{abortSignal:s,reason:c,...d}=a,u=(0,o.VA)(d);e((0,r.apiCall)({method:"workflows.templates.describe",args:u,abortSignal:s,reason:c})).then(e=>{n(e)}).catch(e=>{(0,i.default)({getState:t}).error(`API call to workflows.templates.describe
						with reason ${c} failed, initiated by generated fetcher`),l(e)})}));s.meta={name:"workflowsTemplatesDescribeFetcher",key:"createFetcherWorkflowsTemplatesDescribeFetcher",description:"workflows.templates.describe generated fetcher"}},0xc8f333a2:(e,t,a)=>{"use strict";a.d(t,{M:()=>s});var n=a(0xe874a88a),r=a(0x22a29f141),l=a(0x1dfdeb1c8),i=a(0x1ec68d6a3),o=a(0xe747dd27);let s=(0,l.A)("workflows.templates.update generated fetcher",(e,t,a)=>new n.S((n,l)=>{let{abortSignal:s,reason:c,...d}=a,u=(0,o.VA)(d);e((0,r.apiCall)({method:"workflows.templates.update",args:u,abortSignal:s,reason:c})).then(e=>{n(e)}).catch(e=>{(0,i.default)({getState:t}).error(`API call to workflows.templates.update
						with reason ${c} failed, initiated by generated fetcher`),l(e)})}));s.meta={name:"workflowsTemplatesUpdateFetcher",key:"createFetcherWorkflowsTemplatesUpdateFetcher",description:"workflows.templates.update generated fetcher"}},0x1f26a5878:(e,t,a)=>{"use strict";a.d(t,{W:()=>s});var n=a(0xe874a88a),r=a(0x22a29f141),l=a(0x1dfdeb1c8),i=a(0x1ec68d6a3),o=a(0xe747dd27);let s=(0,l.A)("workflows.triggers.summarize generated fetcher",(e,t,a)=>new n.S((n,l)=>{let{abortSignal:s,reason:c,...d}=a,u=(0,o.VA)(d);e((0,r.apiCall)({method:"workflows.triggers.summarize",args:u,abortSignal:s,reason:c})).then(e=>{n(e)}).catch(e=>{(0,i.default)({getState:t}).error(`API call to workflows.triggers.summarize
						with reason ${c} failed, initiated by generated fetcher`),l(e)})}));s.meta={name:"workflowsTriggersSummarizeFetcher",key:"createFetcherWorkflowsTriggersSummarizeFetcher",description:"workflows.triggers.summarize generated fetcher"}},0x3b26a95e:(e,t,a)=>{"use strict";a.d(t,{A:()=>useClientRect});var n=a(0xbad225b5),r=a(0x162afc153);function useClientRect(e){let[t,a]=(0,n.useState)(e?.getBoundingClientRect()||null);return(0,n.useEffect)(()=>{let t=(0,r.A)(()=>{a(e.getBoundingClientRect())},150);return window.addEventListener("resize",t),window.addEventListener("scroll",t),()=>{window.removeEventListener("resize",t),window.removeEventListener("scroll",t)}},[e]),t}},0x15e922395:(e,t,a)=>{"use strict";a.d(t,{D:()=>n});let n=(0,a(0xcf658893).Ay)("External Auth Completed");n.meta={name:"externalAuthCompleted",key:"createActionExternalAuthCompleted",description:"External Auth Completed"}},0x8921b4af:(e,t,a)=>{"use strict";a.d(t,{T:()=>r});var n=a(0x22b3402cb);let r=(0,a(0x11c82607b).Ay)("Clean message text",(e,t,{text:a,isInternalMessage:r})=>{let l=t();return(0,n.A)(l,a,{isInternalMessage:r})});r.meta={name:"cleanMessageTextWithState",key:"createThunkCleanMessageTextWithState",description:"Clean message text"}},0x852588ab:(e,t,a)=>{"use strict";a.d(t,{n:()=>r});var n=a(0x1634acce7);let r=(0,a(0x11c82607b).Ay)("Prepare message",(e,t,a)=>{let r=t();return(0,n.A)(r,a)});r.meta={name:"prepareMessageThunk",key:"createThunkPrepareMessageThunk",description:"Prepare message"}},0x106932267:(e,t,a)=>{"use strict";a.d(t,{D6:()=>c,R7:()=>u,Tt:()=>i,Yl:()=>s,ZT:()=>d,ad:()=>m,wv:()=>o,ys:()=>p});var n=a(0x1df96de4c),r=a(0x1cf0d97e1),l=a(0xdf55e8f3);let i=(0,r.Ay)(e=>e?.appManifest?.json);i.meta={name:"getJson",key:"createSelectorGetJson",description:e=>e?.appManifest?.json};let o=(0,r.Ay)(e=>e?.appManifest?.lastSavedJson);o.meta={name:"getLastSavedJson",key:"createSelectorGetLastSavedJson",description:e=>e?.appManifest?.lastSavedJson};let s=(0,r.Ay)(e=>e?.appManifest?.errors||n.Ml);s.meta={name:"getErrors",key:"createSelectorGetErrors",description:e=>e?.appManifest?.errors||n.Ml};let c=(0,r.Ay)(e=>e?.appManifest?.teamToken);c.meta={name:"getTeamToken",key:"createSelectorGetTeamToken",description:e=>e?.appManifest?.teamToken};let d=(0,r.Ay)(e=>e?.appManifest?.teamId);d.meta={name:"getTeamId",key:"createSelectorGetTeamId",description:e=>e?.appManifest?.teamId};let u=(0,r.Ay)(e=>e?.appManifest?.appId);u.meta={name:"getAppId",key:"createSelectorGetAppId",description:e=>e?.appManifest?.appId};let m=(0,r.Ay)(e=>e?.appManifest?.warnings||n.Ml);m.meta={name:"getWarnings",key:"createSelectorGetWarnings",description:e=>e?.appManifest?.warnings||n.Ml};let p=(0,l.eI)(e=>s(e).concat(m(e)))},0x95c66692:(e,t,a)=>{"use strict";a.d(t,{u:()=>d});var n=a(0x95583610),r=a(0x1ec68d6a3),l=a(0x11c82607b),i=a(0x110d7b067),o=a(0x19561ce96),s=a(0x65561a6f),c=a(0x184767f39);let d=(0,l.Ay)("Add connector app step",async(e,t,{appId:a,appName:l,onOpenModal:d,onRequestAppModal:u,reason:m})=>{if(!a)return;let p=(0,o.Ez)(t(),a);try{if(p===c.pY.INSTALL_SHOW_STEP_FUNCTION){e((0,i.B$)({appId:a,appInstallationInFlight:!0}));let t=await e((0,n.y)({appId:a,reason:m??"step-library/install-connector-app"}));t&&t.ok&&(e((0,i.B$)({appId:a,appInstallationInFlight:!1})),e((0,s.o)({appIds:[a]})),d())}else p===c.pY.SHOW_STEP_FUNCTION?d():p===c.pY.INIT_APP_REQUEST_FLOW&&u()}catch(n){(0,r.default)({getState:t}).error(`error installing connector app info: ${a}`,n),e((0,i.B$)({appId:a,appInstallationInFlight:!1})),e((0,i.H)({appName:l||a}))}});d.meta={name:"addConnectorAppStep",key:"createThunkAddConnectorAppStep",description:"Add connector app step"}},0x212b4c697:(e,t,a)=>{"use strict";a.d(t,{BX:()=>r,RV:()=>i,RZ:()=>l});var n=a(0xcf658893);let r=(0,n.Ay)("Add function auths");r.meta={name:"addFunctionAuths",key:"createActionAddFunctionAuths",description:"Add function auths"};let l=(0,n.Ay)("Reset function auths");l.meta={name:"resetFunctionAuths",key:"createActionResetFunctionAuths",description:"Reset function auths"};let i=(0,n.Ay)("Set default auth token");i.meta={name:"setDefaultAuthToken",key:"createActionSetDefaultAuthToken",description:"Set default auth token"}},0xddd27d94:(e,t,a)=>{"use strict";a.d(t,{$:()=>generateFunctionAuthKey,A:()=>i});var n=a(0xba77ecb9),r=a(0x15e922395),l=a(0x212b4c697);let getInitialState=()=>({}),generateFunctionAuthKey=({functionId:e,providerKey:t})=>`${e}-${t}`,i=(0,n.Ay)({},getInitialState(),{storeKey:"hermesFunctionAuth",persistenceEnabled:!1}).on(l.BX,(e,{auths:t})=>t.reduce((e,t)=>(e[generateFunctionAuthKey(t)]=t,e),{...e})).on(l.RZ,()=>getInitialState()).on(l.RV,(e,{functionId:t,providerKey:a,externalTokenId:n})=>{let r=generateFunctionAuthKey({functionId:t,providerKey:a}),l=e[r],i=l?.validTokens.find(e=>e.externalTokenId===n);if(!i||i.isDefault)return e;let o=l.validTokens.map(e=>{let t=e.externalTokenId===n;return{...e,isDefault:t}});return{...e,[r]:{...l,validTokens:o}}}).on(r.D,(e,{external_token_id:t,external_user_id:a,provider_key:n,provider_name:r,app_id:l,function_id:i,user_id:o})=>{let s=generateFunctionAuthKey({functionId:i,providerKey:n}),c=e[s],d={externalTokenId:t,externalUserId:a,isDefault:!0,userId:o};if(!c)return{...e,[s]:{appId:l,functionId:i,providerKey:n,providerName:r,validTokens:[d]}};let u=[d,...c.validTokens.filter(e=>e.externalTokenId!==t).map(e=>({...e,isDefault:!1}))];return{...e,[s]:{...c,validTokens:u}}})},0x157b4a886:(e,t,a)=>{"use strict";a.d(t,{JG:()=>c,WZ:()=>d,mh:()=>getFunctionAuthState,rl:()=>u});var n=a(0x19b3ba9fd),r=a(0x1df96de4c),l=a(0x1cf0d97e1),i=a(0xdf55e8f3),o=a(0x1bc4b3ad8),s=a(0xddd27d94);let getFunctionAuthState=e=>e.hermesFunctionAuth,c=(0,l.Ay)((e,{functionId:t,providerKey:a})=>{let n=(0,s.$)({functionId:t,providerKey:a});return getFunctionAuthState(e)[n]});c.meta={name:"getFunctionAuth",key:"createSelectorGetFunctionAuth",description:(e,{functionId:t,providerKey:a})=>{let n=(0,s.$)({functionId:t,providerKey:a});return getFunctionAuthState(e)[n]}};let d=(0,i.eI)((e,t)=>t.map(({functionId:t,providerKey:a})=>c(e,{functionId:t,providerKey:a})).filter(n.b)),u=(0,o.F)(getFunctionAuthState,(e,{appId:t})=>t,(e,{functionId:t})=>t,(e,t,a)=>{let n=Object.values(e).filter(e=>e.appId===t&&e.functionId===a);return n.length?n:r.Ml});(0,l.Ay)(e=>Object.values(getFunctionAuthState(e)).reduce((e,t)=>(e[t.appId]=e[t.appId]??[],e[t.appId].push(t),e),{})).meta={name:"getUserAuthsGroupedByAppId",key:"createSelectorGetUserAuthsGroupedByAppId",description:e=>Object.values(getFunctionAuthState(e)).reduce((e,t)=>(e[t.appId]=e[t.appId]??[],e[t.appId].push(t),e),{})},(0,o.F)(getFunctionAuthState,(e,t)=>t,(e,t)=>{let a=Object.values(e).filter(e=>e.appId===t);return a.length?a:r.Ml})},0x1a7c0453a:(e,t,a)=>{"use strict";a.d(t,{N:()=>l,x:()=>i});var n=a(0x220ca72b1),r=a(0x11c82607b);let l=(0,r.Ay)("Start Function OAuth",async(e,t,{appId:a,providerKey:r,functionId:l,workflowId:i,reason:o="start_function_auth"})=>{let s=(await e((0,n.$)({appId:a,providerKey:r,functionId:l,workflowId:i,reason:o}))).authorization_url;window.open(s,"_blank","popup,noopener,noreferrer")});l.meta={name:"startFunctionAuth",key:"createThunkStartFunctionAuth",description:"Start Function OAuth"};let i=(0,r.Ay)("Start OAuth flow",async(e,t,{appId:a,providerKey:r,reason:l="start_oauth_flow",channelId:i,ephemeralMsgTs:o})=>{let s=(await e((0,n.$)({appId:a,providerKey:r,reason:l,channelId:i,ephemeralMsgTs:o}))).authorization_url;window.open(s,"_blank","popup,noopener,noreferrer")});i.meta={name:"startAuth",key:"createThunkStartAuth",description:"Start OAuth flow"}},0x3b8174d2:(e,t,a)=>{"use strict";a.d(t,{Jk:()=>f,Ui:()=>g,W1:()=>y,Z0:()=>h,cq:()=>b,gL:()=>p,hj:()=>m,oS:()=>_,pk:()=>x,sw:()=>k,vp:()=>E,zy:()=>v});var n=a(0xbe0b63ff),r=a(0x1df96de4c),l=a(0x1846f5916),i=a(0x9b971e7e),o=a(0xdf55e8f3),s=a(0x58fa6f7f),c=a(0xa7a4ed65),d=a(0xea788d49),u=a(0x1be8212b1);let m=(0,o.eI)((e,t,a=!0)=>{let r=e?.hermesFunctions?.functionsById?.[t],l=(0,i.ZT)(e);return l?r?((0,s.J)().maybeRefetch(l,t),r):a?(0,d.Ss)().fetchObjectWithId(l,t):(0,n.WQ)(t):(0,n.WQ)(t)}),p=(0,o.eI)((e,{ids:t})=>t.length?t.map(t=>m(e,t,!0)):r.Ml),b=(0,o.eI)(e=>e.hermesFunctions.functionsById),f=(0,o.eI)(e=>e.hermesFunctions.categories),g=(0,o.eI)(e=>Object.entries(b(e)).reduce((e,[t,a])=>(a&&!a.is_hidden&&(e[t]=a),e),{})),h=(0,o.eI)(e=>Object.entries(f(e)).reduce((e,[t,a])=>(a.isHidden||(e[t]=a),e),{}));(0,o.eI)(e=>e.hermesFunctions.collections);let _=(0,o.eI)(e=>{let t=b(e);return Object.values(e.hermesFunctions.collections).reduce((e,a)=>{let n=Object.keys(a.functionIds.reduce((e,a)=>{let n=t[a],r=n?.app_id||n?.category_id;return r&&(e[r]=!0),e},{}));return n.length>=l.$x&&(e[a.id]={...a,categories:n}),e},{})}),y=(0,o.eI)((e,t)=>{let a=b(e),n=(0,u.g)(t),r=[],l=Object.values(a),i={};for(let{app_id:e,id:o,title:s,category_label:c,callback_id:d,type:u,is_hidden:m}of l){if(!s||!s.length||m)continue;let l=RegExp(`\\b${t}\\b`,"i"),p=s.search(l),b=n.customMatch(s);b=p>-1?-5:b;let f=n.customMatch(c||""),g=Math.min(n.fuzzyMatcher.normalizeAndScore(s)-1,b,c?n.fuzzyMatcher.normalizeAndScore(c||"")+1:1/0,f);isFinite(g)&&(i[o]=g,r.push({id:o,title:s||o,categoryLabel:c,type:u,appId:e||d,isCategory:!1,productLevelAvailability:{isAvailable:a[o]?.product_level_availability?.is_available??!0,availableTo:a[o]?.product_level_availability?.available_to}}))}return r.sort((e,t)=>i[e.id]-i[t.id]).slice(0,10)}),x=(0,o.eI)((e,t)=>{let a=h(e),n=(0,u.g)(t),r=[],l=Object.entries(a),i={};for(let e of l){let[t,{name:a,type:l}]=e,o=Math.min(n.fuzzyMatcher.normalizeAndScore(a),n.customMatch(a));a.length&&isFinite(o)&&(i[a]=o,r.push({id:t,title:a,type:l,appId:t,isCategory:!0}))}return r.sort((e,t)=>i[e.id]-i[t.id]).slice(0,2)}),v=(0,o.eI)(e=>{let t=m(e,c.Ez.case_step,!0);return!(0,n.lv)(t)}),E=(0,o.eI)(e=>{let t=m(e,c.Ez.case_step,!0);return t?.product_level_availability?.is_available??!0}),k=(0,o.eI)((e,t)=>Object.values(b(e)).filter(e=>e&&e.callback_id&&t.includes(e.callback_id)))},0x52b05cae:(e,t,a)=>{"use strict";a.d(t,{b:()=>i});var n=a(0x1dc39a002),r=a(0x11c82607b),l=a(0x16b708a7f);let i=(0,r.Ay)("Fetches notification prefs for given salesforce org id",async(e,t,{salesforceOrgId:a})=>{if(!a)return null;let r=await e((0,n.s)({salesforceOrgId:a,keys:["allow_slack_connect_channels","allow_channel_workspaces","send_notification_to_channel_permission","allow_admins_to_send_to_all_channel_types"],reason:"modern-selling"}));if(!r.ok||!r.org_configs||!r.org_configs.length)return null;let{datasource_id:i,allow_channel_workspaces:o,allow_slack_connect_channels:s,send_notification_to_channel_permission:c,allow_admins_to_send_to_all_channel_types:d}=r.org_configs[0],u={salesforce_org_id:a,datasource_id:i,allowed_channel_workspaces:o,allow_slack_connect_channels:s,send_notification_to_channel_permission:c,allow_admins_to_send_to_all_channel_types:d};return e((0,l.iQ)({[a]:u})),u});i.meta={name:"fetchNotificationPrefsBySalesforceOrgId",key:"createThunkFetchNotificationPrefsBySalesforceOrgId",description:"Fetches notification prefs for given salesforce org id"}},0xcefedbca:(e,t,a)=>{"use strict";a.d(t,{A:()=>g});var n=a(0xe874a88a),r=a(0x22a29f141),l=a(0x1dfdeb1c8),i=a(0x1ec68d6a3),o=a(0xe747dd27);let s=(0,l.A)("salesHome.workflows.get generated fetcher",(e,t,a)=>new n.S((n,l)=>{let{abortSignal:s,reason:c,...d}=a,u=(0,o.VA)(d);e((0,r.apiCall)({method:"salesHome.workflows.get",args:u,abortSignal:s,reason:c})).then(e=>{n(e)}).catch(e=>{(0,i.default)({getState:t}).error(`API call to salesHome.workflows.get
						with reason ${c} failed, initiated by generated fetcher`),l(e)})}));s.meta={name:"salesHomeWorkflowsGetFetcher",key:"createFetcherSalesHomeWorkflowsGetFetcher",description:"salesHome.workflows.get generated fetcher"};var c=a(0x11c82607b),d=a(0x16b708a7f),u=a(0x2fd935d8),m=a(0x1d104c491);let p={ADMIN_SALES_HOME_DEAL_WON:m.Lb.adminDealWon,ADMIN_SALES_HOME_FORECAST_REMINDER:m.Lb.adminForecastReminder,ADMIN_SALES_HOME_NEW_OPPORTUNITY:m.Lb.adminNewOpportunityAlert,ADMIN_SALES_HOME_OPPORTUNITY_AMOUNT_CHANGED:m.Lb.adminAmountChanged,ADMIN_SALES_HOME_OPPORTUNITY_CLOSE_DATE_CHANGED:m.Lb.adminCloseDateChanged,ADMIN_SALES_HOME_OPPORTUNITY_STAGE_CHANGED:m.Lb.adminStageChanged,ADMIN_SALES_HOME_OPPORTUNITY_CLOSING_SOON:m.Lb.adminClosingSoonAlert,ADMIN_SALES_HOME_OPPORTUNITY_PAST_CLOSE_DATE:m.Lb.adminPastCloseDateAlert,ADMIN_SALES_HOME_OUTDATED_FIELD:m.YB.adminOutdatedFields,ADMIN_SALES_HOME_MISSING_FIELD:m.YB.adminMissingFields},b={SALES_HOME_DEAL_WON:m.Lb.userDealWon,SALES_HOME_FORECAST_REMINDER:m.Lb.userForecastReminder,SALES_HOME_NEW_OPPORTUNITY:m.Lb.userNewOpportunityAlert,SALES_HOME_OPPORTUNITY_AMOUNT_CHANGED:m.Lb.userAmountChanged,SALES_HOME_OPPORTUNITY_CLOSE_DATE_CHANGED:m.Lb.userCloseDateChanged,SALES_HOME_OPPORTUNITY_STAGE_CHANGED:m.Lb.userStageChanged},f=(0,c.Ay)("Fetches data for existing workflow, hydrates form data and opens notification builder",(e,t,{workflowId:a,isAdmin:n=!1,reason:r="modern-selling"})=>(n?e((0,d.MB)(!0)):e((0,d.gG)(!0)),e(s({workflowId:a,reason:r})).then(({template_id:t,payload:a,salesforce_org_id:r})=>{let l=a.acn?.account?.id||a.condition?.account?.id,i=a.acn?.opportunity?.id||a.condition?.opportunity?.id;if(l||i){let o;return e((0,u.R)({sobjects:[{sobjectApiName:l?"Account":"Opportunity",fields:["Name"]}],asIntegrationUser:n,query:(o=l||i||"",`https://fake.com/sobjects/?record_id=${o}`),...r&&{salesforceOrgId:r},reason:"edit_workflow"})).then(({records:e})=>{let[o]=e,s={...a};return o&&(n&&l?s.acn.account.name=o.label:n&&i?s.acn.opportunity.name=o.label:!n&&l?s.condition.account.name=o.label:s.condition.opportunity.name=o.label),{templateId:t,payload:s,salesforceOrgId:r}})}return{templateId:t,payload:a,salesforceOrgId:r}}).then(({templateId:t,payload:r,salesforceOrgId:l})=>{if(n){let n=p[t];e((0,d.kC)({workflowView:n,workflowId:a,payload:r,salesforceOrgId:l}))}else{let n=b[t];e((0,d.yK)({workflowView:n,workflowId:a,payload:r,salesforceOrgId:l}))}}).finally(()=>{n?e((0,d.MB)(!1)):e((0,d.gG)(!1))})));f.meta={name:"openEditWorkflow",key:"createThunkOpenEditWorkflow",description:"Fetches data for existing workflow, hydrates form data and opens notification builder"};let g=f},0x1cbba0fb:(e,t,a)=>{"use strict";a.d(t,{S_:()=>l,VN:()=>i,yz:()=>r});var n=a(0x1cf0d97e1);let r=(0,n.Ay)((e,t)=>e?.slackConnectExternalTeamsList[t].teamIdList);r.meta={name:"getSlackConnectExternalTeamListByConnectionType",key:"createSelectorGetSlackConnectExternalTeamListByConnectionType",description:(e,t)=>e?.slackConnectExternalTeamsList[t].teamIdList};let l=(0,n.Ay)((e,t)=>e.slackConnectExternalTeamsList[t].marker);l.meta={name:"getSlackConnectExternalTeamListMarkerByConnectionType",key:"createSelectorGetSlackConnectExternalTeamListMarkerByConnectionType",description:(e,t)=>e.slackConnectExternalTeamsList[t].marker};let i=(0,n.Ay)((e,t)=>e.slackConnectExternalTeamsList[t].lastUpdated);i.meta={name:"getSlackConnectExternalTeamListLastUpdatedByConnectionType",key:"createSelectorGetSlackConnectExternalTeamListLastUpdatedByConnectionType",description:(e,t)=>e.slackConnectExternalTeamsList[t].lastUpdated}},0x1eb98d98a:(e,t,a)=>{"use strict";a.d(t,{J:()=>r,O:()=>l});var n=a(0xcf658893);let r=(0,n.Ay)("ADD_STREAMING_MESSAGE");r.meta={name:"addStreamingMessage",key:"createActionAddStreamingMessage",description:"ADD_STREAMING_MESSAGE"};let l=(0,n.Ay)("REMOVE_STREAMING_MESSAGE");l.meta={name:"removeStreamingMessage",key:"createActionRemoveStreamingMessage",description:"REMOVE_STREAMING_MESSAGE"}},0x507d338f:(e,t,a)=>{"use strict";a.d(t,{_:()=>o,v:()=>s});var n=a(0x1337d9fa2),r=a(0x1cf0d97e1),l=a(0x1ccef1c6f),i=a(0x14149c126);let o=(0,r.Ay)((e,{channelId:t,ts:a})=>e?.streamingMessages?.[`${t}-${a}`]??!1);o.meta={name:"isMessageStreaming",key:"createSelectorIsMessageStreaming",description:(e,{channelId:t,ts:a})=>e?.streamingMessages?.[`${t}-${a}`]??!1};let s=(0,r.Ay)((e,t)=>{let a=(0,l.ty)(e,"a11y_animations")??!0,r="on"===(0,i._Z)(e,"animated_text_streaming");return!!(a&&!(0,n.gn)(t)&&r)});s.meta={name:"shouldMessageStream",key:"createSelectorShouldMessageStream",description:(e,t)=>{let a=(0,l.ty)(e,"a11y_animations")??!0,r="on"===(0,i._Z)(e,"animated_text_streaming");return!!(a&&!(0,n.gn)(t)&&r)}}},0x1b729a17a:(e,t,a)=>{"use strict";a.d(t,{P:()=>s});var n=a(0x12185e091),r=a(0x21dd74f4c),l=a(0x1cf0d97e1),i=a(0x1ccef1c6f),o=a(0x217553e42);let s=(0,l.Ay)(e=>{let t=!(0,i.ty)(e,"activity_include_threads_in_badge_count"),a=e?.unreadCounts?.countsPerChannel,l=0;for(let[t,i]of Object.entries(a)){let a=(0,o.OL)(e,t);if((0,n.JM)(a)){if(!i?.unreadHighlightCnt)continue;(0,r.G)(e,t)||(l+=i?.unreadHighlightCnt||0)}}return l+(t?e?.unreadCounts?.totalUnreadHighlightsWithoutDmsAndThreadUnreads||0:e?.unreadCounts?.totalUnreadHighlightsWithoutDms||0)});s.meta={name:"getTotalUnreadHighlights",key:"createSelectorGetTotalUnreadHighlights",description:e=>{let t=!(0,i.ty)(e,"activity_include_threads_in_badge_count"),a=e?.unreadCounts?.countsPerChannel,l=0;for(let[t,i]of Object.entries(a)){let a=(0,o.OL)(e,t);if((0,n.JM)(a)){if(!i?.unreadHighlightCnt)continue;(0,r.G)(e,t)||(l+=i?.unreadHighlightCnt||0)}}return l+(t?e?.unreadCounts?.totalUnreadHighlightsWithoutDmsAndThreadUnreads||0:e?.unreadCounts?.totalUnreadHighlightsWithoutDms||0)}}},0x42654967:(e,t,a)=>{"use strict";a.d(t,{$n:()=>y,$z:()=>resolveNextCursorMark,BQ:()=>f,CS:()=>A,F6:()=>w,H3:()=>E,HC:()=>formatDateInterval,HM:()=>getNumberAnnotation,IV:()=>g,Nq:()=>getUiPageForType,Ph:()=>C,S5:()=>N,VZ:()=>createQuery,Yx:()=>k,Zq:()=>v,a$:()=>h,cU:()=>formatYYYYMMDDToUnixTime,lV:()=>_,mB:()=>I,p5:()=>b,r5:()=>x,uL:()=>S,w5:()=>T});var n,r,l,i,o,s,c,d,u=a(0x205f4fb61),m=a(0x3711e82d),p=a(0x6960d8b9);a(0xb1f0729f);let b=350;var f=((n={}).Channels="channels",n.Messages="messages",n.Users="users",n.Files="files",n.Apps="apps",n.Teams="teams",n),g=((r={}).Overview="overview",r.Teams="teams",r.Channels="channels",r.Members="users",r.Apps="apps",r.Huddles="huddles",r.Clips="clips",r.SlackAi="slack-ai",r.Canvas="canvas",r.Workflows="workflows",r.Lists="lists",r),h=((l={}).TwentyEightDays="28d",l.SevenDays="7d",l.OneDay="1d",l.Custom="custom",l);let _={ThreeMonths:"3mo",TwentyEightDays:"28d",SevenDays:"7d",Custom:"custom",SelectNewRange:"selectNewRange"},y={ThreeMonths:"3mo",TwentyEightDays:"28d",SevenDays:"7d",Custom:"custom",SelectNewRange:"selectNewRange"},x={ThreeMonths:"3mo",TwentyEightDays:"28d",SevenDays:"7d",Custom:"custom",SelectNewRange:"selectNewRange"};var v=((i={}).ThirtyDays="30d",i.AllTime="all",i.Custom="custom",i.PrevMonth="prevMonth",i);let E={ThirtyDays:"30d",TwentyEightDays:"28d",ThirteenMonths:"13mo",AllTime:"all",Custom:"custom",PrevMonth:"prevMonth",SelectNewRange:"selectNewRange"},k={ThreeMonths:"3mo",TwentyEightDays:"28d",SevenDays:"7d",Custom:"custom",SelectNewRange:"selectNewRange"},w={ThreeMonths:"3mo",TwentyEightDays:"28d",SevenDays:"7d",Custom:"custom",SelectNewRange:"selectNewRange"};var S=((o={}).Default="default",o.Daily="daily",o.Monthly="monthly",o),C=((s={}).Number="number",s.Percentage="percentage",s.Date="date",s.String="string",s),A=((c={}).All="all",c.Audio="audio",c.Video="video",c),T=((d={}).All="all",d.Standalone="standalone",d.Channel="channel_canvas",d);let I=6,N={number:u.Ay,percentage:e=>(0,u.KN)(e/100),date:e=>(0,p.Yq)(e,"{date_num}"),string:e=>e},getUiPageForType=(e,t)=>t?({overview:m.UiPage.ADMIN_ANALYTICS_TEAM_SITE_OVERVIEW,channels:m.UiPage.ADMIN_ANALYTICS_TEAM_SITE_CHANNELS,users:m.UiPage.ADMIN_ANALYTICS_TEAM_SITE_MEMBERS,apps:m.UiPage.ADMIN_ANALYTICS_TEAM_SITE_APPS,"slack-ai":m.UiPage.ADMIN_ANALYTICS_TEAM_SITE_SLACK_AI})[e]:({overview:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_OVERVIEW,channels:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_CHANNELS,teams:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_TEAMS,users:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_MEMBERS,apps:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_APPS,clips:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_CLIPS,canvas:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_CANVAS,huddles:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_HUDDLES,"slack-ai":m.UiPage.ADMIN_ANALYTICS_TEAM_SITE_SLACK_AI,workflows:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_WORKFLOWS,lists:m.UiPage.ADMIN_ANALYTICS_ADMIN_SITE_LISTS})[e];function getNumberAnnotation(e,t){let a="";if("ja-JP"===e)switch(t){case"channels":case"messages":a="\u4EF6";break;case"users":a="\u4EBA";break;case"files":case"apps":a="\u500B"}return a}let resolveNextCursorMark=({cursorMark:e,numFound:t,countRequested:a,countReturned:n,countSoFar:r})=>0===n||t<=a||t===r+n?null:e,formatYYYYMMDDToUnixTime=e=>{let t=new Date(e),a=6e4*t.getTimezoneOffset();return new Date(t.getTime()+a).getTime()};function formatDateInterval(e){let[t="",a=""]=e?.startDate.split("-")??[];return`${t}-${a}`}function createQuery({searchQuery:e,searchType:t="fuzzy_with_email"}){try{if("string"!=typeof e||!e.trim().length)return;let a=e.trim().split(/\s+/).map(e=>({type:t,value:e})),n=1===a.length?a[0]:{type:"and",clauses:a};return JSON.stringify(n)}catch{return}}},0x8ba4f2d8:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});var n=a(0xe874a88a),r=a(0x154933c60),l=a(0x1ecc7f772),i=a(0x1c8f352ff);let o=(0,a(0x11c82607b).Ay)("Returns the result of channel name validation for the Channel Create modal",async(e,t,{channelName:a,skipNameTakenValidation:o=!1,validateNameTakenAgainstLocalStore:s=!0}={})=>{if(o){let e=t(),r=(0,i.cv)(e,a,"",(0,i.zU)(),o);return n.S.resolve(r)}let c=await e((0,r.hq)({query:a})),d=t();if(!s){let e=!!c?.channels?.find(e=>(0,l.Mn)(e)===a);return{...(0,i.cv)(d,a,"",(0,i.zU)()),hasNameTakenWarning:e}}return(0,i.cv)(d,a,"",(0,i.zU)())});o.meta={name:"validateChannelName",key:"createThunkValidateChannelName",description:"Returns the result of channel name validation for the Channel Create modal"};let s=o},0x33830eed:(e,t,a)=>{"use strict";let n,r;a.d(t,{Ay:()=>m});var l=a(0xe874a88a),i=a(0x20482ad21),o=a(0x1f7b0911b),s=a(0x3ed00af5),c=a(0x11c82607b);let d=new i.Ay("user_groups");function initErrorStrings(e){n={hasHandleRequiredWarning:d.t("Please enter a handle for this group."),hasMaxLengthWarning:d.t("Handles can\u2019t be more than {maxLength} characters.",{maxLength:80}),hasReservedHandle:d.t("The group name @{handle} is reserved and cannot be used.",{handle:e}),hasSpecialsWarning:d.t("Handles can only contain letters or numbers."),hasPunctuationWarning:d.t("Handles can only contain letters or numbers."),hasLowercaseWarning:d.t("Handles can only be in lowercase."),hasHandleTakenWarning:d.t("This handle is already in use by a member, channel, or another group."),nonLatinCharacterWarning:d.t("Handles can only contain letters or numbers."),unknownError:d.t("Sorry, something went wrong. Please try a different handle.")}}function initReservedHandles(){r={admins:d.t("admins"),owners:d.t("owners")}}let u=(0,c.Ay)("Validate user group handle",(e,t,{handle:a,prevHandle:i,reason:c,targetTeam:d})=>(initErrorStrings(a),initReservedHandles(),a&&a.trim())?a===i?l.S.resolve(""):a.toLowerCase()===r.admins.toLowerCase()||a.toLowerCase()===r.owners.toLowerCase()?l.S.resolve(n.hasReservedHandle):/[ ,;'`~!@#$%^&*+=\\:"<>?|]/.test(a.trim())?l.S.resolve(n.hasSpecialsWarning):/^[-|_]+$/.test(a)?l.S.resolve(n.hasPunctuationWarning):/[A-Z]/.test(a)?l.S.resolve(n.hasLowercaseWarning):(0,s.A)(a)>80?l.S.resolve(n.hasMaxLengthWarning):e((0,o.S)({handle:a,reason:c,targetTeam:d})).then(()=>"").catch(e=>{let t=e?.data?.error;return"handle_already_exists"===t?n.hasHandleTakenWarning:"bad_handle"===t?n.nonLatinCharacterWarning:n.unknownError}):l.S.resolve(n.hasHandleRequiredWarning));u.meta={name:"validateUserGroupHandle",key:"createThunkValidateUserGroupHandle",description:"Validate user group handle"};let m=u;Object.defineProperty({},"handleErrorStrings",{get:()=>n,set:e=>{n=e}})},0x15e263568:(e,t,a)=>{"use strict";let n,r;a.d(t,{Ay:()=>m});var l=a(0xe874a88a),i=a(0x20482ad21),o=a(0x69509bae),s=a(0x3ed00af5),c=a(0x11c82607b);let d=new i.Ay("user_groups");function initErrorStrings(e){r={hasNameRequiredWarning:d.t("Please enter a name for this group."),hasReservedName:d.t('The name "{name}" is reserved and cannot be used.',{name:e}),hasMaxLengthWarning:d.t("Names can\u2019t be more than {maxLength} characters.",{maxLength:80}),hasNameTakenWarning:d.t("This name is already in use by another group."),unknownError:d.t("Sorry, something went wrong. Please try a different name.")}}function initReservedNames(){n={admins:d.t("Team Admins"),owners:d.t("Team Owners")}}let u=(0,c.Ay)("Validate user group name",async(e,t,{name:a,prevName:i,reason:c,targetTeam:d})=>{if(initErrorStrings(a),initReservedNames(),!a||!a.trim())return l.S.resolve(r.hasNameRequiredWarning);let u=a.toLowerCase().trim();return i&&u===i.toLowerCase().trim()?l.S.resolve(""):u===n.admins.toLowerCase()||u===n.owners.toLowerCase()?l.S.resolve(r.hasReservedName):(0,s.A)(a)>80?l.S.resolve(r.hasMaxLengthWarning):e((0,o.N)({name:a,reason:c,targetTeam:d})).then(()=>"").catch(e=>"name_already_exists"===e?.data?.error?r.hasNameTakenWarning:r.unknownError)});u.meta={name:"validateUserGroupName",key:"createThunkValidateUserGroupName",description:"Validate user group name"};let m=u;Object.defineProperty({},"nameErrorStrings",{get:()=>r,set:e=>{r=e}})},0xccd97fa5:(e,t,a)=>{"use strict";a.d(t,{A:()=>d});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x20482ad21),s=a(0xdb33a144);let c=new o.Ay("threads");function ThreadSeparatorRowGeneric({replyCount:e=0,separatorType:t="default",clientTheme:a="light",ghost:l=!1,unreadMarkerKey:o,willPulse:d,threadsUnreadDataQa:u="",messageContainerType:m}){let p=(0,r.wA)(),b=Math.max(1,e),f=c.t("{count, plural, =1 {# reply} other {# replies}}",{count:b}),g=c.t("New"),h=i()("p-thread_separator_row_generic",{"p-thread_separator_row_generic--dark":"dark"===a,"p-thread_separator_row_generic--ghost":l}),[_,y]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let e;return!l&&d&&(y(!0),e=window.setTimeout(()=>{y(!1),p((0,s.S)({unreadMarkerKey:o||"",messageContainerType:m,willPulse:!1}))},600)),()=>{e&&clearTimeout(e)}},[l,d,p,o,m]),n.createElement("div",{className:h},n.createElement("div",{className:"p-threads_flexpane__separator"},n.createElement("span",{className:"p-threads_flexpane__separator_count"},f),"default"===t&&n.createElement("hr",{className:"p-threads_flexpane__separator_line"}),"default"!==t&&n.createElement(n.Fragment,null,n.createElement("hr",{className:i()("p-threads_flexpane__separator_line",`p-threads_flexpane__separator_line__${t}`,{"p-threads_flexpane__separator_line--pulsing":_}),"aria-hidden":"true","data-qa":u}),n.createElement("span",{className:`p-threads_flexpane__${t}_divider__label`},g))))}ThreadSeparatorRowGeneric.displayName="ThreadSeparatorRowGeneric";let d=n.memo(ThreadSeparatorRowGeneric)},0x133aee58f:(e,t,a)=>{"use strict";a.d(t,{A:()=>useGetSelectedSalesforceOrgIdForSearch});var n=a(0x226892387),r=a(0x1c8beab7f);function useGetSelectedSalesforceOrgIdForSearch(e=!1){let t=!!(0,n.d4)(t=>(0,r.DY)(t,e)),a=(0,n.d4)(r.rg),l=(0,n.d4)(r.RC),i=(0,n.d4)(e?r.MH:r.gE);return t?i:e?a:l}},0x10490d62c:(e,t,a)=>{"use strict";a.d(t,{A:()=>useMuteNotification});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0x6e87d4ec),o=a(0xe874a88a),s=a(0x22a29f141),c=a(0x1dfdeb1c8),d=a(0x1ec68d6a3),u=a(0xe747dd27);let m=(0,c.A)("salesHome.notifications.mutePrefs.update generated fetcher",(e,t,a)=>new o.S((n,r)=>{let{abortSignal:l,reason:i,...o}=a,c=(0,u.VA)(o);e((0,s.apiCall)({method:"salesHome.notifications.mutePrefs.update",args:c,abortSignal:l,reason:i})).then(e=>{n(e)}).catch(e=>{(0,d.default)({getState:t}).error(`API call to salesHome.notifications.mutePrefs.update
						with reason ${i} failed, initiated by generated fetcher`),r(e)})}));m.meta={name:"salesHomeNotificationsMutePrefsUpdateFetcher",key:"createFetcherSalesHomeNotificationsMutePrefsUpdateFetcher",description:"salesHome.notifications.mutePrefs.update generated fetcher"};var p=a(0x16ffed5ab);let b=new l.Ay("modernselling");function useMuteNotification(){let e=(0,r.wA)(),t=(0,n.useCallback)(t=>{e((0,p.M)({element:n.createElement(i.A,{svgIconProps:{name:"check"}},t?b.t("Notification muted. You\u2019ll stop receiving notifications with these conditions."):b.t("Notification unmuted"))}))},[e]);return(0,n.useCallback)(async(a,n)=>{await e(m({workflowId:a,isMuted:n,reason:"sales-notifications"})),t(n)},[e,t])}useMuteNotification.displayName="useMuteNotification"},0x200c38ed8:(e,t,a)=>{"use strict";a.d(t,{aV:()=>useNotificationsOpportunitySchema,jv:()=>useNotificationsOpportunitySchemaForEndUser,qI:()=>useSalesHomeNotificationsSearcherOptions});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x133aee58f),i=a(0x3d5a0d18),o=a(0x12185e091),s=a(0x1fe613d6e),c=a(0x226892387),d=a(0x4f86f8f5),u=a(0x1c8beab7f),m=a(0x52b05cae),p=a(0x1d104c491);function useNotificationsOpportunitySchema(){return(0,c.d4)(e=>(0,u.Y)(e,p.hd.Opportunity))}function useNotificationsOpportunitySchemaForEndUser(){let e=!!(0,c.d4)(e=>(0,u.DY)(e,!1)),t=(0,l.A)(!1),a=(0,c.d4)(e=>(0,u.vV)(e,p.hd.Opportunity,t)),n=(0,c.d4)(e=>(0,u.oL)(e,p.hd.Opportunity));return e?a:n}function getChannelPermissions(e,t){let a=e?.send_notification_to_channel_permission,n=e?.allow_admins_to_send_to_all_channel_types??!1,r=!0,l=!0,i=e?.allow_slack_connect_channels??!1;if(t&&n)return{shouldIncludePublicChannels:r,shouldIncludePrivateChannels:l,shouldIncludeSlackConnectChannels:i=!0};switch(a){case p.$4.PRIVATE_CHANNELS_ONLY:r=!1;break;case p.$4.NO_CHANNELS:r=!1,l=!1;case p.$4.ALL_CHANNELS:}return{shouldIncludePublicChannels:r,shouldIncludePrivateChannels:l,shouldIncludeSlackConnectChannels:i}}function useSalesHomeNotificationsSearcherOptions(e=""){let[t,a]=(0,n.useState)(!1),l=(0,r.wA)(),p=(0,c.d4)(t=>(0,u.uS)(t,e)),b=(0,c.d4)(s.K),f=p?.allowed_channel_workspaces,{shouldIncludePublicChannels:g,shouldIncludePrivateChannels:h,shouldIncludeSlackConnectChannels:_}=getChannelPermissions(p,b),y=(0,n.useMemo)(()=>({workspaceFilter:{type:d.MR.All},peopleFilter:{type:d.E7.All}}),[]),x=(0,i.J)(y),v=(0,n.useCallback)(e=>!(0,o.jq)(e)||x(e),[x]);return(0,n.useEffect)(()=>{a(!p),e&&!p&&l((0,m.b)({salesforceOrgId:e}))},[e,p,l]),{isFetchingPrefs:t,searcherOptions:(0,n.useMemo)(()=>({entities:{channels:{includeOnlyExternallyShared:_,includePrivate:h,includePublic:g,includeArchived:!1,includeMpims:!1,excludeElmChannels:!0,allowedInternalTeams:f,onlyIfMember:!0},members:!1,userGroups:!1},allowEmptyQuery:!0,limit:100,sort:{frecency:!0,preferChannelsUserBelongsTo:!0,preferExactMatch:!0},filter:v}),[f,_,h,g,v])}}},0x1b7f0cd57:(e,t,a)=>{"use strict";a.d(t,{R:()=>WorkflowAvatar});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x85512121),o=a(0x710afd12),s=a.n(o);let WorkflowAvatar=class WorkflowAvatar extends n.PureComponent{static defaultProps={size:"medium",hasDecorativeAltTag:!0};render(){let{size:e,className:t,hasDecorativeAltTag:a,iconSrcUrl:r,altText:o}=this.props,c=r;return c||(c=i),n.createElement("img",{alt:a?"":o,className:l()(s().image,s()[e],t),src:c})}};WorkflowAvatar.displayName="WorkflowAvatar"},0x207b33662:(e,t,a)=>{"use strict";a.d(t,{c:()=>ed});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x21f3c49e8),o=a(0x2286acf6c),s=a(0x1cbdfeceb),c=a(0x118cdcdea),d=a.n(c),u=a(0x1229d92d),m=a(0x20482ad21),p=a(0x677a139e),b=a(0x1d2cd7755),f=a(0x1e586fbba),g=a(0x2501a2cee),h=a(0x1c2ea7265),_=a(0x235d78b7c),y=a(0x99233ecb),x=a(0x6aeae8a3),v=a(0x1a3c2e1af),E=a(0x222a04717),k=a(0x1c9338be7),w=a(0x1a6afe63b),S=a(0x88881d67),C=a(0xe9c32bb),A=a(0x1e1fc678),T=a(0x3b26a95e),I=a(0x1795d8821),N=a(0x133096d9b),M=a.n(N);let L=new m.Ay("workflow_builder"),getMenuItemDataQa=({source:e,name:t})=>`${e}-${t}`,PlaceholderVariablePopover=({onSelect:e,data:t,customDataFilter:a,tetherElement:r,onClose:l})=>{let i=(0,T.A)(r?.lastElementChild??r),o=L.t("Insert a variable"),s=L.t("Variables allow you to insert data from previous steps into your workflow."),c=L.t("No variables available"),d=(0,w.D)(),u=(0,n.useCallback)(t=>()=>{e(t)},[e]),m=(0,S.PW)(t,a),p=(0,n.useCallback)((e,t)=>n.createElement(y.Dr,{key:e.id,onSelected:u(e),label:n.createElement("div",{className:M().menuItem,"data-qa":getMenuItemDataQa(e)},n.createElement("div",null,n.createElement(C.nB,{element:"span"},n.createElement(k.P,{data:e,isObjectPropertySubmenuItem:t}))))}),[u]),b=(0,n.useCallback)(e=>n.createElement(C.HL,null," ",e," "),[]),f=(0,n.useCallback)(e=>t=>n.createElement(y.Ay,t,n.createElement(y.c$,{label:b(e.label)}),n.createElement(y.bX,{key:`${e.id}-separator`}),e.objectProperties?.map(e=>p(e,!0))),[b,p]),g=(0,n.useCallback)(e=>n.createElement(C.nB,{element:"span"},n.createElement(k.P,{data:e})),[]),h=(0,n.useCallback)(e=>n.createElement(C.HL,{className:M().groupHeaderLabel},e.stepIndex&&`${e.stepIndex}. `,(0,A.k)(e.type)?(0,A.T)(e.type,e.label,e.subtype):e.label),[]),_=(0,n.useMemo)(()=>{let e=[];return 0===m.length||m.forEach(t=>{e.push(n.createElement(y.bX,{key:`${t.id}-separator`}),n.createElement(y.c$,{key:`${t.id}-header`,label:h(t)})),t.data.forEach(t=>{t.type===I.TE.Object&&t.objectProperties?e.push(n.createElement(v.A,{key:t.id,"data-qa":getMenuItemDataQa(t),label:g(t),renderSubmenu:f(t)})):e.push(p(t))})}),e},[m,h,g,f,p]),N=_.length>0,O=(0,n.useMemo)(()=>N?o:c,[o,c,N]),F=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,n.createElement(C.Pd,null,n.createElement(E._,null),n.createElement("span",{className:M().menuTriggerText},O)),n.createElement("div",null,N?s:d)),[O,N,s,d]);return n.createElement(x.AM,{isOpen:!0,position:"bottom-left",targetBounds:i,allowanceX:10,allowanceY:10,offsetY:5,onClose:l},n.createElement(y.Ay,{width:400},n.createElement(y.c$,{label:F}),_))};PlaceholderVariablePopover.displayName="PlaceholderVariablePopover";var O=a(0x13f7d86f3),F=a(0x242c34757),D=a(0x162b19a86),P=a(0x1ba35eb3b),R=a(0x1db69cda),B=a(0x668181b3),W=a(0x1ebe91b72),V=a(0x10a716a94),H=a(0x1b77d8ef3),q=a(0x15bc54ead),U=a(0x2c5a5afa),z=a(0x1f9888e24),j=a(0x1d45db25c),G=a(0x1a4072e61),$=a(0x1cd3157a9),K=a(0x13f30d329),Y=a(0x1242da2eb),Q=a(0x86e5e8cf),Z=a(0x1c91944c9),J=a(0x9b971e7e),X=a(0x8921b4af),ee=a(0x7854dbfe);let et=(0,a(0x11c82607b).Ay)("Message to contents string",(e,t,{text:a,tsfMode:n="EDIT",workflowTokens:r=[]})=>{let l=t();return(0,ee.A)(l,{text:a,tsfMode:n,workflowTokens:r})});et.meta={name:"messageToContentsString",key:"createThunkMessageToContentsString",description:"Message to contents string"};var ea=a(0x852588ab),en=a(0x24429189c),er=a(0x1461e71d1),el=a.n(er);let ei=new m.Ay("workflow_builder"),eo=["canvas_update_content","canvas_create","channel_canvas_create"],es=class extends n.PureComponent{static defaultProps={enableEmoji:!0,errorText:null,initialText:"",initialBlocks:[],enableDynamicData:!1,onBlur:null,onEnter:null,shouldAddNewLineOnEnter:!0,isDisabled:!1,focusOnMount:!1,useBlocks:!1,useLimitedBlocks:!1,formatVariableBeforeInsert:null,canInsertAllVariablesByGroup:!1,experimentUserAuthoredWorkflowPostsFeGroupOn:!1,sendAsUserValue:!1,wfbAiPromptButtons:null};texty;constructor(e){super(e);const{useBlocks:t,useLimitedBlocks:a,initialText:n="",initialBlocks:r=[],data:l,convertTextToContentsObject:s,convertBlocksToDelta:c,prepareMessage:d}=this.props;let u=null;if((t||a)&&!(0,i.A)(r)){const{processedDelta:e}=d({delta:(0,h.G)(r,l.list,c)});u={contents:e}}else u=s({text:n,workflowTokens:l.list});this.state={initialContentsObject:u,hasMissingData:this.checkForMissingData(n),activeTokenData:null,activeTokenVariableData:null,activeTokenIndex:null,activeTokenElement:null,showCustomizeDataPopover:!1},this.onEnter=this.onEnter.bind(this),this.insertDynamicData=this.insertDynamicData.bind(this),this.updateDynamicData=this.updateDynamicData.bind(this),this.onTextChange=this.onTextChange.bind(this),this.onWorkflowTokenClick=this.onWorkflowTokenClick.bind(this),this.hideCustomizeDataPopover=this.hideCustomizeDataPopover.bind(this),this.setTextyRef=this.setTextyRef.bind(this),this.renderErrorBoundary=this.renderErrorBoundary.bind(this),this.getBroadcastKeywords=this.getBroadcastKeywords.bind(this),this.onGroupInsertClick=this.onGroupInsertClick.bind(this),this.customDataFilter=this.customDataFilter.bind(this),this.richTextCustomDataFilter=this.richTextCustomDataFilter.bind(this),this.stringCustomDataFilter=this.stringCustomDataFilter.bind(this),this.handleOnSelectVariable=this.handleOnSelectVariable.bind(this),this.renderWorkflowBuilderEditLinkInput=this.renderWorkflowBuilderEditLinkInput.bind(this),this.renderUrlWithWorkflowBuilderVariable=this.renderUrlWithWorkflowBuilderVariable.bind(this),this.getCursorBlockType=this.getCursorBlockType.bind(this),this.debouncedTextChange=(0,o.A)(this.debouncedTextChange.bind(this),150,{leading:!0}),this.debouncedEnterPressed=(0,o.A)(this.debouncedEnterPressed.bind(this),150,{leading:!0})}componentDidMount(){let{data:e,callbackId:t,initialText:a,initialBlocks:n}=this.props;if(e.groups.length>0){let{id:r,subtype:l}=e.groups[e.groups.length-1],i=!a&&n?.length===0;l===I.oW.OpenForm&&t===I.oW.SendMessage&&i&&this.onGroupInsertClick(r)}}componentDidUpdate(e){if(this.props.sendAsUserValue!==e.sendAsUserValue&&this.props.experimentUserAuthoredWorkflowPostsFeGroupOn){let e,{texty:t}=this,{useBlocks:a,useLimitedBlocks:n,useExpandedRichText:r,cleanMessageText:l,convertTextToContentsObject:i,convertBlocksToDelta:o,convertDeltaToBlocks:s,data:c}=this.props,u=null,m=l({text:t.value(),isInternalMessage:!1});a||n?(e=s({delta:new(d())(this.texty.getContents().contents),useExpandedRichText:r}).blocks,u={contents:(0,h.G)(e,c.list,o)}):u=i({text:m,workflowTokens:c.list}),t.setContents(u);let p=(0,S.j2)(t.value(),c.list);this.setState(()=>({hasMissingData:p}))}}onEnter(e={}){let{shouldAddNewLineOnEnter:t}=this.props;return!0!==e.metaKey&&(!!t||!0===e.shiftKey||(this.debouncedEnterPressed(),!1))}onTextChange(){this.texty&&this.debouncedTextChange()}onWorkflowTokenClick({token:e,element:t,index:a}){let{data:n}=this.props,r=(0,B.x)(n.list,e.id);if(!r){e.isPlaceholder&&this.setState(()=>({activeTokenIndex:a,activeTokenData:e,activeTokenVariableData:null,activeTokenElement:t,showCustomizeDataPopover:!0}));return}let l=(0,S.Jq)(r);this.setState(()=>({activeTokenIndex:a,activeTokenData:e,activeTokenVariableData:l,activeTokenElement:t,showCustomizeDataPopover:!0}))}getBroadcastKeywords(){return(0,j.A)()}setTextyRef(e){this.texty=e,this.onTextChange()}checkForMissingData(e){let{data:t}=this.props;return(0,S.ke)(e,t.list)}debouncedEnterPressed(){let{useBlocks:e,useLimitedBlocks:t,useExpandedRichText:a,onEnter:n,convertDeltaToBlocks:r,cleanMessageText:l,prepareMessage:i}=this.props;if(!this.texty||!n)return;let o=null,s=this.texty.value();if(e||t){let{processedDelta:e}=i({delta:new(d())(this.texty.getContents().contents)});o=r({delta:e,useExpandedRichText:a}).blocks}n({blocks:o,text:l({text:s,isInternalMessage:!1})})}debouncedTextChange(){let{useBlocks:e,useLimitedBlocks:t,useExpandedRichText:a,onTextChange:n,convertDeltaToBlocks:r,cleanMessageText:l,prepareMessage:i}=this.props,o=null,s=this.texty.value();if(e||t){let{processedDelta:e}=i({delta:new(d())(this.texty.getContents().contents)});o=(e=>{if(!e)return[];let t=(0,R.A)(e),a=!1,n=t.map(e=>"rich_text"===e.type&&e.elements?{...e,elements:e.elements.reduce((e,t)=>{if("rich_text_preformatted"!==t.type||!t.elements)return e.push(t),e;let n={...t,elements:t.elements.reduce((e,t)=>{if("workflowtoken"!==t.type)return e.push(t),e;let n={...t};switch(n.data_type){case I.TE.SlackTypesRichText:n.id=`{slack.plain_text(rich_text=${n.id})}`,a=!0;break;case I.TE.SlackTypesLimitedRichText:n.id=`{slack.plain_text(limited_rich_text=${n.id})}`,a=!0;break;case I.TE.SlackTypesUserId:n.id=`{slack.user_display_name(user_id=${n.id})}`,a=!0}return n.data_type="string",e.push(n),e},[])};return e.push(n),e},[])}:e);return a?n:e})(o=r({delta:e,useExpandedRichText:a}).blocks)}let c=this.checkForMissingData(s);this.setState(()=>({hasMissingData:c})),n({text:l({text:s,isInternalMessage:!1}),blocks:o})}hideCustomizeDataPopover(){let e=this.state.activeTokenIndex;this.setState(()=>({activeTokenIndex:null,activeTokenData:null,activeTokenElement:null,showCustomizeDataPopover:!1}));let{quill:t}=this.texty.instance;t.setSelection(e)}getCursorBlockType(){let{quill:e}=this.texty.instance,{index:t}=e.getSelection(!0),a=e.getContents(t);for(let e of a?.ops??[]){if(e.attributes?.["code-block"])return"code-block";if(e.attributes?.blockquote)return"blockquote";if(e.attributes?.list==="ordered")return"ordered";if(e.attributes?.list==="bullet")return"bullet"}return null}insertDynamicData({variable:e,idx:t=0,insertAll:a,currentBlockType:n}){let{formatVariableBeforeInsert:r,interceptVariablesInsertion:l}=this.props;if(!a&&l&&0===l([e]).length)return;let{quill:i}=this.texty.instance,{index:o,length:s}=i.getSelection(!0),c=new(d())().retain(o);s>0&&i.deleteText(o,s,"user");let u=r?.(e,{isRichText:!0})??e;a&&e.prependLabel&&c.insert(`${e.prependLabel}
`,{bold:!0});let m=(0,S.Jq)(u);if(c.insert({workflowtoken:{id:m.id,type:(0,$.Z)(m.id,u.type),label:m.label,sourceLabel:m.sourceLabel,isAvailable:m.isAvailable,variableData:m}},{bold:!1}),a)switch(n){case"ordered":case"bullet":c.retain(1,{list:n}).insert(`
`);break;case"blockquote":case"code-block":c.retain(1,{[n]:!0}).insert(`
`);break;default:c.insert(`
`)}i.updateContents(c),i.setSelection(c.length()),u.type===I.TE.SlackTypesRichText||u.type===I.TE.SlackTypesLimitedRichText||u.type===I.TE.SlackTypesExpandedRichText?i.setSelection({index:i.getLength(),length:0}):0!==t&&c.insert(`
`)}customDataFilter(e,t){let{callbackId:a}=this.props;return!("message_link"===t.name&&a&&eo.includes(a))&&(e?(0,P.SA)(t,a)||(0,P.xY)({variable:t,parameter:{type:I.TE.SlackTypesRichText,name:"rich_text_input"}}):(0,P.qO)(t,a)||(0,P.xY)({variable:t,parameter:{type:I.TE.String,name:"plain_text_input"}}))}richTextCustomDataFilter(e){return this.customDataFilter(!0,e)}stringCustomDataFilter(e){return this.customDataFilter(!1,e)}onGroupInsertClick(e,t){let{data:a,interceptVariablesInsertion:n}=this.props,r=a.groups.find(t=>t.id===e),l=r?.data.filter(this.richTextCustomDataFilter),{quill:i}=this.texty.instance,{index:o,length:s}=i.getSelection(!0);s>0&&i.deleteText(o,s,"user");let c=l;n&&l&&(c=n(l));let d=c&&r?.subtype===I.oW.OpenForm;d&&t?c=c?.filter(e=>!(0,Q.q)(e.id)):d&&(c=c?.filter(e=>!!(0,Q.q)(e.id)));let u=this.getCursorBlockType();c?.forEach((e,t)=>{e.type===I.TE.Object?e.objectProperties?.filter(this.richTextCustomDataFilter).forEach((e,t)=>this.insertDynamicData({variable:e,idx:t,insertAll:!0,currentBlockType:u})):this.insertDynamicData({variable:e,idx:t,insertAll:!0,currentBlockType:u})})}updateDynamicData({dataItem:e,property:t,propertyUpdated:a}){let n,{texty:r}=this,{quill:l}=r.instance,{activeTokenIndex:i}=this.state,{useBlocks:o,useLimitedBlocks:s,useExpandedRichText:c,cleanMessageText:u,convertTextToContentsObject:m,convertBlocksToDelta:p,convertDeltaToBlocks:b,data:f,onTextChange:g}=this.props;a&&(l.deleteText(i,1,"user"),l.insertEmbed(i,"workflowtoken",{id:e.id,type:e.type,label:e.label,sourceLabel:e.sourceLabel,isAvailable:e.isAvailable,property:t,variableData:e},"user"));let _=null,y=u({text:r.value(),isInternalMessage:!1});o||s?(n=b({delta:new(d())(this.texty.getContents().contents),useExpandedRichText:c}).blocks,_={contents:(0,h.G)(n,f.list,p)}):_=m({text:y,workflowTokens:f.list}),r.setContents(_),null!==i&&r.instance.setSelection(i+1,0,"silent"),g({text:y,blocks:n}),this.hideCustomizeDataPopover()}handleOnSelectVariable(e){return this.insertDynamicData({variable:e})}renderErrorBoundary(){return n.createElement("div",null,n.createElement(f.A,null,ei.t("Something went wrong")))}renderWorkflowBuilderEditLinkInput({id:e,onChange:t,url:a="",ariaLabel:r,focusUrlOnMount:l}){let{data:i,enableDynamicData:o=!0,formatVariableBeforeInsert:c,onVariableMenuOpen:d}=this.props;return n.createElement(b.A,{text:ei.t("Link",{fallbackHash:"d0517071aa376e797705058bbad4b658954b9930",fallbackHashNs:"message-input"}),htmlFor:"composer-link-modal-url",id:e,className:"p-composer_edit_link_popover__builder_texty","data-qa":"composer-link-modal-label"},n.createElement(F.A,{id:e,initialText:String(a),variables:i,allowVariables:o,ariaLabel:r,shouldAddNewLineOnEnter:!1,onTextChange:({text:e})=>{t("url",(0,D.cY)(e))},formatVariableBeforeInsert:(e,t)=>{if(e.type===z.W.SlackTypesRichText||e.type===z.W.SlackTypesLimitedRichText){let t=e.type===z.W.SlackTypesLimitedRichText;return{...e,id:`{slack.plain_text(${t?"limited_":""}rich_text=${e.id})}`}}return c?.(e,t)??e},onBlur:s.A,customDataFilter:this.stringCustomDataFilter,renderDataMenuLocation:"inline",onVariableMenuOpen:d,focusOnMount:l}))}renderUrlWithWorkflowBuilderVariable(e){let{data:t}=this.props,a=(0,G.t)([(0,W.Mx)(),(0,W.cL)(),(0,W.fE)()],"gi"),r=(e||"").match(a);if(null===r)return e||null;let{result:l}=r.reduce((e,t,a)=>{let[n,l]=(e.url||"").split(t);return e.url=l,n&&e.result.push(n),e.result.push(t),a===r.length-1&&e.url&&e.result.push(e.url),e},{url:e,result:[]});function renderLinkElement(e,r){if(e.match(a)){let a=t.list,[l]=(0,K.A)(e,a)?.contents||[],i=(0,Y.Ay)(l)&&l.insert.workflowtoken.variableData,o=i&&(0,O.L4)(i)?i.label:ei.t("Missing Data");return n.createElement("span",{className:el().variable_container,key:r},n.createElement(g.Ah,{inline:!0,name:"css"})," ",o)}return n.createElement("span",{key:r},e)}return renderLinkElement.displayName="renderLinkElement",n.createElement(n.Fragment,null,l.map((e,t)=>renderLinkElement(e,t)))}render(){let{initialContentsObject:e,hasMissingData:t,showCustomizeDataPopover:a,activeTokenData:r,activeTokenVariableData:i,activeTokenElement:o}=this.state,{enableDynamicData:s,enableEmoji:c,data:d,errorText:u,isDisabled:m,isSingleLine:b,focusOnMount:g,teamId:h,useBlocks:y,useLimitedBlocks:x,canInsertAllVariablesByGroup:v,callbackId:E,hint:k,getVariableCustomizeMenu:w,onVariableMenuOpen:C,useExpandedRichText:A,wfbAiPromptButtons:T,excludePrivateChannelAutocomplete:I,privateChannelTeamIds:N,...M}=this.props;T&&(T.insertVariableButton=n.createElement(_.jx,{key:"dynamic-data-menu",onGroupInsertClick:this.onGroupInsertClick,onSelect:this.handleOnSelectVariable,data:d.groups,canInsertAllVariablesByGroup:v,customDataFilter:this.richTextCustomDataFilter,onMenuTriggerClick:C,renderIconInside:!0,iconSize:"18",className:el().inputToolbarVariablesButton}));let L=t||u&&u.length>0,O=ei.t("There is a missing data reference."),F=(0,S.hM)(d.groups).length>0,D=`${M.id}_errorMessage`,P=n.createElement(U.A,{...M,includeAllBroadcastKeywords:!0,ariaDescribedBy:D,ariaInvalid:!!L,completeOnMembers:!0,completeOnChannels:!b,completeOnEmoji:!0,position:"bottom",forcePlainTextModeDisabled:y||x,focusOnMount:g,enableBroadcastKeywords:!0,maxLines:b?1:8,initialText:e||void 0,isSingleLine:b,workflowTokens:d.list,ref:this.setTextyRef,onTextChange:this.onTextChange,isDisabled:m,onEnter:this.onEnter,useWysiwyg:y||x,useWorkflowTokens:!0,useExpandedRichText:!b&&A,workflowTokenClick:this.onWorkflowTokenClick,getBroadcastKeywords:this.getBroadcastKeywords,"data-qa":"builder-texty__input",renderWorkflowBuilderEditLinkInput:this.renderWorkflowBuilderEditLinkInput,renderUrlWithWorkflowBuilderVariable:this.renderUrlWithWorkflowBuilderVariable,disableSlugging:!0,excludePrivateChannelAutocomplete:I,privateChannelTeamIds:N});P=c?n.createElement(q.A,{className:l()("normal",{margin_bottom_150:!F}),enableEmojiButton:!m,enableComposerButton:!m&&y,isDisabled:m,isInvalid:!!L,numMaxLines:b?1:8,numMinLines:b?1:void 0,forcePlainTextModeDisabled:y||x,withWorkflowTokens:!0,useExpandedRichText:A,withBasicContainerBorder:!0,forceToolbarDisabled:!y||x,renderWorkflowBuilderEditLinkInput:this.renderWorkflowBuilderEditLinkInput,wfbAiPromptButtons:T},P):n.createElement(H.A,{className:l()("normal",{margin_bottom_150:!F}),isDisabled:m,isInvalid:!!L},P);let handlePlaceholderReplace=e=>{this.updateDynamicData({dataItem:(0,S.Jq)(e),propertyUpdated:!0})},maybeRenderCustomizeMenu=()=>!m&&a&&r&&o?r.isPlaceholder?n.createElement(PlaceholderVariablePopover,{onSelect:handlePlaceholderReplace,data:d.groups,customDataFilter:this.richTextCustomDataFilter,tetherElement:o,onClose:this.hideCustomizeDataPopover}):i?w({activeTokenElement:o,activeTokenData:r,activeTokenVariableData:i,hideCustomizeDataPopover:this.hideCustomizeDataPopover,updateDynamicData:this.updateDynamicData}):null:null;maybeRenderCustomizeMenu.displayName="maybeRenderCustomizeMenu";let maybeRenderFiles=()=>this.props.renderFiles?this.props.renderFiles():null;return n.createElement(V.A,{subtype:"builder_texty",renderError:this.renderErrorBoundary},P,maybeRenderFiles(),k&&n.createElement(p.A,{className:"margin_bottom_0"},k),n.createElement("div",{className:"display_flex justify_content_between position_relative"},n.createElement("div",null,L&&n.createElement(f.A,{id:D,className:"margin_bottom_0"},t?O:u)),s&&!m&&!T?.insertVariableButton&&F&&n.createElement("div",{className:"margin_top_50"},n.createElement(_.jx,{onGroupInsertClick:this.onGroupInsertClick,onSelect:this.handleOnSelectVariable,data:d.groups,canInsertAllVariablesByGroup:v,customDataFilter:this.richTextCustomDataFilter,onMenuTriggerClick:C})),maybeRenderCustomizeMenu()))}};es.displayName="_BuilderTexty";let ec={convertDeltaToBlocks:en.y,convertBlocksToDelta:en.f,convertTextToContentsObject:et,cleanMessageText:X.T,prepareMessage:ea.n},ed=(0,Z.N)(e=>({teamId:(0,J.ZT)(e)}),ec)((0,u.A)(es))},0x1c2ea7265:(e,t,a)=>{"use strict";a.d(t,{G:()=>convertBlocksToDeltaWithMergedMetadata,Q:()=>getVariableSourceIdsInBlock});var n=a(0x125763ad),r=a(0x88881d67),l=a(0x668181b3),i=a(0x1242da2eb);function convertBlocksToDeltaWithMergedMetadata(e,t,a){let o=a({blocks:e});return o.ops=o.ops.map(e=>{if((0,i.Ay)(e)){let a=e.insert.workflowtoken,i=(0,l.x)(t,a.id);if(!i){let t=a.isPlaceholder?(0,r.sx)({id:a.id,placeholderLabel:a.label,sourceLabel:a.sourceLabel}):(0,r.Mu)({id:a.id,type:a.type,sourceLabel:a.sourceLabel});return(0,n.A)({},e,{insert:{workflowtoken:t}})}let o=(0,r.Jq)(i);return(0,n.A)({},e,{insert:{workflowtoken:{...a,variableData:o}}})}return e}),o}function getVariableSourceIdsInBlock(e,t,a){return a({blocks:e}).ops.filter(e=>(0,i.Ay)(e)).map(e=>{if((0,i.Ay)(e)){let a=e.insert.workflowtoken,n=(0,l.x)(t,a?.id);return n?n.source_id:""}return""})}},0x1576dac7:(e,t,a)=>{"use strict";a.d(t,{I:()=>DynamicDataCustomizeMenuV2});var n=a(0xbad225b5),r=a(0x21f3c49e8),l=a(0x1cbdfeceb),i=a(0x1b63e435a),o=a.n(i),s=a(0x20482ad21),c=a(0x99233ecb),d=a(0x133aaa7da),u=a(0x6aeae8a3),m=a(0x1a3c2e1af),p=a(0x91728dda),b=a(0x88881d67),f=a(0x3b26a95e),g=a(0x21c50a68b),h=a(0x145d46a61),_=a(0x1795d8821),y=a(0x223ac29bb),x=a(0x1cd3157a9),v=a(0x161a994e6),E=a(0x192814923),k=a(0x158cf1cb),w=a(0x1840248cf),S=a(0x25054cb9f),C=a(0x2241421be),A=a(0x1ccef1c6f),T=a(0x226892387),I=a(0x1de687e0f),N=a.n(I);let M=new s.Ay("workflow_builder"),L=new Set([_.Zk.AddSpreadsheetRow,_.Zk.DeleteSpreadsheetRow,_.Zk.UpdateSpreadsheetRow,_.Zk.SelectSpreadsheetRow]),O=["utcDate","utcFull","utcCompact","utcCompactMinuteAccuracy","localDate","localFull","localCompact","localCompactMinuteAccuracy"],F=[...O,"localSortableDate","dateTimeLocal","internationalDateLocal","canvasDate"],DynamicDataCustomizeMenuV2=({tetherElement:e,onClose:t,tokenData:a,variableData:i,updateDynamicData:s,fromRichText:_,callbackId:I})=>{let[D,P]=(0,n.useState)(a.id),R=(0,f.A)(e?.lastElementChild??e),B=(0,T.d4)(h.tQ),W=(0,T.d4)(p.R5),V=(0,T.d4)(e=>(0,A.ty)(e,"tz")),H=V&&o().tz(V).zoneAbbr(),q=(0,g.JK)(),U=(0,y.Dh)();Object.entries(U).forEach(([e,t])=>{U[e.toLowerCase()]=t});let z=U[q],j=(0,n.useMemo)(()=>(0,C.KC)(D),[D]),G=(0,n.useCallback)(({id:e,type:t})=>()=>{s({dataItem:{...i,id:e,type:t},propertyUpdated:!0}),P(e)},[s,i]),$=(0,n.useCallback)(({formatPreview:e,myLocaleLabel:t,myTimezoneAbbr:a,savedLocale:r,savedTimezoneAbbr:l,wrappedId:o})=>()=>{let s=(0,x.Z)(o,i.type),d=M.t("Update to match my Slack settings:"),u=M.t("Update to match my Slack language,"),m=l?d:u,p=l?`${a}, `:"",b=M.t("Format:"),f=M.t("Timezone:"),g=M.t("Language:");return n.createElement(c.Ay,null,n.createElement(c.c$,{label:n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement("span",{className:"bold"},b)," ",e),l&&n.createElement("div",null,n.createElement("span",{className:"bold"},f)," ",l),r&&n.createElement("div",null,n.createElement("span",{className:"bold"},g," "),U[r]))}),n.createElement(c.bX,{key:"change-localization-separator"}),n.createElement(c.Dr,{key:"change-timezone-and-language",label:`${m} ${p}${t}`,onSelected:G({id:o,type:s})}))},[U,G,i]),K=M.t("Select another format"),Y=M.t("Unknown format"),Q=(0,n.useMemo)(()=>(0,S.zz)({callbackId:I,fromRichText:_,type:i.type,arrayItemType:i.items?.type,variableId:D,supplementalType:i.supplementalType,isCanvasLiveDataFieldsTemplatesEnabled:W}),[I,D,_,i.items?.type,i.type,i.supplementalType,W]),Z=(0,n.useMemo)(()=>(0,E.z)(a,i),[a,i]),J=(0,n.useMemo)(()=>Q&&!(0,r.A)(Q)&&!Object.values(Q).every(e=>e.shouldHideFromUi?.({})||e.isDeprecated?.({})),[Q]),X=(0,n.useMemo)(()=>{let t=(0,w.z)(D);if(!J)return n.createElement(c.Dr,{label:M.t("Update this variable"),onSelected:G({id:t,type:i.type}),type:d.A.radio});let a=!1,r=Object.entries(Q??{}).map(([r,{getLabel:s,getExample:u,isDeprecated:p,shouldHideFromUi:f,wrapWithMacro:g}])=>{let h,y,E={fromRichText:_,callbackId:I},k=F.includes(r),w=O.includes(r);k&&(E.timezone=y=(0,S.C8)(D)),w&&(E.locale=h=(0,S.CE)(D));let A=g(t,E);j?.length&&(A=(0,C.uE)(A,j));let T=Z&&D===A;if(T&&(a=!0),"qualified_emoji"===r&&!L.has(I))return null;(k||w)&&(A=g(t,{fromRichText:_,callbackId:I,locale:q,timezone:V}));let N=(0,x.Z)(A,i.type);if((0,b.Sg)(e)&&("string"!==N||"emoji"===r))return null;let M={timezone:T&&k?y:V,locale:T&&w?h:q,experimentWfbBackToBasicsEclairReleaseGroupOn:B},P=!!p?.(M),R=s(M);return!P&&T&&(y&&y!==V||h&&h!==q)?n.createElement(m.A,{key:R,label:R,renderSubmenu:$({formatPreview:u(M),myLocale:q,myLocaleLabel:z,myTimezoneAbbr:H,savedLocale:h,savedTimezoneAbbr:y&&((0,v.o)(y)?y:o().tz(y).zoneAbbr()),wrappedId:A}),type:d.A.radio,checked:!0}):P&&!T||f?.(M)?null:n.createElement(c.Dr,{key:R,label:R,shortcut:u(M),onSelected:P?l.A:G({id:A,type:N}),type:d.A.radio,checked:T})}).filter(e=>null!==e);return D&&!a&&r.unshift(n.createElement(c.Dr,{key:"unknown_option",label:Y,shortcut:K,onSelected:l.A,type:d.A.radio,checked:!0})),r},[D,j,J,Q,G,i.type,_,I,Z,e,V,q,K,$,z,H,Y,B]);if(null===X||Array.isArray(X)&&0===X.length)return null;let ee=!J&&!Z,et=M.t("Select variable display option"),ea=k.pn[i.type]?.()??et,en="slack#/types/timestamp"===i.type?n.createElement(n.Fragment,null,n.createElement("div",{className:"bold"},ea),H&&n.createElement("div",null,`${M.t("Local options use your timezone,")} ${H}`)):ea;return n.createElement(u.AM,{isOpen:!0,position:"bottom-left",targetBounds:R,allowanceX:10,allowanceY:10,offsetY:5,onClose:t},n.createElement("div",{className:N().dynamic_data_display_options_container},n.createElement(c.Ay,null,!ee&&n.createElement(c.c$,{label:en}),X)))};DynamicDataCustomizeMenuV2.displayName="DynamicDataCustomizeMenuV2"},0x235d78b7c:(e,t,a)=>{"use strict";a.d(t,{jx:()=>DynamicDataMenu});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1cbdfeceb),o=a(0x9e671ad),s=a(0x20482ad21),c=a(0x210cf696f),d=a(0x99233ecb),u=a(0x2ab73abf),m=a(0x1a3c2e1af),p=a(0x2501a2cee),b=a(0x4c96e5d9),f=a(0x222a04717),g=a(0x1c9338be7),h=a(0x1a6afe63b),_=a(0x88881d67),y=a(0xe9c32bb),x=a(0x1e1fc678),v=a(0x668181b3),E=a(0x1ebe91b72),k=a(0x145d46a61),w=a(0x1795d8821),S=a(0x226892387),C=a(0x133096d9b),A=a.n(C);let T=new s.Ay("workflow_builder"),I=["external","service"],getMenuItemDataQa=({source:e,name:t})=>`${e}-${t}`,getGroupMenuItemDataQa=({id:e},t)=>t?`${e}_function_outputs`:e,DynamicDataMenu=({data:e,onSelect:t,canInsertAllVariablesByGroup:a,onGroupInsertClick:r=i.A,renderIconInside:s=!1,renderIconInline:C=!1,customDataFilter:N,isDisabled:M=!1,onMenuTriggerClick:L,inputType:O,allowEmptyState:F,hasDependentField:D,className:P,suggestedVariableConfig:R={enable:!1},value:B,iconSize:W="20"})=>{let V=(0,S.d4)(k.sQ),H=O===w.TE.SlackTypesSalesforceRecordId,q=T.t("Suggested variables"),U=T.t("Insert a variable"),z=T.t("Variables allow you to insert data from previous steps into your workflow."),j=T.t("This field dynamically populates additional fields based on your choice, so variables are not available."),G=D?T.t("Variables not allowed"):T.t("No variables available"),$=(0,h.D)(O),K=D?j:$,[Y,Q]=(0,n.useState)(!1),Z=(0,n.useCallback)(()=>{Q(!0)},[]),J=(0,n.useCallback)(()=>{Q(!1),L()},[L]),X=(0,n.useCallback)(()=>n.createElement(n.Fragment,{key:"see-all-variables-fragment"},n.createElement(d.bX,{key:"see-all-variables-separator"}),n.createElement(d.Dr,{key:"see-all-variables",label:T.t("See all variables"),link:!0,onSelected:Z})),[Z]),ee=(0,n.useCallback)(e=>()=>{H?(t(e),(0,u.K7)()):t(e)},[H,t]),et=(0,n.useCallback)((e,t)=>()=>r(e,t),[r]),ea=(0,n.useMemo)(()=>({...R,type:R?.type??O}),[O,R]),en=(0,_.PW)(e,N),er=(0,_.k4)(en,ea),el=(0,n.useMemo)(()=>(Array.isArray(B)?B:[B]).some(e=>{if("string"!=typeof e)return!1;let t=e.match((0,E.cL)());return t?.some(e=>{let t=!!(0,v.x)(en.flatMap(e=>e.data),e),a=!!(0,v.x)(er.flatMap(e=>e.data),e);return t&&!a})}),[en,er,B]),ei=(0,n.useMemo)(()=>!el&&!Y&&!(0,o.A)(en,er)&&!(er.length<1),[Y,en,el,er]),eo=(0,n.useCallback)((e,t)=>n.createElement(d.Dr,{key:e.id,onSelected:ee(e),label:n.createElement("div",{className:A().menuItem,"data-qa":getMenuItemDataQa(e)},n.createElement("div",null,n.createElement(y.nB,{element:"span"},n.createElement(g.P,{data:e,isObjectPropertySubmenuItem:t}),V&&e.disabledReason&&n.createElement(y.HL,{element:"span"}," (",e.disabledReason,")")))),disabled:e.isDisabled}),[ee,V]),es=(0,n.useCallback)((e,t)=>{let a="function"!==e.type||e.subtype!==w.oW.OpenForm||t?T.t("Insert all data"):T.t("Insert all form responses");return n.createElement("div",{className:A().menuItem,"data-qa":getGroupMenuItemDataQa(e,t)},n.createElement(y.nB,{element:"span"},n.createElement("span",null,a)))},[]),ec=(0,n.useCallback)((e,t)=>n.createElement(d.Dr,{key:getGroupMenuItemDataQa(e,t),onSelected:et(e.id,t),label:es(e,t)}),[et,es]),ed=(0,n.useCallback)(e=>n.createElement(y.HL,null," ",e," "),[]),eu=(0,n.useCallback)(e=>t=>e.objectProperties?n.createElement(d.Ay,t,n.createElement(d.c$,{label:ed(e.label)}),n.createElement(d.bX,{key:`${e.id}-separator`}),e.objectProperties.map(e=>eo(e,!0))):null,[ed,eo]),em=(0,n.useCallback)(e=>n.createElement(y.nB,{element:"span"},n.createElement(g.P,{data:e})),[]),ep=(0,n.useCallback)(e=>n.createElement(y.HL,{className:A().groupHeaderLabel},e.stepIndex&&`${e.stepIndex}. `,(0,x.k)(e.type)?(0,x.T)(e.type,e.label,e.subtype):e.label),[]),eb=(0,n.useMemo)(()=>{let e=[];return 0===en.length||((H&&ei?er:en).forEach(t=>{e.push(n.createElement(d.bX,{key:`${t.id}-separator`}),n.createElement(d.c$,{key:`${t.id}-header`,label:ep(t)}));let r="function"===t.type&&t.subtype===w.oW.OpenForm,l=!1,i=r?t.data.filter(({id:e})=>!!e.includes(".fields.")).length:0,o=(i||t.data.length)>=3;a&&o&&!I.includes(t.type)&&e.push(ec(t));let s=t.data.some(e=>e.id.includes(".fields."));t.data.forEach(o=>{if(o.type===w.TE.Object&&o.objectProperties)e.push(n.createElement(m.A,{key:o.id,"data-qa":getMenuItemDataQa(o),label:em(o),renderSubmenu:eu(o)}));else{if(r&&!l&&!o.id.includes(".fields.")){s&&e.push(n.createElement("div",{className:A().variableTypeSeparator,key:`${t.id}-separator-nonfield-container`},n.createElement(d.bX,{key:`${t.id}-separator-nonfield`})));let r=t.data.length-i;a&&r>=3&&!I.includes(t.type)&&e.push(ec(t,!0)),l=!0}e.push(eo(o))}})}),ei&&H&&e.push(X())),e},[en,H,ei,er,ep,a,ec,em,eu,eo,X]),ef=eb.length>0&&!D,eg=(0,n.useMemo)(()=>H?ef?ei?q:U:G:ef?U:G,[H,ei,U,G,ef,q]),eh=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,n.createElement(y.Pd,null,n.createElement(f._,null),n.createElement("span",{className:A().menuTriggerText},eg)),n.createElement("div",null,ef?z:K)),[eg,ef,z,K]),e_=(0,n.useCallback)(e=>n.createElement("div",{className:A().variablesMenuContainer},n.createElement(d.Ay,{...e,"data-qa":"variables-dropdown-menu"},n.createElement(d.c$,{label:eh}),ef?eb:[])),[eh,ef,eb]);return ef||F?n.createElement(d.cQ,{renderMenu:e_,position:"bottom-right",offsetX:0,onClick:J,isDisabled:M,closeOnSelect:!H},n.createElement(b.Ay,{tip:U,position:"top",offsetY:-7,delay:500,zIndex:"above_fs"},n.createElement(c.A,{className:l()(P,{[A().menuTriggerButtonIconOnly]:s,[A().menuTriggerButton]:!s,[A().menuTriggerButtonDisable]:!ef}),"aria-label":U,"data-qa":"variables-dropdown-trigger"},n.createElement(p.Ah,{name:"css",size:s||C?W:void 0,inline:!0}),s||C?null:n.createElement("span",{className:A().menuTriggerText},U)))):null};DynamicDataMenu.displayName="DynamicDataMenu"},0x380ee7b0:(e,t,a)=>{"use strict";a.d(t,{P:()=>VariableSelect});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x20482ad21),o=a(0x15dd8a31),s=a(0x6b359530),c=a(0x88881d67),d=a(0x1c09d8c36),u=a(0x668181b3),m=a(0x2772625d),p=a(0x1d62f3e69),b=a(0x1795d8821),f=a(0xebf2b1aa),g=a.n(f);let h=new i.Ay("workflow_builder"),VariableSelect=({onChange:e,variables:t,value:a,customDataFilter:r,label:i,isDisabled:f=!1,formatVariableBeforeInsert:_,parameterType:y})=>{let x=(0,n.useMemo)(()=>(0,c.PW)(t.groups,r).reduce((e,t)=>{let a=t.data.reduce((e,t)=>(e.push({value:t.id,label:t.label,data:t}),e),[]),n=t.label;return t.stepIndex&&(n=`${t.stepIndex}. ${n}`),e.push({label:n,options:a,type:"group"}),e},[]),[t,r]),v=(0,n.useMemo)(()=>{if(!a)return null;let e=(0,u.x)(t.list,a);if(!e&&a&&(0,m.cn)(a))e=(0,p.x7)(a,b.TE.SlackTypesUserId);else if(!e)return null;return{value:e.id,label:e.label,data:e}},[t.list,a]),E=(0,n.useCallback)(()=>v?.data?.label?n.createElement(s.R,{data:v.data,size:"medium"}):v?.label,[v]),k=(0,n.useCallback)(({value:a})=>{if("string"==typeof a){let n=(0,u.x)(t.list,a);if(n&&_&&y)return void e(_(n,{parameterType:y}).id)}e(a)},[_,e,y,t.list]);return n.createElement("div",{className:l()({[g().has_errors]:v?.data?.isAvailable===!1})},n.createElement(o.A,{width:"auto",options:x,selectedOption:v,onOptionSelected:k,ariaLabel:i??h.t("Select a variable"),renderSelectedOption:E,isRequired:!1,isDisabled:f,minOptionsListWidth:d.XK}))};VariableSelect.displayName="VariableSelect"},0x1a6afe63b:(e,t,a)=>{"use strict";a.d(t,{D:()=>useEmptyStateMessage});var n=a(0x20482ad21),r=a(0x1795d8821);let l=new n.Ay("workflow_builder"),useEmptyStateMessage=e=>{switch(e){case r.TE.Boolean:return l.t("The field only allows boolean values. If boolean values are added to earlier steps, they\u2019ll appear here.");case r.TE.Integer:return l.t("The field only allows whole numbers. If whole number values are added to earlier steps, they\u2019ll appear here.");case r.TE.Number:return l.t("The field only allows numbers. If number values are added to earlier steps, they\u2019ll appear here.");case r.TE.SlackTypesDate:return l.t("The field only allows dates. If date values are added to earlier steps, they\u2019ll appear here.");case r.TE.String:return l.t("The field only allows strings. If string values are added to earlier steps, they\u2019ll appear here.");default:return l.t("No variables for this field type available. If compatible variables are added to earlier steps, they\u2019ll appear here.")}}},0x13262fc8e:(e,t,a)=>{"use strict";a.d(t,{D:()=>b});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x1d2cd7755),i=a(0x126f22530),o=a(0xf6b2f43b),s=a(0xd0fb5338),c=a(0xabd92c55),d=a(0x1d1437423),u=a(0x226892387),m=a(0x14149c126);let p=new r.Ay("workflow_builder"),b=(0,n.memo)(({segment:e,onChange:t})=>{let a="on"===(0,u.d4)(e=>(0,m._Z)(e,"wfb_open_form_ui_improvements")),r=(0,o.u)(),b=(0,s.F$)(e),f=(0,s.$o)(e),g=p.t("The form title can\u2019t have more than {maxCharacterLimit, plural, =1 {# character} other {# characters}}.",{maxCharacterLimit:f}),h=p.t("Please add a title for this form."),_=(0,n.useMemo)(()=>(0,c.N8)({dialogTitle:b,maxLength:f}),[b,f]),y=(0,n.useMemo)(()=>_||0!==b.length?g:h,[_,b,g,h]),{onChange:x,errorText:v,okayToDisplay:E}=(0,d.x)({errorMessage:y,isErrored:!_,shouldErrorPreventSave:!0}),k=(0,n.useCallback)(e=>(x(),t(e)),[t,x]);return n.createElement(l.A,{htmlFor:"dialog-title",text:a?p.t("Form title"):p.t("Title"),className:"margin_bottom_125"},n.createElement(i.A,{id:"dialog-title",value:b,onChange:k,name:"dialog-title",maxCharacterLimit:f,emojisShouldCountAsSingleCharacter:!0,placeholder:p.t("Ex: Request Form"),errorText:v,showError:E,isRequired:!0,isDisabled:r,autoComplete:"off",spellCheck:!0,"data-qa":"dialog-title__input",useInlineAlert:!0,className:"margin_bottom_0"}))})},0x1c0b91ebb:(e,t,a)=>{"use strict";a.d(t,{v:()=>getQuestionTypeLabelAndIcon});var n=a(0x20482ad21),r=a(0x38bda683);let l=new n.Ay("workflow_builder"),getQuestionTypeLabelAndIcon=e=>({[r.xi.ShortText]:{label:l.t("Short answer",{fallbackHash:"a280b11de85237c46b8552f5bbb13431e922879a"}),icon:"text"},[r.xi.LongText]:{label:l.t("Paragraph"),icon:"text-snippet"},[r.xi.RichText]:{label:l.t("Rich text composer"),icon:"text-snippet"},[r.xi.Dropdown]:{label:l.t("Dropdown"),icon:"caret-dropdown"},[r.xi.StaticMultiSelect]:{label:l.t("Multiple choice"),icon:"radio-button"},[r.xi.StaticMultiSelectWithCheckboxes]:{label:l.t("Checkboxes"),icon:"checkbox"},[r.xi.Boolean]:{label:l.t("Radio Buttons",{fallbackHash:"bcd9a86f8a8742ffb39d556d80ce1ea4b578ab19"}),icon:"radio-button"},[r.xi.File]:{label:l.t("File upload"),icon:"file-upload"},[r.xi.SelectPerson]:{label:l.t("Slack user"),icon:"user"},[r.xi.UserMultiSelect]:{label:l.t("Multiple Slack users"),icon:"user-groups"},[r.xi.SelectChannel]:{label:l.t("Slack channel"),icon:"channel"},[r.xi.ChannelMultiSelect]:{label:l.t("Multiple Slack channels"),icon:"channel"},[r.xi.Date]:{label:l.t("Date"),icon:"calendar"},[r.xi.DateTime]:{label:l.t("Date / time"),icon:"calendar"},[r.xi.Number]:{label:l.t("Number"),icon:"number"}})[e]},0x93d35cfe:(e,t,a)=>{"use strict";a.d(t,{Y:()=>MessagePreview});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x20482ad21),o=a(0x2501a2cee),s=a(0xccd97fa5),c=a(0x1b7f0cd57),d=a(0x668181b3),u=a(0x1ebe91b72),m=a(0x231441bf2),p=a(0x1795d8821),b=a(0x113cdbbd7),f=a(0x1991a9b6d),g=a(0xf1cb9c30),h=a(0x150f8d9c),_=a(0x6792c5b4),y=a(0x1bf20af7f),x=a(0xf271ff9b),v=a(0x1269e55c8),E=a(0x226892387),k=a(0x1fb2d2a87),w=a(0x73cfdc00),S=a.n(w);let C=new i.Ay("workflow_builder"),MessagePreview=({blocks:e,dataList:t,isThread:a,isPinned:r,workflowIcon:i,workflowName:w,workflowId:A,isEditor:T})=>{let I=(0,n.useMemo)(()=>({__meta__:{lastUpdatedTs:""},type:"message",ts:"0",channel:"WFB_MESSAGE_PREVIEW",subtype:"",blocks:e}),[e]),N=(0,n.useMemo)(()=>({item:e,getDefaultOutput:a})=>{if(e.type||!e.text)return a();let r=[],{text:l}=e,i=0;return(l.replace((0,u.gK)(),(e,a,o,s)=>{let c=l.substr(i,s-i);r.push(n.createElement(n.Fragment,{key:r.length},c));let u=(0,d.x)(t,a);if(u){let e=null;if(u.isAvailable)switch(u.type){case p.TE.SlackTypesUserId:case p.TE.SlackTypesUsergroupId:e=n.createElement(m.Dt,{key:r.length,variable:u});break;case p.TE.SlackTypesChannelId:e=n.createElement(m.GZ,{key:r.length,variable:u});break;default:e=n.createElement(m.UR,{key:r.length,variable:u})}else e=n.createElement(m.xH,{workflowId:A,key:r.length});r.push(e)}else r.push(n.createElement(n.Fragment,{key:r.length},e));return i=s+e.length,""}),r.length>0)?(i<l.length&&r.push(n.createElement(n.Fragment,{key:r.length},l.substring(i))),r):a()},[t,A]),M=(0,E.d4)(k.to),L=w;L||(L=C.t("Draft"));let O=(0,n.useMemo)(()=>n.createElement(c.R,{iconSrcUrl:i,altText:w}),[i,w]);return n.createElement(h.A,{subtype:"builder_message_preview",msg:I},n.createElement(m.Zs.Provider,{value:t},n.createElement(m.kA.Provider,{value:T?m.pE.WORKFLOW_EDITOR:null},n.createElement(g.Ay,{msg:I,className:l()("c-message_kit__message",S().container,r?S().pinnedBackground:"",{[S().transparent_background]:T})},a&&n.createElement(s.A,{replyCount:1,clientTheme:M,willPulse:!1}),r&&n.createElement("div",{className:S().pin},n.createElement(o.Ah,{name:"pin-filled"}),n.createElement("span",null,C.t("Pinned by {senderName}",{senderName:L,fallbackHash:"86b41d69dbeaa0f72084093ff87b543afabc99f3",fallbackHashNs:"message"}))),n.createElement(x.A,{msg:I},n.createElement(_.A,{light:O},n.createElement(v.A,{className:"c-message_kit__sender",name:L,memberIsHuman:!1,isUnknown:!1,isInteractive:!1,isWorkflow:!0}),n.createElement(y.A,null,n.createElement(f.A,{msg:I,customFormatHandler:N,blocksContainerContext:b.pi.workflow_message_preview}))))))))};MessagePreview.displayName="MessagePreview"},0x68e1de73:(e,t,a)=>{"use strict";a.d(t,{B:()=>QuestionPreviewList});var n=a(0xbad225b5),r=a(0x2501a2cee),l=a(0xc62077ca),i=a(0xe9c32bb),o=a(0x15a4ffb05),s=a(0xeddc23dd),c=a.n(s);let QuestionPreviewList=({dialogTitle:e,questions:t,showArrow:a=!1,showTitle:s=!1})=>n.createElement(n.Fragment,null,a&&n.createElement("span",{className:c().icon},n.createElement(r.Ah,{name:"arrow-down",inline:!0,size:"20"})),s&&n.createElement(i.nB,{className:c().title,weight:"bold"},n.createElement(o.A,{text:e})),n.createElement("ul",{className:c().list},t.map(e=>n.createElement(l.B,{key:e.name,question:e}))))},0xc62077ca:(e,t,a)=>{"use strict";a.d(t,{B:()=>QuestionPreview,s:()=>getQuestionTypeDef});var n=a(0xbad225b5),r=a(0x2501a2cee),l=a(0x38bda683),i=a(0x23465d793),o=a(0x1795d8821),s=a(0x23efb3294),c=a.n(s);let d={[l.xi.Text]:{questionType:l.xi.Text,baseType:"text",icon:"text-snippet"},[l.xi.Boolean]:{questionType:l.xi.Text,baseType:"boolean",icon:"radio-button"},[l.xi.Integer]:{questionType:l.xi.Integer,baseType:"integer",icon:"number"},[l.xi.Number]:{questionType:l.xi.Number,baseType:"number",icon:"number"},[l.xi.Textarea]:{questionType:l.xi.Textarea,baseType:"textarea",icon:"text-snippet"},[l.xi.RichText]:{questionType:l.xi.RichText,baseType:o.TE.SlackTypesRichText,icon:"formatting"},[l.xi.SelectStatic]:{questionType:l.xi.SelectStatic,baseType:"select",icon:"caret-dropdown"},[l.xi.SelectUser]:{questionType:l.xi.SelectUser,baseType:"select",icon:"user"},[l.xi.SelectConversation]:{questionType:l.xi.SelectConversation,baseType:"select",icon:"channel"},[l.xi.Date]:{questionType:l.xi.Date,baseType:o.TE.SlackTypesDate,icon:"calendar"},[l.xi.DateTime]:{questionType:l.xi.DateTime,baseType:o.TE.SlackTypesTimestamp,icon:"calendar"},[l.xi.ShortText]:{questionType:l.xi.ShortText,baseType:"string",icon:"text-snippet"},[l.xi.LongText]:{questionType:l.xi.LongText,baseType:"string",icon:"text-snippet"},[l.xi.SelectPerson]:{questionType:l.xi.SelectPerson,baseType:o.TE.SlackTypesUserId,icon:"user"},[l.xi.SelectChannel]:{questionType:l.xi.SelectChannel,baseType:o.TE.SlackTypesChannelId,icon:"channel"},[l.xi.Dropdown]:{questionType:l.xi.Dropdown,baseType:o.TE.SlackTypesLimitedRichText,icon:"caret-dropdown"},[l.xi.StaticMultiSelect]:{questionType:l.xi.StaticMultiSelect,baseType:"array",icon:"radio-button"},[l.xi.StaticMultiSelectWithCheckboxes]:{questionType:l.xi.StaticMultiSelectWithCheckboxes,baseType:"array",icon:"checkbox"},[l.xi.UserMultiSelect]:{questionType:l.xi.UserMultiSelect,baseType:"array",icon:"user-groups"},[l.xi.ChannelMultiSelect]:{questionType:l.xi.ChannelMultiSelect,baseType:"array",icon:"channel"},[l.xi.File]:{questionType:l.xi.File,baseType:"array",icon:"file"}},getQuestionTypeDef=e=>d[e]||{},QuestionPreview=({question:e})=>{let t=(0,i.l)(e),{icon:a}=t?getQuestionTypeDef(t):{icon:"text-snippet"};return n.createElement("li",{className:c().container},n.createElement("span",{className:c().icon},n.createElement(r.Ah,{inline:!0,name:a,size:"inherit"})),n.createElement("span",{className:c().label},e.label??e.title))};QuestionPreview.displayName="QuestionPreview"},0x85ec090:(e,t,a)=>{"use strict";a.d(t,{M:()=>T,B:()=>CanvasSelection});var n,r=a(0xbad225b5),l=a(0x20482ad21),i=a(0x1d2cd7755),o=a(0x139c79d16),s=a(0xa5dbe09b),c=a(0x1407c6c2c),d=a(0xe874a88a),u=a(0x2172ff7ff),m=a(0x1ad596f5f),p=a(0x253c586a2),b=a(0x668181b3),f=a(0x2772625d),g=a(0x1d62f3e69),h=a(0xa1832ae4),_=a(0x1795d8821),y=a(0x2196ed249),x=a(0x226892387),v=a(0xbc72568a),E=a(0x1ee439e69);let k=new l.Ay("workflow_builder");function transformDataToOption(e){return{value:e.id,label:e.label,data:e}}let InputCanvasTemplateSearcher=({elementId:e,className:t,value:a,data:n,isDisabled:l=!1,isInvalid:i=!1,isRequired:o=!0,searcherOptions:s,onChange:w,workspaceFilterTeamId:S,selectProps:C,onValueChange:A,renderSelectedOption:T})=>{let I=(0,c.A)(),N=(0,x.d4)(E.H7),M=(0,h.F1)(N),L=(0,x.d4)(v.sk),O=(0,x.d4)(v.jM),F=(0,x.d4)(v._I),D=(0,x.d4)(v.iS),P=(0,r.useMemo)(()=>new Set([...L?.map(e=>e.id)??[],...O?.map(e=>e.id)??[],...F?.map(e=>e.id)??[],...D?.map(e=>e.id)??[]]),[L,D,F,O]),R=(0,r.useMemo)(()=>{let optionsReducer=(e,t)=>{if(t.type===_.TE.SlackTypesCanvasTemplateId&&e.push(transformDataToOption(t)),t.type===_.TE.Object&&t.objectProperties){let a=t.objectProperties.reduce(optionsReducer,[]);e.push(...a)}return e};return n.groups.reduce((e,t)=>{let a=t.data.reduce(optionsReducer,[]);return 0===a.length||e.push({label:t.label,options:a}),e},[])},[n.groups]),B=(0,r.useMemo)(()=>{if(C?.selectedOption)return a;let e="string"==typeof a?(0,b.x)(n.list,a):void 0;return!e&&a&&(0,f.cn)(a)&&(e=(0,g.x7)(a,_.TE.SlackTypesUserId)),e?transformDataToOption(e):a},[n.list,a,C]),getFilteredTemplateOptions=(e,t)=>{if(e&&e.length>0){let a=e.map(e=>({label:e.name,value:e.id}));return""===t?a:a.filter(e=>e.label?.toLowerCase().includes(t.toLowerCase()))}return[]},W=(0,r.useCallback)((e,t)=>{let a=[],n=(0,m.A)(R,t);if(n.length>0&&a.push(...n),C){let e=C.processOptions();a.push(...e)}let r=P&&P.size>0?e.filter(e=>!P.has(e.value)):e;r.length>0&&a.push({label:k.t("Recent templates"),options:r});let l=getFilteredTemplateOptions(O,t);l.length>0&&a.push({label:k.t("Your templates"),options:l});let i=getFilteredTemplateOptions(F,t);i.length>0&&a.push({label:k.t("Shared with you"),options:i});let o=getFilteredTemplateOptions(D,t);o.length>0&&a.push({label:k.t("Created by {teamName}",{teamName:M}),options:o});let s=getFilteredTemplateOptions(L,t);return s.length>0&&a.push({label:k.t("Slack built templates"),options:s.sort((e,t)=>(0,u.Ay)(e.label,t.label))}),d.S.resolve(a)},[R,C,P,O,F,D,L,M]),V=(0,r.useCallback)((e,t)=>{e?(A&&A(e),w({id:e,type:y.BA,isDynamic:!!t.data})):w({})},[w,A]),H=(0,r.useMemo)(()=>{let e=[];return C?.hints&&e.push(...C.hints),e},[C?.hints]);return r.createElement(p.NV,{className:t,id:e||I,queryType:p.JM,searcherOptions:s,ariaLabel:k.t("canvas templates dropdown menu"),onChange:V,value:B,placeholder:k.t("Select an option"),isDisabled:l,isInvalid:i,isRequired:o,processOptions:W,selectDataQa:"workflow-destination__select",workspaceFilterTeamId:S,renderSelectedOption:T,hints:H})};InputCanvasTemplateSearcher.displayName="InputCanvasTemplateSearcher";var w=a(0x11fa58239),S=a(0x223beeef);let C=new l.Ay("workflow_builder"),A={groups:[],list:[]};var T=((n={}).Blank="blank",n.Template="template",n);let I={name:"canvas_create_type",type:_.TE.String,is_required:!1},N={name:"content",type:_.TE.SlackTypesRichText,is_required:!1},CanvasSelection=({onChange:e,parameter:t,callbackId:a,viewOnly:n,configuredParameters:l,variables:c,otherParameterValues:d,workflowExternalWorkspaceId:u})=>{let[m,p]=(0,r.useState)(d?.canvas_create_type?.value==="template"?"template":"blank"),b=(0,r.useCallback)(a=>{let n=a.target.value;p(n),e(I,n),"blank"===n&&e(t,null),d?.content?.value&&"template"===n&&e(N,null)},[e,d?.content,t]),f=(0,r.useCallback)(a=>{let{id:n}=a;e(t,n)},[e,t]),g=l&&l[t.name]?.value,h=(0,w.z)({parameter:t,value:g||"",callbackId:a,variables:c,onChange:e});return r.createElement(r.Fragment,null,r.createElement(s.A,{className:"margin_bottom_150",legendText:C.t("What type of canvas do you want to create?")},r.createElement("div",null,r.createElement(i.A,{htmlFor:"blank",text:C.t("Create from scratch"),type:"inline",cursor:"pointer"},r.createElement(o.A,{id:"blank","data-qa":"blank",value:"blank",checked:"blank"===m,onChange:b,disabled:n}))),r.createElement("div",null,r.createElement(i.A,{htmlFor:"template",text:C.t("Create from template"),type:"inline",cursor:"pointer"},r.createElement(o.A,{id:"template","data-qa":"template",value:"template",checked:"template"===m,onChange:b,disabled:n})))),"template"===m&&r.createElement(S.z,{parameter:t,isAlwaysRequired:!0},r.createElement(InputCanvasTemplateSearcher,{key:t.name,data:c||A,value:g||"",onChange:f,workspaceFilterTeamId:u,...h})))};CanvasSelection.displayName="CanvasSelection"},0x476b122:(e,t,a)=>{"use strict";a.d(t,{o:()=>CanvasUpdateSelection,s:()=>p});var n,r=a(0xbad225b5),l=a(0x20482ad21),i=a(0x1d2cd7755),o=a(0x139c79d16),s=a(0xa5dbe09b),c=a(0x10b93423f),d=a(0x1795d8821);let u=new l.Ay("workflow_builder"),m={groups:[],list:[]};var p=((n={}).Standalone="standalone",n.ChannelCanvas="channel_canvas",n.ChannelTab="channel_tab",n);let b={name:"canvas_update_type",type:d.TE.String,is_required:!1},f={name:"canvas_id",type:d.TE.SlackTypesCanvasId,is_required:!1},g={name:"canvas_tab",type:d.TE.String,is_required:!1},CanvasUpdateSelection=({onChange:e,parameter:t,callbackId:a,viewOnly:n,configuredParameters:l,variables:d,otherParameterValues:p,dynamicParameter:h,workflowExternalWorkspaceId:_})=>{let[y,x]=(0,r.useState)(p?.canvas_update_type?.value==="channel_canvas"?"channel_canvas":"standalone"),v=(0,r.useCallback)(a=>{let n=a.target.value;x(n),e(b,n),e(h,null),"standalone"===n&&(e(t,null),e(g,null)),p?.canvas_id?.value&&"channel_canvas"===n&&e(f,null)},[e,p?.canvas_id,t,h]),E=l&&l[t.name]?.value;return r.createElement(r.Fragment,null,r.createElement(s.A,{className:"margin_bottom_150",legendText:u.t("What type of canvas do you want to update?")},r.createElement("div",null,r.createElement(i.A,{htmlFor:"standalone",text:u.t("Standalone canvas"),subtext:u.t("Can be shared across multiple people and channels."),type:"inline",cursor:"pointer"},r.createElement(o.A,{id:"standalone","data-qa":"standalone",value:"standalone",checked:"standalone"===y,onChange:v,disabled:n}))),r.createElement("div",null,r.createElement(i.A,{htmlFor:"channel_canvas",text:u.t("Channel canvas"),subtext:u.t("Attached to a single channel."),type:"inline",cursor:"pointer"},r.createElement(o.A,{id:"channel_canvas","data-qa":"channel_canvas",value:"channel_canvas",checked:"channel_canvas"===y,onChange:v,disabled:n})))),"channel_canvas"===y&&r.createElement(c.O,{key:t.name,variables:d||m,allowVariables:!0,parameter:t,value:E||"",onChange:e,callbackId:a,externalWorkspaceId:_}))};CanvasUpdateSelection.displayName="CanvasUpdateSelection"},0x1525f79d3:(e,t,a)=>{"use strict";a.d(t,{T:()=>CreateCanvasTreatment,w:()=>shouldRenderCreateCanvasTreatment});var n=a(0xbad225b5),r=a(0x85ec090),l=a(0x1407c6c2c),i=a(0x20482ad21),o=a(0x2b7f0bcc),s=a(0x677a139e),c=a(0x380ee7b0),d=a(0x88881d67),u=a(0x223beeef),m=a(0x1ba35eb3b),p=a(0x1d3dd4cbe);let b=new i.Ay("workflow_builder"),SlackFunctionChannelVariablesInput=({value:e,parameter:t,onChange:a,variables:r,formatVariableBeforeInsert:i})=>{let{viewOnly:f}=(0,p.e)(),g=(0,l.A)(),h=(0,n.useCallback)(e=>{a(t,e)},[a,t]),_=(0,n.useCallback)(e=>!(0,m.Bp)(e)&&((0,m.qk)(e)||(0,m.xY)({variable:e,parameter:t})),[t]),y=e;if(!e){let e=(0,d.PW)(r.groups,_);e&&1===e.length&&a(t,y=e[0].data[0].id)}let maybeRenderDeprecationAlert=()=>{let e=b.t("Heads up\u2014this step will soon be changing. Want to get a head start? Replace this step with these two: \u201CCreate a canvas\u201D and \u201CAdd a canvas tab to a channel.\u201D");return n.createElement(o.Ay,{level:o.A_.warning,className:"margin_bottom_75"},e)};return maybeRenderDeprecationAlert.displayName="maybeRenderDeprecationAlert",n.createElement(n.Fragment,null,maybeRenderDeprecationAlert(),n.createElement(u.z,{elementId:g,parameter:t,forceLabel:b.t("Select a canvas")},n.createElement(c.P,{onChange:h,value:y,variables:r,customDataFilter:_,label:t.title??t.description??t.name,isDisabled:f,formatVariableBeforeInsert:i,parameterType:t.type}),n.createElement(s.A,null,null)))};SlackFunctionChannelVariablesInput.displayName="SlackFunctionChannelVariablesInput";var f=a(0x1795d8821);function shouldRenderCreateCanvasTreatment({parameter:e,callbackId:t,otherParameterValues:a}){switch(e.type){case f.TE.SlackTypesCanvasTemplateId:if("canvas_template_id"===e.name)return!0;return!1;case f.TE.SlackTypesChannelId:if("channel_id"===e.name&&t===f.oW.CreateChannelCanvas)return!0;return!1;case f.TE.String:if("canvas_create_type"===e.name)return!0;return!1;case f.TE.SlackTypesExpandedRichText:if(a?.canvas_create_type?.value==="template"&&"content"===e.name)return!0;return!1;default:return!1}}let CreateCanvasTreatment=({parameter:e,value:t,variables:a,configuredParameters:l,required:i,onChange:o,isReference:s,viewOnly:c,callbackId:d,otherParameterValues:u,workflowExternalWorkspaceId:m})=>{switch(e.type){case f.TE.SlackTypesCanvasTemplateId:if("canvas_template_id"===e.name)return n.createElement(r.B,{parameter:e,value:t,variables:a,configuredParameters:l,required:i,onChange:o,isReference:s,viewOnly:c,callbackId:d,otherParameterValues:u,workflowExternalWorkspaceId:m});return null;case f.TE.SlackTypesChannelId:if("channel_id"===e.name&&d===f.oW.CreateChannelCanvas)return n.createElement(SlackFunctionChannelVariablesInput,{parameter:e,value:t,variables:a,onChange:o});return null;case f.TE.String:if("canvas_create_type"===e.name)return n.createElement("div",null);return null;case f.TE.SlackTypesExpandedRichText:if(u?.canvas_create_type?.value==="template"&&"content"===e.name)return n.createElement("div",null);return null;default:return null}};CreateCanvasTreatment.displayName="CreateCanvasTreatment"},0x18de2ae18:(e,t,a)=>{"use strict";a.d(t,{G:()=>UpdateCanvasTreatmentV2,z:()=>shouldRenderUpdateCanvasTreatmentV2});var n,r=a(0xbad225b5),l=a(0x1d01572a2),i=a(0x20482ad21),o=a(0x1d2cd7755),s=a(0x139c79d16),c=a(0xa5dbe09b),d=a(0x145d46a61),u=a(0x1795d8821),m=a(0x226892387);let p=new i.Ay("workflow_builder");var b=((n={}).Standalone="standalone",n.ChannelTab="channel_tab",n);let f={name:"canvas_update_type",type:u.TE.String,is_required:!1},g={name:"canvas_id",type:u.TE.SlackTypesCanvasId,is_required:!1},h={name:"canvas_tab",type:u.TE.String,is_required:!1},CanvasUpdateSelectionV2=({onChange:e,parameter:t,viewOnly:a,otherParameterValues:n,dynamicParameter:i})=>{let[u,b]=(0,r.useState)(n?.canvas_update_type?.value==="channel_tab"?"channel_tab":"standalone"),_=(0,m.d4)(d.$T);(0,l.A)(()=>{_&&u!==n?.canvas_update_type?.value&&e(f,u)});let y=(0,r.useCallback)(a=>{let r=a.target.value;b(r),e(f,r),e(i,null),"standalone"===r&&(e(t,null),e(h,null)),n?.canvas_id?.value&&"channel_tab"===r&&e(g,null)},[e,n?.canvas_id,t,i]);return r.createElement(c.A,{className:"margin_bottom_150",legendText:p.t("Choose how you\u2019d like to find the canvas:",{fallbackHash:"2cdfb663290cc5db016146845ec88cb4baed33c0",fallbackHashNs:"workflow_builder"})},r.createElement("div",null,r.createElement(o.A,{htmlFor:"standalone",text:p.t("By canvas title",{fallbackHash:"f1f06dedad1afa84271ba4cb62a6441b43bf89fb",fallbackHashNs:"workflow_builder"}),type:"inline",cursor:"pointer"},r.createElement(s.A,{id:"standalone","data-qa":"standalone",value:"standalone",checked:"standalone"===u,onChange:y,disabled:a}))),r.createElement("div",null,r.createElement(o.A,{htmlFor:"channel_tab",text:p.t("By channel",{fallbackHash:"698fe85e4f2b0c5a06e28f5a57100e1b67cd0ada",fallbackHashNs:"workflow_builder"}),type:"inline",cursor:"pointer"},r.createElement(s.A,{id:"channel_tab","data-qa":"channel_tab",value:"channel_tab",checked:"channel_tab"===u,onChange:y,disabled:a}))))};CanvasUpdateSelectionV2.displayName="CanvasUpdateSelectionV2";var _=a(0xa1832ae4),y=a(0x1ee439e69);let x={name:"section_id",type:u.TE.String,is_required:!1};function shouldRenderUpdateCanvasTreatmentV2({parameter:e,otherParameterValues:t,isFreeTeam:a}){switch(e.type){case u.TE.SlackTypesChannelId:if("channel_id"===e.name){if(a)return!1;return!0}return!1;case u.TE.String:if("canvas_update_type"===e.name)return!0;return!1;case u.TE.SlackTypesCanvasId:if((t?.canvas_update_type?.value===b.ChannelTab||a)&&"canvas_id"===e.name)return!0;return!1;default:return!1}}let UpdateCanvasTreatmentV2=({parameter:e,value:t,variables:a,configuredParameters:n,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,workflowExternalWorkspaceId:d})=>{let p=(0,m.d4)(y.H7),f=!(0,_.qR)(p),[g,h]=(0,r.useState)();switch(e.type){case u.TE.String:if("canvas_update_type"===e.name)return f&&!g&&(l(e,b.ChannelTab),h(!0)),r.createElement(CanvasUpdateSelectionV2,{parameter:e,dynamicParameter:x,value:t,variables:a,configuredParameters:n,required:!1,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,workflowExternalWorkspaceId:d});return null;case u.TE.SlackTypesCanvasId:if(f&&"canvas_id"===e.name)return r.createElement("div",null);return null;default:return null}};UpdateCanvasTreatmentV2.displayName="UpdateCanvasTreatmentV2"},0xbdb24cfa:(e,t,a)=>{"use strict";a.d(t,{P:()=>shouldRenderUpdateCanvasTreatment,W:()=>UpdateCanvasTreatment});var n=a(0xbad225b5),r=a(0x476b122),l=a(0xa1832ae4),i=a(0x1795d8821),o=a(0x226892387),s=a(0x1ee439e69);let c={name:"section_id",type:i.TE.String,is_required:!1};function shouldRenderUpdateCanvasTreatment({parameter:e,otherParameterValues:t,isFreeTeam:a}){switch(e.type){case i.TE.SlackTypesChannelId:if("channel_id"===e.name){if(a)return!1;return!0}return!1;case i.TE.String:if("canvas_update_type"===e.name)return!0;return!1;case i.TE.SlackTypesCanvasId:if((t?.canvas_update_type?.value===r.s.ChannelCanvas||a)&&"canvas_id"===e.name)return!0;return!1;default:return!1}}let UpdateCanvasTreatment=({parameter:e,value:t,variables:a,configuredParameters:d,onChange:u,isReference:m,viewOnly:p,callbackId:b,otherParameterValues:f,workflowExternalWorkspaceId:g})=>{let h=(0,o.d4)(s.H7),_=!(0,l.qR)(h),[y,x]=(0,n.useState)();switch(e.type){case i.TE.SlackTypesChannelId:if("channel_id"===e.name){if(_)return null;return n.createElement(r.o,{parameter:e,dynamicParameter:c,value:t,variables:a,configuredParameters:d,required:!1,onChange:u,isReference:m,viewOnly:p,callbackId:b,otherParameterValues:f,workflowExternalWorkspaceId:g})}return null;case i.TE.String:if("canvas_update_type"===e.name)return _&&!y&&(u(e,r.s.ChannelCanvas),x(!0)),n.createElement("div",null);return null;case i.TE.SlackTypesCanvasId:if((f?.canvas_update_type?.value===r.s.ChannelCanvas||_)&&"canvas_id"===e.name)return n.createElement("div",null);return null;default:return null}};UpdateCanvasTreatment.displayName="UpdateCanvasTreatment"},0x162b2271e:(e,t,a)=>{"use strict";a.d(t,{T:()=>UpdateCanvasVariablesTreatment,c:()=>shouldRenderUpdateCanvasVariablesTreatment});var n=a(0xbad225b5),r=a(0x476b122),l=a(0xa1832ae4),i=a(0x1795d8821),o=a(0x226892387),s=a(0x1ee439e69);let c={name:"placeholder_value",type:i.TE.String,is_required:!1};function shouldRenderUpdateCanvasVariablesTreatment({parameter:e,otherParameterValues:t,isFreeTeam:a}){switch(e.type){case i.TE.SlackTypesChannelId:if("channel_id"===e.name){if(a)return!1;return!0}return!1;case i.TE.String:if("canvas_update_type"===e.name)return!0;return!1;case i.TE.SlackTypesCanvasId:if((t?.canvas_update_type?.value===r.s.ChannelCanvas||a)&&"canvas_id"===e.name)return!0;return!1;default:return!1}}let UpdateCanvasVariablesTreatment=({parameter:e,value:t,variables:a,configuredParameters:d,onChange:u,isReference:m,viewOnly:p,callbackId:b,otherParameterValues:f,workflowExternalWorkspaceId:g})=>{let h=(0,o.d4)(s.H7),_=!(0,l.qR)(h),[y,x]=(0,n.useState)();switch(e.type){case i.TE.SlackTypesChannelId:if("channel_id"===e.name){if(_)return null;return n.createElement(r.o,{parameter:e,dynamicParameter:c,value:t,variables:a,configuredParameters:d,required:!1,onChange:u,isReference:m,viewOnly:p,callbackId:b,otherParameterValues:f,workflowExternalWorkspaceId:g})}return null;case i.TE.String:if("canvas_update_type"===e.name)return _&&!y&&(u(e,r.s.ChannelCanvas),x(!0)),n.createElement("div",null);return null;case i.TE.SlackTypesCanvasId:if((f?.canvas_update_type?.value===r.s.ChannelCanvas||_)&&"canvas_id"===e.name)return n.createElement("div",null);return null;default:return null}};UpdateCanvasVariablesTreatment.displayName="UpdateCanvasVariablesTreatment"},0xa4a4f43b:(e,t,a)=>{"use strict";a.d(t,{C:()=>FormFieldValueReadOnly});var n=a(0xbad225b5),r=a(0x174bb7323),l=a(0x1cbdfeceb),i=a(0x20482ad21),o=a(0x2501a2cee),s=a(0x4c96e5d9),c=a(0x223beeef),d=a(0x242c34757),u=a(0x145d46a61),m=a(0x226892387),p=a(0x129d52829),b=a.n(p),f=a(0x9b06c346),g=a.n(f);let h=new i.Ay("workflow_builder"),FormFieldValueReadOnly=({value:e,parameter:t,variables:a,dynamicInput:i})=>{let p=i?`key-value-input-${i.key}`:`input-${t.name}`,f=(0,m.d4)(u.$T),_=h.t("Included in form",{fallbackHash:"0bdb9fe0057325a88dac4c2acd80cb7bbd6774a0"}),renderInput=({inputType:i,ariaLabel:o,textyClassName:s})=>n.createElement(d.A,{id:p,initialText:(0,r.A)(e),variables:a,allowVariables:!1,className:"flex_one",textyClassName:s,ariaLabel:o??"",inputType:i,onVariableMenuOpen:l.A,onTextChange:l.A,onBlur:l.A,isDisabled:!0,hint:t.hint});return f?i?n.createElement("div",{className:b().container},renderInput({inputType:i.type,ariaLabel:i.label,textyClassName:g().textyInput}),n.createElement(s.Ay,{tip:_,position:"top"},n.createElement("div",{className:b().syncIcon},n.createElement(o.Ah,{name:"refresh",size:"20","aria-label":_})))):n.createElement(c.z,{elementId:p,parameter:t,isParameterSyncedWithForm:!0},renderInput({inputType:t.type,ariaLabel:t.title??t.name})):null};FormFieldValueReadOnly.displayName="FormFieldValueReadOnly"},0x16bc32721:(e,t,a)=>{"use strict";a.d(t,{J:()=>formatDynamicOptions});var n=a(0x202470d56),r=a(0x1795d8821);let formatDynamicOptions=({dynamicOptions:e,value:t,displayInline:a,selectionType:l,isParameterFormWrapped:i})=>e.map((e,o)=>{let s=a||e.empty||e.visible||e.is_required;!s&&"string"==typeof e.key&&"object"==typeof t&&e.key in t&&(s=!!i||!(0,n.A)(t[e.key]));let c=e.value;return l===r.Il.KEY_VALUE&&(c="string"==typeof e.key&&"object"==typeof t&&e.key in t?t[e.key]:void 0),{...e,is_required:e.is_required||!1,key:e.key||"",empty:e.empty||!1,label:e.label||"",value:c,visible:!!s,selectable:!s,selected:l===r.Il.SELECT&&t===e.key,index:o}})},0x20f31dc25:(e,t,a)=>{"use strict";a.d(t,{f:()=>useDynamicOptionsWorkflowClient});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x1db69cda),i=a(0xc6a2c86f),o=a(0x242822dfb),s=a(0x347d5813),c=a(0x21dd8a0c2),d=a(0x1806ce928);let useDynamicOptionsWorkflowClient=({function:e,workflowId:t,functionId:a,values:u,inputs:m,stepId:p,isExistingStep:b,hasValidationFunction:f,hierarchicalParameterName:g,optionType:h,serviceTriggerType:_,triggerId:y,isTriggerSegment:x,isOAuthTokenInvalid:v,additionalInputs:E})=>{let k=(0,r.wA)(),w=(0,i.A)(m),S=(0,n.useCallback)(({typeaheadQueryKey:n,typeaheadQueryValue:r}={})=>{let i=m?(0,l.A)(m):{};return n&&(i[n]=r||""),k((0,d.O)({function:e,stepFunctionId:a,workflowStepId:p,workflowId:t,hierarchicalParameterName:g,optionType:h,inputs:i,triggerType:_,reason:"workflow_builder/workflows_get_dynamic_options"}))},[k,a,e,g,m,h,p,t,_]),C=(0,o.p9)(w,m,v),A=(0,n.useCallback)(()=>{let e=!!(b&&p),n=!!(x&&y);if(!f||!e&&!n)return Promise.resolve(void 0);let r=(0,s.V)(u);return k((0,c.X)({stepInputs:r,inputParameterName:g[0],stepFunctionId:a,workflowStepId:p,workflowId:t,triggerType:_,additionalInputs:E,hierarchicalParameterName:g,triggerId:x?y:void 0,reason:"workflow_builder/workflows_validate_options"}))},[b,p,x,y,f,u,k,g,a,t,_,E]);return(0,n.useMemo)(()=>({fetchOptions:S,shouldFetchOptions:C,validateOptions:A,isOAuthTokenInvalid:v}),[S,v,C,A])}},0xee467999:(e,t,a)=>{"use strict";a.d(t,{n:()=>useDynamicOptions});var n=a(0xbad225b5),r=a(0x9e671ad),l=a(0x21f3c49e8);let i="INIT",o="UPDATE_STATE",s="SET_STATUS_PENDING",c="SET_STATUS_COMPLETE",d="FETCH_OPTIONS_SUCCESS",u="FETCH_OPTIONS_ERROR",m="VALIDATE_OPTIONS_SUCCESS",p="VALIDATE_OPTIONS_ERROR",b="UPDATE_VALUE",f="UPDATE_LABEL",g="ADD_EMPTY_OPTION",h="REMOVE_OPTION",_="CHANGE_OPTION",y="SELECT_OPTION",x="CLEAR_STATUS_ERROR";var v=a(0x1165e5027),E=a(0x1feee1711);let shouldDisplayInline=(e,t)=>!!(0,E.A)(t)||t>0&&e<=t;var k=a(0x1795d8821);let combineValidateAndDynamicOptions=({dynamicOptions:e,selectionType:t,validateOptions:a,inlineDisplayThreshold:n})=>{let r,l=shouldDisplayInline((r=t===k.Il.KEY_VALUE?(0,v.A)(a,e,"key").map((e,t)=>({...e,originalIndex:t})):(0,v.A)(a,e,"value").map((e,t)=>({...e,key:"string"==typeof e.value?e.value:String(t),originalIndex:t}))).length,n);return{mappedDynamicOptions:r,displayInline:l}};var w=a(0x16bc32721);let init=({value:e,options:t})=>{let{dynamicOptions:a=[],...n}=t;return{isLoading:!1,isError:!1,isSuccess:!1,displayInline:shouldDisplayInline(a.length,t.inlineDisplayThreshold),dynamicOptions:a,errorMessage:null,errorCode:null,value:e,label:void 0,valueType:void 0,...n}};var S=a(0x1c09d8c36);let updateLabelsForDynamicOptions=(e,t)=>e.map(({valueLabel:e,...a})=>{let n={...a},r=n.key&&t?.[n.key];if(!r||"object"!=typeof r)return n;r.valueLabel&&(n.valueLabel=r.valueLabel);let l=r[S.x3];return l&&(n.filterQueries=l),n});var C=a(0x1e19488b9),A=a(0x1806ce928);let createDynamicOption=e=>({key:"",label:"",value:void 0,visible:!0,selectable:!1,index:0,empty:!0,selected:!1,type:C.J5.String,selection_type:C.p8.NONE,is_required:!1,...e}),reducer=(e,t)=>{switch(t.type){case i:return init({value:t.value,options:{processError:e.processError,dynamicOptions:e.dynamicOptions,inlineDisplayThreshold:e.inlineDisplayThreshold,selectionType:e.selectionType,onSuccess:e.onSuccess,onValueChange:e.onValueChange,...t.options}});case o:return{...e,...t.state};case s:return{...e,isLoading:!0,errorMessage:null,errorCode:null,isError:!1,isSuccess:!1,dynamicOptions:[],validateOptions:[]};case c:return{...e,isLoading:!1};case d:{let{mappedDynamicOptions:a,displayInline:n}=combineValidateAndDynamicOptions({dynamicOptions:t.dynamicOptions,selectionType:e.selectionType,validateOptions:e.validateOptions,inlineDisplayThreshold:e.inlineDisplayThreshold}),r=(0,w.J)({dynamicOptions:a,value:e.value,displayInline:n,selectionType:e.selectionType,isParameterFormWrapped:e.isParameterFormWrapped});if(e.selectionType===k.Il.KEY_VALUE&&(r=updateLabelsForDynamicOptions(r,e.label)),!n&&r.length&&r.every(e=>!e.visible)){let e=createDynamicOption({index:r.length});r.push(e)}return e.onSuccess?.(r),{...e,dynamicOptions:r,valueType:t.valueType,isSuccess:!0,displayInline:n}}case u:{let a=e.processError?.(t.error)??t.error?.data?.error_message;return{...e,dynamicOptions:[],errorMessage:a??null,errorCode:t.error?.data.error??null,isError:!0,isSuccess:!1}}case m:{let{mappedDynamicOptions:a,displayInline:n}=combineValidateAndDynamicOptions({dynamicOptions:t.dynamicOptions,selectionType:e.selectionType,validateOptions:e.validateOptions,inlineDisplayThreshold:e.inlineDisplayThreshold}),r=(0,w.J)({dynamicOptions:a,value:e.value,displayInline:n,selectionType:e.selectionType,isParameterFormWrapped:e.isParameterFormWrapped});return{...e,validateOptions:t.dynamicOptions,dynamicOptions:r,displayInline:n}}case p:{let a=e.processError?.(t.error)??t.error?.data?.error_message;return t.error?.data?.error===A.n.FunctionReturnedError&&"function"==typeof e.onValueChange&&e.onValueChange({value:void 0}),{...e,validateOptions:[],errorMessage:a??null,errorCode:t.error?.data?.error??null,isError:!0}}case b:{if(e.selectionType===k.Il.SELECT){let a=e.dynamicOptions.map(e=>({...e,selected:e.value===t.value}));return{...e,value:t.value,dynamicOptions:a}}let a=(0,w.J)({dynamicOptions:e.dynamicOptions,value:t.value,displayInline:e.displayInline,selectionType:e.selectionType,isParameterFormWrapped:e.isParameterFormWrapped});return{...e,value:t.value,dynamicOptions:a}}case f:if(e.selectionType===k.Il.KEY_VALUE){let a=updateLabelsForDynamicOptions(e.dynamicOptions,t.label);return{...e,dynamicOptions:a,label:t.label}}return{...e,label:t.label};case g:{let t=createDynamicOption({index:e.dynamicOptions.length}),a=[...e.dynamicOptions,t];return{...e,dynamicOptions:a}}case h:{let a=e.dynamicOptions.reduce((e,a)=>{if(a.key===t.dynamicOption.key){if(a.empty)return e;e.push({...a,visible:!1,selectable:!0,value:void 0})}else e.push(a);return e},[]);if("function"==typeof e.onValueChange){let n=a.filter(e=>void 0!==e.value&&e.key!==t.dynamicOption.key),r=a.filter(e=>!e.empty);e.onValueChange({value:n,dynamicOption:t.dynamicOption,nonEmptyDynamicOptions:r})}return{...e,dynamicOptions:a}}case _:{let a,n=[...e.dynamicOptions],r=t.dynamicOption.index,l=!1;if(t.dynamicOption.empty&&t.dynamicOption.key===e.dynamicOptions[t.dynamicOption.index].key)return n[r]=t.dynamicOption,{...e,dynamicOptions:n.map((e,t)=>({...e,index:t}))};if(t.dynamicOption.empty&&t.dynamicOption.key!==e.dynamicOptions[t.dynamicOption.index].key){let e=n.findIndex(e=>e.key===t.dynamicOption.key),r={...t.dynamicOption,value:void 0,label:n[e].label,key:n[e].key,type:n[e].type,selection_type:n[e].selection_type,additional_inputs:n[e].additional_inputs,originalIndex:n[e].originalIndex,empty:!1,available_options:n[e].available_options};r.type!==C.J5.String||r.selection_type&&r.selection_type!==C.p8.NONE||(r.value=t.dynamicOption.value),n[t.dynamicOption.index]={...r},n.splice(e,1),a=[...n],l=!0}else if(e.dynamicOptions[r].key!==t.dynamicOption.key){let i=e.dynamicOptions.find(e=>e.key===t.dynamicOption.key).index,o={...n[i],value:void 0,visible:!0,selectable:!1},s={...n[r],value:void 0,visible:!1,selectable:!0};s?.selection_type&&s.selection_type!==C.p8.NONE||o.selection_type&&o.selection_type!==C.p8.NONE||s.type!==o.type||(o.value=t.dynamicOption.value),n[r]=o,n[i]=s,a=[...n],l=!0}else a=n.map(e=>e.key===t.dynamicOption.key?t.dynamicOption:e);if("function"==typeof e.onValueChange){let r=a.filter(e=>e.visible),i=n.filter(e=>!e.empty);e.onValueChange({value:r,dynamicOption:t.dynamicOption,nonEmptyDynamicOptions:i,isNewDynamicOption:l})}return{...e,dynamicOptions:n.map((e,t)=>({...e,index:t}))}}case y:{let a=e.dynamicOptions.find(e=>(0,r.A)(e.value,t.option?.value)),n=a?{...t.option,...a,selected:!0}:t.option;if("function"==typeof e.onValueChange){let a=e.dynamicOptions.filter(e=>!e.empty);e.onValueChange({value:t.option?.value,dynamicOption:n,nonEmptyDynamicOptions:a})}return{...e,errorMessage:null,errorCode:null,isError:!1}}case x:return{...e,errorMessage:null,errorCode:null,isError:!1};default:return e}};var T=a(0x242822dfb),I=a(0x2772625d),N=a(0x9d5ee87e),M=a(0xf5bbd10a);let useDynamicOptions=({client:e,value:t,label:a,reducerOptions:v,typeahead:E={},minQueryLength:w})=>{let S=(0,M.A)(),{state:C,actions:A}=((e,t,a)=>{let[r,l]=(0,n.useReducer)(reducer,{value:e,label:t,options:a},init);return{state:r,actions:(0,n.useMemo)(()=>({[i]:(e,t)=>l({type:i,value:e,options:t}),[o]:e=>l({type:o,state:e}),[s]:()=>l({type:s}),[c]:()=>l({type:c}),[d]:(e,t)=>l({type:d,dynamicOptions:e,valueType:t}),[u]:e=>l({type:u,error:e}),[m]:e=>l({type:m,dynamicOptions:e}),[p]:e=>l({type:p,error:e}),[b]:e=>l({type:b,value:e}),[f]:e=>l({type:f,label:e}),[g]:()=>l({type:g}),[h]:e=>l({type:h,dynamicOption:e}),[_]:e=>l({type:_,dynamicOption:e}),[y]:(e,t)=>l({type:y,option:e,filterQueries:t}),[x]:()=>l({type:x})}),[l])}})(t,a,v),{typeaheadQueryKey:L}=E,O=(0,n.useCallback)(async()=>{try{let{options:t,value_type:a}=await e.fetchOptions({typeaheadQueryKey:L});A.FETCH_OPTIONS_SUCCESS(t,a)}catch(e){A.FETCH_OPTIONS_ERROR(e),S.error("Something went wrong when trying to fetch dynamic options:",e)}},[A,e,S,L]),F=(0,n.useCallback)(async()=>{try{let t=await e.validateOptions?.();t?.options&&A.VALIDATE_OPTIONS_SUCCESS(t.options)}catch(e){e.data?.error!==N.V.TokenDelegatedError&&A.VALIDATE_OPTIONS_ERROR(e)}},[A,e]),D=(0,n.useCallback)(async()=>{!e.shouldFetchOptions||v.dynamicOptions||(A.SET_STATUS_PENDING(),t&&e.validateOptions&&(v.selectionType===k.Il.MULTI_SELECT||!(0,I.bs)(t))&&await F(),L&&(!L||w)||await O(),A.SET_STATUS_COMPLETE())},[A,e.shouldFetchOptions,v.dynamicOptions,L,O,F]),P=(0,n.useCallback)((e,t)=>(0,T.Xn)(e,t),[]);return(0,n.useEffect)(()=>{D()},[D]),(0,n.useEffect)(()=>{(0,r.A)(t,C.value)||A.UPDATE_VALUE(t)},[t,C.value,A]),(0,n.useEffect)(()=>{(0,r.A)(a,C.label)||A.UPDATE_LABEL(a)},[a,C.label,A]),(0,n.useEffect)(()=>{v.dynamicOptions&&A.INIT(t,{dynamicOptions:v.dynamicOptions})},[A,v.dynamicOptions,t]),(0,n.useEffect)(()=>{let e={};(0,r.A)(v.onValueChange,C.onValueChange)||(e.onValueChange=v.onValueChange),(0,r.A)(v.onSuccess,C.onSuccess)||(e.onSuccess=v.onSuccess),(0,r.A)(v.processError,C.processError)||(e.processError=v.processError),(0,l.A)(e)||A.UPDATE_STATE(e)},[A,v.onSuccess,v.onValueChange,v.processError,C.onSuccess,C.onValueChange,C.processError]),{...C,actions:A,processSelectOptions:P}}},0x1795b5c1b:(e,t,a)=>{"use strict";a.d(t,{g:()=>applyDynamicOptionsAsObjectProperties});var n=a(0x1db69cda),r=a(0xee06738a),l=a(0x242822dfb);let applyDynamicOptionsAsObjectProperties=(e,t,a,i)=>{let o=(0,n.A)(e);if(!o.config.slackFunction)return o;let s=(0,r.q)(o)&&o.config.wrappedSlackFunction?o.config.wrappedSlackFunction.input_parameters:o.config.slackFunction.input_parameters,c=s.findIndex(({name:e})=>e===t.name),d=s[c];if(c<0||!(0,l.sg)(t))return o;let u=a.reduce((e,a)=>{let n=((e,t,a=!1,n={})=>{if(!e.isParameterFormWrapped)return!1;let r=n?.[t.key]??{};return"isParameterFormWrapped"in r?!!r.isParameterFormWrapped:!(!a&&Object.keys(n).some(e=>n[e]&&"isParameterFormWrapped"in n[e]))})(t,a,i,d.properties),r=(0,l.KE)(a,t,n);return r&&(e[a.key]=r),e},{});return d.properties=u,o}},0x1f5430624:(e,t,a)=>{"use strict";a.d(t,{r:()=>SlackFunctionDynamicInputs});var n=a(0xbad225b5),r=a(0x21f3c49e8),l=a(0x1df96de4c),i=a(0xa4a4f43b),o=a(0x1c09d8c36),s=a(0x20482ad21),c=a(0x1806ce928),d=a(0x1795d8821);let u=new s.Ay("workflow_builder"),createGSheetsProcessError=e=>t=>!t?.data?.error||"typeahead"in e&&!0===e.typeahead&&t?.data?.error===c.n.TooManyOptions?null:e.dynamic_options.selectionType===d.Il.KEY_VALUE?u.t("*We had a problem loading your spreadsheet.* Learn more about <{gsheetsLink}|Google Sheets for Workflow Builder>.",{gsheetsLink:o.RE,fallbackHash:"1dd20802d6b9a14c32daa9db95fb5a2231ead6b7",fallbackHashNs:"workflow-builder"}):u.t("We had a problem loading your spreadsheet. Learn more about <{gsheetsLink}|Google Sheets for Workflow Builder>.",{gsheetsLink:o.RE,fallbackHash:"103b8ba13ce647b2cdb8c09934af95a9a7e0e44f",fallbackHashNs:"workflow-builder"});var m=a(0x220a941b7),p=a(0x4ba0a293),b=a(0x59698e4),f=a(0x1101b591d),g=a(0x13ce094e1),h=a(0x11e17f4c1),_=a(0x2a8eb1c6),y=a(0x21c50a68b),x=a(0x25054cb9f),v=a(0x100bcae20),E=a(0x23465d793),k=a(0x153cbdf74);function shouldListsUseDefaultTemplateMacro(e){let t=(0,E.l)(e);return!t||v.g[t]!==k.$.Attachment}var w=a(0x242822dfb),S=a(0xaa8bd6a3);let C=new s.Ay("workflow_builder"),getDynamicOptions=({parameter:e,value:t,variables:a,openFormSteps:n,personWhoSubmittedText:r,timeSubmittedText:l,shouldUseDefaultTemplateMacro:i,keyAsIndex:o=!0,stepId:s,optionType:c})=>(0,w.Wz)(e,t)?!t||"object"!=typeof t||Array.isArray(t)?[]:((e,t,a,n,r,l,i,o=!0,s=()=>!0)=>{let c=(0,b.k)(e.id),u=e.fields.map((e,a)=>{let n=o?(0,p.f)(c,a):(0,p.f)(c,`${(0,m.A)(e.title)}_${a}`),r=t[n];if(s(e)&&"string"==typeof r&&!(0,x.ND)(r)){let t=(0,x.VN)({id:r,type:e.type,items:e.items},{stepId:l});t&&(r=t)}return{label:e.title,key:n,value:r,visible:!0,selectable:!1,type:i??e.type}});if(n){let t=(0,_.C)(e.outputs);if(!t)throw Error("Could not locate submit user variable in step");let a=(0,g.d)(t);u.push({label:n,key:(0,p.f)(c,u.length),value:a,visible:!0,selectable:!1,type:i??d.TE.SlackTypesUserId})}if(r){let e=(0,h.L)(a);if(!e)throw Error("Could not locate trigger event timestamp");let t=(0,f.Q)(e.id,(0,y.JK)());u.push({label:r,key:(0,p.f)(c,u.length),value:t,visible:!0,selectable:!1,type:i??d.TE.SlackTypesTimestamp})}return u.map((e,t)=>({...e,index:t}))})((0,S.H)(t,n),t,a,r,l,s,c,o,i):void 0,getDynamicOptionsForGsheets=({parameter:e,value:t,variables:a,openFormSteps:n})=>{let r=C.t("Form Responses");return e.name===o.dC&&t===o.zK?[{label:r,value:o.zK,key:o.zK,selected:!0,visible:!0,selectable:!1}]:getDynamicOptions({parameter:e,value:t,variables:a,openFormSteps:n,personWhoSubmittedText:C.t("Submitted By"),timeSubmittedText:C.t("Timestamp"),optionType:d.TE.String})};var A=a(0xe874a88a),T=a(0x11e7de8ad),I=a(0x6cc5eee0);let N=new s.Ay("workflow_builder"),getSelectProps=({parameter:e,value:t,openFormSteps:a,functionId:r})=>{let l=N.t("Form Responses"),i=N.t("Create a spreadsheet from a form"),s=N.t("Your spreadsheets"),c=N.t("<{googleSheetUrl}|Open in Google Sheets>",{googleSheetUrl:`${o.BF}/${t}`,fallbackHash:"7a10b850695b39e3c427cb5bb0704d674b8e8858",fallbackHashNs:"files"}),d=N.t("When you save this step, we will create a new spreadsheet for you."),u=N.t("This sheet will be automatically generated from the values below."),m=t?[{id:"spreadsheet-link",message:n.createElement(I.A,{text:c})}]:void 0,p={label:l,value:o.zK};if(e.name===o.dC&&t===o.zK)return{selectedOption:t===o.zK?p:void 0,isDisabled:t===o.zK,hints:[{id:"open-form-create-sheet-hint",message:u}]};if(e.name===o.$S){let n,l,processOptions=async t=>e.name===o.$S&&a.length?A.S.resolve((0,w.ED)({options:t,steps:a,createText:i,existingText:s,wrappedFunctionId:r})):A.S.resolve(t);return t&&("string"==typeof t||"number"==typeof t)?(0,T.B)(t)?{hints:[{id:"open-form-create-spreadsheet-hint",message:d}],processOptions,selectedOption:(n=(0,w.uP)(t),l=a.find(e=>e.id===n),{label:l?.title,value:t})}:{hints:m,processOptions}:{processOptions}}};getSelectProps.displayName="getSelectProps";var M=a(0x1d3dd4cbe);let useGSheetsFunctionProps=({parameter:e,value:t,functionId:a,variables:r,canUserManageStep:l,onChange:i})=>{let{updateRequiredContext:s,updateParameterValue:c,openFormSteps:u}=(0,M.e)(),m=(0,n.useCallback)((e,t,a)=>{let n="string"==typeof a&&(0,w.De)(a,u);if(n){let t={...e};return t.config.inputs={...t.config.inputs,...(0,w.ue)(a,n,r)},s("{{event_timestamp}}"),t}return e},[u,r,s]),p=(0,n.useCallback)(a=>{t||e.name===o.dC&&1===a.length&&c({parameter:e,value:a[0].value,label:{[a[0].value]:a[0].label}})},[e,c,t]);if([o.yZ,o.m$].includes(a)){if(!l)return{processError:createGSheetsProcessError(e)};switch(e.dynamic_options.selectionType){case d.Il.SELECT:return{processError:createGSheetsProcessError(e),onValueChange:({value:t,dynamicOption:a})=>{let n=t&&!(0,T.B)(t)&&a?.label?{[t]:a.label}:void 0;i(e,t,n,{shouldSetSegmentState:w.sd,setSegmentState:m})},onSuccess:p,selectProps:getSelectProps({parameter:e,value:t,openFormSteps:u,functionId:a}),dynamicOptions:getDynamicOptionsForGsheets({parameter:e,value:t,variables:r,openFormSteps:u})};case d.Il.KEY_VALUE:return{processError:createGSheetsProcessError(e),dynamicOptions:getDynamicOptionsForGsheets({parameter:e,value:t,variables:r,openFormSteps:u})};default:throw Error("Unexpected [selectionType] in `useCustomFunctionProps`")}}return[o.zO,o.Ew,o.Qx,o.xh,o.g4,o.yq].includes(a)?{processError:createGSheetsProcessError(e)}:{}},useListsFunctionProps=({parameter:e,value:t,functionId:a,variables:n})=>{let{openFormSteps:r}=(0,M.e)();if([o.rr].includes(a))if(e.dynamic_options.selectionType===d.Il.KEY_VALUE)return{dynamicOptions:(({parameter:e,value:t,variables:a,openFormSteps:n,stepId:r})=>getDynamicOptions({parameter:e,value:t,variables:a,openFormSteps:n,keyAsIndex:!1,shouldUseDefaultTemplateMacro:shouldListsUseDefaultTemplateMacro,stepId:r}))({parameter:e,value:t,variables:n,openFormSteps:r,stepId:a})};else throw Error("Unexpected [selectionType] in `useCustomFunctionProps`");return{}},useNoopProps=()=>({});var L=a(0x1795b5c1b),O=a(0x145d46a61),F=a(0x226892387),D=a(0x9e671ad),P=a(0x12edaa96a),R=a(0x14abc22b0),B=a(0x2b7f0bcc),W=a(0x102edf836),V=a(0xb1ea448c),H=a(0xee467999),q=a(0x20f31dc25);let AlertMarkdown=({text:e})=>n.createElement(B.Ay,{type:"boxed",level:B.A_.error,align:"left"},n.createElement(I.A,{text:e}));AlertMarkdown.displayName="AlertMarkdown";var U=a(0x120c268ad),z=a.n(U),j=a(0x1feee1711),G=a(0x1407c6c2c),$=a(0x11a296110),K=a(0x1d1911997),Y=a(0x2501a2cee),Q=a(0x818fd090);let Z=new s.Ay("workflow_builder"),DefaultLabel=()=>n.createElement("span",{className:"italic"},Z.t("_blank_",{fallbackHash:"f9b302a6528230e8fad06287d3026dae18ccadf3"}));DefaultLabel.displayName="DefaultLabel";var J=a(0x85c4d21),X=a(0x1e19488b9),ee=a(0x1b3ecb90f),et=a(0x9b06c346),ea=a.n(et);let en=new s.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueLabelWithSelect=({variables:e,allowVariables:t,value:a,values:r,dynamicInputs:l,parameter:i,onChange:o,onRemove:s,formatVariableBeforeInsert:c,callbackId:d,functionId:u,workflowId:m,stepId:p,isExistingStep:b,functionVariables:f,isFunctionFormWrapped:g,onlyRenderChildInputs:h,focusOnMount:_,activeFieldName:y})=>{let{title:x}=i,v=`dynamic-inputs-key-value-input-${(0,G.A)()}`,{sendMessageToAnnouncerAPI:E}=(0,n.useContext)(R.A),k=(0,n.useCallback)(e=>e?`dynamicinputs-${i.name}-${e}-field`:`dynamicinputs-${i.name}-new-field`,[i.name]),w=(0,n.useMemo)(()=>k(a.key),[k,a.key]),S=(0,n.useCallback)(e=>{o({...a,value:e.value,valueLabel:"valueLabel"in e?e.valueLabel:void 0,filterQueries:"filterQueries"in e?e.filterQueries:void 0},a.key)},[o,a]),C=(0,n.useMemo)(()=>l.filter(e=>e.selectable||e.key===a?.key&&!a.empty).sort((e,t)=>(0,j.A)(e.originalIndex)||(0,j.A)(t.originalIndex)?0:e.originalIndex-t.originalIndex),[l,a?.key,a?.empty]),A=(0,n.useMemo)(()=>l.filter(({visible:e})=>!!e),[l]),T=(0,n.useMemo)(()=>C.map(e=>({label:e.label??e.value??"",value:e.key??""})),[C]),N=(0,n.useCallback)(e=>{let t=k(e?.value);o({...a,key:e.value,value:a?.value??""},t)},[k,o,a]),M=(0,n.useCallback)(e=>e.label&&"string"==typeof e.label?n.createElement("span",null,n.createElement(I.A,{text:e.label,emojiSize:ee.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0})):n.createElement(DefaultLabel,null),[]),L=(0,n.useMemo)(()=>{if(!a||a.empty)return;let e=l.find(e=>e.key===a?.key);return{label:e?.label??"",value:e?.key??""}},[a,l]),O=(0,n.useMemo)(()=>T.map(e=>`${e.label}:${e.value}`).join(","),[T]),F=(0,n.useCallback)(()=>{s(a),E({message:en.t("A field has been removed."),uuid:(0,P.A)()})},[s,a,E]),D=(0,n.useMemo)(()=>L?.value&&i.properties?.[L.value]?(0,Q.w)(i.properties[L.value]):void 0,[i.properties,L]),B=(0,n.useMemo)(()=>!!(h&&D?.isParameterFormWrapped),[h,D?.isParameterFormWrapped]),W=(0,n.useMemo)(()=>A.some(e=>{let t=e.key&&i.properties?.[e.key]?(0,Q.w)(i.properties[e.key]):void 0;return!t?.isParameterFormWrapped}),[i.properties,A]),V=(0,n.useMemo)(()=>B&&W,[W,B]);return n.createElement("div",{className:ea().row,"data-qa":`${w}-row`},n.createElement("div",{className:ea().cell},n.createElement(K.Ay,{key:O,ariaLabel:x,options:T,onOptionSelected:N,placeholderText:en.t("Select a field"),selectedOption:L,selectId:`input-select_${v}`,width:"100%",renderSelectedOption:M,renderOption:M,selectDataQa:w,retainPreviousSelectionOnDelete:!0,isDisabled:B,shouldRefocusInputAfterSelection:!0,expandOnFocus:!1,focusOnMount:_||y===w})),n.createElement("div",{className:ea().cell},n.createElement(J.J,{value:a?.value??"",values:r,parameter:i,variables:e,allowVariables:t,onChange:S,formatVariableBeforeInsert:c,callbackId:d,dynamicInput:a,elementId:v,functionId:u,workflowId:m,stepId:p,isExistingStep:b,functionVariables:f,isFunctionFormWrapped:g,isParameterSyncedWithForm:B,focusOnMount:!_&&y===a.key})),a&&!B?n.createElement("div",{className:z()(ea().closeIconCell,ea().overflowSpace,{align_self_start:a.type===X.J5.TimeStamp,margin_top_50:a.type===X.J5.TimeStamp})},n.createElement($.Nm,{"aria-label":en.t("Remove"),onClick:F},n.createElement(Y.Ah,{name:"close-filled"}))):null,V&&n.createElement("div",{className:ea().overflowSpace,"aria-hidden":!0}))};SlackFunctionDynamicInputsKeyValueLabelWithSelect.displayName="SlackFunctionDynamicInputsKeyValueLabelWithSelect";var er=a(0x1d2cd7755),el=a(0x223beeef);let SlackFunctionDynamicInputsKeyValueLabelWithText=({variables:e,allowVariables:t,value:a,values:r,dynamicInput:l,parameter:i,onChange:o,formatVariableBeforeInsert:s,callbackId:c,functionId:d,workflowId:u,stepId:m,serviceTriggerType:p,isExistingStep:b,functionVariables:f,isFunctionFormWrapped:g,onlyRenderChildInputs:h,focusOnMount:_})=>{let y=`dynamic-inputs-key-value-input-${(0,G.A)()}`,x=(0,n.useMemo)(()=>n.createElement(DefaultLabel,null),[]),v=(0,n.useCallback)(async e=>{o({...l,key:l.key,value:e.value,valueLabel:"valueLabel"in e?e.valueLabel:void 0,filterQueries:"filterQueries"in e?e.filterQueries:void 0})},[o,l]),E=(0,n.useMemo)(()=>l.key&&i.properties?.[l.key]?(0,Q.w)(i.properties[l.key]):void 0,[l.key,i.properties]),k=(0,n.useMemo)(()=>!!(h&&E?.isParameterFormWrapped),[h,E?.isParameterFormWrapped]),w=(0,n.useMemo)(()=>({...i,title:l.label}),[i,l.label]);return n.createElement("div",{className:z()(ea().row,{align_items_baseline:l.type===X.J5.TimeStamp})},n.createElement("div",{className:ea().cell},l.label?n.createElement(el.z,{elementId:y,parameter:w,className:`c-label--has_footer ${ea().cellLabel} `,noMarginBottom:!0,isBold:!1,isAlwaysRequired:l.is_required,isAlwaysOptional:!!i.dynamic_options.options?.is_required_path&&!l.is_required}):n.createElement(er.A,{htmlFor:y,text:x,className:ea().cellLabel,"data-qa-segment-parameter":i.name})),n.createElement("div",{className:ea().cell},n.createElement(J.J,{value:a,values:r,parameter:i,variables:e,allowVariables:t,onChange:v,formatVariableBeforeInsert:s,callbackId:c,dynamicInput:l,elementId:y,functionId:d,workflowId:u,stepId:m,serviceTriggerType:p,isExistingStep:b,functionVariables:f,isFunctionFormWrapped:g,isParameterSyncedWithForm:k,focusOnMount:_})))};SlackFunctionDynamicInputsKeyValueLabelWithText.displayName="SlackFunctionDynamicInputsKeyValueLabelWithText";var ei=a(0x1d4878a74);let eo=new s.Ay("workflow_builder"),es=["canvas_create","channel_canvas_create"],SlackFunctionDynamicInputsKeyValueInput=({value:e,values:t,parsedValues:a,label:r,parameter:l,onValueChange:i,functionId:o,workflowId:s,stepId:c,processError:u,callbackId:m,dynamicOptions:p,serviceTriggerType:b,triggerId:f,isTriggerSegment:g,variables:h,allowVariables:_,formatVariableBeforeInsert:y,isOAuthTokenInvalid:x,isExistingStep:v,functionVariables:E,isFunctionFormWrapped:k,onlyRenderParentInputs:w,onlyRenderChildInputs:S,onLoadingStateChange:C,hasOnlyKeyValueParameter:A})=>{let T=(0,F.d4)(O.$T),I=(0,q.f)({hierarchicalParameterName:[l.name],function:l.dynamic_options.function,workflowId:s,functionId:o,stepId:c,inputs:a,serviceTriggerType:b,triggerId:f,isTriggerSegment:g,isOAuthTokenInvalid:x}),{sendMessageToAnnouncerAPI:N}=(0,n.useContext)(R.A),M=(0,n.useRef)(null),L=l.dynamic_options.options?.max_inline_options??15,[U,z]=(0,n.useState)({}),{isLoading:j,isError:G,errorMessage:$,dynamicOptions:K,displayInline:Y,actions:Q}=(0,H.n)({client:I,value:e,label:r,reducerOptions:{inlineDisplayThreshold:L,processError:u,onValueChange:i,dynamicOptions:p,selectionType:d.Il.KEY_VALUE,isParameterFormWrapped:l.isParameterFormWrapped}}),Z=(0,n.useMemo)(()=>K.filter(e=>e.visible),[K]),J=(0,n.useMemo)(()=>Z.length,[Z.length]),X=(0,n.useMemo)(()=>K.filter(e=>e.selectable).length,[K]),ee=(0,n.useMemo)(()=>K.some(e=>e.empty),[K]),et=K.filter(e=>!e.empty),en=(0,n.useMemo)(()=>et.length,[et.length]),er=(0,n.useMemo)(()=>K.filter(e=>e.is_required).length,[K]),[el,ec]=(0,n.useState)(l.isParameterFormWrapped);(0,n.useEffect)(()=>{M.current&&J-er==0&&M.current.focus()},[J,er]),(0,n.useEffect)(()=>{T&&en&&i?.({value:Z,nonEmptyDynamicOptions:et})},[T,en]),(0,n.useEffect)(()=>{T&&C&&C(j)},[T,j,C]),(0,n.useEffect)(()=>{"function"!=typeof i||(0,D.A)(el,l.isParameterFormWrapped)||(ec(l.isParameterFormWrapped),i({value:Z,nonEmptyDynamicOptions:et}))},[el,l.isParameterFormWrapped]);let ed=(0,n.useCallback)(()=>{Q.ADD_EMPTY_OPTION(),z({name:""}),N({message:eo.t("A field has been added, and it has been selected."),uuid:(0,P.A)()})},[Q,N]),eu=(0,n.useCallback)((e,t)=>{Q.CHANGE_OPTION(e),z({name:t})},[Q,z]),em=eo.t("Fields to update"),ep=l.title||em,eb=eo.t("Values"),ef=(0,n.useCallback)(e=>{Q.CHANGE_OPTION(e),z({name:e.key})},[Q]),eg=(0,n.useCallback)(e=>{let t=Z.filter(e=>!e.is_required),a=t.findIndex(t=>t.key===e.key),n=t[a-1]??t[a+1];n?z({name:n.key,focusOnMount:!0}):z({name:void 0,focusOnMount:void 0}),Q.REMOVE_OPTION(e)},[Q,z,Z]),renderHeader=(e=!1)=>{let t=m&&es.includes(m);return n.createElement("div",{className:ea().headerRow,"data-qa":`dynamicinputs-${l.name}-key-value-header`},t?n.createElement("div",{className:ea().headerCell},eo.t("Update canvas variables")):n.createElement(n.Fragment,null,n.createElement("div",{className:ea().headerCell},ep),n.createElement("div",{className:ea().headerCell},e?eo.t("Values (required)"):eb)))};return(renderHeader.displayName="renderHeader",w)?null:j?n.createElement("div",{className:"margin_right_150"},n.createElement(V.A,{color:"blue",size:"jumbo"})):G&&$?n.createElement(AlertMarkdown,{text:$}):K&&(l.is_required||0!==K.length)?l.is_required&&0===K.length?n.createElement(B.Ay,{type:"boxed",level:"warning",icon:"warning",align:"left"},n.createElement("span",null,eo.t("The step cannot be saved because {fieldName} field is required but there are no available options for it.",{fieldName:ep}))):Y?n.createElement(n.Fragment,null,!A&&n.createElement("hr",null),renderHeader(),Z.map(e=>n.createElement(SlackFunctionDynamicInputsKeyValueLabelWithText,{key:e.key||e.index,parameter:l,dynamicInput:e,value:e.value??"",values:t,onChange:ef,functionId:o,workflowId:s,stepId:c,callbackId:m,serviceTriggerType:b,variables:h,allowVariables:_,formatVariableBeforeInsert:y,isExistingStep:v,functionVariables:E,isFunctionFormWrapped:k,onlyRenderChildInputs:S,focusOnMount:U.name===e.key}))):n.createElement("div",{className:ea().withSelect},!A&&n.createElement("hr",null),er>0?renderHeader(!0):null,Z.map(e=>e.is_required?n.createElement(SlackFunctionDynamicInputsKeyValueLabelWithText,{key:e.key||e.index,parameter:l,dynamicInput:e,value:e.value??"",values:t,onChange:ef,functionId:o,workflowId:s,stepId:c,callbackId:m,serviceTriggerType:b,variables:h,allowVariables:_,formatVariableBeforeInsert:y,isExistingStep:v,functionVariables:E,isFunctionFormWrapped:k,onlyRenderChildInputs:S,focusOnMount:U.name===e.key}):null),!!L&&!T&&n.createElement(B.Ay,{type:"boxed",level:"default",icon:"slack-logo",align:"left",className:ea().alert},n.createElement("span",null,er>0?eo.t("You can add optional fields below and assign values to them."):eo.t("There are {count} fields. You can add fields below and assign values to them.",{count:en}))),renderHeader(),Z.map(e=>e.is_required?null:n.createElement(SlackFunctionDynamicInputsKeyValueLabelWithSelect,{key:e.key||e.index,parameter:l,value:e,values:t,dynamicInputs:K,onChange:eu,onRemove:eg,functionId:o,workflowId:s,stepId:c,callbackId:m,variables:h,allowVariables:_,formatVariableBeforeInsert:y,isExistingStep:v,functionVariables:E,isFunctionFormWrapped:k,onlyRenderChildInputs:S,focusOnMount:U.name===e.key&&(U.focusOnMount??""===e.key),activeFieldName:U.name})),X>0?n.createElement("div",null,n.createElement(ei.A,null,n.createElement(W.Ay,{type:"outline",size:"small",onClick:ed,disabled:ee,"aria-label":eo.t("Add a Field"),ref:M},eo.t("Add a Field"))),T&&n.createElement("span",{className:ea().availableFields},eo.rt("{selectableDynamicInputCount, plural, =1 {# field} other {# fields}} available",{selectableDynamicInputCount:X}))):null):null};SlackFunctionDynamicInputsKeyValueInput.displayName="SlackFunctionDynamicInputsKeyValueInput";var ec=a(0x18af67efb),ed=a(0x1d01572a2),eu=a(0x1ad596f5f),em=a(0x235d78b7c),ep=a(0x5fb545d6),eb=a(0x40e8839e),ef=a(0xf33a4f91),eg=a(0x152e7cb26),eh=a(0x1ba35eb3b),e_=a(0x1b05cc3ce),ey=a(0x207fb9b92),ex=a(0x1d1437423),ev=a(0x4a120eb2);let eE=new s.Ay("workflow_builder"),SlackFunctionDynamicInputsMultiSelect=({value:e,label:t,values:a,parsedValues:l,parameter:i,onChange:s,required:c,placeholderText:u,functionId:m,workflowId:p,stepId:b,isExistingStep:f,variables:g={list:[],groups:[]},formatVariableBeforeInsert:h,dynamicOptions:_,client:y,serviceTriggerType:x,triggerId:v,isTriggerSegment:E,allowVariables:k,hasDependentField:S,isOAuthTokenInvalid:C,hideLabel:A})=>{let[T,N]=(0,n.useState)(),[L,O]=(0,n.useState)((0,w.mU)(t)??{}),F=(0,G.A)(),[R,B]=(0,n.useState)(F),{onVariableMenuOpen:W}=(0,M.e)(),{name:U,title:z,typeahead:j,typeaheadQueryKey:$,description:K,hint:Y,isParameterFormWrappable:Q}=i,Z=j&&!C,J=!!i.dynamic_options.validation,X=(0,q.f)({hierarchicalParameterName:[i.name],function:i.dynamic_options.function,workflowId:p,functionId:m,stepId:b,values:a,inputs:l,isExistingStep:f,hasValidationFunction:J,serviceTriggerType:x,triggerId:v,isTriggerSegment:E,isOAuthTokenInvalid:C}),et=y||X,ea=i.dynamic_options.request_config?.search?.min_query_length??o.Bp,{isLoading:en,dynamicOptions:er,actions:ei,processSelectOptions:eo,errorCode:es,errorMessage:ek}=(0,H.n)({client:et,value:e,reducerOptions:{selectionType:d.Il.MULTI_SELECT,dynamicOptions:_},typeahead:{typeaheadQueryKey:$},minQueryLength:ea}),ew=(0,n.useMemo)(()=>{if(Y)return[{id:`${U}-hint`,message:Y}]},[Y,U]),eS=eE.t("Select option\u2026"),eC=eE.t("Search options\u2026"),eA=Z?eC:eS,eT=Z?o.vD:o.hU,{errorText:eI,onBlur:eN}=(0,ey.K)({errorMessage:eE.t("This field is required."),isErrored:!!((c||(0,e_.L$)(i))&&!Q)&&(0,r.A)(e)}),[eM,eL]=(0,n.useState)([]);(0,n.useEffect)(()=>{er.length>0&&eL(e=>(0,ec.A)([...e,...er],"value"))},[er]);let{errorText:eO,onChange:eF}=(0,ex.x)({errorMessage:eE.t("1 or more selections are no longer available. Remove to continue."),isErrored:J&&(0,ep.b)(e,eM),shouldErrorPreventSave:!0});(0,ed.A)(eF);let eD=!("can_flatten"in i&&i.can_flatten)&&e&&"string"!=typeof e&&e.length>1&&e.some(e=>(0,ef.x1)(g,String(e))),{errorText:eP,onChange:eR}=(0,ex.x)({errorMessage:eE.t("Variables containing multiple items must be alone",{fallbackHash:"02605f6dabeee59a9b76627b21f072b71011da74"}),isErrored:!!eD,shouldErrorPreventSave:!0}),eB=(0,n.useCallback)(()=>B((0,P.A)()),[]),eW=(0,n.useCallback)(e=>(0,eg.Y)({value:e,typeahead:Z,minQueryLength:ea,errorCode:es}),[es,Z,ea]),eV=(0,w.D$)({emptyErrorMessage:eI,apiErrorMessage:ek,mixedArrayErrorMessage:eP,validationErrorMessage:eO}),eH=(0,n.useCallback)(e=>e.map(({value:e})=>e),[]),eq=(0,n.useCallback)((e,t)=>{let a=t&&!(0,r.A)(t)?{[o.x3]:t}:{};return e?.reduce((e,t)=>(e[t.value]=t.label,e),a)},[]),eU=(0,n.useCallback)(e=>{if(!e)return void s(i,[]);let t=e.reduce((e,t)=>{let a=t.value;return a in L&&(e[a]=L[a]),e},{});1===e.length&&"string"==typeof e[0].value&&(0,ef.x1)(g,e[0].value)?s(i,e[0].value,eq(e,t),{shouldInvalidateDependentInputs:!1}):s(i,eH(e),eq(e,t),{shouldInvalidateDependentInputs:!1}),eR(),eF()},[L,eq,eH,s,eR,i,g,eF]),ez=(0,n.useCallback)((a,n)=>(0,eb.l)({optionValue:a,index:n,variables:g,value:e,label:t,dynamicOptions:J?eM:void 0}),[g,e,t,J,eM]),ej=(0,n.useMemo)(()=>{if((0,r.A)(e)||!e)return[];let t=Array.isArray(e)?e:[e];return t?.map((e,t)=>{let a=er.find(t=>(0,D.A)(t.value,e));return a?{key:`${t}-${e}`,label:a.label||"",value:a.value||e}:"string"==typeof e?ez(e,t):{key:`${t}-${e}`,label:"",value:e}})},[er,ez,e]),eG=(0,n.useCallback)(e=>{T&&(O(t=>({...t,[e.value]:T})),N(void 0))},[T,O]),e$=!eI&&!ek&&!eP&&!eO,eK=(0,n.useCallback)(async e=>{e&&N(e);let t=[],a=!!(e||T);if(Z&&a)try{let{options:a,value_type:n}=await et.fetchOptions({typeaheadQueryKey:$,typeaheadQueryValue:e});ei.FETCH_OPTIONS_SUCCESS(a,n),t=eo(a,n)}catch(e){ei.FETCH_OPTIONS_ERROR(e)}else t=(0,eu.A)(er,e);return t},[ei,et,er,T,Z,eo,$]),eY=(0,n.useCallback)(e=>{let t=e.label??e.value;return n.createElement("span",null,n.createElement(I.A,{text:t,emojiSize:ee.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}))},[]),eQ=(0,n.useCallback)(e=>!!i&&(i.type===d.TE.Array&&"items"in i?(0,eh.yH)(e,i)||(0,eh.xY)({variable:e,parameter:i}):(0,eh.Lm)({variable:e,parameter:i})||(0,eh.xY)({variable:e,parameter:i})),[i]),eZ=(0,n.useCallback)(e=>{let t=ez((h?.(e,{})??e).id,ej.length);eU(ej.concat(t)),eB()},[h,ez,ej,eU,eB]),eJ=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement(el.z,{elementId:F,parameter:i,hideLabel:A},n.createElement("div",{className:"display_flex full_width"},en?n.createElement(V.A,{color:"blue",size:"small",className:"align_self_center"}):n.createElement(ev.x,{key:R,ariaLabel:z,search:eK,debounceWaitPeriod:eT,onSelectedItemsChange:eU,emptyStateMessage:eW,minQueryLength:C?void 0:ea,placeholderText:u||K||eA,selectedOptions:ej,selectId:`input-multi-select_${F}`,width:"100%",onBlur:eN,isInvalid:!e$,errors:eV,renderOption:eY,expandOnFocus:!0,selectDataQa:`dynamicinputs-${i.name}-multi-select`,className:"full_width",hints:ew,onOptionSelected:eG}),k&&n.createElement(em.jx,{value:e,onSelect:eZ,data:g.groups,customDataFilter:eQ,renderIconInline:!0,isDisabled:en,onMenuTriggerClick:W,hasDependentField:S,allowEmptyState:!0,className:"margin_left_50 margin_top_50 display_flex align_items_start",inputType:i.type,suggestedVariableConfig:eJ})))};SlackFunctionDynamicInputsMultiSelect.displayName="SlackFunctionDynamicInputsMultiSelect";var ek=a(0x1fc996df8),ew=a(0x88881d67),eS=a(0xcb24a23b),eC=a(0x4b32db5f);let eA=new s.Ay("workflow_builder"),SlackFunctionDynamicInputsVariableMultiSelectInput=({value:e,parameter:t,onChange:a,variables:l,formatVariableBeforeInsert:i,label:o,hideLabel:s})=>{let c=(0,G.A)(),{name:u,title:m,description:p,hint:b}=t,{onVariableMenuOpen:f}=(0,M.e)(),g=(0,n.useMemo)(()=>{if(b)return[{id:`${u}-hint`,message:b}]},[u,b]),[h,_]=(0,n.useState)(c),y=(0,n.useCallback)(()=>_((0,P.A)()),[]),x=!!(t.is_required||(0,e_.L$)(t)),v=(0,n.useCallback)(e=>!!t&&(t.type===d.TE.Array&&"items"in t?(0,eh.yH)(e,t)||(0,eh.xY)({variable:e,parameter:t}):(0,eh.Lm)({variable:e,parameter:t})||(0,eh.xY)({variable:e,parameter:t})),[t]),E=(0,n.useMemo)(()=>(0,ew.PW)(l.groups,v),[v,l.groups]),k=(0,n.useMemo)(()=>(0,eC.T)(E),[E]),w=(0,n.useCallback)(async e=>(0,eu.A)(k,e),[k]),[S]=(0,n.useMemo)(()=>(0,eS.g)({variables:l,id:u,value:e,isRequired:x,parameter:t}),[l,u,e,x,t]),C=(0,n.useCallback)((t,a)=>(0,eb.l)({optionValue:t,index:a,variables:l,value:e,label:o}),[o,l,e]),{onBlur:A,okayToDisplay:T}=(0,ey.K)({errorMessage:void 0,isErrored:S.length>0,shouldErrorPreventSave:!0}),I=(0,n.useCallback)(e=>{a(t,e.map(e=>e.value))},[a,t]),N=(0,n.useMemo)(()=>(0,r.A)(e)?[]:"string"==typeof e?[C(e,0)]:(e||[]).map((e,t)=>C(String(e),t)),[C,e]),L=(0,n.useCallback)(e=>{let t=C((i?.(e,{})??e).id,N.length);N.find(e=>e.value===t.value)||I(N.concat(t)),y()},[i,C,N,y,I]),O=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement(el.z,{elementId:c,parameter:t,hideLabel:s},n.createElement("div",{className:"display_flex full_width"},n.createElement(ev.x,{key:h,ariaLabel:m,search:w,width:"100%",hints:g,selectId:`input-variable-multi-select_${c}`,selectDataQa:`dynamicinputs-${u}-variable-multi-select`,errors:T?S:void 0,onBlur:A,expandOnFocus:!0,selectedOptions:N,onSelectedItemsChange:I,isInvalid:S.length>0&&T,className:"full_width",placeholderText:p||eA.t("Select option\u2026")}),n.createElement(em.jx,{value:e,onSelect:L,data:l.groups,customDataFilter:v,className:"margin_left_50 margin_top_50 display_flex align_items_start",renderIconInline:!0,onMenuTriggerClick:f,inputType:t.type,suggestedVariableConfig:O})))};SlackFunctionDynamicInputsVariableMultiSelectInput.displayName="SlackFunctionDynamicInputsVariableMultiSelectInput";var eT=a(0x204ee6449),eI=a(0x162b19a86),eN=a(0xa03b6325),eM=a(0x2772625d),eL=a(0x8d66e557),eO=a(0x19c76d181),eF=a(0x157b4a886),eD=a(0x20cfa1dc2);let eP={groups:[],list:[]},SlackFunctionDynamicInputs=({value:e,label:t,values:a,parameter:s,onChange:c,functionId:u,workflowId:m,variables:p,formatVariableBeforeInsert:b,callbackId:f,oAuthParameter:g,stepId:h,stepErrorCode:_,isExistingStep:y,serviceTriggerType:x,triggerId:v,isTriggerSegment:E,allowVariables:k,hasDependentField:S,functionVariables:C,isFunctionFormWrapped:A,onlyRenderChildInputs:T,onlyRenderParentInputs:I,hideLabel:N,isParameterSyncedWithForm:M,onLoadingStateChange:D,hasOnlyKeyValueParameter:P})=>{let R=(0,F.d4)(eO.WR),B=(0,w.Bp)(s.dynamic_options?.inputs,a),W=(0,eI.Q$)(B),V=!1;"parentInputs"in s&&Array.isArray(s.parentInputs)&&s.parentInputs.length&&!(0,r.A)(W)&&!(0,eL.e)(f)&&(V=(g?s.parentInputs.filter(e=>e!==g.name):s.parentInputs).some(e=>{let t=W[e]?W[e]:a?.[e]?.value;return Array.isArray(t)?t.some(e=>(0,eM.bs)(e)):(0,eM.bs)(t)}));let H=g?W?.[g.name]:void 0,q=(0,n.useMemo)(()=>(0,w._Y)({parsedParameterValues:W,callbackId:f}),[f,W]),U=(0,F.d4)(e=>g?(0,eF.JG)(e,{functionId:u,providerKey:g.oauth2_provider_key}):void 0),z=!g||U&&(0,w.jS)({currentUserId:R,functionAuth:U}),j=(0,n.useMemo)(()=>{let e=(0,eN.L)(H)&&U?.validTokens?.some(({externalTokenId:e})=>e===H.external_token_id);return(_===eD.oh.INVALID_EXTERNAL_TOKEN_IDS||_===eD.oh.INVALID_SERVICE_TRIGGER_EXTERNAL_TOKEN_IDS)&&!e},[U,H,_]),G=(({parameter:e,onChange:t})=>{let a=(0,F.d4)(O.$T);switch(e.dynamic_options.selectionType){case d.Il.SELECT:{let a="typeahead"in e&&!!e.typeahead;return{processError:t=>{if(t)return(0,w.P)({parameter:e,error:t?.data})},onValueChange:({value:n,dynamicOption:r})=>{let l=r&&"filterQueries"in r?r.filterQueries:void 0,i=a&&l?{[o.x3]:l}:{},s=n&&r?{...i,[n]:r.label}:void 0;t(e,n,s)}}}case d.Il.MULTI_SELECT:return{};case d.Il.KEY_VALUE:return{processError:t=>{if(t)return(0,w.P)({parameter:e,error:t?.data})},onValueChange:({value:n,nonEmptyDynamicOptions:r,isNewDynamicOption:l})=>{let{value:i,label:o}=(0,w.$w)({value:n,parameter:e,dynamicOptions:r}),s=r?.filter(({visible:e})=>!!e)??[];t(e,i,o,{shouldSetSegmentState:()=>(0,w.sg)(e)&&!!r?.length,setSegmentState:(e,t,n)=>(0,L.g)(e,t,a?r??[]:s,!a&&l),dynamicInputState:{options:r}})}};default:throw Error("Unexpected [selectionType] in `useDefaultProps`")}})({parameter:s,onChange:c}),$=(({parameter:e,value:t,functionId:a,variables:n,canUserManageStep:r,onChange:l})=>(e=>{switch(e){case o.yZ:case o.m$:case o.zO:case o.Ew:case o.Qx:case o.xh:case o.g4:case o.yq:return useGSheetsFunctionProps;case o.rr:return useListsFunctionProps;default:return useNoopProps}})(a)({parameter:e,value:t,functionId:a,variables:n,canUserManageStep:r,onChange:l}))({parameter:s,value:e,functionId:u,variables:p,canUserManageStep:z,onChange:c}),K={...G,...$},renderDI=()=>{switch(s.dynamic_options.selectionType){case d.Il.SELECT:if(M)return n.createElement(i.C,{value:e,parameter:s,variables:p});if(k&&V)return n.createElement(eT.F,{value:e||"",parameter:s,onChange:c,variables:p??eP,formatVariableBeforeInsert:b,hideLabel:N});return n.createElement(ek.L,{key:s.name,value:e||"",label:t,values:a,parsedValues:W,parameter:s,required:!!s.is_required,functionId:u,workflowId:m,stepId:h,callbackId:f,isExistingStep:y,variables:p,allowVariables:k,formatVariableBeforeInsert:b,serviceTriggerType:x,triggerId:v,isTriggerSegment:E,hasDependentField:S,isOAuthTokenInvalid:j,hideLabel:N,...K});case d.Il.MULTI_SELECT:if(M)return n.createElement(i.C,{value:e,parameter:s,variables:p});if(k&&V)return n.createElement(SlackFunctionDynamicInputsVariableMultiSelectInput,{value:e,parameter:s,onChange:c,label:t,variables:p??eP,formatVariableBeforeInsert:b,hideLabel:N});return n.createElement(SlackFunctionDynamicInputsMultiSelect,{key:s.name,value:e,label:t,values:a,parsedValues:W,parameter:s,required:!!s.is_required,onChange:c,functionId:u,workflowId:m,stepId:h,isExistingStep:y,variables:p,allowVariables:k,formatVariableBeforeInsert:b,serviceTriggerType:x,triggerId:v,isTriggerSegment:E,hasDependentField:S,isOAuthTokenInvalid:j,hideLabel:N});case d.Il.KEY_VALUE:if(V)return;return n.createElement(SlackFunctionDynamicInputsKeyValueInput,{key:s.name,value:e??l.t0,values:a,parsedValues:W,label:t,parameter:s,variables:p,allowVariables:k,formatVariableBeforeInsert:b,callbackId:f,functionId:u,workflowId:m,stepId:h,serviceTriggerType:x,triggerId:v,isTriggerSegment:E,isOAuthTokenInvalid:j,isExistingStep:y,functionVariables:C,isFunctionFormWrapped:A,onlyRenderParentInputs:I,onlyRenderChildInputs:T,onLoadingStateChange:D,hasOnlyKeyValueParameter:P,...K});default:return null}};return(renderDI.displayName="renderDI",q)?null:n.createElement(n.Fragment,null,renderDI())};SlackFunctionDynamicInputs.displayName="SlackFunctionDynamicInputs"},0x85c4d21:(e,t,a)=>{"use strict";a.d(t,{J:()=>SlackFunctionDynamicInputsKeyValueInput});var n=a(0xbad225b5),r=a(0x21f3c49e8),l=a(0x20482ad21),i=a(0x11a296110),o=a(0xb1ea448c),s=a(0x8716533d),c=a(0x818fd090),d=a(0xa4a4f43b),u=a(0x9e671ad),m=a(0x12edaa96a),p=a(0x15014e268),b=a(0x235d78b7c),f=a(0x242822dfb),g=a(0x137f92494),h=a(0x21e82d4ab),_=a(0x1d3dd4cbe),y=a(0x668181b3),x=a(0x2772625d),v=a(0x1d62f3e69),E=a(0x207fb9b92);let k=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueBooleanInput=({value:e,parameter:t,variables:a={list:[],groups:[]},allowVariables:r,onChange:l,customDataFilter:i,formatVariableBeforeInsert:o,elementId:s,ariaLabel:c="",dynamicInput:d,isValidEmptyObject:w,hasInvalidVariable:S})=>{let[C,A]=(0,n.useState)(s),T=(0,n.useCallback)(()=>A((0,m.A)()),[]),{onVariableMenuOpen:I}=(0,_.e)(),{isParameterFormWrappable:N}=t,M=!!d.is_required&&!N,L=(0,n.useCallback)(e=>{if("string"==typeof e.value&&(0,x.bs)(e.value)){let t=(0,y.x)(a.list,e.value);return t||(t=(0,v.x7)(e.value,d.type)),n.createElement(h.j,{variable:t})}return n.createElement("span",null,e.label??e.value)},[d,a.list]),O=(0,n.useCallback)(e=>{if("string"==typeof e.value&&(0,x.bs)(e.value)){let t=(0,y.x)(a.list,e.value),r=(0,v.x7)(e.value,d.type);return n.createElement(h.j,{variable:t||r,defaultStyle:"highlight"})}return n.createElement("span",null,e.label??e.value)},[d.type,a.list]),F=(0,n.useMemo)(()=>{if(e&&"string"==typeof e)return(0,g.r)(a.list,e)},[e,a.list]),D=(0,n.useMemo)(()=>{let e=[{label:k.t("Yes"),value:"true"},{label:k.t("No"),value:"false"}];return F&&e.push(F),T(),e},[F,T]),P=(0,n.useMemo)(()=>{if(F)return F;let t=String(e),a=D.find(e=>(0,u.A)(e.value,t));return a||(t?{label:"",value:t}:void 0)},[D,F,e]),R=(0,n.useCallback)(e=>{null===e.value?l({value:null}):l({value:"true"===e.value}),setTimeout(()=>T(),0)},[l,T]),B=!M||w||!1===e||e?void 0:k.t("This field is required."),W=(0,n.useMemo)(()=>S?k.t("This variable is not supported in this input field."):void 0,[S]),V=(0,f.D$)({emptyErrorMessage:B,invalidVariableErrorMessage:W}),{errorText:H,onBlur:q}=(0,E.K)({errorMessage:B??W,isErrored:!!V?.length,shouldErrorPreventSave:!0,shouldErrorShowImmediately:!B}),U=(0,n.useCallback)(e=>{l({value:(o?.(e,{})??e).id})},[o,l]),z=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement("div",{className:"display_flex"},n.createElement("div",{className:"full_width display_flex"},n.createElement(p.Ay,{options:D,renderOption:L,renderSelectedOption:O,selectedOption:P,onOptionSelected:R,className:"flex_one no_min_width",width:"100%",placeholderText:k.t("Select option\u2026"),selectId:s,key:C,ariaLabel:c,isInvalid:!!H,errors:V,onBlur:q,isRequired:M}),r&&n.createElement(b.jx,{value:e,onSelect:U,data:a.groups,customDataFilter:i,renderIconInline:!0,onMenuTriggerClick:I,inputType:d.type,suggestedVariableConfig:z,allowEmptyState:!0,className:"margin_left_50 margin_top_50 display_flex"})))};SlackFunctionDynamicInputsKeyValueBooleanInput.displayName="SlackFunctionDynamicInputsKeyValueBooleanInput";var w=a(0x2503b7c1),S=a(0x1e586fbba),C=a(0x380ee7b0),A=a(0x1558db00c);let T=new l.Ay("workflow_builder"),I={width:"100%"},SlackFunctionDynamicInputsKeyValueDateInput=({value:e,parameter:t,variables:a,allowVariables:r,onChange:l,formatVariableBeforeInsert:i,elementId:o,ariaLabel:s="",customDataFilter:c,dynamicInput:d,isValidEmptyObject:u,hasInvalidVariable:m})=>{let{viewOnly:p,onVariableMenuOpen:g}=(0,_.e)(),{isParameterFormWrappable:h}=t,y=a?a.groups:[],x=!u&&!!d.is_required&&!e&&!h,{errorId:v,errorMessage:k,isErrored:N}=(0,n.useMemo)(()=>{switch(!0){case x:return{errorId:"is_required",errorMessage:T.t("This field is required."),isErrored:!0};case m:return{errorId:"invalid_variable",errorMessage:T.t("This variable is not supported in this input field."),isErrored:!0};default:return{errorId:void 0,errorMessage:void 0,isErrored:!1}}},[x,m]),{errorText:M,onBlur:L}=(0,E.K)({errorMessage:k,isErrored:N,shouldErrorPreventSave:!0,shouldErrorShowImmediately:!!v&&"is_required"!==v}),O=(0,n.useCallback)(e=>l({value:i(e,{parameterType:t.type}).id}),[i,l,t.type]),F=(0,n.useMemo)(()=>{if("string"==typeof e&&a)return(0,f.r2)(a.list,e)},[e,a]),D=(0,n.useCallback)(e=>{l({value:e})},[l]),P=M?n.createElement(S.A,null,M):null,R=(0,n.useMemo)(()=>({enable:!0}),[]);return F&&a?n.createElement(n.Fragment,null,n.createElement(C.P,{onChange:D,value:e??"",variables:a,customDataFilter:c,label:s,isDisabled:p,formatVariableBeforeInsert:i,parameterType:d.type&&(0,A.G)(d.type)?d.type:void 0}),P):n.createElement(n.Fragment,null,n.createElement("div",{className:"display_flex"},n.createElement(w.b,{onDateChange:D,inputClassName:"margin_bottom_100",dateFormat:"YYYY-MM-DD",displayFormat:"YYYY-MM-DD",selectedDate:e??"",id:o,datePlaceholder:T.t("Select a date"),datePickerDisabled:p,"aria-label":s,onBlur:L,isInvalid:!!M,containerStyle:I}),r&&n.createElement(b.jx,{value:e,onSelect:O,data:y,customDataFilter:c,renderIconInline:!0,isDisabled:p,onMenuTriggerClick:g,inputType:d.type,suggestedVariableConfig:R,allowEmptyState:!0,className:"margin_left_50 margin_top_50 display_flex"})),P)};SlackFunctionDynamicInputsKeyValueDateInput.displayName="SlackFunctionDynamicInputsKeyValueDateInput";var N=a(0x120c268ad),M=a.n(N),L=a(0xe874a88a),O=a(0x2264e6ea3),F=a(0x1ad596f5f),D=a(0x6b359530),P=a(0x88881d67),R=a(0x1c09d8c36),B=a(0x40e8839e),W=a(0xfd04a21a),V=a(0xf33a4f91),H=a(0xcb24a23b),q=a(0x4b32db5f),U=a(0x408bdeff),z=a(0x10d53599f),j=a(0x19dc73101),G=a(0x1aad32b98),$=a(0x1795d8821),K=a(0x2a3fb7ec),Y=a(0x16ed1b0dc),Q=a(0xa985ed31),Z=a(0x4f725d55),J=a(0x226892387),X=a(0xe684f705),ee=a(0xdcfa8f6a),et=a.n(ee);let ea=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsMultiSelectEntities=({value:e,parameter:t,parentParameterName:a,variables:l={list:[],groups:[]},allowVariables:i,onChange:o,formatVariableBeforeInsert:s,elementId:c,ariaLabel:d="",customDataFilter:u,dynamicInput:m,isValidEmptyObject:p})=>{let f=(0,J.d4)(X.cA),{onVariableMenuOpen:g}=(0,_.e)(),{name:h}=t??{},y=m.type,x=ea.t("Select users"),v=ea.t("Select channels"),k=ea.t("Select canvases",{fallbackHash:"6b63a8fee06690326b5a1b0522f47b8b49fd9249",fallbackHashNs:"workflow_builder"}),w=ea.t("Select lists",{fallbackHash:"f6cb8141bafc16ddc019d01dbc0b40ca628b8ff7",fallbackHashNs:"workflow_builder"}),S="multi-select-user-id";switch(y){case $.TE.SlackTypesUserId:S="multi-select-user-id";break;case $.TE.SlackTypesChannelId:S="multi-select-channel-id";break;case $.TE.SlackTypesCanvasId:S="multi-select-canvas-id";break;case $.TE.SlackTypesListId:S="multi-select-list-id";break;default:S="multi-select-user-id"}let C=(0,n.useCallback)(e=>{if(!e)return"";switch(e){case $.TE.SlackTypesUserId:return x;case $.TE.SlackTypesChannelId:return v;case $.TE.SlackTypesCanvasId:return k;case $.TE.SlackTypesListId:return w;default:return x}},[k,v,w,x]),[A,T]=(0,n.useMemo)(()=>(0,H.g)({variables:l,id:`${h}-${c}`,value:e,isRequired:!!m.is_required,parameter:t,isValidEmptyObject:p}),[l,h,c,e,m.is_required,t,p]),I=(0,n.useCallback)((t,a)=>(0,B.l)({optionValue:t,index:a,variables:l,value:e??""}),[e,l]),N=(0,n.useMemo)(()=>(0,P.PW)(l.groups,u),[u,l.groups]),ee=(0,n.useMemo)(()=>i?(0,q.T)(N):[],[i,N]),{onBlur:en,okayToDisplay:er}=(0,E.K)({errorMessage:void 0,isErrored:A.length>0,shouldErrorPreventSave:!0}),el=(0,n.useCallback)(e=>(en(),1===e.length&&l&&(0,V.x1)(l,String(e[0])))?o({value:String(e[0])}):e.length?o({value:e}):o({value:null}),[en,o,l]),ei=(0,n.useCallback)(e=>e?.length?el(e.map(e=>e.value)):void el({value:[]}),[el]),eo=(0,n.useMemo)(()=>(0,r.A)(e)||!e?[]:(Array.isArray(e)?e:[e]).map((e,t)=>I(String(e),t)),[I,e]),es=(0,n.useMemo)(()=>{let e=[$.TE.SlackTypesChannelId,$.TE.SlackTypesUserId,$.TE.SlackTypesCanvasId,$.TE.SlackTypesListId];if((0,K.X)(e,m.type))return{...{[$.TE.SlackTypesChannelId]:V.L6,[$.TE.SlackTypesUserId]:V.R_,[$.TE.SlackTypesCanvasId]:V.jO,[$.TE.SlackTypesListId]:V.vU}[m.type],filter:e=>m.type!==$.TE.SlackTypesTeamId||!(0,O.JV)(e.id)&&(0,G.nO)(f,e.id)}},[m.type,f]),ec=(0,n.useCallback)(e=>(0,Y.A)(e.value)?n.createElement(W.A,{channelId:e.value,showTeamForLocalChannels:!0}):(0,Z.A)(e.value)?n.createElement(z.A,{id:e.value,showAvatar:!0,useShortMode:!0,showPresence:!1}):(0,Q.A)(e.value)?n.createElement(U.A,{id:e.value}):e.data&&e.data.label?n.createElement(D.R,{data:e.data}):e.label,[]),ed=(0,n.useCallback)((e,t)=>{let a=[];if(i){let e=(0,F.A)(ee,t);e.length>0&&a.push(...e)}return e.length>0&&a.push(...e),L.S.resolve(a)},[i,ee]),eu=(0,n.useCallback)(t=>{let a=[];a=Array.isArray(e)?e:e?[e]:[];let n=s?.(t,{})??t;a.includes(n.id)||o({value:[...a,n.id]})},[s,o,e]),em=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement("div",{className:"display_flex"},n.createElement(j.h,{key:c,id:c,selectId:c,className:M()(et().entity),width:"100%",onSelectedItemsChange:ei,renderSelectedOption:ec,selectedOptions:eo,searcherOptions:es,renderOption:ec,processOptions:ed,placeholderText:C(y),isInvalid:A.length>0&&er,errors:er?A:void 0,expandOnFocus:!0,selectDataQa:`dynamicinputs-${a}-${m.key}-${S}`,ariaLabel:d,onBlur:en,minOptionsListWidth:R.XK,invalidSelectedTokenIndexes:T}),i&&n.createElement(b.jx,{value:e,onSelect:eu,data:l.groups,customDataFilter:u,renderIconInline:!0,allowEmptyState:!0,inputType:m.type,suggestedVariableConfig:em,onMenuTriggerClick:g,className:"margin_left_50 display_flex align_items_center"}))};SlackFunctionDynamicInputsMultiSelectEntities.displayName="SlackFunctionDynamicInputsMultiSelectEntities";var en=a(0x18af67efb),er=a(0x1d01572a2),el=a(0xee467999),ei=a(0x16bc32721),eo=a(0x20f31dc25),es=a(0x1e19488b9),ec=a(0x5fb545d6),ed=a(0x152e7cb26),eu=a(0x162b19a86),em=a(0x6cc5eee0),ep=a(0x1b3ecb90f),eb=a(0x1d1437423),ef=a(0x4a120eb2);let eg=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueMultiSelectInput=({value:e,values:t,parameter:a,parentParameterName:l,nestedDynamicOptions:i,onChange:s,functionId:c,workflowId:d,stepId:p,variables:g={list:[],groups:[]},allowVariables:h,formatVariableBeforeInsert:y,elementId:x,ariaLabel:v="",dynamicInput:k,customDataFilter:w,isValidEmptyObject:S,serviceTriggerType:C,triggerId:A,isTriggerSegment:T,isExistingStep:I})=>{let{typeahead:N,typeaheadQueryKey:M}=i??{},{name:L}=a,O="object"==typeof k?.additional_inputs?k.additional_inputs:{},D=(0,eu.Q$)({...(0,f.Bp)(i?.inputs,t),...O}),[P,W]=(0,n.useState)(x),[q,U]=(0,n.useState)(),[z,j]=(0,n.useState)(k.filterQueries??{}),G=[l];k.key&&G.push(k.key);let $=(0,n.useMemo)(()=>{if(k.available_options)return(0,ei.J)({dynamicOptions:k.available_options,value:e,selectionType:es.p8.MULTI_SELECT})},[k.available_options,e]),K=N&&!$,Y=$?R.Bp:i?.request_config?.search?.min_query_length??R.Bp,Q=!!i?.validation&&!$,Z=(0,eo.f)({hierarchicalParameterName:G,function:i?.function??"",workflowId:d,functionId:c,stepId:p,inputs:D,optionType:k.type,serviceTriggerType:C,triggerId:A,isTriggerSegment:T,hasValidationFunction:Q,isExistingStep:I,additionalInputs:k?.validation_function_additional_inputs,values:t}),{isLoading:J,dynamicOptions:X,actions:ee,errorCode:et,processSelectOptions:ea,errorMessage:eh,isError:e_}=(0,el.n)({client:Z,value:e,reducerOptions:{selectionType:es.p8.MULTI_SELECT,dynamicOptions:$},typeahead:{typeaheadQueryKey:M},minQueryLength:Y}),{onVariableMenuOpen:ey}=(0,_.e)(),ex=K?eg.t("Search options\u2026"):eg.t("Select options\u2026"),ev=K?R.vD:R.hU,eE=(0,n.useCallback)(e=>(0,ed.Y)({value:e,typeahead:N,minQueryLength:Y,errorCode:et}),[et,Y,N]),[ek,ew]=(0,n.useState)([]);(0,n.useEffect)(()=>{X.length>0&&ew(e=>(0,en.A)([...e,...X],"value"))},[X]);let eS=(0,n.useCallback)(()=>W((0,m.A)()),[]),{errorText:eC,onChange:eA}=(0,eb.x)({errorMessage:eg.t("1 or more selections are no longer available. Remove to continue."),isErrored:Q&&(0,ec.b)(e,ek)||!!$&&(0,ec.b)(e,$),shouldErrorPreventSave:!0});(0,er.A)(eA);let[eT]=(0,n.useMemo)(()=>(0,H.g)({variables:g,id:`${L}-${x}`,value:e,isRequired:!!k.is_required,isValidEmptyObject:S,parameter:a}),[g,L,x,e,k.is_required,S,a]),{onBlur:eI,okayToDisplay:eN}=(0,E.K)({errorMessage:void 0,isErrored:eT.length>0,shouldErrorPreventSave:!0,shouldErrorShowImmediately:!0}),eM=(0,f.D$)({apiErrorMessage:eh,validationErrorMessage:eC}),eL=(0,n.useCallback)((t,a)=>(0,B.l)({optionValue:t,index:a,variables:g,value:e||void 0,label:k.valueLabel||{},dynamicOptions:Q?ek:$}),[g,e,k.valueLabel,Q,ek,$]),eO=(0,n.useMemo)(()=>{if((0,r.A)(e)||!e)return[];let t=Array.isArray(e)?e:[e];return t?.map((e,t)=>{let a=X.find(t=>(0,u.A)(t.value,e));return a?{key:`${t}-${e}`,label:a.label,value:a.value}:"string"==typeof e?eL(e,t):{key:`${t}-${e}`,label:(k.valueLabel||{})[e]??e,value:e}})},[k.valueLabel,X,eL,e]),eF=(0,n.useCallback)(async e=>{e&&U(e);let t=[],a=!!(e||q);if(K&&a)try{let{options:a,value_type:n}=await Z.fetchOptions({typeaheadQueryKey:M,typeaheadQueryValue:e});ee.FETCH_OPTIONS_SUCCESS(a,n),t=ea(a,n)}catch(e){ee.FETCH_OPTIONS_ERROR(e)}else t=(0,F.A)(X,e);return t},[ee,Z,X,q,K,ea,M]),eD=(0,n.useCallback)(e=>{let t=e.label??e.value;return n.createElement("span",null,"string"==typeof t?n.createElement(em.A,{text:t,emojiSize:ep.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}):t)},[]),eP=(0,n.useCallback)(e=>{q&&(j(t=>({...t,[e.value]:q})),U(void 0))},[q,j,U]),eR=(0,n.useCallback)(e=>{if(!e?.length)return void s({value:null});let t=e.reduce((e,t)=>(t.value&&(Array.isArray(e.value)&&e.value.push(t.value),"string"==typeof t.label&&(e.valueLabel[t.value]=t.label),z[t.value]&&(e.filterQueries[t.value]=z[t.value])),e),{value:[],valueLabel:{},filterQueries:{}});1===e.length&&"string"==typeof e[0].value&&(0,V.x1)(g,e[0].value)&&(t.value=e[0].value),j(t.filterQueries??{}),s(t),eA()},[z,s,g,eA]),eB=(0,n.useCallback)(t=>{let a=[];a=Array.isArray(e)?e:e?[e]:[];let n=y?.(t,{})??t;0===a.length&&(0,V.x1)(g,n.id)?s({value:n.id}):a.includes(n.id)||s({value:[...a,n.id]}),eS()},[eS,y,s,e,g]),eW=eT.length>0&&eN||e_&&!!eh||!!eC,eV=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement("div",{className:"display_flex"},J?n.createElement(o.A,{className:"margin_top_75",color:"blue",size:"small"}):n.createElement(ef.x,{key:P,className:"flex_one no_min_width",ariaLabel:v,debounceWaitPeriod:ev,minQueryLength:Y,onSelectedItemsChange:eR,onOptionSelected:eP,emptyStateMessage:eE,selectedOptions:eO,placeholderText:ex,selectId:x,width:"100%",expandOnFocus:!0,expandOnClick:!0,onScrollablePage:!0,renderOption:eD,selectDataQa:`dynamicinputs-${l}-${k.key}-multi-select`,search:eF,isInvalid:eW,errors:eN&&eT.length>0?eT:eM,onBlur:eI,minOptionsListWidth:R.XK}),h&&n.createElement(b.jx,{value:e,onSelect:eB,data:g.groups,customDataFilter:w,renderIconInline:!0,onMenuTriggerClick:ey,inputType:k.type,suggestedVariableConfig:eV,allowEmptyState:!0,isDisabled:J,className:"margin_left_50 display_flex align_items_center"}))};SlackFunctionDynamicInputsKeyValueMultiSelectInput.displayName="SlackFunctionDynamicInputsKeyValueMultiSelectInput";var eh=a(0x242c34757),e_=a(0xbbd2a32d),ey=a(0x9b06c346),ex=a.n(ey);let ev=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueNumberInput=({value:e,parameter:t,variables:a,allowVariables:r,onChange:l,formatVariableBeforeInsert:i,elementId:o,ariaLabel:s="",dynamicInput:c,customDataFilter:d,isValidEmptyObject:u,hasInvalidVariable:m})=>{let p=(0,n.useRef)(),{onVariableMenuOpen:b}=(0,_.e)(),f=!u&&c.is_required,g=c.type===es.J5.Integer,{isParameterFormWrappable:h}=t,y=""===e||null===e?NaN:Number(e),v=g?(0,e_.zh)(y):(0,e_.gf)(y),k=y>e_.Ig,w=y<e_.kj,S=v&&!k&&!w||"string"==typeof e&&(0,x.bs)(e)&&!m,C=(0,n.useMemo)(()=>f&&""===e?ev.t("This field is required."):k?ev.t("This number is too large."):w?ev.t("This number is too small."):m?ev.t("This variable is not supported in this input field."):g?ev.t("This is not a valid integer."):ev.t("This is not a valid number."),[g,f,k,w,m,e]),A=(0,n.useMemo)(()=>f&&!h?!S:""!==e&&!S,[S,h,f,e]),{errorText:T,onBlur:I}=(0,E.K)({errorMessage:C,isErrored:A,shouldErrorPreventSave:!0,shouldErrorShowImmediately:!(f&&""===e)&&!S}),N=(0,n.useCallback)(({text:e})=>{let t=e;(0,x.bs)(t)?t=t.replace(/{{(.*?)}}/g,"$1"):t.includes(" ")?t=NaN:""!==t&&null!==t&&(t=Number(e)),l({value:t})},[l]),M=(0,n.useCallback)(e=>{p.current=e},[]);return n.createElement(eh.A,{id:o,initialText:String(e),variables:a,allowVariables:r,ariaLabel:s,shouldAddNewLineOnEnter:!1,onTextChange:N,formatVariableBeforeInsert:i,errorText:T,onBlur:I,placeholder:g?ev.t("Add an integer\u2026",{fallbackHash:"e1142a4bb9420c0f0411e5c57ae951362c99c9b5"}):ev.t("Add a number\u2026",{fallbackHash:"e1142a4bb9420c0f0411e5c57ae951362c99c9b5"}),renderDataMenuLocation:"inline",customDataFilter:d,onSetTextyRef:M,replaceValueOnVariableChange:!0,textyClassName:ex().textyInput,onVariableMenuOpen:b,inputType:c.type})};SlackFunctionDynamicInputsKeyValueNumberInput.displayName="SlackFunctionDynamicInputsKeyValueNumberInput";var eE=a(0xa9a7442);let ek=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueSelectInput=({value:e,values:t,parameter:a,parentParameterName:l,nestedDynamicOptions:i,onChange:s,functionId:c,workflowId:d,stepId:p,variables:g={list:[],groups:[]},allowVariables:k,formatVariableBeforeInsert:w,elementId:S,ariaLabel:C="",dynamicInput:A,customDataFilter:T,isValidEmptyObject:I,serviceTriggerType:N,triggerId:M,isTriggerSegment:L,isExistingStep:O,hasInvalidVariable:D,focusOnMount:P})=>{let{typeahead:B,typeaheadQueryKey:W}=i??{},{onVariableMenuOpen:V}=(0,_.e)(),{type:H,isParameterFormWrappable:q}=a,U=!!A.is_required&&!q,z="object"==typeof A?.additional_inputs?A.additional_inputs:{},j=(0,eu.Q$)({...(0,f.Bp)(i?.inputs,t),...z}),[G,K]=(0,n.useState)(S),[Y,Q]=(0,n.useState)(),Z=[l];A.key&&Z.push(A.key);let J=(0,n.useMemo)(()=>{if(A.available_options)return(0,ei.J)({dynamicOptions:A.available_options,value:e,selectionType:$.Il.SELECT})},[A.available_options,e]),X=B&&!J,ee=J?R.Bp:i?.request_config?.search?.min_query_length??R.Bp,et=(0,eo.f)({hierarchicalParameterName:Z,function:i?.function??"",workflowId:d,functionId:c,stepId:p,inputs:j,optionType:A.type,serviceTriggerType:N,triggerId:M,isTriggerSegment:L,hasValidationFunction:!!i?.validation&&!J,isExistingStep:O,additionalInputs:A?.validation_function_additional_inputs,values:t}),{isLoading:ea,dynamicOptions:es,actions:ef,errorCode:eg,processSelectOptions:eh,isError:e_,errorMessage:ey}=(0,el.n)({client:et,value:e,reducerOptions:{selectionType:$.Il.SELECT,dynamicOptions:J},typeahead:{typeaheadQueryKey:W},minQueryLength:ee}),ex=X?ek.t("Search options\u2026"):ek.t("Select option\u2026"),ev=X?R.vD:R.hU,ew=(0,n.useCallback)(e=>(0,ed.Y)({value:e,typeahead:B,minQueryLength:ee,errorCode:eg}),[eg,ee,B]),eS=!!J&&(0,ec.b)(e,J),eC=(0,n.useMemo)(()=>A.valueLabel||{},[A.valueLabel]),eA=e?eC[e]??e:"",{errorText:eT,onChange:eI}=(0,eb.x)({errorMessage:ek.t("{fieldLabel} is no longer available as an option.",{fieldLabel:eA}),isErrored:eS,shouldErrorPreventSave:!0});(0,er.A)(eI);let eN=(0,n.useMemo)(()=>D?ek.t("This variable is not supported in this input field."):void 0,[D]),{errorText:eM,onBlur:eL}=(0,E.K)({errorMessage:ek.t("This field is required."),isErrored:!!(U&&!I&&(0,r.A)(e)&&"number"!=typeof e)}),eO=(0,f.D$)({emptyErrorMessage:eM,apiErrorMessage:ey,validationErrorMessage:eT,invalidVariableErrorMessage:eN}),eF=!!eM||e_&&!!ey||eS||D,eD=(0,n.useCallback)(()=>K((0,m.A)()),[]),eP=(0,n.useMemo)(()=>{if(e&&"string"==typeof e)return(0,f.r2)(g.list,e)},[e,g.list]),eR=(0,n.useMemo)(()=>{if(eP)return eP;let t=es.find(t=>(0,u.A)(t.value,e));return t||(e?{label:eC[e]??e,value:e}:void 0)},[es,eP,e,eC]),eB=(0,n.useCallback)(async e=>{e&&Q(e);let t=[],a=!!(e||Y);if(X&&a)try{let{options:a,value_type:n}=await et.fetchOptions({typeaheadQueryKey:W,typeaheadQueryValue:e});ef.FETCH_OPTIONS_SUCCESS(a,n),t=eh(a,n);let r=(0,F.A)(es.filter(e=>e.selected),e);r.length&&(t=(0,en.A)([...r,...t],"value"))}catch(e){ef.FETCH_OPTIONS_ERROR(e)}else t=(0,F.A)(es,e);return eP&&!e&&(t=[...t,eP]),t},[Y,X,eP,et,W,ef,eh,es]),eW=(0,n.useCallback)(e=>{if("string"==typeof e.value&&(0,x.bs)(e.value)){let t=(0,y.x)(g.list,e.value);return t||(t=(0,v.x7)(e.value,H)),n.createElement(h.j,{variable:t})}let t=e.label??e.value;return"string"==typeof t?n.createElement(em.A,{text:t,emojiSize:ep.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}):t},[H,g.list]),eV=(0,n.useCallback)(e=>{if("string"==typeof e.value&&(0,x.bs)(e.value)){let t=(0,y.x)(g.list,e.value),a=(0,v.x7)(e.value,A.type);return n.createElement(h.j,{variable:t||a,defaultStyle:"highlight"})}let t=e.label??e.value;return"string"==typeof t?n.createElement(em.A,{text:t,emojiSize:ep.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}):t},[A.type,g.list]),eH=(0,n.useCallback)(e=>{if(e.value){let t=Y?{[e.value]:Y}:void 0;s({value:e.value,valueLabel:{[e.value]:e.label},filterQueries:t})}else s({value:""});e_&&ef.CLEAR_STATUS_ERROR(),eD()},[ef,Y,eD,e_,s]),eq=(0,n.useCallback)(e=>{s({value:(w?.(e,{})??e).id}),eD()},[eD,w,s]),eU=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement("div",{className:"display_flex"},ea?n.createElement(o.A,{className:"margin_top_75",color:"blue",size:"small"}):n.createElement(eE.m,{key:G,className:"full_width",ariaLabel:C,debounceWaitPeriod:ev,minQueryLength:ee,onOptionSelected:eH,emptyStateMessage:ew,selectedOption:eR,placeholderText:ex,selectId:S,width:"100%",renderOption:eW,renderSelectedOption:eV,selectDataQa:`dynamicinputs-${l}-${A.key}-select`,search:eB,onBlur:eL,errors:eO,isInvalid:eF,retainPreviousSelectionOnDelete:!0,isRequired:U,shouldRefocusInputAfterSelection:!0,focusOnMount:P,expandOnFocus:!1}),k&&n.createElement(b.jx,{value:e,onSelect:eq,data:g.groups,customDataFilter:T,renderIconInline:!0,onMenuTriggerClick:V,inputType:a.type,suggestedVariableConfig:eU,allowEmptyState:!0,isDisabled:ea,className:"margin_left_50 margin_top_50 display_flex"}))};SlackFunctionDynamicInputsKeyValueSelectInput.displayName="SlackFunctionDynamicInputsKeyValueSelectInput";var ew=a(0x10b93423f),eS=a(0x1846f5916),eC=a(0x81984638),eA=a.n(eC);let SlackFunctionDynamicInputsSingleSelectEntity=({value:e,parameter:t,variables:a=eS.Gs,allowVariables:r,onChange:l,formatVariableBeforeInsert:i,elementId:o,customDataFilter:s,dynamicInput:c,callbackId:d,isValidEmptyObject:u})=>{let{onVariableMenuOpen:m}=(0,_.e)(),p=(0,n.useCallback)((t,a)=>{a===e?l({value:null}):l({value:a})},[l,e]),f=(0,n.useCallback)(e=>{l({value:(i?.(e,{})??e).id})},[i,l]),g=(0,n.useCallback)(e=>(0,Y.A)(e.value)?n.createElement(W.A,{channelId:e.value,showTeamForLocalChannels:!0}):(0,Z.A)(e.value)?n.createElement(z.A,{id:e.value,showAvatar:!0,useShortMode:!0,showPresence:!1}):(0,Q.A)(e.value)?n.createElement(U.A,{id:e.value}):e.data&&e.data.label?n.createElement(D.R,{data:e.data}):e.label,[]),h=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement("div",{className:"display_flex"},n.createElement(ew.O,{variables:a,allowVariables:r,parameter:t,value:e||"",onChange:p,callbackId:d,dynamicInput:c,hasLabel:!1,className:eA().entity,elementId:o,renderOption:g,isValidEmptyObject:u}),r&&n.createElement(b.jx,{value:e,onSelect:f,data:a.groups,customDataFilter:s,renderIconInline:!0,allowEmptyState:!0,inputType:t.type,suggestedVariableConfig:h,onMenuTriggerClick:m,className:"margin_left_50 margin_top_50 display_flex"}))};SlackFunctionDynamicInputsSingleSelectEntity.displayName="SlackFunctionDynamicInputsSingleSelectEntity";var eT=a(0xaec6c584);let eI=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueTextInput=({value:e,parameter:t,variables:a,allowVariables:r,onChange:l,formatVariableBeforeInsert:i,callbackId:o,elementId:s,ariaLabel:c="",customDataFilter:d,dynamicInput:u,isValidEmptyObject:m,hasInvalidVariable:p})=>{let{error:b,runAsyncTextValidation:f}=(0,eT.m)(o,t),{onVariableMenuOpen:g,hasValidAppPinBuiltInMessage:h}=(0,_.e)(),{isParameterFormWrappable:y}=t,{errorId:x,message:v,isErrored:k}=(0,n.useMemo)(()=>{switch(!0){case!!(!m&&u.is_required&&!e&&!y):return{errorId:"is_required",message:eI.t("This field is required."),isErrored:!0};case[null,!1].includes(h):return{errorId:"falsy",message:eI.t("This is not a valid message URL or timestamp."),isErrored:!0};case p:return{errorId:"invalid_variable",message:eI.t("This variable is not supported in this input field."),isErrored:!0};default:return{errorId:void 0,message:void 0,isErrored:!1}}},[m,p,u.is_required,e,y,h]),{errorText:w,onBlur:S}=(0,E.K)({errorMessage:v,isErrored:k,shouldErrorPreventSave:!0,shouldErrorShowImmediately:!!x&&"is_required"!==x}),C=b?.errorText??w,A=(0,n.useCallback)(async({text:e})=>{let t=(0,eu.cY)(e);l({value:t}),f&&await f(t)},[l,f]);return n.createElement(eh.A,{id:s,initialText:String(e),variables:a,allowVariables:r,ariaLabel:c,shouldAddNewLineOnEnter:!1,onTextChange:A,formatVariableBeforeInsert:i,errorText:C,onBlur:S,placeholder:eI.t("Add a value\u2026"),renderDataMenuLocation:"inline",customDataFilter:d,textyClassName:ex().textyInput,callbackId:o,onVariableMenuOpen:g,inputType:u.type})};SlackFunctionDynamicInputsKeyValueTextInput.displayName="SlackFunctionDynamicInputsKeyValueTextInput";var eN=a(0x1b1820b2c),eM=a(0x677a139e),eL=a(0x18c090e66),eO=a.n(eL);let eF=new l.Ay("workflow_builder"),SlackFunctionDynamicInputsKeyValueTimestampInput=({value:e,parameter:t,variables:a,allowVariables:r,onChange:l,formatVariableBeforeInsert:i,elementId:o,ariaLabel:s="",customDataFilter:c,isValidEmptyObject:d,dynamicInput:u,hasInvalidVariable:m})=>{let{viewOnly:p,onVariableMenuOpen:g}=(0,_.e)(),{isParameterFormWrappable:h}=t,y=!d&&!!u.is_required&&!e&&!h,{errorId:x,errorMessage:v,isErrored:E}=(0,n.useMemo)(()=>{switch(!0){case y:return{errorId:"is_required",errorMessage:eF.t("This field is required."),isErrored:!0};case m:return{errorId:"invalid_variable",errorMessage:eF.t("This variable is not supported in this input field."),isErrored:!0};default:return{errorId:void 0,errorMessage:void 0,isErrored:!1}}},[y,m]),{onChange:k,errorText:w}=(0,eb.x)({errorMessage:v,isErrored:E,shouldErrorPreventSave:!0,shouldErrorShowImmediately:!!x&&"is_required"!==x}),T=a?a.groups:[],I=(0,n.useCallback)(e=>l({value:i(e,{parameterType:t.type}).id}),[i,l,t.type]),N=(0,n.useMemo)(()=>{if("string"==typeof e&&a)return(0,f.r2)(a.list,e)},[e,a]),M=(0,n.useCallback)(e=>{l({value:e}),k()},[l,k]),L=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,t.hint&&n.createElement(eM.A,{className:"margin_bottom_0"},t.hint),w&&n.createElement(S.A,null,w)),[t.hint,w]),O=(0,n.useMemo)(()=>({enable:!0}),[]);return N?n.createElement(n.Fragment,null,n.createElement(C.P,{onChange:M,value:e??"",variables:a||eS.Gs,customDataFilter:c,label:s,isDisabled:p,formatVariableBeforeInsert:i,parameterType:u.type&&(0,A.G)(u.type)?u.type:void 0}),L):n.createElement(n.Fragment,null,n.createElement("div",{className:eO().timestampWrapper},n.createElement(eN.A,{id:o,className:eO().timestampInlineDateTimePicker,onChange:M,valueFormat:"X",value:e??"","aria-label":s,showTimeZone:!1,disabled:p,isInvalid:!!w}),r&&n.createElement(b.jx,{value:e,onSelect:I,data:T,customDataFilter:c,renderIconInline:!0,isDisabled:p,onMenuTriggerClick:g,inputType:t.type,suggestedVariableConfig:O})),L)};SlackFunctionDynamicInputsKeyValueTimestampInput.displayName="SlackFunctionDynamicInputsKeyValueTimestampInput";var eD=a(0x194fe1f5f);let eP=new l.Ay("workflow_builder"),eR={entities:{members:!1,userGroups:!1,channels:!1,teams:!1},allowEmptyQuery:!1},SlackFunctionDynamicInputsKeyValueVariableInput=({value:e,parameter:t,variables:a,allowVariables:r,onChange:l,elementId:i,dynamicInput:o,isValidEmptyObject:s,hasInvalidVariable:c})=>{let{viewOnly:d}=(0,_.e)(),{isParameterFormWrappable:u}=t,m=!s&&!!o.is_required&&!e&&!u,p=(0,n.useMemo)(()=>{switch(!0){case m:return[{id:"is_required",message:eP.t("This field is required.")}];case c:return[{id:"invalid_variable",message:eP.t("This variable is not supported in this input field.")}];default:return[]}},[m,c]),b=(0,n.useCallback)(e=>{let{id:t}=e;if(t&&a?.list){let e=(0,f.r2)(a.list,t);e&&l({value:e.value})}},[l,a?.list]),g=(0,n.useMemo)(()=>o.type===$.TE.SlackTypesSalesforceDataField?$.TE.SlackTypesSalesforceDataField:void 0,[o.type]);return n.createElement(eD.s,{elementId:i,value:e??"",data:a??eS.Gs,allowVariables:r,onChange:b,allowUsers:!1,allowChannels:!1,allowVariablesByType:g,className:"full_width no_margin",errors:p,isInvalid:p.length>0,isDisabled:d,isRequired:o.is_required,placeholder:eP.t("Select option\u2026"),searcherOptions:eR})};SlackFunctionDynamicInputsKeyValueVariableInput.displayName="SlackFunctionDynamicInputsKeyValueVariableInput";var eB=a(0xb3a43d1e),eW=a(0x2151a9a6),eV=a(0xa224974e),eH=a(0x1d922a37e),eq=a(0xbee49e6c),eU=a(0xa21d3b1e),ez=a(0x1ba35eb3b),ej=a(0x1b05cc3ce),eG=a(0x1ebe91b72),e$=a(0x145d46a61),eK=a(0x2241421be);let eY=new l.Ay("workflow_builder"),containsSingleVariableAsValue=e=>"string"==typeof e&&(0,x.cn)(e)&&(0,x.bs)(e),SlackFunctionDynamicInputsKeyValueInput=({value:e,values:t,parameter:a,variables:l,allowVariables:u,onChange:m,formatVariableBeforeInsert:p,callbackId:b,elementId:g,dynamicInput:h,functionId:_,workflowId:v,stepId:k,serviceTriggerType:w,triggerId:S,isTriggerSegment:C,isExistingStep:A,functionVariables:T,isFunctionFormWrapped:I,isParameterSyncedWithForm:N,shouldRenderRichTextInput:M,focusOnMount:L})=>{let O=(0,J.d4)(e$.B$),{title:F,name:D,description:P}=a,R=h.label||F||P||D,B=(0,f.el)(a),W=(0,n.useMemo)(()=>!a.is_required&&!Object.values(a.properties??{}).some(e=>!0===e.is_required)&&!(0,ej.L$)(a)&&(0,r.A)(t?.[a.name]?.value),[a,t]),H=h?.key&&a.properties?.[h.key]?(0,c.w)(a.properties[h.key]):a,q=eY.t("Value is invalid for this field."),U=(0,n.useMemo)(()=>{var t;return e&&h?.type&&(Array.isArray(e)?!e.every(e=>containsSingleVariableAsValue(e)):!containsSingleVariableAsValue(e))&&(!(0,eq.i5)(e,h.type,h.selection_type)||!M&&(t=h.type,[$.TE.SlackTypesRichText,$.TE.SlackTypesExpandedRichText].includes(t))&&"string"!=typeof e)?[{id:"invalid_value_for_type",message:q}]:[]},[e,h.type,h.selection_type,M,q]);(({errorMessage:e,isErrored:t,shouldErrorPreventSave:a})=>{let{errorText:n,okayToDisplay:r}=(0,E.K)({errorMessage:e,isErrored:t,shouldErrorPreventSave:a??!0,shouldErrorShowImmediately:!0})})({errorMessage:void 0,isErrored:!!U.length});let z=(0,n.useMemo)(()=>l?(0,eU.z)({parameterName:a.name,isKeyValueParameter:!0,dynamicOptionKey:h.key,functionVariables:T,variables:l,isFunctionFormWrapped:I,stepId:k}):l,[h.key,T,I,a.name,k,l]),j=(0,n.useCallback)(e=>!!h.type&&((0,ez.RT)(e,h,_)||(0,ez.uK)(e,h)),[h,_]),G=(0,n.useMemo)(()=>{if("string"==typeof e&&(0,x.cn)(e)){let t=e.match((0,eG.cL)());return!!t&&t.some(e=>{let t=z?(0,y.x)(z.list,e):void 0;return!t||!j(t)})}return!1},[j,e,z]),K=(0,n.useCallback)(()=>{m({value:null})},[m]),Y=(0,n.useCallback)((e,t)=>{if(t&&1===t.length&&z&&(0,V.x1)(z,String(t[0])))return m({value:String(t[0])});m({value:t})},[m,z]),Q=(0,n.useCallback)((e,t)=>{m({value:t})},[m]),Z=(0,n.useMemo)(()=>!!(T?.isLoading&&z?.list&&"string"==typeof e&&(0,x.q4)(e)&&!(0,y.x)(z.list,e)),[T?.isLoading,e,z]),X=(0,n.useCallback)((e,t)=>p((0,eH.F)({variable:e,parameterName:a.name,isKeyValueParameter:!0,dynamicOptionKey:h.key,functionVariables:T}),t),[h.key,p,T,a.name]),ee=(0,n.useCallback)((e,t)=>{let a=X(e,t);if(h.type===es.J5.String&&(0,ez.rf)(e)){let t=eK.pE.join;if(t)return{...e,id:t.wrapWithMacro(e.id)}}return a},[h.type,X]);if(!h)return null;if(Z)return n.createElement(o.A,{className:"margin_top_75",color:"blue",size:"small"});if(N)return n.createElement(d.C,{value:e,parameter:a,variables:z,dynamicInput:h});if(U.length)return n.createElement("div",{className:"display_flex"},n.createElement("div",{className:"full_width"},n.createElement(s.A,{className:"margin_0",errors:U})),n.createElement("div",{className:"margin_left_50"},n.createElement(i.Ay,{type:"danger",onClick:K},eY.t("Clear"))));switch(h.selection_type){case es.p8.SINGLE_SELECT:if(!B&&!h.available_options)break;return n.createElement(SlackFunctionDynamicInputsKeyValueSelectInput,{parameter:H,parentParameterName:a.name,nestedDynamicOptions:B,value:e,values:t,variables:z,allowVariables:u,onChange:m,elementId:g,ariaLabel:R,functionId:_,workflowId:v,stepId:k,customDataFilter:j,formatVariableBeforeInsert:ee,dynamicInput:h,isValidEmptyObject:W,serviceTriggerType:w,triggerId:S,isTriggerSegment:C,isExistingStep:A,hasInvalidVariable:G,focusOnMount:L});case es.p8.MULTI_SELECT:if(h.type===es.J5.UserId||h.type===es.J5.ChannelId||h.type===es.J5.CanvasId||h.type===es.J5.ListId)return n.createElement(SlackFunctionDynamicInputsMultiSelectEntities,{value:e,isValidEmptyObject:W,parameter:H,parentParameterName:a.name,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,ariaLabel:R,dynamicInput:h});if(h.type===es.J5.FileId||!B&&!h.available_options)break;return n.createElement(SlackFunctionDynamicInputsKeyValueMultiSelectInput,{parameter:H,parentParameterName:a.name,nestedDynamicOptions:B,value:e,values:t,variables:z,allowVariables:u,onChange:m,elementId:g,ariaLabel:R,functionId:_,workflowId:v,stepId:k,customDataFilter:j,formatVariableBeforeInsert:X,dynamicInput:h,isValidEmptyObject:W,serviceTriggerType:w,triggerId:S,isTriggerSegment:C,isExistingStep:A});case es.p8.BASIC_MULTI_SELECT:{let t=(0,f.KE)(h,a,!!a.isParameterFormWrapped);return n.createElement(eW.m,{key:g,parameter:t,value:(0,r.A)(e)?void 0:e,onChange:Y,variables:z??eS.Gs,formatVariableBeforeInsert:X,allowVariables:u,placeholder:eY.t("Add a value\u2026"),hideLabel:!0})}case es.p8.NONE:default:if(h.type===es.J5.Integer||h.type===es.J5.Number)return n.createElement(SlackFunctionDynamicInputsKeyValueNumberInput,{value:e,parameter:H,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,ariaLabel:R,dynamicInput:h,isValidEmptyObject:W,hasInvalidVariable:G});if(h?.type===es.J5.Boolean)return n.createElement(SlackFunctionDynamicInputsKeyValueBooleanInput,{value:e,parameter:H,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,ariaLabel:R,isValidEmptyObject:W,dynamicInput:h,hasInvalidVariable:G});if(h?.type===es.J5.Date)return n.createElement(SlackFunctionDynamicInputsKeyValueDateInput,{value:e,parameter:H,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,ariaLabel:R,dynamicInput:h,isValidEmptyObject:W,callbackId:b,hasInvalidVariable:G});if(h?.type===es.J5.TimeStamp&&O)return n.createElement(SlackFunctionDynamicInputsKeyValueTimestampInput,{value:e,parameter:H,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,ariaLabel:R,dynamicInput:h,isValidEmptyObject:W,callbackId:b,hasInvalidVariable:G});if(h?.type===es.J5.SalesforceDataField)return n.createElement(SlackFunctionDynamicInputsKeyValueVariableInput,{value:e,parameter:H,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,ariaLabel:R,dynamicInput:h,isValidEmptyObject:W,callbackId:b,hasInvalidVariable:G});if(h.type===es.J5.UserId||h.type===es.J5.ChannelId||h.type===es.J5.CanvasId||h.type===es.J5.ListId)return n.createElement(SlackFunctionDynamicInputsSingleSelectEntity,{value:e,parameter:a,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:X,elementId:g,callbackId:b,dynamicInput:h,isValidEmptyObject:W});if(h.type===es.J5.RichText&&M)return n.createElement(eV.h,{value:(0,eq.p_)(e)&&e||(0,eq.FI)(e)&&e||"",allowVariables:u,onChange:Q,formatVariableBeforeInsert:X,variables:z||eS.Gs,parameter:(0,f.KE)((0,eB.G)(h),a,!0),required:a.is_required,callbackId:b,stepId:k,hideLabel:!0})}return n.createElement(SlackFunctionDynamicInputsKeyValueTextInput,{value:e,parameter:H,variables:z,allowVariables:u,onChange:m,customDataFilter:j,formatVariableBeforeInsert:ee,callbackId:b,elementId:g,ariaLabel:R,dynamicInput:h,isValidEmptyObject:W,hasInvalidVariable:G})};SlackFunctionDynamicInputsKeyValueInput.displayName="SlackFunctionDynamicInputsKeyValueInput"},0x1fc996df8:(e,t,a)=>{"use strict";a.d(t,{L:()=>SlackFunctionDynamicInputsSelectInput});var n=a(0xbad225b5),r=a(0x21f3c49e8),l=a(0x18af67efb),i=a(0x1407c6c2c),o=a(0x20482ad21),s=a(0x12edaa96a),c=a(0xb1ea448c),d=a(0x1ad596f5f),u=a(0x235d78b7c),m=a(0x1c09d8c36),p=a(0xee467999),b=a(0x20f31dc25),f=a(0x242822dfb),g=a(0x21e82d4ab),h=a(0x223beeef),_=a(0x152e7cb26),y=a(0x1ba35eb3b),x=a(0x1d3dd4cbe),v=a(0x668181b3),E=a(0x2772625d),k=a(0x1b05cc3ce),w=a(0x6cc5eee0),S=a(0x1b3ecb90f),C=a(0xb0ca8936),A=a(0x1d9a37519),T=a(0x1d62f3e69),I=a(0x207fb9b92),N=a(0x145d46a61),M=a(0xa9a7442),L=a(0x1795d8821),O=a(0x4003bce0),F=a(0x226892387),D=a(0x11e7d7571),P=a.n(D);let R=new o.Ay("workflow_builder"),SlackFunctionDynamicInputsSelectInput=({required:e,value:t,label:a,values:o,parsedValues:D,parameter:B,functionId:W,workflowId:V,processError:H,onValueChange:q,onSuccess:U,dynamicOptions:z,selectProps:j={},stepId:G,callbackId:$,isExistingStep:K,variables:Y={list:[],groups:[]},formatVariableBeforeInsert:Q,client:Z,serviceTriggerType:J,triggerId:X,isTriggerSegment:ee,allowVariables:et,hasDependentField:ea,isOAuthTokenInvalid:en,hideLabel:er})=>{let el=(0,i.A)(),[ei,eo]=(0,n.useState)(((e,t)=>{if(!t)return;let a=(0,f.mU)(e);if(a?.[t])return a[t];let[n]=e&&Array.isArray(e[m.x3])?e[m.x3]:[];return n})(a,t)),[es,ec]=(0,n.useState)(el),ed=(0,n.useCallback)(()=>ec((0,s.A)()),[]),{onVariableMenuOpen:eu}=(0,x.e)(),[em,ep]=(0,n.useState)(!1),{name:eb,title:ef,typeahead:eg,typeaheadQueryKey:eh,description:e_,hint:ey,isParameterFormWrappable:ex}=B,ev=!!(e||(0,k.L$)(B))&&!ex,eE=eg&&!en,ek=B.dynamic_options.request_config?.search?.min_query_length??m.Bp,ew=eE?R.t("Search options\u2026"):R.t("Select option\u2026"),eS=eE?m.vD:m.hU,eC=(0,b.f)({hierarchicalParameterName:[B.name],function:B.dynamic_options.function,workflowId:V,functionId:W,stepId:G,values:o,inputs:D,isExistingStep:K,hasValidationFunction:!!B.dynamic_options.validation,serviceTriggerType:J,triggerId:X,isTriggerSegment:ee,isOAuthTokenInvalid:en}),eA=Z||eC,{isLoading:eT,dynamicOptions:eI,actions:eN,processSelectOptions:eM,isError:eL,errorCode:eO,errorMessage:eF}=(0,p.n)({client:eA,value:t,reducerOptions:{selectionType:L.Il.SELECT,onValueChange:q,onSuccess:U,dynamicOptions:z,processError:H},typeahead:{typeaheadQueryKey:eh},minQueryLength:ek}),eD=(0,F.d4)(N.dq),eP=(0,n.useMemo)(()=>"string"==typeof t?(0,f.r2)(Y.list,t):void 0,[t,Y.list]),eR=(0,n.useMemo)(()=>{if(eP)return eP;let e=eI.find(e=>e.selected);return e||(t&&"string"==typeof a?.[t]?{label:a[t],value:t}:t?{label:"",value:t}:void 0)},[eI,a,eP,t]),eB=(0,n.useMemo)(()=>{if(ey)return[{id:`${eb}-hint`,message:ey}]},[ey,eb]),eW=(0,n.useCallback)(e=>(0,_.Y)({value:e,typeahead:eE,minQueryLength:ek,errorCode:eO}),[eO,eE,ek]),eV=(0,n.useMemo)(()=>{if("string"==typeof t&&(0,E.bs)(t)){let e=(0,v.x)(Y.list,t);return!e||!e.isAvailable}return!1},[t,Y]),eH=(0,n.useMemo)(()=>"string"==typeof t&&"canvas"===t&&"canvas_tab"===B.name,[t,B]),eq=(0,n.useMemo)(()=>eV?R.t("This variable is not supported in this input field."):void 0,[eV]),eU=(0,n.useMemo)(()=>{let e=R.t("Choose a canvas that has been added as a tab in the channel, or add a canvas as a tab, and then refresh to select it here.");return eH?e:void 0},[eH]),{errorText:ez,onBlur:ej}=(0,I.K)({errorMessage:R.t("This field is required."),isErrored:!!ev&&(0,r.A)(t)&&"number"!=typeof t}),eG=(0,f.D$)({emptyErrorMessage:ez,apiErrorMessage:eF,invalidVariableErrorMessage:eq,invalidCanvasVariableErrorMessage:eU}),e$=!!ez||eL&&!!eF||eV||eH,eK=(0,n.useCallback)(async e=>{eo(e);let t=[],a=!!(e||ei);if(eE&&a)try{let{options:a,value_type:n}=await eA.fetchOptions({typeaheadQueryKey:eh,typeaheadQueryValue:e});eN.FETCH_OPTIONS_SUCCESS(a,n),t=eM(a,n);let r=(0,d.A)(eI.filter(e=>e.selected),e);r.length&&(t=(0,l.A)([...r,...t],"value"))}catch(e){eN.FETCH_OPTIONS_ERROR(e)}else t=(0,d.A)(eI,e);return eP&&!e&&(t=[...t,eP]),t},[eN,eA,eI,ei,eE,eM,eP,eh]),eY=(0,n.useCallback)(e=>{let t=!e.value,a=ei?{[e.value]:ei}:{};t?eN.SELECT_OPTION(void 0):eN.SELECT_OPTION({...e,filterQueries:a}),ep(!0),ed()},[eN,ed,ei]),eQ=(0,n.useCallback)(e=>eD&&$&&$===L.oW.AskAgentforce&&"string"==typeof e.value&&(0,O.Ay)(e.value),[eD,$]),eZ=(0,n.useMemo)(()=>(e,t)=>n.createElement("div",{className:"display_flex gap_50 align_items_center"},n.createElement(A.z,{appId:e,size:20,width:20,height:20}),n.createElement(C.EY,{color:"inherit"},t)),[]),eJ=(0,n.useCallback)(e=>{if("string"==typeof e.value&&(0,E.bs)(e.value)){let t=(0,v.x)(Y.list,e.value);return t||(t=(0,T.x7)(e.value,B.type)),n.createElement(g.j,{variable:t})}return"string"==typeof e.value&&"string"==typeof e.label&&eQ(e)?eZ(e.value,e.label):"string"==typeof e.label?n.createElement(w.A,{text:e.label,emojiSize:S.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}):e.label},[B.type,Y.list,eZ,eQ]),eX=(0,n.useCallback)(e=>{if("string"==typeof e.value&&(0,E.bs)(e.value)){let t=(0,v.x)(Y.list,e.value);return t||(t=(0,T.x7)(e.value,B.type)),n.createElement(g.j,{variable:t,defaultStyle:"highlight"})}return"string"==typeof e.value&&"string"==typeof e.label&&eQ(e)?eZ(e.value,e.label):"string"==typeof e.label?n.createElement(w.A,{text:e.label,emojiSize:S.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}):e.label},[B.type,Y.list,eZ,eQ]),e0=(0,n.useCallback)(e=>!!B&&((0,y.Lm)({variable:e,parameter:B})||(0,y.xY)({variable:e,parameter:B})),[B]),e1=(0,n.useCallback)(e=>{let t=Q?.(e,{})??e,a=(0,f.r2)(Y.list,t.id);a&&eN.SELECT_OPTION(a),ed()},[eN,ed,Q,Y.list]),e2=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement(h.z,{elementId:el,parameter:B,hideLabel:er},n.createElement("div",{className:"full_width display_flex"},eT?n.createElement(c.A,{color:"blue",size:"small",className:"align_self_center"}):n.createElement(M.m,{key:es,className:P().select,ariaLabel:ef,search:eK,debounceWaitPeriod:eS,minQueryLength:en?void 0:ek,onOptionSelected:eY,selectedOption:eR,placeholderText:e_||ew,selectId:el,width:"100%",renderOption:eJ,renderSelectedOption:eX,selectDataQa:`dynamicinputs-${B.name}-select`,emptyStateMessage:eW,onBlur:ej,isInvalid:e$,errors:eG,hints:eB,retainPreviousSelectionOnDelete:!0,isRequired:ev,focusOnMount:em,expandOnFocus:!1,...j}),et&&n.createElement(u.jx,{value:t,onSelect:e1,data:Y.groups,customDataFilter:e0,renderIconInline:!0,isDisabled:eT,onMenuTriggerClick:eu,hasDependentField:ea,allowEmptyState:!0,className:"margin_left_50 margin_top_50 display_flex align_items_start",inputType:B.type,suggestedVariableConfig:e2})))};SlackFunctionDynamicInputsSelectInput.displayName="SlackFunctionDynamicInputsSelectInput"},0xb3a43d1e:(e,t,a)=>{"use strict";a.d(t,{G:()=>createDynamicOptionFromDynamicInput});let createDynamicOptionFromDynamicInput=e=>{let{empty:t=!1,index:a,key:n="",label:r="",selected:l,selectable:i,visible:o,value:s}=e;return{...e,key:n,label:r,empty:"boolean"==typeof t&&t,index:"number"==typeof a?a:0,selectable:i??!1,selected:"boolean"==typeof l&&l,visible:"boolean"==typeof o&&o,value:s}}},0x8e309e4d:(e,t,a)=>{"use strict";a.d(t,{c:()=>createDynamicOptionFromParameter});var n=a(0x1e19488b9),r=a(0xb4d361ed),l=a(0x1795d8821);let createDynamicOptionFromParameter=e=>{let{type:t,title:a,additionalInputs:i,name:o,availableOptions:s}=e,c=(0,r.q)(e)?e.dynamic_options?.selectionType:void 0,d=t===l.TE.Array,u={label:a,selection_type:!c&&d?n.p8.MULTI_SELECT:c,type:d?e.items.type:t,key:o};return s&&(u.available_options=s),i&&(u.additional_inputs=i),u}},0x40e8839e:(e,t,a)=>{"use strict";a.d(t,{l:()=>makeOptionForDynamicMultiSelectInput});var n=a(0x20482ad21),r=a(0x137f92494),l=a(0xf33a4f91);let i=new n.Ay("workflow_builder"),makeOptionForDynamicMultiSelectInput=({optionValue:e,index:t,variables:a,value:n,label:o,dynamicOptions:s})=>{let c=n&&"string"!=typeof n&&n.length>1&&n.some(e=>(0,l.x1)(a,String(e))),d=`${t}-${e}`,u=(0,r.r)(a.list,e);return u?(0,l.x1)(a,e)?{...u,label:i.t("{selectedDataLabel} (multiple)",{selectedDataLabel:u.label}),isError:!!c}:{...u,key:d}:{key:d,label:"string"==typeof o?.[e]?o[e]:e,value:e,isError:!!s&&!s.some(t=>t.value===e)}}},0x21e82d4ab:(e,t,a)=>{"use strict";a.d(t,{j:()=>WorkflowToken});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1282104f7),o=a(0x1f1acac35),s=a.n(o);let c={name:"css"},WorkflowToken=({variable:e,className:t,defaultStyle:a="inherit",isDisabled:r})=>{let o=!e.isAvailable,d="highlight"===a&&!o&&!r,u=l()(s().token,{[s().highlight]:d,[s().invalid]:o},t);return n.createElement(i.A,{svgIcon:c,size:"small",className:u,entityId:e.id,label:e.label||e.defaultLabel,isInvalid:o,isDisabled:r})};WorkflowToken.displayName="WorkflowToken"},0x1f90df740:(e,t,a)=>{"use strict";a.d(t,{b:()=>SegmentParameterFieldSet});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x20482ad21),o=a(0xd2bf4d47),s=a(0x1d57b7d4c),c=a(0x2cc8fa56),d=a.n(c);let u=new i.Ay("workflow_builder"),SegmentParameterFieldSet=({parameter:e,children:t,className:a})=>{let{title:r,name:i,description:c}=e;return n.createElement(o.A,{"data-qa-segment-parameter":e.name,className:l()(d().container,a)},n.createElement(s.A,null,r??i??c," ",!e.is_required&&u.t("(optional)",{fallbackHashNs:"app_dialog",fallbackHash:"b16c7ac6faff07d7e255da685e52bd66d3bf1575"})),t)};SegmentParameterFieldSet.displayName="SegmentParameterFieldSet"},0x1d8fafe9f:(e,t,a)=>{"use strict";a.d(t,{F:()=>DisabledWorkflowToken});var n=a(0xbad225b5),r=a(0x21e82d4ab),l=a(0x668181b3),i=a(0x1d62f3e69);let DisabledWorkflowToken=({value:e,variables:t,parameterType:a})=>{let o=(0,l.x)(t.list,e);return o||(o=(0,i.x7)(e,a)),n.createElement(r.j,{variable:o,className:"inline_block",isDisabled:!0})};DisabledWorkflowToken.displayName="DisabledWorkflowToken"},0x17ee9cd72:(e,t,a)=>{"use strict";a.d(t,{a:()=>FormWrappedFieldList});var n=a(0xbad225b5),r=a(0x202470d56),l=a(0x130d89881),i=a(0x20482ad21),o=a(0x24f1e08bb),s=a(0x1d2cd7755),c=a(0x1a043bf26),d=a(0x1903d373d),u=a(0x818fd090),m=a(0x242822dfb),p=a(0x120c268ad),b=a.n(p),f=a(0x8716533d),g=a(0x344bb842),h=a(0x2501a2cee),_=a(0x4c96e5d9),y=a(0x1fdec3e16),x=a(0xc62077ca),v=a(0x1d8fafe9f),E=a(0x211a99e2f),k=a(0x2772625d),w=a(0x247cf31a2),S=a(0xf4097f62),C=a(0x6cc5eee0),A=a(0x231441bf2),T=a(0x1b3ecb90f),I=a(0x1991a9b6d),N=a(0x1795d8821),M=a(0x6960d8b9),L=a(0x18c49b4c3),O=a.n(L);let F=new i.Ay("workflow_builder"),DefaultWrappedFormValue=({parameterType:e,value:t,label:a,variables:r})=>{if("string"==typeof t){if((0,k.bs)(t))return n.createElement(v.F,{value:t,variables:r,parameterType:e});if((0,k.cn)(t))return n.createElement(E.l,{text:t,variables:r,parameterType:e})}let l="string"==typeof t?t:void 0,i=("string"==typeof a?a:void 0)??l;switch(e){case N.TE.SlackTypesChannelId:return"string"==typeof t?n.createElement(w.A,{channelId:t,truncate:!0}):null;case N.TE.SlackTypesUserId:return"string"==typeof t?n.createElement(S.A,{id:t,truncate:!0}):null;case N.TE.Boolean:case N.TE.Integer:case N.TE.Number:return n.createElement(n.Fragment,null,String(a??t));case N.TE.SlackTypesTimestamp:return n.createElement(n.Fragment,null,F.t("{date} at {time}",{date:(0,M.Yq)(String(t),"{date_long}"),time:(0,M.xe)(String(t))}));case N.TE.String:case N.TE.SlackTypesLimitedRichText:case N.TE.SlackTypesRichText:if(Array.isArray(t))return n.createElement(A.Zs.Provider,{value:r.list},n.createElement("div",{className:O().inline},n.createElement(I.A,{msg:{__meta__:{lastUpdatedTs:""},type:"message",ts:"0",channel:"WFB_DEFAULT_FORM_VALUE",subtype:"",blocks:t},inline:!0})));return n.createElement(C.A,{emojiSize:T.lw.SMALL,noLinking:!0,noHighlights:!0,noJumbomoji:!0,noCode:!0,noQuotes:!0,noSpecials:!0,text:i});default:return n.createElement(n.Fragment,null,i)}};DefaultWrappedFormValue.displayName="DefaultWrappedFormValue";var D=a(0xa21d3b1e),P=a(0x23465d793),R=a(0x236f54fae),B=a(0x7019ae94),W=a(0x1b05cc3ce),V=a(0x566fc4c8),H=a.n(V);let q=new i.Ay("workflow_builder"),FormWrappedInput=({parameter:e,value:t,valueLabels:a,variables:r,onChange:l,parentParameterName:i,propertyKey:o,functionVariables:c,stepId:u,isFunctionFormWrapped:m})=>{let p=i??e.name,v=e.title??e.name??o,E=e.type===N.TE.Array?e.items:void 0,k=!!e.isParameterFormWrapped,w=q.t("Hide field"),S=q.t("Show field"),A=k?w:S,I=e.is_required||(0,W.L$)(e),M=(0,n.useMemo)(()=>r?(0,D.z)({parameterName:p,isKeyValueParameter:!!i,dynamicOptionKey:o,functionVariables:c,variables:r,isFunctionFormWrapped:m,stepId:u}):r,[c,m,p,i,o,u,r]),L=(0,n.useMemo)(()=>({name:k?"eye-closed":"eye-open"}),[k]),O=(0,n.useMemo)(()=>I&&!k&&(0,B.$)(t)?[{id:"is_required_error",message:q.t("This field is required.")}]:[],[I,k,t]),F=(0,n.useCallback)(e=>{if("string"==typeof e||"number"==typeof e)return a?.[e]},[a]),V=(0,n.useMemo)(()=>!!O.length,[O.length]),U=(0,n.useMemo)(()=>n.createElement(y.A,{lines:1},n.createElement(C.A,{emojiSize:T.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0,noJumbomoji:!0,text:v})),[v]),z=(0,n.useMemo)(()=>{if((0,R.G)(t)){if(t&&Array.isArray(t)&&e.type===N.TE.Array&&E&&"slack#/types/mixed"!==E.type){let e=t.length;return n.createElement(n.Fragment,null,t.map((t,a)=>{let r=`${t}_${a}`,l=F(t),i=!l&&"choices"in E?E.choices?.find(e=>e.value===t)?.title:void 0;return n.createElement(n.Fragment,{key:r},(0,R.G)(t)&&n.createElement(n.Fragment,null,n.createElement(DefaultWrappedFormValue,{parameterType:E.type,value:t,label:l??i,variables:M}),a<e-1?", ":""))}))}return n.createElement(DefaultWrappedFormValue,{parameterType:e.type,value:t,label:F(t),variables:M})}},[F,E,e.type,t,M]),j=(0,n.useMemo)(()=>V?n.createElement(f.A,{errors:O,className:"margin_0"}):(0,R.G)(t)?n.createElement(y.A,{lines:1},n.createElement("span",{className:H().default},q.t("Default"),":\xa0"),z):void 0,[z,O,V,t]),G=(0,n.useCallback)(()=>{l({checked:!k,parameterName:p,propertyKey:o})},[l,k,p,o]),$=(0,n.useMemo)(()=>{if("dynamic_options"in e&&e.dynamic_options||"enum"in e&&e.enum||"choices"in e&&e.choices||"external_select"in e&&e.external_select)return[]},[e]);if(!(0,d.AL)(e))return null;let K=(0,P.l)({...e,options:$}),{icon:Y}=K?(0,x.s)(K):{icon:"text-snippet"};return n.createElement("div",{className:"display_flex align_items_center justify_content_between normal"},n.createElement("div",{className:b()("display_flex flex_one","align_items_center",{half_opacity:!V&&!k})},n.createElement("div",{className:"padding_right_75"},n.createElement(h.Ah,{name:Y,inline:!0,size:"20"})),n.createElement(s.A,{text:U,subtext:j,className:H().label})),n.createElement(_.Ay,{tip:A},n.createElement(g.A,{onClick:G,size:"x-small","aria-label":A,svgIconProps:L})))};FormWrappedInput.displayName="FormWrappedInput";let U=new i.Ay("workflow_builder"),FormWrappedFieldList=({variables:e,slackFunction:t,inputValues:a,functionVariables:i,stepId:p,isFunctionFormWrapped:b,onChange:f})=>{let g=t?.input_parameters,h=(0,n.useMemo)(()=>g?.reduce((e,t)=>{let n=(0,u.w)(t),{label:l,value:i}=a?.[n.name]??{};if(!(0,d.AL)(n,a))return e;if((0,m.sg)(n)){let t=Object.entries(n.properties??{}).reduce((e,[t,a])=>(e[t]=(0,u.w)(a),e),{});return Object.keys(t).forEach(a=>{let o=t[a];if((0,d.AL)(o)){let t=(0,r.A)(i)||"object"!=typeof i?void 0:i[a],s=l?.[a]?.valueLabel;e.push({key:a,parameter:o,value:t,valueLabels:s&&"object"==typeof s?s:void 0,parentParameterName:n.name,propertyKey:a})}}),e}if("object"===n.type)return e;let o="choices"in n&&Array.isArray(n.choices)?n.choices.reduce((e,t)=>(("string"==typeof t.value||"number"==typeof t.value)&&(e[t.value]=t.title),e),{}):void 0;return e.push({key:n.name,parameter:n,value:i,valueLabels:l??o}),e},[])??[],[g,a]),_=(0,n.useCallback)(({parameter:t,parentParameterName:a,propertyKey:r,value:l,valueLabels:o})=>n.createElement(FormWrappedInput,{onChange:f,parameter:t,parentParameterName:a,propertyKey:r,value:l,valueLabels:o,variables:e,functionVariables:i,stepId:p,isFunctionFormWrapped:b}),[i,b,f,p,e]),y=h.map(({key:e})=>e),x=(0,n.useCallback)(e=>{let t=h[e];return n.createElement(o.A,{className:"border_bottom",size:"medium",key:t.key,primaryContent:_(t)})},[h,_]),v=(0,n.useMemo)(()=>{let e=h.filter(({value:e})=>!!(0,R.G)(e)).length,t=h.length-e;return 68*e+52*t+ +h.length+2},[h]),E=U.t("Form questions");return n.createElement(n.Fragment,null,n.createElement(s.A,{text:E,className:"bold",htmlFor:"form-question-list",cursor:null}),n.createElement(l.A,{disableHeight:!0},({width:e})=>n.createElement(c.A,{height:v,keys:y,rowRenderer:x,"aria-label":E,width:e,id:"form-question-list"})))};FormWrappedFieldList.displayName="FormWrappedFieldList"},0x211a99e2f:(e,t,a)=>{"use strict";a.d(t,{l:()=>FormatTextWithVariableTokens});var n=a(0xbad225b5),r=a(0x1d8fafe9f),l=a(0x1ebe91b72),i=a(0x1a4072e61);let FormatTextWithVariableTokens=({text:e,parameterType:t,variables:a})=>{let o=(0,i.t)([(0,l.Mx)(),(0,l.cL)(),(0,l.fE)()],"gi"),s=[],c=0;if(e.replace(o,(l,...i)=>{let o=i[i.length-3];if(o>c){let t=e.slice(c,o);s.push(n.createElement(n.Fragment,{key:`${o}-${t}`},t))}return s.push(n.createElement(r.F,{value:l,variables:a,parameterType:t,key:`${o}-${l}`})),c=o+l.length,""}),!s.length)return n.createElement(n.Fragment,null,e);if(c<e.length){let t=e.substr(c);s.push(n.createElement(n.Fragment,{key:`last-${t}`},t))}return n.createElement(n.Fragment,null,s)};FormatTextWithVariableTokens.displayName="FormatTextWithVariableTokens"},0x2151a9a6:(e,t,a)=>{"use strict";a.d(t,{m:()=>SlackFunctionArrayInput});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x21f3c49e8),s=a(0x1407c6c2c),c=a(0xe874a88a),d=a(0x20482ad21),u=a(0x2264e6ea3),m=a(0x2b7f0bcc),p=a(0x45bd075),b=a(0x1d2cd7755),f=a(0x1e586fbba),g=a(0x1ad596f5f),h=a(0x2501a2cee),_=a(0x250295787),y=a(0x7f5a02e8),x=a(0x6b359530),v=a(0x235d78b7c),E=a(0x88881d67),k=a(0x2173e1832),w=a(0x4c96e5d9),S=a(0x12b6a33fc),C=a(0xbd3de346),A=a(0x1c450e1a),T=a(0x11c82607b),I=a(0x14ea3ce99);let N=(0,T.Ay)("checks if a canvas or list has sharing restricted",(e,t,{fileId:a})=>{let n=t(),r=(0,I.Lp)(n,a);return!!r&&!r.isNonExistent&&((0,C.U9)(r)||(0,C.l7)(r))&&(0,C.Zv)(r)&&(0,A.GF)(n,r)});N.meta={name:"doesCanvasOrListHaveRestrictedSharing",key:"createThunkDoesCanvasOrListHaveRestrictedSharing",description:"checks if a canvas or list has sharing restricted"};var M=a(0x408bdeff),L=a(0x145d46a61),O=a(0x1795d8821),F=a(0x226892387),D=a(0xb11cfed4),P=a.n(D),R=a(0xea8a50b7),B=a.n(R);let W=new d.Ay("workflow_builder"),InputArrayFileEntity=({fileId:e,isAiAnswerStepCanvasOrListInput:t,arrayItemType:a})=>{let l=(0,F.d4)(L.dI),i=(0,r.wA)()(N({fileId:e}));if(!(t&&i))return n.createElement(M.A,{id:e,textClassName:P().fileEntityText});let o=l?W.t("You don\u2019t have permission to share this Canvas. You can ask the owner for access."):"You don\u2019t have permission to share this Canvas. You can ask the owner for access.",s=l?W.t("You don\u2019t have permission to share this List. You can ask the owner for access."):"You don\u2019t have permission to share this List. You can ask the owner for access.",c=a===O.TE.SlackTypesCanvasId?o:s;return n.createElement(w.Ay,{tip:c,position:S.Zj.Left,zIndex:k.m.MenuAboveFullScreen},n.createElement("div",{className:B().container},n.createElement(M.A,{id:e,isDisabled:!0,textClassName:P().fileEntityText}),n.createElement("span",{className:"offscreen"},c)))};InputArrayFileEntity.displayName="InputArrayFileEntity";var V=a(0x2241106d2),H=a(0x223beeef),q=a(0x677a139e),U=a(0x67607d6d);let KeyboardAccessibleEmojiButton=({onEmojiSelected:e,disabled:t=!1,ariaLabel:a,className:r})=>{let l=(0,n.useRef)(null),i=(0,n.useCallback)(()=>l.current?.querySelector("button:not([disabled])"),[]),o=(0,n.useCallback)(e=>{let{key:t,ctrlKey:a,shiftKey:n,metaKey:r,altKey:l}=e;if(!(n||r||a||l)&&("Enter"===t||" "===t)){e.preventDefault();let t=i();t?.click()}},[i]),s=(0,n.useCallback)(e=>{let{target:t,currentTarget:a}=e;if(t!==a)return;let n=i();n&&(n.setAttribute("tabindex","0"),a.setAttribute("tabindex","-1"),n.focus())},[i]),c=(0,n.useCallback)(()=>{let e=l.current,t=i();e&&t&&(e.setAttribute("tabindex","0"),t.setAttribute("tabindex","-1"))},[i]);return((0,n.useEffect)(()=>{let e=i();if(e)return e.addEventListener("blur",c),()=>{e.removeEventListener("blur",c)}},[i,c]),(0,n.useEffect)(()=>{let e=i();e&&e.setAttribute("tabindex","-1")},[i]),t)?n.createElement(U.A,{onEmojiSelected:e,disabled:t}):n.createElement("div",{ref:l,role:"toolbar",tabIndex:0,"aria-label":a,className:r,onKeyDown:o,onFocus:s},n.createElement(U.A,{onEmojiSelected:e,disabled:t}))};KeyboardAccessibleEmojiButton.displayName="KeyboardAccessibleEmojiButton";var z=a(0xb214261e),j=a(0x8c7f74eb),G=a.n(j);let TokenizerInputWrapper=({hasEmojiButton:e=!1,children:t,className:a,...r})=>{let l=i()(a,{[G().withEmojiButton]:e});return t?n.createElement("div",{className:l},t):n.createElement(z.G,{...r,className:l})};TokenizerInputWrapper.displayName="TokenizerInputWrapper";var $=a(0x1ebe91b72),K=a(0x207fb9b92),Y=a(0x21c50a68b),Q=a(0x22b3dbb67),Z=a.n(Q);let J=new d.Ay("workflow_builder"),SlackFunctionTokenizedArray=({value:e,onChange:t,onBlur:a,placeholderText:r,elementId:l,className:i,parameter:c,makeOption:d,splitQuery:u,validator:m,validatorErrorMessage:p="",isDisabled:b=!1,isTokenEditable:f,isErrorVisible:g,hintClassName:h="margin_bottom_0",shouldAutoFocus:_,onSetAddTokenFunction:y,showEmojiButton:x=!1,onEmojiSelected:v,enableEmojiAutocomplete:E,disableIdParsing:k})=>{let w=(0,Y.JK)(),S=(0,s.A)(),C=l||S,A=c.items.type===O.HN.String,[T,I]=(0,n.useState)({currentTokenizerInputText:"",tokenizerInputError:!1}),N=(0,n.useMemo)(()=>"string"==typeof e||"number"==typeof e?[e]:e.map(e=>String(e)),[e]),M=(0,n.useMemo)(()=>!(0,o.A)(e)||m&&T.currentTokenizerInputText&&!m(T.currentTokenizerInputText)?p:J.t("This field is required."),[w,e]),L=T.tokenizerInputError&&!(0,o.A)(T.currentTokenizerInputText.trim()),{errorText:F,onBlur:D}=(0,K.K)({errorMessage:M,isErrored:L}),P=(0,n.useCallback)(()=>{D(),a()},[a,D]),R=(0,n.useCallback)((e,a,n)=>{let r=e.map(e=>(0,$.cL)().test(e)?e:Number(e));t(A?e:r);let l={currentTokenizerInputText:a,tokenizerInputError:!1};return n&&""!==a&&(l.tokenizerInputError=!0),I(l),l},[A,t]),B=(0,n.useCallback)(t=>{R([..."string"==typeof e||"number"==typeof e?[String(e)]:e.map(String),t],"",!1)},[e,R]),W=(0,n.useCallback)(e=>{v?.(e),B(`:${e}:`)},[v,B]);(0,n.useEffect)(()=>{y&&y(B)},[y,B]);let V=!g&&c.hint;return n.createElement("div",null,n.createElement("div",{className:Z().inputWrapper},n.createElement(TokenizerInputWrapper,{hasEmojiButton:x,className:i,tokenizedItems:N,untokenizedText:T.currentTokenizerInputText,onChange:R,isInvalid:b??!!F,errorMessage:b?p:F,isDisabled:b,onBlur:P,placeholderText:r,itemValidator:m,ariaLabelledBy:C,ariaLabel:N.length>0&&c.title?c.title:r,makeOption:d,splitQuery:u,inputDataQaPrefix:C,isTokenEditable:f,focusOnMount:_,enableEmojiAutocomplete:E,disableIdParsing:k}),x&&!b&&n.createElement(KeyboardAccessibleEmojiButton,{onEmojiSelected:W,disabled:b,ariaLabel:J.t("Emoji"),className:Z().emojiButton})),V&&n.createElement(q.A,{className:h},c.hint))};SlackFunctionTokenizedArray.displayName="SlackFunctionTokenizedArray";var X=a(0x1a740dbac),ee=a(0xf33a4f91),et=a(0x118f04a01),ea=a(0xcb24a23b),en=a(0x1d3dd4cbe);let er=new d.Ay("workflow_builder");var el=a(0x668181b3),ei=a(0x2772625d),eo=a(0xc67f3d80);let es=new d.Ay("workflow_builder");var ec=a(0x1ba35eb3b),ed=a(0x4b32db5f),eu=a(0x1b05cc3ce),em=a(0x10d53599f),ep=a(0x1de80d519),eb=a(0x213c0555e),ef=a(0x19dc73101),eg=a(0x1aad32b98),eh=a(0xa1832ae4),e_=a(0xb8504a42),ey=a(0x4a120eb2),ex=a(0x2a3fb7ec),ev=a(0x16ed1b0dc),eE=a(0xa985ed31),ek=a(0x4f725d55),ew=a(0xd2fa49d0),eS=a(0x1b18cac4b),eC=a(0x17f39e0ff),eA=a(0xe684f705),eT=a(0x1ee439e69),eI=a(0xdcfa8f6a),eN=a.n(eI),eM=a(0x2310bfb55),eL=a.n(eM);let eO=new d.Ay("workflow_builder"),SlackFunctionArrayInput=({value:e=[],parameter:t,onChange:a,variables:l,functionId:d,selectDataQa:k,formatVariableBeforeInsert:w,externalWorkspaceId:S,callbackId:A,allowVariables:T,hideLabel:M,placeholder:D,isParameterSyncedWithForm:P,shouldAlwaysDisplayVariableSelector:R,invalidKeyword:B,shouldAutoFocus:W,enableEmojiAutocomplete:q})=>{let U=(0,r.wA)(),z=(0,F.d4)(eA.cA),j=(0,F.d4)(eT.H7),G=(0,eh.ZT)(j),$=(0,eh.F1)(j),Y=(0,e_.kA)(j),Q=(0,s.A)(),{viewOnly:Z,onVariableMenuOpen:J,messagePostedTriggerPrivateChannelAccess:eI,messagePostedTriggerPrivateChannelTeamIds:eM,aiStepPrivateChannelAccess:eF,aiStepPrivateChannelTeamIds:eD}=(0,en.e)(),eP=(0,F.d4)(L.sQ),eR=(0,F.d4)(eC.o),eB=(0,F.d4)(I.Pz),{is_required:eW=!1,isParameterFormWrappable:eV,name:eH}=t,eq="display_type"in t?t.display_type:void 0,eU=(eW||(0,eu.L$)(t))&&!eV,[ez,ej]=(0,n.useState)(null),eG=t.items,e$=eG.type,eK=e$===O.TE.String?eG.format:void 0,eY=e$===O.TE.Boolean,eQ=e$===O.TE.SlackTypesUserId||e$===O.TE.SlackTypesChannelId||e$===O.TE.SlackTypesUsergroupId||e$===O.TE.SlackTypesTeamId||e$===O.TE.SlackTypesCanvasId||e$===O.TE.SlackTypesListId||e$===O.TE.SlackTypesFileId,eZ=eO.t("True"),eJ=eO.t("False"),eX=D??t?.description,e0=eO.t("Select channels"),e1=eO.t("Select users"),e2=eO.t("Select user groups"),e4=eO.t("Select numbers"),e8=eO.t("Select integers"),e5=eO.t("Select strings"),e6=eO.t("Select emails"),e3=eO.t("Select URLs"),e7=eO.t("Select booleans"),e9=eO.t("Select timestamps"),te=eO.t("Select teams"),tt=eO.t("Select canvases"),ta=eO.t("Select lists"),tn=(0,F.d4)(L.HD),tr=(0,F.d4)(L.dI),tl=(0,F.d4)(L.EY),ti=(0,n.useMemo)(()=>A===O.Uk.MessagePosted&&e$===O.TE.String,[e$,A]),to=(0,n.useMemo)(()=>(e$===O.TE.SlackTypesCanvasId||e$===O.TE.SlackTypesListId)&&A===O.oW.AiAnswer,[e$,A]),ts=(0,n.useCallback)(e=>{ez&&ti&&ez(`:${e}:`)},[ez,ti]),tc=(0,n.useCallback)(e=>{ej(()=>e)},[]),td=(0,n.useMemo)(()=>A!==O.Uk.MessagePosted?void 0:eI?eP?eO.t("Select up to 20 public and private channels in {teamName}.",{teamName:$}):`Select up to 20 public and private channels in ${$}.`:eO.t("Select up to 20 public channels in {teamName}.",{teamName:$}),[A,$,eI,eP]),tu=(0,n.useMemo)(()=>!ee.gY.some(e=>e===e$)||Z||P,[e$,P,Z]),tm=(0,n.useMemo)(()=>eY?[{label:eZ,value:"true"},{label:eJ,value:"false"}]:"choices"in eG?eG.choices?.map(e=>({label:e.title,value:e.value})):"enum"in eG?eG.enum?.map(e=>({label:String(e),value:e})):void 0,[eG,eJ,eY,eZ]),tp=T&&!tu&&(!("enum"in eG)||!!R),tb=(0,n.useCallback)(e=>eX||(e?({number:e4,integer:e8,string:e5,boolean:e7,"slack#/types/channel_id":e0,"slack#/types/user_id":e1,"slack#/types/user_email":e1,"slack#/types/usergroup_id":e2,"slack#/types/timestamp":e9,"slack#/types/team_id":te,"slack#/types/list_id":ta,"slack#/types/canvas_id":tt,"slack#/types/dynamic_pair":"","slack#/types/channel_canvas_id":"","slack#/types/canvas_template_id":"","slack#/types/currency":"","slack#/types/message_context":"","slack#/types/file_id":"","slack#/types/mixed":""})[e]:""),[eX,e4,e8,e5,e7,e0,e1,e2,e9,te,ta,tt]),tf=A===O.oW.SummarizeChannel,tg=A===O.oW.AddAgentToChannel,th=(0,V.N)({callbackId:A,parameterType:e$,externalWorkspaceId:S}),t_=eU&&e$===O.TE.SlackTypesTeamId;(0,n.useEffect)(()=>{t_&&(Y||S||e.includes(G)?S&&!e.includes(S)&&a(t,[S]):a(t,[G]))},[t_,a,t,e,S,eU,Y,G]);let ty=(0,n.useCallback)(e=>(0,ec.yH)(e,t)||(0,ec.xY)({variable:e,parameter:t}),[t]),[tx,tv]=(({variables:e,parameter:t,id:a,isRequired:r,value:l,isValidEmptyObject:i,callbackId:o,arrayItemType:s,allChannels:c,allFiles:d})=>{let{messagePostedTriggerPrivateChannelAccess:u,messagePostedTriggerPrivateChannelTeamIds:m}=(0,en.e)(),p=(0,F.d4)(L.sQ);return(0,n.useMemo)(()=>{let[n,b]=(0,ea.g)({variables:e,id:a,value:l,isValidEmptyObject:i,isRequired:r,parameter:t,arrayItemType:s,allFiles:d});if(!p)return[n,b];let f=(0,et.Se)(l,{callbackId:o,arrayItemType:s??"",allChannels:c??{},privateChannelAccess:u,privateChannelTeamIds:m,experimentMessagePostedTriggerInPrivateChannelsGroupOn:p}),g=[...b];f.forEach(e=>{g.includes(e)||g.push(e)});let h=[...n];return f.length>0&&h.push({id:`${a}_permission_error`,message:er.t("This trigger can\u2019t use private channels. Remove private channels to continue.")}),[h,g]},[e,a,l,i,r,t,o,s,c,d,u,m,p])})({variables:l,id:eH,value:e,isRequired:eU,parameter:t,callbackId:A,arrayItemType:e$,allChannels:eR,allFiles:eB}),{onBlur:tE,okayToDisplay:tk}=(0,K.K)({errorMessage:void 0,isErrored:tx.length>0}),tw=(0,n.useMemo)(()=>tk?tx:tx?.filter(e=>e.id.endsWith("_permission_error")||e.id.endsWith("_is_deleted_file")),[tk,tx]),tS=(({variables:e,value:t,id:a,callbackId:r,arrayItemType:l})=>{let i=(0,F.d4)(L.dI),o=[],s=(0,n.useMemo)(()=>r===O.oW.AiAnswer&&!!Array.isArray(t)&&l===O.TE.SlackTypesChannelId&&t.some(e=>"string"==typeof e&&((0,eo.sU)(e)||(0,ei.cn)(e))),[r,t,l]),c=i?es.t("The contents of any channel used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u2019re ok with sharing this content before continuing."):"The contents of any channel used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u2019re ok with sharing this content before continuing.";if(s&&o.push({id:`${a}_has_channels`,message:c}),(0,F.d4)(a=>r===O.oW.AiAnswer&&(l===O.TE.SlackTypesCanvasId||l===O.TE.SlackTypesFileId||l===O.TE.SlackTypesListId)&&Array.isArray(t)?t.some(t=>{if("string"!=typeof t)return!1;if((0,ei.cn)(t)){let a=(0,el.x)(e.list,t);return!!(a&&!a.isTombstone&&a.isAvailable&&a.type===l)}return!!(0,I.Lp)(a,t)}):null)){let e,t;l===O.TE.SlackTypesCanvasId?(e=es.t("Canvas",{fallbackHash:"a3f80b87a456136fc59c442bd1ee5b5eec2430f1",fallbackHashNs:"files"}),t="canvas_or_canvas_variable"):l===O.TE.SlackTypesFileId?(e=es.t("File",{fallbackHash:"2c3cafa4db3f3e1e51b3dff4303502dbe42b7a89",fallbackHashNs:"files"}),t="file_or_file_variable"):l===O.TE.SlackTypesListId&&(e=es.t("List",{fallbackHash:"a1fffaaafb7cc996685bceb829c053cc4f7de43d",fallbackHashNs:"files"}),t="list");let n=i?es.t("The contents of any {entityTypeText} used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u2019re ok with sharing this content before continuing.",{entityTypeText:e}):`The contents of any ${e} used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u{2019}re ok with sharing this content before continuing`;o.push({id:`${a}_has_${t}`,message:n})}return o})({variables:l,id:eH,value:e,callbackId:A,arrayItemType:e$}),tC=ti&&!eQ&&tk&&eU&&!eV&&(0,o.A)(e),tA=ti&&!Z&&tn,tT=(0,n.useCallback)(e=>(ti||tE(),1===e.length&&(0,ee.x1)(l,String(e[0])))?a(t,String(e[0])):a(t,e),[tE,a,t,l,ti]),tI=(0,n.useCallback)(e=>tT(e.map(e=>e.value)),[tT]),tN=(0,n.useCallback)(e=>tT(e.map(e=>Number(e.value))),[tT]),tM=(0,n.useCallback)(e=>tT(e.map(e=>e.value)),[tT]),tL=(0,n.useCallback)((a,n)=>{let r=`${n}-${a}`,i=!1,o="string"==typeof a?a:String(a);if("choices"in eG&&(o=eG.choices?.find(e=>e.value===a)?.title??o),"string"==typeof a){if((0,ei.cn)(a)){let n=(0,el.x)(l.list,a);if(!n)return{key:r,label:eO.t("Missing Data"),isError:!1,svgIcon:{name:"css"},value:a};if(o=n.label||o,i=!n.isAvailable||n.isTombstone||!(0,ec.yH)(n,t),n.type===O.TE.Array){let a="string"!=typeof e&&e.length>1,r=t.can_flatten;o=eO.t("{selectedDataLabel} (multiple)",{selectedDataLabel:n.label}),i=i||a&&!r}return{key:r,label:o,svgIcon:{name:"css"},value:a,isError:i}}if((e$===O.TE.SlackTypesCanvasId||e$===O.TE.SlackTypesListId)&&(0,eE.A)(a)){let e=eB?.[a];if(!e||e.isNonExistent||(0,C.uO)(e)){let e=e$===O.TE.SlackTypesCanvasId?"Canvas":"List";return{key:r,label:eO.t("Deleted {fileType}",{fileType:e,fallbackHash:"3876d76c9dd08c3442581204e246d74ade686acd",fallbackHashNs:"files"}),isError:!0,svgIcon:{name:"css"},value:a}}}t.items.type===O.TE.Boolean&&(o="true"===a.toLowerCase()?eZ:eJ),t.items.type===O.TE.Number&&(i=!(0,ee.Fr)(a)),t.items.type===O.TE.Integer&&(i=!(0,ee.o6)(a)),t.items.type===O.TE.SlackTypesTimestamp&&(i=!(0,ee.ak)(a)),ti&&(i=!!B&&a.toLowerCase()===B),t.items.type===O.TE.String&&("email"===eK?i=!(0,ee.V2)(a):"url"===eK&&(i=!(0,ee.U6)(a)))}return{key:r,label:o,value:a,isError:i}},[eG,eJ,t,eZ,e,l.list,ti,B,eK,e$,eB]),tO=(0,n.useMemo)(()=>"string"==typeof e?[tL(e,0)]:e.map(tL),[tL,e]),tF=(0,n.useMemo)(()=>!1===T?[]:(0,E.PW)(l.groups,ty),[ty,l.groups,T]),tD=(0,n.useMemo)(()=>(0,ed.T)(tF),[tF]),tP=(0,n.useCallback)(n=>{let r=w(n,{parameterType:t.type,skipMacro:(0,E.nK)(n)}).id;return"string"==typeof e?a(t,[e,r]):a(t,[...e,r])},[w,a,t,e]),tR=(0,n.useCallback)(e=>{if("string"==typeof e.value){if((0,ev.A)(e.value))return n.createElement(_.A,{channelId:e.value,showTeamForLocalChannels:!0});if((0,ek.A)(e.value))return n.createElement(em.A,{id:e.value,showAvatar:!0});if((0,ew.A)(e.value))return n.createElement(eb.A,{id:e.value,showDescription:!1});if((0,u.Ay)(e.value))return n.createElement(ep.e,{id:e.value});if((0,eE.A)(e.value))return n.createElement(InputArrayFileEntity,{fileId:e.value,isAiAnswerStepCanvasOrListInput:to,arrayItemType:e$})}return tm?n.createElement("div",{id:"string"==typeof e.label?e.label:"",className:"display_flex align_items_center"},e.svgIcon&&n.createElement(h.Ah,{name:e.svgIcon.name}),e.label):e.data&&e.data.label?n.createElement(x.R,{data:e.data}):e.label},[tm,e$,to]),tB=(0,n.useCallback)((e,t)=>{let a=[],n=(0,g.A)(tD,t);if(tm&&""===t)return a.push(...tm),c.S.resolve(a);if(n.length>0&&!tm&&a.push(...n),e.length>0)if(to){let t=e.map(e=>"string"==typeof e.value&&(0,eE.A)(e.value)&&U(N({fileId:e.value}))?{...e,isDisabled:!0}:e);a.push(...t)}else a.push(...e);return c.S.resolve(a)},[tm,tD,to,U]),tW=(0,n.useCallback)(e=>{if(!tm)return c.S.resolve([]);let t=(0,eS.A)(e);return c.S.resolve(tm.filter(e=>(0,o.A)(t)||(0,eS.A)(String(e.label)).includes(t)).map((e,t)=>tL(e.value,t)))},[tm,tL]),tV=(0,n.useMemo)(()=>t.hint?[{id:`${Q}-hint`,message:t.hint,className:"margin_bottom_0"}]:void 0,[Q,t.hint]),tH=(0,n.useCallback)((e,t)=>n.createElement(ey.x,{selectId:Q,width:"100%",placeholderText:e,hints:tV,search:tW,renderOption:tR,selectedOptions:tO,onSelectedItemsChange:t,processOptions:tB,expandOnFocus:!0,disableSearchOnMount:!1,onBlur:tE,isInvalid:tk&&tx.length>0,isDisabled:tu}),[Q,tV,tW,tR,tO,tB,tE,tk,tx.length,tu]),tq=(0,n.useCallback)((e,t)=>a=>{t(a?.target?.checked?[...tO,e]:tO.filter(t=>t.value!==e.value))},[tO]),tU=(0,n.useCallback)(e=>tm?n.createElement("div",null,tm.map(t=>{let a=tO.some(e=>e.value===t.value),r=`${Q}-${t.value}`;return n.createElement("div",{key:r,className:"display_block margin_bottom_50"},n.createElement(b.A,{htmlFor:r,text:t.label,type:"inline"},n.createElement(p.A,{id:r,checked:a,onChange:tq(t,e),disabled:tu})))})):null,[tm,tO,Q,tu,tq]),tz=(0,n.useCallback)((a,r,l,i)=>{let o=[O.TE.Boolean,O.TE.String,O.TE.Integer,O.TE.Number,O.TE.SlackTypesTimestamp,O.TE.SlackTypesDynamicPair];return(0,ex.X)(o,t.items.type)?n.createElement(SlackFunctionTokenizedArray,{elementId:Q,value:e,onChange:tT,makeOption:tL,splitQuery:i,parameter:t,placeholderText:l,validatorErrorMessage:a,validator:r,isDisabled:tu,onBlur:tE,isTokenEditable:ti,isErrorVisible:tC,shouldAutoFocus:W,onSetAddTokenFunction:ti?tc:void 0,showEmojiButton:tA,onEmojiSelected:ts,enableEmojiAutocomplete:q,disableIdParsing:ti}):null},[Q,e,tT,tL,tE,t,tu,ti,tC,W,tc,tA,ts,q]),tj=(0,n.useMemo)(()=>{switch(A){case O.oW.AiAnswer:return tl?(0,ee.AR)({privateChannelAccess:eF,privateChannelTeamIds:eD}):ee.L6;case O.Uk.MessagePosted:return(0,ee.Ut)({privateChannelAccess:eI,privateChannelTeamIds:eM});default:return ee.L6}},[tl,A,eI,eM,eF,eD]),tG=(0,n.useMemo)(()=>A===O.oW.AiAnswer?ee.dS:ee.jO,[A]),t$=(0,n.useMemo)(()=>{let e=[O.TE.SlackTypesChannelId,O.TE.SlackTypesUserId,O.TE.SlackTypesUsergroupId,O.TE.SlackTypesTeamId,O.TE.SlackTypesCanvasId,O.TE.SlackTypesListId,O.TE.SlackTypesFileId];if(!(0,ex.X)(e,t.items.type))return;let a={[O.TE.SlackTypesChannelId]:tj,[O.TE.SlackTypesUserId]:ee.R_,[O.TE.SlackTypesUsergroupId]:ee.C3,[O.TE.SlackTypesTeamId]:ee.QX,[O.TE.SlackTypesCanvasId]:tG,[O.TE.SlackTypesListId]:ee.vU,[O.TE.SlackTypesFileId]:ee.Fq}[t.items.type],n=S?{...a,entities:(0,y.d7)(a.entities,S)}:a;if(tf||tg)return th;let r="filter"in n?n.filter:void 0;return{...n,filter:e=>(!r||!1!==r(e))&&(tm?tm.map(e=>e.value).includes(e.id):t.items.type===O.TE.SlackTypesTeamId?!(0,u.JV)(e.id)&&(0,eg.nO)(z,e.id):t.items.type!==O.TE.SlackTypesFileId||!(0,C.DQ)(e)&&!(0,C.l7)(e))}},[t.items.type,tj,tG,S,tf,tg,th,tm,z]),tK=(0,n.useMemo)(()=>{switch(e$){case O.TE.SlackTypesUserId:case O.TE.SlackTypesChannelId:case O.TE.SlackTypesUsergroupId:case O.TE.SlackTypesTeamId:case O.TE.SlackTypesCanvasId:case O.TE.SlackTypesListId:case O.TE.SlackTypesFileId:return n.createElement(ef.h,{key:`${Q}-${eF}-${eD?.join(",")}`,id:Q,onSelectedItemsChange:tI,placeholderText:tb(e$),hints:tV,renderOption:tR,searcherOptions:t$,selectedOptions:tO,selectId:Q,width:"100%",className:i()(eN().entity,eN().placeholder_text),isInvalid:tk&&tx.length>0,isDisabled:tu,focusOnMount:W&&0===tO.length,processOptions:tB,errors:tw,selectDataQa:k,expandOnFocus:!W,onBlur:tE,allowFileToken:tr,invalidSelectedTokenIndexes:tv});case O.TE.String:if(tm){if("checkboxes"===eq)return tU(tI);return tH(tb(e$),tI)}if("email"===eK)return tz(eO.t("This is not a valid email address."),ee.V2,e6,ee.Db);if("url"===eK)return tz(eO.t("This is not a valid URL."),ee.U6,e3,ee.Ci);return tz(eO.t("This is not a valid string."),ee.r,tb(e$),ee.r0);case O.TE.SlackTypesTimestamp:if(tm)return tH(tb(e$),tN);return tz(eO.t("This is not a valid timestamp."),ee.ak,tb(e$));case O.TE.Integer:if(tm)return tH(tb(e$),tN);return tz(eO.t("This is not a valid integer."),ee.o6,tb(e$));case O.TE.Number:if(tm)return tH(tb(e$),tN);return tz(eO.t("This is not a valid number."),ee.Fr,tb(e$));case O.TE.Boolean:return tH(tb(e$),tM);default:return n.createElement(n.Fragment,null,n.createElement(X.b,{parameter:t,functionId:d}),tz(eO.t("This type is not currently supported."),()=>!1))}},[e$,Q,tI,tb,tV,tR,t$,tO,tk,tx,tw,tu,W,tB,k,tE,tr,tm,eK,tz,tH,tU,tM,t,d,e6,e3,tN,eq,tv,eF,eD]);if(t_&&!Y||t_&&S)return null;let renderComponent=()=>n.createElement(n.Fragment,null,n.createElement("div",{className:"display_flex","data-qa":"array-input"},n.createElement("div",{className:i()(eL().inline_width,{[eN().entity]:M})},tK),tp&&n.createElement(v.jx,{onSelect:tP,data:l.groups,customDataFilter:ty,renderIconInline:!0,onMenuTriggerClick:J,className:eL().dynamicDataMenuButton})),!tu&&n.createElement("div",{className:"display_flex justify_content_between"},n.createElement("div",null,!eQ&&tk&&tx?.map(e=>n.createElement(f.A,{key:e.id},e.message)))));return renderComponent.displayName="renderComponent",n.createElement(H.z,{elementId:Q,parameter:t,hideLabel:M,isParameterSyncedWithForm:P,subtext:td,callbackId:A},tS&&tS.map(e=>n.createElement("div",{className:"margin_bottom_75",key:e.id},n.createElement(m.Ay,{level:m.A_.warning},e.message))),renderComponent())};SlackFunctionArrayInput.displayName="SlackFunctionArrayInput"},0xa224974e:(e,t,a)=>{"use strict";a.d(t,{h:()=>SlackFunctionBlocksInput});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x21f3c49e8),i=a(0x1d24ec95f),o=a(0x1407c6c2c),s=a(0x20b4dda68),c=a(0x20482ad21),d=a(0x207b33662),u=a(0x1576dac7),m=a(0x13f7d86f3),p=a(0x344bb842),b=a(0x2501a2cee),f=a(0x668181b3),g=a(0x1d62f3e69),h=a(0x1842d80dc),_=a(0x16b446ebc),y=a(0x8b49ee82);function addItemToArrayConcatMacroString(e,t){if(!e||0===e.length)return t;let a=(0,_.D)(e);if(0===a.length){let a=buildConcatMacro(e,t);return isArrayConcatMacroValid((0,_.q)(a))?a:t}return a.every(isArrayConcatMacroValid)?(a.push(buildArrayConcat("$$",t)),toMacroString(a)):t}function getItemsFromArrayConcatMacroString(e){if(!e||0===e.length)return[];let t=(0,_.D)(e);return 0===t.length?[e]:t.every(isArrayConcatMacroValid)?t.reduce((e,t)=>{for(let a of t.namedInputs)"$$"!==a.value&&e.push(a.value);return e},[]):[]}function constructArrayConcatMacroStringFromItems(e){if(0===e.length)return null;if(1===e.length)return e[0];if(2===e.length)return buildConcatMacro(e[0],e[1]);let t=[buildConcatMacro(e[0],e[1])];for(let a of e.slice(2))t.push(buildConcatMacro("$$",a));return t.join(h.u6)}function isArrayConcatMacroValid(e){return!(null===e||"array"!==e.namespace||"concat"!==e.macroCallbackId||2!==e.namedInputs.length||"collection_one"!==e.namedInputs[0].parameter||"collection_two"!==e.namedInputs[1].parameter||e.namedInputs[0].value.includes("array.concat")||e.namedInputs[1].value.includes("array.concat"))}function buildArrayConcat(e,t){return{namespace:y.J.ARRAY,macroCallbackId:"concat",namedInputs:[{parameter:"collection_one",value:e},{parameter:"collection_two",value:t}],templateValue:buildConcatMacro(e,t)}}function buildConcatMacro(e,t){return`{array.concat(collection_one=${e}, collection_two=${t})}`}function toMacroString(e){return e.map(e=>e.templateValue).join(h.u6)}var x=a(0x1897055b4),v=a.n(x);let E={name:"trash"},k=new c.Ay("workflow_builder"),Files=({value:e,parameter:t,variables:a,onChange:r})=>{let l=(0,n.useMemo)(()=>{if(!e)return[];let t=getItemsFromArrayConcatMacroString(e);return 0===t.length?[e]:t},[e]),[i,o]=(0,n.useMemo)(()=>{let e=[],t=[];for(let n of l){let r=a?(0,f.x)(a.list,n):void 0,l=r?.type==="slack#/types/file_id",i=r?.type==="array"&&r?.items?.type==="slack#/types/file_id";r&&(l||i)?e.push(r):t.push(n)}return[e,t]},[l,a]),s=(0,n.useCallback)(e=>{r(t,constructArrayConcatMacroStringFromItems(l.filter(t=>t!==e)))},[l,r,t]),c=(0,n.useCallback)(e=>n.createElement("div",{className:v().sendMessageFile,key:e.id},n.createElement("span",{className:v().sendMessageAttachmentIcon},n.createElement(b.Ah,{name:"attachment"})),n.createElement("div",{key:e.id,className:"c-texty_input_unstyled"},n.createElement("span",{className:"c-texty_workflow_token"},n.createElement("span",{className:g.Dc},n.createElement("i",{className:`${g.tF} c-icon`}),n.createElement("span",{className:g.dc},e.defaultLabel)))),n.createElement(p.A,{"aria-label":k.t("remove"),onClick:()=>s(e.id),svgIconProps:E})),[s]),d=(0,n.useCallback)(e=>n.createElement("div",{className:v().sendMessageFileError,key:e},n.createElement("span",{className:v().sendMessageAttachmentIcon},n.createElement(b.Ah,{name:"warning"})),n.createElement("div",{key:e,className:"c-texty_input_unstyled"},n.createElement("span",{className:"c-texty_workflow_token"},n.createElement("span",{className:g.Dc},n.createElement("span",{className:g.dc},k.t("Missing variable reference"))))),n.createElement(p.A,{"aria-label":k.t("remove"),onClick:()=>s(e),svgIconProps:E})),[s]);return i?.length||o?.length?n.createElement("div",{className:v().sendMessageFilesWrapper},i.map(c),o.map(d)):null};Files.displayName="Files";var w=a(0x223beeef),S=a(0x1db69cda),C=a(0x1795d8821),A=a(0x1d3dd4cbe),T=a(0x1242da2eb);function checkForPlaceholderVariablesInDelta(e){return!!e&&!!e.ops&&e.ops.some(e=>(0,T.Pd)(e))}var I=a(0x1b05cc3ce),N=a(0x207fb9b92),M=a(0x2001af3ac),L=a(0x24429189c);let O=new c.Ay("workflow_builder"),SlackFunctionBlocksInput=({value:e,callbackId:t,parameter:a,variables:c,onChange:p,formatVariableBeforeInsert:b,parameters:f,configuredParameters:g,required:h,allowVariables:_,hideLabel:y,subtext:x,labelClassName:v,isParameterSyncedWithForm:E,sendAsUserValue:k=!1,experimentUserAuthoredWorkflowPostsFeGroupOn:T=!1,experimentWfbAiAnswerStepGroupOn:F=!1,wfbAiPromptButtons:D,excludePrivateChannelAutocomplete:P,privateChannelTeamIds:R})=>{let{title:B,isParameterFormWrappable:W,type:V}=a,H=(0,o.A)(),[q,U]=(0,n.useState)(!1),[z,j]=(0,n.useState)(!1),G=(0,r.wA)(),{viewOnly:$,onVariableMenuOpen:K,aiStepPrivateChannelAccess:Y,aiStepPrivateChannelTeamIds:Q}=(0,A.e)(),Z=(0,n.useMemo)(()=>q||z||!!(h||(0,I.L$)(a))&&!W&&(0,l.A)(e),[e,q,z,h,a,W]),J=(0,n.useMemo)(()=>q?O.t("Message is too long."):z?F?O.t("Please replace all placeholder variables with defined variables."):"Please replace all placeholder variables with defined variables.":O.t("This field is required."),[q,z,F]),{errorText:X,onBlur:ee}=(0,N.K)({errorMessage:J,isErrored:Z,shouldErrorPreventSave:z}),et=(0,n.useCallback)(({blocks:e})=>{if(e){let t=G((0,L.f)({blocks:e}));U((0,M.A)(t)>s.nb),j(checkForPlaceholderVariablesInDelta(t))}p(a,e&&e.length>0?[(e=>{let t=(0,S.A)(e),a={...e,elements:[]};for(;t.elements.length;){let e=t.elements.shift();if(!e)continue;if("rich_text_section"!==e.type){a.elements.push(e);continue}let n=[];for(;e.elements.length;){let t=e.elements.shift();if(t){if("workflowtoken"!==t.type||t.data_type!==C.TE.SlackTypesRichText&&t.data_type!==C.TE.SlackTypesExpandedRichText){n.push(t);continue}n.length&&a.elements.push({...e,elements:n}),a.elements.push(t),n=[]}}n.length&&a.elements.push({...e,elements:n})}return a})(e[0])]:e??[])},[G,p,a]),ea=(0,n.useMemo)(()=>f?.find(({name:e})=>"files"===e),[f]),en=(0,n.useMemo)(()=>g?.files?.value??void 0,[g]),er=(0,n.useCallback)(()=>ea?n.createElement(Files,{value:en,parameter:ea,variables:c,onChange:p}):null,[ea,en,p,c]),el=(0,n.useCallback)(e=>{let[t,a]=(0,i.A)(e,e=>e.type===C.TE.Array&&e.items?.type===C.TE.SlackTypesFileId&&ea);if(t.length>0){let e=getItemsFromArrayConcatMacroString(en),a=en;for(let n of t)e.includes(n.id)||(a=addItemToArrayConcatMacroString(a,n.id));p(ea,a)}return a},[ea,en,p]),ei=(0,n.useCallback)(({activeTokenElement:e,activeTokenData:a,activeTokenVariableData:r,hideCustomizeDataPopover:l,updateDynamicData:i})=>(0,m.L4)(r)?n.createElement(u.I,{tetherElement:e,tokenData:a,variableData:r,callbackId:t,onClose:l,updateDynamicData:i,fromRichText:!0}):null,[t]),eo=(0,n.useMemo)(()=>"string"==typeof e?[]:e,[e]);return n.createElement(w.z,{elementId:H,parameter:a,hideLabel:y,className:v,subtext:x,isParameterSyncedWithForm:E},n.createElement(d.c,{id:"message",initialText:"string"==typeof e?e:"",initialBlocks:eo,data:c,enableDynamicData:_,placeholder:a?.description??O.t("Ex: Hello!"),ariaLabel:B??O.t("Set the step message text"),hint:a.hint,onTextChange:et,onBlur:ee,callbackId:t,errorText:X||null,maxLength:s.nb,useBlocks:!0,enableEmoji:!0,shouldAddNewLineOnEnter:!0,onEnter:null,focusOnMount:!1,isDisabled:$||E,formatVariableBeforeInsert:b,canInsertAllVariablesByGroup:!0,interceptVariablesInsertion:el,renderFiles:er,getVariableCustomizeMenu:ei,onVariableMenuOpen:K,useExpandedRichText:V===C.TE.SlackTypesExpandedRichText,sendAsUserValue:k,experimentUserAuthoredWorkflowPostsFeGroupOn:T,wfbAiPromptButtons:D,excludePrivateChannelAutocomplete:P??!1===Y,privateChannelTeamIds:R??Q}))};SlackFunctionBlocksInput.displayName="SlackFunctionBlocksInput"},0x19f0ddaf7:(e,t,a)=>{"use strict";a.d(t,{B:()=>SlackFunctionBooleanInput});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1407c6c2c),o=a(0x20482ad21),s=a(0x11a296110),c=a(0x45bd075),d=a(0x677a139e),u=a(0x2501a2cee),m=a(0x235d78b7c),p=a(0x223beeef),b=a(0x1ba35eb3b),f=a(0x1d3dd4cbe),g=a(0x668181b3),h=a(0x2772625d),_=a(0x1282104f7),y=a(0x19935b6b1),x=a.n(y);let v=new o.Ay("workflow_builder"),E={type:"inline"},k={name:"css"},SlackFunctionBooleanInput=({value:e,parameter:t,variables:a,onChange:r,formatVariableBeforeInsert:o,allowVariables:y,hideLabel:w,isParameterSyncedWithForm:S})=>{let C=(0,i.A)(),{viewOnly:A,onVariableMenuOpen:T}=(0,f.e)();(0,n.useEffect)(()=>{(""===e||void 0===e)&&r(t,String(t.default??!1))},[r,t,e]);let I=(0,n.useCallback)(e=>{r(t,String(e?.target?.checked??!1))},[r,t]),N=(0,n.useCallback)(e=>{let a=o(e,{parameterType:t.type}).id;return r(t,a)},[o,r,t]),M=(0,n.useCallback)(()=>r(t,""),[t,r]),L=(0,n.useMemo)(()=>{if((0,h.cn)(e))return(0,g.x)(a.list,e)},[e,a.list]),O=(0,n.useCallback)(()=>n.createElement(s.Nm,{onClick:M,"aria-label":v.t("Remove variable from {label}",{label:t.title??t.name??t.description}),disabled:A},n.createElement(u.Ah,{name:"close","data-qa":"token_remove_icon"})),[M,t,A]),F=A||S,D=y&&!L&&!S;return n.createElement("div",{className:l()(x().outerContainer)},n.createElement("div",{className:l()(x().innerContainer,{[x().variableReference]:L})},n.createElement(p.z,{elementId:C,parameter:t,labelProps:E,hideLabel:w,isParameterSyncedWithForm:S},n.createElement(c.A,{"data-qa":"checkbox",id:C,onChange:I,checked:"true"===e,disabled:!!L||F})),L&&n.createElement(_.A,{svgIcon:k,className:x().token,entityId:L.id,label:L.label,renderIcon:O,isDisabled:F}),D&&n.createElement(m.jx,{onSelect:N,data:a.groups,customDataFilter:b.XZ,renderIconInline:!0,isDisabled:F,onMenuTriggerClick:T})),t.hint&&!L&&n.createElement(d.A,{className:"margin_bottom_0 padding_left_150"},t.hint))};SlackFunctionBooleanInput.displayName="SlackFunctionBooleanInput"},0x1fe708dbe:(e,t,a)=>{"use strict";a.d(t,{e:()=>DateTimeInput});var n=a(0xbad225b5),r=a(0x1b63e435a),l=a.n(r),i=a(0x1407c6c2c),o=a(0x4bdf0df6),s=a(0x20482ad21),c=a(0x2503b7c1),d=a(0x677a139e),u=a(0x1e586fbba),m=a(0x9154b87c),p=a(0x1f90df740),b=a(0x1d3dd4cbe),f=a(0x124d99cb0),g=a(0x1d1437423),h=a(0x1b9d5cc0c),_=a(0x226892387),y=a(0x19c76d181),x=a(0xe684f705),v=a(0x1358509bc),E=a.n(v);let k=new s.Ay("workflow_builder"),DateTimeInput=({value:e,timezone:t,parameter:a,required:r,onChange:s,dateAriaLabel:v,timeAriaLabel:w,shouldValidate:S=!0,isParameterSyncedWithForm:C})=>{let{viewOnly:A}=(0,b.e)(),T=(0,_.d4)(y.WR),I=(0,_.d4)(e=>(0,x.nv)(e,T,{preferNonExistentToNull:!1})),N=(0,h.et)(I)??o.vp,M=t||N,L=(0,n.useMemo)(()=>l().tz(M),[M]),{valueMoment:O,valueDate:F,valueTime:D}=(0,n.useMemo)(()=>{let t=(0,f.lP)(e,M);return t?.isValid()?{valueMoment:t,valueDate:t.format("YYYY-MM-DD"),valueTime:t.format("HH:mm")}:{}},[M,e]),P=F===L.format("YYYY-MM-DD"),R=!!O?.isBefore(L),B=(0,n.useMemo)(()=>S&&!P&&R,[R,P,S]),W=(0,n.useMemo)(()=>S&&R,[R,S]),V=A||C,H=(0,n.useCallback)((e,t)=>{s(a,(0,f.lP)(`${e} ${t}`,M).toISOString())},[s,a,M]),{onChange:q,errorText:U}=(0,g.x)({errorMessage:k.t("Scheduled to start in the past. Select a time today or on a future date."),isErrored:B||W,shouldErrorPreventSave:!0});(0,n.useEffect)(()=>q(),[]);let z=(0,n.useCallback)(e=>{F&&D&&(H(e,((e,t,a,n)=>{let r=t,i=(0,f.lP)(`${e} ${t}`,a);if(n.format("YYYY-MM-DD")===e&&i.isBefore(n)){let e=n.hours()>=22,t=l()(n);e?t.endOf("day"):t.add(2,"hours").startOf("hour"),r=t.format("HH:mm")}return r})(e,D,M,l().tz(M))),q())},[F,H,D,q,M]),j=(0,n.useCallback)(e=>{e&&D&&F&&(H(F,e),q())},[D,F,H,q]),G=(0,i.A)();return n.createElement(p.b,{parameter:a,className:E().container},n.createElement("div",{className:E().form_inputs},n.createElement("div",{className:"flex_one"},n.createElement(c.b,{id:"date-picker-select",selectedDate:F,dateFormat:"YYYY-MM-DD",displayFormat:"MMMM D, YYYY",disableDatesBefore:L.format("YYYY-MM-DD"),"aria-label":v??k.t("Select a date"),onDateChange:z,isInvalid:B,datePickerDisabled:V,required:r,datePlaceholder:a?.description})),n.createElement("span",{className:"margin_left_50 margin_right_50","aria-hidden":!0},k.t("at")),n.createElement("div",{className:"flex_one"},n.createElement(m.Ay,{selectId:G,onChange:j,width:"100%",value:D,ariaLabel:w??k.t("Select a time"),optionsHourIncrement:"quarter",isInvalid:W,isRequired:r,allowCustomInput:!0,showTimeZone:!1,isDisabled:V}))),a.hint&&n.createElement(d.A,{className:"margin_bottom_0"},a.hint),U&&n.createElement(u.A,null,U))};DateTimeInput.displayName="DateTimeInput"},0x11fa58239:(e,t,a)=>{"use strict";a.d(t,{z:()=>useCustomFunctionProps});var n=a(0x1df96de4c),r=a(0xbad225b5),l=a(0x1db69cda),i=a(0x128d54e52),o=a(0xd2c5015d),s=a(0x242822dfb),c=a(0x1c7660480),d=a(0x62a17882),u=a(0x8c8bafa3),m=a(0xbf8832f0),p=a(0x20482ad21),b=a(0x59698e4);let addOpenFormSelectOptions=({steps:e,createText:t,wrappedCallbackId:a})=>{let n=e.filter(e=>!(a&&e.wrappedFunction&&e.wrappedFunction.callback_id===a)).map(({title:e,id:t})=>({label:e,value:(0,b.k)(t)}));return n.length?[{label:t,options:n,value:null}]:[]};var f=a(0x11e7de8ad),g=a(0x6cc5eee0);let h=new p.Ay("workflow_builder"),getListSelectProps=({parameter:e,openFormSteps:t,value:a,callbackId:n,isFunctionFormWrapped:l})=>{let i=(0,m.oI)(),o=(0,d.y3)()?`slack://list?id=${a}&team=${i}`:`https://app.${(0,u.Xk)()}/client/${i}/lists/${a}`,p=h.t("<{listUrl}|Open in Slack lists>",{listUrl:o,fallbackHash:"7a10b850695b39e3c427cb5bb0704d674b8e8858",fallbackHashNs:"files"}),b=h.t("When you save this step, we will create a new slack list for you."),_=a?[{id:"list-link",message:r.createElement(g.A,{text:p})}]:void 0,y=h.t("Create a list from a form");if(e.name===c.lh&&"string"==typeof a){let r,i;return{hints:(0,f.B)(a)?[{id:"open-form-create-list-hint",message:b}]:_,processOptions:()=>e.name===c.lh&&t.length&&!l?addOpenFormSelectOptions({steps:t,createText:y,wrappedCallbackId:n}):[],...(0,f.B)(a)?{selectedOption:(r=(0,s.uP)(a),i=t.find(e=>e.id===r),{label:i?.title,value:a})}:{}}}return{processOptions:()=>e.name===c.lh&&t.length?addOpenFormSelectOptions({steps:t,createText:y,wrappedCallbackId:n}):[]}};getListSelectProps.displayName="getListSelectProps";var _=a(0x1d3dd4cbe),y=a(0x408bdeff),x=a(0x1795d8821),v=a(0xa985ed31),E=a(0xb11cfed4),k=a.n(E);let useListsFunctionProps=({parameter:e,callbackId:t,value:a,onChange:d,isFunctionFormWrapped:u})=>{let{openFormSteps:m,updateRequiredContext:p}=(0,_.e)(),b=(0,r.useCallback)(e=>{if((0,f.B)(e.value)){let t=(0,s.uP)(e.value),a=m.filter(({id:e})=>e===t)[0].title;return r.createElement(i.Ay,{text:a,size:"small"})}return(0,v.A)(e.value)?r.createElement(y.A,{id:e.value,textClassName:k().fileEntityText}):null},[m]),g=(0,r.useCallback)((e,t,a)=>t.name===c.lh,[]),h=(0,r.useCallback)((e,t,a)=>{let n=(0,l.A)(e),r="string"==typeof a&&(0,s.De)(a,m);if((0,f.B)(a)&&r)return n.config.inputs={...n.config.inputs,...(0,s.a0)(a,r)},n.config.isFunctionFormWrappable=!1,n.config.isFunctionFormWrapped=!1,p("{{event_timestamp}}"),n;let i=!!n.config.slackFunction&&(0,o.R)({stepFunction:n.config.slackFunction});return n.config.isFunctionFormWrappable=i,n},[m,p]);return(0,r.useMemo)(()=>x.oW.AddListRecord===t&&e.type===x.TE.SlackTypesListId?{onValueChange:t=>{d(e,t,void 0,{shouldSetSegmentState:g,setSegmentState:h})},selectProps:getListSelectProps({parameter:e,openFormSteps:m,value:a,callbackId:t,isFunctionFormWrapped:u}),renderSelectedOption:b}:n.t0,[t,e,m,a,u,b,d,g,h])};useListsFunctionProps.displayName="useListsFunctionProps";let useCustomFunctionProps=({parameter:e,value:t,callbackId:a,variables:r,onChange:l,isFunctionFormWrapped:i})=>(a===x.oW.AddListRecord?useListsFunctionProps:()=>n.t0)({parameter:e,value:t,callbackId:a,variables:r,onChange:l,isFunctionFormWrapped:i})},0x2241106d2:(e,t,a)=>{"use strict";a.d(t,{N:()=>useSummarizeBuiltinSearcherOptions});var n=a(0xbad225b5),r=a(0x9e671ad),l=a(0x20b4dda68),i=a(0x7f5a02e8),o=a(0x189779d5a),s=a(0x1d3dd4cbe),c=a(0x1ec69ee01),d=a(0x12185e091),u=a(0x143fb6398),m=a(0xa1832ae4),p=a(0x1edb6b65f),b=a(0x2498088b6),f=a(0x1795d8821),g=a(0x226892387),h=a(0x1ee439e69);function useSummarizeBuiltinSearcherOptions({callbackId:e,parameterType:t,externalWorkspaceId:a}){let{workflowSummaryStepPrecedes:_}=(0,s.e)(),y=(0,g.d4)(b.so),x=(0,g.d4)(e=>(0,p.B)(e,a)),v=(0,g.d4)(h.H7),E=(0,m.ZT)(v),k=(0,n.useMemo)(()=>[l.uh,l.kp],[]),w=(0,n.useCallback)(e=>{if(!(0,d.jq)(e))return!1;let t=(0,u.ju)(e);return!!(k.some(e=>e===E)&&(0,r.A)(((0,c.gs)(e)||[]).slice().sort(),k.sort()))||!t},[E,k]),S=(0,n.useCallback)(e=>!!(0,d.jq)(e)&&!(0,u.ju)(e),[]);return(0,n.useMemo)(()=>{let n,r,l=(0,o.k)(t,e,_),s=e===f.oW.AddAgentToChannel&&t===f.TE.SlackTypesChannelId;return t===f.TE.SlackTypesChannelId&&(n=s?S:w),l&&(r=(0,i.Zq)(l,{isInfoBarriersEnabled:y,filter:n,externalWorkspaceToSearchOn:x?a:void 0})),r},[S,e,a,x,y,t,w,_])}},0x10b93423f:(e,t,a)=>{"use strict";a.d(t,{O:()=>SlackFunctionEntitiesInput});var n=a(0xbad225b5),r=a(0x1407c6c2c),l=a(0x1df96de4c),i=a(0x20482ad21),o=a(0x2b7f0bcc),s=a(0x200c38ed8),c=a(0x11fa58239),d=a(0x2241106d2),u=a(0x1795d8821),m=a(0x189779d5a),p=a(0x223beeef),b=a(0xf33a4f91),f=a(0x1ba35eb3b),g=a(0x194fe1f5f),h=a(0x1d3dd4cbe),_=a(0x668181b3),y=a(0x2772625d),x=a(0x1b05cc3ce),v=a(0x24f66aeb6),E=a(0x2a037c8a),k=a(0x12185e091),w=a(0x70de3606),S=a(0x143fb6398),C=a(0xa1832ae4),A=a(0xb8504a42),T=a(0x2a3fb7ec),I=a(0x16ed1b0dc),N=a(0x226892387),M=a(0x217553e42),L=a(0x1ee439e69);let O=new i.Ay("workflow_builder"),F=["canvas_update_content","canvas_create","channel_canvas_create"],SlackFunctionEntitiesInput=({value:e,variables:t,allowVariables:a,onChange:i,parameter:D,elementId:P,callbackId:R,externalWorkspaceId:B,dynamicInput:W,hasLabel:V=!0,renderOption:H=null,className:q,isValidEmptyObject:U,hideLabel:z,isFunctionFormWrapped:j})=>{let{externalTriggerSalesforceOrgId:G,triggerType:$,viewOnly:K,workflowSummaryStepPrecedes:Y,messagePostedTriggerPrivateChannelAccess:Q,aiStepPrivateChannelAccess:Z,aiStepPrivateChannelTeamIds:J}=(0,h.e)(),X=(0,N.d4)(L.H7),ee=(0,r.A)(),et=(0,r.A)(),ea=(0,C.ZT)(X),en=(0,A.kA)(X),er=!!W,el=er?W.type:D.type,ei=D.type===u.TE.SlackTypesTeamId,eo=(0,N.d4)(w.Fh),es=(0,N.d4)(t=>(0,M.OL)(t,e)),ec=(0,S.ju)(es),ed=$===E.M.Shortcut&&""===e,{searcherOptions:eu,isFetchingPrefs:em}=(0,s.qI)(G),ep=(0,d.N)({callbackId:R,parameterType:el,externalWorkspaceId:B}),eb=G&&!em?et:ee,ef=$===E.M.External&&R===u.oW.SendMessage&&D.type===u.TE.SlackTypesChannelId,eg=R===u.oW.AskAgentforce,eh=R===u.oW.SummarizeChannel,e_=(0,T.X)([u.oW.SendDm,u.oW.SendMessage,u.oW.SendEphemeralMessage,u.oW.ShareCanvas,u.oW.CreateCanvas,u.oW.UpdateCanvasContent,u.oW.UpdateCanvasContentV2,u.oW.CreateChannelCanvas],R)&&Y,ey=R===u.oW.CreateCanvas&&el===u.TE.SlackTypesUserId,ex=eh||e_,ev=[u.oW.CreateChannel,u.oW.CreateUsergroup],{isParameterFormWrappable:eE,is_required:ek}=D,ew=(!!ek||(0,x.L$)(D))&&!eE,eS=!!W?.is_required&&!eE,eC=ei&&!!R&&ev.includes(R),eA=ew&&!er||!U&&eS||eC;(0,n.useEffect)(()=>{eC&&(en||B||e===ea?B&&e!==B&&i(D,B):i(D,ea))},[i,eC,D,e,B,en,ea]),(0,n.useEffect)(()=>{if(ed&&R===u.oW.SendMessage&&D.type===u.TE.SlackTypesChannelId){let e=t.list.find(e=>"Channel where the workflow was used"===e.label);void 0!==e&&i(D,e.id)}},[R,i,D,ed,e,t]),(0,n.useEffect)(()=>{if(ed&&R===u.oW.SendDm&&D.type===u.TE.SlackTypesUserId){let e=t.list.find(e=>"Person who used this workflow"===e.label);void 0!==e&&i(D,e.id)}},[R,i,D,ed,e,t]);let eT=(0,n.useCallback)(e=>{let{id:t}=e;i(D,t)},[i,D]),eI=O.t("This field is required."),eN=O.t("This variable is not supported in this input field."),eM=O.t("This variable is missing."),eL=O.t("This variable is not available."),eO=O.t("The selected channel can\u2019t be used due to Sales Home administrative channel restrictions."),eF=O.t("Channel does not exist in this Slack organization."),eD=O.t("Channel does not exist in this Slack workspace."),eP=(0,n.useMemo)(()=>{if(ef&&!em){let t=eu.entities.channels;if((0,k.jq)(es)){if("object"==typeof t&&(!(t.includePrivate??!0)&&(0,k.Zp)(es)||!(t.includePublic??!0)&&(0,k.rW)(es)))return!0}else if(e&&(0,y.cn)(e)&&"object"==typeof t&&!(t.includePrivate??!0)&&!(t.includePublic??!0))return!0}return!1},[e,es,em,eu.entities.channels,ef]),eR=(0,n.useMemo)(()=>{let e=[];return D.hint&&e.push({id:"hint_from_parameter",message:D.hint}),e},[D.hint]),eB=(0,n.useMemo)(()=>{let a=[];if(!e&&eA)return[{id:"is_required",message:eI}];if(e&&eP)a.push({id:"channel_selection_restricted",message:eO});else if(e&&(0,y.cn)(e)){let n=(0,_.x)(t.list,e);if(!n||n.isTombstone)return a.push({id:"variable_missing",message:eM}),a;(0,f.Lm)({variable:n,parameter:D})||(0,f.RT)(n,W,void 0)||a.push({id:"invalid_variable_for_input",message:eN}),n.isAvailable||a.push({id:"variable_unavailable",message:eL})}return(0,I.A)(e)&&((0,k.t8)(es)||(0,k.QR)(es))&&a.push({id:"invalid_channel",message:en?eF:eD}),a},[e,eA,eI,t.list,D,W,eM,eN,eL,eP,eO,es,eF,eD,en]),{allowUsers:eW,allowChannels:eV,allowUserGroups:eH,allowMessageContext:eq,allowTeams:eU}=(0,n.useMemo)(()=>(e=>{let t={allowUsers:!1,allowChannels:!1,allowMessageContext:!1,allowUserGroups:!1,allowTeams:!1};switch(e){case u.TE.SlackTypesUserEmail:case u.TE.SlackTypesUserId:return{...t,allowUsers:!0};case u.TE.SlackTypesChannelId:return{...t,allowChannels:!0};case u.TE.SlackTypesUsergroupId:return{...t,allowUserGroups:!0};case u.TE.SlackTypesMessageContext:return{...t,allowMessageContext:!0};case u.TE.SlackTypesTeamId:return{...t,allowTeams:!0};case u.TE.SlackTypesListId:case u.TE.SlackTypesCanvasId:case u.TE.SlackTypesChannelCanvasId:case u.TE.SlackTypesCanvasTemplateId:default:return t}})(el),[el]),ez=(0,m.k)(el,R,Y,Q,Z),ej=(0,n.useMemo)(()=>ef?eu:ex||eg?ep:ey?b.R_:R===u.oW.AiAnswer&&el===u.TE.SlackTypesChannelId&&J&&J.length>0?(0,b.AR)({privateChannelAccess:Z,privateChannelTeamIds:J}):void 0,[eg,ey,eu,ef,ex,ep,R,el,Z,J]),eG=(0,c.z)({parameter:D,value:e,callbackId:R,variables:t,onChange:i,isFunctionFormWrapped:j}),e$=eo?eG:l.t0;if(eC&&!en||eC&&B)return null;let eK=!!(eC||R&&F.includes(R)),eY=ec&&(0,I.A)(e),renderComponent=()=>n.createElement("div",{className:"full_width"},n.createElement(g.s,{elementId:P,placeholder:D.description||"",data:t,allowVariables:a,value:e,onChange:eT,isDisabled:K,isRequired:eA,hints:eR,errors:eB,workspaceFilterTeamId:B,allowUsers:eW,allowChannels:eV,allowUserGroups:eH,allowMessageContext:eq,allowTeams:eU,queryType:ez,searcherOptions:ej,renderOption:H,selectKey:eb,callbackId:R,className:q,...e$}),eY&&n.createElement(o.Ay,{level:o.A_.warning,className:"margin_bottom_50"},n.createElement(v.A,{channel:es,showOnlyConnectedTeamsCount:!1})));return(renderComponent.displayName="renderComponent",V)?n.createElement(p.z,{elementId:P,parameter:D,isAlwaysRequired:eK,hideLabel:z},renderComponent()):renderComponent()};SlackFunctionEntitiesInput.displayName="SlackFunctionEntitiesInput"},0x189779d5a:(e,t,a)=>{"use strict";a.d(t,{k:()=>deriveQueryType});var n=a(0x253c586a2),r=a(0x1795d8821),l=a(0x2a3fb7ec);let deriveQueryType=(e,t,a=!1,i,o)=>{let s=(0,l.X)([r.oW.SendDm,r.oW.SendMessage,r.oW.SendEphemeralMessage,r.oW.ShareCanvas,r.oW.CreateCanvas,r.oW.UpdateCanvasContent,r.oW.UpdateCanvasContentV2,r.oW.CreateChannelCanvas],t),c=t===r.oW.SummarizeChannel,d=t===r.oW.AskAgentforce,u=t===r.Uk.MessagePosted,m=t===r.oW.AiAnswer;switch(e){case r.TE.SlackTypesUserEmail:case r.TE.SlackTypesUserId:if(s&&a)return n.Df;return n.vP;case r.TE.SlackTypesChannelId:if(u)return!1!==i?n.m5:n.XI;if(m)return!1===o?n.XI:n.m5;if(c)return n.kY;if(d)return n.Kh;return n.m5;case r.TE.SlackTypesUsergroupId:return n.MW;case r.TE.SlackTypesListId:return n.xR;case r.TE.SlackTypesCanvasId:return n.Qg;case r.TE.SlackTypesChannelCanvasId:return n.u5;case r.TE.SlackTypesCanvasTemplateId:return n.JM;case r.TE.SlackTypesTeamId:return n.W6;case r.TE.SlackTypesMessageContext:return n.vK;default:return}}},0xb64e73ea:(e,t,a)=>{"use strict";a.d(t,{_:()=>OAuthAccountDelegationRadioField});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1407c6c2c),o=a(0x139c79d16),s=a(0x810a3ce9),c=a.n(s);function OAuthAccountDelegationRadioField({label:e,checked:t,onChange:a,children:r,disabled:s}){let d=(0,i.A)();return n.createElement("div",{className:l()(c().radioField,{[c().radioButtonDisabled]:s})},n.createElement("label",{htmlFor:d,className:c().radioButtonLabel},n.createElement(o.A,{className:c().radioButtonBase,id:d,checked:t,onChange:a,disabled:s}),e),r&&n.createElement("div",{className:"align_self_center margin_left_auto"},r))}OAuthAccountDelegationRadioField.displayName="OAuthAccountDelegationRadioField"},0x32784134:(e,t,a)=>{"use strict";a.d(t,{C:()=>SlackFunctionTextInput});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1407c6c2c),o=a(0x20482ad21),s=a(0x223beeef),c=a(0x242c34757),d=a(0xaec6c584),u=a(0x162b19a86),m=a(0x1ba35eb3b),p=a(0x1d3dd4cbe),b=a(0x1b05cc3ce),f=a(0x207fb9b92),g=a(0x2310bfb55),h=a.n(g);let _=new o.Ay("workflow_builder"),SlackFunctionTextInput=({variables:e,value:t,parameter:a,onChange:r,formatVariableBeforeInsert:o,required:g,callbackId:y,showInline:x,allowVariables:v,hideLabel:E,isParameterSyncedWithForm:k})=>{let{description:w,title:S,maxLength:C,isParameterFormWrappable:A,hint:T}=a,I=(0,i.A)(),{viewOnly:N,onVariableMenuOpen:M,hasValidAppPinBuiltInMessage:L}=(0,p.e)(),{error:O,runAsyncTextValidation:F}=(0,d.m)(y,a),D=N||k,P=T;C&&!T&&(P=S?_.t("Heads up\u2014the {title} may cause the workflow to fail if variables put it over the {maxLength}-character limit.",{title:S.toLowerCase(),maxLength:C}):_.t("Heads up\u2014the text may cause the workflow to fail if variables put it over the {maxLength}-character limit.",{maxLength:C}));let{message:R,isErrored:B}=(0,n.useMemo)(()=>{let e=(0,u.Lk)(t);switch(!0){case!!((g||(0,b.L$)(a))&&!t&&!A):return{message:_.t("This field is required."),isErrored:!0};case!!C&&e.length>C:return{message:_.t("You can\u2019t enter more than {maxLength} characters.",{maxLength:C}),isErrored:!0};case[null,!1].includes(L):return{message:_.t("This is not a valid message URL or timestamp.",{fallbackHash:"ab90d9d736f9e0909b62d0922e0482e4b827449f"}),isErrored:!0};default:return{message:void 0,isErrored:!1}}},[L,A,C,a,g,t]),{errorText:W,onBlur:V}=(0,f.K)({errorMessage:R,isErrored:B}),H=O?.errorText??W,q=(0,n.useCallback)(async({text:e})=>{let t=(0,u.cY)(e);r(a,t),F&&await F(t)},[F,r,a]),U=(0,n.useCallback)(e=>(0,m.qO)(e)||(0,m.xY)({variable:e,parameter:a}),[a]);return n.createElement(s.z,{elementId:I,parameter:a,className:"c-label--has_footer",inline:x,hideLabel:E,isParameterSyncedWithForm:k},n.createElement(c.A,{textyClassName:l()({[h().parameter_long]:a.long}),id:I,initialText:t,variables:e,allowVariables:v,ariaLabel:S,shouldAddNewLineOnEnter:a.long,onTextChange:q,formatVariableBeforeInsert:o,errorText:H,onBlur:V,placeholder:w,hint:P,renderDataMenuLocation:"inline",customDataFilter:U,callbackId:y,isDisabled:D,maxLength:C,isWorkflowInputText:!0,onVariableMenuOpen:M}))};SlackFunctionTextInput.displayName="SlackFunctionTextInput"},0x1f0569040:(e,t,a)=>{"use strict";a.d(t,{I:()=>TimezoneInput});var n=a(0xbad225b5),r=a(0x1e2051844),l=a(0x1407c6c2c),i=a(0x10a23ba39),o=a(0x20482ad21),s=a(0x15014e268),c=a(0x223beeef),d=a(0x1d3dd4cbe),u=a(0x21c50a68b);let m=new o.Ay("workflow_builder"),TimezoneInput=({value:e,parameter:t,onChange:a,required:p=!1,isParameterSyncedWithForm:b})=>{let{viewOnly:f}=(0,d.e)(),g=(0,l.A)(),h=f||b,_=(0,u.JK)(),y=t.title??m.t("Time zone",{ns:"prefs"}),x=(0,i.Ay)(_),v=(0,n.useMemo)(()=>x?.map(e=>({label:e[0],value:e[1]}))||[],[x]),E=(0,n.useMemo)(()=>(0,r.A)(v,["value",e])||(0,r.A)(v,["value",o.Ay.DEFAULT_TZ]),[v,e]),k=(0,n.useCallback)(e=>{a(t,e.value)},[a,t]);return n.createElement(c.z,{elementId:g,parameter:t,isParameterSyncedWithForm:b},n.createElement(s.Ay,{selectDataQa:"timezone",selectId:g,selectedOption:E,onOptionSelected:k,options:v,size:"medium",width:"100%",ariaLabel:y,isRequired:p,isDisabled:h}))};TimezoneInput.displayName="TimezoneInput"},0x204ee6449:(e,t,a)=>{"use strict";a.d(t,{F:()=>SlackFunctionVariableSelectInput});var n=a(0xbad225b5),r=a(0x21f3c49e8),l=a(0x1407c6c2c),i=a(0x20482ad21),o=a(0x12edaa96a),s=a(0x235d78b7c),c=a(0x242822dfb),d=a(0x223beeef),u=a(0x1ba35eb3b),m=a(0x194fe1f5f),p=a(0x1d3dd4cbe),b=a(0x1b05cc3ce),f=a(0x1795d8821);let g=new i.Ay("workflow_builder"),h={entities:{members:!1,userGroups:!1,channels:!1,teams:!1},allowEmptyQuery:!1},SlackFunctionVariableSelectInput=({value:e,parameter:t,onChange:a,variables:i,formatVariableBeforeInsert:_,hideLabel:y})=>{let x=(0,l.A)(),{onVariableMenuOpen:v}=(0,p.e)(),{hint:E,isParameterFormWrappable:k,name:w,title:S,description:C}=t,[A,T]=(0,n.useState)(x),I=(0,n.useCallback)(()=>T((0,o.A)()),[]),N=!!(t.is_required||(0,b.L$)(t)),M=(0,n.useMemo)(()=>t.type===f.TE.SlackTypesSalesforceRecordId,[t.type]),L=(0,n.useMemo)(()=>{if(E)return[{id:`${w}_hint`,message:E}]},[E,w]),O=(0,n.useMemo)(()=>N&&!k&&(0,r.A)(e)?[{id:`${w}_is_required`,message:g.t("This field is required.")}]:[],[k,N,w,e]),F=(0,n.useCallback)(e=>{let{id:n}=e;n?a(t,(0,c.r2)(i.list,n)?.value):a(t,void 0),I()},[I,a,t,i.list]),D=(0,n.useCallback)(e=>{let n=_?.(e,{})??e,r=(0,c.r2)(i.list,n.id);r&&a(t,r.value),I()},[I,_,a,t,i.list]),P=(0,n.useCallback)(e=>!!t&&((0,u.Lm)({variable:e,parameter:t})||(0,u.xY)({variable:e,parameter:t})),[t]),R=(0,n.useMemo)(()=>({enable:!0}),[]);return n.createElement(d.z,{elementId:x,parameter:t,hideLabel:y},n.createElement("div",{className:"display_flex"},n.createElement(m.s,{key:A,value:e,data:i,allowVariables:!0,onChange:F,allowUsers:!1,allowChannels:!1,allowVariablesByType:t.type,className:"full_width no_margin",hints:L,errors:O,isInvalid:O.length>0,isRequired:N,searcherOptions:h,placeholder:C||g.t("Select option\u2026"),ariaLabel:S,enforceStrictVariableTypeMatch:M}),n.createElement(s.jx,{value:e,onSelect:D,data:i.groups,customDataFilter:P,renderIconInline:!0,onMenuTriggerClick:v,className:"margin_left_50 margin_top_50 display_flex align_items_start",inputType:t.type,suggestedVariableConfig:R})))};SlackFunctionVariableSelectInput.displayName="SlackFunctionVariableSelectInput"},0x223beeef:(e,t,a)=>{"use strict";a.d(t,{z:()=>SlackFunctionLabel});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1407c6c2c),o=a(0x20482ad21),s=a(0x1d2cd7755),c=a(0x2501a2cee),d=a(0x1d3dd4cbe),u=a(0x1b05cc3ce),m=a(0x1b3ecb90f),p=a(0x15a4ffb05),b=a(0x1789e94fa),f=a(0x5b1935a6);let g=n.lazy(()=>Promise.resolve().then(a.bind(a,0x7733abee)).then(e=>({default:e.MessagePostedPrivateChannelAccessBadge}))),h={spaceName:f.xu.WORKFLOW_BUILDER_MESSAGE_POSTED_TRIGGER_MODAL,notifications:{[f.ze.HERMES_WORKFLOWS_MESSAGE_POSTED_TRIGGER_PRIVATE_CHANNEL_ACCESS_BADGE]:{component:g}}};var _=a(0x145d46a61),y=a(0x1795d8821),x=a(0x226892387),v=a(0x17abac04c),E=a.n(v);let k=new o.Ay("workflow_builder"),SlackFunctionLabel=({elementId:e,parameter:t,children:a,className:r,inline:o,noMarginBottom:f,labelProps:g={},isAlwaysRequired:v,isAlwaysOptional:w,isBold:S=!0,forceLabel:C,hideLabel:A,isParameterSyncedWithForm:T,subtext:I,callbackId:N})=>{let M=(0,i.A)(),{title:L,name:O,description:F}=t,D=C||L||O||F,P=!w&&(t.type===y.TE.Boolean||t.is_required||v||(0,u.L$)(t))?"":` ${k.t("(optional)")}`,R=(0,x.d4)(_.$T),B=(0,x.d4)(_.sQ),{messagePostedTriggerPrivateChannelAccess:W}=(0,d.e)(),V=N===y.Uk.MessagePosted&&"channelIds"===O&&B&&!0===W,H=R&&T,q=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,n.createElement(p.A,{text:D+P,emojiSize:m.lw.SMALL}),V&&n.createElement(b.A,h),H?n.createElement("span",{className:E().syncedWithFormLabel},n.createElement(c.Ah,{name:"refresh","aria-hidden":!0}),k.t("Included in form")):null),[H,V,P,D]);return A?n.createElement(n.Fragment,null,a):n.createElement(s.A,{htmlFor:e??M,text:q,...g,"data-qa-segment-parameter":O,"data-qa":"slack-function-label",className:l()(r,{bold:S,margin_bottom_150:!f,[E().inlineLabel]:o,[E().messagePostedTriggerLabel]:N===y.Uk.MessagePosted}),subtext:I},a)};SlackFunctionLabel.displayName="SlackFunctionLabel"},0x242c34757:(e,t,a)=>{"use strict";a.d(t,{A:()=>w});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x2286acf6c),o=a(0x20482ad21),s=a(0x677a139e),c=a(0x1e586fbba),d=a(0x1576dac7),u=a(0x235d78b7c),m=a(0x88881d67),p=a(0x1ba35eb3b),b=a(0x668181b3),f=a(0x10a716a94),g=a(0x1b77d8ef3),h=a(0x10bd0ba09),_=a(0x1cd3157a9),y=a(0x13f30d329),x=a(0x2310bfb55),v=a.n(x);let E=new o.Ay("workflow_builder"),k=(0,i.A)((e,t)=>{e.current&&t&&t({text:e.current.value()})},150,{leading:!0}),PlainTextBuilderTexty=({id:e,errorText:t=null,initialText:a="",onEnter:r,onTextChange:i,formatVariableBeforeInsert:o,shouldAddNewLineOnEnter:x=!0,isDisabled:w=!1,focusOnMount:S=!1,variables:C,maxLength:A,onBlur:T,ariaLabel:I,placeholder:N,hint:M,renderDataMenuLocation:L="default",className:O,textyClassName:F,callbackId:D,customDataFilter:P=p.qO,onSetTextyRef:R,replaceValueOnVariableChange:B,onVariableMenuOpen:W,inputType:V,allowVariables:H,isWorkflowInputText:q})=>{let U="inline"===L&&!w,z="inside"===L&&!w,j="default"===L&&!w,G=(0,n.useRef)(),$=(0,n.useMemo)(()=>C||{list:[],groups:[]},[C]),K=(0,n.useMemo)(()=>(0,y.A)(a,C?.list||[]),[C?.list,a]),Y=(0,n.useCallback)(()=>k(G,i),[i]),Q=(0,n.useCallback)((e={})=>!0!==e.metaKey&&(!!x||!0===e.shiftKey||(k(G,r),!1)),[r,x]),Z=(0,n.useCallback)(e=>{null!==e&&!G.current&&(G.current=e,Y(),R&&R(G.current))},[R,Y]),J=(0,n.useCallback)(()=>n.createElement("div",null,n.createElement(c.A,null,E.t("Something went wrong"))),[]),X=t&&t.length>0,ee=(0,n.useCallback)(e=>{if(!G.current)return;let{quill:t}=G.current?.instance,{index:a,length:n}=t.getSelection(!0);n>0&&t.deleteText(a,n,"user");let r=(0,m.Jq)(o?.(e,{})??e),l={id:r.id,type:(0,_.Z)(r.id,r.type),label:r.label,sourceLabel:r.sourceLabel,isAvailable:r.isAvailable};B?(t.setText(""),t.insertEmbed(0,"workflowtoken",{...l,variableData:r},"user"),t.setSelection(1)):(t.insertEmbed(a,"workflowtoken",{...l,variableData:r},"user"),t.setSelection(a+1))},[o,B]),[{activeTokenIndex:et,activeTokenElement:ea,activeTokenData:en,activeTokenVariableData:er},el]=(0,n.useState)({activeTokenIndex:null,activeTokenData:null,activeTokenVariableData:null,activeTokenElement:null}),ei=(0,n.useCallback)(()=>{el({activeTokenIndex:null,activeTokenData:null,activeTokenVariableData:null,activeTokenElement:null})},[el]),eo=(0,n.useCallback)(e=>{let{token:t,element:a,index:n}=e,r=(0,b.x)($.list,t.id);r&&el({activeTokenIndex:n,activeTokenData:t,activeTokenVariableData:(0,m.Jq)(r),activeTokenElement:a})},[$.list]),es=(0,n.useCallback)(({dataItem:e})=>{let t=G.current,{quill:a}=t.instance,n={id:e.id,type:e.type};a.deleteText(et,1),a.insertEmbed(et,"workflowtoken",{...n,variableData:e}),null!==et&&t.instance.setSelection(et+1,0,"silent"),i({text:t.value()}),ei()},[et,ei,i]);return n.createElement(f.A,{subtype:"builder_texty",renderError:J},n.createElement("div",{"data-qa":"plain-text",className:l()(O,{display_flex:U})},n.createElement("div",{className:U?v().inline_width:""},n.createElement(g.A,{className:"normal",isDisabled:w,isInvalid:!!X},n.createElement(h.A,{id:e,"data-qa":e,maxLength:A,onBlur:T,ariaLabel:I,focusOnMount:S,maxLines:8,initialText:K,useWorkflowTokens:!0,workflowTokens:$.list,onTextChange:Y,isDisabled:w,onEnter:Q,useWysiwyg:!1,workflowTokenClick:eo,ref:Z,placeholder:N,className:F,isWorkflowInputText:q}),H&&z?n.createElement(u.jx,{onSelect:ee,data:$.groups,customDataFilter:P,renderIconInside:!0,onMenuTriggerClick:W}):null,!w&&null!==ea&&null!==en&&null!==er&&n.createElement(d.I,{tetherElement:ea,tokenData:en,variableData:er,onClose:ei,updateDynamicData:es,callbackId:D}))),H&&U?n.createElement("div",{className:"margin_left_50 display_flex"},n.createElement(u.jx,{onSelect:ee,data:$.groups,customDataFilter:P,renderIconInline:!0,onMenuTriggerClick:W,inputType:V,allowEmptyState:!!V})):null),M&&n.createElement(s.A,{className:l()("margin_bottom_0",{[v().hint_text_width]:U})},M),n.createElement("div",{className:"display_flex justify_content_between"},n.createElement("div",null,X&&n.createElement(c.A,null,t)),H&&j?n.createElement("div",{className:"margin_top_50"},n.createElement(u.jx,{onSelect:ee,data:$.groups,customDataFilter:P,onMenuTriggerClick:W})):null))};PlainTextBuilderTexty.displayName="PlainTextBuilderTexty";let w=PlainTextBuilderTexty},0x1a740dbac:(e,t,a)=>{"use strict";a.d(t,{b:()=>UnsupportedInputParameter});var n=a(0xbad225b5),r=a(0x40c0d834),l=a(0x3711e82d);let UnsupportedInputParameter=({parameter:e,functionId:t})=>{let a="items"in e?e.items.type:void 0;return n.createElement(r.A,{uiComponentName:l.UiComponentName.WORKFLOW_UNSUPPORTED_PARAMETER,clogImpression:!0,uiComponentVariant:e.type,elementName:a,displayName:t},n.createElement("span",null))};UnsupportedInputParameter.displayName="UnsupportedInputParameter"},0xfd04a21a:(e,t,a)=>{"use strict";a.d(t,{A:()=>p});var n=a(0xbad225b5),r=a(0x2264e6ea3),l=a(0x15bd59d31),i=a(0xf159cb74),o=a(0x73d7ee71),s=a(0x18b8a1e5b),c=a(0xb8504a42),d=a(0x226892387),u=a(0x217553e42),m=a(0x1ee439e69);let ChannelSelectListEntity=({channelId:e,showTeamForLocalChannels:t})=>{let a=(0,d.d4)(m.H7),p=(0,d.d4)(t=>(0,u.OL)(t,e)),b=(0,i.c)(p),f=(0,d.d4)(e=>(0,o.R)(e,p))?.length;return n.createElement(l.A,{channelId:e,"data-qa":"channel-select-list-entity",showTeamForLocalChannel:t&&(0,c.kA)(a)&&!(0,s.O)(p)&&!(0,r.JV)(b)&&1===f})};ChannelSelectListEntity.displayName="ChannelSelectListEntity";let p=ChannelSelectListEntity},0xf33a4f91:(e,t,a)=>{"use strict";a.d(t,{AR:()=>getAiStepChannelSearchOptions,C3:()=>k,Ci:()=>itemStringUrlSplitQuery,Db:()=>itemStringEmailSplitQuery,Fq:()=>E,Fr:()=>itemNumberValidator,L6:()=>b,QX:()=>w,R_:()=>_,U6:()=>itemStringUrlValidator,Ut:()=>getMessagePostedTriggerChannelSearchOptions,V2:()=>itemStringEmailValidator,ak:()=>itemTimestampValidator,dS:()=>x,gY:()=>S,jO:()=>y,o6:()=>itemIntegerValidator,r:()=>itemStringValidator,r0:()=>itemStringSplitQuery,vU:()=>v,x1:()=>isArrayVariableReference});var n=a(0xb77a689a),r=a(0x668181b3),l=a(0xbbd2a32d),i=a(0x2772625d),o=a(0x1ec69ee01),s=a(0x12185e091),c=a(0xf159cb74),d=a(0x1795d8821),u=a(0x143aeed3e),m=a(0xa5d8361b);let p={entities:{channels:{includeArchived:!1,includePrivate:!0,includeMpims:!1,onlyIfMember:!0}},sort:{frecency:!0},allowEmptyQuery:!0},b={...p,entities:{channels:{...p.entities.channels,includeFromAnotherTeam:!0}}},f={...b,entities:{channels:{...b.entities.channels,includePrivate:!1,includeOnlyExternallyShared:!1}}},g={...b,entities:{channels:{...b.entities.channels,includeRecordChannels:!1,includeOnlyExternallyShared:!1}}},h={...f,entities:{channels:{...f.entities.channels,includeRecordChannels:!1,includeOnlyExternallyShared:!1}}},getAiStepChannelSearchOptions=({privateChannelAccess:e,privateChannelTeamIds:t})=>!1===e?h:t&&t.length>0?{...g,filter:e=>{if(!(0,s.Zp)(e))return!0;let a=(0,c.c)(e);return((0,o.Si)(e)||(a?[a]:[])).some(e=>e&&t.includes(e))}}:g,getMessagePostedTriggerChannelSearchOptions=({privateChannelAccess:e,privateChannelTeamIds:t})=>e?t&&t.length>0?{...b,entities:{channels:{...b.entities.channels,includeOnlyExternallyShared:!1}},filter:e=>{if(!(0,s.Zp)(e))return!0;let a=(0,c.c)(e);return((0,o.Si)(e)||(a?[a]:[])).some(e=>e&&t.includes(e))}}:{...b,entities:{channels:{...b.entities.channels,includeOnlyExternallyShared:!1}}}:f,_={entities:{members:{includeSelf:!0,includeSlackbot:!1,includeBots:!1,onlyLocalTeam:!0,includeGuests:!1}},sort:{frecency:!0},allowEmptyQuery:!0},y={allowEmptyQuery:!0,tiered:!0,entities:{files:{onlyCanvases:!0}},returnMetadata:!0,sort:{frecency:!0}},x={...y,entities:{...y.entities,files:{...y.entities.files,excludeTemplateCanvases:!0}}},v={allowEmptyQuery:!0,tiered:!0,entities:{files:{onlyLists:!0}},returnMetadata:!0,sort:{frecency:!0}},E={allowEmptyQuery:!1,entities:{files:{}},returnMetadata:!0,sort:{frecency:!0}},k={entities:{userGroups:{includeFromAnotherTeam:!0,excludeOrgLevel:!0}},sort:{frecency:!0},allowEmptyQuery:!0},w={entities:{teams:{includeCurrentTeam:!0,onlyCurrentOrg:!1}},sort:{frecency:!0},allowEmptyQuery:!0},isArrayVariableReference=(e,t)=>{if(!(0,i.cn)(t))return!1;let a=(0,r.x)(e.list,t);return a?.type===d.TE.Array},itemNumberValidator=e=>(0,l.gf)(Number(e)),itemIntegerValidator=e=>(0,l.zh)(Number(e)),itemStringValidator=e=>(0,n.A)(e),itemStringEmailValidator=e=>{let t=(0,n.A)(e),a=t?(0,u.Ay)(e):{isValid:!1};return t&&a.isValid},itemStringUrlValidator=e=>(0,n.A)(e)&&(0,m.A)(e),itemTimestampValidator=e=>(0,n.A)(e)&&Number(e)>0,itemStringSplitQuery=e=>e.split(",").filter(Boolean),itemStringEmailSplitQuery=e=>e.split(/[\s,]+/).filter(Boolean),itemStringUrlSplitQuery=e=>e.split(/[\s,]+/).filter(Boolean),S=[d.TE.SlackTypesUserId,d.TE.SlackTypesChannelId,d.TE.SlackTypesUserEmail,d.TE.SlackTypesUsergroupId,d.TE.SlackTypesTimestamp,d.TE.String,d.TE.Integer,d.TE.Number,d.TE.Boolean,d.TE.SlackTypesTeamId,d.TE.SlackTypesCanvasId,d.TE.SlackTypesListId,d.TE.SlackTypesFileId]},0xaec6c584:(e,t,a)=>{"use strict";a.d(t,{m:()=>useAsyncTextValidation});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x21f3c49e8),i=a(0x162afc153),o=a(0x162b19a86),s=a(0x1d3dd4cbe),c=a(0x1ebe91b72),d=a(0xb94670f8),u=a(0x1795d8821),m=a(0x1c8f352ff),p=a(0x1ec68d6a3),b=a(0x8ba4f2d8),f=a(0x33830eed),g=a(0x15e263568);let useAsyncTextValidation=(e,t)=>{let[a,h]=(0,n.useState)(void 0),{validateAsyncValue:_}=(0,s.e)(),y=(0,r.wA)(),x=(0,n.useCallback)(async e=>{if((0,l.A)(e))return;let t=(0,m.zU)();try{let a=await y((0,b.A)({channelName:e}));if(!a)return;return(0,m.Zo)(a,{maxChannelNameLength:t})}catch(e){(0,p.default)({label:"WORKFLOW-BUILDER"}).error("Unable to fetch channel name validation",e);return}},[y]),v=(0,n.useCallback)(async e=>{if(!(0,l.A)(e))try{let t=await y((0,g.Ay)({name:e,reason:"workflow-builder-builtin-create-user-group"}));if(!t)return;return t}catch(e){(0,p.default)({label:"WORKFLOW-BUILDER"}).error("Unable to fetch usergroup name validation",e);return}},[y]),E=(0,n.useCallback)(async e=>{if(!(0,l.A)(e))try{let t=await y((0,f.Ay)({handle:e,reason:"workflow-builder-builtin-create-user-group",targetTeam:""}));if(!t)return;return t}catch(e){(0,p.default)({label:"WORKFLOW-BUILDER"}).error("Unable to fetch usergroup handle validation",e);return}},[y]),k=(0,n.useMemo)(()=>e===u.oW.CreateChannel?async t=>{if((0,c.cL)().test(t)){h(void 0),_({isValidChannelName:!0});return}let a=await x(t);if(!a){h(void 0),_({isValidChannelName:!0});return}h({errorType:e,errorText:a}),_({isValidChannelName:!1})}:e===u.oW.CreateUsergroup&&t?.name==="usergroup_handle"?async t=>{if((0,c.cL)().test(t)){h(void 0),_({isValidUserGroupHandle:!0});return}let a=await E(t);if(!a){h(void 0),_({isValidUserGroupHandle:!0});return}h({errorType:e,errorText:a}),_({isValidUserGroupHandle:!1})}:u.oW.CreateUsergroup&&t?.name==="usergroup_name"?async t=>{if((0,c.cL)().test(t)){h(void 0),_({isValidUserGroupName:!0});return}let a=await v(t);if(!a){h(void 0),_({isValidUserGroupName:!0});return}h({errorType:e,errorText:a}),_({isValidUserGroupName:!1})}:e===u.oW.UpdateChannelTopic&&t?.name==="topic"?async t=>{if((0,o.Lk)(t).length>d.QS){h({errorType:e,errorText:(0,d.Bw)(d.FA)}),_({isValidChannelTopic:!1});return}h(void 0),_({isValidChannelTopic:!0})}:void 0,[e,x,E,v,t?.name,_]);return{error:a,runAsyncTextValidation:k?(0,i.A)(k,500,{leading:!0}):void 0}}},0x1011848bf:(e,t,a)=>{"use strict";a.d(t,{L:()=>n.L});var n=a(0x1efcf3032)},0x1c4a1a163:(e,t,a)=>{"use strict";a.d(t,{v:()=>InputRenderingEngine});var n=a(0xbad225b5),r=a(0x1df96de4c),l=a(0x88881d67),i=a(0x1f5430624),o=a(0xa4a4f43b),s=a(0x242822dfb),c=a(0x2151a9a6),d=a(0xa224974e),u=a(0x19f0ddaf7),m=a(0x1407c6c2c),p=a(0x20482ad21),b=a(0x2503b7c1),f=a(0x677a139e),g=a(0x235d78b7c),h=a(0x380ee7b0),_=a(0x223beeef),y=a(0x1ba35eb3b),x=a(0x1d3dd4cbe),v=a(0x170cd7c4b),E=a.n(v);let k=new p.Ay("workflow_builder"),SlackFunctionDateInput=({value:e,parameter:t,onChange:a,required:r,variables:l,formatVariableBeforeInsert:i,allowVariables:o,hideLabel:c,isParameterSyncedWithForm:d})=>{let{viewOnly:u,onVariableMenuOpen:p}=(0,x.e)(),v=(0,m.A)(),w=u||d,S=(0,n.useCallback)(e=>{let n=i(e,{parameterType:t.type}).id;return a(t,n)},[i,a,t]),C=(0,n.useMemo)(()=>(0,s.r2)(l.list,e),[e,l.list]),A=(0,n.useCallback)(e=>{a(t,e)},[a,t]),T=(0,n.useCallback)(e=>(0,y.JF)(e,void 0)||(0,y.xY)({variable:e,parameter:t}),[t]);return n.createElement(_.z,{elementId:v,parameter:t,hideLabel:c,isParameterSyncedWithForm:d},C?n.createElement(h.P,{onChange:A,value:e,variables:l,customDataFilter:T,label:t.title??t.description??t.name,isDisabled:w,formatVariableBeforeInsert:i,parameterType:t.type}):n.createElement(n.Fragment,null,n.createElement("div",{className:E().dateWrapper},n.createElement(b.b,{onDateChange:A,inputClassName:"margin_bottom_100",dateFormat:"YYYY-MM-DD",displayFormat:"YYYY-MM-DD",selectedDate:e,required:r,id:v,datePlaceholder:t?.description??k.t("Select a date"),datePickerDisabled:w}),o&&!d&&n.createElement(g.jx,{onSelect:S,data:l.groups,customDataFilter:T,renderIconInline:!0,isDisabled:w,onMenuTriggerClick:p})),t.hint&&n.createElement(f.A,{className:"margin_bottom_0"},t.hint)))};SlackFunctionDateInput.displayName="SlackFunctionDateInput";var w=a(0x1fe708dbe),S=a(0x11a296110),C=a(0x1b3ecb90f),A=a(0x1faaed399);let SlackFunctionEmojiInput=({value:e,parameter:t,onChange:a,hideLabel:r})=>{let l=(0,m.A)(),{viewOnly:i}=(0,x.e)(),o=(0,n.useCallback)((e,n)=>{a(t,n)},[a,t]);return n.createElement(_.z,{elementId:l,parameter:t,hideLabel:r},n.createElement(A.A,{onEmojiSelected:o},n.createElement(S.Ay,{id:"channel-section-emoji",name:"channel-section-emoji","data-qa":"channel-section-emoji-picker",disabled:i,type:"outline","aria-label":e?"Change Emoji":"Select Emoji"},e?n.createElement(C.Ay,{emojiSize:C.lw.MEDIUM,text:e}):"Select Emoji")))};SlackFunctionEmojiInput.displayName="SlackFunctionEmojiInput";var T=a(0x10b93423f),I=a(0x120c268ad),N=a.n(I),M=a(0x21f3c49e8),L=a(0x12edaa96a),O=a(0x15dd8a31),F=a(0x2772625d),D=a(0x1b05cc3ce),P=a(0x15a4ffb05),R=a(0x185eec583),B=a(0x1e361565a),W=a(0x20a6d1776),V=a(0x207fb9b92),H=a(0x1282104f7),q=a(0x1840248cf),U=a(0xe0cde178),z=a.n(U);let j=new p.Ay("workflow_builder"),SlackFunctionEnumInput=({variables:e,value:t,parameter:a,formatVariableBeforeInsert:r,onChange:l,allowVariables:i,hideLabel:o,isParameterSyncedWithForm:s})=>{let c=(0,m.A)(),d=a.type,{viewOnly:u,onVariableMenuOpen:p}=(0,x.e)(),[b,h]=(0,n.useState)(c),[v,E]=(0,n.useState)(!1),[k,w]=(0,n.useState)(),S=(0,n.useMemo)(()=>Object.fromEntries(e.list.map(e=>[e.id,e])),[e]),A=(a.is_required||(0,D.L$)(a))&&!a.isParameterFormWrappable,T=u||s,I=(0,n.useMemo)(()=>{let e="number"==typeof t?Number.isNaN(t):(0,M.A)(t),a=[];return A&&e&&a.push({id:"is_empty_and_is_required",message:j.t("This field is required.")}),a},[A,t]),{onBlur:U,okayToDisplay:G}=(0,V.K)({errorMessage:void 0,isErrored:I.length>0}),$=(0,n.useCallback)(e=>{switch(d){case W.V.String:return(0,y.qO)(e);case R.I.Integer:return(0,y.DU)(e);case B.n.Number:return(0,y.If)(e);default:return!0}},[d]),K=(0,n.useCallback)(e=>{if(t!==e.value){let t=a?.choices?a.choices.find(t=>t.value===e.value)?.title:void 0;l(a,e.value,t?{[e.value]:t}:void 0),h((0,L.A)()),""===e.value&&E(!0),k&&w(void 0)}},[a,l,t,k]),Y=(0,n.useCallback)(e=>(0,F.cn)(e.value)&&k?n.createElement(H.A,{className:N()("align_items_start flex_direction_column margin_top_0",{[z().has_errors]:!k.label?.length}),svgIcon:{name:"css"},entityId:k.id,label:k.label?.length?k.label:j.t("Missing Data")}):n.createElement(P.A,{text:e.label,emojiSize:C.lw.SMALL}),[k]),Q=(0,n.useCallback)(e=>{let t=r?.(e,{})??e;w(t),l(a,t.id),h((0,L.A)())},[r,l,a]),Z=t;!a.default||Z||v||(Z=a.default,setTimeout(()=>{a.default&&l(a,a.default)}));let J=j.t("Please select an option"),X=(0,n.useMemo)(()=>{let e={label:j.t("Clear selection",{ns:"channel_sidebar"}),value:""},t=Array.isArray(a.choices)?a.choices.filter(e=>!0!==e.is_hidden).map(({title:e,value:t})=>({label:e,value:String(t)})):(a.enum||[]).map(String).map(e=>({label:e,value:e}));if("string"==typeof Z&&(0,F.cn)(Z)){let e={...S[(0,q.z)(Z)],id:Z};t.push({label:e.label||"",value:Z}),k?.id!==e.id&&w(e)}return!a.is_required&&Z&&(t.find(e=>""===e.value)||t.unshift(e)),t},[a,S,Z,k?.id]),ee=(0,n.useMemo)(()=>Z?X.find(e=>e.value===String(Z)):null,[X,Z]);return n.createElement(_.z,{elementId:c,parameter:a,hideLabel:o,isParameterSyncedWithForm:s},n.createElement("div",{className:"display_flex"},n.createElement("div",{className:"full_width display_flex"},n.createElement(O.A,{className:"flex_one no_min_width",key:b,width:"100%",options:X,selectedOption:ee,onOptionSelected:K,ariaLabel:J,selectDataQa:"slack-function-enum-input",placeholderText:a.description||J,renderOption:Y,renderSelectedOption:Y,isDisabled:T,onBlur:U,errors:G?I:void 0,isInvalid:G&&!!I.length}),i&&!s&&n.createElement(g.jx,{onSelect:Q,data:e.groups,customDataFilter:$,renderIconInline:!0,isDisabled:T,onMenuTriggerClick:p,className:"margin_left_50 margin_top_50 display_flex align_items_start"}))),a.hint&&n.createElement(f.A,{className:"margin_bottom_0"},a.hint))};SlackFunctionEnumInput.displayName="SlackFunctionEnumInput";let InteractivityInput=({onChange:e,parameter:t,value:a})=>((0,n.useEffect)(()=>{a&&0!==a.length||e(t,"init")},[e,t,a]),null);var G=a(0x16cf1da63),$=a(0x207b33662),K=a(0x1576dac7),Y=a(0x13f7d86f3),Q=a(0x2001af3ac),Z=a(0x24429189c);let J=new p.Ay("workflow_builder"),SlackFunctionLimitedBlocksInput=({value:e,callbackId:t,parameter:a,variables:r,onChange:l,formatVariableBeforeInsert:i,required:o,hideLabel:s,isParameterSyncedWithForm:c,sendAsUserValue:d=!1,experimentUserAuthoredWorkflowPostsFeGroupOn:u=!1})=>{let{title:p,isParameterFormWrappable:b}=a,f=(0,m.A)(),[g,h]=(0,n.useState)(!1),y=(0,G.wA)(),{viewOnly:v,onVariableMenuOpen:E}=(0,x.e)(),k=(0,n.useMemo)(()=>g||!!(o||(0,D.L$)(a))&&!b&&(0,M.A)(e),[e,g,o,a,b]),w=(0,n.useMemo)(()=>g?J.t("Message is too long."):J.t("This field is required."),[g]),{errorText:S,onBlur:C}=(0,V.K)({errorMessage:w,isErrored:k}),A=(0,n.useCallback)(({blocks:e})=>{if(e){let t=y((0,Z.f)({blocks:e}));h((0,Q.A)(t)>75)}l(a,e??[])},[y,l,a]),T=(0,n.useCallback)(({activeTokenElement:e,activeTokenData:a,activeTokenVariableData:r,hideCustomizeDataPopover:l,updateDynamicData:i})=>(0,Y.L4)(r)?n.createElement(K.I,{tetherElement:e,tokenData:a,variableData:r,callbackId:t,onClose:l,updateDynamicData:i,fromRichText:!0}):null,[t]),I=(0,n.useMemo)(()=>"string"==typeof e?[]:e,[e]);return n.createElement(_.z,{elementId:f,parameter:a,hideLabel:s,isParameterSyncedWithForm:c},n.createElement($.c,{id:"message",initialText:"string"==typeof e?e:"",initialBlocks:I,data:r,placeholder:a?.description??J.t("Ex: Hello!"),ariaLabel:p??J.t("Set the step message text"),hint:a.hint,onTextChange:A,onBlur:C,callbackId:t,errorText:S||null,maxLength:75,isSingleLine:!0,useLimitedBlocks:!0,enableEmoji:!0,shouldAddNewLineOnEnter:!0,onEnter:null,focusOnMount:!1,isDisabled:v||c,formatVariableBeforeInsert:i,canInsertAllVariablesByGroup:!0,getVariableCustomizeMenu:T,onVariableMenuOpen:E,sendAsUserValue:d,experimentUserAuthoredWorkflowPostsFeGroupOn:u}))};SlackFunctionLimitedBlocksInput.displayName="SlackFunctionLimitedBlocksInput";var X=a(0x118cdcdea),ee=a.n(X),et=a(0x242c34757),ea=a(0xbbd2a32d),en=a(0x1795d8821);let er=new p.Ay("workflow_builder"),SlackFunctionNumberInput=({variables:e,value:t,parameter:a,onChange:r,formatVariableBeforeInsert:l,allowVariables:i,hideLabel:o,isParameterSyncedWithForm:s})=>{let{title:c,description:d,is_required:u=!1,isParameterFormWrappable:p}=a,b=(u||(0,D.L$)(a))&&!p,f=(0,m.A)(),{viewOnly:g,onVariableMenuOpen:h}=(0,x.e)(),v=(0,n.useRef)(),E=a.type===en.HN.Integer,k=g||s,w=""===t?NaN:Number(t),S=E?(0,ea.zh)(w):(0,ea.gf)(w),C=w>ea.Ig||a.maximum&&w>a.maximum,A=w<ea.kj||a.minimum&&w<a.minimum,T=(0,F.cn)(String(t))||S&&!C&&!A,I=(0,n.useMemo)(()=>b&&""===t?er.t("This field is required."):C?er.t("This number is too large."):A?er.t("This number is too small."):E?er.t("This is not a valid integer."):er.t("This is not a valid number."),[E,b,C,A,t]),N=(0,n.useMemo)(()=>b?!T:""!==t&&!T,[T,b,t]),{errorText:M,onBlur:L}=(0,V.K)({errorMessage:I,isErrored:N}),O=(0,n.useCallback)(({text:e})=>{r(a,e.replace(/{{(.*?)}}/g,"$1"))},[r,a]),P=(0,n.useCallback)(e=>{v.current=e},[]),R=(0,n.useCallback)(()=>{if(S&&v.current){let e=String(Number(t)),a=new(ee())().insert(e);v.current?.setContents({contents:a.ops})}L()},[S,L,t]),B=(0,n.useCallback)(e=>(E?(0,y.DU)(e):(0,y.If)(e))||(0,y.xY)({variable:e,parameter:a}),[E,a]);return n.createElement(_.z,{elementId:f,parameter:a,hideLabel:o,isParameterSyncedWithForm:s},n.createElement(et.A,{id:f,initialText:String(t),variables:e,allowVariables:i,ariaLabel:c,shouldAddNewLineOnEnter:!1,onTextChange:O,onBlur:R,formatVariableBeforeInsert:l,errorText:M,placeholder:d,hint:a.hint,renderDataMenuLocation:"inline",customDataFilter:B,onSetTextyRef:P,isDisabled:k,onVariableMenuOpen:h}))};SlackFunctionNumberInput.displayName="SlackFunctionNumberInput";var el=a(0x1d2cd7755),ei=a(0x139c79d16),eo=a(0xa5dbe09b),es=a(0x226892387),ec=a(0x14149c126),ed=a(0x19935b6b1),eu=a.n(ed);let em=new p.Ay("workflow_builder"),SlackFunctionRadioInput=({value:e,parameter:t,onChange:a})=>{let r=(0,es.d4)(e=>"on"===(0,ec._Z)(e,"user_authored_workflow_posts_fe")),l=r?em.t("Send message as:"):"Send message as:",i=(0,m.A)(),{viewOnly:o,formStepPrecedesCurrentStep:s}=(0,x.e)();(0,n.useEffect)(()=>{void 0===e&&a(t,!1),s||a(t,!1)},[e,s]);let c=(0,n.useCallback)(e=>{a(t,"true"===e.target.value)},[a,t]);return r?n.createElement("div",{className:N()(eu().outerContainer)},n.createElement("div",{className:N()(eu().innerContainer)},n.createElement(eo.A,{legendText:l},n.createElement(el.A,{text:r?em.t("Workflow"):"Workflow",type:"inline"},n.createElement(ei.A,{"data-qa":"radio",id:`${i}-false`,value:"false",onChange:c,checked:!1===e,disabled:o||!s})),n.createElement(el.A,{text:em.t("Person who submitted the form"),type:"inline"},n.createElement(ei.A,{"data-qa":"radio",id:`${i}-true`,value:"true",onChange:c,checked:!0===e,disabled:o||!s}))))):null};SlackFunctionRadioInput.displayName="SlackFunctionRadioInput";var ep=a(0x2501a2cee),eb=a(0x11c82607b),ef=a(0x9b971e7e),eg=a(0x1e4ae349d);let eh=(0,eb.Ay)("gets the canonical emoji name",(e,t,{emojiName:a})=>{let n=t(),r=(0,ef.ZT)(n);return(0,eg.I9)(n,{text:a,teamId:r})});eh.meta={name:"getCanonicalEmojiNameThunk",key:"createThunkGetCanonicalEmojiNameThunk",description:"gets the canonical emoji name"};var e_=a(0x10b4dd7c2),ey=a.n(e_);let ex=new p.Ay("workflow_builder"),AddReaction=({onAdd:e,reactions:t,maxEmojis:a})=>{let r=(0,G.wA)(),{viewOnly:l}=(0,x.e)(),i=(0,n.useCallback)((t,a)=>{let n=r(eh({emojiName:a}));n&&e(n)},[e,r]);return n.createElement(A.A,{onEmojiSelected:i,showHandyReactions:!0},n.createElement(S.Ay,{disabled:l||t.length>=a,type:"outline",size:"small","data-qa":"add-reaction__button",className:ey().addReaction__button},n.createElement(ep.Ah,{inline:!0,name:"add-reaction",size:"18"}),n.createElement("span",null,ex.t("Add Emoji"))))};AddReaction.displayName="AddReaction";var ev=a(0x344bb842),eE=a(0xe9c32bb),ek=a(0x1ccef1c6f),ew=a(0x1266f1359),eS=a(0x1c9a3f62b),eC=a(0x3bb53a1e),eA=a.n(eC);let eT=new p.Ay("workflow_builder"),ReactionItem=({reaction:e,disabled:t,onRemove:a})=>{let r=(0,es.d4)(ef.ZT),l=(0,ew.$D)(r),i=(0,ek.ty)(l,"preferred_skin_tone"),o=(0,eg.Fm)(l,{text:e,teamId:r??""}),s=(0,n.useMemo)(()=>(0,eS.QV)(e),[e]),c=(0,n.useMemo)(()=>o||e.includes("skin-tone"),[o,e]),d=(0,n.useMemo)(()=>c?`:${s}: (${eT.t("All skin tones")})`:`:${e}:`,[c,e,s]),u=(0,n.useMemo)(()=>i?.length&&"1"!==i?n.createElement(C.Ay,{text:`${s}::skin-tone-${i}`,emojiSize:"medium"}):n.createElement(C.Ay,{text:s,emojiSize:"medium"}),[i,s]),m=(0,n.useCallback)(()=>{a(e)},[a,e]),p=(0,n.useMemo)(()=>({name:"trash"}),[]);return n.createElement("li",null,n.createElement("div",{className:eA().reaction_info},n.createElement("div",null,u),n.createElement(eE.nB,null,d)),n.createElement(ev.A,{className:eA().delete_button,disabled:t,onClick:m,svgIconProps:p,size:"small","aria-label":eT.t("Delete {emojiName} emoji",{emojiName:e,fallbackHash:"f6fdbe48dc54dd86f63097a03bd24094dedd713a"})}))};ReactionItem.displayName="ReactionItem";let ReactionsList=({reactions:e,onDelete:t})=>{let{viewOnly:a}=(0,x.e)(),r=(0,n.useCallback)(e=>{t(e)},[t]);return n.createElement(n.Fragment,null,e.length>0&&n.createElement("ul",{className:eA().container},e.map(e=>n.createElement(ReactionItem,{key:e,reaction:e,disabled:a,onRemove:r}))))};ReactionsList.displayName="ReactionsList";let InputReaction=({value:e,parameter:t,onChange:a,maxEmojis:r=10})=>{let l=(0,n.useMemo)(()=>e?new Set(e.map(e=>(0,eS.QV)(e))):new Set,[e]),i=(0,n.useCallback)(n=>{l.has((0,eS.QV)(n))||a(t,[...e,n])},[l,a,t,e]),o=(0,n.useCallback)(n=>{a(t,e.filter(e=>e!==n))},[a,t,e]),s=(0,m.A)();return n.createElement(_.z,{elementId:s,parameter:t},n.createElement(ReactionsList,{reactions:e,onDelete:o}),n.createElement(AddReaction,{reactions:e,onAdd:i,maxEmojis:r}))};InputReaction.displayName="InputReaction";var eI=a(0x32784134),eN=a(0x1b1820b2c),eM=a(0xec70cbf1),eL=a.n(eM);let SlackFunctionTimestampInput=({value:e,parameter:t,onChange:a,required:r,variables:l,formatVariableBeforeInsert:i,allowVariables:o,hideLabel:c,isParameterSyncedWithForm:d})=>{let u=(0,m.A)(),{viewOnly:p,onVariableMenuOpen:b}=(0,x.e)(),v=p||d,E=(0,n.useCallback)(e=>{let n=i(e,{parameterType:t.type}).id;return a(t,n)},[i,a,t]),k=(0,n.useMemo)(()=>(0,s.r2)(l.list,e),[e,l.list]),w=(0,n.useCallback)(e=>{a(t,e)},[a,t]),S=(0,n.useCallback)(e=>(0,y.p0)(e)||(0,y.xY)({variable:e,parameter:t}),[t]),C=t.title??t.description??t.name;return n.createElement(_.z,{elementId:u,parameter:t,hideLabel:c,isParameterSyncedWithForm:d},k?n.createElement(h.P,{onChange:w,value:e,variables:l,customDataFilter:S,label:C,isDisabled:v,formatVariableBeforeInsert:i,parameterType:t.type}):n.createElement(n.Fragment,null,n.createElement("div",{className:eL().timestampWrapper},n.createElement(eN.A,{id:u,className:eL().timestampInlineDateTimePicker,onChange:w,valueFormat:"X",value:e,"aria-label":C,isRequired:r,showTimeZone:!1,disabled:v}),o&&!d&&n.createElement(g.jx,{onSelect:E,data:l.groups,customDataFilter:S,renderIconInline:!0,isDisabled:v,onMenuTriggerClick:b})),t.hint&&n.createElement(f.A,{className:"margin_bottom_0"},t.hint)))};SlackFunctionTimestampInput.displayName="SlackFunctionTimestampInput";var eO=a(0x1f0569040);let UserContextInput=({onChange:e,parameter:t,value:a})=>((0,n.useEffect)(()=>{a||e(t,"init")},[e,t,a]),null);var eF=a(0x204ee6449),eD=a(0x1a740dbac),eP=a(0x136ad1993),eR=a(0x1d922a37e),eB=a(0x1c09d8c36);let eW=[eB.Eq,eB.V0,eB.a5];var eV=a(0x218fd5440),eH=a(0xa21d3b1e),eq=a(0x17c7b6bbb),eU=a(0x1846f5916),ez=a(0xf5bbd10a);let InputRenderingEngine=({functionId:e,variables:t,configuredParameters:a={},onChange:m,formatVariableBeforeInsert:p,callbackId:b,applySpecialTreatment:f,showInline:g=!1,renderOAuth2InputParameter:h,stepId:_,isExistingStep:v,stepErrorCode:E,workflowId:k,workflowExternalWorkspaceId:S,serviceTriggerType:C,triggerId:A,isTriggerSegment:I,functionVariables:N,isOAuthTokenInvalid:M,isFunctionFormWrapped:L,onlyRenderParentInputs:O,onlyRenderChildInputs:F,shouldAlwaysDisplayVariableSelector:P,parameter:R,keyValueParameters:B,oAuthParameter:W,inputParameters:V,hideLabel:H,onLoadingStateChange:q,hasOnlyKeyValueParameter:U,allowVariables:z=!0,invalidKeyword:j,shouldAutoFocus:G,enableEmojiAutocomplete:$,enableRichTextDropdowns:K=!1,enableStringFallback:Y=!1})=>{let{formStepPrecedesCurrentStep:Q,previousStepId:Z}=(0,x.e)(),J=(0,ez.A)(),X=(0,es.d4)(e=>"on"===(0,ec._Z)(e,"user_authored_workflow_posts_fe")),ee=a[R.name]?.value,et=a[R.name]?.label,ea=R.name.split(".").pop(),er=!!a?.send_as_user?.value,el=(0,n.useMemo)(()=>{if(!t)return;if(!(Q&&er&&b&&"send_message"===b))return t;let{list:e,groups:a}=t,n=[Z,_].filter(e=>void 0!==e);return{list:e.map(e=>n.includes(e.source_id)||"trigger"===e.source?e:{...e,isAvailable:!1,isHidden:!0}),groups:a.filter(e=>n.includes(e.id)||(0,eq.Af)(e.type))}},[t,b,Q,Z,er,_]),{type:ei}=R,eo=!!R.is_required,ed=f?.(R,ee,a),eu=z&&!I&&(0,eP.z)({callbackId:b,parameter:R}),em=t;X&&em&&(em=el),em&&(em=(0,eH.z)({parameterName:R.name,functionVariables:N,variables:em,isFunctionFormWrapped:L,stepId:_}));let formatVariableBeforeInsert=(e,t)=>{let a=(0,eR.F)({variable:e,parameterName:R.name,functionVariables:N});return p?p(a,t):a},ep=(0,n.useMemo)(()=>(0,l.uU)(em??eU.Gs,e=>(0,y.VH)(e)),[em]),eb=F&&R.isParameterFormWrapped,ef=M&&!(0,eV.t)(R);if(R.is_hidden||(0,D.M$)(R,a)||ef)return null;if(ed)return n.createElement(n.Fragment,null,ed);if((0,s.qt)(R)&&e&&k){let t="childInputs"in R&&Array.isArray(R.childInputs)&&B.length>0&&R.childInputs.some(t=>B.some(a=>a.name===t&&(a.is_required||eW.includes(e))));return n.createElement(i.r,{variables:em,parameter:R,value:ee,label:et,values:a,onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,callbackId:b,functionId:e,workflowId:k,oAuthParameter:W,stepId:_,stepErrorCode:E,isExistingStep:v,serviceTriggerType:C,triggerId:A,isTriggerSegment:I,allowVariables:eu,hasDependentField:t,functionVariables:N,isFunctionFormWrapped:L,onlyRenderParentInputs:O,onlyRenderChildInputs:F,isParameterSyncedWithForm:eb,hideLabel:H,onLoadingStateChange:q,hasOnlyKeyValueParameter:U})}if(eb)return n.createElement(o.C,{value:ee,parameter:R,variables:em});switch(ei){case en.HN.SlackTypesMessageContext:case en.HN.SlackTypesUserId:case en.HN.SlackTypesChannelId:case en.HN.SlackTypesUsergroupId:case en.HN.SlackTypesListId:case en.HN.SlackTypesCanvasId:case en.HN.SlackTypesChannelCanvasId:case en.HN.SlackTypesCanvasTemplateId:case en.HN.SlackTypesTeamId:return n.createElement(T.O,{variables:em||eU.Gs,allowVariables:eu,parameter:R,value:ee||"",onChange:m,callbackId:b,externalWorkspaceId:S,hideLabel:H,isFunctionFormWrapped:L});case en.HN.Integer:case en.HN.Number:if(Array.isArray(R.enum)||Array.isArray(R.choices))return n.createElement(SlackFunctionEnumInput,{variables:em||eU.Gs,parameter:R,value:"string"==typeof ee||"number"==typeof ee?ee:"",onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});return n.createElement(SlackFunctionNumberInput,{variables:em||eU.Gs,parameter:R,value:"string"==typeof ee||"number"==typeof ee?ee:"",onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});case en.HN.Boolean:if("send_as_user"===ea)return n.createElement(SlackFunctionRadioInput,{parameter:R,value:ee??void 0,onChange:m});return n.createElement(u.B,{parameter:R,value:ee||"",onChange:m,variables:em||eU.Gs,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});case en.HN.String:if("emoji"===ea)return n.createElement(SlackFunctionEmojiInput,{parameter:R,value:ee||"",onChange:m,hideLabel:H});if(Array.isArray(R.enum)||Array.isArray(R.choices))return n.createElement(SlackFunctionEnumInput,{variables:em||eU.Gs,parameter:R,value:ee||"",onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});return n.createElement(eI.C,{variables:em||eU.Gs,parameter:R,value:ee||"",required:eo,onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,callbackId:b,showInline:g,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});case en.HN.SlackUserPermission:return null;case en.HN.Array:return n.createElement(c.m,{parameter:R,value:"string"==typeof ee||Array.isArray(ee)?ee:void 0,onChange:m,variables:em??eU.Gs,formatVariableBeforeInsert:formatVariableBeforeInsert,externalWorkspaceId:S,callbackId:b,functionId:e,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb,shouldAlwaysDisplayVariableSelector:P,invalidKeyword:j,shouldAutoFocus:G,enableEmojiAutocomplete:$});case en.HN.SlackTypesTimestamp:return n.createElement(SlackFunctionTimestampInput,{parameter:R,value:ee||"",required:eo,onChange:m,variables:em||eU.Gs,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});case en.HN.SlackTypesRichText:case en.HN.SlackTypesExpandedRichText:case en.HN.SlackTypesBlocks:if(ei===en.HN.SlackTypesRichText&&R.contains_ai_generated_content)return n.createElement(eF.F,{value:ee||"",parameter:R,onChange:m,variables:ep,formatVariableBeforeInsert:formatVariableBeforeInsert,hideLabel:H});return n.createElement(d.h,{callbackId:b,variables:em||eU.Gs,parameter:R,value:ee||r.Ml,required:eo,onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,parameters:V,configuredParameters:a,allowVariables:eu,hideLabel:H,sendAsUserValue:er,experimentUserAuthoredWorkflowPostsFeGroupOn:X});case en.HN.SlackTypesLimitedRichText:if(K&&(Array.isArray(R.enum)||Array.isArray(R.choices)))return n.createElement(SlackFunctionEnumInput,{variables:em||eU.Gs,parameter:R,value:ee||"",onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});return n.createElement(SlackFunctionLimitedBlocksInput,{callbackId:b,variables:em||eU.Gs,parameter:R,value:ee||r.Ml,required:eo,onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,parameters:V,configuredParameters:a,allowVariables:eu,hideLabel:H,sendAsUserValue:er,experimentUserAuthoredWorkflowPostsFeGroupOn:X});case en.HN.SlackTypesSalesforceRecordId:return n.createElement(eF.F,{value:ee||"",parameter:R,onChange:m,variables:em??eU.Gs,formatVariableBeforeInsert:formatVariableBeforeInsert,hideLabel:H});case en.HN.SlackTypesDate:return n.createElement(SlackFunctionDateInput,{parameter:R,value:ee||"",required:eo,onChange:m,variables:em||eU.Gs,formatVariableBeforeInsert:formatVariableBeforeInsert,allowVariables:eu,hideLabel:H});case en.HN.DateTime:return n.createElement(w.e,{parameter:R,value:ee||"",required:eo,onChange:m,isParameterSyncedWithForm:eb});case en.HN.Reaction:return n.createElement(InputReaction,{onChange:m,parameter:R,value:ee??r.Ml});case en.HN.SlackTypesCredentialOauth2:if(h)return n.createElement(n.Fragment,null,h(R,ee??void 0));return J.error("Unable to render OAuth2InputParameter"),null;case en.HN.Timezone:return n.createElement(eO.I,{parameter:R,required:eo,value:ee||"",onChange:m,isParameterSyncedWithForm:eb});case en.HN.SlackTypesUserContext:return n.createElement(UserContextInput,{parameter:R,onChange:m,value:ee});case en.HN.SlackTypesInteractivity:return n.createElement(InteractivityInput,{parameter:R,onChange:m,value:ee});default:if(Y)return n.createElement(eI.C,{variables:em||eU.Gs,parameter:R,value:ee||"",required:eo,onChange:m,formatVariableBeforeInsert:formatVariableBeforeInsert,callbackId:b,showInline:g,allowVariables:eu,hideLabel:H,isParameterSyncedWithForm:eb});return n.createElement(eD.b,{parameter:R,functionId:e})}};InputRenderingEngine.displayName="InputRenderingEngine"},0x1efcf3032:(e,t,a)=>{"use strict";a.d(t,{L:()=>SharedClientWorkflowBuilderRenderingEngine});var n=a(0xbad225b5),r=a(0x242822dfb),l=a(0x1c4a1a163),i=a(0x1d3dd4cbe),o=a(0x145d46a61),s=a(0x1795d8821),c=a(0x226892387);let sortInputParametersOAuthToFront=e=>e.type===s.HN.SlackTypesCredentialOauth2?-1:0,SharedClientWorkflowBuilderRenderingEngine=({functionId:e,inputParameters:t,oAuthParameter:a,variables:s,configuredParameters:d,onChange:u,formatVariableBeforeInsert:m,callbackId:p,applySpecialTreatment:b,showInline:f=!1,renderOAuth2InputParameter:g,stepId:h,isExistingStep:_,stepErrorCode:y,workflowRendererContexts:x,workflowId:v,workflowExternalWorkspaceId:E,serviceTriggerType:k,triggerId:w,isTriggerSegment:S,functionVariables:C,isOAuthTokenInvalid:A,isFunctionFormWrapped:T,onlyRenderParentInputs:I,onlyRenderChildInputs:N,shouldAlwaysDisplayVariableSelector:M,onLoadingStateChange:L,hideLabel:O,invalidKeyword:F,shouldAutoFocus:D,enableEmojiAutocomplete:P,allowVariables:R})=>{let B=(0,c.d4)(o.$T),W=(0,n.useMemo)(()=>t.sort(sortInputParametersOAuthToFront),[t]),V=(0,n.useMemo)(()=>(0,r.xn)(W),[W]),H=(0,n.useMemo)(()=>!!B&&!!t.length&&N&&t.every(e=>(0,r.qt)(e)&&(0,r.sg)(e)),[B,t,N]);return t.length?n.createElement(i.B.Provider,{value:x},W.map((t,r)=>{let i=h?`${t.name}-${h}`:t.name;return n.createElement(l.v,{key:i,functionId:e,variables:s,configuredParameters:d,onChange:u,formatVariableBeforeInsert:m,callbackId:p,applySpecialTreatment:b,showInline:f,renderOAuth2InputParameter:g,stepId:h,isExistingStep:_,stepErrorCode:y,workflowId:v,workflowExternalWorkspaceId:E,serviceTriggerType:k,triggerId:w,isTriggerSegment:S,functionVariables:C,isOAuthTokenInvalid:A,isFunctionFormWrapped:T,onlyRenderParentInputs:I,parameter:t,inputParameters:W,keyValueParameters:V,oAuthParameter:a,onlyRenderChildInputs:N,shouldAlwaysDisplayVariableSelector:M,onLoadingStateChange:L,hasOnlyKeyValueParameter:H,hideLabel:O,invalidKeyword:F,shouldAutoFocus:D&&0===r,enableEmojiAutocomplete:P,allowVariables:R})})):null};SharedClientWorkflowBuilderRenderingEngine.displayName="SharedClientWorkflowBuilderRenderingEngine"},0x136ad1993:(e,t,a)=>{"use strict";a.d(t,{z:()=>allowVariablesForParameter});var n=a(0x1340d624e),r=a(0x1795d8821);let l={[r.oW.SendToSalesHome]:[n.XD.NOTIFY_MANAGERS,n.XD.ROLES_TYPE,n.XD.ROLES,n.XD.ROLE_CONTAINS,n.XD.ROLE_DOES_NOT_CONTAIN],[r.oW.SendSummaryToMySalesHome]:[n.bI.MESSAGE],[r.oW.SendSummaryToSalesHome]:[n.bI.MESSAGE],[r.oW.AddAgentToChannel]:[n.zc.AGENT_IDS],[r.oW.SummarizeChannel]:[n.XZ.DAYS],[r.oW.UpdateCanvasContent]:[n.kJ.SECTION_ID],[r.oW.UpdateCanvasContentV2]:[n.ED.SECTION_ID],[r.oW.UpdateCanvasVariables]:[n.x4.PLACEHOLDER_VALUES]},i={[r.oW.UpdateCanvasContent]:[n.kJ.SECTION_ID,n.ED.CHANNEL_ID,n.ED.CANVAS_TAB_SECTION_ID,n.ED.CANVAS_TAB],[r.oW.UpdateCanvasContentV2]:[n.ED.SECTION_ID,n.ED.CHANNEL_ID,n.ED.CANVAS_TAB_SECTION_ID,n.ED.CANVAS_TAB]},allowVariablesForParameter=({parameter:e,callbackId:t})=>!(t&&t in i&&i[t].includes(e.name))&&(!t||!(t in l)||!l[t].includes(e.name))},0x1d922a37e:(e,t,a)=>{"use strict";a.d(t,{F:()=>applyCurrentValueVariableLabel,y:()=>formatCurrentValueVariableLabel});var n=a(0x20482ad21),r=a(0x1862f5064);let l=new n.Ay("workflow_builder"),formatCurrentValueVariableLabel=e=>l.t("Current value: {variableLabel}",{variableLabel:e,fallbackHash:"ed2757f1ed21915706134a6d00c283c0961a392e"}),applyCurrentValueVariableLabel=({variable:e,parameterName:t,isKeyValueParameter:a,dynamicOptionKey:n,functionVariables:l})=>{let i=(0,r.Q)({parameterName:t,isKeyValueParameter:a,dynamicOptionKey:n,functionVariables:l});return i?.mapping.template===e.id?{...e,label:formatCurrentValueVariableLabel(e.label)}:e}},0x118f04a01:(e,t,a)=>{"use strict";a.d(t,{Ps:()=>hasAnyPrivateChannelAccessError,Se:()=>computeChannelPermissionErrorIndexes});var n=a(0x12185e091),r=a(0xf159cb74),l=a(0x73d7ee71),i=a(0x1795d8821);let hasPrivateChannelAccessError=(e,t,a)=>{if(!e||!(0,n.Zp)(e))return!1;if(!1===t)return!0;if(a&&a.length>0){let t=(0,l.S)(e);if(t.length>0)return!t.some(e=>a.includes(e));let n=(0,r.c)(e);return!n||!a.includes(n)}return!1},hasAnyPrivateChannelAccessError=(e,t,a)=>e.some(e=>hasPrivateChannelAccessError(e,t,a)),computeChannelPermissionErrorIndexes=(e,t)=>{if(!t||!t.experimentMessagePostedTriggerInPrivateChannelsGroupOn)return[];let{callbackId:a,arrayItemType:n,allChannels:r,privateChannelAccess:l,privateChannelTeamIds:o}=t;if(a!==i.Uk.MessagePosted||n!==i.TE.SlackTypesChannelId||!Array.isArray(e)||!0===l&&(!o||0===o.length))return[];let s=[];return e.forEach((e,t)=>{"string"==typeof e&&hasPrivateChannelAccessError(r[e],l,o)&&s.push(t)}),s}},0xcb24a23b:(e,t,a)=>{"use strict";a.d(t,{g:()=>deriveMultiSelectInputErrors});var n=a(0x21f3c49e8),r=a(0x20482ad21),l=a(0xf33a4f91),i=a(0x1ba35eb3b),o=a(0x668181b3),s=a(0x2772625d),c=a(0xbd3de346),d=a(0x1795d8821),u=a(0xa985ed31);let m=new r.Ay("workflow_builder"),deriveMultiSelectInputErrors=({variables:e,id:t,value:a,isValidEmptyObject:r,isRequired:p,parameter:b,arrayItemType:f,allFiles:g})=>{let h=[],{isParameterFormWrappable:_}=b,y="items"in b&&"string"===b.items.type?b.items.minLength:void 0,x="items"in b&&"string"===b.items.type?b.items.maxLength:void 0;if(!r&&p&&!_&&(0,n.A)(a)&&h.push({id:`${t}_is_required`,message:m.t("This field is required.")}),"string"==typeof a){if((0,s.cn)(a)){let n=(0,o.x)(e.list,a);if(!n||n.isTombstone)return h.push({id:`${t}_is_missing_variables`,message:m.t("This value contains missing variables.")}),[h,[0]];n.isAvailable||h.push({id:`${t}_is_unavailable_variables`,message:m.t("This value contains unavailable variables.")}),b&&"items"in b&&!(0,i.yH)(n,b)&&h.push({id:`${t}_is_invalid_variables`,message:m.t("This variable is not supported as an item in this field")})}return h.length>0?[h,[0]]:[h,[]]}if(!a)return[h,[]];let v=!1,E=!1,k=!1,w=!1,S=a&&a.length>1,C=a&&"string"!=typeof a&&a.some(t=>(0,l.x1)(e,String(t))),A="can_flatten"in b&&b.can_flatten;S&&C&&!A&&h.push({id:`${t}_is_mixed_with_array_variables`,message:m.t("Variables containing multiple items must be alone",{fallbackHash:"02605f6dabeee59a9b76627b21f072b71011da74"})});let T=f===d.TE.SlackTypesCanvasId||f===d.TE.SlackTypesListId,I=[];for(let t=0;t<a.length;t++){let n=String(a[t]);if((0,s.cn)(n)){let a=(0,o.x)(e.list,n);a?(v=!!(b&&"items"in b&&!(0,i.yH)(a,b)),E=!a.isAvailable):k=!0,(!a||v||E)&&I.push(t)}else if(T&&(0,u.A)(n)&&g){let e=g?.[n];(!e||e.isNonExistent||(0,c.uO)(e))&&(w=!0,I.push(t))}}if(v&&h.push({id:`${t}_is_invalid_variables`,message:m.t("This variable is not supported as an item in this field")}),E&&h.push({id:`${t}_is_unavailable_variables`,message:m.t("This value contains unavailable variables.")}),k&&h.push({id:`${t}_is_missing_variables`,message:m.t("This value contains missing variables.")}),w&&h.push({id:`${t}_is_deleted_file`,message:m.t("This value contains deleted items.",{fallbackHash:"b573f994259c0f2c0906cdd9c83ec7c7f64dd929"})}),b&&"minItems"in b&&b.minItems&&a.length<b.minItems&&!(0,n.A)(a)&&h.push({id:`${t}_is_less_than_min`,message:m.t("You must provide at least {numItems, plural, =1 {# item} other {# items}}",{numItems:b.minItems})}),b&&"maxItems"in b&&b.maxItems&&a.length>b.maxItems&&h.push({id:`${t}_is_greater_than_max`,message:m.t("You must provide at most {numItems, plural, =1 {# item} other {# items}}",{numItems:b.maxItems})}),a.some(e=>y&&"string"==typeof e&&e.length<y&&!(0,n.A)(a))&&h.push({id:`${t}_is_items_less_than_min_char_length`,message:m.t("Entries must include at least {numItems, plural, =1 {# character} other {# characters}}",{numItems:y})}),a.some(e=>x&&"string"==typeof e&&e.length>x&&!(0,n.A)(a))&&h.push({id:`${t}_is_items_less_than_max_char_length`,message:m.t("Entries must not exceed {numItems, plural, =1 {# character} other {# characters}}",{numItems:x})}),b&&"items"in b&&"string"===b.items.type&&"format"in b.items&&"string"!=typeof a&&Array.isArray(a)){let{format:e}=b.items;if(a.some(t=>{if("string"==typeof t&&!(0,s.cn)(t)){if("email"===e)return!(0,l.V2)(t);if("url"===e)return!(0,l.U6)(t)}return!1})){let e="email"===b.items.format?m.t("This is not a valid email address."):m.t("This is not a valid URL.");h.push({id:`${t}_is_invalid_format`,message:e})}}return[h,I]}},0x152e7cb26:(e,t,a)=>{"use strict";a.d(t,{Y:()=>getEmptyStateMessage});var n=a(0x20482ad21),r=a(0x1806ce928);let l=new n.Ay("workflow_builder"),getEmptyStateMessage=({value:e,typeahead:t,minQueryLength:a,errorCode:n})=>{if(t){if(!e)return l.t("Type to search\u2026");if(a&&e.length<a)return l.t("Keep typing\u2026");if(e&&n===r.n.TooManyOptions)return l.t("Too many results. Please add more keywords.")}return l.t("No items")}},0xa21d3b1e:(e,t,a)=>{"use strict";a.d(t,{z:()=>updateFunctionVariables});var n=a(0x18af67efb),r=a(0x20482ad21),l=a(0x1d922a37e),i=a(0x1862f5064);let o=new r.Ay("workflow_builder"),updateFunctionVariables=({parameterName:e,isKeyValueParameter:t,dynamicOptionKey:a,variables:r,functionVariables:s,isFunctionFormWrapped:c,stepId:d})=>{if(!d||!s)return r;let u=r.groups.find(e=>e.id===d&&e.data.some(({source:e})=>"variables"===e)),m=r.groups.filter(({id:e})=>e!==u?.id),p=(0,i.Q)({parameterName:e,isKeyValueParameter:t,dynamicOptionKey:a,functionVariables:s}),b=[...r.list];if(s.variables?.list&&b.unshift(...s.variables.list),p){let e={...p.variable,label:(0,l.y)(p.variable.label)};if(c){let t=u?{...u,data:[p.variable]}:{id:d,type:p.variable.source_type,data:[p.variable],label:o.t("Current value",{fallbackHash:"8dce170de238b1feda2ecd9674ea3ca0d068fbcb"})};return b.unshift(e),{list:(0,n.A)(b,"id"),groups:[t,...m]}}b.unshift({...e,isAvailable:!1})}return{list:(0,n.A)(b,"id"),groups:m}}},0x4b32db5f:(e,t,a)=>{"use strict";a.d(t,{T:()=>variableGroupsAsOptions});var n=a(0x1795d8821);let transformDataToOption=e=>({value:e.id,label:e.label,data:e}),variableGroupsAsOptions=e=>{let optionsReducer=(e,t)=>{if(t.type===n.TE.Object&&t.objectProperties){let a=t.objectProperties.reduce((e,t)=>(e.push(transformDataToOption(t)),e),[]);return e.push(...a),e}return e.push(transformDataToOption(t)),e};return e.reduce((e,t)=>{let a=t.data.reduce(optionsReducer,[]);if(0===a.length)return e;let n=t.label;return t.stepIndex&&(n=`${t.stepIndex}. ${n}`),e.push({label:n,options:a}),e},[])}},0x409e023f:(e,t,a)=>{"use strict";a.d(t,{u:()=>n.u});var n=a(0x1f7facc5c)},0x1f7facc5c:(e,t,a)=>{"use strict";a.d(t,{u:()=>RequestAppModal});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x1cbdfeceb),i=a(0x20482ad21),o=a(0x2b7f0bcc),s=a(0x11a296110),c=a(0x1d2cd7755),d=a(0x126f22530),u=a(0x6e87d4ec),m=a(0xb1ea448c),p=a(0x120c268ad),b=a.n(p),f=a(0x1e4ad58a2),g=a(0x1ee57b3a0),h=a(0xe9c32bb),_=a(0xac500276),y=a.n(_);let StepItemBase=({title:e,description:t,icon:a,className:r})=>n.createElement(f.A,{className:b()(y().step,r)},n.createElement(g.A,{className:y().stepContainer},n.createElement("div",{className:y().stepInfo},n.createElement("div",{className:y().stepIcon},a),n.createElement("div",{className:y().stepText},n.createElement(h.nB,{element:"h2"},e),t))));StepItemBase.displayName="StepItemBase";var x=a(0x1d9a37519),v=a(0x22146d01c),E=a.n(v);function renderDescription(e){return n.createElement(h.Zn,{element:"p",className:"margin_bottom_0",color:"foreground_max_solid"},e)}function RequestAppModalSubsectionList({appId:e,isLoading:t,listItems:a,expandListPane:r,error:l=!1}){if(!r||l)return null;if(t)return n.createElement(m.A,{size:"large",className:E().stepListLoader});if(a&&a.length>0){let t=n.createElement(x.z,{"data-qa":"app-icon",appId:e,alt:"",size:24,imageClassName:E().stepIcon});return n.createElement("ul",{className:E().stepList},a.map(e=>n.createElement("li",{key:e.id,className:"margin_bottom_50"},n.createElement(StepItemBase,{icon:t,title:e.title,description:renderDescription(e.description)}))))}return null}renderDescription.displayName="renderDescription",RequestAppModalSubsectionList.displayName="RequestAppModalSubsectionList";var k=a(0xa6f3163b),w=a(0x410829f8),S=a(0x2501a2cee);function RequestAppModalSubsectionTitle({expand:e,onExpand:t,count:a,showIconButtonAndBadge:r,label:l}){return 0===a?null:n.createElement("div",{className:E().stepListTitle},r&&n.createElement(k.A,{onClick:t,"data-qa":l},n.createElement(S.Ah,{name:e?"caret-down-filled":"caret-right-filled"})),n.createElement("div",{className:E().stepListTitleHeaderAndBadge},n.createElement(h.nB,{weight:"bold",element:"h2"},l),r&&n.createElement(w.Ay,{style:w.rY.minGray,count:a,maxCount:99})))}RequestAppModalSubsectionTitle.displayName="RequestAppModalSubsectionTitle";var C=a(0x6258badf),A=a(0xe747dd27),T=a(0x22a29f141),I=a(0x1ec68d6a3);let N=(0,a(0x1dfdeb1c8).A)("apps.approvals.requests.create fetcher",async(e,t,a)=>{try{let t=(0,C.A)(a,["reason"]),n=(0,A.VA)(t);return await e((0,T.apiCall)({method:"apps.approvals.requests.create",args:{...n,reason:a.note},reason:a.reason}))}catch(e){throw(0,I.default)({getState:t}).error(`API call to apps.approvals.requests.create
				with reason ${a.reason} failed, initiated by fetcher`),e}});N.meta={name:"appsApprovalsRequestsCreateFetcher",key:"createFetcherAppsApprovalsRequestsCreateFetcher",description:"apps.approvals.requests.create fetcher"};var M=a(0xd193e9b8),L=a(0xe374a1b1),O=a(0xcefdd6a2),F=a(0x243c0f3a9),D=a(0x19b809e18),P=a(0x207fb9b92),R=a(0x1c2358c11),B=a(0xf5bbd10a),W=a(0xbe2be077),V=a(0x20e80190e),H=a(0x9b971e7e),q=a(0x226892387),U=a(0x110d7b067),z=a(0x19561ce96),j=a(0x1fcbb004d),G=a(0x16ffed5ab);let $=new i.Ay("workflow_builder"),isStepFunction=e=>!!e,renderSlackAppIcon=(e,t)=>n.createElement(n.Fragment,null,t&&t(),n.createElement(x.z,{"data-qa":"app-icon",appId:e,alt:""})),RequestAppModal=({appId:e,appName:t,onCloseModal:a,backButtonRenderer:i,inline:m=!1})=>{let p=(0,B.A)({label:"step-library/request-app-modal"}),b=(0,q.d4)(H.JY),f=(0,q.d4)(W.k),g=a||l.A,_=(0,r.wA)(),y=!!i,x=(0,q.d4)(a=>t??(0,z.dJ)(a,e)?.app?.profile?.name)??"connector",v=(0,q.d4)(z.g0),[E,k]=(0,n.useState)(!1),[w,S]=(0,n.useState)(!1),[C,A]=(0,n.useState)(!1),[T,I]=(0,n.useState)(!1),[K,Y]=(0,n.useState)(!0),[Q,Z]=(0,n.useState)(!0),[J,X]=(0,n.useState)(""),{data:ee,loading:et,error:ea}=(0,R.L)({fetcher:D._,args:{reason:"step-library/request-app-modal",appId:e}}),en=ee?.functions??[],{triggerTypesWithAvailability:er,isLoading:el,isError:ei}=(0,M.c)({appId:e}),eo=er.map(e=>{let t=e.isAvailable?e.triggerType.serviceConfig?.function:void 0;return t?{...t,title:e.triggerType.label,id:e.triggerType.id}:t}).filter(isStepFunction),{onBlur:es,errorText:ec}=(0,P.K)({errorMessage:$.t("Please enter a reason"),isErrored:0===J.length}),ed=(0,n.useCallback)(e=>{X(e)},[]),eu=(0,n.useCallback)(()=>{m||_((0,j.O)()),g()},[_,g,m]),em=(0,n.useCallback)(()=>Y(!K),[K]),ep=(0,n.useCallback)(()=>Z(!Q),[Q]),eb=(0,n.useCallback)(e=>{_((0,G.M)({element:n.createElement(u.A,null,e)}))},[_]),ef=(0,n.useCallback)(async()=>{try{if(A(!0),I(!1),(await _((0,F.d)({appId:e,teamId:f?void 0:b,enterpriseId:f?b:void 0,reason:"step-library/request-app-modal"}))).ok)_((0,U.zE)({appId:e,resolution:"denied"})),eb($.t("{appName} was successfully denied",{appName:x})),A(!1),eu();else throw Error()}catch{p.error(Error(`failed to deny request for app: ${e}`),{appId:e}),I(!0)}},[_,e,f,b,eb,x,eu,p]),eg=(0,n.useCallback)(async()=>{try{if(S(!0),I(!1),(await _((0,O.i)({appId:e,teamId:f?void 0:b,enterpriseId:f?b:void 0,reason:"step-library/request-app-modal"}))).ok)_((0,U.zE)({appId:e,resolution:"approved"})),eb($.t("{appName} was successfully approved",{appName:x})),S(!1),eu();else throw Error()}catch{p.error(Error(`failed to approve request for app: ${e}`),{appId:e}),I(!0)}},[x,_,e,f,b,eb,eu,p]),eh=(0,n.useCallback)(async()=>{try{if(k(!0),I(!1),(await _(N({app:e,note:J,reason:"step-library/request-app-modal"}))).ok)_((0,U.p4)({appId:e})),eb($.t("Request submitted successfully")),k(!1),eu();else throw Error()}catch{p.error(Error(`failed to submit request for app: ${e}`),{appId:e}),I(!0)}},[_,e,J,eb,eu,p]),e_=$.t("Request {appName} steps",{appName:x}),ey=$.t("You need approval to use {appName} steps. Slackbot will send you a direct message when your request is processed.",{appName:x});eo.length>0&&en.length>0&&(e_=$.t("Request {appName} access",{appName:x}),ey=$.t("You need approval to use {appName}. Slackbot will send you a direct message when your request is processed.",{appName:x})),eo.length>0&&0===en.length&&(e_=$.t("Request {appName} triggers",{appName:x}),ey=$.t("You need approval to use {appName} triggers. Slackbot will send you a direct message when your request is processed.",{appName:x})),v&&(e_=$.t("Approve or Deny {appName} access",{appName:x}),ey=$.t("You need to approve or deny {appName}. Approving {appName} will allow you and other users on your team to use the {appName}. Denying {appName} will prevent you and other users on your team from using {appName}",{appName:x}));let ex=y?renderSlackAppIcon(e,i):renderSlackAppIcon(e);return n.createElement(L.v,{contentLabel:e,maxWidth:x.length>=24?"fit-content":void 0,onClose:g,shouldCloseOnOverlayClick:!0},n.createElement(V.rQ,null,n.createElement(V.Rc,{title:e_,icon:ex})),n.createElement(V.$m,null,n.createElement(V.qf,null,n.createElement(h.nB,null,ey),v?null:n.createElement(c.A,{text:$.t("Reason for the request"),htmlFor:"request-app-modal-reason"},n.createElement(d.A,{id:"request-app-modal-reason",type:"text",name:"name",value:J,onChange:ed,onBlur:es,errorText:ec,placeholder:$.t("Add a short business justification"),autoComplete:"off",focusOnMount:!0,"data-qa":"request-app-modal-reason__input",useInlineAlert:!0})),n.createElement(n.Fragment,null,n.createElement(RequestAppModalSubsectionTitle,{expand:K,onExpand:em,count:eo.length,showIconButtonAndBadge:en.length>0,label:$.t("Triggers")}),n.createElement(RequestAppModalSubsectionList,{appId:e,isLoading:el,listItems:eo,error:ei,expandListPane:K})),n.createElement(RequestAppModalSubsectionTitle,{expand:Q,onExpand:ep,count:en.length,showIconButtonAndBadge:eo.length>0,label:$.t("Steps")}),n.createElement(RequestAppModalSubsectionList,{appId:e,isLoading:et,listItems:en,error:!!ea,expandListPane:Q}),T&&n.createElement(o.Ay,{level:"warning",icon:"warning",align:"left",className:"margin_top_100"},$.t("Sorry, something went wrong. Try again in a moment.")))),n.createElement(V.jl,null,n.createElement(V.ox,null,n.createElement(s.Ay,{type:"outline",onClick:eu,"data-qa":"request-app-modal-cancel__button"},$.t("Cancel")),v?n.createElement(n.Fragment,null,n.createElement(s.lV,{type:"danger",loading:C,onClick:ef,"data-qa":"request-app-modal-deny__button","aria-label":$.t("Deny")},$.t("Deny")),n.createElement(s.lV,{loading:w,onClick:eg,"data-qa":"request-app-modal-approve__button","aria-label":$.t("Approve")},$.t("Approve"))):n.createElement(s.lV,{loading:E,onClick:eh,disabled:0===J.length,"data-qa":"request-app-modal-submit__button","aria-label":$.t("Submit")},$.t("Submit")))))};RequestAppModal.displayName="RequestAppModal"},0x4a312a6e:(e,t,a)=>{"use strict";a.d(t,{Jx:()=>WorkflowActionIcon});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x2501a2cee),i=a(0x210b99e76),o=a(0xe1644a69),s=a(0x1d9a37519),c=a(0x2a037c8a),d=a(0xa7a4ed65),u=a(0x1e9a6d1d),m=a(0x20cfa1dc2),p=a(0x210501b8f);let b=new r.Ay("workflow_builder"),SalesforceIcon=({iconSize:e,alt:t})=>n.createElement("img",{alt:t??b.t("Salesforce Icon",{ns:"data_sources"}),width:e||"100%",height:"auto",src:p}),WorkflowActionIcon=({name:e,type:t,iconSize:a,className:r,alt:i})=>{if(!e)return null;let o=a||void 0;return"slack"===e?n.createElement(l.Ah,{"data-qa":"slack-icon",name:"slack-logo-color",inline:!0,size:o}):"installed_apps_categories"===e?n.createElement(l.Ah,{"data-qa":"wrench-icon",name:"wrench",inline:!0,size:o}):t===c.M.External?n.createElement(SalesforceIcon,{iconSize:o,alt:i}):t===u.A.BuiltIn||t===u.A.Utility?getBuiltinIcon(e,o):t===d.Dd?n.createElement(l.Ah,{inline:!0,"data-qa":"discover-icon",name:"map",size:o}):t===c.M.Service||t===u.A.App||t===m._3.CONNECTOR||t===m._3.CUSTOM?n.createElement(s.z,{"data-qa":"app-icon",size:72,appId:e,imageClassName:r,width:a?Number(a):void 0,height:a?Number(a):void 0,alt:i}):n.createElement(l.Ah,{"data-qa":`${e}-icon`,name:e,inline:!0,size:o})};function getBuiltinIcon(e,t){let a=(0,i.m)(e);if(a&&"slack-logo"!==a)return n.createElement(l.Ah,{"data-qa":`${a}-icon`,name:a,inline:!0,size:t});let r=e.startsWith("builtins_")?e:`builtins_${e}`,s=(e=>{switch(e){case"builtins_channels":return"channel";case"builtins_forms":return"form";case"builtins_messages":return"message";case"builtins_users":return"user";case"builtins_canvas":return"canvas";case"builtins_list":case"builtins_lists":return"lists";case"builtins_sales_elevate":return"sales";case"builtins_salesforce":case"builtins_salesforce_channels":return"sf-record";case"builtins_slack_ai":return"einstein-filled";case"builtins_utilities":return"wrench";case"builtins_agentforce":return"agentforce";default:return"slack-logo"}})(r);return"builtins_slack_ai"===r?n.createElement(o.o,{inline:!0,"data-qa":"slack-ai-icon",type:"sparkles",useFilledIcon:!0,size:t}):"builtins_agentforce"===r?n.createElement(l.Ah,{inline:!0,"data-qa":"agentforce-icon",name:"agentforce-filled",size:t}):"builtins_ai_answer"===r?n.createElement(o.o,{inline:!0,"data-qa":"slack-ai-icon-unfilled",type:"sparkles",size:t}):n.createElement(l.Ah,{inline:!0,"data-qa":`${s}-icon`,name:s,size:t})}WorkflowActionIcon.displayName="WorkflowActionIcon",getBuiltinIcon.displayName="getBuiltinIcon"},0x194fe1f5f:(e,t,a)=>{"use strict";a.d(t,{s:()=>WorkflowDestinationSelect});var n=a(0xbad225b5),r=a(0x1407c6c2c),l=a(0x20482ad21),i=a(0x1e864b930),o=a(0x2264e6ea3),s=a(0x1d2cd7755),c=a(0x1ad596f5f),d=a(0x253c586a2),u=a(0x1ba35eb3b),m=a(0x668181b3),p=a(0x2772625d),b=a(0x1d62f3e69),f=a(0x1795d8821),g=a(0x2196ed249),h=a(0x16ed1b0dc),_=a(0xa985ed31),y=a(0x4f725d55),x=a(0xd2fa49d0);let v=new l.Ay("workflow_builder");function transformDataToOption(e){return{value:e.id,label:e.label,data:e}}function buildDefaultDestinationsLabel(e){let t={channels:v.t("channels",{ns:"enterprise_dashboard"}),threads:v.t("threads"),userGroups:v.t("user groups"),canvases:v.t("canvases"),lists:v.t("lists"),users:v.t("people",{ns:"emoji_keywords"}),teams:v.t("teams")},a=Object.keys(t).map(a=>e[a]?t[a]:void 0).filter(e=>void 0!==e);return v.t("Recent {destinations}",{destinations:(0,i.A)(a).join("")})}let WorkflowDestinationSelect=({elementId:e,className:t,label:a,value:l,hints:i,errors:E,placeholder:k,data:w,allowVariables:S,isDisabled:C=!1,isInvalid:A=!1,isRequired:T=!0,allowThreads:I=!1,allowUsers:N=!0,allowChannels:M=!0,allowUserGroups:L=!1,allowMessageContext:O=!1,allowTeams:F=!1,queryType:D=d.vK,searcherOptions:P,onChange:R,optionsLabel:B,workspaceFilterTeamId:W,selectKey:V,selectProps:H,onValueChange:q,renderSelectedOption:U,renderOption:z,processOptions:j,allowVariablesByType:G,ariaLabel:$,enforceStrictVariableTypeMatch:K,callbackId:Y})=>{let Q=(0,r.A)(),Z=(0,n.useMemo)(()=>{let e=[];return N&&(e.push(g.sD),e.push(f.TE.SlackTypesUserId),e.push(f.TE.SlackTypesUserEmail)),M&&(e.push(g.aL),e.push(f.TE.SlackTypesChannelId)),I&&e.push(g.Bp),L&&(e.push(g.MP),e.push(f.TE.SlackTypesUsergroupId)),O&&e.push(f.TE.SlackTypesMessageContext),F&&e.push(f.TE.SlackTypesTeamId),"canvas"===D&&e.push(f.TE.SlackTypesCanvasId),"lists"===D&&e.push(f.TE.SlackTypesListId),e},[N,M,I,L,O,F,D]),J=(0,n.useMemo)(()=>{let optionsReducer=(e,t)=>{if((Z.includes(t.type)&&!t.isHidden||G&&(0,u.Lm)({variable:t,parameter:{type:G},enforceStrictMatch:K}))&&e.push(transformDataToOption(t)),t.type===f.TE.Object&&t.objectProperties){let a=t.objectProperties.reduce(optionsReducer,[]);e.push(...a)}return e};return w.groups.reduce((e,t)=>{let a=t.data.reduce(optionsReducer,[]);if(0===a.length)return e;let n=t.label;return t.stepIndex&&(n=`${t.stepIndex}. ${n}`),e.push({label:n,options:a}),e},[])},[G,w.groups,Z,K]),X=(0,n.useMemo)(()=>{if(H?.selectedOption)return l;let e="string"==typeof l?(0,m.x)(w.list,l):void 0;return!e&&"string"==typeof l&&(0,p.cn)(l)&&(e=(0,b.x7)(l,f.TE.SlackTypesUserId)),e?transformDataToOption(e):l},[w.list,l,H]),ee=(0,n.useCallback)((e,t)=>{let a=[];if(S){let e=(0,c.A)(J,t,{fuzzyJumpLimit:20});e.length>0&&a.push(...e)}if(H){let e=H.processOptions();a.push(...e)}if(e.length>0&&!O){let t=buildDefaultDestinationsLabel({channels:M,threads:I,userGroups:L,users:N,canvases:"canvas"===D,teams:F,lists:"lists"===D});a.push({label:B||t,options:e})}return Promise.resolve(a)},[J,S,H,O,M,I,L,N,D,F,B]),et=(0,n.useCallback)((e,t)=>{if(!e)return void R({});let a=!!t.data,n=null;a?n=t.data?.type:(0,h.A)(e)?n=g.aL:(0,y.A)(e)?n=g.sD:(0,x.A)(e)?n=g.MP:(0,_.A)(e)?n=g.BA:(0,o.Ay)(e)&&(n=f.TE.SlackTypesTeamId),q&&q(e),n&&R({id:e,type:n,isDynamic:a})},[R,q]),ea=(0,n.useMemo)(()=>[...i||[],...H?.hints||[]],[i,H?.hints]),en=n.createElement(d.NV,{className:t,id:e||Q,queryType:D,searcherOptions:P,ariaLabel:$||v.t("channel or member dropdown menu"),onChange:et,value:X,placeholder:k,hints:ea,errors:E,isDisabled:C,isInvalid:A,isRequired:T,processOptions:j??ee,selectDataQa:"workflow-destination__select",selectKey:V,workspaceFilterTeamId:W,renderSelectedOption:U,renderOption:z,callbackId:Y});return a?n.createElement(s.A,{htmlFor:Q,text:a},en):en};WorkflowDestinationSelect.displayName="WorkflowDestinationSelect"},0x1d3dd4cbe:(e,t,a)=>{"use strict";a.d(t,{B:()=>l,e:()=>useWorkflowBuilderRendererContext});var n=a(0xbad225b5),r=a(0x1cbdfeceb);let l=(0,n.createContext)({updateRequiredContext:r.A,viewOnly:!1,updateParameterValue:r.A,onVariableMenuOpen:r.A,openFormSteps:[],triggerType:void 0,externalTriggerSalesforceOrgId:void 0,validateAsyncValue:r.A,hasValidAppPinBuiltInMessage:!0,workflowSummaryStepPrecedes:!1,formStepPrecedesCurrentStep:!1,previousStepId:"",messagePostedTriggerPrivateChannelAccess:void 0,messagePostedTriggerPrivateChannelTeamIds:void 0,aiStepPrivateChannelAccess:void 0,aiStepPrivateChannelTeamIds:void 0}),useWorkflowBuilderRendererContext=()=>{let e=(0,n.useContext)(l);if(void 0===e)throw Error("useWorkflowBuilderRendererContext must be used within WorkflowBuilderRendererContext");return e}},0x1d1a513a:(e,t,a)=>{"use strict";a.d(t,{u:()=>useSlackConnectPrefsWorkflows});var n=a(0xbad225b5),r=a(0x12cc25ec2),l=a(0x20adb28cd),i=a(0x358bddfc),o=a(0x197981788),s=a(0x226892387),c=a(0x1887ed0ea);let useSlackConnectPrefsWorkflows=(e,t,a)=>{let d=(0,s.d4)(a=>t||(0,l.NN)(a,e)),u=d?.hermes_triggers_trippable_by_slack_connected_teams,m=(0,s.d4)(c.M7),p=(0,s.d4)(t=>void 0!==a?a.is_restricted:(0,l.lW)(t,e)),b=(0,s.d4)(t=>void 0!==a?a.restricted_by_connector_steps_only:(0,l.Yn)(t,e)),f=(0,n.useMemo)(()=>(0,o.Ul)(p??!1,b??!1),[p,b]);return{isTeamValidSCWorkflowTarget:(0,n.useCallback)(e=>{if(!d)return!0;if(m){if(f===i.U.FULL_RESTRICTED)return!1;if(f===i.U.RESTRICTED_BY_ONLY_CONNECTORS)switch(d.hermes_triggers_trippable_by_slack_connected_teams_mcp){case r.HF.NONE:case r.HF.SAFE:return d.allowed_teams_with_3p_connectors?.includes(e);case r.HF.SAFE_AND_3P:return!d.allowed_teams?.includes(e)&&!d.restricted_teams?.includes(e);default:return!0}switch(d?.hermes_triggers_trippable_by_slack_connected_teams_mcp){case r.HF.NONE:return d.allowed_teams.includes(e)||d.allowed_teams_with_3p_connectors?.includes(e);case r.HF.SAFE:case r.HF.SAFE_AND_3P:return!d.restricted_teams.includes(e);default:return!0}}return d.hermes_triggers_trippable_by_slack_connected_teams?!d.restricted_teams.includes(e):d.allowed_teams.includes(e)||(d.allowed_teams_with_3p_connectors?.includes(e)??!1)},[m,d,f]),workflowRestrictedStatus:f,isTrippableByAnySlackConnectedTeamByPrefs:(0,n.useMemo)(()=>m?!!d?.hermes_triggers_trippable_by_slack_connected_teams_mcp&&d?.hermes_triggers_trippable_by_slack_connected_teams_mcp!==r.HF.NONE||(d?.allowed_teams?.length??0)+(d?.allowed_teams_with_3p_connectors?.length??0)>0:!!u||(d?.allowed_teams?.length??0)+(d?.allowed_teams_with_3p_connectors?.length??0)>0,[m,u,d?.allowed_teams?.length,d?.allowed_teams_with_3p_connectors?.length,d?.hermes_triggers_trippable_by_slack_connected_teams_mcp])}}},0xd193e9b8:(e,t,a)=>{"use strict";a.d(t,{c:()=>n.c});var n=a(0x1887f3464)},0x1887f3464:(e,t,a)=>{"use strict";a.d(t,{c:()=>useTriggerTypeList});var n=a(0xbad225b5),r=a(0x51915942),l=a(0x1c2358c11),i=a(0x1c7cb6e50);let useTriggerTypeList=({appId:e,skip:t=!1}={})=>{let{data:a,loading:o,error:s}=(0,l.L)({fetcher:r.G,args:{reason:"fetching-workflow-trigger-types-list-wfb",appId:e},skip:t});return{triggerTypesWithAvailability:(0,n.useMemo)(()=>a?.trigger_types?.map(({trigger_type:e,is_available_to_user:t,private_channel_access:a,private_channel_message:n,private_channel_team_ids:r})=>({triggerType:(0,i.t)(e,0),isAvailable:(0,i.t)(t),privateChannelAccess:a,privateChannelMessage:n,privateChannelTeamIds:r}))??[],[a?.trigger_types]),isLoading:o,isError:!!s}}},0xe374a1b1:(e,t,a)=>{"use strict";a.d(t,{v:()=>WorkflowBuilderModalWrapper});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x145d46a61),o=a(0x20e80190e),s=a(0x226892387),c=a(0x1f1e5460f),d=a.n(c);let WorkflowBuilderModalWrapper=({children:e,contentLabel:t,describedby:a,maxWidth:r,modalClassName:c,onAfterClose:u,onClose:m,shouldCloseOnOverlayClick:p,overlayClassName:b,...f})=>{let g=(0,s.d4)(i.tQ);return n.createElement(o.aF,{className:c,centered:!g,contentLabel:t,dataQa:"workflow-builder-modal-wrapper",describedby:a,maxWidth:r,onAfterClose:u,onClose:m,overlayClassName:l()({[d().modalOverlay]:g,...b?{[b]:!0}:{}}),shouldCloseOnOverlayClick:p,...f},e)};WorkflowBuilderModalWrapper.displayName="WorkflowBuilderModalWrapper"},0xbe3df8c1:(e,t,a)=>{"use strict";a.d(t,{J:()=>i});var n=a(0x157c40d29),r=a(0x11c82607b),l=a(0x212b4c697);let i=(0,r.Ay)("Get Function OAuth",async(e,t,{appId:a,workflowId:r,functionId:i,step:o,trigger:s})=>{let c=await e((0,n.H)({appId:a,workflowId:r,step:o,trigger:s,reason:"workflow_builder/workflows_get_function_auth"}));if(!c.ok)throw Error("Response from appsExternalGetFunctionAuthFetcher not ok");let d=Object.values(c.providers).map(({provider_name:e="",provider_key:t="",valid_tokens:n=[]})=>({appId:a,functionId:i,providerKey:t,providerName:e,validTokens:n.map(({user_id:e="",external_user_id:t="",external_token_id:a="",is_default:n})=>({userId:e,externalUserId:t,externalTokenId:a,isDefault:n}))}));e((0,l.BX)({auths:d}))});i.meta={name:"getFunctionAuth",key:"createThunkGetFunctionAuth",description:"Get Function OAuth"}},0x24129bf7:(e,t,a)=>{"use strict";a.d(t,{V:()=>FormPreview});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x11a296110),i=a(0x1dde3f5ab),o=a(0x113cdbbd7),s=a(0x944e06df),c=a(0x20e80190e),d=a(0x221574985),u=a.n(d);let m=new r.Ay("workflow_builder"),FormPreview=({formTitle:e,formQuestions:t,toggleShowFullPreview:a,onClose:r,formBackButtonLabel:d})=>{let p=(0,n.useCallback)(()=>{a(),r()},[r,a]);return n.createElement(c.dW,{closeModal:p},n.createElement(c.rQ,null,n.createElement(c.Rc,{title:e})),n.createElement(c.$m,null,n.createElement(c.qf,null,n.createElement(s.A,{blocks:(0,i.Jf)(t),blocksContainerContext:o.pi.wfb_preview,container:o.pi.wfb_preview,remountOnUpdate:!0,className:u().blocksRenderer}))),n.createElement(c.jl,null,n.createElement("div",{className:u().footerText},m.t("This is just a preview")),n.createElement(c.ox,null,n.createElement(l.Ay,{type:"outline",onClick:a},d||m.t("Back to Editing")))))};FormPreview.displayName="FormPreview"},0x52038dd0:(e,t,a)=>{"use strict";a.d(t,{z:()=>useOAuthInputParameterRenderer});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x1cbdfeceb),i=a(0x120c268ad),o=a.n(i),s=a(0x6affae29),c=a(0x20482ad21),d=a(0x2b7f0bcc),u=a(0x11a296110),m=a(0x1d2cd7755),p=a(0xa5dbe09b),b=a(0xb64e73ea),f=a(0x145d46a61),g=a(0x1795d8821),h=a(0x226892387),_=a(0x810a3ce9),y=a.n(_);let{BUILDER:x,END_USER:v}=g.x,{LAST_INTERACTOR:E}=g.gx,k=new c.Ay("workflow_builder");function OAuthAccountDelegationRadioGroup({providerName:e,userId:t,credentialSource:a,userContextSource:r,legendText:l,onUpdateCredentials:i,isFunctionFormWrapped:s,hasDynamicInputs:c,showDeprecatedAuthOption:d}){let u=(0,h.d4)(f.$T),m=u?k.t("Person who last interacted with the workflow"):k.t("The person who last interacted with the workflow"),_=u?k.t("The workflow will use the accounts of people using the workflow to connect to {providerName}. They\u2019ll have to connect their account when they use the workflow, if they haven\u2019t already.",{providerName:e}):k.t("The workflow connects to {providerName} using the accounts of people using the workflow. They\u2019ll have to connect their account, if they haven\u2019t already.",{providerName:e}),w=u?k.t("The workflow will use the accounts of people using the workflow. They\u2019ll have to connect their account when they use the workflow, if they haven\u2019t already."):k.t("The workflow uses the accounts of people using the workflow. They\u2019ll have to connect their account, if they haven\u2019t already."),S=e?_:w,C=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,n.createElement("div",{className:"bold"},m),n.createElement("div",{className:o()(y().smallText,"sk_foreground_max")},S)),[m,S]),A=k.t("The person using the workflow"),T=k.t("Individuals will need the right permissions in {providerName}",{providerName:e}),I=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,n.createElement("div",{className:y().callerAuthLabelText},A,d&&n.createElement("span",{className:o()("c-app_badge",y().deprecatedBadge)},"DEPRECATED")),n.createElement("div",{className:o()(y().smallText,"sk_foreground_max")},T)),[A,d,T]),N=!!t,M=e?k.t("Connect your {providerName} account",{providerName:e}):k.t("Connect your account"),L=k.t("You\u2019ll be directed to {providerName} to authenticate",{providerName:e}),O=e?L:k.t("You\u2019ll be directed to the company to authenticate"),F=u?k.t("The workflow will use this account to connect to {providerName} every time, no matter who uses the workflow.",{providerName:e}):k.t("Workflow connects to {providerName} using this account every time, no matter who interacts with the workflow.",{providerName:e}),D=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,n.createElement("div",{className:"bold display_flex align_items_center no_min_width"},N?n.createElement("span",{className:y().userId},t):n.createElement("span",null,M)),n.createElement("div",{className:o()(y().smallText,"sk_foreground_max")},N?F:O)),[N,t,M,F,O]),P=(0,n.useCallback)(({credentialSource:e,userContextSource:t})=>()=>{i({credentialSource:e,userContextSource:t??r})},[i,r]);(0,n.useEffect)(()=>{d&&i({credentialSource:a,userContextSource:g.gx.LAST_INTERACTOR})},[d,a,i]);let R=s||c;return n.createElement(p.A,{legendText:l,className:"no_margin",legendClassNames:"no_margin"},n.createElement("div",{className:y().oauthGroupBorder},n.createElement(b._,{label:C,checked:a===v&&r===E||!!R,onChange:P({credentialSource:v,userContextSource:E}),disabled:R}),d&&n.createElement(b._,{label:I,checked:a===v&&!r,disabled:!0,onChange:P({credentialSource:v})}),!R&&n.createElement(b._,{label:D,disabled:!N,checked:a===x,onChange:P({credentialSource:x})})))}OAuthAccountDelegationRadioGroup.displayName="OAuthAccountDelegationRadioGroup";var w=a(0x1f2e22823),S=a(0x6e0e2fb2),C=a(0x20e80190e);let{BUILDER:A,END_USER:T}=g.x,I=new c.Ay("workflow_builder");function OAuthAccountDelegationModal({providerName:e,userId:t,credentialSource:a,userContextSource:r,requiredCredentialSource:l,onClose:i,onUpdateCredentials:c,onUpdateOAuth:p,onAddOAuth:b,isFunctionFormWrapped:g,hasDynamicInputs:_,showDeprecatedAuthOption:x,isFunctionForKnowledgeSource:v}){let E=(0,h.d4)(f.$T),k=(0,h.d4)(f.oI),[N,M]=(0,n.useState)({credentialSource:a,userContextSource:r}),[L,O]=(0,n.useState)(null),[F,D]=(0,n.useState)(S.r.FINISHED),P=E?I.t("Account for workflow use"):I.t("{providerName} account for workflow use",{providerName:e}),R=e?I.t("{providerName} account for workflow building",{providerName:e}):I.t("Account for workflow building"),B=(0,n.useMemo)(()=>n.createElement("span",{className:"bold"},E?I.t("Account for workflow building"):R),[R,E]),W=(0,n.useMemo)(()=>n.createElement("span",{className:"bold"},k?I.t("Account for workflow building and workflow use"):"Account for workflow building and workflow use"),[k]),V=(0,n.useMemo)(()=>k?I.t("This account lets Slack connect to the external service while you\u2019re building and using the workflow."):"This account lets Slack connect to the external service while you\u2019re building and using the workflow.",[k]),H=E?I.t("This account lets Slack connect to {providerName} while you\u2019re building, so you can use {providerName} steps in the workflow.",{providerName:e}):I.t("This account lets Slack connect to {providerName}, so you can use {providerName} steps in the workflow.",{providerName:e}),q=E?I.t("This account lets Slack connect to the external service while you\u2019re building, so you can use their steps in the workflow."):I.t("This account lets Slack connect to the company, so you can use their steps in the workflow."),U=e?H:q,z=(0,n.useCallback)(()=>{c(N)},[c,N]),j=(0,n.useMemo)(()=>n.createElement(m.A,{text:P}),[P]),G=I.t("Please update this step to use the person who last interacted with the workflow."),$=I.t("Please update this step to use your account, not the person who last interacted with the workflow."),K=e?I.t("Could not connect to {providerName}. Please try again.",{providerName:e,fallbackHashNs:"oauth_account_picker"}):I.t("Could not connect. Please try again.",{fallbackHashNs:"oauth_account_picker"}),Y=(0,n.useMemo)(()=>{if(L)return K;if(!l||N.credentialSource===l)return null;switch(N.credentialSource){case A:return G;case T:return $;default:(0,s.Kh)(N.credentialSource)}},[L,K,G,$,l,N.credentialSource]),Q=!!t,Z=(0,n.useCallback)(e=>n.createElement(u.Ay,{...e,type:Q?"outline":"primary"}),[Q]),J=(0,n.useCallback)(async()=>{try{O(null),D(S.r.IN_FLIGHT),await b()}catch(e){O(e)}finally{D(S.r.FINISHED)}},[b]),X=e?I.t("{providerName} accounts",{providerName:e}):I.t("Accounts");return n.createElement(C.dW,{centered:!0,closeModal:i},n.createElement(C.rQ,null,n.createElement(C.Rc,{title:X})),n.createElement(C.$m,null,Y&&n.createElement(C.qf,{className:"margin_bottom_100"},n.createElement(d.Ay,{type:"boxed",level:"error"},Y)),n.createElement(C.qf,null,v?n.createElement(m.A,{text:W,subtext:V}):n.createElement(m.A,{text:B,subtext:U}),n.createElement("div",{className:o()(y().oauthGroupBorder,"margin_bottom_125 padding_75",{margin_top_100:v})},n.createElement(w.v,{onUpdateOAuth:Q?p:J,providerName:e,renderButton:Z,loadingStatus:F,userId:t,hasValidOAuth:Q}))),!v&&n.createElement(C.qf,null,n.createElement(OAuthAccountDelegationRadioGroup,{providerName:e,userId:t,credentialSource:N.credentialSource,userContextSource:N?.userContextSource,legendText:j,onUpdateCredentials:M,showDeprecatedAuthOption:x,isFunctionFormWrapped:g,hasDynamicInputs:_}))),n.createElement(C.jl,null,n.createElement(C.ox,null,n.createElement(u.Ay,{"data-qa":"oauth-account-delegation-modal-cancel",type:"outline",onClick:i},I.t("Cancel")),n.createElement(u.Ay,{"data-qa":"oauth-account-delegation-modal-save",type:"primary",disabled:!!Y,onClick:z},I.t("Save")))))}OAuthAccountDelegationModal.displayName="OAuthAccountDelegationModal";var N=a(0x1853f0e7c),M=a(0x2501a2cee),L=a(0x17c322a5b),O=a.n(L);let F=new c.Ay("workflow_builder");function OAuthAccountSelect({providerName:e,userId:t,credentialSource:a,userContextSource:r,loadingStatus:l,hasValidOAuth:i,isReadOnly:o=!1,onUpdateOAuth:s,isTriggerSegment:c,showDeprecatedAuthOption:d,isFunctionFormWrapped:u,isFunctionForKnowledgeSource:m}){return l===S.r.FINISHED&&(i||a===g.x.END_USER)?n.createElement(ConnectedOAuthAccountSelect,{userId:t,providerName:e,loadingStatus:l,credentialSource:a,userContextSource:r,hasValidOAuth:i,isReadOnly:o,onUpdateOAuth:s,isTriggerSegment:c,showDeprecatedAuthOption:d,isFunctionFormWrapped:u,isFunctionForKnowledgeSource:m}):n.createElement(w.v,{loadingStatus:l,providerName:e,onUpdateOAuth:s})}function ConnectedOAuthAccountSelect({userId:e,providerName:t,credentialSource:a,userContextSource:r,isReadOnly:l,onUpdateOAuth:i,isTriggerSegment:s,showDeprecatedAuthOption:c,isFunctionFormWrapped:d,isFunctionForKnowledgeSource:m}){let p=F.t("{providerName} account used for this step",{providerName:t}),b=F.t("Account used for this step");s&&(p=F.t("{providerName} account used",{providerName:t}),b=F.t("Account used"));let f=t?p:b,h=(0,n.useMemo)(()=>r?F.t("The person who last interacted with the workflow"):F.t("The person using the workflow"),[r]),_=(0,n.useMemo)(()=>a===g.x.END_USER||d?n.createElement("div",{className:!c||r||m?void 0:O().labelWithError},n.createElement("span",{className:O().subLabel},h)):n.createElement("div",null,n.createElement("span",{className:O().subLabel},e),n.createElement("span",{className:O().checkIcon},n.createElement(M.Ah,{name:"check-circle-filled",color:(0,N.HK)("DT_COLOR_CONTENT_HGL_2"),size:"inherit"}))),[a,d,e,c,r,m,h]);return n.createElement("div",{className:o()(O().oauthAccountContainer)},n.createElement("div",{className:"display_flex flex_direction_column justify_content_between"},n.createElement("div",{className:"bold"},f),_),!l&&n.createElement(u.Ay,{size:"small",type:"outline",onClick:i},F.t("Edit")))}OAuthAccountSelect.displayName="OAuthAccountSelect",ConnectedOAuthAccountSelect.displayName="ConnectedOAuthAccountSelect";var D=a(0x1729ca3b1),P=a(0x135b7b386),R=a(0x157b4a886),B=a(0x1fcbb004d),W=a(0x46dbff89);let{BUILDER:V,END_USER:H}=g.x,q=[P.wo,P.Id,P.Nn];function SlackFunctionOAuthInput({appId:e,oAuthDetails:t,value:a,parameter:r,loadingStatus:i,workflowAuthStrategy:o,hasDynamicInputs:s,onAddOAuth:c,onSelectOAuth:d,onChange:u,isTriggerSegment:m,isFunctionFormWrapped:p,isFunctionForKnowledgeSource:b,isOAuthTokenInvalid:f}){let{providerName:g="",validTokens:h}=t??{},[_,y]=(0,n.useState)(!1),x=(0,n.useCallback)(()=>{c(),y(!0)},[c]);if(i!==S.r.FINISHED)return n.createElement("div",{className:"margin_bottom_150"},n.createElement(w.v,{loadingStatus:i,providerName:g,onUpdateOAuth:l.A}));let v=!h?.length&&a&&!!a.external_token_id;return!h?.length&&s||v?n.createElement("div",{className:"margin_bottom_50"},n.createElement(w.v,{loadingStatus:i,providerName:g,onUpdateOAuth:x,isOAuthTokenInvalid:f,appId:e})):n.createElement(SlackFunctionOAuthInputInternal,{appId:e,oAuthDetails:t,value:a,parameter:r,loadingStatus:i,workflowAuthStrategy:o,hasDynamicInputs:s,onAddOAuth:c,onSelectOAuth:d,onChange:u,isTriggerSegment:m,isFirstConnection:_,isFunctionFormWrapped:p,isFunctionForKnowledgeSource:b})}function SlackFunctionOAuthInputInternal({appId:e,oAuthDetails:t,value:a,parameter:l,loadingStatus:i,hasDynamicInputs:o,workflowAuthStrategy:s,onAddOAuth:c,onSelectOAuth:d,onChange:u,isTriggerSegment:m,isFirstConnection:p,isFunctionFormWrapped:b,isFunctionForKnowledgeSource:f}){let h=(0,r.wA)(),{functionId:_,providerKey:y,providerName:x="",validTokens:v=[]}=t??{},E=!!a?.external_token_id,{externalTokenId:k,externalUserId:w}=(0,n.useMemo)(()=>v.find(e=>e.isDefault)||v.find(e=>e.externalTokenId&&e.externalTokenId===a?.external_token_id)||v[0]||{},[v,a?.external_token_id]),S=(0,n.useMemo)(()=>"end_user_only"===s||!!l?.require_end_user_auth,[s,l?.require_end_user_auth]),C=(0,n.useMemo)(()=>S?H:m?V:void 0,[S,m]),A=(0,n.useMemo)(()=>a?.credential_source?a.credential_source:C?C:q.includes(e)?V:H,[a?.credential_source,C,e]),T=(0,n.useMemo)(()=>A===V&&!!S||A===H&&!!m,[A,S,m]),I=(0,n.useMemo)(()=>!!v.length||A===H,[v,A]),N=a&&!a?.user_context_source,M=(0,n.useRef)(N),L=(0,n.useMemo)(()=>{if(!N&&!f)return a?.user_context_source??g.gx.LAST_INTERACTOR},[N,f,a?.user_context_source]),O=(0,n.useMemo)(()=>!!o||!!T||!!M.current||!S,[T,o,M,S]),F=(0,n.useMemo)(()=>!N&&!T&&o&&S,[T,o,S,N]),D=(0,n.useCallback)(e=>{if(a?.external_token_id===e?.external_token_id)return!1;let t=v.find(e=>e.externalTokenId===a?.external_token_id),n=v.find(t=>t.externalTokenId===e?.external_token_id);return!(!t||t?.externalUserId&&n?.externalUserId&&t.externalUserId===n.externalUserId)},[v,a?.external_token_id]),P=(0,n.useCallback)(e=>{e.external_token_id&&d(e.external_token_id);let t={shouldInvalidateDependentInputs:D(e)};(e.credential_source!==a?.credential_source||e?.external_token_id!==a?.external_token_id||e?.user_context_source!==a?.user_context_source)&&u(l,e,void 0,t)},[D,d,u,l,a]),R=(0,n.useCallback)(()=>{h((0,W.q)({element:n.createElement(ConnectedOAuthAccountDelegationModal,{functionId:_,providerKey:y,providerName:x,credentialSource:A,userContextSource:L,requiredCredentialSource:C,showDynamicInputsOnlyModal:F,onSave:P,onAddOAuth:c,isTriggerSegment:m,showDeprecatedAuthOption:M.current,isFunctionFormWrapped:b,isFunctionForKnowledgeSource:f}),name:"oauth-account-delegation-modal",isStackable:!0}))},[h,_,y,x,A,L,C,F,P,c,m,b,f]),B=(0,n.useMemo)(()=>!a||!a.external_token_id&&!!k||!!k&&!v.some(({externalTokenId:e})=>e===a?.external_token_id),[k,v,a]);return(0,n.useEffect)(()=>{if((!E||p)&&B&&I){let e={external_token_id:k,credential_source:A,user_context_source:L},t={shouldInvalidateDependentInputs:D(e)};u(l,e,void 0,t)}},[A,L,k,I,p,B,E,S,u,l,D]),n.createElement("div",{className:"margin_bottom_150"},n.createElement(OAuthAccountSelect,{hasValidOAuth:I,providerName:x,userId:w,credentialSource:A,userContextSource:L,loadingStatus:i,isReadOnly:!O,onUpdateOAuth:R,isTriggerSegment:m,showDeprecatedAuthOption:M.current,isFunctionFormWrapped:b,isFunctionForKnowledgeSource:f}))}function ConnectedOAuthAccountDelegationModal({functionId:e,providerKey:t,providerName:a,credentialSource:l,userContextSource:i,showDynamicInputsOnlyModal:o,requiredCredentialSource:s,onAddOAuth:c,onSave:d,isTriggerSegment:u,showDeprecatedAuthOption:m,isFunctionFormWrapped:p,isFunctionForKnowledgeSource:b}){let f=(0,r.wA)(),g=useOAuthTokenStateHook({functionId:e,providerKey:t}),h=g(),_=(0,n.useCallback)(()=>{f((0,B.O)())},[f]),[y,x]=(0,n.useState)(()=>{let e=h.find(({isDefault:e})=>e);return(e||h[0])?.externalTokenId}),v=!!y;(0,n.useEffect)(()=>{!v&&h.length&&x(h[0]?.externalTokenId)},[v,h]);let E=(0,n.useMemo)(()=>h.find(e=>e.externalTokenId===y),[h,y]),k=(0,n.useCallback)(e=>t=>Promise.resolve().then(()=>e(t)),[]),w=(0,n.useCallback)(()=>{f((0,W.q)({element:n.createElement(D.W,{selectedAuth:E,providerName:a,onClose:_,onAddOAuth:c,onSelectOAuth:k(x),useOAuthTokenState:g}),name:"oauth-account-select-modal",isStackable:!0}))},[f,E,a,_,c,k,g,x]),S=(0,n.useCallback)(e=>{d(e),u||_()},[d,_,u]),C=(0,n.useCallback)(e=>{S({credential_source:e.credentialSource,external_token_id:y,user_context_source:e?.userContextSource})},[S,y]),A=(0,n.useCallback)(()=>{S({credential_source:l,external_token_id:y,user_context_source:i})},[S,l,i,y]);return((0,n.useEffect)(()=>{u&&null!==y&&A()},[u,y,A]),u)?n.createElement(D.W,{providerName:a,onClose:_,onAddOAuth:c,onSelectOAuth:k(x),useOAuthTokenState:g}):n.createElement(OAuthAccountDelegationModal,{providerName:a,userId:E?.externalUserId,credentialSource:l,userContextSource:i,requiredCredentialSource:s,onUpdateCredentials:C,onClose:_,onUpdateOAuth:w,showDeprecatedAuthOption:m,onAddOAuth:c,isFunctionFormWrapped:p,hasDynamicInputs:o,isFunctionForKnowledgeSource:b})}function useOAuthTokenStateHook({functionId:e,providerKey:t}){return(0,n.useMemo)(()=>function(){return(0,h.d4)(a=>e&&t&&(0,R.JG)(a,{functionId:e,providerKey:t})?.validTokens||[])},[e,t])}SlackFunctionOAuthInput.displayName="SlackFunctionOAuthInput",SlackFunctionOAuthInputInternal.displayName="SlackFunctionOAuthInputInternal",ConnectedOAuthAccountDelegationModal.displayName="ConnectedOAuthAccountDelegationModal";var U=a(0xf5bbd10a),z=a(0x212b4c697),j=a(0x1a7c0453a);function OAuth2InputParameterRenderer({oAuthDetails:e,parameter:t,value:a,providerKey:l,appId:i,functionId:o,workflowId:s,loadingStatus:c,hasDynamicInputs:d,workflowAuthStrategy:u,onChange:m,isTriggerSegment:p,isFunctionFormWrapped:b,isFunctionForKnowledgeSource:f,isOAuthTokenInvalid:g}){let h=(0,r.wA)(),_=(0,U.A)(),y=(0,n.useCallback)(async()=>{if(!l)throw _.error("Missing provider key"),Error("Missing provider key");await h((0,j.N)({appId:i,providerKey:l,functionId:o,workflowId:s,reason:"workflow_builder/workflows_update_function_oauth"}))},[h,_,i,l,o,s]),x=(0,n.useCallback)(e=>Promise.resolve().then(()=>{l?h((0,z.RV)({functionId:o,providerKey:l,externalTokenId:e})):_.error("Missing provider key")}),[h,_,o,l]);return n.createElement(SlackFunctionOAuthInput,{key:t.name,parameter:t,value:a,loadingStatus:c,hasDynamicInputs:d,oAuthDetails:e,onChange:m,onAddOAuth:y,onSelectOAuth:x,appId:i,workflowAuthStrategy:u,isTriggerSegment:p,isFunctionFormWrapped:b,isFunctionForKnowledgeSource:f,isOAuthTokenInvalid:g})}function useOAuthInputParameterRenderer({appId:e,workflowId:t,functionId:a,functionAuths:r,loadingStatus:l,hasDynamicInputs:i,workflowAuthStrategy:o,onChange:s,isTriggerSegment:c,isFunctionFormWrapped:d,isFunctionForKnowledgeSource:u,isOAuthTokenInvalid:m}){return(p,b)=>{let f=p.oauth2_provider_key,g=f?r.find(e=>e.providerKey===f):void 0;return n.createElement(OAuth2InputParameterRenderer,{appId:e,functionId:a,workflowId:t,parameter:p,providerKey:f,value:b,loadingStatus:l,hasDynamicInputs:i,oAuthDetails:g,workflowAuthStrategy:o,onChange:s,isTriggerSegment:c,isFunctionFormWrapped:d,isFunctionForKnowledgeSource:u,isOAuthTokenInvalid:m})}}OAuth2InputParameterRenderer.displayName="OAuth2InputParameterRenderer",useOAuthInputParameterRenderer.displayName="useOAuthInputParameterRenderer"},0x4fbb276b:(e,t,a)=>{"use strict";a.d(t,{v:()=>useSlackFunctionFormOAuth});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x6e0e2fb2),i=a(0xbe3df8c1),o=a(0x226892387),s=a(0x212b4c697),c=a(0x157b4a886);let d=[];function useFunctionAuths(e,t,a,u,m){let p=(0,r.wA)(),[b,f]=(0,n.useState)(l.r.NOT_STARTED);return(0,n.useEffect)(()=>(m(()=>{f(l.r.IN_FLIGHT),p((0,i.J)({appId:e,workflowId:t,functionId:a,step:u})).then(()=>{f(l.r.FINISHED)}).catch(()=>{f(l.r.ERROR)})})||f(l.r.FINISHED),()=>{p((0,s.RZ)()),f(l.r.NOT_STARTED)}),[]),{functionAuths:(0,o.d4)(t=>{if(b===l.r.FINISHED){let n=(0,c.rl)(t,{appId:e,functionId:a});if(n.length)return n}return d}),loadingStatus:b}}var u=a(0x52038dd0),m=a(0x1795d8821),p=a(0x19561ce96);function useSlackFunctionFormOAuth({stepId:e,appId:t,functionId:a,inputParameters:r=[],configuredInputs:l,workflowId:i,onChange:s,isFunctionFormWrapped:c,isOAuthTokenInvalid:d,isFunctionForKnowledgeSource:b}){let f=(0,o.d4)(e=>(0,p.TI)(e,t)),g=(0,n.useMemo)(()=>f?.workflowAuthStrategy,[f]),h=(0,n.useMemo)(()=>({id:e,functionId:a,inputs:l,type:"function"}),[e,a,l]),_=r.filter(({type:e})=>e===m.HN.SlackTypesCredentialOauth2),y=(0,n.useMemo)(()=>r.some(e=>"dynamic_options"in e&&void 0!==e.dynamic_options),[r]),{functionAuths:x,loadingStatus:v}=useFunctionAuths(t,i,a,h,(0,n.useCallback)(e=>{if(_.length)return e(),!0},[_]));return{renderOAuth2InputParameter:(0,u.z)({appId:t,workflowId:i,functionId:a,functionAuths:x,loadingStatus:v,onChange:s,hasDynamicInputs:y,workflowAuthStrategy:g,isFunctionFormWrapped:c,isFunctionForKnowledgeSource:b,isOAuthTokenInvalid:d}),functionAuths:x,loadingStatus:v}}},0x210b99e76:(e,t,a)=>{"use strict";a.d(t,{m:()=>getStepIcon});let n=new Map([["open_form","form"],["send_message","message"],["reply_in_thread","threads"],["send_ephemeral_message","message"],["update_channel_topic","channel"],["create_channel","channel"],["invite_user_to_channel","channel"],["channel start message","channel"],["delay","hourglass"],["archive_channel","channel"],["unarchive_channel","channel"],["create_usergroup","user-groups"],["add_user_to_usergroup","user-groups"],["add_pin","channel"],["remove_pin","channel"],["remove_user_from_usergroup","user-groups"],["send_dm","message"],["create_channel_section","channel"],["add_channel_to_channel_section","channel"],["find_channels_by_keywords","channel"],["add_channel_list_to_section","channel"],["select_channels","channel"],["add_bookmark","bookmark"],["add_channel_manager","channel"],["create_list","lists"],["lists_fetch_columns","lists"],["list_add_record","lists"],["add_list_record","lists"],["share_list_users","lists"],["share_list_channels","lists"],["share_list","lists"],["read_list_record","lists"],["delete_list_record","lists"],["update_list_record","lists"],["copy_list","lists"],["lists_activity_feed","lists"],["send_task_list_alert","lists"],["create_items_due_summary","lists"],["canvas_create","canvas"],["canvas_update_content","canvas"],["canvas_update_content_v2","canvas"],["channel_canvas_create","canvas"],["add_canvas_to_channel_tab","canvas"],["share_canvas","canvas"],["share_canvas_in_thread","canvas"],["find_dm_or_mpdm_channel_canvas","canvas"],["canvas_copy","canvas"],["canvas_fetch_variables","canvas"],["canvas_update_variables","canvas"],["canvas_fetch_header_sections","canvas"],["send_to_sales_home","sales"],["send_to_my_sales_home","sales"],["send_summary_to_sales_home","sales"],["send_summary_to_my_sales_home","sales"],["send_to_record_channel","sales"],["create_record_channel","sales"],["lookup_record_channel","sales"],["lookup_channel_record","sales"],["send_to_salesforce_app","notifications"],["send_to_my_salesforce_app","notifications"],["add_reaction","emoji"],["remove_reaction","emoji"],["summarize_channel","ai-summary"],["search_summary","ai-summary"],["read_message","message"],["share_message","share-message"],["switch_step","branch"],["case_step","add-branch"],["loop_step","refresh"],["ask_agentforce","agentforce-filled"],["add_agent_to_channel","agentforce-filled"],["ai_answer","ai-sparkle"],["lookup_entities","search"],["lookup_from_list","search-files"]]),r=new Set(["send_to_record_channel","create_record_channel","lookup_record_channel","lookup_channel_record"]);function getStepIcon(e){let t=e?n.get(e):void 0;return e&&r.has(e)?"sf-record":t??"slack-logo"}},0x2370b4942:(e,t,a)=>{"use strict";a.r(t),a.d(t,{DropdownMentionSupportBadge:()=>DropdownMentionSupportBadge});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x40c0d834),i=a(0x20482ad21),o=a(0x1fd3f6e20),s=a(0x218842a12),c=a(0x3711e82d),d=a(0xf3c65e54),u=a(0x5b1935a6);let m=new i.Ay("workflow_builder");s.g.HERMES_WORKFLOWS_DROPDOWN_MENTION_SUPPORT_BADGE;let DropdownMentionSupportBadge=()=>{let e=(0,r.wA)();return(0,n.useEffect)(()=>{e((0,d.A)({notificationName:u.ze.HERMES_WORKFLOWS_DROPDOWN_MENTION_SUPPORT_BADGE,action:u.hw.IMPRESSION}))},[e]),n.createElement(l.A,{clogImpression:!0,uiComponentName:c.UiComponentName.HERMES_WORKFLOWS_DROPDOWN_MENTION_SUPPORT_BADGE},n.createElement(o.v,{dataQa:"dropdown-mention-support-badge",isMicro:!0,style:o.u.Informative},m.t("Now with @mentions")))};DropdownMentionSupportBadge.displayName="DropdownMentionSupportBadge"},0x1a3026429:(e,t,a)=>{"use strict";a.d(t,{u:()=>hasValidDynamicInputValues});var n=a(0x242822dfb),r=a(0x7019ae94);let hasValidDynamicInputValues=(e,t)=>{if(!e.dynamic_options)return!0;let a="object"==typeof t&&!Array.isArray(t)&&Object.values(t||{}).some(e=>Number.isNaN(e)),l=!0;if((0,n.sg)(e)&&e.properties){let a=e.properties;l=Object.keys(a).every(e=>{let n=a[e],l=t&&"object"==typeof t&&!Array.isArray(t)?t[e]:void 0;return"isParameterFormWrapped"in n&&!!n.isParameterFormWrapped||!n.is_required||!(0,r.$)(l)})}return l&&!a}},0x1312f060e:(e,t,a)=>{"use strict";a.d(t,{B:()=>isRichTextSectionElement});let isRichTextSectionElement=e=>!!(e&&"object"==typeof e&&"type"in e&&"rich_text_section"===e.type)},0x250ebc75c:(e,t,a)=>{"use strict";function transformSteps(e,t){function visit(e){return e.map(e=>{let a=t(e);if("steps"in e&&Array.isArray(e.steps)){let t=visit(e.steps);return{...a,steps:t}}return a})}return visit(e)}a.d(t,{c:()=>transformSteps})},0x1e1fc678:(e,t,a)=>{"use strict";a.d(t,{T:()=>getTriggerLabel,k:()=>isExtendedTriggerType});var n=a(0x20482ad21),r=a(0x61c95b1b),l=a(0x2a037c8a);let i=new n.Ay("workflow_builder"),o={[l.M.Shortcut]:()=>i.t("From a link in Slack"),hermes_webhook:()=>i.t("From a webhook"),hermes_scheduled:()=>i.t("On a schedule"),[l.M.Webhook]:()=>i.t("From a webhook"),[l.M.Scheduled]:()=>i.t("On a schedule"),[l.M.Event]:{[r.$.ReactionAdded]:()=>i.t("When an emoji reaction is used"),[r.$.UserJoinedChannel]:()=>i.t("When a person joins a channel"),[r.$.ChannelCreated]:()=>i.t("When a channel is created"),[r.$.ListRecordUpdated]:()=>i.t("When a list item is updated"),[r.$.MessagePosted]:()=>i.t("When a message is posted with keywords",{fallbackHash:"67c9a95ef9a34aa542df04020d7543b46c247d2e"})},[l.M.External]:()=>i.t("From a Salesforce event")};function isExtendedTriggerType(e){return[...Object.values(l.M),"hermes_webhook","hermes_scheduled"].includes(e)}let getTriggerLabel=(e,t,a)=>{if(!isExtendedTriggerType(e))return"";if(e===l.M.Service)return t??"";let n=o[e];return"function"==typeof n?n():n[a]?.()}},0x7733abee:(e,t,a)=>{"use strict";a.r(t),a.d(t,{MessagePostedPrivateChannelAccessBadge:()=>MessagePostedPrivateChannelAccessBadge});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x11a296110),i=a(0x1fd3f6e20),o=a(0x4c96e5d9),s=a(0x218842a12),c=a(0x145d46a61),d=a(0x226892387),u=a(0x1de368064),m=a.n(u);let p=new r.Ay("workflow_builder");s.g.HERMES_WORKFLOWS_MESSAGE_POSTED_TRIGGER_PRIVATE_CHANNEL_ACCESS_BADGE;let MessagePostedPrivateChannelAccessBadge=({recordNotificationEventImpression:e})=>{let t=(0,d.d4)(c.sQ);(0,n.useEffect)(()=>{e()},[e]);let a=t?p.t("Private channel access: You can now select private channels when setting up this trigger."):"Private channel access: You can now select private channels when setting up this trigger.";return n.createElement(o.Ay,{tip:a},n.createElement(l.Nm,{"data-qa":"private-channel-access-badge",className:m().badge,"aria-label":a},n.createElement(i.v,{isMicro:!0,style:i.u.Informative},p.t("NEW"))))};MessagePostedPrivateChannelAccessBadge.displayName="MessagePostedPrivateChannelAccessBadge"},0x1340d624e:(e,t,a)=>{"use strict";a.d(t,{ED:()=>c,XD:()=>n,XZ:()=>o,bI:()=>l,kJ:()=>s,qG:()=>r,x4:()=>d,zc:()=>i});let n={USER_ID:"user_id",NOTIFY_MANAGERS:"notify_managers",ROLES_TYPE:"roles_type",ROLES:"roles",ROLE_CONTAINS:"role_contains",ROLE_DOES_NOT_CONTAIN:"role_does_not_contain",USER_FILTER:"user_filter",MESSAGE:"message",INTERACTIVE_BLOCKS:"interactive_blocks"},r={USER_ID:"user_id",INTERACTIVE_BLOCKS:"interactive_blocks"},l={USER_ID:"user_id",MESSAGE:"message",NOTIFICATION_DISPLAY_TABLE_HEADER:"notification_display_table_header",NOTIFICATION_DISPLAY_TABLE_EXTRA_COLUMN_FIELD_ID:"notification_display_table_extra_column_field_id",INTERACTIVE_BLOCKS:"interactive_blocks"},i={AGENT_IDS:"agent_ids"},o={CHANNEL_ID:"channel_id",CHANNEL_IDS:"channel_ids",DAYS:"days"},s={CANVAS_UPDATE_TYPE:"canvas_update_type",CHANNEL_ID:"channel_id",CANVAS_ID:"canvas_id",SECTION_ID:"section_id",ACTION:"action",CONTENT:"content"},c={CANVAS_UPDATE_TYPE:"canvas_update_type",CHANNEL_ID:"channel_id",CANVAS_ID:"canvas_id",SECTION_ID:"section_id",ACTION:"action",CONTENT:"content",CANVAS_TAB_SECTION_ID:"canvas_tab_section_id",CANVAS_TAB:"canvas_tab"},d={CANVAS_UPDATE_TYPE:"canvas_update_type",CHANNEL_ID:"channel_id",CANVAS_ID:"canvas_id",PLACEHOLDER_VALUES:"placeholder_values"}},0x12321ecbc:(e,t,a)=>{"use strict";a.d(t,{E:()=>getChannelLabel,k:()=>getUserLabel});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x2501a2cee),i=a(0x1e74dc307),o=a(0x668181b3),s=a(0x2772625d),c=a(0x247cf31a2),d=a(0xf4097f62),u=a(0x1461e71d1),m=a.n(u);let p=new r.Ay("workflow_builder"),DynamicItemLabel=({label:e})=>n.createElement("span",{className:m().variable_container},n.createElement(l.Ah,{inline:!0,size:"inherit",name:"css"})," ",e??p.t("Missing Data"));DynamicItemLabel.displayName="DynamicItemLabel";let getUserLabel=(e,t)=>{if(e.length>1)return p.t("{qty} people",{qty:e.length,fallbackHash:"b37554f695b15005fd23907b9488e0a8ad4bca5f"});let a=e[0];return(0,s.cn)(a)?n.createElement(DynamicItemLabel,{label:(0,o.x)(t,a)?.label}):p.rt("@{user}",{user:n.createElement(d.A,{id:a,truncate:!0}),fallbackHash:"457d64a8b6c031bbf97653abb1689cab35c6261c"})};getUserLabel.displayName="getUserLabel";let getChannelLabel=(e,t)=>{if(e.length>1)return p.t("{qty} channels",{qty:e.length,fallbackHash:"18e03e2a37ba37df713f9665ef752fb8b40fc1e8"});let a=e[0];return(0,s.cn)(a)?n.createElement(DynamicItemLabel,{label:(0,o.x)(t,a)?.label}):n.createElement(i.A,{channelId:a},n.createElement(c.A,{channelId:a,truncate:!0}))};getChannelLabel.displayName="getChannelLabel"},0x24430233d:(e,t,a)=>{"use strict";a.d(t,{o:()=>getScheduleFrequencySummary});var n=a(0x20482ad21),r=a(0x1e864b930),l=a(0x124d99cb0),i=a(0x118af79e8);let o=new n.Ay("workflow_builder"),getScheduleFrequencySummary=e=>{let t,a=(0,l.lP)(e.startTime,e.timezone),n=(0,i.k)(e),s=a.isoWeekday();switch(n){case"daily":t=o.t("and repeats daily");break;case"weekdays":t=o.t("and repeats every weekday");break;case"weekly_same_day":t=o.t("and repeats weekly on {dayOfWeek}",{dayOfWeek:(0,l.au)(s,!0)});break;case"monthly_nth_day":t=(0,l.U7)((0,l.nA)(a,!0))(s);break;case"monthly":case"yearly":case"custom":t=(e=>{let t;if(!e.frequency)return"";let a=(0,l.lP)(e.startTime,e.timezone),{type:n,repeatsEvery:i=1,onDays:s,onWeekNum:c}=e.frequency,d=a.format("YYYY-MM-DD"),u=(0,l.Bz)(d),m=c??u,p=m?(0,l.fd)(m)?.(!0):(0,l.nA)(a,!0),b=(0,l.au)(a.isoWeekday(),!1),f=s?.map(e=>(0,l.U6)(e,!1));switch(n){case"hourly":t=1===i?o.t("and repeats hourly"):o.t("and repeats every {repeatsEvery, plural, =1 {hour} other {# hours}}",{repeatsEvery:i});break;case"daily":t=1===i?o.t("and repeats daily"):o.t("and repeats every {repeatsEvery, plural, =1 {day} other {# days}}",{repeatsEvery:i});break;case"weekly":t=f?o.t("and repeats every {repeatsEvery, plural, =1 {week} other {# weeks}} on {daysOfWeekList}",{repeatsEvery:i,daysOfWeekList:(0,r.A)(f).join("")}):o.t("and repeats on a custom schedule");break;case"monthly":t=s||c?o.t("and repeats every {repeatsEvery, plural, =1 {month} other {# months}} on the {dayOfWeekOrdinal} {dayOfWeek}",{repeatsEvery:i,dayOfWeekOrdinal:p,dayOfWeek:b}):1===i?o.t("and repeats monthly"):o.t("and repeats every {repeatsEvery, plural, =1 {month} other {# months}}",{repeatsEvery:i});break;case"yearly":t=1===i?o.t("and repeats annually"):o.t("and repeats every {repeatsEvery, plural, =1 {year} other {# years}}",{repeatsEvery:i});break;default:t=o.t("and repeats on a custom schedule")}return t})(e);break;default:t=""}return t}},0xdfa9cb32:(e,t,a)=>{"use strict";a.d(t,{M:()=>getScheduleSummary});var n=a(0x20482ad21),r=a(0x124d99cb0),l=a(0x24430233d),i=a(0x6960d8b9);let o=new n.Ay("workflow_builder"),getScheduleSummary=(e,t={})=>{let{do24hrTime:a}=t,n=(0,r.lP)(e.startTime,e.timezone),s=(0,i.Od)(n,{excludeYear:!0,uncapitalizedRelativeDay:!0}),c=(0,i.xe)(n,{do24hrTime:a}),d=(0,l.o)(e);return o.t("Starts {humanReadableDate} at {humanReadableTime}{repeat}",{humanReadableDate:s,humanReadableTime:c,repeat:d?` ${d}`:d,fallbackHash:"457f9c0427f3b60305b95dc44d845dc00aa06724"})}},0xab1e931b:(e,t,a)=>{"use strict";a.d(t,{Al:()=>c,I4:()=>isOptionLabelTooLong,N8:()=>titleIsValid,Ot:()=>optionIsValid,aA:()=>o,au:()=>s,fD:()=>questionIsValid,kg:()=>isOptionLabelTooShort,l4:()=>isTheSecondDuplicate,ud:()=>i});var n=a(0x18af67efb),r=a(0x1dde3f5ab),l=a(0xe53aa0);let i=24,o=125,s=125,c=75,isOptionLabelTooLong=e=>e.label?.length>c,isOptionLabelTooShort=e=>e.label?.trim?.()?.length===0,optionIsValid=e=>e.label?.trim?.()?.length>0&&e.label?.length<=c,titleIsValid=({dialogTitle:e,maxLength:t})=>e?.trim()?.length>0&&e?.length<=t;function findIndices(e,t=[]){let a=[],n=t.indexOf(e);for(;-1!==n;)a.push(n),n=t.indexOf(e,n+1);return a}function isTheSecondDuplicate(e,t,a){let n=findIndices(t,e.map(e=>(0,l.X)(e)?e.label:e.value));return!(n.length<=1)&&n.some(e=>e<a)}let questionIsValid=e=>{if(e.label?.trim()?.length===0||e.label?.length>o||e.description?.length>s)return!1;if((0,r.OW)(e.questionType)||(0,r.EI)(e.questionType)){let t;return!!e.options&&(!e.options.length||e.options.every(e=>optionIsValid(e))&&(t=e.options,(0,n.A)(t,e=>(0,l.X)(e)?e.label:e.value).length===t.length))}return!0}},0x146e4ebc8:(e,t,a)=>{"use strict";a.d(t,{V:()=>ActionBarForward});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x8601851c),i=a(0x40c0d834),o=a(0x20482ad21),s=a(0x344bb842),c=a(0x2501a2cee),d=a(0x4c96e5d9),u=a(0x11036d95f),m=a(0xe874a88a),p=a(0x22a29f141),b=a(0x1dfdeb1c8),f=a(0x1ec68d6a3),g=a(0xe747dd27);let h=(0,b.A)("salesHome.notifications.formatShare generated fetcher",(e,t,a)=>new m.S((n,r)=>{let{abortSignal:l,reason:i,...o}=a,s=(0,g.VA)(o);e((0,p.apiCall)({method:"salesHome.notifications.formatShare",args:s,abortSignal:l,reason:i})).then(e=>{n(e)}).catch(e=>{(0,f.default)({getState:t}).error(`API call to salesHome.notifications.formatShare
						with reason ${i} failed, initiated by generated fetcher`),r(e)})}));h.meta={name:"salesHomeNotificationsFormatShareFetcher",key:"createFetcherSalesHomeNotificationsFormatShareFetcher",description:"salesHome.notifications.formatShare generated fetcher"};var _=a(0x3711e82d),y=a(0x32d3ef3d),x=a(0xcea4a81c),v=a(0x113cdbbd7),E=a(0x1608420cc),k=a(0x103f48cb9),w=a(0x1506d547b),S=a(0xf7a922a4),C=a(0x181fc1a60);let A=(0,b.A)("salesHome.notifications.share generated fetcher",(e,t,a)=>new m.S((n,r)=>{let{abortSignal:l,reason:i,...o}=a,s=(0,g.VA)(o);e((0,p.apiCall)({method:"salesHome.notifications.share",args:s,abortSignal:l,reason:i})).then(e=>{n(e)}).catch(e=>{(0,f.default)({getState:t}).error(`API call to salesHome.notifications.share
						with reason ${i} failed, initiated by generated fetcher`),r(e)})}));A.meta={name:"salesHomeNotificationsShareFetcher",key:"createFetcherSalesHomeNotificationsShareFetcher",description:"salesHome.notifications.share generated fetcher"};var T=a(0x1d600678),I=a(0xa6b90d4b),N=a(0x24cf1145d),M=a(0x226892387);let L=new o.Ay("modernselling"),ForwardNotificationModal=e=>{let{createdTs:t,notificationType:a,isAdminCreated:l,msgOps:o,selectedChannelId:s,opportunityId:c,attachmentBlocks:d,salesforceRecord:u}=e,m=(0,r.wA)(),p="forward-sales-notification-dialog",b=L.t("Forward this notification");c&&(b=L.t("Forward this record update"));let f=L.t("Forward"),g=(0,n.useCallback)(()=>m((0,N.I)({channelOrMemberId:s,reason:p})).then(e=>{let a=m((0,I.A)({msgOps:o,channelId:e}))||[];return m(A({createdTs:t,channelId:e,...a.length&&{shareBlocks:a},reason:"sales-home-forward-notification",opportunityId:c}))}),[m,s,o,t,c]),h=(0,n.useMemo)(()=>({onClick:{enableClogAction:!0},elementName:"forward_notification_modal_btn",elementValue:t}),[t]),S=(0,n.useMemo)(()=>d&&n.createElement("div",{className:"c-message_attachment_v2"},n.createElement(k.A,{version2:!0}),n.createElement("div",null,n.createElement(E.A,{blocks:d,service:void 0,channelId:s,blocksContainerContext:v.pi.share_dialog}),u&&n.createElement("div",{className:"margin_top_100"},n.createElement(x.a,{entityState:y.w.enabled,size:y.S.expanded,record:u,showActionsBar:!1,isInteractive:!1})))),[d,u,s]),O=(0,M.d4)(e=>(0,T.x)(e,"salesforce_forwarding")?.default==="speedbump");return n.createElement(i.A,{eventId:_.EventId.LOB_SALES_HOME,uiComponentName:_.UiComponentName.LOB_NOTIFICATION_FORWARD_MODAL,channelId:s,lobNotificationType:a,isLobNotificationWorkflowAdmin:l},n.createElement(w.A,{...e,title:b,goButtonText:f,goButtonAutoClogProps:h,goHandler:g,dialogType:C.hs.NOTIFICATION,shareReason:p,notificationType:a,attachment:S,forwardingSpeedbumpEnabled:O}))};ForwardNotificationModal.displayName="ForwardNotificationModal";let O=(0,S.A)(ForwardNotificationModal);var F=a(0x11c82607b),D=a(0x46dbff89);let P=(0,F.Ay)("Opens the Forward Notification Modal",(e,t,a)=>{e((0,D.q)({element:n.createElement(O,a)}))});P.meta={name:"openForwardNotificationModal",key:"createThunkOpenForwardNotificationModal",description:"Opens the Forward Notification Modal"};let R=new o.Ay("modernselling"),ActionBarForward=({hasFocus:e,createdTs:t,notificationType:a,isAdminCreated:o,opportunityId:m})=>{let p=(0,r.wA)(),{maybeClosePeek:b}=(0,n.useContext)(u.Z),f=R.t("Forward notification");m&&(f=R.t("Forward record update"));let g=(0,n.useCallback)(()=>!e,[e]),y=(0,n.useCallback)(async e=>{e.stopPropagation();let n=await p(h({createdTs:t,opportunityId:m,reason:"sales-home-get-notification-blocks"}));if(n&&n.ok){let{content_blocks:e,attachment_blocks:r,salesforce_record:l}=n;p(P({createdTs:t,notificationType:a,isAdminCreated:o,contentBlocks:e,attachmentBlocks:r,salesforceRecord:l,opportunityId:m}))}b()},[p,t,m,b,a,o]),x=(0,n.useCallback)(()=>({onClick:{enableClogAction:!0},elementName:"forward_notification_action_bar",elementValue:t}),[t]);return(0,n.useEffect)(()=>{let e=new l.A;return e.bindAll([{keys:["f"],handler:y,filter:g,action:"keyup"}]),()=>e.reset()},[g,y]),n.createElement(i.A,{eventId:_.EventId.LOB_SALES_HOME,uiComponentName:_.UiComponentName.LOB_NOTIFICATION_ACTIONS_BAR,lobNotificationType:a,isLobNotificationWorkflowAdmin:o},n.createElement(d.Ay,{tip:f,position:"top"},n.createElement(s.A,{"aria-label":f,onClick:y,className:"c-message_actions__button",size:"small",autoClogProps:x()},n.createElement(c.Ah,{name:"share-message"}))))};ActionBarForward.displayName="ActionBarForward"},0x1090ee536:(e,t,a)=>{"use strict";a.d(t,{H:()=>ActionBarMore});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x344bb842),i=a(0x99233ecb),o=a(0x4c96e5d9);let s=new r.Ay("modernselling"),ActionBarMore=({children:e,onMenuOpen:t,onMenuClose:a})=>{let r=(0,n.useCallback)(t=>n.createElement(i.Ay,t,e),[e]);return n.createElement(i.cQ,{onOpen:t,onClose:a,renderMenu:r,position:"left-bottom"},n.createElement(o.Ay,{tip:s.t("More actions"),position:"top"},n.createElement(l.A,{"aria-label":s.t("More actions"),className:"c-message_actions__button",size:"small",svgIconProps:{name:"ellipsis-vertical-filled"}})))};ActionBarMore.displayName="ActionBarMore"},0x21b980720:(e,t,a)=>{"use strict";a.d(t,{E:()=>ActionBar});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r);let ActionBar=({children:e,isVisible:t})=>n.createElement("div",{className:l()("p-sales_feed__action_bar",t&&"p-sales_feed__action_bar--visible")},n.createElement("div",{className:"c-message_actions__container"},n.createElement("div",{className:"c-message_actions__group",role:"group"},e)));ActionBar.displayName="ActionBar"},0x139d2f9a8:(e,t,a)=>{"use strict";a.d(t,{_:()=>useMenuItemCreator});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0xf4097f62),o=a(0x13638bd77);let s=new l.Ay("modernselling"),useMenuItemCreator=e=>{let t=(0,r.wA)(),a=(0,n.useCallback)(()=>{t((0,o.b)({memberId:e}))},[t,e]);return{label:s.rt("Notification created by {admin}",{admin:n.createElement(i.A,{id:e})}),onSelect:a}};useMenuItemCreator.displayName="useMenuItemCreator"},0xcdc086ce:(e,t,a)=>{"use strict";a.d(t,{e:()=>useMenuItemEdit});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0x156eec78a),o=a(0x139aa1a7),s=a(0xcefedbca);let c=new l.Ay("modernselling"),useMenuItemEdit=(e,t=!1)=>{let a=(0,i.Q)(),l=(0,r.wA)(),d=(0,n.useCallback)(()=>{e&&(a({viewType:t?o.D.SalesAdministration:o.D.SalesNotifications}),l((0,s.A)({workflowId:e,isAdmin:t})))},[e,a,l,t]),u=(0,n.useMemo)(()=>({onClick:{enableClogAction:!0},elementName:"lob_notifications_edit",workflowId:e,isLobNotificationWorkflowAdmin:t}),[t,e]);return{label:c.t("Edit notification conditions"),onSelect:d,autoClogProps:u}}},0xc77a8bc3:(e,t,a)=>{"use strict";a.d(t,{z:()=>useMenuItemMute});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x10490d62c);let i=new r.Ay("modernselling"),useMenuItemMute=(e,t)=>{let a=(0,l.A)(),[r,o]=(0,n.useState)(t),s=(0,n.useCallback)(()=>{e&&a(e,!r).then(()=>{o(!r)})},[a,r,e]),c=i.t("Mute notification"),d=i.t("Unmute notification");return{label:r?d:c,onSelect:s}}},0x23b93d6d0:(e,t,a)=>{"use strict";a.d(t,{Z:()=>FeedItemScheduled});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0xb90d5858),i=a(0x2501a2cee),o=a(0x21b980720),s=a(0x1090ee536),c=a(0x139d2f9a8),d=a(0xcdc086ce),u=a(0xc77a8bc3),m=a(0x1e5093c5a),p=a(0xfca33088),b=a(0xbf61ff25);let f=new r.Ay("modernselling"),FeedItemScheduled=({notification:e,isWorkflowPreview:t,isStepPreview:a,...r})=>{let{is_acn:g,is_workflow_deleted:h,is_workflow_editable:_,is_workflow_muted:y,notification_display_columns:x,notification_display_type:v,payload:{opportunities:E,generic_records:k,workflow:w},workflow_created_by:S,workflow_id:C,salesforce_org_id:A,created_ts:T}=e,I=(0,u.z)(C,y),N=(0,d.e)(C,g),M=(0,c._)(S),L=(0,n.useMemo)(()=>n.createElement(i.Ah,{name:"calendar"}),[]),O=(0,n.useCallback)(({isVisible:e,onMenuOpen:t,onMenuClose:a})=>{let r=g&&!!C&&!h,i=_&&!h;return r||i||g?n.createElement(o.E,{isVisible:e},n.createElement(s.H,{onMenuOpen:t,onMenuClose:a},r&&n.createElement(l.A,{onSelected:I.onSelect},I.label),i&&n.createElement(l.A,{onSelected:N.onSelect,autoClogProps:N.autoClogProps},N.label),g&&n.createElement(l.A,{className:"padding_top_75",description:M.label,onSelected:M.onSelect}))):null},[g,C,I,N,M,_,h]),F=(0,n.useCallback)(()=>{let e=k?.length?k:E;return x?.length&&e?.length&&w?.subtitle?n.createElement(p.N,{columns:x,displayType:v,records:e,title:w.subtitle,workflowId:C,salesforceOrgId:A,notificationCreatedTs:T,isWorkflowPreview:t,isStepPreview:a}):null},[k,E,x,w.subtitle,v,C,A,T,t,a]);return n.createElement(m.G,{...r,headerIcon:L,headerText:f.t("Scheduled"),iconFallbackUrl:b,notification:e,renderActionBar:O,renderMore:F,isWorkflowPreview:t,isStepPreview:a})};FeedItemScheduled.displayName="FeedItemScheduled"},0x1e5093c5a:(e,t,a)=>{"use strict";a.d(t,{G:()=>FeedItem});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x14fad6485),s=a(0x40c0d834),c=a(0x1faa3f1ac),d=a(0x113cdbbd7),u=a(0x944e06df),m=a(0x754ea859),p=a(0x184825275),b=a(0x6960d8b9),f=a(0xc0b7c558);let FeedItem=({hasFocus:e,headerIcon:t,headerText:a,headerLinkUrl:l,iconFallbackUrl:g,isFirst:h,notification:_,renderActionBar:y,renderInlineActions:x,renderMore:v,withHeaderWrapper:E,isWorkflowPreview:k,isStepPreview:w})=>{let{body:S,workflow_id:C,created_ts:A,icon_url:T,is_unread:I,salesforce_org_id:N,payload:{workflow:{title:M,service_id:L,service_team_id:O},opportunities:F=[],records:D=[]}}=_,{windowRef:P}=(0,n.useContext)(o._0),R=(0,n.useRef)(null),[B,W]=(0,n.useState)(!1),[V,H]=(0,n.useState)(!1),q=e||B||V,U=(0,r.wA)(),z=(0,n.useCallback)(()=>{W(!0)},[]),j=(0,n.useCallback)(()=>{W(!1)},[]),G=(0,n.useCallback)(()=>{H(!0)},[]),$=(0,n.useCallback)(()=>{H(!1),P.deref()?.requestAnimationFrame(()=>{W(R.current?.matches(":hover")===!0)})},[P]),K=(0,n.useCallback)(()=>{let e=F.length?F[0]?.slack_record_id:(0,f.j)(N,D[0].record_identifier);e&&U((0,m.c)({recordId:e}))},[U,F,D,N]),Y=(0,n.useMemo)(()=>{let e=n.createElement("div",{className:i()("display_flex align_items_center",{sk_foreground_max:!I,sk_primary_foreground:I,bold:I})},t,n.createElement("div",{className:"caption margin_left_25 margin_right_25"},a));if(l){let t=F.length||D.length&&N;e=n.createElement(c.A,{className:"p-sales_feed__item__header__link",href:t?"":l,target:"_blank",onClick:t?K:void 0},e)}return E&&(e=E(e)),e},[I,t,a,l,E,K,F,D,N]),Q=(0,n.useMemo)(()=>({hasFocus:e,isVisible:q,onMenuOpen:G,onMenuClose:$}),[$,G,e,q]),Z=(0,n.useCallback)(e=>{let t={serviceId:L,serviceTeamId:O,container:{type:d.pi.lob_notification,notificationTs:A},actions:[e]};return U((0,p.W)(t))},[L,O,A,U]);return n.createElement(s.A,{clogImpression:!0,elementName:"lob_sales_notification_item",elementValue:A,workflowId:C},n.createElement("div",{ref:R,onPointerOver:z,onPointerLeave:j,className:i()("p-sales_feed__item",{"p-sales_feed__item--first":h,"p-sales_feed__item--preview":k,"p-sales_feed__item--no-border":k&&!w})},n.createElement("div",{className:i()("p-sales_feed__item__inner",{"p-sales_feed__item__inner--preview":k})},!k&&n.createElement("div",{className:"display_flex justify_content_between align_items_center"},Y,n.createElement("div",{className:"display_flex align_items_center"},n.createElement("div",{className:i()("caption",{bold:I})},(0,b.Yq)(A,"{status_expiration}")),I&&n.createElement("div",{className:"p-sales_feed__item__unread_dot"}))),n.createElement("div",{className:i()("display_flex",{margin_top_50:!k})},n.createElement("img",{className:"p-sales_feed__item__icon",src:T||g,alt:M}),n.createElement("div",{className:"flex_one display_flex"},n.createElement("div",{className:"flex_one"},n.createElement("div",{className:"sk_primary_foreground black"},M),n.createElement(u.A,{blocks:S,blocksContainerContext:d.pi.sales_home_notification,onAction:Z}),v?.()),x&&n.createElement("div",{className:"flex_shrink_none"},x()))),y?.(Q))))};FeedItem.displayName="FeedItem"},0x129529b49:(e,t,a)=>{"use strict";a.d(t,{E:()=>OpportunityHoverCardTrigger});var n=a(0xbad225b5),r=a(0x1cbdfeceb),l=a(0x217f0c263),i=a(0x14fad6485),o=a(0x1f3598f80),s=a(0xc745739a),c=a(0x20482ad21),d=a(0x2b7f0bcc),u=a(0x102edf836),m=a(0x11a296110),p=a(0x1ee57b3a0),b=a(0x1fa67866c),f=a(0xb1ea448c),g=a(0x128d54e52),h=a(0x1535e80f3),_=a(0x15fb82076),y=a(0x2501a2cee),x=a(0x4c96e5d9),v=a(0x12b6a33fc),E=a(0x16cf1da63),k=a(0xe874a88a),w=a(0x22a29f141),S=a(0x1dfdeb1c8),C=a(0x1ec68d6a3),A=a(0xe747dd27);let T=(0,S.A)("sfdc.getOpportunity generated fetcher",(e,t,a)=>new k.S((n,r)=>{let{abortSignal:l,reason:i,...o}=a,s=(0,A.VA)(o);e((0,w.apiCall)({method:"sfdc.getOpportunity",args:s,abortSignal:l,reason:i})).then(e=>{n(e)}).catch(e=>{(0,C.default)({getState:t}).error(`API call to sfdc.getOpportunity
						with reason ${i} failed, initiated by generated fetcher`),r(e)})}));function useFetchOpportunityInfo(){let e=(0,E.wA)();return(0,n.useCallback)((t,a)=>e(T({id:t,reason:"sales-home-get-opportunity-info",salesforceOrgId:a})),[e])}T.meta={name:"sfdcGetOpportunityFetcher",key:"createFetcherSfdcGetOpportunityFetcher",description:"sfdc.getOpportunity generated fetcher"};var I=a(0x1c659cbb1),N=a(0x110b4f809),M=a(0xe38b5635),L=a(0x1ed767a16),O=a(0x6960d8b9),F=a(0x226892387),D=a(0x1c8beab7f);let P=a.p+"crown-f27246b.svg",R=new c.Ay("modernselling"),B={elementName:"open_in_salesforce",onClick:{enableClogAction:!0}},W={elementName:"copy_opportunity_link",onClick:{enableClogAction:!0}},V=new RegExp(/\bhttps?:\/\/[^\s]+\b/g),OpportunityNextStep=({nextStep:e})=>{let t=e.split(V),a=e.match(V)||[],r=t.reduce((e,t,r)=>{if(e.push(t),r<a.length){let t=a[r];e.push(n.createElement(_.A,{key:r+t,href:t}))}return e},[]);return n.createElement(n.Fragment,null,r)};OpportunityNextStep.displayName="OpportunityNextStep";let OpportunityHoverCard=({opportunity:e,record:t,salesforceOrgId:a})=>{let r,l=e?.id??t?.record_identifier,i=e?.record_link??t?.record_link,o=useFetchOpportunityInfo(),s=(0,F.d4)(D.cc),[c,_]=(0,n.useState)(),[E,k]=(0,n.useState)(!0),[w,S]=(0,n.useState)(!1),[C,A]=(0,N.A)(!1,2e3);(0,n.useEffect)(()=>{l&&o(l,a).then(e=>{_(e)}).catch(()=>{S(!0)}).finally(()=>{k(!1)})},[o,l,a]);let T=(0,n.useCallback)(()=>n.createElement(I.f1,{className:"p-sales_feed__opp_hover_card_avatar",size:36,imageUrl:P,isInteractive:!1}),[]),V=(0,n.useCallback)(()=>n.createElement(I.Ay,{className:"c-base_entity__avatar",size:h.RG.small,userId:e?.owner.slack_user_id,isInteractive:!1,tabIndex:-1,ariaHidden:!0}),[e]),H=(0,n.useCallback)(()=>{(0,L.x3)(i),A(!0)},[i,A]),q=s.length>1?s.find(e=>e.salesforce_org_id===a)?.name:void 0;return r=c?q?c.account?.name?R.rt("Opportunity in {account_name}, <b>{salesforceOrgName}</b>",{account_name:c.account.name,salesforceOrgName:q}):R.rt("Opportunity in <b>{salesforceOrgName}</b>",{salesforceOrgName:q}):c.account?.name?R.t("Opportunity in {account_name}",{account_name:c.account.name}):R.t("Opportunity"):q?R.rt("Opportunity in <b>{salesforceOrgName}</b>",{salesforceOrgName:q}):"Opportunity",n.createElement(M.A,{elevation:4,size:"medium",className:"p-sales_feed__opp_hover_card"},E&&n.createElement(b.A,{className:"margin_top_200"},n.createElement(f.A,{size:"jumbo"})),w&&n.createElement(b.A,null,n.createElement(d.Ay,{type:"boxed",level:"error",className:"margin_bottom_150"},R.rt("Oops\u2026 we had trouble fetching opportunity info"))),c&&n.createElement(n.Fragment,null,n.createElement(p.A,null,n.createElement(g.Ay,{size:"medium",avatar:T,text:n.createElement(g.CG,{className:"black",withTruncationTooltip:!0},c.name),subtext:n.createElement(g.sT,{className:"caption p-sales_feed__opp_hover_card_header_subtext"},r)})),n.createElement(b.A,null,n.createElement("div",{className:"p-sales_feed__opp_hover_card_details_container"},n.createElement("div",{className:"p-sales_feed__opp_hover_card_stage_details"},n.createElement("div",{className:"p-sales_feed__opp_hover_card_details_label"},R.t("Stage")),n.createElement("div",{className:"p-sales_feed__opp_hover_card_stage_details_pill"},c.stage)),n.createElement("div",{className:"p-sales_feed__opp_hover_card_details"},n.createElement("div",{className:"p-sales_feed__opp_hover_card_details_label"},R.t("Close date")),(0,O.Yq)((0,O.$4)(c.close_date,{parseFormat:"YYYY-MM-DD",returnMoment:!0}),"{date_slash}")),n.createElement("div",{className:"p-sales_feed__opp_hover_card_details"},n.createElement("div",{className:"p-sales_feed__opp_hover_card_details_label"},R.t("Amount")),c.amount.display_value),n.createElement("div",{className:"p-sales_feed__opp_hover_card_owner_details"},n.createElement("div",{className:"p-sales_feed__opp_hover_card_details_label"},R.t("Owner")),n.createElement(g.Ay,{avatar:V,className:"c-member c-member--small",text:n.createElement("span",{className:"c-member__primary_content"},n.createElement(g.CG,{className:"c-member_name"},c.owner.name)),size:"small"}))),""!==c.next_step?n.createElement("div",{className:"p-sales_feed__opp_hover_card_next_steps_details"},n.createElement("div",{className:"p-sales_feed__opp_hover_card_details_label"},R.t("Next Step")),n.createElement(OpportunityNextStep,{nextStep:c.next_step})):null,n.createElement("div",{className:"p-sales_feed__opp_hover_card_actions"},n.createElement(u.z9,{className:"p-sales_feed__opp_hover_card_linkbutton",size:"medium",type:"outline",href:i,autoClogProps:B},n.createElement("span",{className:"p-sales_feed__opp_hover_card_linkbutton_text"},R.t("Open in Salesforce")),n.createElement(y.Ah,{inline:!0,name:"new-window"})),n.createElement(x.Ay,{tip:C?R.t("Copied!"):R.t("Copy link"),status:C?v.YU.Success:v.YU.Info},n.createElement(m.Ay,{className:"p-sales_feed__opp_hover_card_copybutton",size:"medium",type:"outline",onClick:H,autoClogProps:W,"aria-label":C?R.t("Copied"):R.t("Copy Salesforce Url")},n.createElement(y.Ah,{name:"files"})))))))};OpportunityHoverCard.displayName="OpportunityHoverCard";let OpportunityHoverCardTrigger=({children:e,opportunity:t,record:a,salesforceOrgId:c})=>{let{windowRef:d}=(0,n.useContext)(i._0),[u,m]=(0,n.useState)(null),p=(0,n.useRef)(null),b=(0,n.useCallback)(()=>{let e=(e=>{let{pageYOffset:t,innerWidth:a,innerHeight:n}=e.deref()||{pageYOffset:0,innerWidth:0,innerHeight:0};return{top:(0,s.ci)(t+10),right:a-16,bottom:t+n-10,left:16}})(d),t=p.current.getBoundingClientRect(),a={top:void 0,bottom:void 0,right:void 0,left:void 0},n=t.right+345>e.right,r=t.bottom+250>e.bottom,l=t.top-250<e.top;if(n){let n=e.right-(t.left+345)<0;r&&l?(a.top=t.bottom+12,a.right=e.right-t.left+25):(r?a.bottom=e.bottom-t.y+12:l?a.top=t.bottom+12:a.bottom=e.bottom-t.y+25,a.left=t.left),n&&(a.right=12,a.left="auto")}else l&&r?(a.top=t.top-100,a.left=t.right+12):r?(a.left=t.left,a.bottom=e.bottom-t.y+25):l?(a.top=t.bottom+12,a.left=t.left):(a.left=t.right+12,a.top=t.top);return a},[d]),f=(0,n.useCallback)(()=>{m(null)},[]),g=(0,n.useCallback)(()=>{let e=b();m(n.createElement(l.A,{isOpen:!0,className:"opportunity-hover-modal",overlayClassName:"p-sales_feed__opportunity_hover_card__modal",shouldFocusAfterRender:!0,shouldCloseOnEsc:!0,onRequestClose:f},n.createElement("div",{className:"p-sales_feed__opportunity_hover_card__popover",style:e},n.createElement(OpportunityHoverCard,{record:a,opportunity:t,salesforceOrgId:c}))))},[b,a,t,f,c]),[h,_]=(0,o.i)(g),[y,x]=(0,o.i)(f),v=(0,n.useCallback)(()=>(x(),u)?void _():h(350),[x,h,_,u]),E=(0,n.useCallback)(()=>(_(),u)?y(250):void x(),[_,y,x,u]);return n.createElement("span",{className:"p-sales_feed__opportunity_hover_card",onMouseOver:v,onMouseLeave:E,onClick:v,role:"presentation",onFocus:r.A,ref:p},e,u)};OpportunityHoverCardTrigger.displayName="OpportunityHoverCardTrigger"},0xfca33088:(e,t,a)=>{"use strict";a.d(t,{N:()=>R});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x11a296110),o=a(0x2501a2cee),s=a(0x1fdec3e16),c=a(0x16cf1da63),d=a(0x77727995),u=a(0x130d89881),m=a(0x1a043bf26),p=a(0x20482ad21),b=a(0x1d104c491),f=a(0x2493ba930),g=a.n(f);let h=new p.Ay("workflow_builder");function getColumnSortField(e){return e.sort_payload_field??e.payload_field}let getGenericRecordValue=(e,t)=>{let a=(0,d.A)(e.record_fields,t.key);return a.record_field_sort_value??a.record_field_rendered_value},isGenericRecord=e=>"record_identifier"in e&&void 0!==e.record_identifier;function getRecordKey(e){return isGenericRecord(e)?e.record_identifier:e.id}function getRecordName(e){return isGenericRecord(e)?e.record_name??h.t("Missing Data"):e.name}function getObjectType(e){return isGenericRecord(e)?e.object_identifier:b.Dj.Opportunity}function getRecordField(e,t){return isGenericRecord(e)?getGenericRecordField(e,t)??h.t("Missing Data"):e[t]}function getGenericRecordField(e,t){return e.record_fields[t]?.record_field_rendered_value}function getInitialSortByValue(e){let t=e.find(e=>e.primary_sort)||e[0],a=t?.primary_sort?.toLowerCase();return{key:getColumnSortField(t),dir:"desc"===a||"descending"===a?"desc":"asc"}}function getDisplayTypeClassNames(e){return{text:g()[`${e}_text`]||g().standard_text,border:g()[`${e}_border`]||g().standard_border,borderDark:g()[`${e}_border_dark`]||g().standard_border_dark,lightText:g()[`${e}_light_text`]||g().standard_light_text,background:g()[`${e}_background`]||g().standard_background}}function RecordsListTableHeader({column:e,displayType:t,isSortAsc:a,isSortKey:r,onClick:c}){let d=getDisplayTypeClassNames(t);return n.createElement(i.Nm,{onClick:c,className:l()(g().records_list_table_cell,g().records_list_table_cell_header,d.text)},n.createElement(s.A,{withTooltip:!0,lines:1},e.name),r&&n.createElement(o.Ah,{name:a?"arrow-up":"arrow-down",size:"16"}))}RecordsListTableHeader.displayName="RecordsListTableHeader";let _=new p.Ay("modernselling");function RecordsListTablePagination({pageRange:[e,t],totalItems:a,autoClogProps:r,onNextClick:l,onPrevClick:s}){return n.createElement("div",{className:g().records_list_table_pagination},n.createElement(i.Nm,{"aria-label":_.t("Previous page"),autoClogProps:r,disabled:!s,onClick:s},n.createElement(o.Ah,{name:"caret-left",size:"16"})),n.createElement("span",null,_.t("Showing {start}-{end} of {totalItems}",{start:e+1,end:t,totalItems:a})),n.createElement(i.Nm,{"aria-label":_.t("Next page"),autoClogProps:r,disabled:!l,onClick:l},n.createElement(o.Ah,{name:"caret-right",size:"16"})))}RecordsListTablePagination.displayName="RecordsListTablePagination";var y=a(0x4c96e5d9),x=a(0x146e4ebc8),v=a(0x174bb7323),E=a(0x1faa3f1ac),k=a(0x1feb18f19),w=a(0x129529b49),S=a(0x11928a844),C=a.n(S);let Stage=e=>n.createElement("div",{className:l()(C().stage,{[C().previous]:"previous"===e.type,[C().current]:"current"===e.type})},n.createElement(s.A,{lines:1,withTooltip:!0},e.children));Stage.displayName="Stage";var A=a(0x113cdbbd7),T=a(0x944e06df),I=a(0x81d6854c),N=a(0xf01a9d50);let M=new p.Ay("modernselling");function MaybeHoverCard({record:e,children:t,shouldHide:a,salesforceOrgId:r}){return a||isGenericRecord(e)?n.createElement(n.Fragment,null,t):n.createElement(w.E,{opportunity:e,salesforceOrgId:r},t)}function MaybeLink({record:e,children:t,shouldHide:a}){return a?n.createElement(n.Fragment,null,t):n.createElement(E.A,{href:e.record_link},t)}MaybeHoverCard.displayName="MaybeHoverCard",MaybeLink.displayName="MaybeLink";let renderRecordDeltaValue=e=>{if(isGenericRecord(e)||!e.amount_change||!e.amount_change_raw)return null;let t=e.amount_raw?.amount||0,a=e.amount_change_raw.amount,r=e.amount_change_raw.percent,l=!t&&100===r,i=`${l?"-":""}${r}%`;return 0x7fffffff===r&&(i=M.t("New")),n.createElement("div",{className:l||a<0?g().amount_change_negative:g().amount_change_positive},n.createElement(s.A,{lines:1,withTooltip:!0},n.createElement("span",{className:"bold"},e.amount_change),n.createElement("span",null," (",i,")")))};renderRecordDeltaValue.displayName="renderRecordDeltaValue";let renderRecordNameValue=(e,t,{isPreview:a,showHoverCard:r},l)=>n.createElement(MaybeHoverCard,{record:e,shouldHide:a||!r,salesforceOrgId:l},n.createElement(MaybeLink,{record:e,shouldHide:!r},n.createElement(E.A,null,n.createElement(s.A,{lines:1},n.createElement(o.Ah,{inline:!0,...(0,N.C)(getObjectType(e))}),n.createElement("span",{className:"margin_left_25 bold"},getRecordName(e)))))),renderOpportunityRecordStageChangeValue=e=>n.createElement(k.c,{space:"75"},n.createElement(Stage,{type:"previous"},e.prev_stage),n.createElement(o.Ah,{name:"arrow-right"}),n.createElement(Stage,{type:"current"},e.stage));renderOpportunityRecordStageChangeValue.displayName="renderOpportunityRecordStageChangeValue";let renderOpportunityRecordRichTextValue=(e,t)=>"close_date_change"===t.payload_field?n.createElement(T.A,{blocks:e.close_date_change?.blocks,blocksContainerContext:A.pi.sales_home_notification}):n.createElement(k.c,{space:"75"},n.createElement(I.A,null));renderOpportunityRecordRichTextValue.displayName="renderOpportunityRecordRichTextValue";let renderOpportunityRecordStageValue=e=>n.createElement(Stage,{type:"current"},e.stage);renderOpportunityRecordStageValue.displayName="renderOpportunityRecordStageValue";let renderRecordValueAsString=(e,t)=>n.createElement(s.A,{lines:1,withTooltip:!0},n.createElement("span",{className:t.primary_sort?"bold":void 0},(0,v.A)(getRecordField(e,t.payload_field))));function renderRecordValue(e,t,a,n){return isGenericRecord(e)?renderGenericRecordValue(e,t,a):renderOpportunityRecordValue(e,t,a,n)}function renderOpportunityRecordValue(e,t,a,n){switch(t.type){case"name":return renderRecordNameValue(e,t,a,n);case"stage":return renderOpportunityRecordStageValue(e);case"stage_change":return renderOpportunityRecordStageChangeValue(e);case"rich_text":return renderOpportunityRecordRichTextValue(e,t);case"delta":return renderRecordDeltaValue(e,t,a);default:return renderRecordValueAsString(e,t,a)}}function renderGenericRecordValue(e,t,a,n){return"name"===t.type?renderRecordNameValue(e,t,a,n):renderRecordValueAsString(e,t,a)}let L=new p.Ay("modernselling");function RecordsListTableRow({columns:e,isFocused:t,isPreview:a,record:r,salesforceOrgId:i,notificationCreatedTs:o,isLastRow:s,isWorkflowPreview:c}){let[d,u]=(0,n.useState)(!1),m=(0,n.useMemo)(()=>{if(a)return[];let e=getRecordKey(r);return[{key:"opportunity-share-button",enabled:!!o,render:()=>e&&o&&n.createElement(x.V,{hasFocus:!!t,createdTs:o,notificationType:"record",isAdminCreated:!0,opportunityId:e})}].filter(({enabled:e=!0})=>e)},[a,r,o,t]),p=!a&&m.length>0,b=(0,n.useCallback)(()=>u(!0),[]),f=(0,n.useCallback)(()=>u(!1),[]),h=!a,_=n.createElement("div",{onPointerOver:b,onPointerLeave:f,className:l()(g().records_list_table_row,g().records_list_table_row_body,{[g().records_list_table_row_border]:!s}),style:h?{cursor:"pointer"}:void 0},e.map(t=>c?n.createElement("div",{key:t.name,className:l()(g().records_list_table_cell,g().preview_table_cell,getDisplayTypeClassNames("standard").background)}):n.createElement("div",{key:t.name,className:l()(g().records_list_table_cell,{[g().records_list_table_cell_2_col]:2===e.length})},renderRecordValue(r,t,{isPreview:a,showHoverCard:!1},i))),p&&n.createElement("div",{className:l()(g().records_list_action_bar_container,p&&(t||d)&&g().records_list_action_bar_container_visible)},m.map(({key:e,render:t})=>n.createElement(n.Fragment,{key:e},t()))));return h?n.createElement(y.Ay,{tip:L.t("Open Record"),position:"top"},_):_}RecordsListTableRow.displayName="RecordsListTableRow";var O=a(0x106809bc6);function getPageRange(e,t,a){return[(0,O.A)(e,0,a-1),(0,O.A)(e+t,t,a)]}function usePagination(e,{pageSize:t}){let[a,r]=(0,n.useState)(0);(0,n.useEffect)(()=>r(0),[t]);let l=e.length,i=Math.ceil(l/t),o=a>=t,s=a<l-t,c=(0,n.useCallback)(()=>r(0),[]),d=(0,n.useCallback)(()=>r(e=>e-t),[t]),u=(0,n.useCallback)(()=>r(e=>e+t),[t]),m=(0,n.useMemo)(()=>getPageRange(a,t,l),[a,t,l]);return{page:(0,n.useMemo)(()=>e.slice(...m),[e,m]),prev:o?d:void 0,next:s?u:void 0,range:m,reset:c,totalPages:i}}var F=a(0x754ea859),D=a(0xc0b7c558);function RecordsListTable({columns:e,displayType:t,isPreview:a,records:r,paginationAutoClogProps:i,salesforceOrgId:o,notificationCreatedTs:s,isWorkflowPreview:p,isStepPreview:b}){let[f,h]=(0,n.useState)(!1),[_,y]=(0,n.useState)(()=>getInitialSortByValue(e)),x=getDisplayTypeClassNames(t),{page:v,reset:E,...k}=usePagination((0,n.useMemo)(()=>p?[...r]:[...r].sort((e,t)=>{let a="asc"===_.dir,n=isGenericRecord(e)?getGenericRecordValue(e,_):(0,d.A)(e,_.key),r=isGenericRecord(t)?getGenericRecordValue(t,_):(0,d.A)(t,_.key);return("string"==typeof n&&"string"==typeof r&&(n=n.toLocaleUpperCase(),r=r.toLocaleUpperCase()),void 0===n)?1:void 0===r?-1:n<r?a?-1:1:n>r?a?1:-1:0}),[p,r,_]),{pageSize:5}),w=(0,n.useCallback)(e=>()=>{E(),y(({key:t,dir:a})=>({key:e,dir:e===t&&"asc"===a?"desc":"asc"}))},[E]),S=(0,n.useCallback)(e=>{let a=getColumnSortField(e);return n.createElement(RecordsListTableHeader,{key:e.name,column:e,displayType:t,isSortAsc:"asc"===_.dir,isSortKey:!p&&a===_.key,onClick:w(a)})},[_,w,t,p]),C=(0,n.useCallback)((r,{hasFocus:l,hasFocusWithin:i})=>n.createElement(RecordsListTableRow,{key:getRecordKey(v[r]),columns:e,displayType:t,isFocused:l||i,isPreview:a,record:v[r],salesforceOrgId:o,notificationCreatedTs:s,isLastRow:r===v.length-1,isWorkflowPreview:p}),[v,e,t,a,o,s,p]),A=(0,n.useCallback)(()=>h(!0),[]),T=(0,n.useCallback)(()=>h(!1),[]),I=(0,c.wA)(),N=(0,n.useCallback)(e=>{I((0,F.c)({recordId:v[e.id].slack_record_id??(0,D.j)(o,getRecordKey(v[e.id]))}))},[I,v,o]);return n.createElement("div",{onPointerOver:A,onPointerLeave:T,className:l()(x.background,g().records_list_table,{[g().records_list_table_workflow_preview]:p,[g().records_list_table_workflow_step_preview]:b})},n.createElement("div",{className:g().records_list_table_row},e.map(S)),n.createElement(u.A,{disableHeight:!0},({width:e})=>n.createElement(m.A,{keys:Object.keys(v),width:e,height:51*v.length,rowRenderer:C,onItemClick:a?void 0:N,containerClassName:l()(g().records_list_table_rows_container,f&&!p?x.borderDark:x.border)})),k.totalPages>1&&n.createElement(RecordsListTablePagination,{pageRange:k.range,totalItems:r.length,autoClogProps:i,onNextClick:k.next,onPrevClick:k.prev}))}RecordsListTable.displayName="RecordsListTable";var P=a(0x3711e82d);let R=n.memo(({columns:e,displayType:t="standard",isWorkflowPreview:a,isExpandedByDefault:r=a,isPreview:c,isStepPreview:d,records:u,title:m,workflowId:p,salesforceOrgId:b,notificationCreatedTs:f})=>{let[h,_]=(0,n.useState)(r),y=(0,n.useCallback)(()=>_(e=>!e),[]),x=getDisplayTypeClassNames(t),v=(0,n.useCallback)(e=>{if(!c)return{onClick:{enableClogAction:!0},eventId:P.EventId.LOB_NOTIFICATIONS,elementName:e,workflowId:p}},[p,c]);return n.createElement("div",{className:l()(g().records_list_container,{[g().preview_not_expanded]:a&&!h})},n.createElement(i.Nm,{autoClogProps:v("expand_notification"),className:l()(x.text,x.background,g().records_list_toggle,h&&g().records_list_toggle_expanded),onClick:y},n.createElement(o.Ah,{name:h?"caret-down-filled":"caret-right-filled",size:"20"}),a?n.createElement(s.A,{withTooltip:!0,lines:1},n.createElement("span",{className:g().records_list_title},m)):n.createElement(n.Fragment,null,n.createElement("span",{className:g().records_list_title},m),n.createElement("span",{className:x.text},u.length))),h&&n.createElement(RecordsListTable,{columns:e,displayType:t,isPreview:c,records:u,paginationAutoClogProps:v("show_more"),salesforceOrgId:b,notificationCreatedTs:f,isWorkflowPreview:a,isStepPreview:d}))})},0x1c2513fa3:(e,t,a)=>{"use strict";a.d(t,{y:()=>BaseActionLibraryModal});var n,r=a(0xbad225b5),l=a(0x16cf1da63),i=a(0x120c268ad),o=a.n(i),s=a(0x14fad6485),c=a(0x20482ad21),d=a(0x189615fa),u=a(0x2b7f0bcc),m=a(0x15fb82076),p=a(0x1b88224f9),b=a(0xe874a88a),f=a(0x22a29f141),g=a(0x1dfdeb1c8),h=a(0x1ec68d6a3),_=a(0xe747dd27);let y=(0,g.A)("platform.requests.create generated fetcher",(e,t,a)=>new b.S((n,r)=>{let{abortSignal:l,reason:i,...o}=a,s=(0,_.VA)(o);e((0,f.apiCall)({method:"platform.requests.create",args:s,abortSignal:l,reason:i})).then(e=>{n(e)}).catch(e=>{(0,h.default)({getState:t}).error(`API call to platform.requests.create
						with reason ${i} failed, initiated by generated fetcher`),r(e)})}));y.meta={name:"platformRequestsCreateFetcher",key:"createFetcherPlatformRequestsCreateFetcher",description:"platform.requests.create generated fetcher"};var x=a(0x226892387),v=a(0x110d7b067),E=a(0x19561ce96),k=a(0x184767f39);let w=new c.Ay("workflow_builder"),{READY:S,CONFIGURATION_MISSING:C,CONFIGURATION_REQUESTED:A}=k.aW;function StepConfigurationRequiredBanner({id:e,appName:t,is3pTrigger:a=!1,displaySimpleAlert:n,className:i="",icon:o}){let s,c=(0,l.wA)(),[d,b]=(0,r.useState)(!1),[f,g]=(0,r.useState)(!1),h=e??"",[_,k]=(0,r.useState)(!1),[T,I]=(0,r.useState)(!1),N=(0,r.useCallback)(()=>I(!0),[I]),M=(0,r.useCallback)(async()=>{let e;try{g(!0),e=await c(y({requestType:"connector_config_request",entityId:h,reason:"request-step-configuration-within-workflow-builder"})).finally(()=>{g(!1)})}catch(e){b(!0)}e||b(!0),k(!0),c((0,v.yu)({appId:h})),I(!1)},[h,c]),L=(0,r.useCallback)(()=>I(!1),[I]),O=(0,x.d4)(e=>(0,E.$E)(e,h));if(O===S)return null;switch(_?A:O){case C:s=w.rt("{category} {type} require configuration. <button>Request help from an admin</button>",{category:t,type:a?"events":"steps"},({tag:e,text:t})=>"button"===e?r.createElement(m.A,{onClick:N},t):null);break;case A:s=w.rt("{category} {type} require configuration. Your Admin has already been notified.",{category:t,type:a?"events":"steps",fallbackHash:"084c0ae4b9cb4eaf927e434b8166b6ea80efd100"});break;default:s=""}let F=w.rt("There was an error while requesting a configuration. Please try again or let us know if this happens again.");return n?r.createElement(u.Ay,{icon:o,type:o?u.QE.boxed:u.QE.inline,level:u.A_.warning,align:u.AO.left,className:i},r.createElement("span",null,w.rt("{category} {type} require admin configuration.",{category:t,type:a?"events":"steps",fallbackHash:"17a07273a9e2d38955d32bf2e9d7bb6571b8caae"}))):r.createElement("div",null,r.createElement(u.Ay,{icon:o,type:o?u.QE.boxed:u.QE.inline,level:d?u.A_.error:u.A_.warning,align:u.AO.left,className:`${i} margin_top_100 margin_bottom_100 margin_right_50`},r.createElement("span",null,d?F:s)),T&&r.createElement(p.A,{title:w.rt("Request {category} configuration help",{category:t}),onSubmit:M,submitButtonIsLoading:f,onCancel:L,onClose:L,submitButtonText:w.t("Submit")},w.rt("Slackbot will send you a direct message when your request is processed.")))}StepConfigurationRequiredBanner.displayName="StepConfigurationRequiredBanner";var T=a(0x219fde2f3),I=a.n(T);let{INSTALL_SHOW_STEP_FUNCTION:N,SHOW_STEP_FUNCTION:M}=k.pY,{READY:L}=k.aW,AppConfigurationBanner=({id:e="",name:t})=>{let{getState:a}=(0,l.Pj)(),n=a(),i=(0,E.Ez)(n,e??""),o=(0,E.$E)(n,e??"");return(i===M||i===N)&&o!==L?r.createElement(StepConfigurationRequiredBanner,{id:e,appName:t,className:I().appConfigBanner,icon:"warning",displaySimpleAlert:!0}):null};AppConfigurationBanner.displayName="AppConfigurationBanner";var O=a(0x236ed4d73),F=a(0xba7d6f5f),D=a(0x20aa03c9b),P=a(0x10da1e25d),R=a(0x66c6b26d),B=a(0x126492ec6),W=a(0x20adb28cd);function useActionLibraryNavigation(e,t){let{dispatch:a,getState:n}=(0,l.Pj)(),r=(0,x.d4)((0,R.sx)(t,W.wl)),i=e===P.uB.STEPS?{panelId:"discover",panelType:"category",libraryType:e}:{panelId:"slack",panelType:"category",libraryType:e};return r.length||a((0,B.il)({workflowId:t,type:e,initialState:i})),{navigate:e=>{a((0,B.M2)({workflowId:t,navigationState:e}))},navigateBack:()=>(a((0,B.iy)({workflowId:t})),(0,W.Jn)(n(),t))}}var V=a(0x21343fa5a),H=a(0x18ee7321c),q=a(0x11243fb75),U=a(0x4a312a6e);let CardSection=({section:e,autoFocus:t})=>{let a=(0,r.useCallback)(t=>a=>{e.onItemSelect(t)},[e]),n=(0,r.useRef)(null);(0,V.A)(()=>{t&&n.current&&n.current.focus()});let l=(0,r.useCallback)(e=>{let t=e.id??"";return r.createElement(q.A,{onClick:a(t),className:I().cardSectionListcard,id:t,"aria-label":t},r.createElement("div",{className:`${I().cardButtonIcon} ${e.type}-icon`},r.createElement(U.Jx,{alt:"",name:t,type:e.type})),r.createElement("div",{className:I().cardButtonTitle},e.name))},[a]);return r.createElement(H.A,{ref:n,className:I().cardSectionList,renderItem:l,items:e.items,"aria-label":e.ariaLabel||"list"})};CardSection.displayName="CardSection";var z=a(0x2172ff7ff),j=a(0x1846f5916),G=((n={}).BuiltIn="builtin",n.App="app",n.Workflow="workflow",n.Utility="utility",n),$=a(0xe4a3aa1b),K=a(0x3b8174d2);let CollectionCard=({collection:e})=>{let t=(0,x.d4)(K.Jk),a=e.categories.filter(e=>t[e]).sort((e,a)=>{let n=t[e],r=t[a];return n.type!==G.BuiltIn?r.type!==G.BuiltIn?(0,z.Ay)(n.name,r.name):-1:r.type!==G.BuiltIn?1:(0,z.Ay)(n.name,r.name)}),n=a?.length;if(n<j.$x)return null;let l=[a[0],a[1]];t[l[1]].type===G.BuiltIn&&t[l[0]].type!==G.BuiltIn&&l.reverse();let i=l.map(e=>({type:t[e].type,iconSize:t[e].type===G.BuiltIn?void 0:28,name:e}));return r.createElement("div",{className:o()(I().cardSectionButton,I().collectionCard),"data-qa":"collection-card"},r.createElement("div",{className:I().cardIcons},r.createElement("div",{"data-qa":`${i[0].type}-icon`,className:o()(I().cardButtonIcon,`${i[0].type}-icon`)},r.createElement(U.Jx,{alt:"",iconSize:i[0].iconSize,name:i[0].name,type:i[0].type})),n>1?r.createElement("div",{"data-qa":`${i[1].type}-icon`,className:o()(I().cardButtonIcon,`${i[1].type}-icon`)},r.createElement(U.Jx,{alt:"",iconSize:i[1].iconSize,name:i[1].name,type:i[1].type})):null),r.createElement("div",{className:I().cardButtonTitle},(0,$.oH)(e.id)))};CollectionCard.displayName="CollectionCard";var Y=a(0x23a4b0853),Q=a(0x238b287cf),Z=a(0x3711e82d);let J=new c.Ay("workflow_builder"),SectionContainer=({section:e,onSeeAll:t,children:a})=>{let{data:{totalItemCount:n=0,context:l}={totalItemCount:0},items:i,headerNode:o,displayType:s}=e,c=(0,Q.A)(),d=F.XU.includes(s),[u,m]=(0,r.useState)(!1),p=e.items.length>F.GB,b=(0,r.useCallback)(()=>{d&&m(!0)},[d]),f=(0,r.useCallback)(()=>{t&&t(e.id,l)},[t,l,e.id]),g=d&&p&&!u,h=t&&n>=i.length,_=g?b:h?f:null,y=(0,r.useCallback)(()=>{let e=g?Y.KC.WorkflowActionLibraryCollectionsExpandSectionBtn:Y.KC.WorkflowActionLibraryCollectionsSeeAllBtn;(0,Y.ES)({clogger:c,uiArgs:{step:Z.UiStep.WORKFLOW_EDITOR,action:Z.UiAction.CLICK},uiProperties:{element_name:e,element_type:Z.ElementType.LINK},wbArgs:{is_hermes:!0}}),_?.()},[c,_,g]);return r.createElement("section",{"aria-label":e.ariaLabel,className:e.displayType},r.createElement("div",{className:I().sectionHeading},o),(_||u)&&r.isValidElement(a)&&r.cloneElement(a,{isExpanded:u,headerAction:y||void 0})||a)};SectionContainer.displayName="SectionContainer";let SectionContainerHeaderButton=({section:e})=>{let{data:{totalItemCount:t=0}={totalItemCount:0},items:a,displayType:n}=e,l=F.XU.includes(n),i=e.items.length>F.GB,o=J.t("See more"),s=J.t("See all");return l&&i?r.createElement(m.A,{id:`header-button-${e.id}`,tabIndex:-1,"data-qa":"expand-section-btn"},o):t>=a.length?r.createElement(m.A,{id:`header-button-${e.id}`,tabIndex:-1,"data-qa":"see-all-btn"},s):null};SectionContainerHeaderButton.displayName="SectionContainerHeaderButton";let CollectionCardSection=({section:e,isExpanded:t,headerAction:a,autoFocus:n})=>{let l=(0,r.useMemo)(()=>{let n=a?F.GB+1:F.GB;return e.items.slice(0,t?e.items.length:n)},[a,t,e.items]),i=(0,r.useRef)(null);(0,V.A)(()=>{n&&i.current&&i.current.focus()});let s=e.items.length>F.GB,c=!t&&s?l[l.length-1].id:"",d=(0,r.useCallback)(t=>a=>{e.onItemSelect(t)},[e]),u=(0,r.useCallback)(t=>{if(t.id===c)return r.createElement(q.A,{id:t.id,className:I().headerButton,onClick:a,"aria-labelledby":`header-button-${e.id}`},r.createElement(SectionContainerHeaderButton,{section:e}));let n=(0,$.oH)(t.id);return r.createElement(q.A,{onClick:d(t.id),className:I().cardSectionListItem,id:t.id,"aria-label":n},r.createElement(CollectionCard,{key:t.id,collection:t}))},[a,c,d,e]);return l.length?r.createElement(H.A,{ref:i,className:o()(I().cardSectionList,I().collections),renderItem:u,items:l,initialActiveItem:t?e.items[F.GB].id:l[0].id,"aria-label":e.ariaLabel||"list"}):null};CollectionCardSection.displayName="CollectionCardSection";var X=a(0x1c371dd8b),ee=a(0x2173e1832),et=a(0x4c96e5d9),ea=a(0xa6f3163b),en=a(0x1ba239227),er=a(0x1ece86d01),el=a(0xd08839a1);let ActionItem=({action:e,selectedActionId:t,processingActionId:a,renderedInListVariant:n,onClick:l})=>{let{getInteractState:i}=(0,D.I)(),s=(0,en.VZ)(e),c=s?e.appId:e.app_id,d="product_level_availability"in e?e?.product_level_availability:void 0,u=d?.is_available,m=s?e.type:void 0,p=i({actionId:e?.id,selectedActionId:t,processingActionId:a,appId:c,isAvailable:u,triggerType:m}),b=(0,r.useMemo)(()=>s?(0,en.y6)(e.type,e.subtype??"",e.serviceConfig):e.callback_id,[e,s]),f=!(0,el.Ew)(p);return r.createElement(ea.A,{tabIndex:-1,"data-qa":s?`main_view_${b}_trigger_action_button`:`main_view_${b}_step_action_button`,className:o()(I().actionButtonWrapper,{[I().isDisabled]:f}),"aria-disabled":f},s?r.createElement(er.w,{triggerType:e,interactState:p,displayAppName:!1,renderedInListVariant:n,onClick:l}):r.createElement(er.w,{functionId:e.id,interactState:p,displayAppName:!1,renderedInListVariant:n,onClick:l}))};ActionItem.displayName="ActionItem";var ei=a(0xdbc82d6d);let TooltipWrapper=({tooltipContent:e,children:t})=>e?r.createElement(et.Ay,{tip:e,zIndex:ee.m.FullScreen},t):r.createElement(r.Fragment,null,t);TooltipWrapper.displayName="TooltipWrapper";let ListSection=({section:e,selectedActionId:t,processingActionId:a,headerAction:n,autoFocus:l})=>{let{getInteractState:i,getTooltip:o}=(0,D.I)(),{data:{totalItemCount:s=0,limit:c=e.items.length,context:d}={totalItemCount:0}}=e,u=(0,r.useRef)(null);(0,V.A)(()=>{l&&u.current&&u.current.focus()});let m=n&&s>c?e.items[e.items.length-1].id:"",p=(0,r.useCallback)(n=>r=>{let l=(0,en.VZ)(n),o=i({actionId:n.id,selectedActionId:t,processingActionId:a,isAvailable:!("product_level_availability"in n)||n?.product_level_availability?.is_available,triggerType:l?n.type:void 0});o!==ei.V.inactive&&o!==ei.V.selected&&o!==ei.V.processing&&e.onItemSelect(n.id,d)},[d,i,a,e,t]),b=(0,r.useCallback)(l=>{let i=(0,en.VZ)(l),s=i?l.label:l.title||"",c=i?l.type:void 0,d=o(l?.id,l&&"title"in l?l?.title:s,l&&"product_level_availability"in l?l?.product_level_availability:void 0,c);if(l.id===m)return r.createElement(q.A,{id:l.id,className:I().headerButton,onClick:n,"aria-labelledby":`header-button-${e.id}`},r.createElement(SectionContainerHeaderButton,{section:e}));let u=l&&"product_level_availability"in l?l?.product_level_availability:void 0,b=(0,F.HB)(Z.UiAction.CLICK),f=(0,F.qB)(l,e.id,{uiStep:`${Y.KC.WorkflowActionLibraryActions}_${l.id}`,enableClogAction:u?.is_available===!1,elementName:`${Y.KC.WorkflowActionLibraryActions}_${l.id}_${u?.is_available?"upgrade_not_required":"upgrade_required"}`,elementValue:"quick-steps"===e.id?Y.it.ActionLibraryContextQuickSteps:Y.it.ActionLibraryContextUtilities});return r.createElement(TooltipWrapper,{tooltipContent:d},r.createElement(q.A,{onClick:p(l),className:I().actionListItem,id:l.id,"aria-label":s},r.createElement(X.A,{actionProps:b,autoClogProps:f},r.createElement(ActionItem,{action:l,renderedInListVariant:"single",selectedActionId:t,processingActionId:a,onClick:p(l)}))))},[o,n,m,p,a,e,t]);return e.items.length?r.createElement(H.A,{ref:u,renderItem:b,items:e.items,initialActiveItem:e.items?.[0].id,"aria-label":e.ariaLabel||"list"}):null};ListSection.displayName="ListSection";var eo=a(0xe9c32bb),es=a(0x2307c0383),ec=a.n(es);let ed=new c.Ay("workflow_builder"),MainErrorView=({actionType:e})=>{let t=e===P.uB.TRIGGERS?ed.t("Triggers"):ed.t("Steps"),a=ed.t("Something went wrong loading workflow {actionTypeText}",{actionTypeText:t.toLowerCase()}),n=ed.t("Please try again in a bit");return r.createElement("div",{className:ec().errorContainer,"data-qa":"action-library-error-state"},r.createElement("div",{className:ec().errorSvg}),r.createElement(eo.Pd,{className:ec().categoryName},a),r.createElement(eo.nB,null,n))};MainErrorView.displayName="MainErrorView";var eu=a(0x32d3ef3d),em=a(0xfa28400d),ep=a(0x4df01f17),eb=a(0x7729d35b),ef=a(0x10bc07ca1),eg=a.n(ef);let PopularCategorySkeleton=()=>{let e=eu.w.loading,t=eu.S.compact;return r.createElement(em.Ay,{entityState:e,isFullWidth:!0,isAutoHeight:!0,isRemovable:!1,size:t},r.createElement("div",{className:eg().popularCategoryContent},r.createElement(eb.A,{entityState:e,suppressDefaultColors:!0}),r.createElement(ep.A,{width:104,height:12,borderRadius:8})))};function PopularCategorySkeletonList({count:e,subtitle:t}){return r.createElement(r.Fragment,null,t&&r.createElement("div",{className:eg().popularCategorySubtitle},t),r.createElement("div",{className:eg().popularCategoryList},Array.from({length:e},(e,t)=>r.createElement(PopularCategorySkeleton,{key:t}))))}PopularCategorySkeleton.displayName="PopularCategorySkeleton",PopularCategorySkeletonList.displayName="PopularCategorySkeletonList";var eh=a(0x9798b7f);let PopularStepSkeleton=()=>{let e=eu.w.loading,t=eu.S.compact;return r.createElement(em.Ay,{entityState:e,isFullWidth:!0,isAutoHeight:!0,isRemovable:!1,size:t},r.createElement("div",{className:eg().popularStepContent},r.createElement(eb.A,{entityState:e,suppressDefaultColors:!0}),r.createElement(eh.A,{entityState:e,size:t})))};function PopularStepSkeletonList({count:e,subtitle:t}){return r.createElement(r.Fragment,null,t&&r.createElement("div",{className:eg().popularStepSubtitle},t),Array.from({length:e},(e,t)=>r.createElement(PopularStepSkeleton,{key:t})))}function PopularContentSkeleton({popularCategoriesSubtitle:e,popularStepsSubtitle:t}){return r.createElement("div",{className:eg().skeletonView,"data-qa":"popular-content-skeleton"},r.createElement(PopularCategorySkeletonList,{count:2,subtitle:e}),r.createElement(PopularStepSkeletonList,{count:5,subtitle:t}))}function TriggerContentSkeleton(){return r.createElement("div",{className:eg().skeletonView,"data-qa":"trigger-content-skeleton"},r.createElement(PopularStepSkeletonList,{count:6}))}PopularStepSkeleton.displayName="PopularStepSkeleton",PopularStepSkeletonList.displayName="PopularStepSkeletonList",PopularContentSkeleton.displayName="PopularContentSkeleton",TriggerContentSkeleton.displayName="TriggerContentSkeleton";let e_=new c.Ay("workflow_builder");function SkeletonContent({actionType:e}){let t=e===P.uB.TRIGGERS,a=e_.t("Discover workflow triggers"),n=e_.t("Popular categories"),l=e_.t("Quick steps");return r.createElement(r.Fragment,null,r.createElement(O.A,{name:t?a:""}),t?r.createElement(TriggerContentSkeleton,null):r.createElement(PopularContentSkeleton,{popularCategoriesSubtitle:n,popularStepsSubtitle:l}))}SkeletonContent.displayName="SkeletonContent";let MainView=({sections:e,headerNode:t,actionType:a,isLoading:n,hasError:l,navigationMethods:i,selectedActionId:o,processingActionId:s,autoFocusContent:c})=>{let d=(0,r.useCallback)((e,t)=>{let a=c&&0===t;switch(e.displayType){case P.FO.List:return r.createElement(ListSection,{key:e.id,autoFocus:a,section:e,processingActionId:s,selectedActionId:o});case P.FO.Card:return r.createElement(CardSection,{key:e.id,autoFocus:a,section:e});case P.FO.CollectionCards:return r.createElement(CollectionCardSection,{key:e.id,autoFocus:a,section:e});default:return null}},[c,s,o]);return l?r.createElement(MainErrorView,{actionType:a}):r.createElement("div",{className:I().main},n?r.createElement(SkeletonContent,{actionType:a}):r.createElement(r.Fragment,null,t,e.map((e,t)=>r.createElement(SectionContainer,{key:e.id,section:e,onSeeAll:i.setCategoryId},d(e,t)))))};MainView.displayName="MainView";var ey=a(0x1a7251dad),ex=a(0x2501a2cee),ev=a(0x17a5d3eab);let SidebarItemSkeleton=()=>r.createElement("div",{className:eg().skeletonSidebarItem,"data-qa":"sidebar-item-skeleton"},r.createElement(ep.A,{width:20,height:20,borderRadius:4}),r.createElement(ep.A,{width:144,height:8,borderRadius:8}));function SidebarItemSkeletonList({count:e}){return r.createElement(r.Fragment,null,Array.from({length:e},(e,t)=>r.createElement(SidebarItemSkeleton,{key:t})))}SidebarItemSkeleton.displayName="SidebarItemSkeleton",SidebarItemSkeletonList.displayName="SidebarItemSkeletonList";var eE=a(0x1f35a0f5),ek=a(0xa7a4ed65),ew=a(208233e3),eS=a.n(ew);let eC=new c.Ay("workflow_builder"),Sidebar=({setSelectedCategoryId:e,selectedCategoryId:t,categories:a,staticCategoryIds:n,shouldFocusSearchButton:l,toggleSearchMode:i,actionType:s,isLoading:c=!1,hasError:d=!1})=>{let u=(0,r.useRef)(null),m=(0,r.useRef)(null),p=c||d,b=s===P.uB.STEPS?"step":"trigger",f=eC.t("Select {actionTypeLabel} categories",{actionTypeLabel:b,fallbackHash:"8b5f827237793a74978d5d3e15298abe2fc91f7d"}),g=(0,r.useMemo)(()=>({id:ek.Dd,name:eC.t("Discover"),functions:[],type:ek.Dd}),[]),h=(0,r.useMemo)(()=>{let e=Object.values(a).sort(en.Xl);return n.length>0?[g,...e]:e},[a,g,n.length]),_=(0,r.useMemo)(()=>({placeHolderTriggers:eC.t("Search triggers\u2026"),placeHolderSteps:eC.t("Search steps\u2026"),triggersButtonLabel:eC.t("Search triggers"),stepsButtonLabel:eC.t("Search steps")}),[]),y=s===P.uB.TRIGGERS?_.placeHolderTriggers:_.placeHolderSteps,x=s===P.uB.TRIGGERS?_.triggersButtonLabel:_.stepsButtonLabel,v=(0,r.useCallback)(()=>{i(!0)},[i]),E=(0,r.useCallback)(a=>n=>{a.id!==t&&e(a.id,Y.it.ActionLibraryContextSidebar)},[t,e]),k=(0,r.useCallback)((e,a,n)=>{let l=e.id,i=t===l,s=e.name,c=n[a-1]&&(0,en.fU)(n[a-1])!==(0,en.fU)(e);return r.createElement(q.A,{className:o()(eS().sidebarCategory,{[eS().sidebarCategorySelected]:i,[eS().firstOfType]:c}),"aria-label":eC.t("{categoryName}",{categoryName:s}),onClick:E(e),"data-qa":"sidebar_category_wrapper",key:l,id:l},r.createElement("div",{className:eS().sidebarCategoryListItem,"data-qa":`sidebar_${l}_category_button`},r.createElement(U.Jx,{name:l,type:e.type,iconSize:"20",className:eS().categoryIcon}),r.createElement("span",{className:eS().categoryText,"data-qa":`${l}_sidebar_category_title`},s)))},[E,t]);(0,r.useEffect)(()=>{l&&u.current&&u.current.focus()},[u,l]);let w=(0,r.useMemo)(()=>({uiStep:Z.UiStep.WORKFLOW_EDITOR,action:Z.UiAction.CLICK,elementName:Y.KC.WorkflowActionLibrarySearchBtn,elementType:Z.ElementType.BUTTON,onClick:{enableClogAction:!0}}),[]);return r.createElement(r.Fragment,null,r.createElement("div",{className:eS().sidebarSearchbar},r.createElement(ea.A,{ref:u,autoFocus:l,className:o()(eS().sidebarSearchbarInput,{[eS().isSkeleton]:p}),onClick:v,"data-qa":"action-library-typeahead-input-button","aria-label":x,autoClogProps:w},r.createElement("div",{className:eS().sidebarSearchbarInputTextContainer},r.createElement("div",{className:eS().sidebarSearchbarInputTextPrimary},r.createElement(ex.Ah,{name:"search",size:"20",inline:!0}),y),r.createElement(ev.A,{isSidebar:!0})))),r.createElement("div",{className:eS().sidebarDivider},r.createElement(eE.A,null)),r.createElement("div",{className:eS().sidebarList},p?r.createElement(SidebarItemSkeletonList,{count:16}):r.createElement(H.A,{ref:m,renderItem:k,items:h,initialActiveItem:t,"aria-label":f})))};Sidebar.displayName="Sidebar";var eA=a(0x543a781e),eT=a(0x12edaa96a),eI=a(0x14abc22b0),eN=a(0x35514c28),eM=a(0x13b0ddf54),eL=a(0x11a296110),eO=a(0xcdec51d),eF=a.n(eO);let eD=new c.Ay("workflow_builder"),TypeaheadEmptyResult=({clearSearch:e,query:t})=>{let a=eD.rt("No matches found for <b>{queryString}</b>.",{ns:"enterprise_dashboard",queryString:t}),n=eD.t("No matches found.",{ns:"workspace_apps_manage"}),l=eD.t("Clear Search");return r.createElement("div",{id:"empty-state-box",role:"menu","aria-label":n,"data-qa":"action-library-typeahead-empty-result",className:eF().emptyResult},r.createElement(eo.nB,null,a),r.createElement(eL.Ay,{type:"outline",onClick:e},l))};TypeaheadEmptyResult.displayName="TypeaheadEmptyResult";var eP=a(0xb1ea448c),eR=a(0x11113d520),eB=a(0x2a037c8a),eW=a(0xa1832ae4),eV=a(0x9509dfce),eH=a(0x5dd1c0f2),eq=a(0x1e9a6d1d),eU=a(0x1ee439e69);let ez=new c.Ay("workflow_builder"),TypeaheadSuggestion=({id:e,itemIndex:t,itemRef:a,suggestion:n,isFocused:l,onSelect:i,onFocus:s,selectedActionId:c,processingActionId:d,actionType:u})=>{let m=(0,x.d4)(e=>(0,eH.sO)(e,n.appId)),{getInteractState:p,getTooltip:b}=(0,D.I)(),f=u===P.uB.TRIGGERS?n.type:void 0,g=p({actionId:n.id,selectedActionId:c,processingActionId:d,appId:n.appId,isAvailable:n.productLevelAvailability?.isAvailable,triggerType:f}),h=!(0,el.Ew)(g),y=b(n.id,n.title,n.productLevelAvailability?(0,eV.nf)(n.productLevelAvailability):void 0,f),v=ez.t("Category"),E=(0,r.useCallback)(e=>{h||(e.preventDefault(),e.stopPropagation(),0!==e.button||e.ctrlKey||i(n))},[i,n,h]),k=(0,r.useCallback)(()=>{l||s(t,!1)},[l,t,s]),w=n?.icon||n?.appId||"",S="salesforce"===n.appId?eB.M.External:n.type||n.appId&&eB.M.Service||"",C=(0,r.useMemo)(()=>S===eq.A.App||S===eB.M.Service?g===ei.V.requestable?`${ez.t("Request")} ${m?.name}`:g===ei.V.requested?`${ez.t("Requested")} ${m?.name}`:m?.name:n?.categoryLabel,[m?.name,n.categoryLabel,S,g]),A=g===ei.V.selected,T=g===ei.V.processing,I=(0,r.useMemo)(()=>{if(!n.isCategory){if(A)return r.createElement("div",{className:eF().selectedIcon},r.createElement(ex.Ah,{name:"check-filled",size:"16"}));if(T)return r.createElement("div",{className:eF().processing},r.createElement(eP.A,{color:"blue",size:"medium"}))}return r.createElement("span",{className:eF().category},C)},[C,T,A,n.isCategory]),N=(0,x.d4)(eU.H7),M=(0,eW.lk)(N),L=(0,el.EH)(e,n.productLevelAvailability?(0,_.VA)(n.productLevelAvailability):void 0,M);return r.createElement("li",{role:"option",key:e,id:`suggestion-${e}`,ref:a,tabIndex:-1,"aria-selected":l,"aria-label":`${n?.title}, ${!n.isCategory?C:v}`,className:o()({[eF().inFocus]:l&&!(A||T),[eF().selectedFocus]:l&&(A||T),[eF().selectedTypeaheadSuggestion]:A||T}),onMouseDown:E,onMouseMove:k,"aria-disabled":h},r.createElement("div",{className:eF().leftContent},r.createElement(U.Jx,{name:w,type:S,iconSize:"20",alt:""}),r.createElement("span",{className:eF().title},r.createElement("span",null,n?.title),!!y&&r.createElement("span",{className:eF().description},y))),r.createElement("div",{className:eF().rightContent},L.badgeText&&r.createElement(eR.E,{badgeText:L.badgeText,badgeStyle:L.badgeStyle}),I))};TypeaheadSuggestion.displayName="TypeaheadSuggestion";var ej=a(0xb3cd55e4);let eG=new c.Ay("workflow_builder"),SearchTypeahead=({onActionSearch:e,onActionSelected:t,setSelectedCategoryId:a,toggleSearchMode:n,actionType:l,isLoading:i,popularActions:o,selectedActionId:s,processingActionId:c})=>{let d=(0,r.useRef)(null),u=(0,r.useRef)(null),m=(0,r.useMemo)(()=>({}),[]),{sendMessageToAnnouncerAPI:p}=(0,r.useContext)(eI.A),[b,f]=(0,r.useState)([]),[g,h]=(0,r.useState)(o),[_,y]=(0,r.useState)(void 0),[x,v]=(0,r.useState)(""),[E,k]=(0,r.useState)(!1),[w,S]=(0,r.useState)(!1),{getInteractState:C}=(0,D.I)(),A=(0,r.useCallback)(e=>{e.preventDefault(),d?.current?.focus()},[]),T=l===P.uB.TRIGGERS?eG.t("Search workflow triggers"):eG.t("Search workflow steps"),I=eG.t("Instantly search steps from anywhere with"),N=(0,r.useCallback)(()=>{f([]),y(0)},[]),M=(0,r.useCallback)(()=>{N(),v("")},[N]),L=(0,r.useCallback)(async e=>{let r=C({actionId:e.id,selectedActionId:s,processingActionId:c,appId:e.appId,triggerType:l===P.uB.TRIGGERS?e.type:void 0});(0,el.Ew)(r)&&(e.isCategory?a(e.appId||"discover",Y.it.ActionLibraryContextSearch):await t(e.id,Y.it.ActionLibraryContextSearch),M(),n(!1))},[l,C,s,c,M,n,a,t]),O=(0,r.useCallback)(e=>{e>=0&&e<g.length&&d?.current?.setAttribute("aria-activedescendant",`suggestion-${g[e].id}`)},[g]),F=eG.t("Quick steps"),R=eG.t("Popular starting actions"),B=l===P.uB.STEPS?F:R,W=(0,r.useMemo)(()=>{let e=B;return b.length&&(e=eG.t("{count, plural, =1 {# filtered result} other {# filtered results}}",{count:b.length,ns:"enterprise_dashboard"})),e},[B,b.length]),V=(0,eA.A)(W,500);(0,r.useEffect)(()=>{p({message:V,uuid:(0,eT.A)()})},[V,p]),(0,r.useEffect)(()=>{if(!b.length)return x?(y(-1),d?.current?.removeAttribute("aria-activedescendant"),S(!0)):(h(o),void S(!1));h(b),S(!1)},[o,x,b]),(0,r.useEffect)(()=>{g.length&&void 0!==_&&O(_)},[_,g,O]);let H=(0,r.useCallback)(e=>(m[e]||(m[e]=r.createRef()),m[e]),[m]),q=(0,r.useCallback)(e=>{if(!u||!u.current||!m[e]||!m[e].current)return;let t=u.current,a=m[e].current,n=a.offsetTop-t.offsetTop,r=n+a.offsetHeight;n<t.scrollTop&&(t.scrollTop=n),r>t.scrollTop+t.clientHeight&&(t.scrollTop=r-t.clientHeight)},[u,m]),U=(0,r.useCallback)((e,t=!0)=>{y(e),t&&q(e)},[q]),z=(0,r.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),void 0===_?U(0):_<g.length-1&&U(_+1);else if("ArrowUp"===e.key)e.preventDefault(),void 0!==_&&_>0&&U(_-1);else if("Enter"===e.key){if(e.preventDefault(),-1===_||void 0===_)return void M();L(g[_])}else"Escape"===e.key&&(e.preventDefault(),M(),n(!1))},[_,g,U,L,M,n]),j=(0,r.useCallback)(async t=>{let{actions:a,categories:n}=await e(t);f([...a,...n.map(e=>({...e,isCategory:!0}))])},[e]),G=(0,r.useCallback)(async e=>{let t=e?.currentTarget?.value??null;t?.length?(v(t),i)?k(!0):j(t):M()},[i,j,M]);(0,r.useEffect)(()=>{E&&!i&&x&&(j(x),k(!1))},[i,j,E,x]);let $=(0,r.useCallback)(()=>{M(),n(!1)},[M,n]),K=(0,r.useCallback)(()=>{M(),d?.current?.focus()},[M]),Q=(0,r.useRef)(null);return(0,ej.A)(Q,$),r.createElement(eN.A,{hasKeyboardFocusWithin:!0},r.createElement("div",{role:"dialog","aria-label":T,className:eF().typeaheadWrapper,"aria-modal":!0,ref:Q},r.createElement("div",{className:eF().searchBarIcon},r.createElement(ex.Ah,{name:"search-filled",size:"20"})),r.createElement("input",{className:eF().searchBarInput,id:"typeaheadInputId",autoComplete:"off","aria-controls":w?"empty-state-box":"suggestion-box","aria-haspopup":w?"menu":"listbox","aria-autocomplete":"list",role:"combobox","aria-expanded":g.length>0,autoFocus:!0,"data-qa":"action-library-typeahead-input",ref:d,value:x,onChange:G,onKeyDown:z,placeholder:T,maxLength:70}),r.createElement(ea.A,{className:eF().cancelSearch,onClick:$,"data-qa":"cancel-search-mode","aria-label":eG.t("Close search",{ns:"search"})},eG.t("Cancel")),r.createElement("div",{className:eF().typeaheadResults,onFocus:A},b.length||!g.length||w?"":r.createElement("span",{"aria-hidden":!0,className:eF().sectionHeader},B),w&&r.createElement(TypeaheadEmptyResult,{clearSearch:K,query:x}),!w&&r.createElement("ol",{ref:u,id:"suggestion-box",role:"listbox","aria-label":eG.t("Search")},g.map((e,t)=>{let a=g[t-1],n=a&&!a.isCategory&&e.isCategory;return r.createElement("div",{key:e.id},n&&r.createElement(r.Fragment,null,r.createElement(eE.A,null),r.createElement("header",{className:eF().category},eG.t("Categories",{ns:"developer_app_settings"}))),r.createElement(TypeaheadSuggestion,{id:e.id,itemIndex:t,itemRef:H(t),isFocused:t===_,onSelect:L,onFocus:U,suggestion:e,selectedActionId:s,processingActionId:c,actionType:l}))})),g.length?r.createElement("div",{className:eF().overlayFooter,onFocus:A},r.createElement("span",null,I),r.createElement(eM.zG,{slim:!0,label:"CmdOrCtrl"}),r.createElement(eM.zG,{slim:!0,label:"F"})):null)))};SearchTypeahead.displayName="SearchTypeahead";var e$=a(0x1dbeaaa0b),eK=a(0x20570d71a),eY=a(0x1ee062b2e),eQ=a(0x145d46a61),eZ=a(0x1fb2d2a87),eJ=a(0x1fcbb004d),eX=a(0x21d77138c),e0=a.n(eX);let e1=new c.Ay("workflow_builder"),BaseActionLibraryModal=({actionData:e,onActionSearch:t,onActionSelected:a,selectedActionId:n,getStaticPanels:i,type:c,focusSearch:u=!1})=>{let[m,p]=(0,r.useState)(u),[b,f]=(0,r.useState)(!u),{categories:g,collections:h,actions:_}=e,y=(0,eK.Y)(),v=(0,Q.A)(),{getInteractState:E}=(0,D.I)(),{navigate:k,navigateBack:w}=useActionLibraryNavigation(c,y),S=(0,x.d4)((0,R.sx)(y,W.Jn)),C=(0,r.useMemo)(()=>{let e=Object.keys(g);return e.length>0?e[0]:void 0},[g]),{windowRef:A}=(0,r.useContext)(s._0),T=(0,x.d4)(eZ.to),I=(0,r.useRef)(null),N=(0,r.useRef)(null),M=(0,x.d4)(eQ.tQ),L=e1.t("Ways to start"),V=e1.t("Actions"),H=c===P.uB.STEPS?V:L,q=(0,r.useMemo)(()=>{let e=E({actionId:ek.Ez.case_step})===ei.V.inactive;return(0,en.uZ)(c,_,!e)},[_,E,c]),[U,z]=(0,r.useState)(void 0),[j,G]=(0,r.useState)(void 0),[K,J]=(0,r.useState)(!1),[X,ee]=(0,r.useState)(""),et=(0,r.useCallback)(()=>{I.current?.scrollTo(0,0)},[]),ea=(0,r.useCallback)(e=>{z(e),G(void 0),et(),N.current?.querySelector(`#${e}`)?.focus(),J(!0)},[et]),er=(0,r.useCallback)(e=>{G(e),et(),J(!0)},[et]),el=(0,r.useCallback)((e,t)=>{k({panelId:e,panelType:"category",libraryType:c}),(0,Y.E7)({clogger:v,uiArgs:{step:Z.UiStep.WORKFLOW_EDITOR},uiProperties:{element_name:`${Y.KC.WorkflowActionLibraryCategories}_${e}`,element_value:t},wbArgs:{is_hermes:!0}}),ea(e)},[v,k,ea,c]),eo=(0,r.useCallback)(e=>{k({panelId:e,panelType:"collection",libraryType:c}),(0,Y.E7)({clogger:v,uiArgs:{step:Z.UiStep.WORKFLOW_EDITOR},uiProperties:{element_name:Y.KC.WorkflowActionLibraryCollections,element_value:e},wbArgs:{is_hermes:!0}}),er(e)},[v,k,er,c]),es=(0,r.useCallback)(async(e,t)=>{let n=_[e],r=(0,en.VZ)(n);ee(e),k({panelId:n.id,panelType:n.type||"category",libraryType:c}),(0,Y.E7)({clogger:v,uiArgs:{step:Z.UiStep.WORKFLOW_EDITOR},uiProperties:{element_name:`${Y.KC.WorkflowActionLibraryActions}_${e}`,element_value:t},wbArgs:{is_hermes:!0,trigger_type:r?n.type:void 0,trigger_subtype:r&&n.subtype?(0,eY.y)(n.subtype):void 0}}),await a(_[e]),ee("")},[v,_,k,c,a]),ec=(0,r.useCallback)(()=>{let e=w();"category"===e.panelType?ea(e.panelId):"collection"===e.panelType?er(e.panelId):a(_[e.panelId])},[_,w,a,ea,er]),ed=(0,r.useMemo)(()=>({setCollectionId:eo,setCategoryId:el,scrollPanelToTop:et,onNavigateBack:ec,navigate:k}),[et,el,eo,ec,k]),eu=(0,r.useMemo)(()=>i?i(ed):{},[i,ed]),em=(0,r.useMemo)(()=>Object.keys(eu),[eu]);(0,r.useEffect)(()=>{if(!e.isLoading&&!U){let e=em.length>0?em[0]:C,t="category"===S.panelType?S.panelId:void 0;"collection"===S.panelType&&er(S.panelId),z(t||e)}},[e.isLoading,S.panelType,S.panelId,C,U,er,em]);let ep=(0,l.wA)(),eb=(0,r.useCallback)(()=>{ep((0,eJ.O)()),ep((0,B.br)({workflowId:y}))},[ep,y]),ef=(0,r.useCallback)(e=>{p(e),f(!e)},[]);(0,r.useEffect)(()=>{let handleOnFindKeyPress=e=>{!m&&(0,e$.I)(e)&&(e.preventDefault(),ef(!0))};return A.deref()?.document.addEventListener("keydown",handleOnFindKeyPress),()=>{A.deref()?.document.removeEventListener("keydown",handleOnFindKeyPress)}},[m,A,ef]);let eg=U?g[U]:null,eh=j?h[j]:null,e_=eg?.name,ex=e1.t("Select {categoryName} {actionType}",{categoryName:e_,actionType:c}),ev=(0,r.useMemo)(()=>{if(!j&&U&&em.includes(U))return eu[U];if(eh){let e=(0,$.oH)(eh.id);return{headerNode:r.createElement(O.A,{id:eh.id||"",name:e},r.createElement(ey.E,{workflowId:y,onNavigateBack:ec})),sections:(0,F.hL)({collection:eh,categories:g,actions:_,ariaLabel:eh.displayName,onItemSelect:es,sortItems:!0})}}return eg?{headerNode:r.createElement(O.A,{id:eg.id||"",type:eg.type,name:eg.name},r.createElement(ey.E,{workflowId:y,onNavigateBack:ec})),sections:[(0,F.w_)({headerNode:r.createElement(AppConfigurationBanner,{id:eg.id,name:eg.name}),category:eg,actions:_,onItemSelect:es,ariaLabel:ex,sortItems:!0,context:Y.it.ActionLibraryContextCategorySection})]}:{sections:[]}},[j,U,em,eh,eg,eu,y,ec,g,_,es,ex]);return r.createElement(d.A,{className:e0().WFBActionLibrary,maxWidth:"800px",onClose:eb,contentLabel:H,centered:!M,overlayClassName:o()({[e0().modalOverlay]:M})},r.createElement(r.Fragment,null,m&&r.createElement("div",{className:o()(e0().search,{[e0().hasOverlay]:m,[e0().hasDarkOverlay]:m&&"dark"===T})},r.createElement(SearchTypeahead,{onActionSearch:t,onActionSelected:es,setSelectedCategoryId:el,toggleSearchMode:ef,popularActions:q,actionType:c,isLoading:e.isLoading,selectedActionId:n,processingActionId:X})),r.createElement("div",{className:e0().shell},r.createElement("div",{className:e0().left,ref:N},r.createElement(Sidebar,{setSelectedCategoryId:el,selectedCategoryId:U,categories:g,staticCategoryIds:em,shouldFocusSearchButton:b,toggleSearchMode:ef,actionType:c,isLoading:e.isLoading,hasError:!!e.error})),r.createElement("div",{className:e0().right,ref:I},r.createElement(MainView,{sections:ev.sections,headerNode:ev.headerNode,actionType:c,isLoading:e.isLoading,hasError:!!e.error,navigationMethods:ed,selectedActionId:n,processingActionId:X,autoFocusContent:K})))))};BaseActionLibraryModal.displayName="BaseActionLibraryModal"},0x236ed4d73:(e,t,a)=>{"use strict";a.d(t,{A:()=>CategoryHeader});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x20482ad21),o=a(0x4a312a6e),s=a(0x1bb241cc1),c=a(0x2a037c8a);function valueIsInObject(e,t){return Object.values(t).includes(e)}var d=a(0x219fde2f3),u=a.n(d);let m=new i.Ay("workflow_builder"),CategoryHeader=({id:e="",type:t,name:a,children:r})=>{let i=t&&valueIsInObject(t,c.w)?m.t("Events in {name}",{name:a}):a,d=(0,s.S)(u().isPinned);return n.createElement("div",{ref:d,className:l()({[u().hasIcon]:t},u().categoryHeader)},r,t&&n.createElement("div",{key:e,className:`${u().iconWrapper} ${t}-icon`},n.createElement(o.Jx,{name:e||"",type:t})),n.createElement("h2",{className:u().categoryName,"data-qa":"header_category-name"},i))};CategoryHeader.displayName="CategoryHeader"},0xba7d6f5f:(e,t,a)=>{"use strict";a.d(t,{EL:()=>buildCollectionCardSection,GB:()=>m,HB:()=>generateActionClogProps,XU:()=>p,hL:()=>buildCollectionSections,qB:()=>generateAutoClogProps,w_:()=>buildListSection});var n=a(0x19b3ba9fd),r=a(0x20482ad21),l=a(0x2172ff7ff),i=a(0x10da1e25d),o=a(0x1ba239227),s=a(0x23a4b0853),c=a(0x3711e82d),d=a(0x1e9a6d1d);let u=new r.Ay("workflow_builder"),m=3,p=[i.FO.CollectionCards],sortActionsAlphabetical=(e,t)=>{let a=((0,o.VZ)(e)?e.label:e.title)||"",n=((0,o.VZ)(t)?t.label:t.title)||"";return(0,l.Ay)(a,n)},sortSectionsAlphabetical=(e,t)=>e.type===d.A.BuiltIn?t.type===d.A.BuiltIn?(0,l.Ay)(e.name,t.name):1:(0,l.Ay)(e.name,t.name),buildListSection=({id:e,category:t,actions:a,onItemSelect:r,headerNode:l=null,ariaLabel:o,sortItems:s,limit:c,context:d})=>{if(!t)return{id:e||"empty-section",headerNode:l,displayType:i.FO.List,onItemSelect:r,items:[],data:{context:d}};let u=t.functions?.map(e=>a[e]).filter(n.b)||[];s&&(u=u.sort(sortActionsAlphabetical));let m=u.length;return void 0!==c&&(u=u.slice(0,c+1)),{id:e||`${t.name}-section`,headerNode:l,ariaLabel:o,displayType:i.FO.List,onItemSelect:r,items:u,data:{totalItemCount:m,limit:c,context:d}}},buildCollectionCardSection=({id:e,items:t,onItemSelect:a,headerNode:n=null,ariaLabel:r})=>({id:e,headerNode:n,ariaLabel:r,displayType:i.FO.CollectionCards,onItemSelect:a,items:t}),buildCollectionSections=e=>{let{collection:t,categories:a,actions:n,onItemSelect:r,ariaLabel:l,sortItems:o}=e;return t.categories.map(e=>a[e]).filter(e=>e.functions.length).sort(o?sortSectionsAlphabetical:()=>0).map(e=>{let t=u.t("Select {categoryName} {actionType}",{categoryName:e.name,actionType:i.uB.STEPS});return buildListSection({id:e.id,headerNode:e.name,category:e,actions:n,onItemSelect:r,ariaLabel:t||l,sortItems:!0,limit:3,context:s.it.ActionLibraryContextCollections})})};function generateActionClogProps(e){return{onClick:{action:e}}}function generateAutoClogProps(e,t,a={uiStep:`${s.KC.WorkflowActionLibraryActions}_${e.id}`,elementName:`${s.KC.WorkflowActionLibraryActions}_${e.id}`,elementValue:"quick-steps"===t?s.it.ActionLibraryContextQuickSteps:s.it.ActionLibraryContextUtilities,enableClogAction:!0}){let{uiStep:n,elementName:r,elementValue:l,enableClogAction:i}=a;return{eventId:c.EventId.WORKFLOW_BUILDER,uiStep:n,action:c.UiAction.CLICK,elementName:r,elementValue:l,elementType:c.ElementType.BUTTON,appId:e.id,onClick:{enableClogAction:i}}}},0x1b0788a0d:(e,t,a)=>{"use strict";a.d(t,{s:()=>l,xr:()=>o,T8:()=>i});var n=a(0x10da1e25d),r=a(0xa7a4ed65);let l=3,i=[r.Ez.ai_answer,r.Ez.send_message,r.Ez.open_form,r.Ez.case_step,r.Ez.send_dm];r.sV.forms,r.eS.GOOGLE_SHEETS,r.eS.JIRA_CLOUD;let o={[n.uB.STEPS]:i,[n.uB.TRIGGERS]:["Ftt0101","Ftt0104","Ftt0103"]}},0x1c3f9c13e:(e,t,a)=>{"use strict";a.d(t,{I:()=>M,p:()=>ActionCompatibilityProvider});var n,r=a(0xbad225b5),l=a(0x20482ad21),i=a(0x17c7b6bbb),o=a(0xc5f25803),s=a(0x1a5ac3a0c),c=a(0x154dd8295),d=a(0x1795d8821),u=a(0x20cfa1dc2);let m=["builtins_salesforce","builtins_sales_elevate","builtins_salesforce_channels"];var p=((n={}).GENERATIVE_AI="generative_ai",n.THIRD_PARTY="third_party",n.CUSTOM="custom",n.SALESFORCE="salesforce",n);function getWorkflowStepClassifications(e){let t=new Set;if(!e)return t;for(let a of(0,o.a)(e.workflow)){a.function?.callback_id===d.oW.AiAnswer&&t.add("generative_ai"),a.type===u._3.CONNECTOR&&t.add("third_party"),a.type===u._3.CUSTOM&&t.add("custom");let e=a.function?.category_id;e&&m.includes(e)&&t.add("salesforce")}return t}var b=a(0xa7a4ed65);let f=new l.Ay("workflow_builder"),isAiIncompatibleTriggerType=(e,t)=>{let a=[i.vh.Service,i.vh.External];return!1===t&&a.push(i.vh.Webhook,i.vh.HermesWebhook),a.includes(e)},g=[{isBlocked:e=>e.actionId===b.Ez.case_step&&!e.canAddAtCurrentPosition,getBlockedMessage:()=>f.t("You can\u2019t add a branch here")},{isBlocked:e=>!!e.trigger&&e.actionId===b.Ez.ai_answer&&isAiIncompatibleTriggerType(e.trigger.type,e.experiments.wfbAiEnableWebhookTriggersEnabled),getBlockedMessage:e=>e.experiments.experimentWfbAiStepTranslationsGroupOn?f.t("You can\u2019t add this step with this starting action."):"You can\u2019t add this step with this starting action."},{isBlocked:e=>e.actionId===b.Ez.ai_answer&&(e.workflowClassifications.has(p.THIRD_PARTY)||e.workflowClassifications.has(p.CUSTOM)||e.workflowClassifications.has(p.SALESFORCE)),getBlockedMessage:e=>{let{experimentWfbAiStepTranslationsGroupOn:t}=e.experiments;return t?f.t("This step cannot be added to workflows with third-party or Salesforce steps."):"This step cannot be added to workflows with third-party or Salesforce steps."}},{isBlocked:e=>{let t,a;return t=e.categoryId,((a=e.stepType)===u._3.CONNECTOR||a===u._3.CUSTOM||a===u._3.CERTIFIED||void 0!==t&&m.includes(t)||!1)&&e.workflowClassifications.has(p.GENERATIVE_AI)},getBlockedMessage:e=>{let{experimentWfbAiStepTranslationsGroupOn:t}=e.experiments;return t?f.t("This step cannot be added to workflows with AI Generate steps."):"This step cannot be added to workflows with AI Generate steps."}}];function getBlockingRule(e){for(let t of g)if(t.isBlocked(e))return t;return null}let h=[{isBlocked:e=>!!e.workflowClassifications.has(p.GENERATIVE_AI)&&isAiIncompatibleTriggerType(e.triggerType,e.experiments.wfbAiEnableWebhookTriggersEnabled),getBlockedMessage:e=>{let{experimentWfbAiStepTranslationsGroupOn:t}=e.experiments;return t?f.t("This starting action can\u2019t be used with workflows that have AI Generate steps."):"This starting action can\u2019t be used with workflows that have AI Generate steps."}}];function getBlockingTriggerRule(e){for(let t of h)if(t.isBlocked(e))return t;return null}var _=a(0xdbc82d6d),y=a(0xd08839a1),x=a(0x85a83465);let ActionCompatibilityEvaluator=class ActionCompatibilityEvaluator{context;actionRuleCache=new Map;triggerRuleCache=new Map;workflowClassifications;canAddAtCurrentPosition;constructor(e){this.context=e,this.workflowClassifications=getWorkflowStepClassifications(e.hermesWorkflow),this.canAddAtCurrentPosition=((e,t,a)=>{if(!t)return!1;let n=t?.workflow?.steps??[],r=n?.find(c.Z1);if(!a){let t=n.length&&!e||e&&n.findIndex(t=>t.id===e)!==n.length-1;return!!(!r&&!t)}if((0,s.W0)(e,t))return!1;let l=e?(0,s.Dv)(e,t?.workflow):void 0,i=e||(n?.[0]?.id??"");l&&(0,c.Zv)(l)&&(i=l?.steps?.[0]?.id??"");let o=(0,s.o)(i,t?.workflow);return!o.find(c.Z1)&&!(!e&&n&&n.length||o.findIndex(t=>t.id===e)!==o.length-1||o.length&&!o.find(t=>t.id===e))})(e.afterStepId,e.hermesWorkflow,!0)}get currentProductLevel(){return this.context.currentProductLevel}getFunctionMetadata(e){let t=this.context.functionsById[e];return{categoryId:t?.category_id,stepType:t?.stepType}}buildActionRuleContext(e){let{categoryId:t,stepType:a}=this.getFunctionMetadata(e);return{actionId:e,categoryId:t,stepType:a,workflowClassifications:this.workflowClassifications,trigger:this.context.hermesWorkflow?.trigger,canAddAtCurrentPosition:this.canAddAtCurrentPosition,experiments:this.context.experiments}}buildTriggerRuleContext(e){return{triggerType:e,workflowClassifications:this.workflowClassifications,experiments:this.context.experiments}}getBlockingRule(e){let t=this.actionRuleCache.get(e);if(t)return t;let a=getBlockingRule(this.buildActionRuleContext(e));return this.actionRuleCache.set(e,a),a}isActionBlocked(e){return null!==this.getBlockingRule(e)}getActionBlockedMessage(e){let t=this.getBlockingRule(e);if(!t)return null;let a=this.buildActionRuleContext(e);return t.getBlockedMessage(a)}getBlockingTriggerRule(e){let t=this.triggerRuleCache.get(e);if(t)return t;let a=getBlockingTriggerRule(this.buildTriggerRuleContext(e));return this.triggerRuleCache.set(e,a),a}isTriggerBlocked(e){return null!==this.getBlockingTriggerRule(e)}getTriggerBlockedMessage(e){let t=this.getBlockingTriggerRule(e);if(!t)return null;let a=this.buildTriggerRuleContext(e);return t.getBlockedMessage(a)}getDistributionStatus(e){let{connectorAppsInfo:t,wfbDefaultConnectorVisibility:a}=this.context,n=t?.data?.apps?.[e];return n?(0,x.m)({isAppInstalled:n.isInstalled??!1,aaaIsEnabled:t?.data?.isAaaEnabled??!1,appResolution:n.appResolution,isRequestPending:n.isRequestPending??!1,wfbDefaultConnectorVisibility:a}):null}getConfigurationStatus(e){let{connectorAppsInfo:t}=this.context,a=t?.data?.apps?.[e];return(0,x.N)({requiresConfig:a?.requiresConfig,missingRequiredConfig:a?.missingRequiredConfig,isConfigRequestPending:a?.isConfigRequestPending})}getAppInteractState(e){let t=this.getDistributionStatus(e),a=this.getConfigurationStatus(e);return t?(0,y.rG)(t,a):_.V.addable}};var v=a(0x20570d71a),E=a(0x145d46a61),k=a(0xa1832ae4),w=a(0xb1f0729f),S=a(0x66c6b26d),C=a(0x20adb28cd),A=a(0x226892387),T=a(0x19561ce96),I=a(0x3b8174d2),N=a(0x1ee439e69);let M=(0,r.createContext)(null);function ActionCompatibilityProvider({afterStepId:e,children:t}){let a=(0,v.Y)(),n=(0,A.d4)((0,S.sx)(a,C.RG)),l=(0,A.d4)(E.nw),i=(0,A.d4)(E.yH),o=(0,A.d4)(I.cq),s=(0,A.d4)(T.W2),c=(0,A.d4)(w.IN),d=(0,A.d4)(N.H7),u=(0,k.lk)(d),m=(0,r.useMemo)(()=>new ActionCompatibilityEvaluator({hermesWorkflow:n,afterStepId:e,experiments:{experimentWfbAiStepTranslationsGroupOn:l,wfbAiEnableWebhookTriggersEnabled:i},functionsById:o,connectorAppsInfo:s,wfbDefaultConnectorVisibility:c,currentProductLevel:u}),[n,e,l,i,o,s,c,u]);return r.createElement(M.Provider,{value:m},t)}ActionCompatibilityProvider.displayName="ActionCompatibilityProvider"},0x20aa03c9b:(e,t,a)=>{"use strict";a.d(t,{I:()=>useActionItemState});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x1c3f9c13e);function useActionCompatibilityEvaluator(){let e=(0,n.useContext)(l.I);if(!e)throw Error("useActionCompatibilityEvaluator must be used within an ActionCompatibilityProvider. Wrap your component tree with <ActionCompatibilityProvider afterStepId={...}>.");return e}var i=a(0xdbc82d6d);let o=new r.Ay("workflow_builder");function useActionItemState(){let e=useActionCompatibilityEvaluator();return{getInteractState:(0,n.useCallback)(({actionId:t,selectedActionId:a,appId:n,processingActionId:r,isAvailable:l=!0,triggerType:o})=>t&&l?t===a?i.V.selected:t===r?i.V.processing:o&&e.isTriggerBlocked(o)||e.isActionBlocked(t)?i.V.inactive:e.getAppInteractState(n??""):i.V.inactive,[e]),getTooltip:(0,n.useCallback)((t,a,n,r)=>n&&!n?.is_available?e.currentProductLevel===n?.available_to?o.t("This feature is available upon renewal."):o.t("This feature is available with an upgrade."):t&&a?r?e.getTriggerBlockedMessage(r):e.getActionBlockedMessage(t):null,[e])}}},0xca5ff9c9:(e,t,a)=>{"use strict";a.d(t,{Z:()=>BaseErgoBuilderCoachmark});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x13953efe6),i=a(0x3989021c),o=a(0x218842a12),s=a(0xf3c65e54),c=a(0x5b1935a6);o.g.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_TRIGGERS_COACHMARK;let BaseErgoBuilderCoachmark=({children:e,notificationType:t,anchorToBottom:a,titleText:o,bodyText:d,icon:u,disabled:m,coachmarkAnchorClassNames:p})=>{let b=(0,r.wA)(),{closeCoachmark:f,isOpen:g,renderCoachmark:h}=(0,i.A)(t,c.xu.WORKFLOW_BUILDER_COACHMARKS),_=(0,n.useCallback)(()=>{f()},[f]),y=(0,n.useCallback)(()=>{b((0,s.A)({notificationName:t,action:c.hw.IMPRESSION}))},[b,t]);if(!g||m)return n.createElement("div",{className:p},e);let x=h({arrowPosition:50,arrowCenterOnAnchor:!0,bodyText:d,icon:u,centerOnArrow:!0,closeCoachmark:_,onAfterOpen:y,title:o,width:400,isMegaphoneCoachmark:!0});return n.createElement(l.Ay,{coachmarkElement:x,orientation:a?l.YC.Bottom:l.YC.Top,coachmarkAnchorClassNames:p},e)};BaseErgoBuilderCoachmark.displayName="BaseErgoBuilderCoachmark"},0x17a5d3eab:(e,t,a)=>{"use strict";a.d(t,{A:()=>p});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0x1fd3f6e20),o=a(0x3989021c),s=a(0x218842a12),c=a(0x21c50a68b),d=a(0xf3c65e54),u=a(0x5b1935a6);let m=new l.Ay("workflow_builder");s.g.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_NEW_BADGES;let ErgoBuilderNewBadge=({isSidebar:e})=>{let t=(0,r.wA)(),a=(0,c.JK)(),{isOpen:l}=(0,o.A)(u.ze.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_NEW_BADGES,u.xu.WORKFLOW_BUILDER_ACTION_LIBRARY_BADGES),s=(0,n.useMemo)(()=>e&&"fr-FR"===a,[e,a]),p=(0,n.useMemo)(()=>l&&!s,[l,s]),b=(0,n.useCallback)(()=>{l&&t((0,d.A)({notificationName:u.ze.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_NEW_BADGES,action:u.hw.IMPRESSION}))},[t,l]);return(0,n.useEffect)(()=>{b()},[b]),n.createElement(n.Fragment,null,p&&n.createElement(i.v,{isMicro:!0,style:i.u.Informative},m.t("NEW")))};ErgoBuilderNewBadge.displayName="ErgoBuilderNewBadge";let p=ErgoBuilderNewBadge},0x1f8bf90e0:(e,t,a)=>{"use strict";a.r(t),a.d(t,{ErgoBuilderTriggersCoachmark:()=>ErgoBuilderTriggersCoachmark,default:()=>m});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0xca5ff9c9),i=a(0x96aa1794),o=a(0x1a5ac3a0c),s=a(0x218842a12),c=a(0x226892387),d=a(0x5b1935a6);let u=new r.Ay("workflow_builder");s.g.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_TRIGGERS_COACHMARK;let ErgoBuilderTriggersCoachmark=({children:e})=>{let t=(0,i.j)(),a=(0,c.d4)(e=>(0,o.Q)(e,t));return n.createElement(l.Z,{anchorToBottom:!a,notificationType:d.ze.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_TRIGGERS_COACHMARK,titleText:u.t("A new way to add workflow starting actions"),bodyText:u.t("Browse and search for starting actions from Slack and popular connectors with the tools you use every day.")},e)};ErgoBuilderTriggersCoachmark.displayName="ErgoBuilderTriggersCoachmark";let m=ErgoBuilderTriggersCoachmark},0x1fda30635:(e,t,a)=>{"use strict";a.r(t),a.d(t,{COACHMARK_WIDTH:()=>S,MessagePostedTriggerIntroCoachmark:()=>MessagePostedTriggerIntroCoachmark,default:()=>A});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x20482ad21),s=a(0x13953efe6),c=a(0x61c95b1b),d=a(0x96aa1794),u=a(0x1a5ac3a0c),m=a(0x126af815a),p=a(0x3989021c),b=a(0x218842a12),f=a(0x4003bce0),g=a(0xa4606544),h=a(0x226892387),_=a(0x22f6a086f),y=a(0xf3c65e54),x=a(0x5b1935a6);let v=a.p+"message-posted-trigger-coachmark-f76adb2.svg";var E=a(0x243e0d2bb),k=a.n(E);let w=new o.Ay("workflow_builder"),S=437,C=b.g.HERMES_WORKFLOW_BUILDER_COACHMARKS_MESSAGE_POSTED_TRIGGER_INTRO_COACHMARK,MessagePostedTriggerIntroCoachmark=({children:e})=>{let t=(0,r.wA)(),a=(0,d.j)(),l=(0,u.DY)(a),o=(0,h.d4)(e=>(0,u.Q)(e,a)),b=(0,h.d4)(_.cw),[E,A]=(0,n.useState)(!1);(0,n.useEffect)(()=>{!E&&b?.length>0&&b.find(e=>"event"===e.type&&e.subtype===c.$.MessagePosted)&&A(!0)},[b,E]);let{closeCoachmark:T,isOpen:I,renderCoachmark:N}=(0,p.A)(C,x.xu.WORKFLOW_BUILDER_COACHMARKS),M=(0,n.useCallback)(e=>{e?.stopPropagation(),T()},[T]),L=(0,n.useCallback)(()=>{t((0,y.j)({notificationName:C,action:x.hw.IMPRESSION}))},[t]),O=(0,n.useCallback)(()=>{M(),t((0,g.q)({appId:f.D,workflowId:l,type:m.kr,subtype:c.$.MessagePosted}))},[M,t,l]),F=(0,n.useMemo)(()=>n.createElement("div",{className:i()("c-coachmarkv2__hero",k().message_posted_trigger_intro_coachmark_hero)},n.createElement("img",{className:k().message_posted_trigger_intro_coachmark_hero_image,src:v,alt:w.t("Message posted trigger workflow")})),[]);if(!I||!E)return n.createElement(n.Fragment,null,e);let D=N({arrowPosition:10,hero:F,title:w.t("Trigger workflows with specific keywords"),bodyText:w.t("Now you can automatically start a workflow when a message with keywords you choose is posted in a channel. It\u2019s a precise way to automate your most important updates."),primaryCallToActionText:w.t("Try It"),onClickPrimaryButton:O,closeCoachmark:M,closeCoachmarkFromOutsideClick:M,onAfterOpen:L,width:S,isMegaphoneCoachmark:!0,offsetX:0,offsetY:o?7:-7,arrowColor:o?null:"DT_COLOR_PLT_INDIGO_5"});return n.createElement(s.Ay,{coachmarkElement:D,orientation:o?s.YC.Top:s.YC.Bottom,preventPropagation:!0},e)};MessagePostedTriggerIntroCoachmark.displayName="MessagePostedTriggerIntroCoachmark";let A=MessagePostedTriggerIntroCoachmark},0x1a7251dad:(e,t,a)=>{"use strict";a.d(t,{E:()=>NavigationBackButton});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x20482ad21),o=a(0x344bb842),s=a(0x66c6b26d),c=a(0x20adb28cd),d=a(0x226892387),u=a(0x21d77138c),m=a.n(u);let p=new i.Ay("workflow_builder"),b={name:"caret-left-full",size:"20"},NavigationBackButton=({workflowId:e,onNavigateBack:t,isSegmentModal:a=!1,isRequestAppModal:r=!1})=>{let i=(0,d.d4)((0,s.sx)(e,c.wl)).length>1;return n.createElement(n.Fragment,null,i?n.createElement(o.A,{onClick:t,"aria-label":p.t("Back"),svgIconProps:b,className:l()(m().backButton,{[m().isSegmentModal]:a,[m().isRequestAppModal]:r}),"data-qa":"back-button-category-header"}):null)};NavigationBackButton.displayName="NavigationBackButton"},0x1ee6256b0:(e,t,a)=>{"use strict";a.d(t,{G:()=>TriggersLibraryModal});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x1f7facc5c),i=a(0x1c2513fa3),o=a(0x1c3f9c13e),s=a(0x20aa03c9b),c=a(0x10da1e25d),d=a(0xd08839a1),u=a(0x2a037c8a),m=a(0x1fffc0b54),p=a(0xa4606544),b=a(0x66c6b26d),f=a(0x126492ec6),g=a(0x24fc5dd2c),h=a(0x20adb28cd),_=a(0x226892387),y=a(0x95c66692),x=a(0x22f6a086f);let v=(0,a(0x11c82607b).Ay)("search triggers and categories for a given query string",async(e,t,a)=>{let n=t();return{matchingTriggers:(0,x.Wk)(n,a),matchingCategories:(0,x.pk)(n,a)}});v.meta={name:"searchTriggersAndCategories",key:"createThunkSearchTriggersAndCategories",description:"search triggers and categories for a given query string"};var E=a(0x46dbff89);let TriggersLibraryModalContent=({focusSearch:e=!1,workflowId:t})=>{let a=(0,r.wA)(),o=(0,_.d4)(x.cw),k=(0,_.d4)(x.Fv),w=(0,_.d4)(m.YS),S=(0,_.d4)(m._u),C=(0,_.d4)((0,b.sx)(t,h.RX)),{getInteractState:A}=(0,s.I)(),T=(0,n.useCallback)(()=>{a((0,f.iy)({workflowId:t})),a((0,E.q)({element:n.createElement(TriggersLibraryModal,{workflowId:t})}))},[a,t]),I=(0,n.useCallback)((e,n)=>a((0,p.q)({appId:n,workflowId:t,type:e.type,subtype:e.subtype,serviceConfig:e.serviceConfig,onNavigateBack:T})),[a,T,t]),N=(0,n.useCallback)(e=>a((0,E.q)({element:n.createElement(l.u,{appId:e})})),[a]),M=(0,n.useMemo)(()=>{let e=o.find(e=>(0,g.k)(e.type)===C?.type&&e.subtype===C.subtype);return e?.id},[o,C]),L=(0,n.useMemo)(()=>({categories:k,collections:{},actions:o.reduce((e,t)=>(e[t.id]=t,e),{}),isLoading:w,error:S??void 0}),[w,S,k,o]),O=(0,n.useCallback)(async e=>{let t=e.serviceConfig?.function?.app_id||"",n=A({actionId:e.id,selectedActionId:M,appId:t,triggerType:e.type});if((0,d.Ew)(n)){if(e.type===u.w.Service)return void a((0,y.u)({appId:t,onOpenModal:()=>I(e,t),onRequestAppModal:()=>N(t)}));I(e,t)}},[a,A,N,I,M]),F=(0,n.useCallback)(async e=>{let{matchingTriggers:t,matchingCategories:n}=await a(v(e));return{actions:t,categories:n}},[a]);return n.createElement(i.y,{type:c.uB.TRIGGERS,onActionSelected:O,onActionSearch:F,actionData:L,selectedActionId:M,focusSearch:e})};function TriggersLibraryModal({focusSearch:e=!1,workflowId:t}){return n.createElement(o.p,{afterStepId:void 0},n.createElement(TriggersLibraryModalContent,{focusSearch:e,workflowId:t}))}TriggersLibraryModalContent.displayName="TriggersLibraryModalContent",TriggersLibraryModal.displayName="TriggersLibraryModal"},0x10da1e25d:(e,t,a)=>{"use strict";a.d(t,{FO:()=>i,uB:()=>l});var n,r,l=((n={}).STEPS="steps",n.TRIGGERS="triggers",n),i=((r={}).Card="card",r.CollectionCards="collection-cards",r.List="list",r)},0x1ba239227:(e,t,a)=>{"use strict";a.d(t,{VZ:()=>isTriggerTypeApiAction,Xl:()=>sortCategories,fU:()=>getItemGroup,uZ:()=>getDefaultSearchResults,y6:()=>deriveHumanReadableTriggerId});var n=a(0x35d46650),r=a(0x2172ff7ff),l=a(0x61c95b1b),i=a(0x1b0788a0d),o=a(0x10da1e25d),s=a(0x126af815a),c=a(0x2a037c8a),d=a(0x24fc5dd2c),u=a(0xa7a4ed65),m=a(0x1e9a6d1d),p=a(0x20cfa1dc2);let b="third_party_category",isTriggerTypeApiAction=e=>"icon"in e&&"group"in e;function getItemGroup(e){if(!e||!("functions"in e))return"";let t=[m.A.App,p._3.CERTIFIED,p._3.CONNECTOR,p._3.CUSTOM],a=e.type===c.w.External?c.w.Service:e.type;return t.includes(e.type)?b:a}let getDefaultSearchResults=(e,t,a=!0)=>(e===o.uB.TRIGGERS?i.xr[e].map(e=>t[e]?{id:e,title:t[e].label,icon:t[e].icon,type:t[e].type,appId:t[e].appId,categoryLabel:"internal"===t[e].group?"Slack":"",isCategory:!1}:null):i.xr[e].map(e=>t[e]?{id:e,title:t[e].title||"",type:t[e].type,appId:t[e].app_id||t[e].callback_id,categoryLabel:t[e].category_label,isCategory:!1,productLevelAvailability:{isAvailable:t[e].product_level_availability?.is_available??!0,availableTo:t[e].product_level_availability?.available_to}}:null)).filter(e=>{if(e?.id===u.Ez.case_step)return a;let n=t[e?.id||""];return!n||!("is_hidden"in n)||!n.is_hidden}).filter(n.b).slice(0,i.s),f=[m.A.BuiltIn,b,c.w.Event,c.w.Shortcut,c.w.Scheduled,c.w.Webhook,c.w.External,c.w.Service].reduce((e,t,a)=>(e[t]=a,e),{}),sortCategories=(e,t)=>{let a=f[getItemGroup(e)],n=f[getItemGroup(t)];return a!==n?a>n?1:-1:(0,r.Ay)(e.name,t.name)},g={[s.zW]:"from_a_link",[s.LO]:"on_a_schedule",[`${s.kr}${l.$.UserJoinedChannel}`]:"member_joins_channel",[`${s.kr}${l.$.ReactionAdded}`]:"emoji_reaction",[`${s.kr}${l.$.ListRecordUpdated}`]:"list_record_updated",[s.bX]:"from_webhook",[s.SJ]:"salesforce_event"},deriveHumanReadableTriggerId=(e,t,a)=>{let n=(0,d.k)(e),r=g[`${n}${t}`];if(r)return r;if(n===c.w.Service){let e=(a?.function.app?.name??"").replace(/\s/g,"").toLowerCase(),n=t.split("/").pop();return`${e}__${n}`}return t??n}},0x1ca293e13:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var n=a(0xbad225b5),r=a(0x11ad04567),l=a.n(r);let AvatarPaneContent=({children:e})=>n.createElement("div",{className:l().modal_main_content},e);AvatarPaneContent.displayName="AvatarPaneContent";let i=AvatarPaneContent},0x2440854b3:(e,t,a)=>{"use strict";a.d(t,{DV:()=>d,P1:()=>s,Vt:()=>l,Yh:()=>n,dW:()=>o,fw:()=>c,g_:()=>r,i_:()=>u,w3:()=>i});let n=128,r=2e3,l=460,i=2097152,o="too_small",s="too_large",c="max_size",d="invalid_type",u=["image/gif","image/png","image/jpeg"]},0x15ab42d61:(e,t,a)=>{"use strict";a.d(t,{_:()=>AvatarCropPane});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0x11a296110),o=a(0x1e586fbba),s=a(0x127218dbe),c=a(0x1ca293e13),d=a(0x2440854b3),u=a(0x11ad11f0e),m=a(0x339b339c),p=a(0x113a45767),b=a(0x170214077),f=a(0x6792c5b4),g=a(0x1c9784a36),h=a.n(g);let _=new l.Ay("edit_profile"),AvatarCropPreview=({crop:e,minSize:t,maxSize:a,image:r,workflowName:l,workflowDescription:i})=>{let o=(0,n.useMemo)(()=>n.createElement(p.$,{crop:e,image:r,imageDisplaySize:a,previewDisplaySize:t}),[e,r,a,t]),s=(0,n.useMemo)(()=>({type:"message",ts:(0,u.A)(Date.now()),channel:"C12345678",text:"\xa1Hola Mundo!",user:"W1W832GG1"}),[]);return n.createElement("div",{className:h().crop_preview_image_container},n.createElement("div",{className:h().crop_preview_image_label},_.t("Preview")),n.createElement(f.A,{compact:o,light:o},n.createElement("strong",null,l),"\xa0\xa0",n.createElement(b.A,{msg:s}),n.createElement("br",null),n.createElement(n.Fragment,null,i||n.createElement(m.A,{size:"large"}))))};AvatarCropPreview.displayName="AvatarCropPreview";var y=a(0x24de3d958),x=a(0x20e80190e),v=a(0x1ed79bf71),E=a(0x6dbb4c86),k=a.n(E);let w=new l.Ay("workflow_builder"),AvatarCropPane=({onClose:e,setOnCropImagePane:t,switchPane:a,prevPane:l,avatarUrl:u="",workflowName:m,imageId:b="",workflowDescription:f,nextPane:g,showPreview:h=!0,setIconUrl:_})=>{let[E,S]=(0,n.useState)(!1),[C,A]=(0,n.useState)(!1),[T,I]=(0,n.useState)({height:36,width:36,x:0,y:0}),{cropData:N,imageData:M}=(0,y.K)(u,T),L=(0,r.wA)(),O=(0,n.useMemo)(()=>({width:M.width||36,height:M.height||36,src:M.src}),[M]),F=(0,n.useCallback)(()=>{t&&t(!1),a(l)},[l,t,a]),D=(0,n.useCallback)(()=>{S(!0),A(!1),L((0,v.z_)({x:N.fullCropX,y:N.fullCropY,width:N.fullCropSize,id:b})).then(({url:n=""})=>{_(n),g?(t&&t(!1),a(g)):e()}).catch(()=>{A(!0),S(!1)})},[L,N.fullCropX,N.fullCropY,N.fullCropSize,b,_,g,t,a,e]);return n.createElement(n.Fragment,null,n.createElement(x.rQ,null,n.createElement(s.A,{"data-qa":"avatar_crop_pane_back_button",onClick:F}),n.createElement(x.Rc,{"data-qa":"avatar_crop_pane_header",title:w.t("Crop your photo")})),n.createElement(x.$m,null,n.createElement(x.qf,{className:"center_content"},C&&n.createElement(o.A,null,w.t("Sorry! Something went wrong. Please try again.")),n.createElement("div",null,n.createElement(c.A,null,n.createElement(p.A,{className:k().cropper,imageSrc:u,maxSize:d.g_,minSize:d.Yh,onChange:I})),h&&n.createElement("div",{className:"center_content"},n.createElement(AvatarCropPreview,{crop:T,image:O,workflowName:m,workflowDescription:f,minSize:36,maxSize:d.Vt,avatarUrl:u}))))),n.createElement(x.jl,null,n.createElement(x.ox,null,n.createElement(i.Ay,{"data-qa":"avatar_crop_cancel_button",onClick:F,type:"outline"},w.t("Cancel")),n.createElement(i.lV,{"data-qa":"avatar_crop_save_button",loading:E,onClick:D,autoFocus:!0,"aria-label":w.t("Save")},w.t("Save")))))};AvatarCropPane.displayName="AvatarCropPane"},0xdac250:(e,t,a)=>{"use strict";a.d(t,{Z:()=>AvatarUploadPane});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x11a296110),i=a(0xb1ea448c),o=a(0x127218dbe),s=a(0x1ca293e13),c=a(0x2440854b3),d=a(0x2395e748b),u=a(0x20f6327e1),m=a(0x1b3ecb90f),p=a(0x20e80190e),b=a(0xb1a6818e),f=a.n(b);let g=new r.Ay("workflow_builder");function AvatarUploadPane({file:e,prevPane:t,nextPane:a,switchPane:r,onClose:b,setOnCropImagePane:h}){let{status:_,avatarUrl:y,imageId:x,error:v}=(0,u.V)(e),E=(0,n.useCallback)(()=>r(t),[t,r]);(0,n.useEffect)(()=>{_===u.A.SUCCESS&&x&&y&&(a===d.n.CROP_IMAGE&&h&&h(!0),r(a,{imageId:x,avatarUrl:y}))},[y,x,a,h,_,r]);let k=g.t("Uploading your photo\u2026"),w=n.createElement(i.A,{size:"jumbo"});if(_===u.A.ERROR){let{errorEmoji:e,errorText:t,errorTitle:a}=(({error:e})=>e===c.fw?{errorTitle:g.t("Dang"),errorEmoji:":worried:",errorText:g.t("That\u2019s a very nice photo, but it\u2019s a bit too big. Try one that\u2019s smaller than 2 MB.")}:e===c.DV?{errorTitle:g.t("Dang"),errorEmoji:":worried:",errorText:g.t("Profile photos must be GIFs, JPGs or PNGs.")}:e===c.dW?{errorTitle:g.t("Dang"),errorEmoji:":worried:",errorText:g.t("That\u2019s a very nice photo, but it\u2019s a bit too small. Try one that\u2019s larger than 128x128.")}:e===c.P1?{errorTitle:g.t("Dang"),errorEmoji:":worried:",errorText:g.t("That\u2019s a very nice photo, but it\u2019s a bit too big. Try one that\u2019s smaller than 2000x2000.")}:{errorTitle:g.t("Eek"),errorEmoji:":frowning:",errorText:g.t("Sorry! Something went wrong. Please try again.")})({error:v});k=a,w=n.createElement("div",{className:f().error_container},n.createElement(m.Ay,{emojiSize:m.lw.LARGE,forceDisplay:!0,text:e}),n.createElement("br",null),n.createElement("strong",{className:f().error_text,"data-qa":"avatar_upload_error_text"},t))}return n.createElement(n.Fragment,null,n.createElement(p.rQ,null,n.createElement(o.A,{"data-qa":"avatar_upload_back_button",onClick:E}),n.createElement(p.Rc,{"data-qa":"avatar_upload__title-bar",title:k})),n.createElement(p.$m,null,n.createElement(p.qf,{className:"center_content"},n.createElement(s.A,null,w))),n.createElement(p.jl,null,n.createElement(p.ox,null,n.createElement(p.s_,{type:"outline",autoFocus:!v,onClick:b,"aria-label":g.t("Cancel")},g.t("Cancel")),_===u.A.ERROR&&n.createElement(l.Ay,{"data-qa":"avatar_upload_retry_button",onClick:E},g.t("Try a Different Image")))))}AvatarUploadPane.displayName="AvatarUploadPane"},0x1bcdab91d:(e,t,a)=>{"use strict";a.d(t,{a:()=>CollapsibleListItemError});var n=a(0xbad225b5),r=a(0x12edaa96a),l=a(0x9f7220f0),i=a(0x15f8e452a),o=a(0x131edc88b),s=a.n(o);let CollapsibleListItemError=({message:e})=>n.createElement("div",{className:s().container},n.createElement(i.A,{inline:!0,type:"info-circle",size:"inherit"}),n.createElement(l.z,{assertive:!0,uuid:(0,r.A)()},n.createElement("span",null,e)));CollapsibleListItemError.displayName="CollapsibleListItemError"},0x98b4cc3b:(e,t,a)=>{"use strict";a.d(t,{k:()=>h});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1cbdfeceb),o=a(0x20482ad21),s=a(0x11a296110),c=a(0x2501a2cee),d=a(0xe9c32bb),u=a(0x1bcdab91d);let m=new o.Ay("workflow_builder"),p=(0,n.memo)(({direction:e,disabled:t,onClick:a=i.A,...r})=>n.createElement(s.Ay,{...r,disabled:t,onClick:a,type:"outline",size:"large",icon:`arrow-large-${e}`,"aria-label":"up"===e?m.t("Move Up"):m.t("Move Down")}));var b=a(0x18fa00e62),f=a.n(b);let g=new o.Ay("workflow_builder"),h=(0,n.memo)(({canCollapse:e=!0,canEdit:t=!0,canMoveDown:a=!1,canMoveUp:r=!1,canRemove:o=!1,children:m=null,iconType:b="css",isExpanded:h=!1,errorMessage:_=null,label:y="",onCollapse:x=i.A,onEdit:v=i.A,onMoveDown:E=i.A,onMoveUp:k=i.A,onRemove:w=i.A,showEditButton:S=!0,showEditorFooter:C=!0,showMoveButtons:A=!1,removeButtonAriaLabel:T,editButtonAriaLabel:I,collapseButtonAriaLabel:N,forceNoBorder:M=!1,previewInfo:L,collapsedListItemClassName:O,expandedListItemClassName:F,shouldAlignTop:D=!1,filledEditButton:P=!1})=>{let R=(0,n.useCallback)(e=>{e.preventDefault(),x(e)},[x]);return h?n.createElement("li",{className:l()(f().container_form,F),"data-qa":"collapsible-list-item--expanded"},n.createElement("form",{onSubmit:R},m,C&&n.createElement("div",{className:f().footer},n.createElement(s.Ay,{type:"danger",size:"small",disabled:!o,onClick:w,"aria-label":T,"data-qa":"collapsible-list-item__delete"},g.t("Delete")),n.createElement(s.Ay,{htmlType:"submit",type:"outline",size:"small",disabled:!e,"aria-label":N,"data-qa":"collapsible-list-item__done"},g.t("Done"))))):n.createElement("li",{className:l()(f().container,O,{[f().add_top_border]:!M,[f().align_top]:D}),"data-qa":"collapsible-list-item--collapsed"},n.createElement("div",null,L??n.createElement("div",{className:f().info},n.createElement(d.HL,null,n.createElement("span",{className:f().icon},n.createElement(c.Ah,{inline:!0,name:b,size:"inherit"}))),y&&n.createElement("span",{className:f().label},y),_&&n.createElement(u.a,{message:_})),n.createElement("div",{className:f().actions},A&&n.createElement("div",null,n.createElement(p,{direction:"up",disabled:!r,onClick:k,"data-qa":"collapsible-list-item__move-up"}),n.createElement(p,{className:"margin_left_25",direction:"down",disabled:!a,onClick:E,"data-qa":"collapsible-list-item__move-down"})),S&&n.createElement("div",{className:l()({[f().filledEditButton]:P})},n.createElement(s.Ay,{"aria-label":I??g.t("Edit"),icon:"pencil",disabled:!t,onClick:v,size:"large",type:"outline","data-qa":"collapsible-list-item__edit"})))))})},0x12bc54835:(e,t,a)=>{"use strict";a.d(t,{x:()=>s});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x6add6a0e),o=a.n(i);let s=n.forwardRef(({className:e=null,main:t=!1,children:a},r)=>t?n.createElement("div",{ref:r,className:l()(o().container,o().main,e)},a):n.createElement("div",{ref:r,className:l()(o().container,e)},a))},0x1c244e721:(e,t,a)=>{"use strict";a.d(t,{W:()=>onVariableMenuOpenClog});var n=a(0x23a4b0853);function onVariableMenuOpenClog(e,t){let{uiArgs:a,uiProperties:r,wbArgs:l}=t;(0,n.K$)({clogger:e,uiArgs:a,uiProperties:r,wbArgs:l})}},0x16e99b359:(e,t,a)=>{"use strict";a.d(t,{l:()=>Select});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1cbdfeceb),o=a(0x12edaa96a),s=a(0x1e586fbba),c=a(0x1d1911997),d=a(0xe53aa0),u=a(0x1312f060e),m=a(0x93f78b39),p=a(0x1b3ecb90f),b=a(0x15a4ffb05),f=a(0x207fb9b92),g=a(0x77627b71),h=a.n(g);let Select=({className:e,options:t,value:a,id:r,placeholder:g,required:_=!1,errorText:y,isInvalid:x=!1,onChange:v,dataQa:E,...k})=>{let w=(0,n.useMemo)(()=>`${(0,o.A)()}-${t.length}`,[t]),S=(0,n.useMemo)(()=>{let e=null;return t.some(t=>!!(Array.isArray(t.options)&&(e=t.options.find(e=>e.value===a)))||(!!(0,d.X)(t)&&t.id===a||t.value===a)&&(e=t,!0)),e||null},[t,a]),C=(0,n.useCallback)((e={})=>(0,d.X)(e)?v(e.id,e):v(e.value,e),[v]),{onBlur:A,errorText:T}=(0,f.K)({errorMessage:y,isErrored:x}),I=(0,n.useCallback)(e=>(0,d.X)(e)?null:n.isValidElement(e.label)?e.label:n.createElement("div",{className:l()(h().plainTextSelectOptions,"p-block-kit-select_options")},n.createElement(b.A,{text:e.label,emojiSize:p.lw.MEDIUM})),[]),N=(0,n.useCallback)(e=>{let t=e.value?.[0]?.elements?.[0];if(!(0,u.B)(t)||!t.elements)return null;let a=e.value[0].type;return n.createElement("div",{className:"p-block-kit-select_options"},n.createElement(m.A,{type:a,elements:t.elements,disableHighlights:!1,inline:!0,clogLinkClick:i.A,noInlineLinks:!0,alwaysDisplayMentionsAsLinks:!0,disableJumboEmoji:!0}))},[]),M=(0,n.useMemo)(()=>(0,d.X)(t[0]),[t]);return n.createElement("div",{className:l()(h().container,e,{[h().invalid]:!!T})},n.createElement(c.Ay,{key:w,options:t,width:"100%",selectId:r,selectedOption:S,onOptionSelected:C,placeholderText:g,isRequired:_,onBlur:A,isInvalid:!!T,selectDataQa:E,renderSelectedOption:M?N:I,renderOption:M?N:I,...k}),!!T&&n.createElement(s.A,null,T))};Select.displayName="Select"},0x1d898b34c:(e,t,a)=>{"use strict";a.d(t,{v:()=>HermesWorkflowMetadataDialog});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x11a296110),i=a(0x1d2cd7755),o=a(0x126f22530),s=a(0x1e586fbba),c=a(0x1b7f0cd57),d=a(0xa3743afa),u=a(0x16cf1da63),m=a(0x16475a65c),p=a(0x72b537b5),b=a(0xe874a88a),f=a(0x205f4fb61),g=a(0x16ac9b089),h=a(0x2264e6ea3),_=a(0x1faa3f1ac),y=a(0x143f89715),x=a(0x253c586a2),v=a(0x7f5a02e8),E=a(0xe9c32bb),k=a(0x1d1a513a),w=a(0x16e99b359),S=a(0xf4030543),C=a(0x220757cb0),A=a(0x20570d71a),T=a(0x13c8b082e),I=a(0x23a4b0853),N=a(0x10d53599f),M=a(0x19dc73101),L=a(0x23198a843),O=a(0x238b287cf),F=a(0x1bb9b9e21),D=a(0xa1832ae4),P=a(0xb8504a42),R=a(0x3711e82d),B=a(0x16ed1b0dc),W=a(0x4f725d55),V=a(0x66c6b26d),H=a(0x20adb28cd),q=a(0x4e250925),U=a(0x226892387),z=a(0x1ee439e69),j=a(0x1b1df7714),G=a.n(j);let $=new r.Ay("workflow_builder"),renderMemberOption=e=>n.createElement(N.A,{id:e.value}),PermissionsSettingsModalSection=({onPermissionsErrorChange:e,showMore:t=!1},a)=>{let r=(0,p.U)(),l=(0,O.A)(),o=(0,u.wA)(),s=(0,A.Y)(),c=(0,U.d4)(z.H7),d=(0,D.ZT)(c),N=(0,D.F1)(c),j=(0,P.kA)(c),K=(0,U.d4)((0,V.sx)(s,H.u6)),Y=(0,U.d4)((0,V.sx)(s,H.Ds)),Q=(0,U.d4)((0,V.sx)(s,H.Sg)),Z=(0,U.d4)((0,V.sx)(s,H.Zx)),J=(0,U.d4)((0,V.sx)(s,H.uY)),[X,ee]=(0,n.useState)(t),et=$.t("Permissions"),ea=(0,U.d4)(e=>(0,F.X)(e,J)),en=(0,U.d4)(e=>{let t=(0,z._J)(e,ea);if(t)return(0,D.F1)(t)}),er=(0,U.d4)((0,V.sx)(s,H.gT)),el=en||N,[ei,eo]=(0,n.useState)(er),[es,ec]=(0,n.useState)(Z),[ed,eu]=(0,n.useState)(K||"everyone"),em=(0,U.Z2)(e=>{let[t]=(0,H.e5)(e,es);return t}),{isTeamValidSCWorkflowTarget:ep}=(0,k.u)(s),eb=(0,n.useMemo)(()=>em.some(e=>!ep(e)),[ep,em]),[ef,eg]=(0,n.useState)(Y?.slice()||[]),eh=(0,n.useMemo)(()=>ef.map(e=>({label:e,value:e})),[ef]),e_=$.t("Everyone in {teamName}",{teamName:(0,g.Ay)(el)}),ey=$.t("Workflow managers only"),ex=(0,n.useMemo)(()=>[{value:"everyone",label:e_},{value:"collaborators",label:ey}],[ey,e_]),ev=$.t("No selection"),eE=(0,n.useMemo)(()=>{let e=ex.find(e=>e.value===ed);return e?e.label:ev},[ex,ev,ed]),ek=0===ef.length,ew=0===es.length,eS=es.length>S.y,eC=$.t("You must provide at least 1 workflow manager"),eA=$.t("You must select users, channels, or workspaces"),eT=$.t("Workflow access is limited to a total of {entitiesLimit} users, channels, or workspaces. Remove {amountToRemove} to save.",{entitiesLimit:(0,f.ZV)(S.y),amountToRemove:(0,f.ZV)(es.length-S.y)}),eI=(0,n.useMemo)(()=>{let e=[];return ek&&e.push({id:"empty_collaborators",message:eC}),e},[eC,ek]),eN=(0,n.useMemo)(()=>{let e=[];return ei===T.PW.named_entities&&ew&&e.push({id:"empty_entities_with_run_access",message:eA}),eS&&e.push({id:L.S.TooManyNamedEntities,message:eT}),e},[eA,eS,ew,ei,eT]),eM=(0,n.useCallback)(e=>{let t=e.map(({value:e})=>e);eg(t),ei===T.PW.named_entities&&ec([...new Set([...t,...es])])},[es,ei,eg]),eL=(0,n.useCallback)(e=>{("everyone"===e||"collaborators"===e)&&eu(e)},[]),eO=(0,n.useCallback)(async()=>{let e=(0,m.A)(Y,ef),t=(0,m.A)(ef,Y);t.length>0&&await o((0,q.gP)({workflowId:s,collaborators:t})),e.length>0&&await o((0,q.i9)({workflowId:s,collaborators:e}))},[s,Y,o,ef]),eF=(0,n.useCallback)(({userIds:e,channelIds:t,teamIds:a,orgIds:n})=>{let{userIds:r=[],channelIds:l=[],teamIds:i=[],orgIds:o=[]}=Q??{},s=(0,m.A)(e,r).length>0||(0,m.A)(t,l).length>0||(0,m.A)(a,i).length>0||(0,m.A)(n,o).length>0,c=(0,m.A)(r,e).length>0||(0,m.A)(l,t).length>0||(0,m.A)(i,a).length>0||(0,m.A)(o,n).length>0;return s||c},[Q]),eD=(0,n.useCallback)(async()=>{let e=[],t=[],a=[],n=[];es.forEach(r=>{(0,W.A)(r)&&e.push(r),(0,B.A)(r)&&t.push(r),(0,h.Ay)(r)&&a.push(r),(0,h.JV)(r)&&n.push(r)});let r=e.length>0?e:void 0,l=t.length>0?t:void 0,i=a.length>0?a:void 0,c=n.length>0?n:void 0,u=[];if(ei!==Q?.permissionType||eF({userIds:e,channelIds:t,teamIds:a,orgIds:n})){let e=ei,t={};ei===T.PW.everyone&&(i||c)?(e=T.PW.named_entities,t={teamIds:j?i:[d].concat(i||[]),orgIds:j?[d].concat(c||[]):c}):ei===T.PW.named_entities&&(t={userIds:r,channelIds:l,teamIds:i,orgIds:c}),u.push(o((0,q.$N)({workflowId:s,permissionType:e,...t})))}return b.S.all(u)},[eF,d,o,j,es,ei,Q,s]),eP=(0,n.useCallback)(async()=>{if(ed!==K)return o((0,q.ZU)({workflowId:s,permissionType:ed}))},[K,o,ed,s]);(0,n.useEffect)(()=>{(0,I.Vb)({clogger:l,uiArgs:{step:R.UiStep.WORKFLOW_PERMISSIONS},wbArgs:{workflow_id:s,is_hermes:!0}})},[l,s]),(0,n.useEffect)(()=>{e&&e(eb||(0,y.A)(eI,r)||(0,y.A)(eN,r))},[eI,eN,eb,e,r]),(0,n.useImperativeHandle)(a,()=>({updateCollaborators:eO,updateTriggerRunPermissions:eD,updateCopyPermissions:eP}),[eO,eP,eD]);let eR=(0,n.useCallback)(()=>{ee(!0)},[]);return n.createElement("div",{className:"padding_top_50 padding_bottom_125"},n.createElement(E.Pd,{element:"h1",className:"margin_bottom_150",weight:"bold"},et),n.createElement(C.B,{currentTeamId:d,teamName:el,selectedRunAccessOption:ei,setRunAccessOption:eo,selectedEntitiesWithRunAccess:es,setSelectedEntitiesWithRunAccess:ec,entitiesWithRunAccessErrors:eN,selectedCollaborators:ef,selectedExternalEntities:em,hasExternalEntititesDriftedFromSCPrefs:eb}),X?n.createElement(n.Fragment,null,n.createElement(i.A,{htmlFor:"copy-access-select",text:$.t("Who can copy this workflow?")},n.createElement(w.l,{id:"copy-access-select",value:ed||"",options:ex,placeholder:eE,ariaLabel:$.t("Default selection"),onChange:eL,required:!0,errorText:"","data-qa":"copy-access-select"})),n.createElement(i.A,{htmlFor:"collaborators-multi-select",text:$.t("Workflow managers")},n.createElement(M.h,{width:"100%",className:"margin_bottom_50",selectDataQa:"collaborators-multi-select",selectId:"collaborators-multi-select",isInvalid:eI.length>0,errors:eI,renderOption:renderMemberOption,searcherOptions:(0,v.Zq)(x.Df,{externalWorkspaceToSearchOn:ea}),selectedOptions:eh,onSelectedItemsChange:eM,focusOnMount:!0}),n.createElement("span",{className:G().helpText},$.t("Can edit, publish, and delete this workflow")))):n.createElement("div",null,n.createElement(_.A,{onClick:eR,"data-qa":"show-more-permissions-link"},$.t("Show more permissions"))))};PermissionsSettingsModalSection.displayName="PermissionsSettingsModalSection";let K=(0,n.forwardRef)(PermissionsSettingsModalSection);var Y=a(0x1e813d5b2),Q=a(0x1a5ac3a0c),Z=a(0x126af815a),J=a(0x937a43ca),X=a(0x1d1437423),ee=a(0x19178121a),et=a.n(ee);let ea=new r.Ay("workflow_builder"),HermesWorkflowMetadataDialog=({switchPane:e,workflowName:t,workflowId:a,workflowDescription:r,workflowIconUrl:u,setWorkflowDescription:m,setWorkflowName:p,hasSaveError:b,paneType:f,nameIsInvalid:g,selectedWorkflow:h,onPermissionsErrorChange:_,permissionSettingsHandlersRef:y})=>{let x=(0,n.useRef)(null),v=(0,n.useRef)(null),E=(0,U.d4)((0,V.sx)(a,H.RG)),k=h||E,w=(0,n.useRef)(null),S=(0,n.useMemo)(()=>k?.trigger?(0,Q.eG)(k.trigger,k?.coachmarkData):void 0,[k]),C=S?.type,A=Z.zW===C,T=(0,n.useCallback)(()=>w?.current?.click(),[]),I=(0,n.useCallback)(t=>{let a=(t.target.files||[])[0];a&&e(f,{file:a})},[f,e]),N=(0,n.useMemo)(()=>(0,J.yA)(t),[t]),M=(0,n.useMemo)(()=>new Set((0,J.QM)(t)),[t]),L=(0,n.useMemo)(()=>(0,J.Zb)(t),[t]),O=(0,n.useMemo)(()=>(0,J.L8)(t),[t]),F=(0,n.useMemo)(()=>t===ea.t("Untitled Workflow"),[t]),D=(0,n.useMemo)(()=>r===ea.t("A brand new workflow"),[r]),P=(0,n.useMemo)(()=>N?ea.t("Whoops! That name is reserved."):M.size?ea.rt("Choose a name without these special characters: <b>{characters}</b> ",{characters:[...M].join(" ")}):L?ea.t("Workflow names can\u2019t support special characters (i.e. !#$%&)."):O?ea.t("Whoops! Workflow names cannot have emojis."):t.length>d.p?ea.t("You can\u2019t enter more than {maxLength} characters.",{maxLength:d.p}):ea.t("This field is required."),[M,L,N,O,t.length]),{onChange:R,errorText:B}=(0,X.x)({errorMessage:P,isErrored:g}),W=(0,n.useCallback)(e=>{p(e),R()},[R,p]),q=(0,n.useCallback)(()=>{x.current&&F&&x.current?.select()},[F]),z=(0,n.useCallback)(()=>{v.current&&D&&v.current?.select()},[D]);(0,n.useEffect)(()=>{W(t)},[]);let j=ea.t("Something short and descriptive"),G=ea.t("What is this workflow for?"),$=(0,n.useMemo)(()=>{if(k)return{...k,workflow:{...k.workflow,title:t,description:r,icons:{image_192:u,image_96:u}}}},[k,t,r,u]);return n.createElement(n.Fragment,null,n.createElement("div",{className:et().workflow_metadata_section},n.createElement("div",{className:et().workflow_avatar_upload},n.createElement(c.R,{className:et().workflow_avatar_icon_improvement,iconSrcUrl:u,altText:t,size:"large"}),n.createElement("input",{className:et().file_input,type:"file",accept:"image/jpeg,image/gif,image/png",onChange:I,ref:w,"aria-hidden":"true",tabIndex:-1,hidden:!0}),n.createElement(l.Ay,{type:"outline",size:"small",onClick:T,className:et().choose_file_icon,"data-qa":"workflow-details-modal-icon-button","aria-label":ea.t("Upload workflow avatar image")},ea.t("Upload"))),n.createElement("div",{className:et().workflow_metadata_form},n.createElement(i.A,{className:et().workflow_name_form,text:ea.t("Name")},n.createElement(o.A,{id:"workflow-details-modal_name",type:"text",maxCharacterLimit:d.p,name:"name",value:t,onChange:W,placeholder:j,errorText:B,autoComplete:"off",focusOnMount:!0,inputRef:x,onFocus:q,className:"margin_bottom_50","data-qa":"workflow-details-modal-name__input",useInlineAlert:!0,hintId:"workflow_naming_hint"}),n.createElement("span",{className:et().workflow_naming_help_text,id:"workflow_naming_hint"},ea.t('Workflow names can\u2019t use punctuation marks and certain special characters, for example: ! ? @ # % + & $ * : " , / [ ]'))),n.createElement(i.A,{text:ea.t("Description")},n.createElement(o.A,{id:"workflow-details-modal_description",type:"text",maxCharacterLimit:d.p,minCharacterLimit:d.H,name:"description",value:r,onChange:m,placeholder:G,inputRef:v,onFocus:z,"data-qa":"workflow-details-modal-description__input",useInlineAlert:!0,isRequired:!0})))),_&&y&&n.createElement(K,{onPermissionsErrorChange:_,ref:y}),$&&A&&n.createElement(Y.Q,{workflow:$.workflow,trigger:$.trigger,workflowName:t,workflowDescription:r}),b&&n.createElement(s.A,{"data-qa":"workflow-details-modal-description-error"},ea.t("There was an error updating your workflow.")))};HermesWorkflowMetadataDialog.displayName="HermesWorkflowMetadataDialog"},0xa3743afa:(e,t,a)=>{"use strict";a.d(t,{H:()=>n,p:()=>r});let n=1,r=80},0x2395e748b:(e,t,a)=>{"use strict";a.d(t,{n:()=>n});let n={WORKFLOW_DETAILS:"workflow_details",UPLOAD_IMAGE:"upload_image",CROP_IMAGE:"crop_image"}},0x3c5a1598:(e,t,a)=>{"use strict";a.d(t,{R:()=>R});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x20482ad21),s=a(0xf3c40abe),c=a(0x11a296110),d=a(0x4c96e5d9),u=a(0x1b7f0cd57),m=a(0xe9c32bb),p=a(0x24546e7f2),b=a(0x15ab42d61),f=a(0xdac250),g=a(0x2395e748b),h=a(0x1d898b34c),_=a(0xa3743afa),y=a(0x937a43ca),x=a(0x20e80190e),v=a(0x4e250925);let E=new o.Ay("workflow_builder"),WorkflowDetailsModalPane=({onClose:e,switchPane:t,workflowName:a,workflowId:l,workflowDescription:i,workflowIconUrl:o,setWorkflowDescription:s,setWorkflowName:d,updateWorkflowMetaDataCallback:u,selectedWorkflow:m})=>{let p=(0,r.wA)(),[b,f]=(0,n.useState)(!1),[k,w]=(0,n.useState)(!1),S=(0,y.nM)(_.p,a),C=(0,y.Qe)(_.p,i),A=S||k||C,T=(0,n.useCallback)(async()=>{try{w(!0),f(!1);let t=await p((0,v.QC)({name:a,description:i,iconUrl:o,selectedWorkflow:m,workflowId:l}));t&&u&&u(t),e()}catch{w(!1),f(!0)}},[p,a,i,o,m,l,u,e]);return n.createElement(n.Fragment,null,n.createElement(x.rQ,null,n.createElement(x.Rc,{title:E.t("Workflow Details")})),n.createElement(x.$m,null,n.createElement(x.qf,null,n.createElement(h.v,{switchPane:t,workflowName:a,workflowId:l,workflowDescription:i,workflowIconUrl:o,setWorkflowDescription:s,setWorkflowName:d,hasSaveError:b,paneType:g.n.UPLOAD_IMAGE,nameIsInvalid:S,selectedWorkflow:m}))),n.createElement(x.jl,null,n.createElement(x.ox,null,n.createElement(x.s_,{onClick:e,type:"outline","aria-label":E.t("Cancel")},E.t("Cancel")),n.createElement(c.lV,{type:"primary",onClick:T,disabled:A,loading:k,"data-qa":"first_publish-next__button","aria-label":E.t("Save")},E.t("Save")))))};WorkflowDetailsModalPane.displayName="WorkflowDetailsModalPane";var k=a(0x20570d71a),w=a(0x1a5ac3a0c),S=a(0x145d46a61),C=a(0x66c6b26d),A=a(0x20adb28cd),T=a(0x226892387),I=a(0x1fcbb004d),N=a(0x17f19ec0c),M=a.n(N);let L=new o.Ay("workflow_builder"),HermesWorkflowMetadataModal=({selectedWorkflow:e,updateWorkflowMetaDataCallback:t})=>{let a=(0,r.wA)(),l=(0,T.d4)(S.tQ),o=(0,k.Y)(),s=(0,T.d4)((0,C.sx)(o,A.RG)),c=e||s,d=(0,w.BQ)(c),u=c?(0,w.yL)(c):"",m=(0,w.DU)(c),[h,_]=(0,n.useState)(!1),[y,x]=(0,n.useState)((u||"").replace(/[()]/g,"")),[v,E]=(0,n.useState)((d||"").replace(/[()]/g,"")),[N,O]=(0,n.useState)(m||""),F=(0,n.useCallback)(()=>{a((0,I.O)()),_(!1)},[a]),D=L.t("Workflow Details"),P=L.t("Edit Avatar Upload"),R=L.t("Edit Avatar Crop"),B=(0,n.useMemo)(()=>({[g.n.WORKFLOW_DETAILS]:{render:e=>n.createElement(WorkflowDetailsModalPane,{onClose:F,workflowName:v,workflowId:o,workflowDescription:y,workflowIconUrl:N,setWorkflowDescription:x,setWorkflowName:E,updateWorkflowMetaDataCallback:t,selectedWorkflow:c,...e}),modalProps:{contentLabel:D}},[g.n.UPLOAD_IMAGE]:{render:e=>n.createElement(f.Z,{onClose:F,nextPane:g.n.CROP_IMAGE,prevPane:g.n.WORKFLOW_DETAILS,setOnCropImagePane:_,...e}),modalProps:{contentLabel:P}},[g.n.CROP_IMAGE]:{render:e=>n.createElement(b._,{workflowName:v,workflowDescription:u,onClose:F,nextPane:g.n.WORKFLOW_DETAILS,prevPane:g.n.WORKFLOW_DETAILS,showPreview:!1,setOnCropImagePane:_,setIconUrl:O,...e}),modalProps:{contentLabel:R}}}),[D,P,R,F,v,y,N,t,c,o,u]);return n.createElement(p.A,{centered:!l,closeModal:F,dataQa:"workflow_builder_metadata_edit_modal",defaultPane:g.n.WORKFLOW_DETAILS,overlayClassName:i()({[M().modalOverlay]:l}),panes:B,showCloseButton:!h})};HermesWorkflowMetadataModal.displayName="HermesWorkflowMetadataModal";var O=a(0x46dbff89),F=a(0x12cdb23b0),D=a.n(F);let P=new o.Ay("workflow_builder"),PrimitiveHermesWorkflowMetadata=({name:e,icon:t,description:a,badgeText:l,canEdit:o=!1,hasKeyboardFocus:s,onEditClick:p,isClientBuilder:b=!1})=>{let f=P.t("Edit workflow title, description, or avatar"),g=P.t("Edit details",{fallbackHash:"0a49b64a50b81012b504c1a11b676ee14f396601"}),h=(0,r.wA)(),_=(0,n.useCallback)(()=>{if(o){if(p)return void p();h((0,O.q)({element:n.createElement(HermesWorkflowMetadataModal,null)}))}},[o,p,h]);return o?n.createElement(d.Ay,{position:"right",tip:g},n.createElement(c.Nm,{className:i()(D().container,{[D().can_edit]:o,[D().isClientBuilder]:b}),onClick:_,autoFocus:s,"data-qa":"edit-workflow-metadata","aria-label":f},n.createElement(u.R,{size:b?"small":"medium",iconSrcUrl:t,altText:e,className:D().headerAvatar}),n.createElement("div",{className:D().nameContainer},n.createElement("div",{className:D().name},n.createElement(m.Pd,{element:"h1"},e),l&&n.createElement("span",{className:D().badge},l)),n.createElement(m.nB,{className:D().description},a)))):n.createElement("span",{className:i()(D().container,{[D().isClientBuilder]:b}),"data-qa":"no-edit-workflow-metadata",role:"heading","aria-level":1},n.createElement(u.R,{iconSrcUrl:t,altText:e,className:D().headerAvatar}),n.createElement("div",null,n.createElement("div",{className:D().name},n.createElement(m.Pd,{element:"h1"},e),l&&n.createElement("span",{className:D().badge},l)),n.createElement(m.nB,{className:D().description},a)))};PrimitiveHermesWorkflowMetadata.displayName="PrimitiveHermesWorkflowMetadata";let R=(0,s.A)(PrimitiveHermesWorkflowMetadata)},0x667b9397:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>z});var n,r=a(0xbad225b5),l=a(0x16cf1da63),i=a(0x20482ad21),o=a(0xb90de824),s=a(0x13953efe6);let BaseAccessJourneyEduCoachmark=({arrowPosition:e,bodyText:t,children:a,closeBackgroundStyle:n,closeCoachmark:l,closeCoachmarkFromOutsideClick:i,hero:c,onClickPrimaryButton:d,onClickSecondaryButton:u,offsetX:m,offsetY:p,primaryCallToActionText:b,secondaryCallToActionText:f,title:g,width:h})=>{let _=(0,r.useMemo)(()=>r.createElement(o.Ay,{arrowPosition:e,alignActionsRight:!0,bodyText:t,closeBackgroundStyle:n,closeCoachmark:l,closeCoachmarkFromOutsideClick:i,hero:c,isMegaphoneCoachmark:!0,isOpen:!0,offsetX:m,offsetY:p,onClickPrimaryButton:d,onClickSecondaryButton:u,primaryCallToActionText:b,secondaryCallToActionText:f,title:g,width:h}),[e,t,n,l,i,c,d,u,m,p,b,f,g,h]);return r.createElement(s.Ay,{coachmarkElement:_,orientation:s.YC.LeftTop},a)};BaseAccessJourneyEduCoachmark.displayName="BaseAccessJourneyEduCoachmark";var c=((n={}).Dismissed="DEFAULT",n.First="STEP_1",n.Second="STEP_2",n.Third="STEP_3",n),d=a(0x145d46a61),u=a(0x226892387);let m=new i.Ay("workflow_builder"),LegacyWorkflowsFinderCoachmark=({children:e,closeCoachmark:t,dismissCoachmark:a,locale:n,recordCoachmarkImpression:l,setCoachmarkStep:i})=>{let o=(0,u.d4)(d.O4),s=(0,r.useMemo)(()=>{switch(n){case"de-DE":return 86;case"es-ES":case"es-LA":case"fr-FR":case"pt-BR":return 79;default:return 72}},[n]),p=m.t("Looking for legacy workflows?"),b=m.t("We\u2019ve done some rearranging \u2014 find and manage your legacy workflows here.");o&&(p=m.t("Looking for integrations?"),b=m.t("We\u2019ve done some rearranging \u2014 find and manage your integrations here.")),(0,r.useEffect)(()=>{l(c.Third)},[l]);let f=(0,r.useCallback)(()=>{i(c.Second)},[i]);return r.createElement(BaseAccessJourneyEduCoachmark,{arrowPosition:20,bodyText:b,closeCoachmark:a,closeCoachmarkFromOutsideClick:t,onClickPrimaryButton:a,onClickSecondaryButton:f,offsetX:12,offsetY:s,primaryCallToActionText:m.t("Done"),title:p,width:400},e)};LegacyWorkflowsFinderCoachmark.displayName="LegacyWorkflowsFinderCoachmark";var p=a(0x62a17882),b=a(0x8c8bafa3),f=a(0x1faa3f1ac),g=a(0x9b971e7e);let h=a.p+"ManagedByYou-de-DE-475ac94.png",_=a.p+"ManagedByYou-en-GB-ac9dff2.png",y=a.p+"ManagedByYou-en-US-14ad34b.png",x=a.p+"ManagedByYou-es-ES-9856195.png",v=a.p+"ManagedByYou-es-LA-16f64b5.png",E=a.p+"ManagedByYou-fr-FR-8537a64.png",k=a.p+"ManagedByYou-it-IT-7d53fc5.png",w=a.p+"ManagedByYou-ja-JP-3bef009.png",S=a.p+"ManagedByYou-ko-KR-8a206e3.png",C=a.p+"ManagedByYou-pt-BR-00f74bb.png",A=a.p+"ManagedByYou-zh-CN-ee3f075.png",T=a.p+"ManagedByYou-zh-TW-ee7d8b0.png";var I=a(0x22f71b0bf),N=a.n(I);let M=new i.Ay("workflow_builder"),L={"de-DE":h,"en-GB":_,"en-US":y,"es-ES":x,"es-LA":v,"fr-FR":E,"it-IT":k,"ja-JP":w,"ko-KR":S,"pt-BR":C,"zh-CN":A,"zh-TW":T},NewWorkflowManagementHomeCoachmark=({children:e,closeCoachmark:t,dismissCoachmark:a,locale:n,recordCoachmarkImpression:l,setCoachmarkStep:i})=>{let o=(0,u.d4)(g.ZT),s=M.t("Want to manage existing workflows?"),d=M.rt("Workflow management now has a single home. Visit <a>Managed by you</a> in Automations to find your created and managed workflows.",{},({text:e})=>r.createElement(f.A,{"data-qa":"desktop_managed_by_you_link",href:`slack://automations?id=workflows-managed-by-you&team=${o}`},e)),m=M.rt("Workflow management now has a single home. Visit Managed by you in <a>Automations</a> to find your created and managed workflows.",{},({text:e})=>r.createElement(f.A,{"data-qa":"web_automations_link",href:`https://app.${(0,b.Xk)()}/client/${o}/platform/workflows-managed-by-you`},e)),h=(0,r.useMemo)(()=>r.createElement("img",{alt:M.t('Illustration shows Slack app with "Managed by you" highlighted in the "Automations" section of the left sidebar.'),className:N().new_workflow_management_home_coachmark_hero,src:L[n]}),[n]),_=(0,r.useMemo)(()=>{switch(n){case"de-DE":case"fr-FR":case"ja-JP":return 207;case"es-ES":case"es-LA":case"pt-BR":return 217;case"zh-CN":return 189;case"zh-TW":return 180;default:return 199}},[n]);(0,r.useEffect)(()=>{l(c.First)},[l]);let y=(0,r.useCallback)(()=>{i(c.Second)},[i]);return r.createElement(BaseAccessJourneyEduCoachmark,{arrowPosition:10,bodyText:(0,p.y3)()?d:m,closeBackgroundStyle:"light",closeCoachmark:a,closeCoachmarkFromOutsideClick:t,hero:h,onClickPrimaryButton:y,offsetX:2,offsetY:_,title:s,width:300},e)};NewWorkflowManagementHomeCoachmark.displayName="NewWorkflowManagementHomeCoachmark";var O=a(0x2e37ba27),F=a(0x222b5efaf),D=a(0x10bdbc1d5),P=a(0x195ca460e),R=a(0x82bb74ae);let B=new i.Ay("workflow_builder"),WorkflowCreationFocusCoachmark=({children:e,closeCoachmark:t,dismissCoachmark:a,locale:n,recordCoachmarkImpression:l,setCoachmarkStep:i})=>{let o=(0,u.d4)(d.O4),s=B.t("Workflow Builder is where you build workflows"),m=B.t("Workflow Builder is now focused on workflow creation. It starts with a draft on open, so you can get started building right away."),p=(0,r.useMemo)(()=>["en-US","en-GB"].includes(n)?r.createElement(O.A,{autoPlay:!1,enableControls:!0,src:D,title:B.t("Workflows Educational Video"),videoContainerClassName:N().workflow_creation_focus_coachmark_hero_video,videoPoster:R,vtt:P}):r.createElement("img",{alt:B.t("Illustration of a screen with a mouse icon moving a workflow step to a new position."),className:N().workflow_creation_focus_coachmark_hero_static_image,src:F}),[n]),b=(0,r.useMemo)(()=>{switch(n){case"fr-FR":return 223;case"es-ES":case"es-LA":case"pt-BR":return 212;case"ja-JP":return 204;case"de-DE":return 203;case"it-IT":case"ko-KR":return 194;default:return 185}},[n]);(0,r.useEffect)(()=>{l(c.Second)},[l]);let f=(0,r.useCallback)(()=>{i(c.Third)},[i]),g=(0,r.useCallback)(()=>{i(c.First)},[i]);return r.createElement(BaseAccessJourneyEduCoachmark,{arrowPosition:10,bodyText:m,closeBackgroundStyle:"light",closeCoachmark:a,closeCoachmarkFromOutsideClick:t,hero:p,onClickPrimaryButton:o?f:a,onClickSecondaryButton:g,offsetX:2,offsetY:b,primaryCallToActionText:o?void 0:B.t("Done"),title:s,width:300},e)};WorkflowCreationFocusCoachmark.displayName="WorkflowCreationFocusCoachmark";var W=a(0x218842a12),V=a(0x21c50a68b),H=a(0x20061cab9),q=a(0xf3c65e54),U=a(0x5b1935a6);W.g.HERMES_WORKFLOW_BUILDER_COACHMARKS_ACCESS_JOURNEY_EDU_COACHMARK;let AccessJourneyEduCoachmarkContainer=({children:e,step:t})=>{let a=(0,l.wA)(),n=(0,V.JK)(),[i,o]=(0,r.useState)(t),s=(0,r.useCallback)(e=>{o(e)},[]),d=(0,r.useCallback)(e=>{a((0,q.A)({notificationName:U.ze.HERMES_WORKFLOW_BUILDER_COACHMARKS_ACCESS_JOURNEY_EDU_COACHMARK,action:U.hw.IMPRESSION,step:e}))},[a]),u=(0,r.useCallback)(()=>{o(c.Dismissed)},[]),m=(0,r.useCallback)(()=>{u(),a((0,H.Ay)({spaceName:U.xu.WORKFLOW_BUILDER_COACHMARKS,action:U.hw.DISMISS}))},[u,a]);switch(i){case c.First:return r.createElement(NewWorkflowManagementHomeCoachmark,{closeCoachmark:u,dismissCoachmark:m,locale:n,recordCoachmarkImpression:d,setCoachmarkStep:s},e);case c.Second:return r.createElement(WorkflowCreationFocusCoachmark,{closeCoachmark:u,dismissCoachmark:m,locale:n,recordCoachmarkImpression:d,setCoachmarkStep:s},e);case c.Third:return r.createElement(LegacyWorkflowsFinderCoachmark,{closeCoachmark:u,dismissCoachmark:m,locale:n,recordCoachmarkImpression:d,setCoachmarkStep:s},e);case c.Dismissed:default:return r.createElement(r.Fragment,null,e)}};AccessJourneyEduCoachmarkContainer.displayName="AccessJourneyEduCoachmarkContainer";let z=AccessJourneyEduCoachmarkContainer},0x1be4be922:(e,t,a)=>{"use strict";a.r(t),a.d(t,{PageWorkflowVersion:()=>B,default:()=>W});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x16ac9b089),i=a(0x11a296110),o=a(0x1e586fbba),s=a(0xe9c32bb),c=a(0xcaea2334),d=a(0x12bc54835),u=a(0xbada0518),m=a(0x1775ee4d),p=a(0xd8ab69b7),b=a(0x96aa1794),f=a(0x20570d71a),g=a(0xf6b2f43b),h=a(0x1a5ac3a0c),_=a(0xa59ddeb4),y=a(0xad14d02e),x=a(0x129ec1993),v=a(0x1ae5d492),E=a(0x1f2fa5a0f),k=a(0xa1832ae4),w=a(0x6960d8b9),S=a(0x1c91944c9),C=a(0x20adb28cd),A=a(0x4e250925),T=a(0x18967f42a),I=a(0x1d89698af),N=a(0x19c76d181),M=a(0x1ee439e69),L=a(0x1c9a4b8e2),O=a.n(L);let F=new r.Ay("workflow_builder"),D={height:"40vh"},P=class extends n.PureComponent{static defaultProps={versionLoadError:!1,canRestoreVersion:!1};constructor(e){super(e),this.state={isRestoring:!1},this.restoreWorkflowVersion=this.restoreWorkflowVersion.bind(this),this.onDone=this.onDone.bind(this)}componentDidMount(){let{loadWorkflowVersion:e,workflowId:t,versionId:a}=this.props;e({workflowId:t,versionId:a})}onDone(){let{workflowId:e}=this.props;return(0,v._U)(E.Bs,{workflowId:e})}restoreWorkflowVersion(){let{restoreHermesWorkflowVersion:e,versionId:t}=this.props;return this.setState(()=>({isRestoring:!0})),e({versionId:t}).finally(()=>this.setState(()=>({isRestoring:!1})))}getRouteParams(){let{workflowId:e,latestWorkflow:t}=this.props;return{workflowId:e,triggerId:t?.trigger?.id}}renderContent(){let{versionLoading:e,version:t,versionLoaded:a,versionLoadError:r}=this.props;return!e&&a||r?t?n.createElement("div",{className:O().workflow},n.createElement(p.l,{workflow:t})):n.createElement(o.A,null,F.t("Workflow not found")):n.createElement(u.W,{style:D})}render(){let{isRestoring:e}=this.state,{canRestoreVersion:t,workflowId:a,version:r,team:o}=this.props,c=(0,k.F1)(o),u=E.Bs,p=this.getRouteParams();return n.createElement(f.u.Provider,{value:a||""},n.createElement(b.X.Provider,{value:r},n.createElement(g.U.Provider,{value:!0},n.createElement("div",{className:O().container},!!r&&n.createElement(_.A,{title:F.t("{workflowName} | Workflow Builder | {teamName}",{workflowName:(0,l.Ay)((0,h.BQ)(r)),teamName:(0,l.Ay)(c)})}),n.createElement(m.f,{backRouteName:u,backRouteParams:p,workflow:r,canEditName:!1,secondaryContent:!!r&&n.createElement("div",{className:O().header_actions},t&&n.createElement(i.lV,{onClick:this.restoreWorkflowVersion,type:"outline",loading:e,"aria-label":F.t("Restore This Version")},F.t("Restore This Version")),n.createElement(x.Wt,{routeName:u,params:p},n.createElement(i.Ay,{disabled:e},F.t("Cancel"))))}),n.createElement("div",null,!!r&&n.createElement(s.nB,{element:"div",weight:"black",className:O().warning_message},F.t("You're viewing a  previous version of this workflow, published {publishedDate} at {publishedTime}",{publishedTime:(0,w.Yq)((0,h.fQ)(r),"{time}"),publishedDate:(0,w.Od)((0,h.fQ)(r))})),n.createElement(d.x,{className:O().content_container},this.renderContent()),n.createElement(y.A,null))))))}};P.displayName="_PageWorkflowVersion";let R={loadWorkflowVersion:T.S_,restoreHermesWorkflowVersion:A.mr},B=(0,S.N)((e,{teamId:t,workflowId:a,versionId:n})=>{let r=(0,N.WR)(e),l=(0,C.RG)(e,a),i=(0,h.MP)(l,r),o=(0,c.I)(e);return{canRestoreVersion:i&&o,version:(0,I.a2)(e,n),latestWorkflow:l,versionLoading:(0,I.gJ)(e,n),versionLoaded:(0,I.Dz)(e,n),versionLoadError:(0,I.mr)(e,n),team:(0,M._J)(e,t)}},R)(P),W=B},0xf4030543:(e,t,a)=>{"use strict";a.d(t,{y:()=>n});let n=100},0x220757cb0:(e,t,a)=>{"use strict";a.d(t,{B:()=>TriggerRunSettings});var n,r=a(0xbad225b5),l=a(0x120c268ad),i=a.n(l),o=a(0x16475a65c),s=a(0xf2e7528e),c=a(0x1d24ec95f),d=a(0x72b537b5),u=a(0x20b4dda68),m=a(0x20482ad21),p=a(0x16ac9b089),b=a(0x45bd075),f=a(0x1d2cd7755),g=a(0x143f89715),h=a(0x4c96e5d9),_=a(0x7f5a02e8),y=a(0x1d1a513a),x=a(0x16e99b359),v=a(0x124d99cb0),E=a(0x24430233d),k=a(0x6960d8b9),w=a(0x1ccef1c6f),S=a(0x226892387);let C=new m.Ay("workflow_builder"),ScheduledTriggerRunAccessHelpText=({className:e,trigger:t})=>{let a=(0,S.d4)(e=>(0,w.ty)(e,"time24")),{schedule:n}=t.config,l=(0,v.lP)(n.startTime,n.timezone),i=(0,k.Od)(l,{excludeYear:!0,uncapitalizedRelativeDay:!0}),o=l.format(a?"HH:mm":"h:mm A"),s=(0,E.o)(n);return r.createElement("span",{className:e},C.rt("This is a scheduled workflow. Next run {humanReadableDate} at {humanReadableTime}{humanReadableRepeat}.",{humanReadableDate:i,humanReadableTime:o,humanReadableRepeat:""===s?s:` ${s}`}))};ScheduledTriggerRunAccessHelpText.displayName="ScheduledTriggerRunAccessHelpText";var A=a(0x126af815a),T=a(0x13c8b082e),I=a(0x1f66b5878),N=a(0x1887ed0ea),M=a(0x1b1df7714),L=a.n(M);let O=new m.Ay("workflow_builder"),TriggerRunAccessHelpText=({workflowId:e,isAllowExternalOrgsChecked:t=!1,permissionType:a,trigger:n})=>{let l=(0,S.d4)(e=>(0,I.p$)(e,"hermes_triggers_trippable_by_slack_connected_teams")),i=(0,S.d4)(N.M7),{isTrippableByAnySlackConnectedTeamByPrefs:o}=(0,y.u)(e),s=n.type===A.LO,c=n.type===A.zW;return s?r.createElement(ScheduledTriggerRunAccessHelpText,{className:L().helpText,trigger:n}):a===T.PW.app_collaborators?r.createElement("span",{className:L().helpText},O.t("Only workflow managers can find and use this workflow",{fallbackHash:"45866bc2093eb04b2e05464a6d10af2a7d575c0d"})):a===T.PW.named_entities?r.createElement("span",{className:L().helpText},c?O.t("Only people in this list can find and use this workflow."):O.t("Only people in this list can find this workflow.")):(!i&&l||i&&o)&&a===T.PW.everyone&&t?r.createElement("span",{className:L().helpText},O.t("All new connected external orgs will need to be manually added.")):null};TriggerRunAccessHelpText.displayName="TriggerRunAccessHelpText";var F=a(0x2264e6ea3),D=a(0x15bd59d31),P=a(0x10d53599f),R=a(0x1de80d519),B=a(0x16ed1b0dc),W=a(0x4f725d55);let TriggerRunSettingsListEntity=({option:e})=>{let t=e.value,a=null;return(0,W.A)(t)?a=r.createElement(P.A,{id:t,"data-qa":"trigger-run-settings-list-entity-member"}):(0,B.A)(t)?a=r.createElement(D.A,{channelId:t,"data-qa":"trigger-run-settings-list-entity-channel"}):((0,F.Ay)(t)||(0,F.JV)(t))&&(a=r.createElement(R.e,{id:t,"data-qa":"trigger-run-settings-list-entity-team"})),a};TriggerRunSettingsListEntity.displayName="TriggerRunSettingsListEntity";var V=a(0x20570d71a),H=a(0x1a5ac3a0c),q=a(0x19dc73101),U=a(0x12cc25ec2),z=a(0x23198a843),j=a(0xf09fa16e),G=a(0x9b971e7e),$=a(0x66c6b26d),K=a(0x20adb28cd),Y=a(0x358bddfc),Q=a(0x14149c126),Z=a(0x1cbba0fb),J=a(0x8b08ad98),X=a.n(J);let ee=new m.Ay("workflow_builder");var et=((n=et||{}).IS_WORKFLOW_RESTRICTED="is_workflow_restricted",n.IS_EXTERNAL_TEAM_INVALID="is_external_team_invalid",n.GENERIC_DRIFT_ERROR="is_invalid_existing_external_target",n);let TriggerRunSettings=({currentTeamId:e,teamName:t,selectedRunAccessOption:a,setRunAccessOption:n,selectedEntitiesWithRunAccess:l,setSelectedEntitiesWithRunAccess:m,entitiesWithRunAccessErrors:v,selectedCollaborators:E,selectedExternalEntities:k,hasExternalEntititesDriftedFromSCPrefs:w,overrideTrigger:C,overrideWorkflowConnectionsPrefs:M,overrideWorkflowRetrictions:L,overridePermissions:O})=>{let F=(0,d.U)(),D=(0,j.A)(),P=(0,V.Y)(),R=(0,S.d4)(e=>(0,Z.yz)(e,"available")),B=(0,S.d4)((0,$.sx)(P,K.RG)),W=(0,S.d4)(N.M7),J=(0,S.d4)(e=>"on"===(0,Q._Z)(e,"wfb_acl_translation")),et=(0,S.d4)(e=>M||(0,K.NN)(e,P)),ea=(0,r.useMemo)(()=>B?.trigger?(0,H.eG)(B.trigger,B.coachmarkData):void 0,[B]),en=C??ea,er=(0,S.d4)(e=>(0,I.p$)(e,"hermes_triggers_trippable_by_slack_connected_teams")),{isTrippableByAnySlackConnectedTeamByPrefs:el,isTeamValidSCWorkflowTarget:ei,workflowRestrictedStatus:eo}=(0,y.u)(P,M,L),es=(0,S.d4)(e=>L?L.is_restricted:(0,K.lW)(e,P)),ec=(0,S.d4)(G.Kc),ed=(0,S.d4)(e=>(0,K.kS)(e,P,k,O)),[eu,em]=(0,r.useState)(k.length>0),ep=k.length>0||el&&a!==T.PW.app_collaborators,eb=ee.t("Everyone internal in {teamName}",{teamName:(0,p.Ay)(t)}),ef=J?ee.t("Workflow managers, plus specific people, channels, and workspaces"):"Workflow managers, plus specific people, channels, and workspaces",eg=ee.t("Workflow managers only"),eh=(0,r.useMemo)(()=>[{label:eb,value:T.PW.everyone},{label:ef,value:T.PW.named_entities},{label:eg,value:T.PW.app_collaborators}],[eg,eb,ef]),e_=ee.t("No selection"),ey=(0,r.useMemo)(()=>{let e=eh.find(e=>e.value===a);return e?e.label:e_},[eh,a,e_]),ex=(0,r.useCallback)(e=>{e!==a&&(e===T.PW.named_entities&&m([...E,...k]),e===T.PW.everyone&&m(eu?R.slice(0,99):[]),e===T.PW.app_collaborators&&(m([]),em(!1))),n(e)},[R,eu,E,a,k,n,m]),ev=(0,r.useCallback)(e=>{let t=e.map(({value:e})=>e);m(e=>{let a=e.filter(e=>!k.includes(e)),n=(0,o.A)(t,a),r=(0,o.A)(a,t);return(0,s.A)(e,a,n).filter(e=>!r.includes(e))})},[k,m]),eE=(0,r.useCallback)(e=>{let t=e.map(({value:e})=>e);m(e=>{let a=e.filter(e=>k.includes(e)),n=(0,o.A)(t,a),r=(0,o.A)(a,t);return(0,s.A)(e,a,n).filter(e=>!r.includes(e))})},[k,m]),ek=(0,r.useCallback)(t=>{t.target.checked||m(t=>t.filter(t=>!(a===T.PW.everyone&&t===e||k.includes(t)))),em(e=>!e)},[a,m,e,k]),ew=(0,r.useCallback)(e=>r.createElement(TriggerRunSettingsListEntity,{option:e}),[]),[eS,eC]=(0,r.useMemo)(()=>(0,c.A)(v,e=>!eu||e.id!==z.S.TooManyNamedEntities),[v,eu]),eA=(0,r.useMemo)(()=>(0,g.A)(eS,F)||v.some(({id:e})=>e===z.S.TooManyNamedEntities),[v,eS,F]),eT=(0,r.useMemo)(()=>{if(a!==T.PW.named_entities)return null;let e=null;e=!W&&er||W&&el?(0,_.Zq)(_.Dm):(0,_.Zq)(_.aQ);let t=l.filter(e=>!k.includes(e)).map(e=>({label:e,value:e}));return r.createElement(q.h,{width:"100%",isInvalid:eA,errors:eS,renderOption:ew,searcherOptions:e,selectedOptions:t,onSelectedItemsChange:ev,selectDataQa:"run-trigger-permissions-internal-entities-multi-select",selectId:"run-trigger-permissions-internal-entities-multi-select",className:"margin_bottom_50"})},[a,W,er,el,l,eA,eS,ew,ev,k]),eI=ee.t("Your workflow includes third-party steps or restricted Slack built-ins, so it cannot be shared with external teams."),eN=(0,r.useMemo)(()=>(es&&!ed&&eC.push({id:"is_workflow_restricted",message:eI}),eC.length>0?eC:[]),[eC,es,ed,eI]),eM=(0,r.useMemo)(()=>(0,g.A)(eN,F)||v.some(({id:e})=>e===z.S.TooManyNamedEntities),[v,eN,F]),eL=(0,r.useCallback)(({id:e})=>(!es||!!W)&&(!et||ei(e)),[W,ei,es,et]),eO=(0,r.useMemo)(()=>{if(!ep||!eu)return null;let e=(0,_.Zq)(_.TE,{filter:eL}),a=k.map(e=>{let t=!ei(e);return{label:e,value:e,isTeamError:t}}),n=[];return W?w&&(n=[{id:"is_invalid_existing_external_target",message:ee.t("Some organizations are not allowed to use this workflow.")}]):n=eN.concat(w?{id:"is_external_team_invalid",message:ee.t("Some organizations don\u2019t have permissions to use workflows created by {teamName}",{teamName:t})}:[]),r.createElement(q.h,{width:"100%",renderOption:ew,searcherOptions:e,selectedOptions:a,onSelectedItemsChange:eE,selectDataQa:"run-trigger-permissions-external-teams-multi-select",selectId:"run-trigger-permissions-external-teams-multi-select",className:"margin_bottom_50",errors:n,isInvalid:!W&&eM||w})},[ep,eu,eL,k,w,ew,eE,eM,ei,W,t,eN]),eF=(0,r.useMemo)(()=>{if(!ep)return null;let e=ee.t("Also include connected, external organizations to find and run"),t=!1,a=null;W&&(eo===Y.U.FULL_RESTRICTED&&(a=ee.t("External organizations are not allowed to use this workflow."),t=!0),eo===Y.U.RESTRICTED_BY_ONLY_CONNECTORS&&(et?.allowed_teams_with_3p_connectors?.length??0)===0&&et?.hermes_triggers_trippable_by_slack_connected_teams_mcp!==U.HF.SAFE_AND_3P&&(a=ee.t("External organizations are not allowed to use this workflow because it contains third party steps."),t=!0));let n=(ec===u.uh||ec===u.kp)&&ed,l=!W&&es&&!eu&&0===k.length&&!n,o=r.createElement(f.A,{className:i()({[X().disabledCheckboxLabel]:W&&t}),text:e,subtext:a,type:"inline",cursor:"pointer","data-qa":"allow-external-orgs-checkbox-label",isDisabled:!W&&l||t},r.createElement(b.A,{id:"allow-external-orgs",name:"allow-external-orgs",value:String(eu),checked:eu,onChange:ek,"data-qa":"allow-external-orgs-checkbox","aria-disabled":!W&&l||t}));return!W&&l?r.createElement(h.Ay,{"data-qa":"allow-external-orgs-checkbox-tooltip",tip:eI},o):o},[ep,W,ec,ed,es,eu,k.length,ek,eI,eo,et?.allowed_teams_with_3p_connectors?.length,et?.hermes_triggers_trippable_by_slack_connected_teams_mcp]);if((0,r.useEffect)(()=>{k.length>0&&D.current&&em(!0)},[D,k.length]),!en)return null;let eD=ee.t("Who can find and use this workflow?",{fallbackHash:"7d5e45c9df7cc48c632e106be22861700e67214b"}),eP=ee.t("Who can find this workflow?",{fallbackHash:"c49daccad9eba5c019308fe7556b8494fcb19f7a"});return r.createElement("div",{className:"margin_bottom_150"},r.createElement(f.A,{htmlFor:"run-trigger-permissions-select",text:en.type===A.zW?eD:eP},r.createElement(x.l,{id:"run-trigger-permissions-select",value:a,options:eh,placeholder:ey,ariaLabel:ee.t("Default selection"),onChange:ex,required:!0,errorText:"",className:"margin_bottom_50"})),eT,eF,eO,eA||eM?null:r.createElement(TriggerRunAccessHelpText,{workflowId:P,isAllowExternalOrgsChecked:eu,permissionType:a,trigger:en}))};TriggerRunSettings.displayName="TriggerRunSettings"},0x1e813d5b2:(e,t,a)=>{"use strict";a.d(t,{Q:()=>WorkflowPreview});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x1d2cd7755),i=a(0x12cef2078),o=a(0xe9c32bb),s=a(0x126af815a),c=a(0x239cd8d69),d=a(0x1dc84ebc7),u=a(0x21e6a881a),m=a(0xa25cde92),p=a(0xe38b5635),b=a(0x33f2430),f=a.n(b);let g=new r.Ay("workflow_builder"),h={[s.LO]:s.Oy,[s.bX]:s.UE};function mapHermesTriggerTypeToShared(e){let t=e&&h[e];return t||e}let WorkflowPreview=({workflow:e,trigger:t,workflowName:a,workflowDescription:r,shouldAllowAutomatedTriggerPreview:b=!1})=>{let h=t?.type,_=s.zW===h,y=(0,d.j)({trigger:{...t,type:mapHermesTriggerTypeToShared(h)},workflow:{...e,steps:e.steps}});a&&(y.title=a),r&&(y.description=r);let x=y?.description,v=e?.icons?.image_192,E=g.t("This is how the workflow will appear in Slack messages and canvases");return n.createElement(n.Fragment,null,e&&y&&n.createElement(n.Fragment,null,_||b?n.createElement("div",{className:f().workflow_preview},n.createElement(l.A,{text:g.t("Preview"),htmlFor:"",className:f().preview_subtitle,"data-qa":"workflow-details-modal-preview"},n.createElement(o.nB,null,E),_?n.createElement(m.j,{shortcutInfo:y,showActions:!1,showByline:!1,isWorkflowBuilderPreview:!0,iconUrl:v}):n.createElement(i.X,null,n.createElement(p.A,{className:"p-workflow_card",elevation:2,size:"medium"},n.createElement(u.A,{shortcutInfo:y,iconUrl:v}),n.createElement("div",{className:"p-workflow_card__body"},x&&n.createElement("div",{className:"p-workflow_card__body__description"},x),n.createElement(c.x,{owningTeamId:y.owningTeamId,className:"margin_top_75"})))))):n.createElement("div",{"data-qa":"workflow-preview-non-link",className:f().non_link_trigger})))};WorkflowPreview.displayName="WorkflowPreview"},0xcb036ba:(e,t,a)=>{"use strict";a.d(t,{Z:()=>SegmentErrorText,_:()=>eP});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0xf7ab484f),i=a(0x1a5ac3a0c),o=a(0x6cc5eee0),s=a(0x1b3ecb90f),c=a(0x1806ce928),d=a(0x12d850a65),u=a(0x145d46a61),m=a(0xa1832ae4),p=a(0x1795d8821),b=a(0x158cf1cb),f=a(0x226892387),g=a(0x14149c126),h=a(0x20cfa1dc2),_=a(0x1ee439e69);let y=new r.Ay("workflow_builder"),{EXTERNAL_TRIGGER_DISALLOWED_STEP_SENDDM:x,EXTERNAL_TRIGGER_DISALLOWED_STEP_MULTI_RECORD:v,EXTERNAL_TRIGGER_DISALLOWED_STEP_SINGLE_RECORD:E,DIGEST_TRIGGER_DISALLOWED_STEP:k,INVALID_MULTI_RECORD_TRIGGER_EXTRA_STEPS:w,INVALID_MULTI_RECORD_TRIGGER_INVALID_FIRST_STEP:S,INVALID_MY_MULTI_RECORD_TRIGGER_INVALID_FIRST_STEP:C,INVALID_MULTI_RECORD_TRIGGER_INVALID_STEP:A,INVALID_MULTI_RECORD_TRIGGER_INVALID_SALESFORCE_APP_STEP:T,EXTERNAL_TRIGGER_REQUIRED:I,INTERACTIVE_TRIGGER_REQUIRED:N,INTERACTIVE_TRIGGER_OR_STEP_REQUIRED:M,INTERACTIVE_TRIGGER_OR_STEP_OR_BUILDER_AUTH_REQUIRED:L,INVALID_CANVAS_STEPS:O,INVALID_EMOJI:F,INVALID_EXTERNAL_STEPS:D,INVALID_EXTERNAL_TOKEN_IDS:P,INVALID_INTERACTIVITY_POINTER:R,INVALID_SEND_TO_SALES_HOME_STEPS:B,INVALID_SEND_TO_SALES_HOME_BRANCH:W,INVALID_SEND_TO_SALESFORCE_APP_BRANCH:V,INVALID_SEND_TO_SALESFORCE_APP_RECIPIENT:H,INVALID_SEND_TO_SALESFORCE_APP_STEPS:q,INVALID_STEP_POSITION:U,INVALID_MULTIPLE_SF_CHANNELS_INVALID_STEP:z,INVALID_CANNOT_CREATE_SAME_SF_CHANNEL_TWICE_STEP:j,INVALID_STEP_WITH_SF_INSTANT_TRIGGER:G,INVALID_STEP_WITH_SF_SCHEDULED_TRIGGER:$,INVALID_STEP_WITH_SF_EXTERNAL_TRIGGER:K,INVALID_TEMPLATE_MACRO_INPUTS:Y,INVALID_TEMPLATE_VALUES:Q,INVALID_WORKFLOW_AUTH_STRATEGY:Z,MISSING_ONE_OF_OPTIONAL_INPUTS:J,MISSING_INPUTS:X,USER_CANNOT_USE_FUNCTION:ee,FUNCTION_STEP_UNKNOWN_REFERENCE:et,UNDEFINED_FUNCTION_PARAM:ea,INVALID_EXTERNAL_CHANNEL_SUMMARIZE_CHANNEL:en,INVALID_EXTERNAL_CHANNEL_SUMMARIZE_CHANNEL_CANVAS:er,INVALID_EXTERNAL_USER_CHANNEL_SUMMARIZE_CHANNEL_SHARE_CANVAS:el,INVALID_EXTERNAL_USER_SUMMARIZE_CHANNEL:ei,INVALID_EXTERNAL_USER_SUMMARIZE_CHANNEL_CREATE_CANVAS:eo,INVALID_USER_CONTEXT:es,INVALID_FIELD_FOR_LIST_TRIGGER:ec,USER_NOT_LOGGED_INTO_SALES_HOME:ed,USER_NOT_LOGGED_INTO_SALESFORCE_APP:eu,INVALID_INTERACTIVITY_CONFIGURATION_INPUT_PARAMETER:em,INVALID_SERVICE_TRIGGER_EXTERNAL_TOKEN_IDS:ep,INVALID_TEMPLATE_VALUES_SERVICE_TRIGGER:eb,STEP_REQUIRES_TEAM_AI_ACCESS:ef,USERGROUPS_NOT_AVAILABLE:eg,CUSTOM_STEPS_NOT_AVAILABLE:eh,INVALID_EMOJI_REACTION_EVENT_TRIGGER:e_,INVALID_EXTERNAL_CHANNEL_ASK_AGENTFORCE:ey,INVALID_EXTERNAL_CHANNEL_ASK_AGENTFORCE_CANVAS:ex,INVALID_EXTERNAL_USER_ASK_AGENTFORCE:ev,INVALID_EXTERNAL_USER_ASK_AGENTFORCE_CREATE_CANVAS:eE,INVALID_EXTERNAL_USER_CHANNEL_ASK_AGENTFORCE_SHARE_CANVAS:ek,INVALID_PRIVATE_CHANNEL_ASK_AGENTFORCE:ew,INVALID_PRIVATE_CHANNEL_SUMMARIZE_CHANNEL:eS,MESSAGE_CONTEXT_REQUIRED_ASK_AGENTFORCE:eC,TRIGGER_TYPE_NOT_SUPPORTED_ASK_AGENTFORCE:eA,USER_LACKS_STEP_ACCESS:eT,INVALID_RICH_TEXT_ELEMENT_TYPE:eI,CHANNEL_EXCLUDED_FROM_SLACK_AI:eN,CHANNELS_EXCLUDED_FROM_SLACK_AI:eM,WORKFLOW_CANVAS_NOT_FOUND:eL,WORKFLOW_LIST_NOT_FOUND:eO,FILE_SIZE_TOO_LARGE:eF,TRIGGER_CHANNEL_INSUFFICIENT_POSTING_PERMISSIONS:eD}=h.oh,eP={PREVIEW:"preview",MODAL:"modal"},SegmentErrorText=({errorCode:e,errorMessage:t,slackFunction:a,viewContext:r=eP.PREVIEW})=>{let h=(0,f.d4)(u.Ry),Q=(0,f.d4)(u.Mw),eb=(0,f.d4)(u.cA),eR=(0,f.d4)(u.dI),eB=(0,f.d4)(u.sQ),eW=(0,f.d4)(u.EY),eV=y.rt("<strong>Needs attention.</strong> This step requires some additional info."),eH=(0,f.d4)(e=>"on"===(0,g._Z)(e,"ask_agentforce_step")),eq=(0,f.d4)(e=>"on"===(0,g._Z)(e,"ask_agentforce_trigger_validations")),eU=(0,f.d4)(e=>"on"===(0,g._Z)(e,"ask_agentforce_i18n")),ez=(0,f.d4)(e=>"on"===(0,g._Z)(e,"ai_channel_exclusions")),ej=(0,f.d4)(_.H7),renderErrorMessage=()=>t&&"string"==typeof t?n.createElement(o.A,{text:t,className:"break_all",emojiSize:s.lw.SMALL,noLinking:!0,noHighlights:!0,noCode:!0,noQuotes:!0,noSpecials:!0}):null;switch(renderErrorMessage.displayName="renderErrorMessage",e){case ec:return eV;case l.m0:return y.rt("Restricted: you cannot publish or edit this step but the workflow will continue to run.");case l.Hx:case l.nH:case X:return y.rt("<strong>Needs attention.</strong> You\u2019ll need to pick a channel or person.");case l.t3:case l.Lj:return y.rt("<strong>Needs attention.</strong> You\u2019ll need to pick a channel.");case l.T8:return y.rt("<strong>Needs attention.</strong> Choose a workspace for this channel.");case l.EW:return y.rt("<strong>Needs attention.</strong> You\u2019ll need to pick an emoji.");case e_:{let e=(0,m.F1)(ej);return y.rt("The selected emoji doesn\u2019t exist in {workspaceName}. Choose a different emoji to continue.",{workspaceName:e})}case l.U3:return y.rt("Your workflow is scheduled to start in the past. Select a future time or date to continue.");case l.Jx:return eB?y.rt("<strong>Permission required.</strong> Private channels are disabled for this trigger."):"<strong>Permission required.</strong> Private channels are disabled for this trigger.";case l.qP:return eW?y.rt("<strong>Permission required.</strong> Private channels are disabled for this step."):"<strong>Permission required.</strong> Private channels are disabled for this step.";case l.yF:return eB?y.rt("<strong>Variable not available.</strong> The <strong>Text of the message</strong> variable can\u2019t be used in private channels."):"<strong>Variable not available.</strong> The <strong>Text of the message</strong> variable can\u2019t be used in private channels.";case l.aU:return y.rt("<strong>Needs attention.</strong> You\u2019ll need to pick another channel.");case P:return y.rt("Connect your external account to fix this step");case ep:return y.rt("Connect your external account to fix this trigger");case N:return y.rt("To use this step, your workflow needs to start from a link in Slack.");case M:return y.rt("To use this step, you\u2019ll need to add a message step with a button or your workflow needs to start from a link in Slack.");case L:return y.rt("To use this step, change the account used for this step to be yours, or add a message step with a button before this step.");case I:return y.rt("To use this step, the workflow must start with the Salesforce \u201CWhen a record changes\u201D action.");case x:return y.rt("External triggers cannot be sent as a Direct Message.");case v:return y.rt("External triggers with a single record cannot be sent using a multiple record step.");case E:return y.rt("External triggers with multiple records cannot be sent using a single record step.");case k:return Q?y.rt("This step can\u2019t be used when starting the workflow with <strong>On a schedule: Summarize record changes</strong>. Use <strong>Send Summary to Sales Home</strong> instead."):"This step can\u2019t be used when starting the workflow with On a schedule: Summarize record changes. Use Send Summary to Sales Home instead.";case w:return y.rt("Workflows starting with a multi-record trigger can only have a single step (must be a Send Summary to Sales Home step)");case A:return y.rt("Workflows starting with a multi-record trigger can only use one Send Summary to Sales Home step");case T:return eb?y.rt("Workflows starting with a multi-record trigger cannot use this step. Remove this step to continue."):eV;case S:return Q?y.rt("Workflows starting with a multi-record trigger must have the <strong>Send Summary to Sales Home</strong> or <strong>Send Summary to My Sales Home</strong> step before all other steps."):y.rt("Workflows starting with a multi-record trigger must have the Send Summary to Sales Home step before all other steps");case C:return Q?y.rt("Workflows starting with a multi-record trigger must have the <strong>Send Summary to My Sales Home</strong> step before all other steps."):y.rt("Workflows starting with a multi-record trigger must have the Send Summary to Sales Home step before all other steps");case B:return y.rt("Workflows only support a single Send to Sales Home step.");case W:return y.rt("Workflows do not support Send to Sales Home steps in branches.");case V:return eb?y.rt("Workflows do not support the <strong>Send to Salesforce App</strong> step in branches. Remove this step to continue."):eV;case H:return eb?y.rt("All <strong>Send to Salesforce App</strong> and <strong>Send to Sales Home</strong> steps in this workflow must have the same recipient."):eV;case q:return eb?y.rt("Workflows cannot have both <strong>Send To Salesforce App</strong> and <strong>Send To My Salesforce App</strong> steps. Remove one to continue."):eV;case z:return y.rt("To send a message to the Salesforce channel created in a previous step, use the Send a message to a channel step instead.");case j:return y.rt("A Salesforce channel for this record is already being created in an earlier step. Remove this step to continue.");case G:return y.rt("A Slack admin has restricted who can use this step when starting the workflow <strong>When a record changes</strong>. Choose another way to start the workflow.");case $:return y.rt("A Slack admin has restricted who can use this step when starting the workflow <strong>On a schedule</strong>. Choose another way to start the workflow.");case K:return y.rt("A Slack admin has restricted who can use this step. Choose another way to start the workflow.");case l.o1:case D:return t??eV;case F:return y.rt("You can\u2019t use the same emoji to both start the workflow and in this step. Choose a different emoji to continue.");case O:return y.rt("The Update a canvas step cannot follow Summarize Channel step.");case R:if(a&&a.callback_id===p.oW.OpenForm)return y.rt('Add a message step with a "Continue Workflow" button before this one so you can send this form to people.');return y.rt('Add a message step with a "Continue Workflow" button before this interactive step in order to use it.');case es:return y.rt("Add a message step with a button before this one so it can be aware of a user.");case U:return y.rt("To use this step, it has to be the first step in the workflow.");case Z:return y.rt("Your account can\u2019t be used to set up this workflow. Try switching account options.");case ee:return y.rt("Your admin has restricted use of this step. To request access to edit this step or publish this workflow, contact your admin.");case i.TK:return y.rt("This step is from an app that is no longer installed. Remove step.");case J:return y.rt("You\u2019ll need to pick a person or a user group.");case Y:return y.rt("Heads up \u2014 changes made earlier in your workflow have affected this step. Update your variables to continue.");case eS:return eH?y.rt("The summarize channel step cannot be used with private channels. Please choose public channels to proceed."):eV;case eN:return ez?y.rt("An admin has restricted this channel for use with AI steps. Choose a different channel."):eV;case eM:return ez?y.rt("An admin has restricted one or more of the selected channels for use with AI steps. Remove restricted channels."):eV;case en:return y.rt("The summarize channel step cannot be used with channels outside your organization. Please choose channels within your organization to proceed.");case ei:return y.rt("The summarize channel step cannot be used with users from outside your organization. Please choose someone within your organization to proceed.");case er:return y.rt("The selected canvas is shared externally and cannot be updated after a summarize channel step. To continue, select a canvas in your organization.");case eo:return y.rt("The create a canvas step cannot be placed after the summarize channel step if the canvas is owned by someone outside your organization.");case el:return y.rt("The selected canvas is shared externally and cannot be shared after a summarize channel step. To continue, select a canvas in your organization.");case et:case ea:return y.rt("This step requires an update to fix errors with info from another step.");case ef:return y.rt("Needs attention. Your access to AI workflow steps has ended. Slack AI is available with a paid plan add on. Remove this step to continue using this workflow.");case ed:return y.rt("Connect to Salesforce in Sales Home to use this step and publish this workflow.");case eu:return eb?y.rt("Sign in to Salesforce in the Salesforce App to publish a workflow using this step."):eV;case d.e.ListNotFound:if(r===eP.MODAL)return y.rt("The list has been deleted, or you no longer have permission to use it. Select another list to continue.");return y.rt("Update selected list.");case l.GA:case l.Ty:case l.Ag:case l.ny:case l.AE:case l.FD:case c.n.FunctionExecutionError:return renderErrorMessage()??eV;case em:return y.rt("This step requires an update to fix errors within button configuration.");case l.OJ:if(a?.id===b.gy)return y.rt("Your list schema has changed. Open and save this step to update your form.");return y.rt("Your schema has changed. Open and save this step to update your form.");case eg:return y.rt("User groups are only available with specific paid plans. To continue using this step, upgrade your plan.");case eh:return y.rt("Custom steps are only available with specific paid plans. To continue using this step, upgrade your plan.");case l.GR:return h?y.rt("All Salesforce steps must use an account in the same Salesforce organization."):eV;case ey:return eH?y.rt("The ask agentforce step cannot be used with channels outside your organization. Please choose channels within your organization to proceed."):eV;case ev:return eH?y.rt("The ask agentforce step cannot be used with users from outside your organization. Please choose someone within your organization to proceed."):eV;case ex:return eH?y.rt("The selected canvas is shared externally and cannot be updated after a ask agentforce step. To continue, select a canvas in your organization."):eV;case eE:return eH?y.rt("The create a canvas step cannot be placed after the ask agentforce step if the canvas is owned by someone outside your organization."):eV;case ek:return eH?y.rt("The selected canvas is shared externally and cannot be shared after a ask agentforce step. To continue, select a canvas in your organization."):eV;case ew:return eH?y.rt("The agentforce step cannot be used with a private channel. Please choose a public channel to proceed."):eV;case eC:return eH?y.rt("Message context is required to send a message as the agent."):eV;case eA:return eq?y.rt("To use this step, you\u2019ll need to start the workflow from a link in Slack."):eV;case eT:return eU?y.rt("This is no longer available in Workflow Builder. Remove it to continue."):eV;case eI:return y.rt("To use this step, remove the unsupported rich text content.");case l.y6:return n.createElement(n.Fragment,null,n.createElement("strong",null,"Cannot access source.")," There is an issue accessing a knowledge source.");case l.CC:return eR?y.rt("Canvas variables from triggers are not allowed in this step. Please remove them to continue."):"Canvas variables from triggers are not allowed in this step. Please remove them to continue.";case l.nT:return eR?y.rt("Channel variables from triggers are not allowed in this step. Please remove them to continue."):"Channel variables from triggers are not allowed in this step. Please remove them to continue.";case l.hc:return eR?y.rt("Salesforce channels cannot be used with this step."):"Salesforce channels cannot be used with this step.";case l.oi:return eR?y.rt("External channels cannot be used with this step."):"External channels cannot be used with this step.";case eL:return eR?y.rt("One or more selected canvases were not found. Choose a different canvas to continue."):"One or more selected canvases were not found. Choose a different canvas to continue.";case eO:return eR?y.rt("One or more selected lists were not found. Choose a different list to continue."):"One or more selected lists were not found. Choose a different list to continue.";case eF:return eR?y.rt("<strong>Needs attention.</strong> {errorMessage}",{errorMessage:t}):`Needs attention. ${t}`;case eD:return t;case l.Js:return y.t("This step cannot be used with this starting action. Remove this step, or select a different starting action.");default:return eV}};SegmentErrorText.displayName="SegmentErrorText"},0x126eb9491:(e,t,a)=>{"use strict";a.d(t,{G:()=>MultiPaneSegmentFormModal});var n,r=a(0xbad225b5),l=a(0x16cf1da63),i=a(0x120c268ad),o=a.n(i),s=a(0x40c0d834),c=a(0x20482ad21),d=a(0x134e233cc),u=a(0x2b7f0bcc),m=a(0x24546e7f2),p=a(0x2501a2cee),b=a(0x6e87d4ec),f=a(0xbe0b63ff),g=a(0x1df96de4c),h=a(0x11a296110),_=a(0x45bd075),y=a(0x1d2cd7755),x=a(0x344bb842),v=a(0x4c96e5d9),E=a(0x1407c6c2c),k=a(0x12edaa96a),w=a(0x1d1911997),S=a(0x210b99e76),C=a(0x88dc61ea),A=a(0xa231133b),T=a(0x1d9a37519),I=a(0x207fb9b92),N=a(0x145d46a61),M=a(0x226892387),L=a(0x10ab7504),O=a.n(L);let F=new c.Ay("workflow_builder"),D=(0,r.memo)(({formWrappableParameters:e,questionName:t,appId:a,functionCallbackId:n})=>{let l=(0,E.A)(),[i,o]=(0,r.useState)(l),s=(0,r.useCallback)(()=>o((0,k.A)()),[]),c=(0,C.rC)(),d=(0,M.d4)(N.$T),u=(0,r.useMemo)(()=>(0,S.m)(n),[n]),m=(0,r.useCallback)(a=>{a.value===t&&s();let n=e?.find(e=>e.name===a.value);c((0,A.Qj)({questionName:t,parameter:n}))},[c,s,e,t]),b=(0,r.useMemo)(()=>e?.map(e=>({value:e.name,label:e.title}))??[],[e]),f=(0,r.useMemo)(()=>b.find(e=>e.value===t),[b,t]),{onBlur:g,errorText:h}=(0,I.K)({errorMessage:F.t("This field is required."),isErrored:!f}),_=(0,r.useMemo)(()=>h?[{id:"is_required",message:h}]:[],[h]),x=(0,r.useCallback)(e=>r.createElement("div",{className:"display_flex align_items_center"},a?r.createElement(T.z,{appId:a,size:20,imageClassName:O().appIcon}):r.createElement(p.Ah,{name:u,size:"20"}),r.createElement("span",{className:"margin_left_25"},e.label)),[a,u]);if(!d)return null;let v=F.t("Field type");return r.createElement(y.A,{text:v,className:"margin_bottom_125"},r.createElement(w.Ay,{key:i,selectId:l,selectedOption:f,onOptionSelected:m,options:b,ariaLabel:v,placeholderText:F.t("Select a field\u2026"),width:"100%",isRequired:!0,errors:_,renderOption:x,renderSelectedOption:x,onBlur:g,focusOnMount:!f}))});var P=a(0x118cdcdea),R=a.n(P),B=a(0xec9d0658),W=a(0x852588ab),V=a(0x1ae9b422e);let H=/:skin-tone-[2-6]:/g;function convertOptionStringToDelta(e,t,a){if(!e)return Promise.resolve(new(R())().insert(""));let n=[...e.match((0,B.A)())??[]].map(e=>e.replace(H,"").replace(/:/g,"")),r=Promise.resolve();return n.length&&(r=(0,V.uY)(t,n)),r.then(()=>{let t=new(R())().insert(e),{processedDelta:n}=a((0,W.n)({delta:t,useChannelTagging:!1,useColonEmojiConversion:!0}));return n})}var q=a(0x14fad6485),U=a(0x1d01572a2),z=a(0x66d73753),j=a(0x99233ecb),G=a(0x38bda683),$=a(0xe53aa0),K=a(0x820cbf6d),Y=a(0xab1e931b),Q=a(0x1b77d8ef3),Z=a(0x15bc54ead),J=a(0x2c5a5afa),X=a(0x59bcdfd6),ee=a(0x9b971e7e),et=a(0x24429189c),ea=a(0xb9604b6),en=a(0x5b1935a6),er=a(0x1db9fc363),el=a.n(er);let ei=new c.Ay("workflow_builder"),eo={name:"ellipsis-horizontal-filled"},es=(0,r.memo)(({questionName:e,questionIndex:t,optionIndex:a,options:n,onAddOption:i,onLabelUpdate:o,questionType:s})=>{let c=n[a],d=(0,C.rC)(),u=(0,l.wA)(),[m,p]=(0,r.useState)(),b=(0,M.d4)(ee.ZT)??"",f=(0,r.useRef)(null),{windowRef:g}=(0,r.useContext)(q._0),h=(0,M.d4)(e=>(0,ea.Hp)(e,en.xu.WORKFLOW_BUILDER_QUESTION_OPTION_INPUT)),_=s===G.xi.Dropdown,y=_&&(0,$.X)(c);(0,U.A)(()=>{_&&"string"==typeof c.value&&convertOptionStringToDelta(c.value,b,u).then(e=>{p(e)})});let v=(0,r.useMemo)(()=>{if(_&&y){let e=u((0,et.f)({blocks:c.value})),{processedDelta:t}=u((0,W.n)({delta:e,useChannelTagging:!1}));return{contents:t}}},[u,c,_,y]),E=(0,r.useMemo)(()=>{if(y){let e=u((0,et.f)({blocks:c.value}));return(0,X.f)({contents:e.ops})}return c.label},[u,c,y]),k=(0,r.useMemo)(()=>y?v:m?{contents:m.ops}:E,[y,m,v,E]),w=(0,Y.I4)(c),S=(0,Y.kg)(c),T=(0,Y.l4)(n,c.label,a),N=(0,Y.Ot)(c),L="";T?L=ei.t("Dropdown options must be unique."):w?L=ei.t("The option label can\u2019t have more than {maxCharacterLimit, plural, =1 {# character} other {# characters}}.",{maxCharacterLimit:Y.Al}):S&&(L=ei.t("An option label is required."));let{onBlur:O,errorText:F}=(0,I.K)({errorMessage:L,isErrored:!N||T}),D=F?[{id:c.id,message:F}]:void 0,P=(0,r.useCallback)(()=>{let t,a=f?.current?.value();if(_){let e=new(R())(f?.current?.getContents().contents),{blocks:n}=u((0,et.y)({delta:e}));t=n,a=(0,X.f)({contents:e.ops})}if(void 0!==a){let n=_?t??[]:a;d((0,A.ly)({questionName:e,optionId:c.id,value:n,label:a}))}o?.(c.id)},[_,o,c,u,d,e]),B=(0,K.DQ)(a,n.length),V=(0,r.useCallback)(()=>{d((0,A.Zy)({questionIndex:t,questionOptionIndex:a,newQuestionOptionIndex:a-1}))},[d,t,a]),H=(0,r.useCallback)(()=>{d((0,A.Zy)({questionIndex:t,questionOptionIndex:a,newQuestionOptionIndex:a+1}))},[d,t,a]),er=(0,r.useCallback)(()=>d((0,A.JB)({questionName:e,optionId:c.id})),[d,c.id,e]),es=(0,r.useCallback)(e=>r.createElement(j.Ay,e,B.up&&r.createElement(j.Dr,{label:ei.t("Move above"),onSelected:V}),B.down&&r.createElement(j.Dr,{label:ei.t("Move below"),onSelected:H}),(B.up||B.down)&&r.createElement(j.bX,null),r.createElement(j.Dr,{label:ei.t("Delete"),onSelected:er,danger:!0})),[B.up,B.down,V,H,er]),ec=(0,r.useMemo)(()=>_&&"string"==typeof c.value&&void 0===m?null:r.createElement(J.A,{ariaLabel:E,completeOnEmoji:!0,completeOnMembers:_,enableBroadcastKeywords:!1,focusOnMount:!0,id:`${c.id}_input_label`,initialText:k,isSingleLine:!0,isWorkflowQuestionOption:!0,onBlur:O,onEnter:i,onTextChange:P,placeholder:ei.t("List item {itemNumber}",{itemNumber:a+1}),position:"bottom",ref:f,windowRef:g}),[i,O,P,c,a,_,E,g,k,m]);return r.createElement("div",{className:el().container},r.createElement("div",{className:el().inputContainer},_?r.createElement(z.A,{currentCount:c.label.length,maxCharacterLimit:Y.Al,counterMinimumCharacters:0},r.createElement(Z.A,{className:"normal padding_right_300",enableEmojiButton:!0,enableMentionButton:!0,errors:D,forceToolbarDisabled:!0,isInvalid:!!D,numMaxLines:1,numMinLines:1,showWorkflowOptionItemMentionTip:h===en.ze.HERMES_WORKFLOWS_OPTION_ITEM_MENTION_TIP&&0===a,withWorkflowTokens:!0,withBasicContainerBorder:!0},ec)):r.createElement(Q.A,{errors:D,isInvalid:!!D,numMaxLines:1,numMinLines:1},ec)),r.createElement("div",null,r.createElement(j.cQ,{renderMenu:es,position:"bottom-right",offsetX:0},r.createElement(x.A,{"aria-label":ei.t("More actions"),outline:!0,svgIconProps:eo}))))});var ec=a(0x9f477e8a),ed=a(0x5475ff55),eu=a(0xea61e449),em=a.n(eu);let ep=new c.Ay("workflow_builder"),eb=(0,r.memo)(({questionName:e,options:t=[],questionIndex:a,questionType:n,questionHermesType:i})=>{let o=(0,C.rC)(),s=(0,l.wA)(),c=(0,M.d4)(ee.ZT)??"",d="slack#/types/rich_text"===i,u=(0,r.useMemo)(()=>t?.every(e=>"object"==typeof e.value&&e.value[0]?.type==="rich_text"?e.label.length:e.value.length),[t]),m=(0,ec.aA)(n,t)&&u,b=(0,r.useCallback)(()=>{m&&o((0,A.bd)({questionType:n,questionName:e}))},[m,e,n,o]),f=(0,r.useCallback)(a=>{for(let r of t){if(r.id===a)continue;let{label:t,value:l}=r;n===G.xi.Dropdown&&("string"==typeof l||d)&&"string"==typeof l&&void 0!==t?convertOptionStringToDelta(l,c,s).then(a=>{let n=s((0,et.y)({delta:a}));"blocks"in n&&o((0,A.ly)({questionName:e,optionId:r.id,value:n.blocks,label:t}))}):d&&o((0,A.ly)({questionName:e,optionId:r.id,value:l,label:t}))}},[s,o,d,t,e,n,c]),[g,_]=(0,r.useState)(null),y=(0,r.useCallback)(e=>()=>_(e),[]),x=(0,r.useCallback)(()=>{_(null)},[]),v=(0,r.useMemo)(()=>t.map(({id:l},i)=>r.createElement(ed.lO,{draggableId:l,key:l,index:i,disableInteractiveElementBlocking:g!==l},o=>r.createElement("div",{ref:o.innerRef,...o.draggableProps,...o.dragHandleProps,className:em().drag_handle,onFocus:y(l),onBlur:x,"data-qa":l},r.createElement("div",{className:em().drag_icon},r.createElement(p.Ah,{inline:!0,name:"reorder"})),r.createElement(es,{questionName:e,onAddOption:b,onLabelUpdate:f,questionIndex:a,optionIndex:i,options:t,questionType:n})))),[t,g,y,x,e,b,f,a,n]),E=(0,r.useCallback)(({destination:e,source:t})=>{e&&o((0,A.Zy)({questionIndex:a,questionOptionIndex:t.index,newQuestionOptionIndex:e.index}))},[a,o]),k=(0,r.useCallback)((l,i,o)=>r.createElement("div",{...l.draggableProps,...l.dragHandleProps,ref:l.innerRef},r.createElement(es,{questionName:e,onAddOption:b,questionIndex:a,optionIndex:o.source.index,options:t,questionType:n})),[b,t,a,e,n]);return r.createElement("div",{className:em().container},r.createElement("div",{className:em().label},(e=>{switch(e){case G.xi.StaticMultiSelect:return ep.t("Multiple choice options");case G.xi.Dropdown:return ep.t("Dropdown options");case G.xi.StaticMultiSelectWithCheckboxes:return ep.t("Checkbox options");default:return ep.t("Options")}})(n)),r.createElement(ed.MR,{onDragEnd:E},r.createElement(ed.zv,{droppableId:"options-list",renderClone:k},e=>r.createElement("div",{ref:e.innerRef,...e.droppableProps},v,e.placeholder))),r.createElement(h.Ay,{onClick:b,disabled:!m,type:"outline",className:em().add_option_button},r.createElement(p.Ah,{name:"plus",size:"20"}),r.createElement("span",null,ep.t("Add Option"))))});var ef=a(0x15014e268),eg=a(0x1c0b91ebb),eh=a(0x1789e94fa);let e_=r.lazy(()=>Promise.resolve().then(a.bind(a,0x2370b4942)).then(e=>({default:e.DropdownMentionSupportBadge}))),ey={spaceName:en.xu.WORKFLOW_BUILDER_FORM_QUESTION_TYPE_SELECT,notifications:{[en.ze.HERMES_WORKFLOWS_DROPDOWN_MENTION_SUPPORT_BADGE]:{component:e_}}},{ShortText:ex,LongText:ev,RichText:eE,Dropdown:ek,StaticMultiSelect:ew,StaticMultiSelectWithCheckboxes:eS,File:eC,SelectPerson:eA,UserMultiSelect:eT,SelectChannel:eI,ChannelMultiSelect:eN,Date:eM,DateTime:eL,Number:eO,Boolean:eF}=G.xi,eD=new c.Ay("workflow_builder"),createSelectOptionFromQuestionType=(e,t)=>"divider"===e?{type:"divider"}:{value:e,label:r.createElement(r.Fragment,null,r.createElement(p.Ah,{name:(0,eg.v)(e).icon,inline:!0}),r.createElement("span",{className:"margin_left_25 inline_flex gap_75 align_items_center"},(0,eg.v)(e).label,t?r.createElement(eh.A,ey):null))};createSelectOptionFromQuestionType.displayName="createSelectOptionFromQuestionType";let eP=(0,r.memo)(({questionType:e,questionName:t,isSegmentFormWrapped:a=!1,onUpdateQuestionType:n})=>{let l=(0,C.rC)(),i=(0,r.useCallback)(e=>{l((0,A.eY)({questionName:t,questionType:e.value})),n?.(e.value)},[l,n,t]),o=(0,r.useMemo)(()=>[ex,ev,eE,"divider",ek,ew,eS,"divider",eC,"divider",eA,eT,eI,eN,"divider",eM,eL,eO].map(e=>createSelectOptionFromQuestionType(e,e===ek)),[]),s=(0,r.useMemo)(()=>e===ek?createSelectOptionFromQuestionType(ek,!1):e===eF?createSelectOptionFromQuestionType(eF,!1):o.find(t=>t.value===e),[o,e]),c=(0,r.useMemo)(()=>{let e=[{id:"question-type-select-hint",message:eD.t("Question type is set to match the Field type, so people can submit info in the right format.")}];return a?e:void 0},[a]),d=(0,E.A)();return r.createElement(y.A,{text:eD.t("Question type")},r.createElement(ef.Ay,{selectId:d,selectedOption:s,onOptionSelected:i,options:o,ariaLabel:eD.t("Question type"),placeholderText:eD.t("None selected"),width:"100%",isRequired:!0,isDisabled:a,hints:c}))});var eR=a(0x4df01f17),eB=a(0xc5824c14),eW=a.n(eB);let LoadingSkeleton=()=>r.createElement("div",{className:eW().loading_container},r.createElement("div",{className:eW().loading_skeleton},r.createElement("div",{className:eW().label},r.createElement(eR.A,{width:"25%",height:22,borderRadius:4})),r.createElement(eR.A,{width:"100%",height:36,borderRadius:4}),r.createElement("div",{className:eW().label},r.createElement(eR.A,{width:"25%",height:22,borderRadius:4})),r.createElement(eR.A,{width:"100%",height:36,borderRadius:4}),r.createElement("div",{className:eW().label},r.createElement(eR.A,{width:"25%",height:22,borderRadius:4})),r.createElement(eR.A,{width:"100%",height:36,borderRadius:4}),r.createElement("div",{className:eW().required_checkbox},r.createElement(eR.A,{width:"40%",height:22,borderRadius:4}))));LoadingSkeleton.displayName="LoadingSkeleton";var eV=a(0x16e99b359);let eH=new c.Ay("workflow_builder"),eq=(0,r.memo)(({options:e,questionName:t,maxItems:a})=>{let n=(0,C.rC)(),l=(0,r.useCallback)(e=>n((0,A.d4)({questionName:t,maxItems:e})),[n,t]),i=eH.t("Max selectable items"),o=eH.t("Max selectable items selector"),s=(e||[]).slice(1).map((e,t)=>({label:eH.t("{maxSelectedItemQty} items",{maxSelectedItemQty:t+2,fallbackHash:"5859a572f1fe5a6f80d544931f79283ea6bf095a"}),value:t+2})),c=1===a?(s[s.length-1]||{}).value:a;return r.createElement(y.A,{htmlFor:`${t}_multi_select_max_selected_items`,text:i},r.createElement(eV.l,{id:`${t}_multi_select_max_selected_items`,value:c,options:s,ariaLabel:o,onChange:l,errorText:"",required:!0}))});var eU=a(0x818fd090),ez=a(0x1c09d8c36),ej=a(0x85c4d21),eG=a(0x242822dfb),e$=a(0x8e309e4d),eK=a(0x1c4a1a163),eY=a(0x136ad1993),eQ=a(0x218fd5440),eZ=a(0xa21d3b1e),eJ=a(0x9d5bcdc6),eX=a(0x668181b3),e0=a(0x2772625d),e1=a(0x1b05cc3ce),e2=a(0x96aa1794),e4=a(0x20a2a54fa),e8=a(0x1a5ac3a0c),e5=a(0x252b4df6e),e6=a(0x1795d8821),e3=a(0x25054cb9f);let e7=new c.Ay("workflow_builder"),createChoice=(e,t)=>({value:e,title:("string"==typeof e||"number"==typeof e)&&t?t?.[e]:"",description:""}),QuestionDefaultValue=({segment:e,parameter:t,configuredParameters:a,question:n,wrappedFunction:l})=>{let i=(0,k.A)(),o=(0,C.rC)(),s=(0,e4.EM)(e),c=(0,e5.Dp)(e),d=(0,e2.j)(),u=(0,e8.DY)(d),m=(0,e5.am)(e),p=(0,e5.mV)(e),b=d?.trigger?.id,f=(0,M.d4)(N.$T),g=n.name,h=l.id,_=l.input_parameters.map(eU.w),x=(0,r.useMemo)(()=>(0,eQ.K)(_),[_]),v=(0,r.useMemo)(()=>(0,eG.xn)(_),[_]),E=v.length>0?v[0]:void 0,w=(0,r.useMemo)(()=>!_.some(({name:e})=>e===t.name),[_,t.name]),S=w&&!!E,T=(0,r.useMemo)(()=>(0,eZ.z)({functionVariables:m,variables:s,isFunctionFormWrapped:p,stepId:e.id,isKeyValueParameter:S,parameterName:S?E.name:t.name,dynamicOptionKey:S?t.name:void 0}),[m,p,S,E?.name,t.name,e.id,s]),I=(0,r.useCallback)((e,t)=>{let{source:a,sourceReference:n}=e;return("trigger"===a&&n&&o((0,A.aI)({value:n})),t?.skipMacro)?e:(0,e3.Xq)(e,{fromRichText:t?.isRichText,appId:l?.app_id,parameterType:t?.parameterType,stepId:l?.id,callbackId:l?.callback_id})},[o,l?.app_id,l?.id,l?.callback_id]),L=(0,eG.qt)(t),O=(0,r.useCallback)(e=>(Array.isArray(e)?e:[e]).reduce((e,t)=>{if("string"!=typeof t)return e;let a=(0,eX.x)(T.list,t);return a?.source==="trigger"&&a.sourceReference&&e.push(a.sourceReference),e},[]),[T.list]),F=(0,r.useCallback)(({value:e,label:a,filterQueries:r})=>{if(o((0,A.aI)({value:O(e)})),"choices"in t||L){let l=n?.choices;if(L)if(Array.isArray(e)){let t=l?.reduce((e,t)=>(e[t.value]=t.title,e),{})??{};l=e.reduce((e,n)=>{if("string"==typeof n&&(0,e0.bs)(n))return e;let r={...t,...a};return e.push(createChoice(n,r)),e},[])}else"string"==typeof e&&(0,e0.bs)(e)?"string"==typeof e&&(0,e0.bs)(e)&&(l=void 0):l=[createChoice(e,a)];else"choices"in t&&Array.isArray(t.choices)&&(l=t.choices.map(e=>({...e,description:""})));o((0,A.nX)({value:e,questionName:g,choices:l?.length?l:void 0,filterQueries:r}))}else o((0,A.aL)({value:e,questionName:g}))},[O,o,t,L,n?.choices,g]),D=(0,r.useCallback)((e,t,a,n)=>{F({value:t,label:a,filterQueries:a?.[ez.x3]})},[F]),P=(0,r.useCallback)(e=>{let{value:t}=e;F({value:t,label:"valueLabel"in e?e.valueLabel:void 0,filterQueries:"filterQueries"in e?e.filterQueries:void 0})},[F]),R=(0,r.useMemo)(()=>{let e=(0,e1.WG)(t)?{...t.render_condition,is_required:!1}:void 0;return(0,eU.w)({...t,is_required:!1,render_condition:e})},[t]),B=(0,r.useMemo)(()=>({...(0,e$.c)(t),is_required:!1}),[t]),W=(0,r.useMemo)(()=>(0,eY.z)({callbackId:c,parameter:t}),[c,t]),V=(0,r.useMemo)(()=>{if(!(w&&B.type?(0,eJ.K)(B.type):(0,eJ.K)(t.type===e6.TE.Array?t.items.type:t.type)))return null;if(S){let e=a?.[E.name]?.value,n=(0,eG.wK)(e,E)?e[t.name]:void 0;return r.createElement(ej.J,{parameter:E,dynamicInput:B,value:n??"",values:a,onChange:P,functionId:h,workflowId:u,callbackId:c,variables:T,allowVariables:W,formatVariableBeforeInsert:I,functionVariables:m,isFunctionFormWrapped:p,elementId:i,shouldRenderRichTextInput:!0})}return r.createElement(eK.v,{functionId:h,variables:T,configuredParameters:a,onChange:D,formatVariableBeforeInsert:I,callbackId:c,workflowId:u,triggerId:b,functionVariables:m,isFunctionFormWrapped:p,parameter:R,keyValueParameters:v,oAuthParameter:x,inputParameters:_,hideLabel:!0})},[w,B,t,S,h,T,a,D,I,c,u,b,m,p,R,v,x,_,E,P,W,i]);return f?r.createElement(r.Fragment,null,V&&r.createElement(r.Fragment,null,r.createElement(y.A,{text:e7.t("Default value (optional)"),htmlFor:i,className:"margin_bottom_50",subtext:e7.t("The question input will be prefilled with this for users.")}),r.createElement("div",{className:"margin_bottom_125","data-qa":"question-default-value-input"},V))):null};QuestionDefaultValue.displayName="QuestionDefaultValue";var e9=a(0x139d8d26e);let te=new c.Ay("workflow_builder"),QuestionFileDetails=({questionName:e,maxItems:t=e9.$,allowedFileTypesGroup:a=G.vy.ALL})=>{let n=(0,C.rC)(),l=te.t("How many files should they upload?"),i=te.t("Single"),o=te.t("Multiple"),s=(0,r.useCallback)(t=>n((0,A.d4)({questionName:e,maxItems:t})),[n,e]),c=(0,r.useMemo)(()=>[{label:i,value:1},{label:o,value:e9.$}],[o,i]),d=te.t("Any file type"),u=te.t("Images (JPG, PNG, SVG, etc) only"),m=te.t("What file types should they upload?"),p=(0,r.useMemo)(()=>[{label:d,value:G.vy.ALL},{label:u,value:G.vy.IMAGES_ONLY}],[d,u]),b=(0,r.useCallback)(t=>n((0,A.y_)({questionName:e,allowedFileTypesGroup:t})),[n,e]);return r.createElement(r.Fragment,null,r.createElement(y.A,{htmlFor:`${e}_file_how_many`,text:l},r.createElement(eV.l,{id:`${e}_file_how_many`,value:t,options:c,onChange:s,errorText:"",required:!0})),r.createElement(y.A,{htmlFor:`${e}_file_images_only`,text:m},r.createElement(eV.l,{id:`${e}_file_images_only`,value:a,options:p,onChange:b,errorText:"",required:!0})))};QuestionFileDetails.displayName="QuestionFileDetails";var tt=a(0x126f22530),ta=a(0x1dde3f5ab),tn=a(0x14149c126);let tr=new c.Ay("workflow_builder"),tl=(0,r.memo)(({description:e,questionName:t,questionType:a,maxItems:n})=>{let l="on"===(0,M.d4)(e=>(0,tn._Z)(e,"third_party_user_form_parity")),i=(0,C.rC)(),o=(0,ta.vn)(n)[a],s=(0,r.useCallback)(e=>i((0,A.ud)({questionName:t,description:e})),[i,t]);return r.createElement(y.A,{htmlFor:`${e}_input_label`,text:l?tr.t("Hint (optional)"):tr.t("Description (optional)")},r.createElement(tt.A,{id:`${e}_input_label`,value:e,onChange:s,name:"description",maxCharacterLimit:Y.au,placeholder:o,autoComplete:"off",useInlineAlert:!0,spellCheck:!0,"data-qa":"dialog-question-description__input",hintText:l?tr.t("Hint text will appear below the question, just like this text."):tr.t("Description will appear below the question, just like this text.")}))}),ti=new c.Ay("workflow_builder"),to=(0,r.memo)(({label:e,questionName:t,shouldFocusQuestion:a=!1})=>{let n=(0,C.rC)(),l=ti.t("A question is required."),{onBlur:i,errorText:o}=(0,I.K)({errorMessage:l,isErrored:!(0,Y.fD)({label:e})}),s=(0,r.useCallback)(e=>n((0,A.qt)({questionName:t,label:e})),[n,t]);return r.createElement(y.A,{htmlFor:`${e}_input_label`,text:ti.t("Your question")},r.createElement(tt.A,{id:`${e}_input_label`,value:e,onChange:s,name:"label",maxCharacterLimit:Y.aA,isRequired:!0,focusOnMount:a,onBlur:i,errorText:o,autoComplete:"off",useInlineAlert:!0,spellCheck:!0,"data-qa":"dialog-question-label__input"}))});var ts=a(0x1cbdfeceb),tc=a(0xa7ec93c2),td=a(0x1efcf3032),tu=a(0x22e98208d),tm=a.n(tu);let tp=new c.Ay("workflow_builder"),QuestionSelectDefaultValue=({dataSource:e,options:t=[],questionName:a,selectedOptionId:n="",dataQa:l,questionType:i,defaultValue:o})=>{let s=(0,C.rC)(),[c,d]=(0,r.useState)((0,k.A)()),u=(0,r.useCallback)(e=>s((0,A.aL)({optionId:e,questionName:a})),[s,a]),m=(0,r.useCallback)(e=>{s((0,A.aL)({value:e.map(({label:e})=>e),questionName:a}))},[s,a]),p=(0,r.useCallback)((e,t,n)=>{s((0,A.aL)({value:t,questionName:a}))},[s,a]),b=(0,E.A)(),f=(0,$.w)(t),g=(0,r.useMemo)(()=>t.map(e=>({label:e.label,value:e.id})),[t]),h=tp.t("None selected"),_=tp.t("Default option"),x=(0,r.useMemo)(()=>g.filter(e=>o?.includes(e.label)),[g,o]),v=i&&(0,ta.Em)(i),w=v&&(0,ta.kd)(i),S=v&&(0,ta.fo)(i),T=v&&(0,ta.TD)(i),I=[G.g7.Conversations,G.g7.Channels].includes(e),N="users"===e,M=S||T||I||N,L=!S&&!T&&!I&&!N,O=(0,r.useCallback)(()=>d((0,k.A)()),[]);(0,r.useEffect)(()=>{t.length>0&&O()},[O,t]);let F="users"===e?G.xi.SelectPerson:i,D=(0,r.useMemo)(()=>M&&F?(0,ta.OR)(F,o):null,[o,M,F]),P=(0,r.useMemo)(()=>M&&null!==D?[{...(0,ta.FA)(D)[0],is_required:!1,title:_}]:[],[_,D,M]),R=(0,r.useMemo)(()=>M&&null!==D?(0,ta.Fn)(D):null,[D,M]),B=(0,r.useMemo)(()=>({updateRequiredContext:ts.A,viewOnly:!1,updateParameterValue:ts.A,onVariableMenuOpen:ts.A,openFormSteps:[],triggerType:void 0,externalTriggerSalesforceOrgId:void 0,validateAsyncValue:ts.A,hasValidAppPinBuiltInMessage:!1,workflowSummaryStepPrecedes:!1,formStepPrecedesCurrentStep:!1,previousStepId:""}),[]),W=L||N&&null===R||I&&null===R?_:"";return r.createElement(y.A,{htmlFor:b,text:W},e===G.g7.Static&&!v&&r.createElement(eV.l,{id:b,value:n??"",options:f?t:g,placeholder:h,ariaLabel:_,onChange:u,dataQa:l,required:!1,errorText:""}),N&&null!==R&&r.createElement("div",{className:tm().container},r.createElement(td.L,{inputParameters:P,onChange:p,configuredParameters:R,workflowRendererContexts:B,oAuthParameter:void 0,callbackId:void 0})),I&&null!==R&&r.createElement("div",{className:tm().container},r.createElement(td.L,{inputParameters:P,onChange:p,configuredParameters:R,workflowRendererContexts:B,oAuthParameter:void 0,callbackId:void 0})),w&&r.createElement("div",{className:tm().container},r.createElement(tc.Ay,{key:c,options:g,selectDataQa:`${a}-multiSelectDefault`,ariaLabel:_,width:"100%",selectId:b,placeholderText:tp.t("Search for a value\u2026"),expandOnFocus:!0,selectedOptions:x,onSelectedItemsChange:m})),S&&null!==R&&r.createElement("div",{className:tm().container},r.createElement(td.L,{inputParameters:P,onChange:p,configuredParameters:R,workflowRendererContexts:B,oAuthParameter:void 0,callbackId:void 0})),T&&null!==R&&r.createElement("div",{className:tm().container},r.createElement(td.L,{inputParameters:P,onChange:p,configuredParameters:R,workflowRendererContexts:B,oAuthParameter:void 0,callbackId:void 0})))};QuestionSelectDefaultValue.displayName="QuestionSelectDefaultValue";var tb=a(0x1db887024),tf=a(0x228ea2b2a),tg=a(0x22c41b907),th=a(0x1bffa495d),t_=a(0xd0fb5338),ty=a(0xaaa6bbd0),tx=a(0x1bb29da6),tv=a(0x1f35a0f5),tE=a(0x1e22e34a7),tk=a(0xb2c476ed),tw=a(0x2120d7f64),tS=a(0x20e80190e),tC=a(0x46947d88),tA=a(0x537adc79),tT=a.n(tA);let tI=new c.Ay("workflow_builder"),tN={name:"caret-left-full",size:"20"},QuestionEditModal=({questionIndex:e=-1,switchPane:t,segment:a})=>{let n=(0,C.rC)(),{canAddQuestion:l}=(0,C.Qk)(),[i,o]=(0,r.useState)(e),[s,c]=(0,r.useState)(!1),d=(0,M.d4)(N.$T),u=(0,M.d4)(e=>(0,th.MZ)(e,a)),m=u?.input_parameters,p=d&&(0,ty.Pv)(a),b=(0,ty.q2)(a)&&(0,f.uz)(u)?(0,ty.Jl)(a,u,!1):void 0,E=d?(0,tx.N)(m,b):g.Ml,k=(0,t_.yS)(a),w=k[i],S=p&&k.length!==tb.Rj?tI.t("All available fields have been added"):tI.t("Each form can have a maximum of {maxQuestionCount} questions",{maxQuestionCount:tb.Rj}),{questionType:T,optional:I,name:L,options:O,data_source:F,selectedOptionId:P,maxItems:R,default:B}=w,W=(0,r.useMemo)(()=>E?.find(({name:e})=>e===L),[E,L]),V=(0,r.useMemo)(()=>{if(!p||!E.length)return;let{value:e}=a.config.inputs.fields,t=new Set((Array.isArray(e)?e:e.elements||[]).map(({name:e})=>e));return E.filter(e=>L===e.name||!t.has(e.name))},[E,p,a.config.inputs.fields,L]),H=(0,r.useCallback)(()=>{p?t(tg.k.THIRD_PARTY_USER_FORM_CONFIG):t(tg.k.DEFAULT)},[p,t]),q=(0,r.useCallback)(()=>{c(!0),n((0,A.Af)({})),n((0,A.c5)({questionIndex:k.length,newQuestionIndex:i+1})),o(i+1),setTimeout(()=>{c(!1)},300)},[k.length,i,n]),U=(0,r.useCallback)(e=>{let t=!e.target.checked;n((0,A.qc)({questionName:L,optional:t}))},[L,n]),z=(0,r.useCallback)(()=>{n((0,A.V0)({questionName:L})),H()},[L,n,H]),j=((0,ta.OW)(T)||(0,ta.EI)(T))&&!p,$=T===G.xi.File&&!p,K=(0,ta.kd)(T)&&!p,Q=(0,ta.kd)(T)||(0,ta.fo)(T)||(0,ta.TD)(T),Z=([G.xi.SelectPerson,G.xi.SelectChannel,G.xi.Dropdown].includes(T)||Q)&&!p,J=j||$||K||Z,X=(0,r.useMemo)(()=>r.createElement(r.Fragment,null,r.createElement("span",null,tI.t("Question {questionNumber}",{questionNumber:i+1})),I&&r.createElement("span",{className:tT().optional_label},tI.t("(optional)"))),[I,i]),{speedBumpState:ee,closeSpeedBump:et,openSpeedBump:ea}=(0,tw.v)(),en=(0,r.useCallback)(e=>{for(let t of O??[])if(e===G.xi.Dropdown&&"string"==typeof t.value&&void 0!==t.label){let e=(0,tE.l)(t.value);n((0,A.ly)({questionName:L,optionId:t.id,value:e,label:t.label}))}},[O,L,n]),er=(0,r.useCallback)(()=>{let e=!p||p&&W;(0,Y.fD)(w)&&e?H():ea()},[W,p,ea,w,H]),el=(0,r.useMemo)(()=>r.createElement(x.A,{onClick:er,"aria-label":tI.t("Back"),svgIconProps:tN}),[er]);return(0,tk.M)("keyup",e=>{e.key===tC.D.ESCAPE&&er()}),r.createElement(r.Fragment,null,r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:X,icon:el})),r.createElement(tS.$m,null,r.createElement(tS.qf,null,s&&r.createElement(LoadingSkeleton,null),r.createElement("div",{className:s?tT().hidden:""},p&&(0,f.uz)(u)&&r.createElement(D,{key:`${L}_field_type`,formWrappableParameters:V,questionName:L,appId:u.app_id,functionCallbackId:u.callback_id}),r.createElement(to,{label:(0,ta.DM)(w),questionName:L,key:`${L}_label`,shouldFocusQuestion:!p}),p&&W&&(0,f.uz)(u)&&r.createElement(QuestionDefaultValue,{segment:a,parameter:W,configuredParameters:b,question:w,wrappedFunction:u}),r.createElement(eP,{questionType:T,questionName:L,isSegmentFormWrapped:p,onUpdateQuestionType:en}),r.createElement("div",{className:"margin_top_125"},r.createElement(tl,{description:w.description,questionName:L,questionType:T,maxItems:R})),r.createElement(y.A,{text:tI.t("Make this required"),type:"inline",className:"margin_bottom_125"},r.createElement(_.A,{id:"question_optional_input",checked:!I,onChange:U,disabled:W&&(!!W.is_required||(0,tf.L)(W))})),J&&r.createElement(tv.A,null),j&&r.createElement(eb,{options:O,questionName:L,questionIndex:i,questionType:T,questionHermesType:w.type}),$&&r.createElement(QuestionFileDetails,{questionName:L,maxItems:R,allowedFileTypesGroup:w?.items?.allowed_filetypes_group}),K&&r.createElement(eq,{options:O,questionName:L,maxItems:R}),Z&&r.createElement(QuestionSelectDefaultValue,{options:O,questionName:L,dataSource:F??G.g7.Static,defaultValue:B,selectedOptionId:P,questionType:T})))),ee.isVisible?r.createElement(tS.ty,{heading:tI.t("Keep this question?"),description:tI.t("To keep the question, resolve all errors. Or, you can delete it."),continueButtonType:"danger",continueButtonLabel:tI.t("Delete"),onContinue:z,onCancel:et}):r.createElement(tS.jl,null,l?r.createElement(h.Ay,{type:"outline",onClick:q,disabled:!(0,Y.fD)(w)},tI.t("Add Another Question")):r.createElement(v.Ay,{position:"top",tip:S},r.createElement("div",{className:tT().pointer},r.createElement(h.Ay,{type:"outline",disabled:!0},tI.t("Add Another Question")))),r.createElement(tS.ox,null,r.createElement(h.Ay,{type:"primary",onClick:er},tI.t("Done")))))};QuestionEditModal.displayName="QuestionEditModal";var tM=a(0x140c59582),tL=a(0xabcf9c80),tO=a(0xb1ea448c),tF=a(0x2370cecef),tD=a.n(tF);let tP=new c.Ay("workflow_builder"),FormLoadingScreen=({switchPane:e,heading:t,subheadings:a,redirectPane:n})=>{(0,r.useEffect)(()=>{let t=setTimeout(()=>{n&&e(n)},1e3);return()=>clearTimeout(t)});let l=(0,r.useMemo)(()=>a?(0,tL.A)(a):(0,tL.A)([tP.t("Computering in the dataspace\u2026"),tP.t("Tubing fields\u2026"),tP.t("Finding the good stuff\u2026"),tP.t("Reticulating splines\u2026")]),[a]);return r.createElement(tS.dW,{centered:!0,showCloseButton:!1},r.createElement(tS.$m,{className:"margin_top_600 margin_bottom_600"},r.createElement(tS.qf,{className:"margin_top_300 margin_bottom_300"},r.createElement("div",{className:tD().wrapper},r.createElement(tO.A,{size:"jumbo"}),r.createElement("div",{className:tD().textContainer},r.createElement("span",{className:tD().formType},t),r.createElement("span",{className:tD().subheading},l))))))};FormLoadingScreen.displayName="FormLoadingScreen";var tR=a(0x21343fa5a),tB=a(0x1e586fbba),tW=a(0x13262fc8e),tV=a(0x17ee9cd72),tH=a(0x1e864b930),tq=a(0x1faa3f1ac),tU=a(0x1903d373d);let tz=new c.Ay("workflow_builder"),UnwrappableParametersAlert=({inputParameters:e})=>{let[t,a]=(0,r.useState)(!0),n=(0,r.useCallback)(()=>{a(!1)},[a]),l=(0,r.useMemo)(()=>e?.reduce((e,t)=>{let a=(0,eU.w)(t),n=a.title??a.name;if(a.is_hidden||a.type===e6.TE.SlackTypesCredentialOauth2)return e;if((0,eG.sg)(a)){let t=a.properties??{};Object.keys(t).forEach(a=>{let n=t[a],r=n.title??n.name;(0,tU.AL)(n)||e.push(r)})}else(0,tU.AL)(a)||e.push(n);return e},[]),[e]),i=(0,r.useMemo)(()=>{if(!t||!l?.length)return null;let e=l.length-2;if(e<1)return null;let a=tz.rt("{remaining} more",{remaining:e});return r.createElement(tq.A,{"data-qa":"show-param-names",onClick:n,"aria-label":tz.t("Show all input names")},a)},[t,n,l]),o=(0,r.useMemo)(()=>{if(!l)return"";let e=(0,tH.A)(l,{react:!0,strong:!0});if(1===l.length)return r.createElement("span",{"data-qa":"single-item-warning-text"},tz.rt("{fieldList} is an unsupported question type and can\u2019t be added to the form.",{fieldList:e}));if(l.length>3&&t&&i){let t=l.slice(0,2);e=(0,tH.A)(t.concat(i),{react:!0,strong:!0})}return tz.rt("{fieldList} are unsupported question types and can\u2019t be added to the form.",{fieldList:e})},[l,t,i]);return l?.length?r.createElement(u.Ay,{"data-qa":"unsupported-field-alert",id:"unsupported-field-alert",level:u.A_.info,align:u.AO.left,className:"margin_bottom_100"},o):null};UnwrappableParametersAlert.displayName="UnwrappableParametersAlert";var tj=a(0xf6b2f43b),tG=a(0x1e271947d),t$=a(0x171a52b74),tK=a(0x3711e82d),tY=a(0x127a944f7),tQ=a.n(tY);let tZ=new c.Ay("workflow_builder"),FormWrappedInputsModal=({title:e,icon:t,saving:a,onSave:n,onClose:l,saveError:i,renderSaveError:o,submitLabel:s,cancelLabel:c,isExistingSegment:d=!1,isSegmentModified:u=!1,segment:m,speedBumpContext:p,segmentReducer:b,baseAutoClogProps:f,switchPane:g})=>{let _=(0,tj.u)(),y=(0,t$.GS)(m),x=!!y&&(0,e5.mV)(m),v=(0,e4.EM)(m),E=y?(0,e5.Dl)(m):void 0,k=y?(0,e5.Iw)(m):void 0,w=y?(0,e5.ln)(m):void 0,S=y&&(0,t_.F$)(m),C=y?(0,e5.am)(m):void 0,[A,T]=b,{speedBumpState:I}=p,N=A.computed?.isValid&&!a&&(u||!d),M=(0,r.useMemo)(()=>({...f,action:tK.UiAction.SAVE,onClick:{enableClogAction:N}}),[f,N]),L=(0,r.useCallback)(()=>{g(tg.k.DEFAULT)},[g]),O=(0,r.useCallback)(e=>{T((0,tG.R)({isFunctionFormWrapped:x,...e}))},[T,x]),F=(0,r.useCallback)(()=>{A.computed?.isValid&&!a&&n()},[n,a,A.computed]),D=(0,r.useCallback)(e=>{T((0,tG.Ox)({title:e}))},[T]);return(0,tR.A)(()=>{S&&D(S)},!!S),r.createElement(r.Fragment,null,r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:e,icon:t})),r.createElement(tS.$m,null,i&&o&&r.createElement(tS.qf,{className:"c-segment_modal--save_error"},r.createElement(tB.A,null,o(i))),r.createElement(tS.qf,null,r.createElement("h2",{className:tQ().content_title},tZ.t("Please select the questions to show to the user")),r.createElement("p",{className:"sk_foreground_max margin_bottom_100"},tZ.t("We\u2019ll open a form to collect these answers using the account of the person who runs the workflow. Make sure they have permission to edit these fields.")),y&&r.createElement(r.Fragment,null,r.createElement(tW.D,{segment:m,onChange:D}),r.createElement(UnwrappableParametersAlert,{inputParameters:w}),r.createElement(tV.a,{variables:v,slackFunction:E,inputValues:k,functionVariables:C,stepId:m.id,isFunctionFormWrapped:x,onChange:O})))),I.isVisible?r.createElement(tS.ty,{heading:I.heading,cancelButtonLabel:I.cancelButtonLabel,continueButtonLabel:I.continueButtonLabel,continueButtonIsDisabled:I.continueButtonIsDisabled,continueButtonIsLoading:a,continueButtonType:I.continueButtonType,onCancel:I.onCancel,onContinue:I.onContinue,description:I.message}):r.createElement(tS.jl,null,r.createElement(h.Ay,{type:"outline",onClick:L,disabled:a,"data-qa":"form-wrapped-inputs-back__button"},tZ.t("Back")),r.createElement(tS.ox,null,r.createElement(h.Ay,{type:"outline",onClick:l,disabled:a,"data-qa":"form-wrapped-inputs-cancel__button"},c||tZ.t("Cancel")),!_&&r.createElement(h.lV,{loading:a,onClick:F,disabled:!N,"data-qa":"form-wrapped-inputs-submit__button",autoClogProps:M,"aria-label":s||tZ.t("Save")},s||tZ.t("Save")))))};FormWrappedInputsModal.displayName="FormWrappedInputsModal";var tJ=a(0xa5dbe09b),tX=a(0xf77002c6),t0=a(0xe374a1b1),t1=a(0xfe5aa224),t2=a(0x139c79d16),t4=a(0xcc8bbdff),t8=a.n(t4);let FormWrappedSelectionRadio=({label:e,checked:t,onChange:a,disabled:n,className:l,image:i,name:s,value:c})=>{let d=(0,E.A)(),u=(0,r.useContext)(t1.A),[m,p]=(0,r.useState)(!1),b=(0,r.useCallback)(e=>{p(u&&"focus"===e.type)},[u]);return r.createElement("div",{className:o()(t8().radioInputContainer,{[t8().radioInputContainerChecked]:t,[t8().radioInputFocused]:m})},r.createElement("label",{htmlFor:d,className:l},i,r.createElement(t2.A,{className:t8().radioInput,name:s,value:c,id:d,checked:t,onChange:a,disabled:n,autoFocus:t,onFocus:b,onBlur:b}),e))};FormWrappedSelectionRadio.displayName="FormWrappedSelectionRadio";var t5=a(0x3b8174d2);let useSegmentPaneNavigation=({segment:e,switchPane:t,activePane:a})=>{let n=(0,C.rC)(),l=(0,M.d4)(N.$T),i=(0,t$.GS)(e)?e:void 0,o=!!i&&(0,e5.mV)(i),s=(0,r.useMemo)(()=>!!i&&(0,ty.q2)(i),[i]),c=(0,r.useMemo)(()=>l&&!!i?.config.isDataFetching,[l,i]),d=(0,M.d4)(e=>i?.config.isFunctionFormWrappable?(0,t5.hj)(e,tb.QF):void 0),u=(0,r.useCallback)(()=>{(0,f.uz)(d)&&!c&&(n((0,tG.JB)({openFormSlackFunction:d})),t(tg.k.THIRD_PARTY_USER_FORM_CONFIG))},[n,c,d,t]),m=(0,r.useCallback)(()=>{i&&(0,ty.q2)(i)&&i.config.wrappedSlackFunction&&n((0,tG.nk)({wrappedFunction:i.config.wrappedSlackFunction})),t(tg.k.PARENT_INPUTS)},[n,i,t]),p=(0,r.useMemo)(()=>l&&a===tg.k.PARENT_INPUTS,[l,a]),b=(0,r.useMemo)(()=>l&&a===tg.k.CHILD_INPUTS,[l,a]);return{navigateToFormConfiguration:u,navigateToParentInputsModal:m,is3PUFConfigModal:(0,r.useMemo)(()=>l&&a===tg.k.THIRD_PARTY_USER_FORM_CONFIG&&s&&o,[a,l,o,s]),isChildModal:b,isParentModal:p}},t6=new c.Ay("workflow_builder"),FormWrappedSelectionLabel=({label:e,subLabel:t})=>r.createElement("div",{className:t8().radioInputLabel},r.createElement("div",{className:"bold"},e),r.createElement("div",{className:t8().radioInputSubLabel},t));FormWrappedSelectionLabel.displayName="FormWrappedSelectionLabel";let FormWrappedSelectionModal=({title:e,icon:t,onClose:a,switchPane:n,appId:l,segment:i,activePane:o})=>{let s=(0,t$.GS)(i)?i:void 0,c=s?(0,e5.ln)(s):[],{navigateToFormConfiguration:d}=useSegmentPaneNavigation({segment:i,switchPane:n,activePane:o}),u=c?.some(e=>(0,tX.oO)(e)),m=(0,C.rC)(),[b,f]=(0,r.useState)(!0),g=(0,r.useCallback)(e=>{f(e.target?.value==="true")},[]),_=(0,r.useCallback)(()=>{m((0,A.TI)({isFunctionFormWrapped:b})),u?n(tg.k.PARENT_INPUTS):b?d():n(tg.k.CHILD_INPUTS)},[b,d,m,u,n]),y=(0,r.useMemo)(()=>r.createElement(FormWrappedSelectionLabel,{label:t6.t("Add the step with a form"),subLabel:t6.t("Let people using the workflow fill out a form to update the step\u2019s information.")}),[]),x=(0,r.useMemo)(()=>r.createElement(FormWrappedSelectionLabel,{label:t6.t("Add just the step"),subLabel:i?t6.t("You can still build a form manually and connect it to this step later."):t6.t("You can still build a form manually connect it to this step later.")}),[i]),v=(0,r.useMemo)(()=>l?r.createElement(T.z,{appId:l,imageClassName:t8().radioInputImageAppIcon}):r.createElement(r.Fragment,null,t),[l,t]),E=(0,r.useMemo)(()=>r.createElement("div",{className:t8().radioInputImage},r.createElement(p.Ah,{inline:!0,"data-qa":"form",name:"form",size:"24"}),r.createElement("span",{className:t8().radioInputImageArrow},r.createElement(p.Ah,{inline:!0,"data-qa":"arrow-right",name:"arrow-right",size:"20"})),v),[v]),k=(0,r.useMemo)(()=>r.createElement("div",{className:t8().radioInputImage},v),[v]);return r.createElement(t0.v,{onClose:a},r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:e,icon:t})),r.createElement(tS.$m,null,r.createElement(tS.qf,null,r.createElement(tJ.A,{className:t8().radioGroup,legendClassNames:"no_margin"},r.createElement(FormWrappedSelectionRadio,{label:y,checked:b,onChange:g,image:E,name:"choose_form_wrapped",value:"true"}),r.createElement(FormWrappedSelectionRadio,{label:x,checked:!b,onChange:g,image:k,name:"choose_form_wrapped",value:"false"})))),r.createElement(tS.jl,null,r.createElement(tS.ox,null,r.createElement(tS.s_,{"data-qa":"oauth-account-select-modal-cancel",type:"outline","aria-label":"Cancel",onClick:a},t6.t("Cancel")),r.createElement(h.Ay,{type:"primary",onClick:_},t6.t("Set Up")))))};FormWrappedSelectionModal.displayName="FormWrappedSelectionModal";var t3=a(0xb77a689a),t7=a(0x102edf836),t9=a(0x15fb82076),ae=a(0x780e190c),at=a(0xa03b6325),aa=a(0x18e09ba96),an=a(0x24129bf7),ar=a(0x61c95b1b),al=a(0x7019ae94),ai=a(0x1a7251dad),ao=a(0x208f8a00d),as=a(0x67839580),ac=a(0xcb036ba),ad=a(0xf7ab484f),au=a(0x210cf696f),am=a(0x1ee6256b0),ap=a(0x46dbff89);let ab=new c.Ay("workflow_builder"),ChangeTriggerButton=({disabled:e})=>{let t=(0,l.wA)(),a=(0,tj.u)(),n=(0,e2.j)(),i=(0,e8.DY)(n),o=(0,r.useCallback)(()=>t((0,ap.q)({element:r.createElement(am.G,{workflowId:i})})),[t,i]),s=ab.t("Change Trigger"),c=e||a||(0,e8.a6)(n),d=ab.t("How the workflow starts can\u2019t be changed after it\u2019s been published");return n&&!(0,e8.a6)(n)&&(d=ab.t("You can change how the workflow starts now, but not after publishing")),a&&(d=ab.t("You can\u2019t change how the workflow starts in view-only mode")),r.createElement(v.Ay,{tip:d,position:"top"},r.createElement("div",null,r.createElement(au.A,{onClick:o,disabled:c,"data-qa":"form-wrapped-inputs-change_trigger__button"},s)))};ChangeTriggerButton.displayName="ChangeTriggerButton";var af=a(0x21f3c49e8),ag=a(0x20bafd237),ah=a(0x211a99e2f),a_=a(0x1fdec3e16),ay=a(0x18f070aac),ax=a.n(ay);let av=new c.Ay("workflow_builder"),SegmentPaneNavigationLink=({title:e,onClick:t,description:a,linkAutoClogProps:n,dataQa:l,hasError:i})=>{let s=i?av.t("Resolve"):av.t("Edit");return r.createElement("div",{className:o()("padding_bottom_50","padding_top_50",ax().navigation_container),"data-qa":l},r.createElement("div",{className:o()("bold",ax().navigation_title)},e),r.createElement("div",{className:o()(ax().navigation_description,{[ax().error_content]:!!i})},i&&r.createElement(p.Ah,{name:"warning"}),r.createElement(a_.A,{lines:1},r.createElement("span",null,a))),r.createElement("div",{className:ax().navigation_link_change},r.createElement(tq.A,{onClick:t,autoClogProps:n},s)))};SegmentPaneNavigationLink.displayName="SegmentPaneNavigationLink";var aE=a(0x23a4b0853),ak=a(0x339b339c),aw=a(0x4e1a3b33),aS=a(0xa985ed31),aC=a(0x14ea3ce99);let aA=new c.Ay("workflow_builder"),SegmentPaneDataNavigationLabel=({value:e,label:t,parameterType:a,variables:n})=>{let l=(0,M.d4)(t=>{if("string"==typeof e&&(0,aS.A)(e))return(0,aC.Lp)(t,e)});return"string"==typeof e&&(0,e0.cn)(e)&&a?r.createElement(ah.l,{text:e,variables:n,parameterType:a}):l&&(0,f.mX)(l)?r.createElement(ak.A,{size:"medium"}):(0,f.uz)(l)?r.createElement(aw.A,{file:l,disableTooltip:!0,useLeadingEmojiAsIcon:!0,hideRichTextEmojiTooltips:!0,shouldShowHighlight:!1}):r.createElement(r.Fragment,null,e&&t&&("string"==typeof e||"number"==typeof e)&&"string"==typeof t?.[e]?t[e]:String(e))};SegmentPaneDataNavigationLabel.displayName="SegmentPaneDataNavigationLabel";let SegmentPaneDataNavigation=({segment:e,inputParameters:t=[],switchPane:a,baseAutoClogProps:n,hasValidParentInputValues:l,activePane:i})=>{let o=(0,e4.EM)(e),s=(0,e5.P)(e),c=(0,r.useMemo)(()=>(0,eG.ny)(t),[t]),d=t.some(e=>(0,tX.oO)(e)),{navigateToParentInputsModal:u}=useSegmentPaneNavigation({segment:e,switchPane:a,activePane:i}),m=(0,r.useMemo)(()=>{let a=(0,f.uz)(s)&&(0,ty.q2)(e)?(0,ty.Jl)(e,s,!1):(0,e5.Iw)(e),n=t.find(e=>(0,eQ.t)(e)),l=t.filter(e=>(0,tX.oO)(e)&&!(0,eQ.t)(e)&&!(0,e1.M$)(e,a));if((0,af.A)(l)&&n)return s?.category_label;if((0,af.A)(l))return;let i=(c&&"parentInputs"in c&&Array.isArray(c.parentInputs)?c.parentInputs.find(e=>!!l.some(({name:t})=>t===e)):void 0)??(0,ag.A)(l)?.name??"",d=(0,ty.q2)(e)?(0,ty.WC)(e,i):(0,e5.RE)(e,i),u=t.map(eU.w).find(({name:e})=>e===i),m="object"!=typeof d?.value?r.createElement(SegmentPaneDataNavigationLabel,{value:d?.value,label:d?.label,variables:o,parameterType:u?.type}):null;if(u)return d?.value!==void 0&&null!==d.value&&m?aA.rt("{title}: {label}",{title:u.title,label:m}):u.title},[s,e,t,c,o]),p=(0,r.useMemo)(()=>({...n,action:tK.UiAction.CLICK,elementName:aE.KC.NavigateToDataPane,onClick:{enableClogAction:!0}}),[n]);return d?r.createElement(SegmentPaneNavigationLink,{title:aA.t("Connection"),onClick:u,description:m,linkAutoClogProps:p,dataQa:"segment-pane-data-navigation",hasError:!1===l}):null};SegmentPaneDataNavigation.displayName="SegmentPaneDataNavigation";let aT=new c.Ay("workflow_builder"),SegmentPaneFormNavigation=({segment:e,switchPane:t,baseAutoClogProps:a,activePane:n})=>{let{navigateToFormConfiguration:l}=useSegmentPaneNavigation({segment:e,switchPane:t,activePane:n}),i=(0,r.useMemo)(()=>{let t=(0,e5.B8)(e)?.fields?.value,a=(0,e5.UX)(e),n=Array.isArray(t)?t:t?.elements;if(!(!n||(0,af.A)(n)))return aT.t("{length} {serviceName} {length, plural, =1 {field} other {fields}} included",{length:n.length,serviceName:a?.category_label})},[e]),o=(0,r.useMemo)(()=>({...a,action:tK.UiAction.CLICK,elementName:aE.KC.NavigateToFormConfigPane,onClick:{enableClogAction:!0}}),[a]);return r.createElement(SegmentPaneNavigationLink,{title:aT.t("Form"),onClick:l,description:i,linkAutoClogProps:o,dataQa:"segment-pane-form-navigation"})};SegmentPaneFormNavigation.displayName="SegmentPaneFormNavigation";var aI=a(0x152c6b9a8);let SegmentPaneNavigation=({switchPane:e,inputParameters:t,segment:a,baseAutoClogProps:n,hasValidParentInputValues:l,activePane:i})=>{let o=(0,M.d4)(N.$T),s=!!a&&(0,e5.mV)(a),c=(0,r.useMemo)(()=>(0,aI.q)(a),[a]),{is3PUFConfigModal:d,isChildModal:u}=useSegmentPaneNavigation({segment:a,switchPane:e,activePane:i}),m=u||d,p=u&&!c&&s;return o?r.createElement(r.Fragment,null,m&&r.createElement(SegmentPaneDataNavigation,{segment:a,inputParameters:t,switchPane:e,baseAutoClogProps:n,hasValidParentInputValues:l,activePane:i}),p&&r.createElement(SegmentPaneFormNavigation,{segment:a,switchPane:e,baseAutoClogProps:n,activePane:i})):null};SegmentPaneNavigation.displayName="SegmentPaneNavigation";let aN=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-loop").then(a.bind(a,0x1e83cca9c)));var aM=a(0x91728dda),aL=a(0xe9c32bb),aO=a(0x4fbb276b),aF=a(0x161478d06),aD=a(0x20570d71a),aP=a(0x202470d56),aR=a(0x2362a0a7b),aB=a(0x1ec68d6a3),aW=a(0xcf8edac8);function useFunctionDynamicInputs({slackFunction:e,isOpenFormSegment:t,segmentId:a,callbackId:n,workflowId:i,configuredParameters:o,dynamicInputs:s,isExistingStep:c}){let d=(0,l.wA)(),u=(0,C.rC)(),m=(0,aB.default)({label:aW.y}),p=(0,r.useMemo)(()=>e?.input_parameters&&(0,eG.xn)(e.input_parameters),[e?.input_parameters]),b=(0,r.useCallback)(async t=>{try{u((0,tG.T)({[t.name]:{loading:!0,error:void 0}}));let r=await d((0,aR.T)({parameter:t,segmentId:a,stepFunctionId:e?.id??"",workflowId:i,callbackId:n,configuredInputs:o}));u((0,tG.T)({[t.name]:{loading:!1,options:r?.options,error:void 0}})),u((0,tG.aR)({parameter:t,options:r?.options})),u((0,A.zo)({options:r?.options,inputParameters:e?.input_parameters}))}catch(r){let e=r?.data?.error_code||r?.data?.error,n=r?.data?.error_message;u((0,tG.T)({[t.name]:{loading:!1,error:{code:e,message:n,pointer:"",source_id:a}}})),m.error(Error(`Failed to fetch dynamic options for ${t.name} parameter: ${r}`))}},[n,o,d,m,u,a,e?.id,i,e?.input_parameters]),f=!!(t&&p?.length&&c);(0,tR.A)(()=>{p?.forEach(e=>{(0,aP.A)(s?.[e.name]?.options)&&b(e)})},f)}var aV=a(0x1b3b89b97),aH=a(0x1c52575e2),aq=a(0x848ef3c),aU=a(0x6def043b),az=a(0x3c4a564b);function useFunctionVariables({functionId:e,workflowId:t,callbackId:a,functionVariables:n,slackFunctionVariablesSchema:i,configuredParameters:o,segmentId:s,isFunctionFormWrapped:c}){let d=(0,l.wA)(),u=(0,C.rC)(),m=(0,aB.default)({label:aW.y}),p=(0,r.useCallback)(async a=>{try{u((0,tG.zb)({isLoading:!0}));let r=await d((0,aq.O)({functionId:e,workflowId:t,inputs:a,reason:"workflow_builder/fetch_variables"}));if(r?.available_data){let e=Object.entries(r.available_data).reduce((e,[t,a])=>((0,aU.Kw)(a)&&(e[t]=a),e),{}),t=(0,aH.d)({availableData:{...e,...n?.formAvailableData},segmentId:s});u((0,tG.zb)({isLoading:!1,mapping:r.mapping,availableData:e,variables:{list:t,groups:[]}}))}}catch(e){u((0,tG.zb)({isLoading:!1})),m.error(Error(`Failed to fetch function variables: ${e}`))}},[d,e,n?.formAvailableData,m,u,s,t]),b=!!i&&!i.error_code&&(0,aP.A)(n?.mapping),f=(0,az.s)(o,i?.build_time_dependencies),g=(0,aV.O)(f);(0,r.useEffect)(()=>{c&&b&&g&&!(0,eG._Y)({parsedParameterValues:g,callbackId:a})&&p(g)},[a,b,p,c,g])}var aj=a(0xf9f06c3b);let aG=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-slack-function-form").then(a.bind(a,0x1dbcc5a72)));var a$=a(0x677a139e),aK=a(0x1f5430624),aY=a(0x19f0ddaf7),aQ=a(0x10b93423f),aZ=a(0x32784134),aJ=a(0x1d922a37e),aX=a(0x1846f5916),a0=a(0x24eaf48aa),a1=a(0x1bb9b9e21),a2=a(0xb46cd264),a4=a.n(a2);let a8=new c.Ay("workflow_builder"),AskAgentforceStep=({inputParameters:e,variables:t,configuredParameters:a={},onChange:n,formatVariableBeforeInsert:l,callbackId:i,showInline:o=!1,stepId:s,functionId:c,isTriggerSegment:d,isFunctionFormWrapped:u,isExistingStep:m,serviceTriggerType:p,functionVariables:b,oAuthParameter:f,onLoadingStateChange:g,allowVariables:h=!0,segment:_})=>{let y,x=(0,e2.j)(),v=(0,e8.DY)(x),E=(0,M.d4)(e=>(0,a1.X)(e,x)),k=(0,M.d4)(N.dq),w=(0,M.d4)(e=>"on"===(0,tn._Z)(e,"ask_agentforce_step_send_as_agent")),S=(0,M.d4)(N.$T),C=x.trigger?.id,A=k?a8.t("Send additional information to agent"):"Send additional information to agent",T=k?a8.t("Select a message and channel with content you want the agent to reference when generating its response."):"Select a message and channel with content you want the agent to reference when generating its response.",I=(0,r.useMemo)(()=>!!S&&!!e.length&&e.every(e=>(0,eG.qt)(e)&&(0,eG.sg)(e)),[S,e]),L=(0,r.useMemo)(()=>{let e=s;if(!e)if(!d||!C)return;else e=C;let t=(0,e8.rM)(x,e);return(0,a0.jS)(t)},[s,x,C,d]);if(!e.length)return null;let O="padding_left_175 padding_right_175",F=e.find(e=>"dynamic_options"in e),D=e.find(e=>e.type===e6.HN.String&&!("dynamic_options"in e)),P=e.find(e=>e.type===e6.HN.SlackTypesMessageContext),R=e.find(e=>e.type===e6.HN.SlackTypesChannelId),B=e.find(e=>e.type===e6.HN.Boolean),getConfiguredValue=e=>a[e]?.value,formatVariableBeforeInsertWrapper=e=>(t,a)=>{let n=(0,aJ.F)({variable:t,parameterName:e,functionVariables:b});return l?l(n,a):n};return F&&D&&P&&R&&c?r.createElement(aF.$,{noSubmit:!0,noPadding:!0,segment:_},r.createElement("div",{className:O},r.createElement(aK.r,{variables:t,parameter:F,value:getConfiguredValue(F.name),label:(y=F.name,a[y]?.label),values:a,onChange:n,formatVariableBeforeInsert:formatVariableBeforeInsertWrapper(F.name),callbackId:i,functionId:c,workflowId:v,oAuthParameter:f,stepId:s,stepErrorCode:L,isExistingStep:m,serviceTriggerType:p,triggerId:C,isTriggerSegment:d,allowVariables:!1,functionVariables:b,isFunctionFormWrapped:u,onLoadingStateChange:g,hasOnlyKeyValueParameter:I})),r.createElement("div",{className:O},r.createElement(aZ.C,{variables:t||aX.Gs,parameter:D,value:getConfiguredValue(D.name)||"",required:!!D.is_required,onChange:n,formatVariableBeforeInsert:formatVariableBeforeInsertWrapper(D.name),callbackId:i,showInline:o,allowVariables:h&&!d})),r.createElement("hr",null),r.createElement("div",{className:O},r.createElement("h4",{className:"bold "},A),r.createElement(a$.A,{className:a4().hint_text_width},T),r.createElement(aQ.O,{variables:t||aX.Gs,allowVariables:h&&!d,parameter:P,value:getConfiguredValue(P.name)||"",onChange:n,callbackId:i,externalWorkspaceId:E,isFunctionFormWrapped:u}),r.createElement(aQ.O,{variables:t||aX.Gs,allowVariables:h&&!d,parameter:R,value:getConfiguredValue(R.name)||"",onChange:n,callbackId:i,externalWorkspaceId:E,isFunctionFormWrapped:u})),B&&w&&r.createElement("div",{className:O},r.createElement(aY.B,{variables:t||aX.Gs,allowVariables:h&&!d,formatVariableBeforeInsert:formatVariableBeforeInsertWrapper(B.name),parameter:B,value:getConfiguredValue(B.name)||"",onChange:n,isParameterSyncedWithForm:u}))):null};AskAgentforceStep.displayName="AskAgentforceStep";var a5=a(0x1525f79d3),a6=a(0xbdb24cfa),a3=a(0x18de2ae18),a7=a(0x162b2271e);function useWorkflowExternalWorkspaceId(){let e=(0,e2.j)();return(0,M.d4)(t=>(0,a1.X)(t,e))}function ConnectedUpdateCanvasVariablesTreatment({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,dynamicParameter:d}){let u=useWorkflowExternalWorkspaceId();return(0,a7.T)({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,dynamicParameter:d,workflowExternalWorkspaceId:u})}function ConnectedCreateCanvasTreatment({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c}){let d=useWorkflowExternalWorkspaceId();return(0,a5.T)({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,workflowExternalWorkspaceId:d})}function ConnectedUpdateCanvasTreatment({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,dynamicParameter:d}){let u=useWorkflowExternalWorkspaceId();return(0,a6.W)({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,dynamicParameter:d,workflowExternalWorkspaceId:u})}function ConnectedUpdateCanvasTreatmentV2({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,dynamicParameter:d}){let u=useWorkflowExternalWorkspaceId();return(0,a3.G)({value:e,parameter:t,variables:a,configuredParameters:n,required:r,onChange:l,isReference:i,viewOnly:o,callbackId:s,otherParameterValues:c,dynamicParameter:d,workflowExternalWorkspaceId:u})}var a9=a(0x55098bc0),ne=a(0x223beeef),nt=a(0x1d3dd4cbe),na=a(0xbbd2a32d),nn=a(0x1d1437423);let nr=new c.Ay("workflow_builder"),SlackFunctionDelayInputWithFormTextInput=({value:e,parameter:t,onChange:a})=>{let{title:n,maximum:l,minimum:i}=t,{viewOnly:o}=(0,nt.e)(),s=(0,E.A)(),c=Number(e),d=(0,r.useMemo)(()=>[{label:nr.t("Minutes"),value:"minutes",minutesMultiplier:1},{label:nr.t("Hours"),value:"hours",minutesMultiplier:60},{label:nr.t("Days"),value:"days",minutesMultiplier:1440}],[]),[u,m]=(0,r.useState)((0,a9.A)(d,e=>c%e.minutesMultiplier==0)||d[0]),[p,b]=(0,r.useState)(+String(c/u.minutesMultiplier)>0?String(c/u.minutesMultiplier):"1"),f=(0,r.useCallback)(e=>{let t=Number(e),a=(0,na.zh)(t)&&""!==e,n=t*u.minutesMultiplier,r=n>na.Ig||void 0!==l&&n>l,o=n<na.kj||void 0!==i&&n<i||n<1;return{isHermesVariable:(0,e0.cn)(String(e)),isValidNumberValue:a,isValueTooLarge:r,isValueTooSmall:o}},[l,i,u.minutesMultiplier]),g=(0,r.useCallback)(e=>{let{isHermesVariable:t,isValidNumberValue:a,isValueTooLarge:n,isValueTooSmall:r}=f(e);return t||a&&!n&&!r},[f]),h=(0,r.useMemo)(()=>g(p),[p,g]),_=(0,r.useMemo)(()=>{let{isHermesVariable:e,isValidNumberValue:t,isValueTooLarge:a,isValueTooSmall:n}=f(p);if(e)return null;if(!t)return nr.t("Delay must be a valid number.");if(a){let e=Number((l??na.Ig)/u.minutesMultiplier).toLocaleString();switch(u.value){case"hours":return nr.t("Delay must be shorter than 7 days (that\u2019s {maxUpperBoundString} hours).",{maxUpperBoundString:e});case"minutes":return nr.t("Delay must be shorter than 7 days (that\u2019s {maxUpperBoundString} minutes).",{maxUpperBoundString:e});default:return nr.t("Delay must be shorter than 7 days.")}}return n?nr.t("Delay must be at least 1 minute."):null},[f,p,l,u.minutesMultiplier,u.value]);(0,r.useEffect)(()=>{e||(a(t,"1"),m(d[0]))},[a,e,t,d]);let{onChange:y}=(0,nn.x)({errorMessage:"",isErrored:!h,shouldErrorPreventSave:!0}),x=(0,r.useCallback)(e=>{b(e),g(e)&&+e>0&&a(t,String(Number(e)*u.minutesMultiplier)),y()},[g,a,t,u.minutesMultiplier,y]),v=(0,r.useCallback)(e=>{let n=d.find(t=>t.value===e.value);n&&(m(n),a(t,String(Number(p)*n.minutesMultiplier)),y())},[d,p,y,a,t]);return r.createElement(ne.z,{elementId:s,parameter:t},r.createElement("div",{className:"display_flex justify_content_between"},r.createElement(tt.A,{name:"composer-link-modal-text",id:"delayValue","data-qa":"delayValue-input",onChange:x,size:"medium",width:120,value:p,"aria-label":`${n} value`,isRequired:!0,isDisabled:o,isInvalid:!h}),r.createElement(ef.Ay,{className:"flex_one margin_left_50",selectDataQa:"delayScale",selectId:`${s}-scale`,selectedOption:u,onOptionSelected:v,options:d,width:"100%",ariaLabel:`${n} scale`,isRequired:!0,isDisabled:o,isInvalid:!h})),_&&r.createElement(tB.A,{id:`${s}-form-text-input-delay-error-text`,className:"margin_bottom_100","data-qa":"form-text-input-delay-error-text"},_))};SlackFunctionDelayInputWithFormTextInput.displayName="SlackFunctionDelayInputWithFormTextInput";let DelayTreatment=({parameter:e,...t})=>{switch(e.type){case e6.TE.Integer:case e6.TE.Number:if("minutes_to_delay"===e.name)return r.createElement(SlackFunctionDelayInputWithFormTextInput,{parameter:e,...t});return null;default:return null}};DelayTreatment.displayName="DelayTreatment";var nl=a(0x6258badf),ni=a(0xd2bf4d47),no=a(0x1d57b7d4c),ns=a(0x1fd3f6e20),nc=a(0x12cef2078),nd=a(0x1817ab90d),nu=a(0x154dd8295),nm=a(0x205de9db),np=a(0x21c71bcdd),nb=a(0x1991a9b6d),nf=a(0x66c6b26d),ng=a(0x20adb28cd),nh=a(0xefdd8b60),n_=a.n(nh);let ny=new c.Ay("workflow_builder"),ButtonsListItem=({button:e,buttonIndex:t,buttonsLength:a,onDelete:n,switchPane:l,formatVariableBeforeInsert:i,onChange:s,experimentWfbBackToBasicsEclairReleaseGroupOn:c,onMoveUp:d,onMoveDown:u})=>{let m=(0,aD.Y)(),b=(0,M.d4)((0,nf.sx)(m,ng.Pb)),[f,g]=(0,r.useState)(!1),[h,_]=(0,r.useState)(!1),y=(0,r.useCallback)(()=>{g(!0)},[]),x=(0,r.useCallback)(()=>{_(!0)},[]),v=(0,r.useCallback)(()=>{_(!1)},[]),E=(0,r.useCallback)(()=>{_(!1),g(!1)},[]),k=(0,r.useCallback)(()=>{E(),l&&l(tg.k.INTERACTIVE_BLOCKS_ADD_EDIT,{buttonIndex:t,operation:"edit",formatVariableBeforeInsert:i,onChange:s})},[l,t,i,s,E]),w=(0,r.useCallback)(()=>{n(t)},[n,t]),S=(0,r.useCallback)(()=>{E(),d(e,t)},[e,t,E,d]),C=(0,r.useCallback)(()=>{E(),u(e,t)},[e,t,E,u]),A=(0,r.useCallback)(e=>r.createElement(j.Ay,{...e,onUnmount:E},0!==t&&r.createElement(j.Dr,{"data-qa":"more_actions_move_up_menu_item",label:ny.t("Move above"),onSelected:S}),t!==a-1&&r.createElement(j.Dr,{"data-qa":"more_actions_move_down_menu_item",label:ny.t("Move below"),onSelected:C}),a>1&&r.createElement(j.bX,null),r.createElement(j.Dr,{"data-qa":"more_actions_delete_menu_item",label:ny.t("Delete"),onSelected:w,danger:!0})),[t,a,E,w,S,C]),T=(0,r.useMemo)(()=>b.reduce((e,t)=>{if(!(0,nu.Zv)(t)||!(0,nm.zc)(t.expression?.root?.statement?.target??""))return e;let a=t?.expression?.root?.statement?.target?.split(".")?.pop()?.replace("}}","");return a&&(e[a]=t.id),e},{}),[b]),I=(0,r.useMemo)(()=>{let t=c?n_().actionsMenuItem:"",a={tooltip:ny.t("Edit"),onClick:k,ariaLabel:ny.t("Edit {buttonName} button",{buttonName:e.text.text}),className:t};return c?(0,nd.j1)({edit:a,moreActions:{tooltip:ny.t("More actions"),ariaLabel:c?ny.t("More actions for {buttonName} button",{buttonName:e.text.text}):ny.t("More actions"),className:t,menuProps:{renderMenu:A,closeOnSelect:!0,children:null}}}):(0,nd.j1)({edit:a,remove:{tooltip:ny.t("Delete"),onClick:w,ariaLabel:ny.t("Delete {buttonName} button",{buttonName:e.text.text})}})},[e.text.text,w,k,c,A]),N=(0,r.useMemo)(()=>{if("url"in e)return r.createElement("div",{className:n_().buttonBehavior},r.createElement("div",{className:"margin_right_25"},r.createElement(p.Ah,{name:"new-window"})),ny.t("Open link"));if("workflow_button"===e.type)return r.createElement("div",{className:n_().buttonBehavior,"aria-hidden":!0},r.createElement("div",{className:"margin_right_25"},r.createElement(p.Ah,{name:"play"})),ny.t("Run workflow"));if(e.action_id&&e.action_id in T){let t=T[e.action_id],a=b.find(e=>e.id===t),n=a?.name;return r.createElement("div",{className:n_().buttonBehavior,"aria-hidden":!0},r.createElement("div",{className:"margin_right_25"},r.createElement(p.Ah,{name:"branch"})),ny.rt('Proceeds to branch "{buttonName}"',{buttonName:n??e.text.text,fallbackHash:"24520bc1d4c7aac5c8d790e9f9c06fc89e11c45b"}))}return r.createElement("div",{className:n_().buttonBehavior,"aria-hidden":!0},r.createElement("div",{className:"margin_right_25"},r.createElement(p.Ah,{name:"play"})),ny.t("Proceed to next step"))},[e,T,b]);return r.createElement("div",{className:o()(n_().buttonsListItem,{[n_().buttonsListItemActive]:c&&f})},r.createElement("div",{className:n_().previewContainer,onFocus:y,onBlur:E,onMouseEnter:x,onMouseLeave:v},r.createElement(nc.X,{noPointerEvents:!0,isInert:!0},r.createElement("div",{className:n_().buttonPreviewWrapper},r.createElement(nb.A,{inline:!0,msg:(0,nd.$_)(e)}),r.createElement("span",null,N))),r.createElement("div",{className:n_().actionButtonsWrapper},r.createElement(np.A,{className:o()({[n_().actionsMenu]:c}),items:I,isFocused:f,showOnlyOnHover:!h}))))};ButtonsListItem.displayName="ButtonsListItem";var nx=a(0x189a28b3e),nv=a(0x15daa558a),nE=a(0x740142bc),nk=a.n(nE);let nw=new c.Ay("workflow_builder"),MutuallyExclusiveButtonConfig=({updateInteractivityConfiguration:e,interactivityConfiguration:t,segment:a})=>{let n=(0,e5.RE)(a,nv.z.INTERACTIVE_BLOCKS)?.value??[],l=(n[0]?.elements??[]).reduce((e,t)=>((0,nd.O0)(t)&&t?.action_id&&e.push(t.action_id),e),[]),i=l.length>1,o=t?.actions&&l.some(e=>t.actions[e]?.is_mutually_exclusive),s=(0,r.useCallback)(()=>{let a=Object.keys(t.actions).reduce((e,a)=>(e[a]=t.actions[a],l.includes(a)&&(e[a].is_mutually_exclusive=!o,o||(e[a].is_button_multi_click=!1)),e),{});e({...t,actions:a})},[t,e,l,o]);if(!i)return null;let c=nw.t("Mutually Exclusive"),d=r.createElement("span",{"aria-hidden":!0},nw.t("Continue buttons are single click, and when one is clicked, all continue buttons disappear")),u=r.createElement("span",{className:"offscreen",id:"button_mutual-description"},nw.t("Continue buttons are single click, and when one is clicked, all continue buttons disappear"));return r.createElement("div",{className:"margin_top_50 margin_bottom_100"},r.createElement("hr",null),r.createElement(y.A,{htmlFor:"button_click_type_label",className:nk().switch_container,type:"inline",text:c,subtext:d},u,r.createElement(nx.A,{isToggled:o,onChange:s,ariaLabel:c,ariaDescribedBy:"button_mutual-description"})))};MutuallyExclusiveButtonConfig.displayName="MutuallyExclusiveButtonConfig";var nS=a(0x2339a0d72),nC=a(0x173b0d383),nA=a.n(nC);let nT=new c.Ay("workflow_builder"),InteractiveBlocksButtons=({onChange:e,parameter:t,value:a=[],switchPane:n,formatVariableBeforeInsert:l,segment:i,callbackId:s})=>{let c=(0,M.d4)(N.tQ),d=a.find(e=>"actions"===e.type),u=(0,r.useMemo)(()=>d?.elements||[],[d?.elements]),m=(0,r.useMemo)(()=>(0,e5.RE)(i,nv.z.INTERACTIVITY_CONFIGURATION)?.value||{},[i]),b=(0,e5.iL)(i,nv.z.INTERACTIVITY_CONFIGURATION),f=Object.values(m?.actions??{}).some(e=>e?.is_mutually_exclusive),g=(0,r.useCallback)(t=>{b&&e(b,(0,nd.A6)(t.action_id,s,m,f))},[b,e,s,f,m]),_=(0,r.useCallback)(t=>{b&&e(b,(0,af.A)(t.actions)?{}:t)},[e,b]),y=(0,r.useCallback)(a=>{e(t,a.length?[(0,nS.AR)(a)]:[])},[e,t]),x=(0,r.useCallback)((e,t)=>{y(e),_(t)},[y,_]),v=(0,r.useCallback)(e=>{let t=u.filter((t,a)=>a!==e),a={actions:(0,nl.A)(m.actions,u[e].action_id)},n=t.filter(nd.O0);1===n.length&&n[0]?.action_id&&a?.actions?.[n[0].action_id]?.is_mutually_exclusive&&delete a.actions[n[0].action_id].is_mutually_exclusive,y(t),_(a)},[u,m.actions,y,_]),E=(0,r.useCallback)((e,t,a)=>{let n=[...u];n.splice(t,1),n.splice(a,0,e),y(n)},[u,y]),k=(0,r.useCallback)((e,t)=>{e&&E(e,t,t-1)},[E]),w=(0,r.useCallback)((e,t)=>{e&&E(e,t,t+1)},[E]),S=(0,r.useCallback)(()=>{let a=u.length?u[u.length-1]:void 0,r=(0,nd.AI)(u)?"":nT.t("Continue"),i="primary";switch(a&&a.style){case"primary":i="danger";break;case"danger":i=void 0}let o=(0,nS.OK)(!1,r,i);e(t,[(0,nS.AR)([...u,o])]),g(o),n&&n(tg.k.INTERACTIVE_BLOCKS_ADD_EDIT,{buttonIndex:u.length,formatVariableBeforeInsert:l,onChange:x})},[e,t,n,u,l,x,g]),C=(0,r.useCallback)(e=>{let{source:t,destination:a,draggableId:n}=e;if(!a||t.droppableId===a.droppableId&&t.index===a.index)return;let r=u.find(e=>e.action_id===n);if(!r)return;let l=[...u];l.splice(t.index,1),l.splice(a.index,0,r),y(l)},[u,y]),A=(0,r.useCallback)((e,t,a)=>r.createElement(ButtonsListItem,{button:e,buttonIndex:t,buttonsLength:u.length,experimentWfbBackToBasicsEclairReleaseGroupOn:c,formatVariableBeforeInsert:l,key:a,onChange:x,onDelete:v,onMoveUp:k,onMoveDown:w,switchPane:n}),[u,c,l,x,v,k,w,n]),T=(0,r.useCallback)((e,t,a)=>{let n=a.source.index;return r.createElement("div",{...e.draggableProps,...e.dragHandleProps,className:nA().dragClone,ref:e.innerRef},A(u[n],n,a.draggableId))},[u,A]),I=c&&u.length>1,L=(0,r.useMemo)(()=>u.map((e,t)=>{let a=e.action_id||`${e.type}_${t}_${e.text}`,n=A(e,t,a);return I?r.createElement(ed.lO,{draggableId:a,index:t,key:a},e=>r.createElement("div",{...e.draggableProps,...e.dragHandleProps,className:nA().dragHandle,"data-qa":a,ref:e.innerRef},r.createElement("div",{className:nA().dragIcon},r.createElement(p.Ah,{inline:!0,name:"reorder"})),n)):n}),[u,A,I]),O=nT.rt("Interactive buttons {newBadge}",{newBadge:r.createElement(ns.v,{style:ns.u.Informative,isMicro:!0},nT.t("New",{fallbackHash:"66aabd91fc41cc4635aad94dc77d93a0e2eac67b"})),fallbackHash:"503d46db37b0db45db898aabed77244252918ca2"}),F=nT.t("Create dynamic workflows. Buttons let users continue the flow, branch to specific steps, or open links.",{fallbackHash:"12794b7e85dcea25a5fc307ba269768891424cb6"});return r.createElement(ni.A,{className:nA().buttonConfigWrap},r.createElement(no.A,{className:"margin_bottom_100"},r.createElement(aL.nB,{weight:"bold",element:"h2"},O),r.createElement("span",{className:"normal"},F)),I&&r.createElement(ed.MR,{onDragEnd:C},r.createElement(ed.zv,{droppableId:"buttons-list",renderClone:T},e=>r.createElement("ul",{className:nA().buttonsList},r.createElement("div",{ref:e.innerRef,...e.droppableProps},L,e.placeholder)))),!I&&u.length>0&&r.createElement("ul",{className:o()(nA().buttonsList,{[nA().onlyChildButton]:c})},L),r.createElement(h.Ay,{"data-qa":"add-button",onClick:S,className:nA().addInteractiveButton,disabled:5===u.length,size:"small",type:"outline"},nT.t("Add Interactive Button",{fallbackHash:"3d7db431b9155e6d75c4fbbcd640b667f2a8c9ea"})),r.createElement(MutuallyExclusiveButtonConfig,{updateInteractivityConfiguration:_,interactivityConfiguration:m,segment:i}))};InteractiveBlocksButtons.displayName="InteractiveBlocksButtons";let InteractiveBlocksTreatment=({value:e,parameter:t,variables:a,required:n,onChange:l,formatVariableBeforeInsert:i,isReference:o,viewOnly:s,callbackId:c,switchPane:d,segment:u})=>r.createElement(InteractiveBlocksButtons,{value:e,parameter:t,variables:a,required:n,onChange:l,formatVariableBeforeInsert:i,isReference:o,viewOnly:s,callbackId:c,switchPane:d,segment:u});InteractiveBlocksTreatment.displayName="InteractiveBlocksTreatment";let InteractiveBlocksTreatmentWrapper=({value:e,parameter:t,variables:a,required:n,onChange:l,formatVariableBeforeInsert:i,isReference:o,viewOnly:s,callbackId:c,switchPane:d,segment:u})=>t.type!==e6.TE.SlackTypesBlocks?null:t.name===nv.z.INTERACTIVE_BLOCKS?r.createElement(InteractiveBlocksTreatment,{value:e,parameter:t,variables:a,required:n,onChange:l,formatVariableBeforeInsert:i,isReference:o,viewOnly:s,callbackId:c,switchPane:d,segment:u}):null;InteractiveBlocksTreatmentWrapper.displayName="InteractiveBlocksTreatmentWrapper";var nI=a(0x1340d624e),nN=a(0x98b4cc3b),nM=a(0x1535cb779),nL=a.n(nM);let nO=new c.Ay("workflow_builder"),ButtonColorOptionLabel=({label:e,buttonStyle:t})=>r.createElement("span",{className:nL().optionLabel},r.createElement("span",{"aria-hidden":!0,className:o()(nL().optionLabelColor,nL()[`optionLabelColor__${t}`])}),e);ButtonColorOptionLabel.displayName="ButtonColorOptionLabel";let ButtonColor=({buttonStyle:e,handleChange:t})=>{let a=(0,r.useMemo)(()=>[{label:r.createElement(ButtonColorOptionLabel,{label:nO.t("Outline"),buttonStyle:"outline"}),value:"outline"},{label:r.createElement(ButtonColorOptionLabel,{label:nO.t("Lilypad green"),buttonStyle:"primary"}),value:"primary"},{label:r.createElement(ButtonColorOptionLabel,{label:nO.t("Raspberry red"),buttonStyle:"danger"}),value:"danger"}],[]),n=(0,r.useMemo)(()=>a.find(t=>t.value===(e??"outline")),[e,a]),l=(0,r.useCallback)(({value:e})=>{t("outline"===e?void 0:e)},[t]);return r.createElement(y.A,{"data-qa":"send-message-button-color",htmlFor:"send-message-button-color",text:nO.t("Color",{fallbackHash:"1d0c8304baedcf8e3a78982c2e7c0b04622bf2a0",fallbackHashNs:"lists"}),className:"margin_bottom_125"},r.createElement(ef.Ay,{options:a,width:"100",onOptionSelected:l,selectedOption:n}))};ButtonColor.displayName="ButtonColor";var nF=a(0x242c34757),nD=a(0x162b19a86),nP=a(0x1c244e721),nR=a(0x238b287cf),nB=a(0xa5d8361b);let nW=new c.Ay("workflow_builder"),LinkButtonConfiguration=({button:e,handleChange:t,formatVariableBeforeInsert:a,variables:n})=>{let l=(0,nR.A)(),i=(0,aD.Y)(),o=(0,r.useCallback)(({text:e})=>{t({url:(0,nD.cY)(e)})},[t]),{onBlur:s,errorText:c}=(0,I.K)({errorMessage:nW.t("Please enter a valid URL"),isErrored:!(0,nB.A)(e.url)&&!(0,e0.cn)(e?.url??"")}),d=(0,r.useCallback)(()=>{(0,nP.W)(l,{wbArgs:{workflow_id:i,is_hermes:!0}})},[l,i]);return r.createElement("div",{className:"margin_top_75"},r.createElement(nF.A,{id:"link-button-url_label",initialText:e.url??"",variables:n,allowVariables:!0,ariaLabel:nW.t("Enter a URL"),placeholder:nW.t("http://www.example.com"),shouldAddNewLineOnEnter:!1,onTextChange:o,formatVariableBeforeInsert:a,errorText:c,onBlur:s,onVariableMenuOpen:d,renderDataMenuLocation:"inline"}))};LinkButtonConfiguration.displayName="LinkButtonConfiguration";var nV=a(0x162afc153);let nH=(0,a(0x870b34a7).W)("validate input parameters with async calls");var nq=a(0x197981788),nU=a(0x143698f47),nz=a.n(nU);let nj=new c.Ay("workflow_builder"),CustomizableInputs=({trigger:e,variables:t,handleChange:a,formatVariableBeforeInsert:n,button:l})=>{let i=(0,C.rC)(),o=e.inputs,s=(0,r.useMemo)(()=>l.workflow.trigger.customizable_input_parameters??[],[l.workflow.trigger.customizable_input_parameters]),c=e.workflow.input_parameters.filter(t=>(0,nq.p5)(e?.available_data,t.name)).map(e=>({...e,is_required:!1})),d=(0,r.useMemo)(()=>(0,eQ.K)(c),[c]),m=(0,r.useMemo)(()=>c&&0!==c.length&&0!==s.length?c.reduce((e,t)=>{e[t.name]=o[t.name];let a=s.find(e=>e.name===t.name);return a&&(e[t.name].value=a.value),e},{}):{},[c,s,o]),p=(0,r.useMemo)(()=>!s.every(e=>m[e.name]),[s,m]),b=(0,r.useCallback)((e,t)=>{let n=[...s.filter(t=>t.name!==e.name)];t&&n.push({name:e.name,value:t}),i((0,tG.qq)({parameter:e,value:t})),a({workflow:{trigger:{...l.workflow.trigger,customizable_input_parameters:n}}})},[a,i,s,l.workflow.trigger]);return p?r.createElement(u.Ay,{level:"error"},nj.t("This workflow button refers to a custom input that no longer exists. Please try re-configuring this button.")):0===Object.keys(c).length?null:r.createElement("div",{className:nz().workflowButtonConfig},r.createElement(ni.A,null,r.createElement(no.A,{className:nz().inputLegend},nj.t("Custom inputs (optional)",{fallbackHash:"ac018db1f7b00972061adff843d37497d8ee153c"})),r.createElement(aL.nB,null,nj.t("These are defined in the {triggerName} workflow trigger. You can map variables from the parent workflow to these inputs.",{triggerName:e.name})),r.createElement(aj.v,{functionId:e.id,inputParameters:c,formatVariableBeforeInsert:n,variables:t,configuredParameters:m,onChange:b,callbackId:"callbackId",oAuthParameter:d})))};CustomizableInputs.displayName="CustomizableInputs";var nG=a(0x78a9d64e),n$=a(0x239e2ae8e),nK=a(0x98b79679),nY=a(0xe41988fb),nQ=a(0xa9a7442),nZ=a(0x7db59a01);let nJ=new c.Ay("workflow_builder"),nX=(0,nV.A)(e=>e((0,n$.SA)({reason:"search-precache-workflow-button-search-select"})),6e4),WorkflowButtonConfiguration=({button:e,handleChange:t,formatVariableBeforeInsert:a,variables:n})=>{let i=(0,r.useRef)(null),o=(0,l.wA)(),s=(0,C.rC)(),c=(0,e2.j)(),[d,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1),[b,f]=(0,r.useState)(void 0),g=!!("workflow_button"===e.type&&e.workflow?.trigger?.url),h=(0,nZ.F)(e.workflow?.trigger?.url??"");(0,r.useEffect)(()=>{(async()=>{if(h)try{let{trigger:e}=await o((0,nY.B)({triggerId:h,reason:"workflow-builder/send-message/workflow-button"}));f(e)}catch{p(!0)}})()},[h,o]);let _=g&&d&&!b,y=(0,r.useMemo)(()=>{if(h&&e.action_id&&g&&!_)return{value:h,label:e.action_id,extras:b}},[g,h,_,b,e.action_id]),x=(0,r.useMemo)(()=>{let e=[];return m&&e.push({id:"1",message:"An error occured. Please try again later."}),_&&e.push({id:"1",message:nJ.t("Workflow missing. It may have been renamed or deleted.")}),e},[_,m]);(0,r.useEffect)(()=>{s(nH({isValidInteractiveBlockWorkflowButton:!x.length}))},[s,x,h]);let v=(0,r.useCallback)(({label:e,extras:a})=>{let n=(a?.name??e).substring(0,nG.c$);t({type:"workflow_button",action_id:(0,k.A)(),text:{text:n},workflow:{trigger:{url:a?.shortcut_url}}}),f(a)},[t]),E=(0,r.useCallback)(({label:e,extras:t})=>r.createElement(WorkflowButtonOption,{title:t?.name??e,description:t?.description,icon:t?.workflow?.app?.icons.image_32}),[]),w=(0,r.useCallback)(async e=>{try{return await nX(o),(await o((0,nK.v)({query:e,reason:"workflow-builder/send-message-builtin/button-action-run-workflow"}))).triggers.map(e=>({value:e.id,label:e.name,extras:e}))}catch{return p(!0),[]}finally{u(!0)}},[o]),S=(0,r.useCallback)((e,t)=>Promise.resolve(c?e.filter(e=>e.value!==c.trigger?.id):e),[c]);return r.createElement(r.Fragment,null,r.createElement("div",{className:nz().workflowSelect},r.createElement(nQ.m,{selectId:"send-message-button-action-trigger-select",search:w,placeholderText:nJ.t("Select a workflow",{fallbackHash:"16a41552a20953509d63fd3263aa58349b3d382e"}),ariaLabel:nJ.t("Select a workflow to run",{fallbackHash:"16a41552a20953509d63fd3263aa58349b3d382e"}),width:"100",inputRef:i,onOptionSelected:v,processOptions:S,selectedOption:y,renderOption:E,renderSelectedOption:E,isInvalid:x.length>0,errors:x})),y?.extras&&r.createElement(CustomizableInputs,{trigger:y.extras,variables:n,handleChange:t,formatVariableBeforeInsert:a,button:e}))};function WorkflowButtonOption({icon:e,title:t,description:a}){return r.createElement("div",{className:nz().workflowOptionWrapper},e?r.createElement("img",{"data-qa":"workflow-option-image",src:e,alt:""}):r.createElement("span",{className:nz().fallbackImage}),r.createElement("strong",null,t),a&&r.createElement(r.Fragment,null,r.createElement("span",null," \xb7 "),r.createElement("span",{className:nz().workflowOptionDescription},a)))}WorkflowButtonConfiguration.displayName="WorkflowButtonConfiguration",WorkflowButtonOption.displayName="WorkflowButtonOption";let n0=new c.Ay("workflow_builder"),ButtonConfiguration=({button:e,handleChange:t,handleTypeChange:a,formatVariableBeforeInsert:n,variables:l,multipleContinueButtonsExist:i,isNestedStep:o})=>{let s=(0,M.d4)(N.s3),c=(0,r.useMemo)(()=>o?n0.t("Continue workflow"):n0.t("Continue or branch workflow"),[o]),d=(0,r.useMemo)(()=>{let e=[{value:"button",label:c},{value:"workflow_button",label:n0.t("Run another workflow")},{value:"link",label:n0.t("Open link")}];return s||(e=e.filter(e=>"workflow_button"!==e.value)),e},[c,s]),u=(0,r.useMemo)(()=>d.find(t=>e&&"url"in e?"link"===t.value:t.value===e?.type),[d,e]),m=(0,r.useCallback)(({value:e})=>{a(e)},[a]),p=(0,r.useCallback)(()=>e?.type==="workflow_button"?r.createElement(WorkflowButtonConfiguration,{button:e,handleChange:t,variables:l,formatVariableBeforeInsert:n}):e&&"url"in e?r.createElement(LinkButtonConfiguration,{button:e,handleChange:t,variables:l,formatVariableBeforeInsert:n}):null,[t,n,e,l]),b=(0,r.useMemo)(()=>{if(o)return;let e=n0.t("Moves the workflow forward\u2014each button, up to five, can route to a different branch."),t=n0.t("With conditional branching, two or more buttons can be mapped to perform specific steps.");return[{id:"conditional-branching-hint",message:i?t:e}]},[o,i]);return r.createElement(r.Fragment,null,r.createElement(y.A,{"data-qa":"send-message-button-action",htmlFor:"send-message-button-action",text:n0.t("Behavior"),"aria-label":n0.t("Button Behavior")},r.createElement(ef.Ay,{options:d,width:"100",onOptionSelected:m,selectedOption:u,selectId:"send-message-button-action",hints:b})),p())};function createPreviewBlock(e){return{__meta__:{lastUpdatedTs:""},channel:"preview",type:"message",ts:"0",subtype:"",blocks:[{block_id:"workflow-builder-preview-button",elements:["workflow_button"===e.type?{...e,action_id:(0,k.A)(),workflow:{trigger:{url:"https://example.com",customizable_input_parameters:[]}}}:e],type:"actions"}]}}ButtonConfiguration.displayName="ButtonConfiguration";var n1=a(0x1a69ac39f),n2=a.n(n1);let n4=new c.Ay("workflow_builder"),ButtonPreview=({button:e})=>{let t=(0,r.useMemo)(()=>"url"in e?n4.t("Open link",{fallbackHash:"d2de1a2831e7fee28d6c8d214b66da0d1bed30c8",fallbackHashNs:"composer"}):"workflow_button"===e.type?n4.t("Run workflow",{fallbackHash:"b1b392607deaf29a7e81453e069b7c07a32a6b18",fallbackHashNs:"slack_functions"}):n4.t("Continue workflow"),[e]);return r.createElement(nc.X,{noPointerEvents:!0},r.createElement("div",{className:n2().buttonPreviewWrapper,"aria-hidden":!0},r.createElement(nb.A,{inline:!0,msg:createPreviewBlock(e)}),r.createElement("span",{className:n2().buttonBehavior},t)),r.createElement("span",{className:n2().buttonBehaviorScreenReaderView},n4.t("{buttonLabel} \u2014 {buttonBehavior}",{buttonLabel:e.text.text,buttonBehavior:t})))};ButtonPreview.displayName="ButtonPreview";var n8=a(0x1e4549e93),n5=a.n(n8);let n6=new c.Ay("workflow_builder"),ButtonEdit=({button:e,variables:t,provided:a,isExpanded:n,buttonIndex:l,onEdit:i,onDelete:s,onChange:c,onTypeChange:d,formatVariableBeforeInsert:u,canEdit:m=!1,isDragDisabled:b=!1,viewOnly:f=!1,hasDuplicateContinueLabel:g=!1})=>{let h=(0,r.useCallback)(()=>{i(l)},[i,l]),_=(0,r.useCallback)(()=>{i()},[i]),x=(0,r.useCallback)(()=>{s(l),_()},[s,_,l]),v=(0,r.useCallback)(t=>{c({text:{...e.text,text:t}},l)},[c,e,l]),E=(0,r.useCallback)(e=>c(e,l),[c,l]),k=(0,r.useCallback)(e=>d(e,l),[d,l]),w=(0,r.useCallback)(e=>c({style:e},l),[c,l]),S=(0,r.useMemo)(()=>g?n6.t("Please choose a different label, this one already exists."):"",[g]),C=(0,r.useMemo)(()=>{let t=S||e.text.text.length>nG.c$||e.text.text.length<nG.CL,a="url"in e&&!(0,nB.A)(e.url),n="workflow_button"===e.type&&!e.workflow?.trigger?.url;return t||n||a},[e,S]),A=(0,r.useMemo)(()=>r.createElement("div",{className:n5().previewInfo,ref:a.innerRef,...a.draggableProps},r.createElement("div",{...a.dragHandleProps,role:a.dragHandleProps?.role,tabIndex:a.dragHandleProps?.tabIndex,"aria-describedby":a.dragHandleProps?.["aria-describedby"],"aria-label":`Re-order ${e.text.text}`,className:o()({[n5().dragDisabled]:b})},r.createElement(p.Ah,{name:"apps"})),r.createElement(ButtonPreview,{button:e})),[e,b,a.dragHandleProps,a.draggableProps,a.innerRef]);return r.createElement(nN.k,{label:e.text.text,isExpanded:n,onEdit:h,onCollapse:_,onRemove:x,canEdit:m,canCollapse:!C,canRemove:!0,removeButtonAriaLabel:n6.t("Delete {label}",{label:e.text.text,fallbackHash:"9a8d74ce655d76751b0f8ac36ee59c5d8fbfdd79"}),editButtonAriaLabel:n6.t("Edit {label}",{label:e.text.text,fallbackHash:"24d4e0d073df8f371a8b57819503767677a33b04"}),forceNoBorder:!0,previewInfo:A},r.createElement("div",{className:"padding_bottom_100",ref:a.innerRef,...a.draggableProps,...a.dragHandleProps,draggable:!1},r.createElement(y.A,{htmlFor:"message_button_label",text:n6.t("Text")},r.createElement(tt.A,{autoFocus:!0,"data-qa":"send-message-button-text",isRequired:!0,name:"message_button_label",id:"message_button_label",value:e.text.text,placeholder:e.text.text,"aria-label":n6.t("Set the button label"),onChange:v,isDisabled:f,maxCharacterLimit:nG.c$,minCharacterLimit:nG.CL,errorText:S,autoComplete:"off",useInlineAlert:!0})),r.createElement(ButtonColor,{handleChange:w,buttonStyle:e.style}),r.createElement(ButtonConfiguration,{handleChange:E,handleTypeChange:k,button:e,variables:t,formatVariableBeforeInsert:u})))};ButtonEdit.displayName="ButtonEdit";var n3=a(0x614331cf),n7=a.n(n3);let n9=new c.Ay("workflow_builder"),SalesHomeInteractiveBlocksButtons=({onChange:e,formatVariableBeforeInsert:t,parameter:a,viewOnly:n,value:l=[],variables:i})=>{let[o,s]=(0,r.useState)(),c=l.find(e=>"actions"===e.type),d=(0,r.useMemo)(()=>c?.elements||[],[c?.elements]),u=(0,r.useCallback)(e=>{s(e)},[s]),m=(0,r.useCallback)(()=>{e(a,[(0,nS.AR)([...d,(0,nS.OK)(!1,n9.t("Continue")+(d.length||""),"primary")])])},[e,a,d]),p=(0,r.useCallback)(t=>{let n=d.filter((e,a)=>a!==t);n.length?e(a,[(0,nS.AR)(n)]):e(a,[])},[e,a,d]),b=(0,r.useCallback)((t,n)=>{let r={...d[n]};switch(t){case"workflow_button":r.type=t,delete r.style,"value"in r&&delete r.value,"url"in r&&delete r.url;break;case"link":r.type="button",r.url="",delete r.workflow,"value"in r&&delete r.value;break;default:r.type=t,r.style="primary",r.value="button",delete r.workflow,"url"in r&&delete r.url}let l=d.map((e,t)=>n===t?r:e);e(a,[(0,nS.AR)(l)])},[d,e,a]),f=(0,r.useCallback)((t,n)=>{let r=d[n],l={...r,...t,text:{...r.text,...t.text}},i=d.map((e,t)=>n===t?l:e);e(a,[(0,nS.AR)(i)])},[e,a,d]),g=(0,r.useCallback)(t=>{let{source:n,destination:r,draggableId:l}=t;if(!r||n.droppableId===r.droppableId&&n.index===r.index)return;let i=d.find(e=>e.action_id===l);if(!i)return;let o=[...d];o.splice(n.index,1),o.splice(r.index,0,i),e(a,[(0,nS.AR)([...o])])},[d,e,a]),_=(0,r.useMemo)(()=>(0,nS.P6)(d),[d]),y=(0,r.useCallback)((e,t,a)=>{let{draggableId:n}=a,l=d.find(e=>e.action_id===n);return l?r.createElement(ButtonEdit,{button:l,variables:i,provided:e,isExpanded:!1,onEdit:ts.A,onDelete:ts.A,onChange:ts.A,onTypeChange:ts.A,buttonIndex:0}):r.createElement("div",null)},[d,i]);return r.createElement(ed.MR,{onDragEnd:g},r.createElement("div",{className:n7().buttonConfigWrap},r.createElement("div",{className:"margin_bottom_100"},r.createElement(aL.nB,{weight:"bold",element:"h2"},n9.t("Buttons")),r.createElement("span",null,n9.t("Use buttons to initiate actions in the steps that follow",{fallbackHash:"a8173d06df5ef07a104854ec462136bff7f446f2"}))),d.length>0&&r.createElement(ed.zv,{droppableId:"button-config-section",renderClone:y},(e,a)=>r.createElement("ul",{...e.droppableProps,ref:e.innerRef,className:n7().buttonListDroppable},d?.map((e,a)=>{let l=o===a,s=!!(void 0===o||o&&o===a);return r.createElement(ed.lO,{key:e.action_id,draggableId:e.action_id||"",index:a,isDragDisabled:!!o},(c,m)=>r.createElement(ButtonEdit,{key:e.action_id,button:e,provided:c,isExpanded:l,canEdit:s,isDragDisabled:!!(o||1===d.length),onEdit:u,onDelete:p,onChange:f,formatVariableBeforeInsert:t,onTypeChange:b,buttonIndex:a,viewOnly:n,variables:i,hasDuplicateContinueLabel:_}))}),e.placeholder)),r.createElement(h.Ay,{"data-qa":"add-button",onClick:m,className:n7().addButton,disabled:5===d.length,size:"small",type:"outline"},n9.t("Add Button"))))};SalesHomeInteractiveBlocksButtons.displayName="SalesHomeInteractiveBlocksButtons";let SalesHomeInteractiveBlocksTreatment=({value:e,parameter:t,variables:a,required:n,onChange:l,formatVariableBeforeInsert:i,isReference:o,viewOnly:s,callbackId:c})=>t.type===e6.TE.SlackTypesBlocks&&t.name===nv.z.INTERACTIVE_BLOCKS?r.createElement(SalesHomeInteractiveBlocksButtons,{value:e,parameter:t,variables:a,required:n,onChange:l,formatVariableBeforeInsert:i,isReference:o,viewOnly:s,callbackId:c}):null;SalesHomeInteractiveBlocksTreatment.displayName="SalesHomeInteractiveBlocksTreatment";var re=a(0x72b537b5),rt=a(0x2172ff7ff),ra=a(0x143f89715),rn=a(0xc3116e8),rr=a(0x2a61c7f6),rl=a.n(rr);let ri=new c.Ay("workflow_builder"),SlackFunctionSalesforceColumnInput=({onChange:e,value:t,label:a,parameter:n,variables:l,showInline:i})=>{let s=(0,E.A)(),c=(0,re.U)(),d=(0,r.useCallback)(t=>{e(n,t.value,a)},[e,n,a]),u=(0,r.useMemo)(()=>({value:0,label:ri.t("Missing Data"),isError:!0}),[]),m=(0,r.useMemo)(()=>{let e=(l?(0,rn.Km)(l):[]).map(e=>({label:e.label,value:e.id})).sort((e,t)=>(0,rt.Ay)(e.label,t.label)),a=e.filter(e=>!t||t!==e?.value),n=e.filter(e=>!!t&&t===e?.value),r=t&&0===n.length?[u]:n;return(0,af.A)(r)?[...a]:[...r,{type:"divider",value:1/0,label:"-"},...a]},[t,u,l]),p=(0,r.useMemo)(()=>{let e=m.find(e=>e.value===t);return t&&!e?u:e},[m,u,t]),b=(0,r.useMemo)(()=>m.map(({value:e})=>e).join("_"),[m]),f=ri.t("This variable is missing."),g=(0,r.useMemo)(()=>{let e=[];return t&&p?.value===u.value&&e.push({id:"variable_missing",message:f}),e},[t,p,u,f]),h=(0,ra.A)(g,c),{onBlur:_,okayToDisplay:y}=(0,I.K)({errorMessage:"",isErrored:h,shouldErrorPreventSave:!0,shouldErrorShowImmediately:h}),x=(0,r.useCallback)(e=>r.createElement("span",{className:o()({[rl().hasErrors]:p&&p.value===u.value})},e.label),[p,u]);return r.createElement(ne.z,{elementId:s,parameter:n,className:"c-label--has_footer",inline:i},r.createElement("div",null,r.createElement(w.Ay,{key:b,isLoading:!1,selectId:"SchemaField",options:m,placeholderText:ri.t("Select field\u2026"),ariaLabel:ri.t("Field"),width:"100%",onOptionSelected:d,selectedOption:p,renderSelectedOption:x,isInvalid:y&&h,onBlur:_,errors:g,showDropdownIcon:!0})))};SlackFunctionSalesforceColumnInput.displayName="SlackFunctionSalesforceColumnInput";let SlackFunctionSalesforceRecipientInput=({value:e,variables:t,onChange:a,parameter:n,label:l})=>{let i=(0,r.useCallback)((e,t)=>{a(n,t??null,l)},[a,n,l]),o=(0,r.useMemo)(()=>(0,rn.Ji)(t,e=>({...e,isHidden:!1})),[t]);return r.createElement(aQ.O,{value:e,variables:o,onChange:i,parameter:n,allowVariables:!0})};SlackFunctionSalesforceRecipientInput.displayName="SlackFunctionSalesforceRecipientInput";var ro=a(0x56e1c8ae),rs=a(0x126af815a);let SendSummaryToSalesHomeTreatment=({variables:e,value:t,parameter:a,onChange:n,callbackId:l,workflowId:i,formatVariableBeforeInsert:o,required:s,isReference:c,viewOnly:d,segment:u})=>{let m=(0,M.d4)((0,nf.sx)(i,ng.RG)),p=(0,e8.eR)(m);if(p?.type!==rs.SJ||(0,ro.Fe)(p.config)||(0,ro.SZ)(p.config))return r.createElement(r.Fragment,null);let b=p.config.notificationHeader,f={...a,description:b};switch(a.type){case e6.TE.SlackTypesUserId:if(a.name===nI.bI.USER_ID)return r.createElement(SlackFunctionSalesforceRecipientInput,{value:t||"",variables:e,parameter:a,onChange:n,callbackId:l});return null;case e6.TE.Integer:if(a.name===nI.bI.NOTIFICATION_DISPLAY_TABLE_EXTRA_COLUMN_FIELD_ID&&(0,rn.Xw)(p))return r.createElement(SlackFunctionSalesforceColumnInput,{onChange:n,value:t,parameter:a,variables:e});return r.createElement(r.Fragment,null);case e6.TE.String:if(a.name===nI.bI.NOTIFICATION_DISPLAY_TABLE_HEADER)return r.createElement("div",{"data-qa":"send-summary-treatment__table-header-input"},r.createElement(aZ.C,{value:(0,al.$)(t)?b:t,parameter:f,variables:e,onChange:n,callbackId:l,required:a.is_required,allowVariables:!1,formatVariableBeforeInsert:o}));return null;case e6.TE.SlackTypesBlocks:if(a.name===nI.bI.INTERACTIVE_BLOCKS)return r.createElement(SalesHomeInteractiveBlocksTreatment,{value:t,parameter:a,variables:e,required:s,onChange:n,formatVariableBeforeInsert:o,isReference:c,viewOnly:d,callbackId:l,segment:u});return null;default:return null}};SendSummaryToSalesHomeTreatment.displayName="SendSummaryToSalesHomeTreatment";var rc=a(0xa224974e),rd=a(0x1d67ca27f);let ru=[],ChildFieldMessage=({value:e,variables:t,onChange:a,formatVariableBeforeInsert:n,parameter:l,configuredParameters:i,label:o,callbackId:s,required:c})=>{let d=(0,r.useCallback)((e,t)=>{a(l,t??null,o)},[a,l,o]),u=(0,r.useMemo)(()=>(0,rd.Wt)(i.user_id,t,!0),[t,i.user_id]),m=(0,r.useMemo)(()=>{let e=`${i.user_id?.value}`.match(rd.g9);return e?`${e[1]}_${e[3]}`:"-1"},[i.user_id]);return r.createElement(rc.h,{key:m,callbackId:s,variables:u,parameter:l,value:e,required:c,onChange:d,formatVariableBeforeInsert:n,parameters:ru,configuredParameters:i,allowVariables:!0})};ChildFieldMessage.displayName="ChildFieldMessage";let ChildRecipientSelection=({value:e,variables:t,onChange:a,parameter:n,label:l})=>{let i=(0,r.useCallback)((e,t)=>{a(n,t??null,l)},[a,n,l]),o=(0,r.useMemo)(()=>(0,rd.r3)(t,e=>({...e,isHidden:!1})),[t]),s=(0,r.useMemo)(()=>(0,rd._V)(o),[o]);return r.createElement(aQ.O,{value:e,variables:s,onChange:i,parameter:n,allowVariables:!0})};ChildRecipientSelection.displayName="ChildRecipientSelection";var rm=a(0x9e671ad),rp=a(0x18a03595d),rb=a(0x1952a5c50),rf=a(0x4a120eb2),rg=a(0x2fd935d8);let rh=new c.Ay("workflow_builder"),RoleSelection=({value:e,parameter:t,required:a,label:n,onChange:i})=>{let o=(0,l.wA)(),s=(0,E.A)(),c=(0,e2.j)(),d=(0,e8.PM)(c),[u,m]=(0,r.useState)([]),{title:p,description:b,hint:f,name:g}=t,h=(0,r.useMemo)(()=>{if(f)return[{id:`${s}-hint-id`,message:f}]},[s,f]),_=(0,r.useMemo)(()=>{let n=[];return(a||t.is_required)&&(0,af.A)(e)&&n.push({id:"ITEMS_REQUIRED",message:rh.t("This field is required.")}),n},[t.is_required,a,e]),{onBlur:y}=(0,I.K)({errorMessage:void 0,isErrored:_.length>0,shouldErrorPreventSave:!0}),x=(0,r.useCallback)(e=>(0,rb.u)(e)?rh.t("No items"):rh.t("Type at least 3 characters to search roles"),[]),v=(0,r.useCallback)(async e=>{if(!(0,rb.u)(e))return[];let{records:t}=await o((0,rg.R)({sobjects:[{sobjectApiName:"UserRole",fields:["Name"]}],asIntegrationUser:!0,query:e,...d&&{salesforceOrgId:d},reason:"workflow_builder_user_role_search"}));return m(t),t},[o,d]),k=(0,r.useCallback)(e=>e?.reduce((e,t)=>(e[t.value]=t.label,e),{}),[]),w=(0,r.useCallback)(e=>{i(t,e.map(e=>e.value),k(e))},[k,i,t]),S=(0,r.useMemo)(()=>(0,af.A)(e)||!Array.isArray(e)?[]:e.reduce((e,t)=>{let a=u.find(e=>(0,rm.A)(e.value,t));return a?e.push({label:a.label,value:a.value}):"string"==typeof t?e.push({label:n?.[t]||"",value:t}):t&&e.push({label:String(t),value:String(t)}),e},[]),[n,u,e]);return r.createElement(ne.z,{elementId:g,parameter:t,isAlwaysRequired:a},r.createElement(rf.x,{ariaLabel:p,hints:h,selectId:s,search:v,placeholderText:b,onSelectedItemsChange:w,width:"100%",debounceWaitPeriod:rp.Vp,selectedOptions:S,className:"margin_bottom_50",errors:_,isInvalid:_.length>0,onBlur:y,selectDataQa:`roleselection-${g}`,onScrollablePage:!0,emptyStateMessage:x,expandOnClick:!0,expandOnFocus:!0}))};RoleSelection.displayName="RoleSelection";var r_=a(0x77727995),ry=a(0xf3dd4cf5),rx=a(0x1e94f3cf);let rv=new c.Ay("workflow_builder");function isFilterCondition(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&"id"in e&&!!e.id}let rE=(0,rx.y)(ry.Q),UserFilters=({value:e,label:t,parameter:a,configuredParameters:n,required:l,onChange:i})=>{let o=(0,E.A)(),s=(0,e2.j)(),[c,d]=(0,r.useState)(void 0),u=(0,r.useMemo)(()=>isFilterCondition(e)?e:{...(0,ro.jz)()},[e]),m=(0,r.useCallback)(e=>{i(a,{...e},t)},[a,t,i]);(0,r.useEffect)(()=>{let e=`${n.user_id?.value??n.user_ids?.value}`.match(/Ft[A-Z0-9]*?__[0-9]+?_[0-9]+?_([0-9]+?)_([0-9]+?_)*?child/),t=(e&&Number.parseInt(e[1],10))??void 0;t&&c!==t&&d(t)},[c,n]);let{hint:p,name:b}=a,f=(0,r.useMemo)(()=>{if(p)return[{id:`${o}-hint-id`,message:p}]},[o,p]),g=(e=>{let t=(0,e8.eR)(e);if(t&&"datasourceId"in t.config)return(0,r_.A)(t,"config.datasourceId")})(s),h=(0,r.useMemo)(()=>({hasValidConditionGroups:!0,hasValidDataSourceObjectId:!(0,af.A)(g),hasValidSchemaObjectId:!!(c&&c>0),isValid:!0}),[g,c]),_=(0,r.useCallback)(()=>{i(a,{...ro.jz})},[i,a]);return r.createElement(r.Fragment,null,r.createElement(ne.z,{elementId:b,parameter:a,isAlwaysRequired:l,noMarginBottom:!0,className:"display_flex align_items_center justify_content_between full_width margin_bottom_25"},r.createElement(tq.A,{onClick:_},rv.t("Clear Filter",{fallbackHash:"719ea396ad92e01b4757ec2b93bb1e5f270f771d"}))),r.createElement(C.cR.Provider,{value:h},r.createElement(rE,{datasourceId:g,schemaObjectId:c,condition:u,conditionIndex:0,onChange:m,isWrapped:!0})),f&&f.map(({id:e,message:t})=>r.createElement(a$.A,{key:e,id:e},t)))};UserFilters.displayName="UserFilters";let SendToSalesHomeTreatment=({parameter:e,configuredParameters:t,value:a,label:n,variables:l,required:i=!!e.is_required,onChange:o,formatVariableBeforeInsert:s,isReference:c,viewOnly:d,callbackId:u,segment:m})=>{switch(e.type){case e6.TE.Array:if(e.name===nI.XD.ROLES)return r.createElement(RoleSelection,{value:a,label:n,parameter:e,required:i,onChange:o});return null;case e6.TE.SlackTypesUserId:if(e.name===nI.XD.USER_ID)return r.createElement(ChildRecipientSelection,{callbackId:u,value:a||"",label:n,parameter:e,onChange:o,variables:l});return null;case e6.TE.SlackTypesBlocks:if(e.name===nI.XD.INTERACTIVE_BLOCKS)return r.createElement(SalesHomeInteractiveBlocksTreatment,{value:a,parameter:e,variables:l,required:i,onChange:o,formatVariableBeforeInsert:s,isReference:c,viewOnly:d,callbackId:u,segment:m});return null;case e6.TE.Object:if(e.name===nI.XD.USER_FILTER)return r.createElement(UserFilters,{value:a,label:n,parameter:e,configuredParameters:t,required:i,onChange:o});return null;case e6.TE.SlackTypesRichText:if(e.name===nI.XD.MESSAGE)return r.createElement(ChildFieldMessage,{callbackId:u,value:a||g.Ml,label:n,parameter:e,configuredParameters:t,onChange:o,formatVariableBeforeInsert:s,variables:l,required:i});return null;default:return null}};SendToSalesHomeTreatment.displayName="SendToSalesHomeTreatment";let SendToSalesforceAppTreatment=({parameter:e,value:t,label:a,variables:n,required:l,onChange:i,formatVariableBeforeInsert:o,isReference:s,viewOnly:c,callbackId:d,workflowId:u,segment:m})=>{let p=(0,M.d4)((0,nf.sx)(u,ng.RG));switch((0,r.useEffect)(()=>{if(e.name===nI.qG.USER_ID&&(0,al.$)(t)&&p&&m.id){let t=(e=>{if(!e?.workflow)return null;let t=(0,e8.gi)(e.workflow).find(e=>(0,t$.Zk)(e)&&e.function?.callback_id===e6.oW.SendToSalesforceApp&&e.inputs.user_id?.value&&"string"==typeof e.inputs.user_id.value&&!(0,al.$)(e.inputs.user_id.value));return t?.inputs.user_id?.value??null})(p);t&&i(e,t,a)}},[e,t,p,m.id,i,a]),e.type){case e6.TE.SlackTypesUserId:if(e.name===nI.qG.USER_ID)return r.createElement(SlackFunctionSalesforceRecipientInput,{value:t||"",variables:n,parameter:e,onChange:i,callbackId:d});return null;case e6.TE.SlackTypesBlocks:if(e.name===nI.qG.INTERACTIVE_BLOCKS)return r.createElement(SalesHomeInteractiveBlocksTreatment,{value:t,parameter:e,variables:n,required:l,onChange:i,formatVariableBeforeInsert:o,isReference:s,viewOnly:c,callbackId:d,segment:m});return null;default:return null}};SendToSalesforceAppTreatment.displayName="SendToSalesforceAppTreatment";var rk=a(0x1c2ea7265),rw=a(0xc5f25803),rS=a(0x12321ecbc);let rC=new c.Ay("workflow_builder"),ChannelSummaryHint=({segment:e})=>{let t=(0,l.wA)(),a=(0,e2.j)(),n=(0,a0.XS)(a,e),i=(0,e5.Dp)(e),o=[e6.oW.ShareCanvas,e6.oW.CreateCanvas,e6.oW.UpdateCanvasContent,e6.oW.UpdateCanvasContentV2,e6.oW.CreateChannelCanvas].some(e=>e===i),s=(0,e4.EM)(e),c=(0,r.useMemo)(()=>(0,rw.a)(a?.workflow),[a]),d=(0,r.useCallback)(e=>t((0,et.f)(e)),[t]),m=(0,e5.Iw)(e),p=m?.message?.value||m?.content?.value||"",b=(0,r.useMemo)(()=>c.map((e,t)=>({...e,stepIndex:t})).filter(e=>e?.function?.callback_id===e6.oW.SummarizeChannel).map(e=>({id:e.id,stepIndex:e.stepIndex,channelIds:e.inputs?.channel_ids?.value||[e.inputs?.channel_id?.value]})),[c]),f=m.user_id?.value,g=m.channel_id?.value;if(!p||(0,t3.A)(p)||n)return null;let h=(0,rk.Q)(p,s.list,d),_=b.filter(e=>h.includes(e.id)),y=_.flatMap(e=>e.channelIds),x=y.filter((e,t)=>y.indexOf(e)===t&&void 0!==e);return _.length>0?r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},(()=>{if(!f&&!g&&!o)return x.length>=4?rC.rt("This step shares the AI-generated summary from {stepNumber} previous steps with \u2026",{stepNumber:x.length+1}):rC.rt("This step shares the AI-generated summary from steps {stepNumber} with \u2026",{stepNumber:(0,tH.A)(_.map(e=>(e.stepIndex+1).toString()),{conj:"and",keyPrefix:"stepNumber"})});let e=r.createElement(r.Fragment,null,rC.t("Missing Data"));return(g&&(e=r.createElement(r.Fragment,null,(0,rS.E)([g],s.list))),f&&(e=r.createElement(r.Fragment,null,(0,rS.k)([f],s.list))),o&&(e=r.createElement(r.Fragment,null,rC.t("a canvas"))),x.length>2)?rC.rt("This step shares the AI-generated summary from {channelOne}, {channelTwo} and {channelNumber} more with {entity}.",{entity:e,channelOne:(0,rS.E)([x[0]],s.list),channelTwo:(0,rS.E)([x[1]],s.list),channelNumber:x.length-2}):rC.rt("This step shares the AI-generated summary from {channels} with {entity}.",{entity:e,channels:(0,tH.A)(x.map(e=>(0,rS.E)([e],s.list)),{conj:"and",keyPrefix:"channel"})})})()):null};ChannelSummaryHint.displayName="ChannelSummaryHint";var rA=a(0x15dd8a31),rT=a(0x250295787),rI=a(0xbf22577d),rN=a(0xf6cfcca),rM=a(0x22d3b4662),rL=a(0x1fccea22),rO=a.n(rL);let rF=new c.Ay("workflow_builder"),ConvertBlocksToPlainTextHelper=e=>(0,M.d4)(t=>(0,rM.A)(t,e)),ChannelOptionLabel=({channelId:e,label:t})=>t?r.createElement(r.Fragment,null,r.createElement("span",{className:"margin_right_50"},r.createElement(p.Ah,{name:"css",inline:!0})),r.createElement("span",null,t)):r.createElement(rT.A,{channelId:e,showTeamForLocalChannels:!0});ChannelOptionLabel.displayName="ChannelOptionLabel";let PinMessageFormStep=({segmentVariables:e,configuredParameters:t,inputParameters:a,onChange:n})=>{let{channel_id:l,message:i}=t,o=(0,aD.Y)(),s=l.value,c=i.value,[d,u]=(0,r.useState)(s),[m,p]=(0,r.useState)(c),b=(0,r.useCallback)(({channelId:e,messageLink:t})=>{let r=a.find(e=>"channel_id"===e.name),l=a.find(e=>"message"===e.name);r&&l&&e&&t&&(n(r,e),n(l,t))},[a,n]),f=(0,M.d4)((0,nf.sx)(o,ng.RG)),g=(0,r.useMemo)(()=>{let t={};for(let a of e.list){if(!a||"message_link"!==a.name||"function"!==a.source_type||!f)continue;let e=a.id,n=(0,e8.kn)(f,a.source_id);"send_message"===(0,e5.Dp)(n)&&(t[e]=n)}return t},[e.list,f]),h=(0,r.useMemo)(()=>{let e={};for(let[t,a]of Object.entries(g)){let{channel_id:n}=(0,e5.Iw)(a),r=n.value;e[r]=[...e[r]||[],t]}return e},[g]),_=(0,r.useMemo)(()=>{let t={};for(let a of e.list)a&&a.label&&("channel_id"===a.name||a.type===rN.Z.SlackTypesChannelId)&&(t[a.id]=a.label);return t},[e.list]),x=(0,r.useCallback)(e=>{let t=e.value;if(t===d)return;let a=h[t],n=1===a.length,r=a[0],l=n?r:void 0;u(t),p(l),b({channelId:t,messageLink:l})},[d,b,h]),v=(0,r.useCallback)(e=>{let t=e.value;t!==m&&(p(t),b({channelId:d,messageLink:t}))},[d,m,b]),E=(0,r.useMemo)(()=>d?{label:r.createElement(ChannelOptionLabel,{channelId:d,label:_[d]}),value:d}:void 0,[_,d]),k=(0,r.useMemo)(()=>Object.keys(h).map(e=>({label:r.createElement(ChannelOptionLabel,{channelId:e,label:_[e]}),value:e})),[h,_]),w={};for(let[e,t]of Object.entries(g)){let{message:a}=(0,e5.Iw)(t),n=a.value;w[e]=ConvertBlocksToPlainTextHelper(n)}let S=m?{label:w[m],value:m}:void 0,C=d&&Object.entries(w).length>0?h[d].map(e=>({label:w[e],value:e})):[];return r.createElement("div",{className:rO().pinMessage},r.createElement(y.A,{text:rF.t("Select a channel"),className:"margin_bottom_150"},r.createElement(rA.A,{options:k,ariaLabel:rF.t("Select a channel"),selectId:"channel_select",width:"100%",onOptionSelected:x,selectedOption:E,isRequired:!0})),d&&r.createElement(y.A,{text:rF.t("Select a message",{fallbackHash:"16a41552a20953509d63fd3263aa58349b3d382e"}),className:"margin_bottom_150"},r.createElement(rA.A,{options:C,ariaLabel:rF.t("Select a message",{fallbackHash:"16a41552a20953509d63fd3263aa58349b3d382e"}),selectId:"message_select",width:"100%",onOptionSelected:v,selectedOption:S,key:d,isRequired:!0})),m&&g[m]&&r.createElement("div",{className:rO().previewLabelWrapper},r.createElement(aL.nB,{className:rO().previewLabel,weight:"bold"},rF.t("Preview")),r.createElement("div",{className:rO().preview_message_container},(0,rI.n)(o,g[m],e,{isPinned:!0,isEditor:!0}))))};PinMessageFormStep.displayName="PinMessageFormStep";var rD=a(0xead28e26),rP=a(0xb8ff08bd);let rR=new c.Ay("workflow_builder"),StepPrivateChannelMessageAlert=({workflow:e,segment:t})=>{let a=(0,M.d4)(N.sQ),n=(0,rP.f)({workflow:e,segment:t,isTrigger:!1});if(!a||n!==ad.yF)return null;let l=a?rR.t("Variable not available. The Text of the message variable can\u2019t be used in private channels."):"Variable not available. The Text of the message variable can\u2019t be used in private channels.";return r.createElement(u.Ay,{level:u.A_.error,type:"boxed",className:"margin_bottom_50"},l)};StepPrivateChannelMessageAlert.displayName="StepPrivateChannelMessageAlert";let rB=new c.Ay("workflow_builder"),SlackFunctionSegmentForm=({state:e,afterStepId:t,isExistingStep:a,switchPane:n,isOAuthTokenInvalid:l,activePane:i,noFormPadding:o,allowVariables:s,isFunctionForKnowledgeSource:c})=>{let d=(0,C.rC)(),{segment:m}=e,p=(0,e5.ln)(m),b=(0,e4.EM)(m),f=(0,e5.Dp)(m),g=(0,e2.j)(),h=(0,aD.Y)(),_=(0,e5.am)(m),y=(0,e5.mV)(m),x=(0,e5.P)(m),v=x?.id??(0,e5.g$)(m),E=(0,e5.E)(m),k=(0,e5.h)(m),w=(0,M.d4)(aM.R5),S=(0,M.d4)(N.$T),T=(0,M.d4)(N.dq),I=(0,M.d4)(N.cA),L=(0,r.useMemo)(()=>{let e={};return(0,ty.q2)(m)?x?(0,ty.Jl)(m,x,S):e:(p&&0!==p.length&&p.forEach(t=>{let a=(0,e5.RE)(m,t.name);a&&(e[t.name]=a)}),e)},[S,p,m,x]);useFunctionDynamicInputs({workflowId:h,callbackId:f,segmentId:m.id,slackFunction:x,isOpenFormSegment:(0,ty.q2)(m),configuredParameters:L,dynamicInputs:E,isExistingStep:a});let O=(0,r.useCallback)(e=>{let t=[],fillRequiredContextRecursively=(e,a,n=0)=>{n>=a||(e&&"object"==typeof e?Object.values(e):[e]).forEach(e=>{if("string"==typeof e&&(0,e0.cn)(e)){let a=(0,eX.x)(b.list,e);if(!a)return;"trigger"===a.source&&a.sourceReference&&t.push(a.sourceReference)}null!==e&&"object"==typeof e&&fillRequiredContextRecursively(e,a,n+1)})};fillRequiredContextRecursively(e,10),d((0,A.aI)({value:t}))},[d,b.list]),F=(0,r.useCallback)((e,t,a,n)=>{O(t),n?.dynamicInputState&&d((0,tG.T)({[e.name]:n.dynamicInputState})),d((0,tG.qq)({parameter:e,value:t,label:a,options:n,experimentThirdPartyUserFormParityGroupOn:S}))},[d,S,O]),D=(0,r.useCallback)(e=>{d((0,tG.m0)({isDataFetching:e}))},[d]),P=(0,r.useMemo)(()=>p?(0,eQ.K)(p):void 0,[p]),{renderOAuth2InputParameter:R}=(0,aO.v)({stepId:m.id,appId:(0,e5.Zy)(m),functionId:v,inputParameters:p,configuredInputs:(0,e5.Iw)(m),workflowId:h,onChange:F,isFunctionFormWrapped:y,isOAuthTokenInvalid:l,isFunctionForKnowledgeSource:c}),{isParentModal:B,isChildModal:W}=useSegmentPaneNavigation({segment:m,switchPane:n,activePane:i}),V=(0,r.useMemo)(()=>p?.map(e=>(0,eU.w)(e))?.filter(e=>{let t=(0,tX.oO)(e);return B&&!(0,eG.sg)(e)?t:W?!t:"thread_ts"!==e.name})||[],[p,B,W]),H=(0,r.useCallback)((e,t)=>{let{source:a,sourceReference:n}=e;return("trigger"===a&&n&&d((0,A.aI)({value:n})),t?.skipMacro)?e:(0,e3.Xq)(e,{fromRichText:t?.isRichText,appId:x?.app_id,parameterType:t?.parameterType,stepId:x?.id,callbackId:x?.callback_id},w)},[x?.app_id,x?.id,x?.callback_id,d,w]);useFunctionVariables({functionId:v,workflowId:h,callbackId:f,segmentId:m.id,functionVariables:_,slackFunctionVariablesSchema:k,isFunctionFormWrapped:y,configuredParameters:L});let q=(0,r.useCallback)((e,t,a)=>{let r=(e=>{switch(e){case e6.oW.ReplyInThread:case e6.oW.SendDm:case e6.oW.SendMessage:case e6.oW.SendToRecordChannel:return InteractiveBlocksTreatmentWrapper;case e6.oW.CreateCanvas:case e6.oW.CreateChannelCanvas:return ConnectedCreateCanvasTreatment;case e6.oW.UpdateCanvasContent:return ConnectedUpdateCanvasTreatment;case e6.oW.UpdateCanvasContentV2:return ConnectedUpdateCanvasTreatmentV2;case e6.oW.UpdateCanvasVariables:return ConnectedUpdateCanvasVariablesTreatment;case e6.oW.Delay:return DelayTreatment;case e6.oW.SendToMySalesHome:case e6.oW.SendToSalesHome:return SendToSalesHomeTreatment;case e6.oW.SendToMySalesforceApp:case e6.oW.SendToSalesforceApp:return SendToSalesforceAppTreatment;case e6.oW.SendSummaryToMySalesHome:case e6.oW.SendSummaryToSalesHome:return SendSummaryToSalesHomeTreatment;default:return ts.A}})(f),l=L?.[e.name]?.label;return r({parameter:e,variables:b,configuredParameters:L,onChange:F,formatVariableBeforeInsert:H,callbackId:f,workflowId:h,value:t,otherParameterValues:a,label:l,switchPane:n,segment:m})},[f,h,b,L,F,H,n,m]),U=x?.category_label,renderStepHint=()=>{if(W&&y)return r.createElement(aL.Pd,{weight:"bold",className:"margin_bottom_125"},rB.t("Additional fields"),r.createElement(aL.nB,{weight:"regular"},rB.t("Add any other fields you want updated in {serviceName}. These fields won\u2019t be in the form.",{serviceName:U})));if(B&&!l)return r.createElement(aL.Pd,{weight:"bold",className:"margin_bottom_125","data-qa":"step-parent-modal-hint"},rB.t("{serviceName} connection",{serviceName:U}),r.createElement(aL.nB,{weight:"regular"},y?rB.t("Choose where we get info from {serviceName} to create form fields.",{serviceName:U}):rB.t("Choose where we get info from {serviceName} to create step fields.",{serviceName:U})));switch(f){case e6.oW.RemoveReaction:return r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},rB.t("You can remove reactions only added by this workflow."));case e6.oW.AddUserToUsergroup:case e6.oW.RemoveUserFromUserGroup:return r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},rB.t("You might need additional permissions to add people to the user group you select."));case e6.oW.ShareCanvas:case e6.oW.CreateCanvas:case e6.oW.UpdateCanvasContent:case e6.oW.UpdateCanvasContentV2:case e6.oW.CreateChannelCanvas:case e6.oW.SendDm:case e6.oW.SendMessage:return r.createElement(ChannelSummaryHint,{segment:m});case e6.oW.SendEphemeralMessage:return r.createElement(r.Fragment,null,r.createElement(ChannelSummaryHint,{segment:m}),r.createElement(u.Ay,{level:u.A_.default,className:"margin_bottom_150"},r.createElement("span",null,rB.t("This message is only visible to a specific person in the channel. A few notes about \u201Conly visible to you\u201D messages:")),r.createElement("ul",{className:"margin_bottom_0 margin_top_75"},r.createElement("li",null,rB.t("They can\u2019t be sent in DMs")),r.createElement("li",null,rB.t("They can\u2019t post in private channels if their recipient doesn\u2019t have access")),r.createElement("li",null,rB.t("They have a different appearance than a standard message")))));case e6.oW.AddPin:return r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},rB.t('To use this step, the workflow must contain a "Send a message to a channel" step.'));case e6.oW.FindRecordChannel:case e6.oW.CreateRecordChannel:case e6.oW.SendToRecordChannel:return r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},rB.t("To use this step, the workflow must start with the Salesforce \u201CWhen a record changes\u201D action."));case e6.oW.SendSummaryToMySalesHome:case e6.oW.SendSummaryToSalesHome:return r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},rB.t("To use this step, the workflow must start with one of the Salesforce \u201COn a schedule\u201D triggers."));case e6.oW.SendToSalesforceApp:return r.createElement(u.Ay,{level:u.A_.info,className:"margin_bottom_50"},I?rB.t("All Send to Salesforce App and Send to Sales Home steps in this workflow must have the same recipient."):"All Send to Salesforce App and Send to Sales Home steps in this workflow must have the same recipient.");default:return null}};renderStepHint.displayName="renderStepHint";let renderFormInputs=()=>{let{AddPin:e}=e6.oW;return f===e?r.createElement(PinMessageFormStep,{inputParameters:V,configuredParameters:L,segmentVariables:b,onChange:F}):r.createElement(aj.v,{functionId:v,inputParameters:V,oAuthParameter:P,variables:b,configuredParameters:L,onChange:F,formatVariableBeforeInsert:H,callbackId:f,applySpecialTreatment:q,renderOAuth2InputParameter:R,stepId:m.id,isExistingStep:a,functionVariables:_,isOAuthTokenInvalid:l,isFunctionFormWrapped:y,onlyRenderParentInputs:B,onlyRenderChildInputs:W,onLoadingStateChange:D,allowVariables:s})};renderFormInputs.displayName="renderFormInputs";let renderMore=()=>{let{SendSummaryToSalesHome:e,SendSummaryToMySalesHome:t}=e6.oW;switch(f){case t:case e:return r.createElement(rD.P,{configuredParameters:L,workflowId:h,isStepPreview:!0});default:return null}};renderMore.displayName="renderMore";let maybeRenderPrivateChannelAlert=()=>g&&g.trigger?.subtype===ar.$.MessagePosted?r.createElement(StepPrivateChannelMessageAlert,{workflow:g,segment:m}):null;return(maybeRenderPrivateChannelAlert.displayName="maybeRenderPrivateChannelAlert",f===e6.oW.OpenForm)?r.createElement(aG,{afterStepId:t,segmentVariables:b,state:e,switchPane:n,isExistingStep:a,activePane:i}):T&&f===e6.oW.AskAgentforce?r.createElement(AskAgentforceStep,{functionId:v,inputParameters:V,variables:b,configuredParameters:L,oAuthParameter:P,onChange:F,formatVariableBeforeInsert:H,callbackId:f,stepId:m.id,isExistingStep:a,functionVariables:_,isFunctionFormWrapped:y,onLoadingStateChange:D,segment:m,allowVariables:!0}):r.createElement(aF.$,{noSubmit:!0,segment:m,noPadding:o},maybeRenderPrivateChannelAlert(),renderStepHint(),renderFormInputs(),renderMore())};SlackFunctionSegmentForm.displayName="SlackFunctionSegmentForm";let rW=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-switch").then(a.bind(a,0x17e17a79)));var rV=a(0x36e8c71e);let rH=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-third-party-event").then(a.bind(a,0x95fbf008))),rq=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-hermes-scheduled").then(a.bind(a,0x11fdd0746))),rU=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-hermes-webhook").then(a.bind(a,0x1b368318d))),rz=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-hermes-webhook").then(a.bind(a,0x1b3e4b87c))),rj=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-shortcut").then(a.bind(a,0x5b41ec0e))),rG=(0,r.lazy)(()=>a.e("workflow-builder-segment-form-slack-event").then(a.bind(a,0x23f302479)));function getSegmentForm({state:e,switchPane:t,afterStepId:a,isExistingSegment:n,isOAuthTokenInvalid:l,activePane:i=tg.k.DEFAULT}){let o=e?.segment;switch(o?.type){case rs.SJ:return r.createElement(rH,{state:e});case rs.kr:return r.createElement(rG,{state:e});case rs.zW:return r.createElement(rj,{state:e});case rs.bX:return r.createElement(rU,{state:e});case rs.LO:return r.createElement(rq,{state:e});case rs.YV:return r.createElement(rz,{state:e,isOAuthTokenInvalid:l});case rV.SLACK_FUNCTION:return r.createElement(SlackFunctionSegmentForm,{state:e,afterStepId:a,isExistingStep:n,switchPane:t,isOAuthTokenInvalid:l,activePane:i});case rV.SWITCH:return r.createElement(rW,{state:e,isExistingStep:!!n,afterStepId:a});case rV.LOOP:return r.createElement(aN,{state:e,isExistingStep:!!n,afterStepId:a});default:return null}}getSegmentForm.displayName="getSegmentForm";var r$=a(0x177a179f2),rK=a(0x52fc4a0c),rY=a(0x24e22e0a6),rQ=a(0x136bd1488),rZ=a(0x15f4f83cf),rJ=a(0x2a3fb7ec),rX=a(0x16ed1b0dc),r0=a(0x4363d33f),r1=a(0x17c7b6bbb);let isTriggerPreviewSegment=e=>"TRIGGER_ID_PLACE_HOLDER"===e.id&&Object.values(r1.vh).some(t=>t===e.type);var r2=a(0x126492ec6),r4=a(0x157b4a886),r8=a(0x20cfa1dc2),r5=a(0x14e3cd22c),r6=a.n(r5);let r3=new c.Ay("workflow_builder"),SegmentFormModal=({title:e,icon:t,onSave:a,onClose:n,saving:i,saveError:c,renderSaveError:d,segment:m,submitLabel:p=null,cancelLabel:b=null,afterStepId:f="",isExistingSegment:g=!1,isAuthTokenModified:_=!1,isSegmentModified:y=!1,isTrigger:x=!1,currentSegmentState:v,segmentReducer:E,speedBumpContext:k,baseAutoClogProps:w,switchPane:S,activePane:T,onNavigateBack:L})=>{let O=(0,nR.A)(),F=(0,e2.j)(),{showSpeedBump:D}=(0,ae.k)(),P=(0,l.wA)(),R=(0,e8.DY)(F),B=m?.type,W=(0,tj.u)(),V=(0,t$.GS)(m),H=V?(0,e5.Dl)(m):void 0,q=(0,t$.GS)(v)?(0,e5.UX)(v):void 0,U=(0,t$.GS)(v)?(0,e5.B8)(v):void 0,z=(0,t$.GS)(v)?(0,e5.am)(v):void 0,j=(0,t$.GS)(v)?(0,e5.ln)(v):void 0,G=x&&(0,rY.Z)(m),$=G?(0,rK.ln)(m):void 0,K=(j||$)?.find(e=>(0,eQ.t)(e)),Y="on"===(0,M.d4)(e=>(0,tn._Z)(e,"wfb_open_form_ui_improvements")),Q=(0,M.d4)(N.$T),Z=Q&&(0,t$.GS)(v)&&v.config.isDataFetching,J=(0,r.useMemo)(()=>(0,t$.YN)({segment:v}),[v]),X=(0,e8.zF)(m),ee=!!F&&(0,e8.a6)(F),et=(0,r.useMemo)(()=>{if(F)return(0,e8.eR)(F)},[F]),ea=x&&!!et,en=x&&(0,rQ.s)(m)&&m.config.event?.eventType===ar.$.MessagePosted,er=x&&B===rs.SJ,el=!!F?.workflow&&(0,aa.T0)(F.workflow),ei=(0,r.useMemo)(()=>(0,ty.q2)(v),[v]),eo=!!V&&m.config.is_pristine,es=(0,M.d4)(e=>(0,ng.tx)(e,m)),ec=(0,M.d4)(ng.N),{priorityErrorCode:ed,priorityErrorMessage:eu,errorCodeCount:em}=(0,r.useMemo)(()=>{if(isTriggerPreviewSegment(m)&&(0,rQ.s)(m)&&m.config.event?.eventType===ar.$.ReactionAdded&&!(m.config.event?.channelIds&&m.config.event?.channelIds.length>0&&m.config.event?.channelIds.every(rX.A)))return{priorityErrorCode:ad.Lj};if(es)return{priorityErrorCode:ad.aU};let e=(0,e8.rM)(F,m.id),t=(0,a0.jS)(e),a=(0,a0.nh)(F,m,t),n=e.filter(e=>e.code===t).length;return{priorityErrorCode:t,priorityErrorMessage:a,errorCodeCount:n}},[es,m,F]),ep=!!ed,eb=(0,rY.Z)(v)&&x?v.config.service:void 0,{isFunctionFormWrappable:ef=!1,isFunctionFormWrapped:eg=!1,inputs:eh,function_id:e_="",selectedSlackFunction:ey,isAddOrRemoveFormStep:ex=!1}=(0,t$.GS)(v)&&v.config||{},ev=(0,M.d4)(e=>ef?(0,t5.hj)(e,tb.QF):void 0),eE=(0,t$.GS)(m)?m.config?.slackFunction?.callback_id:e,ek=(0,r.useMemo)(()=>(ed===r8.oh.INVALID_EXTERNAL_TOKEN_IDS||ed===r8.oh.INVALID_SERVICE_TRIGGER_EXTERNAL_TOKEN_IDS)&&_,[_,ed]),ew=!eo&&!ek,eS=(0,rJ.X)(r8.Qr,ed)?u.A_.warning:u.A_.error;el&&eo?(ew=ep,eS=u.A_.info):isTriggerPreviewSegment(m)&&(0,rQ.s)(m)&&(ew=ep,eS=u.A_.info);let[eC,eA]=E,{speedBumpState:eT,closeSpeedBump:eI,openSpeedBump:eN}=k;(0,r.useEffect)(()=>{D(eT.isVisible??!1)},[eT.isVisible,D]);let[eM,eL]=(0,r.useState)(!1),[,eO]=(0,r.useState)("0"),{onSubmit:eF,shouldEnableSaveForInitialSubmit:eD,hasBlockingError:eP}=(0,I.b)(eO),{isValid:eR=!1,hasValidValues:eB=!1,questionsAreValid:eW,hasValidParentInputValues:eV}=eC.computed,eH=r3.t("Are you sure you want to change how this workflow starts? These changes will go live immediately."),eq=(0,r.useCallback)(()=>{(0,aE.ft)({clogger:O,wbArgs:{workflow_id:R,is_hermes:!0}}),a()},[O,a,R]),eU=(0,r.useCallback)(()=>{!eR||eD||i||(x&&ee?eN({message:"",onCancel:eI,onContinue:()=>eq(),cancelButtonLabel:r3.t("Cancel"),continueButtonLabel:r3.t("Save Changes",{ns:"developer_app_settings"}),heading:r.createElement("div",{className:"padding_bottom_125"},eH)}):a()),eD&&eF(),P((0,r2.br)({workflowId:R}))},[eR,eD,i,P,R,x,ee,eN,eI,eH,eq,a,eF]),ez=(0,r.useCallback)(e=>{e.preventDefault(),eU()},[eU]),ej=m?.type===rs.SJ,eG=(0,r.useMemo)(()=>r.createElement("div",{className:o()(r6().segment_form_fallback,{[r6().trigger_fallback]:x})},r.createElement(as.O,null,r.createElement(ao.o,null))),[x]),e$=(0,nG.fx)({segment:eC.segment},{},P),eK=(0,nG.r)({segment:eC.segment,isExcludesFromSpecificUsersFilterChecked:ec},{},P),eY=B===rV.SLACK_FUNCTION&&(0,e8.uG)(F,m.config?.slackFunction?.app_id??""),eZ=y||!g,eJ=!i&&!eY&&!eP&&!e$,{navigateToParentInputsModal:eX,navigateToFormConfiguration:e0,is3PUFConfigModal:e1,isParentModal:e4,isChildModal:e6}=useSegmentPaneNavigation({segment:v,switchPane:S,activePane:T}),e3=ei&&q?q.input_parameters:j,e7=e3?.some(e=>(0,tX.oO)(e)),e9=ei&&eg&&T===tg.k.DEFAULT,te=!!ey,tt=eJ&&(eB||e1&&eW||e4&&eV)||e9&&te,ta=e9?tt:eD||tt,tr=eJ&&eZ&&eR,tl=(!en||eK)&&(!er||eR)&&(eD||tr),ti=!i,to=!i,ts=K?.oauth2_provider_key&&(0,t3.A)(K.oauth2_provider_key)?K.oauth2_provider_key:"",tc=(0,M.d4)(e=>{let t=G?eb?.function.id:e_;if(t)return(0,r4.JG)(e,{functionId:t,providerKey:ts})}),td=tc&&tc?.validTokens,tu=((0,t$.GS)(v)?(0,r$.FE)(v):void 0)??eh,tm=(0,r.useMemo)(()=>{let e={};return K?tu&&tu[K.name]?tu[K.name].value:G&&eb?.inputs&&eb.inputs[K.name]?eb.inputs[K.name]?.value:e:e},[G,K,tu,eb]),tp=(0,r.useMemo)(()=>{if(!K)return!1;let e=!!td?.length,t=(0,at.L)(tm)&&!(0,al.$)(tm),a=ed===r8.oh.INVALID_EXTERNAL_TOKEN_IDS||ed===r8.oh.INVALID_SERVICE_TRIGGER_EXTERNAL_TOKEN_IDS;return!t||a&&!e},[tm,K,td?.length,ed]),tf=Q?e4||e1||e9:ef&&eg&&!ei,th=e6||e1,tx=!!L,tv=(0,r.useMemo)(()=>(!e6||!!eg||!!e7)&&(!e1||!!e7)&&th,[th,e1,e6,eg,e7]),tE=(0,r.useCallback)(()=>{(eD&&!e9&&eF(),!Q&&tt)?S(tg.k.FORM_WRAPPED_INPUTS):Q&&tt&&(e1?q&&(eA((0,tG.nk)({wrappedFunction:q,experimentThirdPartyUserFormParityGroupOn:Q})),S(tg.k.CHILD_INPUTS)):eg&&(!Q||e4)?(0,rZ.GU)(ev)||(eA((0,tG.JB)({openFormSlackFunction:ev})),S(tg.k.THIRD_PARTY_USER_FORM_CONFIG)):e9?ey&&P((0,r0.k)({stepType:{type:rV.SLACK_FUNCTION,subtype:ey.id},workflow:F,afterStepId:f,slackFunction:ey,isFormWrapped:!0})):Q&&(U&&(eA((0,tG.ix)({})),eA((0,tG.XZ)({}))),S(tg.k.CHILD_INPUTS)))},[eD,e9,Q,tt,eF,S,e1,eg,e4,q,eA,ev,ey,P,F,f,U]),tk=(0,r.useMemo)(()=>H&&g&&e6&&ef&&!eg&&!Z&&!ex,[H,g,e6,ef,eg,Z,ex]),tw=(0,r.useMemo)(()=>H&&g&&e6&&eg&&!Z&&!ex,[H,g,e6,eg,Z,ex]),tC=(0,r.useCallback)(()=>eL(!eM),[eM,eL]),tA=(0,r.useMemo)(()=>e9?r3.t("Set Up"):r3.t("Next"),[e9]),tT=(0,r.useMemo)(()=>({...w,action:tK.UiAction.SAVE,onClick:{enableClogAction:tr}}),[w,tr]),tI=(0,r.useMemo)(()=>({...w,action:tK.UiAction.NEXT,onClick:{enableClogAction:tr}}),[w,tr]),tN=(0,r.useMemo)(()=>({...w,action:tK.UiAction.CLICK,elementName:aE.KC.Back,onClick:{enableClogAction:ti}}),[w,ti]),tM=(0,r.useMemo)(()=>({...w,action:tK.UiAction.CLICK,elementName:aE.KC.Cancel,onClick:{enableClogAction:to}}),[w,to]),tL="",tO=[];(0,ty.q2)(v)&&(tL=v.config.inputs.title.value,tO=(0,t_.yS)(v));let tF=!tL||0===tO.length,tD=(0,r.useCallback)(()=>{e6&&eg?e0():eX()},[e6,eg,e0,eX]),tP=(0,r.useCallback)(()=>tv?tD():L?.(),[tD,L,tv]),tR=(0,r.useCallback)(()=>{D(!1),eT.onCancel()},[D,eT]),tW=(0,r.useCallback)(()=>{n(),D(!0)},[n,D]),tV=(0,r.useCallback)(()=>{(0,rZ.GU)(ev)||(eA((0,A.TI)({isFunctionFormWrapped:!0,experimentThirdPartyUserFormParityGroupOn:Q})),eA((0,tG.JB)({openFormSlackFunction:ev})),eA((0,A.ST)({isAddOrRemoveFormStep:!0})),eI(),S(tg.k.FORM_LOADING_SCREEN,{heading:r3.t("Create form"),redirectPane:tg.k.THIRD_PARTY_USER_FORM_CONFIG}))},[eI,eA,Q,ev,S]),tH=(0,r.useCallback)(()=>{eN({heading:r3.t("Add a form for this step?"),message:r3.t("We\u2019ll create a form for this step using the info you\u2019ve already set up."),continueButtonLabel:r3.t("Add Form"),continueButtonType:t7.QE.primary,cancelButtonLabel:r3.t("Cancel"),onContinue:tV,onCancel:eI})},[eI,tV,eN]),tq=(0,r.useCallback)(()=>{q&&(eA((0,A.TI)({isFunctionFormWrapped:!1,experimentThirdPartyUserFormParityGroupOn:Q})),eA((0,tG.nk)({wrappedFunction:q})),eA((0,A.ST)({isAddOrRemoveFormStep:!0})),eA((0,tG.ix)({})),eA((0,tG.XZ)({})),eI(),S(tg.k.FORM_LOADING_SCREEN,{heading:r3.t("Remove form"),redirectPane:tg.k.CHILD_INPUTS}))},[eI,eA,Q,S,q]),tU=(0,r.useCallback)(()=>{eN({heading:r3.t("Are you sure you want to remove this form?"),message:r3.rt("The form will be removed from this step. Your {appName} step will remain.",{appName:q?.title}),continueButtonLabel:r3.t("Remove Form"),continueButtonType:t7.QE.danger,cancelButtonLabel:r3.t("Cancel"),onContinue:tq,onCancel:eI})},[eI,tq,eN,q?.title]),tz=(0,r.useCallback)(()=>r.createElement(tS.ty,{heading:eT.heading,cancelButtonLabel:eT.cancelButtonLabel,continueButtonLabel:eT.continueButtonLabel,continueButtonIsDisabled:eT.continueButtonIsDisabled,continueButtonIsLoading:i,continueButtonType:eT.continueButtonType,onCancel:tR,onContinue:eT.onContinue,description:eT.message}),[tR,i,eT.cancelButtonLabel,eT.continueButtonIsDisabled,eT.continueButtonLabel,eT.continueButtonType,eT.heading,eT.message,eT.onContinue]);if(eM)return r.createElement(an.V,{formTitle:tL,formQuestions:tO,toggleShowFullPreview:tC,onClose:n});let tY=Q&&tv,tQ=th||tf,renderModal=()=>r.createElement(r.Fragment,null,r.createElement(tS.rQ,null,tx&&r.createElement(ai.E,{workflowId:R,onNavigateBack:tP,isSegmentModal:!0}),r.createElement(tS.Rc,{"data-qa":"segment-form-header",title:e,icon:t})),r.createElement(tS.$m,{className:o()({[r6().modal_content_height]:e4})},r.createElement(C.N6.Provider,{value:ez},c&&d&&r.createElement(tS.qf,{className:r6().error_banner},r.createElement(tB.A,{className:r6().topIconAlert},d(c))),tY&&(0,t$.GS)(v)&&r.createElement(tS.qf,{className:r6().navigation_border},r.createElement(SegmentPaneNavigation,{inputParameters:e3,segment:v,switchPane:S,baseAutoClogProps:w,hasValidParentInputValues:eV,activePane:T})),ew&&ep?r.createElement(tS.qf,{className:r6().error_banner},r.createElement(u.Ay,{"data-qa":"segment-form-modal-alert-api-error",type:u.QE.inline,level:eS,align:u.AO.left},r.createElement("span",null,r.createElement(ac.Z,{errorCode:ed,errorMessage:eu,errorCount:em,slackFunction:H,viewContext:ac._.MODAL})))):null,r.createElement(r.Suspense,{fallback:eG},getSegmentForm({state:eC,afterStepId:f,isExistingSegment:g,switchPane:S,isOAuthTokenInvalid:tp,activePane:T})))),r.createElement(tS.jl,{className:o()({[r6().formV2Footer]:ej,padding_top_100:tk||tw}),isAdaptive:tk||tw,renderSpeedBump:tz},ei&&(!Q||!eg)&&(Y?r.createElement(t9.A,{onClick:tC,disabled:tF},r3.t("Preview form")):r.createElement(h.Ay,{type:"outline",onClick:tC},r3.t("Preview Form"))),r.createElement(tS.ox,{className:o()({full_width:tk||tQ||tw,[r6().modal_footer_form_generator]:tk||tw,[r6().modal_footer_actions]:ea})},tk&&r.createElement("div",{className:"margin_bottom_150 margin_right_0 padding_0"},r.createElement(u.Ay,{level:u.A_.info,align:u.AO.left,type:u.QE.boxed,isIconVisible:!1},r.createElement("div",{className:"display_flex align_items_center gap_100"},r.createElement("div",null,r.createElement("strong",null,r3.t("Add a form for this step")),r.createElement("div",null,r3.t("Skip the manual form set up \u2014 let us create a form using this step\u2019s data for you."))),r.createElement(h.Ay,{type:"outline",size:"small",className:"padding_left_150 padding_right_150",onClick:tH},r3.t("Add Form"))))),tw&&r.createElement("div",{className:"margin_bottom_150 margin_right_0 padding_0"},r.createElement(u.Ay,{level:u.A_.default,align:u.AO.left,type:u.QE.boxed,isIconVisible:!1},r.createElement("div",{className:"display_flex align_items_center gap_100"},r.createElement("div",null,r.createElement("strong",null,r3.t("Remove form from step")),r.createElement("div",null,r3.t("We\u2019ll remove this form, and you can set one up manually if needed."))),r.createElement(h.Ay,{type:"outline",size:"small",className:"padding_left_150 padding_right_150",onClick:tU},r3.t("Remove Form"))))),ea&&r.createElement(ChangeTriggerButton,{disabled:i}),r.createElement("div",{className:"display_flex justify_content_end gap_75"},r.createElement(h.Ay,{type:"outline",onClick:tW,disabled:!to,"data-qa":"segment-form-modal-cancel__button",autoClogProps:tM,className:o()({margin_right_auto:tQ})},b??r3.t("Cancel")),tv&&r.createElement(h.Ay,{type:"outline",onClick:tD,disabled:!ti,"data-qa":"form-wrapped-inputs-back__button",autoClogProps:tN},r3.t("Back")),tf?r.createElement(h.lV,{loading:Z||J||z?.isLoading||i,onClick:tE,disabled:!ta,"data-qa":"segment-form-modal-next__button",autoClogProps:tI,"aria-label":tA},tA):!W&&r.createElement(h.lV,{loading:i,onClick:eU,disabled:!tl,"data-qa":"segment-form-modal-submit__button",autoClogProps:tT,"aria-label":p||r3.t("Save")},p||r3.t("Save"))))));return X&&ep?r.createElement(s.A,{eventId:tK.EventId.WORKFLOW_CONNECTOR_STEPS_ERROR,clogImpression:!0,uiStep:tK.UiStep.WORKFLOW_EDITOR,elementName:aE.KC.EditStep,displayName:eE,workflowBuilderWorkflowId:(0,e8.DY)(F)},renderModal()):renderModal()};SegmentFormModal.displayName="SegmentFormModal";var r7=a(0x3793f9af),r9=a(0xd2ef9f49),le=a(0x23a9df45f),lt=a(0x11c82607b);let la=(0,lt.Ay)("Fetch and upsert members using user IDs in rich text blocks",async(e,t,{blocks:a})=>{let n=[];a.forEach(e=>{e.elements.forEach(e=>{(0,r9.B)(e)&&e.elements.forEach(e=>{(0,le.H1)(e)&&n.push(e.user_id)})})}),n.length>0&&await e((0,r7.Y)({ids:n}))});la.meta={name:"fetchAndUpsertMembersFromRichTextBlocks",key:"createThunkFetchAndUpsertMembersFromRichTextBlocks",description:"Fetch and upsert members using user IDs in rich text blocks"};var ln=a(0x11e2b5969),lr=a(0x80759cc4);let ll=(0,lt.Ay)("Fetch and upsert user groups using user group IDs in rich text blocks",async(e,t,{blocks:a})=>{let n=[];a.forEach(e=>{e.elements.forEach(e=>{(0,r9.B)(e)&&e.elements.forEach(e=>{(0,lr.GH)(e)&&n.push(e.usergroup_id)})})}),n.length>0&&await e((0,ln.WU)({ids:n,reason:"fetchAndUpsertUserGroupsFromRichTextBlocks"}))});function useSegmentFormInitializer({isOpenForm:e,segment:t}){let a=(0,l.wA)();(0,U.A)(()=>{e&&(0,t$.GS)(t)&&(0,t_.yS)(t).forEach(e=>{let{options:t,questionType:n}=e;(0,ta.OW)(n)&&t&&t.length>0&&t.forEach(e=>{if((0,$.X)(e)){let t=Object.values(e.value);a(la({blocks:t})),a(ll({blocks:t}))}})})})}ll.meta={name:"fetchAndUpsertUserGroupsFromRichTextBlocks",key:"createThunkFetchAndUpsertUserGroupsFromRichTextBlocks",description:"Fetch and upsert user groups using user group IDs in rich text blocks"};let excludeFieldsForComparison=e=>{let{slackFunction:t,isFunctionFormWrapped:a}=e.config;return a?e:{...e,config:{...e.config,slackFunction:{...t,input_parameters:t?.input_parameters?.map(e=>{let{properties:t,...a}=e;return a})??[]}}}};var li=a(0x21453d73b),lo=a(0x1fbc3c543),ls=a(0x30d8960c),lc=a(0x4a312a6e),ld=a(0x1d95c2b6f),lu=a(0x22f6a086f);let lm="20",useTriggerDisplayContent=()=>{let e=(0,M.d4)(lu.cw);return(0,r.useCallback)((t,a={iconSize:lm})=>{let n;if(!t||t.type===rV.SLACK_FUNCTION)return{label:"",icon:""};let l=a.iconSize,i={...t,type:(0,ld.IE)(t.type)};switch(i.type){case r1.vh.Event:n=e.find(e=>e.type===i.type&&e.subtype===i.config.event?.eventType);break;case r1.vh.Service:n=e.find(e=>e.type===i.type&&e.subtype===i.config.service?.trigger_type_ref),l="40";break;case r1.vh.External:n=e.find(e=>e.type===i.type&&e.subtype===i.config.subtype),l="40";break;default:n=e.find(e=>e.type===i.type)}return{label:n?.label||"",icon:"string"==typeof n?.icon?r.createElement(lc.Jx,{name:n.icon||n.appId,iconSize:l,type:n.type}):n?.icon||""}},[e])};useTriggerDisplayContent.displayName="useTriggerDisplayContent";var lp=a(0x1c27a9e4a),lb=a(0xfcd3ead1),lf=a(0x18608b0ec),lg=a(0x1f265cc5b),lh=a(0x3fe57881),l_=a(0xa6e1b10c),ly=a(0x44c1a824),lx=a(0x38e951e5),lv=a(0xf48b1168);function getSegmentReducer(e,t,a){switch(e.type){case rs.zW:return lx.bg;case rs.SJ:return lg.g6;case rs.bX:return l_.iI;case rs.LO:return lh.en;case rs.kr:return lv.rL;case rs.YV:return ly.O;case rV.SLACK_FUNCTION:return a!==e6.oW.OpenForm||(0,ty.Pv)(e)?tG.Qx:(0,A.$m)(t);case rV.SWITCH:return lf.gA;case rV.LOOP:return lb.Jw;default:throw Error("No Reducer Found - get-segment-reducer.ts")}}var lE=a(0x8fb98cae);let useSegmentReducer=(e,t)=>(0,r.useReducer)(e,t,e.initialize),ValidationProvider=({children:e,computed:t})=>{let a=!!t&&(0,r.useMemo)(()=>t,[...Object.values(t)])||{};return r.createElement(C.cR.Provider,{value:a},e)};ValidationProvider.displayName="ValidationProvider";var lk=a(0x130d89881);let lw={width:"100%"},FillParentContainer=({children:e,className:t="",...a})=>r.createElement(lk.A,{style:lw},({height:n,width:l})=>r.createElement("div",{...a,className:t,style:{width:l?`${l}px`:"100%",height:n?`${n}px`:"100%","--container-content-height":`${n}px`,"--container-content-width":`${l}px`}},e));FillParentContainer.displayName="FillParentContainer";var lS=a(0x647f4f35),lC=a(0x203b19061);let CustomPromptInput=e=>{let{variables:t,callbackId:a}=e,n=(0,lC.A)({variables:t,callbackId:a,isTriggerSegment:!1})??t,l=(0,M.d4)(N.EY),{aiStepPrivateChannelAccess:i,aiStepPrivateChannelTeamIds:o}=(0,lS.k)({callbackId:a});return r.createElement(rc.h,{value:e.value,callbackId:a,stepId:e.stepId,parameter:e.parameter,variables:n,allowVariables:e.allowVariables,required:e.required,onChange:e.onChange,formatVariableBeforeInsert:e.formatVariableBeforeInsert,parameters:e.parameters,configuredParameters:e.configuredParameters,hideLabel:e.hideLabel,subtext:e.subtext,labelClassName:e.labelClassName,isParameterSyncedWithForm:e.isParameterSyncedWithForm,sendAsUserValue:e.sendAsUserValue,experimentUserAuthoredWorkflowPostsFeGroupOn:e.experimentUserAuthoredWorkflowPostsFeGroupOn,experimentWfbAiAnswerStepGroupOn:e.experimentWfbAiAnswerStepGroupOn,wfbAiPromptButtons:e.wfbAiPromptButtons,excludePrivateChannelAutocomplete:l?!1===i:void 0,privateChannelTeamIds:l?o:void 0})};CustomPromptInput.displayName="CustomPromptInput";var lA=a(0x2281fc25),lT=a(0x1fcbb004d),lI=a(0x186093629),lN=a.n(lI);let lM=new c.Ay("workflow_builder"),AiPromptEditorModal=e=>{let{parameter:t,onChange:a,variables:n,formatVariableBeforeInsert:i,parameters:o,configuredParameters:s,callbackId:c,experimentWfbAiAnswerStepGroupOn:d,onClose:u,workflowId:m,segment:p}=e,b=(0,l.wA)(),f=(0,nR.A)(),[h,_]=(0,r.useState)(s?.[lA.c.PROMPT]?.value||g.Ml),y=(0,r.useCallback)(()=>{(0,aE.ft)({clogger:f,uiArgs:{step:tK.UiStep.WORKFLOWS_AI_STEP_PROMPT_EDITOR_MODAL},wbArgs:{workflow_id:m,is_hermes:!0}}),b((0,lT.O)())},[b,f,m]),x=(0,r.useCallback)(()=>{u?.(),y()},[y,u]),v=(0,r.useCallback)((e,t)=>{_(t),a(e,t)},[a]),E=(0,r.useMemo)(()=>d?lM.t("Custom Prompt"):"Custom Prompt",[d]),k=(0,r.useMemo)(()=>({segment:p,onExpandCollapsePromptClick:x,isPromptExpanded:!0,insertVariableButton:null,enablePromptToolsButton:!0}),[p,x]);return r.createElement(t0.v,{contentLabel:E,modalClassName:lN().promptEditorModal,centered:!0,shouldCloseOnOverlayClick:!0,maxWidth:1e3,fullscreen:!0,onClose:u,overlayClassName:lN().promptEditorModalOverlay},r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:E})),r.createElement("div",{className:lN().promptEditorModalContent},r.createElement("div",{className:lN().textyInputContainer},r.createElement(CustomPromptInput,{parameter:t,value:h,onChange:v,variables:n,formatVariableBeforeInsert:i,labelClassName:lN().promptLabel,parameters:o,configuredParameters:s,callbackId:c,allowVariables:!0,experimentWfbAiAnswerStepGroupOn:d,hideLabel:!0,wfbAiPromptButtons:k}))),r.createElement(tS.jl,null,r.createElement(tS.ox,null,r.createElement(tS.s_,{onClick:x,type:"outline","aria-label":lM.t("Close")},lM.t("Close")))))};AiPromptEditorModal.displayName="AiPromptEditorModal";var lL=a(0x20b4dda68),lO=a(0x62a17882),lF=a(0x133dc8e0d),lD=a.n(lF);let AiStepLoadingAnimation=({lineCount:e=3,className:t})=>r.createElement("div",{className:`${lD().response_loading} ${t}`},Array.from({length:e}).map((e,t)=>r.createElement("div",{className:lD().loader_container,key:t},r.createElement(eR.A,{width:"100%",height:12,borderRadius:16}))));AiStepLoadingAnimation.displayName="AiStepLoadingAnimation";var lP=a(0xe874a88a),lR=a(0x22a29f141),lB=a(0x1dfdeb1c8),lW=a(0xe747dd27);let lV=(0,lB.A)("functions.workflows.steps.aiFilePrecheck generated fetcher",(e,t,a)=>new lP.S((n,r)=>{let{abortSignal:l,reason:i,...o}=a,s=(0,lW.VA)(o);e((0,lR.apiCall)({method:"functions.workflows.steps.aiFilePrecheck",args:s,abortSignal:l,reason:i})).then(e=>{n(e)}).catch(e=>{(0,aB.default)({getState:t}).error(`API call to functions.workflows.steps.aiFilePrecheck
						with reason ${i} failed, initiated by generated fetcher`),r(e)})}));lV.meta={name:"functionsWorkflowsStepsAiFilePrecheckFetcher",key:"createFetcherFunctionsWorkflowsStepsAiFilePrecheckFetcher",description:"functions.workflows.steps.aiFilePrecheck generated fetcher"};let lH=new c.Ay("workflow_builder"),lq=(0,aB.default)({label:aW.y}),checkAiFileUploadPermitted=async(e,t,a)=>{try{let n=await e(lV({mimetype:t.type,fileSize:t.size,reason:"ai-step-file-upload-pre-check"}));if(!n.ok||n.is_permitted)return null;if(!n.is_mimetype_supported)return{id:`unsupported_type_${t.name}`,message:a?lH.t('The file type "{filetype}" is not supported. Supported types: {supportedTypes}',{filetype:t.type||"unknown",supportedTypes:n.supported_mimetypes.join(", ")}):`The file type "${t.type||"unknown"}" is not supported. Supported types: ${n.supported_mimetypes.join(", ")}`};let r=Math.round(n.size_limit/1048576);return{id:`too_large_${t.name}`,message:a?lH.t('The file "{filename}" exceeds the {sizeLimitMB} MB size limit for its file type.',{filename:t.name,sizeLimitMB:String(r)}):`The file "${t.name}" exceeds the ${r} MB size limit for its file type.`}}catch(e){return lq.error(Error(`AI file upload pre-check failed: ${e}`)),null}};var lU=a(0x11cab3cb4),lz=a(0x18785321b),lj=a(0x1a2b0bc8d),lG=a(0xddc78dc5),l$=a(0x2278818de),lK=a(0x22809c249),lY=a(0x1c2e38de1),lQ=a(0x3143105f),lZ=a(0x113ec6ce5);let lJ=new c.Ay("workflow_builder"),TestFileUpload=({value:e,parameter:t,callbackId:a,onChange:n})=>{let i=(0,l.wA)(),o=(0,r.useRef)(null),s=(0,M.d4)(N.dI),c="maxItems"in t&&t.maxItems||e9.$,d=e9.e,u=(0,M.d4)(lY.p),m=u===lY.v.DISABLE_ALL,p=u===lY.v.IMAGES_ONLY,[b,f]=(0,r.useState)([]),[g,_]=(0,r.useState)([]),[y,x]=(0,r.useState)(m?[{id:"disable_all_error",message:s?lJ.t("File uploads to this workspace have been disabled at the request of your administrator."):"File uploads to this workspace have been disabled at the request of your administrator."}]:[]),[v,E]=(0,r.useState)(!1),k=(0,M.d4)(lj.$),w=(0,r.useMemo)(()=>{let e=[...b,...g];return k.filter(t=>e.includes(t.id))},[k,b,g]),S=(0,r.useCallback)(e=>{_(t=>[...t,e.id])},[]),C=(0,r.useCallback)(a=>{_(e=>e.filter(e=>e!==a.id)),f(r=>{let l=[...r,a.id],i=[];e&&(i=Array.isArray(e)?e:[e]);let o=[...new Set([...i,...l])];return n(t,1===c?o[0]:o),l})},[n,t,e,c]),A=(0,r.useCallback)(a=>{f(r=>{let l=r.filter(e=>e!==a.id),i=[];e&&(i=Array.isArray(e)?e:[e]);let o=[...new Set([...i,...l])].filter(e=>e!==a.id);return n(t,1===c?o[0]||void 0:o),l})},[n,t,e,c]),T=(0,r.useCallback)(e=>{_(t=>t.filter(t=>t!==e.id))},[]),I=(0,r.useCallback)(e=>{let t={id:e.id,message:s?lJ.t("There was a problem uploading the file {filename}. Please try again in a few minutes.",{filename:e.name}):`There was a problem uploading the file ${e.name}. Please try again in a few minutes.`};x(e=>[t,...e])},[s]),L=(0,r.useCallback)(async e=>{x([]);let t=(0,l$.l)({filesToUpload:e,existingFiles:w,maxFiles:c,maxFileSizeBytes:d});if(t)return void x([t]);if(s&&a===e6.oW.AiAnswer){E(!0);try{let t=(await Promise.all(e.map(e=>checkAiFileUploadPermitted(i,e,s)))).filter(e=>null!==e);if(t.length>0)return void x(t)}finally{E(!1)}}i((0,lZ.Z)({filesToUpload:e,onFilePending:S,onFileUploaded:C,onPendingFileRemoved:T,onUploadError:I}))},[a,i,s,w,c,d,S,C,T,I]),O=(0,r.useCallback)(e=>{e.length>0&&L(e)},[L]),F=(0,r.useCallback)(()=>{o.current&&o.current.click()},[]),D=(0,r.useCallback)((e,t)=>{1===w.length&&x([]),i((0,lQ.n)({file:t,onFileRemoved:A,onPendingFileRemoved:T}))},[i,w.length,A,T]),P=s?lJ.t("Add another file"):"Add another file",R=s?lJ.t("Upload file"):"Upload file",B=s?lJ.t("Checking file\u2026"):"Checking file...",W=(0,r.useMemo)(()=>v?B:w.length>0?P:R,[v,B,w.length,P,R]);return r.createElement("div",null,w.length>0&&r.createElement(lU.F,{files:w,onRemoveFile:D}),r.createElement(lz.M,{errors:y}),r.createElement(h.Ay,{onClick:F,disabled:m||v,type:"outline"},W),r.createElement(lK.A,{ref:o,multiple:c>1,onFilesSelectedHandler:O,...(0,lG.y)({filetypes:void 0,isUploadImageOnly:p,isUploadDisabled:m})}))};function isFormFieldDropdown(e){return"slack#/types/limited_rich_text"===e.type&&"choices"in e&&Array.isArray(e.choices)&&e.choices.length>0}function normalizeDropdownParameter(e){return isFormFieldDropdown(e)?{...e,choices:e.choices.map(e=>({...e,value:e.id}))}:e}function normalizeDropdownValue(e,t){if(!isFormFieldDropdown(e)||!Array.isArray(t))return t;try{let a=JSON.stringify(t),n=e.choices.find(e=>{try{return JSON.stringify(e.value)===a}catch{return!1}});return n?.id||t}catch{return t}}function initializeAndNormalizeInputVariables(e,t){let a={...e},n=new Map;return t.forEach(e=>{let t=e.metadata,r=t.name;if(isFormFieldDropdown(t)&&n.set(r,t.choices),a[r]?.value||void 0===t.default||(a[r]={value:t.default,hidden:!1,locked:!1}),isFormFieldDropdown(t)&&a[r]?.value){let e=normalizeDropdownValue(t,a[r].value);a[r]={...a[r],value:e}}}),{inputVariables:a,originalChoicesMap:n}}function createDropdownAwareChangeHandler(e,t){return(a,n,r,l)=>{let i=e.get(a.name);if(i&&i&&"string"==typeof n){let e=i.find(e=>e.id===n);if(e&&Array.isArray(e.value))return void t(a,e.value,r,l)}t(a,n,r,l)}}function normalizeInputVariablesForDropdowns(e,t){let a={...e};return t.forEach(e=>{let t=e.metadata;if(isFormFieldDropdown(t)&&a[t.name]?.value){let e=normalizeDropdownValue(t,a[t.name].value);a[t.name]={...a[t.name],value:e}}}),a}TestFileUpload.displayName="TestFileUpload";var lX=a(0x3264c4f4),l0=a(0x1840248cf);function wrapWithWorkflowTokenDelimiters(e){return`{{${e}}}`}function processChunkElement(e,t){if((0,lX.ed)(e)){let a=(0,l0.z)(e.id);if(a&&t(a))return{...e,id:a}}if("elements"in e&&Array.isArray(e.elements)){let a=e.elements.map(e=>processChunkElement(e,t));return{...e,elements:a}}return e}function processTopLevelElement(e,t){if(!("elements"in e)||!Array.isArray(e.elements))return e;if("rich_text_list"===e.type){let a=e.elements.map(e=>processTopLevelElement(e,t));return{...e,elements:a}}let a=e.elements.map(e=>processChunkElement(e,t));return{...e,elements:a}}function extractMacroVariablesFromRichText(e,t){let a;if(!Array.isArray(e))return e;if(t)if("function"==typeof t)a=t;else{let e=new Set(t.filter(e=>{let t=e.metadata.type;return t&&!isParameterTypeSupportedInInputRenderingEngine(t)}).map(e=>wrapWithWorkflowTokenDelimiters(e.name)));a=t=>e.has(t)}else a=()=>!0;return e.map(e=>e?.type==="rich_text"&&Array.isArray(e.elements)?{...e,elements:e.elements.map(e=>processTopLevelElement(e,a))}:e)}function isParameterTypeSupportedInInputRenderingEngine(e){return[e6.HN.SlackTypesMessageContext,e6.HN.SlackTypesUserId,e6.HN.SlackTypesChannelId,e6.HN.SlackTypesUsergroupId,e6.HN.SlackTypesListId,e6.HN.SlackTypesCanvasId,e6.HN.SlackTypesChannelCanvasId,e6.HN.SlackTypesCanvasTemplateId,e6.HN.SlackTypesTeamId,e6.HN.Integer,e6.HN.Number,e6.HN.Boolean,e6.HN.String,e6.HN.SlackUserPermission,e6.HN.Array,e6.HN.SlackTypesTimestamp,e6.HN.SlackTypesRichText,e6.HN.SlackTypesExpandedRichText,e6.HN.SlackTypesBlocks,e6.HN.SlackTypesLimitedRichText,e6.HN.SlackTypesSalesforceRecordId,e6.HN.SlackTypesDate,e6.HN.DateTime,e6.HN.Reaction,e6.HN.SlackTypesCredentialOauth2,e6.HN.Timezone,e6.HN.SlackTypesUserContext,e6.HN.SlackTypesInteractivity].includes(e)}let l1=new c.Ay("workflow_builder"),l2=[],l4=[],StepTestModalContent=({closeButtonText:e,saveButtonText:t,segment:a,workflow:n,requiredVariables:l,isLoading:i,onCloseButtonClick:o,onSave:s})=>{let c=(0,M.d4)(N.dI),d=(0,e5.Dp)(a),u=(0,r.useMemo)(()=>r.createElement("div",{className:lD().titleContainer},a.config.slackFunction?.title||"",r.createElement(ns.v,{style:ns.u.Jade},c?l1.t("Test run"):"Test run")),[c,a.config.slackFunction?.title]),m=(0,nR.A)(),p=(0,e4.EM)(a),b=(0,r.useMemo)(()=>{let e={};for(let t of l.referencedVariables)e[t.metadata.name]=t.name;return e},[l.referencedVariables]),f=(0,r.useMemo)(()=>a.config.slackFunction?.input_parameters.map(e=>e.name)??[],[a.config.slackFunction?.input_parameters]),g=(0,r.useCallback)(()=>{(0,aE.ft)({clogger:m,uiArgs:{step:tK.UiStep.WORKFLOWS_TEST_RUN_VARIABLES_MODAL},wbArgs:{workflow_id:n.workflow.id,is_hermes:!0}}),o()},[m,o,n.workflow.id]),{inputVariables:_,originalChoicesMap:x}=(0,r.useMemo)(()=>initializeAndNormalizeInputVariables(a.config.inputs,l.referencedVariables),[a.config.inputs,l.referencedVariables]),[v,E]=(0,r.useState)(_),k=(0,r.useMemo)(()=>{let e={};for(let t of l.referencedVariables){let a=t.metadata.name;if(!f.includes(a)&&void 0!==t.metadata.default){let n=b[a];n&&(e[n]=t.metadata.default)}}return e},[l.referencedVariables,f,b]),[w,S]=(0,r.useState)(k),C=(0,r.useCallback)((e,t,a,n)=>{if(E(a=>({...a,[e.name]:{...a[e.name]||{},value:t}})),!f.includes(e.name)){let a=b[e.name];S(e=>({...e,[a]:t}))}},[f,b]),A=(0,r.useMemo)(()=>l.referencedVariables.filter(e=>!!e.metadata.is_required&&!e.metadata.isOptional&&!v[e.metadata.name]?.value),[l.referencedVariables,v]),T=(0,r.useCallback)(e=>{var t,a;let n;s({stepInputs:(t=Object.fromEntries(Object.entries(v).filter(([e])=>f.includes(e))),a=l.referencedVariables,n={},Object.entries(t).forEach(([e,t])=>{if(t?.value&&Array.isArray(t.value)){let r=extractMacroVariablesFromRichText(t.value,a);n[e]={...t,value:r}}else n[e]=t}),n),stepExecutionData:w})},[s,v,w,f,l]);(0,r.useEffect)(()=>{(0,aE.Vb)({clogger:m,uiArgs:{step:tK.UiStep.WORKFLOWS_AI_STEP_DEFAULT_MODAL},wbArgs:{workflow_id:n.workflow.id,is_hermes:!0}})},[m,n.workflow.id]);let I=(0,r.useMemo)(()=>createDropdownAwareChangeHandler(x,C),[C,x]),L=(0,r.useMemo)(()=>normalizeInputVariablesForDropdowns(v,l.referencedVariables),[v,l.referencedVariables]);return r.createElement(r.Fragment,null,r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:u})),r.createElement(tS.$m,null,r.createElement(tS.qf,{className:"padding_top_50 padding_bottom_50"},r.createElement("div",null,l.referencedVariables.length>0&&r.createElement("div",null,r.createElement("p",null,c?l1.t("Provide the below inputs to test run this step"):"Provide the below inputs to test run this step"),l.referencedVariables.map(e=>{let t=normalizeDropdownParameter(e.metadata);return t.type===e6.TE.Array&&t.items?.type===e6.TE.SlackTypesFileId?r.createElement(y.A,{key:e.metadata.name,text:e.metadata.title,className:"margin_bottom_100"},r.createElement(TestFileUpload,{value:"",parameter:t,callbackId:d,onChange:I})):r.createElement(eK.v,{key:e.name,functionId:a.config.function_id,configuredParameters:L,onChange:I,variables:p,allowVariables:!1,callbackId:d,parameter:t,oAuthParameter:void 0,inputParameters:l2,keyValueParameters:l4,enableRichTextDropdowns:!0,enableStringFallback:!0})}))))),r.createElement(tS.jl,null,r.createElement(tS.ox,null,r.createElement(tS.s_,{onClick:g,type:"outline","aria-label":e},e),r.createElement(h.lV,{"data-qa":"step-test-modal__save-button",ariaLoadingMessage:c?l1.t("Running"):"Running",disabled:A.length>0,loading:i,onClick:T,"aria-label":t},t))))};function stripVariablePrefix(e){if(e.startsWith("inputs.")){let t=e.split("__");if(2===t.length)return t[1]}return e}function extractSegmentVariables(e,t,a){let{availableData:n,trigger:r}=t,l=new Map,i=new Map,o=new Map,s={get undefinedVariables(){return Array.from(l.values())},get hiddenVariables(){return Array.from(i.values())},get referencedVariables(){return Array.from(o.values())}},c=/\{\{([^}]+?)\}\}/g,handleVariable=(a,s)=>{let c=`{{${a}}}`,d=stripVariablePrefix(a),u=`{{data.${d}}}`,m=n[c]||r?.outputs[u]||r?.outputs[`{{${d}}}`];if(m){let e,n=(e=>{let a=e.match(/^steps\.([^.]+?)\.fields\.([^.]+?)$/);if(!a)return;let[,n,r]=a,l=t.workflow?.steps?.find(e=>e.id===n);if(!l||l.function?.callback_id!=="open_form")return;let i=l.inputs?.fields?.value;if(Array.isArray(i))return i.find(e=>e.name===r)})(a);n&&(m={...m,...n,title:m.title||n.title,description:m.description||n.description,name:m.name}),e=!(!s.startsWith("inputs[")||n?.optional)||(n&&"optional"in n?!n.optional:"object"==typeof m&&"is_required"in m&&!!m.is_required);let r={...m,name:`${m.source_id?`${m.source_id}.`:""}${m.name}`||a,is_required:e};("slack#/types/message_context"===r.type||r.is_hidden?i:o).set(a,{name:a,location:s,metadata:r})}else e.config.slackFunction?.input_parameters.some(e=>e.name===a&&e.is_required)||l.set(a,{name:a,location:s})},checkForVariables=(e,t)=>{if("string"==typeof e)for(let a of e.matchAll(c))handleVariable(a[1],t);else Array.isArray(e)?e.forEach((e,a)=>{checkForVariables(e,`${t}[${a}]`)}):e&&"object"==typeof e&&Object.entries(e).forEach(([e,a])=>{checkForVariables(a,`${t}.${e}`)})},d=new Set;return Object.entries(e.config.inputs).forEach(([e,t])=>{if("string"==typeof t.value){let e=t.value.match(c);e&&e.forEach(e=>{let t=e.slice(2,-2);d.add(t)})}d.add(`inputs.${e}`),checkForVariables(t.value,`inputs[${e}]`)}),e.config.slackFunction?.input_parameters.forEach(e=>{if(e.is_required){let t=e.name;d.has(t)||n[`{{${t}}}`]||n[`{{inputs.${r?.id}__${t}}}`]||r?.outputs[`{{data.${t}}}`]||s.undefinedVariables.push({name:t,location:`input_parameters.${e.name}`})}}),a?.includeInputs&&e.config.slackFunction?.input_parameters.forEach(t=>{let a=t.name,n=e.config.inputs?.[t.name]?.value;if(!("string"==typeof n&&c.test(n))&&!o.has(a)&&!i.has(a)){let e={type:t.type,title:t.title,name:t.name,is_required:t.is_required,description:t.description};"array"===t.type&&t.items&&(e.items=t.items),void 0!==n&&(e.value=n),o.set(a,{name:a,location:`input_parameters.${t.name}`,metadata:e})}}),s}StepTestModalContent.displayName="StepTestModalContent";let l8=new c.Ay("workflow_builder"),StepTestModal=({segment:e,workflow:t,onTestRun:a,autoRun:n=!1})=>{let i=(0,l.wA)(),o=(0,M.d4)(N.dI),[s,c]=(0,r.useState)(!1),d=(0,r.useCallback)(()=>{c(!1),i((0,lT.O)())},[i]),u=(0,r.useMemo)(()=>extractSegmentVariables(e,t),[e,t]),m=(0,r.useCallback)(({stepInputs:e,stepExecutionData:t})=>{c(!0),a&&a(e,t,d)},[a,d]),p=(0,r.useMemo)(()=>u&&0===u.referencedVariables.length&&n,[u,n]);(0,r.useEffect)(()=>{p&&m({stepInputs:e.config.inputs,stepExecutionData:{}})},[p,m,e.config.inputs]);let b=(0,r.useCallback)(()=>{d()},[d]),f=o?l8.t("Test {stepName}",{stepName:e.config.slackFunction?.title}):`Test ${e.config.slackFunction?.title}`;return p?null:r.createElement(t0.v,{contentLabel:f,modalClassName:lD().step_test_modal,centered:!0,shouldCloseOnOverlayClick:!0},r.createElement(StepTestModalContent,{segment:e,workflow:t,requiredVariables:u,closeButtonText:l8.t("Cancel"),saveButtonText:o?l8.t("Run"):"Run",onCloseButtonClick:b,onSave:m,isLoading:s}))};StepTestModal.displayName="StepTestModal";var l5=a(0xc3cbf6b1);let l6=new c.Ay("workflow_builder"),AiStreamingError=({containerRef:e,showScrollButton:t,error:a})=>{let n=(0,M.d4)(N.dI),l=((e,t,a={})=>{let n=r.useRef(null);return(0,r.useEffect)(()=>{let{current:r}=n;if(!r||!window.IntersectionObserver)return;let l=a.threshold||1,i=new IntersectionObserver(([t])=>{e(t.intersectionRatio<l)},{threshold:l,root:t?.current??void 0,...a});return i.observe(r),()=>{i.unobserve(r),i.disconnect()}},[n,a,e,t]),n})(t,e,{threshold:1}),i={permission_denied:n?l6.t("This result may be incomplete because the user doesn\u2019t have permission to access the given context"):"This result may be incomplete because the user doesn\u2019t have permission to access the given context",max_tokens_reached:n?l6.t("This result may be incomplete because the AI reached its limit."):"This result may be incomplete because the AI reached its limit.",request_limit_exceeded:n?l6.t("This result may be incomplete because the request loop limit was exceeded."):"This result may be incomplete because the request loop limit was exceeded.",ai_answer_failed:n?l6.t("This result may be incomplete because the AI answering failed"):"This result may be incomplete because the AI answering failed",ai_answer_blocked:n?l6.t("This result may be incomplete because the AI answer is blocked by guardrails"):"This result may be incomplete because the AI answer is blocked by guardrails",llm_permanent_error:n?l6.t("This result may be incomplete because the AI had a problem fulfilling the request"):"This result may be incomplete because the AI had a problem fulfilling the request",llm_input_too_long_error:n?l6.t("This result may be incomplete because the input was too large. Try reducing the number or size of files, or shortening your prompt"):"This result may be incomplete because the input was too large. Try reducing the number or size of files, or shortening your prompt"};return r.createElement("div",{ref:l,className:lN().testPromptPanelStreamingError},r.createElement(u.Ay,{type:"boxed",level:"error",align:"left"},r.createElement("span",null,i[a])))};AiStreamingError.displayName="AiStreamingError";let SparkleWithGradientSVG=()=>r.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none"},r.createElement("path",{d:"M12.6123 10.8047C12.6718 10.6857 12.8417 10.6858 12.8984 10.8047L13.3125 11.6289C13.4372 11.8753 13.6355 12.0793 13.8848 12.2012L14.71 12.6143C14.8289 12.6737 14.8288 12.8436 14.71 12.9004L13.8848 13.3145C13.6383 13.4391 13.4343 13.6375 13.3125 13.8867L12.8984 14.7109C12.8389 14.8298 12.669 14.8299 12.6123 14.7109L12.1982 13.8867C12.0735 13.6403 11.8754 13.4362 11.626 13.3145L10.8018 12.9004C10.6827 12.8409 10.6827 12.6709 10.8018 12.6143L11.626 12.2012C11.8725 12.0766 12.0764 11.8781 12.1982 11.6289L12.6123 10.8047ZM5.62598 3.4541C5.76203 3.17933 6.15594 3.17933 6.29199 3.4541L7.25293 5.37695C7.54204 5.95483 8.00968 6.422 8.58789 6.71094L10.5127 7.67188C10.787 7.80798 10.787 8.20078 10.5127 8.33691L8.58789 9.29785C8.0097 9.58678 7.54204 10.054 7.25293 10.6318L6.29199 12.5557C6.15588 12.83 5.76217 12.8299 5.62598 12.5557L4.66504 10.6318C4.37597 10.054 3.9082 9.5868 3.33008 9.29785L1.40527 8.33691C1.13068 8.20086 1.13066 7.80791 1.40527 7.67188L3.33008 6.71094C3.90818 6.42199 4.37597 5.95475 4.66504 5.37695L5.62598 3.4541ZM12.6123 1.28906C12.6719 1.17044 12.8416 1.17059 12.8984 1.28906L13.3125 2.11328C13.4371 2.35958 13.6356 2.56371 13.8848 2.68555L14.71 3.09961C14.829 3.15912 14.829 3.32909 14.71 3.38574L13.8848 3.79883C13.6383 3.92343 13.4344 4.12197 13.3125 4.37109L12.8984 5.19531C12.8389 5.31429 12.669 5.31429 12.6123 5.19531L12.1982 4.37109C12.0735 4.12485 11.8752 3.92056 11.626 3.79883L10.8018 3.38574C10.6827 3.32625 10.6827 3.15626 10.8018 3.09961L11.626 2.68555C11.8726 2.56091 12.0764 2.36255 12.1982 2.11328L12.6123 1.28906Z",fill:"url(#paint0_linear_481_30170)"}),r.createElement("defs",null,r.createElement("linearGradient",{id:"paint0_linear_481_30170",x1:"14.7992",y1:"8.0002",x2:"1.19922",y2:"8.0002",gradientUnits:"userSpaceOnUse"},r.createElement("stop",{stopColor:"#83388A"}),r.createElement("stop",{offset:"1",stopColor:"#EABDFB"}))));var l3=a(0x24e7004c6);let l7=new c.Ay("workflow_builder"),ViewErrorButton=({onClick:e})=>{let t=(0,M.d4)(N.dI)?l7.t("View Error"):"View Error";return r.createElement(h.Nm,{className:lN().viewErrorButton,onClick:e,"aria-label":t},r.createElement("span",{className:lN().jumpIcon},r.createElement(p.Ah,{inline:!0,name:"arrow-up"})),t)};ViewErrorButton.displayName="ViewErrorButton";var l9=a(0x113cdbbd7),ie=a(0x1b3ecb90f),it=a(0x146369fa8),ia=a(0x4e250925);let ir=new c.Ay("workflow_builder"),extractRichText=e=>{let t=[];return e&&Array.isArray(e)&&e.forEach(e=>{e.type===lL.WP.rich_text&&t.push(e)}),t},TestPromptPanel=({segment:e,workflow:t,disabled:a,testKey:n})=>{let i=(0,M.d4)(N.dI),s=(0,r.useRef)(null),c=(0,r.useRef)(null),d=(0,l.wA)(),u=(0,nR.A)(),[m,b]=(0,r.useState)(!1),[f,g]=(0,r.useState)(!1),[_,y]=(0,r.useState)(!1),[x,v]=(0,r.useState)(!1),[E,k]=(0,r.useState)(void 0),w=(0,r.useRef)(null),[S,C]=(0,r.useState)(n),[A,T]=(0,r.useState)(void 0),I=(0,r.useCallback)(e=>{g(!1),T({blocks:extractRichText(e)})},[]),L=(0,r.useCallback)((e,a)=>{d((0,ia.VL)({referenceId:a,appId:t.workflow.app_id})).then(e=>{e?.ok&&e.response.answer&&T({ai_context:{result_status:aX.uX.COMPLETE},blocks:extractRichText(e.response.answer)})})},[d,t.workflow.app_id,T]),O=(0,r.useCallback)((e,t)=>{g(!1),t?k(e):y(!0)},[]),{handleSubmit:F}=(0,l3.M)({workflowId:t.workflow.id,onStreamedResponse:I,onComplete:L,onError:O}),D=(0,r.useCallback)(async(t,a,n)=>{T(void 0),g(!0),b(!0),k(void 0),y(!1),F({segment:e,stepInputs:t,stepExecutionData:a}).then(e=>{e?.ok?y(!1):(g(!1),y(!0))}).catch(()=>{g(!1),y(!0)}).finally(()=>{n()})},[F,e,b,g,y,k]),P=(0,r.useCallback)(()=>{d((0,ap.q)({element:r.createElement(StepTestModal,{segment:e,workflow:t,onTestRun:D,autoRun:!0}),isStackable:!0}))},[d,e,t,D]),R=(0,r.useCallback)(()=>{(0,aE.K$)({clogger:u,uiArgs:{step:tK.UiStep.WORKFLOWS_AI_STEP_DEFAULT_MODAL},uiProperties:{element_name:aE.KC.AiStepTestRun}}),P()},[u,P]);(0,r.useEffect)(()=>{n!==S&&(C(n),f||P())},[n,S,P,f]);let B=(0,r.useCallback)(e=>{let t=(0,lO.cX)()?e.metaKey:e.ctrlKey;e.target instanceof HTMLAnchorElement&&"button"in e&&0===e.button&&!t&&(e.preventDefault(),e.stopPropagation())},[]),W=(0,r.useCallback)(()=>{c.current?.scrollIntoView({behavior:"smooth"})},[]);(0,r.useEffect)(()=>{A&&w.current?.querySelectorAll("a").forEach(e=>{e.onclick=B})},[A,B]);let V=(0,r.useCallback)(()=>_?r.createElement(l5.y,{onRetry:P,disabled:a??!1}):A?r.createElement("div",{ref:w,className:lN().testPromptPanelResultContent},r.createElement(it.o,{msg:A,blocksContainerContext:l9.pi.ai_app,inline:!0}),_&&r.createElement(l5.y,{onRetry:P,disabled:a??!1})):null,[A,_,P,a]);return r.createElement("div",{className:lN().testPromptPanelOuterContainer,ref:s},E&&x?r.createElement(ViewErrorButton,{onClick:W}):null,r.createElement(tS.$m,{"aria-labelledby":"simulate-prompt-output-header-text",id:"simulate-prompt-output-content"},r.createElement("div",{ref:c,className:lN().testPromptPanelContainer},r.createElement("div",{className:o()(lN().testPromptPanel,{[lN().testPromptPanelShowResult]:m||f,[lN().testPromptShowResponse]:m&&!f&&!_,[lN().testPromptPanelStreamingError]:E})},r.createElement("div",{className:lN().testContentModalContentSection},m||f?r.createElement(r.Fragment,null,E&&"string"==typeof E.cause?r.createElement(AiStreamingError,{containerRef:s,error:E.cause,showScrollButton:v}):null,A&&r.createElement("div",{className:lN().generatedContentContainer},r.createElement(SparkleWithGradientSVG,null),i?ir.t("Generated content"):"Generated content"),r.createElement("div",{className:lN().testPromptPanelResult},f?r.createElement(AiStepLoadingAnimation,{lineCount:6,className:lN().testPromptPanelResultLoading}):V())):r.createElement("div",{className:lN().testPromptPanelEmptyState},r.createElement("div",{className:lN().testPromptPanelEmptyStateContent},r.createElement("div",null,r.createElement(ie.Ay,{text:":test_tube:",emojiSize:ie.lw.MEDIUM})),r.createElement("h2",{className:lN().testPromptPanelEmptyStateTitle},i?ir.t("Test your prompt"):"Test your prompt"),r.createElement("div",null,i?ir.t("If you choose to test the efficacy of your prompt, you will be guided to provide the required inputs for execution."):"If you choose to test the efficacy of your prompt, you will be guided to provide the required inputs for execution."),r.createElement(h.$n,{type:"outline",className:lN().testPromptButton,disabled:a,onClick:R},i?ir.t("Test Prompt"):"Test Prompt",r.createElement(p.Ah,{name:"play",size:"18"})))))),r.createElement("div",{className:o()(lN().testPromptPanelFooter,{[lN().resultLoading]:f})},i?ir.t("This tool uses AI to generate responses, so some information may be inaccurate."):"This tool uses AI to generate responses, so some information may be inaccurate."))))};TestPromptPanel.displayName="TestPromptPanel";var il=a(0x133aaa7da),ii=a(0x1a043bf26),io=a(0x409e023f),is=a(0x32d3ef3d),ic=a(0xfa28400d),id=a(0x9798b7f),iu=a(0x7729d35b),im=a(0x135b7b386),ip=a(0x184767f39);let ib="knowledge-source-form-modal",ig="knowledge-source-alert",ih={[im.wo]:"select_sheet",[im.y]:"select_document"},i_={[im.wo]:"sheet_id",[im.y]:"document_id"},iy=Object.keys(ih),ix="requestable",iv="requested",iE="addable",ik="inactive",iw="connected",iS={[ip.pY.INIT_APP_REQUEST_FLOW]:ix,[ip.pY.SHOW_STEP_FUNCTION]:iE,[ip.pY.INSTALL_SHOW_STEP_FUNCTION]:iE,[ip.pY.APP_DENIED]:ik,[ip.pY.APP_REQUEST_IS_PENDING]:iv,[ip.pY.APP_HIDDEN]:ik};var iC=((n={}).Single="single",n.First="first",n.Middle="middle",n.Last="last",n);let getKnowledgeSourceUrl=(e,t)=>{if(!t?.app_id)return;let a=i_[t.app_id];if(!a)return;let n=e.inputs[a];if(!n?.value)return;let r="string"==typeof n.value?n.value:String(n.value);switch(t.app_id){case im.wo:return`https://docs.google.com/spreadsheets/d/${r}`;case im.y:return`https://docs.google.com/document/d/${r}`;default:return}};var iA=a(0x5dd1c0f2),iT=a(0x216c59e11),iI=a.n(iT);let iN={name:"trash"},iM=new c.Ay("workflow_builder"),KnowledgeSourceEntity=({knowledgeSource:e,stepId:t,onRemove:a,renderedInListVariant:n,hasFocus:l})=>{let i=(0,M.d4)(t=>(0,t5.hj)(t,e.function_id)),s=(0,M.d4)(N.kZ),c=(({knowledgeSource:e,workflowId:t,stepId:a})=>{let n=(0,M.d4)(e=>t?(0,ng.W_)(e,t):void 0),l=(0,r.useMemo)(()=>{if(a&&e.id&&n)return n[a]?.[e.id]},[n,a,e.id]);return(0,r.useMemo)(()=>l?.loading?is.w.loading:l?.error?is.w.error:(l?.options,is.w.enabled),[l])})({knowledgeSource:e,workflowId:(0,aD.Y)(),stepId:t}),d=(0,r.useMemo)(()=>getKnowledgeSourceUrl(e,i),[e,i]),u=(0,M.d4)(e=>i?.app_id?(0,iA.jH)(e,i.app_id):""),m=c===is.w.error,p=(0,r.useCallback)(e=>{e.stopPropagation(),a?.()},[a]),b=(0,r.useMemo)(()=>r.createElement(v.Ay,{tip:s?iM.t("Remove variable"):"Remove variable"},r.createElement(x.A,{"aria-label":s?iM.t("Remove variable"):"Remove variable",svgIconProps:iN,onClick:p})),[p,s]),f=(0,r.useMemo)(()=>{if(!i?.app_id)return i?.title||i?.description||"";let t=i_[i.app_id];if(t){let a=e.inputs[t],n=a?.value,r=a?.label;return("object"==typeof r&&r?r[n]:void 0)??""}return i.description},[i,e.inputs]),g=(0,r.useMemo)(()=>m?r.createElement("span",{className:o()(iI().secondaryLabel,iI().errorLabel)},s?iM.t("Cannot access file"):"Cannot access file"):d?l?r.createElement("span",{className:iI().secondaryLabel},s?iM.t("Open resource"):"Open resource"):r.createElement("span",{className:iI().secondaryLabel},r.createElement("span",{className:iI().hoverText},s?iM.t("Open resource"):"Open resource"),r.createElement("span",{className:iI().baseText},u)):u,[m,d,u,l,s]),h=(0,r.useMemo)(()=>r.createElement("div",{className:iI().knowledgeSourceEntityContent},r.createElement(iu.A,{entityState:c,suppressDefaultColors:!0},r.createElement(T.z,{appId:i?.app_id})),r.createElement("div",{className:iI().labelWrap},r.createElement(id.A,{entityState:c,size:is.S.compact,primaryLabel:f,secondaryLabel:g}))),[c,i?.app_id,f,g]);return r.createElement(ic.Ay,{size:is.S.compact,entityState:c,isRemovable:!1,isInteractive:!0,isFullWidth:!0,isFullHeight:!0,customMaxWidth:"100%",actionsBar:b,forceShowActionsBar:!0,shouldShrinkUnderDefaultWidth:!0,renderedInListVariant:n},h)};KnowledgeSourceEntity.displayName="KnowledgeSourceEntity";var iL=a(0x1eac8b1c1),iO=a.n(iL);let ConnectorSourceRow=({knowledgeSource:e,stepId:t,variant:a,params:n,externalResourcesArray:l,inputParameters:i,onChange:o})=>{let s=(0,r.useCallback)(()=>{let t=l.filter(t=>t.id!==e.id),a=i.find(e=>e.name===lA.c.EXTERNAL_RESOURCES);a&&o(a,t)},[l,e.id,i,o]);return r.createElement("div",{className:iO().knowledgeSourceRow,style:{height:"62px"}},r.createElement(KnowledgeSourceEntity,{key:e.id,knowledgeSource:e,stepId:t,onRemove:s,renderedInListVariant:a,hasFocus:n.hasFocus||n.hasFocusWithin}))};ConnectorSourceRow.displayName="ConnectorSourceRow";let iF="connector",iD="canvas",iP="list",iR="file",iB="upload_file";var iW=a(0x22f5cc45d);let iV={name:"trash"},iH=new c.Ay("workflow_builder"),FileSourceRow=({item:e,itemValue:t,variant:a,params:n,configuredParameters:l,inputParameters:i,onChange:s})=>{let c=(0,r.useMemo)(()=>{let t;t=e.type===iD?lA.c.CANVAS_IDS:e.type===iP?lA.c.LIST_IDS:lA.c.FILE_IDS;let a=l[t]?.value??[];return Array.isArray(a)?a:[]},[l,e.type]),d=(0,r.useCallback)(t=>{let a;t.stopPropagation(),a=e.type===iD?lA.c.CANVAS_IDS:e.type===iP?lA.c.LIST_IDS:lA.c.FILE_IDS;let n=c.filter(t=>t!==e.id),r=i.find(e=>e.name===a);r&&s(r,n)},[c,e.id,e.type,i,s]),u=(0,r.useMemo)(()=>r.createElement(v.Ay,{tip:iH.t("Remove")},r.createElement(x.A,{"aria-label":iH.t("Remove"),svgIconProps:iV,onClick:d})),[d]);return r.createElement(iW.A,{key:e.id,fileId:t,className:o()("p-explorer_result--list",{"p-explorer_result--list--first":a===iC.First||a===iC.Single,"p-explorer_result--list--last":a===iC.Last||a===iC.Single}),showActions:!1,forceClickStyles:!0,secondaryContent:u,containerHasFocus:n.hasFocus,useListStyling:!0,forceHoverVisible:n.hasFocus})};FileSourceRow.displayName="FileSourceRow";let iq={name:"trash",size:"16"},iU=new c.Ay("workflow_builder"),VariableEntity=({primaryLabel:e,onRemove:t,isMissing:a=!1,renderedInListVariant:n,sourceLabel:l})=>{let i=(0,M.d4)(N.kZ),o=is.w.enabled,s=(0,r.useMemo)(()=>a?r.createElement("span",{className:iI().missingLabel},e):e,[a,e]),c=(0,r.useMemo)(()=>{let e=iU.t("Variable"),t=l?`${e} \xb7 ${l}`:e;return a?r.createElement("span",{className:iI().missingLabel},t):t},[a,l]),d=(0,r.useMemo)(()=>r.createElement("div",{className:iI().knowledgeSourceEntityContent},r.createElement(iu.A,{entityState:o,suppressDefaultColors:!0},r.createElement("div",{className:`${iI().variableIconContainer} ${a?iI().missing:""}`},r.createElement(p.Ah,{name:"css",size:"20"}))),r.createElement("div",{className:iI().labelWrap},r.createElement(id.A,{entityState:o,size:is.S.compact,primaryLabel:s,secondaryLabel:c}))),[o,s,c,a,"css"]),u=(0,r.useMemo)(()=>t?e=>{e.preventDefault(),e.stopPropagation(),t()}:void 0,[t]),m=(0,r.useMemo)(()=>r.createElement(v.Ay,{tip:i?iU.t("Remove variable"):"Remove variable"},r.createElement(x.A,{"aria-label":i?iU.t("Remove variable"):"Remove variable",svgIconProps:iq,onClick:u})),[u,i]);return r.createElement(ic.Ay,{size:is.S.compact,entityState:o,isRemovable:!1,isInteractive:!1,isFullWidth:!0,isFullHeight:!0,customMaxWidth:"100%",actionsBar:m,forceShowActionsBar:!0,shouldShrinkUnderDefaultWidth:!0,renderedInListVariant:n},d)};VariableEntity.displayName="VariableEntity";var iz=a(0x1e1fc678);let getSourceLabelForVariable=(e,t)=>{let a=t.groups.find(t=>t.id===e.source_id);if(a)return a.stepIndex?`Step ${a.stepIndex}`:(0,iz.T)(a.type,a.label,a.subtype)},ij=new c.Ay("workflow_builder"),VariableSourceRow=({item:e,itemValue:t,variant:a,variables:n,configuredParameters:l,inputParameters:i,onChange:s})=>{let c=(0,eX.x)(n.list,t),d=c&&!c.isTombstone?c.label:ij.t("Missing Data"),u=!c||c.isTombstone,m=c?getSourceLabelForVariable(c,n):void 0,p={[iD]:lA.c.CANVAS_IDS,[iP]:lA.c.LIST_IDS,[iR]:lA.c.FILE_IDS}[e.type],b=(0,r.useMemo)(()=>{let e=l[p]?.value??[];return Array.isArray(e)?e:[]},[l,p]),f=(0,r.useCallback)(()=>{let t=b.filter(t=>t!==e.id),a=i.find(e=>e.name===p);a&&s(a,t)},[b,i,e.id,p,s]);return r.createElement("div",{className:o()(iO().knowledgeSourceRow),style:{height:"62px"}},r.createElement(VariableEntity,{key:e.id,primaryLabel:d,onRemove:f,isMissing:u,renderedInListVariant:a,sourceLabel:m}))};VariableSourceRow.displayName="VariableSourceRow";let KnowledgeSourceRow=({item:e,variant:t,stepId:a,variables:n,params:l,externalResourcesArray:i,configuredParameters:o,inputParameters:s,onChange:c})=>{if(e.type===iF)return r.createElement(ConnectorSourceRow,{knowledgeSource:e.data,stepId:a,params:l,variant:t,externalResourcesArray:i,inputParameters:s,onChange:c});let d=e.data;return"string"==typeof d&&(0,e0.bs)(d)?r.createElement(VariableSourceRow,{item:e,itemValue:d,variant:t,variables:n,configuredParameters:o,inputParameters:s,onChange:c}):r.createElement(FileSourceRow,{item:e,itemValue:d,variant:t,params:l,configuredParameters:o,inputParameters:s,onChange:c})};KnowledgeSourceRow.displayName="KnowledgeSourceRow";var iG=a(0xcb24a23b),i$=a(0xbd3de346);let iK=new c.Ay("workflow_builder"),isFileUnavailable=e=>!e||e.isNonExistent||(0,i$.c4)(e)||(0,i$.uO)(e),useKnowledgeSourceAlerts=({segment:e,workflow:t,configuredParameters:a,variables:n})=>{let l=(0,e8.DY)(t),i=(0,M.d4)(N.kZ),o=(0,M.d4)(aC.Pz),s=(0,a0.XS)(t,e),c=(0,a0.nh)(t,e,s),d=(0,M.d4)(e=>(0,ng.W_)(e,l)),u=(0,r.useMemo)(()=>{let t=d?.[e.id];return!!t&&Object.values(t).some(e=>e.error)},[d,e.id]),m=(0,r.useMemo)(()=>{let e=a[lA.c.CANVAS_IDS]?.value??[];return Array.isArray(e)?e:[]},[a]),p=(0,r.useMemo)(()=>{let e=a[lA.c.LIST_IDS]?.value??[];return Array.isArray(e)?e:[]},[a]),b=(0,r.useMemo)(()=>{let e=a[lA.c.FILE_IDS]?.value??[];return Array.isArray(e)?e:[]},[a]),f=m.length>0||p.length>0||b.length>0,g=(0,M.d4)(e=>(0,aC.bO)(e,[...m,...p,...b])),h=(0,r.useMemo)(()=>{let t=e.config.slackFunction?.input_parameters;return t?{canvasParameter:t.find(e=>e.name===lA.c.CANVAS_IDS),listParameter:t.find(e=>e.name===lA.c.LIST_IDS),fileParameter:t.find(e=>e.name===lA.c.FILE_IDS)}:{}},[e.config.slackFunction?.input_parameters]),_=(0,r.useMemo)(()=>b.some(e=>{let t=o?o[e]:void 0;return!(0,e0.cn)(e)&&isFileUnavailable(t)}),[b,o]),y=(0,r.useMemo)(()=>m.some(e=>{let t=o?o[e]:void 0;return!(0,e0.cn)(e)&&isFileUnavailable(t)}),[m,o]),x=(0,r.useMemo)(()=>p.some(e=>{let t=o?o[e]:void 0;return!(0,e0.cn)(e)&&isFileUnavailable(t)}),[p,o]),v=(0,r.useMemo)(()=>(({canvasArray:e,listArray:t,fileArray:a},{canvasParameter:n,listParameter:r,fileParameter:l},i,o)=>{let s=new Map;if(n){let[t]=(0,iG.g)({variables:i,id:lA.c.CANVAS_IDS,value:e,isValidEmptyObject:!0,isRequired:n.is_required??!1,parameter:n,arrayItemType:n.items?.type,allFiles:o});s.set(lA.c.CANVAS_IDS,t)}if(r){let[e]=(0,iG.g)({variables:i,id:lA.c.LIST_IDS,value:t,isValidEmptyObject:!0,isRequired:r.is_required??!1,parameter:r,arrayItemType:r.items?.type,allFiles:o});s.set(lA.c.LIST_IDS,e)}if(l){let[e]=(0,iG.g)({variables:i,id:lA.c.FILE_IDS,value:a,isValidEmptyObject:!0,isRequired:l.is_required??!1,parameter:l,arrayItemType:l.items?.type,allFiles:o});s.set(lA.c.FILE_IDS,e)}return s})({canvasArray:m,listArray:p,fileArray:b},h,n,o),[m,p,b,h,n,o]),E=[...v.values()].flat(),k=(0,r.useMemo)(()=>{if(u)return{text:i?iK.t("There is an issue accessing a connected data source."):"There is an issue accessing a connected data source.",level:"error"};if(_&&E.some(e=>e.id.endsWith("_is_deleted_file"))||y&&s?.includes("workflow_canvas_not_found")||x&&s?.includes("workflow_list_not_found"))return{text:i?iK.t("One or more selected files were not found. Choose a different file to continue."):"One or more selected files were not found. Choose a different file to continue.",level:"error"};if(c&&s===r8.oh.FILE_SIZE_TOO_LARGE){let e=g.find(e=>!!e?.name&&c.includes(e?.name))?.id;if(e&&b.includes(e))return{text:c,level:"error"}}let e=v.get(lA.c.CANVAS_IDS)??[],t=v.get(lA.c.LIST_IDS)??[],a=v.get(lA.c.FILE_IDS)??[];return e.some(e=>e.id.endsWith("_is_greater_than_max"))?{text:i?iK.t("You can have a maximum of 10 {entityName}.",{entityName:iK.t("Canvases",{fallbackHash:"e2d397a06197e996f48faa9c0abfd3a2a80d15de",fallbackHashNs:"files"})}):`You can have a maximum of 10 ${iK.t("Canvases",{fallbackHash:"e2d397a06197e996f48faa9c0abfd3a2a80d15de",fallbackHashNs:"files"})}.`,level:"error"}:t.some(e=>e.id.endsWith("_is_greater_than_max"))?{text:i?iK.t("You can have a maximum of 10 {entityName}.",{entityName:iK.t("Lists",{fallbackHash:"57c9502a7d7d48fd4a86b45fefb2b163491c3ae1",fallbackHashNs:"files"})}):`You can have a maximum of 10 ${iK.t("Lists",{fallbackHash:"57c9502a7d7d48fd4a86b45fefb2b163491c3ae1",fallbackHashNs:"files"})}.`,level:"error"}:a.some(e=>e.id.endsWith("_is_greater_than_max"))?{text:i?iK.t("You can have a maximum of 10 {entityName}.",{entityName:iK.t("Files")}):`You can have a maximum of 10 ${iK.t("Files")}.`,level:"error"}:E.some(e=>e.id.endsWith("_is_missing_variables"))?{text:i?iK.t("Knowledge sources contain a missing variable.",{fallbackHash:"8224d4b6336ff8635e6cccf713f44fb694e92c70"}):"Knowledge sources contain a missing variable.",level:"error"}:E.some(e=>e.id.endsWith("_is_unavailable_variables"))?{text:i?iK.t("Knowledge sources contain an unavailable variable.",{fallbackHash:"02605f6dabeee59a9b76627b21f072b71011da74"}):"Knowledge sources contain an unavailable variable.",level:"error"}:E.some(e=>e.id.endsWith("_mixed_with_array_variables"))?{text:iK.t("Variables containing multiple items must not be mixed wih other items of the same type",{fallbackHash:"02605f6dabeee59a9b76627b21f072b71011da74"}),level:"error"}:i&&f?{text:iK.t("The contents of any Canvas, List, or File used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u2019re ok with sharing this content before continuing."),level:"warning"}:null},[u,_,E,y,s,x,c,v,i,f,g,b]),w=k?.level==="error";return{alert:k,hasError:w}};var iY=a(0xc6a2c86f),iQ=a(0x6e0e2fb2),iZ=a(0xbe3df8c1),iJ=a(0x19561ce96),iX=a(0x212b4c697),i0=a(0x45cdfa9c),i1=a(0x16af7d0de);let i2=new c.Ay("workflow_builder"),KnowledgeSourceForm=({hermesFunction:e,functionCallbackId:t,onConfiguredParametersChange:a,onValidationChange:n,knowledgeSource:l,type:i,inputParameter:o,existingParameters:s,stepId:c})=>{let d=(0,M.d4)(N.kZ),m=(0,aD.Y)(),p=(0,r.useMemo)(()=>{let t=i===iF?e.input_parameters??[]:[o],a=(0,i0.k)(t);return{...e,input_parameters:a}},[e,i,o]),b=(0,r.useMemo)(()=>{let e;return e=i===iF?l?.inputs??{}:{[o.name]:{value:s}},{id:l?.id??c??`temp_third_party_${t}`,type:rV.SLACK_FUNCTION,config:{function_id:l?.id??p.id,inputs:e,slackFunction:p,workflow_id:m}}},[i,l?.id,l?.inputs,t,p,m,o.name,s,c]),[f,g]=useSegmentReducer((0,r.useMemo)(()=>getSegmentReducer(b,{},t),[b,t]),b),h=f.segment;(0,r.useEffect)(()=>{a(h.config.inputs||{})},[h,a]),(0,r.useEffect)(()=>{n(f.computed?.isValid??!1)},[f.computed?.isValid,n]);let _=(0,r.useCallback)(()=>{},[]),y=(0,r.useMemo)(()=>{let e=h.config.inputs?.[o.name]?.value;return Array.isArray(e)?e.filter(e=>"string"==typeof e):[]},[h,o.name]),x=(0,r.useCallback)((e,t)=>{let n=Array.isArray(t)?t:[t];a({...h.config.inputs||{},[o.name]:{value:n}})},[h,o,a]);return i===iB?r.createElement("div",null,y.length>0&&r.createElement("div",{className:"margin_bottom_100"},r.createElement(u.Ay,{level:u.A_.warning},d?i2.t("The contents of any {fileType} used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u2019re ok with sharing this content before continuing.",{fileType:i2.t("File",{fallbackHashNs:"files"})}):"The contents of any file used with this step can be shared via the AI response and become visible to workflow users. Make sure you\u2019re ok with sharing this content before continuing")),r.createElement("label",{htmlFor:"upload-file-input",className:"c-label"},o.title||i2.t("File",{fallbackHashNs:"files"})),r.createElement(TestFileUpload,{value:y,parameter:o,callbackId:t,onChange:x})):r.createElement(C.ZH.Provider,{value:g},r.createElement(SlackFunctionSegmentForm,{state:f,isExistingStep:!1,switchPane:_,activePane:tg.k.DEFAULT,noFormPadding:!0,allowVariables:i!==iF,isFunctionForKnowledgeSource:!0}))};KnowledgeSourceForm.displayName="KnowledgeSourceForm";let KnowledgeSourceFormModal=({onSave:e,appId:t,inputParameter:a,existingParameters:n,type:i,id:o,stepId:s})=>{let c=(0,l.wA)(),[d,m]=(0,r.useState)({}),[p,b]=(0,r.useState)(!1),f=(0,aD.Y)(),g=(0,M.d4)(N.kZ),_=(0,r.useMemo)(()=>{if(t)return ih[t]},[t]),y=(0,r.useMemo)(()=>{if(i===iF)return(Array.isArray(n)?n:[]).find(e=>"object"==typeof e&&e&&"id"in e&&e?.id===o)},[i,n,o]),x=(0,M.d4)(e=>{if(_)return(0,t5.sw)(e,[_])?.[0]}),v=(0,M.d4)(e=>(0,t5.hj)(e,i1.Ez.ai_answer,!0)),E=x??v,w=(0,r.useCallback)(e=>{m(e)},[]),S=(0,r.useCallback)(e=>{b(e)},[]),C=(0,r.useMemo)(()=>{if(i!==iF||0===Object.keys(d).length)return!1;let e=Array.isArray(n)?n:[];return o?e.filter(e=>e.id!==o).some(e=>(0,rm.A)(e.inputs,d)):e.some(e=>{if(!t)return!1;let a=i_[t];return!!e.inputs[a]&&!!d[a]&&(0,rm.A)(e.inputs[a],d[a])})},[i,t,n,o,d]),A=(0,r.useCallback)(()=>{e(i===iF?{inputParameter:a,configuredParameters:{id:o??(0,k.A)(),function_id:E.id,inputs:d,workflow_id:f}}:{inputParameter:a,configuredParameters:d}),c((0,lT.O)({closeNamed:[ib]}))},[i,a,o,E,d,e,c,f]),T=(0,r.useCallback)(()=>{c((0,lT.O)({closeNamed:[ib]}))},[c]),I=(0,r.useMemo)(()=>{if(i===iF)return!!E?.input_parameters?.length&&E.input_parameters.every(e=>{if(!e.is_required)return!0;let t=d[e.name]?.value;return null!=t&&""!==t});let e=d[a.name]?.value;return Array.isArray(e)&&e.length>0||"string"==typeof e&&(0,e0.cn)(e)},[i,E,d,a]),L=(0,r.useMemo)(()=>p&&I,[p,I]);return r.createElement(tS.aF,{onClose:T,contentLabel:g?i2.t("Add Knowledge Source"):"Add Knowledge Source",shouldCloseOnOverlayClick:!1},r.createElement(tS.$m,null,r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:g?i2.t("Add Knowledge Source"):"Add Knowledge Source"})),r.createElement(tS.qf,null,C&&r.createElement(u.Ay,{level:u.A_.error},g?i2.t("This knowledge source has already been selected. Please choose a different one."):"This knowledge source has already been selected. Please choose a different one."),E&&!(0,rZ.GU)(E)&&r.createElement("div",{className:"margin_top_100 margin_bottom_100"},r.createElement(KnowledgeSourceForm,{key:`form-${E.id}-${_}-${i}`,hermesFunction:E,functionCallbackId:_??"unknown",onConfiguredParametersChange:w,onValidationChange:S,knowledgeSource:y,type:i,inputParameter:a,existingParameters:n,stepId:s})))),r.createElement(tS.jl,null,r.createElement(tS.ox,null,r.createElement(h.Ay,{type:"outline",onClick:T,"aria-label":i2.t("Cancel")},i2.t("Cancel")),r.createElement(h.lV,{type:"primary",disabled:!L||i===iF&&(!t||C),onClick:A,"aria-label":g?i2.t("Add Data Source"):"Add Data Source"},g?i2.t("Add Data Source"):"Add Data Source"))))};KnowledgeSourceFormModal.displayName="KnowledgeSourceFormModal";let i4=new c.Ay("workflow_builder"),KnowledgeSourceMenuItemLabel=({provider:e,status:t})=>{let a=(0,M.d4)(t=>(0,iJ.dJ)(t,e)),n=(0,M.d4)(N.kZ),l=a?.app?.profile?.name,i=(0,r.useMemo)(()=>t===iw?n?i4.t("Connected"):"Connected":t===ix?n?i4.t("Request access"):"Request access":t===iv?n?i4.t("Pending approval"):"Pending approval":"loading"===t?i4.t("Loading"):i4.t("Connect"),[t,n]);return r.createElement("span",{className:iO().knowledgeSourceMenuItemLabel},r.createElement("span",{className:iO().knowledgeSourceMenuItemLeft},a?.app?.profile?.icons?.image32?r.createElement("img",{className:iO().knowledgeSourceMenuItemIcon,src:a?.app?.profile?.icons?.image32,alt:"","data-qa":"knowledge-source-menu-item-icon"}):null,l),r.createElement("span",{className:iO().knowledgeSourceMenuItemRight},i,t===iw&&r.createElement(p.Ah,{name:"check-circle",size:"18"})))};KnowledgeSourceMenuItemLabel.displayName="KnowledgeSourceMenuItemLabel";var i8=a(0x1a02c72b5),i5=a(0xd6a16321),i6=a(0xc4548bcd),i3=a(0x1d600678);let i7=a.p+"ai-step-external-resources-icons-2ccf34e.png",i9=new c.Ay("workflow_builder"),MenuItemLabel=({icon:e,label:t,sourceLabel:a})=>r.createElement("span",{className:iO().knowledgeSourceMenuItemTitleWrap},r.createElement("span",{className:iO().knowledgeSourceMenuItemLeft},r.createElement(p.Ah,{name:e,size:"18"})),r.createElement(a_.A,{lines:1},t),a&&r.createElement("span",{className:iO().knowledgeSourceMenuItemStepIndex},r.createElement(a_.A,{lines:1},a)));MenuItemLabel.displayName="MenuItemLabel";let KnowledgeSourcesCard=({segment:e,workflow:t,onChange:a,configuredParameters:n,inputParameters:i,variables:o})=>{let s=(0,l.wA)(),{openSpeedBump:c,closeSpeedBump:d}=(0,C.qE)(),m=(0,M.d4)(N.kZ),b=(0,M.d4)(N.oI),f=(0,M.d4)(e=>"allow_all"===(0,i3.x)(e,"disable_file_uploads")),g=(0,M.d4)(e=>(0,i3.x)(e,"slack_ai_files_search_opt_out")),_=g?.all_file_opt_out??!1,x=(0,lC.A)({variables:o,callbackId:(0,e5.Dp)(e),isTriggerSegment:!1})??o,{alert:v}=useKnowledgeSourceAlerts({segment:e,workflow:t,configuredParameters:n,variables:x}),E=(0,r.useMemo)(()=>x.list.filter(e=>{let t=e.type===e6.TE.Array?e.items?.type:e.type;return t&&(t===e6.TE.SlackTypesCanvasId||t===e6.TE.SlackTypesListId||t===e6.TE.SlackTypesFileId)&&!e.isDisabled}),[x]),k=i.find(e=>e.name===lA.c.EXTERNAL_RESOURCES),w=i.find(e=>e.name===lA.c.CANVAS_IDS),S=i.find(e=>e.name===lA.c.LIST_IDS),A=(0,r.useMemo)(()=>{let e=i.find(e=>e.name===lA.c.FILE_IDS);if(e)return{...e,is_hidden:!1}},[i]),T=(0,r.useMemo)(()=>n[lA.c.EXTERNAL_RESOURCES]?.value??[],[n]),I=(0,r.useMemo)(()=>{let e=n[lA.c.CANVAS_IDS]?.value??[];return Array.isArray(e)?e:[]},[n]),L=(0,r.useMemo)(()=>{let e=n[lA.c.LIST_IDS]?.value??[];return Array.isArray(e)?e:[]},[n]),O=(0,r.useMemo)(()=>{let e=n[lA.c.FILE_IDS]?.value??[];return"string"==typeof e&&(0,e0.cn)(e)?[e]:Array.isArray(e)?e:[]},[n]),F=(({stepId:e,fetchFunctionAuths:t})=>{let a=(0,aD.Y)(),n=(0,e2.j)(),i=n&&"workflow"in n?(0,e8.Dv)(e,n.workflow):void 0,o=(0,l.wA)(),[s,c]=(0,r.useState)(iQ.r.NOT_STARTED),d=(0,M.d4)(e=>(0,t5.sw)(e,Object.values(ih))),u=(0,r.useMemo)(()=>d.map(e=>e?.id),[d]),m=(0,M.d4)(r4.mh),p=(0,r.useMemo)(()=>Object.values(m).flatMap(e=>e.validTokens).join("-"),[m]),b=(0,iY.A)(p)!==p;(0,r.useEffect)(()=>{let fetchFunctionAuth=async()=>{c(iQ.r.IN_FLIGHT);try{u.forEach(async(t,n)=>{if(t){let r={functionId:t,id:e,inputs:i?.inputs??{}};await o((0,iZ.J)({appId:iy[n],functionId:t,workflowId:a,step:r}))}})}catch{c(iQ.r.ERROR)}finally{c(iQ.r.FINISHED)}};(b||t)&&fetchFunctionAuth()},[u,o,i,a,b,t,e]),(0,r.useEffect)(()=>()=>{o((0,iX.RZ)()),c(iQ.r.NOT_STARTED)},[]);let f=(0,r.useMemo)(()=>e=>(0,iJ.Rp)(e,iy),[]),g=(0,M.d4)(f),h=(0,M.d4)(e=>(0,iA.Aw)(e,iy)),_=(0,r.useMemo)(()=>iy.reduce((e,t)=>{let a=g[t]?.distributionStatus,n=g[t]?.configurationStatus;if(h[t])if(a){let r;e[t]=(r=iS[a])===iE&&n!==ip.aW.READY?iv:r}else e[t]=iE;else e[t]=ik;return e},{}),[g,h]);return(0,r.useMemo)(()=>iy.reduce((e,t)=>{let a=(Object.values(m).find(e=>e.appId===t)?.validTokens??[]).length>0;return s===iQ.r.IN_FLIGHT?e[t]="loading":_[t]===iE?e[t]=a?"connected":"connect":e[t]=_[t],e},{}),[m,_,s])})({stepId:e.id,fetchFunctionAuths:0===T.length}),D=(0,r.useCallback)(e=>{if(e.inputParameter.name===lA.c.EXTERNAL_RESOURCES){let t=i.find(e=>e.name===lA.c.EXTERNAL_RESOURCES);t&&"inputs"in e.configuredParameters&&"function_id"in e.configuredParameters&&"id"in e.configuredParameters&&a(t,[...T.filter(t=>t.id!==e.configuredParameters.id),e.configuredParameters])}else{if("inputs"in e.configuredParameters)return;a(e.inputParameter,e.configuredParameters[e.inputParameter.name]?.value)}},[T,i,a]),P=(0,r.useCallback)(({type:t,appId:a,sourceId:n})=>{let l,i;t===iD?(l=w,i=I):t===iP?(l=S,i=L):t===iR||t===iB?(l=A,i=O):(l=k,i=T),l&&(a&&t===iF&&F[a]===ix?s((0,ap.q)({name:ib,isStackable:!0,element:r.createElement(io.u,{appId:a})})):s((0,ap.q)({name:ib,isStackable:!0,element:r.createElement(KnowledgeSourceFormModal,{inputParameter:l,existingParameters:i,type:t,onSave:D,appId:a,id:n,stepId:e.id})})))},[F,w,I,S,L,A,O,k,T,s,D,e.id]),R=(0,r.useCallback)(e=>()=>{P(e)},[P]),B=(0,r.useCallback)(e=>r.createElement(KnowledgeSourceMenuItemLabel,{provider:e,status:F[e]}),[F]),W=(0,r.useCallback)(e=>{let t=e.type===e6.TE.Array?e.items?.type:e.type;return t===e6.TE.SlackTypesCanvasId?I.some(t=>void 0!==(0,eX.x)([e],t)):t===e6.TE.SlackTypesListId?L.some(t=>void 0!==(0,eX.x)([e],t)):t===e6.TE.SlackTypesFileId&&O.some(t=>void 0!==(0,eX.x)([e],t))},[I,L,O]),V=(0,r.useCallback)(e=>{let t,n,r=e.type===e6.TE.Array?e.items?.type:e.type;if(r===e6.TE.SlackTypesCanvasId)t=w,n=I;else if(r===e6.TE.SlackTypesListId)t=S,n=L;else{if(r!==e6.TE.SlackTypesFileId)return;t=A,n=O}t&&(n.includes(e.id)?a(t,n.filter(t=>t!==e.id)):a(t,[...n,e.id]))},[w,I,S,L,A,O,a]),H=(0,r.useCallback)(e=>()=>{V(e)},[V]),q=(0,r.useCallback)(e=>{let t=b?Object.keys(ih).map(e=>{if(F[e]===ik)return null;let t=F[e]===iv||"config_required"===F[e];return r.createElement(j.Dr,{key:`${e}-${F[e]}`,label:B(e),onSelected:R({type:iF,appId:e}),disabled:t})}):[],a=m?[r.createElement(j.Dr,{key:"canvas-entity",label:r.createElement(MenuItemLabel,{icon:"canvas-content",label:i9.t("Canvas")}),onSelected:R({type:iD}),disabled:!1}),r.createElement(j.Dr,{key:"list-entity",label:r.createElement(MenuItemLabel,{icon:"lists",label:i9.t("List")}),onSelected:R({type:iP}),disabled:!1})]:[];m&&!_&&a.push(r.createElement(j.Dr,{key:"select-file-entity",label:r.createElement(MenuItemLabel,{icon:"file-browser",label:i9.t("Files")}),onSelected:R({type:iR}),disabled:!1})),f&&m&&!_&&a.push(r.createElement(j.Dr,{key:"file-entity",label:r.createElement(MenuItemLabel,{icon:"file-upload",label:m?i9.t("Upload a File"):"Upload a File"}),onSelected:R({type:iB}),disabled:!1}));let n=E.map(e=>r.createElement(j.Dr,{key:`var-${e.id}`,type:il.A.checkbox,checked:W(e),label:r.createElement(MenuItemLabel,{icon:"css",label:e.label,sourceLabel:getSourceLabelForVariable(e,o)}),onSelected:H(e)})),l=n.length>0&&(t.length>0||a.length>0),i=t.length>0&&(n.length>0||a.length>0);return r.createElement(j.Ay,{...e,width:340},a,l&&r.createElement(j.bX,null),n.length>0&&n,i&&r.createElement(j.bX,null),t)},[b,m,R,f,_,E,F,B,W,H,o]),U=(0,r.useMemo)(()=>m?[...I.map(e=>({type:iD,id:e,data:e})),...L.map(e=>({type:iP,id:e,data:e})),...O.map(e=>({type:iR,id:e,data:e})),...T.map(e=>({type:iF,id:e.id,data:e}))]:T.map(e=>({type:iF,id:e.id,data:e})),[m,I,L,O,T]),z=(0,r.useMemo)(()=>T.map(e=>e.function_id),[T]),G=(0,M.d4)(e=>(0,t5.gL)(e,{ids:z})),$=(0,r.useMemo)(()=>{let e={};return T.forEach((t,a)=>{let n=G[a],r=getKnowledgeSourceUrl(t,n);e[t.id]={url:r,appId:n?.app_id??"",functionId:t.function_id}}),e},[T,G]),K=(0,r.useMemo)(()=>U.map(e=>e.id),[U]),Y=(0,r.useCallback)(e=>{c({heading:m?i9.t("Discard changes and open resource?"):"Discard changes and open resource?",message:i9.rt("Your work will not be saved."),onCancel:d,onContinue:()=>{d(),e()},continueButtonLabel:m?i9.t("Discard & Open"):"Discard & Open"})},[c,m,d]),Q=(0,r.useCallback)(e=>{let t=U.find(t=>t.id===e.id);if(t&&!("string"==typeof t.id&&(0,e0.bs)(t.id))){if(t.type===iF){let e=t.data,a=$[e.id];a?.url?(0,i6.A)(a.url):P({type:iF,appId:a?.appId??"",sourceId:e.id});return}t.type===iD&&Y(()=>{s((0,i8.o)((0,i5.mo)({id:t.data}))),s((0,lT.O)())}),t.type===iP&&Y(()=>{s((0,i8.o)((0,i5.st)({listId:t.data}))),s((0,lT.O)())}),t.type===iR&&Y(()=>{s((0,i8.o)((0,i5.EJ)(t.data))),s((0,lT.O)())})}},[U,$,s,P,Y]),Z=(0,r.useCallback)(e=>{let t=U.length;return 1===t?iC.Single:0===e?iC.First:e===t-1?iC.Last:iC.Middle},[U.length]),J=(0,r.useCallback)((t,l)=>{let s=U[t];if(!s)return null;let c=Z(t);return r.createElement(KnowledgeSourceRow,{item:s,variant:c,stepId:e.id,variables:o,params:l,externalResourcesArray:T,configuredParameters:n,inputParameters:i,onChange:a})},[U,Z,e.id,o,T,n,i,a]);return(b||m)&&(!b||m||0!==Object.keys(F).length)?r.createElement("div",{className:"margin_top_100 margin_bottom_100"},r.createElement("div",{className:iO().knowledgeSourcesHeader},r.createElement(y.A,{text:m?i9.t("Files & external sources"):"Files & external sources"}),r.createElement(j.cQ,{renderMenu:q,position:"bottom-right",closeOnSelect:!0},r.createElement(h.$n,{type:"ghost",size:"small","aria-label":m?i9.t("Add a Source"):"Add a Source"},r.createElement("span",{className:"margin_right_25"},r.createElement(p.Ah,{name:"plus"})),m?i9.t("Add a Source"):"Add a Source"))),v&&r.createElement(u.Ay,{id:ig,level:"error"===v.level?u.A_.error:u.A_.warning,className:"margin_bottom_100"},v.text),0===U.length?r.createElement("div",{className:iO().emptyStateContainer},r.createElement("p",{className:iO().emptyStateText},r.createElement("strong",null,m?i9.t("Add files, canvases, lists, or connected sources (Google Drive, Confluence, etc.) the AI can reference"):"Add files, canvases, lists, or connected sources (Google Drive, Confluence, etc.) the AI can reference")),r.createElement("img",{src:i7,className:iO().emptyStateImage,alt:""})):r.createElement("div",{className:iO().knowledgeSourcesList},r.createElement(lk.A,{disableHeight:!0},({width:e})=>r.createElement(ii.A,{width:e,height:62*U.length,keys:K,onItemClick:Q,rowRenderer:J})))):null};KnowledgeSourcesCard.displayName="KnowledgeSourcesCard";let oe=new c.Ay("workflow_builder"),AiStepRightPanel=({segment:e,workflow:t,testDisabled:a,configuredParameters:n,nonPromptSlackFunctionParameters:l,onChange:i,variables:s,formatVariableBeforeInsert:c,callbackId:d})=>{let m=(0,M.d4)(N.kZ),b=(0,M.d4)(N.dI),f=(0,nR.A)(),[g,_]=(0,r.useState)(!0),[y,x]=(0,r.useState)(!1),[v,E]=(0,r.useState)(k.A),w=(0,r.useCallback)((e,t)=>{let a=t??!y;x(a),a&&_(!1)},[y,_]),S=(0,r.useMemo)(()=>m?l.filter(e=>e.name!==lA.c.EXTERNAL_RESOURCES&&e.name!==lA.c.CANVAS_IDS&&e.name!==lA.c.LIST_IDS&&e.name!==lA.c.FILE_IDS):l,[m,l]),C=(0,r.useCallback)((e,t)=>{let a=t??!g;_(a),a&&w(void 0,!1)},[g,w]),A=(0,r.useMemo)(()=>({...e,config:{...e.config,inputs:n}}),[e,n]),T=(0,r.useCallback)(e=>{e.stopPropagation(),(0,aE.K$)({clogger:f,uiArgs:{step:tK.UiStep.WORKFLOWS_AI_STEP_DEFAULT_MODAL},uiProperties:{element_name:aE.KC.AiStepTestRun}}),w(void 0,!0),E((0,k.A)())},[f,w,E]);return r.createElement("div",{className:lN().aiStepRightPanel},r.createElement("div",{className:o()(lN().sectionContainer,lN().contentSourcesContainer,{[lN().expanded]:g})},r.createElement("div",{className:lN().sectionHeader},r.createElement(h.Nm,{onClick:C,className:lN().sectionHeaderContent,"aria-expanded":g,"aria-controls":"context-sources-content"},r.createElement(p.Ah,{name:g?"caret-down-full":"caret-up-full"}),r.createElement("div",{id:"context-sources-header-text",className:lN().sectionHeaderText},b?oe.t("Context sources"):"Context sources"))),r.createElement(tS.$m,{"aria-labelledby":"context-sources-header-text",id:"context-sources-content"},r.createElement("div",{className:lN().contentSourcesContent},S&&S.length>0&&r.createElement(aj.v,{inputParameters:S,configuredParameters:n,onChange:i,variables:s,formatVariableBeforeInsert:c,callbackId:d,stepId:e.id,oAuthParameter:void 0}),r.createElement(KnowledgeSourcesCard,{segment:e,workflow:t,onChange:i,configuredParameters:n,inputParameters:l,variables:s}),r.createElement(u.Ay,{level:u.A_.info},b?oe.t("Links included in the prompt or additional context will not be crawled or used to generate responses."):"Links included in the prompt or additional context will not be crawled or used to generate responses.")))),r.createElement("div",{className:o()(lN().sectionContainer,lN().testPromptContainer,{[lN().expanded]:y})},r.createElement("div",{className:lN().sectionHeader},r.createElement(h.Nm,{onClick:w,className:lN().sectionHeaderContent,"aria-expanded":y,"aria-controls":"simulate-prompt-output-content"},r.createElement(p.Ah,{name:y?"caret-down-full":"caret-up-full"}),r.createElement("div",{id:"simulate-prompt-output-header-text",className:lN().sectionHeaderText},b?oe.t("Simulate prompt output"):"Simulate prompt output")),r.createElement(t7.Ay,{className:lN().sectionHeaderButton,onClick:T,disabled:a,type:"outline",size:"small"},r.createElement(p.Ah,{name:"ai-sparkle"}),oe.t("Run"))),r.createElement(TestPromptPanel,{segment:A,workflow:t,disabled:a,testKey:v})))};AiStepRightPanel.displayName="AiStepRightPanel";let ot=new c.Ay("workflow_builder"),AiStepDefaultModal=({title:e,onClose:t,icon:a,segment:n,onSave:i,workflow:s,speedBumpContext:c,saving:d=!1,saveError:u=null,renderSaveError:m,isExistingSegment:p=!1,isSegmentModified:b=!1,onNavigateBack:f})=>{let _=(0,M.d4)(N.dI),y=(0,e4.EM)(n),x=(0,e5.Dp)(n),v=(0,l.wA)(),{showSpeedBump:E}=(0,ae.k)(),{speedBumpState:w}=c,[S,T]=(0,r.useState)(k.A),L=(0,r.useCallback)(()=>{T((0,k.A)())},[]),{isValid:O=!1}=(0,C.Qk)(),[,F]=(0,r.useState)("0"),{onSubmit:D,shouldEnableSaveForInitialSubmit:P,hasBlockingError:R}=(0,I.b)(F),B=(0,e5.ln)(n),W=(0,r.useMemo)(()=>B?.map(e=>(0,eU.w)(e))||[],[B]),V=W?.find(e=>e.name===lA.c.PROMPT),H=W?.filter(e=>e.name!==lA.c.PROMPT),{configuredParameters:q,formatVariableBeforeInsert:U,onChange:z}=(({segment:e,variables:t,inputParameters:a,slackFunction:n})=>{let l=(0,C.rC)(),i=(0,M.d4)(N.$T),o=(0,r.useMemo)(()=>{let t={};return(0,ty.q2)(e)?n?(0,ty.Jl)(e,n,i):t:(a&&0!==a.length&&a.forEach(a=>{let n=(0,e5.RE)(e,a.name);n&&(t[a.name]=n)}),t)},[i,a,e,n]),s=(0,r.useCallback)((e,t)=>{let{source:a,sourceReference:r}=e;return("trigger"===a&&r&&l((0,A.aI)({value:r})),t?.skipMacro)?e:(0,e3.Xq)(e,{fromRichText:t?.isRichText,appId:n?.app_id,parameterType:t?.parameterType,stepId:n?.id,callbackId:n?.callback_id})},[n?.app_id,n?.id,n?.callback_id,l]),c=(0,r.useCallback)(e=>{let a=[],fillRequiredContextRecursively=(e,n,r=0)=>{r>=n||(e&&"object"==typeof e?Object.values(e):[e]).forEach(e=>{if("string"==typeof e&&(0,e0.cn)(e)){let n=(0,eX.x)(t.list,e);if(!n)return;"trigger"===n.source&&n.sourceReference&&a.push(n.sourceReference)}null!==e&&"object"==typeof e&&fillRequiredContextRecursively(e,n,r+1)})};fillRequiredContextRecursively(e,10),l((0,A.aI)({value:a}))},[l,t.list]);return{configuredParameters:o,formatVariableBeforeInsert:s,onChange:(0,r.useCallback)((e,t,a,n)=>{c(t),n?.dynamicInputState&&l((0,tG.T)({[e.name]:n.dynamicInputState})),l((0,tG.qq)({parameter:e,value:t,label:a,options:n,experimentThirdPartyUserFormParityGroupOn:i}))},[l,i,c])}})({segment:n,variables:y,inputParameters:B,slackFunction:(0,e5.P)(n)}),{hasError:j}=useKnowledgeSourceAlerts({segment:n,workflow:s,configuredParameters:q,variables:y}),G=(0,r.useMemo)(()=>{let e=b||!p,t=!d&&!R&&e&&O;return P||t},[d,R,O,p,b,P]),$=(0,r.useCallback)(()=>{!j&&(!O||P||d||i(),P&&D())},[j,O,P,d,i,D]);(0,r.useEffect)(()=>{E(w.isVisible??!1)},[w.isVisible,E]);let K=(0,r.useCallback)(()=>r.createElement(tS.ty,{heading:w.heading,cancelButtonLabel:w.cancelButtonLabel,continueButtonLabel:w.continueButtonLabel,continueButtonIsDisabled:w.continueButtonIsDisabled,continueButtonIsLoading:d,continueButtonType:w.continueButtonType,onCancel:w.onCancel,onContinue:w.onContinue,description:w.message}),[w.cancelButtonLabel,w.continueButtonIsDisabled,w.continueButtonLabel,w.continueButtonType,w.heading,w.message,w.onCancel,w.onContinue,d]),Y=(0,r.useMemo)(()=>V?.type===e6.HN.SlackTypesRichText?V:void 0,[V]),Q=(0,r.useMemo)(()=>r.createElement(AiPromptEditorModal,{parameter:Y,value:q[lA.c.PROMPT]?.value||g.Ml,onChange:z,variables:y,formatVariableBeforeInsert:U,parameters:W,configuredParameters:q,callbackId:x,experimentWfbAiAnswerStepGroupOn:_,onClose:L,allowVariables:!0,workflowId:s.workflow.id,segment:n}),[Y,q,z,y,U,W,x,_,L,s.workflow.id,n]),Z=(0,r.useCallback)(()=>{V&&Y&&v((0,ap.q)({element:Q,isStackable:!0}))},[V,Y,v,Q]),J=(0,r.useCallback)(()=>{f?.()},[f]),X=(0,r.useMemo)(()=>({segment:n,enableExpandCollapsePromptButton:!0,onExpandCollapsePromptClick:Z,onCollapsePromptClick:L,enablePromptToolsButton:!0,isPromptExpanded:!1}),[n,Z,L]);return r.createElement(r.Fragment,null,r.createElement(tS.rQ,null,f&&r.createElement(ai.E,{workflowId:s.workflow.id,onNavigateBack:J,isSegmentModal:!0}),r.createElement(tS.Rc,null,r.createElement("div",{className:o()(lN().modalTitleBarContentContainer,{[lN().hasNoBackButton]:!f})},r.createElement("div",{className:lN().modalTitleBarContentLeft},a,r.createElement("h1",{className:lN().modalTitleText},e))))),r.createElement("div",{className:lN().modalContent},r.createElement(FillParentContainer,null,r.createElement("div",{className:lN().inputParametersWrapper},r.createElement("div",{className:lN().promptInputWrapper},V&&Y&&r.createElement(CustomPromptInput,{key:S,labelClassName:lN().promptLabel,parameter:Y,value:q[lA.c.PROMPT]?.value||g.Ml,onChange:z,variables:y,formatVariableBeforeInsert:U,parameters:W,configuredParameters:q,callbackId:x,allowVariables:!0,required:Y.is_required,experimentWfbAiAnswerStepGroupOn:_,wfbAiPromptButtons:X}),u&&m&&r.createElement(tB.A,null,m(u))),r.createElement(AiStepRightPanel,{segment:n,workflow:s,testDisabled:d||R||!O||j,configuredParameters:q,nonPromptSlackFunctionParameters:H,onChange:z,variables:y,formatVariableBeforeInsert:U,callbackId:x})))),r.createElement(tS.jl,{renderSpeedBump:K},r.createElement(tS.ox,null,r.createElement(h.Ay,{type:"outline",onClick:t,disabled:d,"aria-label":ot.t("Cancel")},ot.t("Cancel")),r.createElement(h.lV,{type:"primary",loading:d,disabled:j||!G,"aria-describedby":j?ig:void 0,onClick:$,"aria-label":ot.t("Save")},ot.t("Save")))))};AiStepDefaultModal.displayName="AiStepDefaultModal";var oa=a(0x1f355b555),on=a(0x62eaf10),or=a.n(on);let loading_skeleton_LoadingSkeleton=()=>r.createElement(tS.qf,null,r.createElement("div",{"data-qa":"button-add-edit-modal-loading-skeleton",className:or().loadingSkeleton},r.createElement("div",{className:or().loadingContainer},r.createElement(eR.A,{width:"100%",height:140,borderRadius:4}),r.createElement("div",{className:or().label},r.createElement(eR.A,{width:"25%",height:22,borderRadius:4})),r.createElement("div",{className:"display_flex flex_direction_row gap_50"},r.createElement(eR.A,{width:"75%",height:36,borderRadius:4}),r.createElement(eR.A,{width:"25%",height:36,borderRadius:4})),r.createElement("div",{className:or().label},r.createElement(eR.A,{width:"25%",height:22,borderRadius:4})),r.createElement(eR.A,{width:"100%",height:36,borderRadius:4}),r.createElement("div",{className:or().label},r.createElement("div",{className:or().checkbox},r.createElement(eR.A,{width:"25%",height:36,borderRadius:4}),r.createElement(eR.A,{width:"25%",height:36,borderRadius:4}))),r.createElement("div",{className:or().label},r.createElement(eR.A,{width:"100%",height:6,borderRadius:4})))));loading_skeleton_LoadingSkeleton.displayName="LoadingSkeleton";var ol=a(0xc70ec6a6),oi=a.n(ol);let oo=new c.Ay("workflow_builder"),button_color_ButtonColorOptionLabel=({buttonStyle:e})=>r.createElement("div",{className:o()(oi().optionLabelColor,oi()[`optionLabelColor__${e}`])},r.createElement("span",{className:"offscreen"},{primary:oo.t("Primary (green)",{fallbackHash:"ba144ea01fa9962c0dbe1fe6c4c113d0063fa55f"}),outline:oo.t("Outline"),danger:oo.t("Danger (red)",{fallbackHash:"f99914a1464040a7af118f93747699cf8566efa3"})}[e]),r.createElement(p.Ah,{name:"formatting"}));button_color_ButtonColorOptionLabel.displayName="ButtonColorOptionLabel";let button_color_ButtonColor=({buttonStyle:e,handleChange:t})=>{let a=(0,r.useMemo)(()=>[{label:r.createElement(button_color_ButtonColorOptionLabel,{buttonStyle:"outline"}),value:"outline"},{label:r.createElement(button_color_ButtonColorOptionLabel,{buttonStyle:"primary"}),value:"primary"},{label:r.createElement(button_color_ButtonColorOptionLabel,{buttonStyle:"danger"}),value:"danger"}],[]),n=(0,r.useMemo)(()=>a.find(t=>t.value===(e??"outline")),[e,a]),l=(0,r.useCallback)(({value:e})=>{t("outline"===e?void 0:e)},[t]);return r.createElement(y.A,{"data-qa":"send-message-button-color",htmlFor:"send-message-button-color",text:oo.t("Color"),"aria-label":oo.t("Button Color",{fallbackHash:"1d0c8304baedcf8e3a78982c2e7c0b04622bf2a0",fallbackHashNs:"lists"}),className:""},r.createElement(ef.Ay,{options:a,width:"100",onOptionSelected:l,selectedOption:n}))};button_color_ButtonColor.displayName="ButtonColor";var os=a(0x234aee340),oc=a.n(os);let od=new c.Ay("workflow_builder"),ButtonConfigurations=({button:e,variables:t,onChange:a,onTypeChange:n,onBehaviourChange:l,formatVariableBeforeInsert:i,multipleContinueButtonsExist:o,continueButtonExists:s,hasDuplicateContinueLabel:c,isNestedStep:d})=>{let u=(0,r.useCallback)(t=>{a({text:{...e.text,text:t}})},[a,e]),m=(0,r.useCallback)(e=>l(e),[l]),p=(0,r.useCallback)(e=>n(e),[n]),b=(0,r.useCallback)(e=>a({style:e}),[a]),f=(0,r.useMemo)(()=>c?od.t("Please choose a different label, this one already exists."):"",[c]),g=od.t("Example: Continue");return r.createElement("div",{className:"padding_bottom_100"},r.createElement("div",{className:oc().buttonDisplayContainer},r.createElement("div",{className:oc().buttonLabel},r.createElement(y.A,{htmlFor:"message_button_label_input",text:od.t("Button label"),id:"message_button_label_label"}),r.createElement(tt.A,{autoFocus:!0,"data-qa":"send-message-button-text",isRequired:!0,name:"message_button_label_input",id:"message_button_label_input","aria-labelledby":"message_button_label_label",value:e?.text.text,placeholder:e?.text.text||g,onChange:u,maxCharacterLimit:nG.c$,minCharacterLimit:nG.CL,errorText:f,autoComplete:"off",useInlineAlert:!0})),r.createElement(button_color_ButtonColor,{handleChange:b,buttonStyle:e?.style})),r.createElement(ButtonConfiguration,{handleChange:m,handleTypeChange:p,button:e,variables:t,formatVariableBeforeInsert:i,continueButtonExists:s,multipleContinueButtonsExist:o,isNestedStep:d}))};ButtonConfigurations.displayName="ButtonConfigurations";var ou=a(0x93d35cfe),om=a(0x19a0423f0),op=a.n(om);let ob=new c.Ay("workflow_builder"),ButtonsPreview=({variables:e,buttons:t})=>{let a=ob.t("This is a preview of how your button looks in a message!"),n=(0,r.useMemo)(()=>(0,nd.hH)(t,a),[t,a]),l=(0,e2.j)(),i=(0,r.useMemo)(()=>(0,e8.BQ)(l),[l]),o=(0,r.useMemo)(()=>(0,e8.DU)(l),[l]),s=(0,r.useMemo)(()=>(0,e8.DY)(l),[l]);return r.createElement("div",{className:op().previewContainer},r.createElement(nc.X,{noPointerEvents:!0,isInert:!0},r.createElement(ou.Y,{blocks:n,dataList:e.list,workflowName:i,workflowIcon:o,workflowId:s})))};ButtonsPreview.displayName="ButtonsPreview";var of=a(0x1ad596f5f),og=a(0x6b359530),oh=a(0x235d78b7c),o_=a(0x88881d67),oy=a(0xf33a4f91),ox=a(0x1ba35eb3b),ov=a(0x4b32db5f),oE=a(0x10d53599f),ok=a(0x213c0555e),ow=a(0x19dc73101),oS=a(0x4f725d55),oC=a(0xd2fa49d0),oA=a(0xdcfa8f6a),oT=a.n(oA),oI=a(0x2310bfb55),oN=a.n(oI);let oM=new c.Ay("workflow_builder"),AllowedEntitiesConfigurationInput=({value:e,onChange:t,variables:a,formatVariableBeforeInsert:n})=>{let l=(0,E.A)(),[i,s]=(0,r.useState)(!!e),c=(0,r.useCallback)(()=>{t(i?void 0:{member_ids:[]}),s(!i)},[i,t]),d=oM.t("Select users"),{onVariableMenuOpen:u}=(0,nt.e)(),m=(0,r.useMemo)(()=>(0,af.A)(e?.member_ids)?[{id:"member_ids_is_required",message:oM.t("This field is required.")}]:[],[e]),{onBlur:p,okayToDisplay:b}=(0,I.K)({errorMessage:void 0,isErrored:m.length>0}),f=(0,r.useMemo)(()=>"string"==typeof e?.member_ids?[e?.member_ids]:e?.member_ids,[e?.member_ids]),[g,h]=(0,r.useState)(f),_=(0,r.useCallback)(e=>(p(),t({member_ids:e})),[p,t]),x=(0,r.useCallback)(e=>{if((0,e0.cn)(e)){let t=(0,eX.x)(a.list,e);return!!t&&t.isAvailable&&!t.isTombstone&&t.type===e6.TE.Array}return!1},[a]),v=(0,r.useCallback)(e=>{let t=e.map(e=>e.value),a=t;return h(t),t.some(e=>x(e))&&(a=1===t.length?t[0]:t.filter(e=>!(0,e0.cn)(e)||!x(e))),_(a)},[_,x]),k=(0,r.useCallback)((e,t)=>{let n=`${t}-${e}`,r=!1,l="string"==typeof e?e:String(e);if("string"==typeof e&&(0,e0.cn)(e)){let t=(0,eX.x)(a.list,e);if(!t)return{key:n,label:oM.t("Missing Data"),isError:!1,svgIcon:{name:"css"},value:e};if(l=t.label||l,r=!t.isAvailable||t.isTombstone,t.type===e6.TE.Array){let e=!!g&&g.length>1;l=oM.t("{selectedDataLabel} (multiple)",{selectedDataLabel:t.label}),r=r||e}return{key:n,label:l,svgIcon:{name:"css"},value:t.id,isError:r}}return{key:n,label:l,value:e,isError:r}},[a.list,g]),w=(0,r.useMemo)(()=>"object"==typeof g?g?.map(k):"string"==typeof e?.member_ids?[k(e?.member_ids,0)]:e?.member_ids.map(k),[k,e?.member_ids,g]),S=(0,r.useCallback)(e=>"array"===e.type?!e.items||"slack#/types/mixed"===e.items.type||(0,ox.WL)(e.items)||(0,ox.kv)(e.items):(0,ox.WL)(e)||(0,ox.kv)(e),[]),C=(0,r.useMemo)(()=>(0,o_.PW)(a.groups,S),[S,a.groups]),A=(0,r.useMemo)(()=>(0,ov.T)(C),[C]),T=(0,r.useCallback)(a=>{let r=n?.(a,{}).id??"",l=Array.from(e?.member_ids||[]),i=[...l,r];return l=Array.from(g||[]),i=a.type===e6.TE.Array?r:i,h([...l,r]),t({member_ids:i})},[n,e?.member_ids,t,g]),N=(0,r.useCallback)(e=>"string"==typeof e.value&&(0,oS.A)(e.value)?r.createElement(oE.A,{id:e.value,showAvatar:!0}):"string"==typeof e.value&&(0,oC.A)(e.value)?r.createElement(ok.A,{id:e.value,showDescription:!1}):e.data&&e.data.label?r.createElement(og.R,{data:e.data}):e.label,[]),M=(0,r.useCallback)((e,t)=>{let a=[],n=(0,of.A)(A,t);return n.length>0&&a.push(...n),e.length>0&&a.push(...e),lP.S.resolve(a)},[A]),L=(0,r.useMemo)(()=>{let e=oy.R_;return{...{...e,entities:{...e.entities,userGroups:{includeFromAnotherTeam:!0}}},filter:()=>!0}},[]),O=(0,r.useMemo)(()=>r.createElement(ow.h,{id:l,onSelectedItemsChange:v,placeholderText:d,renderOption:N,searcherOptions:L,selectedOptions:w,selectId:l,width:"100%",className:o()(oT().entity),isInvalid:b&&m.length>0,processOptions:M,errors:b?m:void 0,allowVariables:!0,expandOnFocus:!0,onBlur:p,isRequired:!0}),[l,m,b,p,v,M,N,L,w,d]),F=oM.t("Restrict to specific users"),D=r.createElement("span",{"aria-hidden":!0},oM.t("Only certain users can click the button")),P=r.createElement("span",{className:"offscreen",id:"button_user_acl-description"},oM.t("Only certain users can click the button"));return r.createElement("div",{className:"margin_bottom_100"},r.createElement(y.A,{htmlFor:"button_user_acl_label",className:nk().switch_container,type:"inline",text:F,subtext:D},P,r.createElement(nx.A,{isToggled:i,onChange:c,ariaLabel:F,ariaDescribedBy:"button_user_acl-description"})),i&&r.createElement("div",{className:"display_flex","data-qa":"array-input"},r.createElement("div",{className:oN().inline_width},O),r.createElement(oh.jx,{onSelect:T,data:a.groups,customDataFilter:S,renderIconInline:!0,onMenuTriggerClick:u,className:oN().dynamicDataMenuButton})))};AllowedEntitiesConfigurationInput.displayName="AllowedEntitiesConfigurationInput";var oL=a(0x1b1820b2c),oO=a(0x380ee7b0);let oF="RELATIVE",oD="FIXED",oP=new c.Ay("workflow_builder"),ButtonExpiryTimestampInput=({value:e,onChange:t,variables:a,isButtonExpired:n,formatVariableBeforeInsert:l})=>{let i=(0,E.A)(),o=(0,E.A)(),{viewOnly:s,onVariableMenuOpen:c}=(0,nt.e)(),[d,u]=(0,r.useState)(!!e),m=(0,r.useMemo)(()=>e&&(0,eG.r2)(a.list,String(e.timestamp)),[e,a.list]),p=a.list.find(e=>"event_timestamp"===e.name),b=(0,r.useCallback)(()=>{!0===d?t(void 0):t({type:oF,timestamp:p?.id||(0,oa.Ay)().unix(),after_days:30}),u(!d)},[d,t,p]),f=(0,r.useCallback)(({target:a})=>{let{value:n}=a,r=p&&n===oF?p.id:(0,oa.Ay)().unix();e&&t({...e,timestamp:r,type:n,after_days:n===oF?e.after_days??30:void 0})},[e,t,p]),g=(0,r.useCallback)(a=>{let n=l?.(a,{isRichText:!1,skipMacro:!0}).id??a.id;if(e)return t({...e,timestamp:n})},[l,e,t]),h=(0,r.useCallback)(a=>{if(e)return t({...e,timestamp:parseInt(a,10)||(0,oa.Ay)().unix()})},[t,e]),_=(0,r.useCallback)(e=>(0,ox.p0)(e),[]),x=(0,r.useCallback)(a=>{if(e)return t({...e,after_days:e?.type===oF?Number(a):void 0})},[t,e]),renderDatetimeInput=()=>r.createElement(r.Fragment,null,m?r.createElement("div",{className:nk().variableContainer},r.createElement(oO.P,{onChange:h,value:String(e?.timestamp??""),variables:a,customDataFilter:_,label:"button-expiry-timestamp",isDisabled:s,formatVariableBeforeInsert:l,parameterType:e6.TE.SlackTypesTimestamp})):r.createElement("div",{className:nk().timestampWrapper},r.createElement(oL.A,{id:i,className:nk().timestampInlineDateTimePicker,onChange:h,valueFormat:"X",value:String(e?.timestamp??""),"aria-label":"button-expiry-timestamp",isRequired:!0,showTimeZone:!1,disabled:s,isInvalid:n}),r.createElement(oh.jx,{onSelect:g,data:a.groups,customDataFilter:_,renderIconInline:!0,isDisabled:s,onMenuTriggerClick:c}))),v=oP.t("Expires"),k=r.createElement("span",{"aria-hidden":!0},oP.t("Disable button on a certain date")),w=r.createElement("span",{className:"offscreen",id:"button_expires-description"},oP.t("Disable button on a certain date"));return r.createElement(r.Fragment,null,r.createElement(y.A,{htmlFor:"button_expires_label",className:nk().switch_container,type:"inline",text:v,subtext:k},w,r.createElement(nx.A,{isToggled:d,onChange:b,ariaLabel:v,ariaDescribedBy:"button_expires-description"})),d&&r.createElement(tJ.A,{className:"margin_bottom_100","data-qa":""},r.createElement(y.A,{className:"margin_top_25",text:oP.t("Days after a certain date"),type:"inline",cursor:"pointer"},r.createElement(t2.A,{checked:e?.type===oF,onChange:f,"data-qa":"button-expiry-relative",value:oF})),e?.type===oF&&r.createElement("div",{className:nk().relativeExpiryContainer},r.createElement("div",{className:nk().afterDaysContainer},r.createElement(tt.A,{id:o,min:1,max:365,name:"after_days",value:e?.after_days??1,onChange:x,type:"number",placeholder:"Days",className:nk().afterDays,suffix:e?.after_days===1?"day":"days"}),r.createElement("span",{className:"margin_left_50"},oP.t("after"))),renderDatetimeInput()),r.createElement(y.A,{text:oP.t("On a certain date"),type:"inline",cursor:"pointer"},r.createElement(t2.A,{checked:e?.type===oD,onChange:f,"data-qa":"button-expiry-fixed",value:oD})),e?.type===oD&&renderDatetimeInput()))};ButtonExpiryTimestampInput.displayName="ButtonExpiryTimestampInput";let InteractivityConfiguration=({interactivityConfig:e={is_button_multi_click:!1,expiry:void 0,allowed_entities:void 0},onChange:t,variables:a,formatVariableBeforeInsert:n,isButtonExpired:l})=>{let i=e?.allowed_entities,o=e?.expiry,s=(0,r.useCallback)(a=>t({...e,allowed_entities:a}),[t,e]),c=(0,r.useCallback)(a=>t({...e,expiry:a?{...e.expiry,...a}:void 0}),[t,e]);return r.createElement(r.Fragment,null,r.createElement(AllowedEntitiesConfigurationInput,{value:i,onChange:s,variables:a,formatVariableBeforeInsert:n}),r.createElement(ButtonExpiryTimestampInput,{value:o,onChange:c,variables:a,formatVariableBeforeInsert:n,isButtonExpired:l}))};InteractivityConfiguration.displayName="InteractivityConfiguration";let oR=new c.Ay("workflow_builder"),ButtonClickTypeConfiguration=({isMultiClick:e,isMutuallyExclusive:t,onChange:a})=>{let n=(0,r.useCallback)(()=>a({is_button_multi_click:!e}),[a,e]),l=oR.t("Single-click"),i=r.createElement("span",{"aria-hidden":!0},oR.t("Button can only be clicked once")),o=r.createElement("span",{className:"offscreen",id:"button_click_type-description"},oR.t("Button can only be clicked once"));return r.createElement("div",{className:"margin_top_50 margin_bottom_100"},r.createElement(y.A,{htmlFor:"button_click_type_label",className:nk().switch_container,type:"inline",text:oR.t("Single-click"),subtext:i},o,r.createElement(nx.A,{isToggled:!e,onChange:n,ariaLabel:l,isDisabled:t,ariaDescribedBy:"button_click_type-description"})))};ButtonClickTypeConfiguration.displayName="ButtonClickTypeConfiguration";let oB=new c.Ay("workflow_builder"),ButtonsAddEditModal=({buttonIndex:e=-1,operation:t,segment:a,switchPane:n,formatVariableBeforeInsert:l,onChange:i,afterStepId:o,isExistingSegment:s})=>{let[c,d]=(0,r.useState)(!1),u=(0,e4.EM)(a),m=((0,e5.RE)(a,nv.z.INTERACTIVE_BLOCKS)?.value??[]).find(e=>"actions"===e.type),b=(0,r.useMemo)(()=>m?.elements||[],[m?.elements]),f=(0,r.useMemo)(()=>(0,e5.RE)(a,nv.z.INTERACTIVITY_CONFIGURATION)?.value||{},[a]),g=(0,e2.j)(),_=(0,e8.W0)(s?a.id:o,g),y=b[e],v=f?.actions?.[y?.action_id],[E,k]=(0,r.useState)(y),[w,S]=(0,r.useState)(v),C=b.map((t,a)=>e===a?E:t),A=w?.is_button_multi_click??!1,T=w?.is_mutually_exclusive??!1,{speedBumpState:I,closeSpeedBump:N,openSpeedBump:M}=(0,tw.v)(),[L,O]=(0,r.useState)("edit"===t),F=(0,r.useCallback)(()=>{n&&n(tg.k.DEFAULT)},[n]),D=!(E&&"url"in E||E?.type==="workflow_button"),P=(0,r.useCallback)(()=>{if(!D){let e={actions:{...f.actions,[E?.action_id]:{is_button_multi_click:!0}}};i&&i(C,e)}O(!L)},[L,O,D,E,f,i,C]),R=(0,r.useCallback)(()=>{let e={actions:{...f.actions,[E?.action_id]:w}};i&&i(C,e)},[E,i,C,w,f]),B=(0,r.useCallback)(()=>{let t=b.filter((t,a)=>a!==e),a={actions:(0,nl.A)(f.actions,E?.action_id)};i&&i(t,a)},[f,E,i,b,e]),W=(0,r.useCallback)(e=>{k({...E,...e,text:{...E?.text,...e?.text}})},[E,k]),V=(0,r.useCallback)(e=>{let t={...E};switch(e){case"workflow_button":t.type=e,"value"in t&&delete t.value,"url"in t&&delete t.url;break;case"link":t.type="button",t.url="",delete t.workflow,"value"in t&&delete t.value;break;default:t.type=e,t.value="button","url"in t&&delete t.url}k(t);let a={...w,is_mutually_exclusive:T,is_button_multi_click:A};if((0,nd.O0)(t)&&!(0,nd.O0)(E)){let e=Object.values(f.actions||{}).some(e=>e.is_mutually_exclusive);a.is_mutually_exclusive=e,a.is_button_multi_click=!e&&A}S(a)},[E,k,f,A,T,w]),H=(0,r.useCallback)(e=>{S({...w,...e})},[w,S]),q=(0,r.useMemo)(()=>{let e=w?.expiry;if("number"!=typeof e?.timestamp)return!1;if(e?.type===oD)return e?.timestamp<(0,oa.Ay)().unix();let t=e?.after_days??1;return(e?.timestamp??0)+24*t*3600<(0,oa.Ay)().unix()},[w]),U=(0,r.useMemo)(()=>(0,nS.P6)(C),[C]),z=(0,r.useMemo)(()=>{let e=E?.text.text.length>nG.c$||E?.text.text.length<nG.CL,t=!!E&&"url"in E&&!(0,nB.A)(E.url),a=E?.type==="workflow_button"&&!E.workflow?.trigger?.url,n=!!w?.allowed_entities&&(0,af.A)(w?.allowed_entities?.member_ids),r=!!w?.expiry&&!w?.expiry?.timestamp;return e||a||t||n||r||q||U},[E,w,q,U]),j=(0,r.useCallback)(()=>{(0,rm.A)(y,E)&&(0,rm.A)(v,w)&&!z&&"add"!==t?F():M()},[y,E,v,w,M,F,t,z]),G=(0,r.useCallback)(()=>{(0,rm.A)(y,E)&&(0,rm.A)(v,w)||R(),F()},[y,E,v,w,R,F]),$=(0,r.useCallback)(()=>{let e="primary";switch(y&&y.style){case"primary":e="danger";break;case"danger":e=void 0}let t=(0,nS.OK)(!1,"",e),a=(0,nd.A6)(t.action_id,"callbackId",{actions:{...f.actions,[y.action_id]:w}},T);i?.([...C,t],a),t&&t?.action_id&&(k(t),S(a.actions[t?.action_id]),O(!1)),d(!0),n?.(tg.k.INTERACTIVE_BLOCKS_ADD_EDIT,{buttonIndex:b.length,formatVariableBeforeInsert:l,onChange:i}),setTimeout(()=>{d(!1)},300)},[y,w,C,f.actions,T,i,n,b.length,l]),K=(0,r.useCallback)(()=>{N()},[N]),Y=(0,r.useCallback)(()=>{"add"===t&&B(),F()},[B,t,F]),Q=(0,r.useMemo)(()=>r.createElement(x.A,{onClick:j,"aria-label":oB.t("Back")},r.createElement(p.Ah,{name:"caret-left-full",size:"20"})),[j]);(0,tk.M)("keyup",e=>{e.key===tC.D.ESCAPE&&j()});let Z=oB.t("Hide advanced options"),J=oB.t("Advanced options"),X=oB.t("Edit button"),ee=oB.t("Add button"),et="edit"===t?X:ee,ea=(0,nd.AI)(b),en=(0,nd.fd)(b);return r.createElement(r.Fragment,null,r.createElement(tS.rQ,null,r.createElement(tS.Rc,{title:et,icon:Q})),r.createElement(tS.$m,{className:"c-buttons-add-edit-modal__content"},c?r.createElement(loading_skeleton_LoadingSkeleton,null):r.createElement(r.Fragment,null,r.createElement(ButtonsPreview,{variables:u,buttons:C}),r.createElement(tS.qf,null,r.createElement(ButtonConfigurations,{button:E,variables:u,onChange:W,onTypeChange:V,onBehaviourChange:W,formatVariableBeforeInsert:l,multipleContinueButtonsExist:en,continueButtonExists:ea,hasDuplicateContinueLabel:U,isNestedStep:_}),D&&r.createElement(ButtonClickTypeConfiguration,{isMultiClick:A,isMutuallyExclusive:T,onChange:H})),D&&r.createElement(tS.qf,null,r.createElement(h.Nm,{"data-qa":"advanced-options",onClick:P,className:or().advancedOptions,id:"advanced-options-disclosure-control","aria-label":J,"aria-expanded":L},r.createElement("span",{className:or().advancedOptionsLabel},L?Z:J),r.createElement("hr",{"aria-hidden":!0,className:or().hr})),L&&r.createElement("div",{role:"group","aria-labelledby":"advanced-options-disclosure-control",hidden:!L},r.createElement(InteractivityConfiguration,{interactivityConfig:w,onChange:H,variables:u,isButtonExpired:q,formatVariableBeforeInsert:l}))))),I.isVisible?r.createElement(tS.ty,{heading:oB.t("Discard changes?"),description:oB.t("Your changes will not be saved."),cancelButtonLabel:oB.t("Keep Editing"),continueButtonLabel:oB.t("Close and Discard"),onCancel:K,onContinue:Y}):r.createElement(tS.jl,null,r.createElement(h.Ay,{type:"outline",onClick:$,disabled:z||b.length>=5},oB.t("Add Another Button")),r.createElement(tS.ox,null,r.createElement(h.Ay,{type:"primary",onClick:G,disabled:z},oB.t("Done")))))};ButtonsAddEditModal.displayName="ButtonsAddEditModal";var oW=a(0x1ee062b2e),oV=a(0x242503693),oH=a(0x16349a51f),oq=a(0x16ffed5ab),oU=a(0xf8631f1b),oz=a.n(oU);let oj=new c.Ay("workflow_builder"),MultiPaneSegmentFormModal=({onCancel:e,onSave:t,renderSaveError:a,segment:n,submitLabel:i,cancelLabel:c,afterStepId:f,isExistingSegment:g,isTrigger:h=!1,defaultPane:_=tg.k.DEFAULT,onNavigateBack:y})=>{let x=(0,nR.A)(),v=(0,l.wA)(),E=(0,e2.j)(),k=(0,e8.DY)(E),w=(0,M.d4)(N.Lh),{transitionFocusTo:A}=(0,r.useContext)(d.Ay),I=!!E&&(0,tM.I)(E.workflow.steps||[]).length>0,L=n?.type,O=(0,lp.E)(n),F=(0,t$.GS)(n),D=F?(0,e5.Dp)(n):void 0,P=F?(0,e5.P)(n):void 0,R=!!E&&(0,e8.a6)(E),B=(0,M.d4)(N.tQ),W=useTriggerDisplayContent()(n),V=(0,M.d4)(e=>P?.title??(0,th.Kb)(e,{type:n.type,subtype:O})??""),H=V;h&&!R&&(H=W.label||oj.t("Change how this workflow starts"));let q=(0,r.useMemo)(()=>I,[I]),U=useSegmentReducer(getSegmentReducer(n,{},D),n),[z,j]=U,G=(0,r.useRef)(z.segment),$=(0,r.useRef)(z);$.current=z;let K=(0,ty.q2)($.current.segment),Y=(0,ty.RK)($.current.segment);useSegmentFormInitializer({isOpenForm:K,segment:$.current.segment});let Q=(0,tw.v)(),{closeSpeedBump:Z,openSpeedBump:J}=Q,[X,ee]=(0,r.useState)(!1),[et,ea]=(0,r.useState)(null),en=((e,t,a,n)=>{if(n)return!!a&&a.trigger?.type!==t.type||!(0,rm.A)({...t.config,url:void 0},{...e.config,url:void 0});let r=excludeFieldsForComparison(e),l=(e=>{let{type:t,id:a,derived:n,config:r,coachmarkText:l,...i}=e;return{type:t,id:a,config:r,..."coachmarkText"in e&&{coachmarkText:l},..."derived"in e&&{derived:n},..."stepType"in i&&{stepType:i.stepType},..."subtype"in i&&{subtype:i.subtype}}})(excludeFieldsForComparison((e=>{if(!(0,t$.GS)(e))return e;let t={...e.config.inputs};return e.config.slackFunction?.input_parameters.forEach(e=>{var a;(e.type===e6.TE.SlackTypesRichText||e.type===e6.TE.SlackTypesExpandedRichText||e.type===e6.TE.SlackTypesBlocks)&&t[e.name]&&(t[e.name]={...t[e.name],value:Array.isArray(a=t[e.name].value)&&0===a.length?null:a})}),{...e,config:{...e.config,inputs:t}}})(t)));return!(0,rm.A)(r,l)})(G.current,$.current.segment,E,h),er=((e,t)=>{if((0,rY.Z)(t)&&(0,rY.Z)(e)){let a=(0,rK.ln)(e)?.find(({type:e})=>e===e6.TE.SlackTypesCredentialOauth2);if(!a)return!1;let n=(0,rK.RE)(e,a.name)?.value,r=(0,rK.RE)(t,a.name)?.value;return n?.external_token_id!==r?.external_token_id}if((0,t$.GS)(t)&&(0,t$.GS)(e)){let a=(0,e5.ln)(e)?.find(({type:e})=>e===e6.TE.SlackTypesCredentialOauth2);if(!a)return!1;let n=(0,e5.RE)(e,a.name)?.value,r=(0,e5.RE)(t,a.name)?.value;return n?.external_token_id!==r?.external_token_id}return!1})(G.current,$.current.segment),el=(0,r.useMemo)(()=>{let e=g?aE.KC.EditStep:aE.KC.AddStep,t=h&&n.config&&"event"in n.config?n.config.event?.eventType:void 0;return{elementName:h?aE.KC.EditTrigger:e,workflowBuilderStepType:h?L:D,workflowBuilderTriggerSubtype:t?(0,oW.y)(t):void 0,workflowBuilderWorkflowId:k}},[g,h,L,D,n.config,k]),ei=(0,r.useCallback)(()=>{(0,lE.tv)({workflowId:k||"",segmentId:h?lo.m.TRIGGER:n.id,level:u.A_.success})},[h,n.id,k]),eo=(0,r.useCallback)(()=>{let e;if(h||(e=oj.rt('"{segmentTitle}" step added',{segmentTitle:V})),g&&(e=h?oj.t("Workflow start has been updated"):oj.rt('"{segmentTitle}" step updated',{segmentTitle:V})),e)return v((0,oq.M)({element:r.createElement(b.A,null,e)}))},[v,g,h,V]),es=(0,r.useCallback)(()=>{ea(null),ee(!0);let e=(0,t$.GS)($.current.segment)&&(0,e5.mV)($.current.segment)&&!(0,ty.q2)($.current.segment)&&(0,t$.GS)($.current.segment)?(0,ty.$c)($.current.segment):$.current.segment;t(e).then(()=>v((0,lT.O)())).then(ei).then(()=>ee(!1)).then(()=>eo()).then(()=>{h||A({focusKey:oV.Ay.PAGE_CONTENT_WORKFLOW_EDITOR_STEP_PREVIEW,focusMetadata:{id:e.id}})}).catch(e=>{ea({...e,name:e.name}),ee(!1),Z()})},[t,ei,v,eo,A,h,Z]),ec=(0,r.useCallback)(()=>{let t=h&&n.config&&"event"in n.config?n.config.event?.eventType:void 0;(0,aE.ft)({clogger:x,wbArgs:{workflow_id:k,is_hermes:!0,...h&&t&&{trigger_subtype:(0,oW.y)(t)}}}),e&&e(),v((0,lT.O)()),v((0,oH.dV)(G.current.id)),v((0,r2.br)({workflowId:k||""}))},[x,k,e,v,h,n.config]),ed=(0,r.useCallback)(()=>{en?J({heading:oj.t("Discard changes?"),message:oj.rt("Your work will not be saved."),onCancel:Z,onContinue:()=>{if(ec(),!g){let e=h?ls.hf:f||ls.kr;A({focusKey:oV.Ay.PAGE_CONTENT_WORKFLOW_EDITOR_STEP_PREVIEW,focusMetadata:{id:e}})}}}):ec()},[en,ec,J,Z,h,g,A,f]),eu=n?.type===rs.SJ,em=P?.app_id,ep=(0,r.useMemo)(()=>{if(W.icon)return W.icon;if(em)return r.createElement("span",{className:oz().title_icon},r.createElement(T.z,{appId:em}));let e=P?.callback_id??"";(0,nu.Ag)(n)&&(e=li.ad);let t=(0,S.m)(e);return e?r.createElement("span",{className:oz().title_icon},r.createElement(p.Ah,{"data-qa":"svg-icon",name:t,size:"20"})):null},[W.icon,em,P?.callback_id,n]),eb=(0,r.useCallback)(({activePane:e,switchPane:t})=>r.createElement(SegmentFormModal,{title:H,icon:ep,onSave:es,onClose:ed,saving:X,saveError:et,renderSaveError:a,segment:n,submitLabel:i,cancelLabel:c,afterStepId:f,currentSegmentState:$.current.segment,segmentReducer:U,speedBumpContext:Q,isTrigger:h,isExistingSegment:g,isAuthTokenModified:er,isSegmentModified:en,baseAutoClogProps:el,switchPane:t,activePane:e,onNavigateBack:y}),[H,ep,es,ed,X,et,a,n,i,c,f,U,Q,h,g,er,en,el,y]),ef=(0,r.useMemo)(()=>({[tg.k.DEFAULT]:{render:({switchPane:e})=>eb({switchPane:e,activePane:tg.k.DEFAULT}),modalProps:{contentLabel:V}},[tg.k.THIRD_PARTY_USER_FORM_CONFIG]:{render:({switchPane:e})=>eb({switchPane:e,activePane:tg.k.THIRD_PARTY_USER_FORM_CONFIG}),modalProps:{contentLabel:V}},[tg.k.FORM_WRAPPED_SELECTION]:{render:({switchPane:e})=>r.createElement(FormWrappedSelectionModal,{title:H,icon:ep,onClose:ed,switchPane:e,appId:em,segment:n,activePane:tg.k.FORM_WRAPPED_SELECTION}),modalProps:{contentLabel:V}},[tg.k.PARENT_INPUTS]:{render:({switchPane:e})=>eb({switchPane:e,activePane:tg.k.PARENT_INPUTS}),modalProps:{contentLabel:V}},[tg.k.CHILD_INPUTS]:{render:({switchPane:e})=>eb({switchPane:e,activePane:tg.k.CHILD_INPUTS}),modalProps:{contentLabel:V}},[tg.k.FORM_WRAPPED_INPUTS]:{render:({switchPane:e})=>r.createElement(FormWrappedInputsModal,{title:H,icon:ep,onSave:es,onClose:ed,saving:X,saveError:et,renderSaveError:a,segment:$.current.segment,submitLabel:i,cancelLabel:c,segmentReducer:U,speedBumpContext:Q,isExistingSegment:g,isSegmentModified:en,baseAutoClogProps:el,switchPane:e}),modalProps:{contentLabel:V}},[tg.k.OPEN_FORM_QUESTION_EDIT]:{render:({switchPane:e,questionIndex:t})=>K&&(0,t$.GS)($.current.segment)?r.createElement(QuestionEditModal,{questionIndex:t,switchPane:e,segment:$.current.segment}):null,modalProps:{contentLabel:V,showCloseButton:!1,shouldCloseOnOverlayClick:!1,closeModal:()=>{}}},[tg.k.INTERACTIVE_BLOCKS_ADD_EDIT]:{render:({switchPane:e,buttonIndex:t,operation:a,formatVariableBeforeInsert:n,onChange:l})=>Y&&(0,t$.GS)($.current.segment)?r.createElement(ButtonsAddEditModal,{buttonIndex:t,switchPane:e,operation:a??"add",segment:$.current.segment,formatVariableBeforeInsert:n,onChange:l,afterStepId:f,isExistingSegment:g}):null,modalProps:{contentLabel:V,showCloseButton:!1,shouldCloseOnOverlayClick:!1,closeModal:()=>{}}},[tg.k.FORM_LOADING_SCREEN]:{render:({switchPane:e,heading:t,redirectPane:a})=>r.createElement(FormLoadingScreen,{switchPane:e,heading:t,redirectPane:a??tg.k.DEFAULT}),modalProps:{contentLabel:V,showCloseButton:!1,shouldCloseOnOverlayClick:!1,closeModal:()=>{}}},[tg.k.AI_STEP_DEFAULT]:{render:({switchPane:e})=>(0,t$.GS)($.current.segment)?r.createElement(AiStepDefaultModal,{title:V,icon:ep,switchPane:e,onClose:ed,onSave:es,segment:$.current.segment,workflow:E,speedBumpContext:Q,saving:X,saveError:et,renderSaveError:a,isExistingSegment:g,isSegmentModified:en,onNavigateBack:y}):null,modalProps:{contentLabel:V,showCloseButton:!0,shouldCloseOnOverlayClick:!0,fullscreen:!0,maxWidth:1024}}}),[V,eb,H,ep,ed,em,n,es,X,et,a,i,c,U,Q,g,en,el,K,Y,f,E,y]),eg=(0,r.useMemo)(()=>r.createElement(m.A,{panes:ef,defaultPane:_,onClose:ed,forceSpeedBumpEnabled:!0,shouldCloseOnOverlayClick:!X,maxWidth:eu?1200:void 0,className:"c-segment_modal--hermes_workflow",dataQa:h?"trigger-modal":"step-modal",centered:!B,overlayClassName:o()({[oz().modal_overlay]:B})}),[_,B,eu,h,X,ed,ef]);return r.createElement(s.A,{eventId:tK.EventId.WORKFLOW_BUILDER,uiStep:tK.UiStep.WORKFLOW_EDITOR,...el},r.createElement(C.us.Provider,{value:Q},r.createElement(ValidationProvider,{computed:z.computed},r.createElement(C.ZH.Provider,{value:j},w&&r.createElement(e2.X.Provider,{value:E},r.createElement(tj.U.Provider,{value:q},eg)),!w&&eg))))};MultiPaneSegmentFormModal.displayName="MultiPaneSegmentFormModal"},0x426feba4:(e,t,a)=>{"use strict";a.d(t,{l:()=>UpdateTriggerErrorMessage,y:()=>SaveNewWorkflowErrorMessage});var n=a(0xbad225b5);let r=new(a(0x20482ad21)).Ay("workflow_builder"),SaveNewWorkflowErrorMessage=({error:e})=>{let t="default";return(e||{}).name,t=r.t("Sorry, there was a problem trying to save your workflow."),n.createElement("span",null,t)};SaveNewWorkflowErrorMessage.displayName="SaveNewWorkflowErrorMessage";let UpdateTriggerErrorMessage=({error:e})=>{let t="";return t="insufficient_posting_permissions"===(e||{}).name?r.t("You don\u2019t have posting permissions for one or more channels in this trigger.",{fallbackHash:"c2fdb696683556283da97a9f3184ad82dcf1f622",fallbackHashNs:"workflow_builder"}):r.t("Sorry, there was a problem trying to update your trigger."),n.createElement("span",null,t)};UpdateTriggerErrorMessage.displayName="UpdateTriggerErrorMessage"},0x22c41b907:(e,t,a)=>{"use strict";a.d(t,{k:()=>n});let n={DEFAULT:"default",PARENT_INPUTS:"parent-inputs",CHILD_INPUTS:"child-inputs",OPEN_FORM_QUESTION_EDIT:"open-form-question-edit",FORM_WRAPPED_INPUTS:"form-wrapped-inputs",INTERACTIVE_BLOCKS_ADD_EDIT:"interactive-blocks-add-edit",FORM_WRAPPED_SELECTION:"form-wrapped-selection",THIRD_PARTY_USER_FORM_CONFIG:"third-party-user-form-config",FORM_LOADING_SCREEN:"form-loading-screen",AI_STEP_DEFAULT:"ai-step-default"}},0x161478d06:(e,t,a)=>{"use strict";a.d(t,{$:()=>SegmentFormWrapper});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1407c6c2c),o=a(0x20482ad21),s=a(0x1d2cd7755),c=a(0x10598eeca),d=a(0x88dc61ea),u=a(0x106f35107),m=a(0x63978f20),p=a.n(m);let b=new o.Ay("workflow_builder"),f={display:"none"};(function CoachmarkEditField({coachmarkText:e,onUpdateCoachmarkText:t}){let a=(0,i.A)();return n.createElement(s.A,{htmlFor:a,text:"Edit Coachmark"},n.createElement(c.A,{id:a,value:e,onChange:t}))}).displayName="CoachmarkEditField";let SegmentFormWrapper=({children:e,noSubmit:t=!1,noPadding:a=!1,className:r,segment:i})=>{let o=(0,d.Hj)(),s=(0,d.rC)(),c=(i?.coachmarkText,(0,n.useCallback)(e=>{s((0,u.RJ)({coachmarkData:e}))},[s]),n.createElement(n.Fragment,null,e,!1));return n.createElement("div",{"data-qa":"segment-form-wrapper",className:l()({[p().withPadding]:!a},r)},t?c:n.createElement("form",{onSubmit:o},c,n.createElement("button",{style:f,type:"submit"},b.t("Submit"))))};SegmentFormWrapper.displayName="SegmentFormWrapper"},0x6713bca9:(e,t,a)=>{"use strict";a.d(t,{J:()=>SegmentIcon});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x344bb842),o=a(0x2501a2cee),s=a(0x4c96e5d9),c=a(0x12cef2078),d=a(0x1f495452e),u=a.n(d);let SegmentIcon=({icon:e,isFocusedOrHovering:t})=>{if(e&&"object"==typeof e&&"onClick"in e&&void 0!==e?.onClick){let{label:a,onClick:r,svgIconProps:o,svgIconPropsOnHover:d}=e,m=l()(u().outline_container,u().with_background,{[u().show_outline]:t}),p=d&&t?d:o,b={"aria-controls":e["aria-controls"],"aria-expanded":e["aria-expanded"]};return n.createElement(c.X,{preventDefault:!0,stopPropagation:!1},n.createElement("div",{className:m},n.createElement(s.Ay,{tip:a,delay:s.PK},n.createElement(i.A,{svgIconProps:p,"aria-label":a,onClick:r,className:u().icon_button,ref:"ref"in e?e.ref:void 0,...b}))))}return(0,n.isValidElement)(e)?e:n.createElement("div",{className:u().container,"data-qa":"segment-icon"},n.createElement(o.Ah,{name:e,size:"20"}))};SegmentIcon.displayName="SegmentIcon"},0x240c7a514:(e,t,a)=>{"use strict";a.d(t,{H8:()=>getStepMenuButtons,Xw:()=>getTriggerMenuButtons,iT:()=>buildStepButtons,jh:()=>hasPermissionsForSegment,rz:()=>getSegmentPreviewIcon,so:()=>getNextStepActionSubtitle});var n=a(0xbad225b5),r=a(0xbe0b63ff),l=a(0x20482ad21),i=a(0x210b99e76),o=a(0x1bffa495d),s=a(0x1c27a9e4a),c=a(0xaaa6bbd0),d=a(0x171a52b74),u=a(0x20d4168fd),m=a(0x154dd8295),p=a(0x24e22e0a6),b=a(0x23a4b0853),f=a(0x1d3efd4ea),g=a(0x1d9a37519),h=a(0x184767f39),_=a(0x1e9a6d1d),y=a(0x148f558fa),x=a.n(y);let{INIT_APP_REQUEST_FLOW:v,INSTALL_SHOW_STEP_FUNCTION:E,SHOW_STEP_FUNCTION:k,APP_DENIED:w,APP_REQUEST_IS_PENDING:S}=h.pY,C=new l.Ay("workflow_builder"),buildStepButtons=({methods:{onEdit:e,onAboutClick:t,onDelete:a,onMoveUp:r,onMoveDown:l,onAddBranch:i,onDuplicate:o},viewOnly:s,segment:c,branchNameFallback:p,hasMaxNumberOfSteps:f,maxNumberOfSteps:g})=>{let h="";(0,d.GS)(c)&&(h=c?.config?.slackFunction?.title??"");let _=C.t("Move {stepTitle} step up",{stepTitle:h}),y=C.t("Move {stepTitle} step down",{stepTitle:h}),x=C.t("Edit {stepTitle} step",{stepTitle:h}),v=C.t("View {stepTitle} step",{stepTitle:h}),E=C.t("Delete {stepTitle} step",{stepTitle:h}),k=C.t("Duplicate {stepTitle} step",{stepTitle:h}),w=C.t("Add a branch");if((0,m.Ag)(c)){let e=(0,u.At)(c);h=e?e?C.t("{branchName} branch",{branchName:e}):"":p??"",_=C.t("Move {stepTitle} up",{stepTitle:h,fallbackHash:"b4f57cd0cd5c7d88461c1718646713dea47a36c9"}),y=C.t("Move {stepTitle} down",{stepTitle:h,fallbackHash:"260ff8ae7182fc851337b6b2fdb25f8cac2b8d47"}),x=C.t("Edit {stepTitle}",{stepTitle:h,fallbackHash:"2c79c2f8fe6cef139b77391f6699a0512a187188"}),v=C.t("View {stepTitle}",{stepTitle:h,fallbackHash:"dcad67b0405f9754a0d00a9f9fc2cb144f73c98a"}),E=C.t("Delete {stepTitle}",{stepTitle:h,fallbackHash:"0294209f799931433e4e7346620d4304addd4900"}),k=C.t("Duplicate {stepTitle}",{stepTitle:h,fallbackHash:"c37523340d01438b5ca803203fa36081df3a6629"})}return Object.fromEntries(Object.entries({moveUp:{tooltip:n.createElement("span",{"aria-hidden":!0},C.t("Move up")),onClick:r,ariaLabel:_,autoClogProps:{elementName:b.KC.MoveStepUp,onClick:{enableClogAction:!0}}},moveDown:{tooltip:n.createElement("span",{"aria-hidden":!0},C.t("Move down")),onClick:l,ariaLabel:y,autoClogProps:{elementName:b.KC.MoveStepDown,onClick:{enableClogAction:!0}}},edit:{tooltip:n.createElement("span",{"aria-hidden":!0},s?C.t("View"):C.t("Edit")),onClick:e,ariaLabel:s?v:x,autoClogProps:{elementName:b.KC.EditStep,onClick:{enableClogAction:!0}}},about:{tooltip:n.createElement("span",{"aria-hidden":!0},C.t("About this step")),onClick:t,ariaLabel:C.t("About this step")},remove:{tooltip:n.createElement("span",{"aria-hidden":!0},C.t("Delete")),onClick:a,ariaLabel:E,autoClogProps:{elementName:b.KC.DeleteStep,onClick:{enableClogAction:!0}}},addBranch:{tooltip:w,onClick:i,ariaLabel:w,autoClogProps:{elementName:b.KC.AddBranch,onClick:{enableClogAction:!0}}},duplicate:{tooltip:f?C.t("Workflow has reached {max_number_of_steps}-step limit",{max_number_of_steps:g,fallbackHash:"732ddc07733ebd62fa52955da986308c3c54ea06"}):C.t("Duplicate"),onClick:o,isDisabled:f,ariaLabel:k,autoClogProps:{elementName:b.KC.DuplicateStep,onClick:{enableClogAction:!0}}}}).filter(([,{onClick:e}])=>!!e))};buildStepButtons.displayName="buildStepButtons";let getTriggerMenuButtons=({edit:e,copy:t},a)=>[...a?[{key:"segment_copy_link_btn",tooltip:t.tooltip,onClick:t.onClick,ariaLabel:t.ariaLabel,dataQa:"segment_copy_link_btn",dataId:"segment_copy_link_btn",svgIconProps:{name:"link",size:"20"}}]:[],{key:"segment_edit_btn",tooltip:e.tooltip,onClick:e.onClick,ariaLabel:e.ariaLabel,dataQa:"segment_edit_btn",dataId:"segment_edit_btn",svgIconProps:{name:"edit",size:"20"}}],getStepMenuButtons=({moveUp:e,moveDown:t,edit:a,remove:n,addBranch:r,duplicate:l},{viewOnly:i,firstStep:o,lastStep:s,isDragDisabled:c,isUnknownStep:d,isSwitch:u})=>[...!e||!t||i||d||u?[]:[...o?[]:[{key:"segment_move_up_btn",tooltip:e.tooltip,onClick:e.onClick,ariaLabel:e.ariaLabel,isDisabled:c,dataQa:"segment_move_up_btn",dataId:"segment_move_up_btn",svgIconProps:{name:"arrow-up",size:"20"},autoClogProps:e.autoClogProps}],...s?[]:[{key:"segment_move_down_btn",tooltip:t.tooltip,onClick:t.onClick,ariaLabel:t.ariaLabel,isDisabled:c,dataQa:"segment_move_down_btn",dataId:"segment_move_down_btn",svgIconProps:{name:"arrow-down",size:"20"},autoClogProps:t.autoClogProps}]],...n&&(!i||u)?[{key:`${d?"unknown_":""}segment${u?"_switch":""}_delete_btn`,tooltip:n.tooltip,onClick:n.onClick,ariaLabel:n.ariaLabel,dataQa:`${d?"unknown_":""}segment${u?"_switch":""}_delete_btn`,dataId:`${d?"unknown_":""}segment${u?"_switch":""}_delete_btn`,svgIconProps:{name:"trash",size:"20"},autoClogProps:n.autoClogProps}]:[],...!l||i||d||u?[]:[{key:"segment_duplicate_btn",tooltip:l.tooltip,onClick:l.onClick,ariaLabel:l.ariaLabel,isDisabled:l.isDisabled,dataQa:"segment_duplicate_btn",dataId:"segment_duplicate_btn",svgIconProps:{name:"copy",size:"20"},autoClogProps:l.autoClogProps}],...!a||d||u?[]:[{key:"segment_edit_btn",tooltip:a.tooltip,onClick:a.onClick,ariaLabel:a.ariaLabel,dataQa:"segment_edit_btn",dataId:"segment_edit_btn",svgIconProps:{name:"edit",size:"20"},autoClogProps:a.autoClogProps}],...r&&u?[{key:"segment_addBranch_btn",tooltip:r.tooltip,onClick:r.onClick,ariaLabel:r.ariaLabel,dataQa:"segment_addBranch_btn",dataId:"segment_addBranch_btn",svgIconProps:{name:"add-branch",size:"20"},autoClogProps:r.autoClogProps}]:[]],hasPermissionsForSegment=e=>null===e||e===k||e===E,getNextStepActionSubtitle=e=>{switch(e){case v:return n.createElement("span",{className:x().stepInitRequest},C.t("Request this step"));case S:return n.createElement("span",null,C.t("Approval requested"));case w:return n.createElement("span",{className:x().stepRestricted},C.t("This step is restricted"));default:return}};getNextStepActionSubtitle.displayName="getNextStepActionSubtitle";let getSegmentPreviewIcon=({segment:e,wrappedFunctionDetails:t})=>{if((0,d.GS)(e)){let a=(0,c.Pv)(e)?t??e.config.wrappedSlackFunction:e.config.slackFunction;if((0,r.GU)(a))return n.createElement(f.A,{size:36});if(a?.type===_.A.BuiltIn)return(0,i.m)(a?.callback_id);if(a?.app_id)return n.createElement(g.z,{appId:a.app_id,size:24})}else if((0,p.Z)(e)){let t=e.config.service.function;if(t?.app_id)return n.createElement(g.z,{appId:t.app_id,size:24})}let a=(0,s.E)(e);return(0,o.pA)({type:e.type,subtype:a})};getSegmentPreviewIcon.displayName="getSegmentPreviewIcon"},0x8d9b2838:(e,t,a)=>{"use strict";a.d(t,{v:()=>useEditTemplateModal});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0x24546e7f2),o=a(0x15ab42d61),s=a(0xdac250),c=a(0x3c838d6a),d=a(0xd013226d),u=a(0x5b0d97fd),m=a(0xa263fbfd),p=a(0x1a5ac3a0c),b=a(0x145d46a61),f=a(0x235bbf477),g=a(0x226892387),h=a(0x1fcbb004d),_=a(0x16ffed5ab);let y=new l.Ay("workflow_builder"),TemplateEditModal=()=>{let e=(0,m.X)(),t=(0,g.d4)(b.dm),a=(0,g.d4)(b.kY),l=(0,r.wA)(),f=(0,n.useCallback)(()=>l((0,h.O)()),[l]),[_,x]=(0,n.useState)(""),[v,E]=(0,n.useState)(""),[k,w]=(0,n.useState)(""),[S,C]=(0,n.useState)(!1),[A,T]=(0,n.useState)(""),I=(0,n.useMemo)(()=>({[u.C7.Details]:{render:({switchPane:e})=>n.createElement(d.R,{templateName:_,setTemplateName:x,description:v,setDescription:E,iconUrl:k,switchPane:e,madLib:A,setMadLib:T,modalType:"edit"}),modalProps:{contentLabel:y.t("Finish Up Template")}},[u.C7.BasicDetails]:{render:({switchPane:e})=>n.createElement(c.R,{templateName:_,setTemplateName:x,description:v,setDescription:E,iconUrl:k,switchPane:e,modalType:"edit"}),modalProps:{contentLabel:y.t("Edit details")}},[u.C7.UploadImg]:{render:({switchPane:e,file:t})=>n.createElement(s.Z,{onClose:f,nextPane:u.C7.CropImg,prevPane:a?u.C7.BasicDetails:u.C7.Details,setOnCropImagePane:C,switchPane:e,file:t}),modalProps:{contentLabel:y.t("Edit Avatar Upload")}},[u.C7.CropImg]:{render:({switchPane:e,imageId:t,avatarUrl:r})=>n.createElement(o._,{workflowName:_,workflowDescription:v,onClose:f,nextPane:a?u.C7.BasicDetails:u.C7.Details,prevPane:a?u.C7.BasicDetails:u.C7.Details,showPreview:!1,setOnCropImagePane:C,setIconUrl:w,avatarUrl:r||"",imageId:t||"",switchPane:e}),modalProps:{contentLabel:y.t("Edit Avatar Upload")}},[u.C7.Confirmation]:{render:()=>n.createElement(TemplateEditConfirmation,{onClose:f}),modalProps:{contentLabel:y.t("Template Edit Confirmation")}}}),[_,v,k,A,f,a]);return((0,n.useEffect)(()=>{e&&(x(e.workflow.title),E(e.workflow.description),T(e.madLibSentence||""),e.workflow.icons?.image_192&&w((0,p.DU)(e.workflow)))},[e]),t&&e)?n.createElement(i.A,{closeModal:f,defaultPane:a?u.C7.BasicDetails:u.C7.Details,panes:I,dataQa:"template-edit-modal",showCloseButton:!S}):null};function TemplateEditConfirmation({onClose:e}){let t=(0,r.wA)(),a=y.t("Template Updated");return(0,n.useEffect)(()=>{t((0,_.M)({element:n.createElement(f.V,{message:a})})),e()},[t,e,a]),null}TemplateEditModal.displayName="TemplateEditModal",TemplateEditConfirmation.displayName="TemplateEditConfirmation";var x=a(0x46dbff89);function useEditTemplateModal(){let e=(0,r.wA)(),t=(0,m.X)();return{openEditModal:(0,n.useCallback)(()=>{let a=n.createElement(m.Z.Provider,{value:t},n.createElement(TemplateEditModal,null));e((0,x.q)({isStackable:!0,element:a}))},[e,t])}}useEditTemplateModal.displayName="useEditTemplateModal"},0x2d26ca33:(e,t,a)=>{"use strict";a.d(t,{K:()=>useTemplateFetch});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0xe874a88a),i=a(0x1a5ac3a0c),o=a(0x14b92995e),s=a(0xf5bbd10a),c=a(0x145d46a61),d=a(0x16e94c2bd),u=a(0x24fc5dd2c),m=a(0x226892387);function useTemplateFetch(e){let t=(0,m.d4)(c.dm),a=(0,r.wA)(),p=(0,s.A)(),[b,f]=(0,n.useState)(),[g,h]=(0,n.useState)(!1),[_,y]=(0,n.useState)(!0),[x,v]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{t&&_&&(async()=>{if(!e)return l.S.reject(Error("No templateId"));try{return v(!1),h(!0),await a((0,o.l)({templateId:e,reason:"load-template-get-as-decorated-workflow"}))}catch(t){return p.error(`Something went wrong when trying to fetch a workflow with templateId: ${e}`,t),l.S.reject(t)}finally{h(!1)}})().then(e=>{let t=(0,d.l_)(e.workflow),a={...e.trigger,type:(0,u.k)(e.trigger.type)},n=(0,i.Ln)(t);f({...e,workflow:t,trigger:a,segments:n})}).catch(()=>{v(!0)}).finally(()=>{y(!1)})},[a,_,p,e,t]),b&&b.workflow&&b.trigger&&b.segments)?{templateId:e||"",failedToFetch:x,dateUpdated:b?.date_updated,workflow:b?.workflow,trigger:b?.trigger,availableData:b?.available_data,expressionData:b?.expression_data??{},segments:b?.segments,isFetchingTemplate:g,categories:b?.categories||[],madLibSentence:b?.madlibs_config?.sentence,templateState:b?.state,collaboratorIds:b?.collaborator_ids||[],refetchTemplate:()=>y(!0)}:null}},0x18bdc312b:(e,t,a)=>{"use strict";a.d(t,{f:()=>useValidateTemplateName});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0xe874a88a),i=a(0x22a29f141),o=a(0x1dfdeb1c8),s=a(0x1ec68d6a3),c=a(0xe747dd27);let d=(0,o.A)("workflows.templates.validate generated fetcher",(e,t,a)=>new l.S((n,r)=>{let{abortSignal:l,reason:o,...d}=a,u=(0,c.VA)(d);e((0,i.apiCall)({method:"workflows.templates.validate",args:u,abortSignal:l,reason:o})).then(e=>{n(e)}).catch(e=>{(0,s.default)({getState:t}).error(`API call to workflows.templates.validate
						with reason ${o} failed, initiated by generated fetcher`),r(e)})}));function useValidateTemplateName(){let e=(0,r.wA)();return{isTemplateNameValid:(0,n.useCallback)(async t=>{try{return await e(d({name:t,reason:"validate-template-name"})),!0}catch{return!1}},[e])}}d.meta={name:"workflowsTemplatesValidateFetcher",key:"createFetcherWorkflowsTemplatesValidateFetcher",description:"workflows.templates.validate generated fetcher"}},0xcbde109e:(e,t,a)=>{"use strict";a.d(t,{i:()=>MadLibsModal});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x20482ad21),i=a(0x11a296110),o=a(0x1d2cd7755),s=a(0x126f22530),c=a(0x145d46a61),d=a(0x20e80190e),u=a(0x226892387),m=a(0x1fcbb004d);let p=new l.Ay("workflow_builder");function MadLibsModal({templateTitle:e,onGenerate:t}){let a=(0,u.d4)(c.dm),l=(0,r.wA)(),[b,f]=(0,n.useState)(e),g=(0,n.useCallback)(()=>l((0,m.O)()),[l]),h=(0,n.useCallback)(()=>{t(b),g()},[t,g,b]);return a?n.createElement(d.dW,{contentLabel:p.t("Generate Madlibs"),closeModal:g},n.createElement(d.rQ,null,n.createElement(d.Rc,{title:p.t("Generate Madlibs")})),n.createElement(d.$m,null,n.createElement(d.qf,null,n.createElement(o.A,{text:p.rt("<b>Goal:</b> <i>Briefly explain what this workflow achieves</i>")},n.createElement(s.A,{id:"madlibs-goal",type:"text",name:"name",value:b,onChange:f,placeholder:"",autoComplete:"off",focusOnMount:!0,useInlineAlert:!0})))),n.createElement(d.jl,null,n.createElement(d.ox,null,n.createElement(i.Ay,{type:"outline",onClick:g},p.t("Cancel")),n.createElement(i.lV,{onClick:h,"aria-label":p.t("Generate")},p.t("Generate"))))):null}MadLibsModal.displayName="MadLibsModal"},0x3c838d6a:(e,t,a)=>{"use strict";a.d(t,{R:()=>TemplateBasicDetailsPane});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x2286acf6c),s=a(0x20482ad21),c=a(0x11a296110),d=a(0x1d2cd7755),u=a(0x126f22530),m=a(0x5299a396),p=a(0x1e586fbba),b=a(0x1b7f0cd57),f=a(0xa3743afa),g=a(0x18bdc312b),h=a(0x23515fd5),_=a(0x5b0d97fd),y=a(0xa263fbfd),x=a(0x937a43ca),v=a(0x145d46a61),E=a(0x20e80190e),k=a(0x1dae1e14d),w=a(0xf3c231c),S=a(0x226892387),C=a(0x1fcbb004d),A=a(0x254059bfb),T=a.n(A);let I=new s.Ay("workflow_builder");function TemplateBasicDetailsPane({switchPane:e,templateName:t,setTemplateName:a,description:l,setDescription:s,iconUrl:A,modalType:N="publish",publishStepNumber:M,totalNumberOfPublishSteps:L}){let O=(0,y.X)(),{isTemplateNameValid:F}=(0,g.f)(),D=(0,r.wA)(),[P,R]=(0,n.useState)(!1),B=(0,S.d4)(v.dm),W="publish"===N,V=(0,n.useCallback)(()=>D((0,C.O)()),[D]),H=(0,n.useRef)(null),q=(0,n.useCallback)(()=>H?.current?.click(),[]),U=(0,n.useCallback)(t=>{let a=(t.target.files||[])[0];a&&e(_.C7.UploadImg,{file:a})},[e]),[z,j]=(0,n.useState)(!1),G=(0,n.useMemo)(()=>!!(0,k.A)(t),[t]),$=(0,n.useMemo)(()=>!!(0,w.A)(t,f.p),[t]),K=(0,n.useMemo)(()=>(0,x.Zb)(t),[t]),Y=(0,n.useMemo)(()=>(0,x.yA)(t),[t]),Q=(0,n.useMemo)(()=>(0,x.L8)(t),[t]),Z=(0,n.useMemo)(()=>Y?I.t("Whoops! That name is reserved."):K?B?I.t("Template names can\u2019t support special characters (i.e. !#$%&)."):"Template names can\u2019t support special characters (i.e. !#$%&).":Q?B?I.t("Whoops! Template names cannot have emojis."):"Whoops! Template names cannot have emojis.":z?I.t("This template already exists, choose a different name."):"",[B,K,Y,Q,z]),J=(0,n.useMemo)(()=>!!(0,k.A)(l),[l]),X=(0,n.useMemo)(()=>!!(0,w.A)(l,f.p),[l]),ee=(0,n.useMemo)(()=>(0,o.A)(e=>{F(e).then(e=>{e||j(!0)})},600),[F]),et=(0,n.useCallback)(async e=>{j(!1),a(e);let t=e.trim();t.length&&t!==O?.workflow.title&&ee(t)},[a,O?.workflow.title,ee]),ea=(0,n.useCallback)(async()=>{if(W)return void e(_.C7.AdvancedDetails);if(O){R(!1);try{await D((0,h.J7)({...O,description:l,templateName:t,iconUrl:A,prevTemplateState:O.templateState})),O.refetchTemplate?.(),e(_.C7.Confirmation)}catch{R(!0)}}},[l,D,A,W,e,O,t]),en=(0,n.useMemo)(()=>!!Z||G||$||J||X,[Z,G,$,J,X]);return B?n.createElement(n.Fragment,null,n.createElement(E.rQ,null,n.createElement(E.Rc,{id:"story__title-bar",title:W?I.t("Publish Template"):I.t("Edit details")})),n.createElement(E.$m,null,n.createElement(E.qf,null,n.createElement(d.A,{text:I.t("Template Name")},n.createElement(u.A,{id:"template-details-name",type:"text",maxCharacterLimit:f.p,minCharacterLimit:f.H,name:"name",value:t,onChange:et,placeholder:I.t("Something short and descriptive"),errorText:Z,autoComplete:"off",focusOnMount:!0,"data-qa":"workflow-details-modal-name__input",useInlineAlert:!0,isRequired:!0})),n.createElement(d.A,{text:I.t("Description")},n.createElement(m.A,{id:"workflow-details-modal_description",type:"text",maxCharacterLimit:f.p,minCharacterLimit:f.H,name:"description",value:l,onChange:s,placeholder:I.t("What is this template for?"),"data-qa":"workflow-details-modal-description__input",useInlineAlert:!0,isRequired:!0})),n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(d.A,{text:I.t("Image")},n.createElement("input",{className:T().file_input,type:"file",accept:"image/jpeg,image/gif,image/png",onChange:U,ref:H,"aria-hidden":"true",tabIndex:-1,hidden:!0})),n.createElement(c.Ay,{type:"outline",size:"small",onClick:q,className:T().choose_file_icon,"data-qa":"workflow-details-modal-icon-button"},I.t("Choose Image"))),n.createElement(b.R,{className:T().workflow_avatar_icon,iconSrcUrl:A,altText:t,size:"xl"}))),P&&n.createElement(E.qf,null,n.createElement(p.A,{"data-qa":"workflow-details-modal-description-error"},I.t("There was an error updating your template.")))),n.createElement(E.jl,{className:T().modalFooter},W&&n.createElement("div",null,I.rt("Step {currentStepNumber} of {totalNumberOfSteps}",{currentStepNumber:M,totalNumberOfSteps:L})),n.createElement(E.ox,null,n.createElement(c.Ay,{type:"outline",onClick:V},I.t("Cancel")),n.createElement(c.Ay,{disabled:en,onClick:ea,className:i()(T().primaryCtaButton,{[T().disabled]:en,"template-edit-publish-button":W})},W?I.t("Next"):I.t("Save"))))):null}TemplateBasicDetailsPane.displayName="TemplateBasicDetailsPane"},0xd367bf0f:(e,t,a)=>{"use strict";a.d(t,{S:()=>mapCategoriesToOptions,p:()=>TemplateDetailsCategories});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0xa7ec93c2),i=a(0x5b0d97fd),o=a(0x145d46a61),s=a(0x226892387);let c=new r.Ay("workflow_builder");function TemplateDetailsCategories({selectedOptions:e,onSelect:t}){let a=mapCategoriesToOptions();return(0,s.d4)(o.dm)?n.createElement(l.Ay,{className:"template-edit-categories",options:a,selectId:"workflow-details-categories",size:"medium",width:"400",placeholderText:c.t("Choose a category\u2026"),selectedOptions:e,onSelectedItemsChange:t,expandOnFocus:!0}):null}function mapCategoriesToOptions(e=(0,i.N4)()){return e.map(e=>({label:e,value:e}))}TemplateDetailsCategories.displayName="TemplateDetailsCategories"},0x184ab8957:(e,t,a)=>{"use strict";a.d(t,{c:()=>TemplateDetailsDiscoverabilitySetting});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x1d2cd7755),i=a(0x139c79d16),o=a(0xa5dbe09b),s=a(0x1e367a230),c=a(0x145d46a61),d=a(0xa1832ae4),u=a(0x226892387),m=a(0x1ee439e69);let p=new r.Ay("workflow_builder");function TemplateDetailsDiscoverabilitySetting({templateState:e,setTemplateState:t}){let a=(0,n.useRef)(e),r=(0,u.d4)(c.kY),b=(0,u.d4)(m.H7),f=(0,d.F1)(b),g=(0,s.PW)(b.id),h=(0,n.useCallback)(e=>()=>{"publish_requested"===e&&g?t("published"):t(e)},[t,g]),_=r?p.t("Submit to have template reviewed and published to {teamName}",{teamName:f}):`Submit to have template reviewed and published to ${f}`;return g&&(_=r?p.t("Submit to have template published to {teamName}",{teamName:f}):`Submit to have template published to ${f}`),n.createElement(o.A,{legendText:r?p.t("Who can find and use this template",{fallbackHash:"323f0a57655a9c49ec8d3084642340e9f0eab788"}):"Who can find and use this template",isDisabled:"publish_requested"===a.current||"published"===a.current},n.createElement(l.A,{text:r?p.t("Template managers only"):"Template managers only",subtext:r?p.t("Save as private to test with collaborators before sharing widely"):"Save as private to test with collaborators before sharing widely",htmlFor:"template-details-discoverability-managers",type:"inline"},n.createElement(i.A,{id:"template-details-discoverability-managers",name:"template-details-discoverability",checked:"draft"===e,onChange:h("draft")})),n.createElement(l.A,{text:r?p.t("Everyone internal in {teamName}",{teamName:f}):`Everyone internal in ${f}`,subtext:_,htmlFor:"template-details-discoverability-internal",type:"inline"},n.createElement(i.A,{id:"template-details-discoverability-internal",name:"template-details-discoverability",checked:"publish_requested"===e||"published"===e,onChange:h("publish_requested")})))}TemplateDetailsDiscoverabilitySetting.displayName="TemplateDetailsDiscoverabilitySetting"},0xd013226d:(e,t,a)=>{"use strict";a.d(t,{R:()=>TemplateDetailsPane});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x120c268ad),i=a.n(l),o=a(0x2286acf6c),s=a(0x72b537b5),c=a(0x20482ad21),d=a(0x11a296110),u=a(0xb1ea448c),m=a(0x1d2cd7755),p=a(0x126f22530),b=a(0x5299a396),f=a(0x344bb842),g=a(0x1e586fbba),h=a(0x143f89715),_=a(0x1b7f0cd57),y=a(0x253c586a2),x=a(0x7f5a02e8),v=a(0xa3743afa),E=a(0x18bdc312b),k=a(0xcbde109e),w=a(0xd367bf0f),S=a(0x184ab8957),C=a(0x23515fd5),A=a(0x5b0d97fd),T=a(0xa263fbfd),I=a(0x10d53599f),N=a(0x19dc73101),M=a(0x1e367a230),L=a(0xe1644a69),O=a(0x247e6596),F=a(0x1f26a5878),D=a(0x2120d7f64),P=a(0x145d46a61),R=a(0x20e80190e),B=a(0x226892387),W=a(0x19c76d181),V=a(0x14149c126),H=a(0x1fcbb004d),q=a(0x46dbff89),U=a(0x1ee439e69),z=a(0x254059bfb),j=a.n(z);let G=new c.Ay("workflow_builder"),renderMemberOption=e=>n.createElement(I.A,{id:e.value});function TemplateDetailsPane({switchPane:e,templateName:t,setTemplateName:a,madLib:l,setMadLib:c,description:I,setDescription:z,iconUrl:$,modalType:K="publish"}){let Y=(0,s.U)(),Q=(0,T.X)(),[Z,J]=(0,n.useState)(Q?.templateState),{isTemplateNameValid:X}=(0,E.f)(),ee=(0,r.wA)(),[et,ea]=(0,n.useState)(!1),[en,er]=(0,n.useState)(!1),[el,ei]=(0,n.useState)(""),[eo,es]=(0,n.useState)(!1),ec=(0,B.d4)(P.dm),ed=(0,B.d4)(e=>"on"===(0,V._Z)(e,"workflow_templates_collaborators")),eu=(0,B.d4)(P.kY),em=(0,B.d4)(W.WR),ep=(0,B.d4)(U.H7),{speedBumpState:eb,closeSpeedBump:ef,openSpeedBump:eg}=(0,D.v)(),[eh,e_]=(0,n.useState)((0,w.S)(Q?.categories)),ey=(0,n.useCallback)(()=>ee((0,H.O)()),[ee]),ex=(0,n.useRef)(null),ev=(0,n.useCallback)(()=>ex?.current?.click(),[]),eE=(0,n.useCallback)(t=>{let a=(t.target.files||[])[0];a&&e(A.C7.UploadImg,{file:a})},[e]),[ek,ew]=(0,n.useState)(Q?.collaboratorIds||[]),eS=0===ek.length,eC=ed?G.t("You must provide at least 1 template manager"):"You must provide at least 1 template manager",eA=(0,n.useMemo)(()=>{let e=[];return eS&&e.push({id:"empty_collaborators",message:eC}),e},[eC,eS]),eT=(0,n.useMemo)(()=>(0,o.A)(e=>{X(e).then(e=>{e||ei(ec?G.t("This template already exists, choose a different name"):"")})},600),[X,ec]),eI=(0,n.useCallback)(e=>{ei("");let t=e.trim();a(e),t.length&&t!==Q?.workflow.title&&eT(t)},[a,eT,Q]),eN=(0,n.useMemo)(()=>{let e=(Q?.collaboratorIds||[]).some(e=>e===em),t=!ek.some(e=>e===em);return e&&t},[em,ek,Q?.collaboratorIds]),eM=(0,n.useCallback)(async()=>{try{if(!Q)return void er(!0);ea(!0),er(!1);let a=eh.map(e=>e.value),n="publish"===K?"published":void 0;eu&&Z&&(n=Z),await ee((0,C.J7)({workflow:Q.workflow,trigger:Q.trigger,templateId:Q.templateId,description:I,templateName:t,prevTemplateState:Q.templateState,iconUrl:$,categories:a,madLib:l,newTemplateState:n})),await ee((0,C.A1)({templateId:Q.templateId,collaboratorIds:Q.collaboratorIds||[],updatedCollaboratorIds:ek})),Q.refetchTemplate?.(),ea(!1),e(A.C7.Confirmation)}catch{er(!0),ea(!1)}},[Q,eh,K,eu,Z,ee,I,t,$,l,e,ek]),eL=(0,n.useCallback)(()=>{eN&&ed?eg({heading:G.t("Remove yourself as a template manager?"),message:G.t("Removing yourself as a template manager means you\u2019ll immediately lose access to edit this template. To become a template manager of this template again, a current manager will need to add you."),onCancel:ef,onContinue:eM}):eM()},[eN,eg,ef,eM,ed]),eO=(0,n.useMemo)(()=>ek.map(e=>({label:e,value:e})),[ek]),eF=(0,n.useCallback)(e=>{ew(e.map(({value:e})=>e))},[ew]),eD=(0,n.useCallback)(async e=>{es(!0);try{let t=await ee((0,O.A)({templateId:Q?.templateId||"",reason:"template-edit:generate-madlibs"})),{result:a}=await ee((0,F.W)({workflowDescription:t.workflow_description,triggerDescription:t.trigger_description,goal:e,reason:"template-edit:generate-mablibs"}));c(a)}catch{er(!0)}finally{es(!1)}},[ee,Q,c]),eP=(0,n.useCallback)(()=>{ee((0,q.q)({isStackable:!0,element:n.createElement(k.i,{templateTitle:Q?.workflow.title||"",onGenerate:eD})}))},[ee,eD,Q?.workflow.title]),eR=(0,n.useMemo)(()=>{if(eu)switch(Z){case"draft":return G.t("Publish");case"publish_requested":case"published":return G.t("Submit");default:return G.t("Save")}return"publish"===K?G.t("Publish Template"):G.t("Save")},[K,Z,eu]),eB=(0,n.useMemo)(()=>!!el.length||(0,h.A)(eA,Y)&&ed,[eA,el,ed,Y]);if(!ec)return null;let eW=G.t("Something short and descriptive"),eV=G.t("What is this template for?"),eH=(0,M.PW)(ep.id);return n.createElement(n.Fragment,null,n.createElement(R.rQ,null,n.createElement(R.Rc,{id:"story__title-bar",title:"publish"===K?G.t("Finish Up Template"):G.t("Edit details")})),n.createElement(R.$m,null,n.createElement(R.qf,null,n.createElement(m.A,{text:G.t("Template Name")},n.createElement(p.A,{id:"template-details-name",type:"text",maxCharacterLimit:v.p,name:"name",value:t,onChange:eI,placeholder:eW,errorText:el,autoComplete:"off",focusOnMount:!0,"data-qa":"workflow-details-modal-name__input",useInlineAlert:!0})),n.createElement(m.A,{text:G.t("Description")},n.createElement(b.A,{id:"workflow-details-modal_description",type:"text",maxCharacterLimit:v.p,minCharacterLimit:v.H,name:"description",value:I,onChange:z,placeholder:eV,"data-qa":"workflow-details-modal-description__input",useInlineAlert:!0,isRequired:!0})),n.createElement(n.Fragment,null,n.createElement("div",null,n.createElement(m.A,{text:G.t("Image")},n.createElement("input",{className:j().file_input,type:"file",accept:"image/jpeg,image/gif,image/png",onChange:eE,ref:ex,"aria-hidden":"true",tabIndex:-1,hidden:!0})),n.createElement(d.Ay,{type:"outline",size:"small",onClick:ev,className:j().choose_file_icon,"data-qa":"workflow-details-modal-icon-button"},G.t("Choose Image"))),n.createElement(_.R,{className:j().workflow_avatar_icon,iconSrcUrl:$,altText:t,size:"xl"}))),n.createElement("hr",null),n.createElement(R.qf,null,n.createElement(m.A,{text:G.t("Category Tags"),className:j().category_section},n.createElement(w.p,{selectedOptions:eh,onSelect:e_})),ed&&n.createElement(m.A,{text:ed?G.t("Template Managers"):"Template Managers"},n.createElement(N.h,{width:"100%",className:"margin_bottom_50",selectDataQa:"collaborators-multi-select",selectId:"collaborators-multi-select",isInvalid:eA.length>0,errors:eA,renderOption:renderMemberOption,searcherOptions:(0,x.Zq)(y.Df,{}),selectedOptions:eO,onSelectedItemsChange:eF,focusOnMount:!0}),n.createElement("span",{className:j().helpText},ed?G.t("Can edit, publish, and delete this template"):"Can edit, publish, and delete this template"))),n.createElement("hr",null),eu&&n.createElement(R.qf,null,n.createElement(S.c,{templateState:Z,setTemplateState:J})),eH&&n.createElement(R.qf,null,n.createElement("div",{className:j().madlibs_label},n.createElement(m.A,{text:G.t("Madlib")}),eo?n.createElement(u.A,{size:"small",className:j().madlibs_ai_loading}):n.createElement(f.A,{"aria-label":G.t("Generate Madlibs"),className:j().madlibs_ai_btn,onClick:eP},n.createElement(L.o,{type:"workflow",size:"16"}))),n.createElement(b.A,{id:"template-details-madlib",type:"text",name:"madlib",value:l,onChange:c})),(eu||eH)&&n.createElement("hr",null),en&&n.createElement(n.Fragment,null,n.createElement(R.qf,null,n.createElement(g.A,{"data-qa":"workflow-details-modal-description-error"},G.t("There was an error updating your template."))),n.createElement("hr",null))),eb.isVisible?n.createElement(R.ty,{description:eb.message,...eb,continueButtonType:"primary",continueButtonLabel:G.t("Save")}):n.createElement(R.jl,null,n.createElement(R.ox,null,n.createElement(d.Ay,{type:"outline",onClick:ey},G.t("Cancel")),n.createElement(d.lV,{disabled:eB,loading:et,onClick:eL,className:i()({"template-edit-publish-button":"publish"===K}),"aria-label":eR},eR))))}TemplateDetailsPane.displayName="TemplateDetailsPane"},0x23515fd5:(e,t,a)=>{"use strict";a.d(t,{JR:()=>y,Ab:()=>h,lL:()=>_,J7:()=>x,A1:()=>v});var n=a(0x250ebc75c),r=a(0x5b0d97fd),l=a(0xe874a88a),i=a(0x22a29f141),o=a(0x1dfdeb1c8),s=a(0x1ec68d6a3),c=a(0xe747dd27);let d=(0,o.A)("workflows.templates.collaborators.add generated fetcher",(e,t,a)=>new l.S((n,r)=>{let{abortSignal:l,reason:o,...d}=a,u=(0,c.VA)(d);e((0,i.apiCall)({method:"workflows.templates.collaborators.add",args:u,abortSignal:l,reason:o})).then(e=>{n(e)}).catch(e=>{(0,s.default)({getState:t}).error(`API call to workflows.templates.collaborators.add
						with reason ${o} failed, initiated by generated fetcher`),r(e)})}));d.meta={name:"workflowsTemplatesCollaboratorsAddFetcher",key:"createFetcherWorkflowsTemplatesCollaboratorsAddFetcher",description:"workflows.templates.collaborators.add generated fetcher"};let u=(0,o.A)("workflows.templates.collaborators.remove generated fetcher",(e,t,a)=>new l.S((n,r)=>{let{abortSignal:l,reason:o,...d}=a,u=(0,c.VA)(d);e((0,i.apiCall)({method:"workflows.templates.collaborators.remove",args:u,abortSignal:l,reason:o})).then(e=>{n(e)}).catch(e=>{(0,s.default)({getState:t}).error(`API call to workflows.templates.collaborators.remove
						with reason ${o} failed, initiated by generated fetcher`),r(e)})}));u.meta={name:"workflowsTemplatesCollaboratorsRemoveFetcher",key:"createFetcherWorkflowsTemplatesCollaboratorsRemoveFetcher",description:"workflows.templates.collaborators.remove generated fetcher"};var m=a(0x1fa75c0ee),p=a(0xc8f333a2),b=a(0xaf5a1707),f=a(0x11c82607b);let g="WORKFLOW-EDITOR",h=(0,f.Ay)("Updates the workflow template status",async(e,t,{templateId:a,newTemplateStatus:n})=>e((0,m.T)({templateId:a,status:n,reason:"template-edit-update-status"})));h.meta={name:"updateTemplateStatus",key:"createThunkUpdateTemplateStatus",description:"Updates the workflow template status"};let _=(0,f.Ay)("Updates a trigger coachmark on a template",async(e,t,{templateId:a,coachmarkText:n})=>{await e((0,p.M)({templateId:a,triggerConfiguration:{coachmark:n},reason:"template-edit-coachmark-update"}))});_.meta={name:"updateTriggerCoachmark",key:"createThunkUpdateTriggerCoachmark",description:"Updates a trigger coachmark on a template"};let y=(0,f.Ay)("Updates a coachmark on a template",async(e,t,{templateId:a,coachmarkText:r,workflow:l,stepId:i})=>{let o=(0,n.c)(l.steps,e=>({coachmark:i===e.id?r:e.coachmark??"",steps:e?.steps}));await e((0,p.M)({templateId:a,stepsConfiguration:o,reason:"template-edit-coachmark-update"}))});y.meta={name:"updateCoachmark",key:"createThunkUpdateCoachmark",description:"Updates a coachmark on a template"};let x=(0,f.Ay)("Updates the workflow template data and status",async(e,t,{workflow:a,trigger:n,templateName:r,description:l,templateId:i,prevTemplateState:o,newTemplateState:c,iconUrl:d,categories:u,madLib:m})=>{let b=(0,s.default)({getState:t,label:g}),f={coachmark:n.coachmark},_=a.steps.map(e=>({coachmark:e.coachmark||""})),y=0===u.length?void 0:u,x=m&&m.trim().length?{sentence:m}:void 0;try{let t=await e((0,p.M)({templateId:i,name:r,description:l,stepsConfiguration:_,triggerConfiguration:f,icon:d,categories:y,madlibsConfig:x,reason:"template-edit-update"}));if(c&&o!==c)return await e(h({templateId:i,newTemplateStatus:c}));return t}catch(e){throw b.error(Error(`Unable to update the template ${i}: ${e}`)),e}});x.meta={name:"updateWorkflowTemplate",key:"createThunkUpdateWorkflowTemplate",description:"Updates the workflow template data and status"};let v=(0,f.Ay)("Finds users that have been added / removed as collaborators and updates the template",async(e,t,{templateId:a,collaboratorIds:n,updatedCollaboratorIds:l})=>{let i=(0,s.default)({getState:t,label:g}),{toBeAdded:o,toBeRemoved:c}=(0,r.Zf)(n,l);try{(0,b.E)(o)&&await e(d({templateId:a,collaboratorIds:o,reason:"add_template_collaborators"})),(0,b.E)(c)&&await e(u({templateId:a,collaboratorIds:c,reason:"remove_template_collaborators"}))}catch(e){throw i.error(Error(`Unable to update template collaborators ${a}: ${e}`)),e}});v.meta={name:"updateWorkflowTemplateCollaborators",key:"createThunkUpdateWorkflowTemplateCollaborators",description:"Finds users that have been added / removed as collaborators and updates the template"}},0x5b0d97fd:(e,t,a)=>{"use strict";a.d(t,{BE:()=>isWorkflowTemplateViewOnly,C7:()=>l,N4:()=>getTemplateCategories,Zf:()=>diffCollaborators});var n,r=a(0x6affae29),l=((n={}).Details="details",n.BasicDetails="basicDetails",n.AdvancedDetails="advancedDetails",n.UploadImg="uploadImg",n.CropImg="cropImg",n.Confirmation="confirmation",n);let getTemplateCategories=()=>["default","express","advanced","channel_suggestion","express_next","default_next"];function diffCollaborators(e,t){return{toBeAdded:t.filter(t=>!e.includes(t)),toBeRemoved:e.filter(e=>!t.includes(e))}}function isWorkflowTemplateViewOnly({templateState:e,isTemplateAdmin:t,isTemplateOpsWorkspace:a,experimentTemplateCreationDiscoverabilityGroupOn:n}){if(!n)return!1;switch(e){case"draft":return!1;case"publish_requested":case"published":return!t&&!a;case"staging":case"featured":return!a;default:return(0,r.Kh)(e)}}},0x1cb9794d5:(e,t,a)=>{"use strict";a.d(t,{d:()=>n.d});var n=a(0x6a40f0b8)},0x6a40f0b8:(e,t,a)=>{"use strict";a.d(t,{d:()=>TokenizedArray,m:()=>g});var n,r=a(0xbad225b5),l=a(0x21f3c49e8),i=a(0x1407c6c2c),o=a(0x20482ad21),s=a(0x1d2cd7755),c=a(0xf33a4f91),d=a(0xbbd2a32d),u=a(0xb214261e),m=a(0x207fb9b92),p=a(0xab53bfe6),b=a.n(p);let f=new o.Ay("workflow_builder");var g=((n={})[n.Number=0]="Number",n[n.Integer=1]="Integer",n);let TokenizedArray=({value:e,ariaLabel:t,onChange:a,placeholderText:n,required:o,elementId:p,validation:g,className:h,disableIdParsing:_=!1,splitOnWhitespace:y=!0,isDisabled:x=!1})=>{let v=(0,i.A)(),E=p||v,k=o?t:` ${f.t("{ariaLabel} (optional)",{ariaLabel:t,fallbackHashNs:"app_dialog",fallbackHash:"b16c7ac6faff07d7e255da685e52bd66d3bf1575"})}`,[w,S]=(0,r.useState)(""),C=o&&(0,l.A)(e),{errorText:A,onBlur:T}=(0,m.K)({errorMessage:f.t("This field is required."),isErrored:C,shouldErrorPreventSave:!0}),I=(0,r.useCallback)(e=>{switch(g){case 0:return(0,d.gf)(Number(e));case 1:return(0,d.gf)(Number(e))&&(0,d.zh)(Number(e));default:return!0}},[g]),N=(0,r.useCallback)((e,t)=>{a(e,!e.every(I)),S(t)},[a,I]),M=f.t("This is not a valid number."),L=f.t("This is not a valid integer."),O=(0,r.useCallback)(e=>{if(!I(e))switch(g){case 0:return M;case 1:return L;default:return}},[I,g,M,L]),F=(0,r.useCallback)((e,t)=>{let a=O(e);return{key:`${t}-${e}`,label:e,value:e,isError:null!=a,hoverText:a}},[O]);return r.createElement(s.A,{htmlFor:E,text:k,"data-qa-segment-parameter":"tokenized-array-input-label",className:b().inlineLabel},r.createElement(u.G,{ariaLabel:E,className:h,tokenizedItems:e,untokenizedText:w,makeOption:F,onChange:N,isInvalid:!!A,errorMessage:A,onBlur:T,splitQuery:y?void 0:c.r0,placeholderText:n,ariaLabelledBy:E,focusOnMount:!0,disableIdParsing:_,isDisabled:x}))};TokenizedArray.displayName="TokenizedArray"},0x1775ee4d:(e,t,a)=>{"use strict";a.d(t,{f:()=>F});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1cbdfeceb),o=a(0x1df96de4c),s=a(0x20482ad21),c=a(0xd9faf062),d=a(0x15f8e452a),u=a(0x1faa3f1ac),m=a(0x2501a2cee),p=a(0xbe505324),b=a(0xe9c32bb),f=a(0xcaea2334),g=a(0x12bc54835),h=a(0x3c5a1598),_=a(0x1f89b5dbd),y=a(0x8d9b2838),x=a(0x2d26ca33),v=a(0xa263fbfd),E=a(0x1a5ac3a0c);let k=new s.Ay("workflow_builder");function WorkflowTemplateTitleDescription({templateId:e,isClientBuilder:t=!1}){let a=(0,x.K)(e);return a?n.createElement(v.Z.Provider,{value:a},n.createElement(WorkflowTemplateMetadata,{templateData:a,isClientBuilder:t})):null}function WorkflowTemplateMetadata({templateData:e,isClientBuilder:t=!1}){let{openEditModal:a}=(0,y.v)(),r=(0,n.useMemo)(()=>(0,E.BQ)(e.workflow),[e]),l=(0,n.useMemo)(()=>(0,E.DU)(e.workflow),[e.workflow]),i=(0,n.useMemo)(()=>(0,E.yL)(e.workflow),[e.workflow]),o=k.t("TEMPLATE",{fallbackHash:"3ec1ae061c27325c7ecb543adf91235e22cbc9ed",fallbackHashNs:"files"});return n.createElement(h.R,{name:r,icon:l,description:i,badgeText:o,onEditClick:a,canEdit:!0,isClientBuilder:t})}WorkflowTemplateTitleDescription.displayName="WorkflowTemplateTitleDescription",WorkflowTemplateMetadata.displayName="WorkflowTemplateMetadata";var w=a(0x1bb241cc1),S=a(0x129ec1993),C=a(0x1f2fa5a0f),A=a(0x145d46a61),T=a(0x1c91944c9),I=a(0x20adb28cd),N=a(0x226892387),M=a(0x1bda7c2e),L=a.n(M);let O=new s.Ay("app-config"),PrimitiveWorkflowHeader=({workflow:e,backRouteName:t,backRouteParams:a=o.t0,canEditName:r,secondaryContent:s,onRouteClick:f=i.A,canCreateWorkflows:y,defaultTabId:x,templateId:v})=>{let k=(0,N.d4)(A.b2),T=(0,w.S)(L().isPinned,{threshold:1}),M=(0,n.useMemo)(()=>t===C.Bs,[t]),F=(0,n.useMemo)(()=>(0,E.BQ)(e),[e]),D=(0,n.useMemo)(()=>(0,E.DU)(e),[e]),P=(0,n.useMemo)(()=>(0,E.DY)(e),[e]),R=(0,E.yL)(e),B=(0,N.d4)(e=>(0,I.JA)(e,P)),W=(0,N.d4)(e=>(0,I.Pb)(e,P).length),V=(0,N.d4)(I.EP),H=W>=V-5,q=B||H,U=(0,n.useMemo)(()=>B?O.t("This workflow has reached the {max_number_of_steps}-step limit. To add more steps, you need to remove some first.",{fallbackHash:"732ddc07733ebd62fa52955da986308c3c54ea06",fallbackHashNs:"workflow_builder",max_number_of_steps:V}):H?O.t("Heads up, this workflow has {remaining_step_count, plural, one {# step} other {# steps}} remaining before reaching the {max_number_of_steps}-step limit",{fallbackHash:"732ddc07733ebd62fa52955da986308c3c54ea06",fallbackHashNs:"workflow_builder",remaining_step_count:V-W,max_number_of_steps:V}):"",[B,W,H,V]),z=(0,n.useCallback)(({children:e})=>k?n.createElement(p.A,{className:L().workflowToolbar,"aria-label":O.t("Workflow Details",{ns:"workflow_builder"})},e):n.createElement("div",{className:L().header},e),[k]),j=O.t("Back"),G=(0,n.useMemo)(()=>k?n.createElement(u.A,{onClick:f},n.createElement(d.A,{type:"chevron-large-left"})):n.createElement(S.Wt,{routeName:t,params:a,ariaLabel:j,onClick:f,"data-qa":"workflow-header__back"},n.createElement(d.A,{type:"chevron-large-left"})),[t,a,k,j,f]);return x===_.OG?n.createElement(g.x,{className:l()(L().container,L().container_full_width,L().hermesContainerSlim)},n.createElement("div",{className:L().header},M&&G,n.createElement("div",{className:L().multiClickHeaderTitle},k?n.createElement("div",{className:L().activityLogHeader},O.t("Activity Log"),n.createElement(b.nB,{className:L().description},F)):n.createElement(n.Fragment,null,O.t("Activity Log"))))):n.createElement(g.x,{className:l()(L().container,L().hermesContainerSlim,{[L().stickyHeader]:!k,[L().clientBuilderHeader]:k}),ref:T},n.createElement(z,null,n.createElement("div",{className:L().headerContainer},n.createElement("div",{className:L().headerTitle},M&&G,v?n.createElement(WorkflowTemplateTitleDescription,{isClientBuilder:k,templateId:v}):n.createElement(h.R,{name:F,icon:D,description:R,canEdit:y&&r,isClientBuilder:k})),n.createElement("div",{className:L().headerSecondary},s))),q&&n.createElement(c.Ay,{type:B?c.QE.urgent:c.QE.warning,isFixedPosition:!1,showCloseButton:!1},n.createElement("span",{className:L().stepWarningBanner},n.createElement(m.Ah,{name:"info"}),n.createElement("span",null,U))))};PrimitiveWorkflowHeader.displayName="PrimitiveWorkflowHeader";let F=(0,T.N)(e=>({canCreateWorkflows:(0,f.I)(e)}))(PrimitiveWorkflowHeader)},0xd8ab69b7:(e,t,a)=>{"use strict";a.d(t,{l:()=>aS});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x1cbdfeceb),i=a(0x14fad6485),o=a(0x20482ad21),s=a(0x2b7f0bcc),c=a(0x6e87d4ec),d=a(0xe9c32bb),u=a(0x18e09ba96),m=a(0xc5f25803),p=a(0x16bebefd8),b=a(0xbe0b63ff),f=a(0x1f7facc5c),g=a(0x1c2513fa3),h=a(0x236ed4d73),_=a(0xba7d6f5f),y=a(0x1b0788a0d),x=a(0x1c3f9c13e),v=a(0x20aa03c9b),E=a(0x17a5d3eab),k=a(0x1a7251dad),w=a(0x10da1e25d),S=a(0x36e8c71e),C=a(0x23a4b0853),A=a(0xd08839a1),T=a(0x238b287cf),I=a(0x3711e82d),N=a(0x1fffc0b54),M=a(0x66c6b26d),L=a(0x4363d33f),O=a(0x126492ec6),F=a(0x20adb28cd),D=a(0x226892387),P=a(0x95c66692),R=a(0xa7a4ed65),B=a(0x3b8174d2),W=a(0x11c82607b);let V=(0,W.Ay)("search functions and categories for a given query string",async(e,t,a)=>{let n=t();return{matchingFunctions:(0,B.W1)(n,a),matchingCategories:(0,B.pk)(n,a)}});V.meta={name:"searchFunctionsAndCategories",key:"createThunkSearchFunctionsAndCategories",description:"search functions and categories for a given query string"};var H=a(0x20cfa1dc2),q=a(0x46dbff89);let steps_library_modal_noop=e=>{throw Error("Method was not defined!")},U=new o.Ay("workflow_builder"),StepsLibraryModalContent=({workflowId:e,afterStepId:t,focusSearch:a=!1})=>{let l=(0,r.wA)(),i=(0,D.d4)((0,M.sx)(e,F.RG)),o=(0,T.A)(),s=(0,D.rY)(B.oS),c=(0,D.d4)(B.Z0),d=(0,D.d4)(B.Ui),u=(0,D.d4)(N.YS),m=(0,D.d4)(N._u),{getInteractState:p}=(0,v.I)(),x=(0,n.useCallback)(({lastStepId:t})=>()=>{l((0,O.iy)({workflowId:e})),l((0,q.q)({element:n.createElement(StepsLibraryModal,{workflowId:e,afterStepId:t})}))},[l,e]),W=(0,n.useCallback)(()=>n.createElement(k.E,{workflowId:e,onNavigateBack:x({lastStepId:t}),isSegmentModal:!0,isRequestAppModal:!0}),[t,x,e]),z=(0,n.useCallback)((e,a,n)=>{(0,b.uz)(e)&&i&&l((0,L.k)({stepType:{type:a,subtype:n},workflow:i,afterStepId:t,slackFunction:e,onNavigateBack:x({lastStepId:t})}))},[t,l,x,i]),j=(0,n.useCallback)(e=>l((0,q.q)({element:n.createElement(f.u,{appId:e,backButtonRenderer:W})})),[W,l]),G=(0,n.useCallback)(async e=>{let t=e?.input_parameters?e:d[e.id];if((0,b.GU)(t))return;let a=S.SLACK_FUNCTION,n=t.id;"case_step"===t.callback_id?(a="switch",n="switch"):"loop_step"===t.callback_id?a="loop":(a=S.SLACK_FUNCTION,n=t.id);let r=t.app_id||"",i=p({actionId:t.id,appId:r});if((0,A.Ew)(i)){if(t.stepType===H._3.CONNECTOR||t.stepType===H._3.CERTIFIED)return void await l((0,P.u)({appId:r,onOpenModal:()=>z(t,a,n),onRequestAppModal:()=>j(r)}));z(t,a,n)}},[l,d,p,j,z]),$=(0,n.useCallback)(async e=>{let{matchingFunctions:t,matchingCategories:a}=await l(V(e));return{actions:t,categories:a}},[l]),K=(0,n.useMemo)(()=>({categories:c,collections:s,actions:d,isLoading:u,error:m??void 0}),[c,s,d,u,m]),Y=(0,n.useCallback)(async(e,t)=>{let a=d[e];t.navigate?.({panelId:a.id,panelType:a.type||"category",libraryType:w.uB.STEPS}),(0,C.E7)({clogger:o,uiArgs:{step:I.UiStep.WORKFLOW_EDITOR},uiProperties:{element_name:`${C.KC.WorkflowActionLibraryActions}_${e}`,element_value:C.it.ActionLibraryContextQuickSteps},wbArgs:{is_hermes:!0}}),await G(d[e])},[o,d,G]),Q=(0,n.useCallback)(t=>{let a=y.T8.filter(e=>void 0!==d[e]),r=n.createElement("div",null,U.t("Collections")," ",n.createElement(E.A,null)),l=Object.values(s),i=[];return l.length&&i.push((0,_.EL)({id:"popular-collections",headerNode:r,ariaLabel:U.t("Select collections"),onItemSelect:t.setCollectionId||steps_library_modal_noop,items:Object.values(s)})),a.length&&i.push((0,_.w_)({id:"quick-steps",category:{id:"quick-steps",name:"quick-steps",functions:a},headerNode:U.t("Quick steps"),ariaLabel:U.t("Select quick steps"),onItemSelect:e=>Y(e,t),actions:d})),{headerNode:n.createElement(h.A,{name:U.t("Discover workflow steps")},n.createElement(k.E,{workflowId:e,onNavigateBack:t.onNavigateBack})),sections:i}},[s,d,Y,e]),Z=(0,n.useCallback)(e=>({[R.Dd]:Q(e)}),[Q]);return n.createElement(g.y,{onActionSearch:$,onActionSelected:G,type:w.uB.STEPS,getStaticPanels:Z,actionData:K,focusSearch:a})};function StepsLibraryModal({workflowId:e,afterStepId:t,focusSearch:a=!1}){return n.createElement(x.p,{afterStepId:t},n.createElement(StepsLibraryModalContent,{workflowId:e,afterStepId:t,focusSearch:a}))}StepsLibraryModalContent.displayName="StepsLibraryModalContent",StepsLibraryModal.displayName="StepsLibraryModal";var z=a(0x1ee6256b0),j=a(0x120c268ad),G=a.n(j),$=a(0x40c0d834),K=a(0x134e233cc),Y=a(0x10bae7b36),Q=a(0x30d8960c),Z=a(0x96aa1794),J=a(0x20570d71a),X=a(0x1a5ac3a0c),ee=a(0x242503693),et=a(0x4e250925),ea=a(0x1fcbb004d);let en=new o.Ay("workflow_builder"),DeleteSegmentConfirmationModal=({segment:e})=>{let t=(0,J.Y)(),a=(0,Z.j)(),l=(0,r.wA)(),{transitionFocusTo:i}=(0,n.useContext)(K.Ay),o=(0,n.useCallback)(()=>l((0,ea.O)()),[l]),[c,d]=(0,n.useState)(null),[u,m]=(0,n.useState)(!1),p=(0,n.useCallback)(async()=>l((0,et.Om)({workflowId:t,segment:e})),[l,e,t]),b=(0,n.useCallback)(()=>{d(null),i({focusKey:ee.Ay.PAGE_CONTENT_WORKFLOW_EDITOR_STEP_PREVIEW,focusMetadata:{id:e.id}}),o()},[o,e.id,i]),f=(0,n.useCallback)(()=>{m(!0),p().then(b).then(()=>{let t=(0,X.Wn)(a,e.id,{flattenSteps:!0})?.id||(0,X.Ev)(a,e.id,{flattenSteps:!0})?.id||Q.kr;i({focusKey:ee.Ay.PAGE_CONTENT_WORKFLOW_EDITOR_STEP_PREVIEW,focusMetadata:{id:t}})}).catch(d).finally(()=>m(!1))},[p,b,a,e.id,i]),g=en.t("Delete it"),h=en.t("Keep it"),_=en.t("Delete this step?"),y=en.t("Changes you\u2019ve made to this step will be lost, and other steps might stop working if they\u2019re using information from the step you delete.");return n.createElement(Y.A,{submitButtonText:g,submitButtonType:"danger",cancelButtonText:h,showCancelButton:!0,title:_,onCancel:b,onClose:b,onSubmit:f,isSubmitting:u,isSubmitButtonALoadingButton:!0},c&&n.createElement(s.Ay,{className:"margin_bottom_100",level:"error",align:"left"},n.createElement("span",null,en.t("There was an error deleting your step."))),n.createElement("span",null,y))};DeleteSegmentConfirmationModal.displayName="DeleteSegmentConfirmationModal";var er=a(0x11a296110),el=a(0x409e023f),ei=a(0xf7ab484f),eo=a(0x1df96de4c),es=a(0x12edaa96a),ec=a(0x1e4ad58a2),ed=a(0x1ee57b3a0),eu=a(0x1fa67866c),em=a(0xb1ea448c),ep=a(0x12cef2078),eb=a(0x6713bca9),ef=a(0xcb036ba),eg=a(0xb0ca5b2),eh=a(0x252b4df6e),e_=a(0x171a52b74),ey=a(0x184767f39);let ex=new o.Ay("hermes_builtin_workflow_templates"),{USER_CANNOT_USE_FUNCTION:ev}=H.oh,{END_USER_OAUTH_REQUIRES_LAST_INTERACTOR:eE,HOME_TEAM_ONLY:ek}=H.eb;function useSegmentPreviewAlert({coachmark:e,configurationStatusForApp:t,errorCode:a,errorMessage:r,errorCount:l,hideAlert:i,isTriggerRestrictedToUserWarning:o,segment:c}){let d=(0,Z.j)(),m=d?.workflow,p=!!m&&(0,u.T0)(m),b=!!c&&(0,e_.GS)(c),f=b?(0,eh.P)(c):void 0,g=!!e,h=b&&!!c.config.is_pristine,_=(0,D.d4)(e=>(0,F.tx)(e,c)),y=!g&&(!!a||_)&&!h,x=(0,D.d4)((0,M.sx)(m?.id||"",F.MR))||!1,v=(0,n.useMemo)(()=>c&&d?(0,X.e5)(d,c.id):[],[c,d]),E=v.find(({code:e})=>e===ek),k=x&&!!E,w=!!t&&t!==ey.aW.READY,S=(0,n.useMemo)(()=>!!b&&(0,X.uG)(d,c.config.slackFunction?.app_id??""),[b,c,d]),C=v.some(({code:e})=>e===eE),A=(0,eg.r)({workflow:d,segment:c,contextStepId:c?.id}),T=!y&&(k||w||S||C||o)||A,I=!i&&(g||y||T||h&&p&&!!a),N={alertContent:"",alertLevel:s.A_.default,shouldShowAlert:I,shouldShowErrors:y};if(A)return{...N,shouldShowAlert:I,alertIcon:s.A_.warning,alertContent:ex.t("Duplicate branch rules \u2014 These rules are the same as another branch. Since workflows only run on the first matching branch, consider updating the rules to make them unique.",{fallbackHash:"ac05f9ff2190d565dcbb192f6bcb797d3a33acec",fallbackHashNs:"workflow_builder"}),alertLevel:s.A_.warning};if(!I)return N;if(e&&e.level!==s.A_.success)return{...N,alertContent:e.title,alertLevel:e.level};if(w)return{...N,alertContent:ex.t("Step requires configuration in order to run."),alertLevel:s.A_.warning};if(k)return{...N,alertContent:E?.message,alertLevel:s.A_.warning};if(C)return{...N,alertContent:ex.rt("<strong>Needs attention.</strong> The account used for this step must be updated."),alertLevel:s.A_.warning};if(o)return{...N,alertContent:ex.t("This trigger has been restricted by an admin. Please reach out to your admin for help."),alertLevel:s.A_.warning};if(e)return{...N,alertContent:ex.rt("Complete \u2014 {title}",{title:e.title}),alertLevel:s.A_.success};let L=_?ei.aU:a;if(L){let e,t=s.A_.error,a=n.createElement(ef.Z,{errorCode:L,errorMessage:r,errorCount:l,slackFunction:f,viewContext:ef._.PREVIEW});return S&&(e="flag",t=s.A_.warning),L===ev&&(t=s.A_.warning),m&&(0,u.T0)(m)&&h&&(t=s.A_.info),{...N,alertIcon:e,alertContent:a,alertLevel:t}}return N}useSegmentPreviewAlert.displayName="useSegmentPreviewAlert";var ew=a(0x118c611);let eS=(0,n.createContext)(void 0);var eC=a(0xf6b2f43b),eA=a(0x154dd8295),eT=a(0x21c71bcdd),eI=a(0x148f558fa),eN=a.n(eI);let eM=new o.Ay("hermes_builtin_workflow_templates"),BaseSegmentPreview=({title:e,subtitle:t=null,icon:a,button:r=null,actionsMenuButtons:l=eo.Ml,segment:i,children:o=null,onEdit:c,errorCode:u,errorMessage:m,errorCount:p,coachmark:b=null,shouldUseSingleButton:f,className:g,isTriggerRestrictedToUserWarning:h=!1,configurationStatusForApp:_,isDragActive:y=!1,isDuplicatingStep:x=!1,onClickHeader:v,hideAlert:E=!1,stepIndex:k,isLoading:w,isLastStep:S,headingSize:A="h2"})=>{let T=(0,eC.u)(),N=!!i&&(0,e_.GS)(i),{workflowStepBeingDraggedId:M}=(0,ew.x)(),L=(0,n.useContext)(eS),[O,F]=(0,n.useState)(!1),[D,P]=(0,n.useState)(!1),R=!!i&&L?.lastAddedStepId===i.id,B=N&&(0,X.U5)(i),W=N&&(0,X._Q)(i),V=i&&(0,eA.Ag)(i),H=(0,n.useRef)(null),q=(0,n.useCallback)(()=>{F(!0)},[]),U=(0,n.useCallback)(()=>{F(!1)},[]),z=(0,n.useCallback)(()=>{P(!0)},[]),j=(0,n.useCallback)(()=>{P(!1)},[]),K=(0,n.useCallback)(e=>{if(!e.defaultPrevented){if(v)return void v();T||c?.()}},[T,c,v]),Y=!!(v||c),Q=(0,es.A)(),{alertContent:Z,alertIcon:J,alertLevel:ee,shouldShowErrors:et,shouldShowAlert:ea}=useSegmentPreviewAlert({coachmark:b,configurationStatusForApp:_,errorCode:u,errorMessage:m,errorCount:p,hideAlert:E,isTriggerRestrictedToUserWarning:h,segment:i});return(0,n.useEffect)(()=>{H?.current&&R&&L&&(H.current.focus(),L?.setLastAddedStepId(""))},[L,R]),(0,n.useEffect)(()=>{y&&H?.current&&H.current?.focus()},[y,H]),n.createElement("div",{className:G()(eN().container,"base-template-preview-draggable-section",{[eN().has_errors]:et,[eN().has_no_section]:!o,[eN().is_last_step]:S,[eN().drag_active]:!!M},g),onMouseEnter:q,onMouseLeave:U,onFocus:z,onBlur:j,"data-qa":`segment-preview-${i?.id??"new-segment"}`},ea?n.createElement("div",{className:G()(eN().segment_alert_container,{[eN().branch_alert]:V})},n.createElement(s.Ay,{align:"left",className:eN().segment_alert,"data-qa":"base-segment-preview-alert",icon:J,level:ee},Z)):null,n.createElement(ec.A,{className:G()(eN().preview,{[eN().has_alert_info]:ea&&ee===s.A_.info,[eN().has_alert_success]:ea&&ee===s.A_.success,[eN().has_alert_error]:ea&&ee===s.A_.error,[eN().has_alert_warning]:ea&&ee===s.A_.warning,[eN().header_is_clickable]:Y})},n.createElement(ed.A,{className:eN().header},n.createElement("div",{ref:H,"data-qa":"drag-handle",id:i?`segment-edit-${i?.id}`:"",className:G()(eN().headerInfo,{[eN().canClick]:!T&&Y,[eN().isBranch]:V}),onClick:K,role:Y?"button":void 0},w&&n.createElement("div",{className:eN().loadingSpinner},n.createElement(em.A,{size:"large"})),!w&&a&&n.createElement(eb.J,{icon:a,isFocusedOrHovering:(D||O)&&!y}),n.createElement("div",{className:eN().headerText},B&&n.createElement(d.Zn,{element:"p"},eM.rt("Custom Step")),W&&n.createElement(d.Zn,{element:"p"},eM.rt("Third Party Step")),n.createElement(d.nB,{id:Q,element:A,weight:"bold",className:eN().title},n.createElement(ep.X,{preventDefault:!0,stopPropagation:!1},k?`${k}. `:"",e)),!B&&!W&&t&&n.createElement(d.Zn,{element:"p"},t))),n.createElement("div",{className:eN().buttonContainer},y||x?n.createElement(em.A,{size:"large",className:"margin_right_100"}):n.createElement($.A,{eventId:I.EventId.WORKFLOW_BUILDER,uiStep:I.UiStep.WORKFLOW_EDITOR,elementName:C.KC.StepActionsMenu,uiComponentName:C.KC.StepActionsMenu,clogImpression:!1},f?r:n.createElement(eT.A,{className:eN().actions_menu,showOnlyOnHover:!O,items:l,isFocused:D,outlined:O,toolbarAriaLabel:eM.t("Step primary actions",{fallbackHash:"c3cd636a585b20c40ac2df5ffb403e83cb2eef51",fallbackHashNs:"workflow_builder"})})))),o&&n.createElement(eu.A,{className:eN().section},o)))};BaseSegmentPreview.displayName="BaseSegmentPreview";var eL=a(0x240c7a514),eO=a(0xb8ff08bd),eF=a(0x162e18dce),eD=a(0xee12becf),eP=a(0x20a2a54fa),eR=a(0xbf22577d);function useSegmentPreview(e,t){let a=(0,eP.EM)(t);return(0,n.useMemo)(()=>t.type===S.SLACK_FUNCTION?(0,eR.n)(e,t,a,{isEditor:!0}):null,[t,a,e])}var eB=a(0xaaa6bbd0),eW=a(0x126af815a),eV=a(0x1fbc3c543),eH=a(0x8fb98cae);function useSegmentCoachmark(e,t,a=!1,r){let[l,i]=(0,n.useState)(null),o=(0,n.useCallback)(()=>{let n=(0,eH.uT)({workflowId:t});if(!n){r&&i({title:r,level:s.A_.info});return}let{coachmarks:l}=n,o=a?eV.m.TRIGGER:e,c=l?.[o];r&&i({title:r,level:c??s.A_.info})},[t,r,a,e]);return(0,n.useEffect)(()=>(o(),(0,eH.B1)(a?eV.m.TRIGGER:e,()=>{o()}),()=>{(0,eH.al)(e)}),[o,a,e]),l}var eq=a(0x13b2d52cd),eU=a(0x24eaf48aa),ez=a(0x61c95b1b),ej=a(0x112dbb8f3),eG=a(0x1e9747fe7),e$=a(0x2a037c8a),eK=a(0x1cf0d97e1),eY=a(0x14ea3ce99);let eQ=(0,eK.Ay)((e,t)=>{let a=(0,ej.vd)(t),n=getConfiguredParameters(t),r=getFilterStatements(n);if(a!==ez.$.ListRecordUpdated||!r.length)return!1;let l=n.listId?.value||"",i=(0,eY.Lp)(e,l);if(i.isNonExistent)return!1;let o=(0,eG.wf)(i.list_metadata?.schema??[]);for(let e of r)if(void 0===o.find(t=>t.id===e.field))return!0;return!1});function getFilterStatements(e){for(let t of Object.keys(e)){let a=e[t];if("filter"===t){let e=a.value;if(Array.isArray(e))return e;return[e]}}return[]}function getConfiguredParameters(e){let t=e.config.inputParameters;return t&&0!==t.length?t.reduce((t,a)=>(a.isFilter?t[a.name]={value:(0,ej.QS)(e.config.event,a.name)}:("channelIds"===a.name||"teamIds"===a.name||"metadataEventType"===a.name||"listId"===a.name)&&(t[a.name]={value:e.config.event[a.name]||null}),t),{}):{}}eQ.meta={name:"hasUpdateListErrors",key:"createSelectorHasUpdateListErrors",description:(e,t)=>{let a=(0,ej.vd)(t),n=getConfiguredParameters(t),r=getFilterStatements(n);if(a!==ez.$.ListRecordUpdated||!r.length)return!1;let l=n.listId?.value||"",i=(0,eY.Lp)(e,l);if(i.isNonExistent)return!1;let o=(0,eG.wf)(i.list_metadata?.schema??[]);for(let e of r)if(void 0===o.find(t=>t.id===e.field))return!0;return!1}};var eZ=a(0x19561ce96),eJ=a(0x14149c126),eX=a(0x16ffed5ab);let e0=new o.Ay("workflow_builder");function onAboutClick(){return null}let LoadedSegmentPreview=({onEdit:e,onDelete:t,segment:a,isTrigger:l,isTriggerAvailable:o=!1,onMoveUp:d,onMoveDown:u,isDragActive:m,isDragDisabled:p,hideError:f})=>{let g=(0,r.wA)(),h=(0,T.A)(),_=(0,Z.j)(),y=(0,X.DY)(_),x=useSegmentPreview(y,a),v=(0,D.d4)(e=>{if(a.type===e$.M.Event&&eQ(e,a))return H.oh.INVALID_FIELD_FOR_LIST_TRIGGER}),E=(0,eO.f)({workflow:_,segment:a,isTrigger:l??!1}),k=(0,eU.XS)(_,a)||v||E,w=l||k!==ei.Jx?k:ei.qP,S=(0,eU.nh)(_,a,w),[A,N]=(0,n.useState)(!1),L=(0,D.d4)(e=>(0,F.JA)(e,y)),O=(0,D.d4)(F.EP),P=(0,D.d4)((0,M.sx)(y,F.uY))?.steps||[],R=(0,X.B5)(a.id,P),B=!!w,W=(0,eC.u)(),V=useSegmentCoachmark(a.id,y,l??!1,a.coachmarkText),U=(0,X.ux)(_),z=l&&a.type===eW.zW,j=(0,eD.S)(a,B),G=(0,e_.GS)(a)&&a.config.slackFunction?.app_id||"",$=(0,D.d4)(e=>(0,eZ.Ez)(e,G)),Y="on"===(0,D.d4)(e=>(0,eJ._Z)(e,"step_request_in_editor_segment")),J=(0,D.d4)(e=>"on"===(0,eJ._Z)(e,"fe_link_tokenization")),ea=(0,n.useMemo)(()=>l?"h2":_?(0,X.YJ)(a.id,_):"h2",[a.id,_,l]),en=(0,eF.E)(a),{transitionFocusTo:eo}=(0,n.useContext)(K.Ay),es=(0,n.useCallback)(()=>l?e0.rt("<span>Trigger: </span>{summary}",{summary:j},({text:e,tag:t})=>"span"===t?n.createElement("span",{className:eN().offScreen},e):null):e0.rt("<span>Step {index}:</span>{summary}",{index:R,summary:j},({text:e,tag:t})=>"span"===t?n.createElement("span",{className:eN().offScreen},e):null),[l,j,R]),ec=(0,eL.rz)({segment:a,wrappedFunctionDetails:en}),ed=(0,n.useMemo)(()=>(0,X.nB)(_,a.id),[a.id,_]),eu=V?.level===s.A_.info,em=!!l&&!o,ep=(0,D.d4)(e=>(0,eZ.$E)(e,G)),{windowRef:eb}=(0,i.ox)(),ef=(0,n.useCallback)(()=>{_&&((0,eq.M)({workflow:_,optionalWindow:eb.deref(),experimentFeLinkTokenizationGroupOn:J}),g((0,eX.M)({element:n.createElement(c.A,null,e0.t("URL copied to clipboard."))})),(0,C.K$)({clogger:h,uiArgs:{step:I.UiStep.WORKFLOW_EDITOR},uiProperties:{element_name:C.KC.CopyWorkflow,element_value:I.UiStep.WORKFLOW_COPY_URL},wbArgs:{is_hermes:!0}}))},[_,g,h,eb,J]),eg=(0,n.useMemo)(()=>W?e0.t("View"):eu?e0.t("Configure"):e0.t("Edit"),[eu,W]),eh=eu?"primary":"outline",ex=W?e0.t("View trigger"):e0.t("Edit"),ev={edit:{tooltip:ex,onClick:e,ariaLabel:ex},copy:{tooltip:e0.t("Copy workflow link"),onClick:ef,ariaLabel:e0.t("Copy workflow link")},about:{tooltip:e0.t("About this step"),onClick:onAboutClick,ariaLabel:e0.t("About this step")}},eE=(0,n.useCallback)(()=>g((0,q.q)({element:n.createElement(el.u,{appId:G})})),[G,g]),ek=$===ey.pY.INIT_APP_REQUEST_FLOW?eE:void 0,ew=(0,eL.jh)($)&&(!(0,eB.Pv)(a)||!(0,b.GU)(en)),eS=Y?(0,eL.so)($):void 0,{canMoveStepUp:eA,canMoveStepDown:eT}=(0,X.Cz)(a.id,_),eI=(0,e_.GS)(a)?async()=>{try{N(!0);let e=await g((0,et.rG)({workflowId:y||"",segments:[a]}));eo({focusKey:ee.Ay.PAGE_CONTENT_WORKFLOW_EDITOR_STEP_PREVIEW,focusMetadata:{id:e[a.id]||Q.kr}})}catch(a){let e=e0.t("There was an error duplicating this step."),t=e0.t("You don\u2019t have permission to duplicate this step.");g((0,eX.M)({element:n.createElement(c.A,null,"invalid_token"===a.name?t:e)}))}finally{N(!1)}}:void 0,eM=(0,eL.iT)({methods:{onEdit:e,onAboutClick,onDelete:t,onMoveUp:d,onMoveDown:u,onDuplicate:eI},viewOnly:W,segment:a,hasMaxNumberOfSteps:L,maxNumberOfSteps:O}),eP=(0,eL.H8)(eM,{viewOnly:W,firstStep:!eA,lastStep:!eT,isDragDisabled:p});ew||(eP=eP.filter(e=>"segment_edit_btn"!==e.key));let eR=l?(0,eL.Xw)(ev,!!(z&&U)):eP,eV=(0,n.useMemo)(()=>n.createElement(er.Ay,{onClick:e,type:eh,className:"margin_right_75",size:"small","aria-label":W?e0.t("View workflow segment"):e0.t("Edit workflow segment"),"data-qa":l?"edit-trigger":"edit"},eg),[e,eh,W,l,eg]);return n.createElement(BaseSegmentPreview,{title:es(),icon:ec,errorCode:f?void 0:w,errorMessage:f?void 0:S,onEdit:ew&&!em?e:void 0,coachmark:U?null:V,isTriggerRestrictedToUserWarning:em,configurationStatusForApp:ep,segment:a,isDragActive:m,isDuplicatingStep:A,button:eV,actionsMenuButtons:em?void 0:eR,subtitle:eS,onClickHeader:Y?ek:void 0,stepIndex:l?void 0:R,isLoading:ed,headingSize:ea},x)};LoadedSegmentPreview.displayName="LoadedSegmentPreview";var e1=a(0x2501a2cee),e2=a(0x1b81e2549),e4=a(0x9e38a344),e8=a(0x2334f665b),e5=a(0x210eb9aa7),e6=a(0x18a7c6ee0),e3=a.n(e6);function LineIndicator({top:e=!1,text:t,stepType:a}){let[r,l]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{l(!0)},[]),n.createElement("div",{className:G()([e3().lineIndicator],{[e3().topLineIndicator]:e,[e3().followsBranch]:a===e5.t,[e3().showIndicator]:r})},t)}LineIndicator.displayName="LineIndicator";var e7=a(0x3b40b621);let e9=new o.Ay("workflow_builder"),te={[S.SLACK_FUNCTION]:[S.SLACK_FUNCTION],[e5.t]:[S.SLACK_FUNCTION,e5.t,e5.Fo],[e5.Fo]:[e5.t,S.SLACK_FUNCTION],[e7.h]:[S.SLACK_FUNCTION,e7.h]};function determineWhichHalfIsHovering(e,t){let a=e.getBoundingClientRect(),n=t.getClientOffset(),r=!1;return n&&(r=n.y<a.top+a.height/2),r}let canLiveInSameArrayHierarchy=({dragStepType:e,dropStepType:t})=>e===e5.Fo&&t===e5.Fo||e===t||e===S.SLACK_FUNCTION&&t===e5.Fo,isDroppingIntoSelf=({dragStep:e,dropStepId:t})=>{let isDroppingIntoSelfHelper=e=>{if(e.id===t)return!0;if("steps"in e&&e.steps){for(let t of e.steps)if(isDroppingIntoSelfHelper(t))return!0}return!1};return isDroppingIntoSelfHelper(e)},hasSwitchStep=e=>{for(let t of e)if(t.step_type===e5.Fo||t.steps&&hasSwitchStep(t.steps))return!0;return!1},countSwitchStepsAtStepId=(e,t,a)=>{for(let n of e){let e=a;if(n.step_type===e5.Fo&&(e+=1),n.id===t)return e;if(n.steps){let a=countSwitchStepsAtStepId(n.steps,t,e);if(a>=0)return a}}return -1},StepDragWrapper=({children:e,step:t})=>{var a;let l=(0,r.wA)(),{windowRef:o}=(0,i.ox)(),s=(0,eC.u)(),{workflowStepBeingDraggedId:c,setStepBeingDraggedId:d}=(0,ew.x)(),[u,m]=(0,n.useState)(!1),p=(0,n.useRef)(!1),b=(0,n.useRef)(void 0),f=(0,n.useRef)(null),g=(0,n.useRef)(null),h=(0,J.Y)(),_=(0,D.d4)((0,M.sx)(h,F.RG)),y=(0,X.gi)(_&&_.workflow),x=t.id,v=(0,X.Dv)(x,_&&_.workflow),E=t.type||t.step_type||v?.step_type||"",k=v?.parent_step_id,w=(0,X.Wn)(_,x),C=E===e5.t,A=C&&!("expression"in t),T=E===e5.Fo&&!k,I=!!(s||A||T||c),[N,L,O]=(0,e2.i)(()=>({type:E,item:{dragStep:v,childItemRef:g},canDrag:!I,collect:e=>({isDragging:!!e.isDragging(),dragItemType:e.getItemType()})}),[E,I,v]),P=(0,n.useCallback)(e=>{let t=(0,X.Wn)(_,e);return x===t?.id&&!p.current},[_,x]),R=(0,n.useCallback)(e=>{let t=(0,X.Ev)(_,e);return x===t?.id&&!!p.current},[_,x]),[B,W]=(0,e4.H)(()=>({accept:te[E],options:{},drop:(e,t)=>{if(!d)return;let a=e?.dragStep?.id,n=canLiveInSameArrayHierarchy({dragStepType:t.getItemType(),dropStepType:E}),r=p.current&&n,i=(({stepId:e,parentStepId:t,precedingStepId:a,isHoveringOverTopHalfOfPeer:n})=>n?a||t?!a&&t?t:a:void 0:e)({stepId:x,parentStepId:k,precedingStepId:w?.id,isHoveringOverTopHalfOfPeer:r});d(a),l((0,et.Ju)({workflowId:h,sourceStepId:a,destinationStepId:i})).then(()=>d(void 0))},hover:(e,t)=>{let{dragStep:a}=e;a&&!(x===a.parent_step_id||isDroppingIntoSelf({dragStep:a,dropStepId:x}))&&(b.current||(b.current=o?.deref()?.requestAnimationFrame(()=>{if(b.current=void 0,f.current){let e=determineWhichHalfIsHovering(f.current,t);p.current=e,m(e)}})))},canDrop:(e,t)=>{let{dragStep:a}=e,n=a?.id;if(!t.isOver({shallow:!0})||!a||!n)return!1;let r=A&&!p.current,l=E===e5.Fo&&!p.current,i=x===a.parent_step_id,o=hasSwitchStep([a])&&countSwitchStepsAtStepId(y,x,0)>=e5.pE;return!(i||P(n)||R(n)||isDroppingIntoSelf({dragStep:a,dropStepId:x}))&&!r&&!l&&!o},collect:e=>({isOver:e.isOver({shallow:!0}),canDrop:e.canDrop()})}),[E,d,x,k,w?.id,l,h,o,A,y,P,R]),V=canLiveInSameArrayHierarchy({dragStepType:N.dragItemType,dropStepType:E}),H=B.isOver&&B.canDrop&&V,q=B.isOver&&B.canDrop&&!V,U=H&&u&&!w&&N.dragItemType===S.SLACK_FUNCTION,z=(a=N.dragItemType)===e5.t?e9.t("Move branch here"):a===e5.Fo?e9.t("Move branches here"):e9.t("Move step here"),j=n.createElement(LineIndicator,{top:!0,stepType:E,text:z}),$=n.createElement(LineIndicator,{stepType:E,text:z}),K=n.createElement("div",{className:G()(e3().backgroundIndicator,{[e3().showIndicator]:q})},z),Y=n.createElement("span",{className:G()(e3().dragHandle,{[e3().isBranch]:C})},n.createElement(e1.Ah,{name:"reorder",size:"20",inline:!0})),Q=(0,n.useCallback)(e=>(f.current=e,g.current=e,L(W(e))),[L,W]);return(0,n.useEffect)(()=>{O((0,e8.n)(),{captureDraggingState:!0})},[O]),n.createElement("div",{ref:Q,className:G()(e3().dragWrapper,{[e3().isDraggable]:!I,[e3().isDragging]:N.isDragging,[e3().isDroppingSlackFunctionStepBeforeFirstInGroup]:U})},H&&u&&j,K,Y,e,H&&!u&&$)};StepDragWrapper.displayName="StepDragWrapper";var tt=a(0x541e4bc7),ta=a(0x1d406c23),tn=a.n(ta);function getLoopIcon(){return n.createElement("div",{className:`${tn().repeater_icon} ${tn().repeater_icon_with_theme}`},n.createElement(e1.Ah,{name:"refresh",inline:!0,size:"20"}))}getLoopIcon.displayName="getLoopIcon";let LoopSegmentPreview=({segment:e,numberOfSteps:t,onEdit:a,onDelete:r,openLibrary:l,onMove:i,renderNestedStepList:o})=>{let s=(0,Z.j)(),c=(0,X.DY)(s),d=(0,n.useRef)(null),u=(0,eD.S)(e),m=(0,D.d4)((0,M.sx)(c,F.Pb)),p=getLoopIcon(),b=(0,D.d4)((0,M.sx)(c,F.c3)),f=(0,n.useMemo)(()=>m.find(t=>t.id===e.id)?.steps??[],[e.id,m]),g=(0,n.useMemo)(()=>f.map(e=>(0,eh.lq)(e,b?.[e.id])),[f,b]),h=(0,eC.u)(),{canMoveStepUp:_,canMoveStepDown:y}=(0,X.Cz)(e.id,s),x=(0,n.useCallback)(()=>{if(!i)return;let t=m.findIndex(t=>t.id===e.id);t>0&&i(t-1,t)},[i,m,e.id]),v=(0,n.useMemo)(()=>m.findIndex(t=>t.id===e.id),[e.id,m]),E=(0,n.useCallback)(()=>{i&&v<m.length-1&&i(v+1,v)},[i,v,m.length]),k=(0,eL.iT)({methods:{onEdit:a,onDelete:r,onMoveUp:_&&i?x:void 0,onMoveDown:y&&i?E:void 0,onDuplicate:void 0},viewOnly:h,segment:e,hasMaxNumberOfSteps:t>=tt.v9,maxNumberOfSteps:tt.v9}),w=(0,eL.H8)(k,{viewOnly:h,firstStep:!_,lastStep:!y,isDragDisabled:!1}),S=n.createElement(BaseSegmentPreview,{title:u,icon:p,className:tn().repeater_top_level_preview,segment:e,onEdit:a,actionsMenuButtons:w});return n.createElement("div",{className:[tn().repeater_segment_wrapper,tn().supports_nested].join(" "),"data-qa":"loop-segment-preview",ref:d},n.createElement(StepDragWrapper,{step:e},S,n.createElement("div",{className:tn().repeater_list_wrapper},o&&g.length>0&&n.createElement("div",{className:tn().nested_step_list},o({segments:g,openLibrary:l,onMove:i,numberOfSteps:t})))))};LoopSegmentPreview.displayName="LoopSegmentPreview";var tr=a(0x21f3c49e8),tl=a(0x1789e94fa),ti=a(0x159a857e);let to=new o.Ay("workflow_builder"),MissingSegmentPreview=({segment:e,isTrigger:t,isLoading:a=!1,onDelete:i=l.A})=>{let o=(0,r.wA)(),s=(0,Z.j)(),c=(0,eC.u)(),d=(0,X.DY)(s),u=(0,D.d4)(F.EP),m=!t&&e?(0,eL.iT)({methods:{onEdit:l.A,onDelete:i,onAboutClick:l.A,onMoveDown:l.A,onMoveUp:l.A},viewOnly:c,segment:e,maxNumberOfSteps:u}):void 0,p=m?(0,eL.H8)(m,{viewOnly:c,isDragDisabled:!0,isUnknownStep:!0}):void 0,b=(0,n.useCallback)(()=>{o((0,q.q)({element:n.createElement(z.G,{workflowId:d})}))},[o,d]),f=to.t("Choose an event"),g=(0,tr.A)(e)?void 0:e,h=(0,n.useMemo)(()=>[{key:"trigger_edit_btn",tooltip:f,ariaLabel:f,dataQa:"trigger_edit_btn",dataId:"trigger_edit_btn",onClick:b,svgIconProps:{name:"edit",size:"20"}}],[b,f]),_=(0,n.useMemo)(()=>n.createElement(n.Fragment,null,a?n.createElement(em.A,{color:"blue",size:"large"}):n.createElement("div",{"data-qa":"missing-trigger-preview__button"},n.createElement(BaseSegmentPreview,{title:f,icon:"bolt",actionsMenuButtons:h,onClickHeader:b}))),[a,b,h,f]);return t?n.createElement(tl.A,{spaceName:ti.L.spaceName,notifications:ti.L.notifications,shouldAlwaysRenderChildren:!0},_):n.createElement(BaseSegmentPreview,{title:to.t("Step missing"),icon:"warning",segment:g,errorCode:X.TK,actionsMenuButtons:p})};MissingSegmentPreview.displayName="MissingSegmentPreview";var ts=a(0xa6f3163b),tc=a(0x4c96e5d9),td=a(0x12b6a33fc),tu=a(0x1cf7e09ae),tm=a.n(tu);let tp=new o.Ay("workflow_builder"),AddStepButton=({className:e,ariaLabel:t,tooltipText:a,isHovered:r=!1,onClick:l})=>{let i=(0,n.useRef)(!0),o=tp.t("Add Step"),s=tp.t("Add step here",{fallbackHash:"d185bda2ffe5653622bb995d9dc31f979c45a9dd"}),c=n.createElement("span",{"aria-hidden":!0},a??s);return(0,n.useEffect)(()=>(i.current=!0,()=>{i.current=!1}),[]),n.createElement(tc.Ay,{tip:c,position:td.Zj.Right,tipArrowOffset:20,delay:tc.PK},n.createElement(ts.A,{className:G()(tm().button,e,{[tm().isHovered]:r,[tm().animate]:i.current}),onClick:l,type:"outline","aria-label":t??o},n.createElement(e1.Ah,{name:"plus",size:"18"})))};AddStepButton.displayName="AddStepButton";var tb=a(0x13860370b),tf=a.n(tb);let tg=new o.Ay("workflow_builder"),AddBranchDividerButton=({onClick:e,isFirstBranch:t,showAddBranch:a=!0})=>{let[r,l]=(0,n.useState)(!1),i=(0,n.useCallback)(()=>l(!0),[l]),o=(0,n.useCallback)(()=>l(!1),[l]);return a?n.createElement("div",{className:G()(tf().addBranchDividerButtonWrapper,{[tf().firstBranch]:t}),onMouseEnter:i,onMouseLeave:o},n.createElement(AddStepButton,{className:tf().addBranchDividerButton,onClick:e,isHovered:r,tooltipText:tg.t("Add branch here",{fallbackHash:"9b2e9835f74eb062f4e82226de30a918583f644f"})})):n.createElement("div",{className:"padding_bottom_125"})};AddBranchDividerButton.displayName="AddBranchDividerButton";let BranchLine=({switchWrapperRef:e,branchPreviewRef:t,children:a,className:r="",isAnyBranchCollapsing:l=!1,index:i=e5.GI})=>{let o=(0,n.useRef)(null),[s,c]=(0,n.useState)(()=>({"--after-line-bottom-position":"100%","--line-z-index":-10}));(0,n.useEffect)(()=>{if(!e?.current||!t?.current)return;let a=e.current.getBoundingClientRect(),n=t.current.getBoundingClientRect(),r=a?.top??0,l=n?.top+n?.height/2;c({"--after-line-height":`${l-r}px`,"--line-z-index":-Math.abs(i)})},[e,t,i]);let d=G()(tf().branch_line_reference,r,{[tf().is_branch_collapsing]:l});return n.createElement("div",{className:d,ref:o,style:s},a)};BranchLine.displayName="BranchLine";var th=a(0x14abc22b0),t_=a(0x102edf836),ty=a(0x1795d8821),tx=a(0x210b99e76),tv=a(0x21453d73b),tE=a(0x1817ab90d),tk=a(0x2339a0d72);let getStepClickAutoClogProps=(e,t,a)=>{if(e)return{elementType:I.ElementType.MENU_ITEM,displayName:a,onClick:{enableClogAction:!0},workflowBuilderWorkflowId:(0,X.DY)(e),workflowBuilderStepType:t}};var tw=a(0x1d9a37519),tS=a(0x95583610),tC=a(0x15f4f83cf),tA=a(0x145d46a61),tT=a(0x70de3606),tI=a(0x167d76333),tN=a(0x1fe613d6e),tM=a(0x1ec68d6a3),tL=a(0x158cf1cb),tO=a(0x20d4168fd),tF=a(0xcf8edac8),tD=a(0x16e94c2bd);let isReactionAddedTriggerWithMultipleEmojis=e=>e&&"event"===e.type&&e.event_type===ez.$.ReactionAdded&&e?.filter&&Array.isArray(e.filter.root.inputs)&&e.filter.root.inputs.length>1,tP=(0,W.Ay)("Add Branch Button Steps",async(e,t,{workflowId:a,sendMessageStepId:n})=>{let r,l=t(),i=(0,F.FB)(l,a),o=(0,F.uY)(l,a),s=(0,m.a)(o),c=(0,tM.default)({getState:t,label:tF.y});if(!i||!o)return;let d=s.find(e=>e.id===n),u=d?.inputs?.interactive_blocks?.value,p=(u?.find(e=>"actions"===e.type)?.elements??[]).map(e=>e.action_id),b=Object.values(i??{}).filter(e=>{if("button"===e.type){let t=e?.id?e.id.split(".")?.pop()?.replace("}}",""):void 0;return t&&p.includes(t)}return!1});if(!b.length)return;let f=!0;try{for(let t of b){let a=r??n;if(!t?.id)return;r=r??(0,es.A)();let l=(0,tO.N1)({id:(0,es.A)(),inputs:{},outputs:[],available_data:[],expression:{version:1,root:{statement:{target:t.id}}}}),i=await e((0,et.zJ)({workflowId:o.id,segment:l,afterStepId:a,previousStepId:r,stepType:f?S.SWITCH:e5.t}));if(i){let e=(0,X.Nm)(l.id,S.SWITCH,{workflow:i,availableData:{}})?.steps??[];r=e[e.length-1]?.id??r,f=!1}}}catch(e){throw c.error(Error(`Failed to add branches for buttons: ${e}`)),e}});tP.meta={name:"addConditionalBranchesForButtons",key:"createThunkAddConditionalBranchesForButtons",description:"Add Branch Button Steps"};let tR=(0,W.Ay)("Add Branch Emoji Reaction Steps",async(e,t,{workflowId:a})=>{let n,r=t(),l=(0,F.FB)(r,a),i=(0,F.RX)(r,a),o=(0,F.uY)(r,a),s=(0,tM.default)({getState:t,label:tF.y});if(!l||!o||!(i&&"event"===i.type&&i.event_type===ez.$.ReactionAdded))return;let c=Object.values(l??{}).filter(e=>"emoji"===e.type),d=c.reduce((e,t)=>{if(t?.reference){let{inputPath:a}=(0,tD.Cr)(t.reference),n=`{{${tD.B2.TRIGGER}.${a}}}`;e.includes(n)||e.push(n)}return e},[]);try{for(let t of c){let a=n??void 0;if(!t?.id)return;n=n??(0,es.A)();let r=(0,tO.N1)({id:(0,es.A)(),inputs:{},outputs:[],available_data:[],expression:{version:1,root:{statement:{target:t.id}}}},void 0,d),l=await e((0,et.zJ)({workflowId:o.id,segment:r,afterStepId:a,previousStepId:n})),i=l?.steps.find(eA.Z1)?.steps??[],s=i[i.length-1];s&&(n=s.id)}}catch(e){throw s.error(Error(`Failed to add branches for emojis: ${e}`)),e}});tR.meta={name:"addConditionalBranchesForEmojiReactions",key:"createThunkAddConditionalBranchesForEmojiReactions",description:"Add Branch Emoji Reaction Steps"};var tB=a(0x110d7b067),tW=a(0x65561a6f),tV=a(0x73c05cda),tH=a(0x17f56e01a),tq=a.n(tH);let tU=new o.Ay("workflow_builder"),ActionButton=({buttonText:e,appId:t,callbackId:a,isLoading:r=!1,handler:l,autoClogProps:i})=>{let o=(0,n.useCallback)(()=>{l(a)},[l,a]),s=(0,n.useMemo)(()=>{if(r)return n.createElement(em.A,{className:tq().spinner,color:"blue",size:"large"});if(t)return n.createElement(tw.z,{appId:t,imageClassName:tq().suggestedStepIcon,size:20});let e=(0,tx.m)(a);return n.createElement(e1.Ah,{name:e,size:"20"})},[t,a,r]);return n.createElement(t_.Ay,{size:"medium",type:"outline",onClick:o,className:tq().actionButton,autoClogProps:i},s,n.createElement("div",null,e))};ActionButton.displayName="ActionButton";let tz={[tv.fH]:{interactive_blocks:{value:[(0,tk.AR)([(0,tk.OK)(!1,void 0,"primary")])]}},[tv.tM]:{interactive_blocks:{value:[(0,tk.AR)([(0,tk.OK)(!1,void 0,"primary")])]}}},SuggestionSegment=({isBeforeStep:e,workflow:t,trigger:a,step:l,stepId:i,stepCallbackId:o,prevStep:s,segmentErrors:c=[]})=>{let d=(0,r.wA)(),u=(0,D.d4)(tT.Il),m=(0,D.d4)(tI.F),b=(0,D.d4)(tN.K),f=(0,D.d4)(tA.Mw),g=(0,D.d4)(tA.dI),[h,_]=(0,n.useState)(tU.t("Suggested Step")),[y,x]=(0,n.useState)(""),[v,E]=(0,n.useState)(),[k,w]=(0,n.useState)(""),[A,T]=(0,n.useState)(!1),[N,M]=(0,n.useState)(!1),O=(0,X.DY)(t),{sendMessageToAnnouncerAPI:F}=(0,n.useContext)(th.A),P=(0,D.d4)(e=>(0,tM.default)({state:e})),W=s?s.id:void 0,V=s?(0,eh.Dp)(s):void 0,q=c.some(e=>e.source_id===i&&"code"in e&&e.code===H.oh.INVALID_USER_CONTEXT)&&e,U=c.some(e=>e.source_id===i&&"code"in e&&e.code===H.oh.INVALID_INTERACTIVITY_POINTER),z=isReactionAddedTriggerWithMultipleEmojis(a),j=!i&&!o&&z,G=!i&&!o&&!z,K=U&&e,Y=o===tv.qn&&e,Q=o===tv.qn&&!e,Z=o===tv.SY&&!e,J=o!==tv.W2&&tv.VK.includes(o||""),ee=o===tv.uT&&!e,ea=o===tv.nK&&!e,en=(0,p.jm)(t),er=(0,p.NY)(t),el=(0,X.W0)(i,t),ei=o&&[tv.tM,tv.fH].includes(o),eo=l?.config?.inputs?.interactive_blocks?.value,ec=eo?.find(e=>"actions"===e.type)?.elements??[],ed=(0,tE.fd)(ec),eu=(0,X.jA)(t.workflow),em=(0,D.d4)(B.vp),ep=!el&&ei&&ed&&em,eb=(0,n.useMemo)(()=>{let t=V&&[tv.tM,tv.fH].includes(V),a=t&&s?.config&&"inputs"in s.config&&(s?.config?.inputs?.interactive_blocks?.value??[]).length>0;return e&&!!V&&!!t&&!a},[V,s?.config,e]),ef=(0,D.d4)(e=>(0,eZ.Ez)(e,tL.xM)),eg=(0,n.useMemo)(()=>ef&&[ey.pY.INSTALL_SHOW_STEP_FUNCTION,ey.pY.SHOW_STEP_FUNCTION].includes(ef),[ef]),e_=(0,n.useMemo)(()=>[R.Ez.open_form,R.Ez.send_message,R.Ez.send_dm,R.Ez.list_add_record,R.Ez.share_canvas,R.Ez.add_canvas_tab_to_channel,R.Ez.canvas_create,R.Ez.channel_canvas_create,R.Ez.canvas_update_content_v2,R.Ez.send_summary_to_sales_home,R.Ez.invite_user_to_channel,R.wT.GOOGLE_SHEETS.add_spreadsheet_row,R.Ez.case_step,...f?[R.Ez.send_summary_to_my_sales_home]:[]],[f]),ex=(0,D.d4)(e=>(0,B.gL)(e,{ids:e_})),ev=(0,n.useMemo)(()=>ex.filter(tC.uz),[ex]),eE=(0,n.useMemo)(()=>new Map(ev.map(e=>[e.callback_id,e])),[ev]),ek=(0,n.useMemo)(()=>eg&&ev.find(e=>e.id===R.wT.GOOGLE_SHEETS.add_spreadsheet_row),[ev,eg]);(0,n.useEffect)(()=>{A&&F({assertive:!0,message:tU.t("loading\u2026"),uuid:(0,es.A)()})},[A,F]);let ew=(0,n.useCallback)((a,n)=>{let r=e?W:i,l=e?tz[n.callback_id]:void 0;Z&&[tv.fH,tv.tM].includes(n.callback_id)&&i&&(l={message:{value:[{type:"rich_text",elements:[{type:"workflowtoken",id:`{{steps.${i}.answer}}`,data_type:ty.TE.SlackTypesRichText,property:""}]}]}}),d((0,L.k)({stepType:a,workflow:t,afterStepId:r,slackFunction:n,inputs:l}))},[e,W,i,d,t,Z]),eS=(0,n.useCallback)(async e=>{let t=eE.get(e);if(!t)return;let a={type:S.SLACK_FUNCTION,subtype:t.id};if(e===tv.ad&&(a={type:S.SWITCH,subtype:e5.t}),eb&&[tv.tM,tv.fH].includes(e))try{let e={...s,config:{...s.config,inputs:{..."inputs"in s.config?s.config.inputs:{},interactive_blocks:{value:[(0,tk.AR)([(0,tk.OK)(!1,void 0,"primary")])]}}}};M(!0),d((0,et.nv)({workflowId:O,segment:e}))}catch(e){P.error("error updating message step with interactive block",e)}finally{M(!1)}else if(e===tv.A0&&ek)try{T(!0);let e=await d((0,tS.y)({appId:tL.xM,reason:"suggest-a-step/install-gSheets-app"}));e?.ok&&(T(!1),d((0,tW.o)({appIds:[tL.xM]})),ew(a,t))}catch(e){P.error(`error installing connector app info: ${tL.xM}`,e),T(!1),d((0,tB.H)({appName:tv.dN}))}else if(e===tv.ad)if(ed&&i)d(tP({workflowId:O,sendMessageStepId:i}));else if(j)try{M(!0),d(tR({workflowId:O}))}catch(e){P.error("error adding conditional branches for emoji reactions",e)}finally{M(!1)}else ew(a,t);else ew(a,t)},[eE,eb,ek,s,d,O,P,ew,ed,i,j]),eC=tU.t("Channel Message"),eA=tU.t("Direct Message"),eT=tU.t("Google Sheets"),eI=tU.t("List",{ns:"lists"}),eN=tU.t("Share a canvas"),eM=g?tU.t("Update a canvas"):"Update a canvas",eL=tU.t("Add a canvas tab to channel"),eO=tU.t("Add people to a channel"),eF=tU.t("Send Summary To Sales Home"),eD=f?tU.t("Send Summary To My Sales Home"):"Send Summary To My Sales Home";return(0,n.useMemo)(()=>{G?(_(tU.t("Choose your workflow steps")),x(tU.t("Add steps to your workflow to send messages automatically, use forms to collect info, or browse the full library of steps for more options.")),w(C.lp.StandaloneSuggestions),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eE.get(tv.fH)?.title,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),n.createElement(ActionButton,{buttonText:eE.get(tv.qn)?.title,handler:eS,callbackId:tv.qn,autoClogProps:getStepClickAutoClogProps(t,tv.hU,tv.Th)})))):j?(_(tU.t("Route your workflow based on emoji reactions")),x(tU.t("Want each emoji reaction to do something different? Turn them into workflow branches in one click.")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:tU.t("Add branches for each emoji reaction"),handler:eS,isLoading:N,callbackId:tv.ad,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add branches for each emoji")})))):Y?eb?(x(tU.t("You\u2019ll need to add a button to the above message to use a form in the next step.")),w(C.lp.SuggestedStepsBeforeForm),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:tU.t("Add a button"),handler:eS,callbackId:V||"",isLoading:N,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a button")})))):(x(tU.t("You\u2019ll need to add a message step with a button here to use a form in the next step.")),w(C.lp.SuggestedStepsBeforeForm),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),n.createElement(ActionButton,{buttonText:eA,handler:eS,callbackId:tv.tM,autoClogProps:getStepClickAutoClogProps(t,tv.WE,tv.cE)})))):K?eb?(x(tU.t("You\u2019ll need to add a button to the above message to use the interactive next step.")),w(C.lp.SuggestedStepsBeforeForm),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:tU.t("Add a button"),handler:eS,callbackId:V||"",isLoading:N,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a button")})))):(x(tU.t("You\u2019ll need to add a message step with a button here to use the interactive next step.")),w(C.lp.SuggestedStepsBeforeForm),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),n.createElement(ActionButton,{buttonText:eA,handler:eS,callbackId:tv.tM,autoClogProps:getStepClickAutoClogProps(t,tv.WE,tv.cE)})))):ep?(_(tU.t("Route your workflow based on button clicks")),x(tU.t("Want each button to do something different? Turn them into workflow branches in one click.")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:tU.t("Add branches for each button"),handler:eS,callbackId:tv.ad,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add branches for each button")})))):Q?(x(tU.t("Choose where you\u2019d like to save your form responses.")),w(C.lp.SuggestedStepsAfterForm),E(n.createElement("div",{className:tq().buttonGroup},u&&n.createElement(ActionButton,{buttonText:eI,handler:eS,callbackId:tv.Dx,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a record to a list")}),ek&&n.createElement(ActionButton,{buttonText:eT,handler:eS,callbackId:tv.A0,appId:tL.xM,isLoading:A,autoClogProps:getStepClickAutoClogProps(t,tv.jn,tv.tS)}),n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),!eu&&em&&n.createElement(ActionButton,{buttonText:tU.t("Add a branch"),handler:eS,callbackId:tv.ad,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a branch")})))):J?(x(tU.t("Share your canvas with others.")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eN,handler:eS,callbackId:tv.RP,autoClogProps:getStepClickAutoClogProps(t,"builtin","Share a canvas")}),n.createElement(ActionButton,{buttonText:eL,handler:eS,callbackId:tv.U5,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a canvas tab to channel")})))):Z?(x(g?tU.t("Now, choose what to do with the AI response."):"Now, choose what to do with the AI response."),E(n.createElement("div",{className:tq().buttonGroup},!eu&&em&&n.createElement(ActionButton,{buttonText:tU.t("Add a branch"),handler:eS,callbackId:tv.ad,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a branch")}),n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),m&&n.createElement(ActionButton,{buttonText:eM,handler:eS,callbackId:tv.Jh,autoClogProps:getStepClickAutoClogProps(t,"builtin","Update a canvas")}),u&&n.createElement(ActionButton,{buttonText:eI,handler:eS,callbackId:tv.Dx,autoClogProps:getStepClickAutoClogProps(t,"builtin","Add a record to a list")})))):q?(x(tU.t("You\u2019ll need to add a message step with a button to use the function in the next step.")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),n.createElement(ActionButton,{buttonText:eA,handler:eS,callbackId:tv.tM,autoClogProps:getStepClickAutoClogProps(t,tv.WE,tv.cE)})))):ea?(x(tU.t("Post messages, add members, collect information with a canvas, or browse the full library of steps to optimize your Salesforce channel.")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)}),n.createElement(ActionButton,{buttonText:eO,handler:eS,callbackId:tv.aM,autoClogProps:getStepClickAutoClogProps(t,"builtin",eO)})))):ee?(x(tU.t("Post messages, collect information with a canvas, or browse the full library of steps to optimize your selected Salesforce channel.")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eC,handler:eS,callbackId:tv.fH,autoClogProps:getStepClickAutoClogProps(t,tv.wh,tv.sm)})))):en&&0===t.workflow.steps.length&&(f?b?er?(x(f?tU.rt("To start the workflow this way, you\u2019ll need to use <strong>Send Summary To Sales Home</strong> as the first step."):"To start the workflow this way, you\u2019ll need to use Send Summary To Sales Home as the first step."),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eF,handler:eS,callbackId:tv.nw,autoClogProps:getStepClickAutoClogProps(t,tv.G6,tv.wK)})))):(x(f?tU.rt("To start the workflow this way, you\u2019ll need to use <strong>Send Summary To Sales Home</strong> or <strong>Send Summary To My Sales Home</strong> as the first step."):"To start the workflow this way, you\u2019ll need to use Send Summary To Sales Home or Send Summary To My Sales Home as the first step."),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eF,handler:eS,callbackId:tv.nw,autoClogProps:getStepClickAutoClogProps(t,tv.G6,tv.wK)}),n.createElement(ActionButton,{buttonText:eD,handler:eS,callbackId:tv.IO,autoClogProps:getStepClickAutoClogProps(t,tv.h7,tv.To)})))):(x(f?tU.rt("To start the workflow this way, you\u2019ll need to use <strong>Send Summary To My Sales Home</strong> as the first step."):"To start the workflow this way, you\u2019ll need to use Send Summary To My Sales Home as the first step."),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eD,handler:eS,callbackId:tv.IO,autoClogProps:getStepClickAutoClogProps(t,tv.h7,tv.To)})))):(x(tU.t("This trigger requires Send Summary To Sales Home as the first step")),E(n.createElement("div",{className:tq().buttonGroup},n.createElement(ActionButton,{buttonText:eF,handler:eS,callbackId:tv.nw,autoClogProps:getStepClickAutoClogProps(t,tv.G6,tv.wK)})))))},[G,j,Y,K,ep,Q,J,Z,q,ea,ee,en,t,eE,eS,N,eb,V,eC,eA,u,eI,ek,eT,A,eu,em,eN,eL,g,m,eM,eO,f,b,er,eF,eD]),n.createElement($.A,{eventId:I.EventId.WORKFLOW_BUILDER,uiStep:I.UiStep.WORKFLOW_EDITOR,elementName:C.KC.SuggestedSteps,uiComponentVariant:k,uiComponentName:C.KC.SuggestedSteps,clogImpression:!0},n.createElement("div",{className:tq().container},n.createElement("img",{src:tV,alt:tU.t("slackbot"),className:tq().slackbot}),n.createElement("div",{className:tq().containerContent},n.createElement("div",{className:tq().title},h),y,v)))};SuggestionSegment.displayName="SuggestionSegment";var tj=a(0x1ce5aacef),tG=a.n(tj);let t$=new o.Ay("workflow_builder"),TooltipWrapper=({hasMaxNumberOfSteps:e,children:t})=>{let a=(0,D.d4)(F.EP);return e?n.createElement(tc.Ay,{tip:t$.t("Workflow has reached {max_number_of_steps}-step limit",{max_number_of_steps:a,fallbackHash:"732ddc07733ebd62fa52955da986308c3c54ea06"})},t):t};TooltipWrapper.displayName="TooltipWrapper";let WorkflowSegmentAdd=({lastStepId:e,openLibrary:t,stepIndex:a,workflowId:r,hasTrigger:l,showConnectorLine:i=!0})=>{let o=(0,T.A)(),s=(0,Z.j)(),c=!!(0,X.Kt)(s?.workflow),d=s?.trigger,u=isReactionAddedTriggerWithMultipleEmojis(d),m=(0,D.d4)(e=>(0,F.JA)(e,r??"")),p=(0,n.useCallback)(()=>{(0,C.K$)({clogger:o,uiArgs:{step:I.UiStep.WORKFLOW_EDITOR,is_primary_cta:!0},uiProperties:{element_name:C.KC.AddStep},wbArgs:{step_index:a,workflow_id:r,is_hermes:!0}}),t?.(e)},[o,a,r,t,e]),b=(0,n.useMemo)(()=>{let e=!l||m,t=n.createElement(n.Fragment,null,u&&!c&&s&&n.createElement("div",{className:"padding_top_100"},n.createElement(SuggestionSegment,{workflow:s,trigger:d})),i&&n.createElement("div",{className:tG().lineSpacer}),n.createElement(TooltipWrapper,{hasMaxNumberOfSteps:m},n.createElement(ts.A,{key:"add-step",className:G()(tG().wideAddStepButton,{[tG().centerText]:c,[tG().solidColor]:l,[tG().hasConnectorLine]:c&&i}),onClick:p,"data-qa":"add-step__button","aria-disabled":!!e||void 0,id:Q.kr},n.createElement("div",{className:tG().addStepButtonIcon},n.createElement(e1.Ah,{inline:!0,name:"plus",size:c?"16":"20","data-qa":"add-step-icon"})),n.createElement("span",{className:tG().addStepButtonText},c&&l?t$.t("Add Step"):t$.t("Add steps")))));return n.createElement("div",{className:"full_width"},e?n.createElement(tc.Ay,{tip:t$.t("You have to add a start event first"),position:"top"},t):n.createElement(n.Fragment,null,t))},[p,l,m,i,c,u,d,s]);return n.createElement(n.Fragment,null,b)};WorkflowSegmentAdd.displayName="WorkflowSegmentAdd";let tK=new o.Ay("workflow_builder"),tY={[tt.WE.gray]:tf().gray,white:tf().white,[tt.WE.tomato]:tf().tomato,[tt.WE.sunflower]:tf().sunflower,[tt.WE.jade]:tf().jade,[tt.WE.lagoon]:tf().lagoon,[tt.WE.indigo]:tf().indigo},Branch=({branch:e,numberOfSteps:t,onMove:a,openLibrary:o,onAddBranch:s,index:u,renderNestedStepList:m,setIsAnyBranchCollapsing:p,isAnyBranchCollapsing:b,switchWrapperRef:f,hasMaxBranches:g,afterStepId:h})=>{let _=(0,r.wA)(),{windowRef:y}=(0,n.useContext)(i._0),x=(0,n.useRef)(null),v=(0,Z.j)(),E=(0,X.DY)(v),k=(0,eC.u)(),w=(0,D.d4)((0,M.sx)(E,F.uY))?.steps||[],C=(0,D.d4)((0,M.sx)(E,F.c3))??eo.t0,{workflowStepBeingDraggedId:A,stepOrderByIdList:T}=(0,ew.x)(),I=A===e.id,N=T.findIndex(t=>t===e.id),{canMoveStepUp:O,canMoveStepDown:P}=(0,X.Cz)(e.id,v),R=(0,n.useMemo)(()=>v?(0,X.o)(e.id,v.workflow):[],[e.id,v]),B=R.length>0&&R[R.length-1].id===e.id,W=(0,n.useMemo)(()=>(0,tO.N1)(e,C[e.id]),[e,C]),V=(e.steps??[]).map(e=>(0,eh.lq)(e,C[e.id])),H=useSegmentCoachmark(W.id,E,!1,W.coachmarkText),U=(0,eU.XS)(v,W),z=(0,eU.nh)(v,W,U),j=!(0,tO.C9)(W),$=!!e?.steps&&!!e.steps.length&&(0,eA.Z1)(e.steps[e.steps.length-1]),K=(0,X.Nm)(W.id,S.SWITCH,v),Y=!!(K&&(0,X.Nm)(K.id,S.SWITCH,v)),Q=(0,n.useMemo)(()=>{let e=Y?e5.$5:e5.GI;return K?.steps&&K.steps.length>=e},[Y,K]),[J,ee]=(0,n.useState)(!1),[ea,en]=(0,n.useState)(!1),[el,ei]=(0,n.useState)(W?.displayConfig?.is_branch_collapsed),es=j?"":(0,X.B5)(W.id,w),ec=(0,eD.S)(W),ed=(0,n.useMemo)(()=>v?(0,X.YJ)(W.id,v):"h2",[W.id,v]),eu=V?.[V.length-1]?.id??e.id,em=W.id,ep=W?.displayConfig?.color,eb=(0,D.d4)(e=>(0,F.JA)(e,E)),ef=(0,D.d4)(F.EP),eg=!V||0===V.length,e_=(0,n.useCallback)(()=>_((0,L.k)({existingStep:W,workflow:v})),[_,W,v]),ey=(0,n.useCallback)(()=>{_((0,q.q)({element:n.createElement(DeleteSegmentConfirmationModal,{segment:W})}))},[_,W]),ex=(0,n.useCallback)(()=>{if(!O)return;let e=T.findIndex(e=>e===R[u-1]?.id);a?.(N,e)},[T,O,R,u,a,N]),ev=(0,n.useCallback)(()=>{if(!P)return;let e=T.findIndex(e=>e===R[u+1]?.id);a?.(N,e)},[T,P,R,u,a,N]),onDuplicate=async()=>{try{en(!0);let t=[W,...V];if(V.some(eA.Yc)){let a=e.steps??[],n=a.slice(0,-1),r=a[a.length-1],l=(r?.steps??[]).reduce((e,t,a)=>(e.push(...n.map(e=>(0,eh.lq)(e,C[e.id]))),e.push({...(0,tO.N1)(t,C[t.id]),subtype:0===a?S.SWITCH:e5.t}),e.push(...(t?.steps??[]).map(e=>(0,eh.lq)(e,C[e.id]))??[]),e),[]);t=[W,...l]}await _((0,et.rG)({workflowId:E,segments:t}))}catch(a){let e=tK.t("There was an error duplicating this step."),t=tK.t("You don\u2019t have permission to duplicate this step.");_((0,eX.M)({element:n.createElement(c.A,null,"invalid_token"===a.name?t:e)}))}finally{en(!1)}};onDuplicate.displayName="onDuplicate";let eE=(0,n.useCallback)(async()=>{let e=!el;ee(!0),p(!0),ei(e);let t={...W,displayConfig:{...W.displayConfig,is_branch_collapsed:e}};try{await _((0,et.nv)({workflowId:E,segment:t}))}catch(e){throw ee(!1),p(!1),e}finally{ee(!1),p(!1),y.deref()?.requestAnimationFrame(()=>{let e=document.querySelector(`button[aria-controls="${em}"]`);e&&e.focus()})}},[el,p,W,_,E,y,em]),ek=(0,eL.iT)({methods:{onEdit:e_,onMoveUp:ex,onMoveDown:ev,onDelete:ey,onAboutClick:l.A,onDuplicate:j||Q?void 0:onDuplicate},viewOnly:k,segment:W,branchNameFallback:tK.t("Branch {branchIndex}",{branchIndex:j?"fallback":es}),hasMaxNumberOfSteps:eb,maxNumberOfSteps:ef}),eS=(0,n.useMemo)(()=>el?tK.t("Expand branch {branchIndex}",{branchIndex:es}):tK.t("Collapse branch {branchIndex}",{branchIndex:es}),[el,es]),eT=(0,n.useMemo)(()=>{let e="branch",t=el?"caret-right":"caret-down";return b||eg?e:{svgIconProps:{name:e},svgIconPropsOnHover:{name:t},onClick:eE,label:eS,"aria-controls":em,"aria-expanded":!el,disabled:b&&!J}},[el,eg,J,b,eE,eS,em]),eI=(0,n.useMemo)(()=>{let t=e.steps??[],a=t.filter(e=>!(0,eA.Z1)(e)).length,n=t[t.length-1]&&(0,eA.Z1)(t[t.length-1])?t[t.length-1]?.steps?.length??0:0;return n||a?n?a?tK.t("{stepCount, plural, =1 {# step} other {# steps}} & {branchCount, plural, =1 {# branch} other {# branches}}",{fallbackHash:"9869e506c38f643f1fe985347c015deace6baa22",fallbackHashNs:"web",stepCount:a,branchCount:n}):tK.t("{branchCount, plural, =1 {# branch} other {# branches}}",{fallbackHash:"9869e506c38f643f1fe985347c015deace6baa22",fallbackHashNs:"web",branchCount:n}):tK.t("{stepCount, plural, =1 {# step} other {# steps}}",{fallbackHash:"9869e506c38f643f1fe985347c015deace6baa22",fallbackHashNs:"web",stepCount:a}):null},[e.steps]),eN=(0,n.useMemo)(()=>!el||eg?null:n.createElement(er.lV,{className:tf().nested_collapsed_branch_stacking,onClick:eE,loading:b,isUnstyled:!0},n.createElement(d.HL,{element:"p",className:tf().branch_summary_text},eI)),[eI,b,el,eg,eE]),eM=(0,n.useCallback)(()=>s(h),[s,h]),eO=Y?tt.WE.gray:"white",eF=ep&&ep!==tt.WE.gray?tY[ep]:tY[eO],eP=G()(eF,{[tf().with_alert]:!!U||!!H}),eR=G()(tf().branch_wrapper,eF,{[tf().drag_active]:!1,[tf().branch_collapsed]:el}),eB=G()(tf().branch,{[tf().with_alert]:!!U||!!H}),eW=(0,eL.H8)(ek,{viewOnly:k,firstStep:j||!O,lastStep:j||!P}),eV=m?n.createElement("div",{className:tf().branch_step_list},m({segments:V,openLibrary:o,onMove:a,numberOfSteps:t})):null;return n.createElement(BranchLine,{className:eP,switchWrapperRef:f,branchPreviewRef:x,isAnyBranchCollapsing:b,index:u},n.createElement(AddBranchDividerButton,{onClick:eM,isFirstBranch:0===u,showAddBranch:!g}),n.createElement(StepDragWrapper,{step:e},n.createElement("div",{className:eR},n.createElement("div",{className:eB,ref:x},n.createElement(BaseSegmentPreview,{isLoading:J,title:ec,icon:eT,actionsMenuButtons:eW,onEdit:e_,stepIndex:void 0,errorCode:U,errorMessage:z,segment:W,isLastStep:B,isDragActive:I,headingSize:ed,isDuplicatingStep:ea,coachmark:H})),eN,!el&&n.createElement("div",{id:em,hidden:el},eV,!$&&!I&&!k&&n.createElement(WorkflowSegmentAdd,{stepIndex:1,lastStepId:eu,openLibrary:o,workflowId:E,hasTrigger:!0,showConnectorLine:V.length>0})))))};Branch.displayName="Branch";let tQ=new o.Ay("workflow_builder"),tZ={elementName:C.KC.AddBranch,onClick:{enableClogAction:!0}},SwitchSegmentPreview=({segment:e,numberOfSteps:t,onMove:a,onDelete:l,openLibrary:i,renderNestedStepList:o})=>{let s=(0,r.wA)(),d=(0,Z.j)(),u=(0,X.DY)(d),m=(0,D.d4)(B.zy),p=(0,n.useRef)(null),b=(0,n.useRef)(null),f=(0,eC.u)(),g=(0,D.d4)((0,M.sx)(u,F.Pb)),h=(0,D.d4)(e=>(0,F.JA)(e,u)),_=(0,D.d4)(F.EP),y=(0,eD.S)(e),x=(0,n.useMemo)(()=>d?(0,X.YJ)(e.id,d):"h2",[e.id,d]),v=(0,eU.XS)(d,e),E=(0,eU.nh)(d,e,v),k=useSegmentCoachmark(e.id,u,!1,e.coachmarkText),w=(0,n.useMemo)(()=>g.find(t=>t.id===e.id)?.steps??[],[e.id,g]),C=(0,n.useMemo)(()=>!!(0,X.Nm)(e.id,S.SWITCH,d),[e.id,d]),[A,T]=(0,n.useState)(!1),I=C?e5.$5:e5.GI,N=w.length>=I,O=(0,n.useCallback)(t=>{N?s((0,eX.M)({element:n.createElement(c.A,null,tQ.t("You cannot add more than {max_branch_count} conditional branches to a workflow.",{max_branch_count:I}))})):s((0,L.k)({stepType:{type:S.SWITCH,subtype:e5.t},workflow:d,afterStepId:t??e.id}))},[N,s,d,e.id,I]),P=(0,n.useMemo)(()=>w.map((r,l)=>{let s=w[l-1]?.id??e.id;return n.createElement(Branch,{key:r.id,branch:r,numberOfSteps:t,onMove:a,openLibrary:i,onAddBranch:O,afterStepId:s,index:l,renderNestedStepList:o,setIsAnyBranchCollapsing:T,isAnyBranchCollapsing:A,switchWrapperRef:p,hasMaxBranches:N})}),[w,e.id,t,a,i,O,o,A,N]),R=(0,n.useCallback)(()=>{O(w[w.length-1]?.id??e.id)},[w,O,e.id]),W=(0,eL.iT)({methods:{onDelete:l},viewOnly:f,segment:e,maxNumberOfSteps:_}),V=(0,eL.H8)(W,{viewOnly:f,isSwitch:!0}),H=(0,n.useMemo)(()=>n.createElement("div",{className:tf().switch_icon},n.createElement(e1.Ah,{name:"branch",inline:!0,size:"20"})),[]),q=(0,n.useMemo)(()=>{let e=N||!m||f||h,t=w[w.length-1]?.expression?tQ.t("Add branch after branch {branchIndex}",{branchIndex:(0,X.B5)(w[w.length-1].id,d?.workflow.steps??[]),fallbackHash:"5df0e8be499c468b0dab69bb2c4ca50b7721b5e6"}):tQ.t("Add branch before fallback",{fallbackHash:"5df0e8be499c468b0dab69bb2c4ca50b7721b5e6"}),a=n.createElement(ts.A,{className:G()(tf().add_branch,{[tf().disabled]:e||!m}),onClick:R,"aria-disabled":e||!m,autoClogProps:tZ,"aria-label":t},n.createElement(e1.Ah,{name:"add-branch",inline:!0,size:"16"}),n.createElement("span",null,tQ.t("Add a branch")," ")),r=a;return m?h?r=n.createElement(tc.Ay,{tip:tQ.t("Workflow has reached {max_number_of_steps}-step limit",{max_number_of_steps:_})},a):N?r=n.createElement(tc.Ay,{tip:tQ.t("You cannot add more than {max_branch_count} conditional branches to a workflow.",{max_branch_count:I})},a):f&&(r=n.createElement(tc.Ay,{tip:tQ.t("You cannot add branches in view-only mode")},a)):r=n.createElement(tc.Ay,{tip:tQ.t("Your admin has restricted use of this step. To request access to edit this step or publish this workflow, contact your admin.")},a),n.createElement(BranchLine,{className:tf().branch_button_wrapper,isAnyBranchCollapsing:A,switchWrapperRef:p,branchPreviewRef:b},n.createElement("div",{ref:b},r))},[N,m,f,h,w,d,R,A,_,I]),U=n.createElement(BaseSegmentPreview,{title:y,icon:H,className:tf().switch_top_level_preview,actionsMenuButtons:V,errorCode:v,errorMessage:E,coachmark:k,headingSize:x});return n.createElement("div",{className:G()(tf().switch_segment_wrapper,tf().supports_nested,{[tf().branching_disabled]:!1,[tf().is_inside_nested_switch]:C}),"data-qa":"switch-segment-preview",ref:p},n.createElement(StepDragWrapper,{step:e},U,n.createElement("div",{className:tf().branch_list_wrapper},P,q)))};SwitchSegmentPreview.displayName="SwitchSegmentPreview";var tJ=a(0x1c91944c9),tX=a(0x5dd1c0f2);let t0=(0,n.memo)(({app:e})=>n.createElement(n.Fragment,null,e?.name)),t1=(0,tJ.N)((e,{appId:t})=>({app:(0,tX.sO)(e,t)||null}))(t0),t2=new o.Ay("workflow_builder"),UnknownSegmentPreview=({segment:e,isTrigger:t=!1,onDelete:a})=>{let r=(0,eC.u)(),i=(0,e_.GS)(e),o=(0,n.useMemo)(()=>{if(i)return(0,eh.Zy)(e)},[i,e]),s=(0,n.useMemo)(()=>i&&!!o,[i,o]),c=(0,D.d4)(F.EP),d=(0,eL.iT)({methods:{onEdit:l.A,onDelete:a,onAboutClick:l.A,onMoveDown:l.A,onMoveUp:l.A},viewOnly:r,segment:e,maxNumberOfSteps:c}),u=(0,eL.H8)(d,{viewOnly:r,isDragDisabled:!0,isUnknownStep:!0}),m=t2.t("This step is no longer available"),p=(0,n.useMemo)(()=>n.createElement("em",null,m),[m]),b=(0,n.useMemo)(()=>n.createElement(t1,{appId:o}),[o]),f=(0,n.useMemo)(()=>n.createElement(tw.z,{appId:o}),[o]);return s?n.createElement(BaseSegmentPreview,{title:p,subtitle:b,icon:f,segment:e,errorCode:ei.tC,actionsMenuButtons:u}):n.createElement(BaseSegmentPreview,{title:t2.t("Unsupported step type"),icon:"warning",segment:e,errorCode:ei.tC,actionsMenuButtons:t?void 0:u})};UnknownSegmentPreview.displayName="UnknownSegmentPreview";var t4=a(0x1bffa495d),t8=a(0x1c27a9e4a),t5=a(0x178591611);let PrimitiveSegmentPreview=({isTrigger:e=!1,isTriggerAvailable:t=!1,onEdit:a=null,segment:l,segmentTypeIsUnknown:i,numberOfSteps:o=0,onMove:s,onMoveUp:c,onMoveDown:d,openLibrary:u,isDragDisabled:m=!1,isDragActive:p=!1,hideError:b=!1,renderNestedStepList:f})=>{let g=(0,e_.GS)(l),h=(0,T.A)(),_=(0,Z.j)(),y=(0,X.DY)(_),x=(0,eA.Yc)(l),v=(0,t5.Q)(l),E=(0,r.wA)(),k=(0,n.useCallback)(()=>{let t=e?{trigger_type:l.type}:{step_type:g?(0,eh.Dp)(l):l.type};if((0,C.K$)({clogger:h,uiArgs:{step:I.UiStep.WORKFLOW_EDITOR},uiProperties:{element_name:e?C.KC.EditTrigger:C.KC.EditStep},wbArgs:{...t,workflow_id:y,is_hermes:!0}}),a)return a()},[e,l,g,h,y,a]),w=(0,n.useCallback)(()=>{E((0,q.q)({element:n.createElement(DeleteSegmentConfirmationModal,{segment:l})}))},[E,l]),S=(0,n.useCallback)(()=>{c&&c()},[c]),A=(0,n.useCallback)(()=>{d&&d()},[d]);return x?n.createElement(SwitchSegmentPreview,{segment:l,onMove:s,onDelete:w,openLibrary:u,numberOfSteps:o,renderNestedStepList:f}):v?n.createElement(LoopSegmentPreview,{segment:l,numberOfSteps:o,onEdit:k,onDelete:w,openLibrary:u,onMove:s,renderNestedStepList:f}):g&&(0,eh.g$)(l)===H.oh.UNKNOWN_STEP?n.createElement(MissingSegmentPreview,{segment:l,isTrigger:e,onDelete:w}):g?n.createElement(LoadedSegmentPreview,{segment:l,onEdit:k,onDelete:w,onMoveUp:S,onMoveDown:A,isDragActive:p,isDragDisabled:m,hideError:b}):i||g?n.createElement(UnknownSegmentPreview,{segment:l,isTrigger:e,onDelete:w}):n.createElement(LoadedSegmentPreview,{segment:l,onEdit:k,onDelete:w,isTrigger:e,isTriggerAvailable:t,onMoveUp:S,onMoveDown:A,isDragDisabled:m,isDragActive:p,hideError:b})};PrimitiveSegmentPreview.displayName="PrimitiveSegmentPreview";let t6=(0,tJ.N)((e,{segment:t})=>{let a=(0,t8.E)(t);return{segmentTypeIsUnknown:(0,t4.mV)(e,{type:t.type,subtype:a})}})(PrimitiveSegmentPreview);var t3=a(0x120870dd9),t7=a.n(t3);let WorkflowSegmentDivider=({afterStepId:e,openLibrary:t,canAddStep:a=!1,hideSpacer:r})=>{let l=(0,n.useCallback)(()=>t?.(e),[e,t]),[i,o]=(0,n.useState)(!1),s=(0,n.useCallback)(()=>o(!0),[o]),c=(0,n.useCallback)(()=>o(!1),[o]);return n.createElement("div",{className:G()(t7().container,{[t7().noHeight]:!a,[t7().firstStep]:r}),onMouseEnter:s,onMouseLeave:c},a&&n.createElement(AddStepButton,{onClick:l,className:t7().roundButton,isHovered:i}),n.createElement("div",{className:G()(t7().spacer)}))};WorkflowSegmentDivider.displayName="WorkflowSegmentDivider";var t9=a(0x1880c171a),ae=a(0x18f8d96fa),at=a.n(ae);let Step=({step:e,index:t,onMove:a,openLibrary:l,hasMaxSteps:i=!1,renderNestedStepList:o})=>{let s=(0,Z.j)(),c=(0,X.DY)(s),d=(0,r.wA)(),u=(0,eC.u)(),m=(0,n.useMemo)(()=>(0,X.o)(e.id,s?.workflow),[e.id,s]),b=(0,p.jm)(s),{workflowStepBeingDraggedId:f,stepOrderByIdList:g}=(0,ew.x)(),h=(0,D.d4)((0,M.sx)(c,F.Pb)),_=g.length,y=g.findIndex(t=>t===e.id),x=f===e.id,v=(0,eA.Yc)(e),E=(0,X.Wn)(s,e.id,{flattenSteps:!0}),k=E&&(0,eA.Zv)(E),isMessageStep=e=>[tv.tM,tv.fH].includes(e),w=null!==E&&(0,t9.Z)(E)&&E?.function?.callback_id&&isMessageStep(E?.function?.callback_id)&&(0,eh.lq)(E),S=w&&(0,t9.G)(w)?w:void 0,A=(0,n.useMemo)(()=>null!==E?(0,eh.lq)(E):S,[E,S]),T=(0,t9.G)(e)?e:void 0,N=E?.id,O=(0,t9.G)(e)?e.config.is_pristine:void 0,P=(0,t9.G)(e)?e.config.slackFunction?.callback_id:void 0,R=P&&tv.VK.includes(P)&&P!==tv.W2,W=P&&(P===tv.uT||P===tv.nK),V=P&&P===tv.SY,q=(0,eB.q2)(e),U=(0,eB.Pv)(e),z=T?.config?.inputs?.interactive_blocks?.value,j=z?.find(e=>"actions"===e.type)?.elements??[],K=(0,tE.fd)(j),Y=!(0,X.W0)(e.id,s)&&K&&P&&isMessageStep(P),Q=(0,D.d4)(B.vp),J=(0,n.useCallback)(()=>d((0,L.k)({existingStep:e,workflow:s,afterStepId:N})),[d,e,s,N]),ee=(0,n.useCallback)(()=>{let e=y-1;(0,eA.Zv)(h[e])&&(0,eA.Z1)(h[e-1])&&(e-=1),e>=0&&a?.(y,e)},[y,h,a]),et=(0,n.useCallback)(()=>{let e=y+1;if((0,eA.Z1)(h[e])){if(!(0,eA.Zv)(h[e+1]))return;e+=1}e<h.length&&a?.(y,e)},[y,h,a]),ea=G()(at().dividerWrapper,{[at().is_dragging]:f}),en=(0,X.rM)(s,e.id),er=en.find(t=>t.source_id===e.id&&t.message.includes("interactivity")),el=(0,t9.G)(e)&&!!e.config.slackFunction?.input_parameters.some(e=>e.type===ty.TE.SlackTypesUserContext)&&en.some(t=>t.source_id===e.id&&"code"in t&&t.code===H.oh.INVALID_USER_CONTEXT),ei=t===m.length-1,eo=!!P&&!O,es=eo&&(!!er||el),ec=eo&&!es&&ei&&(q&&!U||R||W||V||Y&&Q),ed=(0,X.zF)(e),eu=ed&&en.length>0?I.EventId.WORKFLOW_CONNECTOR_STEPS_ERROR:I.EventId.WORKFLOW_CONNECTOR_STEPS,em=(0,n.useCallback)(({children:e})=>ed?n.createElement($.A,{eventId:eu,clogImpression:!0,uiStep:I.UiStep.WORKFLOW_EDITOR,elementName:C.KC.AddStep,displayName:P,workflowBuilderWorkflowId:(0,X.DY)(s)},e):n.createElement(n.Fragment,null,e),[eu,ed,P,s]),ep=(0,n.useMemo)(()=>n.createElement(t6,{segment:e,onEdit:J,numberOfSteps:_,onMove:a,onMoveUp:ee,onMoveDown:et,openLibrary:l,isDragActive:x,renderNestedStepList:o}),[e,J,_,a,ee,et,l,x,o]);return n.createElement("div",{className:G()(at().preview_container,{[at().switch_step]:v})},n.createElement(em,null,n.createElement("div",{className:ea},n.createElement(WorkflowSegmentDivider,{afterStepId:N,openLibrary:l,canAddStep:!u&&!i&&!b,hideSpacer:void 0===N||!!k})),es&&s&&n.createElement(n.Fragment,null,n.createElement(SuggestionSegment,{isBeforeStep:!0,workflow:s,prevStep:A,stepId:e.id,stepCallbackId:P,segmentErrors:en}),n.createElement(WorkflowSegmentDivider,{openLibrary:l,canAddStep:!1})),n.createElement("div",{className:at().preview,id:e.id,tabIndex:-1},v?ep:n.createElement(StepDragWrapper,{step:e},ep)),ec&&s&&n.createElement(n.Fragment,null,n.createElement(WorkflowSegmentDivider,{openLibrary:l,canAddStep:!1}),n.createElement(SuggestionSegment,{isBeforeStep:!1,workflow:s,stepId:e.id,stepCallbackId:P,step:T}))))};Step.displayName="Step";let StepList=({segments:e,numberOfSteps:t,onMove:a,openLibrary:r,isNestedStepList:l=!1})=>{let i,o=t>=(0,D.d4)(F.EP),s=(0,n.useCallback)(e=>n.createElement(StepList,{...e,isNestedStepList:!0}),[]),c=e.length&&(0,eA.Yc)(e[e.length-1]),d=e;c&&(d=e.slice(0,-1),i=e[e.length-1]);let u=(0,n.useCallback)(()=>d.map((e,t)=>n.createElement(Step,{key:`draggable-step-${e.id}`,step:e,index:t,openLibrary:r,onMove:a,hasMaxSteps:o,renderNestedStepList:s,isNestedStep:l})),[d,r,o,a,l,s]),m=(0,n.useMemo)(()=>i?n.createElement(Step,{key:`draggable-step-${i.id}`,step:i,index:e.length,openLibrary:r,onMove:a,hasMaxSteps:o,renderNestedStepList:s,isDraggable:!1}):null,[o,a,r,s,e.length,i]);return n.createElement("div",{className:at().list},n.createElement("div",{className:G()(at().droppable,{[at().is_empty_branch_list]:l&&0===d.length})},u()),m)};StepList.displayName="StepList";var aa=a(0x1db69cda),an=a(0x126eb9491),ar=a(0x426feba4),al=a(0x241a08725),ai=a(0x52fc4a0c),ao=a(0xe684f705);let as=new o.Ay("workflow_builder"),ac=(0,W.Ay)("Open the segment form modal for a workflow trigger",(e,t,{triggerType:a,existingTrigger:r,workflowId:l,channelId:i,subtype:o,isSwitchingTrigger:s=!1,teamId:c,serviceConfig:d}={})=>{var u;let m,p,b=t(),f=(0,ao.cA)(b),g=l?e=>n.createElement(ar.l,{error:e}):e=>n.createElement(ar.y,{error:e}),createTrigger=()=>(0,al.e)(a,{channelId:i,member:f,featureFlags:{},subtype:o,teamId:c,serviceConfig:d}),h=(u=s?createTrigger():r||createTrigger(),m=(0,aa.A)(u),p={},r?.config&&"name"in r.config&&(p.name=r.config.name),r?.config&&"description"in r.config&&(p.description=r.config.description),m.config={...m.config,...p},r?.id&&(m.id=r.id),m);if(h.type===eW.YV){let e=h.config.service.function;h=(0,ai.$v)(h,e)}let _=r?null:as.t("Next"),y=r?as.t("Save"):_,x=r?as.t("Cancel"):null;e((0,q.q)({element:n.createElement(an.G,{segment:h,onSave:t=>{if(!l)return Promise.resolve();let a=t.coachmarkText??"",n=(0,tD.yO)(t,l);return e((0,et._v)({workflowId:l,triggerUpdate:n,coachmarkText:a}))},renderSaveError:g,submitLabel:y,cancelLabel:x,isExistingSegment:!!r,isTrigger:!0})}))});ac.meta={name:"openTriggerFormModal",key:"createThunkOpenTriggerFormModal",description:"Open the segment form modal for a workflow trigger"};let PrimitiveTriggerPreview=({trigger:e,workflow:t,isAvailable:a=!1,isLoading:r,openTriggerFormModal:l})=>{let i=(0,X.DY)(t),o=(0,n.useRef)(null),s=(0,n.useRef)(!!e),c=(0,n.useCallback)(()=>{l({existingTrigger:e,workflowId:i,triggerType:e?.type??eW.zW})},[l,e,i]),d=e?c:null,u=(0,n.useMemo)(()=>n.createElement(MissingSegmentPreview,{segment:e??{},isTrigger:!0,isLoading:r}),[e,r]),m=(0,n.useMemo)(()=>n.createElement("div",{ref:o,tabIndex:-1},n.createElement(t6,{segment:e??{},onEdit:d,isTrigger:!0,isTriggerAvailable:a})),[e,d,a]);return(0,n.useEffect)(()=>{e&&!s.current&&o.current&&(o.current.focus(),s.current=!0)},[e]),e?m:u};PrimitiveTriggerPreview.displayName="PrimitiveTriggerPreview";let ad=(0,tJ.N)(null,e=>({openTriggerFormModal:t=>e(ac(t))}))(PrimitiveTriggerPreview);var au=a(0x1dbeaaa0b),am=a(0x62a17882),ap=a(0xca5ff9c9),ab=a(0x218842a12),af=a(0x5b1935a6);let ag=new o.Ay("workflow_builder");ab.g.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_STEPS_COACHMARK;let ErgoBuilderStepsCoachmark=({children:e,disabled:t,coachmarkAnchorClassNames:a})=>{let r=(0,am.cX)()?"\u2318":"Ctrl";return n.createElement(ap.Z,{notificationType:af.ze.HERMES_WORKFLOW_BUILDER_COACHMARKS_ERGO_BUILDER_EDU_STEPS_COACHMARK,titleText:ag.rt("Search instantly with {cmdKey} + F",{cmdKey:r}),bodyText:ag.t("Find your next workflow step faster with a keyboard shortcut."),icon:"search",coachmarkAnchorClassNames:a,disabled:t},e)};ErgoBuilderStepsCoachmark.displayName="ErgoBuilderStepsCoachmark";var ah=a(0xcb42ccf7),a_=a.n(ah);let WorkflowSegmentCoachmark=({workflow:e,openLibrary:t})=>{let a=(0,X.DY)(e),r=!!e.trigger,l=(0,n.useMemo)(()=>(0,X.Kt)(e.workflow),[e]),i=l>0,o=(0,n.useMemo)(()=>(0,X.KQ)(e),[e]),s=!r||!i;return n.createElement(ErgoBuilderStepsCoachmark,{coachmarkAnchorClassNames:G()(a_().addStep,{[a_().placeHolder]:!s,full_width:s}),disabled:!r},n.createElement(WorkflowSegmentAdd,{stepIndex:l,lastStepId:o,showConnectorLine:i,openLibrary:t,workflowId:a,hasTrigger:r}))};WorkflowSegmentCoachmark.displayName="WorkflowSegmentCoachmark";var ay=a(0x20e77676b),ax=a(0x51b81145),av=a(0xf5bbd10a),aE=a(0x1f57aea47),ak=a(0x1887ed0ea);let aw=new o.Ay("workflow_builder"),PrimitiveWorkflowSegmentList=({workflow:e,openModal:t,isTriggerAvailable:a=!1})=>{let l=(0,r.wA)(),{windowRef:o}=(0,n.useContext)(i._0),b=(0,D.d4)(aE.oY),f=(0,X.DY)(e),g=(0,T.A)(),h=(0,D.d4)(ak.M7),_=(0,D.d4)((0,M.sx)(f,F.MR)),[y,x]=(0,n.useState)(),[v,E]=(0,n.useState)(),[k,w]=(0,n.useState)(!1),[S,A]=(0,n.useState)(void 0),N=(0,av.A)(),L=(0,p.jm)(e),O=(0,D.d4)((0,M.sx)(f,F.gA)),P=(0,D.d4)((0,M.sx)(f,F.MI)),R=(0,n.useCallback)(async e=>{if(e&&e.match(/^Wt\w+$/))try{w(!0);let t=await l((0,et.Zy)({workflowId:f,templateId:e}));if(!t)throw Error("An error occurred while trying to fetch coachmarks.");let{coachmarkData:a,triggerCoachmarkData:n}=t;x(a),E(n)}catch(t){N.error(`Something went wrong when trying to fetch a workflow with templateId: ${e}`,t),x(void 0),E(void 0),A(t)}finally{w(!1)}},[l,N,f]),B=(0,n.useMemo)(()=>(0,m.a)(e.workflow),[e]),W=(0,n.useMemo)(()=>B.map(e=>e.id),[B]),V=B.length,H=(0,n.useMemo)(()=>{let t=(0,X.Ln)(e);return y?t.map(e=>({...e,coachmarkText:y[e.id]})):t},[y,e]),q=(0,n.useMemo)(()=>{let t=(0,X.eR)(e);return v&&t&&(t.coachmarkText=v),t},[e,v]),U=(0,eC.u)(),j=V>=(0,D.d4)(F.EP),G=V>0,$=(0,D.d4)(t=>(0,X.Q)(t,e)),K=G?W[W.length-1]:"",Y=(0,eH.uT)({workflowId:f}),Z=!!(q&&!U&&!b),J=!!(!q&&!U&&!b);(0,n.useEffect)(()=>{let handleOnFindKeyPress=e=>{if((0,au.I)(e)){e.preventDefault();let a=Z?n.createElement(StepsLibraryModal,{workflowId:f,focusSearch:!0,afterStepId:K}):null,r=J?n.createElement(z.G,{workflowId:f,focusSearch:!0}):null,l=a||r;null!==l&&(t({element:l}),(0,C.ES)({clogger:g,uiArgs:{step:I.UiStep.WORKFLOW_EDITOR,action:I.UiAction.KEYDOWN},uiProperties:{element_name:C.KC.WorkflowActionLibrarySearchShortcut,element_type:I.ElementType.UNKNOWN},wbArgs:{is_hermes:!0}}))}};return handleOnFindKeyPress.displayName="handleOnFindKeyPress",o.deref()?.document.addEventListener("keydown",handleOnFindKeyPress),()=>{o.deref()?.document.removeEventListener("keydown",handleOnFindKeyPress)}},[Z,J,g,K,t,o,f]),(0,n.useEffect)(()=>{!(0,u.wG)(e.workflow)||void 0!==y||void 0!==v||k||S||R(e.workflow.creation_source_id)},[y,k,R,v,e,S]);let ea=(0,n.useCallback)(e=>{t({element:n.createElement(StepsLibraryModal,{workflowId:f,afterStepId:e})})},[t,f]),en=(0,n.useCallback)(async(e,t)=>{try{await l((0,et.Ju)({workflowId:f,sourceStepIdx:e,destinationStepIdx:t}))}finally{l((0,eX.M)({element:n.createElement(c.A,null,aw.t("Step order updated"))}))}},[l,f]),er=Y?.coachmarks||y?aw.t("This workflow is ready to use as-is. Just add your info to the highlighted {stepCount, plural, =1 {step} other {steps}} and publish.",{stepCount:(H||[]).length}):aw.t("This workflow is ready to use as-is."),el=h?aw.rt("External teams can\u2019t use this workflow, as it contains steps that can only be used within your organization. <a>Learn more about workflow restrictions</a>",null,({text:e,tag:t})=>"a"===t?n.createElement(ay.A,{articleId:0xd8057515213,forceOpenInBrowser:!0},e):null):aw.rt("External teams cannot use this workflow because it includes third-party steps or restricted Slack built-ins. <a>Learn more about workflow restrictions</a>",null,({text:e,tag:t})=>"a"===t?n.createElement(ay.A,{articleId:0xd8057515213,forceOpenInBrowser:!0},e):null),ei=(0,n.useMemo)(()=>Y&&null===Y.coachmarks?n.createElement("div",{className:"margin_bottom_100"},n.createElement(s.Ay,{level:s.A_.success},er)):_?n.createElement("div",{className:"margin_bottom_100"},n.createElement(s.Ay,{level:s.A_.warning},el)):null,[Y,_,er,el]),eo=aw.t("Choose an event to start the workflow, and then add the steps that will follow."),es=aw.t("Or, start from scratch \u2014 choose how the workflow starts and the steps that follow."),ec=aw.t("Start the workflow\u2026"),ed=aw.t("Then, do these things"),eu=(0,n.useCallback)(e=>{o.deref()?.requestAnimationFrame(()=>{if(e&&e.id){let t=o.deref()?.document.getElementById(e.id);if(t)t.focus();else if(H.length>0){let e=o.deref()?.document.getElementById(K);e&&e.focus()}else{let e=o.deref()?.document.getElementById(Q.kr);e&&e.focus()}}})},[o,H.length,K]);(0,ax.A)(ee.Ay.PAGE_CONTENT_WORKFLOW_EDITOR_STEP_PREVIEW,eu);let em=(0,n.useMemo)(()=>n.createElement("div",{className:at().wrapper},!q&&n.createElement("p",{className:"padding_bottom_50"},$?es:eo),n.createElement(d.Pd,{element:"h1",className:"padding_bottom_100",id:Q.I6},ec),n.createElement(ad,{key:"trigger",workflow:e,trigger:q,isAvailable:a,isLoading:P||O}),n.createElement(d.Pd,{element:"h1",className:"padding_top_150"},ed),L&&0===e.workflow.steps.length&&n.createElement("div",{className:"padding_top_100"},n.createElement(SuggestionSegment,{isBeforeStep:!0,workflow:e,stepId:tv.nw,stepCallbackId:tv.nw})),n.createElement(StepList,{segments:H,onMove:en,numberOfSteps:V,openLibrary:ea})),[q,$,es,eo,ec,e,a,P,O,ed,L,H,en,V,ea]),ep=(0,X.jA)(e.workflow),eb=(0,n.useMemo)(()=>{let t=n.createElement(n.Fragment,null,!U&&!j&&!ep&&n.createElement(WorkflowSegmentCoachmark,{workflow:e,openLibrary:ea}));return n.createElement(n.Fragment,null,em,t)},[U,j,ep,e,ea,em]);return n.createElement("div",{className:at().container},n.createElement("div",{className:at().list},n.createElement("div",{className:at().list},ei),eb,!U&&j&&n.createElement(s.Ay,{className:at().max_steps_alert,level:"info"},aw.t("Workflows are limited to 100 steps. Remove a step before adding a new one."))))};PrimitiveWorkflowSegmentList.displayName="PrimitiveWorkflowSegmentList";let aS=(0,tJ.N)(l.A,e=>({openModal:({element:t})=>e((0,q.q)({element:t}))}))(PrimitiveWorkflowSegmentList)},0x1dbeaaa0b:(e,t,a)=>{"use strict";a.d(t,{I:()=>isActionLibrarySearchShortcut});var n=a(0x62a17882);let isActionLibrarySearchShortcut=e=>!!("f"===e.key&&!e.shiftKey&&!e.altKey&&((0,n.cX)()&&e.metaKey&&!e.ctrlKey||!(0,n.cX)()&&e.ctrlKey))||!1},0x21453d73b:(e,t,a)=>{"use strict";a.d(t,{A0:()=>s,Dx:()=>d,G6:()=>S,IO:()=>A,Jh:()=>b,RP:()=>u,SY:()=>o,Th:()=>y,To:()=>I,U5:()=>m,VK:()=>f,W2:()=>p,WE:()=>E,aM:()=>n,ad:()=>L,cE:()=>h,dN:()=>c,fH:()=>r,h7:()=>T,hU:()=>v,jn:()=>k,nK:()=>M,nw:()=>w,qn:()=>i,sm:()=>g,tM:()=>l,tS:()=>_,uT:()=>N,wK:()=>C,wh:()=>x}),(0,a(0x18dac2b8e).Cu)();let n="invite_user_to_channel",r="send_message",l="send_dm",i="open_form",o="ai_answer",s="add_spreadsheet_row",c="Google Sheets",d="list_add_record",u="share_canvas",m="add_canvas_to_channel_tab",p="channel_canvas_create",b="canvas_update_content_v2",f=["canvas_create","channel_canvas_create","canvas_copy","canvas_create_from_template"],g="Send a message to a channel",h="Send a message to a person",_="Add to spreadsheet",y="Open a Form",x="builtin",v="builtin",E="builtin",k="app",w="send_summary_to_sales_home",S="builtin",C="Send Summary To Sales Home",A="send_summary_to_my_sales_home",T="builtin",I="Send Summary To My Sales Home",N="lookup_record_channel",M="create_record_channel",L="case_step"},0x1fbc3c543:(e,t,a)=>{"use strict";a.d(t,{m:()=>r});var n,r=((n={}).SEND_DM_TO_REQUESTER="send_dm_to_requester",n.OPEN_FORM="open_form",n.SEND_MESSAGE_TO_CHANNEL="send_message_to_channel",n.SEND_COLLECT_CHECKIN_MESSAGE_TO_CHANNEL="send_collect_checkin_message_to_channel",n.SEND_TOPICS_REMINDER_TO_CHANNEL="send_topics_reminder_to_channel",n.SEND_TOPICS_MESSAGE_TO_CHANNEL="send_topics_message_to_channel",n.OPEN_TOPICS_FORM="open_topics_form",n.SEND_DM_TO_MANAGER="send_dm_to_manager",n.OPEN_PTO_FORM="open_pto_form",n.OPEN_APPROVAL_FORM="open_approval_form",n.SEND_INITAL_KUDOS_DM_TO_REQUESTER="send_inital_kudos_dm_to_requester",n.OPEN_KUDOS_FORM="open_kudos_form",n.SEND_KUDOS_DM="send_kudos_dm",n.SEND_AMA_REMINDER_TO_CHANNEL="send_ama_reminder_to_channel",n.SEND_AMA_MESSAGE_TO_CHANNEL="send_ama_message_to_channel",n.SEND_AMA_CONCLUSION_TO_CHANNEL="send_ama_conclusion_to_channel",n.TRIGGER="trigger",n.SEND_MESSAGE="send_message",n.INVITE_USER="invite_user",n.CREATE_CHANNEL="create_channel",n.ADD_SPREADSHEET_ROW="add_spreadsheet_row",n.JOIN_CHANNELS="join_channels",n.CREATE_JIRA_ISSUE="create_jira_issue",n)},0x30d8960c:(e,t,a)=>{"use strict";a.d(t,{I6:()=>n,hf:()=>r,kr:()=>l});let n="start-workflow-subtitle-id",r="missing-segment-button",l="add-hermes-workflow-step-button"},0x118c611:(e,t,a)=>{"use strict";a.d(t,{e:()=>r,x:()=>useWorkflowDragDropContext});var n=a(0xbad225b5);let r=(0,n.createContext)({workflowStepBeingDraggedId:void 0,stepOrderByIdList:[],setStepBeingDraggedId:()=>{}}),useWorkflowDragDropContext=()=>{let{workflowStepBeingDraggedId:e,stepOrderByIdList:t,setStepBeingDraggedId:a}=(0,n.useContext)(r);return{workflowStepBeingDraggedId:e,stepOrderByIdList:t,setStepBeingDraggedId:a}}},0xf6b2f43b:(e,t,a)=>{"use strict";a.d(t,{U:()=>r,u:()=>useWorkflowViewOnly});var n=a(0xbad225b5);let r=(0,n.createContext)(!1),useWorkflowViewOnly=()=>!!(0,n.useContext)(r)},0x647f4f35:(e,t,a)=>{"use strict";a.d(t,{k:()=>useAiStepPrivateChannelAccess});var n=a(0xbe0b63ff),r=a(0x1795d8821),l=a(0x226892387),i=a(0x16af7d0de),o=a(0x3b8174d2);let useAiStepPrivateChannelAccess=({callbackId:e})=>{let t=e===r.oW.AiAnswer,a=(0,l.d4)(e=>t?(0,o.hj)(e,i.Ez.ai_answer,!1):null);if(!t||!a||(0,n.mX)(a)||(0,n.lv)(a))return{aiStepPrivateChannelAccess:void 0,aiStepPrivateChannelTeamIds:void 0};let s=a.product_level_availability,c=s?.private_channel_access;return{aiStepPrivateChannelAccess:void 0===c?void 0:c!==r.Pj.NoOne,aiStepPrivateChannelTeamIds:c===r.Pj.NamedEntities?s?.private_channel_team_ids:void 0}}},0x24de3d958:(e,t,a)=>{"use strict";a.d(t,{K:()=>useAvatarCropState});var n=a(0xbad225b5),r=a(0x2440854b3),l=a(0x8ed4913f),i=a(0x44240292);let useAvatarCropState=(e,t)=>{let[a,o]=(0,n.useState)({}),s=(0,n.useMemo)(()=>({width:a?.width,height:a?.height,src:e}),[e,a?.height,a?.width]),c=(0,n.useMemo)(()=>(({crop:e,imageWidth:t,imageHeight:a})=>{let{displayWidth:n,displayHeight:i}=(0,l.A)({width:t,height:a,maxSize:r.Vt}),o=Math.max(1,a/i),s=Math.max(1,t/n),c=e.x*s;return{fullCropX:c,fullCropY:e.y*o,fullCropSize:e.width*s}})({crop:t,imageWidth:a.width||0,imageHeight:a.height||0}),[t,a.height,a.width]);return(0,n.useEffect)(()=>{(0,i.A)(e).then(({width:e,height:t})=>o({width:e,height:t}))},[e]),{cropData:c,imageData:s}}},0x20f6327e1:(e,t,a)=>{"use strict";a.d(t,{A:()=>d,V:()=>useAvatarUploadState});var n,r=a(0xbad225b5),l=a(0x16cf1da63),i=a(0x2440854b3),o=a(0xe874a88a),s=a(0x44240292);function validateImage(e,t){return new o.S((a,n)=>{if(!i.i_.includes(e.type))return void n(Error(i.DV));if(e.size>i.w3)return void n(Error(i.fw));let r=new window.FileReader;r.onload=e=>{let l=e?.target?.result;r.onload=null,(0,s.A)(l).then(({width:e,height:r})=>{e>i.g_||r>i.g_?n(Error(i.P1)):e<t||r<t?n(Error(i.dW)):a({dataUrl:l})}).catch(e=>n(e))},r.readAsDataURL(e)})}var c=a(0x1ed79bf71),d=((n={}).UPLOADING="uploading",n.ERROR="error",n.SUCCESS="success",n);let useAvatarUploadState=e=>{let t=(0,l.wA)(),[a,n]=(0,r.useState)({status:"uploading",avatarUrl:null,imageId:null,error:null});return(0,r.useEffect)(()=>{e&&(n({status:"uploading"}),validateImage(e,i.Yh).then(()=>t((0,c.W8)({file:e}))).then(({url:e,id:t})=>n({status:"success",imageId:t,avatarUrl:e})).catch(e=>n({status:"error",error:e.message})))},[e,t]),a}},0x13cd04b48:(e,t,a)=>{"use strict";a.d(t,{DJ:()=>getLabelFromExpressionData,Ox:()=>useExpressionData,SD:()=>buildExpressionDataSourceMap,w:()=>getVarNameFromExpressionReference});var n=a(0x20482ad21),r=a(0x20570d71a),l=a(0x66c6b26d),i=a(0x20adb28cd),o=a(0x226892387);let s=new n.Ay("workflow_builder"),{BUTTON:c,DROPDOWN:d,EMOJI:u}={BUTTON:"button",DROPDOWN:"dropdown",EMOJI:"emoji"};function useExpressionData(){let e=(0,r.Y)(),t=(0,o.d4)((0,l.sx)(e,i.RG));return t?.expressionData}let getLabelFromExpressionData=({expressionDataObject:e,returnOnlyVariableText:t,isUnsupportedRichTextDropdownType:a})=>{let{type:n,content:r}=e;if(!r)return"";let l="";if(n===c&&"string"!=typeof r){let e=r.text.text??"";l=s.t("User clicked button: {buttonName}",{buttonName:e}),t&&(l=e)}if(n===d&&"string"!=typeof r)if(a)l=s.t("Update your Form step dropdown options to use them here.");else{let e=r.title;l=s.t("User picked option: {dropdownOptionTitle}",{dropdownOptionTitle:e})}if(n===u){let e=`:${r}:`;l=s.t("User reacted with: {emojiName}",{emojiName:e}),t&&(l=e)}return l},buildExpressionDataSourceMap=e=>{if(!e)return;let t={};for(let a of Object.values(e)){let{sourceStep:e}=a;if(!e)continue;let n=t[e]||[];n.push(a),t[e]=n}return t},getVarNameFromExpressionReference=e=>{let t=".fields.";if(!e||-1===e.indexOf(t))return"";let a=e.indexOf(t)+t.length,n=e.slice(a),r=n.indexOf(".");return n.slice(0,r)}},0x172b62bb9:(e,t,a)=>{"use strict";a.d(t,{O9:()=>useFilteredVariablesForPrivateChannels,VQ:()=>hasPrivateChannel});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x61c95b1b),i=a(0x96aa1794),o=a(0x21eb6624c),s=a(0x159b87895),c=a(0x12185e091),d=a(0x145d46a61),u=a(0x226892387);let m=new r.Ay("workflow-builder"),hasPrivateChannel=e=>!!e&&0!==e.length&&e.some(e=>(0,c.Zp)(e)),isTextVariable=e=>"trigger"===e.source&&"{{data.blocks}}"===e.sourceReference,useFilteredVariablesForPrivateChannels=({variables:e,callbackId:t,isTriggerSegment:a=!1})=>{let r=(0,i.j)(),c=(0,u.d4)(d.sQ),{privateChannelMessage:p}=(0,s.U)({workflow:r,isLatestWorkflowData:!0,callbackId:t,isTriggerSegment:a}),b=(0,n.useMemo)(()=>r?.trigger&&r.trigger.channel_ids||[],[r]),f=(0,u.d4)(e=>e.channels),g=(0,n.useMemo)(()=>b.map(e=>f?.[e]),[b,f]),h=c?m.t("permission required"):"permission required";return(0,n.useMemo)(()=>(({variables:e,triggerSubtype:t,triggerChannels:a,privateChannelMessage:n,disabledReason:r})=>{if(!e)return e;let i=t===l.$.MessagePosted,s=hasPrivateChannel(a);return i&&s&&!1===n?(0,o.Z)(e,isTextVariable,r):e})({variables:e,triggerSubtype:r?.trigger?.subtype,triggerChannels:g,privateChannelMessage:p,disabledReason:h}),[e,r?.trigger?.subtype,g,p,h])}},0x203b19061:(e,t,a)=>{"use strict";a.d(t,{A:()=>useFilteredVariables});var n=a(0x20482ad21),r=a(0x21eb6624c),l=a(0x145d46a61),i=a(0x1795d8821),o=a(0x1d600678),s=a(0x226892387);let c=new n.Ay("workflow-builder");var d=a(0x172b62bb9);let useFilteredVariables=({variables:e,callbackId:t,isTriggerSegment:a})=>(({variables:e,callbackId:t,isTriggerSegment:a=!1})=>{let n=(0,s.d4)(l.dI),d=(0,s.d4)(l.EI),u=(0,s.d4)(e=>(0,o.x)(e,"slack_ai_files_search_opt_out")),m=u?.all_file_opt_out??!1,p=n?c.t("disabled for step"):"disabled for step",b=n?c.t("Files are disabled by your admin"):"Files are disabled by your admin";if(!e||t!==i.oW.AiAnswer||a)return e;let f=e;return d&&(f=(({variables:e,disabledReason:t})=>(0,r.Z)(e,e=>"trigger"===e.source&&e.type===i.TE.SlackTypesCanvasId,t))({variables:(({variables:e,disabledReason:t})=>(0,r.Z)(e,e=>"trigger"===e.source&&e.type===i.TE.SlackTypesChannelId,t))({variables:f,disabledReason:p}),disabledReason:p})),m&&(f=(({variables:e,disabledReason:t})=>(0,r.Z)(e,e=>(e.type===i.TE.Array?e.items?.type:e.type)===i.TE.SlackTypesFileId,t))({variables:f,disabledReason:b})),f})({variables:(0,d.O9)({variables:e,callbackId:t,isTriggerSegment:a}),callbackId:t,isTriggerSegment:a})},0x21eb6624c:(e,t,a)=>{"use strict";a.d(t,{Z:()=>updateVariablesWithFilter});let updateVariablesWithFilter=(e,t,a)=>{let disableVariablesWithFilter=e=>t(e)?{...e,isDisabled:!0,isAvailable:!1,disabledReason:a}:e,n=e.list.map(disableVariablesWithFilter),r=e.groups.map(e=>({...e,data:e.data.map(disableVariablesWithFilter)}));return{...e,list:n,groups:r}}},0xb0ca5b2:(e,t,a)=>{"use strict";a.d(t,{r:()=>useIsDuplicateExpression});var n=a(0x9e671ad),r=a(0x1a5ac3a0c),l=a(0x36e8c71e);function useIsDuplicateExpression({workflow:e,segment:t,contextStepId:a}){let i=t?.config?.expression,o=(0,r.Nm)(a,l.SWITCH,e)?.steps??[];return!!o&&!!o.length&&!!i&&o.some(e=>e.id!==t.id&&(0,n.A)(e?.expression,i))}},0x159b87895:(e,t,a)=>{"use strict";let n;a.d(t,{U:()=>useMessagePostedPrivateChannelAccess});var r=a(0xbad225b5),l=a(0x1887f3464),i=a(0x145d46a61),o=a(0x1795d8821),s=a(0x226892387);let c=!1,useMessagePostedPrivateChannelAccess=({workflow:e,isLatestWorkflowData:t,callbackId:a,isTriggerSegment:d})=>{let u=(0,s.d4)(i.sQ),{triggerTypesWithAvailability:m}=(0,l.c)({appId:void 0,skip:c||!u||!t});return(0,r.useMemo)(()=>{let r,l,i;if(c&&n)return n;if(!t||!u||0===m.length||!e)return{privateChannelAccess:void 0,privateChannelMessage:void 0,privateChannelTeamIds:void 0};if(e.trigger){let t=e.trigger;r=t.type,l=t.subtype||t.event?.event_type}else{if(!d||"message_posted"!==a)return{privateChannelAccess:void 0,privateChannelMessage:void 0,privateChannelTeamIds:void 0};r="event",l="slack#/events/message_posted"}let s=m.find(({triggerType:e})=>e.type===r&&(e.subtype&&l?e.subtype===l:!e.subtype&&!l)),p=s?.privateChannelAccess;"boolean"==typeof p?i=p:"string"==typeof p&&(i=p===o.Pj.Everyone||p===o.Pj.NamedEntities);let b=p===o.Pj.NamedEntities?s?.privateChannelTeamIds:void 0,f={privateChannelAccess:i,privateChannelMessage:s?.privateChannelMessage,privateChannelTeamIds:b};return s&&(n=f,c=!0),f},[t,e,u,m,a,d])}},0xb8ff08bd:(e,t,a)=>{"use strict";a.d(t,{f:()=>useSegmentPermissionErrorCode});var n=a(0xbad225b5),r=a(0x118f04a01),l=a(0x61c95b1b),i=a(0xf7ab484f),o=a(0x172b62bb9),s=a(0x159b87895),c=a(0x136bd1488),d=a(0x145d46a61),u=a(0x226892387);let m=/__blocks\}\}/,useSegmentPermissionErrorCode=({workflow:e,segment:t,isTrigger:a})=>(({workflow:e,segment:t,isTrigger:a})=>{let p=(0,u.d4)(d.sQ),b=e?.trigger?.subtype===l.$.MessagePosted,{privateChannelAccess:f,privateChannelTeamIds:g,privateChannelMessage:h}=(0,s.U)({workflow:e,isLatestWorkflowData:!0,callbackId:void 0,isTriggerSegment:!0}),_=(0,n.useMemo)(()=>t&&(0,c.s)(t)&&t.config.event?t.config.event.channelIds||[]:e?.trigger&&e.trigger.channel_ids||[],[t,e]),y=(0,u.d4)(e=>e.channels),x=(0,n.useMemo)(()=>_.map(e=>y?.[e]),[_,y]),v=(0,o.VQ)(x),E=(0,n.useMemo)(()=>!!p&&!!b&&!!v&&(0,r.Ps)(x,f,g),[p,b,v,f,g,x]),k=(0,n.useMemo)(()=>{if(!p||!b||!v||!1!==h)return[];let t=e?.workflow?.steps||[],a=[];return t.forEach(e=>{(e=>{if(!e)return!1;try{return m.test(JSON.stringify(e))}catch{return!1}})(e.inputs)&&a.push(e.id)}),a},[e,p,b,v,h]);if(p){if(a&&E)return i.Jx;if(!a&&k.includes(t.id))return i.yF}})({workflow:e,segment:t,isTrigger:a})},0x162e18dce:(e,t,a)=>{"use strict";a.d(t,{E:()=>useSegmentWrappedFunctionDetails});var n=a(0x1bffa495d),r=a(0x226892387);let useSegmentWrappedFunctionDetails=e=>(0,r.d4)(t=>(0,n.MZ)(t,e))},0x1bb241cc1:(e,t,a)=>{"use strict";a.d(t,{S:()=>useStickyHeaderClass});var n=a(0xbad225b5);let useStickyHeaderClass=(e,t={})=>{let a=n.useRef(null);return(0,n.useEffect)(()=>{let{current:n}=a;if(!n||!window.IntersectionObserver)return;let r=t.threshold||(e=>{let t=Math.abs(Number(window.getComputedStyle(e).top.replace("px",""))),{height:a}=e.getBoundingClientRect();return Math.ceil((1-t/a)*100)/100})(n),l=new IntersectionObserver(([t])=>{t.target.classList.toggle(e,t.intersectionRatio<r)},{threshold:r,...t});return l.observe(n),()=>{l.unobserve(n),l.disconnect()}},[a,t,e]),a}},0xa4606544:(e,t,a)=>{"use strict";a.d(t,{q:()=>f});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x409e023f),i=a(0x1a5ac3a0c),o=a(0x11c82607b),s=a(0x1123a239c),c=a(0x24fc5dd2c),d=a(0x20adb28cd),u=a(0x19561ce96),m=a(0x95c66692),p=a(0x46dbff89);let b=new r.Ay("workflow_builder"),f=(0,o.Ay)("Open modal to configure a trigger",async(e,t,{appId:a,type:r,subtype:o,serviceConfig:f,workflowId:g,onNavigateBack:h})=>{let _=t(),y=(0,u.n_)(_,a),x=(0,d.RG)(_,g),v=(0,i.eR)(x),onRequestAppModal=async()=>{e((0,p.q)({element:n.createElement(l.u,{appId:a})}))};onRequestAppModal.displayName="onRequestAppModal";let openTriggerModal=()=>{r&&e((0,s.k)({triggerType:(0,c.k)(r),subtype:o,submitLabel:b.t("Continue"),hasExistingWorkflow:!0,existingTrigger:v,workflowId:g,serviceConfig:f,onNavigateBack:h}))};y?e((0,m.u)({appId:f?.function?.app_id,appName:f?.function?.app?.name,onOpenModal:openTriggerModal,onRequestAppModal,reason:"trigger-events-sidebar/install-connector-app"})):openTriggerModal()});f.meta={name:"openTriggerConfigurationModal",key:"createThunkOpenTriggerConfigurationModal",description:"Open modal to configure a trigger"}},0x235bbf477:(e,t,a)=>{"use strict";a.d(t,{V:()=>BuilderToast});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x1faa3f1ac),i=a(0xbb0c5132);let o=new r.Ay("workflow_builder"),BuilderToast=({message:e,undo:t,...a})=>n.createElement(i.Ay,a,e,t&&n.createElement(n.Fragment,null,"\xa0",n.createElement(l.A,{onClick:t},o.t("Undo"))))},0x135b7b386:(e,t,a)=>{"use strict";a.d(t,{EG:()=>l,Id:()=>s,Nn:()=>c,YE:()=>r,wo:()=>i,y:()=>o});var n=a(0x18dac2b8e);let r="A014GBNBJ59",l="A04MG80N5CY",i=(0,n.Cu)()?r:l,o=(0,n.Cu)()?"A0150E985M0":"A05P4475DFY",s=(0,n.Cu)()?"A014LHD2ATV":"A050C90PUF5",c=(0,n.Cu)()?"A0154SFF675":"A05UG04QC4X"},0x4363d33f:(e,t,a)=>{"use strict";a.d(t,{k:()=>M});var n=a(0xbad225b5),r=a(0xbe0b63ff),l=a(0xd2c5015d),i=a(0xf77002c6),o=a(0xe6eaaf8c),s=a(0x1db887024),c=a(0x127c49a8d),d=a(0x126eb9491);let u=new(a(0x20482ad21)).Ay("workflow_builder"),SaveNewStepErrorMessage=({error:e})=>{let t="";switch((e||{}).name){case"invalid_primary_column":t=u.t("This list couldn\u2019t be created because it requires the first field to be text.",{fallbackHash:"97511c5bbd44082acfbd7098ef04040167986c51"});break;case"insufficient_posting_permissions":t=u.t("This workflow can\u2019t post to this channel because you don\u2019t have permission to post there. Ask a channel manager for help.",{fallbackHash:"97511c5bbd44082acfbd7098ef04040167986c51"});break;default:t=u.t("Sorry, there was a problem trying to add your step.")}return n.createElement("span",null,t)};SaveNewStepErrorMessage.displayName="SaveNewStepErrorMessage";let UpdateStepErrorMessage=({error:e})=>{let t="";return t="invalid_primary_column"===(e||{}).name?u.t("This list couldn\u2019t be created because it requires the first field to be text.",{fallbackHash:"73e5ac81cdcc64e62bf01743450574b23f84a56b"}):u.t("Sorry, there was a problem trying to update your step."),n.createElement("span",null,t)};UpdateStepErrorMessage.displayName="UpdateStepErrorMessage";var m=a(0x22c41b907),p=a(0x1a5ac3a0c),b=a(0x241a08725),f=a(0x1bffa495d),g=a(0xaaa6bbd0),h=a(0x252b4df6e),_=a(0x171a52b74),y=a(0x36e8c71e),x=a(0x145d46a61),v=a(0x1795d8821),E=a(0x11c82607b),k=a(0x4a9c61a9),w=a(0x1c09d8c36),S=a(0x135b7b386);let hasCustomSave=e=>{let t=[S.YE,S.EG],a=[w.rr];return!!(e.config.slackFunction?.type==="builtin"&&a.includes(e.config.slackFunction.id)||"string"==typeof e.config.slackFunction?.app_id&&t.includes(e.config.slackFunction.app_id))},C=[v.oW.CreateCanvas,v.oW.CreateChannelCanvas,v.oW.UpdateCanvasContent,v.oW.UpdateCanvasVariables,v.oW.SendToSalesHome];var A=a(0x4e250925),T=a(0x3b8174d2),I=a(0xe684f705),N=a(0x46dbff89);let M=(0,E.Ay)("Open the segment form modal for a workflow step",async(e,t,{stepType:a,existingStep:u,workflow:E,afterStepId:w,slackFunction:S,inputs:M,isFormWrapped:L,onCancel:O,onNavigateBack:F})=>{let D=(0,p.DY)(E),P=t(),R=(0,x.$T)(P),B=(0,I.cA)(P);u||e((0,k.YE)(w));let W=u?t=>(0,_.GS)(t)&&hasCustomSave(t)?e((0,A.xL)({workflow:E,segment:t,afterStepId:w,isEdit:!!u})):e((0,A.nv)({workflowId:D,segment:t})):t=>(0,_.GS)(t)&&hasCustomSave(t)?e((0,A.xL)({workflow:E,segment:t,afterStepId:w,isEdit:!!u})):e((0,A.zJ)({workflowId:D,afterStepId:w,segment:t,stepType:a?.subtype})),V=u?void 0:(0,p.TT)(E,w),H=u?e=>n.createElement(UpdateStepErrorMessage,{error:e}):e=>n.createElement(SaveNewStepErrorMessage,{error:e}),q=u||(0,b.e)(a?.type,{derivedData:V,featureFlags:{},member:B,subtype:a?.subtype,inputs:M,teamId:void 0}),U=m.k.DEFAULT;if(q.type===y.SLACK_FUNCTION){let e=S??(0,h.Dl)(q),t=(0,g.lK)(q),a=(0,f.MZ)(P,q);if(R?((0,g.Pv)(q)?u?(q.config.isFunctionFormWrappable=!0,q.config.isFunctionFormWrapped=!0,q=(0,h.Xh)(q,e)):(0,r.uz)(a)&&(q=(0,g.Dq)(q,a,R)):(q.config.isFunctionFormWrappable=!!e&&(0,l.R)({stepFunction:e}),q=(0,h.we)(q,e)),!u&&L&&(q.config.isFunctionFormWrapped=q.config.isFunctionFormWrappable,q=(0,c.i)(q,void 0,R))):((0,g.Pv)(q)&&t&&(0,r.uz)(a)&&(e=(q=(0,g.Dq)(q,a,R)).config.slackFunction),(q=(0,h.we)(q,e)).config.isFunctionFormWrappable=!!e&&(0,l.R)({stepFunction:e})),R){let e=(0,g.Pv)(q),t=(0,h.Dp)(q),n=(0,p.Dv)(w||"",E.workflow),l=w&&n&&(0,o.Z)(n)&&n.function.callback_id===v.oW.OpenForm,c=t&&!C.includes(t),d=e?a?.input_parameters:(0,h.ln)(q),b=d?.some(e=>(0,i.oO)(e));if(c&&(b||q.config.isFunctionFormWrappable)){if(u)U=e?m.k.THIRD_PARTY_USER_FORM_CONFIG:m.k.CHILD_INPUTS;else if(U=q.config.isFunctionFormWrappable&&!L?m.k.FORM_WRAPPED_SELECTION:m.k.PARENT_INPUTS,l&&t===v.oW.AddListRecord&&(U=m.k.PARENT_INPUTS),!b&&L){let e=(0,T.hj)(P,s.QF);(0,r.GU)(e)||(q=(0,g.$c)(q,e),U=m.k.THIRD_PARTY_USER_FORM_CONFIG)}}}(0,h.Dp)(q)===v.oW.AiAnswer&&(U=m.k.AI_STEP_DEFAULT)}e((0,N.q)({element:n.createElement(d.G,{segment:q,onSave:W,renderSaveError:H,afterStepId:w,isExistingSegment:!!u,isTrigger:!1,onCancel:O,defaultPane:U,onNavigateBack:F})}))});M.meta={name:"openStepFormModal",key:"createThunkOpenStepFormModal",description:"Open the segment form modal for a workflow step"}},0x1123a239c:(e,t,a)=>{"use strict";a.d(t,{k:()=>f});var n=a(0xbad225b5),r=a(0x1db69cda),l=a(0x126eb9491),i=a(0x426feba4),o=a(0x241a08725),s=a(0x52fc4a0c),c=a(0x126af815a),d=a(0x11c82607b),u=a(0x16e94c2bd),m=a(0x4e250925),p=a(0xe684f705),b=a(0x46dbff89);let renderSaveError=e=>n.createElement(i.y,{error:e}),f=(0,d.Ay)("Open the trigger options modal when creating a new `Start from scratch` workflow or creating a ways to start trigger from the sidebar",(e,t,{triggerType:a,channelId:i,subtype:d,submitLabel:f,serviceConfig:g,hasExistingWorkflow:h,existingTrigger:_,workflowId:y,onNavigateBack:x}={})=>{var v;let E,k=t(),w=(0,p.cA)(k),S=(v=(0,o.e)(a,{channelId:i,member:w,featureFlags:{},subtype:d,serviceConfig:g}),(E=(0,r.A)(v)).config={...E.config},E);if(S.type===c.YV){let e=S.config.service.function;S=(0,s.$v)(S,e)}let onSave=async t=>{if(_&&y){let a=t.coachmarkText,n=(0,u.yO)(t,y);n.name=_.config.name,e((0,m._v)({workflowId:y,triggerUpdate:n,coachmarkText:a}))}else e((0,m.Kb)({existingWorkflowId:h?y:void 0,trigger:t}))};e((0,b.q)({element:n.createElement(l.G,{segment:S,onSave:onSave,renderSaveError:renderSaveError,submitLabel:f,isExistingSegment:!1,isTrigger:!0,onNavigateBack:x})}))});f.meta={name:"openTriggerOptionsModal",key:"createThunkOpenTriggerOptionsModal",description:"Open the trigger options modal when creating a new `Start from scratch` workflow or creating a ways to start trigger from the sidebar"}},0x22678e203:(e,t,a)=>{"use strict";a.d(t,{eF:()=>i,ig:()=>r,rI:()=>s,vX:()=>selectDatasources});var n=a(0xc9c97240);let r=(0,n.Mz)([e=>e?.workflowBuilder?.workflowEditor?.schemaObjects??{},(e,t)=>t],(e,t)=>e?.[t]),l={},i=(0,n.Mz)([e=>e?.workflowBuilder?.workflowEditor?.schemaObjects??{},(e,t)=>t],(e,t)=>(t.forEach(t=>{let a=e?.[t];a&&(l[t]=a)}),l)),selectDatasources=e=>e?.workflowBuilder?.workflowEditor?.datasources,o={},s=(0,n.Mz)([e=>e?.workflowBuilder?.workflowEditor?.schemaObjects??{},(e,t)=>t],(e,t)=>0===t.length?o:t.filter(t=>e[t]).reduce((t,a)=>(t[a]={label:e[a].label,identifier:e[a].identifier},t),{}))},0x99e2bdae:(e,t,a)=>{"use strict";a.d(t,{Bh:()=>f,Fh:()=>x,Jc:()=>y,sv:()=>h});var n=a(0xa72c61bb),r=a(0x28d59ea1),l=a(0xbdbf0a38),i=a(0x1318fdf2a),o=a(0x1fd440889),s=a(0x1c7cb6e50),c=a(0x11c82607b),d=a(0x126492ec6),u=a(0x22678e203),m=a(0x1a7f6fce4),p=a(0x1f8f05a48);let b=(0,n.I)(),f=(0,c.Ay)("Fetch the datasources",async(e,t)=>{let a=await e((0,o.z)({appId:b,reason:"trigger_fetch_data_sources"})),n=a?.datasources??[];return e((0,d.gU)({datasources:n})),n});f.meta={name:"fetchDatasources",key:"createThunkFetchDatasources",description:"Fetch the datasources"};let g=(0,c.Ay)("Fetch the objects for the selected datasource",async(e,t,{datasourceId:a})=>{let n=(0,s.t)(await e((0,i.i)({datasourceId:a,reason:"trigger_fetch_data_source_objects"})));return e((0,d.Vh)({schemaObjects:n.objects})),n});g.meta={name:"innerFetchSchemaObjects",key:"createThunkInnerFetchSchemaObjects",description:"Fetch the objects for the selected datasource"};let h=(0,p.Ay)(g,3e3),_=(0,c.Ay)("Fetch the schema objects for the selected datasource and object",async(e,t,{datasourceId:a,schemaObjectId:n})=>{let r=t(),i=(0,u.ig)(r,n);if(i&&m._.isSchemaObjectWithFields(i)&&m._.isSchemaObjectWithChildren(i))return i;let{id:o,identifier:c,label:p,isUserObject:b,isActive:f,isTriggerSupported:g,isTokenAccessible:h,fields:_,childRelationships:y}=(0,s.t)(await e((0,l.O)({datasourceId:a,schemaObjectId:n,reason:"trigger_fetch_data_source_object_schema"}))),x={id:o,identifier:c,label:p,isUserObject:b,isActive:f,isTriggerSupported:g,isTokenAccessible:h,fields:_.map(e=>{let t=e?.relationships?.map(e=>(0,s.t)(e)),a=e?.options?.map(e=>(0,s.t)(e));return{...e,relationships:t,options:a}}),childRelationships:y};return e((0,d.Vh)({schemaObjects:[x]})),x});_.meta={name:"innerFetchDatasourceObjectsSchema",key:"createThunkInnerFetchDatasourceObjectsSchema",description:"Fetch the schema objects for the selected datasource and object"};let y=(0,p.Ay)(_,3e3),x=(0,c.Ay)("Fetch field references",async(e,t,{datasourceId:a,field:n,schemaObjectId:l,query:i})=>{let o=await e((0,r.J)({datasourceId:a,fieldId:n,schemaObjectId:l,query:i,reason:"trigger_fetch_field_references"}));return(0,s.t)(o)});x.meta={name:"fetchFieldReferences",key:"createThunkFetchFieldReferences",description:"Fetch field references"}},0x18967f42a:(e,t,a)=>{"use strict";a.d(t,{Mi:()=>p,SJ:()=>d,S_:()=>b,XL:()=>u,Zj:()=>m});var n=a(0xe874a88a),r=a(0x1af17aa34),l=a(0xcf658893),i=a(0x11c82607b),o=a(0x16e94c2bd),s=a(0x20adb28cd),c=a(0x1d89698af);let d=(0,l.Ay)("Upsert Workflow Versions");d.meta={name:"upsertWorkflowVersions",key:"createActionUpsertWorkflowVersions",description:"Upsert Workflow Versions"};let u=(0,l.Ay)("Load Workflow Version Begin");u.meta={name:"loadWorkflowVersionBegin",key:"createActionLoadWorkflowVersionBegin",description:"Load Workflow Version Begin"};let m=(0,l.Ay)("Load Workflow Version Success");m.meta={name:"loadWorkflowVersionSuccess",key:"createActionLoadWorkflowVersionSuccess",description:"Load Workflow Version Success"};let p=(0,l.Ay)("Load Workflow Version Failure");p.meta={name:"loadWorkflowVersionFailure",key:"createActionLoadWorkflowVersionFailure",description:"Load Workflow Version Failure"};let b=(0,i.Ay)("Load Workflow Version",(e,t,{workflowId:a,versionId:l})=>{let i=t(),b=(0,c.Dz)(i,l),f=(0,c.gJ)(i,l),g=(0,s.RG)(i,a);return f?n.S.resolve():(e(u({workflowId:a,versionId:l,background:b})),e((0,r.C)({workflowId:a,workflowVersionId:l,reason:"load-workflow-version"})).then(e=>({workflow:e.decorated_workflow,availableData:e.available_data,trigger:g?.trigger})).then(t=>(e(d({workflowVersion:{...t,workflow:(0,o.l_)(t.workflow)}})),e(m({workflowId:a,versionId:l})))).catch(t=>e(p({error:t,workflowId:a,versionId:l}))))});b.meta={name:"loadWorkflowVersion",key:"createThunkLoadWorkflowVersion",description:"Load Workflow Version"}},0x1d89698af:(e,t,a)=>{"use strict";a.d(t,{Dz:()=>selectWorkflowVersionLoaded,a2:()=>i,gJ:()=>selectWorkflowVersionLoading,mr:()=>selectWorkflowVersionLoadError});var n=a(0x77727995),r=a(0xc9c97240);let selectWorkflowVersionsCollection=e=>e.workflowBuilder?.workflowVersions.collection;(0,r.Mz)(selectWorkflowVersionsCollection,e=>Object.values(e||{}).map(e=>e.data));let l=(0,r.Mz)(selectWorkflowVersionsCollection,(e,t)=>t,(e,t)=>e[t]||null),i=(0,r.Mz)(l,e=>(0,n.A)(e,"data",null)),selectWorkflowVersionLoading=(e,t)=>{let a=l(e,t);return(0,n.A)(a,"loading",!1)},selectWorkflowVersionLoaded=(e,t)=>{let a=l(e,t);return(0,n.A)(a,"loaded",!1)},selectWorkflowVersionLoadError=(e,t)=>{let a=l(e,t);return(0,n.A)(a,"loadError",!1)}},0x1ed79bf71:(e,t,a)=>{"use strict";a.d(t,{MS:()=>d,W8:()=>s,Zq:()=>c,z_:()=>o});var n=a(0x292cc606),r=a(0x21f32a55),l=a(0xcf658893),i=a(0x11c82607b);let o=(0,i.Ay)("Crop Workflow Avatar",(e,t,{id:a,x:r,y:l,width:i})=>e((0,n.s)({reason:"workflows_crop_workflow_avatar",avatar:a,cropbox:`${Math.round(r)},${Math.round(l)},${Math.round(i)}`})));o.meta={name:"cropWorkflowAvatar",key:"createThunkCropWorkflowAvatar",description:"Crop Workflow Avatar"};let s=(0,i.Ay)("Upload Workflow Avatar",(e,t,{file:a})=>e((0,r.Z)({reason:"workflows_upload_workflow_avatar",image:a})));s.meta={name:"uploadWorkflowAvatar",key:"createThunkUploadWorkflowAvatar",description:"Upload Workflow Avatar"};let c=(0,l.Ay)("Sets the teamId to use for missions.workflows requests");c.meta={name:"setWorkflowsPageMetadataTeamId",key:"createActionSetWorkflowsPageMetadataTeamId",description:"Sets the teamId to use for missions.workflows requests"};let d=(0,l.Ay)("Sets the teamId to use for admin missions requests");d.meta={name:"setTeamWorkflowsPageMetadataTeamId",key:"createActionSetTeamWorkflowsPageMetadataTeamId",description:"Sets the teamId to use for admin missions requests"}},0x1bffa495d:(e,t,a)=>{"use strict";a.d(t,{pA:()=>getSegmentIcon,Kb:()=>I,mV:()=>T,MZ:()=>M});var n=a(0x20482ad21),r=a(0x14149c126);let l=new n.Ay("workflow_builder"),i={getTitle:e=>"on"===(0,r._Z)(e,"wfb_repeaters_lookups")?l.t("Repeat a step"):"",getDescription:e=>"on"===(0,r._Z)(e,"wfb_repeaters_lookups")?l.t("Repeats steps for each item in a collection"):"",getIsEnabled:()=>!1,getIcon:()=>"refresh"};var o=a(0xaaa6bbd0);let s={getTitle:()=>"",getDescription:()=>"",getIsEnabled:()=>!1,getAppName:()=>"",getFunctionType:()=>""};a(0x171a52b74);let c=new n.Ay("workflow_builder"),d={getTitle:()=>c.t("Add a branch",{fallbackHash:"61cc55aa0453184734c3fa0b621eda6fa874bd83"}),getDescription:()=>"",getIsEnabled:()=>!1,getIcon:()=>"branch"};var u=a(0x36e8c71e),m=a(0xbad225b5),p=a(0x210501b8f);let b=new n.Ay("workflow_builder"),f={getTitle:()=>b.t("Customize how to start the workflow",{fallbackHash:"5695013e040ce5cadf7d7deb2e87ac2471bb0650"}),getDescription:()=>"Third party event trigger",getIsEnabled:()=>!1,getIcon:()=>m.createElement("img",{alt:b.t("Salesforce Icon",{ns:"data_sources"}),className:"c-icon",src:p})},g=new n.Ay("workflow_builder"),h={getTitle:()=>g.t("On a schedule"),getDescription:()=>"Template trigger description",getIsEnabled:()=>!1,getIcon:()=>"clock"},_=new n.Ay("workflow_builder"),y={getTitle:()=>_.t("From a webhook"),getDescription:()=>"Hermes webhook trigger",getIsEnabled:()=>!1,getIcon:()=>"webhook"},x=new n.Ay("workflow_builder"),v={getTitle:()=>x.t("Choose how to start the workflow"),getDescription:()=>"Service trigger",getIsEnabled:()=>!0,getIcon:()=>"code"},E=new n.Ay("workflow_builder"),k={getTitle:()=>E.t("From a link in Slack"),getDescription:()=>"Someone clicks a shortcut",getIsEnabled:()=>!1,getIcon:()=>"link"};var w=a(0x2385f51a9),S=a(0x126af815a),C=a(0x1cf0d97e1),A=a(0x3b8174d2);function getSegmentInfo(e){switch(e){case S.SJ:return f;case S.bX:return y;case S.LO:return h;case S.kr:return w.f;case S.zW:return k;case S.YV:return v;case u.SLACK_FUNCTION:return s;case u.SWITCH:return d;case u.LOOP:return i;default:return null}}let T=(0,C.Ay)((e,t)=>{let{type:a}=t;return!getSegmentInfo(a)});T.meta={name:"getSegmentTypeIsUnknown",key:"createSelectorGetSegmentTypeIsUnknown",description:(e,t)=>{let{type:a}=t;return!getSegmentInfo(a)}};let I=(0,C.Ay)((e,t)=>{let a=getSegmentInfo(t.type);return a?.getTitle?.(e,t.subtype)});I.meta={name:"getSegmentTitle",key:"createSelectorGetSegmentTitle",description:(e,t)=>{let a=getSegmentInfo(t.type);return a?.getTitle?.(e,t.subtype)}},(0,C.Ay)((e,t)=>{let a=getSegmentInfo(t.type);return a?.getDescription?.(e,t.subtype)??null}).meta={name:"getSegmentDescription",key:"createSelectorGetSegmentDescription",description:(e,t)=>{let a=getSegmentInfo(t.type);return a?.getDescription?.(e,t.subtype)??null}},(0,C.Ay)((e,t)=>{let a=getSegmentInfo(t.type);return a?.getAppName?.(e,t.subtype)??null}).meta={name:"getSegmentAppName",key:"createSelectorGetSegmentAppName",description:(e,t)=>{let a=getSegmentInfo(t.type);return a?.getAppName?.(e,t.subtype)??null}};let getSegmentIcon=(e,t)=>{let a=getSegmentInfo(e.type);return a&&a.getIcon?"event"===e.type?a.getIcon(e.subtype,t):a.getIcon(e.type,t):null},N=(0,C.Ay)((e,t,a)=>{let n=getSegmentInfo(t.type);return n?.getIsEnabled?.(e,t.subtype,a)??!1});N.meta={name:"getSegmentIsEnabled",key:"createSelectorGetSegmentIsEnabled",description:(e,t,a)=>{let n=getSegmentInfo(t.type);return n?.getIsEnabled?.(e,t.subtype,a)??!1}},(0,C.Ay)((e,t)=>{let a=getSegmentInfo(t.type);return a?.getIsAdvanced?.(e,t.subtype)??!1}).meta={name:"getSegmentIsAdvanced",key:"createSelectorGetSegmentIsAdvanced",description:(e,t)=>{let a=getSegmentInfo(t.type);return a?.getIsAdvanced?.(e,t.subtype)??!1}},(0,C.Ay)((e,t)=>{let a=getSegmentInfo(t.type);return a?.getFunctionType?.(e,t.subtype)||""}).meta={name:"getSegmentFunctionCallbackId",key:"createSelectorGetSegmentFunctionCallbackId",description:(e,t)=>{let a=getSegmentInfo(t.type);return a?.getFunctionType?.(e,t.subtype)||""}},(0,C.Ay)(e=>Object.values(u).reduce((t,a)=>N(e,{type:a})?[...t,a]:t,[])).meta={name:"selectEnabledStepTypes",key:"createSelectorSelectEnabledStepTypes",description:e=>Object.values(u).reduce((t,a)=>N(e,{type:a})?[...t,a]:t,[])};let M=(0,C.Ay)((e,t)=>{let a=(0,o.Pv)(t)&&(0,o.lK)(t);return a?t.config.wrappedSlackFunction??(0,A.hj)(e,a):void 0});M.meta={name:"selectWrappedFunctionDetails",key:"createSelectorSelectWrappedFunctionDetails",description:(e,t)=>{let a=(0,o.Pv)(t)&&(0,o.lK)(t);return a?t.config.wrappedSlackFunction??(0,A.hj)(e,a):void 0}}},0x1c27a9e4a:(e,t,a)=>{"use strict";a.d(t,{E:()=>getSegmentSubtype});var n=a(0x252b4df6e),r=a(0x36e8c71e),l=a(0x112dbb8f3),i=a(0x126af815a);let getSegmentSubtype=e=>{switch(e?.type){case r.SLACK_FUNCTION:return(0,n.g$)(e);case i.kr:return(0,l.vd)(e);default:return}}},0xee12becf:(e,t,a)=>{"use strict";a.d(t,{S:()=>getSegmentSummary});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x1b3ecb90f),i=a(0x15a4ffb05),o=a(0x226892387),s=a(0x14149c126);let c=new r.Ay("workflow_builder"),LoopSummary=()=>{let e=(0,o.d4)(e=>"on"===(0,s._Z)(e,"wfb_repeaters_lookups"));return n.createElement("span",null,n.createElement(i.A,{text:e?c.t("Loop Function"):"Loop Function",emojiSize:l.lw.SMALL}))};LoopSummary.displayName="LoopSummary";var d=a(0xbe0b63ff),u=a(0x162e18dce),m=a(0x252b4df6e);let p=new r.Ay("workflow_builder");function DelaySummary({segment:e}){let t,a=(0,m.Iw)(e),r=a.minutes_to_delay?.value;if(r){let e=parseInt(r,10);if(e%1440==0){let a=e/1440;t=p.rt("Delay: {delayDisplay} {delayNumber, plural, =1 {day} other {days}}",{delayDisplay:String(a),delayNumber:a})}else if(e%60==0){let a=e/60;t=p.rt("Delay: {delayDisplay} {delayNumber, plural, =1 {hour} other {hours}}",{delayDisplay:String(a),delayNumber:a})}else t=p.rt("Delay: {delayDisplay} {delayNumber, plural, =1 {minute} other {minutes}}",{delayDisplay:r,delayNumber:e})}return n.createElement("span",null,r?t:"")}DelaySummary.displayName="DelaySummary";var b=a(0x15fb82076),f=a(0x2501a2cee),g=a(0x1c09d8c36),h=a(0x1795d8821),_=a(0xc4548bcd),y=a(0x159917868),x=a.n(y);let v=new r.Ay("workflow_builder");function GoogleSheetsSummary({segment:e}){let t=(0,m.Dl)(e),a=(0,m.Dp)(e),r=(0,m.Iw)(e),l=r.spreadsheet_id.value,i=`${g.BF}/${l}`,o=r.spreadsheet_id.label,s=(0,n.useCallback)(e=>{e.stopPropagation(),(0,_.A)(i)},[i]);if(!i||!o||"string"!=typeof l)return n.createElement("span",null,t?.title);let c=o[l],getSummaryLabel=()=>{switch(a){case h.Zk.AddSpreadsheetRow:return v.t("Add to");case h.Zk.SelectSpreadsheetRow:return v.t("Select from");case h.Zk.UpdateSpreadsheetRow:return v.t("Update");case h.Zk.DeleteSpreadsheetRow:return v.t("Delete from");default:return n.createElement("span",null,t?.title)}};return getSummaryLabel.displayName="getSummaryLabel",n.createElement("span",null,n.createElement("span",{className:x().title},getSummaryLabel()),n.createElement(b.A,{onClick:s},n.createElement("span",null,c),n.createElement("span",{className:x().icon},n.createElement(f.Ah,{name:"new-window",inline:!0,size:"20"}))))}GoogleSheetsSummary.displayName="GoogleSheetsSummary";var E=a(0x1e74dc307),k=a(0x668181b3),w=a(0x2772625d),S=a(0x20a2a54fa),C=a(0x247cf31a2),A=a(0xf4097f62),T=a(0x2dcb2e34),I=a.n(T);let N=new r.Ay("workflow_builder"),DynamicItemLabel=({label:e,variableSvgIcon:t})=>n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,size:"inherit",...t})," ",e??N.t("Missing Data")),getUserLabel=(e,t,a)=>{if(e.length>1)return N.t("{qty} people",{qty:e.length,fallbackHash:"b37554f695b15005fd23907b9488e0a8ad4bca5f"});let r=e[0];return(0,w.cn)(r)?n.createElement(DynamicItemLabel,{label:(0,k.x)(t.list,r)?.label,variableSvgIcon:a}):N.rt("@{user}",{user:n.createElement(A.A,{id:r,truncate:!0}),fallbackHash:"457d64a8b6c031bbf97653abb1689cab35c6261c"})};getUserLabel.displayName="getUserLabel";let getChannelLabel=(e,t,a)=>{if(e.length>1)return N.t("{qty} channels",{qty:e.length,fallbackHash:"18e03e2a37ba37df713f9665ef752fb8b40fc1e8"});let r=e[0];return(0,w.cn)(r)?n.createElement(DynamicItemLabel,{label:(0,k.x)(t.list,r)?.label,variableSvgIcon:a}):n.createElement(E.A,{channelId:r},n.createElement(C.A,{channelId:r,truncate:!0}))};function InviteToChannelSummary({segment:e}){let t=(0,m.Iw)(e),a=(0,S.EM)(e),r={name:"css"};if(!t.user_ids?.value||!t.channel_ids?.value)return n.createElement("span",null,N.rt("Invite to channel",{fallbackHash:"9a409d1a0f27bcc7944c5c19495e584fb26964d3",fallbackHashNs:"huddles"}));let l=[t.channel_ids?.value].flat(),i=getUserLabel([t.user_ids?.value].flat(),a,r),o=getChannelLabel(l,a,r);return n.createElement("span",null,N.rt("Invite {userLabel} to {channelLabel}",{userLabel:i,channelLabel:o,fallbackHash:"9a409d1a0f27bcc7944c5c19495e584fb26964d3",fallbackHashNs:"huddles"}))}getChannelLabel.displayName="getChannelLabel",InviteToChannelSummary.displayName="InviteToChannelSummary";let M=new r.Ay("workflow_builder");function SendEphemeralMessageSummary({segment:e}){let t=(0,m.Iw)(e),a=(0,S.EM)(e),r=t.channel_id?.value,l=t.user_id?.value,i=(0,m.Dl)(e),o={name:"css"};if("string"==typeof r&&"string"==typeof l){let e=(0,w.cn)(r),t=(0,w.cn)(l),i=e?(0,k.x)(a.list,r):null,s=t?(0,k.x)(a.list,l):null,c=i&&!i.isTombstone?i.label:M.t("Missing Data"),d=s&&!s.isTombstone?s.label:M.t("Missing Data"),u=t?n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,size:"inherit",...o})," ",d):n.createElement(A.A,{id:l}),m=e?n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,size:"inherit",...o})," ",c):n.createElement(E.A,{channelId:r},n.createElement(C.A,{channelId:r}));return n.createElement("span",null,M.rt('Send an "only visible to you" message to {user} in {channel}',{user:u,channel:m,fallbackHash:"2826a04933908bf2bc4143809f09f387840708b8"}))}return n.createElement("span",null,i?.title)}SendEphemeralMessageSummary.displayName="SendEphemeralMessageSummary";var L=a(0x16cf1da63),O=a(0x11a296110),F=a(0x125de1ee5),D=a(0x1e5781b84),P=a(0xcaee4748),R=a(0x238ee6f5d),B=a(0x154933c60),W=a(0xd6a16321),V=a(0xd843ab47),H=a(0x145d46a61),q=a(0x1ec68d6a3),U=a(0x21bfacd01),z=a(0x217553e42);let j=new r.Ay("workflow_builder");function SendMessageSummary({segment:e,hasErrors:t}){let a=(0,m.Iw)(e),r=(0,S.EM)(e),l=a.channel_id?.value,i=a.user_id?.value,s=(0,m.Dl)(e),c=(0,o.d4)(e=>(0,z.Pu)(e,i)),d=(0,o.d4)(U.V),u=(0,o.d4)(H.b2),{isChildWindow:p}=(0,n.useContext)(V.A),b=!d&&u&&!p,g=(0,L.wA)(),h=(0,n.useCallback)((e,t)=>{b&&(e.stopPropagation(),e.preventDefault(),g((0,F.p)({navProps:(0,W.pr)(t)})))},[g,b]),_=(0,n.useCallback)(async e=>{if(c)return void h(e,c.id);try{let t=await g((0,B.jP)({memberIds:[i],reason:"workflow_builder_send_message_summary"}));t?.channel?.id&&h(e,t.channel.id)}catch(e){(0,q.default)({label:"WORKFLOW-BUILDER"}).error("Failed to open DM in send message summary",e)}},[c,h,g,i]),y={name:"css"};if(l){if((0,w.cn)(l)){let e=(0,k.x)(r.list,l),t=e&&!e.isTombstone?e.label:j.t("Missing Data");return e&&t?n.createElement("span",null,j.rt("Send a message to <span>{dynamic_channel_label}</span>",{dynamic_channel_label:t},({text:e})=>n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,size:"inherit",...y})," ",e))):n.createElement("span",null,j.t("Sends a message to a channel"))}return n.createElement("span",null,j.rt("Send a message to {channel}",{channel:n.createElement(E.A,{openInClient:h,channelId:l},n.createElement(C.A,{channelId:l}),b?n.createElement("span",{className:I().splitViewIcon},n.createElement(f.Ah,{inline:!0,size:"inherit",name:"move-to-split-view"})):null)}))}if(i){if((0,w.cn)(i)){let e=(0,k.x)(r.list,i),t=e&&!e.isTombstone?e.label:j.t("Missing Data");return e&&t?n.createElement("span",null,j.rt("Send a message to <span>{dynamic_user_label}</span>",{dynamic_user_label:t},({text:e})=>n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,size:"inherit",...y})," ",e))):n.createElement("span",null,j.t("Sends a message to a user"))}return b?n.createElement("span",null,j.rt("Send a message to {user}",{user:n.createElement(O.Nm,{className:"c-member_slug--link",onClick:_},n.createElement(P.A,{noLinking:!0,id:i}),n.createElement("span",{className:I().splitViewIcon},n.createElement(f.Ah,{inline:!0,size:"inherit",name:"move-to-split-view"})))})):n.createElement("span",null,j.rt("Send a message to @{user}",{user:n.createElement(D.A,{id:i})}))}return t?n.createElement("span",null,j.rt("Send a message to {error}",{error:n.createElement(R.A,{type:"unknown"})})):n.createElement("span",null,s?.title)}SendMessageSummary.displayName="SendMessageSummary";let G=new r.Ay("workflow_builder"),SendToSalesHomeSummary=({segment:e,hasErrors:t=!1,isUserRequired:a=!1})=>{let r=(0,m.Iw)(e),l=(0,S.EM)(e),i=r.user_id?.value,o=r.notify_managers?.value,s=(0,m.Dl)(e),c={name:"css"};if("string"==typeof i){if((0,w.cn)(i)){let e=(0,k.x)(l.list,i),t=e&&!e.isTombstone?e.label:G.t("Missing Data");return e&&t?"string"==typeof o&&"true"===o.toLowerCase()||!0===o?n.createElement("span",null,G.rt("Send a notification to <span>{dynamic_user_label}</span> and their Managers or Leaders",{dynamic_user_label:t},({text:e})=>n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,...c})," ",e))):n.createElement("span",null,G.rt("Send a notification to <span>{dynamic_user_label}</span>",{dynamic_user_label:t},({text:e})=>n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,...c})," ",e))):n.createElement("span",null,G.t("Sends a notification to a user"))}return n.createElement("span",null,G.rt("Send a notification to @{user}",{user:n.createElement(D.A,{id:i})}))}return t&&a?n.createElement("span",null,G.rt("Send a notification to {error}",{error:n.createElement(R.A,{type:"unknown"})})):n.createElement("span",null,s?.title)};SendToSalesHomeSummary.displayName="SendToSalesHomeSummary";let $=new r.Ay("workflow_builder"),ChannelLabel=({channelId:e,variables:t})=>{if(!e)return null;if((0,w.cn)(e)){let a=(0,k.x)(t,e),r=a?.label;return n.createElement("span",{className:I().variable_container},n.createElement(f.Ah,{inline:!0,name:"css",size:"inherit"})," ",r)}return n.createElement(E.A,{channelId:e},n.createElement(C.A,{channelId:e,truncate:!0}))};function SummarizeChannelSummary({segment:e}){let t=(0,m.Iw)(e),a=(0,S.EM)(e),r=t.channel_ids?.value,l=t.days?.value,i=Array.isArray(r)?r[0]:r;return Array.isArray(r)&&r.length>1?n.createElement("span",null,$.rt("Summarize channels",{fallbackHash:"1b8962f14007d162f0dc43de8d265d059787b34a",fallbackHashNs:"assistant"})):"string"!=typeof i||"string"!=typeof l&&"number"!=typeof l||"string"==typeof l&&(0,w.cn)(l)?n.createElement("span",null,$.rt("Summarize channel")):n.createElement("span",null,$.rt("Summarize the last {dayCount} {dayCount, plural, =1 {day} other {days}} of {channelLabel}",{channelLabel:n.createElement(ChannelLabel,{channelId:i,variables:a.list}),dayCount:Number(l)}))}ChannelLabel.displayName="ChannelLabel",SummarizeChannelSummary.displayName="SummarizeChannelSummary";var K=a(0x339b339c),Y=a(0x135b7b386);let SlackFunctionSummary=({segment:e,hasErrors:t})=>{let a=(0,u.E)(e),r=(0,m.Dp)(e),l=a??(0,m.Dl)(e),i=(0,m.Zy)(e);if(a&&(0,d.GU)(a))return n.createElement(K.A,{size:"large"});if(i===Y.wo)return GoogleSheetsSummary({segment:e});if(r!==h.oW.SendMessage&&r!==h.oW.SendToMySalesHome&&r!==h.oW.SendToSalesHome&&r!==h.oW.SendToMySalesforceApp&&r!==h.oW.SendToSalesforceApp&&r!==h.oW.SendSummaryToMySalesHome&&r!==h.oW.SendSummaryToSalesHome&&r!==h.oW.SendEphemeralMessage&&r!==h.oW.SendDm&&r!==h.oW.ReplyInThread&&r!==h.oW.InviteUserToChannel&&r!==h.oW.Delay&&r!==h.oW.SummarizeChannel)return n.createElement("span",null,l?.title);switch(r){case h.oW.SendDm:case h.oW.SendMessage:case h.oW.ReplyInThread:return n.createElement(SendMessageSummary,{segment:e,hasErrors:t});case h.oW.SendEphemeralMessage:return n.createElement(SendEphemeralMessageSummary,{segment:e});case h.oW.Delay:return n.createElement(DelaySummary,{segment:e});case h.oW.InviteUserToChannel:return n.createElement(InviteToChannelSummary,{segment:e});case h.oW.SummarizeChannel:return n.createElement(SummarizeChannelSummary,{segment:e});case h.oW.SendToMySalesHome:case h.oW.SendToMySalesforceApp:return n.createElement(SendToSalesHomeSummary,{segment:e,hasErrors:t});case h.oW.SendToSalesHome:case h.oW.SendToSalesforceApp:return n.createElement(SendToSalesHomeSummary,{segment:e,hasErrors:t,isUserRequired:!0});default:return n.createElement("span",null,l?.title)}};SlackFunctionSummary.displayName="SlackFunctionSummary";var Q=a(0x75b1e64d),Z=a(0x36e8c71e),J=a(0xdfa9cb32),X=a(0x17178b190),ee=a(0x56e1c8ae);let et=new r.Ay("workflow_builder"),ExternalTriggerSummary=({trigger:e})=>{if((0,ee.kp)(e.config)||(0,ee.EP)(e.config)||(0,ee.S)(e.config)){let{startTime:t,frequency:a}=e.config,r={startTime:t,frequency:{type:a.type,onDays:a.on_days,repeatsEvery:a.repeats_every},timezone:X.GI};return n.createElement("span",{className:"name"},(0,J.M)(r))}return(0,ee.SZ)(e.config)?n.createElement("span",{className:"name"},et.t("Starts when a Salesforce channel is created",{fallbackHash:"16195f4e05b6d8dbd288fb741705a87c3e6e3682",fallbackHashNs:"hermes_shortcuts"})):n.createElement("span",{className:"name"},et.t("Starts with a Salesforce event"))};ExternalTriggerSummary.displayName="ExternalTriggerSummary";var ea=a(0x1ccef1c6f);let HermesScheduledTriggerSummary=({trigger:e})=>{let t=(0,o.d4)(e=>(0,ea.ty)(e,"time24")),{schedule:a}=e.config;return n.createElement("span",null,(0,J.M)(a,{do24hrTime:t}))};HermesScheduledTriggerSummary.displayName="HermesScheduledTriggerSummary";let en=new r.Ay("workflow_builder"),HermesWebhookTriggerSummary=()=>n.createElement("span",null,en.t("Starts with a webhook"));HermesWebhookTriggerSummary.displayName="HermesWebhookTriggerSummary";let ServiceTriggerSummary=({trigger:e})=>n.createElement("span",null,e.config.summary);ServiceTriggerSummary.displayName="ServiceTriggerSummary";var er=a(0x1f48c8a62),el=a.n(er);let ei=new r.Ay("workflow_builder"),ShortcutSummary=()=>n.createElement("div",{className:el().shortcut_summary_header},ei.t("Starts from a link in Slack"));ShortcutSummary.displayName="ShortcutSummary";var eo=a(0x61c95b1b),es=a(0x112dbb8f3);let ec=new r.Ay("workflow_builder"),ChannelCreatedSummary=({trigger:e})=>{let t=(0,o.d4)(H.EA),a=(0,es.kv)(e.config.event);return a?n.createElement(n.Fragment,null,t?ec.rt('Starts when a channel containing "{channelSubstring}" is created',{channelSubstring:a}):`Starts when a channel containing "${a}" is created`):n.createElement(n.Fragment,null,t?ec.t("Starts when a channel is created"):"Starts when a channel is created")};var ed=a(0x408bdeff),eu=a(0x3796a18c),em=a(0x37ad6380),ep=a.n(em);let eb=new r.Ay("workflow_builder"),ListRecordCreatedSummary=({trigger:e})=>{let t=(0,es.I2)(e);return t?n.createElement("span",{className:ep().inline__title},eb.rt("Starts when an item is created in {list}",{list:n.createElement(ed.A,{id:t,detailType:eu.s.NONE,className:ep().inline__file_entity}),fallbackHash:"8bddb4cc8b3a58cca34cd47fcd074c0330af08d3"})):n.createElement(n.Fragment,null,eb.t("Starts when a list item is created",{fallbackHash:"8bddb4cc8b3a58cca34cd47fcd074c0330af08d3"}))};ListRecordCreatedSummary.displayName="ListRecordCreatedSummary";let ef=new r.Ay("workflow_builder"),ListRecordUpdatedSummary=({trigger:e})=>{let t=(0,es.I2)(e);return t?n.createElement("span",{className:ep().inline__title},ef.rt("Starts when an item is updated in {list}",{list:n.createElement(ed.A,{id:t,detailType:eu.s.NONE,className:ep().inline__file_entity}),fallbackHash:"8bddb4cc8b3a58cca34cd47fcd074c0330af08d3"})):n.createElement(n.Fragment,null,ef.t("Starts when a list item is updated",{fallbackHash:"8bddb4cc8b3a58cca34cd47fcd074c0330af08d3"}))};ListRecordUpdatedSummary.displayName="ListRecordUpdatedSummary";var eg=a(0x22f6c772a),eh=a(0x51e1a82c);let e_=new r.Ay("workflow_builder"),MessagePostedSummary=({trigger:e})=>{let{channelIds:t,filter:a}=e.config.event,r=(0,o.d4)(H.Lh);return a&&t?n.createElement("span",null,(0,eh.H)({channelIds:t,filter:a,inClient:r,messagePostedSummaryContext:eg.Q.EDITOR})):e_.t("Starts when a message is posted with keywords")};MessagePostedSummary.displayName="MessagePostedSummary";var ey=a(0x1e864b930),ex=a(0x9b971e7e),ev=a(0x1266f1359),eE=a(0x1e4ae349d);let ek=new r.Ay("workflow_builder"),ReactionAddedSummary=({trigger:e})=>{let t=(0,es.zP)(e.config.event),a=(0,es.Jp)(e),r=(0,o.d4)(e=>(0,ea.ty)(e,"preferred_skin_tone")),i=(0,o.d4)(ex.ZT),s=(0,ev.$D)(i),c=(0,n.useCallback)(e=>(0,eE.Fm)(s,{text:e,teamId:i??""})&&"1"!==r?`${e}::skin-tone-${r}`:e,[r,s,i]);return t.length&&a.length?n.createElement(n.Fragment,null,ek.rt("Starts when someone reacts with {emoji} in {channel}",{emoji:(0,ey.A)(t.map(e=>{let t=c(e);return n.createElement(l.Ay,{key:`emoji-${t}`,text:t,emojiSize:"small"})}),{conj:"or",keyPrefix:"emoji"}),channel:(0,ey.A)(a.map(e=>n.createElement(E.A,{channelId:e,key:`channel-${e}`},n.createElement(C.A,{channelId:e}))),{conj:"or",keyPrefix:"channel"})})):n.createElement(n.Fragment,null,ek.t("Starts when an emoji reaction is used"))};ReactionAddedSummary.displayName="ReactionAddedSummary";let ew=new r.Ay("workflow_builder"),UserJoinedChannelSummary=({trigger:e})=>{let t=(0,es.Jp)(e);return t.length?n.createElement(n.Fragment,null,ew.rt("Starts when a person joins {channel}",{channel:(0,ey.A)(t.map(e=>n.createElement(E.A,{channelId:e,key:`channel-${e}`},n.createElement(C.A,{channelId:e}))),{conj:"or",keyPrefix:"channel"})})):n.createElement(n.Fragment,null,ew.t("Starts when a person joins a channel"))};UserJoinedChannelSummary.displayName="UserJoinedChannelSummary";let SlackEventTriggerSummary=({trigger:e})=>{let t=(0,es.IM)(e);switch((0,es.vd)(e)){case eo.$.ReactionAdded:return n.createElement(ReactionAddedSummary,{trigger:e});case eo.$.UserJoinedChannel:return n.createElement(UserJoinedChannelSummary,{trigger:e});case eo.$.ListRecordCreated:return n.createElement(ListRecordCreatedSummary,{trigger:e});case eo.$.ListRecordUpdated:return n.createElement(ListRecordUpdatedSummary,{trigger:e});case eo.$.ChannelCreated:return n.createElement(ChannelCreatedSummary,{trigger:e});case eo.$.MessagePosted:return n.createElement(MessagePostedSummary,{trigger:e});default:return n.createElement("span",null,t)}};SlackEventTriggerSummary.displayName="SlackEventTriggerSummary";var eS=a(0x126af815a);function getSegmentSummary(e,t){switch(e?.type){case eS.SJ:return n.createElement(ExternalTriggerSummary,{trigger:e});case eS.kr:return n.createElement(SlackEventTriggerSummary,{trigger:e});case eS.zW:return n.createElement(ShortcutSummary,null);case eS.bX:return n.createElement(HermesWebhookTriggerSummary,null);case eS.LO:return n.createElement(HermesScheduledTriggerSummary,{trigger:e});case eS.YV:return n.createElement(ServiceTriggerSummary,{trigger:e});case Z.SLACK_FUNCTION:return n.createElement(SlackFunctionSummary,{segment:e,hasErrors:t});case Z.SWITCH:return n.createElement(Q.B,{segment:e});case Z.LOOP:return n.createElement(LoopSummary,null);default:return null}}getSegmentSummary.displayName="getSegmentSummary"},0x88dc61ea:(e,t,a)=>{"use strict";a.d(t,{Hj:()=>useSegmentSubmit,N6:()=>s,Qk:()=>useSegmentValidation,ZH:()=>l,cR:()=>i,qE:()=>useSegmentSpeedBump,rC:()=>useSegmentDispatch,us:()=>o});var n=a(0xbad225b5),r=a(0x1cbdfeceb);let l=(0,n.createContext)(r.A),useSegmentDispatch=()=>(0,n.useContext)(l),i=(0,n.createContext)({});(0,n.createContext)({});let useSegmentValidation=()=>(0,n.useContext)(i),o=(0,n.createContext)({openSpeedBump:r.A,closeSpeedBump:r.A}),useSegmentSpeedBump=()=>(0,n.useContext)(o),s=(0,n.createContext)(r.A),useSegmentSubmit=()=>(0,n.useContext)(s)},0x870b34a7:(e,t,a)=>{"use strict";a.d(t,{W:()=>createSegmentAction});let createSegmentAction=e=>{let creator=t=>({type:e,payload:t});return creator.type=e,creator}},0x106f35107:(e,t,a)=>{"use strict";a.d(t,{GX:()=>createSegmentReducer,RJ:()=>o});var n=a(0x20c2aafd7),r=a(0x18dac2b8e),l=a(0x870b34a7);let i={type:"__SEGMENT__REDUCER__INITIALIZE__",payload:{}},o=(0,l.W)("update coachmark (template mode only)"),createSegmentReducer=(e=[],t=e=>({segment:e}))=>{let a={},reducer=(t,l)=>{let o=a[l.type];if(o||l.type===i.type){let a=o?o(t,l.payload):t,i=e.reduce((e,t)=>((0,r.Cu)()&&t.key in e&&(0,n.z3)(`Duplicate validator key ${t.key}. All validator keys must be unique.`),{...e,[t.key]:t(a,e)}),{});return{...a,computed:i}}return t};return reducer.initialize=((e,t=e=>({segment:e}))=>a=>{let l=e(t(a),i);if((0,r.Cu)()){let e=typeof l?.computed?.isValid;"boolean"!==e&&(0,n.z3)(`Segment state computed value "isValid" is incorrect type: ${e}.`)}return l})(reducer,t),reducer.on=(e,t)=>(a[e.type]=t,reducer),reducer.on(o,(e,{coachmarkData:t})=>{let{segment:a}=e;return{...e,segment:{...a,coachmarkText:t}}}),reducer}},0x139a1172d:(e,t,a)=>{"use strict";a.d(t,{g:()=>createSegmentValidator});let createSegmentValidator=(e,t)=>{let validator=(e,a={},n)=>n?t(e,a,n):t(e,a);return validator.key=e,validator}},0xf9f06c3b:(e,t,a)=>{"use strict";a.d(t,{v:()=>RenderingEngine});var n=a(0xbad225b5),r=a(0x1011848bf),l=a(0x17c7b6bbb),i=a(0x1c244e721),o=a(0x96aa1794),s=a(0xf6b2f43b),c=a(0x647f4f35),d=a(0x203b19061),u=a(0x159b87895),m=a(0x1a5ac3a0c),p=a(0x88dc61ea),b=a(0x24213b628),f=a(0xa231133b),g=a(0x1e271947d),h=a(0x24eaf48aa),_=a(0x238b287cf),y=a(0x1bb9b9e21),x=a(0x145d46a61),v=a(0x1795d8821),E=a(0x1fffc0b54),k=a(0x226892387),w=a(0x14149c126),S=a(0x16af7d0de);let RenderingEngine=({functionId:e,inputParameters:t,oAuthParameter:a,variables:C,configuredParameters:A,onChange:T,formatVariableBeforeInsert:I,callbackId:N,applySpecialTreatment:M,showInline:L=!1,renderOAuth2InputParameter:O,stepId:F,isExistingStep:D,serviceTriggerType:P,isTriggerSegment:R,functionVariables:B,isOAuthTokenInvalid:W,isFunctionFormWrapped:V,onlyRenderParentInputs:H,onlyRenderChildInputs:q,shouldAlwaysDisplayVariableSelector:U,onLoadingStateChange:z,hideLabel:j,invalidKeyword:G,shouldAutoFocus:$,enableEmojiAutocomplete:K,allowVariables:Y})=>{let Q,Z=(0,k.d4)(e=>"on"===(0,w._Z)(e,"user_authored_workflow_posts_fe")),J=(0,k.d4)(x.EY),X=(0,o.j)(),ee=(0,m.DY)(X),et=(0,p.rC)(),ea=(0,s.u)(),en=(0,_.A)(),er=X.trigger?.type,el=X.trigger&&(0,l.A4)(X.trigger)?X.trigger.external.salesforce_org_id:void 0,ei=X.trigger?.id,{privateChannelAccess:eo,privateChannelTeamIds:es}=(0,u.U)({workflow:X,isLatestWorkflowData:!0,callbackId:N,isTriggerSegment:R}),{aiStepPrivateChannelAccess:ec,aiStepPrivateChannelTeamIds:ed}=(0,c.k)({callbackId:N}),eu=(0,d.A)({variables:C,callbackId:N,isTriggerSegment:R}),{hasValidAppPinBuiltInMessage:em}=(0,p.Qk)(),ep=(0,k.d4)(E.Zs),eb=(0,b.N)(X,ep??void 0),ef=(0,n.useMemo)(()=>{let e=F;if(!e)if(!R||!ei)return;else e=ei;let t=(0,m.rM)(X,e);return(0,h.jS)(t)},[F,X,ei,R]),eg=(0,m.R5)(X,F,ep),eh=eg&&eg.some(e=>e?.function?.callback_id===v.oW.SummarizeChannel);D&&eg&&(Q=eg[eg.length-2]),!D&&eg&&(Q=eg[eg.length-1]);let e_=Q?.id??"",ey=Z&&eg&&Q?.function?.callback_id===v.oW.OpenForm&&Q?.function?.id===S.Ez.open_form,ex=(0,k.d4)(e=>(0,y.X)(e,X)),ev=(0,n.useCallback)(()=>{(0,i.W)(en,{wbArgs:{workflow_id:ee,is_hermes:!0}})},[en,ee]),eE=(0,n.useCallback)(e=>et((0,f.aI)({value:e})),[et]),ek=(0,n.useCallback)(e=>et((0,g.KR)(e)),[et]),ew=(0,n.useCallback)(({parameter:e,value:t,label:a})=>et((0,g.qq)({parameter:e,value:t,label:a})),[et]),eS=(0,n.useMemo)(()=>({updateRequiredContext:eE,viewOnly:ea,updateParameterValue:ew,onVariableMenuOpen:ev,openFormSteps:eb,triggerType:er,externalTriggerSalesforceOrgId:el,validateAsyncValue:ek,hasValidAppPinBuiltInMessage:em,workflowSummaryStepPrecedes:eh,formStepPrecedesCurrentStep:ey,previousStepId:e_,messagePostedTriggerPrivateChannelAccess:eo,messagePostedTriggerPrivateChannelTeamIds:es,aiStepPrivateChannelAccess:J?ec:void 0,aiStepPrivateChannelTeamIds:J?ed:void 0}),[eE,ea,ew,ev,eb,er,el,ek,em,eh,ey,e_,eo,es,J,ec,ed]);return n.createElement(r.L,{functionId:e,inputParameters:t,oAuthParameter:a,variables:eu,onChange:T,configuredParameters:A,formatVariableBeforeInsert:I,applySpecialTreatment:M,renderOAuth2InputParameter:O,isExistingStep:D,workflowRendererContexts:eS,stepId:F,stepErrorCode:ef,showInline:L,callbackId:N,workflowId:ee,workflowExternalWorkspaceId:ex,serviceTriggerType:P,triggerId:ei,isTriggerSegment:R,functionVariables:B,isOAuthTokenInvalid:W,isFunctionFormWrapped:V,onlyRenderParentInputs:H,onlyRenderChildInputs:q,shouldAlwaysDisplayVariableSelector:U,onLoadingStateChange:z,hideLabel:j,invalidKeyword:G,shouldAutoFocus:$,enableEmojiAutocomplete:K,allowVariables:Y})};RenderingEngine.displayName="RenderingEngine"},0xfcd3ead1:(e,t,a)=>{"use strict";a.d(t,{Jw:()=>c,_$:()=>o,Xp:()=>s});var n=a(0x870b34a7),r=a(0x106f35107);let l=(0,a(0x139a1172d).g)("isValid",e=>!!e.segment),i=(0,n.W)("initiate loop step"),o=(0,n.W)("update loop collection"),s=(0,n.W)("update loop item type"),c=(0,r.GX)([l]).on(i,e=>{let{segment:t}=e;return{...e,segment:{...t,loopConfig:{collection:[],parallel_execution:!1,item_type:void 0}}}}).on(o,(e,{collection:t})=>{let{segment:a}=e;return{...e,segment:{...a,loopConfig:{parallel_execution:a.loopConfig?.parallel_execution??!0,collection:t,item_type:a.loopConfig?.item_type}}}}).on(s,(e,{item_type:t})=>{let{segment:a}=e;return{...e,segment:{...a,loopConfig:{...a.loopConfig,item_type:t}}}})},0xa231133b:(e,t,a)=>{"use strict";a.d(t,{Af:()=>N,bd:()=>U,GZ:()=>applySlackFunctionFormStepReducerActions,JB:()=>j,$m:()=>getSlackFunctionFormStepReducer,c5:()=>F,Zy:()=>G,V0:()=>O,zo:()=>Y,Gz:()=>K,Qj:()=>Z,EV:()=>$,ST:()=>et,TI:()=>X,aL:()=>V,nX:()=>J,ud:()=>P,y_:()=>q,qt:()=>D,d4:()=>H,ly:()=>z,qc:()=>B,eY:()=>R,aI:()=>Q,FL:()=>ee});var n=a(0x1db69cda),r=a(0xe0376d2),l=a(0x12edaa96a),i=a(0x61fd76c),o=a(0x12b3420f4),s=a(0x1862f5064),c=a(0x1dde3f5ab),d=a(0x38bda683),u=a(0x23465d793),m=a(0x1db887024),p=a(0x127c49a8d),b=a(0x9d5bcdc6),f=a(0x1bbb44431),g=a(0xe53aa0),h=a(0x542936b0),_=a(0x9f477e8a),y=a(0x870b34a7),x=a(0x106f35107),v=a(0xd0fb5338),E=a(0x177a179f2),k=a(0x828e2524),w=a(0xa03b6325);let getValueTemplateFromOnSubmitConfigInputs=(e,t)=>{if(!(t in e))return Object.values(e).find(({value:e})=>!(!(0,k.w)(e)||(0,w.L)(e))&&t in e);return e[t]};var S=a(0x4cecf0f9),C=a(0xabd92c55),A=a(0x252b4df6e);let move_array_element=function(e,t,a){if(e<0||e>=a.length)throw Error(`start index ${e} is out-of-bounds for array of length ${a.length}`);if(t<0||t>=a.length)throw Error(`end index ${t} is out-of-bounds for array of length ${a.length}`);if(e===t)return a;let n=[...a],r=n.splice(e,1);return n.splice(t,0,...r),n};var T=a(0x1795d8821),I=a(0x1ec68d6a3);let N=(0,y.W)("add question"),M=(0,y.W)("open question"),L=(0,y.W)("close question"),O=(0,y.W)("remove question"),F=(0,y.W)("move question"),D=(0,y.W)("update question label"),P=(0,y.W)("update question description"),R=(0,y.W)("update question type"),B=(0,y.W)("update question optional"),W=(0,y.W)("update question data source"),V=(0,y.W)("update question default value"),H=(0,y.W)("update question multi-select max selected items"),q=(0,y.W)("update allowed_filetypes property for questions of type file_id"),U=(0,y.W)("add question option"),z=(0,y.W)("update question option label"),j=(0,y.W)("delete question option"),G=(0,y.W)("move question option"),$=(0,y.W)("update interactivity pointer"),K=(0,y.W)("update dialog title"),Y=(0,y.W)("syncs form fields based on nested response"),Q=(0,y.W)("update required context needed by step configuration"),Z=(0,y.W)("update field type"),J=(0,y.W)("update question default value and choices"),X=(0,y.W)("update form wrapped configuration"),ee=(0,y.W)("update selected slack function"),et=(0,y.W)("sets whether the form can be added or removed from a step"),initializeSlackFunctionFormSegmentState=e=>{let t=(0,v.yS)(e);return{segment:(0,v.uG)(t.map(e=>{let t=(0,u.l)(e)??d.xi.ShortText,a=(0,c.EI)(t)?(0,_.YP)(e?.items?.enum||[]):e.options,n={...e,options:a,questionType:t};if(n.options){let e,a=n.options.map(e=>e.id?e:{...e,id:(0,l.A)()});if(t===d.xi.Dropdown&&(0,g.w)(a))try{let t=JSON.stringify(n.value);e=a.find(e=>JSON.stringify(e.value)===t)}catch(e){(0,I.getGenericLogger)().warn("WORKFLOW_BUILDER",e)}else e=a.find(e=>e.value===n.value);return{...n,selectedOptionId:e?.id??null,options:a}}return n}),e),openQuestionName:(0,v.UW)(t),shouldFocusQuestion:!1}},applySlackFunctionFormStepReducerActions=e=>e.on(N,e=>{let{segment:t}=e,a=(0,v.yS)(t),n=(0,v.hG)({questionType:d.xi.ShortText});if(a.length<m.Rj){let r=a.concat(n);return{...e,segment:(0,v.uG)(r,t),openQuestionName:n.name,shouldFocusQuestion:!0}}return e}).on(F,(e,t)=>{let{segment:a}=e,{questionIndex:n,newQuestionIndex:r}=t,l=(0,v.yS)(a);if(r>=0&&r<l.length){let t=move_array_element(n,r,l);return{...e,segment:(0,v.uG)(t,a)}}return e}).on(O,(e,t)=>{let{segment:a}=e,{questionName:n}=t,r=(0,v.yS)(a).filter(e=>e.name!==n);return{...e,segment:(0,v.dH)(n,null,(0,v.uG)(r,a))}}).on(M,(e,t)=>{let{questionName:a}=t;return{...e,openQuestionName:a,shouldFocusQuestion:!0}}).on(L,e=>({...e,openQuestionName:null})).on(D,(e,t)=>{let{segment:a}=e,{questionName:n,label:r}=t,l=(0,v.HQ)(n,a,e=>({...e,label:r,title:r}));return{...e,segment:l}}).on(P,(e,t)=>{let{segment:a}=e,{questionName:n,description:r}=t,l=(0,v.HQ)(n,a,e=>({...e,description:r}));return{...e,segment:l}}).on(R,(e,t)=>{let{segment:a}=e,{questionName:n,questionType:r}=t,l=(0,v.HQ)(n,a,e=>(0,v.hG)({questionType:r,label:e.label,optional:e.optional,name:e.name,title:e.title,description:e.description,previousOptions:e.options||[(0,_.Kq)()]}));return{...e,segment:l}}).on(Z,(e,t)=>{let{segment:a}=e,{questionName:r,parameter:l}=t,c=(0,A.UX)(a),d=(0,E.FE)(a),u=c&&(0,o.ny)(c.input_parameters);if(!l||!d||!c)return e;let m=c?.id,p=!(l.name in d)&&!!u,g=getValueTemplateFromOnSubmitConfigInputs(d,l.name)??{value:null},_=(0,f.d)({functionId:m,input:l,valueTemplate:p?(0,h.E)(g,l.name):g,parentInput:p?u:void 0});if(!_)return e;let y=(0,v.yS)(a).find(({name:e})=>e===r),x=(0,n.A)(a);y&&getValueTemplateFromOnSubmitConfigInputs(d,r)&&(x=(0,v.dH)(r,null,x)),x=(0,v.dH)(l.name,(0,i.n)(l.name),x);let k=(0,b.K)(l.type===T.TE.Array?l.items.type:l.type);return x=(0,v.HQ)(r,x,e=>{let t=(0,S.G)(_,l.is_required);if(k&&!t.default&&!t.value){let e=(0,s.Q)({isKeyValueParameter:p,parameterName:p?u.name:l.name,dynamicOptionKey:p?l.name:void 0,functionVariables:(0,A.am)(a)});if(e?.mapping)return{...t,value:e.mapping.template,default:e.mapping.template}}return t}),{...e,segment:x}}).on(B,(e,t)=>{let{segment:a}=e,{questionName:n,optional:r}=t,l=(0,v.HQ)(n,a,e=>({...e,optional:r,is_required:!r}));return{...e,segment:l}}).on(W,(e,t)=>{let{segment:a}=e,{questionName:n,dataSource:r}=t,l=(0,v.HQ)(n,a,e=>({...e,data_source:r,value:"",default:""}));return{...e,segment:l}}).on(V,(e,t)=>{let{segment:a}=e,{questionName:n,value:r,optionId:l}=t,i=(0,v.HQ)(n,a,e=>({...e,value:0===r?0:r||(0,_.Nr)(e,l),default:0===r?0:r||(0,_.Nr)(e,l),selectedOptionId:l}));return{...e,segment:i}}).on(J,(e,t)=>{let{segment:a}=e,{questionName:n,value:r,choices:l,filterQueries:i}=t,o=Array.isArray(r)?{items:{choices:l}}:{choices:l},s=(0,v.HQ)(n,a,e=>({...e,...o,filterQueries:i,value:r,default:r}));return{...e,segment:s}}).on(H,(e,t)=>{let{segment:a}=e,{questionName:n,maxItems:r}=t,l=(0,v.HQ)(n,a,e=>({...e,maxItems:r}));return{...e,segment:l}}).on(q,(e,t)=>{let{segment:a}=e,{questionName:n,allowedFileTypesGroup:r}=t,l=(0,v.HQ)(n,a,e=>({...e,items:{...e.items,allowed_filetypes_group:r}}));return{...e,segment:l}}).on(U,(e,t)=>{let{segment:a}=e,{questionName:n}=t,r=(0,v.HQ)(n,a,e=>{let{options:t,questionType:a,items:n,maxItems:r}=e,l=r===(0,_.sx)(t||[]).length;if((0,_.aA)(a,t)){let i=t.concat((0,_.Kq)()),o=l?(0,_.sx)(i).length:r,s=(0,c.OW)(a);return(0,c.EI)(a)?{...e,options:i,items:{...n,enum:(0,_.sx)(i)},...(0,c.kd)(a)?{maxItems:o}:{}}:{...e,options:i,choices:s?(0,_.mv)(i):(0,_.L3)(i),enum:s?(0,_.fY)(i):(0,_.sx)(i)}}return e});return{...e,segment:r}}).on(j,(e,t)=>{let{segment:a}=e,{questionName:n,optionId:r}=t,l=(0,v.HQ)(n,a,e=>{let{options:t,questionType:a,items:n,maxItems:l}=e,i=e.selectedOptionId===r?null:e.selectedOptionId,o=e.selectedOptionId===r?"":e.value,s=t?.filter(e=>e.id!==r)??[],d=l&&l>(0,_.sx)(s).length?(0,_.sx)(s).length:l,u=(0,c.OW)(a);return(0,c.EI)(a)?{...e,options:s,items:{...n,enum:(0,_.sx)(s)},...(0,c.kd)(a)?{maxItems:d}:{}}:{...e,options:s,choices:u?(0,_.mv)(s):(0,_.L3)(s),enum:u?(0,_.fY)(s):(0,_.sx)(s),selectedOptionId:i,value:o,default:o}});return{...e,segment:l}}).on(G,(e,t)=>{let a=(0,n.A)(e.segment),{questionIndex:r,questionOptionIndex:l,newQuestionOptionIndex:i}=t,o=(0,v.yS)(a),s=o[r].options;if(s&&i>=0&&i<s.length){let t=move_array_element(l,i,s),d=(0,u.l)(o[r]);o[r].options=t;let m=!!d&&(0,c.OW)(d);return d&&(0,c.EI)(d)?o[r].items={type:o[r].items.type,enum:(0,_.sx)(t)}:(o[r].choices=m?(0,_.mv)(t):(0,_.L3)(t),o[r].enum=m?(0,_.fY)(t):(0,_.sx)(t)),{...e,segment:(0,v.uG)((0,n.A)(o),a)}}return e}).on(z,(e,t)=>{let{segment:a}=e,{questionName:n,optionId:r,label:l,value:i}=t,o=(0,v.HQ)(n,a,e=>({...(0,_.X7)(r,e,e=>({...e,label:l,value:i})),value:e.selectedOptionId===r?i:e.value,default:e.selectedOptionId===r?i:e.value}));return{...e,segment:o}}).on(K,(e,t)=>{let{segment:a}=e,{dialogTitle:n}=t,r=(0,v.D0)(a,n);return{...e,segment:r}}).on($,(e,t)=>{let{segment:a}=e,{reference:n=[]}=t,r=(0,v.P)(a,n);return{...e,segment:r}}).on(Q,(e,{value:t})=>{let{segment:a}=e;return{...e,segment:{...a,requiredContext:(0,r.A)([...a.requiredContext||[],..."string"==typeof t?[t]:t])}}}).on(Y,(e,{inputParameters:t,options:a})=>{let{segment:n}=e,r=(0,v.yS)(n).filter(e=>!!t?.find(({name:t})=>t===e.name)||!!a?.find(({key:t})=>t===e.name));return{...e,segment:(0,v.uG)(r,n)}}).on(X,(e,{isFunctionFormWrapped:t,experimentThirdPartyUserFormParityGroupOn:a})=>{let{segment:n}=e;return{...e,segment:(0,p.i)({...n,config:{...n.config,isFunctionFormWrapped:t}},void 0,a)}}).on(ee,(e,{selectedFunction:t})=>{let{segment:a}=e,n={...a,config:{...a.config,selectedSlackFunction:t}};return{...e,segment:n}}).on(et,(e,{isAddOrRemoveFormStep:t})=>{let{segment:a}=e,n={...a,config:{...a.config,isAddOrRemoveFormStep:t}};return{...e,segment:n}}),getSlackFunctionFormStepReducer=e=>applySlackFunctionFormStepReducerActions((0,x.GX)(C.y$,initializeSlackFunctionFormSegmentState))},0x2362a0a7b:(e,t,a)=>{"use strict";a.d(t,{T:()=>i});var n=a(0x242822dfb),r=a(0x1b05cc3ce),l=a(0x1806ce928);let i=(0,a(0x11c82607b).Ay)("Fetch dynamic options for input parameter",async(e,t,{parameter:a,segmentId:i,stepFunctionId:o,workflowId:s,callbackId:c,configuredInputs:d,triggerType:u})=>{let m=(0,n.hv)(a);if(!m||a.is_hidden||(0,r.M$)(a,d))return Promise.resolve();let p=(0,n.Bp)(m.inputs,d);return(0,n._Y)({parsedParameterValues:p,callbackId:c})?Promise.resolve():e((0,l.O)({function:m.function,stepFunctionId:o,workflowStepId:i,workflowId:s,hierarchicalParameterName:[a.name],inputs:p,triggerType:u,reason:"workflow_builder/get_dynamic_options"}))});i.meta={name:"fetchParameterDynamicOptions",key:"createThunkFetchParameterDynamicOptions",description:"Fetch dynamic options for input parameter"}},0xabd92c55:(e,t,a)=>{"use strict";a.d(t,{N8:()=>titleIsValid,c$:()=>f,cy:()=>b,y$:()=>g});var n=a(0x19e69f3e),r=a.n(n),l=a(0xbe0b63ff),i=a(0xec9d0658),o=a(0x1db887024),s=a(0xab1e931b),c=a(0x139a1172d),d=a(0xd0fb5338),u=a(0xaaa6bbd0),m=a(0x1bb29da6);let titleIsValid=({dialogTitle:e,maxLength:t})=>{let a=e.replace((0,i.A)(),"E").replace(r()(),"E").trim().length;return a>0&&a<=t};(0,c.g)("hasValidTitle",({segment:e})=>{let t=(0,d.F$)(e),a=(0,d.$o)(e);return(0,s.N8)({dialogTitle:t,maxLength:a})});let p=(0,c.g)("canDeleteQuestion",({segment:e})=>(0,d.yS)(e).length>1),b=(0,c.g)("canAddQuestion",({segment:e})=>{let t=(0,l.uz)(e.config.wrappedSlackFunction)?e.config.wrappedSlackFunction:void 0,a=(0,u.q2)(e)&&t?(0,u.Jl)(e,t,!1):void 0,n=(0,m.N)(e.config.wrappedSlackFunction?.input_parameters,a),r=n.length?Math.min(n.length,o.Rj):o.Rj;return(0,d.yS)(e).length<r}),f=(0,c.g)("questionsAreValid",({segment:e})=>{let t=(0,d.Gy)(e),a=(0,m.N)(e.config.wrappedSlackFunction?.input_parameters,void 0),n=(0,d.yS)(e).every(e=>(!a.length||!!a.find(({name:t})=>t===e.name))&&(0,s.fD)(e));return t>0&&t<=o.Rj&&n});(0,c.g)("isValid",(e,{hasValidTitle:t,questionsAreValid:a})=>t&&a);let g=[f,p,b,(0,c.g)("isValid",(e,{questionsAreValid:t})=>t)]},0x1817ab90d:(e,t,a)=>{"use strict";a.d(t,{$_:()=>createMultiClickPreviewBlock,A6:()=>createInteractivityConfiguration,AI:()=>isContinueButtonAdded,O0:()=>isContinueButton,fd:()=>areMultipleContinueButtonsAdded,hH:()=>getPreviewBlocks,j1:()=>getMenuButtons});var n=a(0x12edaa96a),r=a(0x1795d8821);function createMultiClickPreviewBlock(e){return{__meta__:{lastUpdatedTs:""},channel:"preview",type:"message",ts:"0",subtype:"",blocks:[{block_id:"workflow-builder-preview-button",elements:["workflow_button"===e.type?{...e,action_id:(0,n.A)(),workflow:{trigger:{url:"https://example.com",customizable_input_parameters:[]}}}:e],type:"actions"}]}}let getMenuButtons=({edit:e,remove:t,moreActions:a})=>{let n=[];if(t){let e="action_delete_btn";n.push({key:e,tooltip:t.tooltip,onClick:t.onClick,ariaLabel:t.ariaLabel,dataQa:e,dataId:e,svgIconProps:{name:"trash",size:"20"},className:t.className})}if(e){let t="action_edit_btn";n.push({key:t,tooltip:e.tooltip,onClick:e.onClick,ariaLabel:e.ariaLabel,dataQa:t,dataId:t,svgIconProps:{name:"edit",size:"20"},className:e.className})}if(a){let e="action_more_actions_btn";n.push({key:e,tooltip:a.tooltip,ariaLabel:a.ariaLabel,dataQa:e,dataId:e,svgIconProps:{name:"ellipsis-horizontal-filled",size:"20"},className:a.className,menuProps:a.menuProps})}return n},getPreviewBlocks=(e,t)=>{let a=[{type:"rich_text",block_id:"blockId-0",elements:[{type:"rich_text_section",elements:[{type:"text",text:t}]}]}];return a.push({type:"actions",block_id:"blockId-1",elements:e.map(e=>({type:"button",action_id:e?.action_id??(0,n.A)(),text:{type:"plain_text",text:e?.text?.text??"",emoji:!0},style:e?.style||"outline"}))}),a},createInteractivityConfiguration=(e,t,a,l)=>({actions:{[e||(0,n.A)()]:{is_button_multi_click:!l&&t!==r.oW.SendDm,is_mutually_exclusive:l},...a?.actions}}),isContinueButton=e=>!("url"in e||"workflow"in e),isContinueButtonAdded=e=>e.filter(isContinueButton).length>0,areMultipleContinueButtonsAdded=e=>e.filter(isContinueButton).length>1},0x2339a0d72:(e,t,a)=>{"use strict";a.d(t,{AR:()=>createBlockKitAction,OK:()=>createBlockKitActionButton,P6:()=>buttonsHaveDuplicateContinueLabels});var n=a(0x20482ad21),r=a(0x12edaa96a);let l=new n.Ay("workflow_builder"),createBlockKitAction=e=>({type:"actions",elements:e}),createBlockKitActionButton=(e,t,a)=>{let n={type:"button",text:{type:"plain_text",text:t??l.t("Continue"),emoji:!0},value:"button",action_id:(0,r.A)(),style:a??(e?void 0:"primary"),url:e?"":void 0};return void 0===n.url&&delete n.url,(void 0===n.style||void 0===a)&&delete n.style,n},buttonsHaveDuplicateContinueLabels=e=>e.some((t,a)=>e.slice(a+1).some(e=>t.type===e.type&&!("url"in t)&&!("url"in e)&&t.text.text===e.text.text))},0xc3116e8:(e,t,a)=>{"use strict";a.d(t,{Ji:()=>modifyObjectVariables,Km:()=>convertVariablesToPrimaryObjectFields,Xw:()=>doesTriggerConfigAllowExtraColumnInput,ZT:()=>convertParametersV2ToPrimaryObjectFields,dg:()=>stripObjectFromPrimaryObjectFieldLabel});var n=a(0x56e1c8ae);let r=/^([^>]*?)\s>\s([^>]*?)$/,l=/^([0-9]+?)_([0-9]+?)$/;function notEmpty(e){return null!=e}let convertVariablesToPrimaryObjectFields=e=>e.list.flatMap(e=>e.objectProperties?e.objectProperties.flatMap(e=>{let t;return t=`${e.name}`.match(l),t?.length===3?{id:+t[2],schemaObjectId:+t[1],label:e.label,type:e.type}:null}).filter(notEmpty):[]),convertParametersV2ToPrimaryObjectFields=e=>Object.values(e).flatMap(e=>e?Object.values(e.properties??[]).map(e=>{let t;return t=`${e.name}`.match(l),t?.length===3?{id:+t[2],schemaObjectId:+t[1],label:e.title??"No Label Found",type:e.type}:null}).filter(notEmpty)??[]:[])??[],stripObjectFromPrimaryObjectFieldLabel=e=>{let t=`${e}`.match(r);return t?.length===3?t[2]:e},i=/^[0-9]+?_[0-9]+?$/,o=/^[0-9]+?_[0-9]+?_[0-9]+?_[0-9]+?$/,modifyMatchingObjectPropertyVariables=(e,t)=>a=>{let n=a.objectProperties?.flatMap(a=>{if(a.isHidden&&e.some(e=>e.test(a.name))){let e=t(a);return e?[e]:[]}return a});return n?{...a,objectProperties:n}:a},modifyObjectVariables=(e,t)=>{let a=e.groups.map(e=>{let a=e.data.map(modifyMatchingObjectPropertyVariables([i,o],t));return{...e,data:a}});return{list:e.list.map(modifyMatchingObjectPropertyVariables([i,o],t)),groups:a}},doesTriggerConfigAllowExtraColumnInput=e=>(0,n.EP)(e.config)},0x1d67ca27f:(e,t,a)=>{"use strict";a.d(t,{Wt:()=>processExternalTriggerSegmentVariablesForStep,_V:()=>sortChildRecipientsForUI,g9:()=>s,r3:()=>modifyChildObjectVariables});var n=a(0x20482ad21),r=a(0x2172ff7ff);let l=/[0-9]+?_([0-9]+?)_([0-9]+?)_([0-9]+?)_([0-9]+?)_child$/,i=/[0-9]+?_([0-9]+?)_([0-9]+?_){3}child_multi$/,o=/[0-9]+?_([0-9]+?)_([0-9]+?_){5}child_multi$/,s=/Ft[A-Z0-9]*?__[0-9]+?_([0-9]+?)_([0-9]+?)_([0-9]+?)_([0-9]+?)_child/,c=new n.Ay("workflow_builder"),modifyChildObjectPropertyVariables=e=>t=>{let a=t.objectProperties?.flatMap(t=>{if(t.isHidden&&l.test(t.name)){let a=e(t);return a?[a]:[]}if(i.test(t.name)||o.test(t.name)){let e=c.t("{selectedDataLabel} (multiple)",{selectedDataLabel:t.label}).replaceAll("&gt;",">");return[{...t,label:e}]}return t});return a?{...t,objectProperties:a}:t},modifyChildObjectVariables=(e,t)=>{let a=e.groups.map(e=>{let a=e.data.map(modifyChildObjectPropertyVariables(t));return{...e,data:a}});return{list:e.list.map(modifyChildObjectPropertyVariables(t)),groups:a}},processExternalTriggerSegmentVariablesForStep=(e,t,a=!1)=>{let n=`${e?.value}`.match(s);return n?a?modifyChildObjectVariables(t,e=>{let t=e.name.match(l);return n[1]===t?.[1]&&n[3]===t?.[3]?{...e,isHidden:!1}:null}):modifyChildObjectVariables(t,e=>{let t=e.name.match(l);return n[1]===t?.[1]&&n[3]===t?.[3]?e:null}):modifyChildObjectVariables(t,e=>null)},labelPrefix=e=>{let t=e.label.indexOf(" >");return t>0?e.label.substring(0,t):e.label},sortByFirstPropLabel=(e,t)=>{let a=e.objectProperties&&e.objectProperties[0]?labelPrefix(e.objectProperties[0]):e.label,n=t.objectProperties&&t.objectProperties[0]?labelPrefix(t.objectProperties[0]):t.label;return(0,r.Ay)(a,n)},sortChildRecipientsForUI=e=>{let buildResult=t=>{let a={...e.groups[0]};a.data=t;let n=e.groups.slice(1);return n.unshift(a),{list:e.list,groups:n}};if(e.groups[0]){let t=e.groups[0].data,a=t.findIndex(e=>!e.name.includes("_")&&"metadata"!==e.name);if(a>=0){let e=t[a],n=t.slice(0,a).concat(t.slice(a+1));return n.sort(sortByFirstPropLabel).unshift(e),buildResult(n)}let n=[...t];return n.sort(sortByFirstPropLabel),buildResult(n)}return e}},0xead28e26:(e,t,a)=>{"use strict";a.d(t,{P:()=>SendSummaryToSalesHomeInputPreview});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x1f355b555),o=a(0x20482ad21),s=a(0x1d2cd7755),c=a(0x12cef2078),d=a(0xe9c32bb),u=a(0x23b93d6d0),m=a(0x1a5ac3a0c),p=a(0xc3116e8),b=a(0x6c06317c),f=a(0x56e1c8ae),g=a(0x126af815a),h=a(0x66c6b26d),_=a(0x20adb28cd),y=a(0x226892387),x=a(0x38c797fc),v=a.n(x);let E=new o.Ay("workflow_builder"),SendSummaryToSalesHomeInputPreview=({configuredParameters:e,isStepPreview:t,workflowId:a})=>{let r=((e,t)=>{let a;if(!t)return null;let n=(0,m.DU)(t),r=(0,m.BQ)(t),l=(0,m.eR)(t);if(l?.type!==g.SJ||(0,f.Fe)(l.config)||(0,f.SZ)(l.config))return null;let o=(0,b.h)(e),s=(0,i.Ay)(l.config.startTime),c=s.subtract(s.utcOffset(),"minute").unix().toString(),d=e?.notification_display_table_header?.value,u="string"==typeof d&&d?d:l.config.notificationHeader,h=t.trigger?.available_data,_=h?(0,p.ZT)(h):[],y=e?.notification_display_table_extra_column_field_id?.value,x=y?_.find(e=>e.id===y):null,v=x?{payload_field:`${x.id}`,name:(0,p.dg)(x.label),type:x.type,label:x.label}:null,E=v?[...l.config.columns,v]:l.config.columns;return{payload:{workflow:{title:r,icon_url:n,subtitle:u},generic_records:(a={},E.forEach(e=>{a[e.payload_field]={record_field_identifier:e.payload_field,record_field_label:e.label||e.name,record_field_rendered_value:""}}),[{object_identifier:"Object1",record_identifier:"Record1",record_link:"https://example.com/record1",record_name:"",record_fields:a},{object_identifier:"Object2",record_identifier:"Record2",record_link:"https://example.com/record2",record_name:"",record_fields:a}]),notification_type:"scheduled"},notification_type:"scheduled",created_ts:c,is_unread:!0,icon_url:n,body:o,is_acn:!1,notification_display_columns:E}})(e,(0,y.d4)((0,h.sx)(a,_.RG)));if(!r)return null;let o=E.t("This is how your notification will appear in Sales Home"),x=n.createElement(c.X,{noPointerEvents:!0},n.createElement(u.Z,{notification:r,hasFocus:!0,isFirst:!0,isWorkflowPreview:!0,isStepPreview:t}));return n.createElement("div",{className:l()({[v().input_preview]:t})},t?n.createElement(s.A,{text:E.t("Preview")},n.createElement(d.nB,null,o),x):x)};SendSummaryToSalesHomeInputPreview.displayName="SendSummaryToSalesHomeInputPreview"},0x1e271947d:(e,t,a)=>{"use strict";a.d(t,{nk:()=>N,JB:()=>I,ix:()=>M,XZ:()=>O,Qx:()=>P,qq:()=>w,Ox:()=>A,zb:()=>T,m0:()=>L,R:()=>C,aR:()=>D,T:()=>F,KR:()=>S});var n=a(0xe0376d2),r=a(0x1db69cda),l=a(0x125763ad),i=a(0xf77002c6),o=a(0x173d265bf),s=a(0x818fd090),c=a(0x1795b5c1b),d=a(0x242822dfb),u=a(0xb3a43d1e),m=a(0x1b05cc3ce),p=a(0x1ebe91b72),b=a(0x870b34a7),f=a(0x106f35107),g=a(0xa231133b),h=a(0xaaa6bbd0);let applyFormWrappedSchemaByName=({slackFunction:e,isFunctionFormWrapped:t,parameterName:a,propertyKey:n,checked:r})=>e?{...e,input_parameters:e.input_parameters?.map(e=>{if(a===e.name){if(!n)return{...e,isParameterFormWrapped:t&&r};if((0,d.sg)(e)&&e.properties){let a=e.properties;Object.keys(a).forEach(e=>{if(n===e){let n=(0,s.w)(a[e]);n.isParameterFormWrapped=t&&r,a[e]=n}})}return{...e,isParameterFormWrapped:t}}return e})}:e;var _=a(0x4cecf0f9),y=a(0x113e7abc2),x=a(0x252b4df6e),v=a(0x202470d56),E=a(0x7019ae94);let removeRegexMatchingTextFromValue=({value:e,regex:t})=>"string"==typeof e?e.replace(t,""):Array.isArray(e)?e.map(e=>removeRegexMatchingTextFromValue({value:e,regex:t})).filter(e=>!(0,E.$)(e)):"object"!=typeof e||(0,v.A)(e)?e:Object.entries(e).reduce((e,[a,n])=>("object"==typeof e&&"string"==typeof a&&(e[a]=removeRegexMatchingTextFromValue({value:n,regex:t})),e),{});var k=a(0x78a9d64e);let w=(0,b.W)("update configured parameter value"),S=(0,b.W)("validate input parameters with async calls"),C=(0,b.W)("update form wrapped configuration for parameter and key-value input by name"),A=(0,b.W)("update form configuration title"),T=(0,b.W)("update function variables"),I=(0,b.W)("converts the segment to be a form segment"),N=(0,b.W)("converts the form segment to be a segment"),M=(0,b.W)("returns the same segment without any form field references"),L=(0,b.W)("sets whether or not nested data is fetching"),O=(0,b.W)("Reset 3PUF step field references"),F=(0,b.W)("update segment dynamic inputs state"),D=(0,b.W)("update key-value parameter properties"),P=(0,g.GZ)((0,f.GX)(k.y$).on(w,(e,{parameter:t,value:a,label:n,options:r,experimentThirdPartyUserFormParityGroupOn:l})=>{let o,{segment:c}=e;return(o=null!==a||t.is_required?(0,x.bG)(c,t,a,n,r,l):(0,x.Xt)(c,t)).config.isFunctionFormWrapped&&(0,i.yw)(t)&&t.conditionalChildInputs?.forEach(e=>{let t=(0,x.iL)(o,e),a=!!t&&!(0,m.M$)((0,s.w)(t),(0,x.Iw)(o));o.config.slackFunction=applyFormWrappedSchemaByName({parameterName:e,slackFunction:o.config.slackFunction,checked:a,isFunctionFormWrapped:!0})}),{...e,segment:o}}).on(g.aI,(e,{value:t})=>{let{segment:a}=e;return{...e,segment:{...a,requiredContext:(0,n.A)([...a.requiredContext||[],..."string"==typeof t?[t]:t])}}}).on(S,(e,t)=>({...e,asyncValidation:{...e.asyncValidation,...t}})).on(C,(e,t)=>{let{segment:a}=e;return{...e,segment:{...a,config:{...a.config,slackFunction:applyFormWrappedSchemaByName({slackFunction:a.config.slackFunction,...t})}}}}).on(T,(e,t)=>{let{segment:a}=e;return{...e,segment:{...a,config:{...a.config,functionVariables:{...a.config.functionVariables,...t}}}}}).on(A,(e,{title:t})=>{let{segment:a}=e;return{...e,segment:{...a,config:{...a.config,formConfiguration:{...a.config.formConfiguration,title:{value:t}}}}}}).on(I,(e,{openFormSlackFunction:t})=>{let{segment:a}=e,n=(0,y.$)(a,t);return{...e,segment:n}}).on(N,(e,{wrappedFunction:t,experimentThirdPartyUserFormParityGroupOn:a})=>{let{segment:n}=e;if(!(0,h.q2)(n))return e;let r=(0,h.Dq)(n,t,a);return{...e,segment:r}}).on(M,e=>{let{segment:t}=e,a=(0,x.Iw)(t),n=(0,x.ln)(t),l=(0,d.ny)(n??[]),i=(0,x.B8)(t),s=Array.isArray(i?.fields?.value)?i.fields.value:i?.fields?.value.elements,c=s?.reduce((e,t)=>(e[t.name]=(0,_.G)(t),e),{}),u=Object.keys(a).reduce((e,t)=>{let n=(0,r.A)(a[t]);if((0,o.H)(n.value)){let{value:e,default:a}=c?.[t]??{};n.value=a??e??null}else if(l?.name===t&&(0,d.wK)(n.value,l)){let e=n.value;Object.keys(e).forEach(t=>{if((0,o.H)(e[t])){let{value:a,default:n}=c?.[t]??{};e[t]=n??a??null}})}return e[t]=n,e},{});return{...e,segment:{...t,config:{...t.config,inputs:u}}}}).on(L,(e,{isDataFetching:t})=>{let{segment:a}=e;return{...e,segment:{...a,config:{...a.config,isDataFetching:t}}}}).on(O,e=>{let{segment:t}=e,a=t.config.functionVariables?.formAvailableData?{...t.config.functionVariables,formAvailableData:void 0,variables:{list:t.config.functionVariables.variables?.list.filter(({id:e})=>!(0,o.H)(e))??[],groups:t.config.functionVariables.variables?.groups??[]}}:t.config.functionVariables,n=(0,x.Iw)(t),l=Object.keys(n).reduce((e,t)=>{let a=(0,r.A)(n[t]);return a.value=removeRegexMatchingTextFromValue({value:a.value,regex:(0,p.wm)()}),e[t]=a,e},{});return{...e,segment:{...t,config:{...t.config,inputs:l,functionVariables:a}}}}).on(F,(e,t)=>{let{segment:a}=e,n=(0,l.A)({},a.config.dynamicInputs,t);return{...e,segment:{...a,config:{...a.config,dynamicInputs:n}}}}).on(D,(e,{parameter:t,options:a=[]})=>{let{segment:n}=e,r=(0,c.g)(n,t,a.map(u.G));return{...e,segment:r}}))},0x1bb29da6:(e,t,a)=>{"use strict";a.d(t,{N:()=>getFormWrappableParameters});var n=a(0x1903d373d),r=a(0x818fd090),l=a(0x242822dfb),i=a(0x45cdfa9c);let getFormWrappableParameters=(e,t)=>e?(0,i.k)(e).reduce((e,a)=>{let i=(0,r.w)(a);if(!(0,n.AL)(i,t))return e;if((0,l.sg)(i)){let t=i.properties??{};return Object.keys(t).forEach(a=>{let l=(0,r.w)(t[a]);(0,n.AL)(l)&&e.push(l)}),e}return"object"!==i.type&&e.push(i),e},[]):[]},0x78a9d64e:(e,t,a)=>{"use strict";a.d(t,{CL:()=>V,Pl:()=>hasValidInputParameterValue,c$:()=>W,fx:()=>U,r:()=>z,y$:()=>et});var n=a(0x20b4dda68),r=a(0x2264e6ea3),l=a(0x1d5f57074),i=a(0xf77002c6),o=a(0x818fd090),s=a(0x23416a0b6),c=a(0x85ec090),d=a(0x476b122),u=a(0x242822dfb),m=a(0x11e7de8ad),p=a(0x1a3026429),b=a(0x1340d624e),f=a(0x7019ae94),g=a(0xbbd2a32d),h=a(0x2772625d),_=a(0x1b05cc3ce),y=a(0x1ebe91b72),x=a(0x139a1172d),v=a(0xd0fb5338),E=a(0xaaa6bbd0),k=a(0xabd92c55),w=a(0x2281fc25),S=a(0x2339a0d72),C=a(0x252b4df6e),A=a(0xb4375e8a),T=a(0x1de72b3d8),I=a(0x6e20c837),N=a(0x1795d8821),M=a(0x16ed1b0dc),L=a(0xa985ed31),O=a(0x4f725d55),F=a(0x50279ca3),D=a(0xd2fa49d0),P=a(0x2001af3ac),R=a(0xa5d8361b),B=a(0x24429189c);let W=30,V=1,hasValidInputParameterValue=(e,t)=>{if((!e.is_required||e.isParameterFormWrappable)&&(0,f.$)(t)||"string"==typeof t&&(0,h.cn)(t))return!0;switch(e.type){case N.TE.String:if((0,f.$)(t)||"string"!=typeof t)return!1;return(!e.minLength||t.length>=e.minLength)&&(!e.maxLength||t.length<=e.maxLength);case N.TE.Boolean:case N.TE.Object:case N.TE.SlackTypesBlocks:case N.TE.SlackTypesRichText:case N.TE.SlackTypesLimitedRichText:case N.TE.SlackTypesExpandedRichText:case N.TE.SlackTypesTimestamp:case N.TE.SlackTypesDate:case N.TE.SlackUserPermission:case N.TE.SlackTypesMessageContext:case N.TE.SlackTypesUserContext:case N.TE.SlackTypesInteractivity:case N.TE.SlackTypesSalesforceRecordId:return!(0,f.$)(t);case N.TE.Number:return(0,g.gf)(Number(t));case N.TE.Integer:return(0,g.zh)(Number(t));case N.TE.SlackTypesChannelId:return"string"==typeof t&&(0,M.A)(t);case N.TE.SlackTypesUserId:return"string"==typeof t&&(0,O.A)(t);case N.TE.SlackTypesUsergroupId:return"string"==typeof t&&(0,D.A)(t);case N.TE.SlackTypesCanvasId:case N.TE.SlackTypesChannelCanvasId:case N.TE.SlackTypesCanvasTemplateId:return"string"==typeof t&&(0,L.A)(t);case N.TE.SlackTypesTeamId:return"string"==typeof t&&(0,r.Ay)(t);case N.TE.SlackTypesFileId:return"string"==typeof t&&(0,L.A)(t);case N.TE.SlackTypesListId:if("string"!=typeof t)return!1;return(0,L.A)(t)||(0,m.B)(t);case N.TE.Array:{if(!Array.isArray(t)||!e.items)return!1;let a=e.items.type;if("slack#/types/dynamic_pair"===a||"slack#/types/mixed"===a)return!0;if((0,f.$)(t)||e.minItems&&t.length<e.minItems||e.maxItems&&t.length>e.maxItems)return!1;if(e.name===w.c.EXTERNAL_RESOURCES)return!0;let n={type:a,maxLength:"string"===a?e.items.maxLength:void 0,minLength:"string"===a?e.items.minLength:void 0};return t.every(e=>("string"==typeof e||"number"==typeof e||"boolean"==typeof e)&&hasValidInputParameterValue(n,e))}case N.TE.SlackTypesCredentialOauth2:{let e=t?.credential_source,a=t?.external_token_id;return!!e&&Object.values(N.x).includes(e)&&(!!a||e===N.x.END_USER)}case N.TE.SlackTypesDynamicPair:return!(0,f.$)(t.value);default:return!1}},hasRequiredValue=(e,t,a)=>{let n=t[e.name]?.value,r=[N.oW.CreateChannel,N.oW.CreateUsergroup];return e.type===N.TE.SlackTypesTeamId&&a&&r.includes(a)?!(0,f.$)(n):!!e.isParameterFormWrapped||((0,_.L$)(e)&&!(0,_.M$)(e,t)?!(0,f.$)(n):!e.is_required||!(0,f.$)(n))},H=(0,x.g)("hasRequiredValues",({segment:e})=>{let t=(0,C.Dl)(e),a=t?.input_parameters||[],n=t?.callback_id,r=(0,C.Iw)(e);return a.every(e=>hasRequiredValue((0,o.w)(e),r,n))}),q=(0,x.g)("hasValidInputValues",({segment:e})=>{let t=(0,C.Dl)(e),a=t?.input_parameters||[],n=(0,C.Iw)(e);return a.every(e=>{let t=n[e.name]?.value;return hasValidInputParameterValue(e,t)})}),U=(0,x.g)("hasMessageWithTooManyCharacters",({segment:e},t,a)=>{if(!a||!(0,s.G)(e))return!1;let r=(0,C.Dl)(e),l=r?.input_parameters||[],i=(0,C.Iw)(e);return l.some(e=>{if(e.type!==N.TE.SlackTypesRichText)return!1;let t=i[e.name]?.value;if(!Array.isArray(t))return!1;let r=a((0,B.f)({blocks:t}));return(0,P.A)(r)>n.nb})}),z=(0,x.g)("hasValidMessagePostedTrigger",({segment:e,isExcludesFromSpecificUsersFilterChecked:t})=>(0,T.IL)(e,t)),j=(0,x.g)("hasValidAppPinBuiltInMessage",({segment:e})=>{let t=(0,C.Dl)(e);if(t?.callback_id!==N.oW.AddPin&&t?.callback_id!==N.oW.RemovePin)return!0;let{message:{value:a}}=(0,C.Iw)(e);return"string"!=typeof a||!!(0,y.cL)().test(a)||(e=>{if((0,F.A)(e))return!0;if(!(0,R.A)(e))return!1;let{pathname:t}=(0,l.jY)(e);return!!t&&(0,I.Wm)(t.split("/")[1])===I.im.MESSAGE})(a)}),G=(0,x.g)("hasValidButtonConfiguration",({segment:e})=>{let t=(0,C.Dl)(e);if(t?.callback_id!==N.oW.SendMessage&&t?.callback_id!==N.oW.SendDm&&t?.callback_id!==N.oW.SendToMySalesHome&&t?.callback_id!==N.oW.SendToSalesHome&&t?.callback_id!==N.oW.SendToMySalesforceApp&&t?.callback_id!==N.oW.SendToSalesforceApp)return!0;let{interactive_blocks:{value:a=[]}={}}=(0,C.Iw)(e),n=a?.find(e=>"actions"===e.type),r=n?.elements||[];return 0===r.length||!(0,S.P6)(r)&&r.every(e=>{let t=e.text.text,a="string"==typeof t&&t.length>=V&&t.length<=W;return"url"in e?!!(a&&((0,R.A)(e.url)||(0,h.cn)(e?.url??""))):"workflow_button"===e.type?!!(a&&e?.workflow?.trigger?.url):a})}),$=(0,x.g)("hasValidCanvasSelected",({segment:e})=>{let t=(0,C.Dl)(e);if(t?.callback_id!==N.oW.UpdateCanvasContent&&t?.callback_id!==N.oW.UpdateCanvasContentV2&&t?.callback_id!==N.oW.UpdateCanvasVariables&&t?.callback_id!==N.oW.CreateCanvas&&t?.callback_id!==N.oW.CreateChannelCanvas&&t?.callback_id!==N.oW.ShareCanvas)return!0;let a=(0,C.Iw)(e);if([N.oW.UpdateCanvasContent,N.oW.UpdateCanvasContentV2,N.oW.UpdateCanvasVariables].includes(t?.callback_id)){let e=a.canvas_update_type?.value||d.s.Standalone;if(e===d.s.Standalone&&!a.canvas_id?.value||(e===d.s.ChannelCanvas||e===d.s.ChannelTab)&&!a.channel_id?.value||t?.callback_id===N.oW.UpdateCanvasContentV2&&e===d.s.ChannelTab&&a.channel_id?.value&&!a.canvas_tab?.value)return!1}else if([N.oW.CreateCanvas,N.oW.CreateChannelCanvas].includes(t?.callback_id)){if((a.canvas_create_type?.value||c.M.Blank)===c.M.Template&&!a.canvas_template_id?.value)return!1}else if([N.oW.ShareCanvas].includes(t?.callback_id)){let e=a.user_ids?.value,t=a.channel_ids?.value;if(!e?.length&&!t?.length)return!1}return!0}),K=(0,x.g)("hasValidAsyncChecks",({asyncValidation:e})=>Object.values(e??{}).every(Boolean)),Y=(0,x.g)("hasValidDynamicInputs",({segment:e})=>{let t=(0,C.Dl)(e),a=t?.input_parameters||[],n=(0,C.Iw)(e);return a.every(e=>{let t=(0,o.w)(e),a=n[t.name]?.value;return(0,p.u)(t,a)})}),Q=(0,x.g)("hasValidFormWrappedInputs",({segment:e})=>{if(!e.config.isFunctionFormWrapped)return!0;if(!(0,C.B8)(e))return!1;let t=(0,C.Dl)(e),a=t?.input_parameters||[],n=(0,v.F$)(e);return!!(0,k.N8)({dialogTitle:n,maxLength:(0,v.$o)(e)})&&a.some(e=>{if((0,u.sg)(e)){let t=e.properties;return!!t&&Object.keys(t).some(e=>{let a=t[e];return"isParameterFormWrapped"in a&&a.isParameterFormWrapped})}return e.isParameterFormWrapped})}),Z=(0,x.g)("hasValidParentInputValues",({segment:e})=>{let t=(0,E.Pv)(e),a=(0,C.P)(e),n=a?.callback_id,r=a?.input_parameters.filter(e=>(0,i.oO)(e)).map(o.w)??[],l=t&&a?(0,E.Jl)(e,a,!0):(0,C.Iw)(e);return r.every(e=>{let t=l[e.name]?.value;return!("string"==typeof t&&(0,h.MR)(t))&&hasRequiredValue(e,l,n)&&hasValidInputParameterValue(e,t)})}),J=(0,x.g)("hasValidUserFilter",({segment:e})=>{let t=(0,C.Dl)(e);if(t?.callback_id!==N.oW.SendToSalesHome)return!0;let a=(0,C.Iw)(e),n=a[b.XD.USER_FILTER]?.value;return!!(!n||"object"!=typeof n||Array.isArray(n))||!n.schema_field_id&&!n.type||(0,A.Un)(n)}),X=(0,x.g)("hasValidValues",(e,{hasValidInputValues:t,hasValidAppPinBuiltInMessage:a,hasValidButtonConfiguration:n,hasValidAsyncChecks:r,hasValidCanvasSelected:l,hasValidParentInputValues:i,hasValidUserFilter:o})=>t&&a&&n&&r&&l&&i&&o),ee=(0,x.g)("isValid",(e,{hasValidValues:t,hasRequiredValues:a,hasValidDynamicInputs:n,hasValidFormWrappedInputs:r})=>t&&a&&n&&r),et=[H,q,G,j,K,Y,$,Q,Z,J,k.cy,k.c$,X,ee]},0xbf22577d:(e,t,a)=>{"use strict";a.d(t,{n:()=>getSlackFunctionStepPreview});var n=a(0xbad225b5),r=a(0x93d35cfe),l=a(0x12cef2078),i=a(0x16bebefd8),o=a(0x96aa1794),s=a(0x1a5ac3a0c),c=a(0x68e1de73),d=a(0xd0fb5338);let SlackFunctionFormStepPreview=({segment:e})=>n.createElement(c.B,{dialogTitle:(0,d.F$)(e),questions:(0,d.yS)(e),showTitle:!0});SlackFunctionFormStepPreview.displayName="SlackFunctionFormStepPreview";var u=a(0x1d67ca27f),m=a(0xead28e26),p=a(0x252b4df6e),b=a(0x6c06317c),f=a(0x1795d8821);let BuiltInMessageStepPreview=({segment:e,data:t,previewOptions:a={}})=>{let{staticWorkflow:c,isPinned:d,isEditor:m}=a,g=(0,p.Iw)(e),h=(0,p.Dp)(e),_=(0,n.useMemo)(()=>h!==f.oW.SendToSalesHome&&h!==f.oW.SendToSalesforceApp?t.list:(0,u.Wt)(g.user_id,t).list,[h,g.user_id,t]),y=(0,o.j)(),x=c||y,v=(0,s.BQ)(x),E=(0,s.DU)(x),k=(0,i.Sp)(x)?"":(0,s.DY)(x),w=(0,b.h)(g);return n.createElement(l.X,{noPointerEvents:!0,isInert:!0},n.createElement(r.Y,{blocks:w,dataList:_,isThread:f.oW.ReplyInThread===h,isPinned:d,workflowName:v,workflowIcon:E,workflowId:k,isEditor:m}))};BuiltInMessageStepPreview.displayName="BuiltInMessageStepPreview";let getSlackFunctionStepPreview=(e,t,a,r)=>{let l=(0,p.Dp)(t),i=(0,p.Iw)(t);switch(l){case f.oW.ReplyInThread:case f.oW.SendDm:case f.oW.SendMessage:case f.oW.SendToMySalesHome:case f.oW.SendToSalesHome:case f.oW.SendToMySalesforceApp:case f.oW.SendToSalesforceApp:case f.oW.SendToRecordChannel:case f.oW.SendEphemeralMessage:return n.createElement(BuiltInMessageStepPreview,{segment:t,data:a,previewOptions:r});case f.oW.OpenForm:return n.createElement(SlackFunctionFormStepPreview,{segment:t});case f.oW.SendSummaryToMySalesHome:case f.oW.SendSummaryToSalesHome:return n.createElement(m.P,{workflowId:e,configuredParameters:i});default:return null}};getSlackFunctionStepPreview.displayName="getSlackFunctionStepPreview"},0x6c06317c:(e,t,a)=>{"use strict";a.d(t,{h:()=>getPreviewBlocks});var n=a(0x21f3c49e8),r=a(0x1db69cda);let l=new(a(0x20482ad21)).Ay("workflow_builder"),getPreviewBlocks=e=>{let t=e.message?.value,a=(0,n.A)(t)?[{type:"rich_text",elements:[{type:"rich_text_section",elements:[{type:"text",text:l.t("Hello!")}]}]}]:(0,r.A)(t),i=e.interactive_blocks?.value,o=i?.find(e=>"actions"===e.type);if(o){let e={...o};e.block_id="workflow-builder-preview-actionblock",e.elements=e.elements.map(e=>"workflow_button"===e.type?{...e,action_id:"test",workflow:{trigger:{url:"https://example.com",customizable_input_parameters:[]}}}:{...e}),a.push(e)}return a}},0x21c792378:(e,t,a)=>{"use strict";a.d(t,{Bl:()=>getOperatorLabel,Qq:()=>buildVarNameToPrependLabelMap,ie:()=>buildTargetSelectOptions,tB:()=>getOperatorsForVariableType,yw:()=>valueOrValueArrayIsEligible});var n=a(0x20482ad21),r=a(0x13cd04b48),l=a(0x210eb9aa7),i=a(0x1795d8821),o=a(0x2a3fb7ec);let s=new n.Ay("workflow_builder"),c=[i.TE.SlackTypesDate,i.TE.SlackTypesTimestamp];function variableIsEligible(e,t){return!!e.isAvailable&&[i.TE.Array,i.TE.Boolean,i.TE.Integer,i.TE.Number,i.TE.String,i.TE.SlackTypesCanvasId,i.TE.SlackTypesChannelId,i.TE.SlackTypesDate,i.TE.SlackTypesLimitedRichText,i.TE.SlackTypesListId,i.TE.SlackTypesMessageContext,i.TE.SlackTypesRichText,i.TE.SlackTypesTimestamp,i.TE.SlackTypesUserId,i.TE.SlackTypesUsergroupId,...t?[i.TE.SlackTypesCanvasTemplateId,i.TE.SlackTypesTeamId]:[]].includes(e.type)}function valueOrValueArrayIsEligible(e){return Array.isArray(e)?e.every(valueIsEligible):valueIsEligible(e)}function valueIsEligible(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||"object"==typeof e&&!!e&&!Array.isArray(e)&&"type"in e&&"rich_text"===e.type||null==e}function getOperatorLabel(e,t){switch(e){case l.UT:return s.t("equals");case l.vz:if((0,o.X)(c,t))return s.t("is after");return s.t("is greater than");case l.iH:if((0,o.X)(c,t))return s.t("is before");return s.t("is less than");case l.k1:if((0,o.X)(c,t))return s.t("is on or after");return s.t("is greater than or equal to");case l.V_:if((0,o.X)(c,t))return s.t("is on or before");return s.t("is less than or equal to");case l.sz:case l.Lr:return s.t("contains");case l.Hh:case l.m:return s.t("does not contain");case l.mh:return s.t("is not equal to");case l.zG:return s.t("is empty");case l.tC:return s.t("is not empty");case l.io:return s.t("contains all of");case l.$:return s.t("contains any of");case l.Rh:return s.t("contains only");case l.aQ:return s.t("does not contain any of");default:return""}}let getOperatorsForVariableType=(e,t)=>{if(e){if(e===i.TE.Array&&t===i.TE.SlackTypesFileId)return l.bK;let a=l.fG[e];if(a)return a}return[]},buildVarNameToPrependLabelMap=e=>{let t={};for(let a of e)t[a.name]=a.prependLabel||"";return t},buildTargetSelectOptions=({stepData:e,expressionData:t,experimentWfbConditionalBranchingNewTypesGroupOn:a})=>{let n=(0,r.SD)(t),l=[],o=e.groups.reduce((e,t)=>{let o,{id:s,data:c,label:d,stepIndex:u}=t,m=(o=(e,t)=>{if(!t.isHidden&&variableIsEligible(t,a)&&e.push({label:t.label,value:t.id,key:`${t.id}`,extras:{data:t}}),t.type===i.TE.Object&&t.objectProperties){let a=t.objectProperties.reduce(o,[]);e.push(...a)}return e},c.reduce(o,[])),p=n&&n[s],b=u?`${u}. ${d}`:d;if(p){let e=((e,t,a)=>{let n=[],l="";for(let o of e){let{id:e,reference:s}=o;if(!e||!s)continue;let c=(0,r.w)(s);l!==c&&n.push({label:t[c],value:"",isDisabled:!0,nonInteractive:!0}),l=c;let d=s.replace(/\.\d+?\.block_id}}$/,"}}"),u=a.find(e=>e.id===d)?.type===i.TE.SlackTypesRichText,m=(0,r.DJ)({expressionDataObject:o,isUnsupportedRichTextDropdownType:u});n.push({label:m,value:e,key:e,extras:{data:{...o,label:m}},isDisabled:u})}return n})(p,buildVarNameToPrependLabelMap(c),c);l.push({label:b,value:"",nonInteractive:!0,isDisabled:!0}),l.push(...e)}return 0!==m.length&&e.push({label:b,options:m,value:s}),e},[]);return[...0!==l.length?[{label:s.t("Recommended"),value:"",options:l}]:[],...o]}},0x18608b0ec:(e,t,a)=>{"use strict";a.d(t,{Iv:()=>u,Mz:()=>b,Oy:()=>g,VO:()=>m,Wf:()=>x,_d:()=>p,aI:()=>f,gA:()=>v,hx:()=>_,sn:()=>h,uI:()=>d,xq:()=>y});var n=a(0xe0376d2),r=a(0x1ebe91b72),l=a(0x870b34a7),i=a(0x106f35107),o=a(0x210eb9aa7),s=a(0x20d4168fd),c=a(0x205de9db);let d=(0,l.W)("initiate expression"),u=(0,l.W)("update selected target"),m=(0,l.W)("update selected operator"),p=(0,l.W)("update selected value"),b=(0,l.W)("update additional context with list info, this is needed on the BE for 3puf list variables to parse option IDs"),f=(0,l.W)("update required context needed by step configuration"),g=(0,l.W)("set fallback is selected"),h=(0,l.W)("set branch name"),_=(0,l.W)("validate input parameters with async calls"),y=(0,l.W)("set the target variable's type for segment validation"),x=(0,l.W)("set branch color"),v=(0,i.GX)(c.y$).on(d,e=>{let{segment:t}=e;return{...e,segment:{...t,config:{...t.config,isFallback:!1},displayConfig:{...t.displayConfig,color:o.fQ}}}}).on(u,(e,{selectedTarget:t,selectedTargetVariable:a})=>{let{segment:n}=e,l=(0,s.C9)(n),i=(0,r.h0)().test(t),o={...l,target:t},c=a?{target:{value:a.id}}:void 0;return i&&(delete o.operator,delete o.value),{...e,segment:{...n,config:{...n.config,isFallback:!1,expression:{version:1,root:{statement:o}}},targetVariable:a,inputs:c}}}).on(m,(e,{selectedOperator:t})=>{let{segment:a}=e,n=(0,s.C9)(a);return{...e,segment:{...a,config:{...a.config,isFallback:!1,expression:{version:1,root:{statement:{...n,operator:t}}}}}}}).on(p,(e,{selectedValue:t,selectedLabel:a})=>{let{segment:n}=e,r={...(0,s.C9)(n),value:t,label:a};return(null==t||""===t)&&(delete r.label,delete r.value),void 0===a&&delete r.label,{...e,segment:{...n,config:{...n.config,isFallback:!1,expression:{version:1,root:{statement:r}}}}}}).on(b,(e,{listId:t,columnId:a})=>{let{segment:n}=e,r={...(0,s.C9)(n)},l={};return t&&(l.list_id=t),a&&(l.column_id=a),r.additional_context=l,t||a||delete r.additional_context,{...e,segment:{...n,config:{...n.config,isFallback:!1,expression:{version:1,root:{statement:r}}}}}}).on(f,(e,{value:t})=>{let{segment:a}=e;return{...e,segment:{...a,requiredContext:(0,n.A)([...a.requiredContext||[],..."string"==typeof t?[t]:t])}}}).on(g,(e,{isFallback:t})=>{let{segment:a}=e;return{...e,segment:{...a,config:{...a.config,isFallback:t,expression:t?void 0:a.config.expression}}}}).on(h,(e,{name:t})=>{let{segment:a}=e;return{...e,segment:{...a,config:{...a.config,name:t}}}}).on(_,(e,t)=>{let{segment:a}=e;return{...e,segment:{...a,asyncValidation:{...e.asyncValidation,...t}}}}).on(y,(e,{targetVariable:t})=>{let{segment:a}=e;return{...e,segment:{...a,targetVariable:t}}}).on(x,(e,{color:t})=>{let{segment:a}=e;return{...e,segment:{...a,displayConfig:{...a.displayConfig,color:t}}}})},0x205de9db:(e,t,a)=>{"use strict";a.d(t,{CX:()=>isStandAloneOperator,y$:()=>c,zc:()=>isStandAloneTarget});var n=a(0xec9d0658),r=a(0x1ebe91b72),l=a(0x139a1172d),i=a(0x78a9d64e),o=a(0x210eb9aa7),s=a(0x20d4168fd);let isStandAloneTarget=e=>(0,r.h0)().test(e),isStandAloneOperator=e=>o.EF.has(e),c=[(0,l.g)("hasValidValues",({segment:e})=>{let t=(0,s.C9)(e),{targetVariable:a}=e,{hasValidTarget:n}=e.asyncValidation||{},{isFallback:r}=e.config,{target:l,operator:o,value:c}=t||{},d=a&&void 0!==c&&(0,i.Pl)({type:a.type,items:{type:a.items?.type},is_required:!0},c),u=l&&o&&d,m=l&&isStandAloneTarget(l),p=l&&o&&isStandAloneOperator(o);return!!(r||n&&(u||m||p))}),(0,l.g)("hasValidBranchName",({segment:e})=>{let{name:t}=e.config;return!t||!t.length||t.replace((0,n.A)(),"1").length<=100}),(0,l.g)("isValid",(e,{hasValidValues:t,hasValidBranchName:a})=>t&&a)]},0x75b1e64d:(e,t,a)=>{"use strict";a.d(t,{B:()=>SwitchSummary});var n=a(0xbad225b5),r=a(0x120c268ad),l=a.n(r),i=a(0x5359476e),o=a(0x1cbdfeceb),s=a(0x20482ad21),c=a(0x1fd3f6e20),d=a(0x1fdec3e16),u=a(0x222a04717),m=a(0x1312f060e),p=a(0x668181b3),b=a(0x2772625d),f=a(0x96aa1794),g=a(0x13cd04b48),h=a(0x20a2a54fa),_=a(0x1a5ac3a0c),y=a(0x21c792378),x=a(0x20d4168fd),v=a(0x154dd8295),E=a(0x247cf31a2),k=a(0x1346d4ed0),w=a(0xf4097f62),S=a(0x213c0555e),C=a(0x93f78b39),A=a(0x1b3ecb90f),T=a(0x15a4ffb05),I=a(0x42654967),N=a(0x1795d8821),M=a(0x6960d8b9),L=a(0x254e93e7),O=a.n(L);let F=new s.Ay("workflow_builder"),SwitchSummary=({segment:e,templateExpressionData:t})=>{let{list:a}=(0,h.EM)(e),r=(0,g.Ox)()??t,i=(0,f.j)(),o=(0,n.useMemo)(()=>i?.workflow.steps??[],[i]),s=(0,v.Yc)(e),m=(0,x.C9)(e),b=(0,x.At)(e),E=(0,_.W0)(e.id,i),k=m?.target?(0,p.x)(a,m.target):void 0,w=r&&m?.target&&r[m.target],S=!k&&!w,C=(0,n.useMemo)(()=>{let e,t=F.t("Missing Data"),r="";m?.target&&(k&&(t=k?.label,e=k.type),w)&&(r=(0,y.Qq)(a)[(0,g.w)(w?.reference)],t=(0,g.DJ)({expressionDataObject:w}),e=w.type);let l=n.createElement("span",{className:S?O().missing_data:""},n.createElement(u._,{type:e}),t&&n.createElement(T.A,{text:t})),i=n.createElement("span",null,r);return r?F.rt("{targetLabelElement} from {referenceLabelElement}",{targetLabelElement:l,referenceLabelElement:i}):l},[m?.target,w,S,a,k]),I=(0,n.useMemo)(()=>m?.operator?n.createElement("span",null,(0,y.Bl)(m.operator,k?.type)):"",[m?.operator,k?.type]),N=(0,n.useMemo)(()=>deriveValueToDisplay(m,a,k)??"",[m,a,k]),M=(0,n.useMemo)(()=>{let t=(0,_.B5)(e.id,o),a=convertBranchColorToTagStyle((0,x.K1)(e),E);return n.createElement("div",null,n.createElement("div",{className:O().branch_header},n.createElement(c.v,{style:a,isMicro:!0},n.createElement(d.A,{lines:1,withTooltip:!0},!!t&&n.createElement("span",{className:"margin_right_25"},F.t("Branch {index}.",{index:t,fallbackHash:"234c28ea605029faff767aa5c00d652776a209f4"})),n.createElement(T.A,{text:b,emojiSize:A.lw.SMALL}))),m?n.createElement("span",{className:l()(O().branch_expression,O().statement_container)},F.rt("If {target} {operator} {value}",{target:C,operator:I,value:N})):F.t("FALLBACK")))},[b,m,E,I,e,C,N,o]);return s?n.createElement("span",null,n.createElement(T.A,{text:F.t("Branch workflow"),emojiSize:A.lw.SMALL}),n.createElement("span",{className:O().switch_caption},F.t("(first matching branch will run)",{fallbackHash:"0d35d89f29fe5c2d2c521a719e4ac92002831468"}))):M};function convertBranchColorToTagStyle(e,t){if(!e||"gray"===e)return t?void 0:c.u.Gray;switch(e){case"gray":default:return c.u.Gray;case"tomato":case"paprika":return c.u.Flamingo;case"sunflower":return c.u.Honeycomb;case"jade":return c.u.Jade;case"indigo":return c.u.Indigo;case"lagoon":return c.u.Lagoon}}function deriveValueToDisplay(e,t,a){return e?.value?Array.isArray(e?.value)?n.createElement(n.Fragment,null,(0,i.A)(e?.value,(e,t,a)=>a.length-1!==t?[e,F.t(", ")]:e).map((n,r)=>deriveSingleValueToDisplay(n,e?.label,t,a,r)??"")):n.createElement(n.Fragment,null,deriveSingleValueToDisplay(e?.value,e?.label,t,a)??""):null}function deriveSingleValueToDisplay(e,t,a,r,l){if(!e)return null;let i=void 0!==l,s=r?.type===N.TE.SlackTypesLimitedRichText||r?.type===N.TE.SlackTypesRichText,c=i&&!s?r?.items?.type:r?.type,d=l??0;if("string"==typeof e&&(0,b.cn)(e)){let t=(0,p.x)(a,e),r=t?.label??F.t("Missing Data");return n.createElement("span",{key:`${d}-${t?.id??"missing-data"}`},n.createElement(u._,{type:c})," ",r)}if(!(i&&l%2==1)){if(r&&c===N.TE.SlackTypesChannelId&&"string"==typeof e)return n.createElement(E.A,{channelId:e,key:`${d}-${e}`});if(r&&c===N.TE.SlackTypesUserId&&"string"==typeof e)return n.createElement(w.A,{id:e,key:`${d}-${e}`});if(r&&c===N.TE.SlackTypesUsergroupId&&"string"==typeof e)return n.createElement("span",{className:O().inline,key:`${d}-${e}`},n.createElement(S.A,{id:e}));if(r&&c===N.TE.SlackTypesTimestamp&&"string"==typeof e)return n.createElement("span",{className:O().inline,key:`${d}-${e}`},(0,M.Yq)(e,"{date_pretty}"),(0,M.Yq)(e," {time}"));if(r&&c===N.TE.SlackTypesDate&&"string"==typeof e)return n.createElement("span",{className:O().inline,key:`${d}-${e}`},(0,M.Yq)((0,I.cU)(e),"{date_pretty}"));if(r&&(c===N.TE.SlackTypesCanvasId||c===N.TE.SlackTypesListId)&&"string"==typeof e)return n.createElement("span",{className:O().inline,key:`${d}-${e}`},n.createElement(k.A,{id:e,shouldShowHighlight:!1,shouldShowDetailText:!1}));if(r&&(c===N.TE.SlackTypesLimitedRichText||c===N.TE.SlackTypesRichText)&&"object"==typeof e){let t=e?.elements?.[0];if(!(0,m.B)(t)||!t.elements)return null;let a=e.type;return n.createElement("div",{className:"p-block-kit-select_options",key:`${a}-${d}`},n.createElement(C.A,{type:a,elements:t.elements,disableHighlights:!1,inline:!0,clogLinkClick:o.A,noInlineLinks:!0,alwaysDisplayMentionsAsLinks:!0,disableJumboEmoji:!0}))}}let f="";return f="string"==typeof e?n.createElement(T.A,{key:`${d}-${e}`,text:e}):"object"==typeof e?"":"boolean"==typeof e?e?F.t("Yes"):F.t("No"):e,t??f}SwitchSummary.displayName="SwitchSummary",deriveSingleValueToDisplay.displayName="deriveSingleValueToDisplay"},0xf3dd4cf5:(e,t,a)=>{"use strict";a.d(t,{Q:()=>TriggerFilterCondition});var n=a(0xbad225b5),r=a(0x20482ad21),l=a(0x2b7f0bcc),i=a(0x2172ff7ff),o=a(0x1d1911997),s=a(0xaf63c01f),c=a(0x17178b190),d=a(0x145d46a61),u=a(0x226892387),m=a(0x1595c7430),p=a.n(m);let b=new r.Ay("workflow_builder"),FilterConditionField=({handleChangeField:e,condition:t,fields:a,fieldsLoading:r,isWrapped:l,disabled:m=!1})=>{let{schema_field_id:f}=t,g=(0,n.useRef)(null),h=(0,u.d4)(d._1),_=(0,s.h)({fields:a,selectedFieldId:f}),y=(0,n.useCallback)(({value:t})=>{t!==f&&e(t)},[f,e]),x=(0,n.useMemo)(()=>a.filter(e=>e.isActive).map(e=>{if(e.type===c.kY.ReferenceSchemaField){let t=e.relationships?.find(e=>e.isActive);return{label:t?.relationshipLabel??t?.relationshipName??e.label,value:e.id}}return{label:e.label,value:e.id}}).sort((e,t)=>(0,i.Ay)(e.label,t.label)),[a]),v=h?_:x,E=(0,n.useMemo)(()=>v.find(e=>e.value===f),[v,f]),k=(0,n.useMemo)(()=>v.map(({value:e})=>e).join("_"),[v]);return n.createElement("div",{className:l?p().conditionContainer__fieldWrap:p().conditionContainer__field},n.createElement(o.Ay,{key:E?.value??k,isLoading:r,isDisabled:m,selectId:"conditionField",options:v,placeholderText:b.t("Select field\u2026"),ariaLabel:b.t("Field"),width:"100%",onOptionSelected:y,selectedOption:E,showDropdownIcon:!0,inputRef:g,shouldAllowUnselectInSingleSelectMode:!1}))};FilterConditionField.displayName="FilterConditionField";var f=a(0x15dd8a31);let g=new r.Ay("workflow_builder"),FilterConditionOperator=({operators:e,handleChangeOperator:t,selectedOperator:a,disabled:r,fieldId:l,isWrapped:o})=>{let s=g.t("And"),d=g.t("Or"),u=g.t("contains"),m=g.t("is"),b=g.t("is later than"),h=g.t("is earlier than"),_=g.t("does not contain"),y=g.t("does not equal"),x=g.t("ends with"),v=g.t("is equal to"),E=g.t("is greater than"),k=g.t("is empty"),w=g.t("is not empty"),S=g.t("is less than"),C=g.t("is exactly all of"),A=g.t("is not exactly all of"),T=g.t("starts with"),I=(0,n.useMemo)(()=>({[c.lt.AndFilterCondition]:s,[c.lt.OrFilterCondition]:d,[c.lt.ContainsFilterCondition]:u,[c.lt.DateOffsetEqualsFilterCondition]:m,[c.lt.DateOffsetGreaterThanFilterCondition]:b,[c.lt.DateOffsetLessThanFilterCondition]:h,[c.lt.DoesNotContainFilterCondition]:_,[c.lt.DoesNotEqualFilterCondition]:y,[c.lt.EndsWithFilterCondition]:x,[c.lt.EqualsFilterCondition]:v,[c.lt.GreaterThanFilterCondition]:E,[c.lt.IsEmptyFilterCondition]:k,[c.lt.IsNotEmptyFilterCondition]:w,[c.lt.LessThanFilterCondition]:S,[c.lt.SetEqualsFilterCondition]:C,[c.lt.SetNotEqualsFilterCondition]:A,[c.lt.StartsWithFilterCondition]:T}),[s,d,u,m,b,h,_,y,x,v,E,k,w,S,C,A,T]),N=(0,n.useCallback)(({value:e})=>{t(e)},[t]),[M,L]=(0,n.useMemo)(()=>[e.map(e=>({value:e,label:I[e]})).sort((e,t)=>(0,i.Ay)(e.label,t.label)),e.join("-")+l],[I,e,l]),O=(0,n.useMemo)(()=>M.find(({value:e})=>e===a),[a,M]);return n.createElement("div",{className:o?p().conditionContainer__operatorWrap:p().conditionContainer__operator},n.createElement(f.A,{key:L,isDisabled:r,options:M,selectId:"conditionOperator",onOptionSelected:N,placeholderText:g.t("Select operator\u2026"),selectedOption:O,width:"100%",ariaLabel:g.t("Operator")}))};FilterConditionOperator.displayName="FilterConditionOperator";var h=a(0x56e1c8ae);let FilterConditionTargetValue=({field:e,handleChangeRhs:t,condition:a,InputComponent:r,isWrapped:l,maxItems:i,isDisabled:o=!1})=>{let{type:s}=a,d=(0,n.useCallback)((a,n)=>{t((Array.isArray(a)?a:[a]).map(t=>{let a=(0,h.Kr)(e?.type);if(n)return{value:t,type:a,isError:n};switch(a){case"DoubleNumber":case"LongInt":return{value:Number(t),type:a,isError:n};case"BooleanValue":return{value:"false"!==t&&!!t,type:a,isError:n};default:return{value:String(t),type:a,isError:n}}}))},[e?.type,t]),u=(0,n.useCallback)(e=>{let a=!!(i&&e.length>i);t(e.map(e=>({...e,type:c.Yf.ReferenceValue,isError:a})))},[t,i]),m=(0,n.useCallback)(e=>{t(e)},[t]);return!e||!s||(0,h.jF)(s)?null:n.createElement(r,{condition:a,field:e,handleChangeValue:d,handleChangeReferenceValue:u,handleChangeDateOffsetValue:m,isWrapped:l,maxItems:i,isDisabled:o})};FilterConditionTargetValue.displayName="FilterConditionTargetValue";var _=a(0x1cb9794d5),y=a(0x6a40f0b8),x=a(0x126f22530),v=a(0x15014e268);let E={type:"divider",value:void 0,label:void 0},k="TODAY",w="StartOf",S="EndOf",C=new r.Ay("workflow_builder"),getTodayOption=e=>({value:k,label:e?C.t("today"):"today"}),getBeforeOption=e=>({value:c.ZH.Before,label:e?C.t("day(s) before"):"day(s) before"}),getAfterOption=e=>({value:c.ZH.After,label:e?C.t("day(s) after"):"day(s) after"}),getStartOfOption=e=>({value:w,label:e?C.t("start of"):"start of"}),getEndOfOption=e=>({value:S,label:e?C.t("end of"):"end of"}),A=new r.Ay("workflow_builder"),getTodayTimePeriodOption=e=>({label:e?A.t("Today"):"Today",value:k}),getTimePeriodOptions=e=>[getTodayTimePeriodOption(e),E,{label:e?A.t("Previous Month"):"Previous Month",value:[c.yO.Previous,c.Wq.Month]},{label:e?A.t("This Month"):"This Month",value:[c.yO.Current,c.Wq.Month]},{label:e?A.t("Next Month"):"Next Month",value:[c.yO.Next,c.Wq.Month]},E,{label:e?A.t("Previous Quarter"):"Previous Quarter",value:[c.yO.Previous,c.Wq.FiscalQuarter]},{label:e?A.t("This Quarter"):"This Quarter",value:[c.yO.Current,c.Wq.FiscalQuarter]},{label:e?A.t("Next Quarter"):"Next Quarter",value:[c.yO.Next,c.Wq.FiscalQuarter]},E,{label:e?A.t("Previous Fiscal Year"):"Previous Fiscal Year",value:[c.yO.Previous,c.Wq.FiscalYear]},{label:e?A.t("This Fiscal Year"):"This Fiscal Year",value:[c.yO.Current,c.Wq.FiscalYear]},{label:e?A.t("Next Fiscal Year"):"Next Fiscal Year",value:[c.yO.Next,c.Wq.FiscalYear]}],isCompositeValueTimePeriodOption=e=>Array.isArray(e.value);var T=a(0x4e697bfb),I=a(0x207fb9b92),N=a(0x8b7c8ca6),M=a.n(N);let L=new r.Ay("workflow_builder"),O="TODAY",F="DAYS_BEFORE",D="DAYS_AFTER",FilterConditionDateOffsetTargetValueInputOld=({value:e,label:t,onChange:a,required:r})=>{let l=(0,n.useMemo)(()=>[{value:O,label:L.t("today")},{value:F,label:L.t("day(s) before today")},{value:D,label:L.t("day(s) after today")}],[]),i=(0,n.useMemo)(()=>void 0===e?null:Math.abs(e),[e]),o=(0,n.useMemo)(()=>void 0===e?null:Math.sign(e),[e]),s=(0,n.useMemo)(()=>{let e=(e=>{switch(e){case 0:return O;case -1:return F;case 1:return D;default:return null}})(o);return l.find(t=>t.value===e)},[l,o]),c=(0,n.useCallback)(e=>a((o||0)*(Number(e)||1)),[a,o]),d=(0,n.useCallback)(e=>{a((e=>{switch(e){case O:return 0;case F:return -1;case D:return 1;default:return 0}})(e.value)*(i||1))},[a,i]),{errorText:u,onBlur:m}=(0,I.K)({errorMessage:"error",isErrored:!!r&&!s,shouldErrorPreventSave:!0}),b=(0,n.useMemo)(()=>{let e=[];return u&&e.push({id:"ITEMS_REQUIRED",message:L.t("This field is required.")}),e},[u]);return n.createElement("div",{className:p().filterConditionDateOffsetTargetValue},o?n.createElement(x.A,{"aria-label":t,value:i,onChange:c,placeholder:L.t("Enter a value\u2026"),type:"number",min:1,max:1/0,id:"filter-condition-form-date-offset-magnitude__input",name:"filter-condition-form-date-offset-magnitude__input"}):null,n.createElement(v.Ay,{options:l,selectedOption:s??null,onOptionSelected:d,placeholderText:L.t("Select a date range\u2026"),isRequired:r,errors:b,onBlur:m,selectDataQa:"filter-condition-form-date-offset__input"}))};FilterConditionDateOffsetTargetValueInputOld.displayName="FilterConditionDateOffsetTargetValueInputOld";let FilterConditionDateOffsetTargetValueInput=({rhs:e,label:t,onChange:a,onChangeRhs:r,required:l,experimentTroopsTimePeriodFilterConditionsGroupOn:i,isDisabled:o=!1})=>{let s,d,u,m,p=e?.value===void 0?1:Math.abs(Number(e.value)),[b,f]=(0,n.useState)(p),g=(s=e?.time_period?.position?.type,d=Number(e?.value),s||0!==d?0===d&&s===c.ZH.Before?getStartOfOption(i):0===d&&s===c.ZH.After?getEndOfOption(i):d<0||s===c.ZH.Before?getBeforeOption(i):d>0||s===c.ZH.After?getAfterOption(i):void 0:getTodayOption(i)),[h,_]=(0,n.useState)(g),y=(u=e?.time_period?.period_reference?.type,m=e?.time_period?.period_type?.type,getTimePeriodOptions(i).filter(isCompositeValueTimePeriodOption).find(e=>e.value[0]===u&&e.value[1]===m)||getTodayTimePeriodOption(i)),[x,C]=(0,n.useState)(y),A=(0,n.useCallback)(({nextMagnitude:e,nextPosition:t,nextTimePeriod:n})=>{let l=e??b,i=t?.value||h?.value,o=n||x;if(!i)return;if(i===k)return void a(0);let s=i===c.ZH.Before?-l:i===c.ZH.After?l:i===w||i===S?0:l;if(o.value===k)return void a(s);if(!isCompositeValueTimePeriodOption(o))return;let[d,u]=o.value;r([{type:c.Yf.TimePeriodOffset,isError:!1,value:s,time_period:{period_type:{type:u},period_reference:{type:d,...d!==c.yO.Current&&{periods:1}},position:{type:i===w?c.ZH.Before:i===S?c.ZH.After:i}}}])},[b,h?.value,x,r,a]),N=(0,n.useCallback)(e=>{e<1||e>999||(f(e),A({nextMagnitude:e}))},[A]),O=(0,n.useCallback)(e=>{e.value&&(_(e),0===b?(f(1),A({nextPosition:e,nextMagnitude:1})):A({nextPosition:e}))},[A,b]),F=(0,n.useCallback)(e=>{(isCompositeValueTimePeriodOption(e)||e.value===k)&&(C(e),A({nextTimePeriod:e}))},[A]),{errorText:D,onBlur:P}=(0,I.K)({errorMessage:"error",isErrored:!!l&&void 0===h,shouldErrorPreventSave:!0}),R=(0,n.useMemo)(()=>{let e=[];return D&&e.push({id:"ITEMS_REQUIRED",message:L.t("This field is required.")}),e},[D]),B=getTimePeriodOptions(i),W=[getTodayOption(i),E,getBeforeOption(i),getAfterOption(i),E,getStartOfOption(i),getEndOfOption(i)],V=h?.value===c.ZH.Before||h?.value===c.ZH.After,H=h?.value===w||h?.value===S;return n.createElement("div",{className:M().container},V&&n.createElement("div",{className:M().magnitudeContainer},n.createElement(T.o,{label:t,value:b,onChange:N,min:1,max:999,isDisabled:o})),n.createElement("div",{className:M().dateRangeContainer},n.createElement(v.Ay,{ariaLabel:L.t("Select a date range\u2026"),width:"100%",options:W,selectedOption:h,onOptionSelected:O,placeholderText:L.t("Select a date range\u2026"),isRequired:l,errors:R,onBlur:P,isDisabled:o})),(V||H)&&n.createElement("div",{className:M().timePeriodContainer},n.createElement(v.Ay,{ariaLabel:i?L.t("Select period\u2026"):"Select period\u2026",width:"100%",options:B,selectedOption:x,onOptionSelected:F,placeholderText:i?L.t("Select period\u2026"):"Select period\u2026",isDisabled:o})))};FilterConditionDateOffsetTargetValueInput.displayName="FilterConditionDateOffsetTargetValueInput";var P=a(0x13245bc52);let R=new r.Ay("workflow_builder"),B=[],FilterConditionTargetValueInput=({field:e,handleChangeValue:t,handleChangeReferenceValue:a,handleChangeDateOffsetValue:r,condition:l,isWrapped:i,maxItems:o,isDisabled:s=!1})=>{let m=(0,u.d4)(d.Xz),{rhs:b,type:f}=l,g=(0,n.useMemo)(()=>Array.isArray(b)?b:b?[b]:b,[b]),x=(0,h.Y3)(g),v=(0,n.useMemo)(()=>x.map(e=>String(e)),[x]),E=(0,h.kR)(g),k=(0,n.useCallback)(e=>t(e,!1),[t]),w=R.t("Value"),S=(0,n.useCallback)(()=>{let l={label:w,onChange:k,isDisabled:s};switch(e.type){case c.kY.StringSchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:case c.lt.ContainsFilterCondition:case c.lt.DoesNotContainFilterCondition:case c.lt.EndsWithFilterCondition:case c.lt.StartsWithFilterCondition:return n.createElement(_.d,{value:v,onChange:t,required:!0,placeholderText:R.t("Enter a value\u2026"),ariaLabel:l.label,className:"margin_bottom_0",disableIdParsing:!0,splitOnWhitespace:!1,isDisabled:s});default:return null}case c.kY.URLSchemaField:case c.kY.EmailSchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:case c.lt.ContainsFilterCondition:case c.lt.DoesNotContainFilterCondition:case c.lt.EndsWithFilterCondition:case c.lt.StartsWithFilterCondition:return n.createElement(_.d,{value:v,onChange:t,required:!0,placeholderText:R.t("Enter a value\u2026"),ariaLabel:l.label,className:"margin_bottom_0",disableIdParsing:!0,isDisabled:s});default:return null}case c.kY.BooleanSchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:return n.createElement(P.$f,{...l,value:x[0],required:!0});default:return null}case c.kY.DoubleSchemaField:case c.kY.CurrencySchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:return n.createElement(_.d,{value:v,onChange:t,required:!0,placeholderText:R.t("Enter a number\u2026"),ariaLabel:l.label,validation:y.m.Number,className:"margin_bottom_0",disableIdParsing:!0,isDisabled:s});case c.lt.GreaterThanFilterCondition:case c.lt.LessThanFilterCondition:return n.createElement(P.oz,{...l,value:x[0]});default:return null}case c.kY.LongSchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:return n.createElement(_.d,{value:v,onChange:t,required:!0,placeholderText:R.t("Enter a number\u2026"),ariaLabel:l.label,validation:y.m.Integer,className:"margin_bottom_0",disableIdParsing:!0,isDisabled:s});case c.lt.GreaterThanFilterCondition:case c.lt.LessThanFilterCondition:return n.createElement(P.oz,{...l,value:x[0]});default:return null}case c.kY.SelectSchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:case c.lt.SetEqualsFilterCondition:case c.lt.SetNotEqualsFilterCondition:return n.createElement(P.zM,{...l,value:x??[],options:e.options||B,required:!0});case c.lt.EndsWithFilterCondition:case c.lt.StartsWithFilterCondition:case c.lt.ContainsFilterCondition:case c.lt.DoesNotContainFilterCondition:return n.createElement(_.d,{value:v,onChange:t,required:!0,placeholderText:R.t("Enter a value\u2026"),ariaLabel:l.label,className:"margin_bottom_0",disableIdParsing:!0,isDisabled:s});default:return null}case c.kY.ReferenceSchemaField:switch(f){case c.lt.EqualsFilterCondition:case c.lt.DoesNotEqualFilterCondition:return n.createElement(P.Gj,{...l,identifiers:E,onChange:a,fieldId:e.id,required:!0,maxItems:o});default:return null}case c.kY.DateSchemaField:case c.kY.DateTimeSchemaField:switch(f){case c.lt.DateOffsetEqualsFilterCondition:case c.lt.DateOffsetGreaterThanFilterCondition:case c.lt.DateOffsetLessThanFilterCondition:return m?n.createElement(FilterConditionDateOffsetTargetValueInput,{required:!0,rhs:g?.[0],label:w,onChange:k,onChangeRhs:r,experimentTroopsTimePeriodFilterConditionsGroupOn:m,isDisabled:s}):n.createElement(FilterConditionDateOffsetTargetValueInputOld,{...l,value:x[0],required:!0});default:return null}default:return null}},[t,k,a,r,e.type,e.options,e.id,f,x,v,E,w,o,g,m,s]);return!f||(0,h.jF)(f)?null:n.createElement("div",{"data-qa":"condition-value__wrapper",className:i?p().conditionContainer__valueWrap:p().conditionContainer__value},S())};FilterConditionTargetValueInput.displayName="FilterConditionTargetValueInput";var W=a(0x702be429),V=a(0x24f77b0a),H=a(0x1fe613d6e);let q=new r.Ay("workflow_builder"),TriggerFilterCondition=({condition:e,conditionIndex:t,onChange:a,isWrapped:r,subtype:i,groupIndex:o=0,isDisabled:s=!1})=>{let{fields:m,fieldsLoading:b,isObjectAccessible:f}=(0,V.T)(),g=(0,u.d4)(d.Mp),_=(0,u.d4)(d._1),y=(0,u.d4)(H.K),x=_&&y,{type:v,schema_field_id:E}=e,k=(0,n.useCallback)((t,n=!1)=>{a(n?t:{...e,...t})},[e,a]),w=(0,n.useMemo)(()=>m.find(e=>e.id===E),[m,E]);(0,W.Lq)(e,a,w);let S=(0,W.AW)(b,E,w),C=!!(w&&x&&!w.isTokenAccessible),A=(0,W.Mc)(w),T=S&&_&&!0===f,I=C&&_&&!0===f,N=(0,n.useCallback)(t=>{k({...e,type:void 0,rhs:void 0,schema_field_id:t})},[e,k]),M=(0,n.useCallback)(t=>{let a=(0,h.FJ)(w?.type,e.type)===(0,h.FJ)(w?.type,t)?e.rhs:[{type:(0,h.Kr)(w?.type),isError:!0}];k({...e,type:t,rhs:(0,h.jF)(t)?void 0:a})},[e,k,w?.type]),L=(0,n.useCallback)(t=>{switch(e.type){case c.lt.GreaterThanFilterCondition:case c.lt.LessThanFilterCondition:case c.lt.DateOffsetLessThanFilterCondition:case c.lt.DateOffsetGreaterThanFilterCondition:case c.lt.DateOffsetEqualsFilterCondition:case c.lt.ContainsFilterCondition:case c.lt.DoesNotContainFilterCondition:case c.lt.StartsWithFilterCondition:case c.lt.EndsWithFilterCondition:a({...e,rhs:t[0]});break;default:a({...e,rhs:t})}},[e,a]),O=(0,n.useMemo)(()=>(0,h.RM)(w),[w]),F=(0,n.useMemo)(()=>{let a=0===o&&0===t;return g&&!y&&a&&e?.isAutoSelected===!0&&i===c.GW.lookback},[g,y,e,t,o,i]);(0,n.useEffect)(()=>{let a=0===o&&0===t,n=E&&m.length>0&&!m.some(e=>e.id===E);if(g&&!y&&a&&i===c.GW.lookback&&n)k({id:e.id},!0);else if(g&&!y&&a&&i===c.GW.lookback&&!E&&!v&&m.length>0&&!b){let t=m.find(e=>"OwnerId"===e.identifier&&e.type===c.kY.ReferenceSchemaField&&e.isActive);t&&k({...e,schema_field_id:t.id,isAutoSelected:!0,type:c.lt.EqualsFilterCondition,rhs:[{type:(0,h.Kr)(t.type),isError:!0}]})}},[o,t,i,g,y,E,v,m,b,e,k]);let D=_&&w?q.t("This condition uses a field that is no longer available: {fieldLabel}",{fieldLabel:A}):q.t("This condition has missing fields."),P=_?q.t("You do not have access to this field: {fieldLabel}. This workflow will not start if the recipient also does not have access.",{fieldLabel:A}):`You do not have access to this field: ${A}. This workflow will not start if the recipient also does not have access.`,R=_?q.t("You do not have access to this field. This workflow will not start if the recipient also does not have access."):"You do not have access to this field. This workflow will not start if the recipient also does not have access.",B=w?P:R;return n.createElement("div",{"data-qa":"trigger-filter-condition",role:"group","aria-label":q.t("Condition {index}",{index:t+1})},T&&n.createElement(l.Ay,{level:"error",align:"left",icon:"warning",className:p().conditionContainer__alert},D),I&&n.createElement(l.Ay,{level:"warning",align:"left",icon:"warning",className:p().conditionContainer__alert},B),n.createElement("div",{"data-qa":"trigger-condition",className:r?p().filterConditionWrap:p().filterCondition},n.createElement(FilterConditionField,{handleChangeField:N,condition:e,fields:m,fieldsLoading:b,isWrapped:r,disabled:F||s}),n.createElement(FilterConditionOperator,{fieldId:E,handleChangeOperator:M,selectedOperator:v,operators:O,disabled:!w||F||S||s,isWrapped:r}),n.createElement(FilterConditionTargetValue,{field:w,condition:e,handleChangeRhs:L,InputComponent:FilterConditionTargetValueInput,isWrapped:r,maxItems:F?100:void 0,isDisabled:S||s})))};TriggerFilterCondition.displayName="TriggerFilterCondition"},0xaf63c01f:(e,t,a)=>{"use strict";a.d(t,{h:()=>useAccessibleFields});var n=a(0xbad225b5),r=a(0x2172ff7ff),l=a(0x17178b190),i=a(0x145d46a61),o=a(0x1fe613d6e),s=a(0x226892387);let useAccessibleFields=({fields:e,selectedFieldId:t,additionalFilter:a,sort:c=!0})=>{let d=(0,s.d4)(o.K),u=(0,s.d4)(i._1);return(0,n.useMemo)(()=>{let n=e.filter(e=>e.id===t||!!(e.isActive&&(d||!u||!0===e.isTokenAccessible))&&(!a||a(e))).map(e=>{let t=e.label;if(e.type===l.kY.ReferenceSchemaField){let a=e.relationships?.find(e=>e.isActive);t=a?.relationshipLabel??a?.relationshipName??e.label}return{label:t,value:e.id}});return c?n.sort((e,t)=>(0,r.Ay)(e.label,t.label)):n},[e,t,d,u,a,c])}},0x702be429:(e,t,a)=>{"use strict";a.d(t,{AW:()=>useHasFieldError,Lq:()=>useHydrateFieldValidity,Mc:()=>useFieldLabel});var n=a(0xbad225b5),r=a(0x6258badf),l=a(0xaf63c01f),i=a(0x145d46a61),o=a(0x1fe613d6e),s=a(0x226892387);function useFieldIsValid(e){let t=(0,s.d4)(i._1),a=(0,s.d4)(o.K);return!e||!t||(a?e.isActive:e.isActive&&(e.isTokenAccessible??!0))}function useHasFieldError(e,t,a){let n=(0,s.d4)(i._1),r=(0,s.d4)(o.K),l=a&&!a.isActive,c=a&&n&&!r&&!a.isTokenAccessible,d=t&&!a&&!e;return!!(l||c||d)}function useFieldLabel(e){let t=(0,n.useMemo)(()=>e?[e]:[],[e]),[a]=(0,l.h)({fields:t,selectedFieldId:e?.id,sort:!1});return a?.label??e?.label??""}function useHydrateFieldValidity(e,t,a){let l=useFieldIsValid(a);(0,n.useEffect)(()=>{void 0!==e.isFieldValid&&a&&l&&t((0,r.A)(e,"isFieldValid")),!1!==e.isFieldValid&&a&&!l&&t({...e,isFieldValid:!1})},[e,a,l,t])}},0x13245bc52:(e,t,a)=>{"use strict";a.d(t,{$f:()=>BooleanField,oz:()=>r.o,zM:()=>SelectField,Gj:()=>TypeaheadField});var n=a(0xbad225b5);a(0x126f22530);var r=a(0x4e697bfb),l=a(0x21f3c49e8),i=a(0x20482ad21),o=a(0xa7ec93c2),s=a(0x207fb9b92);let c=new i.Ay("workflow_builder"),SelectField=({value:e=[],onChange:t,label:a,options:r,required:i=!1,isDisabled:d=!1})=>{let u=(0,n.useMemo)(()=>r.sort((e,t)=>(e?.position??0)-(t?.position??0)).reduce((e,t)=>(t.isActive&&e.push({value:t.identifier,label:t.label??t.identifier}),e),[]),[r]),m=(0,n.useMemo)(()=>u.filter(t=>e.includes(t.value)),[e,u]),p=(0,n.useCallback)(e=>t(e.map(({value:e})=>e)),[t]),{errorText:b,onBlur:f}=(0,s.K)({errorMessage:"error",isErrored:i&&(0,l.A)(e),shouldErrorPreventSave:!0}),g=(0,n.useMemo)(()=>{let e=[];return b&&e.push({id:"ITEMS_REQUIRED",message:c.t("This field is required.")}),e},[b]);return n.createElement(o.Ay,{key:JSON.stringify(r),options:u,ariaLabel:a,onSelectedItemsChange:p,placeholderText:c.t("Select a value\u2026"),selectId:"condition-form-select",selectedOptions:m,width:"100%",expandOnFocus:!0,disableIdParsing:!0,errors:g,onBlur:f,isDisabled:d})};SelectField.displayName="SelectField";var d=a(0x15014e268);let u=new i.Ay("workflow_builder"),BooleanField=({value:e,onChange:t,label:a,required:r,isDisabled:l=!1})=>{let i=(0,n.useMemo)(()=>[{value:String(!0),label:u.t("True")},{value:String(!1),label:u.t("False")}],[]),o=(0,n.useCallback)(({value:e})=>{t("true"===e)},[t]),c=i.find(t=>String(e)===t.value),{errorText:m,onBlur:p}=(0,s.K)({errorMessage:"error",isErrored:!!r&&void 0===e,shouldErrorPreventSave:!0}),b=(0,n.useMemo)(()=>{let e=[];return m&&e.push({id:"ITEMS_REQUIRED",message:u.t("This field is required.")}),e},[m]);return n.createElement(d.Ay,{selectDataQa:"condition-form-boolean__input",ariaLabel:a,width:"100%",options:i,selectId:"conditionField",selectedOption:c,onOptionSelected:o,placeholderText:u.t("Select a value\u2026"),onBlur:p,errors:b,isDisabled:l})};BooleanField.displayName="BooleanField";var m=a(0x16cf1da63),p=a(0xe874a88a),b=a(0x2172ff7ff),f=a(0x24f77b0a),g=a(0x145d46a61),h=a(0x4a120eb2),_=a(0x99e2bdae),y=a(0x226892387);let x=new i.Ay("workflow_builder"),TypeaheadField=({identifiers:e,onChange:t,label:a,fieldId:r,required:l,maxItems:i,isDisabled:o=!1})=>{let c=(0,m.wA)(),d=(0,y.d4)(g.Mp),{datasourceId:u,schemaObjectId:v}=(0,f.T)(),E=(0,n.useMemo)(()=>e?e.map((e,t)=>({label:o?e.label??e.identifier:e.label,value:e.identifier,isError:!!i&&t>=i})):[],[e,i,o]),k=(0,n.useCallback)(e=>e&&e.length<3?x.t("Keep typing to see results\u2026"):x.t("No items"),[]),w=(0,n.useCallback)(e=>e&&!(e.length<3)&&u&&v?c((0,_.Fh)({datasourceId:u,schemaObjectId:v,query:e,field:r})).then(({results:e})=>e.flatMap(e=>({value:e.schemaObjectLabel,id:e.schemaObjectId,label:e.schemaObjectLabel,options:e.records.map(e=>({label:e.name,value:e.identifier})).sort((e,t)=>(0,b.Ay)(e.label,t.label))})).sort((e,t)=>(0,b.Ay)(e.label,t.label))):p.S.resolve([]),[u,c,v,r]),S=(0,n.useCallback)(e=>{t(e.map(e=>({identifier:e.value,label:e.label})))},[t]),C=!!l&&E.length<1,A=!!i&&E.length>i,{errorText:T,onBlur:I}=(0,s.K)({errorMessage:"error",isErrored:C||A,shouldErrorPreventSave:!0}),N=(0,n.useMemo)(()=>{let e=[];return T&&(C&&e.push({id:"ITEMS_REQUIRED",message:x.t("This field is required.")}),A&&e.push({id:"MAX_ITEMS_EXCEEDED",message:d?x.t("{maxItems}-value limit exceeded.",{maxItems:i}):`${i}-value limit exceeded.`})),e},[T,C,A,i,d]),M=(0,n.useMemo)(()=>{let e=[];return i&&0===N.length&&e.push({id:"MAX_ITEMS_HINT",message:d?x.t("Add up to {maxItems} values.",{maxItems:i}):`Add up to ${i} values.`}),e},[i,N,d]);return n.createElement(h.x,{ariaLabel:a,width:"100%",selectId:"condition-form-typeahead__input",search:w,placeholderText:x.t("Search for a value\u2026"),emptyStateMessage:k,selectedOptions:E,onSelectedItemsChange:S,debounceWaitPeriod:300,onBlur:I,errors:N,hints:M,isInvalid:N.length>0,isDisabled:o})};TypeaheadField.displayName="TypeaheadField"},0x4e697bfb:(e,t,a)=>{"use strict";a.d(t,{o:()=>NumberField});var n=a(0xbad225b5),r=a(0x18f2150ea),l=a(0x20482ad21),i=a(0x126f22530),o=a(0xbbd2a32d),s=a(0x207fb9b92);let c=new l.Ay("workflow_builder"),NumberField=({value:e,label:t,onChange:a,min:l,max:d,className:u,isDisabled:m=!1})=>{let p=(0,n.useCallback)(e=>{a(Number(e))},[a]),b=null===e?NaN:Number(e),f=b>(d??o.Ig),g=b<(l??o.kj),h=(0,n.useMemo)(()=>(0,r.A)(e)?f?c.t("This number is too large."):g?c.t("This number is too small."):void 0:c.t("This field is required."),[f,g,e]),_=!(0,r.A)(e)||f||g,{errorText:y,onBlur:x}=(0,s.K)({errorMessage:h,isErrored:_,shouldErrorPreventSave:!0}),v=(0,n.useMemo)(()=>`${e}_condition-form-number__input`,[e]);return n.createElement(i.A,{"data-qa":"condition-form-number__input",id:v,name:"condition-form-number__input","aria-label":t,value:e,onChange:p,placeholder:c.t("Enter a value\u2026"),type:"number",min:l??1/0,max:d??1/0,onBlur:x,errorText:y,useInlineAlert:!0,className:u,isDisabled:m})};NumberField.displayName="NumberField"},0x24f77b0a:(e,t,a)=>{"use strict";a.d(t,{T:()=>useFieldSearchContext,u:()=>r});var n=a(0xbad225b5);let r=(0,n.createContext)({datasourceId:void 0,schemaObjectId:void 0,fieldsLoading:!1,fieldsInvalid:!1,schemaObjectLabel:void 0,isObjectAccessible:void 0,fields:[],sortedChildRelationships:[]}),useFieldSearchContext=()=>{let e=(0,n.useContext)(r);if(!e)throw Error("useFieldSearchContext must be used within a FieldSearchContext provider");return e}},0x1e94f3cf:(e,t,a)=>{"use strict";a.d(t,{y:()=>WithFieldSearchContext});var n=a(0xbad225b5),r=a(0x16cf1da63),l=a(0x2172ff7ff),i=a(0x88dc61ea),o=a(0x24f77b0a),s=a(0x22678e203),c=a(0x99e2bdae),d=a(0x1a7f6fce4),u=a(0x226892387);function WithFieldSearchContext(e){return function({datasourceId:t,schemaObjectId:a,...m}){let[p,b]=(0,n.useState)(void 0),[f,g]=(0,n.useState)([]),[h,_]=(0,n.useState)([]),[y,x]=(0,n.useState)([]),[v,E]=(0,n.useState)(!1),[k,w]=(0,n.useState)(!1),S=(0,r.wA)(),{hasValidDataSourceObjectId:C,hasValidSchemaObjectId:A}=(0,i.Qk)();(0,n.useEffect)(()=>{let fetchData=async()=>{if(t&&a)try{E(!0);let e=await S((0,c.Jc)({datasourceId:t,schemaObjectId:a}));b(e),g(e.fields),d._.isSchemaObjectWithChildren(e)&&(x(e.childRelationships),_(e.childRelationships.map(e=>e.schemaObjectId)))}catch{w(!0)}finally{E(!1)}};C&&A&&fetchData()},[C,A,t,a,S]);let T=(0,u.d4)(e=>(0,s.eF)(e,h)),I=(0,n.useMemo)(()=>y.sort((e,t)=>{let a=T[e.schemaObjectId]?.label??e.relationshipName,n=T[t.schemaObjectId]?.label??t.relationshipName;return(0,l.Ay)(a,n)}),[T,y]),N=p?.label,M=(0,n.useMemo)(()=>({datasourceId:t,schemaObjectId:a,fieldsLoading:v,fieldsInvalid:k,schemaObjectLabel:N,isObjectAccessible:p?.isTokenAccessible,fields:f,sortedChildRelationships:I}),[t,a,k,v,N,p?.isTokenAccessible,f,I]);return n.createElement(o.u.Provider,{value:M},n.createElement(e,m))}}WithFieldSearchContext.displayName="WithFieldSearchContext"},0x1f265cc5b:(e,t,a)=>{"use strict";a.d(t,{Fg:()=>s,Ow:()=>h,aZ:()=>b,g6:()=>_,hs:()=>g,lu:()=>c,ny:()=>d,r$:()=>p,ul:()=>f,vm:()=>u,yb:()=>m});var n=a(0x870b34a7),r=a(0x106f35107),l=a(0x17178b190),i=a(0x56e1c8ae),o=a(0xb4375e8a);let s=(0,n.W)("update condition groups"),c=(0,n.W)("update change condition"),d=(0,n.W)("update static conditions"),u=(0,n.W)("update filters"),m=(0,n.W)("update team member filters"),p=(0,n.W)("update condition datasource"),b=(0,n.W)("update condition datasource object"),f=(0,n.W)("update frequency"),g=(0,n.W)("update startTime"),h=(0,n.W)("update sort config select picker"),_=(0,r.GX)(o.y$).on(s,(e,t)=>{let{segment:a}=e,{triggerConditions:n}=t,r=a.config.conditions;return(0,i.kp)(a.config)?{...e,segment:{...a,config:{...a.config,conditions:(0,i.i$)(r,n),baseConditions:n}}}:{...e,segment:{...a,config:{...a.config,conditions:n}}}}).on(c,(e,t)=>{let{segment:a}=e,{triggerChangeCondition:n}=t,r=a.config.conditions;return(0,i.kp)(a.config)?{...e,segment:{...a,config:{...a.config,conditions:(0,i.lG)(r,n),changeCondition:n}}}:{...e}}).on(d,(e,t)=>{let{segment:a}=e,{staticCondition:n,schemaObjectFields:r}=t;return(0,i.EP)(a.config)||(0,i.S)(a.config)?{...e,segment:{...a,config:{...a.config,conditions:r?(0,i.Ly)(n,r):n,unpreparedConditions:n}}}:{...e}}).on(u,(e,t)=>{let{segment:a}=e,{triggerFilters:n}=t;return{...e,segment:{...a,config:{...a.config,filters:n}}}}).on(m,(e,t)=>{let{segment:a}=e,{triggerTeamMembers:n}=t;return{...e,segment:{...a,config:{...a.config,teamMemberFilters:n}}}}).on(p,(e,t)=>{let{segment:a}=e,{datasourceId:n}=t,r=(0,i.MF)(),l=(0,i.CB)();return(0,i.kp)(a.config)?{...e,segment:{...a,config:{...a.config,datasourceId:n,schemaObjectId:void 0,conditions:(0,i.S1)(r,l),baseConditions:r,changeCondition:l,filters:[]}}}:(0,i.EP)(a.config)?{...e,segment:{...a,config:{...a.config,datasourceId:n,schemaObjectId:void 0,conditions:(0,i.zN)(),unpreparedConditions:(0,i.zN)(),filters:[]}}}:(0,i.S)(a.config)?{...e,segment:{...a,config:{...a.config,datasourceId:n,schemaObjectId:void 0,conditions:(0,i.Hj)(),unpreparedConditions:(0,i.Hj)(),filters:[]}}}:(0,i.Fe)(a.config)||(0,i.SZ)(a.config)?{...e,segment:{...a,config:{...a.config,datasourceId:n,schemaObjectId:void 0,conditions:(0,i.MF)(),filters:[],teamMemberFilters:[]}}}:{...e,segment:{...a}}}).on(b,(e,t)=>{let{segment:a}=e,{schemaObjectId:n}=t,r=(0,i.MF)(),l=(0,i.CB)();return(0,i.kp)(a.config)?{...e,segment:{...a,config:{...a.config,schemaObjectId:n,conditions:(0,i.S1)(r,l),baseConditions:r,changeCondition:l,filters:[],sortConfigPicker:{...a.config.sortConfigPicker,schema_field_id:void 0,limit:void 0,direction:void 0,value:void 0}}}}:(0,i.EP)(a.config)?{...e,segment:{...a,config:{...a.config,schemaObjectId:n,conditions:(0,i.zN)(),unpreparedConditions:(0,i.zN)(),filters:[],sortConfigPicker:{...a.config.sortConfigPicker,schema_field_id:void 0,limit:void 0,direction:void 0,value:void 0}}}}:(0,i.S)(a.config)?{...e,segment:{...a,config:{...a.config,schemaObjectId:n,conditions:(0,i.Hj)(),unpreparedConditions:(0,i.Hj)(),filters:[],sortConfigPicker:{...a.config.sortConfigPicker,schema_field_id:void 0,limit:void 0,direction:void 0,value:void 0}}}}:(0,i.Fe)(a.config)||(0,i.SZ)(a.config)?{...e,segment:{...a,config:{...a.config,schemaObjectId:n,conditions:(0,i.MF)(),filters:[],teamMemberFilters:[]}}}:{...e,segment:{...a}}}).on(f,(e,t)=>{let{segment:a}=e,{triggerFrequency:n}=t;if((0,i.Fe)(a.config)||(0,i.SZ)(a.config))return{...e};let r=(0,i.Ic)(n,a.config.startTime);return{...e,segment:{...a,config:{...a.config,frequency:r,displayFrequency:{type:n,on_days:r.on_days}}}}}).on(g,(e,t)=>{let{segment:a}=e,{triggerStartTime:n}=t;if((0,i.Fe)(a.config)||(0,i.SZ)(a.config))return{...e};let r=a.config.displayFrequency?.type===l.vH.weekly||a.config.displayFrequency?.type===l.vH.monthly||a.config.displayFrequency?.type===l.vH.quarterly?(0,i.Ic)(a.config.displayFrequency?.type,n):a.config.frequency;return{...e,segment:{...a,config:{...a.config,startTime:n,frequency:r}}}}).on(h,(e,t)=>{let{segment:a}=e,{triggerSortConfigPicker:n}=t;return(0,i.Fe)(a.config)||(0,i.SZ)(a.config)?{...e}:{...e,segment:{...a,config:{...a.config,sortConfigPicker:n}}}})},0xb4375e8a:(e,t,a)=>{"use strict";a.d(t,{Un:()=>isValidFilterCondition,y$:()=>m});var n=a(0xbbd2a32d),r=a(0xe08dc76c),l=a(0x139a1172d),i=a(0x17178b190),o=a(0x56e1c8ae);let isValidRhs=({type:e,value:t,identifier:a,isError:l,quantity:o,period:s,direction:c,operator:d},u)=>{if(l)return!1;if(e===i.Yf.BooleanValue&&"boolean"==typeof t)return!0;if(e===i.Yf.LongInt)return"number"==typeof t&&(0,n.gf)(t)&&(0,n.zh)(t);if(e===i.Yf.DoubleNumber)return"number"==typeof t&&(0,n.gf)(t);if(e===i.Yf.RelativeChange)return"number"==typeof o&&(0,n.gf)(o);if(e===i.Yf.TimePeriodChange&&u){if("number"==typeof s?.num&&(0,n.gf)(s?.num))switch(u){case i.hu.TimePeriodBeforeTriggerCondition:if(d?.type===r.Kr.AT_LEAST&&c?.type===r.ig.EARLIER)return s?.num===2||s?.num===1;if(d?.type===r.Kr.AT_MOST&&c?.type===r.ig.LATER)return s?.num===0;break;case i.hu.TimePeriodAfterTriggerCondition:if(d?.type===r.Kr.AT_LEAST&&c?.type===r.ig.LATER)return s?.num===2||s?.num===1||s?.num===0;break;case i.hu.TimePeriodCurrentTriggerCondition:if(d?.type===r.Kr.EXACT){if(c?.type===r.ig.EARLIER||c?.type===r.ig.LATER)return s?.num===1;if(c?.type===r.ig.ANY)return s?.num===0}break;default:return!0}return!1}return e===i.Yf.TimePeriodOffset?"number"==typeof t&&(0,n.zh)(t):!!(t||a)},s=(0,l.g)("hasValidConditionGroups",({segment:e})=>{if((0,o.EP)(e.config)||(0,o.S)(e.config))return!0;let t=(0,o.Gy)(e);return!!t&&t.every(e=>e.conditions.every(e=>(e=>{let{schema_field_id:t,rhs:a,type:n,isFieldValid:r}=e;return!1!==r&&(!!(0,o.Ev)(n)||!!t&&!!n&&(!!((0,o.L8)(n)||(0,o.cP)(n)&&!a)||!!a?.[0]?.type&&a.every(e=>isValidRhs(e,n))))})(e)))}),filterConditionIsArrayRhs=e=>{switch(e){case i.lt.GreaterThanFilterCondition:case i.lt.LessThanFilterCondition:case i.lt.DateOffsetLessThanFilterCondition:case i.lt.DateOffsetGreaterThanFilterCondition:case i.lt.DateOffsetEqualsFilterCondition:case i.lt.ContainsFilterCondition:case i.lt.DoesNotContainFilterCondition:case i.lt.StartsWithFilterCondition:case i.lt.EndsWithFilterCondition:return!1;default:return!0}},isValidFilterCondition=e=>{let{schema_field_id:t,rhs:a,type:n,isFieldValid:r}=e;return!1!==r&&!!t&&!!n&&(!!(0,o.jF)(n)||!!a&&(Array.isArray(a)?!!filterConditionIsArrayRhs(n)&&a?.[0]?.type&&a.every(e=>isValidRhs(e)):!filterConditionIsArrayRhs(n)&&isValidRhs(a)))},c=(0,l.g)("hasValidFilters",({segment:e})=>{let t=(0,o.gA)(e);return!t||t.every(e=>e.reference_field_id&&e.conditions.conditions.every(e=>e.conditions.every(isValidFilterCondition)))}),d=(0,l.g)("hasValidTeamMemberFilters",({segment:e})=>{let t=(0,o.Bv)(e);return!t||t.every(e=>!!e.childSchemaObjectId&&!!e.childToParentSchemaFieldId&&(!e.filter||e.filter.conditions.every(e=>e.conditions.every(isValidFilterCondition))))}),u=(0,l.g)("hasValidStaticCondition",({segment:e})=>{let t=(0,o.Sr)(e);return!t||(0,o.S)(e.config)&&(0,o.KV)(t)||t.conditions.every(e=>e.conditions.every(isValidFilterCondition))}),m=[s,c,d,(0,l.g)("hasValidDataSourceObjectId",({segment:e})=>{let t=(0,o.u8)(e);return!!(t&&""!==t)}),(0,l.g)("hasValidSchemaObjectId",({segment:e})=>{let t=(0,o.Ov)(e);return!!(t&&t>0)}),u,(0,l.g)("isValid",(e,{hasValidConditionGroups:t,hasValidFilters:a,hasValidTeamMemberFilters:n,hasValidDataSourceObjectId:r,hasValidSchemaObjectId:l,hasValidStaticCondition:i})=>t&&a&&n&&r&&l&&i)]},0x8731d017:(e,t,a)=>{"use strict";a.d(t,{Sw:()=>i,iI:()=>getSegmentParameters});var n=a(0x20482ad21),r=a(0x1795d8821);let l=new n.Ay("workflow_builder"),i={hourly:"hours",daily:"days",weekly:"weeks",monthly:"months",yearly:"years"},getSegmentParameters=()=>({startTime:{type:r.HN.DateTime,name:"startTime",title:l.t("Starts on"),is_required:!0},timezone:{type:r.HN.Timezone,name:"timezone",title:l.t("Time zone",{ns:"prefs"}),is_required:!0},occurrenceCount:{type:r.HN.Integer,name:"occurrenceCount",title:l.t("After a set number of occurrences"),is_required:!0},endTime:{type:r.HN.DateTime,name:"endTime",title:l.t("Ends"),is_required:!0},frequency:{type:r.HN.Object,name:"frequency",title:l.t("Frequency"),is_required:!0,required:["type"],properties:{type:{type:r.HN.String,name:"type",is_required:!0,title:l.t("Repeat every"),enum:["daily","weekly","monthly","yearly"]},onDays:{type:r.HN.Array,name:"onDays",is_required:!0,title:l.t("Repeat on"),items:{type:r.HN.String,enum:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],minItems:1}},repeatsEvery:{type:r.HN.Integer,name:"repeatsEvery",title:l.t("Repeat every")},onWeekNum:{type:r.HN.Integer,name:"onWeekNum",enum:[1,2,3,4,-1]}}}})},0x3fe57881:(e,t,a)=>{"use strict";a.d(t,{en:()=>k,qq:()=>v,qC:()=>E});var n=a(0x1db69cda),r=a(0xd4e00a1e),l=a(0x1bcd0917),i=a(0x124d99cb0),o=a(0x870b34a7),s=a(0x106f35107),c=a(0xe65b36eb),d=a(0x1075d3a9c),u=a.n(d),m=a(0x4bdf0df6),p=a(0x139a1172d),b=a(0x8731d017);let f=(0,p.g)("hasValidStartTime",({segment:e})=>{let{startTime:t,timezone:a=m.vp,frequency:n}=e.config?.schedule||{};if(!t)return!1;if(!n){let e=(0,i.lP)(t,a),n=u().tz(a);return e.isSameOrAfter(n)}return!0}),g=(0,p.g)("hasValidEndTime",({segment:e})=>{let{startTime:t,timezone:a,endTime:n,frequency:r}=e.config?.schedule||{};if(!n)return!0;if(!r)return!1;let{repeatsEvery:l=1,type:o}=r;if("once"===o)return!0;let s=(0,i.lP)(t,a).add(l,b.Sw[o]);return(0,i.lP)(n,a).isSameOrAfter(s)}),h=(0,p.g)("hasValidOccurrenceCount",({segment:e})=>{let{occurrenceCount:t,frequency:a}=e.config?.schedule||{};return!t||!!a&&t>0}),_=(0,p.g)("hasValidRepeatsEvery",({segment:e})=>{let{frequency:t}=e.config?.schedule||{};if(!t)return!0;let{repeatsEvery:a}=t;return void 0===a||a>0}),y=(0,p.g)("hasValidFrequency",({segment:e})=>{let{frequency:t}=e.config?.schedule||{};if(!t)return!0;let{type:a,onDays:n,onWeekNum:r}=t;if("daily"===a||"hourly"===a)return!n&&!r;if("weekly"===a)return!r&&void 0!==n&&0!==n.length&&n.every(e=>i.BP.includes(e));if("monthly"===a)return n?!!r&&n.length>0&&n.every(e=>i.BP.includes(e)):!r||!!n&&[1,2,3,4,-1].includes(r);return"yearly"!==a||!n&&!r}),x=(0,p.g)("isValid",(e,{hasValidFrequency:t,hasValidStartTime:a,hasValidEndTime:n,hasValidOccurrenceCount:r,hasValidRepeatsEvery:l})=>a&&t&&n&&r&&l),v=(0,o.W)("update schedule based on segment parameter changed"),E=(0,o.W)("update schedule frequency based on a pre-configured menu option"),k=(0,s.GX)([f,g,h,y,_,x]).on(v,(e,{parameter:t,value:a})=>{let{segment:r}=e,l=(0,n.A)(r.config.schedule);switch(t.name){case"startTime":l=(0,c.Fx)(l,a);break;case"timezone":l=(0,c.X7)(l,a);break;case"endTime":l=(0,c.EM)(l,a);break;case"occurrenceCount":{let e=parseInt(a,10);Number.isNaN(e)||(l=(0,c.MO)(l,e));break}case"type":l=(0,c.Uf)(l,a);break;case"repeatsEvery":{let e=parseInt(a,10);Number.isNaN(e)||(l=(0,c.NR)(l,e));break}case"onDays":l=(0,c.I6)(l,a);break;case"onWeekNum":l=(0,c.j0)(l,a)}return{...e,segment:{...r,config:{...r.config,schedule:l}}}}).on(E,(e,{frequencyMenuOption:t})=>{let{segment:a}=e,{startTime:n,frequency:o,timezone:s}=a.config.schedule,c=(0,r.A)(a.config.schedule,["startTime","timezone","frequency"]),d=(0,i.hN)(n,s),u=d.format("dddd"),m=(0,i.Bz)(d.format("YYYY-MM-DD"))??1;switch(t){case l.w.Daily:c.frequency={type:"daily"};break;case l.w.WeeklySameDay:c.frequency={type:"weekly",onDays:[u]};break;case l.w.Weekdays:c.frequency={type:"weekly",onDays:["Monday","Tuesday","Wednesday","Thursday","Friday"]};break;case l.w.MonthlyNthDay:c.frequency={type:"monthly",onDays:[u],onWeekNum:m};break;case l.w.Yearly:c.frequency={type:"yearly"};break;case l.w.Custom:o||(c.frequency={type:"daily"});break;default:delete c.frequency}return{...e,segment:{...a,config:{...a.config,selectedFrequencyMenuOption:t,schedule:c}}}})},0xa6e1b10c:(e,t,a)=>{"use strict";a.d(t,{R4:()=>s,iI:()=>d,r$:()=>c,s8:()=>o});var n=a(0x870b34a7),r=a(0x106f35107),l=a(0x1e53c059d),i=a(0xf8a1cf7b);let o=(0,n.W)("Update webhook schema entry"),s=(0,n.W)("Remove webhook schema entry"),c=(0,n.W)("Regenerate webhook url"),d=(0,r.GX)(i.y$).on(c,(e,t)=>{let{segment:a}=e,{url:n}=t;return{...e,segment:{...a,config:{...a.config,url:n}}}}).on(o,(e,t)=>{let{segment:a}=e,{schema:n}=t,r=(0,l.iF)(a,n);return{...e,segment:r}}).on(s,(e,t)=>{let{segment:a}=e,{name:n}=t,r=(0,l.Zt)(a,n);return{...e,segment:r}})},0xf8a1cf7b:(e,t,a)=>{"use strict";a.d(t,{L:()=>hasValidTitleCharacters,lk:()=>i,y$:()=>s});var n=a(0x139a1172d),r=a(0x1e53c059d),l=a(0xf2193715);let i=20,o=/^[a-zA-Z0-9-_]+$/,hasValidTitleCharacters=e=>o.test(e),s=[(0,n.g)("validTitleCharacters",({segment:e})=>((0,r.iE)(e)||[]).every(({title:e})=>hasValidTitleCharacters(e))),(0,n.g)("validTitleLength",({segment:e})=>((0,r.iE)(e)||[]).every(({title:e})=>e.length>0&&e.length<=l.tu)),(0,n.g)("hasUniqueTitles",({segment:e})=>{let t=((0,r.iE)(e)||[]).map(({title:e})=>e);return new Set(t).size===t.length}),(0,n.g)("canAddSchema",({segment:e})=>((0,r.iE)(e)||[]).length<i),(0,n.g)("hasValidSchemaCount",({segment:e})=>((0,r.iE)(e)||[]).length<=i),(0,n.g)("isValid",(e,{validTitleCharacters:t,validTitleLength:a,hasUniqueTitles:n,hasValidSchemaCount:r})=>t&&a&&n&&r)]},0x44c1a824:(e,t,a)=>{"use strict";a.d(t,{O:()=>b,q:()=>p});var n=a(0x870b34a7),r=a(0x106f35107),l=a(0x52fc4a0c),i=a(0x818fd090),o=a(0x1a3026429),s=a(0x139a1172d),c=a(0x78a9d64e);let d=(0,s.g)("hasValidInputValues",({segment:e})=>{let t=(0,l.ln)(e),a=(0,l.bn)(e),n=(0,l.Iw)(e);return t.every(e=>{if(e.name in a)return!0;let t=n[e.name]?.value;return(0,c.Pl)(e,t)})}),u=(0,s.g)("hasValidDynamicInputs",({segment:e})=>{let t=(0,l.ln)(e),a=(0,l.Iw)(e);return t.every(e=>{let t=(0,i.w)(e),n=a[t.name]?.value;return(0,o.u)(t,n)})}),m=(0,s.g)("isValid",(e,{hasValidInputValues:t,hasValidDynamicInputs:a})=>t&&a),p=(0,n.W)("update configured parameter value"),b=(0,r.GX)([d,u,m]).on(p,(e,{parameter:t,value:a,label:n,options:r})=>{let i,{segment:o}=e;return i=null!==a||t.is_required?(0,l.bG)(o,t,a,n,r):(0,l.oR)(o,t),{...e,segment:i}})},0x24e22e0a6:(e,t,a)=>{"use strict";a.d(t,{Z:()=>isServiceTriggerSegment});var n=a(0x126af815a);let isServiceTriggerSegment=e=>{let t="config"in e?e.config:void 0;return!!t&&e.type===n.YV&&"service"in t}},0x38e951e5:(e,t,a)=>{"use strict";a.d(t,{GE:()=>b,bg:()=>f,He:()=>p});var n=a(0x870b34a7),r=a(0x106f35107),l=a(0x139a1172d),i=a(0xaed466e2);let o=(0,l.g)("noEmptyTitles",({segment:e})=>((0,i.lK)(e)||[]).every(e=>e.title&&e.title.length>0&&e.name&&e.name.length>0)),s=(0,l.g)("duplicateTitles",({segment:e})=>{let t=(0,i.lK)(e);if(!t)return!1;let a={},n=!1;return t.every(({title:e})=>a[e]?(n=!0,!1):(a[e]=(a[e]||0)+1,!0)),n}),c=(0,l.g)("canAddSchema",({segment:e})=>((0,i.lK)(e)||[]).length<i.Mu),d=(0,l.g)("schemaCountIsValid",({segment:e})=>{let t=(0,i.lK)(e)||[];return Array.isArray(t)&&t.length<=i.Mu}),u=(0,l.g)("isValid",(e,{noEmptyTitles:t,duplicateTitles:a,schemaCountIsValid:n})=>t&&!a&&n);var m=a(0x32fdcd88);let p=(0,n.W)("Upsert shortcut custom input"),b=(0,n.W)("Remove shortcut custom input"),f=(0,r.GX)([o,s,c,d,u]).on(p,(e,t)=>{let{segment:a}=e,{item:n}=t,r=a.config.shortcut.schema.findIndex(e=>e.name===n.name),l={...n},i=r>-1?(0,m.A)(r,l,a.config.shortcut.schema):[...a.config.shortcut.schema,l],o={...a,config:{...a.config,shortcut:{schema:i}}};return{...e,segment:o}}).on(b,(e,t)=>{let{segment:a}=e,{name:n}=t,r={...a,config:{...a.config,shortcut:{schema:[...a.config.shortcut.schema.filter(e=>e.name!==n)]}}};return{...e,segment:r}})},0x1de72b3d8:(e,t,a)=>{"use strict";a.d(t,{$x:()=>getWarningForAtSymbolKeywords,IL:()=>getIsValidMessagePostedTriggerSegment,c0:()=>getErrorForKeywords,sS:()=>getErrorForDuplicateAcrossGroups});var n=a(0x20482ad21),r=a(0xe2e5f9b1),l=a(0x76c6bbbe),i=a(0x1e9747fe7),o=a(0x136bd1488);let s=new n.Ay("workflow_builder"),c=/(?:^|\s)@\w/,getMessagePostedErrorMessages=()=>({duplicateKeywords:s.t("Keywords must be unique. Remove any duplicate keywords to continue."),minimumCharacters:s.t("Keywords must be at least 2 characters. Update the keyword to continue."),maximumCharacters:s.t("Keywords cannot exceed 3,000 characters. Update the keyword to continue."),duplicateAcrossGroups:s.t("Keywords can\u2019t be both included and excluded. Remove any duplicate keywords."),prohibitedSpecialCharacter:s.t("Keywords cannot contain the # character. Update the keyword to continue.")}),getErrorForKeywords=({keywords:e})=>{let t=getMessagePostedErrorMessages();for(let[a,n]of e.entries()){if(!(0,r.A)(n)&&n.length<2)return{errorMessage:t.minimumCharacters,invalidKeyword:n};if(n.includes("#"))return{errorMessage:getMessagePostedErrorMessages().prohibitedSpecialCharacter,invalidKeyword:n};if(n.length>3e3)return{errorMessage:t.maximumCharacters,invalidKeyword:n};let l=n.toLowerCase(),i=e.map(e=>e.toLowerCase());if(i.splice(a,1),i.includes(l))return{errorMessage:t.duplicateKeywords,invalidKeyword:l}}return{errorMessage:null,invalidKeyword:""}},getErrorForDuplicateAcrossGroups=(e,t)=>{let a={errorMessage:null,invalidKeyword:""};if(0===e.length||0===t.length)return a;let n=new Set(t.map(e=>e.toLowerCase()));for(let t of e){let e=t.toLowerCase();if(n.has(e))return{errorMessage:getMessagePostedErrorMessages().duplicateAcrossGroups,invalidKeyword:e}}return a},getWarningForAtSymbolKeywords=({includeKeywords:e,excludeKeywords:t})=>{for(let a of[...e,...t])if(c.test(a))return s.rt("<b>Heads up:</b> For privacy reasons, keywords that are @ mentions of users won\u2019t start this workflow.");return null},getIsValidMessagePostedTriggerSegment=(e,t)=>{if(!(0,o.s)(e))return!1;let a=e.config.event;if(!a)return!1;let{keywordGroups:n,additionalFilters:r,excludedUserIds:s}=(0,i.vu)(a,"keyword_groups");return!(n?.length===0||a.channelIds?.length===0||!a.filter||r.includes(l.rK)&&s.length>20)&&(!t||0!==s.length)&&n.every(({includeKeywords:e,excludeKeywords:t=[]})=>e?.length!==0&&null===getErrorForKeywords({keywords:e}).errorMessage&&(t?.length===0||null===getErrorForKeywords({keywords:t}).errorMessage&&null===getErrorForDuplicateAcrossGroups(e,t).errorMessage))}},0xf48b1168:(e,t,a)=>{"use strict";a.d(t,{rL:()=>g,qq:()=>b});var n=a(0x870b34a7),r=a(0x106f35107),l=a(0x112dbb8f3),i=a(0x21f3c49e8),o=a(0x61c95b1b),s=a(0x139a1172d),c=a(0x78a9d64e),d=a(0x1795d8821);let u=(0,s.g)("hasValidInputValues",({segment:e})=>{let t=e.config?.inputParameters??[],a=e.config?.event;return t.every(e=>{if(!a)return!1;let t=null;if(e.isFilter)if(a.eventType===o.$.ListRecordUpdated){if(t=(0,l.QS)(a,e.name)?.length||null,!e.is_required||t)return!0}else t=(0,l.QS)(a,e.name);else("channelIds"===e.name||"teamIds"===e.name||"metadataEventType"===e.name||"listId"===e.name)&&(t=a[e.name]||null);switch(e.type){case d.HN.Reaction:return!(0,i.A)(t);case d.HN.Array:{let a=e?.maxItems;if(Array.isArray(t)&&a&&t.length>a)return!1}}return(0,c.Pl)(e,t)})}),m=(0,s.g)("isValid",(e,{hasValidInputValues:t})=>t),p=(0,n.W)("update data"),b=(0,n.W)("update configured parameter value"),f=(0,n.W)("update top level filter operator value"),g=(0,r.GX)([u,m]).on(p,(e,t)=>{let{segment:a}=e,{name:n}=t;return{...e,segment:{...a,config:{...a.config,name:n}}}}).on(b,(e,{parameter:t,value:a,currentUserId:n})=>{let{segment:r}=e,i=(0,l.bG)(r,t,a,n);return{...e,segment:i}}).on(f,(e,{operator:t})=>{let a,{segment:n}=e;return n.config.event.filter?.root?"statement"in n.config.event.filter.root?a={operator:t,inputs:[n.config.event.filter?.root]}:"inputs"in n.config.event.filter.root&&(a={operator:t,inputs:n.config.event.filter.root.inputs}):a={operator:t,inputs:[]},{...e,segment:{...n,config:{...n.config,event:{...n.config.event,filter:a?{version:1,root:a}:void 0}}}}})},0x1ee062b2e:(e,t,a)=>{"use strict";a.d(t,{y:()=>getEventName});let getEventName=e=>e.replace("slack#/events/","")},0x136bd1488:(e,t,a)=>{"use strict";a.d(t,{s:()=>isSlackEventTriggerSegment});let isSlackEventTriggerSegment=e=>"event"===e.type&&"config"in e},0x13b2d52cd:(e,t,a)=>{"use strict";a.d(t,{M:()=>copyWorkflowShortcutUrl});var n=a(0x1b595ffd0),r=a(0x1a5ac3a0c);let copyWorkflowShortcutUrl=({workflow:e,name:t,url:a,optionalWindow:l,experimentFeLinkTokenizationGroupOn:i})=>{let o=a||(0,r.Ow)(e),s=t||(0,r.BQ)(e);(0,n.r)({shareUrl:o,workflowName:s,optionalWindow:l,experimentFeLinkTokenizationGroupOn:i})}},0x24eaf48aa:(e,t,a)=>{"use strict";a.d(t,{XS:()=>getSegmentErrorCode,jS:()=>getPrioritySegmentErrorCode,nh:()=>getSegmentErrorMessage});var n=a(0xf7ab484f),r=a(0x1a5ac3a0c);let{INVALID_INTERACTIVITY_POINTER:l,MISSING_FUNCTION_PARAM:i,MISSING_INPUTS:o,INVALID_USER_CONTEXT:s}=a(0x20cfa1dc2).oh,c=[`${n.hc}_`,`${n.oi}_`],getPrioritySegmentErrorCode=e=>{if(0===e.length)return;let t=e.find(e=>e.code===l||e.code===s)||e[0];if(t.code===o&&t.message.includes("channel_id"))return n.Lj;if(t.code===i&&t.message.includes("team_id"))return n.T8;let{baseCode:a}=(e=>{for(let t of c)if(e.startsWith(t))return{baseCode:t.slice(0,-1),channelId:e.slice(t.length)};return{baseCode:e}})(t.code);return a},getSegmentErrorMessage=(e,t,a)=>{if(!e||!t||!a)return;let n=(0,r.rM)(e,t.id).find(e=>e.code===a);return n?.message},getSegmentErrorCode=(e,t)=>{if(e&&t)return getPrioritySegmentErrorCode((0,r.rM)(e,t.id))}},0xf2193715:(e,t,a)=>{"use strict";a.d(t,{tu:()=>n});let n=100},0x35d46650:(e,t,a)=>{"use strict";function nonNil(e){return null!=e}a.d(t,{b:()=>nonNil})},0x85512121:(e,t,a)=>{"use strict";e.exports=a.p+"workflows_192-0e70beb.png"},0x222b5efaf:(e,t,a)=>{"use strict";e.exports=a.p+"NewWorkflowCoachmarkIllustration-b01d8b0.png"},0xbf61ff25:(e,t,a)=>{"use strict";e.exports=a.p+"reminder-02bb3e2.svg"},0x10bdbc1d5:(e,t,a)=>{"use strict";e.exports=a.p+"workflows-education-video-52daf3a.mp4"},0x195ca460e:(e,t,a)=>{"use strict";e.exports=a.p+"workflows-education-video-8a08510.vtt"},0x82bb74ae:(e,t,a)=>{"use strict";e.exports=a.p+"workflows-education-thumbnail-img-14fa6f9.png"}}]);
//# sourceMappingURL=https://slack.com/source-maps/bv1-13/gantry-v2-async-workflow-builder-page-workflow-version.423caad72908a690eead.min.js.mapØA
—Eoúô