PageSourceSearch

https://rehansyed.notion.site/_assets/admin-dbabc27af757a411.js

js rehansyed.notion.site collected 2026-10-09 23:19:17 UTC 1,578,913 bytes, 106 lines download raw bytes

1"use strict";(globalThis.rspackChunknotion_next=globalThis.rspackChunknotion_next||[]).push([[23133],{876252(e,t,a){function i(){return(0,a(579993).O$)(a(192314).AppStoreCurrentUserStore)}a.d(t,{$:()=>i})},338798(e,t,a){var i=a(635790),n=a(440302);let r={krdFHd:"x1i5p2am",kfmiAY:"x1whfx0g",kT0f0o:"xr2y4jy",kVL7Gh:"x1ihp6rs",$$css:!0},s={kzqmXN:"xh8yej3",$$css:!0};function o(e){let t=(0,i.useMemo)(()=>[s,!a(139424).A.isMobile&&r,e.buttonStyle],[e.buttonStyle]);return(0,n.jsx)(a(64960).Ay,{onClick:e.onClick,hovered:e.focused,disabled:e.disabled,style:t,hoveredStyle:e.hoveredButtonStyle,pressedStyle:e.pressedButtonStyle,children:(0,n.jsx)(a(636518).A,{...e,dontShrinkTitle:!0,right:(0,n.jsxs)("div",{...{className:"x78zum5 x6s0dn4 xuxw1ft x1r0jzty x17zd0t2"},children:[e.right?(0,n.jsx)(a(324489).V,{isSecondaryColor:!0,children:e.right}):void 0,a(139424).A.isMobile?void 0:(0,n.jsx)("div",{...{0:{className:"x2lah0s x1jaox4c"},1:{className:"x2lah0s x1jaox4c x182y5vf"}}["right"===e.chevronType|0],children:(0,n.jsx)(a(16275).I,{icon:a(595453).arrowChevronSingleDownSmallIcon,size:"xs",colorVariant:"tertiary"})})]})})})}a.d(t,{_:()=>o})},543313(e,t,a){a.d(t,{A:()=>o}),a(159952);var i=a(635790),n=()=>a(546605);class r extends n().Store{getInitialState(){return{}}}var s=a(440302);let o=i.forwardRef(function({isMenuItem:e,style:t,labelStyle:n,alignmentToOrigin:o,renderMenuSections:c,label:p,selectedTitle:m,focused:u,disabled:h,disabledFeedback:y=!0,innerButtonStyle:g,buttonPopupStore:x,buttonVariant:f,buttonProps:b,menuWidth:v,menuMaxHeight:j,overlayContainerZIndex:k,menuTitle:S,menuShowDone:w,onOpen:I,"aria-labelledby":C,"aria-describedby":D},T){let R=(0,a(579993).uB)(void 0,r),A=(0,a(579993).uB)(x,a(510969).A),N=(0,a(960253).I)(()=>({wrapper:{alignItems:"center",display:"flex",...t},label:{color:a(632079).Tj.text.tertiary,fontSize:14,marginInlineEnd:"auto",...n}}),[n,t]);return((0,i.useImperativeHandle)(T,()=>({closeMenu:()=>{A.setState({...A.state,open:!1})}}),[A]),e)?(0,s.jsx)(d,{alignmentToOrigin:o,isMenuItem:e,renderMenuSections:c,buttonPopupStore:A,selectButtonStore:R,menuWidth:v,menuMaxHeight:j,overlayContainerZIndex:k,menuTitle:S,menuShowDone:w,onOpen:I,children:a=>(0,s.jsx)(l,{events:a,style:t,isMenuItem:e,label:p,selectedTitle:m,focused:u,disabled:h})}):(0,s.jsxs)("div",{style:N.wrapper,children:[p?(0,s.jsx)("div",{style:N.label,children:p}):void 0,(0,s.jsx)(d,{alignmentToOrigin:o,isMenuItem:e,renderMenuSections:c,buttonPopupStore:A,selectButtonStore:R,menuWidth:v,menuMaxHeight:j,overlayContainerZIndex:k,menuTitle:S,menuShowDone:w,onOpen:I,children:e=>{if(f){let t=(0,a(586880).x)(f);return(0,s.jsx)(t,{disabled:h,"aria-labelledby":C,"aria-describedby":D,style:g,iconTrailing:{icon:a(595453).arrowChevronSingleDownSmallIcon,size:"xs",colorVariant:h?"disabled":"secondary"},...b,...e,children:m})}return(0,s.jsx)(a(988022).p,{disabled:h,"aria-labelledby":C,"aria-describedby":D,disabledFeedback:y,style:{marginInlineEnd:-6,...g},iconTrailing:{icon:a(595453).arrowChevronSingleDownSmallIcon,size:"xs",colorVariant:h&&y?"disabled":"secondary"},...e,children:m})}})]})});function l({events:e,style:t,isMenuItem:i,label:n,selectedTitle:r,focused:o,disabled:d}){return i?(0,s.jsx)(a(338798)._,{...e,focused:!!o,disabled:d,style:t,...n?{title:n,right:r}:{title:r}}):null}function d({children:e,alignmentToOrigin:t,isMenuItem:i,renderMenuSections:n,buttonPopupStore:r,selectButtonStore:o,menuWidth:l,menuMaxHeight:c,overlayContainerZIndex:p,menuTitle:m,menuShowDone:u,onOpen:h}){let y=(0,a(579993).K8)(()=>o.state.selectedKey,[o]);return(0,s.jsx)(a(656252).d,{popupType:a(139424).A.isMobile?a(656252).z.BottomSheet:a(656252).z.Popup,buttonPopupStore:r,alignmentToOrigin:void 0!==t?t:"end",placementToOrigin:i?"right":"bottom",originGap:i?void 0:4,overlayContainerZIndex:p,onOpen:h,content:e=>{let{focusedIndex:t,menuSections:i}=function(e){let t,{parent:a,renderMenuSections:i,selectButtonStore:n,selectedKey:r}=e,s=0;return{menuSections:i(a).map(e=>({...e,items:e.items.map(e=>(r&&e.key===r&&(t=s),s++,{...e,action:t=>{var a;e.action(t),a=e.key,n.setState({selectedKey:a})}}))})),focusedIndex:t}}({parent:e,renderMenuSections:n,selectButtonStore:o,selectedKey:y}),r=(0,s.jsx)(a(558045).A,{type:a(558045).O.Vertical,initialFocus:t,sections:i});return a(139424).A.isMobile?(0,s.jsx)(a(747369).A,{menuType:a(649476).gu.Modal,title:m,right:u?(0,s.jsx)(a(327219).sA,{defaultMessage:"Done",id:"selectButton.mobileModal.done.label"}):void 0,onClickRight:u?e.close:void 0,children:r}):(0,s.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,width:l,maxHeight:c,children:r})},children:e})}},739271(e,t,a){var i=a(635790);function n(){let[e,t]=(0,i.useState)({inputElementAttributes:void 0,suppressFocusRing:!1}),[a,n]=(0,i.useState)(!1),[r,s]=(0,i.useState)(!1);return(0,i.useEffect)(()=>
1{if(a){function e(){s(!1)}function t(e){("ArrowDown"===e.key||"ArrowUp"===e.key)&&s(!0)}return window.addEventListener("pointerdown",e),window.addEventListener("keydown",t),()=>{window.removeEventListener("pointerdown",e),window.removeEventListener("keydown",t)}}},[a]),[(0,i.useMemo)(()=>({inputElementAttributes:e.inputElementAttributes,suppressFocusRing:e.suppressFocusRing&&r,onFocus:()=>{n(!0)},onBlur:()=>{n(!1)}}),[e.inputElementAttributes,e.suppressFocusRing,r]),(0,i.useMemo)(()=>({setComboboxState:t,isFocusVisible:r,isComboboxFocused:a,onItemHover:()=>{s(!1)}}),[r,a])]}a.d(t,{s:()=>n})},368678(e,t,a){var i=a(635790),n=a(440302);let r={style0:{display:"flex",alignItems:"center",marginInlineEnd:16,color:a(632079).Tj.blue.text.accentPrimary,fontWeight:a(699422).Wy.semibold}};function s(e){let{onDismiss:t,inputRef:s,isNativeTabComments:o=!1}=e,l=(0,a(533992).Y0)(),d=(0,i.useRef)(null),c=l.isMobileNative&&l.isIOS,p=c&&e.show;(0,a(336494).b)(a(651748).A,()=>({getNode:()=>d.current,isShown:()=>p}),[p]);let m=(0,a(571354).n)(),u=(0,i.useCallback)(()=>{var e;null==s||null==(e=s.current)||e.focus(),t&&t();let a=document.activeElement;a instanceof HTMLElement&&a.blur()},[s,t]);if(!c)return null;let h=o?{bottom:0}:{top:"100vh",transform:p?`translateY(${-(44+m)}px)`:void 0,transition:p?"ease-out":"ease-in"};return(0,n.jsx)(a(114596).O,{open:!0,children:(0,n.jsx)("div",{style:{position:"fixed",width:"100%",height:44,display:p?"flex":"none",alignItems:"center",justifyContent:"flex-end",backgroundColor:a(632079).Tj.keyboardDoneBarBackground,boxShadow:p?`
2								0 -1px 0 ${a(632079).Tj.border.primaryTranslucent}
3							`:void 0,...h},ref:d,children:(0,n.jsx)(a(64960).Ay,{style:r.style0,onTouchEnd:()=>{u()},children:(0,n.jsx)(a(327219).sA,{defaultMessage:"Done",id:"mobile.dismissKeyboardBar.button.label"})})})})}a.d(t,{P:()=>s})},920014(e,t,a){a(635790);var i=a(440302);let n={k1xSpc:"x78zum5",kXwgrk:"x1q0g3np",kGNEyG:"x6s0dn4",$$css:!0};function r(e){let{tint:t,action:r}=e,{label:s,onClick:o,icon:l,iconTrailing:d,disabled:c}=r,p=(0,a(960253).I)(()=>({button:{color:"gray"===t?a(632079).Tj.text.primary:a(632079).Tj[t].text.secondary,borderWidth:1,borderStyle:"solid",borderColor:a(632079).Tj[t].border.strongTranslucent},buttonHovered:{backgroundColor:a(632079).Tj[t].background.secondaryTranslucent},buttonPressed:{backgroundColor:a(632079).Tj[t].background.tertiaryTranslucent}}),[t]);return(0,i.jsx)(a(548436).A,{iconLeading:l?{icon:l,size:"sm"}:void 0,iconTrailing:d?{icon:d,size:"sm"}:void 0,onClick:o,disabled:c,style:p.button,hoveredStyle:p.buttonHovered,pressedStyle:p.buttonPressed,children:(0,i.jsx)(a(111010).D,{styleKey:"bodyMedium",style:n,children:s})})}a.d(t,{f:()=>r})},748356(e,t,a){a(159952),a(635790);var i=a(440302);let n=(0,a(327219).YK)({learnMore:{id:"banner.learnMore",defaultMessage:"Learn more"},dismiss:{id:"banner.dismiss",defaultMessage:"Dismiss"}});function r(e,t){return(0,a(960253).I)(()=>({container:{position:"relative",backgroundColor:a(632079).Tj[e].background.secondary,padding:"8px 12px",minHeight:44,flexShrink:0},icon:{width:a(139424).A.isMobile?a(104509).Ev.default:a(104509).Ev.sm,height:a(139424).A.isMobile?a(104509).Ev.default:a(104509).Ev.sm,fill:t?a(632079).Tj[t].icon.accentPrimary:a(632079).Tj[e].icon.secondary},content:{color:a(632079).Tj[e].text.secondary},contentAutoLayout:{position:"relative",color:a(632079).Tj[e].text.secondary},learnMoreIcon:{fill:a(632079).Tj[e].icon.secondary},titleIcon:{marginInlineEnd:8}}),[e,t])}function s(e){let{onDismiss:t,tint:r,iconColor:s}=e,o=(0,a(327219).tz)();if(!t)return null;let l=s?{colorPalette:s,colorVariant:"accentPrimary"}:{colorPalette:r,colorVariant:"secondary"};return(0,i.jsx)(a(374533).K,{size:"xs",onClick:t,icon:a(25094).xMarkSmallIcon,colorPalette:l.colorPalette,colorVariant:l.colorVariant,ariaLabel:o.formatMessage(n.dismiss)})}function o(e){let{tint:t,iconGroup:n,style:r}=e;return n?(0,i.jsx)(a(708966).Q,{iconGroup:n,variantName:"small",colorPalette:t,colorVariant:"secondary",style:r}):null}let l={kVAEAm:"x1n2onr6",$$css:!0};function d(e){let{label:t,iconGroup:d,tint:c,onDismiss:p,actions:m,onLearnMoreClick:u}=e,h=r(c),y=(0,a(327219).tz)();return(0,i.jsxs)(a(4458).fI,{style:h.container,width:"100%",alignItems:"center",justifyContent:"space-between",children:[(0,i.jsxs)(a(4458).fI,{style:h.contentAutoLayout,alignItems:"center",justifyContent:"center",children:[(0,i.jsx)(o,{tint:c,iconGroup:d,style:h.titleIcon}),(0,i.jsx)(a(111010).D,{styleKey:"bodyMedium",children:t}),u?(0,i.jsx)(a(374533).K,{onClick:u,icon:()=>(0,i.jsx)(a(708966).Q,{iconGroup:a(799472).u,variantName:"default",colorPalette:c,colorVariant:"secondary"}),ariaLabel:y.formatMessage(n.learnMore)}):void 0]}),(0,i.jsxs)(a(4458).fI,{gap:12,alignItems:"center",justifyContent:"flex-end",style:l,flex:"1 1 0",children:[(0,i.jsx)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"center",style:l,children:null==m?void 0:m.map((e,t)=>e.isCustom?e.render():(0,i.jsx)(a(920014).f,{tint:c,action:e},t))}),(0,i.jsx)(s,{onDismiss:p,tint:c})]})]})}function c(e){let{label:t,iconGroup:d,staticIcon:c,iconColor:p,tint:m,onDismiss:u,actions:h,onLearnMoreClick:y,alignment:g="center"}=e,x=r(m,p),f=(0,a(327219).tz)(),b=d?(0,i.jsx)(o,{tint:m,iconGroup:d,style:x.titleIcon}):c?c({...x.icon,...x.titleIcon}):null;return(0,i.jsxs)(a(4458).fI,{style:x.container,alignItems:"center",width:"100%",justifyContent:"space-between",gap:8,children:[(0,i.jsxs)(a(4458).fI,{style:x.contentAutoLayout,gap:24,flexGrow:1,alignItems:"center",justifyContent:"start"===g?"space-between":"center",children:[(0,i.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"center",style:l,children:[b,(0,i.jsx)(a(111010).D,{styleKey:"bodyMedium",children:t}),y?(0,i.jsx)(a(51831).m_,{content:()=>f.formatMessage(n.learnMore),children:e=>(0,i.jsx)(a(374533).K,{onClick:y,icon:()=>(0,i.jsx)(a(708966).Q,{iconGroup:a(799472).u,variantName:"default",colorPalette:m,colorVariant:"secondary"}),ariaLabel:f.formatMessage(n.learnMore),...e})}):void 0]}),h?(0,i.jsx)(a(4458).fI,{gap:8,style:l,children:null==h?void 0:h.map((e,t)=>e.isCustom?e.render():(0,i.jsx)(a(920014).f,{tint:m,action:e},t))}):null]}),(0,i.jsx)(s,{onDismiss:u,tint:m,iconColor:p})]})}function p(e){let{label:t,description:n,iconGroup:d,staticIcon:c,iconColor:p,tint:m,onDismiss:u,actions:h,noRoundedCorners:y}=e,g=r(m,p),x=(0,a(960253).I)(()=>({container:{position:"relative",backgroundColor:a(632079).Tj[m].background.secondary,padding:16,borderRadius:8*!y,minHeight:44,flexShrink:0}}),[m,y]),f=d?(0,i.jsx)(o,{tint:m,iconGroup:d}):c?c(g.icon):null;return(0,i.jsxs)(a(4458).fI,{style:x.container,gap:8,width:"100%",children:[f?(0,i.jsx)(a(4458).fI,{height:20,alignItems:"center",justifyContent:"center",children:f}):null,(0,i.jsxs)(a(4458).VP,{style:g.content,gap:8,flex:"1 1 0",children:[(0,i.jsxs)(a(4458).VP,{gap:4,style:l,children:[(0,i.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"gray"===m?"primary":void 0,children:t}),n?(0,i.jsx)(a(111010).D,{styleKey:"bodyRegular",children:n}):null]}),h?(0,i.jsx)(a(4458).fI,{gap:8,style:l,children:null==h?void 0:h.map((e,t)=>e.isCustom?e.render():(0,i.jsx)(a(920014).f,{tint:m,action:e},t))}):null]}),(0,i.jsx)(s,{onDismiss:u,tint:m,iconColor:p})]})}function m(e){let{label:t,staticIcon:n,tint:o,iconColor:d,onDismiss:c,actions:p}=e,m=r(o,d),u=void 0!==c,h=(0,a(960253).I)(()=>({container:{position:"relative",backgroundColor:a(632079).Tj[o].background.secondary,paddingTop:u?12:8,paddingInlineEnd:u?12:8,paddingBottom:u?12:8,paddingInlineStart:12,borderRadius:8,height:44,flexShrink:0},label:{color:a(632079).Tj[o].text.secondary,flex:"1 1 0",minWidth:0}}),[o,u]);return(0,i.jsxs)(a(4458).fI,{style:h.container,gap:8,alignItems:"center",width:"100%",children:[n?(0,i.jsx)(a(4458).fI,{height:20,alignItems:"center",justifyContent:"center",flexShrink:0,children:n(m.icon)}):null,(0,i.jsxs)(a(4458).fI,{flex:"1 1 0",minWidth:0,alignItems:"center",justifyContent:"space-between",gap:8,children:[(0,i.jsx)(a(111010).D,{styleKey:"bodyMedium",style:h.label,lineClamp:1,colorVariant:"gray"===o?"primary":void 0,children:t}),p?(0,i.jsx)(a(4458).fI,{gap:8,style:l,flexShrink:0,children:null==p?void 0:p.map((e,t)=>e.isCustom?e.render():(0,i.jsx)(a(920014).f,{tint:o,action:e},t))}):null]}),(0,i.jsx)(s,{onDismiss:c,tint:o,iconColor:d})]})}function u(e){let{tint:t,onDismiss:n,content:o,alignment:l="center",verticalAlignment:d="center"}=e,c=r(t);return(0,i.jsxs)(a(4458).fI,{style:c.container,gap:8,alignItems:d,justifyContent:"space-between",width:"100%",children:[(0,i.jsx)(a(4458).fI,{style:c.content,flexGrow:1,justifyContent:l,children:o}),(0,i.jsx)(s,{onDismiss:n,tint:t})]})}function h(e){let{display:t}=e;switch(t){case"inline":return(0,i.jsx)(p,{...e});case"full-width":if(a(139424).A.isMobile)return(0,i.jsx)(d,{...e});return(0,i.jsx)(c,{...e});case"full-width-no-content":return(0,i.jsx)(u,{...e});case"inline-compact":return(0,i.jsx)(m,{...e})}return null}a.d(t,{f:()=>a(920014).f,l:()=>h})},577497(e,t,a){a(435368);var i=a(635790),n=a(440302);let r={kzqmXN:"xh8yej3",$$css:!0},s={xxs:{krdFHd:"xjwep3j",kfmiAY:"x1t39747",kT0f0o:"x1wcsgtt",kVL7Gh:"x1pczhz8",$$css:!0},xs:{krdFHd:"x1i5p2am",kfmiAY:"x1whfx0g",kT0f0o:"xr2y4jy",kVL7Gh:"x1ihp6rs",$$css:!0},sm:{krdFHd:"x1obq294",kfmiAY:"x5a5i1n",kT0f0o:"xde0f50",kVL7Gh:"x15x8krk",$$css:!0},md:{krdFHd:"x16qb05n",kfmiAY:"xi7iut8",kT0f0o:"x1dm3dyd",kVL7Gh:"x1pv694p",$$css:!0},lg:{krdFHd:"x6nl9eh",kfmiAY:"x1a5l9x9",kT0f0o:"x7vuprf",kVL7Gh:"x1mg3h75",$$css:!0}},o={none:{kLKAdn:"xexx8yu",kwRFfy:"xyri2b",kGO01o:"x18d9i69",kZCmMZ:"x1c1uobl",$$css:!0},sm:{kLKAdn:"xz9dl7a",kwRFfy:"xpdmqnj",kGO01o:"xsag5q8",kZCmMZ:"x1g0dm76",$$css:!0},md:{kLKAdn:"xyamay9",kwRFfy:"xv54qhq",kGO01o:"x1l90r2v",kZCmMZ:"xf7dkkf",$$css:!0},lg:{kLKAdn:"x1cnzs8",kwRFfy:"x1xnnf8n",kGO01o:"xx6bls6",kZCmMZ:"x106a9eq",$$css:!0},xl:{kLKAdn:"x1p5oq8j",kwRFfy:"x64bnmy",kGO01o:"xwxc41k",kZCmMZ:"x13jy36j",$$css:!0}},l=i.forwardRef(function(e,t){let i,l,{children:d,colorPalette:c,colorVariant:p="primary",borderRadius:m="md",borderVariant:u,padding:h="none",shadowVariant:y}=e,g=c?a(632079).Tj[c]:a(632079).Tj,x=[];y&&x.push(a(632079).Tj.shadow.base[y]),u&&x.push(`inset 0 0 0 1px ${g.border[u]}`);let f=(0,a(48697).O)(g.background,p)?g.background[p]:g.background.primary;return(0,n.jsx)("div",{...a(398276).A.props(r,s[m],"number"==typeof h?{padding:h}:o[h],[{kC7eKd:null!=(i=f)?"xt2wqj3":i,$$css:!0},{"--x-background":null!=i?i:void 0}],x.length>0&&[{kGVxlE:null!=(l=x.join(", "))?"x1iotiob":l,$$css:!0},{"--x-boxShadow":null!=l?l:void 0}]),ref:t,children:d})});a.d(t,{},{Zp:l,fT:{xxs:4,xs:6,sm:8,md:10,lg:12},v3:{none:0,sm:12,md:16,lg:20,xl:24}})},211300(e,t,a){a(159952);var i=a(635790),n=a(440302);function r({ariaLabel:e,onSelect:t,selectedIndex:i,shouldWrap:o,tabIdPrefix:l,tabs:d}){return(0,n.jsx)(a(943019).Y,{direction:"horizontal",children:(0,n.jsx)("div",{role:"tablist","aria-label":e,className:"hide-scrollbar",...{0:{className:"x78zum5 xw2csxc x1yrsyyn x1icxu4v x10b6aqq x25sj25 xifccgj x1ws5yxj x4cne27 xw01apr xw09woa xmixu3c hide-scrollbar"},1:{className:"x78zum5 xw2csxc x1yrsyyn x1icxu4v x10b6aqq x25sj25 xifccgj x1ws5yxj x4cne27 xw01apr xw09woa xmixu3c x1a02dak hide-scrollbar"}}[0|!!o],children:d.map((e,a)=>(0,n.jsx)(s,{index:a,isSelected:i===a,onSelect:t,tab:e,tabIdPrefix:l},a))})})}function s({index:e,isSelected:t,onSelect:r,tab:o,tabIdPrefix:l}){let{isTabbable:d,itemRef:c,onKeyDown:p,onFocus:m}=(0,a(943019).e)(),{label:u,onClick:h,onKeyDown:y,onFocus:g,...x}=o,f=(0,i.useCallback)(e=>{c(e)},[c]),b=(0,i.useCallback)(t=>{null==h||h(t),r(e)},[h,r,e]),v=(0,i.useCallback)(e=>{null==y||y(e),p(e)},[y,p]),j=(0,i.useCallback)(e=>{null==g||g(e),m()},[g,m]);return(0,n.jsx)(a(988022).p,{colorVariant:t?void 0:"secondary",isEmphasized:!0,shape:"pill",...x,"aria-controls":(0,a(380521).J)(l,e),"aria-selected":t,disallowTabbing:!d,id:(0,a(380521).v)(l,e),isSelected:t,onClick:b,onFocus:j,onKeyDown:v,ref:f,role:"tab",children:u})}a.d(t,{V:()=>r})},380521(e,t,a){function i(e,t){if(e)return`${e}-tab-${t}`}function n(e,t){if(e)return`${e}-tabpanel-${t}`}a.d(t,{J:()=>n,v:()=>i})},540336(e,t,a){a(159952);var i=a(635790),n=a(440302);let r={kORKVm:"xryxfnj",kXHlph:"xw2csxc",k1xSpc:"x78zum5",kzqmXN:"xh8yej3",kVAEAm:"x1n2onr6",$$css:!0},s={kGVxlE:"xx4f2qb",$$css:!0},o={kGuDYH:"xif65rj",kZCmMZ:"xmzvs34",kwRFfy:"xf159sx",kY2c9j:"x1vjfegm",$$css:!0},l={kGuDYH:"x1j61zf2",kLKAdn:"x1nn3v0j",kY2c9j:"xhtitgo",kZKoxP:"xn3w4p2",kC7eKd:"x1mmz80m",$$css:!0},d={kZCmMZ:"xf7dkkf",kwRFfy:"xv54qhq",$$css:!0},c={kLKAdn:"x1yrsyyn",kGO01o:"x10b6aqq",khDVqt:"xuxw1ft",k7Eaqz:"xeuugli",kmuXW:"x2lah0s",kMwMTN:"x1b8rd1j",$$css:!0},p={kVAEAm:"x1n2onr6",$$css:!0},m={k4EQJz:"xkaiwgt",kVAEAm:"x10l6tqk",krVfgx:"x1ey2m1c",kLqNvP:"xrotz4w",kt4wiu:"x11dcrhx",$$css:!0},u={k1xSpc:"x78zum5",kzQI83:"x1iyjqo2",$$css:!0},h={selectedTab:{color:a(632079).Tj.text.primary}};function y(e,t){if(e)return`${e}-tab-${t}`}function g(e,t){if(e)return`${e}-tabpanel-${t}`}let x=i.memo(function({tabs:e,selectedIndex:t,onChange:x,right:f,style:b,tabStyle:v,tabTitleStyle:j,selectedTabTitleStyle:k,tabBorderStyle:S,selectedTabStyle:w,readOnly:I,hideTabBorder:C,idPrefix:D}){let T=(0,i.useContext)(a(649476).xu),R=(0,a(51487).Y5)("left",16),A=(0,a(51487).Y5)("right",16),N=T.menuType===a(649476).gu.Popup;return(0,n.jsxs)("div",{...a(398276).A.props(r,!C&&s,a(139424).A.isMobile?[l,N?d:((e,t)=>[{kZCmMZ:null!=e?"xnvo3vl":e,kwRFfy:null!=t?"x120eax6":t,$$css:!0},{"--x-paddingInlineStart":"number"==typeof e?e+"px":null!=e?e:void 0,"--x-p
3addingInlineEnd":"number"==typeof t?t+"px":null!=t?t:void 0}])(R,A)]:o,b,{$$css:!0,className:"hide-scrollbar"}),children:[(0,n.jsx)("div",{role:"tablist",...a(398276).A.props(u,"object"==typeof b&&b&&"flexDirection"in b&&{flexDirection:b.flexDirection}),children:e.map((e,r)=>{let s=r===t;return(0,n.jsx)(i.Fragment,{children:(0,n.jsxs)("div",{...a(398276).A.props(c,v,s&&p,s&&h.selectedTab,s&&w),children:[(0,n.jsx)(a(988022).p,{role:"tab",style:[j,s&&k],onClick:()=>x(r),disabled:I,"aria-selected":s,id:y(D,r),"aria-controls":g(D,r),colorPalette:s?void 0:"gray",children:e}),s?(0,n.jsx)("div",{...a(398276).A.props(m,S)}):void 0]},`tabButton-${r}`)},r)})}),f?(0,n.jsx)("div",{className:"x1iyjqo2 x78zum5 x6s0dn4 x13a6bvl x1b8rd1j",children:f}):void 0]})});a.d(t,{Jy:()=>g,vU:()=>y},{LZ:x})},941248(e,t,a){function i(e){let{environment:t,data:i}=e;return a(218744).default.checkGate({gateName:"send_temporary_password_authenticated_endpoint"})?t.api.callApi({eventName:"sendTemporaryPasswordAuthenticated",environment:t,data:i}):t.api.callApi({eventName:"sendTemporaryPassword",environment:t,data:i})}a.d(t,{o:()=>i})},499748(e,t,a){function i(e,t){return(0,a(201790).httpRequest)({url:`/__admin/${e}`,method:"POST",data:t,format:"json"})}async function n(e){return i("loginAsUser",e)}async function r(e){return i("logoutAsUser",e)}async function s(e){if(!await a(128190).getGhostAdminUserId(e))return void a(945403).y5({environment:e,logoutOrigin:a(881272).d.AdminActionSelfLogout});if("success"===(await r({})).type){let t=e.currentUser.id;t&&(await a(79884).KB.clearForUser(t),await a(527905).s({userId:t})),a(800198).Router.navigate({environment:e,url:"/__admin"}),window.location.reload();return}a(647095).rG({message:"There was an issue logging back in to your admin account. Logging out fully.",onAccept:()=>{a(945403).y5({environment:e,logoutOrigin:a(881272).d.AdminLogoutFallThrough})}})}a.d(t,{A:()=>s,P:()=>n})},845311(e,t,a){async function i(e){let{environment:t,userId:i}=e;await a(158752).Pq({environment:t,isNewSignup:!1,userId:i,previousPersistedUserId:"admin",loginMethod:"admin"}),(0,a(318620).Y)(a(168962).JZ.root)}a.d(t,{N:()=>i})},688211(e,t,a){let i;a.d(t,{_P:()=>oz,sK:()=>oO,mu:()=>oH,qO:()=>oZ,L4:()=>o$,JZ:()=>oq,nZ:()=>oG});var n=()=>
3a(960408);a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(974864),a(159952);var r=a(635790),s=()=>a(832375);function o(e){return(0,a(540342).Yi)({customerId:e,livemode:!0})}function l(e,t){return(0,a(540342).gl)({customerId:e,contractId:t,livemode:!0})}var d=a(440302);let c=(0,a(327219).YK)({limitHistoryUnavailable:{id:"adminAIAgentDailyCreditUsageLookup.limitHistoryUnavailable",defaultMessage:"Credit-limit history is temporarily unavailable. Usage data is still shown below."},recordedLimitExplanation:{id:"adminAIAgentDailyCreditUsageLookup.recordedLimitExplanation",defaultMessage:"Recorded limits come from custom agent limit-change events. Workspace default changes are not included."},dailyUsageAndLimitTitle:{id:"adminAIAgentDailyCreditUsageLookup.dailyUsageAndLimitTitle",defaultMessage:"Daily Usage and Limit"},recordedCreditLimitHeader:{id:"adminAIAgentDailyCreditUsageLookup.recordedCreditLimitHeader",defaultMessage:"Recorded credit limit"},unlimited:{id:"adminAIAgentDailyCreditUsageLookup.unlimited",defaultMessage:"Unlimited"},notRecorded:{id:"adminAIAgentDailyCreditUsageLookup.notRecorded",defaultMessage:"Not recorded"},unavailable:{id:"adminAIAgentDailyCreditUsageLookup.unavailable",defaultMessage:"Unavailable"}});a(1310);let p=(0,a(327219).YK)({title:{id:"adminAICreditPurchasePaymentSummary.title",defaultMessage:"Credit Purchase Payment Summary"},grantedCredits:{id:"adminAICreditPurchasePaymentSummary.grantedCredits",defaultMessage:"Granted: {credits, plural, one {# credit} other {# credits}}"},pendingCredits:{id:"adminAICreditPurchasePaymentSummary.pendingCredits",defaultMessage:"Awaiting payment: {credits, plural, one {# credit} other {# credits}}"},pendingCreditsExplanation:{id:"adminAICreditPurchasePaymentSummary.pendingCreditsExplanation",defaultMessage:"Renewal credits remain available during dunning. Awaiting payment counts only ungranted one-off purchases."},emptyState:{id:"adminAICreditPurchasePaymentSummary.emptyState",defaultMessage:"No credit purchase attempts in this service period"},purchaseDateHeader:{id:"adminAICreditPurchasePaymentSummary.purchaseDateHeader",defaultMessage:"Purchase / Attempt Date"},creditsHeader:{id:"adminAICreditPurchasePaymentSummary.creditsHeader",defaultMessage:"Credits"},paymentHeader:{id:"adminAICreditPurchasePaymentSummary.paymentHeader",defaultMessage:"Payment"},stripeInvoiceIdHeader:{id:"adminAICreditPurchasePaymentSummary.stripeInvoiceIdHeader",defaultMessage:"Stripe Invoice ID"},dateUtc:{id:"adminAICreditPurchasePaymentSummary.dateUtc",defaultMessage:"{date} UTC"},statusPaid:{id:"adminAICreditPurchasePaymentSummary.statusPaid",defaultMessage:"Paid"},statusUnpaid:{id:"adminAICreditPurchasePaymentSummary.statusUnpaid",defaultMessage:"Unpaid"}});function m(e){let{summary:t}=e,i=(0,a(327219).tz)();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:i.formatMessage(p.title)})}),(0,d.jsx)("div",{style:a(469181).R7.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(p.grantedCredits,{credits:t.grantedCredits})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(p.pendingCredits,{credits:t.pendingCredits})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.subtext,children:i.formatMessage(p.pendingCreditsExplanation)})})]})}),0===t.attempts.length?(0,d.jsx)("div",{style:a(469181).R7.emptyState,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(p.emptyState)})}):(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:i.formatMessage(p.purchaseDateHeader)})}),(0,d.jsx)("th",{style:a(469181).R7.th,children:(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:i.formatMessage(p.creditsHeader)})}),(0,d.jsx)("th",{style:a(469181).R7.th,children:(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:i.formatMessage(p.paymentHeader)})}),(0,d.jsx)("th",{style:a(469181).R7.th,children:(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:i.formatMessage(p.stripeInvoiceIdHeader)})})]})}),(0,d.jsx)("tbody",{children:t.attempts.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:i.formatMessage(p.dateUtc,{date:(0,a(469181).r6)(e.attemptedAtMs)})})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,a(469181).Ql)(e.creditAmount)})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(u,{isPaid:e.isPaid,paymentIntentStatus:e.paymentIntentStatus})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.stripeInvoiceId})})]},e.stripeInvoiceId))})]})})]})}function u(e){let{isPaid:t,paymentIntentStatus:i}=e,n=(0,a(327219).tz)(),r=t?a(469181).R7.allowancePillOk:a(469181).R7.allowancePillBlocked,s=n.formatMessage(t?p.statusPaid:p.statusUnpaid);return(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,d.jsx)("span",{style:r,children:s})}),i?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.subtext,children:i})}):void 0]})}let h=(0,a(327219).YK)({title:{id:"adminAICreditRefundSummary.title",defaultMessage:"Credit Refunds"},refundedCredits:{id:"adminAICreditRefundSummary.refundedCredits",defaultMessage:"Refunded: {credits, plural, one {# credit} other {# credits}}"}
3,periodExplanation:{id:"adminAICreditRefundSummary.periodExplanation",defaultMessage:"Only landed refunds attributed to this service period are shown. Attribution uses Refund Date when provided; otherwise it uses the billing service period recorded by the refund, falling back to execution time for historical entries."},emptyState:{id:"adminAICreditRefundSummary.emptyState",defaultMessage:"No landed credit refunds in this service period"},attributedDateHeader:{id:"adminAICreditRefundSummary.attributedDateHeader",defaultMessage:"Attributed Date"},executedDateHeader:{id:"adminAICreditRefundSummary.executedDateHeader",defaultMessage:"Executed"},creditsHeader:{id:"adminAICreditRefundSummary.creditsHeader",defaultMessage:"Credits"},adminHeader:{id:"adminAICreditRefundSummary.adminHeader",defaultMessage:"Admin"},reasonHeader:{id:"adminAICreditRefundSummary.reasonHeader",defaultMessage:"Reason"},dateUtc:{id:"adminAICreditRefundSummary.dateUtc",defaultMessage:"{date} UTC"}});function y(e){let{summary:t}=e,i=(0,a(327219).tz)();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:i.formatMessage(h.title)})}),(0,d.jsx)("div",{style:a(469181).R7.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(h.refundedCredits,{credits:t.refundedCredits})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.subtext,children:i.formatMessage(h.periodExplanation)})})]})}),0===t.refunds.length?(0,d.jsx)("div",{style:a(469181).R7.emptyState,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(h.emptyState)})}):(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)(g,{message:h.attributedDateHeader}),(0,d.jsx)(g,{message:h.executedDateHeader}),(0,d.jsx)(g,{message:h.creditsHeader}),(0,d.jsx)(g,{message:h.adminHeader}),(0,d.jsx)(g,{message:h.reasonHeader})]})}),(0,d.jsx)("tbody",{children:t.refunds.map(e=>{var t,n;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:i.formatMessage(h.dateUtc,{date:(0,a(469181).r6)(e.attributedAtMs)})})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:i.formatMessage(h.dateUtc,{date:(0,a(469181).r6)(e.executedAtMs)})})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,a(469181).Ql)(e.creditAmount)})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(null==(t=e.adminUser)?void 0:t.email)??e.adminUserId}),null!=(n=e.adminUser)&&n.email?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.subtext,children:e.adminUserId})}):void 0]})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.reason})})]},e.id)})})]})})]})}function g(e){let t=(0,a(327219).tz)();return(0,d.jsx)("th",{style:a(469181).R7.th,children:(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:t.formatMessage(e.message)})})}function x(e){let{csvFilename:t,csvRows:i}=e,n=(0,r.useCallback)(()=>{(0,a(216736).WN)({blob:new Blob([(0,a(318851).A)(i,{escape_formulas:!0,cast:{number:e=>({value:String(e),escape_formulas:!1})}})],{type:"text/csv;charset=utf-8"}),filename:t})},[t,i]);return(0,d.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,marginTop:24,marginBottom:12,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Daily Usage"}),(0,d.jsx)(a(548436).A,{size:"sm",iconLeading:a(782558)._,onClick:n,children:"Download CSV"})]})}let f={monthly:0,trial:0,promotional:0,annual:0,onDemand:0},{SalesAssistedDailyUsageSection:b,SelfServeDailyUsageSection:v,StatusBadge:j}={SalesAssistedDailyUsageSection:function({csvFilename:e,spaceDailyUsage:t,contractDailyUsage:i,contractDailyUsageByBucket:n}){var r,s,o;let l,c,p,m,u,h,y,g=(r=t,s=i,o=n,l=Array.from(new Set([...r.map(e=>e.date),...s.map(e=>e.date)])).sort((e,t)=>
3e-t),c=new Map(r.map(e=>[e.date,e.usage])),p=new Map(s.map(e=>[e.date,e.usage])),m=new Map((o??[]).map(e=>[e.date,e])),u=0,h=0,y=f,l.map(e=>{let t=c.get(e)??u,a=p.get(e)??h,i=m.get(e),n=i?{monthly:i.monthly,trial:i.trial,promotional:i.promotional??0,annual:i.annual,onDemand:i.onDemand}:y;return u=t,h=a,y=n,{date:e,spaceCumulative:t,contractCumulative:a,buckets:n}}));if(0===g.length)return null;let b=t.length>0,v=void 0!==n&&n.length>0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x,{csvFilename:e,csvRows:[["Date (UTC)",...b?["Space cumulative"]:[],"Contract cumulative",...v?["Monthly","Trial","Promotional","Annual","On-Demand"]:[]],...g.map(e=>[new Date(e.date).toISOString(),...b?[e.spaceCumulative]:[],e.contractCumulative,...v?[e.buckets.monthly,e.buckets.trial,e.buckets.promotional,e.buckets.annual,e.buckets.onDemand]:[]])]}),(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Date"}),b?(0,d.jsx)("th",{style:a(469181).R7.th,children:"Space cumulative"}):void 0,(0,d.jsx)("th",{style:a(469181).R7.th,children:"Contract cumulative"}),v?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Monthly"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Trial"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Promotional"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Annual"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"On-Demand"})]}):void 0]})}),(0,d.jsx)("tbody",{children:g.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).r6)(e.date)}),b?(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.spaceCumulative)}):void 0,(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.contractCumulative)}),v?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.buckets.monthly)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.buckets.trial)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.buckets.promotional)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.buckets.annual)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.buckets.onDemand)})]}):void 0]},e.date))})]})})]})},SelfServeDailyUsageSection:function({csvFilename:e,dailyUsage:t}){return 0===t.length?null:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(x,{csvFilename:e,csvRows:[["Date (UTC)","Daily","Cumulative"],...t.map((e,a)=>[new Date(e.date).toISOString(),e.usage-(a>0?t[a-1].usage:0),e.usage])]}),(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Date"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Daily"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Cumulative"})]})}),(0,d.jsx)("tbody",{children:t.map((e,i)=>{let n=i>0?t[i-1].usage:0;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).r6)(e.date)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.usage-n)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.usage)})]},e.date)})})]})})]})},StatusBadge:function({status:e}){let t="live"===e;return(0,d.jsxs)("div",{style:t?a(469181).R7.statusLive:a(469181).R7.statusDisabled,children:[(0,d.jsx)("div",{style:{...a(469181).R7.dot,backgroundColor:t?a(632079).Tj.blue.icon.accentPrimary:a(632079).Tj.text.tertiary}}),t?"Live":"deleted"===e?"Deleted":"Disabled"]})}};function k(e){let{data:t,agentPage:i,isAgentPageLoading:n,userBreakdownPage:s,isUserBreakdownPageLoading:o,onAgentPreviousPage:l,onAgentNextPage:c,onUserBreakdownPreviousPage:p,onUserBreakdownNextPage:u}=e,h=t.usesMetronome?t.contractUsageSummary:t.usageSummary,g=t.usesMetronome?"Contract Usage Summary":"Usage Summary",x=h.monthlyCredits,f=h.trialGrants??[],k=h.promotionalGrants??[],S=h.annualCredits,w=t.usesMetronome?t.affiliatedWorkspaces:void 0,I=t.usesMetronome?t.contractUsage:void 0,C=t.usesMetronome?t.contractCreditSummary:void 0,D=t.usesMetronome?t.contractInfo:void 0,T=r.useMemo(()=>{let e=new Map;for(let t of w??[])e.set(t.spaceId,{spaceName:t.spaceName,onDemandUsageLimit:t.onDemandUsageLimit,monthlyUsageLimit:t.monthlyUsageLimit});return e},[w]),R=`ai-credit-daily-usage-${t.spaceId}-${new Date(t.selectedPeriod.start).toISOString().slice(0,10)}-${new Date(t.selectedPeriod.displayEnd).toISOString().slice(0,10)}.csv`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:g})}),(0,d.jsx)("div",{style:a(469181).R7.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Used in period:"})," ",(0,a(469181).Ql)(h.creditsUsed)]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Remaining balance:"})," ",(0,a(469181).Ql)(h.creditsRemaining)]}),(0,d.jsx)("div",{style:a(469181).R7.cardDivider}),void 0!==x?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Monthly credit usage:"})," ",(0,a(469181).Ql)(x.used)," /"," ",(0,a(469181).Ql)(x.limit)]}):void 0,f.map(e=>(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Trial credit usage:"})," ",(0,a(469181).Ql)(e.usageTotal)," / ",(0,a(469181).Ql)(e.limit),(0,d.jsxs)("span",{style:a(469181).R7.subtext,children:[" ","(access schedule: ",(0,a(469181).vj)(e),")"]})]},`${e.startMs}-${e.endMs}`)),k.map((e,t)=>(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Promotional credit usage:"})," ",(0,a(469181).Ql)(e.usageTotal)," / ",(0,a(469181).Ql)(e.limit),(0,d.jsxs)("span",{style:a(469181).R7.subtext,children:[" ","(source: ",e.source??"Unknown","; access schedule:"," ",(0,a(469181).vj)(e),")"]})]},`promotional-${e.startMs}-${e.endMs}-${e.source??""}-${t}`)),S?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Annual credit usage:"})," ",(0,a(469181).Ql)(S.used)," /"," ",(0,a(469181).Ql)(S.limit),(0,d.jsxs)("span",{style:a(469181).R7.subtext,children:[" ","(whole grant to date, not just this period",S.window?`; access schedule: ${(0,a(469181).vj)(S.window)}`:"",")"]})]}):void 0]})}),t.creditPurchasePaymentSummary?(0,d.jsx)(m,{summary:t.creditPurchasePaymentSummary}):void 0,t.creditRefundSummary?(0,d.jsx)(y,{summary:t.creditRefundSummary}):void 0,I&&Object.keys(I).length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Contract Usage by Workspace"})}),(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Worksp
3ace Name"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Workspace ID"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Total in Period"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Monthly Limit"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"On-Demand"})]})}),(0,d.jsx)("tbody",{children:Object.entries(I).map(([e,t])=>{let i=T.get(e);return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(null==i?void 0:i.spaceName)??"—"}),(0,d.jsx)("td",{style:a(469181).R7.td,children:e}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(t.usageInPeriod)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).C$)(null==i?void 0:i.monthlyUsageLimit)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).lj)(null==i?void 0:i.onDemandUsageLimit)})]},e)})}),(0,d.jsx)("tfoot",{children:(0,d.jsxs)("tr",{style:{fontWeight:a(699422).Wy.semibold},children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:"Total"}),(0,d.jsx)("td",{style:a(469181).R7.td}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(Object.values(I).reduce((e,t)=>e+t.usageInPeriod,0))}),(0,d.jsx)("td",{style:a(469181).R7.td}),(0,d.jsx)("td",{style:a(469181).R7.td})]})})]})})]}):void 0,D?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Contract Info"})}),(0,d.jsx)("div",{style:a(469181).R7.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Contract ID:"})," ",D.contractId]}),D.externalId?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"External ID:"})," ",D.externalId]}):void 0,D.msaVersion?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"MSA Version:"})," ",D.msaVersion]}):void 0,(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Start:"})," ",(0,a(469181).r6)(D.startDate)]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Expiration:"})," ",(0,a(469181).r6)(D.expirationDate)]}),(null==C?void 0:C.annualUsageTotal)!==void 0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Annual Credit Usage (Total):"})," ",(0,a(469181).Ql)(C.annualUsageTotal),void 0!==C.annualLimit?` / ${(0,a(469181).Ql)(C.annualLimit)}`:""]}),C.annualRenewalDateMs?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Annual Credits Renewal:"})," ",(0,a(469181).r6)(C.annualRenewalDateMs)]}):void 0]}):void 0,(0,d.jsx)("div",{style:a(469181).R7.cardDivider}),void 0!==D.onDemandUsageLimit?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Contract On-Demand:"})," ",(0,a(469181).lj)(D.onDemandUsageLimit)]}):void 0,(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"On-Demand Usage (Quarterly):"})," ",(0,a(469181).Ql)((null==C?void 0:C.onDemandUsageTotal)??0)]}),null!=C&&C.onDemandNextBillingDateMs?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"On-Demand Next Billing Date:"})," ",(0,a(469181).r6)(C.onDemandNextBillingDateMs)]}):void 0]})})]}):void 0,(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Agent Breakdown"})}),0!==t.agentBreakdown.length||n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{...a(469181).R7.tableWrapper,...n&&{op
3acity:.5}},children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Agent Name"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Credits Consumed"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Runs"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Status"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Created By"})]})}),(0,d.jsx)("tbody",{children:t.agentBreakdown.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:e.agentName??"Unknown"}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.creditsConsumed)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.runCount)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:e.status?(0,d.jsx)(j,{status:e.status}):"—"}),(0,d.jsx)("td",{style:a(469181).R7.td,children:e.createdByName??"—"})]},e.agentId))})]})}),(0,d.jsxs)(a(4458).fI,{justifyContent:"flex-end",alignItems:"center",gap:8,paddingTop:8,children:[(0,d.jsx)("button",{style:t.topEntitiesPreviousCursor?a(469181).R7.paginationButton:a(469181).R7.paginationButtonDisabled,onClick:l,disabled:!t.topEntitiesPreviousCursor||n,children:"← Prev"}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:["Page ",i]}),(0,d.jsx)("button",{style:t.topEntitiesNextCursor?a(469181).R7.paginationButton:a(469181).R7.paginationButtonDisabled,onClick:c,disabled:!t.topEntitiesNextCursor||n,children:"Next →"})]})]}):(0,d.jsx)("div",{style:a(469181).R7.emptyState,children:"No custom agents found"}),t.userBreakdown.length>0||o?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Per-User Premium Spend"})}),(0,d.jsx)("div",{style:{...a(469181).R7.tableWrapper,...o&&{opacity:.5}},children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"User"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Premium Credits"})]})}),(0,d.jsx)("tbody",{children:t.userBreakdown.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:e.userName??"Unknown"}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.creditsConsumed)})]},e.userId))})]})}),(0,d.jsxs)(a(4458).fI,{justifyContent:"flex-end",alignItems:"center",gap:8,paddingTop:8,children:[(0,d.jsx)("button",{style:t.userBreakdownPreviousCursor?a(469181).R7.paginationButton:a(469181).R7.paginationButtonDisabled,onClick:p,disabled:!t.userBreakdownPreviousCursor||o,children:"← Prev"}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:["Page ",s]}),(0,d.jsx)("button",{style:t.userBreakdownNextCursor?a(469181).R7.paginationButton:a(469181).R7.paginationButtonDisabled,onClick:u,disabled:!t.userBreakdownNextCursor||o,children:"Next →"})]})]}):void 0,t.usesMetronome?(0,d.jsx)(b,{csvFilename:R,spaceDailyUsage:t.spaceUsageSummary.dailyUsage,contractDailyUsage:t.contractDailyUsage,contractDailyUsageByBucket:t.contractDailyUsageByBucket}):(0,d.jsx)(v,{dailyUsage:t.dailyUsage,csvFilename:R})]})}a(435368),a(976614),a(139583),a(765324);let S="used",w="limit",I={card:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:10,backgroundColor:a(632079).Tj.background.primary,padding:16,display:"flex",flexDirection:"column",gap:12},legend:{display:"flex",flexWrap:"wrap",columnGap:16,rowGap:6},legendRow:{display:"flex",alignItems:"center",gap:6},legendSwatch:{width:10,height:10,borderRadius:3,flexShrink:0},caption:{color:a(632079).Tj.text.tertiary},emptyText:{color:a(632079).Tj.text.secondary}};function C(e){let{history:t,selectedPeriod:i,rollingWindowDays:n}=e,s=Math.max(t.windowStartMs,t.windowEndMs-864e5*n),o=t.windowEndMs,l=i.start,c=Math.min(i.end,t.windowEndMs),p=t.windowStartMs>l,m=(0,r.useMemo)(()=>M(t.points,s,o),[t.points,s,o]),u=(0,r.useMemo)(()=>M(t.points,l,c),[t.points,l,c]);
3return void 0!==t.error?(0,d.jsx)("div",{style:I.card,children:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsx)("span",{style:I.emptyText,children:"Allowance history is unavailable right now (the warehouse read failed or timed out). The live status above is unaffected."})})}):0===m.data.length&&0===u.data.length?(0,d.jsx)("div",{style:I.card,children:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsx)("span",{style:I.emptyText,children:"No snapshot data for this rolling window or service period. Snapshots are recorded only when the user's AI usage is metered (and only for workspaces in the snapshot rollout), so this does not mean zero usage."})})}):(0,d.jsxs)("div",{style:I.card,children:[(0,d.jsx)(D,{title:`Rolling allowance${m.rollingWindow?` (${m.rollingWindow} window)`:""} — last ${n} days${n<=7?", hourly":""}`,model:m,usedKey:"rollingUsed",limitKey:"rollingLimit",startMs:s,endMs:o,gapFill:"zero",hourlyPoints:n<=7?t.points:void 0}),(0,d.jsx)(D,{title:`Monthly allowance — service period ${N(l)} to ${N(i.displayEnd)}`,model:u,usedKey:"billingPeriodUsed",limitKey:"billingPeriodLimit",startMs:l,endMs:c,gapFill:"carryForward"}),p?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsxs)("span",{style:I.caption,children:["Partial coverage: snapshot data for this period begins"," ",N(t.windowStartMs),"."]})}):void 0,(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsx)("span",{style:I.caption,children:"Peaks of the limiter counters (UTC) — hourly buckets for the 7-day rolling view, daily peaks otherwise. Quiet stretches record no snapshots: the rolling counter charts as zero (its window expired), while the cumulative monthly counter carries the last observed value forward. The limit line always shows the last known limit."})})]})}function D(e){let{title:t,model:i,usedKey:n,limitKey:s,startMs:o,endMs:l,gapFill:c,hourlyPoints:p}=e,m=(0,r.useMemo)(()=>{if(void 0===p)return;let e=p.filter(e=>e.bucketStartMs>=o&&e.bucketStartMs<l),t=e=>"rollingUsed"===n?e.rollingUsedMax:e.billingPeriodUsedMax,a=e=>"rollingUsed"===n?e.rollingLimit:e.billingPeriodLimit,i=e.filter(e=>void 0!==t(e)||void 0!==a(e));if(0===i.length)return[];let r=new Map(i.map(e=>[e.bucketStartMs,e])),s=36e5*Math.floor(o/36e5),d=36e5*Math.floor(Math.max(o,l-1)/36e5),c=i.map(a).find(e=>void 0!==e)??0,m=[];for(let e=s;e<=d;e+=36e5){let i=r.get(e),n=void 0===i?void 0:a(i);void 0!==n&&(c=n),m.push({ts:e,values:{[S]:(void 0===i?void 0:t(i))??0,[w]:c}})}return m},[p,n,o,l]),u=(0,r.useMemo)(()=>{if(void 0===p)return;let e=new Map;for(let t of p)e.set(t.bucketStartMs,{snapshotCount:t.snapshotCount,enforced:"rollingUsed"===n?t.rollingEnforced:t.billingPeriodEnforced});return e},[p,n]),h=(0,r.useCallback)(e=>{let t=null==u?void 0:u.get(e);return void 0===t?(0,d.jsx)("div",{children:"No snapshots this hour"}):(0,d.jsxs)("div",{children:[`${t.snapshotCount.toLocaleString()} snapshot${1===t.snapshotCount?"":"s"}`,t.enforced?" · RATE LIMITED":""]})},[u]),y=(0,r.useMemo)(()=>{if(!i.data.some(e=>
3void 0!==e.values[n]||void 0!==e.values[s]))return[];let e=new Map(i.data.map(e=>[e.ds,e.values])),t=Date.parse(A(o)),a=Date.parse(A(Math.max(o,l-1))),r=i.data.map(e=>e.values[s]).find(e=>void 0!==e)??0,d=0,p=[];for(let i=t;i<=a;i+=864e5){let t=e.get(A(i)),a=null==t?void 0:t[n],o=null==t?void 0:t[s];void 0!==o&&(r=o),void 0!==a&&(d=a),p.push({ds:A(i),values:{[S]:a??("carryForward"===c?d:0),[w]:r}})}return p},[i.data,n,s,o,l,c]),g=a(620107).O.colorful["0"]??a(620107).O.black["0"],x=a(620107).O.black["0"],f=(0,r.useMemo)(()=>[{key:S,stroke:g,fill:(0,a(650342).X4)(g,.15),renderLabel:e=>`Used: ${e.toLocaleString()}`},{key:w,stroke:x,fill:(0,a(650342).X4)(x,0),renderLabel:e=>`Limit: ${e.toLocaleString()}`}],[g,x]),b=(0,r.useMemo)(()=>{let e=new Map;for(let t of i.data)e.set(t.ds,{snapshotCount:t.values.snapshotCount,enforced:"rollingUsed"===n?t.values.rollingEnforced:t.values.billingPeriodEnforced,peakHourMs:"rollingUsed"===n?t.values.rollingPeakHourMs:t.values.billingPeriodPeakHourMs,hasSnapshot:void 0!==t.values[n]||void 0!==t.values[s]});return e},[i.data,n,s]),v=(0,r.useMemo)(()=>y.map(e=>e.ds).filter(e=>{var t;return(null==(t=b.get(e))?void 0:t.enforced)===!0}),[y,b]),j=(0,r.useCallback)(e=>{var t;let a=b.get(e);return void 0!==a&&a.hasSnapshot?(0,d.jsxs)("div",{children:[`${a.snapshotCount.toLocaleString()} snapshot${1===a.snapshotCount?"":"s"}`,void 0!==a.peakHourMs?` \xb7 peak at ${t=a.peakHourMs,`${new Date(t).toISOString().slice(11,16)} UTC`}`:"",a.enforced?" · RATE LIMITED":""]}):(0,d.jsx)("div",{children:"carryForward"===c?"No snapshots — last value carried forward":"No snapshots this day"})},[b,c]),k=(0,r.useMemo)(()=>{let e=m??y,t=Math.max(0,...e.map(e=>e.values[w]));if(t<=0)return;let a=Math.max(t,...e.map(e=>e.values[S])),i=a>2*t?t/2:t/4,n=[];for(let e=i;e<=a;e+=i)n.push(Math.round(e));return n},[y,m]);if(0===(m??y).length)return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",children:t}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsx)("span",{style:I.emptyText,children:"No snapshot data in this range."})})]});if(void 0!==m)return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",children:t}),(0,d.jsx)(a(629411).Y,{width:720,height:180,data:m,layers:f,curveType:"curveStepAfter",showTooltipPointsForAllLayers:!0,yTickValues:k,renderTooltipFooter:h}),(0,d.jsx)(T,{usedColor:g,limitColor:x,usedLabel:"Used (hourly peak)"}),(0,d.jsx)(R,{limitedDays:v})]});if(1===y.length){var C,D;let e=y[0];return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",children:t}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsxs)("span",{style:I.emptyText,children:[N(Date.parse(e.ds))," (so far): used"," ",null==(C=e.values[S])?void 0:C.toLocaleString()," of"," ",null==(D=e.values[w])?void 0:D.toLocaleString()," — the chart appears once the range spans more than one day."]})})]})}let M=y[0].ds,P=y[y.length-1].ds;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",children:t}),(0,d.jsx)(a(174356).TimeSeries,{width:720,height:180,startDate:M,endDate:P,data:y,layers:f,curveType:"curveStepAfter",showTooltipPointsForAllLayers:!0,yTickValues:k,renderTooltipFooter:j}),(0,d.jsx)(T,{usedColor:g,limitColor:x,usedLabel:"Used (daily peak)"}),(0,d.jsx)(R,{limitedDays:v})]})}function T(e){let{usedColor:t,limitColor:i,usedLabel:n}=e;return(0,d.jsxs)("div",{style:I.legend,children:[(0,d.jsxs)("div",{style:I.legendRow,children:[(0,d.jsx)("div",{style:{...I.legendSwatch,backgroundColor:t}}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:n})]}),(0,d.jsxs)("div",{style:I.legendRow,children:[(0,d.jsx)("div",{style:{...I.legendSwatch,backgroundColor:i}}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:"Limit in effect"})]})]})}function R(e){let{limitedDays:t}=e;return 0===t.length?null:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:(0,d.jsxs)("span",{style:I.caption,children:["Rate limited on:"," ",t.map(e=>N(Date.parse(e))).join(", ")]})})}function A(e){return new Date(e).toISOString().slice(0,10)}function N(e){return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",timeZone:"UTC"})}function M(e,t,a){let i,n=new Map;for(let r of e){if(r.bucketStartMs<t||r.bucketStartMs>=a)continue;let e=new Date(r.bucketStartMs).toISOString().slice(0,10),s=n.get(e);void 0===s&&(s={rollingUsed:0,rollingLimit:0,snapshotCount:0,rollingEnforced:!1,billingPeriodEnforced:!1},n.set(e,s)),(void 0===s.rollingPeakHourMs||r.rollingUsedMax>s.rollingUsed)&&(s.rollingPeakHourMs=r.bucketStartMs),s.rollingUsed=Math.max(s.rollingUsed,r.rollingUsedMax),s.rollingLimit=Math.max(s.rollingLimit,r.rollingLimit),s.snapshotCount+=r.snapshotCount,s.rollingEnforced=s.rollingEnforced||r.rollingEnforced,s.billingPeriodEnforced=s.billingPeriodEnforced||r.billingPeriodEnforced,void 0!==r.billingPeriodUsedMax&&((void 0===s.billingPeriodPeakHourMs||r.billingPeriodUsedMax>(s.billingPeriodUsed??0))&&(s.billingPeriodPeakHourMs=r.bucketStartMs),s.billingPeriodUsed=Math.max(s.billingPeriodUsed??0,r.billingPeriodUsedMax)),void 0!==r.billingPeriodLimit&&(s.billingPeriodLimit=Math.max(s.billingPeriodLimit??0,r.billingPeriodLimit)),i=i??r.rollingWindow}return{data:Array.from(n.entries()).map(([e,t])=>({ds:e,values:t})).sort((e,t)=>
3e.ds<t.ds?-1:1),rollingWindow:i}}function P(e){let{status:t,history:a,selectedPeriod:i,historyDays:n,isLoading:r,onHistoryDaysChange:s}=e;return(0,d.jsxs)(d.Fragment,{children:[t?(0,d.jsx)(V,{status:t}):void 0,a?(0,d.jsx)(E,{history:a,selectedPeriod:i,historyDays:n,isLoading:r,onHistoryDaysChange:s}):void 0]})}function V(e){let{status:t}=e,i="rate_limited"===t.status?(0,d.jsx)("span",{style:a(469181).R7.allowancePillBlocked,children:"Blocked"}):"within_limit"===t.status?(0,d.jsx)("span",{style:a(469181).R7.allowancePillOk,children:"Within limits"}):"not_in_workspace"===t.status?(0,d.jsx)("span",{style:a(469181).R7.allowancePillBlocked,children:"Not in this workspace"}):(0,d.jsx)("span",{style:a(469181).R7.allowancePillNeutral,children:"No allowance applies"}),n=[t.rollingAllowance?{label:`Rolling (${t.rollingAllowance.window})`,allowance:t.rollingAllowance,blocking:"rolling"===t.limitedBy,resets:void 0!==t.rollingAllowance.fullResetInSeconds?`fully resets in ${B(t.rollingAllowance.fullResetInSeconds)}`:"—"}:void 0,t.monthlyAllowance?{label:"Monthly (billing period)",allowance:t.monthlyAllowance,blocking:"billing_period"===t.limitedBy,resets:`resets ${(0,a(469181).r6)(Date.parse(t.monthlyAllowance.periodEndsAt))} (UTC)`}:void 0].filter(e=>void 0!==e);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Notion AI Usage Allowances"})}),(0,d.jsx)("div",{style:a(469181).R7.card,children:(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[i,t.meterOnlyPreview?(0,d.jsx)("span",{style:a(469181).R7.allowancePillNeutral,children:"Meter-only preview — nothing blocks"}):void 0,(0,d.jsxs)("span",{style:a(469181).R7.subtext,children:["User: ",t.userId]})]}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:t.summary}),"rate_limited"===t.status?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsxs)("span",{style:a(469181).R7.allowanceOverLimit,children:["AI available again"," ",void 0!==t.retryAfterSeconds?`in ${B(t.retryAfterSeconds)}`:"when the window resets",t.usageResumesAt?` (${(0,a(469181).r6)(Date.parse(t.usageResumesAt))} UTC)`:""]})}):void 0,n.length>0?(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Allowance"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Used"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Limit"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"% Used"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Resets"})]})}),(0,d.jsx)("tbody",{children:n.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsxs)("td",{style:a(469181).R7.td,children:[e.label,e.blocking?(0,d.jsxs)("span",{style:a(469181).R7.allowanceOverLimit,children:[" ","← blocking"]}):void 0]}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.allowance.used)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.allowance.limit)}),(0,d.jsxs)("td",{style:e.allowance.percentUsed>=100?{...a(469181).R7.td,...a(469181).R7.allowanceOverLimit}:a(469181).R7.td,children:[e.allowance.percentUsed,"%"]}),(0,d.jsx)("td",{style:a(469181).R7.td,children:e.resets})]},e.label))})]})}):void 0]})})]})}function E(e){let{history:t,selectedPeriod:i,historyDays:n,isLoading:r,onHistoryDaysChange:s}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Usage Allowance History"})}),(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",marginBottom:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.label,children:"Rolling history window:"})}),(0,d.jsxs)("select",{style:a(469181).R7.select,value:n,onChange:s,disabled:r,children:[(0,d.jsx)("option",{value:7,children:"Last 7 days (hourly)"}),(0,d.jsx)("option",{value:30,children:"Last 30 days"}),(0,d.jsx)("option",{value:90,children:"Last 90 days"})]}),r?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Loading..."}):void 0]}),(0,d.jsx)(C,{history:t,selectedPeriod:i,rollingWindowDays:n})]})}function B(e){let t=Math.floor(e/3600),a=Math.round(e%3600/60);return 0===t&&0===a?"<1m":0===t?`${a}m`:0===a?`${t}h`:`${t}h ${a}m`}let L={container:{maxWidth:1200},header:{marginBottom:16},card:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},sectionTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:12,marginTop:24},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"start",paddingBlock:8,paddingInline:12,borderBottom:`2px solid ${a(632079).Tj.border.secondary}`,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium},td:{paddingBlock:8,paddingInline:12,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,fontSize:13},label:{fontWeight:a(699422).Wy.semibold},tableWrapper:{overflowX:"auto"},cardDivider:{borderTop:`1px solid ${a(632079).Tj.border.secondary}`,marginBlock:10},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary},badge:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:a(699422).Wy.semibold},badgeActive:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.accentPrimary},badgeInactive:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary},badgeWarning:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.accentPrimary},badgePrimary:{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.accentPrimary},syncButton:{padding:"6px 12px",borderRadius:6,border:`1px solid ${a(632079).Tj.border.secondary}`,backgroundColor:a(632079).Tj.background.primary,cursor:"pointer",fontSize:12,fontWeight:a(699422).Wy.medium},segmentRow:{backgroundColor:a(632079).Tj.background.tertiary},segmentCell:{paddingBlock:4,paddingInline:12,fontSize:11,color:a(632079).Tj.text.secondary,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},sideBySide:{display:"flex",gap:16,alignItems:"flex-start"},sideBySideColumn:{flex:1,minWidth:0},dateMismatch:{fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.yellow.text.accentPrimary,backgroundColor:a(632079).Tj.yellow.background.primary,padding:"1px 6px",borderRadius:4},subtext:{fontSize:11,color:a(632079).Tj.text.tertiary},toggleIcon:{fontSize:12},sectionHeader:{marginBottom:8}};function _(){return"https://notion.lightning.force.com"}
3function U(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC",timeZoneName:"short"})}function W(e){return 0===e?"🚫":-1===e?"✅":`\u2705 ${e.toLocaleString()}`}function F(e){return void 0===e?"Uncapped":e.toLocaleString()}let{StatusBadge:K,WarningBadge:$}={StatusBadge:function({active:e,label:t}){return(0,d.jsx)("span",{style:{...L.badge,...e?L.badgeActive:L.badgeInactive},children:t??(e?"Active":"Inactive")})},WarningBadge:function({label:e}){return(0,d.jsx)("span",{style:{...L.badge,...L.badgeWarning},children:e})}};function O({subscriptions:e}){return(0,d.jsx)("div",{style:L.tableWrapper,children:(0,d.jsxs)("table",{style:L.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:L.th,children:"Product"}),(0,d.jsx)("th",{style:L.th,children:"Code"}),(0,d.jsx)("th",{style:L.th,children:"Qty"}),(0,d.jsx)("th",{style:L.th,children:"Net Price"}),(0,d.jsx)("th",{style:L.th,children:"Currency"})]})}),(0,d.jsx)("tbody",{children:e.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:L.td,children:e.productName}),(0,d.jsx)("td",{style:L.td,children:e.productCode}),(0,d.jsx)("td",{style:L.td,children:e.quantity.toLocaleString()}),(0,d.jsx)("td",{style:L.td,children:e.netPrice.toLocaleString(void 0,{minimumFractionDigits:2,maximumFractionDigits:2})}),(0,d.jsx)("td",{style:L.td,children:e.subscriptionCurrency})]},e.subscriptionId))})]})})}function z({history:e,spaceNames:t}){let i=r.useMemo(()=>{let t=new Map;for(let a of e){let e=t.get(a.space_id);e?e.push(a):t.set(a.space_id,[a])}return t},[e]);return(0,d.jsx)(a(4458).VP,{gap:16,children:[...i.entries()].map(([e,i])=>{let n=t[e]??e;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:L.sectionHeader,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:n}),t[e]?(0,d.jsx)("div",{style:L.subtext,children:e}):void 0]}),(0,d.jsx)("div",{style:L.tableWrapper,children:(0,d.jsxs)("table",{style:L.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:L.th,children:"Created"}),(0,d.jsx)("th",{style:L.th,children:"Primary"}),(0,d.jsx)("th",{style:L.th,children:"On-Demand"}),(0,d.jsx)("th",{style:L.th,children:"Monthly Limit"}),(0,d.jsx)("th",{style:L.th,children:"Start"}),(0,d.jsx)("th",{style:L.th,children:"Expiration"}),(0,d.jsx)("th",{style:L.th,children:"Billing Contract ID"})]})}),(0,d.jsx)("tbody",{children:i.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:L.td,children:U(e.created_timestamp)}),(0,d.jsx)("td",{style:L.td,children:e.is_primary?"✔":"✖"}),(0,d.jsx)("td",{style:L.td,children:W(e.ondemand_usage_limit)}),(0,d.jsx)("td",{style:L.td,children:F(e.monthly_usage_limit)}),(0,d.jsx)("td",{style:L.td,children:U(e.start_timestamp)}),(0,d.jsx)("td",{style:L.td,children:U(e.expiration_timestamp)}),(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("span",{style:L.subtext,children:e.billing_contract_id})})]},e.id))})]})})]},e)})})}function G({diag:e}){return(0,d.jsx)("div",{style:L.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:e.spaceName??e.spaceId}),e.spaceName?(0,d.jsx)("div",{style:L.subtext,children:e.spaceId}):void 0,e.error?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)("span",{style:{...L.badge,...L.badgeInactive,display:"inline"},children:["Error: ",e.error]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Uses Metronome Reporting:"})," ",e.usesMetronomeReporting?"✔ Yes":"✖ No"]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Service Period Start:"})," ",e.servicePeriodStartMs?U(e.servicePeriodStartMs):"—"]}),(0,d.jsx)("div",{style:L.cardDivider}),e.customAgents?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"custom_agents:"})," ",(0,d.jsx)(q,{type:e.customAgents.type})]}),"unavailable"===e.customAgents.type&&e.customAgents.upsell?(0,d.jsxs)("div",{style:L.subtext,children:["upsell: ",JSON.stringify(e.customAgents.upsell)]}):void 0]}):void 0,e.premiumCreditUsage?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"premium_credit_usage:"})," ",(0,d.jsx)(q,{type:e.premiumCreditUsage.type})]}),e.premiumCreditUsage.limit?(0,d.jsxs)("div",{style:L.subtext,children:["limit: ",JSON.stringify(e.premiumCreditUsage.limit)]}):void 0,"unavailable"===e.premiumCreditUsage.type&&e.premiumCreditUsage.upsell?(0,d.jsxs)("div",{style:L.subtext,children:["upsell: ",JSON.stringify(e.premiumCreditUsage.upsell)]}):void 0]}):void 0]})]})})}function q({type:e}){return(0,d.jsx)("span",{style:{...L.badge,..."available"===e?L.badgeActive:L.badgeInactive},children:"available"===e?"AVAILABLE":"UNAVAILABLE"})}
3let{BillingContractCard:H,BillingContractHistorySection:Z,CollapsibleAuditLog:J,MetronomeThresholdCard:Q,PfaDiagnosticsSection:Y,SalesforceContractCard:X}={BillingContractCard:function({contract:e,isActive:t,isInLateRenewalPeriod:i,contractSpaces:n,spaceNamesBySpaceId:r}){return(0,d.jsxs)("div",{style:L.card,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"ID:"})," ",e.id]}),e.external_id?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"External ID:"})," ",e.external_id]}):void 0,(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Account Name:"})," ",e.account_name]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Status:"})," ",e.status," ",void 0!==t?(0,d.jsx)(K,{active:t}):void 0,i?(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsx)($,{label:"Late Renewal Period"})]}):void 0]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"MSA Version:"})," ",e.msa_version]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"On-Demand:"})," ",W(e.ondemand_usage_limit)]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Start:"})," ",U(e.start_timestamp)]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Expiration:"})," ",U(e.expiration_timestamp)]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Metronome Customer ID:"})," ",(0,d.jsx)("a",{href:o(e.metronome_customer_id),target:"_blank",rel:"noopener noreferrer",children:e.metronome_customer_id})]}),e.metronome_contract_id?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Metronome Contract ID:"})," ",(0,d.jsx)("a",{href:l(e.metronome_customer_id,e.metronome_contract_id),target:"_blank",rel:"noopener noreferrer",children:e.metronome_contract_id})]}):void 0,(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Provider:"})," ",e.provider]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Created:"})," ",U(e.created_timestamp)]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Last Updated:"})," ",U(e.updated_timestamp)]})]}),n&&n.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{...L.sectionTitle,marginTop:16},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,d.jsxs)("span",{style:L.label,children:["Workspaces (",n.length,")"]})})}),(0,d.jsx)("div",{style:L.tableWrapper,children:(0,d.jsxs)("table",{style:L.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:L.th,children:"Workspace"}),(0,d.jsx)("th",{style:L.th,children:"On-Demand"}),(0,d.jsx)("th",{style:L.th,children:"Monthly Limit"}),(0,d.jsx)("th",{style:L.th,children:"Start"}),(0,d.jsx)("th",{style:L.th,children:"Expiration"})]})}),(0,d.jsx)("tbody",{children:n.map(t=>{let a=t.start_timestamp!==e.start_timestamp,i=t.expiration_timestamp!==e.expiration_timestamp;return(0,d.jsxs)("tr",{children:[(0,d.jsxs)("td",{style:L.td,children:[(0,d.jsxs)("div",{children:[(null==r?void 0:r[t.space_id])??t.space_id," ",(0,d.jsx)(K,{active:t.isActive}),t.is_primary?(0,d.jsxs)(d.Fragment,{children:[" ",(0,d.jsx)("span",{style:{...L.badge,...L.badgePrimary},children:"Primary"})]}):void 0]}),null!=r&&r[t.space_id]?(0,d.jsx)("div",{style:L.subtext,children:t.space_id}):void 0]}),(0,d.jsx)("td",{style:L.td,children:W(t.ondemand_usage_limit)}),(0,d.jsx)("td",{style:L.td,children:F(t.monthly_usage_limit)}),(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("span",{style:a?L.dateMismatch:void 0,children:U(t.start_timestamp)})}),(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("span",{style:i?L.dateMismatch:void 0,children:U(t.expiration_timestamp)})})]},t.id)})})]})})]}):void 0]})},SalesforceContractCard:function({contract:e}){var t,i;return(0,d.jsxs)("div",{style:L.card,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"ID:"})," ",(0,d.jsx)("a",{href:(t=e.contractId,`${_()}/lightning/r/Contract/${t}/view`),target:"_blank",rel:"noopener noreferrer",children:e.contractId})]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Contract Number:"})," ",e.contractNumber]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Status:"})," ",e.status," ",(0,d.jsx)(K,{active:"Activated"===e.status})]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Account:"})," ",(0,d.jsxs)("a",{href:(i=e.accountId,`${_()}/lightning/r/Account/${i}/view`),target:"_blank",rel:"noopener noreferrer",children:[e.accountName," 
3(",e.accountId,")"]})]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"MSA Version:"})," ",e.msaVersion??"—"]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Contract Term:"})," ",e.contractTerm," months"]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Start Date:"})," ",e.startDate]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"End Date:"})," ",e.endDate]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Metronome Customer ID:"})," ",(0,d.jsx)("a",{href:o(e.metronome_customer_id),target:"_blank",rel:"noopener noreferrer",children:e.metronome_customer_id})]}),e.metronome_contract_id?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Metronome Contract ID:"})," ",(0,d.jsx)("a",{href:l(e.metronome_customer_id,e.metronome_contract_id),target:"_blank",rel:"noopener noreferrer",children:e.metronome_contract_id})]}):void 0]}),e.workspaces.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{...L.sectionTitle,marginTop:16},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,d.jsxs)("span",{style:L.label,children:["Workspaces (",e.workspaces.length,")"]})})}),(0,d.jsx)("div",{style:L.tableWrapper,children:(0,d.jsxs)("table",{style:L.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:L.th,children:"Workspace ID"}),(0,d.jsx)("th",{style:L.th,children:"Salesforce ID"}),(0,d.jsx)("th",{style:L.th,children:"Primary"}),(0,d.jsx)("th",{style:L.th,children:"Effective Start"}),(0,d.jsx)("th",{style:L.th,children:"Effective End"})]})}),(0,d.jsx)("tbody",{children:e.workspaces.map((e,t)=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:L.td,children:e.workspaceId??"—"}),(0,d.jsx)("td",{style:L.td,children:e.salesforceId}),(0,d.jsx)("td",{style:L.td,children:e.isPrimary?"✔":"✖"}),(0,d.jsx)("td",{style:L.td,children:e.effectiveStartDate??"—"}),(0,d.jsx)("td",{style:L.td,children:e.effectiveEndDate??"—"})]},e.salesforceId??t))})]})})]}):void 0,e.subscriptions.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:{...L.sectionTitle,marginTop:16},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,d.jsxs)("span",{style:L.label,children:["Subscriptions (",e.subscriptions.length,")"]})})}),(0,d.jsx)(O,{subscriptions:e.subscriptions})]}):void 0]})},CollapsibleAuditLog:function({history:e,spaceNames:t}){let[i,n]=(0,r.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:{...L.sectionTitle,display:"flex",alignItems:"center",gap:8,cursor:"pointer",userSelect:"none"},onClick:()=>n(e=>!e),role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&n(e=>!e)},children:[(0,d.jsx)("span",{style:L.toggleIcon,children:i?"▼":"▶"}),(0,d.jsxs)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:["Contract Space Audit Log (",e.length," records)"]})]}),i?(0,d.jsx)(z,{history:e,spaceNames:t}):void 0]})},MetronomeThresholdCard:function({state:e}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:L.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Total Credit Balance:"})," ",e.total_credit_balance.toLocaleString()]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Credits in Overage:"})," ",e.credits_in_overage.toLocaleString()]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Last Updated:"})," ",U(e.last_updated_at)]}),(0,d.jsx)("div",{style:L.cardDivider}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Service Period Start:"})," ",U(e.service_period.start_timestamp)]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Service Period End:"})," ",U(e.service_period.end_timestamp)]})]})}),e.commits.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:L.sectionTitle,children:(0,d.jsxs)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:["Commits / Credits (",e.commits.length,")"]})}),(0,d.jsx)("div",{style:L.tableWrapper,children:(0,d.jsxs)("table",{style:L.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:L.th,children:"Product"}),(0,d.jsx)("th",{style:L.th,children:"Type"}),(0,d.jsx)("th",{style:L.th,children:"Priority"}),(0,d.jsx)("th",{style:L.th,children:"Total"}),(0,d.jsx)("th",{style:L.th,children:"Balance"}),(0,d.jsx)("th",{style:L.th,children:"Segments"})]})}),(0,d.jsx)("tbody",{children:e.commits.map(e=>(0,d.jsxs)(r.Fragment,{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:L.td,children:e.product_name}),(0,d.jsx)("td",{style:L.td,children:e.credit_or_commit_type}),(0,d.jsx)("td",{style:L.td,children:e.priority??"—"}),(0,d.jsx)("td",{style:L.td,children:e.total_quantity.toLocaleStr
3ing()}),(0,d.jsx)("td",{style:L.td,children:e.balance.toLocaleString()}),(0,d.jsx)("td",{style:L.td,children:e.segments.length})]}),e.segments.map(e=>(0,d.jsxs)("tr",{style:L.segmentRow,children:[(0,d.jsxs)("td",{style:L.segmentCell,colSpan:2,children:["└"," Segment ",e.segment_id.slice(0,8)]}),(0,d.jsx)("td",{style:L.segmentCell,children:e.quantity.toLocaleString()}),(0,d.jsxs)("td",{style:L.segmentCell,colSpan:3,children:[U(e.starting_at)," ","→"," ",U(e.ending_before)]})]},e.segment_id))]},e.credit_or_commit_id))})]})})]}):void 0]})},PfaDiagnosticsSection:function({diagnostics:e}){let[t,i]=(0,r.useState)(!0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:{...L.sectionTitle,display:"flex",alignItems:"center",gap:8,cursor:"pointer",userSelect:"none"},onClick:()=>i(e=>!e),role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&i(e=>!e)},children:[(0,d.jsx)("span",{style:L.toggleIcon,children:t?"▼":"▶"}),(0,d.jsxs)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:["PFA Diagnostics (",e.length," workspace",1===e.length?"":"s",")"]})]}),t?(0,d.jsx)(a(4458).VP,{gap:12,children:e.map(e=>(0,d.jsx)(G,{diag:e},e.spaceId))}):void 0]})},BillingContractHistorySection:function({contracts:e,syncingSalesforceContractId:t,onSyncSalesforce:i}){let[n,s]=(0,r.useState)(!1);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:{...L.sectionTitle,display:"flex",alignItems:"center",gap:8,cursor:"pointer",userSelect:"none"},onClick:()=>s(e=>!e),role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&s(e=>!e)},children:[(0,d.jsx)("span",{style:L.toggleIcon,children:n?"▼":"▶"}),(0,d.jsxs)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:["Billing Contract Audit Log (",e.length," records)"]}),(0,d.jsx)("div",{style:L.subtext,children:"Historical rows only (active shown above)"})]}),n?(0,d.jsx)("div",{style:L.tableWrapper,children:(0,d.jsxs)("table",{style:L.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:L.th,children:"ID"}),(0,d.jsx)("th",{style:L.th,children:"External ID"}),(0,d.jsx)("th",{style:L.th,children:"Status"}),(0,d.jsx)("th",{style:L.th,children:"MSA"}),(0,d.jsx)("th",{style:L.th,children:"Start / Expiration"}),(0,d.jsx)("th",{style:L.th,children:"Metronome Customer"}),(0,d.jsx)("th",{style:L.th,children:"Created"}),(0,d.jsx)("th",{style:L.th,children:"Last Updated"}),(0,d.jsx)("th",{style:L.th,children:"Sync"})]})}),(0,d.jsx)("tbody",{children:e.map(e=>{let a=e.external_id,n=void 0!==a&&t===a;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("span",{style:L.subtext,children:e.id})}),(0,d.jsx)("td",{style:L.td,children:a??"—"}),(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("div",{children:e.status})}),(0,d.jsx)("td",{style:L.td,children:e.msa_version}),(0,d.jsxs)("td",{style:L.td,children:[(0,d.jsx)("div",{children:U(e.start_timestamp)}),(0,d.jsx)("div",{style:L.subtext,children:U(e.expiration_timestamp)})]}),(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("a",{href:o(e.metronome_customer_id),target:"_blank",rel:"noopener noreferrer",children:e.metronome_customer_id})}),(0,d.jsx)("td",{style:L.td,children:U(e.created_timestamp)}),(0,d.jsx)("td",{style:L.td,children:U(e.updated_timestamp)}),(0,d.jsx)("td",{style:L.td,children:(0,d.jsx)("button",{type:"button",style:{...L.syncButton,opacity:void 0===t&&a?1:.6,cursor:void 0===t&&a?"pointer":"not-allowed"},disabled:void 0!==t||!a,onClick:()=>{a&&i(a)},title:a?void 0:"Salesforce contract not available",children:n?"Syncing…":"Sync"})})]},e.id)})})]})}):void 0]})}},ee={section:{marginTop:16,gap:8},tableContainer:{overflowX:"auto"},table:{borderCollapse:"collapse",width:"100%",fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:12},header:{textAlign:"start",padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.secondary,whiteSpace:"nowrap"},cell:{padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top",whiteSpace:"nowrap",userSelect:"all",WebkitUserSelect:"all"},statusActive:{color:a(632079).Tj.green.text.accentPrimary,fontWeight:a(699422).Wy.semibold}
3,statusInvalid:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.semibold}};function et(e){if(void 0===e)return"—";let t=new Date(e);return Number.isNaN(t.getTime())?"Invalid timestamp":t.toISOString()}function ea(e){let t=e.providerStorageState[e.provider];return"storage_active"===t.status?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ee.statusActive,children:"Storage active"})," · ",t.credential.fingerprint," · version ",t.credential.version]}):"invalid"===t.status?(0,d.jsxs)("span",{style:ee.statusInvalid,children:["Storage invalid (",t.reason,")"]}):(0,d.jsx)("span",{children:"Not configured"})}function ei(e){return(0,d.jsxs)("table",{style:ee.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{scope:"col",style:ee.header,children:"Provider"}),(0,d.jsx)("th",{scope:"col",style:ee.header,children:"Current storage state"}),(0,d.jsx)("th",{scope:"col",style:ee.header,children:"Policy pointer"})]})}),(0,d.jsx)("tbody",{children:a(843209).TK.map(t=>{var i;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:ee.cell,children:(0,a(843209).Ju)(t)}),(0,d.jsx)("td",{style:ee.cell,children:(0,d.jsx)(ea,{provider:t,providerStorageState:e.data.providerStorageState})}),(0,d.jsx)("td",{style:ee.cell,children:(null==(i=e.data.policy)?void 0:i.activeConnectionIdsByProvider[t])??"—"})]},t)})})]})}function en(e){let{record:t}=e;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:ee.cell,children:(0,a(843209).Ju)(t.provider)}),(0,d.jsx)("td",{style:ee.cell,children:t.recordType}),(0,d.jsx)("td",{style:ee.cell,children:t.status}),(0,d.jsx)("td",{style:ee.cell,children:t.fingerprint}),(0,d.jsx)("td",{style:ee.cell,children:t.connectionId}),(0,d.jsx)("td",{style:ee.cell,children:t.version}),(0,d.jsx)("td",{style:ee.cell,children:et(t.activatedTime)}),(0,d.jsx)("td",{style:ee.cell,children:et(t.rotatedTime)}),(0,d.jsx)("td",{style:ee.cell,children:et(t.revokedTime)}),(0,d.jsx)("td",{style:ee.cell,children:et(t.createdTime)}),(0,d.jsx)("td",{style:ee.cell,children:t.createdById}),(0,d.jsx)("td",{style:ee.cell,children:et(t.lastEditedTime)}),(0,d.jsx)("td",{style:ee.cell,children:t.lastEditedById}),(0,d.jsx)("td",{style:ee.cell,children:t.hasEncryptedCredential?"Yes":"No"})]})}function er(e){return 0===e.records.length?(0,d.jsx)(a(553775).i$,{warnings:["No BYOK connection records found."]}):(0,d.jsx)("div",{style:ee.tableContainer,children:(0,d.jsxs)("table",{style:ee.table,children:[(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:["Provider","Record type","Status","Fingerprint","Connection ID","Version","Activated","Rotated","Revoked","Created","Created by","Last edited","Last edited by","Encrypted material stored"].map(e=>(0,d.jsx)("th",{scope:"col",style:ee.header,children:e},e))})}),(0,d.jsx)("tbody",{children:e.records.map(e=>(0,d.jsx)(en,{record:e},`${e.recordType}:${e.connectionId}:${e.version}`))})]})})}let es={container:{maxWidth:1100},containerInner:{display:"flex",flexDirection:"column",gap:16},sectionTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:12,marginTop:16},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"start",padding:"8px 10px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,fontWeight:a(699422).Wy.semibold,whiteSpace:"nowrap"},td:{textAlign:"start",padding:"8px 10px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top"},mono:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:12},emptyState:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,textAlign:"center"},failedRow:{opacity:.6},rejectedTag:{fontSize:11,fontStyle:"italic",color:a(632079).Tj.text.secondary,marginTop:2},summary:{cursor:"pointer",marginTop:16,marginBottom:8},detailsBody:{marginTop:8}};function eo(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}let el=new Set(["timestamp","created_at","updated_at","start","end","date"]);a(533958);var ed=()=>a(48697);let ec={header:{marginBottom:8},label:{fontWeight:a(699422).Wy.semibold},currentPolicyBox:{padding:12,backgroundColor:a(632079).Tj.background.secondary,borderRadius:6,marginBottom:16},agentCountsBox:{padding:12,backgroundColor:a(632079).Tj.yellow.background.secondary,borderRadius:6,marginBottom:16,display:"flex",flexDirection:"column",gap:4,maxWidth:300},selectWrapper:{maxWidth:300},successMessage:{padding:12,backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},errorMessage:{padding:12,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},select:{padding:"8px 12px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,backgroundColor:a(632079).Tj.background.primary,fontSize:14,cursor:"pointer",width:"100%"},disableAgentsSection:{marginTop:16,padding:12,backgroundColor:a(632079).Tj.red.background.secondary,borderRadius:6,border:`1px solid ${a(632079).Tj.red.border.primary}`},disableAgentsSectionTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:12},zendeskInput:{marginTop:4},warningText:{color:a(632079).Tj.red.text.primary,fontSize:12,marginTop:8}}
3,ep=[{value:"all_workspace_members",label:"All Workspace Members",description:"All workspace members can create agents"},{value:"workspace_owners_only",label:"Workspace Owners Only",description:"Only workspace owners can create agents"},{value:"disabled",label:"Disabled",description:"Custom agents are completely disabled. No new agents can be created."}],em=["all_workspace_members","workspace_owners_only","disabled"];function eu(e){if("custom"===e)return"Workspace owners + added groups only";let t=ep.find(t=>t.value===(e??"all_workspace_members"));return(null==t?void 0:t.label)??"All Workspace Members"}function eh(e){return/^https:\/\/makenotion\.zendesk\.com\/agent\/tickets\/\d+$/.test(e.trim())}let ey={section:{marginBottom:24},sectionHeader:{marginBottom:8,paddingBottom:4,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},agentServiceTranscript:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},agentServiceTranscriptHeader:{padding:"10px 16px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},agentServiceTranscriptNotice:{padding:"8px 16px",backgroundColor:a(632079).Tj.orange.background.secondary},metaGrid:{display:"grid",gridTemplateColumns:"160px 1fr",gap:"4px 12px",fontSize:13},usageMetaGrid:{display:"grid",gridTemplateColumns:"220px 1fr",gap:"4px 12px",fontSize:13},metaLabel:{color:a(632079).Tj.text.secondary,fontWeight:a(699422).Wy.medium},metaValue:{fontFamily:"monospace",fontSize:12,wordBreak:"break-all"},permissionList:{display:"flex",flexDirection:"column",gap:6,marginTop:8},permissionItem:{padding:8,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary,fontFamily:"monospace",fontSize:12,wordBreak:"break-all"},summaryGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:12},summaryCard:{display:"flex",flexDirection:"column",gap:2,padding:12,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary},summaryLabel:{fontSize:11,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.tertiary,textTransform:"uppercase",letterSpacing:"0.5px"},summaryValue:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},summaryValueError:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.red.text.primary},stepList:{display:"flex",flexDirection:"column",gap:2},stepRow:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 8px",borderRadius:4,fontSize:13,cursor:"pointer"},stepIndex:{color:a(632079).Tj.text.secondary,fontFamily:"monospace",fontSize:11,minWidth:28,textAlign:"end",paddingTop:2},stepBadge:{display:"inline-flex",alignItems:"center",padding:"1px 6px",borderRadius:3,fontSize:11,fontWeight:a(699422).Wy.semibold,fontFamily:"monospace",whiteSpace:"nowrap"},stepDetails:{display:"flex",flexDirection:"column",gap:2,flex:1,minWidth:0},stepMainLine:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},stepMeta:{color:a(632079).Tj.text.secondary,fontSize:11,fontFamily:"monospace"},stepError:{color:a(632079).Tj.red.text.accentPrimary,fontSize:12,fontFamily:"monospace",maxWidth:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},expandedContent:{marginTop:4,padding:8,backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,fontSize:12,fontFamily:"monospace",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:300,overflow:"auto"},pill:{display:"inline-flex",alignItems:"center",padding:"0 4px",borderRadius:3,fontSize:10,fontWeight:a(699422).Wy.medium},pillSuccess:{backgroundColor:a(632079).Tj.green.background.secondary,color:a(632079).Tj.green.text.accentPrimary},pillError:{backgroundColor:a(632079).Tj.red.background.secondary,color:a(632079).Tj.red.text.accentPrimary},pillWarning:{backgroundColor:a(632079).Tj.orange.background.secondary,color:a(632079).Tj.orange.text.accentPrimary},pillInfo:{backgroundColor:a(632079).Tj.blue.background.secondary,color:a(632079).Tj.blue.text.accentPrimary},tokenInfo:{display:"inline-flex",gap:8,fontSize:11,fontFamily:"monospace",color:a(632079).Tj.text.secondary},timestamp:{color:a(632079).Tj.text.secondary,fontSize:11,fontFamily:"monospace",whiteSpace:"nowrap"},reflectionReasonsWrapper:{marginTop:8},toolName:{fontWeight:a(699422).Wy.medium,fontSize:13}},eg={"agent-tool-result":"orange","agent-inference":"green",error:"red","agent-debug-error":"red",config:"blue",other:"gray"},ex={blue:{backgroundColor:a(632079).Tj.blue.background.secondary,color:a(632079).Tj.blue.text.accentPrimary},green:{backgroundColor:a(632079).Tj.green.background.secondary,color:a(632079).Tj.green.text.accentPrimary},orange:{backgroundColor:a(632079).Tj.orange.background.secondary,color:a(632079).Tj.orange.text.accentPrimary},red:{backgroundColor:a(632079).Tj.red.background.secondary,color:a(632079).Tj.red.text.accentPrimary},purple:{backgroundColor:a(632079).Tj.purple.background.secondary,color:a(632079).Tj.purple.text.accentPrimary},gray:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary}};function ef(e){return new Date(e).toLocaleTimeString()}function eb(e){let t=new Date(e),a=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),r=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0");return`${a}-${i}-${n} ${r}:${s}:${o}`}function ev(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}
3function ej(e){return void 0!==e?e.toLocaleString():"—"}function ek(e){let{eventsTruncated:t,transcript:i}=e;return(0,d.jsxs)("div",{style:{...ey.section,...ey.agentServiceTranscript},children:[(0,d.jsxs)(a(4458).fI,{gap:12,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",style:ey.agentServiceTranscriptHeader,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Agent Service Transcript"}),(0,d.jsx)(a(620823).w,{rawSessionEvents:i})]}),t?(0,d.jsx)("div",{style:ey.agentServiceTranscriptNotice,children:(0,d.jsxs)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:["This transcript exceeded the admin safety limit. Showing the first"," ",i.data.length.toLocaleString()," redacted events."]})}):void 0,(0,d.jsx)(a(873847).u,{rawEvents:i,isLoading:!1,isLoadingMore:!1,isRefreshing:!1,onLoadMore:void 0})]})}function eS(e){let{usageSummary:t}=e,i=null==t?void 0:t.creditsByTypeUnit,n=null==t?void 0:t.unbilledCreditsByTypeUnit;return(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsx)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Thread Usage Summary"})}),void 0===t?(0,d.jsx)("span",{style:ey.metaValue,children:"No thread.data.usage_summary"}):(0,d.jsxs)("div",{style:ey.usageMetaGrid,children:[(0,d.jsx)(ew,{label:"Charged basic AI credits",value:ej(null==i?void 0:i.basicAiCredits)}),(0,d.jsx)(ew,{label:"Charged exempt AI credits",value:ej(null==i?void 0:i.exemptAiCredits)}),(0,d.jsx)(ew,{label:"Charged premium AI credits",value:ej(null==i?void 0:i.premiumAiCredits)}),(0,d.jsx)(ew,{label:"Charged preview AI credits",value:ej(null==i?void 0:i.previewAiCredits)}),(0,d.jsx)(ew,{label:"Unbilled basic AI credits",value:ej(null==n?void 0:n.basicAiCredits)}),(0,d.jsx)(ew,{label:"Unbilled exempt AI credits",value:ej(null==n?void 0:n.exemptAiCredits)}),(0,d.jsx)(ew,{label:"Unbilled premium AI credits",value:ej(null==n?void 0:n.premiumAiCredits)}),(0,d.jsx)(ew,{label:"Unbilled preview AI credits",value:ej(null==n?void 0:n.previewAiCredits)}),(0,d.jsx)(ew,{label:"Input tokens",value:ej(t.inputTokens)}),(0,d.jsx)(ew,{label:"Output tokens",value:ej(t.outputTokens)}),(0,d.jsx)(ew,{label:"Cached input tokens read",value:ej(t.cachedInputTokensRead)}),(0,d.jsx)(ew,{label:"Cached input tokens created",value:ej(t.cachedInputTokensCreated)}),(0,d.jsx)(ew,{label:"Completion count",value:ej(t.completionCount)}),(0,d.jsx)(ew,{label:"Agent inference count",value:ej(t.agentInferenceCount)}),(0,d.jsx)(ew,{label:"Last updated",value:eb(t.lastUpdatedTime)})]})]})}function ew(e){let{label:t,value:a}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:t}),(0,d.jsx)("span",{style:ey.metaValue,children:a})]})}function eI(e){let{threadId:t,spaceId:i,metadata:n}=e;return(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsx)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Thread Metadata"})}),(0,d.jsxs)("div",{style:ey.metaGrid,children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Thread ID"}),(0,d.jsx)("span",{style:ey.metaValue,children:(0,d.jsx)(a(137691).x5,{value:t})}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Space ID"}),(0,d.jsx)("span",{style:ey.metaValue,children:(0,d.jsx)(a(137691).x5,{value:i})}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Type"}),(0,d.jsx)("span",{style:ey.metaValue,children:n.type??"—"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Parent"}),(0,d.jsxs)("span",{style:ey.metaValue,children:[(0,d.jsx)(a(137691).x5,{value:n.parentId})," (",n.parentTable,")"]}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Created"}),(0,d.jsx)("span",{style:ey.metaValue,children:eb(n.createdTime)}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Created By"}),(0,d.jsxs)("span",{style:ey.metaValue,children:[(0,d.jsx)(a(137691).x5,{value:n.createdById})," (",n.createdByActorType,"; ",n.createdByTable,")"]}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Updated"}),(0,d.jsx)("span",{style:ey.metaValue,children:void 0!==n.updatedTime?eb(n.updatedTime):"—"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Alive"}),(0,d.jsx)("span",{style:ey.metaValue,children:n.alive?"Yes":"No"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Workflow ID"}),(0,d.jsx)("span",{style:ey.metaValue,children:void 0!==n.workflowId?(0,d.jsx)(a(137691).x5,{value:n.workflowId}):"—"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Created Source"}),(0,d.jsx)("span",{style:ey.metaValue,children:n.createdSource??"—"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Shared With Space"}),(0,d.jsx)("span",{style:ey.metaValue,children:n.sharedWithSpace?"Yes":"No"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Permissions"}),(0,d.jsx)("span",{style:ey.metaValue,children:n.permissionsItemCount>0?`${n.permissionsItemCount} item${1===n.permissionsItemCount?"":"s"}`:"None"}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Messages"}),(0,d.jsx)("span",{style:ey.metaValue,children:n.messageCount})]}),n.permissionItems.length>0?(0,d.jsx)("div",{style:ey.permissionList,children:n.permissionItems.map((e,t)=>(0,d.jsxs)("div",{style:ey.permissionItem,children:[(0,d.jsxs)("div",{children:["user ID ",(0,d.jsx)(a(137691).x5,{value:e.userId})]}),(0,d.jsxs)("div",{children:["role ",e.role]}),(0,d.jsxs)("div",{children:["can create pages in collection"," ",e.canCreatePagesInCollection?"yes":"no"]}),(0,d.jsxs)("div",{children:["invite ID"," ",void 0!==e.inviteId?(0,d.jsx)(a(137691).x5,{value:e.inviteId}):"—"]})]},`${e.userId}-${e.role}-${t}`))}):void 0]})}function eC(e){let{summary:t}=e;return(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsx)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Summary"})}),(0,d.jsxs)("div",{style:ey.summaryGrid,children:[(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Tool Calls"}),(0,d.jsx)("span",{style:ey.summaryValue,children:t.totalToolCalls})]}),(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Tool Errors"}),(0,d.jsx)("span",{style:t.toolErrors>0?ey.summaryValueError:ey.summaryValue,children:t.toolErrors})]}),(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Deferred"}),(0,d.jsx)("span",{style:ey.summaryValue,children:t.toolDeferred})]}),(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Inferences"}),(0,d.jsx)("span",{style:ey.summaryValue,children:t.inferenceSteps})]}),(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Errors"}),(0,d.jsx)("span",{style:t.errorSteps>0?ey.summaryValueError:ey.summaryValue,children:t.errorSteps})]}),(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Input Tokens"}),(0,d.jsx)("span",{style:ey.summaryValue,children:ev(t.totalInputTokens)})]}),(0,d.jsxs)("div",{style:ey.summaryCard,children:[(0,d.jsx)("span",{style:ey.summaryLabel,children:"Output Tokens"}),(0,d.jsx)("span",{style:ey.summaryValue,children:ev(t.totalOutputTokens)})]})]})]})}function eD(e){let{run:t}=e,i="failure"===t.status||"retryableFailure"===t.status||"insufficientPermissions"===t.status;return(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsx)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Workflow Run Result"})}),(0,d.jsxs)("div",{style:ey.metaGrid,children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Run ID"}),(0,d.jsx)("span",{style:ey.metaValue,children:(0,d.jsx)(a(137691).x5,{value:t.runId})}),(0,d.jsx)("span",{style:ey.metaLabel,children:"Status"}),(0,d.jsx)("span",{style:i?{...ey.metaValue,color:a(632079).Tj.red.text.accentPrimary}:ey.metaValue,children:t.status}),void 0!==t.pausedReason?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Paused Reason"}),(0,d.jsx)("span",{style:ey.metaValue,children:t.pausedReason})]}):void 0,void 0!==t.pauseReasonId?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Pause Reason ID"}),(0,d.jsx)("span",{style:ey.metaValue,children:(0,d.jsx)(a(137691).x5,{value:t.pauseReasonId})})]}):void 0,void 0!==t.pausedToolName?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Paused Tool"}),(0,d.jsx)("span",{style:ey.metaValue,children:t.pausedToolName})]}):void 0,void 0!==t.errorType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Error Type"}),(0,d.jsx)("span",{style:{...ey.metaValue,color:a(632079).Tj.red.text.accentPrimary},children:t.errorType})]}):void 0,void 0!==t.errorMessage?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Error Message"}),(0,d.jsx)("span",{style:{...ey.metaValue,color:a(632079).Tj.red.text.accentPrimary},children:t.errorMessage})]}):void 0,void 0!==t.spend?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Cost"}),(0,d.jsxs)("span",{style:ey.metaValue,children:["$",t.spend.toFixed(4)]})]}):void 0,void 0!==t.enqueuedAt?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Enqueued At"}),(0,d.jsx)("span",{style:ey.metaValue,children:eb(t.enqueuedAt)})]}):void 0,void 0!==t.finishedAt?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Finished At"}),(0,d.jsx)("span",{style:ey.metaValue,children:eb(t.finishedAt)})]}):void 0]}),void 0!==t.reflectionReasons&&t.reflectionReasons.length>0?(0,d.jsxs)("div",{style:ey.reflectionReasonsWrapper,children:[(0,d.jsx)("span",{style:ey.metaLabel,children:"Reflection Reasons"}),(0,d.jsx)("div",{style:ey.expandedContent,children:t.reflectionReasons.map((e,t)=>(0,d.jsx)("div",{children:e},t))})]}):void 0]})}function eT(e){let{steps:t,allSteps:i}=e;return(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsx)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:(0,d.jsxs)(a(111010).D,{styleKey:"titleSmSemibold",children:["Errors and Failures (",t.length,")"]})}),(0,d.jsx)("div",{style:ey.stepList,children:t.map(e=>{let t=i.indexOf(e);return(0,d.jsx)(eR,{step:e,index:t},e.id)})})]})}function eR({step:e,index:t}){let[a,i]=(0,r.useState)(!1),n=ex[eg[e.stepType]??"gray"],s="error"===e.stepType||"agent-debug-error"===e.stepType||"agent-tool-result"===e.stepType&&"applied:error"===e.state,o="agent-tool-result"===e.stepType||"agent-inference"===e.stepType||"error"===e.stepType||"agent-debug-error"===e.stepType;return(0,d.jsxs)("div",{role:"button",tabIndex:o?0:void 0,style:ey.stepRow,onClick:()=>o&&i(!a),onKeyDown:e=>
3{o&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),i(!a))},children:[(0,d.jsx)("span",{style:ey.stepIndex,children:t+1}),(0,d.jsxs)("div",{style:ey.stepDetails,children:[(0,d.jsxs)("div",{style:ey.stepMainLine,children:[(0,d.jsx)("span",{style:{...ey.stepBadge,...n},children:"other"===e.stepType?e.originalStepType:e.stepType}),(0,d.jsx)(eA,{step:e}),s?(0,d.jsx)("span",{style:{...ey.pill,...ey.pillError},children:"error"}):void 0]}),(0,d.jsx)(eN,{step:e}),a&&o?(0,d.jsx)("div",{style:ey.expandedContent,children:(0,d.jsx)(eM,{step:e})}):void 0]})]})}function eA(e){let{step:t}=e;if("agent-tool-result"===t.stepType){var a,i;let e=t.functionName??t.toolTitle??t.toolName,n=t.toolType!==t.toolName&&t.toolType!==e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:ey.toolName,children:e}),n?(0,d.jsxs)("span",{style:ey.stepMeta,children:["(",t.toolType,")"]}):void 0,void 0!==t.moduleName?(0,d.jsxs)("span",{style:{...ey.pill,...ey.pillInfo},children:[t.moduleName,void 0!==t.moduleType?` \xb7 ${t.moduleType}`:void 0]}):void 0,(0,d.jsx)("span",{style:"applied"===(a=t.state)?{...ey.pill,...ey.pillSuccess}:"applied:error"===a?{...ey.pill,...ey.pillError}:"deferred"===a?{...ey.pill,...ey.pillWarning}:"confirmation:rejected"===a?{...ey.pill,...ey.pillError}:{...ey.pill,...ey.pillInfo},children:t.state}),void 0!==t.durationMs?(0,d.jsx)("span",{style:ey.timestamp,children:(i=t.durationMs)<1e3?`${i}ms`:`${(i/1e3).toFixed(1)}s`}):void 0,t.promptInjectionDetected?(0,d.jsx)("span",{style:{...ey.pill,...ey.pillError},children:"PI detected"}):void 0,t.insufficientPermissions?(0,d.jsx)("span",{style:{...ey.pill,...ey.pillWarning},children:"Insufficient permissions"}):void 0,t.warningCount>0?(0,d.jsxs)("span",{style:{...ey.pill,...ey.pillWarning},children:[t.warningCount," warning(s)"]}):void 0]})}return"agent-inference"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[void 0!==t.model?(0,d.jsx)("span",{style:ey.stepMeta,children:t.model}):void 0,void 0!==t.inputTokens?(0,d.jsxs)("span",{style:ey.tokenInfo,children:[(0,d.jsxs)("span",{children:["in: ",ev(t.inputTokens)]}),void 0!==t.outputTokens?(0,d.jsxs)("span",{children:["out: ",ev(t.outputTokens)]}):void 0,void 0!==t.cachedTokensRead&&t.cachedTokensRead>0?(0,d.jsxs)("span",{children:["cached: ",ev(t.cachedTokensRead)]}):void 0]}):void 0,t.hasRetries?(0,d.jsx)("span",{style:{...ey.pill,...ey.pillWarning},children:"retried"}):void 0]}):"error"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[void 0!==t.subType?(0,d.jsxs)("span",{style:ey.stepMeta,children:["[",t.subType,"]"]}):void 0,void 0!==t.errorCode?(0,d.jsxs)("span",{style:ey.stepMeta,children:["HTTP ",t.errorCode]}):void 0,t.isRetryable?(0,d.jsx)("span",{style:{...ey.pill,...ey.pillInfo},children:"retryable"}):void 0]}):"agent-debug-error"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{style:ey.stepMeta,children:["[",t.errorType,"]"]}),void 0!==t.fromToolName?(0,d.jsx)("span",{style:ey.toolName,children:t.fromToolName}):void 0]}):"config"===t.stepType?(0,d.jsx)("span",{style:ey.toolName,children:t.configType}):null}function eN(e){let{step:t}=e;return"agent-tool-result"===t.stepType&&t.hasError?(0,d.jsx)("div",{style:ey.stepError,children:t.errorMessage??"Tool error occurred (message redacted)"}):"error"===t.stepType||"agent-debug-error"===t.stepType?(0,d.jsx)("div",{style:ey.stepError,children:t.message}):null}function eM(e){let{step:t}=e;return"agent-tool-result"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:["toolName: ",t.toolName]}),(0,d.jsxs)("div",{children:["toolType: ",t.toolType]}),void 0!==t.functionName?(0,d.jsxs)("div",{children:["function: ",t.functionName]}):void 0,void 0!==t.moduleName?(0,d.jsxs)("div",{children:["module: ",t.moduleName,void 0!==t.moduleType?` (${t.moduleType})`:""]}):void 0,void 0!==t.errorCode?(0,d.jsxs)("div",{children:["errorCode: ",t.errorCode]}):void 0,void 0!==t.errorMessage?(0,d.jsxs)("div",{children:["error: ",t.errorMessage]}):void 0,void 0!==t.deferredRetryCount?(0,d.jsxs)("div",{children:["deferred: retryCount=",t.deferredRetryCount,", delay=",t.deferredDelayMs,"ms"]}):void 0,t.startedAt?(0,d.jsxs)("div",{children:["started: ",ef(t.startedAt)]}):void 0,void 0!==t.finishedAt?(0,d.jsxs)("div",{children:["finished: ",ef(t.finishedAt)]}):void 0]}):"agent-inference"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:["model: ",t.model??"unknown"]}),(0,d.jsxs)("div",{children:["tokens: in=",t.inputTokens??0," out=",t.outputTokens??0]}),t.cachedTokensRead?(0,d.jsxs)("div",{children:["cachedRead: ",t.cachedTokensRead]}
3):void 0,t.cachedTokensCreated?(0,d.jsxs)("div",{children:["cachedCreated: ",t.cachedTokensCreated]}):void 0,(0,d.jsxs)("div",{children:["traceId: ",t.traceId]}),t.startedAt?(0,d.jsxs)("div",{children:["started: ",ef(t.startedAt)]}):void 0,void 0!==t.finishedAt?(0,d.jsxs)("div",{children:["finished: ",ef(t.finishedAt)]}):void 0]}):"error"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:["message: ",t.message]}),void 0!==t.subType?(0,d.jsxs)("div",{children:["subType: ",t.subType]}):void 0,void 0!==t.errorCode?(0,d.jsxs)("div",{children:["HTTP: ",t.errorCode]}):void 0,void 0!==t.traceId?(0,d.jsxs)("div",{children:["traceId: ",t.traceId]}):void 0]}):"agent-debug-error"===t.stepType?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:["errorType: ",t.errorType]}),(0,d.jsxs)("div",{children:["message: ",t.message]}),void 0!==t.fromToolName?(0,d.jsxs)("div",{children:["fromTool: ",t.fromToolName]}):void 0]}):null}let eP={successBox:{padding:12,backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},detailsBox:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},codeValue:{fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:12,padding:"8px 12px",borderRadius:6,backgroundColor:a(632079).Tj.background.primary,userSelect:"all",WebkitUserSelect:"all"},link:{color:a(632079).Tj.blue.text.primary,textDecoration:"none",fontWeight:a(699422).Wy.medium}},eV={successBox:{padding:12,backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},detailsBox:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},codeValue:{fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:12,padding:"8px 12px",borderRadius:6,backgroundColor:a(632079).Tj.background.primary,userSelect:"all",WebkitUserSelect:"all"},link:{color:a(632079).Tj.blue.text.primary,textDecoration:"none",fontWeight:a(699422).Wy.medium}},eE={infoBox:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:6},warningBox:{backgroundColor:a(632079).Tj.yellow.background.secondary,borderColor:a(632079).Tj.yellow.border.primary,borderRadius:6,borderStyle:"solid",borderWidth:1},successMessage:{backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},errorMessage:{backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},modeOption:{borderColor:a(632079).Tj.border.secondary,borderRadius:6,borderStyle:"solid",borderWidth:1,cursor:"pointer"},modeOptionSelected:{borderColor:a(632079).Tj.blue.border.primary},providerList:{borderColor:a(632079).Tj.border.secondary,borderRadius:6,borderStyle:"solid",borderWidth:1},radioButtonSlot:{alignItems:"center",display:"inline-flex",flexShrink:0,height:18,justifyContent:"center",position:"relative",width:18},providerRow:{cursor:"pointer"},providerRowBorder:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},codeBlock:{backgroundColor:a(632079).Tj.background.tertiaryTranslucent,borderRadius:4,fontFamily:"monospace",overflow:"auto",whiteSpace:"pre-wrap"}},eB=[{mode:"unset",title:"Use default behavior",description:"Remove the explicit external_agent_access_policy value and use workspace defaults."},{mode:"all_enabled",title:"Allow all providers",description:"Current and future providers are allowed."},{mode:"allowlist",title:"Allow selected providers",description:"Only selected providers are allowed."},{mode:"all_disabled",title:"Disable all providers",description:"Agents cannot use external providers."}];function eL(e){let{label:t,value:i}=e;return(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"baseline",children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySmMedium",children:[t,":"]}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",children:i})]})}function e_(e){let{option:t,selectedMode:i,onSelect:n}=e,s=i===t.mode,o=(0,r.useCallback)(()=>{n(t.mode)},[n,t.mode]);return(0,d.jsxs)(a(4458).fI,{as:"label",gap:8,padding:12,width:"100%",alignItems:"center",style:{...eE.modeOption,...s?eE.modeOptionSelected:void 0},children:[(0,d.jsx)("div",{style:eE.radioButtonSlot,children:(0,d.jsx)(a(101127).a,{selectorSize:"normal",name:"admin-external-agent-access-policy",checked:s,onChange:o})}),(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:t.title}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:t.description})]})]})}function eU(e){let{agentType:t,displayName:i,checked:n,isLast:s,onToggle:o}=e,l=`admin-external-agent-access-policy-${t}`,c=`${l}-label`,p=(0,r.useCallback)(()=>{o(t)}
3,[t,o]);return(0,d.jsxs)(a(4458).fI,{as:"label",alignItems:"center",gap:8,padding:12,width:"100%",style:{...eE.providerRow,...s?void 0:eE.providerRowBorder},children:[(0,d.jsx)(a(382726).S,{id:l,"aria-labelledby":c,checked:n,size:16,onClick:p}),(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",id:c,children:i}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:t})]})]})}function eW(e){return e.storedPolicy?"allowlist"===e.storedPolicy.mode?{mode:"allowlist",allowedAgentTypes:e.storedPolicy.allowed_agent_types}:{mode:e.storedPolicy.mode,allowedAgentTypes:eK({policy:e.storedPolicy,availableAgents:e.availableAgents})}:{mode:"unset",allowedAgentTypes:eK({policy:e.effectivePolicy,availableAgents:e.availableAgents})}}function eF(e){if("unset"!==e.mode)return"all_enabled"===e.mode?{mode:"all_enabled"}:"all_disabled"===e.mode||0===(0,ed().objectKeys)(e.allowedAgentTypes).length?{mode:"all_disabled"}:{mode:"allowlist",allowed_agent_types:e.allowedAgentTypes}}function eK(e){let{policy:t,availableAgents:a}=e;return"all_enabled"===t.mode?e$(a.map(e=>e.agentType)):"all_enabled_except"===t.mode?e$(a.filter(e=>!0!==t.disabled_agent_types[e.agentType]).map(e=>e.agentType)):"all_disabled"===t.mode?{}:{...t.allowed_agent_types}}function e$(e){let t={};for(let a of e)t[a]=!0;return t}function eO(e){return e?"allowlist"!==e.mode?e.mode:`allowlist:${(0,ed().objectKeys)(e.allowed_agent_types).sort().join(",")}`:"unset"}function ez(e){return e?JSON.stringify(e,null,2):"undefined"}a(321577);let eG=(0,a(327219).YK)({truncatedResults:{id:"adminExternalAgentSpecifications.truncatedResults",defaultMessage:"Showing the 100 most recently edited matches."},emptyResults:{id:"adminExternalAgentSpecifications.emptyResults",defaultMessage:"No external agent specifications matched that lookup."},detailsLoadFailed:{id:"adminExternalAgentSpecifications.detailsLoadFailed",defaultMessage:"The specification details could not be loaded."}}),eq={resultCard:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:6},detailSection:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:6},field:{width:"100%"},select:{backgroundColor:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,color:a(632079).Tj.text.primary,minHeight:36,padding:"6px 10px",width:"100%"},workspaceRow:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:4},successMessage:{backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},errorMessage:{backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},warningMessage:{backgroundColor:a(632079).Tj.yellow.background.secondary,border:`1px solid ${a(632079).Tj.yellow.border.primary}`,borderRadius:6},monospace:{fontFamily:"monospace",overflowWrap:"anywhere"},logo:{width:64,height:64,backgroundColor:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:12,objectFit:"contain"}};function eH(e){let{specification:t,environment:i,onBack:n,onUpdated:s}=e,[o,l]=(0,r.useState)(()=>eY(t)),[c,p]=(0,r.useState)(""),[m,u]=(0,r.useState)(!1),[h,y]=(0,r.useState)(!1),[g,x]=(0,r.useState)(),[f,b]=(0,r.useState)(),v="deleted"===t.status,j=v||h,k=(0,r.useMemo)(()=>{var e,a;return e=o,a=t,!(e.name===a.name&&eX(e.description)===a.description&&e.definitionSource===JSON.stringify(a.definition,void 0,2)&&e.status===a.status&&e.allowedSpaces.length===a.allowedSpaces.length&&e.allowedSpaces.every((e,t)=>{var i;return e.id===(null==(i=a.allowedSpaces[t])?void 0:i.id)}))},[o,t]),S=(0,r.useCallback)(e=>t=>{b(void 0),l(a=>({...a,[e]:t.target.value}))},[]),w=(0,r.useCallback)(e=>{b(void 0),l(t=>({...t,definitionSource:e}))},[]),I=(0,r.useCallback)(e=>{let t="published"===e.target.value?"published":"unpublished";b(void 0),l(e=>({...e,status:t}))},[]),C=(0,r.useCallback)(()=>{l(eY(t)),p(""),x(void 0),b(void 0)},[t]),D=(0,r.useCallback)(e=>{h||(b(void 0),l(t=>({...t,allowedSpaces:t.allowedSpaces.filter(t=>t.id!==e)})))},[h]),T=(0,r.useCallback)(async()=>
3{if(h||m)return;let e=c.trim();if(x(void 0),b(void 0),0===e.length)return void x("Enter a workspace ID.");if(o.allowedSpaces.some(t=>t.id===e))return void x("That workspace is already allowed.");u(!0);try{let t=await i.api.callApi({eventName:"adminValidateExternalAgentSpecificationSpace",environment:i,data:{spaceId:e}});if("success"!==t.type)return void x(e0(t.body,"Could not validate that workspace."));l(e=>e.allowedSpaces.some(e=>e.id===t.data.space.id)?e:{...e,allowedSpaces:[...e.allowedSpaces,t.data.space]}),p("")}catch(e){(0,a(208318).t)().log({level:"warning",from:"AdminExternalAgentSpecifications",type:"validateExternalAgentSpecificationWorkspaceFailed",error:(0,a(952977).convertErrorToLog)(e)}),x((0,a(324497).A)(e).message)}finally{u(!1)}},[o.allowedSpaces,i,h,m,c]),R=(0,r.useCallback)(async()=>{if(k&&!h&&!v&&!m&&(await a(647095).Gh({mode:"wide",message:`Save changes to ${t.name}?`,description:"This saves your changes to the specification, including its workspace access.",acceptLabel:"Save changes",cancelLabel:"Keep editing"})).accept){y(!0),b(void 0);try{let e=await i.api.callApi({eventName:"adminUpdateExternalAgentSpecification",environment:i,data:{specificationId:t.id,expectedVersion:t.version,name:o.name,description:eX(o.description),iconUrl:t.iconUrl,definitionSource:o.definitionSource,status:o.status,allowedSpaceIds:o.allowedSpaces.map(e=>e.id)}});if("success"!==e.type)return void b({type:"error",message:e0(e.body,"The specification could not be updated.")});let a=e.data;if("validation_failed"===a.type)return void b({type:"error",message:a.diagnostics.map(e=>e.message).join("\n")});s(a.specification),l(eY(a.specification)),b({type:"success",message:"External agent specification updated."})}catch(e){(0,a(208318).t)().log({level:"warning",from:"AdminExternalAgentSpecifications",type:"updateExternalAgentSpecificationFailed",error:(0,a(952977).convertErrorToLog)(e)}),b({type:"error",message:(0,a(324497).A)(e).message})}finally{y(!1)}}},[o,i,k,v,h,m,s,t]);return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,maxWidth:900,children:[(0,d.jsx)(a(4458).fI,{children:(0,d.jsx)(a(548436).A,{size:"sm",disabled:h,onClick:n,children:"Back to results"})}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:t.name}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",style:eq.monospace,children:t.id})]}),(0,d.jsxs)(a(4458).VP,{gap:6,padding:12,style:eq.detailSection,children:[(0,d.jsx)(eZ,{label:"ID",value:t.id,monospace:!0}),(0,d.jsx)(eZ,{label:"Version",value:String(t.version)}),(0,d.jsx)(eZ,{label:"Last version",value:void 0===t.lastVersion?"undefined":String(t.lastVersion)}),(0,d.jsx)(eZ,{label:"Created time",value:`${(0,a(344184).vO)(t.createdTime)} (${t.createdTime})`}),(0,d.jsx)(eZ,{label:"Created by",value:`${t.createdByTable}:${t.createdById}`,monospace:!0}),(0,d.jsx)(eZ,{label:"Last edited time",value:`${(0,a(344184).vO)(t.lastEditedTime)} (${t.lastEditedTime})`}),(0,d.jsx)(eZ,{label:"Last edited by",value:`${t.lastEditedByTable}:${t.lastEditedById}`,monospace:!0})]}),v?(0,d.jsxs)(a(4458).VP,{gap:4,padding:12,style:eq.warningMessage,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:"This specification is deleted."}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",children:"Its details remain viewable, but deleted specifications cannot be edited."})]}):void 0,(0,d.jsx)(eJ,{label:"Name",htmlFor:"external-agent-specification-name",children:(0,d.jsx)(a(287562).p,{id:"external-agent-specification-name",value:o.name,disabled:j,onChange:S("name")})}),(0,d.jsx)(eJ,{label:"Description",htmlFor:"external-agent-specification-description",children:(0,d.jsx)(a(287562).p,{id:"external-agent-specification-description",value:o.description,disabled:j,textarea:!0,autosize:!0,autosizeMinHeight:72,autosizeMaxHeight:180,onChange:S("description")})}),(0,d.jsx)(eQ,{iconUrl:t.iconUrl,name:t.name}),(0,d.jsx)(eJ,{label:"Status",htmlFor:"external-agent-specification-status",children:(0,d.jsxs)("select",{id:"external-agent-specification-status",value:v?"deleted":o.status,disabled:j,onChange:I,style:eq.select,children:[(0,d.jsx)("option",{value:"unpublished",children:"Unpublished"}),(0,d.jsx)("option",{value:"published",children:"Published"}),v?(0,d.jsx)("option",{value:"deleted",children:"Deleted"}):void 0]})}),(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:"Allowed workspaces"}),0===o.allowedSpaces.length?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"No workspaces are currently allowed."}):o.allowedSpaces.map(e=>(0,d.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,padding:8,style:eq.workspaceRow,children:[(0,d.jsxs)(a(4458).VP,{gap:2,minWidth:0,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:e.name??"Unknown workspace"}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",style:eq.monospace,children:[e.id,e.exists?"":" · workspace no longer exists"]})]}),v?void 0:(0,d.jsx)(a(548436).A,{size:"sm",disabled:h,onClick:()=>D(e.id),children:"Remove"})]},e.id)),v?void 0:(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(287562).p,{"aria-label":"Workspace ID to add",placeholder:"Paste workspace ID to add",value:c,disabled:h,onChange:e=>p(e.target.value),onSubmit:T,style:eq.field}),(0,d.jsx)(a(548436).A,{size:"sm",disabled:h||m,onClick:T,children:m?"Validating…":"Add workspace"})]}),g?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorPalette:"red",children:g}):void 0]})]}),(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:"Definition"}),(0,d.jsx)(a(913646).J,{ariaLabel:"External agent specification definition",value:o.definitionSource,disabled:j,onChange:w})]}),f?(0,d.jsx)(a(4458).VP,{padding:12,style:"success"===f.type?eq.successMessage:eq.errorMessage,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",style:{whiteSpace:"pre-wrap"},children:f.message})}):void 0,v?void 0:(0,d.jsxs)(a(4458).fI,{gap:8,justifyContent:"flex-end",children:[(0,d.jsx)(a(548436).A,{size:"sm",disabled:!k||h||m,onClick:C,children:"Reset"}),(0,d.jsx)(a(912946).j,{size:"sm",disabled:!k||h||m,onClick:R,children:h?"Updating…":"Update specification"})]})]})}function eZ(e){let{label:t,value:i,monospace:n}=e;return(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySmMedium",children:[t,":"]}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",style:n?eq.monospace:void 0,children:i})]})}function eJ(e){let{label:t,htmlFor:i,children:n}=e;return(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)("label",{htmlFor:i,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:t})}),n]})}function eQ(e){let{iconUrl:t,name:i}=e,[n,s]=(0,r.useState)(),o=void 0!==t&&n!==t;return(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:"Logo"}),o?(0,d.jsx)("img",{src:t,alt:`${i} logo`,style:eq.logo,onError:()=>s(t)}):(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:void 0===t?"No logo configured.":"Logo unavailable."})]})}function eY(e){return{name:e.name,description:e.description??"",definitionSource:JSON.stringify(e.definition,void 0,2),status:"published"===e.status?"published":"unpublished",allowedSpaces:e.allowedSpaces}}function eX(e){return 0===e.trim().length?void 0:e}function e0(e,t){return(0,a(101787).Ow)(e)?e.debugMessage??t:t}let e1={header:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,paddingBottom:16},workspaceId:{fontFamily:"monospace"},section:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:10,backgroundColor:a(632079).Tj.background.secondary,padding:16},metadataGrid:{display:"grid",gap:"16px 20px",gridTemplateColumns:"repeat(auto-fit, minmax(170px, 1fr))"},sectionDivider:{borderTop:`1px solid ${a(632079).Tj.border.secondary}`,paddingTop:12},badge:{alignItems:"center",borderRadius:999,display:"inline-flex",fontWeight:a(699422).Wy.semibold,padding:"4px 10px",whiteSpace:"nowrap"},badgeRestricted:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary},badgeWarning:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.accentPrimary},badgeClear:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.primary},badgeNeutral:{backgroundColor:a(632079).Tj.background.tertiaryTranslucent,color:a(632079).Tj.text.secondary},modelList:{display:"flex",flexWrap:"wrap",gap:6},modelTag:{backgroundColor:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:6,padding:"4px 8px"}};function e4(e){let{title:t,settingName:i,policy:n,hasWorkspaceDefault:r,modelLabel:s}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,style:e1.section,children:[(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:t}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:n.isConfigured?i:`${i} (not set)`})]}),(0,d.jsxs)("div",{style:e1.metadataGrid,children:[(0,d.jsx)(ta,{label:"Restricted providers",value:n.disabledProviders.join(", ")||"None"}),r?(0,d.jsx)(ta,{label:"Default model",value:void 0===n.defaultModel?"Auto":s(n.defaultModel)}):void 0]}),(0,d.jsx)(e2,{label:"Restricted models",models:n.disabledModels,modelLabel:s}),(0,d.jsx)(e2,{label:"Allowed premium models",models:n.allowedRestrictedModels,modelLabel:s})]})}function e2(e){let{label:t,models:i,modelLabel:n}=e;return(0,d.jsxs)(a(4458).VP,{gap:6,style:e1.sectionDivider,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:t}),0===i.length?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:"None"}):(0,d.jsx)("div",{style:e1.modelList,children:i.map(e=>(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",style:e1.modelTag,children:n(e)},e))})]})}function e6(e){let{geoRestriction:t}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,style:e1.section,children:[(0,d.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,children:[(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Billing-country policy"}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:"Geographic provider restrictions"})]}),(0,d.jsx)(e7,{status:t.status})]}),(0,d.jsxs)("div",{style:e1.metadataGrid,children:[(0,d.jsx)(ta,{label:"Billing country",value:void 0===t.billingCountry||"unknown"===t.billingCountry?"Unknown":t.billingCountry}),(0,d.jsx)(ta,{label:"Policy mode",value:e5(t.policyMode)}),(0,d.jsx)(ta,{label:"Enforcement rollout",value:te(t.rolloutEnabled)}),(0,d.jsx)(ta,{label:"Policy version",value:t.policyVersion??"Unavailable"})]}),void 0!==t.rule?(0,d.jsx)(a(4458).VP,{gap:12,style:e1.sectionDivider,children:(0,d.jsx)(e3,{rule:t.rule})}):void 0,(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Separate from account bans and workspace model controls."})]})}function e9(e){let{diagnostic:t}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,style:e1.section,children:[(0,d.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,children:[(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Location diagnostic"}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:"Hypothetical location only"})]}),(0,d.jsx)(e7,{status:t.status})]}),(0,d.jsxs)("div",{style:e1.metadataGrid,children:[(0,d.jsx)(ta,{label:"Country",value:t.countryCode}),void 0!==t.locationGroup?(0,d.jsx)(ta,{label:"Location group",value:"ua_sanctioned_territories"===t.locationGroup?"Sanctioned Ukraine territories":t.locationGroup}):void 0,(0,d.jsx)(ta,{label:"Enforcement rollout",value:te(t.rolloutEnabled)}),(0,d.jsx)(ta,{label:"Policy version",value:t.policyVersion??"Unavailable"})]}),void 0!==t.rule?(0,d.jsx)(a(4458).VP,{gap:12,style:e1.sectionDivider,children:(0,d.jsx)(e3,{rule:t.rule})}):void 0,(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Evaluates the supplied location without retrieving or saving customer data."})]})}function e7(e){let{status:t}=e,i="restricted"===t?e1.badgeRestricted:"not_restricted"===t?e1.badgeClear:"billing_country_unknown"===t?e1.badgeWarning:e1.badgeNeutral,n="restricted"===t?"red":"not_restricted"===t?"green":"billing_country_unknown"===t?"yellow":void 0;return(0,d.jsx)("span",{style:{...e1.badge,...i},children:(0,d.jsx)(a(111010).D,{styleKey:"captionMedium",colorPalette:n,colorVariant:void 0===n?"secondary":"accentPrimary",children:function(e){switch(e){case"policy_unavailable":return"Unavailable";case"billing_unavailable":return"Billing unavailable";case"billing_country_unknown":return"Unknown country";case"not_restricted":return"No restriction";case"restricted":return"Restricted"}}(t)})})}function e3(e){var t,a,i;let{rule:n}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ta,{label:"Effective restriction mode",value:e5(n.mode)}),void 0!==n.onlyAllow?null!=(t=n.onlyAllow.providers)&&t.length||null!=(a=n.onlyAllow.modelFamilies)&&a.length||null!=(i=n.onlyAllow.models)&&i.length?(0,d.jsx)(e8,{label:"Only allow",targets:n.onlyAllow}):(0,d.jsx)(ta,{label:"Only allow",value:"No models allowed"}):void 0,void 0!==n.disallow?(0,d.jsx)(e8,{label:"Restrict",targets:n.disallow}):void 0]})}function e8(e){var t,a,i;let{label:n,targets:r}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ta,{label:`${n} providers`,value:(null==(t=r.providers)?void 0:t.join(", "))||"None"}),(0,d.jsx)(ta,{label:`${n} model families`,value:(null==(a=r.modelFamilies)?void 0:a.join(", "))||"None"}),(0,d.jsx)(ta,{label:`${n} models`,value:(null==(i=r.models)?void 0:i.join(", "))||"None"})]})}function e5(e){return void 0===e?"Unavailable":"enforce"===e?"Enforcing":"Shadow (not enforced)"}function te(e){return void 0===e?"Unavailable":e?"Enabled":"Disabled"}function tt(e){var t,a;return[null==(t=e.providers)?void 0:t.join(", "),null!=(a=e.modelFamilies)&&a.length?`model families: ${e.modelFamilies.join(", ")}`:void 0].filter(e=>void 0!==e&&""!==e).join("; ")||"nothing"}function ta(e){return(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:e.label}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:e.value})]})}let ti=["workflow","summarize-transcript"].sort(),tn=a(617793).Q.map(e=>({displayName:e,value:e})),tr=Array.from(new Set(a(410040).YP.flatMap(e=>
3"modelFamily"in e&&e.isProductionCallable?[e.modelFamily]:[]))).sort().map(e=>({displayName:e,value:e})),ts={action:{type:"options",comment:"Set a restriction or clear an existing one",options:["set","clear"],defaultValue:"set"},disallowProviders:{type:"multiselect",comment:"Providers blocked by the v2 policy.",options:tn,serializeAsCommaSeparatedString:!0},disallowModelFamilies:{type:"multiselect",comment:"Model families blocked by the v2 policy.",options:tr,serializeAsCommaSeparatedString:!0},onlyAllow:{type:"section",name:"Advanced: only allow",components:{onlyAllowProviders:{type:"multiselect",comment:"These settings should be applied for major AI Labs only. Do not change these configurations without explicit approval from the AI team.",options:tn,serializeAsCommaSeparatedString:!0},onlyAllowModelFamilies:{type:"multiselect",comment:"Model families allowed by the v2 policy.",options:tr,serializeAsCommaSeparatedString:!0}}},dryRun:{type:"boolean",comment:"When checked, shows preview without making changes",defaultValue:!0}},to={adminGetBYOKCredentialHistory:{apiName:"adminGetBYOKCredentialHistory",displayName:"BYOK Credential History",description:"Inspect sanitized OpenAI and Anthropic credential storage state for one workspace or organization. Fill out exactly one field.",emoji:"🔑",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID — resolved to its managing organization."},organizationId:{type:"string",table:s().y75,comment:"Organization ID — inspected directly."}},isDestructive:!1,customResponseRenderer:function(e){var t;let{data:i}=e,n=[...void 0===i.note?[]:[i.note],...0===i.malformedConnectionRecordCount?[]:[`Skipped ${i.malformedConnectionRecordCount} malformed connection ${1===i.malformedConnectionRecordCount?"record":"records"}.`],...i.truncated?["History is truncated after 1,000 connection records."]:[]];return(0,d.jsxs)(a(4458).VP,{children:[(0,d.jsxs)(a(4458).VP,{style:ee.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleXlBold",colorVariant:"primary",children:"BYOK Credential History"}),void 0===i.organizationId?(0,d.jsx)("div",{children:"Organization: None"}):(0,d.jsxs)("div",{children:["Organization:"," ",i.organizationName??"(unnamed)"," ",(0,d.jsx)(a(137691).x5,{value:i.organizationId})]}),void 0===i.spaceId?void 0:(0,d.jsxs)("div",{children:["Workspace:"," ",i.spaceName??"(unnamed)"," ",(0,d.jsx)(a(137691).x5,{value:i.spaceId})]}),0===n.length?void 0:(0,d.jsx)(a(553775).i$,{warnings:n})]}),(0,d.jsxs)(a(4458).VP,{style:ee.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleSemibold",colorVariant:"primary",children:"Current provider storage"}),(0,d.jsxs)("div",{children:["Policy record: ","valid"===(t=i.policyStatus)?"Valid":"missing"===t?"Not found":"Malformed"]}),(0,d.jsx)(ei,{data:i}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:"Storage active means the current Dynamo record is structurally usable. It does not revalidate provider access. Refresh if a credential changed during this lookup."})]}),(0,d.jsxs)(a(4458).VP,{style:ee.section,children:[(0,d.jsxs)(a(111010).D,{styleKey:"titleSemibold",colorVariant:"primary",children:["Sanitized storage rows (",i.connectionRecords.length,")"]}),(0,d.jsx)(er,{records:i.connectionRecords})]})]})}},adminGetAIProviderRestriction:{apiName:"adminGetAIProviderRestriction",displayName:"Get AI Provider Restriction",description:"Check what AI provider restriction (if any) is applied to a workspace and where it comes from (hardcoded, space settings, or org rule).",emoji:"🔍",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to check",table:"space"}},isDestructive:!1,showIfGate:{gateName:"ai_provider_restriction_admin_tool_v2",alwaysEnabledEnvironments:["local"]}},adminGetOrgAIProviderRestriction:{apiName:"adminGetOrgAIProviderRestriction",displayName:"Get Org AI Provider Restriction",description:"Check what AI provider restriction (if any) is applied to an organization and where it comes from (hardcoded or org settings).",emoji:"🔍",schema:{orgIds:{type:"string",comment:"Comma-separated organization_ids to check"}},isDestructive:!1,showIfGate:{gateName:"ai_provider_restriction_admin_tool_v2",alwaysEnabledEnvironments:["local"]}},adminSetProductFeedback:{apiName:"adminSetProductFeedback",displayName:"Set Product Feedback",description:"Set the workspace control that enables or disables product feedback. During migration, the independent Statsig deny may still prevent collection when this workspace control is enabled.",emoji:"🔒",schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to update"},action:{type:"options",options:["enable","disable"],required:!0,comment:"Set the workspace control to enable or disable product feedback"}},isDestructive:!0},adminSetAIProviderRestriction:{apiName:"adminSetAIProviderRestriction",displayName:"Set/Clear AI Provider Restriction",description:"Set or clear an AI provider restriction on a workspace. Used for subprocessor opt-outs (e.g. disallowing xAI/Grok).",emoji:"🚫",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids",table:"space"},...ts},isDestructive:!0,showIfGate:{gateName:"ai_provider_restriction_admin_tool_v2",alwaysEnabledEnvironments:["local"]}},adminSetOrgAIProviderRestriction:{apiName:"adminSetOrgAIProviderRestriction",displayName:"Set/Clear Org AI Provider Restriction",description:"Set or clear an AI provider restriction on an organization. Applies to all spaces in the org.",emoji:"🚫",schema:{orgIds:{type:"string",comment:"Comma-separated organization_ids"},...ts},isDestructive:!0,showIfGate:{gateName:"ai_provider_restriction_admin_tool_v2",alwaysEnabledEnvironments:["local"]}},adminUpdateNotionAIAvailabilityForSpace:{apiName:"adminUpdateNotionAIAvailabilityForSpace",displayName:"Add/Remove Notion AI from a space",description:"Notion AI can only be disabled by Enterprise admins, but this tool allows support to remove AI from spaces by request.",emoji:"🤖",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to add/remove AI from",table:"space"},action:{type:"options",comment:"This setting will be applied to all spaces in the list",options:["turn_off_ai","turn_on_ai"],defaultValue:"turn_off_ai"}},isDestructive:!0},adminAddZeroRetentionSpace:{apiName:"adminAddZeroRetentionSpace",displayName:"Enable HIPAA compliance for a Space",description:"For AI, this sets the zero_retention_enabled flag and routes traffic to zero data retention endpoints",emoji:"0",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to enable HIPAA compliance",table:"space"},action:{type:"options",comment:"This setting will be applied to all spaces in the list",options:["enable","disable"],defaultValue:"enable"}},isDestructive:!0},adminCheckHIPAAComplianceStatus:{apiName:"adminCheckHIPAAComplianceStatus",displayName:"Check HIPAA compliance for a Space",description:"See if workspace has HIPAA compliance flag set",emoji:"0",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to check HIPAA status",table:"space"}},isDestructive:!1},adminOnboardAISlackQnA:{apiName:"adminOnboardAISlackQnA",displayName:"Onboard a Workspace onto AI Slack QnA",description:"Equivalent of setWorksapacePreferences",emoji:"❓",schema:{notionSpaceId:{type:"string",table:"space"},slackWorkspaceId:{type:"string"},userEmail:{type:"string"}},isDestructive:!0},adminOptOutNotionAIDataSharing:{apiName:"adminOptOutNotionAIDataSharing",displayName:"Opt out users from Notion AI Data Sharing",description:"Opt out users that previously enrolled in Notion AI Data Sharing",emoji:"🛑",schema:{userEmail:{type:"string",comment:"User email to opt out"}},isDestructive:!0},adminIsWorkspaceInQnA:{apiName:"adminIsWorkspaceInQnA",displayName:"Check QnA Experiment for Worksp
3ace",description:(0,d.jsxs)(d.Fragment,{children:["Returns the following AI space details:",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"isAiEnabled = Can use AI in the workspace.",(0,d.jsx)("br",{}),"hasAiAddOn = Space pays for AI Add-On.",(0,d.jsx)("br",{}),"hasUnlimitedAI = Space has Notion AI usage, whether bundled with tier or via add-on.",(0,d.jsx)("br",{}),"isQnAEnabled = Space has QnA experience enabled.",(0,d.jsx)("br",{}),"isAssistantEnabled = Space has Assistant experience enabled.",(0,d.jsx)("br",{}),"isEmbeddingsLive = Space has embeddings indexed.",(0,d.jsx)("br",{}),"isLimitedQna = Space is in limited qna mode.",(0,d.jsx)("br",{}),"mode = QnA experience mode (control, canary, alpha, beta, etc.)"]}),emoji:"🔭",schema:{notionSpaceId:{type:"string",table:"space"}},isDestructive:!1},adminSetAssistantEnabledForSpaces:{apiName:"adminSetAssistantEnabledForSpaces",displayName:"Enable assistant alpha for spaces",description:"Enable Assistant for the specified spaces. This will allow users to use the Assistant feature in the specified spaces by setting a space setting",emoji:"🤖",schema:{csv:{type:"file",name:"csv",comment:"CSV must have the column: spaceId. spaceId represents that a space will be added to the space setting."},enable:{type:"boolean",defaultValue:!0,comment:"If true, enables this for workspace. Otherwise disables"}},isDestructive:!0},adminSearchAsUser:{apiName:"adminSearchAsUser",displayName:"Search as a User",emoji:"🔎",description:"Search as a User",schema:{user:{type:"string",comment:"Email or userId"},query:{type:"string",defaultValue:""},spaceId:{type:"string",comment:"Optional spaceId - needed if no user or user is member of more than one space"},options:{type:"section",components:{collectionId:{type:"string",comment:"if set, runs BlocksInCollectionSearch with collectionId as parentId"},limit:{type:"number",comment:"Optional number of results. Default is 20"},disableRecentBoosting:{type:"boolean",defaultValue:!1,comment:"Disable recent pages boosting (sets debug experiment override)"}}},debug:{type:"boolean",defaultValue:!1,comment:"add request debug info (responses are removed)"}}},adminCheckEsDocAccess:{apiName:"adminCheckEsDocAccess",displayName:"Check ES doc access for a user or bot",emoji:"🔎",description:"Check if a document is indexed in ES and searchable for the user / bot ID",schema:{docId:{type:"string",comment:"ES Document ID"},spaceId:{type:"string",table:"space",comment:"for index fragment routing"},userId:{type:"string",table:s().oo9,comment:"User ID or email. Provide either userId or botId"},botId:{type:"string",table:"bot",comment:"Provide either userId or botId"},cluster:{type:"string",comment:"(optional) ES cluster generation, e.g. prod-api-um-35; defaults to the primary read cluster"},generationMember:{type:"options",options:["search","notion-ekm","mckinsey-ekm","openai-ekm"],comment:"(optional) defaults to the space's member (search, or its EKM member)"}},isDestructive:!1},adminSemanticSearchAsUser:{apiName:"adminSemanticSearchAsUser",displayName:"Semantic Search as a User",emoji:"🧠",description:"Run a semantic (vector/Turbopuffer) search as a user",schema:{user:{type:"string",comment:"Email or userId"},query:{type:"string",defaultValue:""},spaceId:{type:"string",comment:"Optional spaceId - needed if user is member of more than one space"},limit:{type:"number",comment:"Optional number of results. Default is 20"},indexTypes:{type:"multiselect",comment:"Index types to include in results. Defaults to all (block, collectionProperties, attachment).",options:[{displayName:"Block spans",value:"block"},{displayName:"Collection properties",value:"collectionProperties"},{displayName:"Attachments",value:"attachment"}]},filters:{type:"section",name:"Filters",comment:"Optional filters passed directly to the Turbopuffer query.",components:{ancestors:{type:"stringArray",comment:"Only return results within these ancestor page IDs",placeholder:"Enter page ID"},pageIds:{type:"stringArray",comment:"Only return results matching these page IDs",placeholder:"Enter page ID"},collectionIds:{type:"stringArray",comment:"Only return results in these collection IDs",placeholder:"Enter collection ID"},excludedCollectionIds:{type:"stringArray",comment:"Exclude results in these collection IDs",placeholder:"Enter collection ID"},lookbackStartTime:{type:"datetimeISO",comment:"Only pages last edited after this time"},lookbackEndTime:{type:"datetimeISO",comment:"Only pages last edited before this time"},createdStartTime:{type:"datetimeISO",comment:"Only pages created after this time"},createdEndTime:{type:"datetimeISO",comment:"Only pages created before this time"}}}}},adminDeleteWorkflows:{apiName:"adminDeleteWorkflows",displayName:"Delete Workflows (Custom Agents)",description:(0,d.jsxs)(d.Fragment,{children:["Bulk soft-delete workflows (custom agents) by setting alive=false via direct postgres (bypasses post-transaction hooks).",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"⚠️ CAUTION:"})," Before using this tool, ensure you have obtained consent from the workflow owner. The confirmation step will display the owner's email address for verification.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Optionally delete workflow artifacts (published versions) permanently. If not deleted, artifacts will be left orphaned."]}),emoji:"🗑",isDestructive:!0,schema:{workflowIds:{type:"stringArray",name:"Workflow IDs",table:s().C0E,placeholder:"Enter workflow ID",maxItems:20,c
3omment:"Workflow IDs to delete (max 20). Space ID is resolved automatically for each workflow."},deleteArtifacts:{type:"boolean",defaultValue:!1,comment:"If checked, workflow artifacts (published versions) will be permanently deleted. WARNING: This is irreversible!"}}},adminDispatchAgentFacetsBackfill:{apiName:"adminDispatchAgentFacetsBackfill",displayName:"Dispatch Agent Facets Backfill",description:(0,d.jsxs)(d.Fragment,{children:["Manually enqueue the agent facets backfill durable workflow. This scans historical agent threads and dispatches facet extraction.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"The durable workflow is controlled by the backfill_agent_facets_workflow_config dynamic config for the current environment."]}),emoji:"🧩",isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:eV.successBox,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"Agent facets backfill dispatched successfully."})}),(0,d.jsx)("div",{style:eV.detailsBox,children:(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Task ID"}),(0,d.jsx)("div",{style:eV.codeValue,children:t.taskId})]}),(0,d.jsxs)(a(4458).fI,{gap:12,children:[(0,d.jsx)("a",{href:t.consoleUrl,target:"_blank",rel:"noopener noreferrer",style:eV.link,children:"Open workflow run"}),(0,d.jsx)("a",{href:t.latestRunsUrl,target:"_blank",rel:"noopener noreferrer",style:eV.link,children:"Latest runs"})]})]})})]})},schema:{}},adminDispatchAgentFacetCentroidsBackfill:{apiName:"adminDispatchAgentFacetCentroidsBackfill",displayName:"Dispatch Agent Facet Centroids Backfill",description:(0,d.jsxs)(d.Fragment,{children:["Manually enqueue the agent facet centroid-assignment backfill durable workflow. This walks every space that has facets and assigns each facet to the closest centroid of that space's active clustering run.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"The durable workflow is controlled by the backfill_agent_facet_centroids_workflow dynamic config for the current environment."]}),emoji:"🎯",isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:eP.successBox,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"Agent facet centroids backfill dispatched successfully."})}),(0,d.jsx)("div",{style:eP.detailsBox,children:(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Task ID"}),(0,d.jsx)("div",{style:eP.codeValue,children:t.taskId})]}),(0,d.jsxs)(a(4458).fI,{gap:12,children:[(0,d.jsx)("a",{href:t.consoleUrl,target:"_blank",rel:"noopener noreferrer",style:eP.link,children:"Open workflow run"}),(0,d.jsx)("a",{href:t.latestRunsUrl,target:"_blank",rel:"noopener noreferrer",style:eP.link,children:"Latest runs"})]})]})})]})},schema:{}},dispatchEvalAgent:{apiName:"dispatchEvalAgent",displayName:"Dispatch Eval Agent",description:(0,d.jsxs)(d.Fragment,{children:["Manually enqueue an eval agent durable workflow for Braintrust model evals.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Non-production only:"})," this tool is only available in local and development environments."]}),emoji:"🧪",availableEnvironments:["local","development"],isDestructive:!1,schema:{project:{type:"string",defaultValue:"personal-agent-evals",comment:"Braintrust project name."},dataset:{type:"string",defaultValue:"script-agent-eval-agent-baseline-live",comment:"Braintrust dataset name."},datasetFilter:{type:"string",comment:"Optional Braintrust dataset filter expression."},modelNames:{type:"stringArray",defaultValue:["anthropic-sonnet-alt-thinking","oatmeal-cookie"],comment:"Model names to evaluate."},concurrency:{type:"number",numberType:"integer",min:1,defaultValue:5,comment:"Number of evals to run in parallel per model. For live search evals, set concurrency to 1."},iterations:{type:"number",numberType:"integer",min:1,defaultValue:1,comment:"How many times to run each eval."},experimentSuffix:{type:"string",defaultValue:"admin-dispatch",comment:"Suffix appended to the Braintrust experiment name."},slackChannelId:{type:"string",defaultValue:"C0ADB6U3U03",comment:"Slack channel for posting results."},retryFailedEvalsIterations:{type:"number",numberType:"integer",min:1,
3comment:"How many retry iterations to run for failed evals."},passThreshold:{type:"number",numberType:"integer",min:0,max:100,comment:"Pass threshold percentage for retry analysis."},logPerMemoryMetrics:{type:"boolean",defaultValue:!1,comment:"Log one Braintrust memory metric per memory test in addition to the aggregate memory score."}}},adminEnqueueAgentFeedbackTriageBackfill:{apiName:"adminEnqueueAgentFeedbackTriageBackfill",displayName:"Enqueue agent feedback triage backfill",description:"Manually enqueue the same agent feedback triage backfill durable workflow that the cron dispatches, scoped to one Braintrust project suffix.",emoji:"🔁",isDestructive:!0,schema:{projectSuffix:{type:"options",options:ti,required:!0,comment:"Braintrust project suffix to backfill. The server maps this to the current environment's full project name."},lookbackHours:{type:"number",numberType:"integer",min:1,comment:"Optional lookback window in hours. Defaults to 24."},limit:{type:"number",numberType:"integer",min:1,comment:"Optional max logs to triage. Defaults to 100."}}},adminDebugRedactedTranscript:{apiName:"adminDebugRedactedTranscript",displayName:"Debug Redacted Transcript",description:(0,d.jsxs)(d.Fragment,{children:["View a redacted version of an agent transcript that strips private content while preserving identifiers and structured debug metadata.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Shows:",(0,d.jsx)("br",{}),"- Step-by-step timeline with types and ordering",(0,d.jsx)("br",{}),"- Tool errors, error codes, and deferred reasons",(0,d.jsx)("br",{}),"- Model errors and transient failures",(0,d.jsx)("br",{}),"- Token usage per inference step",(0,d.jsx)("br",{}),"- Summary statistics (tool calls, errors, token totals)",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Does NOT show: user messages, tool inputs/outputs, model responses, or free-form errors that may contain user-authored content."]}),emoji:"🔍",isDestructive:!1,customResponseRenderer:function(e){var t;let{data:i}=e,[n,s]=(0,r.useState)(!1),o=(0,r.useMemo)(()=>i.steps.filter(e=>"error"===e.stepType||"agent-debug-error"===e.stepType||"agent-tool-result"===e.stepType&&"applied:error"===e.state),[i.steps]),l=i.steps.filter(e=>"agent-tool-result"===e.stepType).length,c=i.steps.filter(e=>"agent-inference"===e.stepType).length;return(0,d.jsxs)(a(4458).VP,{gap:16,children:[(0,d.jsx)(eI,{threadId:i.threadId,spaceId:i.spaceId,metadata:i.metadata}),void 0!==i.workflowRun?(0,d.jsx)(eD,{run:i.workflowRun}):void 0,(0,d.jsx)(eS,{usageSummary:i.usageSummary}),void 0!==i.agentServiceTranscript?(0,d.jsx)(ek,{transcript:i.agentServiceTranscript,eventsTruncated:(null==(t=i.agentServiceSession)?void 0:t.eventsTruncated)??!1}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(eC,{summary:i.summary}),o.length>0?(0,d.jsx)(eT,{steps:o,allSteps:i.steps}):void 0,(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:[(0,d.jsxs)(a(111010).D,{styleKey:"titleSmSemibold",children:["Steps (",i.steps.length,")"]}),(0,d.jsxs)("span",{style:ey.stepMeta,children:[c," inferences · ",l," tools ·"," ",o.length," errors"]})]}),(0,d.jsx)("div",{style:ey.stepList,children:i.steps.map((e,t)=>(0,d.jsx)(eR,{step:e,index:t},e.id))})]})]}),(0,d.jsxs)("div",{style:ey.section,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",style:ey.sectionHeader,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Raw JSON"}),(0,d.jsx)(a(988022).p,{onClick:()=>s(!n),children:n?"Hide":"Show"})]}),n?(0,d.jsx)(a(243119).A,{data:i}):void 0]})]})},schema:{threadId:{type:"string",table:"thread",showByDefaultInSingleRecordMode:!0,comment:"Thread ID to debug"}}},adminExportAgentChatsForUser:{apiName:"adminExportAgentChatsForUser",displayName:"Export a user’s AI chat history",description:(0,d.jsxs)(d.Fragment,{children:["Export retained, user-visible Personal Agent and Custom Agent chats started by this user in this workspace. The ZIP excludes deleted chats, AI Writer, Research mode, Markdown chat, AssistantChatSession data, and Agent Service chats.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"1. Choose ",(0,d.jsx)("b",{children:"preview"})," to see chat counts. Leave Export ID and Confirmation text empty.",(0,d.jsx)("br",{}),"2. Choose ",(0,d.jsx)("b",{children:"start"})," and paste the confirmation text from the preview. Leave Export ID empty.",(0,d.jsx)("br",{}),"3. Choose ",(0,d.jsx)("b",{children:"status"})," and paste the export ID from the start response. Submit again until the ZIP is ready.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Use the same approved Privacy or Legal case URL for all 3 steps."]}),emoji:"📦",isDestructive:!0,schema:{spaceId:{type:"string",table:"space",comment:"Workspace that c
3ontains the chats"},userId:{type:"string",table:s().oo9,comment:"User who started the chats"},caseUrl:{type:"string",comment:"HTTPS link to the approved Privacy or Legal request. Use the same link for preview, start, and status."},action:{type:"options",options:["preview","start","status"],defaultValue:"preview",comment:"Preview shows counts. Start creates the ZIP. Status checks whether the ZIP is ready."},exportId:{type:"string",comment:"For status only. Copy this from the start response."},confirmationText:{type:"string",comment:"For start only. Copy this from the preview response."}}},adminUnshareThread:{apiName:"adminUnshareThread",displayName:"Unshare Thread",emoji:"🔒",description:"Disable all active shared copies of a chat thread. Use after T&S reviews a reported shared chat. Sets sharing_disabled on all copies so shared links stop working. Does NOT delete the source thread.",isDestructive:!0,schema:{threadId:{type:"string",table:"thread",comment:"Source thread ID (the original thread, not the shared copy ID)"}}},adminGetChatGPTTokenSharingState:{apiName:"adminGetChatGPTTokenSharingState",displayName:"ChatGPT Token Sharing State",emoji:"🔑",description:"Look up a user's Sign in with ChatGPT identities and ChatGPT token-sharing grant state and metadata. Add a workspace ID to also check eligibility, settings, and allowance there. Token secrets are never returned.",schema:{userId:{type:"string",table:s().oo9,comment:"Notion user ID"},spaceId:{type:"string",table:"space",comment:"Optional workspace ID — adds rollout, eligibility, settings, and allowance checks."}}},adminGetOpenAISafetyIdentifierLookup:{apiName:"adminGetOpenAISafetyIdentifierLookup",displayName:"OpenAI Safety ID Lookup",emoji:"🛡️",description:(0,d.jsx)(d.Fragment,{children:"Look up the Notion actor last recorded for an OpenAI safety ID. Use this for abuse notification emails from OpenAI. Results only cover recently populated safety IDs before Dynamo TTL expiry."}),schema:{safetyId:{type:"string",comment:"OpenAI safety ID from the abuse notification email"}}},adminGetAIAgentDailyCreditUsageLookup:{apiName:"adminGetAIAgentDailyCreditUsageLookup",displayName:"Agent Daily Credit Usage Lookup",emoji:"📈",description:"Look up one agent's daily and cumulative premium-credit usage and credit limits recorded by agent limit-change events for a selectable service period. Provide either the workspace ID or Metronome customer ID.",customResponseRenderer:function(e){let{data:t,environment:i}=e,[n,s]=(0,r.useState)(t),[l,p]=(0,r.useState)(!1),m=(0,a(327219).tz)(),u=(0,r.useCallback)(async e=>{let t=parseInt(e.target.value,10);p(!0);try{let e=await i.api.callApi({eventName:"adminGetAIAgentDailyCreditUsageLookup",environment:i,data:{agentId:n.agentId,spaceId:n.spaceId,billingPeriodIndex:t}});"success"===e.type&&s(e.data)}finally{p(!1)}},[i,n.agentId,n.spaceId]);return(0,d.jsx)("div",{style:a(469181).R7.container,children:(0,d.jsxs)(a(4458).VP,{gap:0,children:[(0,d.jsx)("div",{style:a(469181).R7.header,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Agent Daily Credit Usage"})}),(0,d.jsxs)("div",{style:a(469181).R7.metaRow,children:[(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Agent:"})," ",n.agentName??"Untitled"]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Agent ID:"})," ",n.agentId]})]}),(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Workspace:"})," ",n.spaceName]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Space ID:"})," ",n.spaceId]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Metronome Customer ID:"})," ",(0,d.jsx)("a",{href:o(n.metronomeCustomerId),target:"_blank",rel:"noopener noreferrer",children:n.metronomeCustomerId})]})]})]}),(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",marginTop:16,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.label,children:"Service Period:"})}),(0,d.jsx)("select",{style:a(469181).R7.select,value:n.selectedPeriodIndex,onChange:u,disabled:l,"aria-label":"Service period",children:n.availablePerio
3ds.map((e,t)=>(0,d.jsxs)("option",{value:t,children:[(0,a(469181).PS)(e),0===t?" (Latest)":""]},e.start))}),l?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Loading..."}):void 0]}),n.creditLimitHistoryAvailable?void 0:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:m.formatMessage(c.limitHistoryUnavailable)}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:m.formatMessage(c.recordedLimitExplanation)}),(0,d.jsx)("div",{style:a(469181).R7.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:m.formatMessage(c.dailyUsageAndLimitTitle)})}),(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th,children:"Date"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Daily credits used"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:"Cumulative credits used"}),(0,d.jsx)("th",{style:a(469181).R7.th,children:m.formatMessage(c.recordedCreditLimitHeader)})]})}),(0,d.jsx)("tbody",{children:n.dailyUsage.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).r6)(e.date)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.dailyCreditsUsed)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(e.cumulativeCreditsUsed)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:function(e,t){switch(e.type){case"limited":return(0,a(469181).Ql)(e.credits);case"unlimited":return t.formatMessage(c.unlimited);case"not_recorded":return t.formatMessage(c.notRecorded);case"unavailable":return t.formatMessage(c.unavailable)}}(e.recordedCreditLimit,m)})]},e.date))})]})}),(0,d.jsx)(a(4458).VP,{marginTop:24,children:(0,d.jsx)(a(243119).A,{data:(0,a(469181).Qu)(n)})})]})})},schema:{agentId:{type:"string",table:s().C0E,comment:"Custom agent workflow ID"},spaceId:{type:"string",table:"space",comment:"Workspace ID (required if Metronome Customer ID is not provided)"},metronomeCustomerId:{type:"string",comment:"Metronome Customer ID (alternative to Workspace ID)"},billingPeriodIndex:{type:"number",defaultValue:0,comment:"0 = latest service period"}}},adminGetAICreditUsageLookup:{apiName:"adminGetAICreditUsageLookup",displayName:"AI Credit Usage Lookup",emoji:"📊",description:(0,d.jsxs)(d.Fragment,{children:["Look up any workspace's AI credit usage. Provide either a Space ID or Stripe Customer ID.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Shows usage summary, agent breakdown, self-serve credit purchase payment status, and contract details for sales-assisted workspaces. Use the billing period dropdown to view previous periods (up to 3).",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Optionally provide a User ID to also get the status of that user's Notion AI Rolling and Monthly Usage Allowances — usage, limit, and percentage used for each allowance, and whether the user is currently blocked. Read-only: shows exactly what the user's app sees, without logging in as them."]}),customResponseRenderer:function(e){var t;let{data:i,environment:n}=e,[s,l]=(0,r.useState)(i),[c,p]=(0,r.useState)(!1),[m,u]=(0,r.useState)(1),[h,y]=(0,r.useState)(),[g,x]=(0,r.useState)(!1),[f,b]=(0,r.useState)(1),[v,j]=(0,r.useState)(),[S,w]=(0,r.useState)(!1),[I,C]=(0,r.useState)(30),[D,T]=(0,r.useState)(!1),R=(0,r.useCallback)(async e=>{var t;let a=await n.api.callApi({eventName:"adminGetAICreditUsageLookup",environment:n,data:{spaceId:s.spaceId,billingPeriodIndex:s.selectedPeriodIndex,userId:null==(t=s.userAllowanceStatus)?void 0:t.userId,topEntitiesCursor:h,userBreakdownCursor:v,allowanceHistoryDays:I,...e}});return"success"===a.type&&(l(a.data),!0)},[n,h,s.spaceId,s.selectedPeriodIndex,null==(t=s.userAllowanceStatus)?void 0:t.userId,v,I]),A=(0,r.useCallback)(async e=>{let t=parseInt(e.target.value,10);C(t),T(!0);try{await R({allowanceHistoryDays:t})}finally{T(!1)}},[R]),N=(0,r.useCallback)(async e=>{let t=parseInt(e.target.value,10);p(!0);try{await R({billingPeriodIndex:t,topEntitiesCursor:void 0,userBreakdownCursor:void 0})&&(u(1),y(void 0),b(1),j(void 0))}finally{p(!1)}},[R]),M=(0,r.useCallback)(async()=>
3{if(s.topEntitiesNextCursor){x(!0);try{await R({topEntitiesCursor:s.topEntitiesNextCursor})&&(y(s.topEntitiesNextCursor),u(e=>e+1))}finally{x(!1)}}},[R,s.topEntitiesNextCursor]),V=(0,r.useCallback)(async()=>{if(s.topEntitiesPreviousCursor){x(!0);try{await R({topEntitiesCursor:s.topEntitiesPreviousCursor})&&(y(s.topEntitiesPreviousCursor),u(e=>Math.max(1,e-1)))}finally{x(!1)}}},[R,s.topEntitiesPreviousCursor]),E=(0,r.useCallback)(async()=>{if(s.userBreakdownNextCursor){w(!0);try{await R({userBreakdownCursor:s.userBreakdownNextCursor})&&(j(s.userBreakdownNextCursor),b(e=>e+1))}finally{w(!1)}}},[R,s.userBreakdownNextCursor]),B=(0,r.useCallback)(async()=>{if(s.userBreakdownPreviousCursor){w(!0);try{await R({userBreakdownCursor:s.userBreakdownPreviousCursor})&&(j(s.userBreakdownPreviousCursor),b(e=>Math.max(1,e-1)))}finally{w(!1)}}},[R,s.userBreakdownPreviousCursor]);return(0,d.jsx)("div",{style:a(469181).R7.container,children:(0,d.jsxs)(a(4458).VP,{gap:0,children:[(0,d.jsx)("div",{style:a(469181).R7.header,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"AI Credit Usage"})}),(0,d.jsxs)("div",{style:a(469181).R7.metaRow,children:[(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Workspace:"})," ",s.spaceName]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Space ID:"})," ",s.spaceId]}),s.metronomeCustomerId?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Metronome Customer ID:"})," ",(0,d.jsx)("a",{href:o(s.metronomeCustomerId),target:"_blank",rel:"noopener noreferrer",children:s.metronomeCustomerId})]}):void 0]}),(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Plan:"})," ",s.planType]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Type:"})," ",s.isSalesAssisted?"Sales-Assisted":"Self-Serve"]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Default agent credit limit:"})," ",(0,a(469181).C$)(s.defaultAgentCreditLimit)]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Credit overage:"})," ",(0,a(469181).GX)(s.aiCreditOverageSetting)]}),s.trialCreditTier?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:a(469181).R7.label,children:"Trial credit tier:"})," ",(0,a(469181).hp)(s.trialCreditTier)]}):void 0]})]}),(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",marginTop:16,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)("span",{style:a(469181).R7.label,children:"Service Period:"})}),(0,d.jsx)("select",{style:a(469181).R7.select,value:s.selectedPeriodIndex,onChange:N,disabled:c,children:s.availablePeriods.map((e,t)=>(0,d.jsxs)("option",{value:t,children:[(0,a(469181).PS)(e),0===t?" (Latest)":""]},e.start))}),c?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Loading..."}):void 0]}),s.usesMetronome?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Usage is cached for up to 15 minutes and can lag a recent credit adjustment. Confirm an adjustment from the refund result, not from this page."}):void 0,(0,d.jsx)(P,{status:s.userAllowanceStatus,history:s.userAllowanceHistory,selectedPeriod:s.selectedPeriod,historyDays:I,isLoading:D,onHistoryDaysChange:A}),(0,d.jsx)(k,{data:s,agentPage:m,isAgentPageLoading:g,userBreakdownPage:f,isUserBreakdownPageLoading:S,onAgentPreviousPage:V,onAgentNextPage:M,onUserBreakdownPreviousPage:B,onUserBreakdownNextPage:E}),(0,d.jsx)(a(4458).VP,{marginTop:24,children:(0,d.jsx)(a(243119).A,{data:(0,a(469181).Qu)(s)})})]})})},schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID (required if Stripe Customer ID is not provided)"},stripeCustomerId:{type:"string",placeholder:a(591977).cs,comment:"Stripe Customer ID (alternative to Space ID)"},userId:{type:"string",table:s().oo9,comment:"(Optional) also show this user's Notion AI Rolling and Monthly Usage Allowance status"},billingPeriodIndex:{type:"number",defaultValue:0,comment:"0 = latest period, 1 = previous, 2 = two periods ago"}}},adminGetAgentCreditLimit:{apiName:"adminGetAgentCreditLimit",displayName:"Agent Credit Limit Lookup",emoji:"🔎",description:"Look up the editor-set, explicit workspace-admin, workspace-default, effective workspace-admin, and enforced credit limits for a custom agent.",isDestructive:!1,schema:{workflowId:{type:"string",table:s().C0E,comment:"Custom agent workflow ID"}}},adminSetAgentCreditLimit:{apiName:"adminSetAgentCreditLimit",displayName:"Set Agent Credit Limit",emoji:"🎚️",description:"Set an explicit workspace-admin credit limit for a custom agent, or clear it so the workspace default applies. This may pause or resume the agent based on its current usage.",isDestructive:!0,schema:{workflowId:{type:"string",table:s().C0E,comment:"Custom agent workflow ID"},creditLimit:{type:"number",comment:"Non-negative integer credit limit; omit when clearing"},clearLimit:{type:"boolean",defaultValue:!1,comment:"Clear the explicit workspace-admin limit and use the workspace default"}}},adminGetEntitlementUsageLookup:{apiName:"adminGetEntitlementUsageLookup",displayName:"Entitlement Usage Lookup",emoji:"📋",description:"Look up all monthly w
3orkflow-level entitlement usage rows for a workspace from space_entitlement_usage.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID"}}},adminGetBillingContractLookup:{apiName:"adminGetBillingContractLookup",displayName:"Billing Contract Lookup",emoji:"💼",description:"Look up billing contract data for a workspace. Shows contract details, contract space audit history, and Metronome usage threshold state. The threshold state is a cached snapshot that credit enforcement reads, refreshed on Metronome webhooks and otherwise about hourly — so after a change to a workspace's commits it can lag what Metronome actually holds. Check Force sync to re-read it from Metronome before it is returned.",customResponseRenderer:function({data:e,environment:t}){var i,n,s,l,c;let[p,m]=(0,r.useState)(e),[u,h]=(0,r.useState)(!1),[y,g]=(0,r.useState)(void 0),x=(0,r.useCallback)(async e=>{let a=await t.api.callApi({eventName:"adminGetBillingContractLookup",environment:t,data:{spaceId:p.spaceId,metronomeCustomerId:p.metronomeCustomerId,...e}});"success"===a.type&&m(a.data)},[t,p.spaceId,p.metronomeCustomerId]),f=(0,r.useCallback)(async()=>{h(!0);try{await x({forceSync:!0})}finally{h(!1)}},[x]),b=(0,r.useCallback)(async e=>{g(e);try{await x({syncSalesforce:!0,syncSalesforceContractId:e})}finally{g(void 0)}},[x]),v=r.useMemo(()=>{var e;let t=p.billingContractHistory??[],a=null==(e=p.billingContract)?void 0:e.id;return a?t.filter(e=>e.id!==a):t},[null==(i=p.billingContract)?void 0:i.id,p.billingContractHistory]);return(0,d.jsx)("div",{style:L.container,children:(0,d.jsxs)(a(4458).VP,{gap:0,children:[(0,d.jsx)("div",{style:L.header,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"💼 Billing Contract Lookup"})}),p.spaceId?(0,d.jsx)("div",{style:L.card,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Workspace:"})," ",p.spaceName]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Space ID:"})," ",p.spaceId]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Uses Metronome Reporting:"})," ",p.usesMetronomeReporting?"✔ Yes":"✖ No"]}),p.metronomeCustomerId?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:L.label,children:"Metronome Customer ID:"})," ",(0,d.jsx)("a",{href:o(p.metronomeCustomerId),target:"_blank",rel:"noopener noreferrer",children:p.metronomeCustomerId})]}):void 0]})}):void 0,(0,d.jsxs)("div",{style:L.sideBySide,children:[(0,d.jsxs)("div",{style:L.sideBySideColumn,children:[(0,d.jsxs)("div",{style:{...L.sectionTitle,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Billing Contract"}),(0,d.jsx)("button",{type:"button",style:{...L.syncButton,opacity:void 0===y&&null!=(n=p.billingContract)&&n.external_id?1:.6,cursor:void 0===y&&null!=(s=p.billingContract)&&s.external_id?"pointer":"not-allowed"},onClick:()=>{var e;null!=(e=p.billingContract)&&e.external_id&&b(p.billingContract.external_id)},disabled:void 0!==y||!(null!=(l=p.billingContract)&&l.external_id),title:null!=(c=p.billingContract)&&c.external_id?void 0:"Salesforce contract not available",children:void 0!==y?"Syncing…":"↻ Sync from Salesforce"})]}),p.billingContract?(0,d.jsx)(H,{contract:p.billingContract,isActive:p.contractIsActive,isInLateRenewalPeriod:p.contractIsInLateRenewalPeriod,contractSpaces:p.currentContractSpaces,spaceNamesBySpaceId:p.spaceNamesBySpaceId}):(0,d.jsx)("div",{style:L.emptyState,children:"No billing contract found"})]}),(0,d.jsxs)("div",{style:L.sideBySideColumn,children:[(0,d.jsx)("div",{style:L.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Salesforce Contract"})}),p.salesforceContract?(0,d.jsx)(X,{contract:p.salesforceContract}):(0,d.jsx)("div",{style:L.emptyState,children:p.salesforceContractError??"No Salesforce contract found (missing external_id)"})]})]}),(0,d.jsxs)("div",{style:{...L.sectionTitle,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Metronome Usage Threshold State"}),(0,d.jsx)("button",{type:"button",style:{...L.syncButton,opacity:u||!p.metronomeUsageThresholdState?.6:1,cursor:u||!p.metronomeUsageThresholdState?"n
3ot-allowed":"pointer"},onClick:f,disabled:u||!p.metronomeUsageThresholdState,title:p.metronomeUsageThresholdState?void 0:"No Metronome threshold state available",children:u?"Syncing…":"↻ Sync from Metronome"})]}),p.metronomeUsageThresholdState?(0,d.jsx)(Q,{state:p.metronomeUsageThresholdState}):(0,d.jsx)("div",{style:L.emptyState,children:"No Metronome usage threshold state found"}),p.pfaDiagnostics&&p.pfaDiagnostics.length>0?(0,d.jsx)(Y,{diagnostics:p.pfaDiagnostics}):void 0,v.length>0?(0,d.jsx)(Z,{contracts:v,syncingSalesforceContractId:y,onSyncSalesforce:b}):void 0,p.billingContractSpaceHistory&&p.billingContractSpaceHistory.length>0?(0,d.jsx)(J,{history:p.billingContractSpaceHistory,spaceNames:p.spaceNamesBySpaceId??{}}):void 0,(0,d.jsx)(a(4458).VP,{marginTop:24,children:(0,d.jsx)(a(243119).A,{data:p})})]})})},schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID (required if Metronome Customer ID is not provided)"},metronomeCustomerId:{type:"string",comment:"Metronome Customer ID (required if Worksp
3ace ID is not provided)"},forceSync:{type:"boolean",name:"Force sync",defaultValue:!1,comment:"Re-read the Metronome usage threshold state from Metronome instead of returning the cached snapshot."}}},adminGetCreditAdjustmentAuditLog:{apiName:"adminGetCreditAdjustmentAuditLog",displayName:"Credit Adjustment Audit Log",emoji:"📒",isDestructive:!1,description:(0,d.jsxs)(d.Fragment,{children:["View audit-log entries for the Refund Notion Credits admin tool.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Reads from the existing admin API log, surfacing the admin user, the timestamp, and the request params (workspace, credit amount, reason) for each refund call. All filters are optional — leave blank to see the most recent entries."]}),customResponseRenderer:function(e){let{data:t}=e,{entries:i}=t;return(0,d.jsxs)("div",{style:{...es.container,...es.containerInner},children:[(0,d.jsx)("div",{style:es.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Credit Adjustment Audit Log"})}),(0,d.jsxs)(a(111010).D,{styleKey:"bodyRegular",children:["Showing ",i.length," ",1===i.length?"entry":"entries"," ","from ",(0,d.jsx)("code",{children:"admin_api_log"})," for event ",(0,d.jsx)("code",{children:t.eventName}),"."]}),0===i.length?(0,d.jsx)("div",{style:es.emptyState,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"No matching credit adjustment audit entries."})}):(0,d.jsxs)("table",{style:es.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:es.th,children:"When"}),(0,d.jsx)("th",{style:es.th,children:"Admin"}),(0,d.jsx)("th",{style:es.th,children:"Workspace"}),(0,d.jsx)("th",{style:es.th,children:"Credits"}),(0,d.jsx)("th",{style:es.th,children:"Reason"})]})}),(0,d.jsx)("tbody",{children:i.map(e=>{var t,a;let i=(null==(t=e.adminUser)?void 0:t.email)??e.adminUserId,n=void 0===e.creditAmount||void 0===e.reason;return(0,d.jsxs)("tr",{style:n?es.failedRow:void 0,children:[(0,d.jsxs)("td",{style:es.td,children:[eo(e.timestamp),n?(0,d.jsx)("div",{style:es.rejectedTag,children:"rejected (invalid request)"}):void 0]}),(0,d.jsxs)("td",{style:es.td,children:[i,(0,d.jsx)("div",{style:es.mono,children:e.adminUserId})]}),(0,d.jsx)("td",{style:{...es.td,...es.mono},children:e.spaceId??"—"}),(0,d.jsx)("td",{style:es.td,children:void 0===(a=e.creditAmount)?"—":a.toLocaleString(void 0,{maximumFractionDigits:0,roundingMode:"trunc"})}),(0,d.jsx)("td",{style:es.td,children:e.reason??"—"})]},e.id)})})]}),(0,d.jsxs)("details",{children:[(0,d.jsx)("summary",{style:es.summary,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Raw response"})}),(0,d.jsx)("div",{style:es.detailsBody,children:(0,d.jsx)(a(243119).A,{data:function e(t){let a={};for(let[i,n]of Object.entries(t))el.has(i)&&"number"==typeof n&&n>0?a[i]=`${n} (${eo(n)})`:a[i]=function t(a){return Array.isArray(a)?a.map(t):null!==a&&"object"==typeof a?e(a):a}(n);return a}(t)})})]})]})},schema:{adminUserId:{type:"string",table:s().oo9,comment:"Optional: filter to a specific admin user"},spaceId:{type:"string",table:"space",comment:"Optional: filter to a specific workspace"},startDate:{type:"datetimeISO",comment:"Optional: only include entries on or after this time"},endDate:{type:"datetimeISO",comment:"Optional: only include entries on or before this time"},limit:{type:"number",numberType:"integer",min:1,max:500,defaultValue:100,comment:"Max rows to return (default 100, max 500)"}}},adminListCustomAgentTrustedHostnames:{apiName:"adminListCustomAgentTrustedHostnames",displayName:"List Custom Agent Trusted Hostnames",emoji:"📜",description:(0,d.jsxs)(d.Fragment,{children:["List every hostname currently in the custom-agent URL safety trusted-hostnames Set (stage 3a of the pipeline).",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Stage 3a matches on ",(0,d.jsx)("strong",{children:"exact hostname"})," — subdomains do not inherit trust. Read-only."]}),schema:{},isDestructive:!1},adminAddCustomAgentTrustedHostnames:{apiName:"adminAddCustomAgentTrustedHostnames",displayName:"Add Custom Agent Trusted Hostnames",emoji:"➕",description:(0,d.jsxs)(d.Fragment,{children:["Add one or more hostnames to the custom-agent URL safety trusted-hostnames Set. Accepts a single hostname or many — the input splits on commas and newlines server-side.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Every entry is validated and normalized (trimmed + lowercased) before the write. If ",(0,d.jsx)("em",{children:"any"})," entry fails validation the whole call is rejected and the Set is not touched."]}),schema:{hostnames:{type:"string",comment:"Hostnames to add, separated by commas or newlines. Each is validated independently — if any one fails, the whole call is rejected. No scheme, path, or port; subdomains must be listed explicitly.",placeholder:"example.com, docs.google.com, notion.so"}},isDestructive:!1},adminRemoveCustomAgentTrustedHostnames:{apiName:"adminRemoveCustomAgentTrustedHostnames",displayName:"Remove Custom Agent Trusted Hostnames",emoji:"➖",description:(0,d.jsx)(d.Fragment,{children:"Remove one or more hostnames from the custom-agent URL safety trusted-hostnames Set. Accepts a single hostname or many — the input splits on commas and newlines server-side. Inputs are normalized (trimmed + lowercased) to match the Set's canonical form. Entries not in the Set are silently skipped."}),schema:{hostnames:{type:"string",comment:"Hostnames to remove, separated by commas or newlines.",placeholder:"example.com, docs.google.com, notion.so"}},isDestructive:!0},adminGetWorkspaceModelRestrictions:{apiName:"adminGetWorkspaceModelRestrictions",displayName:"Get Workspace Model Restrictions",description:(0,d.jsxs)(d.Fragment,{children:["Inspect workspace model controls for both agent surfaces (Custom Agent and Notion Agent), billing-country restrictions, and the current GEO enforcement rollout.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Add a country to preview its geographic policy. For sanctioned regions within Ukraine, choose the matching location group. Customer location is never retrieved or saved.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"GEO policies are separate from bans and workspace model controls."]}),emoji:"🔐",isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;function i(e){return t.modelDisplayNames[e]??e}let n=t.agentModelPolicies,r=(null==n?void 0:n.customAgent)??{disabledModels:t.disabledModels,disabledProviders:t.disabledProviders,allowedRestrictedModels:[],defaultModel:t.defaultModel,isConfigured:t.disabledModels.length>0||t.disabledProviders.length>0||void 0!==t.defaultModel};return(0,d.jsxs)(a(4458).VP,{gap:16,padding:24,marginInline:"auto",maxWidth:760,width:"100%",children:[(0,d.jsxs)(a(4458).VP,{gap:6,style:e1.header,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:"WORKSPACE MODEL RESTRICTIONS"}),(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:t.spaceName}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",style:e1.workspaceId,children:t.spaceId})]}),void 0!==t.geoRestriction?(0,d.jsx)(e6,{geoRestriction:t.geoRestriction}):void 0,void 0!==t.geoCountryDiagnostic?(0,d.jsx)(e9,{diagnostic:t.geoCountryDiagnostic}):void 0,(0,d.jsxs)(a(4458).VP,{gap:16,style:e1.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Worksp
3ace-wide AI controls"}),(0,d.jsxs)("div",{style:e1.metadataGrid,children:[(0,d.jsx)(ta,{label:"Provider policy",value:function(e){if("none"===e.source||!e.rule)return"None";let t="space_settings"===e.source?"space settings":"organization",a=e.rule;if("type"in a){let e="only_allow"===a.type?"Only allow":"Disallow";return`${e}: ${a.providers.join(", ")} (from ${t})`}let i=[void 0!==a.onlyAllow?`Only allow: ${tt(a.onlyAllow)}`:void 0,void 0!==a.disallow?`Disallow: ${tt(a.disallow)}`:void 0].filter(e=>void 0!==e);return`${i.join("; ")||"No restrictions"} (from ${t})`}(t.providerRestriction)}),(0,d.jsx)(ta,{label:"Zero data retention",value:t.zdrEnabled?"Enabled":"Disabled"}),(0,d.jsx)(ta,{label:"HIPAA setting",value:t.zeroRetentionSettingEnabled?"Enabled":"Disabled"})]})]}),(0,d.jsx)(e4,{title:"Custom Agent model controls",settingName:"custom_agent_model_policy",policy:r,hasWorkspaceDefault:!0,modelLabel:i}),void 0!==n?(0,d.jsx)(e4,{title:"Notion Agent model controls",settingName:"personal_agent_model_policy",policy:n.personalAgent,hasWorkspaceDefault:!1,modelLabel:i}):(0,d.jsxs)(a(4458).VP,{gap:16,style:e1.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Notion Agent model controls"}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Not reported by this server. Retry once the deploy finishes."})]}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Premium (Ultra-priced) models are off until allowed by name, so one missing from a surface's allowed list is restricted there even when no list names it. A surface marked “not set” allows none of them, which is not the same as restricting nothing."})]})},schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to inspect"},diagnosticCountryCode:{type:"string",comment:"Optional two-letter country code for a hypothetical check",placeholder:"US"},diagnosticLocationGroup:{type:"options",options:[{displayName:"Sanctioned territories within Ukraine",value:"ua_sanctioned_territories"}],comment:"Optional region; available only when the country is UA"}}},adminGetCustomAgentCreationPolicy:{apiName:"adminGetCustomAgentCreationPolicy",displayName:"View/Update Custom Agent Creation Policy",description:(0,d.jsxs)(d.Fragment,{children:["View and update who can create custom agents in a workspace.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Enter a workspace ID to see the current policy. You can then select a new policy from the dropdown and apply the change with confirmation.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Policy options:",(0,d.jsx)("br",{}),"- ",(0,d.jsx)("strong",{children:"All Workspace Members"}),": All workspace members can create agents (default)",(0,d.jsx)("br",{}),"- ",(0,d.jsx)("strong",{children:"Workspace Owners Only"}),": Only workspace owners can create agents"]}),emoji:"🤖",isDestructive:!1,customResponseRenderer:function(e){let{data:t,environment:i}=e,n="workspace_owners_only"===t.currentPolicy?"workspace_owners_only":"disabled"===t.currentPolicy?"disabled":"all_workspace_members",[s,o]=(0,r.useState)(n),[l,c]=(0,r.useState)(!1),[p,m]=(0,r.useState)(null),[u,h]=(0,r.useState)(!1),[y,g]=(0,r.useState)(""),x=s!==(t.currentPolicy??"all_workspace_members"),f="disabled"===s,b=(0,r.useMemo)(()=>eh(y),[y]),v=(0,r.useCallback)(e=>{let t=e.target.value;(0,ed().Xk)(em,t)&&(o(t),"disabled"!==t&&h(!1))},[]),j=(0,r.useCallback)(e=>{g(e.target.value),eh(e.target.value)||h(!1)},[]),k=(0,r.useCallback)(async()=>{if(!x&&!u)return;let e=eu(t.currentPolicy),n=eu(s),r="";if(e!==n&&(r=`Are you sure you want to change the custom agent creation policy for "${t.spaceName}" from "${e}" to "${n}"?`),u){r&&(r+="\n\n");let e=t.agentCounts.enabled;r+=`Warning: This will disable all ${e} currently enabled ${1===e?"agent":"agents"} in this workspace.`}if((await a(647095).Gh({mode:"wide",message:"Confirm Policy Change",description:r,acceptLabel:u?"Disable Agents & Apply":"Confirm",cancelLabel:"Cancel"})).accept){c(!0),m(null);try{let e=await i.api.callApi({eventName:"adminUpdateCustomAgentCreationPolicy",environment:i,data:{spaceId:t.spaceId,policy:s,disableExistingAgents:u,zendeskTicketUrl:u?y.trim():void 0}});if("success"===e.type){let t=e.data.changed?`Policy updated successfully from "${eu(e.data.previousPolicy)}" to "${eu(e.data.newPolicy)}"`:"No changes were made to the policy";void 0!==e.data.disabledAgentsCount&&e.data.disabledAgentsCount>0?t+=`. ${e.data.disabledAgentsCount} agent(s) were disabled.`:u&&(t+=". No agents needed to be disabled."),m({success:!0,message:t})}else m({success:!1,message:"Failed to update policy: Unknown error"})}catch(e){m({success:!1,message:`Error updating policy: ${e instanceof Error?e.message:"Unknown error"}`})}finally{c(!1)}}},[i,t,s,x,u,y]),S=eu(t.currentPolicy),w=!x&&!u||l||u&&!b;return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:ec.header,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Custom Agent Creation Policy"})}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(324489).V,{isSmall:!0,children:[(0,d.jsx)("span",{style:ec.label,children:"Worksp
3ace:"})," ",t.spaceName]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,children:[(0,d.jsx)("span",{style:ec.label,children:"Space ID:"})," ",t.spaceId]})]}),(0,d.jsxs)("div",{style:ec.currentPolicyBox,children:[(0,d.jsxs)(a(324489).V,{isSmall:!0,children:[(0,d.jsx)("span",{style:ec.label,children:"Current Policy:"})," ",S]}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:t.currentPolicyDescription})]}),(0,d.jsxs)("div",{style:ec.agentCountsBox,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:ec.label,children:"Agent Counts"})}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Enabled:"}),(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:{...ec.label,color:a(632079).Tj.green.text.primary},children:t.agentCounts.enabled})})]}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Disabled:"}),(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:{...ec.label,color:a(632079).Tj.red.text.primary},children:t.agentCounts.disabled})})]}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Deleted:"}),(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:ec.label,children:t.agentCounts.deleted})})]})]}),p?(0,d.jsx)("div",{style:p.success?ec.successMessage:ec.errorMessage,children:p.message}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(a(4458).VP,{marginTop:16,gap:8,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:ec.label,children:"Select New Policy:"})}),(0,d.jsx)("div",{style:ec.selectWrapper,children:(0,d.jsx)("select",{style:ec.select,value:s,onChange:v,children:ep.map(e=>(0,d.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),f?(0,d.jsxs)("div",{style:ec.disableAgentsSection,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:ec.disableAgentsSectionTitle,children:"Disable all existing agents?"})}),(0,d.jsxs)(a(4458).VP,{marginTop:12,gap:4,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:(0,d.jsx)("span",{style:ec.label,children:"Zendesk Ticket URL:"})}),(0,d.jsx)(a(287562).p,{value:y,onChange:j,placeholder:a(591977).r1,style:ec.zendeskInput}),y&&!b?(0,d.jsx)("div",{style:ec.warningText,children:"Please enter a valid Zendesk ticket URL (e.g., https://makenotion.zendesk.com/agent/tickets/12345)"}):void 0]}),(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,marginTop:16,children:[(0,d.jsx)(a(382726).S,{checked:u,size:16,onClick:()=>{(u||b)&&h(!u)},disabled:!b&&!u}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:"Warning: This action is irreversible and highly disruptive. Only enable this if the customer has specifically requested that all existing agents be disabled."})]}),(0,d.jsx)("div",{style:ec.warningText,children:"A valid Zendesk ticket URL is required to enable this option."})]}):void 0,(0,d.jsx)(a(4458).fI,{gap:8,marginTop:16,justifyContent:"flex-end",children:(0,d.jsx)(a(912946).j,{onClick:k,disabled:w,isLoading:l,children:l?"Updating...":"Apply Changes"})})]})]})},schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to view/update"}}},adminGetExternalAgentAccessPolicy:{apiName:"adminGetExternalAgentAccessPolicy",displayName:"View/Update External Agent Provider Access Policy",description:(0,d.jsxs)(d.Fragment,{children:["View and update which external agent providers are allowed in a workspace.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Enter a workspace ID to see the stored external_agent_access_policy, the effective behavior after defaults and legacy settings are applied, and the providers available for that workspace. Updates are only available from the fetched response."]}),emoji:"🛡️",isDestructive:!1,customResponseRenderer:function(e){let{data:t,environment:i}=e,[n,s]=(0,r.useState)(t),[o,l]=(0,r.useState)(()=>eW(t)),[c,p]=(0,r.useState)(!1),[m,u]=(0,r.useState)(),h=(0,r.useMemo)(()=>e$(n.availableAgents.map(e=>e.agentType)),[n.availableAgents]),y=(0,r.useMemo)(()=>(0,ed().objectKeys)(o.allowedAgentTypes).filter(e=>!0!==h[e]),[h,o.allowedAgentTypes]),g=eO(eF(o))!==eO(n.storedPolicy)||n.legacyDisableExternalAgents,x=(0,r.useCallback)(e=>{u(void 0),l(t=>"allowlist"!==e?{...t,mode:e}:"allowlist"===t.mode?t:{mode:e,allowedAgentTypes:eK({policy:n.effectivePolicy,availableAgents:n.availableAgents})})},[n.availableAgents,n.effectivePolicy]),f=(0,r.useCallback)(e=>{u(void 0),l(t=>{let a={...t.allowedAgentTypes};return a[e]?delete a[e]:a[e]=!0,{...t,allowedAgentTypes:a}})},[]),b=(0,r.useCallback)(()=>{u(void 0),l(eW(n))},[n]),v=(0,r.useCallback)(async()=>
3{if(g&&!c&&(await a(647095).Gh({mode:"wide",message:"Confirm External Agent Provider Policy Change",description:function(e){let{spaceName:t,currentPolicy:a,draft:i}=e;return`Apply external agent provider access policy change for "${t}"?
4
5Current stored value: ${ez(a)}
6
7New stored value: ${ez(eF(i))}`}({spaceName:n.spaceName,currentPolicy:n.storedPolicy,draft:o}),acceptLabel:"Apply Changes",cancelLabel:"Cancel"})).accept){p(!0),u(void 0);try{let e=await i.api.callApi({eventName:"adminUpdateExternalAgentAccessPolicy",environment:i,data:{spaceId:n.spaceId,mode:o.mode,allowedAgentTypes:"allowlist"===o.mode?(0,ed().objectKeys)(o.allowedAgentTypes):void 0,expectedPolicyVersionKey:n.policyVersionKey}});if("success"!==e.type)return void u({type:"error",message:"Failed to update policy: Unknown error"});let t=e.data;s(t),l(eW(t)),u({type:"success",message:t.changed?"External agent provider access policy updated.":"No changes were made to the policy."})}catch(e){u({type:"error",message:`Error updating policy: ${(0,a(324497).A)(e).message}`})}finally{p(!1)}}},[o,i,g,c,n]);return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,maxWidth:760,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"External Agent Provider Access Policy"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"Get the workspace policy first, then update from this response. The update is rejected if the policy changes before you apply it."})]}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(eL,{label:"Workspace",value:n.spaceName}),(0,d.jsx)(eL,{label:"Space ID",value:n.spaceId}),(0,d.jsx)(eL,{label:"Subscription tier",value:n.subscriptionTier}),(0,d.jsx)(eL,{label:"HIPAA zero retention enabled",value:n.isHipaaZeroRetentionEnabled?"true":"false"})]}),(0,d.jsxs)(a(4458).VP,{gap:8,padding:12,style:eE.infoBox,children:[(0,d.jsx)(eL,{label:"Stored external_agent_access_policy",value:n.storedPolicy?"set":"undefined"}),n.legacyDisableExternalAgents?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"Legacy disable_external_agents is true. Applying any policy here will remove that legacy flag."}):void 0,(0,d.jsxs)(a(111010).D,{styleKey:"bodySmRegular",children:["Effective behavior: ",n.effectivePolicyDescription]}),(0,d.jsx)(a(4458).VP,{padding:8,style:eE.codeBlock,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",children:ez(n.storedPolicy)})})]}),m?(0,d.jsx)(a(4458).VP,{padding:12,style:"success"===m.type?eE.successMessage:eE.errorMessage,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",children:m.message})}):void 0,(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"New Policy"}),eB.map(e=>(0,d.jsx)(e_,{option:e,selectedMode:o.mode,onSelect:x},e.mode))]}),"allowlist"===o.mode?(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"Allowed Providers"}),n.availableAgents.length>0?(0,d.jsx)(a(4458).VP,{width:"100%",style:eE.providerList,children:n.availableAgents.map((e,t)=>(0,d.jsx)(eU,{agentType:e.agentType,displayName:e.displayName,checked:!0===o.allowedAgentTypes[e.agentType],isLast:t===n.availableAgents.length-1,onToggle:f},e.agentType))}):(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"No configurable providers are available for this workspace."}),y.length>0?(0,d.jsxs)(a(4458).VP,{gap:4,padding:12,style:eE.warningBox,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmMedium",children:"Unavailable stored agent types"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",children:y.join(", ")}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"These values are preserved while you stay in allowlist mode, but they are not currently returned as available providers for this workspace."})]}):void 0]}):void 0,(0,d.jsxs)(a(4458).fI,{gap:8,justifyContent:"flex-end",children:[(0,d.jsx)(a(548436).A,{onClick:b,disabled:c,children:"Reset"}),(0,d.jsx)(a(912946).j,{onClick:v,disabled:!g||c,isLoading:c,children:"Apply Changes"})]})]})},schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to view/update"}}},adminGetExternalAgentSpecifications:{apiName:"adminGetExternalAgentSpecifications",displayName:"Manage External Agent Specifications",description:(0,d.jsxs)(d.Fragment,{children:["Search for external agent specifications by specification ID, creator user ID, or allowed workspace ID. Inspect every persisted field and update user-editable fields.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Workspace additions are validated as existing workspaces before they can be added to the draft, and every update uses a version check to prevent over
7writing a concurrent change."]}),emoji:"🧩",isDestructive:!1,customResponseRenderer:function(e){let{data:t,environment:i}=e,n=(0,a(327219).tz)(),[s,o]=(0,r.useState)(t),l=s.specifications,[c,p]=(0,r.useState)(),[m,u]=(0,r.useState)(),[h,y]=(0,r.useState)(),g=(0,r.useRef)(0);(0,r.useEffect)(()=>(o(t),p(void 0),u(void 0),y(void 0),()=>{g.current+=1}),[t]);let x=(0,r.useCallback)(()=>{p(void 0)},[]),f=(0,r.useCallback)(e=>{o(t=>{var a,i;return a=t,i=e,{...a,specifications:a.specifications.flatMap(e=>e.id!==i.id?[e]:void 0===a.lookupSpaceId||i.allowedSpaceIds.includes(a.lookupSpaceId)?[{id:i.id,name:i.name,status:i.status}]:[])}}),p(e)},[]),b=(0,r.useCallback)(async e=>{if(void 0!==m)return;let t=++g.current;y(void 0),u(e);try{let a=await i.api.callApi({eventName:"adminGetExternalAgentSpecifications",environment:i,data:{lookupType:"specification_id",specificationId:e,includeDetails:!0}});if(t!==g.current)return;if("success"!==a.type)return void y(e0(a.body,n.formatMessage(eG.detailsLoadFailed)));let r=a.data.specifications.find(t=>t.id===e);if(!r||!("allowedSpaces"in r))return void y(n.formatMessage(eG.detailsLoadFailed));p(r)}catch(e){(0,a(208318).t)().log({level:"warning",from:"AdminExternalAgentSpecifications",type:"loadExternalAgentSpecificationDetailsFailed",error:(0,a(952977).convertErrorToLog)(e)}),t===g.current&&y((0,a(324497).A)(e).message)}finally{t===g.current&&u(void 0)}},[i,n,m]);return c?(0,d.jsx)(eH,{specification:c,environment:i,onBack:x,onUpdated:f}):(0,d.jsxs)(a(4458).VP,{gap:12,padding:16,maxWidth:900,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"Matched external agent specifications"}),s.isTruncated?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:(0,d.jsx)(a(327219).sA,{...eG.truncatedResults})}):void 0,h?(0,d.jsx)(a(4458).VP,{padding:12,style:eq.errorMessage,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",children:h})}):void 0,0===l.length?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:(0,d.jsx)(a(327219).sA,{...eG.emptyResults})}):l.map(e=>(0,d.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,padding:12,style:eq.resultCard,children:[(0,d.jsxs)(a(4458).VP,{gap:4,minWidth:0,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:e.name}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",style:eq.monospace,children:[e.id," · ",e.status]})]}),(0,d.jsx)(a(548436).A,{size:"sm",isLoading:m===e.id,disabled:void 0!==m,onClick:()=>void b(e.id),children:"View details"})]},e.id))]})},schema:{lookupType:{type:"options",name:"Lookup by",options:[{displayName:"Specification ID",value:"specification_id"},{displayName:"User ID",value:"user_id"},{displayName:"Workspace ID",value:"space_id"}],defaultValue:"specification_id",required:!0,isRequired:!0},specificationId:{type:"string",comment:"The exact external agent specification ID to search for",visibleWhen:{field:"lookupType",value:"specification_id"},isRequired:!0},userId:{type:"string",table:s().oo9,comment:"Find specifications created by this user",visibleWhen:{field:"lookupType",value:"user_id"},isRequired:!0},spaceId:{type:"string",table:"space",comment:"Find specifications whose allowed workspaces include this ID",visibleWhen:{field:"lookupType",value:"space_id"},isRequired:!0}}}},tl=["notion-mail","notion-calendar","custom"],td={fontSize:12,color:"red"},tc={cursor:"pointer"},tp={adminFindThirdPartyConnection:{apiName:"adminFindThirdPartyConnection",displayName:"Find the workspace associated with a 3P ID",emoji:"🔎",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(428217).V,{external:!0,href:"https://dev.notion.so/notion/How-to-find-3p-ID-29bb35e6e67f80119e5fc67ef8e6703a",color:"notion-link-blue",style:tc,children:"How to find 3p ID?"}),(0,d.jsx)("div",{style:td,children:"Verify you are giving this data to authorized personnel only. Eg: verifying their email domains."})]}),schema:{thirdPartyId:{type:"string",comment:"The third-party ID to find the workspace for"},connectionType:{type:"options",options:a(281708).fl.map(e=>String(e)),comment:"The type of connector"}}},adminCheckConnectorConnection:{apiName:"adminCheckConnectorConnection",displayName:"Check Connector Connection Status",emoji:"🔌",submitConfirmation:{message:"Do you have the user’s consent?",description:"Without consent, the tool checks only the connection status. With consent, it also fetches current scopes directly from Slack.",primaryAction:{label:"No, check connection only",value:!1},secondaryAction:{label:"Yes, I obtained consent",value:!0},resultField:"customerConsentProvided",visibleWhen:{field:"connector",value:"slack"}},description:(0,d.jsx)(d.Fragment,{children:"Check if a specific AI connector is connected for a given space and user. Returns connection status and detailed connection data if connected."}),schema:{connector:{type:"options",options:a(281708).fl.map(e=>String(e)),comment:"The type of connector to check"},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The space ID to check connection for",showByDefaultInSingleRecordMode:!1},userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"The user ID to check connection as"}}},adminListAIConnectors:{apiName:"adminListAIConnectors",displayName:"List AI Connectors for Space",emoji:"🔗",description:(0,d.jsx)(d.Fragment,{children:"List all AI connector connections for a given space and its parent organization."}),schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The space ID to list connectors for",showByDefaultInSingleRecordMode:!1}}},adminDisconnectAIConnector:{apiName:"adminDisconnectAIConnector",displayName:"Disconnect AI Connector for Space",emoji:"🔌",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(428217).V,{external:!0,href:"https://app.dev.notion.com/p/notion/Disconnecting-a-connector-from-a-Space-364b35e6e67f80b0a829f6903c18a8dc?source=copy_link",color:"notion-link-blue",style:tc,children:"Worksp
7ace-level disconnect for a connector from a Space"}),(0,d.jsxs)("div",{style:td,children:[(0,d.jsx)("strong",{children:"Before submitting:"})," Confirm you have the right (workspace, connector) pair."]})]}),isDestructive:!0,typedConfirmation:{expectedValueResponseKey:"spaceName",description:"You are about to disconnect this AI connector from the workspace. This is irreversible — please verify the workspace details below and type the workspace name to confirm.",inputLabel:"Workspace name",confirmButtonLabel:"Disconnect connector",conditionalDisclaimer:{conditionResponseKey:"spaceIsHardDeleted",message:'⚠️ Either the space has been hard-deleted or does not exist — please confirm a connection exists for this (space, connector) pair using the "List AI Connectors for Space" admin tool before proceeding.'}},schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The space ID to disconnect from",showByDefaultInSingleRecordMode:!1},connector:{type:"options",options:a(281708).fl.filter(e=>!tl.includes(e)).map(e=>String(e)),comment:"The connector type to disconnect (personal connectors and `custom` are unsupported at workspace level)"}}},adminValidateSlackExternalConnectionToken:{apiName:"adminValidateSlackExternalConnectionToken",displayName:"Validate Slack External Connection Token",emoji:"🔐",description:(0,d.jsxs)(d.Fragment,{children:["Validate the Slack tokens stored on an ",(0,d.jsx)("code",{children:"external_connection"})," ","row by calling Slack's ",(0,d.jsx)("code",{children:"auth.test"})," for each token. Returns validity, identity, and the granted scopes (from the"," ",(0,d.jsx)("code",{children:"X-OAuth-Scopes"})," response header) for both the bot"," ",(0,d.jsx)("code",{children:"accessToken"})," and the optional ",(0,d.jsx)("code",{children:"userAccessToken"}),". Only valid for ",(0,d.jsx)("code",{children:"integration_type=slack"}),"."]}),schema:{externalConnectionId:{type:"string",table:s().Klg,placeholder:a(591977).nZ,comment:"The external_connection row ID (Slack connections only)"},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"(Optional) Space ID — speeds up lookup by skipping record-to-space resolution",showByDefaultInSingleRecordMode:!1}}},adminAIConnectorS3Inspect:{apiName:"adminAIConnectorS3Inspect",displayName:"AI Connector Debug Query",emoji:"🔍",description:(0,d.jsx)(d.Fragment,{children:"Run a config-driven debug query against AI connector S3 data. Returns only allowlisted fields — no sensitive content is exposed."}),schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The space ID to query",showByDefaultInSingleRecordMode:!1},connectionType:{type:"options",options:a(281708).fl.map(e=>String(e)),comment:"The type of connector (e.g. slack, jira, sharepoint)"},queryType:{type:"options",options:[{displayName:"[Slack] Channel Selection (slack_selection_state)",value:"slack_selection_state"},{displayName:"[Slack] Channel ID by Name (slack_channel_id_by_name)",value:"slack_channel_id_by_name"},{displayName:"[Slack] Channel Info by ID (slack_channel_info)",value:"slack_channel_info"},{displayName:"[Asana] Live Ingestion State (asana_live_ingestion_state)",value:"asana_live_ingestion_state"},{displayName:"[Asana] Workspace Projects (asana_workspace_projects)",value:"asana_workspace_projects"},{displayName:"[Google Drive] Last Sync Timestamp (google_drive_last_sync_timestamp)",value:"google_drive_last_sync_timestamp"},{displayName:"[Google Drive] Initial Ingestion State (google_drive_initial_ingestion_state)",value:"google_drive_initial_ingestion_state"},{displayName:"[Google Drive] Live Ingestion State (google_drive_live_ingestion_state)",value:"google_drive_live_ingestion_state"},{displayName:"[SharePoint] Diagnose File Not Found (sharepoint_diagnose_file)",value:"sharepoint_diagnose_file"},{displayName:"[Multiple] Last Sync Timestamp (last_sync_timestamp)",value:"last_sync_timestamp"}],comment:"Which debug query to run (each query reads specific S3 data)"},params:{type:"json",comment:'Optional JSON params for queries that need them (e.g. {"channelId": "C01234"})',defaultValue:"{}"}}},adminRemoveModuleFromWorkflow:{apiName:"adminRemoveModuleFromWorkflow",displayName:"Remove Module from Workflow",emoji:"✂",description:(0,d.jsx)(d.Fragment,{children:"Remove an inline module from a workflow. Post-transaction hooks will clean up associated connections if no longer referenced."}),schema:{workflowId:{type:"string",table:s().C0E,placeholder:a(591977).nZ,comment:"The workflow containing the module"},moduleId:{type:"string",placeholder:a(591977).nZ,comment:"The module ID to remove from the workflow"},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"(Optional) Space ID for faster lookup"}}},adminSearchWorkflowModules:{apiName:"adminSearchWorkflowModules",displayName:"Search Workflow Modules",emoji:"🔎",description:(0,d.jsx)(d.Fragment,{children:"Search workflow modules by type within a space. Shows connection status for each module."}),schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The space ID to search within",showByDefaultInSingleRecordMode:!1},moduleType:{type:"options",options:a(997377).zP.map(e=>String(e)),comment:"The module type to filter by (e.g. mcpServer, slack)"},keyword:{type:"string",comment:"(Optional) Filter by name or server URL"},limit:{type:"number",defaultValue:50,comment:"Maximum results (default 50, max 200)"}}},adminAddSlackConnectedOrgSpacesToStatsigSegment:{apiName:"adminAddSlackConnectedOrgSpacesToStatsigSegment",displayName:"Sync grid_spaces segment",emoji:"🔄",de
7scription:(0,d.jsxs)(d.Fragment,{children:["Overwrites the Statsig"," ",(0,d.jsx)("a",{href:"https://console.statsig.com/6TSma7coh47E7CjMbuSVCO/segments/segment%3Aproduction_grid_spaces",target:"_blank",rel:"noreferrer",children:"production_grid_spaces"})," ","segment with the space IDs of all organizations with a Slack AI connector."]}),schema:{}}};a(953925),a(540679),a(176765),a(851344),a(866491),a(63224),a(71749);let tm={section:{display:"flex",flexDirection:"column",gap:8,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,padding:16},sectionTitle:{fontSize:16,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:4},fieldLabel:{fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary,minWidth:160,flexShrink:0},secondaryText:{color:a(632079).Tj.text.secondary,fontSize:12},input:{width:"100%",padding:"8px 10px",borderRadius:6,border:`1px solid ${a(632079).Tj.border.primary}`,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,fontSize:13},actionOption:{display:"flex",alignItems:"flex-start",gap:8,padding:12,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:6,cursor:"pointer"},blockedActionOption:{cursor:"not-allowed",opacity:.65},disabledControlTooltipOrigin:{display:"flex",width:"100%"},actionText:{display:"flex",flexDirection:"column",gap:2},actionStatus:{color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium},warningBox:{padding:12,borderRadius:6,backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.primary},successBox:{padding:12,borderRadius:6,backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.primary},errorBox:{padding:12,borderRadius:6,backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.primary}},tu={finalize_existing_transcript:"Finalize the existing transcript",mark_upload_failed:"Allow retry from the original device",retry_existing_audio:"Retry transcription using the existing audio",transcribe_uploaded_audio:"Transcribe replacement audio",reset_to_initial:"Abandon recording and unlock note"},th={finalize_existing_transcript:"Use when transcript text already exists and only the persisted block state is stale.",mark_upload_failed:"Mark the stuck upload as failed without deleting its recording metadata, so retry remains available on the device that recorded it.",retry_existing_audio:"Run production transcription using verified audio already stored for this AI Meeting Note.",transcribe_uploaded_audio:"Upload an audio file to temporary storage and run production transcription with it.",reset_to_initial:"Reset to initial and clear abandoned recording metadata. Existing transcript, notes, and summary content are preserved."},ty=["auto","ar","da","de","en","es","fi","fr","he","id","it","ja","ko","nl","no","pl","pt","ru","sv","th","vi","zh-CN","zh-TW"];function tg(e){var t,i,n,s,o;let{data:l,environment:c}=e,p=l.diagnosis.actions.filter(tx),m=p.length!==l.diagnosis.actions.length,u=p.some(e=>e.eligible),h=null==(t=p.find(e=>e.eligible))?void 0:t.action,y=(null==(i=p.find(e=>e.eligible&&e.action===l.diagnosis.recommendedAction))?void 0:i.action)??h,g=(null==(n=l.currentState)?void 0:n.transcriberId)??(null==(s=l.stateHistory.findLast(e=>void 0!==e.transcriberId))?void 0:s.transcriberId)??"",[x,f]=(0,r.useState)(y),[b,v]=(0,r.useState)(g),[j,k]=(0,r.useState)("en"),[S,w]=(0,r.useState)(""),[I,C]=(0,r.useState)(!1),[D,T]=(0,r.useState)(),[R,A]=(0,r.useState)(),[N,M]=(0,r.useState)(),[P,V]=(0,r.useState)(!1),[E,B]=(0,r.useState)(),[L,_]=(0,r.useState)(!1),[U,W]=(0,r.useState)(),[F,K]=(0,r.useState)(),[$,O]=(0,r.useState)(),z=(0,r.useRef)(!1),G="retry_existing_audio"===x||"transcribe_uploaded_audio"===x,q="transcribe_uploaded_audio"===x,H=p.find(e=>e.action===x),Z=(o={selectedAction:x,selectedActionEligible:(null==H?void 0:H.eligible)===!0,runAsUserId:b,replacementAudioFile:D,isUploading:P}).isUploading?"Wait for the audio upload to finish.":void 0===o.selectedAction?"Select an available recovery action.":o.selectedActionEligible?("retry_existing_audio"===o.selectedAction||"transcribe_uploaded_audio"===o.selectedAction)&&0===o.runAsUserId.trim().length?"Enter the user ID that will run transcription.":"transcribe_uploaded_audio"===o.selectedAction&&void 0===o.replacementAudioFile?"Select the audio file to transcribe.":void 0:"Choose an available recovery action.",J=void 0===Z,Q=Z?`Next: ${Z}`:void 0,Y=F?"Recovery is already submitted. Rerun the inspector to see the latest state.":L?"Wait for this recovery request to finish.":void 0,X=(0,r.useCallback)(()=>{B(void 0),W(void 0),K(void 0),O(void 0)},[]),ee=(0,r.useCallback)(e=>{v(e),X()},[X]),et=(0,r.useCallback)(e=>{k(e),X()},[X]),ea=(0,r.useCallback)(e=>{C(e),X()},[X]),ei=(0,r.useCallback)(e=>{T(e),A(void 0),M(void 0),X()},[X]),en=(0,r.useCallback)(async()=>
7{if(J&&void 0!==x){if(W(void 0),K(void 0),O(void 0),"transcribe_uploaded_audio"!==x||void 0!==R)return void B((0,a(83388).lZ)());if(void 0!==D){V(!0),M(0);try{let e=await (0,a(310196).uploadRecordedAudioToTemporary)({environment:c,spaceId:l.spaceId,file:D,onProgress:M});A(e),B((0,a(83388).lZ)())}catch(e){W(e instanceof Error?e.message:"Audio upload failed")}finally{V(!1)}}}},[J,l.spaceId,c,D,x,R]),er=(0,r.useCallback)(async()=>{if(!z.current&&void 0!==x&&void 0!==E&&("transcribe_uploaded_audio"!==x||void 0!==R)){z.current=!0,_(!0),W(void 0);try{let e=function(e){let t={blockId:e.data.blockId,operationId:e.operationId,...e.reason.trim().length>0?{reason:e.reason.trim()}:{}};switch(e.selectedAction){case"finalize_existing_transcript":case"mark_upload_failed":case"reset_to_initial":return{...t,action:e.selectedAction};case"retry_existing_audio":return{...t,action:e.selectedAction,runAsUserId:e.runAsUserId,language:e.language,keepExistingTranscription:e.keepExistingTranscription};case"transcribe_uploaded_audio":if(void 0===e.uploadedAudio)throw Error("Replacement audio must be uploaded before recovery");return{...t,action:e.selectedAction,runAsUserId:e.runAsUserId,language:e.language,keepExistingTranscription:e.keepExistingTranscription,uploadedAudioUrl:e.uploadedAudio.fileUrl}}}({data:l,selectedAction:x,operationId:E,reason:S,runAsUserId:b,language:j,keepExistingTranscription:I,uploadedAudio:R}),t=await c.api.callApi({eventName:"adminRecoverTranscriptionBlock",environment:c,data:e});if("success"!==t.type)throw Error((0,a(201790).V4)(t));K(t.data);let i=await c.api.callApi({eventName:"adminDebugTranscriptionBlock",environment:c,data:{blockId:l.blockId}});"success"===i.type&&O(i.data.diagnosis)}catch(e){W(e instanceof Error?e.message:"Unknown error")}finally{z.current=!1,_(!1)}}},[l,c,I,j,E,S,b,x,R]);return(0,d.jsxs)("div",{style:tm.section,children:[(0,d.jsx)("div",{style:tm.sectionTitle,children:"Recovery workbench"}),(0,d.jsx)("span",{style:tm.secondaryText,children:"Recovery uses the production transcription pipeline when needed. At submission, the server rechecks the block state, action eligibility, and run-as user when applicable."}),m?(0,d.jsx)("div",{style:tm.warningBox,role:"alert",children:"Some recovery actions were omitted because this admin client does not recognize them. Refresh the page before continuing."}):void 0,(0,d.jsx)(a(4458).VP,{gap:8,children:p.map(e=>(0,d.jsx)(tf,{action:e,diagnosisCode:l.diagnosis.code,nextAvailableAction:h,selected:x===e.action,onSelect:e=>{f(e),X()}},e.action))}),u?(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)("label",{children:[(0,d.jsx)("span",{style:tm.fieldLabel,children:"Recovery reason (optional)"}),(0,d.jsx)("textarea",{style:tm.input,value:S,maxLength:2e3,onChange:e=>{w(e.target.value),X()},placeholder:"Add context for the recovery log"}),(0,d.jsx)("div",{style:tm.secondaryText,children:"Optional context saved in the admin log"})]}),G?(0,d.jsx)(tj,{runAsUserId:b,language:j,keepExistingTranscription:I,onRunAsUserIdChange:ee,onLanguageChange:et,onKeepExistingTranscriptionChange:ea}):void 0,q?(0,d.jsx)(tv,{file:D,uploadProgress:N,isUploading:P,onFileChange:ei}):void 0,void 0===E?(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(tb,{message:Q,children:(0,d.jsx)(a(912946).j,{size:"sm",width:"fill",onClick:en,disabled:!J,children:P?"Uploading audio…":q&&void 0===R?"Upload audio and review":"Review recovery"})}),Q?(0,d.jsx)("span",{style:tm.secondaryText,children:Q}):void 0]}):(0,d.jsx)("div",{style:tm.warningBox,children:(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)("span",{children:`This will run ${x?tu[x]:""} using the latest eligible state of this block.`}),S.trim().length>0?(0,d.jsxs)("span",{children:["Reason: ",S.trim()]}):void 0,G?(0,d.jsxs)("span",{children:["Run as ",b,"; language ",j,"."]}):void 0,q&&D?(0,d.jsxs)("span",{children:["Replacement audio: ",D.name,"."]}):void 0,G?(0,d.jsxs)("span",{children:["Preserve existing transcript: ",I?"yes":"no","."]}):void 0,(0,d.jsx)(tb,{message:Y,children:(0,d.jsx)(a(912946).j,{size:"sm",width:"fill",onClick:er,disabled:L||void 0!==F,children:F?"Recovery submitted":L?"Starting recovery…":"Rescue block"})})]})}),U?(0,d.jsx)("div",{style:tm.errorBox,role:"alert",children:U}):void 0,F?(0,d.jsxs)("div",{style:tm.successBox,role:"status","aria-live":"polite",children:["Recovery ",F.status,". Operation ",F.operationId,F.queueTaskId?`; task ${F.queueTaskId}`:"",".",$?` Fresh diagnosis: ${$.code}.`:""]}):void 0]}):(0,d.jsx)("span",{style:tm.secondaryText,children:"No safe recovery action is available. Re-run the inspector after the active task finishes or investigate the logs."})]})}function tx(e){return Object.hasOwn(tu,e.action)&&Object.hasOwn(th,e.action)}function tf(e){var t;let i=e.action.eligible?void 0:e.action.blockers.join(" "),n=i?`${i} ${"retry_existing_audio"===(t={action:e.action.action,diagnosisCode:e.diagnosisCode,nextAvailableAction:e.nextAvailableAction}).action&&"transcribe_uploaded_audio"===t.nextAvailableAction?"Next: Choose “Transcribe replacement audio” and select the file to use.":"healthy"===t.diagnosisCode?"No action is needed.":"in_progress"===t.diagnosisCode?"Next: Wait for the active task to finish, then rerun the inspector.":"summary_failed"===t.diagnosisCode||"summary_stuck"===t.diagnosisCode?"Next: Investigate the summary task logs;
7 transcription recovery cannot fix this state.":"unknown"===t.diagnosisCode?"Next: Investigate the logs, then rerun the inspector after the block state changes.":void 0!==t.nextAvailableAction?`Next: Choose “${tu[t.nextAvailableAction]}”.`:"Next: Restore the AI Meeting Notes block, then rerun the inspector."}`:void 0,r=t=>(0,d.jsxs)("label",{...t,"aria-label":n?`${tu[e.action.action]}. Unavailable: ${n}`:void 0,tabIndex:e.action.eligible?void 0:0,style:{...tm.actionOption,...e.action.eligible?{}:tm.blockedActionOption},children:[(0,d.jsx)("input",{type:"radio",name:"meeting-note-recovery-action",checked:e.selected,disabled:!e.action.eligible,onChange:()=>e.onSelect(e.action.action)}),(0,d.jsxs)("span",{style:tm.actionText,children:[(0,d.jsx)("span",{children:tu[e.action.action]}),(0,d.jsx)("span",{style:tm.secondaryText,children:th[e.action.action]}),(0,d.jsx)("span",{style:tm.actionStatus,children:e.action.eligible?"Available for this block":"Unavailable — hover or focus for details"})]})]});return e.action.eligible?r():(0,d.jsx)(a(51831).m_,{allowHover:!0,textWrap:!0,content:()=>(0,d.jsx)("div",{children:n}),children:e=>r(e)})}function tb(e){return void 0===e.message?(0,d.jsx)("span",{style:tm.disabledControlTooltipOrigin,children:e.children}):(0,d.jsx)(a(51831).m_,{allowHover:!0,textWrap:!0,content:()=>(0,d.jsx)("div",{children:e.message}),children:t=>(0,d.jsx)("span",{...t,"aria-label":e.message,tabIndex:0,style:tm.disabledControlTooltipOrigin,children:e.children})})}function tv(e){let t=e.isUploading?"Wait for the current upload to finish before selecting another file.":void 0;return(0,d.jsxs)("label",{children:[(0,d.jsx)("span",{style:tm.fieldLabel,children:"Replacement audio"}),(0,d.jsx)(tb,{message:t,children:(0,d.jsx)("input",{type:"file",accept:"audio/*,.m4a,.aac,.mp3,.wav,.caf,.ogg,.mp4",disabled:e.isUploading,onChange:t=>{var a;return e.onFileChange(null==(a=t.currentTarget.files)?void 0:a[0])}})}),(0,d.jsx)("div",{style:tm.secondaryText,children:"Required for this action. The file is uploaded to temporary transcription storage and must be 1 GB or smaller."}),e.file?(0,d.jsx)("div",{style:tm.secondaryText,children:e.isUploading&&void 0!==e.uploadProgress?`${e.file.name}: ${Math.round(e.uploadProgress)}% uploaded`:e.file.name}):void 0]})}function tj(e){return(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsxs)("label",{children:[(0,d.jsx)("span",{style:tm.fieldLabel,children:"Run transcription as user"}),(0,d.jsx)("input",{style:tm.input,value:e.runAsUserId,onChange:t=>e.onRunAsUserIdChange(t.target.value)}),(0,d.jsx)("div",{style:tm.secondaryText,children:"Required to run production transcription. The user must be active, eligible for AI Meeting Notes, and able to edit this block."})]}),(0,d.jsxs)("label",{children:[(0,d.jsx)("span",{style:tm.fieldLabel,children:"Language"}),(0,d.jsx)("select",{style:tm.input,value:e.language,onChange:t=>e.onLanguageChange(ty.find(e=>e===t.target.value)??"en"),children:ty.map(e=>(0,d.jsx)("option",{value:e,children:e},e))}),(0,d.jsx)("div",{style:tm.secondaryText,children:"Language is required by transcription. Choose auto if the recording language is unknown."})]}),(0,d.jsxs)("label",{children:[(0,d.jsx)("input",{type:"checkbox",checked:e.keepExistingTranscription,onChange:t=>e.onKeepExistingTranscriptionChange(t.target.checked)})," ","Keep existing transcript content",(0,d.jsx)("div",{style:tm.secondaryText,children:"Turn on to append recovered text to the existing transcript. Leave off to replace it."})]})]})}let tk={section:{display:"flex",flexDirection:"column",gap:8,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,padding:16},sectionTitle:{fontSize:16,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:4},fieldRow:{display:"flex",gap:8,fontSize:13,lineHeight:"1.5"},fieldLabel:{fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary,minWidth:160,flexShrink:0},fieldValue:{color:a(632079).Tj.text.primary,fontFamily:"monospace",fontSize:12,wordBreak:"break-all"},secondaryText:{color:a(632079).Tj.text.secondary,fontSize:12},badge:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.medium},badgeGreen:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.primary},badgeGray:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.tertiary},badgeBlue:{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.primary},statusDot:{display:"inline-block",width:8,height:8,borderRadius:"50%",flexShrink:0,marginTop:4},statusDotGreen:{backgroundColor:a(632079).Tj.green.text.primary},statusDotRed:{backgroundColor:a(632079).Tj.red.text.primary},fileUrl:{fontFamily:"monospace",fontSize:12,color:a(632079).Tj.text.primary,wordBreak:"break-all",flex:1},expiryNote:{fontSize:11,color:a(632079).Tj.text.tertiary},deletedLabel:{color:a(632079).Tj.red.text.primary,fontSize:12,fontWeight:a(699422).Wy.medium},helperText:{fontSize:11,color:a(632079).Tj.text.tertiary},fileDetails:{display:"flex",flexDirection:"column",gap:4,flex:1},timelineItem:{display:"flex",gap:12,alignItems:"center",fontSize:13},timestamp:{fontFamily:"monospace",fontSize:12,color:a(632079).Tj.text.secondary,flexShrink:0},issueRow:{display:"flex",gap:8,alignItems:"flex-start",fontSize:13,lineHeight:"1.5"},issueIcon:{flexShrink:0,fontSize:14},issueText:{color:a(632079).Tj.text.primary},issueHint:{color:a(632079).Tj.text.tertiary,fontSize:12},promptBox:{fontFamily:"monospace",fontSize:12,lineHeight:"1.5",padding:12,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:400,overflow:"auto",border:`1px solid ${a(632079).Tj.border.secondary}`},rawJsonBlock:{fontFamily:"monospace",fontSize:12,lineHeight:"1.5",margin:0,padding:12,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary,whiteSpace:"pre",maxHeight:600,overflow:"auto",border:`1px solid ${a(632079).Tj.border.secondary}`},copiedBadge:{fontSize:12,color:a(632079).Tj.green.text.primary,fontWeight:a(699422).Wy.medium}},tS=new Set(["summarizing","transcribing"]),tw=new Set(["recorded_audio_file_uploading","recorded_audio_transcribing"]);function tI(e){let t=new Date(e),a=t.getFullYear(),i=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),r=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),o=String(t.getSeconds()).padStart(2,"0");return`${a}-${i}-${n} ${r}:${s}:${o}`}function tC(){return"production"}function tD(){return"application"}function tT(e,t){let a=tC(),i=encodeURIComponent(JSON.stringify({time_range:604800,granularity:0,calculations:[{op:"COUNT"}],filters:[{column:"root_block_id",op:"=",value:e}],filter_combination:"AND",orders:[{op:"COUNT",order:"descending"}],limit:1e3}));return`https://ui.honeycomb.io/notion/environments/${a}/datasets/${t}?query=${i}&tab=traces`}function tR(e){let t=new URLSearchParams({q:e,earliest:"-7d@d",latest:"now","display.page.search.mode":"smart","dispatch.sample_ratio":"1"});return`https://notion.splunkcloud.com/en-US/app/search/search?${t.toString()}`}function tA(e){let{data:t,environment:i,canDownloadAudio:n,onAudioInspectionComplete:s}=e,[o,l]=(0,r.useState)(!1),[c,p]=(0,r.useState)(),{audioFiles:m}=t,u=(0,r.useCallback)(async()=>
7{l(!0),p(void 0);try{let e=await i.api.callApi({eventName:"adminDebugTranscriptionBlock",environment:i,data:{blockId:t.blockId,inspectAudio:!0}});if("success"!==e.type)throw Error((0,a(201790).V4)(e));s(e.data)}catch(e){p(e instanceof Error?e.message:"Audio inspection failed")}finally{l(!1)}},[t.blockId,i,s]);return(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Audio Files"}),(0,d.jsx)("span",{style:tk.helperText,children:n?"Audio inspection and download reveal user audio data. Use them only when needed for the investigation.":"Check whether recorded audio is still available without creating a download link."}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:u,disabled:o,children:o?"Inspecting audio…":n?"Inspect audio":"Check audio availability"}),c?(0,d.jsx)("span",{style:tk.deletedLabel,role:"alert",children:c}):void 0,void 0===m?(0,d.jsx)("span",{style:tk.secondaryText,children:"Audio has not been inspected."}):0===m.length?(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)("span",{style:tk.secondaryText,children:"No audio files recorded for this block"}),(0,d.jsx)("span",{style:tk.helperText,children:"This means transcription was live (not pre-recorded)"})]}):(0,d.jsx)(a(4458).VP,{gap:12,children:m.map((e,t)=>(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",children:[(0,d.jsx)("div",{style:{...tk.statusDot,...e.exists?tk.statusDotGreen:tk.statusDotRed}}),(0,d.jsxs)("div",{style:tk.fileDetails,children:[(0,d.jsx)("span",{style:tk.fileUrl,children:n&&e.fileUrl?e.fileUrl:`Audio file ${t+1}`}),e.exists?(0,d.jsx)("span",{style:tk.secondaryText,children:"Available in S3"}):void 0,n&&e.exists&&e.signedUrl?(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:()=>window.open(e.signedUrl,"_blank","noopener,noreferrer"),children:"Download Audio"}),(0,d.jsx)("span",{style:tk.expiryNote,children:"Link expires in 1 hour"})]}):void 0,e.exists?void 0:(0,d.jsx)("span",{style:tk.deletedLabel,children:"Deleted from S3"}),n&&e.error?(0,d.jsx)("span",{style:tk.deletedLabel,children:e.error}):void 0]})]},t))})]})}function tN(e){let{blockValueDebug:t,isExpanded:i,onToggle:n}=e,[s,o]=(0,r.useState)(!1),l=(0,r.useRef)(),c=(0,r.useMemo)(()=>JSON.stringify(t,void 0,2),[t]);(0,r.useEffect)(()=>()=>{void 0!==l.current&&clearTimeout(l.current)},[]);let p=(0,r.useCallback)(()=>{navigator.clipboard.writeText(c).then(()=>{o(!0),void 0!==l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{o(!1)},2e3)}).catch(e=>{(0,a(208318).t)().log({level:"warning",from:"AdminDebugTranscriptionBlockResponse",type:"copyMeetingNotesBlockValueDebugFailed",error:(0,a(952977).convertErrorToLog)(e)})})},[c]);return(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Stored Block Value"}),(0,d.jsx)(a(265779).E,{size:"sm",onClick:n,children:i?"Hide":"Show"}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:p,children:"Copy"}),s?(0,d.jsx)("span",{style:tk.copiedBadge,children:"Copied!"}):void 0]}),(0,d.jsx)("span",{style:tk.helperText,children:"Shows persisted transcription block value data used for meeting notes lifecycle debugging."}),i?(0,d.jsx)("pre",{style:tk.rawJsonBlock,children:c}):void 0]})}function tM(e){let{blockId:t}=e,i=tD(),n=(0,r.useCallback)(()=>{window.open(tT(t,"audioprocessor"),"_blank")},[t]),s=(0,r.useCallback)(()=>{window.open(tT(t,"hive"),"_blank")},[t]),o=(0,r.useCallback)(()=>{let e=`search index="${i}" "${t}" (from=audioprocessor OR from=transcription OR from=recorded_audio)`;window.open(tR(e),"_blank")},[t,i]),l=(0,r.useCallback)(()=>{let e=`search index="${i}" "${t}" (from=summarization OR from=ai_inference OR from=transcription_summary)`;window.open(tR(e),"_blank")},[t,i]),c=(0,r.useCallback)(()=>{let e=`search index="${i}" "${t}"`;window.open(tR(e),"_blank")},[t,i]);return(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Observability"}),(0,d.jsxs)("span",{style:tk.helperText,children:["Environment: ","production"," (","production"," Honeycomb,"," ",i," Splunk index)"]}),(0,d.jsxs)(a(4458).fI,{gap:16,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:n,children:"Honeycomb: audioprocessor"}),(0,d.jsx)("span",{style:tk.helperText,children:"Audio processing pipeline"})]}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:s,children:"Honeycomb: hive"}),(0,d.jsx)("span",{style:tk.helperText,children:"API and backend events"})]})]}),(0,d.jsxs)(a(4458).fI,{gap:16,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:o,children:"Splunk: Audio Processing"}),(0,d.jsx)("span",{style:tk.helperText,children:"Audio upload and transcription logs"})]}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:l,children:"Splunk: Summarization"}),(0,d.jsx)("span",{style:tk.helperText,children:"AI summarization and inference logs"})]}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:c,children:"Splunk: All Logs"}),(0,d.jsx)("span",{style:tk.helperText,children:"All logs for this block"})]})]})]})}function tP(e){let{issues:t}=e;return(0,d.jsxs)("div",{style:{...tk.section,borderColor:t.some(e=>"error"===e.severity)?a(632079).Tj.red.border.primary:a(632079).Tj.yellow.border.primary},children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Detected Issues"}),(0,d.jsx)(a(4458).VP,{gap:8,children:t.map((e,t)=>(0,d.jsxs)("div",{style:tk.issueRow,children:[(0,d.jsx)("span",{style:tk.issueIcon,children:"error"===e.severity?"❌":"⚠️"}),(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)("span",{style:tk.issueText,children:e.message}),(0,d.jsx)("span",{style:tk.issueHint,children:e.hint})]})]},t))})]})}function tV(e){let{data:t}=e,[i,n]=(0,r.useState)(!1),[s,o]=(0,r.useState)(!1),l=(0,r.useMemo)(()=>{var e;let a,i,n,r,s,o,l,d;return a=tC(),i=tD(),n=t.stateHistory.at(-1),s=(r=t.stateHistory.length>0?t.stateHistory[0]:void 0)&&n?`${tI(r.timestamp)} to ${tI(n.timestamp)}`:"unknown",o=t.stateHistory.map(e=>`${e.state} (${e.from})`).join(" -> "),d=(l=t.audioFiles??[]).map((e,t)=>{let a=e.fileUrl??`audio file ${t+1}`,i=void 0!==e.fileUrl&&void 0!==e.error?` (error: ${e.error})`:"";return`  - ${a}: ${e.exists?"exists":"MISSING"}${i}`}).join("\n"),`# Transcription Block Debug Investigation
8
9## Block Details
10- **Block ID**: ${t.blockId}
11- **Space ID**: ${t.spaceId}
12- **Transcription Model**: ${t.transcriptionModel} (${t.transcriptionModelCode})
13- **Current State**: ${(null==(e=t.currentState)?void 0:e.state)??(null==n?void 0:n.state)??"unknown"} (as of ${n?tI(n.timestamp):"unknown"})
14- **Diagnosis**: ${t.diagnosis.code} — ${t.diagnosis.summary}
15- **Recommended Recovery**: ${t.diagnosis.recommendedAction??"none"}
16- **State Flow**: ${o||"no history"}
17- **Time Range**: ${s}
18- **Environment**: production
19
20## Audio Files
21	${d||"Audio was not inspected. Use the audio inspection action if it is needed."}
22
23## Investigation Instructions
24
25Use Honeycomb and Splunk MCP tools to find what went wrong with this transcription block.
26
27### Step 1: Check Honeycomb for span-level errors
28Query the \`audioprocessor\` dataset in the \`${a}\` environment:
29- Filter: \`root_block_id = "${t.blockId}"\`
30- Time range: last 7 days
31- Look for: error spans, high duration spans, missing expected spans
32- Key columns: \`name\`, \`error\`, \`duration_ms\`, \`status_code\`, \`transcription.state\`
33
34Also query the \`hive\` dataset for backend API events:
35- Filter: \`root_block_id = "${t.blockId}"\`
36- Look for: failed API calls, transaction errors, timeout events
37
38### Step 2: Check Splunk for detailed logs
39Search in the \`${i}\` index:
40- Audio processing: \`index="${i}" "${t.blockId}" (from=audioprocessor OR from=transcription OR from=recorded_audio)\`
41- Summarization: \`index="${i}" "${t.blockId}" (from=summarization OR from=ai_inference OR from=transcription_summary)\`
42- All logs: \`index="${i}" "${t.blockId}"\`
43
44### Step 3: Identify root cause
45Based on the state flow (${o||"empty"}), focus on:
46- The authoritative diagnosis is \`${t.diagnosis.code}\`. Validate its evidence against logs before recovery.
47	${l.some(e=>!e.exists)?"- Audio files are MISSING from S3. Check if upload completed or if retention cleanup ran early.":""}
48- Look at timestamps between state transitions for unusual gaps
49- Check if the transcription model (${t.transcriptionModelCode}) had any known issues during this time period
50`},[t]),c=(0,r.useCallback)(()=>{n(e=>!e)},[]),p=(0,r.useCallback)(()=>{navigator.clipboard.writeText(l).then(()=>{o(!0),setTimeout(()=>o(!1),2e3)})},[l]);return(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Investigation Handoff"}),(0,d.jsx)("span",{style:tk.helperText,children:"Generate a prompt you can paste into Claude Code (with Honeycomb and Splunk MCPs) to investigate this block."}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(a(265779).E,{size:"sm",onClick:c,children:i?"Hide Prompt":"Create LLM Prompt"}),i?(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:p,children:"Copy to Clipboard"}),s?(0,d.jsx)("span",{style:tk.copiedBadge,children:"Copied!"}):void 0]}):void 0]}),i?(0,d.jsx)("div",{style:tk.promptBox,children:l}):void 0]})}let tE={summaryBox:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,display:"flex",flexDirection:"column",gap:8},statRow:{display:"flex",justifyContent:"space-between",alignItems:"center"},statValue:{fontWeight:a(699422).Wy.semibold,fontSize:18},warningBanner:{padding:12,backgroundColor:a(632079).Tj.yellow.background.primary,borderRadius:6,color:a(632079).Tj.yellow.text.primary},successBox:{padding:12,backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},errorBox:{padding:12,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},correlationId:{fontFamily:"monospace",fontSize:12,padding:"4px 8px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,userSelect:"all",WebkitUserSelect:"all"},splunkQuery:{fontFamily:"monospace",fontSize:12,padding:"4px 8px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,userSelect:"all",WebkitUserSelect:"all",flex:1},spaceResult:{padding:8,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary,fontFamily:"monospace",fontSize:12},infoBox:{padding:12,backgroundColor:a(632079).Tj.blue.background.primary,borderRadius:6,color:a(632079).Tj.blue.text.primary}};function tB(e){let{data:t}=e,i=t.results.filter(e=>"enqueued"===e.status),[n,s]=(0,r.useState)(!1),o=t.correlationId?`index="application" from=historicalFillLensTopicFacetsForSpaceTask correlation_id=${t.correlationId} earliest=-24h`:void 0,l=(0,r.useCallback)(()=>{o&&navigator.clipboard.writeText(o).then(()=>{s(!0),setTimeout(()=>s(!1),2e3)})}
50,[o]);return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:tE.successBox,children:(0,d.jsxs)(a(111010).D,{styleKey:"bodyMedium",children:["Historical fill tasks enqueued (",i.length,")"]})}),i.map(e=>(0,d.jsxs)("div",{style:tE.summaryBox,children:[(0,d.jsx)("div",{style:tE.spaceResult,children:e.spaceId}),(0,d.jsxs)("div",{style:tE.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Transcription blocks"}),(0,d.jsx)("span",{style:tE.statValue,children:e.transcriptionBlockCount??0})]}),(0,d.jsxs)("div",{style:tE.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Existing facets"}),(0,d.jsx)("span",{style:tE.statValue,children:e.existingFacetCount??0})]})]},e.spaceId)),t.correlationId&&o?(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Correlation ID:"}),(0,d.jsx)("div",{style:tE.correlationId,children:t.correlationId}),(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Splunk query:"}),(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)("div",{style:tE.splunkQuery,children:o}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:l,children:n?"Copied!":"Copy"})]})]}):void 0]})}let tL={summaryBox:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,display:"flex",flexDirection:"column",gap:8},statRow:{display:"flex",justifyContent:"space-between",alignItems:"center"},statValue:{fontWeight:a(699422).Wy.semibold,fontSize:18},dangerBanner:{padding:12,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},warningBanner:{padding:12,backgroundColor:a(632079).Tj.yellow.background.primary,borderRadius:6,color:a(632079).Tj.yellow.text.primary},successBox:{padding:12,backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},errorBox:{padding:12,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},spaceResult:{padding:8,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary,fontFamily:"monospace",fontSize:12}};function t_(e){let{data:t}=e,i=t.results.filter(e=>"deleted"===e.status),n=t.results.filter(e=>"error"===e.status);return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:tL.successBox,children:(0,d.jsxs)(a(111010).D,{styleKey:"bodyMedium",children:["Nuke complete — ",i.length," space(s) cleared"]})}),i.map(e=>(0,d.jsxs)("div",{style:tL.summaryBox,children:[(0,d.jsx)("div",{style:tL.spaceResult,children:e.spaceId}),(0,d.jsxs)("div",{style:tL.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Facets deleted"}),(0,d.jsx)("span",{style:tL.statValue,children:e.deletedFacets??0})]}),(0,d.jsxs)("div",{style:tL.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Clusters deleted"}),(0,d.jsx)("span",{style:tL.statValue,children:e.deletedClusters??0})]})]},e.spaceId)),n.length>0?(0,d.jsxs)("div",{style:tL.errorBox,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",children:["Errors (",n.length,"):"]}),n.map(e=>(0,d.jsxs)("div",{style:tL.spaceResult,children:[e.spaceId," — ",e.error]},e.spaceId))]}):void 0]})}let tU={summaryBox:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,display:"flex",flexDirection:"column",gap:8},statValue:{fontWeight:a(699422).Wy.semibold,fontSize:18},skippedSection:{marginTop:8},skippedItem:{display:"flex",justifyContent:"space-between",padding:"4px 0",fontSize:12,fontFamily:"monospace"},verifyCallout:{padding:12,backgroundColor:a(632079).Tj.yellow.background.primary,borderRadius:6,color:a(632079).Tj.yellow.text.primary},successBox:{padding:12,backgroundColor:a(632079).Tj.green.background.primary,borderRadius:6,color:a(632079).Tj.green.text.primary},errorBox:{padding:12,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:6,color:a(632079).Tj.red.text.primary},correlationId:{fontFamily:"monospace",fontSize:12,padding:"4px 8px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,userSelect:"all",WebkitUserSelect:"all"},searchInput:{width:"100%",padding:"6px 8px",fontSize:13,fontFamily:"monospace",borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,outline:"none"},spaceIdList:{maxHeight:300,overflowY:"auto",display:"flex",flexDirection:"column",gap:2},spaceIdItem:{fontFamily:"monospace",fontSize:12,padding:"2px 8px",userSelect:"all",WebkitUserSelect:"all"},spaceIdMatch:{fontFamily:"monospace",fontSize:12,padding:"2px 8px",userSelect:"all",WebkitUserSelect:"all",backgroundColor:a(632079).Tj.green.background.primary,borderRadius:3},matchCount:{fontSize:12,color:a(632079).Tj.text.secondary},splunkQuery:{fontFamily:"monospace",fontSize:12,padding:"4px 8px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,userSelect:"all",WebkitUserSelect:"all",flex:1}};function tW(e){let{data:t}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:tU.successBox,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:"Tasks enqueued successfully"})}),(0,d.jsxs)("div",{style:tU.summaryBox,children:[(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Spaces found"}),(0,d.jsx)("span",{style:tU.statValue,children:t.spacesFound})]}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Tasks enqueued"}),(0,d.jsx)("span",{style:tU.statValue,children:t.tasksEnqueued})]}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Skipped"}),(0,d.jsx)("span",{style:tU.statValue,children:t.spacesSkipped.length})]})]}),t.correlationId?(0,d.jsx)(tF,{correlationId:t.correlationId}):void 0,t.spacesSkipped.length>0?(0,d.jsx)(t$,{spacesSkipped:t.spacesSkipped}):void 0,t.errors.length>0?(0,d.jsx)(tO,{errors:t.errors}):void 0]})}
50function tF(e){let{correlationId:t}=e,[i,n]=(0,r.useState)(!1),s=`index="application" from=automated_transcript_deletion correlation_id=${t} earliest=-12h`,o=(0,r.useCallback)(()=>{navigator.clipboard.writeText(s).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[s]);return(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Splunk Correlation ID (click to select):"}),(0,d.jsx)("div",{style:tU.correlationId,children:t}),(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Splunk query:"}),(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)("div",{style:tU.splunkQuery,children:s}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:o,children:i?"Copied!":"Copy"})]})]})}function tK(e){let{eligibleSpaceIds:t}=e,[i,n]=(0,r.useState)(!1),[s,o]=(0,r.useState)(""),l=s.trim().toLowerCase(),c=l?t.filter(e=>e.toLowerCase().includes(l)):t;return(0,d.jsxs)("div",{style:tU.skippedSection,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:["Eligible space IDs (",t.length,"):"]}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:()=>n(e=>!e),children:i?"Hide eligible space IDs":`Show all ${t.length} eligible space IDs`}),i?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("input",{style:tU.searchInput,type:"text",placeholder:"Filter preview by space ID…",value:s,onChange:e=>o(e.target.value)}),l?(0,d.jsxs)("span",{style:tU.matchCount,children:[c.length," of ",t.length," match"]}):void 0,(0,d.jsxs)("div",{style:tU.spaceIdList,children:[c.map(e=>(0,d.jsx)("div",{style:l?tU.spaceIdMatch:tU.spaceIdItem,children:e},e)),0===c.length?(0,d.jsx)("span",{style:tU.matchCount,children:"No matching space IDs found"}):void 0]})]}):void 0]})}function t$(e){let{spacesSkipped:t}=e,[i,n]=(0,r.useState)(!1),s=new Map;for(let{reason:e}of t)s.set(e,(s.get(e)??0)+1);return(0,d.jsxs)("div",{style:tU.skippedSection,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Skipped spaces breakdown:"}),Array.from(s.entries()).map(([e,t])=>(0,d.jsxs)("div",{style:tU.skippedItem,children:[(0,d.jsx)("span",{children:e}),(0,d.jsx)("span",{children:t})]},e)),(0,d.jsx)(a(548436).A,{size:"sm",onClick:()=>n(e=>!e),children:i?"Hide details":"Show all skipped space IDs"}),i?t.map(({spaceId:e,reason:t})=>(0,d.jsxs)("div",{style:tU.skippedItem,children:[(0,d.jsx)("span",{children:e}),(0,d.jsx)("span",{children:t})]},e)):void 0]})}function tO(e){let{errors:t}=e;return(0,d.jsxs)("div",{style:tU.errorBox,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",children:["Errors (",t.length,"):"]}),t.map(({spaceId:e,error:t})=>(0,d.jsxs)("div",{style:tU.skippedItem,children:[(0,d.jsx)("span",{children:e}),(0,d.jsx)("span",{children:t})]},e))]})}let tz={adminUpdateTranscriptionForSpace:{apiName:"adminUpdateTranscriptionForSpace",displayName:"Enable/Disable Transcription for a Space",description:"Toggle the AI meeting notes (transcription) setting for spaces. Useful when a workspace admin has disabled transcription and needs support to re-enable it.",emoji:"🎙",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to update transcription setting",table:"space"},action:{type:"options",comment:"This setting will be applied to all spaces in the list",options:["enable_transcription","disable_transcription"],defaultValue:"enable_transcription"}},isDestructive:!0},adminResetTranscriptionRateLimit:{apiName:"adminResetTranscriptionRateLimit",displayName:"Reset Transcription Rate Limit",description:"Reset the transcription usage rate limit for a user in a space. Use when a user has hit their daily transcription limit and needs to be unblocked.",emoji:"🔓",schema:{userId:{type:"string",comment:"The user ID whose transcription rate limit should be reset."},spaceId:{type:"string",comment:"The space ID in which the transcription rate limit should be reset."}}},adminEnqueueTranscriptRetentionScheduler:{apiName:"adminEnqueueTranscriptRetentionScheduler",displayName:"Re-run Transcript Deletion Scheduler",description:(0,d.jsxs)(d.Fragment,{children:["Manually re-run the daily Automated Transcript Deletion scheduler. This enqueues the same queue task the cron runs: it scans DynamoDB for all workspaces with pending transcript purges and fans out one deletion task per workspace. This action is not scoped to a selected workspace.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"When to use:"}
50),' the "Transcript Deletion Scheduler Completion Freshness" alert fired because the daily run did not finish (e.g. the queue task was evicted mid-scan during a deploy). Run this to complete today\'s scan instead of waiting ~24h for the next cron.',(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Execution:"})," Runs on the prod queue workers (not inline), and per-space deletion tasks dedupe — a space with nothing pending is logged as ",(0,d.jsx)("code",{children:"skipped"}),", so re-running is idempotent.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Validate:"})," after running, confirm a"," ",(0,d.jsx)("code",{children:"transcript_deletion.scheduler.outcome"})," span with"," ",(0,d.jsx)("code",{children:"status=success"})," in Honeycomb (or"," ",(0,d.jsx)("code",{children:'task_status="completed"'})," in Splunk). That also resolves the trigger."]}),emoji:"▶️",isDestructive:!1,schema:{}},adminRemarkTranscriptsAsDeletable:{apiName:"adminRemarkTranscriptsAsDeletable",displayName:"Re-mark All Transcripts as Deletable",description:(0,d.jsxs)(d.Fragment,{children:["For all workspaces with transcript retention enabled, re-enqueue the shared scanner to mark legacy transcription blocks and full-page meeting notes (FPMN) in bounded batches.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Two-step flow:"})," Clicking Submit performs a dry run that shows which spaces would be affected without writing markers or enqueuing tasks. Verify the count against your Hex dashboard, then confirm to re-check and enqueue all eligible workspaces. Searching the preview does not limit execution.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"What this does:"})," Marks transcripts for deletion. Transcripts already past retention can become eligible for downstream deletion as soon as they are marked. Downstream deletion still checks premium eligibility, the ATD feature flag, retention settings, and legal holds. Tasks are staggered by 15 seconds per workspace."]}),emoji:"🔄",isDestructive:!1,customResponseRenderer:function(e){let{data:t,environment:i}=e,[n,s]=(0,r.useState)(!1),[o,l]=(0,r.useState)(void 0),[c,p]=(0,r.useState)(void 0),m=(0,r.useCallback)(async()=>{s(!0),p(void 0);try{let e=await i.api.callApi({eventName:"adminRemarkTranscriptsAsDeletable",environment:i,data:{dryRun:!1}});"success"===e.type?l(e.data):p("API call failed. Check the console for details.")}catch(e){p(e instanceof Error?e.message:"Unknown error")}finally{s(!1)}},[i]);return o?(0,d.jsx)(tW,{data:o}):t.dryRun?(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Preview: Transcript Re-marking"}),(0,d.jsxs)("div",{style:tU.summaryBox,children:[(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Spaces with retention configured"}),(0,d.jsx)("span",{style:tU.statValue,children:t.spacesFound})]}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Eligible for re-marking"}),(0,d.jsx)("span",{style:tU.statValue,children:t.eligibleSpaceIds.length})]}),(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Skipped"}),(0,d.jsx)("span",{style:tU.statValue,children:t.spacesSkipped.length})]}),t.errors.length>0?(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Errors"}),(0,d.jsx)("span",{style:tU.statValue,children:t.errors.length})]}):void 0]}),(0,d.jsx)(tK,{eligibleSpaceIds:t.eligibleSpaceIds}),t.spacesSkipped.length>0?(0,d.jsx)(t$,{spacesSkipped:t.spacesSkipped}):void 0,t.errors.length>0?(0,d.jsx)(tO,{errors:t.errors}):void 0,(0,d.jsx)("div",{style:tU.verifyCallout,children:(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",children:["Verify: Check that the eligible space count (",t.eligibleSpaceIds.length,") matches your Hex dashboard query for spaces with transcript retention enabled. Execute re-checks all workspaces and enqueues every eligible workspace, not just the IDs shown by the search f
50ilter. The count may change since this preview."]})}),c?(0,d.jsx)("div",{style:tU.errorBox,children:c}):void 0,(0,d.jsx)(a(4458).fI,{gap:8,marginTop:8,children:(0,d.jsx)(a(912946).j,{onClick:m,disabled:n,isLoading:n,children:n?"Executing...":"Execute for all eligible workspaces"})})]}):(0,d.jsx)(tW,{data:t})},schema:{}},adminLensClusterFull:{apiName:"adminLensClusterFull",displayName:"LENS Full Clustering",description:(0,d.jsxs)(d.Fragment,{children:["Trigger full clustering of ALL LENS topic facets in a workspace. Re-clusters every facet from scratch using k-means with LLM-supported hierarchy.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Two-step flow:"}),' Submit performs a dry run showing facet counts and eligibility. Review, then uncheck "dryRun" and submit again to enqueue.']}),emoji:"🔬",isDestructive:!1,schema:{spaceIds:{type:"string",comment:"Comma-separated space IDs to run full clustering for",table:"space"},dryRun:{type:"boolean",defaultValue:!0,comment:"When checked, shows preview without enqueuing any tasks"}}},adminLensHistoricalFill:{apiName:"adminLensHistoricalFill",displayName:"LENS Historical Fill",description:(0,d.jsxs)(d.Fragment,{children:["Enqueue LENS topic facet extraction for all existing transcription blocks in a space. Uses the same extract task as the live pipeline.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Two-step flow:"}),' Submit performs a dry run showing block counts and existing facets. Review, then uncheck "dryRun" and submit again to enqueue.',(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Optionally filter by date range to process only a subset of blocks."]}),emoji:"📚",isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;if(!t.dryRun)return(0,d.jsx)(tB,{data:t});let i=t.results.filter(e=>"eligible"===e.status),n=t.results.filter(e=>"skipped"===e.status),r=t.results.filter(e=>"error"===e.status);return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:tE.warningBanner,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:"This will enqueue extraction tasks for all transcription blocks in the specified spaces. Processing may take hours for large workspaces."})}),(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Preview: LENS Historical Fill (Dry Run)"}),i.map(e=>(0,d.jsxs)("div",{style:tE.summaryBox,children:[(0,d.jsx)("div",{style:tE.spaceResult,children:e.spaceId}),(0,d.jsxs)("div",{style:tE.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Transcription blocks"}),(0,d.jsx)("span",{style:tE.statValue,children:e.transcriptionBlockCount??0})]}),(0,d.jsxs)("div",{style:tE.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Existing facets"}),(0,d.jsx)("span",{style:tE.statValue,children:e.existingFacetCount??0})]})]},e.spaceId)),n.length>0?(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:["Skipped (",n.length,"):"]}),n.map(e=>(0,d.jsxs)("div",{style:tE.spaceResult,children:[e.spaceId," — ",e.reason]},e.spaceId))]}):void 0,r.length>0?(0,d.jsxs)("div",{style:tE.errorBox,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",children:["Errors (",r.length,"):"]}),r.map(e=>(0,d.jsxs)("div",{style:tE.spaceResult,children:[e.spaceId," — ",e.reason]},e.spaceId))]}):void 0,i.length>0?(0,d.jsx)("div",{style:tE.infoBox,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:'This is a dry run — no tasks were enqueued. To execute, uncheck the "dryRun" checkbox above and submit again.'})}):void 0]})},schema:{spaceIds:{type:"string",comment:"Comma-separated space IDs to run historical fill for",table:"space"},afterTimestamp:{type:"string",comment:"Only process blocks created after this date (ISO format, e.g. 2026-01-01). Optional."},beforeTimestamp:{type:"string",comment:"Only process blocks created before this date (ISO format, e.g. 2026-03-01). Optional."},dryRun:{type:"boolean",defaultValue:!0,comment:"When checked, shows preview without enqueuing any tasks"}}},adminLensNuke:{apiName:"adminLensNuke",displayName:"LENS Nuke — Delete All Facets & Cluster
50s",description:(0,d.jsxs)(d.Fragment,{children:["Permanently delete all LENS facets and clusters for a space, returning it to day-zero state.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"⚠️ WARNING:"})," This operation is irreversible. All facets and clusters will be permanently deleted from DynamoDB.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),'Submit performs a dry run showing facet counts. Review, then uncheck "dryRun" and submit again to execute.']}),emoji:"💥",isDestructive:!0,customResponseRenderer:function(e){let{data:t}=e;if(!t.dryRun)return(0,d.jsx)(t_,{data:t});let i=t.results.filter(e=>"preview"===e.status),n=t.results.filter(e=>"error"===e.status),r=i.reduce((e,t)=>e+t.facetCount,0);return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:tL.dangerBanner,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:"⚠️ This operation permanently deletes all LENS facets and clusters for the specified spaces. This is irreversible and cannot be undone."})}),(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",children:"Preview: LENS Nuke (Dry Run)"}),i.map(e=>(0,d.jsxs)("div",{style:tL.summaryBox,children:[(0,d.jsx)("div",{style:tL.spaceResult,children:e.spaceId}),(0,d.jsxs)("div",{style:tL.statRow,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Facets that would be deleted"}),(0,d.jsx)("span",{style:tL.statValue,children:e.facetCount})]})]},e.spaceId)),r>0?(0,d.jsx)("div",{style:tL.warningBanner,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:'This is a dry run — nothing was deleted. To execute, uncheck the "dryRun" checkbox above and submit again.'})}):void 0,n.length>0?(0,d.jsxs)("div",{style:tL.errorBox,children:[(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",children:["Errors (",n.length,"):"]}),n.map(e=>(0,d.jsxs)("div",{style:tL.spaceResult,children:[e.spaceId," — ",e.error]},e.spaceId))]}):void 0]})},schema:{spaceIds:{type:"string",comment:"Comma-separated space IDs to nuke all LENS data for",table:"space"},dryRun:{type:"boolean",defaultValue:!0,comment:"When checked, shows facet counts without deleting anything"}}},adminDebugTranscriptionBlock:{apiName:"adminDebugTranscriptionBlock",displayName:"Inspect or Rescue an AI Meeting Note",description:"Diagnose a stuck mobile AI Meeting Note, inspect its audio when needed, and safely recover it with a version-bound confirmation flow.",emoji:"🔍",isDestructive:!1,customResponseRenderer:function(e){var t,i,n;let{data:s,environment:o}=e,l=(0,a(743187).g)(),c=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=l.state;return e},[l]),p=(null==c?void 0:c.has("adminRecoverTranscriptionBlock"))===!0,m=(null==c?void 0:c.has("adminDownloadTranscriptionBlockAudio"))===!0,[u,h]=(0,r.useState)(s);(0,r.useEffect)(()=>{h(s)},[s]);let y=(0,r.useMemo)(()=>(function(e){if("info"===e.diagnosis.severity)return[];let t=e.diagnosis.recommendedAction,a=e.diagnosis.actions.find(e=>e.action===t);return[{severity:e.diagnosis.severity,message:e.diagnosis.summary,hint:void 0===t?`Diagnosis: ${e.diagnosis.code}`:(null==a?void 0:a.eligible)===!0?`Recommended recovery: ${t}`:`Recommended recovery is blocked: ${(null==a?void 0:a.blockers.join(" "))??"unknown reason"}`}]})(u),[u]),[g,x]=(0,r.useState)(!1),f=(0,r.useCallback)(()=>{x(e=>!e)},[]),b=(0,r.useCallback)(e=>{h(t=>t.blockId===e.blockId?e:t)},[]);return(0,d.jsxs)(a(4458).VP,{gap:24,children:[(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Recovery Diagnosis"}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Diagnosis"}),(0,d.jsx)("span",{style:tk.fieldValue,children:u.diagnosis.code})]}),(0,d.jsx)("div",{style:tk.secondaryText,children:u.diagnosis.summary}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Current state"}),(0,d.jsx)("span",{style:tk.fieldValue,children:(null==(t=u.currentState)?void 0:t.state)??"unknown"})]}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Time in state"}),(0,d.jsx)("span",{style:tk.fieldValue,children:function(e){if(void 0===e)return"unknown";let t=Math.floor(e/6e4),a=Math.floor(t/60),i=t%60;return a>0?`${a}h ${i}m`:`${i}m`}(u.diagnosis.stateAgeMs)})]}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Queue task"}),(0,d.jsxs)("span",{style:tk.fieldValue,children:[u.diagnosis.queueTaskStatus??"not available",null!=(i=u.currentState)&&i.queueTaskId?` (${u.currentState.queueTaskId})`:""]})]}),u.diagnosis.recommendedAction?(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Recommended recovery"}),(0,d.jsx)("span",{style:tk.fieldValue,children:u.diagnosis.recommendedAction})]}):void 0]}),p?(0,d.jsx)(tg,{data:u,environment:o},JSON.stringify({blockId:(n=u).blockId,diagnosis:n.diagnosis})):void 0,y.length>0?(0,d.jsx)(tP,{issues:y}):void 0,(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"Block Info"}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Block ID"}),(0,d.jsx)("span",{style:tk.fieldValue,children:(0,d.jsx)(a(137691).x5,{value:u.blockId})})]}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Space ID"}),(0,d.jsx)("span",{style:tk.fieldValue,children:(0,d.jsx)(a(137691).x5,{value:u.spaceId})})]}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Transcription Model"}),(0,d.jsxs)("span",{style:tk.fieldValue,children:[u.transcriptionModel,u.transcriptionModelCode?(0,d.jsxs)("span",{style:tk.secondaryText,children:[" ","(",u.transcriptionModelCode,")"]}):void 0]})]}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Block Type"}),(0,d.jsx)("span",{style:tk.fieldValue,children:u.blockType})]}),(0,d.jsxs)("div",{style:tk.fieldRow,children:[(0,d.jsx)("span",{style:tk.fieldLabel,children:"Block Version"}),(0,d.jsx)("span",{style:tk.fieldValue,children:u.blockVersion})]})]}),(0,d.jsx)(tN,{blockValueDebug:u.meetingNotesBlockValueDebug,isExpanded:g,onToggle:f}),(0,d.jsxs)("div",{style:tk.section,children:[(0,d.jsx)("div",{style:tk.sectionTitle,children:"State History"}),u.stateHistory.length>0?(0,d.jsx)(a(4458).VP,{gap:6,children:u.stateHistory.map((e,t)=>{var a;return(0,d.jsxs)("div",{style:tk.timelineItem,children:[(0,d.jsx)("span",{style:tk.timestamp,children:tI(e.timestamp)}),(0,d.jsx)("span",{style:(a=e.state,tS.has(a)?{...tk.badge,...tk.badgeGreen}:tw.has(a)?{...tk.badge,...tk.badgeBlue}:{...tk.badge,...tk.badgeGray}),children:e.state}),(0,d.jsxs)("span",{style:tk.secondaryText,children:["from: ",e.from]})]},t)})}):(0,d.jsx)("span",{style:tk.secondaryText,children:"No state history recorded"})]}),(0,d.jsx)(tA,{data:u,environment:o,canDownloadAudio:m,onAudioInspectionComplete:b},u.blockId),(0,d.jsx)(tM,{blockId:u.blockId}),(0,d.jsx)(tV,{data:u})]})},schema:{blockId:{type:"string",comment:"The transcription block ID to debug",table:"block"}}},adminGetGranolaImportTask:{apiName:"adminGetGranolaImportTask",displayName:"Inspect a Granola Import",description:(0,d.jsxs)(d.Fragment,{children:["Show a Granola import task's raw stored output, including the per-note failure and omission codes behind the user-facing counts. Find the task ID in Splunk under"," ",(0,d.jsx)("code",{children:"GranolaImportCompletedWithIssues"}),", or in Honeycomb under"," ",(0,d.jsx)("code",{children:"granola_import.task_id"}),". Outputs expire 7 days after the task last wrote them."]}),emoji:"🥣",isDestructive:!1,schema:{spaceId:{type:"string",comment:"The workspace the import ran in",table:"space"},userId:{type:"string",comment:"The user who started the import",table:s().oo9},taskId:{type:"string",comment:"The Granola import task ID (granola-import:...)"}}}},tG={adminBanUser:{apiName:"adminBanUser",generatedRequestIdKey:"requestId",displayName:"Ban or unban user",emoji:"🚷",description:(0,d.jsx)(d.Fragment,{children:"Ban users from using Notion. Users will be logged out and lose all access to Notion. Unbanning will allow them to login again."}),schema:{userEmail:{type:"string"},banOrUnban:{type:"options",options:["ban","unban"],required:!0},category:{type:"options",options:[...a(87549).Kn],comment:"(required on ban)"},subcategory:{type:"options",options:[...a(87549).mQ],comment:"(optional)"},other:{type:"string",comment:"If you selected 'other' as the category, please give a description. (optional)"},note:{type:"string",multiline:!0,comment:"Optional internal note about this ban. Use this for case context; use Other only when the ban category is Other."}
50,accountTerminationEmail:{comment:"Send an email to banned accounts",type:"boolean",defaultValue:!1},disallowGmailAliases:{comment:"Disallow all Gmail aliases for this email (prevents logins and signups for all aliases, gmail.com only)",type:"boolean",defaultValue:!1},removeSpaceGuests:{comment:"Also remove all guests from workspaces this user created (deletes their guest memberships and revokes their direct page permissions). Cannot be undone.",type:"boolean",defaultValue:!1}},isDestructive:!0},adminResolveSanctionsAppeal:{apiName:"adminResolveSanctionsAppeal",displayName:"Resolve account appeal",emoji:"⚖️",description:(0,d.jsx)(d.Fragment,{children:"After reviewing the linked Zendesk ticket, approve, deny, or mark a banned user's appeal as needing more information. Approval restores access only when the appeal still matches the current ban and its category metadata is available. Approval always emails the user and records an Admin Mode note and audit event."}),schema:{userId:{type:"string",comment:"User ID from the Zendesk appeal ticket."},appealId:{type:"string",comment:"Appeal ID from the Zendesk appeal ticket."},action:{type:"options",options:["approve","deny","needs_info"]},reviewerNote:{type:"string",comment:"Reviewer rationale recorded in the audit trail. (optional)"}},isDestructive:!0},adminExportBannedUserData:{apiName:"adminExportBannedUserData",displayName:"Export banned user data",emoji:"📦",description:(0,d.jsxs)(d.Fragment,{children:["Starts a data export for a banned user: checks the user's original ban reason,"," ",(0,d.jsx)("b",{children:"refuses with an error if they were banned for CSAM (Child exploitation) or illegal activities"}),". When the appeals flow is enabled, the export runs without unbanning them and the user downloads it through the appeals site. Otherwise, the existing temporary export and re-ban flow is used. Use this when a banned user asks for their data."]}),schema:{userEmail:{type:"string"},exportType:{type:"options",options:["markdown","html","pdf"],defaultValue:"markdown",comment:"Export format. Defaults to markdown."},windowHours:{type:"number",numberType:"integer",min:1,max:72,defaultValue:24,comment:"Legacy fallback only: how long the user stays unbanned to download before being re-banned. Defaults to 24 hours."},spaceId:{type:"string",comment:"(optional) Restrict the export to a single workspace. Leave empty to export all of the user's exportable workspaces."}},isDestructive:!0},adminDeleteBannedUser:{apiName:"adminDeleteBannedUser",displayName:"Delete Banned User",emoji:"🗑️",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("b",{children:"Use this only to honor a privacy deletion request (GDPR / DSR erasure) from a user who is currently banned."})," ","Regular deletion refuses to run on a banned account, so this tool unbans, permanently deletes, and preserves the ban by blocking the user's email addresses from future logins and signups.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"It"," ",(0,d.jsx)("b",{children:"refuses with an error if they were banned for CSAM (Child exploitation) or illegal activities"}),", since those accounts are never unbanned and may be under a legal preservation hold, and it refuses if the user is under an active legal hold.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"NOTE: the email block covers ",(0,d.jsx)("b",{children:"all aliases"})," of the address, even if the original ban did not. Once the account is deleted there are no records left to enforce the ban against, so the email block is the only thing preventing the person signing up again — a narrower block would not survive. The response lists exactly which addresses were blocked; keep it with the privacy request.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"The block can take up to 5 minutes to reach every server. If the person manages to sign up again in that window, ban the new account normally."]}),schema:{userEmail:{type:"string"},privacyRequestReference:{type:"string",comment:"Ticket ID or DSR reference for the privacy request being honored. Recorded in the admin log so this deletion can be traced after the user's records are gone."}},isDestructive:!0,requiresHourlyReauth:!0}
50,adminBulkBanUsers:{apiName:"adminBulkBanUsers",generatedRequestIdKey:"requestId",displayName:"Bulk Ban Users (via CSV)",emoji:"🚷",description:(0,d.jsxs)(d.Fragment,{children:["Bulk ban users from using Notion. Users will be logged out and lose all access to Notion.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsxs)("i",{children:["NOTE: A ",(0,d.jsx)("b",{children:"single"})," category/subcategory will apply to ",(0,d.jsx)("b",{children:"all"})," ","users specified in the CSV."]}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"WHAT IT OUTPUTS: An automatically downloaded CSV of users (email, user ID) that have been successfully enqueued for banning."," ",(0,d.jsx)("i",{children:"Invalid emails will be omitted from this list."})]}),schema:{csv:{type:"file",name:"csv",comment:"A column of <= 20,000 unique user identifiers (accepts email, uuid with dash, uuid without dash). Requires a USER_IDENTIFIER column header."},banOrUnban:{type:"string"},numRows:{type:"number",comment:"Confirm the number of user identifiers in your CSV"},category:{type:"options",options:[...a(87549).Kn],comment:"(required on ban)"},subcategory:{type:"options",options:[...a(87549).mQ],comment:"(optional)"},other:{type:"string",comment:"If you selected 'other' as the category, please give a description. (optional)"},note:{type:"string",multiline:!0,comment:"Optional internal note applied to every ban in this CSV. Use this for case context; use Other only when the ban category is Other."},accountTerminationEmail:{comment:"Send an email to banned accounts",type:"boolean",defaultValue:!1},disallowGmailAliases:{comment:"Disallow all Gmail aliases for each email (prevents logins and signups for all aliases, gmail.com only)",type:"boolean",defaultValue:!1},removeSpaceGuests:{comment:"Also remove all guests from workspaces each banned user created (deletes their guest memberships and revokes their direct page permissions). Cannot be undone.",type:"boolean",defaultValue:!1}},isDestructive:!0}},tq=[{displayName:"All allowances",value:"all"},{displayName:"Standard rolling",value:"standard-rolling"},{displayName:"Standard billing period",value:"standard-billing-period"},{displayName:"Auto billing period",value:"auto-billing-period"},{displayName:"Flex billing period",value:"flex-billing-period"}];function tH(e){switch(e){case"no_usage":return"no credits were used against it this period";case"fully_refunded":return"everything used against it has already been refunded or credit noted";case"no_invoice_line":return"its Metronome commit names no Stripe invoice line, so a refund against it could not be booked"}}let tZ={planning:{label:"Planning",tone:"info"},awaiting_review:{label:"Needs review",tone:"warn"},answered:{label:"Applying",tone:"info"},planned:{label:"Dry run complete",tone:"neutral"},applied:{label:"Applied",tone:"ok"},rejected:{label:"Declined",tone:"muted"},expired:{label:"Expired",tone:"neutral"},failed:{label:"Failed",tone:"bad"}},tJ={pending:{label:"Will refund",tone:"info"},pending_failed:{label:"Will fail",tone:"bad"},dry_run_success:{label:"Would refund",tone:"info"},dry_run_failed:{label:"Would fail",tone:"bad"},success:{label:"Refunded",tone:"ok"},failed:{label:"Failed",tone:"bad"},partially_applied:{label:"Partially applied",tone:"warn"},outcome_unknown:{label:"Outcome unknown",tone:"warn"}},tQ=["spaceId","creditAmount","status","billingPath","refundableUsageBefore","projectedUsageAfter","metronomeCustomerId","metronomeContractId","creditSource","targetId","invoiceLineId","invoiceDate","creditsFromSource","error"];function tY(e){return"N/A"===e?"—":(0,a(469181).Ql)(e)}function tX(e){let{display:t}=e;return(0,d.jsx)("span",{style:{...a(469181).Io,...a(469181).Rr[t.tone]},children:t.label})}function t0(e){return void 0===e.user?(0,d.jsx)(a(137691).x5,{value:e.userId}):(0,d.jsx)(a(553775).uQ,{user:e.user})}let t1=(0,a(327219).YK)({hideRawResponse:{id:"adminBulkCreditRefundBatch.hideRawResponse",defaultMessage:"Hide the raw response"},showRawResponse:{id:"adminBulkCreditRefundBatch.showRawResponse",defaultMessage:"Show the raw response"}});function t4(e){let{data:t,environment:i,onReload:n}=e,[s,o]=(0,r.useState)({kind:"unanswered"}),[l,c]=(0,r.useState)(new Map),p=(0,r.useMemo)(()=>(function(e){let t=new Map;for(let i of e){var a;let e=t.get(i.spaceId),n=e??{spaceId:(a=i).spaceId,creditAmount:a.creditAmount,status:a.status,billingPath:a.billingPath,refundableUsageBefore:a.refundableUsageBefore,projectedUsageAfter:a.projectedUsageAfter,error:a.error,metronomeCustomerId:a.metronomeCustomerId,metronomeContractId:a.metronomeContractId,sources:[],rows:[]};void 0===e&&t.set(i.spaceId,n),n.rows.push(i),""!==i.creditSource&&n.sources.push({targetId:i.targetId,creditSource:i.creditSource,creditsFromSource:i.creditsFromSource,invoiceLineId:i.invoiceLineId,invoiceDate:i.invoiceDate})}return Array.from(t.values())})(t.rows),[t.rows]),m=(0,r.useMemo)(()=>(function(e){let t=0,a=0,i=0,n=0,r=0,s=0;for(let l of e){var o;t+=l.creditAmount,"partially_applied"===l.status?r+=1:"outcome_unknown"===l.status?s+=1:"failed"===(o=l.status)||"dry_run_failed"===o||"pending_failed"===o?n+=1:(a+=l.creditAmount,i+=1)}
50return{workspaceCount:e.length,applicableWorkspaceCount:i,requestedCredits:t,applicableCredits:a,failedWorkspaceCount:n,partiallyAppliedWorkspaceCount:r,outcomeUnknownWorkspaceCount:s}})(p),[p]),u=(0,r.useMemo)(()=>new Map(t.menus.map(e=>[e.spaceId,e])),[t.menus]),h=(0,r.useMemo)(()=>Array.from(l,([e,t])=>({spaceId:e,allocations:t})),[l]),y=(0,r.useMemo)(()=>{let e,a;var i,n=(e=new Map((i={menus:t.menus,plannedRows:t.rows,overrides:h}).menus.map(e=>[e.spaceId,e])),0===(a=[...function(e){let t=new Set,a=new Set;for(let i of e)t.has(i.spaceId)&&a.add(i.spaceId),t.add(i.spaceId);return[...a].map(e=>({spaceId:e,message:"This workspace is given more than one split. Give it one."}))}(i.overrides),...i.overrides.flatMap(t=>(function(e){var t;let a,{override:i,menu:n,plannedRows:r}=e,{spaceId:s,allocations:o}=i,l=null==(t=r.find(e=>e.spaceId===s))?void 0:t.creditAmount;return void 0===l?[{spaceId:s,message:"This workspace is not in the batch."}]:(a=r.filter(e=>e.spaceId===s)).length>0&&a.every(e=>"dry_run_success"===e.status||"pending"===e.status)?void 0===n||0===n.targets.length?[{spaceId:s,message:"This workspace has no credit sources to choose between, so its split cannot be changed."}]:0===o.length?[{spaceId:s,message:`Give at least one credit source some of the ${l} credits.`}]:[...o.flatMap(e=>(function(e){let{spaceId:t,allocation:a,menu:i}=e,{targetId:n,creditAmount:r}=a,s=i.targets.find(e=>e.targetId===n);return void 0===s?[{spaceId:t,targetId:n,message:`${n} is not one of this workspace's credit sources.`}]:!Number.isSafeInteger(r)||r<=0?[{spaceId:t,targetId:n,message:`${s.label} needs a whole number of credits above zero.`}]:r>s.refundable?[{spaceId:t,targetId:n,message:`${s.label} can only give back ${s.refundable}${void 0===s.ineligibleReason?"":` — ${tH(s.ineligibleReason)}`}.`}]:[]})({spaceId:s,allocation:e,menu:n})),...function(e,t){let a=new Set,i=new Set;for(let e of t)a.has(e.targetId)&&i.add(e.targetId),a.add(e.targetId);return[...i].map(t=>({spaceId:e,targetId:t,message:"This credit source is named twice. Give it one amount."}))}(s,o),...function(e){let t=e.allocations.reduce((e,t)=>e+t.creditAmount,0);if(t===e.requested)return[];let a=t>e.requested?"more than":"less than";return[{spaceId:e.spaceId,message:`These add up to ${t} credits, ${a} the ${e.requested} the file asked for. An override moves a workspace's refund between sources; to change the amount, upload the file again.`}]}({spaceId:s,allocations:o,requested:l})]:[{spaceId:s,message:"This workspace's plan did not resolve, so there is no refund to re-split."}]})({override:t,menu:e.get(t.spaceId),plannedRows:i.plannedRows}))]).length?{ok:!0}:{ok:!1,problems:a});let r=new Map;if(n.ok)return r;for(let e of n.problems){let t=r.get(e.spaceId);void 0===t?r.set(e.spaceId,[e]):t.push(e)}return r},[t.menus,t.rows,h]),g=(0,r.useCallback)((e,t)=>{c(a=>{let i=new Map(a);return void 0===t?i.delete(e):i.set(e,t),i})},[]),x=(0,r.useCallback)(async e=>{o({kind:"sending"});let r=await i.api.callApi({eventName:"adminApproveBulkCreditRefundBatch",environment:i,data:{batchId:t.batchId,approve:e,...e&&h.length>0?{overrides:h}:{}}});"failed"===r.type?o({kind:"failed",message:`Notion could not confirm this went through. Press Refresh to see whether the refunds applied before you try again — ${(0,a(201790).V4)(r)}`}):(o({kind:"unanswered"}),c(new Map),n())},[i,t.batchId,h,n]);return(0,d.jsxs)(a(4458).VP,{style:al.container,children:[(0,d.jsx)(t2,{data:t,totals:m}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:t.message}),(0,d.jsx)(t9,{totals:m}),(0,d.jsx)(t3,{totals:m}),(0,d.jsx)(t5,{workspaces:p,menusBySpaceId:u,canOverride:"awaiting_review"===t.state,overrides:l,problemsBySpaceId:y,onOverrideChange:g}),(0,d.jsx)(ao,{state:t.state,totals:m,answer:s,overriddenWorkspaceCount:h.length,problemCount:function(e){let t=0;for(let a of e.values())t+=a.length;return t}(y),onAnswer:x}),(0,d.jsxs)(a(4458).fI,{style:al.buttonRow,children:[(0,d.jsx)(ar,{data:t}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:n,children:"Refresh"})]}),(0,d.jsx)(as,{data:t})]})}function t2(e){let{data:t,totals:i}=e,n=[{label:"Batch",content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:al.batchId,children:t.batchId}),(0,d.jsx)(tX,{display:tZ[t.state]}),t.dryRun?(0,d.jsx)("span",{style:al.dryRunTag,children:"Dry run"}):void 0]})},{label:"Reason",content:t.reason},{label:"Workspaces",content:String(i.workspaceCount)},{label:function(e){switch(e){case"applied":return"Credits refunded";case"awaiting_review":case"answered":return"Credits to refund";case"rejected":case"expired":return"Credits not refunded";case"planning":case"planned":case"failed":return"Credits in plan"}}(t.state),content:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{children:(0,a(469181).Ql)(i.applicableCredits)}),i.applicableCredits===i.requestedCredits?void 0:(0,d.jsx)("span",{style:a(469181).R7.subtext,children:`${(0,a(469181).Ql)(i.requestedCredits)} uploaded`})]})},{label:"Requested by",content:(0,d.jsx)(t0,{user:t.requestedBy,userId:t.requestedByUserId})}];return void 0!==t.answeredByUserId&&n.push({label:"Reviewed by",content:(0,d.jsx)(t0,{user:t.answeredBy,userId:t.answeredByUserId})}),void 0!==t.allocationMode&&n.push({label:"Split",content:"override"===t.allocationMode?"Changed by hand":"Default refund order"}),(0,d.jsx)("dl",{style:al.headingGrid,children:n.map((e,t)=>(0,d.jsx)(t6,{label:e.label,striped:t%2==1,children:e.content},e.label))})}function t6(e){let{label:t,striped:i,children:n}=e,r=i?{...al.headingLabel,...al.headingStripedCell}:al.headingLabel,s=i?{...al.headingValue,...al.headingStripedCell}:al.headingValue;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("dt",{style:r,children:t}),(0,d.jsx)("dd",{style:s,children:(0,d.jsx)(a(4458).fI,{style:al.headingRow,children:n})})]})}function t9(e){let{totals:t}=e;return 0===t.failedWorkspaceCount&&0===t.partiallyAppliedWorkspaceCount&&0===t.outcomeUnknownWorkspaceCount?null:(0,d.jsxs)(a(4458).fI,{style:al.tileRow,children:[t.failedWorkspaceCount>0?(0,d.jsx)(t7,{label:"Workspaces failing",value:String(t.failedWorkspaceCount)}):void 0,t.partiallyAppliedWorkspaceCount>0?(0,d.jsx)(t7,{label:"Partially applied",value:String(t.partiallyAppliedWorkspaceCount)}):void 0,t.outcomeUnknownWorkspaceCount>0?(0,d.jsx)(t7,{label:"Outcome unknown",value:String(t.outcomeUnknownWorkspaceCount)}):void 0]})}function t7(e){let{label:t,value:i,detail:n}=e;return(0,d.jsxs)(a(4458).VP,{style:a(469181).R7.statTile,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyLgSemibold",children:i}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:t}),void 0===n?void 0:(0,d.jsx)("span",{style:a(469181).R7.subtext,children:n})]})}function t3(e){let{totals:t}=e,i=[function(e){if(0===e.failedWorkspaceCount)return;let t=1===e.failedWorkspaceCount?"The reason is under its row.":"Their reasons are under each row.";return 1===e.workspaceCount?`This workspace will not refund. ${t}`:`${e.failedWorkspaceCount} of ${e.workspaceCount} workspaces will not refund. ${t}`}(t),function(e){if(0===e)return;let t="check what landed before issuing anything else.";return 1===e?`One workspace applied only part of its refund. Re-running cannot recover it — ${t}`:`${e} workspaces applied only part of their refund. Re-running cannot recover these — ${t}`}(t.partiallyAppliedWorkspaceCount),function(e){if(0===e)return;let t="check the Metronome contract before re-running — the grant may have landed.";return 1===e?`One workspace's refund was never confirmed by Metronome. Do not re-run it blind: ${t}`:`${e} workspaces' refunds were never confirmed by Metronome. Do not re-run them blind: ${t}`}(t.outcomeUnknownWorkspaceCount)].filter(e=>void 0!==e);return 0===i.length?null:(0,d.jsx)(a(4458).VP,{style:al.warningBox,children:i.map(e=>(0,d.jsx)("span",{children:e},e))})}let t8=["Workspace","Status","Refund","Refundable before","Projected after","Billing path"];function t5(e){let{workspaces:t,menusBySpaceId:i,canOverride:n,overrides:r,problemsBySpaceId:s,onOverrideChange:o}=e;if(0===t.length)return(0,d.jsx)("div",{style:a(469181).R7.emptyState,children:"No rows resolved yet."});let l=t.some(e=>void 0!==e.metronomeContractId),c=[...t8,...n?["Split"]:[],...l?["Metronome"]:[]];return(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsx)("tr",{children:c.map(e=>(0,d.jsx)("th",{style:a(469181).R7.th,children:e},e))})}),(0,d.jsx)("tbody",{children:t.map(e=>(0,d.jsx)(ae,{workspace:e,menu:i.get(e.spaceId),columnCount:c.length,canOverride:n,showMetronome:l,override:r.get(e.spaceId),problems:s.get(e.spaceId)??[],onOverrideChange:o},e.spaceId))})]})})}function ae(e){let{workspace:t,menu:i,columnCount:n,canOverride:s,showMetronome:o,override:l,problems:c,onOverrideChange:p}=e;return(0,d.jsxs)(r.Fragment,{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(553775).ru,{table:"space",record:{id:t.spaceId}})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(tX,{display:tJ[t.status]})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,a(469181).Ql)(t.creditAmount)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:tY(t.refundableUsageBefore)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:tY(t.projectedUsageAfter)}),(0,d.jsx)("td",{style:a(469181).R7.td,children:"N/A"===t.billingPath?"—":t.billingPath}),s?(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(ai,{workspace:t,menu:i,isOverrid
50den:void 0!==l,onOverrideChange:p})}):void 0,o?(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(aa,{workspace:t})}):void 0]}),void 0===l||void 0===i?(0,d.jsx)(at,{sources:t.sources,columnCount:n}):(0,d.jsx)(an,{spaceId:t.spaceId,targets:i.targets,sources:t.sources,columnCount:n,requestedCredits:t.creditAmount,allocations:l,problems:c,onOverrideChange:p}),""===t.error?void 0:(0,d.jsx)("tr",{children:(0,d.jsx)("td",{style:al.errorCell,colSpan:n,children:t.error})})]})}function at(e){let{sources:t,columnCount:i}=e;return(0,d.jsx)(r.Fragment,{children:t.map((e,t)=>{var n,r;return(0,d.jsxs)("tr",{style:a(469181).R7.segmentRow,children:[(0,d.jsx)("td",{style:a(469181).R7.segmentCellIndented,colSpan:2,children:e.creditSource}),(0,d.jsx)("td",{style:a(469181).R7.segmentCell,children:void 0===e.creditsFromSource?"—":(0,a(469181).Ql)(e.creditsFromSource)}),(0,d.jsx)("td",{style:a(469181).R7.segmentCell,colSpan:i-3,children:(n=e.invoiceDate,""===(r=e.invoiceLineId)?"No invoice line":""===n?r:`${n} \xb7 ${r}`)})]},`${e.creditSource}-${e.invoiceLineId}-${t}`)})})}function aa(e){let{metronomeCustomerId:t,metronomeContractId:i}=e.workspace;return void 0===t||void 0===i?(0,d.jsx)("span",{style:a(469181).R7.subtext,children:"—"}):(0,d.jsx)(a(899815)._,{href:l(t,i),external:!0,children:"Open in Metronome"})}function ai(e){let{workspace:t,menu:i,isOverridden:n,onOverrideChange:s}=e,o=(0,r.useCallback)(()=>{s(t.spaceId,t.sources.flatMap(e=>void 0===e.creditsFromSource||void 0===e.targetId?[]:[{targetId:e.targetId,creditAmount:e.creditsFromSource}]))},[s,t]),l=(0,r.useCallback)(()=>{s(t.spaceId,void 0)},[s,t.spaceId]);return void 0===i||i.targets.length<2?(0,d.jsx)("span",{style:a(469181).R7.subtext,children:"—"}):n?(0,d.jsx)(a(988022).p,{size:"sm",onClick:l,children:"Use plan split"}):(0,d.jsx)(a(265779).E,{size:"sm",onClick:o,children:"Change split"})}function an(e){let{spaceId:t,targets:i,sources:n,columnCount:s,requestedCredits:o,allocations:l,problems:c,onOverrideChange:p}=e,m=(0,r.useMemo)(()=>{let e,t;return t=(e=new Map(n.flatMap((e,t)=>void 0===e.targetId?[]:[[e.targetId,t]]))).size,[...i].sort((a,i)=>(e.get(a.targetId)??t)-(e.get(i.targetId)??t))},[i,n]),u=(0,r.useCallback)((e,a)=>{let i=l.filter(t=>t.targetId!==e);p(t,void 0===a?i:[...i,{targetId:e,creditAmount:a}])},[l,p,t]),h=l.reduce((e,t)=>e+t.creditAmount,0),y=c.filter(e=>void 0===e.targetId);return(0,d.jsxs)(r.Fragment,{children:[m.map(e=>{var t,i,n,r;let o;return(0,d.jsxs)("tr",{style:a(469181).R7.segmentRow,children:[(0,d.jsx)("td",{style:a(469181).R7.segmentCellIndented,colSpan:2,children:(0,d.jsxs)(a(4458).VP,{children:[(0,d.jsx)("span",{children:e.label}),(0,d.jsx)("span",{style:a(469181).R7.subtext,children:(t=e,o=[`${(0,a(469181).Ql)(t.refundable)} refundable`],""!==t.invoiceDate&&o.push(`invoiced ${t.invoiceDate}`),void 0!==t.ineligibleReason&&o.push(tH(t.ineligibleReason)),o.join(" · "))})]})}),(0,d.jsx)("td",{style:a(469181).R7.segmentCell,children:(0,d.jsx)(a(129611).o2,{targetId:e.targetId,label:`Refund amount for ${e.label}`,initialAmount:(i=l,n=e.targetId,null==(r=i.find(e=>e.targetId===n))?void 0:r.creditAmount),disabled:0===e.refundable,onAmountChange:u})}),(0,d.jsx)("td",{style:a(469181).R7.segmentCell,colSpan:s-3,children:c.filter(t=>t.targetId===e.targetId).map(e=>(0,d.jsx)("span",{style:al.problem,children:e.message},e.message))})]},e.targetId)}),(0,d.jsx)("tr",{style:a(469181).R7.segmentRow,children:(0,d.jsx)("td",{style:a(469181).R7.segmentCellIndented,colSpan:s,children:(0,d.jsxs)(a(4458).fI,{style:al.overrideFooter,children:[(0,d.jsx)("span",{children:`Total: ${(0,a(469181).Ql)(h)} of ${(0,a(469181).Ql)(o)} uploaded`}),y.map(e=>(0,d.jsx)("span",{style:al.problem,children:e.message},e.message))]})})})]})}function ar(e){let{data:t}=e,i=(0,r.useCallback)(()=>{(0,a(216736).WN)({blob:new Blob([(0,a(318851).A)([[...tQ],...t.rows.map(e=>tQ.map(t=>{let a=e[t];return void 0===a?"":String(a)}))],{escape_formulas:!0})],{type:"text/csv;charset=utf-8"}),filename:`bulk_credit_refund_${t.batchId}.csv`})},[t]);return 0===t.rows.length?null:(0,d.jsx)(a(548436).A,{size:"sm",onClick:i,children:"Download CSV"})}function as(e){let{data:t}=e,i=(0,a(327219).tz)(),[n,s]=(0,r.useState)(!1),o=(0,r.useCallback)(()=>s(e=>!e),[]);return(0,d.jsxs)(a(4458).VP,{style:al.rawResponse,children:[(0,d.jsxs)(a(4458).fI,{style:al.rawResponseHeader,children:[(0,d.jsx)(a(374533).K,{icon:n?a(87963).arrowChevronSingleDownIcon:a(342392).arrowChevronSingleRightIcon,size:"sm",colorVariant:"secondary",onClick:o,ariaLabel:i.formatMessage(n?t1.hideRawResponse:t1.showRawResponse)}),(0,d.jsx)(a(988022).p,{size:"sm",onClick:o,children:"Raw response"})]}),n?(0,d.jsx)("div",{style:al.rawResponseBody,children:(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})}):void 0]})}function ao(e){let{state:t,totals:i,answer:n,overriddenWorkspaceCount:s,problemCount:o,onAnswer:l}=e,c=(0,r.useCallback)(()=>{var e;window.confirm(`Refund ${(0,a(469181).Ql)(i.applicableCredits)}
50 credits across ${i.applicableWorkspaceCount} workspaces?`+(0===(e=s)?"":1===e?" One workspace has a changed split.":` ${e} workspaces have a changed split.`))&&l(!0)},[l,i,s]),p=(0,r.useCallback)(()=>{window.confirm("Decline this batch? Nothing will be refunded. To refund these workspaces later you have to upload the CSV again.")&&l(!1)},[l]);return"sending"===n.kind?(0,d.jsxs)(a(4458).fI,{style:al.buttonRow,children:[(0,d.jsx)(a(517334).k,{}),(0,d.jsx)("span",{children:"Submitting…"})]}):"failed"===n.kind?(0,d.jsx)("div",{style:al.error,children:n.message}):"awaiting_review"!==t?null:(0,d.jsxs)(a(4458).VP,{style:al.reviewControls,children:[0===o?void 0:(0,d.jsx)("div",{style:al.error,children:1===o?"Fix the changed split above before approving.":`Fix the ${o} problems with the changed splits above before approving.`}),(0,d.jsxs)(a(4458).fI,{style:al.buttonRow,children:[(0,d.jsx)(a(912946).j,{size:"md",colorPalette:"red",disabled:o>0,onClick:c,children:"Approve and apply"}),(0,d.jsx)(a(548436).A,{size:"md",onClick:p,children:"Decline"})]})]})}let al={headingGrid:{display:"grid",gridTemplateColumns:"max-content minmax(0, 1fr)",columnGap:0,margin:0,width:"auto"},headingLabel:{textAlign:"start",paddingBlock:2,paddingInlineEnd:24,fontSize:11,fontWeight:a(699422).Wy.regular,color:a(632079).Tj.text.secondary,whiteSpace:"nowrap"},headingValue:{margin:0,paddingBlock:2,paddingInlineStart:8,fontSize:12},headingStripedCell:{backgroundColor:a(632079).Tj.background.secondary},batchId:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13},buttonRow:{alignItems:"center",gap:8},container:{gap:12,width:"100%"},dryRunTag:{fontStyle:"italic",fontSize:12,color:a(632079).Tj.text.secondary},error:{color:a(632079).Tj.red.text.primary},errorCell:{paddingBlock:4,paddingInlineStart:28,paddingInlineEnd:12,fontSize:12,color:a(632079).Tj.red.text.primary,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},headingRow:{alignItems:"center",gap:12},overrideFooter:{alignItems:"center",gap:12,flexWrap:"wrap"},problem:{color:a(632079).Tj.red.text.primary},rawResponse:{gap:8,marginBlockStart:8},rawResponseBody:{fontSize:12},rawResponseHeader:{alignItems:"center",gap:4},reviewControls:{gap:8},warningBox:{gap:4,paddingBlock:8,paddingInline:12,borderRadius:6,fontSize:13,backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.accentPrimary},tileRow:{gap:12,flexWrap:"wrap"}},ad=(0,a(327219).YK)({collapseBatch:{id:"adminBulkCreditRefundBatchList.collapseBatch",defaultMessage:"Collapse batch {batchId}"},expandBatch:{id:"adminBulkCreditRefundBatchList.expandBatch",defaultMessage:"Expand batch {batchId}"}}),ac=["Batch","State","Reason","Requested by","Workspaces","Updated"];function ap(e){let t,{batch:i,open:n,environment:s,onOpen:o,onClose:l}=e,c=(0,a(327219).tz)(),p=void 0!==n,m=(0,r.useCallback)(()=>{p?l():o(i.batchId)},[p,o,l,i.batchId]),u=(0,r.useCallback)(()=>o(i.batchId),[o,i.batchId]);return(0,d.jsxs)(r.Fragment,{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(a(374533).K,{icon:p?a(87963).arrowChevronSingleDownIcon:a(342392).arrowChevronSingleRightIcon,size:"sm",colorVariant:"secondary",onClick:m,ariaLabel:c.formatMessage(p?ad.collapseBatch:ad.expandBatch,{batchId:i.batchId})})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsxs)(a(4458).fI,{style:au.batchCell,children:[(0,d.jsx)(a(988022).p,{size:"sm",onClick:m,children:(0,d.jsx)("span",{style:au.batchId,children:i.batchId})}),i.dryRun?(0,d.jsx)("span",{style:au.dryRunTag,children:"dry run"}):void 0]})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsxs)(a(4458).fI,{style:au.stateCell,children:[(0,d.jsx)(tX,{display:tZ[i.state]}),i.partiallyAppliedWorkspaceCount>0?(0,d.jsx)(tX,{display:{label:`${i.partiallyAppliedWorkspaceCount} partially applied`,tone:"warn"}}):void 0,i.outcomeUnknownWorkspaceCount>0?(0,d.jsx)(tX,{display:{label:`${i.outcomeUnknownWorkspaceCount} outcome unknown`,tone:"warn"}}):void 0]})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:i.reason}),(0,d.jsx)("td",{style:a(469181).R7.td,children:(0,d.jsx)(t0,{user:i.requestedBy,userId:i.requestedByUserId})}),(0,d.jsx)("td",{style:a(469181).R7.td,children:i.workspaceCount}),(0,d.jsx)("td",{style:a(469181).R7.td,children:Number.isNaN(t=Date.parse(i.updatedAt))||0===t?"—":(0,a(469181).r6)(t)})]}),void 0===n?void 0:(0,d.jsx)("tr",{children:(0,d.jsx)("td",{style:au.expandedCell,colSpan:ac.length+1,children:(0,d.jsx)("div",{style:au.expandedPanel,children:(0,d.jsx)(am,{open:n,environment:s,onReload:u})})})})]})}function am(e){let{open:t,environment:i,onReload:n}=e;return"loading"===t.kind?(0,d.jsxs)(a(4458).fI,{style:au.footerRow,children:[(0,d.jsx)(a(517334).k,{}),(0,d.jsxs)("span",{children:["Reading ",t.batchId,"…"]})]}):"failed"===t.kind?(0,d.jsx)("div",{style:au.error,children:t.message}):(0,d.jsx)(t4,{data:t.data,environment:i,onReload:n})}let au={batchCell:{alignItems:"center",gap:8},batchId:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontSize:13},container:{gap:12,width:"100%"},dryRunTag:{fontStyle:"italic",fontSize:12,color:a(632079).Tj.text.secondary,whiteSpace:"nowrap"},error:{color:a(632079).Tj.red.text.primary},expandedCell:{backgroundColor:a(632079).Tj.background.primary,paddingBlock:12,paddingInlineStart:48,paddingInlineEnd:12,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},expandedPanel:{backgroundColor:a(632079).Tj.background.secondary,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,padding:16},footerRow:{alignItems:"center",gap:8},loadMoreRow:{alignItems:"center",justifyContent:"center",gap:8,paddingBlockStart:4},stateCell:{alignItems:"center",gap:6,flexWrap:"wrap"}},ah=(0,a(327219).YK)({previewCompleted:{id:"admin.refund-credits.response.preview-completed",defaultMessage:"Refund preview completed."},refundSubmitted:{id:"admin.refund-credits.response.submitted",defaultMessage:"Refund submitted successfully."},usageAfterRefund:{id:"admin.refund-credits.response.usage-after-refund",defaultMessage:"{creditAmount} credits; predicted usage after refund: {afterUsage}."},previewBanner:{id:"admin.refund-credits.response.preview-banner",defaultMessage:"This is a preview. No credits were refunded. Review every action, then uncheck dryRun and submit again."},creditAcrossPeriods:{id:"admin.refund-credits.response.credit-across-periods",defaultMessage:"{creditAmount} credits across {periodCount, plural, one {# service period} other {# service periods}}"},impactedUsage:{id:"admin.refund-credits.response.impacted-usage",defaultMessage:"Impacted usage: {totalUsage} credits"},adjustmentId:{id:"admin.refund-credits.response.adjustment-id",defaultMessage:"Adjustment ID: {adjustmentId}"},dateRange:{id:"admin.refund-credits.response.date-range",defaultMessage:"{start} through {end} UTC"},billingState:{id:"admin.refund-credits.response.billing-state",defaultMessage:"Billing state: {billingState}"},action:{id:"admin.refund-credits.response.action",defaultMessage:"Action: {action}"},refundAmount:{id:"admin.refund-credits.response.refund-amount",defaultMessage:"Refund amount: {creditAmount} credits"},pools:{id:"admin.refund-credits.response.pools",defaultMessage:"Pools: {pools}"},noPools:{id:"admin.refund-credits.response.no-pools",defaultMessage:"None"},poolAmount:{id:"admin.refund-credits.response.pool-amount",defaultMessage:"{pool}: {creditAmount}"},open:{id:"admin.refund-credits.response.state.open",defaultMessage:"Open"},softFinalized:{id:"admin.refund-credits.response.state.soft-finalized",defaultMessage:"Soft finalized"},finalized:{id:"admin.refund-credits.response.state.finalized",defaultMessage:"Finalized"},billed:{id:"admin.refund-credits.response.state.billed",defaultMessage:"Billed"},cancelUsage:{id:"admin.refund-credits.response.action.cancel-usage",defaultMessage:"Cancel usage in Metronome"},createBackdatedPromotionalGrant:{id:"admin.refund-credits.response.action.create-backdated-promotional-grant",defaultMessage:"Create a backdated promotional credit grant in Metronome"},createCurrentPeriodPromotionalGrant:{id:"admin.refund-credits.response.action.create-current-period-promotional-grant",defaultMessage:"Create a promotional credit grant for the current invoice peri
50od"},issueCreditMemo:{id:"admin.refund-credits.response.action.issue-credit-memo",defaultMessage:"Issue a NetSuite credit memo; do not change Metronome"},voidRegenerateInvoiceInstruction:{id:"admin.refund-credits.response.instruction.void-regenerate-invoice",defaultMessage:"The backdated promotional credit grant was added. Open the Metronome invoice, then void and regenerate it."},previewVoidRegenerateInvoiceInstruction:{id:"admin.refund-credits.response.instruction.preview-void-regenerate-invoice",defaultMessage:"After the refund succeeds, open the Metronome invoice, then void and regenerate it."},currentPeriodPromotionalGrantInstruction:{id:"admin.refund-credits.response.instruction.current-period-promotional-grant",defaultMessage:"The promotional credit grant applies to the current invoice period. Do not void or regenerate the historical invoice."},openMetronomeInvoice:{id:"admin.refund-credits.response.open-metronome-invoice",defaultMessage:"Open Metronome invoice"},creditMemoInstruction:{id:"admin.refund-credits.response.instruction.credit-memo",defaultMessage:"Do not change Metronome. Finance must issue a credit memo in NetSuite manually."},onDemandPool:{id:"admin.refund-credits.response.pool.on-demand",defaultMessage:"On-demand"},annualPool:{id:"admin.refund-credits.response.pool.annual",defaultMessage:"Annual"},monthlyPool:{id:"admin.refund-credits.response.pool.monthly",defaultMessage:"Monthly"},trialPool:{id:"admin.refund-credits.response.pool.trial",defaultMessage:"Trial"}}),ay={banner:{padding:12,borderRadius:6,backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.primary},summary:{padding:12,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary},action:{padding:12,borderRadius:6,border:`1px solid ${a(632079).Tj.border.primary}`},instruction:{padding:8,borderRadius:4,backgroundColor:a(632079).Tj.yellow.background.secondary,color:a(632079).Tj.yellow.text.primary}},ag={adminRefundNotionCredits:{apiName:"adminRefundNotionCredits",generatedRequestIdKey:"adjustmentId",preserveGeneratedRequestIdOnDryRun:!0,preserveInputValuesOnDryRun:!0,customResponseRenderer:function(e){let{data:t}=e,i=(0,a(327219).tz)();if("sales-assisted"!==t.billingPath||void 0===t.preview)return(0,d.jsxs)(a(4458).VP,{gap:12,padding:16,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:t.dryRun?i.formatMessage(ah.previewCompleted):i.formatMessage(ah.refundSubmitted)}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.usageAfterRefund,{creditAmount:t.creditAmount,afterUsage:t.afterUsage})})]});let n=t.preview,r=new Set(n.actions.map(e=>`${e.servicePeriodStartMs}:${e.servicePeriodEndMs}`)).size;return(0,d.jsxs)(a(4458).VP,{gap:12,padding:16,children:[t.dryRun?(0,d.jsx)("div",{style:ay.banner,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.previewBanner)})}):void 0,(0,d.jsx)("div",{style:ay.summary,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:i.formatMessage(ah.creditAcrossPeriods,{creditAmount:n.creditAmount,periodCount:r})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.impactedUsage,{totalUsage:n.totalUsage})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.adjustmentId,{adjustmentId:n.adjustmentId})})]})}),n.actions.map(e=>{var n,r,s,o,l;
50let c,p,m=function(e,t,a){switch(t){case"cancel_usage":return;case"create_backdated_promotional_grant_and_void_invoice":return e.formatMessage(a?ah.previewVoidRegenerateInvoiceInstruction:ah.voidRegenerateInvoiceInstruction);case"create_current_period_promotional_grant":return e.formatMessage(ah.currentPeriodPromotionalGrantInstruction);case"issue_netsuite_credit_memo":return e.formatMessage(ah.creditMemoInstruction)}}(i,e.action,t.dryRun);return(0,d.jsx)("div",{style:ay.action,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:(n=i,r=e.impactedPeriodStartMs,s=e.impactedPeriodEndExclusiveMs,c=a(120011).DateTime.fromMillis(r,{zone:"UTC"}).toISODate(),p=a(120011).DateTime.fromMillis(s,{zone:"UTC"}).minus({days:1}).toISODate(),n.formatMessage(ah.dateRange,{start:c,end:p}))}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.billingState,{billingState:function(e,t){switch(t){case"open":return e.formatMessage(ah.open);case"soft_finalized":return e.formatMessage(ah.softFinalized);case"finalized":return e.formatMessage(ah.finalized);case"billed":return e.formatMessage(ah.billed)}}(i,e.billingState)})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.action,{action:function(e,t){switch(t){case"cancel_usage":return e.formatMessage(ah.cancelUsage);case"create_backdated_promotional_grant_and_void_invoice":return e.formatMessage(ah.createBackdatedPromotionalGrant);case"create_current_period_promotional_grant":return e.formatMessage(ah.createCurrentPeriodPromotionalGrant);case"issue_netsuite_credit_memo":return e.formatMessage(ah.issueCreditMemo)}}(i,e.action)})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.refundAmount,{creditAmount:e.creditAmount})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(ah.pools,{pools:(o=i,0===(l=e.poolAllocations).length?o.formatMessage(ah.noPools):l.map(e=>o.formatMessage(ah.poolAmount,{pool:function(e,t){switch(t){case"on_demand":return e.formatMessage(ah.onDemandPool);case"annual":return e.formatMessage(ah.annualPool);case"monthly":return e.formatMessage(ah.monthlyPool);case"trial":return e.formatMessage(ah.trialPool)}}(o,e.pool),creditAmount:e.creditAmount})).join(", "))})}),void 0===m?void 0:(0,d.jsx)("div",{style:ay.instruction,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:m}),"create_backdated_promotional_grant_and_void_invoice"===e.action?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:(0,d.jsx)("a",{href:function(e){let{customerId:t,contractId:i,invoiceId:n}=e;return(0,a(540342).L8)({customerId:t,contractId:i,invoiceId:n,livemode:!0})}({customerId:e.metronomeCustomerId,contractId:e.metronomeContractId,invoiceId:e.metronomeInvoiceId}),target:"_blank",rel:"noopener noreferrer",children:i.formatMessage(ah.openMetronomeInvoice)})}):void 0]})})]})},`${e.servicePeriodStartMs}:${e.metronomeInvoiceId}:${e.action}`)})]})},displayName:"Refund Notion credits",emoji:"💳",isDestructive:!0,description:"Refund AI credits attributed to what they offset. Self-serve refunds use the workspace's current credit grants. Sales-assisted refunds use the selected impacted period and allocate the entered amount across its usage automatically.",sc
50hema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to refund credits for"},allocations:{type:"creditRefundAllocations",name:"Credits to refund",spaceIdField:"spaceId",impactedPeriodStartField:"impactedServicePeriodStartDate",impactedPeriodEndField:"impactedServicePeriodEndDate",defaultValue:[],comment:"How many credits to refund against each of this workspace's credit grants. Enter a positive number on the rows you're refunding and leave the rest blank."},reason:{type:"string",comment:"Reason for issuing this refund (required)"},dryRun:{type:"boolean",defaultValue:!0,comment:"If checked, previews billing states and refund actions without applying changes."}}},adminBulkRefundNotionCredits:{apiName:"adminBulkRefundNotionCredits",displayName:"Bulk refund Notion credits (legacy)",emoji:"💳",isDestructive:!0,description:"Legacy. Use Start a bulk credit refund instead: it shows the plan first, and re-uploading a file cannot double-refund. This one refunds the moment you submit.",schema:{csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:"CSV with SPACE_ID and CREDIT_AMOUNT columns. Maximum 100 rows; split a larger file across several uploads."},reason:{type:"string",comment:"Reason for issuing these refunds (required)."},dryRun:{type:"boolean",defaultValue:!0,comment:"If checked, validates and previews refunds without emitting any entitlement or Metronome events."}}},adminStartBulkCreditRefund:{apiName:"adminStartBulkCreditRefund",displayName:"Start a bulk credit refund",emoji:"🧾",isDestructive:!0,description:"Upload a CSV and the batch works out which credits each refund comes out of, then waits for you. Nothing is refunded until you approve, and an unanswered batch expires after 24 hours. Open it from List bulk credit refund batches to read the plan, change a split, and approve or decline.",schema:{csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:"CSV with SPACE_ID and CREDIT_AMOUNT columns. Maximum 500 rows; duplicate SPACE_IDs are rejected."},reason:{type:"string",comment:"Reason for issuing these refunds (required)."},dryRun:{type:"boolean",defaultValue:!0,comment:"If checked, the batch resolves the plan and stops. It never waits for approval and never applies anything."}}},adminListBulkCreditRefundBatches:{apiName:"adminListBulkCreditRefundBatches",displayName:"List bulk credit refund batches",emoji:"📋",description:"Your batches, newest first. Open one to read its plan, download it as a CSV, and approve or decline. Enter a batch id to open one directly, including a colleague's. Kept for 7 days.",schema:{batchId:{type:"string",comment:"Optional. A batch id to open directly, instead of listing recent batches."},limit:{type:"number",defaultValue:25,comment:"How many batches to return. Capped at 100."},cursor:{type:"string",comment:"Optional. The nextCursor from a previous response, to read the next page."}},customResponseRenderer:function(e){let{data:t,environment:i}=e,[n,s]=(0,r.useState)(void 0),[o,l]=(0,r.useState)(void 0),[c,p]=(0,r.useState)(!1),[m,u]=(0,r.useState)(void 0),h=(0,r.useMemo)(()=>(null==o?void 0:o.source)===t?o:{source:t,batches:t.batches,nextCursor:t.nextCursor},[o,t]),y=(0,r.useCallback)(async e=>{let a=await i.api.callApi({eventName:"adminListBulkCreditRefundBatches",environment:i,data:{batchId:e}}),n="failed"===a.type?void 0:a.data.batches[0];void 0!==n&&l(e=>{let a=(null==e?void 0:e.source)===t?e:void 0,i=((null==a?void 0:a.batches)??t.batches).map(e=>e.batchId===n.batchId?n:e);return{source:t,batches:i,nextCursor:(null==a?void 0:a.nextCursor)??t.nextCursor}})},[i,t]),g=(0,r.useCallback)(async e=>{s({kind:"loading",batchId:e});let[t]=await Promise.all([i.api.callApi({eventName:"adminGetBulkCreditRefundBatch",environment:i,data:{batchId:e}}),y(e)]);"failed"===t.type?s({kind:"failed",batchId:e,message:`Could not read this batch: ${(0,a(201790).V4)(t)}`}):s({kind:"loaded",batchId:e,data:t.data})},[i,y]),x=(0,r.useCallback)(()=>s(void 0),[]),f=(0,r.useCallback)(async()=>{if(void 0===h.nextCursor)return;p(!0),u(void 0);let e=await i.api.callApi({eventName:"adminListBulkCreditRefundBatches",environment:i,data:{cursor:h.nextCursor}});(p(!1),"failed"===e.type)?u(`Could not read more batches: ${(0,a(201790).V4)(e)}`):l({source:t,batches:[...h.batches,...e.data.batches],nextCursor:e.data.nextCursor})},[i,t,h]),b=void 0===h.nextCursor?void 0:(0,d.jsxs)(a(4458).fI,{style:au.loadMoreRow,children:[(0,d.jsx)(a(548436).A,{size:"lg",onClick:f,disabled:c,
50children:"Load more"}),c?(0,d.jsx)(a(517334).k,{}):void 0,void 0===m?void 0:(0,d.jsx)("span",{style:au.error,children:m})]});return 0===h.batches.length?(0,d.jsxs)(a(4458).VP,{style:au.container,children:[(0,d.jsx)("div",{style:a(469181).R7.emptyState,children:t.message}),b]}):(0,d.jsxs)(a(4458).VP,{style:au.container,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:t.message}),(0,d.jsx)("div",{style:a(469181).R7.tableWrapper,children:(0,d.jsxs)("table",{style:a(469181).R7.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:a(469181).R7.th}),ac.map(e=>(0,d.jsx)("th",{style:a(469181).R7.th,children:e},e))]})}),(0,d.jsx)("tbody",{children:h.batches.map(e=>(0,d.jsx)(ap,{batch:e,open:(null==n?void 0:n.batchId)===e.batchId?n:void 0,environment:i,onOpen:g,onClose:x},e.batchId))})]})}),b]})}},adminResetAiCreditUsage:{apiName:"adminResetAiCreditUsage",displayName:"Reset AI credit rate-limit usage",emoji:"🔄",isDestructive:!0,description:'Preview or clear the selected AI credit allowance counters for one user in a workspace. Only the selected allowances become available again; other allowances are unchanged. Redis counters only — this does NOT change the durable credit balance or entitlement usage (use "Refund Notion credits" for that).',schema:{allowance:{type:"options",options:[...tq],defaultValue:"all",required:!0,comment:"The allowance to preview or reset. All allowances is the original behavior."},spaceId:{type:"string",table:"space",comment:"Workspace ID whose usage to reset"},userId:{type:"string",table:s().oo9,comment:"User ID whose rate-limit usage to reset in the workspace"},reason:{type:"string",comment:"Reason for the reset (required)"},dryRun:{type:"boolean",defaultValue:!0,comment:"If checked, previews the usage that would be cleared without deleting any counters."}}},adminManageTrialCreditTierOverrides:{apiName:"adminManageTrialCreditTierOverrides",displayName:"Manage Business trial AI credit tier overrides",emoji:"📌",isDestructive:!0,description:"Force a Business trial's AI credit tier, or clear a forced tier. While an override exists it wins over the automatically assigned tier; automated re-evaluation keeps updating the underlying tier, so clearing the override returns the workspace to a current automated tier. Setting a tier is skipped for workspaces not on a Business trial (the override would never be read). Overrides expire on their own a week after the trial ends.",schema:{mode:{type:"options",options:[{displayName:"Single workspace",value:"single"},{displayName:"CSV upload",value:"bulk"}],defaultValue:"single",required:!0,isRequired:!0},spaceId:{type:"string",table:"space",comment:"Workspace ID whose tier to override",visibleWhen:{field:"mode",value:"single"},isRequired:!0},tier:{type:"options",options:["restricted","sample","partial","full",{displayName:"Clear override",value:"clear"}],required:!0,visibleWhen:{field:"mode",value:"single"},isRequired:!0},csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:'CSV with SPACE_ID and TIER columns. TIER is restricted, sample, partial, or full — or "clear" to remove the override. Maximum 500 rows; duplicate SPACE_IDs are rejected.',visibleWhen:{field:"mode",value:"bulk"},isRequired:!0},reason:{type:"string",comment:"Reason for the change (required)."},dryRun:{type:"boolean",defaultValue:!0,comment:"If checked, previews the changes without writing anything."}}},adminBulkResetAiCreditUsage:{apiName:"adminBulkResetAiCreditUsage",displayName:"Bulk reset AI credit rate-limit usage",emoji:"🔄",isDestructive:!0,description:"Preview or clear the selected AI credit allowances for every user in the CSV. CSV must include SPACE_ID and USER_ID columns. Duplicate SPACE_ID/USER_ID pairs are rejected before any resets are processed. Other allowances and durable credit balances are unchanged.",schema:{allowance:{type:"options",options:[...tq],defaultValue:"all",required:!0,comment:"The same allowance target applies to every CSV row."},csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:"CSV with SPACE_ID and USER_ID columns."},reason:{type:"string",comment:"Reason for the resets (required)."},dryRun:{type:"boolean",defaultValue:!0,comment:"If checked, previews the usage that would be cleared without deleting any counters."}}}},ax={type:"object",oneOf:[{type:"object",required:["type","spaceId"],properties:{type:{const:"space"},spaceId:{type:"string"}}},{type:"object",required:["type","spaceId","collectionId"],properties:{type:{const:"collection"},spaceId:{type:"string"},collectionId:{type:"string"}}},{type:"object",required:["type","shardId","schemaName"],properties:{type:{const:"schema"},shardId:{type:"string"},schemaName:{type:"string"}}}]},af={adminEvictCollectionsCache:{apiName:"adminEvictCollectionsCache",dis
50playName:"Evict collections cache",emoji:"🧹",preserveInputValuesOnSuccess:!0,description:`Evicts collections from the SQLite cache across all materializer endpoints. Collections will be re-materialized lazily.
51		See https://dev.notion.so/notion/Collection-SQLite-Runbook-4e3120937a924597a0520095e78e531d?source=copy_link#344b35e6e67f80c79b98cee450edf3ac for more details.`,schema:{target:{type:"json",defaultValue:JSON.stringify({type:"space",spaceId:"00000000-0000-0000-0000-000000000000"},null,2),comment:"JSON target. Supported types: space, collection, schema.",jsonSchema:ax,isRequired:!0},desiredBackend:{type:"options",options:["collectionSqlite","collectionSqlite2"],defaultValue:"collectionSqlite",comment:"Which backend to use for the cache operation.",isRequired:!0},dryRun:{type:"boolean",defaultValue:!0,comment:"If true, simulates the eviction without making changes. Recommended for initial runs."},deleteOrphanedFiles:{type:"boolean",defaultValue:!1,comment:"If true, attempts to delete orphaned cache files on disk for the target(s)."}},isDestructive:!0},adminMaterializeCollectionsCache:{apiName:"adminMaterializeCollectionsCache",displayName:"Materialize collections cache",emoji:"🧱",preserveInputValuesOnSuccess:!0,description:`Materializes collections in the SQLite cache across all materializer endpoints. Cached collections are evicted and rematerialized; uncached collections are materialized from scratch.
52		See https://dev.notion.so/notion/Collection-SQLite-Runbook-4e3120937a924597a0520095e78e531d?source=copy_link#344b35e6e67f80c79b98cee450edf3ac for more details.`,schema:{target:{type:"json",defaultValue:JSON.stringify({type:"collection",spaceId:"00000000-0000-0000-0000-000000000000",collectionId:"00000000-0000-0000-0000-000000000000"},null,2),comment:"JSON target. Supported types: space, collection, schema.",jsonSchema:ax,isRequired:!0},desiredBackend:{type:"options",options:["collectionSqlite","collectionSqlite2"],defaultValue:"collectionSqlite",comment:"Which backend to use for the cache operation.",isRequired:!0},dryRun:{type:"boolean",defaultValue:!0,comment:"If true, simulates the materialization without making changes."}},isDestructive:!0}};function ab(e,t){let a=e.replace(/&/g,"&amp;").replace(/"/g,"&quot;");return`<!DOCTYPE html>
53<html>
54<head>
55  <meta charset="utf-8">
56  <title>Admin Page Review: ${t}</title>
57  <meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; frame-src 'self';">
58  <style>
59    body { 
60      margin: 0; 
61      padding: 0;
62      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
63    }
64    iframe { 
65      width: 100vw; 
66      height: 100vh; 
67      border: none; 
68      display: block;
69    }
70    .banner {
71      position: fixed;
72      top: 0;
73      left: 0;
74      right: 0;
75      background: #fff3cd;
76      border-bottom: 1px solid #ffc107;
77      padding: 8px 16px;
78      font-size: 13px;
79      color: #856404;
80      z-index: 9999;
81      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
82    }
83    .content {
84      padding-top: 40px;
85    }
86  </style>
87</head>
88<body>
89  <div class="banner">
90    📄 Admin Review Mode: Static snapshot of page • Read-only • Images embedded
91  </div>
92  <div class="content">
93    <iframe 
94      sandbox="allow-downloads allow-popups-to-escape-sandbox" 
95      srcdoc="${a}"
96      title="Page Content"
97    ></iframe>
98  </div>
99</body>
100</html>`}a(244767),a(479534),a(718602),a(430278),a(452929),a(953716),a(946415),a(972733),a(417290),a(890015),a(218043),a(889589);let av={style0:{padding:16},style1:{marginBottom:8,fontWeight:a(699422).Wy.semibold},style2:{fontSize:12,color:"#666",marginBottom:12},style3:{color:"#0078D4",textDecoration:"underline",cursor:"pointer",display:"block",marginBottom:16},style4:{marginTop:16,paddingTop:16,borderTop:"1px solid #e0e0e0"},style5:{fontSize:12,color:"#888",marginBottom:8},style6:{marginBottom:8},style7:{color:"#0078D4",textDecoration:"underline",cursor:"pointer",fontSize:13},style8:{fontSize:12,color:"#888",marginTop:16},style9:{fontSize:12,color:"#666",marginBottom:8},style10:{fontSize:11,color:"#999",marginTop:4},style11:{fontSize:12,color:"#888",marginBottom:12},style12:{color:"#0078D4",textDecoration:"underline",cursor:"pointer"}},aj={adminSetPageContentClassification:{apiName:"adminSetPageContentClassification",emoji:"🏛",description:"",schema:{pageId:{type:"string",table:"block"},adminContentClassification:{type:"options",options:a(682956).nd},url:{comment:"External link url (optional). Use this if the notion page links to a malicious site outside of notion.so - all pages containing this url will be flagged if this is set.",type:"string"},supportTicketLink:{type:"string"},overrideVerified:{comment:"Only required if page is currently verified",type:"boolean"},reason:{comment:"Required. Why are you classifying this page?",type:"string"}
100,shouldSendTakedownEmail:{comment:"If it is a content takedown, send an email to all workspace admins",type:"boolean",defaultValue:!0}},isDestructive:!0},adminBulkUnsetPageContentClassification:{apiName:"adminBulkUnsetPageContentClassification",displayName:"Bulk Unset Page Content Classification",emoji:"🏛",description:"Bulk unset page content classification. CSV should have a PAGE_ID column, and an optional EXPECTED_CURRENT_CLASSIFICATION column to enforce unclassification of only those pages.",schema:{csv:{type:"file",name:"csv"},batchSize:{type:"number",comment:"Batch size for the bulk unset",defaultValue:50}},isDestructive:!1},adminRemoveDisallowedUrl:{apiName:"adminRemoveDisallowedUrl",displayName:"Remove disallowed URL",emoji:"🚫",description:"Remove a URL from the disallowed URL list",schema:{url:{type:"string"}},isDestructive:!1},adminSetDisableSpacePublicAccess:{apiName:"adminSetDisableSpacePublicAccess",emoji:"🙅",description:"Disable publishing sites or public links for a workspace. Use this for DMCA takedowns or phishing scammers. Disabling public pages is silent: users will still be able to click the button in the UI, but their pages will not appear publicly.",schema:{spaceId:{type:"string",table:"space"},disabled:{type:"boolean",defaultValue:!0},supportTicketLink:{type:"string"},explanation:{type:"string",comment:"Why are you changing this setting?"}},isDestructive:!0,notinoAction:{actionId:"admin.set_space_public_access",permission:"adminSetDisableSpacePublicAccess",supportsRevert:!0}},adminBulkSetDisableSpacePublicAccess:{apiName:"adminBulkSetDisableSpacePublicAccess",displayName:"Bulk Ban Workspaces (via CSV)",emoji:"🙅",description:"Bulk disable publishing sites and public links for workspaces from a SPACE_ID CSV. Preview first. Guest removal is limited to free workspaces, and creator bans are independently selected.",schema:{csv:{type:"file",name:"CSV",comment:"CSV with a SPACE_ID header and at most 5,000 unique workspace UUIDs."},numRows:{type:"number",comment:"Confirm the number of workspace IDs in your CSV."},disabled:{type:"boolean",defaultValue:!0,comment:"Silently blocks public sites and public links for each workspace. Users may still see publishing controls, but their pages will not be publicly accessible."},removeSpaceGuests:{type:"boolean",defaultValue:!1,comment:"Also remove all guests from each submitted free workspace. This deletes guest memberships and direct page permissions and cannot be undone."},banSpaceCreators:{type:"boolean",defaultValue:!1,comment:"Also ban each submitted workspace's user creator. A creator shared by multiple rows is banned once."},category:{type:"options",options:[...a(87549).Kn],comment:"Required when banning workspace creators."},subcategory:{type:"options",options:[...a(87549).mQ],comment:"Optional creator-ban subcategory."},other:{type:"string",comment:"If the creator-ban category is Other, explain the reason."},supportTicketLink:{type:"string"},explanation:{type:"string",comment:"Why are you changing this setting?"}},isDestructive:!0,requiresHourlyReauth:!0,csvDownloadSuccessMessage:"Workspace enforcement complete. Check the downloaded CSV for results.",typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"Review every per-workspace outcome and selected destructive action, then type the exact generated confirmation.",inputLabel:"Confirmation",confirmButtonLabel:"Run workspace enforcement"}},adminRemovePagePublicAccess:{apiName:"adminRemovePagePublicAccess",displayName:"Remove page public access",emoji:"🚫",description:"Remove public access from a page",schema:{pageId:{type:"string",table:"block"},spaceId:{type:"string",table:"space"}},isDestructive:!0},adminReportCSAMContent:{apiName:"adminReportCSAMContent",emoji:"🛡",description:"Create CSAM case/ticket for content flagged by Cloudflare",sc
100hema:{type:{comment:"Type as categorized by Cloudflare.",type:"string"},csv:{type:"file",name:"csv",comment:"column must be URLS. Please paste the entire comma-separated string in one line."},reference:{comment:"The Reference Note from Cloudflare",type:"string"}},isDestructive:!0},adminTriggerCSAMScan:{apiName:"adminTriggerCSAMScan",displayName:"Trigger CSAM Scan",emoji:"🔍",description:"Manually trigger images for CSAM scanning. Accepts either a pageId (to scan all images on the page) or a single imageUrl for direct scanning.",schema:{pageId:{type:"string",comment:"Page ID to scan all images on the page"},imageUrl:{type:"string",comment:"Single image URL to scan directly",placeholder:"https://bucket.s3.region.amazonaws.com/key"}},isDestructive:!1,customResponseRenderer:void 0},adminExportPageForReview:{apiName:"adminExportPageForReview",displayName:"Export static HTML of non-public page for T&S review",emoji:"📄",description:"Export a Notion page with images and files for legal hold review. Only T&S bypass user consent can use this tool unless running locally.",schema:{pageId:{type:"string",table:"block",comment:"The Notion page ID to export."},includeImages:{type:"boolean",comment:"Include images and file attachments in export",defaultValue:!0},includeSubpages:{type:"boolean",comment:"Include subpages in export",defaultValue:!1},exportFormat:{type:"options",options:["html","pdf"],comment:"Export format",defaultValue:"html"},mode:{type:"options",options:["view","download"],comment:"View: Static HTML with embedded images (opens in browser). Download: ZIP with hash files for legal archival.",defaultValue:"view"}},customResponseRenderer:function({data:e}){let t=(0,a(533992).v3)(),[i,n]=(0,r.useState)(void 0),[s,o]=(0,r.useState)(void 0);if((0,r.useEffect)(()=>{if("view"===e.mode)if("application/pdf"===e.contentType){let t=atob(e.content),a=new Uint8Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);let i=new Blob([a],{type:"application/pdf"}),r=URL.createObjectURL(i);return n(r),window.open(r,"_blank"),()=>{URL.revokeObjectURL(r)}}else{let t=new Blob([ab(e.content,e.fileName)],{type:"text/html"}),a=URL.createObjectURL(t);if(n(a),window.open(a,"_blank"),e.subpages&&e.subpages.length>0){let t=e.subpages.map(e=>{let t=new Blob([ab(e.content,e.fileName)],{type:"text/html"}),a=URL.createObjectURL(t);return{title:e.title,url:a}});return o(t),()=>{URL.revokeObjectURL(a),t.forEach(({url:e})=>{URL.revokeObjectURL(e)})}}return()=>{URL.revokeObjectURL(a)}}"download"===e.mode&&a(326554).I5(t,e.downloadUrl)},[e,t]),"view"===e.mode){let t="application/pdf"===e.contentType;return(0,d.jsxs)("div",{style:av.style0,children:[(0,d.jsx)("div",{style:av.style1,children:t?"PDF opened in new tab!":"Page opened in new tab!"}),(0,d.jsx)("div",{style:av.style2,children:`File: ${e.fileName}`}),(0,d.jsx)("div",{style:av.style2,children:t?"PDF with all images and subpages (if selected) combined into one document.":"Static HTML snapshot with all images and files embedded as base64. This is a read-only snapshot."}),i?(0,d.jsx)("a",{href:i,target:"_blank",rel:"noopener noreferrer",style:av.style3,children:t?"Click here to open PDF again":"Click here to open main page again"}):null,s&&s.length>0?(0,d.jsxs)("div",{style:av.style4,children:[(0,d.jsx)("div",{style:av.style1,children:`Subpages (${s.length}):`}),(0,d.jsx)("div",{style:av.style5,children:"Click to open each subpage in a new tab:"}),s.map(({title:e,url:t},a)=>(0,d.jsx)("div",{style:av.style6,children:(0,d.jsx)("a",{href:t,target:"_blank",rel:"noopener noreferrer",style:av.style7,children:`📄 ${e}`})},a))]}):null,(0,d.jsx)("div",{style:av.style8,children:"Tip: Use Download mode if you need a ZIP archive with hash verification for legal review."})]})}return(0,d.jsxs)("div",{style:av.style0,children:[(0,d.jsx)("div",{style:av.style1,children:"Export complete! Download should start automatically."}),(0,d.jsxs)("div",{style:av.style9,children:[`Bundle file: ${e.zipFileName}`,(0,d.jsx)("div",{style:av.style10,children:"(Contains: export.zip + SHA-256 hash + SHA-512 hash for integrity verification)"})]}),(0,d.jsx)("div",{style:av.style11,children:`Download link expires in ${e.expires
100InHours} hour${1===e.expiresInHours?"":"s"}. File will be deleted after ${e.fileDeletedAfterDays} day${1===e.fileDeletedAfterDays?"":"s"}.`}),(0,d.jsx)("a",{href:e.downloadUrl,style:av.style12,children:"Click here if download doesn't start"})]})},showIfGate:{gateName:"user_data_consent_admin_bypass",alwaysEnabledEnvironments:["local"]}}},ak={td:{padding:"8px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,verticalAlign:"top"}};function aS(e){return(0,d.jsx)("td",{style:ak.td,children:e.children})}let aw={table:{fontSize:13,width:"100%",borderCollapse:"collapse"},th:{textAlign:"start",padding:"8px 12px",borderBottom:`2px solid ${a(632079).Tj.border.primary}`,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.secondary,fontSize:12},caretCell:{padding:"8px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,verticalAlign:"top",width:28},caretButton:{display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",background:"none",border:"none",outline:"none",padding:0,font:"inherit",color:"inherit"},caret:{userSelect:"none",fontSize:10,color:a(632079).Tj.text.secondary,width:12,textAlign:"center"},expandedRow:{backgroundColor:a(632079).Tj.background.secondary},expandedCell:{borderBottom:`1px solid ${a(632079).Tj.border.primary}`,paddingTop:8,paddingInlineEnd:12,paddingBottom:12,paddingInlineStart:30},emptyState:{padding:24,textAlign:"center",fontSize:14,color:a(632079).Tj.text.secondary}};function aI(e){let{columns:t,items:i,getItemId:n,getItemJson:s,renderRow:o,emptyMessage:l="No items found."}=e,[c,p]=(0,r.useState)(new Set),m=(0,r.useCallback)(e=>{p(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]);if(0===i.length)return(0,d.jsx)("div",{style:aw.emptyState,children:l});let u=t.length+1;return(0,d.jsxs)("table",{style:aw.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:aw.th}),t.map(e=>(0,d.jsx)("th",{style:aw.th,children:e},e))]})}),(0,d.jsx)("tbody",{children:i.map(e=>{let t=n(e),i=c.has(t);return(0,d.jsxs)(r.Fragment,{children:[(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:aw.caretCell,children:(0,d.jsx)("button",{type:"button",style:aw.caretButton,onClick:()=>m(t),"aria-expanded":i,"aria-label":`${i?"Collapse":"Expand"} row ${t}`,children:(0,d.jsx)("span",{style:aw.caret,children:i?"▼":"▶"})})}),o(e)]}),i?(0,d.jsx)("tr",{style:aw.expandedRow,children:(0,d.jsx)("td",{style:aw.expandedCell,colSpan:u,children:(0,d.jsx)(a(243119).A,{data:s(e),hideHelp:!0})})}):void 0]},t)})})]})}let aC={container:{display:"flex",flexDirection:"column",gap:12},jobId:{fontFamily:a(699422).Tf.mono,fontSize:12},numeric:{fontVariantNumeric:"tabular-nums"},timestamp:{color:a(632079).Tj.text.secondary,whiteSpace:"nowrap"},errorText:{color:a(632079).Tj.red.text.accentPrimary,fontSize:12,marginTop:4},botMarker:{color:a(632079).Tj.text.secondary},downloadAction:{display:"flex",flexDirection:"column",alignItems:"flex-start",gap:6,minWidth:130},badge:{display:"inline-block",padding:"3px 9px",borderRadius:999,fontSize:11,fontWeight:a(699422).Wy.semibold,whiteSpace:"nowrap",textTransform:"capitalize"},badgeSuccess:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.accentPrimary},badgeError:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary},badgeInProgress:{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.accentPrimary},badgeNeutral:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary}},aD=["Export","Status","Format","Trigger","Actor","Pages","Size","Created","Updated","Download"];function aT(e){var t;let{row:i,environment:n}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:aC.jobId,children:(0,d.jsx)(a(137691).x5,{value:i.exportJobId})})}),(0,d.jsxs)(aS,{children:[(0,d.jsx)("span",{style:"completed"===(t=i.status)?{...aC.badge,...aC.badgeSuccess}:"failed"===t?{...aC.badge,...aC.badgeError}:"running"===t||"zipping"===t?{...aC.badge,...aC.badgeInProgress}:{...aC.badge,...aC.badgeNeutral},children:i.status}),"failed"===i.status&&void 0!==i.errorMessage?(0,d.jsx)("div",{style:aC.errorText,children:void 0!==i.errorType?`${i.errorType}: ${i.errorMessage}`:i.errorMessage}):void 0]}),(0,d.jsx)(aS,{children:i.exportFormat}),(0,d.jsx)(aS,{children:i.triggerSource}),(0,d.jsx)(aS,{children:(0,d.jsx)(aA,{actorType:i.actorType,actorId:i.actorId})}),(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:aC.numeric,children:i.pagesExported.toLocaleStr
100ing()})}),(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:aC.numeric,children:function(e){if(void 0===e)return"—";if(e<1024)return`${e} B`;let t=["KB","MB","GB","TB"],a=e/1024,i=0;for(;a>=1024&&i<t.length-1;)a/=1024,i+=1;return`${a.toFixed(1)} ${t[i]}`}(i.finalZipFileSizeBytes)})}),(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:aC.timestamp,children:aN(i.createdAt)})}),(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:aC.timestamp,children:aN(i.updatedAt)})}),(0,d.jsx)(aS,{children:(0,d.jsx)(aR,{row:i,environment:n})})]})}function aR(e){let{row:t,environment:i}=e,[n,s]=(0,r.useState)(void 0),[o,l]=(0,r.useState)(!1),[c,p]=(0,r.useState)(void 0),m=(0,r.useCallback)(async()=>{l(!0),p(void 0);try{let e=await i.api.callApi({eventName:"adminRegenerateSpaceExportDownloadUrls",environment:i,data:{spaceId:t.spaceId,exportJobId:t.exportJobId}});"success"===e.type?s(e.data):p("Could not generate fresh links.")}catch(e){(0,a(208318).t)().log({level:"warning",from:"ExportDownloadAction",type:"regenerateExportDownloadUrlsFailed",error:(0,a(952977).convertErrorToLog)(e)}),p("Could not generate fresh links.")}finally{l(!1)}},[i,t.exportJobId,t.spaceId]);return"completed"!==t.status?(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"—"}):"appeals"===t.triggerSource?(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Managed in Appeals"}):"user"!==t.actorType?(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Bot export"}):0===t.exportUrls.length?(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Unavailable"}):void 0!==n?(0,d.jsxs)("div",{style:aC.downloadAction,children:[n.downloadUrls.map((e,t)=>(0,d.jsx)(a(799615).B,{value:e,ariaLabel:`Copy download link ${t+1}`,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorPalette:"blue",colorVariant:"accentPrimary",children:1===n.downloadUrls.length?"Copy link":`Copy link ${t+1}`})},e)),(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:`Expires ${aN(n.expiresAt)}`}),(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Only the original requester can download."})]}):(0,d.jsxs)("div",{style:aC.downloadAction,children:[(0,d.jsx)(a(548436).A,{size:"sm",disabled:o,onClick:m,children:o?"Generating…":"Generate fresh links"}),void 0!==c?(0,d.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:c}):void 0]})}function aA(e){let{actorType:t,actorId:i}=e;return"user"===t?(0,d.jsx)(a(553775).ru,{table:"notion_user",record:{id:i}}):(0,d.jsxs)("span",{style:aC.jobId,children:[(0,d.jsx)(a(137691).x5,{value:i}),(0,d.jsx)("span",{style:aC.botMarker,children:" (bot)"})]})}function aN(e){let t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}let aM={...{adminCreateImporterCrossLinkingConfig:{apiName:"adminCreateImporterCrossLinkingConfig",displayName:"Create Importer Cross-linking Config",emoji:"🔗",description:"Create an admin-managed importer cross-linking configuration for import routing. Never include importer credentials.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Authenticated admin user ID. Must match the current admin actor."},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion workspace ID that owns the importer connection and config"},configJson:{type:"json",defaultValue:JSON.stringify({schemaVersion:1,name:"Engineering and Design",description:"optional",importer:{type:"confluence",site:"https://example.atlassian.net"},destinations:[{source:{type:"confluence",site:"https://example.atlassian.net",spaceKey:"ENG",spaceId:"confluence-space-id"},destination:{type:"teamspace",id:"target-teamspace-or-page-id",spaceId:"target-notion-workspace-id"}}]},null,2),comment:"Configuration JSON. Each source must include the Confluence site and space ID; each destination must include the Notion workspace that owns its target."}},isDestructive:!0,preserveInputValuesOnSuccess:!0},adminGetImporterCrossLinkingConfig:{apiName:"adminGetImporterCrossLinkingConfig",displayName:"Get Importer Cross-linking Config",emoji:"🔗",description:"Fetch the current revision of an importer cross-linking configuration by ID.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Authenticated admin user ID. Must match the current admin actor."},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion workspace ID that owns the importer connection"},configId:{type:"string",placeholder:a(591977).nZ,comment:"Importer cross-linking config ID"}}},adminListImporterCrossLinkingConfigs:{apiName:"adminListImporterCrossLinkingConfigs",displayName:"List Importer Cross-linking Configs",emoji:"🔗",description:"List current importer cross-linking configurations in a connection workspace. Optionally filter by provider and source.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Authenticated admin user ID. Must match the current admin actor."},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion workspace ID that owns the importer connection"},providerType:{type:"string",comment:'Optional provider filter. Currently supported: "confluence".',skipUUIDNormalization:!0},site:{type:"string",comment:"Optional Confluence site URL filter, e.g. https://example.atlassian.net",skipUUIDNormalization:!0}}},adminUpdateImporterCrossLinkingConfig:{apiName:"adminUpdateImporterCrossLinkingConfig",displayName:"Update Importer Cross-linking Config",emoji:"🔗",description:"Create a new immutable revision for an existing importer cross-linking configuration. Uses expectedRevision for optimistic concurrency.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Authenticated admin user ID. Must match the current admin actor."},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion workspace ID that owns the importer connection"},configId:{type:"string",placeholder:a(591977).nZ,comment:"Importer cross-linking config ID"}
100,expectedRevision:{type:"number",numberType:"integer",min:1,comment:"Current revision returned by Get or List"},configJson:{type:"json",defaultValue:"{}",comment:"Full replacement configuration JSON. Provider source IDs are normalized before storage."}},isDestructive:!0,preserveInputValuesOnSuccess:!0}},adminFetchAsanaData:{apiName:"adminFetchAsanaData",displayName:"Fetch Asana Data",emoji:"📋",description:"Fetch data from Asana API using a customer's OAuth credentials for triage/debugging. Requires workspace data access consent.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Notion user ID whose Asana token to use"},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion space ID (for consent enforcement)"},asanaApiPath:{type:"string",comment:"Asana API path, e.g. /users/me, /projects/123, /tasks/456/subtasks",skipUUIDNormalization:!0},queryParams:{type:"string",comment:'Optional JSON query params, e.g. {"opt_fields":"name,notes","limit":"50"}',skipUUIDNormalization:!0}}},adminFetchMondayData:{apiName:"adminFetchMondayData",displayName:"Fetch Monday.com Data",emoji:"📊",description:"Fetch data from the Monday.com GraphQL API using a customer's stored API token for triage/debugging. Requires workspace data access consent.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Notion user ID whose Monday.com token to use"},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion space ID (for consent enforcement and token lookup)"},query:{type:"string",multiline:!0,comment:"Read-only Monday.com GraphQL selection set (wrapped server-side in `query { ... }`), e.g. boards(limit: 100) { id name board_kind state }",skipUUIDNormalization:!0}}},adminFetchConfluenceData:{apiName:"adminFetchConfluenceData",displayName:"Fetch Confluence Data",emoji:"📄",description:"Fetch data from Confluence API using a customer's credentials for triage/debugging. Requires workspace data access consent.",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Notion user ID whose Confluence token to use"},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion space ID (for consent enforcement)"},confluenceApiPath:{type:"string",comment:"Confluence API path, e.g. /rest/api/content/123, /api/v2/pages/456",skipUUIDNormalization:!0},queryParams:{type:"string",comment:'Optional JSON query params, e.g. {"expand":"body.storage","limit":"25"}',skipUUIDNormalization:!0}}},adminFetchImportersS3File:{apiName:"adminFetchImportersS3File",displayName:"Fetch Importers S3 File",emoji:"📦",description:"Fetch import-related S3 files for triage/debugging. Supports system-generated files (temporary bucket: zip-import state, confluence import logs) and customer-uploaded files (secure bucket). Consent required only for customer-uploaded files.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Notion space ID where the import occurred"},s3Path:{type:"string",name:"S3 Path",comment:"S3 path to fetch, e.g. zip-import-{id}/state/parent.json or confluenceImport/operations:{taskId}::batch_0.json",skipUUIDNormalization:!0},bucketType:{type:"options",options:["temporary","secure"],defaultValue:"temporary",required:!0,comment:'"temporary" for system-generated files (zip-import/confluenceImport state/logs), "secure" for customer-uploaded import files (requires consent)'},userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"Notion user ID whose workspace data access consent to verify (required for the secure bucket / customer-uploaded files)",visibleWhen:{field:"bucketType",value:"secure"}},responseType:{type:"string",comment:'Optional: "json" (default) returns parsed JSON content, "signedUrl" returns a pre-signed download URL (use for binary files like zips)',skipUUIDNormalization:!0}}},adminListSpaceExports:{apiName:"adminListSpaceExports",displayName:"Workspace export tracking",emoji:"📦",description:"Look up tracked exports for a 
100workspace. Provide an export job ID, or a user ID to list that user's exports. Only returns data for workspaces where export tracking is enabled.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Workspace the export belongs to."},exportJobId:{type:"string",comment:"Export job ID to look up. Provide this or a user ID."},userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"List this user's exports. Provide this or an export job ID."}},customResponseRenderer:function(e){let{data:t,environment:i}=e,{rows:n,truncated:r}=t;return(0,d.jsxs)("div",{style:aC.container,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Workspace Exports"}),r?(0,d.jsx)(a(553775).i$,{warnings:["Results are partial: the workspace has more exports than the read cap. Filter by export job ID or user to narrow the results."]}):void 0,(0,d.jsx)(aI,{columns:aD,items:n,getItemId:e=>e.exportJobId,getItemJson:e=>e,renderRow:e=>(0,d.jsx)(aT,{row:e,environment:i}),emptyMessage:"No exports were found for this workspace with the selected filters."})]})}}},aP={adminGetDomainManagementSettings:{apiName:"adminGetDomainManagementSettings",displayName:"Get Domain Management Settings",emoji:"❓",description:"Retrieve domain management settings given a space or domain. Input only spaceId or domain.",schema:{spaceId:{type:"string"},domain:{type:"string"}},isDestructive:!1},adminCancelSpaceRequest:{apiName:"adminCancelSpaceRequest",displayName:"Remove pending space request",emoji:"❓",description:"Removes any pending space request, such as a domain claim or space deletion.",schema:{spaceId:{type:"string"}},isDestructive:!1,notinoAction:{actionId:"admin.cancel_space_request"}},adminIsSpaceDomainClaimEligible:{apiName:"adminIsSpaceDomainClaimEligible",displayName:"Check domain claim eligibility",emoji:"❓",description:"Check whether the target space ('Target Space Id') is eligible for domain claim actions by the enterprise space ('Enterprise Space Id').",schema:{enterpriseSpaceId:{type:"string",placeholder:a(591977).nZ},targetSpaceId:{type:"string",placeholder:a(591977).nZ}},isDestructive:!1},adminGetDomainClaimEligibleSpaces:{apiName:"adminGetDomainClaimEligibleSpaces",displayName:"Get all domain claim eligible spaces",emoji:"⚙",description:"Returns all domain claim eligible spaces given an enterprise space and email domain. The enterprise space must have these domains verified. By default returns up to 1000 spaces. You can specify a different limit.",schema:{spaceId:{type:"string"},emailDomains:{type:"string",comment:"Comma separated list of email domains verified by the enterprise workspace.",placeholder:a(591977).hT},limit:{type:"number",comment:"Optional. By default returns up to 1000 spaces."}},isDestructive:!1},adminGetClaimableWorkspacesInOrganization:{apiName:"adminGetClaimableWorkspacesInOrganization",displayName:"Get claimable workspaces in organization",emoji:"🏢",description:"Returns all workspaces claimable by a given organization, based on the organization's verified email domains.",schema:{organizationId:{type:"string",placeholder:a(591977).nZ},query:{type:"string",comment:"Optional. Filter results to workspaces whose name matches this query."},excludePendingRequests:{type:"boolean",comment:"Optional. When true, only returns workspaces with no pending domain claim requests."}},isDestructive:!1},adminClaimAndUpgradeForSalesAssisted:{apiName:"adminClaimAndUpgradeForSalesAssisted",displayName:"**Sales Assisted Customer Only** Claim and upgrade workspaces",emoji:"⬇",description:(0,d.jsxs)(d.Fragment,{children:["On the target workspace, downgrade existing workspace owners and add requesting Enterprise WO as new workspace owner. Upgrade the target workspace to enterprise_free plan.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"🆕"," ",(0,d.jsx)(a(590422).Q,{underline:!0,inline:!0,external:!0,href:"https://app.hex.tech/notion/app/a2875158-dfa1-4361-b801-92be4c078c51/latest",children:"View who already processed a domain claim request here"})]}),schema:{targetSpaceId:{type:"string",comment:"Space id of the workspace that should be claimed. Note, paid workspaces can only be claimed by the Finance team.",placeholder:a(591977).nZ},enterpriseSpaceId:{type:"string",comment:"Space id of the workspace that requested the claim",placeholder:a(591977).nZ}},isDestructive:!1},adminRequestOrganizationClaimForDomainMismatch:{apiName:"adminRequestOrganizationClaimForDomainMismatch",displayName:"Request organization claim (domain mismatch)",emoji:"🔧",description:"Kick off a domain claim request for a workspace whose creator's email domain does not match the organization's verified domains. Allowed when the original creator is no longer a workspace owner and a current workspace owner is on one of the organization's verified domains. This puts the workspace in a 'requested' state for Finance to process via the normal claim and upgrade tool.",schema:{organizationId:{type:"string",comment:"The organization requesting the claim.",placeholder:a(591977).nZ},targetSpaceId:{type:"string",comment:"The workspace to be claimed.",placeholder:a(591977).nZ},requestingUserId:{type:"string",comment:"The org owner initiating the claim (used as the requestor on the space request record).",placeholder:a(591977).nZ}},isDestructive:!1},adminDelayClaimSpaceDeletion:{apiName:"adminDelayClaimSpaceDeletion",displayName:"Delay permanent deleti
100on of deleted claimable space",emoji:"⏰",description:"For a workspace that was deleted using domain management, delay permanent deletion by 30 days from the time the delay is requested. The workspace will remain in a deleted state, and the workspace owners of the Enterprise space that initiated this deletion will be notified.",schema:{spaceId:{type:"string",comment:"Space id of the workspace that is pending permanent deletion."}},isDestructive:!0}},aV={stepRow:{marginBottom:4},statusIndicator:{fontWeight:a(699422).Wy.bold,marginInlineEnd:4},duration:{color:a(632079).Tj.text.secondary,marginInlineStart:8},eventList:{marginTop:4,marginBottom:4,paddingInlineStart:16},eventItem:{fontSize:12,color:a(632079).Tj.text.secondary},expandButton:{background:"transparent",border:"none",cursor:"pointer",color:a(632079).Tj.blue.text.primary,fontSize:12,padding:0,marginInlineStart:8}};function aE({node:e,stepKey:t,depth:i}){let[n,s]=r.useState(!1),o=r.useCallback(()=>{s(e=>!e)},[]),l=function(e){let t=e[e.length-1];if(!t)return"";switch(t.event){case"fulfilled":return"✓";case"failed":return"✗";case"suspended":return"⏸";default:return"◌"}}(e.events),c=function(e){let t=e[e.length-1];if(!t)return a(632079).Tj.text.secondary;switch(t.event){case"fulfilled":return a(632079).Tj.green.text.primary;case"failed":return a(632079).Tj.red.text.primary;case"suspended":default:return a(632079).Tj.text.secondary;case"started":return a(632079).Tj.blue.text.primary}}(e.events),p=function(e){if(e.length<2)return"";let t=new Date(e[0].eventDate).getTime(),a=new Date(e[e.length-1].eventDate).getTime()-t;return a<1e3?`${a}ms`:a<6e4?`${(a/1e3).toFixed(1)}s`:a<36e5?`${(a/6e4).toFixed(1)}m`:`${(a/36e5).toFixed(1)}h`}(e.events);return(0,d.jsxs)("div",{style:{paddingInlineStart:16*i},children:[(0,d.jsxs)("div",{style:aV.stepRow,children:[(0,d.jsx)("span",{style:{...aV.statusIndicator,color:c},children:l}),(0,d.jsx)("strong",{children:t}),p?(0,d.jsx)("span",{style:aV.duration,children:p}):void 0,e.events.length>0?(0,d.jsx)("button",{type:"button",style:aV.expandButton,onClick:o,children:n?"hide events":`${e.events.length} events`}):void 0]}),n?(0,d.jsx)("div",{style:aV.eventList,children:e.events.map((e,t)=>(0,d.jsxs)("div",{style:aV.eventItem,children:[new Date(e.eventDate).toLocaleString()," - ",e.event,void 0!==e.payload?` payload: ${e.payload}`:"",void 0!==e.checkpoint?` checkpoint: ${e.checkpoint}`:""]},t))}):void 0,e.children.map(e=>(0,d.jsx)(aE,{node:e.node,stepKey:e.key,depth:i+1},e.key))]})}let aB={metadataCard:{marginBottom:16,padding:12,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:4},sectionHeader:{marginBottom:8,marginTop:16},rawJson:{marginTop:24}},aL={table:{borderCollapse:"collapse",width:"100%",fontSize:11,fontFamily:"monospace"},th:{textAlign:"start",padding:"4px 8px",borderBottom:`2px solid ${a(632079).Tj.border.primary}`,whiteSpace:"nowrap",fontWeight:a(699422).Wy.bold},tdBase:{padding:"3px 8px",whiteSpace:"nowrap"},enabledBadge:{color:a(632079).Tj.green.text.primary},disabledBadge:{color:a(632079).Tj.text.secondary},pctComplete:{fontWeight:a(699422).Wy.bold,color:a(632079).Tj.green.text.primary},pctIncomplete:{fontWeight:a(699422).Wy.bold,color:a(632079).Tj.orange.text.primary}},a_="#f5f5f5",aU="#ffffff";function aW({ekmRowStats:e,totalRowCounts:t}){let i=function(e,t){let a=new Map;for(let t of e){let e=a.get(t.table);e||(e={table:t.table,ekm_enabled:t.ekm_enabled,countByVersion:{},totalEncrypted:0},a.set(t.table,e)),e.countByVersion[t.ekm_format_version]=(e.countByVersion[t.ekm_format_version]??0)+t.count,e.totalEncrypted+=t.count}if(t)for(let{table:e,count:i}of t){let t=a.get(e);t||(t={table:e,ekm_enabled:!0,countByVersion:{},totalEncrypted:0},a.set(e,t)),t.totalRows=i}return Array.from(a.values()).filter(e=>e.totalEncrypted>0||void 0!==e.totalRows&&e.totalRows>0).sort((e,t)=>e.table.localeCompare(t.table))}(e,t),n=[...new Set(e.map(e=>e.ekm_format_version))].sort((e,t)=>e-t),r=void 0!==t;return 0===i.length?(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:"No encrypted rows found."}):(0,d.jsxs)("table",{style:aL.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:aL.th,children:"Table"}),(0,d.jsx)("th",{style:aL.th,children:"EKM Enabled"}),n.map(e=>(0,d.jsxs)("th",{style:aL.th,children:["v",e]},e)),(0,d.jsx)("th",{style:aL.th,children:"Total Encrypted"}),r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("th",{style:aL.th,children:"Total Rows"}),(0,d.jsx)("th",{style:aL.th,children:"Unencrypted"}),(0,d.jsx)("th",{style:aL.th,children:"% Encrypted"})]}):void 0]})}),(0,d.jsx)("tbody",{children:i.map((e,t)=>{let a={...aL.tdBase,backgroundColor:t%2==0?aU:a_},i=r&&void 0!==e.totalRows&&e.totalRows>0?e.totalEncrypted/e.totalRows*100:void 0;return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a,children:e.table}),(0,d.jsx)("td",{style:a,children:(0,d.jsx)("span",{style:e.ekm_enabled?aL.enabledBadge:aL.disabledBadge,children:e.ekm_enabled?"Yes":"No"})}),n.map(t=>(0,d.jsx)("td",{style:a,children:(e.countByVersion[t]??0).toLocaleStr
100ing()},t)),(0,d.jsx)("td",{style:a,children:e.totalEncrypted.toLocaleString()}),r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("td",{style:a,children:void 0!==e.totalRows?e.totalRows.toLocaleString():"-"}),(0,d.jsx)("td",{style:a,children:void 0!==e.totalRows?(e.totalRows-e.totalEncrypted).toLocaleString():"-"}),(0,d.jsx)("td",{style:a,children:void 0!==i?(0,d.jsxs)("span",{style:i>=100?aL.pctComplete:aL.pctIncomplete,children:[i.toFixed(1),"%"]}):"-"})]}):void 0]},e.table)})})]})}function aF({stats:e}){return 0===e.length?null:(0,d.jsxs)("table",{style:{...aL.table,marginTop:6},children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:aL.th,children:"Table"}),(0,d.jsx)("th",{style:aL.th,children:"Format Version"}),(0,d.jsx)("th",{style:aL.th,children:"Encrypted Rows"}),(0,d.jsx)("th",{style:aL.th,children:"EKM Enabled"})]})}),(0,d.jsx)("tbody",{children:e.slice().sort((e,t)=>e.table!==t.table?e.table.localeCompare(t.table):e.ekm_format_version-t.ekm_format_version).map((e,t)=>{let a={...aL.tdBase,backgroundColor:t%2==0?aU:a_};return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:a,children:e.table}),(0,d.jsxs)("td",{style:a,children:["v",e.ekm_format_version]}),(0,d.jsx)("td",{style:a,children:e.count.toLocaleString()}),(0,d.jsx)("td",{style:a,children:(0,d.jsx)("span",{style:e.ekm_enabled?aL.enabledBadge:aL.disabledBadge,children:e.ekm_enabled?"Yes":"No"})})]},`${e.table}-${e.ekm_format_version}`)})})]})}let aK={revokedCard:{marginBottom:16,padding:12,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary},activeCard:{marginBottom:16,padding:12,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4},revokedText:{color:a(632079).Tj.red.text.primary},activeText:{color:a(632079).Tj.green.text.primary},statsLabel:{marginTop:8}};function a$({key_:e,index:t,isRevoked:i,keyPrefix:n,statsByKeyId:r,showStats:s}){let o=r[e.id];return(0,d.jsxs)("div",{style:i?aK.revokedCard:aK.activeCard,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:(0,d.jsxs)("strong",{children:[n," #",t+1]})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["ID: ",(0,d.jsx)(a(137691).x5,{value:e.id})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Customer KMS ARN: ",(0,d.jsx)("code",{children:e.customer_kms_arn})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Created: ",new Date(e.created_at).toLocaleString()]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Status:"," ",i?(0,d.jsxs)("span",{style:aK.revokedText,children:["Marked as revoked on: ",new Date(e.revoked_at).toLocaleString()]}):(0,d.jsx)("span",{style:aK.activeText,children:"Active"})]}),s&&o&&o.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aK.statsLabel,children:(0,d.jsx)("strong",{children:"Encrypted Rows:"})}),(0,d.jsx)(aF,{stats:o})]}):void 0]})}let aO={root:{marginBottom:16},sectionHeader:{marginBottom:8},sectionHeaderWithTopMargin:{marginBottom:8,marginTop:16},currentlyActiveKeyCard:{marginBottom:16,padding:12,border:`2px solid ${a(632079).Tj.green.border.accentPrimary}`,borderRadius:4,backgroundColor:a(632079).Tj.green.background.primary},currentlyActiveKeyLabel:{color:a(632079).Tj.green.text.primary},statsBox:{marginTop:16,marginBottom:16,padding:12,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4},statsSection:{marginTop:24},tableWrapper:{marginTop:8,overflowX:"auto"},gateEnabled:{color:a(632079).Tj.green.text.primary,fontWeight:a(699422).Wy.bold},gateDisabled:{color:a(632079).Tj.red.text.primary,fontWeight:a(699422).Wy.bold},gateLink:{color:a(632079).Tj.blue.text.primary,textDecoration:"underline"}},az={container:{marginBottom:16},workspaceCard:{marginBottom:20,padding:16,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary},workspaceName:{fontSize:16,fontWeight:a(699422).Wy.semibold,marginBottom:8},section:{marginTop:12,marginBottom:12},infoRow:{marginTop:4},primaryWEKBox:{marginTop:8,padding:12,border:`1px solid ${a(632079).Tj.green.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.green.background.primary},summary:{marginBottom:20,padding:16,border:`2px solid ${a(632079).Tj.blue.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.blue.background.primary},jsonSection:{marginTop:24},gateEnabled:{color:a(632079).Tj.green.text.accentPrimary},gateDisabled:{color:a(632079).Tj.red.text.accentPrimary},activeValue:{color:a(632079).Tj.green.text.accentPrimary},revokedValue:{color:a(632079).Tj.red.text.accentPrimary}},aG={bulkActions:{marginBottom:16,padding:12,border:`1px solid ${a(632079).Tj.blue.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.blue.background.primary},bulkHeading:{fontSize:13,fontWeight:a(699422).Wy.semibold,marginBottom:8},requestCard:{marginBottom:16,padding:16,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary},cardHeader:{fontSize:14,fontWeight:a(699422).Wy.semibold,marginBottom:8},infoRow:{marginTop:4,fontSize:13},statusBadge:{display:"inline-block",padding:"2px 8px",borderRadius:3,fontSize:12,fontWeight:a(699422).Wy.semibold},statusRequested:{color:a(632079).Tj.blue.text.accentPrimary,backgroundColor:a(632079).Tj.blue.background.primary},statusPending:{color:a(632079).Tj.yellow.text.accentPrimary,backgroundColor:a(632079).Tj.yellow.background.primary},statusCancelled:{color:a(632079).Tj.gray.text.accentPrimary,backgroundColor:a(632079).Tj.gray.background.primary},statusCompleted:{color:a(632079).Tj.green.text.accentPrimary,backgroundColor:a(632079).Tj.green.background.primary},statusError:{color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.primary},copyAllButton:{display:"inline-block",cursor:"pointer",padding:"6px 12px",border:`1px solid ${a(632079).Tj.blue.border.primary}`,borderRadius:3,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,fontSize:13,fontWeight:a(699422).Wy.semibold},sectionHeading:{fontSize:14,fontWeight:a(699422).Wy.semibold,marginBottom:8},jsonSection:{marginTop:24}}
100,aq={fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:"0.9em",backgroundColor:a(632079).Tj.background.tertiary,borderRadius:3,padding:"0.2em 0.4em"},aH=(0,d.jsxs)(d.Fragment,{children:["Re-encrypts all workspace encryption keys (WEKs) that are not already wrapped with the destination CMK ARN.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),aZ=(0,d.jsxs)(d.Fragment,{children:["Marks a workspace encryption key (WEK) as revoked. Before revoking, verifies that no rows across all EKM-supported tables are still encrypted with this WEK. Revocation will fail if any such rows exist.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),aJ=(0,d.jsxs)(d.Fragment,{children:["Re-encrypts all rows in the workspace that are not already using the target WEK. Use this to repair rows that are out of sync after a key rotation.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),aQ=(0,d.jsxs)(d.Fragment,{children:["Creates a new workspace encryption key (WEK) using the latest CMK ARN from the organization's CMK rotation request, then re-encrypts all Postgres data using that key.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),aY=(0,d.jsxs)(d.Fragment,{children:["Enables Enterprise Key Management (EKM) for a workspace by encrypting all existing Postgres rows using the workspace's existing primary WEK. The WEK must already exist — use Generate WEK first if needed.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Strategy:"})," Uses a WHERE clause to find rows where ",(0,d.jsx)("code",{style:aq,children:"ekm_workspace_encryption_key_id IS DISTINCT FROM"})," the primary WEK. Processes rows serially in a single workflow. Best for small workspaces. For large workspaces, use ",(0,d.jsx)("em",{children:"Onboard Workspace (Parallel Scan)"})," instead.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),aX=(0,d.jsxs)(d.Fragment,{children:["Enables EKM for a workspace by scanning all rows in each EKM-enabled table and encrypting them. Automatically creates a WEK if none exists. Supports parallel execution for large workspaces.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("strong",{children:"Strategy:"})," Full table scan using ",(0,d.jsx)("code",{style:aq,children:"SELECT * FROM table WHERE space_id = $1 AND id >= $start AND id <= $end"}),". The UUID space is split into N non-overlapping ranges, each processed by an independent workflow with checkpointing every 10k rows.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow (with checkpointing — resumable after crashes)",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),a0=(0,d.jsxs)(d.Fragment,{children:["Counts total rows across all EKM-enabled tables using a durable workflow. Paginates through rows with cursor-based batching to avoid query timeouts on large workspaces. Batch size is controlled by the ekmOnboardingChunkSize server setting. Optionally counts encrypted rows per WEK using the EKM partial index. Results are posted to Slack.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),a1={adminListAllEKMWorkspaces:{apiName:"adminListAllEKMWorkspaces",displayName:"List All EKM-Enabled Workspaces",description:"List all workspaces that have Enterprise Key Management (EKM) enabled, showing primary WEK details and ke
100y counts.",emoji:"📋",schema:{organizationId:{type:"string",isRequired:!1,name:"Organization",comment:"Filter results to workspaces belonging to this organization. Leave empty to list all EKM workspaces.",table:s().y75}},customResponseRenderer:function(e){let{data:t}=e;if("error"in t)return(0,d.jsx)("div",{children:(0,d.jsx)(a(553775).i$,{warnings:[t.error]})});let{workspaces:i,totalWorkspaceCount:n}=t;return(0,d.jsxs)("div",{children:[(0,d.jsx)(a(45062).A,{title:"All EKM-Enabled Workspaces"}),(0,d.jsxs)("div",{style:az.summary,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:(0,d.jsx)("strong",{children:"📊 Summary"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Total Workspaces with EKM Enabled:"," ",(0,d.jsx)("strong",{children:n})]})]}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.container,children:(0,d.jsx)("strong",{children:"Workspace Details"})}),i.map((e,t)=>(0,d.jsxs)("div",{style:az.workspaceCard,children:[(0,d.jsxs)("div",{style:az.workspaceName,children:[e.spaceName||"Untitled Workspace"," #",t+1]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Workspace ID: ",(0,d.jsx)(a(137691).x5,{value:e.spaceId})]}),(0,d.jsx)("div",{style:az.section,children:(0,d.jsxs)("div",{style:az.primaryWEKBox,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:(0,d.jsx)("strong",{children:"🔑 Primary Workspace Encryption Key"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["ID: ",(0,d.jsx)(a(137691).x5,{value:e.primaryWEK.id})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Customer KMS ARN:"," ",(0,d.jsx)("code",{children:e.primaryWEK.customerKmsArn})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Created:"," ",new Date(e.primaryWEK.createdAt).toLocaleString()]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Updated:"," ",new Date(e.primaryWEK.updatedAt).toLocaleString()]})]})}),(0,d.jsxs)("div",{style:az.section,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:(0,d.jsx)("strong",{children:"🚦 Statsig Gates"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["ekm_for_space:"," ",(0,d.jsx)("span",{style:e.gateEkmForSpace?az.gateEnabled:az.gateDisabled,children:e.gateEkmForSpace?"enabled":"disabled"})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["ekm_request_org_console:"," ",(0,d.jsx)("span",{style:e.gateEkmRequestOrgConsole?az.gateEnabled:az.gateDisabled,children:e.gateEkmRequestOrgConsole?"enabled":"disabled"})]})]}),(0,d.jsxs)("div",{style:az.section,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:(0,d.jsx)("strong",{children:"📈 Key Statistics"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Total Keys: ",e.activeWEKCount+e.revokedWEKCount]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Active Keys:"," ",(0,d.jsx)("span",{style:az.activeValue,children:e.activeWEKCount})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:az.infoRow,children:["Revoked Keys:"," ",(0,d.jsx)("span",{style:e.revokedWEKCount>0?az.revokedValue:void 0,children:e.revokedWEKCount})]})]})]},e.spaceId)),0===i.length?(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:"No workspaces with EKM enabled found."}):void 0,(0,d.jsx)("div",{style:az.jsonSection,children:(0,d.jsx)(a(243119).A,{data:t})})]})}}
100,adminEKMStatusForWorkspace:{apiName:"adminEKMStatusForWorkspace",displayName:"View EKM Status for Workspace",description:"View Enterprise Key Management (EKM) status including encrypted row statistics and workspace encryption key details.",emoji:"🔍",schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space",showByDefaultInSingleRecordMode:!0},includeTotalRowCounts:{type:"boolean",defaultValue:!1,name:"Include Total Row Counts",comment:"Also count all rows per table (not just encrypted). Enables Total / Unencrypted / % Encrypted columns. This runs additional COUNT(*) queries and may be slower for large workspaces."}},customResponseRenderer:function(e){let{data:t}=e;if("error"in t)return(0,d.jsx)("div",{children:(0,d.jsx)(a(553775).i$,{warnings:[t.error]})});let{ekmRowStats:i,workspaceKeys:n,statsigGates:r,totalRowCounts:s}=t,o=i.reduce((e,t)=>(e[t.ekm_workspace_encryption_key_id]||(e[t.ekm_workspace_encryption_key_id]=[]),e[t.ekm_workspace_encryption_key_id].push(t),e),{}),l=n.filter(e=>void 0===e.revoked_at),c=n.filter(e=>void 0!==e.revoked_at),p=l.length>0?l.reduce((e,t)=>new Date(t.created_at)>new Date(e.created_at)?t:e):null;return(0,d.jsxs)("div",{children:[(0,d.jsx)(a(45062).A,{title:"EKM Status"}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aO.root,children:(0,d.jsx)("strong",{children:"EKM Status Overview"})}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aO.sectionHeader,children:(0,d.jsx)("strong",{children:"Statsig Gate Status"})}),r.map(e=>(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:[(0,d.jsx)("a",{href:`https://console.statsig.com/6TSma7coh47E7CjMbuSVCO/gates/${e.gateName}`,target:"_blank",rel:"noopener noreferrer",style:aO.gateLink,children:e.gateName}),":"," ",(0,d.jsx)("span",{style:e.enabled?aO.gateEnabled:aO.gateDisabled,children:e.enabled?"Enabled":"Disabled"})]},e.gateName)),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aO.sectionHeaderWithTopMargin,children:(0,d.jsxs)("strong",{children:["Active Workspace Encryption Keys (",l.length,")"]})}),p?(0,d.jsxs)("div",{style:aO.currentlyActiveKeyCard,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:(0,d.jsx)("strong",{style:aO.currentlyActiveKeyLabel,children:"🔑 Currently Active Key"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["ID: ",(0,d.jsx)(a(137691).x5,{value:p.id})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Customer KMS ARN: ",(0,d.jsx)("code",{children:p.customer_kms_arn})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Created: ",new Date(p.created_at).toLocaleString()]}),o[p.id]?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:{marginTop:8},children:(0,d.jsx)("strong",{children:"Encrypted Rows:"})}),(0,d.jsx)(aF,{stats:o[p.id]})]}):void 0]}):void 0,l.map((e,t)=>(0,d.jsx)(a$,{key_:e,index:t,isRevoked:!1,keyPrefix:"Key",statsByKeyId:o,showStats:!0},e.id)),c.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aO.sectionHeaderWithTopMargin,children:(0,d.jsxs)("strong",{children:["Revoked Workspace Encryption Keys (",c.length,")"]})}),c.map((e,t)=>(0,d.jsx)(a$,{key_:e,index:t,isRevoked:!0,keyPrefix:"Revoked Key",statsByKeyId:o,showStats:!0},e.id))]}):void 0,(0,d.jsxs)("div",{style:aO.statsBox,children:[(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aO.sectionHeader,children:(0,d.jsx)("strong",{children:"Summary Statistics"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Total Workspace Keys: ",n.length]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Active Keys: ",l.length]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Revoked Keys: ",c.length]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Total Encrypted Rows:"," ",i.reduce((e,t)=>e+t.count,0).toLocaleString()]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Tables with Encrypted Data:"," ",new Set(i.map(e=>e.table)).size]}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aO.sectionHeaderWithTopMargin,children:(0,d.jsx)("strong",{children:"Encrypted Rows by Table:"})}),(0,d.jsx)("div",{style:aO.tableWrapper,children:(0,d.jsx)(aW,{ekmRowStats:i,totalRowCounts:s})})]}),(0,d.jsx)("div",{style:aO.statsSection,children:(0,d.jsx)(a(243119).A,{data:t})})]})}},adminEKMDurableWorkflowStatus:{apiName:"adminEKMDurableWorkflowStatus",displayName:"View Durable Workflow Execution Status",description:"View the status of a durable workflow execution, including step tree and event details.",emoji:"⚙️",schema:{executionPointer:{type:"string",isRequired:!0,name:"Execution Pointer",comment:"Durable workflow execution pointer (e.g. cell:prod-main-usw2-0001/...)",skipUUIDNormalization:!0}},customResponseRenderer:function(e){let{data:t}=e;if("error"in t)return(0,d.jsx)("div",{children:(0,d.jsx)(a(553775).i$,{warnings:[t.error]})});let{execution:i,stepTree:n,totalEvents:r}=t;return(0,d.jsxs)("div",{children:[(0,d.jsx)(a(45062).A,{title:"Durable Workflow Status"}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aB.sectionHeader,children:(0,d.jsx)("strong",{children:"Execution Metadata"})}),(0,d.jsxs)("div",{style:aB.metadataCard,children:[(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Workflow: ",(0,d.jsx)("strong",{children:i.workflow})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Status: ",(0,d.jsx)("strong",{children:i.status})]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Execution ID: ",(0,d.jsx)("code",{children:i.execution_id})]}),i.worker_id?(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Worker ID: ",(0,d.jsx)("code",{children:i.worker_id})]}):void 0,(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Wake C
100ount: ",i.wake_count]}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Created: ",new Date(i.created_at).toLocaleString()]}),i.scope?(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Scope: ",(0,d.jsx)("code",{children:i.scope})]}):void 0,void 0!==i.params?(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Params: ",(0,d.jsx)("code",{children:i.params})]}):void 0]}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aB.sectionHeader,children:(0,d.jsx)("strong",{children:"Step Tree"})}),(0,d.jsx)(aE,{node:n,stepKey:"(root)",depth:0}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:aB.sectionHeader,children:(0,d.jsx)("strong",{children:"Summary"})}),(0,d.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Total Events: ",r]}),(0,d.jsx)("div",{style:aB.rawJson,children:(0,d.jsx)(a(243119).A,{data:t})})]})}},adminEKMReencryptWEKs:{apiName:"adminEKMReencryptWEKs",displayName:"Re-Encrypt All WEKs with New CMK",description:aH,emoji:"🔄",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space"},destinationCMKARN:{type:"string",isRequired:!1,name:"Destination CMK",comment:"Customer Managed Key KMS ARN",placeholder:"arn:aws:kms:region:account:key/key-id",toggleOptions:{defaultLabel:"Use Latest Organization Request (default)",manualLabel:"Manually Configure"}}}},adminEKMOffboarding:{apiName:"adminEKMOffboarding",displayName:"Offboard Workspace from EKM",description:"Offboard a workspace from EKM. Decrypts all EKM-encrypted rows and saves them as plaintext.",emoji:"🔓",isDestructive:!0,schema:{spaceId:{type:"string",table:"space"}}},adminEKMOffboardingV2ByEKMIndex:{apiName:"adminEKMOffboardingV2ByEKMIndex",displayName:"Offboard Workspace from EKM V2 (by EKM index)",description:"Decrypts EKM-encrypted rows by iterating (format version desc) × (WEK desc) using the ekm_format_version/wek_id/id index. Uses adaptive batch sizes (1000 → 10) that stick once reduced. Does NOT revoke WEKs. The ekm_for_space gate should be disabled for the workspace before running; this tool warns but does not fail if it is still enabled.",emoji:"🔓",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target workspace ID",table:"space"},includeAllWEKs:{type:"boolean",comment:"Also iterate revoked WEKs. Leave unchecked to iterate only all active (not revoked) WEKs.",defaultValue:!1}}},adminEKMCreateWEK:{apiName:"adminEKMCreateWEK",displayName:"Create WEK",description:"Creates a new workspace encryption key (WEK) using the latest CMK ARN from the organization's CMK rotation request, or a manually specified CMK ARN.",emoji:"🔑",isDestructive:!1,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space"},manualSpecifiedKeyArn:{type:"string",isRequired:!1,name:"CMK",comment:"Customer Managed Key KMS ARN",placeholder:"arn:aws:kms:region:account:key/key-id",toggleOptions:{defaultLabel:"Use Latest Organization Request (default)",manualLabel:"Manually Configure"}}}},adminEKMRevokeWEK:{apiName:"adminEKMRevokeWEK",displayName:"Revoke WEK",description:aZ,emoji:"🗑",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space"},wekId:{type:"string",isRequired:!0,name:"WEK",comment:"Target Workspace Encryption Key ID",table:s().ef6,placeholder:a(591977).nZ}}},adminEKMReencryptPostgresData:{apiName:"adminEKMReencryptPostgresData",displayName:"Re-Encrypt All Postgres Data",description:aJ,emoji:"🔄",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space",showByDefaultInSingleRecordMode:!1},desiredWEKId:{type:"string",isRequired:!0,name:"Target WEK",comment:"Target Workspace Encryption Key to re-encrypt rows with. Rows not already using this key will be re-encrypted.",placeholder:a(591977).nZ,table:s().ef6,showByDefaultInSingleRecordMode:!1}}},adminEKMCreateWEKAndReencrypt:{apiName:"adminEKMCreateWEKAndReencrypt",displayName:"Create WEK & Re-Encrypt All Postgres Data",description:aQ,emoji:"🔄",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space",showByDefaultInSingleRecordMode:!1}}},adminEKMOnboarding:{apiName:"adminEKMOnboarding",displayName:"Onboard Workspace",description:aY,emoji:"🚀",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space",showByDefaultInSingleRecordMode:!1}}},adminEKMOnboardingViaScan:{apiName:"adminEKMOnboardingViaScan",displayName:"Onboard Workspace (Parallel Scan)",description:aX,emoji:"🚀",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space",showByDefaultInSingleRecordMode:!1},parallelism:{type:"number",isRequired:!1,numberType:"integer",defaultValue:1,min:1,max:64,comment:"Number of parallel workflow executions (1–64). Higher values speed up large workspaces."}}},adminEKMDynamoOnboarding:{apiName:"adminEKMDynamoOnboarding",displayName:"Onboard Workspaces for DynamoDB",description:"Starts the DynamoDB EKM onboarding DW2 workflow in the main cell. This only migrates existing items; configure the new-write EKM state before running it. Available in development and staging.",emoji:"🚀",isDestructive:!0,availableEnvironments:["development","staging"],schema:{spaceIds:{type:"stringArray",name:"Workspaces",comment:"Workspace IDs, with or without dashes.",placeholder:a(591977).nZ,maxItems:100,table:"space"},dataLakeReadyAfterMs:{type:"number",isRequired:!1,numberType:"integer",min:0,max:864e5,comment:"Optional delay before triggering the data-lake export. Leave empty to start immediately."}}},adminEKMDynamoOffboarding:{apiName:"adminEKMDynamoOffboarding",displayName:"Offboard Workspaces for DynamoDB",description:"Starts the DynamoDB EKM offboarding DW2 workflow in the main cell. This only migrates existing items; configure the new-write EKM state before running it. Available in development and staging.",emoji:"🔓",isDestructive:!0,availableEnvironments:["development","staging"],schema:{spaceIds:{type:"stringArray",name:"Workspaces",comment:"Workspace IDs, with or without dashes.",placeholder:a(591977).nZ,maxItems:100,table:"space"},dataLakeReadyAfterMs:{type:"number",isRequired:!1,numberType:"integer",min:0,max:864e5,comment:"Optional delay before triggering the data-lake export. Leave empty to start immediately."}}},adminEKMDynamoWEKRotation:{apiName:"adminEKMDynamoWEKRotation",displayName:"Rotate WEKs for DynamoDB",description:"Starts the DynamoDB EKM WEK rotation DW2 workflow in the main cell. This only migrates existing items; configure the new-write EKM state before running it. Available in development and staging.",emoji:"🔄",isDestructive:!0,availableEnvironments:["development","staging"],schema:{targetWekIds:{type:"stringArray",name:"Target WEKs",comment:"Target WEK IDs, with or without dashes. Each WEK determines its workspace.",placeholder:a(591977).nZ,maxItems:100,table:s().ef6},dataLakeReadyAfterMs:{type:"number",isRequired:!1,numberType:"integer",min:0,max:864e5,comment:"Optional delay before triggering the data-lake export. Leave empty to start immediately."}}},adminListCmkRotationRequests:{apiName:"adminListCmkRotationRequests",displayName:"List CMK Rotation Requests for Organization",description:"Lists CMK rotation (org console) requests for an organization, the same data the org owner sees in the org console plus copyable root + latest request IDs. Use the bulk-copy buttons to grab a comma-separated ID list to feed into Update CMK Rotation Request Status.",emoji:"📋",schema:{organizationId:{type:"string",isRequired:!0,name:"Organization",comment:"Target Organization ID",table:s().y75},limit:{type:"number",isRequired:!1,numberType:"integer",defaultValue:50,min:1,max:500,comment:"Maximum number of root requests to return."}},customResponseRenderer:function(e){let{data:t}=e;if("error"in t)return(0,d.jsx)("div",{children:(0,d.jsx)(a(553775).i$,{warnings:[t.error]})});let{rows:i}=t,n=i.map(e=>e.rootRequestId).join(","),r=i.reduce((e,t)=>
100{let a=e[t.status]??[];return a.push(t.rootRequestId),e[t.status]=a,e},{});return(0,d.jsxs)("div",{children:[(0,d.jsx)(a(45062).A,{title:"CMK Rotation Requests"}),(0,d.jsxs)("div",{style:aG.bulkActions,children:[(0,d.jsxs)("div",{style:aG.bulkHeading,children:["📋 ",i.length," CMK rotation request(s)"]}),i.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:aG.infoRow,children:(0,d.jsx)(a(799615).B,{value:n,children:(0,d.jsxs)("span",{style:aG.copyAllButton,children:["📑 Copy all ",i.length," root request IDs (comma-separated)"]})})}),Object.keys(r).map(e=>{let t=r[e]??[];return(0,d.jsx)("div",{style:aG.infoRow,children:(0,d.jsx)(a(799615).B,{value:t.join(","),children:(0,d.jsxs)("span",{style:aG.copyAllButton,children:["📑 Copy ",t.length," ",(0,d.jsx)("strong",{children:e})," root request ID",1===t.length?"":"s"]})})},e)})]}):void 0]}),(0,d.jsx)("div",{style:aG.sectionHeading,children:"Requests"}),i.map(e=>(0,d.jsxs)("div",{style:aG.requestCard,children:[(0,d.jsx)("div",{style:aG.cardHeader,children:(0,d.jsx)("span",{style:function(e){switch(e){case"requested":return{...aG.statusBadge,...aG.statusRequested};case"pending":return{...aG.statusBadge,...aG.statusPending};case"cancelled":return{...aG.statusBadge,...aG.statusCancelled};case"completed":return{...aG.statusBadge,...aG.statusCompleted};case"error":return{...aG.statusBadge,...aG.statusError};default:return(0,ed().HB)(e)}}(e.status),children:e.status})}),(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Root Request ID:"})," ",(0,d.jsx)(a(799615).B,{value:e.rootRequestId,formatUuid:!0,children:(0,d.jsx)(a(137691).x5,{value:e.rootRequestId})})]}),(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Latest Request ID:"})," ",(0,d.jsx)(a(799615).B,{value:e.latestRequestId,formatUuid:!0,children:(0,d.jsx)(a(137691).x5,{value:e.latestRequestId})})]}),void 0!==e.spaceId?(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Workspace ID:"})," ",(0,d.jsx)(a(799615).B,{value:e.spaceId,formatUuid:!0,children:(0,d.jsx)(a(137691).x5,{value:e.spaceId})})]}):void 0,(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Requested By:"})," ",(0,d.jsx)(a(137691).x5,{value:e.requestedById})]}),(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Desired CMK:"})," ",void 0!==e.desiredCmk?(0,d.jsx)("code",{children:e.desiredCmk}):"—"]}),(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Created:"})," ",new Date(e.createdTime).toLocaleString()]}),(0,d.jsxs)("div",{style:aG.infoRow,children:[(0,d.jsx)("strong",{children:"Last Updated:"})," ",new Date(e.lastUpdatedTime).toLocaleString()]})]},e.rootRequestId)),0===i.length?(0,d.jsx)("div",{style:aG.infoRow,children:"No CMK rotation requests found for this organization."}):void 0,(0,d.jsx)("div",{style:aG.jsonSection,children:(0,d.jsx)(a(243119).A,{data:t})})]})}},adminEKMUpdateCmkRotationRequestStatus:{apiName:"adminEKMUpdateCmkRotationRequestStatus",displayName:"Update CMK Rotation Request Status",description:"Manually update the status of a CMK rotation (org console) request for an organization. Inserts a new organization_request row linked to the previous one. Defaults to the latest request for the organization; pass a Root Request ID to target a specific request chain.",emoji:"📝",isDestructive:!0,schema:{organizationId:{type:"string",isRequired:!0,name:"Organization",comment:"Target Organization ID",table:s().y75},newStatus:{type:"options",isRequired:!0,name:"New Status",options:a(281109).Dy.map(e=>({displayName:e,value:e})),comment:"New status to transition the CMK rotation request to."},rootRequestIds:{type:"string",isRequired:!1,name:"Root Request IDs",comment:"Optional: comma-separated organization_request IDs of the root requests to target. Paste the comma-separated ID list copied from List CMK Rotation Requests. Leave empty to update the latest CMK rotation request for the organization.",placeholder:`${a(591977).nZ}, ${a(591977).nZ}`}}},adminEKMBatchedRowCount:{apiName:"adminEKMBatchedRowCount",displayName:"Batched Row Count",description:a0,emoji:"📊",isDestructive:!1,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space"},includeEncryptedCounts:{type:"boolean",isRequired:!1,defaultValue:!1,comment:"Also count encrypted rows per WEK using the EKM partial index. Adds a second query per range."}}},adminS3OffboardSecureFiles:{apiName:"adminS3OffboardSecureFiles",displayName:"Offboard S3 Files",description:(0,d.jsxs)(d.Fragment,{children:["Re-encrypts all secure files in S3 for a workspace using Notion's own KMS key, effectively offboarding them from customer-managed encryption.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),emoji:"📤",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space"},region:{type:"options",isRequired:!1,options:["us-west-2","eu-central-1"],defaultValue:"us-west-2",comment:"AWS region where the secure files are stored"}}},adminRequestCmkRotation:{apiName:"adminRequestCmkRotation",displayName:"Org Console CMK Rotation Request",description:"Creates organization request records for CMK rotation on behalf of an organization. The CMK ARN is applied to all workspaces in the organization.",emoji:"🏢",isDestructive:!1,schema:{organizationId:{type:"string",isRequired:!0,name:"Organization",comment:"Target Organization ID",table:s().y75},desiredCmk:{type:"string",isRequired:!0,name:"Desired CMK ARN",comment:"The KMS ARN of the desired customer-managed key",placeholder:"arn:aws:kms:region:account:key/key-id"}}},adminS3ReencryptSecureFiles:{apiName:"adminS3ReencryptSecureFiles",displayName:"Re-Encrypt S3 Files",description:(0,d.jsxs)(d.Fragment,{children:["Re-encrypts a workspace's objects in one or more space-sharded S3 buckets using the specified CMK ARN. Uses S3 batch operations for efficient processing; each selected bucket is processed as its own step.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"⚙️ Durable Workflow",(0,d.jsx)("br",{}),(0,d.jsx)(a(16275).I,{icon:a(378111).slackIcon,size:"xxs",style:{display:"inline",verticalAlign:"middle"}})," ","Slack Notifications in ",(0,d.jsx)("a",{href:"https://notion.enterprise.slack.com/archives/C09SCL3AHJQ",target:"_blank",rel:"noreferrer",children:"#ekm-operations"})]}),emoji:"🔄",isDestructive:!0,schema:{spaceId:{type:"string",isRequired:!0,name:"Workspace",comment:"Target Workspace ID",table:"space"},newKmsKeyId:{type:"string",isRequired:!1,name:"CMK",comment:"Customer Managed Key KMS ARN",placeholder:"arn:aws:kms:region:account:key/key-id",toggleOptions:{defaultLabel:"Use Latest Organization Request (default)",manualLabel:"Manually Configure"}},region:{type:"options",isRequired:!1,options:["us-west-2","eu-central-1"],defaultValue:"us-west-2",comment:"AWS region where the secure files are stored"},skipHeadCheck:{type:"boolean",isRequired:!1,defaultValue:!0,name:"Skip HEAD Check",comment:"Skip per-file HEAD requests during manifest generation. When enabled, all files are included in the manifest without checking current encryption status. Recommended for large workspaces. S3 Batch Operations is idempotent so reencrypting already-encrypted files is safe."},bucketIds:{type:"multiselect",defaultValue:["secureFiles"],comment:"Which space-sharded S3 buckets to re-encrypt. Each selected bucket runs as its own step with its own status update in the Slack thread. Defaults to secure files.",options:[{displayName:"Secure files",value:"secureFiles"},{displayName:"Temporary files (non-prod only)",value:"temporaryFiles"}]}}}},a4={adminGetStatsigExperiment:{apiName:"adminGetStatsigExperiment",displayName:"Statsig - Get Experiment Group",emoji:"🔎",description:"Get Statsig Experiments As an User, Device or Space",schema:{experimentId:{type:"options",options:[...a(791002).sE],comment:"Must pick an experiment"},userId:{type:"string",comment:"Optional for experiments not targeting userId."},deviceId:{type:"string",comment:"Optional for experiments not targeting deviceId."},spaceId:{type:"string",comment:"Optional for experiments not targeting spaceId."}}},adminGetStatsigFeatureGate:{apiName:"adminGetStatsigFeatureGate",displayName:"Statsig - Get Feature Gate",emoji:"🔎",description:"Get Statsig Feature Gate As an User, Device or Space",schema:{gateName:{type:"options",options:[...a(43858).vN],comment:"Must pick a feature gate"},userId:{type:"string",comment:"Optional for experiments not targeting userId."},deviceId:{type:"string",comment:"Optional for experiments not targeting deviceId."},spaceId:{type:"string",comment:"Optional for experiments not targeting spaceId."}}},adminCheckStatsigSegment:{apiName:"adminCheckStatsigSegment",displayName:"Statsig - Check Segment",emoji:"🕵",description:(0,d.jsxs)(d.Fragment,{children:["Check information about a single Statsig segment.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)(a(590422).Q,{underline:!0,inline:!0,external:!0,href:"https://docs.statsig.com/segments#:~:text=%E2%80%8B,or%20simply%20using%20user%20IDs.",children:"What are Statsig Segments?"}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),'You can use the "count" information to check how many Ids exist in the segment before and after updating. Note that updating a segment can take up to a couple of minutes to take effect.']}),schema:{segmentId:{type:"string",comment:"Segment Id"}}},adminUpdateStatsigSegmentIds:{apiName:"adminUpdateStatsigSegmentIds",displayName:"Statsig - Add or Delete IDs to Segment",emoji:"🖊",description:(0,d.jsxs)(d.Fragment,{children:["Add or Delete Ids (userId, deviceId, spaceId) to Statsig ID List type Segment.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Notice this does not apply to a conditional type segment.",(0,d.jsx)(a(590422).Q,{underline:!0,inline:!0,external:!0,href:"https://dev.notion.so/notion/Setup-Experiments-and-Feature-Gates-in-Statsig-01bc0c59680c4cea96229aeae2354e09#37875afd56424f4d8ce0a1dfd82f2391",children:"Segment types: conditional vs ID list"}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Use the Check Segment tool to check the number of Ids (count) before and after updating. Note that updating a segment can take up to a couple of minutes to take effect."]}),schema:{segmentId:{type:"string",comment:"Segment Id"},idsToAdd:{type:"string",comment:"Comma-separated ids to add to a 
100segment. Accept dash or dashless IDs, dashless IDs will be transformed into dash IDs. Doesn't matter if space is provided between ids."},idsToDelete:{type:"string",comment:"Comma-separated ids to delete from a segment. Accept dash or dashless IDs, dashless IDs will be transformed into dash IDs. Doesn't matter if space is provided between ids."},emailsToAdd:{type:"string",comment:"Comma-separated list of user emails (up to 100) to add to a user Id level segment. Emails will be converted to user ids (uuid with dash) before getting inserted."},emailsToDelete:{type:"string",comment:"Comma-separated list of user emails (up to 100) to delete from a user Id level segment. Emails will be converted to user ids (uuid with dash) before getting deleted."},domainsToAdd:{type:"string",comment:"Comma-separated list of domains (short domain, e.g makenotion) to add to a space Id level segment. Domains will be converted to space ids (uuid with dash) before getting inserted."},domainsToDelete:{type:"string",comment:"Comma-separated list of domains (short domain, e.g makenotion) to delete from a space Id level segment. Domains will be converted to space ids (uuid with dash) before getting deleted."}}}};function a2(){return"application"}let a6={color:"red"},a9={cursor:"pointer"};function a7(e){let{title:t,children:a}=e,[i,n]=(0,r.useState)(!1);return(0,d.jsxs)("div",{children:[(0,d.jsxs)("h4",{role:"button",onClick:()=>n(!i),style:a9,children:[i?"▼ ":"▶ ",t]}),i?a:void 0]})}function a3(e){let{automationId:t,from:a,types:i}=e,n=a2(),r="";if(i&&i.length>0){let e=i.map(e=>`type="${e}"`).join(" OR ");r=`(${e})`}let s=`search index=${n} from=${a} data.automationId="${t}" ${r}`,o=new URLSearchParams;return o.set("q",s),`https://notion.splunkcloud.com/en-GB/app/search/search?${o.toString()}`}let a8="<redacted>",a5={container:{marginBottom:16,border:`1px solid ${a(632079).Tj.border.primary}`,padding:12,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary},summary:{cursor:"pointer",fontWeight:a(699422).Wy.bold,display:"list-item"},itemContainer:{padding:8,backgroundColor:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4},button:{cursor:"pointer",fontSize:13,padding:"4px 8px",color:a(632079).Tj.text.inversePrimary,borderRadius:4,display:"list-item",border:"none",listStylePosition:"inside"},preformatted:{marginTop:4,padding:8,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,fontSize:11,maxHeight:200,overflow:"auto",whiteSpace:"pre-wrap",backgroundColor:a(632079).Tj.background.secondary},versionContainer:{padding:8,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary},activeStatus:{color:a(632079).Tj.green.text.accentPrimary,fontWeight:a(699422).Wy.bold},inactiveStatus:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.bold},enabledText:{color:a(632079).Tj.green.text.accentPrimary,fontWeight:a(699422).Wy.bold},disabledText:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.bold},yesText:{color:a(632079).Tj.green.text.accentPrimary},noText:{color:a(632079).Tj.red.text.accentPrimary},link:{color:a(632079).Tj.blue.text.primary,textDecoration:"underline",cursor:"pointer"},secondaryText:{color:a(632079).Tj.text.secondary},draftSummary:{color:a(632079).Tj.orange.text.accentPrimary},publishedSummary:{color:a(632079).Tj.green.text.accentPrimary},versionsSummary:{color:a(632079).Tj.purple.text.accentPrimary},blueButton:{backgroundColor:a(632079).Tj.blue.background.accentPrimary},greenButton:{backgroundColor:a(632079).Tj.green.background.accentPrimary},grayButton:{backgroundColor:a(632079).Tj.gray.background.accentPrimary},noDataContainer:{padding:20,border:`1px dashed ${a(632079).Tj.border.primary}`,borderRadius:8,textAlign:"center"},statusSuccess:{color:a(632079).Tj.green.text.accentPrimary,fontWeight:a(699422).Wy.bold},statusFailure:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.bold},statusPending:{color:a(632079).Tj.orange.text.accentPrimary,fontWeight:a(699422).Wy.bold},statusRunning:{color:a(632079).Tj.blue.text.accentPrimary,fontWeight:a(699422).Wy.bold},statusOther:{color:a(632079).Tj.text.secondary,fontWeight:a(699422).Wy.bold},style0:{marginBottom:16},style1:{listStyle:"none",marginTop:8,marginInlineEnd:0,marginBottom:0,marginInlineStart:0,padding:0},style3:{marginBottom:4},style4:{fontSize:11,wordBreak:"break-all"},style6:{fontSize:14,marginBottom:8},style7:{fontSize:11},style8:{marginTop:4},style9:{marginTop:8},style10:{margin:0,fontSize:14},style11:{fontSize:14,marginBottom:4},style12:{fontSize:13},style13:{marginTop:4,padding:8,backgroundColor:a(632079).Tj.red.background.secondary,borderRadius:4,fontSize:12},style14:{paddingTop:4,paddingInlineEnd:8,paddingBottom:4,paddingInlineStart:20},style15:{maxHeight:150},style16:{fontSize:13},style17:{padding:12},style18:{fontSize:12,marginTop:4},style19:{fontSize:14},style20:{fontStyle:"italic",margin:0},style21:{fontSize:12,marginBottom:4},style22:{paddingTop:4,paddingInlineEnd:8,paddingBottom:4,paddingInlineStart:20}
100,loadMoreError:{color:a(632079).Tj.red.text.accentPrimary,fontSize:12}};function ie(e,t){if(!(0,ed().Gv)(e)||Array.isArray(e))return{};let a=function e(t){if(Array.isArray(t))return t.map(t=>e(t));if((0,ed().Gv)(t)&&!Array.isArray(t)){let a={};for(let i in t)Object.prototype.hasOwnProperty.call(t,i)&&(a[i]=e(t[i]));return a}return t}(e);if(!(0,ed().Gv)(a)||Array.isArray(a))return{};for(let e of t)!function(e,t){if(0===t.length)return;let a=e;for(let e=0;e<t.length;e+=1){let i=t[e],n=e===t.length-1;if(Array.isArray(a)){if("number"!=typeof i)return;if(n){a[i]=a8;return}let e=a[i];if(!(0,ed().Gv)(e)){a[i]=a8;return}if(Array.isArray(e)){a=e;continue}a=e;continue}if("string"!=typeof i)return;if(n){a[i]=a8;return}let r=a[i];if(!(0,ed().Gv)(r)){a[i]=a8;return}if(Array.isArray(r)){a=r;continue}a=r}}(a,e);return(0,ed().Gv)(a)&&!Array.isArray(a)?a:{}}function it(e){return null===e?"stored in Agent Service":e.toString()}var ia=()=>a(114588),ii=()=>a(714350),ir=()=>a(599412),is=()=>a(774995),io=()=>a(642157);function il(e){let t=[];for(let a of(t.push("%%{init: {'look':'neo','width':'100%'}}%%"),t.push("flowchart LR"),e))t.push(...function(e){let t=[];for(let a of(e.subgraph&&t.push(`subgraph ${e.subgraph.id} ["${e.subgraph.label}"]`),e.nodes))t.push(`${a.id}${a.shapeTemplate.replace("LABEL",a.label)}`),a.color&&t.push(`style ${a.id} fill:${a.color};`);for(let a of e.edges)t.push(`${a.fromId} --> ${a.toId}`);return e.subgraph&&t.push("end"),t}(a));return t.join("\n")}let id=["#00bfff","#ffd700","#caff70","#ff7f50","#deb887","#5f9ea0","#eee8aa","#76eec6","#9a32cd"],ic={formula:'("LABEL")',relation:'{{"LABEL"}}',rollup:'[["LABEL"]]'},ip='["LABEL"]';function im(e){let t=(0,a(83388).Xw)(e.collectionPointer.id),i=(0,a(83388).Xw)((0,a(83388).gB)(e.property));return`dep_${t}_${i}`}function iu(e){return e.replaceAll(/([\[\](){}<>\\])/g,"").replaceAll('"',"'")}function ih(e){let{time:t}=e;return t?(0,d.jsx)(d.Fragment,{children:t}):(0,d.jsx)(d.Fragment,{children:"No time recorded"})}function iy({data:e,keyPath:t}){return t.includes("permissions")&&"from"===t[0]?{element:(0,d.jsx)("span",{children:e.parentLevel}),expanded:!1}:null}function ig({data:e,keyPath:t}){if("ancestors"===t[1]){if(!(0,a(788145).Xj)(a(564513).uA,e))return null;let t=`[${e.table}${e.type?`:${e.type}`:""}]`,i=!1===e.alive?"🗑️":"";return{expanded:!1,element:(0,d.jsxs)("span",{children:[t," ",e.id," ",i," ",(0,d.jsx)(a(941318).k,{table:e.table,id:e.id})]})}}return null}let ix={style0:{...a(553775).g,paddingTop:5}};function ib(e){var t;let{data:i,singleRecordMode:n}=e;return(0,d.jsxs)(d.Fragment,{children:[n?(0,d.jsx)(a(45062).A,{title:`Notion Block Admin: ${i.id}`}):void 0,(0,d.jsxs)("div",{style:ix.style0,children:["Block ",(0,d.jsx)(a(137691).x5,{value:i.id}),i.deleted.isPermanentlyDeleted?" (permanently deleted)":i.deleted.isInTrash?" (in trash)":""]}),(0,d.jsxs)("div",{style:a(553775).Bk,children:[(0,d.jsxs)("div",{children:["in space:"," ",i.space?(0,d.jsx)(a(553775).lv,{space:i.space}):(0,d.jsx)(a(553775).lv,{space:{id:i.spaceId}})]}),i.createdBy?(0,d.jsxs)("div",{children:["created by: ",(0,d.jsx)(a(553775).uQ,{user:i.createdBy})," on"," ",(0,d.jsx)(ih,{time:i.createdTime})]}):void 0,i.lastEditedBy?(0,d.jsxs)("div",{children:["last edited by: ",(0,d.jsx)(a(553775).uQ,{user:i.lastEditedBy})," on"," ",(0,d.jsx)(ih,{time:i.lastEditedTime})]}):void 0,function(e){let t,{isPermanentlyDeleted:i,isInTrash:n,trashedByParent:r,permanentlyDeletedByParent:s,permanentDeletionReason:o}=e;if(!i&&!n)return null;if(!i&&n)return r?(0,d.jsxs)("div",{children:["in trash due to: user trashed parent -"," ",(0,d.jsx)(a(553775).ru,{table:r.table,record:r})]}):(0,d.jsx)("div",{children:"in trash due to: user trashed this block"});if(s)return(0,d.jsxs)("div",{children:["permanently deleted due to: parent being permanently deleted"," ",s.table,":",(0,d.jsx)(a(137691).x5,{value:s.id})]});switch(o){case"trash_retention_exceeded":t="permanently deleted due to: system permanently deleted this block after exceeding trash retention period";break;case"unknown_system_deletion":t="permanently deleted due to: system permanently deleted this block";break;case"user_initiated":t="permanently deleted due to: user permanently deleted this block";break;
100case void 0:t="unexpectedly missing deletion reason (this should never happen)";break;default:(0,ed().HB)(o)}return(0,d.jsx)("div",{children:t})}(i.deleted),null!=(t=i.publicStatus)&&t.isPublic?(0,d.jsxs)("div",{children:["Page made ",(0,d.jsx)("b",{children:"public"})," on"," ",i.publicStatus.permission.added_timestamp?"number"==typeof i.publicStatus.permission.added_timestamp?(0,a(850640).W_)(i.publicStatus.permission.added_timestamp,"medium",a(849917).locale):i.publicStatus.permission.added_timestamp:"N/A"," ","and"," ",i.publicStatus.isAllowedToBeServedOnBaseUrl?(0,d.jsxs)("span",{children:["is ",(0,d.jsx)("b",{children:"allowed"})," to be served on notion.so"]}):(0,d.jsxs)("span",{children:["notion.so links will ",(0,d.jsx)("b",{children:"redirect"})," to notion.site"]})]}):void 0]}),(0,d.jsxs)("div",{children:["Full Response",(0,d.jsx)(a(243119).A,{data:i,hideHelp:!0,customCollapsedRenderers:[iy,ig]})]})]})}function iv(e){let{title:t,children:a}=e;return(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:t}),a]})}function ij(e){let{title:t,children:a}=e;return(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:`${t}: `}),a]})}let ik={color:"red"},iS={stripeLink:{cursor:"pointer",color:a(632079).Tj.blue.text.accentPrimary}};function iw(e){let{space:t,userRole:i}=e;return(0,d.jsxs)("li",{children:[(0,d.jsx)(a(553775).lv,{space:t})," • role: ",i," ",t.isDeleted?" (deleted)":void 0,t.isSanctioned?" (sanctioned)":void 0," •",(0,d.jsx)("a",{href:t.billing.stripeCustomerUrl,style:iS.stripeLink,children:(0,d.jsx)(a(748075).z,{})})]},t.id)}function iI(e){let{spaces:t,title:i}=e;return 0===Object.keys(t).length?null:(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:i}),(0,d.jsx)("b",{children:`Count: ${Object.keys(t).length}`}),(0,d.jsx)("ol",{children:Object.entries(t).map(([e,t])=>{if(!t)return(0,d.jsxs)("li",{children:[(0,d.jsx)(a(137691).x5,{value:e})," (missing?)"]},e);let{space:i,userRole:r}=t;return(0,n().Im)(t)?(0,d.jsxs)("li",{children:["Unknown space: ",(0,d.jsx)(a(137691).x5,{value:e})]},e):i?(0,d.jsx)(iw,{space:i,userRole:r},e):(0,d.jsxs)("li",{children:[(0,d.jsx)(a(137691).x5,{value:e})," • role: ",r]},e)})})]})}function iC(e){return e.split(".").map(e=>{let t=e.match(/^\[(\d+)\]$/);return(null==t?void 0:t[1])!==void 0?Number(t[1]):e})}function iD(e){return"number"==typeof e}let iT=new Set(["trialEnd","startDate","endDate","currentPeriodEnd","currentPeriodStart","createdAt","dueDate"]),iR={status:"Status",trialEnd:"Trial end",startDate:"Start date",endDate:"End date",currentPeriodEnd:"Period end",currentPeriodStart:"Period start",autoConvert:"Auto-converts",product:"Plan",billingInterval:"Interval",unitAmount:"Price/seat",amount:"Amount",currencyCode:"Currency",quantity:"Seats",items:"Items",provider:"Provider",pendingPhases:"Pending phases",unrepresentableReason:"Unrepresentable reason",paymentIntent:"Payment intent",amountDue:"Amount due",amountPaid:"Amount paid",currency:"Currency",dueDate:"Due date",createdAt:"Created",lineItems:"Line items",overrides:"Overrides"},iA={subscription:"Subscription","subscription.status":"Status","subscription.trialEnd":"Trial end","subscription.startDate":"Start date","subscription.currentPeriodEnd":"Period end","subscription.unrepresentableReason":"Unrepresentable reason",trial:"Trial","trial.startDate":"Trial start","trial.endDate":"Trial end","trial.autoConvert":"Auto-converts",invoices:"Invoices",paymentMethod:"Payment method",email:"Billing email",externalId:"Customer ID",provider:"Provider",lockedCurrencyCode:"Locked currency",hasPaidNonzero:"Has paid nonzero",accountBalances:"Account balances",taxIds:"Tax IDs",address:"Address"};function iN(e){return iR[e]??e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase())}function iM(e){let t=iC(e),a=t[t.length-1],i="string"==typeof a&&iT.has(a);if("clock"===t[0])return{label:"Clock",isNoise:!0,isDate:!1};if("id"===a)return{label:"ID",isNoise:!0,isDate:!1};if("externalId"===a&&t.length>1)return{label:"External ID",isNoise:!0,isDate:!1};let n=iA[e];if(void 0!==n)return{label:n,isNoise:!1,isDate:i};if("subscription"===t[0]&&"items"===t[1]&&iD(t[2])){let e=t.length>3?`: ${iN(String(a))}`:"";return{label:`Item ${t[2]+1}${e}`,isNoise:!1,isDate:i}}if("subscription"===t[0]&&"pendingPhases"===t[1]&&iD(t[2])){let e=t.length>3?`: ${iN(String(a))}`:"";return{label:`Pending change ${t[2]+1}${e}`,isNoise:!1,isDate:i}}if("trial"===t[0]&&"items"===t[1]&&iD(t[2])){let e=t.length>3?`: ${iN(String(a))}`:"";
100return{label:`Trial item ${t[2]+1}${e}`,isNoise:!1,isDate:i}}if("invoices"===t[0]&&iD(t[1])){let e=t.length>2?`: ${iN(String(a))}`:"";return{label:`Invoice ${t[1]+1}${e}`,isNoise:!1,isDate:i}}return{label:iN(String(a??e)),isNoise:!1,isDate:i}}function iP(e){return!(!(0,ed().Gv)(e)||Array.isArray(e))}function iV(e){if(!e)return"—";let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}let iE=new Set(["BIF","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"]);function iB(e,t){let a=iE.has(t.toUpperCase());return new Intl.NumberFormat("en-US",{style:"currency",currency:t,minimumFractionDigits:2*!a}).format(a?e:e/100)}function iL(e){return({free:"Free",student:"Student",personal:"Personal",plus:"Plus",business:"Business",enterprise:"Enterprise",ai:"AI Add-on",sites_custom_hostnames:"Sites Custom Hostnames",ai_credit_pack:"AI Credit Pack"})[e]??e.charAt(0).toUpperCase()+e.slice(1)}function i_(e){return"year"===e?"Annual":"month"===e?"Monthly":e}function iU(e){return e.split("_").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}let iW={link:"Link",kakao_pay:"Kakao Pay",naver_pay:"Naver Pay",cashapp:"Cash App",ach_credit_transfer:"ACH Credit Transfer",invoice:"Invoice",mobile:"Mobile"};function iF(e){return e?"card"===e.type?`${e.brand} \xb7\xb7\xb7\xb7${e.last4}`:"sepa_debit"===e.type?`SEPA Debit \xb7\xb7\xb7\xb7${e.last4}`:iW[e.type]??e.type:"—"}function iK(e,t){var a,i;return void 0===e.trial&&(null==(a=e.subscription)?void 0:a.status)==="active"&&void 0!==e.paymentMethod&&(void 0===t||!("paymentMethod"in t)||(null==(i=t.paymentMethod)?void 0:i.previousValue)===void 0)}function i$(e){let t={};return Object.assign(t,e),t}function iO(e){return e.map(e=>`${iL(e.price.product)} ${i_(e.price.billingInterval)} \xd7${e.quantity}`).join(", ")}function iz(e){return e.filter(iP).map(e=>{let t=iP(e.price)?e.price:void 0,a=t&&(0,n().Kg)(t.product)?iL(t.product):"?",i=t&&(0,n().Kg)(t.billingInterval)?i_(t.billingInterval):"",r=(0,n().Et)(e.quantity)?e.quantity:"?";return`${a} ${i} \xd7${r}`}).join(", ")}let iG={changesTable:{border:`1px solid ${a(632079).oZ.uiLightGray}`,borderRadius:4,overflow:"hidden",marginTop:8,marginBottom:12},changesTableHeader:{backgroundColor:a(632079).oZ.uiLightGray,fontSize:11,fontWeight:a(699422).Wy.bold,letterSpacing:"0.08em",color:a(632079).oZ.mediumTextColor},changesTableRow:{borderTop:`1px solid ${a(632079).oZ.uiLightGray}`,fontSize:13},changesTableCellLabel:{flexShrink:0,width:200,padding:"6px 12px",fontSize:13,fontWeight:a(699422).Wy.medium,color:a(632079).oZ.mediumTextColor,borderInlineEnd:`1px solid ${a(632079).oZ.uiLightGray}`},changesTableCellLabelIndented:{flexShrink:0,width:200,paddingTop:6,paddingInlineEnd:12,paddingBottom:6,paddingInlineStart:24,fontSize:13,fontWeight:a(699422).Wy.medium,color:a(632079).oZ.mediumTextColor,borderInlineEnd:`1px solid ${a(632079).oZ.uiLightGray}`},changesTableCellValue:{flex:1,padding:"6px 12px",wordBreak:"break-all",borderInlineEnd:`1px solid ${a(632079).oZ.uiLightGray}`},changesTableCellValueLast:{flex:1,padding:"6px 12px",wordBreak:"break-all"},changesTableHeaderCell:{padding:"5px 12px"},changesTableSectionHeader:{fontSize:11,fontWeight:a(699422).Wy.bold,letterSpacing:"0.08em",padding:"4px 12px",backgroundColor:a(632079).oZ.uiLightGray,color:a(632079).oZ.mediumTextColor,borderTop:`1px solid ${a(632079).oZ.uiLightGray}`},changesTableGroupHeader:{fontSize:11,fontWeight:a(699422).Wy.medium,letterSpacing:"0.04em",padding:"3px 12px",color:a(632079).oZ.mediumTextColor,borderTop:`1px solid ${a(632079).oZ.uiLightGray}`},changesTableDetailsSummary:{cursor:"pointer",color:a(632079).oZ.mediumTextColor},changesTableDetailsBody:{margin:"4px 0 0",fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-all"}};function iq(e){if(!iP(e))return"?";let t=iP(e.price)?e.price:void 0,a=void 0!==t&&(0,n().Kg)(t.product)?iL(t.product):"?",i=void 0!==t&&(0,n().Kg)(t.billingInterval)?i_(t.billingInterval):"",r=void 0!==t&&iP(t.unitAmount)?t.unitAmount:void 0,s=void 0!==r&&(0,n().Et)(r.amount)?r.amount:void 0,o=void 0!==r&&(0,n().Kg)(r.currencyCode)?r.currencyCode:void 0,l=void 0!==s&&void 0!==o?` \xb7 ${i
100B(s,o)}/seat`:"",d=(0,n().Et)(e.quantity)?e.quantity:"?";return`${a} ${i}${l} \xd7${d}`}function iH(e,t){return(0,d.jsxs)("details",{children:[(0,d.jsx)("summary",{style:iG.changesTableDetailsSummary,children:e}),(0,d.jsx)("pre",{style:iG.changesTableDetailsBody,children:JSON.stringify(t,null,2)})]})}function iZ(e,t){let a,i;if(void 0===t)return"—";if(null===t)return"null";if((0,n().Kg)(t))return iM(e).isDate?iV(t):t;if((0,n().Et)(t)||(0,n().Lm)(t))return String(t);let r=iC(e);if("subscription"===e){if(!iP(t))return"?";let e=Array.isArray(t.items)?t.items:[],a=(0,n().Kg)(t.status)?iU(t.status):"?";return`${a} \xb7 ${iz(e)}`}if("subscription"===r[0]&&"items"===r[1]&&iD(r[2])&&3===r.length)return iq(t);if("trial"===e){if(!iP(t))return"?";let e=Array.isArray(t.items)?t.items:[],a=(0,n().Kg)(t.endDate)?iV(t.endDate):"?";return`${iz(e)} \xb7 ends ${a}`}if("trial"===r[0]&&"items"===r[1]&&iD(r[2])&&3===r.length)return iq(t);if("paymentMethod"===e){if(!iP(t))return"";let e=(0,n().Kg)(t.type)?t.type:void 0;if(void 0===e)return"";if("card"===e){let e=(0,n().Kg)(t.brand)?t.brand:"",a=(0,n().Kg)(t.last4)?t.last4:"????";return`${e} \xb7\xb7\xb7\xb7${a}`}if("sepa_debit"===e){let e=(0,n().Kg)(t.last4)?t.last4:"????";return`SEPA Debit \xb7\xb7\xb7\xb7${e}`}return iW[e]??e}return"invoices"===r[0]?iH(Array.isArray(t)?`[${t.length} invoices]`:function(e){if(!iP(e))return"?";let t=(0,n().Kg)(e.externalId)?e.externalId:"?",a=(0,n().Kg)(e.status)?iU(e.status):"?",i=(0,n().Et)(e.amountDue)?e.amountDue:void 0,r=(0,n().Kg)(e.currency)?e.currency:void 0,s=void 0!==i&&void 0!==r?` \xb7 ${iB(i,r)}`:"";return`${t} \xb7 ${a}${s}`}(t),t):iH(Array.isArray(t)?`[${t.length} items]`:iP(t)?(i=(a=Object.keys(t)).slice(0,3).join(", "),`{ ${i}${a.length>3?", …":""} }`):String(t),t)}function iJ(e){return[...e].sort(([e],[t])=>e.localeCompare(t))}function iQ({changes:e}){let t=Object.entries(e).filter(([e])=>!iM(e).isNoise),i=e=>"subscription"===e||e.startsWith("subscription.")||"trial"===e||e.startsWith("trial."),n=e=>"invoices"===e||e.startsWith("invoices."),s=iJ(t.filter(([e])=>i(e))),o=iJ(t.filter(([e])=>n(e))),l=iJ(t.filter(([e])=>!i(e)&&!n(e))),c=[];return(s.length>0&&c.push({title:"Subscription",rows:s}),o.length>0&&c.push({title:"Invoices",rows:o}),l.length>0&&c.push({title:"Account",rows:l}),0===c.length)?null:(0,d.jsxs)("div",{style:iG.changesTable,children:[(0,d.jsxs)(a(4458).fI,{style:iG.changesTableHeader,children:[(0,d.jsx)("div",{style:{...iG.changesTableCellLabel,...iG.changesTableHeaderCell,fontSize:11,fontWeight:a(699422).Wy.bold},children:"FIELD"}),(0,d.jsx)("div",{style:{...iG.changesTableCellValue,...iG.changesTableHeaderCell},children:"BEFORE"}),(0,d.jsx)("div",{style:{...iG.changesTableCellValueLast,...iG.changesTableHeaderCell},children:"AFTER"})]}),c.map(e=>(0,d.jsxs)(r.Fragment,{children:[(0,d.jsx)("div",{style:iG.changesTableSectionHeader,children:e.title.toUpperCase()}),(function(e){let t=[],a=new Map,i=[];for(let r of e){let e=function(e){let t=iC(e),a=t.findIndex(e=>"number"==typeof e);if(-1!==a)return t.slice(0,a+1).map(e=>"number"==typeof e?`[${e}]`:e).join(".")}(r[0]);if(void 0===e)t.push(r);else{var n;a.has(e)||(a.set(e,[]),i.push(e)),null==(n=a.get(e))||n.push(r)}}let r=[];for(let e of(t.length>0&&r.push({groupKey:void 0,rows:t}),i)){let t=a.get(e);void 0!==t&&r.push({groupKey:e,rows:t})}return r})(e.rows).map(({groupKey:e,rows:t})=>(0,d.jsxs)(r.Fragment,{children:[void 0!==e?(0,d.jsx)("div",{style:iG.changesTableGroupHeader,children:iM(e).label.toUpperCase()}):null,t.map(([t,{previousValue:i,newValue:n}])=>(0,d.jsxs)(a(4458).fI,{style:iG.changesTableRow,children:[(0,d.jsx)("div",{style:void 0!==e?iG.changesTableCellLabelIndented:iG.changesTableCellLabel,children:void 0!==e?function(e,t){if(e===t)return iM(e).label;let a=iC(e),i=iC(t),n=a.slice(i.length);return"price"===n[0]&&"unitAmount"===n[1]?"Price/seat":iN(String(n[n.length-1]??e))}(t,e):iM(t).label}),(0,d.jsx)("div",{style:iG.changesTableCellValue,children:iZ(t,i)}),(0,d.jsx)("div",{style:iG.changesTableCellValueLast,children:iZ(t,n)})]},t))]},e??"__flat__"))]},e.title))]})}var iY=()=>a(645040);let iX={summaryCard:{border:`1px solid ${a(632079).oZ.uiLightGray}`,borderRadius:4,overflow:"hidden",marginTop:12},sectionWithBorder:{borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`},sectionNoBorder:{},sectionHeader:{fontSize:11,fontWeight:a(699422).Wy.bold,letterSpacing:"0.08em",padding:"6px 12px",backgroundColor:a(632079).oZ.uiLightGray,color:a(632079).oZ.mediumTextColor},rowWithBorder:{borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`,fontSize:13},rowNoBorder:{fontSize:13},rowLabel:{flexShrink:0,width:160,padding:"7px 12px",fontWeight:a(699422).Wy.medium,color:a(632079).oZ.mediumTextColor,borderInlineEnd:`1p
100x solid ${a(632079).oZ.uiLightGray}`},rowIndented:{backgroundColor:a(632079).Tj.gray.background.secondary},rowLabelIndented:{paddingInlineStart:28},rowValue:{padding:"7px 12px",wordBreak:"break-all"},statusBadge:{display:"inline-block",padding:"2px 8px",borderRadius:12,fontSize:12,fontWeight:a(699422).Wy.medium},planGroupHeader:{fontSize:11,fontWeight:a(699422).Wy.medium,letterSpacing:"0.06em",padding:"4px 12px",color:a(632079).oZ.mediumTextColor,borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`,borderTop:`1px solid ${a(632079).oZ.uiLightGray}`},sectionHeaderSuffix:{letterSpacing:0,fontWeight:a(699422).Wy.medium}};function i0({label:e,value:t,isLast:i,indent:n}){return(0,d.jsxs)(a(4458).fI,{style:{...i?iX.rowNoBorder:iX.rowWithBorder,...n?iX.rowIndented:{}},children:[(0,d.jsx)("div",{style:{...iX.rowLabel,...n?iX.rowLabelIndented:{}},children:e}),(0,d.jsx)("div",{style:iX.rowValue,children:t})]})}function i1({title:e,titleSuffix:t,children:a,isLast:i}){return(0,d.jsxs)("div",{style:i?iX.sectionNoBorder:iX.sectionWithBorder,children:[(0,d.jsxs)("div",{style:iX.sectionHeader,children:[e.toUpperCase(),void 0!==t?(0,d.jsxs)("span",{style:iX.sectionHeaderSuffix,children:[" · ",t]}):null]}),a]})}function i4({item:e,planLabel:t}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i0,{label:t,value:iL(e.price.product)}),(0,d.jsx)(i0,{label:"Interval",value:i_(e.price.billingInterval)}),(0,d.jsx)(i0,{label:"Price/seat",value:iB(e.price.unitAmount.amount,e.price.unitAmount.currencyCode)}),(0,d.jsx)(i0,{label:"Seats",value:e.quantity})]})}function i2({item:e}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i6,{label:`Add-on \xb7 ${iL(e.price.product)}`}),(0,d.jsx)(i0,{label:"Interval",value:i_(e.price.billingInterval),indent:!0}),(0,d.jsx)(i0,{label:"Price/unit",value:iB(e.price.unitAmount.amount,e.price.unitAmount.currencyCode),indent:!0}),(0,d.jsx)(i0,{label:"Quantity",value:e.quantity,indent:!0})]})}function i6({label:e}){return(0,d.jsx)("div",{style:iX.planGroupHeader,children:e.toUpperCase()})}function i9({billingData:e,snapshotTimeISO:t}){var i,n;let{subscription:r,trial:s,paymentMethod:o,email:l,provider:c,externalId:p}=e,m=(null==r?void 0:r.pendingPhases)??[],u=new Date(null!=(i=e.clock)&&i.externalId?e.clock.now:t??Date.now()),h=null==r?void 0:r.status,y=void 0!==s&&new Date(s.endDate)>u||"trialing"===h&&(null==r?void 0:r.trialEnd)!==void 0&&new Date(r.trialEnd)>u,g="trialing"===h&&(null==r?void 0:r.trialEnd)!==void 0&&new Date(r.trialEnd)<=u?"active":h,x=y?"Trialing":void 0!==g?iU(g):void 0,f=((null==s?void 0:s.items)??[]).filter(e=>!(0,iY().Qt)(e.price.product)),b=((null==s?void 0:s.items)??[]).filter(e=>(0,iY().Qt)(e.price.product)),v=((null==r?void 0:r.items)??[]).filter(e=>!(0,iY().Qt)(e.price.product)),j=((null==r?void 0:r.items)??[]).filter(e=>(0,iY().Qt)(e.price.product));return(0,d.jsxs)("div",{style:iX.summaryCard,children:[(0,d.jsxs)(i1,{title:"Subscription",titleSuffix:void 0!==r?`${r.externalId} \xb7 Started ${iV(r.startDate)}`:void 0,children:[void 0!==x?(0,d.jsx)(i0,{label:"Status",value:(0,d.jsx)("span",{style:{...iX.statusBadge,...function(e){switch(e.toLowerCase()){case"active":return{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.accentPrimary};case"trialing":return{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.accentPrimary};case"canceled":case"cancelled":return{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary};case"incomplete":case"past_due":return{backgroundColor:a(632079).Tj.orange.background.primary,color:a(632079).Tj.orange.text.accentPrimary};default:return{backgroundColor:a(632079).oZ.uiLightGray,color:a(632079).oZ.mediumTextColor}}}(y?"trialing":g??"")},children:x})}):null,void 0!==s?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i6,{label:void 0!==r?"Trial (Stacked)":"Trial (Reverse)"}),(0,d.jsx)(i0,{label:"Trial starts",value:iV(s.startDate)}),(0,d.jsx)(i0,{label:"Trial ends",value:iV(s.endDate)}),(0,d.jsx)(i0,{label:"Auto-converts",value:s.autoConvert?"Yes":"No"}),f.map((e,t)=>(0,d.jsx)(i4,{item:e,planLabel:"Plan"},`trial-plan-${t}`)),b.map((e,t)=>(0,d.jsx)(i2,{item:e},`trial-addon-${t}`))]}):null,void 0===s&&(null==r?void 0:r.trialEnd)!==void 0&&new Date(r.trialEnd)>u?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i6,{label:iK(e)?"Trial (Credit Card Upfront)":"Trial (Reverse)"}),(0,d.jsx)(i0,{label:"Trial starts",value:iV(r.startDate)}),(0,d.jsx)(i0,{label:iK(e)?"Billing begins":"Trial ends",value:iV(r.trialEnd)})]}):null,void 0!==r?(0,d.jsxs)(d.Fragment,{children:[void 0!==s?(0,d.jsx)(i6,{label:"Underlying plan"}):null,v.map((e,t)=>(0,d.jsx)(i4,{item:e,planLabel:"Plan"},`sub-plan-${e.id??t}`)),(0,d.jsx)(i0,{label:"Period ends",value:iV(null==(n=r.items)||null==(n=n[0])?void 0:n.currentPeriodEnd)}),m.map((e,t)=>(0,d.jsx)(i0,{label:0===t?"Pending change":"",value:`${iO(e.items??[])} starting ${iV(e.startDate)}`},`pending-${t}`)),j.map((e,t)=>(0,d.jsx)(i2,{item:e},`sub-addon-${e.id??t}`))]}):null,void 0===r&&void 0===s?(0,d.jsx)(i0,{label:"Status",value:"No active subscription",isLast:!0}):null]}),(0,d.jsxs)(i1,{title:"Account",isLast:!0,children:[void 0!==c?(0,d.jsx)(i0,{label:"Provider",value:c}):null,void 0!==p?(0,d.jsx)(i0,{label:"Customer ID",value:p}):null,void 0!==l?(0,d.jsx)(i0,{label:"Billing email",value:l}):null,(0,d.jsx)(i0,{label:"Payment method",value:iF(o),isLast:!0})]})]})}function i7(e){let t=new Map;for(let a of e){if(!(0,ed().Xk)(iY().xm,a.price.product))continue;let e=t.get(a.price.product);void 0===e?t.set(a.price.product,{count:1,billingInterval:a.price.billingInterval}):e.count+=1}return t}let i3={entryContainer:{marginBottom:24},entryHeaderStyle:{fontWeight:a(699422).Wy.bold,fontSize:16,marginBottom:12,marginTop:20,padding:12,backgroundColor:a(632079).oZ.uiLightGray,borderRadius:4,borderInlineStart:`4px solid ${a(632079).Tj.blue.border.accentPrimary}`},entryHeaderSub:{marginTop:4},changesSection:{marginTop:12,marginBottom:12},changesTitle:{fontWeight:a(699422).Wy.medium,fontSize:14,marginBottom:6,color:a(632079).Tj.blue.text.accentPrimary},changesList:{listStyleType:"disc",paddingInlineStart:20,margin:0},changeItem:{fontSize:13,marginBottom:3},noChangesNote:{fontSize:13,marginTop:12,marginBottom:8,color:a(632079).oZ.mediumTextColor,fontStyle:"italic"},rawDiffDetails:{marginTop:8},rawDiffSummary:{cursor:"pointer",fontSize:12,color:a(632079).oZ.mediumTextColor,userSelect:"none"},autoConvertWarning:{marginTop:12,marginBottom:8,padding:"10px 12px",borderRadius:4,backgroundColor:a(632079).Tj.orange.background.primary,borderInlineStart:`3px solid ${a(632079).Tj.orange.border.accentPrimary}`,fontSize:13,color:a(632079).Tj.orange.text.accentPrimary},autoConvertWarningTitle:{fontWeight:a(699422).Wy.medium,marginBottom:4},autoConvertWarningBody:{color:a(632079).Tj.orange.text.secondary}};function i8({entry:e,previousBillingData:t,index:i,totalEntries:r}){var s,o;let l=e.billingData.billingData,c=(null==(s=e.changesSincePrevious)?void 0:s.changes)!==void 0?i$(e.changesSincePrevious.changes):void 0,p=void 0!==c&&void 0!==t?function(e,t,a){let i=[],r=Object.keys(e),s=e.subscription;if(void 0!==s){let{previousValue:e,newValue:t}=s;i.push(...function(e,t){if(void 0===t&&void 0!==e)return["Subscription removed"];if(void 0===e&&void 0!==t)return["Subscription created"];if(void 0===e||void 0===t)return["Subscription changed"];let a=[];e.status!==t.status&&a.push(`Status: ${iU(e.status)} → ${iU(t.status)}`);let i=e.items??[],n=t.items??[],r=iO(i),s=iO(n);if(r!==s)a.push(`Plan: ${r} → ${s}`);else{let e=i.reduce((e,t)=>
100e+t.quantity,0),t=n.reduce((e,t)=>e+t.quantity,0);e!==t&&a.push(`Seats: ${e} → ${t}`)}e.trialEnd!==t.trialEnd&&(!t.trialEnd&&e.trialEnd?a.push("Trial period ended"):t.trialEnd&&!e.trialEnd?a.push(`Trial end set to ${iV(t.trialEnd)}`):a.push(`Trial end updated to ${iV(t.trialEnd)}`));let o=(e.pendingPhases??[]).length>0,l=(t.pendingPhases??[]).length>0;return!o&&l?a.push("Pending subscription change added"):o&&!l&&a.push("Pending subscription change removed / applied"),0===a.length&&a.push("Subscription updated"),a}(e,t))}else{let s=r.filter(e=>e.startsWith("subscription."));s.length>0&&i.push(...function(e){var t,a,i,r;let{changes:s,previousBillingData:o,currentBillingData:l,subKeys:d}=e,c=new Set(d),p=[];if(c.has("subscription.status")){let{previousValue:e,newValue:t}=s["subscription.status"];(0,n().Kg)(e)&&(0,n().Kg)(t)&&p.push(`Status: ${iU(e)} → ${iU(t)}`)}let m=i7((null==(t=o.subscription)?void 0:t.items)??[]),u=i7((null==(a=l.subscription)?void 0:a.items)??[]);for(let e of new Set([...m.keys(),...u.keys()])){let t=(null==(i=m.get(e))?void 0:i.count)??0,a=u.get(e),n=(null==a?void 0:a.count)??0;if(n>t){let i=null!=a&&a.billingInterval?` ${i_(a.billingInterval)}`:"",r=`Add-on added: ${iL(e)}${i}`;for(let e=0;e<n-t;e++)p.push(r)}else if(t>n){let a=`Add-on removed: ${iL(e)}`;for(let e=0;e<t-n;e++)p.push(a)}}let h=new Set;for(let e of d){let[t,a,i,r,o]=iC(e);if("subscription"===t&&"items"===a&&iD(i)&&"price"===r&&"product"===o){let{previousValue:t,newValue:a}=s[e],r=(0,n().Kg)(t)&&(0,ed().Xk)(iY().xm,t),o=(0,n().Kg)(a)&&(0,ed().Xk)(iY().xm,a);r||o||h.add(i)}}for(let e of h){let t=`subscription.items.[${e}].price.product`,a=`subscription.items.[${e}].price.unitAmount.amount`,i=null==(r=l.subscription)||null==(r=r.items)?void 0:r[e],o=void 0!==i?i_(i.price.billingInterval):"",d=(null==i?void 0:i.price.unitAmount.currencyCode)??"USD",{previousValue:c,newValue:m}=s[t],u=s[a],h="Plan changed";if((0,n().Kg)(c)&&(0,n().Kg)(m)&&(h=`Plan: ${iL(c)} → ${iL(m)}`,o&&(h+=` ${o}`)),void 0!==u){let{previousValue:e,newValue:t}=u;(0,n().Et)(e)&&(0,n().Et)(t)?h+=` \xb7 ${iB(e,d)} → ${iB(t,d)}/seat`:(0,n().Et)(t)&&(h+=` \xb7 ${iB(t,d)}/seat`)}p.push(h)}if(0===h.size){let e=new Set;for(let t of d){let[a,i,n,r]=iC(t);"subscription"===a&&"items"===i&&iD(n)&&"quantity"===r&&e.add(n)}for(let t of e){let{previousValue:e,newValue:a}=s[`subscription.items.[${t}].quantity`];(0,n().Et)(e)&&(0,n().Et)(a)&&p.push(`Seats: ${e} → ${a}`)}}if(0===h.size&&c.has("subscription.currentPeriodEnd")){let{newValue:e}=s["subscription.currentPeriodEnd"];(0,n().Kg)(e)&&p.push(`Billing period rolled to ${iV(e)}`)}if(c.has("subscription.trialEnd")){let{previousValue:e,newValue:t}=s["subscription.trialEnd"],a=iK(l,s);if(!t&&e)p.push(a?"Credit card upfront trial ended — billing began":"Trial period ended");else if(t&&!e){let e=iV((0,n().Kg)(t)?t:void 0);p.push(a?`Credit card upfront trial end set to ${e}`:`Trial end set to ${e}`)}else{let e=iV((0,n().Kg)(t)?t:void 0);p.push(a?`Credit card upfront trial end updated to ${e}`:`Trial end updated to ${e}`)}}return 0===p.length&&p.push("Subscription updated"),p}({changes:e,previousBillingData:t,currentBillingData:a,subKeys:s}))}let o=e.trial;if(void 0!==o)i.push(...function(e,t){if(void 0===t&&void 0!==e)return e.autoConvert?["Trial auto-converted to subscription"]:["Trial ended without conversion"];if(void 0===e&&void 0!==t){let e=t.autoConvert?" (auto-converts to subscription)":"",a=` (ends ${iV(t.endDate)})`;return[`Trial started${a}${e}`]}return void 0!==e&&void 0!==t?e.endDate!==t.endDate?[`Trial end updated to ${iV(t.endDate)}`]:["Trial updated"]:["Trial changed"]}(o.previousValue,o.newValue));else{let t=r.filter(e=>e.startsWith("trial."));t.length>0&&i.push(...function(e,t){let a=new Set(t),i=[];if(a.has("trial.endDate")){let{previousValue:t,newValue:a}=e["trial.endDate"];!t&&a?i.push(`Trial end set to ${iV((0,n().Kg)(a)?a:void 0)}`):t&&!a?i.push("Trial end date removed"):i.push(`Trial end updated to ${iV((0,n().Kg)(a)?a:void 0)}`)}if(a.has("trial.autoConvert")){let{newValue:t}=e["trial.autoConvert"];!0===t?i.push("Trial auto-convert enabled"):!1===t&&i.push("Trial auto-convert disabled")}let r=new Set;for(let e of t){let[t,a,i,n]=iC(e);"trial"===t&&"items"===a&&iD(i)&&"quantity"===n&&r.add(i)}for(let t of r){let{previousValue:a,newValue:r}=e[`trial.items.[${t}].quantity`];(0,n().Et)(a)&&(0,n().Et)(r)&&i.push(`Trial seats: ${a} → ${r}`)}return 0===i.length&&i.push("Trial updated"),i}(e,t))}let l=r.filter(e=>"invoices"===e||e.startsWith("invoices."));l.length>0&&i.push(...function(e,t){let a=[];for(let i of t.filter(t=>/^invoices\.\[\d+\]$/.test(t)&&void 0===e[t].previousValue)){let t=e[i].newValue;if(iP(t)){let e=(0,n().Kg)(t.externalId)?t.externalId:"?",i=(0,n().Kg)(t.status)?iU(t.status):"?",r=(0,n().Et)(t.amountDue)?t.amountDue:void 0,s=(0,n().Kg)(t.currency)?t.currency:"USD",o=void 0!==r?` \xb7 ${i
100B(r,s)}`:"";a.push(`Invoice added: ${e} \xb7 ${i}${o}`)}}return a}(e,l));let d=e.paymentMethod;if(void 0!==d){let{previousValue:e,newValue:t}=d;void 0===t&&void 0!==e?i.push("Payment method removed"):void 0!==t&&void 0===e?i.push(`Payment method added (${iF(t)})`):i.push(`Payment method changed (${iF(t)})`)}let c=e.email;if(void 0!==c){let{previousValue:e,newValue:t}=c;if(void 0!==t){let a=void 0!==e?`${e} → `:"";i.push(`Billing email: ${a}${t}`)}}let p=e.externalId;if(void 0!==p){let{previousValue:e,newValue:t}=p;if(void 0!==t){let a=void 0!==e?`${e} → `:"";i.push(`Customer ID: ${a}${t}`)}}let m=e.provider;if(void 0!==m){let{previousValue:e,newValue:t}=m;if(void 0!==t){let a=void 0!==e?`${e} → `:"";i.push(`Provider: ${a}${t}`)}}let u=e.lockedCurrencyCode;if(void 0!==u){let{previousValue:e,newValue:t}=u;void 0!==t&&void 0===e?i.push(`Currency locked to ${t}`):void 0===t&&void 0!==e&&i.push("Currency lock removed")}let h=e.hasPaidNonzero;if(void 0!==h){let{previousValue:e,newValue:t}=h;!0===t&&!0!==e&&i.push("First payment recorded")}return i}(c,t,l):[],m=l.trial,u=null==(o=l.clock)?void 0:o.now,h=0===i&&void 0!==m&&m.autoConvert&&void 0!==u&&new Date(m.endDate)<new Date(u),y=void 0!==m&&void 0!==u&&new Date(m.endDate)<new Date(u);return(0,d.jsxs)("div",{style:i3.entryContainer,children:[(0,d.jsxs)("div",{style:i3.entryHeaderStyle,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",colorVariant:"primary",children:`Entry ${i+1}: ${e.startTime}`}),(0,d.jsx)("div",{style:i3.entryHeaderSub,children:(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"primary",children:`ID: ${e.id} | ISO: ${e.startTimeISO}`})}),(0,d.jsx)("div",{style:i3.entryHeaderSub,children:(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"primary",children:function(e){if(void 0===e||0===e.length)return"Invoices: none";let t=new Map;for(let a of e)t.set(a.status,(t.get(a.status)??0)+1);let a=Array.from(t,([e,t])=>`${t} ${e}`),i=new Map;for(let t of e){let{currency:e,amountDue:a}=t;void 0!==e&&void 0!==a&&i.set(e,(i.get(e)??0)+a)}if(0===i.size)return`Invoices: ${a.join(" · ")}`;let n=Array.from(i,([e,t])=>iB(t,e));return`Invoices: ${a.join(" · ")} \xb7 ${n.join(" + ")} total`}(l.invoices)})})]}),(0,d.jsx)("div",{style:i3.changesSection,children:void 0===c?i===r-1?(0,d.jsx)("div",{style:i3.noChangesNote,children:"Initial entry — baseline snapshot"}):(0,d.jsx)("div",{style:i3.noChangesNote,children:"No changes from previous entry"}):(0,d.jsxs)(d.Fragment,{children:[p.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:i3.changesTitle,children:"What changed:"}),(0,d.jsx)("ul",{style:i3.changesList,children:p.map((e,t)=>(0,d.jsx)("li",{style:i3.changeItem,children:e},t))})]}):(0,d.jsx)("div",{style:i3.noChangesNote,children:"No recognized field changes — see diff below"}),(0,d.jsxs)("details",{style:i3.rawDiffDetails,children:[(0,d.jsx)("summary",{style:i3.rawDiffSummary,children:"Show all changes"}),(0,d.jsx)(iQ,{changes:c})]})]})}),(h||y)&&void 0!==m?(0,d.jsxs)("div",{style:i3.autoConvertWarning,children:[(0,d.jsx)("div",{style:i3.autoConvertWarningTitle,children:h?"⚠ Auto-convert may not have completed":"⚠ Trial present past its end date"}),(0,d.jsx)("div",{style:i3.autoConvertWarningBody,children:h?`Trial ended ${new Date(m.endDate).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} but this is the most recent snapshot. Check the autoConvertStackedTrial task queue and Stripe for current state.`:`Trial end date was ${new Date(m.endDate).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} but the trial is still present in this snapshot. This likely indicates a failed or delayed auto-conversion at the time this entry was recorded.`})]}):null,(0,d.jsx)(i9,{billingData:l,snapshotTimeISO:e.startTimeISO})]})}function i5({entries:e}){return(0,d.jsx)(d.Fragment,{children:e.map((t,a)=>{var i;return(0,d.jsx)(i8,{entry:t,previousBillingData:null==(i=e[a+1])?void 0:i.billingData.billingData,index:a,totalEntries:e.length},t.id)})})}let ne={style0:{marginBottom:16},style1:{marginBottom:24},style2:{marginTop:4},headerStyle:{fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:8,marginTop:16},tabBarContainer:{marginBottom:16},entryHeaderStyle:{fontWeight:a(699422).Wy.bold,fontSize:16,marginBottom:12,marginTop:20,padding:12,backgroundColor:a(632079).oZ.uiLightGray,borderRadius:4,borderInlineStart:`4px solid ${a(632079).Tj.blue.border.accentPrimary}`},changesHeaderStyle:{fontWeight:a(699422).Wy.medium,fontSize:14,marginBottom:8,marginTop:12,color:a(632079).Tj.blue.text.accentPrimary},noChangesStyle:{fontSize:14,marginBottom:8,marginTop:12,color:a(632079).oZ.mediumTextColor,fontStyle:"italic"}},nt={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:8,marginTop:16},tabBarContainer:{marginBottom:16},outOfSyncBanner:{marginBottom:20,padding:"12px 16px",borderRadius:4,backgroundColor:a(632079).Tj.red.background.primary,borderInlineStart:`4px solid ${a(632079).Tj.red.border.accentPrimary}`},outOfSyncTitle:{fontWeight:a(699422).Wy.bold,fontSize:14,color:a(632079).Tj.red.text.accentPrimary,marginBottom:4},outOfSyncBody:{fontSize:13,color:a(632079).Tj.red.text.secondary,marginBottom:12},snapshotSection:{marginBottom:24},snapshotHeader:{fontWeight:a(699422).Wy.bold,fontSize:14,marginBottom:6,color:a(632079).oZ.mediumTextColor,letterSpacing:"0.04em"},rowIdsLine:{fontSize:13,marginBottom:16,color:a(632079).oZ.mediumTextColor},rowIdsLabel:{fontWeight:a(699422).Wy.bold}};function na({label:e,billingData:t}){return(0,d.jsxs)("div",{style:nt.snapshotSection,children:[(0,d.jsx)("div",{style:nt.snapshotHeader,children:e.toUpperCase()}),(0,d.jsx)(i9,{billingData:t})]})}function ni({isOutOfSync:e,outOfSyncFields:t}){if(!e)return null;let a=function(e){if(!iP(e))return;let t={};for(let[a,i]of Object.entries(e))iP(i)&&"previousValue"in i&&"newValue"in i&&(t[a]={previousValue:i.previousValue,newValue:i.newValue});return t}(t),i=void 0!==a?i$(a):void 0;return(0,d.jsxs)("div",{style:nt.outOfSyncBanner,children:[(0,d.jsx)("div",{style:nt.outOfSyncTitle,children:"⚠ Cache / live data out of sync"}),(0,d.jsx)("div",{style:nt.outOfSyncBody,children:"The loaded (cached) billing data differs from the freshly fetched (live) data. The diff below shows loaded as BEFORE and fetched as AFTER."}),void 0!==i?(0,d.jsx)(iQ,{changes:i}):null]})}let nn={cursor:"pointer",paddingBlock:8,paddingInline:0,userSelect:"none",background:"none",border:"none",textAlign:"start",font:"inherit",color:"inherit",width:"100%"},nr={transition:"transform 100ms ease"},ns={transform:"rotateZ(90deg)"},no={paddingBlock:6},nl={fontFamily:"monospace"},nd=["People","Library"],nc={person_profile_main:"Person profile blockId",people_collection_view_page:"People collection view blockId",library_collection_view_page:"Library collection view blockId",teamspaceDirectory:"Teamspace directory (collection view ID)",recents:"Recents (collection view ID)",favorites:"Favorites (collection view ID)",shared:"Shared (collection view ID)",private:"Private (collection view ID)",myMeetings:"My meetings (collection view ID)",agents:"Agents (collection view ID)",skills:"Skills (collection view ID)",xldb:"Core data (collection view ID)",libraryExternalPages:"Exter
100nal pages (collection view ID)"},np={person_profile_main:"People",people_collection_view_page:"People",library_collection_view_page:"Library",teamspaceDirectory:"Library",recents:"Library",favorites:"Library",shared:"Library",private:"Library",myMeetings:"Library",agents:"Library",skills:"Library",xldb:"Library",libraryExternalPages:"Library"};function nm(e){let{entry:t}=e;return(0,d.jsx)("div",{style:no,children:(0,d.jsxs)(a(4458).fI,{gap:12,alignItems:"center",justifyContent:"space-between",children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t.label}),(0,d.jsx)(a(799615).B,{value:t.id,formatUuid:!0,children:(0,d.jsx)("span",{style:nl,children:(0,d.jsx)(a(137691).x5,{value:t.id})})})]})})}function nu(e){let{groupTitle:t,entries:i}=e,[n,s]=(0,r.useState)(!0),o=n?{...nr,...ns}:nr;return(0,d.jsxs)(a(4458).VP,{gap:0,children:[(0,d.jsx)("button",{type:"button",style:nn,onClick:()=>s(e=>!e),"aria-expanded":n,children:(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)("span",{style:o,children:(0,d.jsx)(a(16275).I,{icon:a(342392).arrowChevronSingleRightIcon})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t})]})}),n?(0,d.jsx)(a(4458).VP,{gap:0,children:i.map(e=>(0,d.jsx)(nm,{entry:e},e.label))}):void 0]})}function nh(e){return"wouldShowBanner"in e&&"migrationExecutionGate"in e}function ny({data:e}){let{copy:t,locale:i,wouldShowBanner:n,reason:s}=e,o=(0,r.useCallback)(()=>{void 0!==t&&window.open(t.learnMoreUrl,"_blank","noopener,noreferrer")},[t]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:ng.status,children:n?`Shown on this workspace's billing page, in ${i}.`:`Not shown. ${s??"No reason reported."}`}),void 0===t?(0,d.jsx)("div",{style:ng.status,children:"No banner copy to preview for this workspace."}):(0,d.jsxs)(d.Fragment,{children:[n?void 0:(0,d.jsx)("div",{style:ng.status,children:`Previewing the copy the workspace would see once enabled, in ${i}:`}),(0,d.jsx)(a(748356).l,{display:"inline",tint:"gray",iconGroup:a(773225).H,label:t.title,description:t.description,actions:[{label:(0,d.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[t.learnMore,(0,d.jsx)(a(16275).I,{icon:a(969278).arrowStraightRightSmallIcon,size:"sm"})]}),onClick:o}]})]})]})}let ng={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:20,marginBottom:8,marginTop:16},jsonContainer:{marginTop:20},status:{fontSize:14,marginBottom:12}},nx={heading:{fontWeight:a(699422).Wy.semibold,marginBottom:8},subtle:{color:a(632079).Tj.text.secondary,marginBottom:12}},nf={container:{fontFamily:a(699422).Tf.mono,fontSize:13},header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:12,paddingBottom:8,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},section:{marginBottom:16},sectionTitle:{fontWeight:a(699422).Wy.semibold,fontSize:14,marginBottom:8,cursor:"pointer",display:"flex",alignItems:"center",gap:8},metadataGrid:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",marginBottom:16},metadataLabel:{color:a(632079).Tj.text.secondary},metadataValue:{fontFamily:a(699422).Tf.mono},metadataLabelError:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.semibold},metadataValueError:{fontFamily:a(699422).Tf.mono,color:a(632079).Tj.red.text.accentPrimary,fontSize:11},typeErrorBadge:{color:a(632079).Tj.orange.text.accentPrimary,backgroundColor:a(632079).Tj.orange.background.secondary,padding:"2px 6px",borderRadius:4,fontSize:11,marginInlineStart:8},truncationWarning:{color:a(632079).Tj.orange.text.accentPrimary,backgroundColor:a(632079).Tj.orange.background.secondary,padding:"8px 12px",borderRadius:4,marginBottom:16,fontWeight:a(699422).Wy.medium},treeContainer:{paddingInlineStart:0},treeNode:{marginBottom:4},treeNodeHeader:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",padding:"4px 8px",borderRadius:4},treeNodeHeaderHover:{backgroundColor:a(632079).Tj.background.secondary},treeNodeToggle:{width:16,textAlign:"center",color:a(632079).Tj.text.secondary},treeNodeClickable:{cursor:"pointer",display:"inline-flex",alignItems:"baseline",gap:4,padding:"2px 4px",borderRadius:4},treeNodeClickableHover:{backgroundColor:a(632079).Tj.red.background.secondary},treeNodeType:{color:a(632079).Tj.text.primary,fontWeight:a(699422).Wy.medium},treeNodeId:{color:a(632079).Tj.text.secondary,fontSize:11},treeNodeMetadata:{padding:"8px 12px",marginInlineStart:24,backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,fontSize:12},treeChildren:{marginInlineStart:20},recordList:{maxHeight:400,overflow:"auto",border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4},recordItem:{padding:"8px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,cursor:"pointer"},recordItemHover:{backgroundColor:a(632079).Tj.background.secondary},collapseIcon:{transition:"transform 0.2s"}
100,expandedIcon:{transform:"rotate(90deg)"},deletedBadge:{color:a(632079).Tj.red.text.accentPrimary},deletedChildBadge:{color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.secondary,padding:"2px 6px",borderRadius:4,fontSize:11,marginInlineStart:8},deletedChildType:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.medium},deletedChildId:{color:a(632079).Tj.red.text.accentPrimary,fontSize:11},orphanedChildBadge:{color:a(632079).Tj.yellow.text.primary,backgroundColor:a(632079).Tj.yellow.background.secondary,padding:"2px 6px",borderRadius:4,fontSize:11,marginInlineStart:8},orphanedChildType:{color:a(632079).Tj.yellow.text.primary,fontWeight:a(699422).Wy.medium},orphanedChildId:{color:a(632079).Tj.yellow.text.primary,fontSize:11},treeNodeIdClickable:{cursor:"pointer"},metadataContainer:{marginTop:8,paddingInlineStart:24}};function nb(e){return void 0===e?"N/A":new Date(e).toLocaleString()}function nv(e){let t=null==e?void 0:e.includes("deleted"),a=null==e?void 0:e.includes("orphaned");return t&&a?(0,d.jsx)("span",{style:nf.deletedBadge,children:"(deleted)"}):t?(0,d.jsx)("span",{style:nf.deletedChildBadge,children:"(alive = false)"}):a?(0,d.jsx)("span",{style:nf.orphanedChildBadge,children:"(not in parent's content)"}):void 0}function nj(e){var t,i,n,s;let{node:o,level:l}=e,[c,p]=(0,r.useState)(l<2),[m,u]=(0,r.useState)(!1),[h,y]=(0,r.useState)(!1),[g,x]=(0,r.useState)(!1),f=o.childrenNodes.length>0,b=()=>p(!c),v=()=>u(!m),j={...nf.treeNodeHeader,...h?nf.treeNodeHeaderHover:{}},k={...nf.treeNodeClickable,...g?nf.treeNodeClickableHover:{}};return(0,d.jsxs)("div",{style:nf.treeNode,children:[(0,d.jsxs)("div",{style:j,onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),children:[(0,d.jsx)("span",{role:f?"button":void 0,tabIndex:f?0:void 0,style:{...nf.treeNodeToggle,...nf.collapseIcon,...c&&f?nf.expandedIcon:{}},onClick:f?b:void 0,onKeyDown:f?e=>{("Enter"===e.key||" "===e.key)&&b()}:void 0,children:f?"▶":"·"}),(0,d.jsxs)("span",{role:"button",tabIndex:0,style:k,onClick:v,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&v()},children:[(0,d.jsx)("span",{style:null!=(t=o.metadata.deadChildReasons)&&t.includes("deleted")?nf.deletedChildType:null!=(i=o.metadata.deadChildReasons)&&i.includes("orphaned")?nf.orphanedChildType:nf.treeNodeType,children:o.type??o.table}),(0,d.jsx)("span",{style:null!=(n=o.metadata.deadChildReasons)&&n.includes("deleted")?nf.deletedChildId:null!=(s=o.metadata.deadChildReasons)&&s.includes("orphaned")?nf.orphanedChildId:nf.treeNodeId,children:(0,d.jsx)(a(137691).x5,{value:o.id})})]}),nv(o.metadata.deadChildReasons),void 0!==o.metadata.typeErrors&&o.metadata.typeErrors.length>0?(0,d.jsxs)("span",{style:nf.typeErrorBadge,children:["⚠ ",o.metadata.typeErrors.length," type error",o.metadata.typeErrors.length>1?"s":""]}):void 0]}),m?(0,d.jsx)("div",{style:nf.treeNodeMetadata,children:(0,d.jsx)(nS,{metadata:o.metadata})}):void 0,c&&f?(0,d.jsx)("div",{style:nf.treeChildren,children:o.childrenNodes.map(e=>(0,d.jsx)(nj,{node:e,level:l+1},e.id))}):void 0]})}let nk="undefined";function nS(e){let{metadata:t}=e;return(0,d.jsxs)("div",{style:nf.metadataGrid,children:[(0,d.jsx)("span",{style:nf.metadataLabel,children:"ID:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:(0,d.jsx)(a(137691).x5,{value:t.id})}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Table:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:t.table}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Type:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:t.type??nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Version:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:t.version??nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Alive:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.alive?t.alive?"Yes":"No":nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Parent ID:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.parentId?(0,d.jsx)(a(137691).x5,{value:t.parentId}):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Parent Table:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:t.parentTable??nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Created:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.createdTime?nb(t.createdTime):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Last Edited:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.lastEditedTime?nb(t.lastEditedTime):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Created By:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.createdById?(0,d.jsx)(a(137691).x5,{value:t.createdById}):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Last Edited By:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.lastEditedById?(0,d.jsx)(a(137691).x5,{value:t.lastEditedById}):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Space ID:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.spaceId?(0,d.jsx)(a(137691).x5,{value:t.spaceId}):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Collection ID:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.collectionId?(0,d.jsx)(a(137691).x5,{value:t.collectionId}):nk}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Children:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:void 0!==t.content&&t.content.length>0?`${t.content.length} blocks`:nk}),void 0!==t.typeErrors&&t.typeErrors.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:nf.metadataLabelError,children:"Type Errors:"}),(0,d.jsx)("span",{style:nf.metadataValueError,children:t.typeErrors.map((e,t)=>(0,d.jsxs)("div",{children:[e.field,": expected ",e.expectedType,", got"," ",e.actualValue]},t))})]}):void 0]})}function nw(e){let{title:t,count:a,children:i,defaultExpanded:n=!0}=e,[s,o]=(0,r.useState)(n);return(0,d.jsxs)("div",{style:nf.section,children:[(0,d.jsxs)("div",{role:"button",tabIndex:0,style:nf.sectionTitle,onClick:()=>o(!s),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&o(!s)},children:[(0,d.jsx)("span",{style:{...nf.collapseIcon,...s?nf.expandedIcon:{}},children:"▶"}),t,void 0!==a?` (${a})`:void 0]}),s?i:void 0]})}function nI(e){var t,i,n,s;let{record:o}=e,[l,c]=(0,r.useState)(!1),[p,m]=(0,r.useState)(!1),u={...nf.recordItem,...p?nf.recordItemHover:{}};return(0,d.jsxs)("div",{role:"button",tabIndex:0,style:u,onClick:()=>c(!l),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&c(!l)},onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)("span",{style:{...nf.collapseIcon,...l?nf.expandedIcon:{}},children:"▶"}),(0,d.jsx)("span",{style:null!=(t=o.deadChildReasons)&&t.includes("deleted")?nf.deletedChildType:null!=(i=o.deadChildReasons)&&i.includes("orphaned")?nf.orphanedChildType:nf.treeNodeType,children:o.type??o.table}),(0,d.jsx)("span",{style:{...null!=(n=o.deadChildReasons)&&n.includes("deleted")?nf.deletedChildId:null!=(s=o.deadChildReasons)&&s.includes("orphaned")?nf.orphanedChildId:nf.treeNodeId,...nf.treeNodeIdClickable},children:(0,d.jsx)(a(137691).x5,{value:o.id})}),nv(o.deadChildReasons)]}),l?(0,d.jsx)("div",{style:nf.metadataContainer,children:(0,d.jsx)(nS,{metadata:o})}):void 0]})}let nC={marginBottom:"10px"},nD={marginBottom:16},nT={marginBottom:8},nR={listStyleType:"disc",paddingInlineStart:32,margin:0},nA={marginBottom:4};var nN=()=>a(80279);let nM=(0,a(477465).Dv)("adminDiagnoseSkillSystemForUserInSpaceTask");(0,a(477465).aI)("adminDiagnoseSkillSystemForUserInSpaceTask");var nP=()=>a(655696);let nV={generatedAtMs:a(764657).number(),requested:a(764657).object({required:{spaceId:a(764657).string(),userId:a(764657).string()},optional:{}})},nE=a(764657).object({required:nV,optional:{}}),nB={generatedAtMs:a(764657).number(),requested:a(764657).object({required:{spaceId:a(764657).string()},optional:{}})},nL=a(764657).object({required:nB,optional:{}}
100),n_=a(764657).union([a(764657).object({required:{type:a(764657).literal("progress"),stage:a(764657).literals("load_gates","load_space_views","load_settings_candidates","load_exact_access","analyze_rich_text","analyze_favorites_migration","finalize_report"),message:a(764657).string()},optional:{}}),a(764657).object({required:{type:a(764657).literal("completed"),stage:a(764657).literal("finalize_report"),report:nE},optional:{}}),a(764657).object({required:{type:a(764657).literal("failed"),message:a(764657).string()},optional:{}})]),nU=a(764657).union([a(764657).object({required:{type:a(764657).literal("progress"),stage:a(764657).literals("load_live_skills","load_space_views","load_assistant_favorites","build_user_rows"),message:a(764657).string()},optional:{}}),a(764657).object({required:{type:a(764657).literal("completed"),stage:a(764657).literal("finalize_report"),report:nL},optional:{}}),a(764657).object({required:{type:a(764657).literal("failed"),message:a(764657).string()},optional:{}})]);function nW(e){let{healthyCount:t,label:i,children:n}=e,[s,o]=(0,r.useState)(!1),l=(0,r.useCallback)(()=>{o(e=>!e)},[]);if(0===t)return null;let c=i??"items";return(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(988022).p,{size:"sm",onClick:l,children:s?`Hide healthy ${c} (${t})`:`Show healthy ${c} (${t})`}),s?n:void 0]})}function nF(e){let{gates:t}=e,i=[];t.isSpaceAiEnabled||i.push("AI is off for this workspace"),t.isPromptPagesEnabledForUser||i.push("Skill pages feature is disabled"),t.isDailyBriefEnabled||i.push("Daily brief is disabled");let n=0===i.length;return(0,d.jsxs)(a(4458).fI,{gap:6,flexWrap:"wrap",alignItems:"center",children:[n?(0,d.jsx)(a(746434).E,{content:"All gates passing",color:"green"}):i.map(e=>(0,d.jsx)(a(746434).E,{content:e,color:"red"},e)),t.isGuestInSpace?(0,d.jsx)(a(746434).E,{content:"Guest (can't migrate favorites)",color:"yellow"}):void 0]})}let nK={mono:{fontFamily:"monospace",fontSize:11},tabularNums:{fontVariantNumeric:"tabular-nums"},statCard:{padding:10,borderRadius:6,background:a(632079).Tj.background.secondary}
100,barTrack:{height:6,borderRadius:3,background:a(632079).Tj.background.tertiary,overflow:"hidden",flexGrow:1},barFill:{height:"100%",borderRadius:3,background:a(632079).Tj.blue.background.accentSecondary,minWidth:1},bucketLabel:{width:72,textAlign:"end",flexShrink:0,fontVariantNumeric:"tabular-nums"},countLabel:{width:44,textAlign:"end",flexShrink:0,fontVariantNumeric:"tabular-nums"},sectionHeader:{cursor:"pointer",paddingBlock:12,borderBlockStart:`1px solid ${a(632079).Tj.border.primary}`}};function n$(e){return(0,d.jsx)("span",{style:nK.mono,children:e.id})}function nO(e){let{title:t,diagnosisCount:i,alwaysExpand:n,headerSummary:s,children:o}=e,l=i>0,[c,p]=(0,r.useState)(void 0),m=void 0!==c?c:l||(n??!1),u=(0,r.useCallback)(()=>{p(e=>!(void 0!==e?e:l||(n??!1)))},[l,n]);return(0,d.jsxs)(a(4458).VP,{children:[(0,d.jsx)("div",{style:nK.sectionHeader,children:(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(988022).p,{size:"sm",iconLeading:m?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,onClick:u,"aria-label":m?"Collapse":"Expand"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:t}),l?(0,d.jsx)(a(746434).E,{content:`${i} ${1===i?"issue":"issues"}`,color:i>3?"red":"yellow"}):(0,d.jsx)(a(746434).E,{content:"OK",color:"green"}),s]})}),m?(0,d.jsx)(a(577497).Zp,{padding:"md",children:o}):void 0]})}function nz(e){let t=(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:e.label});return(0,d.jsxs)(a(4458).VP,{gap:2,style:nK.statCard,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyLgSemibold",colorVariant:"primary",children:(0,d.jsx)("span",{style:nK.tabularNums,children:e.value.toLocaleString()})}),e.tooltip?(0,d.jsx)(a(51831).m_,{content:t=>(0,d.jsx)("div",{...t,children:e.tooltip}),children:e=>(0,d.jsx)("span",{...e,style:{cursor:"help",borderBlockEnd:`1px dotted ${a(632079).Tj.border.secondary}`},children:t})}):t]})}function nG(e){let{status:t,headline:i,diagnoses:n,statChips:r}=e;if("healthy"===t)return(0,d.jsx)(a(748356).l,{display:"inline",tint:"gray",label:i});let s="warning"===t?"yellow":"red",o=r&&r.length>0?` \xb7 ${r.map(e=>`${e.value} ${e.label}`).join(", ")}`:"";return(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(748356).l,{display:"inline",tint:s,label:`${i}${o}`}),n.map(e=>(0,d.jsx)(a(577497).Zp,{padding:"sm",colorPalette:"yellow"===s?"orange":"red",colorVariant:"secondaryTranslucent",children:(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,d.jsx)(a(746434).E,{content:e.code,color:"gray"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:e.summary})]}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:e.detail})]})},e.code))]})}let nq={summaryGrid:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(140px, 1fr))",gap:8},itemRow:{borderBlockStart:`1px solid ${a(632079).Tj.border.secondary}`,paddingBlock:8}},nH={prefilter_excluded:"Excluded from search results",legacy_team_permission_prefilter_miss:"May be missing from search results",dead_block:"Block deleted",dead_path:"Parent page deleted",missing_prompt:"Skill data missing",not_ai_skill:"Not a skill page",missing_mapping:"No page exists for this built-in skill",invalid_materialized_page:"Page exists but is not a valid skill"};function nZ(e,t){return"outside_default_window"===e&&t?`Beyond default limit (${t.defaultCandidateLimit.toLocaleString()})`:"outside_load_all_window"===e&&t?`Beyond Load All limit (${t.loadAllCandidateLimit.toLocaleString()})`:nH[e]??e}function nJ(){let[e,t]=(0,r.useState)(!1),[a,i]=(0,r.useState)(""),[n,s]=(0,r.useState)(20);return{expanded:e,search:a,setSearch:i,pageSize:n,toggle:(0,r.useCallback)(()=>t(e=>!e),[]),showMore:(0,r.useCallback)(()=>s(e=>e+20),[])}}let nQ={fully_healthy:"Migrated successfully",intentionally_skipped:"Skipped (expected)",legacy_only:"Stuck in old format",starter_only:"Partially migrated",migrated_not_visible:"Migrated but not accessible",inconsistent_state:"Data conflict"};function nY(e){switch(e){case"fully_healthy":return"green";case"intentionally_skipped":return"gray";case"legacy_only":case"starter_only":return"yellow";default:return"red"}}function nX(e){switch(e){case"inconsistent_state":return 0;case"migrated_not_visible":return 1;case"legacy_only":return 2;case"starter_only":return 3;case"intentionally_skipped":return 4;case"fully_healthy":return 5;default:return 6}}
100function n0(e){let{spaceView:t}=e,i=t.aiPrompts,n=t.issues.length,r=t.liveSpaceViewIds.length>1,s=t.deadSpaceViewIds.length>0,o=!t.activeSpaceViewId;return(0,d.jsx)(nO,{title:"User's workspace membership",diagnosisCount:n,headerSummary:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${t.liveSpaceViewIds.length} active \xb7 ${t.deadSpaceViewIds.length} deleted`}),children:(0,d.jsxs)(a(4458).VP,{gap:8,children:[n>0?(0,d.jsx)(a(4458).fI,{gap:6,flexWrap:"wrap",children:t.issues.map(e=>(0,d.jsx)(a(746434).E,{content:e,color:"yellow"},e))}):void 0,o?(0,d.jsx)(a(746434).E,{content:"No active membership",color:"red"}):r?(0,d.jsx)(a(746434).E,{content:`${t.liveSpaceViewIds.length} active memberships (expected 1)`,color:"yellow"}):void 0,s?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${t.deadSpaceViewIds.length} deleted ${1===t.deadSpaceViewIds.length?"membership":"memberships"}`}):void 0,i.richTextSkillIds.length>0?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${i.richTextSkillIds.length} custom ${1===i.richTextSkillIds.length?"skill":"skills"} pinned in editor`}):void 0,i.skillContainerPageId?(0,d.jsxs)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:["Skill pages stored in: ",(0,d.jsx)(n$,{id:i.skillContainerPageId})]}):void 0,t.activeSpaceViewId?(0,d.jsxs)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:["ID: ",(0,d.jsx)(n$,{id:t.activeSpaceViewId})]}):void 0]})})}function n1(e){let{surface:t,richTextSurface:i}=e,n=nJ(),s=i.enabledDefaultSkillTypes.length,o=i.effectiveDisabledDefaultSkillTypes.length,l="materialized"===i.defaultSkillMode,c=t.finalAccessibleCountNoLimit+s,{issueRows:p,healthyRows:m}=(0,r.useMemo)(()=>({issueRows:t.rows.filter(e=>e.diagnoses.length>0||e.possibleLegacyTeamPermissionPrefilterMiss),healthyRows:t.rows.filter(e=>0===e.diagnoses.length&&!e.possibleLegacyTeamPermissionPrefilterMiss)}),[t.rows]),u=(0,r.useMemo)(()=>i.defaultMappedRows.filter(e=>!!e.disabled||(l?e.diagnoses.length>0:e.diagnoses.some(e=>"missing_mapping"!==e))),[i.defaultMappedRows,l]),h=p.length+u.length,y=(0,r.useMemo)(()=>{let e=n.search.trim().toLowerCase();return""===e?p:p.filter(t=>t.blockId.toLowerCase().includes(e)||t.promptId.toLowerCase().includes(e)||(t.category??"").toLowerCase().includes(e)||t.matchReasons.some(t=>t.toLowerCase().includes(e)))},[p,n.search]),g=y.slice(0,n.pageSize),x=t.finalAccessibleCountOutsideLoadAllWindow>0||t.finalAccessibleCountInsideLoadAllWindow>t.finalAccessibleCountInsideDefaultWindow;return(0,d.jsx)(nO,{title:"Skills in Settings",diagnosisCount:h,headerSummary:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`User sees ${c} skills (${t.finalAccessibleCountNoLimit} custom + ${s} built-in)`}),children:(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).fI,{gap:12,flexWrap:"wrap",alignItems:"center",children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${t.finalAccessibleCountNoLimit} custom skill ${1===t.finalAccessibleCountNoLimit?"page":"pages"}`}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${s} built-in ${l?"(saved as pages)":"(system-provided)"}`}),o>0?(0,d.jsx)(a(746434).E,{content:`${o} built-in disabled`,color:"gray"}):void 0,t.candidatePromptCountNoLimit!==t.finalAccessibleCountNoLimit?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${t.candidatePromptCountNoLimit} total in workspace`}):void 0]}),(0,d.jsx)(a(4458).fI,{gap:6,flexWrap:"wrap",children:i.defaultMappedRows.map(e=>{let t=u.includes(e);return(0,d.jsx)(a(746434).E,{content:e.skillType,color:e.disabled?"gray":t?"yellow":"green"},e.skillType)})}),x?(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`Settings loads the first ${t.defaultCandidateLimit.toLocaleString()} skills by default, up to ${t.loadAllCandidateLimit.toLocaleString()} with Load All.`}),(0,d.jsxs)("div",{style:nq.summaryGrid,children:[(0,d.jsx)(nz,{value:t.finalAccessibleCountInsideDefaultWindow,label:"Visible on first load",tooltip:`Skills within the first ${t.defaultCandidateLimit.toLocaleStr
100ing()} results shown when Settings opens`}),(0,d.jsx)(nz,{value:t.finalAccessibleCountInsideLoadAllWindow-t.finalAccessibleCountInsideDefaultWindow,label:"Need Load All",tooltip:`Additional skills visible only after clicking Load All (between ${t.defaultCandidateLimit.toLocaleString()} and ${t.loadAllCandidateLimit.toLocaleString()})`}),(0,d.jsx)(nz,{value:t.finalAccessibleCountOutsideLoadAllWindow,label:"Not discoverable",tooltip:`Skills beyond the ${t.loadAllCandidateLimit.toLocaleString()} limit — this user cannot find these in Settings`})]})]}):void 0,u.length>0?(0,d.jsx)(a(4458).VP,{gap:4,children:u.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:e.skillType}),e.disabled?(0,d.jsx)(a(746434).E,{content:"Disabled by user",color:"gray"}):void 0,e.diagnoses.filter(e=>l||"missing_mapping"!==e).map(e=>(0,d.jsx)(a(746434).E,{content:nZ(e),color:"yellow"},e))]},e.skillType))}):void 0,p.length>0?(0,d.jsx)(a(439423).v,{title:"Custom skills with issues",count:p.length,filteredCount:y.length,visibleCount:g.length,isExpanded:n.expanded,onToggle:n.toggle,onShowMore:n.showMore,isFirst:!0,isLast:!0,searchQuery:n.search,onSearchChange:n.setSearch,children:g.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.blockId})}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:void 0!==e.candidateOrdinal?`#${e.candidateOrdinal}`:"excluded"}),e.category?(0,d.jsx)(a(746434).E,{content:e.category,color:"blue"}):void 0,(0,d.jsx)(a(746434).E,{content:"first load",color:e.visibleInDefaultWindow?"green":"gray"}),(0,d.jsx)(a(746434).E,{content:"Load All",color:e.visibleInLoadAllWindow?"green":"gray"}),e.possibleLegacyTeamPermissionPrefilterMiss?(0,d.jsx)(a(746434).E,{content:"May be missing from search results",color:"red"}):void 0,e.diagnoses.map(e=>(0,d.jsx)(a(746434).E,{content:nZ(e,t),color:"yellow"},e))]},e.blockId))}):void 0,(0,d.jsx)(nW,{healthyCount:m.length,label:"custom skills",children:(0,d.jsx)(a(4458).VP,{gap:0,children:m.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.blockId})}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:void 0!==e.candidateOrdinal?`#${e.candidateOrdinal}`:"excluded"}),e.category?(0,d.jsx)(a(746434).E,{content:e.category,color:"blue"}):void 0,(0,d.jsx)(a(746434).E,{content:"OK",color:"green"})]},e.blockId))})})]})})}function n4(e){let{surface:t}=e,i=nJ(),n=nJ(),s=t.customPinnedRows.filter(e=>e.diagnoses.length>0||!e.isLiveBlock||!e.isLivePrompt||e.pathDead).length,o="materialized"===t.defaultSkillMode,l=(0,r.useCallback)(e=>(o?e.diagnoses.length>0:!!e.diagnoses.some(e=>"missing_mapping"!==e))||!e.isMapped&&!!o||e.disabled,[o]),c=s+t.defaultMappedRows.filter(l).length+ +!!t.baselineWouldBeEmpty,{pinnedIssueRows:p,pinnedHealthyRows:m}=(0,r.useMemo)(()=>({pinnedIssueRows:t.customPinnedRows.filter(e=>e.diagnoses.length>0||!e.isLiveBlock||!e.isLivePrompt||e.pathDead),pinnedHealthyRows:t.customPinnedRows.filter(e=>0===e.diagnoses.length&&e.isLiveBlock&&e.isLivePrompt&&!e.pathDead)}),[t.customPinnedRows]),{defaultIssueRows:u,defaultHealthyRows:h}=(0,r.useMemo)(()=>({defaultIssueRows:t.defaultMappedRows.filter(e=>l(e)),defaultHealthyRows:t.defaultMappedRows.filter(e=>!l(e))}),[t.defaultMappedRows,l]),y=(0,r.useMemo)(()=>{let e=i.search.trim().toLowerCase();return""===e?p:p.filter(t=>t.blockId.toLowerCase().includes(e))},[p,i.search]),g=(0,r.useMemo)(()=>{let e=n.search.trim().toLowerCase();return""===e?u:u.filter(t=>t.skillType.toLowerCase().includes(e))},[u,n.search]),x=y.slice(0,i.pageSize),f=g.slice(0,n.pageSize);return(0,d.jsx)(nO,{title:"Skills in the editor",diagnosisCount:c,headerSummary:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${t.baselineEntryCount} skills in editor menu \xb7 built-ins ${"materialized"===t.defaultSkillMode?"saved as editable pages":"provided by system"}`}),children:(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Skills that appear in the editor's quick-access menu. Includes user-pinned skills and built-in defaults."}),(0,d.jsxs)(a(4458).fI,{gap:12,flexWrap:"wrap",children:[(0,d.jsx)(a(746434).E,{content:"materialized"===t.defaultSkillMode?"Built-in skills saved as editable pages":"Built-in skills provided by system",color:"materialized"===t.defaultSkillMode?"green":"blue"}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${t.baselineEntryCount} skills would appear in menu`}),t.baselineWouldBeEmpty?(0,d.jsx)(a(746434).E,{content:"Editor skill menu would be empty",color:"yellow"}):void 0]}),p.length>0?(0,d.jsx)(a(439423).v,{title:"Pinned skills with issues",count:p.length,filteredCount:y.length,visibleCount:x.length,isExpanded:i.expanded,onToggle:i.toggle,onShowMore:i.showMore,isFirst:!0,isLast:0===m.length,searchQuery:i.search,onSearchChange:i.setSearch,children:x.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,
100children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.blockId})}),(0,d.jsx)(a(746434).E,{content:"block exists",color:e.isLiveBlock?"green":"red"}),(0,d.jsx)(a(746434).E,{content:"is a skill",color:e.isLivePrompt?"green":"red"}),e.pathDead?(0,d.jsx)(a(746434).E,{content:"Parent page deleted",color:"red"}):void 0,e.diagnoses.map(e=>(0,d.jsx)(a(746434).E,{content:nZ(e),color:"yellow"},e))]},e.blockId))}):void 0,(0,d.jsx)(nW,{healthyCount:m.length,label:"pinned skills",children:(0,d.jsx)(a(4458).VP,{gap:0,children:m.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.blockId})}),(0,d.jsx)(a(746434).E,{content:"OK",color:"green"})]},e.blockId))})}),u.length>0?(0,d.jsx)(a(439423).v,{title:"Built-in skills with issues",count:u.length,filteredCount:g.length,visibleCount:f.length,isExpanded:n.expanded,onToggle:n.toggle,onShowMore:n.showMore,isFirst:!0,isLast:0===h.length,searchQuery:n.search,onSearchChange:n.setSearch,children:f.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:e.skillType}),e.blockId?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:(0,d.jsx)(n$,{id:e.blockId})}):o?(0,d.jsx)(a(746434).E,{content:"No page assigned",color:"yellow"}):(0,d.jsx)(a(746434).E,{content:"System-provided",color:"gray"}),e.disabled?(0,d.jsx)(a(746434).E,{content:"Disabled by user",color:"gray"}):void 0,e.diagnoses.filter(e=>o||"missing_mapping"!==e).map(e=>(0,d.jsx)(a(746434).E,{content:nZ(e),color:"yellow"},e))]},e.skillType))}):void 0,(0,d.jsx)(nW,{healthyCount:h.length,label:"built-in skills",children:(0,d.jsx)(a(4458).VP,{gap:0,children:h.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:e.skillType}),e.blockId?(0,d.jsx)(a(746434).E,{content:"OK",color:"green"}):(0,d.jsx)(a(746434).E,{content:"System-provided",color:"green"})]},e.skillType))})})]})})}function n2(e){let{migration:t}=e,i=nJ(),n=t.dataIssueRows.length+t.lineageRows.filter(e=>"fully_healthy"!==e.status&&"intentionally_skipped"!==e.status).length,{issueLineageRows:s,healthyLineageRows:o}=(0,r.useMemo)(()=>{let e=[...t.lineageRows].sort((e,t)=>nX(e.status)-nX(t.status));return{issueLineageRows:e.filter(e=>"fully_healthy"!==e.status&&"intentionally_skipped"!==e.status),healthyLineageRows:e.filter(e=>"fully_healthy"===e.status||"intentionally_skipped"===e.status)}},[t.lineageRows]),l=(0,r.useMemo)(()=>{let e=i.search.trim().toLowerCase();return""===e?s:s.filter(t=>t.comparisonKey.toLowerCase().includes(e)||t.status.toLowerCase().includes(e)||t.explanation.toLowerCase().includes(e))},[s,i.search]),c=l.slice(0,i.pageSize);return(0,d.jsx)(nO,{title:"Favorites",diagnosisCount:n,headerSummary:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${t.legacyFavorites.length} old favorites \xb7 ${t.assistantSessionStarterFavorites.length} new favorites \xb7 ${t.migratedSkillPages.length} converted to pages`}),children:(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Favorites were migrated from an old format to skill pages. This section tracks each favorite through that conversion."}),(0,d.jsxs)(a(4458).fI,{gap:12,flexWrap:"wrap",children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${t.legacyFavorites.length} old format`}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${t.assistantSessionStarterFavorites.length} new format`}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${t.migratedSkillPages.length} converted to pages`}),t.dataIssueRows.length>0?(0,d.jsx)(a(746434).E,{content:`${t.dataIssueRows.length} with corrupted data`,color:"red"}):void 0]}),t.dataIssueRows.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,
100children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.starterId})}),(0,d.jsx)(a(746434).E,{content:e.dataType??"unknown type",color:"red"}),e.partiallyParsed?(0,d.jsx)(a(746434).E,{content:"Partially readable",color:"yellow"}):void 0,e.issues.map(e=>(0,d.jsx)(a(746434).E,{content:e,color:"red"},e))]},e.starterId)),s.length>0?(0,d.jsx)(a(439423).v,{title:"Favorites with issues",count:s.length,filteredCount:l.length,visibleCount:c.length,isExpanded:i.expanded,onToggle:i.toggle,onShowMore:i.showMore,isFirst:!0,isLast:0===o.length,searchQuery:i.search,onSearchChange:i.setSearch,children:c.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(746434).E,{content:nQ[e.status]??e.status,color:nY(e.status)}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.comparisonKey})}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:e.explanation})]},e.comparisonKey))}):void 0,(0,d.jsx)(nW,{healthyCount:o.length,label:"favorites",children:(0,d.jsx)(a(4458).VP,{gap:0,children:o.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",alignItems:"center",style:nq.itemRow,children:[(0,d.jsx)(a(746434).E,{content:nQ[e.status]??e.status,color:nY(e.status)}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:(0,d.jsx)(n$,{id:e.comparisonKey})}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:e.explanation})]},e.comparisonKey))})})]})})}function n6(e){let{report:t}=e;return(0,d.jsxs)(a(4458).VP,{gap:16,children:[(0,d.jsx)(nG,{status:t.diagnoses.length>0?"warning":"healthy",headline:t.diagnoses.length>0?`${t.diagnoses.length} ${1===t.diagnoses.length?"issue":"issues"} found for this user`:"No issues found for this user",diagnoses:t.diagnoses}),(0,d.jsx)(nF,{gates:t.gates}),(0,d.jsx)(n0,{spaceView:t.spaceView}),(0,d.jsx)(n1,{surface:t.settingsSurface,richTextSurface:t.richTextSurface}),(0,d.jsx)(n4,{surface:t.richTextSurface}),(0,d.jsx)(n2,{migration:t.favoritesMigration}),(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})}let n9=(0,a(477465).Dv)("adminSummarizeSkillHealthInSpaceTask");(0,a(477465).aI)("adminSummarizeSkillHealthInSpaceTask");let n7={distributionBar:{height:12,borderRadius:6,display:"flex",overflow:"hidden",maxWidth:400}
100,distributionLegend:{display:"flex",flexWrap:"wrap",gap:"4px 12px",maxWidth:400},distributionSwatch:{width:8,height:8,borderRadius:2,flexShrink:0},userRowBorder:{borderBlockStart:`1px solid ${a(632079).Tj.border.secondary}`},userStats:{fontVariantNumeric:"tabular-nums"},helpText:{padding:"8px 16px",borderRadius:6,background:a(632079).Tj.background.secondary},cliCommand:{fontFamily:"monospace",fontSize:11,padding:"1px 4px",borderRadius:3,background:a(632079).Tj.background.tertiary},rawDataToggle:{marginBlockStart:8}},n3=(0,a(327219).YK)({diagnoseSkillVisibilityAriaLabel:{id:"adminSummarizeSkillHealthInSpace.diagnoseSkillVisibilityAriaLabel",defaultMessage:"Diagnose skill visibility for {userLabel}"}}),n8=new Set(["favorite_data_corruption"]),n5={inherited:{label:"Inherited from parent (default)",color:a(632079).Tj.gray.background.accentSecondary},legacy_team:{label:"Legacy team (no team ID)",color:a(632079).Tj.orange.background.accentSecondary},legacy_owner:{label:"Legacy owner (no team ID)",color:a(632079).Tj.yellow.background.accentSecondary},explicit_team:{label:"Explicit team",color:a(632079).Tj.blue.background.accentSecondary},explicit_owner:{label:"Explicit owner",color:a(632079).Tj.green.background.accentSecondary}},re=[a(632079).Tj.blue.background.tertiary,a(632079).Tj.blue.background.secondary,a(632079).Tj.blue.background.accentSecondary,a(632079).Tj.blue.background.accentPrimary];function rt(e){let{label:t,unit:i,data:n}=e,s=e.colors??re,o=(0,r.useMemo)(()=>n.filter(e=>e.count>0),[n]),l=(0,r.useMemo)(()=>o.reduce((e,t)=>e+t.count,0),[o]);return 0===l?null:(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:t}),(0,d.jsx)("div",{style:n7.distributionBar,children:o.map((e,t)=>(0,d.jsx)("div",{style:{height:"100%",width:`${e.count/l*100}%`,background:s[t%s.length],minWidth:2}},e.bucket))}),(0,d.jsx)("div",{style:n7.distributionLegend,children:o.map((e,t)=>{var n;let r=0===t?`${e.count.toLocaleString()} ${1===e.count?i:`${i}s`}`:e.count.toLocaleString();return(0,d.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,d.jsx)("div",{style:{...n7.distributionSwatch,background:s[t%s.length]}}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${r} ${"0"===(n=e.bucket)?"with none":"1"===n?"with 1":`with ${n}`}`})]},e.bucket)})})]})}function ra(e){let{totals:t,histograms:i,windowCutoffs:n,favoriteDataIssues:s}=e,o=t.distinctUsersWithLiveSpaceViewCount,l=t.liveSkillPromptCount,c=t.assistantSessionStarterFavoriteCount,p=t.migratedFavoriteSkillPageCount,m=c>0&&p<c,u=t.liveSpaceViewCount-t.distinctUsersWithLiveSpaceViewCount,h=t.skillPagesNeedingAttention.length>0,{permDistributionData:y,permDistributionColors:g}=(0,r.useMemo)(()=>{let e=t.skillPagePermissionCounts,i=["inherited","legacy_team","legacy_owner","explicit_team","explicit_owner"].filter(t=>e[t]>0);return{permDistributionData:i.map(t=>{var a;return{bucket:(null==(a=n5[t])?void 0:a.label.toLowerCase())??t,count:e[t]}}),permDistributionColors:i.map(e=>{var t;
100return(null==(t=n5[e])?void 0:t.color)??a(632079).Tj.background.tertiary})}},[t.skillPagePermissionCounts]);return(0,d.jsxs)(a(4458).VP,{gap:24,children:[(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Size"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:`${o.toLocaleString()} active users, ${l.toLocaleString()} skill pages.`}),h||m||0!==u?void 0:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"No legacy permissions. Favorites migration is complete."})]}),(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Skill distribution"}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`Settings shows the first ${n.defaultCandidateLimit.toLocaleString()} skill candidates by default. Users can click Load All to see up to ${n.loadAllCandidateLimit.toLocaleString()}.`}),(0,d.jsx)(rt,{label:"How many skills each user created",unit:"user",data:i.ownLiveSkillCountByUser}),(0,d.jsx)(rt,{label:"How many of each user's skills appear on the default Settings page",unit:"user",data:i.ownSkillsBeforeDefaultCutoffByUser}),(0,d.jsx)(rt,{label:"How many additional skills appear after clicking Load All",unit:"user",data:i.ownSkillsBetweenDefaultAndLoadAllByUser})]}),(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Permissions & migration"}),(0,d.jsx)(rt,{label:"Permission types across skill pages",unit:"page",data:y,colors:g}),h?(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:`${t.skillPagesNeedingAttention.length} ${1===t.skillPagesNeedingAttention.length?"page uses":"pages use"} legacy team permissions`}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:"These pages grant access to members of all teams in the workspace because the permission has no team ID. In multi-team workspaces this is ambiguous. An engineer can scope each to a specific team by adding a team_id to the permission record."}),t.skillPagesNeedingAttention.map(e=>{var t;return(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",paddingBlock:4,children:[(0,d.jsx)(n$,{id:e.blockId}),e.createdById?(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`created by ${e.createdByName??e.createdByEmail??e.createdById}`}),e.createdByName&&e.createdByEmail?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:e.createdByEmail}):void 0,(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:(0,d.jsx)(n$,{id:e.createdById})})]}
100):void 0,(0,d.jsx)(a(746434).E,{content:(null==(t=n5[e.permissionType])?void 0:t.label)??e.permissionType,color:"yellow"})]},e.blockId)})]}):(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Most skill pages inherit permissions from their parent page. This is normal — skills are created without explicit permissions and rely on the workspace hierarchy for access control."}),m?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:`${p.toLocaleString()} of ${c.toLocaleString()} favorites have been converted to skill pages.${s.affectedUserCount>0?` ${s.affectedUserCount} users have corrupted favorite data blocking migration.`:""}`}):c>0?(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:`All ${c.toLocaleString()} favorites have been converted to skill pages.`}),(0,d.jsx)(a(746434).E,{content:"OK",color:"green"})]}):void 0,u>0?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:`${u} users have duplicate workspace memberships (${t.liveSpaceViewCount.toLocaleString()} memberships for ${o.toLocaleString()} users).`}):void 0]})]})}function ri(e){return e.userName??e.userEmail??e.userId}function rn(e){if(e.userName&&e.userEmail)return e.userEmail}function rr(e,t){let a=ri(e).localeCompare(ri(t),void 0,{sensitivity:"base"});return 0!==a?a:e.userId.localeCompare(t.userId)}function rs(e){let{row:t,renderStats:i,spaceId:n}=e,r=(0,a(327219).tz)(),{canOpenAdminToolTab:s,openAdminToolTab:o}=(0,a(612002).S)(),l=s("adminDiagnoseSkillSystemForUserInSpace"),c=ri(t);return(0,d.jsxs)(a(4458).fI,{gap:10,flexWrap:"wrap",alignItems:"center",justifyContent:"space-between",paddingBlock:8,style:n7.userRowBorder,children:[(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:c}),rn(t)?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:rn(t)}):void 0,(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:(0,d.jsx)(n$,{id:t.userId})})]}),(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:(0,d.jsx)("span",{style:n7.userStats,children:i(t)})}),(0,d.jsx)(a(374533).K,{size:"sm",variant:"plain",icon:a(58838).eyeSmallIcon,disabled:!0!==l,onClick:()=>o({toolName:"adminDiagnoseSkillSystemForUserInSpace",title:c,args:{spaceId:n,userId:t.userId}}),ariaLabel:r.formatMessage(n3.diagnoseSkillVisibilityAriaLabel,{userLabel:c})})]})]})}function ro(e){let{diagnosis:t,definition:i,spaceId:n,users:s}=e,[o,l]=(0,r.useState)(!0),[c,p]=(0,r.useState)(""),[m,u]=(0,r.useState)(20),h=(0,r.useCallback)(()=>l(e=>!e),[]),y=(0,r.useCallback)(()=>u(e=>e+20),[]),{filtered:g,visible:x}=(0,r.useMemo)(()=>{let e=c.trim().toLowerCase(),t=(""===e?[...s]:s.filter(t=>[t.userId,t.userName,t.userEmail].some(t=>(null==t?void 0:t.toLowerCase().includes(e))??!1))).sort(rr);return{filtered:t,visible:t.slice(0,m)}},[s,c,m]);return(0,d.jsx)(a(577497).Zp,{padding:"md",borderRadius:"md",children:(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(746434).E,{content:"red"===i.badgeColor?"error":"warning",color:i.badgeColor}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:i.title}),(0,d.jsx)(a(746434).E,{content:`${s.length} ${1===s.length?"user":"users"}`,color:"gray"})]}),(0,d.jsx)("div",{style:n7.helpText,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:i.explanation}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:i.resolution})]})}),t.detail?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:t.detail}):void 0,s.length>0?(0,d.jsx)(a(439423).v,{title:"Affected users",count:s.length,filteredCount:g.length,visibleCount:x.length,isExpanded:o,onToggle:h,onShowMore:y,isFirst:!0,isLast:!0,searchQuery:c,onSearchChange:p,children:x.map(e=>(0,d.jsx)(rs,{row:e,renderStats:i.renderUserStats,spaceId:n}
100,e.userId))}):void 0]})})}function rl(e){let{responseData:t,taskId:i}=e,[n,s]=(0,r.useState)(!1),o=(0,r.useMemo)(()=>{var e;return e=t.windowCutoffs,{default_window_starvation:{title:"Some users' skills are hidden in Settings",explanation:`This workspace has more than ${e.defaultCandidateLimit.toLocaleString()} skill candidates. These users' own skills sort after the default cutoff and don't appear on the Settings page.`,resolution:"No admin action needed. Users can click 'Load All' in Settings to see their skills. If this affects many users, the workspace may benefit from cleanup of orphaned skill pages.",badgeColor:"yellow",filter:e=>"at_risk_default_window"===e.riskBucket,renderUserStats:e=>`${e.ownLiveSkillCount} skills \xb7 ${e.ownSkillsInsideDefaultWindow} visible \xb7 ${e.ownSkillsInsideLoadAllWindow} with Load All`},load_all_window_starvation:{title:"Some users' skills are invisible even with Load All",explanation:`These users own skills that sort beyond the ${e.loadAllCandidateLimit.toLocaleString()}-candidate limit. Even 'Load All' won't surface them.`,resolution:(0,d.jsxs)(d.Fragment,{children:["An engineer needs to investigate. The workspace likely has orphaned or duplicated skill pages inflating the candidate count. Use ",(0,d.jsx)("span",{style:n7.cliCommand,children:"adminDiagnoseSkillSystemForUserInSpace"})," to inspect individual users."]}),badgeColor:"red",filter:e=>"at_risk_load_all_window"===e.riskBucket,renderUserStats:e=>`${e.ownLiveSkillCount} skills \xb7 ${e.ownSkillsOutsideLoadAllWindow} beyond Load All`},rich_text_empty_stale_pins:{title:"Editor menus reference deleted skills",explanation:"These users have skills pinned in their editor quick-menu that point to deleted or invalid pages. The entries appear broken or empty.",resolution:(0,d.jsxs)(d.Fragment,{children:["Usually self-healing — the stale references clear when the user next edits their rich text skill pins. Use ",(0,d.jsx)("span",{style:n7.cliCommand,children:"adminDiagnoseSkillSystemForUserInSpace"})," to see the exact stale entries for a specific user."]}),badgeColor:"red",filter:e=>e.hasStaleRichTextSkillReferences,renderUserStats:e=>`${e.richTextSkillsCount} pinned \xb7 ${e.validRichTextSkillsCount} valid`},favorites_invalid_data:{title:"Favorite data is corrupted",explanation:"These users have assistant session-starter favorites with malformed payloads that can't be parsed. Corrupted entries are skipped at render time but block migration.",resolution:(0,d.jsxs)(d.Fragment,{children:["An engineer should investigate. Use ",(0,d.jsx)("span",{style:n7.cliCommand,children:"adminDiagnoseSkillSystemForUserInSpace"})," to see the exact malformed records."]}),badgeColor:"red",filter:e=>e.invalidAssistantFavoriteDataCount>0,renderUserStats:e=>`${e.assistantFavoriteCount} favorites \xb7 ${e.invalidAssistantFavoriteDataCount} corrupted`},favorites_migration_missing_prompt_page:{title:"Favorite-to-skill migration is incomplete",explanation:"These users have assistant favorites that should have been converted to skill pages, but the corresponding pages are missing.",resolution:"An engineer should investigate whether the migration job needs to be re-run for this workspace.",badgeColor:"yellow",filter:e=>e.assistantFavoriteCount>0&&0===e.migratedFavoriteSkillCount,renderUserStats:e=>`${e.assistantFavoriteCount} favorites \xb7 ${e.migratedFavoriteSkillCount} migrated`},multiple_live_space_views:{title:"Users have duplicate workspace memberships",explanation:"These users have more than one active SpaceView record. This can cause skills to appear duplicated or AI prompt state to be stored on the wrong membership.",resolution:"An engineer should consolidate the duplicate SpaceView records.",badgeColor:"yellow",filter:e=>e.liveSpaceViewCount>1,renderUserStats:e=>`${e.liveSpaceViewCount} memberships${e.activeSpaceViewId?` \xb7 active: ${e.activeSpaceViewId.slice(0,8)}…`:""}`}}},[t.windowCutoffs]),l=(0,r.useCallback)(()=>{s(e=>!e)},[]),c=(0,r.useMemo)(()=>{let e=[...t.diagnoses];return t.favoriteDataIssues.affectedUserCount>0&&(e.some(e=>"favorites_invalid_data"===e.code)||e.push({code:"favorites_invalid_data",summary:`${t.favoriteDataIssues.affectedUserCount} users have corrupted favorite data`,detail:`Sample user IDs: ${t.favoriteDataIssues.affectedUserIdsSample.join(", ")}${t.favoriteDataIssues.affectedUserCount>t.favoriteDataIssues.affectedUserIdsSample.length?" ...":""}`})),e.filter(e=>!n8.has(e.code))},[t.diagnoses,t.favoriteDataIssues]),p=(0,r.useMemo)(()=>{let e=new Map;for(let a of c){let i=o[a.code];if(!i)continue;let n=t.perUserRows.filter(i.filter);e.set(a.code,n)}return e},[c,o,t.perUserRows]),m=(0,r.useMemo)(()=>{let e=new Set;for(let t of p.values())for(let a of t)e.add(a.userId);return e.size},[p]),u=c.length>0,h=t.spaceTotals,y=t.histograms;return(0,d.jsxs)(a(4458).VP,{gap:16,children:[(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`Task ${i}`}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Completed"})]}),(0,d.jsx)(nG,{status:u?"warning":"healthy",headline:u?`${c.length} ${1===c.length?"issue":"issues"} detected \xb7 ${m} ${1===m?"user":"users"} affected`:"No issues found — workspace skill system is healthy",diagnoses:[]}),c.map(e=>{let i=o[e.code];return i?(0,d.jsx)(ro,{diagnosis:e,definition:i,spaceId:t.requested.spaceId,users:p.get(e.code)??[]},e.code):(0,d.jsx)(a(577497).Zp,{padding:"md",borderRadius:"md",children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(746434).E,{content:e.code,color:"gray"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:e.summary})]}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:e.detail})]})},e.code)}),(0,d.jsx)(nO,{title:"Workspace overview",diagnosisCount:0,headerSummary:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`${h.liveSkillPromptCount.toLocaleStr
100ing()} skill pages \xb7 ${h.distinctUsersWithLiveSpaceViewCount.toLocaleString()} users`}),children:(0,d.jsx)(ra,{totals:h,histograms:y,windowCutoffs:t.windowCutoffs,favoriteDataIssues:t.favoriteDataIssues})}),(0,d.jsxs)("div",{style:n7.rawDataToggle,children:[(0,d.jsx)(a(988022).p,{size:"sm",onClick:l,children:n?"Hide raw data":"Show raw data"}),n?(0,d.jsx)(a(577497).Zp,{padding:"sm",children:(0,d.jsx)(a(243119).A,{data:t})}):void 0]})]})}let rd={adminFindObject:{apiName:"adminFindObject",displayName:"Find Record",emoji:"🔍",description:"Check whether a record exists by table and ID. Returns existence, alive status and parent info if available.",schema:{recordId:{type:"string",placeholder:a(591977).nZ,comment:"UUID of the record"},table:{type:"options",options:[...a(103118).um].sort(),comment:"The record table to search in"},spaceId:{type:"string",table:"space",comment:"(Optional) Space ID to scope the lookup"}}},adminSearchUsers:{apiName:"adminSearchUsers",displayName:"Find User Information",emoji:"🔎",description:"Fill out just one of the fields below. Returns information about a user.",schema:{userId:{type:"string",table:s().oo9,showByDefaultInSingleRecordMode:!0},userEmail:{type:"string"},spaceRolesOnly:{type:"boolean",name:"Workspace Roles Only (Fast Mode)",defaultValue:!1,comment:"If checked, skips loading full workspace details — returns only workspace IDs and the user's role in each."},includeRemovedSpaces:{type:"boolean",defaultValue:!1,comment:"If checked, includes spaces where the user has a membership record (space_user) but no sidebar entry: spaces they were removed from, plus spaces hidden from the lists above (e.g. a scripted account stripping its own sidebar)."}},customResponseRenderer:function(e){var t,i;let n=(0,a(327219).tz)(),{data:r,singleRecordMode:s}=e,o=r.email??(null==(t=r.emails.find(e=>e.isPrimary))?void 0:t.email)??(null==(i=r.emails[0])?void 0:i.email),l={...r,badStateMessages:void 0};return(0,d.jsxs)(d.Fragment,{children:[s?(0,d.jsx)(a(45062).A,{title:`Notion User Admin: ${(0,a(197018).lR)(n,(0,a(197018).A7)({...r,email:o,version:0}))}`}):void 0,r.badStateMessages&&r.badStateMessages.length>0?(0,d.jsx)(a(553775).i$,{warnings:r.badStateMessages}):null,"???"!==r.deletedTime?(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:"Deletion Info"}),(0,d.jsxs)("ul",{children:[(0,d.jsxs)("li",{children:["deleted_time: ",r.deletedTime]}),r.deletedBy?(0,d.jsxs)("li",{children:["deleted_by: ",(0,d.jsx)(a(553775).uQ,{user:r.deletedBy})]}):null]})]}):null,r.organizationIds&&r.organizationIds.length>0?(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:"Organizations"}),(0,d.jsx)("b",{children:`Count: ${r.organizationIds.length}`}),(0,d.jsx)("ul",{children:r.organizationIds.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)(a(137691).x5,{value:e})},e))})]}):void 0,(0,d.jsx)(iI,{title:"Current Spaces",spaces:r.spaces}),(0,d.jsx)(iI,{title:"Left Spaces",spaces:r.leftSpaces}),(0,d.jsx)(iI,{title:"Removed or Hidden Spaces",spaces:r.removedSpaces}),(0,d.jsx)("h3",{children:"Full Response"}),(0,d.jsx)(a(243119).A,{data:l,hideHelp:!0}),(0,d.jsx)(a(607142).G,{email:o})]})}},adminSearchSpaces:{apiName:"adminSearchSpaces",displayName:"Find Workspace Information",emoji:"🔎",description:"Fill out just one of the fields below. Returns information about a workspace.",schema:{spaceId:{type:"string",table:"space",showByDefaultInSingleRecordMode:!0},domain:{type:"string"},stripeCustomerId:{type:"string",placeholder:a(591977).cs},skipHydrateUsers:{type:"boolean",name:"Counts Only (Fast Mode)",defaultValue:!1,comment:"Return user/bot counts instead of full details (faster for large workspaces)"},includeWorkersConfig:{type:"boolean",name:"Include Workers config",defaultValue:!0,comment:"Include Workers enabled status and creation setting."}},customResponseRenderer:a(279827).$},adminSearchBlocks:{apiName:"adminSearchBlocks",displayName:"Find Block Information",emoji:"🔎",description:"Fill out the block id (can be from a page URL). Returns information about the block.",schema:{blockId:{type:"string",table:"block",showByDefaultInSingleRecordMode:!0},skipSpaceLoad:{type:"boolean",name:"Skip Workspace Load (Fast Mode)",defaultValue:!1,comment:"If checked, skips loading full workspace details — returns only the workspace ID."}},customResponseRenderer:ib},adminViewRecordTree:{apiName:"adminViewRecordTree",displayName:"View Record Tree",emoji:"🌲",description:"View the live record tree for a given record. Shows structural metadata (no user content). For blocks, recursively loads descendants via content arrays.",customResponseRenderer:function(e){let{data:t}=e,{rootRecord:i,tree:n,records:r,totalRecords:s,truncated:o}=t;return(0,d.jsxs)("div",{style:nf.container,children:[(0,d.jsx)("div",{style:nf.header,children:"Record Tree Viewer"}),o?(0,d.jsxs)("div",{style:nf.truncationWarning,children:["⚠ Results truncated: tree contains more records than the limit (",s," loaded). Increase recordCountLimit to see more."]}):void 0,(0,d.jsx)(nw,{title:"Root Record",children:(0,d.jsxs)("div",{style:nf.metadataGrid,children:[(0,d.jsx)("span",{style:nf.metadataLabel,children:"Table:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:i.table}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"ID:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:(0,d.jsx)(a(137691).x5,{value:i.id})}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Space ID:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:(0,d.jsx)(a(137691).x5,{value:i.spaceId})}),(0,d.jsx)("span",{style:nf.metadataLabel,children:"Total Records:"}),(0,d.jsx)("span",{style:nf.metadataValue,children:s})]})}),(0,d.jsx)(nw,{title:"Tree Structure",count:n.length,children:(0,d.jsx)("div",{style:nf.tree
100Container,children:n.map(e=>(0,d.jsx)(nj,{node:e,level:0},e.id))})}),(0,d.jsx)(nw,{title:"All Records",count:r.length,defaultExpanded:!1,children:(0,d.jsx)("div",{style:nf.recordList,children:r.map(e=>(0,d.jsx)(nI,{record:e},e.id))})})]})},schema:{recordId:{type:"string",placeholder:a(591977).nZ,comment:"UUID of the root record"},table:{type:"options",options:[...a(103118).um].sort(),comment:"The record table to search in"},spaceId:{type:"string",table:"space",comment:"(Optional) Space ID — auto-resolved if not provided"},recordCountLimit:{type:"number",comment:"(Optional) Max records to load (default 10000). Increase for larger trees."},includeDeadChildren:{type:"boolean",defaultValue:!1,comment:"(Optional) If true, show children that are alive = false or missing from parent array, Also traverse record tree with parent id instead of content array"}}},adminGetFileMetadata:{apiName:"adminGetFileMetadata",displayName:"Get File Metadata",emoji:"📁",description:"Look up metadata for an internal file ID. Returns S3 metadata and records that reference the file.",schema:{fileId:{type:"string",comment:"Internal file ID (UUID format)"},spaceId:{type:"string",table:"space",comment:"Workspace ID where the file is located"}}},adminSearchNotifications:{apiName:"adminSearchNotifications",displayName:"Search User Notifications",emoji:"🔔",description:"Search notification records for a user. If spaceId is not provided, searches all the user's spaces.",schema:{userIdOrEmail:{type:"string",comment:"User ID or email to search notifications for",table:s().oo9},spaceId:{type:"string",comment:"(optional) Filter by spaceId",table:"space"},size:{type:"number",comment:"(optional) Number of notifications to return per space (default: 25, max: 150)"},archived:{type:"boolean",comment:"(optional) Show archived notifications (default: false)"},unread:{type:"boolean",comment:"(optional) Only show unread notifications, works with both archived and unarchived (default: false)"}},customResponseRenderer:function(e){let{data:t,singleRecordMode:i}=e,n=t.spaces.reduce((e,t)=>e+t.notifications.length,0);return(0,d.jsxs)(d.Fragment,{children:[i?(0,d.jsx)(a(45062).A,{title:`Notion Notifications Admin: ${t.userId}`}):void 0,(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"User ID: "}),(0,d.jsx)(a(137691).x5,{value:t.userId})]}),(0,d.jsxs)("div",{style:nC,children:[(0,d.jsx)("b",{children:`Total Notification Count: ${n}`}),(0,d.jsx)("div",{children:0===t.spaces.length?(0,d.jsx)("p",{children:"No spaces found for user."}):void 0})]}),(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})}},adminSearchBlockBySlug:{apiName:"adminSearchBlockBySlug",displayName:"Find block information from site slug",emoji:"🔎",description:"Fill out space ID and the slug for the site. Returns information about the block.",schema:{spaceId:{type:"string",table:"space"},slug:{type:"string",placeholder:"",comment:"Slug/pathname of the URL"}},customResponseRenderer:ib},adminSearchTeams:{apiName:"adminSearchTeams",displayName:"Find Teamspace Information",emoji:"🔎",description:"Fill out the teamspace id. Returns information about the teamspace.",schema:{teamId:{type:"string",table:"team",showByDefaultInSingleRecordMode:!0}},customResponseRenderer:function(e){var t;let{data:i,singleRecordMode:n}=e,r=(0,a(422280).Sh)({archived_by:null==(t=i.archivedBy)?void 0:t.id});return(0,d.jsxs)(d.Fragment,{children:[n?(0,d.jsx)(a(45062).A,{title:`Notion Teamspace Admin: ${i.name}`}):void 0,(0,d.jsxs)("h2",{children:[i.name," ",(0,d.jsx)(a(137691).x5,{value:i.id})]}),(0,d.jsxs)(iv,{title:"Basic Information",children:[(0,d.jsx)(ij,{title:"Status",children:r?(0,d.jsx)("span",{style:ik,children:"Archived"}):"Active"}),r?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ij,{title:"Archived at",children:i.archivedAt}),(0,d.jsx)(ij,{title:"Archived by",children:(0,d.jsx)(a(553775).uQ,{user:i.archivedBy})})]}):void 0,(0,d.jsx)(ij,{title:"Creator",children:(0,d.jsx)(a(553775).uQ,{user:i.createdBy})}),(0,d.jsx)(ij,{title:"Date created",children:i.createdTime}),(0,d.jsx)(ij,{title:"Workspace",children:(0,d.jsx)(a(553775).lv,{space:{id:i.spaceId}})}),(0,d.jsx)(ij,{title:"Access level",children:(0,a(422280).MA)(i.settings)}),(0,d.jsx)(ij,{title:"Is default team",children:i.isDefault?"Yes":"No"})]}),(0,d.jsx)(a(884877).A,{axis:"y",size:16}),(0,d.jsx)(iv,{title:"Full Response",children:(0,d.jsx)(a(243119).A,{data:i,hideHelp:!0})})]})}},adminSearchCollections:{apiName:"adminSearchCollections",displayName:"Find Collection information (data source)",emoji:"🔎",description:"Fill out the block ID of a collection view or collection ID of a data source. Includes information about attached database-agent and Autofill Lite workflows. When using a block ID, returns information about all data sources owned by the collection view block.",schema:{blockId:{type:"string",table:"block",showByDefaultInSingleRecordMode:!0},collectionId:{type:"string",table:s().VlP,showByDefaultInSingleRecordMode:!0}},customResponseRenderer:void 0},adminSearchCollectionViews:{apiName:"adminSearchCollectionViews",displayName:"Find collection view information",emoji:"🔎",description:"Fill out the collection view ID for a collection view. Returns information about the collection view. To get the view ID, navigate to the collection view block as full-screen and then look at the URL. There should be a URL param that looks like `&v={{COLLECTION_VIEW_ID}}. Insert COLLECTION_VIEW_ID into this input.",schema:{collectionViewId:{type:"string",table:s().Gy1,showByDefaultInSingleRecordMode:!0}},customResponseRenderer:void 0},adminSearchSpaceViews:{apiName:"adminSearchSpaceViews",displayName:"Find SpaceVie
100w Information for User",emoji:"🔎",description:"Fill out user and space IDs to find SpaceView information. SpaceViews provides various information about the user's sidebar and settings in the workspace.",schema:{userId:{type:"string",table:s().oo9},spaceId:{type:"string",table:"space"}},customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(d.Fragment,{children:[t.knownErrors.length>0?function(e){let{knownErrors:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Known Errors"}),(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",colorPalette:"red",colorVariant:"accentPrimary",children:"There are some known errors with this user's SpaceViews. Consider running the AdminSyncSpaceViews tool."}),t.map((e,t)=>{switch(e.type){case"deadSpaceViewInUserRoot":return(0,d.jsx)(a(279827).ft,{title:"User has dead SpaceView(s) in their UserRoot",items:e.spaceViews,renderItem:e=>{if(e&&e.id&&"string"==typeof e.id)return(0,d.jsx)("li",{children:e.id},e.id)}},`${e.type}-${t}`);case"nonMemberHasLiveSpaceView":return(0,d.jsx)(a(279827).ft,{title:"User is not a workspace member but has live space view(s)",items:e.spaceViews,renderItem:e=>{if(e&&e.id&&"string"==typeof e.id)return(0,d.jsx)("li",{children:e.id},e.id)}},`${e.type}-${t}`);case"memberOrGuestMissingLiveSpaceView":return(0,d.jsx)(a(279827).ft,{title:"User is missing live space view for this space",items:e.spaceViews,renderItem:e=>{if(e&&e.id&&"string"==typeof e.id)return(0,d.jsx)("li",{children:e.id},e.id)}},`${e.type}-${t}`);default:(0,ed().HB)(e.type)}}),(0,d.jsx)("br",{})]})}({knownErrors:t.knownErrors}):void 0,(0,d.jsx)("h3",{children:"Full Response"}),(0,d.jsx)("div",{children:(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})})]})}},adminSearchForUsersInSpaces:{apiName:"adminSearchForUsersInSpaces",displayName:"Find All Unique Users in Workspaces",emoji:"🔎",description:"Download a CSV with unique users in each workspace",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to search through for unique users",table:"space"},includeGuests:{type:"boolean",comment:"whether to include guests in the response"},showSpaceNames:{type:"boolean",comment:"whether to show the names of workspaces in the CSV, in addition to their space_ids"}}},adminGetDataAccessConsent:{apiName:"adminGetDataAccessConsent",displayName:"Check data access consent expiry time",emoji:"🔐",description:"Check if the user has granted access and when that access will expire.",schema:{userEmail:{type:"string"}}},adminSearchPermanentlyDeletedPages:{apiName:"adminSearchPermanentlyDeletedPages",displayName:"Find permanently deleted pages in a workspace",emoji:"🙏",description:"Find permanently deleted pages in a space. The result set is limited to 1000, please let us know in #eng-team-workspace-architecture if you need to load more.",schema:{spaceId:{type:"string",comment:"Workspace id to search for deleted pages (required)",table:"space"},query:{type:"string",comment:"Return only deleted pages that match content (optional)"}}},adminSearchPermanentlyDeletedCollections:{apiName:"adminSearchPermanentlyDeletedCollections",displayName:"Find permanently deleted data sources in a workspace",emoji:"🗄️",description:"Find permanently deleted data sources (collections) in a space. The result set is limited to 1000, please let us know in #eng-team-workspace-architecture if you need to load more.",schema:{spaceId:{type:"string",comment:"Workspace id to search for deleted data sources (required)",table:"space"},query:{type:"string",comment:"Return only deleted data sources that match name (optional)"}}},adminSearchSpaceActivity:{apiName:"adminSearchSpaceActivity",displayName:"Search updates on a workspace",emoji:"🔎",description:"Search updates that have occurred on a workspace.",schema:{spaceId:{type:"string",comment:"Workspace id to search",table:"space"},blockId:{type:"string",comment:"Block id to search",table:"block"},activityType:{type:"options",comment:"(optional) Filter by activity type",options:(0,ed().objectKeys)(a(420667).G)},startDate:{type:"date",comment:"(optional) Date to start search from."},endDate:{type:"date",comment:"(optional) Date to search on or before."},limit:{type:"number",comment:"should never be visible",defaultValue:1e3,visibleWhen:{field:"",value:"-1"}}}},adminGetPublicPages:{apiName:"adminGetPublicPages",displayName:"Get public pages in a Workspace",emoji:"🔎",description:"Gets public pages for a 
100workspace. Defaults to fetching a maximum of 1000 pages if no explicit limit is set.",schema:{spaceId:{type:"string",table:"space"},limit:{type:"number",comment:"Optional max number of pages to retrieve. Defaults to 1000 if none is specified."},downloadAsCsv:{type:"boolean",comment:"Download the results as a CSV of public page URLs instead"}},isDestructive:!1},adminGetPublicForms:{apiName:"adminGetPublicForms",displayName:"Get public forms in a Workspace",emoji:"🔎",description:"Gets public forms for a workspace. Defaults to fetching a maximum of 1000 forms if no explicit limit is set.",schema:{spaceId:{type:"string",table:"space"},limit:{type:"number",comment:"Optional max number of forms to retrieve. Defaults to 1000 if none is specified."},downloadAsCsv:{type:"boolean",comment:"Download the results as a CSV of public form URLs instead"}},isDestructive:!1},adminDebugCollectionForm:{apiName:"adminDebugCollectionForm",displayName:"Debug collection form",emoji:"🐛",description:"Debug a form block. Returns all questions with scrubbed metadata (property ID and whether required), plus the basic schema of the associated collection.",schema:{blockId:{type:"string",table:"block",comment:"ID of the form block.",isRequired:!0},spaceId:{type:"string",table:"space",comment:"Space ID the form lives in.",isRequired:!0}}},adminGetTrial:{apiName:"adminGetTrial",displayName:"Get Trial",emoji:"🔎",description:"Get information about the currently active trial and the most recent historical trial.",schema:{spaceId:{type:"string",table:"space"},customerId:{type:"string",table:s().$2J}}},adminGetOrCreateStripeCustomer:{apiName:"adminGetOrCreateStripeCustomer",displayName:"Get or create Stripe customer.",emoji:"🔎",description:"Gets the existing Stripe customer or, if one doesn't already exist, creates a new Stripe customer.",schema:{spaceId:{type:"string",table:"space",showByDefaultInSingleRecordMode:!0},reason:{type:"string",comment:"Reasons can be issuing a trial, etc."}}},adminGetBulkSpaceIdsByDomain:{apiName:"adminGetBulkSpaceIdsByDomain",displayName:"Get bulk workspace ids by domain",emoji:"🚛",description:"Enter a comma-separated list of domains, and get back a map and list of space ids. Used for quickly getting spaces for beta user feature flags.",schema:{domains:{type:"string"}}},adminGetBulkSpaceIdsByEmail:{apiName:"adminGetBulkSpaceIdsByEmail",displayName:"Get bulk workspace by user emails",emoji:"🚛",description:"Enter a comma-separated list of user emails (up to 100), and get back a map and list of all spaces the users belong to. Used for quickly getting spaces for beta user feature flags.",schema:{userEmails:{type:"string"}}},adminGetBulkUserIdsByEmail:{apiName:"adminGetBulkUserIdsByEmail",displayName:"Get bulk user ids by user emails",emoji:"🚛",description:"Enter a comma-separated list of user emails (up to 100), and get back a map and list of all their user IDs. Used for quickly getting users for beta user feature flags.",schema:{userEmails:{type:"string"}}},isEmailEducation:{apiName:"isEmailEducation",emoji:"👩",description:"Is this email or domain an education email or domain?",schema:{email:{type:"string",comment:"E.g. [email protected] or school.edu"}}},adminGetSpaceMembershipUpdates:{apiName:"adminGetSpaceMembershipUpdates",displayName:"View Space Membership Updates",emoji:"🔍",description:(0,d.jsxs)(d.Fragment,{children:["View log of membership updates to paid workspaces. This includes teamspace guests in addition to members. Used by the daily prorations cron.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"We expect currentTeamGuestCount + currentMemberCount = currentBillableUserCount.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"CurrentStripeQuantity is the current quantity we are billing for now, excluding any membership changes that happened today (the daily membership update job runs nightly).",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"NextBillingPeriodStripeQuantityInfo is the quantity we are billing for in the next billing cycle, excluding any membership changes that happened today (the daily membership update job runs nightly)."]}),schema:{spaceId:{type:"string",comment:"Space ID to lookup"}}},adminGetProcessedSpaceMembershipUpdates:{apiName:"adminGetProcessedSpaceMembershipUpdates",displayName:"View Historical Processed Space Membership Updates",emoji:"🔍",description:(0,d.jsx)(d.Fragment,{children:"View log of membership updates to paid workspaces that have already been processed."}),schema:{spaceId:{type:"string",comment:"Space ID to lookup"},effectiveTimeStart:{type:"date",comment:"Start of date range to view Space Membership Updates."},effectiveTimeEnd:{type:"date",comment:"End of date range to view Space Membership Updates."}}},adminFlushSpaceMembershipUpdates:{apiName:"adminFlushSpaceMembershipUpdates",displayName:"Flush Space Membership Updates",emoji:"🔍",description:"Run the daily prorations job on a space to apply pending membership changes to Stripe. Use the date field to apply updates scheduled for the future.",schema:{spaceId:{type:"string",comment:"Space ID to lookup"},effectiveTime:{type:"date",comment:"(Optional) Apply pending updates scheduled up to this date. Useful for testing grace peri
100od logic. Defaults to the current day."}}},adminGetBillingDataInformation:{apiName:"adminGetBillingDataInformation",displayName:"Get billingData Information",emoji:"🔍",description:"Get BillingData information, including the return values of fetchRevenueCatBillingData, fetchStripeBillingData, loadBillingData, and fetchBillingData.",customResponseRenderer:function({data:e}){let[t,i]=(0,r.useState)(0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:nt.pageHeader,children:`Billing Data Information for Space: ${e.spaceId}`}),(0,d.jsxs)("div",{style:nt.rowIdsLine,children:[(0,d.jsx)("span",{style:nt.rowIdsLabel,children:"space_billing_data row id(s): "}),e.spaceBillingDataRowIds.length>0?e.spaceBillingDataRowIds.join(", "):"none found"]}),(0,d.jsxs)("div",{style:nt.rowIdsLine,children:[(0,d.jsx)("span",{style:nt.rowIdsLabel,children:"Metronome customer: "}),void 0!==e.metronomeCustomerId?(0,d.jsx)("a",{href:o(e.metronomeCustomerId),target:"_blank",rel:"noopener noreferrer",children:e.metronomeCustomerId}):"none found"]}),(0,d.jsx)("div",{style:nt.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:t,onChange:i})}),0===t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(ni,{isOutOfSync:e.isLoadedVsFetchedOutOfSync,outOfSyncFields:e.loadedVsFetchedOutOfSyncFields}),(0,d.jsx)(na,{label:"Loaded — Cache",billingData:e.loadedBillingData}),(0,d.jsx)(na,{label:"Fetched — Live",billingData:e.fetchedBillingData}),(0,d.jsx)(na,{label:"Stripe",billingData:e.fetchedStripeBillingData}),(0,d.jsx)(na,{label:"RevenueCat",billingData:e.fetchedRevenueCatBillingData})]}):(0,d.jsx)(a(503270).H,{data:e,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]})},schema:{spaceId:{type:"string",comment:"Space ID of billing data"}}},adminGetBillingDataHistory:{apiName:"adminGetBillingDataHistory",displayName:"Get Billing Data History",emoji:"📜",description:"View billing data history entries for a space with changes highlighted and dates prominently displayed.",customResponseRenderer:function({data:e}){let{spaceId:t,entries:i,totalEntries:n}=e,[s,o]=(0,r.useState)(0);return 0===n?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:ne.headerStyle,children:`Billing Data History for Space: ${t}`}),(0,d.jsx)(a(553775).i$,{warnings:["No billing data history found for this space"]})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:ne.headerStyle,children:`Billing Data History for Space: ${t} (${n} entries)`}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:ne.style0,children:"Entries are shown in reverse chronological order (newest first). Click on any value to copy it to your clipboard."}),(0,d.jsx)("div",{style:ne.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:s,onChange:o})}),0===s?(0,d.jsx)(i5,{entries:e.entries}):i.map((e,t)=>(0,d.jsxs)("div",{style:ne.style1,children:[(0,d.jsxs)("div",{style:ne.entryHeaderStyle,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",colorVariant:"primary",children:`Entry ${t+1}: ${e.startTime}`}),(0,d.jsx)(a(324489).V,{isSmall:!0,style:ne.style2,children:`ID: ${e.id} | ISO: ${e.startTimeISO}`})]}),e.changesSincePrevious?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:ne.changesHeaderStyle,children:"Changes from Previous Entry:"}),(0,d.jsx)(a(503270).H,{data:e.changesSincePrevious,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]}):t===i.length-1?(0,d.jsx)("div",{style:ne.noChangesStyle,children:"Initial entry - no previous data to compare"}):(0,d.jsx)("div",{style:ne.noChangesStyle,children:"No changes from previous entry"}),(0,d.jsx)("div",{style:ne.changesHeaderStyle,children:"Complete Billing Data:"}),(0,d.jsx)(a(503270).H,{data:e.billingData,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]},e.id))]})},schema:{spaceId:{type:"string",comment:"Space ID to fetch billing history for"},recordNum:{type:"number",comment:"Number of records to show (default: 20, optional)"}}},adminGetLegacyPriceMigrationBanner:{apiName:"adminGetLegacyPriceMigrationBanner",displayName:"Legacy Price Migration Banner Preview",emoji:"🔍",customResponseRenderer:function({data:e}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:ng.pageHeader,children:"Legacy Price Migration Banner"}),nh(e)?(0,d.jsx)(ny,{data:e}):(0,d.jsx)(a(553775).i$,{warnings:["Unexpected response shape — see the JSON below."]}),(0,d.jsx)("div",{style:ng.jsonContainer,children:(0,d.jsx)(a(503270).H,{data:function(e){if(!nh(e))return e;let{copy:t,...a}=e;return a}(e),customCollapsedRenderers:void 0,ignoreUuidPreference:!1})})]})},description:"Read-only preview of the December 2026 price migration banner for workspace admins. Renders the banner's own copy in a billing admin's language, plus visibility, the first blocking reason, and workspace config/gate values. Does not include browser-local overrides or cached client state. The migration execution gate does not control banner visibility.",sc
100hema:{spaceId:{type:"string",table:"space",comment:"Workspace ID"}}},adminGetSubscriptionUpdatePreview:{apiName:"adminGetSubscriptionUpdatePreview",displayName:"Subscription Update Preview",emoji:"🔍",description:"Get a breakdown of how a subscription change will be applied to a workspace and the immediate cost of the change, given the workspace's current billing state. Does not include tax.",schema:{spaceOrCustomerId:{type:"string",comment:"Space ID or Stripe Customer ID"},billingInterval:{type:"options",options:["month","year"],comment:"The desired billing interval. Leave empty to use the subscription's current billing interval or scheduled downgrade."},subscriptionTier:{type:"options",options:["free","personal","student","plus","business","enterprise"],comment:"The desired tier. Leave empty to use the subscription's current tier or scheduled downgrade."},aiAddOn:{type:"boolean",comment:"Should the subscription include the AI add-on after all changes? If unchecked, the AI add-on will be removed. If the subscription does not have the add-on, this will have no effect.",defaultValue:!1}}},adminFindDeletedUser:{apiName:"adminFindDeletedUser",emoji:"😵",description:"Find deleted accounts associated with an email address. You can recover any of the resulting accounts using the userId.",schema:{userEmail:{type:"string"}},isDestructive:!0,customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:a(553775).g,children:[t.users.length," deleted users found"]}),t.users.map(e=>(0,d.jsx)("div",{children:(0,d.jsx)(a(553775).ru,{table:"notion_user",record:e,children:e.id})},e.id)),(0,d.jsx)(a(243119).A,{data:t})]})}},adminCountWordsInPage:{apiName:"adminCountWordsInPage",emoji:"🔢",description:"Counts the words in a page and its descendents",schema:{blockUrl:{type:"string",comment:"The link to the page"}},isDestructive:!1},adminReadBlockPermissions:{apiName:"adminReadBlockPermissions",displayName:"Read block permission for a user or bot",emoji:"👀",description:"Reads the permission for an actor (user or bot) on a block. Block must be a navigable block type (page, collection view, or collection)",schema:{blockId:{type:"string",table:"block"},userId:{type:"string",table:s().oo9},botId:{type:"string",table:"bot"}},isDestructive:!1},adminListUserPagePermissionBlockIdsInSpace:{apiName:"adminListUserPagePermissionBlockIdsInSpace",displayName:"List pages explicitly shared with a user in a workspace",emoji:"📄",description:"Lists page block IDs in a workspace that have explicit user permissions for the given user. Useful for debugging “ghost guest” cases (user shows as `page_guest` for the removed space but is not listed as a guest of the workspace settings people tab).",schema:{spaceId:{type:"string",table:"space"},userId:{type:"string",table:s().oo9,comment:"(optional) Provide either userId or userEmail"},userEmail:{type:"string",comment:"(optional) Provide either userId or userEmail"},nextStartId:{type:"string",comment:"(optional) Pagination cursor returned as nextStartId in the previous response"}},isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:nx.heading,children:`Returned ${t.blockIds.length} page(s) with explicit user permissions in this workspace.`}),(0,d.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:nx.subtle,children:`Workspace: ${t.spaceId} • User: ${t.userId}${t.hasMore?` • More results available${t.nextStartId?` (nextStartId: ${t.nextStartId})`:""}`:""}`}),t.blockIds.length>0?(0,d.jsx)(a(4458).VP,{gap:6,marginBottom:16,children:t.blockIds.map(e=>(0,d.jsx)("div",{children:(0,d.jsx)(a(553775).ru,{table:"block",record:{id:e}})},e))}):void 0,(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})}},adminGetAutomationsForRecordId:{apiName:"adminGetAutomationsForRecordId",customResponseRenderer:function(e){let{data:t}=e,i=e=>"recurrence"===e.trigger.type&&"block"===e.parentPointer.table?"Template duplication automation":"Automation",n=e=>`${i(e)} (${e.id})`,r=t.automations.filter(e=>"event"===e.trigger.type).map(e=>({label:n(e),url:a3({automationId:e.id,from:"automationFastProcessor"})})),s=t.automations.filter(e=>e.actions.some(e=>"slack_notification"===e.type)).map(e=>({label:n(e),url:a3({automationId:e.id,from:"automationProcessor"})})),o=t.automations.filter(e=>"recurrence"===e.trigger.type).map(e=>({label:n(e),url:a3({automationId:e.id,from:"recurrenceTask"})})),l=t.automations.flatMap(e=>{let t=e.actions.filter(e=>"slack_notification"===e.type&&void 0!==e.config.externalBotId);if(0!==t.length)return t.map(t=>{let a="slack_notification"===t.type&&t.config.externalBotId;return{automationId:e.id,actionId:t.id,botId:a,url:function(e){let{botId:t,from:a}=e,i=a2(),n=`search index=${i} from=${a} data.botId="${t}"`,r=new URLSearchParams;return r.set("q",n),`https://notion.splunkcloud.com/en-GB/app/search/search?${r.toString()}`}({botId:a,from:"automationProcessor"})}})}).filter(ed().O9),c=t.automations.flatMap(e=>{let t=e.actions.filter(e=>"send_in_app_notification"===e.type);return 0===t.length?[]:t.map(t=>({automationId:e.id,actionId:t.id,url:a3({automationId:e.id,from:"serverExecuteEffectMap",types:["sendInAppNotificationNotificationCreatedSuccess","sendInAppNotificationMissingActivityForNotification","sendInAppNotificationNoPermission"]})}))});return 0===t.automations.length&&0===t.unloadedTemplatePageAutomations.length?(0,d.jsx)("p",{children:"No automations foun
100d for this record. Note: this tool walks downward from the given record — if you passed a database row id, try the parent collection id instead."}):(0,d.jsxs)(d.Fragment,{children:[r.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Automation fast processor Splunk queries (opens in new window)"}),(0,d.jsx)("ul",{children:r.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.url,target:"_blank",children:e.label})},e.label))})]}):void 0,s.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Automation processor Splunk queries (opens in new window)"}),(0,d.jsx)("ul",{children:s.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.url,target:"_blank",children:e.label})},e.label))})]}):void 0,o.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Recurrence Splunk queries (opens in new window)"}),(0,d.jsx)("ul",{children:o.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.url,target:"_blank",children:e.label})},e.label))})]}):void 0,l.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Automation Slack bot Splunk queries (opens in new window)"}),(0,d.jsx)("ul",{children:l.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.url,target:"_blank",children:`Automation id: ${e.automationId}, Action id: ${e.actionId}, Bot id: ${e.botId}`})},`${e.automationId}-${e.actionId}`))})]}):void 0,c.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Automation send in-app notification queries (opens in new window)"}),(0,d.jsx)("ul",{children:c.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("a",{href:e.url,target:"_blank",children:`Automation id: ${e.automationId}, Action id: ${e.actionId}`})},`${e.automationId}-${e.actionId}`))})]}):void 0,t.automations.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Automations (click to expand)"}),t.automations.map((e,t)=>{let n;return(0,d.jsx)(a7,{title:(n=`${i(e)} [${e.trigger.type}] - ${e.id}`,e.templatePageId?`${n} (template page id: ${e.templatePageId})`:n),children:(0,d.jsx)(a(243119).A,{data:e,hideHelp:!0})},t)})]}):void 0,t.unloadedTemplatePageAutomations.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Template page automation pointers that could not be loaded"}),(0,d.jsx)("ul",{children:t.unloadedTemplatePageAutomations.map(e=>(0,d.jsx)("li",{children:`Template page id: ${e.templatePageId}, block.format.automation_id: ${e.automationId}`},`${e.templatePageId}-${e.automationId}`))})]}):void 0,t.hasHitMaxDepth?(0,d.jsx)("h4",{style:a6,children:"Depth limit reached"}):void 0]})},description:"Fill out record id to search a block or collection, or use an automation id. Includes recurrences.",displayName:"Find automations for a block, collection or automation",emoji:"🔎",schema:{recordId:{comment:"Id of the block, collection or automation.",type:"string",table:"block"},userId:{comment:"Id of the user (optional). If provided, will add their role to the pointers within the automations.",type:"string",table:s().oo9}}},adminSearchAccounts:{apiName:"adminSearchAccounts",displayName:"Deep Search Account",emoji:"🔍",description:"Deep search for an account. Searches organizations, billing contracts, and workspaces by email domain, UUID, or name.",schema:{query:{type:"string"}}},adminSearchOrganizations:{apiName:"adminSearchOrganizations",displayName:"Find Organization Information",emoji:"🔎",description:"Find information about an organization. Enter an email domain, space ID or organization ID.",schema:{domainOrSpaceOrOrganizationId:{type:"string"}},customResponseRenderer:void 0},adminGetPremiumFeatureAvailabilities:{apiName:"adminGetPremiumFeatureAvailabilities",displayName:"View Premium Feature Availability",emoji:"⚙",description:"List the current feature availability for the specified Space, plus any active workspace restrictions (dunning / unpaid invoice)",schema:{spaceId:{type:"string",comment:"Space id of the workspace to check the feature for"},userId:{type:"string",comment:"User id of the user to check the feature for (optional)"},feature:{type:"options",options:a(747609).rE,comment:"Optional. Leave blank to get all features"}},isDestructive:!1},adminCalculatePropertyDependencies:{apiName:"adminCalculatePropertyDependencies",displayName:"View collection property depen
100dencies",description:"Calculate the dependencies of rollup and formula properties in a collection, along with bot permissions.",emoji:"▶",isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e,{graphvizSource:i}=t,r=function(e){let{dependencyMap:t,adjacencyList:i,recordMapWithRole:r}=e,o=0,l=new(a(877167)).G(()=>{let e=id[o];return o=(o+1)%id.length,e}),d=[],c=[];for(let e of(0,n().sb)([...Object.values(t).map(e=>e.collectionPointer.id),...Array.from(l.keys())])){var p;let t=(p=e,`collection_${(0,a(83388).Xw)(p)}`),i={id:e,table:s().VlP},n=r.getModel(i),o=(null==n?void 0:n.getRenderTitle({getRecordModel:is().b.constant(void 0),intl:(0,ir()._z)(),userTimeZone:(0,ii().P)()}))||`Unknown Collection Name (${e})`,d=r.getRole(i),m=!!d&&(0,io().Tt)(d),u=!!d&&(0,io().p2)(d),h=`${m?"Can read":"CANNOT read"}; ${u?"Can edit":"CANNOT edit"}`,y=`${o}
101(${h})`;c.push({id:t,label:y,color:l.get(e),shapeTemplate:ip})}d.push({subgraph:{id:"Collections_Legend",label:"Collections (legend)"},nodes:c,edges:[]});let m=Object.entries(ic).map(([e,t])=>({id:`type_${e}`,label:iu((0,n().ZH)(e)),shapeTemplate:t}));m.push({id:"type_default",label:"Other",shapeTemplate:ip}),d.push({subgraph:{id:"PropertyTypes_Legend",label:"Property types (legend)"},nodes:m,edges:[]});let u=[];for(let e of Object.values(t)){let t=e.collectionPointer.id;if("relation"===e.propertySchema.type){let a=e.propertySchema;t=(0,ia().z)(a)??t}let a=im(e),i=iu(e.propertySchema.name),n=ic[e.propertySchema.type]??ip;u.push({id:a,label:i,color:l.get(t),shapeTemplate:n})}let h=[];for(let[e,a]of(0,ed().WP)(i)){let i=t[e];if(!i)continue;let n=im(i);for(let e of a){let a=t[e];if(!a)continue;let i=im(a);h.push({fromId:n,toId:i})}}return d.push({nodes:u,edges:h}),il(d)}({dependencyMap:t.dependencyMap,adjacencyList:t.adjacencyList,recordMapWithRole:a(412951).RecordMapWithRole.create(t.recordMapWithRole)});return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(205855).Z,{source:r}),(0,d.jsx)(a(912946).j,{colorPalette:"blue",external:!0,href:`https://dreampuf.github.io/GraphvizOnline/#${encodeURIComponent(i)}`,children:"View simplified graph (without permission info) in Graphviz"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:"Full Response"}),(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})},schema:{collectionId:{type:"string",table:s().VlP,comment:"UUID of the collection to calculate dependencies for. If you only have a collection view block ID, use the 'Find collection information' tool to get the actual Collection ID."},botId:{type:"string",table:"bot",comment:"(Optional) UUID of a bot to check permissions on those dependencies for."},propertyId:{type:"string",comment:"(Optional) ID of a collection property to filter down to when calculating dependencies. If not provided, all properties will be included."},propertyType:{type:"options",options:["formula","rollup"],comment:"(Optional) Type of property to filter down to when calculating dependencies. If not provided, all supported property types will be included."}}},adminVerifyPeopleCollection:{apiName:"adminVerifyPeopleCollection",displayName:"Verify People Collection",emoji:"👥",description:"Verifies the People collection and person profiles for a space.",schema:{spaceId:{type:"string",table:"space"},enqueueReconciliationTask:{type:"boolean",comment:"Check this box if you want to enqueue a reconciliation task."}},customResponseRenderer:function(e){let t,i,{data:n}=e,r=(0,a(327219).tz)();function s(e){return(0,a(700369).ZV)(e,"number_with_commas",r)}function o(e,t,a){let i=s(e),n=1===e?t:a??`${t}s`;return`${i} ${n}`}t=n.doesPeopleCollectionExist?"✅ Collection exists":`🚨 Collection missing`;let l=s(n.missingPersonProfileCount),c=o(n.expectedPersonProfileCount,"profile");return i=n.doesPeopleCollectionExist?n.foundPersonProfileCount===n.expectedPersonProfileCount?`✅ Fully populated (${c})`:`🚨 Missing ${l} of ${c} total`:`🚨 Collection does not exist (missing ${l} of ${c} total)`,(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:"Verify People Collection"}),(0,d.jsx)("h3",{children:"Space"}),(0,d.jsx)("p",{children:(0,d.jsx)(a(553775).lv,{space:{id:n.spaceId,name:n.spaceName}})}),(0,d.jsx)("h3",{children:"Status"}),(0,d.jsx)("div",{children:t}),(0,d.jsx)("div",{children:i}),n.wasReconciliationTaskEnqueued?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"Actions"}),(0,d.jsx)("p",{children:"Reconciliation task enqueued"})]}):null,(0,d.jsx)("h3",{children:"People Collection Configuration Versions"}),(0,d.jsx)("div",{style:nD,children:`People collection version: ${n.peopleCollectionConfigurationVersion??"None"}`}),(0,d.jsxs)("div",{children:[(0,d.jsx)("div",{style:nT,children:"Person profile versions:"}),(0,d.jsx)("ul",{style:nR,children:n.personProfileVersions.map(({version:e,count:t,percentage:a})=>(0,d.jsx)("li",{style:nA,children:`Version ${e}: ${o(t,"profile")} (${a}%)`},e))})]}),n.peopleCollectionData?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"People Collection - permissions"}),(0,d.jsx)(a(243119).A,{data:n.peopleCollectionData,hideHelp:!0})]}):null,n.peopleCollectionViewPageData?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"People Collection View Page - format and permissions"}),(0,d.jsx)(a(243119).A,{data:n.peopleCollectionViewPageData,hideHelp:!0})]}):null]})}},adminGetSystemBlockIds:{apiName:"adminGetSystemBlockIds",displayName:"Get System Block IDs",emoji:"🆔",description:"Returns the deterministic block IDs for a white-list of system block types for a given user and space. All IDs are pure derivations — no DB lookups happen.",schema:{userId:{type:"string",table:s().oo9,showByDefaultInSingleRecordMode:!0,isRequired:!0},spaceId:{type:"string",table:"space",showByDefaultInSingleRecordMode:!0,isRequired:!0}},customResponseRenderer:function(e){let{data:t}=e,i=(0,r.useMemo)(()=>(function(e){let t={People:[],Library:[]};for(let[a,i]of(0,ed().WP)(nc))t[np[a]].push({label:i,id:e[a]});return t})(t),[t]);return(0,d.jsx)(a(4458).VP,{gap:0,children:nd.map(e=>(0,d.jsx)(nu,{groupTitle:e,entries:i[e]},e))})}}
101,adminGetDiscussionInfo:{apiName:"adminGetDiscussionInfo",displayName:"Get Discussion Info",emoji:"🧵",description:"Returns relevant metadata for a discussion.",schema:{discussionId:{type:"string",table:s().$YH,isRequired:!0},spaceId:{type:"string",table:"space",showByDefaultInSingleRecordMode:!0,isRequired:!0}}},adminGetCommentInfo:{apiName:"adminGetCommentInfo",displayName:"Get Comment Info",emoji:"💬",description:"Returns relevant metadata for a comment.",schema:{commentId:{type:"string",table:s().SNf,showByDefaultInSingleRecordMode:!0,isRequired:!0},spaceId:{type:"string",table:"space",showByDefaultInSingleRecordMode:!0,isRequired:!0}}},adminGetJoinableSpaces:{apiName:"adminGetJoinableSpaces",emoji:"🏢",displayName:"Get joinable workspaces for the user",description:"Get joinable workspaces for the user",schema:{userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"The user ID for whom to get joinable workspaces for"}},isDestructive:!1},adminGetLegalHold:{apiName:"adminGetLegalHold",displayName:"Get Legal Hold",emoji:"⚖",description:"Fetch a legal hold by ID with hydrated metadata and counts.",schema:{legalHoldId:{type:"string",table:s().PXw,placeholder:a(591977).nZ,comment:"Legal hold ID to inspect."}}},adminGetLegalHolds:{apiName:"adminGetLegalHolds",displayName:"List Legal Holds for Organization",emoji:"⚖",description:"List legal holds for an organization along with status and page counts.",schema:{organizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ,comment:"Organization ID to list legal holds for."}}},adminGetWorkflowInfo:{apiName:"adminGetWorkflowInfo",customResponseRenderer:function(e){let t,i,n,{data:s,environment:o}=e,{workflowId:l,spaceId:c,workflowMeta:p,draftWorkflowData:m,draftWorkflowDataRedactionPaths:u,publishedWorkflowData:h,publishedWorkflowDataRedactionPaths:y,publishedWorkflowVersions:g,isAlive:x,workflowRuns:f,workflowRunsLimitReached:b,workflowChatsIncluded:v,workflowChats:j,workflowChatsLimitReached:k,workflowChatsError:S,workflowBotChatsIncluded:w,workflowBotChats:I,workflowBotChatsLimitReached:C,workflowBotChatsError:D}=s,[T,R]=(0,r.useState)(f),[A,N]=(0,r.useState)(b),[M,P]=(0,r.useState)(f.length),[V,E]=(0,r.useState)(!1),[B,L]=(0,r.useState)(void 0),[_,U]=(0,r.useState)(j),[W,F]=(0,r.useState)(v),[K,$]=(0,r.useState)(k),[O,z]=(0,r.useState)(j.length),[G,q]=(0,r.useState)(!1),[H,Z]=(0,r.useState)(S??void 0),[J,Q]=(0,r.useState)(I),[Y,X]=(0,r.useState)(w),[ee,et]=(0,r.useState)(C),[ea,ei]=(0,r.useState)(I.length),[en,er]=(0,r.useState)(!1),[es,eo]=(0,r.useState)(D??void 0),el=(null==m?void 0:m.status)??(null==h?void 0:h.status),ed=(null==m?void 0:m.usage_limit)??(null==h?void 0:h.usage_limit),ec=(null==m?void 0:m.paused_reason)??(null==h?void 0:h.paused_reason);(0,r.useEffect)(()=>{R(f),N(b),P(f.length),L(void 0)},[l,f,b]),(0,r.useEffect)(()=>{F(v),U(j),$(k),z(j.length),Z(S??void 0)},[l,v,j,S,k]),(0,r.useEffect)(()=>{X(w),Q(I),et(C),ei(I.length),eo(D??void 0)},[l,w,I,D,C]);let ep=(0,r.useCallback)(async()=>{if(V||!A)return;E(!0),L(void 0);let e=await o.api.callApi({eventName:"adminGetWorkflowInfo",environment:o,data:{workflowId:l,workflowRunsOffset:M}});if("success"===e.type){let t=e.data.workflowRuns;R(e=>[...e,...t]),P(e=>e+t.length),N(e.data.workflowRunsLimitReached)}else L((0,a(201790).V4)(e));E(!1)},[o,V,l,A,M]),em=(0,r.useCallback)(async()=>{if(G||W&&!K)return;q(!0),Z(void 0);let e=await o.api.callApi({eventName:"adminGetWorkflowInfo",environment:o,data:{workflowId:l,workflowChatsOffset:W?O:0,includeWorkflowChats:!0}});if("success"===e.type)if(F(e.data.workflowChatsIncluded),e.data.workflowChatsError)Z(e.data.workflowChatsError);else{let t=e.data.workflowChats;U(e=>W?[...e,...t]:t),z(e=>W?e+t.length:t.length),$(e.data.workflowChatsLimitReached)}else Z((0,a(201790).V4)(e));q(!1)},[o,G,W,K,O,l]),eu=(0,r.useCallback)(async()=>{if(en||Y&&!ee)return;er(!0),eo(void 0);let e=await o.api.callApi({eventName:"adminGetWorkflowInfo",environment:o,data:{workflowId:l,workflowBotChatsOffset:Y?ea:0,includeWorkflowBotChats:!0}});if("success"===e.type)if(X(e.data.workflowBotChatsIncluded),e.data.workflowBotChatsError)eo(e.data.workflowBotChatsError);else{let t=e.data.workflowBotChats;Q(e=>Y?[...e,...t]:t),ei(e=>Y?e+t.length:t.length),et(e.data.workflowBotChatsLimitReached)}else eo((0,a(201790).V4)(e));er(!1)},[o,en,Y,ee,ea,l]),eh=(e,t)=>{let{redactionPaths:i}=t,n=e.triggers||[],r=e.modules||[],s=ie(e,i);return(0,d.jsxs)("div",{style:a5.container,children:[(0,d.jsxs)("div",{style:a5.style0,children:[(0,d.jsx)("strong",{children:"Basic Information"}),(0,d.jsxs)("ul",{style:a5.style1,children:[e.model&&(0,d.jsxs)("li",{style:a5.style3,children:[(0,d.jsx)("strong",{children:"Model:"})," ",e.model.type??"Unknown"]}),e.runtime_actor_pointer&&(0,d.jsxs)("li",{style:a5.style3,children:[(0,d.jsx)("strong",{children:"Runtime Actor:"})," ",(0,d.jsx)("code",{style:a5.style4,children:"string"==typeof e.runtime_actor_pointer?e.runtime_actor_pointer:JSON.stringify(e.runtime_actor_pointer)})]}),(0,d.jsxs)("li",{style:a5.style3,children:[(0,d.jsx)("strong",{children:"Has Instru
101ctions:"})," ",(0,d.jsx)("span",{style:e.has_instructions?a5.yesText:a5.noText,children:e.has_instructions?"Yes":"No"})]}),e.is_database_agent?(0,d.jsxs)("li",{style:a5.style3,children:[(0,d.jsx)("strong",{children:"Database Agent Type:"})," ",(0,d.jsx)("span",{style:a5.yesText,children:e.is_lite?"Autofill 2.0":"Full Database Agent"})]}):null]})]}),n.length>0&&(0,d.jsxs)("div",{style:a5.style0,children:[(0,d.jsxs)("strong",{children:["Triggers (",n.length,")"]}),(0,d.jsx)(a(4458).VP,{gap:8,marginTop:8,children:n.map((e,t)=>(0,d.jsxs)("div",{style:a5.itemContainer,children:[(0,d.jsxs)("div",{style:a5.style6,children:[(0,d.jsx)("strong",{children:"ID:"})," ",e.id," |",(0,d.jsx)("strong",{children:" Enabled:"})," ",(0,d.jsx)("span",{style:e.enabled?a5.enabledText:a5.disabledText,children:e.enabled?"Yes":"No"}),e.type&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Type:"})," ",e.type]}),e.moduleId&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Module ID:"})," ",e.moduleId]}),e.name&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Name:"})," ",e.name]})]}),void 0!==e.state&&null!==e.state&&(0,d.jsxs)("details",{children:[(0,d.jsx)("summary",{style:{...a5.button,...a5.blueButton,...a5.style14},children:"State Configuration"}),(0,d.jsx)("pre",{style:a5.preformatted,children:JSON.stringify(e.state,null,2)})]})]},e.id||t))})]}),r.length>0&&(0,d.jsxs)("div",{style:a5.style0,children:[(0,d.jsxs)("strong",{children:["Modules (",r.length,")"]}),(0,d.jsx)(a(4458).VP,{gap:8,marginTop:8,children:r.map((e,t)=>(0,d.jsxs)("div",{style:a5.itemContainer,children:[(0,d.jsxs)("div",{style:a5.style6,children:[(0,d.jsx)("strong",{children:"ID:"})," ",e.id," | ",(0,d.jsx)("strong",{children:"Type:"})," ",e.type,e.connectionPointer?(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Connection:"})," ",(0,d.jsx)("code",{style:a5.style7,children:JSON.stringify(e.connectionPointer)})]}):null]}),e.permissions&&e.permissions.length>0?(0,d.jsxs)("details",{children:[(0,d.jsxs)("summary",{style:{...a5.button,...a5.greenButton,...a5.style14},children:["Permissions (",e.permissions.length,")"]}),(0,d.jsx)("div",{style:a5.style8,children:e.permissions.map((e,t)=>(0,d.jsx)("pre",{style:{...a5.preformatted,...a5.style15},children:JSON.stringify(e,null,2)},t))})]}):(0,d.jsx)("div",{style:{...a5.style16,...a5.secondaryText},children:"No permissions"}),void 0!==e.persistedState&&null!==e.persistedState&&(0,d.jsxs)("details",{style:a5.style8,children:[(0,d.jsx)("summary",{style:{...a5.button,...a5.blueButton,...a5.style22},children:"Persisted State (Allowlisted)"}),(0,d.jsx)("pre",{style:a5.preformatted,children:JSON.stringify(e.persistedState,null,2)})]})]},e.id||t))})]}),(0,d.jsxs)("details",{style:a5.style9,children:[(0,d.jsx)("summary",{style:{...a5.button,...a5.grayButton,...a5.style14},children:"View Full JSON"}),(0,d.jsx)(a(243119).A,{data:s,hideHelp:!0})]})]})},ey=`Recent Workflow Runs (${T.length}${A?" - paginate for more at bottom":""})`,eg=`Recent Chats (${_.length}${K?" - paginate for more at bottom":""})`,ex=`Recent Bot-Triggered Chats (${J.length}${ee?" - paginate for more at bottom":""})`,ef=e=>!0===e?"Yes":!1===e?"No":"Unknown",eb=e=>!0===e?a5.yesText:!1===e?a5.noText:a5.secondaryText;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:"Workflow Information"}),(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Workflow ID:"})," ",(0,d.jsx)("code",{style:a5.style4,children:l})," ",(0,d.jsx)("a",{href:`/__admin/find?workflowId=${l}#adminGetWorkflowInfo`,style:a5.link,children:"Admin link"})," ","|"," ",(0,d.jsx)("a",{href:`/agent/${l.replace(/-/g,"")}`,target:"_blank",style:a5.link,children:"Open in Notion"})]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Status:"})," ",(0,d.jsx)("span",{style:x?a5.activeStatus:a5.inactiveStatus,children:x?"Active":"In Trash"})]}),p.created_by_table&&p.created_by_id?(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Created By:"})," ",(0,d.jsx)(a(553775).ru,{table:p.created_by_table,record:{id:p.created_by_id}}),p.created_time?(0,d.jsxs)("span",{children:[" ","(",new Date(p.created_time).toLocaleStr
101ing(),")"]}):null]}):null,p.last_edited_by_table&&p.last_edited_by_id?(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Last Edited By:"})," ",(0,d.jsx)(a(553775).ru,{table:p.last_edited_by_table,record:{id:p.last_edited_by_id}}),p.last_edited_time?(0,d.jsxs)("span",{children:[" ","(",new Date(p.last_edited_time).toLocaleString(),")"]}):null]}):null,c?(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Workspace:"})," ",(0,d.jsx)(a(553775).ru,{table:"space",record:{id:c}})]}):null,(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Workflow Status:"})," ",el??"Unknown"]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Usage Limit:"})," ",ed?(0,d.jsx)("code",{style:a5.style4,children:JSON.stringify(ed)}):"None"]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Paused Reason:"})," ",ec?(0,d.jsx)("code",{style:a5.style4,children:JSON.stringify(ie(ec,[["metadata","errorMessage"]]))}):"None"]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Splunk Logs:"})," ",(0,d.jsx)("a",{href:(t=a2(),i=`search index=${t} data.workflowId="${l}"`,(n=new URLSearchParams).set("q",i),`https://notion.splunkcloud.com/en-GB/app/search/search?${n.toString()}`),target:"_blank",style:a5.link,children:"View workflow logs in Splunk"})]}),(0,d.jsxs)("p",{children:[(0,d.jsx)("strong",{children:"Kill Switches:"})," ",(0,d.jsx)("a",{href:"https://console.statsig.com/6TSma7coh47E7CjMbuSVCO/gates/custom_agent_preenqueue_kill_switch",target:"_blank",style:a5.link,children:"Pre-enqueue"})," ","|"," ",(0,d.jsx)("a",{href:"https://console.statsig.com/6TSma7coh47E7CjMbuSVCO/gates/custom_agent_kill_switch",target:"_blank",style:a5.link,children:"Still enqueue jobs"})]}),(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:a5.summary,children:"Workflow Metadata"}),(0,d.jsx)(a(243119).A,{data:p,hideHelp:!0})]}),m&&(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:{...a5.summary,...a5.draftSummary},children:"Current Draft State"}),eh(m,{redactionPaths:u})]}),h?(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:{...a5.summary,...a5.publishedSummary},children:"Current Published State"}),eh(h,{redactionPaths:y})]}):(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:a5.summary,children:"No Published Version"}),(0,d.jsx)("div",{style:{...a5.versionContainer,...a5.style17},children:(0,d.jsx)("p",{style:a5.style10,children:"This workflow has not been published yet."})})]}),g.length>0&&(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsxs)("summary",{style:{...a5.summary,...a5.versionsSummary},children:["Published Workflow Versions (",g.length,")"]}),(0,d.jsx)(a(4458).VP,{gap:8,marginTop:8,children:g.map((e,t)=>(0,d.jsxs)("div",{style:a5.versionContainer,children:[(0,d.jsxs)("div",{style:a5.style6,children:[(0,d.jsxs)("strong",{children:["Version ",t+1]})," - ID: ",e.id,e.createdAt&&(0,d.jsxs)("div",{style:{...a5.style18,...a5.secondaryText},children:["Created: ",new Date(e.createdAt).toLocaleString(),e.createdBy&&(0,d.jsxs)("span",{children:[" by ",e.createdBy]})]})]}),e.model?eh(e.model,{redactionPaths:e.redactionPaths}):(0,d.jsx)("div",{style:{...a5.style19,...a5.secondaryText},children:"No data available for this version."})]},e.id))})]}),!m&&!h&&0===g.length&&(0,d.jsx)("div",{style:a5.noDataContainer,children:(0,d.jsx)("p",{style:{...a5.style20,...a5.secondaryText},children:"No workflow data found - no draft, published state, or versions available."})}),T.length>0&&(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:a5.summary,children:ey}),(0,d.jsxs)(a(4458).VP,{gap:8,marginTop:8,children:[T.map((e,t)=>(0,d.jsxs)("div",{style:a5.versionContainer,children:[(0,d.jsxs)("div",{style:a5.style11,children:[(0,d.jsxs)("strong",{children:["Run ",t+1]})," - ID: ",e.id,e.status&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Status:"})," ",(0,d.jsx)("span",{style:(e=>{switch(e){case"success":return a5.statusSuccess;case"failure":case"retryableFailure":case"insufficientPermissions":return a5.statusFailure;
101case"pending":case"paused":return a5.statusPending;case"running":return a5.statusRunning;default:return a5.statusOther}})(e.status),children:e.status})]}),e.pausedReason&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Paused Reason:"})," ",e.pausedReason]}),e.pauseReasonId&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Pause Reason ID:"})," ",e.pauseReasonId]}),e.pausedToolName&&(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Paused Tool:"})," ",e.pausedToolName]})]}),(e.triggerId||e.triggerType)&&(0,d.jsxs)("div",{style:a5.style12,children:[e.triggerType&&(0,d.jsxs)("span",{children:[(0,d.jsx)("strong",{children:"Trigger Type:"})," ",e.triggerType]}),e.triggerId&&(0,d.jsxs)("span",{children:[e.triggerType?" | ":"",(0,d.jsx)("strong",{children:"Trigger ID:"})," ",e.triggerId]})]}),(0,d.jsxs)("div",{style:{...a5.style21,...a5.secondaryText},children:["Created: ",new Date(e.createdAt).toLocaleString(),e.finishedAt&&(0,d.jsxs)("span",{children:[" ","| Finished: ",new Date(e.finishedAt).toLocaleString()]})]}),(0,d.jsxs)("div",{style:a5.style12,children:[e.threadId&&(0,d.jsxs)("span",{children:[(0,d.jsx)("strong",{children:"Thread ID:"})," ",e.threadId," ",(0,d.jsx)("a",{href:`/__admin/thread/${e.threadId}`,style:a5.link,children:"View redacted transcript"})]}),e.errorMessage&&(0,d.jsxs)("div",{style:a5.style13,children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Error:"})," ",e.errorMessage]}),e.errorType&&(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Error Type:"})," ",e.errorType]}),e.reflectionReasons&&e.reflectionReasons.length>0&&(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Reflection Reasons:"})," ",e.reflectionReasons.join(", ")]})]})]})]},e.id)),A?(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)(a(548436).A,{onClick:ep,disabled:V,children:V?"Loading...":"Load more runs"}),B?(0,d.jsx)("span",{style:a5.loadMoreError,children:B}):null]}):null]})]}),W?null:(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,marginBottom:16,children:[(0,d.jsx)("span",{style:a5.secondaryText,children:"Recent chats were not loaded."}),(0,d.jsx)(a(548436).A,{onClick:em,disabled:G,children:G?"Loading...":"Load recent chats"})]}),0===_.length&&H?(0,d.jsxs)("p",{style:a5.loadMoreError,children:[(0,d.jsx)("strong",{children:"Recent chats unavailable:"})," ",H]}):null,W&&0===_.length&&!H?(0,d.jsx)("p",{style:a5.secondaryText,children:"No recent chats found."}):null,_.length>0&&(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:a5.summary,children:eg}),(0,d.jsxs)(a(4458).VP,{gap:8,marginTop:8,children:[_.map((e,t)=>(0,d.jsxs)("div",{style:a5.versionContainer,children:[(0,d.jsxs)("div",{style:a5.style11,children:[(0,d.jsxs)("strong",{children:["Chat ",t+1]})," - ID: ",e.id,e.type?(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Type:"})," ",e.type]}):null,(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Alive:"})," ",(0,d.jsx)("span",{style:eb(e.alive),children:ef(e.alive)})]})]}),(0,d.jsxs)("div",{style:{...a5.style21,...a5.secondaryText},children:["Created: ",new Date(e.createdAt).toLocaleString(),e.updatedAt?(0,d.jsxs)("span",{children:[" ","| Updated: ",new Date(e.updatedAt).toLocaleString()]}):null,(0,d.jsxs)("span",{children:[" ","| Messages: ",it(e.messageCount)]})]}),(0,d.jsxs)("div",{style:a5.style12,children:[e.createdById&&e.createdByTable?(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Created By:"})," ",e.createdById," (",e.createdByTable,")"]}):null,e.createdSource?(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Created Source:"})," ",e.createdSource]}):null,e.currentInferenceId?(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Current Inference ID:"})," ",e.currentInferenceId]}):null,(0,d.jsx)("a",{href:`/__admin/thread/${e.id}`,style:a5.link,children:"View redacted transcript"})]})]},e.id)),K?(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)(a(548436).A,{onClick:em,disabled:G,children:G?"Loading...":"Load more chats"}),H?(0,d.jsx)("span",{style:a5.loadMoreError,children:H}):null]}):null]})]}),Y?null:(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,marginBottom:16,children:[(0,d.jsx)("span",{style:a5.secondaryText,children:"Recent bot-triggered chats were not loaded."}),(0,d.jsx)(a(548436).A,{onClick:eu,disabled:en,children:en?"Loading...":"Load recent bot chats"})]}),0===J.length&&es?(0,d.jsxs)("p",{style:a5.loadMoreError,children:[(0,d.jsx)("strong",{children:"Recent bot-triggered chats unavailable:"})," ",es]}):null,Y&&0===J.length&&!es?(0,d.jsx)("p",{style:a5.secondaryText,children:"No recent bot-triggered chats found."}):null,J.length>0&&(0,d.jsxs)("details",{style:a5.style0,children:[(0,d.jsx)("summary",{style:a5.summary,children:ex}),(0,d.jsxs)(a(4458).VP,{gap:8,marginTop:8,children:[J.map((e,t)=>(0,d.jsxs)("div",{style:a5.versionContainer,children:[(0,d.jsxs)("div",{style:a5.style11,children:[(0,d.jsxs)("strong",{children:["Bot Chat ",t+1]})," - ID: ",e.id,e.type?(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Type:"})," ",e.type]}):null,(0,d.jsxs)("span",{children:[" ","| ",(0,d.jsx)("strong",{children:"Alive:"})," ",(0,d.jsx)("span",{style:eb(e.alive),children:ef(e.alive)})]})]}),(0,d.jsxs)("div",{style:{...a5.style21,...a5.secondaryText}
101,children:["Created: ",new Date(e.createdAt).toLocaleString(),e.updatedAt?(0,d.jsxs)("span",{children:[" ","| Updated: ",new Date(e.updatedAt).toLocaleString()]}):null,(0,d.jsxs)("span",{children:[" ","| Messages: ",it(e.messageCount)]})]}),(0,d.jsxs)("div",{style:a5.style12,children:[e.createdById&&e.createdByTable?(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Created By:"})," ",e.createdById," (",e.createdByTable,")"]}):null,e.createdSource?(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Created Source:"})," ",e.createdSource]}):null,e.currentInferenceId?(0,d.jsxs)("div",{children:[(0,d.jsx)("strong",{children:"Current Inference ID:"})," ",e.currentInferenceId]}):null,(0,d.jsx)("a",{href:`/__admin/thread/${e.id}`,style:a5.link,children:"View redacted transcript"})]})]},e.id)),ee?(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)(a(548436).A,{onClick:eu,disabled:en,children:en?"Loading...":"Load more bot chats"}),es?(0,d.jsx)("span",{style:a5.loadMoreError,children:es}):null]}):null]})]})]})},description:"Get detailed information about a workflow including current published version, draft versions, and recent runs. Recent chats are available as opt-in fields. Can look up by w
101orkflow ID or bot ID.",displayName:"Get workflow information",emoji:"🔧",schema:{workflowId:{comment:"ID of the workflow to get information for (or use Bot ID instead).",type:"string",table:s().C0E},botId:{comment:"ID of a workflow bot to look up the workflow for (alternative to Workflow ID).",type:"string",table:"bot"},workflowVersionsLimit:{comment:"Maximum number of published workflow versions to return. Defaults to 10. Set to 0 if this request returns a 504.",type:"number"},includeWorkflowChats:{comment:"Include recent user-authored chats. Disabled by default because chat lookup can be expensive for high-volume workflows.",type:"boolean",defaultValue:!1},includeWorkflowBotChats:{comment:"Include recent bot-triggered chats. Disabled by default because chat lookup can be expensive for high-volume workflows.",type:"boolean",defaultValue:!1},skipRunsAndChats:{comment:"Skip workflow runs and chats to return only workflow metadata.",type:"boolean"}}},adminGetSlackAppMentionRegistrationStatus:{apiName:"adminGetSlackAppMentionRegistrationStatus",description:"Inspect a published workflow's Slack app-mention user-group registrations, including stale or disabled aliases.",displayName:"Check Slack app-mention registration",emoji:"🔎",schema:{workflowId:{comment:"ID of the workflow to inspect.",type:"string",table:s().C0E}}},adminReconcileSlackAppMentionRegistrations:{apiName:"adminReconcileSlackAppMentionRegistrations",description:"Reconcile a published workflow's Slack app-mention user-group registrations. This may create, enable, or update a Slack user group; it never replays past events.",displayName:"Repair Slack app-mention registration",emoji:"🔧",schema:{workflowId:{comment:"ID of the workflow whose registration should be reconciled.",type:"string",table:s().C0E}},isDestructive:!0},adminClearWorkflowPausedReason:{apiName:"adminClearWorkflowPausedReason",description:"Clear a workflow's paused_reason and set its status back to runnable.",displayName:"Clear workflow paused reason",emoji:"▶️",schema:{workflowId:{comment:"ID of the workflow to clear paused reason for.",type:"string",table:s().C0E},spaceId:{comment:"ID of the space containing the workflow.",type:"string",table:"space"}}},adminSummarizeSkillHealthInSpace:{apiName:"adminSummarizeSkillHealthInSpace",displayName:"Summarize skill health in a workspace",emoji:"🩺",description:"Cheap workspace-level triage for Settings candidate-window risk, stale rich text state, migration coverage, and malformed favorite data.",customResponseRenderer:function(e){let{data:t}=e,i=(0,a(533992).v3)(),[n,s]=(0,r.useState)([]),[o,l]=(0,r.useState)();(0,r.useEffect)(()=>{s([]),l(void 0);let{outputKey:e,outputSpaceId:n}=t;if(void 0!==e&&void 0!==n){let t=new AbortController;return(0,nP().cK)({environment:i,outputKey:e,spaceId:n,signal:t.signal,outputValidator:nU,inactivityTimeoutMs:3e5,onChange:e=>{let{value:t}=e;if(void 0!==t&&s(e=>[...e,t]),"failure"===e.status){var a;l((null==(a=e.value)?void 0:a.type)==="failed"?e.value.message:"Task failed.")}return(0,nP().W$)(e)}}).catch(e=>{t.signal.aborted||l(e instanceof Error?e.message:"Task failed.")}),()=>{t.abort()}}let r=t.taskId;if(void 0===r)return void l("Task failed.");let o=!1;return a(259242).fJ.add(r),async function(){for await(let e of(0,a(259242).BP)({environment:i,eventName:n9,taskId:r})){if(o)break;nN().Q.isSuccess(e)?s(t=>[...t,e.value]):l(e.error.message??"Task failed.")}}(),()=>{o=!0,a(259242).fJ.delete(r)}},[t.outputKey,t.outputSpaceId,t.taskId,i]);let c=(0,r.useMemo)(()=>{let e=[...n].reverse().find(e=>"completed"===e.type);return(null==e?void 0:e.type)==="completed"?e.report:void 0},[n]),p=n.length>0?n[n.length-1]:void 0,m=t.outputKey??t.taskId;return c?(0,d.jsx)(rl,{responseData:c,taskId:m}):(0,d.jsx)(a(4458).VP,{gap:16,children:(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`Task ${m}`}),0===n.length?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"Waiting for scan to start..."}):(null==p?void 0:p.type)==="progress"?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:p.message}):(null==p?void 0:p.type)==="failed"?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorPalette:"red",children:p.message}):void 0,o?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorPalette:"red",children:o}):void 0]})})},schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to summarize"}}},adminDiagnoseSkillSystemForUserInSpace:{apiName:"adminDiagnoseSkillSystemForUserInSpace",displayName:"Diagnose skill visibility for a user in a workspace",emoji:"🔬",description:"Exact user-level diagnostic for Settings visibility, rich text durable state, favorites migration lineage, and malformed stored favorite data.",customResponseRenderer:function(e){let{data:t}=e,i=(0,a(533992).v3)(),[n,s]=(0,r.useState)([]),[o,l]=(0,r.useState)();(0,r.useEffect)(()=>{s([]),l(void 0);let{outputKey:e,outputSpaceId:n}=t;if(void 0!==e&&void 0!==n){var r;let t;return r={outputKey:e,outputSpaceId:n},t=new AbortController,(0,nP().cK)({environment:i,outputKey:r.outputKey,spaceId:r.outputSpaceId,signal:t.signal,outputValidator:n_,inactivityTimeoutMs:3e5,onChange:e=>{let{value:t}=e;if(void 0!==t&&s(e=>[...e,t]),"failure"===e.status){var a;l((null==(a=e.value)?void 0:a.type)==="failed"?e.value.message:"Task failed.")}return(0,nP().W$)(e)}}).catch(e=>{t.signal.aborted||l(e instanceof Error?e.message:"Task failed.")}),()=>{t.abort()}}let o=t.taskId;if(void 0===o)return void l("Task failed.");let d=!1;return a(259242).fJ.add(o),async function(){for await(let e of(0,a(259242).BP)({environment:i,eventName:nM,taskId:o})){if(d)break;nN().Q.isSuccess(e)?s(t=>[...t,e.value]):l(e.error.message??"Task failed.")}}(),()=>{d=!0,a(259242).fJ.delete(o)}},[t.outputKey,t.outputSpaceId,t.taskId,i]);let c=(0,r.useMemo)(()=>{let e=[...n].reverse().find(e=>"completed"===e.type);return(null==e?void 0:e.type)==="completed"?e.report:void 0},[n]),p=n.length>0?n[n.length-1]:void 0,m=void 0!==c,u=t.outputKey??t.taskId;return(0,d.jsxs)(a(4458).VP,{gap:16,children:[(0,d.jsxs)(a(4458).VP,{gap:6,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:`Task ${u}`}),m?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Completed"}):0===n.length?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"Waiting for task to start..."}):(0,d.jsx)(a(4458).fI,{gap:6,flexWrap:"wrap",children:n.map((e,t)=>(0,d.jsx)(a(746434).E,{content:"progress"===e.type?e.stage:"completed"===e.type?"done":"failed",color:"failed"===e.type?"red":e===p?"blue":"gray"},`${e.type}-${t}`))}),o?(0,d.jsx)(a(746434).E,{content:o,color:"red"}):void 0]}),c?(0,d.jsx)(n6,{report:c}):void 0]})},schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID"},userId:{type:"string",table:s().oo9,comment:"User ID"}}},adminListEntityNotes:{apiName:"adminListEntityNotes",displayName:"List Entity Notes",emoji:"📝",description:"List notes for a 
101workspace, account, or user entity.",schema:{entityType:{type:"options",options:["workspace","account","user"],defaultValue:"workspace",comment:"Type of entity to list notes for"},entityId:{type:"string",comment:"UUID of the entity"}}},adminCreateEntityNote:{apiName:"adminCreateEntityNote",displayName:"Create Entity Note",emoji:"✏️",description:"Create a note on a workspace, account, or user entity. Max 1,000 characters.",schema:{entityType:{type:"options",options:["workspace","account","user"],defaultValue:"workspace",comment:"Type of entity to attach the note to"},entityId:{type:"string",comment:"UUID of the entity"},spaceId:{type:"string",comment:"Optional space ID (convenience for workspace notes)"},noteText:{type:"string",comment:"Note content (max 1,000 characters)"}}},adminArchiveEntityNote:{apiName:"adminArchiveEntityNote",displayName:"Archive Entity Note",emoji:"🗃️",description:"Soft-delete a note by setting archivedTime. Only the author can archive.",schema:{noteId:{type:"string",comment:"UUID of the note to archive"},entityType:{type:"options",options:["workspace","account","user"],defaultValue:"workspace",comment:"Type of entity the note belongs to"},entityId:{type:"string",comment:"UUID of the entity"}}}};function rc(e){let t=(0,a(327219).tz)(),{apiLog:i,adminUser:n}=e,r=n?(0,a(197018).lR)(t,(0,a(197018).A7)(n)):i.admin_user_id===a(514214).BF.id?"NotionAdminProcess":`Unknown user: ${i.admin_user_id}`;return(0,d.jsxs)(d.Fragment,{children:[`${new Date(i.timestamp).toLocaleString()} by `,(0,d.jsx)("i",{children:r})," via ",(0,d.jsx)("i",{children:i.event_name}),(0,d.jsx)(a(810198).Z,{params:i.params,adminUserId:i.admin_user_id})]})}function rp(e){let{opLog:t}=e,{operation:i}=t;return(0,a(443756).Rm)(i)?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("i",{children:i.command})," ",(0,d.jsx)("b",{children:(i.path||[]).join(".")})," to"," ",(0,d.jsx)("b",{children:JSON.stringify(i.args)})]}):(0,d.jsx)(d.Fragment,{children:JSON.stringify(t.operation)})}function rm(e){let t=(0,a(327219).tz)(),{pointer:i,recordMap:n}=e,r=n&&n.getValue(i),{table:o}=i;return r?"space"===o||"block"===o?(0,d.jsx)(a(553775).ru,{record:r,table:o},r.id):o===s().xMx||o===s().rNM||o===s().GDR?(0,d.jsx)(a(553775).ru,{record:r,table:s().oo9},r.id):o===s().oo9?(0,d.jsx)(a(553775).ru,{record:r,table:o,children:(0,a(197018).lR)(t,(0,a(197018).A7)(r))},r.id):(0,d.jsx)(d.Fragment,{children:JSON.stringify(r)}):(0,d.jsx)(d.Fragment,{})}function ru(e){let{opLogs:t,recordMapJson:i}=e,n=(0,r.useMemo)(()=>i&&a(412951).RecordMap.create(i),[i]);return(0,d.jsx)(d.Fragment,{children:t.map(e=>(0,d.jsxs)("li",{children:[(0,d.jsx)(rp,{opLog:e}),n?" on ":void 0,(0,d.jsx)(rm,{pointer:e.operation.pointer,recordMap:n})]},e.id))})}let rh={style0:{marginTop:"0.1em",marginBottom:"0.5em"},style1:{marginTop:"0.5em",marginInlineStart:"1em",fontSize:"0.9em",backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary,padding:"0.5em",borderRadius:"4px",overflow:"auto",maxWidth:"100%",whiteSpace:"pre-wrap",wordBreak:"break-word"}};function ry(e){var t;let{entry:a}=e,i=(0,r.useMemo)(()=>{var e;return null!=(e=a.apiLog)&&e.params?JSON.stringify(a.apiLog.params,null,2):null},[null==(t=a.apiLog)?void 0:t.params]);return(0,d.jsxs)("div",{children:[a.apiLog?(0,d.jsx)(rc,{apiLog:a.apiLog,adminUser:a.adminUser}):"????",(0,d.jsxs)("ul",{style:rh.style0,children:[i?(0,d.jsxs)("li",{children:[(0,d.jsx)("div",{children:"with params:"}),(0,d.jsx)("pre",{style:rh.style1,children:i})]},"params"):void 0,(0,d.jsx)(ru,{opLogs:a.opLogs})]})]})}function rg(e){let{data:t}=e;return 0===t.changes.length?(0,d.jsx)(d.Fragment,{children:"No changes"}):(0,d.jsx)(d.Fragment,{children:t.changes.map(e=>(0,d.jsx)(ry,{entry:e},e.apiLog?e.apiLog.id:"unknown_key"))})}let rx={header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:12,paddingBottom:8}},rf=["Timestamp","Admin User"];function rb(e){return e.apiLog.id}function rv(e){return e.apiLog}function rj(e){let{apiLog:t,adminUser:i}=e.entry;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aS,{children:new Date(t.timestamp).toLocaleStr
101ing()}),(0,d.jsx)(aS,{children:(0,d.jsx)(a(553775).uQ,{user:i})})]})}let rk=a(604063).wJ.flatMap(e=>[...a(604063).i8[e].tools]).sort(),rS={getUserAdminApiLog:{apiName:"getUserAdminApiLog",displayName:"Find Admin Changes to User",emoji:"🔎",description:"Returns information about changes admins have made to a user.",schema:{userId:{type:"string",table:s().oo9,showByDefaultInSingleRecordMode:!0}},customResponseRenderer:rg},getAdminHistory:{apiName:"getAdminHistory",displayName:"Find Changes an Admin User has made",emoji:"🔎",description:"Returns information about changes admins have made via admin tools",schema:{userId:{type:"string",table:s().oo9,showByDefaultInSingleRecordMode:!1},destructiveOnly:{type:"boolean",defaultValue:!0}},customResponseRenderer:function(e){let{data:t}=e;return 0===t.changes.length?(0,d.jsx)(d.Fragment,{children:"No changes"}):(0,d.jsx)(d.Fragment,{children:t.changes.map(e=>{let{apiLog:i,opLogs:n}=e;return(0,d.jsxs)(r.Fragment,{children:[new Date(i.timestamp).toDateString()," via ",i.event_name," - ",n&&n.length>0?(0,d.jsx)(ru,{opLogs:n,recordMapJson:t.adminRecordMap}):(0,d.jsx)(a(503270).H,{data:i.params}),(0,d.jsx)("br",{})]},i.id)})})}},getSpaceAdminApiLog:{apiName:"getSpaceAdminApiLog",displayName:"Find Admin Changes to Space",emoji:"🔎",description:"Returns information about changes admins have made to a space.",schema:{spaceId:{type:"string",table:"space",showByDefaultInSingleRecordMode:!0}},customResponseRenderer:rg},getBlockAdminApiLog:{apiName:"getBlockAdminApiLog",displayName:"Find Admin Changes to Block",emoji:"🔎",description:"Returns information about changes admins have made to a block.",schema:{blockId:{type:"string",table:"block",showByDefaultInSingleRecordMode:!0}},customResponseRenderer:rg},adminGetApiLogsByEventName:{apiName:"adminGetApiLogsByEventName",displayName:"Find Admin Logs by Event Name",emoji:"🔎",description:"Returns recent admin API log entries for a specific event name (tool).",schema:{eventName:{type:"options",options:rk,placeholder:"Select an admin tool"}},customResponseRenderer:function(e){let t=e.data;return(0,d.jsxs)(d.Fragment,{children:[t.length>0?(0,d.jsx)("div",{style:rx.header,children:`API Logs for ${t[0].apiLog.event_name}`}):void 0,(0,d.jsx)(aI,{columns:rf,items:t,getItemId:rb,getItemJson:rv,renderRow:e=>(0,d.jsx)(rj,{entry:e}),emptyMessage:"No log entries found."})]})}}},rw={section:{marginTop:12,gap:8},table:{borderCollapse:"collapse",width:"100%",fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:12},th:{textAlign:"start",padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.secondary},tdBase:{padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top"},td:{padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top",userSelect:"all",WebkitUserSelect:"all"},tdRevoked:{padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top",userSelect:"all",WebkitUserSelect:"all",color:a(632079).Tj.text.secondary}};function rI(e,t){return e?new Date(e).toLocaleString():t}function rC({botId:e,tokens:t}){if(0===t.length)return(0,d.jsx)(a(553775).i$,{warnings:["No bot tokens found"]});let i=[...t].sort((e,t)=>Number(t.created_at)-Number(e.created_at)),n=(0,a(83388).Xw)(e);return(0,d.jsxs)("table",{style:rw.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:rw.th,children:"Token ID"}),(0,d.jsx)("th",{style:rw.th,children:"Secret preview"}),(0,d.jsx)("th",{style:rw.th,children:"Created"}),(0,d.jsx)("th",{style:rw.th,children:"Revoked"}),(0,d.jsx)("th",{style:rw.th,children:"Expires"}),(0,d.jsx)("th",{style:rw.th,children:"Parent token"}),(0,d.jsx)("th",{style:rw.th,children:"Action"})]})}),(0,d.jsx)("tbody",{children:i.map(e=>{let t,i=void 0!==e.revoked_at,r=i?rw.tdRevoked:rw.td,s=(0,a(83388).Xw)(e.id);return(0,d.jsxs)("tr",{children:[(0,d.jsx)("td",{style:r,children:s}),(0,d.jsx)("td",{style:r,children:e.secret_preview}),(0,d.jsx)("td",{style:r,children:rI(e.created_at,"Never")}),(0,d.jsx)("td",{style:r,children:rI(e.revoked_at,"Never")}),(0,d.jsx)("td",{style:r,children:rI(e.expires_at,"-")}),(0,d.jsx)("td",{style:r,children:e.parent_bot_token_id?(0,a(83388).Xw)(e.parent_bot_token_id):"—"}),(0,d.jsx)("td",{style:rw.tdBase,children:i?(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"—"}):(0,d.jsx)(a(428217).V,{hoverColor:"red",href:(t=new URLSearchParams({botId:n,tokenId:s}),`${a(168962).JZ.admin}/security?${t.toString()}#adminRevokeBotToken`),children:"Revoke this token →"})})]},e.id)})})]})}let rD=(0,a(327219).YK)({missingMetadataTitle:{id:"admin.getIntegration.missingLinkPreviewDisplayMetadata.title",defaultMessage:"Link preview display metadata is incomplete"},missingMetadataDescription:{id:"admin.getIntegration.missingLinkPreviewDisplayMetadata.description",defaultMessage:"Missing fields: {missingFields}. The preview will use fallback styling until these values are set."},openUpdateIntegration:{id:"admin.getIntegration.openUpdateIntegration",defaultMessage:"Open Update integration"}});function rT(e){let{globalUser:t}=e;return(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:"Slack Global User"}),t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Global User Id: "}),t.id]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Slack Enterprise Id: "}),t.slack_enterprise_id||"N/A"]}),(0,d.jsx)("div",{children:(0,d.jsx)(rA,{slackGlobalUserPreferences:t.preferences})})]}):"N/A"]})}function rR(e){let{slackLocalUsers:t}=e,a=t.length;return(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:`Slack Local Users (${a})`}),a>0?(0,d.jsx)("ol",{children:t.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Slack User Id:"})," ",e.slack_local_user_id]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Slack Workspace Id:"})," ",e.slack_workspace_id]})]},t))}):"N/A"]})}function rA(e){let{slackGlobalUserPreferences:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h3",{children:"User Preferences"}),t?(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0}):"N/A"]})}function rN(e){let{notionTokens:t,spaces:i}=e,n=t.length;return(0,d.jsxs)("div",{children:[(0,d.jsx)("h3",{children:`Notion Bot Ids (${n})`}),n>0?(0,d.jsx)("ol",{children:t.map((e,t)=>(0,d.jsxs)("li",{children:[(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Bot Id: "}),e.notion_bot_id]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Bot Creator: "}),(0,d.jsx)(a(553775).uQ,{user:e.botCreator})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Notion Workspace: "}),i[e.notion_workspace_id]?(0,d.jsx)(a(553775).ru,{table:"space",record:{id:i[e.notion_workspace_id].id,name:i[e.notion_workspace_id].name}}):(0,d.jsx)(d.Fragment,{children:e.notion_workspace_id})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)("b",{children:"Is Token Alive?: "}),`${e.alive}`]})]},t))}):"N/A"]})}let rM={margin:"10px"},rP={accordionItem:{border:`1px ${a(713101).$.dark.gray["850"]} solid`,borderRadius:6,marginTop:8},accordionItemTitle:{display:"flex",justifyContent:"space-between",padding:"6px 12px",cursor:"pointer",userSelect:"none"},accordionItemDetails:{paddingInlineStart:38,paddingInlineEnd:24,transition:"all 0.2s ease"}};function rV(e){let[t,i]=r.useState(!1);return(0,d.jsxs)("div",{style:rP.accordionItem,children:[(0,d.jsxs)("div",{style:rP.accordionItemTitle,onClick:()=>i(!t),children:[(0,d.jsx)(a(4458).fI,{alignItems:"center",children:(0,d.jsx)("div",{children:e.title})}),e.children?(0,d.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",transform:t?"rotate(180deg)":void 0,transition:"transform 0.2s ease",transformOrigin:"center"},children:(0,d.jsx)(a(16275).I,{icon:a(595453).arrowChevronSingleDownSmallIcon,size:"xxs"})}):void 0]}),(0,d.jsx)("div",{style:{...rP.accordionItemDetails,opacity:+!!t,flex:+!!t,paddingBottom:8*!!t,transform:t?"translate3d(0,-4px,0)":"translate3d(0,-8px,0)"},children:t?e.children:void 0})]})}let rE={type:"array",items:{type:"object",required:["name","regex","attributes"],properties:{name:{type:"string",description:"Identifier for this URL pattern"},regex:{type:"string",description:"Regex to match against URLs from the verified domains"},sample_urls:{type:"array",items:{type:"string"},description:"Example URLs that should match the regex"},attributes:{type:"array",description:"Attribute definitions extracted from regex matches",items:{type:"object",required:["id","type","values"],properties:{id:{type:"string"},name:{type:"string"},type:{type:"string",enum:["inline","embed","relation","person"]},values:{type:"array",items:{type:"array",items:{type:"string"}}},format:{type:"object"}}}},additional_types:{type:"object",properties:{collection:{type:"boolean"},connectedRelation:{type:"boolean"}}}}}},rB={adminGetIntegrationData:{apiName:"adminGetIntegrationData",displayName:"Get integration",emoji:"🤖",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"Get information about an integration."}),(0,d.jsx)(a(884877).A,{size:8,axis:"y"}),(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"NOTE: Public integrations might have a large number of bots, so we only return up to 100 bot IDs in the response of this tool."})]}),customResponseRenderer:function(e){let t,{data:i}=e,n=(0,a(327219).tz)(),r="integrationId"in i?i.integrationId:void 0,s="missingLinkPreviewDisplayMetadata"in i?i.missingLinkPreviewDisplayMetadata:void 0;return(0,d.jsxs)(a(4458).VP,{children:[s&&s.length>0?(0,d.jsx)(a(748356).l,{display:"inline",tint:"yellow",staticIcon:a(966559).exclamationMarkCircleSmallIcon,label:n.formatMessage(rD.missingMetadataTitle),description:n.formatMessage(rD.missingMetadataDescription,{missingFields:s.join(", ")})}):void 0,r?(0,d.jsx)(a(4458).VP,{gap:8,marginBottom:8,children:(0,d.jsx)(a(428217).V,{
101color:"notion-link-blue",hoverColor:"blue",href:(t=new URLSearchParams({integrationId:r}),`${a(168962).JZ.admin}/integrations?${t.toString()}#adminUpdateIntegrationData`),external:!0,children:n.formatMessage(rD.openUpdateIntegration)})}):void 0,(0,d.jsx)(a(243119).A,{data:i,hideHelp:!1})]})},schema:{integrationId:{type:"string",comment:"The integration or bot ID to retrieve details for",placeholder:a(591977).nZ}},isDestructive:!1},adminUpdateIntegrationData:{apiName:"adminUpdateIntegrationData",displayName:"Update integration",emoji:"🤖",description:"Update a public integration",schema:{integrationId:{type:"string",table:s().Lij,comment:"The ID of the integration update. Provide an Integration ID, not a Bot ID."},status:{type:"options",options:[...a(720871).Vf]},userEmail:{type:"string"},icon:{type:"image"},websiteUrl:{type:"string"},privacyPolicyUrl:{type:"string"},termsOfUseUrl:{type:"string"},twitterUrl:{type:"string"},linkedinUrl:{type:"string"},facebookUrl:{type:"string"},developerName:{type:"string"},developerIcon:{type:"string"},installationUrl:{type:"string",comment:"The URL a user would visit to install an integration directly via an 'Install Now' button."},installationInfoUrl:{type:"string",comment:"The URL a user would visit to learn more about installing an integration via a 'Learn More' button."},tagline:{type:"string"},tags:{type:"string",comment:"Tags are used in the Integration Gallery to allow for quick filtering."},collections:{type:"string",comment:"Collections are used in the Integration Gallery to allow for quick filtering."},description:{type:"string"},screenshots:{type:"images"},templatePageUrl:{type:"string",comment:"Public URL or ID of the Notion page that users can duplicate as a starter template. Accepts a notion.so/notion.site URL, a UUID with or without dashes, or any string containing the 32-char hex page ID. Pass an empty string to clear the existing template page.",placeholder:"https://workspace.notion.site/My-Template-341ecd5413dd8027b2f6f56c661a31bb"},originalUrlDomains:{type:"string",comment:"Comma-separated list of verified domains for this integration. These domains are used for link previews and URL matching."},originalUrlPatternsMode:{type:"options",options:[{displayName:"Do not change",value:"none"},{displayName:"Replace all patterns",value:"replace"},{displayName:"Append to existing patterns",value:"append"}],defaultValue:"none",comment:"'Do not change' skips pattern updates. 'Replace' overwrites all patterns. 'Append' adds the patterns below to the existing list."},originalUrlPatterns:{type:"json",defaultValue:JSON.stringify([{name:"my_pattern",regex:"https://example\\.com/items/(\\d+)",sample_urls:["https://example.com/items/123"],attributes:[{id:"item_id",type:"inline",values:[["$1"]]}]}],void 0,2),comment:'URL patterns for link previews. Use "Get integration" first to see current patterns, copy the originalUrlPatterns JSON, then paste here.',jsonSchema:rE},handledByIntegrationsServer:{type:"string",comment:"Integration server that handles this integration."},ignoreLinkPreviewBlockers:{type:"boolean",defaultValue:!1,comment:"Publishing a link preview integration is refused while its unfurl URL, URL patterns, or verified domains are missing or invalid. Check to publish anyway. Get integration lists the blockers under linkPreview.publishBlockers."}},isDestructive:!0},adminGetIntegrationRedirectUris:{apiName:"adminGetIntegrationRedirectUris",displayName:"Get integration redirect URIs",emoji:"🔀",description:"Retrieve OAuth redirect URIs for a public integration.",schema:{integrationId:{type:"string",table:s().Lij,comment:"The ID of the integration to inspect. Provide an Integration ID, not a Bot ID."}},isDestructive:!1},adminUpdateIntegrationRedirectUris:{apiName:"adminUpdateIntegrationRedirectUris",displayName:"Update integration redirect URIs",emoji:"🔀",description:"Add to or replace OAuth redirect URIs for a public integration. This tool shows a confirmation preview before saving.",schema:{integrationId:{type:"string",table:s().Lij,comment:"The ID of the integration to update. Provide an Integration ID, not a Bot ID."},mode:{type:"options",options:[{displayName:"Add missing URIs",value:"add"},{displayName:"Replace full list",value:"replace"}],defaultValue:"add",comment:"Add appends only URIs that are not already present. Replace overwrites the full redirect URI list."},redirectUris:{type:"stringArray",comment:"Redirect URIs to add or use as the full replacement list. At least one non-empty URI is required.",placeholder:"https://example.com/oauth/callback",maxItems:20}},isDestructive:!0},adminTransferIntegrationOwnership:{apiName:"adminTransferIntegrationOwnership",displayName:"Transfer integration ownership",emoji:"🔄",de
101scription:"Transfer ownership of a public integration to a new user",schema:{integrationId:{type:"string",table:s().Lij,comment:"The ID of the integration to transfer"},newOwnerEmail:{type:"string",comment:"Email of the new owner"},force:{type:"boolean",defaultValue:!1,comment:"Check to force the transfer even if the old and new owners do not share an email domain and are not both owners of a common workspace"}},isDestructive:!0},adminGetCapabilities:{apiName:"adminGetCapabilities",displayName:"Get capabilities for integration",description:'Retrieve the current list of enabled capabilities for a given integration. Do this before using the "Update capabilities" tool.',emoji:"🔍",schema:{integrationId:{type:"string",table:s().Lij,comment:"The ID of the integration to get capabilities for. Provide an Integration ID, not a Bot ID."}},isDestructive:!1},adminListIntegrationManagementPermissions:{apiName:"adminListIntegrationManagementPermissions",displayName:"List integration management permissions",description:"List integration_management_permissions rows for a workspace. Optionally filter to one integration. Includes integration metadata and MCP config summaries.",emoji:"🔍",schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to inspect. Accepts UUIDs with or without dashes.",isRequired:!0},integrationId:{type:"string",table:s().Lij,comment:"Optional integration ID filter. Leave empty to list every integration_management_permissions row for the workspace.",isRequired:!1}},isDestructive:!1},adminUpdateCapabilities:(i=(0,d.jsx)(a(428217).V,{color:"notion-link-blue",hoverColor:"blue",href:"https://dev.notion.so/notion/How-to-change-capabilities-for-a-public-integration-1b2b35e6e67f806ca634d77f90616b5c?pvs=4",children:"Click here to read the runbook first."}),{apiName:"adminUpdateCapabilities",notinoAction:{actionId:"admin.update_integration_capabilities"},displayName:"Update capabilities for integration",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"Update the list of enabled capabilities for a given integration."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"WARNING: Changing integration scopes has security implications, and should be done with caution to avoid unexpected effects."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}),(0,d.jsx)(a(324489).V,{children:i})]}),emoji:"✨",schema:{integrationId:{type:"string",table:s().Lij,comment:"The ID of the integration to update capabilities for. Provide an Integration ID, not a Bot ID."},capabilities:{type:"multiselect",comment:"The capabilities to enable for the integration.",options:(0,io().Ux)().map(e=>({displayName:(0,n().NZ)(e),value:e}))}},isDestructive:!1}),adminSearchBots:{apiName:"adminSearchBots",displayName:"Get bot",emoji:"🤖",description:"Look up a bot by ID. Returns detailed information about the bot including webhook health and token details.",isDestructive:!1,customResponseRenderer:function({data:e}){let{bot_token_details:t=[],...i}=e,n=[...t].sort((e,t)=>Number(e.created_at)-Number(t.created_at)),r=n.map(e=>{let t=(0,a(83388).Xw)(e.id),i=[`ID: ${t}`,`Secret: ${e.secret_preview}`,`Created at: ${rI(e.created_at,"Never")}`,`Revoked at: ${rI(e.revoked_at,"Never")}`,`Expires at: ${rI(e.expires_at,"-")}`];return{id:`botToken_${t}`,label:i.join("\n"),shapeTemplate:'["LABEL"]',color:e.revoked_at?"#ff7f50":"#00bfff"}}),s=il([{nodes:r,edges:n.flatMap(e=>e.parent_bot_token_id?[{fromId:`botToken_${(0,a(83388).Xw)(e.id)}`,toId:`botToken_${(0,a(83388).Xw)(e.parent_bot_token_id)}`}]:[])}]);return(0,d.jsxs)(a(4458).VP,{children:[(0,d.jsxs)(a(4458).VP,{style:rw.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleXlBold",colorVariant:"primary",children:"Bot Details"}),(0,d.jsx)(a(243119).A,{data:i,hideHelp:!0})]}),(0,d.jsxs)(a(4458).VP,{style:rw.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleXlBold",colorVariant:"primary",children:"Bot Tokens"}),(0,d.jsx)(rC,{botId:e.id,tokens:t})]}),(0,d.jsxs)(a(4458).VP,{style:rw.section,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleXlBold",colorVariant:"primary",children:"Bot Token Graph"}),r.length>0?(0,d.jsx)(a(205855).Z,{source:s}):(0,d.jsx)(a(553775).i$,{warnings:["No bot tokens found"]}
101)]})]})},schema:{botId:{type:"string",table:"bot"}}},adminRevokeBotToken:{apiName:"adminRevokeBotToken",displayName:"Revoke bot token",emoji:"🤖",description:"Revoke a bot's token. A new token will automatically be generated for the bot. Use the 'Get bot' tool to list tokens with redacted secret previews and grab a specific token ID to paste here.",schema:{botId:{type:"string",table:"bot"},tokenId:{type:"string",comment:"(optional) Specific bot_token ID to revoke. Leave empty to revoke all unrevoked tokens for this bot. The confirmation preview shows a redacted secret suffix so you can match a customer-reported key."}},isDestructive:!0},adminListBotsInOrganization:{apiName:"adminListBotsInOrganization",displayName:"List organization bots",emoji:"🤖",description:"Search for organization bots by organization ID. Returns up to 100 matching bots.",isDestructive:!1,schema:{organizationId:{type:"string",table:s().y75,comment:"The organization ID. Accepts UUIDs with or without dashes."}}},adminSearchOrganizationBots:{apiName:"adminSearchOrganizationBots",displayName:"Get organization bot",emoji:"🤖",description:"Look up an organization bot by ID. Returns detailed information about the organization bot including token details.",isDestructive:!1,schema:{organizationBotId:{type:"string",table:s().rfw}}},adminListBotsInSpace:{apiName:"adminListBotsInSpace",displayName:"List bots in space",emoji:"🤖",description:"Search for bots by space ID and/or name. Returns up to 100 matching bots ordered by newest first. Use 'Get bot' for full details on a specific bot.",isDestructive:!1,schema:{spaceId:{type:"string",table:"space",comment:"The space ID to search in. Accepts UUIDs with or without dashes."},name:{type:"string",comment:"Case-insensitive substring search on bot name. At least one of Space Id or Name is required."},botTypes:{type:"multiselect",comment:"Filter by bot type. Leave empty to show all types.",options:[{displayName:"Guest (user)",value:"guest (user)"},{displayName:"Guest (space)",value:"guest (space)"},{displayName:"External",value:"external"},{displayName:"Workflow (agent)",value:"workflow"},{displayName:"Automation",value:"automation"},{displayName:"Personal",value:"personal"},{displayName:"SCIM",value:"scim"}]},permissionModes:{type:"multiselect",comment:"Filter by permission mode (only applies to personal bots).",options:[{displayName:"User",value:"user"},{displayName:"Bot",value:"bot"}]}}},adminGetSlackIntegrationData:{apiName:"adminGetSlackIntegrationData",displayName:"Get Slack integration information for user",emoji:"🤖",description:"Get information about a user's Slack integration",schema:{userId:{type:"string",comment:"A user's Notion or Slack user id"}},isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e,{globalUserInformation:i}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("h3",{children:["Slack Global Users (",i.length,")"]}),i.map((e,t)=>(0,d.jsxs)(rV,{title:(0,d.jsx)("h4",{style:rM,children:e.slackGlobalUser.id}),children:[(0,d.jsx)(rT,{globalUser:e.slackGlobalUser}),(0,d.jsx)(rR,{slackLocalUsers:e.slackLocalUsers}),(0,d.jsx)(rN,{notionTokens:e.slackNotionTokens,spaces:e.spaces})]},t)),(0,d.jsx)("h3",{children:"Full Response"}),(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})}},adminGetMicrosoftTeamsConnections:{apiName:"adminGetMicrosoftTeamsConnections",displayName:"Get Microsoft Teams connections for user",emoji:"🤖",description:"List a user's Microsoft Teams bots and associated MicrosoftTeamsAccount records, including incomplete or disconnected connections.",schema:{userId:{type:"string",table:s().oo9,comment:"Notion user ID. Accepts UUIDs with or without dashes."}},isDestructive:!1},adminDeactivateSlackNotionToken:{apiName:"adminDeactivateSlackNotionToken",displayName:"Deactivate Slack notion token",emoji:"🪪",description:"Deactivate (alive = false) slack_notion_token rows via performSlackDisconnect. The repair step for a cross-identity Slack notification binding. Provide exactly one of: a specific token id, a notion bot id (deactivates all that bot's alive tokens), or a Slack global user id (deactivates all that user's alive tokens). Confirm the target first (e.g. with 'Get Slack integration information for user').",schema:{notionTokenId:{type:"string",comment:"A single slack_notion_token row id to deactivate",placeholder:a(591977).nZ},notionBotId:{type:"string",comment:"Deactivate every alive slack_notion_token row for this notion bot id",placeholder:a(591977).nZ},slackUniqueGlobalUserId:{type:"string",comment:"Deactivate every alive slack_notion_token row for this Slack global user id",placeholder:a(591977).nZ},allowExceedingMax:{type:"boolean",comment:"Allow a bot/global-user selector to deactivate more than 20 rows at once",defaultValue:!1}},isDestructive:!0},adminGetSyncedDatabaseData:{apiName:"adminGetSyncedDatabaseData",displayName:"Get synced database information",emoji:"🤖",description:"Get information about a synced database",schema:{ur
101i:{type:"string"},spaceId:{type:"string"}},isDestructive:!1},adminForceResyncExternalObjects:{apiName:"adminForceResyncExternalObjects",displayName:"Force sync on external object blocks",emoji:"🤖",description:"When manual re-syncing isn't restoring/updating blocks, use this tool to get them back in sync. You can provide a list of known problematic urls OR input a collectionId to update all problematic collection child pages.",schema:{urls:{type:"string",comment:"A list of urls separated by a comma (e.g. https://github.com/makenotion/notion-next/pull/28176) **Leave blank if using collectionId"},collectionId:{type:"string",comment:"Id of collection. **Leave blank if using uris"},botId:{type:"string",comment:"Bot id that is associated with collection. **Required"},spaceId:{type:"string",comment:"Space id of the user. **Required"}},isDestructive:!1},adminRemoveChildFromExternalCollection:{apiName:"adminRemoveChildFromExternalCollection",displayName:"Remove a child from a externally synced database",emoji:"⛑",description:"For various reasons synced databases may end up with false duplicates. This tools will remove a child from a synced database. Be careful because this will remove the child in ALL instances of this synced collection. For synced databases, the URI should be the original link of the child page. It matters which of the duplicates you delete, if you are unsure which page is the false duplicate please consult the oncall engineer.",schema:{uris:{type:"string",comment:"A list of urls separated by a comma (e.g. https://github.com/makenotion/notion-next/pull/28176)"},botId:{type:"string"},parent_collection_uri:{type:"string"},spaceId:{type:"string"}},isDestructive:!0},adminJoinSpacesForOauthRedirect:{apiName:"adminJoinSpacesForOauthRedirect",displayName:"Add a makenotion.com user to workspaces for OAuth redirect",productionOnly:!0,emoji:"🔀",description:"Adds email as a member to 2 specific workspaces in prod that lets Notinos use certain integrations like Typeform in dev or staging. See guide: https://dev.notion.so/notion/Installing-Integrations-on-Dev-how-to-demo-faa4055c377c47a99a7ba6b2a7cc8c6b",schema:{userEmail:{type:"string"}},isDestructive:!1},adminGetWorkspaceWebhookSubscriptions:{apiName:"adminGetWorkspaceWebhookSubscriptions",displayName:"Get bots for DLP & SIEM integrations",emoji:"🤔",description:'Returns information about all bots related to DLP & SIEM integrations for a workspace, including inactive ones. The underlying implementation returns all "webhook subscriptions", which powers DLP & SIEM integrations.',schema:{spaceId:{type:"string",table:"space"}}},adminGetPublicApiRateLimit:{apiName:"adminGetPublicApiRateLimit",displayName:"Get Public API rate limit",description:"Show the Public API per-bot rate limit. Enter a bot ID to see the bot's plan, base limit and where it comes from, whether it's blocked, its integration override, and the limit its requests are enforced against. Enter an integration ID to see its override and the limit on each plan (for an internal integration, its bot's exact limit). Leave both empty to list every active integration override. Agent computer ntn and external agent workflow requests can use a higher limit that depends on the request, so a lookup by bot can't show it.",emoji:"⌚",schema:{botId:{name:"Bot ID",type:"string",table:"bot",comment:"The bot whose limit you want to see. Enter a bot ID or an integration ID, not both."},integrationId:{name:"Integration ID",type:"string",table:s().Lij,comment:"The integration whose override and limits you want to see."}},isDestructive:!1},adminSetIntegrationRateLimit:{apiName:"adminSetIntegrationRateLimit",displayName:"Set Public API rate limit",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"Raise, throttle or block the Public API rate limit of every bot of an integration, by multiplying their per-minute limit. Enter a bot ID to change its integration. An internal integration has one bot, so this sets that bot's limit."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"Check with the Public API team in #eng-team-public-api before you change a limit, and link their approval in the reason. Every change posts to #eng-dev-interfaces-alerts."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}),(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"Anyone with this tool can raise an internal integration, up to 10×, or reset it. Throttles, blocks, changes to an integration that is throttled or blocked now, and any change to a public integration need the adminSetIntegrationRateLimitUnrestricted permission (Engineering, Engineering - Public API and Super Admin)."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}),(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"This doesn't change data source query limits. A data source 429 with reason collection_router_too_many_requests goes to Collections Foundations for a workspace rule."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}
101),(0,d.jsx)(a(324489).V,{children:(0,d.jsx)(a(428217).V,{color:"notion-link-blue",hoverColor:"blue",href:"https://dev.notion.so/notion/Runbook-Set-Bot-Rate-Limit-Admin-tool-1fab35e6e67f80d4a4cdcbbab312b4f1",children:"Click here to read the runbook first."})})]}),emoji:"🚦",schema:{botId:{name:"Bot ID",type:"string",table:"bot",comment:"A bot of the integration to change. Enter a bot ID or an integration ID, not both."},integrationId:{name:"Integration ID",type:"string",table:s().Lij,comment:"The integration to change."},multiplier:{type:"options",comment:"Multiplies the per-minute limit of every bot of the integration: 180 per minute, or 600 on Business and Enterprise. Rounded down.",options:[{displayName:"Reset (1×: 180 per minute, 600 on Business and Enterprise)",value:1},{displayName:"1.2× (216 per minute, 720 on Business and Enterprise)",value:1.2},{displayName:"2× (360 per minute, 1,200 on Business and Enterprise)",value:2},{displayName:"3× (540 per minute, 1,800 on Business and Enterprise)",value:3},{displayName:"5× (900 per minute, 3,000 on Business and Enterprise)",value:5},{displayName:"10× (1,800 per minute, 6,000 on Business and Enterprise)",value:10},{displayName:"Throttle to 50% (90 per minute, 300 on Business and Enterprise)",value:.5},{displayName:"Throttle to 10% (18 per minute, 60 on Business and Enterprise)",value:.1},{displayName:"Throttle to 1% (1 per minute, 6 on Business and Enterprise)",value:.01},{displayName:"Block every request (0×)",value:0}],defaultValue:1},reason:{type:"string",isRequired:!0,comment:"Why you're changing the limit, with a link to the Public API team's approval. Posted to #eng-dev-interfaces-alerts.",placeholder:"For example: Data migration, approved in <Slack link>"},duration:{type:"options",comment:"How long the override applies before it expires on its own.",options:[{displayName:"1 day",value:"1_day"},{displayName:"3 days",value:"3_days"},{displayName:"1 week",value:"1_week"},{displayName:"1 month",value:"1_month"},{displayName:"3 months",value:"3_months"},{displayName:"Permanent",value:"permanent"}],defaultValue:"1_month"}},isDestructive:!0,notinoAction:{actionId:"admin.set_integration_rate_limit"}}
101,adminListIntegrationWebhookSubscriptions:{apiName:"adminListIntegrationWebhookSubscriptions",displayName:"List integration webhook subscriptions",emoji:"👂",description:"List all (non-archived) integration webhook subscriptions for a bot, integration, or workspace ID. Provide only one of the IDs.",schema:{botOrIntegrationId:{type:"string",comment:"The ID of the bot or integration for which to show webhooks. Get this from the URL of the manage page, e.g. https://notion.so/profile/integrations/internal/b00066c9-849a-471d-af76-52336733360f"},spaceId:{type:"string",comment:"The ID of the workspace whose bots' webhooks we want to show.",table:"space"}},isDestructive:!1},adminUpdateIntegrationWebhookSubscription:{apiName:"adminUpdateIntegrationWebhookSubscription",displayName:"Update integration webhook subscription",description:"Update the status or other attributes of an existing integration webhook subscription. Do not specify any properties you don't want to change. Use the 'List Webhook Subscriptions' tool first to find the existing subscription's ID and attributes.",emoji:"🔀",schema:{subscriptionId:{type:"string",table:s().bnG,comment:"The ID of the subscription to update. Get this from the 'List Webhook Subscriptions' tool."},status:{type:"options",options:(0,n().FF)(a(40819).Of,"pending"),comment:"The new status of the subscription."},eventTypes:{type:"multiselect",comment:"Event types to subscribe to.",options:a(453932).nK.map(e=>({displayName:(0,n().NZ)(e),value:e}))},url:{type:"string",comment:"The new webhook endpoint URL. Can only be changed for pending subscriptions.",placeholder:"https://webhook.site/e9224198-a5b9-4987-a9f8-ec2aef2bc093"}},isDestructive:!1},adminUpdateBotCapabilities:{apiName:"adminUpdateBotCapabilities",displayName:"Update capabilities for bot",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"Add bot capabilities. We do not currently support removing capabilities."}),(0,d.jsx)(a(884877).A,{size:1,axis:"y"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"WARNING: Changing integration scopes has security implications, and should be done with caution to avoid unexpected effects."})]}),emoji:"🤖",schema:{botId:{type:"string",table:"bot",comment:"The ID of the bot to update capabilities for."},capabilities:{type:"multiselect",comment:"The capabilities to enable for the bot.",options:(0,io().Ux)().map(e=>({displayName:e,value:e}))},dryRun:{type:"boolean",comment:"Preview changes without saving. Set to false to apply.",defaultValue:!0}},isDestructive:!1},adminResyncBotBlockPermissions:{apiName:"adminResyncBotBlockPermissions",displayName:"Resync bot block permissions",description:"Rewrites block permissions to match current capabilities. Provide either a single botId OR an integrationId to resync all bots under a public integration. Start with dry run to preview.",emoji:"🤖",schema:{botId:{type:"string",table:"bot",comment:"The ID of a single bot to resync. Leave empty if using integrationId."},integrationId:{type:"string",table:s().Lij,comment:"The ID of an integration to resync all bots for. Useful for public integrations with many bots. Leave empty if using botId."},dryRun:{type:"boolean",comment:"Preview the affected shared blocks without enqueuing writes. Set to false to enqueue the repair task.",defaultValue:!0}},isDestructive:!1},adminGetPersonalAccessTokenCreationPolicy:{apiName:"adminGetPersonalAccessTokenCreationPolicy",displayName:"Get PAT creation policy",emoji:"🔐",description:"Retrieve the workspace's stored and effective personal access token creation policy. Also returns PAT-enabled permission groups by default.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to inspect."},includeAllGroups:{type:"boolean",defaultValue:!1,comment:"Include every permission group in the response. Leave off to show only groups currently allowed to create PATs."},groupNameQuery:{type:"string",comment:"Optional case-insensitive substring filter for permission group names."}},isDestructive:!1},adminUpdatePersonalAccessTokenCreationPolicy:{apiName:"adminUpdatePersonalAccessTokenCreationPolicy",displayName:"Update PAT creation policy",emoji:"🔐",description:"Update who can create personal access tokens in a workspace. For selected permission groups, use the group list and toggle tools to find and enable groups.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to update."},policy:{type:"options",options:[{displayName:"All workspace members",value:"all_workspace_members"},{displayName:"Selected permission groups",value:"custom"},{displayName:"Workspace owners only",value:"workspace_owners_only"}],comment:"All members and owners-only are available based on plan. Selected permission groups requires Enterprise."}},isDestructive:!0},adminListPersonalAccessTokenCreationGroups:{apiName:"adminListPersonalAccessTokenCreationGroups",displayName:"List PAT creation groups",emoji:"👥",description:"Find workspace permission groups and see which ones can create personal access tokens when the policy is set to selected groups.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID whose permission groups should be listed."},groupNameQuery:{type:"string",comment:"Optional case-insensitive substring filter for permission group names."},onlyGroupsWithPermission:{type:"boolean",defaultValue:!1,comment:"Show only groups currently allowed to create PATs."}},isDestructive:!1},adminUpdatePersonalAccessTokenCreationGroupPermission:{apiName:"adminUpdatePersonalAccessTokenCreationGroupPermission",displayName:"Toggle PAT group permission",emoji:"👥",description:"Allow or disallow a single permission group to create personal access tokens when the workspace policy is selected permission groups.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID containing the permission group."},groupId:{type:"string",table:s().naB,comment:"Plain permission group ID from the list PAT creation groups tool."},enabled:{type:"boolean",defaultValue:!0,comment:"Checked allows the group to create PATs. Unchecked removes the group-specific PAT creation permission."}},isDestructive:!0},adminGetSpaceConnectionsAllowlist:{apiName:"adminGetSpaceConnectionsAllowlist",displayName:"Get workspace connections allowlist",emoji:"🔍",description:"Inspect a 
101workspace's connections allowlist: the stored and effective (org overrides + legacy fallbacks) restriction mode, the approved integrations list with names, with legacy entries surfaced separately, and whether the workspace can self-serve manage the list in-product. Use this before the update/set-mode tools below.",schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to inspect. Accepts UUIDs with or without dashes."}},isDestructive:!1},adminUpdateSpaceApprovedIntegrations:{apiName:"adminUpdateSpaceApprovedIntegrations",displayName:"Update workspace approved integrations",emoji:"✅",description:"Add integrations to (or remove them from) a workspace's approved integrations list. Use for workspaces that enforce an approved-only policy but cannot self-serve manage the list (e.g. grandfathered non-Enterprise workspaces after a downgrade). Fails when the list is centrally managed by an organization. Returns the updated allowlist summary.",schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID whose approved list should be updated. Accepts UUIDs with or without dashes."},action:{type:"options",required:!0,options:[{displayName:"Approve (add to approved list)",value:"approve"},{displayName:"Remove (take off approved list)",value:"remove"}],defaultValue:"approve",comment:"Approve upserts approval entries for the given integrations. Remove deletes their entries (including stale entries for deleted integrations)."},integrationIds:{type:"stringArray",table:s().Lij,comment:"Integration IDs (not bot IDs) to approve or remove. For a public OAuth integration this is the integration/client ID from 'Get integration'. Remove also accepts 'legacy-slack-integration' and 'legacy-google-integration' to clean up stale legacy entries.",placeholder:a(591977).nZ,maxItems:100}},isDestructive:!0},adminSetSpaceConnectionAllowlistMode:{apiName:"adminSetSpaceConnectionAllowlistMode",displayName:"Set workspace connection allowlist mode",emoji:"🚧",description:"Change a workspace's connection allowlist restriction mode (the same dropdown workspace admins see in Settings → Connections). Writes the unified allowlist fields and the derived legacy integration_restrictions together, and preserves the approved integrations list so re-enabling restrictions later restores it. Fails when the mode is enforced by the workspace's organization. Returns the updated allowlist summary.",schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to update. Accepts UUIDs with or without dashes."},mode:{type:"options",required:!0,options:[{displayName:"No restrictions (members can add any connection)",value:"no_restrictions"},{displayName:"Approved & recommended (approved list + Notion-recommended connections)",value:"approved_and_recommended"},{displayName:"Approved only (only the approved list)",value:"approved_only"}],comment:"Use 'Get workspace connections allowlist' first to see the current effective mode."}},isDestructive:!0},adminCreateGlobalOauthClient:{apiName:"adminCreateGlobalOauthClient",ignoreUuidPreference:!0,displayName:"Create Global OAuth Client",emoji:"🔐",description:"Create a new Global OAuth Client for external applications to authenticate with Notion. The client secret is never exposed after creation.",schema:{clientName:{type:"string",comment:"Human readable name of the OAuth client"},redirectUris:{type:"stringArray",comment:"Redirect URIs for the OAuth callback",placeholder:"https://example.com/callback",maxItems:10},websiteUrl:{type:"string",comment:"Website URL for the OAuth client"},logoUrl:{type:"string",comment:"Logo URL for the OAuth client (optional)"},privacyPolicyUrl:{type:"string",comment:"Privacy policy URL (optional)"},termsOfUseUrl:{type:"string",comment:"Terms of use URL (optional)"},clientId:{type:"string",comment:"Custom client ID (optional, will be auto-generated if not provided)",skipUUIDNormalization:!0},clientSecret:{type:"string",comment:"Custom client secret (optional, will be auto-generated if not provided)",skipUUIDNormalization:!0},defaultScopes:{type:"string",comment:"Comma-separated scope names (optional, defaults to read_user_without_email,read_user_with_email,read_user_email_name_photo)",placeholder:"read_user_without_email,read_user_with_email"}},isDestructive:!1},adminUpdateGlobalOauthClient:{apiName:"adminUpdateGlobalOauthClient",ignoreUuidPreference:!0,displayName:"Update Global OAuth Client",emoji:"🔐",description:"Update an existing Global OAuth Client. Supports updating any field including secret rotation.",schema:{clientId:{type:"string",comment:"The ID of the Global OAuth Client to update",skipUUIDNormalization:!0},clientName:{type:"string",comment:"Human readable name of the OAuth client (optional)"},redirectUris:{type:"stringArray",comment:"Redirect URIs for the OAuth callback (optional)",placeholder:"https://example.com/callback",maxItems:10},websiteUrl:{type:"string",comment:"Website URL for the OAuth client (optional)"},logoUrl:{type:"string",comment:"Logo URL for the OAuth client (optional)"},privacyPolicyUrl:{type:"string",comment:"Privacy policy URL (optional)"},termsOfUseUrl:{type:"string",comment:"Terms of use URL (optional)"},clientSecret:{type:"string",comment:"New client secret for rotation (optional)",skipUUIDNormalization:!0}},isDestructive:!0},adminGetGlobalOauthClient:{apiName:"adminGetGlobalOauthClient",ignoreUuidPreference:!0,displayName:"Get Global OAuth Client",emoji:"🔍",description:"Retrieve information about a Global OAuth Client. The client secret is never exposed.",schema:{clientId:{type:"string",comment:"The ID of the Global OAuth Client to retrieve",skipUUIDNormalization:!0}},isDestructive:!1},adminDeleteGlobalOauthClient:{apiName:"adminDeleteGlobalOauthClient",ignoreUuidPreference:!0,displayName:"Delete Global OAuth Client (USE WITH CARE)",emoji:"🗑",description:"Permanently delete a Global OAuth Client. OAuth flows using this client ID stop w
101orking immediately, and it cannot be undone. Use Get Global OAuth Client first to confirm you have the right client.",schema:{clientId:{type:"string",comment:"The client ID of the Global OAuth Client to delete",skipUUIDNormalization:!0}},isDestructive:!0,typedConfirmation:{expectedValueResponseKey:"clientId",description:"You are about to permanently delete this Global OAuth Client. This is irreversible — verify the client below and type its client ID to confirm.",inputLabel:"Client ID",confirmButtonLabel:"Delete OAuth client"}},adminListGlobalOauthClients:{apiName:"adminListGlobalOauthClients",ignoreUuidPreference:!0,displayName:"List Global OAuth Clients",emoji:"📋",description:"List all Global OAuth Clients. Client secrets are never exposed.",schema:{limit:{type:"number",comment:"Maximum number of clients to return (default: 100)",defaultValue:100}},isDestructive:!1},adminGetMcpClient:{apiName:"adminGetMcpClient",displayName:"Get Notion MCP Client",emoji:"🔍",description:"Fetch a registered Notion MCP OAuth client (DCR record) by client_id. The client secret is never exposed.",schema:{clientId:{type:"string",comment:"The OAuth client_id of the registered Notion MCP client",skipUUIDNormalization:!0}},isDestructive:!1},adminUpdateMcpClient:{apiName:"adminUpdateMcpClient",displayName:"Update Notion MCP Client",emoji:"🔧",description:"Update a registered Notion MCP OAuth client (DCR record): the stored client name and/or redirect URIs. Note: for trusted partners the OAuth consent-screen label comes from the static partner registry in code, not this record — editing here does not change a trusted partner's consent label.",schema:{clientId:{type:"string",comment:"The OAuth client_id of the registered Notion MCP client",skipUUIDNormalization:!0},clientName:{type:"string",comment:"New client name to store on the DCR record (optional)"},redirectUris:{type:"stringArray",comment:"Replacement redirect URIs; replaces the full list (optional)",placeholder:"https://example.com/callback",maxItems:10}},isDestructive:!0}},rL={adminPreviewGtmDecisionDebug:{apiName:"adminPreviewGtmDecisionDebug",displayName:"Preview GTM decision",emoji:"🔎",description:"Preview the current GTM decision for a user in a customer workspace. No decision is saved and no action is triggered.",schema:{userIdentifier:{type:"string",comment:"User ID or email address."},targetSpaceId:{type:"string",table:"space",comment:"Customer workspace ID where the user is a member."}}},adminDryRunGtmNextBestAction:{apiName:"adminDryRunGtmNextBestAction",displayName:"Run GTM strategy",emoji:"🧪",description:"Run a GTM strategy for a user in a customer workspace without saving a decision, sending an action, or logging an experiment exposure.",schema:{userIdentifier:{type:"string",comment:"User ID or email address."},targetSpaceId:{type:"string",table:"space",comment:"Customer workspace ID where the user is a member."},strategyId:{type:"string",comment:"GTM strategy ID to evaluate."},requestSource:{type:"options",options:[...a(475027).Aw],defaultValue:"scheduled_run",comment:"Production request source to simulate."}}}},r_={disabled:{fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.red.text.accentPrimary},enabled:{fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.green.text.accentPrimary}},rU={adminGetNotionMailStatus:{apiName:"adminGetNotionMailStatus",displayName:"Check Notion Mail status",emoji:"📧",description:"Fill out just one of the fields below. Reports whether Notion Mail is disabled for the governing organization of a space, organization, or user email. Mail is disabled via the org-level `disable_notion_mail` setting; a space is resolved to its managing organization, and an email is resolved to its verifying organization exactly as the Mail service does at runtime.",isDestructive:!1,schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Space ID — resolved to its managing organization."},organizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ,comment:"Organization ID — checked directly."},email:{type:"string",placeholder:"[email protected]",comment:"User email (or a bare email domain) — resolved to the verifying organization, exactly as the Mail gate does."}},customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:"Notion Mail Status"}),(0,d.jsxs)("div",{children:["Notion Mail:"," ",t.mailDisabled?(0,d.jsx)("span",{style:r_.disabled,children:"Disabled"}):(0,d.jsx)("span",{style:r_.enabled,children:"Enabled"})]}),t.organizationId?(0,d.jsxs)("div",{children:["Organization: ",t.organizationName??"(unnamed)"," ",(0,d.jsx)(a(137691).x5,{value:t.organizationId})]}):(0,d.jsx)("div",{children:"Organization: None (no managing organization)"}),"space"===t.resolvedFrom&&t.spaceId?(0,d.jsxs)("div",{children:["Space
101: ",t.spaceName??"(unnamed)"," ",(0,d.jsx)(a(137691).x5,{value:t.spaceId})]}):void 0,"email"===t.resolvedFrom&&t.emailDomain?(0,d.jsxs)("div",{children:["Email domain: ",t.emailDomain,t.email&&t.email!==t.emailDomain?` (from ${t.email})`:""]}):void 0,t.note?(0,d.jsx)(a(553775).i$,{warnings:[t.note]}):void 0,(0,d.jsxs)("div",{children:["Full Response",(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})]})}}},rW=[s().bhs,s().HtE,s().jvE,s().uLb,s().QOF,s().KcW,s().pEW,s().yAZ,s().a8w,s().KqJ,s()._ig,s().ULG,s().UNl,s().EgT,s().ziV,s().V1v,s().qtq,s().qrH,s().lMK,s().enP,s().XXy,s().J6M,s().OCn,s().XXO,s().bf7,s().vnT,s().Hik,s()._FR,s().hRD];function rF(e){let{year:t,month:a,day:i}=e,n=new Date(Date.UTC(t,a,i)),r=String(n.getUTCFullYear()),s=String(n.getUTCMonth()+1).padStart(2,"0"),o=String(n.getUTCDate()).padStart(2,"0");return`${r}-${s}-${o}`}let rK=(0,a(327219).YK)({noRequest:{id:"adminMarketplaceServiceRequestDetails.noRequest",defaultMessage:"No Marketplace service request was found."},factsHeading:{id:"adminMarketplaceServiceRequestDetails.factsHeading",defaultMessage:"Facts"},unnamedRequest:{id:"adminMarketplaceServiceRequestDetails.unnamedRequest",defaultMessage:"Unnamed request"},createdAt:{id:"adminMarketplaceServiceRequestDetails.createdAt",defaultMessage:"Created {date}"},diagnosisHeading:{id:"adminMarketplaceServiceRequestDetails.diagnosisHeading",defaultMessage:"Diagnosis"},explainDiagnosis:{id:"adminMarketplaceServiceRequestDetails.explainDiagnosis",defaultMessage:"Explain this diagnosis"},diagnosisTooltip:{id:"adminMarketplaceServiceRequestDetails.diagnosisTooltip",defaultMessage:"This is a best-effort Workspace Access check. It compares the request status with pending access requests and current membership. Insufficient evidence means no supported issue matched. It does not mean access is healthy."},deliveryWithPendingWorkspaceAccess:{id:"adminMarketplaceServiceRequestDetails.deliveryWithPendingWorkspaceAccess",defaultMessage:"Pending workspace access"},deliveryWithPendingWorkspaceAccessExtension:{id:"adminMarketplaceServiceRequestDetails.deliveryWithPendingWorkspaceAccessExtension",defaultMessage:"Pending workspace access extension"},insufficientEvidence:{id:"adminMarketplaceServiceRequestDetails.insufficientEvidence",defaultMessage:"Insufficient evidence"},missingRelatedWorkspaceAccessIdentity:{id:"adminMarketplaceServiceRequestDetails.missingRelatedWorkspaceAccessIdentity",defaultMessage:"Missing Marketplace profile or workspace"},fullDetailsHeading:{id:"adminMarketplaceServiceRequestDetails.fullDetailsHeading",defaultMessage:"Full request and Workspace Access evidence"},unknownStatus:{id:"adminMarketplaceServiceRequestDetails.unknownStatus",defaultMessage:"unknown status"},pendingWorkspaceAccessRequests:{id:"adminMarketplaceServiceRequestDetails.pendingWorkspaceAccessRequests",defaultMessage:"{count, plural, one {# pending workspace access request} other {# pending workspace access requests}}"},completeRequest:{id:"adminMarketplaceServiceRequestDetails.completeRequest",defaultMessage:"Complete request"},cancelOrReject:{id:"adminMarketplaceServiceRequestDetails.endWithoutCompletion",defaultMessage:"Cancel or reject"}}),r$=(0,a(327219).YK)({truncatedResults:{id:"adminMarketplaceServiceRequestLookup.truncatedResults",defaultMessage:"Showing the first 250 matching requests. Refine the selectors to narrow this list."},results:{id:"adminMarketplaceServiceRequestLookup.results",defaultMessage:"Matching Marketplace service requests."},unknownStatus:{id:"adminMarketplaceServiceRequestLookup.unknownStatus",defaultMessage:"unknown status"},unnamedRequest:{id:"adminMarketplaceServiceRequestLookup.unnamedRequest",defaultMessage:"Unnamed request"},emptyResults:{id:"adminMarketplaceServiceRequestLookup.emptyResults",defaultMessage:"No requests match these selectors."},inspectRequest:{id:"adminMarketplaceServiceRequestLookup.inspectRequest",defaultMessage:"Inspect"}}),rO={adminBackfillMarketplaceProfileSalesforceId:{apiName:"adminBackfillMarketplaceProfileSalesforceId",displayName:"Backfill Marketplace Profile Salesforce ID",description:"Link an existing Salesforce partner profile to a Marketplace profile whose salesforce_id is missing. This tool will not overwrite a different Salesforce ID or reuse an ID linked to another Marketplace profile.",emoji:"🔗",isDestructive:!0,requiresHourlyReauth:!0,schema:{marketplaceProfileId:{type:"string",table:s().V1v,isRequired:!0,comment:"Exact Marketplace profile UUID."},salesforceProfileId:{type:"string",isRequired:!0,comment:"Exact 15- or 18-character Salesforce partner profile record ID."}}},adminBackfillTemplatesFromCategory:{apiName:"adminBackfillTemplatesFromCategory",displayName:"Backfill Templates From Category",description:"Push a category tag onto every template in the category via Flowdash. Re-approves drafts already in 'published' status (resyncs Contentful) and directly patches tags on drafts with pending edits that were previously published. Runs in the background — you'll get an email when it finishes.",emoji:"🏷️",isDestructive:!0,schema:{templateCategoryId:{type:"string",comment:"Contentful ID of the template category (same value the CLI takes as --category_contentful_id)."}}},adminGetMarketplaceProfile:{apiName:"adminGetMarketplaceProfile",displayName:"Get Marketplace Profile",description:"Get a marketplace profile. Provide any one of the fields below.",emoji:"🌭",schema:{profileEmail:{type:"string"},profileUsername:{type:"string"},contentfulId:{type:"string"}}},adminGetMarketplaceRecord:{apiName:"adminGetMarketplaceRecord",displayName:"Get Marketplace Record",description:"Load and return the raw JSON for a marketplace or template table record by table name and record ID.",emoji:"🧾",schema:{table:{type:"options",options:[...rW],comment:"Only tables in the marketplace admin surface are supported in this tool."},recordId:{type:"string",comment:"UUID of the record to load."}}},adminLookupMarketplaceServiceRequests:{apiName:"adminLookupMarketplaceServiceRequests",displayName:"Find Marketplace Service Requests",description:"Find up to 250 recent Marketplace service requests by workspace or Marketplace profile ID. Use Inspect Marketplace Service Request when you already know the request ID.",emoji:"🔎",schema:{spaceId:{type:"string",comment:"Optional workspace UUID."},marketplaceProfileId:{type:"string",comment:"Optional Marketplace profile UUID."}},customResponseRenderer:function(e){let{data:t}=e,i=(0,a(327219).tz)(),{canOpenAdminToolTab:n,openAdminToolTab:s}=(0,a(612002).S)(),o=n("adminGetMarketplaceServiceRequestDetails"),l=r.useCallback(e=>{s({toolName:"adminGetMarketplaceServiceRequestDetails",title:e,args:{serviceRequestId:e}})},[s]);return(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:t.hasMore?i.formatMessage(r$.truncatedResults):i.formatMessage(r$.results)}),t.candidates.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsxs)(a(4458).VP,{gap:2,flex:"1 1 300px",minWidth:0,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:e.projectName??i.formatMessage(r$.unnamedRequest)}),(0,d.jsxs)(a(4458).fI,{gap:8,flexWrap:"wrap",children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:e.serviceRequestId}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,a(344184).vO)(e.createdTime)}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:e.projectStatusV2??e.projectStatus??i.formatMessage(r$.unknownStatus)})]})]}),(0,d.jsx)(a(988022).p,{size:"sm",disabled:!0!==o,onClick:()=>l(e.serviceRequestId),children:i.formatMessage(r$.inspectRequest)})]},e.serviceRequestId)),0===t.candidates.length?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(r$.emptyResults)}):void 0]})}},adminGetMarketplaceServiceRequestDetails:{apiName:"adminGetMarketplaceServiceRequestDetails",displayName:"Inspect Marketplace Service Request",description:"Inspect one Marketplace service request, including its project details, dates, status history, and scoped Workspace Access evidence. Use the exact request ID returned by Find Marketplace Service Requests.",emoji:"🔍",schema:{serviceRequestId:{type:"string",isRequired:!0,comment:"Exact Marketplace service-request UUID."}},customResponseRenderer:function(e){let{data:t}=e,i=(0,a(327219).tz)(),{details:n}=t;if(void 0===n)return(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(rK.noRequest)});let r={delivery_with_pending_workspace_access:rK.deliveryWithPendingWorksp
101aceAccess,delivery_with_pending_workspace_access_extension:rK.deliveryWithPendingWorkspaceAccessExtension,insufficient_evidence:rK.insufficientEvidence,missing_related_workspace_access_identity:rK.missingRelatedWorkspaceAccessIdentity},s=n.request.attributes.project_name,o=n.request.attributes.project_description,l=i.formatMessage(rK.diagnosisTooltip),c=i.formatMessage(rK.explainDiagnosis);return(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:i.formatMessage(rK.factsHeading)}),(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:s??i.formatMessage(rK.unnamedRequest)}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:n.facts.serviceRequestId}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n.facts.projectStatusV2??n.facts.projectStatus??i.formatMessage(rK.unknownStatus)}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(rK.createdAt,{date:(0,a(344184).vO)(n.request.created_time)})}),void 0===o?void 0:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:o})]}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:i.formatMessage(rK.diagnosisHeading)}),(0,d.jsx)(a(51831).m_,{content:()=>l,children:e=>(0,d.jsx)(a(374533).K,{...e,ariaLabel:c,icon:a(372181).infoCircleSmallIcon,size:"sm",colorVariant:"secondary"})})]}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(r[n.diagnosis.kind])}),(0,d.jsx)(a(553775).i$,{warnings:n.warnings.map(e=>i.formatMessage(rK.pendingWorkspaceAccessRequests,{count:e.count}))})]}),(function(e){let{facts:t,completeRequestLabel:a,cancelOrRejectLabel:i}=e;switch(t.projectStatusV2){case"delivery":return[{apiName:"adminCompleteMarketplaceServiceRequest",label:a},{apiName:"adminEndMarketplaceServiceRequest",label:i}];case"pending":case"discovery":case"pending_project_confirmation":return[{apiName:"adminEndMarketplaceServiceRequest",label:i}];default:return[]}})({facts:n.facts,completeRequestLabel:i.formatMessage(rK.completeRequest),cancelOrRejectLabel:i.formatMessage(rK.cancelOrReject)}).map(e=>(0,d.jsx)(a(428217).V,{color:"notion-link-blue",hoverColor:"blue",href:function(e){let{facts:t,apiName:i}=e;if(void 0===t.projectStatusV2)throw Error("Marketplace service request resolution needs a V2 status.");let n=new URLSearchParams({serviceRequestId:t.serviceRequestId,...void 0===t.spaceId?{}:{spaceId:t.spaceId},...void 0===t.marketplaceProfileId?{}:{marketplaceProfileId:t.marketplaceProfileId}});return`${a(168962).JZ.admin}/marketplace?${n.toString()}#${i}`}({facts:n.facts,apiName:e.apiName}),external:!0,children:e.label},e.apiName)),(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:i.formatMessage(rK.fullDetailsHeading)}),(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})}},adminCompleteMarketplaceServiceRequest:{apiName:"adminCompleteMarketplaceServiceRequest",displayName:"Complete Marketplace Service Request",description:"Complete one Delivery Marketplace service request after reviewing the scoped recovery evidence. This cannot be undone.",emoji:"✅",isDestructive:!0,requiresHourlyReauth:!0,schema:{serviceRequestId:{type:"string",comment:"Exact Marketplace service-request UUID."},reason:{type:"string",isRequired:!0,multiline:!0,comment:"Required operational reason (maximum 500 characters)."},spaceId:{type:"string",comment:"Optional workspace UUID guard."},marketplaceProfileId:{type:"string",comment:"Optional Marketplace profile UUID guard."}},typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"Review the Delivery request and enter the exact completion text before writing the status.",inputLabel:"Confirm Marketplace request completion",confirmButtonLabel:"Complete service request"}},adminEndMarketplaceServiceRequest:{apiName:"adminEndMarketplaceServiceRequest",displayName:"Cancel or reject",description:"Cancel or reject one pending, discovery, confirmation, or Delivery Marketplace service request. This cannot be undone.",emoji:"⛔",isDestructive:!0,requiresHourlyReauth:!0,schema:{serviceRequestId:{type:"string",comment:"Exact Marketplace service-request UUID."},reason:{type:"string",isRequired:!0,multiline:!0,comment:"Required operational reason (maximum 500 characters)."},spaceId:{type:"string",comment:"Optional workspace UUID guard."},marketplaceProfileId:{type:"string",comment:"Optional Marketplace profile UUID guard."}},typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"Review the request and enter the exact confirmation text before changing its status.",inputLabel:"Confirm Marketplace request cancellation or rejection",confirmButtonLabel:"Cancel or reject request"}},adminUpdateTemplateCreatorEmail:{apiName:"adminUpdateTemplateCreatorEmail",displayName:"Update Template Creator Email",description:"Update the user associated with a template creator profile. This transfers ownership of the creator profile from one user to another. ⚠️ WARNING: Templates associated with the original user's workspace will likely be difficult to edit after the migration unless the new user is also an admin of those workspaces.",emoji:"📧",schema:{profileUsername:{type:"string",comment:"The marketplace profile username of the template creator (e.g., 'notion-team'). You can find this in the profile URL."},newEmail:{type:"string",comment:"The email address of the Notion user to associate with this creator profile"}}},adminSetCreatorStripeOnboardingStatus:{apiName:"adminSetCreatorStripeOnboardingStatus",displayName:"Set Creator Stripe Onboarding Status",description:"This tool enables stripe onboarding for a creator. If a creator has already onboarded and is currently disabled, this tool will re-enable selling with Notion",emoji:"💳",schema:{creatorEmail:{type:"string",comment:"Email associated with Notion user of creator"},newStatus:{type:"options",comment:"New status for creator",options:["enabled","disabled"],defaultValue:"enabled"}}},adminReviewMarketplaceRefund:{apiName:"adminReviewMarketplaceRefund",displayName:"Get Refund Data",description:"Get refund metadata for a given refund or acquisition ID. If an acquisition ID is provided, will return most recent refund.",emoji:"🧐",schema:{refundId:{type:"string"},acquisitionId:{type:"string"}}},adminCreateMarketplaceRefund:{apiName:"adminCreateMarketplaceRefund",displayName:"Create a Marketplace Refund",description:"Creates a marketplace refund record for the provided user and acquisition. It will ignore time constraints.",emoji:"🆕",schema:{acquisitionId:{type:"string"},userId:{type:"string"}}},adminGetMarketplaceAcquisitionsForUser:{apiName:"adminGetMarketplaceAcquisitionsForUser",dis
101playName:"Get Marketplace Acquisitions for a User",description:"Get marketplace acquisitions for a user. Must provide one of User Id or User Email.",emoji:"🛒",schema:{userId:{type:"string"},userEmail:{type:"string"},spaceId:{type:"string",defaultValue:"",comment:"If provided, will filter acquisitions by spaceId"},status:{type:"options",options:["initiated","succeeded","failed","refunded"],defaultValue:"",comment:"If provided, will filter acquisitions by status"}}},adminReplayMarketplaceStripeCompletionEvent:{apiName:"adminReplayMarketplaceStripeCompletionEvent",displayName:"Replay Marketplace Stripe Completion Event",description:"Invalidates the cached Stripe invoice and re-enqueues the marketplace invoice.paid handling path.",emoji:"🔁",isDestructive:!1,schema:{invoiceId:{type:"string",comment:"Stripe invoice ID to replay."}}},adminIssueMarketplaceRefund:{apiName:"adminIssueMarketplaceRefund",displayName:"Issue a Marketplace Refund",description:"Issue refund for a given refund ID which will be processed by stripe. PLEASE NOTE: Approving a refund will delete the template from the user's Notion, and they will NOT be able to re-purchase. If you need an exception, please provide the acquisition ID in #proj-marketplace-xfn before issuing the refund.",emoji:"💸",schema:{refundId:{type:"string"},status:{type:"options",comment:"Select what status to set the refund to. If selecting 'Approve' will issue refund via stripe and inform the user their content will be deleted.",options:["approved","denied","cancelled"],defaultValue:""}}},adminCreateOrUpdateMarketplaceCoupon:{apiName:"adminCreateOrUpdateMarketplaceCoupon",displayName:"Create or update marketplace coupon",description:"Create a new coupon or update an existing coupon via a coupon id. For updating a coupon, please only fill out the ID and active field. We will only allow updates to whether a coupon is active or not.",emoji:"💲",schema:{id:{type:"string",table:s().QOF,comment:"(REQUIRED IF UPDATING) Id of an existing coupon. Providing an id means you are updating an existing coupon. If no id is provided, remaining fields are required"},code:{type:"string",comment:"(REQUIRED IF CREATING) Code should only be letters and numbers."},discountType:{type:"options",comment:"(REQUIRED IF CREATING) What type of discount the coupon is.",options:["percentage","fixed"]},discountValue:{type:"number",comment:"(REQUIRED IF CREATING) The value for the discount. For fixed discounts, the value should be in cents (e.g. $20 off = 2000). For percent discounts, it should be the number off (0 to 100)."},active:{type:"boolean",comment:"(REQUIRED IF CREATING) Whether the coupon should be active or not.",defaultValue:!1},startDate:{type:"date",comment:"(Optional) Starting date for when coupon is valid if active."},endDate:{type:"date",comment:"(Optional) Ending date for when coupon is valid if active."},usageLimit:{type:"number",comment:"(Optional) Number of times this coupon can be used."},applyToAll:{type:"boolean",comment:"Whether this coupon should be applied to all listings for a creator or not. If true, eligibleListingIds should be empty.",defaultValue:!1},parentId:{type:"string",comment:"(REQUIRED IF CREATING) The id of the template creator whose products the coupon will be applied to."},eligibleListingIds:{type:"string",comment:"Comma separated marketplace listing IDs that are eligible to use this listing.  At least eligibleListingIds or eligibleCreatorIds must be provided. NOTE: a listing ID is different from a template ID",defaultValue:""}}},adminGetMarketplaceCoupon:{apiName:"adminGetMarketplaceCoupon",displayName:"Get marketplace coupon",description:"Get a marketplace coupon by its database id or coupon code & parent ID.",emoji:"🎟",schema:{id:{type:"string",table:s().QOF,comment:"Id of the coupon"},code:{type:"string",comment:"Code of the coupon"},parentId:{type:"string",comment:"Id of the creator whose products the coupon is applied to"}},isDestructive:!1},adminCreateMarketplaceProfileInvitation:{apiName:"adminCreateMarketplaceProfileInvitation",displayName:"Invite user to marketplace profile",description:"Creates a marketplace profile invitation for a user by email. If no user exists with that email, a new shell user will be created. Membership types: editor = owner (only one per profile), membership_admin = can edit/manage members, reader = read-only for contractors/agency. Note: To transfer ownership, use updateMarketplaceProfileMember instead.",emoji:"📨",schema:{profileUsername:{type:"string",comment:"The username of the marketplace profile (e.g., 'notion-team'). You can find this in the profile URL."},inviteeEmail:{type:"string",comment:"Email address of the user to invite. If no user exists with this email, a new user will be created."},membershipType:{type:"options",options:["reader","membership_admin","editor"],comment:"editor = owner (only one per profile, will error if one exists), membership_admin = can edit/manage members, reader = read-only for contractors/agency members.",defaultValue:"membership_admin"}},isDestructive:!1},adminAcceptMarketplaceProfileInvitation:{apiName:"adminAcceptMarketplaceProfileInvitation",displayName:"Accept marketplace profile invitation on behalf of user",description:"Accepts the pending marketplace profile invitation for the given user on the given profile. With force=true, bypasses the max-members and external-integrations checks. The 'user is already a member of a profile' check is always enforced to prevent duplicate memberships.",emoji:"✅",schema:{profileUsername:{type:"string",comment:"The username of the marketplace profile (e.g., 'notion-team'). You can find this in the profile URL."},userEmail:{type:"string",comment:"Email of the invited user."},force:{type:"boolean",comment:"Bypasses the max-members and external-integrations checks. Use only when you've confirmed it's safe.",defaultValue:!1}},isDestructive:!1},adminTransferMarketplaceProfileOwnership:{apiName:"adminTransferMarketplaceProfileOwnership",displayName:"Transfer marketplace profile ownership",description:"Makes an existing profile member the owner (editor) and demotes the current owner to membership_admin. The new owner must already be a member. If they are not, invite them with 'Invite user to marketplace profile' and accept it with 'Accept marketplace profile invitation on behalf of user' (or have them accept) first.",emoji:"🔑",schema:{profileUsername:{type:"string",comment:"The username of the marketplace profile (e.g., 'notion-team'). You can find this in the profile URL."},newOwnerEmail:{type:"string",comment:"Email of the existing member who will become the owner."}},typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"Enter the profile username exactly to confirm the ownership transfer.",inputLabel:"Confirm profile username",confirmButtonLabel:"Transfer ownership"},isDestructive:!0},adminChangeTemplateAuthor:{apiName:"adminChangeTemplateAuthor",displayName:"Change Template Author",description:"Change the author of a template draft and set status to 'in_review'. A Flowdash task will be created for approval. After running this tool, go to the Flowdash task URL to approve the template draft.",emoji:"👤",schema:{templateDraftId:{type:"string",comment:"Template draft ID"},authorContentfulId:{type:"string",comment:"Author contentful ID"}},isDestructive:!0},adminCreateOrUpdateFlowdashTaskForTemplateDraft:{apiName:"adminCreateOrUpdateFlowdashTaskForTemplateDraft",dis
101playName:"Create/Update Flowdash Task for Template Draft",description:"Creates or updates a Flowdash task for a template draft. Use this when a template draft exists in Postgres but somehow did not have a task created on Flowdash. This is useful for fixing InReviewTemplateDraftCheck failures. All errors and successes including Flowdash API responses will be displayed.",emoji:"🔄",schema:{templateDraftId:{type:"string",comment:"The UUID (with dashes) of the template draft to create/update in Flowdash"}},isDestructive:!1},adminResubmitMarketplaceAgentForReview:{apiName:"adminResubmitMarketplaceAgentForReview",displayName:"Resubmit Marketplace Agent for Review",description:"Re-enqueues the marketplace custom agent review pipeline for a version. Use this when a submission needs to be retried after a rejection or a stalled review. This clears stale rejection and security scan metadata and sets the version back to submitted.",emoji:"🤖",schema:{versionId:{type:"string",table:s().a8w,comment:"The marketplace custom agent version ID to resubmit for review"}},isDestructive:!1},adminDeleteStripeConnectedAccount:{apiName:"adminDeleteStripeConnectedAccount",displayName:"Delete Stripe Connected Account",description:"Deletes a Stripe connected account by ID. Use cautiously; this cannot be undone.",emoji:"🗑️",schema:{stripeConnectedAccountId:{type:"string",comment:"The Stripe connected account id (e.g., acct_123)"}},isDestructive:!0},adminDeleteMarketplaceListingForTemplateDraft:{apiName:"adminDeleteMarketplaceListingForTemplateDraft",displayName:"Delete Marketplace Listing for Template Draft",description:"Cleans up failed marketplace listing for a template draft. Reverts draft to in_review status and deletes the orphaned listing record. Validates that no acquisitions, badges, or block references exist before deletion.",emoji:"🧹",schema:{templateDraftId:{type:"string",comment:"The UUID of the template draft to clean up"}},isDestructive:!0},adminSyncContentfulIntegrationListingToPostgres:{apiName:"adminSyncContentfulIntegrationListingToPostgres",displayName:"Sync Contentful Integration Listing to Postgres",description:"Syncs a single Contentful supportedEmbed entry into the integration_listing + marketplace_listing tables (and, for integration-typed listings, mirrors gallery info / listing_status onto the backing integration row), then creates/updates the Flowdash review task. Single-listing counterpart to the syncContentfulIntegrationsToPostgres CLI.",emoji:"🔄",schema:{contentfulId:{type:"string",comment:"Contentful supportedEmbed entry ID to sync."},listingType:{type:"options",options:[...a(968591).sX],defaultValue:"integration",comment:"Listing type. 'integration' requires integrationId; the others require profileId."},integrationId:{type:"string",table:s().Lij,comment:"Required when listingType is 'integration'. The backing integration row whose owner parents the listing."},profileId:{type:"string",table:s().V1v,comment:"Required for non-integration (CMS-only) listing types. The MarketplaceProfile to parent the listing to."},locale:{type:"string",defaultValue:"en-US",comment:"Contentful locale to fetch the entry in."},updateExisting:{type:"boolean",defaultValue:!0,comment:"When true (default), re-sync from Contentful even if the listing already exists. When false, skip if it already exists."}},isDestructive:!1},adminSetConsultantStatus:{apiName:"adminSetConsultantStatus",displayName:"Set Consultant Status",description:"Set the consultant_status field for a marketplace profile, bypassing the normal application and approval flow. Provide either marketplace profile ID or email. If both are provided, the marketplace profile ID will be used. Please note: USE ONLY FOR TESTING PURPOSES. This will not sync data to Salesforce.",emoji:"👨‍🏫",schema:{marketplaceProfileId:{type:"string",comment:"UUID (if not known, just enter the email)"},email:{type:"string",comment:"Email of the user whose marketplace profile to update"},consultantStatus:{type:"options",options:["draft","application_review","approved","rejected","listing_review","published","disabled"],comment:"New consultant status to set"}},isDestructive:!0},adminRemoveMarketplaceListingIdFromBlock:{apiName:"adminRemoveMarketplaceListingIdFromBlock",displayName:"Remove Marketplace Listing ID from Block",description:"Removes the marketplace_listing_id from a block's format field. Use this to clean up blocks that were incorrectly associated with a marketplace listing or when a listing was deleted but the block still references it. Use 'Find Block Information' to check if a block has a marketplace_listing_id set.",emoji:"🧹",sc
101hema:{blockId:{type:"string",table:"block",comment:"The UUID of the block to remove the marketplace_listing_id from"}},isDestructive:!0},adminUpdateCreatorTemplateCount:{apiName:"adminUpdateCreatorTemplateCount",displayName:"Update Creator Template Count",description:"Update the number_of_templates for a template creator. This field determines whether a creator profile is displayed in the marketplace. It is normally updated by a daily Contentful sync, but this tool can be used for ghost creators or template/creator account transfers where the profile needs to be visible immediately.",emoji:"👻",schema:{creatorId:{type:"string",comment:"The template creator ID (not the contentful_id). Use 'Get Template Creator' to find this."},numTemplates:{type:"number",defaultValue:1,comment:"The number of templates to set for this creator. Will be overwritten by the daily Contentful sync."}}},adminGetRevenueShareInfoForDomain:{apiName:"adminGetRevenueShareInfoForDomain",displayName:"Get Revenue Share Info For Domain",description:"Check revenue share information for a domain. Checks Salesforce account status and existing Notion workspaces with the domain.",emoji:"💰",schema:{domain:{type:"string",comment:"Email domain to look up (e.g., 'acme.com')"},source:{type:"options",options:["direct_booking","consultant_initiated"],comment:"Type of service request to check eligibility for. Only consultant_initiated requests are eligible for referral revenue share.",defaultValue:"consultant_initiated"}}},adminRetryMarketplacePayout:{apiName:"adminRetryMarketplacePayout",displayName:"Retry Marketplace Payout",description:"Retry a marketplace payout. Use this if a payout was successfully created in Stripe but failed to land in the creator's bank account. Provide either the payout ID or the Stripe payout ID (external_id).",emoji:"🔄",schema:{payoutId:{type:"string",comment:"The database ID of the marketplace_payout to retry"},externalId:{type:"string",comment:"The Stripe payout ID (external_id) to retry"}},isDestructive:!1},adminTriggerUpgradeMarketplaceConsultantTiers:{apiName:"adminTriggerUpgradeMarketplaceConsultantTiers",displayName:"Trigger Consultant Tier Upgrade Task",description:"Enqueue the Marketplace consultant tier upgrade task. The default asOfDate is the most recent 15th of the month. Production output is emailed to #eng-team-adoption-ops-production. Non-production runs do not send output.",emoji:"⬆️",schema:{asOfDate:{type:"date",defaultValue:function(e=new Date){var t;let a,i,n;return a=(t=e).getUTCFullYear(),n=Date.UTC(a,i=t.getUTCMonth(),15,17),t.getTime()>=n?rF({year:a,month:i,day:15}):rF({year:a,month:i-1,day:15})}(),comment:"Analytics ds partition to read. The expected date is the most recent 15th of the month."},dryRun:{type:"boolean",defaultValue:!0,comment:"Simulate the full task and output summary without saving tier changes or emitting tier-change analytics events."},profileIds:{type:"string",defaultValue:"",comment:"Optional comma-separated Marketplace profile IDs to restrict the task to. Leave empty to scan all published consultant profiles.",table:s().V1v}},isDestructive:!0,typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"Review the Marketplace consultant tier upgrade task details before enqueueing.",inputLabel:"Confirm upgrade task",confirmButtonLabel:"Enqueue upgrade task",conditionalDisclaimer:{conditionResponseKey:"isOffScheduleAsOfDate",message:"DANGER: This asOfDate does not match the expected upgrade date. Only continue for an intentional off-schedule correction."}}},adminTriggerDowngradeMarketplaceConsultantTiers:{apiName:"adminTriggerDowngradeMarketplaceConsultantTiers",displayName:"Trigger Consultant Tier Downgrade Task",description:"Enqueue the Marketplace consultant tier downgrade task. The default asOfDate is the most recent January or July 15th. Production output is emailed to #eng-team-adoption-ops-production. Non-production runs do not send output.",emoji:"⬇️",schema:{asOfDate:{type:"date",defaultValue:function(e=new Date){var t;let a,i,n;return a=(t=e).getUTCFullYear(),i=t.getTime(),n=Date.UTC(a,0,15,18),i>=Date.UTC(a,6,15,18)?rF({year:a,month:6,day:15}):i>=n?rF({year:a,month:0,day:15}):rF({year:a-1,month:6,day:15})}(),comment:"Analytics ds partition to read. The expected date is the most recent January or July 15th."},dryRun:{type:"boolean",defaultValue:!0,comment:"Simulate the full task and output summary without saving tier changes or emitting tier-change analytics events."},profileIds:{type:"string",defaultValue:"",comment:"Optional comma-separated Marketplace profile IDs to restrict the task to. Leave empty to scan all published consultant profiles.",table:s().V1v}},isDestructive:!0,typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"Review the Marketplace consultant tier downgrade task details before enqueueing.",inputLabel:"Confirm downgrade task",confirmButtonLabel:"Enqueue downgrade task",conditionalDisclaimer:{conditionResponseKey:"isOffScheduleAsOfDate",message:"DANGER: This asOfDate does not match the expected downgrade date. Only continue for an intentional off-schedule correction."}}},adminCreateMarketplacePayouts:{apiName:"adminCreateMarketplacePayouts",displayName:"Create Marketplace Payout",description:"Create a marketplace payout for a marketplace profile. Payout is sent via Stripe. ⚠️ Always use dry run first to preview results, and then run with dryRun unchecked. An email notification to creator will be sent when the payout lands in the bank account, typically a few days later.",emoji:"💰",schema:{profileId:{type:"string",comment:"Marketplace profile ID. Provide this OR Creator Email. If both are provided, Profile ID takes precedence.",table:s().V1v},creatorEmail:{type:"string",comment:"Email address of the user associated with the marketplace profile. Provide this OR Profile ID."},date:{type:"string",comment:"Optional: Cutoff date in YYYY-MM-DD format (e.g., 2024-01-01). If only date is provided, time defaults to 00:00. Leave both date and time empty to use current date/time.",placeholder:new Date().toISOString().split("T")[0]},time:{type:"string",comment:"Optional: Cutoff time in 24-hour format (e.g., 14:30). If only time is provided, uses current date. Leave both date and time empty to use current date/time.",placeholder:"23:59"},timezone:{type:"timezone",comment:"Timezone for interpreting date/time (defaults to your local timezone). If date/time not provided, current time is used regardless of this setting.",defaultValue:(0,ii().P)()},dryRun:{type:"boolean",comment:"Preview payout without creating it. ALWAYS test with dryRun first!",defaultValue:!0},ignoreMinimum:{type:"boolean",comment:"Ignore minimum payout threshold. Use when we need to clear the Stripe balance before unlinking the account from the profile.",defaultValue:!1}},isDestructive:!1},adminAssignMarketplaceBadgesToUsers:{apiName:"adminAssignMarketplaceBadgesToUsers",displayName:"Assign Marketplace Badges to Users",description:"Bulk-assign marketplace badges to users via CSV. The CSV must have two columns: `email` (the user's Notion email) and `badgeSlug` (the badge to add). Each row is processed independently — rows that fail (unknown email, unknown badge, badge already assigned, badge not supported for users, etc.) are reported in the response, but they do not abort the rest of the CSV. For service-certification, also fires the marketplace_consultant_service_certification_complete tracking event.",emoji:"🎖️",isDestructive:!1,schema:{csv:{type:"file",name:"csv",comment:"CSV with two columns (case-sensitive): `email`, `badgeSlug`. One row per (user, badge) assignment."}}},adminAssignMarketplaceBadgeToUser:{apiName:"adminAssignMarketplaceBadgeToUser",dis
101playName:"Assign Marketplace Badge to User",description:"Assign one marketplace badge to one user by email. Use this when support needs to repair a merged Credly or SkillJar profile for a single consultant.",emoji:"🎖️",isDestructive:!1,schema:{email:{type:"string",name:"User email",comment:"Email address of the Notion user receiving the badge.",placeholder:"[email protected]",isRequired:!0},badgeSlug:{type:"options",name:"Badge slug",options:[...a(161791).JA],placeholder:"Select a badge slug...",required:!0,isRequired:!0,comment:"Marketplace badge to assign to the user."}}},adminRejectTemplateDraft:{apiName:"adminRejectTemplateDraft",displayName:"Reject Template Draft (bypass Flowdash)",description:"Directly reject a template draft without going through Flowdash. Only use this when a submission is malformed in a way that prevents a Flowdash task from being created. Sends the creator a rejection email.",emoji:"❌",schema:{templateDraftId:{type:"string",table:s()._FR,comment:"The UUID of the template draft to reject"},rejectionReason:{type:"options",options:[...a(845756).RA],comment:"Reason for rejecting the template draft"},customRejectionReason:{type:"string",comment:'Custom rejection reason text. Required when rejection reason is "custom".',defaultValue:""}},isDestructive:!0}};(0,a(477465).Dv)("dataMigrationWorkerSupervisor");let rz=["exampleStreamMigrationDataFromCsv","crdtMigration","crdtMigrationWithFourWorkers","setSpaceCrdtStatusEnabled","setSpaceCrdtStatusEnabledEu","backfillUserAlias","backfillSidebar","migrateDatabaseFacetForNotificationSharding","backfillFormDefaultTemplateEmpty","deleteUserAliasesForDeletedAccounts","backfillBotTokenSpaceId","backfillBillingDataHistoryForPaidSpaces","purgeOldActivities","purgeOldActivitiesNonDryRun","migrateOfferStatuses","migrateAiFavorites","backfillUserDeletedTime","testSimpleBlockMigration","migrateWorkflowDataAutoModelToSonnet","migrateWorkflowDataNoop","workflowRemoveAccidentalTemplateData","backfillSpaceShardedInvoices","backfillSpaceShardedBillingDataHistoryEntries","fixCollectionSchemaDuplicationPsbs","migrateAiAutofillToDbAgents","backfillCalendarAiConnectorForCronBots","backfillNewMixedBillingIntervalFields","migrateSubscriptionBillingMode","backfillMailAiConnectorForPersonalConnections","backfillGroupManagementType","deleteOrphanedBotTokens","testSimpleBlockMigrationWithErrors","ekmOnboarding","logCollectionSchemaNormalizationDiff","backfillDiscussionsModuleInLayouts","makeAllCollectionSchemasNormalized","cleanupOrphanedDbAgentWorkflows","stripGuestPermissionsFromCustomAgents","confluenceImportViaApi","confluenceImportViaFile","backfillManageWorkersCapability","backfillOneWayRelationPlaceholder","migrateRelationAssociations","migrateRelationAssociationsFromDataLakeCsvExport","backfillOrganizationRequestCompletedStatus","syncAllMetronomeCustomers","backfillTeamMembershipNewTables","backfillTeamMembershipNewTablesTargeted","auditTeamMembershipMigration","deleteUnusedFollowingChannelNotifications","retireSpacePages","deactivateAgentComputerSessionBots","syncAllBizEntBillingData","backfillSyncedBlockAssociations","backfillWorkspaceDataAccessConsent","testLogDataLakeCsvExportIds","testLogDynamoDbDataLakeCsvExportRows","backfillWorkersDynamoDbSpaceId","repairAgentServiceDynamoWorkspaces","backfillAgentServiceDynamoData","backfillNotionMcpBotTokenExpiry","revokeLegacyNotionMcpBotTokens","backfillAllocatedCommitSources","deletePresentedOfferStatuses","migrateLegacySpaceDomainVerificationCodes","migrateFableModelControls","migrateFable51ModelControls","backfillLinkedinAiCreditTiers","clearLegacyTeamMembership","deleteOrphanedClaudeCodeSessionFiles","backfillNotionAutomationWorkspaceSearch","backfillNotionAutomationIntegrationWorkspaceSearch","backfillLegacyConnectionAllowlist","backfillOutlookMailAiConnector","migrateNonNavigableBlockPermissions","migrateNonNavigableBlockPermissionsFromDataLakeCsvExport","migrateGemini3FlashWorkflowModelsToGemini36Flash","rollbackGemini3FlashWorkflowModelsFromGemini36Flash","migrateGemini3FlashDefaultModelsToGemini36Flash","rollbackGemini3FlashDefaultModelsFromGemini36Flash","migrateKimiK26WorkflowModelsToKimiK3","rollbackKimiK26WorkflowModelsFromKimiK3","migrateKimiK26DefaultModelsToKimiK3","rollbackKimiK26DefaultModelsFromKimiK3","migrateKimiK27WorkflowModelsToKimiK3","rollbackKimiK27WorkflowModelsFromKimiK3","migrateKimiK27DefaultModelsToKimiK3","rollbackKimiK27DefaultModelsFromKimiK3","backfillWorkflowThreadDerivedInformation","migrateMinimaxM25WorkflowModelsToAuto","rollbackMinimaxM25WorkflowModelsFromAuto","migrateMinimaxM25DefaultModelsToAuto","rollbackMinimaxM25DefaultModelsFromAuto","migrateRemainingRetiredAgentWorkflowModelsToAuto","rollbackRemainingRetiredAgentWorkflowModelsFromAuto","migrateRemainingRetiredAgentDefaultModelsToAuto","rollbackRemainingRetiredAgentDefaultModelsFromAuto","reconcileBillableSeats","re
101concileDiscoveredBillableSeats","resetFableWorkspaceOptIns","migrateCommentThreads","migrateSonnet5HighWorkflowModelsToSonnet55","rollbackSonnet5HighWorkflowModelsFromSonnet55","migrateSonnet5HighDefaultModelsToSonnet55","rollbackSonnet5HighDefaultModelsFromSonnet55","migrateOpus5WorkflowModelsToOpus55","rollbackOpus5WorkflowModelsFromOpus55","migrateOpus5DefaultModelsToOpus55","rollbackOpus5DefaultModelsFromOpus55","migrateGpt56SolWorkflowModelsToGpt61Sol","rollbackGpt56SolWorkflowModelsFromGpt61Sol","migrateGpt56SolDefaultModelsToGpt61Sol","rollbackGpt56SolDefaultModelsFromGpt61Sol","migrateGpt6SolWorkflowModelsToGpt61Sol","rollbackGpt6SolWorkflowModelsFromGpt61Sol","migrateGpt6SolDefaultModelsToGpt61Sol","rollbackGpt6SolDefaultModelsFromGpt61Sol","propagateOpus5DisableToOpus55","backfillWorkflowBillingMode","backfillWorkflowWorkerIds","enrollLegacyDeletedThreadsForPurge"].sort(),rG={adminCreateMigrationSupervisor:{apiName:"adminCreateMigrationSupervisor",displayName:"Create migration supervisor",description:"Create a migration supervisor for the project (only one supervisor allowed per project).",isDestructive:!0,emoji:"🆕",schema:{project:{type:"options",options:rz}}},adminListMigrationProjects:{apiName:"adminListMigrationProjects",displayName:"List migration projects",description:"List migration projects and their project types.",isDestructive:!1,emoji:"📚",schema:{}},adminListDataLakeCsvExportDirectories:{apiName:"adminListDataLakeCsvExportDirectories",displayName:"List data-lake CSV export directories",description:"List data-lake CSV export directories containing cell-partitioned exports.",isDestructive:!1,emoji:"📁",schema:{}},adminListDynamoDbDataLakeCsvExports:{apiName:"adminListDynamoDbDataLakeCsvExports",displayName:"List DynamoDB data-lake CSV exports",description:"List manifest-backed DynamoDB data-lake exports and inspect one export's regional tables.",isDestructive:!1,emoji:"📦",schema:{exportName:{type:"string",comment:"Optional name of a published DynamoDB export"},exportTime:{type:"string",comment:"Optional export time in YYYYMMDDTHHMMSSZ format"}}},adminListMigrationWorkersForSupervisor:{apiName:"adminListMigrationWorkersForSupervisor",displayName:"List non-completed migration workers for supervisor",description:"List non-completed migration worker IDs for the project's supervisor.",isDestructive:!1,emoji:"🧾",schema:{project:{type:"options",options:rz}}},adminResumeMigrationSupervisor:{apiName:"adminResumeMigrationSupervisor",displayName:"Resume migration supervisor",description:"Set the project's migration supervisor back to failed_retryable so cron can restart it.",isDestructive:!0,emoji:"⏯",schema:{project:{type:"options",options:rz}}},adminGetMigrationStatusForSupervisor:{apiName:"adminGetMigrationStatusForSupervisor",displayName:"Get migration status",description:"Get a one-time snapshot of supervisor state, queue task state, worker counts, and total migrated rows.",isDestructive:!1,emoji:"📊",schema:{project:{type:"options",options:rz}}},adminGetMigrationWorkerForSupervisor:{apiName:"adminGetMigrationWorkerForSupervisor",displayName:"Get migration worker details",description:"Fetch the migration worker record for the project by worker ID.",isDestructive:!1,emoji:"🔎",schema:{project:{type:"options",options:rz},migrationWorkerId:{type:"string",comment:"Migration worker UUID to fetch",placeholder:a(591977).nZ}}},adminResumeMigrationWorkersForSupervisor:{apiName:"adminResumeMigrationWorkersForSupervisor",displayName:"Resume migration workers for supervisor",description:"Resume a specific migration worker (if provided) or bulk move failed_not_retryable workers to failed_retryable for the project's supervisor.",isDestructive:!0,emoji:"🔁",schema:{project:{type:"options",options:rz},migrationWorkerId:{type:"string",comment:"Optional migration worker UUID; leave blank to resume all workers",placeholder:a(591977).nZ}}},adminMarkMigrationSupervisorAsFailed:{apiName:"adminMarkMigrationSupervisorAsFailed",displayName:"Kill running migration supervisor",description:"Force-kill a running migration supervisor by setting its state to failed_not_retryable.",isDestructive:!0,emoji:"🛑",schema:{project:{type:"options",options:rz}}},adminCleanupMigrationProject:{apiName:"adminCleanupMigrationProject",displayName:"Cleanup migration project",description:"Delete all migration supervisors and workers for a project. Only run after ensuring no active work.",isDestructive:!0,emoji:"🧹",sc
101hema:{project:{type:"options",options:rz},confirmNoActiveWorkers:{type:"boolean",comment:"I confirm there are no active workers/supervisors running"},confirmKillSwitchOrSafe:{type:"boolean",comment:"I confirm the project kill switch or equivalent safety is enabled"}}}},rq={adminGetIPRestrictions:{apiName:"adminGetIPRestrictions",displayName:"Get IP Restrictions for Organization",emoji:"🔒",description:"Get all IP restrictions for an organization.",schema:{organizationId:{type:"string",table:s().y75,showByDefaultInSingleRecordMode:!0}}},adminCreateIPRestrictions:{apiName:"adminCreateIPRestrictions",displayName:"Create IP Restriction",emoji:"🛡",description:"Add a network control rule to an organization's managed user settings. Only allows public IP addresses and CIDR ranges. Private IP ranges and localhost are blocked for security.",schema:{organizationId:{type:"string",table:s().y75,comment:"The organization ID to add the network control rule to."},ruleName:{type:"string",comment:"A descriptive name for the network control rule.",placeholder:"Office Network"},ipValues:{type:"string",comment:"IP addresses or CIDR ranges to allow, separated by commas or newlines. Example: 203.0.113.1, 198.51.100.0/24",placeholder:"203.0.113.1\n198.51.100.0/24"},enabled:{type:"boolean",comment:"Whether the rule should be enabled immediately.",defaultValue:!0}},isDestructive:!1},adminUpdateIPRestriction:{apiName:"adminUpdateIPRestriction",displayName:"Update IP Restriction",emoji:"✏",description:"Update an existing IP restriction rule for an organization. Fields left blank will not be updated.",schema:{ipRestrictionId:{type:"string",comment:"The ID of the IP restriction rule to update."},ruleName:{type:"string",comment:"A descriptive name for the network control rule.",placeholder:"Office Network"},ipValues:{type:"string",comment:"IP addresses or CIDR ranges to allow, separated by commas or newlines. Example: 203.0.113.1, 198.51.100.0/24",placeholder:"203.0.113.1\n198.51.100.0/24"},enabled:{type:"options",options:["noop","enable","disable"],defaultValue:"noop",comment:"Whether the rule should be enabled or disabled."}},isDestructive:!1},adminCheckIPRestriction:{apiName:"adminCheckIPRestriction",displayName:"Check IP Restriction",emoji:"🛡",description:"Test if an IP address is allowed or blocked by an IP restriction rule for an Organization.",schema:{organizationId:{type:"string",table:s().y75,comment:"The organization ID to test the IP restriction for."},ipAddress:{type:"string",comment:"The IP address to test.",placeholder:"192.168.1.1"}},isDestructive:!1},adminUpdateManagedUserNetworkControlSettings:{apiName:"adminUpdateManagedUserNetworkControlSettings",displayName:"Toggle Network Control for Managed Users",emoji:"🔐",description:"Enable or disable network control (IP restrictions) for managed users in an organization. Cannot be enabled if the organization has no IP restrictions configured.",schema:{organizationId:{type:"string",comment:"The ID of the organization to configure.",table:s().y75,showByDefaultInSingleRecordMode:!0},enable:{type:"boolean",comment:"Whether to enable or disable network control for managed users."}},isDestructive:!1}};function rH(e){let[t,i]=(0,r.useState)(void 0),[n,s]=(0,r.useState)(void 0);(0,r.useEffect)(()=>{i(void 0),s(void 0)},[e]);let o=void 0===n&&(void 0===t||"pending"===t.state),l=(0,r.useCallback)(async()=>{let t;try{t=await e()}catch(e){t={type:"error",message:(0,a(324497).A)(e).message}}"error"===t.type?s(t.message):i(t.status)},[e]);return(0,a(216266).n)(l,3e3,o),{status:t,errorMessage:n}}let rZ={container:{padding:16},heading:{marginBottom:8,fontWeight:a(699422).Wy.semibold},muted:{fontSize:12,color:a(632079).Tj.text.secondary,marginBottom:12},statRow:{fontFamily:"monospace",fontSize:12,lineHeight:1.6},link:{color:a(632079).Tj.blue.text.primary,textDecoration:"underline",cursor:"pointer",display:"block",marginTop:12},error:{fontSize:13,color:a(632079).Tj.red.text.primary,fontWeight:a(699422).Wy.semibold}},rJ={container:{padding:16},heading:{marginBottom:8,fontWeight:a(699422).Wy.semibold},muted:{fontSize:12,color:a(632079).Tj.text.secondary,marginBottom:12},statRow:{fontFamily:"monospace",fontSize:12,lineHeight:1.6},link:{color:a(632079).Tj.blue.text.primary,textDecoration:"underline",cursor:"pointer",display:"block",marginTop:12},error:{fontSize:13,color:a(632079).Tj.red.text.primary,fontWeight:a(699422).Wy.semibold}}
101,rQ={adminCreateNotionRepresentativeSpaceAccessRequest:{apiName:"adminCreateNotionRepresentativeSpaceAccessRequest",spaceCellRoutingField:"spaceId",displayName:"Request temporary customer workspace access",emoji:"⏱️",description:"Creates a billing-exempt temporary membership request for the signed-in Admin Tool user. A customer workspace membership admin must approve it.",schema:{spaceId:{type:"string",isRequired:!0,table:"space",placeholder:a(591977).nZ,comment:"Enterprise customer workspace ID."},expirationDate:{type:"date",defaultValue:a(120011).DateTime.utc().plus({days:30}).toISODate()??void 0,comment:"Access expires at the end of this date in UTC. Defaults to 30 days from today."}},isDestructive:!0,requiresHourlyReauth:!0}},rY={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:20,marginBottom:8,marginTop:16},tabBarContainer:{marginBottom:16},sectionHeader:{fontWeight:a(699422).Wy.bold,fontSize:15,marginTop:20,marginBottom:8,color:a(632079).Tj.text.secondary,textTransform:"uppercase",letterSpacing:"0.04em"},offerCard:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,padding:"14px 16px",fontSize:15,marginBottom:12,backgroundColor:a(632079).Tj.background.primary,boxShadow:a(632079).Tj.shadow.base.sm},offerCardLast:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,padding:"14px 16px",fontSize:15,backgroundColor:a(632079).Tj.background.primary,boxShadow:a(632079).Tj.shadow.base.sm},campaignName:{fontWeight:a(699422).Wy.bold,wordBreak:"break-all"},offerMetaTable:{marginTop:10,borderTop:`1px solid ${a(632079).Tj.border.primary}`},offerMetaRow:{fontSize:14,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},offerMetaRowLast:{fontSize:14},offerMetaLabel:{flexShrink:0,width:130,paddingTop:6,paddingInlineEnd:8,paddingBottom:6,paddingInlineStart:0,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary},offerMetaValue:{padding:"6px 0",wordBreak:"break-all",flex:1,color:a(632079).Tj.text.primary},typeBadge:{display:"inline-block",padding:"3px 10px",borderRadius:12,fontSize:13,fontWeight:a(699422).Wy.medium},emptySectionNote:{fontSize:14,color:a(632079).Tj.text.secondary,fontStyle:"italic",marginBottom:12},footer:{marginTop:12,fontSize:13,color:a(632079).Tj.text.secondary,fontStyle:"italic"}};function rX(e,t){let a=e[t];return(0,n().Kg)(a)?a:void 0}function r0(e,t){let a=e[t];return(0,n().Et)(a)?a:void 0}function r1(e,t){let a=e[t];return iP(a)?a:void 0}function r4(e){if(!iP(e))return{type:"unknown",campaign:"—",durationSummary:"—",discountSummary:void 0,products:void 0,subscriptionTier:void 0};let t=rX(e,"type");return{type:"coupon"===t||"trial"===t?t:"unknown",campaign:rX(e,"campaign")??"—",durationSummary:function(e){if(void 0===e)return"—";let t=[];for(let a of["years","months","weeks","days","hours","minutes"]){let i=r0(e,a);void 0!==i&&0!==i&&t.push(`${i} ${1===i?a.replace(/s$/,""):a}`)}return 0===t.length?"—":t.join(", ")}(r1(e,"duration")),discountSummary:function(e){if(void 0===e)return;let t=rX(e,"type");if("percent_off"===t){let t=r0(e,"percentOff");return void 0===t?"Percent off":`${t}% off`}if("seat_count"===t){let t=r0(e,"seatCount");return void 0===t?"Seat count":`+${t} seats`}return t}(r1(e,"discount")),products:function(e){if(!Array.isArray(e))return;let t=[];for(let a of e){if((0,n().Kg)(a)){t.push(iL(a));continue}if(iP(a)){let e=rX(a,"name");if(void 0!==e){t.push(iL(e));continue}let i=rX(a,"tier");if(void 0!==i){t.push(iL(i));continue}}}return 0===t.length?void 0:t}(e.products),subscriptionTier:rX(e,"subscriptionTier")}}function r2(e){return iP(e)?{startDateMs:r0(e,"startDateMs"),endDateMs:r0(e,"endDateMs"),entrypoint:rX(e,"entrypoint"),userId:rX(e,"userId"),offer:r4(e.offer??e)}:{startDateMs:void 0,endDateMs:void 0,entrypoint:void 0,userId:void 0,offer:r4(void 0)}}function r6(e){return void 0===e?"—":new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function r9({type:e}){let t=function(e){switch(e){case"trial":return{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.accentPrimary};case"coupon":return{backgroundColor:a(632079).Tj.purple.background.primary,color:a(632079).Tj.purple.text.accentPrimary};default:return{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary}}}(e),i="unknown"===e?"Unknown":"trial"===e?"Trial":"Coupon";return(0,d.jsx)("span",{style:{...rY.typeBadge,...t},children:i})}function r7({entry:e,isLast:t}){return(0,d.jsxs)(a(4458).fI,{style:t?rY.offerMetaRowLast:rY.offerMetaRow,children:[(0,d.jsx)("div",{style:rY.offerMetaLabel,children:e.label}),(0,d.jsx)("div",{style:rY.offerMetaValue,children:e.value})]})}function r3(e){let t=[{label:"Duration",value:e.durationSummary}];return void 0!==e.discountSummary&&t.push({label:"Discount",value:e.discountSummary}),void 0!==e.subscriptionTier&&t.push({label:"Tier",value:iL(e.subscriptionTier)}),void 0!==e.products&&t.push({label:"Products",value:e.products.join(", ")}),t}function r8({offer:e,isLast:t}){let i=r3(e);return(0,d.jsxs)("div",{style:t?rY.offerCardLast:rY.offerCard,children:[(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(r9,{type:e.type}),(0,d.jsx)("span",{style:rY.campaignName,children:e.campaign})]}),(0,d.jsx)("div",{style:rY.offerMetaTable,children:i.map((e,t)=>(0,d.jsx)(r7,{entry:e,isLast:t===i.length-1},e.label))})]})}function r5({claimed:e,isLast:t}){let i=[{label:"Claimed",value:r6(e.startDateMs)},{label:"Ends",value:r6(e.endDateMs)},{label:"Entrypoint",value:e.entrypoint??"—"},{label:"User",value:e.userId??"—"},...r3(e.offer)];return(0,d.jsxs)("div",{style:t?rY.offerCardLast:rY.offerCard,children:[(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(r9,{type:e.offer.type}),(0,d.jsx)("span",{style:rY.campaignName,children:e.offer.campaign})]}),(0,d.jsx)("div",{style:rY.offerMetaTable,children:i.map((e,t)=>(0,d.jsx)(r7,{entry:e,isLast:t===i.length-1},e.label))})]})}let se={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:20,marginBottom:8,marginTop:16},tabBarContainer:{marginBottom:16},invoiceCard:{border:`1px solid ${a(632079).oZ.uiLightGray}`,borderRadius:6,padding:"14px 16px",fontSize:15,marginBottom:12,backgroundColor:a(632079).Tj.background.primary,boxShadow:`0 1px 2px ${a(632079).oZ.uiLightGray}`},invoiceCardLast:{border:`1px solid ${a(632079).oZ.uiLightGray}`,borderRadius:6,padding:"14px 16px",fontSize:15,backgroundColor:a(632079).Tj.background.primary,boxShadow:`0 1px 2px ${a(632079).oZ.uiLightGray}`},invoiceTotal:{fontWeight:a(699422).Wy.bold},invoiceMetaTable:{marginTop:10,borderTop:`1px solid ${a(632079).oZ.uiLightGray}`},invoiceMetaRow:{fontSize:14,borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`},invoiceMetaRowLast:{fontSize:14},invoiceMetaLabel:{flexShrink:0,width:110,paddingTop:6,paddingInlineEnd:8,paddingBottom:6,paddingInlineStart:0,fontWeight:a(699422).Wy.medium,color:a(632079).oZ.mediumTextColor},invoiceMetaValue:{padding:"6px 0",wordBreak:"break-all",flex:1,color:a(632079).Tj.text.primary},statusBadge:{display:"inline-block",padding:"3px 10px",borderRadius:12,fontSize:13,fontWeight:a(699422).Wy.medium},notAttemptedTag:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.medium,backgroundColor:a(632079).Tj.orange.background.primary,color:a(632079).Tj.orange.text.accentPrimary,marginInlineStart:6},truncationFooter:{marginTop:12,fontSize:13,color:a(632079).oZ.mediumTextColor,fontStyle:"italic"}};function st({status:e}){let t=function(e){switch(e){case"paid":return{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.accentPrimary};case"open":return{backgroundColor:a(632079).Tj.orange.background.primary,color:a(632079).Tj.orange.text.accentPrimary};case"uncollectible":case"void":return{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary};default:return{backgroundColor:a(632079).oZ.uiLightGray,color:a(632079).oZ.mediumTextColor}}}(e);return(0,d.jsx)("span",{style:{...se.statusBadge,...t},children:iU(e??"unknown")})}function sa({entry:e,isLast:t}){return(0,d.jsxs)(a(4458).fI,{style:t?se.invoiceMetaRowLast:se.invoiceMetaRow,children:[(0,d.jsx)("div",{style:se.invoiceMetaLabel,children:e.label}),(0,d.jsx)("div",{style:se.invoiceMetaValue,children:e.value})]})}function si({event:e,isLast:t}
101){let i=[{label:"Date",value:new Date(e.timestamp).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})},{label:"ID",value:e.id},{label:"Currency",value:e.currencyCode.toUpperCase()}];return void 0!==e.paymentStatus&&i.push({label:"Payment",value:iU(e.paymentStatus)}),(0,d.jsxs)("div",{style:t?se.invoiceCardLast:se.invoiceCard,children:[(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(st,{status:e.status}),(0,d.jsx)("span",{style:se.invoiceTotal,children:iB(e.total,e.currencyCode)}),(0,d.jsx)(a(428217).V,{href:e.url,external:!0,hoverColor:"blue",children:"View invoice →"}),e.attempted?null:(0,d.jsx)("span",{style:se.notAttemptedTag,children:"Not yet attempted"})]}),(0,d.jsx)("div",{style:se.invoiceMetaTable,children:i.map((e,t)=>(0,d.jsx)(sa,{entry:e,isLast:t===i.length-1},e.label))})]})}let sn={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:20,marginBottom:8,marginTop:16},tabBarContainer:{marginBottom:16},promoCard:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,padding:"14px 16px",fontSize:15,backgroundColor:a(632079).Tj.background.primary,boxShadow:a(632079).Tj.shadow.base.sm},description:{marginTop:8,fontSize:14,color:a(632079).Tj.text.secondary,fontStyle:"italic"},discountSummary:{marginTop:14,fontSize:22,fontWeight:a(699422).Wy.bold,color:a(632079).Tj.text.primary},durationLine:{marginTop:4,fontSize:14,color:a(632079).Tj.text.secondary},metaTable:{marginTop:14,borderTop:`1px solid ${a(632079).Tj.border.primary}`},metaRow:{fontSize:14,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},metaRowLast:{fontSize:14},metaLabel:{flexShrink:0,width:110,paddingTop:6,paddingInlineEnd:8,paddingBottom:6,paddingInlineStart:0,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary},metaValue:{padding:"6px 0",wordBreak:"break-all",flex:1,color:a(632079).Tj.text.primary},sectionHeader:{fontWeight:a(699422).Wy.bold,fontSize:13,marginTop:18,marginBottom:6,color:a(632079).Tj.text.secondary,textTransform:"uppercase",letterSpacing:"0.04em"},appliesToEmpty:{fontSize:14,color:a(632079).Tj.text.secondary,fontStyle:"italic"},appliesToList:{marginTop:4,padding:"8px 10px",fontSize:13,fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,color:a(632079).Tj.text.primary},appliesToItem:{paddingTop:2,paddingBottom:2,wordBreak:"break-all"},sourceBadge:{display:"inline-block",padding:"3px 10px",borderRadius:12,fontSize:13,fontWeight:a(699422).Wy.medium}};function sr({source:e}){let t=function(e){switch(e){case"promo_code":return{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.accentPrimary};case"coupon":return{backgroundColor:a(632079).Tj.purple.background.primary,color:a(632079).Tj.purple.text.accentPrimary}}}(e);return(0,d.jsx)("span",{style:{...sn.sourceBadge,...t},children:iU(e)})}function ss({entry:e,isLast:t}){return(0,d.jsxs)(a(4458).fI,{style:t?sn.metaRowLast:sn.metaRow,children:[(0,d.jsx)("div",{style:sn.metaLabel,children:e.label}),(0,d.jsx)("div",{style:sn.metaValue,children:e.value})]})}function so({appliesTo:e}){return void 0===e||0===e.length?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:sn.sectionHeader,children:"Applies to"}),(0,d.jsx)("div",{style:sn.appliesToEmpty,children:"Applies to all prices."})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:sn.sectionHeader,children:"Applies to (Stripe price IDs)"}),(0,d.jsx)("div",{style:sn.appliesToList,children:e.map(e=>(0,d.jsx)("div",{style:sn.appliesToItem,children:e},e))})]})}function sl({promo:e}){let t=[{label:"Source",value:iU(e.source)},{label:"ID",value:e.id}];
101return e.code!==e.id&&t.push({label:"Code",value:e.code}),(0,d.jsxs)("div",{style:sn.promoCard,children:[(0,d.jsx)(a(4458).fI,{gap:8,children:(0,d.jsx)(sr,{source:e.source})}),void 0!==e.description&&""!==e.description?(0,d.jsx)("div",{style:sn.description,children:e.description}):null,(0,d.jsx)("div",{style:sn.discountSummary,children:void 0!==e.percent_off?`${e.percent_off}% off`:void 0!==e.amount_off?`$${(e.amount_off/100).toFixed(2)} off`:"No discount specified"}),(0,d.jsx)("div",{style:sn.durationLine,children:function(e){switch(e.duration){case"forever":return"Forever";case"once":return"One-time";case"repeating":{let t=e.duration_in_months;return void 0===t?"Repeating":`Repeating \xb7 ${t} month${1===t?"":"s"}`}}}(e)}),(0,d.jsx)("div",{style:sn.metaTable,children:t.map((e,a)=>(0,d.jsx)(ss,{entry:e,isLast:a===t.length-1},e.label))}),(0,d.jsx)(so,{appliesTo:e.applies_to})]})}let sd={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:8,marginTop:16},card:{border:`1px solid ${a(632079).oZ.uiLightGray}`,borderRadius:4,overflow:"hidden",marginTop:12,marginBottom:16},sectionWithBorder:{borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`},sectionNoBorder:{},sectionHeader:{fontSize:11,fontWeight:a(699422).Wy.bold,letterSpacing:"0.08em",padding:"6px 12px",backgroundColor:a(632079).oZ.uiLightGray,color:a(632079).oZ.mediumTextColor},spaceCardHeader:{fontWeight:a(699422).Wy.bold,fontSize:15,padding:"10px 12px",backgroundColor:a(632079).oZ.uiLightGray,borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`},rowWithBorder:{borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`,fontSize:13},rowNoBorder:{fontSize:13},rowLabel:{flexShrink:0,width:180,padding:"7px 12px",fontWeight:a(699422).Wy.medium,color:a(632079).oZ.mediumTextColor,borderInlineEnd:`1px solid ${a(632079).oZ.uiLightGray}`},rowValue:{padding:"7px 12px",wordBreak:"break-all",flex:1},statusBadge:{display:"inline-block",padding:"2px 8px",borderRadius:12,fontSize:12,fontWeight:a(699422).Wy.medium},invoiceRow:{borderBottom:`1px solid ${a(632079).oZ.uiLightGray}`,padding:"8px 12px",fontSize:13},invoiceRowLast:{padding:"8px 12px",fontSize:13},invoiceLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"none"},invoiceAmountDue:{fontWeight:a(699422).Wy.bold},invoiceMeta:{color:a(632079).oZ.mediumTextColor,fontSize:12,marginTop:2},tabBarContainer:{marginBottom:16}};function sc({label:e,value:t,isLast:i}){return(0,d.jsxs)(a(4458).fI,{style:i?sd.rowNoBorder:sd.rowWithBorder,children:[(0,d.jsx)("div",{style:sd.rowLabel,children:e}),(0,d.jsx)("div",{style:sd.rowValue,children:t})]})}function sp({title:e,children:t,isLast:a}){return(0,d.jsxs)("div",{style:a?sd.sectionNoBorder:sd.sectionWithBorder,children:[(0,d.jsx)("div",{style:sd.sectionHeader,children:e.toUpperCase()}),t]})}function sm({status:e}){let t="open"===e?{backgroundColor:a(632079).Tj.orange.background.primary,color:a(632079).Tj.orange.text.accentPrimary}:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary};return(0,d.jsx)("span",{style:{...sd.statusBadge,...t},children:iU(e)})}function su({invoice:e,isLast:t}){let i=[];return e.created_at&&i.push(`Created ${e.created_at}`),e.due_date&&i.push(`Due ${e.due_date}`),e.next_payment_attempt&&i.push(`Next attempt ${e.next_payment_attempt}`),e.attempted||i.push("Not yet attempted"),(0,d.jsxs)("div",{style:t?sd.invoiceRowLast:sd.invoiceRow,children:[(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(sm,{status:e.status}),(0,d.jsx)("span",{style:sd.invoiceAmountDue,children:`${e.amount_due} due`}),e.amount_remaining!==e.amount_due?(0,d.jsx)("span",{style:{color:a(632079).oZ.mediumTextColor},children:`(${e.amount_remaining} remaining)`}):null,(0,d.jsx)("a",{href:e.url,target:"_blank",rel:"noreferrer",style:sd.invoiceLink,children:"View invoice →"})]}),i.length>0?(0,d.jsx)("div",{style:sd.invoiceMeta,children:i.join(" · ")}):null]})}function sh({space:e}){let t=e.name??`Workspace ${e.id}`,i=e.open_invoices??[],n=i.length>0,r=e.payment_method,s=null!=r&&r.brand&&null!=r&&r.last4?`${r.brand} \xb7\xb7\xb7\xb7${r.last4}`:null!=r&&r.last4?`\xb7\xb7\xb7\xb7${r.last4}`:"—",o=e.overdue?{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary}:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.accentPrimary}
101,l=e.overdue?"Overdue":"Up to date",c=e.grace_period_days_left,p=void 0===c?void 0:c<=5?{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.medium}:c<=14?{color:a(632079).Tj.orange.text.accentPrimary,fontWeight:a(699422).Wy.medium}:{color:a(632079).oZ.mediumTextColor};return(0,d.jsxs)("div",{style:sd.card,children:[(0,d.jsx)("div",{style:sd.spaceCardHeader,children:t}),(0,d.jsxs)(sp,{title:"Billing Status",children:[(0,d.jsx)(sc,{label:"Status",value:(0,d.jsx)("span",{style:{...sd.statusBadge,...o},children:l})}),(0,d.jsx)(sc,{label:"Grace period",value:e.overdue&&void 0!==c?(0,d.jsx)("span",{style:p,children:`${c} day(s) remaining before downgrade`}):"—"}),(0,d.jsx)(sc,{label:"Payment method",value:s}),(0,d.jsx)(sc,{label:"Account balance",value:e.accountBalance||"—",isLast:!n})]}),n?(0,d.jsx)(sp,{title:`Open Invoices — Stripe status: open (${i.length})`,isLast:!0,children:i.map((e,t)=>(0,d.jsx)(su,{invoice:e,isLast:t===i.length-1},e.id))}):null]})}let sy=["id","timestamp","action","adminUserId","adminEmail","mode","spaceIds","amount","source","startDate","endDate","reason","didWrite"],sg=(0,a(327219).YK)({title:{id:"adminPromotionalCreditGrantAuditLog.title",defaultMessage:"Promotional Credit Audit Log"},entryCount:{id:"adminPromotionalCreditGrantAuditLog.entryCount",defaultMessage:"Showing {count, plural, one {# entry} other {# entries}} from <logTable>admin_api_log</logTable>."},emptyState:{id:"adminPromotionalCreditGrantAuditLog.emptyState",defaultMessage:"No matching promotional credit audit entries."},showActionsWithNoChanges:{id:"adminPromotionalCreditGrantAuditLog.showActionsWithNoChanges",defaultMessage:"Show actions that made no changes"},actionFilterLabel:{id:"adminPromotionalCreditGrantAuditLog.actionFilter.label",defaultMessage:"Action"},allActions:{id:"adminPromotionalCreditGrantAuditLog.actionFilter.all",defaultMessage:"All"},whenHeader:{id:"adminPromotionalCreditGrantAuditLog.column.when",defaultMessage:"When"},actionHeader:{id:"adminPromotionalCreditGrantAuditLog.column.action",defaultMessage:"Action"},adminHeader:{id:"adminPromotionalCreditGrantAuditLog.column.admin",defaultMessage:"Admin"},spaceIdsHeader:{id:"adminPromotionalCreditGrantAuditLog.column.spaceIds",defaultMessage:"spaceIds"},creditsHeader:{id:"adminPromotionalCreditGrantAuditLog.column.credits",defaultMessage:"Credits"},sourceHeader:{id:"adminPromotionalCreditGrantAuditLog.column.source",defaultMessage:"Source"},startDateHeader:{id:"adminPromotionalCreditGrantAuditLog.column.startDate",defaultMessage:"Start date"},endDateHeader:{id:"adminPromotionalCreditGrantAuditLog.column.endDate",defaultMessage:"End date"},reasonHeader:{id:"adminPromotionalCreditGrantAuditLog.column.reason",defaultMessage:"Reason"},noCreditsGranted:{id:"adminPromotionalCreditGrantAuditLog.noCreditsGranted",defaultMessage:"No changes made"},grantAction:{id:"adminPromotionalCreditGrantAuditLog.action.grant",defaultMessage:"Grant"},revokeAction:{id:"adminPromotionalCreditGrantAuditLog.action.revoke",defaultMessage:"Revoke"},rawResponse:{id:"adminPromotionalCreditGrantAuditLog.rawResponse",defaultMessage:"Raw response"},downloadCsv:{id:"adminPromotionalCreditGrantAuditLog.downloadCsv",defaultMessage:"Download CSV"},remainingWorkspaceCount:{id:"adminPromotionalCreditGrantAuditLog.remainingWorkspaceCount",defaultMessage:"+{count, plural, one {# more space ID} other {# more space IDs}}"},allSpaceIds:{id:"adminPromotionalCreditGrantAuditLog.allSpaceIds",defaultMessage:"All space IDs ({count})"},showAllSpaceIds:{id:"adminPromotionalCreditGrantAuditLog.showAllSpaceIds",defaultMessage:"Show all {count} space IDs"},copyAllSpaceIds:{id:"adminPromotionalCreditGrantAuditLog.copyAllSpaceIds",defaultMessage:"Copy all"},copyAllSpaceIdsAriaLabel:{id:"adminPromotionalCreditGrantAuditLog.copyAllSpaceIdsAriaLabel",defaultMessage:"Copy all {count} space IDs"},missingValue:{id:"adminPromotionalCreditGrantAuditLog.missingValue",defaultMessage:"—"}}),sx={container:{maxWidth:1200},containerInner:{display:"flex",flexDirection:"column",gap:8},sectionTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:4,marginTop:8},tableWrapper:{overflowX:"auto"},toolbar:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},table:{width:"100%",minWidth:1600,borderCollapse:"collapse"},th:{textAlign:"start",padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,fontWeight:a(699422).Wy.semibold,whiteSpace:"nowrap"},td:{textAlign:"start",padding:"6px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top"},mono:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},emptyState:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,textAlign:"center"},failedRow:{opacity:.6},rejectedTag:{fontStyle:"italic",marginTop:2},spaceIdsPopup:{width:360,padding:8},spaceIdsPopupList:{maxHeight:240,overflowY:"auto",marginTop:6},nowrap:{whiteSpace:"nowrap"},summary:{cursor:"pointer",marginTop:8,marginBottom:4},detailsBody:{marginTop:8}};function sf(e){let t=(0,a(327219).tz)();return(0,d.jsx)("th",{style:sx.th,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"secondary",children:t.formatMessage(e.message)})})}
101function sb(e){let{spaceIds:t}=e,i=(0,a(327219).tz)();if(0===t.length)return(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:i.formatMessage(sg.missingValue)});let n=t.slice(0,3),r=t.length-n.length,s=t.join("\n");return(0,d.jsxs)("div",{children:[n.map(e=>(0,d.jsx)("div",{style:sx.mono,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:e})},e)),t.length>1?(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",marginTop:2,children:[r>0?(0,d.jsx)(a(656252).d,{popupType:a(656252).z.Popup,placementToOrigin:"bottom",alignmentToOrigin:"start",originGap:4,content:()=>(0,d.jsxs)("div",{style:sx.spaceIdsPopup,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",children:i.formatMessage(sg.allSpaceIds,{count:t.length})}),(0,d.jsx)("div",{style:sx.spaceIdsPopupList,children:t.map(e=>(0,d.jsx)("div",{style:sx.mono,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:e})},e))})]}),children:e=>(0,d.jsx)(a(988022).p,{...e,size:"sm",ariaLabel:i.formatMessage(sg.showAllSpaceIds,{count:t.length}),children:i.formatMessage(sg.remainingWorkspaceCount,{count:r})})}):void 0,(0,d.jsx)(a(799615).B,{value:s,ariaLabel:i.formatMessage(sg.copyAllSpaceIdsAriaLabel,{count:t.length}),children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.formatMessage(sg.copyAllSpaceIds)})})]}):void 0]})}function sv(e,t){return e.formatDate(t,{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function sj(e,t){if(void 0===t)return e.formatMessage(sg.missingValue);let a=new Date(t);return Number.isNaN(a.getTime())?t:sv(e,a.getTime())}let sk={adminAllowlistCreditDomain:{apiName:"adminAllowlistCreditDomain",emoji:"🚩",description:"Add a domain name to allowlist for credits.",schema:{domain:{type:"string"}}},adminCancelSubscription:{apiName:"adminCancelSubscription",emoji:"😢",description:"Cancel one workspace subscription, or cancel up to 100 workspace or orphaned Stripe subscriptions from CSV.",schema:{mode:{type:"options",options:[{displayName:"Single workspace",value:"single"},{displayName:"CSV upload",value:"bulk"}],defaultValue:"single",isRequired:!0},spaceId:{type:"string",table:"space",visibleWhen:{field:"mode",value:"single"},isRequired:!0},csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:"CSV with WORKSPACE_ID and/or SUBSCRIPTION_ID columns. Each row needs exactly one: a WORKSPACE_ID, or a SUBSCRIPTION_ID for a subscription not associated with a workspace. Maximum 100 rows.",visibleWhen:{field:"mode",value:"bulk"},isRequired:!0},cancelImmediately:{type:"boolean",comment:"If unchecked, the user will still be subscribed until the end of the current billing period. If checked, the user will lose access to their subscription immediately"},dryRun:{type:"boolean",name:"Dry run",defaultValue:!0,comment:"Preview CSV results without releasing schedules, updating subscriptions, or cancelling subscriptions.",visibleWhen:{field:"mode",value:"bulk"}}},isDestructive:!0},adminReleaseSubscriptionSchedule:{apiName:"adminReleaseSubscriptionSchedule",description:"This tool will cancel all the pending changes currently associated with the workspace's subscription.",emoji:"🤖",schema:{spaceId:{type:"string",table:"space"}},isDestructive:!0},adminDowngradeFraudSubscription:{apiName:"adminDowngradeFraudSubscription",description:"This tool will downgrade a subscription to a free subscription, clear their balance if they have a negative balance, and ensure they aren't using send_invoice as a billing method. Please be careful when using this and make sure you have gotten approval to downgrade a customer.",emoji:"⬇",schema:{spaceId:{type:"string",table:"space"},reason:{type:"string",comment:"Reason for downgrading the customer, e.g. ach_abuse, credit_abuse, or other"},description:{type:"string",comment:"Any additional info that might be helpful if we need to investigate this subscription."}},isDestructive:!0},adminGetBillingHistory:{apiName:"adminGetBillingHistory",emoji:"📜",customResponseRenderer:function({data:e}){let[t,i]=(0,r.useState)(0),{events:n,reachedEndOfResults:s}=e;if(0===n.length&&s)return(0,d.jsx)(a(553775).i$,{warnings:["No billing history found for this space."]});let o=0===n.length?"Billing History":`Billing History (${n.length} invoice${1===n.length?"":"s"})`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:se.pageHeader,children:o}),(0,d.jsx)("div",{style:se.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:t,onChange:i})}),0===t?(0,d.jsxs)(d.Fragment,{children:[n.map((e,t)=>(0,d.jsx)(si,{event:e,isLast:t===n.length-1},e.id)),s?null:(0,d.jsx)("div",{style:se.truncationFooter,children:0===n.length?"Response was truncated — toggle to JSON for the raw response, or increase the limit to see invoices.":`Showing the most recent ${n.length} invoices — older invoices may exist.`})]}):(0,d.jsx)(a(503270).H,{data:e,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]})},schema:{spaceId:{type:"string",table:"space"},limit:{type:"number",defaultValue:100}}},adminGetUserBillingInformation:{apiName:"adminGetUserBillingInformation",displayName:"Find User's Billing Information",emoji:"🔎",description:"Fill out just one of the fields below. Returns the open invoices and billing info for the user.",customResponseRenderer:function({data:e}){let t=Object.values(e.paid_spaces),[i,n]=(0,r.useState)(0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:sd.pageHeader,children:`Billing Information for ${e.name??e.email}`}),(0,d.jsx)(a(111010).D,{styleKey:"body",colorVariant:"secondary",children:`Email: ${e.email} \xb7 User ID: ${e.id}`}),(0,d.jsx)("div",{style:sd.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:i,onChange:n})}),0===i?0===t.length?(0,d.jsx)(a(553775).i$,{warnings:["No paid workspaces found for this user."]}):t.map(e=>(0,d.jsx)(sh,{space:e},e.id)):(0,d.jsx)(a(503270).H,{data:e,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]})},schema:{userId:{type:"string",table:s().oo9},userEmail:{type:"string"}}},adminManageNonprofitOffer:{apiName:"adminManageNonprofitOffer",displayName:"Manage nonprofit discounts",emoji:"💝",description:"Grant or revoke the verification-backed 50% nonprofit discount for one workspace or up to 100 workspaces from CSV. Grants apply immediately to active Business subscriptions or appear at checkout for free and Plus workspaces.",schema:{mode:{type:"options",options:[{displayName:"Single workspace",value:"single"},{displayName:"CSV upload",value:"bulk"}],defaultValue:"single",required:!0,isRequired:!0},spaceId:{type:"string",table:"space",visibleWhen:{field:"mode",value:"single"},isRequired:!0},csv:{type:"file",name:"csv",comment:"column must be WORKSPACE_ID; maximum 100 rows",visibleWhen:{field:"mode",value:"bulk"},isRequired:!0},operation:{type:"options",options:["grant","revoke"],required:!0,isRequired:!0}},isDestructive:!0},adminBulkApplyPromotionCodes:{apiName:"adminBulkApplyPromotionCodes",emoji:"🎁",description:"",schema:{csv:{type:"file",name:"csv",comment:"columns must be DOMAIN and PROMO_CODE"}}},adminBulkUpgradeEduPlusUser:{apiName:"adminBulkUpgradeEduPlusUser",dis
101playName:"Bulk apply Edu Plus plan",emoji:"🎒",description:"Bulk upgrade edu users to Edu Plus plan",schema:{csv:{type:"file",name:"csv",comment:"column must be WORKSPACE_ID"}}},adminBulkCreateTimedTrials:{apiName:"adminBulkCreateTimedTrials",displayName:"Startup Program Only: TTs",emoji:"🕰",description:"Only authorized Startup Program members should use this tool to provision 3m, 6m, or 12m TTs. Spaces must not be on a paid plan already.",schema:{period:{type:"options",options:a(848003).wJ},csv:{type:"file",name:"csv",comment:"Startup Workspace CSVs. List of domains, csv should have a single column DOMAIN"}}},adminBulkProvisionMarketingTrials:{apiName:"adminBulkProvisionMarketingTrials",displayName:"Bulk Provision Business Trials for Marketing",emoji:"📈",description:"Provision Business plan trials for workspaces. Upload CSV with WORKSPACE_ID column. Free workspaces and active Plus subscriptions are eligible. Trialing and Business or higher workspaces are skipped; other subscription states return an error.",schema:{trialType:{type:"options",options:[...a(848003).yg],comment:"Select the trial type to provision"},csv:{type:"file",name:"csv",comment:"CSV with WORKSPACE_ID column"}}},adminGrantPromotionalNotionCredits:{apiName:"adminGrantPromotionalNotionCredits",displayName:"Grant promotional Notion credits",emoji:"🎟️",isDestructive:!0,csvDownloadSuccessMessage:"Request complete — check the downloaded CSV for full results",description:(0,d.jsxs)(d.Fragment,{children:["Grant time-bound, free Notion credits to one or more workspaces for an internal program.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Every workspace in a submission gets the same amount of credits for the same time window. Source is used to attribute the resulting AI spend.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Workspaces must already be able to use Notion credits — self-serve Business or Enterprise, including trials; sales-assisted workspaces are rejected.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"A workspace is skipped when an active or future grant with the same source already exists."]}),schema:{mode:{type:"options",options:[{displayName:"Single workspace",value:"single"},{displayName:"CSV upload",value:"bulk"}],defaultValue:"single",isRequired:!0},spaceId:{type:"string",table:"space",visibleWhen:{field:"mode",value:"single"},isRequired:!0},csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:"CSV with a WORKSPACE_ID column. Maximum 200 rows at once.",visibleWhen:{field:"mode",value:"bulk"},isRequired:!0},amount:{type:"number",numberType:"integer",min:1,comment:"Notion credits to grant each workspace.",isRequired:!0},startDate:{type:"datetimeISO",name:"Start",defaultValue:a(120011).DateTime.local().startOf("hour").toUTC().toISO(),comment:"Defaults to the current hour. Metronome commit will begin at the start of this hour."},endDate:{type:"datetimeISO",name:"End",defaultValue:a(120011).DateTime.local().startOf("hour").plus({days:1}).toUTC().toISO(),comment:"When the credits stop being spendable. Must be in the future. Metronome commit will end at the start of this hour.",isRequired:!0},source:{type:"promotionalCreditSource",name:"Source (program)",comment:"The program this grant's Notion credit spend is attributed to. Managed in admin_tool_source_options in the additional_program_credits_config Statsig config.",isRequired:!0},reason:{type:"string",comment:"Why the grant was made (required). Recorded in the audit log."}}},adminRevokePromotionalNotionCredits:{apiName:"adminRevokePromotionalNotionCredits",displayName:"Revoke promotional Notion credits",emoji:"🎟️",availableEnvironments:["local","development","staging"],isDestructive:!0,csvDownloadSuccessMessage:"Request complete — check the downloaded CSV for full results",description:(0,d.jsxs)(d.Fragment,{children:["Revoke active or future promotional Notion credits from one or more workspaces for an internal program.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Active grants end at the start of the current hour. Future grants are archived."]}),schema:{mode:{type:"options",options:[{displayName:"Single workspace",value:"single"},{displayName:"CSV upload",value:"bulk"}],defaultValue:"single",isRequired:!0},spaceId:{type:"string",table:"space",visibleWhen:{field:"mode",value:"single"},isRequired:!0},csv:{type:"file",name:"CSV",acceptedFileExtensions:".csv",comment:"CSV with a WORKSPACE_ID column. Maximum 200 rows at once.",visibleWhen:{field:"mode",value:"bulk"},isRequired:!0},source:{type:"promotionalCreditSource",name:"Source (program)",comment:"The program whose promotional Notion credit grants should be revoked.",isRequired:!0},reason:{type:"string",comment:"Why the grant is being revoked (required). Recorded in the audit log."}}},adminGetPromotionalCreditGrantAuditLog:{apiName:"adminGetPromotionalCreditGrantAuditLog",displayName:"Promotional Credit Audit Log",emoji:"🧾",isDestructive:!1,description:(0,d.jsxs)(d.Fragment,{children:["View audit-log entr
101ies for the promotional Notion credit grant and revoke tools.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Reads from the existing admin API log, surfacing the admin user, the action, timestamp, and request params for each call. All filters are optional — leave blank to see the most recent entries.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"The workspace filter covers both single and CSV grants. To confirm what a workspace currently holds rather than what was granted, use the AI Credit Usage Lookup."]}),customResponseRenderer:function(e){let{data:t}=e,{entries:i}=t,n=(0,a(327219).tz)(),s=n.formatMessage(sg.missingValue),[o,l]=(0,r.useState)(!1),[c,p]=(0,r.useState)("all"),m=i.filter(e=>(o||e.didWrite)&&("all"===c||e.action===c)),u=(0,r.useCallback)(()=>{l(e=>!e)},[]),h="all"===c?n.formatMessage(sg.allActions):n.formatMessage("grant"===c?sg.grantAction:sg.revokeAction),y=(0,r.useCallback)(e=>[{key:"action-filter",items:[{value:"all",label:n.formatMessage(sg.allActions)},{value:"grant",label:n.formatMessage(sg.grantAction)},{value:"revoke",label:n.formatMessage(sg.revokeAction)}].map(t=>({key:t.value,action:()=>{e.close(),p(t.value)},render:e=>(0,d.jsx)(a(95582).A,{...e,title:t.label,isChecked:c===t.value})}))}],[c,n]),g=(0,r.useCallback)(()=>{var e,t;let i,n,r,s;e=(i=m.map(e=>{var t;return[e.id,new Date(e.timestamp).toISOString(),e.action,e.adminUserId,(null==(t=e.adminUser)?void 0:t.email)??"",e.mode??"",e.spaceIds.join(","),e.amount??"",e.source??"",e.startDate??"",e.endDate??"",e.reason??"",e.didWrite]}),(0,a(318851).A)([sy,...i],{escape_formulas:!0})),t="promotional-credit-audit-log.csv",n=new Blob([e],{type:"text/csv;charset=utf-8;"}),r=URL.createObjectURL(n),(s=document.createElement("a")).href=r,s.download=t,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(r)},[m]);return(0,d.jsxs)("div",{style:{...sx.container,...sx.containerInner},children:[(0,d.jsx)("div",{style:sx.sectionTitle,children:(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:n.formatMessage(sg.title)})}),(0,d.jsxs)("div",{style:sx.toolbar,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:(0,d.jsx)(a(327219).sA,{...sg.entryCount,values:{count:m.length,logTable:e=>(0,d.jsx)("code",{children:e})}})}),(0,d.jsx)(a(548436).A,{size:"sm",iconLeading:a(782558)._,disabled:0===m.length,onClick:g,children:n.formatMessage(sg.downloadCsv)})]}),(0,d.jsxs)(a(4458).fI,{gap:12,alignItems:"center",children:[(0,d.jsx)(a(543313).A,{label:n.formatMessage(sg.actionFilterLabel),selectedTitle:h,menuWidth:160,renderMenuSections:y}),(0,d.jsxs)(a(4458).fI,{as:"label",gap:6,alignItems:"center",children:[(0,d.jsx)(a(382726).S,{checked:o,size:16,onClick:u}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n.formatMessage(sg.showActionsWithNoChanges)})]})]}),0===m.length?(0,d.jsx)("div",{style:sx.emptyState,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:n.formatMessage(sg.emptyState)})}):(0,d.jsx)("div",{style:sx.tableWrapper,children:(0,d.jsxs)("table",{style:sx.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)(sf,{message:sg.whenHeader}),(0,d.jsx)(sf,{message:sg.actionHeader}),(0,d.jsx)(sf,{message:sg.adminHeader}),(0,d.jsx)(sf,{message:sg.spaceIdsHeader}),(0,d.jsx)(sf,{message:sg.creditsHeader}),(0,d.jsx)(sf,{message:sg.sourceHeader}),(0,d.jsx)(sf,{message:sg.startDateHeader}),(0,d.jsx)(sf,{message:sg.endDateHeader}),(0,d.jsx)(sf,{message:sg.reasonHeader})]})}),(0,d.jsx)("tbody",{children:m.map(e=>{var t,i,r,o;let l=(null==(t=e.adminUser)?void 0:t.email)??e.adminUserId,c=!e.didWrite;return(0,d.jsxs)("tr",{style:c?sx.failedRow:void 0,children:[(0,d.jsxs)("td",{style:{...sx.td,...sx.nowrap},children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:sv(n,e.timestamp)}),c?(0,d.jsx)("div",{style:sx.rejectedTag,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n.formatMessage(sg.noCreditsGranted)})}):void 0]}),(0,d.jsx)("td",{style:{...sx.td,...sx.nowrap},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:n.formatMessage("grant"===e.action?sg.grantAction:sg.revokeAction)})}),(0,d.jsxs)("td",{style:sx.td,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:l}),null!=(i=e.adminUser)&&i.email?(0,d.jsx)("div",{style:sx.mono,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:e.adminUserId})}):void 0]}),(0,d.jsx)("td",{style:sx.td,children:(0,d.jsx)(sb,{spaceIds:e.spaceIds})}),(0,d.jsx)("td",{style:sx.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:(r=n,void 0===(o=e.amount)?r.formatMessage(sg.missingValue):r.formatNumber(o,{maximumFractionDigits:0,roundingMode:"trunc"}))})}),(0,d.jsx)("td",{style:{...sx.td,...sx.nowrap},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:e.source??s})}),(0,d.jsx)("td",{style:{...sx.td,...sx.nowrap},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:sj(n,e.startDate)})}),(0,d.jsx)("td",{style:{...sx.td,...sx.nowrap},children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:sj(n,e.endDate)})}),(0,d.jsx)("td",{style:sx.td,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:e.reason??s})})]},e.id)})})]})}),(0,d.jsxs)("details",{children:[(0,d.jsx)("summary",{style:sx.summary,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",children:n.formatMessage(sg.rawResponse)})}),(0,d.jsx)("div",{style:sx.detailsBody,children:(0,d.jsx)(a(243119).A,{data:t})})]})]})},schema:{adminUserId:{type:"string",table:s().oo9,comment:"Optional: filter to a specific admin user"},spaceId:{type:"string",table:"space",comment:"Optional: filter to grants that affected this workspace"},source:{type:"promotionalCreditSource",name:"Source (program)",comment:"Optional: filter to grants attributed to this source program"},startDate:{type:"datetimeISO",comment:"Optional: only include entries on or after this time"},endDate:{type:"datetimeISO",comment:"Optional: only include entries on or before this time"},limit:{type:"number",numberType:"integer",min:1,max:500,defaultValue:100,comment:"Max rows to return. Defaults to 100, max 500."}}},allowEducationEmails:{apiName:"allowEducationEmails",emoji:"📚",description:"Add email domains and/or addresses that are allowed to get free Education plan. Please provide either a list or a CSV.",schema:{allow:{type:"string",comment:"Comma-separated emails and domains to allow, e.g. clownschool.ca, [email protected], strandford.edu, [email protected]",placeholder:a(591977).I3},csv:{type:"file",name:"csv",comment:"CSV must have a column named Domain. Domain must be a comma separated list of domains, e.g 'wharton.upenn.edu,seas.upenn.edu' or 'penn.edu'. Emails are not supported."}}},adminRemoveAllowedEducationEmails:{apiName:"adminRemoveAllowedEducationEmails",emoji:"🧑",description:"Remove email domains and/or addresses that are allowed to get free Education plan. Please provide either a list or a CSV.",schema:{toRemove:{type:"string",comment:"Comma-separated emails and domains to remove, e.g. clownschool.ca, [email protected], strandford.edu, [email protected]",placeholder:a(591977).I3},csv:{type:"file",name:"csv",comment:"CSV must have a column named Domain. Domain must be a comma separated list of domains, e.g 'wharton.upenn.edu,seas.upenn.edu' or 'penn.edu'. Emails are not supported."}}},getPromoCode:{apiName:"getPromoCode",emoji:"🆓",description:"Get information on a Stripe coupon code.",customResponseRenderer:function({data:e}){let[t,i]=(0,r.useState)(0),{promo:n}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:sn.pageHeader,children:"Promo Code"}),(0,d.jsx)("div",{style:sn.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:t,onChange:i})}),0===t?void 0===n?(0,d.jsx)(a(553775).i$,{warnings:["No promo code found."]}):(0,d.jsx)(sl,{promo:n}):(0,d.jsx)(a(503270).H,{data:e,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]})},schema:{code:{type:"string"}}},getOfferCodeValue:{apiName:"getOfferCodeValue",emoji:"🔍",description:"Look up offer code values by campaign and code",isDestructive:!1,schema:{campaign:{type:"string",comment:"The campaign name for the offer code"},code:{type:"string",comment:"The offer code to look up",placeholder:"myOfferCode",skipUUIDNormalization:!0}}},adminGetOfferEligibility:{apiName:"adminGetOfferEligibility",emoji:"✅",description:"Check offer eligibility for a 
101workspace. By default, uses a workspace owner as the user with which to check eligibility. Note, if a given workspace / user is eligible for an offer, the user still needs to be in the right in-app entrypoint to claim the offer, which will differ between offers.",isDestructive:!1,schema:{workspaceId:{type:"string",comment:"The workspace ID to check eligibility for"},offerCampaign:{type:"options",options:Object.keys(a(848003).bC),comment:"The offer campaign to check"},userId:{type:"string",comment:"Optional user ID to use for eligibility check (if not provided, uses a workspace owner)"},countryCode:{type:"string",comment:"Optional country code to use for eligibility check"},offerCode:{type:"string",comment:"Optional offer code (if required by the offer campaign)",skipUUIDNormalization:!0},deviceId:{type:"string",comment:"Optional device ID (if required by the offer campaign)"}}},adminGetAllEligibleOffers:{apiName:"adminGetAllEligibleOffers",displayName:"Get All Eligible Offers",emoji:"🎁",description:"Returns all eligible and claimed offers for a workspace. By default, uses a workspace owner as the user with which to check eligibility.",isDestructive:!1,customResponseRenderer:function({data:e}){let[t,i]=(0,r.useState)(0),{eligibleOffers:n,claimedOffers:s,totalOffersChecked:o}=e;if(0===n.length&&0===s.length)return(0,d.jsx)(a(553775).i$,{warnings:[`No eligible or claimed offers found (checked ${o} offers).`]});let l=n.map(r4),c=s.map(r2);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:rY.pageHeader,children:"Workspace Offers"}),(0,d.jsx)("div",{style:rY.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:t,onChange:i})}),0===t?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:rY.sectionHeader,children:`Eligible (${l.length})`}),0===l.length?(0,d.jsx)("div",{style:rY.emptySectionNote,children:"No offers this workspace is currently eligible for."}):l.map((e,t)=>(0,d.jsx)(r8,{offer:e,isLast:t===l.length-1},`eligible-${e.campaign}-${t}`)),(0,d.jsx)("div",{style:rY.sectionHeader,children:`Claimed (${c.length})`}),0===c.length?(0,d.jsx)("div",{style:rY.emptySectionNote,children:"This workspace has not claimed any offers."}):c.map((e,t)=>(0,d.jsx)(r5,{claimed:e,isLast:t===c.length-1},`claimed-${e.offer.campaign}-${t}`)),(0,d.jsx)("div",{style:rY.footer,children:`Checked ${o} offer campaign${1===o?"":"s"} total.`})]}):(0,d.jsx)(a(503270).H,{data:e,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]})},schema:{spaceId:{type:"string",comment:"The workspace ID to check eligibility for"},userId:{type:"string",comment:"Optional user ID to use for eligibility check (if not provided, uses a workspace owner)"}}},adminGetBulkOfferEligibility:{apiName:"adminGetBulkOfferEligibility",displayName:"Get Bulk Offer Eligibility",emoji:"📋",description:"Check offer eligibility for multiple workspaces and campaigns. Returns a CSV with eligibility status and ineligibility reasons. WARNING: USING THIS TOOL WILL RESULT IN STATSIG EXPERIMENT EXPOSURES. MAKE SURE THE OFFER CAMPAIGNS YOU QUERY DO NOT USE A STATSIG EXPERIMENT.",isDestructive:!1,schema:{csv:{type:"file",name:"csv",comment:"CSV must have a column named WORKSPACE_ID"},offerCampaigns:{type:"string",comment:"Comma-separated list of offer campaign IDs to check (e.g. mwn_business_reverse_14d,custom_agents_business_reverse_1m)"}}},adminCleanupDuplicateOfferStatuses:{apiName:"adminCleanupDuplicateOfferStatuses",displayName:"Cleanup Duplicate Offer Statuses",emoji:"🧹",description:"Cleans up duplicate offer_status records for a workspace. Keeps the record with the most recent end_date_ms (or oldest created_time as tiebreaker). Use dryRun to preview changes.",isDestructive:!0,schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to cleanup duplicates for"},dryRun:{type:"boolean",defaultValue:!0,comment:"If true, returns what would be deleted without actually deleting"}}},adminBulkAddPromotionCodes:{apiName:"adminBulkAddPromotionCodes",emoji:"🆓",description:"Adds Promotion codes to an existing Stripe coupon.",schema:{coupon:{type:"string",comment:"The id of the coupon in Stripe"},codes:{type:"string",comment:"Comma-separated list of promotion codes"},expirationDate:{type:"string",comment:"Should be in the format Month-Day-Year (eg. 03-30-1993)"}}},adminPartnerStackFixMissingProductKeys:{apiName:"adminPartnerStackFixMissingProductKeys",emoji:"📖",description:"For Affiliate Monthly Rewards Check for Missing Product Key Issue",schema:{csv:{type:"file",name:"csv",comment:"CSV with list of PartnerStack transactions"},columnName:{type:"string",comment:"Name of column with PartnerStack transaction keys"}}},adminBulkAddEduUniversitiesAndDomains:{apiName:"adminBulkAddEduUniversitiesAndDomains",description:"Upload the FULL LIST of university names and domains that are eligible for student individual plans and student org plans. This will over
101write the existing list.",displayName:"Reset Education Universities and Domains",emoji:"🎓",schema:{csv:{type:"file",name:"csv",comment:"CSV must have these two columns: University, Domain. University is the name of the school that will be displayed in the student form, and Domain should be a comma separated list of domains, e.g 'wharton.upenn.edu,seas.upenn.edu' or 'upenn.edu'. Please make sure there is ONE ROW PER UNIVERSITY."}}},adminSyncBillingState:{apiName:"adminSyncBillingState",displayName:"Sync Remote Billing State",emoji:"🔁",description:"Sync the remote billing account state (Stripe or RevenueCat) to DB. If input given through CSV, it must have the column SPACE_ID.",schema:{csv:{type:"file",name:"csv"},spaceId:{type:"string"},downloadCsv:{type:"boolean",name:"Automatically download CSV",defaultValue:!1,comment:"Turn on to download sync results as a CSV instead of viewing them in the admin tool."}}},adminGetSubscriptionBannerState:{apiName:"adminGetSubscriptionBannerState",displayName:"View Subscription Banner State",emoji:"🚩",description:"View current subscription banner state for a workspace",schema:{spaceId:{type:"string",table:"space"},customerId:{type:"string",placeholder:a(591977).cs}}},adminGetUnrepresentableState:{apiName:"adminGetUnrepresentableState",displayName:"Check if a subscription is in an invalid, unrepresentable state.",emoji:"🔎",description:"Enter in the customerId. Returns information about whether the subscription is unrepresentable, and why.",schema:{stripeCustomerId:{type:"string",placeholder:a(591977).cs}}},adminSetHighWaterMark:{apiName:"adminSetHighWaterMark",displayName:"Set the high water mark of a subscription.",emoji:"🔎",description:"Set the high water mark of a subscription. Takes in either Space Id or Stripe Customer Id, and either New High Water Mark or set Set To Current Number Of Users to True. Does not create an invoice - Must be done manually.",schema:{spaceId:{type:"string",table:"space"},stripeCustomerId:{type:"string",placeholder:a(591977).cs},newHighWaterMark:{type:"number"},setToCurrentNumberOfUsers:{type:"boolean"}}},listPrices:{apiName:"listPrices",emoji:" 🏷",description:"Get list of prices visible to a given space",schema:{spaceId:{type:"string"},countryCode:{type:"string",comment:"(Optional) ISO country code"}}}},sS={cursor:"pointer",display:"flex",alignItems:"center",gap:4,background:"none",border:"none",padding:0},sw={marginTop:8},sI={backgroundColor:"#f5f5f5",padding:12,borderRadius:4,overflow:"auto",maxHeight:500},sC={adminCallPublicApi:{apiName:"adminCallPublicApi",displayName:"Call Public API Endpoint",description:"Make a Public API request on behalf of a bot for debugging. Supports all GET requests and read-only POST endpoints like `/v1/search`, plus the version-appropriate database query endpoint.",emoji:"🔧",isDestructive:!1,customResponseRenderer:function({data:e}){let{httpStatus:t,headers:i,body:n,timingMs:s}=e,[o,l]=(0,r.useState)(!1),c=(0,a(419681).$l)(n),p=void 0!==c,m=p&&c&&"object"==typeof c&&"message"in c?String(c.message):"Unknown error";return(0,d.jsxs)(a(4458).VP,{gap:16,children:[(0,d.jsxs)(a(4458).fI,{gap:16,alignItems:"center",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"HTTP Status"}),(0,d.jsx)(a(111010).D,{styleKey:"titleXlBold",...t>=200&&t<300?{colorPalette:"teal",colorVariant:"accentPrimary"}:t>=400&&t<500?{colorPalette:"orange",colorVariant:"accentPrimary"}:t>=500?{colorPalette:"red",colorVariant:"accentPrimary"}:{colorVariant:"secondary"},children:t})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a(324489).V,{isSmall:!0,children:"Response Time"}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:`${s}ms`})]})]}),t>=400&&p?(0,d.jsx)(a(553775).i$,{warnings:[`Public API Error: ${m}`]}):void 0,(0,d.jsxs)("div",{children:[(0,d.jsx)("button",{type:"button",style:sS,onClick:()=>l(!o),children:(0,d.jsxs)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:[o?"▼":"▶"," Response Headers"]})}),o?(0,d.jsx)("div",{style:sw,children:(0,d.jsx)(a(243119).A,{data:i,hideHelp:!0})}):void 0]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:"Response Body"}),(0,d.jsx)("div",{style:sw,children:p&&"object"==typeof c&&null!==c?(0,d.jsx)(a(243119).A,{data:c,hideHelp:!0}):(0,d.jsx)("pre",{style:sI,children:n})})]})]})},schema:{botId:{type:"string",name:"Bot ID",table:"bot",comment:"Bot ID to use for the request. Use other Admin tools (e.g. 'List bots in space') to look up relevant API bots for a space and/or user."}
101,httpMethod:{type:"options",name:"HTTP Method",options:["GET","POST"],defaultValue:"GET",comment:"HTTP method. POST is only allowed for read-only endpoints like `/v1/search`, `/v1/databases/{id}/query` before 2025-09-03, and `/v1/data_sources/{id}/query` for 2025-09-03 and later."},path:{type:"string",placeholder:"/v1/pages/{page_id}",comment:"Public API path including any path parameters (e.g. /v1/users/me)"},notionVersion:{type:"options",name:"Notion Version",options:[...a(623644).tw].reverse(),defaultValue:a(623644).h9,comment:`Notion-Version header. Use latest (${a(623644).h9}) unless debugging older version.`},queryParams:{type:"string",name:"Query Params",placeholder:'{"filter_properties": ["abc123"]}',comment:'(Optional) Query parameters as JSON object, e.g. {"page_size": 100}'},requestBody:{type:"string",name:"Request Body",placeholder:'{"query": "search term", "filter": {...}}',comment:"(POST only) Request body as JSON object. Required for POST endpoints."}}},adminGetExternalConnectionInfo:{apiName:"adminGetExternalConnectionInfo",displayName:"Get External Connection Info",description:"Look up external connection metadata (without secrets) by ID, or find connections for a workflow/module.",emoji:"🔗",isDestructive:!1,schema:{spaceId:{type:"string",table:"space",comment:"(Recommended) Space ID for faster lookup, skips record-to-space resolution."},externalConnectionId:{type:"string",table:s().Klg,comment:"Direct lookup by external connection ID."},workflowId:{type:"string",table:s().C0E,comment:"Find all connections referenced by workflow inline modules."},workflowModuleId:{type:"string",table:s().yMG,comment:"Find connection referenced by a standalone workflow module."}}},adminDeleteExternalConnection:{apiName:"adminDeleteExternalConnection",displayName:"Delete External Connection",emoji:"🗑",description:"Delete an external connection (MCP server, Slack, etc.) and clear references from all workflows and modules that use it.",isDestructive:!0,schema:{externalConnectionId:{type:"string",table:s().Klg,comment:"The external connection ID to delete"},spaceId:{type:"string",table:"space",comment:"(Optional) Space ID for faster lookup"}}},adminResetMcpClientRegistration:{apiName:"adminResetMcpClientRegistration",displayName:"Reset MCP Client Registration",emoji:"🔁",description:"Delete the workspace-scoped MCP OAuth client registration for a server URL. Does not delete OAuth token connections or clear workflow references. Run as dry run first.",isDestructive:!0,schema:{spaceId:{type:"string",table:"space",comment:"Workspace whose MCP OAuth client registration should be reset."},serverUrl:{type:"string",comment:"Exact MCP server URL stored on the connection, for example https://gitlab.example.com/api/v4/mcp."},dryRun:{type:"boolean",defaultValue:!0,comment:"Preview only by default. Set false to delete the DCR row."}}},adminGetFileUpload:{apiName:"adminGetFileUpload",displayName:"Get File Upload",description:"Look up details of a file upload in the Public API",emoji:"☁",isDestructive:!1,schema:{fileUploadId:{type:"string",table:s().OjI}}},adminExpireFileUpload:{apiName:"adminExpireFileUpload",displayName:"Expire File Upload",description:"Manually expire a file upload or re-run S3 file cleanup steps",emoji:"🕛",isDestructive:!0,schema:{fileUploadId:{type:"string",table:s().OjI}}},adminSearchMcpRegistry:{apiName:"adminSearchMcpRegistry",displayName:"Search MCP Registry",description:"Search MCP registry entries by name, URL, or description with filtering options",emoji:"🔍",isDestructive:!1,schema:{search:{type:"string",name:"Search",placeholder:"figma, github, etc.",comment:"Substring to match against display_name, canonical_name, or server_url (case-insensitive)"},kind:{type:"options",name:"Kind",options:["all","server","client"],defaultValue:"all",comment:"Filter by entry kind"},status:{type:"options",name:"Status",options:["active","archived","deleted","all"],defaultValue:"active",comment:"Filter by entry status"},visibleOnly:{type:"boolean",defaultValue:!1,comment:"Visible Only: If true, only return entries visible in add connection modal or settings"},limit:{type:"number",defaultValue:20,comment:"Limit: Maximum number of entries to return (1-100)"}}},adminSyncMcpRegistry:{apiName:"adminSyncMcpRegistry",displayName:"Sync MCP Registry",description:"Preview MCP registry changes from the registry and Notion database. Applying queues the sync in the background.",emoji:"🔄",isDestructive:!1,schema:{dryRun:{type:"boolean",defaultValue:!0,comment:"Dry Run: If true, preview changes without writing to database. Set to false to queue the sync."},deleteFirst:{type:"boolean",defaultValue:!1,comment:"Delete First: If true, hard-delete all existing entries before syncing (clean slate)"}}},adminGetMcpRegistryEntry:{apiName:"adminGetMcpRegistryEntry",displayName:"Get MCP Registry Entry",description:"Look up a single MCP registry entry by ID or canonical name",emoji:"📋",isDestructive:!1,schema:{id:{type:"string",name:"Entry ID",placeholder:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",comment:"UUID of the entry (with or without dashes)"},canonicalName:{type:"string",name:"Canonical Name",placeholder:"com.example/my-server",comment:"Canonical name of the entry (e.g. 'com.example/my-server'). Use either ID or canonical name."}}},adminUpdateMcpRegistryNotionPage:{apiName:"adminUpdateMcpRegistryNotionPage",displayName:"Update MCP Registry Notion Page",description:"Update a page in the Notion MCP Registry database. Changes are written to Notion and will be picked up on the next sync.",emoji:"✏",isDestructive:!1,schema:{canonicalName:{type:"string",name:"Canonical Name",placeholder:"com.example/my-server",comment:"The canonical name of the entry to update (exact match required). Use 'Search MCP Registry' tool to find entries."},displayName:{type:"string",name:"Display Name",placeholder:"My Server",comment:"New display name (omit to leave unchanged)"},description:{type:"string",name:"Description",placeholder:"A helpful description of this MCP server",comment:"New description (omit to leave unchanged)"},isCustomerVisible:{type:"options",name:"Customer Visible",options:["unchanged","true","false"],defaultValue:"unchanged",comment:"Whether the entry should be visible to customers in the add connection modal"}}},adminBanMcpServer:{apiName:"adminBanMcpServer",displayName:"Ban/Unban MCP Server",description:"Ban or unban a malicious MCP server by URL. Banning blocks all connections and tool calls. The ban is enforced by origin (hostname + port) so all paths on the banned domain are blocked.",emoji:"🚫",isDestructive:!0,schema:{serverUrl:{type:"string",name:"Server URL",placeholder:"https://malicious-server.com/mcp",comment:"The MCP server URL to ban or unban. All paths on this origin will be affected."},action:{type:"options",name:"Action",options:["ban","unban"],defaultValue:"ban",comment:"'ban' to block all connections, 'unban' to allow connections again"}}},adminSetCustomMcpServersAllowed:{apiName:"adminSetCustomMcpServersAllowed",displayName:"Set Custom MCP Servers Allowed",description:"Toggle whether a workspace allows members to connect custom MCP servers. By default, custom MCP servers are blocked.",emoji:"🔧",isDestructive:!1,schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to update"},action:{type:"options",name:"Action",options:["preserve","allow","disallow"],defaultValue:"preserve",comment:"'preserve' to inspect without changing, 'allow' to enable custom MCP servers, 'disallow' to block them (default behavior)"}}},adminGetSpaceMcpAllowlist:{apiName:"adminGetSpaceMcpAllowlist",displayName:"Get Space MCP Allowlist",description:"Inspect a 
101workspace's custom MCP server allowlist: the enforcement toggle, stored URL patterns (exact vs. glob), whether custom MCP servers are blocked, and a plain-language diagnosis. Use to triage 'pattern already added' / missing-pattern reports.",emoji:"🔎",isDestructive:!1,schema:{spaceId:{type:"string",table:"space",comment:"The workspace ID to inspect"}}}},sD={userEmail:{type:"string",comment:"The target email for which the rate limits are to be reset."},resetSendTemporaryPassword:{type:"boolean",comment:"Reset the send_temporary_password ratelimit for this user. This is hit when the user attempts to make too many login requests within a short time"},resetSendTemporaryPasswordPerDay:{type:"boolean",comment:"Reset the send_temporary_password_per_day ratelimit for this user. This is hit when the user exceeds the total number of login requests per day"},resetLoginWithEmail:{type:"boolean",comment:"Reset the login_with_email ratelimit for this user. This is hit when the user attempts to make too many login requests with an email"},resetLoginWithPassword:{type:"boolean",comment:"Reset the login_with_password ratelimit for this user. This is hit when the user attempts to make too many login requests with an incorrect password"}},sT={adminRemoveSpaceUsersAndTransferContent:{apiName:"adminRemoveSpaceUsersAndTransferContent",displayName:"Remove Users and Queue Cleanup",emoji:"!",description:"Provide a comma-separated list of emails for users to remove from the space. This queues async direct page and workflow permission cleanup, but does not recover or transfer private content. If the customer uses SCIM, make sure they have already removed these users through SCIM.",schema:{spaceId:{type:"string"},userEmails:{type:"string",comment:"Emails of users to remove and clean up permissions for."},usersAlreadyRemoved:{type:"boolean",comment:"(Enterprise only) Check this box if customer uses SCIM, and users have already been removed through SCIM."},adminEmail:{type:"string",comment:"Must be an admin of the workspace. The permission change to the content will be performed as this user."}}},recoverSpace:{apiName:"recoverSpace",emoji:"👩",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(590422).Q,{underline:!0,inline:!0,external:!0,href:"https://dev.notion.so/notion/Recovery-Accounts-Workspaces-Pages-Content-de4ef68179e441f4a720eb345c72cdee#03ca1aa5a662491097fa1802263a4a53",children:"Usage Guide"}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Recover a deleted workspace. The workspace will be restored to the user who deleted it. The email of this user will be shown in a popup after you restore."]}),schema:{spaceId:{type:"string",table:"space"}},isDestructive:!0,notinoAction:{actionId:"admin.recover_space"}},recoverUser:{apiName:"recoverUser",emoji:"❤",description:"Recover a deleted account. Any workspaces that got deleted when they deleted their account will be restored, with them as the only admin. Shared workspaces will not be restored – users have to ask a current admin to add them back.",schema:{userId:{type:"string",table:s().oo9}},isDestructive:!0},adminRecoverMfa:{apiName:"adminRecoverMfa",emoji:"📱",description:"Reset MFA on an account. All existing MFA methods will be disabled, and a single recovery backup code will be emailed to the user.",schema:{userId:{type:"string",table:s().oo9}},isDestructive:!0},adminDeleteUserPasskeys:{apiName:"adminDeleteUserPasskeys",emoji:"🔐",description:"Delete all of a user's passkeys.",schema:{userId:{type:"string",table:s().oo9}},isDestructive:!0},adminChangeEmail:{apiName:"adminChangeEmail",emoji:"🔷",description:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(590422).Q,{underline:!0,inline:!0,external:!0,href:"https://dev.notion.so/notion/Change-Account-Emails-f547667d52e3473081eab9f62e3a52e3",children:"Usage Guide"}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Change a user's email. This tool has serious security implications so please follow the process closely."]}),schema:{oldEmail:{type:"string",placeholder:a(591977).zg},newEmail:{type:"string",placeholder:a(591977).zg},supportTicketLink:{type:"string"}},isDestructive:!0},adminSwapUserEmails:{apiName:"adminSwapUserEmails",displayName:"Swap user emails",emoji:"✉",description:(0,d.jsxs)(d.Fragment,{children:["Change multiple users' emails from a CSV. Use this when no account already exists with the new email address.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"This tool has serious security implications. Please make sure you got prior approval to do this. The maximum number of rows allowed for the CSV is 100.",(0,d.jsx)("br",{})]}),schema:{spaceId:{type:"string",table:"space"},csv:{type:"file",name:"csv",comment:"columns must be OLD_EMAIL and NEW_EMAIL"},previewChanges:{type:"boolean",defaultValue:!0,comment:"Check to see a preview of the changes that will be made. Uncheck to actually apply those changes."}},isDestructive:!0},adminSwapUserDomains:{apiName:"adminSwapUserDomains",emoji:"✉",description:(0,d.jsxs)(d.Fragment,{children:["Change the email domains of"," ",(0,d.jsx)("b",{children:"!!ALL!! the users for an enterprise customer"})," to a new email domain.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"This tool has serious security implications. Please make sure you got prior approval to do this.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Example:",(0,d.jsx)("br",{}),"Old Email Domain: makenotion.com",(0,d.jsx)("br",{}),"New Email Domain: notion.so"]}),schema:{oldEmailDomain:{type:"string"},newEmailDomain:{type:"string"}},isDestructive:!0},adminModifyBlock:{apiName:"adminModifyBlock",notinoAction:{actionId:"admin.modify_block"},emoji:"👩",description:(0,d.jsx)(d.Fragment,{children:"Trash or recover a block"}),schema:{blockId:{type:"string",table:"block"},action:{type:"options",options:["Send to Trash","Restore from Trash"],defaultValue:"Restore from Trash"}},isDestructive:!0},adminRestoreBlock:{apiName:"adminRestoreBlock",emoji:"♻",description:(0,d.jsx)(d.Fragment,{children:"Restore a trashed or permanently deleted block."}),schema:{blockId:{type:"string",table:"block"}},isDestructive:!0},adminBulkRestoreBlocks:{apiName:"adminBulkRestoreBlocks",displayName:"Bulk Restore Blocks (via CSV)",emoji:"♻",description:(0,d.jsxs)(d.Fragment,{children:["Bulk restore trashed or permanently deleted blocks.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"After submit, one queue task is enqueued per space. When each job completes, a CSV attachment is emailed to you with columns block ID, status, and message. The response includes ",(0,d.jsx)("b",{children:"queue task IDs"})," you can use in Splunk to trace the jobs."]}),schema:{csv:{type:"file",name:"csv",comment:"A column of <= 5,000 unique block IDs (UUIDs with or without dashes). Requires a BLOCK_ID column header."}},isDestructive:!0},adminViewDeletedCollectionProperties:{apiName:"adminViewDeletedCollectionProperties",displayName:"View deleted properties of a collection",emoji:"♻",description:"View any properties that were deleted from a collection on or after September 2021.",schema:{collectionId:{type:"string",table:s().VlP,comment:"The ID of the collection (aka data source), which can be copied from Database settings -> Manage data sources menu."},rowsToCheck:{type:"number",defaultValue:100,comment:"Select number of rows to check if a property has actual content (max: 5000)"}},isDestructive:!1},adminRestoreDeletedCollectionProperties:{apiName:"adminRestoreDeletedCollectionProperties",displayName:"Restore deleted properties of a data source (collection)",emoji:"♻",description:"Restores any properties that were deleted from a data source (aka collection) on or after September 2021.",schema:{collectionId:{type:"string",table:s().VlP,comment:"The data source ID, which can be copied from Database settings -> Manage data sources menu."},propertyName:{type:"string",comment:"The property name to recover."}},isDestructive:!0},adminRestoreDeletedGuestPermissions:{apiName:"adminRestoreDeletedGuestPermissions",emoji:"🌱",description:(0,d.jsx)(d.Fragment,{children:"Restore page access for guests who were removed from a workspace during the specified time window. Enterprise workspaces require the user ID of the person who removed the guests so their changes can be found in the audit log. Non-Enterprise workspaces require the guest user IDs from the recovery CSV; recovery data is retained for 30 days after removal."}),schema:{removalStartTime:{type:"number",isRequired:!0,comment:"Start time in milliseconds of when permissions were removed."},removalEndTime:{type:"number",isRequired:!0,comment:"End time in milliseconds of when permissions were removed."},deletingUserId:{type:"string",isRequired:!1,comment:"Required for Enterprise workspaces: the user ID of the person who removed the guests. Leave blank for non-Enterprise workspaces.",placeholder:a(591977).nZ},guestUserIdsCsv:{type:"file",name:"guest recovery CSV",acceptedFileExtensions:".csv",comment:"Required for non-Enterprise workspaces: upload a CSV with a GUEST_USER_ID column. Ignored for Enterprise workspaces."},spaceId:{type:"string",isRequired:!0,comment:"Space ID of the workspace where guests were removed from"}},isDestructive:!0},adminMergeUsers:{apiName:"adminMergeUsers",displayName:"Merge user accounts",emoji:"🤝",de
101scription:(0,d.jsxs)(d.Fragment,{children:["Transfer OLD_EMAIL's workspace membership, permissions, team memberships, and page access to NEW_EMAIL. Both emails must already belong to user accounts. NEW_EMAIL's user ID remains in the workspace, and OLD_EMAIL's user ID is removed from the workspace.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"This tool has serious security implications and can corrupt workspaces if used incorrectly. Get prior approval before proceeding. For known limitations and an example of the hazards, see the"," ",(0,d.jsx)(a(590422).Q,{underline:!0,inline:!0,external:!0,href:"https://app.dev.notion.com/p/notion/DBT-Labs-FiveTran-urgent-remediation-request-for-account-merges-391b35e6e67f81d6a209d0f6edac2c3e",children:"DBT Labs/FiveTran SEV1 incident"}),".",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Input CSV files are limited to 200 rows. Upon completion, we will send a CSV of the results to your email. Please check the CSV for any failures and raise them to the Enterprise engineer on triage!"]}),schema:{spaceId:{type:"string",table:"space"},csv:{type:"file",name:"CSV",comment:"columns must be OLD_EMAIL and NEW_EMAIL"},previewChanges:{type:"boolean",comment:"Check to see a preview of the changes that will be made. Uncheck to actually apply those changes.",defaultValue:!0}},isDestructive:!0},adminRecoverUserContentInSpace:{apiName:"adminRecoverUserContentInSpace",displayName:"Recover content and space setup for reprovisioned users",emoji:"❤",description:(0,d.jsxs)(d.Fragment,{children:["This tool is to be used in cases where a user or users were previously in the space and have been re-added but are now missing access to their pages, teams, permission groups, and favorites. This will recover access to all private and shared pages, teams, and permission groups that the user had access to prior to being removed, so make sure the customer is aware of the security and privacy implications of running this tool.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"You will receive an email when the recovery is complete with success and error status. The length of time it takes to complete will depend on the number of rows in the CSV, but you can approximate 5 seconds per row."]}),schema:{spaceId:{type:"string",comment:"Space ID of the Enterprise space where the users were removed from"},csv:{type:"file",name:"CSV",comment:"column must named USER_ID"},ignoreTimeLimit:{type:"boolean",defaultValue:!1,comment:"Bypass the 30-day recovery window. Use when the user left more than 30 days ago."}},isDestructive:!0},adminReviveBlocksOnPage:{apiName:"adminReviveBlocksOnPage",displayName:"Fix `alive: false` blocks visible on page",description:"Due to a bug in the logic for restoring snapshots (i.e. restoring to a previous version of page history), sometimes we end up with blocks that have their `alive` property set to `false` (which suggests that they're deleted) but their parents still point to and render these blocks. These quasi-alive blocks have limited options in their 6-dot menu and cannot be directly dragged around, deleted, etc. This tool will detect quasi-alive blocks on a given page and set all of them to `alive: true`.",emoji:"💀",schema:{pageId:{type:"string",table:"block"}},isDestructive:!0},adminMakeUserAliasPrimary:{apiName:"adminMakeUserAliasPrimary",emoji:"🗣",description:"Make a user's alias primary.",schema:{userId:{type:"string",table:s().oo9},alias:{type:"string",placeholder:a(591977).zg}},isDestructive:!1},adminRemoveUserAlias:{apiName:"adminRemoveUserAlias",emoji:"👻",description:"Remove a user's alias.",schema:{userId:{type:"string",table:s().oo9},alias:{type:"string",placeholder:a(591977).zg}},isDestructive:!0},adminAddUserAlias:{apiName:"adminAddUserAlias",emoji:"👤",description:"Add a user's alias.",schema:{userId:{type:"string",table:s().oo9},alias:{type:"string",placeholder:a(591977).zg},isPrimary:{type:"boolean",defaultValue:!1}},isDestructive:!1},adminRestoreUserAliases:{apiName:"adminRestoreUserAliases",emoji:"🔄",description:"Restore all dead user aliases for given users back to alive=true. Ensures at least one alias is marked as primary for each user.",schema:{userIds:{type:"string",table:s().oo9,placeholder:"Comma-separated user IDs"}},isDestructive:!1},adminMoveBlockSourceFileToCorrectSpace:{apiName:"adminMoveBlockSourceFileToCorrectSpace",displayName:"Move block source file to correct space",emoji:"🖼️",description:"Move a block's source file in S3 to the correct space folder, and update block source. Use when source has legacy url that includes incorrect space in filepath e.g. ../<wrong space ID>/<file ID>/<file name>. If file was edited, move original file if needed as well. If blockId is omitted, processes all blocks in the space with source files referencing the specified space ID.",sc
101hema:{spaceId:{type:"string",table:"space",comment:"Space ID of the block(s)."},fileSpaceId:{type:"string",table:"space",comment:"Existing incorrect space ID in the filepath of the block(s)."},blockId:{type:"string",table:"block",comment:"(Optional) Block with the source file to move. If omitted, processes all blocks in the space with mismatched source files."},limit:{type:"number",comment:"(Optional) Maximum number of blocks to process. If omitted, processes all matching blocks."}}}},sR={adminGetSamlConfig:{apiName:"adminGetSamlConfig",displayName:"Find SAML config",emoji:"🔎",description:"Returns the SAML config and the spaces it applies to, if one exists. Enter a SAML config ID, email domain, space ID, or organization ID.",schema:{samlConfigId:{type:"string",table:s()._71,placeholder:a(591977).nZ},emailDomain:{type:"string",placeholder:a(591977).mT},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ},organizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ}},customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("h2",{children:"SAML configs"}),t.samlConfigs.length>
1010?t.samlConfigs.map(({samlConfig:e,samlConfigSpaces:t})=>(0,d.jsxs)("div",{children:[(0,d.jsx)(a(243119).A,{data:e,hideHelp:!0}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{children:["This SAML config is owned by a ",e.owner_table," (ID"," ",e.owner_id,") and applies to the following workspaces:"]}),(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})]})]},e.id)):(0,d.jsx)("div",{children:"No SAML configs found"})]})}},adminDiagnoseEmaBinding:{apiName:"adminDiagnoseEmaBinding",displayName:"Diagnose EMA binding",emoji:"🩺",description:"Read-only. Shows the workspace's EMA binding: governing SAML config, issuer trust (SAML IdP scope or trusted platform), the trusted-platform gate, and verified email domains. Add an email to check whether a platform binding would serve it.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ},email:{type:"string",comment:"Optional. A user email to check against the binding."}},isDestructive:!1},adminGetSpacesForAllowedEmailDomain:{apiName:"adminGetSpacesForAllowedEmailDomain",displayName:"Find spaces with the allowed email domain",emoji:"🔎",description:"Returns spaces with the provided email domain in the allowed email domains list.",schema:{domain:{type:"string",comment:"Example: makenotion.com"},limit:{type:"number",defaultValue:10,comment:"Limit the number of spaces returned. Optional."}},customResponseRenderer:function({data:{domain:e,spaces:t}}){return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("h2",{children:["Spaces with allowed email domain ",e]}),(0,d.jsx)("div",{children:(0,d.jsx)(a(243119).A,{data:t,hideHelp:!0})})]})}},adminModifySamlUniqueEntityIds:{apiName:"adminModifySamlUniqueEntityIds",emoji:"🆔",description:"Adding a SAML config to the unique entity ID set enables multiple Notion SAML applications in the same IDP (e.g., Azure).",schema:{action:{type:"options",options:["add","remove","view"],comment:"Add or remove a SAML config to the unique entity ID set, or view the current set."},samlConfigId:{type:"string",table:s()._71,placeholder:a(591977).nZ,comment:"Required for 'add' and 'remove' actions."}},isDestructive:!1},adminCreateOrganization:{apiName:"adminCreateOrganization",emoji:"🆕",description:"Create an organization without a verified domain. Note that the workspace needs to be on enterprise tier, and cannot already be part of an organization. IMPORTANT: Make sure to update organization owners after running this tool - otherwise the workspace owners will be unable to continue setting up their organization.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ}},isDestructive:!0},adminUpdateOrganizationOwners:{apiName:"adminUpdateOrganizationOwners",emoji:"➕",description:"Add or remove organization owners from an organization. This will not affect any membership roles these users may have in any workspaces.",schema:{organizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ},userIds:{type:"string",comment:"Comma-separated list of user IDs you want to add or remove as organization owners."},action:{type:"options",options:["add","remove"],defaultValue:"add",comment:"Add or remove the specified users as organization owners."}},isDestructive:!0},adminUpdateOrganizationSpaces:{apiName:"adminUpdateOrganizationSpaces",emoji:"➕",description:"Add or remove workspaces from an organization. Only workspaces on the enterprise plan are eligible to be added. This will also add or remove the space from the organization's SAML config.",schema:{organizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ},spaceIds:{type:"string",comment:"Comma-separated list of workspace IDs you want to add or remove from the organization. Ownership of the workspaces must be verified."},action:{type:"options",options:["add","remove"],comment:"Add or remove the specified workspaces from the organization."}},isDestructive:!0},adminMigrateOrganization:{apiName:"adminMigrateOrganization",displayName:"Migrate organization",emoji:"➡️",description:"Move every workspace to the target organization and delete the source organization. By default, verified domains and SAML configs are transferred too. Review the preview and the target organization's security settings before confirming.",schema:{sourceOrganizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ},targetOrganizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ},copyVerifiedDomainsAndSamlConfigs:{type:"boolean",defaultValue:!0,name:"Copy verified domains and SAML configs",comment:"On by default. Turn off to remove source domains and SAML configs."}},isDestructive:!0,requiresHourlyReauth:!0}
101,adminDeleteOrganization:{apiName:"adminDeleteOrganization",displayName:"Delete organization",emoji:"🗑️",description:"Soft-deletes an organization. Its workspaces are NOT deleted — they keep all content and membership and become standalone workspaces, but lose any required-SAML login enforcement. The org's SAML config is set to unconfigured and its verified email domains are cleared. You will be shown the workspaces that will be freed and the domains that will be unverified before confirming.",schema:{organizationId:{type:"string",table:s().y75,placeholder:a(591977).nZ}},isDestructive:!0,requiresHourlyReauth:!0},adminUpdateSamlConfig:{apiName:"adminUpdateSamlConfig",emoji:"🔐",description:"Update SAML config by SAML config ID, which can be found using the 'Find SAML config' tool. Add email domain(s) to a workspace for SAML SSO. If they already have a domain configured, this will overwrite it. To delete SAML config, just provide samlConfigId.",schema:{samlConfigId:{type:"string",table:s()._71,placeholder:a(591977).nZ},emailDomains:{type:"string",comment:"Comma-separated list of email domains you want to add or remove from this workspace. Ownership of domain must be verified.",placeholder:a(591977).hT},action:{type:"options",options:[...a(505710).$3],comment:"Add/remove the specified email domain(s), delete the current configuration, or clear pending domain verification codes."},status:{type:"options",options:[...a(505710).JO],comment:"The status of the SAML config. Leave it blank if you are not changing the status"},emaIssuer:{type:"string",name:"EMA issuer",placeholder:"https://customer.okta.com",skipUUIDNormalization:!0,comment:"Enterprise-Managed Authorization issuer binding, applied by the 'update' action. Provide the IdP issuer URL exactly as it appears in the ID-JAG `iss` claim (matched byte-exact) together with the EMA config JSON to bind. Submit an empty string to clear the binding. Leave untouched otherwise."},emaConfigJson:{type:"json",name:"EMA config JSON",comment:'EMA governance envelope, e.g. {"status": "enabled"}. Required when binding an EMA issuer. Optional keys: enabled_space_ids (workspace UUIDs; org-owned configs must enable exactly one), denied_user_ids (user UUIDs disconnected from managed auth).',jsonSchema:{type:"object",required:["status"],additionalProperties:!1,properties:{status:{enum:["enabled","disabled"]},enabled_space_ids:{type:"array",items:{type:"string"}},denied_user_ids:{type:"array",items:{type:"string"}}}}}},isDestructive:!0}},sA=a(620107).O.colorful.length,sN="__other__",sM={card:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:10,backgroundColor:a(632079).Tj.background.primary,padding:16,display:"flex",flexDirection:"column",gap:12},legend:{display:"flex",flexWrap:"wrap",columnGap:16,rowGap:6},legendRow:{display:"flex",alignItems:"center",gap:6},legendSwatch:{width:10,height:10,borderRadius:3,flexShrink:0},legendRuleset:{color:a(632079).Tj.text.secondary}};function sP(e){var t;let{rows:i,dailyRows:n,dailyRowsTruncated:s,hasActionBreakdown:o,startDate:l,endDate:c}=e,{data:p,layers:m}=(0,r.useMemo)(()=>(function(e,t,a){let i=a?e:function(e){let t=new Map;for(let a of e){let e=sE(a),i=t.get(e);if(void 0===i){t.set(e,{...a});continue}i.totalTriggeredCount+=a.totalTriggeredCount,a.lastTriggered>i.lastTriggered&&(i.lastTriggered=a.lastTriggered,i.action=a.action)}return Array.from(t.values()).sort((e,t)=>e.totalTriggeredCount!==t.totalTriggeredCount?t.totalTriggeredCount-e.totalTriggeredCount:e.ruleName.localeCompare(t.ruleName))}(e),n=i.slice(0,sA),r=n.map(e=>a?sV(e):sE(e)),s=new Set(r),o=i.length>sA,l=o?[...r,sN]:r,d=new Map;for(let e of t){let t=a&&void 0!==e.action?sV({...e,action:e.action}):sE(e),i=s.has(t)?t:sN,n=d.get(e.date);void 0===n&&(n=Object.fromEntries(l.map(e=>[e,0])),d.set(e.date,n)),n[i]=(n[i]??0)+e.triggeredCount}let c=Array.from(d.entries()).map(([e,t])=>({ds:e,values:t})),p=n.map((e,t)=>sB({key:a?sV(e):sE(e),label:a?`${e.ruleName} \xb7 ${e.action}`:e.ruleName,rulesetName:e.rulesetName,index:t}));return o&&p.push(sB({key:sN,label:"Other",rulesetName:void 0,index:n.length})),{data:c,layers:p}}
101)(i,n,o),[i,n,o]),u=null==(t=n.at(-1))?void 0:t.date,h=s&&void 0!==u?u:c;return 0===p.length||l===h?null:(0,d.jsxs)("div",{style:sM.card,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",children:"Daily triggers"}),(0,d.jsx)(a(174356).TimeSeries,{width:1040,height:260,startDate:l,endDate:h,data:p,layers:m,showTooltipPointsForAllLayers:!0}),(0,d.jsx)("div",{style:sM.legend,children:m.map(e=>(0,d.jsxs)("div",{style:sM.legendRow,children:[(0,d.jsx)("div",{style:{...sM.legendSwatch,backgroundColor:e.stroke}}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:e.label}),void 0!==e.rulesetName?(0,d.jsx)("span",{style:sM.legendRuleset,children:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:e.rulesetName})}):void 0]},e.key))})]})}function sV(e){return JSON.stringify([e.rulesetName,e.ruleName,e.action])}function sE(e){return JSON.stringify([e.rulesetName,e.ruleName])}function sB(e){let{key:t,label:i,rulesetName:n,index:r}=e,s=a(620107).O.colorful[r]??a(620107).O.black["0"];return{key:t,label:i,rulesetName:n,stroke:s,fill:(0,a(650342).X4)(s,.15),renderLabel:e=>`${i}: ${e.toLocaleString()}`}}let sL={container:{maxWidth:1100,display:"flex",flexDirection:"column",gap:16},header:{display:"flex",flexDirection:"column",gap:4},subtitle:{color:a(632079).Tj.text.secondary},tableCard:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:10,overflow:"hidden",backgroundColor:a(632079).Tj.background.primary},table:{width:"100%",borderCollapse:"collapse"},theadRow:{backgroundColor:a(632079).Tj.background.secondary},th:{textAlign:"start",padding:"10px 14px",fontWeight:a(699422).Wy.semibold,fontSize:12,letterSpacing:"0.02em",textTransform:"uppercase",color:a(632079).Tj.text.secondary,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,whiteSpace:"nowrap"},thNumeric:{textAlign:"end"},td:{padding:"12px 14px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"middle"},tdLast:{borderBottom:"none"},rulesetCell:{color:a(632079).Tj.text.secondary,fontSize:12},ruleCell:{fontWeight:a(699422).Wy.medium},countCell:{textAlign:"end",fontVariantNumeric:"tabular-nums",fontWeight:a(699422).Wy.semibold,fontSize:15},timestampCell:{color:a(632079).Tj.text.secondary,fontSize:13,whiteSpace:"nowrap"},badge:{display:"inline-block",padding:"3px 9px",borderRadius:999,fontSize:11,fontWeight:a(699422).Wy.semibold,whiteSpace:"nowrap"},badgeDeny:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary},badgeWarn:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.accentPrimary},badgeNeutral:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary},emptyState:{padding:32,border:`1px dashed ${a(632079).Tj.border.secondary}`,borderRadius:10,textAlign:"center",color:a(632079).Tj.text.secondary},summary:{cursor:"pointer",marginTop:8},detailsBody:{marginTop:8}},s_={adminGetRelatedEntities:{apiName:"adminGetRelatedEntities",displayName:"View related entities",emoji:"🔗",description:"View the latest materialized Related Entities summary, relationships, and signal groups for a user or workspace.",schema:{entityId:{type:"string",isRequired:!0,comment:"User or workspace ID"}},customResponseRenderer:function(e){return(0,d.jsx)(a(763605).g,{response:e.data})}},adminSearchAuditLog:{apiName:"adminSearchAuditLog",displayName:"Search redacted audit logs",emoji:"🔎",description:"Search redacted audit log events for a workspace. Only users with approved access can use this tool. Please reach out to #eng-team-enterprise if you need access.",schema:{spaceId:{type:"string",comment:"Workspace id to search",table:"space"},supportTicketLink:{type:"string",table:"space"},startDate:{type:"date",comment:"Date to start search from."},endDate:{type:"date",comment:"Date to search on or before."},actorId:{type:"string",comment:"User ID or Bot ID to filter by"},actorType:{type:"options",comment:"Filter by actor type",options:["notion_user","bot"],defaultValue:"notion_user"},eventFilters:{type:"multiselect",comment:"(optional) Filter by event type",options:Object.values(a(537186).Dj).map(e=>e.map(e=>
101({displayName:a(962299).A.formatMessage(a(377128).T0[e]),value:e})).sort((e,t)=>e.value.localeCompare(t.value))).flat()},targetId:{type:"string",comment:"Target ID to filter by"},targetType:{type:"options",comment:"Type of the target to filter by",options:["collection","page","form","user","space","team","group","organization"]}}},adminQueryRuleEngineTriggers:{apiName:"adminQueryRuleEngineTriggers",displayName:"Query rule engine triggers",emoji:"🛡️",description:"For a given IP, user, space, or email domain, returns a daily time series of triggers per rule plus total trigger counts across the date range.",schema:{entityType:{type:"options",required:!0,comment:"Entity dimension to query.",options:[{displayName:"IP address",value:"ip"},{displayName:"User",value:"user"},{displayName:"Space",value:"space"},{displayName:"Email domain",value:"emailDomain"}]},entityId:{type:"string",comment:"Identifier within the entity dimension (e.g. IP address, user ID, space ID, email domain)."},startDate:{type:"date",comment:"Inclusive start of the date range. Must be within the last 90 days."},endDate:{type:"date",comment:"Inclusive end of the date range."}},customResponseRenderer:function(e){let{data:t}=e,{rows:i,actionRows:n,dailyRows:r,dailyRowsTruncated:s,request:o,truncated:l}=t,c=n??i,p=void 0!==n,m=[];if(l&&m.push("Totals are partial: the server hit its row-scan safety cap before reading all data. Narrow the date range and re-run."),s){let e="The daily chart is partial: the per-day series hit its row cap, so the latest days are missing from the chart.";l||(e+=" Totals in the table are complete."),m.push(e)}return(0,d.jsxs)("div",{style:sL.container,children:[(0,d.jsxs)("div",{style:sL.header,children:[(0,d.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Rule Engine Trigger Totals"}),(0,d.jsx)("div",{style:sL.subtitle,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:0===c.length?"No rules triggered in this date range.":void 0===n?`${c.length} ${1===c.length?"rule":"rules"} triggered, ranked by total count.`:`${c.length} ${1===c.length?"rule action":"rule actions"} triggered, ranked by total count.`})}),(0,d.jsx)("div",{style:sL.subtitle,children:(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:"Only intervention actions are recorded: rules in log (shadow) mode and bypassed evaluations never appear here, so a shadow-mode rule showing zero triggers may still be matching."})})]}),(0,d.jsx)(a(553775).i$,{warnings:m}),void 0!==r&&void 0!==o?(0,d.jsx)(sP,{rows:c,dailyRows:r,dailyRowsTruncated:s??!1,hasActionBreakdown:p,startDate:o.startDate,endDate:o.endDate}):void 0,0===c.length?(0,d.jsx)("div",{style:sL.emptyState,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"No rule engine triggers recorded for this entity in the selected date range."})}):(0,d.jsx)("div",{style:sL.tableCard,children:(0,d.jsxs)("table",{style:sL.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{style:sL.theadRow,children:[(0,d.jsx)("th",{style:sL.th,children:"Rule"}),(0,d.jsx)("th",{style:sL.th,children:"Action"}),(0,d.jsx)("th",{style:{...sL.th,...sL.thNumeric},children:"Total"}),(0,d.jsx)("th",{style:sL.th,children:"Last triggered"})]})}),(0,d.jsx)("tbody",{children:c.map((e,t)=>{var a,i;let n,r=t===c.length-1?{...sL.td,...sL.tdLast}:sL.td;return(0,d.jsxs)("tr",{children:[(0,d.jsxs)("td",{style:r,children:[(0,d.jsx)("div",{style:sL.ruleCell,children:e.ruleName}),(0,d.jsx)("div",{style:sL.rulesetCell,children:e.rulesetName})]}),(0,d.jsx)("td",{style:r,children:(0,d.jsx)("span",{style:"challenge_hcaptcha"===(a=p?e.action:"")?{...sL.badge,...sL.badgeWarn}:"deny"===a||"autoban"===a||a.startsWith("block_")||a.startsWith("disable_")||"remove_page_public_access"===a||"unindex_public_page"===a?{...sL.badge,...sL.badgeDeny}:{...sL.badge,...sL.badgeNeutral},children:p?e.action:"Unknown"})}),(0,d.jsx)("td",{style:{...r,...sL.countCell},children:e.totalTriggeredCount.toLocaleString()}),(0,d.jsx)("td",{style:{...r,...sL.timestampCell},children:Number.isNaN((n=new Date(i=e.lastTriggered)).getTime())?i:n.toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]},JSON.stringify([e.rulesetName,e.ruleName,e.action]))})})]})}),(0,d.jsxs)("details",{children:[(0,d.jsx)("summary",{style:sL.summary,children:(0,d.jsx)(a(111010).D,{styleKey:"bodyBold",children:"Raw response"})}),(0,d.jsx)("div",{style:sL.detailsBody,children:(0,d.jsx)(a(243119).A,{data:t})})]})]})}},adminDisableNotionAIForSpace:{apiName:"adminDisableNotionAIForSpace",generatedRequestIdKey:"requestId",preserveGeneratedRequestIdOnPartialFailure:!0,displayName:"Disable Notion AI for workspace",emoji:"🤖",description:"Sets the Notion-admin AI disable marker and turns off the legacy AI availability settings. Worksp
101ace admins cannot re-enable AI from workspace settings while this marker is set.",schema:{spaceIds:{type:"string",comment:"Comma-separated workspace IDs to disable AI for",table:"space"},note:{type:"string",multiline:!0,comment:"Optional internal note applied to every workspace listed above. Use this for case context; it will appear in the workspace's Account Notes."}},isDestructive:!0},adminEnableNotionAIForSpace:{apiName:"adminEnableNotionAIForSpace",displayName:"Enable Notion AI for workspace",emoji:"🤖",description:"Clears the Notion-admin AI disable marker and turns on the legacy AI availability settings.",schema:{spaceIds:{type:"string",comment:"Comma-separated workspace IDs to clear the Notion-admin AI disable marker for",table:"space"}},isDestructive:!0},adminDisableReverifyForUser:{apiName:"adminDisableReverifyForUser",emoji:"♻",description:"Disables the reverification flow for users who no longer have access to their email account. Use sparingly (and ideally only for education accounts).",schema:{userId:{type:"string",table:s().oo9}},isDestructive:!0},adminAddPublicEmailDomains:{apiName:"adminAddPublicEmailDomains",emoji:"📪",description:"Add domains as a comma-separated list to disallow them from being used as allowed email domains, e.g. domains that are email providers. This will also remove the domain from any workspace that currently has the domain set as an allowed email domain.",schema:{domains:{type:"string"}},isDestructive:!0},adminDeleteSpaces:{apiName:"adminDeleteSpaces",emoji:"❌",description:"Delete spaces as a comma-separated list. Use this for deleting spaces of churned users or to quickly remove malicious workspaces. Warning: This tool immediately deletes the space, without an option to restore. This action cannot be undone.",schema:{spaceIds:{type:"string",table:"space"}},isDestructive:!0,requiresHourlyReauth:!0},adminResetAccounts:{apiName:"adminResetAccounts",emoji:"🧹",description:"Logs out users and optionally resets their passwords.",schema:{userIds:{type:"string",table:s().oo9},userEmails:{type:"string"},resetPassword:{type:"boolean",comment:"Check this box if you want to reset users' passwords as well."}},isDestructive:!0},adminDeleteUser:{apiName:"adminDeleteUser",emoji:"🗑",description:"Delete user data from Notion's internal databases. By default, users will be permanently purged 30 days after the deletion request. If 'Purge Immediately for GDPR' is checked, user data will be permanently purged at once, rather than in 30 days. Use this option with care, as user data cannot be recovered. 'Purge Immediately for GDPR' will also delete from Amplitude.",schema:{userId:{type:"string",table:s().oo9},purgeImmediatelyForGDPR:{type:"boolean"}},isDestructive:!0,requiresHourlyReauth:!0,notinoAction:{actionId:"admin.delete_user"}},adminDangerouslyQueueRemoveUserDirectPermissionsInSpace:{apiName:"adminDangerouslyQueueRemoveUserDirectPermissionsInSpace",displayName:"Retry removed-user permission cleanup",emoji:"⚠️",description:"Retries direct page and workflow permission cleanup for users already removed from a workspace, such as after failed SCIM cleanup. It does not change workspace membership, teams, space views, bots, or user tokens.",schema:{spaceId:{type:"string",table:"space"},userIds:{type:"stringArray",table:s().oo9,comment:"User IDs already removed from the workspace whose direct page and workflow permission cleanup should be retried."}},isDestructive:!0,requiresHourlyReauth:!0,typedConfirmation:{expectedValueResponseKey:"confirmationText",description:"You are about to retry direct page and workflow permission cleanup for users who have already been removed from this workspace.",inputLabel:"Confirmation",confirmButtonLabel:"Retry permission cleanup"}},adminRemoveAllSpaceGuests:{apiName:"adminRemoveAllSpaceGuests",displayName:"Remove all guests from a workspace",emoji:"🚪",description:"Removes ALL guests from a workspace: deletes their guest memberships and revokes their direct page permissions. Only supports free workspaces for now. Use dryRun=true first to preview which guests would be removed.",schema:{spaceId:{type:"string",table:"space"},dryRun:{type:"boolean",comment:"(Optional) If true, returns the list of guests that would be removed without actually removing them.",defaultValue:!0}},isDestructive:!0,requiresHourlyReauth:!0}
101,adminGetExternalUserProfile:{apiName:"adminGetExternalUserProfile",displayName:"Look up SCIM data for user",emoji:"🔍",description:"Look up external user profile (SCIM data) for a user across all their spaces, or a specific space. Useful for verifying GDPR deletion of SCIM data.",schema:{userId:{type:"string",table:s().oo9},spaceId:{type:"string",table:"space",comment:"Optional. If not provided, will look up across all spaces."}}},revokeUserTokens:{apiName:"revokeUserTokens",displayName:"Log user out of active sessions",emoji:"🖥",description:"Revoke all user tokens. This will sign users out of all active sessions, and they'll have to log in again.",schema:{userId:{type:"string",table:s().oo9}},isDestructive:!0},adminBlockApiBots:{apiName:"adminBlockApiBots",displayName:"Block API Bots",description:"Block a given Bot by bot_Id or space_id.",emoji:"🤖",schema:{type:{type:"options",options:["space_id","bot_id","integration_id"],defaultValue:"bot_id"},botId:{type:"string"},spaceId:{type:"string"},integrationId:{type:"string"},action:{type:"options",options:["block","unblock"],defaultValue:"block"},sendOwnerEmail:{type:"boolean",comment:"Email the integration owner or workspace owners about the access change.",defaultValue:!1}},isDestructive:!0},adminBulkDeactivateApiBots:{apiName:"adminBulkDeactivateApiBots",displayName:"Bulk deactivate Public API bots",emoji:"🤖",description:"Bulk deactivate Public API guest/external bots for newline-, comma-, or space-separated bot IDs by setting Bot.alive=false. Other bot types are skipped. This does not Redis-block bots.",schema:{botIds:{type:"string",table:"bot",comment:'Bot IDs separated by newlines, commas, or spaces. Only Public API bot types "guest" and "external" are deactivated; non-supported bot types are skipped.'}},isDestructive:!0,notinoAction:{actionId:"admin.deactivate_api_bots"}},adminDeleteFileFromS3:{apiName:"adminDeleteFileFromS3",displayName:"[Deprecated] Delete S3 file",emoji:"🗄",description:"This tool is deprecated and can cause irreversible data loss. Send S3 file deletion requests directly to engineering.",schema:{spaceId:{type:"string",table:"space",comment:"The space ID that is requesting this file be deleted."},fileUrl:{type:"string",comment:"(optional) The URL to the file in S3 if you have it."},fileId:{type:"string",comment:"(optional) The ID of the file that is to be deleted from S3."}},isDestructive:!0},adminBlockEmailDomain:{apiName:"adminBlockEmailDomain",emoji:"🚷",description:'Block or unblock signups from one or more email domains, or unblock logins for domains that are on the disallowed-login-domain list. Enter a single domain or a comma-separated list to bulk action multiple domains at once. Login blocks are added by other systems and checked against the user\'s primary email at sign-in, even when the user record\'s isBanned flag is false. "Block signup" refuses domains that are on the education allowlist as registered schools; edu-suffix domains that are not on the allowlist can still be blocked. On "block signup" you can additionally check "ban existing accounts" to ban every account whose primary email is on the entered domains: each entry may be an apex domain or a subdomain and is matched exactly as entered (an apex does not also match its subdomains — enter those separately), bare public suffixes such as eu.org are rejected, public email providers anywhere in the list are refused, it is capped at 500 matched accounts across all entered domains (above that, use the CSV "Bulk ban users" tool), and it is restricted to the Engineering - Trust role. The ban blocks signup only and never adds the domain to the login blocklist. Confirming shows the matched account count and a sample before you press Continue.',schema:{domain:{type:"string",comment:"A single domain (e.g. example.com) or a comma-separated list (e.g. a.com, b.com) to action in bulk."},action:{type:"options",options:["block signup","unblock signup","unblock login"],defaultValue:"block signup",required:!0},banExistingAccounts:{type:"boolean",defaultValue:!1,comment:"Also ban existing accounts whose primary email is on the entered domain(s). Blocks signup only — it does NOT add the domain to the login blocklist. Accepts an apex domain or a subdomain (e.g. acme.eu.org, eng.acme.com) and matches exactly what you enter — an apex does NOT also match its subdomains. Bare public suffixes (eu.org, com) and known email providers are rejected. Restricted to the Engineering - Trust role. Applies across ALL entered domains.",visibleWhen:{field:"action",value:"block signup"}},banAccountMaxAgeDays:{type:"number",numberType:"integer",min:1,defaultValue:14,comment:"Only applies when 'also ban existing accounts' is checked. How many days back to include by signup time (default 14). Widening this never bans more than 500 accounts; above that the request is refused.",visibleWhen:{field:"action",value:"block signup"}}},isDestructive:!0},adminUpdateLoginEmailAllowlist:{apiName:"adminUpdateLoginEmailAllowlist",emoji:"🔒",description:"Add or remove an email from the login email allowlist.",schema:{email:{type:"string",comment:"Email address to add or remove from the allowlist."},action:{type:"options",options:["add","remove"],defaultValue:"add"}},isDestructive:!0},adminUpdateLoginIpAllowlist:{apiName:"adminUpdateLoginIpAllowlist",emoji:"🔒",description:"Add or remove an IP address from the login IP allowlist.",schema:{ip:{type:"string",comment:"IP address to add or remove from the allowlist."},action:{type:"options",options:["add","remove"],defaultValue:"add"}},isDestructive:!0},adminUpdateGlobalIpAllowlist:{apiName:"adminUpdateGlobalIpAllowlist",displayName:"Global IP Allowlist",emoji:"🔒",description:"View, add, or remove IP addresses from the global trust rules IP allowlist.",schema:{ip:{type:"string",comment:"IP address to add or remove from the allowlist. Leave blank when action is view."},action:{type:"options",options:["view","add","remove"],defaultValue:"view"}},isDestructive:!0},adminBypassEmailReputationChecks:{apiName:"adminBypassEmailReputationChecks",displayName:"Add email and domain to bypass",emoji:"📧",description:(0,d.jsxs)(d.Fragment,{children:["Add a list of emails and/or domains seperated by ',' to bypass reputation checks against Mailgun during signup.",(0,d.jsx)("br",{}),"Note: If a domain was added using the ",(0,d.jsx)("b",{children:"Block email domain"})," admin tool, the domain will not be able to signup even if they are a member of the reputation bypass list."]}),schema:{emailsAndDomains:{type:"string"},action:{type:"options",options:["bypass","remove"],defaultValue:"bypass"}},isDestructive:!0},adminAddPreservedSpaces:{apiName:"adminAddPreservedSpaces",emoji:"📪",de
101scription:"Add spaceIds as a comma-separated list to track them as being preserved, ie spaces that cannot be deleted.",schema:{spaceIds:{type:"string",table:"space"}},isDestructive:!0},adminRemovePreservedSpaces:{apiName:"adminRemovePreservedSpaces",emoji:"📪",description:"Remove spaceIds from preserved spaces list, ie spaces that cannot be deleted.",schema:{spaceIds:{type:"string",table:"space"}},isDestructive:!0},adminBlockEmailsToUser:{apiName:"adminBlockEmailsToUser",displayName:"Block emails to user",description:"Block emails from being sent to a user",emoji:"🔒",schema:{userEmail:{type:"string"}}},adminUnblockEmailsToUser:{apiName:"adminUnblockEmailsToUser",displayName:"Unblock emails to user",description:"Unblock emails from being sent to a user",emoji:"🔓",schema:{userEmail:{type:"string"}}}},sU={adminSetSpaceDomain:{apiName:"adminSetSpaceDomain",emoji:"🌌",description:"Sets the domain of a workspace without checking reserved or badWords list. WARNING: This will break all existing backlinks for the current domain.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The workspace ID of the domain we're updating"},domainId:{type:"string",table:s()._6L,placeholder:a(591977).nZ,comment:"The ID of the domain we're updating"},domain:{type:"string",placeholder:"subdomain.notion.site if it's a custom domain, or subdomain if it's a default domain",comment:"The domain name we want to update to"}},isDestructive:!0},adminSetDefaultPublicDomain:{apiName:"adminSetDefaultPublicDomain",emoji:"🌐",description:"Sets the randomly-generated default domain of a workspace",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The workspace ID that's missing the default domain"}},isDestructive:!0},adminGetPublicDomainStatus:{apiName:"adminGetPublicDomainStatus",displayName:"View Sites Custom Hostname Validation Status",emoji:"🎫",description:"View validation status and any errors for a custom hostname being set up for use with Sites. Both workspace ID and domain name are required.",schema:{spaceId:{type:"string",table:"space"},domainName:{type:"string",placeholder:"www.notion.site"}}},adminMarkPublicDomainInvalid:{apiName:"adminMarkPublicDomainInvalid",displayName:"Mark Custom Domain as Invalid",emoji:"❌",description:"Manually mark a pending custom domain as invalid. This will set the status to 'invalid' and delete the Cloudflare record.",isDestructive:!0,schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The workspace ID that owns the domain"},domainName:{type:"string",placeholder:"www.notion.site",comment:"The domain name to mark as invalid"}}},adminUpdatePublicPageSlug:{apiName:"adminUpdatePublicPageSlug",emoji:"✏",displayName:"Update site slug",description:"Sets the slug for a site",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"The workspace ID of the site to be updated"},blockId:{type:"string",table:"block",placeholder:a(591977).nZ,comment:"The block ID of the site to be updated"},slug:{type:"string",comment:"The updated slug for the site"}},isDestructive:!0}},sW={card:{paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,borderInlineStartWidth:3,borderInlineStartStyle:"solid"},cardBorderSent:{borderInlineStartColor:a(632079).Tj.green.background.primary},cardBorderSkipped:{borderInlineStartColor:a(632079).Tj.yellow.background.primary},cardBorderError:{borderInlineStartColor:a(632079).Tj.red.background.primary},summary:{paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},label:{fontWeight:a(699422).Wy.semibold},badgeWrapper:{alignSelf:"flex-start"}};function sF(e){return new Date(e).toLocaleString("en-US",{month:"numeric",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"})}function sK({row:e}){var t,i;return(0,d.jsxs)(a(4458).VP,{gap:4,style:{...sW.card,...function(e){switch(e){case"sent":return sW.cardBorderSent;case"skipped":return sW.cardBorderSkipped;case"error":return sW.cardBorderError}}(e.outcome)},children:[(0,d.jsx)("div",{style:sW.badgeWrapper,children:(0,d.jsx)(a(746434).E,{color:function(e){switch(e){case"sent":return"green";case"skipped":return"yellow";case"error":return"red"}}(e.outcome),content:e.outcome})}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Metronome Customer ID:"})," ",(0,d.jsx)("a",{href:o(e.metronomeCustomerId),target:"_blank",rel:"noopener noreferrer",children:e.metronomeCustomerId})]}),(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Invoice ID:"})," ",(0,d.jsx)("a",{href:(t=e.metronomeCustomerId,i=e.invoiceId,(0,a(540342).zL)({customerId:t,invoiceId:i,livemode:!0})),target:"_blank",rel:"noopener noreferrer",children:e.invoiceId})]}),void 0!==e.servicePeriodStartMs&&void 0!==e.servicePeriodEndMs?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Period:"})," ",`${sF(e.servicePeriodStartMs)} → ${sF(e.servicePeriodEndMs)}`]}):void 0,void 0!==e.currency?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Spend:"})," ",void 0===e.onDemandSpendMinorUnits?"unavailable":iB(e.onDemandSpendMinorUnits,e.currency)]}):void 0,void 0!==e.recipients&&e.recipients.length>0?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Recipients:"}
101)," ",e.recipients.join(", ")]}):void 0,void 0!==e.skipReason?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Skip reason:"})," ",e.skipReason]}):void 0,void 0!==e.error?(0,d.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[(0,d.jsx)("span",{style:sW.label,children:"Error:"})," ",e.error]}):void 0]})}let s$={pageHeader:{fontWeight:a(699422).Wy.bold,fontSize:20,marginBottom:8,marginTop:16},tabBarContainer:{marginBottom:16},sectionHeader:{fontWeight:a(699422).Wy.bold,fontSize:15,marginTop:20,marginBottom:8,color:a(632079).Tj.text.secondary,textTransform:"uppercase",letterSpacing:"0.04em"},bannerCard:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,padding:"14px 16px",fontSize:15,marginBottom:12,backgroundColor:a(632079).Tj.background.primary,boxShadow:a(632079).Tj.shadow.base.sm},bannerCardLast:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,padding:"14px 16px",fontSize:15,backgroundColor:a(632079).Tj.background.primary,boxShadow:a(632079).Tj.shadow.base.sm},bannerKeyName:{fontWeight:a(699422).Wy.bold,wordBreak:"break-all"},bannerText:{marginTop:10,padding:"8px 10px",fontSize:14,backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,whiteSpace:"pre-wrap",color:a(632079).Tj.text.primary},bannerMetaTable:{marginTop:10,borderTop:`1px solid ${a(632079).Tj.border.primary}`},bannerMetaRow:{fontSize:14,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},bannerMetaRowLast:{fontSize:14},bannerMetaLabel:{flexShrink:0,width:110,paddingTop:6,paddingInlineEnd:8,paddingBottom:6,paddingInlineStart:0,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary},bannerMetaValue:{padding:"6px 0",wordBreak:"break-all",flex:1,color:a(632079).Tj.text.primary},typeBadge:{display:"inline-block",padding:"3px 10px",borderRadius:12,fontSize:13,fontWeight:a(699422).Wy.medium},audienceChip:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.medium,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary},emptySectionNote:{fontSize:14,color:a(632079).Tj.text.secondary,fontStyle:"italic",marginBottom:12}};function sO(e){return void 0===e?"—":new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function sz({type:e}){let t=function(e){switch(e){case"alert":case"uncollectible":return{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary};case"warning":return{backgroundColor:a(632079).Tj.orange.background.primary,color:a(632079).Tj.orange.text.accentPrimary};case"info":return{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.accentPrimary}}}(e);return(0,d.jsx)("span",{style:{...s$.typeBadge,...t},children:iU(e)})}function sG({entry:e,isLast:t}){return(0,d.jsxs)(a(4458).fI,{style:t?s$.bannerMetaRowLast:s$.bannerMetaRow,children:[(0,d.jsx)("div",{style:s$.bannerMetaLabel,children:e.label}),(0,d.jsx)("div",{style:s$.bannerMetaValue,children:e.value})]})}function sq({banner:e,isLast:t,includeExpiredAt:i}){let n=[{label:"Active at",value:sO(e.active_at)}];return i&&n.push({label:"Expired at",value:sO(e.expired_at)}),n.push({label:"Version",value:String(e.version)},{label:"ID",value:e.id}),(0,d.jsxs)("div",{style:t?s$.bannerCardLast:s$.bannerCard,children:[(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(sz,{type:e.banner_type}),(0,d.jsx)("span",{style:s$.bannerKeyName,children:iU(e.banner_key)}),(0,d.jsx)("span",{style:s$.audienceChip,children:function(e){switch(e){case"admins":return"Admins only";case"members":return"Members only";case"any":return"Any user"}}(e.audience)})]}),void 0!==e.banner_text&&""!==e.banner_text?(0,d.jsx)("div",{style:s$.bannerText,children:e.banner_text}):null,(0,d.jsx)("div",{style:s$.bannerMetaTable,children:n.map((e,t)=>(0,d.jsx)(sG,{entry:e,isLast:t===n.length-1},e.label))})]})}function sH({data:e}){let{active:t,past:i}=e;return 0===t.length&&0===i.length?(0,d.jsx)(a(553775).i$,{warnings:["No active or past subscription banners for this space."]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:s$.sectionHeader,children:`Active (${t.length})`}),0===t.length?(0,d.jsx)("div",{style:s$.emptySectionNote,children:"No active banners on this space."}):t.map((e,a)=>(0,d.jsx)(sq,{banner:e,isLast:a===t.length-1,includeExpiredAt:!1},e.id)),(0,d.jsx)("div",{style:s$.sectionHeader,children:`Past (${i.length})`}),0===i.length?(0,d.jsx)("div",{style:s$.emptySectionNote,children:"No past banners on this space."}):i.map((e,t)=>(0,d.jsx)(sq,{banner:e,isLast:t===i.length-1,includeExpiredAt:!0},e.id))]})}let sZ={card:{paddingBlock:16,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},sectionTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:8,marginTop:16},label:{fontWeight:a(699422).Wy.semibold},badge:{display:"inline-block",paddingBlock:2,paddingInline:8,borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.semibold},badgeSent:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.primary},badgeDry:{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.primary},mono:{fontFamily:"monospace"}},sJ={adminUpdateSubscription:{apiName:"adminUpdateSubscription",emoji:"💵",description:"Only for Tier 2 & 3 access",
101schema:{spaceId:{type:"string",table:"space"},plan:{type:"options",options:(0,n().Lc)(a(126365).Ap,[...a(126365).nC,...a(126365).qC]),comment:"Optional, only fill out if you want to change the plan."},billingEmail:{type:"string",comment:"This field is required if you are selecting Billing=send_invoice and the subscription has no email currently. Otherwise, it is optional."},billingCycleAnchor:{type:"options",options:["now","unchanged"],comment:"A subscription's billing cycle anchor determines the date of the first full invoice and the day of the month for subsequent invoices. Setting this field to 'now' will reset the billing cycle anchor to the current time. Setting this field to 'unchanged' will keep the current billing cycle anchor. Only applies if updating an existing paid subscription."},prorationBehavior:{type:"options",options:["always_invoice","create_prorations","none"],comment:'The default proration behavior is "create_prorations". Setting this field to other values will overwrite the default behavior. "always_invoice": Always invoice immediately for prorations. "none": Disable creating prorations in this request. Only applies if updating an existing paid subscription.'},reasonForUpdate:{type:"string",comment:"Reasons can be issuing an ambassador discount, marketing discount, bug fixing, issuing a trial, etc."}},isDestructive:!0},adminUpdateAddOnSubscription:{apiName:"adminUpdateAddOnSubscription",emoji:"🤖",schema:{spaceId:{type:"string",table:"space"},addOn:{type:"options",options:(0,n().Lc)(a(607372).dx,a(607372).Mc),comment:"Optional, only fill out if you want to change the add-on."},isCancellation:{type:"boolean",comment:"Optional, only check if you want to remove this add-on."},quantity:{type:"number",comment:"Optional, not relevant for products that use seats-based pricing. Example: AI add-on is seats-based, Sites Custom Domains is not."},coupon:{type:"string",comment:"Optional, only fill out if you want to apply a coupon."},reasonForUpdate:{type:"string",comment:"Reasons can be issuing an ambassador discount, marketing discount, bug fixing, issuing a trial, etc."}},isDestructive:!0},adminBulkMigrateToCampusLeaderBusiness:{apiName:"adminBulkMigrateToCampusLeaderBusiness",displayName:"Bulk migrate to Campus Leaders Business",emoji:"🎓",description:"Migrate workspaces onto comped Campus Leaders Business from any current plan, keeping their billing interval. Skips workspaces with a custom domain add-on.",schema:{csv:{type:"file",name:"csv",comment:"column must be WORKSPACE_ID"},dryRun:{type:"boolean",defaultValue:!0,comment:"Uncheck to actually perform the migration"}}},adminUpdateSubscriptionBusinessEnterprise:{apiName:"adminUpdateSubscriptionBusinessEnterprise",displayName:"Update subscription to business or enterprise marketing or ambassador plan",emoji:"💵",description:"Update subscription to business or enterprise marketing or ambassador plan",schema:{spaceId:{type:"string",comment:"Space ID to update"},plan:{type:"options",options:a(126365).qC,comment:"Plan to update to"},reasonForUpdate:{type:"string",comment:"Reason for the update"}}},adminSetSalesAssistedSubscriptionBanner:{apiName:"adminSetSalesAssistedSubscriptionBanner",displayName:"Finance Team: [Sales Assisted] Set Subscription Banner",emoji:"🚩",description:"Set uncollectible banners on a workspace",schema:{spaceId:{type:"string",table:"space"},action:{type:"options",options:["Yellow Banner","Red Banner","Clear Banner"]},audience:{type:"options",options:["Admins only","Admins + Members"]},bannerText:{type:"string",placeholder:"Optional"}}},adminCheckDomainEligibleForSalesAssisted:{apiName:"adminCheckDomainEligibleForSalesAssisted",displayName:"Check domain is eligible for sales assisted",description:"Optionally specify space IDs to check space specific overrides, eligibility based on paid seat count, and current sales assisted status.",isDestructive:!1,emoji:"🔎",schema:{emailDomain:{type:"string"},spaceIds:{type:"string",table:"space"}}},adminSetSelfServeEnterpriseEligibility:{apiName:"adminSetSelfServeEnterpriseEligibility",displayName:"Set Self-Serve Enterprise Eligibility",emoji:"🤖",description:"Allows for a customer that is eligible for sales assisted plans to instead be eligible for self serve subscriptions. Please provide a space id OR stripe customer id.",schema:{spaceId:{type:"string",table:"space"},customerId:{type:"string",comment:"Stripe Customer ID",placeholder:a(591977).cs},eligibilityStatus:{type:"options",options:["eligible","ineligible"]}}},adminBulkSetSalesAssistedSubscriptionBanner:{apiName:"adminBulkSetSalesAssistedSubscriptionBanner",dis
101playName:"Finance Team: [Sales Assisted] Bulk Set Subscription Banner",emoji:"🚩",description:"Set uncollectible banners on a list of workspaces with given banners",schema:{csv:{type:"file",name:"csv"}}},adminGetSubscriptionBannerHistory:{apiName:"adminGetSubscriptionBannerHistory",displayName:"[Sales Assisted] View Subscription Banner State",emoji:"🚩",description:"View current and past subscription banners state for a workspace",customResponseRenderer:function({data:e}){let[t,i]=(0,r.useState)(0);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:s$.pageHeader,children:"Subscription Banner History"}),(0,d.jsx)("div",{style:s$.tabBarContainer,children:(0,d.jsx)(a(540336).LZ,{tabs:["Human Readable","JSON"],selectedIndex:t,onChange:i})}),0===t?"active"in e&&"past"in e?(0,d.jsx)(sH,{data:e}):(0,d.jsx)(a(553775).i$,{warnings:["Unexpected response shape — toggle to JSON to inspect."]}):(0,d.jsx)(a(503270).H,{data:e,customCollapsedRenderers:void 0,ignoreUuidPreference:!1})]})},schema:{spaceId:{type:"string",table:"space"}}},adminListAllActiveSubscriptionBanners:{apiName:"adminListAllActiveSubscriptionBanners",displayName:"List Active Subscription Banners",emoji:"🚩",description:"View all active subscription banners. Note, this queries all space shards, so may take some time to run.",schema:{}},adminEmployeeSubscriptionUpdate:{apiName:"adminEmployeeSubscriptionUpdate",displayName:"Employee Subscription Update",description:`This tool enables you to give Notion employees the employee discount.
102			The employee discount includes a free business subscription. If there are any
103			open invoices, this will void them.`,emoji:"💳",schema:{spaceId:{type:"string",table:"space"},withCustomDomainAddOn:{type:"boolean",comment:"Gives one free custom domain add on for employees.",defaultValue:!1}},isDestructive:!0},adminMonetizationTaskRunnerEnqueue:{apiName:"adminMonetizationTaskRunnerEnqueue",displayName:"Finance Team: Enqueue cleanup task",emoji:"🧹",description:"Required column names in CSV depend on the task",schema:{task:{type:"options",options:["Adjust Credit Balance","Zero Credit Balance","Schedule downgrade for end of term","Schedule downgrade immediately","Enable Monthly True Up","Mark invoice uncollectible","Turn auto-collection on","Cleanup pending invoice items","Void invoices","Exclude invoices for dunning","Cancel scheduled downgrade","Set payment method as default","Sync stripe state","Compare billingData load vs fetch (Recent Sample)","Compare billingData load vs fetch (Random Sample)","Migrate Notion Employees to Business","Create timed trial"]},dryRun:{type:"boolean",defaultValue:!1},csv:{type:"file",name:"csv"}}},adminTriggerSubscriptionAuditor:{apiName:"adminTriggerSubscriptionAuditor",displayName:"Trigger Billing Auditor",emoji:"🕑",description:"Trigger an auditor to run immediately",schema:{auditor:{type:"options",options:["uncollectibleCustomersAuditor","paidUpCustomersAuditor","draftInvoicesAuditor","openInvoicesAuditor","autoAdvanceDisabledInvoicesAuditor","billingDataLoadFetchAuditor (Random Sample)","billingDataLoadFetchAuditor (Recent Sample)","aiCreditUtilizationAuditor","priceMigrationAuditor"]},customerId:{type:"string",placeholder:a(591977).cs}}},adminSendOnDemandCreditReportEmail:{apiName:"adminSendOnDemandCreditReportEmail",displayName:"Send On-Demand Credit Report Email",emoji:"📧",description:"⚠️ Primarily for testing and break-glass scenarios — usage reports are sent automatically when Metronome invoices finalize (see handleInvoiceFinalized). Use this tool to send the monthly on-demand credit report email to the billing contacts on a contract. Dry Run (default) returns a preview without sending. Service period auto-derives from the customer's most recent FINALIZED USAGE Metronome invoice if both dates are left blank.",isDestructive:!0,customResponseRenderer:function({data:e}){var t,i;let n;return(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:{...sZ.badge,...e.sent?sZ.badgeSent:sZ.badgeDry},children:e.sent?"Sent":"Dry run"}),(0,d.jsx)(a(111010).D,{styleKey:"captionRegular",children:e.sent?`Email delivered to ${e.recipients.length} recipient(s).`:"No emails were sent. Uncheck Dry Run to deliver."})]}),(0,d.jsxs)(a(4458).VP,{gap:6,style:sZ.card,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",style:sZ.sectionTitle,children:"Billing contract"}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Account:"}),(0,d.jsx)("span",{children:e.billingContract.accountName})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Contract ID:"}),(0,d.jsx)("span",{style:sZ.mono,children:e.billingContract.id})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Exter
103nal ID:"}),(0,d.jsx)("span",{style:sZ.mono,children:e.billingContract.externalId??"(none)"})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Status:"}),(0,d.jsx)("span",{children:e.billingContract.status})]})]}),(0,d.jsxs)(a(4458).VP,{gap:6,style:sZ.card,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",style:sZ.sectionTitle,children:"Service period"}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Period:"}),(0,d.jsx)("span",{children:(t=e.servicePeriod.startMs,i=e.servicePeriod.endMs,n={month:"short",day:"numeric",year:"numeric",timeZone:"UTC"},`${new Date(t).toLocaleString("en-US",n)} → ${new Date(i).toLocaleString("en-US",n)}`)})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Source:"}),(0,d.jsx)("span",{children:"metronome_invoice"===e.servicePeriod.source?`Metronome invoice ${e.servicePeriod.sourceInvoiceId??""}`:"explicit override"})]})]}),(0,d.jsxs)(a(4458).VP,{gap:6,style:sZ.card,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",style:sZ.sectionTitle,children:"On-demand usage"}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Credits in period:"}),(0,d.jsx)("span",{children:e.onDemand.creditsInPeriod.toLocaleString(void 0,{maximumFractionDigits:0,roundingMode:"trunc"})})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Spend:"}),(0,d.jsx)("span",{children:void 0===e.onDemand.spendMinorUnits?"unavailable":iB(e.onDemand.spendMinorUnits,e.onDemand.currency)})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Source:"}),(0,d.jsx)("span",{children:e.onDemand.source})]})]}),(0,d.jsxs)(a(4458).VP,{gap:6,style:sZ.card,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",style:sZ.sectionTitle,children:"Salesforce"}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Contract:"}),(0,d.jsx)("span",{style:sZ.mono,children:e.salesforceContractId})]}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)("span",{style:sZ.label,children:"Invoice:"}),(0,d.jsx)("span",{children:e.salesforceInvoice?`${e.salesforceInvoice.name} (${e.salesforceInvoice.id})`:"(none)"})]})]}),(0,d.jsxs)(a(4458).VP,{gap:6,style:sZ.card,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",style:sZ.sectionTitle,children:`Recipients (${e.recipients.length})`}),(0,d.jsx)(a(4458).VP,{gap:2,children:e.recipients.map(e=>(0,d.jsx)("span",{style:sZ.mono,children:e},e))})]})]})},schema:{metronomeCustomerId:{type:"string",comment:"Metronome customer ID for the billing contract"},servicePeriodStart:{type:"string",comment:"ISO 8601 UTC, e.g. 2026-04-06T00:00:00Z. Leave blank to auto-derive from the latest FINALIZED USAGE Metronome invoice. Must be provided together with End."},servicePeriodEnd:{type:"string",comment:"ISO 8601 UTC, e.g. 2026-05-06T00:00:00Z. Leave blank to auto-derive. Must be provided together with Start."},onDemandCreditsOverride:{type:"number",comment:"Override on-demand credit count instead of fetching from Metronome. Useful for testing."},salesforceContractIdOverride:{type:"string",comment:"Override the Salesforce contract ID used to fetch invoice contacts. Useful when the billing contract's external_id is not a real Salesforce ID."},additionalRecipients:{type:"string",comment:"Comma-delimited extra email addresses appended to (not replacing) the Salesforce Email_Contacts__c list. Useful for routing a test send to yourself. Duplicates of SFDC contacts are ignored. Example: [email protected], [email protected]"},dryRun:{type:"boolean",defaultValue:!0,comment:"When checked (default), returns a preview of recipients and spend without sending any email. Uncheck to actually deliver."}}},adminBulkSendOnDemandCreditReportEmail:{apiName:"adminBulkSendOnDemandCreditReportEmail",displayName:"Bulk Send On-Demand Credit Report Emails",emoji:"📧",description:"⚠️ One-off remediation tool — sends the monthly on-demand credit statement to billing contacts for a list of (Metronome customer, Metronome invoice) pairs. Upload a CSV with columns `METRONOME_CUSTOMER_ID` and `INVOICE_ID`. One row per statement. Defaults to Dry Run (preview only). Each row succeeds or fails independently; the response classifies each as sent / skipped / error.",isDestructive:!0,customResponseRenderer:function({data:e}){let t=e.results.reduce((e,t)=>
103(e[t.outcome]+=1,e),{sent:0,skipped:0,error:0});return(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)("div",{style:sW.summary,children:(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:`${e.totalRequested} row(s): ${t.sent} sent, ${t.skipped} skipped, ${t.error} error${e.dryRun?" (dry run)":""}`})}),e.results.map((e,t)=>(0,d.jsx)(sK,{row:e},`${e.metronomeCustomerId}:${e.invoiceId}:${t}`))]})},schema:{csv:{type:"file",comment:"CSV with header row `METRONOME_CUSTOMER_ID,INVOICE_ID`. One pair per row."},concurrencyLimit:{type:"number",comment:"(Optional) Per-item send concurrency. Defaults to 5; clamped to [1, 10]."},dryRun:{type:"boolean",defaultValue:!0,comment:"When checked (default), returns a preview of per-row outcomes without sending any email. Uncheck to actually deliver."}}},adminRefundInvoice:{apiName:"adminRefundInvoice",displayName:"Refund Stripe Invoices",emoji:"🔍",description:"Refund Stripe Invoices via a Credit Note. Can input either a single invoiceId or a CSV of invoiceIds. If Dry Run is checked, we will create a Preview Credit Note instead of a real Credit Note.",schema:{invoiceId:{type:"string",comment:"Stripe Invoice ID to refund."},csv:{type:"file",comment:"CSV of invoices to refund. Columns must include INVOICE_ID."},memo:{type:"string",comment:"Memo to explain why we are refunding these invoices. This will be added to the credit note."},dryRun:{type:"boolean",comment:"If checked, we will create a Preview Credit Note instead of a real Credit Note."}}},adminSetPaymentMethodTrustLevel:{apiName:"adminSetPaymentMethodTrustLevel",emoji:"🤝",description:"Set the trust level of a payment method",schema:{paymentMethodId:{type:"string",comment:"The id of the payment method in Stripe"},trustLevel:{type:"options",options:["trusted","verifying","untrusted"]},reason:{type:"string",comment:"Document the action taken. Will be added to the payment method's metadata"}}},adminUpsertTrial:{apiName:"adminUpsertTrial",displayName:"Manage Trial (Non-campaign)",emoji:"🔎",description:"Manage Non-campaign Trials (ie, not startup program or similar). Currently only supports creating, ending, and updating trials with no active offers.",schema:{spaceId:{type:"string",table:"space"},customerId:{type:"string",table:s().$2J},createTrialPriceId:{type:"options",options:[...a(126365).C5],comment:"Price ID of the trial"},createTrialEndDate:{type:"date",comment:"End date for the trial creation (in PST)."},endTrialImmediately:{type:"boolean",defaultValue:!1,comment:"End the trial immediately"},updatedTrialEndDate:{type:"date",comment:"New end date for the trial (in PST)."},forceUpdate:{type:"boolean",defaultValue:!1,comment:"DANGEROUS. When true, overrides checks ensuring the account does not have any active offers"},reason:{type:"string",comment:"Reason for the trial update"}}},adminManageStackedTrial:{apiName:"adminManageStackedTrial",displayName:"Manage Stacked Trial",emoji:"🥞",description:"Create, extend, or expire a synthetic stacked Business trial on top of an active paid subscription. Provide either a spaceId or a customerId.",schema:{spaceId:{type:"string",table:"space"},customerId:{type:"string",table:s().$2J},operation:{type:"options",options:["create","extend","expire"],required:!0,isRequired:!0,comment:"Whether to create, extend, or expire the stacked trial"},campaign:{type:"options",options:[...a(994234).X0],comment:"Trial campaign (required when creating)"},trialEndDate:{type:"date",comment:"Trial end date (in PT). Required when creating or extending; optional when expiring."},autoConvert:{type:"boolean",defaultValue:!1,comment:"Auto-convert to paid Business when the trial ends"},externalRequestId:{type:"string",isRequired:!0,comment:"Idempotency / audit key (e.g. Salesforce case ID)"},reason:{type:"string",isRequired:!0,comment:"Reason for the operation"}}},adminGooglePlayRevokeAndRefund:{apiName:"adminGooglePlayRevokeAndRefund",displayName:"Google Play Revoke and Refund Subscription",emoji:"🔄",description:"Revokes a Google Play subscription and issues a refund using the purchase token. Choose between full refund or partial refund options.",productionOnly:!0,schema:{purchaseToken:{type:"string",comment:"The purchase token from Google Play Store"},options:{type:"options",options:["full_refund","partial_refund"],comment:"Refund type: full_refund or partial_refund"}},isDestructive:!0},adminSetEduReverificationTestState:{apiName:"adminSetEduReverificationTestState",displayName:"Set Education re-verification test state",emoji:"🎓",description:"Local and development only. Replaces Education re-verification metadata for one workspace. Use notice-due to open a current cycle, downgrade-due for an expired unverified cycle, verified after completing verification, or already-downgraded after mov
103ing the workspace to Free.",availableEnvironments:["local","development"],isDestructive:!0,schema:{spaceId:{type:"string",name:"Workspace ID",table:"space"},scenario:{type:"options",name:"Scenario",options:["notice-due","downgrade-due","verified","already-downgraded"],defaultValue:"notice-due",required:!0}}}},sQ={adminGetSyncs:{apiName:"adminGetSyncs",displayName:"Get Syncs",emoji:"🔄",description:"Search for syncs by workspace ID, sync ID, or user email.",schema:{query:{type:"string",comment:"Workspace ID (UUID), sync ID (UUID), or user email address."}},customResponseRenderer:a(862582).s},adminGetSyncDetail:{apiName:"adminGetSyncDetail",displayName:"Get Sync Detail",emoji:"🔍",description:"View full sync record, credential, tasks, and health for a sync.",schema:{syncId:{type:"string",comment:"The sync record ID."},spaceId:{type:"string",table:"space",comment:"Workspace ID that owns the sync."}},customResponseRenderer:a(56518)._},adminListUnhealthySyncs:{apiName:"adminListUnhealthySyncs",displayName:"List Unhealthy Syncs",emoji:"⚠️",description:"List all syncs with warning or error health status across all cells.",schema:{limit:{type:"number",numberType:"integer",comment:"Max results to return (default: 100)."}},customResponseRenderer:a(199034).q}},sY={statusBox:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,backgroundColor:a(632079).Tj.background.secondary},statusPill:{borderRadius:999,padding:"4px 10px",fontWeight:a(699422).Wy.semibold},statusPillOk:{color:a(632079).Tj.green.text.accentPrimary,backgroundColor:a(632079).Tj.green.background.primary},statusPillNotOk:{color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.primary},tableWrap:{overflowX:"auto",border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6},table:{width:"100%",borderCollapse:"collapse"},tableHeaderCell:{padding:"8px 10px",borderBlockEnd:`1px solid ${a(632079).Tj.border.primary}`,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontWeight:a(699422).Wy.semibold,textAlign:"start",whiteSpace:"nowrap"},tableCell:{padding:"8px 10px",borderBlockEnd:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top"},teamName:{fontWeight:a(699422).Wy.semibold},teamId:{color:a(632079).Tj.text.tertiary,fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:11,marginTop:2},deltaSummary:{cursor:"pointer",color:a(632079).Tj.blue.text.accentPrimary},deltaJson:{margin:"8px 0 0",padding:10,overflowX:"auto",borderRadius:6,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",fontSize:12,lineHeight:1.4}};function sX(e){let{teamspaces:t}=e;return(0,d.jsx)("div",{style:sY.tableWrap,children:(0,d.jsxs)("table",{style:sY.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{style:sY.tableHeaderCell,children:"Teamspace"}),(0,d.jsx)("th",{style:sY.tableHeaderCell,children:"Legacy"}),(0,d.jsx)("th",{style:sY.tableHeaderCell,children:"Migrated"}),(0,d.jsx)("th",{style:sY.tableHeaderCell,children:"Issues"})]})}),(0,d.jsx)("tbody",{children:t.map(e=>(0,d.jsxs)("tr",{children:[(0,d.jsxs)("td",{style:sY.tableCell,children:[(0,d.jsx)("div",{style:sY.teamName,children:e.teamName}),e.archived?(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:"Archived"}):null,(0,d.jsx)("div",{style:sY.teamId,children:e.teamId})]}),(0,d.jsx)("td",{style:sY.tableCell,children:s0(e.legacy)}),(0,d.jsx)("td",{style:sY.tableCell,children:s0(e.migrated)}),(0,d.jsx)("td",{style:sY.tableCell,children:(0,d.jsxs)("details",{children:[(0,d.jsx)("summary",{style:sY.deltaSummary,children:function(e){let{membershipDeltaCount:t,roleDriftCount:a}=e;return`${t} membership delta${1===t?"":"s"}, ${a} role drift${1===a?"":"s"}`}({membershipDeltaCount:e.delta.length,roleDriftCount:e.roleDrift.length})}),(0,d.jsx)("pre",{style:sY.deltaJson,children:JSON.stringify({membershipDelta:e.delta,roleDrift:e.roleDrift},void 0,2)})]})})]},e.teamId))})]})})}function s0(e){let{memberCount:t,ownerCount:a}=e;return`${t} member${1===t?"":"s"}, ${a} owner${1===a?"":"s"}`}let s1={adminEnableSpacePublicAccess:{apiName:"adminEnableSpacePublicAccess",displayName:"Enable Space Public Access",emoji:"✅",description:"Re-enable publishing sites or public links for a workspace that previously had public access disabled. Requires support ticket link and explanation for audit trail.\n\nNote: Some legacy Plus plan users may have disabled this setting but can't re-enable it due to plan restrictions. We honor requests to re-enable it given the low volume.",schema:{spaceId:{type:"string",table:"space"},supportTicketLink:{type:"string"},explanation:{type:"string",comment:"Why are you enabling public access for this workspace?"}},isDestructive:!0},adminRepairWorkspaceAccessRequestState:{apiName:"adminRepairWorkspaceAccessRequestState",displayName:"Repair workspace access-request state",emoji:"🧹",description:"Repairs inconsistent pending workspace membership and invite requests for users who were removed from the workspace. The approved repair resolves those requests as superseded.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,isRequired:!0,comment:"Workspace whose pending access-request state should be checked."}},isDestructive:!0,requiresHourlyReauth:!0,notinoAction:{actionId:"admin.repair_workspace_access_request_state"}},adminRepairPermissionGroupManagementType:{apiName:"adminRepairPermissionGroupManagementType",displayName:"Update group management type",emoji:"🔄",de
103scription:'Marks selected groups as "Synced". If a group has owners, it may still appear as "User-managed".',schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Workspace (space) ID containing the permission groups."},groupIds:{type:"stringArray",table:s().naB,placeholder:a(591977).nZ,maxItems:500,comment:"Enter one raw SpacePermissionGroup ID per row. Use Add for each additional group; do not enter composite groupId|spaceId record IDs."}},isDestructive:!0,requiresHourlyReauth:!0},adminValidateTeamMembershipMigrationForSpace:{apiName:"adminValidateTeamMembershipMigrationForSpace",displayName:"Validate team membership migration for workspace",emoji:"🔎",description:"Compares legacy and migrated team membership state across all active and archived teams in a workspace.",schema:{spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Workspace (space) ID to validate."}},customResponseRenderer:function(e){var t;let{data:i}=e,n=i.teamspaces.length,{checkedTeamspaceCount:r,activeTeamspaceCount:s,archivedTeamspaceCount:o}=i.summary;return(0,d.jsxs)(a(4458).VP,{gap:16,padding:16,children:[(0,d.jsx)("div",{style:sY.statusBox,children:(0,d.jsxs)(a(4458).fI,{gap:12,alignItems:"center",padding:16,children:[(0,d.jsx)("div",{style:(t=i.summary.ok,{...sY.statusPill,...t?sY.statusPillOk:sY.statusPillNotOk}),children:i.summary.ok?"OK":"Needs debug"}),(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodyMedium",children:function(e){let{affectedTeamspaceCount:t,checkedTeamspaceCount:a}=e;return`${t} of ${a} checked teamspaces with deltas`}({affectedTeamspaceCount:n,checkedTeamspaceCount:r})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:function(e){let{activeTeamspaceCount:t,archivedTeamspaceCount:a}=e;return`${t} active and ${a} archived teamspaces checked. Comparing effective legacy roles to migrated table roles and checking TeamAccessEntity.role is empty.`}({activeTeamspaceCount:s,archivedTeamspaceCount:o})})]})]})}),0===n?(0,d.jsx)(a(111010).D,{styleKey:"bodyRegular",colorVariant:"secondary",children:"No teamspace membership deltas found."}):(0,d.jsx)(sX,{teamspaces:i.teamspaces})]})}}},s4={marginBottom:8},s2=a(764657).object({required:{},optional:{}}),s6={success:"success",failure:"failure",in_progress:"inProgress",not_started:"notStarted"},s9={title:{margin:0,fontSize:24,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},progressText:{fontSize:14,color:a(632079).Tj.text.secondary},progressNumbers:{fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},errorText:{color:a(632079).Tj.red.icon.accentPrimary},splunkQuery:{background:a(632079).Tj.background.secondary,fontSize:12,padding:12,borderRadius:6,fontFamily:"SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace",overflowX:"auto",margin:0},copyButton:{fontSize:12,border:"none",borderRadius:4,width:64,background:a(632079).Tj.background.primary}},s7={success:{color:a(632079).Tj.green.text.accentPrimary},failure:{color:a(632079).Tj.red.text.accentPrimary},in_progress:{color:a(632079).Tj.blue.text.accentPrimary},neutral:{color:a(632079).Tj.text.secondary}},s3={header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:12,paddingBottom:8},blockId:{fontFamily:a(699422).Tf.mono,fontSize:12},extraBlocks:{color:a(632079).Tj.text.secondary,fontSize:12},emptyPlaceholder:{color:a(632079).Tj.text.tertiary},errorCount:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.semibold},userActionPrefix:{fontWeight:a(699422).Wy.medium},userActionDetail:{color:a(632079).Tj.text.secondary,fontSize:12}},s8=["ID","Actor","Status","Source Block","Target Block","Destination Type","Progress","Errors","User Action","Start Time"];function s5(e){return e.intent.jobId}function oe(e){let[t,...a]=e.userAction.split(".");return 0===a.length?(0,d.jsx)("span",{style:s3.userActionPrefix,children:t}):(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{style:s3.userActionPrefix,children:t}),(0,d.jsx)("br",{}),(0,d.jsx)("span",{style:s3.userActionDetail,children:a.join(".")})]})}function ot(e){var t,i,n,r;let{entry:s}=e,{actor:o,intent:l,job:c}=s,p=function(e){var t,a;let i=null==(t=e.job)?void 0:t.status,n=!!(null==(a=e.job)||null==(a=a.options)?void 0:a.preserveTargetBlocksOnFailure);if("not_started"===e.taskQueueStatus&&e.intent.scheduledAt>Date.now())return{message:"scheduled",category:"neutral"};switch(i){case"success":return{message:"success",category:"success"};case"failure":return{message:n?"failure (retryable)":"failure",category:"failure"};case"running":case"pending":return{message:i,category:"in_progress"}}return void 0!==e.taskQueueStatus?{message:`no job, task ${e.taskQueueStatus}`,category:"failure"}:{message:"no job, no task",category:"failure"}}(s),m=function(e){if(!e)return"—";let{completedSubtasks:t,createdSubtasks:a,completedRecords:i,totalRecords:n}=e;return`${t}/${a} subtasks, ${i}/${n} records`}(null==c?void 0:c.progressMetadata),u=null==c||null==(t=c.sourceData)||null==(t=t.blocks[0])?void 0:t.id,h=null==c||null==(i=c.sourceData)?void 0:i.blocks.length,y=null==c||null==(n=c.targetData)||null==(n=n.blockIds)?void 0:n[0],g=null==c||null==(r=c.targetData)||null==(r=r.destination)?void 0:r.type,x=(null==c?void 0:c.errors)??[],f=(null==c?void 0:c.userAction)??"—",b=(null==c?void 0:c.createdAt)??l.scheduledAt;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:{fontFamily:a(699422).Tf.mono},children:s5(s)})}),(0,d.jsx)(aS,{children:(0,d.jsx)(a(553775).uQ,{user:o})}),(0,d.jsx)(aS,{children:(0,d.jsx)("span",{style:{...s7[p.category],fontWeight:a(699422).Wy.semibold},children:p.message})}),(0,d.jsx)(aS,{children:void 0!==u?(0,d.jsxs)("span",{children:[(0,d.jsx)("span",{style:s3.blockId,children:u}),void 0!==h&&h>1?(0,d.jsx)("span",{style:s3.extraBlocks,children:` (+${h-1})`}):void 0]}):(0,d.jsx)("span",{style:s3.emptyPlaceholder,children:"—"})}),(0,d.jsx)(aS,{children:void 0!==y?(0,d.jsx)("span",{style:s3.blockId,children:y}):(0,d.jsx)("span",{style:s3.emptyPlaceholder,children:"—"})}),(0,d.jsx)(aS,{children:g}),(0,d.jsx)(aS,{children:m}),(0,d.jsx)(aS,{children:x.length>0?(0,d.jsx)("span",{style:s3.errorCount,children:x.map(e=>e.code).join(", ")}):(0,d.jsx)("span",{style:s3.emptyPlaceholder,children:"—"})}),(0,d.jsx)(aS,{children:(0,d.jsx)(oe,{userAction:f})}
103),(0,d.jsx)(aS,{children:new Date(b).toLocaleString()})]})}let oa={userId:{type:"string",table:s().oo9,placeholder:a(591977).nZ,comment:"The userId to fix SpaceViews for."},spaceId:{type:"string",table:"space",placeholder:a(591977).nZ,comment:"Optional. If provided, only plans and applies sync operations for this workspace."}},oi={adminSearchUserAdminToolRoles:{apiName:"adminSearchUserAdminToolRoles",displayName:"Find Admin Tool Roles for a User",emoji:"🔎",description:"Fill out just one of the fields below. Returns information what Admin Tool roles the user has.",schema:{userEmail:{type:"string"}}},adminGetPermissionsData:{apiName:"adminGetPermissionsData",displayName:"View Admin Mode Permissions",emoji:"🔐",description:"View all admin mode permission mappings from roles to tools",schema:{}},disableUserAnalytics:{apiName:"disableUserAnalytics",emoji:"👻",description:(0,d.jsx)("p",{children:"Disable/Enable Intercom, Amplitude and Event Trail for a user. The user may need to log out/log in to see changes."}),schema:{userId:{type:"string",table:s().oo9},enableAnalytics:{type:"boolean"}},isDestructive:!0},adminEditBlockPermissions:{apiName:"adminEditBlockPermissions",notinoAction:{actionId:"admin.edit_block_permissions",supportsRevert:!0},displayName:"Edit block permission for a user",emoji:"👀",description:"Updates the the permission for a user on a block. Block must be a navigable block type (page, collection view, or collection).",schema:{blockId:{type:"string",table:"block"},userId:{type:"string",table:s().oo9},role:{type:"options",options:[...a(655338).hV],defaultValue:"none",comment:"Set role to none if you want to remove the user's permission(s) on the block."},force:{type:"boolean",defaultValue:!1,comment:"Set to true to add permissions regardless of space plan type."}},isDestructive:!0},adminEditSpacePermissions:{apiName:"adminEditSpacePermissions",notinoAction:{actionId:"admin.edit_space_permissions",permission:"adminEditSpacePermissions",supportsRevert:!1},displayName:"Edit workspace membership for a user",emoji:"👀",description:"Updates the workspace membership for a user.",schema:{spaceId:{type:"string",table:"space"},userId:{type:"string",table:s().oo9},role:{type:"options",options:[...a(729052).fS],defaultValue:"none",comment:"Set role to none if you want to remove the user's permission(s) on the space."},force:{type:"boolean",defaultValue:!1,comment:"Set to true to add permissions regardless of space plan type."}},isDestructive:!0},adminBulkRemoveSpaceGuests:{apiName:"adminBulkRemoveSpaceGuests",displayName:"Bulk remove internal guests from space",emoji:"❗",description:"Bulk remove internal guests (guests who have the same email domains as the space) above space guest limit per subscription tier, by invite time (oldest first).",schema:{spaceId:{type:"string",table:"space"},targetSubscriptionTier:{type:"options",options:["free",...iY().RZ],comment:"(Optional) Preview guest removal for a self-serve plan, including workspace limit overrides. Requires dryRun=true. Leave empty to use the current plan."},dryRun:{type:"boolean",comment:"If true, previews guest removal without removing anyone. An empty list means no internal guests exceed the evaluated plan's limit.",defaultValue:!0}},isDestructive:!0},adminRemoveGhostGuests:{apiName:"adminRemoveGhostGuests",displayName:"Remove ghost guests from a workspace",emoji:"👻",description:"Finds and removes ghost guests from a workspace: these are users who appear as guests in getVisibleUsers by having an explicit permission item on blocks but don't have a SpaceUser. Use dryRun=true first to preview which users would be removed.",schema:{spaceId:{type:"string",table:"space"},dryRun:{type:"boolean",comment:"(optional) If true, returns ghost guest IDs without removing them",defaultValue:!0}},isDestructive:!0},adminBulkRemoveTeamMembers:{apiName:"adminBulkRemoveTeamMembers",displayName:"Bulk remove team members",emoji:"❗",description:"Bulk remove team members from a team.",schema:{spaceId:{type:"string",table:"space",comment:"Space ID to remove team members from"},teamId:{type:"string",table:"team",comment:"Team ID to remove team members from"},csv:{type:"file",comment:"CSV with USER_IDENTIFIER column containing user IDs or emails"},dryRun:{type:"boolean",comment:"If true, will return a list of users who would have been removed, but will not actually remove them. If the returned list is empty, then the team has no members to remove."}},isDestructive:!0},adminBulkAddUsersToSpace:{apiName:"adminBulkAddUsersToSpace",displayName:"Bulk add users to workspace",emoji:"➕",description:"Add multiple existing users to a workspace with specified role. Users already in the workspace will be skipped. Provide CSV with user IDs or emails.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to add users to"},csv:{type:"file",comment:"CSV with USER_IDENTIFIER column containing user IDs or emails"},role:{type:"options",options:["restricted_member","member","membership_admin","owner"],defaultValue:"member",comment:"Workspace membership role to assign to the added users."}},isDestructive:!0},adminOverridePremiumFeatureAvailability:{apiName:"adminOverridePremiumFeatureAvailability",displayName:"Override internal guests feature availability",emoji:"⚙",description:'Override the "internal_guests" feature availability for Sales Assisted workspaces only. Pass a number to set the internal guests limit, "unlimited" for no limit, or "reset" to remove a previously set override. "internal_guests" controls the number of guests at which a workspace is banned from having further internal guests.',schema:{spaceIds:{type:"string",comment:"Comma separated list of spaceIds to override the feature for (must be Sales Assisted workspaces)"},feature:{type:"options",options:["internal_guests"],comment:'Only the "internal_guests" feature can be overridden'},featureValue:{type:"string",comment:'What value to set the "internal_guests" feature to. Allowed values: a number, "unlimited", or "reset"'}},isDestructive:!0},adminOverrideInternalDomains:{apiName:"adminOverrideInternalDomains",displayName:"Override Internal Domains",emoji:"⚙",description:"Override the list of domains that are considered 'internal' for Guest purpose. You must provide *all* domains that you wish to be 'internal' for this Workspace, any omitted domains will be removed",schema:{spaceId:{type:"string"},domains:{type:"string",comment:"Comma separated list of email domains to consider internal for this Domain"}},isDestructive:!1},adminEditTeamMembership:{apiName:"adminEditTeamMembership",displayName:"Add or remove a user from a teamspace",emoji:"👀",description:"Teamspace must not be a default teamspace.",schema:{teamId:{type:"string",table:"team",comment:"You can find the team ID from the 'team
103s' list in 'Find Space Information'."},userIdToAdd:{type:"string",table:s().oo9,comment:"Can be empty. User will be added as teamspace member."},addedUserRole:{type:"options",options:["member","owner"],defaultValue:"member",comment:"Will give the user the specified role on the teamspace."},userIdToRemove:{type:"string",table:s().oo9,comment:"Can be empty."}},isDestructive:!0,notinoAction:{actionId:"admin.edit_team_membership",permission:"adminEditTeamMembership",supportsRevert:!1}},adminUpdateTeamMember:{apiName:"adminUpdateTeamMember",displayName:"Update a teamspace member's role",emoji:"👀",description:"Change a user from member to admin or vice-versa. If the user is not a member of the team, this will not do anything.",schema:{teamId:{type:"string",table:"team",comment:"You can find the team ID from the 'teams' list in 'Find Space Information'."},userIdToUpdate:{type:"string",table:s().oo9,comment:"User to be modified with the specified role."},userRole:{type:"options",options:["member","owner"],defaultValue:"member",comment:"Will give the user the specified role on the teamspace."}},isDestructive:!0},adminUpdateUserSettings:{apiName:"adminUpdateUserSettings",displayName:"Update a user's settings",emoji:"⚙",description:"This allows us to retrigger onboarding material like modals and tooltip tours that only happen once. Use for testing and QA only!",schema:{userId:{type:"string",table:s().oo9,comment:"User whose settings will be modified."},settingsToUpdate:{type:"string",table:s().xMx,comment:'A JSON object with the keys and corresponding values to be updated. e.g. { "seen_views_intro_modal": false }'}},isDestructive:!0},adminShowCustomerInvoice:{apiName:"adminShowCustomerInvoice",emoji:"🧾",description:(0,d.jsxs)(d.Fragment,{children:["View the notion invoice we show to our customers.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Please input the stripe invoice id of the customer below."]}),schema:{invoiceId:{type:"string"}},isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;return(0,a(101787).US)(t)||t instanceof a(101787).WX?null:t.upcoming?(0,d.jsx)(a(18677).Y,{route:{name:"upcomingInvoice",spaceId:t.spaceId}}):(0,d.jsx)(a(18677).Y,{route:{name:"invoiceById",invoiceId:t.invoiceId}})}},adminGetBulkIds:{apiName:"adminGetBulkIds",displayName:"Get UUIDs with or without dashes",emoji:"🆔",description:"Paste in list of comma or space separated UUIDs to add dashes or remove dashes.",schema:{type:{type:"options",options:["return with dashes","return without dashes"],defaultValue:"return with dashes"},ids:{type:"string"}},isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e;return(0,d.jsx)(a(243119).A,{data:t,ignoreUuidPreference:!0})}},adminAddLinkPreviewToSpace:{apiName:"adminAddLinkPreviewToSpace",displayName:"Add link preview to a space",emoji:"🔗",description:"Allow accessing the specified link preview integration in the specified space ID.",schema:{spaceId:{type:"string",table:"space"},integrationId:{type:"string",table:s().Lij}}},adminQueryCollectionReplay:{apiName:"adminQueryCollectionReplay",displayName:"replay query collection request",emoji:"↺",description:"Used to replay a query collection request for darkreading.",schema:{userId:{type:"string"},serializedRequest:{type:"string"},option:{type:"options",options:["compare-main-and-shadow-service"]}},customResponseRenderer:void 0},adminResetUniqueIdCounter:{apiName:"adminResetUniqueIdCounter",displayName:"Reset unique id counter in a database",emoji:"🆔",description:`If a unique id is deleted, then re-added to a database, the id counter will be reset, causing new pages created to start from 1.
104			This flow can result in duplicate ids within a database. This utility will dedupe ids within a database and set the id counter to the new highest id.`,schema:{pageIdBeforeReset:{type:"string",comment:"The page id of the block before the id counter reset to 1.",table:"block",placeholder:a(591977).nZ},collectionId:{type:"string",table:s().VlP},spaceId:{type:"string",table:"space"},dryRun:{type:"boolean",comment:"If true, running this tool won't modify any data."}},customResponseRenderer:void 0},adminGetSpaceIdsForDeletionDate:{apiName:"adminGetSpaceIdsForDeletionDate",displayName:"Get CSV of Space IDs for Deletion Date",emoji:"🗑",description:"Get CSV of spaceIds for a retention type that should have the deletion job run on the given date.",schema:{retentionType:{type:"options",options:["delete_from_trash","purge"]},dateString:{type:"date",comment:"(Optional) Date. Defaults to today"}},isDestructive:!1},adminFindOrphanedBlocks:{apiName:"adminFindOrphanedBlocks",displayName:"Find orphaned blocks in workspace",description:"Find blocks with user permissions that don't have a valid parent in a workspace. The
104se blocks can cause issues with various user operations, such as removing guests or recovering content for reprovisioned users.",emoji:"🤷",schema:{spaceId:{type:"string",table:"space"}},isDestructive:!1},adminClearFreeChartsForSpace:{apiName:"adminClearFreeChartsForSpace",displayName:"Clear free charts for space",description:"Clear all free charts for a space. This will cause any currently viewable free charts to be paywalled, and allow the user to make a new valid free chart.",emoji:"📊",schema:{spaceId:{type:"string",table:"space",comment:"Id of the workspace"}},isDestructive:!0},adminGetFreeChartsForSpace:{apiName:"adminGetFreeChartsForSpace",displayName:"Get free charts for space",description:"Get all free charts for a space.",emoji:"📉",schema:{spaceId:{type:"string",table:"space",comment:"Id of the workspace"}},isDestructive:!1},adminResetPageContentCoverToLegacy:{apiName:"adminResetPageContentCoverToLegacy",displayName:"Reset page content cover to legacy",description:"Reset a gallery or board cover format to legacy page_content behavior",emoji:"🖼",schema:{collectionViewId:{type:"string",table:s().Gy1,placeholder:a(591977).nZ,comment:"The collection view ID to reset the cover format for"}},isDestructive:!0},adminCreateWorkspaceInRegion:{apiName:"adminCreateWorkspaceInRegion",displayName:"Create Workspace in Region",emoji:"➕",description:"Create a workspace in a specific region or cell. Note that User Ids/User Emails must correspond to existing users in Notion",schema:{userIds:{type:"string",table:s().oo9,comment:"Comma-separated user IDs. The first provided will be used to create workspace, all ids will be owners"},userEmails:{type:"string",comment:"Comma-separated user emails. The first provided will be used to create workspace, all emails will be owners"},name:{type:"string",comment:"Name of the workspace"},planType:{type:"options",options:["team","personal"],defaultValue:"team",comment:"Workspace plan (i.e. personal, team)"},targetWorkspaceRegion:{type:"options",options:Array(...a(775093).b),defaultValue:"eu-central-1",comment:"Region to create the workspace in"},targetCellId:{type:"string",comment:"Optional: exact allocatable cell ID (e.g. prod-space-usw2-0003). If omitted, the system chooses a cell in the selected region."}},customResponseRenderer:function(e){let{data:t}=e,i={fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:8};return"status"in t&&"fail"===t.status?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:i,children:"Error"}),(0,d.jsx)(a(324489).V,{isMultiline:!0,style:s4,children:t.error_msg})]}):(0,d.jsx)(a(243119).A,{data:t})}},adminResetEdgeCache:{apiName:"adminResetEdgeCache",displayName:"Reset edge cache for space or organization",description:"Clears the edge cache(s) for a spaceId or organization. This will enqueue a task that may take up to 30 seconds to refresh the cache. Use this if you suspect the cache is stale.",emoji:"🔄",schema:{spaceId:{type:"string",table:"space"},organizationId:{type:"string",table:s().y75}},isDestructive:!1},deleteBlockPropertiesStaleDataForWorkspace:{apiName:"deleteBlockPropertiesStaleDataForWorkspace",displayName:"Clean up relations to permanently deleted pages in space",emoji:"🧹",description:"Relations to permanently deleted pages show up as No access",isDestructive:!0,schema:{spaceId:{type:"string",comment:"Workspace ID to delete stale block properties data for",table:"space"},collectionId:{type:"string",comment:"Collection ID to delete stale block properties data for",table:s().VlP}},customResponseRenderer:function(e){let{data:t}=e,i=(0,a(533992).v3)(),n=t.queue2TaskOutputs,s=(null==n?void 0:n.length)??t.taskIds.length,[o,l]=(0,r.useState)(0),[c,p]=(0,r.useState)(void 0),[m,u]=(0,r.useState)(0),[h,y]=(0,r.useState)(!1),[g,x]=(0,r.useState)(!1),f=o===s,b=m>5,v=(0,r.useCallback)(async()=>{let e=await i.api.callApi({eventName:"getTasks",environment:i,data:{taskIds:t.taskIds}});if("failed"===e.type)return void u(e=>e+1);u(0);let a={success:0,failure:0,inProgress:0,notStarted:0};return e.data.results.forEach(e=>{let t=s6[e.state];a[t]+=1}),a},[t.taskIds,i]);(0,r.useEffect)(()=>
104{l(0),p(void 0),u(0),y(!1)},[t]),(0,r.useEffect)(()=>{if(b)return;if(l(0),p(void 0),y(!1),void 0!==n){let e=new Map,t=(t,a)=>{e.set(t,a);let i={success:0,failure:0,inProgress:0,notStarted:n.length-e.size};for(let t of e.values())i[t]+=1;l(i.success+i.failure),p(i)};p({success:0,failure:0,inProgress:0,notStarted:n.length});let a=new AbortController;for(let e of n)(0,nP().cK)({environment:i,outputKey:e.outputKey,spaceId:e.spaceId,outputValidator:s2,signal:a.signal,onChange:a=>(t(e.outputKey,s6[a.status]),(0,nP().W$)(a))}).catch(()=>{a.signal.aborted||u(6)});return()=>{a.abort()}}if(s>1e3)return void y(!0);let e=setInterval(async()=>{let t=await v();if(!t)return;let a=t.success+t.failure;l(a),p(t),a===s&&clearInterval(e)},5e3);return()=>{clearInterval(e)}},[i,v,b,n,s]);let j=h?`Tasks submitted, but too many tasks (${s}) to track –\xa0good luck, check back tomorrow 🫡`:b?"Unable to find status":f?`✅ Stale data has been cleaned up for ${o} ${1===o?"collection":"collections"}`:`Stale data is being cleaned up for ${s} ${1===s?"collection":"collections"}...`,k=`index="application" rootEventName="deleteBlockPropertiesStaleDataForWorkspace" data.source="adminMode" data.adminToolRequestId="${t.adminToolRequestId}"`,S=`https://notion.splunkcloud.com/en-US/app/search/search?earliest=-3h%40h&latest=now&q=search%20index%3D%22application%22%20rootEventName%3D%22deleteBlockPropertiesStaleDataForWorkspace%22%20data.source%3D%22adminMode%22%20data.adminToolRequestId%3D%22${t.adminToolRequestId}%22&display.page.search.mode=smart&dispatch.sample_ratio=1&workload_pool=`;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(45062).A,{title:j}),(0,d.jsxs)(a(4458).VP,{gap:16,padding:24,children:[(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:12,children:[(0,d.jsx)("h2",{style:s9.title,children:j}),f||b||h?void 0:(0,d.jsx)(a(517334).k,{size:12})]}),h?void 0:(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsxs)("div",{style:s9.progressText,children:[(0,d.jsx)("span",{children:"Completed: "}),(0,d.jsxs)("span",{style:s9.progressNumbers,children:[o," / ",s]})]}),(0,d.jsx)("div",{style:s9.progressText,children:(0,d.jsxs)("span",{children:["---Breakdown---"," ",f?void 0:(0,d.jsx)(a(517334).k,{size:12})]})}),c?(0,d.jsx)(d.Fragment,{children:Object.entries(c).map(([e,t])=>(0,d.jsxs)("div",{style:s9.progressText,children:[(0,d.jsxs)("span",{children:[e,": "]}),(0,d.jsx)("span",{style:s9.progressNumbers,children:t})]},e))}):void 0]}),(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{children:["Check the status in ",(0,d.jsx)("a",{href:S,children:"Splunk."})," Be sure to save this link or query for later reference."]}),(0,d.jsxs)(a(4458).fI,{gap:4,marginTop:16,children:[(0,d.jsx)("pre",{style:s9.splunkQuery,children:k}),(0,d.jsx)("button",{type:"button",style:s9.copyButton,onClick:async()=>{await navigator.clipboard.writeText(k),x(!0),setTimeout(()=>x(!1),1e3)},"aria-label":"Copy query to clipboard",children:g?"Copied!":"Copy"})]})]}),b?(0,d.jsxs)("div",{style:{...s9.progressText,...s9.errorText},children:["Failed to poll for status after ",5," attempts"]}):void 0]})]})}},adminSyncCollectionRelation:{apiName:"adminSyncCollectionRelation",displayName:"Sync collection relation (append-only)",emoji:"🔄",description:"Fixes a two-way relation that is out of sync, using the given side as the source of truth (this means you should pass in the side that is correct, not the side that is missing values). Enqueues a background task that syncs source → target in append-only mode (only adds missing entries, never deletes). Results (including the list of operations for dry runs) will be emailed to you when the task completes.",schema:{collectionId:{type:"string",comment:"ID of the source collection.",isRequired:!0},spaceId:{type:"string",comment:"Space ID of the source collection.",isRequired:!0},propertyId:{type:"string",comment:'Property ID of the two-way relation to sync. Use "Property Name" instead if you don\'t know the ID.'},propertyName:{type:"string",comment:'Human-readable name of the two-way relation property to sync. Use this instead of "Property Id" if you don\'t know the ID. Errors if the name matches multiple tw
104o-way relations (disambiguate with "Property Id" in that case).'},dryRun:{type:"boolean",defaultValue:!1,comment:"If true, simulates the sync without making changes."}},isDestructive:!0},adminSyncSpaceViews:{apiName:"adminSyncSpaceViews",displayName:"Sync SpaceViews for User",emoji:"🔀",description:"Sync a user's SpaceViews with their access. This keeps or adds alive SpaceViews when the user has an active SpaceUser role or public share link pages, kills/removes SpaceViews only when neither access path exists, revives or creates SpaceViews for active SpaceUsers, sets joined on active SpaceUser SpaceViews with public share link pages, and unsets joined on share-link-only SpaceViews for spaces the user is no longer a member or guest of, so they stop showing up in the workspace switcher.",schema:{...oa,dryRun:{type:"boolean",defaultValue:!0,comment:"If true, no changes will be made and the proposed operations will be returned."}},isDestructive:!0,notinoAction:{actionId:"admin.sync_space_views",schema:oa}},adminMarkNotificationsRead:{apiName:"adminMarkNotificationsRead",displayName:"Mark Notifications as Read",emoji:"🧹",description:"Mark notifications as read for a user. You can either provide specific notification IDs (comma-separated) OR a date to mark all notifications older than that date. When using olderThanDate, marks up to 100 notifications per space.",schema:{userIdOrEmail:{type:"string",comment:"User ID or email",table:s().oo9},spaceId:{type:"string",comment:"(optional) Filter by spaceId",table:"space"},notificationIds:{type:"string",comment:"(option A) Comma-separated list of notification IDs to mark as read"},olderThanDate:{type:"date",comment:"(option B) Mark all unread notifications older than this date."}}},adminQueryDuplicationJobs:{apiName:"adminQueryDuplicationJobs",displayName:"Query Duplication Jobs",emoji:"📋",description:"Look up recent duplication jobs by user within a specific workspace.",schema:{spaceId:{type:"string",table:"space",comment:"Space ID where the duplication was initiated"},userIdOrEmail:{type:"string",table:s().oo9,comment:"(Optional) User ID or email who started the duplication job. Must be a user, not an automation. Leave blank to show Admin-initiated jobs"},statusFilter:{type:"options",options:["pending","running","failure","success"],comment:"(Optional) Filter by job status"},startDate:{type:"datetimeISO",comment:"(Optional) Start datetime, inclusive"},endDate:{type:"datetimeISO",comment:"(Optional) End datetime, inclusive"},limit:{type:"number",defaultValue:5,comment:"(Optional) Max results, up to 100"}},isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e,{jobs:a}=t;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:s3.header,children:"Duplication Jobs"}),(0,d.jsx)(aI,{columns:s8,items:a,getItemId:s5,getItemJson:e=>e,renderRow:e=>(0,d.jsx)(ot,{entry:e}),emptyMessage:"No duplication jobs found."})]})}},adminScheduleDuplication:{apiName:"adminScheduleDuplication",displayName:"Schedule Duplication Job",emoji:"⏰",isDestructive:!0,description:"Run or schedule a block duplication job.",schema:{sourceSpaceId:{type:"string",table:"space",comment:"Space ID of the source block"},sourceBlockId:{type:"string",table:"block",comment:"Block ID to duplicate"},targetSpaceId:{type:"string",table:"space",comment:"Space ID of the destination"},destinationType:{type:"options",options:["block","team"],comment:"Type of destination: block (page) or teamspace"},destinationId:{type:"string",comment:"ID of the destination (block ID or team ID depending on destinationType)"},scheduledDateTime:{type:"datetimeISO",comment:"Time to start the duplication. Must be within 7 days. Leave blank to start immediately."},maximumFailedSubtasks:{type:"number",numberType:"integer",min:1,comment:"Max failed subtasks before aborting. Enables partial failure support. Leave blank to fail cleanly on any error."},copyBlockPermissions:{type:"boolean",defaultValue:!1,comment:"If true, copy block-level permissions from source to target, filtered to comply with the target space's security settings."}}},adminRetryDuplication:{apiName:"adminRetryDuplication",displayName:"Retry Failed Duplication Job",emoji:"🔄",isDestructive:!0,description:"Retry a failed duplication job. The job must have been run with partial failure support enabled.",schema:{jobId:{type:"string",comment:"Job ID of the failed duplication job (You can use Query Duplication Jobs to find this)"},sourceSpaceId:{type:"string",table:"space",comment:"Source space ID"}}},adminBootstrapNboUserProfile:{apiName:"adminBootstrapNboUserProfile",displayName:"NBO - User Lifecycle Profile",description:"Get or regenerate a user's lifecycle profile in DynamoDB. 'get' reads the current profile; 'generate_and_set' builds from Postgres and overwrites; 'set_profile' writes a custom JSON profile.",emoji:"📊",schema:{userId:{type:"string",comment:"User ID to look up or bootstrap a lifecycle profile for",table:s().oo9},action:{type:"options",comment:"'get' reads the current profile, 'generate_and_set' builds from Postgres and writes, 'set_profile' writes a custom JSON profile",options:["get","generate_and_set","set_profile"],defaultValue:"get"},profileJson:{type:"json",comment:"JSON blob matching AnalyticsLifecycleUserProfile schema. Required when action is 'set_profile'.",defaultValue:"{}",visibleWhen:{field:"action",value:"set_profile"}}},isDestructive:!0},adminEnqueueAutoOutboundEnrollmentCron:{apiName:"adminEnqueueAutoOutboundEnrollmentCron",displayName:"NBO - Run Auto-Outbound Enrollment Cron",de
104scription:"Enqueue an on-demand auto-outbound enrollment cron run for today's UTC date. The task handler still respects the enable_auto_outbound_enrollment kill switch.",emoji:"📤",schema:{},isDestructive:!1},adminBulkArchiveCollectionPages:{apiName:"adminBulkArchiveCollectionPages",displayName:"Bulk archive database rows",emoji:"🗄️",description:"Archives rows in a database that has grown too large. Enter the space and database IDs, then choose how many rows to archive (up to 25,000), which end of the database to archive from, and optionally an automation that created the rows.",schema:{spaceId:{type:"string",comment:"ID of the space (workspace) that contains the database.",isRequired:!0},collectionId:{type:"string",comment:"ID of the database to archive rows from.",isRequired:!0},limit:{type:"number",numberType:"integer",defaultValue:25e3,min:1,max:25e3,comment:"How many rows to archive (up to 25,000)."},archiveMethod:{type:"options",options:[{displayName:"Oldest first (by creation time)",value:"oldestFirst"},{displayName:"Newest first (by creation time)",value:"newestFirst"}],defaultValue:"oldestFirst",required:!0,comment:"Which rows to archive. Oldest first is the usual choice; newest first is for databases pushed over the limit by a recent bulk import.",isRequired:!0},rowCreationFilter:{type:"options",name:"Rows to archive",options:[{displayName:"All rows",value:"allRows"},{displayName:"Bot-created rows",value:"botCreated"},{displayName:"Rows created by a specific automation",value:"specificAutomation"}],defaultValue:"allRows",required:!0,isRequired:!0,comment:"Optionally restrict rows by their creation attribution. Bot-created rows includes integrations and server-side automations, but not button automations attributed to the person who clicked."},automationId:{type:"string",table:s().yBS,visibleWhen:{field:"rowCreationFilter",value:"specificAutomation"},isRequired:!0,comment:"Among the first 25,000 eligible rows in the selected ordering, archive rows whose creation activity was attributed to this automation ID. The archived count may be lower than requested."}},isDestructive:!0}},on={container:{fontFamily:a(699422).Tf.mono,fontSize:13},header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:12,paddingBottom:8,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},section:{marginBottom:16},sectionTitle:{fontWeight:a(699422).Wy.semibold,fontSize:14,marginBottom:8,cursor:"pointer",display:"flex",alignItems:"center",gap:8},metadataGrid:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"4px 12px",marginBottom:16},metadataLabel:{color:a(632079).Tj.text.secondary},metadataValue:{fontFamily:a(699422).Tf.mono},metadataLabelError:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.semibold},metadataValueError:{fontFamily:a(699422).Tf.mono,color:a(632079).Tj.red.text.accentPrimary,fontSize:11},typeErrorBadge:{color:a(632079).Tj.orange.text.accentPrimary,backgroundColor:a(632079).Tj.orange.background.secondary,padding:"2px 6px",borderRadius:4,fontSize:11,marginInlineStart:8},treeContainer:{paddingInlineStart:0},treeNode:{marginBottom:4},treeNodeHeader:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",padding:"4px 8px",borderRadius:4},treeNodeHeaderHover:{backgroundColor:a(632079).Tj.background.secondary},treeNodeToggle:{width:16,textAlign:"center",color:a(632079).Tj.text.secondary},treeNodeClickable:{cursor:"pointer",display:"inline-flex",alignItems:"baseline",gap:4,padding:"2px 4px",borderRadius:4},treeNodeClickableHover:{backgroundColor:a(632079).Tj.red.background.secondary},treeNodeType:{color:a(632079).Tj.text.primary,fontWeight:a(699422).Wy.medium},treeNodeId:{color:a(632079).Tj.text.secondary,fontSize:11},treeNodeMetadata:{padding:"8px 12px",marginInlineStart:24,backgroundColor:a(632079).Tj.background.secondary,borderRadius:4,fontSize:12},treeChildren:{marginInlineStart:20},recordList:{maxHeight:400,overflow:"auto",border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4},recordItem:{padding:"8px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,cursor:"pointer"},recordItemHover:{backgroundColor:a(632079).Tj.background.secondary},collapseIcon:{transition:"transform 0.2s"}
104,expandedIcon:{transform:"rotate(90deg)"},deletedBadge:{color:a(632079).Tj.red.text.accentPrimary},treeNodeIdClickable:{cursor:"pointer"},metadataContainer:{marginTop:8,paddingInlineStart:24}};function or(e){return void 0===e?"N/A":new Date(e).toLocaleString()}function os(e){let{node:t,level:i}=e,[n,s]=(0,r.useState)(i<2),[o,l]=(0,r.useState)(!1),[c,p]=(0,r.useState)(!1),[m,u]=(0,r.useState)(!1),h=t.childrenNodes.length>0,y=()=>s(!n),g=()=>l(!o),x={...on.treeNodeHeader,...c?on.treeNodeHeaderHover:{}},f={...on.treeNodeClickable,...m?on.treeNodeClickableHover:{}};return(0,d.jsxs)("div",{style:on.treeNode,children:[(0,d.jsxs)("div",{style:x,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),children:[(0,d.jsx)("span",{role:h?"button":void 0,tabIndex:h?0:void 0,style:{...on.treeNodeToggle,...on.collapseIcon,...n&&h?on.expandedIcon:{}},onClick:h?y:void 0,onKeyDown:h?e=>{("Enter"===e.key||" "===e.key)&&y()}:void 0,children:h?"▶":"·"}),(0,d.jsxs)("span",{role:"button",tabIndex:0,style:f,onClick:g,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&g()},children:[(0,d.jsx)("span",{style:on.treeNodeType,children:t.type??t.table}),(0,d.jsx)("span",{style:on.treeNodeId,children:(0,d.jsx)(a(137691).x5,{value:t.id})})]}),!1===t.metadata.alive?(0,d.jsx)("span",{style:on.deletedBadge,children:"(deleted)"}):void 0,void 0!==t.metadata.typeErrors&&t.metadata.typeErrors.length>0?(0,d.jsxs)("span",{style:on.typeErrorBadge,children:["⚠ ",t.metadata.typeErrors.length," type error",t.metadata.typeErrors.length>1?"s":""]}):void 0]}),o?(0,d.jsx)("div",{style:on.treeNodeMetadata,children:(0,d.jsx)(ol,{metadata:t.metadata})}):void 0,n&&h?(0,d.jsx)("div",{style:on.treeChildren,children:t.childrenNodes.map(e=>(0,d.jsx)(os,{node:e,level:i+1},e.id))}):void 0]})}let oo="undefined";function ol(e){let{metadata:t}=e;return(0,d.jsxs)("div",{style:on.metadataGrid,children:[(0,d.jsx)("span",{style:on.metadataLabel,children:"ID:"}),(0,d.jsx)("span",{style:on.metadataValue,children:(0,d.jsx)(a(137691).x5,{value:t.id})}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Table:"}),(0,d.jsx)("span",{style:on.metadataValue,children:t.table}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Type:"}),(0,d.jsx)("span",{style:on.metadataValue,children:t.type??oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Version:"}),(0,d.jsx)("span",{style:on.metadataValue,children:t.version??oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Alive:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.alive?t.alive?"Yes":"No":oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Parent ID:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.parentId?(0,d.jsx)(a(137691).x5,{value:t.parentId}):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Parent Table:"}),(0,d.jsx)("span",{style:on.metadataValue,children:t.parentTable??oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Created:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.createdTime?or(t.createdTime):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Last Edited:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.lastEditedTime?or(t.lastEditedTime):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Created By:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.createdById?(0,d.jsx)(a(137691).x5,{value:t.createdById}):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Last Edited By:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.lastEditedById?(0,d.jsx)(a(137691).x5,{value:t.lastEditedById}):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Space ID:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.spaceId?(0,d.jsx)(a(137691).x5,{value:t.spaceId}):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Collection ID:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.collectionId?(0,d.jsx)(a(137691).x5,{value:t.collectionId}):oo}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Children:"}),(0,d.jsx)("span",{style:on.metadataValue,children:void 0!==t.content&&t.content.length>0?`${t.content.length} blocks`:oo}),void 0!==t.typeErrors&&t.typeErrors.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:on.metadataLabelError,children:"Type Errors:"}),(0,d.jsx)("span",{style:on.metadataValueError,children:t.typeErrors.map((e,t)=>(0,d.jsxs)("div",{children:[e.field,": expected ",e.expectedType,", got"," ",e.actualValue]},t))})]}):void 0]})}function od(e){let{title:t,count:a,children:i,defaultExpanded:n=!0}=e,[s,o]=(0,r.useState)(n);return(0,d.jsxs)("div",{style:on.section,children:[(0,d.jsxs)("div",{role:"button",tabIndex:0,style:on.sectionTitle,onClick:()=>o(!s),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&o(!s)},children:[(0,d.jsx)("span",{style:{...on.collapseIcon,...s?on.expandedIcon:{}},children:"▶"}),t,void 0!==a?` (${a})`:void 0]}),s?i:void 0]})}function oc(e){let{data:t}=e,{snapshotMetadata:i,tree:n,records:r}=t;return(0,d.jsxs)("div",{style:on.container,children:[(0,d.jsx)("div",{style:on.header,children:"Snapshot Content Viewer"}),(0,d.jsx)(od,{title:"Snapshot Metadata",children:(0,d.jsxs)("div",{style:on.metadataGrid,children:[(0,d.jsx)("span",{style:on.metadataLabel,children:"Parent Table:"}),(0,d.jsx)("span",{style:on.metadataValue,children:i.parentTable}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Parent ID:"}),(0,d.jsx)("span",{style:on.metadataValue,children:(0,d.jsx)(a(137691).x5,{value:i.parentId})}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Space ID:"}),(0,d.jsx)("span",{style:on.metadataValue,children:(0,d.jsx)(a(137691).x5,{value:i.spaceId})}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Timestamp:"}),(0,d.jsxs)("span",{style:on.metadataValue,children:[or(i.timestamp)," (",i.timestamp,")"]}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Key Schema Version:"}),(0,d.jsx)("span",{style:on.metadataValue,children:i.keySchemaVersion}),(0,d.jsx)("span",{style:on.metadataLabel,children:"Total Records:"}),(0,d.jsx)("span",{style:on.metadataValue,children:i.totalRecords})]})}),(0,d.jsx)(od,{title:"Page Tree Structure",count:n.length,children:(0,d.jsx)("div",{style:on.treeContainer,children:n.map(e=>(0,d.jsx)(os,{node:e,level:0},e.id))})}),(0,d.jsx)(od,{title:"All Records",count:r.length,defaultExpanded:!1,children:(0,d.jsx)("div",{style:on.recordList,children:r.map(e=>(0,d.jsx)(op,{record:e},e.id))})})]})}function op(e){let{record:t}=e,[i,n]=(0,r.useState)(!1),[s,o]=(0,r.useState)(!1),l={...on.recordItem,...s?on.recordItemHover:{}};return(0,d.jsxs)("div",{role:"button",tabIndex:0,style:l,onClick:()=>n(!i),onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&n(!i)},onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),children:[(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,d.jsx)("span",{style:{...on.collapseIcon,...i?on.expandedIcon:{}},children:"▶"}),(0,d.jsx)("span",{style:on.treeNodeType,children:t.type??t.table}),(0,d.jsx)("span",{style:{...on.treeNodeId,...on.treeNodeIdClickable},children:(0,d.jsx)(a(137691).x5,{value:t.id})}),!1===t.alive?(0,d.jsx)("span",{style:on.deletedBadge,children:"(deleted)"}):void 0]}),i?(0,d.jsx)("div",{style:on.metadataContainer,children:(0,d.jsx)(ol,{metadata:t})}):void 0]})}let om={container:{fontFamily:a(699422).Tf.mono,fontSize:13},header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:12,paddingBottom:8,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},snapshotItem:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,cursor:"pointer"},snapshotItemHover:{backgroundColor:a(632079).Tj.background.tertiary},snapshotTimestamp:{fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary},snapshotMeta:{fontSize:11,color:a(632079).Tj.text.secondary},viewButton:{padding:"6px 12px",backgroundColor:a(632079).Tj.blue.background.accentPrimary,color:a(632079).Tj.white,borderRadius:4,border:"none",cursor:"pointer",fontWeight:a(699422).Wy.medium,fontSize:12},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary},errorText:{fontSize:11,color:a(632079).Tj.red.text.accentPrimary},backButton:{padding:"8px 16px",backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary,borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,cursor:"pointer",fontWeight:a(699422).Wy.medium,fontSize:12,marginBottom:16}};function ou(e){let t,i,n,s,o,{snapshot:l,parentTable:c,parentId:p,spaceId:m,environment:u,onViewSnapsh
104ot:h}=e,[y,g]=(0,r.useState)(!1),[x,f]=(0,r.useState)(!1),[b,v]=(0,r.useState)(void 0),j={...om.snapshotItem,...y?om.snapshotItemHover:{}},k=async()=>{f(!0),v(void 0);try{let e=await u.api.callApi({eventName:"adminViewSnapshot",environment:u,data:{parentTable:c,parentId:p,spaceId:m,timestamp:l.timestamp,keySchemaVersion:l.keySchemaVersion}});if("success"===e.type)h(e.data);else{let t=e.body,a=null!==t&&"object"==typeof t&&"message"in t&&"string"==typeof t.message?t.message:"Failed to load snapshot";v(a)}}catch(e){v(e instanceof Error?e.message:"Failed to load snapshot")}finally{f(!1)}};return(0,d.jsxs)("div",{style:j,onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)("span",{style:om.snapshotTimestamp,children:(n=(i=-(t=new Date(l.timestamp)).getTimezoneOffset()/60)>=0?"+":"",s=i%1==0?i.toString():i.toFixed(1),o=`UTC${n}${s}`,`${t.toLocaleString()} ${o}`)}),(0,d.jsxs)("span",{style:om.snapshotMeta,children:["Timestamp: ",l.timestamp," | Version: ",l.version," | Key Schema: ",l.keySchemaVersion]}),b?(0,d.jsx)("span",{style:om.errorText,children:b}):void 0]}),(0,d.jsx)("button",{type:"button",style:om.viewButton,onClick:k,disabled:x,children:x?(0,d.jsx)(a(517334).k,{size:12}):"View Snapshot"})]})}function oh(e){let{data:t}=e,{snapshots:i}=t,n=(0,a(533992).v3)(),[s,o]=(0,r.useState)(void 0),l=new URLSearchParams(window.location.search),c="collection"===(t.parentTable??l.get("parentTable")??"block")?"collection":"block",p=t.parentId??l.get("parentId")??"",m=t.spaceId??l.get("spaceId")??"";return s?(0,d.jsxs)("div",{style:om.container,children:[(0,d.jsx)("button",{type:"button",style:om.backButton,onClick:()=>o(void 0),children:"← Back to Snapshot List"}),(0,d.jsx)(oc,{data:s})]}):0===i.length?(0,d.jsxs)("div",{style:om.container,children:[(0,d.jsx)("div",{style:om.header,children:"Available Snapshots"}),(0,d.jsx)("div",{style:om.emptyState,children:"No snapshots found for this record."})]}):(0,d.jsxs)("div",{style:om.container,children:[(0,d.jsxs)("div",{style:om.header,children:["Available Snapshots (",i.length,")"]}),(0,d.jsx)(a(4458).VP,{gap:8,children:i.map(e=>(0,d.jsx)(ou,{snapshot:e,parentTable:c,parentId:p,spaceId:m,environment:n,onViewSnapshot:o},e.id))})]})}let oy={container:{fontFamily:a(699422).Tf.mono,fontSize:13},banner:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",backgroundColor:a(632079).Tj.green.background.secondary,borderRadius:8,border:`1px solid ${a(632079).Tj.green.border.secondary}`,marginBottom:16},bannerRateLimited:{backgroundColor:a(632079).Tj.yellow.background.secondary,border:`1px solid ${a(632079).Tj.yellow.border.secondary}`},bannerIcon:{fontSize:20},bannerText:{flex:1},bannerTitle:{fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:2},bannerSubtitle:{color:a(632079).Tj.text.secondary,fontSize:12},section:{marginBottom:16},sectionLabel:{fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.secondary,fontSize:11,textTransform:"uppercase",letterSpacing:"0.05em",marginBottom:6},metaGrid:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"4px 8px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:6,padding:"10px 14px"},metaKey:{color:a(632079).Tj.text.secondary,fontSize:12},metaValue:{color:a(632079).Tj.text.primary,fontSize:12,wordBreak:"break-all"},recordRow:{display:"flex",alignItems:"center",gap:8,padding:"8px 14px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:6},recordTable:{padding:"2px 6px",backgroundColor:a(632079).Tj.blue.background.secondary,color:a(632079).Tj.blue.text.accentPrimary,borderRadius:3,fontSize:11,fontWeight:a(699422).Wy.medium},recordId:{color:a(632079).Tj.text.secondary,fontSize:12},viewButton:{padding:"8px 16px",backgroundColor:a(632079).Tj.blue.background.accentPrimary,color:a(632079).Tj.white,borderRadius:6,border:"none",cursor:"pointer",fontWeight:a(699422).Wy.medium,fontSize:13},viewButtonDisabled:{opacity:.5,cursor:"not-allowed"},errorText:{fontSize:12,color:a(632079).Tj.red.text.accentPrimary,marginTop:4}},og={container:{fontFamily:a(699422).Tf.mono,fontSize:13},header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:12,paddingBottom:8,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},metaGrid:{display:"grid",gridTemplateColumns:"140px 1fr",gap:"4px 12px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:6,padding:"10px 14px",marginBottom:16},metaKey:{color:a(632079).Tj.text.secondary},metaValue:{color:a(632079).Tj.text.primary,wordBreak:"break-all"},rowCard:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8,padding:12,marginBottom:12,backgroundColor:a(632079).Tj.background.primary},rowTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:8},fieldGrid:{display:"grid",gridTemplateColumns:"160px 1fr",gap:"4px 10px"},fieldName:{color:a(632079).Tj.text.secondary},fieldValue:{color:a(632079).Tj.text.primary,wordBreak:"break-all",whiteSpace:"pre-wrap"},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary},paginationText:{color:a(632079).Tj.text.secondary}},ox=[{label:"PK",getValue:e=>e.pk},{label:"SK",getValue:e=>e.sk},{label:"Timestamp",getValue:e=>(function(e){if(void 0===e)return;let t=/^(\d{13})(#|$)/.exec(e);if(null===t)return;let a=Number(t[1]);return Number.isFinite(a)?new Date(a).toISOString():void 0})(e.sk)},{label:"CI",getValue:e=>e.ci},{label:"CT",getValue:e=>e.ct},{label:"Author table",getValue:e=>e.authorTable},{label:"Author ID",getValue:e=>e.authorId},{label:"Author space ID",getValue:e=>e.authorSpaceId},{label:"Space ID",getValue:e=>e.spaceId},{label:"TTL",getValue:e=>e.ttl},{label:"Payload base64",getValue:e=>e.payloadBase64}];function of(e){var t,i,n,s,o,l;let{data:c}=e,[p,m]=r.useState(0);r.useEffect(()=>{m(0)},[c.queryExecutionId]);let u=Math.max(1,Math.ceil(c.rows.length/200)),h=Math.min(p,u-1),y=200*h,g=Math.min(y+200,c.rows.length),x=r.useMemo(()=>c.rows.slice(y,g),[c.rows,g,y]),f=r.useCallback(()=>{m(e=>Math.max(e-1,0))},[]),b=r.useCallback(()=>{m(e=>Math.min(e+1,u-1))},[u]);return(0,d.jsxs)("div",{style:og.container,children:[(0,d.jsx)("div",{style:og.header,children:"Record Snapshot Athena Results"}
104),(0,d.jsxs)("div",{style:og.metaGrid,children:[(0,d.jsx)("span",{style:og.metaKey,children:"Data source"}),(0,d.jsx)("span",{style:og.metaValue,children:c.dataSource}),(0,d.jsx)("span",{style:og.metaKey,children:"Query execution ID"}),(0,d.jsx)("span",{style:og.metaValue,children:c.queryExecutionId}),(0,d.jsx)("span",{style:og.metaKey,children:"Query limit"}),(0,d.jsx)("span",{style:og.metaValue,children:c.effectiveLimit}),(0,d.jsx)("span",{style:og.metaKey,children:"App total time"}),(0,d.jsxs)("span",{style:og.metaValue,children:[c.totalQueryTimeMs," ms"]}),void 0!==c.resultFetchMethod?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{style:og.metaKey,children:"Result fetch method"}),(0,d.jsx)("span",{style:og.metaValue,children:c.resultFetchMethod})]}):void 0,(0,d.jsx)("span",{style:og.metaKey,children:"Result fetch time"}),(0,d.jsxs)("span",{style:og.metaValue,children:[c.resultFetchTimeMs," ms"]}),(0,d.jsx)("span",{style:og.metaKey,children:"Result parse time"}),(0,d.jsxs)("span",{style:og.metaValue,children:[c.resultParseTimeMs," ms"]}),(0,d.jsx)("span",{style:og.metaKey,children:"Result pages"}),(0,d.jsx)("span",{style:og.metaValue,children:c.resultPageCount}),(0,d.jsx)("span",{style:og.metaKey,children:"Athena result reused"}),(0,d.jsx)("span",{style:og.metaValue,children:void 0===(o=null==(t=c.athenaStatistics)?void 0:t.resultReused)?"unknown":o?"yes":"no"}),(0,d.jsx)("span",{style:og.metaKey,children:"Athena total time"}),(0,d.jsx)("span",{style:og.metaValue,children:ob(null==(i=c.athenaStatistics)?void 0:i.totalExecutionTimeMs)}),(0,d.jsx)("span",{style:og.metaKey,children:"Athena engine time"}),(0,d.jsx)("span",{style:og.metaValue,children:ob(null==(n=c.athenaStatistics)?void 0:n.engineExecutionTimeMs)}),(0,d.jsx)("span",{style:og.metaKey,children:"Data scanned"}),(0,d.jsx)("span",{style:og.metaValue,children:void 0===(l=null==(s=c.athenaStatistics)?void 0:s.dataScannedBytes)?"unknown":`${l} bytes`}),(0,d.jsx)("span",{style:og.metaKey,children:"Rows"}),(0,d.jsx)("span",{style:og.metaValue,children:c.rows.length}),(0,d.jsx)("span",{style:og.metaKey,children:"Displayed rows"}),(0,d.jsxs)("span",{style:og.metaValue,children:[0===c.rows.length?0:y+1,"-",g]})]}),0===c.rows.length?(0,d.jsx)("div",{style:og.emptyState,children:"No record snapshots found."}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(a(4458).fI,{alignItems:"center",gap:8,marginBottom:16,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:f,disabled:0===h,children:"Previous"}),(0,d.jsxs)("span",{style:og.paginationText,children:["Page ",h+1," of ",u]}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:b,disabled:h>=u-1,children:"Next"})]}),x.map((e,t)=>(0,d.jsxs)("div",{style:og.rowCard,children:[(0,d.jsxs)("div",{style:og.rowTitle,children:["Row ",y+t+1]}),(0,d.jsx)("div",{style:og.fieldGrid,children:ox.map(t=>{let a=t.getValue(e);if(void 0!==a)return(0,d.jsxs)(r.Fragment,{children:[(0,d.jsx)("span",{style:og.fieldName,children:t.label}),(0,d.jsx)("span",{style:og.fieldValue,children:String(a)})]},t.label)})})]},`${e.pk??"row"}-${e.sk??y+t}`))]})]})}function ob(e){return void 0===e?"unknown":`${e} ms`}let ov={container:{fontFamily:a(699422).Tf.mono,fontSize:13},header:{fontWeight:a(699422).Wy.semibold,fontSize:16,marginBottom:8,paddingBottom:8,borderBottom:`1px solid ${a(632079).Tj.border.primary}`},summaryRow:{fontSize:11,color:a(632079).Tj.text.secondary,marginBottom:12,wordBreak:"break-all"},truncatedWarning:{fontSize:11,color:a(632079).Tj.orange.text.accentPrimary,marginBottom:12},scrollList:{maxHeight:480,overflowY:"auto",paddingInlineEnd:4},changeItem:{padding:"10px 14px",backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},changeItemIncomplete:{border:`1px solid ${a(632079).Tj.red.border.accentPrimary}`},timestamp:{fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary},meta:{fontSize:11,color:a(632079).Tj.text.secondary,wordBreak:"break-all"},chunkBadgeComplete:{fontSize:11,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.green.text.accentPrimary},chunkBadgeIncomplete:{fontSize:11,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.red.text.accentPrimary},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary}};
104function oj(e){return new Date(e).toLocaleString(void 0,{timeZoneName:"shortOffset"})}function ok(e){var t;let{change:i}=e,n=i.isComplete?ov.changeItem:{...ov.changeItem,...ov.changeItemIncomplete};return(0,d.jsx)("div",{style:n,children:(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsxs)("span",{style:ov.timestamp,children:[oj(i.timestamp)," · ",i.timestamp]}),(0,d.jsxs)("span",{style:ov.meta,children:[i.recordTable," · ",i.recordId]}),(0,d.jsxs)("span",{style:ov.meta,children:["author ",void 0===(t=i.author)?"unknown":`${t.table}:${t.id}`,void 0!==i.ttl?` \xb7 ttl ${oj(1e3*i.ttl)}`:""]}),i.isComplete?(0,d.jsxs)("span",{style:ov.chunkBadgeComplete,children:["✓ ",i.chunkTotal," of ",i.chunkTotal," chunks present"]}):(0,d.jsxs)("span",{style:ov.chunkBadgeIncomplete,children:["⚠ ",i.chunksPresent," of ",i.chunkTotal," chunks present",i.missingChunkIndices.length>0?` — missing [${i.missingChunkIndices.join(", ")}]`:"",i.hasInconsistentChunkTotal?" — rows disagree on chunk total":""]})]})})}let oS={breadcrumb:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:a(632079).Tj.text.secondary},breadcrumbLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer"},spaceInfo:{display:"flex",flexDirection:"column",gap:4,padding:12,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,marginBottom:8},spaceInfoRow:{display:"flex",gap:8,alignItems:"center",fontSize:12},spaceInfoLabel:{color:a(632079).Tj.text.tertiary,minWidth:80},readOnlyBanner:{display:"flex",alignItems:"center",gap:8,padding:"8px 12px",backgroundColor:a(632079).Tj.yellow.background.secondary,borderRadius:6,fontSize:12,color:a(632079).Tj.yellow.text.accentPrimary}},ow={adminGetWorkers:{apiName:"adminGetWorkers",displayName:"Get Workers",emoji:"🧵",description:"Search for workers by workspace ID or user email.",schema:{query:{type:"string",comment:"Workspace ID (UUID) or user email address."}},customResponseRenderer:a(850471).V}
104,adminGetWorkerDetail:{apiName:"adminGetWorkerDetail",displayName:"Get Worker Detail",emoji:"🔍",description:"View worker details, capabilities, runs, and sync tasks.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID that owns the worker."},workerId:{type:"string",comment:"Worker ID to inspect."}},customResponseRenderer:function(e){let{data:t}=e,i=`${a(168962).JZ.admin}/workers/list/${encodeURIComponent(t.spaceId)}`;return(0,d.jsxs)(a(4458).VP,{gap:16,children:[(0,d.jsx)("div",{style:oS.breadcrumb,children:(0,d.jsx)("a",{href:i,style:oS.breadcrumbLink,children:"← Back to workers list"})}),(0,d.jsxs)("div",{style:oS.spaceInfo,children:[(0,d.jsxs)("div",{style:oS.spaceInfoRow,children:[(0,d.jsx)("span",{style:oS.spaceInfoLabel,children:"Workspace:"}),(0,d.jsx)("span",{children:t.spaceName||"Unknown"})]}),(0,d.jsxs)("div",{style:oS.spaceInfoRow,children:[(0,d.jsx)("span",{style:oS.spaceInfoLabel,children:"Space ID:"}),(0,d.jsx)(a(137691).x5,{value:t.spaceId})]})]}),(0,d.jsx)("div",{style:oS.readOnlyBanner,children:"📖 Admin Read-Only View — Modifications are disabled"}),(0,d.jsxs)("div",{style:oS.spaceInfo,children:["Notion Admin override:"," ",t.worker.isPausedByNotionAdmin?"On":"Off"]}),(0,d.jsx)(a(456314).cx,{worker:t.worker,capabilities:t.capabilities,runs:t.runs,syncTasks:t.syncTasks,isReadOnly:!0})]})}},adminGetWorkerRunLogs:{apiName:"adminGetWorkerRunLogs",displayName:"Get Worker Run Logs",emoji:"🧾",description:"Fetch logs and output for a specific worker run.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID that owns the worker."},workerId:{type:"string",comment:"Worker ID that produced the run."},runId:{type:"string",comment:"Run ID to fetch logs for."}}},adminDisableWorker:{apiName:"adminDisableWorker",displayName:"Disable Worker",emoji:"🛑",isDestructive:!0,description:"Disable a specific worker. Requires a Zendesk ticket URL for audit trail.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID that owns the worker."},workerId:{type:"string",comment:"Worker ID to disable."},zendeskTicketUrl:{type:"string",placeholder:a(591977).r1,comment:"Zendesk ticket URL (required, makenotion.zendesk.com only)."}}},adminEnableWorker:{apiName:"adminEnableWorker",displayName:"Enable Worker",emoji:"✅",description:"Clear only the Notion Admin pause. Workspace Owner and Worker Editor pauses stay active.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID that owns the worker."},workerId:{type:"string",comment:"Worker ID to re-enable."}}},adminUpdateSyncCapability:{apiName:"adminUpdateSyncCapability",displayName:"Update Sync Capability",emoji:"⚙️",description:"Update a sync capability's disabled status or schedule.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID that owns the worker."},workerId:{type:"string",comment:"Worker ID that owns the capability."},capabilityKey:{type:"string",comment:"The capability key to update."}}},adminGetWorkersRateLimitConfig:{apiName:"adminGetWorkersRateLimitConfig",displayName:"Get Workers Rate Limits",emoji:"⚡",description:"View current rate limit and concurrency config for a workspace. Shows defaults and any overrides.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to view rate limit config for."}}},adminSetWorkersRateLimitConfig:{apiName:"adminSetWorkersRateLimitConfig",displayName:"Set Workers Rate Limits",emoji:"⚙️",description:"Override rate limit and concurrency settings for a workspace. Only set fields you want to override.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID."},build:{type:"section",comment:"Build rate limits",components:{dailyLimit:{type:"number",numberType:"integer",comment:"Max builds/day (default: 100)."},burstLimit:{type:"number",numberType:"integer",comment:"Max builds/5min (default: 10)."}}},sync:{type:"section",comment:"Sync rate limits",components:{dailyLimit:{type:"number",numberType:"integer",comment:"Max sync runs/day (default: 10000)."},burstLimit:{type:"number",numberType:"integer",comment:"Max sync runs/min (default: 100)."}}},capability:{type:"section",comment:"Capability rate limits",components:{dailyLimit:{type:"number",numberType:"integer",comment:"Max capability runs/day (default: 10000)."},burstLimit:{type:"number",numberType:"integer",comment:"Max capability runs/min (default: 100)."}}},sandbox:{type:"section",comment:"Sandbox concurrency",components:{maxConcurrent:{type:"number",numberType:"integer",comment:"Max concurrent sandboxes (default: 3)."}}}}},adminResetWorkersRateLimitConfig:{apiName:"adminResetWorkersRateLimitConfig",displayName:"Reset Workers Rate Limits",emoji:"🔄",de
104scription:"Remove all rate limit overrides for a workspace, reverting to defaults.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to reset."}}},adminGetWorkersEmergencyBrake:{apiName:"adminGetWorkersEmergencyBrake",displayName:"Get Workers Emergency Brake",emoji:"🛑",description:"View the current emergency brake state for a workspace's workers.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to check emergency brake state."}}},adminGetWorkersGlobalEmergencyBrake:{apiName:"adminGetWorkersGlobalEmergencyBrake",displayName:"Get Sandbox Emergency Brake",emoji:"🛑",description:"View the current sandbox emergency brake state for global sandbox creation.",schema:{}},adminSetWorkersEmergencyBrake:{apiName:"adminSetWorkersEmergencyBrake",displayName:"Set Workers Emergency Brake",emoji:"🚨",isDestructive:!0,description:"Toggle the Notion emergency brake for a workspace's workers.",schema:{spaceId:{type:"string",table:"space",comment:"Workspace ID to set emergency brake."},enabled:{type:"boolean",comment:"Whether to enable or disable the Notion brake."}}},adminSetWorkersGlobalEmergencyBrake:{apiName:"adminSetWorkersGlobalEmergencyBrake",displayName:"Set Sandbox Emergency Brake",emoji:"🚨",isDestructive:!0,description:"Toggle the sandbox emergency brake that blocks new sandbox creation globally.",schema:{enabled:{type:"boolean",comment:"Whether to enable or disable the global sandbox emergency brake."}}}};function oI(e){let{data:t}=e;return t.canceledConsolidations,(0,d.jsxs)("div",{children:[(0,d.jsxs)("span",{children:["Please check the"," ",(0,d.jsx)(a(590422).Q,{inline:!0,href:"https://app.hex.tech/notion/app/97f6e650-f032-4af9-823f-9b542dd5e3dd/latest",underline:!0,external:!0,children:"hex dashboard"})," ","to track the status of your consolidation."]}),(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),(0,d.jsx)("b",{children:"Cancelled consolidations"}),t.canceledConsolidations.length?t.canceledConsolidations.map(e=>(0,d.jsx)("div",{children:`Source space ID: ${e.sourceSpaceId}, Target space ID: ${e.targetSpaceId}`},e.sourceSpaceId)):(0,d.jsx)("div",{children:"None"})]})}let oC={adminCancelSpaceConsolidation:{apiName:"adminCancelSpaceConsolidation",displayName:"Cancel a workspace consolidation",emoji:"🗑",description:(0,d.jsxs)(d.Fragment,{children:["Cancel a scheduled workspace consolidation.",(0,d.jsx)("br",{}),"Please check the"," ",(0,d.jsx)(a(590422).Q,{href:"https://app.hex.tech/notion/app/97f6e650-f032-4af9-823f-9b542dd5e3dd/latest",underline:!0,external:!0,inline:!0,children:"hex dashboard"})," ","to see what consolidation(s) has been scheduled for the target space. This tool will cancel any scheduled consolidations associated with the given target space."]}),schema:{targetSpaceId:{type:"string",comment:"Space ID of the workspace that is the destination for the contents of source spaces.",placeholder:a(591977).nZ}},isDestructive:!0,customResponseRenderer:oI},adminRunSpaceConsolidation:{apiName:"adminRunSpaceConsolidation",displayName:"Schedule a workspace consolidation",emoji:"🧩",description:(0,d.jsxs)(d.Fragment,{children:["Schedule a consolidation of up to 4 p90-size source workspaces into a target enterprise workspace. Before scheduling, make sure you've filled out your request in the"," ",(0,d.jsx)("a",{href:"https://dev.notion.so/a4277b18886e40e98db7e590daf96bce?v=96112516fc6649c99dfc4def1a569e14",target:"_blank",style:{cursor:"pointer"},children:"WS Consolidation request db"}),".",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Note: If a consolidation is already scheduled for the target space and has not started, it will be ",(0,d.jsx)("b",{children:"overwritten"})," by the scheduling tool. Please check the"," ",(0,d.jsx)(a(590422).Q,{href:"https://app.hex.tech/notion/app/97f6e650-f032-4af9-823f-9b542dd5e3dd/latest",underline:!0,external:!0,inline:!0,children:"hex dashboard"})," ","to see if a consolidation has already been scheduled for the target space."]}),schema:{sourceSpaceIds:{type:"string",comment:"Comma separated list of space IDs of up to 4 workspaces whose content will be consolidated into the target space. 					Note: check source space block count before running.",placeholder:a(591977).Gb},targetSpaceId:{type:"string",comment:"Space ID of the workspace that is the destination for the contents of source spaces.",placeholder:a(591977).nZ},requestingUserId:{type:"string",comment:"ID for the user requesting this consolidation.",placeholder:a(591977).nZ},contactEmail:{type:"string",comment:"Contact email provided by the requestor to be used in communications. For example, if a user in this source space wants to reach out to someone in the space.",placeholder:a(591977).zg},date:{type:"date",comment:"Scheduled date to run the consolidation."},time:{type:"string",comment:"Scheduled time to start the consolidations in 24 hour format ex: 18:00.",placeholder:"08:00"},timezone:{type:"timezone",comment:"Timezone to use for the entered time and date",defaultValue:(0,ii().P)()},sourceDeletionDelayDays:{type:"number",comment:"(Optional) If set, the source space will be deleted this many days after consolidation. Defaults to 30 days."},dryRun:{type:"boolean",comment:"(Optional) If true, will undo read-only mode on the source space after consolidation and will not delete the source space after 30 days. Do not set this unless you know 
104what you're doing!",defaultValue:!1}},isDestructive:!0,customResponseRenderer:oI}},oD={summary:{color:a(632079).Tj.text.secondary,fontSize:12,marginBottom:8},code:{fontFamily:a(699422).Tf.mono,fontSize:12}};function oT(e){let{data:t}=e;return"error"===t.status?(0,d.jsx)(a(553775).i$,{warnings:[t.reason]}):(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:oD.summary,children:["Execution ",(0,d.jsx)("span",{style:oD.code,children:t.executionPointer})," ·"," ",t.executionStatus," · woken ",t.wakeCount," times"]}),(0,d.jsx)(aE,{node:t.stepTree,stepKey:"(root)",depth:0})]})}let oR={toolbar:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:8,marginBottom:12},windowLabel:{fontWeight:a(699422).Wy.semibold,marginInlineStart:4,marginInlineEnd:4},muted:{color:a(632079).Tj.text.secondary,fontSize:12},sectionHeader:{fontSize:13,fontWeight:a(699422).Wy.semibold,marginTop:12,marginBottom:4},tableContainer:{overflowX:"auto"},table:{width:"100%",borderCollapse:"collapse",fontSize:12},th:{textAlign:"start",padding:"4px 8px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.secondary,whiteSpace:"nowrap"},td:{padding:"4px 8px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,verticalAlign:"top",whiteSpace:"nowrap"},failedRow:{backgroundColor:a(632079).Tj.red.background.secondary},pastRow:{color:a(632079).Tj.text.secondary},nowRow:{borderBottom:`2px solid ${a(632079).Tj.blue.text.accentPrimary}`,color:a(632079).Tj.blue.text.accentPrimary,fontSize:11,fontWeight:a(699422).Wy.semibold,padding:"2px 8px"},detailsCell:{maxWidth:360,overflow:"hidden",textOverflow:"ellipsis"},errorPreview:{fontFamily:a(699422).Tf.mono,color:a(632079).Tj.red.text.primary},pill:{display:"inline-block",padding:"0 6px",borderRadius:4,fontWeight:a(699422).Wy.medium},actions:{display:"flex",alignItems:"center",gap:4},expandedCell:{padding:"8px 16px 12px",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,whiteSpace:"normal"},errorMessage:{fontFamily:a(699422).Tf.mono,fontSize:12,color:a(632079).Tj.red.text.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",marginBottom:8},code:{fontFamily:a(699422).Tf.mono}},oA={failed:"Failed",running:"Running",waiting:"Waiting",scheduled:"Scheduled",completed:"Completed",cancelled:"Cancelled"},oN={failed:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.primary},running:{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.primary},waiting:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.primary},scheduled:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary},completed:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.primary},cancelled:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary}};function oM(e){let{migrations:t,environment:a,onRetried:i,showNowMarker:n,now:s}=e,o=t.findIndex(e=>e.startTime>=s),l=-1===o?t.length:o;return(0,d.jsx)("div",{style:oR.tableContainer,children:(0,d.jsxs)("table",{style:oR.table,children:[(0,d.jsx)("thead",{children:(0,d.jsxs)("tr",{children:[(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Start"}),(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Workspace"}),(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Region"}),(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Status"}),(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Details"}),(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Requested by"}),(0,d.jsx)("th",{scope:"col",style:oR.th,children:"Actions"})]})}),(0,d.jsxs)("tbody",{children:[t.map((e,t)=>(0,d.jsxs)(r.Fragment,{children:[n&&t===l?(0,d.jsx)(oP,{now:s}):void 0,(0,d.jsx)(oV,{migration:e,environment:a,onRetried:i,now:s})]},e.migrationId)),n&&l===t.length?(0,d.jsx)(oP,{now:s}):void 0]})]})})}function oP(e){let{now:t}=e;return(0,d.jsx)("tr",{children:(0,d.jsxs)("td",{colSpan:7,style:oR.nowRow,children:["Now · ",new Date(t).toLocaleString(void 0,oU)]})})}function oV(e){let{migration:t,environment:i,onRetried:n,now:s}=e,o=t.startTime<s,{execution:l}=t,c=o_(t),p="failed"===c,[m,u]=r.useState({state:"idle"}),[h,y]=r.useState(!1),g=r.useCallback(()=>{u({state:"confirming"})},[]),x=r.useCallback(()=>{u({state:"idle"})},[]),f=r.useCallback(async()=>{u({state:"retrying"});try{let e=await i.api.callApi({eventName:"adminRetryWorkspaceMigration",environment:i,data:{spaceId:t.spaceId}});if("success"!==e.type)return void u({state:"error",reason:"Retry request failed"});if("error"===e.data.status)return void u({state:"error",reason:e.data.reason});u({state:"retried"}),await n()}catch(e){u({state:"error",reason:e instanceof Error?e.message:"Retry request failed"})}},[i,t.spaceId,n]),b=r.useCallback(()=>{y(e=>!e)},[]),v=p?oR.failedRow:o&&("completed"===c||"cancelled"===c)?oR.pastRow:void 0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("tr",{style:v,children:[(0,d.jsxs)("td",{style:oR.td,title:`${new Date(t.startTime).toString()}
105Requested in ${t.startTimezone}
105`,children:[new Date(t.startTime).toLocaleString(void 0,oU)," ",(0,d.jsx)("span",{style:oR.muted,children:oW(t.startTime,s)})]}),(0,d.jsx)("td",{style:oR.td,title:t.spaceId,children:(0,d.jsx)(a(553775).ru,{table:"space",record:{id:t.spaceId,name:t.spaceName},children:t.spaceName??(0,d.jsx)("span",{style:oR.code,children:t.spaceId})})}),(0,d.jsx)("td",{style:oR.td,children:t.targetRegion}),(0,d.jsx)("td",{style:oR.td,children:(0,d.jsx)("span",{style:{...oR.pill,...oN[c]},children:oA[c]})}),(0,d.jsx)("td",{style:{...oR.td,...oR.detailsCell},title:(null==l?void 0:l.state)==="failed"?l.errorMessage:void 0,children:(0,d.jsx)(oE,{migration:t,now:s})}),(0,d.jsx)("td",{style:oR.td,children:t.requestorEmail??t.requestorId}),(0,d.jsx)("td",{style:oR.td,children:(0,d.jsxs)("div",{style:oR.actions,children:[p?(0,d.jsx)(oB,{retryState:m,onRequestRetry:g,onConfirmRetry:f,onCancelRetry:x}):void 0,t.executionPointer?(0,d.jsx)(a(548436).A,{size:"sm",onClick:b,children:h?"Hide steps":"Steps"}):void 0,t.slackThreadUrl?(0,d.jsx)("a",{href:t.slackThreadUrl,target:"_blank",rel:"noreferrer",children:"Slack"}):void 0]})})]}),"error"===m.state?(0,d.jsx)("tr",{style:v,children:(0,d.jsx)("td",{colSpan:7,style:oR.expandedCell,children:(0,d.jsx)(a(553775).i$,{warnings:[m.reason]})})}):void 0,h?(0,d.jsx)("tr",{children:(0,d.jsxs)("td",{colSpan:7,style:oR.expandedCell,children:[(0,d.jsxs)("div",{style:oR.muted,children:["Migration ",(0,d.jsx)("span",{style:oR.code,children:t.migrationId})," ","· workspace ",(0,d.jsx)("span",{style:oR.code,children:t.spaceId})]}),(null==l?void 0:l.state)==="failed"?(0,d.jsx)("div",{style:oR.errorMessage,children:l.errorMessage}):void 0,(0,d.jsx)(oL,{migrationId:t.migrationId,environment:i})]})}):void 0]})}function oE(e){let{migration:t,now:a}=e,{execution:i}=t;if("scheduled"===t.status)return t.startTime<a?(0,d.jsx)("span",{children:"Start time passed, not started yet"}):null;if("running"!==t.status||!i)return null;switch(i.state){case"failed":return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{children:i.step})," ·"," ",oW(i.failedAt,a),":"," ",(0,d.jsx)("span",{style:oR.errorPreview,children:i.errorMessage})]});case"inProgress":return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{children:i.step??"(starting)"}),void 0!==i.since?` \xb7 started ${oW(i.since,a)}`:""]});case"waiting":return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("strong",{children:i.step})," · suspended"," ",oW(i.since,a)]});case"finished":return(0,d.jsx)(d.Fragment,{children:"Workflow finished; the migration should complete shortly"});case"notFound":return(0,d.jsx)(d.Fragment,{children:"Workflow execution not found"})}}function oB(e){let{retryState:t,onRequestRetry:i,onConfirmRetry:n,onCancelRetry:r}=e;switch(t.state){case"confirming":return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:n,children:"Confirm retry"}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:r,children:"Cancel"})]});case"retrying":return(0,d.jsx)(a(548436).A,{size:"sm",isLoading:!0,children:"Retry"});case"retried":return(0,d.jsx)("span",{style:oR.muted,children:"Retry requested"});case"idle":case"error":return(0,d.jsx)(a(548436).A,{size:"sm",onClick:i,children:"Retry"})}}function oL(e){let{migrationId:t,environment:i}=e,[n,s]=r.useState(),[o,l]=r.useState();return(r.useEffect(()=>{let e=!1;return i.api.callApi({eventName:"adminGetWorkspaceMigrationSteps",environment:i,data:{migrationId:t}}).then(t=>{e||("success"===t.type?s(t.data):l("Failed to load migration steps"))}).catch(t=>{e||l(t instanceof Error?t.message:"Failed to load migration steps")}),()=>{e=!0}},[i,t]),o)?(0,d.jsx)(a(553775).i$,{warnings:[o]}):n?(0,d.jsx)(oT,{data:n}):(0,d.jsx)(a(517334).k,{size:14})}function o_(e){var t;if("running"!==e.status)return e.status;switch(null==(t=e.execution)?void 0:t.state){case"failed":return"failed";case"waiting":return"waiting";default:return"running"}}let oU={weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"};function oW(e,t){let a,i=e-t,n=Math.abs(i);return a=n<6e4?`${Math.round(n/1e3)}s`:n<36e5?`${Math.round(n/6e4)}m`:n<864e5?`${(n/36e5).toFixed(1)}h`:`${(n/864e5).toFixed(1)}d`,i>=0?`in ${a}`:`${a} ago`}let oF={"us-west-2":"Oregon","eu-central-1":"Frankfurt","ap-northeast-1":"Tokyo","ap-northeast-2":"Seoul"}
105,oK={adminListWorkspaceMigrations:{apiName:"adminListWorkspaceMigrations",displayName:"Workspace migrations dashboard",description:"Compact, chronological table of workspace migrations, starting with the past week and the next week. Page a week at a time, retry failed migrations, and expand any started migration to inspect its workflow steps.",isDestructive:!1,emoji:"📊",schema:{},customResponseRenderer:function(e){var t,i;let n,s,o,{data:l,environment:c}=e,[p,m]=r.useState(),[u,h]=r.useState(),[y,g]=r.useState(),x=(null==y?void 0:y.forData)===l?y:void 0,f=(null==x?void 0:x.response)??l,b="success"===f.status?f:"success"===l.status?l:void 0,v=r.useCallback(async(e,t)=>{m(e),h(void 0);try{let e=await c.api.callApi({eventName:"adminListWorkspaceMigrations",environment:c,data:t});"success"===e.type?g({forData:l,response:e.data,at:Date.now()}):h("Failed to load workspace migrations")}catch(e){h(e instanceof Error?e.message:"Failed to load workspace migrations")}finally{m(void 0)}},[l,c]),j=null==b?void 0:b.windowStart,k=null==b?void 0:b.windowEnd,S=r.useCallback(async()=>{void 0!==j&&void 0!==k&&await v("prev",{windowStart:j-a(286762).lG,windowEnd:k-a(286762).lG})},[v,j,k]),w=r.useCallback(async()=>{void 0!==j&&void 0!==k&&await v("next",{windowStart:j+a(286762).lG,windowEnd:k+a(286762).lG})},[v,j,k]),I=r.useCallback(async()=>{await v("current",{})},[v]),C=r.useCallback(async()=>{await v("refresh",void 0!==j&&void 0!==k?{windowStart:j,windowEnd:k}:{})},[v,j,k]),D=(null==b?void 0:b.loadedAt)??0,T="success"===f.status?f.migrations:[],R="success"===f.status?f.earlierActiveMigrations:[],A=[...T,...R].filter(e=>"failed"===o_(e)).length;return(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:oR.toolbar,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:S,isLoading:"prev"===p,disabled:void 0===b,children:"← Prev week"}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:I,isLoading:"current"===p,children:"Today"}),(0,d.jsx)(a(548436).A,{size:"sm",onClick:w,isLoading:"next"===p,disabled:void 0===b,children:"Next week →"}),b?(0,d.jsx)("span",{style:oR.windowLabel,children:(t=b.windowStart,i=b.windowEnd,n={month:"short",day:"numeric"},s=new Date(t).toLocaleDateString(void 0,n),o=new Date(i).toLocaleDateString(void 0,n),`${s} – ${o}`)}):void 0,"success"===f.status?(0,d.jsxs)("span",{style:oR.muted,children:[T.length," migration",1===T.length?"":"s",A>0?` \xb7 ${A} failed`:""]}):void 0,(0,d.jsx)(a(548436).A,{size:"sm",onClick:C,isLoading:"refresh"===p,children:"Refresh"}),x?(0,d.jsxs)("span",{style:oR.muted,children:["Updated ",new Date(x.at).toLocaleTimeString()]}):void 0]}),u?(0,d.jsx)(a(553775).i$,{warnings:[u]}):void 0,"error"===f.status?(0,d.jsx)(a(553775).i$,{warnings:[f.reason]}):void 0,R.length>0?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{style:oR.sectionHeader,children:["Still active from before this window (",R.length,")"]}),(0,d.jsx)(oM,{migrations:R,environment:c,onRetried:C,showNowMarker:!1,now:D}),(0,d.jsx)("div",{style:oR.sectionHeader,children:"This window"})]}):void 0,"success"===f.status&&0===T.length?(0,d.jsx)("div",{style:oR.muted,children:"No migrations in this window."}):(0,d.jsx)(oM,{migrations:T,environment:c,onRetried:C,showNowMarker:!0,now:D})]})}},adminUpdateWorkspaceFreeze:{apiName:"adminUpdateWorkspaceFreeze",displayName:"Freeze workspace",description:"Freezing a workspace disables saveTransactions for the workspace.",isDestructive:!0,emoji:"🧊",schema:{spaceId:{type:"string",table:"space",comment:"Id of the workspace to freeze"},enabled:{type:"boolean",comment:"Should the workspace be frozen? Uncheck to unfreeze workspace",defaultValue:!0},reason:{type:"options",options:["migration"],comment:"Reason for the freeze",defaultValue:"migration"},date:{type:"date",comment:"Scheduled start date for freeze."},time:{type:"string",comment:"Scheduled start time for freeze in 24 hour format ex: 08:00.",placeholder:"08:00"},timezone:{type:"timezone",comment:"Timezone to use for the entered time and date",defaultValue:(0,ii().P)()}}},adminStartWorkspaceMigration:{apiName:"adminStartWorkspaceMigration",displayName:"Schedule workspace migration",description:(0,d.jsxs)(d.Fragment,{children:["Schedule a workspace migration to a new region.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Review the"," ",(0,d.jsx)("a",{href:"https://dev.notion.so/notion/Internal-EU-Migrations-GTM-Playbook-1b4b35e6e67f80b7bdd7e7b4562e855d?source=copy_link",target:"_blank",style:{cursor:"pointer"}
105,children:"Workspace Migration Runbook"})," ","before you begin.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"Migrations must be scheduled at least 24 hours in advance. The customer's workspace will be read-only for the duration of the migration. It's essential that the customer has completed the acknowledgement form and understands their workspace may be read-only for the duration of the migration.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"You can schedule up to 5 migrations at a time, separated by commas. Each migration will be staggered by 1 hour."]}),isDestructive:!0,emoji:"🚚",schema:{spaceId:{type:"string",comment:"Id of the workspace to migrate. Up to 5 ids can be provided, seperated by commas."},targetRegion:{type:"options",options:a(775093).b.filter(e=>"us-west-2"!==e).map(e=>({displayName:`${oF[e]} (${e})`,value:e})),comment:"Target region for migration"},date:{type:"date",comment:"Scheduled start date for migration."},time:{type:"string",comment:"Scheduled start time for migration in 24 hour format ex: 08:00.",placeholder:"11:00"},timezone:{type:"timezone",comment:"Timezone to use for the entered time and date",defaultValue:(0,ii().P)()}}},adminGetWorkspaceMigrations:{apiName:"adminGetWorkspaceMigrations",displayName:"Get workspace migrations",description:"Get all migrations for a workspace by space ID to view migration history and status.",isDestructive:!1,emoji:"📋",schema:{spaceId:{type:"string",table:"space",comment:"Id of the workspace to get migrations for",showByDefaultInSingleRecordMode:!0}}},adminCancelWorkspaceMigrations:{apiName:"adminCancelWorkspaceMigrations",displayName:"Cancel workspace migrations",description:"Cancel all scheduled migrations for a workspace. This will cancel both the database record and the EventBridge schedule.",isDestructive:!0,emoji:"❌",schema:{spaceId:{type:"string",table:"space",comment:"Id of the workspace to cancel migrations for"}}},adminGetWorkspaceMigrationSteps:{apiName:"adminGetWorkspaceMigrationSteps",displayName:"Inspect workspace migration steps",description:"Show the durable workflow step tree for a workspace migration, including which step is running or failed.",isDestructive:!1,emoji:"🪜",schema:{migrationId:{type:"string",comment:"Id of the workspace migration (from the dashboard)",placeholder:a(591977).nZ}},customResponseRenderer:oT},adminRetryWorkspaceMigration:{apiName:"adminRetryWorkspaceMigration",displayName:"Retry workspace migration",description:"Retry the in-progress (running) migration for a workspace by re-waking its durable workflow. Only works while a migration is in the running state.",isDestructive:!0,emoji:"🔄",schema:{spaceId:{type:"string",table:"space",comment:"Id of the workspace whose running migration should be retried"}}}};function o$(e,t){for(let a in e.schema){let i=e.schema[a];if("string"===i.type&&i.table===t)return{key:a,schema:i}}}function oO(e,t){if(e.apiName.match(t)||(0,n().NZ)(e.apiName).match(t)||e.displayName&&e.displayName.match(t)||"string"==typeof e.description&&e.description.match(t))return!0;for(let[a,i]of Object.entries(e.schema))if(a.match(t)||(0,n().NZ)(a).match(t)||i.comment&&i.comment.match(t))return!0;return!1}let oz={...rd,...rS,...sk,...sJ,...sT,...tG,...s_,...sR,...aj,adminGetRateLimits:{apiName:"adminGetRateLimits",displayName:"Get rate limits by email",emoji:"!",description:"Fetch rate limits via a given email.",schema:{userEmail:{type:"string",comment:"Fetch rate limits which are enforced via the email."}}},adminResetRateLimits:{apiName:"adminResetRateLimits",displayName:"Reset rate limits for email key",emoji:"!",description:"Reset common rate limits for email keys.",schema:sD,notinoAction:{actionId:"admin.reset_rate_limits",schema:sD,permission:"adminResetRateLimits",supportsRevert:!1}},...a4,...oi,...s1,...rQ,...rB,...rL,adminCreateMarketingRoute:{apiName:"adminCreateMarketingRoute",displayName:"Create a Marketing Route",emoji:"🛣",description:"Manually create a 302 redirection from 'https://notion.com${source}' to '${target}'. 'source' must start with '/', 'target' must be a valid url started with 'https://'.",schema:{source:{type:"string"},target:{type:"string"}},isDestructive:!0},adminBulkSetStartupReferralPartners:{apiName:"adminBulkSetStartupReferralPartners",displayName:"Upload Startup Referral Partners",description:"Upload the full list of startup referral partners used by the startup application flow.",emoji:"👼",sc
105hema:{csv:{type:"file",name:"csv",comment:"CSV must have the column: Name. Name is what will be displayed in the startup application form."},shouldAppend:{type:"boolean",comment:"Check to append to the existing list. Will overwrite if not checked."}},isDestructive:!0},adminGetMarketingRoutes:{apiName:"adminGetMarketingRoutes",displayName:"Get Marketing Routes",emoji:"📈",description:'View all currently set 302 redirections set by the "Create a Marketing Route" tool.',schema:{},isDestructive:!1,customResponseRenderer:function(e){let{data:t}=e,i={fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:8};return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:i,children:"Success"}),(0,d.jsx)(a(503270).H,{data:t,defaultCollapsed:!1,showCopyButton:!0,collectionLimit:t.marketingRoutes?Object.keys(t.marketingRoutes).length:void 0})]})}},...aP,...oC,...oK,...rG,adminMonetizationTestingRunAction:{apiName:"adminMonetizationTestingRunAction",displayName:"Run a registered monetization-testing action",description:"Generic runner: looks up an action by name in the registry and invokes it. Most operators will reach this via the action-graph UI (Phase 4); this raw form is a manual escape hatch for one-off testing.",emoji:"🧪",availableEnvironments:["local","development"],isDestructive:!0,schema:{spaceId:{type:"string",comment:"Target workspace ID."},actionName:{type:"string",comment:"Registered action name (see actionRegistry.ts). For typed UI use the action-graph panel instead."},input:{type:"string",comment:"JSON-encoded input payload matching the action's inputSchema. Empty string for actions with no input.",defaultValue:"{}"}}},adminMonetizationTestingGetSnapshot:{apiName:"adminMonetizationTestingGetSnapshot",displayName:"Read current monetization-testing state",description:"Returns the workspace's current MonetizationTestState (billingData + memberCount). Phase 3 extends this to also surface an independent Stripe CLI oracle column.",emoji:"🔎",availableEnvironments:["local","development"],schema:{spaceId:{type:"string",comment:"Target workspace ID."}}},adminMonetizationTestingCreateWorkspaceInState:{apiName:"adminMonetizationTestingCreateWorkspaceInState",displayName:"Create a workspace and drive it into a target state",description:"Creates a fresh workspace owned by you, then applies a sequence of registered actions to drive it into a target monetization state. Empty sequence just creates the workspace.",emoji:"🧬",availableEnvironments:["local","development"],isDestructive:!0,schema:{spaceName:{type:"string",comment:"Workspace name. Optional."},actionSequence:{type:"string",comment:'JSON-encoded array of { actionName, input } entries. Each input is itself a JSON-encoded string. Example: [{"actionName":"upgradeSubscription","input":"{\\"tier\\":\\"plus\\"}"}]',defaultValue:"[]"}}},...to,...ag,...tz,adminUpdateNotionCalendarAvailableForSpace:{apiName:"adminUpdateNotionCalendarAvailableForSpace",displayName:"Add/Remove Notion Calendar CTAs from a space",description:"This tools allows support to remove Notion Calendar CTAs from spaces by request.",emoji:"📅",schema:{spaceIds:{type:"string",comment:"Comma-separated space_ids to add/remove Notion Calendar CTAs from",table:"space"},action:{type:"options",comment:"This setting will be applied to all spaces in the list",options:["turn_calendar_on","turn_calendar_off"],defaultValue:"turn_calendar_off"}},isDestructive:!0},...rU,...aM,...rO,...sC,...sU,...rq,...a1,...tp,adminSerializeWorksp
105aceToIaC:{apiName:"adminSerializeWorkspaceToIaC",displayName:"Serialize Workspace to Notion as Code",description:"Crawl a workspace, teamspace, or page subtree and serialize it to Notion as Code intents JSON, downloadable from S3. Leave both scope IDs empty to crawl the whole workspace. Serializes from the specified admin/owner's perspective and only captures what they can read, so choose deliberately (e.g. an owner for the fullest view). The named user must be an admin or owner of the space with Support access enabled. Polls for the download automatically.",emoji:"📦",customResponseRenderer:function(e){var t;let i,{data:n}=e,s=(0,a(533992).v3)(),{status:o,errorMessage:l}=rH((0,r.useCallback)(async()=>{let e=await s.api.callApi({eventName:"adminGetSerializeWorkspaceToIaCStatus",environment:s,data:{spaceId:n.spaceId,outputKey:n.outputKey}});return"success"!==e.type?{type:"error",message:(0,a(201790).V4)(e)}:{type:"success",status:e.data}},[s,n.spaceId,n.outputKey]));return void 0!==l?(0,d.jsx)("div",{style:rJ.container,children:(0,d.jsx)("div",{style:rJ.error,children:`Status check failed: ${l}`})}):void 0===o||"pending"===o.state?(0,d.jsxs)("div",{style:rJ.container,children:[(0,d.jsx)("div",{style:rJ.heading,children:"Serializing workspace…"}),(0,d.jsx)("div",{style:rJ.muted,children:`Crawling and writing intents to S3. outputKey: ${n.outputKey}`})]}):"failed"===o.state?(0,d.jsx)("div",{style:rJ.container,children:(0,d.jsx)("div",{style:rJ.error,children:`Serialization failed: ${o.error??"unknown error"}`})}):(0,d.jsxs)("div",{style:rJ.container,children:[(0,d.jsx)("div",{style:rJ.heading,children:"Workspace serialized ✓"}),o.stats?(0,d.jsxs)("div",{style:rJ.muted,children:[(0,d.jsx)("div",{style:rJ.statRow,children:`intents: ${o.stats.intents}`}),(0,d.jsx)("div",{style:rJ.statRow,children:`pages: ${o.stats.pages}`}),(0,d.jsx)("div",{style:rJ.statRow,children:`databases: ${o.stats.databases}`}),(0,d.jsx)("div",{style:rJ.statRow,children:`teamspaces: ${o.stats.teamspaces}`}),(0,d.jsx)("div",{style:rJ.statRow,children:`skipped: ${o.stats.skipped}`}),(0,d.jsx)("div",{style:rJ.statRow,children:`conversions: ${o.stats.conversions}`})]}):null,(0,d.jsx)("a",{href:o.intentsDownloadUrl,style:rJ.link,children:"Download intents.json"}),(0,d.jsx)("div",{style:rJ.muted,children:`Download link expires in ${o.expiresInHours} hour${1===o.expiresInHours?"":"s"}. Re-run this tool to mint a fresh link.`}),(0,d.jsx)("div",{style:rJ.heading,children:"Materialize into a new workspace"}),(0,d.jsx)("a",{href:(i=new URLSearchParams({sourceSpaceId:(t={sourceSpaceId:n.spaceId,outputKey:n.outputKey}).sourceSpaceId,outputKey:t.outputKey}),`${a(168962).JZ.admin}/infraAsCode?${i.toString()}
105#adminMaterializeWorkspaceFromIaC`),style:rJ.link,children:"Open the Materialize tool with these inputs pre-filled"}),(0,d.jsxs)("div",{style:rJ.muted,children:["Or paste them manually:",(0,d.jsx)("div",{style:rJ.statRow,children:`source space ID: ${n.spaceId}`}),(0,d.jsx)("div",{style:rJ.statRow,children:`output key: ${n.outputKey}`})]})]})},schema:{spaceId:{type:"string",name:"Space ID",comment:"Space ID of the workspace to serialize.",isRequired:!0},teamId:{type:"string",name:"Teamspace ID (Optional)",comment:"Limit the export to this teamspace and its descendants. Mutually exclusive with Page ID; leave both scope IDs empty to export the whole workspace.",table:"team",isRequired:!1},pageId:{type:"string",name:"Page ID (Optional)",comment:"Limit the export to this page or database and its descendants. Mutually exclusive with Teamspace ID; leave both scope IDs empty to export the whole workspace.",table:"block",isRequired:!1},crawlUserEmail:{type:"string",name:"Crawl as (admin/owner email)",comment:"Email of the admin/owner to crawl as. The workspace is serialized from THIS user's perspective — pick deliberately (e.g. an owner for the fullest view). Must be an admin or owner of the space with Support access enabled.",isRequired:!0}}}
105,adminMaterializeWorkspaceFromIaC:{apiName:"adminMaterializeWorkspaceFromIaC",displayName:"Materialize Workspace from Notion as Code",description:"Create a brand-new workspace for the named owner and rebuild a serialized workspace inside it from its Notion as Code intents (produced by Serialize Workspace to Notion as Code). Full-workspace exports apply the source workspace's name; scoped exports retain the generated import name. Materialization runs as the owner, who ends up owning every record. Known gaps: file attachments are not exported, members/permissions are not transported (owner-only workspace), and serialization outputs expire after ~7 days. Polls for completion automatically.",emoji:"🏗️",customResponseRenderer:function(e){let{data:t}=e,i=(0,a(533992).v3)(),{status:n,errorMessage:s}=rH((0,r.useCallback)(async()=>{let e=await i.api.callApi({eventName:"adminGetMaterializeWorkspaceFromIaCStatus",environment:i,data:{spaceId:t.newSpaceId,outputKey:t.outputKey}});return"success"!==e.type?{type:"error",message:(0,a(201790).V4)(e)}:{type:"success",status:e.data}},[i,t.newSpaceId,t.outputKey]));return void 0!==s?(0,d.jsx)("div",{style:rZ.container,children:(0,d.jsx)("div",{style:rZ.error,children:`Status check failed: ${s}`})}):void 0===n||"pending"===n.state?(0,d.jsxs)("div",{style:rZ.container,children:[(0,d.jsx)("div",{style:rZ.heading,children:"Materializing workspace…"}),(0,d.jsx)("div",{style:rZ.muted,children:`Created workspace ${t.newSpaceId}; rebuilding the serialized content inside it. outputKey: ${t.outputKey}`})]}):"failed"===n.state?(0,d.jsxs)("div",{style:rZ.container,children:[(0,d.jsx)("div",{style:rZ.error,children:`Materialization failed: ${n.error??"unknown error"}`}),(0,d.jsx)("div",{style:rZ.muted,children:`The partially materialized workspace ${t.newSpaceId} was left in place for debugging. Re-run this tool for a fresh attempt.`}),(0,d.jsx)("a",{href:(0,a(132702).nX)(t.newSpaceId),style:rZ.link,target:"_blank",rel:"noopener noreferrer",children:"Open the partial workspace"})]}):(0,d.jsxs)("div",{style:rZ.container,children:[(0,d.jsx)("div",{style:rZ.heading,children:"Workspace materialized ✓"}),(0,d.jsx)("div",{style:rZ.muted,children:`New workspace: ${t.newSpaceId} — named after the source workspace with an "imported @" marker. Only members (e.g. the owner) can open it.`}),n.counts?(0,d.jsxs)("div",{style:rZ.muted,children:[(0,d.jsx)("div",{style:rZ.statRow,children:`teamspaces: ${n.counts.teamspaces}`}),(0,d.jsx)("div",{style:rZ.statRow,children:`databases: ${n.counts.databases}`}),(0,d.jsx)("div",{style:rZ.statRow,children:`pages: ${n.counts.pages}`})]}):null,(0,d.jsx)("a",{href:(0,a(132702).nX)(t.newSpaceId),style:rZ.link,target:"_blank",rel:"noopener noreferrer",children:"Open the new workspace"})]})},isDestructive:!0,schema:{sourceSpaceId:{type:"string",name:"Source Space ID",comment:"Space ID the intents were serialized from.",isRequired:!0},outputKey:{type:"string",name:"Serialization output key",comment:"outputKey returned by Serialize Workspace to Notion as Code. The serialization must have COMPLETED (outputs expire after ~7 days).",isRequired:!0},newOwnerEmail:{type:"string",name:"New workspace owner (email)",comment:"The new workspace is created for and owned by this user; materialization runs as them.",isRequired:!0},planType:{type:"options",name:"Plan type",comment:'Plan type for the new workspace. "team" matches real workspaces (adds a General teamspace the source never had); "personal" is an untested path for teamspace-bearing artifacts.',options:["team","personal"],defaultValue:"team",required:!0},targetWorkspaceRegion:{type:"options",name:"Region",comment:"Region for the new workspace. Only us-west-2 for now.",options:["us-west-2"],defaultValue:"us-west-2",required:!0}}},...sQ,...ow,adminListSnapshots:{apiName:"adminListSnapshots",displayName:"List Snapshots",emoji:"📋",description:"List available snapshots for a block or collection. Click a timestamp to view snapshot content.",schema:{parentTable:{type:"options",options:["block","collection"],defaultValue:"block",comment:"Type of the snapshot parent record"},parentId:{type:"string",comment:"UUID of the parent record"},limit:{type:"number",defaultValue:50,comment:"Maximum number of snapshots to return"}},customResponseRenderer:oh}
105,adminViewSnapshot:{apiName:"adminViewSnapshot",displayName:"View Snapshot",emoji:"👁",description:"View snapshot content with redacted text values, showing page tree structure and record metadata.",schema:{parentTable:{type:"options",options:["block","collection"],defaultValue:"block",comment:"Type of the snapshot parent record"},parentId:{type:"string",comment:"UUID of the parent record"},spaceId:{type:"string",comment:"Space ID of the snapshot"},timestamp:{type:"number",comment:"Snapshot timestamp"},keySchemaVersion:{type:"string",comment:"Optional key schema version; if not provided, will look up from the snapshot record"}},customResponseRenderer:oc},adminCreateSnapshot:{apiName:"adminCreateSnapshot",displayName:"Force Snapshot",emoji:"📸",description:"Immediately create a version history snapshot for a page.",schema:{blockId:{type:"string",isRequired:!0,comment:"UUID of the page to snapshot"},includeInlineCvbBlocks:{type:"boolean",defaultValue:!1,comment:"Check if you edited view config on an inline DB: sort, filter, group, layout type, visible columns, view title, or view order. Adds 1 row per inline CVB on the page."},includeInlineCollections:{type:"boolean",defaultValue:!1,comment:"Check if you edited the inline DB's schema (add/remove/rename column, change type), collection metadata (name, icon, description), or any row (cell values, add/delete rows). Adds 1 row per inline collection on the page."}},customResponseRenderer:function(e){let{data:t}=e,{blockId:i,spaceId:n,recordsSnapshotted:s,snapshotTimestamp:o}=t,l=(0,a(533992).v3)(),[c,p]=(0,r.useState)(void 0),[m,u]=(0,r.useState)(!1),[h,y]=(0,r.useState)(void 0),g=null!==o,x=async()=>{u(!0),y(void 0);try{let e=await l.api.callApi({eventName:"adminListSnapshots",environment:l,data:{parentTable:"block",parentId:i,limit:10}});"success"===e.type?p(e.data):y("Failed to load snapshot list")}catch(e){y(e instanceof Error?e.message:"Failed to load snapshot list")}finally{u(!1)}},f=g?oy.banner:{...oy.banner,...oy.bannerRateLimited};return(0,d.jsxs)("div",{style:oy.container,children:[(0,d.jsxs)("div",{style:f,children:[(0,d.jsx)("span",{style:oy.bannerIcon,children:g?"✅":"⚠️"}),(0,d.jsxs)("div",{style:oy.bannerText,children:[(0,d.jsx)("div",{style:oy.bannerTitle,children:g?"Snapshot created successfully":"Snapshot was rate-limited — no new snapshot created"}),g&&null!==o?(0,d.jsxs)("div",{style:oy.bannerSubtitle,children:[new Date(o).toLocaleString()," (",o," ms)"]}):(0,d.jsx)("div",{style:oy.bannerSubtitle,children:"The block was rate-limited. Check the existing snapshot list below — a recent snapshot may already exist."})]})]}),(0,d.jsxs)("div",{style:oy.section,children:[(0,d.jsx)("div",{style:oy.sectionLabel,children:"Details"}),(0,d.jsxs)("div",{style:oy.metaGrid,children:[(0,d.jsx)("span",{style:oy.metaKey,children:"Block ID"}),(0,d.jsx)("span",{style:oy.metaValue,children:i}),(0,d.jsx)("span",{style:oy.metaKey,children:"Space ID"}),(0,d.jsx)("span",{style:oy.metaValue,children:n})]})]}),(0,d.jsxs)("div",{style:oy.section,children:[(0,d.jsxs)("div",{style:oy.sectionLabel,children:["Records snapshotted (",s.length,")"]}),(0,d.jsx)(a(4458).VP,{gap:4,children:s.map(e=>(0,d.jsxs)("div",{style:oy.recordRow,children:[(0,d.jsx)("span",{style:oy.recordTable,children:e.table}),(0,d.jsx)("span",{style:oy.recordId,children:e.id})]},e.id))})]}),void 0===c?(0,d.jsxs)("div",{style:oy.section,children:[(0,d.jsx)("button",{type:"button",style:{...oy.viewButton,...m?oy.viewButtonDisabled:{}},onClick:x,disabled:m,children:m?(0,d.jsx)(a(517334).k,{size:14}):"View Recent Snapshots"}),h?(0,d.jsx)("div",{style:oy.errorText,children:h}):void 0]}):(0,d.jsxs)("div",{style:oy.section,children:[(0,d.jsx)("div",{style:oy.sectionLabel,children:"Recent Snapshots"}),(0,d.jsx)(oh,{data:c})]})]})}},adminQueryRecordSnapshots:{apiName:"adminQueryRecordSnapshots",displayName:"Query Record Snapshots",emoji:"🧩",description:"Read a bounded set of rows from a record's DynamoDB partition and consolidate them per change, flagging any change with missing chunks. Metadata only — payloads are never read.",schema:{groupingKey:{type:"string",isRequired:!0,comment:"UUID of the grouping key (page id, collection id, etc.)"},recordTable:{type:"options",options:["block","collection","collection_view"],defaultValue:"block",required:!0,comment:"The grouping key's own table; forms the '#table' of the pk."},spaceId:{type:"string",defaultValue:void 0,comment:"Optional. Looked up from the grouping key when left empty; required if lookup fails."},timestamp:{type:"number",comment:"Optional ms-epoch. Reads only changes at or before this timestamp, newest first."},limit:{type:"number",defaultValue:100,comment:"Max rows to read from DynamoDB (1–1000). Defaults to 100."}},customResponseRenderer:function(e){let{data:t}=e,{changes:i,partitionKey:n,spaceId:r,rowsRead:s,truncated:o,unparseableSks:l}=t,c=i.filter(e=>!e.isComplete).length;return(0,d.jsxs)("div",{style:ov.container,children:[(0,d.jsxs)("div",{style:ov.header,children:["Record Snapshots (",i.length," change",1===i.length?"":"s",")",c>0?` \xb7 ${c} incomplete`:""]}),(0,d.jsxs)("div",{style:ov.summaryRow,children:["pk ",n," · space ",r," · ",s," rows read",l.length>0?` \xb7 ${l.length} unparseable sk(s)`:""]}),o?(0,d.jsx)("div",{style:ov.truncatedWarning,children:"Read hit the row cap — older changes were not read, and a chunk set at the cut-off may appear incomplete only because of truncation. Raise the limit or narrow with a timestamp."}):void 0,0===i.length?(0,d.jsx)("div",{style:ov.emptyState,children:"No record snapshots found for this partition."}):(0,d.jsx)("div",{style:ov.scrollList,children:(0,d.jsx)(a(4458).VP,{gap:8,children:i.map(e=>(0,d.jsx)(ok,{change:e},`${e.timestamp}-${e.recordId}-${e.writeId}`))})})]})}},adminQueryRecordSnapshotsAthena:{apiName:"adminQueryRecordSnapshotsAthena",displayName:"Query S3 Archive Record Snapshots",emoji:"🔎",description:"Query archived record snapshot rows from the serving data lake for the same record partition shape as the DynamoDB tool.",preserveInputValuesOnSuccess:!0,schema:{groupingKey:{type:"string",isRequired:!0,comment:"UUID of the grouping key (page id, collection id, etc.)"},recordTable:{type:"options",options:["block","collection","collection_view"],defaultValue:"block",required:!0,comment:"The grouping key's own table; forms the '#table' of the pk."},spaceId:{type:"string",defaultValue:void 0,comment:"Optional. Looked up from the grouping key when left empty; required if lookup fails."},minSk:{type:"string",comment:"Optional inclusive lower SK bound. Provide with maxSk to query sk >= minSk."},maxSk:{type:"string",comment:"Optional inclusive upper SK bound. Provide with minSk to query sk <= maxSk."},limit:{type:"number",defaultValue:20,numberType:"integer",min:1,
105comment:"Maximum rows to return."}},customResponseRenderer:of},adminQueryRecordSnapshotsDuckDbLambda:{apiName:"adminQueryRecordSnapshotsDuckDbLambda",displayName:"Query S3 Archive Record Snapshots (DuckDB Lambda)",emoji:"🦆",description:"Query archived record snapshot rows from the serving data lake through DuckDB Lambda.",preserveInputValuesOnSuccess:!0,schema:{groupingKey:{type:"string",isRequired:!0,comment:"UUID of the grouping key (page id, collection id, etc.)"},recordTable:{type:"options",options:["block","collection","collection_view"],defaultValue:"block",required:!0,comment:"The grouping key's own table; forms the '#table' of the pk."},spaceId:{type:"string",defaultValue:void 0,comment:"Optional. Looked up from the grouping key when left empty; required if lookup fails."},minSk:{type:"string",comment:"Optional inclusive lower SK bound. Provide with maxSk to query sk >= minSk."},maxSk:{type:"string",comment:"Optional inclusive upper SK bound. Provide with minSk to query sk <= maxSk."},limit:{type:"number",defaultValue:20,numberType:"integer",min:1,comment:"Maximum rows to return."}},customResponseRenderer:of},...af};function oG(e){return void 0!==e.notinoAction}function oq(e){var t;return(null==(t=e.notinoAction)?void 0:t.permission)??e.apiName}function oH(e){let t=!e.showIfGate||a(218744).default.checkGate({gateName:e.showIfGate.gateName}),i=void 0===e.availableEnvironments||e.availableEnvironments.includes("production");return t&&i}function oZ(e){let t=!e.showIfGate||e.showIfGate.alwaysEnabledEnvironments.includes("production")||a(218744).default.checkGate({gateName:e.showIfGate.gateName}),i=(void 0===e.availableEnvironments||e.availableEnvironments.includes("production"))&&(void 0===e.productionOnly||e.productionOnly)&&void 0===e.localOnly;return t&&i}},439423(e,t,a){var i=a(635790),n=a(440302);let r={panelContent:{padding:"12px 0",borderBottom:`1px solid ${a(632079).Tj.border.primary}`},panelContentLast:{padding:"12px 0"},chevron:{transition:"transform 100ms ease"},chevronExpanded:{transform:"rotateZ(90deg)"},searchContainer:{marginBottom:12},noResults:{padding:"8px 0"},paginationContainer:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",borderTop:`1px solid ${a(632079).Tj.border.secondary}`,marginTop:8},showMoreButton:{cursor:"pointer",background:"none",border:"none",padding:"4px 8px",color:a(632079).Tj.text.accentPrimary,borderRadius:4}};function s({title:e,count:t,filteredCount:o,visibleCount:l,isExpanded:d,onToggle:c,onShowMore:p,isFirst:m,isLast:u,searchQuery:h,onSearchChange:y,children:g,pageSize:x=20}){let f=0===t,b={cursor:f?"default":"pointer",paddingTop:12*!m,paddingBottom:12,borderBottom:u&&!d?void 0:`1px solid ${a(632079).Tj.border.primary}`,opacity:f?.5:void 0},v=(0,i.useCallback)(e=>{y(e.target.value)},[y]),j=(0,i.useCallback)(()=>{y("")},[y]),k=""!==h.trim()?`${o}/${t}`:t,S=l<o,w=o-l;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:b,onClick:()=>{f||c()},role:"button",tabIndex:f?-1:0,onKeyDown:e=>{f||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),c())},"aria-disabled":f,"aria-expanded":f?void 0:d,children:(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(16275).I,{icon:a(342392).arrowChevronSingleRightIcon,size:"sm",colorVariant:f?"disabled":"secondary",style:{...r.chevron,...d&&!f?r.chevronExpanded:void 0}}),(0,n.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:[e," (",k,")"]})]})}),d&&!f?(0,n.jsxs)("div",{style:u?r.panelContentLast:r.panelContent,children:[(0,n.jsx)("div",{style:r.searchContainer,children:(0,n.jsx)(a(287562).p,{value:h,onChange:v,placeholder:`Search ${e.toLowerCase()}...`,showClearButton:h.length>0,onClearButtonClick:j})}),0===o&&""!==h.trim()?(0,n.jsx)("div",{style:r.noResults,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:['No results found for "',h,'"']})}):(0,n.jsxs)(n.Fragment,{children:[g,S?(0,n.jsxs)("div",{style:r.paginationContainer,children:[(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:["Showing ",l," of ",o]}),(0,n.jsx)("button",{type:"button",style:r.showMoreButton,onClick:p,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"accentPrimary",children:["Show more (",Math.min(x,w)," more)"]})})]}):o>x?(0,n.jsx)("div",{style:r.paginationContainer,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:["Showing all ",o]})}):void 0]})]}):void 0]})}a.d(t,{v:()=>s})},861552(e,t,a){a.r(t),a.d(t,{Admin:()=>d}),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(159952);var i=a(635790),n=a(440302);let r={style0:{fontWeight:a(699422).Wy.bold,fontSize:18},positionRelative:{position:"relative"}}
105;function s(){let[e,t]=(0,i.useState)(""),s=(0,i.useCallback)(e=>{t(e.target.value)},[]),o=(0,i.useCallback)(()=>{let t=(0,a(185612).AI)(e);t&&(0,a(318620).Y)(t)},[e]);return(0,n.jsxs)(a(4458).VP,{gap:12,className:"autolayout-fill-width",style:r.positionRelative,children:[(0,n.jsx)("div",{style:r.style0,children:"Find a user, workspace, or block"}),(0,n.jsx)(a(287562).p,{placeholder:"Email, UUID, or Stripe customer ID",value:e,onChange:s,onSubmit:o}),(0,n.jsx)(a(548436).A,{onClick:o,children:"Find!"})]})}let o={adminItem:(0,a(120308).Uw)(),adminWrap:(0,a(120308).pj)(),updateInfoTitle:{fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:12,color:a(632079).Tj.text.primary},updateInfoText:{fontSize:14,lineHeight:1.5,color:a(632079).Tj.text.primary,marginBottom:12},updateInfoBullet:{fontSize:14,lineHeight:1.6,color:a(632079).Tj.text.secondary,marginBottom:8,paddingInlineStart:8},style0:{marginBottom:12},style2:{textDecoration:"underline"},style3:{flex:1},style4:{height:"auto"},style6:{marginTop:12,display:"flex",alignItems:"center"},style7:{marginTop:24,marginBottom:12,width:"100%"}},l={style0:{fontWeight:a(699422).Wy.bold,fontSize:20,marginBottom:12,width:"100%",marginInlineStart:o.adminItem.margin}};function d(){let{navigate:e}=(0,i.useContext)(a(44894).E),t=(0,a(533992).v3)(),r=(0,a(743187).g)(),[d,c]=(0,a(579993).K8)(()=>{let e=(0,a(427846)._)(t);return[null==e?void 0:e.isDefined(),null==e?void 0:e.getEmail()]},[t]),{currentUserPermissions:p,fetchPermissionsErrored:m}=(0,a(579993).K8)(()=>{let{currentUserPermissions:e,fetchPermissionsErrored:t}=r.state;return{currentUserPermissions:e,fetchPermissionsErrored:t}},[r]),u=(0,a(579993).K8)(()=>a(718473).N.state??!1,[]),h=(0,a(579993).K8)(()=>a(235658).K.state??!0,[]),y=(0,a(579993).K8)(()=>a(229408).A.state||[],[]),g=(0,a(579993).K8)(()=>{let{apiOwnershipMap:e}=r.state;return e},[r]),x=(0,a(579993).K8)(()=>{if(0===y.length)return[];let e=new Set(y);return Object.values(a(688211)._P).filter(t=>{let i=e.has(t.apiName);return(0,a(688211).qO)(t)&&i})},[y]),f=(0,i.useCallback)(()=>{a(499748).A(t)},[t]),b=(0,i.useCallback)(()=>{a(718473).N.setState(!u)},[u]),v=(0,i.useCallback)(()=>{a(235658).K.setState(!h)},[h]),j=(0,a(392096).Gm)({url:`${a(139424).A.domainBaseUrl}${a(168962).JZ.login}`,query:{redirectURL:a(168962).JZ.admin}});return(0,n.jsx)(a(45062).A,{title:"Notion Admin Mode",children:(0,n.jsxs)(a(220952).U,{currentSection:"home",children:[(0,n.jsx)("div",{style:o.adminWrap,children:(0,n.jsxs)("div",{style:a(120308).zR,children:[(0,n.jsxs)("div",{style:o.adminItem,children:[(0,n.jsx)(a(553775).xu,{}),(0,n.jsxs)("div",{style:o.style0,children:[(0,n.jsx)(a(590422).Q,{href:"https://dev.notion.so/notion/Use-Admin-Mode-05f1e0ad9aa749a4b3dc07410b499465",external:!0,inline:!0,underline:!0,children:"Click here"})," to learn more about how to use Admin Mode."]}),(0,n.jsxs)(a(4458).fI,{children:[d?void 0:(0,n.jsx)("div",{style:a(120308).aW,children:(0,n.jsx)(a(590422).Q,{style:o.style2,href:j,children:"Please log in."})}),d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:o.style3,children:["Currently Logged in as: ",c]}),(0,n.jsx)(a(548436).A,{size:"lg",onClick:f,style:o.style4,children:"Log Out"})]}):void 0]}),(0,n.jsxs)(a(4458).fI,{marginTop:10,children:[(0,n.jsxs)(a(548436).A,{size:"lg",onClick:b,style:o.style4,children:[u?"Hide":"Show"," UUID dashes"]}),(0,n.jsxs)(a(548436).A,{size:"lg",onClick:v,style:o.style4,children:[h?"Hide":"Show"," formatted timestamps"]})]}),!m&&d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("hr",{}),(0,n.jsx)(a(607142).G,{permissionsSet:p})]}):void 0,(0,n.jsx)(a(548436).A,{size:"lg",onClick:()=>{e({environment:t,url:"/"})},style:o.style6,iconLeading:{icon:a(551754).arrowStraightLeftFillSmallIcon,size:"sm"},children:"Navigate to user workspace"}),null!=p&&p.has("adminFindObject")?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("hr",{}),(0,n.jsx)(s,{})]}):void 0]}),(0,n.jsxs)("div",{style:o.adminItem,children:[(0,n.jsx)("div",{style:o.updateInfoTitle,children:"What's New"}),(0,n.jsx)("div",{style:o.updateInfoText,children:"Admin Mode has been updated with new navigation features:"}),(0,n.jsxs)("div",{style:o.updateInfoBullet,children:["• ",(0,n.jsx)("strong",{children:"Global Search:"})," Press Cmd-/ (or Ctrl-/ on Windows) to quickly search across all admin sections and tools"]}),(0,n.jsxs)("div",{style:o.updateInfoBullet,children:["• ",(0,n.jsx)("strong",{children:"Sidebar Navigation:"})," Use the left sidebar to browse admin tools organized by section"]}),(0,n.jsxs)("div",{style:o.updateInfoBullet,children:["• ",(0,n.jsx)("strong",{children:"Qu
105ick Navigation:"})," Click any search result to jump directly to that tool or section"]})]}),x.length>0?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("hr",{style:o.style7}),(0,n.jsx)("div",{style:l.style0,children:"⭐ Favorite Tools"}),x.map(e=>{let t=(0,a(688211).JZ)(e),i=g?g[t]:void 0;return(0,n.jsx)(a(869589).RE,{style:o.adminItem,api:e,owner:i,hasPermission:p?p.has(t):void 0},e.apiName)})]}):void 0]})}),(0,n.jsx)(a(514164).N9,{hideProgressBar:!0,autoClose:1500,transition:a(514164).q7})]})})}},220952(e,t,a){a.d(t,{U:()=>p}),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(159952),a(765324);var i=a(635790),n=()=>a(604063),r=()=>a(688211);a(533958),a(435368);var s=a(440302);let o={flex:1,maxWidth:600,position:"relative",marginInlineStart:"auto",marginInlineEnd:"auto",zIndex:1001},l={searchBarContainer:(0,a(120308).G4)(),searchBarTitle:(0,a(120308).HS)(),searchResults:(0,a(120308).Ib)(),searchResultItem:(0,a(120308).qp)(),searchResultItemHover:(0,a(120308).iF)(),searchResultTitle:(0,a(120308).Hb)(),searchResultSection:(0,a(120308).OD)(),searchResultBadge:(0,a(120308).mX)(),searchResultViewAllCta:{fontWeight:a(699422).Wy.semibold},searchIcon:{marginInlineEnd:6,flexGrow:0,flexShrink:0,fill:a(632079).Tj.icon.secondary}};function d({onNavigateToTool:e}){let t=(0,a(533992).v3)(),{navigate:c}=(0,i.useContext)(a(44894).E),p=(0,a(743187).g)(),m=(0,a(579993).uB)(void 0,a(419110).$),[u,h]=(0,a(739271).s)(),y=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=p.state;return e},[p]),[g,x]=(0,a(579993).K8)(()=>[void 0,!1],[!1,p]),[f,b]=((0,a(579993).K8)(()=>void 0,[!1]),(0,a(579993).K8)(()=>{let e=(0,a(427846)._)(t);return[null==e?void 0:e.isDefined(),null==e?void 0:e.getEmail()]},[t])),v=(0,a(579993).K8)(()=>a(718473).N.state??!1,[]),j=(0,a(579993).K8)(()=>a(235658).K.state??!0,[]),k=(0,a(579993).K8)(()=>a(198074).a.state??!1,[]),[S,w]=(0,i.useState)(""),[I,C]=(0,i.useState)(!1),[D,T]=(0,i.useState)(!1),[R,A]=(0,i.useState)(!1),N=(0,i.useRef)(null),M=(0,a(579993).K8)(()=>void 0===y?[]:Object.values(r()._P).filter(e=>(0,r().qO)(e)&&(k||y.has((0,r().JZ)(e)))),[y,k]),P=(0,a(579993).K8)(()=>n().wJ.filter(e=>(0,r().mu)(n().i8[e])&&(0,a(315965).s)({sectionName:e,currentUserPermissions:y,environmentName:"production",showToolsWithoutPermission:k})),[y,k]),V=(0,i.useMemo)(()=>{let e;if(S.length<=1)return[];let t=S.toLowerCase();try{e=RegExp(t,"i")}catch(e){return(0,a(208318).t)().error({from:"AdminGlobalSearch",type:"invalidAdminGlobalSearchRegex",error:e instanceof Error?e.name:"SyntaxError"}),[]}let i=[];for(let e of P){let a=n().i8[e];a.title.toLowerCase().includes(t)&&i.push({type:"section",sectionName:e,sectionTitle:a.title})}for(let t of M)if((0,r().sK)(t,e)){let e=function(e){for(let t of n().wJ)if(new Set(n().i8[t].tools).has(e))return t}(t.apiName);e&&i.push({type:"tool",api:t,sectionName:e,sectionTitle:n().i8[e].title})}return i},[M,P,S]),E=D||V.length<=15?V:[...V.slice(0,15),{type:"view-all"}],B=e=>{e.preventDefault()},L=e=>t=>{(0,a(874873).BV)(),e(t)},_=e=>{let{badgeLabel:t,caption:i,props:n,title:r}=e;return(0,s.jsx)(a(95582).A,{...n,badge:(0,s.jsx)("span",{style:l.searchResultBadge,children:t}),buttonStyle:l.searchResultItem,caption:i,captionStyle:l.searchResultSection,hoveredStyle:l.searchResultItemHover,onMouseEnter:L(n.onMouseEnter),onMouseDown:B,title:r,titleStyle:l.searchResultTitle})},U=E.map(i=>{if("view-all"===i.type)return{key:"view-all",action:()=>{T(!0)},render:e=>(0,s.jsx)(a(95582).A,{...e,buttonStyle:l.searchResultItem,hoveredStyle:l.searchResultItemHover,onMouseEnter:L(e.onMouseEnter),onMouseDown:B,shouldWrapTitle:!0,title:(0,s.jsxs)("span",{style:l.searchResultSection,children:[`Showing 15 of ${V.length} results - narrow your search for better matches, or `,(0,s.jsx)("span",{style:l.searchResultViewAllCta,children:"view all results"})]})})};if("section"===i.type)return{key:`section-${i.sectionName}`,action:()=>{var e,n;e=i.sectionName,c({environment:t,url:`${a(168962).JZ.admin}/${e}`}),w(""),T(!1),C(!1),m.unsetFocus(),null==(n=N.current)||n.blur()},render:e=>_({props:e,badgeLabel:"Section",title:i.sectionTitle})};let n=i.api.displayName||i.api.apiName;return{key:`tool-${i.api.apiName}`,action:()=>{var n,r,s;n=i.sectionName,r=i.api.apiName,c({environment:t,url:`${a(168962).JZ.admin}/${n}#${r}`}),e&&e(n,r),w(""),T(!1),C(!1),m.unsetFocus(),null==(s=N.current)||s.blur()},render:e=>_({props:e,badgeLabel:"Tool",title:n,caption:i.sectionTitle})}}),W=I&&E.length>0&&S.length>1;return(0,s.jsx)(a(369064).N,{capture:!I,debugName:"AdminGlobalSearch",onCommandSlash:e=>{var t;e.preventDefault(),w(""),T(!1),m.unsetFocus(),null==(t=N.current)||t.focu
105s(),C(!0)},children:(0,s.jsxs)("div",{style:l.searchBarContainer,children:[(0,s.jsxs)("div",{style:l.searchBarTitle,children:["Notion Admin Mode (","production",")"]}),(0,s.jsxs)("div",{style:o,children:[(0,s.jsx)(a(287562).p,{showClearButton:!0,forceShowClearButton:!0,clearButtonStyle:{visibility:S.length>0?"visible":"hidden"},placeholder:"Search sections and tools (cmd-/)",ref:N,value:S,onChange:e=>{let t=e.target.value;(w(t),T(!1),t.length>1)?m.setState({focus:{section:0,indexLocal:0,indexGlobal:0,footerFocused:!1}}):m.unsetFocus()},inputElementAttributes:u.inputElementAttributes,suppressFocusRing:u.suppressFocusRing,onFocus:()=>{u.onFocus(),C(!0)},onBlur:()=>{u.onBlur(),C(!1),m.unsetFocus()},onKeyDown:e=>{if("Escape"===e.key){var t;e.preventDefault(),w(""),T(!1),C(!1),m.unsetFocus(),null==(t=N.current)||t.blur()}},left:(0,s.jsx)(a(16275).I,{icon:a(921048).magnifyingGlassSmallIcon,size:"xs",style:l.searchIcon})}),W?(0,s.jsx)(a(879836).H,{style:l.searchResults,type:a(644154).A.Y,children:(0,s.jsx)(a(558045).A,{type:a(558045).O.Vertical,comboboxProps:h,initialFocus:0,role:"listbox",sections:[{key:"results",items:U}],store:m})}):void 0]}),(0,s.jsxs)(a(4458).fI,{gap:8,flexShrink:0,children:[void 0,(0,s.jsx)(a(988022).p,{size:"md",href:a(168962).JZ.adminNotinoActionRuns,children:"Action history"}),(0,s.jsx)(a(543313).A,{selectedTitle:"Preferences",renderMenuSections:()=>[{key:"preferences-menu",items:[{key:"uuid-dashes",action:()=>{a(718473).N.setState(!v)},render:e=>(0,s.jsx)(a(95582).A,{...e,title:v?"Hide UUID dashes":"Show UUID dashes"})},{key:"formatted-timestamps",action:()=>{a(235658).K.setState(!j)},render:e=>(0,s.jsx)(a(95582).A,{...e,title:j?"Hide formatted timestamps":"Show formatted timestamps"})},{key:"tools-without-access",action:()=>{a(198074).a.setState(!k)},render:e=>(0,s.jsx)(a(95582).A,{...e,title:k?"Hide tools without access":"Show tools without access"})}]}]}),(0,s.jsx)(a(543313).A,{selectedTitle:f?`Logged in as ${b}`:"You're not logged in",renderMenuSections:e=>[{key:"user-menu",items:f?[{key:"logout",action:()=>{A(!0),a(499748).A(t),e.close()},render:e=>(0,s.jsx)(a(95582).A,{...e,title:R?"Logging you out...":"Log out",disabled:R})}]:[{key:"login",action:()=>{c({environment:t,url:a(168962).JZ.login}),e.close()},render:e=>(0,s.jsx)(a(95582).A,{...e,title:"Log in"})}]}]})]})]})})}let c={sidebar:(0,a(120308).sA)(),sidebarLink:(0,a(120308).iR)(),sidebarLinkActive:(0,a(120308).wJ)(),layout:(0,a(120308).AG)(),searchContainer:(0,a(120308).hL)()};function p({children:e,currentSection:t}){let o=(0,i.useRef)(null),l=(0,a(743187).g)(),m=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=l.state;return e},[l]),u=(0,a(579993).K8)(()=>a(198074).a.state??!1,[]),h=(0,a(579993).K8)(()=>void 0===m?[]:Object.values(r()._P).filter(r().qO).filter(e=>u||m.has((0,r().JZ)(e))),[u,m]),y=(0,a(579993).K8)(()=>n().wJ.filter(e=>(0,r().mu)(n().i8[e])),[]),g=(0,i.useMemo)(()=>void 0===m?[]:y.filter(e=>{let t=n().i8[e];if(0===t.tools.length)return(0,a(315965).s)({sectionName:e,currentUserPermissions:m,environmentName:"production",showToolsWithoutPermission:u});if(u||void 0===m)return!0;let i=new Set(t.tools);return h.some(e=>i.has(e.apiName))}),[h,y,u,m]);return(0,i.useEffect)(()=>{o.current&&(o.current.scrollTop=0)},[t]),(0,s.jsxs)("div",{style:c.layout,children:[(0,s.jsx)("div",{style:c.searchContainer,children:(0,s.jsx)(d,{})}),(0,s.jsxs)("div",{style:a(120308).PL,children:[(0,s.jsxs)("div",{style:c.sidebar,children:[(0,s.jsx)(a(590422).Q,{href:a(168962).JZ.admin,style:{...c.sidebarLink,..."home"===t?c.sidebarLinkActive:void 0},children:"Home"}),g.map(e=>{let i=n().i8[e],r=t===e;return(0,s.jsx)(a(590422).Q,{href:`${a(168962).JZ.admin}/${e}`,style:{...c.sidebarLink,...r?c.sidebarLinkActive:void 0},children:i.title},e)})]}),(0,s.jsx)("div",{ref:o,style:a(120308).TS,children:e})]})]})}},287903(e,t,a){a.r(t),a.d(t,{AdminSectionPage:()=>D}),a(435368),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(159952),a(176765),a(851344),a(866491);var i=a(635790),n=()=>a(48697),r=()=>a(4458),s=()=>a(2825);a(533958),a(139583);var o=a(440302);function l(e){var t;let{fileInput:n,selectedFile:s,error:l,disabled:d,onChange:c}=e,p=(0,i.useRef)(null),m=(0,i.useId)(),u=(0,i.useId)(),h=(0,i.useCallback)(()=>{null!==p.current&&(p.current.value="",p.current.click())},[]),y=(0,i.useCallback)(()=>{null!==p.current&&(p.current.value=""),c(void 0)},[c]);return(0,o.jsxs)(r().VP,{gap:6,children:[(0,o.jsxs)(r().VP,{gap:2,children:[(0,o.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:`File${n.required?" *":""}`}),(0,o.jsx)(a(111010).D,{id:m,styleKey:"captionRegular",colorVariant:"tertiary",children:n.description})]}),(0,o.jsxs)(r().fI,{gap:8,alignItems:"center",children:[(0,o.jsx)(a(548436).A,{size:"sm",disabled:d,onClick:h,"aria-describedby":void 0===l?m:u,children:"Choose file"}),void 0!==s?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(a(111010).D,{styleKey:"bodySm",lineClamp:1,children:s.name}),(0,o.jsx)(a(988022).p,{size:"sm",disabled:d,onClick:y,children:"Clear"})]}):null]}),(0,o.jsx)("input",{ref:p,...{className:"x1s85apg"},type:"file",accept:null==(t=n.accept)?void 0:t.join(","),disabled:d,onChange:e=>{var t;return c(null==(t=e.target.files)?void 0:t[0])}}),void 0!==l?(0,o.jsx)("div",{id:u,role:"alert",...{className:"x1npf708"},children:(0,o.jsx)(a(111010).D,{styleKey:"captionRegular",children:l})}):null]})}async function d(e){let{environment:t,toolId:i,file:n,isCurrent:r}=e,s=await t.api.callApi({eventName:"adminCreateToolProxyUploadIntent",environment:t,data:{toolId:i,filename:n.name,...""!==n.type?{contentType:n.type}:void 0,contentLength:n.size}});if(!r())return;if("success"!==s.type)throw Error(`Could not prepare upload: ${(0,a(201790).V4)(s)}`);let o=new Headers;for(let e of s.data.putHeaders)o.set(e.name,e.value);let l=await (e.fetchFn??fetch)(s.data.signedPutUrl,{method:"PUT",headers:o,body:n});if(r()){if(!l.ok)throw Error(`File upload failed (${l.status} ${l.statusText}).`);return{type:"uploaded",signedToken:s.data.signedToken}}}function c({currentUserPermissions:e,showToolsWithoutPermission:t}){let n=(0,a(533992).v3)(),s=(0,a(734944).Ng)(),l=(0,i.useMemo)(()=>(0,a(851900).vv)(e,"production",{includeUnauthorized:t}),[e,t]),[h,g]=(0,i.useState)(""),[x,f]=(0,i.useState)(""),[b,v]=(0,i.useState)({}),[j,k]=(0,i.useState)({}),[S,w]=(0,i.useState)(void 0),[I,C]=(0,i.useState)(void 0),[D,T]=(0,i.useState)(void 0),[R,A]=(0,i.useState)(!1),[N,M]=(0,i.useState)(!1),[P,V]=(0,i.useState)(void 0),E=(0,i.useMemo)(()=>l.find(e=>e.toolId===x),[l,x]),B=(0,i.useRef)(0);(0,i.useEffect)(()=>()=>{B.current+=1},[]);let L=(0,i.useCallback)(()=>{B.current+=1,V(void 0),T(void 0)},[]),_=(0,i.useCallback)(e=>{L(),f(e.toolId),v((0,a(851900).Lv)(e)),k({}),w(void 0),C(void 0),A(!1)},[L]),U=(0,i.useCallback)(()=>{L(),f(""),v({}),k({}),w(void 0),C(void 0),A(!1)},[L]),W=(0,i.useCallback)((e,t)=>{L(),v(a=>({...a,[e]:t}))},[L]),F=(0,i.useCallback)(e=>{L(),w(e),C(void 0)},[L]),K=(0,i.useCallback)(()=>{L(),A(e=>!e)},[L]),$=(0,i.useCallback)(()=>
105{if(void 0===E)return;let e=(0,a(851900).uJ)(E,b),t=(0,a(851900).EE)(E,S);if(k(e),C(t),Object.keys(e).length>0||void 0!==t)return;let i=(0,a(851900).gu)(E,b),r=B.current+=1,s=()=>B.current===r;M(!0),V(void 0),T(void 0),(async()=>{try{let e=void 0===S?void 0:await d({environment:n,toolId:E.toolId,file:S,isCurrent:s});if(!s()||void 0!==S&&void 0===e)return;let t=await n.api.callApi({eventName:"adminRunToolProxyScript",environment:n,data:{toolId:E.toolId,input:{params:i,...void 0!==e?{file:e}:void 0},dryRun:R}});s()&&V(t)}catch(e){s()&&T(e instanceof Error?e.message:"Unexpected error.")}finally{M(!1)}})()},[n,E,S,b,R]);return void 0===e?(0,o.jsx)("div",{...{className:"x78zum5 xdt5ytf x1kb72lq x18hwk67 xh8yej3 x7ep2pv xvc5jky x11t971q"},children:(0,o.jsx)(r().fI,{justifyContent:"center",padding:48,children:(0,o.jsx)(a(517334).k,{size:28})})}):0===l.length?(0,o.jsx)("div",{...{className:"x78zum5 xdt5ytf x1kb72lq x18hwk67 xh8yej3 x7ep2pv xvc5jky x11t971q"},children:(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"You don't have permission to run any Tool Proxy scripts."})}):(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf x1kb72lq x18hwk67 xh8yej3 x7ep2pv xvc5jky x11t971q"},children:[(0,o.jsxs)("div",{...{className:"x78zum5 x1pha0wt x1qughib xp1r0qw xtqikln"},children:[(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Run a maintenance script through the Tool Proxy."}),(0,o.jsx)("a",{href:a(734944).FO,onClick:e=>s(a(734944).FO,e),...{className:"x2lah0s x1hl2dhg xt0b8zv x1b8rd1j x1ypdohk"},children:(0,o.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:"Run history â
105†’"})})]}),void 0===E?(0,o.jsx)(p,{scripts:l,search:h,onSearchChange:g,onSelect:_}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m,{script:E,canRun:e.has(E.permission),onChange:U}),(0,o.jsx)(u,{script:E,values:b,errors:j,selectedFile:S,fileError:I,dryRun:R,isSubmitting:N,isPreviewOnly:!e.has(E.permission),onFieldChange:W,onFileChange:F,onToggleDryRun:K,onSubmit:$}),void 0!==P?(0,o.jsx)(y,{result:P}):null,void 0!==D?(0,o.jsx)("div",{role:"alert",...{className:"x78zum5 xdt5ytf x1b8z93w x1amjocr x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf x178xt8z x1lun4ml xso031l xpilrb4 x13fuv20 x18b5jzi x1q0q8m5 x1t7ytsu x5ut2bn x1w0uxo6 xe77maj xt2mrcb xjqs0th"},children:(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:D})}):null]})]})}function p({scripts:e,search:t,onSearchChange:i,onSelect:n}){let r=t.trim().toLowerCase(),s=""===r?e:e.filter(e=>[e.displayName,e.description,e.toolId].some(e=>e.toLowerCase().includes(r)));return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{...{className:"x78zum5 x6s0dn4 x3pnbk8 xfex06f x16wdlz0 x1g0dm76 xpdmqnj x1obq294 x5a5i1n xde0f50 x15x8krk xd54fh8 x178xt8z x1lun4ml xso031l xpilrb4 x13fuv20 x18b5jzi x1q0q8m5 x1t7ytsu xl4im7t x1g1mrbw xpbub5a xhgqxmc x1rwl2r7 x1lo0vff x1kdg6ob x1a5r7i"},children:[(0,o.jsx)(a(16275).I,{icon:a(921048).magnifyingGlassSmallIcon,size:16,colorVariant:"tertiary"}),(0,o.jsx)("input",{className:"x98rzlu xeuugli x76ihet xtmcdsl x112ta8 x4gj9lk x1a2a7pz x1md70p1 x39shxw xjb2p0i xif65rj",type:"text","aria-label":"Search scripts",placeholder:"Search scripts…",value:t,onChange:e=>i(e.target.value)})]}),0===s.length?(0,o.jsx)("div",{...{className:"xhsfehk xa8xo2u x1q4eyhr xh27kie x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 x1miatn0 x1gan7if x13jy36j x64bnmy x2b8uid"},children:(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:`No scripts match “${t.trim()}”.`})}):(0,o.jsx)("div",{...{className:"xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 x6ikm8r x10wlt62 xd54fh8"},children:s.map((e,t)=>(0,o.jsxs)("button",{type:"button",onClick:()=>n(e),...{0:{className:"x78zum5 x6s0dn4 xp1r0qw xtqikln xh8yej3 x1yc453h x76ihet xtmcdsl x112ta8 x4gj9lk xd54fh8 xfcwbsc x15zahet x1a2a7pz x1w79tpz x2ssjo2 x1ypdohk xf7dkkf xv54qhq xz9dl7a xsag5q8"},1:{className:"x78zum5 x6s0dn4 xp1r0qw xtqikln xh8yej3 x1yc453h xtmcdsl x112ta8 x4gj9lk xd54fh8 xfcwbsc x15zahet x1a2a7pz x1w79tpz x2ssjo2 x1ypdohk xf7dkkf xv54qhq xz9dl7a xsag5q8 xiycden"}}[t>0|0],children:[(0,o.jsxs)("div",{...{className:"x98rzlu xeuugli x78zum5 xdt5ytf x1dbijih x1ned7t2"},children:[(0,o.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",lineClamp:1,children:e.displayName}),(0,o.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",lineClamp:2,children:e.description})]}),(0,o.jsx)(g,{executionMode:e.executionMode}),(0,o.jsx)(a(16275).I,{icon:a(491469).arrowChevronSingleRightSmallIcon,size:16,colorVariant:"tertiary",...{className:"x2lah0s"}})]},e.toolId))})]})}function m({script:e,canRun:t,onChange:i}){return(0,o.jsxs)("div",{...{className:"x78zum5 x1cy8zhl x1qughib xp1r0qw xtqikln xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:[(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf x1r0jzty x17zd0t2 xeuugli"},children:[(0,o.jsxs)("div",{...{className:"x78zum5 x6s0dn4 x3pnbk8 xfex06f x1a02dak"},children:[(0,o.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:e.displayName}),(0,o.jsx)(g,{executionMode:e.executionMode,showPreview:!t})]}),e.description?(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:e.description}):null]}),(0,o.jsx)(a(988022).p,{size:"sm",colorPalette:"gray",iconLeading:a(241996).s,onClick:i,children:"Change"})]})}function u({script:e,values:t,errors:i,selectedFile:n,fileError:r,dryRun:s,isSubmitting:d,isPreviewOnly:c,onFieldChange:p,onFileChange:m,onToggleDryRun:y,onSubmit:g}){return(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf x1o0lzc5 xq5c7ks"},children:[e.inputs.params.map(e=>(0,o.jsx)(h,{param:e,value:t[e.name],error:i[e.name],onChange:p}
105,e.name)),void 0!==e.inputs.file?(0,o.jsx)(l,{fileInput:e.inputs.file,selectedFile:n,error:r,disabled:d||c,onChange:m}):null,0===e.inputs.params.length&&void 0===e.inputs.file?(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"This script takes no parameters."}):null,(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf x14vct77 xiyxwb5 xiycden xyamay9"},children:["supported"===e.dryRunSupport?(0,o.jsxs)("div",{...{className:"x78zum5 x6s0dn4 x3pnbk8 xfex06f"},children:[(0,o.jsx)(a(813415).d,{on:s,onClick:y,"aria-label":"Dry run"}),(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:"Dry run"}),(0,o.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"— simulate without making changes"})]}):null,(0,o.jsx)("div",{...{className:"x78zum5"},children:(0,o.jsx)(a(912946).j,{onClick:g,disabled:d||c,children:d?"Running…":"Run script"})}),c?(0,o.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"Preview only — you don't have permission to run this script."}):null]})]})}let h=i.memo(function({param:e,value:t,error:i,onChange:n}){let{control:r}=e,s=e.label??e.name,l="string"==typeof t?t:"";return(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf xw09woa xmixu3c"},children:[(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf x1dbijih x1ned7t2"},children:[(0,o.jsxs)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:[s,e.required?" *":""]}),e.description?(0,o.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:e.description}):null]}),"boolean"===r.type?(0,o.jsx)(a(813415).d,{on:!0===t,onClick:()=>n(e.name,!0!==t),"aria-label":s}):"select"===r.type?(0,o.jsxs)("select",{...{className:"xh8yej3 x9f619 x1g0dm76 x1obq294 x5a5i1n xde0f50 x15x8krk xd54fh8 x39shxw xjb2p0i xif65rj x178xt8z x1lun4ml xso031l xpilrb4 x13fuv20 x18b5jzi x1q0q8m5 x1t7ytsu xl4im7t xgnjzfx xpbub5a x7pnk5p x1rwl2r7 xc1ditg x1kdg6ob x1ynhl8g x1a2a7pz x16wdlz0 xjyslct xhig867 x1bsvlme xexx8yu x18d9i69 x1ypdohk xjgexuv xiy17q3 xva6ddr"},"aria-label":s,value:l,onChange:t=>n(e.name,t.target.value),children:[(0,o.jsx)("option",{value:"",children:"Select…"}),r.options.map(e=>(0,o.jsx)("option",{value:e.value,children:e.label},e.value))]}):"json"===r.type?(0,o.jsx)(a(913646).J,{ariaLabel:s,value:l,jsonSchema:"object"==typeof e.schema?e.schema:void 0,onChange:t=>n(e.name,t)}):"string"===r.type&&r.multiline?(0,o.jsx)("textarea",{...{className:"xh8yej3 x9f619 x1y1aw1k xwib8y2 x1g0dm76 xpdmqnj x1obq294 x5a5i1n xde0f50 x15x8krk xd54fh8 x39shxw xjb2p0i xif65rj x178xt8z x1lun4ml xso031l xpilrb4 x13fuv20 x18b5jzi x1q0q8m5 x1t7ytsu xl4im7t xgnjzfx xpbub5a x7pnk5p x1rwl2r7 xc1ditg x1kdg6ob x1ynhl8g x1a2a7pz x3ilyx8 x288g5 x1fc57z9"},"aria-label":s,value:l,placeholder:r.placeholder,onChange:t=>n(e.name,t.target.value)}):(0,o.jsx)(a(287562).p,{"aria-label":s,value:l,placeholder:"string"===r.type?r.placeholder:void 0,onChange:t=>n(e.name,t.target.value)}),void 0!==i?(0,o.jsx)(a(111010).D,{className:"x1npf708",styleKey:"captionRegular",children:i}):null]})});function y({result:e}){let t=(0,a(734944).Ng)();if("success"===e.type&&"object"==typeof e.data&&null!==e.data){let i=function(e){if("object"!=typeof e||null===e||!("executionId"in e))return;let{executionId:t}=e;return"string"==typeof t?t:void 0}(e.data),n=void 0!==i?(0,a(734944)._M)(i):void 0;return(0,o.jsxs)("div",{...{className:"x78zum5 xdt5ytf x1b8z93w x1amjocr x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf x178xt8z x1lun4ml xso031l xpilrb4 x13fuv20 x18b5jzi x1q0q8m5 x1t7ytsu x1gpoxa x7095yp x1cunp8e xwchxxo x16l9yd1"},children:[(0,o.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorPalette:"green",colorVariant:"accentPrimary",children:"Run started"}),void 0!==n?(0,o.jsx)("a",{href:n,onClick:e=>t(n,e),...{className:"xqcrz7y x1hl2dhg xt0b8zv x1ypdohk"},children:(0,o.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorPalette:"blue",colorVariant:"accentPrimary",children:"View full run →"})}):null,(0,o.jsx)(a(243119).A,{data:e.data,hideHelp:!0})]})}let i="failed"===e.type?(0,a(201790).V4)(e):"Unexpected response.";return(0,o.jsx)("div",{...{className:"x78zum5 xdt5ytf x1b8z93w x1amjocr x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf x178xt8z x1lun4ml xso031l xpilrb4 x13fuv20 x18b5jzi x1q0q8m5 x1t7ytsu x5ut2bn x1w0uxo6 xe77maj xt2mrcb xjqs0th"},children:(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:i})})}function g({executionMode:e,showPreview:t}){return(0,o.jsxs)("div",{...{className:"x78zum5 x6s0dn4 xw09woa xmixu3c x2lah0s"},children:["async"===e?(0,o.jsx)(x,{label:"Async"}):null,t?(0,o.jsx)(x,{label:"No access"}):null]})}function x({label:e}){return(0,o.jsx)("span",{...{className:"x3nfvp2 x6s0dn4 x1qx5ct2 xmzvs34 xf159sx x1iwo8zk x1033uif x179ill4 x1b60jn0 x1wwwm72 xuxw1ft"},children:(0,o.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:e})})}let f={page:{...(0,a(120308).pj)(),width:"100%",minHeight:"100%",boxSizing:"border-box"},panel:{border:`1px solid ${a(632079).Tj.border.primaryTranslucent}`,background:a(632079).Tj.background.primary,borderRadius:8,boxSizing:"border-box",position:"relative"},sectionLabel:{display:"block",marginBottom:6},select:{width:"100%",height:36,borderRadius:6,border:`1px solid ${a(632079).Tj.border.primary}`,background:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,paddingInlineStart:10,paddingInlineEnd:10},codeBlock:{background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,padding:12,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace",fontSize:12,lineHeight:"18px",maxHeight:420,overflow:"auto"},errorPanel:{background:a(632079).Tj.red.background.secondary,border:`1px solid ${a(632079).Tj.red.border.primary}`,borderRadius:8,padding:12},monospaceInput:{fontFamily:"monospace"}};function b(){let e=(0,a(533992).v3)(),[t,n]=(0,i.useState)([]),[s,l]=(0,i.useState)(),[d,c]=(0,i.useState)(),[p,m]=(0,i.useState)({}),[u,h]=(0,i.useState)({}),[y,g]=(0,i.useState)(),[x,b]=(0,i.useState)(),[k,S]=(0,i.useState)(),[w,I]=(0,i.useState)({type:"idle"}),C=(0,i.useRef)(0),D=(0,i.useCallback)(async t=>{let a=C.current+1;C.current=a,I({type:"loading",message:"Rendering prompt…"});let i=await e.api.callApi({eventName:"renderPromptTemplateDefinition",environment:e,data:{inferenceName:t.definition.inferenceName,sourceIn
105putValues:t.definition.sourceInputs.map(e=>({name:e.name,value:t.sourceInputValues[e.name]??""})),templates:t.definition.editableTurns.map(e=>({name:e.name,template:t.templates[e.name]??""}))}});if(a===C.current){if("failed"===i.type)throw I({type:"error",message:"Failed to render prompt."}),i.error;g(i.data),I({type:"idle"})}},[e]),T=(0,a(84235).Y)(e=>{D(e)},250);return(0,i.useEffect)(()=>()=>T.cancel(),[T]),(0,i.useEffect)(()=>{},[e]),(0,i.useEffect)(()=>{if(!s)return;let t=!1;return async function(){I({type:"loading",message:"Loading template…"});let a=await e.api.callApi({eventName:"loadPromptTemplateDefinition",environment:e,data:{inferenceName:s}});if(t)return;if("failed"===a.type)throw I({type:"error",message:"Failed to load template."}),a.error;let i=a.data.definition,n=v(i),r=j(i);c(i),m(n),h(r),g(void 0),b(void 0),S(void 0),D({definition:i,sourceInputValues:n,templates:r})}(),()=>{t=!0}},[e,D,s]),(0,i.useMemo)(()=>t.find(e=>e.inferenceName===s),[t,s]),(0,i.useCallback)(e=>{let a=t.find(t=>t.inferenceName===e.target.value);a&&l(a.inferenceName)},[t]),(0,i.useCallback)(async()=>{if(!d)return;T.cancel(),b(void 0),I({type:"loading",message:"Running draft…"});let t=await e.api.callApi({eventName:"runPromptTemplateDraft",environment:e,data:{inferenceName:d.inferenceName,sourceInputValues:d.sourceIn
105puts.map(e=>({name:e.name,value:p[e.name]??""})),templates:d.editableTurns.map(e=>({name:e.name,template:u[e.name]??""}))}});if("failed"===t.type)throw I({type:"error",message:"Failed to run draft."}),t.error;b(t.data),I({type:"idle"})},[T,d,e,p,u]),(0,i.useCallback)(async()=>{if(!d)return;I({type:"loading",message:"Generating patch…"}),S(void 0);let t=await e.api.callApi({eventName:"createPromptTemplatePatch",environment:e,data:{inferenceName:d.inferenceName,templates:d.editableTurns.map(e=>({name:e.name,template:u[e.name]??""}))}});if("failed"===t.type)throw I({type:"error",message:"Failed to generate patch."}),t.error;S(t.data),I({type:"idle"})},[d,e,u]),(0,i.useCallback)((e,t)=>{let a={...p,[e]:t};m(a),b(void 0),S(void 0),d&&T({definition:d,sourceInputValues:a,templates:u})},[d,T,p,u]),(0,i.useCallback)((e,t)=>{let a={...u,[e]:t};h(a),b(void 0),S(void 0),d&&T({definition:d,sourceInputValues:p,templates:a})},[d,T,p,u]),(0,i.useCallback)(()=>{if(!d)return;let e=v(d),t=j(d);m(e),h(t),b(void 0),S(void 0),T({definition:d,sourceInputValues:e,templates:t})},[d,T]),(0,i.useCallback)(async()=>{if(!y||"success"!==y.type)return;let e=y.turns.map(e=>`[${e.type}]
106${String(e.content)}`).join("\n\n---\n\n");await navigator.clipboard.writeText(e)},[y]),(0,i.useCallback)(async()=>{(null==k?void 0:k.type)==="success"&&await navigator.clipboard.writeText(k.applyCommand)},[k]),(0,o.jsx)("div",{style:f.page,children:(0,o.jsxs)(r().VP,{gap:12,children:[(0,o.jsx)(a(111010).D,{styleKey:"titleSemibold",children:"Prompt Playground unavailable"}),(0,o.jsx)(a(111010).D,{styleKey:"bodyRegular",colorVariant:"secondary",children:"This admin tool is only available in local and development."})]})})}function v(e){return Object.fromEntries(e.sourceInputs.map(e=>[e.name,e.defaultValue]))}function j(e){return Object.fromEntries(e.editableTurns.map(e=>[e.name,e.template]))}let k={style0:{...a(120308).zR,marginTop:12,marginBottom:12,width:"100%"},style1:{...a(120308).g,width:"100%",marginInlineStart:(0,a(120308).Uw)().margin},style2:{width:"100%",marginInlineStart:(0,a(120308).Uw)().margin}},S=(0,i.forwardRef)(function(e,t){let{title:i,runbookUrl:n,children:r,id:s}=e;return!r||Array.isArray(r)&&!r.length?null:(0,o.jsxs)("div",{ref:t,id:s,style:k.style0,children:[(0,o.jsx)("div",{style:k.style1,children:i}),n?(0,o.jsx)("div",{style:k.style2,children:(0,o.jsx)(a(590422).Q,{href:n,external:!0,inline:!0,underline:!0,children:"📕 Runbook"})}):void 0,r]})}),w=(0,a(327219).YK)({resolveMarketplaceServiceRequest:{id:"adminSectionPage.resolveMarketplaceServiceRequest",defaultMessage:"Resolve Marketplace Service Request"},permissionsAccountFallback:{id:"adminSectionPage.permissionsError.accountFallback",defaultMessage:"your account"},permissionsSessionError:{id:"adminSectionPage.permissionsError.session",defaultMessage:"Admin Mode couldn’t authenticate your session for {account}. Log out, then log back in with your Notion work account."},permissionsNetworkError:{id:"adminSectionPage.permissionsError.network",defaultMessage:"Admin Mode couldn’t connect to verify permissions for {account}. Check your network and Notion VPN connection, then reload the page."},permissionsGenericError:{id:"adminSectionPage.permissionsError.generic",defaultMessage:"Admin Mode couldn’t verify permissions for {account}. Make sure you’re connected to the Notion VPN and signed in with your Notion work account. If this keeps happening, log out and log back in."}}),I=["adminCompleteMarketplaceServiceRequest","adminEndMarketplaceServiceRequest"],C={adminItem:(0,a(120308).Uw)(),nestedAdminItem:{...(0,a(120308).Uw)(),boxSizing:"border-box",margin:0,width:"100%"},adminWrap:(0,a(120308).pj)(),helpText:{marginTop:8,color:a(632079).Tj.text.secondary},noAccessText:{color:a(632079).Tj.text.secondary},style0:{...a(120308).zR,marginTop:12,marginBottom:12,width:"100%"},style1:{...a(120308).g,width:"100%",marginInlineStart:(0,a(120308).Uw)().margin},style2:{width:"100%"}};function D({section:e}){let t=(0,a(533992).v3)(),l=(0,a(327219).tz)(),d=(0,a(743187).g)(),{apiOwnershipMap:p,currentUserPermissions:m,fetchPermissionsErrored:u,fetchPermissionsErrorStatus:h}=(0,a(579993).K8)(()=>{let{apiOwnershipMap:e,currentUserPermissions:t,fetchPermissionsErrored:a,fetchPermissionsErrorStatus:i}=d.state;return{apiOwnershipMap:e,currentUserPermissions:t,fetchPermissionsErrored:a,fetchPermissionsErrorStatus:i}},[d]),y=(0,a(579993).K8)(()=>{var e,i;let n,r;return e=t,void 0!==(r=null==(n=(0,a(427846)._)(e))||null==(i=n.getModel())||null==(i=i.getAdminUser())?void 0:i.getEmail())||void 0!==e.currentUser.adminUserId?r:null==n?void 0:n.getEmail()},[t]),g=(0,a(579993).K8)(()=>a(198074).a.state??!1,[]),x=(0,i.useRef)({}),f=(0,i.useCallback)(e=>t=>{x.current[e]=t},[]),v=!!(e&&e in a(604063).i8),j=(0,a(579993).K8)(()=>void 0===m?[]:Object.values(a(688211)._P).filter(e=>(0,a(688211).qO)(e)&&(g||m.has((0,a(688211).JZ)(e)))),[g,m]);if((0,i.useEffect)(()=>
106{if(!v||!e||!m)return;let t=window.location.hash.slice(1);t&&requestAnimationFrame(()=>{let e=x.current[t];e&&e.focus()})},[v,e,m,j]),!v||!e)return(0,o.jsx)(a(220952).U,{currentSection:void 0,children:(0,o.jsx)("div",{style:C.adminWrap,children:(0,o.jsx)("div",{style:a(120308).zR,children:(0,o.jsxs)("div",{style:C.adminItem,children:[(0,o.jsxs)("div",{style:a(120308).aW,children:["Invalid section: ",e||"(empty)"]}),(0,o.jsx)("div",{style:C.helpText,children:"Please select a valid section from the sidebar."})]})})})});let k=a(604063).i8[e],T=(0,a(315965).s)({sectionName:e,currentUserPermissions:m,environmentName:"production",showToolsWithoutPermission:g}),R=u?function({adminActorEmail:e,intl:t,status:a}){let i=e??t.formatMessage(w.permissionsAccountFallback);return 401===a?t.formatMessage(w.permissionsSessionError,{account:i}):0===a?t.formatMessage(w.permissionsNetworkError,{account:i}):t.formatMessage(w.permissionsGenericError,{account:i})}({adminActorEmail:y,intl:l,status:h}):void 0;if("promptTools"===e&&void 0===R)return(0,o.jsx)(a(45062).A,{title:`${k.title} - Notion Admin Mode`,children:(0,o.jsx)(a(220952).U,{currentSection:e,children:(0,o.jsx)(b,{})})});if("toolProxy"===e&&void 0===R)return T?(0,o.jsx)(a(45062).A,{title:`${k.title} - Notion Admin Mode`,children:(0,o.jsx)(a(220952).U,{currentSection:e,children:(0,o.jsx)("div",{style:C.adminWrap,children:(0,o.jsx)("div",{style:a(120308).zR,children:(0,o.jsx)(S,{id:e,title:k.title,runbookUrl:k.runbookUrl,children:(0,o.jsx)(c,{currentUserPermissions:m,showToolsWithoutPermission:g})},e)})})})}):(0,o.jsx)(a(45062).A,{title:`${k.title} - Notion Admin Mode`,children:(0,o.jsx)(a(220952).U,{currentSection:void 0,children:(0,o.jsx)("div",{style:C.adminWrap,children:(0,o.jsx)("div",{style:a(120308).zR,children:(0,o.jsxs)("div",{style:C.adminItem,children:[(0,o.jsx)("div",{style:a(120308).g,children:k.title}),(0,o.jsx)("div",{style:C.noAccessText,children:"You don't have permission to access this section."})]})})})})});let A=new Set(k.tools),N=window.location.hash.slice(1),M=new URLSearchParams(window.location.search),P={};M.forEach((e,t)=>{P[t]=e});let V=Object.keys(P).length>0,E=M.get("executionId")??void 0;function B(e,t=!1){let i=(0,a(688211).JZ)(e),n=p?p[i]:void 0,r=V&&e.apiName===N;return(0,o.jsx)(a(869589).RE,{style:t?C.nestedAdminItem:C.adminItem,ref:f(e.apiName),api:e,owner:n,hasPermission:m?m.has(i):void 0,source:"admin_tool_page",...r?{defaultParams:P,showDefaultParams:!0,notinoActionInitialExecutionId:E}:{}},e.apiName)}let L=new Map(j.filter(e=>A.has(e.apiName)).map(e=>[e.apiName,e])),_=[];for(let t of k.tools){if("marketplace"===e&&(0,n().Xk)(I,t)){if(t!==I[0])continue;let e=I.flatMap(e=>{let t=L.get(e);return void 0===t?[]:[t]});if(0===e.length)continue;let a=(0,n().Xk)(I,N);_.push((0,o.jsx)("div",{style:C.adminItem,children:(0,o.jsx)(s().b,{sections:[{key:"resolveMarketplaceServiceRequest",title:l.formatMessage(w.resolveMarketplaceServiceRequest),content:(0,o.jsx)(r().VP,{gap:8,children:e.map(e=>B(e,!0))}),initialExpanded:a}]},`resolveMarketplaceServiceRequest-${a}`)},"resolveMarketplaceServiceRequest"));continue}let a=L.get(t);void 0!==a&&_.push(B(a))}let U=void 0!==m&&0===_.length&&!g,W=R||(U?"You don't have access to this section.":void 0);return(0,o.jsx)(a(45062).A,{title:`${k.title} - Notion Admin Mode`,children:(0,o.jsxs)(a(220952).U,{currentSection:e,children:[(0,o.jsx)("div",{style:C.adminWrap,children:(0,o.jsx)("div",{style:a(120308).zR,children:W?(0,o.jsxs)("div",{style:C.style0,children:[(0,o.jsx)("div",{style:C.style1,children:k.title}),(0,o.jsx)("div",{style:{...C.adminItem,...C.style2},children:(0,o.jsx)("div",{style:C.noAccessText,children:W})})]}):(0,o.jsx)(S,{id:e,title:k.title,runbookUrl:k.runbookUrl,children:_},e)})}),(0,o.jsx)(a(514164).N9,{hideProgressBar:!0,autoClose:1500,transition:a(514164).q7})]})})}},120308(e,t,a){function i(){return{width:500,padding:18,margin:8,border:`1px solid ${a(632079).Tj.border.primaryTranslucent}`,background:a(632079).Tj.background.primary,position:"relative",borderRadius:8}}function n(){return{background:a(632079).Tj.background.secondary,padding:8}}function r(){return{...n(),height:"100vh",overflow:"auto"}}let s={fontWeight:a(699422).Wy.bold,fontSize:36},o={fontWeight:a(699422).Wy.bold,color:a(632079).Tj.red.text.primary};function l(){return{width:"100%",padding:"16px",background:a(632079).Tj.background.primary,borderBottom:`1px solid ${a(632079).Tj.border.primaryTranslucent}`,display:"flex",justifyContent:"space-between",alignItems:"center",gap:"16px",position:"relative",zIndex:9999}}function d(){return{fontWeight:a(699422).Wy.bold,fontSize:20,color:a(632079).Tj.text.primary,flexShrink:0}}function c(){return{position:"absolute",top:"100%",insetInlineStart:0,insetInlineEnd:0,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primaryTranslucent}`,borderRadius:12,marginTop:8,padding:4,maxHeight:400,zIndex:1e3,boxShadow:a(632079).Tj.shadow.outline.lg}}function p(){return{padding:8,borderRadius:12,cursor:"pointer"}}function m(){return{background:a(632079).Tj.background.tertiaryTranslucent,boxShadow:a(632079).Tj.buttonBlueFocusRing,outline:"2px s
106olid transparent",zIndex:1}}function u(){return{fontWeight:a(699422).Wy.semibold,fontSize:14,color:a(632079).Tj.text.primary}}function h(){return{fontSize:12,color:a(632079).Tj.text.secondary}}function y(){return{fontSize:10,fontWeight:a(699422).Wy.semibold,padding:"2px 6px",borderRadius:3,background:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,display:"inline-block"}}function g(){return{width:240,background:a(632079).Tj.background.primary,borderInlineEnd:`1px solid ${a(632079).Tj.border.primaryTranslucent}`,padding:"16px",overflowY:"auto",flexShrink:0}}function x(){return{display:"block",padding:"8px 8px",marginBottom:4,borderRadius:4,cursor:"pointer",textDecoration:"none",color:a(632079).Tj.text.primary,fontSize:14}}function f(){return{background:a(632079).Tj.background.secondary,fontWeight:a(699422).Wy.semibold}}function b(){return{display:"flex",flexDirection:"column",height:"100vh",background:a(632079).Tj.background.secondary,overflow:"visible"}}function v(){return{flexShrink:0,borderBottom:`1px solid ${a(632079).Tj.border.primaryTranslucent}`,position:"relative",zIndex:1e4}}a.d(t,{AG:()=>b,G4:()=>l,HS:()=>d,Hb:()=>u,Ib:()=>c,OD:()=>h,Uw:()=>i,hL:()=>v,iF:()=>m,iR:()=>x,mX:()=>y,pj:()=>n,qp:()=>p,sA:()=>g,wJ:()=>f,yQ:()=>r},{PL:{display:"flex",flex:1,overflow:"hidden",minHeight:0},TS:{flex:1,overflow:"auto",minWidth:0},aW:o,g:s,zR:{display:"flex",flexWrap:"wrap"}})},469181(e,t,a){a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(159952);let i={display:"inline-flex",alignItems:"center",height:20,paddingInline:8,borderRadius:100,fontSize:12,fontWeight:a(699422).Wy.medium,whiteSpace:"nowrap"},n={ok:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.accentPrimary},bad:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.accentPrimary},warn:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.accentPrimary},info:{backgroundColor:a(632079).Tj.blue.background.primary,color:a(632079).Tj.blue.text.accentPrimary},muted:{backgroundColor:a(632079).Tj.purple.background.primary,color:a(632079).Tj.purple.text.accentPrimary},neutral:{backgroundColor:a(632079).Tj.background.tertiaryTranslucent}},r={container:{maxWidth:800},header:{marginBottom:16},metaRow:{display:"flex",gap:24,flexWrap:"wrap"},card:{padding:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},sectionTitle:{fontWeight:a(699422).Wy.semibold,marginBottom:12,marginTop:24},table:{width:"100%",borderCollapse:"collapse"},th:{textAlign:"start",paddingBlock:8,paddingInline:12,borderBottom:`2px solid ${a(632079).Tj.border.secondary}`,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium},td:{paddingBlock:8,paddingInline:12,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,fontSize:13},statusLive:{display:"inline-flex",alignItems:"center",gap:4,height:20,paddingInlineStart:6,paddingInlineEnd:8,borderRadius:100,backgroundColor:a(632079).Tj.blue.background.tertiaryTranslucent,fontSize:12},statusDisabled:{display:"inline-flex",alignItems:"center",gap:4,height:20,paddingInlineStart:6,paddingInlineEnd:8,borderRadius:100,backgroundColor:a(632079).Tj.background.tertiaryTranslucent,fontSize:12},dot:{width:6,height:6,borderRadius:3},select:{padding:"6px 10px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,backgroundColor:a(632079).Tj.background.primary,fontSize:13,cursor:"pointer"},label:{fontWeight:a(699422).Wy.semibold},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary},tableWrapper:{overflowX:"auto"},subtext:{fontSize:11,color:a(632079).Tj.text.tertiary},cardDivider:{borderTop:`1px solid ${a(632079).Tj.border.secondary}`,marginBlock:10},paginationButton:{padding:"4px 10px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,backgroundColor:a(632079).Tj.background.primary,fontSize:13,cursor:"pointer"},paginationButtonDisabled:{padding:"4px 10px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.secondary}`,backgroundColor:a(632079).Tj.background.secondary,fontSize:13,cursor:"default",opacity:.5},statTile:{paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,minWidth:132},segmentRow:{backgroundColor:a(632079).Tj.background.tertiary},segmentCell:{paddingBlock:4,paddingInline:12,fontSize:11,color:a(632079).Tj.text.secondary,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},segmentCellIndented:{paddingBlock:4,paddingInlineStart:28,paddingInlineEnd:12,fontSize:11,color:a(632079).Tj.text.secondary,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},allowancePillBlocked:{...i,...n.bad},allowancePillOk:{...i,...n.ok},allowancePillNeutral:{...i,...n.neutral},allowanceOverLimit:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.semibold}};
106function s(e){return e.toLocaleString(void 0,{maximumFractionDigits:0,roundingMode:"trunc"})}function o(e){return void 0===e?"—":0===e?"✖":-1===e?"✔":`\u2714 ${s(e)}`}function l(e){return void 0===e?"Uncapped":s(e)}function d(e){let t=[void 0!==e.override?`override: ${e.override}`:void 0,void 0!==e.pin?`pin: ${e.pin}`:void 0].filter(e=>void 0!==e),a=e.effectiveTier??"none (plain trial limit)";return t.length>0?`${a} (${t.join(", ")})`:a}let c={disabled:"Disabled",all_workspace_members:"All workspace members",workspace_owners_only:"Workspace owners only",custom:"Workspace owners + selected groups"};function p(e){let t=c[e.policy],a=e.isDefault?`${t} (default, unset)`:t;if("custom"!==e.policy)return a;if(void 0===e.overageGroups)return`${a}; group lookup failed`;if(0===e.overageGroups.length)return`${a}; no groups grant overage`;let i=e.overageGroups.map(e=>e.name||"Untitled").join(", ");return`${a}; groups: ${i}`}function m(e){return new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC"})}function u(e){return`${m(e.start)} – ${m(e.displayEnd)} (UTC)`}function h(e){return`${m(e.startMs)} – ${m(e.endMs)}`}let y=new Set(["start","end","displayEnd","date","startDate","expirationDate","timestamp","created_at","updated_at","period_start","start_timestamp","expiration_timestamp"]);a.d(t,{C$:()=>l,GX:()=>p,PS:()=>u,Ql:()=>s,Qu:()=>function e(t){let a={};for(let[i,n]of Object.entries(t))y.has(i)&&"number"==typeof n&&n>0?a[i]=`${n} (${m(n)})`:a[i]=function t(a){return Array.isArray(a)?a.map(t):null!==a&&"object"==typeof a?e(a):a}(n);return a},hp:()=>d,lj:()=>o,r6:()=>m,vj:()=>h},{Io:i,R7:r,Rr:n})},243119(e,t,a){a(635790);var i=a(440302);let n={marginBottom:8};function r(e){let{data:t,hideHelp:r,customCollapsedRenderers:s,ignoreUuidPreference:o}=e,l={fontWeight:a(699422).Wy.bold,fontSize:18,marginBottom:8};return(0,i.jsxs)(i.Fragment,{children:[r?void 0:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("div",{style:l,children:"Success"}),(0,i.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:n,children:"Click on a value to copy it into your clipboard."})]}),(0,i.jsx)(a(503270).H,{data:t,customCollapsedRenderers:s,ignoreUuidPreference:o})]})}a.d(t,{A:()=>r})},869589(e,t,a){a.d(t,{RE:()=>ee}),a(533958),a(435368),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(974864),a(218043),a(159952),a(1310),a(765324),a(176765),a(851344),a(866491);var i=a(635790),n=()=>
106a(960408),r=()=>a(83388);let s={adminFindObject:!0,adminSearchUsers:!0,adminSearchSpaces:!0,adminSearchBlocks:!0,adminViewRecordTree:!0,adminGetFileMetadata:!0,adminSearchBlockBySlug:!0,adminSearchNotifications:!0,adminSearchTeams:!0,adminSearchCollections:!0,adminSearchCollectionViews:!0,adminSearchSpaceViews:!0,adminSearchForUsersInSpaces:!0,adminGetDataAccessConsent:!0,adminSearchPermanentlyDeletedPages:!0,adminSearchPermanentlyDeletedCollections:!0,adminSearchSpaceActivity:!0,adminGetPublicPages:!0,adminGetPublicForms:!0,adminDebugCollectionForm:!0,adminGetTrial:!0,adminGetOrCreateStripeCustomer:!1,adminGetBulkSpaceIdsByDomain:!0,adminGetBulkSpaceIdsByEmail:!0,adminGetBulkUserIdsByEmail:!0,isEmailEducation:!0,adminGetSpaceMembershipUpdates:!0,adminGetProcessedSpaceMembershipUpdates:!0,adminFlushSpaceMembershipUpdates:!1,adminGetBillingDataInformation:!0,adminGetBillingDataHistory:!0,adminGetSubscriptionUpdatePreview:!0,adminGetLegacyPriceMigrationBanner:!0,adminFindDeletedUser:!1,adminCountWordsInPage:!0,adminReadBlockPermissions:!0,adminCheckEsDocAccess:!0,adminListUserPagePermissionBlockIdsInSpace:!0,adminGetAutomationsForRecordId:!0,adminSearchOrganizations:!0,adminSearchAccounts:!0,adminGetPremiumFeatureAvailabilities:!0,adminCalculatePropertyDependencies:!0,adminVerifyPeopleCollection:!1,adminGetSystemBlockIds:!0,adminGetDiscussionInfo:!0,adminGetCommentInfo:!0,adminGetJoinableSpaces:!0,adminGetLegalHold:!0,adminGetLegalHolds:!0,adminGetWorkflowInfo:!0,adminGetSlackAppMentionRegistrationStatus:!0,adminReconcileSlackAppMentionRegistrations:!1,adminClearWorkflowPausedReason:!1,adminSummarizeSkillHealthInSpace:!0,adminDiagnoseSkillSystemForUserInSpace:!0,adminListEntityNotes:!0,adminCreateEntityNote:!1,adminCreateNotionRepresentativeSpaceAccessRequest:!1,adminArchiveEntityNote:!1,getUserAdminApiLog:!0,getAdminHistory:!0,getSpaceAdminApiLog:!0,getBlockAdminApiLog:!0,adminGetApiLogsByEventName:!0,adminAllowlistCreditDomain:!1,adminCancelSubscription:!1,adminReleaseSubscriptionSchedule:!1,adminDowngradeFraudSubscription:!1,adminGetBillingHistory:!0,adminGetUserBillingInformation:!0,adminManageNonprofitOffer:!1,adminBulkApplyPromotionCodes:!1,adminBulkUpgradeEduPlusUser:!1,adminBulkCreateTimedTrials:!1,adminBulkProvisionMarketingTrials:!1,allowEducationEmails:!1,adminRemoveAllowedEducationEmails:!1,getPromoCode:!0,getOfferCodeValue:!0,adminGetOfferEligibility:!0,adminGetAllEligibleOffers:!0,adminGetBulkOfferEligibility:!0,adminCleanupDuplicateOfferStatuses:!1,adminBulkAddPromotionCodes:!1,adminPartnerStackFixMissingProductKeys:!1,adminBulkAddEduUniversitiesAndDomains:!1,adminSyncBillingState:!1,adminGetSubscriptionBannerState:!0,adminGetUnrepresentableState:!0,adminSetHighWaterMark:!1,listPrices:!0,adminUpdateSubscription:!1,adminUpdateAddOnSubscription:!1,adminBulkMigrateToCampusLeaderBusiness:!1,adminUpdateSubscriptionBusinessEnterprise:!1,adminSetSalesAssistedSubscriptionBanner:!1,adminCheckDomainEligibleForSalesAssisted:!1,adminSetSelfServeEnterpriseEligibility:!1,adminBulkSetSalesAssistedSubscriptionBanner:!1,adminGetSubscriptionBannerHistory:!0,adminListAllActiveSubscriptionBanners:!0,adminEmployeeSubscriptionUpdate:!1,adminMonetizationTaskRunnerEnqueue:!1,adminTriggerSubscriptionAuditor:!1,adminSendOnDemandCreditReportEmail:!1,adminBulkSendOnDemandCreditReportEmail:!1,adminRefundInvoice:!1,adminSetPaymentMethodTrustLevel:!1,adminUpsertTrial:!1,adminManageStackedTrial:!1,adminGooglePlayRevokeAndRefund:!1,adminSetEduReverificationTestState:!1,adminRemoveSpaceUsersAndTransferContent:!1,recoverSpace:!1,recoverUser:!1,adminRecoverMfa:!1,adminDeleteUserPasskeys:!1,adminChangeEmail:!1,adminSwapUserEmails:!1,adminSwapUserDomains:!1,adminModifyBlock:!1,adminRestoreBlock:!1,adminBulkRestoreBlocks:!1,adminViewDeletedCollectionProperties:!0,adminRestoreDeletedCollectionProperties:!1,adminRestoreDeletedGuestPermissions:!1,adminMergeUsers:!1,adminRecoverUserContentInSpace:!1,adminReviveBlocksOnPage:!1,adminMakeUserAliasPrimary:!1,adminRemoveUserAlias:!1,adminAddUserAlias:!1,adminRestoreUserAliases:!1,adminMoveBlockSourceFileToCorrectSpace:!1,adminBanUser:!1,adminResolveSanctionsAppeal:!1,adminExportBannedUserData:!1,adminExportAgentChatsForUser:!1,adminDeleteBannedUser:!1,adminBulkBanUsers:!1,adminGetRelatedEntities:!0,adminSearchAuditLog:!0,adminQueryRuleEngineTriggers:!0,adminDisableNotionAIForSpace:!1,adminEnableNotionAIForSpace:!1,adminDisableReverifyForUser:!1,adminAddPublicEmailDomains:!1,adminDeleteSpace
106s:!1,adminResetAccounts:!1,adminDeleteUser:!1,adminDangerouslyQueueRemoveUserDirectPermissionsInSpace:!1,adminRemoveAllSpaceGuests:!1,adminGetExternalUserProfile:!0,revokeUserTokens:!1,adminBlockApiBots:!1,adminBulkDeactivateApiBots:!1,adminDeleteFileFromS3:!1,adminBlockEmailDomain:!1,adminUpdateLoginEmailAllowlist:!1,adminUpdateLoginIpAllowlist:!1,adminUpdateGlobalIpAllowlist:!1,adminBypassEmailReputationChecks:!1,adminAddPreservedSpaces:!1,adminRemovePreservedSpaces:!1,adminBlockEmailsToUser:!1,adminUnblockEmailsToUser:!1,adminGetSamlConfig:!0,adminDiagnoseEmaBinding:!0,adminGetSpacesForAllowedEmailDomain:!0,adminModifySamlUniqueEntityIds:!1,adminCreateOrganization:!1,adminUpdateOrganizationOwners:!1,adminUpdateOrganizationSpaces:!1,adminMigrateOrganization:!1,adminDeleteOrganization:!1,adminUpdateSamlConfig:!1,adminSetPageContentClassification:!1,adminBulkUnsetPageContentClassification:!1,adminRemoveDisallowedUrl:!1,adminSetDisableSpacePublicAccess:!1,adminBulkSetDisableSpacePublicAccess:!1,adminRemovePagePublicAccess:!1,adminReportCSAMContent:!1,adminTriggerCSAMScan:!1,adminExportPageForReview:!0,adminGetRateLimits:!0,adminResetRateLimits:!1,adminGetStatsigExperiment:!0,adminGetStatsigFeatureGate:!0,adminCheckStatsigSegment:!0,adminPreviewGtmDecisionDebug:!0,adminDryRunGtmNextBestAction:!0,adminUpdateStatsigSegmentIds:!1,adminSearchUserAdminToolRoles:!0,adminGetPermissionsData:!0,disableUserAnalytics:!1,adminEditBlockPermissions:!1,adminEditSpacePermissions:!1,adminBulkRemoveSpaceGuests:!1,adminRemoveGhostGuests:!1,adminBulkAddUsersToSpace:!1,adminBulkRemoveTeamMembers:!1,adminOverridePremiumFeatureAvailability:!1,adminOverrideInternalDomains:!1,adminEditTeamMembership:!1,adminUpdateTeamMember:!1,adminUpdateUserSettings:!1,adminShowCustomerInvoice:!0,adminGetBulkIds:!1,adminAddLinkPreviewToSpace:!1,adminQueryCollectionReplay:!0,adminResetUniqueIdCounter:!1,adminGetSpaceIdsForDeletionDate:!0,adminFindOrphanedBlocks:!0,adminClearFreeChartsForSpace:!1,adminGetFreeChartsForSpace:!0,adminResetPageContentCoverToLegacy:!1,adminCreateWorkspaceInRegion:!1,adminResetEdgeCache:!1,deleteBlockPropertiesStaleDataForWorkspace:!1,adminSyncCollectionRelation:!1,adminSyncSpaceViews:!1,adminMarkNotificationsRead:!1,adminQueryDuplicationJobs:!0,adminScheduleDuplication:!1,adminRetryDuplication:!1,adminBootstrapNboUserProfile:!1,adminEnqueueAutoOutboundEnrollmentCron:!1,adminBulkArchiveCollectionPages:!1,adminEnableSpacePublicAccess:!1,adminValidateTeamMembershipMigrationForSpace:!0,adminRepairPermissionGroupManagementType:!1,adminRepairWorkspaceAccessRequestState:!1,adminGetIntegrationData:!0,adminGetIntegrationRedirectUris:!0,adminUpdateIntegrationData:!1,adminUpdateIntegrationRedirectUris:!1,adminTransferIntegrationOwnership:!1,adminGetCapabilities:!0,adminListIntegrationManagementPermissions:!0,adminUpdateCapabilities:!1,adminSearchBots:!0,adminRevokeBotToken:!1,adminListBotsInOrganization:!0,adminSearchOrganizationBots:!0,adminListBotsInSpace:!0,adminGetSlackIntegrationData:!0,adminGetMicrosoftTeamsConnections:!0,adminDeactivateSlackNotionToken:!1,adminGetSyncedDatabaseData:!0,adminForceResyncExternalObjects:!1,adminRemoveChildFromExternalCollection:!1,adminJoinSpacesForOauthRedirect:!1,adminGetWorkspaceWebhookSubscriptions:!0,adminGetPublicApiRateLimit:!0,adminSetIntegrationRateLimit:!1,adminListIntegrationWebhookSubscriptions:!0,adminUpdateIntegrationWebhookSubscription:!1,adminUpdateBotCapabilities:!1,adminResyncBotBlockPermissions:!1,adminGetPersonalAccessTokenCreationPolicy:!0,adminUpdatePersonalAccessTokenCreationPolicy:!1,adminListPersonalAccessTokenCreationGroups:!0,adminUpdatePersonalAccessTokenCreationGroupPermission:!1,adminGetSpaceConnectionsAllowlist:!0,adminUpdateSpaceApprovedIntegrations:!1,adminSetSpaceConnectionAllowlistMode:!1,adminCreateGlobalOauthClient:!1,adminUpdateGlobalOauthClient:!1,adminGetGlobalOauthClient:!0,adminDeleteGlobalOauthClient:!1,adminListGlobalOauthClients:!0,adminCreateMarketingRoute:!1,adminBulkSetStartupReferralPartners:!1,adminGetMarketingRoutes:!0,adminGetDomainManagementSettings:!0,adminCancelSpaceRequest:!1,adminIsSpaceDomainClaimEligible:!0,adminGetDomainClaimEligibleSpaces:!0,adminGetClaimableWorksp
106acesInOrganization:!0,adminClaimAndUpgradeForSalesAssisted:!1,adminRequestOrganizationClaimForDomainMismatch:!1,adminDelayClaimSpaceDeletion:!1,adminListWorkspaceMigrations:!0,adminStartWorkspaceMigration:!1,adminGetWorkspaceMigrationSteps:!0,adminGetWorkspaceMigrations:!0,adminRetryWorkspaceMigration:!1,adminCancelWorkspaceMigrations:!1,adminUpdateWorkspaceFreeze:!1,adminCancelSpaceConsolidation:!1,adminRunSpaceConsolidation:!1,adminResumeMigrationSupervisor:!1,adminResumeMigrationWorkersForSupervisor:!1,adminGetMigrationStatusForSupervisor:!0,adminListMigrationWorkersForSupervisor:!0,adminGetMigrationWorkerForSupervisor:!0,adminListMigrationProjects:!0,adminListDataLakeCsvExportDirectories:!0,adminListDynamoDbDataLakeCsvExports:!0,adminCreateMigrationSupervisor:!1,adminMarkMigrationSupervisorAsFailed:!1,adminCleanupMigrationProject:!1,adminGetBYOKCredentialHistory:!0,adminGetAIProviderRestriction:!0,adminGetOrgAIProviderRestriction:!0,adminSetProductFeedback:!1,adminSetAIProviderRestriction:!1,adminSetOrgAIProviderRestriction:!1,adminUpdateNotionAIAvailabilityForSpace:!1,adminAddZeroRetentionSpace:!1,adminCheckHIPAAComplianceStatus:!0,adminOnboardAISlackQnA:!1,adminOptOutNotionAIDataSharing:!1,adminIsWorkspaceInQnA:!0,adminSetAssistantEnabledForSpaces:!1,adminSearchAsUser:!0,adminSemanticSearchAsUser:!0,adminDeleteWorkflows:!1,adminDispatchAgentFacetsBackfill:!1,adminDispatchAgentFacetCentroidsBackfill:!1,dispatchEvalAgent:!1,adminEnqueueAgentFeedbackTriageBackfill:!1,adminDebugRedactedTranscript:!0,adminUnshareThread:!1,adminGetChatGPTTokenSharingState:!0,adminGetOpenAISafetyIdentifierLookup:!0,adminGetCustomAgentCreationPolicy:!0,adminGetWorkspaceModelRestrictions:!0,adminGetExternalAgentAccessPolicy:!0,adminGetExternalAgentSpecifications:!0,adminListCustomAgentTrustedHostnames:!0,adminAddCustomAgentTrustedHostnames:!1,adminRemoveCustomAgentTrustedHostnames:!1,adminGetAIAgentDailyCreditUsageLookup:!0,adminGetAICreditUsageLookup:!0,adminGetAgentCreditLimit:!0,adminSetAgentCreditLimit:!1,adminGetEntitlementUsageLookup:!0,adminGrantPromotionalNotionCredits:!1,adminRevokePromotionalNotionCredits:!1,adminGetCreditAdjustmentAuditLog:!0,adminGetPromotionalCreditGrantAuditLog:!0,adminGetBillingContractLookup:!0,adminRefundNotionCredits:!1,adminBulkRefundNotionCredits:!1,adminStartBulkCreditRefund:!1,adminListBulkCreditRefundBatches:!0,adminResetAiCreditUsage:!1,adminBulkResetAiCreditUsage:!1,adminManageTrialCreditTierOverrides:!1,adminUpdateTranscriptionForSpace:!1,adminEnqueueTranscriptRetentionScheduler:!1,adminRemarkTranscriptsAsDeletable:!1,adminLensClusterFull:!1,adminLensHistoricalFill:!1,adminLensNuke:!1,adminDebugTranscriptionBlock:!0,adminGetGranolaImportTask:!0,adminResetTranscriptionRateLimit:!1,adminUpdateNotionCalendarAvailableForSpace:!1,adminGetNotionMailStatus:!0,adminBackfillMarketplaceProfileSalesforceId:!1,adminBackfillTemplatesFromCategory:!1,adminGetRevenueShareInfoForDomain:!0,adminGetMarketplaceProfile:!0,adminGetMarketplaceRecord:!0,adminGetMarketplaceServiceRequestDetails:!0,adminLookupMarketplaceServiceRequests:!0,adminCompleteMarketplaceServiceRequest:!1,adminEndMarketplaceServiceRequest:!1,adminUpdateTemplateCreatorEmail:!1,adminSetCreatorStripeOnboardingStatus:!1,adminReviewMarketplaceRefund:!0,adminCreateMarketplaceRefund:!1,adminGetMarketplaceAcquisitionsForUser:!0,adminReplayMarketplaceStripeCompletionEvent:!1,adminIssueMarketplaceRefund:!1,adminCreateOrUpdateMarketplaceCoupon:!1,adminGetMarketplaceCoupon:!0,adminCreateMarketplaceProfileInvitation:!1,adminAcceptMarketplaceProfileInvitation:!1,adminTransferMarketplaceProfileOwnership:!1,adminChangeTemplateAuthor:!1,adminCreateOrUpdateFlowdashTaskForTemplateDraft:!1,adminResubmitMarketplaceAgentForReview:!1,adminDeleteStripeConnectedAccount:!1,adminDeleteMarketplaceListingForTemplateDraft:!1,adminSyncContentfulIntegrationListingToPostgres:!1,adminSetConsultantStatus:!1,adminRemoveMarketplaceListingIdFromBlock:!1,adminUpdateCreatorTemplateCount:!1,adminRetryMarketplacePayout:!1,adminTriggerUpgradeMarketplaceConsultantTiers:!1,adminTriggerDowngradeMarketplaceConsultantTiers:!1,adminCreateMarketplacePayouts:!1,adminRejectTemplateDraft:!1,adminAssignMarketplaceBadgeToUser:!1,adminAssignMarketplaceBadgesToUsers:!1,adminCallPublicApi:!0,adminGetExternalConnectionInfo:!0,adminDeleteExternalConnection:!1,adminResetMcpClientRegistration:!1,adminGetFileUpload:!0,adminExpireFileUpload:!1,adminSearchMcpRegistry:!0,adminSyncMcpRegistry:!1,adminGetMcpRegistryEntry:!0,adminGetMcpClient:!0,adminUpdateMcpClient:!1,adminGetSpaceMcpAllowlist:!0,adminUpdateMcpRegistryNotionPage:!1,adminBanMcpServer:!1,adminSetCustomMcpServersAllowed:!1,adminSetSpaceDomain:!1,adminSetDefaultPublicDomain:!1,adminGetPublicDomainStatus:!0,adminMarkPublicDomainInvalid:!1,adminUpdatePublicPageSlug:!1,adminGetIPRestrictions:!0,adminCreateIPRestrictions:!1,adminUpdateIPRestriction:!1,adminCheckIPRestriction:!0,adminUpdateManagedUserNetworkControlSettings:!1,adminListAllEKMWorkspaces:!0,adminEKMStatusForWorksp
106ace:!0,adminEKMDurableWorkflowStatus:!0,adminEKMDynamoOnboarding:!1,adminEKMDynamoOffboarding:!1,adminEKMDynamoWEKRotation:!1,adminEKMOffboarding:!1,adminEKMOffboardingV2ByEKMIndex:!1,adminEKMReencryptWEKs:!1,adminEKMCreateWEK:!1,adminEKMRevokeWEK:!1,adminEKMReencryptPostgresData:!1,adminEKMCreateWEKAndReencrypt:!1,adminEKMOnboarding:!1,adminEKMOnboardingViaScan:!1,adminEKMBatchedRowCount:!0,adminRequestCmkRotation:!1,adminListCmkRotationRequests:!0,adminEKMUpdateCmkRotationRequestStatus:!1,adminS3ReencryptSecureFiles:!1,adminS3OffboardSecureFiles:!1,adminFindThirdPartyConnection:!0,adminCheckConnectorConnection:!0,adminListAIConnectors:!0,adminDisconnectAIConnector:!1,adminValidateSlackExternalConnectionToken:!0,adminAIConnectorS3Inspect:!0,adminRemoveModuleFromWorkflow:!1,adminSearchWorkflowModules:!0,adminAddSlackConnectedOrgSpacesToStatsigSegment:!1,adminGetSyncs:!0,adminGetSyncDetail:!0,adminListUnhealthySyncs:!0,adminGetWorkers:!0,adminGetWorkerDetail:!0,adminGetWorkerRunLogs:!0,adminDisableWorker:!1,adminEnableWorker:!1,adminUpdateSyncCapability:!1,adminGetWorkersRateLimitConfig:!0,adminSetWorkersRateLimitConfig:!1,adminResetWorkersRateLimitConfig:!1,adminGetWorkersEmergencyBrake:!0,adminGetWorkersGlobalEmergencyBrake:!0,adminSetWorkersEmergencyBrake:!1,adminSetWorkersGlobalEmergencyBrake:!1,adminListSnapshots:!0,adminViewSnapshot:!0,adminCreateSnapshot:!1,adminQueryRecordSnapshots:!0,adminQueryRecordSnapshotsAthena:!0,adminQueryRecordSnapshotsDuckDbLambda:!0,adminCreateImporterCrossLinkingConfig:!1,adminFetchAsanaData:!0,adminFetchConfluenceData:!0,adminFetchImportersS3File:!0,adminFetchMondayData:!0,adminGetImporterCrossLinkingConfig:!1,adminListImporterCrossLinkingConfigs:!1,adminListSpaceExports:!0,adminUpdateImporterCrossLinkingConfig:!1,adminEvictCollectionsCache:!1,adminMaterializeCollectionsCache:!1,adminMonetizationTestingGetSnapshot:!0,adminMonetizationTestingRunAction:!1,adminMonetizationTestingCreateWorkspaceInState:!1,adminSerializeWorksp
106aceToIaC:!1,adminMaterializeWorkspaceFromIaC:!1};a(139583);let o={tools:{}},l=new Set(["dev.notion.so"]);function d(e){let t=a(120011).DateTime.fromISO(e,{zone:"utc"});if(t.isValid)return t.toLocaleString({month:"short",day:"numeric",year:"numeric"})}function c(e){let{sectionName:t,hash:i,params:n}=e,r=new URLSearchParams(n).toString(),s=r?`?${r}`:"",o=i?`#${i}`:"";return`${a(168962).JZ.admin}/${t}${s}${o}`}let p=a(764657).record(a(764657).string(),a(764657).string()),m=a(764657).object({required:{toolName:a(764657).string(),type:a(764657).literal("adminTool")},optional:{params:a(764657).lazy(()=>p)}}),u=a(764657).object({required:{sectionName:a(764657).string(),type:a(764657).literal("adminSection")},optional:{params:a(764657).lazy(()=>p)}}),h=a(764657).object({required:{label:a(764657).string(),type:a(764657).literal("docs"),url:a(764657).string()},optional:{}}),y=a(764657).union([a(764657).lazy(()=>u),a(764657).lazy(()=>m),a(764657).lazy(()=>h)]),g=a(764657).object({required:{alternative:a(764657).lazy(()=>y)},optional:{deprecatesOn:a(764657).string(),message:a(764657).string(),removalOn:a(764657).string()}}),x=a(764657).object({required:{tools:a(764657).record(a(764657).string(),a(764657).lazy(()=>g))},optional:{}});var f=()=>a(546605);class b extends f().Store{source;getInitialState(){return{inputValues:{}}}}let v=new(a(246382)).R({key:"adminReauthTimestamps",namespace:a(274919).Bq,important:!1,trackingType:"preference"});var j=a(440302);let k=(0,a(327219).YK)({noMatchingOptions:{id:"adminOptionCombobox.noMatchingOptions",defaultMessage:"No matching options"},searchOptionsPlaceholder:{id:"adminOptionCombobox.searchOptionsPlaceholder",defaultMessage:"Search options…"},searchOptionsLabel:{id:"adminOptionCombobox.searchOptionsLabel",defaultMessage:"Search: {fieldLabel}"}}),S={triggerContent:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textAlign:"start",flexGrow:1},placeholder:{color:a(632079).Tj.text.tertiary}};function w(e){let{label:t,options:i,selectedValue:n,placeholder:r,disabled:s,onSelect:o}=e,l=i.find(e=>e.value===n),d=(null==l?void 0:l.displayName)??r;return(0,j.jsx)(a(656252).d,{popupType:a(656252).z.Popup,placementToOrigin:"bottom",alignmentToOrigin:"start",originGap:4,sameWidthAsOrigin:!0,ariaPopupType:"listbox",disabled:s,content:e=>(0,j.jsx)(I,{label:t,options:i,selectedValue:n,onSelect:t=>{o(t),e.close()}}),children:e=>(0,j.jsx)(a(548436).A,{...e,size:"md",width:"fill",disabled:s,hasSolidBackground:!0,iconTrailing:a(595453).arrowChevronSingleDownSmallIcon,ariaLabel:`${t}: ${d}`,children:(0,j.jsx)("span",{style:{...S.triggerContent,...void 0===l?S.placeholder:void 0},children:d})})})}function I(e){let{label:t,options:n,selectedValue:r,onSelect:s}=e,o=(0,a(327219).tz)(),[l,d]=(0,i.useState)(""),[c,p]=(0,a(739271).s)(),m=(0,i.useCallback)(e=>{d(e.target.value)},[]),u=(0,i.useCallback)(()=>{d("")},[]),h=o.formatMessage(k.noMatchingOptions),y=l.trim(),g=n.findIndex(e=>e.value===r),x=0===y.length&&g>=0?g:0,f=(0,i.useMemo)(()=>{let e=(y?(0,a(367414).tA)(y,n,e=>e.displayName):n).map(e=>({key:e.value,action:()=>s(e.value),render:t=>(0,j.jsx)(a(95582).A,{...t,title:e.displayName,isChecked:e.value===r,"aria-selected":e.value===r})}));return 0===e.length&&e.push({key:"no-matching-options",action:()=>{},render:e=>(0,j.jsx)(a(95582).A,{...e,title:h,disabled:!0})}),[{key:"options",items:e,render:e=>(0,j.jsx)(a(83743).A,{...e,title:null,loading:!1})}]},[h,s,n,r,y]);return(0,j.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,width:"100%",maxHeight:320,header:(0,j.jsx)(a(83743).A,{isInput:!0,children:(0,j.jsx)(a(310324).Ay,{...c,inputLeft:(0,j.jsx)(a(310324).Zf,{icon:a(921048).magnifyingGlassSmallIcon}),value:l,onChange:m,onClearButtonClick:u,showClearButton:l.length>0,focus:!0,focusAfterAnimation:!0,placeholder:o.formatMessage(k.searchOptionsPlaceholder),inputElementAttributes:{...c.inputElementAttributes,"aria-label":o.formatMessage(k.searchOptionsLabel,{fieldLabel:t})}})}),children:(0,j.jsx)(a(558045).A,{type:a(558045).O.Vertical,role:"listbox",comboboxProps:p,initialFocus:x,resetInitialFocusOnSectionChangeAlways:!0,sections:f})})}let C={warningContainer:{background:a(632079).Tj.yellow.background.secondary,border:`1px solid ${a(632079).Tj.yellow.border.strongTranslucent}`,borderRadius:4},icon:{flexShrink:0},link:{color:a(632079).Tj.yellow.text.accentPrimary,textDecoration:"underline"}};function D(e){let{deprecation:t}=e;if(void 0===t)return null;let i=function(e){let{deprecation:t,now:i=a(120011).DateTime.utc()}=e;if(t.removalOn){let e=d(t.removalOn);if(e)return`This tool will be removed on ${e}.`}if(t.deprecatesOn){let e=a(120011).DateTime.fromISO(t.deprecatesOn,{zone:"utc"}),n=d(t.deprecatesOn);if(e.isValid&&n){let t=i.startOf("day"),a=e.startOf("day")<t?"was deprecated":"will be deprecated";return`This tool ${a} on ${n}.`}}return"This tool is deprecated."}({deprecation:t}),n=t.alternative;return(0,j.jsxs)(a(4458).fI,{style:C.warningContainer,alignItems:"flex-start",ga
106p:6,padding:8,marginBottom:8,children:[(0,j.jsx)(a(16275).I,{icon:a(143896).exclamationMarkTriangleFillSmallIcon,size:"sm",colorPalette:"yellow",colorVariant:"accentPrimary",style:C.icon}),(0,j.jsxs)(a(111010).D,{styleKey:"bodySmRegular",colorVariant:"secondary",children:[i,t.message?` ${t.message}`:void 0," Use ",(0,j.jsx)(T,{alternative:n})," instead."]})]})}function T(e){var t,i;let{alternative:r}=e;if("docs"===r.type)return!function(e){try{let t=new URL(e);return"https:"===t.protocol&&l.has(t.hostname)}catch(e){if(e instanceof TypeError)return!1;throw e}}(r.url)?(0,j.jsx)("span",{children:r.label}):(0,j.jsx)(a(590422).Q,{href:r.url,external:!0,inline:!0,underline:!0,style:C.link,children:r.label});if("adminSection"===r.type){let e=(t=r.sectionName,(0,a(48697).O)(a(604063).i8,t)?a(604063).i8[t].title:(0,n().NZ)(t)),i=function(e,t){let i=a(604063).wJ.find(t=>t===e);if(void 0!==i)return c({sectionName:i,params:t})}(r.sectionName,r.params);return void 0===i?(0,j.jsx)("span",{children:e}):(0,j.jsx)(a(590422).Q,{href:i,inline:!0,underline:!0,style:C.link,children:e})}if("adminTool"===r.type){let e=(i=r.toolName,(0,a(48697).O)(a(688211)._P,i)?a(688211)._P[i].displayName??(0,n().NZ)(i.replace(/^admin/,"")):(0,n().NZ)(i.replace(/^admin/,""))),t=function(e,t){let i=a(604063).wJ.find(t=>a(604063).i8[t].tools.some(t=>t===e));if(void 0!==i)return c({sectionName:i,hash:e,params:t})}(r.toolName,r.params);return void 0===t?(0,j.jsx)("span",{children:e}):(0,j.jsx)(a(590422).Q,{href:t,inline:!0,underline:!0,style:C.link,children:e})}return(0,j.jsx)("span",{})}let R="unattributed",A={width:180};function N(e){let{values:t,spaceIdField:n,impactedPeriodStartField:s,impactedPeriodEndField:o,disabled:l,store:d,onChange:c}=e,p=(0,a(533992).v3)(),m=(0,a(579993).K8)(()=>d.state.inputValues[n],[d,n]),u="string"==typeof m&&(0,r().iv)(m.trim())?m.trim():void 0,h=(0,a(579993).K8)(()=>d.state.inputValues[s],[d,s]),y=(0,a(579993).K8)(()=>d.state.inputValues[o],[d,o]),g="string"==typeof h&&h.length>0?h:void 0,x="string"==typeof y&&y.length>0?y:void 0,f=void 0!==g&&void 0!==x,b=(0,i.useCallback)(()=>{d.setState({...d.state,inputValues:{...d.state.inputValues,[s]:void 0,[o]:void 0}})},[d,s,o]),v=(0,i.useRef)(void 0),k=(0,i.useRef)(void 0);(0,i.useEffect)(()=>{v.current!==u&&(v.current=u,b())},[u,b]);let S=(0,i.useRef)(c);(0,i.useEffect)(()=>{S.current=c},[c]);let[w,I]=(0,i.useState)(0),[C,D]=(0,i.useState)(void 0),[T,A]=(0,i.useState)(void 0),[N,E]=(0,i.useState)(!1);(0,i.useEffect)(()=>{let e=k.current!==u;if(k.current=u,void 0===u){D(void 0),A(void 0),E(!1),S.current([]);return}D(e=>(null==e?void 0:e.spaceId)===u?e:void 0),A(void 0),S.current([]);let t=!0;return E(!0),(async()=>{try{let i=!e&&f,n=await p.api.callApi({eventName:"adminGetCreditRefundEligibility",environment:p,data:{spaceId:u,...i?{impactedServicePeriodStartDate:g,impactedServicePeriodEndDate:x}:{}}});if(!t)return;if("success"!==n.type){D(e=>(null==e?void 0:e.spaceId)===u?e:void 0),A((0,a(201790).V4)(n));return}A(void 0),D(n.data),S.current([]),n.data.isSalesAssisted||b()}catch(e){(0,a(208318).t)().log({level:"warning",from:"CreditRefundAllocationsInput",type:"loadCreditRefundEligibilityFailed",error:(0,a(952977).convertErrorToLog)(e)}),t&&(D(e=>(null==e?void 0:e.spaceId)===u?e:void 0),A((0,a(324497).A)(e).message))}finally{t&&E(!1)}})(),()=>{t=!1}},[p,u,g,x,f,w,b]);let L=(0,i.useCallback)(()=>{I(e=>e+1)},[]),_=(0,i.useCallback)((e,a)=>{let i=t.filter(t=>t.targetId!==e);c(void 0===a?i:[...i,{targetId:e,creditAmount:a}])},[t,c]),U=(0,i.useMemo)(()=>t.reduce((e,t)=>e+t.creditAmount,0),[t]);if(void 0===u)return(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Enter a workspace ID to load what a refund can be attributed to."});let W=(null==C?void 0:C.isSalesAssisted)===!0?(0,j.jsx)(M,{store:d,startField:s,endField:o,disabled:l}):void 0;return void 0!==T?(0,j.jsxs)(a(4458).VP,{gap:4,children:[W,(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:`Could not load refund targets: ${T}`}),(0,j.jsx)(B,{disabled:l,onClick:L})]}):void 0===C?(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:N?"Loa
106ding refund targets…":"No refund targets loaded."}):"unattributed"===C.attribution?(0,j.jsxs)(a(4458).VP,{gap:6,children:[(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:C.isSalesAssisted?"The refund amount is allocated automatically across usage in the impacted period.":"This workspace's credits aren't enforced from Metronome commits, so there is no invoice line to attribute the refund to. It is recorded as a usage adjustment for the workspace as a whole."}),W,C.isSalesAssisted&&!f?(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Enter both impacted-period dates to load refundable usage."}):N?(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Loading refundable usage…"}):(0,j.jsxs)(j.Fragment,{children:[C.isSalesAssisted?(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:`${C.totalRefundable} credits used in the impacted period`}):void 0,(0,j.jsx)(a(129611).o2,{targetId:R,label:"Refund amount",initialAmount:P(t,R),disabled:l,onAmountChange:_},C.isSalesAssisted?`${g}:${x}`:R)]})]}):0===C.targets.length?(0,j.jsxs)(a(4458).VP,{gap:4,children:[(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"This workspace has no credit grants in the current service period, so there is nothing to refund against."}),W,(0,j.jsx)(B,{disabled:l,onClick:L})]}):(0,j.jsxs)(a(4458).VP,{gap:2,children:[W,C.targets.map(e=>(0,j.jsx)(V,{target:e,initialAmount:P(t,e.targetId),disabled:l,onAmountChange:_},e.targetId)),(0,j.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:`Total: ${U} of ${C.totalRefundable} refundable`}),(0,j.jsx)(B,{disabled:l,onClick:L})]})]})}function M(e){let{disabled:t,store:n,startField:r,endField:s}=e,o=(0,a(579993).K8)(()=>n.state.inputValues[r],[n,r]),l=(0,a(579993).K8)(()=>n.state.inputValues[s],[n,s]),d=(0,i.useCallback)((e,t)=>{n.setState({...n.state,inputValues:{...n.state.inputValues,[e]:t}})},[n]),c=(0,i.useCallback)(e=>{d(r,""===e.target.value?void 0:e.target.value)},[d,r]),p=(0,i.useCallback)(e=>{d(s,""===e.target.value?void 0:e.target.value)},[d,s]);return(0,j.jsxs)(a(4458).fI,{gap:8,children:[(0,j.jsxs)(a(4458).VP,{gap:2,children:[(0,j.jsx)(a(111010).D,{styleKey:"captionSm",children:"Impacted period start (UTC, inclusive)"}),(0,j.jsx)(a(287562).p,{type:"date",value:"string"==typeof o?o:"",disabled:t,onChange:c,overrideDefaultWidth:!0,style:A})]}),(0,j.jsxs)(a(4458).VP,{gap:2,children:[(0,j.jsx)(a(111010).D,{styleKey:"captionSm",children:"Impacted period end (UTC, inclusive)"}),(0,j.jsx)(a(287562).p,{type:"date",value:"string"==typeof l?l:"",disabled:t,onChange:p,overrideDefaultWidth:!0,style:A})]})]})}function P(e,t){var a;return null==(a=e.find(e=>e.targetId===t))?void 0:a.creditAmount}function V(e){let{target:t,initialAmount:i,disabled:n,onAmountChange:r}=e,s=t.refundable>0;return(0,j.jsxs)(a(4458).fI,{gap:8,alignItems:"center",paddingBlock:6,children:[(0,j.jsx)(a(129611).o2,{targetId:t.targetId,label:`Refund amount for ${t.label}`,initialAmount:i,disabled:!0===n||!s,onAmountChange:r}),(0,j.jsxs)(a(4458).VP,{children:[(0,j.jsx)(a(111010).D,{styleKey:"captionSm",children:`${t.label} — ${t.used} used, ${t.refundable} refundable`}),(0,j.jsx)(E,{target:t})]})]})}function E(e){var t;let i,n,{target:r}=e,s=(i=[],"invoice_line"===(t=r).kind?(void 0!==t.stripeInvoiceCreatedAtMs&&i.push(`invoiced ${(0,a(469181).r6)(t.stripeInvoiceCreatedAtMs)}`),void 0===t.stripeInvoiceId&&i.push("invoice unknown")):"plan_allocated"===t.kind&&i.push("free credits — no invoice line, none needed"),t.alreadyRefunded>0&&i.push(`${t.alreadyRefunded} already refunded`),t.creditNoted>0&&i.push(`${t.creditNoted} credit noted`),void 0!==(n=function(e){switch(e.ineligibleReason){case"no_usage":return"no usage to refund";case"fully_refunded":return"fully refunded already";case"no_invoice_line":return"no Stripe invoice line on this commit, so a refund against it can't be booked";case void 0:return}}(t))&&i.push(n),i.join(" · "));if("invoice_line"!==r.kind||void 0===r.stripeInvoiceId)return(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:s});let o=void 0!==r.stripeInvoiceUrl&&r.stripeInvoiceUrl.startsWith("https://dashboard.stripe.com/")?r.stripeInvoiceUrl:void 0;return(0,j.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:[void 0===o?r.stripeInvoiceId:(0,j.jsx)("a",{href:o,target:"_blank",rel:"noreferrer",children:r.stripeInvoiceId}),""===s?void 0:` \xb7 ${s}`]})}function B(e){return(0,j.jsx)(a(548436).r,{size:"sm",onClick:e.onClick,disabled:e.disabled,children:"Reload targets"})}let L=(0,a(327219).YK)({allSources:{id:"promotionalCreditSourceIn
106put.allSources",defaultMessage:"All sources"}});function _(e){let{label:t,value:n,disabled:r,allowEmpty:s,onChange:o}=e,l=(0,a(533992).v3)(),d=(0,a(327219).tz)(),[c,p]=(0,i.useState)(void 0),[m,u]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(!1);(0,i.useEffect)(()=>{y(!0),(async()=>{try{let e=await l.api.callApi({eventName:"adminGetPromotionalCreditSources",environment:l,data:{}});if("success"!==e.type){p(void 0),u((0,a(201790).V4)(e));return}u(void 0),p(e.data.sources)}catch(e){(0,a(208318).t)().log({level:"warning",from:"PromotionalCreditSourceInput",type:"loadPromotionalCreditSourcesFailed",error:(0,a(952977).convertErrorToLog)(e)}),p(void 0),u((0,a(324497).A)(e).message)}finally{y(!1)}})()},[l]);let g=(0,i.useMemo)(()=>{let e=(c??[]).map(e=>({displayName:e,value:e}));return s?[{displayName:d.formatMessage(L.allSources),value:""},...e]:e},[s,d,c]);return m?(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:`Could not load approved sources: ${m}`}):c?(0,j.jsx)(w,{label:t,options:g,selectedValue:s?n??"":n,placeholder:"Select a program…",disabled:r,onSelect:e=>o(e||void 0)}):(0,j.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:h?"Loading approved sources…":"No sources loaded."})}let U=(0,a(327219).YK)({addButton:{id:"stringArrayInput.addButton",defaultMessage:"Add"},removeButton:{id:"stringArrayInput.removeButton",defaultMessage:"Remove item"},emptyState:{id:"stringArrayInput.emptyState",defaultMessage:"No items added. Click “Add” to add an item."}}),W={style1:{flex:1},style2:{marginTop:4},style3:{color:a(632079).oZ.lightTextColor}};function F(e){let{values:t,placeholder:n,maxItems:r,disabled:s,onChange:o}=e,l=(0,a(327219).tz)(),d=(0,i.useCallback)(()=>{t.length<r&&o([...t,""])},[t,r,o]),c=(0,i.useCallback)(e=>{o(t.filter((t,a)=>a!==e))},[t,o]),p=(0,i.useCallback)((e,a)=>{let i=[...t];i[e]=a,o(i)},[t,o]);return(0,j.jsxs)("div",{children:[t.map((e,t)=>(0,j.jsxs)(a(4458).fI,{gap:4,alignItems:"center",marginBottom:4,children:[(0,j.jsx)(a(287562).p,{value:e,placeholder:n,disabled:s,onChange:e=>p(t,e.target.value),style:W.style1}),(0,j.jsx)(a(374533).K,{icon:a(968411).trashIcon,onClick:()=>c(t),disabled:s,ariaLabel:l.formatMessage(U.removeButton)})]},t)),t.length<r?(0,j.jsx)(a(548436).r,{size:"sm",onClick:d,disabled:s,style:W.style2,iconLeading:{icon:a(581923).plusIcon,size:"sm"},children:l.formatMessage(U.addButton)}):void 0,0===t.length?(0,j.jsx)(a(324489).V,{isSmall:!0,style:W.style3,children:l.formatMessage(U.emptyState)}):void 0]})}let K={style0:{marginTop:16,marginBottom:16},style1:{marginBottom:16},style2:{fontWeight:a(699422).Wy.bold},style3:{padding:"4px 8px",marginBottom:16},style4:{width:"100%"},style5:{color:a(632079).oZ.red,fontSize:12,marginTop:8}};function $(e){let{userEmail:t,headerContent:n,toolName:r}=e,s=(0,a(533992).v3)(),o=(0,a(327219).tz)(),[l]=(0,i.useState)(()=>(0,a(92513).JW)()),[d,c]=(0,i.useState)({passcodeSent:!1,passcode:"",loading:!1,error:void 0}),p=(0,i.useCallback)(async()=>{if(!t)return void c(e=>({...e,error:"User email not found"}));c(e=>({...e,loading:!0,error:void 0}));let e={email:t,authFlowId:l},i="adminDeleteSpaces"===r?{...e,deleteWorkspace:!0}:{...e,deleteUser:!0},n=await (0,a(941248).o)({environment:s,data:i});"success"===n.type?c(e=>({...e,passcodeSent:!0,loading:!1})):c(e=>({...e,loading:!1,error:(0,a(922271).H)(o,n)}))},[t,s,o,r,l]),m=(0,i.useCallback)(async()=>{if(!t)return;c(e=>({...e,loading:!0,error:void 0}));let e="adminDeleteSpaces"===r?"delete_workspace":"delete_user",i=await s.api.callApi({eventName:"authVerifyTemporaryPassword",environment:s,data:{temporaryPassword:d.passcode,useCase:e}});if("success"===i.type){let e,t;e=Date.now(),t=v.state||{},v.setState({...t,[r]:e}),c(e=>({...e,loading:!1}))}else c(e=>({...e,loading:!1,error:(0,a(922271).H)(o,i)}))},[t,s,d.passcode,r,o]),u=(0,i.useCallback)(e=>{c(t=>({...t,passcode:e.target.value,error:void 0}))},[]);return(0,j.jsxs)(j.Fragment,{children:[n,(0,j.jsx)("div",{style:K.style0,children:"You need to reauthenticate to use this tool."}),d.passcodeSent?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("div",{style:K.style1,children:["We sent a temporary verification code to ",(0,j.jsx)("span",{style:K.style2,children:t}),"."]}),(0,j.jsx)(a(287562).p,{value:d.passcode,onChange:u,onSubmit:m,placeholder:"Enter verification code",style:K.style3,focusInitial:!0}),(0,j.jsx)(a(912946).j,{colorPalette:"blue",size:"lg",onClick:m,disabled:d.loading||!d.passcode,style:K.style4,children:d.loading?(0,j.jsx)(a(517334).k,{}):"Verify and continue"})]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("div",{style:K.style1,children:"We'll send a temporary verification code to your email."}),(0,j.jsx)(a(548436).A,{size:"lg",onClick:p,disabled:d.loading,children:d.loading?(0,j.jsx)(a(517334).k,{}):"Send verification code"})]}),d.error?(0,j.jsx)("div",{style:K.style5,children:d.error}):void 0]})}let O={fontWeight:a(699422).Wy.bold,fontSize:20,display:"flex",alignItems:"center",marginBottom:6},z={width:"calc(100% - 120px)",height:"calc(100% - 120px)",padding:24,fontSize:"1.2em",overflow:"scroll"},G={root:{display:"grid",gridTemplateRows:"auto minmax(0, 1fr)",height:"100%",minHeight:0},tabBarAnimationContainer:{overflow:"hidden",display:"flex",alignItems:"flex-end"},tabBar:{display:"flex",flexWrap:"wrap",gap:4,alignItems:"center",width:"100%",padding:16,borderBlockEnd:`1px solid ${a(632079).Tj.border.secondary}`},tabButton:{borderRadius:20,flexShrink:0,lineHeight:1.2,minWidth:0,padding:"6px 12px",whiteSpace:"nowrap",height:32,fontWeight:a(699422).Wy.medium},tabTitle:{...a(699422).RC,maxWidth:240},tabBarSpinner:{flexShrink:0},contentArea:{minHeight:0,overflow:"hidden"},tabPanel:{height:"100%",minHeight:0,overflow:"auto"},tabPanelInner:{padding:24},tabPanelContentFade:{height:"100%"}},q={fontSize:10,position:"absolute",bottom:7,insetInlineEnd:20},H="__undefined",Z={...["userId","spaceId","blockId","pageId","integrationId","spaceId","fileId","teamId","collectionId","botId","commentId","discu
106ssionId"].reduce((e,t)=>({[t]:a(591977).nZ,[`${t}s`]:a(591977).Gb,...e}),{}),...["userEmail","fromEmail","toEmail"].reduce((e,t)=>({[t]:a(591977).zg,[`${t}s`]:a(591977).I3,...e}),{}),domain:a(591977).mT,domains:a(591977).hT,supportTicketLink:a(591977).r1},J={style0:{width:"fit-content",backgroundColor:"white"},style1:{marginInlineStart:4},style2:{color:a(632079).oZ.red,display:"inline-flex",marginInlineStart:8}};function Q(e){let{fieldName:t,acceptMultiple:n,store:r}=e,[s,o]=(0,i.useState)(()=>({isUploading:!1,errorMessage:void 0,uploadedFileUrls:[]})),l=(0,a(533992).v3)();return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(a(548436).A,{size:"lg",style:J.style0,onClick:()=>{a(401558).Bz({multiple:!!n,environment:l,onStart:()=>{o({...s,isUploading:!0,errorMessage:void 0,uploadedFileUrls:[]})},bucket:"public",onError:e=>{o({isUploading:!1,errorMessage:e.message,uploadedFileUrls:[]})},onComplete:e=>{o({isUploading:!1,errorMessage:void 0,uploadedFileUrls:e}),r.setState({response:void 0,inputValues:{...r.state.inputValues,[t]:n?e:e[0]}})},accept:"image/*"})},children:[n?"Upload images":"Upload image",s.isUploading?(0,j.jsx)(a(517334).k,{style:J.style1}):void 0]}),s.uploadedFileUrls?(0,j.jsx)("div",{children:s.uploadedFileUrls.join(",")}):void 0,s.errorMessage?(0,j.jsx)("div",{style:J.style2,children:s.errorMessage}):void 0]})}let Y=(0,a(327219).YK)({loading:{id:"adminAPIRequest.loadingMessage",defaultMessage:"Loading…"},clearCsvFileLabel:{id:"adminAPIRequest.clearCsvFileLabel",defaultMessage:"Clear CSV file"}}),X={noPermission:{background:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary},ownerLink:{color:a(632079).Tj.blue.text.accentPrimary},style0:{cursor:"pointer"},style1:{width:320,maxWidth:320,whiteSpace:"normal"},style2:{textDecoration:"underline"},style3:{marginInlineStart:4,textDecoration:"none",color:"inherit",userSelect:"text",WebkitUserSelect:"text"},style4:{flexGrow:1},style5:{marginTop:16,marginBottom:8},chevron:{width:16,height:16,flexShrink:0,transition:"transform 150ms ease",color:a(632079).Tj.icon.secondary},headerClickable:{cursor:"pointer"}},ee=i.forwardRef(function(e,t){let n=(0,a(579993).K8)(()=>void 0!==e.api.notinoAction&&a(218744).default.getConfigKey("admin_notino_action_rollout","enabledTools").includes(e.api.apiName),[e.api]),r=(0,i.useMemo)(()=>{var t,a;return void 0===e.api.notinoAction?e.api:(t=e.api,n?{...t,schema:(null==(a=t.notinoAction)?void 0:a.schema)??t.schema}:{...t,notinoAction:void 0})},[e.api,n]);return(0,i.createElement)(et,{...e,api:r,forwardedRef:t,key:`${r.apiName}:${(0,a(688211).nZ)(r)?"action":"legacy"}`})});function et(e){var t,s,l,d;let{api:c,owner:p,defaultParams:m,showDefaultParams:u,hasPermission:h,showByDefault:y,singleRecordMode:g,disableGlobalLoadingState:f,onLoadingStateChange:k,source:S,notinoActionInitialExecutionId:w}=e,{apiName:I,displayName:C,schema:T,description:R,emoji:A,isDestructive:N}=c,M=(0,i.useRef)(null),P=(0,i.useRef)(null),V=(0,a(579993).uB)(void 0,b),E=(0,a(579993).K8)(()=>{var e,t,i,n;return e=V.state.inputValues,t=T,(0,a(48697).WP)(t).some(([t,i])=>!!el(i,e)&&("section"===i.type?(0,a(48697).WP)(i.components).some(([t,a])=>el(a,e)&&"date"===a.type&&void 0!==es(e[t],er(a))):"date"===i.type&&void 0!==es(e[t],er(i))))||(i=V.state.inputValues,n=T,(0,a(48697).WP)(n).some(([e,t])=>!!el(t,i)&&("section"===t.type?(0,a(48697).WP)(t.components).some(([e,t])=>el(t,i)&&"options"===t.type&&!0===t.required&&!eo(i[e],t.options)):"options"===t.type&&!0===t.required&&!eo(i[e],t.options))))||function(e,t){if(void 0===t)return!1;let a=e[t];return"string"!=typeof a||0===a.trim().length}(V.state.inputValues,c.spaceCellRoutingField)},[c.spaceCellRoutingField,V,T]),B=(0,a(533992).v3)(),L=Object.keys(T).length,_=!g&&!y&&L>=4,[U,W]=(0,i.useState)(!_),[F,K]=(0,i.useState)(()=>c.generatedRequestIdKey?r().Ay():void 0),z=(0,i.useMemo)(()=>c.generatedRequestIdKey&&F?{key:c.generatedRequestIdKey,value:F}:void 0,[c.generatedRequestIdKey,F]),G=(0,i.useCallback)(e=>{K(t=>{var a;return t?(a=t)===e?r().Ay():a:void 0})},[]),H=(0,i.useCallback)(()=>{W(e=>!e)},[]);(0,a(383953).l)(()=>{ey(e,V)}),(0,i.useEffect)(()=>{V.source=S},[V,S]),(0,i.useEffect)(()=>{var e,t;e=y,t=g,e&&t&&!(0,a(688211).nZ)(c)&&ef({environment:B,api:c,store:V,disableGlobalLoadingState:f,onLoadingStateChange:k,generatedRequestId:z,onRequestSuccess:G})},[]),(0,i.useEffect)(()=>{_&&window.location.hash===`#${I}
106`&&W(!0)},[_,I]),(0,i.useImperativeHandle)(e.forwardedRef,()=>({focus:()=>{var e;W(!0),null==(e=M.current)||e.focus()},getElement:()=>P.current}),[]);let Z=(0,i.useCallback)(()=>{E||(0,a(688211).nZ)(c)||ef({environment:B,api:c,store:V,disableGlobalLoadingState:f,onLoadingStateChange:k,generatedRequestId:z,onRequestSuccess:G})},[f,B,c,z,E,k,G,V]),J=(0,a(579993).K8)(()=>-1!==(a(229408).A.getState()||[]).indexOf(I),[I]),Q=(0,j.jsx)("a",{onClick:()=>{var e;let t,i;return e=c,void(-1===(i=(t=a(229408).A.getState()||[]).indexOf(e.apiName))?t.push(e.apiName):t.splice(i,1),a(229408).A.setState(t))},style:X.style0,children:(0,j.jsx)(a(71729).A,{size:18,emoji:J?"⭐":"☆"})}),Y=J||!1!==h,ee=(0,j.jsx)(a(51831).m_,{content:()=>(0,j.jsxs)("div",{style:X.style1,children:["You do not have permission to ",(0,j.jsx)("i",{children:c.apiName}),". To receive temporary access, please follow"," ",(0,j.jsx)(a(68774).N,{href:"https://dev.notion.so/notion/Admin-Mode-Request-Temporary-Access-3e1c84d2859d4061a18046d49eda6086?pvs=4",external:!0,style:X.style2,children:"these instructions."})]}),closeDelay:1e3,allowHover:!0,children:e=>(0,j.jsx)("div",{...e,children:(0,j.jsx)("span",{title:"No permission",children:(0,j.jsx)(a(71729).A,{size:18,emoji:"🚫",alt:"No permission"})})})}),{confirmationResponse:et,response:ei}=(0,a(579993).O$)(V),ed={...e.style,...!1===h?X.noPermission:{}},ec=(0,a(83208).X)("admin_mode_enable_hourly_reauth_for_sensitive_actions"),ep=(0,a(579993).K8)(()=>(function(e){let{config:t,toolName:i}=e;return((0,a(788145).Qq)(x,t)??o).tools[i]})({config:a(218744).default.getConfig({configName:"admin_tool_deprecations",disableExposureLogging:!0}),toolName:I}),[I]),em=(0,a(579993).K8)(()=>{let e;return ec&&c.requiresHourlyReauth&&!((e=(v.state||{})[I])&&Date.now()-e<a(286762).pT)},[ec,c.requiresHourlyReauth,I]),eh=(0,a(876252).$)(),eg=(0,a(579993).K8)(()=>null==eh?void 0:eh.getEmail(),[eh]);if(em){let e=(0,j.jsxs)("div",{style:O,children:[(0,j.jsx)(a(71729).A,{size:24,emoji:A}),(0,j.jsx)(a(590422).Q,{href:`#${I}`,style:X.style3,children:C||(0,n().NZ)(I.replace(/^(admin)/,""))}),(0,j.jsx)("span",{style:X.style4}),Y?Q:void 0,!1===h?ee:void 0]});return(0,j.jsxs)("div",{style:ed,children:[(0,j.jsx)(D,{deprecation:ep}),(0,j.jsx)($,{userEmail:eg,headerContent:e,toolName:I})]})}return(0,j.jsxs)("div",{ref:P,id:I,style:ed,children:[(0,j.jsxs)("div",{style:{...O,..._?X.headerClickable:void 0},onClick:_?H:void 0,role:_?"button":void 0,tabIndex:_?0:void 0,"aria-expanded":_?U:void 0,onKeyDown:_?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),H())}:void 0,children:[_?(0,j.jsx)(a(16275).I,{icon:a(342392).arrowChevronSingleRightIcon,style:{...X.chevron,transform:`rotateZ(${90*!!U}deg)`}}):void 0,(0,j.jsx)(a(71729).A,{size:24,emoji:A}),(0,j.jsx)(a(590422).Q,{href:`#${I}`,style:X.style3,onClick:_?e=>e.stopPropagation():void 0,children:C||(0,n().NZ)(I.replace(/^(admin)/,""))}),(0,j.jsx)("span",{style:X.style4}),Y?Q:void 0,!1===h?ee:void 0]}),(0,j.jsx)(D,{deprecation:ep}),!U&&_?(0,j.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:"Click the arrow to expand this tool."}):void 0,U?(0,j.jsxs)(j.Fragment,{children:[R?(0,j.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,children:R}):void 0,(t=y,s=g,t&&s)?void 0:(0,a(688211).nZ)(c)?(0,j.jsx)(ea,{api:c,defaultParams:m,showDefaultParams:u,firstInputRef:M,hasPermission:h,hasInputValidationError:E,store:V,environment:B,initialExecutionId:w,onLoadingStateChange:k}):(0,j.jsxs)(j.Fragment,{children:[Object.entries(T).map(([e,t],a)=>m&&m[e]&&!u?null:(0,j.jsx)(en,{schema:t,keyProp:e,index:a,firstInputRef:M,handleSubmitClick:Z,hasPermission:h,store:V},e)),(0,j.jsx)(a(548436).A,{style:X.style5,size:"lg",onClick:Z,colorPalette:N?"red":void 0,disabled:!1===h||E,children:"Submit"})]})]}):void 0,(l=y,d=g,l&&d&&!ei)?(0,j.jsxs)("div",{children:[(0,j.jsx)(a(517334).k,{size:18}),"Loading ..."]}):void 0,(0,j.jsx)(eu,{response:et}),(0,j.jsx)(eS,{api:c,store:V,response:et,generatedRequestId:z,onRequestSuccess:G}),(0,j.jsx)(eu,{response:ei}),(0,j.jsx)(eI,{adminAPIRequestProps:e,store:V,response:ei,generatedRequestId:z,onRequestSuccess:G}),p?(0,j.jsx)("div",{style:q,children:p?(0,j.jsxs)("span",{children:["Owned by"," ",(0,j.jsx)("a",{href:`https://notion.slack.com/app_redirect?channel=${p.slackChannel}`,style:X.ownerLink,children:p.teamName})]}):void 0}):void 0]})}function ea({api:e,defaultParams:t,showDefaultParams:n,firstInputRef:r,hasPermission:s,hasInputValidationError:o,store:l,environment:d,initialExecutionId:c,onLoadingStateChange:p}){let m=(0,a(624139).e)({environment:d,config:e.notinoAction,initialExecutionId:c,onLoadingStateChange:p}),u=(0,i.useCallback)(()=>{o||m.plan(ep(l.state.inputValues,e.schema))},[e.schema,m,o,l]),h=Object.entries(e.schema).map(([e,a],i)=>t&&t[e]&&!n?null:(0,j.jsx)(en,{schema:a,keyProp:e,index:i,firstInputRef:r,handleSubmitClick:u,hasPermission:!m.isBusy&&s,store:l},e));return(0,j.jsx)(a(624139).j,{title:e.displayName??e.apiName,controller:m,hasPermission:s,hasInputValidationError:o,planFields:h,onPlan:u,ArtifactPresentationComponent:e.notinoAction.ArtifactPresentationComponent})}let ei={select:{border:"none",height:28,width:"100%",borderRadius:6,boxShadow:`${a(632079).Tj.border.primaryTranslucent} 0 0 0 1px`,background:a(632079).Tj.background.secondaryTranslucent,paddingInlineStart:10,paddingInlineEnd:10,fontSize:14,cursor:"pointer"},style1:{display:"none"},style2:{marginTop:12,marginBottom:4},style3:{marginTop:4,marginBottom:8},timezone:{marginTop:4,fontSize:10}
106,toggledInput:{marginTop:8},requiredLabel:{fontWeight:a(699422).Wy.bold,color:a(632079).Tj.text.secondary},optionalLabel:{fontWeight:a(699422).Wy.bold,color:a(632079).Tj.text.tertiary},validationError:{marginTop:4,color:a(632079).Tj.red.text.accentPrimary}};function en(e){var t,r,s;let o,l=(0,a(327219).tz)(),{schema:d,keyProp:c,index:p,firstInputRef:m,handleSubmitClick:u,hasPermission:h,store:y}=e,g=(0,a(579993).K8)(()=>y.state.inputValues[c],[y,c]),x=(0,a(579993).K8)(()=>el(d,y.state.inputValues),[y,d]),f=0===p?m:void 0,[b,v]=(0,i.useState)(""),[k,S]=(0,i.useState)(!1),I=(0,i.useRef)(null),C="section"!==d.type?"name"in d&&d.name?d.name:(0,n().NZ)(c):void 0,D=(0,i.useCallback)((e,t)=>{e.current&&(e.current.value=t)},[]);if((0,i.useEffect)(()=>{var e;"file"===d.type&&(void 0===g||""===g||null===g)&&(null==(e=I.current)?void 0:e.value)!==""&&(v(""),D(I,""))},[g,d.type,I,D]),"string"===d.type){let e=(0,j.jsx)(a(287562).p,{ref:f,value:"string"==typeof g?g:"",placeholder:(t=c,void 0!==(r=d).placeholder?r.placeholder:(0,a(48697).O)(Z,t)?Z[t]:void 0),showClearButton:!0,textarea:!0===d.multiline,autosize:!0===d.multiline,onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e.target.value}})},onSubmit:u,onClearButtonClick:()=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:void 0}})},disabled:!1===h});if(void 0!==d.toggleOptions){let{defaultLabel:t,manualLabel:a}=d.toggleOptions;o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)("select",{style:ei.select,value:k?"manual":"default",onChange:e=>{let t="manual"===e.target.value;S(t),t||y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:void 0}})},children:[(0,j.jsx)("option",{value:"default",children:t}),(0,j.jsx)("option",{value:"manual",children:a})]}),k?(0,j.jsx)("div",{style:ei.toggledInput,children:e}):void 0]})}else o=e}else if("number"===d.type){let e="float"===d.numberType?parseFloat:parseInt;o=(0,j.jsx)(a(287562).p,{ref:f,type:"number",value:"number"==typeof g?g.toString():"",min:null==(s=d.min)?void 0:s.toString(),onChange:t=>{let a=e(t.target.value);void 0!==d.max&&a>d.max&&(a=d.max),y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:a}})},onSubmit:u,disabled:!1===h})}else if("date"===d.type){let e=er(d),t=es(g,e);o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a(287562).p,{ref:f,type:"date",value:"string"==typeof g?g:"",min:e.min,inputElementAttributes:{max:e.max},errorOutline:void 0!==t,onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e.target.value}})},showClearButton:!0,onClearButtonClick:()=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:void 0}})},disabled:!1===h}),t?(0,j.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:ei.validationError,children:t}):void 0]})}else if("datetimeISO"===d.type){let e=a(120011).DateTime.now().zoneName;o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(a(324489).V,{isSmall:!0,style:ei.timezone,children:e}),(0,j.jsx)(a(287562).p,{ref:f,type:"datetime-local",value:"string"==typeof g&&g?a(120011).DateTime.fromISO(g).toLocal().toFormat("yyyy-MM-dd'T'HH:mm"):"",onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e.target.value&&new Date(e.target.value).toISOString()}})},showClearButton:!0,onClearButtonClick:()=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:void 0}})},disabled:!1===h})]})}else if("options"===d.type){let e=void 0===g,t=[...!0!==d.required?[{displayName:"Empty",value:H}]:[],...d.options.map(e=>({displayName:"string"==typeof e?e:e.displayName,value:String("string"==typeof e?e:e.value)}))];o=(0,j.jsx)(w,{label:C??(0,n().NZ)(c),options:t,selectedValue:e?void 0:String(g),placeholder:d.placeholder??"Select...",disabled:!1===h,onSelect:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e}})}})}else if("boolean"===d.type)o=(0,j.jsx)(a(382726).S,{checked:!!g,size:20,onClick:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:!g}})},disabled:!1===h});else if("file"===d.type)o=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,j.jsx)(a(548436).A,{size:"lg",onClick:()=>{var e;null==I||null==(e=I.current)||e.click()},children:"Upload"}),b,b?(0,j.jsx)(a(374533).K,{size:"lg",ariaLabel:l.formatMessage(Y.clearCsvFileLabel),colorPalette:"red",icon:a(968411).trashIcon,onClick:()=>{!function({key:e,store:t,fileInputRef:a,setFilename:i}){i(""),null!=a&&a.current&&(a.current.value=""),t.setState({response:void 0,inputValues:{...t.state.inputValues,[e]:void 0}})}({key:c,store:y,fileInputRef:I,setFilename:v})}}):void 0]}),(0,j.jsx)("input",{ref:I,style:ei.style1,type:"file",name:d.name||"csv file",accept:d.acceptedFileExtensions,onChange:e=>eg({key:c,e,store:y,setFilename:v}),disabled:!1===h})]});else if("image"===d.type||"images"===d.type){let e="images"===d.type;o=(0,j.jsx)(Q,{fieldName:c,acceptMultiple:e,store:y})}else if("timezone"===d.type)o=(0,j.jsx)(a(273585).G,{enableRecents:!0,currentValue:void 0,onSelect:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e}})},children:e=>(0,j.jsx)(a(548436).A,{size:"lg",...e,children:"string"==typeof g?g:void 0})});else if("multiselect"===d.type){let e=d.options.map((e,t)=>({key:String(t),value:e.value,title:e.displayName,caption:e.value===e.displayName?void 0:e.value})),t=ew(g),i=d.defaultValue??[],n=t??i,r=n.length>0?`${n.length} selected`:"Empty";o=(0,j.jsx)(a(380305).uI,{pillTitle:r,pillIcon:a(433413).h,setSelectedItems:e=>{y.setState({inputValues:{...y.state.inputValues,[c]:e}})},selectedItems:n,items:e})}else if("stringArray"===d.type){let e=ew(g)??[],t=d.maxItems??100;o=(0,j.jsx)(F,{values:e,placeholder:d.placeholder,maxItems:t,disabled:!1===h,onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e}})}})}else if("creditRefundAllocations"===d.type){let e=Array.isArray(g)?g.flatMap(e=>"object"==typeof e&&"targetId"in e?[e]:[]):[];o=(0,j.jsx)(N,{values:e,spaceIdField:d.spaceIdField,impactedPeriodStartField:d.impactedPeriodStartField,impactedPeriodEndField:d.impactedPeriodEndField,disabled:!1===h,store:y,onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e}})}})}else if("promotionalCreditSource"===d.type)o=(0,j.jsx)(_,{label:C??(0,n().NZ)(c),value:"string"==typeof g?g:void 0,disabled:!1===h,allowEmpty:!0!==d.isRequired,onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e}})}});else if("json"===d.type){let e="string"==typeof g?g:"";o=(0,j.jsx)(a(913646).J,{value:e,disabled:!1===h,jsonSchema:d.jsonSchema,onChange:e=>{y.setState({response:void 0,inputValues:{...y.state.inputValues,[c]:e}})}})}else"section"===d.type?o=(0,j.jsx)(a(2825).b,{sections:[{key:c,title:d.name??(0,n().NZ)(c),content:(0,a(48697).WP)(d.components).map(([e,t])=>(0,j.jsx)(en,{schema:t,keyProp:e,index:p,firstInputRef:m,handleSubmitClick:u,hasPermission:h,store:y},e))}]}):(0,a(48697).HB)(d);return x?(0,j.jsxs)("div",{children:[(0,j.jsx)("div",{style:ei.style2,children:(0,j.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[C,"section"!==d.type&&void 0!==d.isRequired?(0,j.jsx)(a(324489).V,{isSmall:!0,style:d.isRequired?ei.requiredLabel:ei.optionalLabel,children:d.isRequired?"Required":"Optional"}):void 0]})}),d.comment?(0,j.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:ei.style3,children:d.comment}):void 0,o]},c):null}function er(e){let t=a(120011).DateTime.utc().startOf("day");return{min:void 0!==e.minDaysFromToday?t.plus({days:e.minDaysFromToday}).toISODate()??void 0:void 0,max:void 0!==e.maxDaysFromToday?t.plus({days:e.maxDaysFromToday}).toISODate()??void 0:void 0}}function es(e,t){if("string"==typeof e&&""!==e){if(void 0!==t.min&&e<t.min)return`Date must be on or after ${t.min}`;if(void 0!==t.max&&e>t.max)return`Date must be on or before ${t.max}`}}function eo(e,t){return void 0!==e&&t.some(t=>"string"==typeof t?t===String(e):String(t.value)===String(e))}function el(e,t){return void 0===e.visibleWhen||t[e.visibleWhen.field]===e.visibleWhen.value}function ed(e){var t,i,n;if("success"===e.type&&Array.isArray(null==(t=e.data)?void 0:t.rows)&&(null==(i=e.data)?void 0:i.rows.length)>0&&"string"==typeof(null==(n=e.data)?void 0:n.filename)){let{filename:t,rows:i}=e.data,n=Array.from(i.reduce((e,t)=>
106(Object.keys(t).forEach(t=>e.add(t)),e),new Set)),r=new Blob([(0,a(62935).L)({columns:n,rows:i})],{type:"data:text/csv"}),s=window.URL.createObjectURL(r),o=document.createElement("a");return o.download=t,o.href=s,o.click(),!0}return!1}function ec(e,t,a){let i=a?{[a.key]:a.value}:void 0;return t?{...e,...i,__adminUISource:t}:{...e,...i}}function ep(e,t){let i={},s=new Map;for(let l of((0,a(48697).WP)(t).forEach(([e,t])=>{"section"===t.type?(0,a(48697).WP)(t.components).forEach(([e,t])=>{s.set(e,t)}):(s.set(String(e),t),"creditRefundAllocations"===t.type&&(s.set(t.impactedPeriodStartField,{type:"date"}),s.set(t.impactedPeriodEndField,{type:"date"})))}),Object.keys(e))){var o;let t=e[l],a=s.get(l);if((void 0===a||(null==(o=a.visibleWhen)?void 0:o.field)===""||el(a,e))&&a)if(t===H)i[l]=void 0;else if("date"===a.type&&""===t)i[l]=void 0;else if((0,n().Kg)(t)&&"string"===a.type&&r().c_(t.trim())&&!a.skipUUIDNormalization)i[l]=r().np(t.trim());else if("options"===a.type)if(a.options.some(e=>"string"!=typeof e&&"number"==typeof e.value)&&(0,n().Kg)(t)){let e=Number(t);i[l]=Number.isNaN(e)?t:e}else i[l]=t;else if(Array.isArray(t)&&"multiselect"===a.type&&a.serializeAsCommaSeparatedString)i[l]=t.join(",")||void 0;else if(Array.isArray(t)&&"stringArray"===a.type)i[l]=t.flatMap(e=>{if("string"!=typeof e)return[];let t=e.trim();return""===t?[]:r().c_(t)?[r().np(t)]:[t]});else if(Array.isArray(t)&&"creditRefundAllocations"===a.type){let e=t.flatMap(e=>"object"==typeof e&&null!==e&&"targetId"in e&&e.creditAmount>0?[{targetId:e.targetId,creditAmount:e.creditAmount}]:[]);i[l]=e}else i[l]=t}return i}let em={textDecoration:"underline"};function eu({response:e}){var t;if(!e||"success"===e.type)return null;let i=(0,a(201790).V4)(e),n=(null==(t=e.body)||null==(t=t.clientData)?void 0:t.type)==="admin_tool_insufficient_permissions",r={color:a(632079).oZ.red,display:"inline-block",marginInlineStart:8};return 401!==e.status||n?(0,j.jsx)("div",{style:r,children:i}):(0,j.jsxs)("div",{style:r,children:[i,"Likely fixed by"," ",(0,j.jsx)(a(590422).Q,{style:em,href:a(168962).JZ.login,children:"signing in."})]})}function eh(e){return(0,a(48697).O)(a(604063).Jv,e.apiName)?a(604063).Jv[e.apiName]:void 0}function ey(e,t){let{defaultParams:a}=e,i={};for(let t of Object.keys(e.api.schema)){let n=e.api.schema[t];a&&a[t]?i[t]=a[t]:n&&void 0!==n.defaultValue?i[t]=n.defaultValue:i[t]=void 0}t.setState({inputValues:i})}async function eg({key:e,e:t,store:a,setFilename:i}){let n=t.target.files;if(!(null!=n&&n.length))return;let r=n[0],s=await r.text();i(r.name),a.setState({response:void 0,inputValues:{...a.state.inputValues,[e]:s}})}function ex({environment:e,apiDefinition:t,store:i,disableGlobalLoadingState:r,onLoadingStateChange:s,generatedRequestId:o,onRequestSuccess:l,submitConfirmationData:d={}}){var c;let p,{apiName:m,schema:u}=t,{inputValues:h}=i.state,y=function(e){let{eventName:t,data:a}=e;switch(t){case"adminGetExternalAgentSpecifications":return{...a,includeDetails:!1};case"adminResolveSanctionsAppeal":return"approve"===a.action?{...a,sendUserComms:!0}:a;case"adminGrantPromotionalNotionCredits":case"adminRevokePromotionalNotionCredits":if("single"===a.mode)return(0,n().cJ)(a,"csv");if("bulk"===a.mode)return(0,n().cJ)(a,"spaceId");return a;case"adminDiagnoseSkillSystemForUserInSpace":case"adminSummarizeSkillHealthInSpace":case"deleteBlockPropertiesStaleDataForWorkspace":return{...a,enqueueInQueue2:!0};default:return a}}({eventName:(c={eventName:m,normalizedValues:{...ep(h,u),...d},source:i.source,generatedRequestId:o}).eventName,data:ec(c.normalizedValues,c.source,c.generatedRequestId)});if(t.spaceCellRoutingField){let e=y[t.spaceCellRoutingField];if("string"!=typeof e||0===e.trim().length)throw Error("A workspace ID is required for space-cell routing");p={[a(255378).B3]:e}}r||a(262058).m({message:Y.loading}),null==s||s(!0),e.api.callApi({eventName:m,environment:e,data:y,headers:p}).then(e=>{let n=ed(e);if("success"===e.type&&o&&function(e){if(e.preserveOnDryRun&&"object"==typeof e.responseData&&null!==e.responseData&&"dryRun"in e.responseData&&e.responseData.dryRun)return!1;if(!e.preserveOnPartialFailure)return!0;
106if("object"!=typeof e.responseData||null===e.responseData||!("failure"in e.responseData))return!1;let t=e.responseData.failure;return"object"==typeof t&&null!==t&&0===Object.keys(t).length}({responseData:e.data,preserveOnPartialFailure:t.preserveGeneratedRequestIdOnPartialFailure,preserveOnDryRun:t.preserveGeneratedRequestIdOnDryRun})&&(null==l||l(o.value)),n){t.csvDownloadSuccessMessage&&(0,a(514164).oR)(t.csvDownloadSuccessMessage),i.setState({...i.state,confirmationResponse:void 0});return}i.setState({...i.state,confirmationResponse:void 0,response:e})}).finally(()=>{r||a(262058).V(),null==s||s(!1)})}function ef({environment:e,api:t,store:i,disableGlobalLoadingState:n,onLoadingStateChange:r,generatedRequestId:s,onRequestSuccess:o}){eh(t)?function({environment:e,apiDefinition:t,store:i,disableGlobalLoadingState:n,onLoadingStateChange:r,generatedRequestId:s}){let{schema:o}=t,{inputValues:l}=i.state,d=eh(t);if(!d)throw Error("Should not have gotten here without a confirmationApi");let c=ec(ep(l,o),i.source,s);n||a(262058).m({message:Y.loading}),null==r||r(!0),e.api.callApi({eventName:d,environment:e,data:c}).then(e=>{ed(e),i.setState({...i.state,confirmationResponse:e})}).finally(()=>{n||a(262058).V(),null==r||r(!1)})}({environment:e,apiDefinition:t,store:i,disableGlobalLoadingState:n,onLoadingStateChange:r,generatedRequestId:s}):function(e){let{submitConfirmation:t,inputValues:i,onSubmit:n}=e;if(!t||t.visibleWhen&&i[t.visibleWhen.field]!==t.visibleWhen.value)return n({});let r=e=>{n({[t.resultField]:e})};a(647095).ui({mode:"wide",message:t.message,description:t.description,showCancel:!1,keepFocus:!1,items:[{label:t.primaryAction.label,buttonType:"solid",onAccept:()=>r(t.primaryAction.value)},{label:t.secondaryAction.label,onAccept:()=>r(t.secondaryAction.value)}]})}({submitConfirmation:t.submitConfirmation,inputValues:i.state.inputValues,onSubmit:a=>{ex({environment:e,apiDefinition:t,store:i,disableGlobalLoadingState:n,onLoadingStateChange:r,generatedRequestId:s,onRequestSuccess:o,submitConfirmationData:a})}})}let eb={marginBottom:8},ev={marginTop:8,marginBottom:8},ej={marginTop:8,marginBottom:8,marginInlineStart:8},ek={prompt:{marginTop:12,marginBottom:4},disclaimer:{marginTop:12,marginBottom:4,padding:8,borderRadius:4,backgroundColor:a(632079).Tj.orange.background.primary,color:a(632079).Tj.orange.text.accentPrimary,fontWeight:a(699422).Wy.semibold}};function eS({response:e,api:t,store:n,generatedRequestId:r,onRequestSuccess:s}){var o,l;let d=(0,a(533992).v3)(),[c,p]=(0,i.useState)(""),m=t.typedConfirmation,u=m&&(null==e?void 0:e.type)==="success"?function(e,t){if("object"!=typeof e||null===e||!(0,a(48697).O)(e,t))return;let i=e[t];return"string"==typeof i?i:void 0}(e.data,m.expectedValueResponseKey):void 0,h=void 0===m||void 0!==u&&c.trim()===u,y=(0,i.useCallback)(()=>{if(h)return p(""),ex({environment:d,apiDefinition:t,store:n,generatedRequestId:r,onRequestSuccess:s})},[h,d,t,r,s,n]),g=(0,i.useCallback)(()=>(p(""),void n.setState({inputValues:n.state.inputValues})),[n]);return e&&"success"===e.type?(0,j.jsxs)(a(171849).a,{open:!0,innerStyle:z,onDismiss:g,transitionAppearance:"none",children:[(0,j.jsx)(a(324489).V,{isSmall:!m,isMultiline:!0,style:eb,children:m?m.description:"Does this information about the action you're about to take look good to you? Hit Confirm if it does. Cancel if not."}),(0,j.jsx)(a(503270).H,{data:e.data,ignoreUuidPreference:t.ignoreUuidPreference}),m?(0,j.jsxs)(j.Fragment,{children:[m.conditionalDisclaimer&&(o=e.data,l=m.conditionalDisclaimer.conditionResponseKey,"object"==typeof o&&null!==o&&(0,a(48697).O)(o,l)&&o[l])?(0,j.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:ek.disclaimer,children:m.conditionalDisclaimer.message}):null,(0,j.jsx)(a(324489).V,{isSmall:!0,isMultiline:!0,style:ek.prompt,children:`${m.inputLabel}: type "${u??""}" to confirm.`}),(0,j.jsx)(a(287562).p,{value:c,onChange:e=>{p(e.target.value)},onSubmit:y,inputElementAttributes:{autoFocus:!0,"aria-label":m.inputLabel}})]}):null,(0,j.jsx)(a(548436).A,{style:ev,size:"lg",onClick:y,disabled:!h,children:m?m.confirmButtonLabel:"Confirm"}),(0,j.jsx)(a(548436).A,{style:ej,size:"lg",onClick:g,children:"Cancel"})]}):null}function ew(e){if(Array.isArray(e))return e.flatMap(e=>"string"==typeof e?[e]:[])}function eI({response:e,adminAPIRequestProps:t,store:n,generatedRequestId:r,onRequestSuccess:o}){let{api:l,singleRecordMode:d,showByDefault:c}=t,p=(0,a(533992).v3)(),m=(0,i.useCallback)(()=>{var e,a,i;return e=l,a=t,void((i=n).state.response&&(!function(e){let{response:t}=e,a="success"===t.type&&"object"==typeof t.data&&null!==t.data&&"dryRun"in t.data&&!!t.data.dryRun;return"failed"===t.type||e.isReadOnly||!0===e.preserveOnSuccess||!0===e.preserveOnDryRun&&a}({response:i.state.response,isReadOnly:s[e.apiName],preserveOnSuccess:e.preserveInputValuesOnSuccess,preserveOnDryRun:e.preserveInputValuesOnDryRun})?ey(a,i):i.setState({inputValues:i.state.inputValues})))},[l,t,n]),u=(0,i.useCallback)(()=>ef({environment:p,api:l,store:n,disableGlobalLoadingState:t.disableGlobalLoadingState,generatedRequestId:r,onRequestSuccess:o}),[t.disableGlobalLoadingState,p,l,r,o,n]);if(!e||"success"!==e.type)return null;let h=(0,j.jsx)(eC,{adminAPIRequestProps:t,fillAvailableHeight:!c||!d,onReloadMain:u,response:e,mainContent:l.customResponseRenderer?(0,j.jsx)(l.customResponseRenderer,{data:e.data,environment:p,singleRecordMode:d}):(0,j.jsx)(a(243119).A,{data:e.data,ignoreUuidPreference:l.ignoreUuidPreference})});return c&&d?h:(0,j.jsx)(a(171849).a,{open:!!(e&&"success"===e.type),innerStyle:{...z,padding:0,overflow:"hidden"},onDismiss:m,transitionAppearance:"none",children:h})}function eC({adminAPIRequestProps:e,fillAvailableHeight:t,onReloadMain:n,response:r,mainContent:o}){let l=(0,i.useContext)(a(612002).G),d=(0,a(743187).g)(),{currentUserPermissions:c,fetchPermissionsErrored:p}=(0,a(579993).O$)(d),[m,u]=(0,i.useState)([]),[h,y]=(0,i.useState)([]),[g,x]=(0,i.useState)(),[f,b]=(0,i.useState)([]),[v,k]=(0,i.useState)("main");(0,i.useEffect)(()=>{u([]),y([]),x(void 0),b([]),k("main")},[e.api.apiName,r]);let S=(0,i.useCallback)(e=>{if(p)return!1;if(void 0===c)return;let t=a(688211)._P[e];return(0,a(688211).qO)(t)&&c.has((0,a(688211).JZ)(t))},[c,p]),w=(0,i.useCallback)(e=>{if(!s[a(688211)._P[e.toolName].apiName]||!0!==S(e.toolName))return;let t=function({toolName:e,args:t}){let a=Object.entries(t).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}=${t}`).join("&");return`${e}:${a}`}(e),i={...e,key:t,refreshNonce:0};if(0===m.length){y(a=>-1===a.findIndex(e=>e.key===t)?[...a,i]:a.map(a=>a.key===t?{...a,title:e.title}:a)),x(t);return}u(a=>-1===a.findIndex(e=>e.key===t)?[...a,i]:a.map(a=>a.key===t?{...a,title:e.title}:a)),k(t)},[S,m.length]),I=(0,i.useCallback)(e=>{u(t=>{let a=t.findIndex(t=>t.key===e);if(-1===a)return t;let i=t.filter(t=>t.key!==e);return k(t=>{if(t!==e)return t;let n=i[Math.min(a,i.length-1)];return(null==n?void 0:n.key)??"main"}),i}),b(t=>t.filter(t=>t!==e))},[]),C=(0,i.useCallback)(e=>{u(t=>t.map(t=>t.key===e?{...t,refreshNonce:t.refreshNonce+1}:t))},[]),D=(0,i.useCallback)((e,t)=>{b(a=>{let i=a.includes(e);return t?i?a:[...a,e]:i?a.filter(t=>t!==e):a})},[]),T=(0,i.useCallback)(e=>{var t;e&&0!==h.length&&(u(e=>{let t=[...e];for(let e of h){let a=t.findIndex(t=>t.key===e.key);-1===a?t.push(e):t[a]={...t[a],title:e.title}}return t}),k(g??(null==(t=h[h.length-1])?void 0:t.key)??"main"),y([]),x(void 0))},[g,h]),R=m.length>0||h.length>0,A=f.length>0,N=(0,i.useMemo)(()=>({canOpenAdminToolTab:S,openAdminToolTab:w}),[S,w]);return void 0!==l?o:(0,j.jsx)(a(612002).G.Provider,{value:N,children:(0,j.jsxs)("div",{style:t?G.root:void 0,children:[(0,j.jsx)(a(654979).A,{visible:R,style:G.tabBarAnimationContainer,initial:{height:0},animate:{height:65},exit:{height:0}
106,config:{duration:300,timingFunction:"ease-out"},onAnimationEnd:T,children:(0,j.jsxs)(a(4458).fI,{gap:4,flexWrap:"wrap",role:"tablist","aria-label":"Admin response tabs",style:G.tabBar,children:[(0,j.jsx)(eD,{isClosable:!1,isSelected:"main"===v,onReload:n,onSelect:()=>k("main"),tabId:"admin-response-tab-main",panelId:"admin-response-tabpanel-main",title:"Main"}),m.map((e,t)=>(0,j.jsx)(eD,{isClosable:!0,isSelected:v===e.key,onClose:()=>I(e.key),onReload:()=>C(e.key),onSelect:()=>k(e.key),tabId:`admin-response-tab-${t}`,panelId:`admin-response-tabpanel-${t}`,title:e.title},e.key)),(0,j.jsx)(a(654979).A,{visible:A,initial:{opacity:0,translateX:-6},animate:{opacity:+!!A,translateX:0},exit:{opacity:0,translateX:-6},config:{duration:160,timingFunction:"ease-out"},children:(0,j.jsx)("div",{style:G.tabBarSpinner,children:(0,j.jsx)(a(517334).k,{size:"xs"})})})]})}),(0,j.jsxs)("div",{style:t?G.contentArea:void 0,children:[(0,j.jsx)("div",{id:"admin-response-tabpanel-main",role:"tabpanel","aria-labelledby":"admin-response-tab-main",hidden:R&&"main"!==v,style:t?G.tabPanel:void 0,children:(0,j.jsx)("div",{style:t?G.tabPanelInner:void 0,children:o})}),m.map((a,i)=>(0,j.jsx)(eT,{fillAvailableHeight:t,isSelected:v===a.key,panelId:`admin-response-tabpanel-${i}`,permissionsStore:d,tab:a,tabId:`admin-response-tab-${i}`,onLoadingStateChange:e=>D(a.key,e),source:e.source},a.key))]})]})})}function eD(e){let{isClosable:t,isSelected:n,onClose:r,onReload:s,onSelect:o,panelId:l,tabId:d,title:c}=e,[p,m]=(0,i.useState)(!1),u=(0,i.useCallback)(()=>{m(!0)},[]),h=(0,i.useCallback)(()=>{m(!1)},[]),y=(0,i.useCallback)(e=>{let i=[{key:"reload",title:"Reload",action:()=>{e.close(),s()}},...t&&r?[{key:"close",title:"Close",action:()=>{e.close(),r()},isRedOnHover:!0}]:[]];return(0,j.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,children:(0,j.jsx)(a(558045).A,{type:a(558045).O.Vertical,initialFocus:void 0,sections:[{key:"actions",items:i.map(e=>({key:e.key,action:e.action,render:t=>(0,j.jsx)(a(95582).A,{...t,title:e.title,isRedOnHover:e.isRedOnHover})}))}]})})},[t,r,s]);return(0,j.jsx)(a(656252).d,{popupType:a(656252).z.Popup,placementToOrigin:"bottom",alignmentToOrigin:"start",originGap:4,disablePopup:!n,onOpen:u,onClose:h,content:y,children:e=>(0,j.jsx)(a(988022).p,{size:"lg",shape:"pill",role:"tab",id:d,"aria-controls":l,"aria-selected":n,colorVariant:n?"primary":"secondary",hovered:n||p,style:G.tabButton,onClick:t=>{o(),e.onClick(t)},children:(0,j.jsx)("span",{style:G.tabTitle,children:c})})})}function eT(e){let{fillAvailableHeight:t,isSelected:i,onLoadingStateChange:n,panelId:r,permissionsStore:s,source:o,tab:l,tabId:d}=e,c=(0,a(47602).S)(s,l.toolName),p=a(688211)._P[l.toolName];return(0,j.jsx)("div",{id:r,role:"tabpanel","aria-labelledby":d,hidden:!i,style:t?G.tabPanel:void 0,children:(0,j.jsx)("div",{style:t?G.tabPanelInner:void 0,children:(0,j.jsx)(a(654979).A,{initial:{opacity:0}
106,animate:{opacity:1},config:{duration:180,timingFunction:"ease-out"},style:G.tabPanelContentFade,children:(0,j.jsx)(ee,{api:p,defaultParams:l.args,showByDefault:!0,singleRecordMode:!0,hasPermission:c,disableGlobalLoadingState:!0,onLoadingStateChange:n,source:o},`${l.key}:${l.refreshNonce}`)})})})}},416236(e,t,a){a(435368),a(730330),a(976614),a(139583),a(974864),a(159952),a(765324);var i=a(635790),n=a(440302);let r=a(604063).wJ.flatMap(e=>[...a(604063).i8[e].tools]).sort();function s(e){let{selectedEventName:t,onSelect:s,onClose:o}=e,[l,d]=(0,i.useState)(""),[c,p]=(0,a(739271).s)(),m=(0,i.useCallback)(e=>{d(e.target.value)},[]),u=(0,i.useCallback)(()=>{d("")},[]),h=(0,i.useCallback)(e=>{s(e),o()},[o,s]),y=(0,i.useCallback)(e=>{let t=l.trim(),a=r.find(e=>e.toLowerCase()===t.toLowerCase()),i=r.some(e=>e.toLowerCase().includes(t.toLowerCase()));a?(e.preventDefault(),h(a)):t&&!i&&(e.preventDefault(),h(t))},[h,l]),g=(0,i.useMemo)(()=>{let e=l.trim(),i=e.toLowerCase(),s=r.filter(e=>e.toLowerCase().includes(i)),o=s.slice(0,50),d=r.some(e=>e.toLowerCase()===i),c=[];return e||c.push({key:"all-events",action:()=>h(void 0),render:e=>(0,n.jsx)(a(95582).A,{...e,title:"All events",caption:"Remove event filter",isChecked:void 0===t})}),e&&!d&&c.push({key:"custom-event",action:()=>h(e),render:i=>(0,n.jsx)(a(95582).A,{...i,title:`Use “${e}”`,caption:"Custom event name",isChecked:e===t})}),c.push(...o.map(e=>({key:`event-${e}`,action:()=>h(e),render:i=>(0,n.jsx)(a(95582).A,{...i,title:e,isChecked:e===t})}))),s.length>o.length&&c.push({key:"more-events",action:()=>{},render:e=>(0,n.jsx)(a(95582).A,{...e,title:`Showing first ${o.length} of ${s.length} matches`,caption:"Type more to narrow the list",disabled:!0})}),[{key:"events",render:t=>(0,n.jsx)(a(83743).A,{...t,title:e?"Matching events":"Event types"}),items:c}]},[h,l,t]);return(0,n.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,width:360,maxHeight:400,header:(0,n.jsx)(a(83743).A,{isInput:!0,children:(0,n.jsx)(a(310324).Ay,{...c,inputLeft:(0,n.jsx)(a(310324).Zf,{icon:a(921048).magnifyingGlassSmallIcon}),value:l,onChange:m,onSubmit:y,onClearButtonClick:u,showClearButton:l.length>0,focus:!0,focusAfterAnimation:!0,placeholder:"Search or enter event name…",inputElementAttributes:{...c.inputElementAttributes,"aria-label":"Search event names"}})}),children:(0,n.jsx)(a(558045).A,{type:a(558045).O.Vertical,role:"listbox",comboboxProps:p,initialFocus:0,sections:g})})}let o={maxWidth:280},l={maxWidth:200,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},d={maxWidth:240,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};function c(e){let{onChange:t,variant:r}=e,[c,p]=(0,i.useState)(void 0),m=(0,i.useId)(),u=(0,i.useId)(),h=(0,i.useCallback)(e=>{p(e),t(e)},[t]),y=(0,n.jsx)(a(656252).d,{popupType:a(656252).z.Popup,alignmentToOrigin:"start",originGap:4,borderRadius:10,content:e=>(0,n.jsx)(s,{selectedEventName:c,onSelect:h,onClose:e.close}),children:e=>"inlineSelect"===r?(0,n.jsx)(a(548436).A,{...e,size:"sm",style:o,hasSolidBackground:!0,colorPalette:c?"blue":void 0,iconLeading:a(921048).magnifyingGlassSmallIcon,iconTrailing:a(595453).arrowChevronSingleDownSmallIcon,"aria-labelledby":`${m} ${u}`,children:(0,n.jsx)("span",{id:u,style:l,title:c,children:c??"All types"})}):(0,n.jsx)(a(265779).E,{...e,size:"sm",shape:"pill",colorPalette:c?"blue":void 0,iconTrailing:{icon:a(595453).arrowChevronSingleDownSmallIcon,size:"xs"},children:(0,n.jsx)("span",{style:d,title:c,children:c?`Event: ${c}`:"Event: All events"})})});return"inlineSelect"===r?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{id:m,styleKey:"captionSm",colorVariant:"secondary",children:"Event type:"}),y]}):(0,n.jsx)(a(4458).fI,{marginBottom:12,children:y})}a.d(t,{_:()=>c})},2081(e,t,a){a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(159952);var i=a(635790),n=a(440302);let r={entry:{paddingTop:10,paddingBottom:10,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},eventBadge:{display:"inline-block",paddingTop:2,paddingBottom:2,paddingInlineStart:6,paddingInlineEnd:6,borderRadius:4,backgroundColor:a(632079).Tj.background.tertiary,fontFamily:"monospace",whiteSpace:"nowrap"},targetBadge:{display:"inline-block",paddingTop:2,paddingBottom:2,paddingInlineStart:6,paddingInlineEnd:6,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary},rawJson:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary,padding:8,borderRadius:4,overflowX:"auto",maxHeight:240,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"monospace"},detailPanel:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary}};function s(e){let t=(0,a(327219).tz)(),{adminUser:i,adminUserId:r,fallbackAdminActorName:s}=e,o=function(e){let{intl:t,adminUser:i,adminUserId:n,fallbackAdminActorName:r}=e;return i?(0,a(197018).lR)(t,(0,a(197018).A7)(i)):n===a(514214).BF.id?"NotionAdminProcess":r||(n?`Unknown user: ${n}`:"Unknown user")}({intl:t,adminUser:i,adminUserId:r,fallbackAdminActorName:s});return(0,n.jsx)("span",{children:o})}function o(e){let{label:t,value:i}=e;return(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:t}),(0,n.jsx)(a(799615).B,{value:i,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"primary",children:(0,n.jsx)(a(137691).x5,{value:i})})})]})}function l(e){let{target:t}=e;if("workspace"===t.type)return(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Target"}),(0,n.jsx)("span",{style:r.targetBadge,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Worksp
106ace"})})]});let i="page"===t.type?t.pageIds:t.blockIds,s="page"===t.type?"Page":"Block",l="page"===t.type?"Pages":"Blocks";return(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Target"}),(0,n.jsx)("span",{style:r.targetBadge,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:1===i.length?s:l})})]}),i.map(e=>(0,n.jsx)(o,{label:`${s} ID`,value:e},e))]})}function d(e){let{formattedJson:t}=e;return(0,n.jsx)("pre",{style:r.rawJson,children:t})}function c(e){let{isExpanded:t,onToggleExpanded:i,detailPanelId:r}=e;return(0,n.jsx)(a(988022).p,{size:"sm",colorPalette:"gray",iconLeading:t?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,onClick:i,"aria-expanded":t,"aria-controls":r,children:t?"Hide details":"Details"})}function p(e){var t;let{entry:i,recordMapJson:s,detailPanelId:o}=e,l=JSON.stringify(t={apiLog:i.apiLog,adminUser:i.adminUser,opLogs:i.opLogs??[],opLogCount:i.opLogCount,target:i.target,recordMap:s},null,2)??String(t);return(0,n.jsxs)(a(4458).VP,{id:o,gap:4,padding:8,style:r.detailPanel,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"Full admin log JSON"}),(0,n.jsx)(a(799615).B,{value:l,ariaLabel:"Copy full admin log JSON",children:(0,n.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,n.jsx)(a(16275).I,{icon:a(967335).i,size:"xs",colorVariant:"secondary"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Copy JSON"})]})})]}),(0,n.jsx)(d,{formattedJson:l})]})}function m(e){var t;let{entry:d,entryId:m,isExpanded:u,onToggleExpanded:h,onLoadMoreOperations:y,isLoadingOperations:g,recordMapJson:x,fallbackAdminActorName:f,detailPanelId:b}=e,{apiLog:v,adminUser:j}=d,k=d.opLogs??[],S=d.opLogCount??k.length,w=(0,i.useCallback)(()=>{h(m)},[m,h]),I=(0,i.useCallback)(()=>{null==y||y(m,k.length)},[m,y,k.length]);return(0,n.jsx)("div",{style:r.entry,children:(0,n.jsxs)(a(4458).VP,{gap:8,children:[v?(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",minWidth:0,flexGrow:1,flexWrap:"wrap",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:new Date((t=v.timestamp)<1e12?1e3*t:t).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),(0,n.jsx)("span",{style:r.eventBadge,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"primary",children:v.event_name})})]}),(0,n.jsx)(c,{isExpanded:u,onToggleExpanded:w,detailPanelId:b})]}),(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["executed by ",(0,n.jsx)(s,{adminUser:j,adminUserId:v.admin_user_id,fallbackAdminActorName:f})]}),(0,n.jsxs)(a(4458).VP,{gap:4,minWidth:0,children:[(0,n.jsx)(o,{label:"Request ID",value:v.id}),(0,n.jsx)(a(810198).Z,{params:v.params,adminUserId:v.admin_user_id}),v.admin_user_id?(0,n.jsx)(o,{label:"Admin user ID",value:v.admin_user_id}):void 0]})]}):(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Missing admin API request metadata"}),(0,n.jsx)(c,{isExpanded:u,onToggleExpanded:w,detailPanelId:b})]}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",flexWrap:"wrap",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:1===S?"1 database operation":`${S} database operations`}),S>k.length?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:0===k.length?"Operations load on demand":`Showing first ${k.length}`}),y?(0,n.jsx)(a(988022).p,{size:"sm",onClick:I,disabled:g,children:g?"Loading...":0===k.length?"Load operations":"Load more operations"}):void 0]}):void 0,(null==v?void 0:v.params)!==void 0?(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Includes request params"}):void 0]}),d.target?(0,n.jsx)(l,{target:d.target}):void 0,u?(0,n.jsx)(p,{entry:d,recordMapJson:x,detailPanelId:b}):void 0]})})}
106function u(e){let{entries:t,recordMapJson:r,fallbackAdminActorName:s,onLoadMoreOperations:o,loadingOperationRequestIds:l}=e,d=(0,i.useId)(),[c,p]=(0,i.useState)(new Set),u=(0,i.useCallback)(e=>{p(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]);return(0,n.jsx)(a(4458).VP,{gap:0,children:t.map((e,t)=>{var a;let i=(null==(a=e.apiLog)?void 0:a.id)??`entry-${t}`;return(0,n.jsx)(m,{entry:e,entryId:i,isExpanded:c.has(i),onToggleExpanded:u,onLoadMoreOperations:o,isLoadingOperations:(null==l?void 0:l.has(i))??!1,recordMapJson:r,fallbackAdminActorName:s,detailPanelId:`${d}-admin-api-log-details-${t}`},i)})})}a.d(t,{k:()=>u})},279827(e,t,a){a(435368),a(730330),a(139583),a(159952);var i=a(635790),n=a(440302);let r={toggleLink:{paddingInlineStart:5,cursor:"pointer",color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",fontSize:"small"},style0:{marginTop:4,marginBottom:8}};function s(e){let[t,s]=i.useState(!1),{title:o,items:l,renderItem:d}=e;return(0,n.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,style:r.style0,children:[o,": ",(l||[]).length,(0,n.jsxs)("span",{style:r.toggleLink,children:[t?void 0:(0,n.jsx)("a",{onClick:()=>s(!0),children:"(show)"}),t?(0,n.jsx)("a",{onClick:()=>s(!1),children:"(hide)"}):void 0]}),t&&l?(0,n.jsx)("ul",{children:l.map(d)}):void 0]})}function o(e){return(0,n.jsx)(s,{title:e.title,items:e.users,renderItem:e=>(0,n.jsxs)("li",{children:[(0,n.jsx)(a(553775).uQ,{user:e}),(0,n.jsx)(l,{user:e})]},e.id)})}function l(e){let{user:t}=e,a=[];return(void 0!==t.billing_exempt&&a.push(`billing_exempt: ${String(t.billing_exempt)}`),void 0!==t.expiration_time&&a.push(`expiration_time: ${t.expiration_time}`),0===a.length)?null:(0,n.jsxs)(n.Fragment,{children:[" (",a.join(", "),")"]})}function d(e){return(0,n.jsx)(s,{title:e.title,items:e.bots,renderItem:e=>{var t;return(0,n.jsxs)("li",{children:[e.name||"unnamed","created by"," ",(0,n.jsx)("strong",{children:(0,n.jsx)(a(137691).x5,{value:(null==(t=e.createdBy)?void 0:t.id)||""})})," ","on",e.createdAt,", type:",e.type]},e.id)}})}function c({teams:e,settings:t}){let i,[r,o]=(0,a(960408).jB)(e,e=>e.isArchived),l=(i=[],t.is_teams_enabled&&0===o.length&&i.push("This space has no active teams but Space.settings.is_teams_enabled=true"),o.length>0&&!t.is_teams_enabled&&i.push("This space has 1+ active teams but Space.settings.is_teams_enabled=false"),o.length>0&&!o.find(e=>e.isDefault)&&i.push("This space has 1+ active teams but no default team"),i),d=e=>(0,n.jsx)("li",{children:(0,n.jsx)(a(553775).cw,{team:e})},e.id);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(s,{title:"Active teamspaces",items:o,renderItem:d}),(0,n.jsx)(s,{title:"Archived teamspaces",items:r,renderItem:d}),(0,n.jsx)(a(553775).i$,{warnings:l})]})}let p={color:"red"},m={marginTop:12,marginBottom:4};function u(e){let{data:t,singleRecordMode:i}=e,r=t.users?(0,a(960408).$z)(t.users,"role"):void 0;return(0,n.jsxs)(n.Fragment,{children:[i?(0,n.jsx)(a(45062).A,{title:`Notion Space Admin: ${t.name}`}):void 0,(0,n.jsxs)("h2",{children:[t.name," ",(0,n.jsx)(a(137691).x5,{value:t.id}),t.isDeleted?(0,n.jsx)("span",{style:p,children:" DELETED"}):void 0,t.isSanctioned?(0,n.jsxs)("span",{style:p,children:[" ","SANCTIONED"]}):void 0]}),(0,n.jsxs)("div",{children:["Created By: ",(0,n.jsx)(a(553775).uQ,{user:t.createdBy})," on"," ",t.createdTime]}),t.isDeleted?(0,n.jsxs)("div",{children:["Deleted On: ",t.lastEditedTime]}):void 0,t.scheduledForDeletion?(0,n.jsxs)("div",{children:["Scheduled for permanent deletion on: ",t.scheduledForDeletion]}):void 0,(0,n.jsxs)("div",{children:["Cell Id: ",t.cellId]}),t.organizationId?(0,n.jsxs)("div",{children:["Organization: ",(0,n.jsx)(a(137691).x5,{value:t.organizationId})]}):void 0,(0,n.jsxs)("div",{children:["Workers: ",(0,a(626802).s)(t.config.workers)]}),(0,n.jsxs)("div",{children:["Worker creation: ",(0,a(626802).X)(t.config.workers)]}),(0,a(573143).S3)(t.rawSettings.space_request)?(0,n.jsx)("div",{style:p,children:"This workspace is in read-only mode because of a workspace consolidation."}):void 0,(0,n.jsxs)("div",{children:[r?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:m,children:"Users by Role"}),(0,n.jsx)(o,{title:"Owners",users:r.owner}),(0,n.jsx)(o,{title:"Membership admins",users:r.membership_admin}),(0,n.jsx)(o,{title:"Members",users:r.member}),(0,n.jsx)(o,{title:"Restricted Members",users:r.restricted_member}),(0,n.jsx)(o,{title:"Guests",users:r.page_guest}),(0,n.jsx)(d,{title:"Bots",bots:t.bots})]}):(0,n.jsxs)("div",{children:[(0,n.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Users: ",t.userCount]}),(0,n.jsxs)(a(324489).V,{isSmall:!0,isMultiline:!0,children:["Bots: ",t.botCount]})]}),t.teams?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{children:"Teamspaces"}),(0,n.jsx)(c,{teams:t.teams,settings:t.settings})]}):void 0,t.billing.isSubscribed?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:m,children:"Billing"}),(0,n.jsx)(a(243119).A,{hideHelp:!0,data:t.billing})]}):void 0,t.spaceRequest?(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:m,children:"Space Request"}),(0,n.jsx)(a(243119).A,{hideHelp:!0,data:t.spaceRequest})]}):void 0]}),(0,n.jsxs)("div",{children:["Full Response",(0,n.jsx)(a(243119).A,{data:t,hideHelp:!0})]})]})}a.d(t,{$:()=>u,ft:()=>s})},56518(e,t,a){a(159952),a(635790);var i=a(440302);let n={section:{display:"flex",flexDirection:"column",gap:8,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,padding:16},sectionTitle:{fontSize:16,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:4},fieldRow:{display:"flex",gap:8,fontSize:13,lineHeight:"1.5"},fieldLabel:{fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary,minWidth:140,flexShrink:0},fieldValue:{color:a(632079).Tj.text.primary,fontFamily:"monospace",fontSize:12,wordBreak:"break-all"},healthBadge:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.medium},healthError:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.primary},healthWarning:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.primary},healthHealthy:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.primary},healthDisabled:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.tertiary},taskTable:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},taskTableHeader:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 1fr)",alignItems:"center",paddingBlock:10,paddingInline:14,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontSize:11,fontWeight:a(699422).Wy.medium,textTransform:"uppercase",letterSpacing:.4,gap:10},taskRow:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 1fr) minmax(0, 0.6fr) minmax(0, 1fr)",alignItems:"center",paddingBlock:10,paddingInline:14,backgroundColor:a(632079).Tj.background.primary,gap:10,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},taskCell:{fontSize:12,color:a(632079).Tj.text.primary,overflow:"hidden",textOverflow:"ellipsis"},errorText:{color:a(632079).Tj.red.text.primary,fontSize:11,fontFamily:"monospace",wordBreak:"break-all"},checkItem:{padding:8,borderRadius:4,backgroundColor:a(632079).Tj.background.secondary,marginBottom:4},checkSlug:{fontSize:12,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary},checkDescription:{fontSize:11,color:a(632079).Tj.text.secondary},headerCell:{textAlign:"start"}};function r(e){switch(e){case"error":return{...n.healthBadge,...n.healthError};case"warning":return{...n.healthBadge,...n.healthWarning};case"healthy":return{...n.healthBadge,...n.healthHealthy};default:return{...n.healthBadge,...n.healthDisabled}}}function s(e){return void 0===e?"—":new Date(e).toISOString()}function o(e){let{data:t}=e,{sync:o,credential:l,tasks:d,health:c}=t;return(0,i.jsxs)(a(4458).VP,{gap:24,children:[(0,i.jsxs)("div",{style:n.section,children:[(0,i.jsx)("div",{style:n.sectionTitle,children:"Sync Record"}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"ID"}),(0,i.jsx)("span",{style:n.fieldValue,children:(0,i.jsx)(a(137691).x5,{value:o.id})})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Space ID"}),(0,i.jsx)("span",{style:n.fieldValue,children:(0,i.jsx)(a(137691).x5,{value:o.spaceId})})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Source"}),(0,i.jsx)("span",{style:n.fieldValue,children:o.sourceKey})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Schedule"}),(0,i.jsx)("span",{style:n.fieldValue,children:function(e){if("continuous"===e.type)return"continuous";if("interval"===e.type&&e.intervalMs){let t=Math.round(e.intervalMs/6e4);return`interval (${t}m)`}return JSON.stringify(e)}(o.schedule)})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Concurrency"}),(0,i.jsx)("span",{style:n.fieldValue,children:o.concurrencyLimit})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Disabled"}),(0,i.jsx)("span",{style:n.fieldValue,children:o.disabled?"Yes":"No"})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Credential ID"}),(0,i.jsx)("span",{style:n.fieldValue,children:(0,i.jsx)(a(137691).x5,{value:o.credentialId})})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Collections"}),(0,i.jsx)("span",{style:n.fieldValue,children:JSON.stringify(o.destinationMapping.collections)})]})]}),(0,i.jsxs)("div",{style:n.section,children:[(0,i.jsx)("div",{style:n.sectionTitle,children:"Credential"}),l?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"ID"}),(0,i.jsx)("span",{style:n.fieldValue,children:(0,i.jsx)(a(137691).x5,{value:l.id})})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Provider"}),(0,i.jsx)("span",{style:n.fieldValue,children:l.provider||"—"})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Display Name"}),(0,i.jsx)("span",{style:n.fieldValue,children:l.displayName||"—"})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Created"}),(0,i.jsx)("span",{style:n.fieldValue,children:s(l.createdTime)})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Last Edited"}),(0,i.jsx)("span",{style:n.fieldValue,children:s(l.lastEditedTime)})]})]}):(0,i.jsx)("div",{style:n.fieldValue,children:"(not found)"})]}),(0,i.jsxs)("div",{style:n.section,children:[(0,i.jsx)("div",{style:n.sectionTitle,children:"Health"}),c?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Status"}),(0,i.jsx)("span",{style:r(c.status),children:c.status})]}),(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Computed At"}),(0,i.jsx)("span",{style:n.fieldValue,children:s(c.computedAt)})]}),c.missingResources.length>0?(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:"Missing Resources"}),(0,i.jsx)("span",{style:n.errorText,children:c.missingResources.join(", ")})]}):void 0,Object.entries(c.tasks).map(([e,t])=>(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{style:n.fieldRow,children:[(0,i.jsx)("span",{style:n.fieldLabel,children:e}),(0,i.jsx)("span",{style:r(t.status),children:t.status})]}),t.checks.map(e=>(0,i.jsxs)("div",{style:n.checkItem,children:[(0,i.jsxs)("div",{style:n.checkSlug,children:[e.slug," ",(0,i.jsx)("span",{style:r(e.status),children:e.status})]}),(0,i.jsx)("div",{style:n.checkDescription,children:e.description}),e.error?(0,i.jsx)("div",{style:n.errorText,children:e.error}):void 0]},e.slug))]},e))]}):(0,i.jsx)("div",{style:n.fieldValue,children:"(no health snapshot available)"})]}),(0,i.jsxs)("div",{style:n.section,children:[(0,i.jsxs)("div",{style:n.sectionTitle,children:["Tasks (",d.length,")"]}),d.length>0?(0,i.jsxs)("div",{style:n.taskTable,children:[(0,i.jsxs)("div",{style:n.taskTableHeader,children:[(0,i.jsx)("div",{style:n.headerCell,children:"Task Key"}),(0,i.jsx)("div",{style:n.headerCell,children:"Resources"}),(0,i.jsx)("div",{style:n.headerCell,children:"Status"}),(0,i.jsx)("div",{style:n.headerCell,children:"Last Run"}),(0,i.jsx)("div",{style:n.headerCell,children:"Failures"}),(0,i.jsx)("div",{style:n.headerCell,children:"Cycle Stats"})]}),d.map(e=>{let t=void 0!==e.claimedAt,a=Date.now(),r="ready";return t&&void 0!==e.claimedAt&&(r=a-e.claimedAt>3e5?"timed out":"claimed"),(0,i.jsxs)("div",{style:n.taskRow,children:[(0,i.jsx)("div",{style:n.taskCell,children:e.taskKey}),(0,i.jsx)("div",{style:n.taskCell,children:e.resourceNames.join(", ")}),(0,i.jsx)("div",{style:n.taskCell,children:r}),(0,i.jsx)("div",{style:n.taskCell,children:s(e.stats.lastSucceededAt)}),(0,i.jsx)("div",{style:n.taskCell,children:e.stats.consecutiveFailureCount>0?e.stats.consecutiveFailureCount:"—"}),(0,i.jsxs)("div",{style:n.taskCell,children:[e.stats.cycleUpsertsProcessed,"u /"," ",e.stats.cycleDeletesProcessed,"d"]})]},e.taskKey)})]}):(0,i.jsx)("div",{style:n.fieldValue,children:"(no tasks — sync has not been initialized yet)"})]})]})}a.d(t,{_:()=>o})},862582(e,t,a){a(159952),a(635790);var i=a(440302);let n={spaceName:{fontSize:18,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},spaceIdLabel:{fontSize:12,color:a(632079).Tj.text.tertiary},userSpacesSection:{marginTop:8,padding:12,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},userSpacesTitle:{fontSize:14,fontWeight:a(699422).Wy.medium,marginBottom:8,color:a(632079).Tj.text.secondary},userSpaceItem:{fontSize:12,color:a(632079).Tj.text.secondary},userSpaceLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer"},syncsTable:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},tableHeader:{display:"grid",gridTemplateColumns:"280px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 0.6fr) minmax(0, 0.6fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium,textTransform:"uppercase",letterSpacing:.4,gap:12},tableBody:{display:"flex",flexDirection:"column",maxHeight:400,overflowY:"auto"},row:{display:"grid",gridTemplateColumns:"280px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.8fr) minmax(0, 0.8fr) minmax(0, 0.6fr) minmax(0, 0.6fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.primary,gap:12},rowDivider:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},cell:{fontSize:13,color:a(632079).Tj.text.primary,overflow:"hidden",textOverflow:"ellipsis"},syncIdCell:{fontSize:12,fontFamily:"monospace",color:a(632079).Tj.text.primary,wordBreak:"break-all"},detailLink:{fontSize:12,fontFamily:"monospace",color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer"},healthBadge:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.medium},healthError:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.primary},healthWarning:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.primary},healthHealthy:{backgroundColor:a(632079).Tj.green.background.primary,color:a(632079).Tj.green.text.primary},healthDisabled:{backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.tertiary},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary,fontSize:14},headerCell:{textAlign:"start"}};function r(e){let{data:t}=e;return t.redirectToDetail?(0,i.jsx)(a(4458).VP,{gap:16,children:(0,i.jsxs)("div",{style:n.emptyState,children:["Sync found!"," ",(0,i.jsx)("a",{href:`${a(168962).JZ.admin}/syn
106cs/detail/${t.redirectToDetail.spaceId}/${t.redirectToDetail.syncId}`,style:n.detailLink,children:"View sync detail"})]})}):(0,i.jsxs)(a(4458).VP,{gap:16,children:[(0,i.jsxs)(a(4458).VP,{gap:4,children:[(0,i.jsx)("div",{style:n.spaceName,children:t.spaceName||"Workspace"}),(0,i.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,i.jsx)("span",{style:n.spaceIdLabel,children:"Space ID:"}),(0,i.jsx)(a(137691).x5,{value:t.spaceId})]})]}),t.userSpaces&&t.userSpaces.length>1?(0,i.jsxs)("div",{style:n.userSpacesSection,children:[(0,i.jsxs)("div",{style:n.userSpacesTitle,children:["User is a member of ",t.userSpaces.length," workspaces:"]}),(0,i.jsx)(a(4458).VP,{gap:4,children:t.userSpaces.map(e=>(0,i.jsxs)("div",{style:n.userSpaceItem,children:[(0,i.jsx)("a",{href:`${a(168962).JZ.admin}/syncs?spaceId=${encodeURIComponent(e.spaceId)}`,style:n.userSpaceLink,children:e.spaceName||e.spaceId}),e.spaceId===t.spaceId?" (current)":""]},e.spaceId))})]}):void 0,(0,i.jsxs)(a(324489).V,{isSmall:!0,children:["Found ",t.syncs.length," sync",1!==t.syncs.length?"s":""]}),t.syncs.length>0?(0,i.jsxs)("div",{style:n.syncsTable,children:[(0,i.jsxs)("div",{style:n.tableHeader,children:[(0,i.jsx)("div",{style:n.headerCell,children:"Sync ID"}),(0,i.jsx)("div",{style:n.headerCell,children:"Source"}),(0,i.jsx)("div",{style:n.headerCell,children:"Schedule"}),(0,i.jsx)("div",{style:n.headerCell,children:"Health"}),(0,i.jsx)("div",{style:n.headerCell,children:"Tasks"}),(0,i.jsx)("div",{style:n.headerCell,children:"Disabled"}),(0,i.jsx)("div",{style:n.headerCell,children:"Actions"})]}),(0,i.jsx)("div",{style:n.tableBody,children:t.syncs.map((e,r)=>{let s=r===t.syncs.length-1?n.row:{...n.row,...n.rowDivider};return(0,i.jsxs)("div",{style:s,children:[(0,i.jsx)("div",{style:n.syncIdCell,children:e.syncId}),(0,i.jsx)("div",{style:n.cell,children:e.sourceKey}),(0,i.jsx)("div",{style:n.cell,children:e.schedule}),(0,i.jsx)("div",{children:(0,i.jsx)("span",{style:function(e){switch(e){case"error":return{...n.healthBadge,...n.healthError};case"warning":return{...n.healthBadge,...n.healthWarning};case"healthy":return{...n.healthBadge,...n.healthHealthy};default:return{...n.healthBadge,...n.healthDisabled}}}(e.healthStatus),children:e.healthStatus||"unknown"})}),(0,i.jsx)("div",{style:n.cell,children:e.taskCount??"—"}),(0,i.jsx)("div",{style:n.cell,children:e.disabled?"Yes":"No"}),(0,i.jsx)("div",{children:(0,i.jsx)("a",{href:`${a(168962).JZ.admin}/syncs/detail/${e.spaceId}/${e.syncId}`,style:n.detailLink,children:"Detail"})})]},e.syncId)})})]}):(0,i.jsx)("div",{style:n.emptyState,children:"No syncs found in this workspace"})]})}a.d(t,{s:()=>r})},850471(e,t,a){a(159952),a(635790);var i=a(440302);let n={disabledByAdmin:"Paused by Notion",disabledByWorkspaceOwner:"Paused by workspace owner",disabledByWorkerEditor:"Paused by editor"},r={spaceName:{fontSize:18,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},spaceIdLabel:{fontSize:12,color:a(632079).Tj.text.tertiary},userSpacesSection:{marginTop:8,padding:12,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8},userSpacesTitle:{fontSize:14,fontWeight:a(699422).Wy.medium,marginBottom:8,color:a(632079).Tj.text.secondary},userSpaceItem:{fontSize:12,color:a(632079).Tj.text.secondary},userSpaceLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer"},workersTable:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},tableHeader:{display:"grid",gridTemplateColumns:"minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.8fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium,textTransform:"uppercase",letterSpacing:.4,gap:12},tableBody:{display:"flex",flexDirection:"column",maxHeight:400,overflowY:"auto"},row:{display:"grid",gridTemplateColumns:"minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.8fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.primary,gap:12},rowDivider:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},workerName:{fontSize:14,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary,wordBreak:"break-word"},workerId:{fontFamily:"monospace",fontSize:11,color:a(632079).Tj.text.secondary,overflow:"hidden",textOverflow:"ellipsis"},ownerId:{fontFamily:"monospace",fontSize:11,color:a(632079).Tj.text.secondary,overflow:"hidden",textOverflow:"ellipsis"},ownerEmail:{fontSize:12,color:a(632079).Tj.text.secondary,overflow:"hidden",textOverflow:"ellipsis"},ownerLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer",fontSize:11,fontFamily:"monospace"},createdAt:{fontSize:12,color:a(632079).Tj.text.secondary},detailLink:{fontSize:12,color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer"},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary,fontSize:14},headerCell:{textAlign:"start"}};function s(e){let{data:t}=e;return(0,i.jsxs)(a(4458).VP,{gap:16,children:[(0,i.jsxs)(a(4458).VP,{gap:4,children:[(0,i.jsx)("div",{style:r.spaceName,children:t.spaceName||"Workspace"}),(0,i.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,i.jsx)("span",{style:r.spaceIdLabel,children:"Space ID:"}),(0,i.jsx)(a(137691).x5,{value:t.spaceId})]})]}),t.userSpaces&&t.userSpaces.length>1?(0,i.jsxs)("div",{style:r.userSpacesSection,children:[(0,i.jsxs)("div",{style:r.userSpacesTitle,children:["User is a member of ",t.userSpaces.length," workspaces:"]}),(0,i.jsx)(a(4458).VP,{gap:4,children:t.userSpaces.map(e=>(0,i.jsxs)("div",{style:r.userSpaceItem,children:[(0,i.jsx)("a",{href:`${a(168962).JZ.admin}/workers?spaceId=${encodeURIComponent(e.spaceId)}`,style:r.userSpaceLink,children:e.spaceName||e.spaceId}),e.spaceId===t.spaceId?" (current)":""]},e.spaceId))})]}):void 0,(0,i.jsxs)(a(111010).D,{styleKey:"bodySm",children:["Found ",t.workers.length," worker",1!==t.workers.length?"s":""]}),t.workers.length>0?(0,i.jsxs)("div",{style:r.workersTable,children:[(0,i.jsxs)("div",{style:r.tableHeader,children:[(0,i.jsx)("div",{style:r.headerCell,children:"Name"}),(0,i.jsx)("div",{style:r.headerCell,children:"Worker ID"}),(0,i.jsx)("div",{style:r.headerCell,children:"Owner ID"}),(0,i.jsx)("div",{style:r.headerCell,children:"Owner Email"}),(0,i.jsx)("div",{style:r.headerCell,children:"Status"}),(0,i.jsx)("div",{style:r.headerCell,children:"Created"}),(0,i.jsx)("div",{style:r.headerCell,children:"Actions"})]}
106),(0,i.jsx)("div",{style:r.tableBody,children:t.workers.map((e,s)=>{let o,l=new Date(e.createdAt).getTime(),d=s===t.workers.length-1?r.row:{...r.row,...r.rowDivider};return(0,i.jsxs)("div",{style:d,children:[(0,i.jsx)("div",{style:r.workerName,children:e.name}),(0,i.jsx)("div",{style:r.workerId,title:e.workerId,children:e.workerId}),(0,i.jsx)("div",{style:r.ownerId,children:e.ownerUserId?(0,i.jsxs)("a",{href:`${a(168962).JZ.admin}/find#adminSearchUsers?userId=${e.ownerUserId}`,style:r.ownerLink,title:e.ownerUserId,children:[e.ownerUserId.slice(0,8),"..."]}):"—"}),(0,i.jsx)("div",{style:r.ownerEmail,title:e.ownerUserEmail,children:e.ownerUserEmail||"—"}),(0,i.jsx)("div",{children:function(e){switch(e.status.type){case"deleting":return"Deleting";case"paused":return n[e.status.reason];case"enabled":return"Enabled"}}(e)}),(0,i.jsx)("div",{style:r.createdAt,children:(0,a(497491).nl)(l)}),(0,i.jsx)("div",{children:(0,i.jsx)("a",{href:(o=e.workerId,`${a(168962).JZ.admin}/workers/detail/${t.spaceId}/${o}`),style:r.detailLink,children:"View details"})})]},e.workerId)})})]}):(0,i.jsx)("div",{style:r.emptyState,children:"No workers found in this workspace"})]})}a.d(t,{V:()=>s})},318793(e,t,a){a.r(t),a.d(t,{default:()=>M}),a(159952);var i=a(635790);let n=[{action:"badWords",title:"Bad Words",description:"Notion domains are not allowed to have these words present anywhere in the string"},{action:"temporaryPasswordWordList",title:"Temporary password word list / dothraki dictionary",description:"Word list used to generate temporary notion passwords"},{action:"disallowedSpaceDomains",title:"Disallowed Space Domains",description:"Notion domains are not allowed to exactly match anything on this list"},{action:"disallowedSignupDomains",title:"Blocked Signup Email Domains",description:"Users with email domains are this list are not allowed to sign up. Existing accounts can still login."},{action:"disallowedLoginDomains",title:"Blocked Login Email Domains",description:"Users with email domains are this list are not allowed to sign up OR log in"},{action:"disallowedUrls",title:"Disallowed Urls",description:"Linking to a url on this list cause public pages to automatically be classified as bad"},{action:"disallowedCreditDomains",title:"Disallowed Credit Domains",description:"Email domains on this list are not allowed to receive notion credits"},{action:"allowedCreditDomains",title:"Allowed Credit Domains",description:"Email domains on this list are always to receive notion credits (other domains are too!)"},{action:"trustRules",title:"Trust Rules",description:"Show all trust rules in the redis setting"},{action:"asnHighRisk",title:"High risk ASNs",description:"Show all high risk ASNs in the redis setting"},{action:"asnMediumRisk",title:"Medium risk ASNs",description:"Show all medium risk ASNs in the redis setting"},{action:"contentScanningFlaggedKeywords",title:"Public Sites Flagged Keywords",description:"Show all keywords that will flag a public site during a content scan"},{action:"preservedSpaces",title:"Preserved Spaces",description:"SpaceIds marked as preserved and cannot be deleted"},{action:"aiContentScanningAllowlistedKeywords",title:"Public Sites AI Scanning Allowlisted Keywords",description:"Keywords in the AI summary of a flagged public page that will cause us to allowlist, since it is likely a false positive"},{action:"searchEngineUserAgentIdentifyingKeywords",title:"Keywords used to identify Search Engine User Agents",description:"Keywords to match a UserAgent string against to identify search engine bots (which are not covered by existing device detector logic)"},{action:"emailDenylist",title:"Email Denylist",description:"Emails that want to opt out of all emails from Notion. This includes signup, login, and security notifications."},{action:"loginEmailAllowlist",title:"Login Email Allowlist",description:"Emails that are allowed to bypass login rate limits and rules."},{action:"loginIpAllowlist",title:"Login IP Allowlist",description:"IP addresses that are allowed to bypass login rate limits and rules."},{action:"globalIpAllowlist",title:"Global IP Allowlist",description:"IP addresses that are allowed to bypass configured trust rules."}];function r(e){return!!Array.isArray(e)}a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(974864),a(765324);function s(e){return(r(e)?e:[e]).map(e=>e.action)}(0,a(48697).objectKeys)({email_unreachable:()=>new(a(101787)).rT("We could not reach the email address you provided. Please try again with a different email.",{type:"email_unreachable"}),sanctioned_entity:()=>new(a(101787)).rT("You may not access Notion from a prohibited jurisdiction.",{type:"sanctioned_entity"}),mfa_sms_unsupported_country_code:()=>new(a(101787)).rT("The country code is not supported.",{type:"mfa_sms_unsupported_country_code_for_enrollment"})});var o=a(440302);function l(e){let t=e.match(/^([^:]+):([^:]+): (.+)$/);if(!t)return;let[,a,i,n]=t;
106try{let e=JSON.parse(n);return{ruleSet:a,ruleName:i,rule:e}}catch{return}}function d(e){return void 0!==e}let c={whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0,fontFamily:"monospace"};function p({rule:e}){let t=e.split(/(&&|\|\||==|!=|>=|<=|>|<|\$[a-zA-Z0-9_]+|'[^']*'|"[^"]*"|\btrue\b|\bfalse\b|[{}(),]|\s+)/g).filter(Boolean);return(0,o.jsx)("pre",{style:c,children:t.map((e,t)=>(0,o.jsx)("span",{style:"&&"===e||"||"===e?{color:"purple"}:["==","!=",">=","<=",">","<"].includes(e)?{color:"blue"}:/^\$[a-zA-Z0-9_]+$/.test(e)?{color:"green"}:/^'.*'$|^".*"$/.test(e)?{color:"brown"}:"true"===e||"false"===e?{color:"teal"}:void 0,children:e},t))})}function m({isLast:e,isFirst:t}){return{borderInlineEnd:e?void 0:"1px solid #eee",borderInlineStart:t?"1px solid #eee":void 0}}let u={padding:24},h={marginInlineEnd:8},y={width:"100%",maxHeight:"80vh",overflowY:"auto",border:"1px solid #eee"},g={width:"100%",borderCollapse:"collapse"},x={borderBottom:"2px solid #eee"},f={borderBottom:"1px solid #eee"},b={whiteSpace:"pre-wrap",wordBreak:"break-word",margin:0},v={fontSize:12,padding:"2px 8px",cursor:"pointer"},j={minWidth:180},k={minWidth:220},S={width:70,whiteSpace:"nowrap"},w={width:80,whiteSpace:"nowrap"},I={minWidth:320,maxWidth:600},C={minWidth:220,maxWidth:400},D={width:80},T={width:80,textAlign:"center"};function R({listData:e}){let t=i.useMemo(()=>e.map(l).filter(d),[e]),n=i.useMemo(()=>Array.from(new Set(t.map(e=>e.ruleSet))).sort(),[t]),c=i.useMemo(()=>Array.from(new Set(t.flatMap(({rule:e})=>s(e)))).sort(),[t]),[A,N]=i.useState("All"),[M,P]=i.useState("All"),V=i.useMemo(()=>{let e=t;return"All"!==A&&(e=e.filter(e=>e.ruleSet===A)),"All"!==M&&(e=e.filter(({rule:e})=>s(e).some(e=>e===M))),e},[t,A,M]),E={wordBreak:"break-word",whiteSpace:"normal",padding:"4px",verticalAlign:"top"},[B,L]=i.useState(null);return(0,o.jsxs)("div",{style:u,children:[(0,o.jsx)("h2",{children:"Trust Rules"}),(0,o.jsxs)(a(4458).fI,{marginBottom:16,gap:16,alignItems:"center",children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"ruleset-filter",style:h,children:"Filter by Rule Set:"}),(0,o.jsxs)("select",{id:"ruleset-filter",value:A,onChange:e=>N(e.target.value),children:[(0,o.jsx)("option",{value:"All",children:"All"}),n.map(e=>(0,o.jsx)("option",{value:e,children:e},e))]})]}),(0,o.jsxs)("div",{children:[(0,o.jsx)("label",{htmlFor:"action-filter",style:h,children:"Filter by Action:"}),(0,o.jsxs)("select",{id:"action-filter",value:M,onChange:e=>P(e.target.value),children:[(0,o.jsx)("option",{value:"All",children:"All"}),c.map(e=>(0,o.jsx)("option",{value:e,children:e},e))]})]})]}),(0,o.jsx)("div",{style:y,children:(0,o.jsxs)("table",{style:g,children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{style:x,children:[(0,o.jsx)("th",{style:{...E,...j,...m({isLast:!1,isFirst:!0})},children:"Rule Set"}),(0,o.jsx)("th",{style:{...E,...k,...m({isLast:!1,isFirst:!1})},children:"Name"}),(0,o.jsx)("th",{style:{...E,...S,...m({isLast:!1,isFirst:!1})},children:"Action"}),(0,o.jsx)("th",{style:{...E,...w,...m({isLast:!1,isFirst:!1})},children:"Enabled %"}),(0,o.jsx)("th",{style:{...E,...I,...m({isLast:!1,isFirst:!1})},children:"Rule"}),(0,o.jsx)("th",{style:{...E,...C,...m({isLast:!1,isFirst:!1})},children:"Metadata"}),(0,o.jsx)("th",{style:{...E,...D,...m({isLast:!0,isFirst:!1})},children:"Copy Raw"})]})}),(0,o.jsx)("tbody",{children:V.map(({ruleSet:t,ruleName:a,rule:i},n)=>{let s=function(e){if(r(e))return e.map(({enabledPercent:e,rule:t,...a})=>a);let{action:t,enabledPercent:a,rule:i,...n}=e;return n}(i),d=e.findIndex(e=>{let i=l(e);return i&&i.ruleSet===t&&i.ruleName===a});return(0,o.jsxs)("tr",{style:f,children:[(0,o.jsx)("td",{style:{...E,...j,...m({isLast:!1,isFirst:!0})},children:t}),(0,o.jsx)("td",{style:{...E,...k,...m({isLast:!1,isFirst:!1})},children:a}),(0,o.jsx)("td",{style:{...E,...S,...m({isLast:!1,isFirst:!1})},children:r(i)?i.map(e=>`${e.action} ${e.enabledPercent}%`).join(", "):i.action}),(0,o.jsx)("td",{style:{...E,...w,...m({isLast:!1,isFirst:!1})},children:r(i)?"Split":i.enabledPercent}),(0,o.jsx)("td",{style:{...E,...I,...m({isLast:!1,isFirst:!1})},children:(r(i)?i:[i]).map(e=>(0,o.jsxs)("div",{children:[r(i)?(0,o.jsx)("strong",{children:`${e.action}: `}):void 0,(0,o.jsx)(p,{rule:e.rule})]},e.action))}),(0,o.jsx)("td",{style:{...E,...C,...m({isLast:!1,isFirst:!1})},children:Object.keys(s).length>0?(0,o.jsx)("pre",{style:b,children:JSON.stringify(s,null,2)}):""}),(0,o.jsx)("td",{style:{...E,...T,...m({isLast:!0,isFirst:!1})},children:(0,o.jsx)("button",{style:v,onClick:t=>{t.stopPropagation(),-1!==d&&(navigator.clipboard.writeText(e[d]),L(n),setTimeout(()=>L(null),1200))},children:B===n?"Copied!":"Copy Raw"})})]},t+a)})})]})})]})}let A={overflow:"scroll",height:"100%",width:"100%",margin:10},N={adminItem:(0,a(120308).Uw)(),adminWrap:(0,a(120308).pj)(),style0:{...a(120308).g,width:"100%",cursor:"pointer"},style1:{marginTop:12,marginBottom:12,width:"100%"}},M=function({category:e}){let t=(0,a(533992).v3)(),[r,s]=(0,i.useState)(!1),[l,d]=(0,i.useState)(),[c,p]=(0,i.useState)();return((0,i.useEffect)(()=>{e&&(s(!0),t.api.callApi({eventName:"adminListData",environment:t,data:{category:e}}).then(e=>{s(!1),"success"===e.type?p(e.data):d((0,a(201790).V4)(e))}))},[e,t]),r)?(0,o.jsxs)("div",{children:["loading ",e]}):l?(0,o.jsxs)("div",{children:["ERROR ",l]}):e&&c?"trustRules"===e?(0,o.jsx)(R,{listData:c.listData}):(0,o.jsx)("div",{style:A,children:c.listData.sort().map((e,t)=>(0,o.jsxs)(i.Fragment,{children:[e,(0,o.jsx)("br",{})]},t))}):(0,o.jsx)("div",{style:N.adminWrap,children:(0,o.jsx)("div",{style:a(120308).zR,children:n.map(e=>(0,o.jsxs)("div",{style:{...N.adminItem,...N.style1},children:[(0,o.jsx)("a",{href:`${a(168962).JZ.adminListData}/${e.action}`,children:(0,o.jsx)("div",{style:N.style0,children:e.title})}),e.description]},e.action))})})}},199034(e,t,a){a(159952),a(635790);var i=a(440302);let n={syncsTable:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},tableHeader:{display:"grid",gridTemplateColumns:"280px minmax(0, 0.8fr) minmax(0, 0.6fr) minmax(0, 1fr) minmax(0, 0.6fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium,textTransform:"uppercase",letterSpacing:.4,gap:12},tableBody:{display:"flex",flexDirection:"column",maxHeight:500,overflowY:"auto"},row:{display:"grid",gridTemplateColumns:"280px minmax(0, 0.8fr) minmax(0, 0.6fr) minmax(0, 1fr) minmax(0, 0.6fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.primary,gap:12},rowDivider:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},cell:{fontSize:13,color:a(632079).Tj.text.primary,overflow:"hidden",textOverflow:"ellipsis"},syncLink:{fontSize:12,fontFamily:"monospace",color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer",w
106ordBreak:"break-all"},healthBadge:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:a(699422).Wy.medium},healthError:{backgroundColor:a(632079).Tj.red.background.primary,color:a(632079).Tj.red.text.primary},healthWarning:{backgroundColor:a(632079).Tj.yellow.background.primary,color:a(632079).Tj.yellow.text.primary},emptyState:{padding:24,textAlign:"center",color:a(632079).Tj.text.secondary,fontSize:14},headerCell:{textAlign:"start"}};function r(e){let{data:t}=e;return(0,i.jsxs)(a(4458).VP,{gap:16,children:[(0,i.jsxs)(a(324489).V,{isSmall:!0,children:["Found ",t.syncs.length," unhealthy sync",1!==t.syncs.length?"s":""," across ",t.cellsScanned," cell",1!==t.cellsScanned?"s":""]}),t.syncs.length>0?(0,i.jsxs)("div",{style:n.syncsTable,children:[(0,i.jsxs)("div",{style:n.tableHeader,children:[(0,i.jsx)("div",{style:n.headerCell,children:"Sync ID"}),(0,i.jsx)("div",{style:n.headerCell,children:"Health"}),(0,i.jsx)("div",{style:n.headerCell,children:"Tasks"}),(0,i.jsx)("div",{style:n.headerCell,children:"Last Check"}),(0,i.jsx)("div",{style:n.headerCell,children:"Cell"})]}),(0,i.jsx)("div",{style:n.tableBody,children:t.syncs.map((e,r)=>{let s=r===t.syncs.length-1?n.row:{...n.row,...n.rowDivider};return(0,i.jsxs)("div",{style:s,children:[(0,i.jsx)("div",{children:(0,i.jsx)("a",{href:`${a(168962).JZ.admin}/syncs/detail/${encodeURIComponent(e.spaceId)}/${encodeURIComponent(e.syncId)}`,style:n.syncLink,children:e.syncId})}),(0,i.jsx)("div",{children:(0,i.jsx)("span",{style:function(e){switch(e){case"error":return{...n.healthBadge,...n.healthError};case"warning":return{...n.healthBadge,...n.healthWarning};default:return n.healthBadge}}(e.status),children:e.status})}),(0,i.jsx)("div",{style:n.cell,children:e.taskCount}),(0,i.jsx)("div",{style:n.cell,children:new Date(e.computedAt).toISOString()}),(0,i.jsx)("div",{style:n.cell,title:e.cellId,children:e.cellId})]},`${e.cellId}-${e.syncId}`)})})]}):(0,i.jsxs)("div",{style:n.emptyState,children:["No unhealthy syncs found across ",t.cellsScanned," cells"]})]})}a.d(t,{q:()=>r})},607142(e,t,a){a(730330),a(976614),a(159952),a(176765),a(851344),a(866491);var i=a(635790),n=a(440302);let r={full:{text:"read-write",permission:"adminLoginAsUserWrite"},restricted:{text:"view-only",permission:"adminLoginAsUserRead"},noPermissionOverride:{text:"user's permissions",permission:"adminLoginAsUserNoPermissionOverride"}},s=(0,a(327219).YK)({loggingInAs:{id:"adminLoginAsUser.loggingInAs.loadingMessage",defaultMessage:"Logging in as {userEmail}"}});function o(e){return new URLSearchParams(window.location.search).get(e)??""}let l={style0:{fontWeight:a(699422).Wy.bold,fontSize:18},style1:{marginTop:12,marginBottom:4},style2:{marginBottom:8},style3:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"5px"}};function d(e){let{email:t,permissionsSet:d}=e,[c,p]=(0,i.useState)(()=>o("loginEmail")),[m,u]=(0,i.useState)(()=>o("supportTicketLink")),[h,y]=(0,i.useState)(()=>o("pageId")),g=(0,a(579993).O$)(a(16329).x,"recentLogins")??[],[x,f]=(0,i.useState)(void 0);(0,i.useEffect)(()=>{x&&(0,a(318620).Y)(x)},[x]);let b=(0,a(533992).v3)(),v=(0,a(579993).K8)(()=>!a(218744).default.checkGate({gateName:"user_data_consent_admin_bypass"}),[]),j=(0,a(48697).objectKeys)(r).filter(e=>void 0===d||d.has(r[e].permission));async function k(e,i){let n=t||c;if(v&&0===m.length)return void a(647095).y$("You must include a support ticket link to login as a user!",e);null==i||i.currentTarget.blur(),a(262058).m({message:s.loggingInAs,interpolatedValues:{userEmail:n}}),await a(527905).s(),sessionStorage.clear(),a(16329).x.setState(function(e,t){if(0===t.loginEmail.length)return e;let a=e.filter(e=>e.loginEmail!==t.loginEmail||e.supportTicketLink!==t.supportTicketLink||e.pageId!==t.pageId);return[t,...a].slice(0,5)}(g,{loginEmail:n,supportTicketLink:m,pageId:h}));let r=h.trim()||void 0,o=await a(499748).P({email:n,intercomLink:m,preferredLoginRole:e});if("failed"===o.type)a(262058).V(),a(647095).Qg(o);else{let{userId:e}=o.data;if(r){a(262058).V(),f(`/${r}`);return}let t=`Success! click "Continue" to enter account for "${n}".`,i=o.data.expiryTime?`${t} The user has granted access until ${(0,a(850640).W_)(o.data.expiryTime,"medium_with_time",a(599412).q)}.`:t;a(262058).V(),a(647095).ui({message:i,showCancel:!1,keepFocus:!0,items:[{label:"Continue",color:"blue",onAccept:()=>{a(845311).N({userId:e,environment:b})}}]})}}let S=(0,i.useCallback)(e=>{u(e.target.value)},[]),w=(0,i.useCallback)(e=>{let t=e.target.value,a="mailto:";t.toLowerCase().startsWith(a)&&(t=t.substring(a.length)),p(t)},[]),I=(0,i.useCallback)(e=>{let t=e.target.value.trim();if(t.startsWith("http://")||t.startsWith("https://")){let e=(0,a(52628).w)(t);e&&(t=e.replace(/-/g,""))}y(t)},[]),C=(0,i.useCallback)(e=>{p(e.loginEmail),u(e.supportTicketLink),y(e.pageId)},[]),D=(0,i.useCallback)(()=>{a(16329).x.setState([])},[]);if(0===j.length)return null;let T=`e.g. 0123456789abcdef... or ${a(139424).A.domainBaseUrl}/...`;return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{style:l.style0,children:"Log In as User"}),v?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:l.style1,children:"Support ticket link"}),(0,n.jsx)(a(287562).p,{value:m,onChange:S,style:l.style2,placeholder:a(591977).r1})]}):void 0,t?(0,n.jsx)("div",{children:`Log in as ${t}`}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:l.style1,children:"User email"}),(0,n.jsx)(a(287562).p,{value:c,onChange:w,style:l.style2,placeholder:a(591977).zg})]}),(0,n.jsx)("div",{style:l.style1,children:"Page ID or URL (optional)"}),(0,n.jsx)(a(287562).p,{value:h,onChange:I,style:l.style2,placeholder:T}),(0,n.jsx)("div",{style:l.style3,children:j.map(e=>(0,n.jsx)(a(548436).A,{size:"lg",onClick:async()=>{await k(e)},children:`Log in ${"noPermissionOverride"===e?"with":"as"} ${r[e].text}`},e))}),g.length>0?(0,n.jsxs)("div",{style:l.style1,children:[(0,n.jsx)("div",{style:l.style2,children:"Recent logins"}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[g.map(e=>(0,n.jsx)(a(988022).p,{colorPalette:"blue",onClick:()=>C(e),children:e.loginEmail},`${e.loginEmail}-${e.supportTicketLink}-${e.pageId}`)),(0,n.jsx)(a(988022).p,{colorPalette:"red",iconLeading:a(822973).trashSmallIcon,onClick:D,children:"Clear history"})]})]}):void 0]})}a.d(t,{G:()=>d},{v:r})},834670(e,t,a){a.r(t);var i=a(635790),n=()=>a(201790),r=()=>a(318620),s=()=>a(185612),o=a(440302);let l=[{table:a(832375).oo9},{table:"space"},{table:"block"}],d={page:{background:a(632079).Tj.background.secondary},card:{background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8}};function c(e){return(0,a(83388).iv)(e)?`This UUID did not resolve to a user, workspace, or block: ${e}`:`This input did not resolve to a user, workspace, or block: ${e}`}function p(e){let{objectId:t,state:i}=e,n="loading"===i.type,r="notFound"===i.type&&!(0,a(83388).iv)(t);return(0,o.jsx)(a(45062).A,{title:"Resolving Admin Object - Notion Admin",children:(0,o.jsx)(a(220952).U,{currentSection:"home",children:(0,o.jsx)(a(4458).VP,{height:"100%",padding:8,alignItems:"center",justifyContent:"center",style:d.page,children:(0,o.jsxs)(a(4458).VP,{gap:12,padding:24,width:"100%",maxWidth:520,style:d.card,role:n?"status":"alert","aria-live":"polite",children:[(0,o.jsxs)(a(4458).fI,{gap:10,alignItems:"center",children:[n?(0,o.jsx)(a(517334).k,{size:"sm"}):void 0,(0,o.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"loading"===i.type?"Resolving admin object":"notFound"===i.type?"No matching admin object":"Could not resolve admin object"})]}),(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n?"Checking whether this identifier belongs to a user, workspace, or block. You'll be redirected automatically.":i.message}),r?(0,o.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Try searching with an email, UUID, or Stripe customer ID instead."}):void 0,(0,o.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,o.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"tertiary",children:"Input"}),(0,o.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:(0,o.jsx)(a(137691).x5,{value:t})})]})]})})})})}function m(e){let{objectId:t}=e,d=(0,a(533992).v3)(),m=(0,a(743187).g)(),{currentUserPermissions:u,fetchPermissionsErrored:h}=(0,a(579993).K8)(()=>{let{currentUserPermissions:e,fetchPermissionsErrored:t}=m.state;return{currentUserPermissions:e,fetchPermissionsErrored:t}},[m]),[y,g]=i.useState({type:"loading"});return i.useEffect(()=>{!async function(){if(g({type:"loading"}),!(0,a(83388).iv)(t))return g({type:"notFound",message:c(t)});for(let{table:e}of l){let i={recordId:t,table:e,__adminUISource:"admin_object_redirect"},o=await d.api.callApi({eventName:"adminFindObject",environment:d,data:i});
106if("success"===o.type&&o.data.exists){if((e===a(832375).oo9||"space"===e)&&void 0===u&&!h)return;(0,r().Y)((0,s().oS)({table:e,objectId:t,currentUserPermissions:u}));return}if("failed"===o.type)return void g({type:"error",message:(0,n().V4)(o)})}g({type:"notFound",message:c(t)})}()},[t,d,u,h]),(0,o.jsx)(p,{objectId:t,state:y})}a.d(t,{AdminObjectRedirect:()=>m})},38390(e,t,a){a.r(t),a.d(t,{AdminPermissionsPage:()=>f});var i=a(635790);function n(e){if((0,a(48697).O)(a(688211)._P,e))return a(688211)._P[e]}function r(e,t){let a=t.toLowerCase();if(e.toLowerCase().includes(a))return!0;let i=n(e);return!!(null!=i&&i.displayName&&i.displayName.toLowerCase().includes(a))}a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(159952);var s=a(440302);function o(e=new Set){let[t,a]=i.useState(e);return[t,i.useCallback(e=>{a(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[])]}let l={fontSize:13},d={position:"relative"};function c(e){return(0,s.jsx)("li",{style:l,children:e},e)}let p={container:{position:"relative",marginBottom:24,border:"1px solid #e0e0e0",borderRadius:8},roleContainer:{position:"relative",marginBottom:24,border:"1px solid #e0e0e0",borderRadius:8},button:{width:"100%",padding:16,background:"none",border:"none",textAlign:"start",cursor:"pointer",userSelect:"none",display:"flex",alignItems:"center",justifyContent:"flex-start",gap:8,font:"inherit",fontSize:"1.17em",fontWeight:a(699422).Wy.bold}};function m({title:e,isExpanded:t,onToggle:i,children:n,variant:r="section",contentPadding:o="16px",contentGap:l=8}){let c="role"===r?p.roleContainer:p.container;return(0,s.jsxs)(a(4458).VP,{style:c,className:"autolayout-fill-width",children:[(0,s.jsxs)(a(548436).A,{style:p.button,onClick:i,children:[(0,s.jsx)(a(111010).D,{as:"span",styleKey:"captionRegular",children:t?"▼":"►"}),e]}),t?(0,s.jsx)("div",{className:"autolayout-col",style:{display:"flex",flexDirection:"column",padding:o,gap:l,...d},children:n}):void 0]})}let u={maxWidth:400};function h(e){let{data:t}=e,[n,r]=i.useState("roles"),[o,l]=i.useState("");return(0,s.jsxs)(a(4458).VP,{gap:16,className:"autolayout-fill-width",style:d,children:[(0,s.jsx)(a(287562).p,{value:o,onChange:e=>l(e.target.value),placeholder:"Search by role or section name…",showClearButton:!0,style:u}),(0,s.jsx)(a(540336).LZ,{tabs:["Roles","Sections & Tools"],selectedIndex:+("roles"!==n),onChange:e=>{r(0===e?"roles":"tools")}}),"roles"===n?(0,s.jsx)(y,{roles:t.roles,searchQuery:o.toLowerCase()}):void 0,"tools"===n?(0,s.jsx)(g,{roles:t.roles,allPermissions:t.allPermissions,searchQuery:o.toLowerCase()}):void 0]})}function y({roles:e,searchQuery:t}){let[i,n]=o();return(0,s.jsxs)(a(4458).VP,{className:"autolayout-fill-width",style:d,children:[e.filter(e=>r(e.name,t)).map(e=>{let t=i.has(e.name),r=e.permissions.production||[];return(0,s.jsxs)(m,{title:e.name,isExpanded:t,onToggle:()=>n(e.name),variant:"role",contentPadding:"16px",contentGap:12,children:[(0,s.jsx)(a(324489).V,{children:`Okta Group: Admin Mode - ${e.name}`}),(0,s.jsx)(a(4458).VP,{gap:8,className:"autolayout-fill-width",style:d,children:Object.entries(a(604063).i8).map(([e,t])=>{let i=t.tools.filter(e=>r.includes(e));return 0===i.length?null:(0,s.jsx)(a(279827).ft,{title:t.title,items:i,renderItem:c},e)})})]},e.name)}),(0,s.jsx)(m,{title:"Uncategorized -- these permissions are not associated with any section or tool",isExpanded:i.has("uncategorized"),onToggle:()=>n("uncategorized"),variant:"role",contentPadding:"16px",contentGap:12,children:(0,s.jsx)(a(4458).VP,{gap:8,className:"autolayout-fill-width",style:d,children:(0,s.jsx)(a(279827).ft,{title:"Uncategorized",items:["adminLoginAsUserRead","adminLoginAsUserWrite","adminLoginAsUserNoPermissionOverride","adminViewSpaceFile"],renderItem:c})})})]})}function g({roles:e,allPermissions:t,searchQuery:l}){let[p,u]=o(),h=i.useMemo(()=>{let i=Object.fromEntries(t.map(t=>[t,e.filter(e=>{var a;return null==(a=e.permissions.production)?void 0:a.includes(t)})]));return Object.entries(a(604063).i8).map(([e,t])=>{let a=t.tools.filter(e=>r(e,l));return{sectionName:e,section:t,tools:a.map(e=>({tool:e,roles:i[e]}))}}).filter(({tools:e})=>e.length>0)},[e,t,l]);return(0,s.jsx)(a(4458).VP,{className:"autolayout-fill-width",style:d,children:h.map(({sectionName:e,section:t,tools:i})=>{let r=p.has(e);return(0,s.jsx)(m,{title:t.title,isExpanded:r,onToggle:()=>u(e),variant:"section",contentPadding:"0 16px 16px 16px",contentGap:8,children:i.map(({tool:e,roles:t})=>{var i;let r=n(e),o=(i=null==r?void 0:r.displayName)&&i!==e?`${i} (${e})`:e;return(0,s.jsx)(a(279827).ft,{title:o,items:t.map(e=>e.name),renderItem:c},e)})},e)})})}let x={adminWrap:(0,a(120308).pj)(),fullWidthItem:{...(0,a(120308).Uw)(),maxWidth:"1200px",width:"calc(100% - 16px)"},positionRelative:{position:"relative"}}
106;function f(){let e=(0,a(533992).v3)(),[t,n]=(0,i.useState)(!0),[r,o]=(0,i.useState)(),[l,d]=(0,i.useState)();return(0,i.useEffect)(()=>{n(!0),e.api.callApi({eventName:"adminGetPermissionsData",environment:e,data:{}}).then(e=>{n(!1),"success"===e.type?d(e.data):o((0,a(201790).V4)(e))}).catch(e=>{n(!1),o(String(e))})},[e]),(0,s.jsxs)("div",{style:x.adminWrap,children:[(0,s.jsx)(a(45062).A,{title:"Admin Permissions"}),(0,s.jsx)("div",{style:x.fullWidthItem,children:(0,s.jsxs)(a(4458).VP,{gap:20,className:"autolayout-fill-width",style:x.positionRelative,children:[(0,s.jsx)(a(111010).D,{as:"h1",styleKey:"titleLgBold",children:"Admin Mode Permissions"}),(0,s.jsx)(a(111010).D,{styleKey:"bodyRegular",colorVariant:"secondary",children:"This page shows all admin mode permission mappings from Okta groups to admin tools."}),t?(0,s.jsxs)(a(4458).fI,{gap:8,style:x.positionRelative,children:[(0,s.jsx)(a(517334).k,{size:16}),(0,s.jsx)(a(111010).D,{styleKey:"bodyRegular",children:"Loading permissions data..."})]}):void 0,r?(0,s.jsxs)(a(111010).D,{styleKey:"bodyRegular",colorPalette:"red",colorVariant:"accentPrimary",children:["Error loading permissions: ",r]}):void 0,l?(0,s.jsx)(h,{data:l}):void 0]})})]})}},612002(e,t,a){a(533958);var i=a(635790);let n=i.createContext(void 0);function r(){let e=(0,i.useContext)(n);if(void 0===e)throw Error("Admin response tabs context is unavailable.");return e}n.displayName="AdminResponseTabsContext",a.d(t,{S:()=>r},{G:n})},9446(e,t,a){a.r(t),a(730330),a(976614),a(974864),a(159952);var i=a(635790),n=a(440302);let r={adminItem:(0,a(120308).Uw)(),fullWidthItem:{...(0,a(120308).Uw)(),width:1016},style0:{color:"red"}};function s(e){let{table:t,resolution:s}=e,o=(0,a(579993).uB)(e.permissionsStore,a(913657).A),l=(0,a(579993).K8)(()=>o.state.currentUserPermissions,[o]),d=(0,i.useRef)(null),c=(0,a(579993).K8)(()=>Object.values(a(688211)._P).filter(e=>!e.showIfGate||e.showIfGate.alwaysEnabledEnvironments.includes("production")||a(218744).default.checkGate({gateName:e.showIfGate.gateName})),[]).flatMap(e=>{let i=(0,a(688211).L4)(e,t);return i?[{api:e,paramWithTable:i}]:[]});return"error"===s.type?(0,n.jsx)("div",{style:r.fullWidthItem,children:(0,n.jsx)("div",{style:r.style0,children:s.message})}):"loading"===s.type?(0,n.jsxs)("div",{style:r.fullWidthItem,children:[s.message,(0,n.jsx)(a(517334).k,{})]}):(0,n.jsx)(n.Fragment,{children:c.map(({api:e,paramWithTable:t},i)=>(0,n.jsx)(a(869589).RE,{style:t.schema.showByDefaultInSingleRecordMode?r.fullWidthItem:r.adminItem,ref:0===i?d:void 0,defaultParams:{[t.key]:s.id},api:e,singleRecordMode:!0,showByDefault:t.schema.showByDefaultInSingleRecordMode,hasPermission:l?l.has((0,a(688211).JZ)(e)):void 0,source:"admin_single_record"},e.apiName))})}let o={adminSingleRecordWrap:(0,a(120308).yQ)(),fullWidthItem:{...(0,a(120308).Uw)(),width:1016},style0:{marginBottom:12},style1:{flex:1},style2:{textDecoration:"underline"}};function l(e){let{table:t,id:i}=e,r=(0,a(533992).v3)(),l=(0,a(743187).g)(),[c,p]=(0,a(579993).K8)(()=>{let e=(0,a(427846)._)(r);return[null==e?void 0:e.isDefined(),null==e?void 0:e.getEmail()]},[r]),m=d(t,i);return(0,n.jsxs)("div",{style:o.adminSingleRecordWrap,children:[(0,n.jsx)(a(45062).A,{title:"Notion Admin Mode"}),(0,n.jsxs)("div",{style:a(120308).zR,children:[(0,n.jsxs)("div",{style:o.fullWidthItem,children:[(0,n.jsx)(a(553775).xu,{}),(0,n.jsxs)("div",{style:o.style0,children:[(0,n.jsx)(a(590422).Q,{href:"https://dev.notion.so/notion/Use-Admin-Mode-05f1e0ad9aa749a4b3dc07410b499465",external:!0,inline:!0,underline:!0,children:"Click here"})," ","to learn more about how to use Admin Mode."]}),c?(0,n.jsxs)("div",{style:o.style1,children:["Currently Logged in as: ",p]}):void 0,c?void 0:(0,n.jsx)("div",{style:a(120308).aW,children:(0,n.jsx)(a(590422).Q,{style:o.style2,href:a(168962).JZ.login,children:"Please log in."})})]}),(0,n.jsx)(s,{table:t,permissionsStore:l,resolution:m})]}),(0,n.jsx)(a(514164).N9,{hideProgressBar:!0,autoClose:1500,transition:a(514164).q7})]})}function d(e,t){let i=(0,a(533992).v3)(),n=t.includes("@"),r=!(0,a(83388).iv)(t)&&"space"===e,s=n?`Searching for ${t}`:r?`Searching for space with domain: ${t}`:void 0,[o]=(0,a(97668).Yb)(async()=>
106{if(!t)return{type:"loading"};if(n){let e=await i.api.callApi({eventName:"adminSearchUsers",environment:i,data:{userEmail:t,skipHydrateSpaces:!0,__adminUISource:"admin_single_record"}});return"success"===e.type?{type:"ready",id:e.data.id}:{type:"error",message:`email ${t} not found`}}if(r){let e={domain:t.replace("notion.so","").replace("notion.site",""),__adminUISource:"admin_single_record"},a=await i.api.callApi({eventName:"adminSearchSpaces",environment:i,data:e});return"success"===a.type?{type:"ready",id:a.data.id}:{type:"error",message:`space ${t} not found`}}return{type:"ready",id:t}},[i,t,n,r]);return"resolved"===o.status?o.value:"rejected"===o.status?{type:"error",message:o.error.message}:{type:"loading",message:s}}a.d(t,{AdminSingleRecord:()=>l,InnerPage:()=>s,useAdminSingleRecordResolution:()=>d})},748075(e,t,a){a(635790);var i=a(440302);let n={stripeFill:{fillRule:"evenodd",clipRule:"evenodd",fill:a(632079).Tj.blue.icon.accentPrimary},style0:{height:"15px"}};function r(){return(0,i.jsx)("svg",{version:"1.1",id:"Layer_1",x:"0px",y:"0px",viewBox:"0 0 468 222.5",style:n.style0,children:(0,i.jsxs)("g",{children:[(0,i.jsx)("path",{style:n.stripeFill,d:"M414,113.4c0-25.6-12.4-45.8-36.1-45.8c-23.8,0-38.2,20.2-38.2,45.6c0,30.1,17,45.3,41.4,45.3 c11.9,0,20.9-2.7,27.7-6.5v-20c-6.8,3.4-14.6,5.5-24.5,5.5c-9.7,0-18.3-3.4-19.4-15.2h48.9C413.8,121,414,115.8,414,113.4z M364.6,103.9c0-11.3,6.9-16,13.2-16c6.1,0,12.6,4.7,12.6,16H364.6z"}),(0,i.jsx)("path",{style:n.stripeFill,d:"M301.1,67.6c-9.8,0-16.1,4.6-19.6,7.8l-1.3-6.2h-22v116.6l25-5.3l0.1-28.3c3.6,2.6,8.9,6.3,17.7,6.3 c17.9,0,34.2-14.4,34.2-46.1C335.1,83.4,318.6,67.6,301.1,67.6z M295.1,136.5c-5.9,0-9.4-2.1-11.8-4.7l-0.1-37.1 c2.6-2.9,6.2-4.9,11.9-4.9c9.1,0,15.4,10.2,15.4,23.3C310.5,126.5,304.3,136.5,295.1,136.5z"}),(0,i.jsx)("polygon",{style:n.stripeFill,points:"223.8,61.7 248.9,56.3 248.9,36 223.8,41.3 	"}),(0,i.jsx)("rect",{x:"223.8",y:"69.3",style:n.stripeFill,width:"25.1",height:"87.5"}),(0,i.jsx)("path",{style:n.stripeFill,d:"M196.9,76.7l-1.6-7.4h-21.6v87.5h25V97.5c5.9-7.7,15.9-6.3,19-5.2v-23C214.5,68.1,202.8,65.9,196.9,76.7z"}),(0,i.jsx)("path",{style:n.stripeFill,d:"M146.9,47.6l-24.4,5.2l-0.1,80.1c0,14.8,11.1,25.7,25.9,25.7c8.2,0,14.2-1.5,17.5-3.3V135 c-3.2,1.3-19,5.9-19-8.9V90.6h19V69.3h-19L146.9,47.6z"}),(0,i.jsx)("path",{style:n.stripeFill,d:"M79.3,94.7c0-3.9,3.2-5.4,8.5-5.4c7.6,0,17.2,2.3,24.8,6.4V72.2c-8.3-3.3-16.5-4.6-24.8-4.6 C67.5,67.6,54,78.2,54,95.9c0,27.6,38,23.2,38,35.1c0,4.6-4,6.1-9.6,6.1c-8.3,0-18.9-3.4-27.3-8v23.8c9.3,4,18.7,5.7,27.3,5.7 c20.8,0,35.1-10.3,35.1-28.2C117.4,100.6,79.3,105.9,79.3,94.7z"})]})})}a.d(t,{z:()=>r})},527621(e,t,a){a.r(t);var i=a(635790),n=a(440302);let r={adminWrap:(0,a(120308).pj)(),admin:a(120308).zR,sectionTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:16,width:"100%"},errorContainer:{padding:24,color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:8,width:"100%"},detailContainer:{width:"100%"},breadcrumb:{marginBottom:16,width:"100%"},breadcrumbLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"none",fontSize:14,cursor:"pointer"}};function s(e){let{spaceId:t,syncId:s}=e,o=(0,a(533992).v3)(),[l,d]=(0,i.useState)(!0),[c,p]=(0,i.useState)(void 0),[m,u]=(0,i.useState)(void 0);return(0,i.useEffect)(()=>{!async function(){d(!0),p(void 0);let e=await o.api.callApi({eventName:"adminGetSyncDetail",environment:o,data:{syncId:s,spaceId:t}});"success"===e.type?u(e.data):p((0,a(201790).V4)(e)),d(!1)}()},[o,s,t]),(0,n.jsx)(a(45062).A,{title:"Sync Detail - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"syncs",children:(0,n.jsx)("div",{style:r.adminWrap,children:(0,n.jsxs)("div",{style:r.admin,children:[(0,n.jsx)("div",{style:r.breadcrumb,children:(0,n.jsx)("a",{href:`${a(168962).JZ.adminSyncsHome}?spaceId=${encodeURIComponent(t)}`,style:r.breadcrumbLink,children:"← Back to Syncs"})}),(0,n.jsx)("h1",{style:r.sectionTitle,children:"Sync Detail"}),l?(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:48,width:"100%",children:(0,n.jsx)(a(517334).k,{size:32})}):c?(0,n.jsx)("div",{style:r.errorContainer,children:c}):m?(0,n.jsx)("div",{style:r.detailContainer,children:(0,n.jsx)(a(56518)._,{data:m})}):void 0]})})})})}a.d(t,{AdminSyncDetailPage:()=>s})},375500(e,t,a){a.r(t);var i=a(635790),n=a(440302);let r={adminWrap:(0,a(120308).pj)(),admin:a(120308).zR,adminItem:(0,a(120308).Uw)(),title:{fontSize:18,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:8},description:{fontSize:13,color:a(632079).Tj.text.secondary,lineHeight:1.5,marginBottom:16},form:{display:"flex",flexDirection:"column",gap:12},label:{fontSize:12,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary},input:{padding:"8px 10px",fontSize:14,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,outline:"none",width:"100%",boxSizing:"border-box"},hint:{fontSize:11,color:a(632079).Tj.text.tertiary,marginTop:4},buttonRow:{marginTop:4},sectionTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:16,marginTop:24,width:"100%"},errorContainer:{padding:24,color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:8,width:"100%"},syncsListContainer:{width:"100%"},breadcrumb:{marginBottom:16,width:"100%"},breadcrumbLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"none",fontSize:14,cursor:"pointer"}};function s(e){let{spaceId:t,email:a,syncId:i}=e;return t||a||i?(0,n.jsx)(l,{spaceId:t,email:a,syncId:i}):(0,n.jsx)(o,{})}function o(){let[e,t]=(0,i.useState)(""),[s,o]=(0,i.useState)(!1),l=(0,a(533992).v3)(),[d,c]=(0,i.useState)(!0),[p,m]=(0,i.useState)(void 0),[u,h]=(0,i.useState)(void 0),y=(0,i.useCallback)(()=>{e.trim()&&o(!0)},[e]),g=(0,i.useCallback)(e=>{e.preventDefault(),y()},[y]);(0,i.useEffect)(()=>
106{if(s){let t=e.trim();if(t){let e=t.includes("@");(0,a(318620).Y)(`${a(168962).JZ.adminSyncsHome}?${e?"email":"spaceId"}=${encodeURIComponent(t)}`)}}},[s,e]),(0,i.useEffect)(()=>{!async function(){c(!0),m(void 0);let e=await l.api.callApi({eventName:"adminListUnhealthySyncs",environment:l,data:{}});"success"===e.type?h(e.data):m((0,a(201790).V4)(e)),c(!1)}()},[l]);let x=(0,i.useCallback)(e=>{t(e.target.value)},[]);return(0,n.jsx)(a(45062).A,{title:"Syncs - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"syncs",children:(0,n.jsx)("div",{style:r.adminWrap,children:(0,n.jsxs)("div",{style:r.admin,children:[(0,n.jsxs)("div",{style:r.adminItem,children:[(0,n.jsx)("div",{style:r.title,children:"Find Syncs"}),(0,n.jsx)("div",{style:r.description,children:"Search for syncs by entering a workspace ID (UUID), sync ID (UUID), or a user's email address."}),(0,n.jsxs)("form",{onSubmit:g,style:r.form,children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)("label",{style:r.label,children:"Space ID, Sync ID, or User Email"}),(0,n.jsx)("input",{type:"text",value:e,onChange:x,placeholder:"Enter a space ID, sync ID, or email address",style:r.input,autoFocus:!0}),(0,n.jsx)("div",{style:r.hint,children:"If you enter an email, we'll find all workspaces that user belongs to."})]}),(0,n.jsx)("div",{style:r.buttonRow,children:(0,n.jsx)(a(912946).j,{onClick:y,disabled:!e.trim(),children:"Search"})})]})]}),(0,n.jsx)("h1",{style:r.sectionTitle,children:"Unhealthy Syncs"}),d?(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:48,width:"100%",children:(0,n.jsx)(a(517334).k,{size:32})}):p?(0,n.jsx)("div",{style:r.errorContainer,children:p}):u?(0,n.jsx)("div",{style:r.syncsListContainer,children:(0,n.jsx)(a(199034).q,{data:u})}):void 0]})})})})}function l(e){let{spaceId:t,email:s,syncId:o}=e,l=o||t||s||"",d=(0,a(533992).v3)(),[c,p]=(0,i.useState)(!0),[m,u]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(void 0);return(0,i.useEffect)(()=>{!async function(){p(!0),u(void 0);let e=await d.api.callApi({eventName:"adminGetSyncs",environment:d,data:{query:l}});if("success"===e.type){let t=e.data;if(t.redirectToDetail){let{syncId:e,spaceId:i}=t.redirectToDetail;(0,a(318620).Y)(`/__admin/syncs/detail/${i}/${e}`);return}y(t)}else u((0,a(201790).V4)(e));p(!1)}()},[d,l]),(0,n.jsx)(a(45062).A,{title:"Syncs - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"syncs",children:(0,n.jsx)("div",{style:r.adminWrap,children:(0,n.jsxs)("div",{style:r.admin,children:[(0,n.jsx)("div",{style:r.breadcrumb,children:(0,n.jsx)("a",{href:a(168962).JZ.adminSyncsHome,style:r.breadcrumbLink,children:"← Back to Syncs Search"})}),(0,n.jsx)("h1",{style:r.sectionTitle,children:"Syncs"}),c?(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:48,width:"100%",children:(0,n.jsx)(a(517334).k,{size:32})}):m?(0,n.jsx)("div",{style:r.errorContainer,children:m}):h?(0,n.jsx)("div",{style:r.syncsListContainer,children:(0,n.jsx)(a(862582).s,{data:h})}):void 0]})})})})}a.d(t,{AdminSyncsHomePage:()=>s})},344184(e,t,a){var i=a(635790);let n=new Intl.DateTimeFormat("en-US",{timeZone:"UTC",year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit",hour12:!1}),r=a(764657).union([a(764657).number(),a(764657).string()]);function s(e){return`${n.format(e)} UTC`}function o(){let e=(0,a(579993).K8)(()=>a(235658).K.getState()??!0,[]);return i.useCallback((t,i)=>(function(e){let{key:t,value:i,showFormattedTimestamps:n}=e;if(!(t.endsWith("_time")||t.endsWith("_date")))return;let o=function(e){if(!(0,a(788145).Xj)(r,e))return;let t="number"==typeof e?e:Number(e);if("string"!=typeof e||e===t.toString()){var i;return Number.isInteger(i=t)&&i>=1e11&&i<=1e13?t:void 0}}(i);if(void 0===o)return;let l=o.toString();return{copyValue:l,displayValue:n?s(o):l}})({key:t,value:i,showFormattedTimestamps:e}),[e])}a.d(t,{jh:()=>o,vO:()=>s})},137691(e,t,a){var i=a(635790),n=a(440302);function r(e,t){return(0,a(83388).iv)(e)?t?(0,a(83388).G2)(e):(0,a(83388).S2)(e):e}function s(e){return r(e,a(718473).N.getState()??!1)}function o({value:e}){let t=r(e,(0,a(579993).K8)(()=>a(718473).N.getState()??!1,[]));return(0,n.jsx)("span",{children:t})}function l(){let e=(0,a(579993).K8)(()=>a(718473).N.getState()??!1,[]);return i.useCallback(t=>r(t,e),[e])}a.d(t,{n6:()=>l,s_:()=>s,x5:()=>o})},274743(e,t,a){a.r(t),a(159952);var i=a(635790),n=a(440302);let r={container:{padding:24,maxWidth:1200,margin:"0 auto",background:a(632079).Tj.background.primary,minHeight:"100vh"},breadcrumb:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:a(632079).Tj.text.secondary,marginBottom:16},breadcrumbLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"underline",cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit"},spaceInfo:{display:"flex",flexDirection:"column",gap:4,padding:12,backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,marginBottom:8},spaceInfoRow:{display:"flex",gap:8,alignItems:"center",fontSize:12},spaceInfoLabel:{color:a(632079).Tj.text.tertiary,minWidth:80},errorContainer:{padding:24,color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:8}};function s(e){let{spaceId:t,workerId:s}=e,o=(0,a(533992).v3)(),[l,d]=(0,i.useState)(!0),[c,p]=(0,i.useState)(void 0),[m,u]=(0,i.useState)(void 0),h=i.useRef(!0),[y,g]=(0,i.useState)(null),[x,f]=(0,i.useState)(null);(0,i.useEffect)(()=>{async function e(){h.current&&(d(!0),h.current=!1),p(void 0);let e=await o.api.callApi({eventName:"adminGetWorkerDetail",environment:o,data:{spaceId:t,workerId:s}});"success"===e.type?u(e.data):p((0,a(201790).V4)(e)),d(!1)}e();let i=window.setInterval(()=>{("u"<typeof document||"visible"===document.visibilityState)&&e()},1e4);return()=>{window.clearInterval(i)}},[o,t,s]);let b=(0,i.useCallback)(()=>{window.history.back()},[]),v=(0,i.useCallback)(async e=>{let a=await o.api.callApi({eventName:"adminGetWorkerRunLogs",environment:o,data:{spaceId:t,workerId:s,runId:e}});if("success"===a.type)return{logs:a.data.logs,output:a.data.output}},[o,t,s]),j=(0,i.useCallback)(async(e,a)=>{g(e);let i=await o.api.callApi({eventName:"adminUpdateSyncCapability",environment:o,data:{spaceId:t,workerId:s,capabilityKey:e,disabled:a}});
106if("success"===i.type){let t=i.data.capability;u(a=>a?{...a,capabilities:a.capabilities.map(a=>a.key===e?t:a)}:a)}g(null)},[o,t,s]),k=(0,i.useCallback)(async(e,a)=>{f(e);let i=await o.api.callApi({eventName:"adminUpdateSyncCapability",environment:o,data:{spaceId:t,workerId:s,capabilityKey:e,schedule:a}});if("success"===i.type){let t=i.data.capability;u(a=>a?{...a,capabilities:a.capabilities.map(a=>a.key===e?t:a)}:a)}f(null)},[o,t,s]);return(0,n.jsx)(a(45062).A,{title:"Worker Details - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"workers",children:(0,n.jsxs)("div",{style:r.container,children:[(0,n.jsx)("div",{style:r.breadcrumb,children:(0,n.jsx)("button",{onClick:b,style:r.breadcrumbLink,type:"button",children:"← Back to workers list"})}),l?(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:48,children:(0,n.jsx)(a(517334).k,{size:32})}):c?(0,n.jsx)("div",{style:r.errorContainer,children:c}):m?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:r.spaceInfo,children:[(0,n.jsxs)("div",{style:r.spaceInfoRow,children:[(0,n.jsx)("span",{style:r.spaceInfoLabel,children:"Workspace:"}),(0,n.jsx)("span",{children:m.spaceName||"Unknown"})]}),(0,n.jsxs)("div",{style:r.spaceInfoRow,children:[(0,n.jsx)("span",{style:r.spaceInfoLabel,children:"Space ID:"}),(0,n.jsx)(a(137691).x5,{value:m.spaceId})]})]}),(0,n.jsxs)("div",{style:r.spaceInfo,children:["Notion Admin override:"," ",m.worker.isPausedByNotionAdmin?"On":"Off"]}),(0,n.jsx)(a(456314).cx,{worker:m.worker,capabilities:m.capabilities,runs:m.runs,syncTasks:m.syncTasks,onFetchRunLogs:v,onToggleDisabled:j,isUpdatingCapability:y,onUpdateSchedule:k,isUpdatingSchedule:x})]}):null]})})})}a.d(t,{AdminWorkersDetailPage:()=>s})},940477(e,t,a){a.r(t),a.d(t,{AdminWorkersHomePage:()=>f}),a(533958),a(159952);var i=a(635790),n=a(440302);let r={panel:{...(0,a(120308).Uw)(),width:"100%"},brakeRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:6,marginBottom:8},brakeRowEngaged:{borderColor:a(632079).Tj.red.border.primary,backgroundColor:a(632079).Tj.red.background.primary},brakeName:{fontSize:14,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary},brakeStatus:{fontSize:13,color:a(632079).Tj.text.secondary},brakeStatusEngaged:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.medium},brakeMetadata:{fontSize:12,color:a(632079).Tj.text.tertiary,marginTop:2},statusMessage:{fontSize:13,marginTop:8},successMessage:{color:a(632079).Tj.green.text.accentPrimary},errorMessage:{color:a(632079).Tj.red.text.accentPrimary},errorContainer:{padding:16,color:a(632079).Tj.red.text.accentPrimary,fontSize:14}};function s(e){return new Date(e).toLocaleString()}function o(e){let{spaceId:t}=e,o=(0,a(533992).v3)(),[l,d]=(0,i.useState)(!0),[c,p]=(0,i.useState)(void 0),[m,u]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(!1),[g,x]=(0,i.useState)(!1),[f,b]=(0,i.useState)(void 0),v=(0,i.useCallback)(async()=>{d(!0),p(void 0);let e=await o.api.callApi({eventName:"adminGetWorkersEmergencyBrake",environment:o,data:{spaceId:t}});"success"===e.type?u(e.data):p((0,a(201790).V4)(e)),d(!1)},[o,t]);(0,i.useEffect)(()=>{v()},[v]);let j=(0,i.useCallback)(async()=>{if(!m)return;y(!0),b(void 0);let e=!m.notionBrakeEnabled,i=await o.api.callApi({eventName:"adminSetWorkersEmergencyBrake",environment:o,data:{spaceId:t,enabled:e}});"success"===i.type?(b({type:"success",text:e?"Notion brake engaged. All workers are now blocked.":"Notion brake released. Workers can resume execution."}),x(!1),await v()):b({type:"error",text:(0,a(201790).V4)(i)}),y(!1)},[o,t,m,v]),k=(0,i.useCallback)(()=>{g?j():(x(!0),b(void 0))},[g,j]),S=(0,i.useCallback)(()=>{x(!1)},[]);if(l)return(0,n.jsx)("div",{style:r.panel,children:(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:32,children:(0,n.jsx)(a(517334).k,{size:24})})});if(c)return(0,n.jsx)("div",{style:r.panel,children:(0,n.jsx)("div",{style:r.errorContainer,children:c})});if(!m)return(0,n.jsx)("div",{style:r.panel,children:(0,n.jsx)("div",{style:r.errorContainer,children:"No data available."})});let w=m.globalBrakeEnabled||m.adminBrakeEnabled||m.notionBrakeEnabled;return(0,n.jsxs)("div",{style:r.panel,children:[(0,n.jsxs)("div",{style:{...r.brakeRow,...m.globalBrakeEnabled&&r.brakeRowEngaged},children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)("div",{style:r.brakeN
106ame,children:"Sandbox Emergency Brake"}),(0,n.jsx)("div",{style:r.brakeMetadata,children:"Blocks all new sandbox creation across Notion, including worker runs and deploys."}),(0,n.jsx)("div",{style:m.globalBrakeEnabled?r.brakeStatusEngaged:r.brakeStatus,children:m.globalBrakeEnabled?"ENGAGED":"Released"}),m.globalBrakeAdminEmail?(0,n.jsxs)("div",{style:r.brakeMetadata,children:["Set by ",m.globalBrakeAdminEmail,m.globalBrakeUpdatedAt?` at ${s(m.globalBrakeUpdatedAt)}`:""]}):void 0]}),(0,n.jsx)("div",{style:r.brakeStatus,children:"Controlled on /__admin/workers as the sandbox emergency brake"})]}),(0,n.jsxs)("div",{style:{...r.brakeRow,...m.adminBrakeEnabled&&r.brakeRowEngaged},children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)("div",{style:r.brakeName,children:"Admin Brake"}),(0,n.jsx)("div",{style:m.adminBrakeEnabled?r.brakeStatusEngaged:r.brakeStatus,children:m.adminBrakeEnabled?"ENGAGED":"Released"}),m.adminBrakeUserId?(0,n.jsxs)("div",{style:r.brakeMetadata,children:["Set by"," ",m.adminBrakeUserName&&m.adminBrakeUserEmail?`${m.adminBrakeUserName} (${m.adminBrakeUserEmail})`:m.adminBrakeUserEmail??m.adminBrakeUserId,m.adminBrakeUpdatedAt?` at ${s(m.adminBrakeUpdatedAt)}`:""]}):void 0]}),(0,n.jsx)("div",{style:r.brakeStatus,children:"Controlled by workspace admin"})]}),(0,n.jsxs)("div",{style:{...r.brakeRow,...m.notionBrakeEnabled&&r.brakeRowEngaged},children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)("div",{style:r.brakeName,children:"Notion Brake"}),(0,n.jsx)("div",{style:m.notionBrakeEnabled?r.brakeStatusEngaged:r.brakeStatus,children:m.notionBrakeEnabled?"ENGAGED":"Released"}),m.notionBrakeAdminEmail?(0,n.jsxs)("div",{style:r.brakeMetadata,children:["Set by ",m.notionBrakeAdminEmail,m.notionBrakeUpdatedAt?` at ${s(m.notionBrakeUpdatedAt)}`:""]}):void 0]}),(0,n.jsx)(a(4458).fI,{gap:8,alignItems:"center",children:g?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(912946).j,{onClick:k,disabled:h,children:h?"Updating...":m.notionBrakeEnabled?"Confirm Release":"Confirm Engage"}),h?void 0:(0,n.jsx)(a(548436).A,{onClick:S,children:"Cancel"})]}):(0,n.jsx)(a(912946).j,{onClick:k,children:m.notionBrakeEnabled?"Release Brake":"Engage Brake"})})]}),w?(0,n.jsx)("div",{style:{...r.statusMessage,...r.errorMessage},children:"Workers are currently blocked for this workspace."}):void 0,f?(0,n.jsx)("div",{style:{...r.statusMessage,..."success"===f.type?r.successMessage:r.errorMessage},children:f.text}):void 0]})}let l={panel:{...(0,a(120308).Uw)(),width:"100%"},title:{fontSize:18,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:8},description:{fontSize:13,color:a(632079).Tj.text.secondary,lineHeight:1.5,marginBottom:16},brakeRow:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:6},brakeRowEngaged:{borderColor:a(632079).Tj.red.border.primary,backgroundColor:a(632079).Tj.red.background.primary},brakeName:{fontSize:14,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary},brakeStatus:{fontSize:13,color:a(632079).Tj.text.secondary},brakeStatusEngaged:{color:a(632079).Tj.red.text.accentPrimary,fontWeight:a(699422).Wy.medium},brakeMetadata:{fontSize:12,color:a(632079).Tj.text.tertiary,marginTop:2},statusMessage:{fontSize:13,marginTop:12},successMessage:{color:a(632079).Tj.green.text.accentPrimary},errorMessage:{color:a(632079).Tj.red.text.accentPrimary},errorContainer:{padding:16,color:a(632079).Tj.red.text.accentPrimary,fontSize:14}};function d(){let e=(0,a(533992).v3)(),[t,r]=(0,i.useState)(!0),[s,o]=(0,i.useState)(void 0),[d,c]=(0,i.useState)(void 0),[p,m]=(0,i.useState)(!1),[u,h]=(0,i.useState)(!1),[y,g]=(0,i.useState)(void 0),x=(0,i.useCallback)(async()=>{r(!0),o(void 0);let t=await e.api.callApi({eventName:"adminGetWorkersGlobalEmergencyBrake",environment:e,data:{}});"success"===t.type?c(t.data):o((0,a(201790).V4)(t)),r(!1)},[e]);(0,i.useEffect)(()=>{x()},[x]);let f=(0,i.useCallback)(async()=>{if(!d)return;m(!0),g(void 0);let t=!d.globalBrakeEnabled,i=await e.api.callApi({eventName:"adminSetWorkersGlobalEmergencyBrake",environment:e,data:{enabled:t}});
106"success"===i.type?(g({type:"success",text:t?"Sandbox emergency brake engaged. New sandboxes are now blocked across all products.":"Sandbox emergency brake released. New sandbox creation can resume."}),h(!1),await x()):g({type:"error",text:(0,a(201790).V4)(i)}),m(!1)},[e,d,x]),b=(0,i.useCallback)(()=>{u?f():(h(!0),g(void 0))},[u,f]),v=(0,i.useCallback)(()=>{h(!1)},[]);return(0,n.jsxs)("div",{style:l.panel,children:[(0,n.jsx)("div",{style:l.title,children:"Sandbox Emergency Brake"}),(0,n.jsx)("div",{style:l.description,children:"Blocks all new sandbox creation across Notion. This stops worker runs, worker deploys, Notion as Code sandboxes, and any other sandbox-backed flow until the brake is released."}),(0,n.jsx)("div",{style:l.brakeMetadata,children:"Changes propagate through cached server settings. The UI may take up to 10 seconds to reflect the new state."}),t?(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:32,children:(0,n.jsx)(a(517334).k,{size:24})}):s?(0,n.jsx)("div",{style:l.errorContainer,children:s}):d?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{...l.brakeRow,...d.globalBrakeEnabled&&l.brakeRowEngaged},children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)("div",{style:l.brakeName,children:"Sandbox Emergency Brake"}),(0,n.jsx)("div",{style:d.globalBrakeEnabled?l.brakeStatusEngaged:l.brakeStatus,children:d.globalBrakeEnabled?"ENGAGED":"Released"}),d.globalBrakeAdminEmail?(0,n.jsxs)("div",{style:l.brakeMetadata,children:["Set by"," ",d.globalBrakeAdminEmail,d.globalBrakeUpdatedAt?` at ${new Date(d.globalBrakeUpdatedAt).toLocaleString()}`:""]}):void 0]}),(0,n.jsx)(a(4458).fI,{gap:8,alignItems:"center",children:u?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(912946).j,{onClick:b,disabled:p,children:p?"Updating...":d.globalBrakeEnabled?"Confirm Release":"Confirm Engage"}),p?void 0:(0,n.jsx)(a(548436).A,{onClick:v,children:"Cancel"})]}):(0,n.jsx)(a(912946).j,{onClick:b,children:d.globalBrakeEnabled?"Release Brake":"Engage Brake"})})]}),y?(0,n.jsx)("div",{style:{...l.statusMessage,..."success"===y.type?l.successMessage:l.errorMessage},children:y.text}):void 0]}):(0,n.jsx)("div",{style:l.errorContainer,children:"No data available."})]})}let c={buildLimit:"",buildBurstLimit:"",syncLimit:"",syncBurstLimit:"",capabilityLimit:"",capabilityBurstLimit:"",syncCollectionOpsLimit:"",syncCollectionOpsBurstLimit:"",webhookLimit:"",webhookBurstLimit:""},p=[{category:"Build",metric:"Limit",defaultKey:"buildLimit",inputKey:"buildLimit",getOverride:e=>{var t;return null==e||null==(t=e.build)?void 0:t.limit},durationKey:"buildDuration"},{category:"Build",metric:"Burst Limit",defaultKey:"buildBurstLimit",inputKey:"buildBurstLimit",getOverride:e=>{var t;return null==e||null==(t=e.build)?void 0:t.burstLimit},durationKey:"buildBurstDuration"},{category:"Sync",metric:"Limit",defaultKey:"syncLimit",inputKey:"syncLimit",getOverride:e=>{var t;return null==e||null==(t=e.sync)?void 0:t.limit},durationKey:"syncDuration"},{category:"Sync",metric:"Burst Limit",defaultKey:"syncBurstLimit",inputKey:"syncBurstLimit",getOverride:e=>{var t;return null==e||null==(t=e.sync)?void 0:t.burstLimit},durationKey:"syncBurstDuration"},{category:"Capability",metric:"Limit",defaultKey:"capabilityLimit",inputKey:"capabilityLimit",getOverride:e=>{var t;return null==e||null==(t=e.capability)?void 0:t.limit},durationKey:"capabilityDuration"},{category:"Capability",metric:"Burst Limit",defaultKey:"capabilityBurstLimit",inputKey:"capabilityBurstLimit",getOverride:e=>{var t;return null==e||null==(t=e.capability)?void 0:t.burstLimit},durationKey:"capabilityBurstDuration"},{category:"Sync Collection Ops",metric:"Limit",defaultKey:"syncCollectionOpsLimit",inputKey:"syncCollectionOpsLimit",getOverride:e=>{var t;return null==e||null==(t=e.syncCollectionOps)?void 0:t.limit},durationKey:"syncCollectionOpsDuration"},{category:"Sync Collection Ops",metric:"Burst Limit",defaultKey:"syncCollectionOpsBurstLimit",inputKey:"syncCollectionOpsBurstLimit",getOverride:e=>{var t;return null==e||null==(t=e.syncCollectionOps)?void 0:t.burstLimit},durationKey:"syncCollectionOpsBurstDuration"},{category:"Webhook",metric:"Limit",defaultKey:"webhookLimit",inputKey:"webhookLimit",getOverride:e=>{var t;return null==e||null==(t=e.webhook)?void 0:t.limit},durationKey:"webhookDuration"},{category:"Webhook",metric:"Burst Limit",defaultKey:"webhookBurstLimit",inputKey:"webhookBurstLimit",getOverride:e=>{var t;return null==e||null==(t=e.webhook)?void 0:t.burstLimit},durationKey:"webhookBurstDuration"}],m={panel:{...(0,a(120308).Uw)(),width:"100%"},title:{fontSize:16,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:4},metadata:{fontSize:12,color:a(632079).Tj.text.tertiary,marginBottom:12},grid:{display:"grid",gridTemplateColumns:"1fr 1fr 1fr 1fr 1fr 1fr",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:6,overflow:"hidden"},gridHeader:{padding:"8px 12px",fontSize:12,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary,backgroundColor:a(632079).Tj.background.secondary,textTransform:"uppercase",letterSpacing:.3},gridHeaderNumeric:{padding:"8px 12px",fontSize:12,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary,backgroundColor:a(632079).Tj.background.secondary,textTransform:"uppercase",letterSpacing:.3,textAlign:"end"},gridCell:{padding:"8px 12px",fontSize:14,color:a(632079).Tj.text.primary,borderTop:`1px solid ${a(632079).Tj.border.secondary}`,display:"flex",alignItems:"center"},gridCellNumeric:{padding:"8px 12px",fontSize:14,color:a(632079).Tj.text.primary,borderTop:`1px solid ${a(632079).Tj.border.secondary}`,display:"flex",alignItems:"center",justifyContent:"flex-end"},gridCellCategory:{padding:"8px 12px",fontSize:14,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary,borderTop:`1px solid ${a(632079).Tj.border.secondary}`,display:"flex",alignItems:"center"},overrideEmpty:{color:a(632079).Tj.text.tertiary},input:{padding:"1px 6px",margin:"-2px 0",fontSize:14,lineHeight:"20px",border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:4,outline:"none",width:"100%",boxSizing:"border-box",textAlign:"end"},statusMessage:{fontSize:13,marginInlineStart:8},successMessage:{color:a(632079).Tj.green.text.accentPrimary},errorMessage:{color:a(632079).Tj.red.text.accentPrimary},errorContainer:{padding:16,color:a(632079).Tj.red.text.accentPrimary,fontSize:14}};function u(e){let{spaceId:t}=e,r=(0,a(533992).v3)(),[s,o]=(0,i.useState)(!0),[l,d]=(0,i.useState)(void 0),[u,h]=(0,i.useState)(void 0),[y,g]=(0,i.useState)(void 0),[x,f]=(0,i.useState)(c),[b,v]=(0,i.useState)(!1),[j,k]=(0,i.useState)(!1),[S,w]=(0,i.useState)(!1),[I,C]=(0,i.useState)(!1),[D,T]=(0,i.useState)(void 0),R=(0,i.useCallback)(async()=>{o(!0),d(void 0);let e=await r.api.callApi({eventName:"adminGetWorkersRateLimitConfig",environment:r,data:{spaceId:t}});if("success"===e.type){var i,n,s,l,p,m,u,y,x,b,v;h(e.data.defaults),g(e.data.overrides),f((i=e.data.overrides)?{buildLimit:(null==(n=i.build)||null==(n=n.limit)?void 0:n.toString())??"",buildBurstLimit:(null==(s=i.build)||null==(s=s.burstLimit)?void 0:s.toString())??"",syncLimit:(null==(l=i.sync)||null==(l=l.limit)?void 0:l.toString())??"",syncBurstLimit:(null==(p=i.sync)||null==(p=p.burstLimit)?void 0:p.toString())??"",capabilityLimit:(null==(m=i.capability)||null==(m
106=m.limit)?void 0:m.toString())??"",capabilityBurstLimit:(null==(u=i.capability)||null==(u=u.burstLimit)?void 0:u.toString())??"",syncCollectionOpsLimit:(null==(y=i.syncCollectionOps)||null==(y=y.limit)?void 0:y.toString())??"",syncCollectionOpsBurstLimit:(null==(x=i.syncCollectionOps)||null==(x=x.burstLimit)?void 0:x.toString())??"",webhookLimit:(null==(b=i.webhook)||null==(b=b.limit)?void 0:b.toString())??"",webhookBurstLimit:(null==(v=i.webhook)||null==(v=v.burstLimit)?void 0:v.toString())??""}:c)}else d((0,a(201790).V4)(e));o(!1)},[r,t]);(0,i.useEffect)(()=>{R()},[R]);let A=(0,i.useCallback)(e=>t=>{f(a=>({...a,[e]:t.target.value})),T(void 0)},[]),N=(0,i.useCallback)(()=>{v(!0),T(void 0)},[]),M=(0,i.useCallback)(async()=>{let e,i,n,s,o,l,d,c,p,m,u;k(!0),T(void 0);let h=(e={},i=x.buildLimit.trim(),n=x.buildBurstLimit.trim(),(i||n)&&(e.build={},i&&(e.build.limit=Number(i)),n&&(e.build.burstLimit=Number(n))),s=x.syncLimit.trim(),o=x.syncBurstLimit.trim(),(s||o)&&(e.sync={},s&&(e.sync.limit=Number(s)),o&&(e.sync.burstLimit=Number(o))),l=x.capabilityLimit.trim(),d=x.capabilityBurstLimit.trim(),(l||d)&&(e.capability={},l&&(e.capability.limit=Number(l)),d&&(e.capability.burstLimit=Number(d))),c=x.syncCollectionOpsLimit.trim(),p=x.syncCollectionOpsBurstLimit.trim(),(c||p)&&(e.syncCollectionOps={},c&&(e.syncCollectionOps.limit=Number(c)),p&&(e.syncCollectionOps.burstLimit=Number(p))),m=x.webhookLimit.trim(),u=x.webhookBurstLimit.trim(),(m||u)&&(e.webhook={},m&&(e.webhook.limit=Number(m)),u&&(e.webhook.burstLimit=Number(u))),e),y=await r.api.callApi({eventName:"adminSetWorkersRateLimitConfig",environment:r,data:{spaceId:t,...h}});"success"===y.type?(T({type:"success",text:"Overrides saved successfully."}),v(!1),await R()):T({type:"error",text:(0,a(201790).V4)(y)}),k(!1)},[r,t,x,R]),P=(0,i.useCallback)(async()=>{w(!0),T(void 0);let e=await r.api.callApi({eventName:"adminResetWorkersRateLimitConfig",environment:r,data:{spaceId:t}});"success"===e.type?(T({type:"success",text:"Overrides reset to defaults."}),C(!1),v(!1),await R()):T({type:"error",text:(0,a(201790).V4)(e)}),w(!1)},[r,t,R]),V=(0,i.useCallback)(()=>{I?P():C(!0)},[I,P]),E=(0,i.useCallback)(()=>{C(!1)},[]);return s?(0,n.jsx)("div",{style:m.panel,children:(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:32,children:(0,n.jsx)(a(517334).k,{size:24})})}):l?(0,n.jsxs)("div",{style:m.panel,children:[(0,n.jsx)("div",{style:m.title,children:"Rate Limit Configuration"}),(0,n.jsx)("div",{style:m.errorContainer,children:l})]}):u?(0,n.jsxs)("div",{style:m.panel,children:[(0,n.jsx)("div",{style:m.title,children:"Rate Limit Configuration"}),null!=y&&y.updatedBy?(0,n.jsxs)("div",{style:m.metadata,children:["Last updated by ",y.updatedBy,y.updatedAt?` at ${new Date(y.updatedAt).toLocaleString()}`:""]}):void 0,(0,n.jsxs)("div",{style:m.grid,children:[(0,n.jsx)("div",{style:m.gridHeader,children:"Category"}),(0,n.jsx)("div",{style:m.gridHeader,children:"Metric"}),(0,n.jsx)("div",{style:m.gridHeaderNumeric,children:"Duration"}),(0,n.jsx)("div",{style:m.gridHeaderNumeric,children:"Default"}),(0,n.jsx)("div",{style:m.gridHeaderNumeric,children:"Override"}),(0,n.jsx)("div",{style:m.gridHeaderNumeric,children:"Effective"}),p.map(e=>{var t;let a=e.getOverride(y),r=a??u[e.defaultKey];return(0,n.jsxs)(i.Fragment,{children:[(0,n.jsx)("div",{style:m.gridCellCategory,children:e.category}),(0,n.jsx)("div",{style:m.gridCell,children:e.metric}),(0,n.jsx)("div",{style:m.gridCellNumeric,children:e.durationKey?(t=u[e.durationKey])>=3600&&t%3600==0?`${t/3600}h`:t>=60&&t%60==0?`${t/60}m`:`${t}s`:(0,n.jsx)("span",{style:m.overrideEmpty,children:"—"})}),(0,n.jsx)("div",{style:m.gridCellNumeric,children:u[e.defaultKey]}),(0,n.jsx)("div",{style:m.gridCellNumeric,children:b?(0,n.jsx)("input",{type:"number",value:x[e.inputKey],onChange:A(e.inputKey),placeholder:String(u[e.defaultKey]),style:m.input}):void 0!==a?a:(0,n.jsx)("span",{style:m.overrideEmpty,children:"—"})}),(0,n.jsx)("div",{style:m.gridCellNumeric,children:r})]},e.inputKey)})]}),(0,n.jsxs)(a(4458).fI,{gap:8,marginTop:16,alignItems:"center",children:[b?(0,n.jsx)(a(912946).j,{onClick:M,disabled:j,children:j?"Saving...":"Save Overrides"}):(0,n.jsx)(a(912946).j,{onClick:N,children:"Edit Overrides"}),I?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(548436).A,{onClick:V,disabled:S,children:S?"Resetting...":"Are you sure?"}),S?void 0:(0,n.jsx)(a(548436).A,{onClick:E,children:"Cancel"})]}):(0,n.jsx)(a(548436).A,{onClick:V,children:"Reset to Defaults"}),D?(0,n.jsx)("span",{style:{...m.statusMessage,..."success"===D.type?m.successMessage:m.errorMessage},children:D.text}):void 0]})]}):(0,n.jsxs)("div",{style:m.panel,children:[(0,n.jsx)("div",{style:m.title,children:"Rate Limit Configuration"}),(0,n.jsx)("div",{style:m.errorContainer,children:"No data available."})]})}let h=[{type:"workerId",label:"Worker ID",description:"Enter the Space ID, a slash, then the Worker ID.",placeholder:"Enter space ID / worker ID"},{type:"spaceId",label:"Space ID",description:"List every worker in a workspace.",placeholder:"Enter a space ID"},{type:"userId",label:"User ID",description:"Find workers in workspaces the user belongs to.",placeholder:"Enter a user ID"},{type:"email",label:"User Email",description:"Find workers in workspaces linked to an email.",placeholder:"Enter a user email"}];function y(e){let t=e.split("/").map(e=>e.trim());if(2!==t.length)return;let[i,n]=t;if(!i||!n)return;let r=i.toLowerCase();return{spaceId:(0,a(83388).c_)(r)?(0,a(83388).np)(r):r,workerId:n}}let g={adminWrap:(0,a(120308).pj)(),admin:a(120308).zR,adminItem:(0,a(120308).Uw)(),title:{fontSize:18,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:8},description:{fontSize:13,color:a(632079).Tj.text.secondary,lineHeight:1.5,marginBottom:16},form:{display:"flex",flexDirection:"column",gap:16},label:{fontSize:12,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary},buttonRow:{marginTop:4},sectionTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary,marginBottom:16,width:"100%"},errorContainer:{padding:24,color:a(632079).Tj.red.text.accentPrimary,backgroundColor:a(632079).Tj.red.background.primary,borderRadius:8,width:"100%"},workersListContainer:{width:"100%"},breadcrumb:{marginBottom:16,width:"100%"},breadcrumbLink:{color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"none",fontSize:14,cursor:"pointer"}};function x({apiName:e,defaultSpaceId:t}){let i=(0,a(743187).g)(),{apiOwnershipMap:r,currentUserPermissions:s}=(0,a(579993).K8)(()=>{let{apiOwnershipMap:e,currentUserPermissions:t}=i.state;return{apiOwnershipMap:e,currentUserPermissions:t}},[i]),o=a(688211)._P[e];if(!o)return null;let l=s?s.has(e):void 0,d=r?r[e]:void 0;return(0,n.jsx)(a(869589).RE,{style:g.adminItem,api:o,owner:d,hasPermission:l,source:"admin_tool_page",defaultParams:t?{spaceId:t}:void 0,showDefaultParams:!!t})}function f(e){let{spaceId:t,userId:a,email:i}=e;return t||a||i?(0,n.jsx)(v,{spaceId:t,userId:a,email:i}):(0,n.jsx)(b,{})}function b(){let[e,t]=(0,i.useState)("workerId"),[r,s]=(0,i.useState)(""),[o,l]=(0,i.useState)(!1),c=h.find(t=>t.type===e);if(!c)throw Error("Unknown Worker search type");let p="workerId"===e?void 0!==y(r):!!r.trim(),m=(0,i.useCallback)(()=>{let t=r.trim();t&&("workerId"!==e||void 0!==y(t))&&l(!0)},[r,e]),u=(0,i.useCallback)(e=>{e.preventDefault(),m()},[m]);(0,i.useEffect)(()=>
106{if(o){let t=r.trim();if(t)if("workerId"===e){let e=y(t);e&&(0,a(318620).Y)(`/__admin/workers/detail/${encodeURIComponent(e.spaceId)}/${encodeURIComponent(e.workerId)}`)}else(0,a(318620).Y)(`/__admin/workers?${e}=${encodeURIComponent(t)}`)}},[r,e,o]);let f=(0,i.useCallback)(e=>{s(e.target.value)},[]),b=(0,i.useCallback)(e=>{"Enter"===e.key&&(e.preventDefault(),m())},[m]);return(0,n.jsx)(a(45062).A,{title:"Workers - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"workers",children:(0,n.jsx)("div",{style:g.adminWrap,children:(0,n.jsxs)("div",{style:g.admin,children:[(0,n.jsxs)("div",{style:g.adminItem,children:[(0,n.jsx)("div",{style:g.title,children:"Find Workers"}),(0,n.jsx)("div",{style:g.description,children:"Choose what you have, then enter its ID or email."}),(0,n.jsxs)("form",{onSubmit:u,style:g.form,children:[(0,n.jsx)(a(543313).A,{selectedTitle:c.label,buttonVariant:"outline",buttonProps:{size:"md",width:"fill"},renderMenuSections:i=>[{key:"worker-search-types",items:h.map(r=>({key:r.type,action:()=>{t(r.type),s(""),l(!1),i.close()},render:t=>(0,n.jsx)(a(95582).A,{...t,title:r.label,isChecked:r.type===e})}))}]}),(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)("label",{htmlFor:"worker-search-query",style:g.label,children:c.label}),(0,n.jsx)(a(287562).p,{id:"worker-search-query",type:"email"===e?"email":"text",value:r,onChange:f,onSubmit:b,placeholder:c.placeholder,focusInitial:!0}),(0,n.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:c.description})]}),(0,n.jsx)("div",{style:g.buttonRow,children:(0,n.jsx)(a(912946).j,{onClick:m,disabled:!p,children:"Search"})})]})]}),(0,n.jsx)(d,{}),(0,n.jsx)(x,{apiName:"adminDisableWorker"}),(0,n.jsx)(x,{apiName:"adminEnableWorker"})]})})})})}function v(e){let{spaceId:t,userId:r,email:s}=e,l=t?{queryValue:t,queryType:"spaceId"}:r?{queryValue:r,queryType:"userId"}:{queryValue:s||"",queryType:"userEmail"},d=(0,a(533992).v3)(),[c,p]=(0,i.useState)(!0),[m,h]=(0,i.useState)(void 0),[y,f]=(0,i.useState)(void 0);(0,i.useEffect)(()=>{!async function(){p(!0),h(void 0);let e=await d.api.callApi({eventName:"adminGetWorkers",environment:d,data:{query:l.queryValue,queryType:l.queryType}});"success"===e.type?f(e.data):h((0,a(201790).V4)(e)),p(!1)}()},[d,l.queryType,l.queryValue]);let b=(null==y?void 0:y.spaceId)??t;return(0,n.jsx)(a(45062).A,{title:"Workers - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"workers",children:(0,n.jsx)("div",{style:g.adminWrap,children:(0,n.jsxs)("div",{style:g.admin,children:[(0,n.jsx)("div",{style:g.breadcrumb,children:(0,n.jsx)(a(68774).N,{href:"/__admin/workers",style:g.breadcrumbLink,children:"← Back to Workers Search"})}),(0,n.jsx)("h1",{style:g.sectionTitle,children:"Workers"}),c?(0,n.jsx)(a(4458).fI,{justifyContent:"center",alignItems:"center",padding:48,width:"100%",children:(0,n.jsx)(a(517334).k,{size:32})}):m?(0,n.jsx)("div",{style:g.errorContainer,children:m}):y?(0,n.jsx)("div",{style:g.workersListContainer,children:(0,n.jsx)(a(850471).V,{data:y})}):void 0,(0,n.jsx)("h1",{style:g.sectionTitle,children:"Rate Limits"}),b?(0,n.jsx)(u,{spaceId:b}):void 0,(0,n.jsx)("h1",{style:g.sectionTitle,children:"Emergency Brake"}),b?(0,n.jsx)(o,{spaceId:b}):void 0,(0,n.jsx)("h1",{style:g.sectionTitle,children:"Disable / Enable Worker"}),(0,n.jsx)(x,{apiName:"adminDisableWorker",defaultSpaceId:b}),(0,n.jsx)(x,{apiName:"adminEnableWorker",defaultSpaceId:b})]})})})})}},799615(e,t,a){var i=a(635790),n=a(440302);let r={cursor:"pointer",background:"none",border:"none",padding:0,font:"inherit",color:"inherit",textAlign:"inherit"},s={whiteSpace:"nowrap"};function o({value:e,formatUuid:t=!1,ariaLabel:l,children:d}){let[c,p]=(0,i.useState)(!1),m=(0,i.useRef)(void 0);(0,i.useEffect)(()=>()=>{void 0!==m.current&&clearTimeout(m.current)},[]);let u=(0,i.useCallback)(async()=>{try{await navigator.clipboard.writeText(t?(0,a(137691).s_)(e):e),p(!0),void 0!==m.current&&clearTimeout(m.current),m.current=setTimeout(()=>p(!1),2e3)}catch(e){(0,a(208318).t)().log({level:"warning",from:"ClickToCopy",type:"clipboardCopyFailed",error:(0,a(952977).convertErrorToLog)(e)})}},[t,e]);return(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)("button",{type:"button","aria-label":l,onClick:u,style:r,children:d}),c?(0,n.jsx)(a(4458).fI,{style:s,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Copied!"})}):void 0]})}a.d(t,{B:()=>o})},129611(e,t,a){var i=a(635790),n=a(440302);function r(e){let{targetId:t,label:r,initialAmount:o,disabled:l,onAmountChange:d}=e,[c,p]=(0,i.useState)(void 0===o?"":String(o)),m=function(e){let t=e.trim();if(""===t)return;let a=Number(t);return Number.isFinite(a)?Number.isInteger(a)?a<=0?"Must be more than 0":Number.isSafeInteger(a)?void 0:"Too large":"Whole credits only":"Enter a number"}(c),u=(0,i.useCallback)(e=>{let a=e.target.value;p(a),d(t,function(e){let t=e.trim();if(""===t)return;let a=Number(t);if(Number.isSafeInteger(a)&&!(a<=0))return a}(a))},[t,d]);return(0,n.jsxs)(a(4458).VP,{gap:2,width:160,children:[(0,n.jsx)(a(287562).p,{type:"number",value:c,placeholder:"0",disabled:l,errorOutline:void 0!==m,onChange:u,inputElementAttributes:{"aria-label":r},overrideDefaultWidth:!0,style:s.amountInput}),void 0===m?void 0:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:m})]})}let s={amountInput:{width:120}};a.d(t,{o2:()=>r})},851826(e,t,a){a.r(t),a.d(t,{EvalAgentDispatch:()=>l}),a(533958),a(730330),a(976614),a(159952),a(176765),a(851344),a(866491);var i=a(635790);let n=(0,a(477465).Dv)("nightly-eval-agent");var r=a(440302);let s={error:{padding:12,backgroundColor:a(632079).Tj.red.background.secondary,color:a(632079).Tj.red.text.primary,borderRadius:6},success:{padding:12,backgroundColor:a(632079).Tj.green.background.secondary,color:a(632079).Tj.green.text.primary,borderRadius:6},link:{color:a(632079).Tj.blue.text.primary,textDecoration:"none",cursor:"pointer"}};function o(e){let t=String(e??"").trim();if(""===t)return;let a=Number(t);return Number.isFinite(a)?a:void 0}function l(){let e=(0,a(533992).v3)(),t=(0,a(743187).g)(),n=(0,a(47602).S)(t,"dispatchEvalAgent"),l=(0,a(579993).K8)(()=>{var t;let i=(0,a(427846)._)(e);return(t=null==i?void 0:i.getName())?t.split(" ")[0]??"":""},[e]),d=(0,i.useMemo)(()=>(function(){if("u"<typeof window)return{};let e=new URLSearchParams(window.location.search),t=e.get("concurrency"),a=e.get("iterations");return{project:e.get("project")||void 0,dataset:e.get("dataset")||void 0,datasetFilter:e.get("datasetFilter")||void 0,modelNames:e.get("modelNames")||void 0,concurrency:t&&Number.isFinite(Number(t))?Number(t):void 0,iterations:a&&Number.isFinite(Number(a))?Number(a):void 0,experimentSuffix:e.get("experimentSuffix")||void 0,slackChannelId:e.get("slackChannelId")||void 0,retryFailedEvalsIterations:e.get("retryFailedEvalsIterations")||void 0,passThreshold:e.get("passThreshold")||void 0,logPerMemoryMetrics:function(e){if(null===e)return;let t=e.trim().toLowerCase();return"true"===t||"1"===t||"false"!==t&&"0"!==t&&void 0}(e.get("logPerMemoryMetrics"))}})(),[]),c=(0,i.useMemo)(()=>({project:{type:"string",title:"Project",byline:"Braintrust project name",defaultValue:d.project??"personal-agent-evals"},dataset:{type:"string",title:"Dataset",byline:"Braintrust dataset name",defaultValue:d.dataset??"script-agent-eval-agent-baseline-live"}}),[d]),p=(0,i.useMemo)(()=>({datasetFilter:{type:"string",title:"Dataset Filter",byline:"Optional Braintrust dataset filter expression",defaultValue:d.datasetFilter??""},modelNames:{type:"string",title:"Model Names",byline:"Comma-separated list of model names (e.g. anthropic-sonnet-alt-thinking,oatmeal-cookie)",defaultValue:d.modelNames??"anthropic-sonnet-alt-thinking,oatmeal-cookie"},concurrency:{type:"number",title:"Concurrency",byline:"Number of evals to run in parallel per model. For live search evals, set concurrency to 1.",defaultValue:d.concurrency??5,minValue:1},iterations:{type:"number",title:"Iterations",byline:"How many times to run each eval",defaultValue:d.iterations??1,minValue:1},experimentSuffix:{type:"string",title:"Experiment Suffix",byline:"Suffix appended to the Braintrust experiment name",defaultValue:d.experimentSuffix??(l?`${l.toLowerCase()}`:"ui-doc-dispatch")},slackChannelId:{type:"string",title:"Slack Channel ID",byline:"Slack channel for posting results (e.g. C0ADB6U3U03 = #alerts-cloud-eval-runs)",defaultValue:d.slackChannelId??"C0ADB6U3U03"},retryFailedEvalsIterations:{type:"string",title:"Retry Failed Evals Iterations",byline:"How many retry iterations for failed evals (leave empty for server default)",defaultValue:d.retryFailedEvalsIterations??""},passThreshold:{type:"string",title:"Pass Threshold",byline:"Pass threshold percentage for retry analysis",defaultValue:d.passThreshold??""},logPerMemoryMetrics:{type:"boolean",title:"Log Per-Memory Metrics",byline:"Log one Braintrust memory metric per memory test in addition to the aggregate memory score",defaultValue:d.logPerMemoryMetrics??!1}}),[l,d]),[m,u]=(0,a(254298)._5)(c),[h,y]=(0,a(254298)._5)(p),[g,x]=(0,i.useState)(!1),[f,b]=(0,i.useState)(),[v,j]=(0,i.useState)(),[k,S]=(0,i.useState)(!1);return(0,i.useCallback)(async()=>
106{if(!0!==n)return void j("You don't have the right role to access this Admin Mode tool.");x(!0),j(void 0),b(void 0);try{let t=await e.api.callApi({eventName:"dispatchEvalAgent",environment:e,data:{project:String(m.project??""),dataset:String(m.dataset??""),datasetFilter:h.datasetFilter?String(h.datasetFilter):void 0,modelNames:String(h.modelNames??"").split(",").map(e=>e.trim()).filter(Boolean),concurrency:Number(h.concurrency??5),iterations:Number(h.iterations??1),experimentSuffix:String(h.experimentSuffix??""),slackChannelId:h.slackChannelId?String(h.slackChannelId):void 0,retryFailedEvalsIterations:o(h.retryFailedEvalsIterations),passThreshold:o(h.passThreshold),logPerMemoryMetrics:!!h.logPerMemoryMetrics}});"success"===t.type?b(t.data):j(String(t.error))}catch(e){j(e instanceof Error?e.message:"Failed to dispatch workflow")}finally{x(!1)}},[m,h,e,n]),(0,i.useCallback)(()=>{S(e=>!e)},[]),(0,r.jsx)(a(45062).A,{title:"Eval Agent Dispatch - Notion Admin Mode",children:(0,r.jsx)(a(220952).U,{currentSection:"ai",children:(0,r.jsxs)(a(4458).VP,{gap:16,padding:36,width:"100%",maxWidth:960,children:[(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleLgSemibold",children:"Eval Agent Dispatch"}),(0,r.jsx)(a(111010).D,{styleKey:"bodyRegular",colorVariant:"secondary",children:"Dispatch an eval agent workflow. Creates a Braintrust experiment and runs evals from the provided dataset. Only available in local/dev environments. All controls can be set via URL params (e.g. ?project=...&dataset=...&modelNames=...&concurrency=10)."})]}),void 0===n?(0,r.jsx)("div",{children:"Loading permissions..."}):!1===n?(0,r.jsx)("div",{style:s.error,children:"You don't have the right role to access this Admin Mode tool."}):(0,r.jsx)("div",{style:s.error,children:"Eval Agent Dispatch is only available in local and development environments."})]})})})}encodeURIComponent(n)},941318(e,t,a){a(635790);var i=a(440302);let n={cursor:"pointer",textDecoration:"none",paddingInlineStart:6};function r({table:e,id:t}){let s=e;return("user"===s&&(s="notion_user"),(0,a(48697).Xk)(a(216612).oU,s))?(0,i.jsx)("a",{style:n,href:`/__admin/${s}/${t}`,children:"🔗"}):null}a.d(t,{k:()=>r})},949559(e,t,a){a.r(t),a.d(t,{MigrationDashboard:()=>ei}),a(533958),a(730330),a(139583),a(159952),a(176765),a(851344),a(866491);var i=a(635790);function n(e,t){let a=`index="${"production"===e?"application":"non_production_application"}" ${t}`;return`https://notion.splunkcloud.com/en-US/app/search/search?earliest=-7d%40d&latest=now&q=${encodeURIComponent(a)}&display.page.search.mode=smart&dispatch.sample_ratio=1`}a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(765324);var r=a(440302);let s={table:{width:"100%",borderCollapse:"collapse"},headerCell:{padding:"6px 12px",textAlign:"start",borderBottom:`2px solid ${a(632079).Tj.border.primary}`},cell:{padding:"6px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`},highlightCell:{padding:"6px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,background:a(632079).Tj.yellow.background.primary}},o={statsigProjectOverride:"Statsig project override",projectCodeDefault:"Project code default",statsigDefault:"Statsig default",statsigGlobal:"Statsig global",notSet:"Not set"},l={supervisor:"Supervisor",workers:"Workers",both:"Supervisor and workers"},d=new Set(["is_dry_run","universal_kill_switch","project_kill_switch"]);function c({effectiveConfig:e}){var t;let i;return(0,r.jsxs)(a(4458).VP,{gap:12,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Effective Config"}),"staleStatsigConfig"===e.type?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:"Statsig returned the fallback migration_task_supervisor_configs (is_not_default is false). The supervisor and workers stop on this config until Statsig recovers."}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(t=e.fields,(i=e=>t.some(t=>t.name===e&&!0===t.value))("universal_kill_switch")||i("project_kill_switch")?"Mode: stopped by kill switch":i("is_dry_run")?"Mode: dry run (no writes)":"Mode: live (writing)")}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Resolved now from Statsig migration_task_supervisor_configs and the project's code defaults. The supervisor re-reads it every loop and workers before every chunk."}),(0,r.jsx)(p,{fields:e.fields})]})]})}function p({fields:e}){return(0,r.jsxs)("table",{style:s.table,children:[(0,r.jsx)("thead",{children:(0,r.jsx)("tr",{children:["Setting","Value","Source","Read by"].map(e=>(0,r.jsx)("th",{style:s.headerCell,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:e})},e))})}),(0,r.jsx)("tbody",{children:e.map(e=>{var t;let i=d.has(e.name)&&!0===e.value?s.highlightCell:s.cell;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:i,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.name})}),(0,r.jsx)("td",{style:i,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:void 0===(t=e.value)?"—":"number"==typeof t?t.toLocaleStr
106ing():String(t)})}),(0,r.jsx)("td",{style:i,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:o[e.source]})}),(0,r.jsx)("td",{style:i,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:l[e.readBy]})})]},e.name)})})]})}let m={root:{zIndex:1},wrapper:{position:"relative",maxWidth:400},dropdown:{...(0,a(120308).Ib)(),maxHeight:320,overflowY:"auto"}};function u({projects:e,isOpen:t,comboboxProps:n,inputValue:s,selectedProject:o,onSelectProject:l}){let d=(0,i.useMemo)(()=>{let t=s.toLowerCase(),i=[...e].filter(e=>e.toLowerCase().includes(t)).sort();return 0===i.length?[{key:"no-match",items:[{key:"no-match-item",action:()=>{},render:e=>(0,r.jsx)(a(95582).A,{...e,title:"No matching projects",disabled:!0})}]}]:[{key:"projects",items:i.map(e=>({key:e,action:()=>{l(e)},render:t=>(0,r.jsx)(a(95582).A,{...t,title:e,isChecked:e===o})}))}]},[e,s,o,l]);return t?(0,r.jsx)("div",{role:"presentation",style:m.dropdown,onMouseDown:e=>e.preventDefault(),children:(0,r.jsx)(a(558045).A,{type:a(558045).O.Vertical,comboboxProps:n,role:"listbox",initialFocus:void 0,sections:d})}):null}function h({projects:e,selectedProject:t,onSelect:n}){let[s,o]=(0,i.useState)(t??""),[l,d]=(0,i.useState)(!1),[c,p]=(0,a(739271).s)();(0,i.useEffect)(()=>{l||o(t??"")},[t,l]);let y=(0,i.useCallback)(e=>{o(e.target.value),d(!0)},[]),g=(0,i.useCallback)(()=>{c.onFocus(),d(!0)},[c]),x=(0,i.useCallback)(()=>{c.onBlur(),d(!1),o(t??"")},[c,t]),f=(0,i.useCallback)(()=>{o(""),n(void 0)},[n]),b=(0,i.useCallback)(e=>{o(e),n(e),d(!1)},[n]);return(0,r.jsxs)(a(4458).VP,{gap:8,style:m.root,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"Migration Project"}),(0,r.jsxs)("div",{style:m.wrapper,children:[(0,r.jsx)(a(287562).p,{value:s,placeholder:"Search for a migration…",showClearButton:!0,forceShowClearButton:!0,clearButtonStyle:{visibility:s.length>0?"visible":"hidden"},onChange:y,onFocus:g,onBlur:x,onClearButtonClick:f,inputElementAttributes:{role:"combobox",...l?c.inputElementAttributes:void 0,"aria-expanded":l},suppressFocusRing:c.suppressFocusRing}),(0,r.jsx)(u,{projects:e,isOpen:l,comboboxProps:p,inputValue:s,selectedProject:t,onSelectProject:b})]})]})}a(976614);let y=(0,a(327219).YK)({permissionDenied:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.permissionDenied",defaultMessage:"You don’t have permission to list DynamoDB data-lake exports."},exportName:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.exportName",defaultMessage:"Export:"},chooseExport:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.chooseExport",defaultMessage:"Choose an export"},runLabel:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.runLabel",defaultMessage:"Run:"},chooseRun:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.chooseRun",defaultMessage:"Choose a run"},totalRowCount:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.totalRowCount",defaultMessage:"Total rows (all regions): {rowCount, number}"},regionsLabel:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.regionsLabel",defaultMessage:"Regions"},regionRowAndTableCount:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.regionRowAndTableCount",defaultMessage:"{region} ({rowCount, plural, one {# row} other {# rows}}; {tableCount, plural, one {# table} other {# tables}})"},tableRowCount:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.tableRowCount",defaultMessage:"{tableName} ({rowCount, plural, one {# row} other {# rows}})"},loading:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.loading",defaultMessage:"Loading DynamoDB exports…"},loadError:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.loadError",defaultMessage:"Couldn’t load DynamoDB exports."},retry:{id:"migrationDashboard.dynamoDbDataLakeSourceSelector.retry",defaultMessage:"Retry"}}),g=(0,a(208318).t)();function x(e){var t,n,s;let{permissionsStore:o,onChange:l}=e,d=(0,a(533992).v3)(),c=(0,a(327219).tz)(),p=(0,a(47602).S)(o,"adminListDynamoDbDataLakeCsvExports"),[m,u]=(0,i.useState)(),[h,x]=(0,i.useState)(),[j,k]=(0,i.useState)([]),[S,w]=(0,a(97668).Yb)(async()=>
106{if(!0===p)return await v({environment:d,data:{}})},[d,p],{debugName:"MigrationDashboard.listDynamoDbExportNames"}),[I,C]=(0,a(97668).Yb)(async()=>{if(!0===p&&void 0!==m)return await v({environment:d,data:{exportName:m}})},[m,d,p],{debugName:"MigrationDashboard.listDynamoDbExports"}),[D,T]=(0,a(97668).Yb)(async()=>{if(!0===p&&void 0!==m&&void 0!==h)return await v({environment:d,data:{exportName:m,exportTime:h}})},[m,d,h,p],{debugName:"MigrationDashboard.getDynamoDbExport"}),R=null==(t=D.value)?void 0:t.selectedExport,A="resolved"===D.status&&void 0!==R&&R.exportName===m&&R.exportTime===h?R:void 0;(0,i.useEffect)(()=>{k((null==A?void 0:A.regionalTables.map(e=>e.region))??[])},[A]),(0,i.useEffect)(()=>{l(void 0!==m&&void 0!==h&&j.length>0?{exportName:m,exportTime:h,regions:j}:void 0)},[m,h,l,j]);let N=(0,i.useCallback)(e=>{e!==m&&(u(e),x(void 0),k([]))},[m]),M=(0,i.useCallback)(e=>{e!==h&&(x(e),k([]))},[h]),P=(0,i.useCallback)(e=>{k(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),V=(null==(n=S.value)?void 0:n.exportNames)??[],E=(null==(s=I.value)?void 0:s.runs)??[],B="rejected"===S.status?w:"rejected"===I.status?C:"rejected"===D.status?T:void 0,L=(0,i.useCallback)(()=>{void 0!==B&&B().catch(e=>{g.error({from:"DynamoDbDataLakeSourceSelector",type:"retryLoadExportsFailed",error:e instanceof Error?e:Error(String(e))})})},[B]),_="pending"===S.status||"pending"===I.status||"pending"===D.status;return!1===p?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:c.formatMessage(y.permissionDenied)}):(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(f,{label:c.formatMessage(y.exportName),selectedTitle:m??c.formatMessage(y.chooseExport),items:V,onSelect:N}),(0,r.jsx)(f,{label:c.formatMessage(y.runLabel),selectedTitle:h??c.formatMessage(y.chooseRun),items:E.map(e=>e.exportTime),onSelect:M,disabled:void 0===m}),A?(0,r.jsxs)(a(4458).VP,{gap:6,children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:c.formatMessage(y.totalRowCount,{rowCount:A.totalRowCount})}),(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:c.formatMessage(y.regionsLabel)}),A.regionalTables.map(e=>(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(b,{region:e.region,tableCount:e.tables.length,rowCount:e.totalRowCount,checked:j.includes(e.region),onToggle:P}),(0,r.jsx)(a(4458).VP,{as:"ul",gap:4,margin:0,paddingInlineStart:24,children:e.tables.map(e=>(0,r.jsx)("li",{children:(0,r.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:c.formatMessage(y.tableRowCount,{tableName:e.dynamoTableName,rowCount:e.rowCount})})},e.dynamoTableName))})]},e.region))]}):void 0,_?(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:c.formatMessage(y.loading)})]}):void 0,void 0!==B?(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:c.formatMessage(y.loadError)}),(0,r.jsx)(a(548436).A,{size:"sm",onClick:L,children:c.formatMessage(y.retry)})]}):void 0]})}function f(e){let{label:t,selectedTitle:i,items:n,onSelect:s,disabled:o}=e;return(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:t}),(0,r.jsx)(a(543313).A,{selectedTitle:i,disabled:o||0===n.length,menuWidth:"max-content",renderMenuSections:e=>[{key:t,items:n.map(t=>({key:t,action:()=>{s(t),e.close()},render:e=>(0,r.jsx)(a(95582).A,{...e,title:t,dontShrinkTitle:!0,isChecked:t===i})}))}]})]})}function b(e){let{region:t,tableCount:n,rowCount:s,checked:o,onToggle:l}=e,d=(0,a(327219).tz)(),c=(0,i.useCallback)(()=>{l(t)},[l,t]),p=`dynamodb-data-lake-region-${t}`;return(0,r.jsxs)(a(4458).fI,{as:"label",gap:8,alignItems:"center",children:[(0,r.jsx)(a(382726).S,{checked:o,size:16,onClick:c,"aria-labelledby":p}),(0,r.jsx)(a(111010).D,{id:p,styleKey:"bodySmRegular",children:d.formatMessage(y.regionRowAndTableCount,{region:t,tableCount:n,rowCount:s})})]})}async function v(e){let t=await e.environment.api.callApi({eventName:"adminListDynamoDbDataLakeCsvExports",environment:e.environment,data:e.data});if("success"!==t.type)throw Error((0,a(201790).V4)(t));return t.data}let j={box:{padding:12,borderRadius:8,border:`1px solid ${a(632079).Tj.red.border.primary}`,background:a(632079).Tj.red.background.primary}},k=(0,a(327219).YK)({activeSourceTitle:{id:"migrationDashboard.quickActions.activeSourceTitle",defaultMessage:"Migration source"},exportName:{id:"migrationDashboard.quickActions.exportName",defaultMessage:"Export:"},exportLabel:{id:"migrationDashboard.quickActions.exportLabel",defaultMessage:"Run:"},regionsLabel:{id:"migrationDashboard.quickActions.regionsLabel",defaultMessage:"Regions:"},s3DirectoryLabel:{id:"migrationDashboard.quickActions.s3DirectoryLabel",defaultMessage:"S3 directory:"},sourceUnavailable:{id:"migrationDashboard.quickActions.sourceUnavailable",defaultMessage:"Source details are unavailable for this supervisor."}});function S(e){var t;let n=(0,a(533992).v3)(),{project:s,projectType:o,permissionsStore:l,actionInProgress:d,callAction:c,statusData:p}=e,m=(0,a(47602).S)(l,"adminCreateMigrationSupervisor"),u=(0,a(47602).S)(l,"adminListDataLakeCsvExportDirectories"),[h,y]=(0,i.useState)(""),g=(0,i.useId)(),f="postgresFromDataLakeCsvExport"===o,b="dynamoDbFromDataLakeCsvExport"===o,v=h.trim(),[j,k]=(0,i.useState)(void 0),S=void 0!==p&&"not_found"!==p.supervisorState,I=(0,i.useCallback)(e=>{k(e)},[]),[C]=(0,a(97668).Yb)(async()=>
106{if(S||!f||!0!==m||!0!==u)return[];let e=await n.api.callApi({eventName:"adminListDataLakeCsvExportDirectories",environment:n,data:{}});if("success"!==e.type)throw Error((0,a(201790).V4)(e));return e.data.directories},[n,u,m,f,S],{debugName:"MigrationDashboard.listDataLakeCsvExportDirectories"}),D=C.value??[],T="pending"===C.status?"Loading…":0===D.length?"None found":"Browse",R=(0,i.useCallback)(()=>{var e;c("Create Supervisor","adminCreateMigrationSupervisor",(e={project:s,requiresS3DirectoryPath:f,normalizedS3DirectoryPath:v,requiresDynamoDbDataLakeSource:b,dynamoDbDataLakeSource:j}).requiresS3DirectoryPath?{project:e.project,input:{type:"postgresFromDataLakeCsvExport",s3DirectoryPath:e.normalizedS3DirectoryPath}}:e.requiresDynamoDbDataLakeSource&&void 0!==e.dynamoDbDataLakeSource?{project:e.project,input:{type:"dynamoDbFromDataLakeCsvExport",...e.dynamoDbDataLakeSource}}:{project:e.project})},[c,j,v,s,b,f]);return m?S?(0,r.jsx)(w,{projectType:o,source:null==p?void 0:p.source}):(0,r.jsxs)(a(4458).VP,{gap:8,children:[f?(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{id:g,styleKey:"captionSemibold",colorVariant:"secondary",children:"S3 directory path"}),(0,r.jsx)(a(287562).p,{value:h,onChange:e=>y(e.currentTarget.value),placeholder:"Enter a path or choose a discovered directory",format:"small",inputElementAttributes:{"aria-labelledby":g},right:(0,r.jsx)(a(543313).A,{selectedTitle:T,disabled:"pending"===C.status||0===D.length,menuWidth:"max-content",renderMenuSections:e=>[{key:"csv-export-directories",items:D.map(t=>({key:t,action:()=>{y(t),e.close()},render:e=>(0,r.jsx)(a(95582).A,{...e,title:t,dontShrinkTitle:!0,isChecked:t===h})}))}]}),isRightLastElementOfInput:!0}),"pending"===C.status?(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Loading CSV export directories…"})]}):void 0,!1===u?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:"You don't have permission to list CSV export directories."}):"rejected"===C.status?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:(null==(t=C.error)?void 0:t.message)??"Failed to load CSV export directories"}):void 0]}):void 0,b?(0,r.jsx)(x,{permissionsStore:l,onChange:I}):void 0,(0,r.jsx)(a(548436).A,{onClick:R,disabled:S||void 0!==d||f&&0===v.length||b&&void 0===j,children:"Create Supervisor"===d?"Creating...":"Create Supervisor"})]}):null}function w(e){let{projectType:t,source:i}=e,n=(0,a(327219).tz)();return(null==i?void 0:i.type)==="dynamoDbFromDataLakeCsvExport"?(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:n.formatMessage(k.activeSourceTitle)}),(0,r.jsx)(I,{label:n.formatMessage(k.exportName),value:i.exportName}),(0,r.jsx)(I,{label:n.formatMessage(k.exportLabel),value:i.exportTime}),(0,r.jsx)(I,{label:n.formatMessage(k.regionsLabel),value:i.regionalManifests.map(e=>e.region).join(", ")})]}):(null==i?void 0:i.type)==="postgresFromDataLakeCsvExport"?(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:n.formatMessage(k.activeSourceTitle)}),(0,r.jsx)(I,{label:n.formatMessage(k.s3DirectoryLabel),value:i.s3DirectoryPath})]}):"dynamoDbFromDataLakeCsvExport"===t||"postgresFromDataLakeCsvExport"===t?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n.formatMessage(k.sourceUnavailable)}):null}function I(e){return(0,r.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:e.label}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.value})]})}function C({project:e,permissionsStore:t,actionInProgress:n,callAction:s,statusData:o}){let l=(0,a(47602).S)(t,"adminResumeMigrationSupervisor"),d=void 0!==o&&("failed_retryable"===o.supervisorState||"failed_not_retryable"===o.supervisorState||"completed_require_attention"===o.supervisorState),c=(0,i.useCallback)(()=>{s("Resume Supervisor","adminResumeMigrationSupervisor",{project:e})},[s,e]);return l?(0,r.jsx)(a(548436).A,{onClick:c,disabled:!d||void 0!==n,children:"Resume Supervisor"===n?"Resuming...":"Resume Supervisor"}):null}function D({project:e,permissionsStore:t,actionInProgress:n,callAction:s,statusData:o}){let l=(0,a(47602).S)(t,"adminResumeMigrationWorkersForSupervisor"),d=void 0!==o&&(o.workerCountsByState.failed_not_retryable??0)>0,c=(0,i.useCallback)(()=>{s("Resume All Workers","adminResumeMigrationWorkersForSupervisor",{project:e,migrationWorkerId:""})},[s,e]);return l?(0,r.jsx)(a(548436).A,{onClick:c,disabled:!d||void 0!==n,children:"Resume All Workers"===n?"Resuming...":"Resume All Failed Workers"}):null}function T({project:e,permissionsStore:t,actionInProgress:n,callAction:s,statusData:o}){let l=(0,a(47602).S)(t,"adminMarkMigrationSupervisorAsFailed"),d=void 0!==o&&"in_progress"===o.supervisorState,c=(0,i.useCallback)(()=>{s("Kill Running Supervisor","adminMarkMigrationSupervisorAsFailed",{project:e})},[s,e]);return l?(0,r.jsx)(a(548436).A,{onClick:c,colorPalette:"red",disabled:!d||void 0!==n,children:"Kill Running Supervisor"===n?"Killing...":"Kill running supervisor"}):null}function R({project:e,permissionsStore:t,actionInProgress:n,callAction:s,statusData:o,onCleanupComplete:l}){let d=(0,a(47602).S)(t,"adminCleanupMigrationProject"),[c,p]=(0,i.useState)(!1),m=(0,i.useCallback)(()=>{p(!1),s("Cleanup Project","adminCleanupMigrationProject",{project:e,confirmNoActiveWorkers:!0,confirmKillSwitchOrSafe:!0},l)},[s,e,l]);return d?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(548436).A,{onClick:()=>{p(!0)},colorPalette:"red",disabled:void 0===o||void 0!==n,children:"Cleanup Project"===n?"Cleaning up...":"Cleanup Project"}),c?(0,r.jsx)("div",{style:j.box,children:(0,r.jsxs)(a(4458).VP,{gap:8,children:[(null==o?void 0:o.supervisorState)==="in_progress"?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:"Warning: This migration is currently running. Cleaning up now may interrupt active workers and cause data loss."}):void 0,(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:"This will delete all supervisor and worker records for this project. You will lose the ability to resume failed workers. This action cannot be undone."}),(0,r.jsxs)(a(4458).fI,{gap:8,children:[(0,r.jsx)(a(548436).A,{onClick:m,colorPalette:"red",disabled:void 0!==n,children:"Confirm Cleanup"}),(0,r.jsx)(a(548436).A,{onClick:()=>{p(!1)},disabled:void 0!==n,children:"Cancel"})]})]})}):void 0]}):null}function A({project:e,projectType:t,statusData:n,permissionsStore:s,onActionComplete:o,onCleanupComplete:l}){let d=(0,a(533992).v3)(),[c,p]=(0,i.useState)(void 0),[m,u]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(void 0),g=(0,i.useCallback)(async(e,t,i,n)=>{if(!c){p(e),u(void 0),y(void 0);try{let r=await d.api.callApi({eventName:t,environment:d,data:i});"success"===r.type?(y(`${e} succeeded`),(n??o)()):u((0,a(201790).V4)(r))}catch(t){u(t instanceof Error?t.message:`${e} failed`)}finally{p(void 0)}}},[c,d,o]),x=(0,i.useCallback)((e,t,a,i)=>{g(e,t,a,i)},[g]);return(0,r.jsxs)(a(4458).VP,{gap:12,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Qu
106ick Actions"}),(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(S,{project:e,projectType:t,permissionsStore:s,actionInProgress:c,callAction:x,statusData:n},e),(0,r.jsx)(C,{project:e,permissionsStore:s,actionInProgress:c,callAction:x,statusData:n}),(0,r.jsx)(D,{project:e,permissionsStore:s,actionInProgress:c,callAction:x,statusData:n}),(0,r.jsx)(T,{project:e,permissionsStore:s,actionInProgress:c,callAction:x,statusData:n}),(0,r.jsx)(R,{project:e,permissionsStore:s,actionInProgress:c,callAction:x,statusData:n,onCleanupComplete:l})]}),(0,r.jsx)(a(590422).Q,{href:"https://dev.notion.so/notion/How-to-use-Scalable-Data-Migration-Framework-With-Supervisor-198b35e6e67f8057bdf2f106f91ac420",underline:!0,external:!0,inline:!0,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"accentPrimary",children:"Migration Runbook"})}),m?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:m}):void 0,h?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"accentPrimary",children:h}):void 0]})}let N={completed:{bg:a(632079).Tj.green.background.primary,colorPalette:"green",label:"Completed"},in_progress:{bg:a(632079).Tj.blue.background.primary,colorPalette:"blue",label:"In Progress"},waiting:{bg:a(632079).Tj.yellow.background.primary,colorPalette:"yellow",label:"Waiting"},require_attention:{bg:a(632079).Tj.red.background.primary,colorPalette:"red",label:"Needs Attention"},completed_require_attention:{bg:a(632079).Tj.yellow.background.primary,colorPalette:"yellow",label:"Completed (Needs Attention)"}},M={display:"inline-block",padding:"2px 10px",borderRadius:12};function P({statusType:e}){let t=N[e];return(0,r.jsx)("span",{style:{...M,background:t.bg},children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorPalette:t.colorPalette,colorVariant:"accentPrimary",children:t.label})})}let V={minWidth:140},E={cursor:"pointer"};function B({data:e}){var t;return(0,r.jsxs)(a(4458).VP,{gap:12,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Supervisor Status"}),(0,r.jsx)(L,{label:"Supervisor ID",value:e.supervisorId,copyable:!0}),(0,r.jsx)(L,{label:"Project",value:e.project}),(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:V,children:"Status"}),(0,r.jsx)(P,{statusType:e.statusType})]}),(0,r.jsx)(L,{label:"Supervisor State",value:e.supervisorState}),e.queueTaskState?(0,r.jsx)(L,{label:"Queue Task",value:e.queueTaskState}):void 0,(0,r.jsx)(L,{label:"Status Message",value:e.statusMessage}),(0,r.jsx)(L,{label:"Total Rows Migrated",value:void 0!==e.totalMigratedRows?e.totalMigratedRows.toLocaleString():"N/A"}),(0,r.jsx)("a",{href:(t=e.supervisorId,n("production",`serviceName="queue" eventName="dataMigrationWorkerSupervisor" ("data.request.id"="${t}" OR "data.task.request.id"="${t}")`)),target:"_blank",rel:"noreferrer",style:E,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:"View supervisor Splunk logs"})})]})}function L({label:e,value:t,copyable:i}){return(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:V,children:e}),i?(0,r.jsx)(a(799615).B,{value:t,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t})}):(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t})]})}let _={not_started:{bg:a(632079).Tj.gray.background.primary,colorPalette:"gray",label:"Not started"},in_progress:{bg:a(632079).Tj.blue.background.primary,colorPalette:"blue",label:"In progress"},completed:{bg:a(632079).Tj.green.background.primary,colorPalette:"green",label:"Completed"},failed_retryable:{bg:a(632079).Tj.yellow.background.primary,colorPalette:"yellow",label:"Failed (retryable)"},failed_not_retryable:{bg:a(632079).Tj.red.background.primary,colorPalette:"red",label:"Failed (not retryable)"}},U={display:"inline-block",padding:"2px 8px",borderRadius:10};function W({state:e}){let t=_[e];return(0,r.jsx)("span",{style:{...U,background:t.bg},children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorPalette:t.colorPalette,color
106Variant:"accentPrimary",children:t.label})})}function F(e){return _[e].label}let K=["not_started","in_progress","completed","failed_retryable","failed_not_retryable"];function $({selectedStates:e,onChange:t}){let n=(0,i.useMemo)(()=>K.map(e=>({key:e,value:e,title:F(e)})),[]),s=(0,i.useCallback)(e=>{t(e)},[t]),o=function(e){if(0===e.length)return"Worker state: any";if(e.length===K.length)return"Worker state: all";let t=e.map(F);return t.length<=2?`Worker state: ${t.join(", ")}`:`Worker state: ${t[0]} +${t.length-1}`}(e);return(0,r.jsx)(a(380305).uI,{pillTitle:o,items:n,selectedItems:[...e],setSelectedItems:s})}(0,a(477465).Dv)("supervisorManagedDataMigrationWorker");let O={workerCard:{padding:12,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,background:a(632079).Tj.background.secondary},errorText:{wordBreak:"break-word"},splunkLink:{cursor:"pointer"},metadataPanel:{borderTop:`1px solid ${a(632079).Tj.border.secondary}`},metadataValue:{wordBreak:"break-word"}};function z({project:e,workers:t,selectedStates:i,onSelectedStatesChange:n,permissionsStore:s,onActionComplete:o}){return(0,r.jsxs)(a(4458).VP,{gap:12,children:[(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Workers"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:`(${t.length})`})]}),(0,r.jsx)($,{selectedStates:i,onChange:n}),0===t.length?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:0===i.length?"Pick at least one worker state above to load workers.":"No w
106orkers match the selected states."}):t.map(t=>(0,r.jsx)(G,{project:e,worker:t,permissionsStore:s,onActionComplete:o},t.workerId))]})}function G({project:e,worker:t,permissionsStore:s,onActionComplete:o}){var l;let d=(0,a(533992).v3)(),c=(l=t.workerId,n("production",`serviceName="queueCrdtMigration" ("data.request.worker_id"="${l}" OR "data.task.request.worker_id"="${l}")`)),[p,m]=(0,i.useState)({type:"idle"}),[u,h]=(0,i.useState)(!1),y=(0,a(47602).S)(s,"adminResumeMigrationWorkersForSupervisor"),g="failed_not_retryable"===t.state,x=(0,i.useCallback)(async()=>{if("loading"!==p.type){m({type:"loading"});try{let i=await d.api.callApi({eventName:"adminResumeMigrationWorkersForSupervisor",environment:d,data:{project:e,migrationWorkerId:t.workerId}});"success"===i.type?(m({type:"idle"}),o()):m({type:"error",message:(0,a(201790).V4)(i)})}catch(e){m({type:"error",message:e instanceof Error?e.message:"Failed to resume worker"})}}},[d,p.type,o,e,t.workerId]);return(0,r.jsx)("div",{style:O.workerCard,children:(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"Worker ID:"}),(0,r.jsx)(a(799615).B,{value:t.workerId,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t.workerId})}),(0,r.jsx)(W,{state:t.state})]}),t.stateDetails?(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"State details:"}),g?(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",style:O.errorText,children:t.stateDetails}):(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",style:O.errorText,children:t.stateDetails})]}):void 0,(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[g&&y?(0,r.jsx)(a(548436).A,{onClick:x,disabled:"loading"===p.type,children:"loading"===p.type?"Resuming...":"Resume Worker"}):void 0,(0,r.jsx)("a",{href:c,target:"_blank",rel:"noreferrer",style:O.splunkLink,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:"View Splunk logs"})}),"error"===p.type?(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:p.message}):void 0]}),(0,r.jsx)(a(4458).fI,{gap:8,alignItems:"center",children:(0,r.jsx)(a(548436).A,{size:"sm",iconLeading:u?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,onClick:()=>h(e=>!e),"aria-expanded":u,children:"Click to see additional details"})}),u?(0,r.jsx)(q,{worker:t}):void 0]})})}function q(e){var t;let{worker:i}=e,n=(null==(t=i.additionalDetails)?void 0:t.type)==="dynamoDbFromDataLakeCsvExport"?i.additionalDetails:void 0;return(0,r.jsxs)(a(4458).VP,{gap:6,paddingTop:8,style:O.metadataPanel,children:[(0,r.jsx)(H,{label:"Total queue tasks that have attempted this worker",value:String((i.previousWorkerQueueTaskCount??0)+1)}),(0,r.jsx)(Z,{progress:i.progress}),(0,r.jsx)(H,{label:"ID range",value:function(e){let{additionalDetails:t}=e;return t?"postgres"!==t.type?"Unavailable for CSV workers":`${J(t.idRange.start)} to ${J(t.idRange.end)}`:"Unavailable"}(i)}),n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{label:"Source region",value:n.sourceRegion}),(0,r.jsx)(H,{label:"DynamoDB table",value:n.dynamoTableName}),(0,r.jsx)(H,{label:"Source part",value:n.sourceS3Path})]}):void 0,i.database&&!n?(0,r.jsx)(H,{label:"Database",value:i.database}):void 0,i.schema&&!n?(0,r.jsx)(H,{label:"Schema",value:i.schema}):void 0]})}function H(e){let{label:t,value:i}=e;return(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"baseline",children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:`${t}:`}),(0,r.jsx)("div",{style:O.metadataValue,children:(0,r.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"primary",children:i})})]})}function Z(e){let{progress:t}=e;return t?"csv"===t.type?(0,r.jsx)(H,{label:"Progress",value:`Latest byte offset ${Q(t.latestByteOffset)}`}):"postgresFromDataLakeCsvExport"===t.type?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{label:"IDs processed",value:Q(t.numberOfIdsProcessed)}),(0,r.jsx)(H,{label:"Latest byte offset",value:Q(t.latestByteOffset)})]}):"dynamoDbFromDataLakeCsvExport"===t.type?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{label:"Rows processed",value:Q(t.numberOfRowsProcessed)}),(0,r.jsx)(H,{label:"Latest byte offset",value:Q(t.latestByteOffset)})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(H,{label:"Number of rows migrated",value:Q(t.numberOfRowsMigrated)}),(0,r.jsx)(H,{label:"Total number of rows to migrate",value:Q(t.totalNumberOfRowsToMigrate)})]}):(0,r.jsx)(H,{label:"Progress",value:"No progress reported"})}function J(e){return`${e.id} (${e.inclusive?"inclusive":"exclusive"})`}
106function Q(e){return e.toLocaleString()}a(1310);let Y={table:{width:"100%",borderCollapse:"collapse"},headerCell:{padding:"6px 12px",textAlign:"start",borderBottom:`2px solid ${a(632079).Tj.border.primary}`},cell:{padding:"6px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`},warningCell:{padding:"6px 12px",borderBottom:`1px solid ${a(632079).Tj.border.primary}`,background:a(632079).Tj.red.background.primary}},X=new Set(["failed_not_retryable","failed_retryable"]);function ee({workerCountsByState:e}){let t=(0,a(48697).WP)(e),i=t.reduce((e,[,t])=>e+Number(t),0);return(0,r.jsxs)(a(4458).VP,{gap:12,children:[(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Worker Summary"}),(0,r.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:["(",i," total)"]})]}),(e.failed_retryable??0)>0?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"failed_retryable workers retry automatically — no action needed."}):void 0,0===t.length?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"No workers found."}):(0,r.jsxs)("table",{style:Y.table,children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:Y.headerCell,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"State"})}),(0,r.jsx)("th",{style:Y.headerCell,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"Count"})})]})}),(0,r.jsx)("tbody",{children:t.map(([e,t])=>{let i=X.has(e),n=i?Y.warningCell:Y.cell;return(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{style:n,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e})}),(0,r.jsx)("td",{style:n,children:(0,r.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:[Number(t).toLocaleString(),i?" ⚠":""]})})]},e)})})]})]})}let et={card:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8}},ea={adminWrap:(0,a(120308).pj)(),searchCard:{...et.card,flex:1,minWidth:0},quickActionsCard:{...et.card,flex:1,minWidth:0},sectionCard:{...et.card},successBanner:{...et.card,background:a(632079).Tj.green.background.primary,border:`1px solid ${a(632079).Tj.green.border.primary}`},splunkLink:{cursor:"pointer"}};function ei(){var e,t;let s=(0,a(533992).v3)(),o=(0,a(743187).g)(),l=(0,a(47602).S)(o,"adminGetMigrationStatusForSupervisor"),[d]=(0,i.useState)(()=>new URLSearchParams(window.location.search).get("project")??void 0),[p,m]=(0,i.useState)(void 0),[u]=(0,a(97668).Yb)(async()=>{if(!0!==l)return;let e=await s.api.callApi({eventName:"adminListMigrationProjects",environment:s,data:{}});if("success"!==e.type)throw Error((0,a(201790).V4)(e));return e.data.projects},[s,l],{debugName:"MigrationDashboard.listMigrationProjects"}),y=(0,i.useMemo)(()=>u.value??[],[u.value]),g="resolved"===u.status&&void 0!==u.value,x=(0,i.useMemo)(()=>y.map(({project:e})=>e),[y]),f=y.find(({project:e})=>e===p),b=(0,i.useRef)(!1);(0,i.useEffect)(()=>{if(!0!==l||b.current||!g)return;b.current=!0;let e=y.find(({project:e})=>e===d);m(null==e?void 0:e.project)},[l,g,y,d]);let[v,j]=(0,i.useState)(["failed_not_retryable"]),[k,S]=(0,i.useState)(!1),[w,I]=(0,i.useState)(void 0),[C,D]=(0,i.useState)(()=>Date.now());(0,i.useEffect)(()=>{let e=setInterval(()=>D(Date.now()),3e4);return()=>clearInterval(e)},[]);let[T,R,N]=(0,a(97668).V$)(async e=>{if(!p)throw Error("No project selected");let t=await s.api.callApi({eventName:"adminGetMigrationStatusForSupervisor",environment:s,data:{project:p,workerStatesToInclude:[...e??v]}});if("success"!==t.type)throw Error((0,a(201790).V4)(t));return{project:p,data:t.data}},[s,p,v]),M=void 0!==T.value&&T.value.project===p?T.value.data:void 0;(0,i.useEffect)(()=>{if(void 0!==M){let e;e=new URL(window.location.href),p?e.searchParams.set("project",p):e.searchParams.delete("project"),window.history.replaceState(window.history.state,"",e.toString()),I(Date.now())}},[M,p]),(0,i.useEffect)(()=>{S(!1)},[p]);let P=(0,i.useRef)(!1);(0,i.useEffect)(()=>{d&&!0===l&&!P.current&&p&&(P.current=!0,R().catch(()=>{}))},[d,l,R,p]);let V=(0,i.useCallback)(()=>{S(!1),R().catch(()=>{})},[R]),E=(0,i.useCallback)(e=>{j(e),void 0===M||k||(S(!1),R(e).catch(()=>{}))},[M,k,R]),L=(0,i.useCallback)(()=>{N(),S(!0)},[N]);
106return void 0===l?(0,r.jsx)(a(45062).A,{title:"Migration Dashboard - Notion Admin",children:(0,r.jsx)(a(220952).U,{currentSection:"migrationDashboard",children:(0,r.jsx)("div",{style:ea.adminWrap,children:(0,r.jsx)(a(4458).fI,{padding:8,justifyContent:"center",children:(0,r.jsx)(a(517334).k,{size:"default"})})})})}):!1===l?(0,r.jsx)(a(45062).A,{title:"Migration Dashboard - Notion Admin",children:(0,r.jsx)(a(220952).U,{currentSection:"migrationDashboard",children:(0,r.jsx)("div",{style:ea.adminWrap,children:(0,r.jsx)(a(4458).fI,{padding:8,children:(0,r.jsx)("div",{style:ea.searchCard,children:(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Migration Dashboard"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:'You don\'t have access to this tool. Contact your admin to request the "Migrations" permission.'})]})})})})})}):(0,r.jsx)(a(45062).A,{title:"Migration Dashboard - Notion Admin",children:(0,r.jsx)(a(220952).U,{currentSection:"migrationDashboard",children:(0,r.jsxs)("div",{style:ea.adminWrap,children:[(0,r.jsxs)(a(4458).fI,{gap:16,alignItems:"stretch",padding:8,children:[(0,r.jsx)("div",{style:ea.searchCard,children:(0,r.jsxs)(a(4458).VP,{gap:16,children:[(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Migration Dashboard"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Select a migration project to view supervisor status, worker details, and perform actions."})]}),"rejected"===u.status?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:(null==(e=u.error)?void 0:e.message)??"Failed to load migration projects"}):g?(0,r.jsx)(h,{projects:x,selectedProject:p,onSelect:m}):(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(912946).j,{onClick:()=>{R().catch(()=>{})},disabled:!p||"pending"===T.status,children:"pending"===T.status?void 0!==M?"Refreshing...":"Loading...":void 0!==M?"Refresh":"Go"}),"pending"===T.status?(0,r.jsx)(a(517334).k,{size:"sm"}):void 0]}),void 0!==w?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:`Project status refreshed ${(0,a(497491).nl)(w,{useLowercase:!0,nowOverrideMs:C})}.`}):void 0,p?(0,r.jsx)("a",{href:n("production",`(serviceName="queue" OR serviceName="queueCrdtMigration") ("data.request.project"="${p}" OR migrationProject="${p}")`),target:"_blank",rel:"noreferrer",style:ea.splunkLink,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:"View project Splunk logs"})}):void 0,"rejected"===T.status?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:(null==(t=T.error)?void 0:t.message)??"Failed to fetch migration status"}):void 0]})}),p&&f?(0,r.jsx)("div",{style:ea.quickActionsCard,children:(0,r.jsx)(A,{project:p,projectType:f.projectType,statusData:k?void 0:M,permissionsStore:o,onActionComplete:V,onCleanupComplete:L})}):void 0]}),k?(0,r.jsx)(a(4458).fI,{gap:16,paddingTop:0,paddingBottom:8,paddingInlineStart:8,paddingInlineEnd:8,children:(0,r.jsx)("div",{style:ea.successBanner,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"green",colorVariant:"accentPrimary",children:"Project cleaned up successfully. All supervisor and worker records have been deleted."})})}):void 0,void 0===M||void 0===p||k?void 0:(0,r.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",paddingTop:0,paddingBottom:8,paddingInlineStart:8,paddingInlineEnd:8,children:[(0,r.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,r.jsx)("div",{style:ea.sectionCard,children:(0,r.jsx)(B,{data:M})}),(0,r.jsx)("div",{style:ea.sectionCard,children:(0,r.jsx)(z,{project:p,workers:M.workerInfo??[],selectedStates:v,onSelectedStatesChange:E,permissionsStore:o,onActionComplete:V})})]}),(0,r.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[M.effectiveConfig?(0,r.jsx)("div",{style:ea.sectionCard,children:(0,r.jsx)(c,{effectiveConfig:M.effectiveConfig})}):void 0,(0,r.jsx)("div",{style:ea.sectionCard,children:(0,r.jsx)(ee,{workerCountsByState:M.workerCountsByState})})]})]})]})})})}}
106,59009(e,t,a){a.r(t),a.d(t,{MonetizationTesting:()=>ee}),a(176765),a(851344),a(866491);var i=a(635790);a(533958),a(730330),a(976614),a(159952);var n=()=>a(120011);a(435368);let r={"Subscription lifecycle":["upgradeSubscription","downgradeSubscription","changeBillingCycle","changeCurrency","grantComplimentary","assignEmployeePlan","markSalesAssisted","setEducationPlan","revokeEducationPlan","markCancelAtPeriodEnd","reverseCancellation","cancelSubscription"],Trials:["upsertTrial","stackTrial","expireSyntheticTrial"],"Payment & invoices":["swapValidPaymentMethod","addInvalidPaymentMethod","setTaxRegion","applyCoupon","removeCoupon","payInvoice","refundInvoice","openStripeDispute","closeStripeDispute"],"Membership & seats":["addMember","addGuest","addPendingMemberInvite","setMembershipRole","removeMember","bulkScaleSeats"],Usage:["addBlocks","fillBlocksToLimit","consumeAICredits","addAIAddOn","removeAIAddOn"],"Infra & misc":["syncBillingState","attachTestClock","advanceBillingClock","setLocale","setEKMEnabled","setEKMDisabled","simulateAggregatorCollapse","triggerAuditor"]},s=new Map(["advanceBillingClock","addMember","removeMember","bulkScaleSeats"].map((e,t)=>[e,t]));function o(e,t){let a=(r[e]??[]).indexOf(t);return -1===a?Number.MAX_SAFE_INTEGER:a}function l(e){let t=[],a=[];for(let i of e)s.has(i.name)?t.push(i):a.push(i);return t.sort((e,t)=>{if(e.available!==t.available)return e.available?-1:1;let a=s.get(e.name)??Number.MAX_SAFE_INTEGER,i=s.get(t.name)??Number.MAX_SAFE_INTEGER;return a!==i?a-i:e.name.localeCompare(t.name)}),{common:t,rest:a}}function d(e){if("string"==typeof e)return e;if("object"==typeof e&&null!==e){if("debugMessage"in e&&"string"==typeof e.debugMessage)return e.debugMessage;if("message"in e&&"string"==typeof e.message)return e.message}return JSON.stringify(e)}var c=a(440302);let p=(0,a(48697).objectKeys)({"Subscription lifecycle":null,Trials:null,"Payment & invoices":null,"Membership & seats":null,Usage:null,"Infra & misc":null});function m(e){let{spaceId:t,actions:n,showExperimental:r,showUnavailable:s,onActionStart:d,onActionComplete:m}=e,[y,g]=(0,i.useState)(""),x=(0,i.useCallback)(e=>{g(e.target.value)},[]),f=n.filter(e=>{if("experimental"===e.validationStatus&&!r||!e.available&&!s)return!1;var t=y.trim();if(""===t)return!0;let a=t.toLowerCase();return e.name.toLowerCase().includes(a)||e.description.toLowerCase().includes(a)}),{common:b}=l(f),v=(0,i.useCallback)(e=>(0,c.jsx)(h,{spaceId:t,action:e,onActionStart:d,onActionComplete:m},e.name),[t,d,m]);return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"Actions"}),(0,c.jsx)(a(287562).p,{value:y,onChange:x,placeholder:"Search actions…",inputElementAttributes:{"aria-label":"Search actions"}}),0===f.length?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:""===y.trim()?"No validated actions are available from this state. Toggle “Show experimental” / “Show unavailable” to see the rest of the registry.":"No actions match your search."}):void 0,b.length>0?(0,c.jsx)(u,{title:"Common actions",children:b.map(v)}):void 0,p.map(e=>{var t;let a=(t=l(f.filter(t=>t.category===e)).rest,[...t].sort((t,a)=>{if(t.available!==a.available)return t.available?-1:1;let i=o(e,t.name)-o(e,a.name);return 0!==i?i:t.name.localeCompare(a.name)}));if(0!==a.length)return(0,c.jsx)(u,{title:e,children:a.map(v)},e)})]})}function u(e){let{title:t,children:i}=e;return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:t}),i]})}function h(e){let{spaceId:t,action:n,onActionStart:r,onActionComplete:s}=e,o=(0,a(533992).v3)(),[l,p]=(0,i.useState)({}),[m,u]=(0,i.useState)(!1),[h,y]=(0,i.useState)(),f=(0,i.useCallback)((e,t)=>{p(a=>({...a,[e]:t}))},[]),b=(0,i.useCallback)(async()=>{u(!0),y(void 0),r();try{let e={};for(let t of n.inputFields){let a=l[t.name]??"";if(""!==a)switch(t.kind){case"number":e[t.name]=Number(a);break;case"boolean":e[t.name]="true"===a;break;case"json":e[t.name]=JSON.parse(a);break;default:e[t.name]=a}}let a=await o.api.callApi({eventName:"adminMonetizationTestingRunAction",environment:o,data:{spaceId:t,actionName:n.name,input:JSON.stringify(e)}});"success"!==a.type&&y(d(a.error))}catch(e){y(e instanceof Error?e.message:"Action failed")}finally{u(!1),s()}},[o,t,n,l,r,s]),v="experimental"===n.validationStatus?(0,c.jsx)(a(746434).E,{content:"experimental",color:"yellow"}):void 0;return n.available?"advanceBillingClock"===n.name?(0,c.jsx)(g,{spaceId:t,action:n,onActionStart:r,onActionComplete:s}):(0,c.jsxs)(a(4458).VP,{gap:4,children:[(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(111010).D,{styleKey:"body",children:n.name}),v]}),(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:n.description}),(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",flexWrap:"wrap",children:[n.inputFields.map(e=>(0,c.jsx)(x,{field:e,value:l[e.name]??"",onChange:f},e.name)),(0,c.jsx)(a(548436).A,{onClick:b,disabled:m,children:m?"Running…":"Run"})]}),void 0!==h?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"red",colorVariant:"accentPrimary",children:h}):void 0]}):(0,c.jsxs)(a(4458).VP,{gap:4,children:[(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(111010).D,{styleKey:"body",colorVariant:"secondary",children:n.name}),v]}),(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`Unavailable: ${n.unavailableReason??"unknown reason"}`})]})}let y=[{label:"+1 day",duration:{days:1}},{label:"+1 week",duration:{weeks:1}},{label:"+1 month",duration:{months:1}},{label:"+3 months",duration:{months:3}},{label:"+1 year",duration:{years:1}}];function g(e){let{spaceId:t,action:r,onActionStart:s,onActionComplete:o}=e,l=(0,a(533992).v3)(),[p,m]=(0,i.useState)(!1),[u,h]=(0,i.useState)(),[g,x]=(0,i.useState)(),[f,b]=(0,i.useState)(""),v=(0,i.useCallback)(async()=>{let e=await l.api.callApi({eventName:"adminMonetizationTestingGet
106Snapshot",environment:l,data:{spaceId:t}});if("success"===e.type)return e.data.state;x(d(e.error))},[l,t]),j=(0,i.useCallback)(async()=>{let e=await l.api.callApi({eventName:"adminSyncBillingState",environment:l,data:{spaceId:t}});return"success"===e.type||(x(d(e.error)),!1)},[l,t]),k=(0,i.useCallback)(async e=>{for(let a=0;a<3;a+=1){let i=await l.api.callApi({eventName:"adminMonetizationTestingRunAction",environment:l,data:{spaceId:t,actionName:"advanceBillingClock",input:JSON.stringify({epochSeconds:e})}});if("success"===i.type)return!0;let n=d(i.error);if(n.includes("still advancing")&&a<2){h("Clock busy from the previous step — retrying…"),await new Promise(e=>setTimeout(e,2e3));continue}x(n);break}return!1},[l,t]),S=(0,i.useCallback)(async e=>{m(!0),x(void 0),h(void 0),s();try{let i,r=e.set({millisecond:0});for(let e=0;e<60;e+=1){var t,a;let e=await v();if(void 0===e)break;let s=null==(t=e.billingData)||null==(t=t.clock)?void 0:t.now;if(void 0===s){x("Workspace has no test clock to advance.");break}let o=n().DateTime.fromISO(s);if(o>=r){h(`Clock at ${o.toISODate()??"?"} — done.`);break}if(void 0!==i&&o<=i){x("Clock stopped advancing before reaching the target.");break}i=o;let l=null==(a=e.billingData)||null==(a=a.subscription)?void 0:a.currentPeriodEnd,d=function(e){let{clockNow:t,currentPeriodEnd:a,finalTarget:i}=e;if(void 0===a)return i;let r=n().DateTime.min(a.plus({hours:1}),i);return r>t?r:i}({clockNow:o,currentPeriodEnd:void 0===l?void 0:n().DateTime.fromISO(l),finalTarget:r});if(h(`Advancing to ${d.toISODate()??"?"} (from ${o.toISODate()??"?"})…`),!await k(Math.floor(d.toSeconds()))||!await j())break}}finally{m(!1),o()}},[v,k,j,s,o]),w=(0,i.useCallback)(async e=>{var t;let a=await v(),i=null==a||null==(t=a.billingData)||null==(t=t.clock)?void 0:t.now;void 0===i?x("Workspace has no test clock to advance."):await S(n().DateTime.fromISO(i).plus(e.duration))},[v,S]),I=(0,i.useCallback)(async()=>{let e=n().DateTime.fromISO(f);e.isValid?await S(e.endOf("day")):x(`"${f}" is not a valid date.`)},[f,S]),C=(0,i.useCallback)(e=>{b(e.target.value)},[]);return(0,c.jsxs)(a(4458).VP,{gap:4,children:[(0,c.jsx)(a(111010).D,{styleKey:"body",children:r.name}),(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:r.description}),(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",flexWrap:"wrap",children:[y.map(e=>(0,c.jsx)(a(548436).A,{size:"sm",disabled:p,onClick:()=>void w(e),children:e.label},e.label)),(0,c.jsx)(a(287562).p,{type:"date",value:f,onChange:C,placeholder:"target date"}),(0,c.jsx)(a(548436).A,{size:"sm",disabled:p||""===f,onClick:()=>void I(),children:p?"Advancing…":"Advance to date"})]}),void 0!==u?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:u}):void 0,void 0!==g?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"red",colorVariant:"accentPrimary",children:g}):void 0]})}function x(e){let{field:t,value:a,onChange:i}=e,n="enum"===t.kind?t.values:"boolean"===t.kind?["true","false"]:void 0;return void 0!==n?(0,c.jsx)(b,{field:t,options:n,value:a,onChange:i}):(0,c.jsx)(f,{field:t,value:a,onChange:i})}function f(e){let{field:t,value:n,onChange:r}=e,s=(0,i.useCallback)(e=>{r(t.name,e.target.value)},[t.name,r]),o=`${t.name}${t.optional?"?":""} (${t.kind})`;return(0,c.jsx)(a(287562).p,{value:n,onChange:s,placeholder:o})}function b(e){let{field:t,options:n,value:r,onChange:s}=e,o=(0,i.useCallback)(e=>{let i=[...t.optional?[{key:"__default__",title:"(default)",selected:""===r,select:()=>s(t.name,"")}]:[],...n.map(e=>({key:e,title:e,selected:r===e,select:()=>s(t.name,e)}))];return(0,c.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,children:(0,c.jsx)(a(558045).A,{type:a(558045).O.Vertical,initialFocus:void 0,sections:[{key:t.name,items:i.map(t=>({key:t.key,action:()=>{t.select(),e.close()},render:e=>(0,c.jsx)(a(95582).A,{...e,title:t.title,isChecked:t.selected})}))}]})})},[t.name,t.optional,n,r,s]),l=""===r?`${t.name}${t.optional?"?":""}…`:r;return(0,c.jsx)(a(656252).d,{popupType:a(656252).z.Popup,placementToOrigin:"bottom",alignmentToOrigin:"start",originGap:4,content:o,children:e=>(0,c.jsx)(a(548436).A,{size:"sm",onClick:t=>e.onClick(t),iconTrailing:a(595453).arrowChevronSingleDownSmallIcon,ariaLabel:`${t.name}: ${""===r?"not set":r}`,children:l})})}function v({initialSpaceName:e,initialActionSequence:t,onWorkspaceCreated:n}){let r=(0,a(533992).v3)(),[s,o]=(0,i.useState)(e),[l,p]=(0,i.useState)(t),[m,u]=(0,i.useState)(!1),[h,y]=(0,i.useState)(),[g,x]=(0,i.useState)(),f=(0,i.useCallback)(e=>{o(e.target.value)},[]),b=(0,i.useCallback)(e=>{p(e.target.value)},[]),j=(0,i.useCallback)(async()=>{u(!0),y(void 0);try{let e=await r.api.callApi({eventName:"adminMonetizationTestingCreateWorksp
106aceInState",environment:r,data:{spaceName:""===s?void 0:s,actionSequence:l}});"success"===e.type?(x(e.data.spaceId),n(e.data.spaceId)):y(d(e.error))}catch(e){y(e instanceof Error?e.message:"Create failed")}finally{u(!1)}},[r,s,l,n]);return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"Create workspace in state"}),(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",flexWrap:"wrap",children:[(0,c.jsx)(a(287562).p,{value:s,onChange:f,placeholder:"Workspace name (optional)"}),(0,c.jsx)(a(287562).p,{value:l,onChange:b,placeholder:'actionSequence JSON, e.g. [{"actionName":"addMember","input":"{}"}]'}),(0,c.jsx)(a(912946).j,{onClick:j,disabled:m,children:m?"Creating…":"Create"})]}),void 0!==h?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"red",colorVariant:"accentPrimary",children:h}):void 0,void 0!==g?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:`Created workspace ${g} — snapshot below now points at it.`}):void 0]})}a(765324);let j=/\$now\+(\d+)d/g,k=["tierMatchesStripe","syncIsIdempotent","monetaryFieldsPresentIffStripe"],S=[],w=[{name:"Free workspace (owner only)",validationStatus:"validated",description:"Fresh free workspace, no members beyond the owner.",group:"Plan tier permutations",steps:[],expectedInvariants:k},{name:"Free + 1 member",validationStatus:"validated",description:"Free workspace with one additional member.",group:"Plan tier permutations",steps:[{actionName:"addMember",input:"{}"}],expectedInvariants:k},{name:"Free + 1 guest",validationStatus:"validated",description:"Free workspace with one page guest (guest-cap behavior).",group:"Plan tier permutations",steps:[{actionName:"addGuest",input:"{}"}],expectedInvariants:[...k,"guestCountWithinTierCap"]},{name:"Free + 10 members",validationStatus:"validated",description:"Free workspace over typical free-seat semantics — exercises upsell triggers.",group:"Plan tier permutations",steps:Array.from({length:10},()=>({actionName:"addMember",input:"{}"})),expectedInvariants:[...k,"pfaReflectsTier"]},{name:"Plus workspace (monthly USD)",validationStatus:"validated",description:"Self-serve Plus on the current monthly USD price (valid card attached first — costed upgrades require a payment method).",group:"Plan tier permutations",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"plus_monthly_usd_202407"})}],expectedInvariants:[...k,"pfaReflectsTier"]},{name:"Business workspace (monthly USD)",validationStatus:"validated",description:"Self-serve Business on the current monthly USD price.",group:"Plan tier permutations",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})}],expectedInvariants:[...k,"pfaReflectsTier","seatCountMatchesStripeQuantity"]},{name:"Self-serve Enterprise (monthly USD)",validationStatus:"validated",description:"Self-serve Enterprise on the current monthly USD price via upgradeSubscription — the paid, card-on-file counterpart to the sales-assisted Enterprise scenarios (markSalesAssisted).",group:"Plan tier permutations",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"enterprise_monthly_usd_202505"})}],expectedInvariants:[...k,"pfaReflectsTier","seatCountMatchesStripeQuantity"]},{name:"Sales Enterprise 2.0 (monthly USD)",validationStatus:"validated",description:"Legacy sales-assisted Enterprise 2.0 on the zero-cost USD price. The plan does not include Notion AI usage.",group:"Plan tier permutations",steps:[{actionName:"markSalesAssisted",input:JSON.stringify({plan:"enterprise_trial"})}],expectedInvariants:[...k,"pfaReflectsTier"]},{name:"Sales Enterprise 3.0 (monthly USD)",validationStatus:"validated",description:"Sales-assisted Enterprise 3.0 on the USD price. The plan includes Notion AI usage.",group:"Plan tier permutations",steps:[{actionName:"markSalesAssisted",input:JSON.stringify({plan:"bundled_ai_enterprise_sales_assisted"})}],expectedInvariants:[...k,"pfaReflectsTier"]},{name:"Business → Enterprise comp grant",validationStatus:"experimental",description:"Self-serve Business upgraded to a complimentary Enterprise grant (marketing_enterprise_free). KNOWN BLOCKED in the shared sandbox: the enterprise comp prices (marketing/ambassador_enterprise_free) are INACTIVE there, so Stripe rejects the grant — the business comp prices work. Needs the price activated in the sandbox.",group:"Plan tier permutations",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"grantComplimentary",input:JSON.stringify({plan:"marketing_enterprise_free"})}],expectedInvariants:[...k,"pfaReflectsTier"]}
106,{name:"Employee comp plan workspace",validationStatus:"validated",description:"Notion employee comp plan via adminEmployeeSubscriptionUpdate (zero-cost, no card needed). The endpoint relies on the async webhook path to sync billingData, so the explicit sync step is load-bearing — without it tierMatchesStripe honestly fails (free vs business).",group:"Plan tier permutations",steps:[{actionName:"assignEmployeePlan",input:"{}"},{actionName:"syncBillingState",input:"{}"}],expectedInvariants:k},{name:"iOS Personal",validationStatus:"validated",description:"Single-member Personal subscription persisted as an App Store mobile fixture.",group:"Plan tier permutations",steps:[{actionName:"spoofMobileSubscription",input:JSON.stringify({store:"app_store"})}],expectedInvariants:S},{name:"iOS Personal+AI",validationStatus:"validated",description:"Single-member Personal with AI subscription persisted as an App Store mobile fixture.",group:"Plan tier permutations",steps:[{actionName:"spoofMobileSubscription",input:JSON.stringify({store:"app_store",includeAIAddOn:!0})}],expectedInvariants:S},{name:"Android Personal",validationStatus:"validated",description:"Single-member Personal subscription persisted as a Play Store mobile fixture.",group:"Plan tier permutations",steps:[{actionName:"spoofMobileSubscription",input:JSON.stringify({store:"play_store"})}],expectedInvariants:S},{name:"Android Personal+AI",validationStatus:"validated",description:"Single-member Personal with AI subscription persisted as a Play Store mobile fixture.",group:"Plan tier permutations",steps:[{actionName:"spoofMobileSubscription",input:JSON.stringify({store:"play_store",includeAIAddOn:!0})}],expectedInvariants:S},{name:"Free on Business trial — 14 days out",validationStatus:"validated",description:"Free workspace with a forced trial ending in 14 days (day-1 shape).",group:"Trial lifecycle",steps:[{actionName:"upsertTrial",input:JSON.stringify({endDate:"$now+14d"})}],expectedInvariants:[...k,"trialSourceOfTruthAligned"]},{name:"Free on Business trial — expiring tomorrow",validationStatus:"validated",description:"Trial ends tomorrow — verifies the in-product expiring-trial warning state.",group:"Trial lifecycle",steps:[{actionName:"upsertTrial",input:JSON.stringify({endDate:"$now+1d"})}],expectedInvariants:[...k,"trialSourceOfTruthAligned"]},{name:"Free on Business trial — day 5 (mid-trial)",validationStatus:"validated",description:"Mid-trial shape: 9 of 14 trial days remaining (day-5 of a 14-day trial).",group:"Trial lifecycle",steps:[{actionName:"upsertTrial",input:JSON.stringify({endDate:"$now+9d"})}],expectedInvariants:[...k,"trialSourceOfTruthAligned"]},{name:"Free on Business trial — day 10",validationStatus:"validated",description:"The proposal's example: 4 of 14 trial days remaining (day-10 shape).",group:"Trial lifecycle",steps:[{actionName:"upsertTrial",input:JSON.stringify({endDate:"$now+4d"})}],expectedInvariants:[...k,"trialSourceOfTruthAligned"]},{name:"Free + failing payment method",validationStatus:"validated",description:"Workspace with a payment method that fails every charge — precursor to dunning scenarios (upgrade or clock-advance next).",group:"Billing health / dunning",steps:[{actionName:"addInvalidPaymentMethod",input:"{}"}],expectedInvariants:k},{name:"Business with no payment method",validationStatus:"validated",description:"Sales-assisted Business with NO payment method on file (markSalesAssisted subscribes without a card — invoiced in production).",group:"Billing health / dunning",steps:[{actionName:"markSalesAssisted",input:"{}"}],expectedInvariants:k},{name:"Owner + 100 members",validationStatus:"validated",description:"Bulk membership for seat-quantity sync checks (run upgrade afterwards to exercise seat-priced tiers).",group:"Membership + seat scaling",steps:Array.from({length:100},()=>({actionName:"addMember",input:"{}"})),expectedInvariants:[...k,"seatCountMatchesStripeQuantity"]},{name:"Pending member invite (billable-seat preview)",validationStatus:"validated",description:"Subscribed Business with one UNPROCESSED SpaceMembershipUpdate — billable seats (2) intentionally ahead of Stripe quantity (1) until adminFlushSpaceMembershipUpdates processes it.",group:"Membership + seat scaling",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"addPendingMemberInvite",input:"{}"}],expectedInvariants:k}
106,{name:"Free near block limit",validationStatus:"validated",description:"Adds a member then 900 blocks toward Free's 1000-block cap — verify the upgrade gate engages as the cap approaches. (The cap only applies to MULTI-member free workspaces, so the member step is load-bearing.)",group:"Usage caps / PFA",steps:[{actionName:"addMember",input:"{}"},{actionName:"addBlocks",input:JSON.stringify({count:900})}],expectedInvariants:[...k,"pfaReflectsTier"]},{name:"Dunning recovery: bad card → good card → sync",validationStatus:"validated",description:"Attach a failing payment method, then swap a valid one and sync — exercises the recover-from-dunning path (pair with advanceBillingClock to generate the failed invoice).",group:"Billing health / dunning",steps:[{actionName:"attachTestClock",input:"{}"},{actionName:"addInvalidPaymentMethod",input:"{}"},{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"syncBillingState",input:"{}"}],expectedInvariants:[...k,"syncIsIdempotent"]},{name:"Business + scheduled cancellation",validationStatus:"validated",description:"Active Business with cancel-at-period-end set — still entitled until the period rolls. (Flexible-billing-mode subs express this as cancel_at == current_period_end, not cancel_at_period_end: true.)",group:"Billing health / dunning",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"markCancelAtPeriodEnd",input:"{}"}],expectedInvariants:k},{name:"Business cancelled immediately",validationStatus:"validated",description:"Business subscription cancelled immediately — back to free. Billing history survives only on the Stripe side: fetchStripeBillingData skips invoices when no subscription exists, so billingData reports invoices: [] (and monetaryFieldsPresentIffStripe passes vacuously) — compare the Stripe CLI column.",group:"Billing health / dunning",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"cancelSubscription",input:"{}"}],expectedInvariants:k},{name:"Reverse cancellation mid-period",validationStatus:"validated",description:"Schedule a cancellation, then reverse it — the production reactivation flow (plan re-assert clears cancel_at_period_end).",group:"Billing health / dunning",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"markCancelAtPeriodEnd",input:"{}"},{actionName:"reverseCancellation",input:"{}"}],expectedInvariants:[...k,"syncIsIdempotent"]},{name:"USD annual Business",validationStatus:"validated",description:"Self-serve Business on the current ANNUAL USD price (proration baseline for cycle-switch comparisons).",group:"Currency / cycle / tax",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_yearly_usd_202505"})}],expectedInvariants:[...k,"pfaReflectsTier"]},{name:"JPY monthly Plus (zero-decimal currency)",validationStatus:"validated",description:"Plus denominated in JPY — Stripe zero-decimal currency edge case (amounts are whole yen, no minor units).",group:"Currency / cycle / tax",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"plus_monthly_jpy_202407"})}],expectedInvariants:[...k,"pfaReflectsTier","currencyRoundTrips"]},{name:"EUR monthly Plus",validationStatus:"validated",description:'Plus subscription denominated in EUR — exercises the toSupportedCurrency round-trip (Stripe lowercase "eur" ↔ "EUR").',group:"Currency / cycle / tax",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"changeCurrency",input:JSON.stringify({currency:"EUR",product:"plus"})}],expectedInvariants:[...k,"currencyRoundTrips"]},{name:"Monthly → annual cycle switch",validationStatus:"validated",description:"Business monthly flipped to annual mid-cycle — exercises proration and the monthlyYearlyPairs/eligibility-group counterpart resolution.",group:"Currency / cycle / tax",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})}
106,{actionName:"changeBillingCycle",input:JSON.stringify({interval:"year"})}],expectedInvariants:k},{name:"US-CA sales-tax Business",validationStatus:"validated",description:"Billing address in California (state sales tax) before subscribing — exercises US tax computation.",group:"Currency / cycle / tax",steps:[{actionName:"setTaxRegion",input:JSON.stringify({region:"us-ca"})},{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})}],expectedInvariants:k},{name:"US-DE no-tax Business",validationStatus:"validated",description:"Billing address in Delaware (no state sales tax) — control for the US-CA scenario.",group:"Currency / cycle / tax",steps:[{actionName:"setTaxRegion",input:JSON.stringify({region:"us-de"})},{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})}],expectedInvariants:k},{name:"EU VAT-registered Business",validationStatus:"validated",description:"German billing address with a VAT ID (reverse-charge shape) before subscribing.",group:"Currency / cycle / tax",steps:[{actionName:"setTaxRegion",input:JSON.stringify({region:"de",vatId:"DE123456789"})},{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})}],expectedInvariants:k},{name:"Business + AI add-on",validationStatus:"experimental",description:"Business with the standard AI add-on attached — verify getAIConfigForSpace / entitlements.",group:"Coupons / add-ons",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"addAIAddOn",input:"{}"}],expectedInvariants:[...k,"pfaReflectsTier"]},{name:"AI add-on removed (lands at period end)",validationStatus:"experimental",description:"Attach then remove the AI add-on — removal is scheduled at period end, so the item remains until the period rolls (advanceBillingClock to apply).",group:"Coupons / add-ons",steps:[{actionName:"swapValidPaymentMethod",input:"{}"},{actionName:"upgradeSubscription",input:JSON.stringify({plan:"business_monthly_usd_202505"})},{actionName:"addAIAddOn",input:"{}"},{actionName:"removeAIAddOn",input:"{}"}],expectedInvariants:k},{name:"AI credits burned (basic)",validationStatus:"validated",description:"Burns 1000 basic AI credits on a free workspace via the recordAIUsage testing API — usage-cap shape for PFA cumulative checks.",group:"Usage caps / PFA",steps:[{actionName:"consumeAICredits",input:JSON.stringify({credits:1e3})}],expectedInvariants:k},{name:"Sync immediately after membership change",validationStatus:"validated",description:"addMember then explicit sync — guards the MonetizationFastAggregator collapse-window behavior (webhook-driven syncs within 5s collapse).",group:"Regression / known-bug guards",steps:[{actionName:"addMember",input:"{}"},{actionName:"syncBillingState",input:"{}"}],expectedInvariants:[...k,"syncIsIdempotent"]},{name:"Aggregator collapse window",validationStatus:"validated",description:"Two syncStripeState events on the same customer inside 5s — deliberately exercises MonetizationFastAggregator's collapse window (runtime-proven: 2 Kafka events → exactly 1 queue2:monetizationFast delivery). The sync step is load-bearing: pre-sync billingData doesn't expose the customer's externalId.",group:"Regression / known-bug guards",steps:[{actionName:"attachTestClock",input:"{}"},{actionName:"syncBillingState",input:"{}"},{actionName:"simulateAggregatorCollapse",input:"{}"}],expectedInvariants:[...k,"syncIsIdempotent"]}],I=["Plan tier permutations","Trial lifecycle","Billing health / dunning","Membership + seat scaling","Currency / cycle / tax","Coupons / add-ons","Usage caps / PFA","Regression / known-bug guards"];function C(e){let{showExperimental:t,onWorkspaceCreated:n}=e,[r,s]=(0,i.useState)(!0),[o,l]=(0,i.useState)(),[d,p]=(0,i.useState)(),[m,u]=(0,i.useState)(),h=(0,i.useCallback)(()=>{s(e=>!e)},[]);return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(a(988022).p,{size:"sm",colorPalette:"gray",iconLeading:r?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,onClick:h,"aria-expanded":r,children:(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"Scenarios"})}),r?(0,c.jsx)(D,{showExperimental:t,runningScenario:d,onRunStart:p,onRunEnd:()=>p(void 0),error:o,onError:l,onWorkspaceCreated:n,invariantResults:m,onInvariantResults:u}):void 0]})}function D(e){let{showExperimental:t,runningScenario:i,onRunStart:n,onRunEnd:r,error:s,onError:o,onWorkspaceCreated:l,invariantResults:d,onInvariantResults:p}=e;return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:"Running a scenario creates an entirely new workspace and does not modify the workspace you are currently viewing. Hover a scenario for its description."}),I.map(e=>{let a=w.filter(a=>a.group===e&&(t||"validated"===a.validationStatus));if(0!==a.length)return(0,c.jsx)(T,{group:e,scenarios:a,runningScenario:i,onRunStart:n,onRunEnd:r,onError:o,onWorkspaceCreated:l,onInvariantResults:p},e)}),void 0!==s?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"red",colorVariant:"accentPrimary",children:s}):void 0,void 0!==d&&d.length>0?(0,c.jsxs)(a(4458).VP,{gap:4,children:[(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:"Invariant results:"}),d.map(e=>(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"failed"===e.status?"red":"passed"===e.status?"teal":void 0,colorVariant:"notYetAssertable"===e.status?"secondary":"accentPrimary",children:`${"passed"===e.status?"✓":"failed"===e.status?"✗":"○"} ${e.id} [${e.status}] — ${e.detail}`},e.id))]}):void 0]})}function T(e){let{group:t,scenarios:n,runningScenario:r,onRunStart:s,onRunEnd:o,onError:l,onWorkspaceCreated:d,onInvariantResults:p}=e,[m,u]=(0,i.useState)(!1),h=(0,i.useCallback)(()=>{u(e=>!e)},[]),y=n.some(e=>
106e.name===r),g=m||y;return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(988022).p,{size:"sm",colorPalette:"gray",iconLeading:g?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,onClick:h,"aria-expanded":g,children:t}),(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:1===n.length?"1 scenario":`${n.length} scenarios`})]}),g?(0,c.jsx)(a(4458).fI,{gap:8,flexWrap:"wrap",children:n.map(e=>(0,c.jsx)(R,{scenario:e,isRunning:r===e.name,isDisabled:void 0!==r,onRunStart:s,onRunEnd:o,onError:l,onWorkspaceCreated:d,onInvariantResults:p},e.name))}):void 0]})}function R({scenario:e,isRunning:t,isDisabled:n,onRunStart:r,onRunEnd:s,onError:o,onWorkspaceCreated:l,onInvariantResults:p}){let m=(0,a(533992).v3)(),u=(0,i.useCallback)(async()=>{r(e.name),o(void 0),p(void 0);try{let t=new Date,a=e.steps.map(e=>{var a;return{actionName:e.actionName,input:(a=e.input,a.replace(j,(e,a)=>{let i=new Date(t);return i.setUTCDate(i.getUTCDate()+Number(a)),i.toISOString().slice(0,10)}))}}),i=await m.api.callApi({eventName:"adminMonetizationTestingCreateWorkspaceInState",environment:m,data:{spaceName:`Scenario: ${e.name}`,actionSequence:JSON.stringify(a),expectedInvariants:JSON.stringify(e.expectedInvariants)}});"success"===i.type?(l(i.data.spaceId),p(i.data.invariantResults)):o(d(i.error))}catch(e){o(e instanceof Error?e.message:"Scenario failed")}finally{s()}},[m,e,r,s,o,l,p]);return(0,c.jsx)(a(51831).m_,{placement:"top",content:()=>e.description,children:i=>(0,c.jsxs)(a(4458).fI,{gap:4,alignItems:"center",...i,children:[(0,c.jsx)(a(548436).A,{onClick:u,disabled:n,children:t?`Running ${e.name}…`:e.name}),"experimental"===e.validationStatus?(0,c.jsx)(a(746434).E,{content:"experimental",color:"yellow"}):void 0]})})}let A={free:"Free",trialing:"Trialing",paidPlus:"Paid — Plus",paidBusiness:"Paid — Business",paidEnterprise:"Paid — Enterprise",pendingCancellation:"Pending cancellation",delinquent:"Delinquent",education:"Education",employee:"Employee"},N=[{from:"free",to:"trialing",actionName:"upsertTrial"},{from:"free",to:"paidPlus",actionName:"upgradeSubscription"},{from:"free",to:"paidBusiness",actionName:"upgradeSubscription"},{from:"free",to:"paidEnterprise",actionName:"grantComplimentary"},{from:"free",to:"paidBusiness",actionName:"grantComplimentary"},{from:"free",to:"education",actionName:"setEducationPlan"},{from:"free",to:"employee",actionName:"assignEmployeePlan"},{from:"trialing",to:"free",actionName:"expireSyntheticTrial"},{from:"paidBusiness",to:"pendingCancellation",actionName:"markCancelAtPeriodEnd"},{from:"pendingCancellation",to:"paidBusiness",actionName:"reverseCancellation"},{from:"paidBusiness",to:"delinquent",actionName:"addInvalidPaymentMethod"},{from:"paidBusiness",to:"free",actionName:"cancelSubscription"},{from:"delinquent",to:"paidBusiness",actionName:"swapValidPaymentMethod"},{from:"paidBusiness",to:"paidPlus",actionName:"downgradeSubscription"}],M={light:{nodeFill:"#f7f6f3",nodeText:"#37352f",nodeStroke:"#d3d1cb",lineColor:"#9b9b9b",edgeLabelBackground:"#ffffff"},dark:{nodeFill:"#2f2f2f",nodeText:"#d4d4d4",nodeStroke:"#5a5a5a",lineColor:"#9b9b9b",edgeLabelBackground:"#191919"}};function P(e){try{var t,i;let n,r,s=void 0===e.billingData?void 0:(0,a(337174).Mc)(e.billingData),{stateId:o,label:l}=function(e){var t;if(void 0===e)return{stateId:"free",label:"Free (billingData not loaded)"};let i=(0,a(991394).AI)(e),n=e.invoices.some(e=>"open"===e.status||"uncollectible"===e.status);if((0,a(991394).Fq)(e)&&n)return{stateId:"delinquent",label:`Delinquent — ${i}`};if(void 0!==(0,a(991394).D_)(e))return{stateId:"pendingCancellation",label:`Pending cancellation — ${i}`};if((0,a(991394).TB)(e))return{stateId:"trialing",label:`Trialing — ${i}`};if("student"===i)return{stateId:"education",label:"Education plan"};if((null==(t=(0,a(991394).jL)(e))?void 0:t.includes("employee"))===!0)return{stateId:"employee",label:"Employee plan"};switch(i){case"plus":return{stateId:"paidPlus",label:"Paid — Plus"};case"personal":return{stateId:"paidPlus",label:"Paid — Personal (Mobile Plus)"};case"business":return{stateId:"paidBusiness",label:"Paid — Business"};case"enterprise":return{stateId:"paidEnterprise",label:"Paid — Enterprise"};case"free":return{stateId:"free",label:"Free"}}}(s);return{stateId:o,label:l,facts:(t=e,i=s,n=[],(null==i?void 0:i.externalId)!==void 0&&n.push({label:"Str
106ipe customer",value:i.externalId}),(null==i?void 0:i.subscription)!==void 0&&n.push({label:"Subscription",value:i.subscription.externalId}),r=V(i),void 0!==r&&n.push({label:"Payment method",value:r}),n.push({label:"Members",value:String(t.memberCount)}),void 0!==i&&void 0!==i.clock.externalId&&n.push({label:"Test clock",value:`${i.clock.externalId} — now ${i.clock.now.toISO()??"?"}`}),n)}}catch(t){return{stateId:"free",label:`State derivation failed: ${t instanceof Error?t.message:String(t)}`,facts:[{label:"Members",value:String(e.memberCount)}]}}}function V(e){let t=null==e?void 0:e.paymentMethod;if(void 0!==t)switch(t.type){case"card":return`${t.brand} •••• ${t.last4}`;case"sepa_debit":return`SEPA •••• ${t.last4}`;default:return t.type}}let E=[{key:"Blue node",description:"current state"},{key:"Blue edge",description:"validated, available now"},{key:"Grey edge",description:"validated, unavailable from this state"},{key:"Dotted edge",description:"experimental (toggle to show)"}];function B(e){let{state:t,actions:i,showExperimental:n}=e,r=(0,a(960253).e)(),{stateId:s}=P(t),o=function(e){let{currentStateId:t,actions:i,showExperimental:n,themeMode:r}=e,s=M[r],o=new Map(i.map(e=>[e.name,e])),l=[`%%{init: {'theme':'base','themeVariables':{'fontSize':'14px','primaryColor':'${s.nodeFill}','primaryTextColor':'${s.nodeText}','primaryBorderColor':'${s.nodeStroke}','lineColor':'${s.lineColor}','edgeLabelBackground':'${s.edgeLabelBackground}'},'flowchart':{'curve':'basis','nodeSpacing':45,'rankSpacing':70,'padding':8}}}%%`,"flowchart LR"];for(let[e,t]of(0,a(48697).WP)(A))l.push(`	${e}("${t}")`);let d=[],c=0;
106for(let e of N){let t=o.get(e.actionName);if("experimental"===((null==t?void 0:t.validationStatus)??"experimental")){if(!n)continue;l.push(`	${e.from} -.->|${e.actionName}| ${e.to}`),d.push(`	linkStyle ${c} stroke:#9b9b9b`)}else{l.push(`	${e.from} -->|${e.actionName}| ${e.to}`);let a=(null==t?void 0:t.available)===!0?"#2383e2":"#9b9b9b";d.push(`	linkStyle ${c} stroke:${a}`)}c+=1}l.push(`	classDef state fill:${s.nodeFill},color:${s.nodeText},stroke:${s.nodeStroke}`),l.push("	classDef current fill:#2383e2,color:#ffffff,stroke:#1a6cc4");let p=(0,a(48697).objectKeys)(A).filter(e=>e!==t);return p.length>0&&l.push(`	class ${p.join(",")} state`),l.push(`	class ${t} current`),l.push(...d),l.join("\n")}({currentStateId:s,actions:i,showExperimental:n,themeMode:r});return(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"State graph"}),(0,c.jsx)(a(4458).fI,{gap:12,children:E.map(e=>(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:`${e.key} = ${e.description}`},e.key))}),(0,c.jsx)(a(205855).Z,{source:o})]})}function L(e,t){let a=new Map(e.map(e=>[e.label,e.value])),i=new Set;for(let e of t)a.get(e.label)!==e.value&&i.add(e.label);return i}function _(e){let{snapshotHandle:t}=e,{snapshot:i,previousSnapshot:n,error:r,isLoading:s,fetchSnapshot:o,syncNow:l}=t;return(0,c.jsxs)(a(4458).VP,{gap:12,children:[(0,c.jsxs)(a(4458).fI,{gap:8,children:[(0,c.jsx)(a(912946).j,{onClick:o,disabled:s,children:s?"Loading…":"Fetch snapshot"}),(0,c.jsx)(a(548436).A,{onClick:l,disabled:s||void 0===i,children:"Sync now"})]}),void 0!==r?(0,c.jsx)(a(111010).D,{styleKey:"body",colorPalette:"red",colorVariant:"accentPrimary",children:r}):void 0,void 0!==i?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:"Heads up: MonetizationFastAggregator collapses syncStripeState events for the same customer within a 5s window, so state written by webhook-driven syncs can lag actions by several seconds. If a column looks stale right after an action, re-fetch — the framework surfaces this timing on purpose instead of papering over it."}),(0,c.jsx)(U,{snapshot:i,previousSnapshot:n})]}):void 0]})}function U({snapshot:e,previousSnapshot:t}){let{state:n,stripeCli:r}=e,s=n.billingData,o=`notion postgres get-shard-config --id=${n.spaceId} --table=space`,[l,d]=(0,i.useState)(!1),[p,m]=(0,i.useState)(!1),u=(0,i.useCallback)(()=>{d(e=>!e)},[]),h=(0,i.useCallback)(()=>{m(e=>!e)},[]),y=void 0!==s&&s.invoices.length>0&&s.invoices.every(e=>void 0===e.amountDue),g=W(n),x=void 0===t?void 0:L(W(t.state),g),f=F(r.subscription),b=void 0===t?void 0:L(F(t.stripeCli.subscription),f);return(0,c.jsxs)(a(4458).fI,{gap:12,alignItems:"flex-start",flexWrap:"wrap",children:[(0,c.jsxs)(a(4458).VP,{gap:8,flexGrow:1,flexShrink:1,flexBasis:0,minWidth:260,children:[(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"billingData (product view)"}),(0,c.jsx)(z,{rows:g,changedLabels:x}),y?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"orange",colorVariant:"accentPrimary",children:"DB-fallback mode: monetary fields (amountDue / amountPaid / currency / lineItems) are absent because fetchBillingData fell back to the database. Disagreements with the Stripe CLI column on those fields are expected."}):void 0,(0,c.jsxs)(a(111010).D,{styleKey:"captionRegular",children:["EKM note: on EKM-enabled workspaces the plaintext billing columns are intentionally NULL in Postgres — verify ekm_encrypted_data / ekm_workspace_encryption_key_id are populated on the space shard instead. Resolve the shard with: ",(0,c.jsx)("code",{children:o})]}),(0,c.jsx)(G,{on:l,onClick:u}),l?(0,c.jsx)(Z,{value:s}):void 0]}),(0,c.jsxs)(a(4458).VP,{gap:8,flexGrow:1,flexShrink:1,flexBasis:0,minWidth:260,children:[(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:"Stripe CLI (independent oracle)"}),r.preflight.ok?(0,c.jsxs)(a(4458).VP,{gap:8,children:[(0,c.jsx)(z,{rows:f,changedLabels:b}),(0,c.jsx)(G,{on:p,onClick:h}),(0,c.jsx)(q,{label:"Customer",result:r.customer,showRawJson:p}),(0,c.jsx)(q,{label:"Subscription",result:r.subscription,showRawJson:p}),(0,c.jsx)(q,{label:"Invoices",result:r.invoices,showRawJson:p}),(0,c.jsx)(q,{label:"Test clock",result:r.testClock,showRawJson:p})]}):(0,c.jsx)(a(111010).D,{styleKey:"body",colorPalette:"red",colorVariant:"accentPrimary",children:r.preflight.remediation})]})]})}function W(e){let t={label:"Members",value:String(e.memberCount)};if(void 0===e.billingData)return[{label:"billingData",value:"not loaded"},t];try{var i,n,r;let s=(0,a(337174).Mc)(e.billingData),o=[t];o.push({label:"Tier",value:(0,a(991394).AI)(s)}),o.push({label:"Status",value:(null==(i=s.subscription)?void 0:i.status)??"no subscription"});let l=(0,a(991394).D_)(s);void 0!==l&&o.push({label:"Cancels at",value:l.toISODate()??"?"});let d=null==(n=s.trial)?void 0:n.endDate,c=null==(r=s.subscription)?void 0:r.trialEnd;if(void 0!==d&&void 0!==c)o.push({label:"Trial end",value:`INCONSISTENT — trial.endDate (${d.toISODate()??"?"}
106) and subscription.trialEnd (${c.toISODate()??"?"}) are both set`});else{let e=d??c;void 0!==e&&o.push({label:"Trial end",value:e.toISODate()??"?"})}void 0!==s.externalId&&o.push({label:"Customer",value:s.externalId});let p=s.invoices.reduce((e,t)=>void 0===e||t.createdAt>e.createdAt?t:e,void 0);void 0!==p&&(o.push({label:"Latest invoice",value:`${p.status} (amountDue: ${p.amountDue??"absent"})`}),void 0!==p.currency&&o.push({label:"Currency",value:p.currency}));let m=V(s);return void 0!==m&&o.push({label:"Payment method",value:m}),o}catch(e){return[t,{label:"Summary",value:`derivation failed: ${e instanceof Error?e.message:String(e)} — see raw JSON`}]}}function F(e){if(void 0===e||!e.ok)return[{label:"Subscription",value:"no Stripe subscription result"}];let t=e.json,i=[],n=function(e){if(!(0,a(48697).u4)(e))return;let t=e.items;if(!(0,a(48697).u4)(t))return;let i=t.data;if(Array.isArray(i))return i[0]}(t);i.push({label:"Status",value:K(t,"status")??"absent"});let r=$(t,"quantity")??$(n,"quantity");void 0!==r&&i.push({label:"Quantity",value:String(r)});let s=K(t,"currency")??K(n,"currency");void 0!==s&&i.push({label:"Currency",value:s});let o=$(t,"current_period_end")??$(n,"current_period_end");return void 0!==o&&i.push({label:"Period end",value:new Date(1e3*o).toISOString()}),i}function K(e,t){if(!(0,a(48697).u4)(e))return;let i=e[t];return"string"==typeof i?i:void 0}function $(e,t){if(!(0,a(48697).u4)(e))return;let i=e[t];return"number"==typeof i?i:void 0}a(321577),a(1310),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168);let O={visuallyHidden:a(69916).Qg};function z(e){let{rows:t,changedLabels:i}=e;return(0,c.jsx)(a(4458).VP,{gap:4,children:t.map(e=>(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"baseline",flexWrap:"wrap",children:[(0,c.jsx)(a(111010).D,{styleKey:"body",colorVariant:"secondary",children:e.label}),(0,c.jsx)(a(111010).D,{styleKey:"bodySemibold",children:e.value}),(null==i?void 0:i.has(e.label))===!0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a(746434).E,{content:"changed",color:"blue"}),(0,c.jsx)("span",{style:O.visuallyHidden,children:"value changed since the last action"})]}):void 0]},e.label))})}function G(e){let{on:t,onClick:i}=e;return(0,c.jsx)(a(4458).fI,{children:(0,c.jsx)(a(988022).p,{onClick:i,children:t?"Hide raw JSON":"Show raw JSON"})})}function q(e){let{label:t,result:i,showRawJson:n}=e;return void 0===i?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:`${t}: no matching Stripe ID on billingData`}):(0,c.jsxs)(a(4458).VP,{gap:4,children:[(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:`${t} — ran: ${i.command}`}),i.ok?n?(0,c.jsx)(Z,{value:i.json}):void 0:(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorPalette:"red",colorVariant:"accentPrimary",children:i.error})]})}let H={fontSize:11,maxHeight:400,overflow:"auto",whiteSpace:"pre-wrap",margin:0};function Z({value:e}){return(0,c.jsx)("pre",{style:H,children:JSON.stringify(e,null,2)})}let J={card:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6},visuallyHidden:a(69916).Qg};function Q(e){let{state:t,previousState:n}=e,r=P(t),s=void 0===n?void 0:L(P(n).facts,r.facts),o=t.firstPageId,l=(0,i.useCallback)(()=>{if(void 0===o)return;let e=new URL(`/${o.replaceAll("-","")}`,window.location.origin);window.open(e.toString(),"_blank","noopener,noreferrer")},[o]);return(0,c.jsxs)(a(4458).VP,{gap:8,padding:12,style:J.card,children:[(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(111010).D,{styleKey:"titleSmBold",children:r.label}),void 0!==o?(0,c.jsx)(a(548436).A,{size:"sm",onClick:l,children:"Open workspace"}):void 0]}),r.facts.map(e=>(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:e.label}),(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:e.value}),(null==s?void 0:s.has(e.label))===!0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(a(746434).E,{content:"changed",color:"blue"}),(0,c.jsx)("span",{style:J.visuallyHidden,children:"value changed since the last action"})]}):void 0]},e.label))]})}function Y(){if("u"<typeof window)return{spaceId:"",spaceName:"",actionSequence:"[]"};let e=new URLSearchParams(window.location.search);return{spaceId:e.get("spaceId")??"",spaceName:e.get("spaceName")??"",actionSequence:e.get("actionSequence")??"[]"}}let X={sidePane:{position:"sticky",top:16,maxHeight:"calc(100vh - 32px)",overflowY:"auto"},visuallyHidden:a(69916).Qg};function ee(){var e;let[t]=(0,i.useState)(Y),[n,r]=(0,i.useState)(t.spaceId),s=(0,i.useCallback)(e=>{r(e.target.value)},[]),o=(0,i.useCallback)(e=>{r(e)},[]),l=n.trim(),p=function(e){let t=(0,a(533992).v3)(),[n,r]=(0,i.useState)(),[s,o]=(0,i.useState)(),[l,c]=(0,i.useState)(),[p,m]=(0,i.useState)(!1),u=(0,i.useRef)(void 0),[h,y]=(0,i.useState)(e);e!==h&&(y(e),r(void 0),o(void 0),c(void 0),u.current=void 0);let g=(0,i.useCallback)(async()=>{m(!0),c(void 0);try{let a=await t.api.callApi({eventName:"adminMonetizationTestingGet
106Snapshot",environment:t,data:{spaceId:e}});"success"===a.type?(o(u.current),r(a.data),u.current=a.data):c(d(a.error))}catch(e){c(e instanceof Error?e.message:"Failed to fetch snapshot")}finally{m(!1)}},[t,e]),x=(0,i.useCallback)(async()=>{let a;m(!0),c(void 0);try{let i=await t.api.callApi({eventName:"adminSyncBillingState",environment:t,data:{spaceId:e}});"success"!==i.type&&(a=d(i.error))}catch(e){a=e instanceof Error?e.message:"Sync failed"}await g(),void 0!==a&&c(a)},[t,e,g]);return{snapshot:n,previousSnapshot:s,error:l,isLoading:p,fetchSnapshot:g,syncNow:x}}(l),{fetchSnapshot:u}=p;(0,i.useEffect)(()=>{""!==l&&u()},[l,u]);let[h,y]=(0,i.useState)(0),g=(0,i.useCallback)(()=>{y(e=>e+1)},[]),x=(0,i.useCallback)(()=>{y(e=>Math.max(0,e-1)),u()},[u]),f=h>0||p.isLoading,[b,j]=(0,i.useState)(!1),[k,S]=(0,i.useState)(!1),w=(0,i.useCallback)(()=>{j(e=>!e)},[]),I=(0,i.useCallback)(()=>{S(e=>!e)},[]);return(0,c.jsxs)(a(220952).U,{currentSection:"monetizationTesting",children:[(0,c.jsx)(a(45062).A,{title:"Monetization Testing"}),(0,c.jsxs)(a(4458).VP,{gap:12,padding:16,children:[(0,c.jsx)(a(111010).D,{styleKey:"titleXlBold",children:"Monetization Testing"}),(0,c.jsx)(a(111010).D,{styleKey:"body",children:"Drive a workspace into a monetization state with composable actions, then validate billingData against an independent Stripe CLI oracle."}),(0,c.jsxs)(a(4458).fI,{gap:16,alignItems:"center",children:[(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(813415).d,{on:b,onClick:w,inputId:"monetization-testing-show-experimental","aria-label":"Show experimental actions and scenarios"}),(0,c.jsx)("label",{htmlFor:"monetization-testing-show-experimental",children:(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:"Show experimental"})})]}),(0,c.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,c.jsx)(a(813415).d,{on:k,onClick:I,inputId:"monetization-testing-show-unavailable","aria-label":"Show unavailable actions"}),(0,c.jsx)("label",{htmlFor:"monetization-testing-show-unavailable",children:(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",children:"Show unavailable"})})]})]}),(0,c.jsx)(a(287562).p,{value:n,onChange:s,placeholder:"Workspace (space) ID to inspect"}),(0,c.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",flexWrap:"wrap",children:[(0,c.jsxs)(a(4458).VP,{gap:12,flexGrow:2,flexShrink:1,flexBasis:0,minWidth:460,children:[(0,c.jsx)(C,{showExperimental:b,onWorkspaceCreated:o}),(0,c.jsx)(v,{initialSpaceName:t.spaceName,initialActionSequence:t.actionSequence,onWorkspaceCreated:o}),void 0!==p.snapshot?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(B,{state:p.snapshot.state,actions:p.snapshot.actions,showExperimental:b}),(0,c.jsx)(m,{spaceId:l,actions:p.snapshot.actions,showExperimental:b,showUnavailable:k,onActionStart:g,onActionComplete:x})]}):void 0]}),""!==l?(0,c.jsxs)(a(4458).VP,{gap:12,flexGrow:3,flexShrink:1,flexBasis:0,minWidth:520,style:X.sidePane,children:[(0,c.jsx)("div",{role:"status",children:f?(0,c.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"secondary",children:"Refreshing snapshot…"}):(0,c.jsx)("span",{style:X.visuallyHidden,children:"Snapshot up to date"})}),void 0!==p.snapshot?(0,c.jsx)(Q,{state:p.snapshot.state,previousState:null==(e=p.previousSnapshot)?void 0:e.state}):void 0,(0,c.jsx)(_,{snapshotHandle:p})]}):void 0]})]})]})}},810198(e,t,a){a.d(t,{Z:()=>s}),a(176765),a(851344),a(866491),a(635790);let i=a(764657).object({required:{actionId:a(764657).string(),endpoint:a(764657).string(),executionId:a(764657).string(),phase:a(764657).literals("EXECUTION","PLANNING","REVERT"),target:a(764657).object({required:{id:a(764657).string(),table:a(764657).string()},optional:{}})},optional:{}});var n=a(440302);let r=(0,a(327219).YK)({PLANNING:{id:"notinoActionAuditDetails.planning",defaultMessage:"Planning"},EXECUTION:{id:"notinoActionAuditDetails.execution",defaultMessage:"Execution"},REVERT:{id:"notinoActionAuditDetails.revert",defaultMessage:"Reversal"},openRun:{id:"notinoActionAuditDetails.openRun",defaultMessage:"Open run"}});function s(e){let t=(0,a(327219).tz)(),s=(0,a(533992).v3)(),o=e.adminUserId===(s.currentUser.adminUserId??s.currentUser.id),{params:l}=e;if(!(0,a(48697).u4)(l))return null;let d=(0,a(788145).jA)(i,l.__notinoAction);if(a(80279).Q.isFail(d))return null;let{actionId:c,executionId:p,phase:m}=d.value,u=new URLSearchParams({actionId:c,executionId:p});return(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",children:t.formatMessage(r[m])}),o?(0,n.jsx)(a(988022).p,{size:"sm",href:`${a(168962).JZ.adminNotinoActionRuns}?${u.toString()}`,children:t.formatMessage(r.openRun)}):void 0]}),(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:p})]})}},524423(e,t,a){a.r(t),a(533958),a(730330),a(139583),a(159952),a(176765),a(851344),a(866491);var i=a(635790),n=a(440302);let r=(0,a(327219).YK)({title:{id:"adminNotinoActionRuns.title",defaultMessage:"Action history"},documentTitle:{id:"adminNotinoActionRuns.documentTitle",defaultMessage:"Action history - Notion Admin"},description:{id:"adminNotinoActionRuns.description",defaultMessage:"Your recent Admin action runs, newest first."},empty:{id:"adminNotinoActionRuns.empty",defaultMessage:"You have no action runs yet."},showMore:{id:"adminNotinoActionRuns.showMore",defaultMessage:"Show more"},unexpectedError:{id:"adminNotinoActionRuns.unexpectedError",defaultMessage:"The action history request failed unexpectedly."}}),s={k1xSpc:"x78zum5",kGNEyG:"x6s0dn4",khm7nJ:"xp1r0qw",k1C7PZ:"xtqikln",kZCmMZ:"xf7dkkf",kwRFfy:"xv54qhq",kE3dHu:null,kpe85a:null,kLKAdn:"xz9dl7a",kGO01o:"xsag5q8",kybGjl:"x1hl2dhg",kMwMTN:"x39shxw",kC7eKd:"xfcwbsc x15zahet",kI3sdo:"x1a2a7pz x1w79tpz",kInvED:"x2ssjo2",$$css:!0},o={kX8ASl:"xiycden",$$css:!0};function l(e){let{executionId:t,actionId:s}=e,o=(0,a(533992).v3)(),l=(0,a(327219).tz)(),{navigate:c}=(0,i.useContext)(a(44894).E),u=(0,i.useCallback)(()=>{c({environment:o,url:a(168962).JZ.adminNotinoActionRuns})},[o,c]),h=Object.values(a(688211)._P).find(e=>(0,a(688211).nZ)(e)&&e.notinoAction.actionId===s),[y,g]=(0,i.useState)([]),[x,f]=(0,i.useState)(void 0),[b,v]=(0,i.useState)(!0),[j,k]=(0,i.useState)(!1),[S,w]=(0,i.useState)(void 0),I=(0,i.useCallback)(async e=>{w(void 0);try{let t=await o.api.callApi({eventName:"adminListNotinoActionRuns",environment:o,data:{limit:25,cursor:e}});if("success"!==t.type)return void w((0,a(201790).V4)(t));g(a=>void 0===e?t.data.runs:[...a,...t.data.runs]),f(t.data.nextCursor)}catch(e){(0,a(208318).t)().error({type:"error",from:"NotinoActionRunsPage.loadRuns",error:e}),w(e instanceof Error?e.message:l.formatMessage(r.unexpectedError))}},[o,l]);(0,i.useEffect)(()=>{I().finally(()=>v(!1))},[I]);let C=(0,i.useCallback)(()=>{void 0!==x&&(k(!0),I(x).finally(()=>k(!1)))},[I,x]);return(0,n.jsx)(a(45062).A,{title:l.formatMessage(r.documentTitle),children:(0,n.jsx)(a(220952).U,{children:(0,n.jsxs)("div",{...{className:"x1xr5p7o xvc5jky x11t971q x13jy36j x64bnmy x1miatn0 x1gan7if x78zum5 xdt5ytf x1kb72lq x18hwk67"},children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSemibold",colorVariant:"primary",children:l.formatMessage(r.title)}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:l.formatMessage(r.description)})]}),t?h&&(0,a(688211).nZ)(h)?(0,n.jsx)(p,{executionId:t,config:h.notinoAction,apiName:h.apiName,title:h.displayName??h.apiName,onClose:u},t):(0,n.jsx)(m,{executionId:t,onClose:u},t):void 0,(0,n.jsx)(d,{runs:y,isLoading:b,isLoadingMore:j,error:S,hasMore:void 0!==x,onShowMore:C})]})})})}function d({runs:e,isLoading:t,isLoadingMore:i,error:s,hasMore:o,onShowMore:l}){let p=(0,a(327219).tz)();return t?(0,n.jsx)(a(4458).fI,{justifyContent:"center",padding:32,children:(0,n.jsx)(a(517334).k,{size:22})}):void 0!==s&&0===e.length?(0,n.jsx)("div",{role:"alert",...{className:"x6hnrot xcjx3il x5m9n4a x16skee8 xjqs0th x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",children:s})}):0===e.length?(0,n.jsx)("div",{...{className:"xhsfehk xa8xo2u x1q4eyhr xh27kie x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 x13zrc24 xp48ta0 x1t1ogtf xtssl2i x2b8uid"},children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:p.formatMessage(r.empty)})}):(0,n.jsxs)(a(4458).VP,{gap:12,children:[(0,n.jsx)("div",{...{className:"xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 x6ikm8r x10wlt62 xd54fh8"},children:e.map((e,t)=>(0,n.jsx)(c,{run:e,hasDivider:t>0},e.executionId))}),void 0!==s?(0,n.jsx)("div",{role:"alert",...{className:"x6hnrot xcjx3il x5m9n4a x16skee8 xjqs0th x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",children:s})}):void 0,o?(0,n.jsx)(a(548436).A,{size:"md",onClick:l,disabled:i,isLoading:i,children:p.formatMessage(r.showMore)}):void 0]})}function c({run:e,hasDivider:t}){var r;let l,d=(l=new URLSearchParams({executionId:(r=e).executionId,actionId:r.actionId}),`${a(168962).JZ.adminNotinoActionRuns}?${l.toString()}`),p=(0,a(533992).v3)(),{navigate:m}=(0,i.useContext)(a(44894).E),u=(0,i.useCallback)(e=>{0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),m({environment:p,url:d}))},[d,p,m]),h=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(4458).VP,{gap:4,...{className:"x98rzlu xeuugli"},children:[(0,n.jsxs)(a(4458).fI,{gap:8,justifyContent:"space-between",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.actionId}),(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:e.state})]}),(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:`${e.capability.verb} ${e.capability.resource.table}:${e.capability.resource.id}`}),(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"tertiary",children:`${(0,a(344184).vO)(e.createdAt)} \xb7 ${e.executionId}`})]}),(0,n.jsx)(a(16275).I,{icon:a(491469).arrowChevronSingleRightSmallIcon,size:"sm",...{className:"x2lah0s"}})]});return(0,n.jsx)("a",{href:d,onClick:u,...a(398276).A.props(s,t?o:void 0),children:h})}function p(e){let{executionId:t,config:i,apiName:r,title:s,onClose:o}=e,l=(0,a(533992).v3)(),d=(0,a(743187).g)(),c=(0,a(47602).S)(d,r),p=(0,a(624139).e)({environment:l,config:i,initialExecutionId:t});return(0,n.jsx)(a(624139).j,{mode:"history",title:s,controller:{...p,closeDialog:o},hasPermission:!0===c,ArtifactPresentationComponent:i.ArtifactPresentationComponent})}function m(e){let{executionId:t,onClose:i}=e,r=(0,a(533992).v3)(),s=(0,a(624139).e)({environment:r,config:void 0,initialExecutionId:t}),{content:o}=s.state;return(0,n.jsx)(a(624139).j,{mode:"history",title:"run"in o?o.run.actionId:t,controller:{...s,closeDialog:i},hasPermission:!1})}a.d(t,{NotinoActionRunsPage:()=>l})},624139(e,t,a){a.d(t,{j:()=>P,e:()=>N}),a(533958),a(159952),a(176765),a(851344),a(866491);var i=a(635790);a(764657).union([a(764657).isNull(),a(764657).literal(!1),a(764657).literal(!0),a(764657).number(),a(764657).string()]);let n=a(764657).record(a(764657).string(),a(764657).lazy(()=>
106s)),r=a(764657).array(a(764657).lazy(()=>s)),s=a(764657).union([a(764657).isNull(),a(764657).lazy(()=>r),a(764657).lazy(()=>n),a(764657).literal(!1),a(764657).literal(!0),a(764657).number(),a(764657).string()]),o=a(764657).object({required:{rows:a(764657).array(a(764657).object({required:{disposition:a(764657).literals("change","no_op","refused","skipped"),operation:a(764657).string(),planRowId:a(764657).string(),target:a(764657).object({required:{label:a(764657).string()},optional:{id:a(764657).string(),spaceId:a(764657).string(),table:a(764657).string()}})},optional:{reason:a(764657).string(),reasonCode:a(764657).string(),snapshots:a(764657).object({required:{after:a(764657).nullable(n),before:a(764657).nullable(n)},optional:{}})}})),standardVersion:a(764657).literal(1)},optional:{facts:a(764657).array(a(764657).object({required:{key:a(764657).string(),label:a(764657).string(),value:a(764657).string()},optional:{}})),notes:a(764657).array(a(764657).string())}}),l=a(764657).object({required:{rows:a(764657).array(a(764657).object({required:{operation:a(764657).string(),outcome:a(764657).literals("changed","failed","no_op","refused","skipped","unknown","untouched"),planRowId:a(764657).string(),target:a(764657).object({required:{label:a(764657).string()},optional:{id:a(764657).string(),spaceId:a(764657).string(),table:a(764657).string()}})},optional:{reason:a(764657).string(),reasonCode:a(764657).string(),snapshots:a(764657).object({required:{after:a(764657).nullable(n),before:a(764657).nullable(n)},optional:{}})}})),standardVersion:a(764657).literal(1)},optional:{csvExport:a(764657).object({required:{columns:a(764657).array(a(764657).string()),rows:a(764657).array(a(764657).record(a(764657).string(),a(764657).union([a(764657).isNull(),a(764657).literal(!1),a(764657).literal(!0),a(764657).number(),a(764657).string()])))},optional:{}}),facts:a(764657).array(a(764657).object({required:{key:a(764657).string(),label:a(764657).string(),value:a(764657).string()},optional:{}})),notes:a(764657).array(a(764657).string())}});var d=a(440302);let c=(0,a(327219).YK)({downloadCsv:{id:"notinoActionCsvExportButton.downloadCsv",defaultMessage:"Download CSV"}});function p(e){var t;let{actionId:n,executionId:r,result:s}=e,o=(0,a(327219).tz)(),p=null==(t=(0,a(788145).Qq)(l,s))?void 0:t.csvExport,m=(0,i.useCallback)(()=>{void 0!==p&&(0,a(216736).WN)({blob:new Blob([(0,a(62935).L)(p)],{type:"text/csv;charset=utf-8"}),filename:`${n}-${r}.csv`})},[n,p,r]);return void 0===p||0===p.rows.length?null:(0,d.jsx)(a(548436).A,{size:"md",onClick:m,children:o.formatMessage(c.downloadCsv)})}a(730330),a(976614),a(974864),a(765324);var m=a.n(a(943777));let u=(0,a(327219).YK)({summary:{id:"notinoActionPlanChanges.summary",defaultMessage:"{count, plural, =0 {No changes needed} one {# change planned} other {# changes planned}}"},appliedSummary:{id:"notinoActionPlanChanges.appliedSummary",defaultMessage:"{count, plural, =0 {No changes were needed} one {# change applied} other {# changes applied}}"},created:{id:"notinoActionPlanChanges.created",defaultMessage:"Created"},updated:{id:"notinoActionPlanChanges.updated",defaultMessage:"Updated"},deleted:{id:"notinoActionPlanChanges.deleted",defaultMessage:"Deleted"},before:{id:"notinoActionPlanChanges.before",defaultMessage:"Before"},after:{id:"notinoActionPlanChanges.after",defaultMessage:"After"},create:{id:"notinoActionPlanChanges.create",defaultMessage:"Will be created"},update:{id:"notinoActionPlanChanges.update",defaultMessage:"Will be updated"},delete:{id:"notinoActionPlanChanges.delete",defaultMessage:"Will be deleted"},unchanged:{id:"notinoActionPlanChanges.unchanged",defaultMessage:"No change"},workspace:{id:"notinoActionPlanChanges.workspace",defaultMessage:"Workspace: {id}"},record:{id:"notinoActionPlanChanges.record",defaultMessage:"{table}: {id}"},absent:{id:"notinoActionPlanChanges.absent",defaultMessage:"Not present"}}),h={planned:{create:"create",update:"update",delete:"delete",unchanged:"unchanged"},applied:{create:"created",update:"updated",delete:"deleted",unchanged:"unchanged"}};function y(e){var t;let{review:i,mode:n="planned",hideSummary:r=!1}
106=e,s=(0,a(327219).tz)(),o=2===i.version?i.changes:i.changes.map(b);return(0,d.jsxs)(a(4458).VP,{gap:16,children:[r?void 0:(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",children:s.formatMessage("applied"===n?u.appliedSummary:u.summary,{count:o.filter(e=>"unchanged"!==f(e)).length})}),2===i.version?null==(t=i.context)?void 0:t.map((e,t)=>(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:e},t)):void 0,o.map((e,t)=>{var a;return(0,d.jsx)(x,{change:e,mode:n,reason:1===i.version?null==(a=i.changes[t])?void 0:a.reason:void 0},t)})]})}let g={card:{border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},metadata:{overflowWrap:"anywhere"},before:{background:a(632079).Tj.red.background.secondaryTranslucent},after:{background:a(632079).Tj.green.background.secondaryTranslucent}};function x(e){let{change:t,mode:n,reason:r}=e,s=(0,a(327219).tz)(),o=(0,a(960253).e)(),l=null===t.before?"":m()(t.before,{space:2})??"",c=null===t.after?"":m()(t.after,{space:2})??"",p=Math.max(l.split("\n").length,c.split("\n").length),y=f(t),x=s.formatMessage(u.before),b=s.formatMessage(u.after),v=(0,i.useCallback)(e=>{e.getOriginalEditor().updateOptions({ariaLabel:`${t.target.label}: ${x}`}),e.getModifiedEditor().updateOptions({ariaLabel:`${t.target.label}: ${b}`})},[t.target.label,x,b]);return(0,d.jsxs)(a(4458).VP,{style:g.card,children:[(0,d.jsxs)(a(4458).VP,{padding:12,gap:4,style:g.metadata,children:[(0,d.jsxs)(a(4458).fI,{gap:8,justifyContent:"space-between",flexWrap:"wrap",children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",children:t.target.label}),(0,d.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:s.formatMessage(u[h[n][y]])})]}),t.target.spaceId?(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:s.formatMessage(u.workspace,{id:t.target.spaceId})}):void 0,t.target.id?(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:t.target.table?s.formatMessage(u.record,{table:t.target.table,id:t.target.id}):t.target.id}):void 0,r?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:r}):void 0]}),(0,d.jsxs)(a(4458).fI,{children:[(0,d.jsxs)(a(4458).VP,{width:"50%",padding:8,style:g.before,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",children:x}),null===t.before?(0,d.jsx)(a(111010).D,{styleKey:"caption",children:s.formatMessage(u.absent)}):void 0]}),(0,d.jsxs)(a(4458).VP,{width:"50%",padding:8,style:g.after,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",children:b}),null===t.after?(0,d.jsx)(a(111010).D,{styleKey:"caption",children:s.formatMessage(u.absent)}):void 0]})]}),(0,d.jsx)(a(480088).K,{onMount:v,original:l,modified:c,language:"json",theme:"dark"===o?"vs-dark":"vs",height:Math.min(400,Math.max(120,20*p+24)),options:{readOnly:!0,domReadOnly:!0,originalEditable:!1,renderSideBySide:!0,useInlineViewWhenSpaceIsLimited:!1,enableSplitViewResizing:!1,tabFocusMode:!0,originalAriaLabel:`${t.target.label}: ${x}`,modifiedAriaLabel:`${t.target.label}: ${b}`,minimap:{enabled:!1},renderOverviewRuler:!1,renderGutterMenu:!1,scrollBeyondLastLine:!1,automaticLayout:!0}})]})}function f(e){return(0,a(931576).n)(e.before,e.after)?"unchanged":null===e.before?"create":null===e.after?"delete":"update"}function b(e){return{target:e.target,before:"create"===e.kind?null:v(e.fields,"before"),after:"delete"===e.kind?null:v(e.fields,"after")}}function v(e,t){return(0,a(48697).MU)(e.flatMap(e=>{let a=e[t];return"absent"===a.kind?[]:[[e.key,"list"===a.kind?a.items:a.value]]}))}let j=(0,a(327219).YK)({showDetails:{id:"notinoActionTechnicalDetails.showDetails",defaultMessage:"Show technical details"},hideDetails:{id:"notinoActionTechnicalDetails.hideDetails",defaultMessage:"Hide technical details"}});function k(e){let t=(0,a(327219).tz)(),[n,r]=(0,i.useState)(!1),s=(0,i.useCallback)(()=>r(e=>!e),[]);return(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(548436).A,{size:"sm",onClick:s,children:t.formatMessage(n?j.hideDetails:j.showDetail
106s)}),n?(0,d.jsx)(a(243119).A,{data:e.data,hideHelp:!0}):void 0]})}function S(e){let{headline:t,description:i,rows:n=[],metadata:r=[],details:s=[],technicalDetails:o,children:l}=e;return(0,d.jsxs)(a(4458).VP,{gap:12,children:[t||i||n.length>0?(0,d.jsxs)(a(4458).VP,{gap:8,children:[t?(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:t}):void 0,i?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i}):void 0,(0,d.jsx)(w,{rows:n})]}):void 0,l,r.length>0?(0,d.jsx)(a(4458).VP,{gap:4,children:r.map(e=>(0,d.jsxs)(a(4458).fI,{gap:8,justifyContent:"space-between",flexWrap:"wrap",children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"tertiary",children:e.label}),(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:e.value})]},e.key))}):void 0,s.length>0?(0,d.jsx)(a(4458).VP,{gap:4,children:s.map(e=>(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:e.content},e.key))}):void 0,o?(0,d.jsx)(k,{data:o}):void 0]})}function w(e){return 0===e.rows.length?null:(0,d.jsx)(a(4458).VP,{gap:4,children:e.rows.map(e=>(0,d.jsxs)(a(4458).fI,{justifyContent:"space-between",gap:8,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:e.label}),(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:e.value})]},e.key))})}let I=(0,a(327219).YK)({planHeadline:{id:"notinoActionStandardArtifact.planHeadline",defaultMessage:"{count, plural, =0 {No changes needed} one {# change planned} other {# changes planned}}"},resultHeadline:{id:"notinoActionStandardArtifact.resultHeadline",defaultMessage:"{count, plural, =0 {No changes were needed} one {# change applied} other {# changes applied}}"},planNotAppliedHeadline:{id:"notinoActionStandardArtifact.planNotAppliedHeadline",defaultMessage:"This run will not change anything"},resultUnknownHeadline:{id:"notinoActionStandardArtifact.resultUnknownHeadline",defaultMessage:"Some changes could not be confirmed. Check the affected records before retrying."},resultNotAppliedHeadline:{id:"notinoActionStandardArtifact.resultNotAppliedHeadline",defaultMessage:"No changes were made"},row:{id:"notinoActionStandardArtifact.row",defaultMessage:"{label} · {status}"},rowWithReason:{id:"notinoActionStandardArtifact.rowWithReason",defaultMessage:"{label} · {status} · {reason}"},change:{id:"notinoActionStandardArtifact.change",defaultMessage:"Will be applied"},noOp:{id:"notinoActionStandardArtifact.noOp",defaultMessage:"Already in the requested state"},skipped:{id:"notinoActionStandardArtifact.skipped",defaultMessage:"Skipped"},refused:{id:"notinoActionStandardArtifact.refused",defaultMessage:"Refused, nothing written"},changed:{id:"notinoActionStandardArtifact.changed",defaultMessage:"Changed"},failed:{id:"notinoActionStandardArtifact.failed",defaultMessage:"Failed, nothing written"},untouched:{id:"notinoActionStandardArtifact.untouched",defaultMessage:"Not attempted"},unknown:{id:"notinoActionStandardArtifact.unknown",defaultMessage:"Unknown, check the record"}}),C={change:I.change,no_op:I.noOp,skipped:I.skipped,refused:I.refused},D={changed:I.changed,no_op:I.noOp,skipped:I.skipped,refused:I.refused,failed:I.failed,untouched:I.untouched,unknown:I.unknown};function T(e){let{artifact:t}=e;if("plan"===t.artifactKind){var a,i;let e,n,{review:r}=t;return(0,d.jsx)(R,{mode:"planned",rows:r.rows.map(e=>({row:e,status:C[e.disposition],isChange:"change"===e.disposition})),headline:(e=(a=r).rows.some(e=>"change"===e.disposition),n=a.rows.some(e=>"refused"===e.disposition)||0===a.rows.length&&((null==(i=a.notes)?void 0:i.length)??0)>0,!e&&n?I.planNotAppliedHeadline:I.planHeadline),facts:r.facts,notes:r.notes})}let{result:n}=t;return(0,d.jsx)(R,{mode:"applied",rows:n.rows.map(e=>({row:e,status:D[e.outcome],isChange:"changed"===e.outcome})),headline:function(e){var t;if(e.rows.some(e=>"unknown"===e.outcome))return I.resultUnknownHeadline;let a=e.rows.some(e=>"changed"===e.outcome),i=e.rows.some(e=>"refused"===e.outcome||"failed"===e.outcome||"untouched"===e.outcome||"skipped"===e.outcome)||0===e.rows.length&&((null==(t=e.notes)?void 0:t.length)??0)>0;return!a&&i?I.resultNotAppliedHeadline:I.resultHeadline}(n),facts:n.facts,notes:n.notes})}function R(e){let{mode:t,rows:i,headline:n,facts:r,notes:s}=e,o=(0,a(327219).tz)(),l=i.filter(({row:e})=>void 0!==e.snapshots),c=i.filter(({row:e,isChange:t})=>!t||void 0===e.snapshots),p=i.filter(({isChange:e})=>e).length;return(0,d.jsx)(S,{headline:o.formatMessage(n,{count:p}),rows:function(e,t){let a=new Map;for(let{status:t}of e)a.set(t,(a.get(t)??0)+1);return Array.from(a,([e,a])=>({key:e.id,label:t.formatMessage(e),value:a}))}(i,o),metadata:(r??[]).map(e=>({key:e.key,label:e.label,value:e.value})),details:[...(s??[]).map((e,t)=>({key:`note:${t}`,content:e})),...c.map(e=>(function(e,t){let{row:a,status:i}=e,n={label:a.target.label,status:t.formatMessage(i)};return{key:a.planRowId,content:void 0===a.reason?t.formatMessage(I.row,n):t.formatMessage(I.rowWithReason,{...n,reason:a.reason})}})(e,o))],technicalDetails:{rows:i.map(({row:e})=>e),facts:r,notes:s},children:l.length>0?(0,d.jsx)(y,{review:{version:2,changes:l.flatMap(({row:e})=>e.snapshots?[{target:e.target,...e.snapshots}]:[])},mode:t,hideSummary:!0}):void 0})}(0,a(327219).YK)({unsupported:{id:"validatedNotinoActionArtifact.unsupported",defaultMessage:"This saved action payload is not supported by this version of Admin Mode."}});let A=(0,a(327219).YK)({asyncAccepted:{id:"notinoActionWorkflow.asyncAccepted",defaultMessage:"Action started. Progress and results will be available on its execution page."},verificationPassed:{id:"notinoActionWorkflow.verificationPassed",defaultMessage:"Verification passed"},verificationFailed:{id:"notinoActionWorkflow.verificationFailed",defaultMessage:"Verification did not confirm the changes"},missingResult:{id:"notinoActionWorkflow.missingResult",defaultMessage:"No result was saved for the latest stage. Any earlier artifacts shown below do not confirm its outcome."},noArtifacts:{id:"notinoActionWorkflow.noArtifacts",defaultMessage:"No saved artifacts are available for this run."},additionalContext:{id:"notinoActionWorkflow.additionalContext",defaultMessage:"Additional context"},artifactPlan:{id:"notinoActionWorkflow.artifactPlan",defaultMessage:"Plan"},artifactExecution:{id:"notinoActionWorkflow.artifactExecution",defaultMessage:"Execution"},artifactReversal:{id:"notinoActionWorkflow.artifactReversal",defaultMessage:"Reversal"},artifactStages:{id:"notinoActionWorkflow.artifactStages",defaultMessage:"Run stages"},artifactLoading:{id:"notinoActionWorkflow.artifactLoading",defaultMessage:"Loading saved details…"},savedRunHeading:{id:"notinoActionWorkflow.useExecutionId",defaultMessage:"Use execution ID"},executionIdHelp:{id:"notinoActionWorkflow.executionIdHelp",defaultMessage:"Open a saved run to review and execute its plan, or revert its changes."},executionIdLabel:{id:"notinoActionWorkflow.executionIdLabel",defaultMessage:"Execution ID"},openRun:{id:"notinoActionWorkflow.openRun",defaultMessage:"Open run"},viewRun:{id:"notinoActionWorkflow.viewRun",defaultMessage:"View current run"}
106,close:{id:"notinoActionWorkflow.close",defaultMessage:"Close"},closeWhileRunning:{id:"notinoActionWorkflow.closeWhileRunning",defaultMessage:"You can close this dialog. The request will continue."},planFailed:{id:"notinoActionWorkflow.planFailed",defaultMessage:"Could not prepare the plan"},stepLabel:{id:"notinoActionWorkflow.stepLabel",defaultMessage:"Step {step} of 3"},configureDescription:{id:"notinoActionWorkflow.configureDescription",defaultMessage:"Enter the target, then review every change before applying it."},reviewChanges:{id:"notinoActionWorkflow.reviewChanges",defaultMessage:"Plan"},planningTitle:{id:"notinoActionWorkflow.planningTitle",defaultMessage:"Preparing your plan…"},planningDescription:{id:"notinoActionWorkflow.planningDescription",defaultMessage:"Checking the current state. No changes are being made."},loadingTitle:{id:"notinoActionWorkflow.loadingTitle",defaultMessage:"Loading action…"},loadingDescription:{id:"notinoActionWorkflow.loadingDescription",defaultMessage:"Retrieving the saved plan and latest result."},loadFailedTitle:{id:"notinoActionWorkflow.loadFailedTitle",defaultMessage:"Could not load this action"},planReadyTitle:{id:"notinoActionWorkflow.planReadyTitle",defaultMessage:"Plan ready"},planReadyDescription:{id:"notinoActionWorkflow.planReadyDescription",defaultMessage:"Review the planned changes before applying them."},plannedChanges:{id:"notinoActionWorkflow.plannedChanges",defaultMessage:"Planned changes"},editInputs:{id:"notinoActionWorkflow.editInputs",defaultMessage:"Edit inputs"},execute:{id:"notinoActionWorkflow.execute",defaultMessage:"Approve and execute"},irreversible:{id:"notinoActionWorkflow.irreversible",defaultMessage:"This action cannot be reverted."},executingTitle:{id:"notinoActionWorkflow.executingTitle",defaultMessage:"Applying approved changes…"},executingDescription:{id:"notinoActionWorkflow.executingDescription",defaultMessage:"The approved plan remains visible while the action runs."},executionCompleteTitle:{id:"notinoActionWorkflow.executionCompleteTitle",defaultMessage:"Changes applied"},executionCompleteDescription:{id:"notinoActionWorkflow.executionCompleteDescription",defaultMessage:"The action finished and its result was saved."},executionPartialTitle:{id:"notinoActionWorkflow.executionPartialTitle",defaultMessage:"Changes partially applied"},executionPartialDescription:{id:"notinoActionWorkflow.executionPartialDescription",defaultMessage:"The action applied only some changes. Review the saved result before continuing."},executionFailedTitle:{id:"notinoActionWorkflow.executionFailedTitle",defaultMessage:"Changes were not applied"},executionFailedDescription:{id:"notinoActionWorkflow.executionFailedDescription",defaultMessage:"The action failed. Review the saved result before trying again."},executionUnknownTitle:{id:"notinoActionWorkflow.executionUnknownTitle",defaultMessage:"Execution outcome unknown"},executionUnknownDescription:{id:"notinoActionWorkflow.executionUnknownDescription",defaultMessage:"The system could not confirm whether all changes were applied. Review the saved result before retrying."}
106,executionDetails:{id:"notinoActionWorkflow.executionDetails",defaultMessage:"Result details"},revert:{id:"notinoActionWorkflow.revert",defaultMessage:"Revert changes"},revertingTitle:{id:"notinoActionWorkflow.revertingTitle",defaultMessage:"Reverting changes…"},revertingDescription:{id:"notinoActionWorkflow.revertingDescription",defaultMessage:"The execution result remains visible while the revert runs."},revertedTitle:{id:"notinoActionWorkflow.revertedTitle",defaultMessage:"Changes reverted"},revertedDescription:{id:"notinoActionWorkflow.revertedDescription",defaultMessage:"The revert finished and its result was saved."},revertPartialTitle:{id:"notinoActionWorkflow.revertPartialTitle",defaultMessage:"Changes partially reverted"},revertPartialDescription:{id:"notinoActionWorkflow.revertPartialDescription",defaultMessage:"The revert completed only some changes. Review the saved result before continuing."},revertFailedTitle:{id:"notinoActionWorkflow.revertFailedTitle",defaultMessage:"Changes were not reverted"},revertFailedDescription:{id:"notinoActionWorkflow.revertFailedDescription",defaultMessage:"The revert failed. Review the saved result before trying again."},revertUnknownTitle:{id:"notinoActionWorkflow.revertUnknownTitle",defaultMessage:"Revert outcome unknown"},revertUnknownDescription:{id:"notinoActionWorkflow.revertUnknownDescription",defaultMessage:"The system could not confirm whether all changes were reverted. Review the saved result before retrying."},revertDetails:{id:"notinoActionWorkflow.revertDetails",defaultMessage:"Revert details"},planAnother:{id:"notinoActionWorkflow.planAnother",defaultMessage:"Plan another action"},tryAgain:{id:"notinoActionWorkflow.tryAgain",defaultMessage:"Try again"},unexpectedError:{id:"notinoActionWorkflow.unexpectedError",defaultMessage:"The action request failed unexpectedly."},executionIdValue:{id:"notinoActionWorkflow.executionIdValue",defaultMessage:"Execution ID: {executionId}"},stateValue:{id:"notinoActionWorkflow.stateValue",defaultMessage:"State: {state}"}});function N(e){let{environment:t,config:n,initialExecutionId:r,onLoadingStateChange:s}=e,o=(0,a(327219).tz)(),{navigate:l}=(0,i.useContext)(a(44894).E),d=(0,i.useCallback)(async e=>{if(!er(e))return ee({environment:t,executionId:e.executionId,expectedActionId:e.actionId},e);if(void 0!==e.remoteExecution&&((0,a(514164).oR)(o.formatMessage(A.asyncAccepted)),r!==e.executionId)){let i=new URLSearchParams({executionId:e.executionId,actionId:e.actionId});l({environment:t,url:`${a(168962).JZ.adminNotinoActionRuns}?${i.toString()}`})}return{kind:"saved_run",run:e,artifact:void 0}},[t,r,o,l]),c=(null==r?void 0:r.trim())??"",[p,m]=(0,i.useState)(()=>c.length>0?{content:{kind:"recovery",executionId:c},pendingOperation:"load"}:{content:{kind:"configuration"}}),u=(0,i.useRef)(!1),h=(0,i.useRef)(c),y=(0,i.useRef)(!1),[g,x]=(0,i.useState)(c.length>0),f=(0,i.useCallback)(()=>x(!0),[]),b=(0,i.useCallback)(()=>{x(!1),m(e=>"configuration"===e.content.kind&&void 0===e.pendingOperation&&void 0!==e.error?{content:{kind:"configuration"}}:e)},[]),v=(0,i.useCallback)(async(e,i,r)=>{if(!y.current){y.current=!0,x(!0),m(t=>({...t,pendingOperation:e,error:void 0})),null==s||s(!0);try{m({content:await i()})}catch(i){(0,a(208318).t)().error({type:"error",from:"NotinoActionWorkflow.perform",error:i});let e=i instanceof Error?i.message:o.formatMessage(A.unexpectedError);void 0!==r?(h.current=r,m({content:{kind:"recovery",executionId:r},pendingOperation:"load"}),m(await Y({environment:t,executionId:r,expectedActionId:null==n?void 0:n.actionId,error:e}))):m(t=>({...t,pendingOperation:void 0,error:e}))}finally{y.current=!1,null==s||s(!1)}}},[null==n?void 0:n.actionId,t,o,s]),j=(0,i.useCallback)(async e=>{void 0!==n&&await v("plan",async()=>{m({content:{kind:"configuration"},pendingOperation:"plan"});let a=await t.api.callApi({eventName:"adminPlanNotinoAction",environment:t,data:{actionId:n.actionId,toolInput:e}});if("success"!==a.type)throw en(a);return(ei(a.data,n.actionId),es(a.data))?(h.current=a.data.executionId,d(a.data)):ee({environment:t,executionId:a.data.executionId,expectedActionId:n.actionId},a.data)})},[d,n,t,v]),k=(0,i.useCallback)(async e=>{let a=(e??h.current).trim();0!==a.length&&await v("load",()=>(h.current=a,m({content:{kind:"recovery",executionId:a},pendingOperation:"load"}),X({environment:t,executionId:a,expectedActionId:null==n?void 0:n.actionId})))},[n,t,v]);(0,i.useEffect)(()=>{0===c.length||u.current||(u.current=!0,k())},[c,k]);let S="run"in p.content&&er(p.content.run)?p.content.run.executionId:void 0;(0,i.useEffect)(()=>{let e;if(void 0===S||!g||void 0!==p.pendingOperation)return;let i=!1;async function r(){try{let e=await et({environment:t,executionId:S});ei(e,null==n?void 0:n.actionId);let a=er(e)?{kind:"saved_run",run:e,artifact:void 0}:await ee({environment:t,executionId:e.executionId,expectedActionId:null==n?void 0:n.actionId},e);i||y.current||m({content:a})}catch(e){(0,a(208318).t)().error({type:"error",from:"NotinoActionWorkflow.poll",error:e}),i||m(t=>({...t,error:e instanceof Error?e.message:o.formatMessage(A.unexpectedError)}))}finally{i||(e=window.setTimeout(r,3e3))}}return e=window.setTimeout(r,3e3),()=>{i=!0,window.clearTimeout(e)}},[null==n?void 0:n.actionId,t,o,g,S,p.pendingOperation]);let w=(0,i.useCallback)(async()=>{let{content:e}=p;void 0!==n&&"plan"===e.kind&&"PLANNED"===e.run.state&&await v("execute",async()=>{let a=await t.api.callApi({eventName:"adminApproveAndExecuteNotinoAction",environment:t,data:{executionId:e.run.executionId}});if("success"!==a.type)throw en(a);return(ei(a.data,n.actionId),es(a.data))?(h.current=a.data.executionId,d(a.data)):ee({environment:t,executionId:a.data.executionId,expectedActionId:n.actionId},a.data)},e.run.executionId)},[d,n,t,v,p]),I=(0,i.useCallback)(async()=>{let{content:e}=p;void 0!==n&&"execution_result"===e.kind&&n.supportsRevert&&e.run.supportsRevert&&("EXECUTED"===e.run.state||"PARTIALLY_EXECUTED"===e.run.state)&&await v("revert",async()=>{let a=await t.api.callApi({eventName:"adminRevertNotinoAction",environment:t,data:{executionId:e.run.executionId}});if("success"!==a.type)throw en(a);return(ei(a.data,n.actionId),es(a.data))?(h.current=a.data.executionId,d(a.data)):ee({environment:t,executionId:a.data.executionId,expectedActionId:n.actionId},a.data)},e.run.executionId)},[d,n,t,v,p]),C=(0,i.useCallback)(()=>{y.current||(x(!1),m({content:{kind:"configuration"}}))},[]);return{state:p,isDialogOpen:g,openDialog:f,closeDialog:b,isBusy:void 0!==p.pendingOperation,plan:j,load:k,execute:w,revert:I,reset:C}}let M={body:{width:"min(840px, calc(100vw - 32px))",maxHeight:"calc(100vh - 48px)",display:"flex",flexDirection:"column",overflow:"hidden"},header:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},content:{overflowY:"auto"},footer:{borderTop:`1px solid ${a(632079).Tj.border.secondary}`}};
106function P(e){let{controller:t,title:n}=e,r=(0,i.useId)();return(0,d.jsxs)(d.Fragment,{children:["history"!==e.mode?(0,d.jsx)(B,{...e}):void 0,(0,d.jsxs)(a(171849).a,{open:t.isDialogOpen,onDismiss:t.closeDialog,ariaLabelledBy:r,innerStyle:M.body,preventHideChildrenWhileOpening:!0,children:[(0,d.jsx)(a(4458).fI,{padding:24,style:M.header,flexShrink:0,children:(0,d.jsx)(a(111010).D,{id:r,styleKey:"titleSmSemibold",children:n})}),(0,d.jsx)(a(4458).VP,{padding:24,gap:16,minHeight:0,style:M.content,children:(0,d.jsx)(V,{...e})}),(0,d.jsx)(E,{controller:t,hasPermission:e.hasPermission,canEditInputs:"history"!==e.mode})]})]})}function V(e){let{controller:t,ArtifactPresentationComponent:i}=e,{content:n}=t.state,r=(0,a(327219).tz)();switch(n.kind){case"configuration":if(!t.isBusy&&void 0===t.state.error)return null;return t.isBusy?(0,d.jsx)(q,{title:r.formatMessage(A.planningTitle),description:r.formatMessage(A.planningDescription)}):(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",children:r.formatMessage(A.planFailed)}),(0,d.jsx)(Q,{message:t.state.error}),(0,d.jsx)(a(548436).A,{size:"lg",onClick:t.reset,children:r.formatMessage(A.editInputs)})]});case"recovery":return(0,d.jsx)(L,{controller:t});case"plan":return(0,d.jsx)(_,{controller:t,content:n,ArtifactPresentationComponent:i});case"saved_run":case"execution_result":case"revert_result":return(0,d.jsx)(W,{controller:t,content:n,ArtifactPresentationComponent:i})}}function E(e){let{controller:t,hasPermission:n,canEditInputs:r}=e,{content:s,pendingOperation:o}=t.state,l=(0,a(327219).tz)(),c=(0,i.useCallback)(()=>void t.execute(),[t]),p=(0,i.useCallback)(()=>void t.revert(),[t]),m="plan"===s.kind&&"PLANNED"===s.run.state,u="execution_result"===s.kind&&s.run.supportsRevert&&("EXECUTED"===s.run.state||"PARTIALLY_EXECUTED"===s.run.state);return(0,d.jsxs)(a(4458).VP,{padding:16,gap:8,flexShrink:0,style:M.footer,children:[t.isBusy?(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:l.formatMessage(A.closeWhileRunning)}):void 0,(0,d.jsxs)(a(4458).fI,{gap:8,justifyContent:"flex-end",flexWrap:"wrap",children:[(0,d.jsx)(a(988022).p,{size:"lg",onClick:t.closeDialog,children:l.formatMessage(A.close)}),"plan"===s.kind&&r?(0,d.jsx)(a(548436).A,{size:"lg",onClick:t.reset,disabled:t.isBusy,children:l.formatMessage(A.editInputs)}):void 0,m?(0,d.jsx)(a(912946).j,{size:"lg",colorPalette:"red",onClick:c,disabled:t.isBusy||!1===n,isLoading:"execute"===o,children:l.formatMessage(A.execute)}):void 0,u?(0,d.jsx)(a(912946).j,{size:"lg",colorPalette:"red",onClick:p,disabled:t.isBusy||!1===n,isLoading:"revert"===o,children:l.formatMessage(A.revert)}):void 0]})]})}function B(e){let{controller:t,hasPermission:n,hasInputValidationError:r,planFields:s,onPlan:o}=e,l=(0,a(327219).tz)(),[c,p]=(0,i.useState)(""),[m,u]=(0,i.useState)(!1),h=(0,i.useId)(),y=(0,i.useCallback)(()=>{u(e=>!e)},[]),g=(0,i.useId)(),x=(0,i.useId)(),f=(0,i.useCallback)(e=>{p(e.target.value)},[]),b=(0,i.useCallback)(()=>{!1===n||t.isBusy||t.load(c)},[t,c,n]),v="configuration"!==t.state.content.kind||t.isBusy;return(0,d.jsxs)(a(4458).VP,{gap:20,children:[(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:l.formatMessage(A.configureDescription)}),s,(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(a(912946).j,{size:"lg",onClick:o,disabled:!1===n||r||t.isBusy,children:l.formatMessage(A.reviewChanges)}),v?(0,d.jsx)(a(548436).A,{size:"lg",onClick:t.openDialog,children:l.formatMessage(A.viewRun)}):void 0]})]}),(0,d.jsxs)(a(4458).VP,{gap:8,paddingTop:16,style:M.footer,children:[(0,d.jsx)(a(988022).p,{size:"sm",colorVariant:"secondary",iconLeading:m?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,"aria-expanded":m,"aria-controls":h,onClick:y,children:l.formatMessage(A.savedRunHeading)}),(0,d.jsx)("div",{id:h,hidden:!m,children:(0,d.jsxs)(a(4458).VP,{gap:8,children:[(0,d.jsx)(a(111010).D,{id:x,styleKey:"caption",colorVariant:"secondary",children:l.formatMessage(A.executionIdHelp)}),(0,d.jsx)(a(111010).D,{id:g,styleKey:"captionMedium",children:l.formatMessage(A.executionIdLabel)}),(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(287562).p,{format:"small",value:c,onChange:f,onSubmit:b,"aria-labelledby":g,"aria-describedby":x,disabled:!1===n||t.isBusy}),(0,d.jsx)(a(548436).A,{size:"lg",onClick:b,disabled:!1===n||t.isBusy||0===c.trim().length,children:l.formatMessage(A.openRun)})]})]})})]})]})}
106function L(e){let{controller:t}=e,n=(0,a(327219).tz)(),r="load"===t.state.pendingOperation,s=(0,i.useCallback)(()=>void t.load(),[t]);return r?(0,d.jsx)(q,{title:n.formatMessage(A.loadingTitle),description:n.formatMessage(A.loadingDescription)}):(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(z,{step:1,title:n.formatMessage(A.loadFailedTitle),description:n.formatMessage(A.loadingDescription)}),(0,d.jsx)(Q,{message:t.state.error}),(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(a(548436).A,{size:"lg",onClick:t.reset,children:n.formatMessage(A.planAnother)}),(0,d.jsx)(a(912946).j,{size:"lg",onClick:s,children:n.formatMessage(A.tryAgain)})]})]})}function _(e){let{controller:t,content:i,ArtifactPresentationComponent:n}=e,r=(0,a(327219).tz)(),s="execute"===t.state.pendingOperation;return(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(z,{step:2,title:r.formatMessage(A.planReadyTitle),description:r.formatMessage(A.planReadyDescription)}),s?(0,d.jsx)(q,{title:r.formatMessage(A.executingTitle),description:r.formatMessage(A.executingDescription)}):void 0,(0,d.jsx)(Q,{message:t.state.error}),(0,d.jsx)(J,{run:i.run}),(0,d.jsx)(U,{context:i.context}),(0,d.jsx)(Z,{title:r.formatMessage(A.plannedChanges),children:(0,d.jsx)(O,{presentation:$({artifactKind:"plan",data:i.review},n),fallbackData:{review:i.review}})}),i.run.supportsRevert?void 0:(0,d.jsx)(a(111010).D,{role:"note",styleKey:"bodySmSemibold",colorPalette:"red",colorVariant:"accentPrimary",children:r.formatMessage(A.irreversible)})]})}function U(e){var t;let i=(0,a(327219).tz)();return null!=(t=e.context)&&t.length?(0,d.jsx)(Z,{title:i.formatMessage(A.additionalContext),children:e.context.map((e,t)=>(0,d.jsx)(a(111010).D,{styleKey:"bodySm",children:e},t))}):null}function W(e){let{controller:t,content:i,ArtifactPresentationComponent:n}=e,r=(0,a(327219).tz)(),s=function(e){switch(e.state){case"PLANNING":return{title:A.planningTitle,description:A.planningDescription};case"PLANNED":return{title:A.planReadyTitle,description:A.planReadyDescription};case"PLAN_FAILED":return{title:A.planFailed,description:A.noArtifacts};case"EXECUTING":return{title:A.executingTitle,description:A.executingDescription};case"EXECUTED":return{title:A.executionCompleteTitle,description:A.executionCompleteDescription};case"PARTIALLY_EXECUTED":return{title:A.executionPartialTitle,description:A.executionPartialDescription};case"EXECUTION_FAILED":return{title:A.executionFailedTitle,description:A.executionFailedDescription};case"EXECUTION_UNKNOWN":return{title:A.executionUnknownTitle,description:A.executionUnknownDescription};case"REVERTING":return{title:A.revertingTitle,description:A.revertingDescription};case"REVERTED":return{title:A.revertedTitle,description:A.revertedDescription};case"PARTIALLY_REVERTED":return{title:A.revertPartialTitle,description:A.revertPartialDescription};case"REVERT_FAILED":return{title:A.revertFailedTitle,description:A.revertFailedDescription};case"REVERT_UNKNOWN":return{title:A.revertUnknownTitle,description:A.revertUnknownDescription}}}(i.run),o="revert"===t.state.pendingOperation;return(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",children:r.formatMessage(s.title)}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:r.formatMessage(s.description)})]}),o?(0,d.jsx)(q,{title:r.formatMessage(A.revertingTitle),description:r.formatMessage(A.revertingDescription)}):void 0,(0,d.jsx)(Q,{message:t.state.error}),(0,d.jsx)(J,{run:i.run}),"saved_run"!==i.kind||er(i.run)?void 0:(0,d.jsx)(a(111010).D,{role:"note",styleKey:"bodySm",colorVariant:"secondary",children:r.formatMessage(i.artifact?A.missingResult:A.noArtifacts)}),i.artifact?(0,d.jsx)(F,{run:i.run,latestArtifact:i.artifact,ArtifactPresentationComponent:n},`${i.run.executionId}:${i.kind}`):void 0]})}function F(e){let{run:t,latestArtifact:n,ArtifactPresentationComponent:r}=e,s=(0,a(533992).v3)(),o=(0,a(327219).tz)(),l=(0,i.useId)(),[c,p]=(0,i.useState)(n.artifactKind),[m,u]=(0,i.useState)(),[h,y]=(0,i.useState)(),[g,x]=(0,i.useState)(0),f=["plan","execution_result","revert_result"].filter(e=>t.availableArtifacts.includes(e)),b=f.indexOf(c),v=c===n.artifactKind?n:(null==m?void 0:m.artifactKind)===c?m:void 0,j=(0,i.useCallback)(e=>{let t=f[e];void 0!==t&&t!==c&&(y(void 0),u(void 0),p(t))},[f,c]),k=(0,i.useCallback)(()=>{y(void 0),x(e=>e+1)},[]);return(0,i.useEffect)(()=>
106{if(void 0!==v)return;let e=!1;return async function(){try{let a=await ea({environment:s,executionId:t.executionId,artifactKind:c});if(a.actionId!==t.actionId||a.executionId!==t.executionId||a.artifactKind!==c)throw Error("The saved artifact does not match this run and stage.");e||u(a)}catch(t){(0,a(208318).t)().error({type:"error",from:"SavedArtifactHistory.loadArtifact",error:t}),e||y(t instanceof Error?t.message:o.formatMessage(A.unexpectedError))}}(),()=>{e=!0}},[v,s,o,g,t.actionId,t.executionId,c]),(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(a(211300).V,{tabIdPrefix:l,ariaLabel:o.formatMessage(A.artifactStages),selectedIndex:b,onSelect:j,tabs:f.map(e=>({label:o.formatMessage("plan"===e?A.artifactPlan:"execution_result"===e?A.artifactExecution:A.artifactReversal)}))}),(0,d.jsx)("div",{role:"tabpanel",id:(0,a(380521).J)(l,b),"aria-labelledby":(0,a(380521).v)(l,b),tabIndex:0,children:v?(0,d.jsx)(K,{artifact:v,ArtifactPresentationComponent:r}):h?(0,d.jsxs)(a(4458).VP,{gap:12,children:[(0,d.jsx)(Q,{message:h}),(0,d.jsx)(a(548436).A,{size:"md",onClick:k,children:o.formatMessage(A.tryAgain)})]}):(0,d.jsxs)(a(4458).fI,{gap:8,children:[(0,d.jsx)(a(517334).k,{size:16}),(0,d.jsx)(a(111010).D,{role:"status",styleKey:"bodySm",children:o.formatMessage(A.artifactLoading)})]})})]})}function K(e){var t;let{artifact:i,ArtifactPresentationComponent:n}=e,r=(0,a(327219).tz)(),s=$(function(e){switch(e.artifactKind){case"plan":return{artifactKind:"plan",data:e.payload.plan.review};case"execution_result":return{artifactKind:"execution_result",data:e.payload.result};case"revert_result":return}}(i),n);return(0,d.jsxs)(a(4458).VP,{gap:12,children:["plan"===i.artifactKind?(0,d.jsx)(U,{context:i.payload.plan.context}):void 0,(0,d.jsx)(Z,{title:r.formatMessage("plan"===i.artifactKind?A.plannedChanges:"execution_result"===i.artifactKind?A.executionDetail
106s:A.revertDetails),children:(0,d.jsx)(O,{presentation:s,fallbackData:i.payload})}),"execution_result"===i.artifactKind?(0,d.jsx)(p,{actionId:i.actionId,executionId:i.executionId,result:i.payload.result}):void 0,"execution_result"===i.artifactKind&&s?(0,d.jsx)(Z,{title:r.formatMessage(i.payload.verification.success?A.verificationPassed:A.verificationFailed),children:null==(t=i.payload.verification.details)?void 0:t.map((e,t)=>(0,d.jsx)(a(111010).D,{styleKey:"bodySm",style:{overflowWrap:"anywhere"},children:e},t))}):void 0]})}function $(e,t){if(void 0===e)return;if(t)return{kind:"tool",artifact:e,Component:t};let i=function(e){if("plan"===e.artifactKind){let t=(0,a(788145).Qq)(o,e.data);return t&&{artifactKind:"plan",review:t}}let t=(0,a(788145).Qq)(l,e.data);return t&&{artifactKind:"execution_result",result:t}}(e);return i&&{kind:"standard",artifact:i}}function O(e){let{presentation:t,fallbackData:i}=e;switch(null==t?void 0:t.kind){case"tool":return(0,d.jsx)(t.Component,{...t.artifact});case"standard":return(0,d.jsx)(T,{artifact:t.artifact});case void 0:return(0,d.jsx)(a(243119).A,{data:i,hideHelp:!0})}}function z(e){let{step:t,title:i,description:n}=e,r=(0,a(327219).tz)();return(0,d.jsxs)(a(4458).VP,{gap:4,children:[(0,d.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"tertiary",children:r.formatMessage(A.stepLabel,{step:t})}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:i}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n})]})}let G={surface:{background:a(632079).Tj.background.secondaryTranslucent,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8}};function q(e){let{title:t,description:i}=e;return(0,d.jsxs)(a(4458).VP,{role:"status","aria-live":"polite",minHeight:120,padding:16,gap:12,justifyContent:"center",style:G.surface,children:[(0,d.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,d.jsx)(a(517334).k,{size:18}),(0,d.jsx)(a(111010).D,{styleKey:"bodySemibold",colorVariant:"primary",children:t})]}),(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i})]})}let H={surface:{background:a(632079).Tj.background.secondaryTranslucent,border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8}};function Z(e){let{title:t,children:i}=e;return(0,d.jsxs)(a(4458).VP,{padding:12,gap:8,style:H.surface,children:[(0,d.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:t}),i]})}function J(e){var t;let{run:i}=e,n=(0,a(327219).tz)();return(0,d.jsxs)(a(4458).VP,{gap:2,children:[(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:n.formatMessage(A.executionIdValue,{executionId:i.executionId})}),(0,d.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:n.formatMessage(A.stateValue,{state:i.state})}),(null==(t=i.remoteExecution)||null==(t=t.progress)?void 0:t.message)!==void 0?(0,d.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:i.remoteExecution.progress.message}):void 0]})}function Q(e){let{message:t}=e;return void 0===t?null:(0,d.jsx)(a(111010).D,{role:"alert",styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:t})}async function Y(e){try{return{content:await X(e),error:e.error}}catch(t){return(0,a(208318).t)().error({type:"error",from:"NotinoActionWorkflow.recover",error:t}),{content:{kind:"recovery",executionId:e.executionId},error:e.error}}}async function X(e){let t=await et(e);return ee(e,t)}async function ee(e,t){if(ei(t,e.expectedActionId),t.availableArtifacts.includes("revert_result")){let a=await ea({environment:e.environment,executionId:e.executionId,artifactKind:"revert_result"});if("revert_result"!==a.artifactKind)throw Error("The action returned the wrong revert artifact.");return{kind:"revert_result",run:t,artifact:a}}if(t.availableArtifacts.includes("execution_result")){let a=await ea({environment:e.environment,executionId:e.executionId,artifactKind:"execution_result"});if("execution_result"!==a.artifactKind)throw Error("The action returned the wrong execution artifact.");return"EXECUTED"===t.state||"PARTIALLY_EXECUTED"===t.state||"EXECUTION_FAILED"===t.state||"EXECUTION_UNKNOWN"===t.state?{kind:"execution_result",run:t,artifact:a}:{kind:"saved_run",run:t,artifact:a}}if(t.availableArtifacts.includes("plan")){let a=await ea({environment:e.environment,executionId:e.executionId,artifactKind:"plan"});if("plan"!==a.artifactKind)throw Error("The action returned the wrong plan artifact.");return"PLANNED"!==t.state?{kind:"saved_run",run:t,artifact:a}:{kind:"plan",run:t,review:a.payload.plan.review,context:a.payload.plan.context}}return{kind:"saved_run",run:t,artifact:void 0}}async function et(e){let t=await e.environment.api.callApi({eventName:"adminGetNotinoActionRun",environment:e.environment,data:{executionId:e.executionId}});if("success"!==t.type)throw en(t);return t.data}async function ea(e){let t=await e.environment.api.callApi({eventName:"adminGetNotinoActionArtifact",environment:e.environment,data:{executionId:e.executionId,artifactKind:e.artifactKind}});if("success"!==t.type)throw en(t);return t.data.artifact}function ei(e,t){if(void 0!==t&&e.actionId!==t)throw Error(`Execution ${e.executionId} belongs to ${e.actionId}, not ${t}.`)}function en(e){var t,i;let n=(0,a(201790).V4)(e);if(e.offline)return Error(n);let r=null==(t=e.body)?void 0:t.name,s=r?`HTTP ${e.status} \xb7 ${r}`:`HTTP ${e.status}`;return Error(null!=(i=e.body)&&i.debugMessage?`${n} (${s})`:s)}function er(e){return"PLANNING"===e.state||"EXECUTING"===e.state||"REVERTING"===e.state}function es(e){return void 0!==e.remoteExecution||er(e)}},820517(e,t,a){a(635790);var i=a(440302);function n(e){let{title:t,defaultExpanded:n,...r}=e,{isExpanded:s,toggleExpansion:o}=(0,a(714289).J)({title:t,defaultExpanded:n});return(0,i.jsx)(a(439423).v,{...r,title:t,isExpanded:s,onToggle:o})}a.d(t,{P:()=>n})},348330(e,t,a){a.r(t),a.d(t,{UnifiedAccountView:()=>R}),a(533958),a(730330),a(976614),a(159952),a(176765),a(851344),a(866491);var i=a(635790);a(139583),a(974864);var n=a(440302);let r={columnsRow:{display:"flex",flexDirection:"row",gap:16,alignItems:"stretch"},panel:{flex:1,minWidth:0,padding:16,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8},labelColumn:{minWidth:120},memberEntry:{paddingBlock:4},toggleHeader:{cursor:"pointer"}},s="Configured";function o({owner:e,onViewUser:t}){let s=(0,i.useCallback)(()=>{e.email&&t(e.email)},[t,e.email]);return(0,n.jsx)("div",{style:r.memberEntry,children:(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(799615).B,{value:e.email??e.id,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.email??e.id})}),e.email?(0,n.jsx)(a(988022).p,{size:"xs",onClick:s,iconTrailing:a(166568).arrowUpRightSquareSmallIcon,children:"View User"}):void 0]})})}function l({owners:e,permissionsStore:t}){let[s,d]=(0,i.useState)(!1),[c,p]=(0,i.useState)(void 0),m=(0,i.useCallback)(()=>{d(e=>!e)},[]),u=(0,i.useCallback)(()=>{p(void 0)},[]),h=(0,a(83208).X)("admin_unified_user_view"),y=(0,i.useCallback)(e=>{if(h){let t=new URL(a(168962).JZ.adminUnifiedUserView,window.location.origin);t.searchParams.set("userEmail",e),window.open(t.toString(),"_blank","noopener,noreferrer")}else p(e)},[h]),g=(0,a(47602).S)(t,"adminSearchUsers");return(0,n.jsxs)(a(4458).VP,{gap:0,marginTop:16,children:[(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",onClick:m,style:r.toggleHeader,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:s?"▼"
106:"▶"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:`Owners (${e.length})`})]}),s?(0,n.jsxs)(n.Fragment,{children:[0===e.length?(0,n.jsx)(a(4458).VP,{marginTop:8,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No owners found"})}):(0,n.jsx)(a(4458).VP,{gap:4,marginTop:8,children:e.map(e=>(0,n.jsx)(o,{owner:e,onViewUser:y},e.id))}),(0,n.jsx)(a(674848).v,{isOpen:void 0!==c,onDismiss:u,toolName:"adminSearchUsers",displayName:"Find User Information",spaceId:"",hasPermission:g,additionalParams:c?{userEmail:c}:void 0,source:"unified_account_view"})]}):void 0]})}function d({organization:e,usersWithOrgRoles:t,workspaceCount:i,samlConfigs:o,permissionsStore:c}){let p=t.find(t=>t.id===e.created_by_id),m=(null==p?void 0:p.email)??e.created_by_id,u=t.filter(e=>"owner"===e.organizationRole);return(0,n.jsxs)("div",{style:r.columnsRow,children:[(0,n.jsxs)("div",{style:r.panel,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Organization Overview"}),(0,n.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,n.jsx)(a(458482).F,{title:"Identity"}),(0,n.jsx)(a(135744).B,{label:"Name",value:e.name}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:r.labelColumn,children:"Organization ID"}),(0,n.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,n.jsx)(a(137691).x5,{value:e.id})})})]}),e.email_domains&&e.email_domains.length>0?(0,n.jsx)(a(135744).B,{label:"Email Domains",value:e.email_domains.join(", ")}):void 0]}),(0,n.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,n.jsx)(a(458482).F,{title:"Details"}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:r.labelColumn,children:"Status"}),(0,n.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,n.jsx)("span",{"aria-hidden":!0,children:e.alive?"✅":"❌"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:e.alive?"secondary":"accentPrimary",colorPalette:e.alive?void 0:"red",children:e.alive?"Active":"Deleted"})]})]}),(0,n.jsx)(a(135744).B,{label:"Created",value:new Date(e.created_time).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}),(0,n.jsx)(a(135744).B,{label:"Created By",value:m}),(0,n.jsx)(a(135744).B,{label:"Workspace Count",value:String(i)}),(0,n.jsx)(a(135744).B,{label:"Onboarding Status",value:e.onboarding_status})]})]}),(0,n.jsxs)("div",{style:r.panel,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Security & Owners"}),(0,n.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,n.jsx)(a(458482).F,{title:"Security"}),(0,n.jsx)(a(135744).B,{label:"SSO Status",value:function(e){let t=e.filter(e=>"configured"===e.status||"enforced"===e.status);if(0===t.length)return"Not configured";let a=t.flatMap(e=>e.email_domains??[]);return a.length>0?`${s} (${a.join(", ")})`:s}(o)})]}),(0,n.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,n.jsx)(a(458482).F,{title:"Managed User Settings"}),(0,n.jsx)(a(135744).B,{label:"Workspace Creation",value:e.managed_user_settings.workspace_creation_enum}),(0,n.jsx)(a(135744).B,{label:"Workspace Region",value:e.managed_user_settings.workspace_region}),void 0!==e.managed_user_settings.prevent_profile_edits?(0,n.jsx)(a(135744).B,{label:"Profile Edits Locked",value:e.managed_user_settings.prevent_profile_edits?"Yes":"No"}):void 0,void 0!==e.managed_user_settings.prevent_members_joining_external_workspace?(0,n.jsx)(a(135744).B,{label:"External Workspaces Blocked",value:e.managed_user_settings.prevent_members_joining_external_workspace?"Yes":"No"}):void 0,e.managed_user_settings.mdm_provider?(0,n.jsx)(a(135744).B,{label:"MDM Provider",value:e.managed_user_settings.mdm_provider}):void 0]}),(0,n.jsx)(l,{owners:u,permissionsStore:c})]})]})}let c={sectionTitle:{marginBottom:12},notesList:{maxHeight:600,overflowY:"auto"},noteEntry:{paddingTop:10,paddingBottom:10,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},charCount:{textAlign:"end"},emptyState:{padding:8}};function p({onSubmit:e,isSubmitting:t}){let[r,s]=(0,i.useState)(""),o=r.length,l=o>1e3,d=o>=800&&!l,m=r.trim().length>0&&!l&&!t,u=(0,i.useCallback)(async()=>{m&&(await e(r),s(""))},[m,e,r]),h=(0,i.useCallback)(e=>{s(e.target.value)},[]),y=(0,i.useCallback)(()=>{s("")},[]);return(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(287562).p,{textarea:!0,textareaSubmitOnEnter:!1,autosize:!0,autosizeMinHeight:50,value:r,onChange:h,onClearButtonClick:y,showClearButton:r.length>0,placeholder:"Add a note about this account…",maxlength:1e3}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",children:[(0,n.jsx)("div",{style:c.charCount,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:l||d?"primary":"tertiary",colorPalette:l?"red":d?"orange":void 0,children:[o," / ",1e3]})}),(0,n.jsx)(a(912946).j,{size:"sm",onClick:u,disabled:!m,children:t?"Posting...":"Post"})]})]})}function m({note:e,isAuthor:t,onArchive:r,isArchiving:s}){let o=(0,i.useCallback)(()=>{r(e.id)},[r,e.id]);return(0,n.jsx)("div",{style:c.noteEntry,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:e.createdByEmail}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:new Date(e.createdTime).toLocaleStr
106ing(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),t?(0,n.jsx)(a(548436).A,{size:"xs",onClick:o,disabled:s,children:s?"Archiving...":"Archive"}):void 0]}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.noteText})]})})}function u({organizationId:e,permissionsStore:t}){let r=(0,a(533992).v3)(),s=r.currentUser.id,o=(0,a(47602).S)(t,"adminListEntityNotes"),l=(0,i.useRef)(!0);(0,i.useEffect)(()=>()=>{l.current=!1},[]);let[d,h]=(0,i.useState)([]),[y,g]=(0,i.useState)(!1),[x,f]=(0,i.useState)(!1),[b,v]=(0,i.useState)(void 0),[j,k]=(0,i.useState)(void 0),S=(0,i.useCallback)(async()=>{if(l.current){g(!0),k(void 0);try{let t=await r.api.callApi({eventName:"adminListEntityNotes",environment:r,data:{entityType:"account",entityId:e,__adminUISource:"unified_account_view"}});l.current&&("success"===t.type?h(t.data.notes):k("Failed to load notes"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"AccountNotesSection",type:"notesLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),l.current&&k("Failed to load notes")}finally{l.current&&g(!1)}}},[r,e]);(0,i.useEffect)(()=>{!1!==o&&void 0!==o&&S()},[S,o]);let w=(0,i.useCallback)(async t=>{f(!0),k(void 0);try{let a=await r.api.callApi({eventName:"adminCreateEntityNote",environment:r,data:{entityType:"account",entityId:e,noteText:t,__adminUISource:"unified_account_view"}});l.current&&("success"===a.type?await S():k("Failed to create note"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"AccountNotesSection",type:"noteCreateFailed",error:(0,a(952977).convertErrorToLog)(e)}),l.current&&k("Failed to create note")}finally{l.current&&f(!1)}},[r,e,S]),I=(0,i.useCallback)(async t=>{v(t),k(void 0);try{let a=await r.api.callApi({eventName:"adminArchiveEntityNote",environment:r,data:{noteId:t,entityType:"account",entityId:e,__adminUISource:"unified_account_view"}});l.current&&("success"===a.type?await S():k("Failed to archive note"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"AccountNotesSection",type:"noteArchiveFailed",error:(0,a(952977).convertErrorToLog)(e)}),l.current&&k("Failed to archive note")}finally{l.current&&v(void 0)}},[r,e,S]),C=(0,n.jsx)("div",{style:c.sectionTitle,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Account Notes"})});return void 0===o?(0,n.jsxs)(a(4458).VP,{gap:0,children:[C,(0,n.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,n.jsx)(a(517334).k,{size:"sm"})})]}):!1===o?(0,n.jsxs)(a(4458).VP,{gap:0,children:[C,(0,n.jsx)("div",{style:c.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"You don't have access to view account notes"})})]}):(0,n.jsxs)(a(4458).VP,{gap:0,children:[C,(0,n.jsx)(p,{onSubmit:w,isSubmitting:x}),j?(0,n.jsx)(a(4458).fI,{padding:4,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:j})}):void 0,(0,n.jsx)("div",{style:c.notesList,children:y?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading notes..."})]}):d.length>0?(0,n.jsx)(a(4458).VP,{gap:0,children:d.map(e=>(0,n.jsx)(m,{note:e,isAuthor:e.createdById===s,onArchive:I,isArchiving:b===e.id},e.id))}):(0,n.jsx)("div",{style:c.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No notes yet. Add a note about this account above."})})})]})}let h={card:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8}},y={adminWrap:(0,a(120308).pj)(),inputContainer:{maxWidth:500},flexCard:{...h.card,flex:1,minWidth:0},resultsContainer:{display:"flex",flexDirection:"column",gap:16,paddingInlineStart:8,paddingInlineEnd:8},columnsRow:{display:"flex",flexDirection:"row",gap:16,alignItems:"flex-start"},noPermissionBanner:{padding:12,borderRadius:8,backgroundColor:a(632079).Tj.yellow.background.secondary},collapsibleHeader:{display:"flex",flexDirection:"row",alignItems:"center",gap:8,padding:12,cursor:"pointer",background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8},collapsibleContent:{paddingTop:12}}
106,g="Workspaces",x="All Workspaces",f="Deleted",b="Active",v=["Identity (UUID, name, email domains)","Security & SAML configurations","Managed user settings","Organization owners"];function j(e,t){let a=t.trim().toLowerCase();return a?e.filter(e=>{let t=(e.name??"").toLowerCase(),i=e.id.toLowerCase(),n=(e.plan_type??"").toLowerCase();return t.includes(a)||i.includes(a)||n.includes(a)}):e}let k={row:{paddingBlock:8,paddingInline:0,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},rowLast:{paddingBlock:8,paddingInline:0},detailsLabel:{minWidth:80}};function S({space:e,isLast:t}){let r=(0,i.useCallback)(t=>{t.stopPropagation(),window.open(`/__admin/unifiedWorkspaceView?spaceId=${e.id}`,"_blank")},[e.id]),s=void 0!==e.deleted_by;return(0,n.jsx)("div",{style:t?k.rowLast:k.row,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:e.name??"Unnamed Workspace"}),s?(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:f}):(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"green",colorVariant:"accentPrimary",children:b}),e.plan_type?(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:e.plan_type}):void 0]}),(0,n.jsxs)(a(4458).fI,{gap:16,alignItems:"center",children:[(0,n.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",style:k.detailsLabel,children:"Space ID"}),(0,n.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:(0,n.jsx)(a(137691).x5,{value:e.id})})})]}),(0,n.jsx)(a(988022).p,{size:"xs",onClick:r,iconTrailing:a(166568).arrowUpRightSquareSmallIcon,children:"Open in Workspace View"})]})]})})}let w={contractEntry:{paddingTop:8,paddingBottom:8,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},contractEntryLast:{paddingTop:8,paddingBottom:8}};function I(e){return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function C({contracts:e}){return(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Billing Contracts"}),e.map((t,i)=>(0,n.jsx)("div",{style:i===e.length-1?w.contractEntryLast:w.contractEntry,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:t.provider}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"accentPrimary",colorPalette:"Activated"===t.status?"green":void 0,children:t.status})]}),(0,n.jsx)(a(4458).fI,{gap:8,alignItems:"center",children:(0,n.jsx)(a(799615).B,{value:t.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:(0,n.jsx)(a(137691).x5,{value:t.id})})})}),t.external_id?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Salesforce ID"}),(0,n.jsx)(a(799615).B,{value:t.external_id,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:t.external_id})})]}):void 0,(0,n.jsx)(a(4458).fI,{gap:8,alignItems:"center",children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:[I(t.start_timestamp)," — ",I(t.expiration_timestamp)]})})]})},t.id))]})}function D(e){let t=new URL(window.location.href);e?t.searchParams.set("q",e):t.searchParams.delete("q"),window.history.replaceState(window.history.state,"",t.toString())}function T({result:e,defaultExpanded:t,permissionsStore:r}){var s,o,l;let[c,p]=(0,i.useState)(t),m=(0,i.useCallback)(()=>{p(e=>!e)},[]),[h,v]=(0,i.useState)(!0),[k,w]=(0,i.useState)(""),[I,D]=(0,i.useState)(20),R=(0,i.useCallback)(()=>{v(e=>!e)},[]),A=(0,i.useCallback)(e=>{w(e),D(20)},[]),N=(0,i.useCallback)(()=>{D(e=>e+20)},[]),M=(0,i.useMemo)(()=>j(e.spaces,k),[e.spaces,k]),P=(0,i.useMemo)(()=>M.slice(0,I),[M,I]),V=(null==(s=e.organization)?void 0:s.name)??"Unknown Organization",E=(null==(o=e.organization)?void 0:o.alive)??!0;return(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsxs)("div",{role:"button",tabIndex:0,style:y.collapsibleHeader,onClick:m,onKeyDown:e=>
106{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),m())},children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:c?"▼":"▶"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:V}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"accentPrimary",colorPalette:E?"green":"red",children:E?b:f}),null!=(l=e.organization)&&l.email_domains&&e.organization.email_domains.length>0?(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:e.organization.email_domains.join(", ")}):void 0,(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:`${e.spaces.length} workspace${1!==e.spaces.length?"s":""}`})]}),c?(0,n.jsx)("div",{style:y.collapsibleContent,children:(0,n.jsxs)(a(4458).VP,{gap:16,children:[e.organization?(0,n.jsx)(d,{organization:e.organization,usersWithOrgRoles:e.usersWithOrgRoles,workspaceCount:e.spaces.length,samlConfigs:e.samlConfigs,permissionsStore:r}):void 0,e.billingContracts.length>0?(0,n.jsx)("div",{style:y.flexCard,children:(0,n.jsx)(C,{contracts:e.billingContracts})}):void 0,(0,n.jsxs)("div",{style:y.columnsRow,children:[(0,n.jsx)("div",{style:y.flexCard,children:(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:g}),(0,n.jsx)(a(439423).v,{title:x,count:e.spaces.length,filteredCount:M.length,visibleCount:P.length,isExpanded:h,onToggle:R,onShowMore:N,isFirst:!0,isLast:!0,searchQuery:k,onSearchChange:A,children:P.map((e,t)=>(0,n.jsx)(S,{space:e,isLast:t===P.length-1},e.id))})]})}),e.organization?(0,n.jsx)("div",{style:y.flexCard,children:(0,n.jsx)(u,{organizationId:e.organization.id,permissionsStore:r})}):void 0]})]})}):void 0]})}function R(e){let t=(0,a(533992).v3)(),r=(0,a(743187).g)(),s=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=r.state;if(void 0===e)return{accounts:void 0,organizations:void 0};let t=a(688211)._P.adminSearchAccounts,i=a(688211)._P.adminSearchOrganizations;return{accounts:(0,a(688211).qO)(t)&&e.has(t.apiName),organizations:(0,a(688211).qO)(i)&&e.has(i.apiName)}},[r]),[o]=(0,i.useState)(()=>new URLSearchParams(window.location.search).get("q")??""),[l,c]=(0,i.useState)(o),[p,m]=(0,i.useState)(!1),[h,f]=(0,i.useState)(void 0),[b,k]=(0,i.useState)(void 0),[w,I]=(0,i.useState)(void 0),[C,R]=(0,i.useState)(!1),[A,N]=(0,i.useState)(""),[M,P]=(0,i.useState)(20),V=C?s.accounts:s.organizations,E=l.trim().length>0&&!p&&!0===V,B=(0,i.useMemo)(()=>(null==b?void 0:b.spaces)??[],[null==b?void 0:b.spaces]),L=(0,i.useMemo)(()=>j(B,A),[B,A]),_=(0,i.useMemo)(()=>L.slice(0,M),[L,M]),U=(0,i.useCallback)(e=>{N(e),P(20)},[]),W=(0,i.useCallback)(()=>{P(e=>e+20)},[]),F=(0,i.useCallback)(()=>{f(void 0),k(void 0),I(void 0),N(""),P(20)},[]),K=(0,i.useCallback)(async()=>{if(!E)return;let e=l.trim();m(!0),F();try{if(C){let i=await t.api.callApi({eventName:"adminSearchAccounts",environment:t,data:{query:e,__adminUISource:"unified_account_view"}});if("success"===i.type){let t=i.data;t.found?(I(t.results),D(e)):f("No account found. Searched organizations, billing contracts, and workspaces by email domain.")}else f((0,a(201790).V4)(i))}else{let i=await t.api.callApi({eventName:"adminSearchOrganizations",environment:t,data:{domainOrSpaceOrOrganizationId:e,__adminUISource:"unified_account_view"}});if("success"===i.type){let t=i.data;+("invalid"===t.input)?f("No organization found. Try searching by email domain, space UUID, or organization UUID."):(k(t),D(e))}else f((0,a(201790).V4)(i))}}catch(e){(0,a(208318).t)().log({level:"warning",from:"UnifiedAccountView",type:"searchFailed",error:(0,a(952977).convertErrorToLog)(e)}),f(e instanceof Error?e.message:"Failed to fetch organization data")}finally{m(!1)}},[E,t,C,l,F]),$=(0,i.useCallback)(()=>{K()},[K]),O=(0,i.useCallback)(()=>{R(e=>!e)},[]),z=(0,i.useCallback)(e=>{c(e.target.value)},[]),G=(0,i.useCallback)(()=>{c(""),F(),D(void 0)},[F]),q=(0,i.useRef)(!1);(0,i.useEffect)(()=>{o&&!0===s.organizations&&!q.current&&(q.current=!0,K())},[o,s.organizations,K]);let H=void 0!==b||void 0!==w||void 0!==h,Z=void 0===b&&void 0===w&&void 0===h;return(0,n.jsx)(a(45062).A,{title:"Unified Account View - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"unifiedAccountView",children:(0,n.jsxs)("div",{style:y.adminWrap,children:[!1===s.organizations?(0,n.jsx)(a(4458).fI,{padding:8,children:(0,n.jsx)("div",{style:y.noPermissionBanner,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:"You do not have permission to search organizations. Contact your admin to request access."})})}):void 0,(0,n.jsx)(a(4458).fI,{gap:16,alignItems:"stretch",padding:8,children:(0,n.jsx)("div",{style:y.flexCard,children:(0,n.jsxs)(a(4458).VP,{gap:16,children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Unified Account View"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Search for an account by email domain, UUID, or organization name."})]}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"Search"}),(0,n.jsx)("div",{style:y.inputContainer,children:(0,n.jsx)(a(287562).p,{value:l,onCh
106ange:z,placeholder:"Enter email domain, space UUID, or organization UUID",focusInitial:!0,onSubmit:$,showClearButton:!0,onClearButtonClick:G})}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"You can search by email domain (e.g. example.com), workspace UUID, or organization UUID."})]}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)("input",{type:"checkbox",checked:C,onChange:O}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Include billing contracts, shared workspace domains & user emails (slower)"})]}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(548436).A,{onClick:$,disabled:!E,children:p?"Searching...":"Search"}),H?(0,n.jsx)(a(548436).A,{onClick:G,children:"Clear"}):void 0,p?(0,n.jsx)(a(517334).k,{size:"sm"}):void 0]}),h?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:h}):void 0]})})}),Z?(0,n.jsxs)("div",{style:y.resultsContainer,children:[(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"What you'll see after searching"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Each section below loads once you search for an account."})]}),(0,n.jsx)(a(554577).A,{title:"Organization Overview",description:"Core organization details alongside security and owners.",items:v}),(0,n.jsxs)("div",{style:y.columnsRow,children:[(0,n.jsx)(a(4458).VP,{flex:1,minWidth:0,children:(0,n.jsx)(a(554577).A,{title:"Workspaces",description:"All workspaces belonging to this organization — searchable, with links into the Workspace View."})}),(0,n.jsx)(a(4458).VP,{flex:1,minWidth:0,children:(0,n.jsx)(a(554577).A,{title:"Account Notes",description:"Internal support notes attached to this organization — read, add, or edit."})})]}),(0,n.jsx)(a(554577).A,{title:"Billing Contracts",description:"Salesforce contracts tied to this organization (shown when deep search is enabled)."})]}):void 0,w?(0,n.jsxs)("div",{style:y.resultsContainer,children:[w.length>1?(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:`${w.length} results found`}):void 0,w.map((e,t)=>{var a;return(0,n.jsx)(T,{result:e,defaultExpanded:0===t,permissionsStore:r},(null==(a=e.organization)?void 0:a.id)??t)})]}):void 0,b?(0,n.jsxs)("div",{style:y.resultsContainer,children:[b.organization?(0,n.jsx)(d,{organization:b.organization,usersWithOrgRoles:b.usersWithOrgRoles,workspaceCount:b.spaces.length,samlConfigs:b.samlConfigs,permissionsStore:r}):void 0,(0,n.jsxs)("div",{style:y.columnsRow,children:[(0,n.jsx)("div",{style:y.flexCard,children:(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:g}),(0,n.jsx)(a(820517).P,{title:x,count:B.length,filteredCount:L.length,visibleCount:_.length,defaultExpanded:!0,onShowMore:W,isFirst:!0,isLast:!0,searchQuery:A,onSearchChange:U,children:_.map((e,t)=>(0,n.jsx)(S,{space:e,isLast:t===_.length-1},e.id))})]})}),b.organization?(0,n.jsx)("div",{style:y.flexCard,children:(0,n.jsx)(u,{organizationId:b.organization.id,permissionsStore:r})}):void 0]})]}):void 0]})})})}},378134(e,t,a){a.r(t),a.d(t,{UnifiedUserView:()=>Y}),a(533958),a(176765),a(851344),a(866491);var i=a(635790),n=()=>a(208318);a(159952);var r=a(440302);let s={sectionTitle:{marginBottom:12},notesList:{maxHeight:600,overflowY:"auto"},noteEntry:{paddingTop:10,paddingBottom:10,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},charCount:{textAlign:"end"},emptyState:{padding:8}};function o({onSubmit:e,isSubmitting:t}){let[n,l]=(0,i.useState)(""),d=n.length,c=d>1e3,p=d>=800&&!c,m=n.trim().length>0&&!c&&!t,u=(0,i.useCallback)(async()=>{m&&(await e(n),l(""))},[m,e,n]),h=(0,i.useCallback)(e=>{l(e.target.value)},[]),y=(0,i.useCallback)(()=>{l("")},[]);return(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(287562).p,{textarea:!0,textareaSubmitOnEnter:!1,autosize:!0,autosizeMinHeight:50,value:n,onChange:h,onClearButtonClick:y,showClearButton:n.length>0,placeholder:"Add a note about this user…",maxlength:1e3}),(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",children:[(0,r.jsx)("div",{style:s.charCount,children:(0,r.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:c||p?"primary":"tertiary",colorPalette:c?"red":p?"orange":void 0,children:[d," / ",1e3]})}),(0,r.jsx)(a(912946).j,{size:"sm",onClick:u,disabled:!m,children:t?"Posting...":"Post"})]})]})}function l({note:e,isAuthor:t,onArchive:n,isArchiving:o}){let d=(0,i.useCallback)(()=>{n(e.id)}
106,[n,e.id]);return(0,r.jsx)("div",{style:s.noteEntry,children:(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",children:[(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:e.createdByEmail}),(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:new Date(e.createdTime).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),t?(0,r.jsx)(a(548436).A,{size:"xs",onClick:d,disabled:o,children:o?"Archiving...":"Archive"}):void 0]}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.noteText})]})})}function d({userId:e,permissionsStore:t}){let c=(0,a(533992).v3)(),p=c.currentUser.id,m=(0,a(83388).G2)(e),u=(0,a(47602).S)(t,"adminListEntityNotes"),h=(0,i.useRef)(!0);(0,i.useEffect)(()=>()=>{h.current=!1},[]);let[y,g]=(0,i.useState)([]),[x,f]=(0,i.useState)(!1),[b,v]=(0,i.useState)(!1),[j,k]=(0,i.useState)(void 0),[S,w]=(0,i.useState)(void 0),I=(0,i.useCallback)(async()=>{if(h.current){f(!0),w(void 0);try{let e=await c.api.callApi({eventName:"adminListEntityNotes",environment:c,data:{entityType:"user",entityId:m,__adminUISource:"unified_user_view"}});h.current&&("success"===e.type?g(e.data.notes):w("Failed to load notes"))}catch(e){(0,n().t)().log({level:"warning",from:"UserAccountNotesSection",type:"notesLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),h.current&&w("Failed to load notes")}finally{h.current&&f(!1)}}},[c,m]);(0,i.useEffect)(()=>{!1!==u&&void 0!==u&&I()},[I,u]);let C=(0,i.useCallback)(async e=>{v(!0),w(void 0);try{let t=await c.api.callApi({eventName:"adminCreateEntityNote",environment:c,data:{entityType:"user",entityId:m,noteText:e,__adminUISource:"unified_user_view"}});h.current&&("success"===t.type?await I():w("Failed to create note"))}catch(e){(0,n().t)().log({level:"warning",from:"UserAccountNotesSection",type:"noteCreateFailed",error:(0,a(952977).convertErrorToLog)(e)}),h.current&&w("Failed to create note")}finally{h.current&&v(!1)}},[c,m,I]),D=(0,i.useCallback)(async e=>{k(e),w(void 0);try{let t=await c.api.callApi({eventName:"adminArchiveEntityNote",environment:c,data:{noteId:e,entityType:"user",entityId:m,__adminUISource:"unified_user_view"}});h.current&&("success"===t.type?await I():w("Failed to archive note"))}catch(e){(0,n().t)().log({level:"warning",from:"UserAccountNotesSection",type:"noteArchiveFailed",error:(0,a(952977).convertErrorToLog)(e)}),h.current&&w("Failed to archive note")}finally{h.current&&k(void 0)}},[c,m,I]),T=(0,r.jsx)("div",{style:s.sectionTitle,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"User Notes"})});return void 0===u?(0,r.jsxs)(a(4458).VP,{gap:0,children:[T,(0,r.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,r.jsx)(a(517334).k,{size:"sm"})})]}):!1===u?(0,r.jsxs)(a(4458).VP,{gap:0,children:[T,(0,r.jsx)("div",{style:s.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"You don't have access to view account notes"})})]}):(0,r.jsxs)(a(4458).VP,{gap:0,children:[T,(0,r.jsx)(o,{onSubmit:C,isSubmitting:b}),S?(0,r.jsx)(a(4458).fI,{padding:4,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:S})}):void 0,(0,r.jsx)("div",{style:s.notesList,children:x?(0,r.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading notes..."})]}):y.length>0?(0,r.jsx)(a(4458).VP,{gap:0,children:y.map(e=>(0,r.jsx)(l,{note:e,isAuthor:e.createdById===p,onArchive:D,isArchiving:j===e.id},e.id))}):(0,r.jsx)("div",{style:s.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No notes yet. Add a note about this user above."})})})]})}a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(139583);let c="Admin Actions Log",p="Loading admin actions...",m="Failed to load admin actions",u="Failed to load admin history",h="You don't have access to view admin actions",y="Lo
106ad more",g={sectionTitle:{marginBottom:12},tabBar:{display:"flex",gap:0,borderBottom:`1px solid ${a(632079).Tj.border.primary}`,marginBottom:12},tab:{paddingTop:8,paddingBottom:8,paddingInlineStart:12,paddingInlineEnd:12,cursor:"pointer",background:"none",border:"none",borderBottom:"2px solid transparent",font:"inherit",color:a(632079).Tj.text.secondary},tabActive:{paddingTop:8,paddingBottom:8,paddingInlineStart:12,paddingInlineEnd:12,cursor:"pointer",background:"none",border:"none",font:"inherit",borderBottom:`2px solid ${a(632079).Tj.text.primary}`,color:a(632079).Tj.text.primary},tabContent:{maxHeight:400,overflowY:"auto"},emptyState:{padding:8},loadMoreContainer:{display:"flex",justifyContent:"center",paddingTop:12,paddingBottom:4,borderTop:`1px solid ${a(632079).Tj.border.secondary}`,marginTop:8},loadMoreButton:{cursor:"pointer",background:"none",border:"none",padding:"4px 8px",font:"inherit",color:a(632079).Tj.text.accentPrimary,borderRadius:4},dateFilterRow:{marginBottom:12},dateInput:{padding:"4px 8px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,background:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,font:"inherit",fontSize:13},filterButton:{cursor:"pointer",background:"none",border:`1px solid ${a(632079).Tj.border.primary}`,padding:"4px 12px",font:"inherit",fontSize:13,borderRadius:4,color:a(632079).Tj.text.primary}};function x({startDate:e,endDate:t,onStartDateChange:n,onEndDateChange:s,onApply:o,onClear:l,hasFilter:d}){let c=(0,i.useCallback)(e=>{n(e.target.value)},[n]),p=(0,i.useCallback)(e=>{s(e.target.value)},[s]);return(0,r.jsx)("div",{style:g.dateFilterRow,children:(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"From"}),(0,r.jsx)("input",{type:"date",value:e,onChange:c,style:g.dateInput}),(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"To"}),(0,r.jsx)("input",{type:"date",value:t,onChange:p,style:g.dateInput}),(0,r.jsx)("button",{type:"button",style:g.filterButton,onClick:o,disabled:!e&&!t||!!e&&!!t&&e>t,children:"Apply"}),d?(0,r.jsx)("button",{type:"button",style:g.filterButton,onClick:l,children:"Clear"}):void 0]})})}function f(e){return new Date(e).getTime()}function b({userId:e,permissionsStore:t}){let s=(0,a(533992).v3)(),o=(0,a(83388).G2)(e),l=(0,a(47602).S)(t,"getUserAdminApiLog"),[d,c]=(0,i.useState)([]),[u,v]=(0,i.useState)(!1),[j,k]=(0,i.useState)(!1),[S,w]=(0,i.useState)(void 0),[I,C]=(0,i.useState)(!1),[D,T]=(0,i.useState)(""),[R,A]=(0,i.useState)(""),[N,M]=(0,i.useState)(void 0),[P,V]=(0,i.useState)(void 0),[E,B]=(0,i.useState)(void 0),L=(0,i.useRef)(0),_=(0,i.useCallback)(async(e,t,i,r)=>{let l=L.current+1;L.current=l,0===e?v(!0):k(!0),w(void 0);try{let a=await s.api.callApi({eventName:"getUserAdminApiLog",environment:s,data:{userId:o,offset:e,startTime:t,endTime:i,eventName:r,__adminUISource:"unified_user_view"}});if(l===L.current)if("success"===a.type){let t=a.data.changes;0===e?c(t):c(e=>{let a=new Set(e.map(e=>{var t;return null==(t=e.apiLog)?void 0:t.id}).filter(Boolean)),i=t.filter(e=>{var t;return!(null!=(t=e.apiLog)&&t.id)||!a.has(e.apiLog.id)});return[...e,...i]}),C(t.length>=25)}else w(m)}catch(e){(0,n().t)().log({level:"warning",from:"UserAdminActionsSection",type:"actionsOnUserLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),l===L.current&&w(m)}finally{l===L.current&&(v(!1),k(!1))}},[o,s]);(0,i.useEffect)(()=>{if(!0===l)return _(0),()=>{L.current+=1}},[_,l]);let U=(0,i.useCallback)(()=>{_(d.length,N,P,E)},[_,d.length,N,P,E]),W=(0,i.useCallback)(()=>{let e=D?f(D):void 0,t=R?f(R)+864e5:void 0;M(e),V(t),c([]),_(0,e,t,E)},[D,R,_,E]),F=(0,i.useCallback)(()=>{T(""),A(""),M(void 0),V(void 0),c([]),_(0,void 0,void 0,E)},[_,E]),K=(0,i.useCallback)(e=>{B(e),c([]),_(0,N,P,e)},[_,N,P]);return void 0===l?(0,r.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,r.jsx)(a(517334).k,{size:"sm"})}):!1===l?(0,r.jsx)("div",{style:g.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:h})}):(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)(a(4458).fI,{marginBottom:12,children:(0,r.jsx)(a(416236)._,{variant:"inlineSelect",onChange:K})}),(0,r.jsx)(x,{startDate:D,endDate:R,onStartDateChange:T,onEndDateChange:A,onApply:W,onClear:F,hasFilter:void 0!==N||void 0!==P}),u?(0,r.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:p})]}):S?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:S}):d.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(2081).k,{entries:d}),I?(0,r.jsx)("div",{style:g.loadMoreContainer,children:j?(0,r.jsx)(a(517334).k,{size:"sm"}):(0,r.jsx)("button",{type:"button",style:g.loadMoreButton,onClick:U,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"accentPrimary",children:y})})}):void 0]}):(0,r.jsx)("div",{style:g.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No admin actions foun
106d for this user."})})]})}function v({userId:e,viewedUser:t,permissionsStore:s}){var o,l;let d,c=(0,a(533992).v3)(),m=(0,a(83388).G2)(e),b=(0,a(47602).S)(s,"getAdminHistory"),[j,k]=(0,i.useState)(void 0),[S,w]=(0,i.useState)(!1),[I,C]=(0,i.useState)(!1),[D,T]=(0,i.useState)(void 0),[R,A]=(0,i.useState)(!1),[N,M]=(0,i.useState)(""),[P,V]=(0,i.useState)(""),[E,B]=(0,i.useState)(void 0),[L,_]=(0,i.useState)(void 0),[U,W]=(0,i.useState)(void 0),F=(0,i.useRef)(0),K=(0,i.useCallback)(async(e,t,i,r)=>{let s=F.current+1;F.current=s,0===e?w(!0):C(!0),T(void 0);try{let n=await c.api.callApi({eventName:"getAdminHistory",environment:c,data:{userId:m,offset:e,startTime:t,endTime:i,eventName:r,__adminUISource:"unified_user_view"}});if(s===F.current)if("success"===n.type){let t=n.data.changes;0===e?k(n.data):k(e=>(function(e,t){if(void 0===e)return t;let i=new Set(e.changes.map(e=>e.apiLog.id)),n=t.changes.filter(e=>!i.has(e.apiLog.id));return{changes:[...e.changes,...n],adminRecordMap:a(412951).RecordMap.mergeByVersion([a(412951).RecordMap.create(e.adminRecordMap),a(412951).RecordMap.create(t.adminRecordMap)]).toJson()}})(e,n.data)),A(t.length>=25)}else T(u)}catch(e){(0,n().t)().log({level:"warning",from:"UserAdminActionsSection",type:"actionsByUserLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),s===F.current&&T(u)}finally{s===F.current&&(w(!1),C(!1))}},[m,c]);(0,i.useEffect)(()=>{if(!0===b)return K(0),()=>{F.current+=1}},[K,b]);let $=(0,i.useCallback)(()=>{K((null==j?void 0:j.changes.length)??0,E,L,U)},[K,null==j?void 0:j.changes.length,E,L,U]),O=(0,i.useCallback)(()=>{let e=N?f(N):void 0,t=P?f(P)+864e5:void 0;B(e),_(t),k(void 0),K(0,e,t,U)},[N,P,K,U]),z=(0,i.useCallback)(()=>{M(""),V(""),B(void 0),_(void 0),k(void 0),K(0,void 0,void 0,U)},[K,U]),G=(0,i.useCallback)(e=>{W(e),k(void 0),K(0,E,L,e)},[K,E,L]),q=(null==j?void 0:j.changes)??[];return void 0===b?(0,r.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,r.jsx)(a(517334).k,{size:"sm"})}):!1===b?(0,r.jsx)("div",{style:g.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:h})}):(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)(a(4458).fI,{marginBottom:12,children:(0,r.jsx)(a(416236)._,{variant:"inlineSelect",onChange:G})}),(0,r.jsx)(x,{startDate:N,endDate:P,onStartDateChange:M,onEndDateChange:V,onApply:O,onClear:z,hasFilter:void 0!==E||void 0!==L}),S?(0,r.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:p})]}):D?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:D}):q.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(2081).k,{entries:q,recordMapJson:null==j?void 0:j.adminRecordMap,fallbackAdminActorName:(d=null==(o=t.emails.find(e=>e.isPrimary))?void 0:o.email,t.name??d??t.email??(null==(l=t.emails[0])?void 0:l.email)??(0,a(83388).G2)(t.id))}),R?(0,r.jsx)("div",{style:g.loadMoreContainer,children:I?(0,r.jsx)(a(517334).k,{size:"sm"}):(0,r.jsx)("button",{type:"button",style:g.loadMoreButton,onClick:$,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"accentPrimary",children:y})})}):void 0]}):(0,r.jsx)("div",{style:g.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No admin actions found by this user."})})]})}function j({userId:e,viewedUser:t,permissionsStore:n}){let s=(0,a(47602).S)(n,"getUserAdminApiLog"),o=(0,a(47602).S)(n,"getAdminHistory"),l=!1!==s,d=!1!==o,[p,m]=(0,i.useState)(l?"onUser":"byUser");return((0,i.useEffect)(()=>{!1===s&&!1!==o&&m("byUser")},[s,o]),l||d)?(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)("div",{style:g.sectionTitle,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:c})}),+!!l+ +!!d>1?(0,r.jsxs)("div",{style:g.tabBar,role:"tablist",children:[l?(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":"onUser"===p,"aria-controls":"admin-actions-on-user-panel",style:"onUser"===p?g.tabActive:g.tab,onClick:()=>m("onUser"),children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"onUser"===p?"primary":"secondary",children:"Actions on User"})}):void 0,d?(0,r.jsx)("button",{type:"button",role:"tab","aria-selected":"byUser"===p,"aria-controls":"admin-actions-by-user-panel",style:"byUser"===p?g.tabActive:g.tab,onClick:()=>m("byUser"),children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"byUser"===p?"primary":"secondary",children:"Actions by User"})}):void 0]}):void 0,(0,r.jsx)("div",{style:g.tabContent,role:"tabpanel",id:"onUser"===p?"admin-actions-on-user-panel":"admin-actions-by-user-panel",children:"onUser"===p?(0,r.jsx)(b,{userId:e,permissionsStore:n},e):(0,r.jsx)(v,{userId:e,viewedUser:t,permissionsStore:n},e)})]}):(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)("div",{style:g.sectionTitle,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:c})}),(0,r.jsx)("div",{style:g.emptyState,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:h})})]})}a(435368),a(1310);let k=(0,a(327219).YK)({banCategoryLabel:{id:"userInfoSection.ban.categoryLabel",defaultMessage:"Ban Category"},banSubcategoryLabel:{id:"userInfoSection.ban.subcategoryLabel",defaultMessage:"Ban Subcategory"},banDetailsLabel:{id:"userInfoSection.ban.detailsLabel",defaultMessage:"Ban Details"},dateBannedLabel:{id:"userInfoSection.ban.dateBannedLabel",defaultMessage:"Date Banned"},banIdLabel:{id:"userInfoSection.ban.idLabel",defaultMessage:"Ban ID"},appealEligibleLabel:{id:"userInfoSection.ban.appealEligibleLabel",defaultMessage:"Appeal Eligible"},previouslyBannedValue:{id:"userInfoSection.ban.previouslyBannedValue",defaultMessage:"No (previously banned)"}}),S={container:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,padding:16},labelColumn:{minWidth:180}},w="None";function I({orgId:e}){let t=(0,i.useCallback)(t=>{t.stopPropagation(),window.open(`${a(168962).JZ.adminUnifiedAccountView}?q=${e}`,"_blank")},[e]);return(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(799615).B,{value:e,formatUuid:!0,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,r.jsx)(a(137691).x5,{value:e})})}),(0,r.jsx)(a(988022).p,{size:"xs",onClick:t,iconTrailing:a(166568).arrowUpRightSquareSmallIcon,children:"Open in Account View"})]})}function C({icon:e,text:t,isNegative:i}){return(0,r.jsxs)(a(4458).fI,{alignItems:"center",gap:4,children:[(0,r.jsx)("span",{"aria-hidden":!0,
106children:e}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:i?"accentPrimary":"secondary",colorPalette:i?"red":void 0,children:t})]})}function D({data:e}){var t,i;let n=(0,a(327219).tz)(),s=(null==(t=e.emails.find(e=>e.isPrimary))?void 0:t.email)??(null==(i=e.emails[0])?void 0:i.email),o=e.emails.map(e=>e.email).join(", "),l="???"!==e.deletedTime?{label:"Deleted",isNegative:!0}:e.isBanned?{label:"Banned",isNegative:!0}:"???"!==e.suspendedTime?{label:"Suspended",isNegative:!0}:{label:"Active",isNegative:!1};return(0,r.jsxs)("div",{style:S.container,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"General Information"}),(0,r.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,r.jsx)(a(458482).F,{title:"Identity"}),(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:S.labelColumn,children:"User ID"}),(0,r.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,r.jsx)(a(137691).x5,{value:e.id})})})]}),e.name?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Name",value:e.name}):void 0,s?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Primary Email",value:s}):void 0,e.emails.length>1?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"All Emails",value:o}):void 0]}),(0,r.jsx)(a(143855).c,{}),(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(458482).F,{title:"Status"}),(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:S.labelColumn,children:"Status"}),(0,r.jsx)(C,{icon:l.isNegative?"❌":"✅",text:l.label,isNegative:l.isNegative})]}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Signup Time",value:e.signupTime}),e.lastSeenTime?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Last Seen",value:e.lastSeenTime}):void 0,e.lastLoginTime?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Last Login",value:e.lastLoginLocation?`${e.lastLoginTime} \u00b7 ${e.lastLoginLocation}`:e.lastLoginTime}):void 0,"???"!==e.suspendedTime?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Suspended Time",value:e.suspendedTime}):void 0,"???"!==e.deletedTime?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Deleted Time",value:e.deletedTime}):void 0,e.deletedBy?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Deleted By",value:e.deletedBy.email??e.deletedBy.id}):void 0,e.isBanned||e.banMetadata?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Banned",value:e.isBanned?"Yes":n.formatMessage(k.previouslyBannedValue)}):void 0,e.banMetadata?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:n.formatMessage(k.banCategoryLabel),value:e.banMetadata.category}),e.banMetadata.subcategory?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:n.formatMessage(k.banSubcategoryLabel),value:e.banMetadata.subcategory}):void 0,e.banMetadata.other?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:n.formatMessage(k.banDetailsLabel),value:e.banMetadata.other}):void 0,e.banMetadata.dateBanned?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:n.formatMessage(k.dateBannedLabel),value:e.banMetadata.dateBanned}):void 0,e.banMetadata.banId?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:n.formatMessage(k.banIdLabel),value:e.banMetadata.banId}):void 0,void 0!==e.banMetadata.appealEligible?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:n.formatMessage(k.appealEligibleLabel),value:e.banMetadata.appealEligible?"Yes":"No"}):void 0]}):void 0]}),(0,r.jsx)(a(143855).c,{}),(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(458482).F,{title:"Security"}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Password",value:e.password?"Yes":"No"}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"MFA",value:e.isMfaEnabled?`Enabled (${function(e){let t=[],a=e.mfaMethods.totp;if(a&&a.length>0){let e=a.map(e=>e.name.trim()).filter(e=>e.length>0);t.push(e.length>0?`TOTP (${e.join(", ")})`:`TOTP (${a.length})`)}let i=e.mfaMethods.sms;if(i&&i.length>0){let e=i.map(e=>e.phoneNumberLastFour.trim()).filter(e=>e.length>0).map(e=>`\u2022\u2022\u2022\u2022 ${e}`);t.push(e.length>0?`SMS (${e.join(", ")})`:`SMS (${i.length})`)}let n=e.mfaMethods.backup_code;if(n&&n.length>0){let e=n.reduce((e,t)=>
106e+t.codesRemaining,0);t.push(`Backup codes (${e} remaining)`)}return 0===t.length?w:t.join("; ")}(e)})`:"Disabled"}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Passkeys",value:e.passkeys.length>0?`${e.passkeys.length} registered`:w}),void 0!==e.isSamlSsoLoginRequiredForUser?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"SAML SSO Required",value:e.isSamlSsoLoginRequiredForUser?"Yes":"No"}):void 0]}),(0,r.jsx)(a(143855).c,{}),(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(458482).F,{title:"Settings"}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Timezone",value:e.userTimezone??"Not set"}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Analytics Disabled",value:e.disableAnalytics?"Yes":"No"}),(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Workspace Analytics Disabled",value:e.disableWorkspaceAnalytics?"Yes":"No"}),void 0!==e.aiDataShareOptIn?(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"AI Data Share Opt-In",value:e.aiDataShareOptIn?"Yes":"No"}):void 0,(0,r.jsx)(a(135744).B,{labelWidth:"wide",label:"Data Access Consent",value:function(e){switch(e.status){case"notGranted":return"Not granted";case"expired":return`Expired ${e.expiryTime}`;case"granted":return`Expires ${e.expiryTime}`}}(e.userDataConsent)})]}),e.organizationIds.length>0?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(a(143855).c,{}),(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(458482).F,{title:"Organizations"}),e.organizationIds.map(e=>(0,r.jsx)(I,{orgId:e},e))]})]}):void 0]})}let T=(0,a(327219).YK)({sectionTitle:{id:"userQuickActionsSection.title",defaultMessage:"Quick Actions"},noPermissions:{id:"userQuickActionsSection.noPermissions",defaultMessage:"You don’t have permission to use any quick actions."},loadingPermissions:{id:"userQuickActionsSection.loadingPermissions",defaultMessage:"Loading available actions…"},categoryPrimary:{id:"userQuickActionsSection.category.primary",defaultMessage:"Primary Actions"},categoryAccount:{id:"userQuickActionsSection.category.account",defaultMessage:"Account Actions"},categoryDestructive:{id:"userQuickActionsSection.category.destructive",defaultMessage:"Destructive"},categoryExperiments:{id:"userQuickActionsSection.category.experiments",defaultMessage:"Experiments"},loginAsUserAriaLabel:{id:"userQuickActionsSection.loginAsUser.ariaLabel",defaultMessage:"Login as User - Admin Tool"}}),R=[{titleMessageKey:"categoryPrimary",actions:[{toolName:"recoverUser",displayName:"Recover User",isDestructive:!0},{toolName:"adminRecoverMfa",displayName:"Reset MFA",isDestructive:!0}]},{titleMessageKey:"categoryAccount",actions:[{toolName:"adminChangeEmail",displayName:"Change Email",isDestructive:!0},{toolName:"adminBanUser",displayName:"Ban/Unban User",isDestructive:!0}]},{titleMessageKey:"categoryDestructive",actions:[{toolName:"adminDeleteUser",displayName:"Delete User",isDestructive:!0}]},{titleMessageKey:"categoryExperiments",actions:[{toolName:"adminGetStatsigExperiment",displayName:"Get Experiment Group"},{toolName:"adminGetStatsigFeatureGate",displayName:"Get Feature Gate"}]}],A={headerRow:{marginBottom:16},categorySection:{marginBottom:16},categoryHeader:{marginBottom:8},messageText:{padding:8},loginModalContent:{padding:24,backgroundColor:a(632079).Tj.background.primary,maxHeight:"70vh",overflowY:"auto"}};function N({data:e,permissionsStore:t}){var n,s;let o=(0,a(327219).tz)(),[l,d]=(0,i.useState)(void 0),[c,p]=(0,i.useState)(!1),m=(null==(n=e.emails.find(e=>e.isPrimary))?void 0:n.email)??(null==(s=e.emails[0])?void 0:s.email),u=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=t.state;return void 0===e?new Set:new Set(Object.values(a(688211)._P).filter(t=>(0,a(688211).qO)(t)&&e.has(t.apiName)).map(e=>e.apiName))},[t]),{permissionsLoaded:h,permissionsErrored:y,currentUserPermissions:g}=(0,a(579993).K8)(()=>{let{currentUserPermissions:e,fetchPermissionsErrored:a}=t.state;return{permissionsLoaded:void 0!==e,permissionsErrored:a,currentUserPermissions:e}},[t]),x=(0,i.useCallback)(e=>{d({toolName:e.toolName,displayName:e.displayName})},[]),f=(0,i.useCallback)(()=>{d(void 0)},[]),b=(0,i.useCallback)(()=>{p(!0)},[]),v=(0,i.useCallback)(()=>{p(!1)},[]),j=(0,i.useMemo)(()=>{let t={};return t.userId=e.id,m&&(t.userEmail=m,t.oldEmail=m,t.email=m),t},[e.id,m]),k=(0,i.useMemo)(()=>h?R.map(e=>({...e,actions:e.actions.filter(e=>u.has(e.toolName))})).filter(e=>e.actions.length>0):[],[u,h]),S=(0,i.useMemo)(()=>!!g&&(g.has("adminLoginAsUserRead")||g.has("adminLoginAsUserWrite")||g.has("adminLoginAsUserNoPermissionOverride")),[g]),w=k.length>0||S;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)("div",{style:A.headerRow,children:(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:o.formatMessage(T.sectionTitle)})}),h||y?w?(0,r.jsxs)(a(4458).VP,{gap:0,children:[S?(0,r.jsx)("div",{style:A.categorySection,children:(0,r.jsx)(a(4458).fI,{flexWrap:"wrap",gap:8,children:(0,r.jsx)(a(548436).A,{onClick:b,children:"Login as User"})})}):void 0,k.map(e=>(0,r.jsxs)("div",{style:A.categorySection,children:[(0,r.jsx)("div",{style:A.categoryHeader,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:o.formatMessage(T[e.titleMessageKey])})}),(0,r.jsx)(a(4458).fI,{flexWrap:"wrap",gap:8,children:e.actions.map(e=>(0,r.jsx)(a(548436).A,{onClick:()=>{x(e)},colorPalette:e.isDestructive?"red":void 0,children:e.displayName},e.toolName))})]},e.titleMessageKey))]}):(0,r.jsx)("div",{style:A.messageText,children:(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:o.formatMessage(T.noPermissions)})}):(0,r.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,r.jsx)(a(517334).k,{size:"sm"}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:o.formatMessage(T.loadingPermissions)})]})]}),(0,r.jsx)(a(943365).s,{isOpen:c,onDismiss:v,ariaLabel:o.formatMessage(T.loginAsUserAriaLabel),areaConstraint:{width:{type:"range",min:500,max:700}},children:()=>(0,r.jsx)("div",{style:A.loginModalContent,children:(0,r.jsx)(a(607142).G,{email:m,permissionsSet:g})})}),(0,r.jsx)(a(674848).v,{isOpen:void 0!==l,onDismiss:f,toolName:null==l?void 0:l.toolName,displayName:(null==l?void 0:l.displayName)??"",spaceId:"",additionalParams:j,hasPermission:l?u.has(l.toolName):void 0,source:"unified_user_view"})]})}let M=[{toolName:"adminSearchBlocks",displayName:"Block Lookup"},{toolName:"adminReadBlockPermissions",displayName:"Page Permissions"},{toolName:"adminSearchNotifications",displayName:"Search Notifications"}
106,{toolName:"adminFindDeletedUser",displayName:"Find Deleted Accounts"},{toolName:"adminGetMicrosoftTeamsConnections",displayName:"Microsoft Teams Connections"}],P={container:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8},sectionTitle:{marginBottom:8}};function V({data:e,permissionsStore:t}){var n,s;let[o,l]=(0,i.useState)(void 0),d=(null==(n=e.emails.find(e=>e.isPrimary))?void 0:n.email)??(null==(s=e.emails[0])?void 0:s.email),c=(0,i.useMemo)(()=>{let t={};return t.userId=e.id,d&&(t.userIdOrEmail=d,t.userEmail=d),t},[e.id,d]),p=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=t.state;return void 0===e?new Set:new Set(Object.values(a(688211)._P).filter(t=>(0,a(688211).qO)(t)&&e.has(t.apiName)).map(e=>e.apiName))},[t]),m=(0,a(579993).K8)(()=>void 0!==t.state.currentUserPermissions,[t]),u=(0,i.useMemo)(()=>m?M.filter(e=>p.has(e.toolName)):[],[p,m]),h=(0,i.useCallback)(e=>{l(e)},[]),y=(0,i.useCallback)(()=>{l(void 0)},[]);return 0===u.length?null:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{style:P.container,children:(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)("div",{style:P.sectionTitle,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Related Lookups"})}),(0,r.jsx)(a(4458).fI,{flexWrap:"wrap",gap:8,children:u.map(e=>(0,r.jsx)(a(548436).A,{onClick:()=>h(e),children:e.displayName},e.toolName))})]})}),(0,r.jsx)(a(674848).v,{isOpen:void 0!==o,onDismiss:y,toolName:null==o?void 0:o.toolName,displayName:(null==o?void 0:o.displayName)??"",spaceId:"",additionalParams:c,hasPermission:o?p.has(o.toolName):void 0,source:"unified_user_view"})]})}let E="Workspaces",B="Sales-assisted",L="Self-serve",_={owner:"Owner",membership_admin:"Membership Admin",member:"Member",restricted_member:"Restricted Member",page_guest:"Guest",none:"No access",unknown:"Unknown"},U={row:{paddingBlock:8,paddingInline:0,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},rowLast:{paddingBlock:8,paddingInline:0},detailsLabel:{minWidth:80},providerLink:{display:"inline-flex",alignItems:"center",textDecoration:"none",cursor:"pointer"}};function W({spaceId:e,userRole:t,hydratedData:n,hydrationFailed:s,isLast:o}){var l,d,c,p;let m=(0,i.useCallback)(t=>{t.stopPropagation(),window.open(`${a(168962).JZ.adminUnifiedWorkspaceView}?spaceId=${e}`,"_blank")},[e]),u=void 0!==n,h=(null==n?void 0:n.forUserRole)??t;return(0,r.jsx)("div",{style:o?U.rowLast:U.row,children:(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[u?(0,r.jsx)(a(111010).D,{styleKey:"bodySmSemibold",colorVariant:"primary",children:n.name??"Unnamed Workspace"}):s?(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Details unavailable"}):(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Loading details…"}),u?(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:n.isDeleted?"red":"green",colorVariant:"accentPrimary",children:n.isDeleted?"Deleted":"Active"}):void 0,u&&null!=(l=n.billing)&&l.planType?(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:n.billing.planType}):void 0,u&&(null==(d=n.billing)?void 0:d.isSalesAssisted)!==void 0?(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:n.billing.isSalesAssisted?"purple":"blue",colorVariant:"accentPrimary",children:n.billing.isSalesAssisted?B:L}):void 0,(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:`Role: ${_[h]}`})]}),(0,r.jsxs)(a(4458).fI,{gap:16,alignItems:"center",children:[(0,r.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",style:U.detailsLabel,children:"Space ID"}),(0,r.jsx)(a(799615).B,{value:e,formatUuid:!0,children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:(0,r.jsx)(a(137691).x5,{value:e})})})]}),u&&null!=(c=n.billing)&&null!=(c=c.stripeCustomerUrl)&&c.startsWith("https://dashboard.stripe.com/")?(0,r.jsx)("a",{href:n.billing.stripeCustomerUrl,target:"_blank",rel:"noopener noreferrer",style:U.providerLink,"aria-label":"Open in Stripe",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(a(748075).z,{})}):void 0,u&&null!=(p=n.billing)&&null!=(p=p.metronomeCustomerUrl)&&p.startsWith("https://app.metronome.com/")?(0,r.jsx)("a",{href:n.billing.metronomeCustomerUrl,target:"_blank",rel:"noopener noreferrer",style:U.providerLink,"aria-label":"Open in Metronome",onClick:e=>e.stopPropagation(),children:(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"accentPrimary",children:"Metronome"})}):void 0,(0,r.jsx)(a(988022).p,{size:"xs",onClick:m,iconTrailing:a(166568).arrowUpRightSquareSmallIcon,children:"Open in Workspace View"})]})]})})}function F(e){return Object.entries(e).map(([e,t])=>({spaceId:e,userRole:t.userRole}))}function K({title:e,entries:t,hydratedSpaces:n,failedSpaceIds:s,isFirst:o,isLast:l}){let[d,c]=(0,i.useState)(""),[p,m]=(0,i.useState)(20),u=(0,i.useCallback)(e=>{c(e),m(20)},[]),h=(0,i.useCallback)(()=>{m(e=>e+20)},[]),y=(0,i.useMemo)(()=>{let e;return(e=d.trim().toLowerCase())?t.filter(t=>{var a,i;let r=n[t.spaceId],s=((null==r?void 0:r.name)??"").toLowerCase(),o=t.spaceId.toLowerCase(),l=((null==r||null==(a=r.billing)?void 0:a.planType)??"").toLowerCase(),d=(null==r||null==(i=r.billing)?void 0:i.isSalesAssisted)===void 0?"":r.billing.isSalesAssisted?B.toLowerCase():L.toLowerCase(),c=_[(null==r?void 0:r.forUserRole)??t.userRole].toLowerCase();return s.includes(e)||o.includes(e)||l.includes(e)||d.includes(e)||c.includes(e)}):t},[t,n,d]),g=(0,i.useMemo)(()=>y.slice(0,p),[y,p]);return(0,r.jsx)(a(820517).P,{title:e,count:t.length,filteredCount:y.length,visibleCount:g.length,defaultExpanded:!1,onShowMore:h,isFirst:o,isLast:l,searchQuery:d,onSearchChange:u,children:g.map((e,t)=>(0,r.jsx)(W,{spaceId:e.spaceId,userRole:e.userRole,hydratedData:n[e.spaceId],hydrationFailed:s.has(e.spaceId),isLast:t===g.length-1},e.spaceId))})}function $({userId:e,spaces:t,leftSpaces:s,removedSpaces:o}){let l=(0,a(533992).v3)(),[d,c]=(0,i.useState)({}),[p,m]=(0,i.useState)(new Set),u=(0,i.useRef)(!0);(0,i.useEffect)(()=>()=>{u.current=!1},[]);let h=(0,i.useMemo)(()=>F(t),[t]),y=(0,i.useMemo)(()=>F(s),[s]),g=(0,i.useMemo)(()=>F(o),[o]),x=(0,i.useMemo)(()=>[...new Set([...h,...y,...g].map(e=>e.spaceId))],[h,y,g]);(0,i.useEffect)(()=>
106{if(0===x.length)return;let t=!1;return(async function(){for(let a=0;a<x.length;a+=5){if(t||!u.current)return;let i=x.slice(a,a+5),r=await Promise.allSettled(i.map(t=>{let a={spaceId:t,skipHydrateUsers:!0,skipGetSubscriptionData:!0,forUserId:e,__adminUISource:"unified_user_view"};return l.api.callApi({eventName:"adminSearchSpaces",environment:l,data:a})}));if(t||!u.current)return;let s={},o=[];for(let e=0;e<i.length;e++){let t=r[e];"fulfilled"===t.status&&"success"===t.value.type?s[i[e]]=t.value.data:(o.push(i[e]),(0,n().t)().log({level:"warning",from:"UserWorkspacesSection",type:"workspaceHydrationFailed",data:{spaceId:i[e]}}))}Object.keys(s).length>0&&c(e=>({...e,...s})),o.length>0&&m(e=>{let t=new Set(e);for(let e of o)t.add(e);return t})}})().catch(e=>{(0,n().t)().log({level:"warning",from:"UserWorkspacesSection",type:"hydrationFailed",error:(0,a(952977).convertErrorToLog)(e)})}),()=>{t=!0}},[x,l,e]);let f=h.length>0,b=y.length>0,v=g.length>0;return f||b||v?(0,r.jsxs)(a(4458).VP,{gap:0,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:E}),f?(0,r.jsx)(K,{title:"Current Workspaces",entries:h,hydratedSpaces:d,failedSpaceIds:p,isFirst:!0,isLast:!b&&!v}):void 0,b?(0,r.jsx)(K,{title:"Left Workspaces",entries:y,hydratedSpaces:d,failedSpaceIds:p,isFirst:!f,isLast:!v}):void 0,v?(0,r.jsx)(K,{title:"Removed or Hidden Workspaces",entries:g,hydratedSpaces:d,failedSpaceIds:p,isFirst:!f&&!b,isLast:!0}):void 0]}):(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:E}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"This user is not part of any workspaces."})]})}let O={card:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8}},z={adminWrap:(0,a(120308).pj)(),inputContainer:{maxWidth:400},searchCard:{...O.card,flex:1,minWidth:0},quickActionsCard:{...O.card,flex:1,minWidth:0},sectionCard:{...O.card}},G="Unified User View - Notion Admin",q="Unified User View",H=["Primary actions (e.g. login as user)","Account actions (e.g. reset password, change email)","Destructive actions (e.g. delete account)"],Z=["UUID, name, profile photo","Primary and linked emails","Account type and creation date","Latest device activity"];function J(e){return e.includes("@")}function Q(e){let t=new URL(window.location.href);e?J(e)?(t.searchParams.delete("userId"),t.searchParams.set("userEmail",e)):(t.searchParams.delete("userEmail"),t.searchParams.set("userId",e)):(t.searchParams.delete("userId"),t.searchParams.delete("userEmail")),window.history.replaceState(window.history.state,"",t.toString())}function Y(e){let t=(0,a(533992).v3)(),s=(0,a(743187).g)(),o=(0,a(47602).S)(s,"adminSearchUsers"),[l]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search);return e.get("userId")??e.get("userEmail")??""}),[c,p]=(0,i.useState)(l),[m,u]=(0,i.useState)(!1),[h,y]=(0,i.useState)(void 0),[g,x]=(0,i.useState)(void 0),f=(0,i.useRef)(!1),b=(0,i.useCallback)(async()=>{if(m)return;let e=c.trim();if(e){u(!0),y(void 0),x(void 0);try{let i={skipHydrateSpaces:!0,includeRemovedSpaces:!0,__adminUISource:"unified_user_view"},n=J(e)?{...i,userEmail:e}:(0,a(83388).iv)(e)?{...i,userId:(0,a(83388).G2)(e)}:{...i,userEmail:e},r=await t.api.callApi({eventName:"adminSearchUsers",environment:t,data:n});"success"===r.type?(x(r.data),Q(e)):y((0,a(201790).V4)(r))}catch(e){(0,n().t)().log({level:"warning",from:"UnifiedUserView",type:"searchFailed",error:(0,a(952977).convertErrorToLog)(e)}),y(e instanceof Error?e.message:"Failed to fetch user data")}finally{u(!1)}}},[t,m,c]);(0,i.useEffect)(()=>{l&&!0===o&&!f.current&&(f.current=!0,b())},[l,o,b]);let v=(0,i.useCallback)(()=>{b()},[b]),k=(0,i.useCallback)(e=>{p(e.target.value)},[]),S=(0,i.useCallback)(()=>{p(""),x(void 0),y(void 0),Q(void 0)},[]),w=void 0!==g||void 0!==h,I=void 0===g&&void 0===h;return void 0===o?(0,r.jsx)(a(45062).A,{title:G,children:(0,r.jsx)(a(220952).U,{currentSection:"unifiedUserView",children:(0,r.jsx)("div",{style:z.adminWrap,children:(0,r.jsx)(a(4458).fI,{padding:8,justifyContent:"center",children:(0,r.jsx)(a(517334).k,{size:"default"})})})})}):!1===o?(0,r.jsx)(a(45062).A,{title:G,children:(0,r.jsx)(a(220952).U,{currentSection:"unifiedUserView",children:(0,r.jsx)("div",{style:z.adminWrap,children:(0,r.jsx)(a(4458).fI,{padding:8,children:(0,r.jsx)("div",{style:z.searchCard,children:(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:q}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:'You don\'t have access to this tool. Contact your admin to request the "Find user and workspace information" permission.'})]})})})})})}):(0,r.jsx)(a(45062).A,{title:G,children:(0,r.jsx)(a(220952).U,{currentSection:"unifiedUserView",children:(0,r.jsxs)("div",{style:z.adminWrap,children:[(0,r.jsxs)(a(4458).fI,{gap:16,alignItems:"stretch",padding:8,children:[(0,r.jsx)("div",{style:z.searchCard,children:(0,r.jsxs)(a(4458).VP,{gap:16,children:[(0,r.jsxs)(a(4458).VP,{gap:4,children:[(0,r.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:q}),(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Search for user information by entering a user UUID or email address."})]}),(0,r.jsxs)(a(4458).VP,{gap:8,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"User UUID or Email"}),(0,r.jsx)("div",{style:z.inputContainer,children:(0,r.jsx)(a(287562).p,{value:c,onChange:k,placeholder:"Enter a user UUID or email address",focusInitial:!0,onSubmit:v,showClearButton:!0,onClearButtonClick:S})}),(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Enter the UUID or email address of the user you want to look up."})]}),(0,r.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,r.jsx)(a(912946).j,{onClick:v,disabled:!c.trim()||m,children:m?"Searching...":"Search"}),w?(0,r.jsx)(a(548436).A,{onClick:S,children:"Clear"}):void 0,m?(0,r.jsx)(a(517334).k,{size:"sm"}):void 0]}),h?(0,r.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:h}):void 0]})}
106),g?(0,r.jsx)("div",{style:z.quickActionsCard,children:(0,r.jsx)(N,{data:g,permissionsStore:s})}):void 0,I?(0,r.jsx)(a(4458).VP,{flex:1,minWidth:0,children:(0,r.jsx)(a(554577).A,{title:"Quick Actions",description:"Admin tools scoped to this user, categorized by type.",items:H})}):void 0]}),I?(0,r.jsxs)(a(4458).VP,{gap:8,paddingTop:0,paddingBottom:8,paddingInlineStart:8,paddingInlineEnd:8,children:[(0,r.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"What you'll see after searching"}),(0,r.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Each section below loads once you search for a user."}),(0,r.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",children:[(0,r.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,r.jsx)(a(554577).A,{title:"Workspaces",description:"All workspaces this user belongs to, has left, or was removed from — with their roles."}),(0,r.jsx)(a(554577).A,{title:"General Information",description:"Core user profile, emails, auth providers, and recent device activity.",items:Z})]}),(0,r.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,r.jsx)(a(554577).A,{title:"Related Lookups",description:"Open deeper admin lookups (permissions, notifications, etc.) pre-filled for this user."}),(0,r.jsx)(a(554577).A,{title:"User Notes",description:"Internal support notes attached to this user — read, add, or edit."}),(0,r.jsx)(a(554577).A,{title:"Admin Actions Log",description:"Audit log of admin tools that have been run against this user."})]})]})]}):void 0,g?(0,r.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",paddingTop:0,paddingBottom:8,paddingInlineStart:8,paddingInlineEnd:8,children:[(0,r.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,r.jsx)("div",{style:z.sectionCard,children:(0,r.jsx)($,{userId:g.id,spaces:g.spaces,leftSpaces:g.leftSpaces,removedSpaces:g.removedSpaces},g.id)}),(0,r.jsx)("div",{style:z.sectionCard,children:(0,r.jsx)(D,{data:g})})]}),(0,r.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,r.jsx)(a(949130).n,{entityId:g.id,permissionsStore:s}),(0,r.jsx)(V,{data:g,permissionsStore:s}),(0,r.jsx)("div",{style:z.sectionCard,children:(0,r.jsx)(d,{userId:g.id,permissionsStore:s})}),(0,r.jsx)("div",{style:z.sectionCard,children:(0,r.jsx)(j,{userId:g.id,viewedUser:g,permissionsStore:s})})]})]}):void 0]})})})}},674848(e,t,a){a(635790);var i=a(440302);let n=(0,a(327219).YK)({modalAriaLabel:{id:"adminToolModal.ariaLabel",defaultMessage:"{toolName} - Admin Tool"}}),r={modalContent:{padding:24,backgroundColor:a(632079).Tj.background.primary,maxHeight:"70vh",overflowY:"auto"},header:{marginBottom:16,paddingBottom:16,borderBottom:`1px solid ${a(632079).Tj.border.primary}`}};function s({isOpen:e,onDismiss:t,toolName:o,displayName:l,spaceId:d,hasPermission:c,additionalParams:p,source:m="unified_workspace_view"}){let u,h=(0,a(327219).tz)();if(!o)return null;let y=a(688211)._P[o];if(!y)return null;let g={...(u={},"spaceId"in y.schema&&d&&(u.spaceId=d),u),...p},x={api:y,defaultParams:g,showDefaultParams:!0,showByDefault:!0,hasPermission:c,source:m};return(0,i.jsx)(a(943365).s,{isOpen:e&&!0===c,onDismiss:t,ariaLabel:h.formatMessage(n.modalAriaLabel,{toolName:l}),areaConstraint:{width:{type:"range",min:500,max:700}},children:()=>(0,i.jsx)("div",{style:r.modalContent,children:(0,i.jsxs)(a(4458).VP,{gap:0,children:[(0,i.jsx)("div",{style:r.header,children:(0,i.jsx)(a(111010).D,{styleKey:"titleSemibold",colorVariant:"primary",children:l})}),(0,i.jsx)(a(869589).RE,{...x})]})})})}a.d(t,{v:()=>s})},143855(e,t,a){a(635790);var i=a(440302);let n={divider:{height:1,backgroundColor:a(632079).Tj.border.primary,marginTop:16,marginBottom:16}};function r(){return(0,i.jsx)("div",{style:n.divider})}a.d(t,{c:()=>r})},135744(e,t,a){a(635790);var i=a(440302);let n={minWidth:120},r={minWidth:180};function s({label:e,value:t,copyValue:o,labelWidth:l="default"}){let d=o??t;return(0,i.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,i.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:"wide"===l?r:n,children:e}),(0,i.jsx)(a(799615).B,{value:d,children:(0,i.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t})})]})}a.d(t,{B:()=>s})},458482(e,t,a){a(635790);var i=a(440302);let n={marginBottom:8};function r({title:e}){return(0,i.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",style:n,children:e})}a.d(t,{F:()=>r})},123093(e,t,a){a.r(t),a.d(t,{UnifiedWorkspaceView:()=>eP,mergeMembershipData:()=>eA}),a(533958),a(730330),a(321577),a(176765),a(851344),a(866491);var i=a(635790);a(159952);var n=a(440302);let r="Account Notes",s={sectionTitle:{marginBottom:12},notesList:{maxHeight:600,overflowY:"auto"},noteEntry:{paddingTop:10,paddingBottom:10,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},charCount:{textAlign:"end"},emptyState:{padding:8}};function o({onSubmit:e,isSubmitting:t}){let[r,l]=(0,i.useState)(""),d=r.length,c=d>1e3,p=d>=800&&!c,m=r.trim().length>0&&!c&&!t,u=(0,i.useCallback)(async()=>{m&&(await e(r),l(""))},[m,e,r]),h=(0,i.useCallback)(e=>{l(e.target.value)},[]),y=(0,i.useCallback)(()=>{l("")},[]);return(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(287562).p,{textarea:!0,textareaSubmitOnEnter:!1,autosize:!0,autosizeMinHeight:50,value:r,onChange:h,onClearButtonClick:y,showClearButton:r.length>0,placeholder:"Add a note about this workspace…",maxlength:1e3}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",children:[(0,n.jsx)("div",{style:s.charCount,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:c||p?"primary":"tertiary",colorPalette:c?"red":p?"orange":void 0,children:[d," / ",1e3]})}),(0,n.jsx)(a(912946).j,{size:"sm",onClick:u,disabled:!m,children:t?"Posting...":"Post"})]})]})}function l({note:e,isAuthor:t,onArchive:r,isArchiving:o}){let d=(0,i.useCallback)(()=>{r(e.id)},[r,e.id]);return(0,n.jsx)("div",{style:s.noteEntry,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:e.createdByEmail}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:new Date(e.createdTime).toLocaleStr
106ing(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),t?(0,n.jsx)(a(548436).A,{size:"xs",onClick:d,disabled:o,children:o?"Archiving...":"Archive"}):void 0]}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.noteText})]})})}function d({data:e,permissionsStore:t}){let c=(0,a(533992).v3)(),p=(0,a(83388).G2)(e.id),m=c.currentUser.id,u=(0,a(47602).S)(t,"adminListEntityNotes"),h=(0,i.useRef)(!0);(0,i.useEffect)(()=>()=>{h.current=!1},[]);let[y,g]=(0,i.useState)([]),[x,f]=(0,i.useState)(!1),[b,v]=(0,i.useState)(!1),[j,k]=(0,i.useState)(void 0),[S,w]=(0,i.useState)(void 0),I=(0,i.useCallback)(async()=>{if(h.current){f(!0),w(void 0);try{let e=await c.api.callApi({eventName:"adminListEntityNotes",environment:c,data:{entityType:"workspace",entityId:p,__adminUISource:"unified_workspace_view"}});h.current&&("success"===e.type?g(e.data.notes):w("Failed to load notes"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"AccountNotesSection",type:"notesLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),h.current&&w("Failed to load notes")}finally{h.current&&f(!1)}}},[c,p]);(0,i.useEffect)(()=>{!1!==u&&void 0!==u&&I()},[I,u]);let C=(0,i.useCallback)(async e=>{v(!0),w(void 0);try{let t=await c.api.callApi({eventName:"adminCreateEntityNote",environment:c,data:{entityType:"workspace",entityId:p,spaceId:p,noteText:e,__adminUISource:"unified_workspace_view"}});h.current&&("success"===t.type?await I():w("Failed to create note"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"AccountNotesSection",type:"noteCreateFailed",error:(0,a(952977).convertErrorToLog)(e)}),h.current&&w("Failed to create note")}finally{h.current&&v(!1)}},[c,p,I]),D=(0,i.useCallback)(async e=>{k(e),w(void 0);try{let t=await c.api.callApi({eventName:"adminArchiveEntityNote",environment:c,data:{noteId:e,entityType:"workspace",entityId:p,__adminUISource:"unified_workspace_view"}});h.current&&("success"===t.type?await I():w("Failed to archive note"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"AccountNotesSection",type:"noteArchiveFailed",error:(0,a(952977).convertErrorToLog)(e)}),h.current&&w("Failed to archive note")}finally{h.current&&k(void 0)}},[c,p,I]);return void 0===u?(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:s.sectionTitle,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:r})}),(0,n.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,n.jsx)(a(517334).k,{size:"sm"})})]}):!1===u?(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:s.sectionTitle,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:r})}),(0,n.jsx)("div",{style:s.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"You don't have access to view account notes"})})]}):(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:s.sectionTitle,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:r})}),(0,n.jsx)(o,{onSubmit:C,isSubmitting:b}),S?(0,n.jsx)(a(4458).fI,{padding:4,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:S})}):void 0,(0,n.jsx)("div",{style:s.notesList,children:x?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading notes..."})]}):y.length>0?(0,n.jsx)(a(4458).VP,{gap:0,children:y.map(e=>(0,n.jsx)(l,{note:e,isAuthor:e.createdById===m,onArchive:D,isArchiving:j===e.id},e.id))}):(0,n.jsx)("div",{style:s.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No notes yet. Add a note about this workspace above."})})})]})}let c={container:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,padding:16},sectionHeader:{cursor:"pointer",userSelect:"none"},chevron:{transition:"transform 100ms ease"},chevronExpanded:{transform:"rotateZ(90deg)"},labelColumn:{minWidth:180},externalLink:{color:a(632079).Tj.text.accentPrimary,textDecoration:"none",cursor:"pointer",whiteSpace:"nowrap",fontSize:14}},p="Billing & Subscription",m="Stripe Customer",u="Metronome Customer";function h({data:e}){let t=(0,a(533992).v3)(),{isExpanded:r,toggleExpansion:s}=(0,a(714289).J)({title:p,defaultExpanded:!1}),[o,l]=(0,i.useState)(void 0),[d,y]=(0,i.useState)(void 0),[g,x]=(0,i.useState)(!1),[f,b]=(0,i.useState)(!1),[v,j]=(0,i.useState)(void 0),[k,S]=(0,i.useState)(void 0),{billing:w}=e,I=(0,a(83388).G2)(e.id),C=(0,i.useCallback)(async(e,i)=>{x(!0),j(void 0);try{let a=await t.api.callApi({eventName:"adminGetTrial",environment:t,data:{spaceId:e,__adminUISource:"unified_workspace_view"}});i.value&&("success"===a.type?l(a.data):j("Failed to load trial data"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"BillingSubscriptionSection",type:"trialDataLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),i.value&&j("Failed to load trial data")}finally{i.value&&x(!1)}},[t]),D=(0,i.useCallback)(async(e,i)=>{b(!0),S(void 0);try{let a=await t.api.callApi({eventName:"adminGetSubscriptionBannerState",environment:t,data:{spaceId:e,__adminUISource:"unified_workspace_view"}});i.value&&("success"===a.type?y(a.data):S("Failed to load banner data"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"BillingSubscriptionSection",type:"bannerDataLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),i.value&&S("Failed to load banner data")}finally{i.value&&b(!1)}},[t]);(0,i.useEffect)(()=>
106{if(!r)return;l(void 0),y(void 0);let e={value:!0};return C(I,e),D(I,e),()=>{e.value=!1}},[r,I,C,D]);let T=(0,i.useCallback)(e=>void 0===e?"N/A":"desynced"===e?"Desynced":String(e),[]),R=w.isSubscribed,A=(0,i.useMemo)(()=>{if(w.addOns&&0!==w.addOns.length)return w.addOns},[w.addOns]);return(0,n.jsxs)("div",{style:c.container,children:[(0,n.jsx)("div",{style:c.sectionHeader,onClick:s,role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),s())},"aria-expanded":r,children:(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(16275).I,{icon:a(342392).arrowChevronSingleRightIcon,size:"sm",colorVariant:"secondary",style:{...c.chevron,...r?c.chevronExpanded:void 0}}),(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:p})]})}),r?(0,n.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,n.jsx)(a(458482).F,{title:"Plan Details"}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Plan",value:w.plan??"N/A",copyValue:w.plan}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Plan Type",value:w.planType??"N/A"}),w.subscriptionTier?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Subscription Tier",value:w.subscriptionTier}):void 0,(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Billing Type",value:w.billing??"N/A"}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Billing Email",value:w.billingEmail??"N/A",copyValue:w.billingEmail}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:c.labelColumn,children:"Status"}),(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:4,children:[(0,n.jsx)("span",{"aria-hidden":!0,children:R?"✅":"❌"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:R?"secondary":"accentPrimary",colorPalette:R?void 0:"red",children:R?"Subscribed":"Not Subscribed"})]})]}),w.activeSubscriptionPlatform?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Platform",value:w.activeSubscriptionPlatform}):void 0,A?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:c.labelColumn,children:"Add-ons"}),(0,n.jsx)(a(4458).VP,{gap:4,children:A.map(e=>(0,n.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:[e.feature," (",e.billingInterval,")"]},`${e.feature}-${e.billingInterval}`))})]}):void 0,(0,n.jsx)(a(143855).c,{}),(0,n.jsx)(a(458482).F,{title:"Usage & Limits"}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Current High Water",value:T(w.currentHighWaterMark)}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"End of Day High Water",value:T(w.endOfDayHighWaterMark)}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Next Billing Period HWM",value:void 0!==w.nextBillingPeriodHighWaterMark?String(w.nextBillingPeriodHighWaterMark):"N/A"}),(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Has Paid",value:w.hasPaidNonzero?"Yes":"No"}),(0,n.jsx)(a(143855).c,{}),(0,n.jsx)(a(458482).F,{title:"Stripe"}),w.stripeCustomerId?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:c.labelColumn,children:m}),(0,n.jsx)(a(799615).B,{value:w.stripeCustomerId,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,n.jsx)(a(137691).x5,{value:w.stripeCustomerId})})}),w.stripeCustomerUrl?(0,n.jsx)("a",{href:w.stripeCustomerUrl,target:"_blank",rel:"noopener noreferrer",style:c.externalLink,children:(0,n.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:["Stripe",(0,n.jsx)(a(16275).I,{icon:a(213458).arrowUpRightSquareIcon,size:"sm",colorVariant:"accentPrimary"})]})}):void 0]}):(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:m,value:"N/A"}),null!==w.accountBalance&&void 0!==w.accountBalance?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Account Balance",value:w.accountBalance}):void 0,(0,n.jsx)(a(143855).c,{}),(0,n.jsx)(a(458482).F,{title:"Metronome"}),w.metronomeCustomerId?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:c.labelColumn,children:u}),(0,n.jsx)(a(799615).B,{value:w.metronomeCustomerId,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,n.jsx)(a(137691).x5,{value:w.metronomeCustomerId})})}),w.metronomeCustomerUrl?(0,n.jsx)("a",{href:w.metronomeCustomerUrl,target:"_blank",rel:"noopener noreferrer",style:c.externalLink,children:(0,n.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:["Metronome",(0,n.jsx)(a(16275).I,{icon:a(213458).arrowUpRightSquareIcon,size:"sm",colorVariant:"accentPrimary"})]})}):void 0]}):(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:u,value:"N/A"}),(0,n.jsx)(a(143855).c,{}),(0,n.jsx)(a(458482).F,{title:"Trial Status"}),g?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading trial data..."})]}):v?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"primary",children:v}):o?(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:o.activeTrialStatus}),o.historicalTrialDescription?(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:o.historicalTrialDescription}):void 0]}):(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No trial data available"}),(0,n.jsx)(a(143855).c,{}),(0,n.jsx)(a(458482).F,{title:"Banner State"}),f?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading banner data..."})]}):k?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"primary",children:k}):d?(0,n.jsxs)(a(4458).VP,{gap:4,children:[d.banner.bannerType?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Banner Type",value:d.banner.bannerType}):(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No active banner"}),d.banner.bannerKey?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Banner Key",value:d.banner.bannerKey}):void 0,d.banner.overdueReason?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Overdue Reason",value:d.banner.overdueReason}):void 0,void 0!==d.banner.overdueInvoiceCount?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Overdue Invoices",value:String(d.banner.overdueInvoiceCount)}):void 0,d.banner.invoiceHostedUrl?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:c.labelColumn,children:"Invoice URL"}),(0,n.jsx)("a",{href:d.banner.invoiceHostedUrl,target:"_blank",rel:"noopener noreferrer",style:c.externalLink,children:(0,n.jsxs)(a(4458).fI,{gap:4,alignItems:"center",children:["View Invoice",(0,n.jsx)(a(16275).I,{icon:a(213458).arrowUpRightSquareIcon,size:"sm",colorVariant:"accentPrimary"})]})})]}):void 0,d.banner.bannerText?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:c.labelColumn,children:"Banner Text"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:d.banner.bannerText})]}):void 0,void 0!==d.banner.editsBlocked?(0,n.jsx)(a(135744).B,{labelWidth:"wide",label:"Edits Blocked",value:d.banner.editsBlocked?"Yes":"No"}):void 0]}):(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"No banner data available"})]}):void 0]})}let y="AI geographic restrictions",g={container:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8},sectionHeader:{cursor:"pointer",userSelect:"none"},chevron:{transition:"transform 100ms ease"},chevronExpanded:{transform:"rotateZ(90deg)"},badge:{borderRadius:999,padding:"4px 10px",whiteSpace:"nowrap"},badgeRestricted:{backgroundColor:a(632079).Tj.red.background.primary},badgeClear:{backgroundColor:a(632079).Tj.green.background.primary},badgeWarning:{backgroundColor:a(632079).Tj.yellow.background.primary},badgeNeutral:{backgroundColor:a(632079).Tj.background.tertiaryTranslucent},separator:{borderTop:`1px solid ${a(632079).Tj.border.secondary}`}};function x({spaceId:e,permissionsStore:t}){let r=(0,a(533992).v3)(),s=(0,a(47602).S)(t,"adminGetWorkspaceModelRestrictions"),[o,l]=(0,i.useState)(void 0),[d,c]=(0,i.useState)(!1),[p,m]=(0,i.useState)(!1),[u,h]=(0,i.useState)(!1),v=(0,i.useCallback)(()=>{h(e=>!e)},[]),j=(0,i.useCallback)(e=>
106{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),v())},[v]);return((0,i.useEffect)(()=>{if(!0!==s)return;let t=!1;return l(void 0),m(!1),c(!0),async function(){try{let i=await r.api.callApi({eventName:"adminGetWorkspaceModelRestrictions",environment:r,data:{spaceId:e,__adminUISource:"unified_workspace_view"}});if(t)return;"success"===i.type?l(i.data.geoRestriction):((0,a(208318).t)().log({level:"warning",from:"GeoRestrictionsSection",type:"workspaceGeoRestrictionNonSuccess",error:{message:i.type}}),m(!0))}catch(e){(0,a(208318).t)().log({level:"warning",from:"GeoRestrictionsSection",type:"workspaceGeoRestrictionLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),t||m(!0)}finally{t||c(!1)}}(),()=>{t=!0}},[r,s,e]),!0!==s)?null:(0,n.jsx)("div",{style:g.container,children:(0,n.jsxs)(a(4458).VP,{gap:12,children:[(0,n.jsx)("div",{style:g.sectionHeader,onClick:v,onKeyDown:j,role:"button",tabIndex:0,"aria-label":y,"aria-expanded":u,children:(0,n.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,children:[(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,children:[(0,n.jsx)(a(16275).I,{icon:a(491469).arrowChevronSingleRightSmallIcon,size:"sm",colorVariant:"secondary",style:{...g.chevron,...u?g.chevronExpanded:void 0}}),(0,n.jsxs)(a(4458).VP,{gap:2,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:y}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Billing-country provider policy"})]})]}),o?(0,n.jsx)(f,{status:o.status}):void 0,d?(0,n.jsx)(a(517334).k,{size:"sm"}):void 0]})}),u&&p?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:"Unable to load geographic restrictions."}):void 0,u&&o?(0,n.jsx)(b,{restriction:o}):void 0]})})}function f(e){let{status:t}=e,i="restricted"===t?"red":"not_restricted"===t?"green":"billing_country_unknown"===t?"yellow":void 0,r="red"===i?g.badgeRestricted:"green"===i?g.badgeClear:"yellow"===i?g.badgeWarning:g.badgeNeutral;return(0,n.jsx)("span",{style:{...g.badge,...r},children:(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorPalette:i,colorVariant:void 0===i?"secondary":"accentPrimary",children:function(e){switch(e){case"restricted":return"Restricted";case"not_restricted":return"Not restricted";case"billing_country_unknown":return"Unknown country";case"billing_unavailable":return"Billing unavailable";case"policy_unavailable":return"Policy unavailable"}}(t)})})}function b(e){var t,i,r,s,o,l,d,c,p,m,u;let{restriction:h}=e,y=(null==(t=h.rule)?void 0:t.mode)??("enforce"!==h.policyMode||h.rolloutEnabled?h.policyMode:"shadow"),x=(null==(i=h.rule)?void 0:i.disallow)??(null==(r=h.rule)?void 0:r.onlyAllow),f=null!=(s=h.rule)&&s.disallow?"Restricted":"Allowed";return(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(135744).B,{label:"Billing country",value:h.billingCountry&&"unknown"!==h.billingCountry?h.billingCountry:"Unknown"}),(0,n.jsx)(a(135744).B,{label:"Policy mode",value:v(h.policyMode)}),(0,n.jsx)(a(135744).B,{label:"Effective mode",value:v(y)}),(0,n.jsx)(a(135744).B,{label:"Enforcement rollout",value:void 0===h.rolloutEnabled?"Unavailable":h.rolloutEnabled?"Enabled":"Disabled"}),h.policyVersion?(0,n.jsx)(a(135744).B,{label:"Policy version",value:h.policyVersion}):void 0,x?(0,n.jsxs)(a(4458).VP,{gap:8,paddingTop:12,style:g.separator,children:[null!=(o=x.providers)&&o.length?(0,n.jsx)(a(135744).B,{label:`${f} providers`,value:x.providers.join(", ")}):void 0,null!=(l=x.modelFamilies)&&l.length?(0,n.jsx)(a(135744).B,{label:`${f} families`,value:x.modelFamilies.join(", ")}):void 0,null!=(d=x.models)&&d.length?(0,n.jsx)(a(135744).B,{label:`${f} models`,value:x.models.join(", ")}):void 0,null==(c=h.rule)||!c.onlyAllow||null!=(p=x.providers)&&p.length||null!=(m=x.modelFamilies)&&m.length||null!=(u=x.models)&&u.length?void 0:(0,n.jsx)(a(135744).B,{label:"Allowed models",value:"None"})]}):void 0]})}function v(e){return void 0===e?"Unavailable":"enforce"===e?"Enforcing":"Shadow"}a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(976614);let j=(0,a(327219).YK)({sectionTitle:{id:"quickActionsSection.title",defaultMessage:"Quick Actions"},noWorkspaceSelected:{id:"quickActionsSection.noWorkspaceSelected",defaultMessage:"No workspace selected."},noPermissions:{id:"quickActionsSection.noPermissions",defaultMessage:"You don’t have permission to use any quick actions."},loadingPermissions:{id:"quickActionsSection.loadingPermissions",defaultMessage:"Loading available actions…"}
106,categorySubscriptionBilling:{id:"quickActionsSection.category.subscriptionBilling",defaultMessage:"Subscription & Billing"},categoryWorkspaceOperations:{id:"quickActionsSection.category.workspaceOperations",defaultMessage:"Workspace Operations"},categoryRecoveryRestore:{id:"quickActionsSection.category.recoveryRestore",defaultMessage:"Recovery & Restore"},categoryExperiments:{id:"quickActionsSection.category.experiments",defaultMessage:"Experiments"}}),k=[{titleMessageKey:"categorySubscriptionBilling",actions:[{toolName:"adminSetHighWaterMark",displayName:"Set High Water Mark"},{toolName:"adminSyncBillingState",displayName:"Sync Billing State"},{toolName:"adminSetSalesAssistedSubscriptionBanner",displayName:"Set Banner"},{toolName:"adminUpdateSubscriptionBusinessEnterprise",displayName:"Upgrade to Business/Enterprise"},{toolName:"adminUpsertTrial",displayName:"Manage Trial"},{toolName:"adminGetOrCreateStripeCustomer",displayName:"Get or Create Stripe Customer"},{toolName:"adminGetProcessedSpaceMembershipUpdates",displayName:"View Historical Processed Space Membership Updates"}]},{titleMessageKey:"categoryWorkspaceOperations",actions:[{toolName:"adminGetWorkspaceModelRestrictions",displayName:"View AI Model & Geo Restrictions"},{toolName:"adminGetPremiumFeatureAvailabilities",displayName:"View Premium Feature Availability"},{toolName:"adminListAIConnectors",displayName:"List AI Connectors for Space"},{toolName:"adminAIConnectorS3Inspect",displayName:"AI Connector Debug Query"},{toolName:"adminUpdateNotionAIAvailabilityForSpace",displayName:"Update AI Availability"},{toolName:"adminClaimAndUpgradeForSalesAssisted",displayName:"Claim & Upgrade"},{toolName:"adminStartWorkspaceMigration",displayName:"Schedule Migration"},{toolName:"adminClearFreeChartsForSpace",displayName:"Clear Free Charts",isDestructive:!0}]},{titleMessageKey:"categoryRecoveryRestore",actions:[{toolName:"recoverSpace",displayName:"Recover Workspace",isDestructive:!0},{toolName:"adminEditSpacePermissions",displayName:"Edit Permissions",isDestructive:!0},{toolName:"adminRecoverUserContentInSpace",displayName:"Recover User Content"}]},{titleMessageKey:"categoryExperiments",actions:[{toolName:"adminGetStatsigExperiment",displayName:"Get Experiment Group"},{toolName:"adminGetStatsigFeatureGate",displayName:"Get Feature Gate"}]}],S={marginBottom:16},w={marginBottom:16},I={marginBottom:8},C={padding:8};function D({data:e,permissionsStore:t}){let r=(0,a(327219).tz)(),[s,o]=(0,i.useState)(void 0),l=e.id,d=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=t.state;return void 0===e?new Set:new Set(Object.values(a(688211)._P).filter(t=>(0,a(688211).qO)(t)&&e.has(t.apiName)).map(e=>e.apiName))},[t]),{permissionsLoaded:c,permissionsErrored:p}=(0,a(579993).K8)(()=>{let{currentUserPermissions:e,fetchPermissionsErrored:a}=t.state;return{permissionsLoaded:void 0!==e,permissionsErrored:a}},[t]),m=(0,i.useCallback)(e=>{o({toolName:e.toolName,displayName:e.displayName})},[]),u=(0,i.useCallback)(()=>{o(void 0)},[]),h=(0,i.useMemo)(()=>c?k.map(e=>({...e,actions:e.actions.filter(e=>d.has(e.toolName))})).filter(e=>e.actions.length>0):[],[d,c]),y=h.length>0;return l?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:S,children:(0,n.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:r.formatMessage(j.sectionTitle)})}),c||p?y?(0,n.jsx)(a(4458).VP,{gap:0,children:h.map(e=>(0,n.jsxs)("div",{style:w,children:[(0,n.jsx)("div",{style:I,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:r.formatMessage(j[e.titleMessageKey])})}),(0,n.jsx)(a(4458).fI,{flexWrap:"wrap",gap:8,children:e.actions.map(e=>(0,n.jsx)(a(548436).A,{onClick:()=>{m(e)},colorPalette:e.isDestructive?"red":void 0,children:e.displayName},e.toolName))})]},e.titleMessageKey))}):(0,n.jsx)("div",{style:C,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:r.formatMessage(j.noPermissions)})}):(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:r.formatMessage(j.loadingPermissions)})]})]}),(0,n.jsx)(a(674848).v,{isOpen:void 0!==s,onDismiss:u,toolName:null==s?void 0:s.toolName,displayName:(null==s?void 0:s.displayName)??"",spaceId:l,hasPermission:s?d.has(s.toolName):void 0})]}):(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:r.formatMessage(j.sectionTitle)}),(0,n.jsx)("div",{style:C,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:r.formatMessage(j.noWorkspaceSelected)})})]})}let T=(0,a(48697).objectKeys)(a(420667).G);function R(e){if(e)return Date.parse(`${e}T00:00:00.000Z`)}let A={sectionTitle:{marginBottom:12},tabBar:{display:"flex",gap:0,borderBottom:`1px solid ${a(632079).Tj.border.primary}`,marginBottom:12},tab:{paddingTop:8,paddingBottom:8,paddingInlineStart:12,paddingInlineEnd:12,cursor:"pointer",background:"none",border:"none",borderBottom:"2px s
106olid transparent",font:"inherit",color:a(632079).Tj.text.secondary},tabActive:{paddingTop:8,paddingBottom:8,paddingInlineStart:12,paddingInlineEnd:12,cursor:"pointer",background:"none",border:"none",font:"inherit",borderBottom:`2px solid ${a(632079).Tj.text.primary}`,color:a(632079).Tj.text.primary},filterRow:{marginBottom:12},filterSelect:{padding:"4px 8px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.primary}`,background:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary,font:"inherit",fontSize:13},tabContent:{maxHeight:600,overflowY:"auto"},activityEntryClickable:{paddingTop:10,paddingBottom:10,borderBottom:`1px solid ${a(632079).Tj.border.secondary}`,cursor:"pointer"},activityTypeBadge:{display:"inline-block",paddingTop:2,paddingBottom:2,paddingInlineStart:6,paddingInlineEnd:6,borderRadius:4,backgroundColor:a(632079).Tj.background.tertiary,fontSize:11,fontFamily:"monospace",whiteSpace:"nowrap"},emptyState:{padding:8},editDescription:{maxWidth:400,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},expandedPageInfo:{wordBreak:"break-all"},lookupButton:{cursor:"pointer",background:"none",border:"none",padding:2,display:"inline-flex",alignItems:"center",borderRadius:4}};function N({message:e}){return(0,n.jsx)("div",{style:A.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:e})})}function M({message:e}){return(0,n.jsx)("div",{style:A.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"primary",children:e})})}function P(e){e.stopPropagation()}function V({page:e,hasBlockLookupPermission:t,onLookup:i}){return(0,n.jsxs)(a(4458).VP,{gap:2,style:A.expandedPageInfo,onClick:P,children:[(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.title??"Untitled"}),!0===t?(0,n.jsx)("button",{type:"button",style:A.lookupButton,onClick:()=>i(e.id),"aria-label":`Look up block ${e.title??e.id}`,children:(0,n.jsx)(a(16275).I,{icon:a(166568).arrowUpRightSquareSmallIcon,size:"sm",colorVariant:"accentPrimary"})}):void 0]}),(0,n.jsx)(a(799615).B,{value:e.id,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:e.id})})]})}function E({spaceId:e,permissionsStore:t}){let r=(0,a(533992).v3)(),s=(0,a(47602).S)(t,"adminSearchSpaceActivity"),o=(0,a(47602).S)(t,"adminSearchBlocks"),[l,d]=(0,i.useState)([]),[c,p]=(0,i.useState)(!1),[m,u]=(0,i.useState)(!1),[h,y]=(0,i.useState)(void 0),[g,x]=(0,i.useState)(""),[f,b]=(0,i.useState)(""),[v,j]=(0,i.useState)(""),[k,S]=(0,i.useState)(!1),[w,I]=(0,i.useState)(void 0),[C,D]=(0,i.useState)(new Set),[R,P]=(0,i.useState)(void 0),B=(0,i.useRef)(0),L=(0,i.useCallback)(()=>{P(void 0)},[]),_=(0,i.useCallback)(e=>{D(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),U=(0,i.useCallback)(async t=>{let{filterType:i,startDate:n,endDate:s,startingAfterId:o,replace:l}=t,c=B.current+1;if(B.current=c,n&&s&&n>s){c===B.current&&(y("Start date must be before end date"),l&&(d([]),S(!1),I(void 0)),p(!1),u(!1));return}l?(d([]),D(new Set),S(!1),I(void 0),p(!0)):u(!0),y(void 0);let m={spaceId:e,limit:50,__adminUISource:"unified_workspace_view"};i&&(m.activityType=i),n&&(m.startDate=n.slice(2)),s&&(m.endDate=s.slice(2)),o&&(m.startingAfterId=o);try{let e=await r.api.callApi({eventName:"adminSearchSpaceActivity",environment:r,data:m});c===B.current&&("success"===e.type?(d(t=>l?e.data.activities:[...t,...e.data.activities]),S(e.data.hasMore),I(e.data.nextStartingAfterId)):((0,a(208318).t)().log({level:"warning",from:"RecentActivitySection",type:"workspaceActivityNonSuccess",error:{message:e.type}}),y("Failed to load workspace activity")))}catch(e){(0,a(208318).t)().log({level:"warning",from:"RecentActivitySection",type:"workspaceActivityLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),c===B.current&&y("Failed to load workspace activity")}finally{c===B.current&&(p(!1),u(!1))}},[e,r]);(0,i.useEffect)(()=>{if(!0===s)return U({filterType:g,startDate:f,endDate:v,replace:!0}),()=>{B.current+=1}},[U,g,f,v,s]);let W=(0,i.useCallback)(e=>{let t=e.target.value;""===t?x(""):(0,a(48697).Xk)(T,t)&&x(t)},[]),F=(0,i.useCallback)(e=>{b(e.target.value)},[]),K=(0,i.useCallback)(e=>{j(e.target.value)},[]),$=(0,i.useCallback)(()=>{k&&!m&&void 0!==w&&U({filterType:g,startDate:f,endDate:v,startingAfterId:w,replace:!1})},[g,v,U,k,m,w,f]);return void 0===s?(0,n.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,n.jsx)(a(517334).k,{size:"sm"})}):!1===s?(0,n.jsx)("div",{style:A.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"You don't have access to view workspace activity"})}):(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:A.filterRow,children:(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)("label",{htmlFor:"activity-type-filter",children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:"Activity type:"})}),(0,n.jsxs)("select",{id:"activity-type-filter",style:A.filterSelect,value:g,onChange:W,children:[(0,n.jsx)("option",{value:"",children:"All types"}),T.map(e=>(0,n.jsx)("option",{value:e,children:e},e))]})]}),(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)("input",{id:"activity-start-date",type:"date",style:A.filterSelect,value:f,onChange:F,"aria-label":"Start date"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"—"}),(0,n.jsx)("input",{id:"activity-end-date",type:"date",style:A.filterSelect,value:v,onCh
106ange:K,"aria-label":"End date"})]})]})}),c?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading activity..."})]}):void 0,!c&&l.length>0?(0,n.jsx)(a(4458).VP,{gap:0,children:l.map(e=>{var t;let i=C.has(e.id);return(0,n.jsx)("div",{style:A.activityEntryClickable,onClick:()=>_(e.id),role:"button",tabIndex:0,onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),_(e.id))},children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"string"==typeof(t=e.time)?t:new Date(t).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}),(0,n.jsx)("span",{style:A.activityTypeBadge,children:e.type})]}),e.authors.length>0?(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["by ",e.authors.map(e=>e.email??e.id).join(", ")]}):void 0,e.edits.length>0?(0,n.jsx)("div",{style:A.editDescription,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:[e.edits.slice(0,3).map(e=>e.type).join(", ")," ","(",e.edits.length," ",1===e.edits.length?"edit":"edits",")"]})}):void 0,i&&void 0!==e.page?(0,n.jsx)(V,{page:e.page,hasBlockLookupPermission:o,onLookup:P}):void 0]})},e.id)})}):void 0,c||0!==l.length||h?void 0:(0,n.jsx)(N,{message:"No activity found"}),h?(0,n.jsx)(M,{message:h}):void 0,k?(0,n.jsx)(a(4458).fI,{justifyContent:"center",paddingBlock:8,children:(0,n.jsx)(a(988022).p,{size:"sm",onClick:$,disabled:m,children:m?"Loading...":"Load more"})}):void 0,(0,n.jsx)(a(674848).v,{isOpen:void 0!==R,onDismiss:L,toolName:"adminSearchBlocks",displayName:"Block Lookup",spaceId:e,hasPermission:o,additionalParams:R?{blockId:R}:void 0})]})}function B({spaceId:e,permissionsStore:t}){let r=(0,a(533992).v3)(),s=(0,a(47602).S)(t,"getSpaceAdminApiLog"),[o,l]=(0,i.useState)([]),[d,c]=(0,i.useState)(new Set),[p,m]=(0,i.useState)(!1),[u,h]=(0,i.useState)(void 0),[y,g]=(0,i.useState)(void 0),[x,f]=(0,i.useState)(""),[b,v]=(0,i.useState)(""),j=(0,i.useRef)(0),k=(0,i.useCallback)(async t=>{let{limit:i,eventName:n,startDate:s,endDate:o}=t,d=j.current+1;if(j.current=d,m(!0),h(void 0),l([]),s&&o&&s>o){h("Start date must be before end date"),m(!1);return}try{let t,a={spaceId:e,limit:i,eventName:n,startTime:R(s),endTime:(t=R(o),void 0===t?void 0:t+864e5),__adminUISource:"unified_workspace_view"},c=await r.api.callCellCompatibleApi({eventName:"getSpaceAdminApiLog",environment:r,data:a,cellNavigation:{spaceId:e}});d===j.current&&("success"===c.type?l(c.data.changes):h("Failed to load admin actions"))}catch(e){(0,a(208318).t)().log({level:"warning",from:"RecentActivitySection",type:"adminActionsLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),d===j.current&&h("Failed to load admin actions")}finally{d===j.current&&m(!1)}},[e,r]);(0,i.useEffect)(()=>{if(!0===s)return k({limit:25,eventName:y,startDate:x,endDate:b}),()=>{j.current+=1}},[b,y,k,s,x]);let S=(0,i.useCallback)(e=>{g(e)},[]),w=(0,i.useCallback)(e=>{f(e.target.value)},[]),I=(0,i.useCallback)(e=>{v(e.target.value)},[]),C=(0,i.useCallback)((t,i)=>{c(e=>{let a=new Set(e);return a.add(t),a});let n=j.current;(async()=>{try{let a=await r.api.callCellCompatibleApi({eventName:"getSpaceAdminApiLog",environment:r,data:{spaceId:e,operationRequestId:t,operationOffset:i,operationLimit:25,__adminUISource:"unified_workspace_view"},cellNavigation:{spaceId:e}});if(n!==j.current)return;if("success"!==a.type)return void h("Failed to load admin action operations");let s=a.data.changes[0];if(!s)return void h("Admin action is no longer available");l(e=>e.map(e=>{var a;if((null==(a=e.apiLog)?void 0:a.id)!==t)return e;let i=new Set(e.opLogs.map(e=>e.id)),n=s.opLogs.filter(e=>!i.has(e.id));return{...e,opLogs:[...e.opLogs,...n],opLogCount:s.opLogCount}}))}catch(e){(0,a(208318).t)().log({level:"warning",from:"RecentActivitySection",type:"adminActionOperationsLoadFailed",error:(0,a(952977).convertErrorToLog)(e)}),n===j.current&&h("Failed to load admin action operations")}finally{c(e=>{let a=new Set(e);return a.delete(t),a}
106)}})()},[r,e]);return void 0===s?(0,n.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,n.jsx)(a(517334).k,{size:"sm"})}):!1===s?(0,n.jsx)("div",{style:A.emptyState,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"You don't have access to view admin actions"})}):(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:A.filterRow,children:(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",children:[(0,n.jsx)(a(416236)._,{variant:"inlineSelect",onChange:S}),(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)("input",{id:"admin-actions-start-date",type:"date",style:A.filterSelect,value:x,onChange:w,"aria-label":"Start date"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"—"}),(0,n.jsx)("input",{id:"admin-actions-end-date",type:"date",style:A.filterSelect,value:b,onChange:I,"aria-label":"End date"})]})]})}),p?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:"Loading admin actions..."})]}):void 0,!p&&o.length>0?(0,n.jsx)(a(2081).k,{entries:o,onLoadMoreOperations:C,loadingOperationRequestIds:d}):void 0,p||0!==o.length||u?void 0:(0,n.jsx)(N,{message:"No admin actions found"}),u?(0,n.jsx)(M,{message:u}):void 0]})}function L({data:e,permissionsStore:t}){let[r,s]=(0,i.useState)("workspaceActivity"),o=(0,a(83388).G2)(e.id);return(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:A.sectionTitle,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Recent Activity"})}),(0,n.jsxs)("div",{style:A.tabBar,role:"tablist",children:[(0,n.jsx)("button",{type:"button",role:"tab","aria-selected":"workspaceActivity"===r,"aria-controls":"recent-activity-workspace-panel",style:"workspaceActivity"===r?A.tabActive:A.tab,onClick:()=>s("workspaceActivity"),children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"workspaceActivity"===r?"primary":"secondary",children:"Workspace Activity"})}),(0,n.jsx)("button",{type:"button",role:"tab","aria-selected":"adminActions"===r,"aria-controls":"recent-activity-admin-panel",style:"adminActions"===r?A.tabActive:A.tab,onClick:()=>s("adminActions"),children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"adminActions"===r?"primary":"secondary",children:"Admin Actions"})})]}),(0,n.jsx)("div",{style:A.tabContent,role:"tabpanel",id:"workspaceActivity"===r?"recent-activity-workspace-panel":"recent-activity-admin-panel",children:"workspaceActivity"===r?(0,n.jsx)(E,{spaceId:o,permissionsStore:t}):(0,n.jsx)(B,{spaceId:o,permissionsStore:t})})]})}let _=[{toolName:"adminGetBYOKCredentialHistory",displayName:"BYOK Credential History"},{toolName:"adminSearchBlocks",displayName:"Block Lookup"},{toolName:"adminReadBlockPermissions",displayName:"Page Permissions"},{toolName:"adminSearchTeams",displayName:"Teamspace Lookup"},{toolName:"adminSearchPermanentlyDeletedPages",displayName:"Find Deleted Pages"}],U={container:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8},sectionTitle:{marginBottom:8}};function W({data:e,permissionsStore:t}){let[r,s]=(0,i.useState)(void 0),o=e.id,l=(0,a(579993).K8)(()=>{let{currentUserPermissions:e}=t.state;return void 0===e?new Set:new Set(Object.values(a(688211)._P).filter(t=>(0,a(688211).qO)(t)&&e.has(t.apiName)).map(e=>e.apiName))},[t]),d=(0,a(579993).K8)(()=>void 0!==t.state.currentUserPermissions,[t]),c=(0,i.useMemo)(()=>d?_.filter(e=>l.has(e.toolName)):[],[l,d]),p=(0,i.useCallback)(e=>{s(e)},[]),m=(0,i.useCallback)(()=>{s(void 0)},[]);return 0===c.length?null:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:U.container,children:(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)("div",{style:U.sectionTitle,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Related Lookups"})}),(0,n.jsx)(a(4458).fI,{flexWrap:"wrap",gap:8,children:c.map(e=>(0,n.jsx)(a(548436).A,{onClick:()=>p(e),children:e.displayName},e.toolName))})]})}),(0,n.jsx)(a(674848).v,{isOpen:void 0!==r,onDismiss:m,toolName:null==r?void 0:r.toolName,displayName:(null==r?void 0:r.displayName)??"",spaceId:o,hasPermission:r?l.has(r.toolName):void 0})]})}let F={container:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,padding:16},sectionTitle:{marginBottom:8},userEntry:{padding:"8px 0",borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},userEntryLast:{padding:"8px 0"}
106,lookupButton:{cursor:"pointer",background:"none",border:"none",padding:2,display:"inline-flex",alignItems:"center",borderRadius:4},filterPillBar:{display:"flex",gap:6,marginBottom:10},filterPill:{cursor:"pointer",border:`1px solid ${a(632079).Tj.border.primary}`,background:a(632079).Tj.background.primary,borderRadius:12,paddingTop:3,paddingBottom:3,paddingInlineStart:10,paddingInlineEnd:10,fontFamily:"inherit",fontSize:12,fontWeight:a(699422).Wy.regular,color:a(632079).Tj.text.tertiary},filterPillActive:{cursor:"pointer",border:`1px solid ${a(632079).Tj.border.accentPrimary}`,background:a(632079).Tj.background.primary,borderRadius:12,paddingTop:3,paddingBottom:3,paddingInlineStart:10,paddingInlineEnd:10,fontFamily:"inherit",fontSize:12,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.accentPrimary}};function K({user:e,isLast:t,onLookup:i,showLookup:r}){return(0,n.jsx)("div",{style:t?F.userEntryLast:F.userEntry,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[e.email?(0,n.jsx)(a(799615).B,{value:e.email,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.email})}):void 0,r?(0,n.jsx)("button",{type:"button",style:F.lookupButton,onClick:()=>i(e.id),"aria-label":`Look up details for ${e.email??e.id}`,children:(0,n.jsx)(a(16275).I,{icon:a(166568).arrowUpRightSquareSmallIcon,size:"sm",colorVariant:"accentPrimary"})}):void 0]}),(0,n.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:(0,n.jsx)(a(137691).x5,{value:e.id})})}),void 0!==e.billing_exempt?(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["billing_exempt: ",String(e.billing_exempt)]}):void 0,void 0!==e.expiration_time?(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["expiration_time: ",e.expiration_time]}):void 0]})})}function $({bot:e,isLast:t}){return(0,n.jsx)("div",{style:t?F.userEntryLast:F.userEntry,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(799615).B,{value:e.name??"Unnamed Bot",children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.name??"Unnamed Bot"})}),(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["Type: ",e.type]}),e.createdBy?(0,n.jsx)(a(799615).B,{value:e.createdBy.email??e.createdBy.id,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["Created by: ",e.createdBy.email??e.createdBy.id]})}):void 0,e.createdAt?(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["Created: ",e.createdAt]}):void 0,(0,n.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:(0,n.jsx)(a(137691).x5,{value:e.id})})})]})})}function O({team:e,isLast:t,onLookup:i,showLookup:r}){return(0,n.jsx)("div",{style:t?F.userEntryLast:F.userEntry,children:(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)(a(799615).B,{value:e.name,children:(0,n.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:[e.name,e.isDefault?" (Default)":"",e.isArchived?" (Archived)":""]})}),r?(0,n.jsx)("button",{type:"button",style:F.lookupButton,onClick:()=>i(e.id),"aria-label":`Look up details for ${e.name}`,children:(0,n.jsx)(a(16275).I,{icon:a(166568).arrowUpRightSquareSmallIcon,size:"sm",colorVariant:"accentPrimary"})}):void 0]}),(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:["Access: ",e.accessLevel]}),(0,n.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:(0,n.jsx)(a(137691).x5,{value:e.id})})})]})})}function z(){return(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Loading members…"})]})}function G(e,t){let a=t.toLowerCase().trim();return a?e.filter(e=>{var t;return(null==(t=e.email)?void 0:t.toLowerCase().includes(a))||e.id.toLowerCase().includes(a)}):e}function q({data:e,permissionsStore:t,isLoadingMembership:r=!1,membershipFetchError:s}){let[o,l]=(0,i.useState)(void 0),[d,c]=(0,i.useState)(void 0),p=(0,a(47602).S)(t,"adminSearchTeams"),m=(0,a(47602).S)(t,"adminSearchUsers"),u=(0,a(83208).X)("admin_unified_user_view"),[h,y]=(0,i.useState)("active"),g=(0,i.useCallback)(e=>{y(e),k(e=>({...e,teamspaces:20}))},[]),[x,f]=(0,i.useState)(new Set),[b,v]=(0,i.useState)({teamspaces:"",owners:"",membershipAdmins:"",members:"",restrictedMembers:"",guests:"",bots:""}),[j,k]=(0,i.useState)({teamspaces:20,owners:20,membershipAdmins:20,members:20,restrictedMembers:20,guests:20,bots:20}),S=(0,i.useCallback)(e=>{f(t=>{let a=new Set(t);return a.has(e)?a.delete(e):a.add(e),a})},[]),w=(0,i.useCallback)(e=>{l(e)},[]),I=(0,i.useCallback)(()=>{l(void 0)},[]),C=(0,i.useCallback)(e=>{if(u){let t=new URL(a(168962).JZ.adminUnifiedUserView,window.location.origin);t.searchParams.set("userId",e),window.open(t.toString(),"_blank","noopener,noreferrer")}else c(e)},[u]),D=(0,i.useCallback)(()=>{c(void 0)},[]),T=(0,i.useCallback)((e,t)=>{v(a=>({...a,[e]:t})),k(t=>({...t,[e]:20}))},[]),R=(0,i.useCallback)(e=>{k(t=>({...t,[e]:t[e]+20}))},[]),A=(0,i.useMemo)(()=>{let t=e.users;return Array.isArray(t)?{owners:t.filter(e=>"owner"===e.role),membershipAdmins:t.filter(e=>"membership_admin"===e.role),members:t.filter(e=>"member"===e.role),restrictedMembers:t.filter(e=>"restricted_member"===e.role),guests:t.filter(e=>"page_guest"===e.role)}:{owners:[],membershipAdmins:[],members:[],restrictedMembers:[],guests:[]}},[e.users]),N=(0,i.useMemo)(()=>e.teams??[],[e.teams]),M=(0,i.useMemo)(()=>N.filter(e=>!e.isArchived).length,[N]),P=(0,i.useMemo)(()=>N.filter(e=>e.isArchived).length,[N]),V=(0,i.useMemo)(()=>"active"===h?N.filter(e=>!e.isArchived):"archived"===h?N.filter(e=>e.isArchived):N,[N,h]),E=(0,i.useMemo)(()=>Array.isArray(e.bots)?e.bots:[],[e.bots]),B=(0,i.useMemo)(()=>Array.isArray(e.bots)?e.bots.length:"number"==typeof e.bots?e.bots:0,[e.bots]),L=(0,i.useMemo)(()=>{let e;return(e=b.teamspaces.toLowerCase().trim())?V.filter(t=>t.name.toLowerCase().includes(e)||t.id.toLowerCase().includes(e)||t.accessLevel.toLowerCase().includes(e)):V},[V,b.teamspaces]),_=(0,i.useMemo)(()=>G(A.owners,b.owners),[A.owners,b.owners]),U=(0,i.useMemo)(()=>G(A.membershipAdmins,b.membershipAdmins),[A.membershipAdmins,b.membershipAdmins]),W=(0,i.useMemo)(()=>G(A.members,b.members),[A.members,b.members]),H=(0,i.useMemo)(()=>G(A.restrictedMembers,b.restrictedMembers),[A.restrictedMembers,b.restrictedMembers]),Z=(0,i.useMemo)(()=>G(A.guests,b.guests),[A.guests,b.guests]),J=(0,i.useMemo)(()=>{let e;return(e=b.bots.toLowerCase().trim())?E.filter(t=>{var a,i;return(null==(a=t.name)?void 0:a.toLowerCase().includes(e))||t.id.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)||(null==(i=t.createdBy)||null==(i=i.email)?void 0:i.toLowerCase().includes(e))}):E},[E,b.bots]),Q=(0,i.useMemo)(()=>
106{let t=L.slice(0,j.teamspaces),i=_.slice(0,j.owners),s=U.slice(0,j.membershipAdmins),o=W.slice(0,j.members),l=H.slice(0,j.restrictedMembers),d=Z.slice(0,j.guests),c=J.slice(0,j.bots),u=e.membershipCounts,y=(null==u?void 0:u.owner)??A.owners.length,x=(null==u?void 0:u.membership_admin)??A.membershipAdmins.length,f=(null==u?void 0:u.member)??A.members.length,b=(null==u?void 0:u.restricted_member)??A.restrictedMembers.length,v=(null==u?void 0:u.page_guest)??A.guests.length;function k(e,t){return 0===e.length&&r?(0,n.jsx)(z,{}):e.map((a,i)=>t(a,i,e.length))}return[{id:"teamspaces",title:"Teamspaces",count:N.length,filteredCount:L.length,visibleCount:t.length,render:()=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:F.filterPillBar,children:[(0,n.jsx)("button",{type:"button","aria-pressed":"active"===h,style:"active"===h?F.filterPillActive:F.filterPill,onClick:()=>g("active"),children:`Active (${M})`}),(0,n.jsx)("button",{type:"button","aria-pressed":"archived"===h,style:"archived"===h?F.filterPillActive:F.filterPill,onClick:()=>g("archived"),children:`Archived (${P})`}),(0,n.jsx)("button",{type:"button","aria-pressed":"all"===h,style:"all"===h?F.filterPillActive:F.filterPill,onClick:()=>g("all"),children:`All (${N.length})`})]}),t.length>0?t.map((e,a)=>(0,n.jsx)(O,{team:e,isLast:a===t.length-1,onLookup:w,showLookup:!0===p},e.id)):(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:`No ${h} teamspaces`})]})},{id:"owners",title:"Owners",count:y,filteredCount:_.length,visibleCount:i.length,render:()=>k(i,(e,t,a)=>(0,n.jsx)(K,{user:e,isLast:t===a-1,onLookup:C,showLookup:!0===m},e.id))},{id:"membershipAdmins",title:"Membership Admins",count:x,filteredCount:U.length,visibleCount:s.length,render:()=>k(s,(e,t,a)=>(0,n.jsx)(K,{user:e,isLast:t===a-1,onLookup:C,showLookup:!0===m},e.id))},{id:"members",title:"Members",count:f,filteredCount:W.length,visibleCount:o.length,render:()=>k(o,(e,t,a)=>(0,n.jsx)(K,{user:e,isLast:t===a-1,onLookup:C,showLookup:!0===m},e.id))},{id:"restrictedMembers",title:"Restricted Members",count:b,filteredCount:H.length,visibleCount:l.length,render:()=>k(l,(e,t,a)=>(0,n.jsx)(K,{user:e,isLast:t===a-1,onLookup:C,showLookup:!0===m},e.id))},{id:"guests",title:"Guests",count:v,filteredCount:Z.length,visibleCount:d.length,render:()=>k(d,(e,t,a)=>(0,n.jsx)(K,{user:e,isLast:t===a-1,onLookup:C,showLookup:!0===m},e.id))},{id:"bots",title:"Bots",count:B,filteredCount:J.length,visibleCount:c.length,render:()=>c.map((e,t)=>(0,n.jsx)($,{bot:e,isLast:t===c.length-1},e.id))}]},[e.membershipCounts,r,N.length,M,P,h,g,w,p,C,m,A,B,L,_,U,W,H,Z,J,j]);if("number"==typeof e.users){let t=e.users,i="number"==typeof e.bots?e.bots:0;return(0,n.jsx)("div",{style:F.container,children:(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"Users & Membership"}),(0,n.jsxs)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:[t," users, ",i," bots"]}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"User details not loaded. Re-search without skipHydrateUsers to see full membership information."})]})})}return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:F.container,children:(0,n.jsxs)(a(4458).VP,{gap:0,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",style:F.sectionTitle,children:"Users & Membership"}),r?(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:[(0,n.jsx)(a(517334).k,{size:"sm"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Loading membership data…"})]}):void 0,!r&&s?(0,n.jsx)(a(4458).fI,{alignItems:"center",gap:8,padding:8,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"red",colorVariant:"accentPrimary",children:s})}):void 0,Q.map((e,t)=>(0,n.jsx)(a(439423).v,{title:e.title,count:e.count,filteredCount:e.filteredCount,visibleCount:e.visibleCount,isExpanded:x.has(e.id),onToggle:()=>S(e.id),onShowMore:()=>R(e.id),isFirst:0===t,isLast:t===Q.length-1,searchQuery:b[e.id],onSearchChange:t=>T(e.id,t),children:e.render()},e.id))]})}),(0,n.jsx)(a(674848).v,{isOpen:void 0!==o,onDismiss:I,toolName:"adminSearchTeams",displayName:"Teamspace Lookup",spaceId:e.id,hasPermission:p,additionalParams:o?{teamId:o}:void 0}),(0,n.jsx)(a(674848).v,{isOpen:void 0!==d,onDismiss:D,toolName:"adminSearchUsers",displayName:"User Lo
106okup",spaceId:e.id,hasPermission:m,additionalParams:d?{userId:d}:void 0})]})}a(139583);let H={modalList:{overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:`${a(632079).Tj.icon.tertiary} transparent`},modalInfoCard:{border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6,background:a(632079).Tj.background.primary,overflowWrap:"anywhere"},summaryButton:{maxWidth:260,paddingInlineEnd:0},overflowBadge:{borderRadius:4,background:a(632079).Tj.blue.background.secondary,paddingInline:4},copyIcon:{display:"flex",alignItems:"center",justifyContent:"center"}};function Z(e){let{isOpen:t,onDismiss:r,title:s,items:o,getItemKey:l,ItemContentComponent:d,modalWidth:c}=e,p=(0,a(960253).I)(()=>({modal:{width:c,maxWidth:"calc(100vw - 48px)",padding:0}}),[c]),m=(0,i.useId)();return(0,n.jsx)(a(171849).a,{open:t,onDismiss:r,showCloseIcon:!0,transitionAppearance:"none",ariaLabelledBy:m,innerStyle:p.modal,preventHideChildrenWhileOpening:!0,children:(0,n.jsxs)(a(4458).VP,{gap:12,padding:16,children:[(0,n.jsx)(a(111010).D,{id:m,styleKey:"bodySmSemibold",colorVariant:"primary",children:s}),(0,n.jsx)(a(4458).VP,{gap:8,maxHeight:420,style:H.modalList,children:o.map(e=>(0,n.jsx)(a(4458).VP,{gap:6,padding:8,style:H.modalInfoCard,children:(0,n.jsx)(d,{item:e})},l(e)))})]})})}function J(e){let{label:t,items:r,emptySummary:s,modalTitle:o,ariaLabel:l,overflowAriaLabel:d,getItemKey:c,getItemSummary:p,ItemContentComponent:m,getSummaryItem:u,getSummaryCopyValue:h,copyAriaLabel:y,alwaysShowModal:g=!1,modalWidth:x=420}=e,[f,b]=(0,i.useState)(!1),v=(0,i.useCallback)(()=>{b(!0)},[]),j=(0,i.useCallback)(()=>{b(!1)},[]),k=u?u(r):r[0],S=k?p(k):s,w=k?r.length-1:0,I=g||w>0||void 0===k&&r.length>0,C=k&&h?h(k):void 0;return(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(4458).fI,{width:120,flexShrink:0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:t})}),I?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsxs)(a(4458).fI,{gap:2,alignItems:"center",children:[(0,n.jsx)(a(406910).p,{size:"xs",colorPalette:"blue","aria-label":l,onClick:v,shouldShrink:!0,style:H.summaryButton,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",lineClamp:1,children:S})}),C&&y?(0,n.jsx)(a(799615).B,{value:C,ariaLabel:y,children:(0,n.jsx)("span",{style:H.copyIcon,children:(0,n.jsx)(a(764262).I,{icon:a(967335).i,size:"xs",colorVariant:"secondary"})})}):void 0]}),w>0?(0,n.jsx)(a(406910).p,{size:"xs","aria-label":d,onClick:v,style:H.overflowBadge,children:(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorPalette:"blue",colorVariant:"accentPrimary",children:`+${w}`})}):void 0,(0,n.jsx)(Z,{isOpen:f,onDismiss:j,title:o,items:r,getItemKey:c,ItemContentComponent:m,modalWidth:x})]}):(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:S})]})}function Q(e){let{item:t}=e;return(0,n.jsx)(a(799615).B,{value:t,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:t})})}function Y(e){let{emailDomains:t}=e;return(0,n.jsx)(J,{label:"Email domains",items:t,emptySummary:"No email domains",modalTitle:"Email domains",ariaLabel:"View email domains",overflowAriaLabel:"View additional email domains",getItemKey:e=>e,getItemSummary:e=>e,ItemContentComponent:Q,modalWidth:360})}a(974864);let X={modal:{width:760,maxWidth:"calc(100vw - 48px)",maxHeight:"90vh",overflow:"hidden",padding:0},listContainer:{overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:`${a(632079).Tj.icon.tertiary} transparent`},assignmentRow:{background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:6},assignmentText:{overflowWrap:"anywhere"},groupBadge:{background:a(632079).Tj.background.secondary,borderRadius:4},assignmentDetails:{borderTop:`1px solid ${a(632079).Tj.border.primary}`},metadataValue:{overflowWrap:"anywhere"}},ee="Metadata unavailable",et={experiments:{title:"Experiments",loading:"Loading experiments...",failed:"Failed to load workspace experiments",searchLabel:"Search experiments",searchPlaceholder:"Search experiment or group",empty:"No experiment assignments",noMatches:"No matching experiments"},flags:{title:"Flags",loading:"Loading flags...",failed:"Failed to load w
106orkspace flags",searchLabel:"Search flags",searchPlaceholder:"Search flag or rule",empty:"No enabled flags",noMatches:"No matching flags"}};function ea(e){return 1===e?"1 assignment":`${e} assignments`}function ei(e){return"experiment"===e.type?e.experimentId:e.gateName}function en(e){return"experiment"===e.type?"control"===e.group?"Control · baseline":`Treatment \xb7 ${e.group}`:"Enabled"}function er(e){if(void 0!==e)return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function es(e){if(0!==e.length)return e.join(", ")}function eo(e){let{label:t,value:i}=e;return i?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"baseline",children:[(0,n.jsx)(a(4458).fI,{width:120,flexShrink:0,children:(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:t})}),(0,n.jsx)(a(4458).fI,{flexGrow:1,minWidth:0,style:X.metadataValue,children:(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"primary",children:i})})]}):null}function el(e){let{metadata:t}=e;return t?(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(eo,{label:"Display name",value:t.displayName}),(0,n.jsx)(eo,{label:"Status",value:t.status}),(0,n.jsx)(eo,{label:"ID type",value:t.idType}),(0,n.jsx)(eo,{label:"Allocation",value:function(e){if(void 0!==e)return`${e}%`}(t.allocation)}),(0,n.jsx)(eo,{label:"Duration",value:function(e){if(void 0!==e)return 1===e?"1 day":`${e} days`}(t.durationDays)}),(0,n.jsx)(eo,{label:"Created",value:er(t.createdTime)}),(0,n.jsx)(eo,{label:"Experiment started",value:er(t.startTime)}),(0,n.jsx)(eo,{label:"Last modified",value:er(t.lastModifiedTime)}),(0,n.jsx)(eo,{label:"Team",value:t.team}),(0,n.jsx)(eo,{label:"Target apps",value:es(t.targetApps)}),(0,n.jsx)(eo,{label:"Tags",value:es(t.tags)}),(0,n.jsx)(eo,{label:"Targeting gate",value:t.targetingGateId}),(0,n.jsx)(eo,{label:"Groups",value:function(e){if(0!==e.groups.length)return e.groups.map(e=>[e.name,e.group?`group=${e.group}`:void 0,`${e.size}%`,e.disabled?"disabled":void 0].filter(e=>void 0!==e).join(" · ")).join(", ")}(t)})]}):(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"tertiary",children:ee})}function ed(e){let{metadata:t}=e;return t?(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(eo,{label:"Status",value:t.status}),(0,n.jsx)(eo,{label:"Enabled",value:t.isEnabled?"Yes":"No"}),(0,n.jsx)(eo,{label:"ID type",value:t.idType}),(0,n.jsx)(eo,{label:"Checks/hour",value:void 0===t.checksPerHour?void 0:String(t.checksPerHour)}),(0,n.jsx)(eo,{label:"Created",value:er(t.createdTime)}),(0,n.jsx)(eo,{label:"Last modified",value:er(t.lastModifiedTime)}),(0,n.jsx)(eo,{label:"Team",value:t.team}),(0,n.jsx)(eo,{label:"Target apps",value:es(t.targetApps)}),(0,n.jsx)(eo,{label:"Rules",value:function(e){if(0!==e.rules.length)return e.rules.map(e=>{let t=e.environments.length>0?`env=${e.environments.join(", ")}`:void 0;return[e.name,`${e.passPercentage}%`,t].filter(e=>void 0!==e).join(" · ")}).join(", ")}(t)})]}):(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"tertiary",children:ee})}function ec(e){let{assignment:t}=e;return"experiment"===t.type?(0,n.jsx)(el,{metadata:t.metadata}):(0,n.jsx)(ed,{metadata:t.metadata})}function ep(e){var t;let{assignment:r}=e,[s,o]=(0,i.useState)(!1),l=(0,i.useId)(),d=r.metadata,c=ei(r),p=en(r),m=function(e){var t,a;if("experiment"===e.type){let t=er(null==(a=e.metadata)?void 0:a.startTime);return t?`Started ${t}`:void 0}let i=er(null==(t=e.metadata)?void 0:t.lastModifiedTime);return i?`Modified ${i}`:void 0}(r),u="experiment"===r.type?null==(t=r.metadata)?void 0:t.displayName:void 0,h=(0,i.useCallback)(()=>{o(e=>!e)},[]);return(0,n.jsxs)(a(4458).VP,{gap:8,padding:8,style:X.assignmentRow,children:[(0,n.jsxs)(a(4458).fI,{gap:12,alignItems:"center",justifyContent:"space-between",children:[(0,n.jsxs)(a(4458).VP,{gap:4,flexGrow:1,minWidth:0,children:[(0,n.jsx)(a(799615).B,{value:c,children:(0,n.jsx)("div",{style:X.assignmentText,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:c})})}),u?(0,n.jsx)("div",{style:X.assignmentText,children:(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"secondary",children:u})}):void 0,(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",flexWrap:"wrap",children:[null!=d&&d.status?(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"tertiary",children:d.status}):void 0,m?(0,n.jsx)(a(111010).D,{styleKey:"caption",colorVariant:"tertiary",children:m}):void 0]})]}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",flexShrink:0,children:[(0,n.jsx)(a(4458).fI,{alignItems:"center",paddingInline:8,paddingBlock:2,style:X.groupBadge,children:(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:p})}),(0,n.jsx)(a(988022).p,{size:"xs",iconLeading:s?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,"aria-expanded":s,"aria-controls":l,onClick:h,children:s?"Hide details":"Show details"})]})]}),s?(0,n.jsx)(a(4458).VP,{id:l,gap:4,paddingTop:8,style:X.assignmentDetails,children:(0,n.jsx)(ec,{assignment:r})}):void 0]})}function em(e){var t;let{spaceId:r}=e,s=(0,a(533992).v3)(),[o,l]=(0,i.useState)(!1),[d,c]=(0,i.useState)("experiments"),p=(0,i.useId)(),[m,u]=(0,i.useState)(void 0),[h,y]=(0,i.useState)(!1),[g,x]=(0,i.useState)(void 0),[f,b]=(0,i.useState)(""),v=(0,i.useMemo)(()=>(0,a(83388).G2)(r),[r]),j=f.trim().toLowerCase(),k=et[d],S=(0,i.useMemo)(()=>m?j?m.assignments.filter(e=>("experiment"===e.type?function(e){let{metadata:t}=e;return[e.experimentId,e.group,en(e),null==t?void 0:t.displayName,null==t?void 0:t.status,null==t?void 0:t.idType,null==t?void 0:t.team,null==t?void 0:t.targetingGateId,...(null==t?void 0:t.targetApps)??[],...(null==t?void 0:t.tags)??[],...(null==t?void 0:t.groups.flatMap(e=>[e.name,e.group,e.disabled?"disabled":void 0]))??[]]}(e):function(e){let{metadata:t}=e;return[e.gateName,"enabled",null==t?void 0:t.status,null==t?void 0:t.idType,null==t?void 0:t.team,...(null==t?void 0:t.targetApps)??[],...(null==t?void 0:t.rules.flatMap(e=>[e.name,`${e.passPercentage}
106%`,...e.environments]))??[]]}(e)).filter(e=>void 0!==e).join("\n").toLowerCase().includes(j)):m.assignments:[],[j,m]),w=(0,i.useCallback)(e=>{c(e),l(!0),b("")},[]),I=(0,i.useCallback)(()=>{w("experiments")},[w]),C=(0,i.useCallback)(()=>{w("flags")},[w]),D=(0,i.useCallback)(()=>{l(!1)},[]),T=(0,i.useCallback)(e=>{b(e.currentTarget.value)},[]),R=(0,i.useCallback)(()=>{b("")},[]);return(0,i.useEffect)(()=>{if(!o)return;let e={value:!0};return y(!0),x(void 0),u(void 0),async function(){try{let t=await s.api.callApi({eventName:"adminGetStatsigExperimentAssignmentsForWorkspace",environment:s,data:{spaceId:v,kind:d,includeControl:"experiments"===d}});if(!e.value)return;"success"===t.type?u(t.data):x(k.failed)}catch(t){(0,a(208318).t)().log({level:"warning",from:"ExperimentAssignmentsRow",type:"statsigAssignmentsLoadFailed",error:(0,a(952977).convertErrorToLog)(t)}),e.value&&x(k.failed)}finally{e.value&&y(!1)}}(),()=>{e.value=!1}},[s,o,k.failed,v,d]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(4458).fI,{width:120,flexShrink:0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Statsig"})}),(0,n.jsxs)(a(4458).fI,{gap:6,alignItems:"center",children:[(0,n.jsx)(a(548436).A,{size:"xs",colorPalette:"blue",iconLeading:a(107492).c,onClick:I,children:"View experiments"}),(0,n.jsx)(a(548436).A,{size:"xs",colorPalette:"blue",iconLeading:a(107492).c,onClick:C,children:"View flags"})]})]}),(0,n.jsx)(a(171849).a,{open:o,onDismiss:D,showCloseIcon:!0,transitionAppearance:"none",ariaLabelledBy:p,innerStyle:X.modal,preventHideChildrenWhileOpening:!0,children:(0,n.jsxs)(a(4458).VP,{gap:12,padding:16,children:[(0,n.jsx)(a(111010).D,{id:p,styleKey:"bodySmSemibold",colorVariant:"primary",children:k.title}),h?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(517334).k,{}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:k.loading})]}):void 0,g?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:g}):void 0,m?(0,n.jsxs)(a(4458).VP,{gap:10,children:[(0,n.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",gap:12,children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:function(e){let{filteredCount:t,totalCount:a}=e;return t===a?ea(a):`${t} of ${ea(a)}`}({filteredCount:S.length,totalCount:m.assignments.length})}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:1===(t=m.totalEvaluated)?"1 evaluated":`${t} evaluated`})]}),(0,n.jsx)(a(287562).p,{value:f,onChange:T,placeholder:k.searchPlaceholder,"aria-label":k.searchLabel,showClearButton:!0,onClearButtonClick:R}),S.length>0?(0,n.jsx)(a(4458).VP,{gap:6,maxHeight:520,style:X.listContainer,children:S.map(e=>(0,n.jsx)(ep,{assignment:e},ei(e)))}):(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:0===m.assignments.length?k.empty:k.noMatches})]}):void 0]})})]})}function eu(e){let t=e.filter(e=>"active"===e.domainStatus);return t.find(e=>e.isDefault)??t[0]}function eh(e){let{item:t}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:t.domainName}),(0,n.jsx)(a(135744).B,{label:"Status",value:function(e){switch(e){case"active":return"Active";case"certificate_pending":return"Certificate pending";case"invalid":return"Invalid";case"notion_dcv_pending":return"Notion DCV pending";case"payment_required":return"Payment required"}}(t.domainStatus)}),(0,n.jsx)(a(135744).B,{label:"Type",value:t.isCustom?"Custom":"Default"}),t.homePage?(0,n.jsx)(a(135744).B,{label:"Home page",value:t.homePage}):void 0,(0,n.jsx)(a(135744).B,{label:"Domain ID",value:t.domainId}),t.createdTime?(0,n.jsx)(a(135744).B,{label:"Created",value:t.createdTime}):void 0]})}function ey(e){let{publicDomains:t}=e;return(0,n.jsx)(J,{label:"Public domains",items:t,emptySummary:"No active public domains",modalTitle:"Public domains",ariaLabel:"View public domains",overflowAriaLabel:"View additional public domains",getItemKey:e=>e.domainId,getItemSummary:e=>e.domainName,getSummaryItem:eu,getSummaryCopyValue:e=>e.domainName,copyAriaLabel:"Copy public domain ID",alwaysShowModal:t.length>0,ItemContentComponent:eh,modalWidth:560})}let eg={container:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,padding:16},labelColumn:{minWidth:120},stripeLink:{color:a(632079).Tj.text.accentPrimary,textDecoration:"none",cursor:"pointer",fontSize:13,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:300,display:"inline-block"},rawSettingsModal:{width:760,maxWidth:"calc(100vw - 48px)",maxHeight:"90vh",overflow:"hidden",padding:0},rawSettingsJsonContainer:{overflowY:"auto",scrollbarWidth:"thin",scrollbarColor:`${a(632079).Tj.icon.tertiary} transparent`}},ex="Space settings";function ef(e){let{orgId:t}=e,r=i.useCallback(e=>{e.stopPropagation();let i=new URL(a(168962).JZ.adminUnifiedAccountView,window.location.origin);i.searchParams.set("q",t),window.open(i.toString(),"_blank","noopener,noreferrer")},[t]);return(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(799615).B,{value:t,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,n.jsx)(a(137691).x5,{value:t})})}),(0,n.jsx)(a(988022).p,{size:"xs",onClick:r,iconTrailing:a(166568).arrowUpRightSquareSmallIcon,children:"Open in Account View"})]})}function eb(e){let{user:t,showUserViewLink:r}=e,s=t.isBot?"Bot ID":"User ID",o=(0,i.useCallback)(()=>{let e=new URL(a(168962).JZ.adminUnifiedUserView,window.location.origin);e.searchParams.set("userId",t.id),window.open(e.toString(),"_blank","noopener,noreferrer")},[t.id]);return(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[t.email?(0,n.jsx)(a(799615).B,{value:t.email,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:t.email})}):void 0,r&&!t.isBot?(0,n.jsx)(a(988022).p,{size:"xs",onClick:o,iconTrailing:a(166568).arrowUpRightSquareSmallIcon,children:"Open in User View"}):void 0]}),(0,n.jsx)(a(799615).B,{value:t.id,formatUuid:!0,children:(0,n.jsxs)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:[`${s}: `,(0,n.jsx)(a(137691).x5,{value:t.id})]})}),t.isBanned?(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"accentPrimary",colorPalette:"red",children:"Banned"}):void 0]})}function ev({icon:e,text:t,isNegative:i}){return(0,n.jsxs)(a(4458).fI,{alignItems:"center",gap:4,children:[(0,n.jsx)("span",{"aria-hidden":!0,
106children:e}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:i?"accentPrimary":"secondary",colorPalette:i?"red":void 0,children:t})]})}function ej(e){let{settings:t}=e,[r,s]=(0,i.useState)(!1),o=(0,i.useId)(),l=(0,i.useMemo)(()=>{var e;return 0===(e=Object.values(t).filter(e=>void 0!==e).length)?"No stored settings":1===e?"1 defined setting":`${e} defined settings`},[t]),d=(0,i.useCallback)(()=>{s(!0)},[]),c=(0,i.useCallback)(()=>{s(!1)},[]);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:ex}),(0,n.jsx)(a(548436).A,{size:"xs",colorPalette:"blue",iconLeading:a(107492).c,onClick:d,children:"View raw JSON"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:l})]}),(0,n.jsx)(a(171849).a,{open:r,onDismiss:c,showCloseIcon:!0,transitionAppearance:"none",ariaLabelledBy:o,innerStyle:eg.rawSettingsModal,preventHideChildrenWhileOpening:!0,children:(0,n.jsxs)(a(4458).VP,{gap:12,padding:16,children:[(0,n.jsx)(a(111010).D,{id:o,styleKey:"bodySmSemibold",colorVariant:"primary",children:ex}),(0,n.jsx)(a(4458).VP,{maxHeight:560,style:eg.rawSettingsJsonContainer,children:(0,n.jsx)(a(503270).H,{data:t,defaultCollapsed:!0,showCopyButton:!0})})]})})]})}function ek({data:e,permissionsStore:t}){var r,s,o,l,d,c,p,m,u,h;let y=(0,a(83208).X)("admin_unified_user_view"),g=(0,a(47602).S)(t,"adminSearchUsers"),x=(0,a(579993).K8)(()=>{let{currentUserPermissions:e,fetchPermissionsErrored:a}=t.state;return!a&&(void 0!==e?e.has("adminGetStatsigExperimentAssignmentsForWorkspace"):void 0)},[t]),f=(0,i.useMemo)(()=>e.primaryOwner?e.primaryOwner:Array.isArray(e.users)?e.users.find(e=>"owner"===e.role):void 0,[e.primaryOwner,e.users]),b=(0,a(213003).GT)({subscription_tier:null==(r=e.billing)?void 0:r.subscriptionTier,settings:e.settings}),v=!!e.config.adminDisablePublicAccess,j=e.cellId||(null==(s=e.sharding)||null==(s=s.spaceShard)?void 0:s.databaseName)||(null==(o=e.sharding)||null==(o=o.spaceShard)?void 0:o.schemaName)||e.domain,k=e.publicDomains??[],S=e.emailDomains??[],w=y&&!0===g;return(0,n.jsxs)("div",{style:eg.container,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"primary",children:"General Information"}),(0,n.jsxs)(a(4458).VP,{gap:8,marginTop:16,children:[(0,n.jsx)(a(458482).F,{title:"Identity"}),e.name?(0,n.jsx)(a(135744).B,{label:"Name",value:e.name}):void 0,(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:"Space ID"}),(0,n.jsx)(a(799615).B,{value:e.id,formatUuid:!0,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:(0,n.jsx)(a(137691).x5,{value:e.id})})})]}),e.organizationId?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:"Organization"}),(0,n.jsx)(ef,{orgId:e.organizationId})]}):void 0,null!=(l=e.billing)&&l.planType?(0,n.jsx)(a(135744).B,{label:"Subscription",value:e.billing.planType}):void 0,(null==(d=e.billing)?void 0:d.isSalesAssisted)!==void 0?(0,n.jsx)(a(135744).B,{label:"Account Type",value:e.billing.isSalesAssisted?"Sales-assisted":"Self-serve"}):void 0,null!=(c=e.billing)&&null!=(c=c.stripeCustomerUrl)&&c.startsWith("https://dashboard.stripe.com/")?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:"Stripe"}),(0,n.jsx)("a",{href:e.billing.stripeCustomerUrl,target:"_blank",rel:"noopener noreferrer",style:eg.stripeLink,children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"accentPrimary",children:e.billing.stripeCustomerUrl})})]}):void 0]}),(0,n.jsx)(a(143855).c,{}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(458482).F,{title:"Ownership"}),e.createdBy?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:"Created by"}),(0,n.jsx)(eb,{user:e.createdBy,showUserViewLink:w})]}):void 0,e.createdTime?(0,n.jsx)(a(135744).B,{label:"Created at",value:e.createdTime}):void 0,f?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"flex-start",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:"Owned by"}),(0,n.jsx)(eb,{user:f,showUserViewLink:w})]}):void 0]}),(0,n.jsx)(a(143855).c,{}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsxs)(a(4458).fI,{gap:12,alignItems:"center",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",style:eg.labelColumn,children:"Status:"}),(0,n.jsxs)(a(4458).fI,{gap:16,alignItems:"center",flexWrap:"wrap",children:[(0,n.jsx)(ev,{icon:e.isDeleted?"❌":"✅",text:e.isDeleted?"Deleted":"Active",isNegative:e.isDeleted}),(0,n.jsx)(ev,{icon:e.isSanctioned?"❌":"✅",text:e.isSanctioned?"Sanctioned":"Not sanctioned",isNegative:!!e.isSanctioned}),(0,n.jsx)(ev,{icon:b?"✅":"❌",text:b?"AI enabled":"AI disabled",isNegative:!b}),(0,n.jsx)(ev,{icon:v?"❌":"✅",text:v?"Public pages disabled":"Public pages enabled",isNegative:v})]})]}),e.isDeleted&&e.lastEditedTime?(0,n.jsx)(a(135744).B,{label:"Deleted on",value:e.lastEditedTime}):void 0,e.deletedBy?(0,n.jsx)(a(135744).B,{label:"Deleted by",value:e.deletedBy.email??e.deletedBy.id}):void 0,e.scheduledForDeletion?(0,n.jsx)(a(135744).B,{label:"Scheduled",value:e.scheduledForDeletion}):void 0]}),(0,n.jsx)(a(143855).c,{}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(458482).F,{title:"Workers"}),(0,n.jsx)(a(135744).B,{label:"Status",value:(0,a(626802).s)(e.config.workers)}),(0,n.jsx)(a(135744).B,{label:"Creation setting",value:(0,a(626802).X)(e.config.workers)})]}),(0,n.jsx)(a(143855).c,{}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(458482).F,{title:"Security & Compliance"}),(0,n.jsx)(a(135744).B,{label:"SAML",value:e.samlConfig?`${e.samlConfig.value.status}${null!=(p=e.samlConfig.value.email_domains)&&p.length?` (${e.samlConfig.value.email_domains.join(", ")})`:""}`:"Not configured"}),(0,n.jsx)(a(135744).B,{label:"HIPAA",value:null!=(m=e.settings)&&m.hipaa_compliancy_data?"Enabled":"Not enabled"}),(0,n.jsx)(ej,{settings:e.rawSettings}),!0===x?(0,n.jsx)(em,{spaceId:e.id}):void 0]}),(0,n.jsx)(a(143855).c,{}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(458482).F,{title:"Domains"}),(0,n.jsx)(ey,{publicDomains:k}),(0,n.jsx)(Y,{emailDomains:S})]}),j?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(143855).c,{}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(458482).F,{title:"Infrastru
106cture"}),e.cellId?(0,n.jsx)(a(135744).B,{label:"Cell ID",value:e.cellId}):void 0,null!=(u=e.sharding)&&null!=(u=u.spaceShard)&&u.databaseName?(0,n.jsx)(a(135744).B,{label:"Space Shard Database",value:e.sharding.spaceShard.databaseName}):void 0,null!=(h=e.sharding)&&null!=(h=h.spaceShard)&&h.schemaName?(0,n.jsx)(a(135744).B,{label:"Space Shard Schema",value:e.sharding.spaceShard.schemaName}):void 0,e.domain?(0,n.jsx)(a(135744).B,{label:"Domain",value:e.domain}):void 0]})]}):void 0]})}let eS={card:{padding:18,background:a(632079).Tj.background.primary,border:`1px solid ${a(632079).Tj.border.primary}`,borderRadius:8}},ew={adminWrap:(0,a(120308).pj)(),inputContainer:{maxWidth:400},searchCard:{...eS.card,flex:1,minWidth:0},quickActionsCard:{...eS.card,flex:1,minWidth:0},sectionCard:{...eS.card}},eI=["Plan & billing actions (e.g. change plan, migrate)","Member actions (e.g. remove member, change role)","Destructive actions (e.g. delete workspace)"],eC=["UUID, name, domain","Plan type and creation date","Owner and organization"];function eD(e){let t=new URL(window.location.href);e?t.searchParams.set("spaceId",e):t.searchParams.delete("spaceId"),t.searchParams.delete("q"),t.searchParams.delete("domain"),t.searchParams.delete("stripeCustomerId"),window.history.replaceState(window.history.state,"",t.toString())}let eT={skipGetVisibleUsers:!0,skipGetBots:!0,skipGetTeams:!0,skipGetGroups:!0,skipBlockUsage:!0,skipHighWaterMarks:!0,skipGetSubscriptionData:!0,includeMembershipCounts:!0,includePrimaryOwner:!0},eR={skipBlockUsage:!0,skipGetSubscriptionData:!0,skipSamlConfig:!0,skipUserSimilarity:!0,skipUserAliases:!0,skipGuestPageIds:!0};function eA(e,t){return{...e,userCount:t.userCount,users:t.users,botCount:t.botCount,bots:t.bots,groups:t.groups,teams:t.teams,billing:{...e.billing,currentHighWaterMark:t.billing.currentHighWaterMark,endOfDayHighWaterMark:t.billing.endOfDayHighWaterMark,nextBillingPeriodHighWaterMark:t.billing.nextBillingPeriodHighWaterMark}}}async function eN(e){let t,{environment:i,spaceId:n,myRequestId:r,requestIdRef:s,setWorkspaceData:o,setIsLoadingMembership:l,setMembershipFetchError:d}=e;try{let e={__adminUISource:"unified_workspace_view",spaceId:n,...eR},a=await i.api.callApi({eventName:"adminSearchSpaces",environment:i,data:e});if(r!==s.current)return;"success"===a.type?o(e=>e?eA(e,a.data):e):t="Failed to load members. Try searching again."}catch(e){(0,a(208318).t)().log({level:"warning",from:"UnifiedWorkspaceView",type:"membershipHeavyFetchFailed",error:(0,a(952977).convertErrorToLog)(e)}),t="Failed to load members. Try searching again."}finally{r===s.current&&(l(!1),void 0!==t&&d(t))}}let eM=/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?$/;function eP(e){let t=(0,a(533992).v3)(),r=(0,a(743187).g)(),s=(0,a(47602).S)(r,"adminSearchSpaces"),[o]=(0,i.useState)(()=>{let e=new URLSearchParams(window.location.search);return e.get("spaceId")??e.get("q")??e.get("domain")??e.get("stripeCustomerId")??""}),[l,c]=(0,i.useState)(o),[p,m]=(0,i.useState)(!1),[u,y]=(0,i.useState)(!1),[g,f]=(0,i.useState)(void 0),[b,v]=(0,i.useState)(void 0),[j,k]=(0,i.useState)(void 0),S=(0,i.useRef)(!1),w=(0,i.useRef)(0),I=(0,a(83208).X)("unified_workspace_view_optimised_fetch"),C=(0,a(83208).X)("admin_optimise_space_results"),T=I&&C,R=(0,i.useCallback)(async()=>{if(p)return;let e=function(e){let t=e.trim();if(t){if((0,a(83388).iv)(t))return{kind:"spaceId",normalized:(0,a(83388).G2)(t)};if(t.startsWith("cus_"))return{kind:"stripeCustomerId",normalized:t};if(t.split(".").every(e=>eM.test(e)))return{kind:"domain",normalized:t.toLowerCase()}}}(l);if(!e){k(void 0),v("Please enter a valid workspace UUID, domain, or Stripe customer ID (cus_…).");return}let i=++w.current;m(!0),v(void 0),k(void 0),y(!1),f(void 0);let n="spaceId"===e.kind?{spaceId:e.normalized}:"domain"===e.kind?{domain:e.normalized}:{stripeCustomerId:e.normalized};try{let e={__adminUISource:"unified_workspace_view",...n,includeWorkersConfig:!0,...T?eT:{}},r=await t.api.callApi({eventName:"adminSearchSpaces",environment:t,data:e});if(i!==w.current)return;"success"===r.type?(k(r.data),eD(r.data.id),T&&(y(!0),eN({environment:t,spaceId:(0,a(83388).G2)(r.data.id),myRequestId:i,requestIdRef:w,setWorkspaceData:k,setIsLoadingMembership:y,setMembershipFetchError:f}))):v((0,a(201790).V4)(r))}catch(e){if(i!==w.current)return;v(e instanceof Error?e.message:"Failed to fetch workspace data")}finally{i===w.current&&m(!1)}},[t,p,l,T]);(0,i.useEffect)(()=>{o&&!0===s&&!S.current&&(S.current=!0,R())},[o,s,R]);let A=(0,i.useCallback)(()=>{R()},[R]),N=(0,i.useCallback)(e=>{c(e.target.value)},[]),M=(0,i.useCallback)(()=>{w.current++,c(""),k(void 0),v(void 0),m(!1),y(!1),f(void 0),eD(void 0)},[]),P=void 0!==j||void 0!==b,V=void 0===j&&void 0===b;return void 0===s?(0,n.jsx)(a(45062).A,{title:"Unified Workspace View - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"unifiedWorkspaceView",children:(0,n.jsx)("div",{style:ew.adminWrap,children:(0,n.jsx)(a(4458).fI,{padding:8,justifyContent:"center",children:(0,n.jsx)(a(517334).k,{size:"default"})})})})}):!1===s?(0,n.jsx)(a(45062).A,{title:"Unified Workspace View - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"unifiedWorkspaceView",children:(0,n.jsx)("div",{style:ew.adminWrap,children:(0,n.jsx)(a(4458).fI,{padding:8,children:(0,n.jsx)("div",{style:ew.searchCard,children:(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Unified Workspace View"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:'You don\'t have access to this tool. Contact your admin to request the "Find user and workspace information" permission.'})]})})})})})}):(0,n.jsx)(a(45062).A,{title:"Unified Workspace View - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"unifiedWorkspaceView",children:(0,n.jsxs)("div",{style:ew.adminWrap,children:[(0,n.jsxs)(a(4458).fI,{gap:16,alignItems:"stretch",padding:8,children:[(0,n.jsx)("div",{style:ew.searchCard,children:(0,n.jsxs)(a(4458).VP,{gap:16,children:[(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:"Unified Workspace View"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Search for workspace information by entering a workspace UUID, domain, or Stripe customer ID."})]}),(0,n.jsxs)(a(4458).VP,{gap:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"Search"}),(0,n.jsx)("div",{style:ew.inputContainer,children:(0,n.jsx)(a(287562).p,{value:l,onCh
106ange:N,placeholder:"Workspace UUID, domain, subdomain, or Stripe customer ID (cus_…)",focusInitial:!0,onSubmit:A,showClearButton:!0,onClearButtonClick:M})}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Accepts a workspace UUID (with or without dashes), a custom domain (e.g. example.com), a workspace subdomain (e.g. maple-wakeboard-419), or a Stripe customer ID (cus_…)."})]}),(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)(a(912946).j,{onClick:R,disabled:!l.trim()||p,children:p?"Searching...":"Search"}),P?(0,n.jsx)(a(548436).A,{onClick:M,children:"Clear"}):void 0,p?(0,n.jsx)(a(517334).k,{size:"sm"}):void 0]}),b?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:b}):void 0]})}),j?(0,n.jsx)("div",{style:ew.quickActionsCard,children:(0,n.jsx)(D,{data:j,permissionsStore:r})}):void 0,V?(0,n.jsx)(a(4458).VP,{flex:1,minWidth:0,children:(0,n.jsx)(a(554577).A,{title:"Quick Actions",description:"Admin tools scoped to this workspace, categorized by type.",items:eI})}):void 0]}),V?(0,n.jsxs)(a(4458).VP,{gap:8,paddingTop:0,paddingBottom:8,paddingInlineStart:8,paddingInlineEnd:8,children:[(0,n.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:"What you'll see after searching"}),(0,n.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:"Each section below loads once you search for a workspace."}),(0,n.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",children:[(0,n.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,n.jsx)(a(554577).A,{title:"General Information",description:"Core workspace metadata and settings at a glance.",items:eC}),(0,n.jsx)(a(554577).A,{title:"Billing & Subscription",description:"Plan tier, seats, Stripe customer, trial status, and renewal info."}),(0,n.jsx)(a(554577).A,{title:"Users & Membership",description:"Members, guests, and their roles — with search and pagination."})]}),(0,n.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,n.jsx)(a(554577).A,{title:"Related Lookups",description:"Open deeper admin lookups (permissions, integrations, etc.) pre-filled for this workspace."}),(0,n.jsx)(a(554577).A,{title:"Account Notes",description:"Internal support notes attached to this workspace — read, add, or edit."}),(0,n.jsx)(a(554577).A,{title:"Recent Activity",description:"Latest audit log events in this workspace."})]})]})]}):void 0,j?(0,n.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",paddingTop:0,paddingBottom:8,paddingInlineStart:8,paddingInlineEnd:8,children:[(0,n.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,n.jsx)("div",{style:ew.sectionCard,children:(0,n.jsx)(ek,{data:j,permissionsStore:r})}),(0,n.jsx)("div",{style:ew.sectionCard,children:(0,n.jsx)(h,{data:j})}),(0,n.jsx)("div",{style:ew.sectionCard,children:(0,n.jsx)(q,{data:j,permissionsStore:r,isLoadingMembership:u,membershipFetchError:g})}),(0,n.jsx)(x,{spaceId:j.id,permissionsStore:r})]}),(0,n.jsxs)(a(4458).VP,{flex:1,minWidth:0,gap:16,children:[(0,n.jsx)(a(949130).n,{entityId:j.id,permissionsStore:r}),(0,n.jsx)(W,{data:j,permissionsStore:r}),(0,n.jsx)("div",{style:ew.sectionCard,children:(0,n.jsx)(d,{data:j,permissionsStore:r})}),(0,n.jsx)("div",{style:ew.sectionCard,children:(0,n.jsx)(L,{data:j,permissionsStore:r})})]})]}):void 0]})})})}},62935(e,t,a){function i(e){let{columns:t,rows:i}=e;return(0,a(318851).A)([t,...i.map(e=>t.map(t=>e[t]))],{escape_formulas:!0})}a(159952),a.d(t,{L:()=>i})},553775(e,t,a){a(159952),a(635790);var i=a(440302);let n={cursor:"pointer",textDecoration:"none",color:"inherit"};function r(){return(0,i.jsx)("div",{style:a(120308).g,children:(0,i.jsxs)("a",{href:a(168962).JZ.admin,style:n,children:["Notion Admin Mode"," ",void 0]})})}let s={link:{cursor:"pointer",textDecoration:"none",color:a(632079).Tj.blue.text.accentPrimary}};function o(e){let{table:t,record:n,children:r}=e;return(0,i.jsx)("a",{href:(0,a(185612).YV)({table:t,recordId:n.id}),style:s.link,children:r||(0,i.jsxs)(i.Fragment,{children:[n.name,n.name?" ":void 0,(0,i.jsx)(a(137691).x5,{value:n.id})]})})}function l(e){let{user:t}=e;return t?(0,i.jsxs)(o,{table:"notion_user",record:t,children:[t.email,t.isBot?(0,i.jsx)("i",{children:" (bot)"}):null]}):(0,i.jsx)(i.Fragment,{children:"Unknown User"})}function d(e){let{team:t}=e;return t?(0,i.jsxs)(o,{table:"team",record:t,children:[t.name,t.isDefault?(0,i.jsx)("i",{children:" (default)"}):null,t.isArchived?(0,i.jsx)("i",{children:" (archived)"}):null]}):(0,i.jsx)(i.Fragment,{children:"Unknown Team"})}function c(e){let{space:t}=e;return(0,i.jsxs)(o,{table:"space",record:t,children:[t.name?`${t.name} `:null,(0,i.jsx)(a(137691).x5,{value:t.id})]})}let p={header:{display:"flex",alignItems:"center",gap:4,fontWeight:a(699422).Wy.semibold},label:{color:a(632079).Tj.red.text.accentPrimary},list:{paddingInlineStart:"2em"}};function m(e){let{warnings:t}=e;return 0===t.length?null:(0,i.jsxs)(a(4458).VP,{alignItems:"flex-start",children:[(0,i.jsxs)("div",{style:p.header,children:[(0,i.jsx)(a(16275).I,{icon:a(143896).exclamationMarkTri
106angleFillSmallIcon,size:"sm",colorPalette:"red",colorVariant:"accentPrimary"}),(0,i.jsx)(a(324489).V,{style:p.label,children:`Found ${t.length} issue${t.length>1?"s":""}`})]}),(0,i.jsx)(a(324489).V,{isSmall:!0,style:p.label,children:(0,i.jsx)("ul",{style:p.list,children:t.map(e=>(0,i.jsx)("li",{children:e},e))})})]})}let u={fontWeight:a(699422).Wy.bold,fontSize:20,display:"flex",alignItems:"center",marginBottom:6},h={fontSize:12,color:a(632079).oZ.mediumTextColor};a.d(t,{cw:()=>d,i$:()=>m,lv:()=>c,ru:()=>o,uQ:()=>l,xu:()=>r},{Bk:h,g:u})},578545(e,t,a){a.r(t);var i=a(635790),n=a(440302);a.d(t,{},{default:function(e){var t;let{navigate:r}=(0,i.useContext)(a(44894).E),{legacyColor:s}=e,o=(0,a(533992).v3)(),l=(0,a(876252).$)(),d=(0,a(579993).K8)(()=>null==l?void 0:l.getEmail(),[l]),c="makenotion.com"===(0,a(801109).zN)(d??""),[p,m]=i.useState("");i.useEffect(()=>{!async function(){try{let e=await (0,a(128190).getCookie)(o,"notion_ghost_preferred_role");m(t=>e??"")}catch(e){console.error(e)}}()});let u="full"===p?"restricted":"full",h=i.useCallback(async()=>{if(!d)return null;let e=await a(499748).P({email:d,intercomLink:"switch role",preferredLoginRole:u});if("failed"===e.type)a(262058).V(),a(647095).Qg(e);else{let{userId:t}=e.data,i=`Success! click "Continue" to enter account for "${d}" in ${a(607142).v[u].text} mode.`,n=e.data.expiryTime?`${i} The user has granted access until ${(0,a(850640).W_)(e.data.expiryTime,"medium_with_time",a(599412).q)}.`:i;a(262058).V(),a(647095).ui({message:n,showCancel:!1,keepFocus:!0,items:[{label:"Continue",color:"blue",onAccept:()=>{a(845311).N({userId:t,environment:o})}}]})}},[o,d,u]);if(!d)return null;let y=(0,n.jsxs)(n.Fragment,{children:[`You are currently logged in as ${d}`,(0,n.jsx)("i",{children:p&&c?` (${null==(t=a(607142).v[p])?void 0:t.text} access)`:""}),"."]}),g=[{label:"Back to Admin Console",onClick:()=>{r({environment:o,url:"/__admin"})}},{label:"Logout as user",onClick:()=>{a(499748).A(o)}}];
106return p&&c&&(g=[{label:`Switch to ${a(607142).v[u].text} mode`,onClick:()=>h()},...g]),(0,n.jsx)(a(141342).l,{label:y,display:"full-width",actions:g,tint:(0,a(550552).V)(s)})}})},949130(e,t,a){a(635790);var i=a(440302);function n(e){let{entityId:t,permissionsStore:n}=e;return(0,a(47602).S)(n,"adminGetRelatedEntities")?(0,i.jsx)(r,{entityId:t},t):null}function r(e){let{entityId:t}=e,n=(0,a(533992).v3)(),[r,s]=(0,a(97668).Yb)(async()=>{try{let e=(0,a(83388).G2)(t),i=await n.api.callCellCompatibleApi({cellNavigation:{recordId:e},eventName:"adminGetRelatedEntities",environment:n,data:{entityId:e}});return"success"===i.type?i.data:void 0}catch(e){(0,a(208318).t)().log({level:"warning",from:"RelatedEntitiesPanel",type:"loadFailed",error:(0,a(952977).convertErrorToLog)(e)});return}},[t,n]);if("resolved"===r.status&&void 0!==r.value)return(0,i.jsx)(a(763605).g,{response:r.value});let o="idle"===r.status||"pending"===r.status;return(0,i.jsx)(a(577497).Zp,{padding:"lg",borderVariant:"primary",children:(0,i.jsxs)(a(4458).VP,{gap:8,alignItems:"flex-start",children:[(0,i.jsx)(a(111010).D,{styleKey:"titleSmSemibold",children:"Related entities"}),(0,i.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:o?"Loading related entities…":"Unable to load related entities."}),o?void 0:(0,i.jsx)(a(548436).A,{onClick:()=>void s(),children:"Retry related entities"})]})})}a.d(t,{n:()=>n})},763605(e,t,a){a.d(t,{g:()=>x}),a(533958),a(435368),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(976614),a(139583),a(159952),a(765324);var i=a(635790);function n(e){switch(e){case"client_browser":return"Device";case"signup_network":return"Network";case"canonical_google_email":return"Email";case"payment":return"Payment";case"shared_member":return"Shared members";case"shared_workspace":return"Shared workspaces";case"hcaptcha_udid":return"hCaptcha device";case"hcaptcha_user_sig":return"hCaptcha user";case"shared_uncommon_email_domain":return"Email domain"}}let r={banned:"Banned",created_auto_ai_disabled_space:"Created auto AI-disabled space",created_business_trial_denied_space:"Created business-trial-denied space",created_fraud_disabled_space:"Created fraud-disabled space",created_known_fraud_space:"Created known-fraud space",created_manual_ai_disabled_space:"Created manually AI-disabled space",auto_ai_disabled:"AI auto-disabled",business_trial_denied:"Business trial denied",creator_banned:"Creator banned",fraud_disabled:"Fraud disabled",known_fraud:"Known fraud",manual_ai_disabled:"AI manually disabled"};function s(e){return r[e]}function o(e){let t=e.evidenceMetadata,a=[],i=l(e);switch(i&&a.push(`Identifier: ${i}`),e.signalType){case"payment":null!=t&&t.cardBrand&&a.push(`Brand: ${t.cardBrand}`),null!=t&&t.cardLast4&&a.push(`Card: •••• ${t.cardLast4}`),null!=t&&t.cardFunding&&a.push(`Funding: ${t.cardFunding}`),null!=t&&t.cardCountry&&a.push(`Country: ${t.cardCountry}`);break;case"client_browser":null!=t&&t.devicePlatform&&a.push(`Platform: ${t.devicePlatform}`),null!=t&&t.deviceType&&a.push(`OS/device type: ${t.deviceType}`);break;case"canonical_google_email":((null==t?void 0:t.canonicalEmail)??(null!=t&&t.maskedEmail))&&a.push((null==t?void 0:t.canonicalEmail)??(null==t?void 0:t.maskedEmail)??"");break;case"signup_network":a.push("Shared signup IP + TLS fingerprint (JA3)");break;case"hcaptcha_udid":a.push("Shared hCaptcha device ID (udid)");break;case"hcaptcha_user_sig":a.push("Shared hCaptcha user signature (userSig)");break;case"shared_uncommon_email_domain":a.push("Shared uncommon email domain")}0===a.length&&a.push("Connector details are unavailable in this snapshot."),a.push(`${e.exactFanout} total group members`);let n="First observed for this user",r="Last observed for this user";return"payment"===e.signalType?(e.groupFirstObservedAt&&a.push(`Earliest payment method creation across group: ${e.groupFirstObservedAt.slice(0,10)}
106`),e.groupLastObservedAt&&a.push(`Latest payment method creation across group: ${e.groupLastObservedAt.slice(0,10)}`),e.groupFirstObservedAt||e.groupLastObservedAt||a.push("Group-wide payment method creation dates are unavailable in this snapshot."),n="Earliest payment method creation for lookup entity",r="Latest payment method creation for lookup entity"):"canonical_google_email"===e.signalType||"shared_uncommon_email_domain"===e.signalType?(n="Account created",r="Snapshot date"):("shared_member"===e.signalType||"shared_workspace"===e.signalType)&&(n="Membership start for this entity",r="Snapshot date"),e.firstObservedAt&&a.push(`${n}: ${e.firstObservedAt.slice(0,10)}`),e.lastObservedAt&&a.push(`${r}: ${e.lastObservedAt.slice(0,10)}`),a}function l(e){var t;let a=e.evidenceMetadata;switch(e.signalType){case"payment":return null==a?void 0:a.cardFingerprint;case"client_browser":return null==a?void 0:a.deviceId;case"canonical_google_email":return(null==a?void 0:a.canonicalEmail)??(null==a?void 0:a.maskedEmail);case"signup_network":return null!=a&&a.ipAddress&&a.ja3?`${a.ipAddress} \xb7 JA3: ${a.ja3}`:void 0;case"shared_uncommon_email_domain":return null==a?void 0:a.emailDomain;case"hcaptcha_udid":case"hcaptcha_user_sig":return;case"shared_member":case"shared_workspace":return null==(t=e.connectingEntity)?void 0:t.entityId}}async function d(e){let{response:t,scope:i,loadGroupPage:r,isCanceled:l}=e,d=new Map,p=c(t.focusEntity);function m(e){var t,a,i,n,r,s,o,l,m,u,h,y,g,x;let f=c(e);if(f===p)return;let b=d.get(f);if(void 0===b)return void d.set(f,e);let v=[...new Set([...b.trustStatuses??[],...e.trustStatuses??[]])],j=!0===b.trustActioned||!0===e.trustActioned||(e.trustActioned??b.trustActioned);d.set(f,{...b,metadata:{name:(null==(t=e.metadata)?void 0:t.name)??(null==(a=b.metadata)?void 0:a.name),email:(null==(i=e.metadata)?void 0:i.email)??(null==(n=b.metadata)?void 0:n.email),creatorEmail:(null==(r=e.metadata)?void 0:r.creatorEmail)??(null==(s=b.metadata)?void 0:s.creatorEmail),createdAt:(null==(o=e.metadata)?void 0:o.createdAt)??(null==(l=b.metadata)?void 0:l.createdAt),memberCount:(null==(m=e.metadata)?void 0:m.memberCount)??(null==(u=b.metadata)?void 0:u.memberCount),isBusinessTrial:(null==(h=e.metadata)?void 0:h.isBusinessTrial)??(null==(y=b.metadata)?void 0:y.isBusinessTrial),subscriptionTier:(null==(g=e.metadata)?void 0:g.subscriptionTier)??(null==(x=b.metadata)?void 0:x.subscriptionTier)},signals:[...new Set([...b.signals,...e.signals])],groups:[...new Set([...b.groups,...e.groups])],groupDetails:[...new Set([...b.groupDetails,...e.groupDetails])],connectingEntities:[...new Map([...b.connectingEntities,...e.connectingEntities].map(e=>[c(e),e])).values()],trustActioned:j,trustStatuses:v.length>0?v:j?void 0:e.trustStatuses??b.trustStatuses})}if("overview"===i.type||"all"===i.type)for(let e of t.overview)m({...e,entityType:e.relatedEntityType,entityId:e.relatedEntityId,signals:e.signals,groups:[],connectingEntities:[],groupDetails:[]});if("signal"===i.type||"all"===i.type)for(let e of t.relationships){var u;if("signal"===i.type&&e.signalType!==i.signalType)continue;let a={entityType:e.relatedEntityType,entityId:e.relatedEntityId},n=null==(u=t.overview.find(e=>c({entityType:e.relatedEntityType,entityId:e.relatedEntityId})===c(a)))?void 0:u.metadata;m({...a,metadata:n,trustActioned:e.trustActioned,trustStatuses:e.trustStatuses,signals:[e.signalType],groups:[],connectingEntities:[],groupDetails:[]})}if(("all"===i.type||"signal"===i.type)&&t.relationships.some(e=>e.isTruncated&&("all"===i.type||e.signalType===i.signalType)&&!t.groups.some(t=>t.signalType===e.signalType&&t.exactFanout>1)))throw Error("Complete group data is missing for a truncated signal. Refresh the results and retry; no partial CSV was downloaded.");for(let e of t.groups.filter(e=>{switch(i.type){case"overview":return!1;case"group":return e.signalType===i.group.signalType&&e.evidenceKeyHash===i.group.evidenceKeyHash;case"signal":return e.signalType===i.signalType;case"all":return!0}})){let a;if(e.exactFanout<=1)continue;let i=t.groups.filter(t=>t.signalType===e.signalType),s=`${n(e.signalType)}: ${function(e,t){var a,i;let n=e.connectingEntity;if(void 0===n)return`Group ${t+1}`;let r=(null==(a=n.metadata)?void 0:a.name)??(null==(i=n.metadata)?void 0:i.email);return void 0===r?n.entityId:`${r} (${n.entityId})`}(e,i.indexOf(e))}`,d=new Set,p=new Set;do{if(l())throw Error("Export canceled.");let i=await r({entityType:t.focusEntity.entityType,entityId:t.focusEntity.entityId,signalType:e.signalType,evidenceKeyHash:e.evidenceKeyHash,cursor:a,limit:100});if("ready"!==i.state||void 0===t.generatedAt||i.generatedAt!==t.generatedAt)throw Error("The group snapshot changed or is unavailable. Refresh the results and retry; no partial CSV was downloaded.");for(let t of i.members)p.add(c(t)),m({...t,signals:[e.signalType],groups:[s],groupDetail
106s:[`${s}: ${o(e).join(" · ")}`],connectingEntities:e.connectingEntity?[e.connectingEntity]:[]});if(void 0!==(a=i.nextCursor)){if(d.has(a))throw Error("Group pagination did not advance. Refresh the results and retry.");d.add(a)}}while(void 0!==a)if(p.size!==e.exactFanout)throw Error("The group is incomplete. Refresh the results and retry; no partial CSV was downloaded.")}if(l())throw Error("Export canceled.");return(0,a(318851).A)([["entityType","entityId","name","email","creatorEmail","createdAt","memberCount","subscriptionTier","isBusinessTrial","signals","groups","trustActioned","trustStatuses","trustStatusLabels","snapshotGeneratedAt","snapshotState","connectingEntities","groupDetails"],...[...d.values()].map(e=>{var i,r,o,l,d,c,p,m,u;return[e.entityType,(0,a(83388).Xw)(e.entityId),(null==(i=e.metadata)?void 0:i.name)??"",(null==(r=e.metadata)?void 0:r.email)??"",(null==(o=e.metadata)?void 0:o.creatorEmail)??"",(null==(l=e.metadata)?void 0:l.createdAt)??"",(null==(d=e.metadata)?void 0:d.memberCount)??"",(null==(c=e.metadata)?void 0:c.subscriptionTier)??"",(null==(p=e.metadata)?void 0:p.isBusinessTrial)===void 0?"":String(e.metadata.isBusinessTrial),e.signals.map(n).join("; "),e.groups.join("; "),void 0===e.trustActioned?"":String(e.trustActioned),(null==(m=e.trustStatuses)?void 0:m.join("; "))??"",(null==(u=e.trustStatuses)?void 0:u.map(s).join("; "))??(e.trustActioned?"Actioned by Trust":""),t.generatedAt??"",t.state,JSON.stringify(e.connectingEntities.map(e=>{var t;return{...e,trustStatusLabels:null==(t=e.trustStatuses)?void 0:t.map(s)}})),e.groupDetails.join("; ")]})],{escape_formulas:!0})}function c(e){return`${e.entityType}:${(0,a(83388).Xw)(e.entityId)}`}var p=a(440302);function m(e){let{response:t,selectedSignal:r}=e,{announce:s}=(0,a(813367).U)(),o=(0,a(533992).v3)(),[l,c]=(0,i.useState)(!1),[m,u]=(0,i.useState)(),h=(0,i.useRef)(!0),y=(0,i.useRef)(!1);(0,i.useEffect)(()=>(h.current=!0,()=>{h.current=!1}),[]);let g=(0,i.useCallback)(async e=>{if(!y.current){y.current=!0,c(!0),u(void 0);try{let i=await d({response:t,scope:e,isCanceled:()=>!h.current,loadGroupPage:async e=>{let t=await o.api.callApi({eventName:"adminGetRelatedEntityGroupMembers",environment:o,data:e});if("success"!==t.type)throw Error("Could not load the complete list. Retry; no partial CSV was downloaded.");return t.data}});if(!h.current)return;let n=e.type;if("signal"===e.type)n=e.signalType;else if("group"===e.type){let a=t.groups.filter(t=>t.signalType===e.group.signalType);n=`${e.group.signalType}-group-${a.findIndex(t=>t.evidenceKeyHash===e.group.evidenceKeyHash)+1}`}s("CSV export complete."),(0,a(216736).WN)({blob:new Blob([i],{type:"text/csv;charset=utf-8"}),filename:`related-${t.focusEntity.entityType}s-${t.focusEntity.entityId}-${n}.csv`})}catch(e){h.current&&u(e instanceof Error?e.message:"Export failed. Retry; no partial CSV was downloaded.")}finally{y.current=!1,h.current&&c(!1)}}},[s,o,t]),x=[{label:void 0===r?"Overview":`Current tab (${n(r)})`,scope:void 0===r?{type:"overview"}:{type:"signal",signalType:r}},{label:`All related ${t.focusEntity.entityType}s`,scope:{type:"all"}},...t.groups.filter(e=>e.signalType===r).map((e,a)=>({label:`Group ${a+1} (${Math.max(0,e.exactFanout-1)} related ${t.focusEntity.entityType}s)`,scope:{type:"group",group:e}}))];return(0,p.jsxs)(a(4458).VP,{gap:4,children:[(0,p.jsx)(a(656252).d,{popupType:a(656252).z.Popup,trapFocus:!0,originGap:4,alignmentToOrigin:"end",content:e=>(0,p.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,width:260,maxHeight:300,children:(0,p.jsx)(a(558045).A,{type:a(558045).O.Vertical,initialFocus:0,sections:[{key:"export-scopes",render:({children:e})=>e,items:x.map((t,i)=>({key:String(i),render:e=>(0,p.jsx)(a(95582).A,{...e,title:t.label}),action:()=>{e.close(),g(t.scope)}}))}]})}),children:e=>(0,p.jsx)(a(548436).A,{...e,size:"sm",disabled:l,iconTrailing:a(595453).arrowChevronSingleDownSmallIcon,children:l?"Exporting…":"Export CSV"})}),void 0===m?void 0:(0,p.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",role:"status",children:m})]})}function u(e){var t;let{entityType:i,value:n,onChange:o}=e,l=(0,a(48697).objectKeys)(r).filter(e=>{var t;return("banned"===(t=e)||t.startsWith("created_"))===("user"===i)}),d="user"===i?"All users":"All workspaces",c=[{value:"all",label:d},{value:"actioned",label:"Any recorded action"},...l.map(e=>({value:e,label:s(e)}))],m=(null==(t=c.find(e=>e.value===n))?void 0:t.label)??d;return(0,p.jsx)(a(656252).d,{popupType:a(656252).z.Popup,trapFocus:!0,originGap:4,content:e=>(0,p.jsx)(a(747369).A,{menuType:a(649476).gu.Popup,width:300,maxHeight:360,children:(0,p.jsx)(a(558045).A,{type:a(558045).O.Vertical,initialFocus:0,sections:[{key:"enforcement-actions",render:({children:e})=>e,items:c.map(t=>({key:t.value,render:e=>(0,p.jsx)(a(95582).A,{...e,title:t.label,isChecked:n===t.value}),action:()=>{e.close(),o(t.value)}}))}]})}),children:e=>(0,p.jsx)(a(548436).A,{...e,size:"sm",iconTrailing:a(595453).arrowChevronSingleDownSmallIcon,children:"all"===n?d:`Action: ${m}`})})}function h(e,t){var a,i;return"all"===t||("actioned"===t?!0===e.trustActioned||((null==(i=e.trustStatuses)?void 0:i.length)??0)>0:(null==(a=e.trustStatuses)?void 0:a.includes(t))??!1)}let y="admin-related-entities";function g(e){return`${e.entityType}:${(0,a(83388).Xw)(e.entityId)}`}function x(e){var t;let{response:n}=e,{entityType:r,entityId:s}=n.focusEntity,o=function(e){let t={label:"Overview"};switch(e){case"user":return[t,{label:"Email",signalType:"canonical_google_email"},{label:"Payment",signalType:"payment"},{label:"Device",signalType:"client_browser"},{label:"Network",signalType:"signup_network"},{label:"Shared workspaces",signalType:"shared_workspace"},{label:"Email domain",signalType:"shared_uncommon_email_domain"},{label:"hCaptcha device",signalType:"hcaptcha_udid"},{label:"hCaptcha user",signalType:"hcaptcha_user_sig"}];case"workspace":return[t,{label:"Payment",signalType:"payment"},{label:"Shared members",signalType:"shared_member"}]}}(r),l=`${r}:${s}`,[d,c]=(0,i.useState)({entityKey:l,index:0}),[h,y]=(0,i.useState)({entityKey:l,value:"all"}),g=h.entityKey===l?h.value:"all",x=(0,i.useCallback)(e=>{y({entityKey:l,value:e})},[l]),b=d.entityKey===l?d.index:0,v=(0,i.useCallback)(e=>{c({entityKey:l,index:e})},[l]);return(0,p.jsx)(a(577497).Zp,{padding:"lg",borderVariant:"primary",children:(0,p.jsxs)(a(4458).VP,{gap:16,children:[(0,p.jsxs)(a(4458).fI,{gap:16,alignItems:"flex-start",justifyContent:"space-between",flexWrap:"wrap",children:[(0,p.jsxs)(a(4458).VP,{gap:4,flex:1,children:[(0,p.jsx)(a(111010).D,{styleKey:"titleSmSemibold",colorVariant:"primary",children:function(e){switch(e){case"user":return"Related users";case"workspace":return"Related workspaces"}}(r)}),(0,p.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Governed linkage signals for investigation. Review the evidence before taking action."})]}),("ready"===n.state||"stale"===n.state)&&(n.overview.length>0||n.groups.length>0)?(0,p.jsx)(m,{response:n,selectedSignal:null==(t=o[b])?void 0:t.signalType},`${l}:${n.generatedAt}`):void 0]}),"ready"===n.state||"stale"===n.state?(0,p.jsx)(a(4458).fI,{children:(0,p.jsx)(u,{entityType:r,value:g,onChange:x})}):void 0,(0,p.jsx)(f,{entityId:s,entityType:r,response:n,tabs:o,selectedTabIndex:b,onSelectTab:v,enforcementFilter:g})]})})}function f(e){let{entityId:t,entityType:i,onSelectTab:n,enforcementFilter:r,response:s,selectedTabIndex:o,tabs:l}=e;if("not_materialized"===s.state)return(0,p.jsx)(k,{children:"Related-entity data has not been materialized for this entity yet."});if("unavailable"===s.state)return(0,p.jsx)(j,{});if("complete_with_no_matches"===s.state)return(0,p.jsx)(k,{children:"The latest materialization found no related entities."});if("stale"===s.state&&0===s.overview.length)return(0,p.jsxs)(a(4458).VP,{gap:8,children:[(0,p.jsx)(v,{}),(0,p.jsx)(k,{children:"The latest materialization found no related entities."})]});let d=l[o]??l[0],c=null==d?void 0:d.signalType,m=void 0===c?[]:s.relationships.filter(e=>e.signalType===c),u=void 0===c?[]:s.groups.filter(e=>e.signalType===c);return(0,p.jsxs)(a(4458).VP,{gap:16,children:["stale"===s.state?(0,p.jsx)(v,{}):void 0,(0,p.jsx)(a(211300).V,{ariaLabel:"Related entity signals",tabs:l,selectedIndex:o,onSelect:n,tabIdPrefix:y}),(0,p.jsx)(a(4458).VP,{gap:16,role:"tabpanel",id:(0,a(380521).J)(y,o),"aria-labelledby":`${y}-tab-${o}`,children:(0,p.jsx)(b,{enforcementFilter:r,generatedAt:s.generatedAt,entityType:i,entity
106Id:t,selectedSignal:c,overview:s.overview,relationships:m,groups:u})})]})}function b(e){let{entityId:t,entityType:a,groups:i,overview:n,relationships:r,selectedSignal:s,enforcementFilter:o}=e;return void 0===s?(0,p.jsx)(S,{overview:n.filter(e=>h(e,o))}):0===i.length?(0,p.jsx)(w,{relationships:r.filter(e=>h(e,o)),overview:n}):(0,p.jsx)(C,{generatedAt:e.generatedAt,enforcementFilter:o,entityType:a,entityId:t,groups:i},`${a}:${t}:${s}:${e.generatedAt}:${o}`)}function v(){return(0,p.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"yellow",colorVariant:"accentPrimary",children:"This snapshot is more than 5 days old. Treat it as stale investigation context."})}function j(){return(0,p.jsx)(k,{children:"Related-entity data is unavailable. The rest of this Admin view is unaffected."})}function k(e){let{children:t}=e;return(0,p.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:t})}function S(e){let{overview:t}=e;return(0,p.jsx)(a(4458).VP,{gap:8,children:t.map(e=>{let t=g({entityType:e.relatedEntityType,entityId:e.relatedEntityId});return(0,p.jsx)(I,{entity:{entityType:e.relatedEntityType,entityId:e.relatedEntityId},metadata:e.metadata,details:`Signals: ${e.signals.map(n).join(", ")}`,trustActioned:e.trustActioned,trustStatuses:e.trustStatuses},t)})})}function w(e){let{overview:t,relationships:i}=e;return 0===i.length?(0,p.jsx)(k,{children:"No relationships found for this signal."}):(0,p.jsx)(a(4458).VP,{gap:8,children:i.map(e=>{let a=g({entityType:e.relatedEntityType,entityId:e.relatedEntityId}),i=t.find(t=>t.relatedEntityType===e.relatedEntityType&&t.relatedEntityId===e.relatedEntityId);return(0,p.jsx)(I,{entity:{entityType:e.relatedEntityType,entityId:e.relatedEntityId},metadata:null==i?void 0:i.metadata,trustActioned:e.trustActioned,trustStatuses:e.trustStatuses},`${e.signalType}:${a}`)})})}function I(e){let{details:t,entity:i,metadata:n,trustActioned:r,trustStatuses:o}=e,l=(null==n?void 0:n.name)??(null==n?void 0:n.email)??i.entityId,d=function(e,t){if(void 0===t)return;let a=[e.entityId];if("user"===e.entityType)return a.join(" · ");if(void 0!==t.memberCount){let e=1===t.memberCount?"member":"members";a.push(`${t.memberCount} ${e}`)}return void 0!==t.subscriptionTier&&a.push(t.isBusinessTrial?`${t.subscriptionTier} (trial)`:t.subscriptionTier),void 0!==t.createdAt&&a.push(`Created ${t.createdAt.slice(0,10)}`),void 0!==t.creatorEmail&&a.push(`by ${t.creatorEmail}`),a.join(" · ")}(i,n),c=(0,a(83388).G2)(i.entityId),m="user"===i.entityType?(0,a(185612).X8)(c):(0,a(185612).sZ)(c);return(0,p.jsxs)(a(4458).VP,{paddingBlock:8,minWidth:0,gap:2,children:[(0,p.jsx)(a(4458).fI,{children:(0,p.jsx)(a(68774).N,{href:m,external:!0,className:"notion-link-blue",children:(0,p.jsxs)(a(4458).fI,{gap:4,alignItems:"center",flexWrap:"wrap",children:[(0,p.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorVariant:"primary",children:l}),"user"===i.entityType&&null!=n&&n.email&&n.email!==l?(0,p.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:n.email}):void 0,(0,p.jsx)(a(16275).I,{icon:a(166568).arrowUpRightSquareSmallIcon,size:"sm",colorVariant:"secondary"}),(0,p.jsx)("span",{style:a(69916).Qg,children:" opens in new tab"})]})})}),(0,p.jsxs)(a(4458).fI,{gap:4,alignItems:"center",flexWrap:"wrap",children:[null==o?void 0:o.map(e=>(0,p.jsx)(a(746434).E,{content:s(e)},e)),r&&void 0===o?(0,p.jsx)(a(746434).E,{content:"Actioned by Trust"}):void 0,d?(0,p.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:d}):void 0]}),t?(0,p.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:t}):void 0]})}function C(e){return(0,p.jsx)(a(4458).VP,{gap:8,children:e.groups.map((t,a)=>(0,p.jsx)(D,{enforcementFilter:e.enforcementFilter,group:t,index:a,entityId:e.entityId,entityType:e.entityType,generatedAt:e.generatedAt},t.evidenceKeyHash))})}function D(e){var t,r,d,c;let{group:m,index:u,entityId:y,entityType:x,generatedAt:f,enforcementFilter:b}=e,v=(0,a(533992).v3)(),{announce:j}=(0,a(813367).U)(),[S,w]=(0,i.useState)(!1),[C,D]=(0,i.useState)({type:"idle"}),A=(0,i.useRef)(!0),N=(0,i.useRef)(!1),M=(0,i.useRef)(new Set),P=(0,i.useRef)(null),V=(0,i.useRef)(null),E=(0,i.useRef)(null),B=(0,i.useRef)(!1),L=(0,i.useId)(),_=(0,i.useId)(),U=g({entityType:x,entityId:y}),W="idle"===C.type?[]:C.members.filter(e=>g(e)!==U&&h(e,b)),F=m.connectingEntity,K=l(m),$=(null==F||null==(t=F.metadata)?void 0:t.name)??(null==F||null==(r=F.metadata)?void 0:r.email)??(null==F?void 0:F.entityId),O=K;!S&&$&&(O=K&&$!==K?`${$} (${K})`:$);let z=`Group ${u+1} \xb7 ${Math.max(0,m.exactFanout-1)} related ${x}
106s${"all"===b?"":" (before filtering)"}`;(0,i.useEffect)(()=>(A.current=!0,()=>{A.current=!1}),[]);let G=(0,i.useCallback)(async(e,t,i=!1)=>{var n,r;if(!N.current){N.current=!0,B.current=i||((null==(n=P.current)?void 0:n.contains(document.activeElement))??!1),D({type:"loading",members:t,cursor:e});try{let a=e,i=t,n=new Set,s="all"!==b;for(;;){let o=await v.api.callApi({eventName:"adminGetRelatedEntityGroupMembers",environment:v,data:{entityType:x,entityId:y,signalType:m.signalType,evidenceKeyHash:m.evidenceKeyHash,cursor:a,limit:s?100:10}});if(!A.current)return;if("success"!==o.type||"unavailable"===o.data.state)return void D({type:"failed",members:t,retryCursor:e});if("not_materialized"===o.data.state)return void D({type:"not_materialized",members:t});if(void 0!==f&&void 0!==o.data.generatedAt&&o.data.generatedAt!==f)return void D({type:"snapshot_changed",members:t});if("stale"===o.data.state)return void D({type:"stale",members:t,retryCursor:e});let l=o.data.nextCursor;if(void 0!==l&&(l===a||M.current.has(l)||n.has(l)))throw Error("Group pagination did not advance.");if(void 0!==a&&n.add(a),i=[...new Map([...i,...o.data.members].map(e=>[g(e),e])).values()],s&&(i.length>m.exactFanout||void 0===l&&i.length!==m.exactFanout))throw Error("The group is incomplete; filtering cannot confirm all matches.");if(s&&void 0!==l){a=l;continue}let d=null==(r=i.find(e=>g(e)!==g({entityId:y,entityType:x})&&h(e,b)&&!t.some(t=>g(t)===g(e))))?void 0:r.entityId;for(let e of n)M.current.add(e);D({type:"loaded",firstAppendedEntityId:d,members:i,nextCursor:l});break}}catch(i){if(!A.current)return;(0,a(208318).t)().log({level:"warning",from:"RelatedEntitiesSection",type:"groupLoadFailed",error:(0,a(952977).convertErrorToLog)(i)}),D({type:"failed",members:t,retryCursor:e})}finally{N.current=!1}}},[y,x,v,f,m.evidenceKeyHash,m.exactFanout,m.signalType,b]);(0,i.useEffect)(()=>{var e,t;if(!S||"loading"===C.type||!B.current)return;B.current=!1;let a=document.activeElement;(a===document.body||null===a||null!=(e=P.current)&&e.contains(a))&&("loaded"===C.type&&E.current?E.current.focus():null==(t=V.current)||t.focus())},[S,C]);let q=(0,i.useCallback)(()=>{w(!S),S&&(B.current=!1),S||"idle"!==C.type||G(void 0,[])},[S,G,C.type]),H=(0,i.useCallback)(()=>{S&&"loaded"===C.type&&void 0!==C.nextCursor&&G(C.nextCursor,C.members)},[S,G,C]),Z=(0,i.useCallback)(()=>{("failed"===C.type||"stale"===C.type)&&G(C.retryCursor,C.members,!0)},[G,C]);return(0,i.useEffect)(()=>{S&&("loading"===C.type?j(`Loading group ${u+1}…`):"loaded"===C.type?j(`${W.length} related ${x}s loaded in group ${u+1}.`):"snapshot_changed"===C.type?j("Snapshot changed. Rerun the lookup to refresh the results."):("failed"===C.type||"stale"===C.type)&&j(`Group ${u+1} could not load. Retry is available.`))},[j,S,u,x,W.length,C.type]),(0,p.jsx)(a(577497).Zp,{padding:"sm",borderVariant:"secondary",children:(0,p.jsxs)(a(4458).VP,{gap:8,children:[(0,p.jsx)(a(4458).fI,{children:(0,p.jsx)(a(988022).p,{id:_,ref:V,size:"md",onClick:q,"aria-expanded":S,"aria-controls":L,iconLeading:S?a(595453).arrowChevronSingleDownSmallIcon:a(491469).arrowChevronSingleRightSmallIcon,children:z})}),(0,p.jsxs)(a(4458).VP,{gap:4,paddingInlineStart:24,children:[(0,p.jsxs)(a(4458).fI,{gap:4,flexWrap:"wrap",alignItems:"center",children:[(0,p.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",style:{overflowWrap:"anywhere",minWidth:0},children:`Connecting ${"shared_workspace"===(c=m.signalType)?"workspace":"shared_member"===c?"user":"hcaptcha_udid"===c||"hcaptcha_user_sig"===c?n(c):n(c).toLowerCase()}${O?`: ${O}`:""}`}),S||null==F||null==(d=F.trustStatuses)?void 0:d.slice(0,2).map(e=>(0,p.jsx)(a(746434).E,{content:s(e)},e))]}),S?(0,p.jsxs)(a(4458).VP,{id:L,role:"region","aria-labelledby":_,gap:8,children:[void 0===F?(0,p.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",style:{overflowWrap:"anywhere"},children:o(m).filter(e=>!e.startsWith("Identifier:")).join(" · ")}):(0,p.jsxs)(a(4458).VP,{gap:8,children:[(0,p.jsx)(I,{entity:F,metadata:F.metadata,trustActioned:F.trustActioned,trustStatuses:F.trustStatuses}),(0,p.jsx)(a(346268).c,{size:1})]}),W.map(e=>(0,p.jsx)(a(4458).VP,{tabIndex:-1,ref:"loaded"===C.type&&e.entityId===C.firstAppendedEntityId?E:void 0,children:(0,p.jsx)(I,{entity:e,metadata:e.metadata,trustActioned:e.trustActioned,trustStatuses:e.trustStatuses})},g(e))),"loaded"===C.type&&0===W.length&&void 0===C.nextCursor?(0,p.jsx)(k,{children:"all"===b?`No related ${x}
106s found.`:"No members match this enforcement action."}):void 0,(0,p.jsx)(R,{entityType:x,stateType:C.type,onRetry:Z}),"loaded"===C.type&&void 0!==C.nextCursor||"loading"===C.type&&void 0!==C.cursor?(0,p.jsxs)(a(4458).fI,{ref:P,children:[(0,p.jsx)(a(988022).p,{size:"sm",colorVariant:"secondary",disabled:"loading"===C.type,onClick:H,children:"loading"===C.type?"Loading…":"Load more"}),"loaded"===C.type?(0,p.jsx)(T,{onLoad:H},C.nextCursor):void 0]}):void 0]}):void 0]})]})})}function T(e){let{onLoad:t}=e,[n,r]=(0,a(68740).P)();return(0,i.useEffect)(()=>{r&&t()},[t,r]),(0,p.jsx)(a(4458).fI,{ref:n,width:1,"aria-hidden":"true",children:null})}function R(e){let{entityType:t,onRetry:i,stateType:n}=e;switch(n){case"loading":return(0,p.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,p.jsx)(a(517334).k,{size:"sm"}),(0,p.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"secondary",children:`Loading related ${t}s…`})]});case"failed":return(0,p.jsx)(N,{entityType:t,onRetry:i});case"stale":return(0,p.jsx)(A,{entityType:t,onRetry:i});case"snapshot_changed":return(0,p.jsx)(k,{children:"This snapshot changed. Close these results and rerun the lookup to refresh all groups."});case"not_materialized":return(0,p.jsx)(k,{children:"This signal group is not materialized."});case"idle":case"loaded":return null}}function A(e){let{entityType:t,onRetry:i}=e;return(0,p.jsxs)(a(4458).VP,{gap:8,children:[(0,p.jsx)(k,{children:`Related ${t}s are stale. Retry to refresh this group.`}),(0,p.jsx)(a(4458).fI,{children:(0,p.jsx)(a(548436).A,{size:"sm",onClick:i,children:"Retry"})})]})}function N(e){let{entityType:t,onRetry:i}=e;return(0,p.jsxs)(a(4458).VP,{gap:8,children:[(0,p.jsx)(k,{children:`Related ${t}s are unavailable.`}),(0,p.jsx)(a(4458).fI,{children:(0,p.jsx)(a(548436).A,{size:"sm",onClick:i,children:"Retry"})})]})}},554577(e,t,a){a(159952),a(635790);var i=a(440302);let n={card:{padding:16,background:a(632079).Tj.background.primary,border:`1px dashed ${a(632079).Tj.border.primary}`,borderRadius:8},bullet:{width:4,height:4,borderRadius:4,background:a(632079).Tj.border.primary,flexShrink:0}};function r({title:e,description:t,items:s}){return(0,i.jsx)("div",{style:n.card,children:(0,i.jsxs)(a(4458).VP,{gap:8,children:[(0,i.jsx)(a(111010).D,{styleKey:"captionSemibold",colorVariant:"secondary",children:e}),(0,i.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"tertiary",children:t}),s&&s.length>0?(0,i.jsx)(a(4458).VP,{gap:4,children:s.map(e=>(0,i.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,i.jsx)("div",{style:n.bullet}),(0,i.jsx)(a(111010).D,{styleKey:"captionSm",colorVariant:"tertiary",children:e})]},e))}):void 0]})})}a.d(t,{A:()=>r})},626802(e,t,a){let i="Unknown";function n(e){return(null==e?void 0:e.enabled)===void 0?i:e.enabled?"Enabled":"Not enabled"}function r(e){switch(null==e?void 0:e.creationPolicy){case"all_workspace_members":return"All workspace members";case"workspace_owners_only":return"Workspace owners only";case"custom":return"Workspace owners + added groups only";case"disabled":return"Disabled";case void 0:return i}}a.d(t,{X:()=>r,s:()=>n})},591977(e,t,a){let i="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",n=`${i},${i}`,r="[email protected]",s=`${r},${r}`;a.d(t,{},{Gb:n,I3:s,cs:"cus_xxxxxxxxxxxxxx",hT:"sub1.example.com,sub2.example.com",mT:"subdomain.example.com",nZ:i,r1:"https://makenotion.zendesk.com/agent/tickets/xxxxxxx",zg:r})},743187(e,t,a){a(533958);var i=a(635790);let n=(0,i.createContext)(void 0);n.displayName="AdminPermissionsContext";let r=n.Provider;function s(){let e=(0,i.useContext)(n);if(void 0===e)throw Error("No context provided: AdminPermissionsStore");return e}a.d(t,{g:()=>s},{e:r})},431917(e,t,a){a.r(t),a.d(t,{AdminPermissionsProvider:()=>n}),a(635790),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(159952);var i=a(440302);function n({children:e}){let t,r,s=(0,a(579993).uB)(void 0,a(913657).A);return!function(e){let t=(0,a(533992).v3)(),i=(0,a(579993).K8)(()=>void 0,[!1]),[n,r]=(0,a(579993).K8)(()=>{let e=(0,a(427846)._)(t);return[null==e?void 0:e.isDefined(),null==e?void 0:e.id]},[t]);(0,a(97668).Yb)(async()=>{let i;if(!n||void 0===r){let t=e.state;(void 0!==t.currentUserPermissions||t.fetchPermissionsErrored||void 0!==t.cache.currentUserPermissionsRequestTarget||void 0!==t.cache.currentUserPermissionsTarget)&&e.setState(e.getInitialState());return}let s={localRoleName:i,userId:r},o=e.state,l=(0,a(913657).w)(o.cache.currentUserPermissionsRequestTarget,s);if((0,a(913657).w)(o.cache.currentUserPermissionsTarget,s)){if(void 0!==o.currentUserPermissions||l)return;e.setState({...o,cache:{...o.cache,currentUserPermissionsRequestTarget:s},fetchPermissionsErrored:!1,fetchPermissionsErrorStatus:void 0})}else e.setState({...o,cache:{...o.cache,currentUserPermissionsRequestTarget:s,currentUserPermissionsTarget:s},currentUserPermissions:void 0,fetchPermissionsErrored:!1,fetchPermissionsErrorStatus:void 0});let d={__adminUISource:"admin_permissions_bootstrap",...void 0!==i?{localAdminRoleName:i}:{}},c=await t.api.callApi({eventName:"adminGetCurrentUserPermissions",environment:t,data:d});if((0,a(913657).w)(e.state.cache.currentUserPermissionsTarget,s)&&1)if("failed"===c.type)e.setState({...e.state,cache:{...e.state.cache,currentUserPermissionsRequestTarget:void 0},fetchPermissionsErrored:!0,fetchPermissionsErrorStatus:c.status});else{let t=c.data.permissions?new Set(c.data.permissions):void 0;e.setState({...e.state,cache:{...e.state.cache,currentUserPermissionsRequestTarget:void 0,currentUserPermissionsTarget:s},currentUserPermissions:t,fetchPermissionsErrored:!1,fetchPermissionsErrorStatus:void 0})}},[n,e,t,!1,i,r]),(0,a(97668).Yb)(async()=>
106{if(!n||void 0!==e.state.apiOwnershipMap||e.state.cache.apiOwnershipRequestInFlight)return;e.setState({...e.state,cache:{...e.state.cache,apiOwnershipRequestInFlight:!0}});let a=await t.api.callApi({eventName:"adminGetOwnership",environment:t,data:{__adminUISource:"admin_permissions_bootstrap"}});"failed"===a.type?e.setState({...e.state,cache:{...e.state.cache,apiOwnershipRequestInFlight:!1}}):a&&e.setState({...e.state,apiOwnershipMap:a.data,cache:{...e.state.cache,apiOwnershipRequestInFlight:!1}})},[n,e,t])}(s),t=(0,a(533992).v3)(),r=(0,a(579993).K8)(()=>{var e;return null==(e=(0,a(427846)._)(t))?void 0:e.isDefined()},[t]),(0,a(97668).Yb)(async()=>{},[r,!1,s,t]),(0,i.jsx)(a(743187).e,{value:s,children:e})}},913646(e,t,a){let i=new(a(552709)).O2("AdminJsonEditor",async()=>{let[e,t,i]=await Promise.all([Promise.all([a.e(2243),a.e(54777)]).then(a.bind(a,187471)).then(e=>e.default),a.e(46197).then(a.bind(a,551922)).then(e=>e.loader),Promise.all([a.e(46197),a.e(66646)]).then(a.bind(a,54951))]);return t.config({monaco:e}),i}),n=(0,a(552709)._h)(i,e=>e.AdminJsonEditor);a.d(t,{},{J:n})},503270(e,t,a){let i=new(a(552709)).O2("AdminReactJson",async()=>Promise.all([a.e(38559),a.e(88405),a.e(90776)]).then(a.bind(a,842179))),n=(0,a(552709)._h)(i,e=>e.AdminReactJson);a.d(t,{},{H:n})},315965(e,t,a){function i(e){let{sectionName:t,currentUserPermissions:i,environmentName:n,showToolsWithoutPermission:r}=e;return void 0===i||"toolProxy"!==t||i.has(a(604063).US)&&(r||(0,a(851900).vv)(i,n).length>0)}a.d(t,{s:()=>i})},185612(e,t,a){function i(e,t){let a=new URLSearchParams(t);return`${e}?${a.toString()}`}function n(e,t){return(null==e?void 0:e.has(t))===!0}function r(e){return i(a(168962).JZ.adminUnifiedUserView,{userId:e})}function s(e){return i(a(168962).JZ.adminUnifiedWorkspaceView,{spaceId:e})}function o(e,t){return`${a(168962).JZ.admin}/${e}/${encodeURIComponent(t)}`}function l(e){let{table:t,recordId:a}=e;return o(t,a)}function d(e){let{table:t,objectId:i,currentUserPermissions:l}=e;return t===a(832375).oo9&&n(l,"adminSearchUsers")?r(i):"space"===t&&n(l,"adminSearchSpaces")?s(i):o(t,i)}function c(e){let t=e.trim();if(t)return t.includes("@")?i(a(168962).JZ.adminUnifiedUserView,{userEmail:t}):t.startsWith("cus_")?i(a(168962).JZ.adminUnifiedWorkspaceView,{q:t}):`${a(168962).JZ.adminObject}/${encodeURIComponent(t)}`}a(176765),a(851344),a(866491),a.d(t,{AI:()=>c,X8:()=>r,YV:()=>l,oS:()=>d,sZ:()=>s})},47602(e,t,a){function i(e,t){return(0,a(579993).K8)(()=>{let{currentUserPermissions:i,fetchPermissionsErrored:n}=e.state;if(n)return!1;if(void 0===i)return;let r=a(688211)._P[t];return(0,a(688211).qO)(r)&&i.has((0,a(688211).JZ)(r))},[e,t])}a.d(t,{S:()=>i})},714289(e,t,a){a.d(t,{J:()=>r});var i=a(635790);let n=new(a(246382)).R({key:"adminAccordionExpansionPreferences",namespace:a(274919).Bq,important:!1,trackingType:"preference"});function r(e){let{title:t,defaultExpanded:r}=e,s=(0,a(579993).K8)(()=>n.state??{},[]),o=`${window.location.pathname}:${t}`,[l,d]=(0,i.useState)(void 0),c=l??s[o]??r,p=(0,i.useCallback)(()=>{let e=!c;d(e),n.update(t=>({...t??{},[o]:e}))},[c,o]);return{isExpanded:c,toggleExpansion:p}}},450092(e,t,a){let i=new(a(246382)).R({key:"adminLocalRole",namespace:a(274919).Bq,important:!1,trackingType:"preference"});a.d(t,{},{_:i})},913657(e,t,a){var i=()=>a(546605);function n(e,t){return void 0===e||void 0===t?e===t:e.localRoleName===t.localRoleName&&e.userId===t.userId}class r extends i().Store{getInitialState(){return{apiOwnershipMap:void 0,cache:{apiOwnershipRequestInFlight:!1,currentUserPermissionsRequestTarget:void 0,currentUserPermissionsTarget:void 0,localRoleNames:void 0,localRoleNamesFetchErrored:!1},currentUserPermissions:void 0,fetchPermissionsErrored:!1,fetchPermissionsErrorStatus:void 0}}}a.d(t,{w:()=>n},{A:r})},198074(e,t,a){let i=new(a(246382)).R({key:"adminShowToolsWithoutPermission",
106namespace:a(274919).Bq,important:!1,trackingType:"preference"});a.d(t,{},{a:i})},235658(e,t,a){let i=new(a(246382)).R({key:"adminShowFormattedTimestamps",namespace:a(274919).Bq,important:!1,trackingType:"preference"});a.d(t,{},{K:i})},718473(e,t,a){let i=new(a(246382)).R({key:"adminShowUuidDashes",namespace:a(274919).Bq,important:!1,trackingType:"preference"});a.d(t,{},{N:i})},221161(e,t,a){a.r(t);var i=a(635790),n=a(440302);function r(e){let{executionId:t}=e,r=(0,a(533992).v3)(),c=(0,a(734944).Ng)(),[p,m]=(0,i.useState)({executionId:t,type:"loading"}),[u,h]=(0,i.useState)(void 0),y=p.executionId===t?p:void 0,g=u===t;(0,i.useEffect)(()=>{m({executionId:t,type:"loading"}),s({environment:r,executionId:t}).then(e=>{m(a=>a.executionId===t?o(t,e):a)})},[r,t]),(0,i.useEffect)(()=>{if(g||(null==y?void 0:y.type)!=="loaded"||!(0,a(734944).Ic)(y.run.status))return;let e=!0,i=window.setTimeout(()=>{s({environment:r,executionId:t}).then(a=>{e&&m(e=>l({current:e,executionId:t,result:a}))})},3e3);return()=>{e=!1,window.clearTimeout(i)}},[y,r,t,g]);let x=(0,i.useCallback)(()=>{h(t),s({environment:r,executionId:t}).then(e=>{m(a=>l({current:a,executionId:t,result:e}))}).finally(()=>{h(e=>e===t?void 0:e)})},[r,t]);return(0,n.jsx)(a(45062).A,{title:"Tool Proxy Run - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"toolProxy",children:(0,n.jsxs)("div",{...{className:"xapjn7j xvc5jky x11t971q x13jy36j x64bnmy x1miatn0 x1gan7if x78zum5 xdt5ytf x1kb72lq x18hwk67"},children:[(0,n.jsx)("a",{href:a(734944).FO,onClick:e=>c(a(734944).FO,e),...{className:"xqcrz7y x1hl2dhg xt0b8zv x1b8rd1j x1ypdohk"},children:(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:"← Run history"})}),void 0===y||"loading"===y.type?(0,n.jsx)(a(4458).fI,{justifyContent:"center",padding:48,children:(0,n.jsx)(a(517334).k,{size:28})}):"failed"===y.type?(0,n.jsx)("div",{...{className:"x78zum5 x1b8z93w x1amjocr x6hnrot xcjx3il x5m9n4a x16skee8 xjqs0th x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:(0,n.jsxs)(a(4458).VP,{gap:8,alignItems:"flex-start",children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:y.error}),(0,n.jsx)(a(988022).p,{size:"sm",colorPalette:"gray",onClick:x,disabled:g,children:g?"Refreshing…":"Refresh"})]})}):(0,n.jsxs)(n.Fragment,{children:[void 0!==y.refreshError?(0,n.jsx)("div",{...{className:"x78zum5 x1b8z93w x1amjocr x6hnrot xcjx3il x5m9n4a x16skee8 xjqs0th x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:`Couldn't refresh: ${y.refreshError}`})}):null,(0,n.jsx)(d,{run:y.run,onRefresh:x,isRefreshing:g})]})]})})})}async function s(e){let{environment:t,executionId:i}=e;if((0,a(689934).Cd)()){let e=(0,a(689934).S$)(i);return void 0===e?{type:"failed",error:"Run not found."}:{type:"success",run:e}}let n=await t.api.callApi({eventName:"adminGetToolProxyRun",environment:t,data:{executionId:i}});return"success"===n.type?{type:"success",run:n.data.run}:{type:"failed",error:(0,a(201790).V4)(n)}}function o(e,t){return"success"===t.type?{executionId:e,type:"loaded",run:t.run}:{executionId:e,type:"failed",error:t.error}}function l(e){let{current:t,executionId:a,result:i}=e;return t.executionId!==a?t:"success"===i.type?o(a,i):"loaded"===t.type?{...t,refreshError:i.error}:o(a,i)}function d({run:e,onRefresh:t,isRefreshing:i}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{...{className:"x78zum5 xdt5ytf x3pnbk8 xfex06f"},children:[(0,n.jsxs)("div",{...{className:"x78zum5 x6s0dn4 x1qughib xp1r0qw xtqikln"},children:[(0,n.jsxs)("div",{...{className:"x78zum5 x6s0dn4 x3pnbk8 xfex06f x1a02dak xeuugli"},children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSemibold",colorVariant:"primary",children:e.toolId}),(0,n.jsx)(a(734944).VO,{status:e.status,dryRun:e.dryRun})]}),(0,n.jsx)(a(988022).p,{size:"sm",colorPalette:"gray",onClick:t,disabled:i,children:i?"Refreshing…":"Refresh"})]}),(0,n.jsxs)("div",{...{className:"x78zum5 x6s0dn4 x3pnbk8 xfex06f x1a02dak"},children:[(0,n.jsx)(a(111010).D,{...{className:"xmzfycu"},styleKey:"captionRegular",colorVariant:"tertiary",children:e.executionId}),(0,n.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:"·"}),(0,n.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",title:(0,a(734944).is)(e.startedAt),children:`Started ${(0,a(734944).Z2)(e.startedAt)}`})]})]}),void 0!==e.error?(0,n.jsxs)("div",{...{className:"x78zum5 x1b8z93w x1amjocr x6hnrot xcjx3il x5m9n4a x16skee8 xjqs0th x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:[(0,n.jsx)(a(16275).I,{icon:a(50171).exclamationMarkTri
106angleSmallIcon,size:16,colorPalette:"red",colorVariant:"accentPrimary",...{className:"xvijh9v x2lah0s"}}),(0,n.jsxs)("div",{...{className:"x78zum5 xdt5ytf x1r0jzty x17zd0t2 xeuugli"},children:[(0,n.jsx)(a(111010).D,{styleKey:"bodySmMedium",colorPalette:"red",colorVariant:"accentPrimary",children:e.error.errorName}),void 0!==e.error.safeMessage?(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"primary",children:e.error.safeMessage}):null,void 0!==e.error.failureCode?(0,n.jsx)(a(111010).D,{...{className:"xmzfycu"},styleKey:"captionRegular",colorVariant:"tertiary",children:e.error.failureCode}):null]})]}):null,(0,n.jsxs)("section",{...{className:"x78zum5 xdt5ytf xp1r0qw xtqikln xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:[(0,n.jsx)(a(111010).D,{className:"xtvhhri x1dgsrnt",styleKey:"captionMedium",colorVariant:"secondary",children:"Details"}),(0,n.jsxs)("dl",{...{className:"xrvj5dj x1rfa8br xgpatz3 x40hh3e xdj266r x14z9mp xat24cr x1lziwak"},children:[(0,n.jsx)(c,{label:"Execution ID",value:e.executionId,isMono:!0}),(0,n.jsx)(c,{label:"Run by",value:e.userEmail}),(0,n.jsx)(c,{label:"Started",value:(0,a(734944).is)(e.startedAt)}),(0,n.jsx)(c,{label:"Completed",value:(0,a(734944).is)(e.completedAt)}),(0,n.jsx)(c,{label:"Duration",value:(0,a(734944).wP)(e.startedAt,e.completedAt)})]})]}),void 0!==e.progress?(0,n.jsxs)("section",{...{className:"x78zum5 xdt5ytf xp1r0qw xtqikln xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:[(0,n.jsx)(a(111010).D,{className:"xtvhhri x1dgsrnt",styleKey:"captionMedium",colorVariant:"secondary",children:"Progress"}),(0,n.jsx)(a(111010).D,{...{className:"x126k92a"},styleKey:"bodySm",colorVariant:"primary",children:[e.progress.phase,e.progress.status,e.progress.message].filter(e=>void 0!==e&&""!==e).join("  ·  ")}),void 0!==e.progress.details?(0,n.jsx)(a(243119).A,{data:e.progress.details,hideHelp:!0}):null]}):null,void 0!==e.debugInfo?(0,n.jsxs)("section",{...{className:"x78zum5 xdt5ytf xp1r0qw xtqikln xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:[(0,n.jsx)(a(111010).D,{className:"xtvhhri x1dgsrnt",styleKey:"captionMedium",colorVariant:"secondary",children:"Debug info"}),(0,n.jsx)(a(243119).A,{data:{debugInfo:e.debugInfo},hideHelp:!0})]}):null]})}function c({label:e,value:t,isMono:i}){return(0,n.jsxs)("div",{...{className:"x78zum5 xdt5ytf xpse7mg x1ihrfj4 xeuugli"},children:[(0,n.jsx)(a(111010).D,{className:"xdj266r x14z9mp xat24cr x1lziwak xtvhhri x1dgsrnt",as:"dt",styleKey:"captionRegular",colorVariant:"tertiary",children:e}),(0,n.jsx)(a(111010).D,{...{0:{className:"xdj266r x14z9mp xat24cr x1lziwak x13faqbe"},1:{className:"xdj266r x14z9mp xat24cr x1lziwak x13faqbe xmzfycu"}}[0|!!i],as:"dd",styleKey:"bodySmMedium",colorVariant:"primary",children:t})]})}a.d(t,{AdminToolProxyRunDetailPage:()=>r})},196353(e,t,a){a.r(t),a(730330),a(159952),a(765324);var i=a(635790),n=a(440302);function r(){let e=(0,a(533992).v3)(),t=(0,a(734944).Ng)(),[r,o]=(0,i.useState)([]),[l,d]=(0,i.useState)(!1),[c,p]=(0,i.useState)(!0),[m,u]=(0,i.useState)(!1),[h,y]=(0,i.useState)(void 0),g=(0,i.useRef)(0),[x,f]=(0,i.useState)(0),b=(0,i.useCallback)(async t=>{let i=++g.current;if(y(void 0),(0,a(689934).Cd)()){let e=(0,a(689934).TL)({limit:t});o(e.runs),d(e.hasMore);return}let n=await e.api.callApi({eventName:"adminListToolProxyRuns",environment:e,data:{limit:t}});i===g.current&&("success"===n.type?(o(n.data.runs),d(n.data.hasMore)):y((0,a(201790).V4)(n)))},[e]);(0,i.useEffect)(()=>{b(50).finally(()=>p(!1))},[b]);let v=r.some(e=>(0,a(734944).Ic)(e.status));(0,i.useEffect)(()=>{if(!v||c||m)return;let e=window.setTimeout(()=>{b(Math.max(r.length,50)).finally(()=>f(e=>e+1))},3e3);return()=>window.clearTimeout(e)},[v,c,m,b,x,r.length]);let j=(0,i.useCallback)(()=>{u(!0),b(r.length+50).finally(()=>u(!1))},[b,r.length]);return(0,n.jsx)(a(45062).A,{title:"Tool Proxy Runs - Notion Admin",children:(0,n.jsx)(a(220952).U,{currentSection:"toolProxy",children:(0,n.jsxs)("div",{...{className:"xapjn7j xvc5jky x11t971q x13jy36j x64bnmy x1miatn0 x1gan7if x78zum5 xdt5ytf x1kb72lq x18hwk67"},children:[(0,n.jsx)("a",{href:a(734944).Eq,onClick:e=>t(a(734944).Eq,e),...{className:"xqcrz7y x3nfvp2 x6s0dn4 x1r0jzty x17zd0t2 x1hl2dhg xt0b8zv x1b8rd1j x1ypdohk"},children:(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:"← Tool Proxy"})}),(0,n.jsxs)(a(4458).VP,{gap:4,children:[(0,n.jsx)(a(111010).D,{styleKey:"titleSemibold",colorVariant:"primary",children:"Run history"}),(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"Scripts you've run through the Tool Proxy, newest first."})]}),(0,n.jsx)(s,{runs:r,isLoading:c,isLoadingMore:m,error:h,hasMore:l,onShowMore:j})]})})})}function s({runs:e,isLoading:t,isLoadingMore:i,error:r,hasMore:d,onShowMore:c}){return t?(0,n.jsx)(a(4458).fI,{justifyContent:"center",padding:48,children:(0,n.jsx)(a(517334).k,{size:28})}):0===e.length?void 0!==r?(0,n.jsx)(o,{message:r}):(0,n.jsx)("div",{...{className:"xhsfehk xa8xo2u x1q4eyhr xh27kie x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 x13jy36j x64bnmy x13zrc24 x1t1ogtf x78zum5 xl56j7k x2b8uid"},children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorVariant:"secondary",children:"You haven't run any Tool Proxy scripts yet."})}):(0,n.jsxs)(a(4458).VP,{gap:16,children:[(0,n.jsx)("div",{...{className:"xiycden xdkmkoj xjmasz6 x1uyo0ou x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 x6ikm8r x10wlt62 xd54fh8"},children:e.map((e,t)=>(0,n.jsx)(l,{run:e,isFirst:0===t},e.executionId))}),void 0!==r?(0,n.jsx)(o,{message:r}):null,d?(0,n.jsx)(a(4458).fI,{justifyContent:"center",children:(0,n.jsx)(a(808446).r,{onClick:c,disabled:i,children:i?"Loading…":"Show more"})}):null]})}function o({message:e}){return(0,n.jsx)("div",{...{className:"x6hnrot xcjx3il x5m9n4a x16skee8 xjqs0th x6nl9eh x1a5l9x9 x7vuprf x1mg3h75 xyamay9 xv54qhq x1l90r2v xf7dkkf"},children:(0,n.jsx)(a(111010).D,{styleKey:"bodySm",colorPalette:"red",colorVariant:"accentPrimary",children:e})})}function l({run:e,isFirst:t}){let i=(0,a(734944).Ng)(),r=(0,a(734944)._M)(e.executionId);return(0,n.jsxs)("a",{href:r,onClick:e=>i(r,e),...{0:{className:"x78zum5 x6s0dn4 xp1r0qw xtqikln xf7dkkf xv54qhq xz9dl7a xsag5q8 x1hl2d
106hg x1ypdohk xfcwbsc x15zahet x1a2a7pz x1w79tpz x2ssjo2"},1:{className:"x78zum5 x6s0dn4 xp1r0qw xtqikln xf7dkkf xv54qhq xz9dl7a xsag5q8 x1hl2dhg x1ypdohk xfcwbsc x15zahet x1a2a7pz x1w79tpz x2ssjo2 xiycden"}}[0|!t],children:[(0,n.jsxs)("div",{...{className:"x98rzlu xeuugli x78zum5 xdt5ytf x1dbijih x1ned7t2"},children:[(0,n.jsx)(a(111010).D,{styleKey:"bodyMedium",colorVariant:"primary",lineClamp:1,children:e.toolId}),(0,n.jsx)(a(111010).D,{styleKey:"captionRegular",colorVariant:"tertiary",children:(0,a(344184).vO)(e.startedAt)})]}),(0,n.jsx)(a(734944).VO,{status:e.status,dryRun:e.dryRun}),(0,n.jsx)(a(16275).I,{icon:a(491469).arrowChevronSingleRightSmallIcon,size:16,colorVariant:"tertiary",...{className:"x2lah0s"}})]})}a.d(t,{AdminToolProxyRunsPage:()=>r})},689934(e,t,a){function i(){return!1}a(159952);let n=Date.now(),r=[{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-queued",toolId:"contentOnboardingExportBlock",permission:"adminExportPageForUser",status:"queued",dryRun:!1,startedAt:n-4e3,updatedAt:n-4e3},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-running-dry",toolId:"migrateBlocks",permission:"adminGetCurrentUserPermissions",status:"running",dryRun:!0,startedAt:n-3e4,updatedAt:n-5e3,progress:{phase:"scanning",status:"in_progress",message:"Scanning blocks (42%)",details:{scanned:4200,total:1e4}}},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-running-phase-only",toolId:"reindexSearch",permission:"adminGetCurrentUserPermissions",status:"running",dryRun:!1,startedAt:n-8e3,updatedAt:n-8e3,progress:{phase:"queued"}},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-completed-rich",toolId:"backfillWorkspaceFlags",permission:"adminGetCurrentUserPermissions",status:"completed",dryRun:!1,startedAt:n-36e5,updatedAt:n-36e5+9800,completedAt:n-36e5+9800,progress:{phase:"done",status:"success",message:"Backfilled 1,234 rows"},debugInfo:{rowsScanned:5e3,rowsUpdated:1234,durationMs:9800,batches:[{id:1,updated:500},{id:2,updated:734}]}},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-completed-progress-details",toolId:"recomputeStats",permission:"adminGetCurrentUserPermissions",status:"completed",dryRun:!1,startedAt:n-72e5,updatedAt:n-72e5+4100,completedAt:n-72e5+4100,progress:{phase:"done",status:"success",message:"Recomputed workspace stats",details:{updated:12,skipped:3}},debugInfo:{updated:12,skipped:3}},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-completed-dry-minimal",toolId:"smokeTest",permission:"adminGetCurrentUserPermissions",status:"completed",dryRun:!0,startedAt:n-864e5,updatedAt:n-864e5+800,completedAt:n-864e5+800},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-completed-array-debug",toolId:"exportAuditLog",permission:"adminGetCurrentUserPermissions",status:"completed",dryRun:!1,startedAt:n-108e5,updatedAt:n-108e5+15e3,completedAt:n-108e5+15e3,progress:{phase:"done",status:"success",message:"Exported 3 files"},debugInfo:{logs:["started export","wrote chunk 1","wrote chunk 2","finalized"],warnings:["2 rows skipped: missing space"],files:3}},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-failed-with-message",toolId:"resetUserCache",permission:"adminGetCurrentUserPermissions",status:"failed",dryRun:!1,startedAt:n-144e5,updatedAt:n-144e5+1200,completedAt:n-144e5+1200,progress:{phase:"executing",message:"Reached error while flushing"},error:{errorName:"ServiceUnavailableError",failureCode:"remote_execution_start_failed",safeMessage:"Cache service returned 503."},debugInfo:{attempted:!0,flushed:0}},{userId:"local-admin",userEmail:"[email protected]",executionId:"mock-failed-dry-no-message",toolId:"deleteOrphans",permission:"adminGetCurrentUserPermissions",status:"failed",dryRun:!0,startedAt:n-216e5,updatedAt:n-216e5+400,completedAt:n-216e5+400,error:{errorName:"BadRequestError"},debugInfo:{found:0}}];function s(e){return{runs:r.slice(0,e.limit).map(l),hasMore:r.length>e.limit}}function o(e){return r.find(t=>t.executionId===e)}function l(e){var t,a;return{executionId:e.executionId,toolId:e.toolId,status:e.status,dryRun:e.dryRun,startedAt:e.startedAt,completedAt:e.completedAt,progressPhase:null==(t=e.progress)?void 0:t.phase,progressMessage:null==(a=e.progress)?void 0:a.message}}
106a.d(t,{Cd:()=>i,S$:()=>o,TL:()=>s})},734944(e,t,a){var i=a(635790),n=a(440302);let r="/__admin/tool-proxy/runs";function s(e){return"queued"===e||"running"===e}function o(e){return`${r}/${encodeURIComponent(e)}`}function l(){let{navigate:e}=(0,i.useContext)(a(44894).E),t=(0,a(533992).v3)();return(0,i.useCallback)((a,i)=>{i.defaultPrevented||0!==i.button||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||(i.preventDefault(),e({environment:t,url:a}))},[t,e])}let d={queued:{label:"Queued",palette:"gray"},running:{label:"Running",palette:"blue"},completed:{label:"Completed",palette:"green"},failed:{label:"Failed",palette:"red"}},c={badge:{display:"inline-flex",alignItems:"center",gap:5,height:20,paddingInline:"6px 9px",borderRadius:999,whiteSpace:"nowrap"},dot:{width:6,height:6,borderRadius:999,flexShrink:0},dryRunTag:{display:"inline-flex",alignItems:"center",height:20,paddingInline:8,borderRadius:999,whiteSpace:"nowrap",backgroundColor:a(632079).Tj.background.secondary}};function p({status:e,dryRun:t}){let{label:i,palette:r}=d[e];return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{style:{...c.badge,backgroundColor:a(632079).Tj[r].background.secondaryTranslucent},children:[(0,n.jsx)("span",{style:{...c.dot,backgroundColor:a(632079).Tj[r].icon.accentPrimary}}),(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorPalette:r,colorVariant:"accentPrimary",children:i})]}),t?(0,n.jsx)("span",{style:c.dryRunTag,children:(0,n.jsx)(a(111010).D,{styleKey:"captionMedium",colorVariant:"secondary",children:"Dry run"})}):null]})}function m(e){return void 0===e?"—":new Date(e).toLocaleString()}function u(e){let t=Math.round((Date.now()-e)/1e3);if(t<45)return"just now";let a=Math.round(t/60);if(a<60)return`${a}m ago`;let i=Math.round(a/60);if(i<24)return`${i}h ago`;let n=Math.round(i/24);return n<7?`${n}d ago`:new Date(e).toLocaleDateString()}function h(e,t){if(void 0===t)return"—";let a=Math.max(0,Math.round((t-e)/1e3));if(a<60)return`${a}s`;let i=Math.floor(a/60);return`${i}m ${a%60}s`}a.d(t,{Ic:()=>s,Ng:()=>l,VO:()=>p,Z2:()=>u,_M:()=>o,is:()=>m,wP:()=>h},{Eq:"/__admin/toolProxy",FO:r})},851900(e,t,a){a.d(t,{gu:()=>l,Lv:()=>r,vv:()=>n,EE:()=>o,uJ:()=>s}),a(533958),a(730330),a(976614),a(765324),a(953925),a(540679);let i=[{toolId:"contentOnboardingExportBlock",displayName:"Export page for user",description:"Run a page export directly and return a temporary download link.",permission:"adminExportPageForUser",workspaceConsent:{mode:"enforce",target:{type:"blockId",param:"blockId",subject:{emailParam:"email"}}},dryRunSupport:"unsupported",visibility:"visible",executionMode:"async",inputs:{params:[{name:"email",label:"User email",description:"Email of the user requesting the export. The download is generated for this user.",required:!0,schema:{type:"string"},control:{type:"string"}},{name:"blockId",label:"Page ID",description:"ID of the page to export.",required:!0,schema:{type:"string"},control:{type:"string"}},{name:"exportType",label:"Format",description:"File format for the page export.",required:!1,schema:{type:"string",enum:["html","markdown","pdf"]},control:{type:"select",options:[{value:"html",label:"HTML"},{value:"markdown",label:"Markdown & CSV"},{value:"pdf",label:"PDF"}]},defaultValue:"html"},{name:"includeFilesAndImages",label:"Include files and images",description:"Include uploaded files and images in the export.",required:!1,schema:{type:"boolean"},control:{type:"boolean"},defaultValue:!0},{name:"exportSubpages",label:"Include subpages",description:"Recursively include pages nested under this page.",required:!1,schema:{type:"boolean"},control:{type:"boolean"},defaultValue:!1},{name:"shouldExportComments",label:"Include comments",description:"Include page comments in the HTML export.",required:!1,schema:{type:"boolean"},control:{type:"boolean"},defaultValue:!1}]}},{toolId:"contentOnboardingExportSpace",displayName:"Content onboarding export space",description:"Export a space through the partitioned content-onboarding export flow.",permission:"adminExportSpaceForUser",workspaceConsent:{mode:"enforce",target:{type:"spaceId",param:"spaceId"}},dryRunSupport:"supported",visibility:"visible",executionMode:"async",inputs:{params:[{name:"spaceId",description:"Notion space ID to export.",required:!0,schema:{type:"string"},control:{type:"string"}},{name:"userId",description:"User ID to perform the export as. Required when email is not provided.",required:!1,schema:{type:["string","null"]},control:{type:"string"},defaultValue:null},{name:"email",description:"Email to perform the export as. Required when userId is not provided.",required:!1,schema:{type:["string","null"]},control:{type:"string"},defaultValue:null}]}},{toolId:"smokeTest",displayName:"Admin Tool Proxy smoke test",description:"Hidden local-only runtime exercise script.",permission:"adminGetCurrentUserPermissions",workspaceConsent:{mode:"not_applicable",reason:"Smoke test does not access workspace content."},dryRunSupport:"supported",visibility:"hiddenLocalOnly",executionMode:"sync",inputs:{params:[{name:"steps",description:"Number of smoke-test progress steps to emit.",required:!1,schema:{type:"integer",minimum:1},control:{type:"number",integer:!0,min:1},defaultValue:1},{name:"message",description:"Optional progress message.",required:!1,schema:{type:["string","null"]},control:{type:"string"},defaultValue:null},{name:"failAtStep",description:"Optional step number where the script should fail.",required:!1,schema:{type:["integer","null"]},control:{type:"number",integer:!0},defaultValue:null},{name:"demoText",description:"Single-line text input.",required:!1,schema:{type:["string","null"]},control:{type:"string",placeholder:"Type something…"},defaultValue:null},{name:"demoMultilineText",description:"Multi-line text input.",required:!1,schema:{type:["string","null"]},control:{type:"string",multiline:!0},defaultValue:null},{name:"demoNumber",description:"Decimal number with min/max bounds.",required:!1,schema:{type:["number","null"],minimum:0,maximum:100},control:{type:"number",min:0,max:100},defaultValue:null},{name:"demoBoolean",description:"Boolean toggle.",required:!1,schema:{type:"boolean"},control:{type:"boolean"},defaultValue:!1},{name:"demoSelect",description:"Single-select dropdown.",required:!1,schema:{anyOf:[{type:"string",enum:["alpha","beta","gamma"]},{type:"null"}]},control:{type:"select",options:[{value:"alpha",label:"Alpha"},{value:"beta",label:"Beta"},{value:"gamma",label:"Gamma"}]},defaultValue:null},{name:"demoJson",description:"Arbitrary JSON object (string values).",required:!1,schema:{type:"object",additionalProperties:{type:"string"}},control:{type:"json"},defaultValue:{}}],file:{description:"Optional file used to exercise remote upload handling.",required:!1,accept:[".csv",".json",".txt"]}}}];function n(e,t,a){if(void 0===e)return[];let n="production"!==t,r=(null==a?void 0:a.includeUnauthorized)??!1;return i.filter(t=>(r||e.has(t.permission))&&("visible"===t.visibility||"hiddenLocalOnly"===t.visibility&&n))}function r(e){let t={};for(let i of e.inputs.params){var a;t[i.name]="boolean"===(a=i).control.type?!0===a.defaultValue:void 0===a.defaultValue||null===a.defaultValue?"":"json"===a.control.type?JSON.stringify(a.defaultValue,void 0,2):String(a.defaultValue)}return t}function s(e,t){let a={};for(let i of e.inputs.params){let e=function(e,t){if("boolean"===e.control.type)return;let a="string"==typeof t?t.trim():"";if(""===a)return e.required?"This field is required.":void 0;switch(e.control.type){case"number":{let t=Number(a);if(!Number.isFinite(t))return"Must be a number.";if(e.control.integer&&!Number.isInteger(t))return"Must be a whole number.";if(void 0!==e.control.min&&t<e.control.min)return`Must be at least ${e.control.min}.`;if(void 0!==e.control.max&&t>e.control.max)return`Must be at most ${e.control.max}.`;return}case"select":return e.control.options.some(e=>e.value===a)?void 0:"Select a valid option.";case"json":try{JSON.parse(a);return}catch(e){return e instanceof Error?`Must be valid JSON: ${e.message}`:"Must be valid JSON."}default:return}}(i,t[i.name]);void 0!==e&&(a[i.name]=e)}return a}function o(e,t){let a=e.inputs.file;if(void 0===a)return void 0===t?void 0:"This script does not accept a file.";if(void 0===t)return a.required?"A file is required.":void 0;if(t.size>0x6400000)return"File must be 100 MB or smaller.";if(!function(e){let{accept:t}=e;if(void 0===t)return!0;let a=e.filename.toLowerCase();return t.some(e=>a.endsWith(e.toLowerCase()))}({filename:t.name,accept:a.accept})){var i;return`Select a file with one of these extensions: ${null==(i=a.accept)?void 0:i.join(", ")}.`}}function l(e,t){let a={};for(let i of e.inputs.params){let e=t[i.name];if("boolean"===i.control.type){a[i.name]=!!e;continue}let n="string"==typeof e?e.trim():"";if(""===n){void 0!==i.defaultValue&&(a[i.name]=i.defaultValue);continue}a[i.name]=function(e,t){switch(e.control.type){case"number":return Number(t);case"json":return JSON.parse(t);default:return t}}(i,n)}return a}},207270(e,t,a){var i=a(635790),n=a(440302);let r={codeDisplay:{whiteSpace:"pre-wrap",wordWrap:"break-word",userSelect:"text",WebkitUserSelect:"text",cursor:"text",fontFamily:"monospace",color:a(632079).Tj.text.primary,margin:0,fontSize:12},preserveWhitespace:{whiteSpace:"pre",wordWrap:"normal"},xs:{fontSize:10},script:{lineHeight:1.6,tabSize:2}};function s(e){let{value:t,language:s="typescript",preserveWhitespace:o=!1,size:l="default",format:d="default"}=e,{value:c}=(0,a(552709).fJ)(a(909373).y),p=i.useMemo(()=>
106{if(c)return c.highlight(t,c.languages[s]||c.languages.javascript,s)},[c,t,s]),m=(0,i.useCallback)(e=>{e.stopPropagation()},[]);return(0,n.jsx)("div",{style:{...r.codeDisplay,...o?r.preserveWhitespace:void 0,..."xs"===l?r.xs:void 0,..."script"===d?r.script:void 0},onCopy:m,...void 0===p?{children:t}:{dangerouslySetInnerHTML:{__html:p}}})}a.d(t,{O:()=>s})},227670(e,t,a){function i(){return a(205885).A.state.online}function n(e){return new Promise(t=>{function a(){window.clearTimeout(i),t()}let i=window.setTimeout(()=>{e.abortSignal.removeEventListener("abort",a),t()},e.delayMs);e.abortSignal.addEventListener("abort",a,{once:!0})})}a.d(t,{W7:()=>i,yR:()=>n})},550552(e,t,a){function i(e){switch(e){case a(646478).q.Red:return"red";case a(646478).q.Blue:return"blue";case a(646478).q.Beige:return"yellow";case a(646478).q.White:return"gray";case a(646478).q.Purple:return"blue";case a(646478).q.LightRed:return"red";case a(646478).q.Yellow:return"yellow";case a(646478).q.PageNotification:return"gray";case a(646478).q.ImportNotification:case a(646478).q.LightBlue:return"blue";case a(646478).q.LightGray:default:return"gray"}}a.d(t,{V:()=>i})},2825(e,t,a){a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(159952);var i=a(635790),n=a(440302);let r={headerWithSelection:{display:"grid"},headerDisclosure:{gridArea:"1 / 1"},headerOverlay:{gridArea:"1 / 1",position:"relative",pointerEvents:"none",background:"transparent"},selectionControl:{pointerEvents:"auto"},sectionTitle:{fontWeight:a(699422).Wy.medium,padding:0},sectionIcon:{flexShrink:0,width:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",marginInlineEnd:8},chevronIcon:{width:a(104509).Ev.xs,height:a(104509).Ev.xs,marginInlineStart:12,transition:"transform 200ms ease-out"}};function s(e){var t,s,l,d;let{sections:p,expandAllWhenSectionsChange:m=!1,overrideExpandedState:u,chevronPosition:h="end",styleOverrides:y,borderedStyle:g=!1,compactMode:x=!1,buttonPadding:f,onSectionToggle:b}=e,v=(t=y,s=g,l=x,d=f,(0,a(960253).I)(()=>{let e=(null==t?void 0:t.sectionBackground)??a(632079).Tj.background.secondary,i=(null==t?void 0:t.sectionButtonBackground)??a(632079).Tj.background.secondary,n=(null==t?void 0:t.sectionButtonHoverBackground)??a(632079).Tj.background.secondaryTranslucent;return{container:{display:"grid",gap:8,...l?{maxWidth:"100%",boxSizing:"border-box",overflow:"hidden"}:{}},sectionWrapper:s?{background:"transparent",borderRadius:8,border:`1px solid ${a(632079).Tj.border.secondary}`,...l?{boxSizing:"border-box",overflow:"hidden"}:{}}:{background:e,borderRadius:8,...l?{boxSizing:"border-box",overflow:"hidden"}:{}},sectionButton:{background:s?"transparent":i,borderRadius:8,padding:d??(l?"6px 10px":"8px 12px"),...l?{width:"100%",boxSizing:"border-box"}:{}},sectionButtonWithDividerExpanded:{background:s?"transparent":i,borderBottom:`1px solid ${s?a(632079).Tj.border.secondary:a(632079).Tj.border.primary}`,padding:d??(l?"6px 10px":"8px 12px"),borderStartStartRadius:8,borderStartEndRadius:8,borderEndStartRadius:0,borderEndEndRadius:0,...l?{width:"100%",boxSizing:"border-box"}:{}},sectionButtonWithDividerCollapsed:{background:s?"transparent":i,borderBottom:s?void 0:`1px solid ${a(632079).Tj.border.primary}`,padding:d??(l?"6px 10px":"8px 12px"),borderRadius:8,...l?{width:"100%",boxSizing:"border-box"}:{}},sectionButtonPressed:{background:c.pressed},sectionButtonHovered:{background:n},titleWrapper:l?{flex:1,minWidth:0,overflow:"hidden"}:{},sectionContent:{padding:l?10:12,...l?{maxWidth:"100%",boxSizing:"border-box",overflow:"hidden"}:{}}}},[null==t?void 0:t.sectionBackground,null==t?void 0:t.sectionButtonBackground,null==t?void 0:t.sectionButtonHoverBackground,l,s,d])),[j,k]=(0,i.useState)(()=>{let e={};for(let t of p)!t.hidden&&t.initialExpanded&&(e[t.key]=!0);return e}),S=(0,i.useMemo)(()=>u&&"always"===u.mode?new Set(Object.keys(u.sections)):new Set,[u]),w=(0,i.useCallback)((e,t)=>{if(S.has(e))return;let a=!t;k(t=>({...t,[e]:a})),null==b||b(e,a)},[b,S]);(0,i.useEffect)(()=>{if(m){let e={};for(let t of p)t.hidden||(e[t.key]=!0);k(e)}},[p,m]),(0,i.useEffect)(()=>{(null==u?void 0:u.mode)==="onceOnChange"&&k(e=>({...e,...u.sections}))},[u]);let I=(0,i.useMemo)(()=>u&&"always"===u.mode?{...j,...u.sections}:j,[j,u]);return(0,n.jsx)("div",{style:v.container,children:p.map(e=>{if(e.hidden)return null;let t=!!I[e.key],a=!1!==e.collapsible&&!S.has(e.key);return(0,n.jsx)(o,{section:e,isExpanded:t,isCollapsible:a,chevronPosition:h,onToggle:w,styles:{...v,...r},borderedStyle:g},e.key)})})}function o(e){let{section:t,isExpanded:r,isCollapsible:s,chevronPosition:o,onToggle:c,styles:p,borderedStyle:m}=e,[u,h]=(0,i.useState)(!1),y=(0,i.useId)(),g=(0,i.useId)(),x=t.headerDivider?r?p.sectionButtonWithDividerExpanded:p.sectionButtonWithDividerCollapsed:p.sectionButton,f=(0,n.jsx)(l,{section:t,isExpanded:r,isCollapsible:s,chevronPosition:o,styles:p,titleId:y});return(0,n.jsxs)("div",{style:p.sectionWrapper,children:[(0,n.jsx)("div",{style:t.selectionControl?p.headerWithSelection:void 0,onMouseEnter:t.selectionControl?()=>h(!0):void 0,onMouseLeave:t.selectionControl?()=>h(!1):void 0,children:s&&t.selectionControl?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a(64960).Ay,{onClick:()=>c(t.key,r),"aria-labelledby":y,"aria-expanded":r,"aria-controls":t.content?g:void 0,style:{...x,...p.headerDisclosure},hovered:u,hoveredStyle:p.sectionButtonHovered}),(0,n.jsx)("div",{style:{...x,...p.headerOverlay},children:f})]}):s?(0,n.jsx)(a(64960).Ay,{onClick:()=>c(t.key,r),"aria-expanded":r,"aria-controls":t.content?g:void 0,style:x,hoveredStyle:p.sectionButtonHovered,children:f}):(0,n.jsx)("div",{style:x,children:f})}),t.content?(0,n.jsx)("div",{id:g,children:(0,n.jsx)(d,{content:t.content,isExpanded:r,contentStyle:t.sectionContentStyleOverride??p.sectionContent,borderedStyle:m})}):void 0]})}function l(e){let{section:t,isExpanded:i,isCollapsible:r,chevronPosition:s,styles:o,titleId:l}=e,d=r?(0,n.jsx)(a(16275).I,{icon:a(342392).arrowChevronSingleRightIcon,colorVariant:t.chevronColorVariant,style:{...o.chevronIcon,transform:`rotateZ(${90*!!i}deg)`}}):void 0,c=t.disableUILabelWrap?t.title:(0,n.jsx)(a(324489).V,{style:o.sectionTitle,children:t.title}),p=t.selectionControl?(0,n.jsxs)(a(4458).fI,{gap:8,alignItems:"center",children:[(0,n.jsx)("div",{style:o.selectionControl,children:t.selectionControl}),(0,n.jsx)("div",{id:l,children:c})]}):c,m=t.secondaryLabel?t.disableUILabelWrap?t.secondaryLabel:(0,n.jsx)(a(324489).V,{isSecondaryColor:!0,children:t.secondaryLabel}):void 0;return"start"===s&&r?(0,n.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,n.jsxs)(a(4458).fI,{alignItems:"center",style:o.titleWrapper,children:[(0,n.jsx)(a(16275).I,{icon:a(342392).arrowChevronSingleRightIcon,colorVariant:t.chevronColorVariant,style:{...o.chevronIcon,marginInlineStart:0,marginInlineEnd:8,transform:`rotateZ(${90*!!i}deg)`}}),t.icon?(0,n.jsx)("div",{style:o.sectionIcon,children:t.icon}):void 0,p]}),(0,n.jsx)(a(4458).fI,{alignItems:"center",children:m})]}):(0,n.jsxs)(a(4458).fI,{justifyContent:"space-between",alignItems:"center",children:[(0,n.jsxs)(a(4458).fI,{alignItems:"center",style:o.titleWrapper,children:[t.icon?(0,n.jsx)("div",{style:o.sectionIcon,children:t.icon}):void 0,p]}),(0,n.jsxs)(a(4458).fI,{alignItems:"center",children:[m,d]})]})}function d({content:e,isExpanded:t,contentStyle:i,borderedStyle:r}){return(0,n.jsx)(a(678951).N,{initial:!1,children:t?(0,n.jsx)(a(851333).P.div,{initial:{height:0,opacity:0}
106,animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.25,ease:"easeInOut"},style:{overflow:"hidden",background:r?void 0:a(632079).Tj.background.primary},children:(0,n.jsx)("div",{style:i,children:e})}):void 0})}let c=(0,a(133251)._S)({color:a(632079).Tj.background.secondaryTranslucent,pressedAdjustmentFactor:1});a.d(t,{b:()=>s})},45062(e,t,a){var i=a(635790);function n(e){return(0,i.useEffect)(()=>{document.title=e.title,(0,a(328975).H)(e.title)},[e.title]),e.children}a.d(t,{A:()=>n})},521180(e,t,a){a(635790);var i=a(440302);a.d(t,{},{A:function(e){let t=(0,a(533992).v3)(),{modalStyle:n,alignItems:r="flex-start"}=e,s=(0,a(960253).I)(()=>({modalStyle:{top:a(801113).jq(t.device.isElectronMac),borderRadius:12,overflow:"hidden",boxShadow:a(632079).Tj.shadow.outline.scrim,background:a(632079).Tj.background.primary,...n}}),[t,n]);return a(139424).A.isMobile?(0,i.jsx)(a(182718).z,{popupType:a(423291).n.SlideUp,open:e.open,content:e.renderContent,preventSlideUpTransition:e.disableAnimation,onDismiss:e.onDismiss,trapFocus:!1,ariaLabel:e.ariaLabel,children:e.children}):(0,i.jsx)(a(171849).a,{open:e.open,preventHideChildrenWhileOpening:!0,style:{alignItems:r},innerStyle:s.modalStyle,onDismiss:e.onDismiss,origin:e.children,isWaxPaper:e.modalIsWaxPaper,backgroundStyle:e.modalBackgroundStyle,transitionAppearance:e.disableAnimation?"none":void 0,ariaLabel:e.ariaLabel,children:e.renderContent()})}})},328975(e,t,a){function i(e){var t;null===a(775657).electronApi||void 0===a(775657).electronApi||null==(t=a(775657).electronApi.setWindowTitle)||t.call(a(775657).electronApi,e)}a.d(t,{H:()=>i})},310196(e,t,a){a.r(t),a(533958);class i extends Error{reason;constructor(e,t){super(e),this.name="RecordedAudioValidationError",this.reason=t}}async function n(e){let{environment:t,spaceId:n,file:r,signal:s,onProgress:o,onError:l}=e,d=function(e){let{file:t,spaceId:n}=e;if(t.size>0x40000000){let e=new i("Audio file exceeds 1 GB limit","file_size_exceeded");return function(e){let{error:t,file:i,reason:n,spaceId:r}=e;(0,a(208318).t)().log({level:"error",from:"meetingNotesUploadActions",type:"recordedAudioTemporaryUploadRejected",error:(0,a(952977).convertErrorToLog)(t),data:{miscDataToConvertToString:{reason:n,space_id:r,file_size_bytes:i.size,max_file_size_bytes:0x40000000,content_type:i.type,file_extension:function(e){let t=e.lastIndexOf(".");if(-1!==t&&t!==e.length-1)return e.slice(t+1).toLowerCase()}(i.name)}}})}({error:e,file:t,reason:"file_size_exceeded",spaceId:n}),e}if(!function(e,t){if(e&&e.startsWith("audio/"))return!0;let a=t.toLowerCase();return a.endsWith(".m4a")||a.endsWith(".aac")||a.endsWith(".mp4")||a.endsWith(".mp3")||a.endsWith(".wav")||a.endsWith(".caf")||a.endsWith(".ogg")}(t.type,t.name))return new i("Selected file does not appear to be an audio file","not_audio_file")}({file:r,spaceId:n});if(void 0!==d)throw null==l||l(d),d;return await new Promise((e,i)=>{a(401558).Zn({environment:t,files:[r],bucket:"temporary",bypassFreeFileUploadLimitCheck:!0,spaceId:n,uploadContext:"transcription_audio",signal:s,onBatchProgress:e=>{"number"==typeof e.progressPercent&&(null==o||o(e.progressPercent))},onBatchCompleteWithToken:t=>{let a=t[0];a?e({fileUrl:a.fileUrl,signedToken:a.signedToken}):i(Error("Upload failed: no URL returned"))},onBatchError:e=>{null==l||l(e),i(e)}})})}a.d(t,{RecordedAudioValidationError:()=>i,uploadRecordedAudioToTemporary:()=>n})},480088(e,t,a){let i=new(a(552709)).O2("MonacoDiffEditor",async()=>{let[e,t,{DiffEditor:i}]=await Promise.all([Promise.all([a.e(2243),a.e(54777)]).then(a.bind(a,187471)).then(e=>e.default),a.e(46197).then(a.bind(a,551922)).then(e=>e.loader),a.e(46197).then(a.bind(a,551922))]);return t.config({monaco:e}),{DiffEditor:i}}),n=(0,a(552709)._h)(i,e=>e.DiffEditor);a.d(t,{},{K:n})},899815(e,t,a){a(635790);var i=a(440302);let n={link:{color:a(632079).Tj.blue.icon.accentPrimary,fontWeight:a(699422).Wy.medium}};function r({href:e,external:t,onClick:s,children:o}){return(0,i.jsx)(a(428217).V,{disableUnderline:!0,href:e,external:t,onClick:s,color:n.link.color,hoverColor:"blue",style:n.link,children:o})}a.d(t,{_:()=>r})},18677(e,t,a){let i=new(a(552709)).O2("Invoice",async()=>await a.e(59289).then(a.bind(a,358453))),n=(0,a(552709)._h)(i,e=>e.Invoice);a.d(t,{},{Y:n})},456314(e,t,a){a.d(t,{cx:()=>b}),a(533958);var i=a(635790);a(159952),a(435368);
106let n=/^(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?$/;function r(e){let t=Math.round(e/6e4),a=Math.floor(t/1440),i=Math.floor(t%1440/60),n=t%60,r=[];return a>0&&r.push(`${a}d`),i>0&&r.push(`${i}h`),n>0&&r.push(`${n}m`),r.length>0?r.join(""):"0m"}var s=a(440302);let o="minmax(0, 1.5fr) minmax(0, 0.8fr) minmax(0, 1.5fr) minmax(0, 1.2fr) minmax(0, 0.5fr)",l={section:{display:"flex",flexDirection:"column",gap:24,paddingInline:4},sectionTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},sectionSubtitle:{fontSize:14,color:a(632079).Tj.text.secondary,maxWidth:520},tableContainer:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},tableHeader:{display:"grid",gridTemplateColumns:o,alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium,textTransform:"uppercase",letterSpacing:.4,gap:16},tableBody:{display:"flex",flexDirection:"column",maxHeight:320,overflowY:"auto"},headerCell:{textAlign:"start"},row:{display:"grid",gridTemplateColumns:o,alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.primary,gap:16},rowDivider:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},capabilityKey:{fontFamily:"monospace",fontSize:13,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary,wordBreak:"break-word"},capabilityType:{fontSize:12,color:a(632079).Tj.text.secondary},capabilityDescription:{fontSize:12,color:a(632079).Tj.text.secondary,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},scheduleCell:{display:"flex",alignItems:"center",gap:8,fontSize:12,position:"relative",zIndex:1},scheduleDisplay:{color:a(632079).Tj.text.secondary,fontFamily:"monospace",fontSize:12},scheduleSelect:{fontSize:12,padding:"2px 4px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.secondary}`,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary},scheduleInput:{width:56,fontSize:12,fontFamily:"monospace",padding:"2px 6px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.secondary}`,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary},scheduleInputError:{width:56,fontSize:12,fontFamily:"monospace",padding:"2px 6px",borderRadius:4,border:`1px solid ${a(632079).Tj.red.border.primary}`,backgroundColor:a(632079).Tj.background.primary,color:a(632079).Tj.text.primary},scheduleSaveButton:{fontSize:11,padding:"2px 8px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.secondary}`,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.primary,cursor:"pointer"},scheduleSaveButtonDisabled:{fontSize:11,padding:"2px 8px",borderRadius:4,border:`1px solid ${a(632079).Tj.border.secondary}`,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.tertiary,cursor:"not-allowed"},checkbox:{cursor:"pointer",width:16,height:16},checkboxDisabled:{cursor:"not-allowed",width:16,height:16},emptyState:{fontSize:12,color:a(632079).Tj.text.secondary,paddingInline:4}};function d(e){let{capabilities:t,isReadOnly:i,onToggleDisabled:n,isUpdatingCapability:o,onUpdateSchedule:d,isUpdatingSchedule:u}=e;return(0,s.jsxs)("section",{style:l.section,children:[(0,s.jsxs)(a(4458).VP,{gap:4,children:[(0,s.jsx)("div",{style:l.sectionTitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Capabilities",id:"workers.detail.capabilities.title"})}),(0,s.jsx)("div",{style:l.sectionSubtitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Actions and integrations this worker exposes.",id:"workers.detail.capabilities.subtitle"})})]}),t.length>0?(0,s.jsxs)("div",{style:l.tableContainer,children:[(0,s.jsxs)("div",{style:l.tableHeader,children:[(0,s.jsx)("div",{style:l.headerCell,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Key",id:"workers.detail.capabilities.listHeader.key"})}),(0,s.jsx)("div",{style:l.headerCell,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Type",id:"workers.detail.capabilities.listHeader.type"})}),(0,s.jsx)("div",{style:l.headerCell,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Description",id:"workers.detail.capabilities.listHeader.description"})}),(0,s.jsx)("div",{style:l.headerCell,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Schedule",id:"workers.detail.capabilities.listHeader.schedule"})}),(0,s.jsx)("div",{style:l.headerCell,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Enabled",id:"workers.detail.capabilities.listHeader.enabled"})})]}
106),(0,s.jsx)("div",{style:l.tableBody,children:t.map((e,h)=>{let y,g=h===t.length-1?l.row:{...l.row,...l.rowDivider},x="sync"===e._tag,f=!x||!e.disabled,b=o===e.key,v=i||b;return(0,s.jsxs)("div",{style:g,children:[(0,s.jsx)("div",{style:l.capabilityKey,children:e.key}),(0,s.jsx)("div",{style:l.capabilityType,children:function(e){switch(e._tag){case"sync":return"Sync";case"tool":return"Tool";case"automation":return"Automation";case"workflow":return"Workflow";case"oauth":return"OAuth";case"webhook":return"Webhook";case"custom_block":return"Custom block"}}(e)}),(0,s.jsx)("div",{style:l.capabilityDescription,title:m(e),children:m(e)}),(0,s.jsx)("div",{style:l.scheduleCell,children:x?d&&!i?(0,s.jsx)(c,{capability:e,onUpdateSchedule:d,isUpdating:u===e.key}):(0,s.jsx)("span",{style:l.scheduleDisplay,children:"continuous"===(y=p(e)).type?"Continuous":"manual"===y.type?"Manual":r(y.intervalMs)}):"—"}),(0,s.jsx)(a(4458).fI,{alignItems:"center",justifyContent:"center",children:x?(0,s.jsx)("input",{type:"checkbox",checked:f,disabled:v||!n,onChange:t=>{null==n||n(e.key,!t.target.checked)},style:v||!n?l.checkboxDisabled:l.checkbox,"aria-label":`Enable ${e.key}`}):"—"})]},e.key)})})]}):(0,s.jsx)("div",{style:l.emptyState,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"No capabilities defined",id:"workers.detail.capabilities.empty"})})]})}function c(e){let{capability:t,onUpdateSchedule:o,isUpdating:d}=e,c=(0,a(327219).tz)(),m=p(t),[u,h]=(0,i.useState)(m.type),[y,g]=(0,i.useState)("interval"===m.type?r(m.intervalMs):"30m"),x="interval"===u?function(e){let t=e.trim();if(0===t.length)return;let a=n.exec(t);if(!a)return;let i=a[1]?parseInt(a[1],10):0,r=a[2]?parseInt(a[2],10):0,s=a[3]?parseInt(a[3],10):0;if(0!==i||0!==r||0!==s)return 864e5*i+36e5*r+6e4*s}(y):void 0,f="continuous"===u||void 0!==x,b=u!==m.type||"interval"===u&&"interval"===m.type&&x!==m.intervalMs,v=f&&b&&!d,j=(0,i.useCallback)(()=>{let e;if(v){if("continuous"===u)e={type:"continuous"};else if("manual"===u)e={type:"manual"};else{if(void 0===x)return;e={type:"interval",intervalMs:x}}o(t.key,e)}},[v,u,x,o,t.key]),k=(0,i.useCallback)(e=>{let t=e.target.value;("continuous"===t||"interval"===t)&&h(t)},[]),S=(0,i.useCallback)(e=>{g(e.target.value)},[]);return(0,s.jsxs)(a(4458).fI,{alignItems:"center",gap:6,children:[(0,s.jsxs)("select",{value:u,onChange:k,disabled:d,style:l.scheduleSelect,"aria-label":`Schedule type for ${t.key}`,children:[(0,s.jsx)("option",{value:"interval",children:c.formatMessage({defaultMessage:"Interval",id:"workers.detail.capabilities.schedule.interval"})}),(0,s.jsx)("option",{value:"continuous",children:c.formatMessage({defaultMessage:"Continuous",id:"workers.detail.capabilities.schedule.continuous"})})]}),"interval"===u?(0,s.jsx)("input",{type:"text",value:y,onChange:S,disabled:d,placeholder:"e.g. 4h, 30m",style:f?l.scheduleInput:l.scheduleInputError,"aria-label":`Schedule interval for ${t.key}`}):void 0,b?(0,s.jsx)("button",{onClick:j,disabled:!v,style:v?l.scheduleSaveButton:l.scheduleSaveButtonDisabled,type:"button",children:d?"...":c.formatMessage({defaultMessage:"Save",id:"workers.detail.capabilities.schedule.save"})}):void 0]})}function p(e){return e.config.schedule??{type:"interval",intervalMs:18e5}}function m(e){switch(e._tag){case"sync":if(!e.config.schema)return e.key;return"dataSourceTitle"in e.config.schema?e.config.schema.dataSourceTitle:e.config.schema.defaultName;case"tool":case"automation":case"workflow":case"webhook":return e.config.description;case"oauth":return e.config.name;case"custom_block":return e.key}}let u={section:{display:"flex",flexDirection:"column",gap:24,paddingInline:4},sectionTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},sectionSubtitle:{fontSize:14,color:a(632079).Tj.text.secondary,maxWidth:520},tableContainer:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden"},tableHeader:{display:"grid",gridTemplateColumns:"minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 1.4fr) minmax(0, 0.8fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary,color:a(632079).Tj.text.secondary,fontSize:12,fontWeight:a(699422).Wy.medium,textTransform:"uppercase",letterSpacing:.4,gap:16},tableBody:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},headerCell:{textAlign:"start"},rowDivider:{borderBottom:`1px solid ${a(632079).Tj.border.secondary}`},runName:{fontSize:14,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.primary,wordBreak:"break-word"},exitCode:{fontSize:12,color:a(632079).Tj.text.secondary},startedAt:{fontSize:12,color:a(632079).Tj.text.secondary},duration:{fontSize:12,color:a(632079).Tj.text.secondary},emptyState:{fontSize:12,color:a(632079).Tj.text.secondary,paddingInline:4}};function h(e){let{runs:t,onRunSelect:n}=e,r=(0,a(327219).tz)(),o=(0,a(960253).I)(()=>({row:{display:"grid",gridTemplateColumns:"minmax(0, 2fr) minmax(0, 0.8fr) minmax(0, 1.4fr) minmax(0, 0.8fr)",alignItems:"center",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.primary,gap:16,cursor:n?"pointer":"default"}}),[n]),l=(0,i.useMemo)(()=>[...t].sort((e,t)=>
106{let a=new Date(e.startedAt).getTime();return new Date(t.startedAt).getTime()-a}),[t]);return(0,s.jsxs)("section",{style:u.section,children:[(0,s.jsxs)(a(4458).VP,{gap:4,children:[(0,s.jsx)("div",{style:u.sectionTitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Recent runs",id:"workers.detail.runs.title"})}),(0,s.jsx)("div",{style:u.sectionSubtitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Latest executions for this worker.",id:"workers.detail.runs.subtitle"})})]}),l.length>0?(0,s.jsxs)("div",{style:u.tableContainer,children:[(0,s.jsxs)("div",{style:u.tableHeader,children:[(0,s.jsx)("div",{style:u.headerCell,children:"Name"}),(0,s.jsx)("div",{style:u.headerCell,children:"Exit code"}),(0,s.jsx)("div",{style:u.headerCell,children:"Started"}),(0,s.jsx)("div",{style:u.headerCell,children:"Duration"})]}),(0,s.jsx)("div",{style:u.tableBody,children:l.map((e,t)=>{let i,d,c,p,m,h=new Date(e.startedAt),y=e.endedAt?new Date(e.endedAt):void 0,g=y?Math.max(y.getTime()-h.getTime(),0):void 0,x=t===l.length-1?o.row:{...o.row,...u.rowDivider};return(0,s.jsxs)("div",{style:x,role:n?"button":void 0,tabIndex:n?0:void 0,onClick:()=>{null==n||n(e)},children:[(0,s.jsx)("div",{style:u.runName,children:e.name}),(0,s.jsx)("div",{style:u.exitCode,children:null!==e.exitCode?e.exitCode:r.formatMessage({defaultMessage:"In progress",id:"workers.detail.runs.exitCode.inProgress"})}),(0,s.jsx)("div",{style:u.startedAt,children:(0,s.jsx)("time",{dateTime:h.toISOString(),title:r.formatDate(h,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),children:(0,a(497491).nl)(h.getTime())})}),(0,s.jsx)("div",{style:u.duration,children:void 0!==g?(c=Math.floor((d=Math.floor((i=Math.max(Math.floor(g/1e3),0))/60))/60),p=d%60,m=i%60,c>0?[`${c}h`,p>0?`${p}m`:void 0,m>0?`${m}s`:void 0].filter(Boolean).join(" "):p>0?m>0?`${p}m ${m}s`:`${p}m`:`${m}s`):r.formatMessage({defaultMessage:"In progress",id:"workers.detail.runs.duration.inProgress"})})]},e.runId)})})]}):(0,s.jsx)("div",{style:u.emptyState,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"No runs yet",id:"workers.detail.runs.empty"})})]})}a(730330),a(1310);let y={section:{display:"flex",flexDirection:"column",gap:24,paddingInline:4},sectionTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},sectionSubtitle:{fontSize:14,color:a(632079).Tj.text.secondary,maxWidth:520},capabilityCard:{display:"flex",flexDirection:"column",border:`1px solid ${a(632079).Tj.border.secondary}`,borderRadius:8,overflow:"hidden",marginBottom:16},capabilityHeader:{display:"flex",alignItems:"center",justifyContent:"space-between",paddingBlock:12,paddingInline:16,backgroundColor:a(632079).Tj.background.secondary},capabilityKey:{fontFamily:"monospace",fontSize:14,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},executingTag:{display:"inline-flex",alignItems:"center",paddingBlock:2,paddingInline:8,backgroundColor:a(632079).Tj.blue.background.secondary,color:a(632079).Tj.blue.text.accentPrimary,fontSize:11,fontWeight:a(699422).Wy.semibold,borderRadius:4,textTransform:"uppercase",letterSpacing:.5},statsTable:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:1,backgroundColor:a(632079).Tj.border.secondary},statRow:{display:"flex",flexDirection:"column",gap:2,paddingBlock:10,paddingInline:16,backgroundColor:a(632079).Tj.background.primary},statLabel:{fontSize:11,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.tertiary,textTransform:"uppercase",letterSpacing:.3},statValue:{fontSize:13,color:a(632079).Tj.text.primary},statValueError:{fontSize:13,color:a(632079).Tj.red.text.accentPrimary},payloadSection:{paddingBlock:12,paddingInline:16,borderTop:`1px solid ${a(632079).Tj.border.secondary}`},payloadTitle:{fontSize:12,fontWeight:a(699422).Wy.medium,color:a(632079).Tj.text.secondary,textTransform:"uppercase",letterSpacing:.3},expandButton:{fontSize:12,color:a(632079).Tj.blue.text.accentPrimary,background:"none",border:"none",cursor:"pointer",padding:0,textDecoration:"underline"},codeBlock:{fontFamily:"monospace",fontSize:12,lineHeight:1.5,color:a(632079).Tj.text.secondary,backgroundColor:a(632079).Tj.background.secondary,borderRadius:6,padding:12,overflow:"auto",maxHeight:300,whiteSpace:"pre-wrap",wordBreak:"break-word"},taskMeta:{display:"flex",gap:16,marginBottom:8,fontSize:12,color:a(632079).Tj.text.tertiary},emptyState:{fontSize:12,color:a(632079).Tj.text.secondary,paddingInline:4},collectionLink:{fontSize:12,color:a(632079).Tj.blue.text.accentPrimary,textDecoration:"none",cursor:"pointer"}};function g(e){let{syncTasks:t,spaceDomain:n}=e,r=(0,a(327219).tz)(),[o,l]=(0,i.useState)({}),d=(0,i.useCallback)(e=>{l(t=>({...t,[e]:!t[e]}))},[]),c=(0,i.useCallback)(e=>{if(!e)return"—";let t=new Date(e);return r.formatDate(t,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"})},[r]),p=(0,i.useCallback)(e=>{if(void 0===e)return"—";if(e<1e3)return`${e}ms`;if(e<6e4)return`${(e/1e3).toFixed(1)}s`;let t=Math.floor(e/6e4),a=Math.floor(e%6e4/1e3);return`${t}m ${a}s`},[]);return(0,s.jsxs)("section",{style:y.section,children:[(0,s.jsxs)(a(4458).VP,{gap:4,children:[(0,s.jsx)("div",{style:y.sectionTitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Sync Tasks",id:"workers.detail.syncTasks.title"})}),(0,s.jsx)("div",{style:y.sectionSubtitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Active sync capabilities and their execution stats.",id:"workers.detail.syncTasks.subtitle"})})]}),0===t.length?(0,s.jsx)("div",{style:y.emptyState,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"No sync capabilities configured",id:"workers.detail.syncTasks.empty"})}):void 0,t.map(e=>{var t,i;let{capabilityKey:l,task:m,stats:u,collectionId:h}=e,g=function(e){let{lastExecutionStartedAt:t,lastSucceededAt:a,lastFailedAt:i}=e;return!!t&&t>Math.max(a??0,i??0)}(u),f=function(e){if(0!==e.length)return Math.round(e.reduce((e,t)=>
106e+t,0)/e.length)}(u.recentRunDurationsMs),b=JSON.stringify(m.state,null,2),v=`${l}:${m.key}`,j=`${v}:taskState`,k=`${v}:lastFailureErrorMessage`,S=o[j]??!1,w=S||b.length<=500?b:x(b,500),I=void 0!==u.lastFailureErrorMessage&&u.lastFailureErrorMessage.trim().length>0,C=void 0!==u.lastSystemErrorMessage&&u.lastSystemErrorMessage.trim().length>0,D=!I&&C,T=I?null==(t=u.lastFailureErrorMessage)?void 0:t.trim():D?r.formatMessage({defaultMessage:"System error: {message}",id:"workers.detail.syncTasks.systemErrorMessage"},{message:(null==(i=u.lastSystemErrorMessage)?void 0:i.trim())??""}):void 0,R=void 0!==T&&T.trim().length>0,A=o[k]??!1,N=R?A||T.length<=500?T:x(T,500):"—";return(0,s.jsxs)("div",{style:y.capabilityCard,children:[(0,s.jsx)("div",{style:y.capabilityHeader,children:(0,s.jsxs)(a(4458).fI,{alignItems:"center",gap:12,children:[(0,s.jsx)("span",{style:y.capabilityKey,children:l}),g?(0,s.jsx)("span",{style:y.executingTag,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Executing",id:"workers.detail.syncTasks.executing"})}):void 0,h&&n?(0,s.jsx)("a",{href:`/${n}/ds/${h.replace(/-/g,"")}`,style:y.collectionLink,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"View database",id:"workers.detail.syncTasks.viewDatabase"})}):void 0]})}),(0,s.jsxs)("div",{style:y.statsTable,children:[(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Cycle Started"}),(0,s.jsx)("span",{style:y.statValue,children:c(u.cycleStartedAt)})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Last Execution"}),(0,s.jsx)("span",{style:y.statValue,children:c(u.lastExecutionStartedAt)})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Last Success"}),(0,s.jsx)("span",{style:y.statValue,children:c(u.lastSucceededAt)})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Last Completed"}),(0,s.jsx)("span",{style:y.statValue,children:c(u.lastCompletedAt)})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Failing Since"}),(0,s.jsx)("span",{style:u.failingSince?y.statValueError:y.statValue,children:c(u.failingSince)})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Consecutive Failures"}),(0,s.jsx)("span",{style:u.consecutiveFailureCount>0?y.statValueError:y.statValue,children:u.consecutiveFailureCount})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Total Upserts"}),(0,s.jsx)("span",{style:y.statValue,children:u.totalUpsertsProcessed.toLocaleString()})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Total Deletes"}),(0,s.jsx)("span",{style:y.statValue,children:u.totalDeletesProcessed.toLocaleString()})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Avg Cycle Duration"}),(0,s.jsx)("span",{style:y.statValue,children:p(f)})]}),(0,s.jsxs)("div",{style:y.statRow,children:[(0,s.jsx)("span",{style:y.statLabel,children:"Empty Responses"}),(0,s.jsx)("span",{style:y.statValue,children:u.consecutiveEmptyResponseCount})]})]}),(0,s.jsxs)("div",{style:y.payloadSection,children:[(0,s.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",marginBottom:8,children:[(0,s.jsx)("span",{style:y.payloadTitle,children:D?"Last System Error":"Last Failure Error"}),R&&T.length>500?(0,s.jsx)("button",{style:y.expandButton,onClick:()=>{d(k)},children:A?"Show less":"Show more"}):void 0]}),(0,s.jsx)("pre",{style:y.codeBlock,children:N})]}),(0,s.jsxs)("div",{style:y.payloadSection,children:[(0,s.jsxs)(a(4458).fI,{alignItems:"center",justifyContent:"space-between",marginBottom:8,children:[(0,s.jsx)("span",{style:y.payloadTitle,children:"Task State"}),b.length>500?(0,s.jsx)("button",{style:y.expandButton,onClick:()=>{d(j)},children:S?"Show less":"Show more"}):void 0]}),(0,s.jsxs)("div",{style:y.taskMeta,children:[(0,s.jsxs)("span",{children:["Key: ",m.key]}),(0,s.jsxs)("span",{children:["Initialized: ",c(m.initializedAt)]})]}),(0,s.jsx)("pre",{style:y.codeBlock,children:w})]})]},v)})]})}function x(e,t){return e.length<=t?e:e.slice(0,t)+"..."}let f={headerSection:{display:"flex",flexDirection:"column",gap:12,paddingInline:4},headerTitle:{fontSize:28,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},headerMeta:{display:"flex",flexWrap:"wrap",gap:4,columnGap:16,fontSize:14,color:a(632079).Tj.text.secondary},headerMetaLabel:{color:a(632079).Tj.text.tertiary},code:{fontFamily:"monospace",fontSize:12,color:a(632079).Tj.text.secondary,wordBreak:"break-word"}};function b(e){let{worker:t,capabilities:n,runs:r,syncTasks:o,isReadOnly:l,spaceDomain:c,onFetchRunLogs:p,onToggleDisabled:m,isUpdatingCapability:u,onUpdateSchedule:y,isUpdatingSchedule:x}=e,b=(0,a(327219).tz)(),[v,k]=(0,i.useState)(null),[S,w]=(0,i.useState)(!1),[I,C]=(0,i.useState)({isLoading:!1}),D=(0,i.useCallback)(e=>{k(e),w(!0),C({isLoading:!0}),p?p(e.runId).then(e=>{e?C({logs:e.logs,output:e.output,isLoading:!1}):C({isLoading:!1,error:"Failed to load logs"})}).catch(()=>{C({isLoading:!1,error:"Failed to load logs"})}):C({isLoading:!1})}
106,[p]),T=(0,i.useCallback)(()=>{w(!1),k(null),C({isLoading:!1})},[]),R=new Date(t.createdAt),A=R.getTime();return(0,s.jsxs)(a(4458).VP,{gap:32,children:[(0,s.jsxs)("div",{style:f.headerSection,children:[(0,s.jsx)("div",{style:f.headerTitle,children:t.name}),(0,s.jsxs)("div",{style:f.headerMeta,children:[(0,s.jsxs)(a(4458).fI,{alignItems:"baseline",gap:6,children:[(0,s.jsx)("span",{style:f.headerMetaLabel,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Created",id:"workers.detail.createdLabel"})}),(0,s.jsx)("time",{dateTime:R.toISOString(),title:b.formatDate(R,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),children:(0,a(497491).nl)(A)})]}),(0,s.jsxs)(a(4458).fI,{alignItems:"baseline",gap:6,children:[(0,s.jsx)("span",{style:f.headerMetaLabel,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Worker ID",id:"workers.detail.workerIdLabel"})}),(0,s.jsx)("span",{style:f.code,children:t.workerId})]}),t.ownerUserId?(0,s.jsxs)(a(4458).fI,{alignItems:"baseline",gap:6,children:[(0,s.jsx)("span",{style:f.headerMetaLabel,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Owner",id:"workers.detail.ownerLabel"})}),(0,s.jsx)("span",{style:f.code,children:t.ownerUserId})]}):void 0]})]}),(0,s.jsx)(d,{capabilities:n,isReadOnly:l,onToggleDisabled:m,isUpdatingCapability:u,onUpdateSchedule:y,isUpdatingSchedule:x}),(0,s.jsx)(g,{syncTasks:o,spaceDomain:c}),(0,s.jsx)(h,{runs:r,onRunSelect:D}),(0,s.jsx)(j,{run:v,isOpen:S&&null!==v,onDismiss:T,logs:I.logs,output:I.output,isLoading:I.isLoading,error:I.error})]})}let v={modalTitle:{fontSize:20,fontWeight:a(699422).Wy.semibold,color:a(632079).Tj.text.primary},modalSubtitle:{fontSize:14,color:a(632079).Tj.text.secondary},metaList:{display:"grid",gridTemplateColumns:"minmax(0, 120px) 1fr",columnGap:16,rowGap:4,fontSize:12,color:a(632079).Tj.text.secondary},metaLabel:{color:a(632079).Tj.text.tertiary,fontWeight:a(699422).Wy.medium},metaValue:{color:a(632079).Tj.text.secondary},tabBar:{marginTop:4},outputContainer:{backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,border:`1px solid ${a(632079).Tj.border.secondary}`,padding:16,maxHeight:480,overflowY:"auto",overflowX:"auto",color:a(632079).Tj.text.primary},outputText:{margin:0,fontFamily:"monospace",fontSize:12,whiteSpace:"pre",wordWrap:"normal"},logsContainer:{fontFamily:"monospace",whiteSpace:"pre-wrap",backgroundColor:a(632079).Tj.background.secondary,borderRadius:8,border:`1px solid ${a(632079).Tj.border.secondary}`,padding:16,maxHeight:480,overflowY:"auto",color:a(632079).Tj.text.primary},loadingContainer:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:a(632079).Tj.text.secondary},emptyState:{fontSize:12,color:a(632079).Tj.text.secondary},errorText:{fontSize:12,color:a(632079).Tj.red.text.accentPrimary}};function j(e){let{run:t,isOpen:n,onDismiss:r,logs:o,output:l,isLoading:d,error:c}=e,p=(0,a(327219).tz)(),[m,u]=(0,i.useState)(0),h=(0,i.useCallback)(e=>{u(e)},[]),y=(0,i.useMemo)(()=>[(0,s.jsx)(a(327219).sA,{defaultMessage:"Output",id:"workers.detail.runs.outputTab"},"output"),(0,s.jsx)(a(327219).sA,{defaultMessage:"Logs",id:"workers.detail.runs.logsTab"},"logs")],[]),g=(0,i.useMemo)(()=>{if(void 0===l)return{type:"empty",value:""};let e=l.trim();if(0===e.length)return{type:"empty",value:""};let t=function(e){try{return JSON.parse(e)}catch(e){if(e instanceof SyntaxError)return;throw e}}(e);return void 0!==t?{type:"json",value:JSON.stringify(t,null,2)}:{type:"text",value:l}},[l]);if(!t)return null;let x=new Date(t.startedAt),f=t.endedAt?new Date(t.endedAt):void 0,b=f?Math.max(f.getTime()-x.getTime(),0):void 0,j="workers-run-output-logs";return(0,s.jsx)(a(521180).A,{open:n,onDismiss:r,renderContent:()=>{let e,i,n,l,u;return(0,s.jsxs)(a(4458).VP,{width:720,maxWidth:"90vw",padding:24,gap:16,children:[(0,s.jsxs)(a(4458).VP,{gap:4,children:[(0,s.jsx)("div",{style:v.modalTitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Run output and logs",id:"workers.detail.runs.logsModalTitle"})}),(0,s.jsx)("div",{style:v.modalSubtitle,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Inspect the output and logs captured for this run.",id:"workers.detail.runs.logsModalSubtitle"})})]}),(0,s.jsxs)("div",{style:v.metaList,children:[(0,s.jsx)("div",{style:v.metaLabel,children:"Run"}),(0,s.jsx)("div",{style:v.metaValue,children:t.name}),(0,s.jsx)("div",{style:v.metaLabel,children:"Started"}),(0,s.jsx)("div",{style:v.metaValue,children:(0,s.jsx)("time",{dateTime:x.toISOString(),title:p.formatDate(x,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric"}),children:p.formatDate(x,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"numeric"})})}),(0,s.jsx)("div",{style:v.metaLabel,children:"Exit code"}),(0,s.jsx)("div",{style:v.metaValue,children:null!==t.exitCode?t.exitCode:p.formatMessage({defaultMessage:"In progress",id:"workers.detail.runs.exitCode.inProgress"})}),(0,s.jsx)("div",{style:v.metaLabel,children:"Duration"}),(0,s.jsx)("div",{style:v.metaValue,children:void 0!==b?(n=Math.floor((i=Math.floor((e=Math.max(Math.floor(b/1e3),0))/60))/60),l=i%60,u=e%60,n>0?[`${n}h`,l>0?`${l}m`:void 0,u>0?`${u}
106s`:void 0].filter(Boolean).join(" "):l>0?u>0?`${l}m ${u}s`:`${l}m`:`${u}s`):p.formatMessage({defaultMessage:"In progress",id:"workers.detail.runs.duration.inProgress"})})]}),(0,s.jsx)("div",{style:v.tabBar,children:(0,s.jsx)(a(540336).LZ,{tabs:y,selectedIndex:m,onChange:h,idPrefix:j})}),0===m?(0,s.jsx)("div",{role:"tabpanel",id:(0,a(540336).Jy)(j,0),"aria-labelledby":(0,a(540336).vU)(j,0),children:d?(0,s.jsxs)("div",{style:v.loadingContainer,children:[(0,s.jsx)(a(517334).k,{size:"sm"}),(0,s.jsx)(a(327219).sA,{defaultMessage:"Loading output…",id:"workers.detail.runs.outputLoading"})]}):c?(0,s.jsx)("div",{style:v.errorText,children:c}):"empty"===g.type?(0,s.jsx)("div",{style:v.emptyState,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"No output for this run",id:"workers.detail.runs.outputEmpty"})}):(0,s.jsx)("div",{style:v.outputContainer,children:"json"===g.type?(0,s.jsx)(a(207270).O,{value:g.value,language:"json",preserveWhitespace:!0}):(0,s.jsx)("pre",{style:v.outputText,children:g.value})})}):(0,s.jsx)("div",{role:"tabpanel",id:(0,a(540336).Jy)(j,1),"aria-labelledby":(0,a(540336).vU)(j,1),children:d?(0,s.jsxs)("div",{style:v.loadingContainer,children:[(0,s.jsx)(a(517334).k,{size:"sm"}),(0,s.jsx)(a(327219).sA,{defaultMessage:"Loading logs…",id:"workers.detail.runs.logsLoading"})]}):c?(0,s.jsx)("div",{style:v.errorText,children:c}):o&&o.trim().length>0?(0,s.jsx)("div",{style:v.logsContainer,children:o}):(0,s.jsx)("div",{style:v.emptyState,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"No logs for this run",id:"workers.detail.runs.logsEmpty"})})}),(0,s.jsx)(a(4458).fI,{justifyContent:"flex-end",marginTop:8,children:(0,s.jsx)(a(988022).p,{onClick:r,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Close",id:"workers.detail.runs.logsClose"})})})]})}})}},502193(e,t,a){a.d(t,{E:()=>l}),a(533958);var i=a(635790);let n={SimpleMonacoWrapper:new(a(552709)).O2("SimpleMonacoWrapper",async()=>{let[e,t,i]=await Promise.all([Promise.all([a.e(2243),a.e(54777)]).then(a.bind(a,187471)).then(e=>e.default),a.e(46197).then(a.bind(a,551922)).then(e=>e.loader),Promise.all([a.e(46197),a.e(75294)]).then(a.bind(a,985687))]);return t.config({monaco:e}),i})},r=(0,a(552709)._h)(n.SimpleMonacoWrapper,e=>e.SimpleMonacoWrapper);var s=a(440302);let o={position:"absolute",top:8,insetInlineEnd:12,display:"flex",gap:8,zIndex:1};function l(e){let{value:t,onSave:n,disabled:l,language:d="typescript",onFocus:c,onBlur:p,onChange:m,fetchTypescriptImports:u,fillHeight:h,size:y="default",wrappingStrategy:g}=e,x=(0,i.useRef)(null),[f,b]=i.useState(t),v=(0,a(668745).ZC)(t);i.useEffect(()=>{if(v===f&&t!==v){var e;b(t),null==(e=x.current)||e.setValue(t)}},[f,v,t]);let j=(0,i.useCallback)(()=>{if(f!==t)try{null==n||n(f)}catch(e){console.error(e),e instanceof Error&&a(647095).rG({message:e.message})}},[n,f,t]),k=(0,i.useCallback)(()=>{var e;b(t),null==(e=x.current)||e.setValue(t)},[t]),S=(0,i.useCallback)(e=>{b(e??""),null==m||m(e??"")},[m]),w=(0,i.useCallback)(e=>{x.current=e},[]),[I,C]=i.useState(void 0);(0,a(97668).Yb)(async()=>{u&&C(await u())},[u]);let D=(0,a(960253).I)(()=>({container:{position:"relative",borderRadius:8*!h,overflow:"hidden",height:h?"100%":"compact"===y?260:"50vh",display:"flex",flexDirection:"column",minHeight:h?400:"compact"===y?180:400}}),[h,y]);return(0,s.jsxs)("div",{style:D.container,children:[t!==f?(0,s.jsxs)("div",{style:o,children:[(0,s.jsx)(a(988022).p,{onClick:k,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Discard",id:"workflow.monacoCodeBlock.discard"})}),(0,s.jsx)(a(988022).p,{onClick:j,children:(0,s.jsx)(a(327219).sA,{defaultMessage:"Save changes",id:"workflow.monacoCodeBlock.save"})})]}):void 0,(0,s.jsx)(r,{language:d,value:f,disabled:l,onChange:S,onMount:w,onFocus:c,onBlur:p,imports:I,wrappingStrategy:g})]})}},487378(e,t,a){a.d(t,{y:()=>n,x:()=>i});let i=["asana","box","calendar","computer","confluence","cursor","discord","feedback","files","fs","github","gmail","googleCalendar","googleDrive","googleDriveOauth","gtm","helpdocs","images","jira","linear","mail","marketplace","mcpServer","memory","microsoftTeams","microsoftTeamsOauth","notion","outlook","salesforce","search","security","sharepoint","sharepointOauth","shopify","skills","slack","system","test","web","webhooks","worker","workers"];function n(e){return!!("string"==typeof e&&(0,a(48697).Xk)(i,e))}},480674(e,t,a){a.r(t),a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"2.66 3.01 10.68 10.48",svg:(0,a(440302).jsx)("path",{d:"M3.286 3.015a.625.625 0 0 0-.625.625v2.8a.625.625 0 0 0 1.25 0V5.15l2.382 2.38a3.7 3.7 0 0 1 1.082 2.607v3.277c0 .042.034.075.075.075h1.1a.075.075 0 0 0 .075-.075v-3.277A3.7 3.7 0 0 1 9.707 7.53l2.382-2.382V6.44a.625.625 0 1 0 1.25 0v-2.8a.625.625 0 0 0-.625-.625h-2.8a.625.625 0 0 0 0 1.25h1.29l-2.38 2.382A5 5 0 0 0 8 7.737a5 5 0 0 0-.823-1.09L4.795 4.265h1.291
106a.625.625 0 0 0 0-1.25z"})},n=(0,a(104509).wt)("arrowBranchSmall",i,"small");a.d(t,{},{arrowBranchSmallIcon:n,iconDefinition:i})},551754(e,t,a){a.r(t),a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"2.25 3.46 11.5 9.09",directional:!0,svg:(0,a(440302).jsx)("path",{d:"M7.33 12.33a.75.75 0 0 1-1.06 0l-3.8-3.8a.75.75 0 0 1 0-1.06l3.8-3.8a.75.75 0 0 1 1.06 1.06L4.81 7.25H13a.75.75 0 0 1 0 1.5H4.81l2.52 2.52a.75.75 0 0 1 0 1.06"})},n=(0,a(104509).wt)("arrowStraightLeftFillSmall",i,"fillSmall");a.d(t,{},{arrowStraightLeftFillSmallIcon:n,iconDefinition:i})},969278(e,t,a){a.r(t),a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"2.37 3.59 11.26 8.84",directional:!0,svg:(0,a(440302).jsx)("path",{d:"M8.758 12.243c.244.243.64.244.885 0l3.8-3.801a.625.625 0 0 0 0-.884l-3.8-3.8a.626.626 0 0 0-.885.884l2.733 2.733H3a.625.625 0 1 0 0 1.25h8.491l-2.733 2.733a.626.626 0 0 0 0 .885"})},n=(0,a(104509).wt)("arrowStraightRightSmall",i,"small");a.d(t,{},{arrowStraightRightSmallIcon:n,iconDefinition:i})},782558(e,t,a){a(635790);var i=a(440302);let n={viewBox:"0 0 16 16",fittedViewBox:"2.57 1.62 10.86 12",svg:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M12.8 9.575c.345 0 .625.28.625.625v1.6a1.825 1.825 0 0 1-1.824 1.825H4.4A1.826 1.826 0 0 1 2.574 11.8v-1.6a.625.625 0 1 1 1.25 0v1.6c0 .317.258.575.575.575h7.2a.575.575 0 0 0 .575-.575v-1.6c0-.345.28-.625.625-.625"}),(0,i.jsx)("path",{d:"M7.96 1.625c.345 0 .625.28.625.625v6.46l1.753-1.752a.626.626 0 0 1 .885.884l-2.801 2.8-.098.08a.626.626 0 0 1-.786-.08l-2.8-2.8a.625.625 0 0 1 .884-.884l1.713 1.713V2.25c0-.345.28-.625.625-.625"})]})},r=(0,a(104509).wt)("arrowTrayDownSmall",n,"small");a.d(t,{},{_:r})},504655(e,t,a){a.r(t),a(635790);var i=a(440302);let n={viewBox:"0 0 16 16",fittedViewBox:"2.78 2.12 10.44 11.75",svg:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M10.172 5.564a.625.625 0 0 0-.858.214L7.36 9.035 6.325 7.827a.625.625 0 1 0-.95.813l1.6 1.867a.625.625 0 0 0 1.01-.085l2.4-4a.625.625 0 0 0-.213-.858"}),(0,i.jsx)("path",{d:"M8.28 2.191a.63.63 0 0 0-.56 0l-.962.481a7.25 7.25 0 0 1-3.242.765h-.11a.625.625 0 0 0-.625.626v4.333a5 5 0 0 0 3.03 4.596l1.943.832a.63.63 0 0 0 .492 0l1.942-.832a5 5 0 0 0 3.03-4.596V4.062a.625.625 0 0 0-.624-.625h-.11a7.25 7.25 0 0 1-3.242-.765zm-.963 1.6L8 3.448l.683.341a8.5 8.5 0 0 0 3.286.882v3.724a3.75 3.75 0 0 1-2.273 3.447L8 12.57l-1.696-.727a3.75 3.75 0 0 1-2.273-3.447V4.672a8.5 8.5 0 0 0 3.286-.882"})]})},r=(0,a(104509).wt)("checkmarkShieldSmall",n,"small");a.d(t,{},{checkmarkShieldSmallIcon:r,iconDefinition:n})},433413(e,t,a){a(635790);var i=a(440302);let n={viewBox:"0 0 16 16",fittedViewBox:"2.37 2.37 11.25 11.25",svg:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("path",{d:"M10.172 5.564a.625.625 0 0 0-.858.214L7.36 9.035 6.325 7.827a.625.625 0 1 0-.95.813l1.6 1.867a.625.625 0 0 0 1.01-.085l2.4-4a.625.625 0 0 0-.213-.858"}),(0,i.jsx)("path",{d:"M4.25 2.375c-1.036 0-1.875.84-1.875 1.875v7.5c0 1.036.84 1.875 1.875 1.875h7.5c1.036 0 1.875-.84 1.875-1.875v-7.5c0-1.036-.84-1.875-1.875-1.875zM3.625 4.25c0-.345.28-.625.625-.625h7.5c.345 0 .625.28.625.625v7.5c0 .345-.28.625-.625.625h-7.5a.625.625 0 0 1-.625-.625z"})]})},r=(0,a(104509).wt)("checkmarkSquareSmall",n,"small");a.d(t,{},{h:r})},967335(e,t,a){a(635790);let i={viewBox:"0 0 20 20",fittedViewBox:"4.12 1.5 11.75 16",svg:(0,a(440302).jsx)("path",{d:"M11.5 1.5c.768 0 1.41.534 1.58 1.25h.67c1.174 0 2.125.951 2.125 2.125v10.5A2.125 2.125 0 0 1 13.75 17.5h-7.5a2.125 2.125 0 0 1-2.125-2.125v-10.5c0-1.174.951-2.125 2.125-2.125h.67c.17-.716.812-1.25 1.58-1.25zM6.25 4a.875.875 0 0 0-.875.875v10.5c0 .483.392.875.875.875h7.5a.875.875 0 0 0 .875-.875v-10.5A.875.875 0 0 0 13.75 4h-.67a1.626 1.626 0 0 1-1.58 1.25h-3c-.768 0-1.41-.534-1.58-1.25zM8.5 2.75a.375.375 0 0 0-.375.375v.5c0 .207.168.375.375.375h3a.375.375 0 0 0 .375-.375v-.5a.375.375 0 0 0-.375-.375z"})},n=(0,a(104509).wt)("clipboard",i,"default");a.d(t,{},{i:n})},107492(e,t,a){a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"0.89 2.33 14.22 11.31",svg:(0,a(440302).jsx)("path",{d:"M9.611 2.36c.332.094.524.44.429.772l-2.88 10.08a.625.625 0 0 1-1.201-.344l2.88-10.08a.625.625 0 0 1 .772-.428M4.246 4.39a.626.626 0 0 1 .885.885L2.404 8l2.727 2.727a.626.626 0 0 1-.885.884L1.078 8.443a.627.627 0 0 1 0-.885zm6.624 0a.626.626 0 0 1 .885 0l3.168 3.168a.627.627 0 0 1 0 .885l-3.168 3.168a.625.625 0 0 1-.885-.884L13.596 8 10.87 5.275a.626.626 0 0 1 0-.885"})}
106,n=(0,a(104509).wt)("codeSmall",i,"small");a.d(t,{},{c:n})},773225(e,t,a){let i=(0,a(104509).xh)("infoCircle",{default:{loader:()=>a.e(5754).then(a.bind(a,61107))},small:{loader:()=>a.e(5754).then(a.bind(a,372181))},fill:{loader:()=>a.e(5754).then(a.bind(a,923007))},fillSmall:{loader:()=>a.e(5754).then(a.bind(a,827670))}},["info","circle","information","help","details"]);a.d(t,{},{H:i})},440956(e,t,a){a.r(t),a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"3.96 1.38 8.07 13.24",svg:(0,a(440302).jsx)("path",{d:"M8 1.385c-2.23 0-4.035 1.793-4.035 3.985 0 .782.193 1.525.56 2.147.09.161.181.312.281.473.454.725.86 1.386.86 2.08a.63.63 0 0 0 .624.625.63.63 0 0 0 .625-.625c.01-1.064-.553-1.972-1.041-2.75l-.27-.448a3 3 0 0 1-.389-1.512C5.215 3.853 6.46 2.625 8 2.625s2.785 1.228 2.785 2.735c0 .558-.137 1.084-.39 1.512l-.269.449-.01.016c-.475.773-1.03 1.675-1.03 2.723a.63.63 0 0 0 .55.62v.015h.074a.63.63 0 0 0 .625-.625c0-.684.406-1.355.859-2.08v-.002l.001-.001q.067-.117.139-.233t.141-.237c.367-.622.56-1.365.56-2.147 0-2.202-1.815-3.985-4.035-3.985m-1.6 10.19a.63.63 0 0 0-.625.625.63.63 0 0 0 .625.625h3.2a.63.63 0 0 0 .625-.625.63.63 0 0 0-.625-.625zm.8 1.8a.63.63 0 0 0-.625.625.63.63 0 0 0 .625.625h1.6A.63.63 0 0 0 9.425 14a.63.63 0 0 0-.625-.625z"})},n=(0,a(104509).wt)("lightBulbBrightSmall",i,"small");a.d(t,{},{iconDefinition:i,lightBulbBrightSmallIcon:n})},921048(e,t,a){a.r(t),a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"1.97 1.97 12.46 12.46",svg:(0,a(440302).jsx)("path",{d:"M7.1 1.975a5.125 5.125 0 1 0 3.155 9.164l3.107 3.107a.625.625 0 1 0 .884-.884l-3.107-3.107A5.125 5.125 0 0 0 7.1 1.975M3.225 7.1a3.875 3.875 0 1 1 7.75 0 3.875 3.875 0 0 1-7.75 0"})},n=(0,a(104509).wt)("magnifyingGlassSmall",i,"small");a.d(t,{},{iconDefinition:i,magnifyingGlassSmallIcon:n})},125040(e,t,a){a.r(t),a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"2.81 1.77 10.36 12.45",svg:(0,a(440302).jsx)("path",{d:"M8 1.775c-.947 0-1.717.392-2.237 1.04-.508.633-.747 1.47-.747 2.338s.239 1.704.747 2.337c.52.648 1.29 1.04 2.237 1.04s1.717-.392 2.237-1.04c.508-.633.748-1.47.748-2.337 0-.869-.24-1.705-.748-2.338-.52-.648-1.29-1.04-2.237-1.04M6.738 3.597c.28-.348.69-.572 1.262-.572s.983.224 1.263.572c.291.364.472.904.472 1.556 0 .651-.18 1.191-.472 1.555-.28.348-.69.572-1.263.572s-.982-.224-1.262-.572c-.292-.364-.472-.904-.472-1.555 0-.652.18-1.192.472-1.556M8 9.178c-2.196 0-4.166 1.07-5.007 2.713a1.48 1.48 0 0 0 .2 1.677c.356.413.91.657 1.487.657h6.64c.577 0 1.132-.244 1.486-.657a1.48 1.48 0 0 0 .201-1.677c-.84-1.643-2.81-2.713-5.007-2.713m-3.894 3.283c.583-1.14 2.062-2.033 3.894-2.033s3.311.893 3.895 2.033q.045.089.033.154a.27.27 0 0 1-.07.14.72.72 0 0 1-.538.22H4.68a.72.72 0 0 1-.537-.22.27.27 0 0 1-.07-.14.26.26 0 0 1 .033-.154"})},n=(0,a(104509).wt)("personSmall",i,"small");a.d(t,{},{iconDefinition:i,personSmallIcon:n})},799472(e,t,a){let i=(0,a(104509).xh)("questionMarkCircle",{default:{loader:()=>a.e(88135).then(a.bind(a,80094))},small:{loader:()=>a.e(88135).then(a.bind(a,211052))},fill:{loader:()=>a.e(88135).then(a.bind(a,769980))},fillSmall:{loader:()=>a.e(88135).then(a.bind(a,479491))}},["question","query","inquiry","uncertain","unknown","help","circle"]);a.d(t,{},{u:i})},53634(e,t,a){a(635790);let i={viewBox:"0 0 16 16",fittedViewBox:"1.17 1.53 13.65 12.93",svg:(0,a(440302).jsx)("path",{d:"M4.577 1.536a.7.7 0 0 0-.7.7c0 .362-.236.87-.684 1.317-.448.448-.955.683-1.316.683a.7.7 0 1 0 0 1.4c.36 0 .868.236 1.316.684s.684.955.684 1.316a.7.7 0 1 0 1.4 0c0-.36.235-.868.683-1.316s.955-.684 1.317-.684a.7.7 0 1 0 0-1.4c-.362 0-.87-.235-1.317-.683-.448-.448-.683-.955-.683-1.317a.7.7 0 0 0-.7-.7m-.394 3.007q.208-.208.394-.451a4.4 4.4 0 0 0 .844.844 4.4 4.4 0 0 0-.844.845 4.4 4.4 0 0 0-.845-.845 4 4 0 0 0 .451-.393m5.887.413a.7.7 0 0 0-.7.7c0 .831-.392 1.674-1.036 2.318S6.847 9.01 6.016 9.01a.7.7 0 1 0 0 1.4c.831 0 1.674.392 2.318 1.036s1.036 1.487 1.036 2.318a.7.7 0 1 0 1.4 0c0-.831.392-1.674 1.036-2.318s1.487-1.036 2.318-1.036a.7.7 0 1 0 0-1.4c-.831 0-1.674-.392-2.318-1.036S10.77 6.487 10.77 5.656a.7.7 0 0 0-.7-.7m-.746 4.008a5.2 5.2 0 0 0 .746-.941 5.2 5.2 0 0 0 1.687 1.687 5.2 5.2 0 0 0-1.687 1.687A5.2 5.2 0 0 0 8.383 9.71a5.2 5.2 0 0 0 .94-.746"})},n=(0,a(104509).wt)("sparklesSmall",i,"small");a.d(t,{},{m:n})},564513(e,t,a){let i=a(764657).object({required:{id:a(764657).string(),isBot:a(764657).boolean()},optional:{email:a(764657).string(),parent_table:a(764657).string()}}),n=a(764657).object({required:{parentId:a(764657).string(),parentTable:a(764657).string()},optional:{}}),r=a(764657).object({required:{id:a(764657).string(),table:a(764657).string()},optional:{type:a(764657).string(),alive:a(764657).boolean(),createdTime:a(764657).string()}}),s=a(764657).object({required:{id:a(764657).string(),table:a(764657).literal("block")},optional:{title:a(764657).string()}}),o=a(764657).object({required:{id:a(764657).string(),table:a(764657).literal("space")},optional:{name:a(764657).string(),plan_type:a(764657).string()}}),l=a(764657).object({required:{time:a(764657).string(),type:a(764657).string(),authors:a(764657).array(i)},optional:{pageId:a(764657).string(),blockId:a(764657).string()}}),d=a(764657).object({required:{type:a(764657).literals(...a(642157).ZQ)},optional:{role:a(764657).literals(...a(655338).hV),id:a(764657).string(),name:a(764657).string()}}),c=a(764657).object({required:{before:d,after:d},optional:{}}),p=a(764657).object({required:{id:a(764657).string(),time:a(764657).string(),type:a(764657).string(),authors:a(764657).array(i),edits:a(764657).array(l)}
106,optional:{invalid:a(764657).boolean(),page:s,addedPermissions:a(764657).array(d),removedPermissions:a(764657).array(d),changedPermissions:a(764657).array(c)}}),m=a(764657).object({required:{id:a(764657).string(),type:a(764657).string(),endTime:a(764657).string()},optional:{activity:p,navigableBlock:s,read:a(764657).boolean(),received:a(764657).boolean(),emailed:a(764657).boolean(),visited:a(764657).boolean()}}),u=a(764657).object({required:{id:a(764657).string(),name:a(764657).string(),isDefault:a(764657).boolean(),accessLevel:a(764657).literals(...a(708628).nJ),isArchived:a(764657).boolean()},optional:{}});a.d(t,{},{HB:l,K4:u,KZ:c,Kp:m,N5:o,_E:p,k5:s,u5:d,uA:r,v7:n,yZ:i})},420667(e,t,a){a.d(t,{},{G:{"Block Edited":"block-edited",Commented:"commented","Page Locked":"page-locked","Page Unlocked":"page-unlocked","Permissions Edited":"permissions-edited","Page Permanently Deleted":"page-permanently-deleted","Page restored":"page-restored"}})},604063(e,t,a){let i={find:{title:"Find user and workspace information",runbookUrl:void 0,tools:["adminFindObject","adminSearchUsers","adminSearchSpaces","adminSearchBlocks","adminViewRecordTree","adminGetFileMetadata","adminSearchBlockBySlug","adminSearchNotifications","adminSearchTeams","adminSearchCollections","adminSearchCollectionViews","adminSearchSpaceViews","adminSearchForUsersInSpaces","adminGetDataAccessConsent","adminSearchPermanentlyDeletedPages","adminSearchPermanentlyDeletedCollections","adminSearchSpaceActivity","adminGetPublicPages","adminGetPublicForms","adminDebugCollectionForm","adminGetTrial","adminGetOrCreateStripeCustomer","adminGetBulkSpaceIdsByDomain","adminGetBulkSpaceIdsByEmail","adminGetBulkUserIdsByEmail","isEmailEducation","adminGetSpaceMembershipUpdates","adminGetProcessedSpaceMembershipUpdates","adminFlushSpaceMembershipUpdates","adminGetBillingDataInformation","adminGetBillingDataHistory","adminGetSubscriptionUpdatePreview","adminGetLegacyPriceMigrationBanner","adminFindDeletedUser","adminCountWordsInPage","adminReadBlockPermissions","adminListUserPagePermissionBlockIdsInSpace","adminGetAutomationsForRecordId","adminSearchOrganizations","adminSearchAccounts","adminGetPremiumFeatureAvailabilities","adminCalculatePropertyDependencies","adminVerifyPeopleCollection","adminGetSystemBlockIds","adminGetDiscussionInfo","adminGetCommentInfo","adminGetJoinableSpaces","adminGetLegalHold","adminGetLegalHolds","adminGetWorkflowInfo","adminGetSlackAppMentionRegistrationStatus","adminReconcileSlackAppMentionRegistrations","adminClearWorkflowPausedReason","adminSummarizeSkillHealthInSpace","adminDiagnoseSkillSystemForUserInSpace","adminListEntityNotes","adminCreateEntityNote","adminArchiveEntityNote"]},unifiedAccountView:{title:"Unified Account View",runbookUrl:void 0,tools:[],showIfGate:{gateName:"admin_unified_account_view"}},unifiedWorkspaceView:{title:"Unified Workspace View",runbookUrl:void 0,tools:[]},unifiedUserView:{title:"Unified User View",runbookUrl:void 0,tools:[],showIfGate:{gateName:"admin_unified_user_view"}},findAdminLogs:{title:"Find Admin logs",runbookUrl:void 0,tools:["getUserAdminApiLog","getAdminHistory","getSpaceAdminApiLog","getBlockAdminApiLog","adminGetApiLogsByEventName"]},pricing:{title:"Pricing and credits",runbookUrl:void 0,tools:["adminAllowlistCreditDomain","adminCancelSubscription","adminReleaseSubscriptionSchedule","adminDowngradeFraudSubscription","adminGetBillingHistory","adminGetUserBillingInformation","adminManageNonprofitOffer","adminBulkApplyPromotionCodes","adminBulkUpgradeEduPlusUser","adminBulkCreateTimedTrials","adminBulkProvisionMarketingTrials","adminGrantPromotionalNotionCredits","adminRevokePromotionalNotionCredits","adminGetPromotionalCreditGrantAuditLog","allowEducationEmails","adminRemoveAllowedEducationEmails","getPromoCode","getOfferCodeValue","adminGetOfferEligibility","adminGetAllEligibleOffers","adminGetBulkOfferEligibility","adminCleanupDuplicateOfferStatuses","adminBulkAddPromotionCodes","adminPartnerStackFixMissingProductKeys","adminBulkAddEduUniversitiesAndDomains","adminSyncBillingState","adminGetSubscriptionBannerState","adminGetUnrepresentableState","adminSetHighWaterMark","listPrices"]},subscriptions:{title:"Subscriptions",runbookUrl:void 0,tools:["adminUpdateSubscription","adminUpdateAddOnSubscription","adminBulkMigrateToCampusLeaderBusiness","adminUpdateSubscriptionBusinessEnterprise","adminSetSalesAssistedSubscriptionBanner","adminCheckDomainEligibleForSalesAssisted","adminSetSelfServeEnterpriseEligibility","adminBulkSetSalesAssistedSubscriptionBanner","adminGetSubscriptionBannerHistory","adminListAllActiveSubscriptionBanners","adminEmployeeSubscriptionUpdate","adminMonetizationTaskRunnerEnqueue","adminTriggerSubscriptionAuditor","adminSendOnDemandCreditReportEmail","adminBulkSendOnDemandCreditReportEmail","adminRefundInvoice","adminSetPaymentMethodTrustLevel","adminUpsertTrial","adminManageStackedTrial","adminGooglePlayRevokeAndRefund","adminSetEduReverificationTestState"]},recovery:{title:"Recovery",runbookUrl:void 0,tools:["adminRemoveSpaceUsersAndTransferContent","recoverSpace","recoverUser","adminRecoverMfa","adminDeleteUserPasskeys","adminChangeEmail","adminSwapUserEmails","adminSwapUserDomains","adminModifyBlock","adminRestoreBlock","adminBulkRestoreBlocks","adminViewDeletedCollectionProperties","adminRestoreDeletedCollectionProperties","adminRestoreDeletedGuestPermissions","adminMergeUsers","adminRecoverUserContentInSpace","adminReviveBlocksOnPage","adminMakeUserAliasPrimary","adminRemoveUserAlias","adminAddUserAlias","adminRestoreUserAliases","adminMoveBlockSourceFileToCorrectSpace"]},banUsers:{title:"Ban Users",runbookUrl:void 0,tools:["adminBanUser","adminResolveSanctionsAppeal","adminExportBannedUserData","adminDeleteBannedUser","adminBulkBanUsers"]},security:{title:"Security",runbookUrl:void 0,tools:["adminGetRelatedEntities","adminSearchAuditLog","adminQueryRuleEngineTriggers","adminDisableNotionAIForSpace","adminEnableNotionAIForSpace","adminDisableReverifyForUser","adminAddPublicEmailDomains","adminDeleteSpace
106s","adminResetAccounts","adminDeleteUser","adminDangerouslyQueueRemoveUserDirectPermissionsInSpace","adminRemoveAllSpaceGuests","adminGetExternalUserProfile","revokeUserTokens","adminBlockApiBots","adminBulkDeactivateApiBots","adminDeleteFileFromS3","adminBlockEmailDomain","adminUpdateLoginEmailAllowlist","adminUpdateLoginIpAllowlist","adminUpdateGlobalIpAllowlist","adminBypassEmailReputationChecks","adminAddPreservedSpaces","adminRemovePreservedSpaces","adminBlockEmailsToUser","adminUnblockEmailsToUser"]},saml:{title:"SAML and Organization",runbookUrl:void 0,tools:["adminGetSamlConfig","adminDiagnoseEmaBinding","adminGetSpacesForAllowedEmailDomain","adminModifySamlUniqueEntityIds","adminCreateOrganization","adminUpdateOrganizationOwners","adminUpdateOrganizationSpaces","adminMigrateOrganization","adminDeleteOrganization","adminUpdateSamlConfig"]},contentModeration:{title:"Content Moderation",runbookUrl:void 0,tools:["adminSetPageContentClassification","adminBulkUnsetPageContentClassification","adminRemoveDisallowedUrl","adminSetDisableSpacePublicAccess","adminBulkSetDisableSpacePublicAccess","adminRemovePagePublicAccess","adminReportCSAMContent","adminTriggerCSAMScan","adminExportPageForReview"]},rateLimits:{title:"Rate limits",runbookUrl:void 0,tools:["adminGetRateLimits","adminResetRateLimits"]},experiments:{title:"Experiments",runbookUrl:void 0,tools:["adminGetStatsigExperiment","adminGetStatsigFeatureGate","adminCheckStatsigSegment","adminUpdateStatsigSegmentIds"]},lifecycle:{title:"Lifecycle",runbookUrl:void 0,tools:["adminPreviewGtmDecisionDebug","adminDryRunGtmNextBestAction"]},utilities:{title:"Utilities",runbookUrl:void 0,tools:["adminSearchUserAdminToolRoles","adminGetPermissionsData","disableUserAnalytics","adminEditBlockPermissions","adminEditSpacePermissions","adminBulkRemoveSpaceGuests","adminRemoveGhostGuests","adminBulkAddUsersToSpace","adminBulkRemoveTeamMembers","adminOverridePremiumFeatureAvailability","adminOverrideInternalDomains","adminEditTeamMembership","adminUpdateTeamMember","adminUpdateUserSettings","adminShowCustomerInvoice","adminGetBulkIds","adminAddLinkPreviewToSpace","adminQueryCollectionReplay","adminResetUniqueIdCounter","adminGetSpaceIdsForDeletionDate","adminFindOrphanedBlocks","adminClearFreeChartsForSpace","adminGetFreeChartsForSpace","adminResetPageContentCoverToLegacy","adminCreateWorkspaceInRegion","adminResetEdgeCache","deleteBlockPropertiesStaleDataForWorkspace","adminSyncCollectionRelation","adminSyncSpaceViews","adminMarkNotificationsRead","adminQueryDuplicationJobs","adminScheduleDuplication","adminRetryDuplication","adminBootstrapNboUserProfile","adminEnqueueAutoOutboundEnrollmentCron","adminBulkArchiveCollectionPages"]},userRolesPermissions:{title:"User Roles & Permissions",runbookUrl:void 0,tools:["adminEnableSpacePublicAccess","adminValidateTeamMembershipMigrationForSpace","adminRepairPermissionGroupManagementType","adminRepairWorkspaceAccessRequestState"]},notionRepresentativeAccess:{title:"Notion representative access",runbookUrl:void 0,tools:["adminCreateNotionRepresentativeSpaceAccessRequest"],showIfGate:{gateName:"enable_notion_representative_workspace_access"}},integrations:{title:"Integrations",runbookUrl:void 0,tools:["adminGetIntegrationData","adminGetIntegrationRedirectUris","adminUpdateIntegrationData","adminUpdateIntegrationRedirectUris","adminTransferIntegrationOwnership","adminGetCapabilities","adminListIntegrationManagementPermissions","adminUpdateCapabilities","adminSearchBots","adminRevokeBotToken","adminListBotsInOrganization","adminSearchOrganizationBots","adminListBotsInSpace","adminGetSlackIntegrationData","adminGetMicrosoftTeamsConnections","adminDeactivateSlackNotionToken","adminGetSyncedDatabaseData","adminForceResyncExternalObjects","adminRemoveChildFromExternalCollection","adminJoinSpacesForOauthRedirect","adminGetWorkspaceWebhookSubscriptions","adminGetPublicApiRateLimit","adminSetIntegrationRateLimit","adminListIntegrationWebhookSubscriptions","adminUpdateIntegrationWebhookSubscription","adminUpdateBotCapabilities","adminResyncBotBlockPermissions","adminGetPersonalAccessTokenCreationPolicy","adminUpdatePersonalAccessTokenCreationPolicy","adminListPersonalAccessTokenCreationGroups","adminUpdatePersonalAccessTokenCreationGroupPermission","adminGetSpaceConnectionsAllowlist","adminUpdateSpaceApprovedIntegrations","adminSetSpaceConnectionAllowlistMode","adminCreateGlobalOauthClient","adminUpdateGlobalOauthClient","adminGetGlobalOauthClient","adminDeleteGlobalOauthClient","adminListGlobalOauthClients","adminGetMcpClient","adminUpdateMcpClient"]},marketing:{title:"Marketing",runbookUrl:void 0,tools:["adminCreateMarketingRoute","adminBulkSetStartupReferralPartners","adminGetMarketingRoutes"]},domainClaim:{title:"Domain Claim (Management)",runbookUrl:void 0,tools:["adminGetDomainManagementSettings","adminCancelSpaceRequest","adminIsSpaceDomainClaimEligible","adminGetDomainClaimEligibleSpaces","adminGetClaimableWorksp
106acesInOrganization","adminClaimAndUpgradeForSalesAssisted","adminRequestOrganizationClaimForDomainMismatch","adminDelayClaimSpaceDeletion"]},workspaceMigrations:{title:"Workspace Migrations",runbookUrl:"https://dev.notion.so/notion/Internal-EU-Migrations-GTM-Playbook-1b4b35e6e67f80b7bdd7e7b4562e855d",tools:["adminListWorkspaceMigrations","adminStartWorkspaceMigration","adminGetWorkspaceMigrationSteps","adminGetWorkspaceMigrations","adminRetryWorkspaceMigration","adminCancelWorkspaceMigrations","adminUpdateWorkspaceFreeze"]},workspaceConsolidation:{title:"Workspace Consolidation",runbookUrl:void 0,tools:["adminCancelSpaceConsolidation","adminRunSpaceConsolidation"]},migrations:{title:"Migrations",runbookUrl:"https://dev.notion.so/notion/How-to-use-Scalable-Data-Migration-Framework-With-Supervisor-198b35e6e67f8057bdf2f106f91ac420",tools:["adminResumeMigrationSupervisor","adminResumeMigrationWorkersForSupervisor","adminGetMigrationStatusForSupervisor","adminListMigrationWorkersForSupervisor","adminGetMigrationWorkerForSupervisor","adminListMigrationProjects","adminListDataLakeCsvExportDirectories","adminListDynamoDbDataLakeCsvExports","adminCreateMigrationSupervisor","adminMarkMigrationSupervisorAsFailed","adminCleanupMigrationProject"]},migrationDashboard:{title:"Migration Dashboard",runbookUrl:"https://dev.notion.so/notion/How-to-use-Scalable-Data-Migration-Framework-With-Supervisor-198b35e6e67f8057bdf2f106f91ac420",tools:[]},ai:{title:"Notion AI",runbookUrl:void 0,tools:["adminGetBYOKCredentialHistory","adminGetAIProviderRestriction","adminGetOrgAIProviderRestriction","adminSetAIProviderRestriction","adminSetOrgAIProviderRestriction","adminUpdateNotionAIAvailabilityForSpace","adminAddZeroRetentionSpace","adminCheckHIPAAComplianceStatus","adminOnboardAISlackQnA","adminOptOutNotionAIDataSharing","adminIsWorkspaceInQnA","adminSetAssistantEnabledForSpaces","adminSearchAsUser","adminCheckEsDocAccess","adminSemanticSearchAsUser","adminDeleteWorkflows","adminDispatchAgentFacetsBackfill","adminDispatchAgentFacetCentroidsBackfill","dispatchEvalAgent","adminEnqueueAgentFeedbackTriageBackfill","adminDebugRedactedTranscript","adminExportAgentChatsForUser","adminUnshareThread","adminGetChatGPTTokenSharingState","adminGetOpenAISafetyIdentifierLookup","adminSetProductFeedback","adminGetCustomAgentCreationPolicy","adminGetWorkspaceModelRestrictions","adminGetExternalAgentAccessPolicy","adminGetExternalAgentSpecifications","adminListCustomAgentTrustedHostnames","adminAddCustomAgentTrustedHostnames","adminRemoveCustomAgentTrustedHostnames","adminGetAIAgentDailyCreditUsageLookup","adminGetAICreditUsageLookup","adminGetAgentCreditLimit","adminSetAgentCreditLimit","adminGetEntitlementUsageLookup","adminGetCreditAdjustmentAuditLog","adminGetBillingContractLookup"]},promptTools:{title:"Prompt Tools",runbookUrl:void 0,tools:[],availableEnvironments:["local","development"]},billingAiTools:{title:"Billing - AI Tools",runbookUrl:void 0,tools:["adminRefundNotionCredits","adminBulkRefundNotionCredits","adminStartBulkCreditRefund","adminListBulkCreditRefundBatches","adminResetAiCreditUsage","adminBulkResetAiCreditUsage","adminManageTrialCreditTierOverrides"]},aiMeetingNotes:{title:"AI Meeting Notes",runbookUrl:void 0,tools:["adminUpdateTranscriptionForSpace","adminEnqueueTranscriptRetentionScheduler","adminRemarkTranscriptsAsDeletable","adminLensClusterFull","adminLensHistoricalFill","adminLensNuke","adminDebugTranscriptionBlock","adminGetGranolaImportTask","adminResetTranscriptionRateLimit"]},calendar:{title:"Notion Calendar",runbookUrl:void 0,tools:["adminUpdateNotionCalendarAvailableForSpace"]},mail:{title:"Notion Mail",runbookUrl:void 0,tools:["adminGetNotionMailStatus"]},marketplace:{title:"Marketplace",runbookUrl:void 0,tools:["adminBackfillMarketplaceProfileSalesforceId","adminBackfillTemplatesFromCategory","adminGetRevenueShareInfoForDomain","adminGetMarketplaceProfile","adminGetMarketplaceRecord","adminGetMarketplaceServiceRequestDetails","adminLookupMarketplaceServiceRequests","adminCompleteMarketplaceServiceRequest","adminEndMarketplaceServiceRequest","adminUpdateTemplateCreatorEmail","adminSetCreatorStripeOnboardingStatus","adminReviewMarketplaceRefund","adminCreateMarketplaceRefund","adminGetMarketplaceAcquisitionsForUser","adminReplayMarketplaceStripeCompletionEvent","adminIssueMarketplaceRefund","adminCreateOrUpdateMarketplaceCoupon","adminGetMarketplaceCoupon","adminCreateMarketplaceProfileInvitation","adminAcceptMarketplaceProfileInvitation","adminTransferMarketplaceProfileOwnership","adminChangeTemplateAuthor","adminCreateOrUpdateFlowdashTaskForTemplateDraft","adminResubmitMarketplaceAgentForReview","adminDeleteStripeConnectedAccount","adminDeleteMarketplaceListingForTemplateDraft","adminSyncContentfulIntegrationListingToPostgres","adminSetConsultantStatus","adminRemoveMarketplaceListingIdFromBlock","adminUpdateCreatorTemplateCount","adminRetryMarketplacePayout","adminTriggerUpgradeMarketplaceConsultantTiers","adminTriggerDowngradeMarketplaceConsultantTiers","adminCreateMarketplacePayouts","adminRejectTemplateDraft","adminAssignMarketplaceBadgeToUser","adminAssignMarketplaceBadgesToUsers"]},publicApi:{title:"Public API",runbookUrl:"https://dev.notion.so/notion/Admin-tools-for-File-Upload-Public-API-1deb35e6e67f80b9bd39f8a46c9cc952",tools:["adminCallPublicApi","adminGetExternalConnectionInfo","adminDeleteExternalConnection","adminResetMcpClientRegistration","adminGetFileUpload","adminExpireFileUpload","adminSearchMcpRegistry","adminSyncMcpRegistry","adminGetMcpRegistryEntry","adminUpdateMcpRegistryNotionPage","adminBanMcpServer","adminSetCustomMcpServersAllowed","adminGetSpaceMcpAllowlist"]},sites:{title:"Sites",runbookUrl:void 0,tools:["adminSetSpaceDomain","adminSetDefaultPublicDomain","adminGetPublicDomainStatus","adminMarkPublicDomainInvalid","adminUpdatePublicPageSlug"]},networkControl:{title:"Network Control",tools:["adminGetIPRestrictions","adminCreateIPRestrictions","adminUpdateIPRestriction","adminCheckIPRestriction","adminUpdateManagedUserNetworkControlSettings"],runbookUrl:"https://dev.notion.so/notion/Network-Controls-Runbook-21cb35e6e67f803c8797faf41a3d115d?source=copy_link"},enterpriseKeyManagement:{title:"Enterprise Key Management",runbookUrl:"https://dev.notion.so/notion/EKM-CMK-Rotation-22ab35e6e67f8056bdece8d16ded41dd?source=copy_link",tools:["adminListAllEKMWorkspaces","adminEKMStatusForWorksp
106ace","adminEKMDurableWorkflowStatus","adminEKMDynamoOnboarding","adminEKMDynamoOffboarding","adminEKMDynamoWEKRotation","adminEKMOffboarding","adminEKMOffboardingV2ByEKMIndex","adminEKMReencryptWEKs","adminEKMCreateWEK","adminEKMRevokeWEK","adminEKMReencryptPostgresData","adminEKMCreateWEKAndReencrypt","adminEKMOnboarding","adminEKMOnboardingViaScan","adminEKMBatchedRowCount","adminRequestCmkRotation","adminListCmkRotationRequests","adminEKMUpdateCmkRotationRequestStatus","adminS3ReencryptSecureFiles","adminS3OffboardSecureFiles"]},aiConnectors:{title:"AI Connectors",runbookUrl:void 0,tools:["adminFindThirdPartyConnection","adminCheckConnectorConnection","adminListAIConnectors","adminDisconnectAIConnector","adminValidateSlackExternalConnectionToken","adminAIConnectorS3Inspect","adminRemoveModuleFromWorkflow","adminSearchWorkflowModules","adminAddSlackConnectedOrgSpacesToStatsigSegment"]},infraAsCode:{title:"Notion as Code",runbookUrl:void 0,tools:["adminSerializeWorkspaceToIaC","adminMaterializeWorkspaceFromIaC"]},syncs:{title:"Syncs",runbookUrl:void 0,tools:["adminGetSyncs","adminGetSyncDetail","adminListUnhealthySyncs"]},workers:{title:"Workers",runbookUrl:void 0,tools:["adminGetWorkers","adminGetWorkerDetail","adminGetWorkerRunLogs","adminDisableWorker","adminEnableWorker","adminUpdateSyncCapability","adminGetWorkersRateLimitConfig","adminSetWorkersRateLimitConfig","adminResetWorkersRateLimitConfig","adminGetWorkersEmergencyBrake","adminGetWorkersGlobalEmergencyBrake","adminSetWorkersEmergencyBrake","adminSetWorkersGlobalEmergencyBrake"]},versionHistory:{title:"Version History",runbookUrl:void 0,tools:["adminListSnapshots","adminViewSnapshot","adminCreateSnapshot"]},versionHistory2:{title:"Version History 2",runbookUrl:void 0,tools:["adminQueryRecordSnapshots","adminQueryRecordSnapshotsAthena","adminQueryRecordSnapshotsDuckDbLambda"]},contentOnboarding:{title:"Content Onboarding",runbookUrl:void 0,tools:["adminCreateImporterCrossLinkingConfig","adminFetchAsanaData","adminFetchConfluenceData","adminFetchImportersS3File","adminFetchMondayData","adminGetImporterCrossLinkingConfig","adminListImporterCrossLinkingConfigs","adminListSpaceExports","adminUpdateImporterCrossLinkingConfig"]},collectionsInfra:{title:"Collections Infra",runbookUrl:void 0,tools:["adminEvictCollectionsCache","adminMaterializeCollectionsCache"]},monetizationTesting:{title:"Monetization Testing",runbookUrl:void 0,tools:["adminMonetizationTestingRunAction","adminMonetizationTestingGetSnapshot","adminMonetizationTestingCreateWorkspaceInState"],availableEnvironments:["local","development"]},toolProxy:{title:"Tool Proxy",runbookUrl:void 0,tools:[]}},n=(0,a(48697).objectKeys)(i),r={adminRestoreBlock:"adminDescribeDeletedBlockPermissions",adminRestoreDeletedGuestPermissions:"adminDescribeRestoreDeletedGuestPermissions",adminReviveBlocksOnPage:"adminDescribeBlocksOnPageToRevive",adminDeleteSpaces:"adminDescribeSpacesToDelete",adminResetAccounts:"adminDescribeAccountsToReset",adminBlockEmailDomain:"adminDescribeBlockEmailDomain",adminDeleteFileFromS3:"adminDescribeDeleteFileFromS3",adminEditSpacePermissions:"adminDescribeEditSpacePermission",adminDangerouslyQueueRemoveUserDirectPermissionsInSpace:"adminDescribeDangerouslyQueueRemoveUserDirectPermissionsInSpace",adminRunSpaceConsolidation:"adminDescribeRunSpaceConsolidation",adminTransferIntegrationOwnership:"adminDescribeTransferIntegrationOwnership",adminUpdateIntegrationRedirectUris:"adminDescribeUpdateIntegrationRedirectUris",adminRepairPermissionGroupManagementType:"adminDescribeRepairPermissionGroupManagementType",adminMigrateSlackConnection:"adminDescribeMigrateSlackConnection",adminDeleteStripeConnectedAccount:"adminDescribeDeleteStripeConnectedAccount",adminSetCustomMcpServersAllowed:"adminDescribeSetCustomMcpServersAllowed",adminDeleteWorkflows:"adminDescribeDeleteWorkflows",adminDeleteExternalConnection:"adminDescribeDeleteExternalConnection",adminRetryMarketplacePayout:"adminDescribeRetryMarketplacePayout",adminCompleteMarketplaceServiceRequest:"adminDescribeCompleteMarketplaceServiceRequest",adminEndMarketplaceServiceRequest:"adminDescribeEndMarketplaceServiceRequest",adminTransferMarketplaceProfileOwnership:"adminDescribeTransferMarketplaceProfileOwnership",adminTriggerUpgradeMarketplaceConsultantTiers:"adminDescribeTriggerUpgradeMarketplaceConsultantTiers",adminTriggerDowngradeMarketplaceConsultantTiers:"adminDescribeTriggerDowngradeMarketplaceConsultantTiers",adminRevokeBotToken:"adminDescribeRevokeBotToken",adminBulkDeactivateApiBots:"adminDescribeBulkDeactivateApiBots",adminBulkSetDisableSpacePublicAccess:"adminDescribeBulkSetDisableSpacePublicAccess",adminDisconnectAIConnector:"adminDescribeDisconnectAIConnector",adminDeleteOrganization:"adminDescribeDeleteOrganization",adminMigrateOrganization:"adminDescribeMigrateOrganization",adminDeleteGlobalOauthClient:"adminDescribeDeleteGlobalOauthClient"};Object.values(r),a.d(t,{},{Jv:r,US:"adminViewToolProxySection",i8:i,wJ:n})},50873(e,t,a){let i=a(764657).object({required:{excludeChatFromMemories:a(764657).boolean(),useMemories:a(764657).boolean()},optional:{}});a.d(t,{},{W:i})},889834(e,t,a){function i(e){return a(784859).UO[e]??e}function n(e){let{model:t,restrictedModels:a}=e;if(void 0===a||0===a.length)return!1;let n=i(t);return a.some(e=>i(e)===n)}function r(e){let t=new Set(e??[]);if(0===t.size)return t;let n=new Set(Array.from(t,i));for(let e of a(784859).di)n.has(i(e.notionName))&&t.add(e.notionName);return t}a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(765324),a.d(t,{Nr:()=>i,tN:()=>r,u7:()=>n})},843209(e,t,a){a(533958);let i={openai:"OpenAI",anthropic:"Anthropic"};function n(e){return i[e]}a.d(t,{Ju:()=>n},{TK:["openai","anthropic"]})},894186(e,t,a){a.d(t,{wF:()=>n,S0:()=>o,tv:()=>s}),a(435368);let i={onico:"GPT-6 Sol",omodi:"GPT-6 Luna","gpt-5.6-sol":"GPT-5.6 Sol","gpt-5.6-sol-security-research":"GPT 5.6 Cyber","gpt-daybreak-red":"GPT Daybreak Red","omniberry-sundae":"GPT-6.1 Sol","gpt-6-astra":"GPT-6 Astra","gpt-5.6-terra":"GPT-5.6 Terra","gpt-5.6-luna":"GPT-5.6 Luna","gpt-5.5":"GPT-5.5","gpt-5.4":"GPT-5.4","gpt-5.4-mini":"GPT-5.4 Mini","gpt-5.4-nano":"GPT-5.4 Nano","gpt-5.2":"GPT-5.2","claude-haiku-4-5-20251001":"Claude Haiku 4.5","claude-sonnet-4-6":"Claude Sonnet 4.6","claude-opus-4-5-20251101":"Claude Opus 4.5","claude-opus-4-6":"Claude Opus 4.6","claude-opus-4-7":"Claude Opus 4.7","claude-sonnet-5":"Claude Sonnet 5","achira-donut":"Claude Sonnet 5.5","claude-opus-4-8":"Claude Opus 4.8","claude-opus-5":"Claude Opus 5","claude-opus-5-5":"Claude Opus 5.5","amla-jam":"Claude Haiku 5.5","claude-fable-5":"Claude Fable 5","claude-fable-5-1":"Claude Fable 5.1","fireworks/kimi-k2p6":"Kimi K2.6","fireworks/kimi-k2p7-code":"Kimi K2.7 Code","fireworks/kimi-k3":"Kimi K3","fireworks/minimax-m2p7":"MiniMax M2.7","gemini-3-flash-preview":"Gemini 3 Flash Preview","gemini-3.1-pro-preview":"Gemini 3.1 Pro Preview","gemini-3.5-flash":"Gemini 3.5 Flash","gemini-3.6-flash":"Gemini 3.6 Flash","gemini-3.7-flash":"Gemini 3.7 Flash","gemini-3.8-flash":"Gemini 3.8 Flash","gooseberry-souffle":"Gooseberry Souffle","baseten-deepseek-v4-pro":"DeepSeek V4 Pro","baseten-deepseek-v4-flash":"DeepSeek V4 Flash","baseten-deepseek-v4.1-flash":"DeepSeek V4.1 Flash","baseten-glm-5.2":"GLM 5.2","baseten-glm-5.3":"GLM 5.3","baseten-glm-5.3-flash":"GLM 5.3 Flash","grok-4.3":"Grok 4.3","grok-build-0.1":"Grok Build 0.1","grok-4.5":"Grok 4.5","grok-4.6":"Grok 4.6","grok-4.7":"Grok 4.7","muse-spark-1.2":"Muse Spark 1.2","claude-sonnet-4-5-20250929":"Claude Sonnet 4.5"},n=(0,a(327219).YK)({autoModelOptionLabel:{id:"agentServiceThread.threadView.autoModelOptionLabel",defaultMessage:"Auto"}}
106),r=(0,a(327219).YK)({unknownModel:{id:"modelDisplayMessages.unknownModel",defaultMessage:"Unknown model"}});function s(e,t){return o(e)??(null==t?void 0:t.formatMessage(r.unknownModel))??"Unknown model"}function o(e){for(let t of a(784859).di)if(t.notionName===e)return"displayName"in t?t.displayName:e;return i[e]}},475027(e,t,a){a.d(t,{vB:()=>i().vB,Aw:()=>i().Aw});var i=()=>a(967126)},350730(e,t,a){function i(...e){return a(764657).object({required:{table:a(764657).literals(...e),id:a(764657).string(),spaceId:a(764657).string()},optional:{}})}function n(...e){return i(...e)}function r(...e){return function(...e){return a(764657).object({required:{table:a(764657).literals(...e),id:a(764657).string()},optional:{spaceId:a(764657).string()}})}(...e)}function s(...e){return i(...e)}a.d(t,{uV:()=>s,VR:()=>r,IK:()=>n})},607372(e,t,a){a(533958),a(499468),a(586042),a(169187),a(726090),a(132457),a(219390),a(73168),a(730330),a(139583),a(765324);let i=new Set(["sites_custom_hostnames_add_on_monthly_usd_4","sites_custom_hostnames_add_on_yearly_usd_36"]),n=["ai_credit_pack_100_annual_usd_revised","ai_credit_pack_100_annual_eur_revised","ai_credit_pack_100_annual_gbp_revised","ai_credit_pack_100_annual_jpy_revised","ai_credit_pack_100_annual_krw_revised"],r=["ai_add_on_standard_sales_assisted","ai_add_on_standard_sales_assisted_eur","ai_add_on_standard_sales_assisted_gbp","ai_add_on_standard_sales_assisted_jpy","ai_add_on_standard_sales_assisted_krw","ai_add_on_employee_discount_monthly","ai_add_on_employee_discount_yearly","ai_add_on_marketing_discount_monthly","ai_add_on_marketing_discount_yearly","sites_custom_hostnames_add_on_sales_assisted_gbp","sites_custom_hostnames_add_on_sales_assisted_usd","sites_custom_hostnames_add_on_sales_assisted_eur","sites_custom_hostnames_add_on_sales_assisted_jpy","sites_custom_hostnames_add_on_sales_assisted_krw","ai_add_on_standard_trial_monthly_usd","ai_add_on_standard_trial_yearly_usd","ai_add_on_standard_trial_monthly_eur","ai_add_on_standard_trial_yearly_eur","ai_add_on_standard_trial_monthly_gbp","ai_add_on_standard_trial_yearly_gbp","ai_add_on_standard_trial_monthly_jpy","ai_add_on_standard_trial_yearly_jpy","ai_add_on_standard_trial_monthly_krw","ai_add_on_standard_trial_yearly_krw","free_ai_credit_pack_100_monthly","ai_add_on_standard_monthly_10","ai_add_on_standard_monthly_eur","ai_add_on_standard_monthly_gbp","ai_add_on_standard_monthly_jpy","ai_add_on_standard_monthly_krw","ai_add_on_standard_yearly_96","ai_add_on_standard_yearly_eur","ai_add_on_standard_yearly_gbp","ai_add_on_standard_yearly_jpy","ai_add_on_standard_yearly_krw","sites_custom_hostnames_add_on_monthly_usd","sites_custom_hostnames_add_on_yearly_usd","sites_custom_hostnames_add_on_monthly_usd_4","sites_custom_hostnames_add_on_yearly_usd_36","sites_custom_hostnames_add_on_monthly_eur","sites_custom_hostnames_add_on_yearly_eur","sites_custom_hostnames_add_on_monthly_gbp","sites_custom_hostnames_add_on_yearly_gbp","sites_custom_hostnames_add_on_monthly_jpy","sites_custom_hostnames_add_on_yearly_jpy","sites_custom_hostnames_add_on_monthly_krw","sites_custom_hostnames_add_on_yearly_krw","ai_credit_pack_100_monthly_usd_revised","ai_credit_pack_100_monthly_eur","ai_credit_pack_100_monthly_gbp","ai_credit_pack_100_monthly_jpy","ai_credit_pack_100_monthly_krw","ai_credit_pack_100_annual_usd","ai_credit_pack_100_annual_eur","ai_credit_pack_100_annual_gbp","ai_credit_pack_100_annual_jpy","ai_credit_pack_100_annual_krw",...n];function s(e){return(0,a(48697).Xk)(n,e)}function o(e){return 402===e}a.d(t,{Nf:()=>o,tB:()=>s},{Mc:["ai_add_on_employee_discount_monthly","ai_add_on_employee_discount_yearly"],NM:i,dx:r})},540342(e,t,a){function i(e){return e?"https://app.metronome.com":"https://app.metronome.com/sandbox"}function n(e){let{query:t,livemode:a}=e;return`${i(a)}/customers?s=${encodeURIComponent(t)}`}function r(e){let{customerId:t,livemode:a}=e;return`${i(a)}/customers/${t}`}function s(e){let{customerId:t,contractId:a,livemode:i}=e;return`${r({customerId:t,livemode:i})}/contracts/${a}`}function o(e){let{customerId:t,invoiceId:a,livemode:i}=e;return`${r({customerId:t,livemode:i})}/invoices/${a}`}function l(e){let{customerId:t,contractId:a,invoiceId:i,livemode:n}=e;return`${s({customerId:t,contractId:a,livemode:n})}/invoices/${i}`}a.d(t,{L8:()=>l,Yi:()=>r,aj:()=>n,gl:()=>s,zL:()=>o})},87549(e,t,a){a.d(t,{},{Kn:["Illegal activities","Graphic and harmful content","Child exploitation","Harassment, bullying, defamation, and threats","Hateful content","Intellectual property","Malicious and deceptive practices","Personal and confidential information","Interference with the Services","Content subject to additional scrutiny","Billing fraud","Sanctions regulations","Card testing","Account Lockout","AI Abuse","Other"],_N:["todos","projectsTasks","habitWellness","budgetPersonalFinance","travel","hobbies","careerBuilding","foodNutrition","websiteBuildingForLife","entertainment"],gb:["planner","notes","research","clubs","teachingLessonPlans","teachingClassroomManagement","websiteBuildingForSchool","internshipApplications","groupProjects"],mQ:["Violent or obscene content","Sexually explicit","Promotes self-harm","Promotes terrorist activity","Misinformation","Get rich quick","Gambling services or products","Price-gauging","Online or day trading","Multi-level marketing or affiliate marketing","Credit abuse","Payments fraud","Specially Designated National (SDN) screening","User must contact support to manually verify account ownership","Reselling","Usage abuse"]})},112844(e,t,a){a(730330),a(976614),a(139583),a(765324),a(176765),a(851344),a(866491);let i=/^(?!\.{1,2}$)[^\\/*?#\s](?:[^\\/*?#]*[^\\/*?#\s])?$/;function n(e){return"channel"===e.kind?`channel:${e.teamId}:${e.channelId}`:`chat:${e.chatId}`}function r(e,t){let a=n(t);return(null==e?void 0:e.some(e=>e.identifier===a&&e.actions.includes("read")))??!1}function s(e){if(e.startsWith("channel:")){let[t,...a]=e.slice(8).split(":"),i=a.join(":");if(!d(t)||!d(i))return;return{kind:"channel",teamId:t,channelId:i}}if(e.startsWith("chat:")){let t=e.slice(5);if(!d(t))return;return{kind:"chat",chatId:t}}}function o(e){var t;let a;try{a=new URL(e)}catch(e){if(l(e,"TypeError"))return;throw e}if(!("teams.microsoft.com"===(t=a.hostname)||t.endsWith(".teams.microsoft.com")||"teams.cloud.microsoft"===t))return;
106let[i,n,r]=a.pathname.split("/").filter(Boolean).slice(1);if(!n)return;let s=function(e){try{return decodeURIComponent(e)}catch(e){if(l(e,"URIError"))return;throw e}}(n);if(s){if("channel"===i){let e=a.searchParams.get("groupId");if(!e||!d(e)||!d(s))return;return{kind:"channel",teamId:e,channelId:s}}if("chat"===i&&"0"!==s&&d(s))return{kind:"chat",chatId:s};if("message"===i&&r){if('{"contextType":"chat"}'===a.searchParams.get("context")&&d(s))return{kind:"chat",chatId:s};let e=a.searchParams.get("groupId");if(e&&d(e)&&d(s))return{kind:"channel",teamId:e,channelId:s}}}}function l(e,t){return"object"==typeof e&&null!==e&&"name"in e&&e.name===t}function d(e){return i.test(e)}let c={type:"microsoftTeamsOauth",connectionIntegrationTypes:["microsoftTeams"],isSingleton:!0,config:{},authentication:{type:"oauth2"},hideReconnect:!1,latestVersion:"1.0.0",triggers:{"microsoftTeamsOauth.message":{isTriggerConfigured:a(188571).G,triggerDuplicator:({original:e})=>({type:e.type}),versionAvailability:"*",createDefaultState:()=>({type:"microsoftTeamsOauth.message"})}},effects:{"microsoftTeamsOauth.searchMessages":{versionAvailability:"*"},"microsoftTeamsOauth.sendChannelMessage":{versionAvailability:"*"},"microsoftTeamsOauth.replyToChannelMessage":{versionAvailability:"*"},"microsoftTeamsOauth.sendChatMessage":{versionAvailability:"*"},"microsoftTeamsOauth.listChannelMessages":{versionAvailability:"*"},"microsoftTeamsOauth.listChatMessages":{versionAvailability:"*"},"microsoftTeamsOauth.getChannelMessage":{versionAvailability:"*"},"microsoftTeamsOauth.getChatMessage":{versionAvailability:"*"},"microsoftTeamsOauth.listTeams":{versionAvailability:"*"},"microsoftTeamsOauth.listChannels":{versionAvailability:"*"},"microsoftTeamsOauth.listChats":{versionAvailability:"*"},"microsoftTeamsOauth.getChannel":{versionAvailability:"*"},"microsoftTeamsOauth.listChannelMembers":{versionAvailability:"*"},"microsoftTeamsOauth.getChat":{versionAvailability:"*"}},isAvailable:e=>{let{configStep:t,isCustomAgentContext:i}=e;return(!!i||!!t.isCustomAgent)&&(0,a(16712).UD)(e,"agent_microsoft_teams_oauth")},stateDuplicator:()=>void 0,getDescription:e=>e.formatMessage({id:"workflow.module.microsoftTeamsOauth.description",defaultMessage:"Read and send messages in Microsoft Teams."}),getName:e=>e.formatMessage({id:"workflow.module.microsoftTeamsOauth.title",defaultMessage:"Microsoft Teams"}),getModuleConfigSection:()=>"connections",getIcon:()=>a(394615).microsoftTeamsIcon};a.d(t,{Gf:()=>r,P8:()=>o,PF:()=>s,oZ:()=>n},{Me:/^(?:channel:[^:\\/*?#\s](?:[^:\\/*?#]*[^:\\/*?#\s])?:[^\\/*?#\s](?:[^\\/*?#]*[^\\/*?#\s])?|chat:[^\\/*?#\s](?:[^\\/*?#]*[^\\/*?#\s])?)$/,Px:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,7})?(?:Z|[+-]\d{2}:\d{2})$/,iJ:c,r1:i})},761956(e,t,a){let i="(?!\\.+(?:/|$))[A-Za-z0-9,.!_-]+";RegExp(`^${i}$`);let n=RegExp(`^(?:\\*|site:${i}|drive:${i}|folder:${i}/${i}|file:${i}/${i})$`);a.d(t,{},{GX:n,n3:{type:"sharepointOauth",connectionIntegrationTypes:["sharepoint"],isSingleton:!0,config:{},authentication:{type:"oauth2"},hideReconnect:!1,latestVersion:"1.0.0",triggers:{},effects:{"sharepointOauth.searchFiles":{versionAvailability:"*"},"sharepointOauth.readFile":{versionAvailability:"*"},"sharepointOauth.listFiles":{versionAvailability:"*"},"sharepointOauth.resolveUrl":{versionAvailability:"*"}},isAvailable:e=>{let{configStep:t,isCustomAgentContext:i}=e;return(!!i||!!t.isCustomAgent)&&(0,a(16712).UD)(e,"agent_sharepoint_oauth")},stateDuplicator:()=>void 0,getDescription:e=>e.formatMessage({id:"workflow.module.sharepointOauth.description",defaultMessage:"Search and read SharePoint files."}),getName:e=>e.formatMessage({id:"workflow.module.sharepointOauth.title",defaultMessage:"SharePoint"}),getModuleConfigSection:()=>"connections",getIcon:()=>a(72168).microsoftSharePointIcon}})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.