import{j as e,r as t}from"./vendor-react-Dp9pL_Wn.js";import{aR as a,h as n,aw as i,df as r,WX as s,tO as o,tN as d,u7 as c,a04 as u,c6 as l,cT as m,cU as p,Z as f,bR as g}from"./c6eedc03a-CsEFTfjy.js";import{c as b}from"./vendor-ant-cds-bBedrtIN.js";import{u as x}from"./vendor-query-BwvgHhJ1.js";import{dz as y}from"./index-CBEPphRm.js";import{M as v}from"./vendor-intl-D2wGIp4M.js";function _({checked:t}){return e.jsxs("div",{className:"relative h-4 w-4",children:[e.jsx("div",{className:b("bg-bg-500 absolute left-0 top-0 h-4 w-4 rounded-full border",t?"border-text-100":"border-border-100")}),t&&e.jsx("div",{className:"bg-text-100 absolute left-1 top-1 h-2 w-2 rounded-full"})]})}function w({checked:t}){return e.jsx("div",{className:"inline-flex h-5 w-5 items-center justify-center gap-2.5",children:t?e.jsx("div",{className:"bg-text-100 text-bg-100 inline-flex h-4 w-4 items-center justify-center rounded-[4px] text-lg",children:e.jsx(a,{size:12})}):e.jsx("div",{className:"bg-bg-300 border-border-200 h-4 w-4 rounded-[4px] border"})})}function h({onError:e,organizationUuid:a}){const{activeOrganization:r}=n(),s=a??r?.uuid,{data:o,variables:d,...c}=i(`/api/billing/${s}/ss_enterprise_pricing`,"POST",{enabled:!!s,meta:{noToast:!0},onError:e}),[u,l]=t.useState(),[m,p]=t.useState();return t.useEffect(()=>{o&&(l(o),p(d))},[o,d]),{data:u,variables:m,...c}}const k=e=>{const{activeOrganization:t}=n();return i(`/api/organizations/${t?.uuid}/subscription/ss-enterprise`,"PUT",{enabled:!!t,...e?.noToast?{meta:{noToast:e.noToast}}:{}})};function j({enabled:e=!0}={}){const{activeOrganization:t}=n(),a=t?.uuid,i=m(p.BillingManage);return f(`/api/organizations/${a}/team/upgrade_to_ss_enterprise_eligibility`,{queryKey:["upgrade_to_ss_enterprise_eligibility",a],enabled:e&&!!a&&i,meta:{noToast:!0}})}function T(e={}){const{activeOrganization:t}=n(),a=x(),m=e.organizationUuid??t?.uuid;return i(`/api/organizations/${m}/team/upgrade_to_ss_enterprise`,"PUT",{...e,async onSuccess(t,n,i){!t.idvRequirement||y(t.idvRequirement.status)?(a.setQueriesData({queryKey:[r,m]},e=>{if(e)return{...e,status:"active"}}),a.invalidateQueries({queryKey:[s,m]}),a.invalidateQueries({queryKey:[o,m]}),a.invalidateQueries({queryKey:[d,m]}),a.invalidateQueries({queryKey:[c,m]}),await a.invalidateQueries({queryKey:[u,m]}),await a.invalidateQueries({queryKey:[l]}),await(e.onSuccess?.(t,n,i))):await(e.onSuccess?.(t,n,i))},enabled:!!m})}function z({fromDate:t,toDate:a,onFromDateChange:n,onToDateChange:i,minDate:r,maxDate:s,noTopMargin:o}){return e.jsxs("div",{className:"flex gap-4 "+(o?"":"mt-[22px]"),children:[e.jsx(C,{id:"modal-from-date",label:e.jsx(v,{defaultMessage:"From",id:"dM+p3/YEXT"}),value:t,onChange:n,min:r?.toLocaleDateString("en-CA"),max:a}),e.jsx(C,{id:"modal-to-date",label:e.jsx(v,{defaultMessage:"To",id:"9j3hXO4Ojb"}),value:a,onChange:i,min:t,max:s?.toLocaleDateString("en-CA")})]})}function C({id:t,label:a,value:n,onChange:i,min:r,max:s}){return e.jsxs("div",{className:"flex flex-col gap-1.5 flex-1",children:[e.jsx("label",{htmlFor:t,className:"text-xs text-text-400",children:a}),e.jsx("div",{className:"flex items-center bg-bg-000 border border-border-300 rounded-lg px-3 py-2",children:e.jsx("input",{id:t,type:"date",value:n,onChange:e=>i?.(e.target.value),min:r,max:s,className:"flex-1 bg-transparent border-none outline-none text-text-100 text-sm [&::-webkit-calendar-picker-indicator]:cursor-pointer [&::-webkit-calendar-picker-indicator]:opacity-50 [&::-webkit-calendar-picker-indicator]:hover:opacity-100"})})]})}const q="pr-steward-org-settings",O=1e4,N=200,M=/[\p{Cc}\p{Zl}\p{Zp}\p{Bidi_Control}]/u;function S(e,t){return t?.run_on_drafts?"on_with_drafts":"on"}function K(e){return{"anthropic-version":"2023-06-01",...e?{"x-organization-uuid":e}:{}}}function D(e){return e instanceof g&&(501===e.statusCode||404===e.statusCode)}function E(e){return e.trim().toLowerCase()}const Q=/^[A-Za-z0-9](?:-?[A-Za-z0-9]){0,38}(?:_[A-Za-z0-9](?:-?[A-Za-z0-9]){0,38})?$/,P=79;function $(e){return e.trim().toLowerCase()}function A(e,t){const a=[],n=new Set;for(const i of[...e,...t]){const e=E(i);e&&!n.has(e)&&(n.add(e),a.push(e))}return a}function R(e){const{activeOrganization:t}=n(),a=t?.uuid;return f("/v1/code/pr-steward/org-settings",{queryKey:[q,a],headers:K(a),enabled:e&&!!a,staleTime:3e5,meta:{noToast:!0}})}function Z(){const{activeOrganization:e}=n(),t=e?.uuid,a=x();return i("/v1/code/pr-steward/org-settings","PUT",{headers:K(t),meta:{noToast:!0},onSuccess:async(e,n)=>{await a.cancelQueries({queryKey:[q,t]}),a.setQueryData([q,t],t=>({...e,settings:e.settings??n.settings,cost_summary:e.cost_summary??t?.cost_summary}))}})}function L(){const{activeOrganization:e}=n(),t=e?.uuid,a=x();return i("/v1/code/pr-steward/org-settings/repo","POST",{headers:K(t),meta:{noToast:!0},onSuccess:async e=>{await a.cancelQueries({queryKey:[q,t]}),a.setQueryData([q,t],t=>({...e,cost_summary:e.cost_summary??t?.cost_summary}))}})}
/*!-----------------------------------------------------------------------------
 * 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
 *-----------------------------------------------------------------------------*/var U={comments:{lineComment:"COMMENT"},brackets:[["(",")"]],autoClosingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:":",close:"."}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"`",close:"`"},{open:'"',close:'"'},{open:"'",close:"'"},{open:":",close:"."}],folding:{markers:{start:new RegExp("^\\s*(::\\s*|COMMENT\\s+)#region"),end:new RegExp("^\\s*(::\\s*|COMMENT\\s+)#endregion")}}};const X=Object.freeze(Object.defineProperty({__proto__:null,conf:U,language:{tokenPostfix:".lexon",ignoreCase:!0,keywords:["lexon","lex","clause","terms","contracts","may","pay","pays","appoints","into","to"],typeKeywords:["amount","person","key","time","date","asset","text"],operators:["less","greater","equal","le","gt","or","and","add","added","subtract","subtracted","multiply","multiplied","times","divide","divided","is","be","certified"],symbols:/[=><!~?:&|+\-*\/\^%]+/,tokenizer:{root:[[/^(\s*)(comment:?(?:\s.*|))$/,["","comment"]],[/"/,{token:"identifier.quote",bracket:"@open",next:"@quoted_identifier"}],["LEX$",{token:"keyword",bracket:"@open",next:"@identifier_until_period"}],["LEXON",{token:"keyword",bracket:"@open",next:"@semver"}],[":",{token:"delimiter",bracket:"@open",next:"@identifier_until_period"}],[/[a-z_$][\w$]*/,{cases:{"@operators":"operator","@typeKeywords":"keyword.type","@keywords":"keyword","@default":"identifier"}}],{include:"@whitespace"},[/[{}()\[\]]/,"@brackets"],[/[<>](?!@symbols)/,"@brackets"],[/@symbols/,"delimiter"],[/\d*\.\d*\.\d*/,"number.semver"],[/\d*\.\d+([eE][\-+]?\d+)?/,"number.float"],[/0[xX][0-9a-fA-F]+/,"number.hex"],[/\d+/,"number"],[/[;,.]/,"delimiter"]],quoted_identifier:[[/[^\\"]+/,"identifier"],[/"/,{token:"identifier.quote",bracket:"@close",next:"@pop"}]],space_identifier_until_period:[[":","delimiter"],[" ",{token:"white",next:"@identifier_rest"}]],identifier_until_period:[{include:"@whitespace"},[":",{token:"delimiter",next:"@identifier_rest"}],[/[^\\.]+/,"identifier"],[/\./,{token:"delimiter",bracket:"@close",next:"@pop"}]],identifier_rest:[[/[^\\.]+/,"identifier"],[/\./,{token:"delimiter",bracket:"@close",next:"@pop"}]],semver:[{include:"@whitespace"},[":","delimiter"],[/\d*\.\d*\.\d*/,{token:"number.semver",bracket:"@close",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,"white"]]}}},Symbol.toStringTag,{value:"Module"}));export{w as C,z as D,Q as G,P as M,_ as R,R as a,Z as b,L as c,E as d,N as e,M as f,O as g,k as h,D as i,h as j,T as k,X as l,A as m,$ as n,K as p,S as s,j as u};
