@tickernelz/paperclip-pro-server 2026.928.0 → 2026.928.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build-info.json +1 -1
- package/dist/services/adapter-config-schema.d.ts.map +1 -1
- package/dist/services/adapter-config-schema.js +32 -8
- package/dist/services/adapter-config-schema.js.map +1 -1
- package/dist/services/execution-workspaces.d.ts +6 -4
- package/dist/services/execution-workspaces.d.ts.map +1 -1
- package/dist/services/execution-workspaces.js +25 -4
- package/dist/services/execution-workspaces.js.map +1 -1
- package/dist/services/heartbeat.d.ts +6 -0
- package/dist/services/heartbeat.d.ts.map +1 -1
- package/dist/services/heartbeat.js +24 -1
- package/dist/services/heartbeat.js.map +1 -1
- package/package.json +21 -21
- package/ui-dist/assets/{Agents.production-DWWgo4A7.js → Agents.production-DnNn75nn.js} +2 -2
- package/ui-dist/assets/{CompanyActivity.production-DA1vWn15.js → CompanyActivity.production-BY7txBud.js} +1 -1
- package/ui-dist/assets/{CompanyExport-B2fFD7mk.js → CompanyExport-CM6gvMQK.js} +1 -1
- package/ui-dist/assets/{CompanySkills.production-CPTxTVTQ.js → CompanySkills.production-D-APop9n.js} +1 -1
- package/ui-dist/assets/{Costs.production-bu8MzAPR.js → Costs.production-BLGB0Sf8.js} +1 -1
- package/ui-dist/assets/{MarkdownBody-D0eCfSWN.js → MarkdownBody-DJQ35hak.js} +1 -1
- package/ui-dist/assets/{OrgChart.production-BHlwZQTx.js → OrgChart.production-BAnt5soz.js} +1 -1
- package/ui-dist/assets/{RoutineDetail.production-WBEY9g9e.js → RoutineDetail.production-DcR87XCo.js} +1 -1
- package/ui-dist/assets/{RoutineRunVariablesDialog-IRX4TLng.js → RoutineRunVariablesDialog-BdO_mZGp.js} +1 -1
- package/ui-dist/assets/{Routines.production-7tYNG689.js → Routines.production-Wo_pIGw6.js} +1 -1
- package/ui-dist/assets/{definition-Dxm_TuVz.js → definition-C0oghTDp.js} +1 -1
- package/ui-dist/assets/{index-CZl9vxyj.js → index-DhwreIEp.js} +166 -166
- package/ui-dist/assets/index-J-4PQOv1.css +1 -0
- package/ui-dist/assets/{router-DyZkoSkG.js → router-Bb8nJWyv.js} +1 -1
- package/ui-dist/index.html +5 -5
- package/ui-dist/sw.js +1 -1
- package/ui-dist/assets/index-GCNIGBzC.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-G_BSi0G0.js","assets/preload-helper-CceJXRIF.js","assets/chunk-Y2CYZVJY-OvsAdhaO.js","assets/src-Bssc388C.js","assets/rolldown-runtime-ZpX3ckPj.js","assets/chunk-DU6HZSFF-2P5iNHqg.js","assets/chunk-75Z2AOVW-BaPl5WA6.js","assets/dist-Cj4C2HPs.js","assets/chunk-PWAF6VOD-CR3rNBNB.js","assets/chunk-GMAD6QVW-BfvaaEBW.js","assets/chunk-P2QGCYS3-CjqEi3mx.js","assets/chunk-4HAMMTFA-CGGd_Pxz.js","assets/rough.esm-DnC5Tr1g.js","assets/chunk-GVQU2GXP-Cwp_Wpj2.js","assets/chunk-OSK3NFVY-DlrxddG-.js","assets/line-CJEZO7lL.js","assets/path-D6mommQw.js","assets/array-CL5Tisss.js","assets/graphlib-DHhK3saS.js","assets/chunk-L3NEJ4N5-JUd1UqX1.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
var xn=Object.defineProperty;var o=(e,t)=>xn(e,"name",{value:t,configurable:!0});import{i as ye,n as Sn,t as ie}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as Bn,Lr as In,Pr as Pn,S as H,W as Ln,Xn as fe,Y as St,nr as Rn,t as Bt}from"./createLucideIcon-r3v6fbGz.js";import{t as jn}from"./preload-helper-CceJXRIF.js";import{B as Tn,a as Nn,c as _n,it as It,o as On,s as Mn,t as Ue}from"./router-DyZkoSkG.js";import{C as zn,D as Pt,F as Re,H as re,I as tt,J as He,K as $,L as $n,P as T,R as Un,S as Hn,U as le,W as Wn,Y as Z,_ as Vn,c as Kn,d as qn,f as Xn,g as ue,h as Yn,i as Lt,j as We,k as nt,l as Gn,m as Zn,p as Jn,r as Qn,u as er,x as Ve,z as tr}from"./mention-chips-DXumPrOR.js";import{c as nr,d as rr,h as rt,i as Rt,l as lr,m as or,n as ir,t as ur,u as jt,y as ar}from"./StatusIcon-BuUYMqqU.js";import{t as sr}from"./check-DDiXDm2i.js";import{p as cr}from"./button-CAPbz11u.js";import{i as pr,r as fr,t as hr}from"./clipboard-CYJ5Q78m.js";import{t as dr}from"./external-link-0lrOvZWO.js";var mr=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Dr=Bt("file-code-corner",mr),gr=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],Fr=Bt("text-wrap",gr);function J(e){const t=[];let n=-1,r=0,l=0;for(;++n<e.length;){const u=e.charCodeAt(n);let i="";if(u===37&&le(e.charCodeAt(n+1))&&le(e.charCodeAt(n+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(i=String.fromCharCode(u));else if(u>55295&&u<57344){const a=e.charCodeAt(n+1);u<56320&&a>56319&&a<57344?(i=String.fromCharCode(u,a),l=1):i="�"}else i=String.fromCharCode(u);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+l+1,i=""),l&&(n+=l,l=0)}return t.join("")+e.slice(r)}o(J,"normalizeUri");var w=ye(In(),1),g=ye(Bn(),1);function yr(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}o(yr,"escapeStringRegexp");var Tt="paperclip.theme",wr="#18181b",Cr="#ffffff",Nt=(0,w.createContext)(void 0);function kr(){return typeof document>"u"||document.documentElement.classList.contains("dark")?"dark":"light"}o(kr,"resolveThemeFromDocument");function Er(){if(typeof window>"u")return!1;try{const e=window.localStorage.getItem(Tt);return e==="light"||e==="dark"}catch{return!1}}o(Er,"hasStoredTheme");function Ar(e){if(typeof document>"u")return;const t=e==="dark",n=document.documentElement;n.classList.toggle("dark",t),n.style.colorScheme=t?"dark":"light";const r=document.querySelector('meta[name="theme-color"]');r instanceof HTMLMetaElement&&r.setAttribute("content",t?wr:Cr)}o(Ar,"applyTheme");function oa({children:e}){const[t,n]=(0,w.useState)(()=>kr()),[r,l]=(0,w.useState)(()=>Er()),u=(0,w.useCallback)(c=>{l(!0),n(c)},[]),i=(0,w.useCallback)(()=>{l(!0),n(c=>c==="dark"?"light":"dark")},[]);(0,w.useEffect)(()=>{if(Ar(t),!!r)try{localStorage.setItem(Tt,t)}catch{}},[t,r]),(0,w.useEffect)(()=>{if(r||typeof window>"u"||typeof window.matchMedia!="function")return;const c=window.matchMedia("(prefers-color-scheme: dark)"),p=o(f=>{n(f.matches?"dark":"light")},"handleChange");return c.addEventListener("change",p),()=>c.removeEventListener("change",p)},[r]);const a=(0,w.useMemo)(()=>({theme:t,setTheme:u,toggleTheme:i}),[t,u,i]);return(0,g.jsx)(Nt.Provider,{value:a,children:e})}o(oa,"ThemeProvider");function vr(){const e=(0,w.useContext)(Nt);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}o(vr,"useTheme");function br(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}o(br,"stringify$1");var xr=/[ \t\n\f\r]/g;function Sr(e){return typeof e=="object"?e.type==="text"?lt(e.value):!1:lt(e)}o(Sr,"whitespace");function lt(e){return e.replace(xr,"")===""}o(lt,"empty");var ae=class{static{o(this,"Schema")}constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ae.prototype.normal={};ae.prototype.property={};ae.prototype.space=void 0;function _t(e,t){const n={},r={};for(const l of e)Object.assign(n,l.property),Object.assign(r,l.normal);return new ae(n,r,t)}o(_t,"merge");function je(e){return e.toLowerCase()}o(je,"normalize$1");var N=class{static{o(this,"Info")}constructor(e,t){this.attribute=t,this.property=e}};N.prototype.attribute="";N.prototype.booleanish=!1;N.prototype.boolean=!1;N.prototype.commaOrSpaceSeparated=!1;N.prototype.commaSeparated=!1;N.prototype.defined=!1;N.prototype.mustUseProperty=!1;N.prototype.number=!1;N.prototype.overloadedBoolean=!1;N.prototype.property="";N.prototype.spaceSeparated=!1;N.prototype.space=void 0;var Te=Sn({boolean:o(()=>v,"boolean"),booleanish:o(()=>L,"booleanish"),commaOrSpaceSeparated:o(()=>M,"commaOrSpaceSeparated"),commaSeparated:o(()=>X,"commaSeparated"),number:o(()=>m,"number"),overloadedBoolean:o(()=>Ne,"overloadedBoolean"),spaceSeparated:o(()=>P,"spaceSeparated")}),Br=0,v=Y(),L=Y(),Ne=Y(),m=Y(),P=Y(),X=Y(),M=Y();function Y(){return 2**++Br}o(Y,"increment");var we=Object.keys(Te),Ke=class extends N{static{o(this,"DefinedInfo")}constructor(e,t,n,r){let l=-1;if(super(e,t),ot(this,"space",r),typeof n=="number")for(;++l<we.length;){const u=we[l];ot(this,we[l],(n&Te[u])===Te[u])}}};Ke.prototype.defined=!0;function ot(e,t,n){n&&(e[t]=n)}o(ot,"mark");function Q(e){const t={},n={};for(const[r,l]of Object.entries(e.properties)){const u=new Ke(r,e.transform(e.attributes||{},r),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(u.mustUseProperty=!0),t[r]=u,n[je(r)]=r,n[je(u.attribute)]=r}return new ae(t,n,e.space)}o(Q,"create");var Ot=Q({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:m,ariaColIndex:m,ariaColSpan:m,ariaControls:P,ariaCurrent:null,ariaDescribedBy:P,ariaDetails:null,ariaDisabled:L,ariaDropEffect:P,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:P,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:P,ariaLevel:m,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:P,ariaPlaceholder:null,ariaPosInSet:m,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:P,ariaRowCount:m,ariaRowIndex:m,ariaRowSpan:m,ariaSelected:L,ariaSetSize:m,ariaSort:null,ariaValueMax:m,ariaValueMin:m,ariaValueNow:m,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Mt(e,t){return t in e?e[t]:t}o(Mt,"caseSensitiveTransform");function zt(e,t){return Mt(e,t.toLowerCase())}o(zt,"caseInsensitiveTransform");var Ir=Q({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:X,acceptCharset:P,accessKey:P,action:null,allow:null,allowFullScreen:v,allowPaymentRequest:v,allowUserMedia:v,alpha:v,alt:null,as:null,async:v,autoCapitalize:null,autoComplete:P,autoFocus:v,autoPlay:v,blocking:P,capture:null,charSet:null,checked:v,cite:null,className:P,closedBy:null,colorSpace:null,cols:m,colSpan:m,command:null,commandFor:null,content:null,contentEditable:L,controls:v,controlsList:P,coords:m|X,crossOrigin:null,data:null,dateTime:null,decoding:null,default:v,defer:v,dir:null,dirName:null,disabled:v,download:Ne,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:v,formTarget:null,headers:P,height:m,hidden:Ne,high:m,href:null,hrefLang:null,htmlFor:P,httpEquiv:P,id:null,imageSizes:null,imageSrcSet:null,inert:v,inputMode:null,integrity:null,is:null,isMap:v,itemId:null,itemProp:P,itemRef:P,itemScope:v,itemType:P,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:v,low:m,manifest:null,max:null,maxLength:m,media:null,method:null,min:null,minLength:m,multiple:v,muted:v,name:null,nonce:null,noModule:v,noValidate:v,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:v,optimum:m,pattern:null,ping:P,placeholder:null,playsInline:v,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:v,referrerPolicy:null,rel:P,required:v,reversed:v,rows:m,rowSpan:m,sandbox:P,scope:null,scoped:v,seamless:v,selected:v,shadowRootClonable:v,shadowRootCustomElementRegistry:v,shadowRootDelegatesFocus:v,shadowRootMode:null,shadowRootSerializable:v,shape:null,size:m,sizes:null,slot:null,span:m,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:m,step:null,style:null,tabIndex:m,target:null,title:null,translate:null,type:null,typeMustMatch:v,useMap:null,value:L,width:m,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:P,axis:null,background:null,bgColor:null,border:m,borderColor:null,bottomMargin:m,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:v,declare:v,event:null,face:null,frame:null,frameBorder:null,hSpace:m,leftMargin:m,link:null,longDesc:null,lowSrc:null,marginHeight:m,marginWidth:m,noResize:v,noHref:v,noShade:v,noWrap:v,object:null,profile:null,prompt:null,rev:null,rightMargin:m,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:m,valueType:null,version:null,vAlign:null,vLink:null,vSpace:m,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:v,disablePictureInPicture:v,disableRemotePlayback:v,exportParts:X,part:P,prefix:null,property:null,results:m,security:null,unselectable:null},space:"html",transform:zt}),Pr=Q({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:M,accentHeight:m,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:m,amplitude:m,arabicForm:null,ascent:m,attributeName:null,attributeType:null,azimuth:m,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:m,by:null,calcMode:null,capHeight:m,className:P,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:m,diffuseConstant:m,direction:null,display:null,dur:null,divisor:m,dominantBaseline:null,download:v,dx:null,dy:null,edgeMode:null,editable:null,elevation:m,enableBackground:null,end:null,event:null,exponent:m,externalResourcesRequired:null,fill:null,fillOpacity:m,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:X,g2:X,glyphName:X,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:m,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:m,horizOriginX:m,horizOriginY:m,id:null,ideographic:m,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:m,k:m,k1:m,k2:m,k3:m,k4:m,kernelMatrix:M,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:m,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:m,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:m,overlineThickness:m,paintOrder:null,panose1:null,path:null,pathLength:m,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:P,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:m,pointsAtY:m,pointsAtZ:m,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:M,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:M,rev:M,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:M,requiredFeatures:M,requiredFonts:M,requiredFormats:M,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:m,specularExponent:m,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:m,strikethroughThickness:m,string:null,stroke:null,strokeDashArray:M,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:m,strokeOpacity:m,strokeWidth:null,style:null,surfaceScale:m,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:M,tabIndex:m,tableValues:null,target:null,targetX:m,targetY:m,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:M,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:m,underlineThickness:m,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:m,values:null,vAlphabetic:m,vMathematical:m,vectorEffect:null,vHanging:m,vIdeographic:m,version:null,vertAdvY:m,vertOriginX:m,vertOriginY:m,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:m,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mt}),$t=Q({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Ut=Q({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zt}),Ht=Q({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Lr={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Rr=/[A-Z]/g,it=/-[a-z]/g,jr=/^data[-\w.:]+$/i;function Tr(e,t){const n=je(t);let r=t,l=N;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jr.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(it,_r);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!it.test(u)){let i=u.replace(Rr,Nr);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}l=Ke}return new l(r,t)}o(Tr,"find");function Nr(e){return"-"+e.toLowerCase()}o(Nr,"kebab");function _r(e){return e.charAt(1).toUpperCase()}o(_r,"camelcase");var Or=_t([Ot,Ir,$t,Ut,Ht],"html"),qe=_t([Ot,Pr,$t,Ut,Ht],"svg");function Mr(e){return e.join(" ").trim()}o(Mr,"stringify");var zr=ie(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,l=/^\s*/,u=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,p=/^\s+|\s+$/g,f=`
|
|
2
|
+
var xn=Object.defineProperty;var o=(e,t)=>xn(e,"name",{value:t,configurable:!0});import{i as ye,n as Sn,t as ie}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as Bn,Lr as In,Pr as Pn,S as H,W as Ln,Xn as fe,Y as St,nr as Rn,t as Bt}from"./createLucideIcon-r3v6fbGz.js";import{t as jn}from"./preload-helper-CceJXRIF.js";import{B as Tn,a as Nn,c as _n,it as It,o as On,s as Mn,t as Ue}from"./router-Bb8nJWyv.js";import{C as zn,D as Pt,F as Re,H as re,I as tt,J as He,K as $,L as $n,P as T,R as Un,S as Hn,U as le,W as Wn,Y as Z,_ as Vn,c as Kn,d as qn,f as Xn,g as ue,h as Yn,i as Lt,j as We,k as nt,l as Gn,m as Zn,p as Jn,r as Qn,u as er,x as Ve,z as tr}from"./mention-chips-DXumPrOR.js";import{c as nr,d as rr,h as rt,i as Rt,l as lr,m as or,n as ir,t as ur,u as jt,y as ar}from"./StatusIcon-BuUYMqqU.js";import{t as sr}from"./check-DDiXDm2i.js";import{p as cr}from"./button-CAPbz11u.js";import{i as pr,r as fr,t as hr}from"./clipboard-CYJ5Q78m.js";import{t as dr}from"./external-link-0lrOvZWO.js";var mr=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],Dr=Bt("file-code-corner",mr),gr=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],Fr=Bt("text-wrap",gr);function J(e){const t=[];let n=-1,r=0,l=0;for(;++n<e.length;){const u=e.charCodeAt(n);let i="";if(u===37&&le(e.charCodeAt(n+1))&&le(e.charCodeAt(n+2)))l=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(i=String.fromCharCode(u));else if(u>55295&&u<57344){const a=e.charCodeAt(n+1);u<56320&&a>56319&&a<57344?(i=String.fromCharCode(u,a),l=1):i="�"}else i=String.fromCharCode(u);i&&(t.push(e.slice(r,n),encodeURIComponent(i)),r=n+l+1,i=""),l&&(n+=l,l=0)}return t.join("")+e.slice(r)}o(J,"normalizeUri");var w=ye(In(),1),g=ye(Bn(),1);function yr(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}o(yr,"escapeStringRegexp");var Tt="paperclip.theme",wr="#18181b",Cr="#ffffff",Nt=(0,w.createContext)(void 0);function kr(){return typeof document>"u"||document.documentElement.classList.contains("dark")?"dark":"light"}o(kr,"resolveThemeFromDocument");function Er(){if(typeof window>"u")return!1;try{const e=window.localStorage.getItem(Tt);return e==="light"||e==="dark"}catch{return!1}}o(Er,"hasStoredTheme");function Ar(e){if(typeof document>"u")return;const t=e==="dark",n=document.documentElement;n.classList.toggle("dark",t),n.style.colorScheme=t?"dark":"light";const r=document.querySelector('meta[name="theme-color"]');r instanceof HTMLMetaElement&&r.setAttribute("content",t?wr:Cr)}o(Ar,"applyTheme");function oa({children:e}){const[t,n]=(0,w.useState)(()=>kr()),[r,l]=(0,w.useState)(()=>Er()),u=(0,w.useCallback)(c=>{l(!0),n(c)},[]),i=(0,w.useCallback)(()=>{l(!0),n(c=>c==="dark"?"light":"dark")},[]);(0,w.useEffect)(()=>{if(Ar(t),!!r)try{localStorage.setItem(Tt,t)}catch{}},[t,r]),(0,w.useEffect)(()=>{if(r||typeof window>"u"||typeof window.matchMedia!="function")return;const c=window.matchMedia("(prefers-color-scheme: dark)"),p=o(f=>{n(f.matches?"dark":"light")},"handleChange");return c.addEventListener("change",p),()=>c.removeEventListener("change",p)},[r]);const a=(0,w.useMemo)(()=>({theme:t,setTheme:u,toggleTheme:i}),[t,u,i]);return(0,g.jsx)(Nt.Provider,{value:a,children:e})}o(oa,"ThemeProvider");function vr(){const e=(0,w.useContext)(Nt);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}o(vr,"useTheme");function br(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}o(br,"stringify$1");var xr=/[ \t\n\f\r]/g;function Sr(e){return typeof e=="object"?e.type==="text"?lt(e.value):!1:lt(e)}o(Sr,"whitespace");function lt(e){return e.replace(xr,"")===""}o(lt,"empty");var ae=class{static{o(this,"Schema")}constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ae.prototype.normal={};ae.prototype.property={};ae.prototype.space=void 0;function _t(e,t){const n={},r={};for(const l of e)Object.assign(n,l.property),Object.assign(r,l.normal);return new ae(n,r,t)}o(_t,"merge");function je(e){return e.toLowerCase()}o(je,"normalize$1");var N=class{static{o(this,"Info")}constructor(e,t){this.attribute=t,this.property=e}};N.prototype.attribute="";N.prototype.booleanish=!1;N.prototype.boolean=!1;N.prototype.commaOrSpaceSeparated=!1;N.prototype.commaSeparated=!1;N.prototype.defined=!1;N.prototype.mustUseProperty=!1;N.prototype.number=!1;N.prototype.overloadedBoolean=!1;N.prototype.property="";N.prototype.spaceSeparated=!1;N.prototype.space=void 0;var Te=Sn({boolean:o(()=>v,"boolean"),booleanish:o(()=>L,"booleanish"),commaOrSpaceSeparated:o(()=>M,"commaOrSpaceSeparated"),commaSeparated:o(()=>X,"commaSeparated"),number:o(()=>m,"number"),overloadedBoolean:o(()=>Ne,"overloadedBoolean"),spaceSeparated:o(()=>P,"spaceSeparated")}),Br=0,v=Y(),L=Y(),Ne=Y(),m=Y(),P=Y(),X=Y(),M=Y();function Y(){return 2**++Br}o(Y,"increment");var we=Object.keys(Te),Ke=class extends N{static{o(this,"DefinedInfo")}constructor(e,t,n,r){let l=-1;if(super(e,t),ot(this,"space",r),typeof n=="number")for(;++l<we.length;){const u=we[l];ot(this,we[l],(n&Te[u])===Te[u])}}};Ke.prototype.defined=!0;function ot(e,t,n){n&&(e[t]=n)}o(ot,"mark");function Q(e){const t={},n={};for(const[r,l]of Object.entries(e.properties)){const u=new Ke(r,e.transform(e.attributes||{},r),l,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(u.mustUseProperty=!0),t[r]=u,n[je(r)]=r,n[je(u.attribute)]=r}return new ae(t,n,e.space)}o(Q,"create");var Ot=Q({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:m,ariaColIndex:m,ariaColSpan:m,ariaControls:P,ariaCurrent:null,ariaDescribedBy:P,ariaDetails:null,ariaDisabled:L,ariaDropEffect:P,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:P,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:P,ariaLevel:m,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:P,ariaPlaceholder:null,ariaPosInSet:m,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:P,ariaRowCount:m,ariaRowIndex:m,ariaRowSpan:m,ariaSelected:L,ariaSetSize:m,ariaSort:null,ariaValueMax:m,ariaValueMin:m,ariaValueNow:m,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Mt(e,t){return t in e?e[t]:t}o(Mt,"caseSensitiveTransform");function zt(e,t){return Mt(e,t.toLowerCase())}o(zt,"caseInsensitiveTransform");var Ir=Q({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:X,acceptCharset:P,accessKey:P,action:null,allow:null,allowFullScreen:v,allowPaymentRequest:v,allowUserMedia:v,alpha:v,alt:null,as:null,async:v,autoCapitalize:null,autoComplete:P,autoFocus:v,autoPlay:v,blocking:P,capture:null,charSet:null,checked:v,cite:null,className:P,closedBy:null,colorSpace:null,cols:m,colSpan:m,command:null,commandFor:null,content:null,contentEditable:L,controls:v,controlsList:P,coords:m|X,crossOrigin:null,data:null,dateTime:null,decoding:null,default:v,defer:v,dir:null,dirName:null,disabled:v,download:Ne,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:v,formTarget:null,headers:P,height:m,hidden:Ne,high:m,href:null,hrefLang:null,htmlFor:P,httpEquiv:P,id:null,imageSizes:null,imageSrcSet:null,inert:v,inputMode:null,integrity:null,is:null,isMap:v,itemId:null,itemProp:P,itemRef:P,itemScope:v,itemType:P,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:v,low:m,manifest:null,max:null,maxLength:m,media:null,method:null,min:null,minLength:m,multiple:v,muted:v,name:null,nonce:null,noModule:v,noValidate:v,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:v,optimum:m,pattern:null,ping:P,placeholder:null,playsInline:v,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:v,referrerPolicy:null,rel:P,required:v,reversed:v,rows:m,rowSpan:m,sandbox:P,scope:null,scoped:v,seamless:v,selected:v,shadowRootClonable:v,shadowRootCustomElementRegistry:v,shadowRootDelegatesFocus:v,shadowRootMode:null,shadowRootSerializable:v,shape:null,size:m,sizes:null,slot:null,span:m,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:m,step:null,style:null,tabIndex:m,target:null,title:null,translate:null,type:null,typeMustMatch:v,useMap:null,value:L,width:m,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:P,axis:null,background:null,bgColor:null,border:m,borderColor:null,bottomMargin:m,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:v,declare:v,event:null,face:null,frame:null,frameBorder:null,hSpace:m,leftMargin:m,link:null,longDesc:null,lowSrc:null,marginHeight:m,marginWidth:m,noResize:v,noHref:v,noShade:v,noWrap:v,object:null,profile:null,prompt:null,rev:null,rightMargin:m,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:m,valueType:null,version:null,vAlign:null,vLink:null,vSpace:m,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:v,disablePictureInPicture:v,disableRemotePlayback:v,exportParts:X,part:P,prefix:null,property:null,results:m,security:null,unselectable:null},space:"html",transform:zt}),Pr=Q({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:M,accentHeight:m,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:m,amplitude:m,arabicForm:null,ascent:m,attributeName:null,attributeType:null,azimuth:m,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:m,by:null,calcMode:null,capHeight:m,className:P,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:m,diffuseConstant:m,direction:null,display:null,dur:null,divisor:m,dominantBaseline:null,download:v,dx:null,dy:null,edgeMode:null,editable:null,elevation:m,enableBackground:null,end:null,event:null,exponent:m,externalResourcesRequired:null,fill:null,fillOpacity:m,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:X,g2:X,glyphName:X,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:m,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:m,horizOriginX:m,horizOriginY:m,id:null,ideographic:m,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:m,k:m,k1:m,k2:m,k3:m,k4:m,kernelMatrix:M,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:m,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:m,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:m,overlineThickness:m,paintOrder:null,panose1:null,path:null,pathLength:m,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:P,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:m,pointsAtY:m,pointsAtZ:m,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:M,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:M,rev:M,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:M,requiredFeatures:M,requiredFonts:M,requiredFormats:M,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:m,specularExponent:m,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:m,strikethroughThickness:m,string:null,stroke:null,strokeDashArray:M,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:m,strokeOpacity:m,strokeWidth:null,style:null,surfaceScale:m,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:M,tabIndex:m,tableValues:null,target:null,targetX:m,targetY:m,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:M,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:m,underlineThickness:m,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:m,values:null,vAlphabetic:m,vMathematical:m,vectorEffect:null,vHanging:m,vIdeographic:m,version:null,vertAdvY:m,vertOriginX:m,vertOriginY:m,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:m,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mt}),$t=Q({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Ut=Q({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:zt}),Ht=Q({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Lr={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Rr=/[A-Z]/g,it=/-[a-z]/g,jr=/^data[-\w.:]+$/i;function Tr(e,t){const n=je(t);let r=t,l=N;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&jr.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(it,_r);r="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!it.test(u)){let i=u.replace(Rr,Nr);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}l=Ke}return new l(r,t)}o(Tr,"find");function Nr(e){return"-"+e.toLowerCase()}o(Nr,"kebab");function _r(e){return e.charAt(1).toUpperCase()}o(_r,"camelcase");var Or=_t([Ot,Ir,$t,Ut,Ht],"html"),qe=_t([Ot,Pr,$t,Ut,Ht],"svg");function Mr(e){return e.join(" ").trim()}o(Mr,"stringify");var zr=ie(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,l=/^\s*/,u=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,i=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,p=/^\s+|\s+$/g,f=`
|
|
3
3
|
`,s="/",h="*",d="",D="comment",F="declaration";function C(k,E){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];E=E||{};var A=1,y=1;function B(I){var S=I.match(r);S&&(A+=S.length);var O=I.lastIndexOf(f);y=~O?I.length-O:y+I.length}o(B,"updatePosition");function x(){var I={line:A,column:y};return function(S){return S.position=new _(I),ee(),S}}o(x,"position");function _(I){this.start=I,this.end={line:A,column:y},this.source=E.source}o(_,"Position"),_.prototype.content=k;function j(I){var S=new Error(E.source+":"+A+":"+y+": "+I);if(S.reason=I,S.filename=E.source,S.line=A,S.column=y,S.source=k,!E.silent)throw S}o(j,"error");function V(I){var S=I.exec(k);if(S){var O=S[0];return B(O),k=k.slice(O.length),S}}o(V,"match");function ee(){V(l)}o(ee,"whitespace");function R(I){var S;for(I=I||[];S=te();)S!==!1&&I.push(S);return I}o(R,"comments");function te(){var I=x();if(!(s!=k.charAt(0)||h!=k.charAt(1))){for(var S=2;d!=k.charAt(S)&&(h!=k.charAt(S)||s!=k.charAt(S+1));)++S;if(S+=2,d===k.charAt(S-1))return j("End of comment missing");var O=k.slice(2,S-2);return y+=2,B(O),k=k.slice(S),y+=2,I({type:D,comment:O})}}o(te,"comment");function ce(){var I=x(),S=V(u);if(S){if(te(),!V(i))return j("property missing ':'");var O=V(a),bn=I({type:F,property:b(S[0].replace(n,d)),value:O?b(O[0].replace(n,d)):d});return V(c),bn}}o(ce,"declaration");function pe(){var I=[];R(I);for(var S;S=ce();)S!==!1&&(I.push(S),R(I));return I}return o(pe,"declarations"),ee(),pe()}o(C,"index");function b(k){return k?k.replace(p,d):d}o(b,"trim"),t.exports=C})),$r=ie((e=>{var t=e&&e.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(e,"__esModule",{value:!0}),e.default=r;var n=t(zr());function r(l,u){let i=null;if(!l||typeof l!="string")return i;const a=(0,n.default)(l),c=typeof u=="function";return a.forEach(p=>{if(p.type!=="declaration")return;const{property:f,value:s}=p;c?u(f,s,p):s&&(i=i||{},i[f]=s)}),i}o(r,"StyleToObject")})),Ur=ie((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,l=/^-(webkit|moz|ms|o|khtml)-/,u=/^-(ms)-/,i=o(function(f){return!f||r.test(f)||t.test(f)},"skipCamelCase"),a=o(function(f,s){return s.toUpperCase()},"capitalize"),c=o(function(f,s){return"".concat(s,"-")},"trimHyphen"),p=o(function(f,s){return s===void 0&&(s={}),i(f)?f:(f=f.toLowerCase(),s.reactCompat?f=f.replace(u,c):f=f.replace(l,c),f.replace(n,a))},"camelCase");e.camelCase=p})),Hr=ie(((e,t)=>{var n=(e&&e.__importDefault||function(u){return u&&u.__esModule?u:{default:u}})($r()),r=Ur();function l(u,i){var a={};return!u||typeof u!="string"||(0,n.default)(u,function(c,p){c&&p&&(a[(0,r.camelCase)(c,i)]=p)}),a}o(l,"StyleToJS"),l.default=l,t.exports=l})),Wt=Vt("end"),Xe=Vt("start");function Vt(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}o(Vt,"point");function Wr(e){const t=Xe(e),n=Wt(e);if(t&&n)return{start:t,end:n}}o(Wr,"position");var Vr=ye(Hr(),1),Ye={}.hasOwnProperty,Kr=new Map,qr=/[A-Z]/g,Xr=new Set(["table","tbody","thead","tfoot","tr"]),Yr=new Set(["td","th"]),Kt="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Gr(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=ll(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=rl(n,t.jsx,t.jsxs)}const l={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?qe:Or,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=qt(l,e,void 0);return u&&typeof u!="string"?u:l.create(e,l.Fragment,{children:u||void 0},void 0)}o(Gr,"toJsxRuntime");function qt(e,t,n){if(t.type==="element")return Zr(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Jr(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return el(e,t,n);if(t.type==="mdxjsEsm")return Qr(e,t);if(t.type==="root")return tl(e,t,n);if(t.type==="text")return nl(e,t)}o(qt,"one$1");function Zr(e,t,n){const r=e.schema;let l=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(l=qe,e.schema=l),e.ancestors.push(t);const u=Yt(e,t.tagName,!1),i=ol(e,t);let a=Ze(e,t);return Xr.has(t.tagName)&&(a=a.filter(function(c){return typeof c=="string"?!Sr(c):!0})),Xt(e,i,u,t),Ge(i,a),e.ancestors.pop(),e.schema=r,e.create(t,u,i,n)}o(Zr,"element");function Jr(e,t){if(t.data&&t.data.estree&&e.evaluater){const n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}oe(e,t.position)}o(Jr,"mdxExpression");function Qr(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);oe(e,t.position)}o(Qr,"mdxEsm");function el(e,t,n){const r=e.schema;let l=r;t.name==="svg"&&r.space==="html"&&(l=qe,e.schema=l),e.ancestors.push(t);const u=t.name===null?e.Fragment:Yt(e,t.name,!0),i=il(e,t),a=Ze(e,t);return Xt(e,i,u,t),Ge(i,a),e.ancestors.pop(),e.schema=r,e.create(t,u,i,n)}o(el,"mdxJsxElement");function tl(e,t,n){const r={};return Ge(r,Ze(e,t)),e.create(t,e.Fragment,r,n)}o(tl,"root$1");function nl(e,t){return t.value}o(nl,"text$2");function Xt(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}o(Xt,"addNode");function Ge(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}o(Ge,"addChildren");function rl(e,t,n){return r;function r(l,u,i,a){const c=Array.isArray(i.children)?n:t;return a?c(u,i,a):c(u,i)}}o(rl,"productionCreate");function ll(e,t){return n;function n(r,l,u,i){const a=Array.isArray(u.children),c=Xe(r);return t(l,u,i,a,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}o(ll,"developmentCreate");function ol(e,t){const n={};let r,l;for(l in t.properties)if(l!=="children"&&Ye.call(t.properties,l)){const u=ul(e,l,t.properties[l]);if(u){const[i,a]=u;e.tableCellAlignToStyle&&i==="align"&&typeof a=="string"&&Yr.has(t.tagName)?r=a:n[i]=a}}if(r){const u=n.style||(n.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}o(ol,"createElementProps");function il(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const l=r.data.estree.body[0];l.type;const u=l.expression;u.type;const i=u.properties[0];i.type,Object.assign(n,e.evaluater.evaluateExpression(i.argument))}else oe(e,t.position);else{const l=r.name;let u;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const i=r.value.data.estree.body[0];i.type,u=e.evaluater.evaluateExpression(i.expression)}else oe(e,t.position);else u=r.value===null?!0:r.value;n[l]=u}return n}o(il,"createJsxElementProps");function Ze(e,t){const n=[];let r=-1;const l=e.passKeys?new Map:Kr;for(;++r<t.children.length;){const u=t.children[r];let i;if(e.passKeys){const c=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(c){const p=l.get(c)||0;i=c+"-"+p,l.set(c,p+1)}}const a=qt(e,u,i);a!==void 0&&n.push(a)}return n}o(Ze,"createChildren");function ul(e,t,n){const r=Tr(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?br(n):Mr(n)),r.property==="style"){let l=typeof n=="object"?n:al(e,String(n));return e.stylePropertyNameCase==="css"&&(l=sl(l)),["style",l]}return[e.elementAttributeNameCase==="react"&&r.space?Lr[r.property]||r.property:r.attribute,n]}}o(ul,"createProperty");function al(e,t){try{return(0,Vr.default)(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,l=new We("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw l.file=e.filePath||void 0,l.url=Kt+"#cannot-parse-style-attribute",l}}o(al,"parseStyle");function Yt(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const l=t.split(".");let u=-1,i;for(;++u<l.length;){const a=nt(l[u])?{type:"Identifier",name:l[u]}:{type:"Literal",value:l[u]};i=i?{type:"MemberExpression",object:i,property:a,computed:!!(u&&a.type==="Literal"),optional:!1}:a}r=i}else r=nt(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const l=r.value;return Ye.call(e.components,l)?e.components[l]:l}if(e.evaluater)return e.evaluater.evaluateExpression(r);oe(e)}o(Yt,"findComponentFromName");function oe(e,t){const n=new We("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=Kt+"#cannot-handle-mdx-estrees-without-createevaluater",n}o(oe,"crashEstree");function sl(e){const t={};let n;for(n in e)Ye.call(e,n)&&(t[cl(n)]=e[n]);return t}o(sl,"transformStylesToCssCasing");function cl(e){let t=e.replace(qr,pl);return t.slice(0,3)==="ms-"&&(t="-"+t),t}o(cl,"transformStyleToCssCasing");function pl(e){return"-"+e.toLowerCase()}o(pl,"toDash");var Ce={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]};function fl(e){const t=this;t.parser=n;function n(r){return Zn(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}o(n,"parser")}o(fl,"remarkParse");function hl(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}o(hl,"blockquote");function dl(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
4
4
|
`}]}o(dl,"hardBreak");function ml(e,t){const n=t.value?t.value+`
|
|
5
5
|
`:"",r={},l=t.lang?t.lang.split(/\s+/):[];l.length>0&&(r.className=["language-"+l[0]]);let u={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(u.data={meta:t.meta}),e.patch(t,u),u=e.applyData(t,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(t,u),u}o(ml,"code$1");function Dl(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}o(Dl,"strikethrough");function gl(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}o(gl,"emphasis");function Fl(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),l=J(r.toLowerCase()),u=e.footnoteOrder.indexOf(r);let i,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),i=e.footnoteOrder.length):i=u+1,a+=1,e.footnoteCounts.set(r,a);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+l,id:n+"fnref-"+l+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};e.patch(t,c);const p={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,p),e.applyData(t,p)}o(Fl,"footnoteReference$1");function yl(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}o(yl,"heading");function wl(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}o(wl,"html");function Gt(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const l=e.all(t),u=l[0];u&&u.type==="text"?u.value="["+u.value:l.unshift({type:"text",value:"["});const i=l[l.length-1];return i&&i.type==="text"?i.value+=r:l.push({type:"text",value:r}),l}o(Gt,"revert");function Cl(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Gt(e,t);const l={src:J(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(l.title=r.title);const u={type:"element",tagName:"img",properties:l,children:[]};return e.patch(t,u),e.applyData(t,u)}o(Cl,"imageReference");function kl(e,t){const n={src:J(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}o(kl,"image");function El(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}o(El,"inlineCode");function Al(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return Gt(e,t);const l={href:J(r.url||"")};r.title!==null&&r.title!==void 0&&(l.title=r.title);const u={type:"element",tagName:"a",properties:l,children:e.all(t)};return e.patch(t,u),e.applyData(t,u)}o(Al,"linkReference");function vl(e,t){const n={href:J(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}o(vl,"link");function bl(e,t,n){const r=e.all(t),l=n?xl(n):Zt(t),u={},i=[];if(typeof t.checked=="boolean"){const f=r[0];let s;f&&f.type==="element"&&f.tagName==="p"?s=f:(s={type:"element",tagName:"p",properties:{},children:[]},r.unshift(s)),s.children.length>0&&s.children.unshift({type:"text",value:" "}),s.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),u.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const f=r[a];(l||a!==0||f.type!=="element"||f.tagName!=="p")&&i.push({type:"text",value:`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var pt=Object.defineProperty;var u=(e,a)=>pt(e,"name",{value:a,configurable:!0});import{i as ot}from"./rolldown-runtime-ZpX3ckPj.js";import{En as yt,Fr as bt,Lr as vt,U as wt,Y as K,_ as Ct,nr as Q}from"./createLucideIcon-r3v6fbGz.js";import{o as jt,t as V}from"./router-DyZkoSkG.js";import{t as Mt}from"./AgentAvatar-PT82VwmU.js";import{t as J}from"./agents-BlSzFh-1.js";import{r as Nt,t as tt}from"./EmptyState-DPcc0zYh.js";import{k as kt,t as et}from"./button-CAPbz11u.js";import{n as Pt,t as Dt}from"./useHiddenSettings-2JpxuJV7.js";import{t as Yt}from"./card-dmVcp3AX.js";import{t as Zt}from"./PageSkeleton-DHjTwRT3.js";import{Dn as rt,On as Et,Pn as Tt,Yt as _t,en as Xt,hn as zt}from"./index-CZl9vxyj.js";var o=ot(vt(),1),n=ot(bt(),1),N=200,W=100,X=32,$t=80,L=60,Wt=.2,Lt=2,R=6;function Z(e){if(e.reports.length===0)return N;const a=e.reports.reduce((i,f)=>i+Z(f),0),d=(e.reports.length-1)*X;return Math.max(N,a+d)}u(Z,"subtreeWidth");function at(e,a,d){const i=Z(e),f=[];if(e.reports.length>0){const C=e.reports.reduce((k,P)=>k+Z(P),0),S=(e.reports.length-1)*X;let j=a+(i-C-S)/2;for(const k of e.reports){const P=Z(k);f.push(at(k,j,d+W+$t)),j+=P+X}}return{id:e.id,name:e.name,role:e.role,status:e.status,x:a+(i-N)/2,y:d,children:f}}u(at,"layoutTree");function St(e){if(e.length===0)return[];e.reduce((f,C)=>f+Z(C),0),(e.length-1)*X;let a=L;const d=L,i=[];for(const f of e){const C=Z(f);i.push(at(f,a,d)),a+=C+X}return i}u(St,"layoutForest");function Ht(e){const a=[];function d(i){a.push(i),i.children.forEach(d)}return u(d,"walk"),e.forEach(d),a}u(Ht,"flattenLayout");function Rt(e){const a=[];function d(i){for(const f of i.children)a.push({parent:i,child:f}),d(f)}return u(d,"walk"),e.forEach(d),a}u(Rt,"collectEdges");function A(e){return Math.min(Math.max(e,Wt),Lt)}u(A,"clampZoom");function At(e){return{x:e.clientX,y:e.clientY}}u(At,"touchPoint");function nt(e,a){const d=e.clientX-a.clientX,i=e.clientY-a.clientY;return Math.hypot(d,i)}u(nt,"touchDistance");function st(e,a,d){const i=d.getBoundingClientRect();return{x:(e.clientX+a.clientX)/2-i.left,y:(e.clientY+a.clientY)/2-i.top}}u(st,"touchCenter");var Ot={running:"var(--hex-22d3ee)",active:"var(--hex-4ade80)",paused:"var(--hex-facc15)",idle:"var(--hex-facc15)",error:"var(--hex-f87171)",terminated:"var(--hex-a3a3a3)"},Bt="var(--hex-a3a3a3)";function oe(){const{selectedCompanyId:e}=wt(),{setBreadcrumbs:a}=Nt(),d=jt(),i=!!Xt(),{hidden:f}=Dt(),C=!i&&!f.has("company.import"),S=!f.has("company.export"),{data:j,isLoading:k}=Q({queryKey:K.org(e),queryFn:u(()=>J.org(e),"queryFn"),enabled:!!e}),{data:P}=Q({queryKey:K.agents.list(e),queryFn:u(()=>J.list(e),"queryFn"),enabled:!!e}),ct=(0,o.useMemo)(()=>{const t=new Map;for(const r of P??[])t.set(r.id,r);return t},[P]);(0,o.useEffect)(()=>{a([{label:"Org Chart"}])},[a]);const z=(0,o.useMemo)(()=>St(j??[]),[j]),D=(0,o.useMemo)(()=>Ht(z),[z]),it=(0,o.useMemo)(()=>Rt(z),[z]),v=(0,o.useMemo)(()=>{if(D.length===0)return{width:800,height:600};let t=0,r=0;for(const s of D)t=Math.max(t,s.x+N),r=Math.max(r,s.y+W);return{width:t+L,height:r+L}},[D]),p=(0,o.useRef)(null),[l,M]=(0,o.useState)({x:0,y:0}),[h,E]=(0,o.useState)(1),[H,O]=(0,o.useState)(!1),T=(0,o.useRef)({x:0,y:0,panX:0,panY:0}),m=(0,o.useRef)({mode:null,startPoint:{x:0,y:0},startPan:{x:0,y:0},startZoom:1,startDistance:0,startCenter:{x:0,y:0},moved:!1}),$=(0,o.useRef)(!1),Y=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current)},[]);const B=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(B.current||D.length===0||!p.current)return;B.current=!0;const t=p.current,r=t.clientWidth,s=t.clientHeight,c=(r-40)/v.width,x=(s-40)/v.height,g=Math.min(c,x,1),y=v.width*g,w=v.height*g;E(g),M({x:(r-y)/2,y:(s-w)/2})},[D,v]);const lt=(0,o.useCallback)(t=>{t.button===0&&(t.target.closest("[data-org-card]")||(O(!0),T.current={x:t.clientX,y:t.clientY,panX:l.x,panY:l.y}))},[l]),ut=(0,o.useCallback)(t=>{if(!H)return;const r=t.clientX-T.current.x,s=t.clientY-T.current.y;M({x:T.current.panX+r,y:T.current.panY+s})},[H]),q=(0,o.useCallback)(()=>{O(!1)},[]),dt=(0,o.useCallback)(t=>{t.preventDefault();const r=p.current;if(!r)return;const s=r.getBoundingClientRect(),c=t.clientX-s.left,x=t.clientY-s.top,g=t.deltaY<0?1.1:.9,y=A(h*g),w=y/h;M({x:c-w*(c-l.x),y:x-w*(x-l.y)}),E(y)},[h,l]),I=(0,o.useCallback)((t,r)=>{const s=A(t),c=s/h;M({x:r.x-c*(r.x-l.x),y:r.y-c*(r.y-l.y)}),E(s)},[h,l]),ht=(0,o.useCallback)(()=>{if(!p.current)return;const t=p.current.clientWidth,r=p.current.clientHeight,s=(t-40)/v.width,c=(r-40)/v.height,x=Math.min(s,c,1),g=v.width*x,y=v.height*x;E(x),M({x:(t-g)/2,y:(r-y)/2})},[v]),mt=(0,o.useCallback)(t=>{if(t.touches.length>=2&&p.current){const[s,c]=[t.touches[0],t.touches[1]];m.current={mode:"pinch",startPoint:{x:0,y:0},startPan:l,startZoom:h,startDistance:nt(s,c),startCenter:st(s,c,p.current),moved:!1};return}const r=t.touches[0];r&&(m.current={mode:"pan",startPoint:At(r),startPan:l,startZoom:h,startDistance:0,startCenter:{x:0,y:0},moved:!1})},[l,h]),ft=(0,o.useCallback)(t=>{const r=p.current;if(!r||!m.current.mode)return;if(t.touches.length>=2){const[g,y]=[t.touches[0],t.touches[1]],w=nt(g,y),_=st(g,y,r);if(m.current.mode!=="pinch"||m.current.startDistance===0){m.current={mode:"pinch",startPoint:{x:0,y:0},startPan:l,startZoom:h,startDistance:w,startCenter:_,moved:!1};return}const b=m.current,U=A(b.startZoom*(w/b.startDistance)),G=U/b.startZoom,xt=_.x-b.startCenter.x,gt=_.y-b.startCenter.y;b.moved=b.moved||Math.abs(w-b.startDistance)>R||Math.hypot(xt,gt)>R,E(U),M({x:_.x-G*(b.startCenter.x-b.startPan.x),y:_.y-G*(b.startCenter.y-b.startPan.y)});return}const s=t.touches[0];if(!s||m.current.mode!=="pan")return;const c=s.clientX-m.current.startPoint.x,x=s.clientY-m.current.startPoint.y;m.current.moved=m.current.moved||Math.hypot(c,x)>R,M({x:m.current.startPan.x+c,y:m.current.startPan.y+x})},[l,h]),F=(0,o.useCallback)(()=>{m.current.moved&&($.current=!0,Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>{$.current=!1,Y.current=null},400)),m.current={mode:null,startPoint:{x:0,y:0},startPan:l,startZoom:h,startDistance:0,startCenter:{x:0,y:0},moved:!1}},[l,h]);return e?k?(0,n.jsx)(Zt,{variant:"org-chart"}):j&&j.length===0?(0,n.jsx)(tt,{icon:rt,message:"No organizational hierarchy defined."}):(0,n.jsxs)("div",{className:"flex h-(--sz-calc-38) min-h-(--sz-420px) flex-col md:h-full md:min-h-0",children:[(0,n.jsxs)("div",{className:"mb-2 flex shrink-0 flex-wrap items-center justify-start gap-2",children:[C&&(0,n.jsx)(V,{to:"/company/import",children:(0,n.jsxs)(et,{variant:"outline",size:"sm",children:[(0,n.jsx)(zt,{className:"mr-1.5 h-3.5 w-3.5"}),"Import company"]})}),S&&(0,n.jsx)(V,{to:"/company/export",children:(0,n.jsxs)(et,{variant:"outline",size:"sm",children:[(0,n.jsx)(Tt,{className:"mr-1.5 h-3.5 w-3.5"}),"Export company"]})})]}),(0,n.jsxs)("div",{ref:p,"data-testid":"org-chart-viewport",className:"w-full flex-1 min-h-0 overflow-hidden relative bg-muted/20 border border-border rounded-lg",style:{cursor:H?"grabbing":"grab",touchAction:"none",overscrollBehavior:"contain"},onMouseDown:lt,onMouseMove:ut,onMouseUp:q,onMouseLeave:q,onWheel:dt,onTouchStart:mt,onTouchMove:ft,onTouchEnd:F,onTouchCancel:F,children:[(0,n.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1.5",children:[(0,n.jsx)("button",{className:"flex size-9 items-center justify-center rounded border border-border bg-background text-sm transition-colors hover:bg-accent sm:size-7",onClick:u(()=>{const t=p.current;t&&I(h*1.2,{x:t.clientWidth/2,y:t.clientHeight/2})},"onClick"),title:"Zoom in","aria-label":"Zoom in",children:(0,n.jsx)(kt,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"})}),(0,n.jsx)("button",{className:"flex size-9 items-center justify-center rounded border border-border bg-background text-sm transition-colors hover:bg-accent sm:size-7",onClick:u(()=>{const t=p.current;t&&I(h*.8,{x:t.clientWidth/2,y:t.clientHeight/2})},"onClick"),title:"Zoom out","aria-label":"Zoom out",children:(0,n.jsx)(Pt,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"})}),(0,n.jsx)("button",{className:"flex size-9 items-center justify-center rounded border border-border bg-background text-(length:--text-nano) transition-colors hover:bg-accent sm:size-7",onClick:ht,title:"Fit to screen","aria-label":"Fit chart to screen",children:(0,n.jsx)(Et,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"})})]}),(0,n.jsx)("svg",{className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%"},children:(0,n.jsx)("g",{transform:`translate(${l.x}, ${l.y}) scale(${h})`,children:it.map(({parent:t,child:r})=>{const s=t.x+N/2,c=t.y+W,x=r.x+N/2,g=r.y,y=(c+g)/2;return(0,n.jsx)("path",{d:`M ${s} ${c} L ${s} ${y} L ${x} ${y} L ${x} ${g}`,fill:"none",stroke:"var(--border)",strokeWidth:1.5},`${t.id}-${r.id}`)})})}),(0,n.jsx)("div",{"data-testid":"org-chart-card-layer",className:"absolute inset-0",style:{transform:`translate(${l.x}px, ${l.y}px) scale(${h})`,transformOrigin:"0 0"},children:D.map(t=>{const r=ct.get(t.id),s=Ot[t.status]??Bt;return(0,n.jsx)(Yt,{"data-org-card":!0,className:"block absolute py-0 hover:shadow-md hover:border-foreground/20 transition-(--tp-box-shadow-border-color) duration-150 cursor-pointer select-none",style:{left:t.x,top:t.y,width:N,minHeight:W},onClick:u(()=>d(r?Ct(r):`/agents/${t.id}`),"onClick"),onClickCapture:u(c=>{$.current&&($.current=!1,c.preventDefault(),c.stopPropagation())},"onClickCapture"),children:(0,n.jsxs)("div",{className:"flex items-center px-4 py-3 gap-3",children:[(0,n.jsxs)("div",{className:"relative shrink-0",children:[(0,n.jsx)("div",{className:"w-9 h-9 rounded-full bg-muted flex items-center justify-center",children:(0,n.jsx)(Mt,{agent:r,size:16,className:"h-4.5 w-4.5 text-foreground/70"})}),(0,n.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full border-2 border-card",style:{backgroundColor:s}})]}),(0,n.jsxs)("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"text-sm font-semibold text-foreground leading-tight",children:t.name}),(0,n.jsx)("span",{className:"text-(length:--text-micro) text-muted-foreground leading-tight mt-0.5",children:r?.title??It(t.role)}),r&&(0,n.jsx)("span",{className:"text-(length:--text-nano) text-muted-foreground/60 font-mono leading-tight mt-1",children:_t(r.adapterType)}),r&&r.capabilities&&(0,n.jsx)("span",{className:"text-(length:--text-nano) text-muted-foreground/80 leading-tight mt-1 line-clamp-2",children:r.capabilities})]})]})},t.id)})})]})]}):(0,n.jsx)(tt,{icon:rt,message:"Select a company to view the org chart."})}u(oe,"OrgChart");var qt=yt;function It(e){return qt[e]??e}u(It,"roleLabel");export{oe as OrgChart};
|
|
1
|
+
var pt=Object.defineProperty;var u=(e,a)=>pt(e,"name",{value:a,configurable:!0});import{i as ot}from"./rolldown-runtime-ZpX3ckPj.js";import{En as yt,Fr as bt,Lr as vt,U as wt,Y as K,_ as Ct,nr as Q}from"./createLucideIcon-r3v6fbGz.js";import{o as jt,t as V}from"./router-Bb8nJWyv.js";import{t as Mt}from"./AgentAvatar-PT82VwmU.js";import{t as J}from"./agents-BlSzFh-1.js";import{r as Nt,t as tt}from"./EmptyState-DPcc0zYh.js";import{k as kt,t as et}from"./button-CAPbz11u.js";import{n as Pt,t as Dt}from"./useHiddenSettings-2JpxuJV7.js";import{t as Yt}from"./card-dmVcp3AX.js";import{t as Zt}from"./PageSkeleton-DHjTwRT3.js";import{Dn as rt,On as Et,Pn as Tt,Yt as _t,en as Xt,hn as zt}from"./index-DhwreIEp.js";var o=ot(vt(),1),n=ot(bt(),1),N=200,W=100,X=32,$t=80,L=60,Wt=.2,Lt=2,R=6;function Z(e){if(e.reports.length===0)return N;const a=e.reports.reduce((i,f)=>i+Z(f),0),d=(e.reports.length-1)*X;return Math.max(N,a+d)}u(Z,"subtreeWidth");function at(e,a,d){const i=Z(e),f=[];if(e.reports.length>0){const C=e.reports.reduce((k,P)=>k+Z(P),0),S=(e.reports.length-1)*X;let j=a+(i-C-S)/2;for(const k of e.reports){const P=Z(k);f.push(at(k,j,d+W+$t)),j+=P+X}}return{id:e.id,name:e.name,role:e.role,status:e.status,x:a+(i-N)/2,y:d,children:f}}u(at,"layoutTree");function St(e){if(e.length===0)return[];e.reduce((f,C)=>f+Z(C),0),(e.length-1)*X;let a=L;const d=L,i=[];for(const f of e){const C=Z(f);i.push(at(f,a,d)),a+=C+X}return i}u(St,"layoutForest");function Ht(e){const a=[];function d(i){a.push(i),i.children.forEach(d)}return u(d,"walk"),e.forEach(d),a}u(Ht,"flattenLayout");function Rt(e){const a=[];function d(i){for(const f of i.children)a.push({parent:i,child:f}),d(f)}return u(d,"walk"),e.forEach(d),a}u(Rt,"collectEdges");function A(e){return Math.min(Math.max(e,Wt),Lt)}u(A,"clampZoom");function At(e){return{x:e.clientX,y:e.clientY}}u(At,"touchPoint");function nt(e,a){const d=e.clientX-a.clientX,i=e.clientY-a.clientY;return Math.hypot(d,i)}u(nt,"touchDistance");function st(e,a,d){const i=d.getBoundingClientRect();return{x:(e.clientX+a.clientX)/2-i.left,y:(e.clientY+a.clientY)/2-i.top}}u(st,"touchCenter");var Ot={running:"var(--hex-22d3ee)",active:"var(--hex-4ade80)",paused:"var(--hex-facc15)",idle:"var(--hex-facc15)",error:"var(--hex-f87171)",terminated:"var(--hex-a3a3a3)"},Bt="var(--hex-a3a3a3)";function oe(){const{selectedCompanyId:e}=wt(),{setBreadcrumbs:a}=Nt(),d=jt(),i=!!Xt(),{hidden:f}=Dt(),C=!i&&!f.has("company.import"),S=!f.has("company.export"),{data:j,isLoading:k}=Q({queryKey:K.org(e),queryFn:u(()=>J.org(e),"queryFn"),enabled:!!e}),{data:P}=Q({queryKey:K.agents.list(e),queryFn:u(()=>J.list(e),"queryFn"),enabled:!!e}),ct=(0,o.useMemo)(()=>{const t=new Map;for(const r of P??[])t.set(r.id,r);return t},[P]);(0,o.useEffect)(()=>{a([{label:"Org Chart"}])},[a]);const z=(0,o.useMemo)(()=>St(j??[]),[j]),D=(0,o.useMemo)(()=>Ht(z),[z]),it=(0,o.useMemo)(()=>Rt(z),[z]),v=(0,o.useMemo)(()=>{if(D.length===0)return{width:800,height:600};let t=0,r=0;for(const s of D)t=Math.max(t,s.x+N),r=Math.max(r,s.y+W);return{width:t+L,height:r+L}},[D]),p=(0,o.useRef)(null),[l,M]=(0,o.useState)({x:0,y:0}),[h,E]=(0,o.useState)(1),[H,O]=(0,o.useState)(!1),T=(0,o.useRef)({x:0,y:0,panX:0,panY:0}),m=(0,o.useRef)({mode:null,startPoint:{x:0,y:0},startPan:{x:0,y:0},startZoom:1,startDistance:0,startCenter:{x:0,y:0},moved:!1}),$=(0,o.useRef)(!1),Y=(0,o.useRef)(null);(0,o.useEffect)(()=>()=>{Y.current!==null&&window.clearTimeout(Y.current)},[]);const B=(0,o.useRef)(!1);(0,o.useEffect)(()=>{if(B.current||D.length===0||!p.current)return;B.current=!0;const t=p.current,r=t.clientWidth,s=t.clientHeight,c=(r-40)/v.width,x=(s-40)/v.height,g=Math.min(c,x,1),y=v.width*g,w=v.height*g;E(g),M({x:(r-y)/2,y:(s-w)/2})},[D,v]);const lt=(0,o.useCallback)(t=>{t.button===0&&(t.target.closest("[data-org-card]")||(O(!0),T.current={x:t.clientX,y:t.clientY,panX:l.x,panY:l.y}))},[l]),ut=(0,o.useCallback)(t=>{if(!H)return;const r=t.clientX-T.current.x,s=t.clientY-T.current.y;M({x:T.current.panX+r,y:T.current.panY+s})},[H]),q=(0,o.useCallback)(()=>{O(!1)},[]),dt=(0,o.useCallback)(t=>{t.preventDefault();const r=p.current;if(!r)return;const s=r.getBoundingClientRect(),c=t.clientX-s.left,x=t.clientY-s.top,g=t.deltaY<0?1.1:.9,y=A(h*g),w=y/h;M({x:c-w*(c-l.x),y:x-w*(x-l.y)}),E(y)},[h,l]),I=(0,o.useCallback)((t,r)=>{const s=A(t),c=s/h;M({x:r.x-c*(r.x-l.x),y:r.y-c*(r.y-l.y)}),E(s)},[h,l]),ht=(0,o.useCallback)(()=>{if(!p.current)return;const t=p.current.clientWidth,r=p.current.clientHeight,s=(t-40)/v.width,c=(r-40)/v.height,x=Math.min(s,c,1),g=v.width*x,y=v.height*x;E(x),M({x:(t-g)/2,y:(r-y)/2})},[v]),mt=(0,o.useCallback)(t=>{if(t.touches.length>=2&&p.current){const[s,c]=[t.touches[0],t.touches[1]];m.current={mode:"pinch",startPoint:{x:0,y:0},startPan:l,startZoom:h,startDistance:nt(s,c),startCenter:st(s,c,p.current),moved:!1};return}const r=t.touches[0];r&&(m.current={mode:"pan",startPoint:At(r),startPan:l,startZoom:h,startDistance:0,startCenter:{x:0,y:0},moved:!1})},[l,h]),ft=(0,o.useCallback)(t=>{const r=p.current;if(!r||!m.current.mode)return;if(t.touches.length>=2){const[g,y]=[t.touches[0],t.touches[1]],w=nt(g,y),_=st(g,y,r);if(m.current.mode!=="pinch"||m.current.startDistance===0){m.current={mode:"pinch",startPoint:{x:0,y:0},startPan:l,startZoom:h,startDistance:w,startCenter:_,moved:!1};return}const b=m.current,U=A(b.startZoom*(w/b.startDistance)),G=U/b.startZoom,xt=_.x-b.startCenter.x,gt=_.y-b.startCenter.y;b.moved=b.moved||Math.abs(w-b.startDistance)>R||Math.hypot(xt,gt)>R,E(U),M({x:_.x-G*(b.startCenter.x-b.startPan.x),y:_.y-G*(b.startCenter.y-b.startPan.y)});return}const s=t.touches[0];if(!s||m.current.mode!=="pan")return;const c=s.clientX-m.current.startPoint.x,x=s.clientY-m.current.startPoint.y;m.current.moved=m.current.moved||Math.hypot(c,x)>R,M({x:m.current.startPan.x+c,y:m.current.startPan.y+x})},[l,h]),F=(0,o.useCallback)(()=>{m.current.moved&&($.current=!0,Y.current!==null&&window.clearTimeout(Y.current),Y.current=window.setTimeout(()=>{$.current=!1,Y.current=null},400)),m.current={mode:null,startPoint:{x:0,y:0},startPan:l,startZoom:h,startDistance:0,startCenter:{x:0,y:0},moved:!1}},[l,h]);return e?k?(0,n.jsx)(Zt,{variant:"org-chart"}):j&&j.length===0?(0,n.jsx)(tt,{icon:rt,message:"No organizational hierarchy defined."}):(0,n.jsxs)("div",{className:"flex h-(--sz-calc-38) min-h-(--sz-420px) flex-col md:h-full md:min-h-0",children:[(0,n.jsxs)("div",{className:"mb-2 flex shrink-0 flex-wrap items-center justify-start gap-2",children:[C&&(0,n.jsx)(V,{to:"/company/import",children:(0,n.jsxs)(et,{variant:"outline",size:"sm",children:[(0,n.jsx)(zt,{className:"mr-1.5 h-3.5 w-3.5"}),"Import company"]})}),S&&(0,n.jsx)(V,{to:"/company/export",children:(0,n.jsxs)(et,{variant:"outline",size:"sm",children:[(0,n.jsx)(Tt,{className:"mr-1.5 h-3.5 w-3.5"}),"Export company"]})})]}),(0,n.jsxs)("div",{ref:p,"data-testid":"org-chart-viewport",className:"w-full flex-1 min-h-0 overflow-hidden relative bg-muted/20 border border-border rounded-lg",style:{cursor:H?"grabbing":"grab",touchAction:"none",overscrollBehavior:"contain"},onMouseDown:lt,onMouseMove:ut,onMouseUp:q,onMouseLeave:q,onWheel:dt,onTouchStart:mt,onTouchMove:ft,onTouchEnd:F,onTouchCancel:F,children:[(0,n.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1.5",children:[(0,n.jsx)("button",{className:"flex size-9 items-center justify-center rounded border border-border bg-background text-sm transition-colors hover:bg-accent sm:size-7",onClick:u(()=>{const t=p.current;t&&I(h*1.2,{x:t.clientWidth/2,y:t.clientHeight/2})},"onClick"),title:"Zoom in","aria-label":"Zoom in",children:(0,n.jsx)(kt,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"})}),(0,n.jsx)("button",{className:"flex size-9 items-center justify-center rounded border border-border bg-background text-sm transition-colors hover:bg-accent sm:size-7",onClick:u(()=>{const t=p.current;t&&I(h*.8,{x:t.clientWidth/2,y:t.clientHeight/2})},"onClick"),title:"Zoom out","aria-label":"Zoom out",children:(0,n.jsx)(Pt,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"})}),(0,n.jsx)("button",{className:"flex size-9 items-center justify-center rounded border border-border bg-background text-(length:--text-nano) transition-colors hover:bg-accent sm:size-7",onClick:ht,title:"Fit to screen","aria-label":"Fit chart to screen",children:(0,n.jsx)(Et,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"})})]}),(0,n.jsx)("svg",{className:"absolute inset-0 pointer-events-none",style:{width:"100%",height:"100%"},children:(0,n.jsx)("g",{transform:`translate(${l.x}, ${l.y}) scale(${h})`,children:it.map(({parent:t,child:r})=>{const s=t.x+N/2,c=t.y+W,x=r.x+N/2,g=r.y,y=(c+g)/2;return(0,n.jsx)("path",{d:`M ${s} ${c} L ${s} ${y} L ${x} ${y} L ${x} ${g}`,fill:"none",stroke:"var(--border)",strokeWidth:1.5},`${t.id}-${r.id}`)})})}),(0,n.jsx)("div",{"data-testid":"org-chart-card-layer",className:"absolute inset-0",style:{transform:`translate(${l.x}px, ${l.y}px) scale(${h})`,transformOrigin:"0 0"},children:D.map(t=>{const r=ct.get(t.id),s=Ot[t.status]??Bt;return(0,n.jsx)(Yt,{"data-org-card":!0,className:"block absolute py-0 hover:shadow-md hover:border-foreground/20 transition-(--tp-box-shadow-border-color) duration-150 cursor-pointer select-none",style:{left:t.x,top:t.y,width:N,minHeight:W},onClick:u(()=>d(r?Ct(r):`/agents/${t.id}`),"onClick"),onClickCapture:u(c=>{$.current&&($.current=!1,c.preventDefault(),c.stopPropagation())},"onClickCapture"),children:(0,n.jsxs)("div",{className:"flex items-center px-4 py-3 gap-3",children:[(0,n.jsxs)("div",{className:"relative shrink-0",children:[(0,n.jsx)("div",{className:"w-9 h-9 rounded-full bg-muted flex items-center justify-center",children:(0,n.jsx)(Mt,{agent:r,size:16,className:"h-4.5 w-4.5 text-foreground/70"})}),(0,n.jsx)("span",{className:"absolute -bottom-0.5 -right-0.5 h-3 w-3 rounded-full border-2 border-card",style:{backgroundColor:s}})]}),(0,n.jsxs)("div",{className:"flex flex-col items-start min-w-0 flex-1",children:[(0,n.jsx)("span",{className:"text-sm font-semibold text-foreground leading-tight",children:t.name}),(0,n.jsx)("span",{className:"text-(length:--text-micro) text-muted-foreground leading-tight mt-0.5",children:r?.title??It(t.role)}),r&&(0,n.jsx)("span",{className:"text-(length:--text-nano) text-muted-foreground/60 font-mono leading-tight mt-1",children:_t(r.adapterType)}),r&&r.capabilities&&(0,n.jsx)("span",{className:"text-(length:--text-nano) text-muted-foreground/80 leading-tight mt-1 line-clamp-2",children:r.capabilities})]})]})},t.id)})})]})]}):(0,n.jsx)(tt,{icon:rt,message:"Select a company to view the org chart."})}u(oe,"OrgChart");var qt=yt;function It(e){return qt[e]??e}u(It,"roleLabel");export{oe as OrgChart};
|
package/ui-dist/assets/{RoutineDetail.production-WBEY9g9e.js → RoutineDetail.production-DcR87XCo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ot=Object.defineProperty;var i=(s,a)=>ot(s,"name",{value:a,configurable:!0});import{i as Le}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as ct,Lr as lt,Pr as dt,S as ut,U as mt,Y as p,Yn as pt,nr as L,tr as U}from"./createLucideIcon-r3v6fbGz.js";import{Z as Ee,o as ht,r as oe,st as gt}from"./router-DyZkoSkG.js";import{Ct as xt,bt as yt,lr as vt,t as ft,vt as Oe,wt as bt,xt as jt,yt as wt}from"./RoutineRunVariablesDialog-IRX4TLng.js";import{Q as Nt}from"./mention-chips-DXumPrOR.js";import{s as kt,t as St}from"./zap-P-cXfK28.js";import{l as T,t as De}from"./MarkdownEditor-Pip4OXiJ.js";import{v as It}from"./sheet-DeCxNmfl.js";import{t as _e}from"./AgentAvatar-PT82VwmU.js";import{k as Ct}from"./checkbox-CmMbs2PZ.js";import{_ as At,s as Pt,t as O}from"./label-C2ddSDJj.js";import{t as Rt}from"./agents-BlSzFh-1.js";import{g as Tt}from"./StatusIcon-BuUYMqqU.js";import{r as Et,t as te}from"./EmptyState-DPcc0zYh.js";import{c as de,i as ue,n as me,s as pe,t as he}from"./select-mS22eY6T.js";import{r as Ot,t as Dt}from"./save-DUnPDT6R.js";import{k as _t,t as E}from"./button-CAPbz11u.js";import{n as Mt,t as qt}from"./clipboard-CYJ5Q78m.js";import{t as Ft}from"./heartbeats-CK_aXmx5.js";import{t as xe}from"./badge-Cf7ihb3q.js";import{t as V}from"./input-DpsS9it-.js";import{i as Kt,o as Lt}from"./company-members-BcZm1g8Q.js";import{r as Ut,t as Wt}from"./card-dmVcp3AX.js";import{t as $t}from"./PageSkeleton-DHjTwRT3.js";import{A as Vt,B as Gt,Cn as Qt,F as zt,G as Q,H as Bt,Ht,I as Jt,K as Ue,L as Yt,M as We,N as Zt,P as Xt,Qt as Me,R as es,Rn as ye,Tt as ts,U as qe,Un as ve,V as ss,Vn as is,Vt as ns,W as $e,Xt as X,fn as as,j as rs,k as os,pn as cs,q as ls,qt as ds,z as us}from"./index-CZl9vxyj.js";var u=Le(lt(),1);function ms(s,a,n){const c={label:a.label.trim()||null};return s.kind==="schedule"&&(c.cronExpression=a.cronExpression.trim(),c.timezone=s.timezone??n),s.kind==="webhook"&&(c.signingMode=a.signingMode,c.replayWindowSec=Number(a.replayWindowSec||"300")),c}i(ms,"buildRoutineTriggerPatch");var e=Le(ct(),1),ps=["app_webhook","bearer","hmac_sha256","github_hmac","none"],hs=new Set(["app_webhook","bearer","github_hmac","fireflies_hmac","none"]);function gs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}i(gs,"getLocalTimezone$1");function xs({trigger:s,onSave:a,onRotate:n,onDelete:c,disabled:r}){const[m,l]=(0,u.useState)({label:s.label??"",cronExpression:s.cronExpression??"",signingMode:s.signingMode??"bearer",replayWindowSec:String(s.replayWindowSec??300)});(0,u.useEffect)(()=>{l({label:s.label??"",cronExpression:s.cronExpression??"",signingMode:s.signingMode??"bearer",replayWindowSec:String(s.replayWindowSec??300)})},[s]);const k=s.kind==="schedule"?ye:s.kind==="webhook"?cs:St,I=s.kind==="schedule"?Xt(m.cronExpression):null,M=/fail|error/i.test(s.lastResult??""),C=s.lastResult?.startsWith("Created execution issue ")?"Task created":s.lastResult;return(0,e.jsxs)("form",{"aria-label":`Trigger: ${s.label??s.kind}`,className:"space-y-4 rounded-lg border border-border p-4",onSubmit:i(x=>x.preventDefault(),"onSubmit"),children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,e.jsx)(k,{className:"h-3.5 w-3.5 shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:s.label??s.kind})]}),I?(0,e.jsx)("p",{id:`cron-readable-${s.id}`,className:"text-xs text-muted-foreground",children:I}):null]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[s.lastResult?(0,e.jsx)(xe,{variant:M?"destructive":"secondary",children:C}):null,(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:s.kind==="schedule"&&s.nextRunAt?`Next: ${new Date(s.nextRunAt).toLocaleString()}`:s.kind==="webhook"?"Webhook":"API"})]})]}),s.kind==="webhook"&&s.webhookUrl&&(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{htmlFor:`webhook-url-${s.id}`,className:"text-xs",children:"Webhook URL"}),(0,e.jsx)(V,{id:`webhook-url-${s.id}`,value:s.webhookUrl,readOnly:!0,onFocus:i(x=>x.target.select(),"onFocus")}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Send a POST request with Content-Type: application/json. Keep this URL private when signing is disabled."})]}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Label"}),(0,e.jsx)(V,{value:m.label,disabled:r,onChange:i(x=>l(S=>({...S,label:x.target.value})),"onChange")})]}),s.kind==="schedule"&&(0,e.jsxs)("div",{className:"space-y-1.5 md:col-span-2",children:[(0,e.jsx)(O,{className:"text-xs",children:"Schedule"}),(0,e.jsx)(We,{value:m.cronExpression,onChange:i(x=>l(S=>({...S,cronExpression:x})),"onChange")})]}),s.kind==="webhook"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Signing mode"}),(0,e.jsxs)(he,{value:m.signingMode,onValueChange:i(x=>l(S=>({...S,signingMode:x})),"onValueChange"),disabled:r,children:[(0,e.jsx)(pe,{children:(0,e.jsx)(de,{})}),(0,e.jsx)(me,{children:ps.map(x=>(0,e.jsx)(ue,{value:x,children:x},x))})]})]}),!hs.has(m.signingMode)&&(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Replay window (seconds)"}),(0,e.jsx)(V,{value:m.replayWindowSec,disabled:r,onChange:i(x=>l(S=>({...S,replayWindowSec:x.target.value})),"onChange")})]})]})]}),!r&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,e.jsxs)(E,{variant:"ghost",size:"sm",className:"mr-auto text-muted-foreground hover:text-destructive",onClick:i(()=>c(s.id),"onClick"),children:[(0,e.jsx)(Ct,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]}),s.kind==="webhook"&&(0,e.jsxs)(E,{variant:"outline",size:"sm",onClick:i(()=>n(s.id),"onClick"),children:[(0,e.jsx)(It,{className:"mr-1.5 h-3.5 w-3.5"}),"Rotate secret"]}),(0,e.jsxs)(E,{variant:"outline",size:"sm",onClick:i(()=>a(s.id,ms(s,m,gs())),"onClick"),children:[(0,e.jsx)(Dt,{className:"mr-1.5 h-3.5 w-3.5"}),"Save trigger"]})]})]})}i(xs,"RoutineTriggerCard");var ys=[{value:"coalesce_if_active",title:"Coalesce if active",description:"Keep one follow-up run queued while an active run is still working."},{value:"always_enqueue",title:"Always enqueue",description:"Queue every trigger occurrence, even if several runs stack up."},{value:"skip_if_active",title:"Skip if active",description:"Drop overlapping trigger occurrences while the routine is already active."}],vs=[{value:"skip_missed",title:"Skip missed",description:"Ignore schedule windows that were missed while paused."},{value:"enqueue_missed_with_cap",title:"Enqueue missed with cap",description:"Catch up missed schedule windows after recovery; sub-hourly schedules are combined into one catch-up run, slower schedules replay each missed window up to a cap."}],fs=[{value:"always",title:"Run on every scheduled tick",description:"Fire on the schedule no matter what — the default behavior."},{value:"require_external_activity",title:"Skip when there's been no activity since the last run",description:"On a scheduled tick, only run if something happened since the last run that finished. Lets a watcher-style routine stay asleep while the system is settled instead of burning tokens."}],bs=[{value:"company",title:"Company-wide",description:"Any activity across the company counts as a reason to run."},{value:"project",title:"This project",description:"Only activity in the routine's project counts as a reason to run."}],js=["schedule","webhook"],ws=["app_webhook","bearer","hmac_sha256","github_hmac","none"],Ns={bearer:"Send Authorization: Bearer <secret> with each request.",hmac_sha256:"Send X-Paperclip-Timestamp and X-Paperclip-Signature: sha256=<hex>, signing timestamp + a dot + the exact JSON body.",github_hmac:"Accept GitHub-style X-Hub-Signature-256 header (HMAC over raw body, no timestamp).",app_webhook:"Accept a bearer token or an HMAC-SHA256 signature over the exact request body in X-Hub-Signature or X-Hub-Signature-256.",fireflies_hmac:"Signed webhook (legacy).",none:"No authentication — the webhook URL itself acts as a shared secret."},ks=new Set(["app_webhook","bearer","github_hmac","fireflies_hmac","none"]);function Ss({defaultDescriptionAnnotationsOpen:s=!1}={}){const{routine:a,editDraft:n,setEditDraft:c,assigneeOptions:r,projectOptions:m,recentAssigneeIds:l,recentProjectIds:k,agentById:I,projectById:M,currentAssignee:C,currentProject:x,mentionOptions:S,assigneeSelectorRef:D,projectSelectorRef:q,descriptionEditorRef:A,routineRuns:g,activity:b,saveRoutine:j,saveConflict:se,isSectionDirty:f,navigateToSection:P}=Q(),[w,_]=(0,u.useState)(s),o=a.triggers.length,z=(0,u.useMemo)(()=>{const d=a.triggers.filter(y=>y.kind==="schedule"&&y.nextRunAt).map(y=>new Date(y.nextRunAt)).sort((y,G)=>y.getTime()-G.getTime())[0];return d?d.toLocaleString():null},[a.triggers]),W=n.env?Object.keys(n.env).length:0,R=(g??[])[0]??null,B=(b??[]).slice(0,5);return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsx)("div",{className:"overflow-x-auto overscroll-x-contain",children:(0,e.jsxs)("div",{className:"inline-flex min-w-full flex-wrap items-center gap-2 text-sm text-muted-foreground sm:min-w-max sm:flex-nowrap",children:[(0,e.jsx)("span",{children:"For"}),(0,e.jsx)(Oe,{ref:D,value:n.assigneeAgentId,options:r,recentOptionIds:l,placeholder:"Responsible",noneLabel:"No responsible",searchPlaceholder:"Search responsible...",emptyMessage:"No responsible found.",onChange:i(d=>c(y=>({...y,assigneeAgentId:d})),"onChange"),onConfirm:i(()=>{n.projectId?A.current?.focus():q.current?.focus()},"onConfirm"),renderTriggerValue:i(d=>d?C?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_e,{agent:C,size:16,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:d.label})]}):(0,e.jsx)("span",{className:"truncate",children:d.label}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"Responsible"}),"renderTriggerValue"),renderOption:i(d=>{if(!d.id)return(0,e.jsx)("span",{className:"truncate",children:d.label});const y=I.get(d.id);return(0,e.jsxs)(e.Fragment,{children:[y?(0,e.jsx)(_e,{agent:y,size:16,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):null,(0,e.jsx)("span",{className:"truncate",children:d.label})]})},"renderOption")}),(0,e.jsx)("span",{children:"in"}),(0,e.jsx)(Oe,{ref:q,value:n.projectId,options:m,recentOptionIds:k,placeholder:"Project",noneLabel:"No project",searchPlaceholder:"Search projects...",emptyMessage:"No projects found.",onChange:i(d=>c(y=>({...y,projectId:d})),"onChange"),onConfirm:i(()=>A.current?.focus(),"onConfirm"),renderTriggerValue:i(d=>d&&x?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:x.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:d.label})]}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"Project"}),"renderTriggerValue"),renderOption:i(d=>{if(!d.id)return(0,e.jsx)("span",{className:"truncate",children:d.label});const y=M.get(d.id);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:y?.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:d.label})]})},"renderOption")})]})}),a.assigneeAgentId?null:(0,e.jsx)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm text-amber-900 dark:text-amber-200",children:"Default agent required. This routine can stay as a draft and still run manually, but automation stays paused until you assign a default agent."}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"flex items-center justify-end",children:a.descriptionDocument?(0,e.jsx)(ns,{issueId:a.id,docKey:"description",target:{kind:"routine",routineId:a.id,documentKey:"description"},panelOpen:w,onToggle:i(()=>_(d=>!d),"onToggle")}):null}),a.descriptionDocument?(0,e.jsx)(Ht,{issueId:a.id,doc:a.descriptionDocument,target:{kind:"routine",routineId:a.id,documentKey:"description"},bodyMarkdown:n.description,draftDirty:f("overview")||j.isPending,draftConflicted:se,historicalPreview:!1,locationHash:typeof window>"u"?"":window.location.hash,panelOpen:w,onPanelOpenChange:_,children:(0,e.jsx)(De,{ref:A,value:n.description,onChange:i(d=>c(y=>({...y,description:d})),"onChange"),placeholder:"Add instructions...",bordered:!1,contentClassName:"min-h-(--sz-120px) text-sm leading-7",mentions:S,onSubmit:i(()=>{!j.isPending&&n.title.trim()&&j.mutate()},"onSubmit")})}):(0,e.jsx)(De,{ref:A,value:n.description,onChange:i(d=>c(y=>({...y,description:d})),"onChange"),placeholder:"Add instructions...",bordered:!1,contentClassName:"min-h-(--sz-120px) text-sm leading-7",mentions:S,onSubmit:i(()=>{!j.isPending&&n.title.trim()&&j.mutate()},"onSubmit")})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(ls,{}),(0,e.jsx)(Ue,{title:n.title,description:n.description,value:n.variables,onChange:i(d=>c(y=>({...y,variables:d})),"onChange")})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,e.jsx)(ce,{icon:ye,label:"Triggers",value:o===0?"None":`${o} active`,hint:z?`Next fire ${z}`:"No schedule",to:i(()=>P("triggers"),"to"),ariaLabel:`${o} triggers. Open triggers.`}),(0,e.jsx)(ce,{icon:Mt,label:"Secrets",value:W===0?"None":`${W} bound`,hint:"Manage bound secrets",to:i(()=>P("secrets"),"to"),ariaLabel:`${W} secrets bound. Open secrets.`}),(0,e.jsx)(ce,{icon:At,label:"Last run",value:R?R.status.replaceAll("_"," "):"No runs",hint:R?Ee(R.triggeredAt):"Trigger a run",to:i(()=>P("runs"),"to"),ariaLabel:R?`Last run ${R.status}. Open runs.`:"No runs. Open runs."})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Recent activity"}),B.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No activity yet."}):(0,e.jsxs)("div",{className:"divide-y divide-border/60",children:[B.map(d=>(0,e.jsxs)("div",{className:"flex items-center gap-2 py-1.5 text-xs",children:[(0,e.jsx)(xe,{variant:"outline",className:"shrink-0 font-mono",children:d.action}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:d.details&&Object.keys(d.details).length>0?Object.keys(d.details).slice(0,3).join(" · "):""}),(0,e.jsx)("span",{className:"shrink-0 text-muted-foreground/60",children:Ee(d.createdAt)})]},d.id)),(0,e.jsxs)("button",{type:"button",onClick:i(()=>P("activity"),"onClick"),className:"flex items-center gap-1 pt-2 text-xs text-muted-foreground hover:text-foreground",children:["View all activity ",(0,e.jsx)(ve,{className:"h-3 w-3"})]})]})]})]})}i(Ss,"OverviewSection");function ce({icon:s,label:a,value:n,hint:c,to:r,ariaLabel:m}){return(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":m,className:"text-left",children:(0,e.jsx)(Wt,{className:"gap-2 p-4 transition-colors hover:border-border hover:bg-accent/30",children:(0,e.jsxs)(Ut,{className:"space-y-1 p-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs uppercase tracking-wide text-muted-foreground",children:[(0,e.jsx)(s,{className:"h-3.5 w-3.5"}),a,(0,e.jsx)(ve,{className:"ml-auto h-3.5 w-3.5 text-muted-foreground/60"})]}),(0,e.jsx)("p",{className:"text-lg font-semibold",children:n}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:c})]})})})}i(ce,"SummaryCard");function Is(){const{routine:s,newTrigger:a,setNewTrigger:n,createTrigger:c,updateTrigger:r,deleteTrigger:m,rotateTrigger:l,secretMessage:k,copySecretValue:I,setSecretMessage:M}=Q(),[C,x]=(0,u.useState)(!1),[S,D]=(0,u.useState)(!0),q=(0,u.useMemo)(()=>a.kind==="schedule"?Zt(a.cronExpression):null,[a.cronExpression,a.kind]),A=c.isPending||(q?!q.valid||!S:!1);return(0,u.useEffect)(()=>{a.kind!=="schedule"&&D(!0)},[a.kind]),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:s.triggers.length===0?"No triggers yet":`${s.triggers.length} trigger${s.triggers.length===1?"":"s"}`}),(0,e.jsx)(E,{size:"sm",variant:C?"secondary":"default",onClick:i(()=>x(g=>!g),"onClick"),"aria-expanded":C,children:C?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Nt,{className:"mr-1.5 h-3.5 w-3.5"}),"Cancel"]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_t,{className:"mr-1.5 h-3.5 w-3.5"}),"New trigger"]})})]}),C?(0,e.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Add trigger"}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Kind"}),(0,e.jsxs)(he,{value:a.kind,onValueChange:i(g=>n(b=>({...b,kind:g})),"onValueChange"),children:[(0,e.jsx)(pe,{children:(0,e.jsx)(de,{})}),(0,e.jsx)(me,{children:js.map(g=>(0,e.jsx)(ue,{value:g,children:g},g))})]})]}),a.kind==="schedule"&&(0,e.jsxs)("div",{className:"space-y-1.5 md:col-span-2",children:[(0,e.jsx)(O,{className:"text-xs",children:"Schedule"}),(0,e.jsx)(We,{value:a.cronExpression,onChange:i(g=>n(b=>({...b,cronExpression:g})),"onChange"),onValidityChange:D})]}),a.kind==="webhook"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Signing mode"}),(0,e.jsxs)(he,{value:a.signingMode,onValueChange:i(g=>n(b=>({...b,signingMode:g})),"onValueChange"),children:[(0,e.jsx)(pe,{children:(0,e.jsx)(de,{})}),(0,e.jsx)(me,{children:ws.map(g=>(0,e.jsx)(ue,{value:g,children:g},g))})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:Ns[a.signingMode]})]}),!ks.has(a.signingMode)&&(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Replay window (seconds)"}),(0,e.jsx)(V,{value:a.replayWindowSec,onChange:i(g=>n(b=>({...b,replayWindowSec:g.target.value})),"onChange")})]})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,e.jsx)(E,{size:"sm",variant:"ghost",onClick:i(()=>x(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(E,{size:"sm",onClick:i(()=>c.mutate(void 0,{onSuccess:i(()=>{n($e()),x(!1)},"onSuccess")}),"onClick"),disabled:A,children:c.isPending?"Adding...":"Add trigger"})]})]}):null,k?(0,e.jsxs)("div",{className:"space-y-3 rounded-lg border border-border bg-muted/20 p-4 text-sm",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"font-medium",children:k.title}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Save this now. Paperclip will not show the secret value again."})]}),(0,e.jsx)("div",{className:"space-y-3",children:k.entries.map((g,b)=>(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(V,{"aria-label":"New webhook URL",value:g.webhookUrl,readOnly:!0,className:"flex-1"}),(0,e.jsx)(E,{variant:"outline",size:"sm",onClick:i(()=>I("Webhook URL",g.webhookUrl),"onClick"),children:"URL"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(V,{"aria-label":"New webhook secret",value:g.webhookSecret,readOnly:!0,className:"flex-1"}),(0,e.jsx)(E,{variant:"outline",size:"sm",onClick:i(()=>I("Webhook secret",g.webhookSecret),"onClick"),children:"Secret"})]})]},`${g.webhookUrl}-${b}`))}),(0,e.jsx)(E,{variant:"outline",size:"sm",onClick:i(()=>M(null),"onClick"),children:"Done"})]}):null,s.triggers.length===0?(0,e.jsx)(te,{icon:ye,message:"No triggers yet.",action:"Add a trigger",onAction:i(()=>x(!0),"onAction")}):(0,e.jsx)("div",{className:"space-y-3",children:s.triggers.map(g=>(0,e.jsx)(xs,{trigger:g,onSave:i((b,j)=>r.mutate({id:b,patch:j}),"onSave"),onRotate:i(b=>l.mutate(b),"onRotate"),onDelete:i(b=>m.mutate(b),"onDelete")},g.id))})]})}i(Is,"TriggersSection");function Cs(){const{editDraft:s,setEditDraft:a,navigateToSection:n}=Q(),c=s.variables.length>0;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/20 px-4 py-3 text-xs",children:[(0,e.jsxs)("span",{className:"flex-1 text-muted-foreground",children:["Variables are auto-detected from ",(0,e.jsx)("code",{className:"font-mono",children:"{{placeholders}}"})," in the title & instructions. The variable name is read-only — rename by editing the placeholder."]}),(0,e.jsxs)(E,{variant:"secondary",size:"sm",onClick:i(()=>n("overview"),"onClick"),children:[(0,e.jsx)(Qt,{className:"mr-1.5 h-3.5 w-3.5"}),"Edit instructions"]})]}),c?(0,e.jsx)(Ue,{title:s.title,description:s.description,value:s.variables,onChange:i(r=>a(m=>({...m,variables:r})),"onChange")}):(0,e.jsx)(te,{icon:is,message:"No variables yet. Add a {{placeholder}} in the title or instructions to create one.",action:"Edit instructions",onAction:i(()=>n("overview"),"onAction")})]})}i(Cs,"VariablesSection");function As(){const{editDraft:s,setEditDraft:a,availableSecrets:n,createSecret:c}=Q(),r=(0,u.useMemo)(()=>[...n].filter(m=>m.status==="active").sort((m,l)=>{const k=(l.referenceCount??0)-(m.referenceCount??0);return k!==0?k:new Date(l.updatedAt).getTime()-new Date(m.updatedAt).getTime()}).slice(0,8),[n]);return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"rounded-md border border-border bg-muted/20 px-4 py-3 text-xs text-muted-foreground",children:["Routine secrets apply to every task this routine creates. They override matching keys in project and agent env. ",(0,e.jsx)("span",{className:"font-mono",children:"PAPERCLIP_*"})," names are reserved."]}),(0,e.jsx)(ds,{value:s.env??{},secrets:n,recentlyUsedSecrets:r,onCreateSecret:i(async(m,l)=>c.mutateAsync({name:m,value:l}),"onCreateSecret"),onChange:i(m=>a(l=>({...l,env:m??null})),"onChange")})]})}i(As,"SecretsSection");function Ps(){const{editDraft:s,setEditDraft:a,routine:n}=Q(),c=n.triggers.some(m=>m.kind==="schedule"),r=s.activityGatePolicy==="require_external_activity";return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Concurrency"}),(0,e.jsx)(X,{ariaLabel:"Concurrency policy",value:s.concurrencyPolicy,onValueChange:i(m=>a(l=>({...l,concurrencyPolicy:m})),"onValueChange"),options:ys})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Catch-up"}),(0,e.jsx)(X,{ariaLabel:"Catch-up policy",value:s.catchUpPolicy,onValueChange:i(m=>a(l=>({...l,catchUpPolicy:m})),"onValueChange"),options:vs})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Advanced run policy"}),(0,e.jsx)(X,{ariaLabel:"Advanced run policy",value:s.activityGatePolicy,onValueChange:i(m=>a(l=>({...l,activityGatePolicy:m})),"onValueChange"),options:fs,disabled:!c}),c?r?(0,e.jsxs)("div",{className:"space-y-2 rounded-lg border border-border p-3",children:[(0,e.jsx)(O,{className:"text-xs font-medium",children:"Activity scope"}),(0,e.jsx)(X,{ariaLabel:"Activity gate scope",value:s.activityGateScope,onValueChange:i(m=>a(l=>({...l,activityGateScope:m})),"onValueChange"),options:bs})]}):null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add a schedule trigger to gate runs on activity. Webhook, manual, and API fires always run."})]}),(0,e.jsx)(Ts,{triggers:n.triggers,concurrencyPolicy:s.concurrencyPolicy})]})}i(Ps,"DeliverySection");var Rs={queued:"text-emerald-600 dark:text-emerald-400",coalesced:"text-amber-600 dark:text-amber-400",skipped:"text-muted-foreground"};function Ts({triggers:s,concurrencyPolicy:a}){const n=(0,u.useMemo)(()=>{const c=s.filter(r=>r.kind==="schedule"&&r.enabled&&r.cronExpression).map(r=>({trigger:r,fires:zt(r.cronExpression,5,{timeZone:r.timezone??"UTC"})})).filter(r=>r.fires.length>0).sort((r,m)=>r.fires[0].getTime()-m.fires[0].getTime())[0];return c?{timeZone:c.trigger.timezone??"UTC",entries:Jt(c.fires,a)}:null},[s,a]);return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Next 5 fires"}),n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"space-y-1.5 rounded-lg border border-border p-3 font-mono text-xs",children:n.entries.map((c,r)=>(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,e.jsx)("span",{className:"tabular-nums",children:Es(c.at,n.timeZone)}),(0,e.jsx)(ve,{className:"h-3 w-3 shrink-0 text-muted-foreground/50"}),(0,e.jsx)("span",{className:ut("font-medium",Rs[c.disposition]),children:c.label}),c.note?(0,e.jsxs)("span",{className:"truncate text-muted-foreground/60",children:["(",c.note,")"]}):null]},r))}),(0,e.jsxs)("p",{className:"text-(length:--text-micro) text-muted-foreground/60",children:["Preview assumes the previous run is still in flight when the next fires. Times shown in"," ",n.timeZone,"."]})]}):(0,e.jsx)("p",{className:"rounded-lg border border-dashed border-border p-3 text-xs text-muted-foreground",children:"No enabled schedule trigger to preview. Add a schedule in Triggers to see how this policy treats upcoming fires."})]})}i(Ts,"NextFiresPreview");function Es(s,a){try{return new Intl.DateTimeFormat(void 0,{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(s).replace(",","")}catch{return s.toISOString()}}i(Es,"formatFireTime");var ge="paperclip.routineLastSection";function Os(s){return s.filter(a=>!a.archivedAt).map(a=>({id:a.id,label:a.name,searchText:a.description??""}))}i(Os,"buildRoutineProjectOptions");var Ds={overview:"Overview",triggers:"Triggers",variables:"Variables",secrets:"Secrets",delivery:"Delivery",runs:"Runs",activity:"Activity",history:"History"};function ee(s){return s!=null&&ss.includes(s)}i(ee,"isRoutineSection");function _s(s){try{const a=localStorage.getItem(ge);if(!a)return null;const n=JSON.parse(a)[s];return ee(n)?n:null}catch{return null}}i(_s,"readLastSection");function le(s,a){try{const n=localStorage.getItem(ge),c=n?JSON.parse(n):{};c[s]=a,localStorage.setItem(ge,JSON.stringify(c))}catch{}}i(le,"writeLastSection");var Fe={triggers:"triggers",runs:"runs",activity:"activity",secrets:"secrets",history:"history"};function Ke(s){s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)}i(Ke,"autoResizeTextarea");function Ms(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}i(Ms,"getLocalTimezone");function qs(s){return{...s,description:s.description.trim()||null,projectId:s.projectId||null,assigneeAgentId:s.assigneeAgentId||null,env:s.env&&Object.keys(s.env).length>0?s.env:null}}i(qs,"buildRoutineMutationPayload");function di(){const{routineId:s,section:a}=gt(),{selectedCompanyId:n}=mt(),{setBreadcrumbs:c}=Et(),r=dt(),m=ht(),{pushToast:l}=as(),k=(0,u.useRef)(null),I=(0,u.useRef)(null),M=(0,u.useRef)(null),C=(0,u.useRef)(null),x=(0,u.useRef)(null),[S,D]=(0,u.useState)(null),[q,A]=(0,u.useState)(!1),[g,b]=(0,u.useState)(!1),[j,se]=(0,u.useState)($e),[f,P]=(0,u.useState)({title:"",description:"",projectId:"",assigneeAgentId:"",priority:"medium",concurrencyPolicy:"coalesce_if_active",catchUpPolicy:"skip_missed",activityGatePolicy:"always",activityGateScope:"company",variables:[],env:null}),w=ee(a)?a:"overview",_=(0,u.useCallback)((t,h)=>{s&&(le(s,t),m(`/routines/${s}/${t}`,{replace:h?.replace??!0}))},[m,s]),{data:o,isLoading:z,error:W}=L({queryKey:p.routines.detail(s),queryFn:i(()=>T.get(s),"queryFn"),enabled:!!s}),R=o?.activeIssue?.id,{data:B}=L({queryKey:p.issues.liveRuns(R),queryFn:i(()=>Ft.liveRunsForIssue(R),"queryFn"),enabled:!!R,refetchInterval:3e3}),d=(B??[]).length>0,{data:y}=L({queryKey:p.routines.runs(s),queryFn:i(()=>T.listRuns(s),"queryFn"),enabled:!!s,refetchInterval:d?3e3:!1}),G=(0,u.useMemo)(()=>({triggerIds:o?.triggers.map(t=>t.id)??[],runIds:y?.map(t=>t.id)??[]}),[o?.triggers,y]),{data:Ve}=L({queryKey:[...p.routines.activity(n,s),G.triggerIds.join(","),G.runIds.join(",")],queryFn:i(()=>T.activity(n,s,G),"queryFn"),enabled:!!n&&!!s&&!!o}),{data:F}=L({queryKey:p.agents.list(n),queryFn:i(()=>Rt.list(n),"queryFn"),enabled:!!n}),{data:K}=L({queryKey:p.projects.list(n,{includeArchived:!0}),queryFn:i(()=>Tt.list(n,{includeArchived:!0}),"queryFn"),enabled:!!n}),{data:fe}=L({queryKey:p.access.companyUserDirectory(n),queryFn:i(()=>Lt.listUserDirectory(n),"queryFn"),enabled:!!n}),{data:Ge=[]}=L({queryKey:n?p.secrets.list(n):["secrets","none"],queryFn:i(()=>Me.list(n),"queryFn"),enabled:!!n}),Qe=U({mutationFn:i(t=>{if(!n)throw new Error("Select a company to create secrets");return Me.create(n,t)},"mutationFn"),onSuccess:i(()=>{n&&r.invalidateQueries({queryKey:p.secrets.list(n)})},"onSuccess")}),v=(0,u.useMemo)(()=>o?{title:o.title,description:o.description??"",projectId:o.projectId??"",assigneeAgentId:o.assigneeAgentId??"",priority:o.priority,concurrencyPolicy:o.concurrencyPolicy,catchUpPolicy:o.catchUpPolicy,activityGatePolicy:o.activityGatePolicy,activityGateScope:o.activityGateScope,variables:o.variables,env:o.env??null}:null,[o]),H=(0,u.useMemo)(()=>{if(!v)return[];const t=[];return f.title!==v.title&&t.push({key:"title",label:"the title"}),f.description!==v.description&&t.push({key:"description",label:"the description"}),f.projectId!==v.projectId&&t.push({key:"projectId",label:"the project"}),f.assigneeAgentId!==v.assigneeAgentId&&t.push({key:"assigneeAgentId",label:"the default agent"}),f.priority!==v.priority&&t.push({key:"priority",label:"the priority"}),f.concurrencyPolicy!==v.concurrencyPolicy&&t.push({key:"concurrencyPolicy",label:"the concurrency policy"}),f.catchUpPolicy!==v.catchUpPolicy&&t.push({key:"catchUpPolicy",label:"the catch-up policy"}),f.activityGatePolicy!==v.activityGatePolicy&&t.push({key:"activityGatePolicy",label:"the advanced run policy"}),f.activityGateScope!==v.activityGateScope&&t.push({key:"activityGateScope",label:"the activity gate scope"}),JSON.stringify(f.variables)!==JSON.stringify(v.variables)&&t.push({key:"variables",label:"the variables"}),JSON.stringify(f.env??null)!==JSON.stringify(v.env??null)&&t.push({key:"env",label:"the secrets"}),t},[f,v]),ie=H.length>0,J=(0,u.useCallback)(t=>{const h=qe[t];return h?H.filter(N=>h.includes(N.key)):[]},[H]),ne=(0,u.useCallback)(t=>J(t).length>0,[J]),be=(0,u.useCallback)(t=>{if(!v)return;const h=qe[t];h&&P(N=>{const Re={...N};for(const Te of h)Re[Te]=v[Te];return Re})},[v]);(0,u.useEffect)(()=>{o&&(c([{label:"Routines",href:"/routines"},{label:o.title}]),v&&(k.current!==o.id||!ie)&&(P(v),k.current=o.id))},[o,v,ie,c]),(0,u.useEffect)(()=>{Ke(I.current)},[f.title,o?.id]),(0,u.useEffect)(()=>{s&&ee(a)&&le(s,a)},[s,a]);const ze=(0,u.useCallback)(async(t,h)=>{try{await qt(h),l({title:`${t} copied`,tone:"success"})}catch(N){l({title:`Failed to copy ${t.toLowerCase()}`,body:N instanceof Error?N.message:"Clipboard access was denied.",tone:"error"})}},[l]),Y=U({mutationFn:i(()=>{const t=qs(f),h=o?.latestRevisionId??null;return T.update(s,{...t,...h?{baseRevisionId:h}:{}})},"mutationFn"),onSuccess:i(async()=>{A(!1),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)}),r.invalidateQueries({queryKey:p.routines.revisions(s)})])},"onSuccess"),onError:i(t=>{if(t instanceof pt&&t.status===409){A(!0),l({title:"Routine changed",body:"Someone else updated this routine. Reload to see the latest revision.",tone:"warn"});return}l({title:"Failed to save routine",body:t instanceof Error?t.message:"Paperclip could not save the routine.",tone:"error"})},"onError")}),Z=U({mutationFn:i(t=>T.run(s,{...t?.variables&&Object.keys(t.variables).length>0?{variables:t.variables}:{},...t?.assigneeAgentId!==void 0?{assigneeAgentId:t.assigneeAgentId}:{},...t?.projectId!==void 0?{projectId:t.projectId}:{},...t?.executionWorkspaceId!==void 0?{executionWorkspaceId:t.executionWorkspaceId}:{},...t?.executionWorkspacePreference!==void 0?{executionWorkspacePreference:t.executionWorkspacePreference}:{},...t?.executionWorkspaceSettings!==void 0?{executionWorkspaceSettings:t.executionWorkspaceSettings}:{}}),"mutationFn"),onSuccess:i(async()=>{l({title:"Routine run started",tone:"success"}),b(!1),_("runs"),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.runs(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Routine run failed",body:t instanceof Error?t.message:"Paperclip could not start the routine run.",tone:"error"})},"onError")}),je=U({mutationFn:i(t=>T.update(s,{status:t}),"mutationFn"),onSuccess:i(async(t,h)=>{l({title:"Routine saved",body:h==="paused"?"Automation paused.":"Automation enabled.",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to update routine",body:t instanceof Error?t.message:"Paperclip could not update the routine.",tone:"error"})},"onError")}),Be=U({mutationFn:i(async()=>{const t=(o?.triggers??[]).filter(N=>N.kind===j.kind).length,h=t>0?`${j.kind}-${t+1}`:j.kind;return T.createTrigger(s,{kind:j.kind,label:h,...j.kind==="schedule"?{cronExpression:j.cronExpression.trim(),timezone:Ms()}:{},...j.kind==="webhook"?{signingMode:j.signingMode,replayWindowSec:Number(j.replayWindowSec||"300")}:{}})},"mutationFn"),onSuccess:i(async t=>{t.secretMaterial?D({title:"Webhook trigger created",entries:[{webhookUrl:t.secretMaterial.webhookUrl,webhookSecret:t.secretMaterial.webhookSecret}]}):l({title:"Trigger added",body:"The routine schedule was saved.",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to add trigger",body:t instanceof Error?t.message:"Paperclip could not create the trigger.",tone:"error"})},"onError")}),He=U({mutationFn:i(({id:t,patch:h})=>T.updateTrigger(t,h),"mutationFn"),onSuccess:i(async()=>{l({title:"Trigger saved",body:"The routine cadence update was saved.",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to update trigger",body:t instanceof Error?t.message:"Paperclip could not update the trigger.",tone:"error"})},"onError")}),Je=U({mutationFn:i(t=>T.deleteTrigger(t),"mutationFn"),onSuccess:i(async()=>{l({title:"Trigger deleted",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to delete trigger",body:t instanceof Error?t.message:"Paperclip could not delete the trigger.",tone:"error"})},"onError")}),Ye=U({mutationFn:i(t=>T.rotateTriggerSecret(t),"mutationFn"),onSuccess:i(async t=>{D({title:"Webhook secret rotated",entries:[{webhookUrl:t.secretMaterial.webhookUrl,webhookSecret:t.secretMaterial.webhookSecret}]}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to rotate webhook secret",body:t instanceof Error?t.message:"Paperclip could not rotate the webhook secret.",tone:"error"})},"onError")}),we=(0,u.useMemo)(()=>new Map((F??[]).map(t=>[t.id,t])),[F]),Ne=(0,u.useMemo)(()=>new Map((K??[]).map(t=>[t.id,t])),[K]),ae=(0,u.useMemo)(()=>jt(),[o?.id]),Ze=(0,u.useMemo)(()=>wt(),[o?.id]),Xe=(0,u.useMemo)(()=>xt((F??[]).filter(t=>t.status!=="terminated"),ae).map(t=>({id:t.id,label:t.name,searchText:`${t.name} ${t.role} ${t.title??""}`})),[F,ae]),et=(0,u.useMemo)(()=>Os(K??[]),[K]),tt=(0,u.useMemo)(()=>Kt({agents:F,projects:(K??[]).filter(t=>!t.archivedAt),members:fe?.users}),[F,fe?.users,K]),st=(0,u.useCallback)(t=>{P(h=>{const N=typeof t=="function"?t(h):t;return N.assigneeAgentId&&N.assigneeAgentId!==h.assigneeAgentId&&bt(N.assigneeAgentId),N.projectId&&N.projectId!==h.projectId&&yt(N.projectId),N})},[]),it=f.assigneeAgentId?we.get(f.assigneeAgentId)??null:null,nt=f.projectId?Ne.get(f.projectId)??null:null,ke=(0,u.useCallback)(()=>{A(!1),v&&P(v),r.invalidateQueries({queryKey:p.routines.detail(s)})},[r,v,s]),at=(0,u.useCallback)(t=>{t.secretMaterials.length>0&&(_("triggers"),D({title:t.secretMaterials.length===1?"Webhook trigger restored":`${t.secretMaterials.length} webhook triggers restored`,entries:t.secretMaterials.map(h=>({webhookUrl:h.webhookUrl,webhookSecret:h.webhookSecret}))}))},[_]),rt=(0,u.useCallback)(t=>{A(!1),r.setQueryData(p.routines.detail(s),h=>h&&{...h,...t.routine,latestRevisionId:t.revision.id,latestRevisionNumber:t.revision.revisionNumber}),P({title:t.routine.title,description:t.routine.description??"",projectId:t.routine.projectId??"",assigneeAgentId:t.routine.assigneeAgentId??"",priority:t.routine.priority,concurrencyPolicy:t.routine.concurrencyPolicy,catchUpPolicy:t.routine.catchUpPolicy,activityGatePolicy:t.routine.activityGatePolicy,activityGateScope:t.routine.activityGateScope,variables:t.routine.variables,env:t.routine.env??null}),k.current=t.routine.id},[r,s]);if(!n)return(0,e.jsx)(te,{icon:vt,message:"Select a company to view routines."});const re=new URLSearchParams(window.location.search).get("tab");if(s&&re&&Fe[re])return(0,e.jsx)(oe,{to:`/routines/${s}/${Fe[re]}`,replace:!0});if(s&&!a){const t=_s(s)??"overview";return(0,e.jsx)(oe,{to:`/routines/${s}/${t}`,replace:!0})}if(s&&a&&!ee(a))return(0,e.jsx)(oe,{to:`/routines/${s}/overview`,replace:!0});if(z)return(0,e.jsx)($t,{variant:"issues-list"});if(W||!o||!v)return(0,e.jsx)(te,{icon:Ot,message:W instanceof Error?W.message:"We couldn't load this routine."});const $=o.status==="active",Se=je.isPending||o.status==="archived",Ie=o.status==="archived"?"Archived":o.assigneeAgentId?$?"Active":"Paused":"Draft",Ce=o.status==="archived"?"text-muted-foreground":$?"text-emerald-400":"text-muted-foreground",Ae={routine:o,routineId:s,companyId:o.companyId,editDraft:f,setEditDraft:st,routineDefaults:v,dirtyFields:H,isEditDirty:ie,sectionDirtyFields:J,isSectionDirty:ne,discardSection:be,saveRoutine:Y,saveConflict:q,reloadLatest:ke,automationEnabled:$,automationLabel:Ie,automationLabelClassName:Ce,automationToggleDisabled:Se,onToggleAutomation:i(()=>{if(!$&&!o.assigneeAgentId){l({title:"Default agent required",body:"Set a default agent before enabling routine automation.",tone:"warn"});return}je.mutate($?"paused":"active")},"onToggleAutomation"),onOpenRunDialog:i(()=>b(!0),"onOpenRunDialog"),runRoutinePending:Z.isPending,newTrigger:j,setNewTrigger:se,createTrigger:Be,updateTrigger:He,deleteTrigger:Je,rotateTrigger:Ye,secretMessage:S,setSecretMessage:D,copySecretValue:ze,availableSecrets:Ge,createSecret:Qe,agents:F??[],projects:K??[],agentById:we,projectById:Ne,assigneeOptions:Xe,projectOptions:et,recentAssigneeIds:ae,recentProjectIds:Ze,mentionOptions:tt,currentAssignee:it,currentProject:nt,routineRuns:y,activity:Ve,hasLiveRun:d,activeIssueId:R,titleInputRef:I,descriptionEditorRef:M,assigneeSelectorRef:C,projectSelectorRef:x,onHistoryRestoreSecretMaterials:at,onHistoryRestored:rt,navigateToSection:_},Pe=Gt.includes(w);return(0,e.jsxs)(Bt.Provider,{value:Ae,children:[(0,e.jsx)("a",{href:"#routine-section",className:"sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-20 focus:rounded focus:bg-background focus:px-3 focus:py-1.5 focus:text-sm",children:"Skip to section"}),(0,e.jsxs)("div",{className:"-m-4 flex h-full min-h-0 flex-col overflow-hidden md:-m-6",children:[(0,e.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-6",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,e.jsx)("textarea",{ref:I,"data-autosize-title":!0,className:"min-w-0 flex-1 resize-none overflow-hidden bg-transparent text-base font-semibold leading-7 outline-none placeholder:text-muted-foreground/50",placeholder:"Routine title",rows:1,value:f.title,onChange:i(t=>{P(h=>({...h,title:t.target.value})),Ke(t.target)},"onChange"),onKeyDown:i(t=>{t.key==="Enter"&&!t.metaKey&&!t.ctrlKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),w==="overview"?M.current?.focus():_("overview"))},"onKeyDown")}),o.managedByPlugin?(0,e.jsxs)(xe,{variant:"outline",className:"hidden shrink-0 gap-1.5 text-xs text-muted-foreground sm:inline-flex",children:[(0,e.jsx)(kt,{className:"h-3 w-3"}),o.managedByPlugin.pluginDisplayName,(0,e.jsx)("span",{className:"font-mono text-(length:--text-nano)",children:o.managedByPlugin.resourceKey})]}):null]}),(0,e.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-3",children:[(0,e.jsx)(ts,{onClick:i(()=>b(!0),"onClick"),disabled:Z.isPending}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Pt,{size:"default",checked:$,onCheckedChange:Ae.onToggleAutomation,disabled:Se,"aria-label":$?"Pause automatic triggers":"Enable automatic triggers"}),(0,e.jsx)("span",{className:`text-sm font-medium ${Ce}`,children:Ie})]})]})]}),(0,e.jsx)(es,{activeSection:w,onNavigate:_,isSectionDirty:ne}),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,e.jsx)(us,{activeSection:w,hrefFor:i(t=>`/routines/${s}/${t}`,"hrefFor"),isSectionDirty:ne,hasLiveRun:d,onNavigate:i(t=>le(s,t),"onNavigate")}),(0,e.jsx)("main",{id:"routine-section",role:"main",className:"min-h-0 min-w-0 flex-1 overflow-y-auto px-4 pb-6 pt-10 md:px-8",children:(0,e.jsxs)("section",{"aria-labelledby":"routine-section-title",className:Pe?"mx-auto w-full max-w-3xl":"w-full",children:[(0,e.jsx)("h2",{id:"routine-section-title",className:"mb-4 text-lg font-semibold",children:Ds[w]}),w==="overview"&&(0,e.jsx)(Ss,{}),w==="triggers"&&(0,e.jsx)(Is,{}),w==="variables"&&(0,e.jsx)(Cs,{}),w==="secrets"&&(0,e.jsx)(As,{}),w==="delivery"&&(0,e.jsx)(Ps,{}),w==="runs"&&(0,e.jsx)(rs,{}),w==="activity"&&(0,e.jsx)(os,{}),w==="history"&&(0,e.jsx)(Vt,{}),Pe?(0,e.jsx)(Yt,{dirtyFields:J(w),isSaving:Y.isPending,saveConflict:q,onSave:i(()=>{!Y.isPending&&f.title.trim()&&Y.mutate()},"onSave"),onDiscard:i(()=>be(w),"onDiscard"),onReload:ke}):null]})})]})]}),(0,e.jsx)(ft,{open:g,onOpenChange:b,companyId:o.companyId,routineName:o.title,agents:F??[],projects:K??[],defaultProjectId:o.projectId,defaultAssigneeAgentId:o.assigneeAgentId,variables:o.variables??[],isPending:Z.isPending,onSubmit:i(t=>Z.mutate(t),"onSubmit")})]})}i(di,"RoutineDetail");export{di as RoutineDetail};
|
|
1
|
+
var ot=Object.defineProperty;var i=(s,a)=>ot(s,"name",{value:a,configurable:!0});import{i as Le}from"./rolldown-runtime-ZpX3ckPj.js";import{Fr as ct,Lr as lt,Pr as dt,S as ut,U as mt,Y as p,Yn as pt,nr as L,tr as U}from"./createLucideIcon-r3v6fbGz.js";import{Z as Ee,o as ht,r as oe,st as gt}from"./router-Bb8nJWyv.js";import{Ct as xt,bt as yt,lr as vt,t as ft,vt as Oe,wt as bt,xt as jt,yt as wt}from"./RoutineRunVariablesDialog-BdO_mZGp.js";import{Q as Nt}from"./mention-chips-DXumPrOR.js";import{s as kt,t as St}from"./zap-P-cXfK28.js";import{l as T,t as De}from"./MarkdownEditor-Pip4OXiJ.js";import{v as It}from"./sheet-DeCxNmfl.js";import{t as _e}from"./AgentAvatar-PT82VwmU.js";import{k as Ct}from"./checkbox-CmMbs2PZ.js";import{_ as At,s as Pt,t as O}from"./label-C2ddSDJj.js";import{t as Rt}from"./agents-BlSzFh-1.js";import{g as Tt}from"./StatusIcon-BuUYMqqU.js";import{r as Et,t as te}from"./EmptyState-DPcc0zYh.js";import{c as de,i as ue,n as me,s as pe,t as he}from"./select-mS22eY6T.js";import{r as Ot,t as Dt}from"./save-DUnPDT6R.js";import{k as _t,t as E}from"./button-CAPbz11u.js";import{n as Mt,t as qt}from"./clipboard-CYJ5Q78m.js";import{t as Ft}from"./heartbeats-CK_aXmx5.js";import{t as xe}from"./badge-Cf7ihb3q.js";import{t as V}from"./input-DpsS9it-.js";import{i as Kt,o as Lt}from"./company-members-BcZm1g8Q.js";import{r as Ut,t as Wt}from"./card-dmVcp3AX.js";import{t as $t}from"./PageSkeleton-DHjTwRT3.js";import{A as Vt,B as Gt,Cn as Qt,F as zt,G as Q,H as Bt,Ht,I as Jt,K as Ue,L as Yt,M as We,N as Zt,P as Xt,Qt as Me,R as es,Rn as ye,Tt as ts,U as qe,Un as ve,V as ss,Vn as is,Vt as ns,W as $e,Xt as X,fn as as,j as rs,k as os,pn as cs,q as ls,qt as ds,z as us}from"./index-DhwreIEp.js";var u=Le(lt(),1);function ms(s,a,n){const c={label:a.label.trim()||null};return s.kind==="schedule"&&(c.cronExpression=a.cronExpression.trim(),c.timezone=s.timezone??n),s.kind==="webhook"&&(c.signingMode=a.signingMode,c.replayWindowSec=Number(a.replayWindowSec||"300")),c}i(ms,"buildRoutineTriggerPatch");var e=Le(ct(),1),ps=["app_webhook","bearer","hmac_sha256","github_hmac","none"],hs=new Set(["app_webhook","bearer","github_hmac","fireflies_hmac","none"]);function gs(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}i(gs,"getLocalTimezone$1");function xs({trigger:s,onSave:a,onRotate:n,onDelete:c,disabled:r}){const[m,l]=(0,u.useState)({label:s.label??"",cronExpression:s.cronExpression??"",signingMode:s.signingMode??"bearer",replayWindowSec:String(s.replayWindowSec??300)});(0,u.useEffect)(()=>{l({label:s.label??"",cronExpression:s.cronExpression??"",signingMode:s.signingMode??"bearer",replayWindowSec:String(s.replayWindowSec??300)})},[s]);const k=s.kind==="schedule"?ye:s.kind==="webhook"?cs:St,I=s.kind==="schedule"?Xt(m.cronExpression):null,M=/fail|error/i.test(s.lastResult??""),C=s.lastResult?.startsWith("Created execution issue ")?"Task created":s.lastResult;return(0,e.jsxs)("form",{"aria-label":`Trigger: ${s.label??s.kind}`,className:"space-y-4 rounded-lg border border-border p-4",onSubmit:i(x=>x.preventDefault(),"onSubmit"),children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,e.jsx)(k,{className:"h-3.5 w-3.5 shrink-0"}),(0,e.jsx)("span",{className:"truncate",children:s.label??s.kind})]}),I?(0,e.jsx)("p",{id:`cron-readable-${s.id}`,className:"text-xs text-muted-foreground",children:I}):null]}),(0,e.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[s.lastResult?(0,e.jsx)(xe,{variant:M?"destructive":"secondary",children:C}):null,(0,e.jsx)("span",{className:"text-xs text-muted-foreground",children:s.kind==="schedule"&&s.nextRunAt?`Next: ${new Date(s.nextRunAt).toLocaleString()}`:s.kind==="webhook"?"Webhook":"API"})]})]}),s.kind==="webhook"&&s.webhookUrl&&(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{htmlFor:`webhook-url-${s.id}`,className:"text-xs",children:"Webhook URL"}),(0,e.jsx)(V,{id:`webhook-url-${s.id}`,value:s.webhookUrl,readOnly:!0,onFocus:i(x=>x.target.select(),"onFocus")}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Send a POST request with Content-Type: application/json. Keep this URL private when signing is disabled."})]}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Label"}),(0,e.jsx)(V,{value:m.label,disabled:r,onChange:i(x=>l(S=>({...S,label:x.target.value})),"onChange")})]}),s.kind==="schedule"&&(0,e.jsxs)("div",{className:"space-y-1.5 md:col-span-2",children:[(0,e.jsx)(O,{className:"text-xs",children:"Schedule"}),(0,e.jsx)(We,{value:m.cronExpression,onChange:i(x=>l(S=>({...S,cronExpression:x})),"onChange")})]}),s.kind==="webhook"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Signing mode"}),(0,e.jsxs)(he,{value:m.signingMode,onValueChange:i(x=>l(S=>({...S,signingMode:x})),"onValueChange"),disabled:r,children:[(0,e.jsx)(pe,{children:(0,e.jsx)(de,{})}),(0,e.jsx)(me,{children:ps.map(x=>(0,e.jsx)(ue,{value:x,children:x},x))})]})]}),!hs.has(m.signingMode)&&(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Replay window (seconds)"}),(0,e.jsx)(V,{value:m.replayWindowSec,disabled:r,onChange:i(x=>l(S=>({...S,replayWindowSec:x.target.value})),"onChange")})]})]})]}),!r&&(0,e.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,e.jsxs)(E,{variant:"ghost",size:"sm",className:"mr-auto text-muted-foreground hover:text-destructive",onClick:i(()=>c(s.id),"onClick"),children:[(0,e.jsx)(Ct,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete"]}),s.kind==="webhook"&&(0,e.jsxs)(E,{variant:"outline",size:"sm",onClick:i(()=>n(s.id),"onClick"),children:[(0,e.jsx)(It,{className:"mr-1.5 h-3.5 w-3.5"}),"Rotate secret"]}),(0,e.jsxs)(E,{variant:"outline",size:"sm",onClick:i(()=>a(s.id,ms(s,m,gs())),"onClick"),children:[(0,e.jsx)(Dt,{className:"mr-1.5 h-3.5 w-3.5"}),"Save trigger"]})]})]})}i(xs,"RoutineTriggerCard");var ys=[{value:"coalesce_if_active",title:"Coalesce if active",description:"Keep one follow-up run queued while an active run is still working."},{value:"always_enqueue",title:"Always enqueue",description:"Queue every trigger occurrence, even if several runs stack up."},{value:"skip_if_active",title:"Skip if active",description:"Drop overlapping trigger occurrences while the routine is already active."}],vs=[{value:"skip_missed",title:"Skip missed",description:"Ignore schedule windows that were missed while paused."},{value:"enqueue_missed_with_cap",title:"Enqueue missed with cap",description:"Catch up missed schedule windows after recovery; sub-hourly schedules are combined into one catch-up run, slower schedules replay each missed window up to a cap."}],fs=[{value:"always",title:"Run on every scheduled tick",description:"Fire on the schedule no matter what — the default behavior."},{value:"require_external_activity",title:"Skip when there's been no activity since the last run",description:"On a scheduled tick, only run if something happened since the last run that finished. Lets a watcher-style routine stay asleep while the system is settled instead of burning tokens."}],bs=[{value:"company",title:"Company-wide",description:"Any activity across the company counts as a reason to run."},{value:"project",title:"This project",description:"Only activity in the routine's project counts as a reason to run."}],js=["schedule","webhook"],ws=["app_webhook","bearer","hmac_sha256","github_hmac","none"],Ns={bearer:"Send Authorization: Bearer <secret> with each request.",hmac_sha256:"Send X-Paperclip-Timestamp and X-Paperclip-Signature: sha256=<hex>, signing timestamp + a dot + the exact JSON body.",github_hmac:"Accept GitHub-style X-Hub-Signature-256 header (HMAC over raw body, no timestamp).",app_webhook:"Accept a bearer token or an HMAC-SHA256 signature over the exact request body in X-Hub-Signature or X-Hub-Signature-256.",fireflies_hmac:"Signed webhook (legacy).",none:"No authentication — the webhook URL itself acts as a shared secret."},ks=new Set(["app_webhook","bearer","github_hmac","fireflies_hmac","none"]);function Ss({defaultDescriptionAnnotationsOpen:s=!1}={}){const{routine:a,editDraft:n,setEditDraft:c,assigneeOptions:r,projectOptions:m,recentAssigneeIds:l,recentProjectIds:k,agentById:I,projectById:M,currentAssignee:C,currentProject:x,mentionOptions:S,assigneeSelectorRef:D,projectSelectorRef:q,descriptionEditorRef:A,routineRuns:g,activity:b,saveRoutine:j,saveConflict:se,isSectionDirty:f,navigateToSection:P}=Q(),[w,_]=(0,u.useState)(s),o=a.triggers.length,z=(0,u.useMemo)(()=>{const d=a.triggers.filter(y=>y.kind==="schedule"&&y.nextRunAt).map(y=>new Date(y.nextRunAt)).sort((y,G)=>y.getTime()-G.getTime())[0];return d?d.toLocaleString():null},[a.triggers]),W=n.env?Object.keys(n.env).length:0,R=(g??[])[0]??null,B=(b??[]).slice(0,5);return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsx)("div",{className:"overflow-x-auto overscroll-x-contain",children:(0,e.jsxs)("div",{className:"inline-flex min-w-full flex-wrap items-center gap-2 text-sm text-muted-foreground sm:min-w-max sm:flex-nowrap",children:[(0,e.jsx)("span",{children:"For"}),(0,e.jsx)(Oe,{ref:D,value:n.assigneeAgentId,options:r,recentOptionIds:l,placeholder:"Responsible",noneLabel:"No responsible",searchPlaceholder:"Search responsible...",emptyMessage:"No responsible found.",onChange:i(d=>c(y=>({...y,assigneeAgentId:d})),"onChange"),onConfirm:i(()=>{n.projectId?A.current?.focus():q.current?.focus()},"onConfirm"),renderTriggerValue:i(d=>d?C?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_e,{agent:C,size:16,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),(0,e.jsx)("span",{className:"truncate",children:d.label})]}):(0,e.jsx)("span",{className:"truncate",children:d.label}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"Responsible"}),"renderTriggerValue"),renderOption:i(d=>{if(!d.id)return(0,e.jsx)("span",{className:"truncate",children:d.label});const y=I.get(d.id);return(0,e.jsxs)(e.Fragment,{children:[y?(0,e.jsx)(_e,{agent:y,size:16,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):null,(0,e.jsx)("span",{className:"truncate",children:d.label})]})},"renderOption")}),(0,e.jsx)("span",{children:"in"}),(0,e.jsx)(Oe,{ref:q,value:n.projectId,options:m,recentOptionIds:k,placeholder:"Project",noneLabel:"No project",searchPlaceholder:"Search projects...",emptyMessage:"No projects found.",onChange:i(d=>c(y=>({...y,projectId:d})),"onChange"),onConfirm:i(()=>A.current?.focus(),"onConfirm"),renderTriggerValue:i(d=>d&&x?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:x.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:d.label})]}):(0,e.jsx)("span",{className:"text-muted-foreground",children:"Project"}),"renderTriggerValue"),renderOption:i(d=>{if(!d.id)return(0,e.jsx)("span",{className:"truncate",children:d.label});const y=M.get(d.id);return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("span",{className:"h-3.5 w-3.5 shrink-0 rounded-sm",style:{backgroundColor:y?.color??"var(--project-none)"}}),(0,e.jsx)("span",{className:"truncate",children:d.label})]})},"renderOption")})]})}),a.assigneeAgentId?null:(0,e.jsx)("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm text-amber-900 dark:text-amber-200",children:"Default agent required. This routine can stay as a draft and still run manually, but automation stays paused until you assign a default agent."}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("div",{className:"flex items-center justify-end",children:a.descriptionDocument?(0,e.jsx)(ns,{issueId:a.id,docKey:"description",target:{kind:"routine",routineId:a.id,documentKey:"description"},panelOpen:w,onToggle:i(()=>_(d=>!d),"onToggle")}):null}),a.descriptionDocument?(0,e.jsx)(Ht,{issueId:a.id,doc:a.descriptionDocument,target:{kind:"routine",routineId:a.id,documentKey:"description"},bodyMarkdown:n.description,draftDirty:f("overview")||j.isPending,draftConflicted:se,historicalPreview:!1,locationHash:typeof window>"u"?"":window.location.hash,panelOpen:w,onPanelOpenChange:_,children:(0,e.jsx)(De,{ref:A,value:n.description,onChange:i(d=>c(y=>({...y,description:d})),"onChange"),placeholder:"Add instructions...",bordered:!1,contentClassName:"min-h-(--sz-120px) text-sm leading-7",mentions:S,onSubmit:i(()=>{!j.isPending&&n.title.trim()&&j.mutate()},"onSubmit")})}):(0,e.jsx)(De,{ref:A,value:n.description,onChange:i(d=>c(y=>({...y,description:d})),"onChange"),placeholder:"Add instructions...",bordered:!1,contentClassName:"min-h-(--sz-120px) text-sm leading-7",mentions:S,onSubmit:i(()=>{!j.isPending&&n.title.trim()&&j.mutate()},"onSubmit")})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(ls,{}),(0,e.jsx)(Ue,{title:n.title,description:n.description,value:n.variables,onChange:i(d=>c(y=>({...y,variables:d})),"onChange")})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[(0,e.jsx)(ce,{icon:ye,label:"Triggers",value:o===0?"None":`${o} active`,hint:z?`Next fire ${z}`:"No schedule",to:i(()=>P("triggers"),"to"),ariaLabel:`${o} triggers. Open triggers.`}),(0,e.jsx)(ce,{icon:Mt,label:"Secrets",value:W===0?"None":`${W} bound`,hint:"Manage bound secrets",to:i(()=>P("secrets"),"to"),ariaLabel:`${W} secrets bound. Open secrets.`}),(0,e.jsx)(ce,{icon:At,label:"Last run",value:R?R.status.replaceAll("_"," "):"No runs",hint:R?Ee(R.triggeredAt):"Trigger a run",to:i(()=>P("runs"),"to"),ariaLabel:R?`Last run ${R.status}. Open runs.`:"No runs. Open runs."})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Recent activity"}),B.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"No activity yet."}):(0,e.jsxs)("div",{className:"divide-y divide-border/60",children:[B.map(d=>(0,e.jsxs)("div",{className:"flex items-center gap-2 py-1.5 text-xs",children:[(0,e.jsx)(xe,{variant:"outline",className:"shrink-0 font-mono",children:d.action}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:d.details&&Object.keys(d.details).length>0?Object.keys(d.details).slice(0,3).join(" · "):""}),(0,e.jsx)("span",{className:"shrink-0 text-muted-foreground/60",children:Ee(d.createdAt)})]},d.id)),(0,e.jsxs)("button",{type:"button",onClick:i(()=>P("activity"),"onClick"),className:"flex items-center gap-1 pt-2 text-xs text-muted-foreground hover:text-foreground",children:["View all activity ",(0,e.jsx)(ve,{className:"h-3 w-3"})]})]})]})]})}i(Ss,"OverviewSection");function ce({icon:s,label:a,value:n,hint:c,to:r,ariaLabel:m}){return(0,e.jsx)("button",{type:"button",onClick:r,"aria-label":m,className:"text-left",children:(0,e.jsx)(Wt,{className:"gap-2 p-4 transition-colors hover:border-border hover:bg-accent/30",children:(0,e.jsxs)(Ut,{className:"space-y-1 p-0",children:[(0,e.jsxs)("div",{className:"flex items-center gap-1.5 text-xs uppercase tracking-wide text-muted-foreground",children:[(0,e.jsx)(s,{className:"h-3.5 w-3.5"}),a,(0,e.jsx)(ve,{className:"ml-auto h-3.5 w-3.5 text-muted-foreground/60"})]}),(0,e.jsx)("p",{className:"text-lg font-semibold",children:n}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:c})]})})})}i(ce,"SummaryCard");function Is(){const{routine:s,newTrigger:a,setNewTrigger:n,createTrigger:c,updateTrigger:r,deleteTrigger:m,rotateTrigger:l,secretMessage:k,copySecretValue:I,setSecretMessage:M}=Q(),[C,x]=(0,u.useState)(!1),[S,D]=(0,u.useState)(!0),q=(0,u.useMemo)(()=>a.kind==="schedule"?Zt(a.cronExpression):null,[a.cronExpression,a.kind]),A=c.isPending||(q?!q.valid||!S:!1);return(0,u.useEffect)(()=>{a.kind!=="schedule"&&D(!0)},[a.kind]),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:s.triggers.length===0?"No triggers yet":`${s.triggers.length} trigger${s.triggers.length===1?"":"s"}`}),(0,e.jsx)(E,{size:"sm",variant:C?"secondary":"default",onClick:i(()=>x(g=>!g),"onClick"),"aria-expanded":C,children:C?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(Nt,{className:"mr-1.5 h-3.5 w-3.5"}),"Cancel"]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(_t,{className:"mr-1.5 h-3.5 w-3.5"}),"New trigger"]})})]}),C?(0,e.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,e.jsx)("p",{className:"text-sm font-medium",children:"Add trigger"}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Kind"}),(0,e.jsxs)(he,{value:a.kind,onValueChange:i(g=>n(b=>({...b,kind:g})),"onValueChange"),children:[(0,e.jsx)(pe,{children:(0,e.jsx)(de,{})}),(0,e.jsx)(me,{children:js.map(g=>(0,e.jsx)(ue,{value:g,children:g},g))})]})]}),a.kind==="schedule"&&(0,e.jsxs)("div",{className:"space-y-1.5 md:col-span-2",children:[(0,e.jsx)(O,{className:"text-xs",children:"Schedule"}),(0,e.jsx)(We,{value:a.cronExpression,onChange:i(g=>n(b=>({...b,cronExpression:g})),"onChange"),onValidityChange:D})]}),a.kind==="webhook"&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Signing mode"}),(0,e.jsxs)(he,{value:a.signingMode,onValueChange:i(g=>n(b=>({...b,signingMode:g})),"onValueChange"),children:[(0,e.jsx)(pe,{children:(0,e.jsx)(de,{})}),(0,e.jsx)(me,{children:ws.map(g=>(0,e.jsx)(ue,{value:g,children:g},g))})]}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:Ns[a.signingMode]})]}),!ks.has(a.signingMode)&&(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)(O,{className:"text-xs",children:"Replay window (seconds)"}),(0,e.jsx)(V,{value:a.replayWindowSec,onChange:i(g=>n(b=>({...b,replayWindowSec:g.target.value})),"onChange")})]})]})]}),(0,e.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,e.jsx)(E,{size:"sm",variant:"ghost",onClick:i(()=>x(!1),"onClick"),children:"Cancel"}),(0,e.jsx)(E,{size:"sm",onClick:i(()=>c.mutate(void 0,{onSuccess:i(()=>{n($e()),x(!1)},"onSuccess")}),"onClick"),disabled:A,children:c.isPending?"Adding...":"Add trigger"})]})]}):null,k?(0,e.jsxs)("div",{className:"space-y-3 rounded-lg border border-border bg-muted/20 p-4 text-sm",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)("p",{className:"font-medium",children:k.title}),(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Save this now. Paperclip will not show the secret value again."})]}),(0,e.jsx)("div",{className:"space-y-3",children:k.entries.map((g,b)=>(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(V,{"aria-label":"New webhook URL",value:g.webhookUrl,readOnly:!0,className:"flex-1"}),(0,e.jsx)(E,{variant:"outline",size:"sm",onClick:i(()=>I("Webhook URL",g.webhookUrl),"onClick"),children:"URL"})]}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(V,{"aria-label":"New webhook secret",value:g.webhookSecret,readOnly:!0,className:"flex-1"}),(0,e.jsx)(E,{variant:"outline",size:"sm",onClick:i(()=>I("Webhook secret",g.webhookSecret),"onClick"),children:"Secret"})]})]},`${g.webhookUrl}-${b}`))}),(0,e.jsx)(E,{variant:"outline",size:"sm",onClick:i(()=>M(null),"onClick"),children:"Done"})]}):null,s.triggers.length===0?(0,e.jsx)(te,{icon:ye,message:"No triggers yet.",action:"Add a trigger",onAction:i(()=>x(!0),"onAction")}):(0,e.jsx)("div",{className:"space-y-3",children:s.triggers.map(g=>(0,e.jsx)(xs,{trigger:g,onSave:i((b,j)=>r.mutate({id:b,patch:j}),"onSave"),onRotate:i(b=>l.mutate(b),"onRotate"),onDelete:i(b=>m.mutate(b),"onDelete")},g.id))})]})}i(Is,"TriggersSection");function Cs(){const{editDraft:s,setEditDraft:a,navigateToSection:n}=Q(),c=s.variables.length>0;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/20 px-4 py-3 text-xs",children:[(0,e.jsxs)("span",{className:"flex-1 text-muted-foreground",children:["Variables are auto-detected from ",(0,e.jsx)("code",{className:"font-mono",children:"{{placeholders}}"})," in the title & instructions. The variable name is read-only — rename by editing the placeholder."]}),(0,e.jsxs)(E,{variant:"secondary",size:"sm",onClick:i(()=>n("overview"),"onClick"),children:[(0,e.jsx)(Qt,{className:"mr-1.5 h-3.5 w-3.5"}),"Edit instructions"]})]}),c?(0,e.jsx)(Ue,{title:s.title,description:s.description,value:s.variables,onChange:i(r=>a(m=>({...m,variables:r})),"onChange")}):(0,e.jsx)(te,{icon:is,message:"No variables yet. Add a {{placeholder}} in the title or instructions to create one.",action:"Edit instructions",onAction:i(()=>n("overview"),"onAction")})]})}i(Cs,"VariablesSection");function As(){const{editDraft:s,setEditDraft:a,availableSecrets:n,createSecret:c}=Q(),r=(0,u.useMemo)(()=>[...n].filter(m=>m.status==="active").sort((m,l)=>{const k=(l.referenceCount??0)-(m.referenceCount??0);return k!==0?k:new Date(l.updatedAt).getTime()-new Date(m.updatedAt).getTime()}).slice(0,8),[n]);return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"rounded-md border border-border bg-muted/20 px-4 py-3 text-xs text-muted-foreground",children:["Routine secrets apply to every task this routine creates. They override matching keys in project and agent env. ",(0,e.jsx)("span",{className:"font-mono",children:"PAPERCLIP_*"})," names are reserved."]}),(0,e.jsx)(ds,{value:s.env??{},secrets:n,recentlyUsedSecrets:r,onCreateSecret:i(async(m,l)=>c.mutateAsync({name:m,value:l}),"onCreateSecret"),onChange:i(m=>a(l=>({...l,env:m??null})),"onChange")})]})}i(As,"SecretsSection");function Ps(){const{editDraft:s,setEditDraft:a,routine:n}=Q(),c=n.triggers.some(m=>m.kind==="schedule"),r=s.activityGatePolicy==="require_external_activity";return(0,e.jsxs)("div",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Concurrency"}),(0,e.jsx)(X,{ariaLabel:"Concurrency policy",value:s.concurrencyPolicy,onValueChange:i(m=>a(l=>({...l,concurrencyPolicy:m})),"onValueChange"),options:ys})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Catch-up"}),(0,e.jsx)(X,{ariaLabel:"Catch-up policy",value:s.catchUpPolicy,onValueChange:i(m=>a(l=>({...l,catchUpPolicy:m})),"onValueChange"),options:vs})]}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Advanced run policy"}),(0,e.jsx)(X,{ariaLabel:"Advanced run policy",value:s.activityGatePolicy,onValueChange:i(m=>a(l=>({...l,activityGatePolicy:m})),"onValueChange"),options:fs,disabled:!c}),c?r?(0,e.jsxs)("div",{className:"space-y-2 rounded-lg border border-border p-3",children:[(0,e.jsx)(O,{className:"text-xs font-medium",children:"Activity scope"}),(0,e.jsx)(X,{ariaLabel:"Activity gate scope",value:s.activityGateScope,onValueChange:i(m=>a(l=>({...l,activityGateScope:m})),"onValueChange"),options:bs})]}):null:(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:"Add a schedule trigger to gate runs on activity. Webhook, manual, and API fires always run."})]}),(0,e.jsx)(Ts,{triggers:n.triggers,concurrencyPolicy:s.concurrencyPolicy})]})}i(Ps,"DeliverySection");var Rs={queued:"text-emerald-600 dark:text-emerald-400",coalesced:"text-amber-600 dark:text-amber-400",skipped:"text-muted-foreground"};function Ts({triggers:s,concurrencyPolicy:a}){const n=(0,u.useMemo)(()=>{const c=s.filter(r=>r.kind==="schedule"&&r.enabled&&r.cronExpression).map(r=>({trigger:r,fires:zt(r.cronExpression,5,{timeZone:r.timezone??"UTC"})})).filter(r=>r.fires.length>0).sort((r,m)=>r.fires[0].getTime()-m.fires[0].getTime())[0];return c?{timeZone:c.trigger.timezone??"UTC",entries:Jt(c.fires,a)}:null},[s,a]);return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)("p",{className:"text-xs font-medium uppercase tracking-(--tracking-caps) text-muted-foreground",children:"Next 5 fires"}),n?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"space-y-1.5 rounded-lg border border-border p-3 font-mono text-xs",children:n.entries.map((c,r)=>(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,e.jsx)("span",{className:"tabular-nums",children:Es(c.at,n.timeZone)}),(0,e.jsx)(ve,{className:"h-3 w-3 shrink-0 text-muted-foreground/50"}),(0,e.jsx)("span",{className:ut("font-medium",Rs[c.disposition]),children:c.label}),c.note?(0,e.jsxs)("span",{className:"truncate text-muted-foreground/60",children:["(",c.note,")"]}):null]},r))}),(0,e.jsxs)("p",{className:"text-(length:--text-micro) text-muted-foreground/60",children:["Preview assumes the previous run is still in flight when the next fires. Times shown in"," ",n.timeZone,"."]})]}):(0,e.jsx)("p",{className:"rounded-lg border border-dashed border-border p-3 text-xs text-muted-foreground",children:"No enabled schedule trigger to preview. Add a schedule in Triggers to see how this policy treats upcoming fires."})]})}i(Ts,"NextFiresPreview");function Es(s,a){try{return new Intl.DateTimeFormat(void 0,{timeZone:a,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}).format(s).replace(",","")}catch{return s.toISOString()}}i(Es,"formatFireTime");var ge="paperclip.routineLastSection";function Os(s){return s.filter(a=>!a.archivedAt).map(a=>({id:a.id,label:a.name,searchText:a.description??""}))}i(Os,"buildRoutineProjectOptions");var Ds={overview:"Overview",triggers:"Triggers",variables:"Variables",secrets:"Secrets",delivery:"Delivery",runs:"Runs",activity:"Activity",history:"History"};function ee(s){return s!=null&&ss.includes(s)}i(ee,"isRoutineSection");function _s(s){try{const a=localStorage.getItem(ge);if(!a)return null;const n=JSON.parse(a)[s];return ee(n)?n:null}catch{return null}}i(_s,"readLastSection");function le(s,a){try{const n=localStorage.getItem(ge),c=n?JSON.parse(n):{};c[s]=a,localStorage.setItem(ge,JSON.stringify(c))}catch{}}i(le,"writeLastSection");var Fe={triggers:"triggers",runs:"runs",activity:"activity",secrets:"secrets",history:"history"};function Ke(s){s&&(s.style.height="auto",s.style.height=`${s.scrollHeight}px`)}i(Ke,"autoResizeTextarea");function Ms(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return"UTC"}}i(Ms,"getLocalTimezone");function qs(s){return{...s,description:s.description.trim()||null,projectId:s.projectId||null,assigneeAgentId:s.assigneeAgentId||null,env:s.env&&Object.keys(s.env).length>0?s.env:null}}i(qs,"buildRoutineMutationPayload");function di(){const{routineId:s,section:a}=gt(),{selectedCompanyId:n}=mt(),{setBreadcrumbs:c}=Et(),r=dt(),m=ht(),{pushToast:l}=as(),k=(0,u.useRef)(null),I=(0,u.useRef)(null),M=(0,u.useRef)(null),C=(0,u.useRef)(null),x=(0,u.useRef)(null),[S,D]=(0,u.useState)(null),[q,A]=(0,u.useState)(!1),[g,b]=(0,u.useState)(!1),[j,se]=(0,u.useState)($e),[f,P]=(0,u.useState)({title:"",description:"",projectId:"",assigneeAgentId:"",priority:"medium",concurrencyPolicy:"coalesce_if_active",catchUpPolicy:"skip_missed",activityGatePolicy:"always",activityGateScope:"company",variables:[],env:null}),w=ee(a)?a:"overview",_=(0,u.useCallback)((t,h)=>{s&&(le(s,t),m(`/routines/${s}/${t}`,{replace:h?.replace??!0}))},[m,s]),{data:o,isLoading:z,error:W}=L({queryKey:p.routines.detail(s),queryFn:i(()=>T.get(s),"queryFn"),enabled:!!s}),R=o?.activeIssue?.id,{data:B}=L({queryKey:p.issues.liveRuns(R),queryFn:i(()=>Ft.liveRunsForIssue(R),"queryFn"),enabled:!!R,refetchInterval:3e3}),d=(B??[]).length>0,{data:y}=L({queryKey:p.routines.runs(s),queryFn:i(()=>T.listRuns(s),"queryFn"),enabled:!!s,refetchInterval:d?3e3:!1}),G=(0,u.useMemo)(()=>({triggerIds:o?.triggers.map(t=>t.id)??[],runIds:y?.map(t=>t.id)??[]}),[o?.triggers,y]),{data:Ve}=L({queryKey:[...p.routines.activity(n,s),G.triggerIds.join(","),G.runIds.join(",")],queryFn:i(()=>T.activity(n,s,G),"queryFn"),enabled:!!n&&!!s&&!!o}),{data:F}=L({queryKey:p.agents.list(n),queryFn:i(()=>Rt.list(n),"queryFn"),enabled:!!n}),{data:K}=L({queryKey:p.projects.list(n,{includeArchived:!0}),queryFn:i(()=>Tt.list(n,{includeArchived:!0}),"queryFn"),enabled:!!n}),{data:fe}=L({queryKey:p.access.companyUserDirectory(n),queryFn:i(()=>Lt.listUserDirectory(n),"queryFn"),enabled:!!n}),{data:Ge=[]}=L({queryKey:n?p.secrets.list(n):["secrets","none"],queryFn:i(()=>Me.list(n),"queryFn"),enabled:!!n}),Qe=U({mutationFn:i(t=>{if(!n)throw new Error("Select a company to create secrets");return Me.create(n,t)},"mutationFn"),onSuccess:i(()=>{n&&r.invalidateQueries({queryKey:p.secrets.list(n)})},"onSuccess")}),v=(0,u.useMemo)(()=>o?{title:o.title,description:o.description??"",projectId:o.projectId??"",assigneeAgentId:o.assigneeAgentId??"",priority:o.priority,concurrencyPolicy:o.concurrencyPolicy,catchUpPolicy:o.catchUpPolicy,activityGatePolicy:o.activityGatePolicy,activityGateScope:o.activityGateScope,variables:o.variables,env:o.env??null}:null,[o]),H=(0,u.useMemo)(()=>{if(!v)return[];const t=[];return f.title!==v.title&&t.push({key:"title",label:"the title"}),f.description!==v.description&&t.push({key:"description",label:"the description"}),f.projectId!==v.projectId&&t.push({key:"projectId",label:"the project"}),f.assigneeAgentId!==v.assigneeAgentId&&t.push({key:"assigneeAgentId",label:"the default agent"}),f.priority!==v.priority&&t.push({key:"priority",label:"the priority"}),f.concurrencyPolicy!==v.concurrencyPolicy&&t.push({key:"concurrencyPolicy",label:"the concurrency policy"}),f.catchUpPolicy!==v.catchUpPolicy&&t.push({key:"catchUpPolicy",label:"the catch-up policy"}),f.activityGatePolicy!==v.activityGatePolicy&&t.push({key:"activityGatePolicy",label:"the advanced run policy"}),f.activityGateScope!==v.activityGateScope&&t.push({key:"activityGateScope",label:"the activity gate scope"}),JSON.stringify(f.variables)!==JSON.stringify(v.variables)&&t.push({key:"variables",label:"the variables"}),JSON.stringify(f.env??null)!==JSON.stringify(v.env??null)&&t.push({key:"env",label:"the secrets"}),t},[f,v]),ie=H.length>0,J=(0,u.useCallback)(t=>{const h=qe[t];return h?H.filter(N=>h.includes(N.key)):[]},[H]),ne=(0,u.useCallback)(t=>J(t).length>0,[J]),be=(0,u.useCallback)(t=>{if(!v)return;const h=qe[t];h&&P(N=>{const Re={...N};for(const Te of h)Re[Te]=v[Te];return Re})},[v]);(0,u.useEffect)(()=>{o&&(c([{label:"Routines",href:"/routines"},{label:o.title}]),v&&(k.current!==o.id||!ie)&&(P(v),k.current=o.id))},[o,v,ie,c]),(0,u.useEffect)(()=>{Ke(I.current)},[f.title,o?.id]),(0,u.useEffect)(()=>{s&&ee(a)&&le(s,a)},[s,a]);const ze=(0,u.useCallback)(async(t,h)=>{try{await qt(h),l({title:`${t} copied`,tone:"success"})}catch(N){l({title:`Failed to copy ${t.toLowerCase()}`,body:N instanceof Error?N.message:"Clipboard access was denied.",tone:"error"})}},[l]),Y=U({mutationFn:i(()=>{const t=qs(f),h=o?.latestRevisionId??null;return T.update(s,{...t,...h?{baseRevisionId:h}:{}})},"mutationFn"),onSuccess:i(async()=>{A(!1),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)}),r.invalidateQueries({queryKey:p.routines.revisions(s)})])},"onSuccess"),onError:i(t=>{if(t instanceof pt&&t.status===409){A(!0),l({title:"Routine changed",body:"Someone else updated this routine. Reload to see the latest revision.",tone:"warn"});return}l({title:"Failed to save routine",body:t instanceof Error?t.message:"Paperclip could not save the routine.",tone:"error"})},"onError")}),Z=U({mutationFn:i(t=>T.run(s,{...t?.variables&&Object.keys(t.variables).length>0?{variables:t.variables}:{},...t?.assigneeAgentId!==void 0?{assigneeAgentId:t.assigneeAgentId}:{},...t?.projectId!==void 0?{projectId:t.projectId}:{},...t?.executionWorkspaceId!==void 0?{executionWorkspaceId:t.executionWorkspaceId}:{},...t?.executionWorkspacePreference!==void 0?{executionWorkspacePreference:t.executionWorkspacePreference}:{},...t?.executionWorkspaceSettings!==void 0?{executionWorkspaceSettings:t.executionWorkspaceSettings}:{}}),"mutationFn"),onSuccess:i(async()=>{l({title:"Routine run started",tone:"success"}),b(!1),_("runs"),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.runs(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Routine run failed",body:t instanceof Error?t.message:"Paperclip could not start the routine run.",tone:"error"})},"onError")}),je=U({mutationFn:i(t=>T.update(s,{status:t}),"mutationFn"),onSuccess:i(async(t,h)=>{l({title:"Routine saved",body:h==="paused"?"Automation paused.":"Automation enabled.",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to update routine",body:t instanceof Error?t.message:"Paperclip could not update the routine.",tone:"error"})},"onError")}),Be=U({mutationFn:i(async()=>{const t=(o?.triggers??[]).filter(N=>N.kind===j.kind).length,h=t>0?`${j.kind}-${t+1}`:j.kind;return T.createTrigger(s,{kind:j.kind,label:h,...j.kind==="schedule"?{cronExpression:j.cronExpression.trim(),timezone:Ms()}:{},...j.kind==="webhook"?{signingMode:j.signingMode,replayWindowSec:Number(j.replayWindowSec||"300")}:{}})},"mutationFn"),onSuccess:i(async t=>{t.secretMaterial?D({title:"Webhook trigger created",entries:[{webhookUrl:t.secretMaterial.webhookUrl,webhookSecret:t.secretMaterial.webhookSecret}]}):l({title:"Trigger added",body:"The routine schedule was saved.",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to add trigger",body:t instanceof Error?t.message:"Paperclip could not create the trigger.",tone:"error"})},"onError")}),He=U({mutationFn:i(({id:t,patch:h})=>T.updateTrigger(t,h),"mutationFn"),onSuccess:i(async()=>{l({title:"Trigger saved",body:"The routine cadence update was saved.",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to update trigger",body:t instanceof Error?t.message:"Paperclip could not update the trigger.",tone:"error"})},"onError")}),Je=U({mutationFn:i(t=>T.deleteTrigger(t),"mutationFn"),onSuccess:i(async()=>{l({title:"Trigger deleted",tone:"success"}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.list(n)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to delete trigger",body:t instanceof Error?t.message:"Paperclip could not delete the trigger.",tone:"error"})},"onError")}),Ye=U({mutationFn:i(t=>T.rotateTriggerSecret(t),"mutationFn"),onSuccess:i(async t=>{D({title:"Webhook secret rotated",entries:[{webhookUrl:t.secretMaterial.webhookUrl,webhookSecret:t.secretMaterial.webhookSecret}]}),await Promise.all([r.invalidateQueries({queryKey:p.routines.detail(s)}),r.invalidateQueries({queryKey:p.routines.activity(n,s)})])},"onSuccess"),onError:i(t=>{l({title:"Failed to rotate webhook secret",body:t instanceof Error?t.message:"Paperclip could not rotate the webhook secret.",tone:"error"})},"onError")}),we=(0,u.useMemo)(()=>new Map((F??[]).map(t=>[t.id,t])),[F]),Ne=(0,u.useMemo)(()=>new Map((K??[]).map(t=>[t.id,t])),[K]),ae=(0,u.useMemo)(()=>jt(),[o?.id]),Ze=(0,u.useMemo)(()=>wt(),[o?.id]),Xe=(0,u.useMemo)(()=>xt((F??[]).filter(t=>t.status!=="terminated"),ae).map(t=>({id:t.id,label:t.name,searchText:`${t.name} ${t.role} ${t.title??""}`})),[F,ae]),et=(0,u.useMemo)(()=>Os(K??[]),[K]),tt=(0,u.useMemo)(()=>Kt({agents:F,projects:(K??[]).filter(t=>!t.archivedAt),members:fe?.users}),[F,fe?.users,K]),st=(0,u.useCallback)(t=>{P(h=>{const N=typeof t=="function"?t(h):t;return N.assigneeAgentId&&N.assigneeAgentId!==h.assigneeAgentId&&bt(N.assigneeAgentId),N.projectId&&N.projectId!==h.projectId&&yt(N.projectId),N})},[]),it=f.assigneeAgentId?we.get(f.assigneeAgentId)??null:null,nt=f.projectId?Ne.get(f.projectId)??null:null,ke=(0,u.useCallback)(()=>{A(!1),v&&P(v),r.invalidateQueries({queryKey:p.routines.detail(s)})},[r,v,s]),at=(0,u.useCallback)(t=>{t.secretMaterials.length>0&&(_("triggers"),D({title:t.secretMaterials.length===1?"Webhook trigger restored":`${t.secretMaterials.length} webhook triggers restored`,entries:t.secretMaterials.map(h=>({webhookUrl:h.webhookUrl,webhookSecret:h.webhookSecret}))}))},[_]),rt=(0,u.useCallback)(t=>{A(!1),r.setQueryData(p.routines.detail(s),h=>h&&{...h,...t.routine,latestRevisionId:t.revision.id,latestRevisionNumber:t.revision.revisionNumber}),P({title:t.routine.title,description:t.routine.description??"",projectId:t.routine.projectId??"",assigneeAgentId:t.routine.assigneeAgentId??"",priority:t.routine.priority,concurrencyPolicy:t.routine.concurrencyPolicy,catchUpPolicy:t.routine.catchUpPolicy,activityGatePolicy:t.routine.activityGatePolicy,activityGateScope:t.routine.activityGateScope,variables:t.routine.variables,env:t.routine.env??null}),k.current=t.routine.id},[r,s]);if(!n)return(0,e.jsx)(te,{icon:vt,message:"Select a company to view routines."});const re=new URLSearchParams(window.location.search).get("tab");if(s&&re&&Fe[re])return(0,e.jsx)(oe,{to:`/routines/${s}/${Fe[re]}`,replace:!0});if(s&&!a){const t=_s(s)??"overview";return(0,e.jsx)(oe,{to:`/routines/${s}/${t}`,replace:!0})}if(s&&a&&!ee(a))return(0,e.jsx)(oe,{to:`/routines/${s}/overview`,replace:!0});if(z)return(0,e.jsx)($t,{variant:"issues-list"});if(W||!o||!v)return(0,e.jsx)(te,{icon:Ot,message:W instanceof Error?W.message:"We couldn't load this routine."});const $=o.status==="active",Se=je.isPending||o.status==="archived",Ie=o.status==="archived"?"Archived":o.assigneeAgentId?$?"Active":"Paused":"Draft",Ce=o.status==="archived"?"text-muted-foreground":$?"text-emerald-400":"text-muted-foreground",Ae={routine:o,routineId:s,companyId:o.companyId,editDraft:f,setEditDraft:st,routineDefaults:v,dirtyFields:H,isEditDirty:ie,sectionDirtyFields:J,isSectionDirty:ne,discardSection:be,saveRoutine:Y,saveConflict:q,reloadLatest:ke,automationEnabled:$,automationLabel:Ie,automationLabelClassName:Ce,automationToggleDisabled:Se,onToggleAutomation:i(()=>{if(!$&&!o.assigneeAgentId){l({title:"Default agent required",body:"Set a default agent before enabling routine automation.",tone:"warn"});return}je.mutate($?"paused":"active")},"onToggleAutomation"),onOpenRunDialog:i(()=>b(!0),"onOpenRunDialog"),runRoutinePending:Z.isPending,newTrigger:j,setNewTrigger:se,createTrigger:Be,updateTrigger:He,deleteTrigger:Je,rotateTrigger:Ye,secretMessage:S,setSecretMessage:D,copySecretValue:ze,availableSecrets:Ge,createSecret:Qe,agents:F??[],projects:K??[],agentById:we,projectById:Ne,assigneeOptions:Xe,projectOptions:et,recentAssigneeIds:ae,recentProjectIds:Ze,mentionOptions:tt,currentAssignee:it,currentProject:nt,routineRuns:y,activity:Ve,hasLiveRun:d,activeIssueId:R,titleInputRef:I,descriptionEditorRef:M,assigneeSelectorRef:C,projectSelectorRef:x,onHistoryRestoreSecretMaterials:at,onHistoryRestored:rt,navigateToSection:_},Pe=Gt.includes(w);return(0,e.jsxs)(Bt.Provider,{value:Ae,children:[(0,e.jsx)("a",{href:"#routine-section",className:"sr-only focus:not-sr-only focus:absolute focus:left-2 focus:top-2 focus:z-20 focus:rounded focus:bg-background focus:px-3 focus:py-1.5 focus:text-sm",children:"Skip to section"}),(0,e.jsxs)("div",{className:"-m-4 flex h-full min-h-0 flex-col overflow-hidden md:-m-6",children:[(0,e.jsxs)("header",{className:"flex h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-6",children:[(0,e.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,e.jsx)("textarea",{ref:I,"data-autosize-title":!0,className:"min-w-0 flex-1 resize-none overflow-hidden bg-transparent text-base font-semibold leading-7 outline-none placeholder:text-muted-foreground/50",placeholder:"Routine title",rows:1,value:f.title,onChange:i(t=>{P(h=>({...h,title:t.target.value})),Ke(t.target)},"onChange"),onKeyDown:i(t=>{t.key==="Enter"&&!t.metaKey&&!t.ctrlKey&&!t.nativeEvent.isComposing&&(t.preventDefault(),w==="overview"?M.current?.focus():_("overview"))},"onKeyDown")}),o.managedByPlugin?(0,e.jsxs)(xe,{variant:"outline",className:"hidden shrink-0 gap-1.5 text-xs text-muted-foreground sm:inline-flex",children:[(0,e.jsx)(kt,{className:"h-3 w-3"}),o.managedByPlugin.pluginDisplayName,(0,e.jsx)("span",{className:"font-mono text-(length:--text-nano)",children:o.managedByPlugin.resourceKey})]}):null]}),(0,e.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-3",children:[(0,e.jsx)(ts,{onClick:i(()=>b(!0),"onClick"),disabled:Z.isPending}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(Pt,{size:"default",checked:$,onCheckedChange:Ae.onToggleAutomation,disabled:Se,"aria-label":$?"Pause automatic triggers":"Enable automatic triggers"}),(0,e.jsx)("span",{className:`text-sm font-medium ${Ce}`,children:Ie})]})]})]}),(0,e.jsx)(es,{activeSection:w,onNavigate:_,isSectionDirty:ne}),(0,e.jsxs)("div",{className:"flex min-h-0 flex-1",children:[(0,e.jsx)(us,{activeSection:w,hrefFor:i(t=>`/routines/${s}/${t}`,"hrefFor"),isSectionDirty:ne,hasLiveRun:d,onNavigate:i(t=>le(s,t),"onNavigate")}),(0,e.jsx)("main",{id:"routine-section",role:"main",className:"min-h-0 min-w-0 flex-1 overflow-y-auto px-4 pb-6 pt-10 md:px-8",children:(0,e.jsxs)("section",{"aria-labelledby":"routine-section-title",className:Pe?"mx-auto w-full max-w-3xl":"w-full",children:[(0,e.jsx)("h2",{id:"routine-section-title",className:"mb-4 text-lg font-semibold",children:Ds[w]}),w==="overview"&&(0,e.jsx)(Ss,{}),w==="triggers"&&(0,e.jsx)(Is,{}),w==="variables"&&(0,e.jsx)(Cs,{}),w==="secrets"&&(0,e.jsx)(As,{}),w==="delivery"&&(0,e.jsx)(Ps,{}),w==="runs"&&(0,e.jsx)(rs,{}),w==="activity"&&(0,e.jsx)(os,{}),w==="history"&&(0,e.jsx)(Vt,{}),Pe?(0,e.jsx)(Yt,{dirtyFields:J(w),isSaving:Y.isPending,saveConflict:q,onSave:i(()=>{!Y.isPending&&f.title.trim()&&Y.mutate()},"onSave"),onDiscard:i(()=>be(w),"onDiscard"),onReload:ke}):null]})})]})]}),(0,e.jsx)(ft,{open:g,onOpenChange:b,companyId:o.companyId,routineName:o.title,agents:F??[],projects:K??[],defaultProjectId:o.projectId,defaultAssigneeAgentId:o.assigneeAgentId,variables:o.variables??[],isPending:Z.isPending,onSubmit:i(t=>Z.mutate(t),"onSubmit")})]})}i(di,"RoutineDetail");export{di as RoutineDetail};
|