import{j as e}from"./vendor-react-Dp9pL_Wn.js";import{C as t}from"./c627fcdb6-1_bsVTpt.js";import{c as r,M as o,j as s,I as n,T as a}from"./vendor-ant-cds-BLsR_p72.js";import{M as i,u as l}from"./vendor-intl-D2wGIp4M.js";import{l as c,a6 as d,_ as u,aF as g}from"./c2ee0272b-DPDuX889.js";import{u as p}from"./vendor-query-CRl6sF7K.js";function m({value:l,onChange:c,roles:d,disabled:u=!1,removeOption:g,triggerClassName:p,align:m="end",triggerAriaLabel:b,popupClassName:f,triggerVariant:x="compact"}){const k=d.find(e=>e.value===l),h="row"===x?"flex items-center gap-2 rounded px-3 py-2 text-body text-primary transition-colors hover:bg-alpha-1 data-[popup-open]:bg-alpha-1":"flex h-7 items-center gap-1 rounded-md px-2 text-xs text-text-300 transition-colors hover:bg-bg-200 hover:text-text-100 data-[popup-open]:bg-bg-200 data-[popup-open]:text-text-100",v=e.jsx("span",{className:"truncate",children:k?.label??e.jsx(i,{id:"kQAf2d9u+x",defaultMessage:"Select"})});if(u)return e.jsx("span",{className:r("row"===x?"flex items-center gap-2 rounded px-3 py-2 text-body text-disabled":"flex h-7 items-center gap-1 rounded-md px-2 text-xs text-text-400",p),children:v});const y=g&&e.jsx(o.Item,{variant:"danger",disabled:g.disabled,onClick:g.onSelect,children:g.label??e.jsx(i,{id:"G/yZLul6P1",defaultMessage:"Remove"})});return e.jsxs(o.Root,{children:[e.jsx(o.Trigger,{render:e.jsxs("button",{type:"button","aria-label":b,className:r(h,p),children:[v,e.jsx(t,{className:"row"===x?"size-4 text-muted":"size-3.5"})]})}),e.jsx(s,{className:"contents",children:e.jsxs(o.Popup,{align:m,className:r("min-w-56",f),children:[e.jsx(o.Group,{children:d.filter(e=>!e.hidden).map(t=>{const r=e.jsxs("span",{className:"flex min-w-0 flex-col whitespace-normal",children:[e.jsx("span",{children:t.label}),t.description&&e.jsx("span",{className:"text-footnote text-muted",children:t.description})]});return t.locked?e.jsx(o.Item,{disabled:!0,trailing:e.jsx("span",{className:"-mr-1 flex size-4 shrink-0 items-center justify-center",children:e.jsx(n,{name:"Lock",size:"sm"})}),className:"!items-start",children:r},t.value):e.jsx(o.Item,{checked:t.value===l,checkedRole:"radio",onClick:()=>c(t.value),className:"!items-start",children:r},t.value)})}),g&&e.jsxs(e.Fragment,{children:[e.jsx(o.Separator,{}),g.disabled&&g.disabledTooltip?e.jsx(a,{content:g.disabledTooltip,side:"left",children:e.jsx("span",{className:"block",children:y})}):y]})]})})]})}const b="ccr-webhook-triggers";function f(e){return{"anthropic-version":"2023-06-01","anthropic-beta":"ccr-triggers-2026-01-30",...e?{"x-organization-uuid":e}:{}}}function x(e){const{activeOrganization:t}=c(),r=t?.uuid;return d("/v1/code/webhook-triggers",{queryKey:[b,{orgUuid:r}],enabled:Boolean(r)&&(e?.enabled??!0),staleTime:1e4,headers:f(r),meta:{noToast:!0}})}function k(e,t){const{activeOrganization:r}=c(),o=r?.uuid;return d(`/v1/code/webhook-triggers?routine_trigger_id=${encodeURIComponent(e??"")}`,{queryKey:[b,{orgUuid:o,routineTriggerId:e}],enabled:Boolean(o)&&Boolean(e)&&(t?.enabled??!0),staleTime:1e4,headers:f(o),meta:{noToast:!0}})}function h(e){const{activeOrganization:t}=c(),r=t?.uuid;return d("/v1/code/plugins",{queryKey:["ccr-webhook-plugins",{orgUuid:r}],enabled:Boolean(r)&&(e?.enabled??!0),staleTime:6e4,headers:f(r),meta:{noToast:!0}})}function v(e){const{activeOrganization:t}=c(),r=t?.uuid,o=p(),{addError:s}=u(),n=l(),a=void 0===e?.errorToast?n.formatMessage({defaultMessage:"Failed to enable security review. You can try again.",id:"cJ7iFOGFAD"}):e.errorToast;return g("/v1/code/webhook-triggers","POST",{onSuccess:e=>{if(!e.trigger)return;const t=e.trigger;o.setQueryData([b,{orgUuid:r}],e=>e?{...e,data:[...e.data??[],t]}:{data:[t]});const s=t.routine_trigger_id;s&&o.setQueryData([b,{orgUuid:r,routineTriggerId:s}],e=>e?{...e,data:[...e.data??[],t]}:{data:[t]})},onError:e=>{null!==a&&s(a,{error:e,errorContext:{tags:{source:"ccr_webhook_trigger_create"}},messageForLogging:"Failed to create CCR webhook trigger"})},meta:{noToast:!0},headers:f(r)})}function y(e){const{activeOrganization:t}=c(),r=t?.uuid,o=p(),{addError:s}=u(),n=l(),a=void 0===e?.errorToast?n.formatMessage({defaultMessage:"Failed to remove GitHub trigger. You can try again.",id:"JgJ5T3QTfz"}):e.errorToast;return g(e=>`/v1/code/webhook-triggers/${e.triggerId}`,"DELETE",{transformVariables:()=>({}),onSuccess:(e,t)=>{o.setQueryData([b,{orgUuid:r}],e=>e?{...e,data:(e.data??[]).filter(e=>e.trigger_id!==t.triggerId)}:void 0),o.invalidateQueries({queryKey:[b],exact:!1})},onError:e=>{null!==a&&s(a,{error:e,errorContext:{tags:{source:"ccr_webhook_trigger_delete"}},messageForLogging:"Failed to delete CCR webhook trigger"})},meta:{noToast:!0},headers:f(r)})}
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/const w=Object.freeze(Object.defineProperty({__proto__:null,conf:{comments:{lineComment:"#"},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"'",close:"'",notIn:["string"]},{open:'"',close:'"',notIn:["string"]},{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"}]},language:{defaultToken:"",tokenPostfix:".rq",brackets:[{token:"delimiter.curly",open:"{",close:"}"},{token:"delimiter.parenthesis",open:"(",close:")"},{token:"delimiter.square",open:"[",close:"]"},{token:"delimiter.angle",open:"<",close:">"}],keywords:["add","as","asc","ask","base","by","clear","construct","copy","create","data","delete","desc","describe","distinct","drop","false","filter","from","graph","group","having","in","insert","limit","load","minus","move","named","not","offset","optional","order","prefix","reduced","select","service","silent","to","true","undef","union","using","values","where","with"],builtinFunctions:["a","abs","avg","bind","bnode","bound","ceil","coalesce","concat","contains","count","datatype","day","encode_for_uri","exists","floor","group_concat","hours","if","iri","isblank","isiri","isliteral","isnumeric","isuri","lang","langmatches","lcase","max","md5","min","minutes","month","now","rand","regex","replace","round","sameterm","sample","seconds","sha1","sha256","sha384","sha512","str","strafter","strbefore","strdt","strends","strlang","strlen","strstarts","struuid","substr","sum","timezone","tz","ucase","uri","uuid","year"],ignoreCase:!0,tokenizer:{root:[[/<[^\s\u00a0>]*>?/,"tag"],{include:"@strings"},[/#.*/,"comment"],[/[{}()\[\]]/,"@brackets"],[/[;,.]/,"delimiter"],[/[_\w\d]+:(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])*/,"tag"],[/:(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/,"tag"],[/[$?]?[_\w\d]+/,{cases:{"@keywords":{token:"keyword"},"@builtinFunctions":{token:"predefined.sql"},"@default":"identifier"}}],[/\^\^/,"operator.sql"],[/\^[*+\-<>=&|^\/!?]*/,"operator.sql"],[/[*+\-<>=&|\/!?]/,"operator.sql"],[/@[a-z\d\-]*/,"metatag.html"],[/\s+/,"white"]],strings:[[/'([^'\\]|\\.)*$/,"string.invalid"],[/'$/,"string.sql","@pop"],[/'/,"string.sql","@stringBody"],[/"([^"\\]|\\.)*$/,"string.invalid"],[/"$/,"string.sql","@pop"],[/"/,"string.sql","@dblStringBody"]],stringBody:[[/[^\\']+/,"string.sql"],[/\\./,"string.escape"],[/'/,"string.sql","@pop"]],dblStringBody:[[/[^\\"]+/,"string.sql"],[/\\./,"string.escape"],[/"/,"string.sql","@pop"]]}}},Symbol.toStringTag,{value:"Module"}));
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/const _=Object.freeze(Object.defineProperty({__proto__:null,conf:{brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}]},language:{tokenPostfix:".tcl",specialFunctions:["set","unset","rename","variable","proc","coroutine","foreach","incr","append","lappend","linsert","lreplace"],mainFunctions:["if","then","elseif","else","case","switch","while","for","break","continue","return","package","namespace","catch","exit","eval","expr","uplevel","upvar"],builtinFunctions:["file","info","concat","join","lindex","list","llength","lrange","lsearch","lsort","split","array","parray","binary","format","regexp","regsub","scan","string","subst","dict","cd","clock","exec","glob","pid","pwd","close","eof","fblocked","fconfigure","fcopy","fileevent","flush","gets","open","puts","read","seek","socket","tell","interp","after","auto_execok","auto_load","auto_mkindex","auto_reset","bgerror","error","global","history","load","source","time","trace","unknown","unset","update","vwait","winfo","wm","bind","event","pack","place","grid","font","bell","clipboard","destroy","focus","grab","lower","option","raise","selection","send","tk","tkwait","tk_bisque","tk_focusNext","tk_focusPrev","tk_focusFollowsMouse","tk_popup","tk_setPalette"],symbols:/[=><!~?:&|+\-*\/\^%]+/,brackets:[{open:"(",close:")",token:"delimiter.parenthesis"},{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"}],escapes:/\\(?:[abfnrtv\\"'\[\]\{\};\$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,variables:/(?:\$+(?:(?:\:\:?)?[a-zA-Z_]\w*)+)/,tokenizer:{root:[[/[a-zA-Z_]\w*/,{cases:{"@specialFunctions":{token:"keyword.flow",next:"@specialFunc"},"@mainFunctions":"keyword","@builtinFunctions":"variable","@default":"operator.scss"}}],[/\s+\-+(?!\d|\.)\w*|{\*}/,"metatag"],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/@symbols/,"operator"],[/\$+(?:\:\:)?\{/,{token:"identifier",next:"@nestedVariable"}],[/@variables/,"type.identifier"],[/\.(?!\d|\.)[\w\-]*/,"operator.sql"],[/\d+(\.\d+)?/,"number"],[/\d+/,"number"],[/;/,"delimiter"],[/"/,{token:"string.quote",bracket:"@open",next:"@dstring"}],[/'/,{token:"string.quote",bracket:"@open",next:"@sstring"}]],dstring:[[/\[/,{token:"@brackets",next:"@nestedCall"}],[/\$+(?:\:\:)?\{/,{token:"identifier",next:"@nestedVariable"}],[/@variables/,"type.identifier"],[/[^\\$\[\]"]+/,"string"],[/@escapes/,"string.escape"],[/"/,{token:"string.quote",bracket:"@close",next:"@pop"}]],sstring:[[/\[/,{token:"@brackets",next:"@nestedCall"}],[/\$+(?:\:\:)?\{/,{token:"identifier",next:"@nestedVariable"}],[/@variables/,"type.identifier"],[/[^\\$\[\]']+/,"string"],[/@escapes/,"string.escape"],[/'/,{token:"string.quote",bracket:"@close",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,"white"],[/#.*\\$/,{token:"comment",next:"@newlineComment"}],[/#.*(?!\\)$/,"comment"]],newlineComment:[[/.*\\$/,"comment"],[/.*(?!\\)$/,{token:"comment",next:"@pop"}]],nestedVariable:[[/[^\{\}\$]+/,"type.identifier"],[/\}/,{token:"identifier",next:"@pop"}]],nestedCall:[[/\[/,{token:"@brackets",next:"@nestedCall"}],[/\]/,{token:"@brackets",next:"@pop"}],{include:"root"}],specialFunc:[[/"/,{token:"string",next:"@dstring"}],[/'/,{token:"string",next:"@sstring"}],[/\S+/,{token:"type",next:"@pop"}]]}}},Symbol.toStringTag,{value:"Module"}));export{m as R,x as a,h as b,y as c,v as d,w as s,_ as t,k as u};
