aiware-js 1.0.0-master.678 → 1.0.0-master.679

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/js-core.esm.js CHANGED
@@ -1480,4 +1480,4 @@ createScheduledJob(input:{
1480
1480
  }
1481
1481
  `)}),n},[]).join("\r\n")}
1482
1482
  }
1483
- `,l={entityId:t,entityType:e};try{a=yield baseGraphQLApi({query:s,operationName:n,variables:l,graphEndpoint:u,token:d})}catch(e){i=!0}if(a.errors){if(0===(o=a.errors.filter(({message:e})=>e.includes(' does not exist in "AuthPermissionType" enum.')).map(({message:e})=>{var t='Value "',n=e.substring(t.length).indexOf('"');return e.substring(t.length,t.length+n)})).length)throw i=!0,a={},new Error((null==(f=(a.errors||[])[0])?void 0:f.message)||"Error")}else i=!0}const c=a.data||{};return Object.keys(c).map(e=>{var t=e.split("__");return 3===t.length?{fetchedTargetEntityType:t[0],fetchedTargetGroupType:t[1],fetchedTargetAction:t[2],hasPermission:c[e][0].hasPermission}:{fetchedTargetEntityType:t[0],fetchedTargetAction:t[1],hasPermission:c[e][0].hasPermission}}).reduce((e,t)=>{var n=t.fetchedTargetGroupType||t.fetchedTargetEntityType;return t.hasPermission&&(e[n]||(e[n]={}),e[n][t.fetchedTargetAction]=t.hasPermission),e},{})})}function getMyRights(t){return __awaiter(this,void 0,void 0,function*(){var e="getMyRights";return(yield baseGraphQLApiWithError(Object.assign({query:"\n query getMyRights {\n myRights {\n operations\n }\n }\n ",operationName:e},t))).myRights.operations})}const selectPermissionsByEntity=(t,n,r)=>e=>{return t&&n&&(e=e[namespace].permissionsByObject[t])&&e[n]?e[n][r||t]:void 0},selectMyRights=e=>e[namespace].rights;var index=Object.freeze({__proto__:null,selectPermissionsByEntity:selectPermissionsByEntity,selectMyRights:selectMyRights});function*fetchObjectPermissions(t){var{entityId:t,entityType:n}=t.payload,i=yield select(selectApiConfigs$2),e=yield select(graphEndpointSelector),o=yield select(sessionTokenSelector),a=yield select(selectIsOLPEnabled),r=yield select(selectPermissionsByEntity(n,t));if(!r||"success"!==r.status&&"pending"!==r.status){yield put(actions.fetchObjectPermissionsStarted({entityId:t,entityType:n}));try{let r={};if(a)r=yield call$f(getObjectPermissions,e,o,{entityType:n,entityId:t});else{let e=yield select(selectMyRights);if("success"!==e.status&&"pending"!==e.status){yield put(actions.fetchMyRightsStarted);try{var s=yield call$f(getMyRights,i);yield put(actions.fetchMyRightsSucceeded(s)),e=yield select(selectMyRights)}catch(e){throw yield put(actions.fetchMyRightsFailed),e}}else"pending"===e.status&&(yield take([actions.fetchMyRightsFailed,actions.fetchMyRightsSucceeded]),e=yield select(selectMyRights));const l=e["myRights"];getPermissionTypesToQuery(n).forEach(n=>{var{action:e,resource:t}=n.targetActions.reduce((e,t)=>(e.action[t.targetAction]=convertPermissionsToRights(t.resource||n.targetObjectType,t.targetAction,l),e.resource=t.resource,e),{action:{}});r[t||n.targetObjectType]=e})}yield put(actions.fetchObjectPermissionsSucceeded({entityId:t,entityType:n,permissions:r}))}catch(e){actions.fetchObjectPermissionsFailed({entityId:t,entityType:n})}}}function*watchPermissionsStart(){yield takeEvery$1(actions.fetchObjectPermissionsStart.type,fetchObjectPermissions)}function*rootSaga(){yield all([watchPermissionsStart()])}function getPermissionsModule(){return{id:namespace,reducerMap:{[namespace]:permissionsReducer},sagas:[rootSaga],initialActions:[]}}const useOrganizationPermissions=e=>{const t=react.exports.useRef(),n=useDispatch(),r=null==(o=useSelector(userSelector$2).organization)?void 0:o.organizationId,i=useSelector(selectPermissionsByEntity(EAuthResourceType.Organization,String(r),e));react.exports.useEffect(()=>{!r||i&&"failure"!==i.status&&"idle"!==i.status&&t.current===r||(t.current=r,n(actions.fetchObjectPermissionsStart({entityType:EAuthResourceType.Organization,entityId:String(r)})))},[n,r,i]);var o=react.exports.useCallback(e=>{return!isPermissionLoading(i)&&hasPermission(i,e)},[i]);return{permissions:i,hasPermission:o}},rateLimiter=new RateLimiter,checkAndDecodeBase64String=t=>{if(null==t||!t.trim())return t;try{return window.btoa(window.atob(t))==t?window.atob(t):t}catch(e){return t}};function SnackbarRenderer(){return jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getSnackbarModule()]},{children:jsxRuntime.exports.jsx(CustomSnackbar,{})}))}))}store$4.addModules([getWidgetsModule(),getPanelsModule(registry,registryLookup),getDataModule(),getConfigModule(),getAuthModule(),getPermissionsModule()]);let hasLoaded=!1;const AppBarPreLoader=()=>{var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&!hasLoaded&&(hasLoaded=!0,setTimeout(()=>{store$4.addModules([getAppbarPanelModule()])},0)),null};function ApplicationDialogPreLoader(){var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&hasLoaded?jsxRuntime.exports.jsx(ApplicationDialog,{}):null}const authHelpers={updateToken(e){e?store$4.dispatch(updateTokenRequest({token:e})):console.error("[AiWARE JS]: Please provide a valid token!")},logout(e){"function"==typeof e?(e(),setTimeout(()=>{store$4.dispatch(logout())},1e3)):store$4.dispatch(logout())},reportAppActivity(e){rateLimiter.checkIfCanCall(e)&&store$4.dispatch(updateActivityStatus$1())}};function PortalRenderer(){return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment,{children:[jsxRuntime.exports.jsx(SupportCenterPixel,{}),jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AppBarPreLoader,{})}))]})}function ApplicationDialogRenderer(){return jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment,{children:jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ApplicationDialogPreLoader,{})})}))})}const ThemeInitializer=()=>(useTheme(),null),root=getElement("aiWARE"),reactDOMroot=(root.classList.add("aiware-el"),client$1.createRoot(root)),mountWidget=("_auth"===window.name?handleImplicitRedirect(window.location.hash,window.opener):reactDOMroot.render(jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsxs(AIWareThemeProvider$1,{children:[jsxRuntime.exports.jsx(PortalRenderer,{}),jsxRuntime.exports.jsx(SnackbarRenderer,{}),jsxRuntime.exports.jsx(ApplicationDialogRenderer,{}),jsxRuntime.exports.jsx(ThemeInitializer,{})]})})),(e,t)=>{var n=getUniqueID(),{name:e,elementId:r,config:i}=e;return e&&r&&i||console.error("[aiwarejs-error]: `mountWidget` function should include all the following params: name, elementId, config"),store$4.dispatch(mountWidget$1({elementId:r,widgetName:e,widgetConfig:i,widgetId:n,onComplete:t})),n}),unmountWidget=e=>(store$4.dispatch(unmountWidget$1(e)),!0),mountPanel=(e,t)=>{const n=e.panelId||getUniqueID();var{microFrontend:e,panelConfig:r}=e;store$4.dispatch(mountPanel$1({microFrontend:e,panelId:n,panelConfig:r}));const i=[...(null==(e=null==r?void 0:r.header)?void 0:e.actions)||[],...(null==(e=null==r?void 0:r.footer)?void 0:e.actions)||[]].filter(e=>e.submit).map(e=>e.action);r={id:n,sagas:[function*(){yield takeEvery$1(i.map(e=>e.type),function*(){var e=(yield select(e=>e.data.find(e=>e.id===n)))["data"];t&&t(e)})}]};return store$4.addModule(r),n},unmountPanel=e=>(store$4.dispatch(unmountPanel$1(e)),!0),hidePanel=e=>(store$4.dispatch(hidePanel$1(e)),!0),unmountAllPanel=()=>{store$4.dispatch(unmountAllPanel$1(""))};function init(e,t){var n;validateConfig(e)&&(n=e["authToken"],n=checkAndDecodeBase64String(n||""),store$4.dispatch(getInitConfig(Object.assign(Object.assign({},e),{authToken:n,onComplete:t}))))}function helpCenter(){var e=new HelpCenter$2({actions:{setCustomKnowledgeBaseUrlAction:setCustomKnowledgeBaseUrl,setCustomDocsUrlAction:setCustomDocsUrl,updateSelectedTabAction:updateSelectedTab}});return{openKnowledgeBasePanel:e.openKnowledgeBasePanel.bind(e),openDocsPanel:e.openDocsPanel.bind(e)}}function dataCenter(){var e=new DataCenter$1;return{openImporterPanel:e.openImporterPanel.bind(e)}}function handleEvents(){function n(e){if(!e||"string"!=typeof e)throw new SdkError("Please provide a valid event name!");if(!SdkEvents[e])throw new SdkError("Unknown event: "+e)}return{on:function(e,t){n(e),sdkEventManager.on.call(sdkEventManager,e,t)},off:function(e){n(e),sdkEventManager.off.call(sdkEventManager,e)}}}const mountPanelForResponse=e=>mountPanelForResponse$1(e,store$4),aiwareEvents=handleEvents();window&&(window.aiWare_initTesting=()=>{window.aiWare_store=store$4,window.aiWare_theme={darkTheme:darkTheme$1,lightTheme:lightTheme$1}},window.aiware={init:init,auth:authHelpers,helpCenter:helpCenter(),dataCenter:dataCenter(),on:aiwareEvents.on,off:aiwareEvents.off,hidePanel:hidePanel,unmountPanel:unmountPanel,store:store$4,registry:registry,registerComponent:registerComponent,AvailableWidgets:AvailableWidgets,mountPanelAction:mountPanel$1,unmountPanelAction:unmountPanel$1,hidePanelAction:hidePanel$1,updatePanelMicroFrontendPropsAction:updatePanelMicroFrontendProps,setData:setData,mountWidget:mountWidget,mountPanel:mountPanel,mountPanelForResponse:mountPanelForResponse,unmountWidget:unmountWidget,version:"sdk_release_version",commit:"5e5d41659",releaseDate:"2023-06-26T16:57:56.934Z"});export{DynamicModuleLoader as $,AIWareIntlProvider as A,Box$1 as B,resetPasswordRequest as C,InputAdornment$1 as D,IconButton$1 as E,FormattedMessage$1 as F,Grid$1 as G,Select$1 as H,InputLabel$1 as I,Location as J,Button$1 as K,LoadingButton$1 as L,MenuItem$1 as M,Divider$1 as N,OutlinedInput$1 as O,Provider$2 as P,createTheme$1 as Q,systemStyled as R,Switch$1 as S,Typography$1 as T,useThemeProps$1 as U,createAction as V,createReducer as W,createSlice as X,ENGINE_OWNER_TYPES as Y,ENGINE_FILTER_TYPES as Z,_extends as _,generateUtilityClasses as a,img$p as a$,preferredLanguageSelector as a0,baseUrlSelector as a1,rootApiSelector as a2,sessionTokenSelector as a3,graphEndpointSelector as a4,controllerNodeRedImageSelector as a5,controllerUrlSelector as a6,automateControllerUrlSelector as a7,flowCenterDialogSelector as a8,automateUrlSelector as a9,FormGroup$1 as aA,FormControlLabel$1 as aB,Checkbox$1 as aC,fetchTemplateGalleryFallback as aD,Card$1 as aE,CardContent$1 as aF,img$l as aG,CardActions$1 as aH,flowStyles as aI,NoResults as aJ,CircularProgress$1 as aK,img$b as aL,Dialog$1 as aM,setApiEndpoint as aN,TableContainer$1 as aO,Table$1 as aP,TableHead$1 as aQ,TableRow$1 as aR,TableCell$1 as aS,TableSortLabel$1 as aT,TableBody$1 as aU,img$g as aV,default_1 as aW,Popper$1 as aX,ClickAwayListener as aY,Fade$1 as aZ,img$s as a_,Portal$1 as aa,flowCenterDialogReducer as ab,List$2 as ac,ListItem$1 as ad,ListItemIcon$1 as ae,ListItemText$1 as af,flowCenterDialogAction as ag,all as ah,img$n as ai,img$o as aj,img$q as ak,img$r as al,Tooltip$1 as am,img$h as an,img$F as ao,Skeleton$1 as ap,takeLatest$1 as aq,fetchAllTags as ar,put as as,select as at,fetchFlows as au,call$f as av,fetchTemplateGallery as aw,isRevisionsExistOnServerRequest as ax,FormLabel$1 as ay,default_1$b as az,styled$1 as b,FormHelperText$2 as b$,img$P as b0,img$B as b1,DialogTitle$1 as b2,DialogContent$1 as b3,DialogActions$1 as b4,Snackbar$1 as b5,default_1$6 as b6,img$i as b7,img$k as b8,img$T as b9,__spread as bA,TransitionGroup$1 as bB,connect$1 as bC,Bookmark as bD,EngineFlagIcons as bE,createAsyncThunk as bF,withStyles as bG,getConfigModule as bH,getAuthModule as bI,getSnackbarModule as bJ,AIWareCacheProvider as bK,img$Q as bL,img$d as bM,img$c as bN,isEmpty_1 as bO,Backdrop$1 as bP,getDefaultMiddleware as bQ,isNil_1 as bR,UpDown as bS,Icon$1 as bT,get_1 as bU,map_1 as bV,keys_1 as bW,RadioGroup$1 as bX,Avatar$1 as bY,img$v as bZ,baseGraphQLApi as b_,Tabs$2 as ba,Tab$2 as bb,deleteEngine as bc,fetchEngine as bd,img$j as be,AIWareFormatMessage as bf,FormattedDate as bg,fetchVeritoneGraphQLApi as bh,useTheme as bi,KeyboardArrowRight as bj,KeyboardArrowLeft as bk,useId as bl,InputUnstyled as bm,isHostComponent as bn,getDefaultExportFromNamespaceIfNotNamed as bo,commonjsRequire as bp,_typeof$4 as bq,_inheritsLoose$2 as br,_assertThisInitialized$1 as bs,React as bt,hoistNonReactStatics_cjs as bu,_defineProperty$1 as bv,reactDom as bw,Transition$1 as bx,__awaiter$d as by,__generator$2 as bz,Paper$1 as c,_stringToArray as c$,img$f as c0,StyledEngineProvider as c1,ThemeProvider as c2,lightTheme$1 as c3,CssBaseline as c4,Hide as c5,has_1 as c6,showMessage as c7,MessageSeverity as c8,Radio$2 as c9,Menu$1 as cA,Edit as cB,Upload as cC,Delete as cD,CustomTabs as cE,useBackupImg as cF,img$1y as cG,validate as cH,configSelector as cI,baseGraphQLApiWithError as cJ,VerifiedFilled as cK,Add as cL,ExpandLess as cM,ExpandMore as cN,Collapse$1 as cO,img$15 as cP,Filter$1 as cQ,DynamicTable as cR,useTheme$3 as cS,getThemeProps as cT,useEnhancedEffect$1 as cU,React$1 as cV,_arrayPush as cW,isArray_1 as cX,_baseToString as cY,_baseTrim as cZ,_castSlice as c_,createSvgIcon$2 as ca,_createCompounder as cb,_baseIteratee as cc,isArrayLike_1 as cd,toInteger_1 as ce,_toPropertyKey as cf,_setPrototypeOf$3 as cg,commonjsGlobal$1 as ch,combineReducers as ci,createSelector$1 as cj,fork as ck,AIWareThemeProvider$1 as cl,Stack$4 as cm,Close$1 as cn,FullscreenExit as co,Fullscreen as cp,TabPanel as cq,default_1$8 as cr,unmountPanel$1 as cs,AvailableComponents as ct,delay$1 as cu,hidePanel$1 as cv,mountPanel$1 as cw,DialogContentText$1 as cx,userSelector$2 as cy,MoreVert$1 as cz,capitalize$2 as d,_overArg as d$,toString_1 as d0,ReactIs as d1,upperFirst_1 as d2,isString_1 as d3,_baseGet as d4,_baseSlice as d5,_castPath as d6,_toKey as d7,_isIndex as d8,channel$1 as d9,useForkRef as dA,getDefaultExportFromCjs as dB,isObject_1 as dC,MoreHor as dD,takeEvery$1 as dE,EngineCategoryIcons as dF,selectApiConfigs$2 as dG,panelsSelector as dH,tabsClasses$1 as dI,AlarmTwo as dJ,EditList as dK,Chip$1 as dL,usePreviousProps$1 as dM,setRef as dN,inputClasses$1 as dO,inputBaseClasses$1 as dP,outlinedInputClasses$1 as dQ,filledInputClasses$1 as dR,ClearIcon as dS,ArrowDropDownIcon as dT,_arrayMap as dU,_baseEach as dV,_arrayFilter as dW,_getNative as dX,eq_1 as dY,_root as dZ,_Uint8Array as d_,useIntl as da,VideoCamera as db,Image$1 as dc,Sound as dd,Description as de,toNumber_1 as df,ProgressStepper as dg,size_1 as dh,take as di,CurlyBraces as dj,UnknownDocument as dk,sdkEventManager as dl,SdkEvents as dm,SdkError as dn,EngineClassIcons as dp,Mode2 as dq,EngineModeIcons as dr,DeploymentModelIcons as ds,guid as dt,forceReflow as du,alpha as dv,useTheme$2 as dw,useControlled as dx,useEventCallback as dy,ButtonBase$1 as dz,_objectWithoutPropertiesLoose$2 as e,MoveFolder as e$,_isPrototype as e0,isObjectLike_1 as e1,_baseGetTag as e2,_arrayLikeKeys as e3,isArguments_1 as e4,isBuffer$3 as e5,isFunction_1 as e6,isTypedArray_1 as e7,_Stack as e8,_baseFor as e9,emphasize as eA,useSlotProps as eB,_arraySome as eC,EntityType as eD,injectIntl as eE,ErrorBoundary$1 as eF,EPermissionAction as eG,Process as eH,Information as eI,NewFolder as eJ,SpecialFolder as eK,User as eL,Source as eM,Search$1 as eN,selectIsOLPEnabled as eO,ListItemSecondaryAction$1 as eP,getLibraryModule as eQ,cmsUrlSelector as eR,betaFeaturesSelector as eS,SearchStructuredData as eT,Grow$1 as eU,index as eV,actions as eW,hasPermission as eX,UserAddFilled as eY,Popover$1 as eZ,MenuList$1 as e_,identity_1 as ea,_isIterateeCall as eb,isSymbol_1 as ec,_baseMap as ed,_baseUnary as ee,memoizeOne as ef,createBox$1 as eg,StepperContext$1 as eh,StepContext$1 as ei,SvgIcon$1 as ej,StepConnector$1 as ek,_Symbol as el,_Set as em,_setToArray as en,_SetCache as eo,_cacheHas as ep,img$M as eq,img$L as er,img$1u as es,img$1t as et,img$1s as eu,img$J as ev,img$1w as ew,img$I as ex,authSelector as ey,ListItemAvatar$1 as ez,clsx as f,ArrowDown as f$,EAuthResourceType as f0,Slide$1 as f1,img$9 as f2,selectPanelByPanelName as f3,FullScreenContainer as f4,isPermissionLoading as f5,Settings$2 as f6,Hamburger as f7,List as f8,Download as f9,NullState$2 as fA,Group as fB,PermissionChangedAction as fC,Lock as fD,useOrganizationPermissions as fE,EAuthSubResourceType as fF,AddGroup as fG,initialConfigSelector as fH,ConfirmationModal as fI,EnumHelpers as fJ,formatBytes as fK,LinearProgress$1 as fL,NotInterested as fM,mountPanelForResponse$1 as fN,Users as fO,ApplicationTabIcon as fP,SecurityGroup as fQ,getOrganizationPanelModule as fR,Lock2 as fS,NoApps as fT,green$1 as fU,md5 as fV,selectIsSuperAdmin as fW,organizations_selector as fX,actions$5 as fY,AddUser as fZ,ArrowUp as f_,Badge$1 as fa,convertEntityToAuthResource as fb,selectUserOrgEdgeVersion as fc,EditAttributes as fd,gqlIntrospection as fe,ProcessingDetail as ff,img$u as fg,img$w as fh,img$3 as fi,FilterRemove as fj,CheckCircle as fk,FolderOpen as fl,Voice as fm,useDoubleClick as fn,FolderFilled as fo,Time as fp,img$x as fq,Undefined as fr,PodcastSource as fs,YoutubeSource as ft,TVSource as fu,RadioSource as fv,selectOrgId as fw,selectIsUserAdmin as fx,AvatarGroup$1 as fy,ErrorState$2 as fz,generateUtilityClass as g,selectors as g0,LibraryDropdown as g1,Remove as g2,Save as g3,Input$3 as g4,Copy as g5,ArrowForward as g6,Modal$1 as g7,_baseIsEqual as g8,Slider$1 as g9,useSyncExternalStoreExports as gA,Packages as gB,Resources$1 as gC,selectUserCanCreatePackage as gD,Engines as gE,PackagesAvatar as gF,actionChannel as gG,cancelled as gH,flush$3 as gI,cancel as gJ,FlowCenter2 as gK,registry as gL,registerComponent as gM,AvailableWidgets as gN,updatePanelMicroFrontendProps as gO,setData as gP,root as gQ,mountWidget as gR,unmountWidget as gS,mountPanel as gT,unmountPanel as gU,hidePanel as gV,unmountAllPanel as gW,init as gX,aiwareEvents as gY,_getSymbols as ga,stubArray_1 as gb,_baseGetAllKeys as gc,_getTag as gd,_nodeUtil as ge,_getAllKeys as gf,_castFunction as gg,Article as gh,Task as gi,View as gj,_objectSpread2 as gk,serialize as gl,stringify$2 as gm,compile as gn,Check as go,FormattedRelativeTime$1 as gp,BottomQueue as gq,TopQueue as gr,Pause as gs,Cancel as gt,Folder as gu,Hidden as gv,toFinite_1 as gw,_baseForOwn as gx,_arrayReduce as gy,hasIn_1 as gz,composeClasses as h,createSvgIcon$1 as i,jsxRuntime as j,interopRequireDefault as k,useDispatch as l,makeStyles as m,useSelector as n,authStatusSelector as o,authContextSelector as p,AuthContext as q,react as r,store$4 as s,lodash as t,useThemeProps as u,Alert$1 as v,authErrorMessage as w,FormControl$1 as x,TextField$1 as y,classNames as z};
1483
+ `,l={entityId:t,entityType:e};try{a=yield baseGraphQLApi({query:s,operationName:n,variables:l,graphEndpoint:u,token:d})}catch(e){i=!0}if(a.errors){if(0===(o=a.errors.filter(({message:e})=>e.includes(' does not exist in "AuthPermissionType" enum.')).map(({message:e})=>{var t='Value "',n=e.substring(t.length).indexOf('"');return e.substring(t.length,t.length+n)})).length)throw i=!0,a={},new Error((null==(f=(a.errors||[])[0])?void 0:f.message)||"Error")}else i=!0}const c=a.data||{};return Object.keys(c).map(e=>{var t=e.split("__");return 3===t.length?{fetchedTargetEntityType:t[0],fetchedTargetGroupType:t[1],fetchedTargetAction:t[2],hasPermission:c[e][0].hasPermission}:{fetchedTargetEntityType:t[0],fetchedTargetAction:t[1],hasPermission:c[e][0].hasPermission}}).reduce((e,t)=>{var n=t.fetchedTargetGroupType||t.fetchedTargetEntityType;return t.hasPermission&&(e[n]||(e[n]={}),e[n][t.fetchedTargetAction]=t.hasPermission),e},{})})}function getMyRights(t){return __awaiter(this,void 0,void 0,function*(){var e="getMyRights";return(yield baseGraphQLApiWithError(Object.assign({query:"\n query getMyRights {\n myRights {\n operations\n }\n }\n ",operationName:e},t))).myRights.operations})}const selectPermissionsByEntity=(t,n,r)=>e=>{return t&&n&&(e=e[namespace].permissionsByObject[t])&&e[n]?e[n][r||t]:void 0},selectMyRights=e=>e[namespace].rights;var index=Object.freeze({__proto__:null,selectPermissionsByEntity:selectPermissionsByEntity,selectMyRights:selectMyRights});function*fetchObjectPermissions(t){var{entityId:t,entityType:n}=t.payload,i=yield select(selectApiConfigs$2),e=yield select(graphEndpointSelector),o=yield select(sessionTokenSelector),a=yield select(selectIsOLPEnabled),r=yield select(selectPermissionsByEntity(n,t));if(!r||"success"!==r.status&&"pending"!==r.status){yield put(actions.fetchObjectPermissionsStarted({entityId:t,entityType:n}));try{let r={};if(a)r=yield call$f(getObjectPermissions,e,o,{entityType:n,entityId:t});else{let e=yield select(selectMyRights);if("success"!==e.status&&"pending"!==e.status){yield put(actions.fetchMyRightsStarted);try{var s=yield call$f(getMyRights,i);yield put(actions.fetchMyRightsSucceeded(s)),e=yield select(selectMyRights)}catch(e){throw yield put(actions.fetchMyRightsFailed),e}}else"pending"===e.status&&(yield take([actions.fetchMyRightsFailed,actions.fetchMyRightsSucceeded]),e=yield select(selectMyRights));const l=e["myRights"];getPermissionTypesToQuery(n).forEach(n=>{var{action:e,resource:t}=n.targetActions.reduce((e,t)=>(e.action[t.targetAction]=convertPermissionsToRights(t.resource||n.targetObjectType,t.targetAction,l),e.resource=t.resource,e),{action:{}});r[t||n.targetObjectType]=e})}yield put(actions.fetchObjectPermissionsSucceeded({entityId:t,entityType:n,permissions:r}))}catch(e){actions.fetchObjectPermissionsFailed({entityId:t,entityType:n})}}}function*watchPermissionsStart(){yield takeEvery$1(actions.fetchObjectPermissionsStart.type,fetchObjectPermissions)}function*rootSaga(){yield all([watchPermissionsStart()])}function getPermissionsModule(){return{id:namespace,reducerMap:{[namespace]:permissionsReducer},sagas:[rootSaga],initialActions:[]}}const useOrganizationPermissions=e=>{const t=react.exports.useRef(),n=useDispatch(),r=null==(o=useSelector(userSelector$2).organization)?void 0:o.organizationId,i=useSelector(selectPermissionsByEntity(EAuthResourceType.Organization,String(r),e));react.exports.useEffect(()=>{!r||i&&"failure"!==i.status&&"idle"!==i.status&&t.current===r||(t.current=r,n(actions.fetchObjectPermissionsStart({entityType:EAuthResourceType.Organization,entityId:String(r)})))},[n,r,i]);var o=react.exports.useCallback(e=>{return!isPermissionLoading(i)&&hasPermission(i,e)},[i]);return{permissions:i,hasPermission:o}},rateLimiter=new RateLimiter,checkAndDecodeBase64String=t=>{if(null==t||!t.trim())return t;try{return window.btoa(window.atob(t))==t?window.atob(t):t}catch(e){return t}};function SnackbarRenderer(){return jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getSnackbarModule()]},{children:jsxRuntime.exports.jsx(CustomSnackbar,{})}))}))}store$4.addModules([getWidgetsModule(),getPanelsModule(registry,registryLookup),getDataModule(),getConfigModule(),getAuthModule(),getPermissionsModule()]);let hasLoaded=!1;const AppBarPreLoader=()=>{var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&!hasLoaded&&(hasLoaded=!0,setTimeout(()=>{store$4.addModules([getAppbarPanelModule()])},0)),null};function ApplicationDialogPreLoader(){var e=useSelector(authSelector);return(null==(e=null==e?void 0:e.user)?void 0:e.token)&&hasLoaded?jsxRuntime.exports.jsx(ApplicationDialog,{}):null}const authHelpers={updateToken(e){e?store$4.dispatch(updateTokenRequest({token:e})):console.error("[AiWARE JS]: Please provide a valid token!")},logout(e){"function"==typeof e?(e(),setTimeout(()=>{store$4.dispatch(logout())},1e3)):store$4.dispatch(logout())},reportAppActivity(e){rateLimiter.checkIfCanCall(e)&&store$4.dispatch(updateActivityStatus$1())}};function PortalRenderer(){return jsxRuntime.exports.jsxs(jsxRuntime.exports.Fragment,{children:[jsxRuntime.exports.jsx(SupportCenterPixel,{}),jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AppBarPreLoader,{})}))]})}function ApplicationDialogRenderer(){return jsxRuntime.exports.jsx(jsxRuntime.exports.Fragment,{children:jsxRuntime.exports.jsx(Provider$2,Object.assign({store:store$4},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ApplicationDialogPreLoader,{})})}))})}const ThemeInitializer=()=>(useTheme(),null),root=getElement("aiWARE"),reactDOMroot=(root.classList.add("aiware-el"),client$1.createRoot(root)),mountWidget=("_auth"===window.name?handleImplicitRedirect(window.location.hash,window.opener):reactDOMroot.render(jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsxs(AIWareThemeProvider$1,{children:[jsxRuntime.exports.jsx(PortalRenderer,{}),jsxRuntime.exports.jsx(SnackbarRenderer,{}),jsxRuntime.exports.jsx(ApplicationDialogRenderer,{}),jsxRuntime.exports.jsx(ThemeInitializer,{})]})})),(e,t)=>{var n=getUniqueID(),{name:e,elementId:r,config:i}=e;return e&&r&&i||console.error("[aiwarejs-error]: `mountWidget` function should include all the following params: name, elementId, config"),store$4.dispatch(mountWidget$1({elementId:r,widgetName:e,widgetConfig:i,widgetId:n,onComplete:t})),n}),unmountWidget=e=>(store$4.dispatch(unmountWidget$1(e)),!0),mountPanel=(e,t)=>{const n=e.panelId||getUniqueID();var{microFrontend:e,panelConfig:r}=e;store$4.dispatch(mountPanel$1({microFrontend:e,panelId:n,panelConfig:r}));const i=[...(null==(e=null==r?void 0:r.header)?void 0:e.actions)||[],...(null==(e=null==r?void 0:r.footer)?void 0:e.actions)||[]].filter(e=>e.submit).map(e=>e.action);r={id:n,sagas:[function*(){yield takeEvery$1(i.map(e=>e.type),function*(){var e=(yield select(e=>e.data.find(e=>e.id===n)))["data"];t&&t(e)})}]};return store$4.addModule(r),n},unmountPanel=e=>(store$4.dispatch(unmountPanel$1(e)),!0),hidePanel=e=>(store$4.dispatch(hidePanel$1(e)),!0),unmountAllPanel=()=>{store$4.dispatch(unmountAllPanel$1(""))};function init(e,t){var n;validateConfig(e)&&(n=e["authToken"],n=checkAndDecodeBase64String(n||""),store$4.dispatch(getInitConfig(Object.assign(Object.assign({},e),{authToken:n,onComplete:t}))))}function helpCenter(){var e=new HelpCenter$2({actions:{setCustomKnowledgeBaseUrlAction:setCustomKnowledgeBaseUrl,setCustomDocsUrlAction:setCustomDocsUrl,updateSelectedTabAction:updateSelectedTab}});return{openKnowledgeBasePanel:e.openKnowledgeBasePanel.bind(e),openDocsPanel:e.openDocsPanel.bind(e)}}function dataCenter(){var e=new DataCenter$1;return{openImporterPanel:e.openImporterPanel.bind(e)}}function handleEvents(){function n(e){if(!e||"string"!=typeof e)throw new SdkError("Please provide a valid event name!");if(!SdkEvents[e])throw new SdkError("Unknown event: "+e)}return{on:function(e,t){n(e),sdkEventManager.on.call(sdkEventManager,e,t)},off:function(e){n(e),sdkEventManager.off.call(sdkEventManager,e)}}}const mountPanelForResponse=e=>mountPanelForResponse$1(e,store$4),aiwareEvents=handleEvents();window&&(window.aiWare_initTesting=()=>{window.aiWare_store=store$4,window.aiWare_theme={darkTheme:darkTheme$1,lightTheme:lightTheme$1}},window.aiware={init:init,auth:authHelpers,helpCenter:helpCenter(),dataCenter:dataCenter(),on:aiwareEvents.on,off:aiwareEvents.off,hidePanel:hidePanel,unmountPanel:unmountPanel,store:store$4,registry:registry,registerComponent:registerComponent,AvailableWidgets:AvailableWidgets,mountPanelAction:mountPanel$1,unmountPanelAction:unmountPanel$1,hidePanelAction:hidePanel$1,updatePanelMicroFrontendPropsAction:updatePanelMicroFrontendProps,setData:setData,mountWidget:mountWidget,mountPanel:mountPanel,mountPanelForResponse:mountPanelForResponse,unmountWidget:unmountWidget,version:"sdk_release_version",commit:"5d9e33dca",releaseDate:"2023-06-26T19:56:35.158Z"});export{DynamicModuleLoader as $,AIWareIntlProvider as A,Box$1 as B,resetPasswordRequest as C,InputAdornment$1 as D,IconButton$1 as E,FormattedMessage$1 as F,Grid$1 as G,Select$1 as H,InputLabel$1 as I,Location as J,Button$1 as K,LoadingButton$1 as L,MenuItem$1 as M,Divider$1 as N,OutlinedInput$1 as O,Provider$2 as P,createTheme$1 as Q,systemStyled as R,Switch$1 as S,Typography$1 as T,useThemeProps$1 as U,createAction as V,createReducer as W,createSlice as X,ENGINE_OWNER_TYPES as Y,ENGINE_FILTER_TYPES as Z,_extends as _,generateUtilityClasses as a,img$p as a$,preferredLanguageSelector as a0,baseUrlSelector as a1,rootApiSelector as a2,sessionTokenSelector as a3,graphEndpointSelector as a4,controllerNodeRedImageSelector as a5,controllerUrlSelector as a6,automateControllerUrlSelector as a7,flowCenterDialogSelector as a8,automateUrlSelector as a9,FormGroup$1 as aA,FormControlLabel$1 as aB,Checkbox$1 as aC,fetchTemplateGalleryFallback as aD,Card$1 as aE,CardContent$1 as aF,img$l as aG,CardActions$1 as aH,flowStyles as aI,NoResults as aJ,CircularProgress$1 as aK,img$b as aL,Dialog$1 as aM,setApiEndpoint as aN,TableContainer$1 as aO,Table$1 as aP,TableHead$1 as aQ,TableRow$1 as aR,TableCell$1 as aS,TableSortLabel$1 as aT,TableBody$1 as aU,img$g as aV,default_1 as aW,Popper$1 as aX,ClickAwayListener as aY,Fade$1 as aZ,img$s as a_,Portal$1 as aa,flowCenterDialogReducer as ab,List$2 as ac,ListItem$1 as ad,ListItemIcon$1 as ae,ListItemText$1 as af,flowCenterDialogAction as ag,all as ah,img$n as ai,img$o as aj,img$q as ak,img$r as al,Tooltip$1 as am,img$h as an,img$F as ao,Skeleton$1 as ap,takeLatest$1 as aq,fetchAllTags as ar,put as as,select as at,fetchFlows as au,call$f as av,fetchTemplateGallery as aw,isRevisionsExistOnServerRequest as ax,FormLabel$1 as ay,default_1$b as az,styled$1 as b,FormHelperText$2 as b$,img$P as b0,img$B as b1,DialogTitle$1 as b2,DialogContent$1 as b3,DialogActions$1 as b4,Snackbar$1 as b5,default_1$6 as b6,img$i as b7,img$k as b8,img$T as b9,__spread as bA,TransitionGroup$1 as bB,connect$1 as bC,Bookmark as bD,EngineFlagIcons as bE,createAsyncThunk as bF,withStyles as bG,getConfigModule as bH,getAuthModule as bI,getSnackbarModule as bJ,AIWareCacheProvider as bK,img$Q as bL,img$d as bM,img$c as bN,isEmpty_1 as bO,Backdrop$1 as bP,getDefaultMiddleware as bQ,isNil_1 as bR,UpDown as bS,Icon$1 as bT,get_1 as bU,map_1 as bV,keys_1 as bW,RadioGroup$1 as bX,Avatar$1 as bY,img$v as bZ,baseGraphQLApi as b_,Tabs$2 as ba,Tab$2 as bb,deleteEngine as bc,fetchEngine as bd,img$j as be,AIWareFormatMessage as bf,FormattedDate as bg,fetchVeritoneGraphQLApi as bh,useTheme as bi,KeyboardArrowRight as bj,KeyboardArrowLeft as bk,useId as bl,InputUnstyled as bm,isHostComponent as bn,getDefaultExportFromNamespaceIfNotNamed as bo,commonjsRequire as bp,_typeof$4 as bq,_inheritsLoose$2 as br,_assertThisInitialized$1 as bs,React as bt,hoistNonReactStatics_cjs as bu,_defineProperty$1 as bv,reactDom as bw,Transition$1 as bx,__awaiter$d as by,__generator$2 as bz,Paper$1 as c,_stringToArray as c$,img$f as c0,StyledEngineProvider as c1,ThemeProvider as c2,lightTheme$1 as c3,CssBaseline as c4,Hide as c5,has_1 as c6,showMessage as c7,MessageSeverity as c8,Radio$2 as c9,Menu$1 as cA,Edit as cB,Upload as cC,Delete as cD,CustomTabs as cE,useBackupImg as cF,img$1y as cG,validate as cH,configSelector as cI,baseGraphQLApiWithError as cJ,VerifiedFilled as cK,Add as cL,ExpandLess as cM,ExpandMore as cN,Collapse$1 as cO,img$15 as cP,Filter$1 as cQ,DynamicTable as cR,useTheme$3 as cS,getThemeProps as cT,useEnhancedEffect$1 as cU,React$1 as cV,_arrayPush as cW,isArray_1 as cX,_baseToString as cY,_baseTrim as cZ,_castSlice as c_,createSvgIcon$2 as ca,_createCompounder as cb,_baseIteratee as cc,isArrayLike_1 as cd,toInteger_1 as ce,_toPropertyKey as cf,_setPrototypeOf$3 as cg,commonjsGlobal$1 as ch,combineReducers as ci,createSelector$1 as cj,fork as ck,AIWareThemeProvider$1 as cl,Stack$4 as cm,Close$1 as cn,FullscreenExit as co,Fullscreen as cp,TabPanel as cq,default_1$8 as cr,unmountPanel$1 as cs,AvailableComponents as ct,delay$1 as cu,hidePanel$1 as cv,mountPanel$1 as cw,DialogContentText$1 as cx,userSelector$2 as cy,MoreVert$1 as cz,capitalize$2 as d,_overArg as d$,toString_1 as d0,ReactIs as d1,upperFirst_1 as d2,isString_1 as d3,_baseGet as d4,_baseSlice as d5,_castPath as d6,_toKey as d7,_isIndex as d8,channel$1 as d9,useForkRef as dA,getDefaultExportFromCjs as dB,isObject_1 as dC,MoreHor as dD,takeEvery$1 as dE,EngineCategoryIcons as dF,selectApiConfigs$2 as dG,panelsSelector as dH,tabsClasses$1 as dI,AlarmTwo as dJ,EditList as dK,Chip$1 as dL,usePreviousProps$1 as dM,setRef as dN,inputClasses$1 as dO,inputBaseClasses$1 as dP,outlinedInputClasses$1 as dQ,filledInputClasses$1 as dR,ClearIcon as dS,ArrowDropDownIcon as dT,_arrayMap as dU,_baseEach as dV,_arrayFilter as dW,_getNative as dX,eq_1 as dY,_root as dZ,_Uint8Array as d_,useIntl as da,VideoCamera as db,Image$1 as dc,Sound as dd,Description as de,toNumber_1 as df,ProgressStepper as dg,size_1 as dh,take as di,CurlyBraces as dj,UnknownDocument as dk,sdkEventManager as dl,SdkEvents as dm,SdkError as dn,EngineClassIcons as dp,Mode2 as dq,EngineModeIcons as dr,DeploymentModelIcons as ds,guid as dt,forceReflow as du,alpha as dv,useTheme$2 as dw,useControlled as dx,useEventCallback as dy,ButtonBase$1 as dz,_objectWithoutPropertiesLoose$2 as e,MoveFolder as e$,_isPrototype as e0,isObjectLike_1 as e1,_baseGetTag as e2,_arrayLikeKeys as e3,isArguments_1 as e4,isBuffer$3 as e5,isFunction_1 as e6,isTypedArray_1 as e7,_Stack as e8,_baseFor as e9,emphasize as eA,useSlotProps as eB,_arraySome as eC,EntityType as eD,injectIntl as eE,ErrorBoundary$1 as eF,EPermissionAction as eG,Process as eH,Information as eI,NewFolder as eJ,SpecialFolder as eK,User as eL,Source as eM,Search$1 as eN,selectIsOLPEnabled as eO,ListItemSecondaryAction$1 as eP,getLibraryModule as eQ,cmsUrlSelector as eR,betaFeaturesSelector as eS,SearchStructuredData as eT,Grow$1 as eU,index as eV,actions as eW,hasPermission as eX,UserAddFilled as eY,Popover$1 as eZ,MenuList$1 as e_,identity_1 as ea,_isIterateeCall as eb,isSymbol_1 as ec,_baseMap as ed,_baseUnary as ee,memoizeOne as ef,createBox$1 as eg,StepperContext$1 as eh,StepContext$1 as ei,SvgIcon$1 as ej,StepConnector$1 as ek,_Symbol as el,_Set as em,_setToArray as en,_SetCache as eo,_cacheHas as ep,img$M as eq,img$L as er,img$1u as es,img$1t as et,img$1s as eu,img$J as ev,img$1w as ew,img$I as ex,authSelector as ey,ListItemAvatar$1 as ez,clsx as f,ArrowDown as f$,EAuthResourceType as f0,Slide$1 as f1,img$9 as f2,selectPanelByPanelName as f3,FullScreenContainer as f4,isPermissionLoading as f5,Settings$2 as f6,Hamburger as f7,List as f8,Download as f9,NullState$2 as fA,Group as fB,PermissionChangedAction as fC,Lock as fD,useOrganizationPermissions as fE,EAuthSubResourceType as fF,AddGroup as fG,initialConfigSelector as fH,ConfirmationModal as fI,EnumHelpers as fJ,formatBytes as fK,LinearProgress$1 as fL,NotInterested as fM,mountPanelForResponse$1 as fN,Users as fO,ApplicationTabIcon as fP,SecurityGroup as fQ,getOrganizationPanelModule as fR,Lock2 as fS,NoApps as fT,green$1 as fU,md5 as fV,selectIsSuperAdmin as fW,organizations_selector as fX,actions$5 as fY,AddUser as fZ,ArrowUp as f_,Badge$1 as fa,convertEntityToAuthResource as fb,selectUserOrgEdgeVersion as fc,EditAttributes as fd,gqlIntrospection as fe,ProcessingDetail as ff,img$u as fg,img$w as fh,img$3 as fi,FilterRemove as fj,CheckCircle as fk,FolderOpen as fl,Voice as fm,useDoubleClick as fn,FolderFilled as fo,Time as fp,img$x as fq,Undefined as fr,PodcastSource as fs,YoutubeSource as ft,TVSource as fu,RadioSource as fv,selectOrgId as fw,selectIsUserAdmin as fx,AvatarGroup$1 as fy,ErrorState$2 as fz,generateUtilityClass as g,selectors as g0,LibraryDropdown as g1,Remove as g2,Save as g3,Input$3 as g4,Copy as g5,ArrowForward as g6,Modal$1 as g7,_baseIsEqual as g8,Slider$1 as g9,useSyncExternalStoreExports as gA,Packages as gB,Resources$1 as gC,selectUserCanCreatePackage as gD,Engines as gE,PackagesAvatar as gF,actionChannel as gG,cancelled as gH,flush$3 as gI,cancel as gJ,FlowCenter2 as gK,registry as gL,registerComponent as gM,AvailableWidgets as gN,updatePanelMicroFrontendProps as gO,setData as gP,root as gQ,mountWidget as gR,unmountWidget as gS,mountPanel as gT,unmountPanel as gU,hidePanel as gV,unmountAllPanel as gW,init as gX,aiwareEvents as gY,_getSymbols as ga,stubArray_1 as gb,_baseGetAllKeys as gc,_getTag as gd,_nodeUtil as ge,_getAllKeys as gf,_castFunction as gg,Article as gh,Task as gi,View as gj,_objectSpread2 as gk,serialize as gl,stringify$2 as gm,compile as gn,Check as go,FormattedRelativeTime$1 as gp,BottomQueue as gq,TopQueue as gr,Pause as gs,Cancel as gt,Folder as gu,Hidden as gv,toFinite_1 as gw,_baseForOwn as gx,_arrayReduce as gy,hasIn_1 as gz,composeClasses as h,createSvgIcon$1 as i,jsxRuntime as j,interopRequireDefault as k,useDispatch as l,makeStyles as m,useSelector as n,authStatusSelector as o,authContextSelector as p,AuthContext as q,react as r,store$4 as s,lodash as t,useThemeProps as u,Alert$1 as v,authErrorMessage as w,FormControl$1 as x,TextField$1 as y,classNames as z};
package/js-core.esm.js.gz CHANGED
Binary file
package/js-core.esm56.js CHANGED
@@ -1,5 +1,5 @@
1
- import{i as createSvgIcon,k as interopRequireDefault,j as jsxRuntime,X as createSlice,t as lodash,ci as combineReducers,cj as createSelector,a2 as rootApiSelector,a4 as graphEndpointSelector,a3 as sessionTokenSelector,ck as fork,d9 as channel,m as makeStyles,cl as AIWareThemeProvider,$ as DynamicModuleLoader,A as AIWareIntlProvider,bK as AIWareCacheProvider,aq as takeLatest$1,l as useDispatch,n as useSelector,r as react,B as Box,aK as CircularProgress,a0 as preferredLanguageSelector,G as Grid,T as Typography,F as FormattedMessage,am as Tooltip,E as IconButton,cn as Close,M as MenuItem,bV as map_1,bW as keys_1,K as Button,bU as get_1,cu as delay,as as put,at as select,av as call,c7 as showMessage,c8 as MessageSeverity,cs as unmountPanel,cw as mountPanel,ah as all,dg as ProgressStepper,bf as AIWareFormatMessage,di as take,dL as Chip,aB as FormControlLabel,c9 as Radio,cO as Collapse,cm as Stack,da as useIntl,cJ as baseGraphQLApiWithError,dl as sdkEventManager,dm as SdkEvents,dn as SdkError,aA as FormGroup,x as FormControl,ay as FormLabel,D as InputAdornment,g5 as Copy,g6 as ArrowForward,cG as img$1y,b6 as default_1$2,S as Switch,bO as isEmpty_1,dt as guid}from"./js-core.esm.js";import{i as index,s as set_1,b as InputText,c as InputSelect,S as SchemaOrText,d as InputCheckbox,H as Heading,e as InputRadioGroup,D as DistributionFlags,f as engineFlags,g as uploadFileToS3,h as getSignedWritableUrl,o as orderBy_1,l as lowerCase_1}from"./js-core.esm19.js";import{u as useForm,F as FormProvider}from"./js-core.esm13.js";import{E as EntityTags,L as ListField}from"./js-core.esm21.js";import{a as findIndex_1}from"./js-core.esm14.js";import{d as default_1$1}from"./js-core.esm41.js";import{d as default_1$3}from"./js-core.esm9.js";import{v as v4}from"./js-core.esm42.js";import"./js-core.esm34.js";import"./js-core.esm28.js";import"./js-core.esm26.js";import"./js-core.esm35.js";import"./js-core.esm17.js";import"./js-core.esm27.js";import"./js-core.esm12.js";import"./js-core.esm22.js";import"./js-core.esm29.js";import"./js-core.esm30.js";import"./js-core.esm31.js";import"./js-core.esm23.js";import"./js-core.esm32.js";var ModuleRepo,ModuleStatus,ContextMenuExtensionType,UiInfo,FormStatus,FormValidations,DeploymentModel,IconImportStatus,AppConfigType,AppConfigLevel,VisibilityOffOutlined={},_interopRequireDefault=interopRequireDefault.exports,default_1=(Object.defineProperty(VisibilityOffOutlined,"__esModule",{value:!0}),VisibilityOffOutlined.default=void 0),_createSvgIcon=_interopRequireDefault(createSvgIcon),_jsxRuntime=jsxRuntime.exports,_default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4 1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"}),"VisibilityOffOutlined"),default_1=VisibilityOffOutlined.default=_default;const SLICE_NAME="appCenterNew",namespace$7=(!function(e){e.NPM="npm",e.Github="github"}(ModuleRepo=ModuleRepo||{}),!function(e){e.ACTIVE="active",e.DELETED="deleted"}(ModuleStatus=ModuleStatus||{}),!function(e){e.mention="mention",e.watchlist="watchlist",e.collection="collection",e.tdo="tdo"}(ContextMenuExtensionType=ContextMenuExtensionType||{}),!function(e){e.PanelClosed="closed",e.PanelOpen="open"}(UiInfo=UiInfo||{}),!function(e){e[e.Pending=0]="Pending",e[e.Submitting=1]="Submitting",e[e.Success=2]="Success",e[e.Error=3]="Error"}(FormStatus=FormStatus||{}),!function(e){e.Pending="pending",e.EmptyFieldError="This field should not be empty",e.SpecialCharError="This field cannot contain special characters"}(FormValidations=FormValidations||{}),!function(e){e.FullyNetworkIsolated="FullyNetworkIsolated",e.MostlyNetworkIsolated="MostlyNetworkIsolated",e.NonNetworkIsolated="NonNetworkIsolated",e.HumanReview="HumanReview"}(DeploymentModel=DeploymentModel||{}),!function(e){e.Idle="idle",e.Uploading="uploading",e.Uploaded="uploaded",e.Failed="failed",e.Aborted="aborted"}(IconImportStatus=IconImportStatus||{}),!function(e){e.String="String",e.Boolean="Boolean",e.Date="Date",e.Integer="Integer",e.JSON="JSON",e.Float="Float"}(AppConfigType=AppConfigType||{}),!function(e){e.Organization="Organization",e.User="User"}(AppConfigLevel=AppConfigLevel||{}),"uiState"),initialState$6={status:"idle"},slice$6=createSlice({name:SLICE_NAME+"/"+namespace$7,initialState:initialState$6,reducers:{}}),actions$7=slice$6.actions;var uiState=slice$6.reducer;const namespace$6="appFormState",initialState$5={app:{id:"",configFields:[],contextMenuExtensions:{mentions:[],tdos:[],watchlists:[],collections:[]},contextMenuExtensionIdsForBulkDelete:{ids:[]},name:"",description:"",iconPath:"",url:"",entityTags:[],packageDistributionType:index.DistributionType.Private,headerbarEnabled:!0,applicationHeaderbar:{name:"",config:{backgroundColor:"",logoSrc:"",help:!1,notification:!1}},authMethod:"none",oauthUrl:"",nodeModules:[],flows:[],engines:[],schemas:[],flowsToDelete:[],enginesToDelete:[],schemasToDelete:[]},step:[],isLoadingExistingAppData:!1,isEditForm:!1,isResumeSession:!1,formValidations:FormValidations.Pending,formStatus:FormStatus.Pending,uiInfo:UiInfo.PanelClosed,currentComponents:{engines:[],dataRegistries:[]},apps:[],prevNodeModules:[],prevContextMenuExtensions:{mentions:[],tdos:[],watchlists:[],collections:[]}},slice$5=createSlice({name:SLICE_NAME+"/"+namespace$6,initialState:initialState$5,reducers:{createNewApp(e){e.formStatus=FormStatus.Submitting},editApp(e,t){e.isLoadingExistingAppData=!0,e.isEditForm=!0},setEditAppExistingData(e,t){e.isLoadingExistingAppData=!1,lodash.exports.merge(e.app,t.payload),e.prevNodeModules=t.payload.nodeModules,e.prevContextMenuExtensions=t.payload.contextMenuExtensions},updateAppStart(e,t){e.formStatus=FormStatus.Submitting,e.isEditForm=!0},createAppStart(e,t){e.formStatus=FormStatus.Submitting},createAppSuccess(e,{payload:t}){e.formStatus=FormStatus.Success,lodash.exports.set(e.app,"id",t)},createAppFailed(e,t){e.formStatus=FormStatus.Error},stepper(e,t){e.step=t.payload},updateAppFormField(e,t){var{field:t,value:a}=t.payload;lodash.exports.set(e.app,lodash.exports.camelCase(t),a)},updateApplicationHeaderbar(e,t){var{field:t,value:a}=t.payload;lodash.exports.set(e.app.applicationHeaderbar,t,a)},addConfigField(e,t){e.app.configFields=lodash.exports.concat(e.app.configFields,t.payload)},createConfigField(e,t){e.app.configFields=lodash.exports.concat(e.app.configFields,t.payload.newConfigField)},updateConfigField(e,t){var{configFields:t,index:a}=t.payload;lodash.exports.set(e,`app.configFields[${a}]`,t)},removeConfigField(e,t){e.app.configFields.splice(t.payload.removeIndex,1)},clearConfigFields(e){e.app.configFields=[]},addContextMenuExtension(e,t){var t=t.payload["extension"],a=t.type+"s";e.app.contextMenuExtensions[a]=lodash.exports.concat(e.app.contextMenuExtensions[a],t)},updateContextMenuExtension(e,t){var{extension:t,index:a}=t.payload;lodash.exports.set(e,`app.contextMenuExtensions.${t.type+"s"}[${a}]`,t)},removeContextMenuExtension(e,t){var{extensionType:t,index:a}=t.payload;e.app.contextMenuExtensionIdsForBulkDelete.ids.push(e.app.contextMenuExtensions[t+"s"][a].id),e.app.contextMenuExtensions[t+"s"].splice(a,1)},clearContextMenuExtensions(e){e.app.contextMenuExtensions={mentions:[],tdos:[],watchlists:[],collections:[]}},addNodeModule(e,t){var a=lodash.exports.findIndex(e.app.nodeModules,{moduleName:t.payload.moduleName,status:ModuleStatus.DELETED});0<=a?lodash.exports.set(e,`app.nodeModules[${a}]`,t.payload):e.app.nodeModules=lodash.exports.concat(e.app.nodeModules,t.payload)},updateNodeModule(e,t){var{nodeModules:t,index:a}=t.payload;lodash.exports.set(e,`app.nodeModules[${a}]`,t)},removeNodeModule(e,t){e.app.nodeModules.splice(t.payload,1)},fetchApplications(e,t){e.apps=null==(e=t.payload)?void 0:e.records},resumeSession(e,{payload:t}){lodash.exports.set(e,"app",t),lodash.exports.set(e,"isResumeSession",!0)},clearSession(e){localStorage.removeItem("appOnboardingSession"),lodash.exports.set(e,"app",initialState$5.app)}}}),actions$6=slice$5.actions;var appFormState$1=slice$5.reducer;const namespace$5="flowLinkingPanelState",initialState$4={searchTerm:"",isLoadingSearchResults:!1,sortOrder:"asc",searchResults:[]},slice$4=createSlice({name:SLICE_NAME+"/"+namespace$5,initialState:initialState$4,reducers:{searchByTerm(e,t){set_1(e,"searchTerm",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},toggleSortOrder(e,t){set_1(e,"sortOrder",lodash.exports.isNil(t.payload)?"asc"===e.sortOrder?"desc":"asc":t.payload)},updateFlowLinkingPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)}}}),actions$5=slice$4.actions;var flowLinkingPanelState=slice$4.reducer;const namespace$4="schemaLinkingPanelState",initialState$3={searchTerm:"",isLoadingSearchResults:!1,sortOrder:"asc",searchResults:[]},slice$3=createSlice({name:SLICE_NAME+"/"+namespace$4,initialState:initialState$3,reducers:{searchByTerm(e,t){set_1(e,"searchTerm",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},toggleSortOrder(e,t){set_1(e,"sortOrder",lodash.exports.isNil(t.payload)?"asc"===e.sortOrder?"desc":"asc":t.payload)},updateSchemaLinkingPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)}}}),actions$4=slice$3.actions;var schemaLinkingPanelState=slice$3.reducer;const namespace$3="engineLinkingPanelState",initialState$2={searchTerm:"",isLoadingSearchResults:!1,sortOrder:"asc",searchResults:[]},slice$2=createSlice({name:SLICE_NAME+"/"+namespace$3,initialState:initialState$2,reducers:{searchByTerm(e,t){set_1(e,"searchTerm",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},toggleSortOrder(e,t){set_1(e,"sortOrder",lodash.exports.isNil(t.payload)?"asc"===e.sortOrder?"desc":"asc":t.payload)},updateEngineLinkingPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)}}}),actions$3=slice$2.actions;var engineLinkingPanelState=slice$2.reducer;const namespace$2="appEventsPanelState",initialState$1={getEvents:!1,isLoadingSearchResults:!1,sortOrder:"asc",handlers:[],searchResults:[]},slice$1=createSlice({name:SLICE_NAME+"/"+namespace$2,initialState:initialState$1,reducers:{getEvents(e,t){set_1(e,"getEvents",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},addHandler(e,t){var a=JSON.parse(JSON.stringify(e.handlers)),{eventIds:t,eventNames:s,eventType:i,webhook:n,automateFlowId:o}=t.payload;a.push({eventIds:t,eventNames:s,eventType:i,webhook:n,automateFlowId:o}),set_1(e,"handlers",a)},editHandler(e,t){var{handler:t,index:a}=t.payload;set_1(e,`handlers[${a}]`,t)},deleteHandler(e,t){var t=t.payload,a=JSON.parse(JSON.stringify(e.handlers));a.splice(t,1),set_1(e,"handlers",a)},updateEventsPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)},resumeSession(e,{payload:t}){set_1(e,"handlers",t)}}}),actions$2=slice$1.actions;var eventsPanelState=slice$1.reducer;const namespace$1="iconUploadState",initialState={file:null,status:IconImportStatus.Idle},slice=createSlice({name:SLICE_NAME+"/"+namespace$1,initialState:initialState,reducers:{uploadIconStart(e,{payload:t}){e.file=t.file,e.status=IconImportStatus.Uploading},updateIcon(e,{payload:t}){e.file=Object.assign(Object.assign({},e.file),t)},uploadIconSuccess(e){e.status=IconImportStatus.Uploaded},uploadIconFailed(e,{payload:t}){e.file=null,e.error=t,e.status=IconImportStatus.Failed},deleteLocalIcon(e){e.file=null}}}),actions$1=slice.actions;var iconUploadState=slice.reducer;const namespace=SLICE_NAME,actions={[namespace$7]:actions$7,[namespace$6]:actions$6,[namespace$5]:actions$5,[namespace$4]:actions$4,[namespace$3]:actions$3,[namespace$1]:actions$1,[namespace$2]:actions$2},rootReducer=combineReducers({[namespace$7]:uiState,[namespace$6]:appFormState$1,[namespace$3]:engineLinkingPanelState,[namespace$5]:flowLinkingPanelState,[namespace$4]:schemaLinkingPanelState,[namespace$1]:iconUploadState,[namespace$2]:eventsPanelState}),selectApp=e=>e[namespace].appFormState.app,selectApps=e=>e[namespace].appFormState.apps,selectIsEditForm=e=>lodash.exports.pick(e[namespace].appFormState,"isEditForm"),selectIsLoadingExistingAppData=e=>lodash.exports.pick(e[namespace].appFormState,"isLoadingExistingAppData"),selectConfigFields=e=>e[namespace].appFormState.app.configFields,selectContextMenuExtensions=e=>e[namespace].appFormState.app.contextMenuExtensions,selectAppUrl=e=>e[namespace].appFormState.app.url,selectEntityTags=e=>e[namespace].appFormState.app.entityTags,selectNodeModules=e=>e[namespace].appFormState.app.nodeModules,selectPrevNodeModules=e=>e[namespace].appFormState.prevNodeModules,selectPrevContextMenuExtensions=e=>e[namespace].appFormState.prevContextMenuExtensions,selectIsResumeSession=e=>lodash.exports.get(e[namespace].appFormState,"isResumeSession"),selectAppPackageDistributionType=e=>e[namespace].appFormState.app.packageDistributionType;var appFormState=Object.freeze({__proto__:null,selectApp:selectApp,selectApps:selectApps,selectIsEditForm:selectIsEditForm,selectIsLoadingExistingAppData:selectIsLoadingExistingAppData,selectConfigFields:selectConfigFields,selectContextMenuExtensions:selectContextMenuExtensions,selectAppUrl:selectAppUrl,selectEntityTags:selectEntityTags,selectNodeModules:selectNodeModules,selectPrevNodeModules:selectPrevNodeModules,selectPrevContextMenuExtensions:selectPrevContextMenuExtensions,selectIsResumeSession:selectIsResumeSession,selectAppPackageDistributionType:selectAppPackageDistributionType});const selectEventPanel=e=>e[namespace].appEventsPanelState;var eventPanelState=Object.freeze({__proto__:null,selectEventPanel:selectEventPanel});const selectIcon=e=>e[namespace].iconUploadState.file,selectApiConfigs=createSelector([rootApiSelector,graphEndpointSelector,sessionTokenSelector],(e,t,a)=>({apiRoot:e,graphQLEndpoint:t,token:a}));function __awaiter(e,o,r,p){return new(r=r||Promise)(function(a,t){function s(e){try{n(p.next(e))}catch(e){t(e)}}function i(e){try{n(p.throw(e))}catch(e){t(e)}}function n(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,i)}n((p=p.apply(e,o||[])).next())})}const getEnginesByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getEngines";return yield baseGraphQLApiWithError(Object.assign({query:"\n query getEngines($name:String){\n engines(\n name: $name,\n orderBy: {\n field: name,\n direction: asc\n }\n ) {\n records {\n id\n name\n modifiedDateTime\n edgeVersion\n iconPath\n description\n category {\n id\n }\n }\n }\n }\n ",variables:e,operationName:t},a))}),getFlowsByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getFlows";return yield baseGraphQLApiWithError(Object.assign({query:'\n query getFlows($name:String){\n engines(\n name: $name,\n categoryId: "c5458876-43d2-41e8-a340-f734702df04a",\n orderBy: {\n field: name,\n direction: asc\n }\n ) {\n records {\n id,\n name,\n modifiedDateTime,\n edgeVersion\n }\n }\n }\n ',variables:e,operationName:t},a))}),createApplication=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="createApplication";return(yield baseGraphQLApiWithError(Object.assign(Object.assign({query:"\n mutation createApplication ($input: CreateApplication!) {\n createApplication (input: $input) {\n id\n }\n }\n ",variables:{input:a},operationName:e},t),{throwWholeErrorObject:!0})))[e]}),updateAppComponents=(o,r)=>__awaiter(void 0,void 0,void 0,function*(){const{engines:t,dataRegistries:a,id:s}=r,i="updateApplicationComponent";let n="";lodash.exports.forEach(lodash.exports.keys(t),e=>{lodash.exports.isEmpty(t[e])||(n+=`
2
- ${e}Engines: ${i} (input: {
1
+ import{i as createSvgIcon,k as interopRequireDefault,j as jsxRuntime,X as createSlice,t as lodash,ci as combineReducers,cj as createSelector,a2 as rootApiSelector,a4 as graphEndpointSelector,a3 as sessionTokenSelector,ck as fork,d9 as channel,m as makeStyles,cl as AIWareThemeProvider,$ as DynamicModuleLoader,A as AIWareIntlProvider,bK as AIWareCacheProvider,aq as takeLatest$1,l as useDispatch,n as useSelector,r as react,B as Box,aK as CircularProgress,a0 as preferredLanguageSelector,G as Grid,T as Typography,F as FormattedMessage,am as Tooltip,E as IconButton,cn as Close,M as MenuItem,bV as map_1,bW as keys_1,K as Button,bU as get_1,cu as delay,as as put,at as select,av as call,c7 as showMessage,c8 as MessageSeverity,cs as unmountPanel,cw as mountPanel,ah as all,dg as ProgressStepper,bf as AIWareFormatMessage,di as take,dL as Chip,aB as FormControlLabel,c9 as Radio,cO as Collapse,cm as Stack,da as useIntl,cJ as baseGraphQLApiWithError,dl as sdkEventManager,dm as SdkEvents,dn as SdkError,aA as FormGroup,x as FormControl,ay as FormLabel,D as InputAdornment,g5 as Copy,g6 as ArrowForward,cG as img$1y,b6 as default_1$2,S as Switch,bO as isEmpty_1,dt as guid}from"./js-core.esm.js";import{i as index,s as set_1,b as InputText,c as InputSelect,S as SchemaOrText,d as InputCheckbox,H as Heading,e as InputRadioGroup,D as DistributionFlags,f as engineFlags,g as uploadFileToS3,h as getSignedWritableUrl,o as orderBy_1,l as lowerCase_1}from"./js-core.esm19.js";import{u as useForm,F as FormProvider}from"./js-core.esm13.js";import{E as EntityTags,L as ListField}from"./js-core.esm21.js";import{a as findIndex_1}from"./js-core.esm14.js";import{d as default_1$1}from"./js-core.esm41.js";import{d as default_1$3}from"./js-core.esm9.js";import{v as v4}from"./js-core.esm42.js";import"./js-core.esm34.js";import"./js-core.esm28.js";import"./js-core.esm26.js";import"./js-core.esm35.js";import"./js-core.esm17.js";import"./js-core.esm27.js";import"./js-core.esm12.js";import"./js-core.esm22.js";import"./js-core.esm29.js";import"./js-core.esm30.js";import"./js-core.esm31.js";import"./js-core.esm23.js";import"./js-core.esm32.js";var ModuleRepo,ModuleStatus,ContextMenuExtensionType,UiInfo,FormStatus,FormValidations,DeploymentModel,IconImportStatus,AppConfigType,AppConfigLevel,VisibilityOffOutlined={},_interopRequireDefault=interopRequireDefault.exports,default_1=(Object.defineProperty(VisibilityOffOutlined,"__esModule",{value:!0}),VisibilityOffOutlined.default=void 0),_createSvgIcon=_interopRequireDefault(createSvgIcon),_jsxRuntime=jsxRuntime.exports,_default=(0,_createSvgIcon.default)((0,_jsxRuntime.jsx)("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4 1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"}),"VisibilityOffOutlined"),default_1=VisibilityOffOutlined.default=_default;const SLICE_NAME="appCenterNew",namespace$7=(!function(e){e.NPM="npm",e.Github="github"}(ModuleRepo=ModuleRepo||{}),!function(e){e.ACTIVE="active",e.DELETED="deleted"}(ModuleStatus=ModuleStatus||{}),!function(e){e.mention="mention",e.watchlist="watchlist",e.collection="collection",e.tdo="tdo"}(ContextMenuExtensionType=ContextMenuExtensionType||{}),!function(e){e.PanelClosed="closed",e.PanelOpen="open"}(UiInfo=UiInfo||{}),!function(e){e[e.Pending=0]="Pending",e[e.Submitting=1]="Submitting",e[e.Success=2]="Success",e[e.Error=3]="Error"}(FormStatus=FormStatus||{}),!function(e){e.Pending="pending",e.EmptyFieldError="This field should not be empty",e.SpecialCharError="This field cannot contain special characters"}(FormValidations=FormValidations||{}),!function(e){e.FullyNetworkIsolated="FullyNetworkIsolated",e.MostlyNetworkIsolated="MostlyNetworkIsolated",e.NonNetworkIsolated="NonNetworkIsolated",e.HumanReview="HumanReview"}(DeploymentModel=DeploymentModel||{}),!function(e){e.Idle="idle",e.Uploading="uploading",e.Uploaded="uploaded",e.Failed="failed",e.Aborted="aborted"}(IconImportStatus=IconImportStatus||{}),!function(e){e.String="String",e.Boolean="Boolean",e.Date="Date",e.Integer="Integer",e.JSON="JSON",e.Float="Float"}(AppConfigType=AppConfigType||{}),!function(e){e.Organization="Organization",e.User="User"}(AppConfigLevel=AppConfigLevel||{}),"uiState"),initialState$6={status:"idle"},slice$6=createSlice({name:SLICE_NAME+"/"+namespace$7,initialState:initialState$6,reducers:{}}),actions$7=slice$6.actions;var uiState=slice$6.reducer;const namespace$6="appFormState",initialState$5={app:{id:"",configFields:[],contextMenuExtensions:{mentions:[],tdos:[],watchlists:[],collections:[]},contextMenuExtensionIdsForBulkDelete:{ids:[]},name:"",description:"",iconPath:"",url:"",entityTags:[],packageDistributionType:index.DistributionType.Private,headerbarEnabled:!0,applicationHeaderbar:{name:"",config:{backgroundColor:"",logoSrc:"",help:!1,notification:!1}},authMethod:"none",oauthUrl:"",nodeModules:[],flows:[],engines:[],schemas:[],flowsToDelete:[],enginesToDelete:[],schemasToDelete:[]},step:[],isLoadingExistingAppData:!1,isEditForm:!1,isResumeSession:!1,formValidations:FormValidations.Pending,formStatus:FormStatus.Pending,uiInfo:UiInfo.PanelClosed,currentComponents:{engines:[],dataRegistries:[]},apps:[],prevNodeModules:[],prevContextMenuExtensions:{mentions:[],tdos:[],watchlists:[],collections:[]}},slice$5=createSlice({name:SLICE_NAME+"/"+namespace$6,initialState:initialState$5,reducers:{createNewApp(e){e.formStatus=FormStatus.Submitting},editApp(e,t){e.isLoadingExistingAppData=!0,e.isEditForm=!0},setEditAppExistingData(e,t){e.isLoadingExistingAppData=!1,lodash.exports.merge(e.app,t.payload),e.prevNodeModules=t.payload.nodeModules,e.prevContextMenuExtensions=t.payload.contextMenuExtensions},updateAppStart(e,t){e.formStatus=FormStatus.Submitting,e.isEditForm=!0},createAppStart(e,t){e.formStatus=FormStatus.Submitting},createAppSuccess(e,{payload:t}){e.formStatus=FormStatus.Success,lodash.exports.set(e.app,"id",t)},createAppFailed(e,t){e.formStatus=FormStatus.Error},stepper(e,t){e.step=t.payload},updateAppFormField(e,t){var{field:t,value:a}=t.payload;lodash.exports.set(e.app,lodash.exports.camelCase(t),a)},updateApplicationHeaderbar(e,t){var{field:t,value:a}=t.payload;lodash.exports.set(e.app.applicationHeaderbar,t,a)},addConfigField(e,t){e.app.configFields=lodash.exports.concat(e.app.configFields,t.payload)},createConfigField(e,t){e.app.configFields=lodash.exports.concat(e.app.configFields,t.payload.newConfigField)},updateConfigField(e,t){var{configFields:t,index:a}=t.payload;lodash.exports.set(e,`app.configFields[${a}]`,t)},removeConfigField(e,t){e.app.configFields.splice(t.payload.removeIndex,1)},clearConfigFields(e){e.app.configFields=[]},addContextMenuExtension(e,t){var t=t.payload["extension"],a=t.type+"s";e.app.contextMenuExtensions[a]=lodash.exports.concat(e.app.contextMenuExtensions[a],t)},updateContextMenuExtension(e,t){var{extension:t,index:a}=t.payload;lodash.exports.set(e,`app.contextMenuExtensions.${t.type+"s"}[${a}]`,t)},removeContextMenuExtension(e,t){var{extensionType:t,index:a}=t.payload;e.app.contextMenuExtensionIdsForBulkDelete.ids.push(e.app.contextMenuExtensions[t+"s"][a].id),e.app.contextMenuExtensions[t+"s"].splice(a,1)},clearContextMenuExtensions(e){e.app.contextMenuExtensions={mentions:[],tdos:[],watchlists:[],collections:[]}},addNodeModule(e,t){var a=lodash.exports.findIndex(e.app.nodeModules,{moduleName:t.payload.moduleName,status:ModuleStatus.DELETED});0<=a?lodash.exports.set(e,`app.nodeModules[${a}]`,t.payload):e.app.nodeModules=lodash.exports.concat(e.app.nodeModules,t.payload)},updateNodeModule(e,t){var{nodeModules:t,index:a}=t.payload;lodash.exports.set(e,`app.nodeModules[${a}]`,t)},removeNodeModule(e,t){e.app.nodeModules.splice(t.payload,1)},fetchApplications(e,t){e.apps=null==(e=t.payload)?void 0:e.records},resumeSession(e,{payload:t}){lodash.exports.set(e,"app",t),lodash.exports.set(e,"isResumeSession",!0)},clearSession(e){localStorage.removeItem("appOnboardingSession"),lodash.exports.set(e,"app",initialState$5.app)}}}),actions$6=slice$5.actions;var appFormState$1=slice$5.reducer;const namespace$5="flowLinkingPanelState",initialState$4={searchTerm:"",isLoadingSearchResults:!1,sortOrder:"asc",searchResults:[]},slice$4=createSlice({name:SLICE_NAME+"/"+namespace$5,initialState:initialState$4,reducers:{searchByTerm(e,t){set_1(e,"searchTerm",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},toggleSortOrder(e,t){set_1(e,"sortOrder",lodash.exports.isNil(t.payload)?"asc"===e.sortOrder?"desc":"asc":t.payload)},updateFlowLinkingPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)}}}),actions$5=slice$4.actions;var flowLinkingPanelState=slice$4.reducer;const namespace$4="schemaLinkingPanelState",initialState$3={searchTerm:"",isLoadingSearchResults:!1,sortOrder:"asc",searchResults:[]},slice$3=createSlice({name:SLICE_NAME+"/"+namespace$4,initialState:initialState$3,reducers:{searchByTerm(e,t){set_1(e,"searchTerm",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},toggleSortOrder(e,t){set_1(e,"sortOrder",lodash.exports.isNil(t.payload)?"asc"===e.sortOrder?"desc":"asc":t.payload)},updateSchemaLinkingPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)}}}),actions$4=slice$3.actions;var schemaLinkingPanelState=slice$3.reducer;const namespace$3="engineLinkingPanelState",initialState$2={searchTerm:"",isLoadingSearchResults:!1,sortOrder:"asc",searchResults:[]},slice$2=createSlice({name:SLICE_NAME+"/"+namespace$3,initialState:initialState$2,reducers:{searchByTerm(e,t){set_1(e,"searchTerm",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},toggleSortOrder(e,t){set_1(e,"sortOrder",lodash.exports.isNil(t.payload)?"asc"===e.sortOrder?"desc":"asc":t.payload)},updateEngineLinkingPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)}}}),actions$3=slice$2.actions;var engineLinkingPanelState=slice$2.reducer;const namespace$2="appEventsPanelState",initialState$1={getEvents:!1,isLoadingSearchResults:!1,sortOrder:"asc",handlers:[],searchResults:[]},slice$1=createSlice({name:SLICE_NAME+"/"+namespace$2,initialState:initialState$1,reducers:{getEvents(e,t){set_1(e,"getEvents",t.payload)},fetchingStart(e){set_1(e,"isLoadingSearchResults",!0)},fetchingDone(e){set_1(e,"isLoadingSearchResults",!1)},addHandler(e,t){var a=JSON.parse(JSON.stringify(e.handlers)),{eventIds:t,eventNames:s,eventType:n,webhook:i,automateFlowId:o}=t.payload;a.push({eventIds:t,eventNames:s,eventType:n,webhook:i,automateFlowId:o}),set_1(e,"handlers",a)},editHandler(e,t){var{handler:t,index:a}=t.payload;set_1(e,`handlers[${a}]`,t)},deleteHandler(e,t){var t=t.payload,a=JSON.parse(JSON.stringify(e.handlers));a.splice(t,1),set_1(e,"handlers",a)},updateEventsPanelField(e,t){var{field:t,value:a}=t.payload;set_1(e,t,a)},resumeSession(e,{payload:t}){set_1(e,"handlers",t)}}}),actions$2=slice$1.actions;var eventsPanelState=slice$1.reducer;const namespace$1="iconUploadState",initialState={file:null,status:IconImportStatus.Idle},slice=createSlice({name:SLICE_NAME+"/"+namespace$1,initialState:initialState,reducers:{uploadIconStart(e,{payload:t}){e.file=t.file,e.status=IconImportStatus.Uploading},updateIcon(e,{payload:t}){e.file=Object.assign(Object.assign({},e.file),t)},uploadIconSuccess(e){e.status=IconImportStatus.Uploaded},uploadIconFailed(e,{payload:t}){e.file=null,e.error=t,e.status=IconImportStatus.Failed},deleteLocalIcon(e){e.file=null}}}),actions$1=slice.actions;var iconUploadState=slice.reducer;const namespace=SLICE_NAME,actions={[namespace$7]:actions$7,[namespace$6]:actions$6,[namespace$5]:actions$5,[namespace$4]:actions$4,[namespace$3]:actions$3,[namespace$1]:actions$1,[namespace$2]:actions$2},rootReducer=combineReducers({[namespace$7]:uiState,[namespace$6]:appFormState$1,[namespace$3]:engineLinkingPanelState,[namespace$5]:flowLinkingPanelState,[namespace$4]:schemaLinkingPanelState,[namespace$1]:iconUploadState,[namespace$2]:eventsPanelState}),selectApp=e=>e[namespace].appFormState.app,selectApps=e=>e[namespace].appFormState.apps,selectIsEditForm=e=>lodash.exports.pick(e[namespace].appFormState,"isEditForm"),selectIsLoadingExistingAppData=e=>lodash.exports.pick(e[namespace].appFormState,"isLoadingExistingAppData"),selectConfigFields=e=>e[namespace].appFormState.app.configFields,selectContextMenuExtensions=e=>e[namespace].appFormState.app.contextMenuExtensions,selectAppUrl=e=>e[namespace].appFormState.app.url,selectEntityTags=e=>e[namespace].appFormState.app.entityTags,selectNodeModules=e=>e[namespace].appFormState.app.nodeModules,selectPrevNodeModules=e=>e[namespace].appFormState.prevNodeModules,selectPrevContextMenuExtensions=e=>e[namespace].appFormState.prevContextMenuExtensions,selectIsResumeSession=e=>lodash.exports.get(e[namespace].appFormState,"isResumeSession"),selectAppPackageDistributionType=e=>e[namespace].appFormState.app.packageDistributionType;var appFormState=Object.freeze({__proto__:null,selectApp:selectApp,selectApps:selectApps,selectIsEditForm:selectIsEditForm,selectIsLoadingExistingAppData:selectIsLoadingExistingAppData,selectConfigFields:selectConfigFields,selectContextMenuExtensions:selectContextMenuExtensions,selectAppUrl:selectAppUrl,selectEntityTags:selectEntityTags,selectNodeModules:selectNodeModules,selectPrevNodeModules:selectPrevNodeModules,selectPrevContextMenuExtensions:selectPrevContextMenuExtensions,selectIsResumeSession:selectIsResumeSession,selectAppPackageDistributionType:selectAppPackageDistributionType});const selectEventPanel=e=>e[namespace].appEventsPanelState;var eventPanelState=Object.freeze({__proto__:null,selectEventPanel:selectEventPanel});const selectIcon=e=>e[namespace].iconUploadState.file,selectApiConfigs=createSelector([rootApiSelector,graphEndpointSelector,sessionTokenSelector],(e,t,a)=>({apiRoot:e,graphQLEndpoint:t,token:a}));function __awaiter(e,o,r,p){return new(r=r||Promise)(function(a,t){function s(e){try{i(p.next(e))}catch(e){t(e)}}function n(e){try{i(p.throw(e))}catch(e){t(e)}}function i(e){var t;e.done?a(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,n)}i((p=p.apply(e,o||[])).next())})}const getEnginesByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getEngines";return yield baseGraphQLApiWithError(Object.assign({query:"\n query getEngines($name:String){\n engines(\n name: $name,\n orderBy: {\n field: name,\n direction: asc\n }\n ) {\n records {\n id\n name\n modifiedDateTime\n edgeVersion\n iconPath\n description\n category {\n id\n }\n }\n }\n }\n ",variables:e,operationName:t},a))}),getFlowsByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getFlows";return yield baseGraphQLApiWithError(Object.assign({query:'\n query getFlows($name:String){\n engines(\n name: $name,\n categoryId: "c5458876-43d2-41e8-a340-f734702df04a",\n orderBy: {\n field: name,\n direction: asc\n }\n ) {\n records {\n id,\n name,\n modifiedDateTime,\n edgeVersion\n }\n }\n }\n ',variables:e,operationName:t},a))}),createApplication=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="createApplication";return(yield baseGraphQLApiWithError(Object.assign(Object.assign({query:"\n mutation createApplication ($input: CreateApplication!) {\n createApplication (input: $input) {\n id\n }\n }\n ",variables:{input:a},operationName:e},t),{throwWholeErrorObject:!0})))[e]}),updateAppComponents=(o,r)=>__awaiter(void 0,void 0,void 0,function*(){const{engines:t,dataRegistries:a,id:s}=r,n="updateApplicationComponent";let i="";lodash.exports.forEach(lodash.exports.keys(t),e=>{lodash.exports.isEmpty(t[e])||(i+=`
2
+ ${e}Engines: ${n} (input: {
3
3
  id: "${s}"
4
4
  componentIds: [${lodash.exports.join(lodash.exports.map(t[e],e=>`"${e}"`),",")}]
5
5
  type: engines
@@ -11,8 +11,8 @@ import{i as createSvgIcon,k as interopRequireDefault,j as jsxRuntime,X as create
11
11
  }
12
12
  }
13
13
  }
14
- `)}),lodash.exports.forEach(lodash.exports.keys(a),e=>{lodash.exports.isEmpty(a[e])||(n+=`
15
- ${e}DataRegistries: ${i} (input: {
14
+ `)}),lodash.exports.forEach(lodash.exports.keys(a),e=>{lodash.exports.isEmpty(a[e])||(i+=`
15
+ ${e}DataRegistries: ${n} (input: {
16
16
  id: "${s}"
17
17
  componentIds: [${lodash.exports.join(lodash.exports.map(a[e],e=>`"${e}"`),",")}]
18
18
  type: dataRegistries
@@ -24,9 +24,9 @@ import{i as createSvgIcon,k as interopRequireDefault,j as jsxRuntime,X as create
24
24
  }
25
25
  }
26
26
  }
27
- `)});var e=`mutation ${i} {
28
- ${n}
29
- }`;return(yield baseGraphQLApiWithError(Object.assign({query:e,operationName:i},o)))[i]}),createAppConfig=(a,s,i)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionCreate",t=lodash.exports.map(i,e=>{var t={appId:s,configKey:e.name,configType:AppConfigType[e.type],configLevel:AppConfigLevel[e.configLevel],required:e.required,description:e.description,secured:!1};return lodash.exports.isNil(e.defaultValue)||(t.defaultValue=e.defaultValue),t});return(yield baseGraphQLApiWithError(Object.assign({query:"mutation applicationConfigDefinitionCreate ($input: [ApplicationConfigDefinitionCreate]) {\n applicationConfigDefinitionCreate (input: $input) {\n records {\n configKey\n }\n }\n }",variables:{input:t},operationName:e},a)))[e]}),applicationFieldsFragment=`fragment applicationFields on Application {
27
+ `)});var e=`mutation ${n} {
28
+ ${i}
29
+ }`;return(yield baseGraphQLApiWithError(Object.assign({query:e,operationName:n},o)))[n]}),createAppConfig=(a,s,n)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionCreate",t=lodash.exports.map(n,e=>{var t={appId:s,configKey:e.name,configType:AppConfigType[e.type],configLevel:AppConfigLevel[e.configLevel],required:e.required,description:e.description,secured:!1};return lodash.exports.isNil(e.defaultValue)||(t.defaultValue=e.defaultValue),t});return(yield baseGraphQLApiWithError(Object.assign({query:"mutation applicationConfigDefinitionCreate ($input: [ApplicationConfigDefinitionCreate]) {\n applicationConfigDefinitionCreate (input: $input) {\n records {\n configKey\n }\n }\n }",variables:{input:t},operationName:e},a)))[e]}),applicationFieldsFragment=`fragment applicationFields on Application {
30
30
  id
31
31
  name
32
32
  description
@@ -159,4 +159,4 @@ import{i as createSvgIcon,k as interopRequireDefault,j as jsxRuntime,X as create
159
159
  ...applicationFields
160
160
  }
161
161
  }
162
- `;return(yield baseGraphQLApiWithError(Object.assign({query:t,variables:{id:s},operationName:e},a))).application}),updateApplication=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="updateApplication";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation updateApplication ($input: UpdateApplication!) {\n updateApplication (input: $input) {\n id\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),bulkDeleteContextMenuExtensions=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="bulkDeleteContextMenuExtensions";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation bulkDeleteContextMenuExtensions ($input: BulkDeleteContextMenuExtensions!) {\n bulkDeleteContextMenuExtensions (input: $input) {\n mentions {\n id\n label\n url\n type\n }\n tdos {\n id\n label\n url\n type\n }\n watchlists {\n id\n label\n url\n type\n }\n collections {\n id\n label\n url\n type\n }\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),deleteConfigField=(t,a,s)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionDelete";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionDelete($appId: ID! $configKey: String!) {\n applicationConfigDefinitionDelete(\n input: {\n appId: $appId\n configKey: $configKey\n }\n )\n {\n success\n code\n msg\n }\n }\n ",variables:{appId:a,configKey:s},operationName:e},t))}),updateConfigField=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionUpdate";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionUpdate($input: [ApplicationConfigDefinitionUpdateInput]) {\n applicationConfigDefinitionUpdate(input: $input)\n {\n records {\n applicationId\n configKey\n }\n }\n }",variables:{input:a},operationName:e},t))}),getApplicationConfigFields=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinition";return yield baseGraphQLApiWithError(Object.assign({query:"\n query applicationConfigDefinition ($appId: ID!) {\n applicationConfigDefinition(appId: $appId) {\n records {\n applicationId\n configKey\n configType\n configLevel\n description\n defaultValue\n defaultValueJSON\n required\n secured\n }\n }\n\n }\n ",variables:{appId:a},operationName:e},t))}),getOAuthClientSecret=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="getApplicationOatuhClientSecret";return yield baseGraphQLApiWithError(Object.assign({query:"query getApplicationOatuhClientSecret($id: ID!, $password: String!) {\n application(id: $id) {\n id,\n clientSecret(password: $password)\n }\n }",variables:a,operationName:e},t))}),getSchemasByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getSchemasByDataRegistryName";return yield baseGraphQLApiWithError(Object.assign({query:"\n query getSchemasByDataRegistryName($name:String){\n dataRegistries(\n name: $name\n ){\n records {\n id\n name\n modifiedDateTime\n schemas {\n records {\n id\n dataRegistryId\n modifiedDateTime\n majorVersion\n minorVersion\n }\n }\n }\n }\n }\n ",variables:e,operationName:t},a))}),getEvents$1=t=>__awaiter(void 0,void 0,void 0,function*(){var e="systemEvents";return yield baseGraphQLApiWithError(Object.assign({query:'\n query systemEvents {\n events (application: "system", limit: 9999) {\n records {\n id\n eventName\n eventType\n description\n }\n }\n }\n ',operationName:e},t))});function*searchFlows(e){yield delay(200),yield put(actions.flowLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getFlowsByName,t,{name:e.payload});yield put(actions.flowLinkingPanelState.updateFlowLinkingPanelField({field:"searchResults",value:a.engines.records})),yield put(actions.flowLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.flowLinkingPanelState.fetchingDone())}}function*watchSearchFlows(){yield takeLatest$1(actions.flowLinkingPanelState.searchByTerm.type,searchFlows)}const flowsSagas=[fork(watchSearchFlows)];function*searchSchemas(e){yield delay(200),yield put(actions.schemaLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getSchemasByName,t,{name:e.payload});yield put(actions.schemaLinkingPanelState.updateSchemaLinkingPanelField({field:"searchResults",value:lodash.exports.map(a.dataRegistries.records,e=>{var t=lodash.exports.reduce(e.schemas.records,(e,t)=>t.majorVersion>e.majorVersion||t.majorVersion==e.majorVersion&&t.minorVersion>e.minorVersion?t:e);return t?{id:t.id,dataRegistryId:t.dataRegistryId,name:e.name,modifiedDateTime:t.modifiedDateTime,version:`v${t.majorVersion}.`+t.minorVersion}:null}).filter(e=>!(!e||!e.name))})),yield put(actions.schemaLinkingPanelState.fetchingDone())}catch(e){yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.schemaLinkingPanelState.fetchingDone())}}function*watchSearchSchemas(){yield takeLatest$1(actions.schemaLinkingPanelState.searchByTerm.type,searchSchemas)}const schemasSagas=[fork(watchSearchSchemas)];function*searchEngines(e){yield delay(200),yield put(actions.engineLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEnginesByName,t,{name:e.payload}),s=lodash.exports.filter(a.engines.records,e=>"c5458876-43d2-41e8-a340-f734702df04a"!==e.category.id);yield put(actions.engineLinkingPanelState.updateEngineLinkingPanelField({field:"searchResults",value:s})),yield put(actions.engineLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.engineLinkingPanelState.fetchingDone())}}function*watchSearchEngines(){yield takeLatest$1(actions.engineLinkingPanelState.searchByTerm.type,searchEngines)}const enginesSagas=[fork(watchSearchEngines)];function*getEvents(e){yield delay(0),yield put(actions.appEventsPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEvents$1,t);yield put(actions.appEventsPanelState.updateEventsPanelField({field:"searchResults",value:a.events.records})),yield put(actions.appEventsPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.appEventsPanelState.fetchingDone())}}function*watchGetEvents(){yield takeLatest$1(actions.appEventsPanelState.getEvents.type,getEvents)}const appEventsSagas=[fork(watchGetEvents)],supportedAppFields$1=["id","name","isPublic","key","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","contextMenuExtensions","eventEndpoint","entityTags","headerbarEnabled","nodeModules","applicationHeaderbar","packageDistributionType"],formatApp$1=t=>{const a={checkPermissions:t.checkPermissions||!1,name:t.name,key:lodash.exports.snakeCase(t.name)};return supportedAppFields$1.forEach(e=>{if(!lodash.exports.isNil(t[e])){if("applicationHeaderbar"===e)return t.headerbarEnabled&&(a.headerbar=t[e]);a[e]=t[e]}}),lodash.exports.isNil(t.iconPath)||(a.iconUrl=t.iconPath),lodash.exports.isNil(t.oauthUrl)||lodash.exports.isEmpty(t.oauthUrl)||(a.oauth2RedirectUrls=[t.oauthUrl]),a};function*createNewApplication(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"];if(lodash.exports.isNil(e))throw new Error("Empty app not allowed!");var a=yield select(selectApiConfigs);try{var s,i=formatApp$1(e),n=yield call(createApplication,a,i),{flows:o,engines:r,schemas:p}=e;lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)&&lodash.exports.isEmpty(p)||(s={id:n.id},lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)||(s.engines={add:[...lodash.exports.map(o,e=>e.id),...lodash.exports.map(r,e=>e.id)],remove:[]}),lodash.exports.isEmpty(p)||(s.dataRegistries={add:lodash.exports.map(p,e=>e.dataRegistryId),remove:[]}),yield call(updateAppComponents,a,s)),lodash.exports.isEmpty(e.configFields)||(yield call(createAppConfig,a,n.id,e.configFields)),yield put(actions.appFormState.createAppSuccess(n.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appCreateSuccess",defaultMessage:[{type:0,value:"Application successfully created"}]}),severity:MessageSeverity.Success})),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){i=lodash.exports.get(e[0],"data.validationErrors[0].message")||"Application onboarding failed";yield put(actions.appFormState.createAppFailed(e[0].message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appOnboardingFailed",defaultMessage:[{type:1,value:"message"}]},{message:i}),severity:MessageSeverity.Error}))}}function*watchNewApplicationCreateStart(){yield takeLatest$1(actions.appFormState.createAppStart.type,createNewApplication)}const newApplicationSagas=[fork(watchNewApplicationCreateStart)],root="undefined"!=typeof window?window:global,fileUploadChannel=(root.xhrInstances={},channel());function*uploadIcon(t){const a=t.payload.file;t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);try{var e=yield call(getUrlBucket,a.name);const i=Object.assign(Object.assign({},a),{status:IconImportStatus.Uploading,percentComplete:0,expiresInSeconds:e.expiresInSeconds,getUrl:e.getUrl,key:e.key,unsignedUrl:e.unsignedUrl,url:e.url}),n=(yield put(actions.iconUploadState.updateIcon(i)),e=>{fileUploadChannel.put(actions.iconUploadState.updateIcon(Object.assign({id:a.id},e)))});var s=yield uploadFileToS3(e,a,{onProgress:e=>{n({percentComplete:e}),sdkEventManager.dispatch(SdkEvents.fileUploadProgress,null,e)},onAbort:e=>{n({status:IconImportStatus.Aborted}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e,"abort"),i)},onError:e=>{n({status:IconImportStatus.Failed}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e),i)},onUpload:e=>{n({status:IconImportStatus.Uploaded}),sdkEventManager.dispatch(SdkEvents.fileUpload,null,i)}});root.xhrInstances[a.id]=s,yield put(actions.iconUploadState.uploadIconSuccess()),yield put(actions.appFormState.updateAppFormField({field:"iconPath",value:i.getUrl}))}catch(e){yield put(actions.iconUploadState.uploadIconFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.iconUploadFail",defaultMessage:[{type:0,value:"Icon upload failed, please try again."}]}),severity:MessageSeverity.Error}))}}function*getUrlBucket(e){var t=yield select(selectApiConfigs);return yield call(getSignedWritableUrl,t,e)}function*watchUploadIconStart(){yield takeLatest$1(actions.iconUploadState.uploadIconStart.type,uploadIcon)}function*watchProgressChannel(){var e=yield take(fileUploadChannel);yield put(e)}const supportedAppFields=["id","name","isPublic","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","eventEndpoint","entityTags","headerbarEnabled","nodeModules","applicationHeaderbar","packageDistributionType"],formatApp=a=>{const t={checkPermissions:a.checkPermissions||!1,name:a.name,id:a.id};if(lodash.exports.forEach(supportedAppFields,e=>{if(!lodash.exports.isNil(a[e])){if("applicationHeaderbar"===e)return a.headerbarEnabled&&(t.headerbar=a[e]);t[e]=a[e]}}),lodash.exports.isNil(a.iconPath)||(t.iconUrl=a.iconPath),!lodash.exports.isEmpty(a.contextMenuExtensions)){const s={mentions:[],tdos:[],watchlists:[],collections:[]};lodash.exports.forEach(lodash.exports.keys(a.contextMenuExtensions),t=>{lodash.exports.forEach(a.contextMenuExtensions[t],e=>{s[t].push({id:e.id,label:e.label,url:e.url})})}),t.contextMenuExtensions=s}return t},decodeApp=(e,t)=>{const a=[],s=[];lodash.exports.map(lodash.exports.get(e.components.engines,"records"),e=>{("c5458876-43d2-41e8-a340-f734702df04a"===e.categoryId?a:s).push(e)});t=lodash.exports.map(lodash.exports.get(t.applicationConfigDefinition,"records"),e=>{return{id:e.applicationId,name:e.configKey,type:e.configType,configLevel:AppConfigLevel[e.configLevel],required:e.required,description:e.description,defaultValue:e.defaultValue,secured:!1}});return{id:e.id,name:e.name,description:e.description,entityTags:lodash.exports.map(e.entityTags,e=>({tagKey:e.tagKey,tagValue:e.tagValue})),configFields:t,status:e.status,url:e.url,oauth2RedirectUrls:e.oauth2RedirectUrls,iconSvg:e.iconSvg,iconPath:e.iconUrl,key:e.key,clientSecret:e.clientSecret,validStateActions:e.validStateActions,createdDateTime:e.createdDateTime,modifiedDateTime:e.modifiedDateTime,flows:a,engines:s,headerbarEnabled:e.headerbarEnabled,schemas:lodash.exports.map(lodash.exports.get(e.components.dataRegistries,"records"),e=>{return{dataRegistryId:e.id,name:e.name,modifiedDateTime:e.modifiedDateTime,version:(e=e.publishedSchema)?e.majorVersion+"."+e.minorVersion:""}}),contextMenuExtensions:e.contextMenuExtensions,nodeModules:e.nodeModules,applicationHeaderbar:e.applicationHeaderbar}};function*queryAppDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplication,t,e)}function*queryAppConfigFieldDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplicationConfigFields,t,e)}function*editApp(e){var t=yield queryAppDetails(e.payload),e=yield queryAppConfigFieldDetails(e.payload);yield put(actions.appFormState.setEditAppExistingData(decodeApp(t,e)))}function*updateApp(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"],a=yield select(selectApiConfigs);try{var s,i,n,o,r=formatApp(e),p=yield call(updateApplication,a,r),{flows:l,flowsToDelete:d,engines:c,enginesToDelete:u,schemas:x,schemasToDelete:m,contextMenuExtensionIdsForBulkDelete:g}=e,h=(lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(d)&&lodash.exports.isEmpty(u)&&lodash.exports.isEmpty(m)||(s={id:p.id},i=lodash.exports.differenceBy(d,l,"id"),n=lodash.exports.differenceBy(u,c,"id"),o=lodash.exports.differenceBy(m,x,"dataRegistryId"),lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(i)&&lodash.exports.isEmpty(n)||(s.engines={add:[...lodash.exports.map(l,e=>e.id),...lodash.exports.map(c,e=>e.id)],remove:[...lodash.exports.map(i,e=>e.id),...lodash.exports.map(n,e=>e.id)]}),lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(o)||(s.dataRegistries={add:lodash.exports.map(x,e=>e.dataRegistryId),remove:lodash.exports.map(o,e=>e.dataRegistryId)}),yield call(updateAppComponents,a,s),lodash.exports.isEmpty(g))||(yield call(bulkDeleteContextMenuExtensions,a,g)),yield put(actions.appFormState.createAppSuccess(p.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.app-update-success",defaultMessage:[{type:0,value:"App successfully updated"}]}),severity:MessageSeverity.Success})),"APP_CENTER_DETAILS"),f={name:h,config:{appId:p.id}};yield put(mountPanel({panelId:h,microFrontend:f,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,size:"xlarge"}})),localStorage.removeItem("appOnboardingSession"),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){yield put(actions.appFormState.createAppFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.app-updating-failed",defaultMessage:[{type:0,value:"App updating failed"}]}),severity:MessageSeverity.Error}))}}function*deleteAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configToDelete.id)try{yield call(deleteConfigField,t,e.configToDelete.id,e.configToDelete.name)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-delete-fail",defaultMessage:[{type:0,value:"Config field failed to be deleted"}]}),severity:MessageSeverity.Error}))}}function*updateAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configFields.id){var s={configKey:e.configFields.name,description:e.configFields.description,configLevel:e.configFields.configLevel,configType:AppConfigType[e.configFields.type],defaultValue:e.configFields.defaultValue,required:e.configFields.required,secured:!1},e={input:[{filter:{appId:e.configFields.id,configKey:e.name},update:s}]};try{yield call(updateConfigField,t,e.input)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-update-fail",defaultMessage:[{type:0,value:"Config field failed to be updated"}]}),severity:MessageSeverity.Error}))}}}function*addAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t)try{yield call(createAppConfig,t,e.appId,[e.newConfigField])}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-create-fail",defaultMessage:[{type:0,value:"Config field failed to be created"}]}),severity:MessageSeverity.Error}))}}function*fetchApplications(){var e=yield select(selectApiConfigs),t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);if(e)try{var a=yield call(getApplications,e);yield put(actions.appFormState.fetchApplications(a))}catch(e){yield put(showMessage({content:t({id:"os-app-center-new.get-all-applications-fail",defaultMessage:[{type:0,value:"Fetching applications failed"}]}),severity:MessageSeverity.Error}))}}function*watchEditApp(){yield takeLatest$1(actions.appFormState.editApp.type,editApp)}function*watchUpdateAppStart(){yield takeLatest$1(actions.appFormState.updateAppStart.type,updateApp)}function*watchDeleteConfigField(){yield takeLatest$1(actions.appFormState.removeConfigField.type,deleteAppConfigField)}function*watchUpdateConfigField(){yield takeLatest$1(actions.appFormState.updateConfigField.type,updateAppConfigField)}function*watchCreateConfigField(){yield takeLatest$1(actions.appFormState.createConfigField.type,addAppConfigField)}function*watchGetApplications(){yield takeLatest$1(actions.appFormState.createNewApp.type,fetchApplications)}const editAppSagas=[fork(watchEditApp),fork(watchUpdateAppStart),fork(watchDeleteConfigField),fork(watchUpdateConfigField),fork(watchCreateConfigField),fork(watchGetApplications)];function*updateLocalStorage(){var e=appFormState["selectApp"],t=eventPanelState["selectEventPanel"],e=yield select(e),t=yield select(t);window.localStorage.setItem("appOnboardingSession",JSON.stringify(Object.assign(Object.assign({},e),{eventHandlers:t.handlers})))}function*watchAppForm(){var{appFormState:e,appEventsPanelState:t}=actions,e=[e.updateAppFormField.type,e.updateApplicationHeaderbar.type,e.addConfigField.type,e.createConfigField.type,e.updateConfigField.type,e.removeConfigField.type,e.clearConfigFields.type,e.addContextMenuExtension.type,e.updateContextMenuExtension.type,e.removeContextMenuExtension.type,e.clearContextMenuExtensions.type,e.addNodeModule.type,e.updateNodeModule.type,e.removeNodeModule.type,t.addHandler.type,t.editHandler.type,t.deleteHandler.type];yield takeLatest$1(e,updateLocalStorage)}const updateAppFormSagas=[fork(watchAppForm)];function*rootSaga(){yield all([watchUploadIconStart(),watchProgressChannel(),...appEventsSagas,...flowsSagas,...enginesSagas,...newApplicationSagas,...schemasSagas,...editAppSagas,...updateAppFormSagas])}function getAppCenterNewModule(){return{id:SLICE_NAME,reducerMap:{[SLICE_NAME]:rootReducer},sagas:[rootSaga],initialActions:[]}}const formattedMessageIdPrefix$2="toggle-switch.",Toggle=e=>{var{checked:t,onChange:a}=e;return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:-1,alignItems:"center"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"off",defaultMessage:"Off",description:"Off lable for aiware headerbar toggle switch"})})),jsxRuntime.exports.jsx(Switch,Object.assign({color:"secondary",id:"toggle-aiware-headerbar",onChange:a},lodash.exports.omit(e,"className"))),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"on",defaultMessage:"On",description:"On lable for aiware headerbar toggle switch"})}))]}))},formattedMessageIdPrefix$1="os-app-center-new.headerbar-step.headerbar-toggle.";var ApplicationHeaderbarToggle=({checked:e=!0,onChange:t})=>jsxRuntime.exports.jsxs(Box,Object.assign({width:"100%","data-test":formattedMessageIdPrefix$1+"container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"title",defaultMessage:"aiWARE Headerbar",description:"Title of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"instructions",defaultMessage:"This allows the aiWARE header to wrap around your app, keeping it self contained.",description:"Instructions of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(FormGroup,{children:jsxRuntime.exports.jsx(FormControl,{children:jsxRuntime.exports.jsx(Toggle,{checked:e,onChange:t,"data-test":formattedMessageIdPrefix$1+"toggle"})})})]}));const useStyles$8=makeStyles()(e=>({editorImg:{maxWidth:"100%",height:"auto"},container:{"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5,boxSizing:"content-box"}})),formattedMessageIdPrefix="os-app-center-new.headerbar-step.customize-headerbar.";var CustomizeApplicationHeaderbar=({handleOnValidate:e})=>{var t=useStyles$8()["classes"];const s=useDispatch(),a=useSelector(selectApp);var i={name:null==(i=a.applicationHeaderbar)?void 0:i.name,"config.backgroundColor":null==(i=a.applicationHeaderbar)?void 0:i.config.backgroundColor,"config.logoSrc":null==(i=a.applicationHeaderbar)?void 0:i.config.logoSrc,"config.help":null==(i=a.applicationHeaderbar)?void 0:i.config.help,"config.notification":null==(i=a.applicationHeaderbar)?void 0:i.config.notification};const n=useForm({mode:"onChange",defaultValues:i});react.exports.useEffect(()=>{a.headerbarEnabled?null!=e&&e(n.formState.isValid):null!=e&&e(!0)},[n.formState.isValid,a.headerbarEnabled]);var i=e=>{var t=e.target["name"];let a=e.target["value"];"config.zIndex"===t&&(a=Number(a)),s(actions.appFormState.updateApplicationHeaderbar({field:t,value:a}))},o=e=>{var{name:e,checked:t}=e.target;s(actions.appFormState.updateApplicationHeaderbar({field:e,value:t}))};return jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:3,"data-test":formattedMessageIdPrefix+"container"},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{opacity:a.headerbarEnabled?1:.5}},{children:[jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",alignItems:"center",spacing:1},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"title",defaultMessage:"Customize the aiWARE Header",description:"Title of the Customize aiware headerbar section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"optional",defaultMessage:"(Optional)",description:"Optional modifier for titles"})}))]})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"instructions",defaultMessage:"Your inputs will be injected into the header as JSON and can be used to customize the user interface and functionality.",description:"Instructions of the Customize aiware header bar section"})}))]})),a.headerbarEnabled&&jsxRuntime.exports.jsx(Box,{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},n,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,spacing:5,"data-test":formattedMessageIdPrefix+"form-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-name",defaultMessage:"Name",description:"You can set a headerbar name"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-name",inputProps:{maxLength:250,className:t.textInput},rules:{required:!0},onChange:i})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:2},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-backgroundColor",defaultMessage:"Background Color",description:"You can set a headerbar background color"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"color",name:"config.backgroundColor",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.backgroundColor",inputProps:{maxLength:250,className:t.textInput},onChange:i})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-logoSource",defaultMessage:"Logo Source",description:"You can set a headerbar logo source"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"config.logoSrc",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.logoSrc",inputProps:{maxLength:5e3,className:t.textInput},onChange:i})]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"25px 0 0 25px"}},{children:jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:[jsxRuntime.exports.jsx(InputCheckbox,{name:"config.help",checked:null==(i=null==(t=a.applicationHeaderbar)?void 0:t.config)?void 0:i.help,onChange:o,"data-test":"app-center-new.aiware-headerbar-checkbox-help",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-help",defaultMessage:"Help",description:"Help field checkbox"})}),jsxRuntime.exports.jsx(InputCheckbox,{name:"config.notification",checked:null==(i=null==(t=a.applicationHeaderbar)?void 0:t.config)?void 0:i.notification,onChange:o,"data-test":"app-center-new.aiware-headerbar-checkbox-notification",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-notification",defaultMessage:"Notification",description:"Notification field checkbox"})})]}))}))]}))}))})]}))};const useStyles$7=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)}}));var HeaderbarStep=({handleOnValidate:e})=>{const t=useDispatch();var a=useSelector(selectApp),s=useStyles$7()["classes"];return jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,flexDirection:"column",rowSpacing:5,columnSpacing:6,className:s.container,"data-test":"app-new-headerbar-step-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(ApplicationHeaderbarToggle,{checked:a.headerbarEnabled,onChange:e=>{t(actions.appFormState.updateAppFormField({field:"headerbarEnabled",value:e.target.checked}))}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(CustomizeApplicationHeaderbar,{handleOnValidate:e})}))]}))};const useStyles$6=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},grayText:{color:"gray"},textInput:{boxSizing:"content-box"}})),ConfigFields=()=>{const a=useDispatch(),s=useSelector(selectConfigFields),e=e=>lodash.exports.map(e,e=>({name:e.name,configLevel:e.configLevel,type:e.type,default:isEmpty_1(e.defaultValue)?"N/A":e.defaultValue})),[i,n]=react.exports.useState(e(s));react.exports.useEffect(()=>{n(e(s))},[s]);const t=(e=!1,t=-1)=>{e={name:"APP_CENTER_CONFIG_FIELDS_FORM",config:{name:"Custom Fields",isEdit:e,editIndex:t}};a(mountPanel({panelId:"APP_CENTER_CONFIG_FIELDS_FORM",microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-config-fields",heading:"Application Config Fields",description:"Does your application require config fields? If so, specify them here. Leave blank if not..",actionButtonLabel:"Add Config",items:i,columnNames:["Name","Config Level","Type","Default","",""],canEdit:!0,canDelete:!0,onActionClick:()=>t(),onEditClick:e=>{e=i[e],e=findIndex_1(s,{name:e.name,type:e.type});0<=e&&t(!0,e)},onDeleteClick:e=>{var t=i[e],t=findIndex_1(s,{name:t.name,type:t.type});0<=t&&a(actions.appFormState.removeConfigField({removeIndex:t,configToDelete:s[e]}))},onRequestSort:(e,t)=>{n(orderBy_1(i,lowerCase_1(e),t))}})},urlRegex=/^https?:\/\/[(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,CME_PANEL_NAME="APP_CENTER_CONTEXT_MENU_EXTENSIONS",ContextMenuExtensions=()=>{const s=useDispatch(),a=useSelector(selectContextMenuExtensions),e=e=>{return lodash.exports.isNil(e)?[]:Object.values(e).flat().map(e=>({id:e.id,type:e.type,label:e.label,url:e.url||""}))},[i,n]=react.exports.useState(e(a)),o=(react.exports.useEffect(()=>{n(e(a))},[JSON.stringify(a)]),(e=!1,t=void 0,a=-1)=>{e={name:CME_PANEL_NAME,config:{name:"Context Menu Extensions",isEdit:e,extensionType:t,editIndex:a}};s(mountPanel({panelId:CME_PANEL_NAME,microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))}),r=e=>{var e=i[e],t=a[e.type+"s"];return{index:lodash.exports.findIndex(t,["id",e.id]),type:e.type}};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-context-menu-extensions",heading:"Context Menu Extensions",description:"Add a menu option to files in aiWare that allow users to send them to your application",actionButtonLabel:"Add Context Menu Extension",items:lodash.exports.map(i,e=>lodash.exports.omit(e,"id")),columnNames:["Type","Label","URL","",""],canEdit:!0,canDelete:!0,onActionClick:()=>o(),onEditClick:e=>{var{index:e,type:t}=r(e);0<=e?o(!0,t,e):console.log("Extension not found",e,t)},onDeleteClick:e=>{var{index:e,type:t}=r(e);0<=e&&s(actions.appFormState.removeContextMenuExtension({extensionType:t,index:e}))},onRequestSort:(e,t)=>{n(lodash.exports.orderBy(i,lodash.exports.lowerCase(e),t))}})},FunctionalityStep=({handleOnValidate:e})=>{var t=useStyles$6()["classes"];const a=useDispatch();var s=useSelector(selectAppUrl);const i=useForm({mode:"onChange",defaultValues:{url:s}});react.exports.useEffect(()=>{null!=e&&e(i.formState.isValid)},[i.formState.isValid]);s=e=>{var{name:e,value:t}=e.target;a(actions.appFormState.updateAppFormField({field:e,value:t}))};return jsxRuntime.exports.jsx(FormProvider,Object.assign({},i,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container,"data-test":"os-app-center-new-functionality-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.application-type-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-type-title-formattedMessage",defaultMessage:"Application Type",description:"Application Type title"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption","data-test":"os-app-center-new.application-type-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-type-description-formattedMessage",defaultMessage:"Please select the application type from the list below:",description:"Application Type description"})})),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsxs(InputSelect,Object.assign({className:t.root,onChange:s,"data-test":"os-app-center-new.app-type-input",fullWidth:!0,value:"web",name:"app-type"},{children:[jsxRuntime.exports.jsxs(MenuItem,Object.assign({value:"web"},{children:[jsxRuntime.exports.jsx("b",{children:"Web Application"})," ",jsxRuntime.exports.jsx("span",Object.assign({className:t.grayText},{children:"(Accessible via Browser)"}))]})),jsxRuntime.exports.jsxs(MenuItem,Object.assign({disabled:!0},{children:[jsxRuntime.exports.jsx("b",{children:"Docker Application"})," (Run on aiWARE)"," ",jsxRuntime.exports.jsx(Chip,{color:"primary",className:t.chip,size:"small",label:"Coming Soon"})]})),jsxRuntime.exports.jsxs(MenuItem,Object.assign({disabled:!0},{children:[jsxRuntime.exports.jsx("b",{children:"Kubernetes"})," ",jsxRuntime.exports.jsx(Chip,{color:"primary",className:t.chip,size:"small",label:"Coming Soon"})]}))]}))}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.application-url-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-url-title-formattedMessage",defaultMessage:"Application URL",description:"Application url title"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption","data-test":"os-app-center-new.application-url-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.integration-description-formattedMessage",defaultMessage:"Provide the url to access your application. Include http or https.",description:"Application url description"})})),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsx(InputText,{className:t.textInput,required:!0,type:"url","data-test":"os-app-center-new.url-input",rules:{required:!0,pattern:{value:urlRegex,message:"Must be a valid URL including protocol."}},onChange:s,placeholder:"URL",name:"url",fullWidth:!0})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ConfigFields,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ContextMenuExtensions,{})}))]}))}))},useStyles$5=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px",marginTop:"9px",marginRight:"15px",background:"#214167"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},checked:{color:"#6098D1"},textInput:{boxSizing:"content-box"}})),useOneClickCopy=a=>{const[t,s]=react.exports.useState(!1);return[e=>{var t;navigator.clipboard.writeText(null!=(t=a.current.dataset.copyToClipboardText)?t:a.current.innerText).catch(e=>{console.error("Error copying to clipboard: ",e)}),s(!0)},e=>jsxRuntime.exports.jsx(Tooltip,Object.assign({open:t,onClose:()=>{s(!1)},title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-copied-to-clipboard",defaultMessage:"Copied to clipboard",description:"Copied to clipboard"})},e,{children:e.children}))]};var OAuthClientSecret=({appId:a,disabled:e})=>{const s=useSelector(selectApiConfigs),[t,i]=react.exports.useState(""),[n,o]=react.exports.useState(!1),[r,p]=react.exports.useState(!1),[l,d]=react.exports.useState(!1);var c=react.exports.useRef();const[u,x]=useOneClickCopy(c);react.exports.useEffect(()=>{!lodash.exports.isEmpty(t)&&l&&(u(null),d(!1))});const m=react.exports.useRef();const[g,h]=react.exports.useState(!1),[f,j]=react.exports.useState(!1);const[y,b]=react.exports.useState(!1);return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"column",spacing:2,"data-test":"oauth-client-secret-retrival-tool"},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-label-formattedMessage",defaultMessage:"Client Secret: OAuth",description:"Lable for the client secret input when selecting OAuth"})}))})),jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2,alignItems:"center",width:"60%"},{children:[jsxRuntime.exports.jsx(x,{children:jsxRuntime.exports.jsx(InputText,{name:"oauthClientSecret",fullWidth:!0,disabled:!0,ref:c,"data-copy-to-clipboard-text":t,id:"clientSecret",color:"secondary",style:{backgroundColor:"#F2F5F9"},type:f?"text":"password",size:"small",value:t,InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"data-test":"oauth-client-secret-reveal","aria-label":"toggle client secret visibility",onClick:()=>{lodash.exports.isEmpty(t)?h(!0):j(!f)},disabled:e},{children:f?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))}})}),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"copy client secret",onClick:e=>{lodash.exports.isEmpty(t)?(d(!0),h(!0)):u(e)},disabled:e,"data-test":"oauth-client-secret-copy"},{children:jsxRuntime.exports.jsx(Copy,{})}))]})),jsxRuntime.exports.jsxs(Collapse,Object.assign({in:g},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-password-input-label-formattedMessage",defaultMessage:"Please enter your account password to reveal client secret",description:"Lable for the client secret password input when selecting OAuth"})}))})),jsxRuntime.exports.jsx("form",Object.assign({onSubmit:e=>{e.preventDefault();var t,e=null==(e=m.current)?void 0:e.value;lodash.exports.isEmpty(e)||(t=e,__awaiter(void 0,void 0,void 0,function*(){console.log("handleFetchClientSecret Start");try{o(!0);var e=yield getOAuthClientSecret(s,{id:a,password:t});console.log("Result:",e),i(e.application.clientSecret),h(!1)}catch(e){m.current.focus(),p(!0)}finally{o(!1)}}).catch(e=>{console.error("Error fetching client secrets: ",e)}))}},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2},{children:[jsxRuntime.exports.jsx(InputText,{name:"password",InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"toggle password visibility",onClick:()=>{b(!y)},"data-test":"oauth-client-secret-password-reveal"},{children:y?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))},inputRef:m,id:"password",color:r?"error":"secondary",type:y?"text":"password",size:"small"}),n?jsxRuntime.exports.jsx(CircularProgress,{color:"secondary"}):jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"submit password",type:"submit","data-test":"oauth-client-secret-password-submit"},{children:jsxRuntime.exports.jsx(ArrowForward,{})}))]}))}))]}))]}))};const AuthenticationStep=({handleOnValidate:e})=>{var t=useStyles$5()["classes"],a=useSelector(selectApp),s=useSelector(selectIsEditForm)["isEditForm"];const i=useDispatch();const n=useForm({mode:"onChange",defaultValues:{oauthUrl:"",authMethod:"none"}});react.exports.useEffect(()=>{null!=e&&e(n.formState.isValid)},[n.formState.isValid]);var o=e=>{var{name:e,value:t}=e.target;i(actions.appFormState.updateAppFormField({field:e,value:t}))};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-authentication-step-container"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},n,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Heading,{title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-title-formattedMessage",defaultMessage:"Authentication",description:"Authentication title"}),description:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-description-formattedMessage",defaultMessage:"Default authentication is None. OAuth and JWT authentication protocols coming soon",description:"authentication description"}),testName:"os-app-center-new.authentication"}),jsxRuntime.exports.jsx(Typography,{variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.authentication-title"}),jsxRuntime.exports.jsx(Typography,{variant:"caption","data-test":"os-app-center-new.authentication-description"}),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsxs(InputRadioGroup,Object.assign({"data-test":"authentication-radio-group",name:"authMethod",value:a.authMethod,onChange:o,rules:{required:!0},row:!0},{children:[jsxRuntime.exports.jsx(FormControlLabel,{value:"none",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-none"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",color:"textSecondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-None-formattedMessage",defaultMessage:"None",description:"None"})}))}),jsxRuntime.exports.jsx(FormControlLabel,{value:"oauth",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-oauth"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-OAuth-formattedMessage",defaultMessage:"OAuth",description:"OAuth"})}))}),jsxRuntime.exports.jsx(FormControlLabel,{value:"jwt",disabled:!0,control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-jwt"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",style:{color:"lightgray"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-JWT-formattedMessage",defaultMessage:"JWT",description:"JWT"})}))}),jsxRuntime.exports.jsx(Chip,{color:"primary",className:t.chip,size:"small",label:"Coming Soon"})]}))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(Collapse,Object.assign({in:lodash.exports.isEqual(a.authMethod,"oauth")},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:5,"data-test":"authentication-oauth-section"},{children:[jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},name:"oauthUrl",value:a.oauthUrl,onChange:o,fullWidth:!0,variant:"outlined",label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2",style:{color:"lightgray"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-url-formattedMessage",defaultMessage:"OAuth URL",description:"Lable for the oauth url input when selecting OAuth"})})),InputLabelProps:{disableAnimation:!1},rules:{required:lodash.exports.isEqual(a.authMethod,"oauth"),pattern:{value:urlRegex,message:"Must be a valid URL including protocol."},maxLength:1e3}}),s?jsxRuntime.exports.jsx(OAuthClientSecret,{appId:a.id}):jsxRuntime.exports.jsxs(Box,{children:[jsxRuntime.exports.jsx(OAuthClientSecret,{appId:"",disabled:!0}),jsxRuntime.exports.jsx(Typography,Object.assign({color:"secondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-not-available-formattedMessage",defaultMessage:"You will be able to retrieve the oauth client secret here after submitting this application.",description:"Instruction durring application onboarding on how to find oauth client secret after application submission."})}))]})]}))}))}))]}))}))}))},useStyles$4=makeStyles()(e=>({container:{width:"100%",padding:"25px 30px"},subheading:{maxWidth:"100%",minWidth:"48.75rem",padding:"30px 0"},titleDesc:{width:"60%",display:"inline-block"},appLogo:{width:"40%",display:"inline-block"},text:{width:"39.5rem",padding:"14px 0",borderBottom:"0.5px solid #D5DFE9",fontWeight:400},textCollapsible:{width:"39.5rem",padding:"8px 0",borderBottom:"0.5px solid #D5DFE9",cursor:"pointer"},collapse:{width:"39.5rem"},collapseContent:{maxHeight:200,overflow:"auto"},pre:{whiteSpace:"pre-line"},asterisk:{color:"#D43060",margin:"0 2px"}})),useStyles$3=makeStyles()(e=>({root:{borderRadius:"50%",border:"1px solid #D5DFE9",display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",width:e.spacing(8),height:e.spacing(8)},logo:{maxWidth:"100%",maxHeight:"100%"},veritoneLogo:{maxWidth:"100%",maxHeight:"100%"}})),AppLogo=({path:e})=>{var t=useStyles$3()["classes"];return jsxRuntime.exports.jsx("div",Object.assign({className:t.root},{children:jsxRuntime.exports.jsx("img",{className:t.logo+" "+(!e&&t.veritoneLogo),src:e||img$1y,alt:"app logo"})}))},Row=({label:e,value:t,style:a,testName:s,icon:i,asterisk:n,handleOpenCollapse:o,textTransformValue:r="capitalize"})=>jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"space-between",alignItems:"center",textTransform:r,"data-test":s+"-container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6","data-test":"label-"+s},{children:e})),jsxRuntime.exports.jsxs(Box,Object.assign({className:a,display:"flex",justifyContent:"space-between",alignItems:"center",onClick:o},{children:[jsxRuntime.exports.jsxs(Typography,Object.assign({variant:"h6",sx:{fontWeight:400}},{children:[t,n]})),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"expand row",size:"small",onClick:o,"data-test":s+"-expand-action-trigger"},{children:i}))]}))]})),ConfirmationStep=()=>{var e=useStyles$4()["classes"],t=useSelector(selectApp);return jsxRuntime.exports.jsxs(Box,Object.assign({className:e.container,"data-test":"os-app-center-new-confirmation-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.subheading},{children:[jsxRuntime.exports.jsxs("div",Object.assign({className:e.titleDesc},{children:[jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",alignItems:"center",textTransform:"capitalize","data-test":"os-app-center-new-confirmation-step.app-name"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2"},{children:lodash.exports.isEmpty(t.name)?"-":t.name}))})),jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-confirmation-step.app-description"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",color:"#2A323C"},{children:lodash.exports.isEmpty(t.description)?"-":t.description}))}))]})),jsxRuntime.exports.jsx("div",Object.assign({"data-test":"os-app-center-new-confirmation-step.app-logo",className:e.appLogo},{children:jsxRuntime.exports.jsx(AppLogo,{path:t.iconPath})}))]})),jsxRuntime.exports.jsxs(Box,Object.assign({sx:{width:"100%"},"data-test":"os-app-center-new-confirmation-step.row-container"},{children:[jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-url-formattedMessage",defaultMessage:"Application URL:",description:"application url"}),textTransformValue:"none",value:lodash.exports.isEmpty(t.url)?"-":t.url,style:e.text,testName:"os-app-center-new-confirmation-step.app-url"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.custom-fields-formattedMessage",defaultMessage:"Custom Fields:",description:"Custom Fields"}),value:lodash.exports.isEmpty(t.configFields)?"-":lodash.exports.join(lodash.exports.map(t.configFields,e=>e.name),", "),style:e.text,testName:"os-app-center-new-confirmation-step.app-custom-fields"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-headerbar-formattedMessage",defaultMessage:"Headerbar:",description:"headerbar"}),value:t.headerbarEnabled?"On (Default)":"Off",style:e.text,testName:"os-app-center-new-confirmation-step.app-headerbar"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-auth-formattedMessage",defaultMessage:"Authentication:",description:"auth"}),value:"None (Default)",style:e.text,testName:"os-app-center-new-confirmation-step.app-auth"})]}))]}))},useBasicInfoStyles=makeStyles()(e=>({container:{padding:e.spacing(6),justifyContent:"space-around","& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},textInput:{padding:26},labelRow:{display:"flex",gap:e.spacing(2),alignItems:"flex-end"},optional:{fontSize:10,marginBottom:e.spacing(1)},select:{"& > div":{fontWeight:400,width:"280px"}}})),useIconImporterStyles=makeStyles()(e=>({iconBox:{display:"flex",justifyContent:"center",alignItems:"center",width:200,height:200,padding:e.spacing(3),border:"1px dashed #D5DFE9",borderRadius:5,transition:"all .2s ease","&:hover":{border:"1px solid #dde6ee"}},innerBox:{position:"relative",background:"#F5F5F5",width:"100%",height:"100%",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center",transition:"all .2s ease","&:hover":{background:"#dde6ee"}},fileInput:{display:"none"},addIcon:{color:"#555F7C",height:42,width:42,"&:hover":{color:"#555F7C"}},iconPreview:{objectFit:"cover",borderRadius:5,width:"100%",maxHeight:"100%"},removeIcon:{top:"90%",right:66}})),useDragAndDrop=({acceptedFileTypes:n})=>{const t=react.exports.useRef(),e=react.exports.useRef(),o=useDispatch();var a=useSelector(preferredLanguageSelector);const r=AIWareFormatMessage(a),s=react.exports.useCallback(e=>{var t,a,s,i;e&&(n.includes(e.type)?5e6<=e.size?o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileSize",defaultMessage:[{type:0,value:"File file size must be less than 5 MB"}]}),severity:MessageSeverity.Warning})):({name:t,size:a,type:s}=e,i=URL.createObjectURL(e),i={id:guid(),previewUrl:i,name:t,size:a,type:s},o(actions.iconUploadState.uploadIconStart({file:i}))):o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileType",defaultMessage:[{type:1,value:"type"},{type:0,value:" is not a supported image type."}]},{type:e.type}),severity:MessageSeverity.Warning})))},[n,o]),i=react.exports.useCallback(e=>{e.preventDefault();e=e.dataTransfer.files[0];s(e)},[s]);const p=e=>{e.preventDefault()};return react.exports.useEffect(()=>{const e=t.current;return e.addEventListener("drop",i),()=>{e.removeEventListener("drop",i)}},[i]),react.exports.useEffect(()=>{const e=t.current;return e&&(e.addEventListener("dragover",p),e.addEventListener("dragleave",p)),()=>{e.removeEventListener("dragover",p),e.removeEventListener("dragleave",p)}},[]),{dropZoneRef:t,fileInputRef:e,handleRemoveFile:e=>{e.stopPropagation(),o(actions.iconUploadState.deleteLocalIcon()),o(actions.appFormState.updateAppFormField({field:"iconPath",value:""}))},handleOpenFilePicker:()=>{e.current.click()},handleIconSelect:e=>{e=e.target.files[0];s(e)}}},acceptedFileTypes=["image/jpeg","image/png","image/gif","image/svg+xml"],IconImporter=({iconPath:e})=>{var t=useSelector(selectIcon),a=useIconImporterStyles()["classes"],{dropZoneRef:s,fileInputRef:i,handleRemoveFile:n,handleIconSelect:o,handleOpenFilePicker:r}=useDragAndDrop({acceptedFileTypes:acceptedFileTypes});return jsxRuntime.exports.jsx("div",Object.assign({className:a.iconBox,ref:s,"data-test":"app-description-icon-dropzone"},{children:e||null!=t&&t.previewUrl?jsxRuntime.exports.jsxs("div",Object.assign({className:a.innerBox,style:{backgroundColor:"transparent"}},{children:[jsxRuntime.exports.jsx(IconButton,Object.assign({style:{position:"absolute"},"data-test":"app-description-icon-remove",className:a.removeIcon,size:"small",onClick:n},{children:jsxRuntime.exports.jsx(default_1$2,{})})),jsxRuntime.exports.jsx("img",{src:(null==t?void 0:t.previewUrl)||e,alt:(null==t?void 0:t.name)||"Icon",className:a.iconPreview,"data-test":"app-description-icon-preview"})]})):jsxRuntime.exports.jsxs(Button,Object.assign({className:a.innerBox,onClick:r},{children:[jsxRuntime.exports.jsx("input",{accept:"image/jpeg, image/png",type:"file",ref:i,className:a.fileInput,onChange:o}),jsxRuntime.exports.jsx(default_1$3,{className:a.addIcon})]}))}))},BasicInfo=({onValidate:e})=>{var t=useBasicInfoStyles()["classes"];const a=useIntl(),s=useDispatch(),i=useSelector(selectApp),n=useSelector(selectIsResumeSession),o=useSelector(selectApps);var r=useSelector(selectAppPackageDistributionType),p={name:i.name,description:i.description};const l=useForm({mode:"onChange",defaultValues:p}),d=(react.exports.useEffect(()=>{e(l.formState.isValid)},[l.formState.isValid]),react.exports.useEffect(()=>{__awaiter(void 0,void 0,void 0,function*(){n&&(l.reset(i),setTimeout(()=>__awaiter(void 0,void 0,void 0,function*(){yield l.trigger()}),500))}).catch(e=>{console.error("Error validating information: ",e)})},[n]),(e,t)=>{s(actions.appFormState.updateAppFormField({field:e,value:t}))});p=e=>{var{name:e,value:t}=e.target;d(e,t)};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"basic-info"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},l,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,rowSpacing:4,columnSpacing:10,"data-test":"app-description"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,item:!0,xs:12,sm:8,rowSpacing:2,columnSpacing:6},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12,sm:6},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.name-description-label",defaultMessage:"Name & Description",description:"Name & Description"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-description-caption",defaultMessage:"Provide a name and description to let users know what your application does.",description:"application name and description caption"})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},"data-test":"app-description-input-name",variant:"outlined",sx:{marginBottom:3},placeholder:"Application Name",name:"name",value:i.name,onChange:p,fullWidth:!0,rules:{required:!0,maxLength:100,validate:{isNameSame:t=>{return!o.find(e=>e.name.toLowerCase()===t.toLowerCase())||a.formatMessage({id:"os-app-center-new.app-description-input-name-error",defaultMessage:[{type:0,value:"An application with this name already exists"}]})}}}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{InputProps:{className:t.textInput},"data-test":"app-description-input-description",variant:"outlined",placeholder:"Description",name:"description",fullWidth:!0,multiline:!0,rows:10,value:i.description,onChange:p,rules:{required:!0,maxLength:250}})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({container:!0,item:!0,xs:12,sm:4,rowSpacing:4,columnSpacing:6},{children:jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{py:1}},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.icon-image-label",defaultMessage:"App Icon",description:"App Icon"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.image-recommended-label",defaultMessage:"Recommended image size:{br}300x300 .png or .jpg",description:"Recommended image size:{br} 300x300 .png or .jpg",values:{br:jsxRuntime.exports.jsx("br",{})}})}))]})),jsxRuntime.exports.jsx(IconImporter,{iconPath:i.iconPath})]}))})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(EntityTags,{selectedTags:i.entityTags,setSelectedTags:e=>{s(actions.appFormState.updateAppFormField({field:"entityTags",value:e}))}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(DistributionFlags,{description:"Add Distribution Flag for App",selectedFlag:r,engineFlags:engineFlags,handleEngineFlag:({value:e})=>{d("packageDistributionType",e)},idPrefix:"os-app-center-new",inputName:"appPackageDistribution"})}))]}))}))}))},AppOnboardingFlow=()=>{const a=useDispatch(),s=useSelector(selectApp),i=useSelector(selectIsEditForm)["isEditForm"],n=useSelector(selectPrevNodeModules),[e,t]=react.exports.useState(!1);var o=e=>t(e);var o=[jsxRuntime.exports.jsx(BasicInfo,{onValidate:o}),jsxRuntime.exports.jsx(FunctionalityStep,{handleOnValidate:o}),jsxRuntime.exports.jsx(HeaderbarStep,{handleOnValidate:o}),jsxRuntime.exports.jsx(AuthenticationStep,{handleOnValidate:o}),jsxRuntime.exports.jsx(ConfirmationStep,{})],r=[jsxRuntime.exports.jsx(Button,Object.assign({"data-test":"app-new-submit-app-button",variant:"contained",color:"primary",onClick:()=>{var e,t;e=!1,i?(t=lodash.exports.differenceWith(s.nodeModules,n,lodash.exports.isEqual),a(actions.appFormState.updateAppStart({app:Object.assign(Object.assign({},s),{nodeModules:t}),openBuildPanel:e}))):a(actions.appFormState.createAppStart({app:s,openBuildPanel:e}))}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.{idPrefix}-app-button",defaultMessage:"{verb}",description:"{verb} app button text",values:{idPrefix:i?"update":"submit",verb:i?"Update":"Submit"}})}),"submit-app-button")];return jsxRuntime.exports.jsx(ProgressStepper,{panelName:"APP_CENTER_NEW",sessionKey:"appOnboardingSession",entityId:s.id,onResumeSession:e=>{var t=lodash.exports.omit(e,"eventHandlers"),e=lodash.exports.get(e,"eventHandlers");a(actions.appEventsPanelState.resumeSession(e)),a(actions.appFormState.resumeSession(t))},steps:["Basic Info","Functionality","Headerbar","Authentication","Review"],stepContent:o,customFinalStepButtons:r,nextButtonDisabled:!e,idPrefix:"app-center-new-aob"})},appBarHeight$1=55,headerHeight=64,borderBottom$1=5,useStyles$2=makeStyles()(e=>({ecnPanel:{height:`calc(100vh - ${appBarHeight$1}px - ${headerHeight}px - ${borderBottom$1}px)`}})),MainLayout=({appId:e})=>{var t=useStyles$2()["classes"];const a=useDispatch();var s=useSelector(selectIsLoadingExistingAppData)["isLoadingExistingAppData"];return react.exports.useEffect(()=>{e?a(actions.appFormState.editApp(e)):a(actions.appFormState.createNewApp())},[]),jsxRuntime.exports.jsx("div",Object.assign({role:"presentation","data-test":"app-center-new-widget",className:t.ecnPanel},{children:s?jsxRuntime.exports.jsx(Box,Object.assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},{children:jsxRuntime.exports.jsx(CircularProgress,{})})):jsxRuntime.exports.jsx(AppOnboardingFlow,{})}))},AppCenterNew=e=>jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getAppCenterNewModule()]},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(MainLayout,Object.assign({},e))})})}))}),appBarHeight=55,borderBottom=5,mainHeight=`calc(100vh - ${appBarHeight+borderBottom}px)`,useStyles$1=makeStyles()(e=>({root:{display:"flex",flexFlow:"column",height:mainHeight},container:{padding:e.spacing(5),"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{width:"100%"},optional:{fontSize:12,marginBottom:e.spacing(1),marginLeft:e.spacing(1),color:"#9CA8B4"}})),ConfigFieldsForm=({hidePanel:t,isEdit:a=!1,editIndex:s=-1})=>{var e=useStyles$1()["classes"],i=useSelector(preferredLanguageSelector);const n=AIWareFormatMessage(i),o=useDispatch(),r=useSelector(selectApp),p=useSelector(selectConfigFields);var i=()=>a&&0<=s?p[s]:{name:"",configLevel:AppConfigLevel.Organization,type:AppConfigType.String,required:!1,defaultValue:""},l=i();const d=useForm({mode:"onChange",defaultValues:l}),[c,u]=react.exports.useState(i().type),[x,m]=react.exports.useState(i().configLevel);return jsxRuntime.exports.jsx(FormProvider,Object.assign({},d,{children:jsxRuntime.exports.jsxs("form",Object.assign({className:e.root,onSubmit:d.handleSubmit(e=>{a?o(actions.appFormState.updateConfigField({configFields:e,index:s,name:p[s].name})):lodash.exports.isEmpty(r.id)?o(actions.appFormState.addConfigField(e)):o(actions.appFormState.createConfigField({newConfigField:e,appId:r.id})),t()})},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.container,container:!0,spacing:5,"data-test":"app-new-config-fields-form-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-new-config-fields-header-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title",defaultMessage:"{label} Config Fields",description:"Form label for supported file types",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title-close",defaultMessage:"Close",description:"Form label for close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-description-input-icon"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-name"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-name",defaultMessage:"Name",description:"You can set a field name"})})),jsxRuntime.exports.jsx(InputText,{inputProps:{maxLength:50,className:e.textInput},variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-new-config-fields-name-content",rules:{required:!0,maxLength:50,validate:{isNameSame:a=>{return!p.find((e,t)=>t!==s&&e.name===a)||n({id:"os-app-center-new.config-name-error",defaultMessage:[{type:0,value:"Please select a different name"}]})}}}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-description",defaultMessage:"Description",description:"You can set a field description"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",name:"description",fullWidth:!0,multiline:!0,rows:5,"data-test":"app-new-config-fields-description-content",inputProps:{maxLength:250},InputProps:{className:e.textInput},rules:{required:!0,maxLength:250}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-config-level"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.config-level",defaultMessage:"Config Level",description:"You can set a config level"})})),jsxRuntime.exports.jsxs(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"configLevel",value:x,defaultValue:x,onChange:e=>{d.setValue("configLevel",e.target.value),m(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-level-content",rules:{required:!0}},{children:[jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"Organization"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-organization",defaultMessage:"Organization",description:"You can set a config level"})})),jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"User"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-user",defaultMessage:"User",description:"You can set a config level"})}))]}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-type"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-type",defaultMessage:"Type",description:"You can set a field type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"type",value:c,onChange:e=>{d.setValue("type",e.target.value),u(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-fields-type-content",rules:{required:!0}},{children:map_1(keys_1(AppConfigType),(e,t)=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:AppConfigType[e]},{children:AppConfigType[e]}),t))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(SchemaOrText,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"12.5px 0 0 25px"}},{children:jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:jsxRuntime.exports.jsx(InputCheckbox,{name:"required",defaultChecked:l.required,label:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.required-checkbox",defaultMessage:"Make Required",description:"Required field checkbox"})})}))}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!get_1(d,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-new-config-fields-button-submit"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-config-fields.submit-button-label",defaultMessage:"{label}",description:"{label} Config Fields",values:{label:a?"Update":"Add"}})}))}))]}))}))},AppCenterConfigFieldsForm=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ConfigFieldsForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex})})})}),useStyles=makeStyles()(e=>({form:{display:"flex",flexDirection:"column",height:"100%"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{textTransform:"capitalize"}})),ContextMenuExtensionForm=({hidePanel:t,isEdit:a,editIndex:s,extensionType:i})=>{var e=useStyles()["classes"];const n=useDispatch();var o=useSelector(selectIsEditForm)["isEditForm"],r=useSelector(selectPrevContextMenuExtensions);const p=useSelector(selectContextMenuExtensions);r=a&&lodash.exports.findIndex(r[i+"s"],e=>lodash.exports.isMatch(e,p[i+"s"][s]))<0,o=a&&o&&!r,r=useForm({mode:"onChange",defaultValues:a&&0<=s&&!lodash.exports.isNil(i)?p[i+"s"][s]:{label:"",url:"",type:""}});const l=r.watch("type");return jsxRuntime.exports.jsx(Box,Object.assign({sx:{p:6,height:"calc(100vh - 60px)"}},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},r,{children:jsxRuntime.exports.jsxs("form",Object.assign({onSubmit:r.handleSubmit(e=>{a&&0<=s&&!lodash.exports.isNil(i)?n(actions.appFormState.updateContextMenuExtension({extensionType:i,index:s,extension:e})):(e.id=v4(),n(actions.appFormState.addContextMenuExtension({extension:e}))),null!=t&&t()}),className:e.form},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,direction:"column",spacing:8,"data-test":"app-center-new.context-menu-extension.panel-container",flexWrap:"nowrap"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-center-new.context-menu-extension.panel-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title",defaultMessage:"{label} a Context Menu Extension",description:"Panel title for context menu extension form",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title-close",defaultMessage:"Close",description:"Close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-center-new.context-menu-extension.close-button"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.type-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.type-header-text",defaultMessage:"Type",description:"You can set a type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({name:"type",fullWidth:!0,disabled:o,rules:{required:!0},className:e.inputSelect,"data-test":"app-center-new.context-menu-extension.type-input"},{children:Object.values(ContextMenuExtensionType).map(e=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:e,"data-test":"app-center-new.context-menu-extension.type-input."+e},{children:"tdo"===e?"Media (Temporal Data Objects)":e}),e))}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.label-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.label-header",defaultMessage:"Label",description:"You can set a label"})})),jsxRuntime.exports.jsx(InputText,{name:"label",fullWidth:!0,rules:{required:!0,maxLength:50,validate:t=>{var e;return!!lodash.exports.isEmpty(null===p||void 0===p?void 0:p[l+"s"])||!(!(a&&0<=s)||lodash.exports.isNil(i))||(e=null==(e=p[l+"s"])?void 0:e.find(e=>e.label===t),!!lodash.exports.isNil(e))||"Label already exists for this type."}},"data-test":"app-center-new.context-menu-extension.label-input"})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.url-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.url-header",defaultMessage:"Open a URL in a new tab (optional)",description:"You can set a url"})})),jsxRuntime.exports.jsx(InputText,{placeholder:l&&`https://example.com?${l}Id=\${${l}Id}`,name:"url",fullWidth:!0,rules:{maxLength:255,validate:e=>!!lodash.exports.isEmpty(e)||(urlRegex.test(e)?!!lodash.exports.includes(e,"${"+l+"Id}")||"URL must contain ${"+l+"Id}":"Must be a valid URL including protocol.")},"data-test":"app-center-new.context-menu-extension.url-input"})]}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!lodash.exports.get(r,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-center-new.context-menu-extension.submit-button"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.submit-button-text",defaultMessage:"{label}",description:"{label} Context Menu Extension",values:{label:a?"Update":"Add"}})}))}))]}))}))}))},ContextMenuExtensionPanel=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ContextMenuExtensionForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex,extensionType:e.extensionType})})})});export{AppCenterConfigFieldsForm,ContextMenuExtensionPanel as AppCenterContextMenuExtensionPanel,AppCenterNew};
162
+ `;return(yield baseGraphQLApiWithError(Object.assign({query:t,variables:{id:s},operationName:e},a))).application}),updateApplication=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="updateApplication";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation updateApplication ($input: UpdateApplication!) {\n updateApplication (input: $input) {\n id\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),bulkDeleteContextMenuExtensions=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="bulkDeleteContextMenuExtensions";return(yield baseGraphQLApiWithError(Object.assign({query:"\n mutation bulkDeleteContextMenuExtensions ($input: BulkDeleteContextMenuExtensions!) {\n bulkDeleteContextMenuExtensions (input: $input) {\n mentions {\n id\n label\n url\n type\n }\n tdos {\n id\n label\n url\n type\n }\n watchlists {\n id\n label\n url\n type\n }\n collections {\n id\n label\n url\n type\n }\n }\n }\n ",variables:{input:a},operationName:e},t)))[e]}),deleteConfigField=(t,a,s)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionDelete";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionDelete($appId: ID! $configKey: String!) {\n applicationConfigDefinitionDelete(\n input: {\n appId: $appId\n configKey: $configKey\n }\n )\n {\n success\n code\n msg\n }\n }\n ",variables:{appId:a,configKey:s},operationName:e},t))}),updateConfigField=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinitionUpdate";return yield baseGraphQLApiWithError(Object.assign({query:"\n mutation applicationConfigDefinitionUpdate($input: [ApplicationConfigDefinitionUpdateInput]) {\n applicationConfigDefinitionUpdate(input: $input)\n {\n records {\n applicationId\n configKey\n }\n }\n }",variables:{input:a},operationName:e},t))}),getApplicationConfigFields=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="applicationConfigDefinition";return yield baseGraphQLApiWithError(Object.assign({query:"\n query applicationConfigDefinition ($appId: ID!) {\n applicationConfigDefinition(appId: $appId) {\n records {\n applicationId\n configKey\n configType\n configLevel\n description\n defaultValue\n defaultValueJSON\n required\n secured\n }\n }\n\n }\n ",variables:{appId:a},operationName:e},t))}),getOAuthClientSecret=(t,a)=>__awaiter(void 0,void 0,void 0,function*(){var e="getApplicationOatuhClientSecret";return yield baseGraphQLApiWithError(Object.assign({query:"query getApplicationOatuhClientSecret($id: ID!, $password: String!) {\n application(id: $id) {\n id,\n clientSecret(password: $password)\n }\n }",variables:a,operationName:e},t))}),getSchemasByName=(a,s={name:""})=>__awaiter(void 0,void 0,void 0,function*(){var e={name:s.name},t="getSchemasByDataRegistryName";return yield baseGraphQLApiWithError(Object.assign({query:"\n query getSchemasByDataRegistryName($name:String){\n dataRegistries(\n name: $name\n ){\n records {\n id\n name\n modifiedDateTime\n schemas {\n records {\n id\n dataRegistryId\n modifiedDateTime\n majorVersion\n minorVersion\n }\n }\n }\n }\n }\n ",variables:e,operationName:t},a))}),getEvents$1=t=>__awaiter(void 0,void 0,void 0,function*(){var e="systemEvents";return yield baseGraphQLApiWithError(Object.assign({query:'\n query systemEvents {\n events (application: "system", limit: 9999) {\n records {\n id\n eventName\n eventType\n description\n }\n }\n }\n ',operationName:e},t))});function*searchFlows(e){yield delay(200),yield put(actions.flowLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getFlowsByName,t,{name:e.payload});yield put(actions.flowLinkingPanelState.updateFlowLinkingPanelField({field:"searchResults",value:a.engines.records})),yield put(actions.flowLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.flowLinkingPanelState.fetchingDone())}}function*watchSearchFlows(){yield takeLatest$1(actions.flowLinkingPanelState.searchByTerm.type,searchFlows)}const flowsSagas=[fork(watchSearchFlows)];function*searchSchemas(e){yield delay(200),yield put(actions.schemaLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getSchemasByName,t,{name:e.payload});yield put(actions.schemaLinkingPanelState.updateSchemaLinkingPanelField({field:"searchResults",value:lodash.exports.map(a.dataRegistries.records,e=>{var t=lodash.exports.reduce(e.schemas.records,(e,t)=>t.majorVersion>e.majorVersion||t.majorVersion==e.majorVersion&&t.minorVersion>e.minorVersion?t:e);return t?{id:t.id,dataRegistryId:t.dataRegistryId,name:e.name,modifiedDateTime:t.modifiedDateTime,version:`v${t.majorVersion}.`+t.minorVersion}:null}).filter(e=>!(!e||!e.name))})),yield put(actions.schemaLinkingPanelState.fetchingDone())}catch(e){yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.schemaLinkingPanelState.fetchingDone())}}function*watchSearchSchemas(){yield takeLatest$1(actions.schemaLinkingPanelState.searchByTerm.type,searchSchemas)}const schemasSagas=[fork(watchSearchSchemas)];function*searchEngines(e){yield delay(200),yield put(actions.engineLinkingPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEnginesByName,t,{name:e.payload}),s=lodash.exports.filter(a.engines.records,e=>"c5458876-43d2-41e8-a340-f734702df04a"!==e.category.id);yield put(actions.engineLinkingPanelState.updateEngineLinkingPanelField({field:"searchResults",value:s})),yield put(actions.engineLinkingPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.engineLinkingPanelState.fetchingDone())}}function*watchSearchEngines(){yield takeLatest$1(actions.engineLinkingPanelState.searchByTerm.type,searchEngines)}const enginesSagas=[fork(watchSearchEngines)];function*getEvents(e){yield delay(0),yield put(actions.appEventsPanelState.fetchingStart());var t=yield select(selectApiConfigs);try{var a=yield call(getEvents$1,t);yield put(actions.appEventsPanelState.updateEventsPanelField({field:"searchResults",value:a.events.records})),yield put(actions.appEventsPanelState.fetchingDone())}catch(e){console.log(e.message),yield put(showMessage({content:e.message,severity:MessageSeverity.Error})),yield put(actions.appEventsPanelState.fetchingDone())}}function*watchGetEvents(){yield takeLatest$1(actions.appEventsPanelState.getEvents.type,getEvents)}const appEventsSagas=[fork(watchGetEvents)],supportedAppFields$1=["id","name","isPublic","key","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","contextMenuExtensions","eventEndpoint","entityTags","headerbarEnabled","nodeModules","applicationHeaderbar","packageDistributionType"],formatApp$1=t=>{const a={checkPermissions:t.checkPermissions||!1,name:t.name,key:lodash.exports.snakeCase(t.name)};return supportedAppFields$1.forEach(e=>{if(!lodash.exports.isNil(t[e])){if("applicationHeaderbar"===e)return t.headerbarEnabled&&(a.headerbar=t[e]);a[e]=t[e]}}),lodash.exports.isNil(t.iconPath)||(a.iconUrl=t.iconPath),lodash.exports.isNil(t.oauthUrl)||lodash.exports.isEmpty(t.oauthUrl)||(a.oauth2RedirectUrls=[t.oauthUrl]),a};function*createNewApplication(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"];if(lodash.exports.isNil(e))throw new Error("Empty app not allowed!");var a=yield select(selectApiConfigs);try{var s,n=formatApp$1(e),i=yield call(createApplication,a,n),{flows:o,engines:r,schemas:p}=e;lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)&&lodash.exports.isEmpty(p)||(s={id:i.id},lodash.exports.isEmpty(o)&&lodash.exports.isEmpty(r)||(s.engines={add:[...lodash.exports.map(o,e=>e.id),...lodash.exports.map(r,e=>e.id)],remove:[]}),lodash.exports.isEmpty(p)||(s.dataRegistries={add:lodash.exports.map(p,e=>e.dataRegistryId),remove:[]}),yield call(updateAppComponents,a,s)),lodash.exports.isEmpty(e.configFields)||(yield call(createAppConfig,a,i.id,e.configFields)),yield put(actions.appFormState.createAppSuccess(i.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appCreateSuccess",defaultMessage:[{type:0,value:"Application successfully created"}]}),severity:MessageSeverity.Success})),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){n=lodash.exports.get(e[0],"data.validationErrors[0].message")||"Application onboarding failed";yield put(actions.appFormState.createAppFailed(e[0].message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.appOnboardingFailed",defaultMessage:[{type:1,value:"message"}]},{message:n}),severity:MessageSeverity.Error}))}}function*watchNewApplicationCreateStart(){yield takeLatest$1(actions.appFormState.createAppStart.type,createNewApplication)}const newApplicationSagas=[fork(watchNewApplicationCreateStart)],root="undefined"!=typeof window?window:global,fileUploadChannel=(root.xhrInstances={},channel());function*uploadIcon(t){const a=t.payload.file;t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);try{var e=yield call(getUrlBucket,a.name);const n=Object.assign(Object.assign({},a),{status:IconImportStatus.Uploading,percentComplete:0,expiresInSeconds:e.expiresInSeconds,getUrl:e.getUrl,key:e.key,unsignedUrl:e.unsignedUrl,url:e.url}),i=(yield put(actions.iconUploadState.updateIcon(n)),e=>{fileUploadChannel.put(actions.iconUploadState.updateIcon(Object.assign({id:a.id},e)))});var s=yield uploadFileToS3(e,a,{onProgress:e=>{i({percentComplete:e}),sdkEventManager.dispatch(SdkEvents.fileUploadProgress,null,e)},onAbort:e=>{i({status:IconImportStatus.Aborted}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e,"abort"),n)},onError:e=>{i({status:IconImportStatus.Failed}),sdkEventManager.dispatch(SdkEvents.fileUpload,new SdkError(e),n)},onUpload:e=>{i({status:IconImportStatus.Uploaded}),sdkEventManager.dispatch(SdkEvents.fileUpload,null,n)}});root.xhrInstances[a.id]=s,yield put(actions.iconUploadState.uploadIconSuccess()),yield put(actions.appFormState.updateAppFormField({field:"iconPath",value:n.getUrl}))}catch(e){yield put(actions.iconUploadState.uploadIconFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.snackbar.iconUploadFail",defaultMessage:[{type:0,value:"Icon upload failed, please try again."}]}),severity:MessageSeverity.Error}))}}function*getUrlBucket(e){var t=yield select(selectApiConfigs);return yield call(getSignedWritableUrl,t,e)}function*watchUploadIconStart(){yield takeLatest$1(actions.iconUploadState.uploadIconStart.type,uploadIcon)}function*watchProgressChannel(){var e=yield take(fileUploadChannel);yield put(e)}const supportedAppFields=["id","name","isPublic","category","description","iconUrl","iconSvg","url","oauth2RedirectUrls","checkPermissions","deploymentModel","eventEndpoint","entityTags","headerbarEnabled","nodeModules","applicationHeaderbar","packageDistributionType"],formatApp=a=>{const t={checkPermissions:a.checkPermissions||!1,name:a.name,id:a.id};if(lodash.exports.forEach(supportedAppFields,e=>{if(!lodash.exports.isNil(a[e])){if("applicationHeaderbar"===e)return a.headerbarEnabled&&(t.headerbar=a[e]);t[e]=a[e]}}),lodash.exports.isNil(a.iconPath)||(t.iconUrl=a.iconPath),!lodash.exports.isEmpty(a.contextMenuExtensions)){const s={mentions:[],tdos:[],watchlists:[],collections:[]};lodash.exports.forEach(lodash.exports.keys(a.contextMenuExtensions),t=>{lodash.exports.forEach(a.contextMenuExtensions[t],e=>{s[t].push({id:e.id,label:e.label,url:e.url})})}),t.contextMenuExtensions=s}return t},decodeApp=(e,t)=>{const a=[],s=[];lodash.exports.map(lodash.exports.get(e.components.engines,"records"),e=>{("c5458876-43d2-41e8-a340-f734702df04a"===e.categoryId?a:s).push(e)});t=lodash.exports.map(lodash.exports.get(t.applicationConfigDefinition,"records"),e=>{return{id:e.applicationId,name:e.configKey,type:e.configType,configLevel:AppConfigLevel[e.configLevel],required:e.required,description:e.description,defaultValue:e.defaultValue,secured:!1}});return{id:e.id,name:e.name,description:e.description,entityTags:lodash.exports.map(e.entityTags,e=>({tagKey:e.tagKey,tagValue:e.tagValue})),configFields:t,status:e.status,url:e.url,oauth2RedirectUrls:e.oauth2RedirectUrls,iconSvg:e.iconSvg,iconPath:e.iconUrl,key:e.key,clientSecret:e.clientSecret,validStateActions:e.validStateActions,createdDateTime:e.createdDateTime,modifiedDateTime:e.modifiedDateTime,flows:a,engines:s,headerbarEnabled:e.headerbarEnabled,schemas:lodash.exports.map(lodash.exports.get(e.components.dataRegistries,"records"),e=>{return{dataRegistryId:e.id,name:e.name,modifiedDateTime:e.modifiedDateTime,version:(e=e.publishedSchema)?e.majorVersion+"."+e.minorVersion:""}}),contextMenuExtensions:e.contextMenuExtensions,nodeModules:e.nodeModules,applicationHeaderbar:e.applicationHeaderbar}};function*queryAppDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplication,t,e)}function*queryAppConfigFieldDetails(e){var t=yield select(selectApiConfigs);return yield call(getApplicationConfigFields,t,e)}function*editApp(e){var t=yield queryAppDetails(e.payload),e=yield queryAppConfigFieldDetails(e.payload);yield put(actions.appFormState.setEditAppExistingData(decodeApp(t,e)))}function*updateApp(e){var t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t||"en"),e=e.payload["app"],a=yield select(selectApiConfigs);try{var s,n,i,o,r=formatApp(e),p=yield call(updateApplication,a,r),{flows:l,flowsToDelete:d,engines:c,enginesToDelete:u,schemas:x,schemasToDelete:m,contextMenuExtensionIdsForBulkDelete:g}=e,h=(lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(d)&&lodash.exports.isEmpty(u)&&lodash.exports.isEmpty(m)||(s={id:p.id},n=lodash.exports.differenceBy(d,l,"id"),i=lodash.exports.differenceBy(u,c,"id"),o=lodash.exports.differenceBy(m,x,"dataRegistryId"),lodash.exports.isEmpty(l)&&lodash.exports.isEmpty(c)&&lodash.exports.isEmpty(n)&&lodash.exports.isEmpty(i)||(s.engines={add:[...lodash.exports.map(l,e=>e.id),...lodash.exports.map(c,e=>e.id)],remove:[...lodash.exports.map(n,e=>e.id),...lodash.exports.map(i,e=>e.id)]}),lodash.exports.isEmpty(x)&&lodash.exports.isEmpty(o)||(s.dataRegistries={add:lodash.exports.map(x,e=>e.dataRegistryId),remove:lodash.exports.map(o,e=>e.dataRegistryId)}),yield call(updateAppComponents,a,s),lodash.exports.isEmpty(g))||(yield call(bulkDeleteContextMenuExtensions,a,g)),yield put(actions.appFormState.createAppSuccess(p.id)),localStorage.removeItem("appOnboardingSession"),yield put(showMessage({content:t({id:"os-app-center-new.app-update-success",defaultMessage:[{type:0,value:"App successfully updated"}]}),severity:MessageSeverity.Success})),"APP_CENTER_DETAILS"),f={name:h,config:{appId:p.id}};yield put(mountPanel({panelId:h,microFrontend:f,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,size:"xlarge"}})),localStorage.removeItem("appOnboardingSession"),yield put(unmountPanel("APP_CENTER_NEW"))}catch(e){yield put(actions.appFormState.createAppFailed(e.message)),yield put(showMessage({content:t({id:"os-app-center-new.app-updating-failed",defaultMessage:[{type:0,value:"App updating failed"}]}),severity:MessageSeverity.Error}))}}function*deleteAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configToDelete.id)try{yield call(deleteConfigField,t,e.configToDelete.id,e.configToDelete.name)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-delete-fail",defaultMessage:[{type:0,value:"Config field failed to be deleted"}]}),severity:MessageSeverity.Error}))}}function*updateAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t&&e.configFields.id){var s={configKey:e.configFields.name,description:e.configFields.description,configLevel:e.configFields.configLevel,configType:AppConfigType[e.configFields.type],defaultValue:e.configFields.defaultValue,required:e.configFields.required,secured:!1},e={input:[{filter:{appId:e.configFields.id,configKey:e.name},update:s}]};try{yield call(updateConfigField,t,e.input)}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-update-fail",defaultMessage:[{type:0,value:"Config field failed to be updated"}]}),severity:MessageSeverity.Error}))}}}function*addAppConfigField(e){var e=e["payload"],t=yield select(selectApiConfigs),a=yield select(preferredLanguageSelector),a=AIWareFormatMessage(a);if(t)try{yield call(createAppConfig,t,e.appId,[e.newConfigField])}catch(e){yield put(showMessage({content:a({id:"os-app-center-new.config-field-create-fail",defaultMessage:[{type:0,value:"Config field failed to be created"}]}),severity:MessageSeverity.Error}))}}function*fetchApplications(){var e=yield select(selectApiConfigs),t=yield select(preferredLanguageSelector),t=AIWareFormatMessage(t);if(e)try{var a=yield call(getApplications,e);yield put(actions.appFormState.fetchApplications(a))}catch(e){yield put(showMessage({content:t({id:"os-app-center-new.get-all-applications-fail",defaultMessage:[{type:0,value:"Fetching applications failed"}]}),severity:MessageSeverity.Error}))}}function*watchEditApp(){yield takeLatest$1(actions.appFormState.editApp.type,editApp)}function*watchUpdateAppStart(){yield takeLatest$1(actions.appFormState.updateAppStart.type,updateApp)}function*watchDeleteConfigField(){yield takeLatest$1(actions.appFormState.removeConfigField.type,deleteAppConfigField)}function*watchUpdateConfigField(){yield takeLatest$1(actions.appFormState.updateConfigField.type,updateAppConfigField)}function*watchCreateConfigField(){yield takeLatest$1(actions.appFormState.createConfigField.type,addAppConfigField)}function*watchGetApplications(){yield takeLatest$1(actions.appFormState.createNewApp.type,fetchApplications)}const editAppSagas=[fork(watchEditApp),fork(watchUpdateAppStart),fork(watchDeleteConfigField),fork(watchUpdateConfigField),fork(watchCreateConfigField),fork(watchGetApplications)];function*updateLocalStorage(){var e=appFormState["selectApp"],t=eventPanelState["selectEventPanel"],e=yield select(e),t=yield select(t);window.localStorage.setItem("appOnboardingSession",JSON.stringify(Object.assign(Object.assign({},e),{eventHandlers:t.handlers})))}function*watchAppForm(){var{appFormState:e,appEventsPanelState:t}=actions,e=[e.updateAppFormField.type,e.updateApplicationHeaderbar.type,e.addConfigField.type,e.createConfigField.type,e.updateConfigField.type,e.removeConfigField.type,e.clearConfigFields.type,e.addContextMenuExtension.type,e.updateContextMenuExtension.type,e.removeContextMenuExtension.type,e.clearContextMenuExtensions.type,e.addNodeModule.type,e.updateNodeModule.type,e.removeNodeModule.type,t.addHandler.type,t.editHandler.type,t.deleteHandler.type];yield takeLatest$1(e,updateLocalStorage)}const updateAppFormSagas=[fork(watchAppForm)];function*rootSaga(){yield all([watchUploadIconStart(),watchProgressChannel(),...appEventsSagas,...flowsSagas,...enginesSagas,...newApplicationSagas,...schemasSagas,...editAppSagas,...updateAppFormSagas])}function getAppCenterNewModule(){return{id:SLICE_NAME,reducerMap:{[SLICE_NAME]:rootReducer},sagas:[rootSaga],initialActions:[]}}const formattedMessageIdPrefix$2="toggle-switch.",Toggle=e=>{var{checked:t,onChange:a}=e;return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:-1,alignItems:"center"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"off",defaultMessage:"Off",description:"Off lable for aiware headerbar toggle switch"})})),jsxRuntime.exports.jsx(Switch,Object.assign({color:"secondary",id:"toggle-aiware-headerbar",onChange:a},lodash.exports.omit(e,"className"))),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",sx:{color:t?null:"#5C6269"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$2+"on",defaultMessage:"On",description:"On lable for aiware headerbar toggle switch"})}))]}))},formattedMessageIdPrefix$1="os-app-center-new.headerbar-step.headerbar-toggle.";var ApplicationHeaderbarToggle=({checked:e=!0,onChange:t})=>jsxRuntime.exports.jsxs(Box,Object.assign({width:"100%","data-test":formattedMessageIdPrefix$1+"container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"title",defaultMessage:"aiWARE Headerbar",description:"Title of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix$1+"instructions",defaultMessage:"This allows the aiWARE header to wrap around your app, keeping it self contained.",description:"Instructions of the aiware headerbar toggle section"})})),jsxRuntime.exports.jsx(FormGroup,{children:jsxRuntime.exports.jsx(FormControl,{children:jsxRuntime.exports.jsx(Toggle,{checked:e,onChange:t,"data-test":formattedMessageIdPrefix$1+"toggle"})})})]}));const useStyles$8=makeStyles()(e=>({editorImg:{maxWidth:"100%",height:"auto"},container:{"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5,boxSizing:"content-box"}})),formattedMessageIdPrefix="os-app-center-new.headerbar-step.customize-headerbar.";var CustomizeApplicationHeaderbar=({handleOnValidate:e})=>{var t=useStyles$8()["classes"];const s=useDispatch(),a=useSelector(selectApp);var n={name:null==(n=a.applicationHeaderbar)?void 0:n.name,"config.backgroundColor":null==(n=a.applicationHeaderbar)?void 0:n.config.backgroundColor,"config.logoSrc":null==(n=a.applicationHeaderbar)?void 0:n.config.logoSrc,"config.help":null==(n=a.applicationHeaderbar)?void 0:n.config.help,"config.notification":null==(n=a.applicationHeaderbar)?void 0:n.config.notification};const i=useForm({mode:"onChange",defaultValues:n});react.exports.useEffect(()=>{a.headerbarEnabled?null!=e&&e(i.formState.isValid):null!=e&&e(!0)},[i.formState.isValid,a.headerbarEnabled]);var n=e=>{var t=e.target["name"];let a=e.target["value"];"config.zIndex"===t&&(a=Number(a)),s(actions.appFormState.updateApplicationHeaderbar({field:t,value:a}))},o=e=>{var{name:e,checked:t}=e.target;s(actions.appFormState.updateApplicationHeaderbar({field:e,value:t}))};return jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:3,"data-test":formattedMessageIdPrefix+"container"},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{opacity:a.headerbarEnabled?1:.5}},{children:[jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",alignItems:"center",spacing:1},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h4"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"title",defaultMessage:"Customize the aiWARE Header",description:"Title of the Customize aiware headerbar section"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"optional",defaultMessage:"(Optional)",description:"Optional modifier for titles"})}))]})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"body1"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"instructions",defaultMessage:"Your inputs will be injected into the header as JSON and can be used to customize the user interface and functionality.",description:"Instructions of the Customize aiware header bar section"})}))]})),a.headerbarEnabled&&jsxRuntime.exports.jsx(Box,{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},i,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,spacing:5,"data-test":formattedMessageIdPrefix+"form-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-name",defaultMessage:"Name",description:"You can set a headerbar name"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-name",inputProps:{maxLength:250,className:t.textInput},rules:{required:!0},onChange:n})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:2},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-backgroundColor",defaultMessage:"Background Color",description:"You can set a headerbar background color"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"color",name:"config.backgroundColor",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.backgroundColor",inputProps:{maxLength:250,className:t.textInput},onChange:n})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"headerbar-logoSource",defaultMessage:"Logo Source",description:"You can set a headerbar logo source"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",type:"text",name:"config.logoSrc",fullWidth:!0,"data-test":"app-center-new.aiware-headerbar-config.logoSrc",inputProps:{maxLength:5e3,className:t.textInput},onChange:n})]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"25px 0 0 25px"}},{children:jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:[jsxRuntime.exports.jsx(InputCheckbox,{name:"config.help",checked:null==(n=null==(t=a.applicationHeaderbar)?void 0:t.config)?void 0:n.help,onChange:o,"data-test":"app-center-new.aiware-headerbar-checkbox-help",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-help",defaultMessage:"Help",description:"Help field checkbox"})}),jsxRuntime.exports.jsx(InputCheckbox,{name:"config.notification",checked:null==(n=null==(t=a.applicationHeaderbar)?void 0:t.config)?void 0:n.notification,onChange:o,"data-test":"app-center-new.aiware-headerbar-checkbox-notification",label:jsxRuntime.exports.jsx(FormattedMessage,{id:formattedMessageIdPrefix+"checkbox-notification",defaultMessage:"Notification",description:"Notification field checkbox"})})]}))}))]}))}))})]}))};const useStyles$7=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)}}));var HeaderbarStep=({handleOnValidate:e})=>{const t=useDispatch();var a=useSelector(selectApp),s=useStyles$7()["classes"];return jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,flexDirection:"column",rowSpacing:5,columnSpacing:6,className:s.container,"data-test":"app-new-headerbar-step-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(ApplicationHeaderbarToggle,{checked:a.headerbarEnabled,onChange:e=>{t(actions.appFormState.updateAppFormField({field:"headerbarEnabled",value:e.target.checked}))}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,flexShrink:0},{children:jsxRuntime.exports.jsx(CustomizeApplicationHeaderbar,{handleOnValidate:e})}))]}))};const useStyles$6=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},grayText:{color:"gray"},textInput:{boxSizing:"content-box"}})),ConfigFields=()=>{const a=useDispatch(),s=useSelector(selectConfigFields),e=e=>lodash.exports.map(e,e=>({name:e.name,configLevel:e.configLevel,type:e.type,default:isEmpty_1(e.defaultValue)?"N/A":e.defaultValue})),[n,i]=react.exports.useState(e(s));react.exports.useEffect(()=>{i(e(s))},[s]);const t=(e=!1,t=-1)=>{e={name:"APP_CENTER_CONFIG_FIELDS_FORM",config:{name:"Custom Fields",isEdit:e,editIndex:t}};a(mountPanel({panelId:"APP_CENTER_CONFIG_FIELDS_FORM",microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-config-fields",heading:"Application Config Fields",description:"Does your application require config fields? If so, specify them here. Leave blank if not..",actionButtonLabel:"Add Config",items:n,columnNames:["Name","Config Level","Type","Default","",""],canEdit:!0,canDelete:!0,onActionClick:()=>t(),onEditClick:e=>{e=n[e],e=findIndex_1(s,{name:e.name,type:e.type});0<=e&&t(!0,e)},onDeleteClick:e=>{var t=n[e],t=findIndex_1(s,{name:t.name,type:t.type});0<=t&&a(actions.appFormState.removeConfigField({removeIndex:t,configToDelete:s[e]}))},onRequestSort:(e,t)=>{i(orderBy_1(n,lowerCase_1(e),t))}})},urlRegex=/^https?:\/\/[(www\.)?a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,CME_PANEL_NAME="APP_CENTER_CONTEXT_MENU_EXTENSIONS",ContextMenuExtensions=()=>{const s=useDispatch(),a=useSelector(selectContextMenuExtensions),e=e=>{return lodash.exports.isNil(e)?[]:Object.values(e).flat().map(e=>({id:e.id,type:e.type,label:e.label,url:e.url||""}))},[n,i]=react.exports.useState(e(a)),o=(react.exports.useEffect(()=>{i(e(a))},[JSON.stringify(a)]),(e=!1,t=void 0,a=-1)=>{e={name:CME_PANEL_NAME,config:{name:"Context Menu Extensions",isEdit:e,extensionType:t,editIndex:a}};s(mountPanel({panelId:CME_PANEL_NAME,microFrontend:e,panelConfig:{type:"APP_BAR_PANEL_TEMPLATE",marginTop:55,marginStart:0,zIndex:1010}}))}),r=e=>{var e=n[e],t=a[e.type+"s"];return{index:lodash.exports.findIndex(t,["id",e.id]),type:e.type}};return jsxRuntime.exports.jsx(ListField,{idPrefix:"aob-functionality-context-menu-extensions",heading:"Context Menu Extensions",description:"Add a menu option to files in aiWare that allow users to send them to your application",actionButtonLabel:"Add Context Menu Extension",items:lodash.exports.map(n,e=>lodash.exports.omit(e,"id")),columnNames:["Type","Label","URL","",""],canEdit:!0,canDelete:!0,onActionClick:()=>o(),onEditClick:e=>{var{index:e,type:t}=r(e);0<=e?o(!0,t,e):console.log("Extension not found",e,t)},onDeleteClick:e=>{var{index:e,type:t}=r(e);0<=e&&s(actions.appFormState.removeContextMenuExtension({extensionType:t,index:e}))},onRequestSort:(e,t)=>{i(lodash.exports.orderBy(n,lodash.exports.lowerCase(e),t))}})},FunctionalityStep=({handleOnValidate:e})=>{var t=useStyles$6()["classes"];const a=useDispatch();var s=useSelector(selectAppUrl);const n=useForm({mode:"onChange",defaultValues:{url:s}});react.exports.useEffect(()=>{null!=e&&e(n.formState.isValid)},[n.formState.isValid]);s=e=>{var{name:e,value:t}=e.target;a(actions.appFormState.updateAppFormField({field:e,value:t}))};return jsxRuntime.exports.jsx(FormProvider,Object.assign({},n,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container,"data-test":"os-app-center-new-functionality-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.application-type-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-type-title-formattedMessage",defaultMessage:"Application Type",description:"Application Type title"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption","data-test":"os-app-center-new.application-type-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-type-description-formattedMessage",defaultMessage:"Please select the application type from the list below:",description:"Application Type description"})})),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsxs(InputSelect,Object.assign({className:t.root,onChange:s,"data-test":"os-app-center-new.app-type-input",fullWidth:!0,value:"web",name:"app-type"},{children:[jsxRuntime.exports.jsxs(MenuItem,Object.assign({value:"web"},{children:[jsxRuntime.exports.jsx("b",{children:"Web Application"})," ",jsxRuntime.exports.jsx("span",Object.assign({className:t.grayText},{children:"(Accessible via Browser)"}))]})),jsxRuntime.exports.jsxs(MenuItem,Object.assign({disabled:!0},{children:[jsxRuntime.exports.jsx("b",{children:"Docker Application"})," (Run on aiWARE)"," ",jsxRuntime.exports.jsx(Chip,{color:"primary",className:t.chip,size:"small",label:"Coming Soon"})]})),jsxRuntime.exports.jsxs(MenuItem,Object.assign({disabled:!0},{children:[jsxRuntime.exports.jsx("b",{children:"Kubernetes"})," ",jsxRuntime.exports.jsx(Chip,{color:"primary",className:t.chip,size:"small",label:"Coming Soon"})]}))]}))}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.application-url-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-url-title-formattedMessage",defaultMessage:"Application URL",description:"Application url title"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption","data-test":"os-app-center-new.application-url-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.integration-description-formattedMessage",defaultMessage:"Provide the url to access your application. Include http or https.",description:"Application url description"})})),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsx(InputText,{className:t.textInput,required:!0,type:"url","data-test":"os-app-center-new.url-input",rules:{required:!0,pattern:{value:urlRegex,message:"Must be a valid URL including protocol."}},onChange:s,placeholder:"URL",name:"url",fullWidth:!0})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ConfigFields,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(ContextMenuExtensions,{})}))]}))}))},useStyles$5=makeStyles()(e=>({container:{padding:e.spacing(6),maxWidth:"100%"},divider:{width:"60rem",margin:e.spacing(5,5,1,6)},list:{width:"60rem",padding:e.spacing(6,0),marginLeft:e.spacing(6)},chip:{marginLeft:"10px",marginTop:"9px",marginRight:"15px",background:"#214167"},inputContainer:{paddingTop:"10px"},root:{"&":{width:"100%"}},checked:{color:"#6098D1"},textInput:{boxSizing:"content-box"}})),useOneClickCopy=a=>{const[t,s]=react.exports.useState(!1);return[e=>{var t;navigator.clipboard.writeText(null!=(t=a.current.dataset.copyToClipboardText)?t:a.current.innerText).catch(e=>{console.error("Error copying to clipboard: ",e)}),s(!0)},e=>jsxRuntime.exports.jsx(Tooltip,Object.assign({open:t,onClose:()=>{s(!1)},title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-copied-to-clipboard",defaultMessage:"Copied to clipboard",description:"Copied to clipboard"})},e,{children:e.children}))]};var OAuthClientSecret=({appId:a,disabled:e})=>{const s=useSelector(selectApiConfigs),[t,n]=react.exports.useState(""),[i,o]=react.exports.useState(!1),[r,p]=react.exports.useState(!1),[l,d]=react.exports.useState(!1);var c=react.exports.useRef();const[u,x]=useOneClickCopy(c);react.exports.useEffect(()=>{!lodash.exports.isEmpty(t)&&l&&(u(null),d(!1))});const m=react.exports.useRef();const[g,h]=react.exports.useState(!1),[f,j]=react.exports.useState(!1);const[y,b]=react.exports.useState(!1);return jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"column",spacing:2,"data-test":"oauth-client-secret-retrival-tool"},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-label-formattedMessage",defaultMessage:"Client Secret: OAuth",description:"Lable for the client secret input when selecting OAuth"})}))})),jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2,alignItems:"center",width:"60%"},{children:[jsxRuntime.exports.jsx(x,{children:jsxRuntime.exports.jsx(InputText,{name:"oauthClientSecret",fullWidth:!0,disabled:!0,ref:c,"data-copy-to-clipboard-text":t,id:"clientSecret",color:"secondary",style:{backgroundColor:"#F2F5F9"},type:f?"text":"password",size:"small",value:t,InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"data-test":"oauth-client-secret-reveal","aria-label":"toggle client secret visibility",onClick:()=>{lodash.exports.isEmpty(t)?h(!0):j(!f)},disabled:e},{children:f?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))}})}),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"copy client secret",onClick:e=>{lodash.exports.isEmpty(t)?(d(!0),h(!0)):u(e)},disabled:e,"data-test":"oauth-client-secret-copy"},{children:jsxRuntime.exports.jsx(Copy,{})}))]})),jsxRuntime.exports.jsxs(Collapse,Object.assign({in:g},{children:[jsxRuntime.exports.jsx(FormLabel,Object.assign({htmlFor:"clientSecret"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-password-input-label-formattedMessage",defaultMessage:"Please enter your account password to reveal client secret",description:"Lable for the client secret password input when selecting OAuth"})}))})),jsxRuntime.exports.jsx("form",Object.assign({onSubmit:e=>{e.preventDefault();var t,e=null==(e=m.current)?void 0:e.value;lodash.exports.isEmpty(e)||(t=e,__awaiter(void 0,void 0,void 0,function*(){console.log("handleFetchClientSecret Start");try{o(!0);var e=yield getOAuthClientSecret(s,{id:a,password:t});console.log("Result:",e),n(e.application.clientSecret),h(!1)}catch(e){m.current.focus(),p(!0)}finally{o(!1)}}).catch(e=>{console.error("Error fetching client secrets: ",e)}))}},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({direction:"row",spacing:2},{children:[jsxRuntime.exports.jsx(InputText,{name:"password",InputProps:{endAdornment:jsxRuntime.exports.jsx(InputAdornment,Object.assign({position:"end"},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"toggle password visibility",onClick:()=>{b(!y)},"data-test":"oauth-client-secret-password-reveal"},{children:y?jsxRuntime.exports.jsx(default_1$1,{}):jsxRuntime.exports.jsx(default_1,{})}))}))},inputRef:m,id:"password",color:r?"error":"secondary",type:y?"text":"password",size:"small"}),i?jsxRuntime.exports.jsx(CircularProgress,{color:"secondary"}):jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"submit password",type:"submit","data-test":"oauth-client-secret-password-submit"},{children:jsxRuntime.exports.jsx(ArrowForward,{})}))]}))}))]}))]}))};const AuthenticationStep=({handleOnValidate:e})=>{var t=useStyles$5()["classes"],a=useSelector(selectApp),s=useSelector(selectIsEditForm)["isEditForm"];const n=useDispatch();const i=useForm({mode:"onChange",defaultValues:{oauthUrl:"",authMethod:"none"}});react.exports.useEffect(()=>{null!=e&&e(i.formState.isValid)},[i.formState.isValid]);var o=e=>{var{name:e,value:t}=e.target;n(actions.appFormState.updateAppFormField({field:e,value:t}))};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-authentication-step-container"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},i,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,rowSpacing:5,columnSpacing:6,className:t.container},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Heading,{title:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-title-formattedMessage",defaultMessage:"Authentication",description:"Authentication title"}),description:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.authentication-description-formattedMessage",defaultMessage:"Default authentication is None. OAuth and JWT authentication protocols coming soon",description:"authentication description"}),testName:"os-app-center-new.authentication"}),jsxRuntime.exports.jsx(Typography,{variant:"h6",gutterBottom:!0,"data-test":"os-app-center-new.authentication-title"}),jsxRuntime.exports.jsx(Typography,{variant:"caption","data-test":"os-app-center-new.authentication-description"}),jsxRuntime.exports.jsx("div",Object.assign({className:t.inputContainer},{children:jsxRuntime.exports.jsxs(InputRadioGroup,Object.assign({"data-test":"authentication-radio-group",name:"authMethod",value:a.authMethod,onChange:o,rules:{required:!0},row:!0},{children:[jsxRuntime.exports.jsx(FormControlLabel,{value:"none",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-none"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",color:"textSecondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-None-formattedMessage",defaultMessage:"None",description:"None"})}))}),jsxRuntime.exports.jsx(FormControlLabel,{value:"oauth",control:jsxRuntime.exports.jsx(Radio,{"data-test":"radio-oauth"}),label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.radio-OAuth-formattedMessage",defaultMessage:"OAuth",description:"OAuth"})}))})]}))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(Collapse,Object.assign({in:lodash.exports.isEqual(a.authMethod,"oauth")},{children:jsxRuntime.exports.jsxs(Stack,Object.assign({spacing:5,"data-test":"authentication-oauth-section"},{children:[jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},name:"oauthUrl",value:a.oauthUrl,onChange:o,fullWidth:!0,variant:"outlined",label:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2",style:{color:"lightgray"}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-url-formattedMessage",defaultMessage:"OAuth URL",description:"Lable for the oauth url input when selecting OAuth"})})),InputLabelProps:{disableAnimation:!1},rules:{required:lodash.exports.isEqual(a.authMethod,"oauth"),pattern:{value:urlRegex,message:"Must be a valid URL including protocol."},maxLength:1e3}}),s?jsxRuntime.exports.jsx(OAuthClientSecret,{appId:a.id}):jsxRuntime.exports.jsxs(Box,{children:[jsxRuntime.exports.jsx(OAuthClientSecret,{appId:"",disabled:!0}),jsxRuntime.exports.jsx(Typography,Object.assign({color:"secondary"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.oauth-client-secret-not-available-formattedMessage",defaultMessage:"You will be able to retrieve the oauth client secret here after submitting this application.",description:"Instruction durring application onboarding on how to find oauth client secret after application submission."})}))]})]}))}))}))]}))}))}))},useStyles$4=makeStyles()(e=>({container:{width:"100%",padding:"25px 30px"},subheading:{maxWidth:"100%",minWidth:"48.75rem",padding:"30px 0"},titleDesc:{width:"60%",display:"inline-block"},appLogo:{width:"40%",display:"inline-block"},text:{width:"39.5rem",padding:"14px 0",borderBottom:"0.5px solid #D5DFE9",fontWeight:400},textCollapsible:{width:"39.5rem",padding:"8px 0",borderBottom:"0.5px solid #D5DFE9",cursor:"pointer"},collapse:{width:"39.5rem"},collapseContent:{maxHeight:200,overflow:"auto"},pre:{whiteSpace:"pre-line"},asterisk:{color:"#D43060",margin:"0 2px"}})),useStyles$3=makeStyles()(e=>({root:{borderRadius:"50%",border:"1px solid #D5DFE9",display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",width:e.spacing(8),height:e.spacing(8)},logo:{maxWidth:"100%",maxHeight:"100%"},veritoneLogo:{maxWidth:"100%",maxHeight:"100%"}})),AppLogo=({path:e})=>{var t=useStyles$3()["classes"];return jsxRuntime.exports.jsx("div",Object.assign({className:t.root},{children:jsxRuntime.exports.jsx("img",{className:t.logo+" "+(!e&&t.veritoneLogo),src:e||img$1y,alt:"app logo"})}))},Row=({label:e,value:t,style:a,testName:s,icon:n,asterisk:i,handleOpenCollapse:o,textTransformValue:r="capitalize"})=>jsxRuntime.exports.jsxs(Box,Object.assign({display:"flex",justifyContent:"space-between",alignItems:"center",textTransform:r,"data-test":s+"-container"},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6","data-test":"label-"+s},{children:e})),jsxRuntime.exports.jsxs(Box,Object.assign({className:a,display:"flex",justifyContent:"space-between",alignItems:"center",onClick:o},{children:[jsxRuntime.exports.jsxs(Typography,Object.assign({variant:"h6",sx:{fontWeight:400}},{children:[t,i]})),jsxRuntime.exports.jsx(IconButton,Object.assign({"aria-label":"expand row",size:"small",onClick:o,"data-test":s+"-expand-action-trigger"},{children:n}))]}))]})),ConfirmationStep=()=>{var e=useStyles$4()["classes"],t=useSelector(selectApp);return jsxRuntime.exports.jsxs(Box,Object.assign({className:e.container,"data-test":"os-app-center-new-confirmation-step-container"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.subheading},{children:[jsxRuntime.exports.jsxs("div",Object.assign({className:e.titleDesc},{children:[jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",alignItems:"center",textTransform:"capitalize","data-test":"os-app-center-new-confirmation-step.app-name"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h2"},{children:lodash.exports.isEmpty(t.name)?"-":t.name}))})),jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"os-app-center-new-confirmation-step.app-description"},{children:jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",color:"#2A323C"},{children:lodash.exports.isEmpty(t.description)?"-":t.description}))}))]})),jsxRuntime.exports.jsx("div",Object.assign({"data-test":"os-app-center-new-confirmation-step.app-logo",className:e.appLogo},{children:jsxRuntime.exports.jsx(AppLogo,{path:t.iconPath})}))]})),jsxRuntime.exports.jsxs(Box,Object.assign({sx:{width:"100%"},"data-test":"os-app-center-new-confirmation-step.row-container"},{children:[jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-url-formattedMessage",defaultMessage:"Application URL:",description:"application url"}),textTransformValue:"none",value:lodash.exports.isEmpty(t.url)?"-":t.url,style:e.text,testName:"os-app-center-new-confirmation-step.app-url"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.custom-fields-formattedMessage",defaultMessage:"Custom Fields:",description:"Custom Fields"}),value:lodash.exports.isEmpty(t.configFields)?"-":lodash.exports.join(lodash.exports.map(t.configFields,e=>e.name),", "),style:e.text,testName:"os-app-center-new-confirmation-step.app-custom-fields"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-headerbar-formattedMessage",defaultMessage:"Headerbar:",description:"headerbar"}),value:t.headerbarEnabled?"On (Default)":"Off",style:e.text,testName:"os-app-center-new-confirmation-step.app-headerbar"}),jsxRuntime.exports.jsx(Row,{label:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-confirmation-step.app-auth-formattedMessage",defaultMessage:"Authentication:",description:"auth"}),value:"None (Default)",style:e.text,testName:"os-app-center-new-confirmation-step.app-auth"})]}))]}))},useBasicInfoStyles=makeStyles()(e=>({container:{padding:e.spacing(6),justifyContent:"space-around","& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},textInput:{padding:26},labelRow:{display:"flex",gap:e.spacing(2),alignItems:"flex-end"},optional:{fontSize:10,marginBottom:e.spacing(1)},select:{"& > div":{fontWeight:400,width:"280px"}}})),useIconImporterStyles=makeStyles()(e=>({iconBox:{display:"flex",justifyContent:"center",alignItems:"center",width:200,height:200,padding:e.spacing(3),border:"1px dashed #D5DFE9",borderRadius:5,transition:"all .2s ease","&:hover":{border:"1px solid #dde6ee"}},innerBox:{position:"relative",background:"#F5F5F5",width:"100%",height:"100%",borderRadius:5,display:"flex",justifyContent:"center",alignItems:"center",transition:"all .2s ease","&:hover":{background:"#dde6ee"}},fileInput:{display:"none"},addIcon:{color:"#555F7C",height:42,width:42,"&:hover":{color:"#555F7C"}},iconPreview:{objectFit:"cover",borderRadius:5,width:"100%",maxHeight:"100%"},removeIcon:{top:"90%",right:66}})),useDragAndDrop=({acceptedFileTypes:i})=>{const t=react.exports.useRef(),e=react.exports.useRef(),o=useDispatch();var a=useSelector(preferredLanguageSelector);const r=AIWareFormatMessage(a),s=react.exports.useCallback(e=>{var t,a,s,n;e&&(i.includes(e.type)?5e6<=e.size?o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileSize",defaultMessage:[{type:0,value:"File file size must be less than 5 MB"}]}),severity:MessageSeverity.Warning})):({name:t,size:a,type:s}=e,n=URL.createObjectURL(e),n={id:guid(),previewUrl:n,name:t,size:a,type:s},o(actions.iconUploadState.uploadIconStart({file:n}))):o(showMessage({content:r({id:"os-app-center-new.snackbar.unsupportedFileType",defaultMessage:[{type:1,value:"type"},{type:0,value:" is not a supported image type."}]},{type:e.type}),severity:MessageSeverity.Warning})))},[i,o]),n=react.exports.useCallback(e=>{e.preventDefault();e=e.dataTransfer.files[0];s(e)},[s]);const p=e=>{e.preventDefault()};return react.exports.useEffect(()=>{const e=t.current;return e.addEventListener("drop",n),()=>{e.removeEventListener("drop",n)}},[n]),react.exports.useEffect(()=>{const e=t.current;return e&&(e.addEventListener("dragover",p),e.addEventListener("dragleave",p)),()=>{e.removeEventListener("dragover",p),e.removeEventListener("dragleave",p)}},[]),{dropZoneRef:t,fileInputRef:e,handleRemoveFile:e=>{e.stopPropagation(),o(actions.iconUploadState.deleteLocalIcon()),o(actions.appFormState.updateAppFormField({field:"iconPath",value:""}))},handleOpenFilePicker:()=>{e.current.click()},handleIconSelect:e=>{e=e.target.files[0];s(e)}}},acceptedFileTypes=["image/jpeg","image/png","image/gif","image/svg+xml"],IconImporter=({iconPath:e})=>{var t=useSelector(selectIcon),a=useIconImporterStyles()["classes"],{dropZoneRef:s,fileInputRef:n,handleRemoveFile:i,handleIconSelect:o,handleOpenFilePicker:r}=useDragAndDrop({acceptedFileTypes:acceptedFileTypes});return jsxRuntime.exports.jsx("div",Object.assign({className:a.iconBox,ref:s,"data-test":"app-description-icon-dropzone"},{children:e||null!=t&&t.previewUrl?jsxRuntime.exports.jsxs("div",Object.assign({className:a.innerBox,style:{backgroundColor:"transparent"}},{children:[jsxRuntime.exports.jsx(IconButton,Object.assign({style:{position:"absolute"},"data-test":"app-description-icon-remove",className:a.removeIcon,size:"small",onClick:i},{children:jsxRuntime.exports.jsx(default_1$2,{})})),jsxRuntime.exports.jsx("img",{src:(null==t?void 0:t.previewUrl)||e,alt:(null==t?void 0:t.name)||"Icon",className:a.iconPreview,"data-test":"app-description-icon-preview"})]})):jsxRuntime.exports.jsxs(Button,Object.assign({className:a.innerBox,onClick:r},{children:[jsxRuntime.exports.jsx("input",{accept:"image/jpeg, image/png",type:"file",ref:n,className:a.fileInput,onChange:o}),jsxRuntime.exports.jsx(default_1$3,{className:a.addIcon})]}))}))},BasicInfo=({onValidate:e})=>{var t=useBasicInfoStyles()["classes"];const a=useIntl(),s=useDispatch(),n=useSelector(selectApp),i=useSelector(selectIsResumeSession),o=useSelector(selectApps);var r=useSelector(selectAppPackageDistributionType),p={name:n.name,description:n.description};const l=useForm({mode:"onChange",defaultValues:p}),d=(react.exports.useEffect(()=>{e(l.formState.isValid)},[l.formState.isValid]),react.exports.useEffect(()=>{__awaiter(void 0,void 0,void 0,function*(){i&&(l.reset(n),setTimeout(()=>__awaiter(void 0,void 0,void 0,function*(){yield l.trigger()}),500))}).catch(e=>{console.error("Error validating information: ",e)})},[i]),(e,t)=>{s(actions.appFormState.updateAppFormField({field:e,value:t}))});p=e=>{var{name:e,value:t}=e.target;d(e,t)};return jsxRuntime.exports.jsx(Box,Object.assign({"data-test":"basic-info"},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},l,{children:jsxRuntime.exports.jsxs(Grid,Object.assign({className:t.container,container:!0,rowSpacing:4,columnSpacing:10,"data-test":"app-description"},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,item:!0,xs:12,sm:8,rowSpacing:2,columnSpacing:6},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12,sm:6},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.name-description-label",defaultMessage:"Name & Description",description:"Name & Description"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.application-description-caption",defaultMessage:"Provide a name and description to let users know what your application does.",description:"application name and description caption"})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{inputProps:{className:t.textInput},"data-test":"app-description-input-name",variant:"outlined",sx:{marginBottom:3},placeholder:"Application Name",name:"name",value:n.name,onChange:p,fullWidth:!0,rules:{required:!0,maxLength:100,validate:{isNameSame:t=>{return!o.find(e=>e.name.toLowerCase()===t.toLowerCase())||a.formatMessage({id:"os-app-center-new.app-description-input-name-error",defaultMessage:[{type:0,value:"An application with this name already exists"}]})}}}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(InputText,{InputProps:{className:t.textInput},"data-test":"app-description-input-description",variant:"outlined",placeholder:"Description",name:"description",fullWidth:!0,multiline:!0,rows:10,value:n.description,onChange:p,rules:{required:!0,maxLength:250}})}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({container:!0,item:!0,xs:12,sm:4,rowSpacing:4,columnSpacing:6},{children:jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsxs(Box,Object.assign({sx:{py:1}},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.icon-image-label",defaultMessage:"App Icon",description:"App Icon"})})),jsxRuntime.exports.jsx(Typography,Object.assign({variant:"caption",paragraph:!0},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.image-recommended-label",defaultMessage:"Recommended image size:{br}300x300 .png or .jpg",description:"Recommended image size:{br} 300x300 .png or .jpg",values:{br:jsxRuntime.exports.jsx("br",{})}})}))]})),jsxRuntime.exports.jsx(IconImporter,{iconPath:n.iconPath})]}))})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(EntityTags,{selectedTags:n.entityTags,setSelectedTags:e=>{s(actions.appFormState.updateAppFormField({field:"entityTags",value:e}))}})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(DistributionFlags,{description:"Add Distribution Flag for App",selectedFlag:r,engineFlags:engineFlags,handleEngineFlag:({value:e})=>{d("packageDistributionType",e)},idPrefix:"os-app-center-new",inputName:"appPackageDistribution"})}))]}))}))}))},AppOnboardingFlow=()=>{const a=useDispatch(),s=useSelector(selectApp),n=useSelector(selectIsEditForm)["isEditForm"],i=useSelector(selectPrevNodeModules),[e,t]=react.exports.useState(!1);var o=e=>t(e);var o=[jsxRuntime.exports.jsx(BasicInfo,{onValidate:o}),jsxRuntime.exports.jsx(FunctionalityStep,{handleOnValidate:o}),jsxRuntime.exports.jsx(HeaderbarStep,{handleOnValidate:o}),jsxRuntime.exports.jsx(AuthenticationStep,{handleOnValidate:o}),jsxRuntime.exports.jsx(ConfirmationStep,{})],r=[jsxRuntime.exports.jsx(Button,Object.assign({"data-test":"app-new-submit-app-button",variant:"contained",color:"primary",onClick:()=>{var e,t;e=!1,n?(t=lodash.exports.differenceWith(s.nodeModules,i,lodash.exports.isEqual),a(actions.appFormState.updateAppStart({app:Object.assign(Object.assign({},s),{nodeModules:t}),openBuildPanel:e}))):a(actions.appFormState.createAppStart({app:s,openBuildPanel:e}))}},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new.{idPrefix}-app-button",defaultMessage:"{verb}",description:"{verb} app button text",values:{idPrefix:n?"update":"submit",verb:n?"Update":"Submit"}})}),"submit-app-button")];return jsxRuntime.exports.jsx(ProgressStepper,{panelName:"APP_CENTER_NEW",sessionKey:"appOnboardingSession",entityId:s.id,onResumeSession:e=>{var t=lodash.exports.omit(e,"eventHandlers"),e=lodash.exports.get(e,"eventHandlers");a(actions.appEventsPanelState.resumeSession(e)),a(actions.appFormState.resumeSession(t))},steps:["Basic Info","Functionality","Headerbar","Authentication","Review"],stepContent:o,customFinalStepButtons:r,nextButtonDisabled:!e,idPrefix:"app-center-new-aob"})},appBarHeight$1=55,headerHeight=64,borderBottom$1=5,useStyles$2=makeStyles()(e=>({ecnPanel:{height:`calc(100vh - ${appBarHeight$1}px - ${headerHeight}px - ${borderBottom$1}px)`}})),MainLayout=({appId:e})=>{var t=useStyles$2()["classes"];const a=useDispatch();var s=useSelector(selectIsLoadingExistingAppData)["isLoadingExistingAppData"];return react.exports.useEffect(()=>{e?a(actions.appFormState.editApp(e)):a(actions.appFormState.createNewApp())},[]),jsxRuntime.exports.jsx("div",Object.assign({role:"presentation","data-test":"app-center-new-widget",className:t.ecnPanel},{children:s?jsxRuntime.exports.jsx(Box,Object.assign({sx:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"}},{children:jsxRuntime.exports.jsx(CircularProgress,{})})):jsxRuntime.exports.jsx(AppOnboardingFlow,{})}))},AppCenterNew=e=>jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(DynamicModuleLoader,Object.assign({modules:[getAppCenterNewModule()]},{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(MainLayout,Object.assign({},e))})})}))}),appBarHeight=55,borderBottom=5,mainHeight=`calc(100vh - ${appBarHeight+borderBottom}px)`,useStyles$1=makeStyles()(e=>({root:{display:"flex",flexFlow:"column",height:mainHeight},container:{padding:e.spacing(5),"& input, textarea":{fontWeight:400},"& fieldset":{borderColor:"#D5DFE9"}},"& fieldset":{borderColor:"#D5DFE9"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{width:"100%"},optional:{fontSize:12,marginBottom:e.spacing(1),marginLeft:e.spacing(1),color:"#9CA8B4"}})),ConfigFieldsForm=({hidePanel:t,isEdit:a=!1,editIndex:s=-1})=>{var e=useStyles$1()["classes"],n=useSelector(preferredLanguageSelector);const i=AIWareFormatMessage(n),o=useDispatch(),r=useSelector(selectApp),p=useSelector(selectConfigFields);var n=()=>a&&0<=s?p[s]:{name:"",configLevel:AppConfigLevel.Organization,type:AppConfigType.String,required:!1,defaultValue:""},l=n();const d=useForm({mode:"onChange",defaultValues:l}),[c,u]=react.exports.useState(n().type),[x,m]=react.exports.useState(n().configLevel);return jsxRuntime.exports.jsx(FormProvider,Object.assign({},d,{children:jsxRuntime.exports.jsxs("form",Object.assign({className:e.root,onSubmit:d.handleSubmit(e=>{a?o(actions.appFormState.updateConfigField({configFields:e,index:s,name:p[s].name})):lodash.exports.isEmpty(r.id)?o(actions.appFormState.addConfigField(e)):o(actions.appFormState.createConfigField({newConfigField:e,appId:r.id})),t()})},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({className:e.container,container:!0,spacing:5,"data-test":"app-new-config-fields-form-container"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-new-config-fields-header-title"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title",defaultMessage:"{label} Config Fields",description:"Form label for supported file types",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.form-title-close",defaultMessage:"Close",description:"Form label for close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-description-input-icon"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-name"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-name",defaultMessage:"Name",description:"You can set a field name"})})),jsxRuntime.exports.jsx(InputText,{inputProps:{maxLength:50,className:e.textInput},variant:"outlined",type:"text",name:"name",fullWidth:!0,"data-test":"app-new-config-fields-name-content",rules:{required:!0,maxLength:50,validate:{isNameSame:a=>{return!p.find((e,t)=>t!==s&&e.name===a)||i({id:"os-app-center-new.config-name-error",defaultMessage:[{type:0,value:"Please select a different name"}]})}}}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-description"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-description",defaultMessage:"Description",description:"You can set a field description"})})),jsxRuntime.exports.jsx(InputText,{variant:"outlined",name:"description",fullWidth:!0,multiline:!0,rows:5,"data-test":"app-new-config-fields-description-content",inputProps:{maxLength:250},InputProps:{className:e.textInput},rules:{required:!0,maxLength:250}})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-config-level"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.config-level",defaultMessage:"Config Level",description:"You can set a config level"})})),jsxRuntime.exports.jsxs(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"configLevel",value:x,defaultValue:x,onChange:e=>{d.setValue("configLevel",e.target.value),m(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-level-content",rules:{required:!0}},{children:[jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"Organization"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-organization",defaultMessage:"Organization",description:"You can set a config level"})})),jsxRuntime.exports.jsx(MenuItem,Object.assign({value:"User"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.menu-item-user",defaultMessage:"User",description:"You can set a config level"})}))]}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-new-config-fields-header-type"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.field-type",defaultMessage:"Type",description:"You can set a field type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({inputProps:{maxLength:50,className:e.textInput},className:e.inputSelect,type:"text",name:"type",value:c,onChange:e=>{d.setValue("type",e.target.value),u(e.target.value)},style:{minWidth:"100%"},"data-test":"app-new-config-fields-type-content",rules:{required:!0}},{children:map_1(keys_1(AppConfigType),(e,t)=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:AppConfigType[e]},{children:AppConfigType[e]}),t))}))]})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsx(SchemaOrText,{})})),jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12,style:{padding:"12.5px 0 0 25px"}},{children:jsxRuntime.exports.jsx(Box,Object.assign({display:"flex",justifyContent:"start",alignItems:"center"},{children:jsxRuntime.exports.jsx(InputCheckbox,{name:"required",defaultChecked:l.required,label:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.config-fields.required-checkbox",defaultMessage:"Make Required",description:"Required field checkbox"})})}))}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!get_1(d,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-new-config-fields-button-submit"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"os-app-center-new-config-fields.submit-button-label",defaultMessage:"{label}",description:"{label} Config Fields",values:{label:a?"Update":"Add"}})}))}))]}))}))},AppCenterConfigFieldsForm=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ConfigFieldsForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex})})})}),useStyles=makeStyles()(e=>({form:{display:"flex",flexDirection:"column",height:"100%"},textInput:{padding:14.5},header:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",marginBottom:20},addButtonWrapper:{flexGrow:1,display:"flex",justifyContent:"flex-end",alignItems:"flex-end",padding:"0px 20px 20px 20px"},inputSelect:{textTransform:"capitalize"}})),ContextMenuExtensionForm=({hidePanel:t,isEdit:a,editIndex:s,extensionType:n})=>{var e=useStyles()["classes"];const i=useDispatch();var o=useSelector(selectIsEditForm)["isEditForm"],r=useSelector(selectPrevContextMenuExtensions);const p=useSelector(selectContextMenuExtensions);r=a&&lodash.exports.findIndex(r[n+"s"],e=>lodash.exports.isMatch(e,p[n+"s"][s]))<0,o=a&&o&&!r,r=useForm({mode:"onChange",defaultValues:a&&0<=s&&!lodash.exports.isNil(n)?p[n+"s"][s]:{label:"",url:"",type:""}});const l=r.watch("type");return jsxRuntime.exports.jsx(Box,Object.assign({sx:{p:6,height:"calc(100vh - 60px)"}},{children:jsxRuntime.exports.jsx(FormProvider,Object.assign({},r,{children:jsxRuntime.exports.jsxs("form",Object.assign({onSubmit:r.handleSubmit(e=>{a&&0<=s&&!lodash.exports.isNil(n)?i(actions.appFormState.updateContextMenuExtension({extensionType:n,index:s,extension:e})):(e.id=v4(),i(actions.appFormState.addContextMenuExtension({extension:e}))),null!=t&&t()}),className:e.form},{children:[jsxRuntime.exports.jsxs(Grid,Object.assign({container:!0,direction:"column",spacing:8,"data-test":"app-center-new.context-menu-extension.panel-container",flexWrap:"nowrap"},{children:[jsxRuntime.exports.jsx(Grid,Object.assign({item:!0,xs:12},{children:jsxRuntime.exports.jsxs(Box,Object.assign({className:e.header},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h1",color:"secondary","data-test":"app-center-new.context-menu-extension.panel-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title",defaultMessage:"{label} a Context Menu Extension",description:"Panel title for context menu extension form",values:{label:a?"Edit":"Add"}})})),jsxRuntime.exports.jsx(Tooltip,Object.assign({title:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extension.form-title-close",defaultMessage:"Close",description:"Close tooltip label"})},{children:jsxRuntime.exports.jsx(IconButton,Object.assign({onClick:t,"aria-labelledby":"app-center-new-close-panel","data-test":"app-center-new.context-menu-extension.close-button"},{children:jsxRuntime.exports.jsx(Close,{})}))}))]}))})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.type-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.type-header-text",defaultMessage:"Type",description:"You can set a type"})})),jsxRuntime.exports.jsx(InputSelect,Object.assign({name:"type",fullWidth:!0,disabled:o,rules:{required:!0},className:e.inputSelect,"data-test":"app-center-new.context-menu-extension.type-input"},{children:Object.values(ContextMenuExtensionType).map(e=>jsxRuntime.exports.jsx(MenuItem,Object.assign({value:e,"data-test":"app-center-new.context-menu-extension.type-input."+e},{children:"tdo"===e?"Media (Temporal Data Objects)":e}),e))}))]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.label-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.label-header",defaultMessage:"Label",description:"You can set a label"})})),jsxRuntime.exports.jsx(InputText,{name:"label",fullWidth:!0,rules:{required:!0,maxLength:50,validate:t=>{var e;return!!lodash.exports.isEmpty(null===p||void 0===p?void 0:p[l+"s"])||!(!(a&&0<=s)||lodash.exports.isNil(n))||(e=null==(e=p[l+"s"])?void 0:e.find(e=>e.label===t),!!lodash.exports.isNil(e))||"Label already exists for this type."}},"data-test":"app-center-new.context-menu-extension.label-input"})]})),jsxRuntime.exports.jsxs(Grid,Object.assign({item:!0,xs:12},{children:[jsxRuntime.exports.jsx(Typography,Object.assign({variant:"h6",gutterBottom:!0,"data-test":"app-center-new.context-menu-extension.url-header"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.url-header",defaultMessage:"Open a URL in a new tab (optional)",description:"You can set a url"})})),jsxRuntime.exports.jsx(InputText,{placeholder:l&&`https://example.com?${l}Id=\${${l}Id}`,name:"url",fullWidth:!0,rules:{maxLength:255,validate:e=>!!lodash.exports.isEmpty(e)||(urlRegex.test(e)?!!lodash.exports.includes(e,"${"+l+"Id}")||"URL must contain ${"+l+"Id}":"Must be a valid URL including protocol.")},"data-test":"app-center-new.context-menu-extension.url-input"})]}))]})),jsxRuntime.exports.jsx(Box,Object.assign({className:e.addButtonWrapper},{children:jsxRuntime.exports.jsx(Button,Object.assign({type:"submit",disabled:!lodash.exports.get(r,"formState.isValid"),variant:"contained",color:"primary","data-test":"app-center-new.context-menu-extension.submit-button"},{children:jsxRuntime.exports.jsx(FormattedMessage,{id:"app-center-new.context-menu-extensions.submit-button-text",defaultMessage:"{label}",description:"{label} Context Menu Extension",values:{label:a?"Update":"Add"}})}))}))]}))}))}))},ContextMenuExtensionPanel=e=>jsxRuntime.exports.jsx(AIWareCacheProvider,{children:jsxRuntime.exports.jsx(AIWareThemeProvider,{children:jsxRuntime.exports.jsx(AIWareIntlProvider,{children:jsxRuntime.exports.jsx(ContextMenuExtensionForm,{hidePanel:e.hidePanel,isEdit:e.isEdit,editIndex:e.editIndex,extensionType:e.extensionType})})})});export{AppCenterConfigFieldsForm,ContextMenuExtensionPanel as AppCenterContextMenuExtensionPanel,AppCenterNew};