@wfgraph/client 2.2.1 → 2.2.2
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.
|
@@ -98,4 +98,4 @@ ${i}`;else if(r===`event`)n.event=i;else if(r===`id`)n.id=i;else if(r===`retry`)
|
|
|
98
98
|
`),t+=CZ(e.data),t+=`
|
|
99
99
|
`,t}var EZ=Symbol.for(`STANDARDSERVER_EVENT_META`),DZ=Symbol.for(`STANDARDSERVER_EVENT_SOURCE`);function OZ(e,t){let n;if(t.id!==void 0&&(yZ(t.id),n??={},n.id=t.id),t.retry!==void 0&&(xZ(t.retry),n??={},n.retry=t.retry),t.comments!==void 0){for(let e of t.comments)SZ(e);n??={},n.comments=t.comments}return n?new Proxy(e,{get(e,t,r){return t===DZ?e:t===EZ?n:IX(e,t)}}):e}function kZ(e){if(!PX(e))return[e,void 0];let t=e[EZ];return[e[DZ]??e,t]}function AZ(e){if(PX(e))return e[EZ]}function jZ(e){return`inline; filename="${e.replace(/[^\x20-\x7E]/g,`_`).replace(/"/g,`\\"`)}"; filename*=utf-8''${encodeURIComponent(e).replace(/['()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`).replace(/%(7C|60|5E)/g,(e,t)=>String.fromCharCode(Number.parseInt(t,16)))}`}function MZ(e){let t=e.match(/filename\*=(UTF-8'')?([^;]*)/i);if(t&&typeof t[2]==`string`)return LX(t[2]);let n=e.match(/filename="((?:\\"|[^"])*)"/i);if(n&&typeof n[1]==`string`)return n[1].replace(/\\"/g,`"`)}function NZ(e,t){let n={...e};for(let e in t)Array.isArray(t[e])?n[e]=[...EX(n[e]),...t[e]]:t[e]!==void 0&&(n[e]=Array.isArray(n[e])?[...n[e],t[e]]:n[e]===void 0?t[e]:[n[e],t[e]]);return n}function PZ(e){let t=e.indexOf(`#`),n=e.indexOf(`?`),r=n!==-1&&(t===-1||n<t),i=r?n:t===-1?e.length:t,a=t===-1?e.length:t;return[e.slice(0,i),r?e.slice(n,a):void 0,t===-1?void 0:e.slice(t)]}var FZ={BAD_REQUEST:400,UNAUTHORIZED:401,PAYMENT_REQUIRED:402,FORBIDDEN:403,NOT_FOUND:404,METHOD_NOT_SUPPORTED:405,NOT_ACCEPTABLE:406,TIMEOUT:408,CONFLICT:409,GONE:410,PRECONDITION_FAILED:412,PAYLOAD_TOO_LARGE:413,UNSUPPORTED_MEDIA_TYPE:415,UNPROCESSABLE_CONTENT:422,PRECONDITION_REQUIRED:428,TOO_MANY_REQUESTS:429,CLIENT_CLOSED_REQUEST:499,INTERNAL_SERVER_ERROR:500,NOT_IMPLEMENTED:501,BAD_GATEWAY:502,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504},IZ,LZ=class e extends Error{static{let t=Symbol.for(`ORPC_ERROR_CONSTRUCTORS`);globalThis[t]??=new WeakSet,IZ=globalThis[t],IZ.add(e)}name=`ORPCError`;defined=!1;inferable=!1;code;data;constructor(e,...t){let n=RX(t),r=n.message??e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `);super(r,n),this.code=e,this.data=n.data}toJSON(){return{defined:this.defined,inferable:this.inferable,code:this.code,message:this.message,data:this.data}}static[Symbol.hasInstance](e){if(!IZ.has(this))return super[Symbol.hasInstance](e);let t=tZ(e);return t&&IZ.has(t)?!0:super[Symbol.hasInstance](e)}};function RZ(e){return e instanceof LZ?e:new LZ(`INTERNAL_SERVER_ERROR`,{cause:e})}function zZ(e){if(!nZ(e))return!1;let t=[`defined`,`inferable`,`code`,`message`,`data`];return!Object.keys(e).some(e=>!t.includes(e))&&`defined`in e&&typeof e.defined==`boolean`&&`inferable`in e&&typeof e.inferable==`boolean`&&`code`in e&&typeof e.code==`string`&&`message`in e&&typeof e.message==`string`}function BZ(e,t={}){let n=new LZ(e.code,{...e,...t});return n.defined=e.defined,n.inferable=e.inferable,n}function VZ(e,{mapResult:t,mapError:n,...r}){return ZX(e,{...r,mapResult:t&&(async e=>{let n=await t(e);if(n.value!==e.value){let t=AZ(e.value);if(t&&PX(n.value))return{done:n.done,value:OZ(n.value,t)}}return n}),mapError:n&&(async e=>{let t=await n(e);if(t!==e){let n=AZ(e);if(n&&PX(t))return OZ(t,n)}return t})})}var HZ=/^\/(.*)\/([a-z]*)$/,UZ={undefined:{condition(e){return e===void 0},serialize(){return null},deserialize(){},isTerminal:!0},bigint:{condition(e){return typeof e==`bigint`},serialize(e){return e.toString()},deserialize(e){return BigInt(e)},isTerminal:!0},date:{condition(e){return e instanceof Date},serialize(e){return Number.isNaN(e.getTime())?null:e.toISOString()},deserialize(e){return new Date(e??`Invalid Date`)},isTerminal:!0},nan:{condition(e){return typeof e==`number`&&Number.isNaN(e)},serialize(){return null},deserialize(){return NaN},isTerminal:!0},url:{condition(e){return e instanceof URL},serialize(e){return e.toString()},deserialize(e){return new URL(e)},isTerminal:!0},regexp:{condition(e){return e instanceof RegExp},serialize(e){return e.toString()},deserialize(e){let[,t,n]=e.match(HZ);return new RegExp(t,n)},isTerminal:!0},set:{condition(e){return e instanceof Set},serialize(e){return Array.from(e)},deserialize(e){return new Set(e)}},map:{condition(e){return e instanceof Map},serialize(e){return Array.from(e.entries())},deserialize(e){return new Map(e)}}},WZ=class{handlers;omitUndefinedProperties;constructor(e={}){this.handlers={...UZ,...e.handlers},this.omitUndefinedProperties=e.omitUndefinedProperties!==!1}serialize(e){let[t,n,r,i]=this.serializeValue(e,[],[],[],[]),a=n.length===0?void 0:n;return r.length===0?{json:t,meta:a}:{json:t,meta:a,maps:r,blobs:i}}serializeValue(e,t,n,r,i){for(let a in this.handlers){let o=this.handlers[a];if(o&&o.condition(e)){let s=o.serialize(e);if(o.isTerminal)return n.push([a,...t]),[s,n,r,i];let c=this.serializeValue(s,t,n,r,i);return n.push([a,...t]),c}}if(e instanceof Blob)return r.push(t),i.push(e),[e,n,r,i];if(Array.isArray(e))return[e.map((e,a)=>this.serializeValue(e,[...t,a],n,r,i)[0]),n,r,i];if(nZ(e)){let a={};for(let o in e){let s=e[o];(o!==`toJSON`||typeof s!=`function`)&&(s===void 0&&this.omitUndefinedProperties||(a[o]=this.serializeValue(s,[...t,o],n,r,i)[0]))}return[a,n,r,i]}return[e,n,r,i]}deserialize(e){let t={data:e.json};return e.blobs?.length&&e.maps.forEach((n,r)=>{let i=t,a=`data`;n.forEach(e=>{if(i=i[a],a=e,!Object.hasOwn(i,a))throw Error(`Security error: Invalid serialized data. Segment "${a}" does not exist.`)}),i[a]=e.blobs[r]}),e.meta?.forEach(e=>{let n=e[0],r=t,i=`data`;for(let t=1;t<e.length;t++)if(r=r[i],i=e[t],!Object.hasOwn(r,i))throw Error(`Security error: Invalid serialized data. Segment "${i}" does not exist.`);r[i]=this.handlers[n].deserialize(r[i])}),t.data}},GZ=class{jsonSerializer;defaultSerializeOptions;constructor(e={}){this.jsonSerializer=new WZ(e),this.defaultSerializeOptions=e.serialize}serialize(e,t={}){return e===void 0||e instanceof ReadableStream||e instanceof Blob?e:kX(e)?VZ(e,{mapResult:e=>e.value===void 0?e:{done:e.done,value:this.serializeValue(e.value,t)},mapError:e=>new uZ(this.serializeValue(RZ(e).toJSON(),{...t,useFormDataForBlobFields:!1}),{cause:e})}):this.serializeValue(e,t)}serializeValue(e,t){let n=t.useFormDataForBlobFields??this.defaultSerializeOptions?.useFormDataForBlobFields??!0,{json:r,meta:i,maps:a,blobs:o}=this.jsonSerializer.serialize(e);if(!n||!o?.length)return{json:r,meta:i};let s=new FormData;return s.set(`data`,NX({json:r,meta:i,maps:a})),o.forEach((e,t)=>{s.set(t.toString(),e)}),s}deserialize(e){return e===void 0||e instanceof ReadableStream||e instanceof Blob?e:kX(e)?VZ(e,{mapResult:e=>e.value===void 0?e:{done:e.done,value:this.deserializeValue(e.value)},mapError:e=>{if(!(e instanceof uZ))return e;let t=this.deserializeValue(e.data);return zZ(t)?BZ(t,{cause:e}):new uZ(t,{cause:e})}}):this.deserializeValue(e)}deserializeValue(e){if(!(e instanceof FormData))return this.jsonSerializer.deserialize(e);let t=JSON.parse(e.get(`data`)),n=[];for(let[t,r]of e)r instanceof Blob&&(n[Number(t)]=r);return this.jsonSerializer.deserialize({...t,blobs:n})}},KZ=new Set([`then`,`bind`,`valueOf`,`toString`,`toJSON`]);function qZ(e){return{...e,context:e.context??{}}}function JZ(e){return[e[0],qZ(e[1]??{})]}function YZ(e,{path:t=[],...n}={}){return new Proxy((...r)=>{let[i,a]=JZ(r);return oZ([...EX(n.interceptors),...EX(n.scoped?.interceptors)],{...a,input:i,path:t},({path:t,input:n,...r})=>e.call(t,n,r))},{get(r,i){if(typeof i!=`string`||KZ.has(i))return IX(r,i);let a=n.scoped===void 0?void 0:n.scoped[i];return YZ(e,{...n,path:[...t,i],scoped:a})}})}var XZ=class{constructor(e=[]){this.plugins=e,this.plugins=sZ(e)}name=`~composite`;init(e){for(let t of this.plugins)t.init&&(e=t.init(e));return e}initProcedureOptions(e,t){for(let n of this.plugins)n.initProcedureOptions&&(t=n.initProcedureOptions(e,t));return t}};function ZZ(e,t={}){return[...t.prefix===void 0?[]:[t.prefix],e,{...t.input===void 0?{}:{input:t.input},...t.type===void 0?{}:{type:t.type},...t.fnOptions===void 0?{}:{fnOptions:t.fnOptions}}]}function QZ(e){return async t=>{let n=await e(t),r;for await(let e of n)t.signal?.throwIfAborted(),r={chunk:e},t.client.setQueryData(t.queryKey,e);if(!r)throw TypeError(`Live query for ${NX(t.queryKey)} did not yield any data. Ensure the query function returns an AsyncIterable with at least one chunk.`);return r.chunk}}var $Z=class{constructor(e,t){this.path=e,this.options=t}key(e={}){return ZZ(this.path,{...e,prefix:this.options.prefix})}};function eQ(e,{refetchMode:t=`reset`,maxChunks:n=1/0}={}){return async r=>{let i=r.client.getQueryCache().find({queryKey:r.queryKey,exact:!0}),a=!!i&&i.state.data!==void 0;a&&(t===`reset`?i.setState({status:`pending`,data:void 0,error:null,fetchStatus:`fetching`}):r.client.setQueryData(r.queryKey,(e=[])=>tQ(e,n)));let o=[],s=await e(r),c=!a||t!==`replace`;r.client.setQueryData(r.queryKey,(e=[])=>tQ(e,n));for await(let e of s){if(r.signal.aborted)throw r.signal.reason;o.push(e),o=tQ(o,n),c&&r.client.setQueryData(r.queryKey,(t=[])=>tQ([...t,e],n))}c||r.client.setQueryData(r.queryKey,o);let l=r.client.getQueryData(r.queryKey);return l?tQ(l,n):o}}function tQ(e,t){return e.length<=t?e:e.slice(e.length-t)}var nQ=Symbol.for(`ORPC_TANSTACK_QUERY_OPERATION_CONTEXT`),rQ=[`queryInterceptors`,`streamedInterceptors`,`liveInterceptors`,`infiniteInterceptors`,`mutationInterceptors`],iQ=[`queryKey`,`queryOptions`,`streamedKey`,`streamedOptions`,`liveKey`,`liveOptions`,`infiniteKey`,`infiniteOptions`,`mutationKey`,`mutationOptions`];function aQ(e){if(!PX(e))return!1;for(let t in e)if(e[t]!==void 0){if(t===`prefix`){if(typeof e[t]!=`string`)return!1}else if(rQ.includes(t)){if(!Array.isArray(e[t])||e[t].some(e=>typeof e!=`function`))return!1}else if(iQ.includes(t)&&!PX(e[t]))return!1}return!0}function oQ(e,t){if(typeof e!=`function`&&typeof t!=`function`)return{...e,...t};let n=typeof e==`function`?e:t=>({...e,...t}),r=typeof t==`function`?t:e=>({...t,...e});return e=>r(n(e))}function sQ(e,t){let n={...e,...t};for(let r of rQ){let i=e[r],a=t[r];i&&a&&(n[r]=[...i,...a])}for(let r of iQ){let i=e[r],a=t[r];i&&a&&(n[r]=oQ(i,a))}return n}var cQ=class extends $Z{call;constructor(e,t,n={}){super(e,n),this.call=t}queryKey(...e){let t=RX(e);return typeof this.options.queryKey==`function`?t=this.options.queryKey(t):this.options.queryKey&&(t={...this.options.queryKey,...t}),t.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`query`,input:t.input})}queryOptions(...e){let t=RX(e);typeof this.options.queryOptions==`function`?t=this.options.queryOptions(t):this.options.queryOptions&&(t={...this.options.queryOptions,...t});let n=this.queryKey(t);return{...t,queryKey:n,queryFn:e=>oZ(this.options.queryInterceptors,{path:this.path,context:{[nQ]:{key:n,type:`query`},...t.context},input:t.input,fnContext:e},({context:e,input:n,fnContext:r})=>{if(n===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(r):this.call(n,{signal:r.signal,context:e})}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}streamedKey(...e){let t=RX(e);return typeof this.options.streamedKey==`function`?t=this.options.streamedKey(t):this.options.streamedKey&&(t={...this.options.streamedKey,...t}),t.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`streamed`,input:t.input,fnOptions:t.queryFnOptions})}streamedOptions(...e){let t=RX(e);typeof this.options.streamedOptions==`function`?t=this.options.streamedOptions(t):this.options.streamedOptions&&(t={...this.options.streamedOptions,...t});let n=this.streamedKey(t);return{...t,queryKey:n,queryFn:e=>oZ(EX(this.options.streamedInterceptors),{path:this.path,context:{[nQ]:{key:n,type:`streamed`},...t.context},input:t.input,fnContext:e},({context:e,fnContext:n,input:r})=>{if(r===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(n):eQ(async t=>{let n=await this.call(r,{signal:t.signal,context:e});if(!kX(n))throw Error(`streamedQuery requires an AsyncIteratorObject output`);return n},t.queryFnOptions)(n)}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}liveKey(...e){let t=RX(e);return typeof this.options.liveKey==`function`?t=this.options.liveKey(t):this.options.liveKey&&(t={...this.options.liveKey,...t}),t.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`live`,input:t.input})}liveOptions(...e){let t=RX(e);typeof this.options.liveOptions==`function`?t=this.options.liveOptions(t):this.options.liveOptions&&(t={...this.options.liveOptions,...t});let n=this.liveKey(t);return{...t,queryKey:n,queryFn:e=>oZ(EX(this.options.liveInterceptors),{path:this.path,context:{[nQ]:{key:n,type:`live`},...t.context},input:t.input,fnContext:e},({fnContext:e,input:n,context:r})=>{if(n===B||t.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return t.queryFn?t.queryFn(e):QZ(async e=>{let t=await this.call(n,{signal:e.signal,context:r});if(!kX(t))throw Error(`liveQuery requires an AsyncIteratorObject output`);return t})(e)}),...t.input===B||t.queryFn===B?{enabled:!1}:{}}}infiniteKey(e){return typeof this.options.infiniteKey==`function`?e=this.options.infiniteKey(e):this.options.infiniteKey&&(e={...this.options.infiniteKey,...e}),e.queryKey??ZZ(this.path,{prefix:this.options.prefix,type:`infinite`,input:e.input===B?B:e.input(e.initialPageParam)})}infiniteOptions(e){typeof this.options.infiniteOptions==`function`?e=this.options.infiniteOptions(e):this.options.infiniteOptions&&(e={...this.options.infiniteOptions,...e});let t=this.infiniteKey(e);return{...e,queryKey:t,queryFn:n=>oZ(EX(this.options.infiniteInterceptors),{path:this.path,context:{[nQ]:{key:t,type:`infinite`},...e.context},input:e.input===B?B:e.input(n.pageParam),fnContext:n},({context:t,input:n,fnContext:r})=>{if(n===B||e.queryFn===B)throw Error(`queryFn should not be called when skipToken used for skipping`);return e.queryFn?e.queryFn(r):this.call(n,{signal:r.signal,context:t})}),...e.input===B||e.queryFn===B?{enabled:!1}:{}}}mutationKey(e={}){return typeof this.options.mutationKey==`function`?e=this.options.mutationKey(e):this.options.mutationKey&&(e={...this.options.mutationKey,...e}),e.mutationKey??ZZ(this.path,{prefix:this.options.prefix,type:`mutation`})}mutationOptions(...e){let t=RX(e);typeof this.options.mutationOptions==`function`?t=this.options.mutationOptions(t):this.options.mutationOptions&&(t={...this.options.mutationOptions,...t});let n=this.mutationKey(t);return{...t,mutationKey:n,mutationFn:(e,r)=>oZ(EX(this.options.mutationInterceptors),{path:this.path,context:{[nQ]:{key:n,type:`mutation`},...t.context},fnContext:r,input:e},({input:e,fnContext:n,context:r})=>t.mutationFn?t.mutationFn(e,n):this.call(e,{context:r}))}}};function lQ(e,t={}){let n=new XZ(t.plugins);return t=n.init(t),uQ(e,t,n)}function uQ(e,t,n){let r=EX(t.path),i=typeof e==`function`&&(t.scoped===void 0||aQ(t.scoped))?aZ(new cQ(r,e,n.initProcedureOptions(r,sQ({prefix:t.prefix,queryInterceptors:t.queryInterceptors,streamedInterceptors:t.streamedInterceptors,liveInterceptors:t.liveInterceptors,infiniteInterceptors:t.infiniteInterceptors,mutationInterceptors:t.mutationInterceptors},t.scoped??{})))):aZ(new $Z(r,t));return new Proxy(i,{get(i,a){let o=IX(i,a),s=e[a];if(typeof a!=`string`||KZ.has(a)||!PX(s))return o;let c=uQ(s,{...t,path:[...r,a],scoped:rZ(t.scoped,[a])},n);return typeof o==`function`?new Proxy(o,{get(e,t){return typeof t!=`string`||KZ.has(t)?IX(e,t):IX(c,t)}}):c}})}function dQ(e){let t=(e?.pipeThrough(new TextDecoderStream).pipeThrough(new gZ))?.getReader(),n=!1;return new jX(async()=>{for(;;){if(t===void 0)return{done:!0,value:void 0};let{done:e,value:r}=await t.read();if(e){if(n)throw new DX(`Stream was cancelled`);return{done:!0,value:void 0}}switch(r.event){case`message`:{let e=MX(r.data);return PX(e)&&(e=OZ(e,r)),{done:!1,value:e}}case`error`:{let e=new uZ(MX(r.data));throw e=OZ(e,r),e}case`close`:{let e=MX(r.data);return PX(e)&&(e=OZ(e,r)),{done:!0,value:e}}}}},async e=>{e.kind===`cancelled`&&(n=!0),await t?.cancel()})}function fQ(e,t={}){let n=t.keepAlive?.enabled??!0,r=t.keepAlive?.interval??15e3,i=t.keepAlive?.comment??``,a=t.initialComment?.enabled??!0,o=t.initialComment?.comment??``,s=t.emptyCloseEventEnabled??!0,c=!1,l;return new ReadableStream({start(e){a&&e.enqueue(TZ({comments:[o]}))},async pull(t){try{n&&(l=setInterval(()=>{t.enqueue(TZ({comments:[i]}))},r));let a=await e.next();if(clearInterval(l),c)return;let[o,u]=kZ(a.value);if(!a.done||o!==void 0||u!==void 0||s){let e=a.done?`close`:`message`;t.enqueue(TZ({...u,event:e,data:NX(o)}))}a.done&&t.close()}catch(e){if(clearInterval(l),c)return;e instanceof uZ?(t.enqueue(TZ({...AZ(e),event:`error`,data:NX(e.data)})),t.close()):t.error(e)}},async cancel(){c=!0,clearInterval(l),await e.return?.()}}).pipeThrough(new TextEncoderStream)}async function pQ(e,t){let n=t?.hint??e.headers.get(`standard-server`),r=e.headers.get(`content-type`)?.split(`;`)[0]?.trim(),i=e.headers.get(`content-length`);if(n!==`none`&&(n!==null||r!==void 0||i!==`0`&&i!==null)&&(n!==null||e.body!==null)){if(e.bodyUsed)throw TypeError(`Failed to read body: body stream already read`);if(n===`json`||n===null&&r===`application/json`)return MX(await e.text());if(n===`form-data`||n===null&&r===`multipart/form-data`)return await e.formData();if(n===`url-search-params`||n===null&&r===`application/x-www-form-urlencoded`){let t=await e.text();return new URLSearchParams(t)}if(n===`event-stream`||n===null&&r===`text/event-stream`)return dQ(e.body);if(n===`file`||n===null&&i!==null){let t=e.headers.get(`content-disposition`),n=t===null?void 0:MZ(t),r=await e.blob();return new File([r],n??`blob`,{type:r.type})}return e.body??new ReadableStream({start(e){e.close()}})}}function mQ(e,t,n={}){return t={...t},e instanceof ReadableStream?(t[`standard-server`]??=`octet-stream`,t[`content-type`]??=`application/octet-stream`,[e,t]):e instanceof Blob?(t[`standard-server`]??=`file`,t[`content-type`]=e.type,t[`content-disposition`]??=jZ(e instanceof File?e.name:`blob`),Number.isFinite(e.size)?(t[`content-length`]=e.size.toString(),[e,t]):[e.stream(),t]):(t[`standard-server`]=void 0,t[`content-length`]=void 0,e===void 0?(t[`content-type`]=void 0,[void 0,t]):e instanceof FormData||e instanceof URLSearchParams?(t[`content-type`]=void 0,[e,t]):kX(e)?(t[`content-type`]=`text/event-stream`,[fQ(e,n.eventStream),t]):(t[`content-type`]=`application/json`,[NX(e),t]))}function hQ(e){let t={};return e.forEach((e,n)=>{Array.isArray(t[n])?t[n].push(e):t[n]===void 0?t[n]=e:t[n]=[t[n],e]}),t}function gQ(e){let t=new Headers;for(let[n,r]of Object.entries(e))if(Array.isArray(r))for(let e of r)t.append(n,e);else r!==void 0&&t.append(n,r);return t}function _Q(e){return{resolveBody:t=>pQ(e,{hint:t}),status:e.status,get headers(){let t=hQ(e.headers);return Object.defineProperty(this,"headers",{value:t,writable:!0}),t},set headers(e){Object.defineProperty(this,"headers",{value:e,writable:!0})}}}var vQ=class{name=`~composite`;plugins;constructor(e=[]){this.plugins=sZ(e)}init(e){for(let t of this.plugins)t.init&&(e=t.init(e));return e}},yQ=class{constructor(e,t,n={}){this.codec=e,this.transport=t,n=new vQ(n.plugins).init(n),this.interceptors=n.interceptors,this.transportInterceptors=n.transportInterceptors}interceptors;transportInterceptors;call(e,t,n){return YX(`${zX}.${e.join(`/`)}`,r=>(r?.setAttribute(`rpc.system`,zX),r?.setAttribute(`rpc.method`,e.join(`.`)),kX(t)&&(t=eZ(t,QX(`consume_async_iterator_object_input`,t))),oZ(this.interceptors,{...n,path:e,input:t},async({path:e,input:t,...n})=>{let i=GX(),a,o=i?.trace.getActiveSpan()??r;o&&i&&(a=i.trace.setSpan(i.context.active(),o));let s=await YX({name:`encode_input`,context:a},()=>this.codec.encodeInput(t,e,n));if(a&&i?.propagation){let e={...s.headers};i.propagation.inject(a,e),s={...s,headers:e}}let c=await oZ(this.transportInterceptors,{...n,path:e,request:s},({path:e,request:t,...n})=>{let r,a=i?.trace.getActiveSpan()??o;return a&&i&&(r=i.trace.setSpan(i.context.active(),a)),YX({name:`send_request`,context:r},()=>this.transport.send(t,e,n))}),l=await YX({name:`decode_response`,context:a},()=>this.codec.decodeResponse(c,e,n));if(l.kind===`error`)throw l.error;let u=l.output;return kX(u)?eZ(u,QX(`consume_async_iterator_object_output`,u)):u})))}},bQ=/\/$/,xQ=class{baseUrl;maxUrlLength;fallbackMethod;expectedMethod;headers;serializer;constructor(e){this.baseUrl=e.url??`/`,this.maxUrlLength=e.maxUrlLength??2083,this.fallbackMethod=e.fallbackMethod??`POST`,this.expectedMethod=e.method??this.fallbackMethod,this.headers=e.headers??{},this.serializer=e.serializer??new GZ}async encodeInput(e,t,n){let r=SQ(await $X(this.headers,n,t,e));n.lastEventId!==void 0&&(r=NZ(r,{"last-event-id":n.lastEventId}));let i=await $X(this.expectedMethod,n,t,e),[a,o,s]=PZ(await $X(this.baseUrl,n,t,e)),c=`${a.replace(bQ,``)}${HX(t)}`,l=this.serializer.serialize(e);if(i===`GET`&&!(l instanceof Blob)&&!(l instanceof ReadableStream)&&!(l instanceof FormData)&&!kX(l)){let a=await $X(this.maxUrlLength,n,t,e),u=new URLSearchParams(o);u.append(`data`,NX(l)??``);let d=`${c}?${u}${s??``}`;if(d.length<=a)return{body:void 0,method:i,headers:r,url:d,signal:n.signal}}return{url:`${c}${o??``}${s??``}`,method:i===`GET`?this.fallbackMethod:i,headers:r,body:l,signal:n.signal}}async decodeResponse(e){let t=e.status<400,n=await e.resolveBody(),r=await(async()=>{try{return this.serializer.deserialize(n)}catch(e){throw Error(`Invalid RPC response format.`,{cause:e})}})();return t?{kind:`output`,output:r}:zZ(r)?{kind:`error`,error:BZ(r)}:{kind:`error`,error:new LZ(`MALFORMED_ORPC_ERROR_RESPONSE`,{data:{headers:e.headers,status:e.status,body:r}})}}};function SQ(e){return typeof e.forEach==`function`?hQ(e):e}var CQ=class{constructor(e=[]){this.plugins=e,this.plugins=sZ(e)}name=`~composite/fetch-link-transport`;initFetchLinkTransportOptions(e){for(let t of this.plugins)t.initFetchLinkTransportOptions&&(e=t.initFetchLinkTransportOptions(e));return e}},wQ=VX(()=>{try{let e;return new Request(`https://example.com`,{method:`POST`,body:new ReadableStream,get duplex(){return e=`half`,`half`}}),e}catch{return}}),TQ=class{origin;fetch;toFetchRequestOptions;fetchInterceptors;constructor(e){e=new CQ(e.plugins).initFetchLinkTransportOptions(e),this.origin=e.origin,this.fetch=e.fetch??globalThis.fetch.bind(globalThis),this.toFetchRequestOptions=e.toFetchRequest,this.fetchInterceptors=e.fetchInterceptors}async send(e,t,n){let r=await $X(this.origin,n,t);r?.endsWith(`/`)&&(r=r.slice(0,-1));let i=`${r??``}${e.url}`,[a,o]=mQ(e.body,e.headers,this.toFetchRequestOptions),s={body:a,headers:gQ(o),method:e.method,signal:n.signal,redirect:`manual`};if(a instanceof ReadableStream){let e=wQ();e!==void 0&&(s.duplex=e)}return _Q(await oZ(this.fetchInterceptors,{...n,url:i,path:t,init:s},({url:e,path:t,init:n,...r})=>this.fetch(e,n,r,t)))}},EQ=class extends yQ{constructor(e){let t=new xQ(e),n=new TQ(e);super(t,n,e)}};function DQ(e){return e==null}function OQ(e,t){let n={},r=Object.keys(e);for(let i=0;i<r.length;i++){let a=r[i],o=e[a];t(o,a)||(n[a]=o)}return n}function kQ(e){if(typeof e==`string`)return e.trim()||void 0}function AQ(e){return Array.isArray(e)?e.flatMap(e=>{let t=kQ(e);return t?[t]:[]}):[]}function jQ(e,t=`Request failed`){let n=kQ(e);if(n)return n;if(typeof e!=`object`||!e)return t;let r=e,i=kQ(r.error)??kQ(r.message)??kQ(r.details)??t;if(r.code===`integration_validation_failed`){let e=AQ(r.invalidIntegrationIds);if(e.length>0)return`${i} (invalid integration IDs: ${e.join(`, `)})`}return i}var MQ=s(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}}))();function NQ(){let e=arguments[0];for(let t=1,n=arguments.length;t<n;t++)if(arguments[t])for(let n in arguments[t])e[n]=arguments[t][n];return e}var PQ=NQ;typeof Object.assign==`function`&&(PQ=Object.assign);function FQ(e,t,n,r){let i=e._nodes.get(t),a=null;return i&&(a=r===`mixed`?i.out&&i.out[n]||i.undirected&&i.undirected[n]:r===`directed`?i.out&&i.out[n]:i.undirected&&i.undirected[n]),a}function IQ(e){return typeof e==`object`&&!!e}function LQ(e){let t;for(t in e)return!1;return!0}function RQ(e,t,n){Object.defineProperty(e,t,{enumerable:!1,configurable:!1,writable:!0,value:n})}function zQ(e,t,n){let r={enumerable:!0,configurable:!0};typeof n==`function`?r.get=n:(r.value=n,r.writable=!1),Object.defineProperty(e,t,r)}function BQ(e){return!(!IQ(e)||e.attributes&&!Array.isArray(e.attributes))}function VQ(){let e=Math.floor(Math.random()*256)&255;return()=>e++}function HQ(){let e=arguments,t=null,n=-1;return{[Symbol.iterator](){return this},next(){let r=null;do{if(t===null){if(n++,n>=e.length)return{done:!0};t=e[n][Symbol.iterator]()}if(r=t.next(),r.done){t=null;continue}break}while(!0);return r}}}function UQ(){return{[Symbol.iterator](){return this},next(){return{done:!0}}}}var WQ=class extends Error{constructor(e){super(),this.name=`GraphError`,this.message=e}},GQ=class e extends WQ{constructor(t){super(t),this.name=`InvalidArgumentsGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},KQ=class e extends WQ{constructor(t){super(t),this.name=`NotFoundGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}},qQ=class e extends WQ{constructor(t){super(t),this.name=`UsageGraphError`,typeof Error.captureStackTrace==`function`&&Error.captureStackTrace(this,e.prototype.constructor)}};function JQ(e,t){this.key=e,this.attributes=t,this.clear()}JQ.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.undirectedDegree=0,this.undirectedLoops=0,this.directedLoops=0,this.in={},this.out={},this.undirected={}};function YQ(e,t){this.key=e,this.attributes=t,this.clear()}YQ.prototype.clear=function(){this.inDegree=0,this.outDegree=0,this.directedLoops=0,this.in={},this.out={}};function XQ(e,t){this.key=e,this.attributes=t,this.clear()}XQ.prototype.clear=function(){this.undirectedDegree=0,this.undirectedLoops=0,this.undirected={}};function ZQ(e,t,n,r,i){this.key=t,this.attributes=i,this.undirected=e,this.source=n,this.target=r}ZQ.prototype.attach=function(){let e=`out`,t=`in`;this.undirected&&(e=t=`undirected`);let n=this.source.key,r=this.target.key;this.source[e][r]=this,!(this.undirected&&n===r)&&(this.target[t][n]=this)},ZQ.prototype.attachMulti=function(){let e=`out`,t=`in`,n=this.source.key,r=this.target.key;this.undirected&&(e=t=`undirected`);let i=this.source[e],a=i[r];if(a===void 0){i[r]=this,this.undirected&&n===r||(this.target[t][n]=this);return}a.previous=this,this.next=a,i[r]=this,this.target[t][n]=this},ZQ.prototype.detach=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),delete this.source[n][t],delete this.target[r][e]},ZQ.prototype.detachMulti=function(){let e=this.source.key,t=this.target.key,n=`out`,r=`in`;this.undirected&&(n=r=`undirected`),this.previous===void 0?this.next===void 0?(delete this.source[n][t],delete this.target[r][e]):(this.next.previous=void 0,this.source[n][t]=this.next,this.target[r][e]=this.next):(this.previous.next=this.next,this.next!==void 0&&(this.next.previous=this.previous))};var QQ=0,$Q=1,e$=2,t$=3;function n$(e,t,n,r,i,a,o){let s,c,l,u;if(r=``+r,n===QQ){if(s=e._nodes.get(r),!s)throw new KQ(`Graph.${t}: could not find the "${r}" node in the graph.`);l=i,u=a}else if(n===t$){if(i=``+i,c=e._edges.get(i),!c)throw new KQ(`Graph.${t}: could not find the "${i}" edge in the graph.`);let n=c.source.key,d=c.target.key;if(r===n)s=c.target;else if(r===d)s=c.source;else throw new KQ(`Graph.${t}: the "${r}" node is not attached to the "${i}" edge (${n}, ${d}).`);l=a,u=o}else{if(c=e._edges.get(r),!c)throw new KQ(`Graph.${t}: could not find the "${r}" edge in the graph.`);s=n===$Q?c.source:c.target,l=i,u=a}return[s,l,u]}function r$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);return a.attributes[o]}}function i$(e,t,n){e.prototype[t]=function(e,r){let[i]=n$(this,t,n,e,r);return i.attributes}}function a$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);return a.attributes.hasOwnProperty(o)}}function o$(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=n$(this,t,n,e,r,i,a);return o.attributes[s]=c,this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function s$(e,t,n){e.prototype[t]=function(e,r,i,a){let[o,s,c]=n$(this,t,n,e,r,i,a);if(typeof c!=`function`)throw new GQ(`Graph.${t}: updater should be a function.`);let l=o.attributes;return l[s]=c(l[s]),this.emit(`nodeAttributesUpdated`,{key:o.key,type:`set`,attributes:o.attributes,name:s}),this}}function c$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);return delete a.attributes[o],this.emit(`nodeAttributesUpdated`,{key:a.key,type:`remove`,attributes:a.attributes,name:o}),this}}function l$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);if(!IQ(o))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return a.attributes=o,this.emit(`nodeAttributesUpdated`,{key:a.key,type:`replace`,attributes:a.attributes}),this}}function u$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);if(!IQ(o))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return PQ(a.attributes,o),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`merge`,attributes:a.attributes,data:o}),this}}function d$(e,t,n){e.prototype[t]=function(e,r,i){let[a,o]=n$(this,t,n,e,r,i);if(typeof o!=`function`)throw new GQ(`Graph.${t}: provided updater is not a function.`);return a.attributes=o(a.attributes),this.emit(`nodeAttributesUpdated`,{key:a.key,type:`update`,attributes:a.attributes}),this}}var f$=[{name:e=>`get${e}Attribute`,attacher:r$},{name:e=>`get${e}Attributes`,attacher:i$},{name:e=>`has${e}Attribute`,attacher:a$},{name:e=>`set${e}Attribute`,attacher:o$},{name:e=>`update${e}Attribute`,attacher:s$},{name:e=>`remove${e}Attribute`,attacher:c$},{name:e=>`replace${e}Attributes`,attacher:l$},{name:e=>`merge${e}Attributes`,attacher:u$},{name:e=>`update${e}Attributes`,attacher:d$}];function p$(e){f$.forEach(function({name:t,attacher:n}){n(e,t(`Node`),QQ),n(e,t(`Source`),$Q),n(e,t(`Target`),e$),n(e,t(`Opposite`),t$)})}function m$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes[r]}}function h$(e,t,n){e.prototype[t]=function(e){let r;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>1){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let i=``+e,a=``+arguments[1];if(r=FQ(this,i,a,n),!r)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${i}" - "${a}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,r=this._edges.get(e),!r)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return r.attributes}}function g$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return i.attributes.hasOwnProperty(r)}}function _$(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=FQ(this,o,s,n),!a)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return a.attributes[r]=i,this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function v$(e,t,n){e.prototype[t]=function(e,r,i){let a;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>3){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let o=``+e,s=``+r;if(r=arguments[2],i=arguments[3],a=FQ(this,o,s,n),!a)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${o}" - "${s}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,a=this._edges.get(e),!a)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof i!=`function`)throw new GQ(`Graph.${t}: updater should be a function.`);return a.attributes[r]=i(a.attributes[r]),this.emit(`edgeAttributesUpdated`,{key:a.key,type:`set`,attributes:a.attributes,name:r}),this}}function y$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}return delete i.attributes[r],this.emit(`edgeAttributesUpdated`,{key:i.key,type:`remove`,attributes:i.attributes,name:r}),this}}function b$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!IQ(r))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return i.attributes=r,this.emit(`edgeAttributesUpdated`,{key:i.key,type:`replace`,attributes:i.attributes}),this}}function x$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(!IQ(r))throw new GQ(`Graph.${t}: provided attributes are not a plain object.`);return PQ(i.attributes,r),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`merge`,attributes:i.attributes,data:r}),this}}function S$(e,t,n){e.prototype[t]=function(e,r){let i;if(this.type!==`mixed`&&n!==`mixed`&&n!==this.type)throw new qQ(`Graph.${t}: cannot find this type of edges in your ${this.type} graph.`);if(arguments.length>2){if(this.multi)throw new qQ(`Graph.${t}: cannot use a {source,target} combo when asking about an edge's attributes in a MultiGraph since we cannot infer the one you want information about.`);let a=``+e,o=``+r;if(r=arguments[2],i=FQ(this,a,o,n),!i)throw new KQ(`Graph.${t}: could not find an edge for the given path ("${a}" - "${o}").`)}else{if(n!==`mixed`)throw new qQ(`Graph.${t}: calling this method with only a key (vs. a source and target) does not make sense since an edge with this key could have the other type.`);if(e=``+e,i=this._edges.get(e),!i)throw new KQ(`Graph.${t}: could not find the "${e}" edge in the graph.`)}if(typeof r!=`function`)throw new GQ(`Graph.${t}: provided updater is not a function.`);return i.attributes=r(i.attributes),this.emit(`edgeAttributesUpdated`,{key:i.key,type:`update`,attributes:i.attributes}),this}}var C$=[{name:e=>`get${e}Attribute`,attacher:m$},{name:e=>`get${e}Attributes`,attacher:h$},{name:e=>`has${e}Attribute`,attacher:g$},{name:e=>`set${e}Attribute`,attacher:_$},{name:e=>`update${e}Attribute`,attacher:v$},{name:e=>`remove${e}Attribute`,attacher:y$},{name:e=>`replace${e}Attributes`,attacher:b$},{name:e=>`merge${e}Attributes`,attacher:x$},{name:e=>`update${e}Attributes`,attacher:S$}];function w$(e){C$.forEach(function({name:t,attacher:n}){n(e,t(`Edge`),`mixed`),n(e,t(`DirectedEdge`),`directed`),n(e,t(`UndirectedEdge`),`undirected`)})}var T$=[{name:`edges`,type:`mixed`},{name:`inEdges`,type:`directed`,direction:`in`},{name:`outEdges`,type:`directed`,direction:`out`},{name:`inboundEdges`,type:`mixed`,direction:`in`},{name:`outboundEdges`,type:`mixed`,direction:`out`},{name:`directedEdges`,type:`directed`},{name:`undirectedEdges`,type:`undirected`}];function E$(e,t,n,r){let i=!1;for(let a in t){if(a===r)continue;let o=t[a];if(i=n(o.key,o.attributes,o.source.key,o.target.key,o.source.attributes,o.target.attributes,o.undirected),e&&i)return o.key}}function D$(e,t,n,r){let i,a,o,s=!1;for(let c in t)if(c!==r){i=t[c];do{if(a=i.source,o=i.target,s=n(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected),e&&s)return i.key;i=i.next}while(i!==void 0)}}function O$(e,t){let n=Object.keys(e),r=n.length,i,a=0;return{[Symbol.iterator](){return this},next(){do if(i)i=i.next;else{if(a>=r)return{done:!0};let o=n[a++];if(o===t){i=void 0;continue}i=e[o]}while(!i);return{done:!1,value:{edge:i.key,attributes:i.attributes,source:i.source.key,target:i.target.key,sourceAttributes:i.source.attributes,targetAttributes:i.target.attributes,undirected:i.undirected}}}}}function k$(e,t,n,r){let i=t[n];if(!i)return;let a=i.source,o=i.target;if(r(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected)&&e)return i.key}function A$(e,t,n,r){let i=t[n];if(!i)return;let a=!1;do{if(a=r(i.key,i.attributes,i.source.key,i.target.key,i.source.attributes,i.target.attributes,i.undirected),e&&a)return i.key;i=i.next}while(i!==void 0)}function j$(e,t){let n=e[t];if(n.next!==void 0)return{[Symbol.iterator](){return this},next(){if(!n)return{done:!0};let e={edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected};return n=n.next,{done:!1,value:e}}};let r=!1;return{[Symbol.iterator](){return this},next(){return r===!0?{done:!0}:(r=!0,{done:!1,value:{edge:n.key,attributes:n.attributes,source:n.source.key,target:n.target.key,sourceAttributes:n.source.attributes,targetAttributes:n.target.attributes,undirected:n.undirected}})}}}function M$(e,t){if(e.size===0)return[];if(t===`mixed`||t===e.type)return Array.from(e._edges.keys());let n=t===`undirected`?e.undirectedSize:e.directedSize,r=Array(n),i=t===`undirected`,a=e._edges.values(),o=0,s,c;for(;s=a.next(),s.done!==!0;)c=s.value,c.undirected===i&&(r[o++]=c.key);return r}function N$(e,t,n,r){if(t.size===0)return;let i=n!==`mixed`&&n!==t.type,a=n===`undirected`,o,s,c=!1,l=t._edges.values();for(;o=l.next(),o.done!==!0;){if(s=o.value,i&&s.undirected!==a)continue;let{key:t,attributes:n,source:l,target:u}=s;if(c=r(t,n,l.key,u.key,l.attributes,u.attributes,s.undirected),e&&c)return t}}function P$(e,t){if(e.size===0)return UQ();let n=t!==`mixed`&&t!==e.type,r=t===`undirected`,i=e._edges.values();return{[Symbol.iterator](){return this},next(){let e,t;for(;;){if(e=i.next(),e.done)return e;if(t=e.value,!(n&&t.undirected!==r))break}return{value:{edge:t.key,attributes:t.attributes,source:t.source.key,target:t.target.key,sourceAttributes:t.source.attributes,targetAttributes:t.target.attributes,undirected:t.undirected},done:!1}}}}function F$(e,t,n,r,i,a){let o=t?D$:E$,s;if(n!==`undirected`&&(r!==`out`&&(s=o(e,i.in,a),e&&s)||r!==`in`&&(s=o(e,i.out,a,r?void 0:i.key),e&&s))||n!==`directed`&&(s=o(e,i.undirected,a),e&&s))return s}function I$(e,t,n,r){let i=[];return F$(!1,e,t,n,r,function(e){i.push(e)}),i}function L$(e,t,n){let r=UQ();return e!==`undirected`&&(t!==`out`&&n.in!==void 0&&(r=HQ(r,O$(n.in))),t!==`in`&&n.out!==void 0&&(r=HQ(r,O$(n.out,t?void 0:n.key)))),e!==`directed`&&n.undirected!==void 0&&(r=HQ(r,O$(n.undirected))),r}function R$(e,t,n,r,i,a,o){let s=n?A$:k$,c;if(t!==`undirected`&&(i.in!==void 0&&r!==`out`&&(c=s(e,i.in,a,o),e&&c)||i.out!==void 0&&r!==`in`&&(r||i.key!==a)&&(c=s(e,i.out,a,o),e&&c))||t!==`directed`&&i.undirected!==void 0&&(c=s(e,i.undirected,a,o),e&&c))return c}function z$(e,t,n,r,i){let a=[];return R$(!1,e,t,n,r,i,function(e){a.push(e)}),a}function B$(e,t,n,r){let i=UQ();return e!==`undirected`&&(n.in!==void 0&&t!==`out`&&r in n.in&&(i=HQ(i,j$(n.in,r))),n.out!==void 0&&t!==`in`&&r in n.out&&(t||n.key!==r)&&(i=HQ(i,j$(n.out,r)))),e!==`directed`&&n.undirected!==void 0&&r in n.undirected&&(i=HQ(i,j$(n.undirected,r))),i}function V$(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];if(!arguments.length)return M$(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new KQ(`Graph.${n}: could not find the "${e}" node in the graph.`);return I$(this.multi,r===`mixed`?this.type:r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let a=this._nodes.get(e);if(!a)throw new KQ(`Graph.${n}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${n}: could not find the "${t}" target node in the graph.`);return z$(r,this.multi,i,a,t)}throw new GQ(`Graph.${n}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function H$(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r===`mixed`||this.type===`mixed`||r===this.type){if(arguments.length===1)return n=e,N$(!1,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return F$(!1,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new KQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return R$(!1,r,this.multi,i,o,t,n)}throw new GQ(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)}};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n;if(e.length===0){let i=0;r!==`directed`&&(i+=this.undirectedSize),r!==`undirected`&&(i+=this.directedSize),n=Array(i);let a=0;e.push((e,r,i,o,s,c,l)=>{n[a++]=t(e,r,i,o,s,c,l)})}else n=[],e.push((e,r,i,a,o,s,c)=>{n.push(t(e,r,i,a,o,s,c))});return this[a].apply(this,e),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop(),n=[];return e.push((e,r,i,a,o,s,c)=>{t(e,r,i,a,o,s,c)&&n.push(e)}),this[a].apply(this,e),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(){let e=Array.prototype.slice.call(arguments);if(e.length<2||e.length>4)throw new GQ(`Graph.${c}: invalid number of arguments (expecting 2, 3 or 4 and got ${e.length}).`);if(typeof e[e.length-1]==`function`&&typeof e[e.length-2]!=`function`)throw new GQ(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let t,n;e.length===2?(t=e[0],n=e[1],e=[]):e.length===3?(t=e[1],n=e[2],e=[e[0]]):e.length===4&&(t=e[2],n=e[3],e=[e[0],e[1]]);let r=n;return e.push((e,n,i,a,o,s,c)=>{r=t(r,e,n,i,a,o,s,c)}),this[a].apply(this,e),r}}function U$(e,t){let{name:n,type:r,direction:i}=t,a=`find`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t,n){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return!1;if(arguments.length===1)return n=e,N$(!0,this,r,n);if(arguments.length===2){e=``+e,n=t;let o=this._nodes.get(e);if(o===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return F$(!0,this.multi,r===`mixed`?this.type:r,i,o,n)}if(arguments.length===3){e=``+e,t=``+t;let o=this._nodes.get(e);if(!o)throw new KQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return R$(!0,r,this.multi,i,o,t,n)}throw new GQ(`Graph.${a}: too many arguments (expecting 1, 2 or 3 and got ${arguments.length}).`)};let o=`some`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[o]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>t(e,n,r,i,a,o,s)),!!this[a].apply(this,e)};let s=`every`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[s]=function(){let e=Array.prototype.slice.call(arguments),t=e.pop();return e.push((e,n,r,i,a,o,s)=>!t(e,n,r,i,a,o,s)),!this[a].apply(this,e)}}function W$(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return UQ();if(!arguments.length)return P$(this,r);if(arguments.length===1){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return L$(r,i,t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.${a}: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.${a}: could not find the "${t}" target node in the graph.`);return B$(r,i,n,t)}throw new GQ(`Graph.${a}: too many arguments (expecting 0, 1 or 2 and got ${arguments.length}).`)}}function G$(e){T$.forEach(t=>{V$(e,t),H$(e,t),U$(e,t),W$(e,t)})}var K$=[{name:`neighbors`,type:`mixed`},{name:`inNeighbors`,type:`directed`,direction:`in`},{name:`outNeighbors`,type:`directed`,direction:`out`},{name:`inboundNeighbors`,type:`mixed`,direction:`in`},{name:`outboundNeighbors`,type:`mixed`,direction:`out`},{name:`directedNeighbors`,type:`directed`},{name:`undirectedNeighbors`,type:`undirected`}];function q$(){this.A=null,this.B=null}q$.prototype.wrap=function(e){this.A===null?this.A=e:this.B===null&&(this.B=e)},q$.prototype.has=function(e){return this.A!==null&&e in this.A||this.B!==null&&e in this.B};function J$(e,t,n,r,i){for(let a in r){let o=r[a],s=o.source,c=o.target,l=s===n?c:s;if(t&&t.has(l.key))continue;let u=i(l.key,l.attributes);if(e&&u)return l.key}}function Y$(e,t,n,r,i){if(t!==`mixed`){if(t===`undirected`)return J$(e,null,r,r.undirected,i);if(typeof n==`string`)return J$(e,null,r,r[n],i)}let a=new q$,o;if(t!==`undirected`){if(n!==`out`){if(o=J$(e,null,r,r.in,i),e&&o)return o;a.wrap(r.in)}if(n!==`in`){if(o=J$(e,a,r,r.out,i),e&&o)return o;a.wrap(r.out)}}if(t!==`directed`&&(o=J$(e,a,r,r.undirected,i),e&&o))return o}function X$(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Object.keys(n.undirected);if(typeof t==`string`)return Object.keys(n[t])}let r=[];return Y$(!1,e,t,n,function(e){r.push(e)}),r}function Z$(e,t,n){let r=Object.keys(n),i=r.length,a=0;return{[Symbol.iterator](){return this},next(){let o=null;do{if(a>=i)return e&&e.wrap(n),{done:!0};let s=n[r[a++]],c=s.source,l=s.target;if(o=c===t?l:c,e&&e.has(o.key)){o=null;continue}}while(o===null);return{done:!1,value:{neighbor:o.key,attributes:o.attributes}}}}}function Q$(e,t,n){if(e!==`mixed`){if(e===`undirected`)return Z$(null,n,n.undirected);if(typeof t==`string`)return Z$(null,n,n[t])}let r=UQ(),i=new q$;return e!==`undirected`&&(t!==`out`&&(r=HQ(r,Z$(i,n,n.in))),t!==`in`&&(r=HQ(r,Z$(i,n,n.out)))),e!==`directed`&&(r=HQ(r,Z$(i,n,n.undirected))),r}function $$(e,t){let{name:n,type:r,direction:i}=t;e.prototype[n]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return[];e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new KQ(`Graph.${n}: could not find the "${e}" node in the graph.`);return X$(r===`mixed`?this.type:r,i,t)}}function e1(e,t){let{name:n,type:r,direction:i}=t,a=`forEach`+n[0].toUpperCase()+n.slice(1,-1);e.prototype[a]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);Y$(!1,r===`mixed`?this.type:r,i,n,t)};let o=`map`+n[0].toUpperCase()+n.slice(1);e.prototype[o]=function(e,t){let n=[];return this[a](e,(e,r)=>{n.push(t(e,r))}),n};let s=`filter`+n[0].toUpperCase()+n.slice(1);e.prototype[s]=function(e,t){let n=[];return this[a](e,(e,r)=>{t(e,r)&&n.push(e)}),n};let c=`reduce`+n[0].toUpperCase()+n.slice(1);e.prototype[c]=function(e,t,n){if(arguments.length<3)throw new GQ(`Graph.${c}: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let r=n;return this[a](e,(e,n)=>{r=t(r,e,n)}),r}}function t1(e,t){let{name:n,type:r,direction:i}=t,a=n[0].toUpperCase()+n.slice(1,-1),o=`find`+a;e.prototype[o]=function(e,t){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return;e=``+e;let n=this._nodes.get(e);if(n===void 0)throw new KQ(`Graph.${o}: could not find the "${e}" node in the graph.`);return Y$(!0,r===`mixed`?this.type:r,i,n,t)};let s=`some`+a;e.prototype[s]=function(e,t){return!!this[o](e,t)};let c=`every`+a;e.prototype[c]=function(e,t){return!this[o](e,(e,n)=>!t(e,n))}}function n1(e,t){let{name:n,type:r,direction:i}=t,a=n.slice(0,-1)+`Entries`;e.prototype[a]=function(e){if(r!==`mixed`&&this.type!==`mixed`&&r!==this.type)return UQ();e=``+e;let t=this._nodes.get(e);if(t===void 0)throw new KQ(`Graph.${a}: could not find the "${e}" node in the graph.`);return Q$(r===`mixed`?this.type:r,i,t)}}function r1(e){K$.forEach(t=>{$$(e,t),e1(e,t),t1(e,t),n1(e,t)})}function i1(e,t,n,r,i){let a=r._nodes.values(),o=r.type,s,c,l,u,d,f,p;for(;s=a.next(),s.done!==!0;){let r=!1;if(c=s.value,o!==`undirected`)for(l in u=c.out,u){d=u[l];do{if(f=d.target,r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}if(o!==`directed`){for(l in u=c.undirected,u)if(!(t&&c.key>l)){d=u[l];do{if(f=d.target,f.key!==l&&(f=d.source),r=!0,p=i(c.key,f.key,c.attributes,f.attributes,d.key,d.attributes,d.undirected),e&&p)return d;d=d.next}while(d)}}if(n&&!r&&(p=i(c.key,null,c.attributes,null,null,null,null),e&&p))return null}}function a1(e,t){let n={key:e};return LQ(t.attributes)||(n.attributes=PQ({},t.attributes)),n}function o1(e,t,n){let r={key:t,source:n.source.key,target:n.target.key};return LQ(n.attributes)||(r.attributes=PQ({},n.attributes)),e===`mixed`&&n.undirected&&(r.undirected=!0),r}function s1(e){if(!IQ(e))throw new GQ(`Graph.import: invalid serialized node. A serialized node should be a plain object with at least a "key" property.`);if(!(`key`in e))throw new GQ(`Graph.import: serialized node is missing its key.`);if(`attributes`in e&&(!IQ(e.attributes)||e.attributes===null))throw new GQ(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`)}function c1(e){if(!IQ(e))throw new GQ(`Graph.import: invalid serialized edge. A serialized edge should be a plain object with at least a "source" & "target" property.`);if(!(`source`in e))throw new GQ(`Graph.import: serialized edge is missing its source.`);if(!(`target`in e))throw new GQ(`Graph.import: serialized edge is missing its target.`);if(`attributes`in e&&(!IQ(e.attributes)||e.attributes===null))throw new GQ(`Graph.import: invalid attributes. Attributes should be a plain object, null or omitted.`);if(`undirected`in e&&typeof e.undirected!=`boolean`)throw new GQ(`Graph.import: invalid undirectedness information. Undirected should be boolean or omitted.`)}var qle=VQ(),Jle=new Set([`directed`,`undirected`,`mixed`]),l1=new Set([`domain`,`_events`,`_eventsCount`,`_maxListeners`]),Yle=[{name:e=>`${e}Edge`,generateKey:!0},{name:e=>`${e}DirectedEdge`,generateKey:!0,type:`directed`},{name:e=>`${e}UndirectedEdge`,generateKey:!0,type:`undirected`},{name:e=>`${e}EdgeWithKey`},{name:e=>`${e}DirectedEdgeWithKey`,type:`directed`},{name:e=>`${e}UndirectedEdgeWithKey`,type:`undirected`}],Xle={allowSelfLoops:!0,multi:!1,type:`mixed`};function Zle(e,t,n){if(n&&!IQ(n))throw new GQ(`Graph.addNode: invalid attributes. Expecting an object but got "${n}"`);if(t=``+t,n||={},e._nodes.has(t))throw new qQ(`Graph.addNode: the "${t}" node already exist in the graph.`);let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function u1(e,t,n){let r=new e.NodeDataClass(t,n);return e._nodes.set(t,r),e.emit(`nodeAdded`,{key:t,attributes:n}),r}function d1(e,t,n,r,i,a,o,s){if(!r&&e.type===`undirected`)throw new qQ(`Graph.${t}: you cannot add a directed edge to an undirected graph. Use the #.addEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new qQ(`Graph.${t}: you cannot add an undirected edge to a directed graph. Use the #.addEdge or #.addDirectedEdge instead.`);if(s&&!IQ(s))throw new GQ(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`);if(a=``+a,o=``+o,s||={},!e.allowSelfLoops&&a===o)throw new qQ(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let c=e._nodes.get(a),l=e._nodes.get(o);if(!c)throw new KQ(`Graph.${t}: source node "${a}" not found.`);if(!l)throw new KQ(`Graph.${t}: target node "${o}" not found.`);let u={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new qQ(`Graph.${t}: the "${i}" edge already exists in the graph.`);if(!e.multi&&(r?c.undirected[o]!==void 0:c.out[o]!==void 0))throw new qQ(`Graph.${t}: an edge linking "${a}" to "${o}" already exists. If you really want to add multiple edges linking those nodes, you should create a multi graph by using the 'multi' option.`);let d=new ZQ(r,i,c,l,s);e._edges.set(i,d);let f=a===o;return r?(c.undirectedDegree++,l.undirectedDegree++,f&&(c.undirectedLoops++,e._undirectedSelfLoopCount++)):(c.outDegree++,l.inDegree++,f&&(c.directedLoops++,e._directedSelfLoopCount++)),e.multi?d.attachMulti():d.attach(),r?e._undirectedSize++:e._directedSize++,u.key=i,e.emit(`edgeAdded`,u),i}function Qle(e,t,n,r,i,a,o,s,c){if(!r&&e.type===`undirected`)throw new qQ(`Graph.${t}: you cannot merge/update a directed edge to an undirected graph. Use the #.mergeEdge/#.updateEdge or #.addUndirectedEdge instead.`);if(r&&e.type===`directed`)throw new qQ(`Graph.${t}: you cannot merge/update an undirected edge to a directed graph. Use the #.mergeEdge/#.updateEdge or #.addDirectedEdge instead.`);if(s){if(c){if(typeof s!=`function`)throw new GQ(`Graph.${t}: invalid updater function. Expecting a function but got "${s}"`)}else if(!IQ(s))throw new GQ(`Graph.${t}: invalid attributes. Expecting an object but got "${s}"`)}a=``+a,o=``+o;let l;if(c&&(l=s,s=void 0),!e.allowSelfLoops&&a===o)throw new qQ(`Graph.${t}: source & target are the same ("${a}"), thus creating a loop explicitly forbidden by this graph 'allowSelfLoops' option set to false.`);let u=e._nodes.get(a),d=e._nodes.get(o),f,p;if(!n&&(f=e._edges.get(i),f)){if((f.source.key!==a||f.target.key!==o)&&(!r||f.source.key!==o||f.target.key!==a))throw new qQ(`Graph.${t}: inconsistency detected when attempting to merge the "${i}" edge with "${a}" source & "${o}" target vs. ("${f.source.key}", "${f.target.key}").`);p=f}if(!p&&!e.multi&&u&&(p=r?u.undirected[o]:u.out[o]),p){let t=[p.key,!1,!1,!1];if(c?!l:!s)return t;if(c){let t=p.attributes;p.attributes=l(t),e.emit(`edgeAttributesUpdated`,{type:`replace`,key:p.key,attributes:p.attributes})}else PQ(p.attributes,s),e.emit(`edgeAttributesUpdated`,{type:`merge`,key:p.key,attributes:p.attributes,data:s});return t}s||={},c&&l&&(s=l(s));let m={key:null,undirected:r,source:a,target:o,attributes:s};if(n)i=e._edgeKeyGenerator();else if(i=``+i,e._edges.has(i))throw new qQ(`Graph.${t}: the "${i}" edge already exists in the graph.`);let h=!1,g=!1;u||(u=u1(e,a,{}),h=!0,a===o&&(d=u,g=!0)),d||(d=u1(e,o,{}),g=!0),f=new ZQ(r,i,u,d,s),e._edges.set(i,f);let _=a===o;return r?(u.undirectedDegree++,d.undirectedDegree++,_&&(u.undirectedLoops++,e._undirectedSelfLoopCount++)):(u.outDegree++,d.inDegree++,_&&(u.directedLoops++,e._directedSelfLoopCount++)),e.multi?f.attachMulti():f.attach(),r?e._undirectedSize++:e._directedSize++,m.key=i,e.emit(`edgeAdded`,m),[i,!0,h,g]}function f1(e,t){e._edges.delete(t.key);let{source:n,target:r,attributes:i}=t,a=t.undirected,o=n===r;a?(n.undirectedDegree--,r.undirectedDegree--,o&&(n.undirectedLoops--,e._undirectedSelfLoopCount--)):(n.outDegree--,r.inDegree--,o&&(n.directedLoops--,e._directedSelfLoopCount--)),e.multi?t.detachMulti():t.detach(),a?e._undirectedSize--:e._directedSize--,e.emit(`edgeDropped`,{key:t.key,attributes:i,source:n.key,target:r.key,undirected:a})}var p1=class e extends MQ.EventEmitter{constructor(e){if(super(),e=PQ({},Xle,e),typeof e.multi!=`boolean`)throw new GQ(`Graph.constructor: invalid 'multi' option. Expecting a boolean but got "${e.multi}".`);if(!Jle.has(e.type))throw new GQ(`Graph.constructor: invalid 'type' option. Should be one of "mixed", "directed" or "undirected" but got "${e.type}".`);if(typeof e.allowSelfLoops!=`boolean`)throw new GQ(`Graph.constructor: invalid 'allowSelfLoops' option. Expecting a boolean but got "${e.allowSelfLoops}".`);let t=e.type===`mixed`?JQ:e.type===`directed`?YQ:XQ;RQ(this,`NodeDataClass`,t);let n=`geid_`+qle()+`_`,r=0;RQ(this,`_attributes`,{}),RQ(this,`_nodes`,new Map),RQ(this,`_edges`,new Map),RQ(this,`_directedSize`,0),RQ(this,`_undirectedSize`,0),RQ(this,`_directedSelfLoopCount`,0),RQ(this,`_undirectedSelfLoopCount`,0),RQ(this,`_edgeKeyGenerator`,()=>{let e;do e=n+r++;while(this._edges.has(e));return e}),RQ(this,`_options`,e),l1.forEach(e=>RQ(this,e,this[e])),zQ(this,`order`,()=>this._nodes.size),zQ(this,`size`,()=>this._edges.size),zQ(this,`directedSize`,()=>this._directedSize),zQ(this,`undirectedSize`,()=>this._undirectedSize),zQ(this,`selfLoopCount`,()=>this._directedSelfLoopCount+this._undirectedSelfLoopCount),zQ(this,`directedSelfLoopCount`,()=>this._directedSelfLoopCount),zQ(this,`undirectedSelfLoopCount`,()=>this._undirectedSelfLoopCount),zQ(this,`multi`,this._options.multi),zQ(this,`type`,this._options.type),zQ(this,`allowSelfLoops`,this._options.allowSelfLoops),zQ(this,`implementation`,()=>`graphology`)}_resetInstanceCounters(){this._directedSize=0,this._undirectedSize=0,this._directedSelfLoopCount=0,this._undirectedSelfLoopCount=0}hasNode(e){return this._nodes.has(``+e)}hasDirectedEdge(e,t){if(this.type===`undirected`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&!n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out.hasOwnProperty(t):!1}throw new GQ(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasUndirectedEdge(e,t){if(this.type===`directed`)return!1;if(arguments.length===1){let t=``+e,n=this._edges.get(t);return!!n&&n.undirected}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.undirected.hasOwnProperty(t):!1}throw new GQ(`Graph.hasDirectedEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}hasEdge(e,t){if(arguments.length===1){let t=``+e;return this._edges.has(t)}if(arguments.length===2){e=``+e,t=``+t;let n=this._nodes.get(e);return n?n.out!==void 0&&n.out.hasOwnProperty(t)||n.undirected!==void 0&&n.undirected.hasOwnProperty(t):!1}throw new GQ(`Graph.hasEdge: invalid arity (${arguments.length}, instead of 1 or 2). You can either ask for an edge id or for the existence of an edge between a source & a target.`)}directedEdge(e,t){if(this.type===`undirected`)return;if(e=``+e,t=``+t,this.multi)throw new qQ(`Graph.directedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.directedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.directedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.directedEdge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||void 0;if(r)return r.key}undirectedEdge(e,t){if(this.type===`directed`)return;if(e=``+e,t=``+t,this.multi)throw new qQ(`Graph.undirectedEdge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.undirectedEdges instead.`);let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.undirectedEdge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.undirectedEdge: could not find the "${t}" target node in the graph.`);let r=n.undirected&&n.undirected[t]||void 0;if(r)return r.key}edge(e,t){if(this.multi)throw new qQ(`Graph.edge: this method is irrelevant with multigraphs since there might be multiple edges between source & target. See #.edges instead.`);e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.edge: could not find the "${e}" source node in the graph.`);if(!this._nodes.has(t))throw new KQ(`Graph.edge: could not find the "${t}" target node in the graph.`);let r=n.out&&n.out[t]||n.undirected&&n.undirected[t]||void 0;if(r)return r.key}areDirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areDirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type===`undirected`?!1:t in n.in||t in n.out}areOutNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areOutNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out}areInNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areInNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in}areUndirectedNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areUndirectedNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`directed`&&t in n.undirected}areNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&(t in n.in||t in n.out)||this.type!==`directed`&&t in n.undirected}areInboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areInboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.in||this.type!==`directed`&&t in n.undirected}areOutboundNeighbors(e,t){e=``+e,t=``+t;let n=this._nodes.get(e);if(!n)throw new KQ(`Graph.areOutboundNeighbors: could not find the "${e}" node in the graph.`);return this.type!==`undirected`&&t in n.out||this.type!==`directed`&&t in n.undirected}inDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree}outDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree}directedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.directedDegree: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree}undirectedDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.undirectedDegree: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree}inboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree),n}outboundDegree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outboundDegree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.outDegree),n}degree(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.degree: could not find the "${e}" node in the graph.`);let n=0;return this.type!==`directed`&&(n+=t.undirectedDegree),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree),n}inDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree-t.directedLoops}outDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.outDegree-t.directedLoops}directedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.directedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`undirected`?0:t.inDegree+t.outDegree-t.directedLoops*2}undirectedDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.undirectedDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);return this.type===`directed`?0:t.undirectedDegree-t.undirectedLoops*2}inboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.inboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree,r+=t.directedLoops),n-r}outboundDegreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.outboundDegreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.outDegree,r+=t.directedLoops),n-r}degreeWithoutSelfLoops(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.degreeWithoutSelfLoops: could not find the "${e}" node in the graph.`);let n=0,r=0;return this.type!==`directed`&&(n+=t.undirectedDegree,r+=t.undirectedLoops*2),this.type!==`undirected`&&(n+=t.inDegree+t.outDegree,r+=t.directedLoops*2),n-r}source(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.source: could not find the "${e}" edge in the graph.`);return t.source.key}target(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.target: could not find the "${e}" edge in the graph.`);return t.target.key}extremities(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.extremities: could not find the "${e}" edge in the graph.`);return[t.source.key,t.target.key]}opposite(e,t){e=``+e,t=``+t;let n=this._edges.get(t);if(!n)throw new KQ(`Graph.opposite: could not find the "${t}" edge in the graph.`);let r=n.source.key,i=n.target.key;if(e===r)return i;if(e===i)return r;throw new KQ(`Graph.opposite: the "${e}" node is not attached to the "${t}" edge (${r}, ${i}).`)}hasExtremity(e,t){e=``+e,t=``+t;let n=this._edges.get(e);if(!n)throw new KQ(`Graph.hasExtremity: could not find the "${e}" edge in the graph.`);return n.source.key===t||n.target.key===t}isUndirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.isUndirected: could not find the "${e}" edge in the graph.`);return t.undirected}isDirected(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.isDirected: could not find the "${e}" edge in the graph.`);return!t.undirected}isSelfLoop(e){e=``+e;let t=this._edges.get(e);if(!t)throw new KQ(`Graph.isSelfLoop: could not find the "${e}" edge in the graph.`);return t.source===t.target}addNode(e,t){return Zle(this,e,t).key}mergeNode(e,t){if(t&&!IQ(t))throw new GQ(`Graph.mergeNode: invalid attributes. Expecting an object but got "${t}"`);e=``+e,t||={};let n=this._nodes.get(e);return n?(t&&(PQ(n.attributes,t),this.emit(`nodeAttributesUpdated`,{type:`merge`,key:e,attributes:n.attributes,data:t})),[e,!1]):(n=new this.NodeDataClass(e,t),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:t}),[e,!0])}updateNode(e,t){if(t&&typeof t!=`function`)throw new GQ(`Graph.updateNode: invalid updater function. Expecting a function but got "${t}"`);e=``+e;let n=this._nodes.get(e);if(n){if(t){let r=n.attributes;n.attributes=t(r),this.emit(`nodeAttributesUpdated`,{type:`replace`,key:e,attributes:n.attributes})}return[e,!1]}let r=t?t({}):{};return n=new this.NodeDataClass(e,r),this._nodes.set(e,n),this.emit(`nodeAdded`,{key:e,attributes:r}),[e,!0]}dropNode(e){e=``+e;let t=this._nodes.get(e);if(!t)throw new KQ(`Graph.dropNode: could not find the "${e}" node in the graph.`);let n;if(this.type!==`undirected`){for(let e in t.out){n=t.out[e];do f1(this,n),n=n.next;while(n)}for(let e in t.in){n=t.in[e];do f1(this,n),n=n.next;while(n)}}if(this.type!==`directed`)for(let e in t.undirected){n=t.undirected[e];do f1(this,n),n=n.next;while(n)}this._nodes.delete(e),this.emit(`nodeDropped`,{key:e,attributes:t.attributes})}dropEdge(e){let t;if(arguments.length>1){let e=``+arguments[0],n=``+arguments[1];if(t=FQ(this,e,n,this.type),!t)throw new KQ(`Graph.dropEdge: could not find the "${e}" -> "${n}" edge in the graph.`)}else if(e=``+e,t=this._edges.get(e),!t)throw new KQ(`Graph.dropEdge: could not find the "${e}" edge in the graph.`);return f1(this,t),this}dropDirectedEdge(e,t){if(arguments.length<2)throw new qQ(`Graph.dropDirectedEdge: it does not make sense to try and drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new qQ(`Graph.dropDirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);e=``+e,t=``+t;let n=FQ(this,e,t,`directed`);if(!n)throw new KQ(`Graph.dropDirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return f1(this,n),this}dropUndirectedEdge(e,t){if(arguments.length<2)throw new qQ(`Graph.dropUndirectedEdge: it does not make sense to drop a directed edge by key. What if the edge with this key is undirected? Use #.dropEdge for this purpose instead.`);if(this.multi)throw new qQ(`Graph.dropUndirectedEdge: cannot use a {source,target} combo when dropping an edge in a MultiGraph since we cannot infer the one you want to delete as there could be multiple ones.`);let n=FQ(this,e,t,`undirected`);if(!n)throw new KQ(`Graph.dropUndirectedEdge: could not find a "${e}" -> "${t}" edge in the graph.`);return f1(this,n),this}clear(){this._edges.clear(),this._nodes.clear(),this._resetInstanceCounters(),this.emit(`cleared`)}clearEdges(){let e=this._nodes.values(),t;for(;t=e.next(),t.done!==!0;)t.value.clear();this._edges.clear(),this._resetInstanceCounters(),this.emit(`edgesCleared`)}getAttribute(e){return this._attributes[e]}getAttributes(){return this._attributes}hasAttribute(e){return this._attributes.hasOwnProperty(e)}setAttribute(e,t){return this._attributes[e]=t,this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}updateAttribute(e,t){if(typeof t!=`function`)throw new GQ(`Graph.updateAttribute: updater should be a function.`);let n=this._attributes[e];return this._attributes[e]=t(n),this.emit(`attributesUpdated`,{type:`set`,attributes:this._attributes,name:e}),this}removeAttribute(e){return delete this._attributes[e],this.emit(`attributesUpdated`,{type:`remove`,attributes:this._attributes,name:e}),this}replaceAttributes(e){if(!IQ(e))throw new GQ(`Graph.replaceAttributes: provided attributes are not a plain object.`);return this._attributes=e,this.emit(`attributesUpdated`,{type:`replace`,attributes:this._attributes}),this}mergeAttributes(e){if(!IQ(e))throw new GQ(`Graph.mergeAttributes: provided attributes are not a plain object.`);return PQ(this._attributes,e),this.emit(`attributesUpdated`,{type:`merge`,attributes:this._attributes,data:e}),this}updateAttributes(e){if(typeof e!=`function`)throw new GQ(`Graph.updateAttributes: provided updater is not a function.`);return this._attributes=e(this._attributes),this.emit(`attributesUpdated`,{type:`update`,attributes:this._attributes}),this}updateEachNodeAttributes(e,t){if(typeof e!=`function`)throw new GQ(`Graph.updateEachNodeAttributes: expecting an updater function.`);if(t&&!BQ(t))throw new GQ(`Graph.updateEachNodeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._nodes.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,i.attributes=e(i.key,i.attributes);this.emit(`eachNodeAttributesUpdated`,{hints:t||null})}updateEachEdgeAttributes(e,t){if(typeof e!=`function`)throw new GQ(`Graph.updateEachEdgeAttributes: expecting an updater function.`);if(t&&!BQ(t))throw new GQ(`Graph.updateEachEdgeAttributes: invalid hints. Expecting an object having the following shape: {attributes?: [string]}`);let n=this._edges.values(),r,i,a,o;for(;r=n.next(),r.done!==!0;)i=r.value,a=i.source,o=i.target,i.attributes=e(i.key,i.attributes,a.key,o.key,a.attributes,o.attributes,i.undirected);this.emit(`eachEdgeAttributesUpdated`,{hints:t||null})}forEachAdjacencyEntry(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAdjacencyEntry: expecting a callback.`);i1(!1,!1,!1,this,e)}forEachAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAdjacencyEntryWithOrphans: expecting a callback.`);i1(!1,!1,!0,this,e)}forEachAssymetricAdjacencyEntry(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAssymetricAdjacencyEntry: expecting a callback.`);i1(!1,!0,!1,this,e)}forEachAssymetricAdjacencyEntryWithOrphans(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachAssymetricAdjacencyEntryWithOrphans: expecting a callback.`);i1(!1,!0,!0,this,e)}nodes(){return Array.from(this._nodes.keys())}forEachNode(e){if(typeof e!=`function`)throw new GQ(`Graph.forEachNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)}findNode(e){if(typeof e!=`function`)throw new GQ(`Graph.findNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return r.key}mapNodes(e){if(typeof e!=`function`)throw new GQ(`Graph.mapNode: expecting a callback.`);let t=this._nodes.values(),n,r,i=Array(this.order),a=0;for(;n=t.next(),n.done!==!0;)r=n.value,i[a++]=e(r.key,r.attributes);return i}someNode(e){if(typeof e!=`function`)throw new GQ(`Graph.someNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,e(r.key,r.attributes))return!0;return!1}everyNode(e){if(typeof e!=`function`)throw new GQ(`Graph.everyNode: expecting a callback.`);let t=this._nodes.values(),n,r;for(;n=t.next(),n.done!==!0;)if(r=n.value,!e(r.key,r.attributes))return!1;return!0}filterNodes(e){if(typeof e!=`function`)throw new GQ(`Graph.filterNodes: expecting a callback.`);let t=this._nodes.values(),n,r,i=[];for(;n=t.next(),n.done!==!0;)r=n.value,e(r.key,r.attributes)&&i.push(r.key);return i}reduceNodes(e,t){if(typeof e!=`function`)throw new GQ(`Graph.reduceNodes: expecting a callback.`);if(arguments.length<2)throw new GQ(`Graph.reduceNodes: missing initial value. You must provide it because the callback takes more than one argument and we cannot infer the initial value from the first iteration, as you could with a simple array.`);let n=t,r=this._nodes.values(),i,a;for(;i=r.next(),i.done!==!0;)a=i.value,n=e(n,a.key,a.attributes);return n}nodeEntries(){let e=this._nodes.values();return{[Symbol.iterator](){return this},next(){let t=e.next();if(t.done)return t;let n=t.value;return{value:{node:n.key,attributes:n.attributes},done:!1}}}}export(){let e=Array(this._nodes.size),t=0;this._nodes.forEach((n,r)=>{e[t++]=a1(r,n)});let n=Array(this._edges.size);return t=0,this._edges.forEach((e,r)=>{n[t++]=o1(this.type,r,e)}),{options:{type:this.type,multi:this.multi,allowSelfLoops:this.allowSelfLoops},attributes:this.getAttributes(),nodes:e,edges:n}}import(t,n=!1){if(t instanceof e)return t.forEachNode((e,t)=>{n?this.mergeNode(e,t):this.addNode(e,t)}),t.forEachEdge((e,t,r,i,a,o,s)=>{n?s?this.mergeUndirectedEdgeWithKey(e,r,i,t):this.mergeDirectedEdgeWithKey(e,r,i,t):s?this.addUndirectedEdgeWithKey(e,r,i,t):this.addDirectedEdgeWithKey(e,r,i,t)}),this;if(!IQ(t))throw new GQ(`Graph.import: invalid argument. Expecting a serialized graph or, alternatively, a Graph instance.`);if(t.attributes){if(!IQ(t.attributes))throw new GQ(`Graph.import: invalid attributes. Expecting a plain object.`);n?this.mergeAttributes(t.attributes):this.replaceAttributes(t.attributes)}let r,i,a,o,s;if(t.nodes){if(a=t.nodes,!Array.isArray(a))throw new GQ(`Graph.import: invalid nodes. Expecting an array.`);for(r=0,i=a.length;r<i;r++){o=a[r],s1(o);let{key:e,attributes:t}=o;n?this.mergeNode(e,t):this.addNode(e,t)}}if(t.edges){let e=!1;if(this.type===`undirected`&&(e=!0),a=t.edges,!Array.isArray(a))throw new GQ(`Graph.import: invalid edges. Expecting an array.`);for(r=0,i=a.length;r<i;r++){s=a[r],c1(s);let{source:t,target:i,attributes:o,undirected:c=e}=s,l;`key`in s?(l=n?c?this.mergeUndirectedEdgeWithKey:this.mergeDirectedEdgeWithKey:c?this.addUndirectedEdgeWithKey:this.addDirectedEdgeWithKey,l.call(this,s.key,t,i,o)):(l=n?c?this.mergeUndirectedEdge:this.mergeDirectedEdge:c?this.addUndirectedEdge:this.addDirectedEdge,l.call(this,t,i,o))}}return this}nullCopy(t){let n=new e(PQ({},this._options,t));return n.replaceAttributes(PQ({},this.getAttributes())),n}emptyCopy(e){let t=this.nullCopy(e);return this._nodes.forEach((e,n)=>{let r=PQ({},e.attributes);e=new t.NodeDataClass(n,r),t._nodes.set(n,e)}),t}copy(e){if(e||={},typeof e.type==`string`&&e.type!==this.type&&e.type!==`mixed`)throw new qQ(`Graph.copy: cannot create an incompatible copy from "${this.type}" type to "${e.type}" because this would mean losing information about the current graph.`);if(typeof e.multi==`boolean`&&e.multi!==this.multi&&e.multi!==!0)throw new qQ(`Graph.copy: cannot create an incompatible copy by downgrading a multi graph to a simple one because this would mean losing information about the current graph.`);if(typeof e.allowSelfLoops==`boolean`&&e.allowSelfLoops!==this.allowSelfLoops&&e.allowSelfLoops!==!0)throw new qQ(`Graph.copy: cannot create an incompatible copy from a graph allowing self loops to one that does not because this would mean losing information about the current graph.`);let t=this.emptyCopy(e),n=this._edges.values(),r,i;for(;r=n.next(),r.done!==!0;)i=r.value,d1(t,`copy`,!1,i.undirected,i.key,i.source.key,i.target.key,PQ({},i.attributes));return t}toJSON(){return this.export()}toString(){return`[object Graph]`}inspect(){let e={};this._nodes.forEach((t,n)=>{e[n]=t.attributes});let t={},n={};this._edges.forEach((e,r)=>{let i=e.undirected?`--`:`->`,a=``,o=e.source.key,s=e.target.key,c;e.undirected&&o>s&&(c=o,o=s,s=c);let l=`(${o})${i}(${s})`;r.startsWith(`geid_`)?this.multi&&(n[l]===void 0?n[l]=0:n[l]++,a+=`${n[l]}. `):a+=`[${r}]: `,a+=l,t[a]=e.attributes});let r={};for(let e in this)this.hasOwnProperty(e)&&!l1.has(e)&&typeof this[e]!=`function`&&typeof e!=`symbol`&&(r[e]=this[e]);return r.attributes=this._attributes,r.nodes=e,r.edges=t,RQ(r,`constructor`,this.constructor),r}};typeof Symbol<`u`&&(p1.prototype[Symbol.for(`nodejs.util.inspect.custom`)]=p1.prototype.inspect),Yle.forEach(e=>{[`add`,`merge`,`update`].forEach(t=>{let n=e.name(t),r=t===`add`?d1:Qle;e.generateKey?p1.prototype[n]=function(i,a,o){return r(this,n,!0,(e.type||this.type)===`undirected`,null,i,a,o,t===`update`)}:p1.prototype[n]=function(i,a,o,s){return r(this,n,!1,(e.type||this.type)===`undirected`,i,a,o,s,t===`update`)}})}),p$(p1),w$(p1),G$(p1),r1(p1);var m1=class extends p1{constructor(e){let t=PQ({type:`directed`},e);if(`multi`in t&&t.multi!==!1)throw new GQ(`DirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`directed`)throw new GQ(`DirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},h1=class extends p1{constructor(e){let t=PQ({type:`undirected`},e);if(`multi`in t&&t.multi!==!1)throw new GQ(`UndirectedGraph.from: inconsistent indication that the graph should be multi in given options!`);if(t.type!==`undirected`)throw new GQ(`UndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},g1=class extends p1{constructor(e){let t=PQ({multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new GQ(`MultiGraph.from: inconsistent indication that the graph should be simple in given options!`);super(t)}},_1=class extends p1{constructor(e){let t=PQ({type:`directed`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new GQ(`MultiDirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`directed`)throw new GQ(`MultiDirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}},v1=class extends p1{constructor(e){let t=PQ({type:`undirected`,multi:!0},e);if(`multi`in t&&t.multi!==!0)throw new GQ(`MultiUndirectedGraph.from: inconsistent indication that the graph should be simple in given options!`);if(t.type!==`undirected`)throw new GQ(`MultiUndirectedGraph.from: inconsistent "`+t.type+`" type in given options!`);super(t)}};function y1(e){e.from=function(t,n){let r=new e(PQ({},t.options,n));return r.import(t),r}}y1(p1),y1(m1),y1(h1),y1(g1),y1(_1),y1(v1),p1.Graph=p1,p1.DirectedGraph=m1,p1.UndirectedGraph=h1,p1.MultiGraph=g1,p1.MultiDirectedGraph=_1,p1.MultiUndirectedGraph=v1,p1.InvalidArgumentsGraphError=GQ,p1.NotFoundGraphError=KQ,p1.UsageGraphError=qQ;var b1={condition:`Condition`,wait:`Wait`,eventSplit:`Event Split`},$le=Ah([`newest-wins`,`first-wins`,`unlimited`]),x1=Ch({startEvents:Eh(Bh),cancelEvents:Eh(Bh),concurrency:$le,allowManualStart:mh(xh),correlationPaths:mh(wh(yh,Bh))}),S1={startEvents:[],cancelEvents:[],concurrency:`unlimited`,allowManualStart:!0},eue=Wh(x1);function C1(e){return eue(e?.lifecycleRules)}function w1(e){return(C1(e)?.cancelEvents.length??0)>0}function T1(e){return e.rules.correlationPaths?.[e.eventName]??e.declaredPath}function tue(e){return e.startEvents.length>0||e.allowManualStart===!0}function E1(e){return e===void 0||e.allowManualStart===!0}var nue={valid:!0},D1=e=>({valid:!1,error:e});function rue(e){return`No Event named "${e}" is defined. Choose an Event this app declares, or ask whoever defines them to add it.`}function O1(e){return e.concurrency!==`unlimited`||e.cancelEvents.length>0}function k1(e){let{rules:t,catalog:n,eventName:r,role:i}=e;if(!(i===`start`&&!O1(t)))return{eventName:r,role:i,declaredPath:Ny(n,r)?.correlationPath,suppliedPath:t.correlationPaths?.[r]}}function iue(e){let{rules:t,catalog:n}=e,r=t.startEvents.map(e=>k1({rules:t,catalog:n,eventName:e,role:`start`})),i=t.cancelEvents.map(e=>k1({rules:t,catalog:n,eventName:e,role:`cancel`}));return Ka([...r,...i])}function A1(e){if(!e.correlationPaths)return e;let t=new Set(e.cancelEvents);if(O1(e))for(let n of e.startEvents)t.add(n);let n=Object.fromEntries(Object.entries(e.correlationPaths).filter(([e])=>t.has(e)));return{...e,correlationPaths:Object.keys(n).length>0?n:void 0}}function aue(e){let{rules:t,catalog:n}=e,r=t.startEvents.find(e=>t.cancelEvents.includes(e));if(r)return D1(`Event "${r}" cannot both start and cancel runs of this workflow. Give it one role, or start on one Event and cancel on another.`);let i=[...t.startEvents,...t.cancelEvents];for(let e of i)if(!Ny(n,e))return D1(rue(e));let a=iue({rules:t,catalog:n}).find(e=>!T1({rules:t,eventName:e.eventName,declaredPath:e.declaredPath}));return a?D1(oue(a.eventName)):tue(t)?nue:D1(`Nothing can start this workflow. Add a Start Event, or allow manual starts.`)}function oue(e){return`Event "${e}" declares no Correlation Path. Enter the payload path holding the value that identifies the entity, or ask whoever defined the Event to declare it.`}var sue=Wh(zh);function cue(e){return sue(e)??null}function lue(e){let t=cue(e);return typeof t==`object`&&t&&!Array.isArray(t)?t:null}var j1=wh(yh,zh),M1=Ch({byEvent:mh(wh(yh,j1)),manual:mh(j1)}),uue=Wh(M1);function due(e){return uue(e?.testPayloads)}function N1(e,t){return t?e?.byEvent?.[t]:e?.manual}var fue=Ch({lifecycleRules:mh(x1),testPayloads:mh(M1)}).annotate({message:`Lifecycle config must be an object`}),P1={label:yh,description:mh(yh),enabled:mh(xh)},pue=Th(Ch({...P1,type:hh(`lifecycle`),config:mh(fue)}),Hh),mue=kh([Ch({actionType:hh(b1.condition),condition:mh(kh([yh,xh])),conditionModel:mh(yh),integrationId:mh(yh)}).annotate({message:`Condition config must be an object`}),Th(Ch({actionType:hh(b1.wait),integrationId:mh(yh),waitDelayTimingMode:mh(yh),waitMode:mh(Ah([`delay`,`event`])),waitFor:mh(gh),waitTimeout:mh(yh),waitTimeoutBehavior:mh(yh),waitDuration:mh(yh),waitUntil:mh(yh),waitOffset:mh(yh),waitGateMode:mh(yh),waitAllowedHoursMode:mh(yh),waitAllowedStartTime:mh(yh),waitAllowedEndTime:mh(yh),waitTimezone:mh(yh)}),Hh).annotate({message:`Wait config must be an object`}),Ch({actionType:hh(b1.eventSplit),integrationId:mh(yh)}).annotate({message:`Event Split config must be an object`}),Th(Ch({actionType:mh(Bh.check(Nh(e=>e===b1.condition||e===b1.wait||e===b1.eventSplit?`Built-in action configs use their own schema arm`:!0))),integrationId:mh(yh)}),Hh)]).annotate({message:`Action config must be an object`}),hue=Th(Ch({...P1,type:hh(`action`),config:mh(mue)}),Hh),gue=Th(Ch({...P1,type:hh(`add`),config:mh(wh(yh,gh))}),Hh),_ue=Ch({entryNodeIds:mh(Uh(Bh)),exitNodeId:mh(Bh),outletHandle:mh(hh(`true`))}).annotate({message:`Group config must be an object`}),vue=kh([pue,hue,gue,Th(Ch({...P1,type:hh(`group`),config:mh(_ue)}),Hh)]).annotate({message:`Node data needs a type of "lifecycle", "action", "add", or "group"`}),F1=Th(Ch({id:Bh,type:mh(Ah([`lifecycle`,`action`,`add`,`group`])),parentId:mh(Bh),width:mh(Fh),height:mh(Fh),position:mh(Ch({x:Fh,y:Fh})),data:vue}),Hh),I1=Th(Ch({id:Bh,source:Bh,target:Bh,sourceHandle:mh(jh(Bh)),targetHandle:mh(jh(Bh)),data:mh(wh(yh,gh))}),Hh),yue=Ch({key:Bh,attributes:F1}),bue=Ch({key:Bh,source:Bh,target:Bh,attributes:I1,undirected:mh(hh(!1))}),L1=Ch({attributes:mh(wh(yh,gh)),options:mh(Ch({allowSelfLoops:mh(xh),multi:mh(xh),type:mh(Ah([`directed`,`undirected`,`mixed`]))})),nodes:Uh(yue),edges:Uh(bue)}),R1={allowSelfLoops:!1,multi:!1,type:`directed`},xue=sh(L1,Vh);oh(L1,{...Vh,errors:`all`});var Sue=sh(F1,Vh);oh(F1,Vh);var Cue=sh(I1,Vh);function z1(e){let t={label:e.label,type:e.type};return e.description!==void 0&&(t.description=e.description),typeof e.config==`object`&&e.config!==null&&!Array.isArray(e.config)&&(t.config={...e.config}),e.enabled!==void 0&&(t.enabled=e.enabled),t}function wue(e){let t=Sue(e),n={id:t.id,type:t.type,position:t.position??{x:0,y:0},data:z1(t.data)};return t.parentId!==void 0&&(n.parentId=t.parentId),t.width!==void 0&&(n.width=t.width),t.height!==void 0&&(n.height=t.height),n}function Tue(e){let t=Cue(e);return{id:t.id,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle,data:t.data}}function Eue(e){let t=wue(e.attributes);if(e.key!==t.id)throw Error(`Node key '${e.key}' must match node attribute id '${t.id}'`);return t}function Due(e){let t=Tue(e.attributes);if(e.key!==t.id)throw Error(`Edge key '${e.key}' must match edge attribute id '${t.id}'`);if(e.source!==t.source||e.target!==t.target)throw Error(`Edge '${e.key}' source/target must match edge attributes`);return t}function B1(e){let t=new m1({allowSelfLoops:R1.allowSelfLoops,multi:R1.multi});e.attributes&&t.replaceAttributes(e.attributes);for(let n of e.nodes)t.mergeNode(n.id,{...n,data:z1(n.data)});for(let n of e.edges){let e=[n.source,n.target].filter(e=>!t.hasNode(e));if(e.length>0)throw Error(`Edge '${n.id}' names ${e.join(` and `)}, which the graph has no node for`);t.mergeEdgeWithKey(n.id,n.source,n.target,n)}return V1(t.export())}function V1(e){return xue(e)}function H1(e){let t=V1(e);return{nodes:t.nodes.map(Eue),edges:t.edges.map(Due)}}var U1=`animated`;function W1(e){let{status:t,issues:n,...r}=e.data,i={id:e.id,position:e.position,data:r,type:e.type};return typeof e.width==`number`&&(i.width=e.width),typeof e.height==`number`&&(i.height=e.height),e.measured&&typeof e.measured.width==`number`&&typeof e.measured.height==`number`&&(i.measured={width:e.measured.width,height:e.measured.height}),typeof e.parentId==`string`&&e.parentId.length>0&&(i.parentId=e.parentId),i}function G1(e){return e.filter(e=>e.type!==`add`).map(W1)}function K1(e){let{displayLabel:t,inactive:n,...r}=e.data??{};return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:Object.keys(r).length>0?r:void 0}}function q1(e){let t={id:e.id,position:e.position,type:e.type,width:e.width,height:e.height,measured:e.measured,data:{...e.data}};return e.parentId&&(t.parentId=e.parentId,t.extent=`parent`,t.draggable=!1,t.connectable=!1),t}function J1(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle??void 0,targetHandle:e.targetHandle??void 0,data:e.data}}function Y1(e){return B1({nodes:G1(e.nodes),edges:e.edges.map(K1)})}var X1=class extends Error{constructor(e,t){super(t),this.status=e,this.name=`ApiError`}},Oue=`/api/rpc`,Z1=`http://localhost:3000`;function Q1(){let e=typeof globalThis.location?.origin==`string`?globalThis.location.origin.trim():``;if(!(!e||e===`null`))return e}function kue(){let e={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1}.VITE_RPC_URL;return typeof e==`string`?e:void 0}function Aue(e={}){let t=e.rpcUrl??kue();if(t){let n=t.trim();if(n.length>0)try{return new URL(n).toString()}catch{let t=e.origin?.trim()||Q1()||Z1;try{return new URL(n,t).toString()}catch{return new URL(n,Z1).toString()}}}let n=`${Sy()}${Oue}`,r=e.origin?.trim()||Q1()||Z1;try{return new URL(n,r).toString()}catch{return new URL(n,Z1).toString()}}function jue(e){let t=new URL(e);return{origin:t.origin,pathWithQuery:`/${t.pathname.slice(1)}${t.search}`}}var Mue=FZ,$1=jue(Aue()),e0=YZ(new EQ({origin:$1.origin,url:$1.pathWithQuery,fetch:(e,t)=>globalThis.fetch(e,t),interceptors:[async e=>{try{return await e.next()}catch(e){throw e instanceof X1?e:e instanceof LZ?new X1(Mue[e.code]??500,jQ(e.data??e.message)):e instanceof Error?new X1(500,e.message||`Request failed`):new X1(500,`Request failed`)}}]}));function t0(e){let t=H1(e.graph);return{...e,nodes:t.nodes.map(q1),edges:t.edges.map(J1)}}function n0(e){return e.graph?e.graph:Y1({nodes:e.nodes??[],edges:e.edges??[]})}var Nue={create:e=>e0.workflow.create({name:e.name,graph:n0(e),...OQ({description:e.description},DQ)}).then(t0),update:(e,t)=>{let n=t.graph!==void 0||t.nodes!==void 0&&t.edges!==void 0?n0({graph:t.graph,nodes:t.nodes,edges:t.edges}):void 0;return e0.workflow.update({workflowId:e,...OQ({name:t.name,description:t.description,graph:n,mode:t.mode},DQ)}).then(t0)}},r0=lQ(e0),i0=()=>r0.integration.getAll.queryOptions({input:{}}),Pue=()=>r0.workflow.getAll.queryOptions({input:{}});function Fue(e){return e.hasUnpublishedChanges}function Iue(e){return r0.workflow.getById.queryOptions({input:{workflowId:e},select:Fue,staleTime:1/0})}function a0(e){return e.invalidateQueries({queryKey:r0.workflow.getAll.key()})}function o0(e,t){e.setQueryData(r0.workflow.getById.queryKey({input:{workflowId:t.id}}),e=>e&&{...e,hasUnpublishedChanges:t.hasUnpublishedChanges,updatedAt:t.updatedAt??e.updatedAt,...t.publishedVersionId===void 0?{}:{publishedVersionId:t.publishedVersionId}})}function s0(e){return Promise.all([e.invalidateQueries({queryKey:r0.workflow.getExecutions.key()}),e.invalidateQueries({queryKey:r0.workflow.getExecutionsGlobal.key()})])}function c0(e){return e.invalidateQueries({queryKey:r0.integration.getAll.key()})}function l0(){let e=(0,Z.c)(3),t=Fe(),n=Gi(),r;return e[0]!==n||e[1]!==t?(r=r0.workflow.delete.mutationOptions({onSuccess:async()=>{Ty.success(`Workflow deleted successfully`),await Promise.all([a0(t),s0(t)]),await n({to:`/`,replace:!0})},meta:{errorMessage:`Failed to delete workflow. Please try again.`}}),e[0]=n,e[1]=t,e[2]=r):r=e[2],Ze(r)}var Lue=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,u0=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=Lue[n[e]&63];return t};function d0(e,t){return!t||e?.[t.field]===t.equals}function f0(e,t){return t.filter(t=>d0(e,t.showWhen))}var Rue=/\{\{@([^:{}]+):([^{}]+)\}\}/g;function zue(e){let[t,n,r]=e,i=r.indexOf(`.`);return{raw:t,nodeId:n,nodeLabel:i===-1?r:r.slice(0,i),fieldPath:i===-1?``:r.slice(i+1),start:e.index,end:e.index+t.length}}function p0(e){let t=new RegExp(Rue.source,`g`),n=[],r=t.exec(e);for(;r!==null;)n.push(zue(r)),r=t.exec(e);return n}function m0(e){let t=[],n=0;for(let r of p0(e))r.start>n&&t.push({kind:`literal`,text:e.slice(n,r.start)}),t.push({kind:`token`,token:r}),n=r.end;return n<e.length&&t.push({kind:`literal`,text:e.slice(n)}),t}function h0(e){let t=e.fieldPath?`.${e.fieldPath}`:``;return`{{@${e.nodeId}:${e.nodeLabel}${t}}}`}function g0(e,t){if(typeof e==`string`)return Bue(e,t);if(Array.isArray(e)){let n=!1,r=e.map(e=>{let r=g0(e,t);return r!==e&&(n=!0),r});return n?r:e}if(typeof e==`object`&&e){let n=!1,r={};for(let[i,a]of Object.entries(e)){let e=g0(a,t);e!==a&&(n=!0),r[i]=e}return n?r:e}return e}function Bue(e,t){let n=!1,r=m0(e).map(e=>{if(e.kind===`literal`)return e.text;let r=t(e.token);return r===void 0||r===e.token.raw?e.token.raw:(n=!0,r)}).join(``);return n?r:e}var Vue=/\[(\d+)\]/g,Hue=/^([^[]*)((?:\[\d+\])*)$/;function Uue(e){let t=[];for(let n of e.split(`.`)){let e=n.trim();if(!e)return null;let r=Hue.exec(e);if(!r)return null;let i=r[1];if(i.includes(`]`))return null;i&&t.push({kind:`key`,key:i});for(let n of e.matchAll(Vue)){let e=Number(n[1]);if(!Number.isSafeInteger(e))return null;t.push({kind:`index`,index:e})}}return t.length>0?t:null}function _0(e,t){let n=e?.[t];return typeof n==`string`?n:void 0}function v0(e,t,n){return _0(e,t)??n}function y0(e,t){let n=_0(e,t)?.trim();return n&&n.length>0?n:void 0}function b0(e){if(!(!e||e.data.type!==`action`))return _0(e.data.config,`actionType`)}function Wue(e){return e===b1.wait}function x0(e){return!e||e.data.type!==`action`?!1:Wue(b0(e))}function S0(e){return!e||e.data.type!==`action`?!1:b0(e)===b1.condition}function C0(e){return!e||e.data.type!==`action`?!1:b0(e)===b1.eventSplit}function w0(e){return e===`true`||e===`false`?e:null}function Gue(e){let t=w0(e);return t===`true`?`True`:t===`false`?`False`:null}function T0(e){return e===b1.condition}function E0(e){return S0(e)}function D0(e){return e?.data.type===`group`}function O0(e){let t=e?.data.config?.entryNodeIds;return Array.isArray(t)?t.filter(e=>typeof e==`string`&&e.length>0):[]}function k0(e){return _0(e?.data.config,`exitNodeId`)}function A0(e){return _0(e?.data.config,`outletHandle`)===`true`?`true`:void 0}function j0(e){return`${e.source}\0${e.sourceHandle??``}`}function M0(e,t){let n=e(t.source);return n!==void 0&&n===e(t.target)}function N0(e,t){return e.has(t.source)&&e.has(t.target)}function P0(e,t,n,r){let i=new Map(e.map(e=>[e.id,e])),a=[];for(let e of n){let t=i.get(e);if(!t)return{ok:!1,error:`Select at least two steps`};let n=$ue(t,r);if(n)return{ok:!1,error:n};a.push(t)}if(a.length<2)return{ok:!1,error:`Select at least two steps`};let o=new Set(a.map(e=>e.id)),s=t.filter(e=>N0(o,e)),c=new Map,l=new Map;for(let e of o)c.set(e,0),l.set(e,0);for(let e of s)c.set(e.target,(c.get(e.target)??0)+1),l.set(e.source,(l.get(e.source)??0)+1);let u=a.filter(e=>(c.get(e.id)??0)===0),d=a.filter(e=>(l.get(e.id)??0)===0);if(u.length===0)return{ok:!1,error:`Needs an entry step`};if(d.length!==1)return{ok:!1,error:`Needs exactly one exit step`};let f=d[0];if(!f)return{ok:!1,error:`Needs exactly one exit step`};let p=u.map(e=>e.id);if(U0(p,s,o).size!==o.size)return{ok:!1,error:`Needs a connected lookup group`};for(let e of p)if(!U0([e],s,o).has(f.id))return{ok:!1,error:`Needs a connected lookup group`};let m=new Set(p),h=new Set;for(let e of t){let t=o.has(e.source),n=o.has(e.target);if(t!==n){if(n&&!m.has(e.target))return{ok:!1,error:`Needs an entry step`};if(t&&e.source!==f.id)return{ok:!1,error:`Needs exactly one exit step`};if(t&&e.source===f.id){let t=w0(e.sourceHandle);if(S0(f)&&t===`false`)return{ok:!1,error:`Condition False cannot leave the group`}}n&&m.has(e.target)&&h.add(j0(e))}}return h.size>1?{ok:!1,error:`Parallel lookups must share the same incoming step`}:{ok:!0,entryIds:p,exitId:f.id,memberIds:W0(o,s,p)}}function Kue(e,t){let n=e.find(e=>e.id===t);return D0(n)?k0(n)??t:t}function F0(e){let t=Kue(e.nodes,e.sourceId),n=new Set(e.edges.filter(t=>t.id!==e.excludeEdgeId).map(e=>`${j0(e)}\0${e.target}`)),r=[];for(let i of que(e.nodes,e.targetId)){let a=`${j0({source:t,sourceHandle:e.sourceHandle})}\0${i}`;n.has(a)||r.push({source:t,target:i,sourceHandle:e.sourceHandle})}return r}function que(e,t){let n=e.find(e=>e.id===t);if(!D0(n))return[t];let r=O0(n);return r.length>0?r:[t]}function I0(e,t,n){let r=t.find(e=>e.id===n);if(!r)return[];let i=e.find(e=>e.id===r.target),a=i?.parentId?e.find(e=>e.id===i.parentId):void 0;if(!D0(a))return[n];let o=new Set(O0(a));return o.has(r.target)?t.filter(e=>e.source===r.source&&(e.sourceHandle??``)===(r.sourceHandle??``)&&o.has(e.target)).map(e=>e.id):[n]}function L0(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map,i=new Map;for(let t of e){if(!D0(t))continue;for(let e of O0(t))r.set(e,t.id);let e=k0(t);e&&i.set(e,t.id)}let a=e=>n.get(e)?.parentId,o=!1,s=t.map(e=>{if(M0(a,e))return e;let t=e,n=a(e.source);n&&i.get(e.source)===n&&(t={...t,source:n});let s=a(e.target);return s&&r.get(e.target)===s&&(t={...t,target:s}),o||=t!==e,t});return ede(o?s:t)}function Jue(e,t){let n=new Map(e.map(e=>[e.id,e]));return L0(e,t).filter(e=>!n.get(e.source)?.parentId&&!n.get(e.target)?.parentId)}function R0(e,t){let n=new Set(t),r=new Map(e.map(e=>[e.id,e]));for(let i of t){let t=r.get(i);if(t){if(D0(t)){for(let t of e)t.parentId===i&&n.add(t.id);continue}if(t.parentId){n.add(t.parentId);for(let r of e)r.parentId===t.parentId&&n.add(r.id)}}}return n}function z0(e,t){return e.filter(e=>e.parentId===t).map(e=>e.id)}function B0(e){let t=new Map;for(let n of e){if(!n.parentId)continue;let e=(t.get(n.parentId)??!0)&&n.data.enabled===!1;t.set(n.parentId,e)}let n=new Set;for(let[e,r]of t)r&&n.add(e);return n}function V0(e){if(!e.some(e=>D0(e))||Yue(e))return e;let t=[],n=[],r=[];for(let i of e)D0(i)?t.push(i):i.parentId?n.push(i):r.push(i);return[...r,...t,...n]}function Yue(e){let t=`rest`;for(let n of e){let e=D0(n)?`groups`:n.parentId?`children`:`rest`;if(e!==t){if(t===`rest`&&e===`groups`){t=`groups`;continue}if(t===`groups`&&e===`children`){t=`children`;continue}return!1}}return!0}function Xue(e){let t=new Map;for(let n of e)n.parentId&&t.set(n.parentId,(t.get(n.parentId)??0)+1);return e.filter(e=>D0(e)&&(t.get(e.id)??0)<2).map(e=>e.id)}function Zue(e,t,n){let r=W0(new Set(e),t,n),i=new Map;for(let t of e)i.set(t,[]);for(let e of t)i.get(e.target)?.push(e.source);let a=new Map;for(let e of r){let t=(i.get(e)??[]).filter(e=>a.has(e)).map(e=>a.get(e)??0);a.set(e,t.length===0?0:Math.max(...t)+1)}let o=new Map;return r.map(e=>{let t=a.get(e)??0,n=o.get(t)??0;return o.set(t,n+1),{id:e,row:t,column:n}})}function Que(e){return e.length===0?{rows:1,columns:1}:{rows:Math.max(...e.map(e=>e.row+1)),columns:Math.max(...e.map(e=>e.column+1))}}function H0(e,t,n){let r=Zue(e,t,n);return{slots:r,bounds:Que(r)}}function $ue(e,t){if(e.data.type===`lifecycle`||e.data.type===`add`)return`Only lookup and Condition steps can be grouped`;if(D0(e)||e.parentId)return`Already in a group`;if(e.data.type!==`action`)return`Only lookup and Condition steps can be grouped`;let n=b0(e);return n?x0(e)?`Wait cannot be grouped`:C0(e)?`Event Split cannot be grouped`:Py(t,n)?.sideEffect?`A step that changes something outside the workflow stays outside the frame`:null:`Every step needs an action`}function U0(e,t,n){let r=new Map;for(let e of t){let t=r.get(e.source)??[];t.push(e.target),r.set(e.source,t)}let i=new Set,a=[...e];for(;a.length>0;){let e=a.pop();if(!(!e||i.has(e)||!n.has(e))){i.add(e);for(let t of r.get(e)??[])a.push(t)}}return i}function W0(e,t,n){let r=new Map,i=new Map;for(let t of e)r.set(t,0),i.set(t,[]);for(let n of t)!e.has(n.source)||!e.has(n.target)||(r.set(n.target,(r.get(n.target)??0)+1),i.get(n.source)?.push(n.target));let a=n.filter(t=>e.has(t)),o=[],s=new Set;for(;a.length>0;){let e=a.shift();if(!(!e||s.has(e))){s.add(e),o.push(e);for(let t of i.get(e)??[]){let e=(r.get(t)??1)-1;r.set(t,e),e===0&&a.push(t)}}}for(let t of e)s.has(t)||o.push(t);return o}function ede(e){let t=new Set,n=[];for(let r of e){let e=`${r.source}\0${r.sourceHandle??``}\0${r.target}\0${r.targetHandle??``}`;t.has(e)||(t.add(e),n.push(r))}return n.length===e.length?e:n}function G0(e){return e.data.type!==`lifecycle`&&e.type!==`add`}function tde(e,t){let n=e.find(e=>e.id===t);return!n||!G0(n)?new Set:n.selected?R0(e,new Set(e.filter(e=>e.selected&&G0(e)).map(e=>e.id))):R0(e,new Set([n.id]))}function nde(e){let t=e.nodes.filter(t=>G0(t)?e.nodeIds?e.nodeIds.has(t.id):!!t.selected:!1);if(t.length===0)return null;let n=R0(e.nodes,new Set(t.map(e=>e.id))),r=e.nodes.filter(e=>n.has(e.id)),i=e.edges.filter(e=>n.has(e.source)&&n.has(e.target));return{nodes:r.map(ide),edges:i.map(ade)}}function K0(e,t){let n=t.createId??u0,r=new Map;for(let t of e.nodes)r.set(t.id,n());let i=new Set(e.nodes.map(e=>e.id));return{nodes:e.nodes.map(e=>{let n=e.parentId,a=typeof n==`string`&&i.has(n),o=a?q0(r,n):void 0;return{...e,id:q0(r,e.id),parentId:o,position:a?e.position:{x:e.position.x+t.offset.x,y:e.position.y+t.offset.y},selected:!0,dragging:!1,data:{...e.data,config:ode(sde(e.data.config,r),r,e)}}}),edges:e.edges.map(e=>({...e,id:n(),source:q0(r,e.source),target:q0(r,e.target),selected:!0}))}}function rde(e,t){let n=new Set(e.map(e=>e.id)),r=e.filter(e=>!e.parentId||!n.has(e.parentId)),i=r.map(e=>e.position.x),a=r.map(e=>e.position.y);return{x:t.x-Math.min(...i),y:t.y-Math.min(...a)}}function q0(e,t){let n=e.get(t);if(n===void 0)throw Error(`cloneSelection expected extractCopyableSelection output`);return n}function ide(e){return{...q1(W1(e)),selected:!1,dragging:!1}}function ade(e){return{...J1(K1(e)),selected:!1}}function ode(e,t,n){if(!e||!D0(n))return e;let r={...e},i=Array.isArray(e.entryNodeIds)?e.entryNodeIds.map(e=>typeof e==`string`?t.get(e):void 0).filter(e=>typeof e==`string`):[],a=typeof e.exitNodeId==`string`?t.get(e.exitNodeId):void 0;return i.length>0&&(r.entryNodeIds=i),a&&(r.exitNodeId=a),r}function sde(e,t){return e&&g0(e,e=>{let n=t.get(e.nodeId);if(n)return h0({nodeId:n,nodeLabel:e.nodeLabel,fieldPath:e.fieldPath})})}function cde(e,t){return Py(e,t)?.integration}function J0(e,t,n){let r=_0(t.data.config,`actionType`);if(!r)return t;let i=cde(e,r);if(!i)return t;let a=_0(t.data.config,`integrationId`);if(a&&n.some(e=>e.id===a))return t;let o=n.filter(e=>e.type===i);return o.length===1?X0(t,o[0].id):o.length===0&&a?X0(t,void 0):t}function Y0(e,t,n){let r=!1,i=t.map(t=>{let i=J0(e,t,n);return i!==t&&(r=!0),i});return r?i:t}function X0(e,t){return{...e,data:{...e.data,config:{...e.data.config,integrationId:t}}}}var Z0=jy(`workflow`,`save`),Q0=lA(null),$0=lA(``),lde=lA(`private`),e2=lA(`live`),t2=lA(!0),n2=lA(null),r2=lA(!1),i2=lA(null),a2=lA(!1),o2=lA(!1),s2=lA(null),c2=lA(Nue);function l2(){My.invalidateQueries({queryKey:r0.workflow.getAll.key(),refetchType:`none`})}var ude=lA(1e3),dde=lA(()=>({timeoutId:null,pending:[],failedPatches:new Map,isFlushing:!1}));function u2(e){return e instanceof Error?e:Error(`Failed to save workflow`,{cause:e})}function fde(e){let{nodes:t,edges:n,...r}=e;return t&&n?{...r,nodes:t.filter(e=>e.type!==`add`),edges:n}:r}var d2=lA(null,async(e,t,n,r)=>{t(o2,!0),t(s2,null);let i=e(Q0);if(!i)return null;let a=e(dde),o=async()=>{if(!a.isFlushing){a.isFlushing=!0,t(a2,!0);try{for(;a.pending.length>0;){let n=a.pending.shift();if(!n)break;let r;try{let i=await e(c2).update(n.workflowId,fde(n.patch));r={ok:!0,workflow:i},t(s2,null),l2(),o0(My,i),!a.pending.some(e=>e.workflowId===n.workflowId)&&!a.failedPatches.has(n.workflowId)&&e(Q0)===n.workflowId&&t(o2,!1)}catch(e){let i=u2(e);r={ok:!1,error:i},t(s2,i);let o=a.pending.find(e=>e.workflowId===n.workflowId);o?o.patch={...n.patch,...o.patch}:a.failedPatches.set(n.workflowId,{...a.failedPatches.get(n.workflowId),...n.patch}),Z0.error(`Save failed`,{workflowId:n.workflowId,error:e})}for(let e of n.waiters)e(r)}}finally{a.isFlushing=!1,t(a2,!1)}}},s=new Promise(e=>{let t=a.failedPatches.get(i),r=t?{...t,...n}:n;a.failedPatches.delete(i);let o=a.pending.at(-1);if(o?.workflowId===i){o.patch={...o.patch,...r},o.waiters.push(e);return}a.pending.push({workflowId:i,patch:r,waiters:[e]})});return a.timeoutId&&=(clearTimeout(a.timeoutId),null),r?.immediate?(await o(),await s):(a.timeoutId=setTimeout(()=>{a.timeoutId=null,o().catch(e=>{Z0.error(`Save flush failed`,{error:e})})},e(ude)),await s)}),pde=lA(null,async(e,t,n)=>{t($0,n),t(n2,null);let r=await t(d2,{name:n});return r?.ok===!1?r.error:null}),mde=lA(null,async(e,t,n)=>await t(d2,{mode:n},{immediate:!0})),hde=lA(null,async(e,t,n)=>{try{let r=await e(c2).create({name:n.name,description:n.description??``,nodes:n.nodes.filter(e=>e.type!==`add`),edges:n.edges});return t(Q0,r.id),t($0,r.name),t(n2,null),t(o2,!1),t(s2,null),l2(),o0(My,r),{ok:!0,workflow:r}}catch(e){let n=u2(e);return t(s2,n),{ok:!1,error:n}}}),f2=`sidebar-width`,p2=`sidebar-collapsed`,gde=31536e3,_de=20,vde=50,yde=30;function m2(e){if(!(typeof document>`u`))return document.cookie.split(`; `).find(t=>t.startsWith(`${e}=`))?.split(`=`)[1]}function h2(e,t){document.cookie=`${e}=${t}; path=/; max-age=${gde}`}function bde(){let e=Number.parseFloat(m2(f2)??``);return e>=_de&&e<=vde?e:yde}var g2=lA(`properties`),_2=lA(!1),v2=lA(!1),y2=lA(m2(p2)===`true`),b2=lA(e=>e(y2),(e,t,n)=>{let r=typeof n==`function`?n(e(y2)):n;t(y2,r),h2(p2,String(r))}),x2=lA(bde()),S2=lA(e=>e(x2),(e,t,n)=>{t(x2,n),h2(f2,String(n))});function C2(e){return`min(max(${e}%, 320px), 460px)`}var xde=lA(e=>e(b2)?null:C2(e(S2))),w2=lA(!1),T2=lA(!1),E2=lA(e=>e(g2)===`runs`&&e(t2)?`runs`:`properties`),D2=lA(null),O2=lA(e=>e(E2)===`runs`?e(D2):null,(e,t,n)=>{t(D2,n)});function Sde(e){let t=new Map;for(let n of e.edges){let e=t.get(n.source);e?e.push(n.target):t.set(n.source,[n.target])}let n=[];for(let r of e.startIds)n.push(...t.get(r)??[]);let r=new Set;for(;n.length>0;){let e=n.pop();!e||r.has(e)||(r.add(e),n.push(...t.get(e)??[]))}return r}var k2=`started`,A2=`canceled`;function Cde(e){return e===`started`||e===`canceled`}var j2={nodeIds:new Set,outletEdgeIds:new Set};function wde(e){let t=Tde(e),n=e.nodes.filter(e=>e.data.enabled===!1).map(e=>e.id);if(t.length===0&&n.length===0)return j2;let r=new Set(t.map(e=>e.target)),i=[...r,...n];for(let t of Sde({startIds:i,edges:e.edges}))r.add(t);return Ede(e.nodes,r),r.size===0?j2:{nodeIds:r,outletEdgeIds:new Set(t.map(e=>e.id))}}function Tde(e){let t=e.nodes.filter(e=>e.data.type===`lifecycle`);if(t.length===0||t.some(e=>w1(e.data.config)))return[];let n=new Set(t.map(e=>e.id));return e.edges.filter(e=>n.has(e.source)&&e.sourceHandle===`canceled`)}function Ede(e,t){let n=new Map;for(let r of e){if(!r.parentId)continue;let e=t.has(r.id);n.set(r.parentId,(n.get(r.parentId)??!0)&&e)}for(let[e,r]of n)r&&t.add(e)}var M2=`payload`,Dde=`event`,Ode=`$event.name`;function kde(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Ade(e){return e===`before`||e===`after`}function N2(e){return kde(e.operator)}function P2(e){return Ade(e.operator)}function jde(e){return e===`is_set`||e===`is_not_set`}function F2(e){return jde(e.operator)}function I2(e,t=`rule`){return e.type===`timestamp`?{id:t,field:e.path,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e.type===`number`?{id:t,field:e.path,fieldType:`number`,operator:`equals`,value:0}:e.type===`boolean`?{id:t,field:e.path,fieldType:`boolean`,operator:`is_true`}:{id:t,field:e.path,fieldType:`string`,operator:`equals`,value:``}}function Mde(e,t){let n=!1,r=e.groups.map(e=>({...e,conditions:e.conditions.map(e=>{let r=t.get(e.field);return!r||r.type===e.fieldType?e:(n=!0,I2(r,e.id))})}));return n?{...e,groups:r}:e}function L2(e,t){return{version:2,groupLogic:`and`,groups:[{id:t?.groupId??`group`,logic:`and`,conditions:[I2(e,t?.conditionId??`rule`)]}]}}var Nde=[{value:`and`,label:`AND`},{value:`or`,label:`OR`}],Pde=[{value:`within_next`,label:`is within the next`},{value:`more_than_from_now`,label:`is more than from now`},{value:`less_than_ago`,label:`is less than ago`},{value:`more_than_ago`,label:`is more than ago`},{value:`before`,label:`is before`},{value:`after`,label:`is after`}],R2=[{value:`minutes`,label:`minutes`},{value:`hours`,label:`hours`},{value:`days`,label:`days`},{value:`weeks`,label:`weeks`}],Fde=[{value:`equals`,label:`equals`},{value:`not_equals`,label:`does not equal`},{value:`contains`,label:`contains`}],Ide=[{value:`equals`,label:`equals`},{value:`not_equals`,label:`does not equal`},{value:`greater_than`,label:`is greater than`},{value:`greater_or_equal`,label:`is greater than or equal`},{value:`less_than`,label:`is less than`},{value:`less_or_equal`,label:`is less than or equal`}],Lde=[{value:`is_true`,label:`is true`},{value:`is_false`,label:`is false`}],Rde=[{value:`is_set`,label:`is set`},{value:`is_not_set`,label:`is not set`}],zde=RegExp(`^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|(?:[+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$`),z2=yh.check(Tee(zde)).pipe(Mh(Mee,Vf)),Bde=ah(z2);ch(z2);var Vde=dh(z2);function B2(e){return Rc(Bde(e.trim()))}function Hde(e){return Vde(e)}function V2(e){return yh.annotate({message:e}).pipe(Mh(yh,Lf())).check(Lh(1).annotate({message:e})).annotateKey({messageMissingKey:e})}function H2(e,t){return e.annotate({message:t}).annotateKey({messageMissingKey:t})}function U2(e){return{id:V2(`Condition id is required`),field:V2(`Condition field is required`),fieldType:hh(e)}}function W2(e,t){return Ch({...U2(e),operator:H2(Ah([`is_set`,`is_not_set`]),t)})}var G2=`Timestamp operator is invalid`,K2=`Timestamp amount must be a positive integer`,q2=`Timestamp absolute operators require a valid date-time`,J2=`String operator is invalid`,Y2=`Number operator is invalid`,X2=`Number conditions require a finite numeric value`,Z2=`Boolean operator is invalid`;function Ude(e){return B2(e)!==null}var Wde=[Ch({...U2(`timestamp`),operator:H2(Ah([`within_next`,`more_than_from_now`,`less_than_ago`,`more_than_ago`]),G2),amount:H2(bh,K2).check(Ih().annotate({message:K2}),kee().annotate({message:K2}),Oee(0).annotate({message:K2})),unit:H2(Ah([`minutes`,`hours`,`days`,`weeks`]),`Timestamp unit is invalid`)}),Ch({...U2(`timestamp`),operator:H2(Ah([`before`,`after`]),G2),dateTime:yh.annotate({message:q2}).pipe(Mh(yh,Lf())).check(Nh(e=>Ude(e)?void 0:q2)).annotateKey({messageMissingKey:q2})}),W2(`timestamp`,G2),Ch({...U2(`string`),operator:H2(Ah([`equals`,`not_equals`,`contains`]),J2),value:H2(yh,`String conditions require a text value`)}),W2(`string`,J2),Ch({...U2(`number`),operator:H2(Ah([`equals`,`not_equals`,`greater_than`,`greater_or_equal`,`less_than`,`less_or_equal`]),Y2),value:H2(bh,X2).check(Ih().annotate({message:X2}))}),W2(`number`,Y2),Ch({...U2(`boolean`),operator:H2(Ah([`is_true`,`is_false`]),Z2)}),W2(`boolean`,Z2)],Gde=wh(yh,gh).annotate({message:`Condition must be an object`}).pipe(Mh(kh(Wde).annotate({message:`Condition field type is invalid`}))),Q2=`Each group must contain at least one condition`,Kde=Ch({id:V2(`Group id is required`),logic:H2(Ah([`and`,`or`]),`Group logic is invalid`),conditions:H2(Dh(Eh(Gde)),Q2).check(Lh(1).annotate({message:Q2}))}).annotate({message:`Group must be an object`}),$2=`Condition model must contain at least one group`,qde=oh(Ch({version:H2(hh(2),`Condition model version must be 2`),groupLogic:H2(Ah([`and`,`or`]),`Condition model group logic is invalid`),groups:H2(Dh(Eh(Kde)),$2).check(Lh(1).annotate({message:$2}))}).annotate({message:`Condition model must be an object`})),Jde=df();function Yde(e){let t=e.path?.at(-1);if(t!=null)return typeof t==`object`?t.key:t}function Xde(e){return(e.find(e=>Yde(e)!==`operator`)??e[0])?.message}function e4(e){let t=e;if(typeof e==`string`){let n=e.trim();if(!n)return{valid:!1,error:`Condition model is empty`};try{t=JSON.parse(n)}catch{return{valid:!1,error:`Condition model must be valid JSON`}}}let n=qde(t);if(Uc(n)){let{issues:e}=Jde(n.failure.issue);return{valid:!1,error:Xde(e)??`Condition model is invalid`}}return{valid:!0,model:n.success}}function t4(e){return JSON.stringify(e)}function n4(e){return JSON.stringify(e)}function r4(e){return e===`and`||e===`or`}function Zde(e){return typeof e==`number`&&Number.isFinite(e)&&Number.isInteger(e)&&e>0}function Qde(e){return e===`minutes`||e===`hours`||e===`days`||e===`weeks`}function $de(e){return B2(e)!==null}function efe(e){switch(e){case`equals`:return`==`;case`not_equals`:return`!=`;case`greater_than`:return`>`;case`greater_or_equal`:return`>=`;case`less_than`:return`<`;case`less_or_equal`:return`<=`;default:return`==`}}function tfe(e,t){if(N2(e)){let n=e.amount;if(!Zde(n))return{valid:!1,error:`Timestamp amount must be a positive integer`,incomplete:!0};if(!Qde(e.unit))return{valid:!1,error:`Timestamp unit is invalid`};let r=e.unit;return e.operator===`within_next`?{valid:!0,expression:`${t} > now && ${t} < now + ${r}(${n})`}:e.operator===`more_than_from_now`?{valid:!0,expression:`${t} > now + ${r}(${n})`}:e.operator===`less_than_ago`?{valid:!0,expression:`${t} > now - ${r}(${n})`}:{valid:!0,expression:`${t} < now - ${r}(${n})`}}if(!$de(e.dateTime))return{valid:!1,error:`Timestamp absolute operators require a valid date-time`,incomplete:!0};let n=n4(e.dateTime.trim());return e.operator===`before`?{valid:!0,expression:`${t} < date(${n})`}:{valid:!0,expression:`${t} > date(${n})`}}function nfe(e,t){if(!e.value.trim())return{valid:!1,error:`Text conditions require a value`,incomplete:!0};let n=n4(e.value);return e.operator===`equals`?{valid:!0,expression:`${t} == ${n}`}:e.operator===`not_equals`?{valid:!0,expression:`${t} != ${n}`}:{valid:!0,expression:`${t}.contains(${n})`}}function rfe(e,t){return Number.isFinite(e.value)?{valid:!0,expression:`${t} ${efe(e.operator)} ${e.value}`}:{valid:!1,error:`Number conditions require a finite numeric value`,incomplete:!0}}function ife(e,t){return e.operator===`is_true`?{valid:!0,expression:`${t} == true`}:{valid:!0,expression:`${t} == false`}}function afe(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(e)}function ofe(e){let t=Uue(e);if(!t)return null;if(t.every(e=>e.kind===`key`&&afe(e.key))){let e=t.map(e=>e.key);return{field:`${M2}.${e.join(`.`)}`,presence:e.map((t,n)=>`has(${M2}.${e.slice(0,n+1).join(`.`)})`).join(` && `)}}let n=M2,r=[];for(let e of t)if(e.kind===`key`){let t=n4(e.key);r.push(`${t} in ${n}`),n=`${n}[${t}]`}else r.push(`size(${n}) > ${e.index}`),n=`${n}[${e.index}]`;return{field:n,presence:r.join(` && `)}}function sfe(e,t){return e.operator===`is_set`?{valid:!0,expression:t}:{valid:!0,expression:`!(${t})`}}function i4(e,t){return e.fieldType===`timestamp`?tfe(e,t):e.fieldType===`string`?nfe(e,t):e.fieldType===`number`?rfe(e,t):ife(e,t)}function cfe(e){let t=`${Dde}.name`;return F2(e)?{valid:!0,expression:e.operator===`is_set`?`${t} != null`:`${t} == null`}:i4(e,t)}function lfe(e){let t=e.field.trim();if(!t)return{valid:!1,error:`Condition field is required`};if(t===`$event.name`)return cfe(e);let n=ofe(t);if(!n)return{valid:!1,error:`Condition field path is invalid`};let{field:r,presence:i}=n;if(F2(e))return sfe(e,i);let a=i4(e,r);return a.valid?{valid:!0,expression:`${i} && (${a.expression})`}:a}function ufe(e){if(e.conditions.length===0)return{valid:!1,error:`Each group must contain at least one condition`};let t=[];for(let n of e.conditions){let e=lfe(n);if(!e.valid)return e;t.push(`(${e.expression})`)}let n=e.logic===`and`?` && `:` || `;return{valid:!0,expression:t.join(n)}}function a4(e){if(!r4(e.groupLogic))return{valid:!1,error:`Condition model group logic is invalid`};if(e.groups.length===0)return{valid:!1,error:`Condition model must contain at least one group`};let t=[];for(let n of e.groups){if(!r4(n.logic))return{valid:!1,error:`Group logic is invalid`};let e=ufe(n);if(!e.valid)return e;t.push(`(${e.expression})`)}let n=e.groupLogic===`and`?` && `:` || `;return{valid:!0,expression:t.join(n)}}function dfe(e){let t=e4(e);return t.valid?a4(t.model):{valid:!1,error:t.error}}var o4=Ch({event:Bh,match:mh(yh)}),ffe=Dh(Eh(o4)).check(Lh(1)),pfe=Ch({waitMode:mh(Ah([`delay`,`event`])),waitFor:mh(ffe),waitTimeout:mh(yh),waitTimeoutBehavior:mh(Ah([`continue`,`skip`])),waitDuration:mh(yh),waitUntil:mh(yh),waitOffset:mh(yh),waitGateMode:mh(Ah([`off`,`require_actual_wait`])),waitAllowedHoursMode:mh(yh),waitAllowedStartTime:mh(yh),waitAllowedEndTime:mh(yh),waitTimezone:mh(yh)}),s4={waitDuration:{type:`duration`,required:!0,owner:{mode:`delay`,timing:`duration`}},waitUntil:{type:`timestamp`,required:!0,owner:{mode:`delay`,timing:`until`}},waitOffset:{type:`duration`,required:!1,owner:{mode:`delay`,timing:`until`}},waitTimeout:{type:`duration`,required:!0,owner:{mode:`event`}}},c4=[`waitDuration`,`waitUntil`,`waitOffset`,`waitTimeout`];function l4(e){let t=e.waitDelayTimingMode;return t===`until`||t===`duration`?t:typeof e.waitUntil==`string`&&e.waitUntil.trim()?`until`:`duration`}function mfe(e){let t=e.waitMode===`event`?`event`:`delay`,n=l4(e);return c4.filter(e=>{let{owner:r}=s4[e];return r.mode===`event`?t===`event`:t===`delay`&&r.timing===n})}function u4(e){let t=new Set(mfe(e));return c4.filter(e=>!t.has(e))}oh(pfe);var hfe=Wh(Dh(Eh(o4)));function d4(e){return hfe(e?.waitFor)??[]}var gfe=/^([01]\d|2[0-3]):([0-5]\d)$/;function f4(e){return typeof e==`string`&&e.trim()===`daily_window`?`daily_window`:`off`}function p4(e){if(typeof e!=`string`)return null;let t=e.trim(),n=gfe.exec(t);if(!n)return null;let[,r,i]=n;return r&&i?Number.parseInt(r,10)*60+Number.parseInt(i,10):null}function _fe(e){let t=[],n=typeof e.mode==`string`?e.mode.trim():f4(e.mode);if(n.length>0&&n!==`off`&&n!==`daily_window`)return t.push({field:`mode`,message:`Allowed-hours mode must be either "off" or "daily_window".`}),t;if(n!==`daily_window`)return t;let r=p4(e.startTime);r===null&&t.push({field:`start`,message:`Allowed-hours start must use HH:MM (24-hour) format.`});let i=p4(e.endTime);return i===null&&t.push({field:`end`,message:`Allowed-hours end must use HH:MM (24-hour) format.`}),r!==null&&i!==null&&r>=i&&t.push({field:`window`,message:`Allowed-hours start must be earlier than end (same-day window only).`}),t}function vfe(e){return e.type===`group`&&`fields`in e&&Array.isArray(e.fields)}function m4(e){return e==null||typeof e==`string`&&e.trim().length===0}function yfe(e){let t=[];for(let n of e){if(vfe(n)){t.push(...n.fields);continue}t.push(n)}return t}function bfe(e){let{config:t,configFields:n}=e;return yfe(n).filter(e=>e.required===!0&&d0(t,e.showWhen)&&m4(t[e.key])).map(e=>({fieldKey:e.key,fieldLabel:e.label}))}function xfe(e){return kQ(e.waitMode)===`event`?`event`:`delay`}function Sfe(e){if(xfe(e)===`event`){let t=[];d4(e).length===0&&t.push({fieldKey:`waitFor`,fieldLabel:`Wait for these events`});for(let n of d4(e)){let e=kQ(n.match);if(!e)continue;let r=dfe(e);!r.valid&&r.incomplete&&t.push({fieldKey:`waitFor`,fieldLabel:`Match value for "${n.event}"`})}return m4(e.waitTimeout)&&t.push({fieldKey:`waitTimeout`,fieldLabel:`Stop waiting after`}),t}let t=[];if(l4(e)===`until`?m4(e.waitUntil)&&t.push({fieldKey:`waitUntil`,fieldLabel:`Wait until this date/time`}):m4(e.waitDuration)&&t.push({fieldKey:`waitDuration`,fieldLabel:`Wait for (duration)`}),kQ(e.waitAllowedHoursMode)===`daily_window`){let n=kQ(e.waitAllowedStartTime);(!n||p4(n)===null)&&t.push({fieldKey:`waitAllowedStartTime`,fieldLabel:`Window start (HH:MM)`});let r=kQ(e.waitAllowedEndTime);(!r||p4(r)===null)&&t.push({fieldKey:`waitAllowedEndTime`,fieldLabel:`Window end (HH:MM)`}),m4(e.waitTimezone)&&t.push({fieldKey:`waitTimezone`,fieldLabel:`Timezone`})}return t}function Cfe(e){let{actionType:t,config:n}=e;switch(t){case b1.condition:return m4(n.condition)?[{fieldKey:`condition`,fieldLabel:`Condition`}]:[];case b1.wait:return Sfe(n);default:return[]}}function h4(e){let{node:t,actionType:n,actionLabel:r}=e;return kQ(t.data.label)||r||n||t.id}function wfe(e){let{node:t,resolveActionByType:n}=e;if(t.data.type!==`action`||t.data.enabled===!1)return null;let r=t.data.config??{},i=kQ(r.actionType);if(!i)return{nodeId:t.id,nodeLabel:h4({node:t}),missingFields:[{fieldKey:`actionType`,fieldLabel:`Action`}]};let a=n(i),o=Cfe({actionType:i,config:r}),s=a?bfe({config:r,configFields:a.configFields??[]}):[],c=[...o,...s];return c.length===0?null:{nodeId:t.id,nodeLabel:h4({node:t,actionType:i,actionLabel:a?.label}),missingFields:c}}function Tfe(e){let{nodes:t,resolveActionByType:n}=e;return t.map(e=>wfe({node:e,resolveActionByType:n})).filter(e=>e!==null)}function g4(e){return e.type===`group`}function Efe(e){let t=[];for(let n of e)g4(n)?t.push(...n.fields):t.push(n);return t}function Dfe(e){return t=>Py(e,t)}function _4(e){return kQ(e.node.data.label)||(e.actionLabel?e.actionLabel:e.actionType?e.actionType:e.node.id)}function Ofe(e){return Tfe({nodes:e.nodes,resolveActionByType:Dfe(e.catalog)}).flatMap(e=>e.missingFields.map(t=>({kind:`missing_required_field`,severity:`blocking`,nodeId:e.nodeId,nodeLabel:e.nodeLabel,fieldKey:t.fieldKey,fieldLabel:t.fieldLabel,message:`Node "${e.nodeLabel}" is missing required field "${t.fieldLabel}"`})))}function kfe(e){let t=new Set(e.integrations.map(e=>e.id)),n=[];for(let r of e.nodes){if(r.data.type!==`action`||r.data.enabled===!1)continue;let i=y0(r.data.config,`actionType`);if(!i)continue;let a=Py(e.catalog,i),o=a?.integration;if(!o)continue;let s=y0(r.data.config,`integrationId`);if(s&&t.has(s))continue;let c=Fy(e.catalog,o)?.label??o,l=_4({node:r,actionLabel:a?.label,actionType:i});n.push({kind:`missing_integration`,severity:`blocking`,nodeId:r.id,nodeLabel:l,integrationType:o,integrationLabel:c,message:`Node "${l}" needs a ${c} connection`})}return n}function Afe(e){return typeof e==`string`?p0(e).map(e=>({nodeId:e.nodeId,displayText:e.fieldPath?`${e.nodeLabel}.${e.fieldPath}`:e.nodeLabel})):[]}function v4(e,t=``){let n=[];for(let[r,i]of Object.entries(e)){let e=t?`${t}.${r}`:r;if(typeof i==`string`){for(let t of Afe(i))n.push({field:e,...t});continue}if(typeof i==`object`&&i&&!Array.isArray(i)){let t={...i};n.push(...v4(t,e))}}return n}function jfe(e){let t=new Set(e.nodes.map(e=>e.id)),n=[];for(let r of e.nodes){if(r.data.enabled===!1)continue;let i=r.data.config;if(!i||typeof i!=`object`)continue;let a=v4(i).filter(e=>!t.has(e.nodeId));if(a.length===0)continue;let o=y0(i,`actionType`),s=o?Py(e.catalog,o):void 0,c=s?Efe(s.configFields):[],l=_4({node:r,actionLabel:s?.label,actionType:o});for(let e of a){let t=c.find(t=>t.key===e.field)?.label??e.field;n.push({kind:`broken_reference`,severity:`warning`,nodeId:r.id,nodeLabel:l,fieldKey:e.field,fieldLabel:t,referencedNodeId:e.nodeId,displayText:e.displayText,message:`Node "${l}" references missing step in ${t}`})}}return n}function y4(e){return[...Ofe(e),...kfe(e),...jfe(e)]}function b4(e){return e.some(e=>e.severity===`blocking`)}function x4(e){let t=new Map,n=new Map,r=new Map;for(let i of e)switch(i.kind){case`missing_required_field`:{let e=t.get(i.nodeId);if(e){e.missingFields.push({fieldKey:i.fieldKey,fieldLabel:i.fieldLabel});break}t.set(i.nodeId,{nodeId:i.nodeId,nodeLabel:i.nodeLabel,missingFields:[{fieldKey:i.fieldKey,fieldLabel:i.fieldLabel}]});break}case`broken_reference`:{let e=n.get(i.nodeId);if(e){e.brokenReferences.push({fieldKey:i.fieldKey,fieldLabel:i.fieldLabel,referencedNodeId:i.referencedNodeId,displayText:i.displayText});break}n.set(i.nodeId,{nodeId:i.nodeId,nodeLabel:i.nodeLabel,brokenReferences:[{fieldKey:i.fieldKey,fieldLabel:i.fieldLabel,referencedNodeId:i.referencedNodeId,displayText:i.displayText}]});break}case`missing_integration`:{let e=r.get(i.integrationType);if(e){e.nodeNames.includes(i.nodeLabel)||e.nodeNames.push(i.nodeLabel);break}r.set(i.integrationType,{integrationType:i.integrationType,integrationLabel:i.integrationLabel,nodeNames:[i.nodeLabel]});break}default:throw Error(`Unhandled workflow issue`)}return{missingRequiredFields:Array.from(t.values()),missingIntegrations:Array.from(r.values()),brokenReferences:Array.from(n.values())}}var S4=[],C4=lA(S4),Mfe=lA(e=>{let t=qa(e(C4),e=>e.nodeId),n=new Map(Object.entries(t).map(([e,t])=>{let n=Ife(t),r=w4.get(e);return[e,r&&Nfe(r,n)?r:n]}));return w4=n,n}),w4=new Map;function Nfe(e,t){return e.severity===t.severity&&e.messages.length===t.messages.length&&e.messages.every((e,n)=>e===t.messages[n])}var Pfe=lA(e=>b4(e(C4))),Ffe=new Map;function Ife(e){return{severity:e.some(e=>e.severity===`blocking`)?`blocking`:`warning`,messages:e.map(e=>e.message)}}function Lfe(e,t){return e===t||e.length===t.length&&e.every((e,n)=>{let r=t[n];return e.kind===r.kind&&e.nodeId===r.nodeId&&e.message===r.message})}function T4(e=192){return{width:e,height:112}}function E4(e,t){let n=Math.max(e,1),r=Math.max(t,1);return{width:12+n*188+(n-1)*24+12,height:48+r*56+(r-1)*40+12}}var Rfe=132;function D4(e){return e>1?e*Rfe:192}var O4=`size-5`,zfe=324/212,Bfe=200/96;function Vfe(e){let t=P0(e.nodes,e.edges,e.selectedIds,e.catalog);if(!t.ok)return null;let n=new Map(e.nodes.map(e=>[e.id,e])),r=t.memberIds.map(e=>{let t=n.get(e);if(!t)throw Error(`groupSelection expected analyzeGroupableSelection ids`);return t}),i={x:Math.min(...r.map(e=>e.position.x)),y:Math.min(...r.map(e=>e.position.y))},a=new Set(t.memberIds),o=e.edges.filter(e=>N0(a,e)),{slots:s,bounds:c}=H0(t.memberIds,o,t.entryIds),l=E4(c.columns,c.rows),u=(e.createId??u0)(),d=F4(s,c.columns),f=n.get(t.exitId),p={id:u,type:`group`,position:i,width:l.width,height:l.height,style:{width:l.width,height:l.height},selected:!0,data:{label:`Group`,type:`group`,config:{entryNodeIds:t.entryIds,exitNodeId:t.exitId,...S0(f)?{outletHandle:`true`}:{}}}},m=r.some(e=>e.data.enabled===!1),h=r.map(e=>L4(m?{...e,data:{...e.data,enabled:!1}}:e,u,I4(d,e.id)));return{nodes:V0([...e.nodes.filter(e=>!a.has(e.id)).map(e=>({...e,selected:!1})),p,...h]),edges:qfe({edges:e.edges,entryIds:t.entryIds,createEdgeId:e.createEdgeId??u0}),analysis:t}}function k4(e,t){let n=e.find(e=>e.id===t);return!n||!D0(n)?e:V0(e.flatMap(e=>e.id===t?[]:e.parentId===t?[Yfe(e,Jfe(n,e))]:[e]))}function Hfe(e,t){let n=new Map;for(let t of e){if(!t.parentId)continue;let e=n.get(t.parentId)??[];e.push(t),n.set(t.parentId,e)}if(n.size===0)return e;let r=new Map,i=new Map;for(let[a,o]of n){let n=e.find(e=>e.id===a),s=o.map(e=>e.id),c=new Set(s),{slots:l,bounds:u}=H0(s,t.filter(e=>N0(c,e)),O0(n));i.set(a,E4(u.columns,u.rows));let d=F4(l,u.columns);for(let e of o)r.set(e.id,L4(e,a,I4(d,e.id)))}return e.map(e=>{if(D0(e)){let t=i.get(e.id);return t?{...e,width:t.width,height:t.height,style:{...e.style,width:t.width,height:t.height}}:e}return r.get(e.id)??e})}var A4=new WeakMap;function Ufe(e,t){let n=new Map(e.map(e=>[e.id,e.parentId])),r=e=>n.get(e),i=!1,a=t.map(e=>{if(!M0(r,e))return e;i=!0;let t=A4.get(e);if(t)return t;let n={...e,selectable:!1,deletable:!1,focusable:!1};return A4.set(e,n),n});return i?a:t}function j4(e){let t=e;for(let e of Xue(t))t=k4(t,e);return t}function M4(e){let t=new Set(e.filter(e=>D0(e)).map(e=>e.id));return e.some(e=>e.parentId&&!t.has(e.parentId))?`Ungroup the frame before deleting a step inside it`:null}function N4(e){let t=M4(e);return t&&Ty.error(t),t}function P4(e){return!!(e&&(D0(e)||e.parentId))}function Wfe(e,t){let n=new Set([t]);if(D0(e.find(e=>e.id===t)))for(let r of z0(e,t))n.add(r);return n}function Gfe(e,t,n){let r=new Set;for(let i of n)if(i.type===`remove`)for(let n of I0(e,t,i.id))r.add(n);return r.size===0?n:[...n.filter(e=>e.type!==`remove`),...[...r].map(e=>({type:`remove`,id:e}))]}function Kfe(e,t){let n=new Set(e.map(e=>e.id)),r=t.filter(e=>n.has(e.source)&&n.has(e.target));return r.length===t.length?t:r}function qfe(e){let{edges:t,entryIds:n,createEdgeId:r}=e,i=new Set(n),a=t.filter(e=>i.has(e.target)),o=[],s=new Set;for(let e of a){let t=j0(e);s.has(t)||(s.add(t),o.push(e))}if(o.length!==1)return t;let c=o[0];if(!c)return t;let l=j0(c),u=new Set(t.filter(e=>j0(e)===l).map(e=>e.target)),d=[];for(let e of n)u.has(e)||d.push({id:r(),source:c.source,target:e,sourceHandle:c.sourceHandle,targetHandle:c.targetHandle});return d.length===0?t:[...t,...d]}function F4(e,t){let n=new Map;for(let t of e)n.set(t.row,(n.get(t.row)??0)+1);let r=new Map;for(let i of e){let e=(t-(n.get(i.row)??1))*212/2;r.set(i.id,{x:12+e+i.column*212,y:48+i.row*96})}return r}function I4(e,t){let n=e.get(t);if(!n)throw Error(`Group layout has no slot for member '${t}'`);return n}function L4(e,t,n){return{...e,parentId:t,extent:`parent`,draggable:!1,connectable:!1,selected:!1,width:188,height:56,position:n}}function Jfe(e,t){if(typeof e.width!=`number`)throw Error(`Group '${e.id}' has no width to ungroup around`);let n=e.position.x+e.width/2,r=e.position.x+t.position.x+94,i=t.position.y-36-12;return{x:n+(r-n)*zfe-96,y:e.position.y+i*Bfe}}function Yfe(e,t){let{extent:n,parentId:r,...i}=e;return{...i,draggable:!0,connectable:!0,width:192,height:112,position:t}}var R4=lA([]),z4=lA([]),B4=lA(null),V4=lA(e=>e(E2)===`runs`?e(B4):null,(e,t,n)=>{t(B4,n===null?null:{nodes:V0(n.nodes),edges:n.edges})}),H4=lA(null),U4=lA(null),W4=lA([]),G4=lA([]);function K4(e){return e(V4)===null}function q4(e,t){let n={nodes:e(R4),edges:e(z4)};t(W4,[...e(W4),n].slice(-50)),t(G4,[])}function J4(e,t,n){t(d2,{nodes:e(R4),edges:e(z4)},n)}var Y4=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(R4),i=n.selectedIds??new Set(r.filter(e=>e.selected).map(e=>e.id)),a=Vfe({nodes:r,edges:e(z4),selectedIds:i,catalog:n.catalog});return a?(q4(e,t),t(R4,a.nodes),t(z4,a.edges),t(H4,a.nodes.find(e=>D0(e)&&e.selected)?.id??null),t(U4,null),J4(e,t,{immediate:!0}),!0):!1}),X4=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(R4),i=r.find(e=>e.id===n),a=D0(i)?n:i?.parentId;if(!a)return!1;let o=k4(r,a);return o!==r&&(q4(e,t),t(R4,o),t(H4,null),t(U4,null),J4(e,t,{immediate:!0}),!0)}),Xfe=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(R4),i=new Set(z0(r,n.groupId));return i.size!==0&&(q4(e,t),t(R4,r.map(e=>i.has(e.id)?{...e,data:{...e.data,enabled:n.enabled}}:e)),J4(e,t),!0)}),Zfe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=A0(r.find(e=>e.id===n.source))??n.sourceHandle,a=e(z4),o=F0({nodes:r,edges:a,sourceId:n.source,targetId:n.target,sourceHandle:i}).map((e,t)=>({...n,id:t===0?n.id:u0(),source:e.source,target:e.target,sourceHandle:e.sourceHandle}));o.length!==0&&(q4(e,t),t(z4,[...a,...o]),J4(e,t,{immediate:!0}))}),Z4=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(z4),i=new Set(I0(e(R4),r,n));if(i.size===0)return;let a=r.filter(e=>!i.has(e.id));a.length!==r.length&&(q4(e,t),t(z4,a),e(U4)&&i.has(e(U4)??``)&&t(U4,null),J4(e,t,{immediate:!0}))}),Q4=lA(e=>e(R4)),$4=lA(e=>e(z4)),e3=lA(new Map),t3=lA(e=>e(V4)!==null),n3=lA(e=>e(T2)||e(t3)),r3=lA(e=>wde({nodes:e(V4)?.nodes??e(R4),edges:e(V4)?.edges??e(z4)})),Qfe={opacity:.5},i3=new WeakMap,$fe=lA(e=>{let t=e(V4),n=t?.nodes??e(R4),r=e(e3),{nodeIds:i}=e(r3),a=V0(n),o=B0(n),s=t?Ffe:e(Mfe);if(r.size===0&&i.size===0&&o.size===0&&s.size===0)return a;let c=r.size>0;return a.map(e=>{let t=o.has(e.id),n=i.has(e.id)&&!t&&e.data.enabled!==!1,a=s.get(e.id);if(!(c||t||n||a))return e;let l=c?r.get(e.id)??`idle`:void 0,u=i3.get(e);if(u&&u.status===l&&u.disabledFrame===t&&u.muted===n&&u.issues===a)return u.painted;let d={...e,data:{...e.data,...l?{status:l}:{},...t?{enabled:!1}:{},...a?{issues:a}:{}}},f=n?{...d,style:{...d.style,...Qfe}}:d;return i3.set(e,{status:l,disabledFrame:t,muted:n,issues:a,painted:f}),f})}),epe=lA(e=>{let t=e(V4)?.nodes??e(R4),n=Ufe(t,L0(t,e(V4)?.edges??e(z4))),{nodeIds:r,outletEdgeIds:i}=e(r3);return r.size===0?n:n.map(e=>r.has(e.target)?{...e,data:{...e.data,inactive:!0,...i.has(e.id)?{displayLabel:`No Cancel Event`}:{}}}:e)}),a3=lA(null),o3=lA(null),s3=lA(!1),tpe=lA(null,(e,t,n)=>{t(R4,V0(n.nodes)),t(z4,n.edges),t(W4,[]),t(G4,[]),t(H4,null),t(U4,null),t(a3,null),t(o2,!1),t(C4,S4)}),npe=lA(null,(e,t,n)=>{t(tpe,{nodes:n.nodes.map(e=>({...e,selected:!1})),edges:n.edges}),t(e3,new Map),t(V4,null),t(O2,null),t(Q0,n.id),t($0,n.name),t(lde,n.visibility??`private`),t(e2,n.mode??`live`),t(t2,n.isOwner!==!1),t(r2,!1),t(i2,null)}),rpe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=Y0(n.catalog,r,n.integrations);i!==r&&(t(R4,i),J4(e,t))}),ipe=lA(null,(e,t)=>{K4(e)&&q4(e,t)}),ape=lA(null,(e,t)=>{K4(e)&&(t(R4,e(R4).map(e=>({...e,selected:!1}))),t(z4,e(z4).map(e=>({...e,selected:!1}))),t(H4,null),t(U4,null))}),ope=lA(null,(e,t,n)=>{K4(e)&&(t(R4,e(R4).map(e=>({...e,selected:e.id===n}))),t(H4,n),t(U4,null))}),spe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=n.filter(e=>e.type!==`remove`||r.find(t=>t.id===e.id)?.data.type!==`lifecycle`),a=i.some(e=>e.type===`remove`),o=i.some(e=>e.type===`position`&&e.dragging===!0),s=i.some(e=>e.type===`position`&&e.dragging===!1);o&&!e(s3)&&(q4(e,t),t(s3,!0)),s&&t(s3,!1);let c=j4(bE(i,r));if(t(R4,c),a){let n=Kfe(c,e(z4));t(z4,n);let r=e(U4);r&&!n.some(e=>e.id===r)&&t(U4,null)}let l=c.find(e=>e.selected);if(l){t(H4,l.id),t(U4,null);let n=e(a3);n&&n!==l.id&&t(a3,null)}else if(e(H4)){let n=e(H4);c.find(e=>e.id===n)||t(H4,null),t(a3,null)}a?J4(e,t,{immediate:!0}):s&&J4(e,t)}),cpe=lA(null,(e,t,n)=>{if(!K4(e))return;let r=n.some(e=>e.type===`remove`),i=e(z4),a=xE(Gfe(e(R4),i,n),i);t(z4,a);let o=a.find(e=>e.selected);if(o)t(U4,o.id),t(H4,null);else if(e(U4)){let n=e(U4);a.find(e=>e.id===n)||t(U4,null)}r&&J4(e,t,{immediate:!0})});function c3(e,t,n){let r=n.nodes.map(e=>({...e,selected:!0})),i=n.edges.map(e=>({...e,selected:!0}));q4(e,t),t(R4,V0([...e(R4).map(e=>({...e,selected:!1})),...r])),t(z4,[...e(z4).map(e=>({...e,selected:!1})),...i]),t(H4,r[0].id),t(U4,null);let a=r.length===1?r[0]:void 0;a?.data.type===`action`&&!a.data.config?.actionType?t(a3,a.id):t(a3,null),J4(e,t,{immediate:!0})}function l3(e,t){let n=e(R4);return nde({nodes:n,edges:e(z4),nodeIds:t?tde(n,t):void 0})}var u3=lA(null,(e,t,n)=>{K4(e)&&c3(e,t,{nodes:[n],edges:[]})}),lpe=lA(e=>e(o3)!==null),d3=lA(null,(e,t,n)=>{let r=l3(e,n);return r?(t(o3,{selection:r,pasteCount:0}),!0):!1}),f3=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=e(o3);if(!r)return!1;let i=r.pasteCount+1,a=n?rde(r.selection.nodes,n):{x:48*i,y:48*i};return t(o3,{...r,pasteCount:i}),c3(e,t,K0(r.selection,{offset:a})),!0}),p3=lA(null,(e,t,n)=>{if(!K4(e))return!1;let r=l3(e,n);return r?(c3(e,t,K0(r,{offset:{x:48,y:48}})),!0):!1}),upe=lA(null,(e,t,n)=>{K4(e)&&(q4(e,t),t(R4,n),J4(e,t,{immediate:!0}))}),m3=lA(null,(e,t,{id:n,data:r})=>{if(!K4(e))return;let i=e(R4);q4(e,t);let a=i.find(e=>e.id===n)?.data.label,o=r.label,s=o!==void 0&&a!==o;t(R4,i.map(e=>{if(e.id===n)return{...e,data:{...e.data,...r}};if(s&&a){let t=dpe(e.data.config||{},n,a,o);if(t!==e.data.config)return{...e,data:{...e.data,config:t}}}return e})),J4(e,t)});function dpe(e,t,n,r){return g0(e,e=>{if(e.nodeId===t&&e.nodeLabel===n)return h0({nodeId:t,nodeLabel:r,fieldPath:e.fieldPath})})}var h3=lA(null,(e,t,n)=>{if(!K4(e))return;let r=e(R4),i=r.find(e=>e.id===n);if(i?.data.type===`lifecycle`||i&&N4([i]))return;q4(e,t);let a=Wfe(r,n);t(R4,j4(r.filter(e=>!a.has(e.id)))),t(z4,e(z4).filter(e=>!a.has(e.source)&&!a.has(e.target))),e(H4)&&a.has(e(H4)??``)&&t(H4,null),J4(e,t,{immediate:!0})}),fpe=lA(null,(e,t)=>{if(!K4(e))return;let n=e(R4),r=e(z4),i=n.filter(e=>e.selected);if(N4(i))return;let a=new Set(i.filter(e=>e.data.type!==`lifecycle`).map(e=>e.id));for(let e of n)e.parentId&&a.has(e.parentId)&&a.add(e.id);let o=j4(n.filter(e=>e.data.type===`lifecycle`||!a.has(e.id))),s=new Set(r.filter(e=>e.selected).flatMap(e=>I0(n,r,e.id))),c=r.filter(e=>!s.has(e.id)&&!a.has(e.source)&&!a.has(e.target));(o.length!==n.length||c.length!==r.length)&&(q4(e,t),t(R4,o),t(z4,c),t(H4,null),t(U4,null),J4(e,t,{immediate:!0}))}),g3=lA(null,(e,t)=>{if(!K4(e))return;let n=e(R4),r=n.filter(e=>e.data.type===`lifecycle`);(r.length!==n.length||e(z4).length!==0)&&(q4(e,t),t(R4,r),t(z4,[]),t(H4,null),t(U4,null),J4(e,t,{immediate:!0}))}),_3=lA(null,(e,t)=>{if(!K4(e))return;let n=e(W4),r=n.at(-1);r&&(t(G4,[...e(G4),{nodes:e(R4),edges:e(z4)}]),t(W4,n.slice(0,-1)),t(R4,r.nodes),t(z4,r.edges),J4(e,t,{immediate:!0}))}),v3=lA(null,(e,t)=>{if(!K4(e))return;let n=e(G4),r=n.at(-1);r&&(t(W4,[...e(W4),{nodes:e(R4),edges:e(z4)}]),t(G4,n.slice(0,-1)),t(R4,r.nodes),t(z4,r.edges),J4(e,t,{immediate:!0}))}),ppe=lA(e=>e(W4).length>0),mpe=lA(e=>e(G4).length>0),hpe=lA(null,(e,t)=>{t(V4,null),t(e3,new Map)}),gpe=lA(null,(e,t)=>{t(e3,new Map)}),y3=lA(null,(e,t,n)=>{if(n.length===0)return;let r=e(e3),i=new Map(r),a=!1;for(let{nodeId:e,status:t}of n)r.get(e)!==t&&(i.set(e,t),a=!0);a&&t(e3,i)}),_pe={database:dte};function b3(e){let t=(0,Z.c)(14),{integration:n,className:r}=e,i=r===void 0?`h-3 w-3`:r,a=xy(),o=_pe[n];if(o){let e;t[0]===i?e=t[1]:(e=Q(`text-foreground`,i),t[0]=i,t[1]=e);let n;return t[2]!==o||t[3]!==e?(n=(0,X.jsx)(o,{className:e}),t[2]=o,t[3]=e,t[4]=n):n=t[4],n}let s=a[n];if(s){let e=s.icon,n;t[5]===i?n=t[6]:(n=Q(`text-foreground`,i),t[5]=i,t[6]=n);let r;return t[7]!==e||t[8]!==n?(r=(0,X.jsx)(e,{className:n}),t[7]=e,t[8]=n,t[9]=r):r=t[9],r}let c;t[10]===i?c=t[11]:(c=Q(`text-foreground`,i),t[10]=i,t[11]=c);let l;return t[12]===c?l=t[13]:(l=(0,X.jsx)(Zv,{className:c}),t[12]=c,t[13]=l),l}function x3(e){return Object.keys(OQ(e,e=>!e||e.length===0)).length>0}function S3(e){e.status===`success`?Ty.success(e.message||`Connection successful`):Ty.error(e.message||`Connection failed`)}function vpe(e){return e.integrations.toSorted((e,t)=>e.label.localeCompare(t.label))}var ype=(e,t)=>Fy(e,t)?.label??t;function bpe(e){let t=(0,Z.c)(36),{overlayId:n,onSuccess:r}=e,i=yy(),{push:a}=RY(),[o,s]=(0,Y.useState)(``),c=jY(),l,u,d,f,p,m,h,g;if(t[0]!==i||t[1]!==c||t[2]!==r||t[3]!==n||t[4]!==a||t[5]!==o){let e=o.trim().toLowerCase(),_=vpe(i).filter(t=>!e||t.label.toLowerCase().includes(e)),v;t[14]!==r||t[15]!==a?(v=e=>{a(C3,{type:e,onSuccess:r})},t[14]=r,t[15]=a,t[16]=v):v=t[16];let y=v;l=SX,m=n,h=`Add Connection`,t[17]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Select a service to connect`}),t[17]=g):g=t[17],f=`space-y-3`;let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[18]=b):b=t[18];let x=!c,S;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[19]=S):S=t[19],t[20]!==o||t[21]!==x?(p=(0,X.jsxs)(`div`,{className:`relative`,children:[b,(0,X.jsx)(wX,{autoFocus:x,className:`pl-9`,onChange:S,placeholder:`Search services...`,value:o})]}),t[20]=o,t[21]=x,t[22]=p):p=t[22],u=`max-h-[300px] space-y-1 overflow-y-auto`,d=_.length===0?(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No services found`}):_.map(e=>(0,X.jsxs)(`button`,{className:`flex w-full items-center gap-3 rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted/50`,onClick:()=>y(e.type),type:`button`,children:[(0,X.jsx)(b3,{className:`size-5 shrink-0`,integration:e.type}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})]},e.type)),t[0]=i,t[1]=c,t[2]=r,t[3]=n,t[4]=a,t[5]=o,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else l=t[6],u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];let _;t[23]!==u||t[24]!==d?(_=(0,X.jsx)(`div`,{className:u,children:d}),t[23]=u,t[24]=d,t[25]=_):_=t[25];let v;t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,X.jsxs)(`div`,{className:f,children:[p,_]}),t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29];let y;return t[30]!==l||t[31]!==m||t[32]!==h||t[33]!==g||t[34]!==v?(y=(0,X.jsxs)(l,{overlayId:m,title:h,children:[g,v]}),t[30]=l,t[31]=m,t[32]=h,t[33]=g,t[34]=v,t[35]=y):y=t[35],y}function xpe(e){let t=(0,Z.c)(18),{fieldId:n,label:r,configKey:i,placeholder:a,helpText:o,helpLink:s,value:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,X.jsx)(TX,{htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==l?(d=e=>l(i,e.target.value),t[3]=i,t[4]=l,t[5]=d):d=t[5];let f;t[6]!==n||t[7]!==a||t[8]!==d||t[9]!==c?(f=(0,X.jsx)(wX,{className:`flex-1`,id:n,onChange:d,placeholder:a,type:`password`,value:c}),t[6]=n,t[7]=a,t[8]=d,t[9]=c,t[10]=f):f=t[10];let p;t[11]!==s||t[12]!==o?(p=(o||s)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[o,s&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:s.url,rel:`noopener noreferrer`,target:`_blank`,children:s.text})]}),t[11]=s,t[12]=o,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==f||t[16]!==p?(m=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[u,f,p]}),t[14]=u,t[15]=f,t[16]=p,t[17]=m):m=t[17],m}function C3(e){let t=(0,Z.c)(62),{overlayId:n,type:r,onSuccess:i}=e,a=yy(),{push:o,closeAll:s}=RY(),c=Fe(),[l,u]=(0,Y.useState)(``),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Y.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=(e,t)=>{p(n=>({...n,[e]:t}))},t[1]=m):m=t[1];let h=m,g;t[2]!==s||t[3]!==i||t[4]!==c?(g=r0.integration.create.mutationOptions({onSuccess:async e=>{Ty.success(`Connection created`),await c0(c),i?.(e.id),s()},meta:{errorMessage:`Failed to save connection`}}),t[2]=s,t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=Ze(g),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=r0.integration.testCredentials.mutationOptions({meta:{errorShownByCaller:!0}}),t[6]=v):v=t[6];let y=Ze(v),b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=r0.integration.testCredentials.mutationOptions({onSuccess:S3}),t[7]=b):b=t[7];let x=Ze(b),S;t[8]!==a||t[9]!==r?(S=Fy(a,r),t[8]=a,t[9]=r,t[10]=S):S=t[10];let C=S,w=C?.credentialFields,T=C?.hasTest===!0,E=_.isPending||y.isPending,D;t[11]!==f||t[12]!==_||t[13]!==l||t[14]!==r?(D=()=>{_.mutate({name:l.trim(),type:r,config:f})},t[11]=f,t[12]=_,t[13]=l,t[14]=r,t[15]=D):D=t[15];let O=D,k;t[16]!==o||t[17]!==O?(k=e=>{o(CX,{title:`Connection Test Failed`,message:`${e}\n\nDo you want to save anyway?`,confirmLabel:`Save Anyway`,onConfirm:O})},t[16]=o,t[17]=O,t[18]=k):k=t[18];let A=k,j;t[19]!==f||t[20]!==T||t[21]!==A||t[22]!==O||t[23]!==y||t[24]!==r?(j=async()=>{if(!x3(f)){Ty.error(`Please enter credentials`);return}if(!T){O();return}try{let e=await y.mutateAsync({type:r,config:f});if(e.status===`error`){A(`The test failed: ${e.message}`);return}}catch(e){let t=e;A(t instanceof Error?t.message:`Failed to test connection`);return}O()},t[19]=f,t[20]=T,t[21]=A,t[22]=O,t[23]=y,t[24]=r,t[25]=j):j=t[25];let M=j,N;t[26]!==f||t[27]!==x||t[28]!==r?(N=()=>{if(!x3(f)){Ty.error(`Please enter credentials first`);return}x.mutate({type:r,config:f})},t[26]=f,t[27]=x,t[28]=r,t[29]=N):N=t[29];let P=N,F;t[30]!==f||t[31]!==w?(F=()=>w?Object.entries(w).map(e=>{let[t,n]=e;return n.type===`password`?(0,X.jsx)(xpe,{configKey:t,fieldId:t,helpLink:n.helpLink,helpText:n.helpText,label:n.label,onChange:h,placeholder:n.placeholder,value:f[t]||``},t):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:t,children:n.label}),(0,X.jsx)(wX,{id:t,onChange:e=>h(t,e.target.value),placeholder:n.placeholder,type:n.type,value:f[t]||``}),(n.helpText||n.helpLink)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[n.helpText,n.helpLink&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:n.helpLink.url,rel:`noopener noreferrer`,target:`_blank`,children:n.helpLink.text})]})]},t)}):null,t[30]=f,t[31]=w,t[32]=F):F=t[32];let I=F,L;t[33]!==P||t[34]!==T||t[35]!==E||t[36]!==x?(L=T?[{label:`Test`,variant:`outline`,onClick:P,loading:x.isPending,disabled:E}]:[],t[33]=P,t[34]=T,t[35]=E,t[36]=x,t[37]=L):L=t[37];let R;t[38]!==M||t[39]!==E?(R={label:`Create`,onClick:M,loading:E},t[38]=M,t[39]=E,t[40]=R):R=t[40];let z;t[41]!==L||t[42]!==R?(z=[...L,R],t[41]=L,t[42]=R,t[43]=z):z=t[43];let B;t[44]!==a||t[45]!==r?(B=ype(a,r),t[44]=a,t[45]=r,t[46]=B):B=t[46];let V=`Add ${B}`,H;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Enter your credentials`}),t[47]=H):H=t[47];let U;t[48]===I?U=t[49]:(U=I(),t[48]=I,t[49]=U);let W;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,X.jsx)(TX,{htmlFor:`name`,children:`Label (Optional)`}),t[50]=W):W=t[50];let G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(G=e=>u(e.target.value),t[51]=G):G=t[51];let K;t[52]===l?K=t[53]:(K=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[W,(0,X.jsx)(wX,{id:`name`,onChange:G,placeholder:`e.g. Production, Personal, Work`,value:l})]}),t[52]=l,t[53]=K);let q;t[54]!==U||t[55]!==K?(q=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[U,K]}),t[54]=U,t[55]=K,t[56]=q):q=t[56];let J;return t[57]!==n||t[58]!==z||t[59]!==V||t[60]!==q?(J=(0,X.jsxs)(SX,{actions:z,overlayId:n,title:V,children:[H,q]}),t[57]=n,t[58]=z,t[59]=V,t[60]=q,t[61]=J):J=t[61],J}var Spe=(e,t)=>e?.label??t;function Cpe(e){let t=(0,Z.c)(35),{fieldId:n,label:r,configKey:i,placeholder:a,helpText:o,helpLink:s,value:c,onChange:l}=e,[u,d]=(0,Y.useState)(!1),f=jY(),p=c.length>0;if(!(u||p)){let e;t[0]!==n||t[1]!==r?(e=(0,X.jsx)(TX,{htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=e):e=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsxs)(`div`,{className:`flex h-9 flex-1 items-center gap-2 rounded-md border bg-muted/30 px-3`,children:[(0,X.jsx)(qv,{className:`size-4 text-success`}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:`Configured`})]}),t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>d(!0),t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,(0,X.jsxs)(zv,{onClick:a,type:`button`,variant:`outline`,children:[(0,X.jsx)(oy,{className:`mr-1.5 size-3`}),`Change`]})]}),t[5]=o):o=t[5];let s;return t[6]===e?s=t[7]:(s=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[e,o]}),t[6]=e,t[7]=s),s}let m;t[8]!==n||t[9]!==r?(m=(0,X.jsx)(TX,{htmlFor:n,children:r}),t[8]=n,t[9]=r,t[10]=m):m=t[10];let h=u&&!f,g;t[11]!==i||t[12]!==l?(g=e=>l(i,e.target.value),t[11]=i,t[12]=l,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==a||t[16]!==h||t[17]!==g||t[18]!==c?(_=(0,X.jsx)(wX,{autoFocus:h,className:`flex-1`,id:n,onChange:g,placeholder:a,type:`password`,value:c}),t[14]=n,t[15]=a,t[16]=h,t[17]=g,t[18]=c,t[19]=_):_=t[19];let v;t[20]!==i||t[21]!==p||t[22]!==u||t[23]!==l?(v=(u||p)&&(0,X.jsx)(zv,{onClick:()=>{l(i,``),d(!1)},size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})}),t[20]=i,t[21]=p,t[22]=u,t[23]=l,t[24]=v):v=t[24];let y;t[25]!==_||t[26]!==v?(y=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_,v]}),t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;t[28]!==s||t[29]!==o?(b=(o||s)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[o,s&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:s.url,rel:`noopener noreferrer`,target:`_blank`,children:s.text})]}),t[28]=s,t[29]=o,t[30]=b):b=t[30];let x;return t[31]!==m||t[32]!==y||t[33]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,y,b]}),t[31]=m,t[32]=y,t[33]=b,t[34]=x):x=t[34],x}function w3(e){let t=(0,Z.c)(83),{overlayId:n,integration:r,onSuccess:i,onDelete:a}=e,{push:o,closeAll:s}=RY(),c=Fe(),[l,u]=(0,Y.useState)(r.name),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d={},t[0]=d):d=t[0];let[f,p]=(0,Y.useState)(d),m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=(e,t)=>{p(n=>({...n,[e]:t}))},t[1]=m):m=t[1];let h=m,g;t[2]!==s||t[3]!==i||t[4]!==c?(g=r0.integration.update.mutationOptions({onSuccess:async()=>{Ty.success(`Connection updated`),await c0(c),i?.(),s()},meta:{errorMessage:`Failed to update connection`}}),t[2]=s,t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=Ze(g),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=r0.integration.testCredentials.mutationOptions({meta:{errorShownByCaller:!0}}),t[6]=v):v=t[6];let y=Ze(v),b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=r0.integration.testCredentials.mutationOptions({onSuccess:S3}),t[7]=b):b=t[7];let x=Ze(b),S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=r0.integration.testConnection.mutationOptions({onSuccess:S3}),t[8]=S):S=t[8];let C=Ze(S),w=yy(),T,E,D,O,k;if(t[9]!==w||t[10]!==s||t[11]!==f||t[12]!==r||t[13]!==l||t[14]!==a||t[15]!==n||t[16]!==o||t[17]!==y||t[18]!==x||t[19]!==C||t[20]!==_){let e=Fy(w,r.type),i=e?.credentialFields,c=e?.hasTest===!0,u=_.isPending||y.isPending,d=x.isPending||C.isPending,p;t[26]!==f||t[27]!==r.id||t[28]!==l||t[29]!==_?(p=()=>{_.mutate({integrationId:r.id,name:l.trim(),config:x3(f)?f:void 0})},t[26]=f,t[27]=r.id,t[28]=l,t[29]=_,t[30]=p):p=t[30];let m=p,g;t[31]!==o||t[32]!==m?(g=e=>{o(CX,{title:`Connection Test Failed`,message:`${e}\n\nDo you want to save anyway?`,confirmLabel:`Save Anyway`,onConfirm:m})},t[31]=o,t[32]=m,t[33]=g):g=t[33];let v=g,b;t[34]!==f||t[35]!==c||t[36]!==r.type||t[37]!==v||t[38]!==m||t[39]!==y?(b=async()=>{if(!(x3(f)&&c)){m();return}try{let e=await y.mutateAsync({type:r.type,config:f});if(e.status===`error`){v(`The test failed: ${e.message}`);return}}catch(e){let t=e;v(t instanceof Error?t.message:`Failed to test connection`);return}m()},t[34]=f,t[35]=c,t[36]=r.type,t[37]=v,t[38]=m,t[39]=y,t[40]=b):b=t[40];let S=b,A;t[41]!==f||t[42]!==r.id||t[43]!==r.type||t[44]!==x||t[45]!==C?(A=()=>{if(x3(f)){x.mutate({type:r.type,config:f});return}C.mutate({integrationId:r.id})},t[41]=f,t[42]=r.id,t[43]=r.type,t[44]=x,t[45]=C,t[46]=A):A=t[46];let j=A,M;t[47]!==s||t[48]!==r||t[49]!==a||t[50]!==o?(M=()=>{o(T3,{integration:r,onDismiss:s,onSuccess:a})},t[47]=s,t[48]=r,t[49]=a,t[50]=o,t[51]=M):M=t[51];let N=M;E=()=>i?Object.entries(i).map(e=>{let[t,n]=e;return n.type===`password`?(0,X.jsx)(Cpe,{configKey:t,fieldId:t,helpLink:n.helpLink,helpText:n.helpText,label:n.label,onChange:h,placeholder:n.placeholder,value:f[t]||``},t):(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:t,children:n.label}),(0,X.jsx)(wX,{id:t,onChange:e=>h(t,e.target.value),placeholder:n.placeholder,type:n.type,value:f[t]||``}),(n.helpText||n.helpLink)&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[n.helpText,n.helpLink&&(0,X.jsx)(`a`,{className:`underline hover:text-foreground`,href:n.helpLink.url,rel:`noopener noreferrer`,target:`_blank`,children:n.helpLink.text})]})]},t)}):null,T=SX;let P=u||d,F;t[52]!==N||t[53]!==P?(F={label:`Delete`,variant:`ghost`,onClick:N,disabled:P},t[52]=N,t[53]=P,t[54]=F):F=t[54];let I;t[55]!==j||t[56]!==c||t[57]!==u||t[58]!==d?(I=c?[{label:`Test`,variant:`outline`,onClick:j,loading:d,disabled:u}]:[],t[55]=j,t[56]=c,t[57]=u,t[58]=d,t[59]=I):I=t[59];let L;t[60]!==S||t[61]!==u?(L={label:`Update`,onClick:S,loading:u},t[60]=S,t[61]=u,t[62]=L):L=t[62],t[63]!==F||t[64]!==I||t[65]!==L?(O=[F,...I,L],t[63]=F,t[64]=I,t[65]=L,t[66]=O):O=t[66],k=n,D=Spe(e,r.type),t[9]=w,t[10]=s,t[11]=f,t[12]=r,t[13]=l,t[14]=a,t[15]=n,t[16]=o,t[17]=y,t[18]=x,t[19]=C,t[20]=_,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k}else T=t[21],E=t[22],D=t[23],O=t[24],k=t[25];let A=`Edit ${D}`,j;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Update your connection credentials`}),t[67]=j):j=t[67];let M;t[68]===E?M=t[69]:(M=E(),t[68]=E,t[69]=M);let N;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(TX,{htmlFor:`name`,children:`Label (Optional)`}),t[70]=N):N=t[70];let P;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>u(e.target.value),t[71]=P):P=t[71];let F;t[72]===l?F=t[73]:(F=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,(0,X.jsx)(wX,{id:`name`,onChange:P,placeholder:`e.g. Production, Personal, Work`,value:l})]}),t[72]=l,t[73]=F);let I;t[74]!==M||t[75]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[M,F]}),t[74]=M,t[75]=F,t[76]=I):I=t[76];let L;return t[77]!==T||t[78]!==A||t[79]!==I||t[80]!==O||t[81]!==k?(L=(0,X.jsxs)(T,{actions:O,overlayId:k,title:A,children:[j,I]}),t[77]=T,t[78]=A,t[79]=I,t[80]=O,t[81]=k,t[82]=L):L=t[82],L}function T3(e){let t=(0,Z.c)(19),{overlayId:n,integration:r,onDismiss:i,onSuccess:a}=e,{pop:o}=RY(),s=i??o,c=Fe(),l;t[0]!==s||t[1]!==a||t[2]!==c?(l=r0.integration.delete.mutationOptions({onSuccess:async()=>{Ty.success(`Connection deleted`),s(),await c0(c),a?.()},meta:{errorMessage:`Failed to delete connection`}}),t[0]=s,t[1]=a,t[2]=c,t[3]=l):l=t[3];let u=Ze(l),d;t[4]===o?d=t[5]:(d={label:`Cancel`,variant:`outline`,onClick:o},t[4]=o,t[5]=d);let f;t[6]!==u||t[7]!==r?(f=()=>u.mutate({integrationId:r.id}),t[6]=u,t[7]=r,t[8]=f):f=t[8];let p;t[9]!==u.isPending||t[10]!==f?(p={label:`Delete`,variant:`destructive`,onClick:f,loading:u.isPending},t[9]=u.isPending,t[10]=f,t[11]=p):p=t[11];let m;t[12]!==d||t[13]!==p?(m=[d,p],t[12]=d,t[13]=p,t[14]=m):m=t[14];let h;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Are you sure you want to delete this connection? Workflows using it will fail until a new one is configured.`}),t[15]=h):h=t[15];let g;return t[16]!==n||t[17]!==m?(g=(0,X.jsx)(SX,{actions:m,overlayId:n,title:`Delete Connection`,children:h}),t[16]=n,t[17]=m,t[18]=g):g=t[18],g}function E3(){let e=(0,Z.c)(4),t=Fe(),n=yy(),r=TA(rpe),i;return e[0]!==n||e[1]!==t||e[2]!==r?(i=async()=>{r({integrations:await t.fetchQuery(i0()),catalog:n})},e[0]=n,e[1]=t,e[2]=r,e[3]=i):i=e[3],i}function D3(e){let t=(0,Z.c)(23),{displayName:n,selected:r,className:i,disabled:a,onSelect:o,onEdit:s}=e,c=a&&`cursor-not-allowed opacity-50`,l;t[0]!==i||t[1]!==c?(l=Q(i,c),t[0]=i,t[1]=c,t[2]=l):l=t[2];let u;t[3]===r?u=t[4]:(u=r?(0,X.jsx)(qv,{className:`size-4 shrink-0 text-success`}):(0,X.jsx)(Qv,{className:`size-4 shrink-0 text-muted-foreground`}),t[3]=r,t[4]=u);let d;t[5]===n?d=t[6]:(d=(0,X.jsx)(`span`,{className:`truncate`,children:n}),t[5]=n,t[6]=d);let f;t[7]!==a||t[8]!==o||t[9]!==r||t[10]!==u||t[11]!==d?(f=(0,X.jsxs)(`button`,{"aria-checked":r,className:`flex min-w-0 flex-1 items-center gap-2 text-left`,disabled:a,onClick:o,role:`radio`,type:`button`,children:[u,d]}),t[7]=a,t[8]=o,t[9]=r,t[10]=u,t[11]=d,t[12]=f):f=t[12];let p;t[13]===s?p=t[14]:(p=e=>{e.stopPropagation(),s()},t[13]=s,t[14]=p);let m;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(oy,{className:`size-3`}),t[15]=m):m=t[15];let h;t[16]!==a||t[17]!==p?(h=(0,X.jsx)(zv,{className:`size-6 shrink-0`,disabled:a,onClick:p,size:`icon`,variant:`ghost`,children:m}),t[16]=a,t[17]=p,t[18]=h):h=t[18];let g;return t[19]!==l||t[20]!==f||t[21]!==h?(g=(0,X.jsxs)(`div`,{className:l,children:[f,h]}),t[19]=l,t[20]=f,t[21]=h,t[22]=g):g=t[22],g}function wpe(e){let t=(0,Z.c)(68),{integrationType:n,value:r,onChange:i,onOpenSettings:a,disabled:o,onAddConnection:s}=e,c=yy(),{push:l}=RY(),u=E3(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=i0(),t[0]=d):d=t[0];let{data:f,isPending:p}=Xe(d),m;t[1]===f?m=t[2]:(m=f===void 0?[]:f,t[1]=f,t[2]=m);let h=m,g;if(t[3]!==h||t[4]!==n){let e;t[6]===n?e=t[7]:(e=e=>e.type===n,t[6]=n,t[7]=e),g=h.filter(e),t[3]=h,t[4]=n,t[5]=g}else g=t[5];let _=g,v;t[8]!==i||t[9]!==u?(v=async e=>{await u(),i(e)},t[8]=i,t[9]=u,t[10]=v):v=t[10];let y=v,b;t[11]!==y||t[12]!==n||t[13]!==l?(b=()=>{l(C3,{type:n,onSuccess:y})},t[11]=y,t[12]=n,t[13]=l,t[14]=b):b=t[14];let x=b,S;t[15]!==l||t[16]!==u?(S=e=>{l(w3,{integration:e,onSuccess:u,onDelete:u})},t[15]=l,t[16]=u,t[17]=S):S=t[17];let C=S,w;t[18]!==s||t[19]!==x?(w=()=>{s?s():x()},t[18]=s,t[19]=x,t[20]=w):w=t[20];let T=w;if(p){let e;return t[21]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex flex-col gap-1`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md px-2 py-1.5`,children:[(0,X.jsx)(`div`,{className:`size-4 shrink-0 animate-pulse rounded-full bg-muted`}),(0,X.jsx)(`div`,{className:`h-4 flex-1 animate-pulse rounded bg-muted`}),(0,X.jsx)(`div`,{className:`size-6 shrink-0 animate-pulse rounded bg-muted`})]})}),t[21]=e):e=t[21],e}let E;t[22]!==c||t[23]!==n?(E=Fy(c,n),t[22]=c,t[23]=n,t[24]=E):E=t[24];let D=E?.label||n,O;t[25]===D?O=t[26]:(O=e=>e.name||`${D} API Key`,t[25]=D,t[26]=O);let k=O;if(_.length===0){let e;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(py,{className:`size-4`}),t[27]=e):e=t[27];let n;t[28]===D?n=t[29]:(n=(0,X.jsxs)(`span`,{className:`flex-1 text-left`,children:[`Add `,D,` connection`]}),t[28]=D,t[29]=n);let r;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[30]=r):r=t[30];let i;return t[31]!==o||t[32]!==T||t[33]!==n?(i=(0,X.jsxs)(zv,{className:`w-full justify-start gap-2 border-warning/50 bg-warning/10 text-warning hover:bg-warning/20`,disabled:o,onClick:T,variant:`outline`,children:[e,n,r]}),t[31]=o,t[32]=T,t[33]=n,t[34]=i):i=t[34],i}if(_.length===1){let e=_[0],n;t[35]!==e||t[36]!==k?(n=k(e),t[35]=e,t[36]=k,t[37]=n):n=t[37];let a;t[38]!==e||t[39]!==C?(a=()=>C(e),t[38]=e,t[39]=C,t[40]=a):a=t[40];let s;t[41]!==e.id||t[42]!==i?(s=()=>i(e.id),t[41]=e.id,t[42]=i,t[43]=s):s=t[43];let c=r===e.id,l;return t[44]!==o||t[45]!==e||t[46]!==n||t[47]!==a||t[48]!==s||t[49]!==c?(l=(0,X.jsx)(`div`,{role:`radiogroup`,children:(0,X.jsx)(D3,{className:`flex h-9 w-full items-center gap-2 rounded-md border px-3 text-sm`,disabled:o,displayName:n,integration:e,onEdit:a,onSelect:s,selected:c})}),t[44]=o,t[45]=e,t[46]=n,t[47]=a,t[48]=s,t[49]=c,t[50]=l):l=t[50],l}let A,j,M;if(t[51]!==o||t[52]!==_||t[53]!==k||t[54]!==i||t[55]!==C||t[56]!==r){let[e,n]=Ja(_,Tpe);A=`flex flex-col gap-1`,j=`radiogroup`,M=[...e,...n].map(e=>{let t=r===e.id;return(0,X.jsx)(D3,{className:Q(`flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-sm transition-colors`,t?`bg-primary/10 text-primary`:`hover:bg-muted/50`),disabled:o,displayName:k(e),integration:e,onEdit:()=>C(e),onSelect:()=>i(e.id),selected:t},e.id)}),t[51]=o,t[52]=_,t[53]=k,t[54]=i,t[55]=C,t[56]=r,t[57]=A,t[58]=j,t[59]=M}else A=t[57],j=t[58],M=t[59];let N;t[60]!==o||t[61]!==a?(N=a&&(0,X.jsxs)(`button`,{className:`flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-muted-foreground text-sm transition-colors hover:bg-muted/50 hover:text-foreground`,disabled:o,onClick:a,type:`button`,children:[(0,X.jsx)(dy,{className:`size-4 shrink-0`}),(0,X.jsx)(`span`,{children:`Manage all connections`})]}),t[60]=o,t[61]=a,t[62]=N):N=t[62];let P;return t[63]!==A||t[64]!==j||t[65]!==M||t[66]!==N?(P=(0,X.jsxs)(`div`,{className:A,role:j,children:[M,N]}),t[63]=A,t[64]=j,t[65]=M,t[66]=N,t[67]=P):P=t[67],P}function Tpe(e){return!!e.isManaged}function O3(e){let t=Y.useRef(!0);t.current&&(t.current=!1,e())}function Epe(e){let[t,n]=Y.useState({current:e,previous:null});return Object.is(e,t.current)||n({current:e,previous:t.current}),t.previous}function k3(e){return e==null||e.hasAttribute(`disabled`)||e.getAttribute(`aria-disabled`)===`true`}function A3({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=Y.useRef(e!==void 0),[a,o]=Y.useState(t);return[i?e:a,Y.useCallback(e=>{i||o(e)},[])]}var j3=Y.createContext(null);function M3(){let e=Y.useContext(j3);if(e===null)throw Error(Gg(60));return e}var N3={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},P3={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Dpe={disabled:!1,...P3},F3={valid(e){return e===null?null:e?{"data-valid":``}:{"data-invalid":``}}},I3={invalid:void 0,name:void 0,validityData:{state:N3,errors:[],error:``,value:``,initialValue:null},setValidityData:r_,disabled:void 0,setTouched:r_,setDirty:r_,setFilled:r_,setFocused:r_,validationMode:`onSubmit`,shouldValidateOnChange:()=>!1,state:Dpe,registerFieldControl:r_,validation:{getValidationProps:(e,t=a_)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:r_,getInputControl:()=>null,commit:async()=>{},change:r_}},L3=Y.createContext(I3);function R3(e=!0){let t=Y.useContext(L3);if(t.setValidityData===r_&&!e)throw Error(Gg(28));return t}function z3(e,t,n,r,i=!0,a){let{registerFieldControl:o}=R3(),s=Eg(()=>Symbol());Mg(()=>{let c=s.current;if(!i){o(c,void 0);return}o(c,{controlRef:e,getValue:r,id:t,name:a,value:n})},[e,i,r,t,a,o,s,n]),Mg(()=>{let e=s.current;return()=>{o(e,void 0)}},[o,s])}var Ope=Y.createContext({controlId:void 0,registerControlId:r_,labelId:void 0,setLabelId:r_,messageIds:[],setMessageIds:r_,getDescriptionProps:e=>e});function B3(){return Y.useContext(Ope)}function V3(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=B3(),o=PH(t),s=n?i:void 0,c=Eg(()=>Symbol()),l=Y.useRef(!1),u=Y.useRef(t!=null),d=kg(()=>{!l.current||a===r_||(l.current=!1,a(c.current,void 0))});return Mg(()=>{if(a===r_)return;let e;if(n){let n=r?.current;e=ig(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),Y.useEffect(()=>d,[d]),i??o}var H3=(e,t)=>Object.is(e,t);function U3(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function kpe(e,t,n){return!e||e.length===0?!1:e.some(e=>e!==void 0&&U3(t,e,n))}function W3(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e!==void 0&&U3(e,t,n))}function G3(e,t,n,r){let i=W3(e,r&&Array.isArray(t)?t[t.length-1]:t,n);return i===-1?null:i}function K3(e,t,n){return e.filter(e=>!U3(t,e,n))}function q3(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function J3(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Y3(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(J3(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function X3(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return q3(e)}function Z3(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?q3(e.value):q3(e)}function Q3(e,t,n){function r(){return X3(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=J3(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Ape(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,X.jsx)(Y.Fragment,{children:Q3(r,t,n)},i)),e),[])}var $3={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Z3(t,r)!==``},hasNullItemLabel:(e,t)=>t?Y3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.value;return e.multiple?Array.isArray(r)&&r.some(e=>U3(t,e,n)):U3(t,r,n)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows},jpe=Y.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:r_,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function e6(){return Y.useContext(jpe)}function t6(e,t,n=(e,t)=>e===t){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}function n6(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function r6(e,t){return Math.max(0,e-t)}function i6(e,t){if(t<=0)return 0;let n=n6(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function Mpe(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:y=!1,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S=H3,highlightItemOnHover:C=!0,children:w}=e,{clearErrors:T}=e6(),{setDirty:E,setTouched:D,setFocused:O,validityData:k,setFilled:A,name:j,disabled:M,validation:N,validationMode:P}=R3(),F=V3({id:t}),I=M||d,L=j??c,[R,z]=A3({controlled:n,default:y?r??i_:r,name:`Select`,state:`value`}),[B,V]=A3({controlled:a,default:o,name:`Select`,state:`open`}),H=Y.useRef([]),U=Y.useRef([]),W=Y.useRef(null),G=Y.useRef(null),K=Y.useRef(0),q=Y.useRef(null),J=Y.useRef([]),ee=Y.useRef(!1),te=Y.useRef(null),ne=Y.useRef(null),re=Y.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ie=Y.useRef(!1),{mounted:ae,setMounted:oe,transitionStatus:se}=gq(B),{openMethod:ce,triggerProps:le}=sY(B),ue=Eg(()=>new fq({id:F,labelId:void 0,modal:m,multiple:y,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,value:R,open:B,mounted:ae,transitionStatus:se,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,de=$(ue,$3.activeIndex),fe=$(ue,$3.selectedIndex),pe=$(ue,$3.triggerElement),me=$(ue,$3.positionerElement),he=Epe(ce),ge=ce??he,_e=Y.useMemo(()=>y?``:Z3(R,x),[y,R,x]),ve=Y.useMemo(()=>y&&Array.isArray(R)?R.map(e=>Z3(e,x)):Z3(R,x),[y,R,x]);z3(FU(pe),F,R,kg(()=>ve),!I,c);let ye=Y.useRef(R),be=y?Array.isArray(R)&&R.length>0:R!=null&&_e!==``;Mg(()=>{A(be)},[be,A]),Mg(function(){let e=R,t=!1;if(y){let n=Array.isArray(R)?R:[];t=n.length===0,e=n[n.length-1]}let n=t?-1:W3(J.current,e,S),r=n===-1?null:n;r===null&&(ne.current=null),!B&&ue.set(`selectedIndex`,r)},[y,B,R,S,ue]);function xe(e){let t=k.initialValue;return Array.isArray(e)&&Array.isArray(t)?!t6(e,t,(e,t)=>U3(e,t,S)):e!==t}aY(R,()=>{T(L),E(xe(R)),N.change(R)});let Se=kg((e,t)=>{s?.(e,t),!t.isCanceled&&(V(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(D(!0),O(!1),P===`onBlur`&&N.commit(R)))}),Ce=kg(()=>{oe(!1),ue.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),_?.(!1)});vq({enabled:!h,open:B,ref:W,onComplete(){B||Ce()}}),Y.useImperativeHandle(h,()=>({unmount:Ce}),[Ce]);let we=kg((e,t)=>{i?.(e,t),!t.isCanceled&&z(e)}),Te=kg(e=>{let t=r6(e.scrollHeight,e.clientHeight),n=i6(e.scrollTop,t),r=n>0,i=n<t;ue.set(`scrollUpArrowVisible`,r),ue.set(`scrollDownArrowVisible`,i)}),Ee=Uq({open:B,onOpenChange:Se,elements:{reference:pe,floating:me}}),De=UG(Ee,{enabled:!f&&!I,event:`mousedown`}),Oe=YG(Ee),ke=lJ(Ee,{enabled:!f&&!I,listRef:H,activeIndex:de,selectedIndex:fe,disabledIndices:i_,onNavigate(e){e===null&&!B||ue.set(`activeIndex`,e)},focusItemOnHover:C}),Ae=uJ(Ee,{enabled:!f&&!I&&(B||!y),listRef:U,activeIndex:de,selectedIndex:fe,disabledIndices:e=>k3(H.current[e]),onMatch(e){B?ue.set(`activeIndex`,e):we(J.current[e],DH(sH))},onTyping(e){ee.current=e}}),je=Y.useMemo(()=>Fg(Ae.reference,ke.reference,Oe.reference,De.reference,le),[De.reference,Ae.reference,ke.reference,Oe.reference,le]),Me=Y.useMemo(()=>Fg(yq,Ae.floating,ke.floating,Oe.floating),[Ae.floating,ke.floating,Oe.floating]),Ne=ke.item??a_;O3(()=>{ue.update({popupProps:Me,triggerProps:je})}),ue.useSyncedValues({id:F,modal:m,multiple:y,value:R,open:B,mounted:ae,transitionStatus:se,popupProps:Me,triggerProps:je,items:v,itemToStringLabel:b,itemToStringValue:x,isItemEqualToValue:S,openMethod:ge});let Pe=Y.useMemo(()=>({store:ue,floatingContext:Ee,required:p,disabled:I,readOnly:f,multiple:y,highlightItemOnHover:C,setValue:we,setOpen:Se,listRef:H,popupRef:W,scrollHandlerRef:G,handleScrollArrowVisibility:Te,scrollArrowsMountedCountRef:K,itemProps:Ne,valueRef:q,valuesRef:J,labelsRef:U,typingRef:ee,selectionRef:re,firstItemTextRef:te,selectedItemTextRef:ne,validation:N,onOpenChangeComplete:_,alignItemWithTriggerActiveRef:ie,initialValueRef:ye}),[ue,Ee,p,I,f,y,C,we,Se,Ne,N,_,Te]),Fe=Qg(g,N.inputRef),Ie=y?void 0:L,Le=Y.useMemo(()=>!y||!Array.isArray(R)||!L?null:R.map(e=>{let t=Z3(e,x);return(0,X.jsx)(`input`,{type:`hidden`,form:l,name:L,value:t,disabled:I},t)}),[y,R,l,L,x,I]);return(0,X.jsxs)(j3.Provider,{value:Pe,children:[w,(0,X.jsx)(`input`,{...N.getValidationProps(I,{onFocus(){ue.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||I||f)return;let t=e.currentTarget.value,n=DH(sH,e.nativeEvent);function r(){if(y)return;let e=t.toLowerCase(),r=J.current.findIndex(t=>Z3(t,x).toLowerCase()===e||X3(t,b).toLowerCase()===e);r===-1&&(r=J.current.findIndex((t,n)=>{let r=U.current[n];return r!=null&&r.toLowerCase()===e}));let i=J.current[r];i!=null&&we(i,n)}ue.set(`forceMount`,!0),queueMicrotask(r)}}),id:F&&Ie==null?`${F}-hidden-input`:void 0,form:l,name:Ie,autoComplete:u,value:_e,disabled:I,required:p&&!(y&&be),readOnly:f,ref:Fe,style:L?UU:HU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Le]})}function a6(e,t){return e??t}var o6=5;function s6(e,t){let n=Npe(t);return e.clientX>=n.left-o6&&e.clientX<=n.right+o6&&e.clientY>=n.top-o6&&e.clientY<=n.bottom+o6}function Npe(e){let t=e.getBoundingClientRect(),n=tg(e);if(eU)return t;let r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(r.content===`none`&&i.content===`none`)return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var Ppe=400,Fpe={...rH,...F3,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},Ipe=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=R3(),{labelId:m}=B3(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:b,alignItemWithTriggerActiveRef:x,disabled:S}=M3(),C=p||S||a,w=$(h,$3.open),T=$(h,$3.mounted),E=$(h,$3.value),D=$(h,$3.triggerProps),O=$(h,$3.positionerElement),k=$(h,$3.listElement),A=$(h,$3.popupSide),j=$(h,$3.id),M=$(h,$3.labelId),N=$(h,$3.hasSelectedValue),P=T&&O?A:null,F=i??j,I=a6(m,M);V3({id:F});let L=FU(O),R=Y.useRef(null),{getButtonProps:z,buttonRef:B}=Xg({disabled:C,native:o}),V=h.useStateSetter(`triggerElement`),H=zH(),U=zH(),W=zH();Y.useEffect(()=>{if(w)return W.start(Ppe,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{W.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},U.clear()},[w,_,U,W]);let G=Fg(D,{id:F,role:`combobox`,"aria-expanded":w,"aria-haspopup":`listbox`,"aria-controls":w?k?.id??CU(O)?.id:void 0,"aria-labelledby":I,"aria-readonly":y||void 0,"aria-required":b||void 0,tabIndex:C?-1:0,onFocus(e){u(!0),w&&x.current&&g(!1,DH(sH,e.nativeEvent)),H.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){mU(O,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(E))},onMouseDown(e){if(w)return;let t=Jg(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;mU(R.current,t)||mU(L.current,t)||s6(e,R.current)||g(!1,DH(SH,e))}U.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},c,z),K=v.getValidationProps(C,G);K.role=`combobox`;let q={...f,open:w,disabled:C,value:E,readOnly:y,popupSide:P,placeholder:!N};return o_(`button`,e,{ref:[t,R,B,V],state:q,stateAttributesMapping:Fpe,props:K})}),Lpe={value:()=>null},Rpe=Y.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=M3(),u=$(c,$3.value),d=$(c,$3.items),f=$(c,$3.itemToStringLabel),p=$(c,$3.hasSelectedValue),m=!p&&a!=null&&i==null,h=$(c,$3.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(m&&!h?a:Array.isArray(u)?Ape(u,d,f):Q3(u,d,f)),o_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:Lpe})}),zpe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=M3();return o_(`span`,e,{state:{open:$(o,$3.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:nH})}),Bpe=Y.forwardRef(function(e,t){let{store:n}=M3(),r=$(n,$3.mounted),i=$(n,$3.forceMount);return r||i?(0,X.jsx)(CG,{ref:t,...e}):null}),c6=Y.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function Vpe(){return Y.useContext(c6)}function l6(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=kg(i),[,o]=Y.useState(!1),s=Eg(Upe).current,c=Eg(Hpe).current,l=Y.useRef(0),u=Y.useRef(!0),d=Y.useRef([]),f=Y.useRef(null),p=kg(()=>{u.current||(u.current=!0,o(e=>!e))}),m=kg((e,t)=>{c.set(e,t),p()}),h=kg(e=>{c.delete(e),p()}),g=kg(e=>{let t=new Map;return n.current.length=0,r&&(r.current.length=0),e.forEach(e=>{t.set(e.element,{...e.registration.metadata??{},index:e.index}),n.current[e.index]=e.element,r&&(r.current[e.index]=e.registration.label===void 0?e.registration.textRef?.current?.textContent??e.element.textContent:e.registration.label)}),l.current=n.current.length,t});function _(e){if(f.current?.disconnect(),f.current=null,typeof MutationObserver!=`function`||e.length<2)return;let t=new MutationObserver(n=>{if(!Kpe(n))return;let r=null;for(let n of e)if(n.isConnected){if(r&&u6(r,n)>0){t.disconnect(),p();return}r=n}});f.current=t;let n=new Set;for(let t=1;t<e.length;t+=1){let r=Gpe(e[t-1],e[t]);r&&n.add(r)}n.forEach(e=>t.observe(e,{childList:!0}))}let v=kg(()=>{let[e,t]=Wpe(c),n=g(e);_(t),d.current=e,u.current=!1,s.forEach(e=>e(n)),a(n)});Mg(()=>(u.current||g(d.current),()=>{n.current=[],r&&(r.current=[])}),[n,r,g]),Mg(()=>{u.current&&v()}),Mg(()=>()=>{f.current?.disconnect(),u.current=!0},[]);let y=kg(e=>(s.add(e),()=>{s.delete(e)})),b=Y.useMemo(()=>({register:m,unregister:h,subscribeMapChange:y,nextIndexRef:l}),[m,h,y,l]);return(0,X.jsx)(c6.Provider,{value:b,children:t})}function Hpe(){return new Map}function Upe(){return new Set}function Wpe(e){let t=new Set,n=[],r=[];e.forEach((e,i)=>{if(!i.isConnected)return;let a=e.index,o={index:a??-1,element:i,registration:e};a===null?r.push(o):a>=0&&(t.add(a),n.push(o))});let i=0;return r.sort((e,t)=>u6(e.element,t.element)),r.forEach(e=>{for(;t.has(i);)i+=1;e.index=i,n.push(e),i+=1}),t.size>0&&n.sort((e,t)=>e.index-t.index),[n,r.map(e=>e.element)]}function Gpe(e,t){let n=e.parentElement;for(;n&&!n.contains(t);)n=n.parentElement;return n}function Kpe(e){for(let t of e)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}function u6(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}var qpe=Y.createContext(void 0);function d6(){return Y.useContext(qpe)?.direction??`ltr`}var Jpe=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=QU(e,t)||{};if(l==null)return{};let f=gW(u),p={x:n,y:r},m=iW(i),h=nW(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=ZU(k,j,A),N=!c.arrow&&eW(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Ype=(e,t)=>({...Jpe(e),options:[e,t]}),Xpe={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0,o=await e.platform.detectOverflow(e,{elementContext:`reference`});return{data:{referenceHidden:o.top-n>=0||o.right-t>=0||o.bottom-n>=0||o.left-t>=0||a}}}},Zpe={sideX:`left`,sideY:`top`},f6=`--available-width`,p6=`--available-height`;function m6(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function h6(e,t,n){let{rects:r,placement:i}=e;return{side:m6(t,$U(i),n),align:eW(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function g6(e){return Qpe(e,Wq)}function Qpe(e,t){let{anchor:n,positionMethod:r=`absolute`,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:d=5,disableAnchorTracking:f=!1,inline:p,keepMounted:m=!1,floatingRootContext:h,mounted:g,collisionAvoidance:_,shift:v,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=Y.useState(null);!g&&C!==null&&w(null);let T=_.side||`flip`,E=_.align||`flip`,D=_.fallbackAxisSide||`end`,O=v?.crossAxis??!1,k=v?.rootBoundary,A=typeof n==`function`?n:void 0,j=kg(A),M=A?j:n,N=FU(n),P=FU(g),F=d6()===`rtl`,I=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":F?`left`:`right`,"inline-start":F?`right`:`left`}[i],L=o===`center`?I:`${I}-${o}`,R=l;typeof R==`number`?R={top:R,right:R,bottom:R,left:R}:R&&={top:R.top||0,right:R.right||0,bottom:R.bottom||0,left:R.left||0};let z=+(i===`bottom`),B=+(i===`top`),V=+(i===`right`),H=+(i===`left`),U={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:R},W=Y.useRef(null),G=FU(a),K=FU(s),q=typeof a==`function`?0:a,J=typeof s==`function`?0:s,ee=[];p&&ee.push(p),ee.push(JK(e=>{let t=h6(e,i,F),n=typeof G.current==`function`?G.current(t):G.current,r=typeof K.current==`function`?K.current(t):K.current;return{mainAxis:n,crossAxis:r,alignmentAxis:r}},[q,J,F,i]));let te=E===`none`&&T!==`shift`,ne=!te&&(u||O||T===`shift`),re=T===`none`?null:ZK({...U,padding:{top:R.top+1+z,right:R.right+1+H,bottom:R.bottom+1+B,left:R.left+1+V},mainAxis:!O&&T===`flip`,crossAxis:E===`flip`&&`alignment`,fallbackAxisSideDirection:D}),ie=te?null:YK({...U,rootBoundary:k,mainAxis:E!==`none`,crossAxis:ne,limiter:u||O?void 0:XK(e=>{if(!W.current)return{};let{width:t,height:n}=W.current.getBoundingClientRect(),r=rW($U(e.placement)),i=r===`y`?t:n,a=r===`y`?R.left+R.right:R.top+R.bottom;return{offset:i/2+a/2}})},[U,u,O,k,R,E]);T===`shift`||E===`shift`||o===`center`?ee.push(ie,re):ee.push(re,ie),ee.push(QK({...U,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!P.current)return;let i=e.style;i.setProperty(f6,`${t}px`),i.setProperty(p6,`${n}px`);let a=tg(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Ype(e=>({element:W.current||Jg(e.elements.floating).createElement(`div`),padding:d,offsetParent:`floating`}),[d]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:r,rects:o,y:s}=e,c=$U(r),l=rW(c),u=W.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof a==`function`?a(h6(e,i,F)):a,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ne&&l===`y`&&b?S:x),{}}},Xpe,b),Mg(()=>{!g&&h&&h.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[g,h]);let ae=Y.useMemo(()=>({elementResize:!f&&typeof ResizeObserver<`u`,layoutShift:!f&&typeof IntersectionObserver<`u`}),[f]),{refs:oe,elements:se,x:ce,y:le,middlewareData:ue,update:de,placement:fe,context:pe,isPositioned:me,floatingStyles:he}=t({rootContext:h,open:m?g:void 0,placement:L,middleware:ee,strategy:r,whileElementsMounted:m?void 0:(...e)=>FK(...e,ae),nodeId:y,externalTree:S}),{sideX:ge,sideY:_e}=ue.adaptiveOrigin||Zpe,ve=me?r:`fixed`,ye=Y.useMemo(()=>{let e;return e=me?b?{position:ve,[ge]:ce,[_e]:le}:{...he,position:ve}:{position:ve,top:0,left:0},e[f6]=`100vw`,e[p6]=`100vh`,me||(e.opacity=0),e},[b,ve,ge,ce,_e,le,he,me]),be=Y.useRef(null);Mg(()=>{if(!g)return;let e=N.current,t=typeof e==`function`?e():e,n=(_6(t)?t.current:t)||null;n!==be.current&&(oe.setPositionReference(n),be.current=n)},[g,oe,M,N]),Y.useEffect(()=>{if(!g)return;let e=N.current;typeof e!=`function`&&_6(e)&&e.current!==be.current&&(oe.setPositionReference(e.current),be.current=e.current)},[g,oe,M,N]),Y.useEffect(()=>{if(m&&g&&se.reference&&se.floating)return FK(se.reference,se.floating,de,ae)},[m,g,se,de,ae]);let xe=$U(fe),Se=m6(i,xe,F),Ce=eW(fe)||`center`,we=!!ue.hide?.referenceHidden;Mg(()=>{x&&g&&me&&xe!==I&&w(xe)},[x,g,me,xe,I]);let Te=Y.useMemo(()=>({position:`absolute`,top:ue.arrow?.y,left:ue.arrow?.x}),[ue.arrow]),Ee=ue.arrow?.centerOffset!==0;return Y.useMemo(()=>({positionerStyles:ye,arrowStyles:Te,arrowRef:W,arrowUncentered:Ee,side:Se,align:Ce,physicalSide:xe,anchorHidden:we,refs:oe,context:pe,isPositioned:me,update:de}),[ye,Te,W,Ee,Se,Ce,xe,we,oe,pe,me,de])}function _6(e){return e!=null&&`current`in e}var v6=Y.createContext(void 0);function y6(){let e=Y.useContext(v6);if(!e)throw Error(Gg(59));return e}function b6(e,t){e&&Object.assign(e.style,t)}var x6={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function S6(e){return e===`starting`?hG:a_}function C6(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),o_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},S6(r),i],stateAttributesMapping:iH})}var $pe=20;function w6(e,t,n,r){let[i,a]=Y.useState(!1);Mg(()=>{if(!e||!t||n==null){a(!1);return}let r=Jg(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-$pe)},[e,t,n]),JJ(e&&(!t||i),r)}var eme={position:`fixed`},tme=Y.forwardRef(function(e,t){let{anchor:n,className:r,render:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=gG,style:_,...v}=e,{store:y,listRef:b,labelsRef:x,alignItemWithTriggerActiveRef:S,selectedItemTextRef:C,valuesRef:w,initialValueRef:T,popupRef:E,setValue:D,floatingContext:O}=M3(),k=$(y,$3.open),A=$(y,$3.mounted),j=$(y,$3.modal),M=$(y,$3.value),N=$(y,$3.openMethod),P=$(y,$3.positionerElement),F=$(y,$3.triggerElement),I=$(y,$3.isItemEqualToValue),L=$(y,$3.transitionStatus),R=Y.useRef(null),z=Y.useRef(null),[B,V]=Y.useState(h),H=A&&B&&N!==`touch`;!A&&B!==h&&V(h),Y.useImperativeHandle(S,()=>H),w6((H||j)&&k,N===`touch`,P,F);let U=g6({anchor:n,floatingRootContext:O,positionMethod:a,mounted:A,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??H,collisionAvoidance:g,keepMounted:!0}),W=H?`none`:U.side,G=H?eme:U.positionerStyles,K={open:k,side:W,align:U.align,anchorHidden:U.anchorHidden};Mg(()=>{y.set(`popupSide`,U.side)},[y,U.side]);let q=C6(e,K,{styles:G,transitionStatus:L,props:v,refs:[t,y.useStateSetter(`positionerElement`)],hidden:!A,inert:!k}),J=Y.useRef(0),ee=kg(e=>{if(w.current.length===0)return;let t=J.current;if(J.current=e.size,e.size===t)return;let n=DH(sH);if(t!==0&&!y.state.multiple&&M!==null&&W3(w.current,M,I)===-1){let e=T.current,t=e!=null&&W3(w.current,e,I)!==-1?e:null;D(t,n),t===null&&(y.set(`selectedIndex`,null),C.current=null)}if(t!==0&&y.state.multiple&&Array.isArray(M)){let e=M.filter(e=>W3(w.current,e,I)!==-1);e.length!==M.length&&(D(e,n),e.length===0&&(y.set(`selectedIndex`,null),C.current=null))}if(k&&H){y.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};b6(P,e),b6(E.current,e)}}),te=Y.useMemo(()=>({...U,side:W,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:R,scrollDownArrowRef:z}),[U,W,H,V]);return(0,X.jsx)(l6,{elementsRef:b,labelsRef:x,onMapChange:ee,children:(0,X.jsxs)(v6.Provider,{value:te,children:[A&&j&&(0,X.jsx)(IJ,{inert:FJ(!k),cutout:F}),q]})})}),T6=`base-ui-disable-scrollbar`,E6={className:T6,getElement(e){return(0,X.jsx)(`style`,{nonce:e,href:T6,precedence:`base-ui:low`,children:`.${T6}{scrollbar-width:none}.${T6}::-webkit-scrollbar{display:none}`})}},nme=Y.createContext(void 0);function D6(e){let t=Y.useContext(nme);if(t===void 0&&!e)throw Error(Gg(69));return t}var rme=Y.createContext(void 0),ime={disableStyleElements:!1};function ame(){return Y.useContext(rme)??ime}var ome={...iH,...XV},sme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v,floatingContext:y}=M3(),{side:b,align:x,alignItemWithTriggerActive:S,isPositioned:C,setControlledAlignItemWithTrigger:w}=y6(),T=D6(!0)!=null,E=d6(),{nonce:D,disableStyleElements:O}=ame(),k=$(s,$3.id),A=$(s,$3.open),j=$(s,$3.openMethod),M=$(s,$3.mounted),N=$(s,$3.popupProps),P=$(s,$3.transitionStatus),F=$(s,$3.triggerElement),I=$(s,$3.positionerElement),L=$(s,$3.listElement),R=Y.useRef(!1),z=Y.useRef(!1),B=Y.useRef({}),V=BU(),H=kg(e=>{if(!I||!c.current||!z.current)return;let t=I.style.top===`0px`,n=I.style.bottom===`0px`;if(R.current||!S||!t&&!n){h(e);return}let r=A6(I),i=j6(I.getBoundingClientRect().height,`y`,r),a=Jg(I),o=tg(I),s=o.getComputedStyle(I),l=parseFloat(s.marginTop),u=parseFloat(s.marginBottom),d=O6(o.getComputedStyle(c.current)),f=Math.min(a.documentElement.clientHeight-l-u,d),p=e.scrollTop,m=k6(e),g=null,_=e=>{I.style.height=`${e}px`},v=t?m-p:p,y=Math.min(i+v,f);if(v<=1){let n=n6(v,0,f-i);n>0&&_(i+n),e.scrollTop=t?m:0,f-(i+n)<=1&&(R.current=!0),h(e);return}f-y>1?g=t?1/0:0:n&&p<m&&(g=p-(v-(i+v-f)));let b=Math.ceil(y);if(b!==0&&_(b),g!=null){let t=n6(g,0,k6(e));Math.abs(e.scrollTop-t)>1&&(e.scrollTop=t)}b>=f-1&&(R.current=!0),h(e)});Y.useImperativeHandle(g,()=>H,[H]),vq({open:A,ref:c,onComplete(){A&&l?.(!0)}});let U={open:A,transitionStatus:P,side:b,align:x};Mg(()=>{!I||!c.current||Object.keys(B.current).length||(B.current={top:I.style.top||`0`,left:I.style.left||`0`,right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[c,I]),Mg(()=>{A||S||(z.current=!1,R.current=!1,b6(I,B.current))},[A,S,I,c]),Mg(()=>{let e=c.current;if(!A||!F||!I||!e||S&&!C||s.state.transitionStatus===`ending`)return;if(z.current=!0,e.style.removeProperty(`--transform-origin`),!S){V.request(()=>h(L||e));return}let t=cme(e);try{let t=p.current;t?.isConnected||(t=!$3.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=tg(I),i=r.getComputedStyle(I),a=r.getComputedStyle(e),o=Jg(F),c=A6(F),l=M6(F.getBoundingClientRect(),c),u=M6(I.getBoundingClientRect(),c),m=l.height,g=L||e,y=g.scrollHeight,b=parseFloat(a.borderBottomWidth),x=parseFloat(i.marginTop)||10,S=parseFloat(i.marginBottom)||10,C=parseFloat(i.minHeight)||100,T=O6(a),D=o.documentElement.clientHeight-x-S,O=o.documentElement.clientWidth,k=D-l.bottom+m,A,j=E===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=M6(n.getBoundingClientRect(),c);A=M6(t.getBoundingClientRect(),c),j=u.left+(E===`rtl`?e.right-A.right:e.left-A.left);let r=e.top-l.top+e.height/2;M=A.top-u.top+A.height/2-r}let N=k+M+S+b,P=Math.min(D,N),z=D-x-S,V=N-P,H=O-5;I.style.left=`${n6(j,5,H-u.width)}px`,I.style.height=`${P}px`,I.style.maxHeight=`none`,I.style.marginTop=`${x}px`,I.style.marginBottom=`${S}px`,e.style.height=`100%`;let U=k6(g),W=V>=U-1;W&&(P=Math.min(D,u.height)-(V-U));let G=l.top<20||l.bottom>D-20||Math.ceil(P)+1<Math.min(y,C),K=(r.visualViewport?.scale??1)!==1&&ZH;if(G||K){b6(I,B.current),w(!1);return}let q=Math.max(C,P);if(W){let e=Math.max(0,D-N);I.style.top=u.height>=z?`0`:`${e}px`,I.style.height=`${P}px`,g.scrollTop=k6(g)}else I.style.bottom=`0`,g.scrollTop=V;if(A){let t=u.top,n=u.height,r=A.top+A.height/2,i=n6(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(q===D||P>=T)&&(R.current=!0),h(g),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0)}finally{t()}},[s,A,I,F,d,f,p,c,h,S,w,V,L,_,v,E,C]),Y.useEffect(()=>{if(!S||!I||!A)return;let e=tg(I);function t(e){u(!1,DH(EH,e))}return NU(e,`resize`,t)},[u,S,I,A]);let W={...L?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${k}-list`},onKeyDown(e){T&&TJ.has(e.key)&&e.stopPropagation()},onScroll(e){L||H(e.currentTarget)},...S&&{style:L?{height:`100%`}:x6},className:!L&&S?E6.className:void 0},G=o_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:ome,props:[N,W,S6(P),o]});return(0,X.jsxs)(Y.Fragment,{children:[!O&&E6.getElement(D),(0,X.jsx)(HG,{context:y,modal:!1,disabled:!M,openInteractionType:j,returnFocus:a,restoreFocus:!0,children:G})]})});function O6(e){let t=e.maxHeight;return t.endsWith(`px`)&&parseFloat(t)||1/0}function k6(e){return r6(e.scrollHeight,e.clientHeight)}function A6(e){return MK.getScale(e)}function j6(e,t,n){return e/n[t]}function M6(e,t){return _W({x:j6(e.x,`x`,t),y:j6(e.y,`y`,t),width:j6(e.width,`x`,t),height:j6(e.height,`y`,t)})}var N6=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function cme(e){let{style:t}=e,n={};for(let[e,r]of N6)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of N6){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var lme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s,multiple:c}=M3(),{alignItemWithTriggerActive:l}=y6(),u=$(o,$3.hasScrollArrows),d=$(o,$3.openMethod),f={id:`${$(o,$3.id)}-list`,role:`listbox`,"aria-multiselectable":c||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:x6},className:u&&d!==`touch`?E6.className:void 0};return o_(`div`,e,{ref:[t,o.useStateSetter(`listElement`)],props:[f,a]})});function P6(e={}){let{guess:t,label:n,metadata:r,textRef:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,nextIndexRef:l}=Vpe(),u=Y.useRef(-1),[d,f]=Y.useState(a==null&&t?()=>{if(u.current===-1){let e=l.current;l.current+=1,u.current=e}return u.current}:-1),p=a??d,m=Y.useRef(null),h=Y.useCallback(e=>{let t=m.current;t&&s(t),m.current=e,e&&o(e,{metadata:r??null,index:a??null,label:n,textRef:i})},[a,o,s,r,n,i]);return Mg(()=>{if(a==null)return c(e=>{let t=m.current?e.get(m.current)?.index:null;t!=null&&f(t)})},[a,c]),{ref:h,index:p}}var F6=Y.createContext(void 0);function I6(){let e=Y.useContext(F6);if(!e)throw Error(Gg(57));return e}var ume=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=Y.useRef(null),d=P6({guess:!0,label:o,textRef:u}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:y,selectedItemTextRef:b,disabled:x,readOnly:S}=M3(),C=x||s,w=$(f,$3.isActive,d.index),T=$(f,$3.open),E=$(f,$3.isSelected,a),D=$(f,$3.isSelectedByFocus,d.index),O=$(f,$3.isItemEqualToValue),k=d.index,A=Y.useRef(null);Mg(()=>{let e=v.current;return e[k]=a,()=>{delete e[k]}},[k,a,v]),Mg(()=>{let e=f.state.value,t=e;y&&Array.isArray(e)&&(t=e.length>0?e[e.length-1]:void 0),t!==void 0&&U3(a,t,O)&&(f.set(`selectedIndex`,k),u.current&&(b.current=u.current))},[k,y,O,f,a,b]);let j=Y.useRef(`mouse`),M=Y.useRef(!1),{getButtonProps:N,buttonRef:P}=Xg({disabled:C,focusableWhenDisabled:!0,native:c,composite:!0}),F={disabled:C,selected:E,highlighted:w};function I(e){if(x||S)return;let t=f.state.value;if(y){let n=Array.isArray(t)?t:[],r=E?K3(n,a,O):[...n,a];h(r,DH(fH,e))}else h(a,DH(fH,e)),m(!1,DH(fH,e))}function L(){g.current.dragY=0}let R={role:`option`,"aria-selected":E,tabIndex:T&&w?0:-1,onKeyDown(e){f.set(`activeIndex`,k),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=j.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&rU(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!M.current;M.current=!1,!(C||i)&&I(e.nativeEvent)},onPointerEnter(e){j.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){j.current=e.pointerType,M.current=!0,L()},onMouseUp(){if(L(),C||j.current===`touch`||M.current)return;let e=!g.current.allowSelectedMouseUp&&E,t=!g.current.allowUnselectedMouseUp&&!E;e||t||(M.current=!0,A.current?.click(),M.current=!1)}},z=o_(`div`,e,{ref:[P,t,d.ref,A],state:F,props:[p,R,l,N]}),B=Y.useMemo(()=>({selected:E,index:k,textRef:u,selectedByFocus:D}),[E,k,u,D]);return(0,X.jsx)(F6.Provider,{value:B,children:z})})),dme=Y.forwardRef(function(e,t){let{selected:n}=I6();return e.keepMounted||n?(0,X.jsx)(fme,{...e,ref:t}):null}),fme=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=I6(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=gq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:XV});return vq({open:s,ref:c,onComplete(){s||u(!1)}}),d})),pme=Y.memo(Y.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i}=I6(),{firstItemTextRef:a,selectedItemTextRef:o}=M3(),{render:s,className:c,style:l,...u}=e;return o_(`div`,e,{ref:[Y.useCallback(e=>{e&&(n===0&&(a.current=e),i&&(o.current=e))},[a,o,n,i]),t,r],props:u})})),L6=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=M3(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=y6(),_=$(l,c?$3.scrollUpArrowVisible:$3.scrollDownArrowVisible),v=$(l,$3.openMethod),y=_&&v!==`touch`,b=zH(),x=c?g:h,{mounted:S,transitionStatus:C,setMounted:w}=gq(y);Mg(()=>(p.current+=1,l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.set(`hasScrollArrows`,!1)}),[l,p]),vq({open:y,ref:x,onComplete(){y||w(!1)}});let T=o_(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:C},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f(e);let n=r6(e.scrollHeight,e.clientHeight),r=i6(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=mme(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s],stateAttributesMapping:XV});return S||o?T:null});function mme(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?i6(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?i6(l.offsetTop+l.offsetHeight-r+i,a):a}var hme=Y.forwardRef(function(e,t){return(0,X.jsx)(L6,{...e,ref:t,direction:`down`})}),gme=Y.forwardRef(function(e,t){return(0,X.jsx)(L6,{...e,ref:t,direction:`up`})}),R6=Y.createContext(void 0);function _me(){let e=Y.useContext(R6);if(e===void 0)throw Error(Gg(56));return e}var vme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,[o,s]=Y.useState(),c=Y.useMemo(()=>({labelId:o,setLabelId:s}),[o,s]),l=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":o},a]});return(0,X.jsx)(R6.Provider,{value:c,children:l})}),yme=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=_me(),c=PH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),bme=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`presentation`},o]})}),z6=(0,Y.createContext)(new Map);function B6(e){return typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(B6).join(` `):(0,Y.isValidElement)(e)?B6(e.props.children):``}function xme(e){let t=[],n=e=>{Y.Children.forEach(e,e=>{if((0,Y.isValidElement)(e)){if(typeof e.props.value==`string`||e.props.value===null){let n=typeof e.props.label==`string`?e.props.label:B6(e.props.children).trim();n&&t.push({value:e.props.value,label:n})}e.props.children&&n(e.props.children)}})};return n(e),t}function V6(e){let t=(0,Z.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({onValueChange:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;if(t[4]!==n){a=new Map;for(let e of xme(n))a.set(e.value,e.label);t[4]=n,t[5]=a}else a=t[5];let o=a,s;t[6]===r?s=t[7]:(s=e=>r?.(e),t[6]=r,t[7]=s);let c;t[8]!==n||t[9]!==i||t[10]!==s?(c=(0,X.jsx)(Mpe,{"data-slot":`select`,multiple:!1,onValueChange:s,...i,children:n}),t[8]=n,t[9]=i,t[10]=s,t[11]=c):c=t[11];let l;return t[12]!==o||t[13]!==c?(l=(0,X.jsx)(z6.Provider,{value:o,children:c}),t[12]=o,t[13]=c,t[14]=l):l=t[14],l}function H6(e){return t=>{t!==null&&e(t)}}function Sme(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(vme,{"data-slot":`select-group`,...n}),t[2]=n,t[3]=r),r}function U6(e){let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({placeholder:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i=(0,Y.useContext)(z6),a;t[3]!==i||t[4]!==n?(a=e=>i.get(e)??(e||n),t[3]=i,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==n||t[7]!==r||t[8]!==a?(o=(0,X.jsx)(Rpe,{"data-slot":`select-value`,placeholder:n,...r,children:a}),t[6]=n,t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function W6(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,size:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===r?s=t[6]:(s=Q(`flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[size=default]:h-9 data-[size=sm]:h-8 data-[disabled]:cursor-not-allowed data-[invalid]:border-destructive data-[placeholder]:text-muted-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:data-[invalid]:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(zpe,{children:(0,X.jsx)(Jv,{className:`size-4 opacity-50`})}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,X.jsxs)(Ipe,{className:s,"data-size":o,"data-slot":`select-trigger`,...i,children:[n,c]}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function G6(e){let t=(0,Z.c)(27),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:r,children:n,side:a,sideOffset:o,align:s,alignOffset:c,alignItemWithTrigger:l,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l);let u=a===void 0?`bottom`:a,d=o===void 0?4:o,f=s===void 0?`center`:s,p=c===void 0?0:c,m=l!==void 0&&l,h;t[9]===r?h=t[10]:(h=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) w-max min-w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-closed:animate-out data-open:animate-in`,r),t[9]=r,t[10]=h);let g;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(Tme,{}),t[11]=g):g=t[11];let _;t[12]===n?_=t[13]:(_=(0,X.jsx)(lme,{className:`max-h-[inherit] w-max min-w-full overflow-y-auto p-1`,children:n}),t[12]=n,t[13]=_);let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Eme,{}),t[14]=v):v=t[14];let y;t[15]!==m||t[16]!==i||t[17]!==h||t[18]!==_?(y=(0,X.jsxs)(sme,{className:h,"data-align-trigger":m,"data-slot":`select-content`,...i,children:[g,_,v]}),t[15]=m,t[16]=i,t[17]=h,t[18]=_,t[19]=y):y=t[19];let b;return t[20]!==f||t[21]!==m||t[22]!==p||t[23]!==u||t[24]!==d||t[25]!==y?(b=(0,X.jsx)(Bpe,{children:(0,X.jsx)(tme,{align:f,alignItemWithTrigger:m,alignOffset:p,className:`isolate z-50`,side:u,sideOffset:d,children:y})}),t[20]=f,t[21]=m,t[22]=p,t[23]=u,t[24]=d,t[25]=y,t[26]=b):b=t[26],b}function Cme(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(yme,{className:i,"data-slot":`select-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function K6(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 whitespace-nowrap rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(dme,{children:(0,X.jsx)(qv,{className:`size-4`})})}),t[6]=o):o=t[6];let s;t[7]===n?s=t[8]:(s=(0,X.jsx)(pme,{children:n}),t[7]=n,t[8]=s);let c;return t[9]!==i||t[10]!==a||t[11]!==s?(c=(0,X.jsxs)(ume,{className:a,"data-slot":`select-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function wme(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`pointer-events-none -mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(bme,{className:i,"data-slot":`select-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Tme(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex cursor-default items-center justify-center py-1 data-[visible=false]:hidden`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(ote,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(gme,{className:i,"data-slot":`select-scroll-up-button`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Eme(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex cursor-default items-center justify-center py-1 data-[visible=false]:hidden`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(hme,{className:i,"data-slot":`select-scroll-down-button`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function q6(e,t){let n=new Map;for(let e of t){let t=n.get(e.target);t?t.push(e.source):n.set(e.target,[e.source])}let r=new Set,i=new Set([e]),a=[e];for(;a.length>0;){let e=a.pop();if(e)for(let t of n.get(e)??[])r.add(t),i.has(t)||(i.add(t),a.push(t))}return r}var J6=`event:`;function Y6(e){return`${J6}${e}`}function X6(e){if(typeof e!=`string`||!e.startsWith(J6))return null;let t=e.slice(6).trim();return t.length>0?t:null}function Dme(e){return e===b1.eventSplit}function Z6(e){return C0(e)}function Q6(e){let{rule:t,event:n}=e,r=t.field.trim();return r===`$event.name`?F2(t)?!0:t.operator===`equals`?t.value===n.name:t.operator!==`not_equals`||t.value!==n.name:F2(t)||e.declaredElsewhere.has(r)?!0:n.payloadFields.some(e=>e.path===r)}function $6(e){let{rule:t,event:n}=e;return t.field.trim()!==`$event.name`||F2(t)?!0:t.operator===`equals`?t.value!==n.name:t.operator!==`not_equals`||t.value===n.name}function Ome(e){let t=(t,n)=>n?t.every(t=>Q6({...e,rule:t})):t.some(t=>Q6({...e,rule:t})),n=e.model.groups.map(e=>t(e.conditions,e.logic===`and`));return e.model.groupLogic===`and`?n.every(Boolean):n.some(Boolean)}function kme(e){let t=(t,n)=>n?t.some(t=>$6({...e,rule:t})):t.every(t=>$6({...e,rule:t})),n=e.model.groups.map(e=>t(e.conditions,e.logic===`and`));return e.model.groupLogic===`and`?n.some(Boolean):n.every(Boolean)}function Ame(e){let{events:t,branch:n}=e;if(!n)return[...t];let r=e4(e.node.data.config?.conditionModel);return r.valid?t.filter(t=>{let i={model:r.model,event:t,declaredElsewhere:e.declaredElsewhere};return n===`true`?Ome(i):kme(i)}):[...t]}function jme(e){let t=C1(e.entryNode.data.config);return t?Ka((e.handle===`started`?t.startEvents:e.handle===`canceled`?t.cancelEvents:[]).map(t=>Ny(e.catalog,t))):[]}function Mme(e,t){let n=e.data.config?.actionType;if(typeof n!=`string`)return[];let r=Py(t,n);return r?f0(e.data.config,r.outputFields).map(e=>e.path):[]}function Nme(e){let{catalog:t}=e,n=new Map(e.nodes.map(e=>[e.id,e])),r=new Map;for(let t of e.edges){let e=r.get(t.target);e?e.push(t):r.set(t.target,[t])}let i=r=>{let i=new Set,a=e=>{let r=n.get(e);if(r)for(let e of Mme(r,t))i.add(e)};a(r);for(let t of q6(r,e.edges))a(t);return i},a=new Map,o=(e,s)=>{let c=a.get(e);if(c)return c;if(s.has(e))return[];let l=r.get(e)??[];if(l.length===0)return a.set(e,[]),[];let u=new Set(s);u.add(e);let d=null;for(let e of l){let r=n.get(e.source);if(!r)continue;let a=r.data.type===`lifecycle`?jme({entryNode:r,handle:e.sourceHandle,catalog:t}):Pme({parent:r,handle:e.sourceHandle,events:o(r.id,u),declaredElsewhere:i(r.id)});d=d===null?a:Fme(d,a)}let f=d??[];return a.set(e,f),f};return o(e.targetNodeId,new Set)}function Pme(e){let{parent:t,handle:n,events:r}=e;if(Z6(t)){let e=X6(n);return r.filter(t=>t.name===e)}return r.length>0&&E0(t)?Ame({events:r,node:t,branch:w0(n),declaredElsewhere:e.declaredElsewhere}):r}function Fme(e,t){let n=new Set(t.map(e=>e.name));return e.filter(e=>n.has(e.name))}function Ime(e){let t=Ya(Ka(e.map(e=>e.field.type)));return t.length<2?t[0]?{type:t[0]}:{}:{typeClash:{types:t,events:e.filter(e=>e.field.type).map(e=>e.event.name)}}}function Lme(e){return e.find(e=>e.field.description)?.field.description}function Rme(e){return Ya(e.map(e=>(e.field.enumValues??[]).toSorted().join(` `))).length===1&&e[0]?.field.enumValues?[...e[0].field.enumValues]:void 0}function zme(e){let t=new Map;for(let n of e)for(let e of n.payloadFields){let r=t.get(e.path);r?r.push({event:n,field:e}):t.set(e.path,[{event:n,field:e}])}return Array.from(t.entries()).map(([t,n])=>{let{type:r,typeClash:i}=Ime(n),a=Lme(n),o=Rme(n);return{path:t,...a?{description:a}:{},...r?{type:r}:{},...o?{enumValues:o}:{},...i?{typeClash:i}:{},...n.length<e.length||n.some(e=>e.field.nullable)?{nullable:!0}:{},declaredBy:n.map(e=>e.event.name)}})}var e8=`Carried by every Event`,Bme=`Event name`;function Vme(e){return zme(e).map(({declaredBy:t,...n})=>{let[r,i]=Ja(e,e=>t.includes(e.name));return{...n,...i.length>0?{absentOn:i.map(e=>e.label)}:{},...e.length<2?{}:{sourceLabel:i.length===0?e8:r.map(e=>e.label).join(`, `)}}})}function t8(e){return Nme({targetNodeId:e.targetNodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog})}function Hme(e,t){let n=Py(e,t);return n?[...n.outputFields]:[]}function n8(e,t){if(t.data.label)return t.data.label;if(t.data.type===`action`){let n=_0(t.data.config,`actionType`);if(n){let t=Py(e,n);if(t?.label)return t.label}return n||`Action`}return t.data.type===`lifecycle`?`Lifecycle`:`Node`}function r8(e,t){let n=_0(e.data.config,`actionType`);if(n){let r=Hme(t.catalog,n);if(r.length>0)return[...f0(e.data.config,r)]}return e.data.type===`lifecycle`?Vme(t8(t)):[]}function i8(e){let{currentNodeId:t,nodes:n,edges:r}=e;if(!t)return[];let i=q6(t,r);return n.filter(e=>i.has(e.id))}function Ume(e){let{currentNodeId:t,nodes:n,edges:r,catalog:i}=e;return t?i8(e).flatMap(e=>{let a=n8(i,e);return r8(e,{targetNodeId:t,nodes:n,edges:r,catalog:i}).map(({sourceLabel:t,...n})=>({...n,sourceNodeId:e.id,sourceNodeName:t??a}))}):[]}function a8(e){return e.type===`timestamp`?`timestamp`:e.type===`string`||e.type===`number`||e.type===`boolean`?e.type:e.type===`duration`||e.type===void 0?`string`:null}function Wme(e,t){let n=Ny(e,t);return n?Ka(n.payloadFields.map(e=>{let r=e.path.trim(),i=a8({...e,sourceNodeId:t,sourceNodeName:n.label});return r&&i?{path:r,label:r,type:i,sourceNodeId:t,sourceNodeLabel:n.label,sourceNodeLabels:[n.label],...e.nullable?{nullable:!0}:{},...e.enumValues?{enumValues:e.enumValues}:{}}:null})).toSorted((e,t)=>e.path.localeCompare(t.path)):[]}function Gme(e){let{currentNodeId:t,nodes:n,edges:r,catalog:i}=e,a=i8(e).find(e=>e.data.type===`lifecycle`);if(!(a&&t))return[];let o=t8({targetNodeId:t,nodes:n,edges:r,catalog:i});return o.length<2?[]:[{path:Ode,label:Bme,type:`string`,sourceNodeId:a.id,sourceNodeLabel:e8,sourceNodeLabels:[e8],enumValues:o.map(e=>e.name)}]}function o8(e){let t=new Map(Gme(e).map(e=>[e.path,e]));for(let n of Ume(e)){let e=n.path.trim();if(!e||n.typeClash)continue;let r=a8(n);if(!r)continue;let i=t.get(e);if(i){i.sourceNodeLabels.includes(n.sourceNodeName)||(i.sourceNodeLabels.push(n.sourceNodeName),i.sourceNodeLabels.sort((e,t)=>e.localeCompare(t)));continue}t.set(e,{path:e,label:e,type:r,sourceNodeId:n.sourceNodeId,sourceNodeLabel:n.sourceNodeName,sourceNodeLabels:[n.sourceNodeName],...n.nullable?{nullable:!0}:{},...n.enumValues?{enumValues:n.enumValues}:{}})}return Array.from(t.values()).toSorted((e,t)=>e.path.localeCompare(t.path))}function Kme(e,t,n){return!(t&&e.type)||n.allowNumber&&e.type===`number`?!0:e.type===t}function s8(e,t){return Kme(e,t,{allowNumber:!1})}function qme(e,t,n){return n?2:t&&!e.type?1:0}function Jme(e,t){let n=e.typeClash;if(n&&!(t&&!n.types.some(e=>s8({type:e},t))))return`${n.events.join(` and `)} type this differently. Add an Event Split above this node to use it.`}function c8(e){let t=(0,Z.c)(45),{isOpen:n,position:r,onSelect:i,onClose:a,currentNodeId:o,filter:s,fieldType:c}=e,l=s===void 0?``:s,u=yy(),[d]=EA(Q4),[f]=EA($4),[p,m]=(0,Y.useState)(0),h=(0,Y.useRef)(null),g;t[0]!==o||t[1]!==f||t[2]!==d?(g=i8({currentNodeId:o,nodes:d,edges:f}),t[0]=o,t[1]=f,t[2]=d,t[3]=g):g=t[3];let _=g,v;bb0:{if(!o){let e;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[4]=e):e=t[4],v=e;break bb0}let e;if(t[5]!==u||t[6]!==o||t[7]!==f||t[8]!==c||t[9]!==d||t[10]!==_){let n=[];for(let e of _){let t=n8(u,e),r=r8(e,{targetNodeId:o,nodes:d,edges:f,catalog:u});!c&&e.data.type!==`lifecycle`&&r.length&&n.push({type:`node`,rank:0,nodeId:e.id,nodeName:t,template:h0({nodeId:e.id,nodeLabel:t})});for(let i of r){let r=Jme(i,c);(r||s8(i,c))&&n.push({type:`field`,rank:qme(i,c,r),nodeId:e.id,nodeName:t,field:i.path,description:i.description,template:h0({nodeId:e.id,nodeLabel:t,fieldPath:i.path}),...r?{unusable:r}:{},...i.absentOn?.length?{absentOn:i.absentOn}:{}})}}e=n.toSorted(Xme),t[5]=u,t[6]=o,t[7]=f,t[8]=c,t[9]=d,t[10]=_,t[11]=e}else e=t[11];v=e}let y=v,b;if(t[12]!==l||t[13]!==y){bb1:{let e=l.trim().toLowerCase();if(!e){b=y;break bb1}b=y.filter(t=>t.nodeName.toLowerCase().includes(e)||t.field&&t.field.toLowerCase().includes(e))}t[12]=l,t[13]=y,t[14]=b}else b=t[14];let x=b,S=x.length===0?0:Math.min(p,x.length-1),C=c&&y.length===0?c===`duration`?`No field upstream is a duration. Type a value like 24h.`:`No field upstream is a date and time. Type one, like 2026-03-10T09:00:00Z.`:null,w=x.length>0||C!==null,T;t[15]!==x||t[16]!==a||t[17]!==i||t[18]!==S?(T=e=>{bb87:switch(e.key){case`ArrowDown`:e.preventDefault(),m(e=>e<x.length-1?e+1:e);break bb87;case`ArrowUp`:e.preventDefault(),m(Yme);break bb87;case`Enter`:{e.preventDefault();let t=x[S];t&&!t.unusable&&i(t.template);break bb87}case`Escape`:e.preventDefault(),a()}},t[15]=x,t[16]=a,t[17]=i,t[18]=S,t[19]=T):T=t[19];let E=T,D=n&&w,O;t[20]===D?O=t[21]:(O={enabled:D},t[20]=D,t[21]=O),_Y(window,`keydown`,E,O);let k;if(t[22]===S?k=t[23]:(k=()=>{let e=h.current?.children.item(S);e instanceof HTMLElement&&e.scrollIntoView({block:`nearest`})},t[22]=S,t[23]=k),vY(S,k),!(n&&w)||typeof document>`u`)return null;let A=Math.min(r.top,window.innerHeight-300),j=Math.min(r.left,window.innerWidth-320),M;t[24]!==j||t[25]!==A?(M={top:A,left:j},t[24]=j,t[25]=A,t[26]=M):M=t[26];let N=M,P=`${N.top}px`,F=`${N.left}px`,I;t[27]!==P||t[28]!==F?(I={top:P,left:F},t[27]=P,t[28]=F,t[29]=I):I=t[29];let L;t[30]===C?L=t[31]:(L=C&&(0,X.jsx)(`div`,{className:`px-2 py-1.5 text-muted-foreground text-sm`,children:C}),t[30]=C,t[31]=L);let R;if(t[32]!==x||t[33]!==i||t[34]!==S){let e;t[36]!==i||t[37]!==S?(e=(e,t)=>(0,X.jsxs)(`div`,{className:Q(`flex items-center justify-between rounded px-2 py-1.5 text-sm transition-colors`,e.unusable?`cursor-not-allowed opacity-60`:`cursor-pointer`,t===S?`bg-accent text-accent-foreground`:!e.unusable&&`hover:bg-accent/50`),onMouseDown:t=>{t.preventDefault(),e.unusable||i(e.template)},onMouseEnter:()=>m(t),children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`font-medium`,children:e.type===`node`?e.nodeName:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[e.nodeName,`.`]}),e.field]})}),e.description&&(0,X.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.description}),e.absentOn&&(0,X.jsxs)(`div`,{className:`text-warning text-xs dark:text-warning`,children:[`Absent on `,e.absentOn.join(`, `)]}),e.unusable&&(0,X.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:e.unusable})]}),t===S&&!e.unusable&&(0,X.jsx)(qv,{className:`size-4`})]},`${e.nodeId}-${e.field||`root`}`),t[36]=i,t[37]=S,t[38]=e):e=t[38],R=x.map(e),t[32]=x,t[33]=i,t[34]=S,t[35]=R}else R=t[35];let z;t[39]!==L||t[40]!==R?(z=(0,X.jsxs)(`div`,{className:`max-h-60 overflow-y-auto`,ref:h,children:[L,R]}),t[39]=L,t[40]=R,t[41]=z):z=t[41];let B;return t[42]!==I||t[43]!==z?(B=(0,Xi.createPortal)((0,X.jsx)(`div`,{className:`fixed z-50 w-80 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,style:I,children:z}),document.body),t[42]=I,t[43]=z,t[44]=B):B=t[44],B}function Yme(e){return e>0?e-1:e}function Xme(e,t){return e.rank-t.rank}var l8=`data-placeholder`,u8=`data-filler`,Zme=`inline-flex items-center gap-1 rounded bg-info/10 px-1.5 py-0.5 text-info font-mono text-xs border border-info/20 mx-0.5`,Qme=`inline-flex items-center gap-1 rounded bg-destructive/10 px-1.5 py-0.5 text-destructive font-mono text-xs border border-destructive/20 mx-0.5`;function $me(e,t,n){let r=e.fieldPath?`${e.nodeLabel}.${e.fieldPath}`:e.nodeLabel,i=t.find(t=>t.id===e.nodeId);if(!i)return r;let a=i.data.label;if(!a&&i.data.type===`action`){let e=_0(i.data.config,`actionType`);e&&(a=Py(n,e)?.label)}return a?e.fieldPath?`${a}.${e.fieldPath}`:a:r}function ehe(e){return e instanceof HTMLElement?e.getAttribute(`data-template`):null}function d8(e){return e.start+e.text.length}function f8(e,t){let n=[],r=0;function i(e){n.push(e),r+=e.text.length}function a(e){if(e instanceof Text){i({kind:`text`,node:e,start:r,text:e.data});return}if(!(e instanceof HTMLElement))return;let n=ehe(e);if(n!==null){i({kind:`badge`,node:e,start:r,text:n});return}if(!(e.hasAttribute(l8)||e.hasAttribute(u8))){if(e.tagName===`BR`){i({kind:`break`,node:e,start:r,text:t?`
|
|
100
100
|
`:``});return}for(let t of Array.from(e.childNodes))a(t)}}for(let t of Array.from(e.childNodes))a(t);return n}function p8(e,t){return f8(e,t).map(e=>e.text).join(``)}function the(e,t){let{catalog:n}=t,r=t.multiline??!1,i={focused:!1,nodes:[]};function a(e){let t=e.at(-1);return t?d8(t):0}function o(e,t,n){let r=e.find(e=>e.kind===`text`&&e.node===t);if(r)return r.start+Math.min(n,r.text.length);let i=e.find(e=>e.kind!==`text`&&e.node.contains(t));if(i)return n===0?i.start:d8(i);if(t instanceof HTMLElement){let r=Array.from(t.childNodes);for(let t of r.slice(n)){let n=e.find(e=>e.node===t||t.contains(e.node));if(n)return n.start}let i=e.findLast(e=>t.contains(e.node));return i?d8(i):a(e)}return a(e)}function s(e,t,n){let r=e.find(e=>e.kind===`badge`&&(t===`start`?e.start:d8(e))===n);return r?{end:d8(r),start:r.start}:null}function c(){let t=window.getSelection();if(!t||t.rangeCount===0)return null;let n=t.getRangeAt(0);if(!e.contains(n.endContainer))return null;let i=f8(e,r),a=o(i,n.endContainer,n.endOffset);return{badgeAfter:s(i,`start`,a),badgeBefore:s(i,`end`,a),collapsed:n.collapsed,offset:a}}function l(){document.activeElement!==e&&e.focus()}function u(e,t){let n=e.find(e=>e.kind===`badge`&&t>e.start&&t<d8(e));if(n)return u(e,n.start);let r=e.findLast(e=>e.kind===`text`&&e.start<=t&&t<=d8(e));return r?.kind===`text`?{node:r.node,offset:t-r.start}:null}function d(t){let n=f8(e,r),i=u(n,Math.max(0,Math.min(t,a(n))));if(!i){l();return}let o=document.createRange(),s=window.getSelection();try{o.setStart(i.node,i.offset),o.collapse(!0),s?.removeAllRanges(),s?.addRange(o),l()}catch{l()}}function f(){e.appendChild(document.createTextNode(``))}function p(t){if(!r){e.appendChild(document.createTextNode(t));return}let n=t.split(`
|
|
101
|
-
`);n.forEach((t,r)=>{t&&e.appendChild(document.createTextNode(t)),r<n.length-1&&(f(),e.appendChild(document.createElement(`br`)),f())})}function m(t,r){i=r;let a=r.focused?r.caretOffset??c()?.offset??null:null;if(e.innerHTML=``,!(t||r.focused)){let t=document.createElement(`span`);t.setAttribute(l8,``),t.className=`text-muted-foreground pointer-events-none`,t.textContent=r.placeholder??``,e.appendChild(t);return}for(let i of m0(t)){if(i.kind===`literal`){p(i.text);continue}let t=document.createElement(`span`);t.className=r.nodes.some(e=>e.id===i.token.nodeId)?Zme:Qme,t.contentEditable=`false`,t.setAttribute(`data-template`,i.token.raw),t.textContent=$me(i.token,r.nodes,n),f(),e.appendChild(t),f()}if(!t){let t=document.createElement(`br`);t.setAttribute(u8,``),f(),e.appendChild(t)}r.focused&&a!==null&&d(a)}return{render:m,rerender(t){m(p8(e,r),{...i,nodes:t,caretOffset:void 0})},readText:()=>p8(e,r),readCaret:c,setCaretOffset:d,insertText(e){let t=window.getSelection();if(!t||t.rangeCount===0)return!1;let n=t.getRangeAt(0);n.deleteContents();let r=document.createTextNode(e);return n.insertNode(r),n.setStartAfter(r),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!0},insertLineBreak(){let e=window.getSelection();if(!e||e.rangeCount===0)return!1;let t=e.getRangeAt(0);t.deleteContents();let n=document.createElement(`br`),r=document.createTextNode(``);return t.insertNode(n),n.parentNode?.insertBefore(r,n.nextSibling),n.parentNode?.insertBefore(document.createTextNode(``),n),t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!0}}}function m8(e){let t=(0,Z.c)(52),{value:n,onChange:r,placeholder:i,multiline:a}=e,o=yy(),s=wA(Q4),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(n),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={top:0,left:0},t[0]=h):h=t[0];let[g,_]=(0,Y.useState)(h),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S;t[1]!==o||t[2]!==a?(S=e=>{if(c.current=e,!e){l.current=null;return}l.current=the(e,{multiline:a,catalog:o})},t[1]=o,t[2]=a,t[3]=S):S=t[3];let C=S,w;t[4]!==d||t[5]!==s||t[6]!==i||t[7]!==n?(w=()=>{d||l.current?.render(n,{focused:!1,nodes:s,placeholder:i})},t[4]=d,t[5]=s,t[6]=i,t[7]=n,t[8]=w):w=t[8],vY(d?h8:n,w);let T;t[9]!==d||t[10]!==s?(T=()=>{d||l.current?.rerender(s)},t[9]=d,t[10]=s,t[11]=T):T=t[11],vY(d?h8:s,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=e.slice(0,t),r=n.lastIndexOf(`@`),i=r===-1?null:n.slice(r+1),a=p0(e).some(e=>r>=e.start&&r<e.end);if(i===null||a||i.includes(` `)){m(!1);return}y(i),x(r);let o=c.current?.getBoundingClientRect();o&&_({top:o.bottom+window.scrollY+4,left:o.left+window.scrollX}),m(!0)},t[12]=E):E=t[12];let D=E,O;t[13]!==s||t[14]!==r||t[15]!==i?(O=()=>{let e=l.current;if(!e)return;let t=e.readText();if(t===u.current)return;let n=p0(u.current).length,a=p0(t).length;if(u.current=t,r?.(t),n===a){D(t,e.readCaret()?.offset??t.length);return}m(!1),e.render(t,{focused:!0,nodes:s,placeholder:i})},t[13]=s,t[14]=r,t[15]=i,t[16]=O):O=t[16];let k=O,A;t[17]!==b||t[18]!==v||t[19]!==s||t[20]!==r||t[21]!==i?(A=e=>{let t=l.current;if(!t||b===null)return;let n=t.readText(),a=n.slice(0,b),o=n.slice(b+1+v.length),c=a+e+o;u.current=c,r?.(c),m(!1),x(null),f(!0),t.render(c,{caretOffset:a.length+e.length,focused:!0,nodes:s,placeholder:i})},t[17]=b,t[18]=v,t[19]=s,t[20]=r,t[21]=i,t[22]=A):A=t[22];let j=A,M;t[23]!==s||t[24]!==i||t[25]!==n?(M=()=>{f(!0);let e=l.current?.readText()??n;u.current=e,e||l.current?.render(``,{focused:!0,nodes:s,placeholder:i})},t[23]=s,t[24]=i,t[25]=n,t[26]=M):M=t[26];let N=M,P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{setTimeout(()=>{document.activeElement!==c.current&&(f(!1),m(!1))},nhe)},t[27]=P):P=t[27];let F=P,I;t[28]===k?I=t[29]:(I=e=>{e.preventDefault(),l.current?.insertText(e.clipboardData.getData(`text/plain`))&&k()},t[28]=k,t[29]=I);let L=I,R;t[30]===k?R=t[31]:(R=()=>{l.current?.insertLineBreak()&&k()},t[30]=k,t[31]=R);let z=R,B;t[32]!==s||t[33]!==r||t[34]!==i?(B=e=>{let t=l.current;if(!t)return;let n=t.readText(),a=n.slice(0,e.start)+n.slice(e.end);u.current=a,r?.(a),m(!1),t.render(a,{caretOffset:e.start,focused:!0,nodes:s,placeholder:i})},t[32]=s,t[33]=r,t[34]=i,t[35]=B):B=t[35];let V=B,H;t[36]!==z||t[37]!==a||t[38]!==V?(H=e=>{let t=l.current;if(!t)return;if(a&&e.key===`Enter`){e.preventDefault(),z();return}if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.key===`Backspace`||e.key===`ArrowLeft`,r=e.key===`Delete`||e.key===`ArrowRight`;if(!(n||r))return;let i=t.readCaret();if(!i?.collapsed)return;let o=n?i.badgeBefore:i.badgeAfter;o&&(e.preventDefault(),e.key===`ArrowLeft`?t.setCaretOffset(o.start):e.key===`ArrowRight`?t.setCaretOffset(o.end):V(o))},t[36]=z,t[37]=a,t[38]=V,t[39]=H):H=t[39];let U=H,W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>m(!1),t[40]=W):W=t[40];let G;return t[41]!==C||t[42]!==v||t[43]!==g||t[44]!==j||t[45]!==N||t[46]!==k||t[47]!==U||t[48]!==L||t[49]!==s||t[50]!==p?(G={attachEditor:C,autocompleteFilter:v,autocompletePosition:g,handleBlur:F,handleFocus:N,handleInput:k,handleAutocompleteSelect:j,handleKeyDown:U,handlePaste:L,closeAutocomplete:W,nodes:s,showAutocomplete:p},t[41]=C,t[42]=v,t[43]=g,t[44]=j,t[45]=N,t[46]=k,t[47]=U,t[48]=L,t[49]=s,t[50]=p,t[51]=G):G=t[51],G}var h8=Symbol(`focused`),nhe=200;function g8(e){let t=(0,Z.c)(38),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,fieldType:c,currentNodeId:l,labelledBy:u,ariaLabel:d,required:f,invalid:p}=e,m=n===void 0?``:n,h;t[0]!==r||t[1]!==i||t[2]!==m?(h={value:m,onChange:r,placeholder:i},t[0]=r,t[1]=i,t[2]=m,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=m8(h),O;t[4]===E?O=t[5]:(O=E.find(rhe)?.id,t[4]=E,t[5]=O);let k=O,A=p&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex min-h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=p||void 0,P=p||void 0,F=f||void 0,I=!a,L;t[10]!==d||t[11]!==g||t[12]!==x||t[13]!==S||t[14]!==C||t[15]!==w||t[16]!==T||t[17]!==s||t[18]!==u||t[19]!==I||t[20]!==P||t[21]!==F?(L=(0,X.jsx)(`div`,{"aria-invalid":P,"aria-label":d,"aria-labelledby":u,"aria-required":F,className:`w-full outline-none`,contentEditable:I,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[10]=d,t[11]=g,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=s,t[18]=u,t[19]=I,t[20]=P,t[21]=F,t[22]=L):L=t[22];let R;t[23]!==L||t[24]!==M||t[25]!==N?(R=(0,X.jsx)(`div`,{className:M,"data-invalid":N,children:L}),t[23]=L,t[24]=M,t[25]=N,t[26]=R):R=t[26];let z=l??k??void 0,B;t[27]!==_||t[28]!==v||t[29]!==y||t[30]!==c||t[31]!==b||t[32]!==D||t[33]!==z?(B=(0,X.jsx)(c8,{currentNodeId:z,fieldType:c,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[27]=_,t[28]=v,t[29]=y,t[30]=c,t[31]=b,t[32]=D,t[33]=z,t[34]=B):B=t[34];let V;return t[35]!==R||t[36]!==B?(V=(0,X.jsxs)(X.Fragment,{children:[R,B]}),t[35]=R,t[36]=B,t[37]=V):V=t[37],V}function rhe(e){return e.selected}var ihe=[{label:`North America`,zones:[{value:`America/New_York`,label:`Eastern Time (ET)`},{value:`America/Chicago`,label:`Central Time (CT)`},{value:`America/Denver`,label:`Mountain Time (MT)`},{value:`America/Phoenix`,label:`Arizona Time (MST)`},{value:`America/Los_Angeles`,label:`Pacific Time (PT)`},{value:`America/Anchorage`,label:`Alaska Time (AKT)`},{value:`Pacific/Honolulu`,label:`Hawaii Time (HST)`},{value:`America/Toronto`,label:`Toronto`},{value:`America/Vancouver`,label:`Vancouver`}]},{label:`Europe`,zones:[{value:`Europe/London`,label:`London (GMT/BST)`},{value:`Europe/Paris`,label:`Paris (CET/CEST)`},{value:`Europe/Berlin`,label:`Berlin (CET/CEST)`},{value:`Europe/Rome`,label:`Rome (CET/CEST)`},{value:`Europe/Madrid`,label:`Madrid (CET/CEST)`},{value:`Europe/Amsterdam`,label:`Amsterdam (CET/CEST)`},{value:`Europe/Brussels`,label:`Brussels (CET/CEST)`},{value:`Europe/Stockholm`,label:`Stockholm (CET/CEST)`},{value:`Europe/Warsaw`,label:`Warsaw (CET/CEST)`},{value:`Europe/Athens`,label:`Athens (EET/EEST)`},{value:`Europe/Moscow`,label:`Moscow (MSK)`}]},{label:`Asia`,zones:[{value:`Asia/Dubai`,label:`Dubai (GST)`},{value:`Asia/Kolkata`,label:`India (IST)`},{value:`Asia/Shanghai`,label:`China (CST)`},{value:`Asia/Hong_Kong`,label:`Hong Kong (HKT)`},{value:`Asia/Tokyo`,label:`Tokyo (JST)`},{value:`Asia/Seoul`,label:`Seoul (KST)`},{value:`Asia/Singapore`,label:`Singapore (SGT)`},{value:`Asia/Bangkok`,label:`Bangkok (ICT)`},{value:`Asia/Jakarta`,label:`Jakarta (WIB)`}]},{label:`Australia & Pacific`,zones:[{value:`Australia/Sydney`,label:`Sydney (AEDT/AEST)`},{value:`Australia/Melbourne`,label:`Melbourne (AEDT/AEST)`},{value:`Australia/Brisbane`,label:`Brisbane (AEST)`},{value:`Australia/Perth`,label:`Perth (AWST)`},{value:`Pacific/Auckland`,label:`Auckland (NZDT/NZST)`}]},{label:`South America`,zones:[{value:`America/Sao_Paulo`,label:`São Paulo (BRT)`},{value:`America/Argentina/Buenos_Aires`,label:`Buenos Aires (ART)`},{value:`America/Santiago`,label:`Santiago (CLT)`},{value:`America/Bogota`,label:`Bogotá (COT)`},{value:`America/Lima`,label:`Lima (PET)`}]},{label:`Africa & Middle East`,zones:[{value:`Africa/Cairo`,label:`Cairo (EET)`},{value:`Africa/Johannesburg`,label:`Johannesburg (SAST)`},{value:`Africa/Lagos`,label:`Lagos (WAT)`},{value:`Africa/Nairobi`,label:`Nairobi (EAT)`},{value:`Asia/Jerusalem`,label:`Jerusalem (IST)`}]},{label:`Other`,zones:[{value:`UTC`,label:`UTC (Coordinated Universal Time)`}]}];function ahe(e){let t=(0,Z.c)(11),{value:n,onValueChange:r,disabled:i,id:a}=e,o;t[0]===r?o=t[1]:(o=H6(r),t[0]=r,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(U6,{placeholder:`Select timezone`}),t[2]=s):s=t[2];let c;t[3]===a?c=t[4]:(c=(0,X.jsx)(W6,{className:`w-full`,id:a,children:s}),t[3]=a,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(G6,{children:ihe.map(ohe)}),t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==n?(u=(0,X.jsxs)(V6,{disabled:i,onValueChange:o,value:n,children:[c,l]}),t[6]=i,t[7]=o,t[8]=c,t[9]=n,t[10]=u):u=t[10],u}function ohe(e){return(0,X.jsxs)(Sme,{children:[(0,X.jsx)(Cme,{children:e.label}),e.zones.map(she)]},e.label)}function she(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}var _8=Y.createContext(void 0);function v8(e){let t=Y.useContext(_8);if(t===void 0&&!e)throw Error(Gg(72));return t}var che={...Vq,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},lhe=class extends fq{constructor(e,t,n){let r=new Mq;super(uhe(e,r,t,n),dhe(r),che)}setOpen=(e,t)=>{Eq(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,DH(cH,e))}};function uhe(e,t,n,r=!1){let i={...Pq(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=Fq(t,n,r),i}function dhe(e){return{popupRef:Y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var fhe=rq(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=xq((e,t)=>new lhe({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Oq(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=kq(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Y.useRef(null);Mg(()=>{m&&t&&p.setOpen(!1,DH(wH))},[m,t,p]),Mg(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Mg(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Y.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,DH(TH))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,X.jsxs)(_8.Provider,{value:p,children:[l&&(0,X.jsx)(Sq,{handle:l,store:p}),T&&(0,X.jsx)(phe,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function phe({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=YG(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=KG(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Y.useMemo(()=>Fg(a.reference,i.reference),[a.reference,i.reference]);return Aq(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??a_}),null}var y8=Y.createContext(void 0);function mhe(){return Y.useContext(y8)}var b8=`data-base-ui-tooltip-trigger`;function x8(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(ig(n))return n}}let t=e.target;return ig(t)?t:null}function hhe(e){let t=e;for(;t;){let e=t.closest(`[${b8}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&ig(n.host)?n.host:null}return null}var ghe=iq(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=v8(!0),m=Hq(a)??p;if(!m)throw Error(Gg(82));let h=PH(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Y.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=Dq(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=mhe(),{delayRef:T,isInstantPhase:E,hasProvider:D}=MU(v,{open:_}),O=Qq(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=FU(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Y.useRef(!1),F=zH(),I=Y.useRef(void 0);function L(){return D?TU(T.current,`open`)===0?0:c??w??600:b}function R(e){let t=y.current;if(!t||!e)return!1;let n=hhe(e);return n!==null&&n!==t&&mU(t,n)}function z(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let B=tJ(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?vJ():null,restMs:L,delay(){return u==null&&D?{close:TU(T.current,`close`)}:{close:x}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),V=qq(v,{enabled:!A}).reference,H=e=>{let t=P.current,n=x8(e),r=z(n),i=y.current,a=i&&n&&mU(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,DH(lH,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&aU(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,DH(lH,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},U=m.useState(`triggerProps`,C);return o_(`button`,e,{state:{open:_},ref:[t,S,y],props:[B,V,C||M!==`none`?U:void 0,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(x8(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,"data-trigger-disabled":A?``:void 0,[b8]:A?void 0:``},f],stateAttributesMapping:nH})}),S8=Y.createContext(void 0);function _he(){let e=Y.useContext(S8);if(e===void 0)throw Error(Gg(70));return e}var vhe=Y.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=SG({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,X.jsxs)(Y.Fragment,{children:[l,c&&Xi.createPortal(n,c)]})}),yhe=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return v8().useState(`mounted`)||n?(0,X.jsx)(S8.Provider,{value:n,children:(0,X.jsx)(vhe,{ref:t,...r})}):null}),C8=Y.createContext(void 0);function w8(){let e=Y.useContext(C8);if(e===void 0)throw Error(Gg(71));return e}var bhe=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=_G,style:g,..._}=e,v=v8(),y=_he(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=g6({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=C6(e,Y.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,X.jsx)(C8.Provider,{value:D,children:O})}),xhe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=v8(),{side:s,align:c}=w8(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);vq({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),$q(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return o_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[yq,f,S6(d),a],stateAttributesMapping:aH})}),She=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=v8(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=w8();return o_(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:iH})}),Che=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Y.useMemo(()=>({open:t,close:n}),[t,n]);return(0,X.jsx)(y8.Provider,{value:t,children:(0,X.jsx)(jU,{delay:i,timeoutMs:r,children:e.children})})};function T8(e){let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,X.jsx)(Che,{closeDelay:0,"data-slot":`tooltip-provider`,delay:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function E8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(T8,{children:(0,X.jsx)(fhe,{"data-slot":`tooltip`,...n})}),t[2]=n,t[3]=r),r}function D8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(ghe,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function O8(e){let t=(0,Z.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--transform-origin) text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(She,{className:`z-50 size-2.5 rotate-45 rounded-[2px] bg-foreground`}),t[7]=c):c=t[7];let l;t[8]!==n||t[9]!==s?(l=(0,X.jsxs)(xhe,{className:s,"data-slot":`tooltip-content`,children:[n,c]}),t[8]=n,t[9]=s,t[10]=l):l=t[10];let u;return t[11]!==i||t[12]!==o||t[13]!==l?(u=(0,X.jsx)(yhe,{children:(0,X.jsx)(bhe,{sideOffset:o,...i,children:l})}),t[11]=i,t[12]=o,t[13]=l,t[14]=u):u=t[14],u}var whe=[];function k8(e){let t=(0,Z.c)(5),n=yy(),r=wA(Q4),i=wA($4),a;return t[0]!==n||t[1]!==i||t[2]!==e||t[3]!==r?(a=e?t8({targetNodeId:e,nodes:r,edges:i,catalog:n}):whe,t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=a):a=t[4],a}function The(e){let t=(0,Z.c)(40),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,rows:c,fieldType:l,labelledBy:u,required:d,invalid:f}=e,p=n===void 0?``:n,m=c===void 0?3:c,h;t[0]!==r||t[1]!==i||t[2]!==p?(h={value:p,onChange:r,placeholder:i,multiline:!0},t[0]=r,t[1]=i,t[2]=p,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=m8(h),O;t[4]===E?O=t[5]:(O=E.find(Ehe)?.id,t[4]=E,t[5]=O);let k=O,A=f&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=f||void 0,P=`${m*1.5}rem`,F;t[10]===P?F=t[11]:(F={minHeight:P},t[10]=P,t[11]=F);let I=f||void 0,L=d||void 0,R=!a,z;t[12]!==g||t[13]!==x||t[14]!==S||t[15]!==C||t[16]!==w||t[17]!==T||t[18]!==s||t[19]!==u||t[20]!==I||t[21]!==L||t[22]!==R?(z=(0,X.jsx)(`div`,{"aria-invalid":I,"aria-labelledby":u,"aria-required":L,className:`w-full whitespace-pre-wrap break-words outline-none`,contentEditable:R,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[12]=g,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=s,t[19]=u,t[20]=I,t[21]=L,t[22]=R,t[23]=z):z=t[23];let B;t[24]!==F||t[25]!==z||t[26]!==M||t[27]!==N?(B=(0,X.jsx)(`div`,{className:M,"data-invalid":N,style:F,children:z}),t[24]=F,t[25]=z,t[26]=M,t[27]=N,t[28]=B):B=t[28];let V=k||void 0,H;t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==l||t[33]!==b||t[34]!==D||t[35]!==V?(H=(0,X.jsx)(c8,{currentNodeId:V,fieldType:l,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[29]=_,t[30]=v,t[31]=y,t[32]=l,t[33]=b,t[34]=D,t[35]=V,t[36]=H):H=t[36];let U;return t[37]!==B||t[38]!==H?(U=(0,X.jsxs)(X.Fragment,{children:[B,H]}),t[37]=B,t[38]=H,t[39]=U):U=t[39],U}function Ehe(e){return e.selected}function Dhe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=typeof r==`string`?r:``,c;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(g8,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,value:s}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ohe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=n.rows||4,c=typeof r==`string`?r:``,l;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,X.jsx)(The,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,rows:s,value:c}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function khe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.value),t[0]=i,t[1]=o);let s=typeof r==`string`?r:``,c;return t[2]!==a||t[3]!==n.key||t[4]!==n.placeholder||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(wX,{disabled:a,id:n.key,onChange:o,placeholder:n.placeholder,value:s}),t[2]=a,t[3]=n.key,t[4]=n.placeholder,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ahe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=typeof r==`number`||typeof r==`string`?`${r}`:``,s;t[0]===i?s=t[1]:(s=e=>{let t=e.target.value.trim();if(!t){i(void 0);return}let n=Number.parseFloat(t);Number.isFinite(n)&&i(n)},t[0]=i,t[1]=s);let c;return t[2]!==a||t[3]!==o||t[4]!==n.key||t[5]!==n.min||t[6]!==n.placeholder||t[7]!==s?(c=(0,X.jsx)(wX,{disabled:a,id:n.key,min:n.min,onChange:s,placeholder:n.placeholder,type:`number`,value:o}),t[2]=a,t[3]=o,t[4]=n.key,t[5]=n.min,t[6]=n.placeholder,t[7]=s,t[8]=c):c=t[8],c}function jhe(e){let t=(0,Z.c)(15),{field:n,value:r,onChange:i,disabled:a}=e;if(!n.options)return null;let o=typeof r==`string`?r:``,s;t[0]===n.placeholder?s=t[1]:(s=(0,X.jsx)(U6,{placeholder:n.placeholder}),t[0]=n.placeholder,t[1]=s);let c;t[2]!==n.key||t[3]!==s?(c=(0,X.jsx)(W6,{className:`w-full`,id:n.key,children:s}),t[2]=n.key,t[3]=s,t[4]=c):c=t[4];let l;t[5]===n.options?l=t[6]:(l=n.options.map(Mhe),t[5]=n.options,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,X.jsx)(G6,{children:l}),t[7]=l,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==o||t[12]!==c||t[13]!==u?(d=(0,X.jsxs)(V6,{disabled:a,onValueChange:i,value:o,children:[c,u]}),t[9]=a,t[10]=i,t[11]=o,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Mhe(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}var Nhe=0;function A8(){return`kv-${++Nhe}`}function Phe(e){return typeof e!=`object`||!e||!(`name`in e&&`value`in e)?!1:typeof e.name==`string`&&typeof e.value==`string`}function Fhe(e){if(typeof e!=`string`||!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Phe)}catch{}return[]}function Ihe(e){let t=(0,Z.c)(29),{value:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=()=>Fhe(n).map(Rhe),t[0]=n,t[1]=a);let[o,s]=(0,Y.useState)(a),c;t[2]===r?c=t[3]:(c=function(e){s(e),r(JSON.stringify(e.map(Lhe)))},t[2]=r,t[3]=c);let l=c,u;t[4]!==o||t[5]!==l?(u=function(){l([...o,{name:``,value:``,_id:A8()}])},t[4]=o,t[5]=l,t[6]=u):u=t[6];let d=u,f;t[7]!==o||t[8]!==l?(f=function(e){l(o.filter(t=>t._id!==e))},t[7]=o,t[8]=l,t[9]=f):f=t[9];let p=f,m;t[10]!==o||t[11]!==l?(m=function(e,t,n){l(o.map(r=>r._id===e?{...r,[t]:n}:r))},t[10]=o,t[11]=l,t[12]=m):m=t[12];let h=m,g;if(t[13]!==i||t[14]!==p||t[15]!==o||t[16]!==h){let e;t[18]!==i||t[19]!==p||t[20]!==h?(e=e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(wX,{className:`flex-1`,disabled:i,onChange:t=>h(e._id,`name`,t.target.value),placeholder:`Name`,value:e.name}),(0,X.jsx)(g8,{ariaLabel:`Value`,className:`flex-1`,disabled:i,onChange:t=>h(e._id,`value`,t??``),placeholder:`Value`,value:e.value}),(0,X.jsx)(zv,{className:`size-8 shrink-0`,disabled:i,onClick:()=>p(e._id),size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})})]},e._id),t[18]=i,t[19]=p,t[20]=h,t[21]=e):e=t[21],g=o.map(e),t[13]=i,t[14]=p,t[15]=o,t[16]=h,t[17]=g}else g=t[17];let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(cy,{className:`mr-1 size-3.5`}),t[22]=_):_=t[22];let v;t[23]!==d||t[24]!==i?(v=(0,X.jsxs)(zv,{className:`h-8`,disabled:i,onClick:d,size:`sm`,type:`button`,variant:`outline`,children:[_,`Add`]}),t[23]=d,t[24]=i,t[25]=v):v=t[25];let y;return t[26]!==g||t[27]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[g,v]}),t[26]=g,t[27]=v,t[28]=y):y=t[28],y}function Lhe(e){let{name:t,value:n}=e;return{name:t,value:n}}function Rhe(e){return{...e,_id:A8()}}var zhe={"template-input":Dhe,"template-textarea":Ohe,text:khe,number:Ahe,select:jhe,"key-value":Ihe};function j8(e,t,n,r){if(!d0(t,e.showWhen))return null;let i=t[e.key]??e.defaultValue??``,a=zhe[e.type];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.label&&(0,X.jsxs)(TX,{className:`ml-1`,htmlFor:e.key,id:`${e.key}-label`,children:[e.label,e.required&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:`*`})]}),(0,X.jsx)(a,{disabled:r,field:e,onChange:t=>n({[e.key]:t}),value:i})]},e.key)}function Bhe(e){let t=(0,Z.c)(19),{label:n,fields:r,config:i,onUpdateConfig:a,disabled:o,defaultExpanded:s}=e,[c,l]=(0,Y.useState)(s!==void 0&&s),u;t[0]===c?u=t[1]:(u=()=>l(!c),t[0]=c,t[1]=u);let d;t[2]===n?d=t[3]:(d=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:n}),t[2]=n,t[3]=d);let f=`size-3.5 text-muted-foreground transition-transform duration-200 ${c?``:`-rotate-90`}`,p;t[4]===f?p=t[5]:(p=(0,X.jsx)(Jv,{className:f}),t[4]=f,t[5]=p);let m;t[6]!==u||t[7]!==d||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`ml-1 flex items-center gap-1 text-left`,onClick:u,type:`button`,children:[d,p]}),t[6]=u,t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==i||t[11]!==o||t[12]!==r||t[13]!==c||t[14]!==a?(h=c&&(0,X.jsx)(`div`,{className:`ml-1 space-y-4 border-primary/50 border-l-2 py-2 pl-3`,children:r.map(e=>j8(e,i,a,o))}),t[10]=i,t[11]=o,t[12]=r,t[13]=c,t[14]=a,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Vhe(e){let t=(0,Z.c)(11),{fields:n,config:r,onUpdateConfig:i,disabled:a}=e,o;if(t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i){let e;t[5]!==r||t[6]!==a||t[7]!==i?(e=e=>g4(e)?(0,X.jsx)(Bhe,{config:r,defaultExpanded:e.defaultExpanded,disabled:a,fields:e.fields,label:e.label,onUpdateConfig:i},`group-${e.label}`):j8(e,r,i,a),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],o=n.map(e),t[0]=r,t[1]=a,t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,X.jsx)(X.Fragment,{children:o}),t[9]=o,t[10]=s),s}function Hhe(e,t,n,r,i,a,o,s,c,l=2){let u=CW(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return yW(n.current,u)?void 0:u}var M8=Y.createContext(void 0),N8=Y.createContext(void 0),P8=Y.createContext(void 0),F8=Y.createContext(!1),I8=Y.createContext(``);function L8(){let e=Y.useContext(M8);if(!e)throw Error(Gg(22));return e}function R8(){let e=Y.useContext(N8);if(!e)throw Error(Gg(23));return e}function z8(){let e=Y.useContext(P8);if(!e)throw Error(Gg(24));return e}function B8(){return Y.useContext(I8)}function Uhe(){return Y.useContext(F8)}var V8={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Y3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>U3(t,e,n)):U3(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function H8(e){return e==null?void 0:`${e}-popup`}function Whe(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function U8(e){return Array.isArray(e)?e.map(e=>U8(e)).join(`,`):e==null?``:String(e)}var W8=new Map;function Ghe(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${U8(e.locale)}|${JSON.stringify(t)}`,r=W8.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=X3(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=X3(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=X3(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return W8.set(n,a),a}var Khe=Ghe;function qhe(e,t=!1){let{overflowY:n}=vg(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var G8=Symbol(`none`),K8={value:G8,index:-1};function Jhe(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u,onItemHighlighted:d,name:f,form:p,disabled:m=!1,readOnly:h=!1,required:g=!1,inputRef:_,grid:v=!1,items:y,filteredItems:b,filter:x,openOnInputClick:S=!0,autoHighlight:C=!1,keepHighlight:w=!1,highlightItemOnHover:T=!0,loopFocus:E=!0,itemToStringLabel:D,itemToStringValue:O,isItemEqualToValue:k=H3,virtualized:A=!1,inline:j=!1,fillInputOnItemPress:M=!0,modal:N=!1,limit:P=-1,autoComplete:F=`list`,formAutoComplete:I,locale:L,submitOnItemClick:R=!1}=e,{clearErrors:z}=e6(),{setDirty:B,validityData:V,setFilled:H,name:U,disabled:W,setTouched:G,setFocused:K,validationMode:q,validation:J}=R3(),ee=d6(),te=V3({id:t}),ne=Khe({locale:L}),[re,ie]=Y.useState(!1),[ae,oe]=Y.useState(null),se=Y.useRef([]),ce=Y.useRef([]),le=Y.useRef(null),ue=Y.useRef(null),de=Y.useRef(null),fe=Y.useRef(null),pe=Y.useRef(null),me=Y.useRef(!0),he=Y.useRef(!1),ge=Y.useRef(null),_e=Y.useRef(null),ve=Y.useRef(null),ye=Y.useRef(K8),be=Y.useRef(null),xe=Y.useRef([]),Se=Y.useRef(null),Ce=W||m,we=U??f,Te=u===`multiple`,Ee=u===`single`,De=s!==void 0||o!==void 0,Oe=y!==void 0,ke=b!==void 0,Ae;Ae=C===`always`?`always`:C?`input-change`:!1;let[je,Me]=A3({controlled:i,default:Te?r??i_:r,name:`Combobox`,state:`selectedValue`}),Ne=Y.useMemo(()=>x===null?()=>!0:x===void 0?Whe(ne,D):x,[x,ne,D]),Pe=Eg(()=>De?o??``:Ee?X3(je,D):``).current,[Fe,Ie]=A3({controlled:s,default:Pe,name:`Combobox`,state:`inputValue`}),[Le,Re]=A3({controlled:c,default:l,name:`Combobox`,state:`open`}),ze=J3(y),Be=ae??String(Fe).trim(),Ve=Ee?X3(je,D):``,He=Ee&&!re&&Be!==``&&Ve.length===Be.length&&ne.contains(Ve,Be),Ue=He?``:Be,We=Oe&&ke&&He,Ge=Y.useMemo(()=>y?ze?y.flatMap(e=>e.items):y:i_,[y,ze]),Ke=Y.useMemo(()=>{if(b&&!We)return b;if(!y)return i_;if(ze){let e=y,t=[],n=0;for(let r of e){if(P>-1&&n>=P)break;let e=P>-1?P-n:1/0,i=Ue===``?r.items.slice(0,e):[];if(Ue!==``)for(let t of r.items){if(i.length>=e)break;Ne(t,Ue,D)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Ue===``)return P>-1?Ge.slice(0,P):Ge;let e=[];for(let t of Ge){if(P>-1&&e.length>=P)break;Ne(t,Ue,D)&&e.push(t)}return e},[b,We,y,ze,Ue,P,Ne,D,Ge]),qe=Y.useMemo(()=>ze?Ke.flatMap(e=>e.items):Ke,[Ke,ze]),Je=Eg(()=>{let e=null;return j&&Le&&Oe&&u!==`none`&&(e=G3(qe,je,k,Te)),new dq({id:te,labelId:void 0,selectedValue:je,open:Le,items:y,selectionMode:u,listRef:se,labelsRef:ce,popupRef:le,emptyRef:pe,inputRef:ue,startDismissRef:de,endDismissRef:fe,keyboardActiveRef:me,chipsContainerRef:ge,clearRef:_e,valuesRef:xe,pointerDownItemRef:Se,selectionEventRef:ve,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,isItemEqualToValue:k,modal:N,autoHighlight:Ae,submitOnItemClick:R,hasInputValue:De,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:j,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:a_,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`,onOpenChangeComplete:r_,setOpen:r_,setInputValue:r_,setSelectedValue:r_,setIndices:r_,handleSelection:r_,forceMount:r_,requestSubmit:r_})}).current,Ye=u===`none`?Fe:je,Xe=Y.useMemo(()=>u===`none`?Ye:Array.isArray(je)?je.map(e=>Z3(e,O)):Z3(je,O),[Ye,O,u,je]),Ze=kg(d),Qe=kg(n),$e=$(Je,V8.activeIndex),et=$(Je,V8.selectedIndex),tt=$(Je,V8.positionerElement),nt=$(Je,V8.listElement),rt=$(Je,V8.triggerElement),it=$(Je,V8.inputElement),at=$(Je,V8.inputGroupElement),ot=$(Je,V8.inline),st=$(Je,V8.inputInsidePopup),ct=$(Je,V8.inputOwnsFormValue),lt=FU(rt),{mounted:ut,setMounted:dt,transitionStatus:ft}=gq(Le),{openMethod:pt,triggerProps:mt}=sY(Le),ht=kg(()=>Xe);z3(st?lt:ue,te,Ye,ht,!Ce,f);let gt=kg(()=>{y?ce.current=qe.map(e=>X3(e,D)):Je.set(`forceMounted`,!0)}),_t=kg((e,t,n)=>{if(t===-1){if(ye.current===K8)return;ye.current=K8}else ye.current={value:e,index:t};Ze(e,OH(n,void 0,{index:t}))}),vt=kg(e=>{Je.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?_t(void 0,-1,n):_t(xe.current[t],t,n)}),yt=kg((t,n)=>{if(he.current=n.reason===hH,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){Le&&ae!==null&&oe(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&ie(!0),be.current={hasQuery:e};let n=Je.state.listElement;if(!Je.state.virtualized&&n){let e=le.current;for(let t of Sg(n.firstElementChild??n)){if(!ag(t)||(e?!mU(e,t):t.getAttribute(`role`)===`dialog`))break;if(qhe(t)){t.scrollTop=0;break}}}e&&Ae&&Je.state.activeIndex==null&&(Le||ot)&&Je.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Je.state.inputInsidePopup&&(be.current={hasQuery:!1,selection:!0});Ie(t)}}),bt=kg((t,n)=>{if(Le!==t&&(n.reason===`escape-key`&&Oe&&qe.length===0&&!pe.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&st&&!ot&&ae!==null&&(ie(!1),oe(null),Fe!==``&&n.reason!==`input-change`&&yt(``,DH(hH,n.event))),!t&&re&&(Ee?(ot||oe(Be),Be===``&&ie(!1)):Te&&(ot||oe(Be),st&&vt({activeIndex:null}),(!st||ot)&&yt(``,DH(hH,n.event)))),Re(t),!t&&st&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(G(!0),K(!1),q===`onBlur`)))){let e=u===`none`?Fe:je;J.commit(e)}}),xt=kg((e,t)=>{a?.(e,t),!t.isCanceled&&(Me(e),(u===`none`&&le.current&&M||Ee&&!Je.state.inputInsidePopup)&&yt(X3(e,D),DH(t.reason,t.event)))}),St=kg((e,t)=>{let n=hU(e),r=ve.current??e;ve.current=null;let i=DH(fH,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&bt(!1,i);return}if(Te){let e=Array.isArray(je)?je:[],n=kpe(e,t,k)?K3(e,t,k):[...e,t];if(xt(n,i),i.isCanceled||!(ue.current&&ue.current.value.trim()!==``))return;Je.state.inputInsidePopup?yt(``,DH(hH,i.event)):bt(!1,i)}else{if(xt(t,i),i.isCanceled)return;bt(!1,i)}}),Ct=kg(()=>{let e=J.inputRef.current?.form??Je.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),wt=kg(()=>{if(dt(!1),Qe?.(!1),ie(!1),oe(null),vt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Te&&ue.current&&ue.current.value!==``&&!he.current&&yt(``,DH(hH)),Ee){if(Je.state.inputInsidePopup)ue.current&&ue.current.value!==``&&yt(``,DH(hH));else{let e=X3(je,D);ue.current&&ue.current.value!==e&&yt(e,DH(e===``?hH:sH))}}}),Tt=Y.useMemo(()=>ot&&tt?{current:tt.closest(`[role="dialog"]`)}:le,[ot,tt]);vq({enabled:!e.actionsRef,open:Le,ref:Tt,onComplete(){Le||wt()}}),Y.useImperativeHandle(e.actionsRef,()=>({unmount:wt}),[wt]),Mg(function(){if(Le||(Se.current=null,u===`none`))return;let e=Oe?Ge:xe.current;vt({selectedIndex:G3(e,je,k,Te)})},[Le,je,u,Te,Oe,Ge,k,vt]),Mg(()=>{y&&(xe.current=qe,se.current.length=qe.length)},[y,qe]),Mg(()=>{let e=be.current;if(e){let t=Le||ot||Je.state.positionerElement?.hidden===!1;if(e.hasQuery)Ae&&t&&Je.set(`activeIndex`,0),be.current=null;else if(String(Fe).trim()===``&&(be.current=null,t)){let t=e.selection;Ae===`always`&&!t&&Je.state.selectionMode===`none`&&Je.set(`activeIndex`,0),queueMicrotask(()=>{if(!Je.state.open&&!Je.state.inline||ue.current&&ue.current.value.trim()!==``)return;let e=Je.state.selectedValue,n=Je.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Je.state.selectionMode!==`none`&&r!=null;if(i||t){let t=Oe||ke?qe:xe.current;Je.set(`activeIndex`,i?G3(t,e,Je.state.isItemEqualToValue,n):null)}else Ae===`always`&&Je.set(`activeIndex`,0)})}}if(!Le&&!ot)return;let t=Oe||ke?qe:xe.current,n=Je.state.activeIndex;if(n==null){if(Ae===`always`&&t.length>0){Je.set(`activeIndex`,0);return}_t(void 0,-1,sH);return}if(n>=t.length){_t(void 0,-1,sH),Je.set(`activeIndex`,null);return}let r=t[n],i=ye.current.value,a=i!==G8&&U3(r,i,Je.state.isItemEqualToValue);(ye.current.index!==n||!a)&&_t(r,n,sH)},[$e,Ae,_t,ke,Oe,qe,ot,Le,Je,Fe]),Mg(()=>{if(u===`none`){H(String(Fe)!==``);return}H(Te?Array.isArray(je)&&je.length>0:je!=null)},[H,u,Fe,je,Te]),Y.useEffect(()=>{Oe&&Ae&&qe.length===0&&vt({activeIndex:null})},[Oe,Ae,qe.length,vt]);function Et(e){let t=V.initialValue;return Array.isArray(e)&&Array.isArray(t)?!t6(e,t,(e,t)=>U3(e,t,k)):e!==t}aY(Be,()=>{!Le||Be===``||Be===String(Pe)||ie(!0)});function Dt(){let e=X3(je,D);Fe!==e&&yt(e,DH(sH))}aY(je,()=>{u!==`none`&&(z(we),B(Et(je)),J.change(je),Ee&&!De&&!st&&Dt())}),aY(Fe,()=>{u===`none`&&(z(we),B(Fe!==V.initialValue),J.change(Fe))}),aY(y,()=>{!Ee||De||st||re||Dt()});let Ot=Uq({open:ot?!0:Le,onOpenChange:bt,elements:{reference:st?rt:it,floating:tt}}),kt=v?`grid`:`listbox`,At=Le||ot,jt=At?`true`:`false`,Mt=Y.useMemo(()=>{let e=it?.tagName===`INPUT`,t=it==null||e,n=t||At,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=jt,r[`aria-haspopup`]=kt,r[`aria-controls`]=At?nt?.id:void 0,r[`aria-autocomplete`]=F),{reference:r,floating:{role:`presentation`}}},[it,At,jt,kt,nt?.id,F]),Nt=UG(Ot,{enabled:!h&&!Ce&&S,event:`mousedown-only`,toggle:!1,touchOpenDelay:st?0:100,reason:gH}),Pt=YG(Ot,{enabled:!h&&!Ce&&!ot,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:ot?!0:void 0,outsidePress(e){let t=hU(e);return!mU(rt,t)&&!mU(_e.current,t)&&!mU(ge.current,t)&&!mU(at,t)}}),Ft=lJ(Ot,{enabled:!h&&!Ce,id:te,listRef:se,activeIndex:$e,selectedIndex:et,virtual:!0,loopFocus:E,allowEscape:E&&!Ae,focusItemOnOpen:re||u===`none`&&!Ae?!1:`auto`,focusItemOnHover:T,resetOnPointerLeave:!w,orientation:v?`horizontal`:void 0,rtl:ee===`rtl`,disabledIndices:i_,grid:v?Hhe:void 0,onNavigate(e,t){!t&&!Le||ft===`ending`||vt(t?{activeIndex:e,type:me.current?bH:xH}:{activeIndex:e})}}),It=Y.useMemo(()=>Fg(Ft.reference,{onKeyDown(e){v&&Je.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Pt.reference,Nt.reference,Mt.reference),[Ft.reference,Pt.reference,Nt.reference,Mt.reference,v,Je]),Lt=Y.useMemo(()=>Fg(yq,Pt.floating),[Pt.floating]),Rt=Y.useMemo(()=>Fg(Ft.floating,Mt.floating),[Ft.floating,Mt.floating]),zt=Y.useMemo(()=>{let e=Ft.item;return e?{...e,onFocus:void 0}:a_},[Ft.item]);O3(()=>{Je.update({inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,itemProps:zt,setOpen:bt,setInputValue:yt,setSelectedValue:xt,setIndices:vt,handleSelection:St,forceMount:gt,requestSubmit:Ct,onOpenChangeComplete:Qe})}),Mg(()=>{Je.update({id:te,selectedValue:je,open:Le,mounted:ut,transitionStatus:ft,items:y,inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,openMethod:pt,itemProps:zt,selectionMode:u,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,modal:N,autoHighlight:Ae,isItemEqualToValue:k,submitOnItemClick:R,hasInputValue:De,inputOwnsFormValue:u===`none`&&(j||!Je.state.inputInsidePopup)})},[Je,te,je,Le,ut,ft,y,Lt,Rt,It,zt,pt,mt,u,we,Ce,h,g,v,A,S,D,N,k,R,De,j,Ae,p]);let Bt=Qg(_,J.inputRef),Vt=Y.useMemo(()=>({query:Be,hasItems:Oe,filteredItems:Ke,flatFilteredItems:qe}),[Be,Oe,Ke,qe]),Ht=Y.useMemo(()=>Array.isArray(Ye)?``:Z3(Ye,O),[Ye,O]),Ut=Te&&Array.isArray(je)&&je.length>0,Wt=Te||u===`none`&&ct?void 0:we,Gt=Y.useMemo(()=>!Te||!Array.isArray(je)||!we?null:je.map(e=>{let t=Z3(e,O);return(0,X.jsx)(`input`,{type:`hidden`,form:p,name:we,value:t,disabled:Ce},t)}),[Te,je,p,we,O,Ce]),Kt=(0,X.jsxs)(Y.Fragment,{children:[e.children,(0,X.jsx)(`input`,{...J.getValidationProps(Ce,{onFocus(){if(st){rt?.focus();return}(ue.current||rt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ce||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=DH(sH,e.nativeEvent),i=()=>xe.current.findIndex(e=>Z3(e,O).toLowerCase()===n||X3(e,D).toLowerCase()===n);function a(){if(Te)return;if(u===`none`){yt(t,r);return}let e=i();e===-1&&(e=xe.current.findIndex((e,t)=>{let r=ce.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:xe.current[e];a!=null&&xt?.(a,r)}Ee&&(gt(),y&&i()===-1&&Je.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:te&&Wt==null?`${te}-hidden-input`:void 0,form:p,name:Wt,autoComplete:I,disabled:Ce,required:g&&!Ut,readOnly:h,value:Ht,ref:Bt,style:Wt?UU:HU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Gt]});return(0,X.jsx)(M8.Provider,{value:Je,children:(0,X.jsx)(N8.Provider,{value:Ot,children:(0,X.jsx)(F8.Provider,{value:Oe,children:(0,X.jsx)(P8.Provider,{value:Vt,children:(0,X.jsx)(I8.Provider,{value:Fe,children:Kt})})})})})}function Yhe(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,X.jsx)(Jhe,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var q8={...rH,...F3,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Xhe=Y.createContext(void 0);function Zhe(){return Y.useContext(Xhe)}var J8=Y.createContext(void 0);function Y8(e){let t=Y.useContext(J8);if(t===void 0&&!e)throw Error(Gg(21));return t}var X8=Y.forwardRef(function(e,t){let n=L8(),{buttonRef:r,getButtonProps:i}=Xg({native:!1}),a=Qg(t,r);function o(e){n.state.setOpen(!1,DH(pH,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,X.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:UU})});function Z8(e){let t=$(e,V8.mounted),n=$(e,V8.popupSide),r=$(e,V8.positionerElement);return t&&r?n:null}function Q8(){return z8().filteredItems.length===0}function Qhe(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function $he(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function $8(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}var ege=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:f,validation:p}=R3(),{labelId:m}=B3(),h=Zhe(),g=!!Y8(!0),_=L8(),v=B8(),y=d6(),b=$(_,V8.required),x=$(_,V8.disabled),S=$(_,V8.readOnly),C=$(_,V8.name),w=$(_,V8.form),T=$(_,V8.selectionMode),E=$(_,V8.autoHighlight),D=$(_,V8.inputProps),O=$(_,V8.triggerProps),k=$(_,V8.open),A=$(_,V8.mounted),j=$(_,V8.selectedValue),M=$(_,V8.id),N=$(_,V8.inline),P=$(_,V8.modal),F=!!E,I=Z8(_),L=l||x||i,R=Q8(),z=g||N,B=!z||P,V=PH(a??(z?void 0:M)),H=g?P3:c,[U,W]=Y.useState(null),G=Y.useRef(!1),K=Y.useRef(null),q=Y.useRef(!1),J=T===`none`&&!g,ee=kg(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.state.setInputValue(``,DH(sH)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:J})}),te=g?s:p.getValidationProps(L,s);function ne(){_.state.setIndices({activeIndex:null,selectedIndex:null,type:_.state.keyboardActiveRef.current?bH:xH})}function re(){_.state.keyboardActiveRef.current=!1}let ie={...H,open:k,disabled:L,readOnly:S,popupSide:I,listEmpty:R};function ae(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=Qhe(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=$he(n,j.length),ne()),t)}let oe=o_(`input`,e,{state:ie,ref:[t,_.state.inputRef,ee],props:[D,O,{value:U??v,"aria-readonly":S||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:L,readOnly:S,required:T===`none`?b:void 0,form:w,...J&&C&&{name:C},id:V,onFocus(){if(d(!0),!N||!q.current)return;q.current=!1;let e=K.current;e==null||!Object.hasOwn(_.state.valuesRef.current,e)||_.state.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=_.state.activeIndex;if(N&&e!==null&&E!==`always`&&(K.current=e,q.current=!0,_.state.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:j;p.commit(e)}},onCompositionStart(e){JH||(G.current=!0,W(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;W(null),_.state.setInputValue(t,DH(mH,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){S||L||!e||!i||(_.state.setOpen(!0,DH(mH,t)),F||ne())}if(G.current){let n=e.currentTarget.value;W(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.state.setOpen(!1,DH(hH,t));let r=n.trim(),i=F&&r!==``;a(r),k&&_.state.activeIndex!==null&&!i&&ne();return}let o=DH(mH,t);if(_.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=DH(hH,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.state.setSelectedValue(null,c),_.state.openOnInputClick||_.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),k&&_.state.activeIndex!==null&&!F&&ne()},onKeyDown(e){if(L||S||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;_.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){tU(e);let n=QH&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){tU(e);let i=QH&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!A&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=DH(vH,e.nativeEvent),r=T===`multiple`?[]:null;_.state.setInputValue(``,n),_.state.setSelectedValue(r,n),!t&&!_.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);ne(),_.state.setSelectedValue(r,DH(sH,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=ae(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.state.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&k){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(N)return;_.state.setOpen(!1,DH(sH,n));return}tU(e),$8(_,t,n)}},onPointerMove:re,onPointerDown:re},te],stateAttributesMapping:q8}),se=g?(0,X.jsx)(L3.Provider,{value:I3,children:oe}):oe;return(0,X.jsxs)(Y.Fragment,{children:[k&&B&&(0,X.jsx)(X8,{ref:_.state.startDismissRef}),se]})});function tge(e,t,n,r,i){if(e.baseUIHandlerPrevented||r)return;let a=hU(e.nativeEvent),o=ig(a)?a:null;o!==e.currentTarget&&(i?.(o)||bU(o))||(e.preventDefault(),!n&&(t.state.inputRef.current?.focus(),t.state.openOnInputClick&&t.state.setOpen(!0,DH(gH,e.nativeEvent))))}var nge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=R3(),s=L8(),c=$(s,V8.open),l=$(s,V8.disabled),u=$(s,V8.readOnly),d=$(s,V8.hasSelectedValue),f=$(s,V8.selectionMode),p=Z8(s),m=l,h=Q8(),g=f!==`none`&&!d,_={...o,open:c,disabled:m,readOnly:u,popupSide:p,listEmpty:h,placeholder:g};return o_(`div`,e,{ref:[t,kg(e=>{s.set(`inputGroupElement`,e)})],props:[{role:`group`,onMouseDown(e){tge(e,s,m,u,e=>mU(s.state.chipsContainerRef.current,e))}},a],state:_,stateAttributesMapping:q8})}),rge=Y.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=R3(),{labelId:h}=B3(),g=L8(),_=$(g,V8.selectionMode),v=$(g,V8.disabled),y=$(g,V8.readOnly),b=$(g,V8.required),x=$(g,V8.positionerElement),S=$(g,V8.listElement),C=$(g,V8.popupId),w=$(g,V8.triggerProps),T=$(g,V8.inputInsidePopup),E=$(g,V8.id),D=$(g,V8.labelId),O=$(g,V8.open),k=$(g,V8.selectedValue),A=$(g,V8.activeIndex),j=$(g,V8.selectedIndex),M=$(g,V8.hasSelectedValue),N=R8(),P=B8(),F=zH(),I=u||v||a,L=Q8(),R=Z8(g);V3({id:T?o:void 0});let z=T?o??E:o,B=a6(h,D),V;O&&T?V=C??H8(E):O&&(V=S?.id);let H=Y.useRef(``);function U(e){H.current=e.pointerType}let{reference:W}=uJ(N,{enabled:!O&&!y&&!v&&_===`single`,listRef:g.state.labelsRef,activeIndex:A,selectedIndex:j,onMatch(e){let t=g.state.valuesRef.current[e];t!==void 0&&g.state.setSelectedValue(t,DH(sH))}}),{reference:G}=UG(N,{enabled:!y&&!v,event:`mousedown`}),{buttonRef:K,getButtonProps:q}=Xg({native:i,disabled:I}),J={...l,open:O,disabled:I,popupSide:R,listEmpty:L,placeholder:_!==`none`&&!M};return o_(`button`,e,{ref:[t,K,kg(e=>{g.set(`triggerElement`,e)})],state:J,props:[w,G,W,{id:z,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":O,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":V,"aria-required":T&&b||void 0,"aria-labelledby":B,onPointerDown:U,onPointerEnter:U,onFocus(){f(!0),!(I||y)&&F.start(0,g.state.forceMount)},onBlur(e){if(!mU(x,e.relatedTarget)&&(d(!0),f(!1),p===`onBlur`)){let e=_===`none`?P:k;m.commit(e)}},onMouseDown(e){if(I||y||(T||N.set(`domReferenceElement`,e.currentTarget),g.state.forceMount(),H.current!==`touch`&&(g.state.inputRef.current?.focus(),T||e.preventDefault()),O))return;let t=Jg(e.currentTarget);function n(e){let t=g.state.triggerElement;if(!t)return;let n=hU(e),r=g.state.positionerElement,i=g.state.listElement;mU(t,n)||mU(r,n)||mU(i,n)||s6(e,t)||g.state.setOpen(!1,DH(SH,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){y||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(tU(e),g.state.setOpen(!0,DH(yH,e.nativeEvent)),g.state.inputRef.current?.focus())}},m.getValidationProps(I,c),q],stateAttributesMapping:q8})}),e5=Y.createContext(null);function ige(){return Y.useContext(e5)}function age(e){let{children:t,items:n}=e,r=Y.useMemo(()=>({items:n}),[n]);return(0,X.jsx)(e5.Provider,{value:r,children:t})}function t5(e){let{children:t}=e,{filteredItems:n}=z8(),r=ige(),i=r?r.items:n;return(0,X.jsx)(Y.Fragment,{children:i.map(t)})}var oge=Y.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=L8(),l=R8(),u=!!Y8(!0),{filteredItems:d,hasItems:f}=z8(),p=$(c,V8.selectionMode),m=$(c,V8.grid),h=$(c,V8.listProps),g=$(c,V8.virtualized),_=$(c,V8.forceMounted),v=p===`multiple`,y=d.length===0,b=kg(e=>{c.set(`positionerElement`,e)}),x=kg(e=>{c.set(`listElement`,e)}),S=Y.useMemo(()=>typeof o==`function`?n||=(0,X.jsx)(t5,{children:o}):o,[o]),C={empty:y},w=l.useState(`floatingId`),T=o_(`div`,e,{state:C,ref:[t,x,u?null:b],props:[h,{children:S,tabIndex:-1,id:w,role:m?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;tU(e),$8(c,t,e.nativeEvent)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});if(g)return T;let E=f&&!_?void 0:c.state.labelsRef;return(0,X.jsx)(l6,{elementsRef:c.state.listRef,labelsRef:E,children:T})}),sge=``;function cge(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function lge(){let e=zH(),t=Y.useRef(null);return Y.useEffect(()=>{if(KH)return;let n=t.current;if(n==null)return;let r=cge(n);if(r==null)return;let i=r.data,a=`${i}${sge}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var n5=Y.createContext(void 0);function uge(){let e=Y.useContext(n5);if(e===void 0)throw Error(Gg(20));return e}var dge=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=L8(),a=$(i,V8.mounted),o=$(i,V8.forceMounted);return a||n||o?(0,X.jsx)(n5.Provider,{value:n,children:(0,X.jsx)(CG,{ref:t,...r})}):null}),fge=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,v=L8(),y=R8(),b=uge(),x=$(v,V8.modal),S=$(v,V8.open),C=$(v,V8.mounted),w=$(v,V8.openMethod),T=$(v,V8.positionerElement),E=$(v,V8.triggerElement),D=$(v,V8.inputElement),O=$(v,V8.inputGroupElement),k=$(v,V8.inputInsidePopup),A=$(v,V8.transitionStatus),j=Q8(),M=g6({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});w6(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};Mg(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=kg(e=>{v.set(`positionerElement`,e)}),F=C6(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,X.jsxs)(J8.Provider,{value:M,children:[C&&x&&(0,X.jsx)(IJ,{inert:FJ(!S),cutout:O??D??E}),F]})}),pge={...iH,...XV},mge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=L8(),l=Y8(),u=R8(),d=$(c,V8.mounted),f=$(c,V8.open),p=$(c,V8.openMethod),m=$(c,V8.popupProps),h=$(c,V8.transitionStatus),g=$(c,V8.inputInsidePopup),_=$(c,V8.inputElement),v=$(c,V8.modal),y=$(c,V8.id),b=Q8(),x=s.id??(g?H8(y):void 0);Mg(()=>(c.set(`popupId`,c.state.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),vq({open:f,ref:c.state.popupRef,onComplete(){f&&c.state.onOpenChangeComplete(!0)}});let S=o_(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.state.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=hU(e.nativeEvent);p!==`touch`&&(mU(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},S6(h),s],stateAttributesMapping:pge}),C=a===void 0?g?e=>e===`touch`?c.state.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let T=!g||v;return(0,X.jsx)(HG,{context:u,disabled:!d,modal:T,openInteractionType:p,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,X.jsxs)(Y.Fragment,{children:[S,T&&(0,X.jsx)(X8,{ref:c.state.endDismissRef})]})})}),r5=Y.createContext(void 0);function hge(){let e=Y.useContext(r5);if(e===void 0)throw Error(Gg(18));return e}var gge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,[s,c]=Y.useState(),l=Y.useMemo(()=>({labelId:s,setLabelId:c,items:a}),[s,c,a]),u=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":s},o]}),d=(0,X.jsx)(r5.Provider,{value:l,children:u});return a?(0,X.jsx)(age,{items:a,children:d}):d}),_ge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=hge(),c=PH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),i5=Y.createContext(void 0);function a5(){let e=Y.useContext(i5);if(!e)throw Error(Gg(19));return e}var vge=Y.createContext(!1);function yge(){return Y.useContext(vge)}function o5(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Y.useRef(null),m=P6({guess:!0,index:l,textRef:p}),h=L8(),g=yge(),_=Uhe(),v=$(h,V8.selectionMode),y=$(h,V8.disabled),b=$(h,V8.readOnly),x=$(h,V8.isItemEqualToValue),S=y||u,C=v!==`none`,w=l??i??m.index,T=w!==-1,E=$(h,V8.id),D=$(h,V8.isActive,w),O=$(h,V8.isSelected,c),k=$(h,V8.itemProps),A=Y.useRef(null),j=E!=null&&T?`${E}-${w}`:void 0,M=O&&C;Mg(()=>{if(!(T&&(r||l!=null)))return;let e=h.state.listRef.current;return e[w]=A.current,()=>{delete e[w]}},[T,r,w,l,h]),Mg(()=>{if(!T||_)return;let e=h.state.valuesRef.current;return e[w]=c,()=>{delete e[w]}},[T,_,w,c,h]),Mg(()=>{if(!T||_)return;let e=h.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;U3(c,t,x)&&h.set(`selectedIndex`,w)},[T,_,h,w,c,x]);let{getButtonProps:N,buttonRef:P}=Xg({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:M,highlighted:D};function I(e){function t(){h.state.handleSelection(e,c)}h.state.submitOnItemClick?(Xi.flushSync(t),h.state.requestSubmit()):t()}let L={id:j,role:g?`gridcell`:`option`,"aria-selected":C?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||I(e.nativeEvent)},onMouseUp(e){let t=h.state.pointerDownItemRef.current===e.currentTarget;h.state.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!D)&&I(e.nativeEvent)}},R=o_(`div`,t,{ref:[P,n,m.ref,A],state:F,props:[k,L,f,N]}),z=Y.useMemo(()=>({selected:M,textRef:p}),[M,p]);return(0,X.jsx)(i5.Provider,{value:z,children:R})}function bge(e){let{componentProps:t,forwardedRef:n}=e,r=$(L8(),V8.isItemEqualToValue),{flatFilteredItems:i}=z8(),a=W3(i,t.value??null,r);return(0,X.jsx)(o5,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var xge=Y.memo(Y.forwardRef(function(e,t){let n=$(L8(),V8.virtualized);return n&&e.index==null?(0,X.jsx)(bge,{componentProps:e,forwardedRef:t}):(0,X.jsx)(o5,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),Sge=Y.forwardRef(function(e,t){let{selected:n}=a5();return e.keepMounted||n?(0,X.jsx)(Cge,{...e,ref:t}):null}),Cge=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=a5(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=gq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:XV});return vq({open:s,ref:c,onComplete(){s||u(!1)}}),d})),wge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=z8(),c=L8(),l=lge(),u=s.length===0?a:null;return o_(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function s5(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Yhe,{...e}),t[0]=e,t[1]=n),n}function c5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`relative flex w-full items-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nge,{className:i,"data-slot":`combobox-input-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function l5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent py-1 pr-16 pl-3 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ege,{className:i,"data-slot":`combobox-input`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Tge=`flex size-7 items-center justify-center rounded-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`;function u5(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Tge,`absolute right-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4 opacity-50`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(rge,{className:i,"data-slot":`combobox-trigger`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function d5(e){let t=(0,Z.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,side:a,sideOffset:o,align:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`bottom`:a,l=o===void 0?4:o,u=s===void 0?`start`:s,d;t[7]===r?d=t[8]:(d=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in`,r),t[7]=r,t[8]=d);let f;t[9]!==n||t[10]!==i||t[11]!==d?(f=(0,X.jsx)(mge,{className:d,"data-slot":`combobox-content`,...i,children:n}),t[9]=n,t[10]=i,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==c||t[15]!==l||t[16]!==f?(p=(0,X.jsx)(dge,{children:(0,X.jsx)(fge,{align:u,className:`isolate z-50 outline-none`,side:c,sideOffset:l,children:f})}),t[13]=u,t[14]=c,t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function f5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`max-h-64 overflow-y-auto overscroll-contain`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oge,{className:i,"data-slot":`combobox-list`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function p5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-3 text-muted-foreground text-xs empty:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(wge,{className:i,"data-slot":`combobox-empty`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function m5(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[6]=n,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Sge,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(qv,{className:`size-4`})}),t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(xge,{className:a,"data-slot":`combobox-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ege(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(gge,{"data-slot":`combobox-group`,...n}),t[2]=n,t[3]=r),r}function Dge(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(_ge,{className:i,"data-slot":`combobox-group-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Oge=t5;function kge(e){return{path:e,label:`${e} (Unavailable)`,type:`string`,sourceNodeId:``,sourceNodeLabel:`Unavailable`,sourceNodeLabels:[`Unavailable`]}}function Age(e){let t=new Map;for(let n of e){let e=t.get(n.sourceNodeLabel);e?e.push(n):t.set(n.sourceNodeLabel,[n])}return Array.from(t.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({value:e,items:t.toSorted((e,t)=>e.path.localeCompare(t.path))}))}function jge(e,t){let n=e.find(e=>e.path===t),r=Age(e);if(n)return{selected:n,groups:r};let i=kge(t);return{selected:i,groups:[{value:i.sourceNodeLabel,items:[i]},...r]}}function Mge(e,t){let n=t.trim().toLowerCase();return!n||[e.path,e.label,...e.sourceNodeLabels,...e.nullable?[`nullable`]:[]].some(e=>e.toLowerCase().includes(n))}function Nge(e,t){return e.path===t.path}function Pge(e){return e.label}function Fge(e){let t=(0,Z.c)(12),{fields:n,valuePath:r,onValueChange:i,disabled:a}=e,o;t[0]!==n||t[1]!==r?(o=jge(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let{selected:s,groups:c}=o,l;t[3]===i?l=t[4]:(l=e=>{e&&i(e)},t[3]=i,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsxs)(c5,{className:`min-w-[280px]`,children:[(0,X.jsx)(l5,{"aria-label":`Select field`,placeholder:`Select field`}),(0,X.jsx)(u5,{"aria-label":`Show the fields`})]}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(d5,{className:`w-max min-w-(--anchor-width)`,children:[(0,X.jsx)(p5,{children:`No field matches that.`}),(0,X.jsx)(f5,{children:Ige})]}),t[6]=d):d=t[6];let f;return t[7]!==a||t[8]!==c||t[9]!==s||t[10]!==l?(f=(0,X.jsxs)(s5,{disabled:a,filter:Mge,isItemEqualToValue:Nge,items:c,itemToStringLabel:Pge,onValueChange:l,value:s,children:[u,d]}),t[7]=a,t[8]=c,t[9]=s,t[10]=l,t[11]=f):f=t[11],f}function Ige(e){return(0,X.jsxs)(Ege,{items:e.items,children:[(0,X.jsx)(Dge,{children:e.value}),(0,X.jsx)(Oge,{children:t=>(0,X.jsx)(m5,{className:`items-start`,value:t,children:(0,X.jsxs)(`span`,{className:`flex w-full flex-col items-start`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.label,t.nullable&&(0,X.jsx)(`span`,{className:`rounded bg-muted px-1 py-0.5 font-normal text-xs text-muted-foreground leading-none`,children:`nullable`})]}),t.sourceNodeLabels.length>1&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Also from`,` `,t.sourceNodeLabels.filter(t=>t!==e.value).join(`, `)]})]})},t.path)})]},e.value)}function Lge(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Rge(e){return e===`before`||e===`after`}function zge(e){return e===`equals`||e===`not_equals`||e===`contains`}function Bge(e){return e===`equals`||e===`not_equals`||e===`greater_than`||e===`greater_or_equal`||e===`less_than`||e===`less_or_equal`}function Vge(e){return e===`is_true`||e===`is_false`}function Hge(e){return R2.some(t=>t.value===e)}function Uge(e,t){let n=t?Rde:[];return e===`timestamp`?[...Pde,...n]:e===`string`?[...Fde,...n]:e===`number`?[...Ide,...n]:[...Lde,...n]}function Wge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function Gge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}function Kge(e){return L2(e,{groupId:u0(),conditionId:u0()})}function h5(e){return I2(e,u0())}function qge(e){let{condition:t,operatorValue:n}=e;return Lge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,amount:N2(t)?t.amount:1,unit:N2(t)?t.unit:`days`}:Rge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,dateTime:P2(t)?t.dateTime:new Date().toISOString()}:null}function Jge(e){return e===`is_set`||e===`is_not_set`}function Yge(e,t){let n={id:e.id,field:e.field};if(Jge(t))return{...n,fieldType:e.fieldType,operator:t};if(e.fieldType===`timestamp`)return qge({condition:F2(e)?{...n,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e,operatorValue:t});if(e.fieldType===`string`){if(!zge(t))return null;let r=!F2(e)&&`value`in e?e.value:``;return{...n,fieldType:`string`,operator:t,value:r}}if(e.fieldType===`number`){if(!Bge(t))return null;let r=!F2(e)&&`value`in e?e.value:0;return{...n,fieldType:`number`,operator:t,value:r}}return Vge(t)?{...n,fieldType:`boolean`,operator:t}:null}function g5(e){let t=(0,Z.c)(6),{value:n,onChange:r,disabled:i}=e,a;t[0]!==i||t[1]!==r||t[2]!==n?(a=Nde.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{className:`rounded-full px-3 py-1 font-medium text-xs transition-colors ${t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,disabled:i,onClick:()=>r(e.value),type:`button`,children:e.label},e.value)}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`div`,{className:`inline-flex items-center rounded-full border bg-card p-0.5`,children:a}),t[4]=a,t[5]=o),o}function Xge(e){let t=(0,Z.c)(56),{condition:n,disabled:r,currentNodeId:i,enumValues:a,onConditionChange:o}=e;if(F2(n))return null;if(n.fieldType===`timestamp`){if(N2(n)){let e;t[0]!==n||t[1]!==o?(e=e=>{let t=Number.parseInt(e.target.value,10);o({...n,amount:Number.isNaN(t)?1:Math.max(t,1)})},t[0]=n,t[1]=o,t[2]=e):e=t[2];let i;t[3]!==n.amount||t[4]!==r||t[5]!==e?(i=(0,X.jsx)(wX,{className:`w-24`,disabled:r,min:1,onChange:e,type:`number`,value:n.amount}),t[3]=n.amount,t[4]=r,t[5]=e,t[6]=i):i=t[6];let a;t[7]!==n||t[8]!==o?(a=H6(e=>{Hge(e)&&o({...n,unit:e})}),t[7]=n,t[8]=o,t[9]=a):a=t[9];let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(W6,{className:`w-36`,children:(0,X.jsx)(U6,{})}),t[10]=s):s=t[10];let c;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(G6,{children:R2.map(Qge)}),t[11]=c):c=t[11];let l;t[12]!==n.unit||t[13]!==r||t[14]!==a?(l=(0,X.jsxs)(V6,{disabled:r,onValueChange:a,value:n.unit,children:[s,c]}),t[12]=n.unit,t[13]=r,t[14]=a,t[15]=l):l=t[15];let u;return t[16]!==i||t[17]!==l?(u=(0,X.jsxs)(X.Fragment,{children:[i,l]}),t[16]=i,t[17]=l,t[18]=u):u=t[18],u}let e;t[19]!==n||t[20]!==o?(e=e=>{P2(n)&&o({...n,dateTime:Gge(e.target.value)})},t[19]=n,t[20]=o,t[21]=e):e=t[21];let i;t[22]===n?i=t[23]:(i=P2(n)?Wge(n.dateTime):``,t[22]=n,t[23]=i);let a;return t[24]!==r||t[25]!==e||t[26]!==i?(a=(0,X.jsx)(wX,{disabled:r,onChange:e,type:`datetime-local`,value:i}),t[24]=r,t[25]=e,t[26]=i,t[27]=a):a=t[27],a}if(n.fieldType===`string`){if(a&&a.length>0&&(n.operator===`equals`||n.operator===`not_equals`)){let e;t[28]!==n||t[29]!==o?(e=H6(e=>{o({...n,value:e})}),t[28]=n,t[29]=o,t[30]=e):e=t[30];let i=a.includes(n.value)?n.value:null,s;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(W6,{className:`min-w-[240px]`,children:(0,X.jsx)(U6,{placeholder:`Select value`})}),t[31]=s):s=t[31];let c;t[32]===a?c=t[33]:(c=a.map(Zge),t[32]=a,t[33]=c);let l;t[34]===c?l=t[35]:(l=(0,X.jsx)(G6,{children:c}),t[34]=c,t[35]=l);let u;return t[36]!==r||t[37]!==e||t[38]!==i||t[39]!==l?(u=(0,X.jsxs)(V6,{disabled:r,onValueChange:e,value:i,children:[s,l]}),t[36]=r,t[37]=e,t[38]=i,t[39]=l,t[40]=u):u=t[40],u}let e;t[41]!==n||t[42]!==o?(e=e=>{o({...n,value:e})},t[41]=n,t[42]=o,t[43]=e):e=t[43];let s;return t[44]!==n.value||t[45]!==i||t[46]!==r||t[47]!==e?(s=(0,X.jsx)(g8,{className:`min-w-[240px]`,currentNodeId:i,disabled:r,onChange:e,placeholder:`value`,value:n.value}),t[44]=n.value,t[45]=i,t[46]=r,t[47]=e,t[48]=s):s=t[48],s}if(n.fieldType===`number`){let e;t[49]!==n||t[50]!==o?(e=e=>{let t=Number.parseFloat(e.target.value);o({...n,value:Number.isNaN(t)?0:t})},t[49]=n,t[50]=o,t[51]=e):e=t[51];let i=String(n.value),a;return t[52]!==r||t[53]!==e||t[54]!==i?(a=(0,X.jsx)(wX,{disabled:r,onChange:e,placeholder:`0`,type:`number`,value:i}),t[52]=r,t[53]=e,t[54]=i,t[55]=a):a=t[55],a}return null}function Zge(e){return(0,X.jsx)(K6,{value:e,children:e},e)}function Qge(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}function _5(e){let t=(0,Z.c)(58),{label:n,description:r,fields:i,emptyFieldsMessage:a,value:o,onChange:s,currentNodeId:c,disabled:l}=e,u=i[0]??null,d;t[0]===i?d=t[1]:(d=new Map(i.map(e_e)),t[0]=i,t[1]=d);let f=d,p,m,h,g,_,v,y;if(t[2]!==i||t[3]!==c||t[4]!==r||t[5]!==l||t[6]!==a||t[7]!==f||t[8]!==n||t[9]!==s||t[10]!==u||t[11]!==o){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=o.trim(),d=e4(e),b=d.valid?d.model:null,x;t[19]===s?x=t[20]:(x=e=>{let t=a4(e);s({model:t4(e),expression:t.valid?t.expression:``})},t[19]=s,t[20]=x);let S=x,C;t[21]!==S||t[22]!==u?(C=()=>{u&&S(Kge(u))},t[21]=S,t[22]=u,t[23]=C):C=t[23];let w=C,T=b?Mde(b,f):null;m=T?a4(T):null;let E=(e,t)=>{T&&S({...T,groups:T.groups.map(n=>n.id===e?t(n):n)})},D=(e,t,n)=>{E(e,e=>({...e,conditions:e.conditions.map(e=>e.id===t?n(e):e)}))},O=e=>{T&&u&&E(e,e=>({...e,conditions:[...e.conditions,h5(u)]}))},k=(e,t)=>{T&&E(e,e=>e.conditions.length<=1?e:{...e,conditions:e.conditions.filter(e=>e.id!==t)})};p=()=>{T&&u&&S({...T,groups:[...T.groups,{id:u0(),logic:`and`,conditions:[h5(u)]}]})};let A=e=>{!T||T.groups.length<=1||S({...T,groups:T.groups.filter(t=>t.id!==e)})};if(!T){let o;t[24]===n?o=t[25]:(o=(0,X.jsx)(TX,{className:`text-sm`,children:n}),t[24]=n,t[25]=o);let s;t[26]===r?s=t[27]:(s=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[26]=r,t[27]=s);let c;t[28]!==w||t[29]!==i.length||t[30]!==l||t[31]!==a?(c=i.length>0?(0,X.jsx)(zv,{disabled:l,onClick:w,size:`sm`,type:`button`,variant:`outline`,children:`Configure condition`}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[28]=w,t[29]=i.length,t[30]=l,t[31]=a,t[32]=c):c=t[32],y=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border bg-muted/30 p-3`,children:[o,s,c,e&&!d.valid&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:d.error})]});break bb0}_=`space-y-3 rounded-md border bg-muted/30 p-3`;let j;t[33]===n?j=t[34]:(j=(0,X.jsx)(TX,{className:`text-sm`,children:n}),t[33]=n,t[34]=j);let M;t[35]===r?M=t[36]:(M=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[35]=r,t[36]=M),t[37]!==M||t[38]!==j?(v=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[j,M]}),t[37]=M,t[38]=j,t[39]=v):v=t[39],h=`space-y-3`,g=T.groups.map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-muted px-2 py-1 font-medium text-xs`,children:t+1}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Filter group`}),(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[e.conditions.length,` `,e.conditions.length===1?`condition`:`conditions`]})]}),(0,X.jsx)(zv,{disabled:l||T.groups.length<=1,onClick:()=>A(e.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),(0,X.jsxs)(`div`,{className:`space-y-3 p-3`,children:[e.conditions.map((t,n)=>{let r=f.get(t.field),a=Uge(t.fieldType,r?.nullable),o=e.conditions.length>1;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Fge,{disabled:l||i.length===0,fields:i,onValueChange:n=>{n.path!==t.field&&D(e.id,t.id,e=>I2(n,e.id))},valuePath:t.field}),(0,X.jsxs)(V6,{disabled:l,onValueChange:H6(n=>{let r=Yge(t,n);r&&D(e.id,t.id,()=>r)}),value:t.operator,children:[(0,X.jsx)(W6,{className:`min-w-[190px]`,children:(0,X.jsx)(U6,{placeholder:`Select operator`})}),(0,X.jsx)(G6,{children:a.map($ge)})]}),(0,X.jsx)(Xge,{condition:t,currentNodeId:c,disabled:l,enumValues:r?.enumValues,onConditionChange:n=>{D(e.id,t.id,()=>n)}}),(0,X.jsx)(zv,{disabled:l||!o,onClick:()=>k(e.id,t.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),n<e.conditions.length-1&&(0,X.jsx)(`div`,{className:`py-2 pl-2`,children:(0,X.jsx)(g5,{disabled:l,onChange:t=>{E(e.id,e=>({...e,logic:t}))},value:e.logic})})]},t.id)}),(0,X.jsxs)(zv,{disabled:l||!u,onClick:()=>O(e.id),size:`sm`,type:`button`,variant:`ghost`,children:[(0,X.jsx)(cy,{className:`size-4`}),`Add condition`]})]})]}),t<T.groups.length-1&&(0,X.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,X.jsx)(g5,{disabled:l,onChange:e=>{S({...T,groupLogic:e})},value:T.groupLogic})})]},e.id))}t[2]=i,t[3]=c,t[4]=r,t[5]=l,t[6]=a,t[7]=f,t[8]=n,t[9]=s,t[10]=u,t[11]=o,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y}else p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;t[40]!==h||t[41]!==g?(b=(0,X.jsx)(`div`,{className:h,children:g}),t[40]=h,t[41]=g,t[42]=b):b=t[42];let x=l||!u,S;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(cy,{className:`size-4`}),t[43]=S):S=t[43];let C;t[44]!==p||t[45]!==x?(C=(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsxs)(zv,{disabled:x,onClick:p,size:`sm`,type:`button`,variant:`outline`,children:[S,`Add group`]})}),t[44]=p,t[45]=x,t[46]=C):C=t[46];let w;t[47]===m?w=t[48]:(w=m?.valid===!1&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:m.error}),t[47]=m,t[48]=w);let T;t[49]===m?T=t[50]:(T=m?.valid&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Compiled CEL: `,m.expression]}),t[49]=m,t[50]=T);let E;return t[51]!==C||t[52]!==w||t[53]!==T||t[54]!==_||t[55]!==v||t[56]!==b?(E=(0,X.jsxs)(`div`,{className:_,children:[v,b,C,w,T]}),t[51]=C,t[52]=w,t[53]=T,t[54]=_,t[55]=v,t[56]=b,t[57]=E):E=t[57],E}function $ge(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}function e_e(e){return[e.path,e]}function v5(e){let t=(0,Z.c)(18),{children:n,className:r,title:i,variant:a}=e;if((a===void 0?`box`:a)===`text`){let e;t[0]===r?e=t[1]:(e=Q(`text-warning text-xs`,r),t[0]=r,t[1]=e);let i;return t[2]!==n||t[3]!==e?(i=(0,X.jsx)(`p`,{className:e,children:n}),t[2]=n,t[3]=e,t[4]=i):i=t[4],i}let o;t[5]===r?o=t[6]:(o=Q(`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/10 p-2`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(py,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),t[7]=s):s=t[7];let c;t[8]===i?c=t[9]:(c=i?(0,X.jsx)(`p`,{className:`font-medium text-warning text-xs`,children:i}):null,t[8]=i,t[9]=c);let l;t[10]===n?l=t[11]:(l=(0,X.jsx)(`p`,{className:`text-warning text-xs`,children:n}),t[10]=n,t[11]=l);let u;t[12]!==c||t[13]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;return t[15]!==o||t[16]!==u?(d=(0,X.jsxs)(`div`,{className:o,children:[s,u]}),t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function t_e(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function n_e(e,t){return e.name===t.name}function r_e(e){let t=(0,Z.c)(9),{inputId:n,placeholder:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,X.jsx)(l5,{id:n,placeholder:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(u5,{"aria-label":`Show the Events`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,X.jsxs)(c5,{children:[i,a]}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(d5,{children:[(0,X.jsx)(p5,{children:`No Event matches that.`}),(0,X.jsx)(f5,{children:i_e})]}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,X.jsxs)(X.Fragment,{children:[o,s]}),t[7]=o,t[8]=c),c}function i_e(e){return(0,X.jsxs)(m5,{value:e,children:[(0,X.jsx)(`span`,{className:`block truncate`,children:e.label}),e.label===e.name?null:(0,X.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.name})]},e.name)}function y5(e){let t=(0,Z.c)(16),{choices:n,value:r,onValueChange:i,disabled:a,inputId:o,placeholder:s}=e,c=s===void 0?`Search Events`:s,l;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>n.find(t=>t.name===e)??[],t[3]=n,t[4]=e),l=r.flatMap(e),t[0]=n,t[1]=r,t[2]=l}else l=t[2];let u=l,d;t[5]===i?d=t[6]:(d=e=>i(e.map(a_e)),t[5]=i,t[6]=d);let f;t[7]!==o||t[8]!==c?(f=(0,X.jsx)(r_e,{inputId:o,placeholder:c}),t[7]=o,t[8]=c,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,X.jsx)(s5,{disabled:a,filter:t_e,isItemEqualToValue:n_e,items:n,itemToStringLabel:o_e,multiple:!0,onValueChange:d,value:u,children:f}),t[10]=n,t[11]=a,t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function a_e(e){return e.name}function o_e(e){return e.label}function s_e(e){let t=(0,Z.c)(30),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=d4(n),s=yy(),c=o.map(c_e),l;t[0]===r?l=t[1]:(l=e=>{r({waitFor:e})},t[0]=r,t[1]=l);let u=l,d;t[2]!==o||t[3]!==u?(d=e=>{u(e.map(e=>o.find(t=>t.event===e)??{event:e}))},t[2]=o,t[3]=u,t[4]=d):d=t[4];let f=d,p;t[5]!==o||t[6]!==u?(p=e=>{u(o.filter(t=>t.event!==e))},t[5]=o,t[6]=u,t[7]=p):p=t[7];let m=p,h;t[8]!==o||t[9]!==u?(h=(e,t)=>{u(o.map(n=>n.event===e?{event:n.event,...t?{match:t}:{}}:n))},t[8]=o,t[9]=u,t[10]=h):h=t[10];let g=h,_;t[11]===a?_=t[12]:(_=(0,X.jsx)(TX,{htmlFor:a,children:`Resume when the event is`}),t[11]=a,t[12]=_);let v;t[13]!==s.events||t[14]!==i||t[15]!==a||t[16]!==c||t[17]!==f?(v=s.events.length>0?(0,X.jsx)(y5,{choices:s.events,disabled:i,inputId:a,onValueChange:f,value:c}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This server declares no Events, so there is nothing for a wait to park on. Ask whoever runs it to declare the Event.`}),t[13]=s.events,t[14]=i,t[15]=a,t[16]=c,t[17]=f,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==m||t[24]!==o||t[25]!==g?(b=o.length===0?(0,X.jsx)(v5,{children:`Name at least one event. A wait with none cannot be resumed by anything, and the workflow will not save.`}):o.map(e=>(0,X.jsx)(l_e,{disabled:i,onMatchChange:g,onRemove:m,subscription:e},e.event)),t[22]=i,t[23]=m,t[24]=o,t[25]=g,t[26]=b):b=t[26];let x;return t[27]!==y||t[28]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[y,b]}),t[27]=y,t[28]=b,t[29]=x):x=t[29],x}function c_e(e){return e.event}function l_e(e){let t=(0,Z.c)(59),{subscription:n,onMatchChange:r,onRemove:i,disabled:a}=e,o=wA(H4),s=wA(Q4),c=yy(),l;t[0]!==c||t[1]!==n.event?(l=Ny(c,n.event),t[0]=c,t[1]=n.event,t[2]=l):l=t[2];let u=l,d;t[3]===s?d=t[4]:(d=s.filter(f_e).map(d_e).find(u_e),t[3]=s,t[4]=d);let f=d,p;t[5]!==c||t[6]!==n.event?(p=Wme(c,n.event),t[5]=c,t[6]=n.event,t[7]=p):p=t[7];let m=p,h;t[8]!==r||t[9]!==n.event?(h=e=>{r(n.event,e.model)},t[8]=r,t[9]=n.event,t[10]=h):h=t[10];let g=h,_;t[11]!==r||t[12]!==n.event?(_=()=>{r(n.event,``)},t[11]=r,t[12]=n.event,t[13]=_):_=t[13];let v=_,y;t[14]!==f||t[15]!==u?.correlationPath||t[16]!==n.event?(y=()=>f?T1({rules:f,eventName:n.event,declaredPath:u?.correlationPath}):u?.correlationPath,t[14]=f,t[15]=u?.correlationPath,t[16]=n.event,t[17]=y):y=t[17],u?.correlationPath;let b;t[18]===y?b=t[19]:(b=y(),t[18]=y,t[19]=b);let x=b,S;t[20]!==m||t[21]!==r||t[22]!==x||t[23]!==n.event?(S=()=>{let e=m.find(e=>e.path===x)??m[0];e&&r(n.event,t4(L2(e,{groupId:`${n.event}-group`,conditionId:`${n.event}-rule`})))},t[20]=m,t[21]=r,t[22]=x,t[23]=n.event,t[24]=S):S=t[24];let C=S,w;t[25]===u?w=t[26]:(w=u?(0,X.jsx)(`p`,{className:`truncate text-xs`,children:u.label}):null,t[25]=u,t[26]=w);let T;t[27]===n.event?T=t[28]:(T=(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:n.event}),t[27]=n.event,t[28]=T);let E;t[29]===u?E=t[30]:(E=u?null:(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:`This app no longer declares this Event; the workflow will not save until it is removed or declared again.`}),t[29]=u,t[30]=E);let D;t[31]!==n.event||t[32]!==T||t[33]!==E||t[34]!==w?(D=(0,X.jsxs)(`div`,{className:`min-w-0`,title:n.event,children:[w,T,E]}),t[31]=n.event,t[32]=T,t[33]=E,t[34]=w,t[35]=D):D=t[35];let O=`Remove ${n.event}`,k;t[36]!==i||t[37]!==n.event?(k=()=>i(n.event),t[36]=i,t[37]=n.event,t[38]=k):k=t[38];let A;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(hy,{className:`size-3.5`}),t[39]=A):A=t[39];let j;t[40]!==a||t[41]!==O||t[42]!==k?(j=(0,X.jsx)(zv,{"aria-label":O,className:`size-7 shrink-0`,disabled:a,onClick:k,size:`icon`,type:`button`,variant:`ghost`,children:A}),t[40]=a,t[41]=O,t[42]=k,t[43]=j):j=t[43];let M;t[44]!==D||t[45]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[D,j]}),t[44]=D,t[45]=j,t[46]=M):M=t[46];let N;t[47]!==a||t[48]!==m||t[49]!==g||t[50]!==v||t[51]!==C||t[52]!==o||t[53]!==n.event||t[54]!==n.match?(N=n.match?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_5,{currentNodeId:o??void 0,description:`Only an arrival satisfying this resumes the run. Compare a payload field against a literal, or against a value from this run.`,disabled:a,emptyFieldsMessage:`This Event declares no fields, so there is nothing to match on.`,fields:m,label:`Match`,onChange:g,value:n.match}),(0,X.jsxs)(zv,{disabled:a,onClick:v,size:`sm`,type:`button`,variant:`ghost`,children:[`Resume on any `,n.event]})]}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Any `,n.event,` resumes this run, whatever it carries.`]}),(0,X.jsx)(zv,{disabled:a||m.length===0,onClick:C,size:`sm`,type:`button`,variant:`outline`,children:`Add a match`})]}),t[47]=a,t[48]=m,t[49]=g,t[50]=v,t[51]=C,t[52]=o,t[53]=n.event,t[54]=n.match,t[55]=N):N=t[55];let P;return t[56]!==M||t[57]!==N?(P=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[M,N]}),t[56]=M,t[57]=N,t[58]=P):P=t[58],P}function u_e(e){return e!==void 0}function d_e(e){return C1(e.data.config)}function f_e(e){return e.data.type===`lifecycle`}function b5(e){let t=(0,Z.c)(5),{logoUrl:n,label:r,fallback:i}=e,a;t[0]===n?a=t[1]:(a=n?.trim(),t[0]=n,t[1]=a);let o=a;if(!o)return i;let s=`${r} logo`,c;return t[2]!==o||t[3]!==s?(c=(0,X.jsx)(`img`,{alt:s,className:`size-4 rounded-sm object-contain`,height:16,loading:`lazy`,src:o,width:16}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}function p_e(e){let t=(0,Z.c)(15),{config:n,onUpdateConfig:r,disabled:i}=e,a=wA(H4),o=wA(Q4),s=wA($4),c=yy(),l=a??void 0,u;t[0]!==c||t[1]!==s||t[2]!==o||t[3]!==l?(u=o8({currentNodeId:l,nodes:o,edges:s,catalog:c}),t[0]=c,t[1]=s,t[2]=o,t[3]=l,t[4]=u):u=t[4];let d=u,f;t[5]===r?f=t[6]:(f=e=>{r({conditionModel:e.model,condition:e.expression})},t[5]=r,t[6]=f);let p=f,m=a??void 0,h;t[7]===n?h=t[8]:(h=_0(n,`conditionModel`)??``,t[7]=n,t[8]=h);let g;return t[9]!==i||t[10]!==d||t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,X.jsx)(_5,{currentNodeId:m,description:`Build a condition from the Lifecycle Node and upstream action output fields. Timestamp fields support relative and absolute time filters.`,disabled:i,emptyFieldsMessage:`No upstream fields available. Connect this node to the Lifecycle Node or an action with typed outputs first.`,fields:d,label:`Condition`,onChange:p,value:h}),t[9]=i,t[10]=d,t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function m_e(){let e=(0,Z.c)(3),t=k8(wA(H4)),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Splits On Event`}),e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[n,t.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No Event reaches this node yet. Connect it below the Lifecycle Node, and it draws one outlet per Start Event.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ul`,{className:`space-y-1`,children:t.map(h_e)}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A run leaves by the outlet naming the Event it arrived on. An outlet with nothing connected ends the run there.`})]})]}),e[1]=t,e[2]=r),r}function h_e(e){return(0,X.jsxs)(`li`,{className:`text-sm`,children:[e.label,(0,X.jsx)(`span`,{className:`ml-2 text-muted-foreground text-xs`,children:e.name})]},e.name)}function g_e(e){let t=(0,Z.c)(87),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=v0(n,`waitGateMode`,`off`),t[0]=n,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=_0(n,`waitUntil`),t[2]=n,t[3]=s);let c=s,l;t[4]===n?l=t[5]:(l=_0(n,`waitDuration`),t[4]=n,t[5]=l);let u=l,d;t[6]===n?d=t[7]:(d=l4(n),t[6]=n,t[7]=d);let f=d,p;t[8]===n?p=t[9]:(p=_0(n,`waitAllowedHoursMode`),t[8]=n,t[9]=p);let m=p===`daily_window`,h;t[10]!==n||t[11]!==r?(h=e=>{let t={...n,waitDelayTimingMode:e},i=Object.fromEntries(u4(t).map(__e));r({...i,waitDelayTimingMode:e})},t[10]=n,t[11]=r,t[12]=h):h=t[12];let g=h,_;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Time-Based Wait`}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(TX,{htmlFor:`waitDelayTimingMode`,children:`Time input mode`}),t[14]=v):v=t[14];let y;t[15]===g?y=t[16]:(y=H6(g),t[15]=g,t[16]=y);let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(W6,{className:`w-full`,id:`waitDelayTimingMode`,children:(0,X.jsx)(U6,{placeholder:`Select time input mode`})}),t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`duration`,children:`Wait for duration`}),(0,X.jsx)(K6,{value:`until`,children:`Wait until date/time`})]}),t[18]=x):x=t[18];let S;t[19]!==f||t[20]!==i||t[21]!==y?(S=(0,X.jsxs)(V6,{disabled:i,onValueChange:y,value:f,children:[b,x]}),t[19]=f,t[20]=i,t[21]=y,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Pick one mode. Switching modes clears fields that do not apply.`}),t[23]=C):C=t[23];let w;t[24]===S?w=t[25]:(w=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[v,S,C]}),t[24]=S,t[25]=w);let T;t[26]!==n||t[27]!==u||t[28]!==c||t[29]!==f||t[30]!==i||t[31]!==r?(T=f===`duration`?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitDuration`,children:`Wait for (duration)`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitDuration.type,id:`waitDuration`,onChange:e=>r({waitDuration:e}),placeholder:`24h, 90m, 3600000, or P1D`,value:u}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: use `,(0,X.jsx)(`code`,{children:`24h`}),` to continue one day later.`]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitUntil`,children:`Wait until this date/time`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitUntil.type,id:`waitUntil`,onChange:e=>r({waitUntil:e}),placeholder:`2026-03-10T09:00:00-05:00 or {{@lifecycle_1:Lifecycle.appointment.startsAt}}`,value:c}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Use this when timing comes from payload data, like an appointment start time.`})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitOffset`,children:`Send before/after that time (optional)`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitOffset.type,id:`waitOffset`,onChange:e=>r({waitOffset:e}),placeholder:`-1d, 6h, 30m`,value:_0(n,`waitOffset`)}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: `,(0,X.jsx)(`code`,{children:`-1d`}),` sends one day before the target time.`]})]})]}),t[26]=n,t[27]=u,t[28]=c,t[29]=f,t[30]=i,t[31]=r,t[32]=T):T=t[32];let E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(TX,{htmlFor:`waitGateMode`,children:`Continue only if time actually elapsed`}),t[33]=E):E=t[33];let D;t[34]===r?D=t[35]:(D=e=>r({waitGateMode:e}),t[34]=r,t[35]=D);let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(W6,{className:`w-full`,id:`waitGateMode`,children:(0,X.jsx)(U6,{placeholder:`Select behavior`})}),t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`off`,children:`Off (continue immediately)`}),(0,X.jsx)(K6,{value:`require_actual_wait`,children:`Skip branch when already due`})]}),t[37]=k):k=t[37];let A;t[38]!==i||t[39]!==D||t[40]!==o?(A=(0,X.jsxs)(V6,{disabled:i,onValueChange:D,value:o,children:[O,k]}),t[38]=i,t[39]=D,t[40]=o,t[41]=A):A=t[41];let j;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Prevents immediate sends when the computed time is now or in the past after an update/reschedule.`}),t[42]=j):j=t[42];let M;t[43]===A?M=t[44]:(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[E,A,j]}),t[43]=A,t[44]=M);let N;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(TX,{htmlFor:`waitAllowedHoursMode`,children:`Allowed send window`}),t[45]=N):N=t[45];let P;t[46]===r?P=t[47]:(P=e=>r({waitAllowedHoursMode:e}),t[46]=r,t[47]=P);let F;t[48]===n?F=t[49]:(F=v0(n,`waitAllowedHoursMode`,`off`),t[48]=n,t[49]=F);let I;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(W6,{className:`w-full`,id:`waitAllowedHoursMode`,children:(0,X.jsx)(U6,{placeholder:`Select window mode`})}),t[50]=I):I=t[50];let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`off`,children:`Off (allow any time)`}),(0,X.jsx)(K6,{value:`daily_window`,children:`Daily window`})]}),t[51]=L):L=t[51];let R;t[52]!==i||t[53]!==P||t[54]!==F?(R=(0,X.jsxs)(V6,{disabled:i,onValueChange:P,value:F,children:[I,L]}),t[52]=i,t[53]=P,t[54]=F,t[55]=R):R=t[55];let z;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`When enabled, times outside the window shift to the next allowed start.`}),t[56]=z):z=t[56];let B;t[57]===R?B=t[58]:(B=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,R,z]}),t[57]=R,t[58]=B);let V;t[59]!==n||t[60]!==i||t[61]!==m||t[62]!==r?(V=m&&(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitAllowedStartTime`,children:`Window start`}),(0,X.jsx)(wX,{disabled:i,id:`waitAllowedStartTime`,onChange:e=>r({waitAllowedStartTime:e.target.value}),placeholder:`09:00`,value:_0(n,`waitAllowedStartTime`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitAllowedEndTime`,children:`Window end`}),(0,X.jsx)(wX,{disabled:i,id:`waitAllowedEndTime`,onChange:e=>r({waitAllowedEndTime:e.target.value}),placeholder:`17:00`,value:_0(n,`waitAllowedEndTime`)})]}),(0,X.jsx)(`p`,{className:`col-span-2 text-muted-foreground text-xs`,children:`Use 24-hour format (HH:MM). Start must be before end. Requires timezone below.`})]}),t[59]=n,t[60]=i,t[61]=m,t[62]=r,t[63]=V):V=t[63];let H=m?` (required for send window)`:` (optional)`,U;t[64]===H?U=t[65]:(U=(0,X.jsxs)(TX,{htmlFor:`waitTimezone`,children:[`Timezone`,H]}),t[64]=H,t[65]=U);let W;t[66]===r?W=t[67]:(W=e=>r({waitTimezone:e}),t[66]=r,t[67]=W);let G;t[68]===n?G=t[69]:(G=v0(n,`waitTimezone`,`UTC`),t[68]=n,t[69]=G);let K;t[70]!==i||t[71]!==W||t[72]!==G?(K=(0,X.jsx)(ahe,{disabled:i,id:`waitTimezone`,onValueChange:W,value:G}),t[70]=i,t[71]=W,t[72]=G,t[73]=K):K=t[73];let q=m&&` Also determines when the daily send window applies.`,J;t[74]===q?J=t[75]:(J=(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Used when the target date/time does not include an offset.`,q]}),t[74]=q,t[75]=J);let ee;t[76]!==U||t[77]!==K||t[78]!==J?(ee=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[U,K,J]}),t[76]=U,t[77]=K,t[78]=J,t[79]=ee):ee=t[79];let te;return t[80]!==w||t[81]!==T||t[82]!==M||t[83]!==B||t[84]!==V||t[85]!==ee?(te=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[_,w,T,M,B,V,ee]}),t[80]=w,t[81]=T,t[82]=M,t[83]=B,t[84]=V,t[85]=ee,t[86]=te):te=t[86],te}function __e(e){return[e,``]}function v_e(e){let t=(0,Z.c)(35),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Wait for Event`}),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=(0,X.jsx)(s_e,{config:n,disabled:i,onUpdateConfig:r}),t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(TX,{htmlFor:`waitTimeout`,children:`Stop waiting after`}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=e=>r({waitTimeout:e}),t[6]=r,t[7]=c);let l;t[8]===n?l=t[9]:(l=_0(n,`waitTimeout`),t[8]=n,t[9]=l);let u;t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitTimeout.type,id:`waitTimeout`,onChange:c,placeholder:`7d`,value:l}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Required. A wait with no end holds a run, and a place in the run list, until somebody notices.`}),t[14]=d):d=t[14];let f;t[15]===u?f=t[16]:(f=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,u,d]}),t[15]=u,t[16]=f);let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(TX,{htmlFor:`waitTimeoutBehavior`,children:`On timeout`}),t[17]=p):p=t[17];let m;t[18]===r?m=t[19]:(m=e=>r({waitTimeoutBehavior:e}),t[18]=r,t[19]=m);let h;t[20]===n?h=t[21]:(h=v0(n,`waitTimeoutBehavior`,`continue`),t[20]=n,t[21]=h);let g;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(W6,{className:`w-full`,id:`waitTimeoutBehavior`,children:(0,X.jsx)(U6,{placeholder:`Select timeout behavior`})}),t[22]=g):g=t[22];let _;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`continue`,children:`Continue workflow`}),(0,X.jsx)(K6,{value:`skip`,children:`Skip remaining branch`})]}),t[23]=_):_=t[23];let v;t[24]!==i||t[25]!==m||t[26]!==h?(v=(0,X.jsxs)(V6,{disabled:i,onValueChange:m,value:h,children:[g,_]}),t[24]=i,t[25]=m,t[26]=h,t[27]=v):v=t[27];let y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Choose whether to continue downstream nodes or halt the branch when the timeout expires.`}),t[28]=y):y=t[28];let b;t[29]===v?b=t[30]:(b=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,v,y]}),t[29]=v,t[30]=b);let x;return t[31]!==b||t[32]!==o||t[33]!==f?(x=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[a,o,f,b]}),t[31]=b,t[32]=o,t[33]=f,t[34]=x):x=t[34],x}function y_e(e){let t=(0,Z.c)(31),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=v0(n,`waitMode`,`delay`),t[0]=n,t[1]=a);let o=a,s;t[2]!==n||t[3]!==r?(s=e=>{let t={...n,waitMode:e},i=Object.fromEntries(u4(t).map(b_e));r({...i,waitMode:e,...e===`event`&&!(_0(n,`waitTimeout`)??``).trim()?{waitTimeout:`7d`}:{}})},t[2]=n,t[3]=r,t[4]=s):s=t[4];let c=s,l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(TX,{htmlFor:`waitMode`,children:`How should this step wait?`}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=H6(c),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(W6,{className:`w-full`,id:`waitMode`,children:(0,X.jsx)(U6,{placeholder:`Select wait mode`})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`delay`,children:`Wait for time`}),(0,X.jsx)(K6,{value:`event`,children:`Wait for an event`})]}),t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==u||t[12]!==o?(p=(0,X.jsxs)(V6,{disabled:i,onValueChange:u,value:o,children:[d,f]}),t[10]=i,t[11]=u,t[12]=o,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Resume on a clock, or when an event arrives that this step's match accepts.`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[l,p,m]}),t[15]=p,t[16]=h);let g;t[17]!==n||t[18]!==i||t[19]!==r||t[20]!==o?(g=o===`delay`&&(0,X.jsx)(g_e,{config:n,disabled:i,onUpdateConfig:r}),t[17]=n,t[18]=i,t[19]=r,t[20]=o,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==i||t[24]!==r||t[25]!==o?(_=o===`event`&&(0,X.jsx)(v_e,{config:n,disabled:i,onUpdateConfig:r}),t[22]=n,t[23]=i,t[24]=r,t[25]=o,t[26]=_):_=t[26];let v;return t[27]!==g||t[28]!==_||t[29]!==h?(v=(0,X.jsxs)(X.Fragment,{children:[h,g,_]}),t[27]=g,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function b_e(e){return[e,``]}function x_e(e){let t=(0,Z.c)(9),{actionType:n,config:r,onUpdateConfig:i,disabled:a}=e;switch(n){case b1.condition:{let e;return t[0]!==r||t[1]!==a||t[2]!==i?(e=(0,X.jsx)(p_e,{config:r,disabled:a,onUpdateConfig:i}),t[0]=r,t[1]=a,t[2]=i,t[3]=e):e=t[3],e}case b1.eventSplit:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(m_e,{}),t[4]=e):e=t[4],e}case b1.wait:{let e;return t[5]!==r||t[6]!==a||t[7]!==i?(e=(0,X.jsx)(y_e,{config:r,disabled:a,onUpdateConfig:i}),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],e}default:return null}}function S_e(){let e=(0,Z.c)(2),t=yy(),n;if(e[0]!==t){let r=yne(t);n=Object.fromEntries(Object.entries(r).map(C_e)),e[0]=t,e[1]=n}else n=e[1];return n}function C_e(e){let[t,n]=e;return[t,n.map(w_e)]}function w_e(e){return{id:e.id,label:e.label,logoUrl:e.logoUrl,integration:e.integration}}function T_e(e,t){return Py(e,t)?.category??null}function E_e(e){let t=(0,Z.c)(81),{config:n,onUpdateConfig:r,disabled:i,isOwner:a}=e,o=a===void 0||a,s=yy(),c=_0(n,`actionType`),l=S_e(),u;t[0]===l?u=t[1]:(u=Object.keys(l).filter(k_e).toSorted(),t[0]=l,t[1]=u);let d=u,f=c&&T_e(s,c)||``,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=i0(),t[2]=p):p=t[2];let{data:m}=Xe(p),h;t[3]===m?h=t[4]:(h=m===void 0?[]:m,t[3]=m,t[4]=h);let g=h,{push:_}=RY(),v;t[5]!==l||t[6]!==r?(v=e=>{let t=l[e]?.[0];t&&r({actionType:t.id})},t[5]=l,t[6]=r,t[7]=v):v=t[7];let y=v,b;t[8]===r?b=t[9]:(b=e=>{r({actionType:e})},t[8]=r,t[9]=b);let x=b,S=c?Py(s,c):void 0,C=S?.integration,w;if(t[10]!==g||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>e.type===C,t[13]=C,t[14]=e),w=g.some(e),t[10]=g,t[11]=C,t[12]=w}else w=t[12];let T=w,E;t[15]!==C||t[16]!==r||t[17]!==_?(E=()=>{C&&_(C3,{type:C,onSuccess:e=>{r({integrationId:e})}})},t[15]=C,t[16]=r,t[17]=_,t[18]=E):E=t[18];let D=E,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(TX,{className:`ml-1`,htmlFor:`actionCategory`,children:`Service`}),t[19]=O):O=t[19];let k;t[20]===y?k=t[21]:(k=H6(y),t[20]=y,t[21]=k);let A=f||void 0,j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(W6,{className:`w-full`,id:`actionCategory`,children:(0,X.jsx)(U6,{placeholder:`Select category`})}),t[22]=j):j=t[22];let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(K6,{value:`System`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(dy,{className:`size-4`}),(0,X.jsx)(`span`,{children:`System`})]})}),t[23]=M):M=t[23];let N;t[24]===d.length?N=t[25]:(N=d.length>0&&(0,X.jsx)(wme,{}),t[24]=d.length,t[25]=N);let P;if(t[26]!==l||t[27]!==d){let e;t[29]===l?e=t[30]:(e=e=>{let t=l[e],n=t?.[0]?.integration,r=t?.map(O_e).find(D_e);return(0,X.jsx)(K6,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b5,{fallback:n?(0,X.jsx)(b3,{className:`size-4`,integration:n}):(0,X.jsx)(gy,{className:`size-4`}),label:e,logoUrl:r}),(0,X.jsx)(`span`,{children:e})]})},e)},t[29]=l,t[30]=e),P=d.map(e),t[26]=l,t[27]=d,t[28]=P}else P=t[28];let F;t[31]!==N||t[32]!==P?(F=(0,X.jsxs)(G6,{children:[M,N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let I;t[34]!==i||t[35]!==k||t[36]!==A||t[37]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[O,(0,X.jsxs)(V6,{disabled:i,onValueChange:k,value:A,children:[j,F]})]}),t[34]=i,t[35]=k,t[36]=A,t[37]=F,t[38]=I):I=t[38];let L;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(TX,{className:`ml-1`,htmlFor:`actionType`,children:`Action`}),t[39]=L):L=t[39];let R=i||!f,z;t[40]===x?z=t[41]:(z=H6(x),t[40]=x,t[41]=z);let B=c||void 0,V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsx)(W6,{className:`w-full`,id:`actionType`,children:(0,X.jsx)(U6,{placeholder:`Select action`})}),t[42]=V):V=t[42];let H;t[43]!==l||t[44]!==f?(H=f&&l[f]?.map(e=>{let t;return t=f===`System`?(0,X.jsx)(dy,{className:`size-4`}):e.integration?(0,X.jsx)(b3,{className:`size-4`,integration:e.integration}):(0,X.jsx)(gy,{className:`size-4`}),(0,X.jsx)(K6,{value:e.id,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b5,{fallback:t,label:e.label,logoUrl:e.logoUrl}),(0,X.jsx)(`span`,{children:e.label})]})},e.id)}),t[43]=l,t[44]=f,t[45]=H):H=t[45];let U;t[46]===H?U=t[47]:(U=(0,X.jsx)(G6,{children:H}),t[46]=H,t[47]=U);let W;t[48]!==R||t[49]!==z||t[50]!==B||t[51]!==U?(W=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[L,(0,X.jsxs)(V6,{disabled:R,onValueChange:z,value:B,children:[V,U]})]}),t[48]=R,t[49]=z,t[50]=B,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==I||t[54]!==W?(G=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[I,W]}),t[53]=I,t[54]=W,t[55]=G):G=t[55];let K;t[56]!==n||t[57]!==i||t[58]!==T||t[59]!==C||t[60]!==o||t[61]!==r||t[62]!==D?(K=C&&o&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`ml-1 flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(TX,{children:`Connection`}),(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[(0,X.jsx)(D8,{render:(0,X.jsx)(`span`,{className:`inline-flex`,children:(0,X.jsx)(Zv,{className:`size-3.5 text-muted-foreground`})}),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Connection help`})}),(0,X.jsx)(O8,{children:(0,X.jsx)(`p`,{children:`API key or OAuth credentials for this service`})})]})})]}),T&&(0,X.jsx)(zv,{"aria-label":`Add connection`,className:`size-6`,disabled:i,onClick:D,size:`icon`,variant:`ghost`,children:(0,X.jsx)(cy,{className:`size-4`})})]}),(0,X.jsx)(wpe,{disabled:i,integrationType:C,onChange:e=>r({integrationId:e}),value:_0(n,`integrationId`)})]}),t[56]=n,t[57]=i,t[58]=T,t[59]=C,t[60]=o,t[61]=r,t[62]=D,t[63]=K):K=t[63];let q;t[64]===n?q=t[65]:(q=_0(n,`actionType`)??``,t[64]=n,t[65]=q);let J;t[66]!==n||t[67]!==i||t[68]!==r||t[69]!==q?(J=(0,X.jsx)(x_e,{actionType:q,config:n,disabled:i,onUpdateConfig:r}),t[66]=n,t[67]=i,t[68]=r,t[69]=q,t[70]=J):J=t[70];let ee;t[71]!==S||t[72]!==n||t[73]!==i||t[74]!==r?(ee=S&&S.configFields.length>0&&(0,X.jsx)(Vhe,{config:n,disabled:i,fields:S.configFields,onUpdateConfig:r}),t[71]=S,t[72]=n,t[73]=i,t[74]=r,t[75]=ee):ee=t[75];let te;return t[76]!==G||t[77]!==K||t[78]!==J||t[79]!==ee?(te=(0,X.jsxs)(X.Fragment,{children:[G,K,J,ee]}),t[76]=G,t[77]=K,t[78]=J,t[79]=ee,t[80]=te):te=t[80],te}function D_e(e){return typeof e==`string`&&e.trim().length>0}function O_e(e){return e.logoUrl}function k_e(e){return e!==`System`}var x5=Y.createContext(void 0);function S5(e){let t=Y.useContext(x5);if(t===void 0&&!e)throw Error(Gg(33));return t}var C5=Y.createContext(void 0);function w5(e){let t=Y.useContext(C5);if(t===void 0&&!e)throw Error(Gg(36));return t}var A_e=Y.createContext(void 0);function T5(e=!0){let t=Y.useContext(A_e);if(t===void 0&&!e)throw Error(Gg(25));return t}function j_e(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=T5(!0),f=d!==void 0;return Y.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:fH})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!YH&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&Yg(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var E5={type:`regular-item`};function D5(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Y.useRef(null),{getButtonProps:d,buttonRef:f}=Xg({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=j_e({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Y.useCallback(e=>Fg(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Qg(u,f);return Y.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var O5=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),k5={checked(e){return e?{[O5.checked]:``}:{[O5.unchecked]:``}},...XV},M_e=Y.createContext(void 0),N_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=P6({guess:!0,label:a}),f=S5(!0),p=PH(i),{store:m}=w5(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=D5({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:E5});return o_(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),A5=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=w5(),{side:c,align:l}=S5(),u=D6(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;vq({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Y.useEffect(()=>{function e(e){s.setOpen(!1,DH(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),$q(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=o_(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:aH,props:[p,{onKeyDown(e){u&&TJ.has(e.key)&&e.stopPropagation()}},S6(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,X.jsx)(HG,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),j5=Y.createContext(void 0);function P_e(){let e=Y.useContext(j5);if(e===void 0)throw Error(Gg(32));return e}var M5=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=w5();return i.useState(`mounted`)||n?(0,X.jsx)(j5.Provider,{value:n,children:(0,X.jsx)(CG,{ref:t,...r})}):null}),N5=Y.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,{store:v}=w5(),y=P_e(),b=T5(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Y.useRef(null),R=_q(A),z=n,B=c,V=l,H=s,U=h;x.type===`context-menu`&&(z=n??x.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let W=o,G=H;x.type===`menu`?(W??=`inline-end`,G??=`start`,U=e.collisionAvoidance??_G):x.type===`menubar`&&(W??=x.context.orientation===`vertical`?`inline-end`:`bottom`,G??=`start`);let K=x.type===`context-menu`,q=g6({anchor:z,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:W,sideOffset:B,align:G,alignOffset:V,arrowPadding:K?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:U,shift:K?{crossAxis:!(`side`in U&&U.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Y.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,DH(CH)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Y.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,DH(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let J=zH();Y.useEffect(()=>{T||J.clear()},[T,J]),Y.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?J.isStarted()||J.start(e,()=>{v.setOpen(!1,DH(CH))}):v.setOpen(!1,DH(CH))}else J.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,J]),Y.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Mg(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let ee={open:T,side:q.side,align:q.align,anchorHidden:q.anchorHidden,nested:x.type===`menu`,instant:j},te=x.type===`menubar`&&x.context.modal;w6(T&&(te||E&&N!==`trigger-hover`),D===`touch`,A,O);let ne=C6(e,ee,{styles:q.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),re=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ie=null;return x.type===`menubar`?ie=x.context.contentElement:x.type===void 0&&(ie=O),(0,X.jsxs)(x5.Provider,{value:q,children:[re&&(0,X.jsx)(IJ,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:FJ(!T),cutout:ie}),(0,X.jsx)(jG,{id:P,children:(0,X.jsx)(l6,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ne})})]})}),P5=Y.createContext(void 0);function F_e(){let e=Y.useContext(P5);if(e===void 0)throw Error(Gg(34));return e}var I_e=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Y.useState(void 0),[p,m]=A3({controlled:i,default:a,name:`MenuRadioGroup`}),h=kg((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=o_(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Y.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,X.jsx)(M_e.Provider,{value:f,children:(0,X.jsx)(P5.Provider,{value:_,children:g})})})),F5=Y.createContext(void 0);function L_e(){let e=Y.useContext(F5);if(e===void 0)throw Error(Gg(35));return e}var R_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=P6({guess:!0,label:a}),p=S5(!0),m=PH(i),{store:h}=w5(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=F_e(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=D5({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:E5}),E=Y.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=DH(fH,e.nativeEvent,void 0,{preventUnmountOnClose:r_});y(l,t)}let O=o_(`div`,e,{state:E,stateAttributesMapping:k5,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,X.jsx)(F5.Provider,{value:E,children:O})}),z_e=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=L_e(),c=Y.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=gq(s.checked);return vq({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),o_(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:k5,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),B_e=Y.createContext(null);function I5(e){let t=Y.useContext(B_e);if(t===null&&!e)throw Error(Gg(5));return t}var V_e={...Vq,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},H_e=class extends fq{constructor(e){super({...W_e(),...e},U_e(),V_e),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function U_e(){return{positionerRef:Y.createRef(),popupRef:Y.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Y.createRef(),beforeContentFocusGuardRef:Y.createRef(),onOpenChangeComplete:void 0,triggerElements:new Mq}}function W_e(){return{...Pq(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new TG,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:a_,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var L5=Y.createContext(void 0);function R5(){return Y.useContext(L5)}var z5=rq(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=T5(!0),_=w5(!0),v=I5(!0),y=R5(),b=Y.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=G_e({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});x.useControlledProp(`openProp`,n),x.useControlledProp(`triggerIdProp`,p),x.useContextCallback(`onOpenChangeComplete`,i);let S=NH(),C=NH(),w=x.useState(`floatingTreeRoot`),T=AG(w),E=OG(),D=x.useState(`open`),O=x.useState(`activeTriggerElement`),k=x.useState(`positionerElement`),A=x.useState(`hoverEnabled`),j=x.useState(`disabled`),M=x.useState(`lastOpenChangeReason`),N=x.useState(`parent`),P=x.useState(`activeIndex`),F=x.useState(`payload`),I=x.useState(`floatingParentNodeId`),L=Y.useRef(null),R=Y.useRef(N.type!==`context-menu`),z=zH(),B=Y.useRef(!0),V=zH(),H=I!=null,{openMethod:U,triggerProps:W}=sY(D);x.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:N.type===void 0?s:void 0,openMethod:U,rootId:S}),Oq(x);let{forceUnmount:G}=kq(D,x,()=>{x.set(`allowMouseEnter`,!1)});Mg(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:T,floatingParentNodeId:E}):_&&x.update({floatingNodeId:T,floatingParentNodeId:E})},[g,_,T,E,x]),Y.useEffect(()=>{if(D||(L.current=null),N.type===`context-menu`){if(!D){z.clear(),R.current=!1;return}z.start(500,()=>{R.current=!0})}},[z,D,N.type]),Mg(()=>{!D&&!A&&x.set(`hoverEnabled`,!0)},[D,A,x]);let K=kg((e,t)=>{let n=t.reason;if(!e&&!x.select(`open`)||D===e&&t.trigger===O&&M===n)return;let i=Tq(t);if(!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled)return;x.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!B.current)return;e&&n===`trigger-focus`?(B.current=!1,V.start(300,()=>{B.current=!0})):(B.current=!0,V.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};L.current=t.event,wq(c,e,t.trigger,i()),x.update(c),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):o||s?x.set(`instantType`,o?`click`:`dismiss`):x.set(`instantType`,void 0)}),q=hq({popupStore:x,floatingId:C,nested:E!=null,onOpenChange:K}),J=q.context.events;Mg(()=>{let e=({open:e,eventDetails:t})=>K(e,t);return J.on(`setOpen`,e),()=>{J?.off(`setOpen`,e)}},[J,K]);let ee=Y.useCallback(()=>{x.setOpen(!1,DH(TH))},[x]);Y.useImperativeHandle(u,()=>({unmount:G,close:ee}),[G,ee]);let te;N.type===`context-menu`&&(te=N.context),Y.useImperativeHandle(te?.positionerRef,()=>k,[k]),Y.useImperativeHandle(te?.actionsRef,()=>({setOpen:K}),[K]);let ne=YG(q,{enabled:!j,bubbles:{escapeKey:d&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`||R.current},externalTree:H?w:void 0}),re=d6(),ie=Y.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),ae=lJ(q,{enabled:!j,listRef:x.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:re===`rtl`,disabledIndices:i_,onNavigate:ie,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:H?w:void 0,focusItemOnHover:h}),oe=Y.useCallback(e=>{x.context.typingRef.current=e},[x]),se=uJ(q,{enabled:!j,listRef:x.context.itemLabels,elementsRef:x.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&x.set(`activeIndex`,e)},onTyping:oe});Aq(x,{floatingRootContext:q,activeTriggerProps:Y.useMemo(()=>{let e=Fg(se.reference,ae.reference,ne.reference,{onMouseMove(){x.set(`allowMouseEnter`,!0)}},W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=D,e},[x,se.reference,ae.reference,ne.reference,W,D]),inactiveTriggerProps:Y.useMemo(()=>{let e=Fg(ae.trigger,ne.trigger,W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ae.trigger,ne.trigger,W]),popupProps:Y.useMemo(()=>Fg(yq,{id:C,role:`menu`,"aria-labelledby":O?.id,onMouseMove(){x.set(`allowMouseEnter`,!0),N.type===`menu`&&x.set(`hoverEnabled`,!1)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},se.floating,ae.floating,ne.floating),[O,C,N.type,x,se.floating,ae.floating,ne.floating]),itemProps:ae.item??a_});let ce=Y.useMemo(()=>({store:x,parent:b}),[x,b]),le=(0,X.jsxs)(C5.Provider,{value:ce,children:[f&&(0,X.jsx)(Sq,{handle:f,store:x}),typeof t==`function`?t({payload:F}):t]});return N.type===void 0||N.type===`context-menu`?(0,X.jsx)(MG,{externalTree:w,children:le}):le});function G_e(e){return Eg(()=>new H_e(e)).current}function K_e(e){let t=w5().store,n=Y.useMemo(()=>({parentMenu:t}),[t]);return(0,X.jsx)(L5.Provider,{value:n,children:(0,X.jsx)(z5,{...e})})}function q_e(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qg(),{ref:i,index:a}=P6(e),o=n===a,s=Y.useRef(null),c=Qg(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function B5(e){let{render:t,className:n,style:r,state:i=a_,props:a=i_,refs:o=i_,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=q_e({metadata:s});return o_(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function V5(e){if(ag(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!_g(e))return V5(bg(e))}function J_e(e,t){let n=Y.useRef(null);function r(t){Xi.flushSync(()=>{e.setOpen(!1,DH(_H,t.nativeEvent,t.currentTarget))}),JW(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&YW(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Xi.flushSync(()=>{e.setOpen(!1,DH(_H,n.nativeEvent,n.currentTarget))});let i=qW(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&mU(r,i);){let e=i;if(i=WW(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Y_e(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Y.useRef(!1);return Y.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Jg(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:a_,[t,n,r])}var X_e=iq(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=w5(!0),h=Hq(d)??m?.store;if(!h)throw Error(Gg(85));let g=PH(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Y.useRef(null),S=Q_e(),C=qg(!0),w=kG(),T=Y.useMemo(()=>w??new TG,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Dq(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:AG(T),floatingParentNodeId:OG(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Xg({disabled:A,native:o});Y.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Y.useRef(null),P=zH(),F=kg(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;mU(N.current,t)||mU(h.select(`positionerElement`),t)||t===N.current||(t==null||V5(t)!==h.select(`rootId`))&&(s6(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:SH}))});Y.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&Jg(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=tJ(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:vJ({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=Z_e(y,h.select(`lastOpenChangeReason`)),z=UG(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=qq(v,{enabled:!A&&I}),V=Y_e({open:y,enabled:O,mouseDownAction:`open`}),H=Y.useMemo(()=>Fg(B.reference,z.reference),[B.reference,z.reference]),U=h.useState(`triggerProps`,D),{preFocusGuardRef:W,handlePreFocusGuardFocus:G,handleFocusTargetFocus:K}=J_e(h,x),q={disabled:A,open:y},J=[N,t,M,E,x],ee=[H,L??a_,U,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Jg(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},V,p,j],te=o_(`button`,e,{enabled:!O,stateAttributesMapping:rH,state:q,ref:J,props:ee});return O?(0,X.jsx)(B5,{tag:`button`,render:n,className:r,style:i,state:q,refs:J,props:ee,stateAttributesMapping:rH}):y?(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(WU,{ref:W,onFocus:G},`${g}-pre-focus-guard`),(0,X.jsx)(Y.Fragment,{children:te},g),(0,X.jsx)(WU,{ref:h.context.triggerFocusTargetRef,onFocus:K},`${g}-post-focus-guard`)]}):(0,X.jsx)(Y.Fragment,{children:te},g)});function Z_e(e,t){let n=zH(),[r,i]=Y.useState(!1);return Mg(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Q_e(){let e=I5(!0);return Y.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var $_e=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),eve={"aria-expanded":void 0},tve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=R5();if(!p?.parentMenu)throw Error(Gg(37));let m=P6({guess:!0,label:a}),h=S5(),{store:g}=w5(),_=PH(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Cq(_,g),C=Y.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=Y.useRef(null),T=Y.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),j=E.useState(`isActive`,m.index),M=Y.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:N,itemRef:P}=D5({closeOnClick:!1,disabled:k,highlighted:j,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:M,nodeId:h?.context.nodeId}),F=tJ(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:vJ({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),I=UG(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??a_,L=g.useState(`triggerProps`,!0);delete L.id;let R={disabled:k,highlighted:j,open:v},z=g.useState(`openMethod`),B=g.useState(`lastOpenChangeReason`)===`list-navigation`||z===`keyboard`;return o_(`div`,e,{state:R,stateAttributesMapping:nH,props:[I,F,L,A,v&&B&&$H?eve:void 0,{"aria-controls":x,tabIndex:v||j?0:-1,onBlur(){j&&E.set(`activeIndex`,null)}},f,N],ref:[t,m.ref,P,C,T]})});function H5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(z5,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function U5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(X_e,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function W5(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(A5,{className:s,"data-slot":`dropdown-menu-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(M5,{children:(0,X.jsx)(N5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function G5(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Q(`data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive data-[disabled]:opacity-50 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,X.jsx)(N_e,{className:s,"data-inset":r,"data-slot":`dropdown-menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function nve(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(I_e,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function K5(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(z_e,{children:(0,X.jsx)(Qv,{className:`size-2 fill-current`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,X.jsxs)(R_e,{className:a,"data-slot":`dropdown-menu-radio-item`,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function q5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)($_e,{className:i,"data-slot":`dropdown-menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rve(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(K_e,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function ive(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Q(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[highlighted]:bg-accent data-[popup-open]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[popup-open]:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Xv,{className:`ml-auto size-4`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(tve,{className:o,"data-inset":i,"data-slot":`dropdown-menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function ave(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(A5,{className:s,"data-slot":`dropdown-menu-sub-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(M5,{children:(0,X.jsx)(N5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ove(){return`ontouchstart`in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function sve(){return yy().actions}function cve(e){let t=(0,Z.c)(4),{group:n}=e,r=n.actions[0];if(r?.integration){let e;return t[0]===r.integration?e=t[1]:(e=(0,X.jsx)(b3,{className:`size-4`,integration:r.integration}),t[0]=r.integration,t[1]=e),e}if(n.category===`System`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(dy,{className:`size-4`}),t[2]=e):e=t[2],e}let i;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(gy,{className:`size-4`}),t[3]=i):i=t[3],i}function lve(e){let t=(0,Z.c)(11),{action:n,className:r}=e;if(n.integration){let e;return t[0]!==n.integration||t[1]!==r?(e=(0,X.jsx)(b3,{className:r,integration:n.integration}),t[0]=n.integration,t[1]=r,t[2]=e):e=t[2],e}if(n.category===`System`){let e;t[3]===r?e=t[4]:(e=Q(r,`text-muted-foreground`),t[3]=r,t[4]=e);let n;return t[5]===e?n=t[6]:(n=(0,X.jsx)(dy,{className:e}),t[5]=e,t[6]=n),n}let i;t[7]===r?i=t[8]:(i=Q(r,`text-muted-foreground`),t[7]=r,t[8]=i);let a;return t[9]===i?a=t[10]:(a=(0,X.jsx)(gy,{className:i}),t[9]=i,t[10]=a),a}var J5=`workflow-action-grid-hidden-groups`,Y5=`workflow-action-grid-view-mode`;function uve(){if(typeof window>`u`)return new Set;try{let e=localStorage.getItem(J5);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function dve(){if(typeof window>`u`)return`list`;try{return localStorage.getItem(Y5)===`grid`?`grid`:`list`}catch{return`list`}}function fve(e){let t=(0,Z.c)(72),{onSelectAction:n,disabled:r,isNewlyCreated:i}=e,[a,o]=(0,Y.useState)(``),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Set,t[0]=s):s=t[0];let[c,l]=(0,Y.useState)(s),[u,d]=(0,Y.useState)(uve),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(dve),g=sve(),_;t[1]===m?_=t[2]:(_=()=>{let e=m===`list`?`grid`:`list`;h(e),localStorage.setItem(Y5,e)},t[1]=m,t[2]=_);let v=_,y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[3]=y):y=t[3];let b=y,x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),localStorage.setItem(J5,JSON.stringify([...n])),n})},t[4]=x):x=t[4];let S=x,C;if(t[5]!==g||t[6]!==a){let e;t[8]===a?e=t[9]:(e=e=>{let t=a.toLowerCase();return e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.category.toLowerCase().includes(t)},t[8]=a,t[9]=e),C=g.filter(e),t[5]=g,t[6]=a,t[7]=C}else C=t[7];let w=C,T;if(t[10]!==w){let e={};for(let t of w){let n=t.category;e[n]||(e[n]=[]),e[n].push(t)}T=Object.keys(e).toSorted(pve).map(t=>({category:t,actions:e[t]})),t[10]=w,t[11]=T}else T=t[11];let E=T,D;bb0:{if(f){D=E;break bb0}let e;if(t[12]!==E||t[13]!==u){let n;t[15]===u?n=t[16]:(n=e=>!u.has(e.category),t[15]=u,t[16]=n),e=E.filter(n),t[12]=E,t[13]=u,t[14]=e}else e=t[14];D=e}let O=D,k=u.size,A;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[17]=A):A=t[17];let j;t[18]===i?j=t[19]:(j=i===!0&&!ove(),t[18]=i,t[19]=j);let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>o(e.target.value),t[20]=M):M=t[20];let N;t[21]!==r||t[22]!==a||t[23]!==j?(N=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[A,(0,X.jsx)(wX,{autoFocus:j,className:`pl-9`,"data-testid":`action-search-input`,disabled:r,id:`action-filter`,onChange:M,placeholder:`Search actions...`,value:a})]}),t[21]=r,t[22]=a,t[23]=j,t[24]=N):N=t[24];let P;t[25]===v?P=t[26]:(P=(0,X.jsx)(zv,{className:`shrink-0`,onClick:v,size:`icon`,variant:`ghost`}),t[25]=v,t[26]=P);let F;t[27]===m?F=t[28]:(F=m===`list`?(0,X.jsx)(pte,{className:`size-4`}):(0,X.jsx)(vte,{className:`size-4`}),t[27]=m,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,X.jsx)(D8,{render:P,children:F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=m===`list`?`Grid view`:`List view`,R;t[32]===L?R=t[33]:(R=(0,X.jsx)(O8,{children:L}),t[32]=L,t[33]=R);let z;t[34]!==I||t[35]!==R?(z=(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[I,R]})}),t[34]=I,t[35]=R,t[36]=z):z=t[36];let B;t[37]!==k||t[38]!==f?(B=k>0&&(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[(0,X.jsx)(D8,{render:(0,X.jsx)(zv,{className:Q(`shrink-0`,f&&`bg-muted`),onClick:()=>p(!f),size:`icon`,variant:`ghost`}),children:f?(0,X.jsx)(ry,{className:`size-4`}):(0,X.jsx)(ny,{className:`size-4`})}),(0,X.jsx)(O8,{children:f?`Hide hidden groups`:`Show ${k} hidden group${k>1?`s`:``}`})]})}),t[37]=k,t[38]=f,t[39]=B):B=t[39];let V;t[40]!==N||t[41]!==z||t[42]!==B?(V=(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[N,z,B]}),t[40]=N,t[41]=z,t[42]=B,t[43]=V):V=t[43];let H;t[44]===w.length?H=t[45]:(H=w.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No actions found`}),t[44]=w.length,t[45]=H);let U;t[46]!==w.length||t[47]!==O?(U=w.length>0&&O.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`All groups are hidden`}),t[46]=w.length,t[47]=O,t[48]=U):U=t[48];let W;t[49]!==r||t[50]!==w||t[51]!==u||t[52]!==n||t[53]!==f||t[54]!==m||t[55]!==O?(W=m===`grid`&&O.length>0&&(0,X.jsx)(`div`,{className:`grid gap-2 p-1`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(72px, 1fr))`},children:w.filter(e=>f||!u.has(e.category)).map(e=>(0,X.jsxs)(`button`,{className:Q(`flex aspect-square flex-col items-center justify-center gap-1.5 rounded-lg border border-transparent p-2 text-center transition-colors hover:border-border hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:[(0,X.jsx)(lve,{action:e,className:`size-6`}),(0,X.jsx)(`span`,{className:`line-clamp-2 font-medium text-xs leading-tight`,children:e.label})]},e.id))}),t[49]=r,t[50]=w,t[51]=u,t[52]=n,t[53]=f,t[54]=m,t[55]=O,t[56]=W):W=t[56];let G;t[57]!==c||t[58]!==r||t[59]!==u||t[60]!==n||t[61]!==m||t[62]!==O?(G=m===`list`&&O.length>0&&O.map((e,t)=>{let i=c.has(e.category),a=u.has(e.category);return(0,X.jsxs)(`div`,{children:[t>0&&(0,X.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,X.jsxs)(`div`,{className:Q(`sticky top-0 z-10 mb-1 flex items-center gap-2 bg-background px-3 py-2 font-medium text-muted-foreground text-xs uppercase tracking-wider`,a&&`opacity-50`),children:[(0,X.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 text-left hover:text-foreground`,onClick:()=>b(e.category),type:`button`,children:[(0,X.jsx)(Xv,{className:Q(`size-3.5 transition-transform`,!i&&`rotate-90`)}),(0,X.jsx)(cve,{group:e}),e.category]}),(0,X.jsxs)(H5,{children:[(0,X.jsx)(U5,{render:(0,X.jsx)(`button`,{className:`rounded p-0.5 hover:bg-muted hover:text-foreground`,type:`button`}),children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsx)(W5,{align:`end`,children:(0,X.jsx)(G5,{onClick:()=>S(e.category),children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Show group`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Hide group`]})})})]})]}),!i&&e.actions.map(e=>(0,X.jsx)(`button`,{className:Q(`flex w-full items-center rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})},e.id))]},e.category)}),t[57]=c,t[58]=r,t[59]=u,t[60]=n,t[61]=m,t[62]=O,t[63]=G):G=t[63];let K;t[64]!==H||t[65]!==U||t[66]!==W||t[67]!==G?(K=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-4`,"data-testid":`action-grid`,children:[H,U,W,G]}),t[64]=H,t[65]=U,t[66]=W,t[67]=G,t[68]=K):K=t[68];let q;return t[69]!==V||t[70]!==K?(q=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[V,K]}),t[69]=V,t[70]=K,t[71]=q):q=t[71],q}function pve(e,t){return e===`System`?-1:t===`System`?1:e.localeCompare(t)}function mve(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function X5(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...F3}}var hve=Y.createContext({disabled:!1});function Z5(){return Y.useContext(hve)}function Q5(e,t,n,r=!0,i){let[a,o]=Y.useState(),s=PH(i?`${i}-label`:void 0),c=e??t??a;return Mg(()=>{let i=e||t||!r?void 0:gve(n.current,s);a!==i&&o(i)}),c}function gve(e,t){let n=_ve(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function _ve(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var vve=Y.createContext(void 0);function yve(){return Y.useContext(vve)}var $5=Y.createContext(void 0);function bve(){let e=Y.useContext($5);if(e===void 0)throw Error(Gg(14));return e}var xve=`data-parent`,Sve=Y.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=e6(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:D,setTouched:O,state:k,validationMode:A,validityData:j,validation:M}=R3(),N=Z5(),{labelId:P,controlId:F,registerControlId:I,getDescriptionProps:L}=B3(),R=yve(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=C||N.disabled||R?.disabled||o,H=w??d,U=v??H,W=PH(),G=PH(),K=c||F;B&&(p?K=G:U===void 0?K||=G:K=`${z.id}-${U}`);let q={};B&&(p?q=z.getParentProps():U!==void 0&&(q=z.getChildProps(U)));let{checked:J=n,indeterminate:ee=l,onCheckedChange:te,...ne}=q,re=R?.value,ie=Y.useRef(null),ae=Eg(()=>Symbol()),oe=Y.useRef(!1),{getButtonProps:se,buttonRef:ce}=Xg({disabled:V,native:y}),le=R?.validation??M,[ue,de]=A3({controlled:U!==void 0&&re!==void 0&&!p?re.includes(U):J,default:i,name:`Checkbox`,state:`checked`}),fe=B?!!J:ue,pe=B&&ee||l;Mg(()=>{I!==r_&&(oe.current=!0,I(ae.current,K))},[K,I,ae]),Y.useEffect(()=>{let e=ae.current;return()=>{!oe.current||I===r_||(oe.current=!1,I(e,void 0))}},[I,ae]),z3(ie,W,ue,void 0,!R&&!V,d);let me=Y.useRef(null),he=le.registerInput,ge=R?U:void 0,_e=Y.useCallback(e=>he(e,{controlRef:ie,value:ge}),[he,ge]),ve=Qg(u,me,p?void 0:_e),ye=Q5(a,P,me,!y,K??void 0);Mg(()=>{me.current&&(me.current.indeterminate=pe,ue&&E(!0))},[ue,pe,E]),aY(ue,()=>{R||(S(H),E(ue),T(ue!==j.initialValue),le.change(ue))});let be=Fg({checked:ue,disabled:V,form:s,name:p?void 0:H,id:y?void 0:K??void 0,required:g,ref:ve,style:H?UU:HU,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=DH(sH,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(te?.(t,n),!n.isCanceled&&(de(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){ie.current?.focus()}},v===void 0?a_:{value:(R?ue&&v:v)||``},L,e=>le.getValidationProps(V,e));Y.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let xe=Y.useMemo(()=>({...k,checked:fe,disabled:V,readOnly:m,required:g,indeterminate:pe}),[k,fe,V,m,g,pe]),Se=X5(xe),Ce=o_(`span`,e,{state:xe,ref:[ce,ie,t],props:[{id:y?K??void 0:W,role:`checkbox`,"aria-checked":pe?`mixed`:fe,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":ye,[xve]:p?``:void 0,onFocus(){V||D(!0)},onBlur(){let e=me.current;e&&(O(!0),D(!1),A===`onBlur`&&le.commit(R?re:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=me.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),tg(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||mve(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=me.current;t&&Yg(t,e)}},x,ne,se,L,e=>le.getValidationProps(V,e)],stateAttributesMapping:Se});return(0,X.jsxs)($5.Provider,{value:xe,children:[Ce,!ue&&!R&&H&&!p&&_!==void 0&&(0,X.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,X.jsx)(`input`,{...be,suppressHydrationWarning:!0})]})}),Cve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=bve(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=gq(c),f=Y.useRef(null),p={...s,transitionStatus:u};vq({open:c,ref:f,onComplete(){c||d(!1)}});let m={...X5(s),...XV},h=a||l,g=o_(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function e7(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`peer inline-grid size-4 shrink-0 place-content-center rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[disabled]:cursor-not-allowed data-[checked]:border-primary data-[invalid]:border-destructive data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 dark:bg-input/30 dark:data-[checked]:bg-primary dark:data-[invalid]:ring-destructive/40`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Cve,{className:`grid place-content-center text-current transition-none`,"data-slot":`checkbox-indicator`,children:(0,X.jsx)(qv,{className:`size-3.5`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Sve,{className:i,"data-slot":`checkbox`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var t7={checked(e){return e?{"data-checked":``}:{"data-unchecked":``}},...XV,...F3},wve=`data-composite-item-active`,n7=Y.createContext(void 0);function Tve(){return Y.useContext(n7)}var r7=Y.createContext(void 0);function Eve(){let e=Y.useContext(r7);if(e===void 0)throw Error(Gg(52));return e}var Dve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=Tve(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=r_,setTouched:w=r_,registerInputRef:T=r_}=m??{},{setTouched:E,setFilled:D,state:O,disabled:k}=R3(),A=Z5(),{labelId:j,getDescriptionProps:M}=B3(),N=k||A.disabled||h||i,P=g||a,F=_||o,I=v,L=m?y===c:c===``,R=Y.useRef(null),z=Y.useRef(null),B=x?.registerInput,V=Qg(l,z,T,Y.useCallback(e=>B?.(e,{controlRef:R,value:void 0}),[B]));Mg(()=>{z.current?.checked&&D(!0)},[D]),Mg(()=>{if(z.current){if(N&&L){T(null);return}T(z.current)}},[L,N,T]);let H=PH(),U=V3({id:d,implicit:!1,controlRef:R}),W=u?void 0:U,G={role:`radio`,"aria-checked":L,"aria-labelledby":Q5(s,j,z,!u,W),[wve]:L?``:void 0,id:u?U:H,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||N||P)return;e.preventDefault();let t=z.current;t&&Yg(t,e)},onFocus(e){e.defaultPrevented||N||P||!b||(z.current?.click(),w(!1))}},{getButtonProps:K,buttonRef:q}=Xg({disabled:N,native:u,composite:!1}),J={type:`radio`,ref:V,form:I,id:W,name:S,tabIndex:-1,style:S?UU:HU,"aria-hidden":!0,...c===void 0?a_:{value:q3(c)},disabled:N,checked:L,required:F,readOnly:P,onChange(e){if(e.nativeEvent.defaultPrevented||N||P||c===void 0)return;let t=DH(sH,e.nativeEvent);C(c,t),!t.isCanceled&&E(!0)},onClick(e){e.stopPropagation()},onFocus(){R.current?.focus()}},ee=Y.useMemo(()=>({...O,required:F,disabled:N,readOnly:P,checked:L}),[O,N,P,L,F]),te=ee,ne=m!==void 0,re=[t,R,q],ie=[G,p,K,M,x?e=>x.getValidationProps(N,e):a_],ae=o_(`span`,e,{enabled:!ne,state:ee,ref:re,props:ie,stateAttributesMapping:t7});return(0,X.jsxs)(r7.Provider,{value:te,children:[ne?(0,X.jsx)(B5,{tag:`span`,render:n,className:r,style:f,state:ee,refs:re,props:ie,stateAttributesMapping:t7}):ae,(0,X.jsx)(`input`,{...J,suppressHydrationWarning:!0})]})}),Ove=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Eve(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=gq(c),f={...s,transitionStatus:u},p=Y.useRef(null),m=a||l,h=o_(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:t7});return vq({open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null}),kve=[];function Ave(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=kve}=e,[p,m]=Y.useState(0),h=r!=null,g=Y.useRef(null),_=Qg(g,c),v=Y.useRef([]),y=Y.useRef(!1),b=o??p,x=kg((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];AJ(g.current,t,a,n)}}),S=kg(e=>{if(e.size===0||y.current)return;y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)x(i);else if(wW(t,b,d)){let e=SW(t,{disabledIndices:d});yW(t,e)||x(e)}AJ(g.current,r,a,n)});Mg(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(wW(e,b,d)){let t=SW(e,{disabledIndices:d});yW(e,t)||x(t)}},[d,o,b,v,x]);let C=kg((e,t,n)=>i?i(e,t,n,v):n),w=kg(e=>{let o=e.key===`Home`||e.key===`End`;if(!TJ.has(e.key)||!l&&o||jve(e,f)||!g.current)return;let s=a===`rtl`,c=s?CJ:wJ,p=s?wJ:CJ,m=n===`vertical`?SJ:c,_=n===`vertical`?xJ:p,y=hU(e.nativeEvent);if(y!=null&&kJ(y)&&!k3(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let S=b,w=bW(v,d),T=xW(v,d);r!=null&&(S=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:b,loopFocus:t,maxIndex:T,minIndex:w,onLoop:C,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?S=w:e.key===`End`&&(S=T)),S===b&&(E||D)&&(t&&S===T&&E?(S=w,i&&(S=i(e,b,S,v))):t&&S===w&&D?(S=T,i&&(S=i(e,b,S,v))):S=SW(v.current,{startingIndex:S,decrement:D,disabledIndices:d})),S!==b&&!yW(v.current,S)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),x(S,!0),queueMicrotask(()=>{v.current[S]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=hU(e.nativeEvent);!t||n==null||!kJ(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:w},highlightedIndex:b,onHighlightedIndexChange:x,elementsRef:v,onMapChange:S,relayKeyboardEvent:w}}function jve(e,t){for(let n of DJ)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Mve(e){let{render:t,className:n,style:r,refs:i=i_,props:a=i_,state:o=a_,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Ave({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:d6(),disabledIndices:v,modifierKeys:y}),k=o_(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Y.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,X.jsx)(Kg.Provider,{value:A,children:(0,X.jsx)(l6,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}Object.keys(N3);function Nve(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var Pve=Y.createContext(void 0);function Fve(e=!1){let t=Y.useContext(Pve);if(!t&&!e)throw Error(Gg(86));return t}var Ive=[EJ],Lve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=R3(),{labelId:E}=B3(),{clearErrors:D,elementRef:O}=e6(),k=Fve(!0),A=b||i,j=y??d,M=PH(p),[N,P]=A3({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[F,I]=Y.useState(!1),L=kg((e,t)=>{s?.(e,t),!t.isCanceled&&P(e)}),R=S.getInputControl,z=Y.useMemo(()=>({get current(){return R()}}),[R]),B=Y.useRef(null),V=Y.useRef(null);function H(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),B.current=e,t}let U=kg(e=>{if(!e||e.disabled)return;V.current||=e;let t=B.current,n=e.checked||t==null||t.disabled?H(e):void 0;return()=>{V.current===e&&(V.current=null),B.current===e?n?(n(),B.current=null):H(null):n?.()}}),W=kg(()=>{let e=O.current;if(!e)return N??null;for(let t of S.registeredInputs.keys())if(t.checked&&Nve(t,e))return N??null;return null});z3(z,M,N??null,W,!A,d),aY(N,()=>{D(j),C(N!==T.initialValue),w(N!=null),S.change(N);let e=V.current;N==null&&e&&!e.disabled&&H(e)});let G=E??k?.legendId,K={...x,disabled:A??!1,required:o??!1,readOnly:a??!1},q=Y.useMemo(()=>({checkedValue:N,disabled:A,form:u,validation:S,name:j,readOnly:a,registerInputRef:U,required:o,setCheckedValue:L,setTouched:I,touched:F}),[N,A,u,S,j,a,U,o,L,I,F]),J={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":A||void 0,"aria-readonly":a||void 0,"aria-labelledby":G,onFocus(){_(!0)},onBlur(e){mU(e.currentTarget,e.relatedTarget)||(g(!0),_(!1),v===`onBlur`&&S.commit(N))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(I(!0),_(!0))}};return(0,X.jsx)(n7.Provider,{value:q,children:(0,X.jsx)(Mve,{render:n,className:r,style:m,state:K,props:[J,h,e=>S.getValidationProps(A??!1,e)],refs:[t],stateAttributesMapping:F3,enableHomeAndEndKeys:!1,modifierKeys:Ive})})});function Rve(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`space-y-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Lve,{className:i,"data-slot":`radio-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zve(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-background outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[checked]:border-primary data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ove,{className:`flex items-center justify-center before:size-1.5 before:rounded-full before:bg-current data-[unchecked]:hidden`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Dve,{className:i,"data-slot":`radio`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Bve(e){let t=(0,Z.c)(95),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=(0,Y.useId)(),s=(0,Y.useId)(),c=(0,Y.useId)(),l=yy(),u,d;t[0]!==l||t[1]!==n?(u=C1(n)??S1,d=aue({rules:u,catalog:l}),t[0]=l,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]);let f=d,p;t[4]===r?p=t[5]:(p=e=>{r({lifecycleRules:e})},t[4]=r,t[5]=p);let m=p,h;t[6]!==u||t[7]!==m?(h=e=>{m(A1({...u,startEvents:e}))},t[6]=u,t[7]=m,t[8]=h):h=t[8];let g=h,_;t[9]!==u||t[10]!==m?(_=e=>{m(A1({...u,cancelEvents:e}))},t[9]=u,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==u||t[13]!==m?(y=e=>{m(A1({...u,concurrency:e}))},t[12]=u,t[13]=m,t[14]=y):y=t[14];let b=y,x;t[15]!==u||t[16]!==m?(x=(e,t)=>{let n=t.trim(),r={...u.correlationPaths};n?r[e]=n:delete r[e],m({...u,correlationPaths:Object.keys(r).length>0?r:void 0})},t[15]=u,t[16]=m,t[17]=x):x=t[17];let S=x,C=l.events.length>0,w;t[18]!==l.events||t[19]!==i||t[20]!==u.startEvents||t[21]!==g||t[22]!==a?(w=(0,X.jsx)(y5,{choices:l.events,disabled:i,inputId:a,onValueChange:g,value:u.startEvents}),t[18]=l.events,t[19]=i,t[20]=u.startEvents,t[21]=g,t[22]=a,t[23]=w):w=t[23];let T;t[24]!==l||t[25]!==i||t[26]!==u||t[27]!==S||t[28]!==g?(T=u.startEvents.map(e=>(0,X.jsx)(a7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>g(u.startEvents.filter(t=>t!==e)),request:k1({rules:u,catalog:l,eventName:e,role:`start`})},e)),t[24]=l,t[25]=i,t[26]=u,t[27]=S,t[28]=g,t[29]=T):T=t[29];let E;t[30]!==a||t[31]!==C||t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(i7,{help:`A run starts when one of these Events arrives. Naming several is how one workflow answers an appointment being booked and being moved: Concurrency decides what happens to the run already going.`,hasEvents:C,inputId:a,label:`Start Events`,children:[w,T]}),t[30]=a,t[31]=C,t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]===s?D=t[36]:(D=(0,X.jsx)(TX,{id:s,children:`Concurrency`}),t[35]=s,t[36]=D);let O=u.concurrency,k;t[37]!==i||t[38]!==u.concurrency?(k=Gve.map(e=>(0,X.jsxs)(`label`,{className:Q(`flex w-full cursor-pointer items-start gap-2 rounded-md border p-2 transition-colors`,u.concurrency===e.value?`border-primary bg-muted/50`:`border-input hover:bg-muted/30`,i&&`pointer-events-none opacity-50`),children:[(0,X.jsx)(zve,{className:`mt-0.5`,value:e.value}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]})]},e.value)),t[37]=i,t[38]=u.concurrency,t[39]=k):k=t[39];let A;t[40]!==s||t[41]!==i||t[42]!==u.concurrency||t[43]!==b||t[44]!==k?(A=(0,X.jsx)(Rve,{"aria-labelledby":s,disabled:i,onValueChange:b,value:O,children:k}),t[40]=s,t[41]=i,t[42]=u.concurrency,t[43]=b,t[44]=k,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The entity is the value at the Correlation Path. A start carrying no payload uses the workflow itself, so every manual run is about the same entity.`}),t[46]=j):j=t[46];let M;t[47]!==D||t[48]!==A?(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[D,A,j]}),t[47]=D,t[48]=A,t[49]=M):M=t[49];let N=u.allowManualStart===!0,P;t[50]!==u||t[51]!==m?(P=e=>m({...u,allowManualStart:e}),t[50]=u,t[51]=m,t[52]=P):P=t[52];let F;t[53]!==i||t[54]!==c||t[55]!==N||t[56]!==P?(F=(0,X.jsx)(e7,{checked:N,disabled:i,id:c,onCheckedChange:P}),t[53]=i,t[54]=c,t[55]=N,t[56]=P,t[57]=F):F=t[57];let I;t[58]===c?I=t[59]:(I=(0,X.jsx)(TX,{htmlFor:c,children:`Allow manual runs`}),t[58]=c,t[59]=I);let L;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The Run button and the execute route. With this off, only a Start Event starts a run.`}),t[60]=L):L=t[60];let R;t[61]===u.startEvents.length?R=t[62]:(R=u.startEvents.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A manual run's payload is described by nothing, so downstream nodes are offered no fields to reference. Add a Start Event to give them its payload.`}):null,t[61]=u.startEvents.length,t[62]=R);let z;t[63]!==I||t[64]!==R?(z=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[I,L,R]}),t[63]=I,t[64]=R,t[65]=z):z=t[65];let B;t[66]!==F||t[67]!==z?(B=(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,z]}),t[66]=F,t[67]=z,t[68]=B):B=t[68];let V=l.events.length>0,H;t[69]!==o||t[70]!==l.events||t[71]!==i||t[72]!==u.cancelEvents||t[73]!==v?(H=(0,X.jsx)(y5,{choices:l.events,disabled:i,inputId:o,onValueChange:v,value:u.cancelEvents}),t[69]=o,t[70]=l.events,t[71]=i,t[72]=u.cancelEvents,t[73]=v,t[74]=H):H=t[74];let U;t[75]!==l||t[76]!==i||t[77]!==u||t[78]!==v||t[79]!==S?(U=u.cancelEvents.map(e=>(0,X.jsx)(a7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>v(u.cancelEvents.filter(t=>t!==e)),request:k1({rules:u,catalog:l,eventName:e,role:`cancel`})},e)),t[75]=l,t[76]=i,t[77]=u,t[78]=v,t[79]=S,t[80]=U):U=t[80];let W;t[81]!==o||t[82]!==V||t[83]!==H||t[84]!==U?(W=(0,X.jsxs)(i7,{hasEvents:V,help:`When one of these arrives, Workflow Graph reads its Entity Value at the Correlation Path you set for it and cancels the runs already going for that entity. A canceled run leaves through the Canceled outlet.`,inputId:o,label:`Cancel Events`,children:[H,U]}),t[81]=o,t[82]=V,t[83]=H,t[84]=U,t[85]=W):W=t[85];let G;t[86]!==f.error||t[87]!==f.valid?(G=f.valid?null:(0,X.jsx)(v5,{title:`This will not save`,children:f.error}),t[86]=f.error,t[87]=f.valid,t[88]=G):G=t[88];let K;return t[89]!==E||t[90]!==M||t[91]!==B||t[92]!==W||t[93]!==G?(K=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[E,M,B,W,G]}),t[89]=E,t[90]=M,t[91]=B,t[92]=W,t[93]=G,t[94]=K):K=t[94],K}function i7(e){let t=(0,Z.c)(12),{label:n,inputId:r,hasEvents:i,help:a,children:o}=e,s;t[0]!==r||t[1]!==n?(s=(0,X.jsx)(TX,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==o||t[4]!==i?(c=i?o:(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`This server declares no Events. Whoever runs it passes them to`,(0,X.jsx)(`code`,{className:`mx-1 font-mono text-xs`,children:`createWfGraphApp`}),`, and they appear here.`]}),t[3]=o,t[4]=i,t[5]=c):c=t[5];let l;t[6]===a?l=t[7]:(l=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[6]=a,t[7]=l);let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function a7(e){let t=(0,Z.c)(19),{eventName:n,label:r,request:i,catalog:a,onCommitPath:o,onRemove:s,disabled:c}=e,l=r??n,u;t[0]!==n||t[1]!==l?(u=(0,X.jsx)(`p`,{className:`min-w-0 truncate text-xs`,title:n,children:l}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d=`Remove ${n}`,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(hy,{className:`size-3.5`}),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==d?(p=(0,X.jsx)(zv,{"aria-label":d,className:`size-7 shrink-0`,disabled:c,onClick:s,size:`icon`,type:`button`,variant:`ghost`,children:f}),t[4]=c,t[5]=s,t[6]=d,t[7]=p):p=t[7];let m;t[8]!==u||t[9]!==p?(m=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[u,p]}),t[8]=u,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==a||t[12]!==c||t[13]!==o||t[14]!==i?(h=i?(0,X.jsx)(Vve,{catalog:a,disabled:c,onCommit:o,request:i}):null,t[11]=a,t[12]=c,t[13]=o,t[14]=i,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Vve(e){let t=(0,Z.c)(47),{request:n,catalog:r,disabled:i,onCommit:a}=e,o=(0,Y.useId)(),{eventName:s,declaredPath:c,suppliedPath:l}=n,u,d,f,p,m,h,g,_,v,y;if(t[0]!==r||t[1]!==c||t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l){let e=Wve(r,s,c,l);v=`space-y-1`,t[17]!==s||t[18]!==o?(y=(0,X.jsx)(TX,{className:`sr-only`,htmlFor:o,children:s}),t[17]=s,t[18]=o,t[19]=y):y=t[19],d=V6,m=i,t[20]!==c||t[21]!==s||t[22]!==a?(h=e=>a(s,e===c||e===null?``:e),t[20]=c,t[21]=s,t[22]=a,t[23]=h):h=t[23],g=l??c??null;let n;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(U6,{}),t[24]=n):n=t[24],t[25]===o?_=t[26]:(_=(0,X.jsx)(W6,{className:`w-full`,id:o,children:n}),t[25]=o,t[26]=_),u=G6,t[27]===c?f=t[28]:(f=c?null:(0,X.jsx)(K6,{value:null,children:`Choose a path`}),t[27]=c,t[28]=f),p=e.map(Hve),t[0]=r,t[1]=c,t[2]=i,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[29]!==u||t[30]!==f||t[31]!==p?(b=(0,X.jsxs)(u,{children:[f,p]}),t[29]=u,t[30]=f,t[31]=p,t[32]=b):b=t[32];let x;t[33]!==d||t[34]!==m||t[35]!==h||t[36]!==g||t[37]!==_||t[38]!==b?(x=(0,X.jsxs)(d,{disabled:m,onValueChange:h,value:g,children:[_,b]}),t[33]=d,t[34]=m,t[35]=h,t[36]=g,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S=c?`Runs are matched on this payload path. The Event declares ${c}; a path here is read instead.`:`Runs are matched on this payload path. This Event declares none, so choose the one holding the value that identifies the entity.`,C;t[40]===S?C=t[41]:(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:S}),t[40]=S,t[41]=C);let w;return t[42]!==x||t[43]!==C||t[44]!==v||t[45]!==y?(w=(0,X.jsxs)(`div`,{className:v,children:[y,x,C]}),t[42]=x,t[43]=C,t[44]=v,t[45]=y,t[46]=w):w=t[46],w}function Hve(e){return(0,X.jsx)(K6,{value:e,children:e},e)}var Uve=new Set([`string`,`number`]);function Wve(e,t,n,r){return Ya(Ka([...(Ny(e,t)?.payloadFields??[]).filter(e=>Uve.has(e.type??``)).map(e=>e.path),n,r]))}var Gve=[{value:`unlimited`,label:`Unlimited`,description:`Every Event starts its own run.`},{value:`newest-wins`,label:`Newest wins`,description:`A new run for the same entity supersedes the ones already going, which end with that status.`},{value:`first-wins`,label:`First wins`,description:`A run already going for the same entity keeps it. The arriving Event is recorded as a Refused Start.`}];function Kve(e){let[t]=o8({currentNodeId:e.nodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog});if(!t)return;let n=L2(t),r=a4(n);return{conditionModel:t4(n),condition:r.valid?r.expression:``}}function qve(){let e=(0,Z.c)(17),t=yy(),n=_A(),r=Fe(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={from:`/workflows/$workflowId`},e[0]=i):i=e[0];let a=Gi(i),o=wA(H4),s=TA(m3),c=TA(hpe),l;e[1]!==t||e[2]!==r||e[3]!==o||e[4]!==n||e[5]!==s?(l=e=>{let i=n.get(Q4),a=i.find(e=>e.id===o);if(!a)return;let c=typeof e.actionType==`string`&&!!a.data.config?.integrationId,l={...a.data.config,...e,...c?{integrationId:void 0}:{}};e.actionType===b1.condition&&!l.conditionModel&&Object.assign(l,Kve({nodeId:a.id,nodes:i,edges:n.get($4),catalog:t}));let u=r.getQueryData(i0().queryKey),d=u?J0(t,{...a,data:{...a.data,config:l}},u).data.config:l;s({id:a.id,data:{config:d}})},e[1]=t,e[2]=r,e[3]=o,e[4]=n,e[5]=s,e[6]=l):l=e[6];let u=l,d;e[7]===r?d=e[8]:(d=()=>s0(r),e[7]=r,e[8]=d);let f=d,p;e[9]!==c||e[10]!==a||e[11]!==r?(p=r0.workflow.deleteExecutions.mutationOptions({onSuccess:async()=>{c(),a({search:{},replace:!0}),await s0(r),Ty.success(`All runs deleted`)},meta:{errorMessage:`Failed to delete runs`}}),e[9]=c,e[10]=a,e[11]=r,e[12]=p):p=e[12];let m=Ze(p),h;return e[13]!==m||e[14]!==f||e[15]!==u?(h={updateConfig:u,refreshRuns:f,deleteRuns:m},e[13]=m,e[14]=f,e[15]=u,e[16]=h):h=e[16],h}var Jve=[`pending`,`running`,`waiting`,`completed`,`canceled`,`superseded`,`failed`],Yve=[`pending`,`running`,`waiting`];function o7(e){return Yve.some(t=>t===e)}function Xve(e){return{supersededCount:e.supersededCount,refusedStarts:e.refusedStarts.map(e=>({...e,createdAt:new Date(e.createdAt)})),executions:e.items.map(e=>({...e,startedAt:new Date(e.startedAt),waitingAt:e.waitingAt?new Date(e.waitingAt):null,cancelledAt:e.cancelledAt?new Date(e.cancelledAt):null,completedAt:e.completedAt?new Date(e.completedAt):null}))}}function Zve(e){return{logs:s7(e),waits:e.waits.map(e=>({...e,waitUntil:e.waitUntil?new Date(e.waitUntil):null})),execution:{...Qve(e.execution),workflowVersionId:e.execution.workflowVersionId}}}function Qve(e){return{id:e.id,workflowId:e.workflowId,status:$ve(e.status),startSource:e.startSource,runMode:e.runMode,startEventName:e.startEventName,entityValue:e.entityValue,workflowRunId:null,startedAt:new Date(e.startedAt),waitingAt:null,cancelledAt:null,completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,error:e.error}}function $ve(e){for(let t of Jve)if(t===e)return t;return`failed`}function eye(e){return iye(s7(e))}function tye(e){return{workflowId:e.execution.workflowId,workflowVersionId:e.execution.workflowVersionId}}function nye(e){return e.events.map(e=>({...e,createdAt:new Date(e.createdAt)}))}function s7(e){return aye(e.logs.map(e=>({id:e.id,nodeId:e.nodeId,nodeName:e.nodeName,nodeType:e.nodeType,status:e.status,startedAt:new Date(e.startedAt),completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,input:e.input,output:e.output,error:e.error})),e.execution.status)}function rye(e){return new Date(e.startedAt).getTime()}function iye(e){let t={};for(let n of e){let e=t[n.nodeId];e?.startedAt!==void 0&&rye(n)<new Date(e.startedAt).getTime()||(t[n.nodeId]={nodeId:n.nodeId,nodeName:n.nodeName,nodeType:n.nodeType,status:n.status,input:n.input,output:n.output,startedAt:n.startedAt,completedAt:n.completedAt})}return t}function aye(e,t){return t!==`canceled`&&t!==`superseded`?e:e.map(e=>e.status===`pending`||e.status===`running`?{...e,status:`cancelled`,error:e.error||`Run cancelled before step completion`}:e)}function c7(){let e=(0,Z.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={from:`/workflows/$workflowId`},e[0]=t):t=e[0];let n=Gi(t),r;return e[1]===n?r=e[2]:(r=()=>{n({search:{},replace:!0})},e[1]=n,e[2]=r),r}function l7(){let e=(0,Z.c)(3),t=c7(),n=TA(g2),r;return e[0]!==t||e[1]!==n?(r=()=>{n(`properties`),t()},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function u7(e,t){return`${e} ${t}${e===1?``:`s`} ago`}function d7(e){let t=new Date,n=new Date(e),r=Math.floor((t.getTime()-n.getTime())/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return u7(i,`min`);let a=Math.floor(i/60);if(a<24)return u7(a,`hour`);let o=Math.floor(a/24);if(o<7)return u7(o,`day`);let s=Math.floor(o/7);if(s<4)return u7(s,`week`);let c=Math.floor(o/30);return c<12?u7(c,`month`):u7(Math.floor(o/365),`year`)}function f7(e){let t=(0,Z.c)(5),{refusedStarts:n}=e;if(n.length===0)return null;let r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Kv,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Refused Starts`})]}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=n.map(oye),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[r,(0,X.jsx)(`div`,{className:`divide-y`,children:i})]}),t[3]=i,t[4]=a),a}function oye(e){return(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-foreground text-xs`,children:e.message}),(0,X.jsx)(`p`,{className:`shrink-0 text-muted-foreground text-xs tabular-nums`,title:e.createdAt.toLocaleString(),children:d7(e.createdAt)})]},e.id)}var sye=jy(`workflow`,`run`),cye={pending:`muted`,running:`info`,waiting:`pending`,completed:`good`,canceled:`quiet`,superseded:`quiet`,failed:`bad`},lye={pending:`muted`,running:`info`,success:`good`,error:`bad`,cancelled:`quiet`};function p7(e){return cye[e]??lye[e]??`muted`}var uye={good:`bg-success`,bad:`bg-destructive`,info:`bg-info`,pending:`bg-warning`,quiet:`bg-cancelled`,muted:`bg-muted-foreground`},dye={pending:`Pending`,running:`Running`,waiting:`Waiting`,completed:`Completed`,canceled:`Canceled`,superseded:`Superseded`,failed:`Failed`},fye={pending:`Pending`,running:`Running`,success:`Success`,error:`Error`,cancelled:`Cancelled`},pye={good:`border-success/30 bg-success/10 text-success`,bad:`border-destructive/30 bg-destructive/10 text-destructive`,info:`border-info/30 bg-info/10 text-info`,pending:`border-warning/30 bg-warning/10 text-warning`,quiet:`border-cancelled/30 bg-cancelled/10 text-cancelled`,muted:`border-muted bg-muted/40 text-muted-foreground`};function m7(e){return uye[p7(e)]}function h7(e){return dye[e]??fye[e]??`Unknown`}function g7(e){return pye[p7(e)]}function _7(e){let t=Number.parseInt(e,10);return t<1e3?`${e}ms`:`${(t/1e3).toFixed(2)}s`}var mye=Wh(Ch({base64:yh.check(Lh(101))}));function v7(e){return mye(e)?.base64??null}function hye(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function y7(e){let t=(0,Z.c)(4),{data:n}=e,r;t[0]===n?r=t[1]:(r=JSON.stringify(n,null,2).split(/("https?:\/\/[^"]+"|"[^"]*")/g).map(gye),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i}function gye(e){if(e.startsWith(`"`)&&e.endsWith(`"`)){let t=e.slice(1,-1);if(hye(t))return(0,X.jsx)(`a`,{className:`text-info underline underline-offset-2 hover:text-info/80`,href:t,rel:`noopener noreferrer`,target:`_blank`,children:e},t)}return e}function _ye({data:e,isError:t=!1}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(zv,{className:`h-7 px-2`,onClick:async n=>{n.stopPropagation();try{let n=t?String(e):JSON.stringify(e,null,2);await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){sye.error(`Failed to copy the run payload`,{error:e})}},size:`sm`,type:`button`,variant:`ghost`,children:n?(0,X.jsx)(qv,{className:`size-3 text-success`}):(0,X.jsx)($v,{className:`size-3`})})}function b7(e){let t=(0,Z.c)(21),{title:n,children:r,defaultExpanded:i,copyData:a,isError:o}=e,s=i!==void 0&&i,c=o!==void 0&&o,[l,u]=(0,Y.useState)(s),d;t[0]===l?d=t[1]:(d=()=>u(!l),t[0]=l,t[1]=d);let f;t[2]===l?f=t[3]:(f=l?(0,X.jsx)(Jv,{className:`size-3 text-muted-foreground`}):(0,X.jsx)(Xv,{className:`size-3 text-muted-foreground`}),t[2]=l,t[3]=f);let p;t[4]===n?p=t[5]:(p=(0,X.jsx)(`span`,{className:`font-medium text-muted-foreground text-sm`,children:n}),t[4]=n,t[5]=p);let m;t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`flex items-center gap-1.5`,onClick:d,type:`button`,children:[f,p]}),t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==c?(h=a===void 0?null:(0,X.jsx)(_ye,{data:a,isError:c}),t[10]=a,t[11]=c,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,X.jsx)(`div`,{className:`flex items-center gap-1`,children:h}),t[13]=h,t[14]=g);let _;t[15]!==m||t[16]!==g?(_=(0,X.jsxs)(`div`,{className:`mb-2 flex w-full items-center justify-between`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v=l?r:null,y;return t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20],y}function vye(e,t){let n=t?.integration;if(!n)return;let r=`${n}/`;if(t.id.startsWith(r))return e[n]?.outputComponents?.[t.id.slice(r.length)]}function yye(e){let t=(0,Z.c)(22),{output:n,input:r,actionType:i}=e,a=yy(),o=xy(),s;t[0]!==i||t[1]!==a||t[2]!==o?(s=i?vye(o,Py(a,i)):void 0,t[0]=i,t[1]=a,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]!==c||t[5]!==n?(l=c?null:v7(n),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u=l,d;t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==n?(d=c?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(c,{input:r,output:n})}):u?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(`img`,{alt:`Step output`,className:`max-h-96 w-auto rounded`,height:384,src:`data:image/png;base64,${u}`,width:384})}):null,t[7]=c,t[8]=u,t[9]=r,t[10]=n,t[11]=d):d=t[11];let f=d,p;t[12]===n?p=t[13]:(p=(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(y7,{data:n})}),t[12]=n,t[13]=p);let m;t[14]!==n||t[15]!==p?(m=(0,X.jsx)(b7,{copyData:n,title:`Output`,children:p}),t[14]=n,t[15]=p,t[16]=m):m=t[16];let h;t[17]===f?h=t[18]:(h=f?(0,X.jsx)(b7,{defaultExpanded:!0,title:`Result`,children:f}):null,t[17]=f,t[18]=h);let g;return t[19]!==m||t[20]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}var x7=`grid w-full grid-cols-[1.5rem_minmax(0,1fr)_5rem] items-start gap-3 px-1 py-3 text-left`;function bye(e){return e.type===`back`?(0,X.jsx)(`button`,{"aria-label":`Back to runs list`,className:`mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-muted`,onClick:e.onBack,type:`button`,children:(0,X.jsx)(ate,{className:`size-4 text-muted-foreground`})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`size-6 shrink-0`})}function xye(e,t){return t.type===`cancel`?(0,X.jsx)(`div`,{className:`flex w-20 justify-end`,children:(0,X.jsxs)(zv,{className:`w-full`,disabled:t.isCanceling,onClick:()=>t.onCancel(e.id),size:`sm`,variant:`outline`,children:[t.isCanceling?(0,X.jsx)(ay,{className:`mr-1 size-3 animate-spin`}):(0,X.jsx)(Kv,{className:`mr-1 size-3`}),`Cancel`]})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`w-20 shrink-0`})}function Sye(e){let t=(0,Z.c)(41),{execution:n,runNumber:r,showStartEventName:i}=e,a;t[0]===n.status?a=t[1]:(a=Q(`mt-1 size-2.5 shrink-0 rounded-full`,m7(n.status)),t[0]=n.status,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,X.jsx)(`div`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,X.jsxs)(`span`,{className:`font-medium text-sm`,children:[`Run #`,r]}),t[4]=r,t[5]=s);let c;t[6]===n.status?c=t[7]:(c=Q(`rounded border px-1.5 py-0.5 font-medium text-xs uppercase`,g7(n.status)),t[6]=n.status,t[7]=c);let l;t[8]===n.status?l=t[9]:(l=h7(n.status),t[8]=n.status,t[9]=l);let u;t[10]!==c||t[11]!==l?(u=(0,X.jsx)(`span`,{className:c,children:l}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;t[13]===n.runMode?d=t[14]:(d=n.runMode===`test`?(0,X.jsx)(`span`,{className:`rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 font-medium text-xs text-warning uppercase`,children:`Test Mode`}):null,t[13]=n.runMode,t[14]=d);let f;t[15]!==s||t[16]!==u||t[17]!==d?(f=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,u,d]}),t[15]=s,t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;t[19]===n.startedAt?p=t[20]:(p=d7(n.startedAt),t[19]=n.startedAt,t[20]=p);let m;t[21]===p?m=t[22]:(m=(0,X.jsx)(`span`,{children:p}),t[21]=p,t[22]=m);let h;t[23]===n.startSource?h=t[24]:(h=n.startSource?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`capitalize`,children:n.startSource})]}):null,t[23]=n.startSource,t[24]=h);let g;t[25]!==n.startEventName||t[26]!==i?(g=i&&n.startEventName?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{children:n.startEventName})]}):null,t[25]=n.startEventName,t[26]=i,t[27]=g):g=t[27];let _;t[28]===n.duration?_=t[29]:(_=n.duration?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`font-mono tabular-nums`,children:_7(n.duration)})]}):null,t[28]=n.duration,t[29]=_);let v;t[30]!==m||t[31]!==h||t[32]!==g||t[33]!==_?(v=(0,X.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-muted-foreground text-xs`,children:[m,h,g,_]}),t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v):v=t[34];let y;t[35]!==v||t[36]!==f?(y=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,v]}),t[35]=v,t[36]=f,t[37]=y):y=t[37];let b;return t[38]!==y||t[39]!==o?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[o,y]}),t[38]=y,t[39]=o,t[40]=b):b=t[40],b}function S7(e){let t=(0,Z.c)(21),{execution:n,runNumber:r,leading:i,trailing:a,onClick:o,selected:s,showStartEventName:c}=e,l=s!==void 0&&s,u=c!==void 0&&c,d;t[0]===i?d=t[1]:(d=bye(i),t[0]=i,t[1]=d);let f;t[2]!==n||t[3]!==r||t[4]!==u?(f=(0,X.jsx)(Sye,{execution:n,runNumber:r,showStartEventName:u}),t[2]=n,t[3]=r,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==n||t[7]!==a?(p=xye(n,a),t[6]=n,t[7]=a,t[8]=p):p=t[8];let m;t[9]!==d||t[10]!==f||t[11]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[d,f,p]}),t[9]=d,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h=m;if(o){let e=l&&`bg-muted/50`,n;t[13]===e?n=t[14]:(n=Q(x7,`transition-colors hover:bg-muted/50`,e),t[13]=e,t[14]=n);let r;return t[15]!==h||t[16]!==o||t[17]!==n?(r=(0,X.jsx)(`button`,{className:n,"data-testid":`workflow-run-summary-row`,onClick:o,type:`button`,children:h}),t[15]=h,t[16]=o,t[17]=n,t[18]=r):r=t[18],r}let g;return t[19]===h?g=t[20]:(g=(0,X.jsx)(`div`,{className:x7,"data-testid":`workflow-run-summary-row`,children:h}),t[19]=h,t[20]=g),g}function Cye(e){let t=(0,Z.c)(36),{log:n,isLast:r}=e,[i,a]=(0,Y.useState)(!1),o;t[0]===r?o=t[1]:(o=r?null:(0,X.jsx)(`div`,{className:`absolute top-5 bottom-0 left-2 w-px bg-border`}),t[0]=r,t[1]=o);let s;t[2]===n.status?s=t[3]:(s=Q(`size-4 rounded-full ring-2 ring-background`,m7(n.status)),t[2]=n.status,t[3]=s);let c;t[4]===s?c=t[5]:(c=(0,X.jsx)(`div`,{className:`relative z-10 mt-1.5 flex shrink-0 items-center justify-center`,children:(0,X.jsx)(`div`,{className:s})}),t[4]=s,t[5]=c);let l;t[6]===i?l=t[7]:(l=()=>a(!i),t[6]=i,t[7]=l);let u=n.nodeName||n.nodeType,d;t[8]===u?d=t[9]:(d=(0,X.jsx)(`span`,{className:`truncate font-medium text-sm transition-colors group-hover:text-foreground`,children:u}),t[8]=u,t[9]=d);let f;t[10]===n.status?f=t[11]:(f=h7(n.status),t[10]=n.status,t[11]=f);let p;t[12]===f?p=t[13]:(p=(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:f}),t[12]=f,t[13]=p);let m;t[14]===n.duration?m=t[15]:(m=n.duration?(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground text-xs tabular-nums`,children:_7(n.duration)}):null,t[14]=n.duration,t[15]=m);let h;t[16]!==d||t[17]!==p||t[18]!==m?(h=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d,p,m]}),t[16]=d,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==h||t[21]!==l?(g=(0,X.jsx)(`button`,{className:`group w-full text-left`,onClick:l,type:`button`,children:h}),t[20]=h,t[21]=l,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==n.error||t[25]!==n.input||t[26]!==n.nodeType||t[27]!==n.output?(_=i?(0,X.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[n.input!==null&&n.input!==void 0?(0,X.jsx)(b7,{copyData:n.input,title:`Input`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(y7,{data:n.input})})}):null,n.output!==null&&n.output!==void 0?(0,X.jsx)(yye,{actionType:n.nodeType,input:n.input,output:n.output}):null,n.error?(0,X.jsx)(b7,{copyData:n.error,defaultExpanded:!0,isError:!0,title:`Error`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border border-destructive/20 bg-destructive/5 p-3 font-mono text-destructive text-xs leading-relaxed`,children:n.error})}):null,n.input||n.output||n.error?null:(0,X.jsx)(`div`,{className:`rounded-lg border bg-muted/30 py-4 text-center text-muted-foreground text-xs`,children:`No data recorded`})]}):null,t[23]=i,t[24]=n.error,t[25]=n.input,t[26]=n.nodeType,t[27]=n.output,t[28]=_):_=t[28];let v;t[29]!==g||t[30]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 pb-4`,children:[g,_]}),t[29]=g,t[30]=_,t[31]=v):v=t[31];let y;return t[32]!==o||t[33]!==v||t[34]!==c?(y=(0,X.jsxs)(`div`,{className:`relative flex gap-3`,children:[o,c,v]}),t[32]=o,t[33]=v,t[34]=c,t[35]=y):y=t[35],y}function wye(e){let t=(0,Z.c)(7),{logs:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`py-8 text-center text-muted-foreground text-xs`,children:`No steps recorded`}),t[0]=e):e=t[0],e}let r;if(t[1]!==n){let e;t[3]===n.length?e=t[4]:(e=(e,t)=>(0,X.jsx)(Cye,{isLast:t===n.length-1,log:e},e.id),t[3]=n.length,t[4]=e),r=n.map(e),t[1]=n,t[2]=r}else r=t[2];let i;return t[5]===r?i=t[6]:(i=(0,X.jsx)(`div`,{className:`pl-1`,children:r}),t[5]=r,t[6]=i),i}function Tye(e){let t=(0,Z.c)(32),{execution:n,runNumber:r,notice:i,logs:a,events:o,waits:s,isCanceling:c,isResuming:l,onBack:u,onCancel:d,onResume:f}=e,p;t[0]===a?p=t[1]:(p=a.toSorted(Dye),t[0]=a,t[1]=p);let m=p,h;t[2]===u?h=t[3]:(h={onBack:u,type:`back`},t[2]=u,t[3]=h);let g;t[4]!==n.status||t[5]!==c||t[6]!==d?(g=o7(n.status)?{isCanceling:c,onCancel:d,type:`cancel`}:{type:`spacer`},t[4]=n.status,t[5]=c,t[6]=d,t[7]=g):g=t[7];let _;t[8]!==n||t[9]!==r||t[10]!==h||t[11]!==g?(_=(0,X.jsx)(S7,{execution:n,leading:h,runNumber:r,showStartEventName:!0,trailing:g}),t[8]=n,t[9]=r,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v;t[13]===i?v=t[14]:(v=i?(0,X.jsx)(`p`,{className:`rounded-md border bg-muted/30 p-2 text-muted-foreground text-xs`,children:i}):null,t[13]=i,t[14]=v);let y;if(t[15]!==l||t[16]!==f||t[17]!==s){let e;t[19]!==l||t[20]!==f?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-1.5 rounded-md border bg-muted/30 p-2`,children:[(0,X.jsxs)(`p`,{className:`font-medium text-xs`,children:[`Parked at `,e.nodeName]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.subscribedEvents.length>0?`Waiting for ${e.subscribedEvents.join(`, `)}`:`Waiting on a timer`}),e.resumeToken?(0,X.jsx)(zv,{disabled:l,onClick:()=>f(e.resumeToken??``),size:`sm`,type:`button`,variant:`outline`,children:`Resume now`}):null]},e.id),t[19]=l,t[20]=f,t[21]=e):e=t[21],y=s.map(e),t[15]=l,t[16]=f,t[17]=s,t[18]=y}else y=t[18];let b;t[22]===m?b=t[23]:(b=(0,X.jsx)(wye,{logs:m}),t[22]=m,t[23]=b);let x;t[24]===o?x=t[25]:(x=o.length>0?(0,X.jsx)(b7,{title:`Audit Events`,children:(0,X.jsx)(`div`,{className:`space-y-2`,children:o.map(Eye)})}):null,t[24]=o,t[25]=x);let S;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==b||t[30]!==x?(S=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v,y,b,x]}),t[26]=_,t[27]=v,t[28]=y,t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Eye(e){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate font-medium text-xs`,children:e.message}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.eventType})]}),(0,X.jsx)(`div`,{className:`ml-3 shrink-0 text-xs text-muted-foreground`,children:d7(e.createdAt)})]},e.id)}function Dye(e,t){return new Date(e.startedAt).getTime()-new Date(t.startedAt).getTime()}function Oye(e){let t=(0,Z.c)(10),{executions:n,selectedId:r,onSelect:i}=e,a;if(t[0]!==n||t[1]!==i||t[2]!==r){let e;t[4]!==n.length||t[5]!==i||t[6]!==r?(e=(e,t)=>{let a=r===e.id,o=n.length-t;return(0,X.jsx)(S7,{execution:e,leading:{type:`spacer`},onClick:()=>i(e.id),runNumber:o,selected:a,trailing:{type:`spacer`}},e.id)},t[4]=n.length,t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a}else a=t[3];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`divide-y`,children:a}),t[8]=a,t[9]=o),o}var C7=2e3,w7=50,kye=`This run has left the runs list, so what it shows stops here. A newer start supersedes the runs going for the same entity, and the list holds the newest 50.`,Aye=ma(`/workflows/$workflowId`);function jye(){let e=(0,Z.c)(80),t=wA(Q0),n=wA(O2),r=Fe(),{executionId:i}=Aye.useSearch(),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={from:`/workflows/$workflowId`},e[0]=a):a=e[0];let o=Gi(a),s=c7(),[c,l]=(0,Y.useState)(!1),u=c||i!==void 0,d;e[1]!==t||e[2]!==u?(d=r0.workflow.getExecutions.queryOptions({input:{workflowId:t??``,includeSuperseded:u},select:Xve}),e[1]=t,e[2]=u,e[3]=d):d=e[3];let f=t!==null,p;e[4]!==d||e[5]!==f?(p={...d,enabled:f,staleTime:0,refetchInterval:C7,placeholderData:L},e[4]=d,e[5]=f,e[6]=p):p=e[6];let m=Xe(p),h;e[7]===m.data?.executions?h=e[8]:(h=m.data?.executions??[],e[7]=m.data?.executions,e[8]=h);let g=h,_=m.data?.supersededCount??0,v;e[9]===m.data?.refusedStarts?v=e[10]:(v=m.data?.refusedStarts??[],e[9]=m.data?.refusedStarts,e[10]=v);let y=v,b;e[11]!==i||e[12]!==g?(b=i===void 0?-1:g.findIndex(e=>e.id===i),e[11]=i,e[12]=g,e[13]=b):b=e[13];let x=b,S=x>=0?g[x]:void 0,C=o7(S?.status)?C7:!1,w;e[14]===i?w=e[15]:(w=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:i??``},select:Zve}),e[14]=i,e[15]=w);let T=i!==void 0,E;e[16]!==C||e[17]!==w||e[18]!==T?(E={...w,enabled:T,staleTime:0,refetchInterval:C},e[16]=C,e[17]=w,e[18]=T,e[19]=E):E=e[19];let D=Xe(E),O;e[20]===i?O=e[21]:(O=r0.workflow.getExecutionEvents.queryOptions({input:{executionId:i??``},select:nye}),e[20]=i,e[21]=O);let k=i!==void 0,A;e[22]!==C||e[23]!==O||e[24]!==k?(A={...O,enabled:k,staleTime:0,refetchInterval:C},e[22]=C,e[23]=O,e[24]=k,e[25]=A):A=e[25];let j=Xe(A),M;e[26]===r?M=e[27]:(M=r0.workflow.cancelExecution.mutationOptions({onSuccess:()=>s0(r),meta:{errorMessage:`Failed to cancel run`}}),e[26]=r,e[27]=M);let N=Ze(M),P;e[28]===r?P=e[29]:(P=r0.workflow.resumeWait.mutationOptions({onSuccess:()=>s0(r),meta:{errorMessage:`Failed to resume the run`}}),e[28]=r,e[29]=P);let F=Ze(P),I;e[30]===o?I=e[31]:(I=e=>{o({search:{executionId:e}})},e[30]=o,e[31]=I);let R=I;if(m.isPending&&i===void 0){let t;return e[32]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[32]=t):t=e[32],t}let z;e[33]!==c||e[34]!==_?(z=_>0?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-1 pb-2`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[_===1?`1 run was superseded by a newer start`:`${_} runs were superseded by newer starts`,_>w7?`, of which the newest ${w7} can be shown`:``]}),(0,X.jsx)(zv,{onClick:()=>l(Mye),size:`sm`,type:`button`,variant:`ghost`,children:c?`Hide`:`Show`})]}):null,e[33]=c,e[34]=_,e[35]=z):z=e[35];let B=z;if(i!==void 0){let t=S??D.data?.execution;if(!t){if(!D.isError&&(D.isPending||m.isPending)){let t;return e[36]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[36]=t):t=e[36],t}let t;e[37]===s?t=e[38]:(t=(0,X.jsx)(zv,{"aria-label":`Back to runs list`,onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:`Back`}),e[37]=s,e[38]=t);let n;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This run could not be loaded.`}),e[39]=n):n=e[39];let r;return e[40]===t?r=e[41]:(r=(0,X.jsxs)(`div`,{className:`space-y-2 px-1 py-2`,children:[t,n]}),e[40]=t,e[41]=r),r}let n=x>=0?g.length-x:0,r;e[42]===j.data?r=e[43]:(r=j.data??[],e[42]=j.data,e[43]=r);let i=N.isPending&&N.variables?.executionId===t.id,a;e[44]===D.data?.logs?a=e[45]:(a=D.data?.logs??[],e[44]=D.data?.logs,e[45]=a);let o=S?void 0:kye,c;e[46]===N?c=e[47]:(c=e=>N.mutate({executionId:e}),e[46]=N,e[47]=c);let l;e[48]===F?l=e[49]:(l=e=>F.mutate({token:e}),e[48]=F,e[49]=l);let u;e[50]===D.data?.waits?u=e[51]:(u=D.data?.waits??[],e[50]=D.data?.waits,e[51]=u);let d;return e[52]!==t||e[53]!==s||e[54]!==F.isPending||e[55]!==n||e[56]!==r||e[57]!==i||e[58]!==a||e[59]!==o||e[60]!==c||e[61]!==l||e[62]!==u?(d=(0,X.jsx)(Tye,{events:r,execution:t,isCanceling:i,isResuming:F.isPending,logs:a,notice:o,onBack:s,onCancel:c,onResume:l,runNumber:n,waits:u}),e[52]=t,e[53]=s,e[54]=F.isPending,e[55]=n,e[56]=r,e[57]=i,e[58]=a,e[59]=o,e[60]=c,e[61]=l,e[62]=u,e[63]=d):d=e[63],d}if(g.length===0){let t;e[64]===y?t=e[65]:(t=(0,X.jsx)(f7,{refusedStarts:y}),e[64]=y,e[65]=t);let n;e[66]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,X.jsx)(`div`,{className:`mb-3 rounded-lg border border-dashed p-4`,children:(0,X.jsx)(sy,{className:`size-6 text-muted-foreground`})}),(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:`No runs yet`}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground text-xs`,children:`Execute your workflow to see runs here`})]}),e[66]=n):n=e[66];let r;return e[67]!==B||e[68]!==t?(r=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,t,n]}),e[67]=B,e[68]=t,e[69]=r):r=e[69],r}let V;e[70]===y?V=e[71]:(V=(0,X.jsx)(f7,{refusedStarts:y}),e[70]=y,e[71]=V);let H;e[72]!==g||e[73]!==R||e[74]!==n?(H=(0,X.jsx)(Oye,{executions:g,onSelect:R,selectedId:n}),e[72]=g,e[73]=R,e[74]=n,e[75]=H):H=e[75];let U;return e[76]!==B||e[77]!==V||e[78]!==H?(U=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,V,H]}),e[76]=B,e[77]=V,e[78]=H,e[79]=U):U=e[79],U}function Mye(e){return!e}function T7(){let e=(0,Z.c)(3),t=wA(E2),n=TA(g2),r;return e[0]!==n||e[1]!==t?(r={validActiveTab:t,setActiveTab:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function Nye(){let{validActiveTab:e}=T7(),t=wA(H4),n=wA(U4);return e===`runs`?`Runs`:t?`Properties`:n?`Connection`:`Workflow`}function Pye(e){let t=(0,Z.c)(27),{placement:n,activeTab:r,onSelect:i,propertiesLabel:a,showRuns:o}=e;if(n===`bottom`){let e=`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`properties`?`text-foreground`:`text-muted-foreground`}`,n;t[0]===i?n=t[1]:(n=()=>i(`properties`),t[0]=i,t[1]=n);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(uy,{className:`size-5`}),t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==e||t[5]!==n?(c=(0,X.jsxs)(`button`,{className:e,onClick:n,type:`button`,children:[s,a]}),t[3]=a,t[4]=e,t[5]=n,t[6]=c):c=t[6];let l;t[7]!==r||t[8]!==i||t[9]!==o?(l=o?(0,X.jsxs)(`button`,{className:`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`runs`?`text-foreground`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:[(0,X.jsx)(sy,{className:`size-5`}),`Runs`]}):null,t[7]=r,t[8]=i,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==c||t[12]!==l?(u=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-around border-t bg-background pb-safe`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}let s=`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`properties`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,c;t[14]===i?c=t[15]:(c=()=>i(`properties`),t[14]=i,t[15]=c);let l;t[16]!==a||t[17]!==s||t[18]!==c?(l=(0,X.jsx)(`button`,{className:s,onClick:c,type:`button`,children:a}),t[16]=a,t[17]=s,t[18]=c,t[19]=l):l=t[19];let u;t[20]!==r||t[21]!==i||t[22]!==o?(u=o?(0,X.jsx)(`button`,{className:`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`runs`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:`Runs`}):null,t[20]=r,t[21]=i,t[22]=o,t[23]=u):u=t[23];let d;return t[24]!==l||t[25]!==u?(d=(0,X.jsx)(`div`,{className:`shrink-0 border-b px-4 py-2.5`,children:(0,X.jsxs)(`div`,{className:`inline-flex h-9 w-full items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground`,children:[l,u]})}),t[24]=l,t[25]=u,t[26]=d):d=t[26],d}function E7(e){let t=(0,Z.c)(82),{frame:n}=e,{updateConfig:r,refreshRuns:i,deleteRuns:a}=qve(),{validActiveTab:o,setActiveTab:s}=T7(),c=wA(H4),l=wA(U4),u=wA(Q4),d=wA($4),f=wA(T2),p=wA(Q0),m=wA($0),h=TA(pde),[g,_]=EA(n2),v=wA(t2),y=TA(m3),b=TA(h3),x=TA(X4),S=TA(Xfe),C=TA(Z4),w=TA(fpe),T=TA(g3),E=l0(),[D,O]=EA(a3),k,A,j,M,N;if(t[0]!==T||t[1]!==p||t[2]!==m||t[3]!==C||t[4]!==b||t[5]!==a||t[6]!==w||t[7]!==E||t[8]!==d||t[9]!==n||t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==v||t[14]!==D||t[15]!==u||t[16]!==h||t[17]!==l||t[18]!==c||t[19]!==s||t[20]!==S||t[21]!==O||t[22]!==_||t[23]!==x||t[24]!==y||t[25]!==o||t[26]!==g){let e;t[32]===c?e=t[33]:(e=e=>e.id===c,t[32]=c,t[33]=e);let P=u.find(e),F;if(t[34]!==d||t[35]!==l){let e;t[37]===l?e=t[38]:(e=e=>e.id===l,t[37]=l,t[38]=e),F=d.find(e),t[34]=d,t[35]=l,t[36]=F}else F=t[36];let I=F,L;t[39]===u?L=t[40]:(L=u.filter(Iye),t[39]=u,t[40]=L);let R=L,z;t[41]===d?z=t[42]:(z=d.filter(Fye),t[41]=d,t[42]=z);let B=z,V=R.length+B.length>1,H;t[43]!==B.length||t[44]!==R.length?(H=[],R.length>0&&H.push(`${R.length} ${R.length===1?`step`:`steps`}`),B.length>0&&H.push(`${B.length} ${B.length===1?`connection`:`connections`}`),t[43]=B.length,t[44]=R.length,t[45]=H):H=t[45];let U=H.join(` and `),W=e=>{P&&y({id:P.id,data:{label:e}})},G=e=>{P&&y({id:P.id,data:{description:e}})},K=P&&D0(P)?B0(u).has(P.id):!1,q=!!(P&&!P.parentId&&(P.data.type===`action`||D0(P))),J=P?D0(P)?K:P.data.enabled===!1:!1,ee=()=>{if(P){if(D0(P)){S({groupId:P.id,enabled:K});return}y({id:P.id,data:{enabled:P.data.enabled===!1}})}},te;t[46]!==h||t[47]!==_?(te=async e=>{let t=await h(e);t&&_(t.message||`Failed to update workflow name`)},t[46]=h,t[47]=_,t[48]=te):te=t[48];let ne=te,re=()=>{if(!P)return;let e=P.id;n.confirm({title:`Delete Step`,message:`Are you sure you want to delete this step? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{b(e),n.dismiss?.()}})},ie;t[49]!==C||t[50]!==n||t[51]!==l?(ie=()=>{l&&n.confirm({title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{C(l),n.dismiss?.()}})},t[49]=C,t[50]=n,t[51]=l,t[52]=ie):ie=t[52];let ae=ie,oe;t[53]!==w||t[54]!==n||t[55]!==U?(oe=()=>{n.confirm({title:`Delete Selected Items`,message:`Are you sure you want to delete ${U}? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{w(),n.dismiss?.()}})},t[53]=w,t[54]=n,t[55]=U,t[56]=oe):oe=t[56];let se=oe,ce;t[57]!==p||t[58]!==a||t[59]!==n?(ce=()=>{n.confirm({title:`Delete All Runs`,message:`Are you sure you want to delete all workflow runs? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{p&&a.mutate({workflowId:p})}})},t[57]=p,t[58]=a,t[59]=n,t[60]=ce):ce=t[60];let le=ce,ue;t[61]!==T||t[62]!==n?(ue=()=>{n.confirm({title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,onConfirm:()=>T()})},t[61]=T,t[62]=n,t[63]=ue):ue=t[63];let de=ue,fe;t[64]!==p||t[65]!==m||t[66]!==E||t[67]!==n?(fe=()=>{n.confirm({title:`Delete Workflow`,message:`Are you sure you want to delete "${m}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,onConfirm:()=>{p&&E.mutate({workflowId:p},{onSuccess:()=>n.dismiss?.()})}})},t[64]=p,t[65]=m,t[66]=E,t[67]=n,t[68]=fe):fe=t[68];let pe=fe,me=P?.data.type===`action`&&!P.data.config?.actionType&&v,he;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`You are viewing a public workflow. Duplicate it to make changes.`})}),t[69]=he):he=t[69];let ge=he,_e=()=>V?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{children:`Selection`}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[U,` selected`]})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:se,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):I&&!P?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-id`,children:`Connection ID`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-id`,value:I.id})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-source`,children:`Source`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-source`,value:I.source})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-target`,children:`Target`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-target`,value:I.target})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:ae,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):P?me?(0,X.jsx)(`div`,{className:`px-4 pt-4`,children:(0,X.jsx)(fve,{disabled:f,isNewlyCreated:P.id===D,onSelectAction:e=>{r({actionType:e}),P.id===D&&O(null)}},P.id)}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[P.data.type===`group`?(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Lookups and a Condition in a single-entry, single-exit frame. Lookups may run side by side and join at the Condition. True continues; False with no outgoing edge ends that path.`}):null,P.data.type===`lifecycle`?(0,X.jsx)(Bve,{config:P.data.config||{},disabled:f||!v,onUpdateConfig:r}):null,P.data.type===`action`&&!P.data.config?.actionType?(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No action configured for this step.`})}):null,P.data.type===`action`&&P.data.config?.actionType?(0,X.jsx)(E_e,{config:P.data.config||{},disabled:f||!v,isOwner:v,onUpdateConfig:r},P.id):null,P.data.type!==`action`||P.data.config?.actionType?(0,X.jsxs)(`div`,{className:P.data.type===`lifecycle`?`space-y-3 rounded-md border border-muted/70 bg-muted/20 p-3`:`space-y-4`,children:[P.data.type===`lifecycle`?(0,X.jsx)(`p`,{className:`font-medium text-muted-foreground text-sm`,children:`Node Metadata`}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`label`,children:`Label`}),(0,X.jsx)(wX,{disabled:f||!v,id:`label`,onChange:e=>W(e.target.value),value:P.data.label})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`description`,children:`Description`}),(0,X.jsx)(wX,{disabled:f||!v,id:`description`,onChange:e=>G(e.target.value),placeholder:`Optional description`,value:P.data.description||``})]})]}):null,v?null:ge,v&&P.parentId?(0,X.jsx)(`p`,{className:`pt-4 text-muted-foreground text-xs`,children:`This step runs with its Group. Select the frame to switch it off.`}):null,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[q?(0,X.jsx)(zv,{onClick:ee,size:`sm`,variant:`outline`,children:J?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Disabled`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Enabled`]})}):null,P4(P)?(0,X.jsxs)(zv,{onClick:()=>x(P.id),size:`sm`,variant:`outline`,children:[(0,X.jsx)(my,{className:`mr-2 size-4`}),`Ungroup`]}):null,M4([P])?null:(0,X.jsxs)(zv,{onClick:re,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`workflow-name`,children:`Workflow Name`}),(0,X.jsx)(wX,{className:g?`border-destructive`:void 0,disabled:!v,id:`workflow-name`,onChange:e=>ne(e.target.value),value:m}),g?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:g}):null]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`workflow-id`,children:`Workflow ID`}),(0,X.jsx)(wX,{disabled:!0,id:`workflow-id`,value:p||`Not saved`})]}),v?null:ge,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:de,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear`]}),(0,X.jsxs)(zv,{onClick:pe,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}),ve=P||I||V?`Properties`:`Workflow`,ye;t[70]!==n.tabs||t[71]!==v||t[72]!==s||t[73]!==ve||t[74]!==o?(ye=(0,X.jsx)(Pye,{activeTab:o,onSelect:s,placement:n.tabs,propertiesLabel:ve,showRuns:v}),t[70]=n.tabs,t[71]=v,t[72]=s,t[73]=ve,t[74]=o,t[75]=ye):ye=t[75],N=ye,k=`flex min-h-0 flex-1 flex-col`,A=`properties-panel`,j=n.tabs===`top`?N:null,M=o===`properties`?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-gutter:stable_both-edges]`,children:_e()}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:[(0,X.jsxs)(zv,{onClick:i,size:`sm`,variant:`outline`,children:[(0,X.jsx)(Dte,{className:`mr-2 size-4`}),`Refresh`]}),(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:le,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear All`]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable_both-edges]`,children:(0,X.jsx)(jye,{})})]}),t[0]=T,t[1]=p,t[2]=m,t[3]=C,t[4]=b,t[5]=a,t[6]=w,t[7]=E,t[8]=d,t[9]=n,t[10]=i,t[11]=r,t[12]=f,t[13]=v,t[14]=D,t[15]=u,t[16]=h,t[17]=l,t[18]=c,t[19]=s,t[20]=S,t[21]=O,t[22]=_,t[23]=x,t[24]=y,t[25]=o,t[26]=g,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let P=n.tabs===`bottom`?N:null,F;return t[76]!==k||t[77]!==A||t[78]!==j||t[79]!==M||t[80]!==P?(F=(0,X.jsxs)(`div`,{className:k,"data-testid":A,children:[j,M,P]}),t[76]=k,t[77]=A,t[78]=j,t[79]=M,t[80]=P,t[81]=F):F=t[81],F}function Fye(e){return e.selected}function Iye(e){return e.selected}function D7(e){let t=(0,Z.c)(16),{overlayId:n}=e,{push:r,closeAll:i}=RY(),a=Nye(),o=jY(),s;t[0]!==i||t[1]!==o?(s=()=>{o||i()},t[0]=i,t[1]=o,t[2]=s):s=t[2],vY(o,s);let c;t[3]===r?c=t[4]:(c=e=>{let{title:t,message:n,confirmLabel:i,onConfirm:a}=e;return r(CX,{title:t,message:n,confirmLabel:i,confirmVariant:`destructive`,destructive:!0,onConfirm:a})},t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c?(l={confirm:c,dismiss:i,tabs:`bottom`},t[5]=i,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]!==n||t[9]!==a?(d=(0,X.jsx)(xX,{overlayId:n,title:a}),t[8]=n,t[9]=a,t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,X.jsx)(E7,{frame:u}),t[11]=u,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-full max-h-[80vh] flex-col`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function O7(){let e=(0,Z.c)(11),{open:t,push:n}=RY(),r=l7(),i;e[0]===r?i=e[1]:(i=()=>{AY()&&r()},e[0]=r,e[1]=i);let a=i,o;e[2]!==a||e[3]!==t?(o=()=>{t(D7,{},{onClose:a})},e[2]=a,e[3]=t,e[4]=o):o=e[4];let s=o,c;e[5]!==a||e[6]!==n?(c=()=>{n(D7,{},{onClose:a})},e[5]=a,e[6]=n,e[7]=c):c=e[7];let l=c,u;return e[8]!==s||e[9]!==l?(u={openSheet:s,pushSheet:l},e[8]=s,e[9]=l,e[10]=u):u=e[10],u}function Lye(){let e=(0,Z.c)(2),t=rE(Rye),n;return e[0]===t?n=e[1]:(n=()=>{document.documentElement.style.setProperty(`--rf-zoom`,String(t))},e[0]=t,e[1]=n),vY(t,n),null}function Rye(e){return e.transform[2]}var zye=e=>{let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`Backspace`,`Delete`],t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=[`Meta`,`Control`,`Shift`],t[4]=a):a=t[4];let o,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(Lye,{}),s=(0,X.jsx)(tk,{bgColor:`var(--sidebar)`,color:`var(--border)`,gap:24,size:2}),t[5]=o,t[6]=s):(o=t[5],s=t[6]);let c;return t[7]!==n||t[8]!==r?(c=(0,X.jsxs)(WO,{deleteKeyCode:i,fitView:!0,multiSelectionKeyCode:a,panActivationKeyCode:null,selectionOnDrag:!1,zoomOnDoubleClick:!1,zoomOnPinch:!0,...r,children:[o,s,n]}),t[7]=n,t[8]=r,t[9]=c):c=t[9],c},Bye=16,Vye=16;function k7(e){return mT({...e,borderRadius:Bye,offset:Vye})}var Hye=e=>{let t=(0,Z.c)(15),{fromX:n,fromY:r,fromPosition:i,toX:a,toY:o,toPosition:s}=e,c;t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==o?(c=k7({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:o,targetPosition:s}),t[0]=i,t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=o,t[6]=c):c=t[6];let[l]=c,u;t[7]===l?u=t[8]:(u=(0,X.jsx)(`path`,{className:`animated`,d:l,fill:`none`,stroke:`var(--color-ring)`,strokeDasharray:`5, 5`,strokeWidth:1}),t[7]=l,t[8]=u);let d;t[9]!==a||t[10]!==o?(d=(0,X.jsx)(`circle`,{cx:a,cy:o,fill:`#fff`,r:3,stroke:`var(--color-ring)`,strokeWidth:1}),t[9]=a,t[10]=o,t[11]=d):d=t[11];let f;return t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`g`,{children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14],f},Uye=d_(`flex w-fit shrink-0 items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function A7(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=Q(Uye({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,X.jsx)(`div`,{className:a,"data-orientation":r,"data-slot":`button-group`,role:`group`,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var Wye=e=>{let t=(0,Z.c)(33),{onReflow:n,canReflow:r}=e,i=r===void 0||r,{zoomIn:a,zoomOut:o,fitView:s}=RE(),[c,l]=EA(_2),u;t[0]===a?u=t[1]:(u=()=>{a()},t[0]=a,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{o()},t[2]=o,t[3]=f);let p=f,m;t[4]===s?m=t[5]:(m=()=>{s({padding:.2,duration:300})},t[4]=s,t[5]=m);let h=m,g;t[6]!==l||t[7]!==c?(g=()=>{l(!c)},t[6]=l,t[7]=c,t[8]=g):g=t[8];let _=g,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Pte,{className:`size-4`}),t[9]=v):v=t[9];let y;t[10]===d?y=t[11]:(y=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:d,size:`icon`,title:`Zoom in`,variant:`secondary`,children:v}),t[10]=d,t[11]=y);let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(Fte,{className:`size-4`}),t[12]=b):b=t[12];let x;t[13]===p?x=t[14]:(x=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:p,size:`icon`,title:`Zoom out`,variant:`secondary`,children:b}),t[13]=p,t[14]=x);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(xte,{className:`size-4`}),t[15]=S):S=t[15];let C;t[16]===h?C=t[17]:(C=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:h,size:`icon`,title:`Fit view`,variant:`secondary`,children:S}),t[16]=h,t[17]=C);let w=c?`Hide minimap`:`Show minimap`,T;t[18]===c?T=t[19]:(T=c?(0,X.jsx)(bte,{className:`size-4`}):(0,X.jsx)(yte,{className:`size-4`}),t[18]=c,t[19]=T);let E;t[20]!==_||t[21]!==w||t[22]!==T?(E=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:_,size:`icon`,title:w,variant:`secondary`,children:T}),t[20]=_,t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==i||t[25]!==n?(D=n?(0,X.jsx)(zv,{"aria-label":`Reflow nodes`,className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:!i,onClick:n,size:`icon`,title:`Reflow nodes`,variant:`secondary`,children:(0,X.jsx)(Ete,{className:`size-4`})}):null,t[24]=i,t[25]=n,t[26]=D):D=t[26];let O;return t[27]!==C||t[28]!==E||t[29]!==D||t[30]!==y||t[31]!==x?(O=(0,X.jsxs)(A7,{orientation:`vertical`,children:[y,x,C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=y,t[31]=x,t[32]=O):O=t[32],O};function j7(e){return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function Gye(e){navigator.clipboard.writeText(e),Ty.success(`Copied to clipboard`)}function Kye(e){let t=(0,Z.c)(19),{overlayId:n,onCreated:r}=e,{pop:i}=RY(),a=Fe(),[o,s]=(0,Y.useState)(``),c;t[0]!==r||t[1]!==i||t[2]!==a?(c=r0.apiKey.create.mutationOptions({onSuccess:async e=>{r(e.key),Ty.success(`API key created successfully`),await a.invalidateQueries({queryKey:r0.apiKey.key()}),i()},meta:{errorMessage:`Failed to create API key`}}),t[0]=r,t[1]=i,t[2]=a,t[3]=c):c=t[3];let l=Ze(c),u;t[4]!==l||t[5]!==o?(u=()=>l.mutate({name:o||null}),t[4]=l,t[5]=o,t[6]=u):u=t[6];let d;t[7]!==l.isPending||t[8]!==u?(d=[{label:`Create`,onClick:u,loading:l.isPending}],t[7]=l.isPending,t[8]=u,t[9]=d):d=t[9];let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(`p`,{className:`mb-4 text-muted-foreground text-sm`,children:`Create a new API key for webhook authentication`}),t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(TX,{htmlFor:`key-name`,children:`Label (optional)`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>s(e.target.value),t[12]=m):m=t[12];let h;t[13]===o?h=t[14]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,(0,X.jsx)(wX,{id:`key-name`,onChange:m,placeholder:`e.g., Production, Testing`,value:o})]}),t[13]=o,t[14]=h);let g;return t[15]!==n||t[16]!==d||t[17]!==h?(g=(0,X.jsxs)(SX,{actions:d,overlayId:n,title:`Create API Key`,children:[f,h]}),t[15]=n,t[16]=d,t[17]=h,t[18]=g):g=t[18],g}function qye(e){let t=(0,Z.c)(26),{overlayId:n}=e,{push:r,closeAll:i}=RY(),a=Fe(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...r0.apiKey.getAll.queryOptions({input:{}}),meta:{errorMessage:`Failed to load API keys`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,[d,f]=(0,Y.useState)(null),p;t[3]===a?p=t[4]:(p=r0.apiKey.delete.mutationOptions({onSuccess:async()=>{Ty.success(`API key deleted`),await a.invalidateQueries({queryKey:r0.apiKey.key()})},meta:{errorMessage:`Failed to delete API key`}}),t[3]=a,t[4]=p);let m=Ze(p),h=m.isPending?m.variables?.keyId:void 0,g;t[5]!==m||t[6]!==r?(g=e=>{r(CX,{title:`Delete API Key`,message:`Are you sure you want to delete this API key? Any webhooks using this key will stop working immediately.`,confirmLabel:`Delete`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>m.mutate({keyId:e})})},t[5]=m,t[6]=r,t[7]=g):g=t[7];let _=g,v;t[8]===r?v=t[9]:(v={label:`New API Key`,variant:`outline`,onClick:()=>r(Kye,{onCreated:f})},t[8]=r,t[9]=v);let y;t[10]===i?y=t[11]:(y={label:`Done`,onClick:i},t[10]=i,t[11]=y);let b;t[12]!==v||t[13]!==y?(b=[v,y],t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys for webhook authentication`}),t[15]=x):x=t[15];let S;t[16]!==u||t[17]!==h||t[18]!==c||t[19]!==d||t[20]!==_?(S=c?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d&&(0,X.jsxs)(`div`,{className:`rounded-md border border-warning/50 bg-warning/10 p-3`,children:[(0,X.jsx)(`p`,{className:`mb-2 font-medium text-sm text-warning`,children:`Copy your API key now. You won't be able to see it again!`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 font-mono text-xs`,children:d}),(0,X.jsx)(zv,{onClick:()=>Gye(d),size:`sm`,variant:`outline`,children:(0,X.jsx)($v,{className:`size-4`})})]}),(0,X.jsx)(zv,{className:`mt-2`,onClick:()=>f(null),size:`sm`,variant:`ghost`,children:`Dismiss`})]}),u.length===0?(0,X.jsxs)(`div`,{className:`py-8 text-center text-muted-foreground text-sm`,children:[(0,X.jsx)(iy,{className:`mx-auto mb-2 size-8 opacity-50`}),(0,X.jsx)(`p`,{children:`No API keys yet`}),(0,X.jsx)(`p`,{className:`text-xs`,children:`Create an API key to authenticate webhook requests`})]}):(0,X.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:[e.keyPrefix,`...`]}),e.name&&(0,X.jsx)(`span`,{className:`truncate text-sm`,children:e.name})]}),(0,X.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[`Created `,j7(e.createdAt),e.lastUsedAt&&` · Last used ${j7(e.lastUsedAt)}`]})]}),(0,X.jsx)(zv,{disabled:h===e.id,onClick:()=>_(e.id),size:`sm`,variant:`ghost`,children:h===e.id?(0,X.jsx)(_y,{className:`size-4`}):(0,X.jsx)(fy,{className:`size-4 text-destructive`})})]},e.id))})]}),t[16]=u,t[17]=h,t[18]=c,t[19]=d,t[20]=_,t[21]=S):S=t[21];let C;return t[22]!==n||t[23]!==S||t[24]!==b?(C=(0,X.jsxs)(SX,{actions:b,overlayId:n,title:`API Keys`,children:[x,S]}),t[22]=n,t[23]=S,t[24]=b,t[25]=C):C=t[25],C}function Jye(e){let t=(0,Z.c)(24),{filter:n}=e,r=n===void 0?``:n,i=yy(),{push:a}=RY(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...i0(),meta:{errorMessage:`Failed to load integrations`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=r0.integration.testConnection.mutationOptions({onSuccess:S3,meta:{errorMessage:`Connection test failed`}}),t[3]=d):d=t[3];let f=Ze(d),p;if(t[4]!==i||t[5]!==r||t[6]!==u){let e=r.toLowerCase(),n;t[8]===i?n=t[9]:(n=e=>{let t=Fy(i,e.type);return{...e,label:t?.label??e.type,hasTest:t?.hasTest===!0,known:t!==void 0}},t[8]=i,t[9]=n),p=u.map(n).filter(t=>!r||t.label.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)).toSorted(Yye),t[4]=i,t[5]=r,t[6]=u,t[7]=p}else p=t[7];let m=p,h;t[10]===a?h=t[11]:(h=e=>{a(w3,{integration:e})},t[10]=a,t[11]=h);let g=h,_;t[12]===a?_=t[13]:(_=e=>{a(T3,{integration:e})},t[12]=a,t[13]=_);let v=_,y=f.isPending?f.variables?.integrationId:void 0;if(c){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}),t[14]=e):e=t[14],e}let b;t[15]!==v||t[16]!==g||t[17]!==u.length||t[18]!==m||t[19]!==f||t[20]!==y?(b=()=>u.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections configured yet`})}):m.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections match your filter`})}):(0,X.jsx)(`div`,{className:`space-y-1`,children:m.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b3,{className:`size-4`,integration:e.type}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:e.name}),e.known?null:(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Not available in this build`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.hasTest&&(0,X.jsx)(zv,{className:`h-7 px-2`,disabled:y===e.id,onClick:()=>f.mutate({integrationId:e.id}),size:`sm`,variant:`outline`,children:y===e.id?(0,X.jsx)(_y,{className:`size-3`}):(0,X.jsx)(`span`,{className:`text-xs`,children:`Test`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>g(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(oy,{className:`size-3`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>v(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(fy,{className:`size-3`})})]})]},e.id))}),t[15]=v,t[16]=g,t[17]=u.length,t[18]=m,t[19]=f,t[20]=y,t[21]=b):b=t[21];let x=b,S;return t[22]===x?S=t[23]:(S=(0,X.jsx)(`div`,{className:`space-y-1`,children:x()}),t[22]=x,t[23]=S),S}function Yye(e,t){let n=e.label.localeCompare(t.label);return n===0?e.name.localeCompare(t.name):n}function Xye(e){let t=(0,Z.c)(25),{overlayId:n}=e,{push:r,closeAll:i}=RY(),[a,o]=(0,Y.useState)(``),s;t[0]===r?s=t[1]:(s=()=>{r(bpe,{})},t[0]=r,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=()=>i(),t[2]=i,t[3]=l);let u=l,d;t[4]===c?d=t[5]:(d={label:`Add Connection`,variant:`outline`,onClick:c},t[4]=c,t[5]=d);let f;t[6]===u?f=t[7]:(f={label:`Done`,onClick:u},t[6]=u,t[7]=f);let p;t[8]!==d||t[9]!==f?(p=[d,f],t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys and credentials used by your workflows`}),t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>o(e.target.value),t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=(0,X.jsxs)(`div`,{className:`relative`,children:[h,(0,X.jsx)(wX,{className:`pl-9`,onChange:g,placeholder:`Filter connections...`,value:a})]}),t[14]=a,t[15]=_);let v;t[16]===a?v=t[17]:(v=(0,X.jsx)(`div`,{className:`max-h-[300px] overflow-y-auto`,children:(0,X.jsx)(Jye,{filter:a})}),t[16]=a,t[17]=v);let y;t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20];let b;return t[21]!==n||t[22]!==y||t[23]!==p?(b=(0,X.jsxs)(SX,{actions:p,overlayId:n,title:`Connections`,children:[m,y]}),t[21]=n,t[22]=y,t[23]=p,t[24]=b):b=t[24],b}var Zye=()=>{let e=(0,Z.c)(25),{theme:t,setTheme:n}=eX(),{open:r}=RY(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(U5,{render:(0,X.jsx)(zv,{className:`h-9`,size:`sm`,variant:`outline`}),children:`Settings`}),e[0]=i):i=e[0];let a;e[1]===r?a=e[2]:(a=()=>r(Xye),e[1]=r,e[2]=a);let o,s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(wte,{className:`size-4`}),s=(0,X.jsx)(`span`,{children:`Connections`}),e[3]=o,e[4]=s):(o=e[3],s=e[4]);let c;e[5]===a?c=e[6]:(c=(0,X.jsxs)(G5,{onClick:a,children:[o,s]}),e[5]=a,e[6]=c);let l;e[7]===r?l=e[8]:(l=()=>r(qye),e[7]=r,e[8]=l);let u,d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(iy,{className:`size-4`}),d=(0,X.jsx)(`span`,{children:`API Keys`}),e[9]=u,e[10]=d):(u=e[9],d=e[10]);let f;e[11]===l?f=e[12]:(f=(0,X.jsxs)(G5,{onClick:l,children:[u,d]}),e[11]=l,e[12]=f);let p;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(q5,{}),e[13]=p):p=e[13];let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsxs)(ive,{children:[(0,X.jsx)(jte,{className:`size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,X.jsx)(Ste,{className:`absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,X.jsx)(`span`,{children:`Theme`})]}),e[14]=m):m=e[14];let h,g,_;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(K5,{value:`light`,children:`Light`}),g=(0,X.jsx)(K5,{value:`dark`,children:`Dark`}),_=(0,X.jsx)(K5,{value:`system`,children:`System`}),e[15]=h,e[16]=g,e[17]=_):(h=e[15],g=e[16],_=e[17]);let v;e[18]!==n||e[19]!==t?(v=(0,X.jsxs)(rve,{children:[m,(0,X.jsx)(ave,{children:(0,X.jsxs)(nve,{onValueChange:n,value:t,children:[h,g,_]})})]}),e[18]=n,e[19]=t,e[20]=v):v=e[20];let y;return e[21]!==v||e[22]!==c||e[23]!==f?(y=(0,X.jsxs)(H5,{children:[i,(0,X.jsxs)(W5,{align:`end`,className:`w-56`,children:[c,f,p,v]})]}),e[21]=v,e[22]=c,e[23]=f,e[24]=y):y=e[24],y};function Qye(e){let t=(0,Z.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M125.776 0C120.929 1.64945e-05 117 3.9291 117 8.77539V61.4248C117 66.2711 120.929 70.2002 125.776 70.2002H160.875L161.253 70.2051C169.032 70.4023 175.301 76.6734 175.495 84.4531L175.5 84.8252V143.325C175.5 148.171 179.429 152.101 184.276 152.101H219.375L219.753 152.105C227.53 152.303 233.798 158.571 233.995 166.348L234 166.726V225.225C234 230.071 237.929 234 242.776 234H295.425C300.271 234 304.2 230.071 304.2 225.225V172.575C304.2 167.729 300.271 163.8 295.425 163.8H260.25C252.334 163.76 245.905 157.43 245.705 149.553L245.7 149.176V90.6758C245.7 85.8295 241.771 81.9004 236.925 81.9004H201.825C193.874 81.9004 187.405 75.5551 187.205 67.6523L187.2 67.2754V8.77539C187.2 3.9291 183.271 1.64951e-05 178.425 0H125.776Z`}),i=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M67.2755 81.9004C62.4293 81.9004 58.5002 85.8295 58.5002 90.6758V143.325C58.5004 148.171 62.4294 152.101 67.2755 152.101H102.375L102.753 152.105C110.53 152.303 116.798 158.571 116.995 166.348L117 166.726V225.225C117 230.071 120.929 234 125.776 234H178.425C183.271 234 187.2 230.071 187.2 225.225V172.575C187.2 167.729 183.271 163.8 178.425 163.8H143.25C135.334 163.76 128.905 157.43 128.705 149.553L128.7 149.176V90.6758C128.7 85.8295 124.771 81.9004 119.925 81.9004H67.2755Z`}),a=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M8.77454 163.8C3.92844 163.8 0.00012207 167.729 0.00012207 172.575V225.225C0.00012207 230.071 3.92844 234 8.77454 234H61.4249C66.2712 234 70.2003 230.071 70.2003 225.225V172.575C70.2003 167.729 66.2712 163.8 61.4249 163.8H8.77454Z`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,X.jsxs)(`svg`,{className:n,fill:`none`,height:`16`,viewBox:`0 0 305 234`,width:`16`,xmlns:`http://www.w3.org/2000/svg`,children:[r,i,a]}),t[3]=n,t[4]=o),o}function $ye(e){let t=new Set(e.map(e=>e.toLowerCase())),n=`New Workflow`;if(!t.has(`new workflow`))return n;let r=2;for(;t.has(`${n} (${r})`.toLowerCase());)r+=1;return`${n} (${r})`}function M7(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r,existingWorkflowNames:i,onCreated:a}=e,o;t[0]===i?o=t[1]:(o=()=>$ye(i),t[0]=i,t[1]=o);let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(null),d=Fe(),f;if(t[2]!==a||t[3]!==r||t[4]!==d){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{u(e instanceof X1?e.message:`Failed to create workflow`)},t[6]=e):e=t[6],f=r0.workflow.create.mutationOptions({onSuccess:async e=>{await a0(d),await a(e.id),r(!1),Ty.success(`Workflow created`)},onError:e,meta:{errorShownByCaller:!0}}),t[2]=a,t[3]=r,t[4]=d,t[5]=f}else f=t[5];let p=Ze(f),m=p.isPending,h;t[7]!==p||t[8]!==s?(h=()=>{let e=s.trim();if(!e){u(`Workflow name is required.`);return}u(null),p.mutate({name:e,graph:B1({nodes:[],edges:[]})})},t[7]=p,t[8]=s,t[9]=h):h=t[9];let g=h,_;t[10]!==m||t[11]!==r?(_=e=>{e||m||r(!1)},t[10]=m,t[11]=r,t[12]=_):_=t[12];let v=_,y=!m,b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(fY,{children:[(0,X.jsx)(mY,{children:`Create Workflow`}),(0,X.jsx)(hY,{children:`Choose a name for the new workflow.`})]}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(TX,{htmlFor:`create-workflow-name`,children:`Name`}),t[14]=x):x=t[14];let S=l?!0:void 0,C;t[15]===l?C=t[16]:(C=e=>{c(e.target.value),l&&u(null)},t[15]=l,t[16]=C);let w;t[17]===g?w=t[18]:(w=e=>{e.key===`Enter`&&(e.preventDefault(),g())},t[17]=g,t[18]=w);let T;t[19]!==m||t[20]!==w||t[21]!==S||t[22]!==C||t[23]!==s?(T=(0,X.jsx)(wX,{"aria-invalid":S,autoFocus:!0,disabled:m,id:`create-workflow-name`,onChange:C,onKeyDown:w,placeholder:`Workflow name`,value:s}),t[19]=m,t[20]=w,t[21]=S,t[22]=C,t[23]=s,t[24]=T):T=t[24];let E;t[25]===l?E=t[26]:(E=l?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:l}):null,t[25]=l,t[26]=E);let D;t[27]!==T||t[28]!==E?(D=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[x,T,E]}),t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===r?O=t[31]:(O=()=>{r(!1)},t[30]=r,t[31]=O);let k;t[32]!==m||t[33]!==O?(k=(0,X.jsx)(zv,{disabled:m,onClick:O,type:`button`,variant:`outline`,children:`Cancel`}),t[32]=m,t[33]=O,t[34]=k):k=t[34];let A=m?`Creating...`:`Create Workflow`,j;t[35]!==g||t[36]!==m||t[37]!==A?(j=(0,X.jsx)(zv,{disabled:m,onClick:g,type:`button`,children:A}),t[35]=g,t[36]=m,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==k||t[40]!==j?(M=(0,X.jsxs)(pY,{children:[k,j]}),t[39]=k,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==D||t[43]!==M||t[44]!==y?(N=(0,X.jsxs)(dY,{showCloseButton:y,children:[b,D,M]}),t[42]=D,t[43]=M,t[44]=y,t[45]=N):N=t[45];let P;return t[46]!==v||t[47]!==n||t[48]!==N?(P=(0,X.jsx)(cY,{onOpenChange:v,open:n,children:N}),t[46]=v,t[47]=n,t[48]=N,t[49]=P):P=t[49],P}function ebe(e){let t=(0,Z.c)(10),{isPublishing:n,disabled:r,handlePublish:i}=e,a=r||n,o=n?`Publishing...`:`Publish workflow`,s;t[0]===n?s=t[1]:(s=n?(0,X.jsx)(ay,{className:`size-4 animate-spin`,"data-icon":`inline-start`}):(0,X.jsx)(Nte,{className:`size-4`,"data-icon":`inline-start`}),t[0]=n,t[1]=s);let c=n?`Publishing`:`Publish`,l;t[2]===c?l=t[3]:(l=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:c}),t[2]=c,t[3]=l);let u;return t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==l?(u=(0,X.jsxs)(zv,{className:`relative gap-1.5`,disabled:a,onClick:i,size:`default`,title:o,variant:`default`,children:[s,l]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function tbe(e){let t=(0,Z.c)(9),{state:n,handleSave:r}=e,i;t[0]===n.nodes?i=t[1]:(i=n.nodes.some(nbe),t[0]=n.nodes,t[1]=i);let a=!i||n.isGenerating||n.isSaving,o=n.isSaving?`Saving...`:`Save workflow`,s;t[2]===n.isSaving?s=t[3]:(s=n.isSaving?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(Ote,{className:`size-4`}),t[2]=n.isSaving,t[3]=s);let c;return t[4]!==r||t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,X.jsx)(zv,{className:`relative border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:a,onClick:r,size:`icon`,title:o,variant:`secondary`,children:s}),t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function nbe(e){return e.type!==`add`}function rbe(e){let t=(0,Z.c)(8),{state:n,actions:r}=e,i=n.isExecuting||n.nodes.length===0||n.isGenerating||!n.currentWorkflowId,a;t[0]===r?a=t[1]:(a=()=>r.handleExecute(),t[0]=r,t[1]=a);let o;t[2]===n.isExecuting?o=t[3]:(o=n.isExecuting?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(sy,{className:`size-4`}),t[2]=n.isExecuting,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,X.jsx)(A7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:i,onClick:a,size:`icon`,title:`Run Workflow`,variant:`secondary`,children:o})}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function ibe(e){let t=(0,Z.c)(6),{isDuplicating:n,onDuplicate:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,X.jsx)(ay,{className:`mr-2 size-4 animate-spin`}):(0,X.jsx)($v,{className:`mr-2 size-4`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,X.jsxs)(zv,{className:`h-9 border hover:bg-secondary dark:hover:bg-secondary`,disabled:n,onClick:r,size:`sm`,title:`Duplicate to your workflows`,variant:`secondary`,children:[i,`Duplicate`]}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function abe(e){let t=(0,Z.c)(79),{workflowId:n,state:r,actions:i}=e,{push:a}=RY(),{openSheet:o}=O7(),[s]=EA(H4),[c]=EA(U4),l=wA(Q4),u=wA($4),d=TA(h3),f=TA(Z4),{screenToFlowPosition:p}=RE(),m=jY(),h=wA(n3),g;if(t[0]!==l||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e.id===s,t[3]=s,t[4]=e),g=l.find(e),t[0]=l,t[1]=s,t[2]=g}else g=t[2];let _=g,v;if(t[5]!==u||t[6]!==c){let e;t[8]===c?e=t[9]:(e=e=>e.id===c,t[8]=c,t[9]=e),v=u.find(e),t[5]=u,t[6]=c,t[7]=v}else v=t[7];let y=_||v,b;t[10]!==h||t[11]!==r?(b=h||r.isSaving||!r.nodes.some(obe),t[10]=h,t[11]=r,t[12]=b):b=t[12];let x=b;if(n&&!r.isOwner)return null;let S;t[13]!==f||t[14]!==d||t[15]!==a||t[16]!==c||t[17]!==s?(S=()=>{let e=s?`Node`:`Connection`;a(CX,{title:`Delete ${e}`,message:`Are you sure you want to delete this ${e.toLowerCase()}? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s?d(s):c&&f(c)}})},t[13]=f,t[14]=d,t[15]=a,t[16]=c,t[17]=s,t[18]=S):S=t[18];let C=S,w;t[19]!==p||t[20]!==r?(w=()=>{let e=document.querySelector(`.react-flow`);if(!e)return;let t=e.getBoundingClientRect(),n=t.left+t.width/2,i=t.top+t.height/2,a=p({x:n,y:i});a.x-=96,a.y-=56;let o={...a},s=!0,c=0;for(;s&&c<20;)s=r.nodes.some(e=>Math.abs(e.position.x-o.x)<192&&Math.abs(e.position.y-o.y)<112),s&&(o.x+=20,o.y+=20,c+=1);let l={id:u0(),type:`action`,position:o,data:{label:``,description:``,type:`action`,config:{},status:`idle`}};r.addNode(l),r.setSelectedNodeId(l.id),r.setActiveTab(`properties`)},t[19]=p,t[20]=r,t[21]=w):w=t[21];let T=w,E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(cy,{className:`size-4`}),t[22]=E):E=t[22];let D;t[23]!==T||t[24]!==r.isGenerating?(D=(0,X.jsx)(A7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:r.isGenerating,onClick:T,size:`icon`,title:`Add Step`,variant:`secondary`,children:E})}),t[23]=T,t[24]=r.isGenerating,t[25]=D):D=t[25];let O=m?``:`hidden`,k;t[26]===O?k=t[27]:(k=Q(`flex`,O),t[26]=O,t[27]=k);let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(uy,{className:`size-4`}),t[28]=A):A=t[28];let j;t[29]===o?j=t[30]:(j=(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:o,size:`icon`,title:`Configuration`,variant:`secondary`,children:A}),t[29]=o,t[30]=j);let M;t[31]!==C||t[32]!==y?(M=y&&(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:C,size:`icon`,title:`Delete`,variant:`secondary`,children:(0,X.jsx)(fy,{className:`size-4`})}),t[31]=C,t[32]=y,t[33]=M):M=t[33];let N;t[34]!==j||t[35]!==M||t[36]!==k?(N=(0,X.jsxs)(A7,{className:k,orientation:`horizontal`,children:[j,M]}),t[34]=j,t[35]=M,t[36]=k,t[37]=N):N=t[37];let P=!r.canUndo||r.isGenerating,F;t[38]===r?F=t[39]:(F=()=>r.undo(),t[38]=r,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(Mte,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==P||t[42]!==F?(L=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:P,onClick:F,size:`icon`,title:`Undo`,variant:`secondary`,children:I}),t[41]=P,t[42]=F,t[43]=L):L=t[43];let R=!r.canRedo||r.isGenerating,z;t[44]===r?z=t[45]:(z=()=>r.redo(),t[44]=r,t[45]=z);let B;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(Tte,{className:`size-4`}),t[46]=B):B=t[46];let V;t[47]!==R||t[48]!==z?(V=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:R,onClick:z,size:`icon`,title:`Redo`,variant:`secondary`,children:B}),t[47]=R,t[48]=z,t[49]=V):V=t[49];let H;t[50]!==L||t[51]!==V?(H=(0,X.jsxs)(A7,{className:`flex`,orientation:`horizontal`,children:[L,V]}),t[50]=L,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==i.handleSave||t[54]!==r?(U=(0,X.jsx)(tbe,{handleSave:i.handleSave,state:r}),t[53]=i.handleSave,t[54]=r,t[55]=U):U=t[55];let W;t[56]!==i.handlePublish||t[57]!==i.isPublishing||t[58]!==x?(W=(0,X.jsx)(ebe,{disabled:x,handlePublish:i.handlePublish,isPublishing:i.isPublishing}),t[56]=i.handlePublish,t[57]=i.isPublishing,t[58]=x,t[59]=W):W=t[59];let G;t[60]!==U||t[61]!==W?(G=(0,X.jsxs)(A7,{className:`flex`,orientation:`horizontal`,children:[U,W]}),t[60]=U,t[61]=W,t[62]=G):G=t[62];let K;t[63]!==i||t[64]!==r?(K=(0,X.jsx)(rbe,{actions:i,state:r}),t[63]=i,t[64]=r,t[65]=K):K=t[65];let q;t[66]!==i||t[67]!==r.isGenerating||t[68]!==r.isSaving||t[69]!==r.workflowMode||t[70]!==n?(q=n&&(0,X.jsx)(A7,{"aria-label":`Workflow mode`,className:`flex`,orientation:`horizontal`,role:`radiogroup`,children:[`live`,`test`].map(e=>{let t=r.workflowMode===e;return(0,X.jsx)(zv,{"aria-checked":t,className:`border`,disabled:r.isSaving||r.isGenerating,onClick:()=>i.handleSetWorkflowMode(e),role:`radio`,size:`default`,variant:t?`default`:`outline`,children:e===`live`?`Live`:`Test`},e)})}),t[66]=i,t[67]=r.isGenerating,t[68]=r.isSaving,t[69]=r.workflowMode,t[70]=n,t[71]=q):q=t[71];let J;return t[72]!==N||t[73]!==H||t[74]!==G||t[75]!==K||t[76]!==q||t[77]!==D?(J=(0,X.jsxs)(X.Fragment,{children:[D,N,H,G,K,q]}),t[72]=N,t[73]=H,t[74]=G,t[75]=K,t[76]=q,t[77]=D,t[78]=J):J=t[78],J}function obe(e){return e.type!==`add`}function sbe(e){let t=(0,Z.c)(52),{workflowId:n,state:r,actions:i}=e,a=Gi(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(0),u;t[0]===a?u=t[1]:(u=()=>a({to:`/`}),t[0]=a,t[1]=u);let d,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(Qye,{className:`size-4 shrink-0`}),f=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:`Dashboard`}),t[2]=d,t[3]=f):(d=t[2],f=t[3]);let p;t[4]===u?p=t[5]:(p=(0,X.jsxs)(`button`,{className:`flex h-full shrink-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,onClick:u,type:`button`,children:[d,f]}),t[4]=u,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/60`,children:`/`}),t[6]=m):m=t[6];let h;t[7]===i?h=t[8]:(h=e=>e&&i.loadWorkflows(),t[7]=i,t[8]=h);let g=r.workflowName||`Untitled workflow`,_;t[9]===g?_=t[10]:(_=(0,X.jsx)(`p`,{className:`truncate font-medium text-sm`,children:g}),t[9]=g,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Jv,{className:`size-3 shrink-0 opacity-50`}),t[11]=v):v=t[11];let y;t[12]===_?y=t[13]:(y=(0,X.jsxs)(U5,{className:`flex h-full min-w-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,children:[_,v]}),t[12]=_,t[13]=y);let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(G5,{className:`flex items-center gap-2`,onClick:()=>{l(ube),s(!0)},children:[(0,X.jsx)(cy,{className:`size-4`}),`New Workflow...`]}),x=(0,X.jsx)(q5,{}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]!==a||t[17]!==r.allWorkflows||t[18]!==r.currentWorkflowId?(S=r.allWorkflows.length===0?(0,X.jsx)(G5,{disabled:!0,children:`No workflows found`}):r.allWorkflows.filter(lbe).map(e=>(0,X.jsxs)(G5,{className:`flex items-center justify-between`,onClick:()=>a({to:`/workflows/$workflowId`,params:{workflowId:e.id}}),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.id===r.currentWorkflowId&&(0,X.jsx)(qv,{className:`size-4 shrink-0`})]},e.id)),t[16]=a,t[17]=r.allWorkflows,t[18]=r.currentWorkflowId,t[19]=S):S=t[19];let C;t[20]!==i||t[21]!==r.isOwner||t[22]!==n?(C=n&&r.isOwner&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q5,{}),(0,X.jsxs)(G5,{className:`flex items-center gap-2`,disabled:i.isDuplicating,onClick:i.handleDuplicate,children:[i.isDuplicating?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)($v,{className:`size-4`}),`Duplicate`]}),(0,X.jsxs)(G5,{className:`flex items-center gap-2 text-destructive focus:text-destructive`,onClick:i.handleDeleteWorkflow,children:[(0,X.jsx)(fy,{className:`size-4`}),`Delete Workflow`]})]}),t[20]=i,t[21]=r.isOwner,t[22]=n,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C?(w=(0,X.jsxs)(W5,{align:`start`,className:`w-64`,children:[b,x,S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==y||t[28]!==w||t[29]!==h?(T=(0,X.jsxs)(H5,{onOpenChange:h,children:[y,w]}),t[27]=y,t[28]=w,t[29]=h,t[30]=T):T=t[30];let E;t[31]!==T||t[32]!==p?(E=(0,X.jsxs)(`div`,{className:`flex h-9 max-w-[260px] items-center overflow-hidden rounded-md border bg-secondary text-secondary-foreground sm:max-w-none`,children:[p,m,T]}),t[31]=T,t[32]=p,t[33]=E):E=t[33];let D;t[34]!==r.isOwner||t[35]!==n?(D=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs @xl:hidden`,children:`Read-only`}),t[34]=r.isOwner,t[35]=n,t[36]=D):D=t[36];let O;t[37]!==E||t[38]!==D?(O=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E,D]}),t[37]=E,t[38]=D,t[39]=O):O=t[39];let k;t[40]===r.allWorkflows?k=t[41]:(k=r.allWorkflows.map(cbe),t[40]=r.allWorkflows,t[41]=k);let A;t[42]===a?A=t[43]:(A=e=>a({to:`/workflows/$workflowId`,params:{workflowId:e}}),t[42]=a,t[43]=A);let j;t[44]!==c||t[45]!==o||t[46]!==k||t[47]!==A?(j=(0,X.jsx)(M7,{existingWorkflowNames:k,onCreated:A,onOpenChange:s,open:o},c),t[44]=c,t[45]=o,t[46]=k,t[47]=A,t[48]=j):j=t[48];let M;return t[49]!==O||t[50]!==j?(M=(0,X.jsxs)(X.Fragment,{children:[O,j]}),t[49]=O,t[50]=j,t[51]=M):M=t[51],M}function cbe(e){return e.name}function lbe(e){return e.name!==`__current__`}function ube(e){return e+1}function dbe(e,t){if(!t)return;let n=t.trim();if(!n)return;let r=Ka(n.split(`.`)),i=e;for(let e of r){if(i==null)return;if(Array.isArray(i)){if(!/^\d+$/.test(e))return;let t=Number(e);if(!Number.isSafeInteger(t))return;i=i[t];continue}if(typeof i==`object`){i=i[e];continue}return}return i}function fbe(e,t,n){let r=Ka(t.trim().split(`.`)),i=r.pop();if(!i)return e;let a=e;for(let e of r){let t=a[e],n=typeof t==`object`&&t&&!Array.isArray(t)?t:{};a[e]=n,a=n}return a[i]=n,e}function pbe(e){return!e.path.includes(`[`)&&e.type!==`array`&&e.type!==`object`}function mbe(e){return e.enumValues&&e.enumValues.length>0?`select`:e.type===`boolean`?`checkbox`:e.type===`number`?`number`:e.type===`timestamp`?`datetime`:`text`}function N7(e){return e?e.payloadFields.filter(pbe).map(e=>({path:e.path,...e.description?{description:e.description}:{},control:mbe(e),...e.enumValues?{options:[...e.enumValues]}:{},optional:e.nullable===!0})):[]}function hbe(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function P7(e,t){let n={};for(let r of e){let e=dbe(t,r.path);if(e==null){n[r.path]=``;continue}let i=typeof e==`string`?e:JSON.stringify(e);n[r.path]=r.control===`datetime`?hbe(i):i}return n}function gbe(e,t){let n=t.trim();if(n){if(e.control===`checkbox`)return n===`true`;if(e.control===`number`){let e=Number(n);return Number.isFinite(e)?e:n}if(e.control===`datetime`){let e=new Date(n);return Number.isNaN(e.getTime())?n:Hde(e)}return n}}function _be(e,t,n={}){let r=structuredClone(n);for(let n of e){let e=gbe(n,t[n.path]??``);e!==void 0&&fbe(r,n.path,e)}return r}function F7(e){let t=e.trim();if(!t)return{ok:!0,payload:{}};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:`This is not valid JSON.`}}let r=lue(n);return r?{ok:!0,payload:r}:{ok:!1,error:`A payload has to be a JSON object.`}}function I7(e){return e.find(e=>e.data.type===`lifecycle`)}function vbe(e){return C1(I7(e)?.data.config)}function L7(e){return due(I7(e)?.data.config)??{}}function ybe(e,t){return t.eventName?{...e,byEvent:{...e.byEvent,[t.eventName]:t.input}}:{...e,manual:t.input}}var R7=``;function bbe(e,t){return Ny(e,t)?.label??t}function xbe(e){let t=(0,Z.c)(29),{field:n,value:r,onChange:i}=e;if(n.control===`checkbox`){let e=r===`true`,a;t[0]===i?a=t[1]:(a=e=>i(e?`true`:`false`),t[0]=i,t[1]=a);let o;return t[2]!==n.path||t[3]!==e||t[4]!==a?(o=(0,X.jsx)(e7,{checked:e,id:n.path,onCheckedChange:a}),t[2]=n.path,t[3]=e,t[4]=a,t[5]=o):o=t[5],o}if(n.control===`select`){let e;t[6]===i?e=t[7]:(e=H6(i),t[6]=i,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(U6,{placeholder:`Choose a value`}),t[8]=a):a=t[8];let o;t[9]===n.path?o=t[10]:(o=(0,X.jsx)(W6,{className:`w-full`,id:n.path,children:a}),t[9]=n.path,t[10]=o);let s;t[11]===n.options?s=t[12]:(s=n.options??[],t[11]=n.options,t[12]=s);let c;t[13]===s?c=t[14]:(c=s.map(z7),t[13]=s,t[14]=c);let l;t[15]===c?l=t[16]:(l=(0,X.jsx)(G6,{children:c}),t[15]=c,t[16]=l);let u;return t[17]!==e||t[18]!==o||t[19]!==l||t[20]!==r?(u=(0,X.jsxs)(V6,{onValueChange:e,value:r,children:[o,l]}),t[17]=e,t[18]=o,t[19]=l,t[20]=r,t[21]=u):u=t[21],u}let a;t[22]===i?a=t[23]:(a=e=>i(e.target.value),t[22]=i,t[23]=a);let o=n.control===`number`?`number`:n.control===`datetime`?`datetime-local`:`text`,s;return t[24]!==n.path||t[25]!==a||t[26]!==o||t[27]!==r?(s=(0,X.jsx)(wX,{id:n.path,onChange:a,type:o,value:r}),t[24]=n.path,t[25]=a,t[26]=o,t[27]=r,t[28]=s):s=t[28],s}function z7(e){return(0,X.jsx)(K6,{value:e,children:e},e)}function Sbe(e){let t=(0,Z.c)(10),{fields:n,values:r,onChange:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This Event declares no payload field the form can draw. Use the JSON tab to write the payload.`}),t[0]=e):e=t[0],e}let a;if(t[1]!==n||t[2]!==i||t[3]!==r){let e;t[5]!==i||t[6]!==r?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(TX,{className:`font-mono text-xs`,htmlFor:e.path,children:[e.path,e.optional&&(0,X.jsx)(`span`,{className:`ml-2 font-sans text-muted-foreground`,children:`optional`})]}),(0,X.jsx)(xbe,{field:e,onChange:t=>i(e.path,t),value:r[e.path]??``}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]},e.path),t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[1]=n,t[2]=i,t[3]=r,t[4]=a}else a=t[4];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[8]=a,t[9]=o),o}function Cbe(e){let t=(0,Z.c)(92),{overlayId:n,startEvents:r,allowManualStart:i,hasEventSplit:a,savedPayloads:o,onRun:s}=e,c=yy(),{closeAll:l}=RY(),[u,d]=(0,Y.useState)(r[0]??R7),[f,p]=(0,Y.useState)(`form`),m=u===R7?void 0:u,h;t[0]!==m||t[1]!==o?(h=N1(o,m),t[0]=m,t[1]=o,t[2]=h):h=t[2];let g=h,_;t[3]!==c||t[4]!==m?(_=N7(m?Ny(c,m):void 0),t[3]=c,t[4]=m,t[5]=_):_=t[5];let v=_,y;t[6]!==v||t[7]!==g?(y=()=>P7(v,g),t[6]=v,t[7]=g,t[8]=y):y=t[8];let[b,x]=(0,Y.useState)(y),S;t[9]===g?S=t[10]:(S=()=>JSON.stringify(g??{},null,2),t[9]=g,t[10]=S);let[C,w]=(0,Y.useState)(S),[T,E]=(0,Y.useState)(null),D;t[11]===g?D=t[12]:(D=()=>g??{},t[11]=g,t[12]=D);let[O,k]=(0,Y.useState)(D),A;t[13]!==c||t[14]!==o?(A=e=>{d(e);let t=e===R7?void 0:e,n=N1(o,t)??{},r=N7(t?Ny(c,t):void 0);x(P7(r,n)),w(JSON.stringify(n,null,2)),k(n),E(null)},t[13]=c,t[14]=o,t[15]=A):A=t[15];let j=A,M;t[16]!==O||t[17]!==v||t[18]!==b?(M=()=>_be(v,b,O),t[16]=O,t[17]=v,t[18]=b,t[19]=M):M=t[19];let N=M,P;t[20]===N?P=t[21]:(P=()=>{w(JSON.stringify(N(),null,2)),E(null),p(`json`)},t[20]=N,t[21]=P);let F=P,I;t[22]!==v||t[23]!==C?(I=()=>{let e=F7(C);if(!e.ok){E(e.error);return}x(P7(v,e.payload)),k(e.payload),E(null),p(`form`)},t[22]=v,t[23]=C,t[24]=I):I=t[24];let L=I,R=!a||m!==void 0,z;t[25]!==l||t[26]!==N||t[27]!==m||t[28]!==C||t[29]!==s||t[30]!==f?(z=()=>{if(f===`json`){let e=F7(C);if(!e.ok){E(e.error);return}s({...m?{eventName:m}:{},input:e.payload}),l();return}s({...m?{eventName:m}:{},input:N()}),l()},t[25]=l,t[26]=N,t[27]=m,t[28]=C,t[29]=s,t[30]=f,t[31]=z):z=t[31];let B=z,V;t[32]===l?V=t[33]:(V={label:`Cancel`,variant:`outline`,onClick:l},t[32]=l,t[33]=V);let H=!R,U;t[34]!==B||t[35]!==H?(U={label:`Run`,onClick:B,disabled:H},t[34]=B,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==V||t[38]!==U?(W=[V,U],t[37]=V,t[38]=U,t[39]=W):W=t[39];let G;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,X.jsx)(TX,{htmlFor:`testRunEvent`,children:`Which Event does this run stand in for?`}),t[40]=G):G=t[40];let K;t[41]===j?K=t[42]:(K=H6(j),t[41]=j,t[42]=K);let q;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(W6,{className:`w-full`,id:`testRunEvent`,children:(0,X.jsx)(U6,{placeholder:`Choose an Event`})}),t[43]=q):q=t[43];let J;if(t[44]!==c||t[45]!==r){let e;t[47]===c?e=t[48]:(e=e=>(0,X.jsx)(K6,{value:e,children:bbe(c,e)},e),t[47]=c,t[48]=e),J=r.map(e),t[44]=c,t[45]=r,t[46]=J}else J=t[46];let ee;t[49]!==i||t[50]!==a?(ee=i&&(0,X.jsx)(K6,{disabled:a,value:R7,children:`No Event (manual start)`}),t[49]=i,t[50]=a,t[51]=ee):ee=t[51];let te;t[52]!==J||t[53]!==ee?(te=(0,X.jsxs)(G6,{children:[J,ee]}),t[52]=J,t[53]=ee,t[54]=te):te=t[54];let ne;t[55]!==u||t[56]!==K||t[57]!==te?(ne=(0,X.jsxs)(V6,{onValueChange:K,value:u,children:[q,te]}),t[55]=u,t[56]=K,t[57]=te,t[58]=ne):ne=t[58];let re;t[59]===a?re=t[60]:(re=a&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This workflow splits on the Event a run is on, so a run has to name one.`}),t[59]=a,t[60]=re);let ie;t[61]!==ne||t[62]!==re?(ie=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[G,ne,re]}),t[61]=ne,t[62]=re,t[63]=ie):ie=t[63];let ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Payload`}),t[64]=ae):ae=t[64];let oe=f===`form`?`secondary`:`ghost`,se;t[65]!==L||t[66]!==oe?(se=(0,X.jsx)(zv,{onClick:L,size:`sm`,variant:oe,children:`Form`}),t[65]=L,t[66]=oe,t[67]=se):se=t[67];let ce=f===`json`?`secondary`:`ghost`,le;t[68]!==F||t[69]!==ce?(le=(0,X.jsx)(zv,{onClick:F,size:`sm`,variant:ce,children:`JSON`}),t[68]=F,t[69]=ce,t[70]=le):le=t[70];let ue;t[71]!==se||t[72]!==le?(ue=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[ae,(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[se,le]})]}),t[71]=se,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==v||t[75]!==C||t[76]!==f||t[77]!==b?(de=f===`form`?(0,X.jsx)(Sbe,{fields:v,onChange:(e,t)=>x(n=>({...n,[e]:t})),values:b}):(0,X.jsx)(`textarea`,{"aria-label":`Payload JSON`,className:`min-h-64 w-full rounded-md border border-input bg-transparent p-3 font-mono text-xs shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,onChange:e=>{w(e.target.value),E(null)},spellCheck:!1,value:C}),t[74]=v,t[75]=C,t[76]=f,t[77]=b,t[78]=de):de=t[78];let fe;t[79]===T?fe=t[80]:(fe=T&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:T}),t[79]=T,t[80]=fe);let pe;t[81]!==ue||t[82]!==de||t[83]!==fe?(pe=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[ue,de,fe]}),t[81]=ue,t[82]=de,t[83]=fe,t[84]=pe):pe=t[84];let me;t[85]!==ie||t[86]!==pe?(me=(0,X.jsxs)(`div`,{className:`space-y-6`,children:[ie,pe]}),t[85]=ie,t[86]=pe,t[87]=me):me=t[87];let he;return t[88]!==n||t[89]!==W||t[90]!==me?(he=(0,X.jsx)(SX,{actions:W,description:`A test run carries the payload an Event would have sent, so every template downstream resolves the way it will in production.`,overlayId:n,title:`Test run`,children:me}),t[88]=n,t[89]=W,t[90]=me,t[91]=he):he=t[91],he}function B7(e){let t=(0,Z.c)(38),{overlayId:n,issues:r,onGoToStep:i,onRunAnyway:a,allowRunAnyway:o}=e,s=o!==void 0&&o,{push:c,closeAll:l}=RY(),{pushSheet:u}=O7(),d=jY(),f=E3(),{brokenReferences:p,missingRequiredFields:m,missingIntegrations:h}=r,g=p.length+m.length+h.length,_;t[0]!==l||t[1]!==d||t[2]!==i||t[3]!==u?(_=(e,t)=>{i(e,t),d?u():l()},t[0]=l,t[1]=d,t[2]=i,t[3]=u,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==f?(y=e=>{c(C3,{type:e,onSuccess:()=>void f()})},t[5]=c,t[6]=f,t[7]=y):y=t[7];let b=y,x;t[8]!==l||t[9]!==a?(x=()=>{a&&(l(),a())},t[8]=l,t[9]=a,t[10]=x):x=t[10];let S=x,C=m.length+h.length,w;t[11]!==s||t[12]!==l||t[13]!==S||t[14]!==a?(w=s&&a?[{label:`Run Anyway`,variant:`outline`,onClick:S},{label:`Cancel`,onClick:l}]:[{label:`Close`,onClick:l}],t[11]=s,t[12]=l,t[13]=S,t[14]=a,t[15]=w):w=t[15];let T=`Workflow Issues (${g})`,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-warning`,children:[(0,X.jsx)(py,{className:`size-5`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This workflow has issues that may cause it to fail.`})]}),t[16]=E):E=t[16];let D;t[17]===C?D=t[18]:(D=C>0&&(0,X.jsx)(`p`,{className:`mt-2 text-destructive text-sm`,children:`Resolve blocking issues before running this workflow.`}),t[17]=C,t[18]=D);let O;t[19]!==b||t[20]!==h?(O=h.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Connections`}),h.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,X.jsx)(b3,{className:`size-4 shrink-0`,integration:e.integrationType}),(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.integrationLabel}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — `,e.nodeNames.length>3?`${e.nodeNames.slice(0,3).join(`, `)} +${e.nodeNames.length-3} more`:e.nodeNames.join(`, `)]})]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>b(e.integrationType),size:`sm`,variant:`outline`,children:`Add`})]},e.integrationType))]}),t[19]=b,t[20]=h,t[21]=O):O=t[21];let k;t[22]!==p||t[23]!==v?(k=p.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Broken References`}),p.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.brokenReferences.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:t.displayText}),` in `,t.fieldLabel]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}-${t.displayText}-${t.fieldLabel}`))})]},e.nodeId))]}),t[22]=p,t[23]=v,t[24]=k):k=t[24];let A;t[25]!==v||t[26]!==m?(A=m.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Required Fields`}),m.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.missingFields.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:t.fieldLabel}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}`))})]},e.nodeId))]}),t[25]=v,t[26]=m,t[27]=A):A=t[27];let j;t[28]!==k||t[29]!==A||t[30]!==O?(j=(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[O,k,A]}),t[28]=k,t[29]=A,t[30]=O,t[31]=j):j=t[31];let M;return t[32]!==n||t[33]!==j||t[34]!==w||t[35]!==T||t[36]!==D?(M=(0,X.jsxs)(SX,{actions:w,overlayId:n,title:T,children:[E,D,j]}),t[32]=n,t[33]=j,t[34]=w,t[35]=T,t[36]=D,t[37]=M):M=t[37],M}function V7(e){return e instanceof HTMLElement&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)}var wbe=jy(`workflow`,`run`),Tbe={workflow_paused:`Workflow is paused and cannot start new runs.`,concurrency_first_wins:`A run for this entity is already going, and this workflow keeps the first one.`,entity_value_missing:`This payload carries nothing at the workflow's Correlation Path, and its Concurrency needs an entity to compare.`,manual_start_not_allowed:`This workflow does not list manual runs as a start source.`,start_event_required:`This workflow splits on the Event a run is on, so a run has to name one.`};function H7(e,t,n){t(e.map(e=>({nodeId:e.id,status:n})))}function Ebe(e){let t=I7(e.nodes);t&&e.updateNodeData({id:t.id,data:{config:{...t.data.config,testPayloads:ybe(L7(e.nodes),e.request)}}})}async function Dbe({runWorkflow:e,nodes:t,setNodeStatuses:n,setIsExecuting:r,navigateToExecution:i}){H7(t,n,`idle`),n(t.filter(e=>e.data.type===`lifecycle`).map(e=>({nodeId:e.id,status:`running`})));try{let a=await e();if(a.status!==`running`||!a.executionId){Ty.message(a.status===`ignored`?Tbe[a.reason]:`Execution completed without starting a new run.`),r(!1),H7(t,n,`idle`);return}if(typeof a.supersededExecutions==`number`&&a.supersededExecutions>0){let e=Array.isArray(a.failedToSupersede)?a.failedToSupersede.length:0,t=`Superseded ${a.supersededExecutions} run${a.supersededExecutions===1?``:`s`} for this entity and started a new one.`;e>0?Ty.error(`${t} ${e} could not be signalled and may still be running. Cancel them from the Runs panel.`):Ty.success(t)}await i(a.executionId)}catch(e){wbe.error(`Failed to execute the workflow`,{error:e}),H7(t,n,`error`),r(!1)}}function Obe(e){let t=(0,Z.c)(53),{currentWorkflowId:n,workflowName:r,nodes:i,edges:a,updateNodeData:o,isExecuting:s,setIsExecuting:c,setCurrentWorkflowName:l,setWorkflowNameError:u,setIsTransitioningFromHomepage:d,setActiveTab:f,setSelectedNodeId:p,userIntegrations:m}=e,h=yy(),[g,_]=(0,Y.useState)(null),{open:v}=RY(),y=Gi(),b=Fe(),x=TA(ape),S=TA(V4),C=TA(y3),w=TA(d2),T=TA(hde),E;t[0]===b?E=t[1]:(E=r0.workflow.execute.mutationOptions({onSuccess:()=>s0(b)}),t[0]=b,t[1]=E);let D=Ze(E),O;t[2]!==T||t[3]!==n||t[4]!==a||t[5]!==y||t[6]!==i||t[7]!==w||t[8]!==l||t[9]!==d||t[10]!==u||t[11]!==r?(O=async()=>{if(!i.some(kbe)){u(`Add at least one step before saving.`);return}let e=r.trim();if(!e){u(`Workflow name is required.`);return}if(n){let t=await w({name:e,nodes:i,edges:a},{immediate:!0});if(t&&!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}l(e),u(null);return}let t=await T({name:e,nodes:i,edges:a});if(!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}d(!0),await y({to:`/workflows/$workflowId`,params:{workflowId:t.workflow.id},replace:!0})},t[2]=T,t[3]=n,t[4]=a,t[5]=y,t[6]=i,t[7]=w,t[8]=l,t[9]=d,t[10]=u,t[11]=r,t[12]=O):O=t[12];let k=O,A;t[13]!==x||t[14]!==n||t[15]!==y||t[16]!==i||t[17]!==D||t[18]!==f||t[19]!==S||t[20]!==c||t[21]!==C||t[22]!==p||t[23]!==o?(A=async e=>{if(!n){Ty.error(`Please save the workflow before executing`);return}Ebe({nodes:i,updateNodeData:o,request:e}),f(`runs`),S(null),x(),p(null),c(!0),await Dbe({runWorkflow:()=>D.mutateAsync({workflowId:n,input:e.input,...e.eventName?{eventName:e.eventName}:{}}),nodes:i,setNodeStatuses:C,setIsExecuting:c,navigateToExecution:e=>y({to:`/workflows/$workflowId`,params:{workflowId:n},search:{executionId:e}})})},t[13]=x,t[14]=n,t[15]=y,t[16]=i,t[17]=D,t[18]=f,t[19]=S,t[20]=c,t[21]=C,t[22]=p,t[23]=o,t[24]=A):A=t[24];let j=A,M;t[25]!==j||t[26]!==i||t[27]!==v?(M=()=>{let e=vbe(i)??S1;v(Cbe,{startEvents:e.startEvents,allowManualStart:E1(e),hasEventSplit:i.some(Z6),savedPayloads:L7(i),onRun:e=>{j(e)}})},t[25]=j,t[26]=i,t[27]=v,t[28]=M):M=t[28];let N=M,P;t[29]!==f||t[30]!==p?(P=(e,t)=>{p(e),f(`properties`),_(t??null)},t[29]=f,t[30]=p,t[31]=P):P=t[31];let F=P,I;t[32]===g?I=t[33]:(I=()=>{if(!g)return;_(null);let e=document.getElementById(g);e&&(e.focus(),e.scrollIntoView({behavior:`smooth`,block:`center`}))},t[32]=g,t[33]=I),yY(g,I);let L;t[34]!==h||t[35]!==F||t[36]!==s||t[37]!==i||t[38]!==v||t[39]!==N||t[40]!==m?(L=async()=>{if(s)return;let e=y4({nodes:G1(i),catalog:h,integrations:m});if(e.length>0){let t=b4(e);v(B7,{issues:x4(e),onGoToStep:F,onRunAnyway:t?void 0:N,allowRunAnyway:!t});return}N()},t[34]=h,t[35]=F,t[36]=s,t[37]=i,t[38]=v,t[39]=N,t[40]=m,t[41]=L):L=t[41];let R=L,z;t[42]!==h||t[43]!==F||t[44]!==i||t[45]!==v||t[46]!==m?(z=()=>{let e=y4({nodes:G1(i),catalog:h,integrations:m});v(B7,{issues:x4(e),onGoToStep:F,allowRunAnyway:!1})},t[42]=h,t[43]=F,t[44]=i,t[45]=v,t[46]=m,t[47]=z):z=t[47];let B=z,V;return t[48]!==R||t[49]!==F||t[50]!==k||t[51]!==B?(V={handleSave:k,handleExecute:R,handleShowIssues:B,handleGoToStep:F},t[48]=R,t[49]=F,t[50]=k,t[51]=B,t[52]=V):V=t[52],V}function kbe(e){return e.type!==`add`}function Abe(){let e=(0,Z.c)(33),t=wA(Q4),n=wA($4),[r,i]=EA(w2),[a]=EA(T2),o=TA(g3),s=TA(m3),[c]=EA(Q0),[l,u]=EA($0),[d,f]=EA(e2),p=TA(n2),m=TA(v2),h=wA(t2),g=wA(a2),_=wA(o2),v=TA(_3),y=TA(v3),b=TA(u3),[x]=EA(ppe),[S]=EA(mpe),C=TA(g2),w=TA(H4),T;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=i0(),e[0]=T):T=e[0];let{data:E}=Xe(T),D;e[1]===E?D=e[2]:(D=E===void 0?[]:E,e[1]=E,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=Pue(),e[3]=k):k=e[3];let{data:A}=Xe(k),j;e[4]===A?j=e[5]:(j=A===void 0?[]:A,e[4]=A,e[5]=j);let M=j,N;return e[6]!==b||e[7]!==M||e[8]!==S||e[9]!==x||e[10]!==o||e[11]!==c||e[12]!==n||e[13]!==_||e[14]!==r||e[15]!==a||e[16]!==h||e[17]!==g||e[18]!==t||e[19]!==y||e[20]!==C||e[21]!==f||e[22]!==u||e[23]!==i||e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==v||e[28]!==s||e[29]!==O||e[30]!==d||e[31]!==l?(N={nodes:t,edges:n,isExecuting:r,setIsExecuting:i,isGenerating:a,clearWorkflow:o,updateNodeData:s,currentWorkflowId:c,workflowName:l,workflowMode:d,setCurrentWorkflowName:u,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,isOwner:h,isSaving:g,hasUnsavedChanges:_,undo:v,redo:y,addNode:b,canUndo:x,canRedo:S,allWorkflows:M,setActiveTab:C,setSelectedNodeId:w,userIntegrations:O},e[6]=b,e[7]=M,e[8]=S,e[9]=x,e[10]=o,e[11]=c,e[12]=n,e[13]=_,e[14]=r,e[15]=a,e[16]=h,e[17]=g,e[18]=t,e[19]=y,e[20]=C,e[21]=f,e[22]=u,e[23]=i,e[24]=m,e[25]=w,e[26]=p,e[27]=v,e[28]=s,e[29]=O,e[30]=d,e[31]=l,e[32]=N):N=e[32],N}function jbe(e){let t=(0,Z.c)(62),n=yy(),{open:r}=RY(),i=Gi(),a=Fe(),o=l0(),s=TA(mde),{currentWorkflowId:c,workflowName:l,workflowMode:u,setCurrentWorkflowName:d,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,clearWorkflow:b,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C}=e,w;t[0]!==c||t[1]!==g||t[2]!==v||t[3]!==h||t[4]!==x||t[5]!==d||t[6]!==y||t[7]!==m||t[8]!==S||t[9]!==p||t[10]!==_||t[11]!==C||t[12]!==l?(w={currentWorkflowId:c,workflowName:l,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,setCurrentWorkflowName:d,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C},t[0]=c,t[1]=g,t[2]=v,t[3]=h,t[4]=x,t[5]=d,t[6]=y,t[7]=m,t[8]=S,t[9]=p,t[10]=_,t[11]=C,t[12]=l,t[13]=w):w=t[13];let{handleSave:T,handleExecute:E,handleShowIssues:D,handleGoToStep:O}=Obe(w),k;t[14]===E?k=t[15]:(k=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(V7(e.target)||(e.preventDefault(),e.stopPropagation(),E()))},t[14]=E,t[15]=k);let A=k,j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j={capture:!0},t[16]=j):j=t[16],_Y(document,`keydown`,A,j);let M;t[17]!==b||t[18]!==r?(M=()=>{r(CX,{title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{b()}})},t[17]=b,t[18]=r,t[19]=M):M=t[19];let N=M,P;t[20]!==c||t[21]!==o||t[22]!==r||t[23]!==l?(P=()=>{r(CX,{title:`Delete Workflow`,message:`Are you sure you want to delete "${l}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{c&&o.mutate({workflowId:c})}})},t[20]=c,t[21]=o,t[22]=r,t[23]=l,t[24]=P):P=t[24];let F=P,I;t[25]===a?I=t[26]:(I=()=>a0(a),t[25]=a,t[26]=I);let L=I,R;t[27]!==L||t[28]!==i?(R=r0.workflow.duplicate.mutationOptions({onSuccess:async e=>{Ty.success(`Workflow duplicated successfully`),await L(),await i({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},meta:{errorMessage:`Failed to duplicate workflow. Please try again.`}}),t[27]=L,t[28]=i,t[29]=R):R=t[29];let z=Ze(R),B;t[30]!==L||t[31]!==a?(B=r0.workflow.publish.mutationOptions({onSuccess:e=>{Ty.success(`Published version ${e.publishedVersion}`),o0(a,e),L()}}),t[30]=L,t[31]=a,t[32]=B):B=t[32];let V=Ze(B),H;t[33]!==c||t[34]!==z?(H=()=>{c&&z.mutate({workflowId:c})},t[33]=c,t[34]=z,t[35]=H):H=t[35];let U=H,W;t[36]!==n||t[37]!==c||t[38]!==g||t[39]!==O||t[40]!==h||t[41]!==r||t[42]!==V||t[43]!==C?(W=()=>{if(!c)return;let e=y4({nodes:G1(h),catalog:n,integrations:C});if(b4(e)){r(B7,{issues:x4(e),onGoToStep:O,allowRunAnyway:!1});return}V.mutate({workflowId:c,graph:Y1({nodes:h,edges:g})})},t[36]=n,t[37]=c,t[38]=g,t[39]=O,t[40]=h,t[41]=r,t[42]=V,t[43]=C,t[44]=W):W=t[44];let G=W,K;t[45]!==c||t[46]!==f||t[47]!==s||t[48]!==u?(K=async e=>{if(!c||u===e)return;let t=await s(e);if(!t?.ok){Ty.error(`Failed to update workflow mode`);return}f(t.workflow.mode),Ty.success(e===`test`?`Workflow set to Test mode`:`Workflow set to Live mode`)},t[45]=c,t[46]=f,t[47]=s,t[48]=u,t[49]=K):K=t[49];let q=K,J;return t[50]!==z.isPending||t[51]!==N||t[52]!==F||t[53]!==U||t[54]!==E||t[55]!==G||t[56]!==T||t[57]!==q||t[58]!==D||t[59]!==L||t[60]!==V.isPending?(J={handleSave:T,handleExecute:E,handleShowIssues:D,handleClearWorkflow:N,handleDeleteWorkflow:F,loadWorkflows:L,handleDuplicate:U,isDuplicating:z.isPending,handlePublish:G,isPublishing:V.isPending,handleSetWorkflowMode:q},t[50]=z.isPending,t[51]=N,t[52]=F,t[53]=U,t[54]=E,t[55]=G,t[56]=T,t[57]=q,t[58]=D,t[59]=L,t[60]=V.isPending,t[61]=J):J=t[61],J}function Mbe(e){let t=(0,Z.c)(7),{onOpen:n}=e,r=wA(C4),i=wA(Pfe),a=wA(t2),o=`${r.length} ${r.length===1?`issue`:`issues`}`;if(!a)return null;let s;t[0]!==i||t[1]!==r.length||t[2]!==o||t[3]!==n?(s=r.length>0&&(0,X.jsxs)(`button`,{className:Q(`flex items-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 font-medium text-xs transition-colors`,i?`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20`:`bg-card text-muted-foreground hover:bg-accent`),onClick:n,title:`Show what is wrong with this workflow`,type:`button`,children:[(0,X.jsx)(py,{className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:o})]}),t[0]=i,t[1]=r.length,t[2]=o,t[3]=n,t[4]=s):s=t[4];let c;return t[5]===s?c=t[6]:(c=(0,X.jsx)(`output`,{"aria-live":`polite`,className:`shrink-0`,children:s}),t[5]=s,t[6]=c),c}function Nbe(e){let t=(0,Z.c)(3),{isPublished:n,hasUnpublishedChanges:r}=e;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:`Never published`}),t[0]=e):e=t[0],e}let i=r?`Unpublished changes`:`Published`,a;return t[1]===i?a=t[2]:(a=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:i}),t[1]=i,t[2]=a),a}function Pbe(e){return e.isSaving?`saving`:e.lastSaveError?`failed`:e.hasUnsavedChanges?`unsaved`:`saved`}var Fbe={saving:`Saving`,unsaved:`Unsaved changes`,failed:`Save failed`,saved:`Saved`},Ibe={saving:`text-muted-foreground`,unsaved:`text-warning`,failed:`text-destructive`,saved:`text-muted-foreground`};function Lbe(){let e=(0,Z.c)(14),t=wA(a2),n=wA(o2),r=wA(s2),i=wA(t2),a;e[0]!==n||e[1]!==t||e[2]!==r?(a=Pbe({isSaving:t,hasUnsavedChanges:n,lastSaveError:r}),e[0]=n,e[1]=t,e[2]=r,e[3]=a):a=e[3];let o=a,s=i&&(n||t),c;if(e[4]===s?c=e[5]:(c={enabled:s},e[4]=s,e[5]=c),_Y(window,`beforeunload`,Rbe,c),!i)return null;let l=Ibe[o],u;e[6]===l?u=e[7]:(u=Q(`flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 font-medium text-xs`,l),e[6]=l,e[7]=u);let d;e[8]===o?d=e[9]:(d=o===`saving`&&(0,X.jsx)(ay,{className:`size-3 animate-spin`}),e[8]=o,e[9]=d);let f=Fbe[o],p;return e[10]!==u||e[11]!==d||e[12]!==f?(p=(0,X.jsxs)(`output`,{"aria-live":`polite`,className:u,children:[d,f]}),e[10]=u,e[11]=d,e[12]=f,e[13]=p):p=e[13],p}function Rbe(e){e.preventDefault()}var zbe=e=>{let t=(0,Z.c)(57),{workflowId:n}=e,r=Abe(),i=jbe(r),a;if(t[0]!==r.allWorkflows||t[1]!==r.currentWorkflowId){let e;t[3]===r.currentWorkflowId?e=t[4]:(e=e=>e.id===r.currentWorkflowId,t[3]=r.currentWorkflowId,t[4]=e),a=r.allWorkflows.find(e),t[0]=r.allWorkflows,t[1]=r.currentWorkflowId,t[2]=a}else a=t[2];let o=!!a?.publishedVersionId,s=n??``,c;t[5]===s?c=t[6]:(c=Iue(s),t[5]=s,t[6]=c);let l=!!n,u;t[7]!==c||t[8]!==l?(u={...c,enabled:l},t[7]=c,t[8]=l,t[9]=u):u=t[9];let{data:d}=Xe(u),f=d!==void 0&&d,p;t[10]!==i||t[11]!==r||t[12]!==n?(p=(0,X.jsx)(sbe,{actions:i,state:r,workflowId:n}),t[10]=i,t[11]=r,t[12]=n,t[13]=p):p=t[13];let m;t[14]!==r.workflowMode||t[15]!==n?(m=n&&r.workflowMode===`test`&&(0,X.jsx)(`span`,{className:`rounded-md border border-warning/40 bg-warning/10 px-2 py-1 font-medium text-warning text-xs`,children:`Test mode`}),t[14]=r.workflowMode,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==f||t[18]!==o||t[19]!==n?(h=n&&(0,X.jsx)(Nbe,{hasUnpublishedChanges:f,isPublished:o}),t[17]=f,t[18]=o,t[19]=n,t[20]=h):h=t[20];let g;t[21]!==r.isOwner||t[22]!==n?(g=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Read-only`}),t[21]=r.isOwner,t[22]=n,t[23]=g):g=t[23];let _;t[24]===i.handleShowIssues?_=t[25]:(_=(0,X.jsx)(Mbe,{onOpen:i.handleShowIssues}),t[24]=i.handleShowIssues,t[25]=_);let v;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Lbe,{}),t[26]=v):v=t[26];let y;t[27]!==g||t[28]!==_||t[29]!==p||t[30]!==m||t[31]!==h?(y=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 flex-wrap items-center gap-2`,children:[p,m,h,g,_,v]}),t[27]=g,t[28]=_,t[29]=p,t[30]=m,t[31]=h,t[32]=y):y=t[32];let b;t[33]!==i||t[34]!==r||t[35]!==n?(b=(0,X.jsx)(abe,{actions:i,state:r,workflowId:n}),t[33]=i,t[34]=r,t[35]=n,t[36]=b):b=t[36];let x;t[37]!==i.handleDuplicate||t[38]!==i.isDuplicating||t[39]!==r.isOwner||t[40]!==n?(x=n&&!r.isOwner&&(0,X.jsx)(ibe,{isDuplicating:i.isDuplicating,onDuplicate:i.handleDuplicate}),t[37]=i.handleDuplicate,t[38]=i.isDuplicating,t[39]=r.isOwner,t[40]=n,t[41]=x):x=t[41];let S;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(Zye,{}),t[42]=S):S=t[42];let C;t[43]===x?C=t[44]:(C=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,S]}),t[43]=x,t[44]=C);let w;t[45]!==b||t[46]!==C?(w=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2 overflow-x-auto @xl:justify-end`,children:[b,C]}),t[45]=b,t[46]=C,t[47]=w):w=t[47];let T;t[48]!==y||t[49]!==w?(T=(0,X.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-4 top-4 z-10 flex flex-col items-stretch gap-2 @container @xl:flex-row @xl:items-start @xl:justify-between`,children:[y,w]}),t[48]=y,t[49]=w,t[50]=T):T=t[50];let E;t[51]!==r.workflowMode||t[52]!==n?(E=n&&r.workflowMode===`test`&&(0,X.jsxs)(`div`,{className:`-translate-x-1/2 pointer-events-none absolute bottom-4 left-1/2 z-10 max-w-xl rounded-md border border-warning/30 bg-warning/10 px-4 py-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-warning`,children:`Test mode active`}),(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:`No real email or SMS is sent unless a node is configured to route to a test recipient.`})]}),t[51]=r.workflowMode,t[52]=n,t[53]=E):E=t[53];let D;return t[54]!==T||t[55]!==E?(D=(0,X.jsxs)(X.Fragment,{children:[T,E]}),t[54]=T,t[55]=E,t[56]=D):D=t[56],D};function U7(e,t){return e?.data.label?.trim()||t}function Bbe(e){return e.data.type===`lifecycle`||E0(e)||Z6(e)}function Vbe(e){return w0(e.sourceHandle)||(typeof e.sourceHandle==`string`&&e.sourceHandle.length>0?e.sourceHandle:``)}function Hbe(e){let{joinNodeId:t,predecessorIds:n,edges:r}=e;if(n.length===0)return new Set;let i=null;for(let e of n){let t=q6(e,r);if(!i){i=t;continue}for(let e of i)t.has(e)||i.delete(e)}let a=q6(t,r);for(let e of i??[])a.delete(e);return a}function Ube(e){if(e.nodeById.get(e.nodeId)?.data.type===`lifecycle`)return!0;for(let t of q6(e.nodeId,e.edges))if(e.nodeById.get(t)?.data.type===`lifecycle`)return!0;return!1}function Wbe(e){let{joinNodeId:t,nodes:n,edges:r}=e,i=new Map(n.map(e=>[e.id,e])),a=U7(i.get(t),t),o=r.filter(e=>e.target===t).map(e=>e.source),s=q6(t,r);for(let e of o)if(!Ube({nodeId:e,nodeById:i,edges:r}))return`Node "${a}" cannot join an unreachable branch (found "${U7(i.get(e),e)}")`;let c=new Map;for(let e of r){if(e.target!==t&&!s.has(e.target))continue;let n=i.get(e.source);if(!n||!Bbe(n))continue;let r=c.get(n.id)??new Set;r.add(Vbe(e)),c.set(n.id,r)}for(let[e,t]of c){if(t.size<=1)continue;let n=i.get(e);return n?.data.type===`lifecycle`?`Node "${a}" cannot join the Started and Canceled branches`:`Node "${a}" cannot join mutually exclusive branches from "${U7(n,e)}"`}for(let e of Hbe({joinNodeId:t,predecessorIds:o,edges:r})){let t=i.get(e);if(t&&x0(t))return`Node "${a}" cannot join branches that include a Wait (found "${U7(t,e)}")`}return null}function Gbe(e){let t=new Map;for(let n of e.edges)t.set(n.target,(t.get(n.target)??0)+1);for(let[n,r]of t){if(r<=1)continue;let t=Wbe({joinNodeId:n,nodes:e.nodes,edges:e.edges});if(t)return t}return null}function Kbe(e,t){return Gue(e)??t?.displayLabel??null}var W7=(e,t,n,r)=>{let i=e.internals.handleBounds?.[t];if(!(i&&i.length>0))return[0,0];let a=(r?i.find(e=>(e.id??null)===r):void 0)??i.find(e=>e.position===n)??i[0];if(!a)return[0,0];let o=a.width/2,s=a.height/2;switch(n){case _w.Left:o=0;break;case _w.Right:o=a.width;break;case _w.Top:s=0;break;case _w.Bottom:s=a.height;break;default:throw Error(`Invalid handle position`)}return[e.internals.positionAbsolute.x+a.x+o,e.internals.positionAbsolute.y+a.y+s]},qbe=(e,t,n,r)=>{let i=_w.Bottom,[a,o]=W7(e,`source`,i,n),s=_w.Top,[c,l]=W7(t,`target`,s,r);return{sx:a,sy:o,tx:c,ty:l,sourcePos:i,targetPos:s}},Jbe={Animated:(0,Y.memo)(function(e){let t=(0,Z.c)(27),{id:n,source:r,sourceHandleId:i,target:a,targetHandleId:o,style:s,selected:c,data:l}=e,u=JO(r),d=JO(a);if(!(u&&d))return null;let f;if(t[0]!==i||t[1]!==u||t[2]!==o||t[3]!==d){let{sx:e,sy:n,tx:r,ty:a,sourcePos:s,targetPos:c}=qbe(u,d,i,o);f=k7({sourceX:e,sourceY:n,sourcePosition:s,targetX:r,targetY:a,targetPosition:c}),t[0]=i,t[1]=u,t[2]=o,t[3]=d,t[4]=f}else f=t[4];let[p,m,h]=f,g;t[5]!==l||t[6]!==i?(g=Kbe(i,l),t[5]=l,t[6]=i,t[7]=g):g=t[7];let _=g,v=l?.inactive===!0,y=c?`var(--primary)`:v?`var(--canvas-line-muted)`:`var(--canvas-line)`,b=v?`4, 8`:`5`,x;t[8]===v?x=t[9]:(x=v?{}:{animation:`dashdraw 0.5s linear infinite`},t[8]=v,t[9]=x);let S;t[10]!==s||t[11]!==y||t[12]!==b||t[13]!==x?(S={...s,stroke:y,strokeWidth:2,strokeDasharray:b,...x},t[10]=s,t[11]=y,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==p||t[16]!==n||t[17]!==S?(C=(0,X.jsx)(GD,{id:n,path:p,style:S}),t[15]=p,t[16]=n,t[17]=S,t[18]=C):C=t[18];let w;t[19]!==_||t[20]!==v||t[21]!==m||t[22]!==h?(w=_&&(0,X.jsx)(KO,{children:(0,X.jsx)(`div`,{className:`pointer-events-none absolute rounded-sm border bg-background px-1.5 py-0.5 font-medium text-xs text-muted-foreground leading-none`,style:{transform:`translate(-50%, -50%) translate(${m}px,${h}px)`,...v?{opacity:.7}:{}},children:_})}),t[19]=_,t[20]=v,t[21]=m,t[22]=h,t[23]=w):w=t[23];let T;return t[24]!==C||t[25]!==w?(T=(0,X.jsxs)(X.Fragment,{children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26],T})},Ybe=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`m-4 rounded-md border bg-card p-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(cE,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function Xbe(e,t){let n=t.filter(t=>t.source===e);return n.some(e=>w0(e.sourceHandle)===`true`)?n.some(e=>w0(e.sourceHandle)===`false`)?`true`:`false`:`true`}function Zbe(e){let{nodes:t,edges:n,sourceNodeId:r,catalog:i}=e,a=t8({targetNodeId:r,nodes:t,edges:n,catalog:i}),o=new Set(n.filter(e=>e.source===r).map(e=>e.sourceHandle)),s=a.find(e=>!o.has(Y6(e.name)))??a[0];return s?Y6(s.name):null}function G7(e){let{nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:a}=e,o=w0(i);if(o)return o;let s=t.find(e=>e.id===r);if(D0(s))return A0(s)??i??null;if(s?.data.type===`lifecycle`)return Cde(i)?i:k2;if(Z6(s)){let e=X6(i);return e?Y6(e):Zbe({nodes:t,edges:n,sourceNodeId:r,catalog:a})}return E0(s)?Xbe(r,n):i??null}var Qbe=e=>{let t=(0,Z.c)(12),{className:n}=e,r;t[0]===n?r=t[1]:(r=Q(`pointer-events-none absolute inset-0 animate-border-mask rounded-[inherit]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`svg`,{className:`size-full overflow-visible`,xmlns:`http://www.w3.org/2000/svg`,children:(0,X.jsx)(`rect`,{fill:`none`,height:`calc(100% - 2px)`,rx:`6`,stroke:`var(--info)`,strokeWidth:`2`,width:`calc(100% - 2px)`,x:`1`,y:`1`})}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,X.jsx)(`div`,{className:r,children:i}),t[3]=r,t[4]=a);let o;t[5]===n?o=t[6]:(o=Q(`pointer-events-none absolute inset-0 rounded-[inherit] border-2 border-info/20`,n),t[5]=n,t[6]=o);let s;t[7]===o?s=t[8]:(s=(0,X.jsx)(`div`,{className:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,X.jsxs)(X.Fragment,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c},$be=d_(`flex flex-col rounded-xl border text-card-foreground shadow-sm`,{variants:{size:{default:`gap-6 py-6`,sm:`gap-4 py-4`}},defaultVariants:{size:`default`}});function exe(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Q($be({size:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,X.jsx)(`div`,{className:o,"data-size":a,"data-slot":`card`,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function txe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nxe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rxe={running:{label:`Running`,Icon:ay,className:`bg-primary/5 text-foreground`,iconClassName:`animate-spin motion-reduce:animate-none`},success:{label:`Succeeded`,Icon:qv,className:`bg-success/10 text-success`,iconClassName:``},error:{label:`Failed`,Icon:cte,className:`bg-destructive/10 text-destructive`,iconClassName:``},cancelled:{label:`Cancelled`,Icon:Kv,className:`bg-cancelled/10 text-cancelled`,iconClassName:``}},ixe=e=>{let t=(0,Z.c)(11),{status:n}=e;if(!n||n===`idle`)return null;let r=rxe[n],i;t[0]===r.className?i=t[1]:(i=Q(`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-sm py-0.5 pr-2 pl-1.5 font-medium text-xs leading-none`,r.className),t[0]=r.className,t[1]=i);let a=r.Icon,o;t[2]===r.iconClassName?o=t[3]:(o=Q(`size-3`,r.iconClassName),t[2]=r.iconClassName,t[3]=o);let s;t[4]!==r.Icon||t[5]!==o?(s=(0,X.jsx)(a,{className:o,strokeWidth:2.5}),t[4]=r.Icon,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==r.label||t[8]!==i||t[9]!==s?(c=(0,X.jsxs)(`div`,{className:i,role:`status`,children:[s,r.label]}),t[7]=r.label,t[8]=i,t[9]=s,t[10]=c):c=t[10],c};function K7(e,t){return t===!1?null:t===!0?(0,X.jsx)(dD,{position:e===`source`?_w.Bottom:_w.Top,type:e}):t.map(t=>{let n=[e,t.position,t.style?.top,t.style?.right,t.style?.bottom,t.style?.left].join(`:`);return(0,X.jsx)(dD,{className:t.className,id:t.id,position:t.position,style:t.style,type:e},t.id??n)})}var q7=e=>{let t=(0,Z.c)(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({handles:r,className:n,status:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===`success`&&`border-2 border-success`,s=a===`error`&&`border-2 border-destructive`,c=a===`cancelled`&&`border-2 border-cancelled`,l;t[5]!==n||t[6]!==o||t[7]!==s||t[8]!==c?(l=Q(`node-container relative flex flex-col items-center justify-center gap-0 overflow-visible rounded-md border-[1.5px] border-canvas-line bg-card p-0 shadow-none transition-all duration-150 ease-out`,o,s,c,n),t[5]=n,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=a===`running`&&(0,X.jsx)(Qbe,{}),t[10]=a,t[11]=u);let d;t[12]===a?d=t[13]:(d=(0,X.jsx)(ixe,{status:a}),t[12]=a,t[13]=d);let f;t[14]===r.target?f=t[15]:(f=K7(`target`,r.target),t[14]=r.target,t[15]=f);let p;t[16]===r.source?p=t[17]:(p=K7(`source`,r.source),t[16]=r.source,t[17]=p);let m;return t[18]!==i||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p?(m=(0,X.jsxs)(exe,{className:l,...i,children:[u,d,f,p,i.children]}),t[18]=i,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m):m=t[24],m},J7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-base`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(txe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},Y7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nxe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},X7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex w-full flex-col items-center justify-center gap-1 px-3 py-2 text-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function axe(e){if(!e)return``;let t=e.messages.length,n=t===1?`issue`:`issues`;return e.severity===`blocking`?`${t} blocking ${n}`:`${t} ${n}`}function Z7(e){let t=(0,Z.c)(13),{issues:n,placement:r}=e,i=r===void 0?`corner`:r;if(!n)return null;let a,o;t[0]===n.messages?(a=t[1],o=t[2]):([a,...o]=n.messages,t[0]=n.messages,t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=axe(n),t[3]=n,t[4]=s);let c=i===`corner`?`absolute top-2 left-2 z-10`:`shrink-0`,l=n.severity===`blocking`?`bg-warning/50`:`bg-muted-foreground/40`,u;t[5]!==c||t[6]!==l?(u=Q(`rounded-full p-1`,c,l),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=o.length>0?`${a} and ${o.length} more`:a,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(py,{className:`size-3.5 text-background`}),t[8]=f):f=t[8];let p;return t[9]!==s||t[10]!==u||t[11]!==d?(p=(0,X.jsx)(`div`,{"aria-label":s,className:u,role:`img`,title:d,children:f}),t[9]=s,t[10]=u,t[11]=d,t[12]=p):p=t[12],p}var oxe=/(-?\d+(?:\.\d+)?)\s*(ms|s|m|h|d|w)/gi,sxe=/(Z|[+-]\d{2}:\d{2})$/i,cxe=/^(-)?P(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/i,lxe=/^-?\d+(?:\.\d+)?$/,uxe=/^\d+$/,dxe=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Q7(e){switch(e){case`ms`:return 1;case`s`:return 1e3;case`m`:return 6e4;case`h`:return 36e5;case`d`:return 864e5;case`w`:return 6048e5;default:return NaN}}function fxe(e){let t=cxe.exec(e.trim());if(!t)return null;let n=t[1]?-1:1,r=Number.parseFloat(t[2]??`0`),i=Number.parseFloat(t[3]??`0`),a=Number.parseFloat(t[4]??`0`),o=Number.parseFloat(t[5]??`0`),s=Number.parseFloat(t[6]??`0`);return n*(r*Q7(`w`)+i*Q7(`d`)+a*Q7(`h`)+o*Q7(`m`)+s*Q7(`s`))}function $7(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;if(lxe.test(t))return Number.parseFloat(t);let n=fxe(t);if(n!==null)return n;let r=0,i=!1;for(let e of t.matchAll(oxe)){let t=Number.parseFloat(e[1]),n=Q7(e[2].toLowerCase());if(!Number.isFinite(t)||Number.isNaN(n))return null;i=!0,r+=t*n}return i?r:null}function pxe(e){let t=dxe.exec(e);return t?{year:Number.parseInt(t[1],10),month:Number.parseInt(t[2],10),day:Number.parseInt(t[3],10),hour:Number.parseInt(t[4]??`0`,10),minute:Number.parseInt(t[5]??`0`,10),second:Number.parseInt(t[6]??`0`,10)}:null}function e9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).formatToParts(e),r=Object.fromEntries(n.map(e=>[e.type,e.value]));return Date.UTC(Number.parseInt(r.year,10),Number.parseInt(r.month,10)-1,Number.parseInt(r.day,10),Number.parseInt(r.hour,10),Number.parseInt(r.minute,10),Number.parseInt(r.second,10))-e.getTime()}function mxe(e,t){let n=pxe(e);if(!n)return null;let r=new Date(Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)),i=e9(r,t),a=new Date(r.getTime()-i),o=e9(a,t);return o===i?a:new Date(r.getTime()-o)}function t9(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==`number`)return n9(e);if(typeof e!=`string`)return null;let n=e.trim();return n?hxe(n)??gxe(n)??_xe(n,t):null}function n9(e){if(typeof e==`number`&&!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function hxe(e){if(!uxe.test(e))return null;let t=Number.parseInt(e,10);return n9(e.length<=10?t*1e3:t)}function gxe(e){return sxe.test(e)?n9(e):null}function _xe(e,t){if(t){let n=mxe(e,t);if(n)return n}return n9(e)}function vxe(e,t,n,r){let i=e9(e,r),a=e.getTime()+i,o=new Date(a),s=o.getUTCHours()*60+o.getUTCMinutes();if(s>=t&&s<n)return e;let c=Math.floor(t/60),l=t%60,u=s<t?0:1,d=new Date(a);d.setUTCDate(d.getUTCDate()+u),d.setUTCHours(c,l,0,0);let f=new Date(d.getTime()-i),p=e9(f,r);return p===i?f:new Date(d.getTime()-p)}function yxe(e){let t=f4(e.waitAllowedHoursMode);if(t===`off`)return{date:e.candidate};let n=_fe({mode:t,startTime:e.waitAllowedStartTime,endTime:e.waitAllowedEndTime});if(n.length>0)return{date:e.candidate,error:n.map(e=>e.message).join(` `)};if(!e.timeZone)return{date:e.candidate,error:`Timezone is required when allowed-hours window is enabled.`};let r=p4(e.waitAllowedStartTime),i=p4(e.waitAllowedEndTime);return r===null||i===null?{date:e.candidate,error:`Invalid allowed-hours time format after validation.`}:{date:vxe(e.candidate,r,i,e.timeZone)}}function r9(e){let t=e.now??new Date,n=typeof e.waitTimezone==`string`&&e.waitTimezone.trim()?e.waitTimezone.trim():void 0,r;if(e.waitUntil!==void 0&&e.waitUntil!==``){let t=t9(e.waitUntil,n);if(!t)return{error:`Invalid waitUntil value. Use an ISO timestamp or unix epoch.`};let i=$7(e.waitOffset);if(e.waitOffset!==void 0&&e.waitOffset!==``&&i===null)return{error:`Invalid waitOffset value. Use duration like -1d, 6h, 30m, or ISO duration.`};r=new Date(t.getTime()+(i??0))}else{let n=$7(e.waitDuration);if(n===null)return{error:`Invalid waitDuration value. Use milliseconds, duration tokens (e.g. 24h), or ISO duration.`};r=new Date(t.getTime()+n)}let i=yxe({candidate:r,waitAllowedHoursMode:e.waitAllowedHoursMode,waitAllowedStartTime:e.waitAllowedStartTime,waitAllowedEndTime:e.waitAllowedEndTime,timeZone:n});return i.error?{error:i.error}:{waitUntil:i.date}}var bxe={};function xxe(){let e=(0,Z.c)(5),t=wA(O2),n;e[0]===t?n=e[1]:(n=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:t??``},select:eye}),e[0]=t,e[1]=n);let r=t!==null,i;e[2]!==n||e[3]!==r?(i={...n,enabled:r},e[2]=n,e[3]=r,e[4]=i):i=e[4];let{data:a}=Xe(i);return a??bxe}var Sxe=Wh(Ch({waitMode:ph(Rh),waitTimezone:ph(Rh),waitDuration:ph(gh),waitUntil:ph(gh),waitOffset:ph(gh),waitTimeout:ph(gh)}));function i9(e){return typeof e==`string`&&e.includes(`{{`)&&e.includes(`}}`)}function a9(e){let t=Math.max(Math.floor(e/1e3),0),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return`${n} ${n===1?`day`:`days`} ${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function o9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0,timeZoneName:`short`}),r=Object.fromEntries(n.formatToParts(e).map(e=>[e.type,e.value])),i=r.dayPeriod?` ${r.dayPeriod.toUpperCase()}`:``,a=r.timeZoneName?` ${r.timeZoneName}`:``;return`${r.month} ${r.day}, ${r.year} ${r.hour}:${r.minute}${i}${a}`}function Cxe(e,t){let n=(0,Z.c)(15),r=v0(t,`waitMode`,`delay`),i=e===b1.wait&&(r===`delay`||r===`event`),a=t?.waitDuration,o=t?.waitUntil,s=t?.waitOffset,c;n[0]===t?c=n[1]:(c=typeof t?.waitTimezone==`string`&&t.waitTimezone.trim()?t.waitTimezone.trim():void 0,n[0]=t,n[1]=c);let l=c,u=i9(a)||i9(o)||i9(s),d;bb0:{if(!i||u||r===`event`){d=null;break bb0}let e;n[2]!==a||n[3]!==s||n[4]!==l||n[5]!==o?(e=r9({waitDuration:a,waitUntil:o,waitOffset:s,waitTimezone:l}),n[2]=a,n[3]=s,n[4]=l,n[5]=o,n[6]=e):e=n[6],d=e}let f=d;if(!i)return null;if(r===`event`){let e;return n[7]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Waiting for event`,triggerTime:`Resumes when a matching event arrives`},n[7]=e):e=n[7],e}if(u){let e;return n[8]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Runtime-calculated`,triggerTime:`Trigger time comes from workflow data`},n[8]=e):e=n[8],e}if(!f?.waitUntil){let e;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Set wait duration`,triggerTime:`Add a valid wait time`},n[9]=e):e=n[9],e}let p;n[10]!==f.waitUntil||n[11]!==l?(p=o9(f.waitUntil,l),n[10]=f.waitUntil,n[11]=l,n[12]=p):p=n[12];let m;return n[13]===p?m=n[14]:(m={countdown:`Delay configured`,triggerTime:p},n[13]=p,n[14]=m),m}function wxe(e,t,n){let r=(0,Z.c)(16),i=e===b1.wait&&t!==null&&n!==void 0&&(n.status===`running`||n.status===`pending`),a;r[0]===i?a=r[1]:(a={intervalMs:1e3,enabled:i},r[0]=i,r[1]=a);let o=SY(a);n?.input;let s;bb0:{if(!i){s=null;break bb0}let e;r[2]===n?.input?e=r[3]:(e=Sxe(n?.input)??null,r[2]=n?.input,r[3]=e),s=e}let c=s,l,u,d;if(r[4]!==n||r[5]!==o||r[6]!==c||r[7]!==i){d=Symbol.for(`react.early_return_sentinel`);bb1:{let e=i&&n?.startedAt!==void 0?t9(n.startedAt):null;if(!(i&&c&&e)){d=null;break bb1}let t=c.waitMode||`delay`,a=c.waitTimezone||void 0;if(t===`event`){let t=r9({now:e,waitDuration:c.waitTimeout});if(!t.waitUntil){d={countdown:`Waiting for event`,triggerTime:`Resumes when matching event arrives`};break bb1}d={countdown:a9(t.waitUntil.getTime()-o),triggerTime:o9(t.waitUntil,a)};break bb1}let s=r9({now:e,waitDuration:c.waitDuration,waitUntil:c.waitUntil,waitOffset:c.waitOffset,waitTimezone:a});if(!s.waitUntil){d={countdown:`Runtime-calculated`,triggerTime:`Waiting timestamp unavailable`};break bb1}let f=s.waitUntil.getTime()-o;r[11]===f?l=r[12]:(l=a9(f),r[11]=f,r[12]=l),u=o9(s.waitUntil,a)}r[4]=n,r[5]=o,r[6]=c,r[7]=i,r[8]=l,r[9]=u,r[10]=d}else l=r[8],u=r[9],d=r[10];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;return r[13]!==l||r[14]!==u?(f={countdown:l,triggerTime:u},r[13]=l,r[14]=u,r[15]=f):f=r[15],f}var Txe=e=>({"gpt-5":`GPT-5`,"openai/gpt-5.1-instant":`GPT-5.1 Instant`,"openai/gpt-5.1-codex":`GPT-5.1 Codex`,"openai/gpt-5.1-codex-mini":`GPT-5.1 Codex Mini`,"openai/gpt-5.1-thinking":`GPT-5.1 Thinking`,"gpt-4":`GPT-4`,"gpt-4o":`GPT-4o`,"gpt-4o-mini":`GPT-4o Mini`,"claude-3-5-sonnet":`Claude 3.5`,"claude-3-opus":`Claude 3 Opus`,"anthropic/claude-opus-4.5":`Claude Opus 4.5`,"anthropic/claude-sonnet-4.5":`Claude Sonnet 4.5`,"anthropic/claude-haiku-4.5":`Claude Haiku 4.5`,"google/gemini-3-pro-preview":`Gemini 3 Pro Preview`,"google/gemini-2.5-flash-lite":`Gemini 2.5 Flash Lite`,"google/gemini-2.5-flash":`Gemini 2.5 Flash`,"google/gemini-2.5-pro":`Gemini 2.5 Pro`,"meta/llama-4-scout":`Llama 4 Scout`,"meta/llama-3.3-70b":`Llama 3.3 70B`,"meta/llama-3.1-8b":`Llama 3.1 8B`,"moonshotai/kimi-k2-0905":`Kimi K2`,"openai/gpt-oss-120b":`GPT OSS 120B`,"openai/gpt-oss-safeguard-20b":`GPT OSS Safeguard 20B`,"openai/gpt-oss-20b":`GPT OSS 20B`,"o1-preview":`o1 Preview`,"o1-mini":`o1 Mini`,"bfl/flux-2-pro":`FLUX.2 Pro`,"bfl/flux-1-pro":`FLUX.1 Pro`,"openai/dall-e-3":`DALL-E 3`,"google/imagen-4.0-generate":`Imagen 4.0`})[e]||e,Exe=(e,t)=>{let n=Py(e,t)?.integration;return n&&Fy(e,n)?.label||`System`},s9=e=>{let t=(0,Z.c)(19),{actionType:n,catalog:r,className:i}=e,a=i===void 0?O4:i,o=xy();switch(n){case b1.condition:{let e;t[0]===a?e=t[1]:(e=Q(a,`text-node-condition`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(fte,{className:e,strokeWidth:1.5}),t[2]=e,t[3]=n),n}case b1.eventSplit:{let e;t[4]===a?e=t[5]:(e=Q(a,`text-node-split`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,X.jsx)(Ate,{className:e,strokeWidth:1.5}),t[6]=e,t[7]=n),n}case b1.wait:{let e;t[8]===a?e=t[9]:(e=Q(a,`text-node-wait`),t[8]=a,t[9]=e);let n;return t[10]===e?n=t[11]:(n=(0,X.jsx)(hte,{className:e,strokeWidth:1.5}),t[10]=e,t[11]=n),n}}let s=Py(r,n)?.integration;if(s){let e=o[s];if(e){let n=e.icon,r;return t[12]!==n||t[13]!==a?(r=(0,X.jsx)(n,{className:a}),t[12]=n,t[13]=a,t[14]=r):r=t[14],r}}let c;t[15]===a?c=t[16]:(c=Q(a,`text-node-wait`),t[15]=a,t[16]=c);let l;return t[17]===c?l=t[18]:(l=(0,X.jsx)(gy,{className:c,strokeWidth:1.5}),t[17]=c,t[18]=l),l};function Dxe(e){let t=(0,Z.c)(14),{base64:n}=e,[r,i]=(0,Y.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Q(O4,`relative cursor-zoom-in overflow-hidden rounded-lg transition-transform hover:scale-105`),o=e=>{e.stopPropagation(),i(!0)},t[0]=a,t[1]=o):(a=t[0],o=t[1]);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=Q(O4,`object-cover`),t[2]=s):s=t[2];let c=`data:image/png;base64,${n}`,l;t[3]===c?l=t[4]:(l=(0,X.jsx)(`button`,{className:a,onClick:o,type:`button`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:s,height:20,src:c,width:20})}),t[3]=c,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(mY,{className:`sr-only`,children:`Generated Image`}),t[5]=u):u=t[5];let d=`data:image/png;base64,${n}`,f;t[6]===d?f=t[7]:(f=(0,X.jsxs)(dY,{className:`max-w-3xl p-2`,showCloseButton:!1,children:[u,(0,X.jsx)(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:`h-auto w-full object-contain`,height:768,src:d,width:768})})]}),t[6]=d,t[7]=f);let p;t[8]!==r||t[9]!==f?(p=(0,X.jsx)(cY,{onOpenChange:i,open:r,children:f}),t[8]=r,t[9]=f,t[10]=p):p=t[10];let m;return t[11]!==l||t[12]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[l,p]}),t[11]=l,t[12]=p,t[13]=m):m=t[13],m}var c9=`38%`,l9=`62%`;function u9(e,t){return`${(e+.5)/t*100}%`}var d9=`group-child-handle`,Oxe=[{position:_w.Top,className:d9}],kxe=[{position:_w.Bottom,className:d9}],Axe=[{id:`true`,position:_w.Bottom,className:d9,style:{left:c9}},{id:`false`,position:_w.Bottom,className:d9,style:{left:l9}}];function jxe(e){let t=(0,Z.c)(26),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=_0(n?.config,`actionType`),c=T0(s),l;if(t[0]!==i||t[1]!==o?(l=()=>{o(i)},t[0]=i,t[1]=o,t[2]=l):l=t[2],yY(c,l),!n)return null;let u=n.label||(s?Py(a,s)?.label:void 0)||s||`Action`,d=r&&`border-primary`,f=n.enabled===!1&&`opacity-50`,p;t[3]!==d||t[4]!==f?(p=Q(`nodrag flex h-14 w-[188px] flex-row items-center shadow-none transition-all duration-150 ease-out`,d,f),t[3]=d,t[4]=f,t[5]=p):p=t[5];let m=`action-node-${i}`,h=c?Axe:kxe,g;t[6]===h?g=t[7]:(g={target:Oxe,source:h},t[6]=h,t[7]=g);let _;t[8]!==s||t[9]!==a?(_=s?(0,X.jsx)(s9,{actionType:s,catalog:a,className:Q(O4,`shrink-0`)}):(0,X.jsx)(gy,{className:Q(O4,`shrink-0 text-muted-foreground`),strokeWidth:1.5}),t[8]=s,t[9]=a,t[10]=_):_=t[10];let v;t[11]===u?v=t[12]:(v=(0,X.jsx)(J7,{className:`truncate text-sm`,children:u}),t[11]=u,t[12]=v);let y;t[13]!==n.enabled||t[14]!==n.issues?(y=n.enabled!==!1&&(0,X.jsx)(Z7,{issues:n.issues,placement:`inline`}),t[13]=n.enabled,t[14]=n.issues,t[15]=y):y=t[15];let b;t[16]!==y||t[17]!==_||t[18]!==v?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 px-3`,children:[_,v,y]}),t[16]=y,t[17]=_,t[18]=v,t[19]=b):b=t[19];let x;return t[20]!==n.status||t[21]!==b||t[22]!==p||t[23]!==m||t[24]!==g?(x=(0,X.jsx)(q7,{className:p,"data-testid":m,handles:g,status:n.status,children:b}),t[20]=n.status,t[21]=b,t[22]=p,t[23]=m,t[24]=g,t[25]=x):x=t[25],x}var f9=(0,Y.memo)(e=>{let t=(0,Z.c)(99),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=wA(O2),c=xxe()[i],l,u,d;t[0]===n?.config?(l=t[1],u=t[2],d=t[3]):(l=_0(n?.config,`actionType`),u=T0(l),d=Dme(l),t[0]=n?.config,t[1]=l,t[2]=u,t[3]=d);let f=d,p=k8(f?i:null),m=wxe(l??``,s,c),h=Cxe(l??``,n?.config),g=m??h,_;t[4]!==f||t[5]!==p?(_=f?p.map(Mxe).join(`|`):null,t[4]=f,t[5]=p,t[6]=_):_=t[6];let v=_,y;if(t[7]!==i||t[8]!==u||t[9]!==f||t[10]!==o?(y=()=>{(u||f)&&o(i)},t[7]=i,t[8]=u,t[9]=f,t[10]=o,t[11]=y):y=t[11],yY(u?i:v,y),!n)return null;let b=n.status,x;t[12]!==l||t[13]!==c?.output||t[14]!==s?(x=s&&l===`Generate Image`?v7(c?.output):null,t[12]=l,t[13]=c?.output,t[14]=s,t[15]=x):x=t[15];let S=x;if(!l){let e=n.enabled===!1,a=r&&`border-primary`,o=e&&`opacity-50`,s;t[16]!==a||t[17]!==o?(s=Q(a,o),t[16]=a,t[17]=o,t[18]=s):s=t[18];let c=`action-node-${i}`,l;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(l={target:!0,source:!0},t[19]=l):l=t[19];let u;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(u=T4(),t[20]=u):u=t[20];let d;t[21]===e?d=t[22]:(d=e&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[21]=e,t[22]=d);let f;t[23]!==n.issues||t[24]!==e?(f=!e&&(0,X.jsx)(Z7,{issues:n.issues}),t[23]=n.issues,t[24]=e,t[25]=f):f=t[25];let p;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(gy,{className:Q(O4,`text-muted-foreground`),strokeWidth:1.5}),t[26]=p):p=t[26];let m=n.label||`Action`,h;t[27]===m?h=t[28]:(h=(0,X.jsx)(J7,{children:m}),t[27]=m,t[28]=h);let g;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(Y7,{children:`Select an action`}),t[29]=g):g=t[29];let _;t[30]===h?_=t[31]:(_=(0,X.jsxs)(X7,{children:[p,h,g]}),t[30]=h,t[31]=_);let v;return t[32]!==b||t[33]!==d||t[34]!==f||t[35]!==_||t[36]!==s||t[37]!==c?(v=(0,X.jsxs)(q7,{className:s,"data-testid":c,handles:l,status:b,style:u,children:[d,f,_]}),t[32]=b,t[33]=d,t[34]=f,t[35]=_,t[36]=s,t[37]=c,t[38]=v):v=t[38],v}let C;t[39]!==l||t[40]!==a?(C=Py(a,l),t[39]=l,t[40]=a,t[41]=C):C=t[41];let w=C,T=n.label||w?.label||l,E;t[42]!==l||t[43]!==n.config?(E=()=>l===`Generate Text`?v0(n.config,`aiModel`,`meta/llama-4-scout`):l===`Generate Image`?v0(n.config,`imageModel`,`google/imagen-4.0-generate`):null,t[42]=l,t[43]=n.config,t[44]=E):E=t[44];let D=E,O,k;if(t[45]!==l||t[46]!==a||t[47]!==n.description||t[48]!==n.enabled||t[49]!==D||t[50]!==g){let e=D();O=n.enabled===!1,k=g?g.countdown:e?Txe(e):n.description||Exe(a,l),t[45]=l,t[46]=a,t[47]=n.description,t[48]=n.enabled,t[49]=D,t[50]=g,t[51]=O,t[52]=k}else O=t[51],k=t[52];let A=k,j=r&&`border-primary`,M=O&&`opacity-50`,N;t[53]!==j||t[54]!==M?(N=Q(j,M),t[53]=j,t[54]=M,t[55]=N):N=t[55];let P=`action-node-${i}`,F;t[56]!==u||t[57]!==f||t[58]!==p?(F=u?[{id:`true`,position:_w.Bottom,style:{left:c9,width:12,height:12}},{id:`false`,position:_w.Bottom,style:{left:l9,width:12,height:12}}]:!f||p.map((e,t)=>({id:Y6(e.name),position:_w.Bottom,style:{left:u9(t,p.length),width:12,height:12}})),t[56]=u,t[57]=f,t[58]=p,t[59]=F):F=t[59];let I;t[60]===F?I=t[61]:(I={target:!0,source:F},t[60]=F,t[61]=I);let L;t[62]!==f||t[63]!==p?(L=T4(f?D4(p.length):192),t[62]=f,t[63]=p,t[64]=L):L=t[64];let R;t[65]===O?R=t[66]:(R=O&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[65]=O,t[66]=R);let z;t[67]!==n.issues||t[68]!==O?(z=!O&&(0,X.jsx)(Z7,{issues:n.issues}),t[67]=n.issues,t[68]=O,t[69]=z):z=t[69];let B;t[70]===u?B=t[71]:(B=u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[38%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`True`}),(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[62%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`False`})]}),t[70]=u,t[71]=B);let V;t[72]!==f||t[73]!==p?(V=f&&p.map((e,t)=>(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 max-w-28 -translate-x-1/2 truncate rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:u9(t,p.length)},title:e.name,children:e.label},e.name)),t[72]=f,t[73]=p,t[74]=V):V=t[74];let H;t[75]!==l||t[76]!==a||t[77]!==S?(H=S?(0,X.jsx)(Dxe,{base64:S}):(0,X.jsx)(s9,{actionType:l,catalog:a}),t[75]=l,t[76]=a,t[77]=S,t[78]=H):H=t[78];let U;t[79]===T?U=t[80]:(U=(0,X.jsx)(J7,{children:T}),t[79]=T,t[80]=U);let W;t[81]!==A||t[82]!==g?(W=A&&(0,X.jsx)(Y7,{className:g?`font-medium tabular-nums`:void 0,children:A}),t[81]=A,t[82]=g,t[83]=W):W=t[83];let G;t[84]!==H||t[85]!==U||t[86]!==W?(G=(0,X.jsxs)(X7,{children:[H,U,W]}),t[84]=H,t[85]=U,t[86]=W,t[87]=G):G=t[87];let K;return t[88]!==b||t[89]!==N||t[90]!==P||t[91]!==I||t[92]!==L||t[93]!==R||t[94]!==z||t[95]!==B||t[96]!==V||t[97]!==G?(K=(0,X.jsxs)(q7,{className:N,"data-testid":P,handles:I,status:b,style:L,children:[R,z,B,V,G]}),t[88]=b,t[89]=N,t[90]=P,t[91]=I,t[92]=L,t[93]=R,t[94]=z,t[95]=B,t[96]=V,t[97]=G,t[98]=K):K=t[98],K});f9.displayName=`StandaloneActionNode`;var p9=(0,Y.memo)(e=>{let t=(0,Z.c)(4);if(e.parentId){let n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(jxe,{...e}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(f9,{...e}),t[2]=e,t[3]=n),n});p9.displayName=`ActionNode`;function Mxe(e){return e.name}function Nxe(e){let t=(0,Z.c)(3),{data:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[0]=r):r=t[0];let i;return t[1]===n.onClick?i=t[2]:(i=(0,X.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-border border-dashed bg-background/50 p-8 backdrop-blur-sm`,children:(0,X.jsxs)(zv,{className:`gap-2 shadow-lg`,onClick:n.onClick,size:`default`,children:[r,`Add a Step`]})}),t[1]=n.onClick,t[2]=i),i}var m9=(0,Y.memo)(e=>{let t=(0,Z.c)(19),{data:n,selected:r,id:i}=e;if(!n||!D0({data:n}))return null;let a=n.enabled===!1,o=r&&`border-primary`,s=a&&`opacity-50`,c;t[0]!==o||t[1]!==s?(c=Q(`flex h-full w-full flex-col rounded-md border-[1.5px] border-canvas-line bg-muted shadow-none`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=`group-node-${i}`,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(dD,{position:_w.Top,type:`target`}),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a&&(0,X.jsx)(`span`,{className:`rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[4]=a,t[5]=d);let f=n.label||`Group`,p;t[6]!==d||t[7]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-canvas-line/60 border-b px-3 font-medium text-sm`,children:[d,f]}),t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==n||t[10]!==i?(m=A0({data:n,id:i}),t[9]=n,t[10]=i,t[11]=m):m=t[11];let h;t[12]===m?h=t[13]:(h=(0,X.jsx)(dD,{id:m,position:_w.Bottom,type:`source`}),t[12]=m,t[13]=h);let g;return t[14]!==h||t[15]!==c||t[16]!==l||t[17]!==p?(g=(0,X.jsxs)(`div`,{className:c,"data-testid":l,children:[u,p,h]}),t[14]=h,t[15]=c,t[16]=l,t[17]=p,t[18]=g):g=t[18],g});m9.displayName=`GroupNode`;var h9=`25%`,g9=`75%`;function Pxe(e){let t=C1(e);return t?.startEvents.length?`On ${t.startEvents.join(`, `)}`:E1(t)?`Manual runs only`:`Nothing starts this yet`}var _9=(0,Y.memo)(e=>{let t=(0,Z.c)(33),{data:n,selected:r}=e;if(!n)return null;let i=n.label||`Lifecycle`,a;t[0]===n.config?a=t[1]:(a=Pxe(n.config),t[0]=n.config,t[1]=a);let o=a,s=n.description||o,c=n.status,l;t[2]===n.config?l=t[3]:(l=w1(n.config),t[2]=n.config,t[3]=l);let u=!l,d=r&&`border-primary`,f;t[4]===d?f=t[5]:(f=Q(d),t[4]=d,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p={id:k2,position:_w.Bottom,style:{left:h9,width:12,height:12}},t[6]=p):p=t[6];let m;t[7]===u?m=t[8]:(m={target:!1,source:[p,{id:A2,position:_w.Bottom,style:{left:g9,width:12,height:12,...u?{opacity:.45}:{}}}]},t[7]=u,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=T4(),t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:h9},children:`Started`}),t[10]=g):g=t[10];let _=u&&`opacity-50`,v;t[11]===_?v=t[12]:(v=Q(`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,_),t[11]=_,t[12]=v);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y={left:g9},t[13]=y):y=t[13];let b;t[14]===v?b=t[15]:(b=(0,X.jsx)(`div`,{className:v,style:y,children:`Canceled`}),t[14]=v,t[15]=b);let x;t[16]===n.issues?x=t[17]:(x=(0,X.jsx)(Z7,{issues:n.issues}),t[16]=n.issues,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(sy,{className:Q(O4,`text-node-lifecycle`),strokeWidth:1.5}),t[18]=S):S=t[18];let C;t[19]===i?C=t[20]:(C=(0,X.jsx)(J7,{children:i}),t[19]=i,t[20]=C);let w;t[21]===s?w=t[22]:(w=s&&(0,X.jsx)(Y7,{children:s}),t[21]=s,t[22]=w);let T;t[23]!==C||t[24]!==w?(T=(0,X.jsxs)(X7,{children:[S,C,w]}),t[23]=C,t[24]=w,t[25]=T):T=t[25];let E;return t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==T||t[30]!==f||t[31]!==m?(E=(0,X.jsxs)(q7,{className:f,handles:m,status:c,style:h,children:[g,b,x,T]}),t[26]=c,t[27]=b,t[28]=x,t[29]=T,t[30]=f,t[31]=m,t[32]=E):E=t[32],E});_9.displayName=`LifecycleNode`;function Fxe(e){let t=(0,Z.c)(8),n=TA(d3),r=TA(f3),i=TA(p3),a=TA(Y4),o=yy(),s;t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==a||t[4]!==r?(s=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||V7(e.target))return;let t=e.key.toLowerCase();if(t===`c`){n()&&e.preventDefault();return}if(t===`v`){r()&&e.preventDefault();return}if(t===`d`){i()&&e.preventDefault();return}t===`g`&&a({catalog:o})&&e.preventDefault()},t[0]=o,t[1]=n,t[2]=i,t[3]=a,t[4]=r,t[5]=s):s=t[5];let c=s,l;t[6]===e?l=t[7]:(l={enabled:e},t[6]=e,t[7]=l),_Y(window,`keydown`,c,l)}var Ixe=300;function Lxe(){let e=(0,Z.c)(8),t=wA(Q4),n=yy(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i0(),e[0]=r):r=e[0];let{data:i}=Xe(r),a=TA(C4),o=bY(t,Ixe),s;bb0:{if(!i){s=S4;break bb0}let t;e[1]!==n||e[2]!==i||e[3]!==o?(t=y4({nodes:G1(o),catalog:n,integrations:i}),e[1]=n,e[2]=i,e[3]=o,e[4]=t):t=e[4],s=t}let c=s,l;e[5]!==c||e[6]!==a?(l=()=>{a(e=>Lfe(e,c)?e:c)},e[5]=c,e[6]=a,e[7]=l):l=e[7],vY(c,l)}function Rxe(e){let t=(0,Z.c)(103),{menuState:n,onClose:r}=e,i=wA(Q4),a=wA($4),o=TA(h3),s=TA(Z4),c=TA(u3),l=TA(d3),u=TA(f3),d=TA(p3),f=TA(Y4),p=TA(X4),m=wA(lpe),h=TA(H4),g=TA(g2),_=yy(),{open:v}=RY(),{openSheet:y}=O7(),b=jY(),x=(0,Y.useRef)(null),S;t[0]!==o||t[1]!==n||t[2]!==r||t[3]!==v?(S=()=>{if(n?.nodeId){let e=n.nodeId;r(),v(CX,{title:`Delete Step`,message:`Are you sure you want to delete this node? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{o(e)}})}},t[0]=o,t[1]=n,t[2]=r,t[3]=v,t[4]=S):S=t[4];let C=S,w;t[5]!==b||t[6]!==n||t[7]!==r||t[8]!==y||t[9]!==g||t[10]!==h?(w=()=>{if(n?.nodeId){let e=n.nodeId;r(),h(e),g(`properties`),b&&y()}},t[5]=b,t[6]=n,t[7]=r,t[8]=y,t[9]=g,t[10]=h,t[11]=w):w=t[11];let T=w,E;t[12]!==s||t[13]!==n||t[14]!==r||t[15]!==v?(E=()=>{if(n?.edgeId){let e=n.edgeId;r(),v(CX,{title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s(e)}})}},t[12]=s,t[13]=n,t[14]=r,t[15]=v,t[16]=E):E=t[16];let D=E,O;t[17]!==c||t[18]!==n||t[19]!==r||t[20]!==g||t[21]!==h?(O=()=>{if(n?.flowPosition){let e={id:u0(),type:`action`,position:{x:n.flowPosition.x,y:n.flowPosition.y-56},data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};c(e),h(e.id),g(`properties`)}r()},t[17]=c,t[18]=n,t[19]=r,t[20]=g,t[21]=h,t[22]=O):O=t[22];let k=O,A;t[23]!==l||t[24]!==n||t[25]!==r?(A=()=>{n?.nodeId&&l(n.nodeId),r()},t[23]=l,t[24]=n,t[25]=r,t[26]=A):A=t[26];let j=A,M;t[27]!==d||t[28]!==n||t[29]!==r?(M=()=>{n?.nodeId&&d(n.nodeId),r()},t[27]=d,t[28]=n,t[29]=r,t[30]=M):M=t[30];let N=M,P;t[31]!==_||t[32]!==f||t[33]!==n||t[34]!==r?(P=()=>{if(n?.type!==`node`){r();return}f({catalog:_,selectedIds:n.selectedIds??new Set}),r()},t[31]=_,t[32]=f,t[33]=n,t[34]=r,t[35]=P):P=t[35];let F=P,I;t[36]!==n||t[37]!==r||t[38]!==p?(I=()=>{n?.nodeId&&p(n.nodeId),r()},t[36]=n,t[37]=r,t[38]=p,t[39]=I):I=t[39];let L=I,R;t[40]!==n?.flowPosition||t[41]!==r||t[42]!==u?(R=()=>{u(n?.flowPosition),r()},t[40]=n?.flowPosition,t[41]=r,t[42]=u,t[43]=R):R=t[43];let z=R,B;t[44]===r?B=t[45]:(B=e=>{let t=e.target;x.current&&!(t instanceof globalThis.Node&&x.current.contains(t))&&r()},t[44]=r,t[45]=B);let V=B,H;t[46]===r?H=t[47]:(H=e=>{e.key===`Escape`&&r()},t[46]=r,t[47]=H);let U=H,W=n!==null,G;t[48]===W?G=t[49]:(G={deferAttach:!0,enabled:W},t[48]=W,t[49]=G),_Y(document,`mousedown`,V,G);let K;t[50]===W?K=t[51]:(K={enabled:W},t[50]=W,t[51]=K),_Y(document,`keydown`,U,K);let q;if(t[52]===W?q=t[53]:(q={enabled:W},t[52]=W,t[53]=q),_Y(window,`resize`,r,q),!n)return null;let J,ee,te,ne,re,ie;if(t[54]!==_||t[55]!==a||t[56]!==n.nodeId||t[57]!==n.selectedIds||t[58]!==i){ee=n.nodeId?i.find(e=>e.id===n.nodeId):void 0,ne=ee?.data.type===`lifecycle`;let e;t[65]===n.selectedIds?e=t[66]:(e=n.selectedIds??new Set,t[65]=n.selectedIds,t[66]=e);let r=e,o;t[67]!==_||t[68]!==a||t[69]!==r||t[70]!==i?(o=P0(i,a,r,_),t[67]=_,t[68]=a,t[69]=r,t[70]=i,t[71]=o):o=t[71],te=o,J=te.ok,re=P4(ee),ie=ee?M4([ee]):null,t[54]=_,t[55]=a,t[56]=n.nodeId,t[57]=n.selectedIds,t[58]=i,t[59]=J,t[60]=ee,t[61]=te,t[62]=ne,t[63]=re,t[64]=ie}else J=t[59],ee=t[60],te=t[61],ne=t[62],re=t[63],ie=t[64];let ae=ie,oe=ee?.data.label||`Step`,se;t[72]!==n.position.x||t[73]!==n.position.y?(se={left:n.position.x,top:n.position.y},t[72]=n.position.x,t[73]=n.position.y,t[74]=se):se=t[74];let ce;t[75]!==J||t[76]!==ae||t[77]!==te.error||t[78]!==te.ok||t[79]!==j||t[80]!==C||t[81]!==N||t[82]!==T||t[83]!==F||t[84]!==L||t[85]!==ne||t[86]!==n.type||t[87]!==oe||t[88]!==re?(ce=n.type===`node`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y9,{icon:(0,X.jsx)(kte,{className:`size-4`}),label:`Edit ${oe}`,onClick:T}),(0,X.jsx)(y9,{disabled:ne,icon:(0,X.jsx)($v,{className:`size-4`}),label:`Copy`,onClick:j,shortcut:v9(`C`)}),(0,X.jsx)(y9,{disabled:ne,icon:(0,X.jsx)(ute,{className:`size-4`}),label:`Duplicate`,onClick:N,shortcut:v9(`D`)}),(0,X.jsx)(y9,{disabled:!J,hint:!J&&!te.ok?te.error:void 0,icon:(0,X.jsx)(mte,{className:`size-4`}),label:`Group`,onClick:F,shortcut:v9(`G`)}),(0,X.jsx)(y9,{disabled:!re,icon:(0,X.jsx)(my,{className:`size-4`}),label:`Ungroup`,onClick:L}),(0,X.jsx)(y9,{disabled:ne||!!ae,hint:ae??void 0,icon:(0,X.jsx)(fy,{className:`size-4`}),label:`Delete ${oe}`,onClick:C,variant:`destructive`})]}),t[75]=J,t[76]=ae,t[77]=te.error,t[78]=te.ok,t[79]=j,t[80]=C,t[81]=N,t[82]=T,t[83]=F,t[84]=L,t[85]=ne,t[86]=n.type,t[87]=oe,t[88]=re,t[89]=ce):ce=t[89];let le;t[90]!==D||t[91]!==n.type?(le=n.type===`edge`&&(0,X.jsx)(y9,{icon:(0,X.jsx)(_te,{className:`size-4`}),label:`Delete Connection`,onClick:D,variant:`destructive`}),t[90]=D,t[91]=n.type,t[92]=le):le=t[92];let ue;t[93]!==k||t[94]!==z||t[95]!==m||t[96]!==n.type?(ue=n.type===`pane`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y9,{icon:(0,X.jsx)(cy,{className:`size-4`}),label:`Add Step`,onClick:k}),(0,X.jsx)(y9,{disabled:!m,icon:(0,X.jsx)(lte,{className:`size-4`}),label:`Paste`,onClick:z,shortcut:v9(`V`)})]}),t[93]=k,t[94]=z,t[95]=m,t[96]=n.type,t[97]=ue):ue=t[97];let de;return t[98]!==se||t[99]!==ce||t[100]!==le||t[101]!==ue?(de=(0,X.jsxs)(`div`,{className:`fade-in-0 zoom-in-95 fixed z-50 min-w-[8rem] animate-in overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md`,ref:x,style:se,children:[ce,le,ue]}),t[98]=se,t[99]=ce,t[100]=le,t[101]=ue,t[102]=de):de=t[102],de}function v9(e){return typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?`⌘${e}`:`Ctrl+${e}`}function y9(e){let t=(0,Z.c)(18),{icon:n,label:r,onClick:i,variant:a,disabled:o,hint:s,shortcut:c}=e,l=(a===void 0?`default`:a)===`destructive`&&`text-destructive hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive`,u=o&&`pointer-events-none opacity-50`,d;t[0]!==l||t[1]!==u?(d=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none`,`hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground`,l,u),t[0]=l,t[1]=u,t[2]=d):d=t[2];let f;t[3]===s?f=t[4]:(f=s?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs leading-tight`,children:s}):null,t[3]=s,t[4]=f);let p;t[5]!==r||t[6]!==f?(p=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col items-start`,children:[r,f]}),t[5]=r,t[6]=f,t[7]=p):p=t[7];let m;t[8]===c?m=t[9]:(m=c?(0,X.jsx)(`span`,{className:`ml-auto pl-4 text-muted-foreground text-xs tracking-widest`,children:c}):null,t[8]=c,t[9]=m);let h;return t[10]!==o||t[11]!==s||t[12]!==n||t[13]!==i||t[14]!==d||t[15]!==p||t[16]!==m?(h=(0,X.jsxs)(`button`,{className:d,disabled:o,onClick:i,title:s,type:`button`,children:[n,p,m]}),t[10]=o,t[11]=s,t[12]=n,t[13]=i,t[14]=d,t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function zxe(e,t,n){let r=(0,Z.c)(12),i;r[0]!==n||r[1]!==t?(i=(e,r)=>{e.preventDefault(),t({type:`node`,position:{x:e.clientX,y:e.clientY},nodeId:r.id,selectedIds:n()})},r[0]=n,r[1]=t,r[2]=i):i=r[2];let a=i,o;r[3]===t?o=r[4]:(o=(e,n)=>{e.preventDefault(),t({type:`edge`,position:{x:e.clientX,y:e.clientY},edgeId:n.id})},r[3]=t,r[4]=o);let s=o,c;r[5]!==e||r[6]!==t?(c=n=>{n.preventDefault();let r=e({x:n.clientX,y:n.clientY});t({type:`pane`,position:{x:n.clientX,y:n.clientY},flowPosition:r})},r[5]=e,r[6]=t,r[7]=c):c=r[7];let l=c,u;return r[8]!==s||r[9]!==a||r[10]!==l?(u={onNodeContextMenu:a,onEdgeContextMenu:s,onPaneContextMenu:l},r[8]=s,r[9]=a,r[10]=l,r[11]=u):u=r[11],u}var b9=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),x9=b9((e,t)=>{var n=Object.defineProperty,r=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>r(e,typeof t==`symbol`?t:t+``,n),o=i((e,t)=>{var n=class{constructor(e){a(this,`_isDirected`,!0),a(this,`_isMultigraph`,!1),a(this,`_isCompound`,!1),a(this,`_label`),a(this,`_defaultNodeLabelFn`,()=>{}),a(this,`_defaultEdgeLabelFn`,()=>{}),a(this,`_nodes`,{}),a(this,`_in`,{}),a(this,`_preds`,{}),a(this,`_out`,{}),a(this,`_sucs`,{}),a(this,`_edgeObjs`,{}),a(this,`_edgeLabels`,{}),a(this,`_nodeCount`,0),a(this,`_edgeCount`,0),a(this,`_parent`),a(this,`_children`),e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){var t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,a=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(e,t,n);var u=s(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n),a=this._edgeObjs[r];return a&&(e=a.v,t=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,n){if(e){var r=Object.values(e);return n?r.filter(function(e){return e.v===t&&e.w===n||e.v===n&&e.w===t}):r}}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function s(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return o(e,t.v,t.w,t.name)}t.exports=n}),s=i((e,t)=>{t.exports=`3.0.2`}),c=i((e,t)=>{t.exports={Graph:o(),version:s()}}),l=i((e,t)=>{var n=o();t.exports={write:r,read:s};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}),u=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r,a){return i(e,String(t),r||n,a||function(t){return e.outEdges(t)})}function i(e,t,n,r){var i={},a=!0,o=0,s=e.nodes(),c=function(e){var t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){var n=t.v===e?t.v:t.w;c({v:n,w:n===t.v?t.w:t.v})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0}});for(var u=s.length,d=1;d<u&&(a=!1,o++,l(),a);d++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}}),d=i((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}}),f=i((e,t)=>{t.exports=class{constructor(){a(this,`_arr`,[]),a(this,`_keyIndices`,{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}}),p=i((e,t)=>{var n=f();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}}),m=i((e,t)=>{var n=p();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}}),h=i((e,t)=>{t.exports=n;function n(e,t,n){if(e[t].predecessor!==void 0)throw Error(`Invalid source vertex`);if(e[n].predecessor===void 0&&n!==t)throw Error(`Invalid destination vertex`);return{weight:e[n].distance,path:r(e,t,n)}}function r(e,t,n){for(var r=[],i=n;i!==t;)r.push(i),i=e[i].predecessor;return r.push(t),r.reverse()}}),g=i((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}}),_=i((e,t)=>{var n=g();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}}),v=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}}),y=i((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r}),b=i((e,t)=>{var n=y();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}}),x=i((e,t)=>{t.exports=n;function n(e,t,n,i,a){Array.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);a=r(e,t,n===`post`,s,o,i,a)}),a}function r(e,t,n,i,a,o,s){return Object.hasOwn(i,t)||(i[t]=!0,n||(s=o(s,t)),a(t).forEach(function(t){s=r(e,t,n,i,a,o,s)}),n&&(s=o(s,t))),s}}),S=i((e,t)=>{var n=x();t.exports=r;function r(e,t,r){return n(e,t,r,function(e,t){return e.push(t),e},[])}}),C=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`post`)}}),w=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`pre`)}}),T=i((e,t)=>{var n=o(),r=f();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}e.nodeEdges(s).forEach(c)}return i}}),E=i((e,t)=>{var n=p(),r=u();t.exports=i;function i(e,t,n,r){return a(e,t,n,r||function(t){return e.outEdges(t)})}function a(e,t,i,a){if(i===void 0)return n(e,t,i,a);for(var o=!1,s=e.nodes(),c=0;c<s.length;c++){for(var l=a(s[c]),u=0;u<l.length;u++){var d=l[u],f=d.v===s[c]?d.v:d.w;i({v:f,w:f===d.v?d.w:d.v})<0&&(o=!0)}if(o)return r(e,t,i,a)}return n(e,t,i,a)}}),D=i((e,t)=>{t.exports={bellmanFord:u(),components:d(),dijkstra:p(),dijkstraAll:m(),extractPath:h(),findCycles:_(),floydWarshall:v(),isAcyclic:b(),postorder:C(),preorder:w(),prim:T(),shortestPaths:E(),reduce:x(),tarjan:g(),topsort:y()}}),O=c();t.exports={Graph:O.Graph,json:l(),alg:D(),version:O.version}}),Bxe=b9((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n}),Vxe=b9((e,t)=>{var n=x9().Graph,r=Bxe();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}}),S9=b9((e,t)=>{var n=x9().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}}),Hxe=b9((e,t)=>{var n=Vxe(),r=S9().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}}),Uxe=b9((e,t)=>{var n=S9();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}}),C9=b9((e,t)=>{var{applyWithChunking:n}=S9();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}),w9=b9((e,t)=>{var n=x9().Graph,r=C9().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}}),Wxe=b9((e,t)=>{var n=w9(),r=C9().slack,i=C9().longestPath,a=x9().alg.preorder,o=x9().alg.postorder,s=S9().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}}),Gxe=b9((e,t)=>{var n=C9().longestPath,r=w9(),i=Wxe();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}}),Kxe=b9((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}}),qxe=b9((e,t)=>{var n=S9();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}),Jxe=b9((e,t)=>{var n=S9();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}}),Yxe=b9((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}}),Xxe=b9((e,t)=>{var n=S9();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}}),Zxe=b9((e,t)=>{var n=S9().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}}),Qxe=b9((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}}),$xe=b9((e,t)=>{var n=S9();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}}),eSe=b9((e,t)=>{var n=S9();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}),tSe=b9((e,t)=>{var n=Qxe(),r=$xe(),i=eSe();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}}),nSe=b9((e,t)=>{var n=x9().Graph,r=S9();t.exports=i;function i(e,t,r,i){i||=e.nodes();let o=a(e),s=new n({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(n=>{let i=e.node(n),a=e.parent(n);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(n),s.setParent(n,a||o),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=s.edge(r,n),a=i===void 0?0:i.weight;s.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(n,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}}),rSe=b9((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}}),iSe=b9((e,t)=>{var n=Xxe(),r=Zxe(),i=tSe(),a=nSe(),o=rSe(),s=x9().Graph,c=S9();t.exports=l;function l(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t.disableOptimalOrderHeuristic)return;let p=1/0,m,h=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2,h),s=c.buildLayerMatrix(e);let i=r(e,s);i<p?(n=0,m=Object.assign({},s),p=i):i===p&&(m=structuredClone(s))}f(e,m)}function u(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return a(e,t,n,r.get(t)||[])})}function d(e,t,n){let r=new s;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let a=e.graph().root,s=i(e,a,r,t);s.vs.forEach((t,n)=>e.node(t).order=n),o(e,r,s.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}}),aSe=b9((e,t)=>{var n=x9().Graph,r=S9();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}}),oSe=b9((e,t)=>{var n=S9(),r=aSe().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=e.graph().rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}}),sSe=b9((e,t)=>{var n=Hxe(),r=Uxe(),i=Gxe(),a=S9().normalizeRanks,o=Kxe(),s=S9().removeEmptyRanks,c=qxe(),l=Jxe(),u=Yxe(),d=iSe(),f=oSe(),p=S9(),m=x9().Graph;t.exports=h;function h(e,t={}){let n=t.debugTiming?p.time:p.notime;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));return n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r)),r})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>I(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>L(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>R(e)),t(` removeBorderNodes`,()=>F(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`,rankalign:`center`},b=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=B(e.graph());return t.setGraph(Object.assign({},y,z(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=z(B(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=B(e.edge(n));t.setEdge(n,Object.assign({},w,z(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function F(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function I(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function L(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function R(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function z(e,t){return p.mapValues(p.pick(e,t),Number)}function B(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}}),cSe=b9((e,t)=>{var n=S9(),r=x9().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}}),lSe=b9((e,t)=>{t.exports=`2.0.4`}),T9=b9((e,t)=>{t.exports={graphlib:x9(),layout:sSe(),debug:cSe(),util:{time:S9().time,notime:S9().notime},version:lSe()}})();function uSe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function dSe(){return this.eachAfter(uSe)}function fSe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function pSe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function mSe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function hSe(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function gSe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function _Se(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function vSe(e){for(var t=this,n=ySe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function ySe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function bSe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function xSe(){return Array.from(this)}function SSe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function CSe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*wSe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function E9(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=DSe)):t===void 0&&(t=ESe);for(var n=new D9(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new D9(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(kSe)}function TSe(){return E9(this).eachBefore(OSe)}function ESe(e){return e.children}function DSe(e){return Array.isArray(e)?e[1]:null}function OSe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function kSe(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function D9(e){this.data=e,this.depth=this.height=0,this.parent=null}D9.prototype=E9.prototype={constructor:D9,count:dSe,each:fSe,eachAfter:mSe,eachBefore:pSe,find:hSe,sum:gSe,sort:_Se,path:vSe,ancestors:bSe,descendants:xSe,leaves:SSe,links:CSe,copy:TSe,[Symbol.iterator]:wSe};function ASe(e,t){return e.parent===t.parent?1:2}function O9(e){var t=e.children;return t?t[0]:e.t}function k9(e){var t=e.children;return t?t[t.length-1]:e.t}function jSe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function MSe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function NSe(e,t,n){return e.a.parent===t.parent?e.a:n}function A9(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}A9.prototype=Object.create(D9.prototype);function PSe(e){for(var t=new A9(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new A9(a[o],o)),i.parent=n;return(t.parent=new A9(null,0)).children=[t],t}function FSe(){var e=ASe,t=1,n=1,r=null;function i(i){var s=PSe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.x<l.x&&(l=e),e.x>u.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){MSe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=k9(o),i=O9(i),o&&i;)s=O9(s),a=k9(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(jSe(NSe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!k9(a)&&(a.t=o,a.m+=u-l),i&&!O9(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var ISe=`TB`,j9=40,M9=`__workflow-root__`;function N9(e,t){return e.x!==t.x||e.y!==t.y}function LSe(e){return e.sourceHandle===`true`?4:e.sourceHandle===`false`?3:X6(e.sourceHandle)?4:6}function RSe(e){return typeof e==`number`&&Number.isFinite(e)&&e<1024?{nodeSpacing:96,rankSpacing:72}:{nodeSpacing:132,rankSpacing:88}}function zSe(e,t){let n=e.node(t);return n?.x===void 0||n.y===void 0?null:{x:n.x,y:n.y}}var P9=new Map([[`true`,0],[`false`,1],[k2,0],[A2,1]]),BSe=2**53-1;function VSe(e){if(D0(e.node)){let t=e.nodes.filter(t=>t.parentId===e.node.id).map(e=>e.id),n=new Set(t),{bounds:r}=H0(t,e.edges.filter(e=>n.has(e.source)&&n.has(e.target)),O0(e.node)),i=E4(r.columns,r.rows);return{width:i.width,height:i.height,handleRanks:P9}}if(!Z6(e.node))return{width:192,height:112,handleRanks:P9};let t=t8({targetNodeId:e.node.id,nodes:e.nodes,edges:e.edges,catalog:e.catalog});return{width:D4(t.length),height:112,handleRanks:new Map(t.map((e,t)=>[Y6(e.name),t]))}}function HSe(e){let t=t=>e.ranks.get(t.sourceHandle??``)??BSe,n=t=>e.positionXById.get(t)??0;return e.edges.toSorted((e,r)=>{let i=t(e)-t(r);return i===0?n(e.target)-n(r.target):i})}function USe(e){let t=new Map(e.nodes.map(e=>[e.id,e.position.x])),n=new Map(e.nodes.map(e=>[e.id,[]]));for(let t of e.edges)n.get(t.source)?.push(t);let r=new Map,i=new Map;for(let a of e.nodes){let o=VSe({node:a,nodes:e.allNodes,edges:e.allEdges,catalog:e.catalog});r.set(a.id,o.width),i.set(a.id,o.height),n.set(a.id,HSe({edges:n.get(a.id)??[],ranks:o.handleRanks,positionXById:t}))}return{nodes:e.nodes.toSorted((e,t)=>e.position.x-t.position.x),widthById:r,heightById:i,outEdgesBySource:n}}function WSe(e){let t=new T9.graphlib.Graph({directed:!0,multigraph:!1,compound:!1});t.setGraph({rankdir:ISe,nodesep:e.spacing.nodeSpacing,ranksep:e.spacing.rankSpacing,marginx:j9,marginy:j9}),t.setDefaultEdgeLabel(()=>({}));let n=t=>e.model.widthById.get(t)??192,r=t=>e.model.heightById.get(t)??112;for(let i of e.model.nodes)t.setNode(i.id,{width:n(i.id),height:r(i.id)});for(let n of e.model.nodes)for(let r of e.model.outEdgesBySource.get(n.id)??[])t.setEdge(r.source,r.target,{weight:LSe(r)});T9.layout(t);let i=!1;return{nodes:e.nodes.map(e=>{let a=zSe(t,e.id);if(!a)return e;let o={x:Math.round(a.x-n(e.id)/2),y:Math.round(a.y-r(e.id)/2)};return N9(e.position,o)?(i=!0,{...e,position:o}):e}),changed:i}}function GSe(e){let t=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.model.outEdgesBySource.values())for(let e of n)if(e.source===e.target||(t.set(e.target,(t.get(e.target)??0)+1),(t.get(e.target)??0)>1))return null;let n=e.model.nodes.filter(e=>(t.get(e.id)??0)===0);if(n.length===0)return null;let r=new Set,i=new Set;function a(t){if(i.has(t))return null;i.add(t),r.add(t);let n=e.model.outEdgesBySource.get(t)??[],o=[];for(let e of n){let t=a(e.target);if(!t)return null;o.push(t)}return i.delete(t),o.length===0?{id:t}:{id:t,children:o}}let o=[];for(let e of n){let t=a(e.id);if(!t)return null;o.push(t)}return r.size===e.nodes.length?{id:M9,children:o}:null}function KSe(e){if(e.nodes.some(e=>D0(e)))return null;let t=GSe({nodes:e.nodes,model:e.model});if(!t)return null;let n=t=>e.model.widthById.get(t)??192,r=E9(t,e=>e.children??[]),i=192+e.spacing.nodeSpacing;FSe().nodeSize([i,112+e.spacing.rankSpacing]).separation((t,r)=>{let a=t.parent===r.parent?e.spacing.nodeSpacing:e.spacing.nodeSpacing*2;return(n(t.data.id)/2+n(r.data.id)/2+a)/i})(r);let a=r.descendants().filter(e=>e.data.id!==M9);if(a.length===0)return{nodes:e.nodes,changed:!1};let o=new Map;for(let e of a){let t=e.x??0,r=e.y??0;o.set(e.data.id,{x:t-n(e.data.id)/2,y:r-56})}let s=Array.from(o.values()),c=Math.min(...s.map(e=>e.x)),l=Math.min(...s.map(e=>e.y)),u=!1;return{nodes:e.nodes.map(e=>{let t=o.get(e.id);if(!t)return e;let n={x:Math.round(t.x-c+j9),y:Math.round(t.y-l+j9)};return N9(e.position,n)?(u=!0,{...e,position:n}):e}),changed:u}}function qSe(e){return e.type!==`add`&&!e.parentId}function JSe(e){let t=e.nodes.filter(qSe);if(t.length===0)return{nodes:e.nodes,changed:!1};let n=new Set(t.map(e=>e.id)),r=Jue(e.nodes,e.edges).filter(e=>n.has(e.source)&&n.has(e.target)),i=RSe(e.availableWidth),a=USe({nodes:t,allNodes:e.nodes,edges:r,allEdges:e.edges,catalog:e.catalog}),o=KSe({nodes:t,model:a,spacing:i})??WSe({nodes:t,model:a,spacing:i}),s=new Map(o.nodes.map(e=>[e.id,e])),c=Hfe(e.nodes.map(e=>{let t=s.get(e.id);return t?{...e,position:t.position}:e}),e.edges),l=new Map(e.nodes.map(e=>[e.id,e]));return{nodes:c,changed:c.some(e=>{let t=l.get(e.id);return!t||N9(t.position,e.position)||t.width!==e.width||t.height!==e.height})}}var YSe={[U1]:Jbe.Animated},XSe={type:U1},ZSe={lifecycle:_9,action:p9,add:Nxe,group:m9};function QSe(){let e=yy(),t=wA($fe),n=wA(epe),r=wA($4),i=wA(n3),a=wA(Q0),[o]=EA(_2),s=jY(),{openSheet:c}=O7(),l=wA(xde),u=s?null:l,[d,f]=EA(v2),p=TA(spe),m=TA(cpe),h=TA(H4),g=TA(U4),_=TA(u3),v=TA(upe),y=TA(Zfe),b=TA(ope),x=TA(ipe),S=TA(_3),C=TA(v3),w=TA(g2),{screenToFlowPosition:T,fitView:E,getViewport:D,setViewport:O}=RE(),k=(0,Y.useRef)(null),A=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=(0,Y.useRef)(!1),N=(0,Y.useRef)(!1),P=(0,Y.useRef)(null),F=(0,Y.useRef)(0),I=(0,Y.useRef)(!1),[L,R]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(null),U=(0,Y.useRef)(new Set);_Y(window,`pointerdown`,e=>{e.button===2&&(U.current=new Set(t.filter(e=>e.selected).map(e=>e.id)))},{capture:!0,enabled:!i});let{onNodeContextMenu:W,onEdgeContextMenu:G,onPaneContextMenu:K}=zxe(T,H,(0,Y.useCallback)(()=>U.current,[])),q=(0,Y.useCallback)(()=>{H(null)},[]),J=t.some(e=>e.type!==`add`),ee=(0,Y.useMemo)(()=>t.filter(e=>e.type!==`add`).length,[t]),te=(0,Y.useRef)(!1);vY(d,()=>{if(!d||te.current||(te.current=!0,document.cookie.split(`; `).find(e=>e.startsWith(`sidebar-collapsed=`))?.split(`=`)[1]===`true`))return;let e=D(),t=window.innerWidth*.3/2;O({...e,x:e.x-t},{duration:0})}),yY(a,()=>{if(d&&N.current){R(!0),f(!1);return}E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0),f(!1)}),yY(!a&&J,()=>{a||!J||(E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0))});let ne=(0,Y.useCallback)(e=>{!(e.metaKey||e.ctrlKey)||e.key.toLowerCase()!==`z`||V7(e.target)||i||(e.preventDefault(),e.shiftKey?C():S())},[S,C,i]);_Y(window,`keydown`,ne),Fxe(!i),Lxe();let re=(0,Y.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`/`&&(e.preventDefault(),E({padding:.2,duration:300}))},[E]);_Y(window,`keydown`,re);let ie=(0,Y.useCallback)(()=>{if(i||ee<2||I.current)return;I.current=!0,B(!0);let r=F.current+1;F.current=r;try{let i=P.current?.getBoundingClientRect().width??(typeof window<`u`?window.innerWidth:void 0),{nodes:a,changed:o}=JSe({nodes:t,edges:n,availableWidth:i,catalog:e});if(r!==F.current)return;o&&v(a),window.requestAnimationFrame(()=>{Promise.resolve(E({maxZoom:1,minZoom:.5,padding:.2,duration:300})).catch(()=>void 0)})}finally{r===F.current&&(I.current=!1,B(!1))}},[v,n,E,i,t,ee,e]),ae=(0,Y.useCallback)((e,n)=>{let r=t.find(t=>t.id===e);return!r||r.type===`add`||r.parentId?!1:n!==`target`||r.type!==`lifecycle`},[t]),oe=(0,Y.useCallback)(i=>{let a=i.source,o=i.target;if(!(a&&o)||a===o)return!1;let s=t.find(e=>e.id===a),c=t.find(e=>e.id===o);if(s?.parentId||c?.parentId)return!1;let l=`id`in i&&typeof i.id==`string`?i.id:null,u=G7({nodes:t,edges:n,sourceNodeId:a,sourceHandle:`sourceHandle`in i?i.sourceHandle:void 0,catalog:e}),d=F0({nodes:t,edges:r,sourceId:a,targetId:o,sourceHandle:u,excludeEdgeId:l});if(d.length===0)return!1;let f=[...r.filter(e=>e.id!==l),...d];return!Gbe({nodes:t,edges:f})},[e,n,t,r]),se=(0,Y.useCallback)((r,i)=>G7({nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:e}),[t,n,e]),ce=(0,Y.useCallback)(e=>{if(!(e.source&&e.target)||!oe(e))return;let t=se(e.source,e.sourceHandle),n={id:u0(),...e,sourceHandle:t};y(n)},[se,oe,y]),le=(0,Y.useCallback)(({nodes:e,edges:t})=>!(e.some(e=>e.data.type!==`lifecycle`)||t.length>0)||N4(e)?Promise.resolve(!1):(x(),Promise.resolve(!0)),[x]),ue=(0,Y.useCallback)((e,t)=>{h(t.id),w(`properties`),s&&c()},[h,w,s,c]),de=(0,Y.useCallback)((e,t)=>{k.current=t.nodeId,A.current=t.handleType,j.current=t.handleId??null},[]),fe=(0,Y.useCallback)(e=>({clientX:`changedTouches`in e?e.changedTouches[0].clientX:e.clientX,clientY:`changedTouches`in e?e.changedTouches[0].clientY:e.clientY}),[]),pe=(0,Y.useCallback)((e,t,n)=>{let r=(e.target instanceof Element?e.target:void 0)?.closest(`.react-flow`)?.getBoundingClientRect();return{adjustedX:r?t-r.left:t,adjustedY:r?n-r.top:n}},[]),me=(0,Y.useCallback)(e=>{let t=e.getAttribute(`data-id`),n=A.current===`source`,r=n?`target`:`source`,i=k.current;if(t&&i&&t!==i&&ae(t,r)){let e=n?i:t,r=n?t:i,a=se(e,n?j.current:null),o=n?null:j.current;ce({source:e,target:r,sourceHandle:a,targetHandle:o})}},[ae,se,ce]),he=(0,Y.useCallback)((e,t,n)=>{let r=k.current;if(!r)return;let i=A.current===`source`;if(!(i||oe({source:`__new_node__`,target:r,sourceHandle:null,targetHandle:null})))return;let{adjustedX:a,adjustedY:o}=pe(e,t,n),s=T({x:a,y:o});s.y-=56;let c={id:u0(),type:`action`,position:s,data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};_(c),h(c.id),w(`properties`),setTimeout(()=>{b(c.id)},50);let l=i?r:c.id,u=i?c.id:r,d=se(l,i?j.current:null),f=i?null:j.current;ce({source:l,target:u,sourceHandle:d,targetHandle:f}),M.current=!0,setTimeout(()=>{M.current=!1},100)},[pe,T,_,b,h,w,se,ce,oe]),ge=(0,Y.useCallback)(e=>{if(!k.current)return;let{clientX:t,clientY:n}=fe(e),r;if(r=`changedTouches`in e?document.elementFromPoint(t,n):e.target instanceof Element?e.target:null,!r){k.current=null,A.current=null,j.current=null;return}let i=r.closest(`.react-flow__node`),a=r.closest(`.react-flow__handle`);if(i&&!a&&A.current){me(i),k.current=null,A.current=null,j.current=null;return}i||a||he(e,t,n),k.current=null,A.current=null,j.current=null},[fe,me,he]),_e=(0,Y.useCallback)(()=>{M.current||(h(null),g(null),q())},[h,g,q]),ve=(0,Y.useCallback)(({nodes:e})=>{M.current&&e.length===0||(e.length===0?h(null):e.length===1&&h(e[0].id))},[h]);return(0,X.jsxs)(`div`,{className:`relative h-full bg-background`,"data-testid":`workflow-canvas`,ref:P,style:{opacity:+!!L,width:u?`calc(100% - ${u})`:`100%`,transition:`opacity 300ms`},children:[(0,X.jsx)(`div`,{className:`pointer-events-auto`,children:(0,X.jsx)(zbe,{workflowId:a??void 0})}),(0,X.jsxs)(zye,{className:`bg-background`,connectionLineComponent:Hye,connectionMode:dw.Strict,defaultEdgeOptions:XSe,edges:n,edgeTypes:YSe,elementsSelectable:!i,isValidConnection:oe,nodes:t,nodesConnectable:!i,nodesDraggable:!i,nodeTypes:ZSe,onBeforeDelete:le,onConnect:i?void 0:ce,onConnectEnd:i?void 0:ge,onConnectStart:i?void 0:de,onEdgeContextMenu:i?void 0:G,onEdgesChange:i?void 0:m,onNodeClick:i?void 0:ue,onNodeContextMenu:i?void 0:W,onNodesChange:i?void 0:p,onPaneClick:_e,onPaneContextMenu:i?void 0:K,onSelectionChange:i?void 0:ve,children:[(0,X.jsx)(Ybe,{className:`workflow-controls-panel border-none bg-transparent p-0`,position:`bottom-left`,children:(0,X.jsx)(Wye,{canReflow:!i&&ee>1&&!z,onReflow:i?void 0:ie})}),o&&(0,X.jsx)(Ek,{bgColor:`var(--sidebar)`,className:`rounded-lg border shadow-sm`,maskColor:`color-mix(in oklch, var(--muted) 60%, transparent)`,nodeColor:`var(--muted-foreground)`,nodeStrokeColor:`var(--border)`})]}),(0,X.jsx)(Rxe,{menuState:V,onClose:q})]})}var $Se=/^\/workflows\/[^/]+$/;function eCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:tCe},e[0]=t):t=e[0];let n=za(t);if(!$Se.test(n))return null;let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`div`,{className:`fixed inset-0 z-0`,children:(0,X.jsx)(QSe,{})}),e[1]=r):r=e[1],r}function tCe(e){return e.location.pathname}var F9=pA(),I9=`The workflow could not be loaded. Try again.`;function nCe(e){return e instanceof X1&&e.status===404?{notFound:!0,message:null}:{notFound:!1,message:I9}}function rCe(e){return e?`runs`:null}var iCe=ma(`/workflows/$workflowId`);function aCe(){let e=(0,Z.c)(19),t=wA(Q0),[n,r]=EA(O2),i=TA(V4),a=TA(gpe),{executionId:o}=iCe.useSearch(),s;e[0]===o?s=e[1]:(s=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:o??``},select:tye}),e[0]=o,e[1]=s);let c=o!==void 0,l;e[2]!==s||e[3]!==c?(l={...s,enabled:c,staleTime:0},e[2]=s,e[3]=c,e[4]=l):l=e[4];let u=Xe(l),d=u.data?.workflowVersionId,f;e[5]===d?f=e[6]:(f=r0.workflow.getVersionGraph.queryOptions({input:{versionId:d??``},select:sCe}),e[5]=d,e[6]=f);let p=d!==void 0,m;e[7]!==f||e[8]!==p?(m={...f,enabled:p,staleTime:1/0},e[7]=f,e[8]=p,e[9]=m):m=e[9];let h=Xe(m),g=u.data,_=h.data,v=g!==void 0&&_!==void 0&&g.workflowId===t,y;e[10]!==t||e[11]!==g||e[12]!==o||e[13]!==_||e[14]!==a||e[15]!==n||e[16]!==i||e[17]!==r?(y=()=>{if(o===void 0){r(null),i(null);return}if(n!==o&&a(),r(o),g===void 0||_===void 0||g.workflowId!==t){i(null);return}let e=H1(_);i({nodes:e.nodes.map(oCe),edges:e.edges.map(J1)})},e[10]=t,e[11]=g,e[12]=o,e[13]=_,e[14]=a,e[15]=n,e[16]=i,e[17]=r,e[18]=y):y=e[18],vY(o===void 0?`closed`:v?`ready:${o}:${t}`:`open:${o}:${t??``}`,y)}function oCe(e){return{...q1(e),selected:!1}}function sCe(e){return e.graph}function cCe(){return aCe(),null}function lCe(e){return eY(`alert-dialog`,e)}function L9(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(lCe,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function uCe(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(LJ,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function dCe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`data-[starting-style]:fade-in-0 data-[ending-style]:fade-out-0 fixed inset-0 z-50 bg-foreground/50 data-[closed]:animate-out data-[open]:animate-in`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oH,{className:i,"data-slot":`alert-dialog-overlay`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function R9(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(dCe,{}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 grid w-full max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[open]:animate-in`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,X.jsxs)(uCe,{children:[i,(0,X.jsx)(nY,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:(0,X.jsx)(PJ,{className:a,"data-slot":`alert-dialog-content`,...r})})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function z9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold text-lg`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(rY,{className:i,"data-slot":`alert-dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function H9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(FH,{className:i,"data-slot":`alert-dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U9(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=Q(Rv({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,X.jsx)(kH,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function W9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Rv({variant:`outline`}),n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(kH,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fCe(e){let t=(0,Z.c)(18),{open:n,onOpenChange:r,onConfirm:i,title:a,description:o,confirmLabel:s}=e,c=a===void 0?`Delete`:a,l=o===void 0?`Are you sure? This action cannot be undone.`:o,u=s===void 0?`Delete`:s,d;t[0]===c?d=t[1]:(d=(0,X.jsx)(V9,{children:c}),t[0]=c,t[1]=d);let f;t[2]===l?f=t[3]:(f=(0,X.jsx)(H9,{children:l}),t[2]=l,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,X.jsxs)(z9,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(W9,{children:`Cancel`}),t[7]=m):m=t[7];let h;t[8]!==u||t[9]!==i?(h=(0,X.jsxs)(B9,{children:[m,(0,X.jsx)(U9,{onClick:i,variant:`destructive`,children:u})]}),t[8]=u,t[9]=i,t[10]=h):h=t[10];let g;t[11]!==p||t[12]!==h?(g=(0,X.jsxs)(R9,{children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;return t[14]!==r||t[15]!==n||t[16]!==g?(_=(0,X.jsx)(L9,{onOpenChange:r,open:n,children:g}),t[14]=r,t[15]=n,t[16]=g,t[17]=_):_=t[17],_}var pCe=4;function mCe(){let e=(0,Z.c)(11),[t,n]=(0,Y.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={confirm:n,tabs:`top`},e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(E7,{frame:i}),e[1]=a):a=e[1];let o=t?.confirmLabel,s=t?.message,c;e[2]===t?c=e[3]:(c=()=>t?.onConfirm(),e[2]=t,e[3]=c);let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{e||n(null)},e[4]=l):l=e[4];let u=t!==null,d=t?.title,f;return e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==u||e[9]!==d?(f=(0,X.jsxs)(`aside`,{className:`flex size-full flex-col overflow-hidden bg-card`,children:[a,(0,X.jsx)(fCe,{confirmLabel:o,description:s,onConfirm:c,onOpenChange:l,open:u,title:d})]}),e[5]=o,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f):f=e[10],f}function hCe(){let e=(0,Z.c)(29),t=jY(),[n,r]=EA(b2),[i,a]=EA(S2),o=wA(H4),{hasOverlays:s}=RY(),{openSheet:c}=O7(),l=l7(),u;e[0]!==s||e[1]!==t||e[2]!==c||e[3]!==o?(u=()=>{t&&o&&!s&&c()},e[0]=s,e[1]=t,e[2]=c,e[3]=o,e[4]=u):u=e[4],vY(t,u);let d;e[5]!==l||e[6]!==r?(d=e=>{e&&l(),r(e)},e[5]=l,e[6]=r,e[7]=d):d=e[7];let f=d,[p,m]=(0,Y.useState)(!1),h=(0,Y.useRef)(!1),g;e[8]!==n||e[9]!==f?(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`b`&&(e.preventDefault(),f(!n))},e[8]=n,e[9]=f,e[10]=g):g=e[10],_Y(window,`keydown`,g);let _;e[11]!==n||e[12]!==f||e[13]!==a?(_=e=>{e.preventDefault(),h.current=!0,m(!0);let t=e.clientX,r=!1,i=e=>{if(!h.current||(Math.abs(e.clientX-t)>pCe&&(r=!0),!r))return;let n=(window.innerWidth-e.clientX)/window.innerWidth*100;a(Math.min(50,Math.max(20,n)))},o=()=>{h.current=!1,m(!1),document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,o),document.removeEventListener(`pointercancel`,o),document.body.style.cursor=``,document.body.style.userSelect=``,r||f(!n)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,o),document.addEventListener(`pointercancel`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},e[11]=n,e[12]=f,e[13]=a,e[14]=_):_=e[14];let v=_,y;e[15]!==t||e[16]!==n||e[17]!==f?(y=!t&&n&&(0,X.jsx)(`button`,{className:`pointer-events-auto absolute top-1/2 right-0 z-20 flex size-6 -translate-y-1/2 items-center justify-center rounded-l-full border border-r-0 bg-background shadow-sm transition-colors hover:bg-muted`,onClick:()=>{f(!1)},type:`button`,children:(0,X.jsx)(Yv,{className:`size-4`})}),e[15]=t,e[16]=n,e[17]=f,e[18]=y):y=e[18];let b;e[19]!==v||e[20]!==p||e[21]!==t||e[22]!==n||e[23]!==i||e[24]!==f?(b=!t&&(0,X.jsxs)(`div`,{className:`workflow-sidebar-panel pointer-events-auto absolute inset-y-0 right-0 z-20 border-l bg-sidebar transition-transform duration-200 ease-out`,style:{width:C2(i),transform:n?`translateX(100%)`:`translateX(0)`},children:[(0,X.jsxs)(`div`,{"aria-label":`Resize properties panel. Click to collapse.`,"aria-orientation":`vertical`,"aria-valuenow":i,className:`group absolute inset-y-0 left-0 z-10 w-3 cursor-col-resize`,onPointerDown:v,role:`separator`,tabIndex:0,children:[(0,X.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 bg-transparent transition-colors group-hover:bg-ring group-active:bg-primary`}),!(p||n)&&(0,X.jsx)(`button`,{"aria-label":`Collapse panel`,className:`absolute top-1/2 left-0 flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border bg-background shadow-sm transition-opacity hover:bg-muted focus-visible:opacity-100 lg:opacity-0 lg:group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),f(!0)},onPointerDown:gCe,type:`button`,children:(0,X.jsx)(Xv,{className:`size-4`})})]}),(0,X.jsx)(mCe,{})]}),e[19]=v,e[20]=p,e[21]=t,e[22]=n,e[23]=i,e[24]=f,e[25]=b):b=e[25];let x;return e[26]!==y||e[27]!==b?(x=(0,X.jsxs)(X.Fragment,{children:[y,b]}),e[26]=y,e[27]=b,e[28]=x):x=e[28],x}function gCe(e){return e.stopPropagation()}var _Ce=500,vCe=()=>{let e=(0,Z.c)(33),t=wA(T2),n=wA(s2),r=wA(Q4),i=wA($4),[a]=EA(Q0),[o]=EA(O2),s=wA(t3),c=TA(w2),l=TA(d2),u=TA(y3),d=wA(r2),f=wA(i2),p;e[0]===n?p=e[1]:(p=()=>{n&&Ty.error(n.message||`Failed to save workflow`)},e[0]=n,e[1]=p),vY(n,p);let m;e[2]!==a||e[3]!==i||e[4]!==t||e[5]!==r||e[6]!==l?(m=async()=>{if(!a||t)return;let e=await l({nodes:r,edges:i},{immediate:!0});e&&!e.ok&&Ty.error(e.error.message||`Failed to save workflow`)},e[2]=a,e[3]=i,e[4]=t,e[5]=r,e[6]=l,e[7]=m):m=e[7];let h=m,g;e[8]===h?g=e[9]:(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),e.stopPropagation(),h())},e[8]=h,e[9]=g);let _=g,v;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={capture:!0},e[10]=v):v=e[10],_Y(document,`keydown`,_,v);let y;e[11]===o?y=e[12]:(y=r0.workflow.getExecutionStatus.queryOptions({input:{executionId:o??``}}),e[11]=o,e[12]=y);let b=o!==null,x;e[13]!==y||e[14]!==b?(x={...y,enabled:b,staleTime:0,refetchIntervalInBackground:!1,refetchInterval:yCe},e[13]=y,e[14]=b,e[15]=x):x=e[15];let S=Xe(x).data,C;e[16]===S?.nodeStatuses?C=e[17]:(C=S?.nodeStatuses.map(bCe).join(`,`)??``,e[16]=S?.nodeStatuses,e[17]=C);let w=C,T;e[18]!==S||e[19]!==r||e[20]!==o||e[21]!==c||e[22]!==u?(T=()=>{if(!o){u(r.map(xCe)),c(!1);return}S&&(u(S.nodeStatuses.map(SCe)),c(o7(S.status)))},e[18]=S,e[19]=r,e[20]=o,e[21]=c,e[22]=u,e[23]=T):T=e[23],vY(o===null?`idle`:`${o}:${s}:${S===void 0?`loading`:`${S.status}:${w}`}`,T);let E;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(cCe,{}),e[24]=E):E=e[24];let D;e[25]===d?D=e[26]:(D=d&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Workflow Not Found`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:`The workflow you're looking for doesn't exist or has been deleted.`}),(0,X.jsx)(zv,{render:(0,X.jsx)(fa,{to:`/`}),children:`Go to Dashboard`})]})}),e[25]=d,e[26]=D);let O;e[27]===f?O=e[28]:(O=f&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Couldn't Load Workflow`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:f}),(0,X.jsx)(zv,{onClick:CCe,children:`Try Again`})]})}),e[27]=f,e[28]=O);let k;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(hCe,{}),e[29]=k):k=e[29];let A;return e[30]!==D||e[31]!==O?(A=(0,X.jsxs)(`div`,{className:`flex h-dvh w-full flex-col overflow-hidden`,children:[E,D,O,k]}),e[30]=D,e[31]=O,e[32]=A):A=e[32],A};function yCe(e){return o7(e.state.data?.status)?_Ce:!1}function bCe(e){return`${e.nodeId}=${e.status}`}function xCe(e){return{nodeId:e.id,status:`idle`}}function SCe(e){return{nodeId:e.nodeId,status:e.status===`pending`?`idle`:e.status}}function CCe(){return window.location.reload()}var wCe=jy(`workflows`),G9=3,K9=[`running`,`waiting`,`failed`,`completed`,`canceled`,`pending`],TCe=[...K9,`superseded`];function ECe(e){if(!e)return`-`;let t=Number.parseInt(e,10);return Number.isNaN(t)?e:t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}var DCe=100;function OCe(e){return e.toSorted(kCe)}function kCe(e,t){return new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()}function ACe(e){return e===`pause`?`Paused`:e===`resume`?`Resumed`:`Deleted`}function q9(e,t,n){return e===1?t:n}function jCe(){let e=(0,Z.c)(165),t=Gi(),n=Fe(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,e[0]=r):r=e[0];let[i,a]=(0,Y.useState)(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Set,e[1]=o):o=e[1];let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(null),y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=r0.workflow.getAll.queryOptions({input:{},select:OCe,meta:{errorMessage:`Failed to load workflows`}}),e[2]=y):y=e[2];let{data:b,isPending:x}=Xe(y),S;e[3]===b?S=e[4]:(S=b===void 0?[]:b,e[3]=b,e[4]=S);let C=S,w;e[5]===C?w=e[6]:(w=C.filter(HCe),e[5]=C,e[6]=w);let T=w,E;e[7]===i?E=e[8]:(E=Array.from(i),e[7]=i,e[8]=E);let D=E,O;e[9]!==D||e[10]!==T?(O=D.filter(e=>T.some(t=>t.id===e&&t.isOwner!==!1)),e[9]=D,e[10]=T,e[11]=O):O=e[11];let k=O,A;e[12]!==i||e[13]!==T?(A=T.length>0&&T.every(e=>i.has(e.id)),e[12]=i,e[13]=T,e[14]=A):A=e[14];let j=A,M=l&&k.length>0,N;e[15]!==M||e[16]!==k||e[17]!==s?(N=OQ({workflowIds:M?k.toSorted():void 0,statuses:s.size>0?Array.from(s).toSorted():K9.toSorted(),limit:DCe},DQ),e[15]=M,e[16]=k,e[17]=s,e[18]=N):N=e[18];let P=N,F;e[19]===P?F=e[20]:(F=r0.workflow.getExecutionsGlobal.infiniteOptions({input:e=>({...P,cursor:e}),initialPageParam:void 0,getNextPageParam:VCe,meta:{errorMessage:`Failed to load workflow runs`}}),e[19]=P,e[20]=F);let I=Qe(F),L;e[21]===I.data?.pages?L=e[22]:(L=I.data?.pages.flatMap(BCe)??[],e[21]=I.data?.pages,e[22]=L);let R=L,z=I.isPending,B=I.isFetchingNextPage,V;e[23]===n?V=e[24]:(V=()=>a0(n),e[23]=n,e[24]=V);let H=V,U;e[25]===n?U=e[26]:(U=()=>s0(n),e[25]=n,e[26]=U);let W=U,G;e[27]===H?G=e[28]:(G=r0.workflow.update.mutationOptions({onSuccess:async(e,t)=>{let{mode:n}=t;await H(),Ty.success(n===`test`?`Switched workflow to Test mode`:`Switched workflow to Live mode`)},meta:{errorMessage:`Failed to switch workflow mode`}}),e[27]=H,e[28]=G);let K=Ze(G),q;e[29]===T?q=e[30]:(q=e=>{if(!e){a(new Set);return}a(new Set(T.map(zCe)))},e[29]=T,e[30]=q);let J=q,ee;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(e,t)=>{a(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},e[31]=ee):ee=e[31];let te=ee,ne;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},e[32]=ne):ne=e[32];let re=ne,ie;e[33]===n?ie=e[34]:(ie=r0.workflow.bulkLifecycle.mutationOptions({onSuccess:async(e,t)=>{let{action:r}=t;if(e.summary.failed===0?Ty.success(`${ACe(r)} ${e.summary.succeeded} workflow${q9(e.summary.succeeded,``,`s`)}`):Ty.error(`${r} finished with ${e.summary.failed} failure${q9(e.summary.failed,``,`s`)}`),await a0(n),r!==`delete`)return;let i=new Set(e.results.filter(RCe).map(LCe));a(e=>{let t=new Set;for(let n of e)i.has(n)||t.add(n);return t}),await s0(n)},onError:ICe,meta:{errorShownByCaller:!0}}),e[33]=n,e[34]=ie);let ae=Ze(ie),oe=ae.isPending?ae.variables.action:null,se=ae.mutate,ce;e[35]===se?ce=e[36]:(ce=(e,t)=>{t.length!==0&&se({workflowIds:t,action:e})},e[35]=se,e[36]=ce);let le=ce,ue;e[37]===C?ue=e[38]:(ue=e=>{if(e.length===0)return;let t=new Map(C.map(FCe)),n=e.map(e=>t.get(e)??`Untitled workflow`),r=e.length===1?`Delete Workflow`:`Delete Workflows`,i=e.length===1?`This will permanently delete "${n[0]}" and all of its runs and events. This cannot be undone.`:`This will permanently delete ${e.length} workflows and all of their runs and events. This cannot be undone.`;v({workflowIds:e,workflowNames:n,title:r,description:i})},e[37]=C,e[38]=ue);let de=ue,fe;e[39]!==j||e[40]!==x||e[41]!==oe||e[42]!==t||e[43]!==de||e[44]!==le||e[45]!==i||e[46]!==K||e[47]!==J||e[48]!==T?(fe=()=>x&&T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading workflows...`}):T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No workflows found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`w-10 px-4 py-2`,children:(0,X.jsx)(e7,{"aria-label":`Select all workflows`,checked:j,onCheckedChange:e=>{J(e)}})}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Name`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`State`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Mode`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Updated`}),(0,X.jsx)(`th`,{className:`w-10`})]})}),(0,X.jsx)(`tbody`,{children:T.map(e=>{let n=i.has(e.id),r=e.isOwner!==!1,a=e.isPaused?`border-amber-500/30 bg-amber-500/10 text-amber-700`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700`,o=e.isPaused?`Paused`:`Active`,s=e.mode===`test`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-zinc-500/30 bg-zinc-500/10 text-zinc-700`,c=e.mode===`test`?`Test`:`Live`,l=e.isPaused?`resume`:`pause`,u=e.isPaused?`Resume`:`Pause`;return(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsx)(`td`,{className:`px-4 py-3`,children:(0,X.jsx)(e7,{"aria-label":`Select ${e.name}`,checked:n,onCheckedChange:t=>{te(e.id,t)}})}),(0,X.jsxs)(`td`,{className:`px-2 py-3`,children:[(0,X.jsx)(`button`,{className:`text-left font-medium text-foreground hover:underline`,onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},type:`button`,children:e.name}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.id})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs transition-colors duration-200 ${a}`,children:o})}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase transition-colors duration-200 ${s}`,children:c})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:d7(e.updatedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsxs)(H5,{children:[(0,X.jsx)(U5,{className:`inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`,disabled:!r||oe!==null,children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsxs)(W5,{align:`end`,children:[(0,X.jsx)(G5,{onClick:()=>{K.mutate({workflowId:e.id,mode:e.mode===`test`?`live`:`test`})},children:e.mode===`test`?`Switch to Live`:`Switch to Test`}),(0,X.jsx)(G5,{onClick:()=>{le(l,[e.id])},children:u}),(0,X.jsx)(q5,{}),(0,X.jsx)(G5,{onClick:()=>{de([e.id])},variant:`destructive`,children:`Delete`})]})]})})]},e.id)})})]}),e[39]=j,e[40]=x,e[41]=oe,e[42]=t,e[43]=de,e[44]=le,e[45]=i,e[46]=K,e[47]=J,e[48]=T,e[49]=fe):fe=e[49];let pe=fe,me;e[50]!==z||e[51]!==t||e[52]!==R?(me=()=>z&&R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading runs...`}):R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No runs found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`px-4 py-2`,children:`Workflow`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Status`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Started`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Duration`}),(0,X.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Open`})]})}),(0,X.jsx)(`tbody`,{children:R.map(e=>(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:e.workflowName}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.workflowId})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase ${g7(e.status)}`,children:e.status})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:d7(e.startedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:ECe(e.duration)}),(0,X.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,X.jsx)(zv,{onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.workflowId},search:{executionId:e.id}})},size:`sm`,type:`button`,variant:`outline`,children:`Open`})})]},e.id))})]}),e[50]=z,e[51]=t,e[52]=R,e[53]=me):me=e[53];let he=me,ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(`h1`,{className:`font-semibold text-2xl text-foreground`,children:`Workflow Dashboard`}),e[54]=ge):ge=e[54];let _e;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[ge,(0,X.jsx)(zv,{onClick:()=>{m(PCe),f(!0)},type:`button`,children:`New Workflow`})]}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Manage workflows in bulk and review runs across every workflow. Paused workflows block new starts. Test mode makes runs execute with test-mode action behavior.`})]}),e[55]=_e):_e=e[55];let ve;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`Workflows`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Select one or more workflows to run bulk actions.`})]}),e[56]=ve):ve=e[56];let ye=x||oe!==null,be;e[57]!==H||e[58]!==ye?(be=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[ve,(0,X.jsx)(zv,{disabled:ye,onClick:H,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[57]=H,e[58]=ye,e[59]=be):be=e[59];let xe=k.length===0||oe!==null,Se;e[60]!==le||e[61]!==k?(Se=()=>{le(`pause`,k)},e[60]=le,e[61]=k,e[62]=Se):Se=e[62];let Ce;e[63]!==xe||e[64]!==Se?(Ce=(0,X.jsx)(zv,{disabled:xe,onClick:Se,size:`sm`,type:`button`,variant:`outline`,children:`Pause Selected`}),e[63]=xe,e[64]=Se,e[65]=Ce):Ce=e[65];let we=k.length===0||oe!==null,Te;e[66]!==le||e[67]!==k?(Te=()=>{le(`resume`,k)},e[66]=le,e[67]=k,e[68]=Te):Te=e[68];let Ee;e[69]!==we||e[70]!==Te?(Ee=(0,X.jsx)(zv,{disabled:we,onClick:Te,size:`sm`,type:`button`,variant:`outline`,children:`Resume Selected`}),e[69]=we,e[70]=Te,e[71]=Ee):Ee=e[71];let De=k.length===0||oe!==null,Oe;e[72]!==de||e[73]!==k?(Oe=()=>{de(k)},e[72]=de,e[73]=k,e[74]=Oe):Oe=e[74];let ke;e[75]!==De||e[76]!==Oe?(ke=(0,X.jsx)(zv,{disabled:De,onClick:Oe,size:`sm`,type:`button`,variant:`destructive`,children:`Delete Selected`}),e[75]=De,e[76]=Oe,e[77]=ke):ke=e[77];let Ae;e[78]!==Ce||e[79]!==Ee||e[80]!==ke?(Ae=(0,X.jsx)(`div`,{className:`border-b px-4 py-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ce,Ee,ke]})}),e[78]=Ce,e[79]=Ee,e[80]=ke,e[81]=Ae):Ae=e[81];let je;e[82]===pe?je=e[83]:(je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:pe()}),e[82]=pe,e[83]=je);let Me;e[84]!==be||e[85]!==Ae||e[86]!==je?(Me=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[be,Ae,je]}),e[84]=be,e[85]=Ae,e[86]=je,e[87]=Me):Me=e[87];let Ne;e[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`All Runs`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Combined run history across workflows.`})]}),e[88]=Ne):Ne=e[88];let Pe=z||B,Ie;e[89]===W?Ie=e[90]:(Ie=()=>{W()},e[89]=W,e[90]=Ie);let Le;e[91]!==Pe||e[92]!==Ie?(Le=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[Ne,(0,X.jsx)(zv,{disabled:Pe,onClick:Ie,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[91]=Pe,e[92]=Ie,e[93]=Le):Le=e[93];let Re;e[94]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{c(new Set)},e[94]=Re):Re=e[94];let ze=s.size===0?`secondary`:`outline`,Be;e[95]===ze?Be=e[96]:(Be=(0,X.jsx)(zv,{onClick:Re,size:`sm`,type:`button`,variant:ze,children:`All statuses`}),e[95]=ze,e[96]=Be);let Ve;e[97]===s?Ve=e[98]:(Ve=TCe.map(e=>(0,X.jsx)(zv,{onClick:()=>{re(e)},size:`sm`,type:`button`,variant:s.has(e)?`secondary`:`outline`,children:e},e)),e[97]=s,e[98]=Ve);let He=k.length===0,Ue;e[99]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=()=>{u(NCe)},e[99]=Ue):Ue=e[99];let We=l?`secondary`:`outline`,Ge=l?`Showing selected workflows`:`Show selected workflows only`,Ke;e[100]!==He||e[101]!==We||e[102]!==Ge?(Ke=(0,X.jsx)(zv,{disabled:He,onClick:Ue,size:`sm`,type:`button`,variant:We,children:Ge}),e[100]=He,e[101]=We,e[102]=Ge,e[103]=Ke):Ke=e[103];let qe;e[104]!==Be||e[105]!==Ve||e[106]!==Ke?(qe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b px-4 py-2`,children:[Be,Ve,Ke]}),e[104]=Be,e[105]=Ve,e[106]=Ke,e[107]=qe):qe=e[107];let Je;e[108]===he?Je=e[109]:(Je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:he()}),e[108]=he,e[109]=Je);let Ye;e[110]!==B||e[111]!==I?(Ye=I.hasNextPage?(0,X.jsx)(`div`,{className:`border-t px-4 py-3`,children:(0,X.jsx)(zv,{disabled:B,onClick:()=>{I.fetchNextPage()},size:`sm`,type:`button`,variant:`outline`,children:B?`Loading...`:`Load more`})}):null,e[110]=B,e[111]=I,e[112]=Ye):Ye=e[112];let $e;e[113]!==Le||e[114]!==qe||e[115]!==Je||e[116]!==Ye?($e=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[Le,qe,Je,Ye]}),e[113]=Le,e[114]=qe,e[115]=Je,e[116]=Ye,e[117]=$e):$e=e[117];let et;e[118]!==Me||e[119]!==$e?(et=(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1600px] flex-col gap-6 p-6`,children:[_e,(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 xl:grid-cols-[1fr_1.5fr]`,children:[Me,$e]})]}),e[118]=Me,e[119]=$e,e[120]=et):et=e[120];let tt;e[121]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>{e||(v(null),g(``))},e[121]=tt):tt=e[121];let nt=_!==null,rt=_?.title,it;e[122]===rt?it=e[123]:(it=(0,X.jsx)(V9,{children:rt}),e[122]=rt,e[123]=it);let at=_?.description,ot;e[124]===at?ot=e[125]:(ot=(0,X.jsx)(H9,{children:at}),e[124]=at,e[125]=ot);let st;e[126]!==it||e[127]!==ot?(st=(0,X.jsxs)(z9,{children:[it,ot]}),e[126]=it,e[127]=ot,e[128]=st):st=e[128];let ct;e[129]===_?ct=e[130]:(ct=_&&_.workflowNames.length>1?(0,X.jsxs)(`ul`,{className:`list-disc pl-5 text-muted-foreground text-sm`,children:[_.workflowIds.slice(0,3).map((e,t)=>(0,X.jsx)(`li`,{children:_.workflowNames[t]},e)),_.workflowNames.length>3?(0,X.jsxs)(`li`,{children:[`and `,_.workflowNames.length-3,` more`]}):null]}):null,e[129]=_,e[130]=ct);let lt;e[131]!==_||e[132]!==h?(lt=_&&_.workflowIds.length>G9?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(TX,{htmlFor:`delete-challenge`,children:[`Type `,_.workflowIds.length,` to confirm`]}),(0,X.jsx)(wX,{autoComplete:`off`,id:`delete-challenge`,inputMode:`numeric`,onChange:e=>{g(e.target.value)},value:h})]}):null,e[131]=_,e[132]=h,e[133]=lt):lt=e[133];let ut;e[134]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,X.jsx)(W9,{children:`Cancel`}),e[134]=ut):ut=e[134];let dt;e[135]!==_||e[136]!==h?(dt=_!==null&&_.workflowIds.length>G9&&h.trim()!==String(_.workflowIds.length),e[135]=_,e[136]=h,e[137]=dt):dt=e[137];let ft;e[138]!==_||e[139]!==le?(ft=()=>{_&&(le(`delete`,_.workflowIds),v(null),g(``))},e[138]=_,e[139]=le,e[140]=ft):ft=e[140];let pt;e[141]!==dt||e[142]!==ft?(pt=(0,X.jsxs)(B9,{children:[ut,(0,X.jsx)(U9,{disabled:dt,onClick:ft,variant:`destructive`,children:`Delete`})]}),e[141]=dt,e[142]=ft,e[143]=pt):pt=e[143];let mt;e[144]!==st||e[145]!==ct||e[146]!==lt||e[147]!==pt?(mt=(0,X.jsxs)(R9,{children:[st,ct,lt,pt]}),e[144]=st,e[145]=ct,e[146]=lt,e[147]=pt,e[148]=mt):mt=e[148];let ht;e[149]!==nt||e[150]!==mt?(ht=(0,X.jsx)(L9,{onOpenChange:tt,open:nt,children:mt}),e[149]=nt,e[150]=mt,e[151]=ht):ht=e[151];let gt;e[152]===C?gt=e[153]:(gt=C.map(MCe),e[152]=C,e[153]=gt);let _t;e[154]===t?_t=e[155]:(_t=e=>t({to:`/workflows/$workflowId`,params:{workflowId:e}}),e[154]=t,e[155]=_t);let vt;e[156]!==p||e[157]!==d||e[158]!==gt||e[159]!==_t?(vt=(0,X.jsx)(M7,{existingWorkflowNames:gt,onCreated:_t,onOpenChange:f,open:d},p),e[156]=p,e[157]=d,e[158]=gt,e[159]=_t,e[160]=vt):vt=e[160];let yt;return e[161]!==et||e[162]!==ht||e[163]!==vt?(yt=(0,X.jsxs)(`div`,{className:`pointer-events-auto h-dvh overflow-auto bg-background`,children:[et,ht,vt]}),e[161]=et,e[162]=ht,e[163]=vt,e[164]=yt):yt=e[164],yt}function MCe(e){return e.name}function NCe(e){return!e}function PCe(e){return e+1}function FCe(e){return[e.id,e.name]}function ICe(e,t){let{action:n}=t;wCe.error(`Failed to ${n} workflows`,{action:n,error:e}),Ty.error(`Failed to ${n} workflows`)}function LCe(e){return e.workflowId}function RCe(e){return e.ok&&e.deleted===!0}function zCe(e){return e.id}function BCe(e){return e.items}function VCe(e){return e.nextCursor??void 0}function HCe(e){return e.name!==`__current__`}function UCe(e){return{executionId:typeof e.executionId==`string`&&e.executionId.length>0?e.executionId:void 0}}function WCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(eCe,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(BO,{children:[t,(0,X.jsx)(`div`,{className:`pointer-events-none relative z-10`,children:(0,X.jsx)(ka,{})})]}),e[1]=n):n=e[1],n}function GCe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(cX,{attribute:`class`,defaultTheme:`system`,disableTransitionOnChange:!0,enableSystem:!0,children:(0,X.jsx)(vA,{store:F9,children:(0,X.jsxs)(FY,{children:[(0,X.jsx)(WCe,{}),(0,X.jsx)(dX,{}),(0,X.jsx)(qY,{})]})})}),e[0]=t):t=e[0],t}function J9(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(vCe,{}),e[0]=t):t=e[0],t}var Y9=ya({component:GCe}),KCe=_a({getParentRoute:()=>Y9,path:`/`,component:jCe}),qCe=_a({getParentRoute:()=>Y9,path:`/workflows`,component:()=>(0,X.jsx)(Ki,{replace:!0,to:`/`})}),JCe=_a({getParentRoute:()=>Y9,path:`/workflows/$workflowId`,validateSearch:UCe,beforeLoad:({search:e})=>{let t=rCe(e.executionId);t!==null&&F9.set(g2,t)},loader:async({params:e})=>{F9.set(r2,!1),F9.set(i2,null);let[t,n]=await Promise.allSettled([My.fetchQuery(r0.workflow.getById.queryOptions({input:{workflowId:e.workflowId},staleTime:0})),My.fetchQuery(i0())]);if(t.status===`rejected`){let e=nCe(t.reason);throw F9.set(r2,e.notFound),F9.set(i2,e.message),t.reason}if(n.status===`rejected`)throw F9.set(i2,I9),n.reason;let r=t0(t.value);F9.set(npe,{...r,nodes:Y0(By(),r.nodes,n.value)})},errorComponent:J9,component:J9}),YCe=Fa({routeTree:Y9.addChildren([KCe,qCe,JCe]),defaultPreload:`intent`,basepath:Sy()}),X9=e=>typeof e==`string`&&e.includes(`ResizeObserver loop`);function XCe(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)return e.message}(()=>{if(window.__resizeObserverPatched||!window.ResizeObserver)return;let e=window.ResizeObserver;window.ResizeObserver=class extends e{constructor(e){super((t,n)=>{window.requestAnimationFrame(()=>e(t,n))})}},window.__resizeObserverPatched=!0})(),window.addEventListener(`error`,e=>{X9(e.message)&&(e.preventDefault(),e.stopImmediatePropagation())}),window.addEventListener(`unhandledrejection`,e=>{X9(XCe(e.reason))&&e.preventDefault()});var Z9=document.getElementById(`root`);if(!Z9)throw Error(`Root element not found`);var Q9=(0,Pee.createRoot)(Z9);Q9.render((0,X.jsx)(Ite,{}));var $9=await One();Q9.render($9.ok?(0,X.jsx)(Bte,{value:By(),children:(0,X.jsx)(Vte,{value:Qh,children:(0,X.jsx)(Ie,{client:My,children:(0,X.jsx)(Ra,{router:YCe})})})}):(0,X.jsx)(Rte,{endpoint:`${Sy()}/api/extensions`,reason:$9.reason}));
|
|
101
|
+
`);n.forEach((t,r)=>{t&&e.appendChild(document.createTextNode(t)),r<n.length-1&&(f(),e.appendChild(document.createElement(`br`)),f())})}function m(t,r){i=r;let a=r.focused?r.caretOffset??c()?.offset??null:null;if(e.innerHTML=``,!(t||r.focused)){let t=document.createElement(`span`);t.setAttribute(l8,``),t.className=`text-muted-foreground pointer-events-none`,t.textContent=r.placeholder??``,e.appendChild(t);return}for(let i of m0(t)){if(i.kind===`literal`){p(i.text);continue}let t=document.createElement(`span`);t.className=r.nodes.some(e=>e.id===i.token.nodeId)?Zme:Qme,t.contentEditable=`false`,t.setAttribute(`data-template`,i.token.raw),t.textContent=$me(i.token,r.nodes,n),f(),e.appendChild(t),f()}if(!t){let t=document.createElement(`br`);t.setAttribute(u8,``),f(),e.appendChild(t)}r.focused&&a!==null&&d(a)}return{render:m,rerender(t){m(p8(e,r),{...i,nodes:t,caretOffset:void 0})},readText:()=>p8(e,r),readCaret:c,setCaretOffset:d,insertText(e){let t=window.getSelection();if(!t||t.rangeCount===0)return!1;let n=t.getRangeAt(0);n.deleteContents();let r=document.createTextNode(e);return n.insertNode(r),n.setStartAfter(r),n.collapse(!0),t.removeAllRanges(),t.addRange(n),!0},insertLineBreak(){let e=window.getSelection();if(!e||e.rangeCount===0)return!1;let t=e.getRangeAt(0);t.deleteContents();let n=document.createElement(`br`),r=document.createTextNode(``);return t.insertNode(n),n.parentNode?.insertBefore(r,n.nextSibling),n.parentNode?.insertBefore(document.createTextNode(``),n),t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!0}}}function m8(e){let t=(0,Z.c)(52),{value:n,onChange:r,placeholder:i,multiline:a}=e,o=yy(),s=wA(Q4),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(n),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h={top:0,left:0},t[0]=h):h=t[0];let[g,_]=(0,Y.useState)(h),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(null),S;t[1]!==o||t[2]!==a?(S=e=>{if(c.current=e,!e){l.current=null;return}l.current=the(e,{multiline:a,catalog:o})},t[1]=o,t[2]=a,t[3]=S):S=t[3];let C=S,w;t[4]!==d||t[5]!==s||t[6]!==i||t[7]!==n?(w=()=>{d||l.current?.render(n,{focused:!1,nodes:s,placeholder:i})},t[4]=d,t[5]=s,t[6]=i,t[7]=n,t[8]=w):w=t[8],vY(d?h8:n,w);let T;t[9]!==d||t[10]!==s?(T=()=>{d||l.current?.rerender(s)},t[9]=d,t[10]=s,t[11]=T):T=t[11],vY(d?h8:s,T);let E;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=(e,t)=>{let n=e.slice(0,t),r=n.lastIndexOf(`@`),i=r===-1?null:n.slice(r+1),a=p0(e).some(e=>r>=e.start&&r<e.end);if(i===null||a||i.includes(` `)){m(!1);return}y(i),x(r);let o=c.current?.getBoundingClientRect();o&&_({top:o.bottom+window.scrollY+4,left:o.left+window.scrollX}),m(!0)},t[12]=E):E=t[12];let D=E,O;t[13]!==s||t[14]!==r||t[15]!==i?(O=()=>{let e=l.current;if(!e)return;let t=e.readText();if(t===u.current)return;let n=p0(u.current).length,a=p0(t).length;if(u.current=t,r?.(t),n===a){D(t,e.readCaret()?.offset??t.length);return}m(!1),e.render(t,{focused:!0,nodes:s,placeholder:i})},t[13]=s,t[14]=r,t[15]=i,t[16]=O):O=t[16];let k=O,A;t[17]!==b||t[18]!==v||t[19]!==s||t[20]!==r||t[21]!==i?(A=e=>{let t=l.current;if(!t||b===null)return;let n=t.readText(),a=n.slice(0,b),o=n.slice(b+1+v.length),c=a+e+o;u.current=c,r?.(c),m(!1),x(null),f(!0),t.render(c,{caretOffset:a.length+e.length,focused:!0,nodes:s,placeholder:i})},t[17]=b,t[18]=v,t[19]=s,t[20]=r,t[21]=i,t[22]=A):A=t[22];let j=A,M;t[23]!==s||t[24]!==i||t[25]!==n?(M=()=>{f(!0);let e=l.current?.readText()??n;u.current=e,e||l.current?.render(``,{focused:!0,nodes:s,placeholder:i})},t[23]=s,t[24]=i,t[25]=n,t[26]=M):M=t[26];let N=M,P;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{setTimeout(()=>{document.activeElement!==c.current&&(f(!1),m(!1))},nhe)},t[27]=P):P=t[27];let F=P,I;t[28]===k?I=t[29]:(I=e=>{e.preventDefault(),l.current?.insertText(e.clipboardData.getData(`text/plain`))&&k()},t[28]=k,t[29]=I);let L=I,R;t[30]===k?R=t[31]:(R=()=>{l.current?.insertLineBreak()&&k()},t[30]=k,t[31]=R);let z=R,B;t[32]!==s||t[33]!==r||t[34]!==i?(B=e=>{let t=l.current;if(!t)return;let n=t.readText(),a=n.slice(0,e.start)+n.slice(e.end);u.current=a,r?.(a),m(!1),t.render(a,{caretOffset:e.start,focused:!0,nodes:s,placeholder:i})},t[32]=s,t[33]=r,t[34]=i,t[35]=B):B=t[35];let V=B,H;t[36]!==z||t[37]!==a||t[38]!==V?(H=e=>{let t=l.current;if(!t)return;if(a&&e.key===`Enter`){e.preventDefault(),z();return}if(e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)return;let n=e.key===`Backspace`||e.key===`ArrowLeft`,r=e.key===`Delete`||e.key===`ArrowRight`;if(!(n||r))return;let i=t.readCaret();if(!i?.collapsed)return;let o=n?i.badgeBefore:i.badgeAfter;o&&(e.preventDefault(),e.key===`ArrowLeft`?t.setCaretOffset(o.start):e.key===`ArrowRight`?t.setCaretOffset(o.end):V(o))},t[36]=z,t[37]=a,t[38]=V,t[39]=H):H=t[39];let U=H,W;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(W=()=>m(!1),t[40]=W):W=t[40];let G;return t[41]!==C||t[42]!==v||t[43]!==g||t[44]!==j||t[45]!==N||t[46]!==k||t[47]!==U||t[48]!==L||t[49]!==s||t[50]!==p?(G={attachEditor:C,autocompleteFilter:v,autocompletePosition:g,handleBlur:F,handleFocus:N,handleInput:k,handleAutocompleteSelect:j,handleKeyDown:U,handlePaste:L,closeAutocomplete:W,nodes:s,showAutocomplete:p},t[41]=C,t[42]=v,t[43]=g,t[44]=j,t[45]=N,t[46]=k,t[47]=U,t[48]=L,t[49]=s,t[50]=p,t[51]=G):G=t[51],G}var h8=Symbol(`focused`),nhe=200;function g8(e){let t=(0,Z.c)(38),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,fieldType:c,currentNodeId:l,labelledBy:u,ariaLabel:d,required:f,invalid:p}=e,m=n===void 0?``:n,h;t[0]!==r||t[1]!==i||t[2]!==m?(h={value:m,onChange:r,placeholder:i},t[0]=r,t[1]=i,t[2]=m,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=m8(h),O;t[4]===E?O=t[5]:(O=E.find(rhe)?.id,t[4]=E,t[5]=O);let k=O,A=p&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex min-h-9 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=p||void 0,P=p||void 0,F=f||void 0,I=!a,L;t[10]!==d||t[11]!==g||t[12]!==x||t[13]!==S||t[14]!==C||t[15]!==w||t[16]!==T||t[17]!==s||t[18]!==u||t[19]!==I||t[20]!==P||t[21]!==F?(L=(0,X.jsx)(`div`,{"aria-invalid":P,"aria-label":d,"aria-labelledby":u,"aria-required":F,className:`w-full outline-none`,contentEditable:I,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[10]=d,t[11]=g,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=s,t[18]=u,t[19]=I,t[20]=P,t[21]=F,t[22]=L):L=t[22];let R;t[23]!==L||t[24]!==M||t[25]!==N?(R=(0,X.jsx)(`div`,{className:M,"data-invalid":N,children:L}),t[23]=L,t[24]=M,t[25]=N,t[26]=R):R=t[26];let z=l??k??void 0,B;t[27]!==_||t[28]!==v||t[29]!==y||t[30]!==c||t[31]!==b||t[32]!==D||t[33]!==z?(B=(0,X.jsx)(c8,{currentNodeId:z,fieldType:c,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[27]=_,t[28]=v,t[29]=y,t[30]=c,t[31]=b,t[32]=D,t[33]=z,t[34]=B):B=t[34];let V;return t[35]!==R||t[36]!==B?(V=(0,X.jsxs)(X.Fragment,{children:[R,B]}),t[35]=R,t[36]=B,t[37]=V):V=t[37],V}function rhe(e){return e.selected}var ihe=[{label:`North America`,zones:[{value:`America/New_York`,label:`Eastern Time (ET)`},{value:`America/Chicago`,label:`Central Time (CT)`},{value:`America/Denver`,label:`Mountain Time (MT)`},{value:`America/Phoenix`,label:`Arizona Time (MST)`},{value:`America/Los_Angeles`,label:`Pacific Time (PT)`},{value:`America/Anchorage`,label:`Alaska Time (AKT)`},{value:`Pacific/Honolulu`,label:`Hawaii Time (HST)`},{value:`America/Toronto`,label:`Toronto`},{value:`America/Vancouver`,label:`Vancouver`}]},{label:`Europe`,zones:[{value:`Europe/London`,label:`London (GMT/BST)`},{value:`Europe/Paris`,label:`Paris (CET/CEST)`},{value:`Europe/Berlin`,label:`Berlin (CET/CEST)`},{value:`Europe/Rome`,label:`Rome (CET/CEST)`},{value:`Europe/Madrid`,label:`Madrid (CET/CEST)`},{value:`Europe/Amsterdam`,label:`Amsterdam (CET/CEST)`},{value:`Europe/Brussels`,label:`Brussels (CET/CEST)`},{value:`Europe/Stockholm`,label:`Stockholm (CET/CEST)`},{value:`Europe/Warsaw`,label:`Warsaw (CET/CEST)`},{value:`Europe/Athens`,label:`Athens (EET/EEST)`},{value:`Europe/Moscow`,label:`Moscow (MSK)`}]},{label:`Asia`,zones:[{value:`Asia/Dubai`,label:`Dubai (GST)`},{value:`Asia/Kolkata`,label:`India (IST)`},{value:`Asia/Shanghai`,label:`China (CST)`},{value:`Asia/Hong_Kong`,label:`Hong Kong (HKT)`},{value:`Asia/Tokyo`,label:`Tokyo (JST)`},{value:`Asia/Seoul`,label:`Seoul (KST)`},{value:`Asia/Singapore`,label:`Singapore (SGT)`},{value:`Asia/Bangkok`,label:`Bangkok (ICT)`},{value:`Asia/Jakarta`,label:`Jakarta (WIB)`}]},{label:`Australia & Pacific`,zones:[{value:`Australia/Sydney`,label:`Sydney (AEDT/AEST)`},{value:`Australia/Melbourne`,label:`Melbourne (AEDT/AEST)`},{value:`Australia/Brisbane`,label:`Brisbane (AEST)`},{value:`Australia/Perth`,label:`Perth (AWST)`},{value:`Pacific/Auckland`,label:`Auckland (NZDT/NZST)`}]},{label:`South America`,zones:[{value:`America/Sao_Paulo`,label:`São Paulo (BRT)`},{value:`America/Argentina/Buenos_Aires`,label:`Buenos Aires (ART)`},{value:`America/Santiago`,label:`Santiago (CLT)`},{value:`America/Bogota`,label:`Bogotá (COT)`},{value:`America/Lima`,label:`Lima (PET)`}]},{label:`Africa & Middle East`,zones:[{value:`Africa/Cairo`,label:`Cairo (EET)`},{value:`Africa/Johannesburg`,label:`Johannesburg (SAST)`},{value:`Africa/Lagos`,label:`Lagos (WAT)`},{value:`Africa/Nairobi`,label:`Nairobi (EAT)`},{value:`Asia/Jerusalem`,label:`Jerusalem (IST)`}]},{label:`Other`,zones:[{value:`UTC`,label:`UTC (Coordinated Universal Time)`}]}];function ahe(e){let t=(0,Z.c)(11),{value:n,onValueChange:r,disabled:i,id:a}=e,o;t[0]===r?o=t[1]:(o=H6(r),t[0]=r,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(U6,{placeholder:`Select timezone`}),t[2]=s):s=t[2];let c;t[3]===a?c=t[4]:(c=(0,X.jsx)(W6,{className:`w-full`,id:a,children:s}),t[3]=a,t[4]=c);let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(G6,{children:ihe.map(ohe)}),t[5]=l):l=t[5];let u;return t[6]!==i||t[7]!==o||t[8]!==c||t[9]!==n?(u=(0,X.jsxs)(V6,{disabled:i,onValueChange:o,value:n,children:[c,l]}),t[6]=i,t[7]=o,t[8]=c,t[9]=n,t[10]=u):u=t[10],u}function ohe(e){return(0,X.jsxs)(Sme,{children:[(0,X.jsx)(Cme,{children:e.label}),e.zones.map(she)]},e.label)}function she(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}var _8=Y.createContext(void 0);function v8(e){let t=Y.useContext(_8);if(t===void 0&&!e)throw Error(Gg(72));return t}var che={...Vq,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin},lhe=class extends fq{constructor(e,t,n){let r=new Mq;super(uhe(e,r,t,n),dhe(r),che)}setOpen=(e,t)=>{Eq(this,e,t,{extraState:{openChangeReason:t.reason}})};cancelPendingOpen(e){this.state.floatingRootContext.dispatchOpenChange(!1,DH(cH,e))}};function uhe(e,t,n,r=!1){let i={...Pq(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=Fq(t,n,r),i}function dhe(e){return{popupRef:Y.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}var fhe=rq(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=xq((e,t)=>new lhe({open:n,openProp:r,activeTriggerId:d,triggerIdProp:u},e,t));p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`mounted`),v=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i,disabled:t}),Oq(p,{closeOnActiveTriggerUnmount:!0});let{forceUnmount:y,transitionStatus:b}=kq(h,p),x=p.useState(`isInstantPhase`),S=p.useState(`instantType`),C=p.useState(`lastOpenChangeReason`),w=Y.useRef(null);Mg(()=>{m&&t&&p.setOpen(!1,DH(wH))},[m,t,p]),Mg(()=>{b===`ending`&&C===`none`||b!==`ending`&&x?(S!==`delay`&&(w.current=S),p.set(`instantType`,`delay`)):w.current!==null&&(p.set(`instantType`,w.current),w.current=null)},[b,x,C,S,p]),Mg(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]),Y.useImperativeHandle(o,()=>({unmount:y,close:()=>p.setOpen(!1,DH(TH))}),[y,p]);let T=h||_||!t&&a!==`none`;return(0,X.jsxs)(_8.Provider,{value:p,children:[l&&(0,X.jsx)(Sq,{handle:l,store:p}),T&&(0,X.jsx)(phe,{store:p,disabled:t,trackCursorAxis:a}),typeof f==`function`?f({payload:v}):f]})});function phe({store:e,disabled:t,trackCursorAxis:n}){let r=e.useState(`floatingRootContext`),i=YG(r,{enabled:!t,referencePress:()=>e.select(`closeOnClick`)}),a=KG(r,{enabled:!t&&n!==`none`,axis:n===`none`?void 0:n}),o=Y.useMemo(()=>Fg(a.reference,i.reference),[a.reference,i.reference]);return Aq(e,{activeTriggerProps:o,inactiveTriggerProps:o,popupProps:i.floating??a_}),null}var y8=Y.createContext(void 0);function mhe(){return Y.useContext(y8)}var b8=`data-base-ui-tooltip-trigger`;function x8(e){if(`composedPath`in e){let t=e.composedPath();for(let e=0;e<t.length;e+=1){let n=t[e];if(ig(n))return n}}let t=e.target;return ig(t)?t:null}function hhe(e){let t=e;for(;t;){let e=t.closest(`[${b8}]`);if(e)return e;let n=t.getRootNode();t=`host`in n&&ig(n.host)?n.host:null}return null}var ghe=iq(function(e,t){let{render:n,className:r,style:i,handle:a,payload:o,disabled:s,delay:c,closeOnClick:l=!0,closeDelay:u,id:d,...f}=e,p=v8(!0),m=Hq(a)??p;if(!m)throw Error(Gg(82));let h=PH(d),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=Y.useRef(null),b=c??600,x=u??0,{registerTrigger:S,isMountedByThisTrigger:C}=Dq(h,y,m,{payload:o,closeOnClick:l,closeDelay:x}),w=mhe(),{delayRef:T,isInstantPhase:E,hasProvider:D}=MU(v,{open:_}),O=Qq(v);m.useSyncedValue(`isInstantPhase`,E);let k=m.useState(`disabled`),A=s??k,j=FU(A),M=m.useState(`trackCursorAxis`),N=m.useState(`disableHoverablePopup`),P=Y.useRef(!1),F=zH(),I=Y.useRef(void 0);function L(){return D?TU(T.current,`open`)===0?0:c??w??600:b}function R(e){let t=y.current;if(!t||!e)return!1;let n=hhe(e);return n!==null&&n!==t&&mU(t,n)}function z(e){let t=R(e);return P.current=t,t&&(O.openChangeTimeout.clear(),O.restTimeout.clear(),O.restTimeoutPending=!1,F.clear()),t}let B=tJ(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!N&&M!==`both`?vJ():null,restMs:L,delay(){return u==null&&D?{close:TU(T.current,`close`)}:{close:x}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`,shouldOpen(){return!P.current}}),V=qq(v,{enabled:!A}).reference,H=e=>{let t=P.current,n=x8(e),r=z(n),i=y.current,a=i&&n&&mU(i,n);if(r&&m.select(`open`)&&m.select(`lastOpenChangeReason`)===`trigger-hover`){m.setOpen(!1,DH(lH,e));return}if(t&&!r&&a&&!j.current&&!m.select(`open`)&&i&&aU(I.current)){let t=()=>{!P.current&&!j.current&&!m.select(`open`)&&m.setOpen(!0,DH(lH,e,i))},n=L();n===0?(F.clear(),t()):F.start(n,t)}},U=m.useState(`triggerProps`,C);return o_(`button`,e,{state:{open:_},ref:[t,S,y],props:[B,V,C||M!==`none`?U:void 0,{onMouseOver(e){H(e.nativeEvent)},onFocus(e){R(x8(e.nativeEvent))&&e.preventBaseUIHandler()},onMouseLeave(){P.current=!1,F.clear(),I.current=void 0},onPointerEnter(e){I.current=e.pointerType},onPointerDown(e){I.current=e.pointerType,m.set(`closeOnClick`,l),l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},onClick(e){l&&!m.select(`open`)&&m.cancelPendingOpen(e.nativeEvent)},id:h,"data-trigger-disabled":A?``:void 0,[b8]:A?void 0:``},f],stateAttributesMapping:nH})}),S8=Y.createContext(void 0);function _he(){let e=Y.useContext(S8);if(e===void 0)throw Error(Gg(70));return e}var vhe=Y.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{node:c,subtree:l}=SG({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,X.jsxs)(Y.Fragment,{children:[l,c&&Xi.createPortal(n,c)]})}),yhe=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return v8().useState(`mounted`)||n?(0,X.jsx)(S8.Provider,{value:n,children:(0,X.jsx)(vhe,{ref:t,...r})}):null}),C8=Y.createContext(void 0);function w8(){let e=Y.useContext(C8);if(e===void 0)throw Error(Gg(71));return e}var bhe=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=_G,style:g,..._}=e,v=v8(),y=_he(),b=v.useState(`open`),x=v.useState(`mounted`),S=v.useState(`trackCursorAxis`),C=v.useState(`disableHoverablePopup`),w=v.useState(`floatingRootContext`),T=v.useState(`instantType`),E=v.useState(`transitionStatus`),D=g6({anchor:i,positionMethod:a,floatingRootContext:w,mounted:x,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:y,collisionAvoidance:h,adaptiveOrigin:v.useState(`adaptiveOrigin`)}),O=C6(e,Y.useMemo(()=>({open:b,side:D.side,align:D.align,anchorHidden:D.anchorHidden,instant:S===`none`?T:`tracking-cursor`}),[b,D.side,D.align,D.anchorHidden,S,T]),{styles:D.positionerStyles,transitionStatus:E,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!x,inert:!b||S===`both`||C});return(0,X.jsx)(C8.Provider,{value:D,children:O})}),xhe=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=v8(),{side:s,align:c}=w8(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`),m=o.useState(`disabled`),h=o.useState(`closeDelay`);vq({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}}),$q(p,{enabled:!m,closeDelay:h});let g=o.useStateSetter(`popupElement`);return o_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,g],props:[yq,f,S6(d),a],stateAttributesMapping:aH})}),She=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=v8(),{arrowRef:s,side:c,align:l,arrowUncentered:u,arrowStyles:d}=w8();return o_(`div`,e,{state:{open:o.useState(`open`),side:c,align:l,uncentered:u,instant:o.useState(`instantType`)},ref:[t,s],props:[{style:d,"aria-hidden":!0},a],stateAttributesMapping:iH})}),Che=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=Y.useMemo(()=>({open:t,close:n}),[t,n]);return(0,X.jsx)(y8.Provider,{value:t,children:(0,X.jsx)(jU,{delay:i,timeoutMs:r,children:e.children})})};function T8(e){let t=(0,Z.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,X.jsx)(Che,{closeDelay:0,"data-slot":`tooltip-provider`,delay:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function E8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(T8,{children:(0,X.jsx)(fhe,{"data-slot":`tooltip`,...n})}),t[2]=n,t[3]=r),r}function D8(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(ghe,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function O8(e){let t=(0,Z.c)(15),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--transform-origin) text-balance rounded-md bg-foreground px-3 py-1.5 text-background text-xs data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(She,{className:`z-50 size-2.5 rotate-45 rounded-[2px] bg-foreground`}),t[7]=c):c=t[7];let l;t[8]!==n||t[9]!==s?(l=(0,X.jsxs)(xhe,{className:s,"data-slot":`tooltip-content`,children:[n,c]}),t[8]=n,t[9]=s,t[10]=l):l=t[10];let u;return t[11]!==i||t[12]!==o||t[13]!==l?(u=(0,X.jsx)(yhe,{children:(0,X.jsx)(bhe,{sideOffset:o,...i,children:l})}),t[11]=i,t[12]=o,t[13]=l,t[14]=u):u=t[14],u}var whe=[];function k8(e){let t=(0,Z.c)(5),n=yy(),r=wA(Q4),i=wA($4),a;return t[0]!==n||t[1]!==i||t[2]!==e||t[3]!==r?(a=e?t8({targetNodeId:e,nodes:r,edges:i,catalog:n}):whe,t[0]=n,t[1]=i,t[2]=e,t[3]=r,t[4]=a):a=t[4],a}function The(e){let t=(0,Z.c)(40),{value:n,onChange:r,placeholder:i,disabled:a,className:o,id:s,rows:c,fieldType:l,labelledBy:u,required:d,invalid:f}=e,p=n===void 0?``:n,m=c===void 0?3:c,h;t[0]!==r||t[1]!==i||t[2]!==p?(h={value:p,onChange:r,placeholder:i,multiline:!0},t[0]=r,t[1]=i,t[2]=p,t[3]=h):h=t[3];let{attachEditor:g,autocompleteFilter:_,autocompletePosition:v,closeAutocomplete:y,handleAutocompleteSelect:b,handleBlur:x,handleFocus:S,handleInput:C,handleKeyDown:w,handlePaste:T,nodes:E,showAutocomplete:D}=m8(h),O;t[4]===E?O=t[5]:(O=E.find(Ehe)?.id,t[4]=E,t[5]=O);let k=O,A=f&&`border-destructive focus-within:border-destructive focus-within:ring-destructive/20`,j=a&&`cursor-not-allowed opacity-50`,M;t[6]!==o||t[7]!==A||t[8]!==j?(M=Q(`flex w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs transition-colors focus-within:border-ring focus-within:outline-none focus-within:ring-[3px] focus-within:ring-ring/50 lg:text-sm`,A,j,o),t[6]=o,t[7]=A,t[8]=j,t[9]=M):M=t[9];let N=f||void 0,P=`${m*1.5}rem`,F;t[10]===P?F=t[11]:(F={minHeight:P},t[10]=P,t[11]=F);let I=f||void 0,L=d||void 0,R=!a,z;t[12]!==g||t[13]!==x||t[14]!==S||t[15]!==C||t[16]!==w||t[17]!==T||t[18]!==s||t[19]!==u||t[20]!==I||t[21]!==L||t[22]!==R?(z=(0,X.jsx)(`div`,{"aria-invalid":I,"aria-labelledby":u,"aria-required":L,className:`w-full whitespace-pre-wrap break-words outline-none`,contentEditable:R,id:s,onBlur:x,onFocus:S,onInput:C,onKeyDown:w,onPaste:T,ref:g,role:`textbox`,suppressContentEditableWarning:!0}),t[12]=g,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=s,t[19]=u,t[20]=I,t[21]=L,t[22]=R,t[23]=z):z=t[23];let B;t[24]!==F||t[25]!==z||t[26]!==M||t[27]!==N?(B=(0,X.jsx)(`div`,{className:M,"data-invalid":N,style:F,children:z}),t[24]=F,t[25]=z,t[26]=M,t[27]=N,t[28]=B):B=t[28];let V=k||void 0,H;t[29]!==_||t[30]!==v||t[31]!==y||t[32]!==l||t[33]!==b||t[34]!==D||t[35]!==V?(H=(0,X.jsx)(c8,{currentNodeId:V,fieldType:l,filter:_,isOpen:D,onClose:y,onSelect:b,position:v}),t[29]=_,t[30]=v,t[31]=y,t[32]=l,t[33]=b,t[34]=D,t[35]=V,t[36]=H):H=t[36];let U;return t[37]!==B||t[38]!==H?(U=(0,X.jsxs)(X.Fragment,{children:[B,H]}),t[37]=B,t[38]=H,t[39]=U):U=t[39],U}function Ehe(e){return e.selected}function Dhe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=typeof r==`string`?r:``,c;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(g8,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,value:s}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ohe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=n.label?`${n.key}-label`:void 0,s=n.rows||4,c=typeof r==`string`?r:``,l;return t[0]!==a||t[1]!==n.key||t[2]!==n.placeholder||t[3]!==n.required||t[4]!==i||t[5]!==o||t[6]!==s||t[7]!==c?(l=(0,X.jsx)(The,{disabled:a,id:n.key,labelledBy:o,onChange:i,placeholder:n.placeholder,required:n.required,rows:s,value:c}),t[0]=a,t[1]=n.key,t[2]=n.placeholder,t[3]=n.required,t[4]=i,t[5]=o,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function khe(e){let t=(0,Z.c)(8),{field:n,value:r,onChange:i,disabled:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.value),t[0]=i,t[1]=o);let s=typeof r==`string`?r:``,c;return t[2]!==a||t[3]!==n.key||t[4]!==n.placeholder||t[5]!==o||t[6]!==s?(c=(0,X.jsx)(wX,{disabled:a,id:n.key,onChange:o,placeholder:n.placeholder,value:s}),t[2]=a,t[3]=n.key,t[4]=n.placeholder,t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function Ahe(e){let t=(0,Z.c)(9),{field:n,value:r,onChange:i,disabled:a}=e,o=typeof r==`number`||typeof r==`string`?`${r}`:``,s;t[0]===i?s=t[1]:(s=e=>{let t=e.target.value.trim();if(!t){i(void 0);return}let n=Number.parseFloat(t);Number.isFinite(n)&&i(n)},t[0]=i,t[1]=s);let c;return t[2]!==a||t[3]!==o||t[4]!==n.key||t[5]!==n.min||t[6]!==n.placeholder||t[7]!==s?(c=(0,X.jsx)(wX,{disabled:a,id:n.key,min:n.min,onChange:s,placeholder:n.placeholder,type:`number`,value:o}),t[2]=a,t[3]=o,t[4]=n.key,t[5]=n.min,t[6]=n.placeholder,t[7]=s,t[8]=c):c=t[8],c}function jhe(e){let t=(0,Z.c)(15),{field:n,value:r,onChange:i,disabled:a}=e;if(!n.options)return null;let o=typeof r==`string`?r:``,s;t[0]===n.placeholder?s=t[1]:(s=(0,X.jsx)(U6,{placeholder:n.placeholder}),t[0]=n.placeholder,t[1]=s);let c;t[2]!==n.key||t[3]!==s?(c=(0,X.jsx)(W6,{className:`w-full`,id:n.key,children:s}),t[2]=n.key,t[3]=s,t[4]=c):c=t[4];let l;t[5]===n.options?l=t[6]:(l=n.options.map(Mhe),t[5]=n.options,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,X.jsx)(G6,{children:l}),t[7]=l,t[8]=u);let d;return t[9]!==a||t[10]!==i||t[11]!==o||t[12]!==c||t[13]!==u?(d=(0,X.jsxs)(V6,{disabled:a,onValueChange:i,value:o,children:[c,u]}),t[9]=a,t[10]=i,t[11]=o,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Mhe(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}var Nhe=0;function A8(){return`kv-${++Nhe}`}function Phe(e){return typeof e!=`object`||!e||!(`name`in e&&`value`in e)?!1:typeof e.name==`string`&&typeof e.value==`string`}function Fhe(e){if(typeof e!=`string`||!e)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(Phe)}catch{}return[]}function Ihe(e){let t=(0,Z.c)(29),{value:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=()=>Fhe(n).map(Rhe),t[0]=n,t[1]=a);let[o,s]=(0,Y.useState)(a),c;t[2]===r?c=t[3]:(c=function(e){s(e),r(JSON.stringify(e.map(Lhe)))},t[2]=r,t[3]=c);let l=c,u;t[4]!==o||t[5]!==l?(u=function(){l([...o,{name:``,value:``,_id:A8()}])},t[4]=o,t[5]=l,t[6]=u):u=t[6];let d=u,f;t[7]!==o||t[8]!==l?(f=function(e){l(o.filter(t=>t._id!==e))},t[7]=o,t[8]=l,t[9]=f):f=t[9];let p=f,m;t[10]!==o||t[11]!==l?(m=function(e,t,n){l(o.map(r=>r._id===e?{...r,[t]:n}:r))},t[10]=o,t[11]=l,t[12]=m):m=t[12];let h=m,g;if(t[13]!==i||t[14]!==p||t[15]!==o||t[16]!==h){let e;t[18]!==i||t[19]!==p||t[20]!==h?(e=e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(wX,{className:`flex-1`,disabled:i,onChange:t=>h(e._id,`name`,t.target.value),placeholder:`Name`,value:e.name}),(0,X.jsx)(g8,{ariaLabel:`Value`,className:`flex-1`,disabled:i,onChange:t=>h(e._id,`value`,t??``),placeholder:`Value`,value:e.value}),(0,X.jsx)(zv,{className:`size-8 shrink-0`,disabled:i,onClick:()=>p(e._id),size:`icon`,type:`button`,variant:`ghost`,children:(0,X.jsx)(hy,{className:`size-4`})})]},e._id),t[18]=i,t[19]=p,t[20]=h,t[21]=e):e=t[21],g=o.map(e),t[13]=i,t[14]=p,t[15]=o,t[16]=h,t[17]=g}else g=t[17];let _;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(cy,{className:`mr-1 size-3.5`}),t[22]=_):_=t[22];let v;t[23]!==d||t[24]!==i?(v=(0,X.jsxs)(zv,{className:`h-8`,disabled:i,onClick:d,size:`sm`,type:`button`,variant:`outline`,children:[_,`Add`]}),t[23]=d,t[24]=i,t[25]=v):v=t[25];let y;return t[26]!==g||t[27]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[g,v]}),t[26]=g,t[27]=v,t[28]=y):y=t[28],y}function Lhe(e){let{name:t,value:n}=e;return{name:t,value:n}}function Rhe(e){return{...e,_id:A8()}}var zhe={"template-input":Dhe,"template-textarea":Ohe,text:khe,number:Ahe,select:jhe,"key-value":Ihe};function j8(e,t,n,r){if(!d0(t,e.showWhen))return null;let i=t[e.key]??e.defaultValue??``,a=zhe[e.type];return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.label&&(0,X.jsxs)(TX,{className:`ml-1`,htmlFor:e.key,id:`${e.key}-label`,children:[e.label,e.required&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-destructive`,children:`*`})]}),(0,X.jsx)(a,{disabled:r,field:e,onChange:t=>n({[e.key]:t}),value:i})]},e.key)}function Bhe(e){let t=(0,Z.c)(19),{label:n,fields:r,config:i,onUpdateConfig:a,disabled:o,defaultExpanded:s}=e,[c,l]=(0,Y.useState)(s!==void 0&&s),u;t[0]===c?u=t[1]:(u=()=>l(!c),t[0]=c,t[1]=u);let d;t[2]===n?d=t[3]:(d=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:n}),t[2]=n,t[3]=d);let f=`size-3.5 text-muted-foreground transition-transform duration-200 ${c?``:`-rotate-90`}`,p;t[4]===f?p=t[5]:(p=(0,X.jsx)(Jv,{className:f}),t[4]=f,t[5]=p);let m;t[6]!==u||t[7]!==d||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`ml-1 flex items-center gap-1 text-left`,onClick:u,type:`button`,children:[d,p]}),t[6]=u,t[7]=d,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==i||t[11]!==o||t[12]!==r||t[13]!==c||t[14]!==a?(h=c&&(0,X.jsx)(`div`,{className:`ml-1 space-y-4 border-primary/50 border-l-2 py-2 pl-3`,children:r.map(e=>j8(e,i,a,o))}),t[10]=i,t[11]=o,t[12]=r,t[13]=c,t[14]=a,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Vhe(e){let t=(0,Z.c)(11),{fields:n,config:r,onUpdateConfig:i,disabled:a}=e,o;if(t[0]!==r||t[1]!==a||t[2]!==n||t[3]!==i){let e;t[5]!==r||t[6]!==a||t[7]!==i?(e=e=>g4(e)?(0,X.jsx)(Bhe,{config:r,defaultExpanded:e.defaultExpanded,disabled:a,fields:e.fields,label:e.label,onUpdateConfig:i},`group-${e.label}`):j8(e,r,i,a),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],o=n.map(e),t[0]=r,t[1]=a,t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;return t[9]===o?s=t[10]:(s=(0,X.jsx)(X.Fragment,{children:o}),t[9]=o,t[10]=s),s}function Hhe(e,t,n,r,i,a,o,s,c,l=2){let u=CW(n.current,{event:e,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:o,minIndex:s,maxIndex:c,prevIndex:t>c?s:t,stopEvent:!0});return yW(n.current,u)?void 0:u}var M8=Y.createContext(void 0),N8=Y.createContext(void 0),P8=Y.createContext(void 0),F8=Y.createContext(!1),I8=Y.createContext(``);function L8(){let e=Y.useContext(M8);if(!e)throw Error(Gg(22));return e}function R8(){let e=Y.useContext(N8);if(!e)throw Error(Gg(23));return e}function z8(){let e=Y.useContext(P8);if(!e)throw Error(Gg(24));return e}function B8(){return Y.useContext(I8)}function Uhe(){return Y.useContext(F8)}var V8={id:e=>e.id,labelId:e=>e.labelId,items:e=>e.items,selectedValue:e=>e.selectedValue,hasSelectionChips:e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0},hasSelectedValue:e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0},hasNullItemLabel:(e,t)=>t?Y3(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMounted:e=>e.forceMounted,inline:e=>e.inline,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>U3(t,e,n)):U3(t,r,n)},transitionStatus:e=>e.transitionStatus,popupProps:e=>e.popupProps,listProps:e=>e.listProps,inputProps:e=>e.inputProps,triggerProps:e=>e.triggerProps,itemProps:e=>e.itemProps,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupId:e=>e.popupId,triggerElement:e=>e.triggerElement,inputElement:e=>e.inputElement,inputGroupElement:e=>e.inputGroupElement,popupSide:e=>e.popupSide,openMethod:e=>e.openMethod,inputInsidePopup:e=>e.inputInsidePopup,inputOwnsFormValue:e=>e.inputOwnsFormValue,selectionMode:e=>e.selectionMode,name:e=>e.name,form:e=>e.form,disabled:e=>e.disabled,readOnly:e=>e.readOnly,required:e=>e.required,grid:e=>e.grid,virtualized:e=>e.virtualized,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,modal:e=>e.modal,autoHighlight:e=>e.autoHighlight};function H8(e){return e==null?void 0:`${e}-popup`}function Whe(e,t){return(n,r)=>n!=null&&e.contains(n,r,t)}function U8(e){return Array.isArray(e)?e.map(e=>U8(e)).join(`,`):e==null?``:String(e)}var W8=new Map;function Ghe(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${U8(e.locale)}|${JSON.stringify(t)}`,r=W8.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=X3(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=X3(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=X3(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return W8.set(n,a),a}var Khe=Ghe;function qhe(e,t=!1){let{overflowY:n}=vg(e);return n!==`auto`&&n!==`scroll`?!1:t?e.clientHeight>0:e.scrollHeight>e.clientHeight}var G8=Symbol(`none`),K8={value:G8,index:-1};function Jhe(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u,onItemHighlighted:d,name:f,form:p,disabled:m=!1,readOnly:h=!1,required:g=!1,inputRef:_,grid:v=!1,items:y,filteredItems:b,filter:x,openOnInputClick:S=!0,autoHighlight:C=!1,keepHighlight:w=!1,highlightItemOnHover:T=!0,loopFocus:E=!0,itemToStringLabel:D,itemToStringValue:O,isItemEqualToValue:k=H3,virtualized:A=!1,inline:j=!1,fillInputOnItemPress:M=!0,modal:N=!1,limit:P=-1,autoComplete:F=`list`,formAutoComplete:I,locale:L,submitOnItemClick:R=!1}=e,{clearErrors:z}=e6(),{setDirty:B,validityData:V,setFilled:H,name:U,disabled:W,setTouched:G,setFocused:K,validationMode:q,validation:J}=R3(),ee=d6(),te=V3({id:t}),ne=Khe({locale:L}),[re,ie]=Y.useState(!1),[ae,oe]=Y.useState(null),se=Y.useRef([]),ce=Y.useRef([]),le=Y.useRef(null),ue=Y.useRef(null),de=Y.useRef(null),fe=Y.useRef(null),pe=Y.useRef(null),me=Y.useRef(!0),he=Y.useRef(!1),ge=Y.useRef(null),_e=Y.useRef(null),ve=Y.useRef(null),ye=Y.useRef(K8),be=Y.useRef(null),xe=Y.useRef([]),Se=Y.useRef(null),Ce=W||m,we=U??f,Te=u===`multiple`,Ee=u===`single`,De=s!==void 0||o!==void 0,Oe=y!==void 0,ke=b!==void 0,Ae;Ae=C===`always`?`always`:C?`input-change`:!1;let[je,Me]=A3({controlled:i,default:Te?r??i_:r,name:`Combobox`,state:`selectedValue`}),Ne=Y.useMemo(()=>x===null?()=>!0:x===void 0?Whe(ne,D):x,[x,ne,D]),Pe=Eg(()=>De?o??``:Ee?X3(je,D):``).current,[Fe,Ie]=A3({controlled:s,default:Pe,name:`Combobox`,state:`inputValue`}),[Le,Re]=A3({controlled:c,default:l,name:`Combobox`,state:`open`}),ze=J3(y),Be=ae??String(Fe).trim(),Ve=Ee?X3(je,D):``,He=Ee&&!re&&Be!==``&&Ve.length===Be.length&&ne.contains(Ve,Be),Ue=He?``:Be,We=Oe&&ke&&He,Ge=Y.useMemo(()=>y?ze?y.flatMap(e=>e.items):y:i_,[y,ze]),Ke=Y.useMemo(()=>{if(b&&!We)return b;if(!y)return i_;if(ze){let e=y,t=[],n=0;for(let r of e){if(P>-1&&n>=P)break;let e=P>-1?P-n:1/0,i=Ue===``?r.items.slice(0,e):[];if(Ue!==``)for(let t of r.items){if(i.length>=e)break;Ne(t,Ue,D)&&i.push(t)}if(i.length>0){let e={...r,items:i};t.push(e),n+=i.length}}return t}if(Ue===``)return P>-1?Ge.slice(0,P):Ge;let e=[];for(let t of Ge){if(P>-1&&e.length>=P)break;Ne(t,Ue,D)&&e.push(t)}return e},[b,We,y,ze,Ue,P,Ne,D,Ge]),qe=Y.useMemo(()=>ze?Ke.flatMap(e=>e.items):Ke,[Ke,ze]),Je=Eg(()=>{let e=null;return j&&Le&&Oe&&u!==`none`&&(e=G3(qe,je,k,Te)),new dq({id:te,labelId:void 0,selectedValue:je,open:Le,items:y,selectionMode:u,listRef:se,labelsRef:ce,popupRef:le,emptyRef:pe,inputRef:ue,startDismissRef:de,endDismissRef:fe,keyboardActiveRef:me,chipsContainerRef:ge,clearRef:_e,valuesRef:xe,pointerDownItemRef:Se,selectionEventRef:ve,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,isItemEqualToValue:k,modal:N,autoHighlight:Ae,submitOnItemClick:R,hasInputValue:De,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:j,activeIndex:null,selectedIndex:e,popupProps:{},listProps:{},inputProps:{},triggerProps:{},itemProps:a_,positionerElement:null,listElement:null,popupId:void 0,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`,onOpenChangeComplete:r_,setOpen:r_,setInputValue:r_,setSelectedValue:r_,setIndices:r_,handleSelection:r_,forceMount:r_,requestSubmit:r_})}).current,Ye=u===`none`?Fe:je,Xe=Y.useMemo(()=>u===`none`?Ye:Array.isArray(je)?je.map(e=>Z3(e,O)):Z3(je,O),[Ye,O,u,je]),Ze=kg(d),Qe=kg(n),$e=$(Je,V8.activeIndex),et=$(Je,V8.selectedIndex),tt=$(Je,V8.positionerElement),nt=$(Je,V8.listElement),rt=$(Je,V8.triggerElement),it=$(Je,V8.inputElement),at=$(Je,V8.inputGroupElement),ot=$(Je,V8.inline),st=$(Je,V8.inputInsidePopup),ct=$(Je,V8.inputOwnsFormValue),lt=FU(rt),{mounted:ut,setMounted:dt,transitionStatus:ft}=gq(Le),{openMethod:pt,triggerProps:mt}=sY(Le),ht=kg(()=>Xe);z3(st?lt:ue,te,Ye,ht,!Ce,f);let gt=kg(()=>{y?ce.current=qe.map(e=>X3(e,D)):Je.set(`forceMounted`,!0)}),_t=kg((e,t,n)=>{if(t===-1){if(ye.current===K8)return;ye.current=K8}else ye.current={value:e,index:t};Ze(e,OH(n,void 0,{index:t}))}),vt=kg(e=>{Je.update(e);let t=e.activeIndex;if(t===void 0)return;let n=e.type||`none`;t===null?_t(void 0,-1,n):_t(xe.current[t],t,n)}),yt=kg((t,n)=>{if(he.current=n.reason===hH,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){Le&&ae!==null&&oe(null);let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&ie(!0),be.current={hasQuery:e};let n=Je.state.listElement;if(!Je.state.virtualized&&n){let e=le.current;for(let t of Sg(n.firstElementChild??n)){if(!ag(t)||(e?!mU(e,t):t.getAttribute(`role`)===`dialog`))break;if(qhe(t)){t.scrollTop=0;break}}}e&&Ae&&Je.state.activeIndex==null&&(Le||ot)&&Je.set(`activeIndex`,0)}}else n.reason===`input-clear`&&t===``&&Je.state.inputInsidePopup&&(be.current={hasQuery:!1,selection:!0});Ie(t)}}),bt=kg((t,n)=>{if(Le!==t&&(n.reason===`escape-key`&&Oe&&qe.length===0&&!pe.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&st&&!ot&&ae!==null&&(ie(!1),oe(null),Fe!==``&&n.reason!==`input-change`&&yt(``,DH(hH,n.event))),!t&&re&&(Ee?(ot||oe(Be),Be===``&&ie(!1)):Te&&(ot||oe(Be),st&&vt({activeIndex:null}),(!st||ot)&&yt(``,DH(hH,n.event)))),Re(t),!t&&st&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(G(!0),K(!1),q===`onBlur`)))){let e=u===`none`?Fe:je;J.commit(e)}}),xt=kg((e,t)=>{a?.(e,t),!t.isCanceled&&(Me(e),(u===`none`&&le.current&&M||Ee&&!Je.state.inputInsidePopup)&&yt(X3(e,D),DH(t.reason,t.event)))}),St=kg((e,t)=>{let n=hU(e),r=ve.current??e;ve.current=null;let i=DH(fH,r),a=n?.closest(`a`)?.getAttribute(`href`);if(a){a.startsWith(`#`)&&bt(!1,i);return}if(Te){let e=Array.isArray(je)?je:[],n=kpe(e,t,k)?K3(e,t,k):[...e,t];if(xt(n,i),i.isCanceled||!(ue.current&&ue.current.value.trim()!==``))return;Je.state.inputInsidePopup?yt(``,DH(hH,i.event)):bt(!1,i)}else{if(xt(t,i),i.isCanceled)return;bt(!1,i)}}),Ct=kg(()=>{let e=J.inputRef.current?.form??Je.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),wt=kg(()=>{if(dt(!1),Qe?.(!1),ie(!1),oe(null),vt(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),Te&&ue.current&&ue.current.value!==``&&!he.current&&yt(``,DH(hH)),Ee){if(Je.state.inputInsidePopup)ue.current&&ue.current.value!==``&&yt(``,DH(hH));else{let e=X3(je,D);ue.current&&ue.current.value!==e&&yt(e,DH(e===``?hH:sH))}}}),Tt=Y.useMemo(()=>ot&&tt?{current:tt.closest(`[role="dialog"]`)}:le,[ot,tt]);vq({enabled:!e.actionsRef,open:Le,ref:Tt,onComplete(){Le||wt()}}),Y.useImperativeHandle(e.actionsRef,()=>({unmount:wt}),[wt]),Mg(function(){if(Le||(Se.current=null,u===`none`))return;let e=Oe?Ge:xe.current;vt({selectedIndex:G3(e,je,k,Te)})},[Le,je,u,Te,Oe,Ge,k,vt]),Mg(()=>{y&&(xe.current=qe,se.current.length=qe.length)},[y,qe]),Mg(()=>{let e=be.current;if(e){let t=Le||ot||Je.state.positionerElement?.hidden===!1;if(e.hasQuery)Ae&&t&&Je.set(`activeIndex`,0),be.current=null;else if(String(Fe).trim()===``&&(be.current=null,t)){let t=e.selection;Ae===`always`&&!t&&Je.state.selectionMode===`none`&&Je.set(`activeIndex`,0),queueMicrotask(()=>{if(!Je.state.open&&!Je.state.inline||ue.current&&ue.current.value.trim()!==``)return;let e=Je.state.selectedValue,n=Je.state.selectionMode===`multiple`,r=n&&Array.isArray(e)?e[e.length-1]:e,i=Je.state.selectionMode!==`none`&&r!=null;if(i||t){let t=Oe||ke?qe:xe.current;Je.set(`activeIndex`,i?G3(t,e,Je.state.isItemEqualToValue,n):null)}else Ae===`always`&&Je.set(`activeIndex`,0)})}}if(!Le&&!ot)return;let t=Oe||ke?qe:xe.current,n=Je.state.activeIndex;if(n==null){if(Ae===`always`&&t.length>0){Je.set(`activeIndex`,0);return}_t(void 0,-1,sH);return}if(n>=t.length){_t(void 0,-1,sH),Je.set(`activeIndex`,null);return}let r=t[n],i=ye.current.value,a=i!==G8&&U3(r,i,Je.state.isItemEqualToValue);(ye.current.index!==n||!a)&&_t(r,n,sH)},[$e,Ae,_t,ke,Oe,qe,ot,Le,Je,Fe]),Mg(()=>{if(u===`none`){H(String(Fe)!==``);return}H(Te?Array.isArray(je)&&je.length>0:je!=null)},[H,u,Fe,je,Te]),Y.useEffect(()=>{Oe&&Ae&&qe.length===0&&vt({activeIndex:null})},[Oe,Ae,qe.length,vt]);function Et(e){let t=V.initialValue;return Array.isArray(e)&&Array.isArray(t)?!t6(e,t,(e,t)=>U3(e,t,k)):e!==t}aY(Be,()=>{!Le||Be===``||Be===String(Pe)||ie(!0)});function Dt(){let e=X3(je,D);Fe!==e&&yt(e,DH(sH))}aY(je,()=>{u!==`none`&&(z(we),B(Et(je)),J.change(je),Ee&&!De&&!st&&Dt())}),aY(Fe,()=>{u===`none`&&(z(we),B(Fe!==V.initialValue),J.change(Fe))}),aY(y,()=>{!Ee||De||st||re||Dt()});let Ot=Uq({open:ot?!0:Le,onOpenChange:bt,elements:{reference:st?rt:it,floating:tt}}),kt=v?`grid`:`listbox`,At=Le||ot,jt=At?`true`:`false`,Mt=Y.useMemo(()=>{let e=it?.tagName===`INPUT`,t=it==null||e,n=t||At,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=jt,r[`aria-haspopup`]=kt,r[`aria-controls`]=At?nt?.id:void 0,r[`aria-autocomplete`]=F),{reference:r,floating:{role:`presentation`}}},[it,At,jt,kt,nt?.id,F]),Nt=UG(Ot,{enabled:!h&&!Ce&&S,event:`mousedown-only`,toggle:!1,touchOpenDelay:st?0:100,reason:gH}),Pt=YG(Ot,{enabled:!h&&!Ce&&!ot,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:ot?!0:void 0,outsidePress(e){let t=hU(e);return!mU(rt,t)&&!mU(_e.current,t)&&!mU(ge.current,t)&&!mU(at,t)}}),Ft=lJ(Ot,{enabled:!h&&!Ce,id:te,listRef:se,activeIndex:$e,selectedIndex:et,virtual:!0,loopFocus:E,allowEscape:E&&!Ae,focusItemOnOpen:re||u===`none`&&!Ae?!1:`auto`,focusItemOnHover:T,resetOnPointerLeave:!w,orientation:v?`horizontal`:void 0,rtl:ee===`rtl`,disabledIndices:i_,grid:v?Hhe:void 0,onNavigate(e,t){!t&&!Le||ft===`ending`||vt(t?{activeIndex:e,type:me.current?bH:xH}:{activeIndex:e})}}),It=Y.useMemo(()=>Fg(Ft.reference,{onKeyDown(e){v&&Je.state.activeIndex==null&&(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&e.preventBaseUIHandler()}},Pt.reference,Nt.reference,Mt.reference),[Ft.reference,Pt.reference,Nt.reference,Mt.reference,v,Je]),Lt=Y.useMemo(()=>Fg(yq,Pt.floating),[Pt.floating]),Rt=Y.useMemo(()=>Fg(Ft.floating,Mt.floating),[Ft.floating,Mt.floating]),zt=Y.useMemo(()=>{let e=Ft.item;return e?{...e,onFocus:void 0}:a_},[Ft.item]);O3(()=>{Je.update({inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,itemProps:zt,setOpen:bt,setInputValue:yt,setSelectedValue:xt,setIndices:vt,handleSelection:St,forceMount:gt,requestSubmit:Ct,onOpenChangeComplete:Qe})}),Mg(()=>{Je.update({id:te,selectedValue:je,open:Le,mounted:ut,transitionStatus:ft,items:y,inline:j,popupProps:Lt,listProps:Rt,inputProps:It,triggerProps:mt,openMethod:pt,itemProps:zt,selectionMode:u,name:we,form:p,disabled:Ce,readOnly:h,required:g,grid:v,virtualized:A,openOnInputClick:S,itemToStringLabel:D,modal:N,autoHighlight:Ae,isItemEqualToValue:k,submitOnItemClick:R,hasInputValue:De,inputOwnsFormValue:u===`none`&&(j||!Je.state.inputInsidePopup)})},[Je,te,je,Le,ut,ft,y,Lt,Rt,It,zt,pt,mt,u,we,Ce,h,g,v,A,S,D,N,k,R,De,j,Ae,p]);let Bt=Qg(_,J.inputRef),Vt=Y.useMemo(()=>({query:Be,hasItems:Oe,filteredItems:Ke,flatFilteredItems:qe}),[Be,Oe,Ke,qe]),Ht=Y.useMemo(()=>Array.isArray(Ye)?``:Z3(Ye,O),[Ye,O]),Ut=Te&&Array.isArray(je)&&je.length>0,Wt=Te||u===`none`&&ct?void 0:we,Gt=Y.useMemo(()=>!Te||!Array.isArray(je)||!we?null:je.map(e=>{let t=Z3(e,O);return(0,X.jsx)(`input`,{type:`hidden`,form:p,name:we,value:t,disabled:Ce},t)}),[Te,je,p,we,O,Ce]),Kt=(0,X.jsxs)(Y.Fragment,{children:[e.children,(0,X.jsx)(`input`,{...J.getValidationProps(Ce,{onFocus(){if(st){rt?.focus();return}(ue.current||rt)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||Ce||h)return;let t=e.currentTarget.value,n=t.toLowerCase(),r=DH(sH,e.nativeEvent),i=()=>xe.current.findIndex(e=>Z3(e,O).toLowerCase()===n||X3(e,D).toLowerCase()===n);function a(){if(Te)return;if(u===`none`){yt(t,r);return}let e=i();e===-1&&(e=xe.current.findIndex((e,t)=>{let r=ce.current[t];return r!=null&&r.toLowerCase()===n}));let a=e===-1?void 0:xe.current[e];a!=null&&xt?.(a,r)}Ee&&(gt(),y&&i()===-1&&Je.set(`forceMounted`,!0)),queueMicrotask(a)}}),id:te&&Wt==null?`${te}-hidden-input`:void 0,form:p,name:Wt,autoComplete:I,disabled:Ce,required:g&&!Ut,readOnly:h,value:Ht,ref:Bt,style:Wt?UU:HU,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Gt]});return(0,X.jsx)(M8.Provider,{value:Je,children:(0,X.jsx)(N8.Provider,{value:Ot,children:(0,X.jsx)(F8.Provider,{value:Oe,children:(0,X.jsx)(P8.Provider,{value:Vt,children:(0,X.jsx)(I8.Provider,{value:Fe,children:Kt})})})})})}function Yhe(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,X.jsx)(Jhe,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}var q8={...rH,...F3,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Xhe=Y.createContext(void 0);function Zhe(){return Y.useContext(Xhe)}var J8=Y.createContext(void 0);function Y8(e){let t=Y.useContext(J8);if(t===void 0&&!e)throw Error(Gg(21));return t}var X8=Y.forwardRef(function(e,t){let n=L8(),{buttonRef:r,getButtonProps:i}=Xg({native:!1}),a=Qg(t,r);function o(e){n.state.setOpen(!1,DH(pH,e.nativeEvent,e.currentTarget))}let s=i({onClick:o});return(0,X.jsx)(`span`,{ref:a,...s,"aria-label":`Dismiss`,tabIndex:void 0,style:UU})});function Z8(e){let t=$(e,V8.mounted),n=$(e,V8.popupSide),r=$(e,V8.positionerElement);return t&&r?n:null}function Q8(){return z8().filteredItems.length===0}function Qhe(e){return e===`rtl`?[`ArrowRight`,`ArrowLeft`]:[`ArrowLeft`,`ArrowRight`]}function $he(e,t){let n=e>=t-1?t-2:e;return n>=0?n:void 0}function $8(e,t,n){let r=e.state.listRef.current[t];r&&(e.state.selectionEventRef.current=n,r.click(),e.state.selectionEventRef.current=null)}var ege=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:f,validation:p}=R3(),{labelId:m}=B3(),h=Zhe(),g=!!Y8(!0),_=L8(),v=B8(),y=d6(),b=$(_,V8.required),x=$(_,V8.disabled),S=$(_,V8.readOnly),C=$(_,V8.name),w=$(_,V8.form),T=$(_,V8.selectionMode),E=$(_,V8.autoHighlight),D=$(_,V8.inputProps),O=$(_,V8.triggerProps),k=$(_,V8.open),A=$(_,V8.mounted),j=$(_,V8.selectedValue),M=$(_,V8.id),N=$(_,V8.inline),P=$(_,V8.modal),F=!!E,I=Z8(_),L=l||x||i,R=Q8(),z=g||N,B=!z||P,V=PH(a??(z?void 0:M)),H=g?P3:c,[U,W]=Y.useState(null),G=Y.useRef(!1),K=Y.useRef(null),q=Y.useRef(!1),J=T===`none`&&!g,ee=kg(e=>{let t=g||_.state.inline;t&&!_.state.hasInputValue&&_.state.setInputValue(``,DH(sH)),_.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:J})}),te=g?s:p.getValidationProps(L,s);function ne(){_.state.setIndices({activeIndex:null,selectedIndex:null,type:_.state.keyboardActiveRef.current?bH:xH})}function re(){_.state.keyboardActiveRef.current=!1}let ie={...H,open:k,disabled:L,readOnly:S,popupSide:I,listEmpty:R};function ae(e){if(!h)return;let t,{highlightedChipIndex:n}=h,r=h.chipsRef.current.length,[i,a]=Qhe(y);return n===void 0?(e.key===i&&(e.currentTarget.selectionStart??0)===0&&j.length>0&&(e.preventDefault(),t=r>0?r-1:void 0),t):(e.key===i?(e.preventDefault(),t=n>0?n-1:void 0):e.key===a?(e.preventDefault(),t=n<r-1?n+1:void 0):(e.key===`Backspace`||e.key===`Delete`)&&(e.preventDefault(),t=$he(n,j.length),ne()),t)}let oe=o_(`input`,e,{state:ie,ref:[t,_.state.inputRef,ee],props:[D,O,{value:U??v,"aria-readonly":S||void 0,"aria-required":b||void 0,"aria-labelledby":m,disabled:L,readOnly:S,required:T===`none`?b:void 0,form:w,...J&&C&&{name:C},id:V,onFocus(){if(d(!0),!N||!q.current)return;q.current=!1;let e=K.current;e==null||!Object.hasOwn(_.state.valuesRef.current,e)||_.state.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=_.state.activeIndex;if(N&&e!==null&&E!==`always`&&(K.current=e,q.current=!0,_.state.setIndices({activeIndex:null})),f===`onBlur`){let e=T===`none`?v:j;p.commit(e)}},onCompositionStart(e){JH||(G.current=!0,W(e.currentTarget.value))},onCompositionEnd(e){G.current=!1;let t=e.currentTarget.value;W(null),_.state.setInputValue(t,DH(mH,e.nativeEvent))},onChange(e){let t=e.nativeEvent,n=t.inputType,r=!n||n===`insertReplacementText`,i=G.current||!r;function a(e){S||L||!e||!i||(_.state.setOpen(!0,DH(mH,t)),F||ne())}if(G.current){let n=e.currentTarget.value;W(n),n===``&&!_.state.openOnInputClick&&!_.state.inputInsidePopup&&_.state.setOpen(!1,DH(hH,t));let r=n.trim(),i=F&&r!==``;a(r),k&&_.state.activeIndex!==null&&!i&&ne();return}let o=DH(mH,t);if(_.state.setInputValue(e.currentTarget.value,o),o.isCanceled)return;let s=e.currentTarget.value===``,c=DH(hH,t);s&&!_.state.inputInsidePopup&&(T===`single`&&_.state.setSelectedValue(null,c),_.state.openOnInputClick||_.state.setOpen(!1,c)),a(e.currentTarget.value.trim()),k&&_.state.activeIndex!==null&&!F&&ne()},onKeyDown(e){if(L||S||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;_.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=y===`rtl`;if(e.key===`Home`){tU(e);let n=QH&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){tU(e);let i=QH&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!A&&e.key===`Escape`){let t=T===`multiple`&&Array.isArray(j)?j.length===0:j===null,n=DH(vH,e.nativeEvent),r=T===`multiple`?[]:null;_.state.setInputValue(``,n),_.state.setSelectedValue(r,n),!t&&!_.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(h&&e.key===`Backspace`&&t.value===``&&h.highlightedChipIndex===void 0&&Array.isArray(j)&&j.length>0){let t=h.chipsRef.current.length,n=t>0?t-1:j.length-1,r=j.filter((e,t)=>t!==n);ne(),_.state.setSelectedValue(r,DH(sH,e.nativeEvent));return}let i=h?.highlightedChipIndex!==void 0,a=ae(e);if(h?.setHighlightedChipIndex(a),a===void 0?i&&_.state.inputRef.current?.focus():h?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&k){let t=_.state.activeIndex,n=e.nativeEvent;if(t===null){if(N)return;_.state.setOpen(!1,DH(sH,n));return}tU(e),$8(_,t,n)}},onPointerMove:re,onPointerDown:re},te],stateAttributesMapping:q8}),se=g?(0,X.jsx)(L3.Provider,{value:I3,children:oe}):oe;return(0,X.jsxs)(Y.Fragment,{children:[k&&B&&(0,X.jsx)(X8,{ref:_.state.startDismissRef}),se]})});function tge(e,t,n,r,i){if(e.baseUIHandlerPrevented||r)return;let a=hU(e.nativeEvent),o=ig(a)?a:null;o!==e.currentTarget&&(i?.(o)||bU(o))||(e.preventDefault(),!n&&(t.state.inputRef.current?.focus(),t.state.openOnInputClick&&t.state.setOpen(!0,DH(gH,e.nativeEvent))))}var nge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=R3(),s=L8(),c=$(s,V8.open),l=$(s,V8.disabled),u=$(s,V8.readOnly),d=$(s,V8.hasSelectedValue),f=$(s,V8.selectionMode),p=Z8(s),m=l,h=Q8(),g=f!==`none`&&!d,_={...o,open:c,disabled:m,readOnly:u,popupSide:p,listEmpty:h,placeholder:g};return o_(`div`,e,{ref:[t,kg(e=>{s.set(`inputGroupElement`,e)})],props:[{role:`group`,onMouseDown(e){tge(e,s,m,u,e=>mU(s.state.chipsContainerRef.current,e))}},a],state:_,stateAttributesMapping:q8})}),rge=Y.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=R3(),{labelId:h}=B3(),g=L8(),_=$(g,V8.selectionMode),v=$(g,V8.disabled),y=$(g,V8.readOnly),b=$(g,V8.required),x=$(g,V8.positionerElement),S=$(g,V8.listElement),C=$(g,V8.popupId),w=$(g,V8.triggerProps),T=$(g,V8.inputInsidePopup),E=$(g,V8.id),D=$(g,V8.labelId),O=$(g,V8.open),k=$(g,V8.selectedValue),A=$(g,V8.activeIndex),j=$(g,V8.selectedIndex),M=$(g,V8.hasSelectedValue),N=R8(),P=B8(),F=zH(),I=u||v||a,L=Q8(),R=Z8(g);V3({id:T?o:void 0});let z=T?o??E:o,B=a6(h,D),V;O&&T?V=C??H8(E):O&&(V=S?.id);let H=Y.useRef(``);function U(e){H.current=e.pointerType}let{reference:W}=uJ(N,{enabled:!O&&!y&&!v&&_===`single`,listRef:g.state.labelsRef,activeIndex:A,selectedIndex:j,onMatch(e){let t=g.state.valuesRef.current[e];t!==void 0&&g.state.setSelectedValue(t,DH(sH))}}),{reference:G}=UG(N,{enabled:!y&&!v,event:`mousedown`}),{buttonRef:K,getButtonProps:q}=Xg({native:i,disabled:I}),J={...l,open:O,disabled:I,popupSide:R,listEmpty:L,placeholder:_!==`none`&&!M};return o_(`button`,e,{ref:[t,K,kg(e=>{g.set(`triggerElement`,e)})],state:J,props:[w,G,W,{id:z,tabIndex:T?0:-1,role:T?`combobox`:void 0,"aria-expanded":O,"aria-haspopup":T?`dialog`:`listbox`,"aria-controls":V,"aria-required":T&&b||void 0,"aria-labelledby":B,onPointerDown:U,onPointerEnter:U,onFocus(){f(!0),!(I||y)&&F.start(0,g.state.forceMount)},onBlur(e){if(!mU(x,e.relatedTarget)&&(d(!0),f(!1),p===`onBlur`)){let e=_===`none`?P:k;m.commit(e)}},onMouseDown(e){if(I||y||(T||N.set(`domReferenceElement`,e.currentTarget),g.state.forceMount(),H.current!==`touch`&&(g.state.inputRef.current?.focus(),T||e.preventDefault()),O))return;let t=Jg(e.currentTarget);function n(e){let t=g.state.triggerElement;if(!t)return;let n=hU(e),r=g.state.positionerElement,i=g.state.listElement;mU(t,n)||mU(r,n)||mU(i,n)||s6(e,t)||g.state.setOpen(!1,DH(SH,e))}T&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){y||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(tU(e),g.state.setOpen(!0,DH(yH,e.nativeEvent)),g.state.inputRef.current?.focus())}},m.getValidationProps(I,c),q],stateAttributesMapping:q8})}),e5=Y.createContext(null);function ige(){return Y.useContext(e5)}function age(e){let{children:t,items:n}=e,r=Y.useMemo(()=>({items:n}),[n]);return(0,X.jsx)(e5.Provider,{value:r,children:t})}function t5(e){let{children:t}=e,{filteredItems:n}=z8(),r=ige(),i=r?r.items:n;return(0,X.jsx)(Y.Fragment,{children:i.map(t)})}var oge=Y.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=L8(),l=R8(),u=!!Y8(!0),{filteredItems:d,hasItems:f}=z8(),p=$(c,V8.selectionMode),m=$(c,V8.grid),h=$(c,V8.listProps),g=$(c,V8.virtualized),_=$(c,V8.forceMounted),v=p===`multiple`,y=d.length===0,b=kg(e=>{c.set(`positionerElement`,e)}),x=kg(e=>{c.set(`listElement`,e)}),S=Y.useMemo(()=>typeof o==`function`?n||=(0,X.jsx)(t5,{children:o}):o,[o]),C={empty:y},w=l.useState(`floatingId`),T=o_(`div`,e,{state:C,ref:[t,x,u?null:b],props:[h,{children:S,tabIndex:-1,id:w,role:m?`grid`:`listbox`,"aria-multiselectable":v?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;tU(e),$8(c,t,e.nativeEvent)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});if(g)return T;let E=f&&!_?void 0:c.state.labelsRef;return(0,X.jsx)(l6,{elementsRef:c.state.listRef,labelsRef:E,children:T})}),sge=``;function cge(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function lge(){let e=zH(),t=Y.useRef(null);return Y.useEffect(()=>{if(KH)return;let n=t.current;if(n==null)return;let r=cge(n);if(r==null)return;let i=r.data,a=`${i}${sge}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var n5=Y.createContext(void 0);function uge(){let e=Y.useContext(n5);if(e===void 0)throw Error(Gg(20));return e}var dge=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=L8(),a=$(i,V8.mounted),o=$(i,V8.forceMounted);return a||n||o?(0,X.jsx)(n5.Provider,{value:n,children:(0,X.jsx)(CG,{ref:t,...r})}):null}),fge=Y.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a,side:o,align:s,sideOffset:c,alignOffset:l,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f,sticky:p,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,v=L8(),y=R8(),b=uge(),x=$(v,V8.modal),S=$(v,V8.open),C=$(v,V8.mounted),w=$(v,V8.openMethod),T=$(v,V8.positionerElement),E=$(v,V8.triggerElement),D=$(v,V8.inputElement),O=$(v,V8.inputGroupElement),k=$(v,V8.inputInsidePopup),A=$(v,V8.transitionStatus),j=Q8(),M=g6({anchor:i??(k?E:O??D),floatingRootContext:y,positionMethod:a,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:b,collisionAvoidance:h,lazyFlip:!0});w6(S&&x,w===`touch`,T,E);let N={open:S,side:M.side,align:M.align,anchorHidden:M.anchorHidden,empty:j};Mg(()=>{v.set(`popupSide`,M.side)},[v,M.side]);let P=kg(e=>{v.set(`positionerElement`,e)}),F=C6(e,N,{styles:M.positionerStyles,transitionStatus:A,props:_,refs:[t,P],hidden:!C,inert:!S});return(0,X.jsxs)(J8.Provider,{value:M,children:[C&&x&&(0,X.jsx)(IJ,{inert:FJ(!S),cutout:O??D??E}),F]})}),pge={...iH,...XV},mge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=L8(),l=Y8(),u=R8(),d=$(c,V8.mounted),f=$(c,V8.open),p=$(c,V8.openMethod),m=$(c,V8.popupProps),h=$(c,V8.transitionStatus),g=$(c,V8.inputInsidePopup),_=$(c,V8.inputElement),v=$(c,V8.modal),y=$(c,V8.id),b=Q8(),x=s.id??(g?H8(y):void 0);Mg(()=>(c.set(`popupId`,c.state.popupRef.current?.id||x),()=>{c.set(`popupId`,void 0)}),[c,x]),vq({open:f,ref:c.state.popupRef,onComplete(){f&&c.state.onOpenChangeComplete(!0)}});let S=o_(`div`,e,{state:{open:f,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:h,empty:b},ref:[t,c.state.popupRef],props:[m,{id:x,role:g?`dialog`:`presentation`,onFocus(e){let t=hU(e.nativeEvent);p!==`touch`&&(mU(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},S6(h),s],stateAttributesMapping:pge}),C=a===void 0?g?e=>e===`touch`?c.state.popupRef.current:_:!1:a,w;w=o??(g?void 0:!1);let T=!g||v;return(0,X.jsx)(HG,{context:u,disabled:!d,modal:T,openInteractionType:p,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,X.jsxs)(Y.Fragment,{children:[S,T&&(0,X.jsx)(X8,{ref:c.state.endDismissRef})]})})}),r5=Y.createContext(void 0);function hge(){let e=Y.useContext(r5);if(e===void 0)throw Error(Gg(18));return e}var gge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,items:a,...o}=e,[s,c]=Y.useState(),l=Y.useMemo(()=>({labelId:s,setLabelId:c,items:a}),[s,c,a]),u=o_(`div`,e,{ref:t,props:[{role:`group`,"aria-labelledby":s},o]}),d=(0,X.jsx)(r5.Provider,{value:l,children:u});return a?(0,X.jsx)(age,{items:a,children:d}):d}),_ge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{setLabelId:s}=hge(),c=PH(a);return Mg(()=>(s(c),()=>{s(e=>e===c?void 0:e)}),[c,s]),o_(`div`,e,{ref:t,props:[{id:c},o]})}),i5=Y.createContext(void 0);function a5(){let e=Y.useContext(i5);if(!e)throw Error(Gg(19));return e}var vge=Y.createContext(!1);function yge(){return Y.useContext(vge)}function o5(e){let{componentProps:t,forwardedRef:n,virtualized:r,indexFromFilter:i}=e,{render:a,className:o,style:s,value:c=null,index:l,disabled:u=!1,nativeButton:d=!1,...f}=t,p=Y.useRef(null),m=P6({guess:!0,index:l,textRef:p}),h=L8(),g=yge(),_=Uhe(),v=$(h,V8.selectionMode),y=$(h,V8.disabled),b=$(h,V8.readOnly),x=$(h,V8.isItemEqualToValue),S=y||u,C=v!==`none`,w=l??i??m.index,T=w!==-1,E=$(h,V8.id),D=$(h,V8.isActive,w),O=$(h,V8.isSelected,c),k=$(h,V8.itemProps),A=Y.useRef(null),j=E!=null&&T?`${E}-${w}`:void 0,M=O&&C;Mg(()=>{if(!(T&&(r||l!=null)))return;let e=h.state.listRef.current;return e[w]=A.current,()=>{delete e[w]}},[T,r,w,l,h]),Mg(()=>{if(!T||_)return;let e=h.state.valuesRef.current;return e[w]=c,()=>{delete e[w]}},[T,_,w,c,h]),Mg(()=>{if(!T||_)return;let e=h.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;U3(c,t,x)&&h.set(`selectedIndex`,w)},[T,_,h,w,c,x]);let{getButtonProps:N,buttonRef:P}=Xg({disabled:S,focusableWhenDisabled:!0,native:d,composite:!0}),F={disabled:S,selected:M,highlighted:D};function I(e){function t(){h.state.handleSelection(e,c)}h.state.submitOnItemClick?(Xi.flushSync(t),h.state.requestSubmit()):t()}let L={id:j,role:g?`gridcell`:`option`,"aria-selected":C?M:void 0,tabIndex:void 0,onPointerDownCapture(e){e.isPrimary&&(h.state.pointerDownItemRef.current=e.currentTarget),e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){S||b||I(e.nativeEvent)},onMouseUp(e){let t=h.state.pointerDownItemRef.current===e.currentTarget;h.state.pointerDownItemRef.current=null,!(S||b||e.button!==0||t||!D)&&I(e.nativeEvent)}},R=o_(`div`,t,{ref:[P,n,m.ref,A],state:F,props:[k,L,f,N]}),z=Y.useMemo(()=>({selected:M,textRef:p}),[M,p]);return(0,X.jsx)(i5.Provider,{value:z,children:R})}function bge(e){let{componentProps:t,forwardedRef:n}=e,r=$(L8(),V8.isItemEqualToValue),{flatFilteredItems:i}=z8(),a=W3(i,t.value??null,r);return(0,X.jsx)(o5,{componentProps:t,forwardedRef:n,virtualized:!0,indexFromFilter:a})}var xge=Y.memo(Y.forwardRef(function(e,t){let n=$(L8(),V8.virtualized);return n&&e.index==null?(0,X.jsx)(bge,{componentProps:e,forwardedRef:t}):(0,X.jsx)(o5,{componentProps:e,forwardedRef:t,virtualized:n,indexFromFilter:void 0})})),Sge=Y.forwardRef(function(e,t){let{selected:n}=a5();return e.keepMounted||n?(0,X.jsx)(Cge,{...e,ref:t}):null}),Cge=Y.memo(Y.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=a5(),c=Y.useRef(null),{transitionStatus:l,setMounted:u}=gq(s),d=o_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:XV});return vq({open:s,ref:c,onComplete(){s||u(!1)}}),d})),wge=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=z8(),c=L8(),l=lge(),u=s.length===0?a:null;return o_(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})});function s5(e){let t=(0,Z.c)(2),n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(Yhe,{...e}),t[0]=e,t[1]=n),n}function c5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`relative flex w-full items-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nge,{className:i,"data-slot":`combobox-input-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function l5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent py-1 pr-16 pl-3 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,`focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(ege,{className:i,"data-slot":`combobox-input`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Tge=`flex size-7 items-center justify-center rounded-sm text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`;function u5(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Tge,`absolute right-1`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Jv,{className:`size-4 opacity-50`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(rge,{className:i,"data-slot":`combobox-trigger`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function d5(e){let t=(0,Z.c)(18),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({className:r,children:n,side:a,sideOffset:o,align:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`bottom`:a,l=o===void 0?4:o,u=s===void 0?`start`:s,d;t[7]===r?d=t[8]:(d=Q(`data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-closed:animate-out data-open:animate-in`,r),t[7]=r,t[8]=d);let f;t[9]!==n||t[10]!==i||t[11]!==d?(f=(0,X.jsx)(mge,{className:d,"data-slot":`combobox-content`,...i,children:n}),t[9]=n,t[10]=i,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==u||t[14]!==c||t[15]!==l||t[16]!==f?(p=(0,X.jsx)(dge,{children:(0,X.jsx)(fge,{align:u,className:`isolate z-50 outline-none`,side:c,sideOffset:l,children:f})}),t[13]=u,t[14]=c,t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function f5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`max-h-64 overflow-y-auto overscroll-contain`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oge,{className:i,"data-slot":`combobox-list`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function p5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-3 text-muted-foreground text-xs empty:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(wge,{className:i,"data-slot":`combobox-empty`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function m5(e){let t=(0,Z.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50`,r),t[4]=r,t[5]=a);let o;t[6]===n?o=t[7]:(o=(0,X.jsx)(`span`,{className:`min-w-0 flex-1`,children:n}),t[6]=n,t[7]=o);let s;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Sge,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(qv,{className:`size-4`})}),t[8]=s):s=t[8];let c;return t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(xge,{className:a,"data-slot":`combobox-item`,...i,children:[o,s]}),t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function Ege(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(gge,{"data-slot":`combobox-group`,...n}),t[2]=n,t[3]=r),r}function Dge(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`px-2 py-1.5 text-muted-foreground text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(_ge,{className:i,"data-slot":`combobox-group-label`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Oge=t5;function kge(e){return{path:e,label:`${e} (Unavailable)`,type:`string`,sourceNodeId:``,sourceNodeLabel:`Unavailable`,sourceNodeLabels:[`Unavailable`]}}function Age(e){let t=new Map;for(let n of e){let e=t.get(n.sourceNodeLabel);e?e.push(n):t.set(n.sourceNodeLabel,[n])}return Array.from(t.entries()).toSorted(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({value:e,items:t.toSorted((e,t)=>e.path.localeCompare(t.path))}))}function jge(e,t){let n=e.find(e=>e.path===t),r=Age(e);if(n)return{selected:n,groups:r};let i=kge(t);return{selected:i,groups:[{value:i.sourceNodeLabel,items:[i]},...r]}}function Mge(e,t){let n=t.trim().toLowerCase();return!n||[e.path,e.label,...e.sourceNodeLabels,...e.nullable?[`nullable`]:[]].some(e=>e.toLowerCase().includes(n))}function Nge(e,t){return e.path===t.path}function Pge(e){return e.label}function Fge(e){let t=(0,Z.c)(12),{fields:n,valuePath:r,onValueChange:i,disabled:a}=e,o;t[0]!==n||t[1]!==r?(o=jge(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let{selected:s,groups:c}=o,l;t[3]===i?l=t[4]:(l=e=>{e&&i(e)},t[3]=i,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsxs)(c5,{className:`min-w-[280px]`,children:[(0,X.jsx)(l5,{"aria-label":`Select field`,placeholder:`Select field`}),(0,X.jsx)(u5,{"aria-label":`Show the fields`})]}),t[5]=u):u=t[5];let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsxs)(d5,{className:`w-max min-w-(--anchor-width)`,children:[(0,X.jsx)(p5,{children:`No field matches that.`}),(0,X.jsx)(f5,{children:Ige})]}),t[6]=d):d=t[6];let f;return t[7]!==a||t[8]!==c||t[9]!==s||t[10]!==l?(f=(0,X.jsxs)(s5,{disabled:a,filter:Mge,isItemEqualToValue:Nge,items:c,itemToStringLabel:Pge,onValueChange:l,value:s,children:[u,d]}),t[7]=a,t[8]=c,t[9]=s,t[10]=l,t[11]=f):f=t[11],f}function Ige(e){return(0,X.jsxs)(Ege,{items:e.items,children:[(0,X.jsx)(Dge,{children:e.value}),(0,X.jsx)(Oge,{children:t=>(0,X.jsx)(m5,{className:`items-start`,value:t,children:(0,X.jsxs)(`span`,{className:`flex w-full flex-col items-start`,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[t.label,t.nullable&&(0,X.jsx)(`span`,{className:`rounded bg-muted px-1 py-0.5 font-normal text-xs text-muted-foreground leading-none`,children:`nullable`})]}),t.sourceNodeLabels.length>1&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Also from`,` `,t.sourceNodeLabels.filter(t=>t!==e.value).join(`, `)]})]})},t.path)})]},e.value)}function Lge(e){return e===`within_next`||e===`more_than_from_now`||e===`less_than_ago`||e===`more_than_ago`}function Rge(e){return e===`before`||e===`after`}function zge(e){return e===`equals`||e===`not_equals`||e===`contains`}function Bge(e){return e===`equals`||e===`not_equals`||e===`greater_than`||e===`greater_or_equal`||e===`less_than`||e===`less_or_equal`}function Vge(e){return e===`is_true`||e===`is_false`}function Hge(e){return R2.some(t=>t.value===e)}function Uge(e,t){let n=t?Rde:[];return e===`timestamp`?[...Pde,...n]:e===`string`?[...Fde,...n]:e===`number`?[...Ide,...n]:[...Lde,...n]}function Wge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function Gge(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toISOString()}function Kge(e){return L2(e,{groupId:u0(),conditionId:u0()})}function h5(e){return I2(e,u0())}function qge(e){let{condition:t,operatorValue:n}=e;return Lge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,amount:N2(t)?t.amount:1,unit:N2(t)?t.unit:`days`}:Rge(n)?{id:t.id,field:t.field,fieldType:`timestamp`,operator:n,dateTime:P2(t)?t.dateTime:new Date().toISOString()}:null}function Jge(e){return e===`is_set`||e===`is_not_set`}function Yge(e,t){let n={id:e.id,field:e.field};if(Jge(t))return{...n,fieldType:e.fieldType,operator:t};if(e.fieldType===`timestamp`)return qge({condition:F2(e)?{...n,fieldType:`timestamp`,operator:`within_next`,amount:1,unit:`days`}:e,operatorValue:t});if(e.fieldType===`string`){if(!zge(t))return null;let r=!F2(e)&&`value`in e?e.value:``;return{...n,fieldType:`string`,operator:t,value:r}}if(e.fieldType===`number`){if(!Bge(t))return null;let r=!F2(e)&&`value`in e?e.value:0;return{...n,fieldType:`number`,operator:t,value:r}}return Vge(t)?{...n,fieldType:`boolean`,operator:t}:null}function g5(e){let t=(0,Z.c)(6),{value:n,onChange:r,disabled:i}=e,a;t[0]!==i||t[1]!==r||t[2]!==n?(a=Nde.map(e=>{let t=e.value===n;return(0,X.jsx)(`button`,{className:`rounded-full px-3 py-1 font-medium text-xs transition-colors ${t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground`}`,disabled:i,onClick:()=>r(e.value),type:`button`,children:e.label},e.value)}),t[0]=i,t[1]=r,t[2]=n,t[3]=a):a=t[3];let o;return t[4]===a?o=t[5]:(o=(0,X.jsx)(`div`,{className:`inline-flex items-center rounded-full border bg-card p-0.5`,children:a}),t[4]=a,t[5]=o),o}function Xge(e){let t=(0,Z.c)(56),{condition:n,disabled:r,currentNodeId:i,enumValues:a,onConditionChange:o}=e;if(F2(n))return null;if(n.fieldType===`timestamp`){if(N2(n)){let e;t[0]!==n||t[1]!==o?(e=e=>{let t=Number.parseInt(e.target.value,10);o({...n,amount:Number.isNaN(t)?1:Math.max(t,1)})},t[0]=n,t[1]=o,t[2]=e):e=t[2];let i;t[3]!==n.amount||t[4]!==r||t[5]!==e?(i=(0,X.jsx)(wX,{className:`w-24`,disabled:r,min:1,onChange:e,type:`number`,value:n.amount}),t[3]=n.amount,t[4]=r,t[5]=e,t[6]=i):i=t[6];let a;t[7]!==n||t[8]!==o?(a=H6(e=>{Hge(e)&&o({...n,unit:e})}),t[7]=n,t[8]=o,t[9]=a):a=t[9];let s;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(W6,{className:`w-36`,children:(0,X.jsx)(U6,{})}),t[10]=s):s=t[10];let c;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,X.jsx)(G6,{children:R2.map(Qge)}),t[11]=c):c=t[11];let l;t[12]!==n.unit||t[13]!==r||t[14]!==a?(l=(0,X.jsxs)(V6,{disabled:r,onValueChange:a,value:n.unit,children:[s,c]}),t[12]=n.unit,t[13]=r,t[14]=a,t[15]=l):l=t[15];let u;return t[16]!==i||t[17]!==l?(u=(0,X.jsxs)(X.Fragment,{children:[i,l]}),t[16]=i,t[17]=l,t[18]=u):u=t[18],u}let e;t[19]!==n||t[20]!==o?(e=e=>{P2(n)&&o({...n,dateTime:Gge(e.target.value)})},t[19]=n,t[20]=o,t[21]=e):e=t[21];let i;t[22]===n?i=t[23]:(i=P2(n)?Wge(n.dateTime):``,t[22]=n,t[23]=i);let a;return t[24]!==r||t[25]!==e||t[26]!==i?(a=(0,X.jsx)(wX,{disabled:r,onChange:e,type:`datetime-local`,value:i}),t[24]=r,t[25]=e,t[26]=i,t[27]=a):a=t[27],a}if(n.fieldType===`string`){if(a&&a.length>0&&(n.operator===`equals`||n.operator===`not_equals`)){let e;t[28]!==n||t[29]!==o?(e=H6(e=>{o({...n,value:e})}),t[28]=n,t[29]=o,t[30]=e):e=t[30];let i=a.includes(n.value)?n.value:null,s;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(W6,{className:`min-w-[240px]`,children:(0,X.jsx)(U6,{placeholder:`Select value`})}),t[31]=s):s=t[31];let c;t[32]===a?c=t[33]:(c=a.map(Zge),t[32]=a,t[33]=c);let l;t[34]===c?l=t[35]:(l=(0,X.jsx)(G6,{children:c}),t[34]=c,t[35]=l);let u;return t[36]!==r||t[37]!==e||t[38]!==i||t[39]!==l?(u=(0,X.jsxs)(V6,{disabled:r,onValueChange:e,value:i,children:[s,l]}),t[36]=r,t[37]=e,t[38]=i,t[39]=l,t[40]=u):u=t[40],u}let e;t[41]!==n||t[42]!==o?(e=e=>{o({...n,value:e})},t[41]=n,t[42]=o,t[43]=e):e=t[43];let s;return t[44]!==n.value||t[45]!==i||t[46]!==r||t[47]!==e?(s=(0,X.jsx)(g8,{className:`min-w-[240px]`,currentNodeId:i,disabled:r,onChange:e,placeholder:`value`,value:n.value}),t[44]=n.value,t[45]=i,t[46]=r,t[47]=e,t[48]=s):s=t[48],s}if(n.fieldType===`number`){let e;t[49]!==n||t[50]!==o?(e=e=>{let t=Number.parseFloat(e.target.value);o({...n,value:Number.isNaN(t)?0:t})},t[49]=n,t[50]=o,t[51]=e):e=t[51];let i=String(n.value),a;return t[52]!==r||t[53]!==e||t[54]!==i?(a=(0,X.jsx)(wX,{disabled:r,onChange:e,placeholder:`0`,type:`number`,value:i}),t[52]=r,t[53]=e,t[54]=i,t[55]=a):a=t[55],a}return null}function Zge(e){return(0,X.jsx)(K6,{value:e,children:e},e)}function Qge(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}function _5(e){let t=(0,Z.c)(58),{label:n,description:r,fields:i,emptyFieldsMessage:a,value:o,onChange:s,currentNodeId:c,disabled:l}=e,u=i[0]??null,d;t[0]===i?d=t[1]:(d=new Map(i.map(e_e)),t[0]=i,t[1]=d);let f=d,p,m,h,g,_,v,y;if(t[2]!==i||t[3]!==c||t[4]!==r||t[5]!==l||t[6]!==a||t[7]!==f||t[8]!==n||t[9]!==s||t[10]!==u||t[11]!==o){y=Symbol.for(`react.early_return_sentinel`);bb0:{let e=o.trim(),d=e4(e),b=d.valid?d.model:null,x;t[19]===s?x=t[20]:(x=e=>{let t=a4(e);s({model:t4(e),expression:t.valid?t.expression:``})},t[19]=s,t[20]=x);let S=x,C;t[21]!==S||t[22]!==u?(C=()=>{u&&S(Kge(u))},t[21]=S,t[22]=u,t[23]=C):C=t[23];let w=C,T=b?Mde(b,f):null;m=T?a4(T):null;let E=(e,t)=>{T&&S({...T,groups:T.groups.map(n=>n.id===e?t(n):n)})},D=(e,t,n)=>{E(e,e=>({...e,conditions:e.conditions.map(e=>e.id===t?n(e):e)}))},O=e=>{T&&u&&E(e,e=>({...e,conditions:[...e.conditions,h5(u)]}))},k=(e,t)=>{T&&E(e,e=>e.conditions.length<=1?e:{...e,conditions:e.conditions.filter(e=>e.id!==t)})};p=()=>{T&&u&&S({...T,groups:[...T.groups,{id:u0(),logic:`and`,conditions:[h5(u)]}]})};let A=e=>{!T||T.groups.length<=1||S({...T,groups:T.groups.filter(t=>t.id!==e)})};if(!T){let o;t[24]===n?o=t[25]:(o=(0,X.jsx)(TX,{className:`text-sm`,children:n}),t[24]=n,t[25]=o);let s;t[26]===r?s=t[27]:(s=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[26]=r,t[27]=s);let c;t[28]!==w||t[29]!==i.length||t[30]!==l||t[31]!==a?(c=i.length>0?(0,X.jsx)(zv,{disabled:l,onClick:w,size:`sm`,type:`button`,variant:`outline`,children:`Configure condition`}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[28]=w,t[29]=i.length,t[30]=l,t[31]=a,t[32]=c):c=t[32],y=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border bg-muted/30 p-3`,children:[o,s,c,e&&!d.valid&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:d.error})]});break bb0}_=`space-y-3 rounded-md border bg-muted/30 p-3`;let j;t[33]===n?j=t[34]:(j=(0,X.jsx)(TX,{className:`text-sm`,children:n}),t[33]=n,t[34]=j);let M;t[35]===r?M=t[36]:(M=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:r}),t[35]=r,t[36]=M),t[37]!==M||t[38]!==j?(v=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[j,M]}),t[37]=M,t[38]=j,t[39]=v):v=t[39],h=`space-y-3`,g=T.groups.map((e,t)=>(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`rounded-lg border bg-card`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between border-b px-3 py-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-md bg-muted px-2 py-1 font-medium text-xs`,children:t+1}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Filter group`}),(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[e.conditions.length,` `,e.conditions.length===1?`condition`:`conditions`]})]}),(0,X.jsx)(zv,{disabled:l||T.groups.length<=1,onClick:()=>A(e.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),(0,X.jsxs)(`div`,{className:`space-y-3 p-3`,children:[e.conditions.map((t,n)=>{let r=f.get(t.field),a=Uge(t.fieldType,r?.nullable),o=e.conditions.length>1;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(Fge,{disabled:l||i.length===0,fields:i,onValueChange:n=>{n.path!==t.field&&D(e.id,t.id,e=>I2(n,e.id))},valuePath:t.field}),(0,X.jsxs)(V6,{disabled:l,onValueChange:H6(n=>{let r=Yge(t,n);r&&D(e.id,t.id,()=>r)}),value:t.operator,children:[(0,X.jsx)(W6,{className:`min-w-[190px]`,children:(0,X.jsx)(U6,{placeholder:`Select operator`})}),(0,X.jsx)(G6,{children:a.map($ge)})]}),(0,X.jsx)(Xge,{condition:t,currentNodeId:c,disabled:l,enumValues:r?.enumValues,onConditionChange:n=>{D(e.id,t.id,()=>n)}}),(0,X.jsx)(zv,{disabled:l||!o,onClick:()=>k(e.id,t.id),size:`icon-sm`,type:`button`,variant:`ghost`,children:(0,X.jsx)(fy,{className:`size-4`})})]}),n<e.conditions.length-1&&(0,X.jsx)(`div`,{className:`py-2 pl-2`,children:(0,X.jsx)(g5,{disabled:l,onChange:t=>{E(e.id,e=>({...e,logic:t}))},value:e.logic})})]},t.id)}),(0,X.jsxs)(zv,{disabled:l||!u,onClick:()=>O(e.id),size:`sm`,type:`button`,variant:`ghost`,children:[(0,X.jsx)(cy,{className:`size-4`}),`Add condition`]})]})]}),t<T.groups.length-1&&(0,X.jsx)(`div`,{className:`flex justify-center py-2`,children:(0,X.jsx)(g5,{disabled:l,onChange:e=>{S({...T,groupLogic:e})},value:T.groupLogic})})]},e.id))}t[2]=i,t[3]=c,t[4]=r,t[5]=l,t[6]=a,t[7]=f,t[8]=n,t[9]=s,t[10]=u,t[11]=o,t[12]=p,t[13]=m,t[14]=h,t[15]=g,t[16]=_,t[17]=v,t[18]=y}else p=t[12],m=t[13],h=t[14],g=t[15],_=t[16],v=t[17],y=t[18];if(y!==Symbol.for(`react.early_return_sentinel`))return y;let b;t[40]!==h||t[41]!==g?(b=(0,X.jsx)(`div`,{className:h,children:g}),t[40]=h,t[41]=g,t[42]=b):b=t[42];let x=l||!u,S;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(cy,{className:`size-4`}),t[43]=S):S=t[43];let C;t[44]!==p||t[45]!==x?(C=(0,X.jsx)(`div`,{className:`flex justify-center`,children:(0,X.jsxs)(zv,{disabled:x,onClick:p,size:`sm`,type:`button`,variant:`outline`,children:[S,`Add group`]})}),t[44]=p,t[45]=x,t[46]=C):C=t[46];let w;t[47]===m?w=t[48]:(w=m?.valid===!1&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:m.error}),t[47]=m,t[48]=w);let T;t[49]===m?T=t[50]:(T=m?.valid&&(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Compiled CEL: `,m.expression]}),t[49]=m,t[50]=T);let E;return t[51]!==C||t[52]!==w||t[53]!==T||t[54]!==_||t[55]!==v||t[56]!==b?(E=(0,X.jsxs)(`div`,{className:_,children:[v,b,C,w,T]}),t[51]=C,t[52]=w,t[53]=T,t[54]=_,t[55]=v,t[56]=b,t[57]=E):E=t[57],E}function $ge(e){return(0,X.jsx)(K6,{value:e.value,children:e.label},e.value)}function e_e(e){return[e.path,e]}function v5(e){let t=(0,Z.c)(18),{children:n,className:r,title:i,variant:a}=e;if((a===void 0?`box`:a)===`text`){let e;t[0]===r?e=t[1]:(e=Q(`text-warning text-xs`,r),t[0]=r,t[1]=e);let i;return t[2]!==n||t[3]!==e?(i=(0,X.jsx)(`p`,{className:e,children:n}),t[2]=n,t[3]=e,t[4]=i):i=t[4],i}let o;t[5]===r?o=t[6]:(o=Q(`flex items-start gap-2 rounded-md border border-warning/30 bg-warning/10 p-2`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(py,{className:`mt-0.5 size-3.5 shrink-0 text-warning`}),t[7]=s):s=t[7];let c;t[8]===i?c=t[9]:(c=i?(0,X.jsx)(`p`,{className:`font-medium text-warning text-xs`,children:i}):null,t[8]=i,t[9]=c);let l;t[10]===n?l=t[11]:(l=(0,X.jsx)(`p`,{className:`text-warning text-xs`,children:n}),t[10]=n,t[11]=l);let u;t[12]!==c||t[13]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[c,l]}),t[12]=c,t[13]=l,t[14]=u):u=t[14];let d;return t[15]!==o||t[16]!==u?(d=(0,X.jsxs)(`div`,{className:o,children:[s,u]}),t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function t_e(e,t){let n=t.trim().toLowerCase();return!n||e.label.toLowerCase().includes(n)||e.name.toLowerCase().includes(n)}function n_e(e,t){return e.name===t.name}function r_e(e){let t=(0,Z.c)(9),{inputId:n,placeholder:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,X.jsx)(l5,{id:n,placeholder:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(u5,{"aria-label":`Show the Events`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,X.jsxs)(c5,{children:[i,a]}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsxs)(d5,{children:[(0,X.jsx)(p5,{children:`No Event matches that.`}),(0,X.jsx)(f5,{children:i_e})]}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,X.jsxs)(X.Fragment,{children:[o,s]}),t[7]=o,t[8]=c),c}function i_e(e){return(0,X.jsxs)(m5,{value:e,children:[(0,X.jsx)(`span`,{className:`block truncate`,children:e.label}),e.label===e.name?null:(0,X.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.name})]},e.name)}function y5(e){let t=(0,Z.c)(16),{choices:n,value:r,onValueChange:i,disabled:a,inputId:o,placeholder:s}=e,c=s===void 0?`Search Events`:s,l;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>n.find(t=>t.name===e)??[],t[3]=n,t[4]=e),l=r.flatMap(e),t[0]=n,t[1]=r,t[2]=l}else l=t[2];let u=l,d;t[5]===i?d=t[6]:(d=e=>i(e.map(a_e)),t[5]=i,t[6]=d);let f;t[7]!==o||t[8]!==c?(f=(0,X.jsx)(r_e,{inputId:o,placeholder:c}),t[7]=o,t[8]=c,t[9]=f):f=t[9];let p;return t[10]!==n||t[11]!==a||t[12]!==u||t[13]!==d||t[14]!==f?(p=(0,X.jsx)(s5,{disabled:a,filter:t_e,isItemEqualToValue:n_e,items:n,itemToStringLabel:o_e,multiple:!0,onValueChange:d,value:u,children:f}),t[10]=n,t[11]=a,t[12]=u,t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function a_e(e){return e.name}function o_e(e){return e.label}function s_e(e){let t=(0,Z.c)(30),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=d4(n),s=yy(),c=o.map(c_e),l;t[0]===r?l=t[1]:(l=e=>{r({waitFor:e})},t[0]=r,t[1]=l);let u=l,d;t[2]!==o||t[3]!==u?(d=e=>{u(e.map(e=>o.find(t=>t.event===e)??{event:e}))},t[2]=o,t[3]=u,t[4]=d):d=t[4];let f=d,p;t[5]!==o||t[6]!==u?(p=e=>{u(o.filter(t=>t.event!==e))},t[5]=o,t[6]=u,t[7]=p):p=t[7];let m=p,h;t[8]!==o||t[9]!==u?(h=(e,t)=>{u(o.map(n=>n.event===e?{event:n.event,...t?{match:t}:{}}:n))},t[8]=o,t[9]=u,t[10]=h):h=t[10];let g=h,_;t[11]===a?_=t[12]:(_=(0,X.jsx)(TX,{htmlFor:a,children:`Resume when the event is`}),t[11]=a,t[12]=_);let v;t[13]!==s.events||t[14]!==i||t[15]!==a||t[16]!==c||t[17]!==f?(v=s.events.length>0?(0,X.jsx)(y5,{choices:s.events,disabled:i,inputId:a,onValueChange:f,value:c}):(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This server declares no Events, so there is nothing for a wait to park on. Ask whoever runs it to declare the Event.`}),t[13]=s.events,t[14]=i,t[15]=a,t[16]=c,t[17]=f,t[18]=v):v=t[18];let y;t[19]!==_||t[20]!==v?(y=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[_,v]}),t[19]=_,t[20]=v,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==m||t[24]!==o||t[25]!==g?(b=o.length===0?(0,X.jsx)(v5,{children:`Name at least one event. A wait with none cannot be resumed by anything, and the workflow will not save.`}):o.map(e=>(0,X.jsx)(l_e,{disabled:i,onMatchChange:g,onRemove:m,subscription:e},e.event)),t[22]=i,t[23]=m,t[24]=o,t[25]=g,t[26]=b):b=t[26];let x;return t[27]!==y||t[28]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[y,b]}),t[27]=y,t[28]=b,t[29]=x):x=t[29],x}function c_e(e){return e.event}function l_e(e){let t=(0,Z.c)(59),{subscription:n,onMatchChange:r,onRemove:i,disabled:a}=e,o=wA(H4),s=wA(Q4),c=yy(),l;t[0]!==c||t[1]!==n.event?(l=Ny(c,n.event),t[0]=c,t[1]=n.event,t[2]=l):l=t[2];let u=l,d;t[3]===s?d=t[4]:(d=s.filter(f_e).map(d_e).find(u_e),t[3]=s,t[4]=d);let f=d,p;t[5]!==c||t[6]!==n.event?(p=Wme(c,n.event),t[5]=c,t[6]=n.event,t[7]=p):p=t[7];let m=p,h;t[8]!==r||t[9]!==n.event?(h=e=>{r(n.event,e.model)},t[8]=r,t[9]=n.event,t[10]=h):h=t[10];let g=h,_;t[11]!==r||t[12]!==n.event?(_=()=>{r(n.event,``)},t[11]=r,t[12]=n.event,t[13]=_):_=t[13];let v=_,y;t[14]!==f||t[15]!==u?.correlationPath||t[16]!==n.event?(y=()=>f?T1({rules:f,eventName:n.event,declaredPath:u?.correlationPath}):u?.correlationPath,t[14]=f,t[15]=u?.correlationPath,t[16]=n.event,t[17]=y):y=t[17],u?.correlationPath;let b;t[18]===y?b=t[19]:(b=y(),t[18]=y,t[19]=b);let x=b,S;t[20]!==m||t[21]!==r||t[22]!==x||t[23]!==n.event?(S=()=>{let e=m.find(e=>e.path===x)??m[0];e&&r(n.event,t4(L2(e,{groupId:`${n.event}-group`,conditionId:`${n.event}-rule`})))},t[20]=m,t[21]=r,t[22]=x,t[23]=n.event,t[24]=S):S=t[24];let C=S,w;t[25]===u?w=t[26]:(w=u?(0,X.jsx)(`p`,{className:`truncate text-xs`,children:u.label}):null,t[25]=u,t[26]=w);let T;t[27]===n.event?T=t[28]:(T=(0,X.jsx)(`p`,{className:`truncate font-mono text-xs text-muted-foreground`,children:n.event}),t[27]=n.event,t[28]=T);let E;t[29]===u?E=t[30]:(E=u?null:(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:`This app no longer declares this Event; the workflow will not save until it is removed or declared again.`}),t[29]=u,t[30]=E);let D;t[31]!==n.event||t[32]!==T||t[33]!==E||t[34]!==w?(D=(0,X.jsxs)(`div`,{className:`min-w-0`,title:n.event,children:[w,T,E]}),t[31]=n.event,t[32]=T,t[33]=E,t[34]=w,t[35]=D):D=t[35];let O=`Remove ${n.event}`,k;t[36]!==i||t[37]!==n.event?(k=()=>i(n.event),t[36]=i,t[37]=n.event,t[38]=k):k=t[38];let A;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(hy,{className:`size-3.5`}),t[39]=A):A=t[39];let j;t[40]!==a||t[41]!==O||t[42]!==k?(j=(0,X.jsx)(zv,{"aria-label":O,className:`size-7 shrink-0`,disabled:a,onClick:k,size:`icon`,type:`button`,variant:`ghost`,children:A}),t[40]=a,t[41]=O,t[42]=k,t[43]=j):j=t[43];let M;t[44]!==D||t[45]!==j?(M=(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[D,j]}),t[44]=D,t[45]=j,t[46]=M):M=t[46];let N;t[47]!==a||t[48]!==m||t[49]!==g||t[50]!==v||t[51]!==C||t[52]!==o||t[53]!==n.event||t[54]!==n.match?(N=n.match?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(_5,{currentNodeId:o??void 0,description:`Only an arrival satisfying this resumes the run. Compare a payload field against a literal, or against a value from this run.`,disabled:a,emptyFieldsMessage:`This Event declares no fields, so there is nothing to match on.`,fields:m,label:`Match`,onChange:g,value:n.match}),(0,X.jsxs)(zv,{disabled:a,onClick:v,size:`sm`,type:`button`,variant:`ghost`,children:[`Resume on any `,n.event]})]}):(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Any `,n.event,` resumes this run, whatever it carries.`]}),(0,X.jsx)(zv,{disabled:a||m.length===0,onClick:C,size:`sm`,type:`button`,variant:`outline`,children:`Add a match`})]}),t[47]=a,t[48]=m,t[49]=g,t[50]=v,t[51]=C,t[52]=o,t[53]=n.event,t[54]=n.match,t[55]=N):N=t[55];let P;return t[56]!==M||t[57]!==N?(P=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[M,N]}),t[56]=M,t[57]=N,t[58]=P):P=t[58],P}function u_e(e){return e!==void 0}function d_e(e){return C1(e.data.config)}function f_e(e){return e.data.type===`lifecycle`}function b5(e){let t=(0,Z.c)(5),{logoUrl:n,label:r,fallback:i}=e,a;t[0]===n?a=t[1]:(a=n?.trim(),t[0]=n,t[1]=a);let o=a;if(!o)return i;let s=`${r} logo`,c;return t[2]!==o||t[3]!==s?(c=(0,X.jsx)(`img`,{alt:s,className:`size-4 rounded-sm object-contain`,height:16,loading:`lazy`,src:o,width:16}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}function p_e(e){let t=(0,Z.c)(15),{config:n,onUpdateConfig:r,disabled:i}=e,a=wA(H4),o=wA(Q4),s=wA($4),c=yy(),l=a??void 0,u;t[0]!==c||t[1]!==s||t[2]!==o||t[3]!==l?(u=o8({currentNodeId:l,nodes:o,edges:s,catalog:c}),t[0]=c,t[1]=s,t[2]=o,t[3]=l,t[4]=u):u=t[4];let d=u,f;t[5]===r?f=t[6]:(f=e=>{r({conditionModel:e.model,condition:e.expression})},t[5]=r,t[6]=f);let p=f,m=a??void 0,h;t[7]===n?h=t[8]:(h=_0(n,`conditionModel`)??``,t[7]=n,t[8]=h);let g;return t[9]!==i||t[10]!==d||t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,X.jsx)(_5,{currentNodeId:m,description:`Build a condition from the Lifecycle Node and upstream action output fields. Timestamp fields support relative and absolute time filters.`,disabled:i,emptyFieldsMessage:`No upstream fields available. Connect this node to the Lifecycle Node or an action with typed outputs first.`,fields:d,label:`Condition`,onChange:p,value:h}),t[9]=i,t[10]=d,t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function m_e(){let e=(0,Z.c)(3),t=k8(wA(H4)),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Splits On Event`}),e[0]=n):n=e[0];let r;return e[1]===t?r=e[2]:(r=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[n,t.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No Event reaches this node yet. Connect it below the Lifecycle Node, and it draws one outlet per Start Event.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`ul`,{className:`space-y-1`,children:t.map(h_e)}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A run leaves by the outlet naming the Event it arrived on. An outlet with nothing connected ends the run there.`})]})]}),e[1]=t,e[2]=r),r}function h_e(e){return(0,X.jsxs)(`li`,{className:`text-sm`,children:[e.label,(0,X.jsx)(`span`,{className:`ml-2 text-muted-foreground text-xs`,children:e.name})]},e.name)}function g_e(e){let t=(0,Z.c)(87),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=v0(n,`waitGateMode`,`off`),t[0]=n,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=_0(n,`waitUntil`),t[2]=n,t[3]=s);let c=s,l;t[4]===n?l=t[5]:(l=_0(n,`waitDuration`),t[4]=n,t[5]=l);let u=l,d;t[6]===n?d=t[7]:(d=l4(n),t[6]=n,t[7]=d);let f=d,p;t[8]===n?p=t[9]:(p=_0(n,`waitAllowedHoursMode`),t[8]=n,t[9]=p);let m=p===`daily_window`,h;t[10]!==n||t[11]!==r?(h=e=>{let t={...n,waitDelayTimingMode:e},i=Object.fromEntries(u4(t).map(__e));r({...i,waitDelayTimingMode:e})},t[10]=n,t[11]=r,t[12]=h):h=t[12];let g=h,_;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Time-Based Wait`}),t[13]=_):_=t[13];let v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(TX,{htmlFor:`waitDelayTimingMode`,children:`Time input mode`}),t[14]=v):v=t[14];let y;t[15]===g?y=t[16]:(y=H6(g),t[15]=g,t[16]=y);let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(W6,{className:`w-full`,id:`waitDelayTimingMode`,children:(0,X.jsx)(U6,{placeholder:`Select time input mode`})}),t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`duration`,children:`Wait for duration`}),(0,X.jsx)(K6,{value:`until`,children:`Wait until date/time`})]}),t[18]=x):x=t[18];let S;t[19]!==f||t[20]!==i||t[21]!==y?(S=(0,X.jsxs)(V6,{disabled:i,onValueChange:y,value:f,children:[b,x]}),t[19]=f,t[20]=i,t[21]=y,t[22]=S):S=t[22];let C;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Pick one mode. Switching modes clears fields that do not apply.`}),t[23]=C):C=t[23];let w;t[24]===S?w=t[25]:(w=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[v,S,C]}),t[24]=S,t[25]=w);let T;t[26]!==n||t[27]!==u||t[28]!==c||t[29]!==f||t[30]!==i||t[31]!==r?(T=f===`duration`?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitDuration`,children:`Wait for (duration)`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitDuration.type,id:`waitDuration`,onChange:e=>r({waitDuration:e}),placeholder:`24h, 90m, 3600000, or P1D`,value:u}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: use `,(0,X.jsx)(`code`,{children:`24h`}),` to continue one day later.`]})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitUntil`,children:`Wait until this date/time`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitUntil.type,id:`waitUntil`,onChange:e=>r({waitUntil:e}),placeholder:`2026-03-10T09:00:00-05:00 or {{@lifecycle_1:Lifecycle.appointment.startsAt}}`,value:c}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Use this when timing comes from payload data, like an appointment start time.`})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitOffset`,children:`Send before/after that time (optional)`}),(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitOffset.type,id:`waitOffset`,onChange:e=>r({waitOffset:e}),placeholder:`-1d, 6h, 30m`,value:_0(n,`waitOffset`)}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Example: `,(0,X.jsx)(`code`,{children:`-1d`}),` sends one day before the target time.`]})]})]}),t[26]=n,t[27]=u,t[28]=c,t[29]=f,t[30]=i,t[31]=r,t[32]=T):T=t[32];let E;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(TX,{htmlFor:`waitGateMode`,children:`Continue only if time actually elapsed`}),t[33]=E):E=t[33];let D;t[34]===r?D=t[35]:(D=e=>r({waitGateMode:e}),t[34]=r,t[35]=D);let O;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(W6,{className:`w-full`,id:`waitGateMode`,children:(0,X.jsx)(U6,{placeholder:`Select behavior`})}),t[36]=O):O=t[36];let k;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`off`,children:`Off (continue immediately)`}),(0,X.jsx)(K6,{value:`require_actual_wait`,children:`Skip branch when already due`})]}),t[37]=k):k=t[37];let A;t[38]!==i||t[39]!==D||t[40]!==o?(A=(0,X.jsxs)(V6,{disabled:i,onValueChange:D,value:o,children:[O,k]}),t[38]=i,t[39]=D,t[40]=o,t[41]=A):A=t[41];let j;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Prevents immediate sends when the computed time is now or in the past after an update/reschedule.`}),t[42]=j):j=t[42];let M;t[43]===A?M=t[44]:(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[E,A,j]}),t[43]=A,t[44]=M);let N;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,X.jsx)(TX,{htmlFor:`waitAllowedHoursMode`,children:`Allowed send window`}),t[45]=N):N=t[45];let P;t[46]===r?P=t[47]:(P=e=>r({waitAllowedHoursMode:e}),t[46]=r,t[47]=P);let F;t[48]===n?F=t[49]:(F=v0(n,`waitAllowedHoursMode`,`off`),t[48]=n,t[49]=F);let I;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(W6,{className:`w-full`,id:`waitAllowedHoursMode`,children:(0,X.jsx)(U6,{placeholder:`Select window mode`})}),t[50]=I):I=t[50];let L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`off`,children:`Off (allow any time)`}),(0,X.jsx)(K6,{value:`daily_window`,children:`Daily window`})]}),t[51]=L):L=t[51];let R;t[52]!==i||t[53]!==P||t[54]!==F?(R=(0,X.jsxs)(V6,{disabled:i,onValueChange:P,value:F,children:[I,L]}),t[52]=i,t[53]=P,t[54]=F,t[55]=R):R=t[55];let z;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`When enabled, times outside the window shift to the next allowed start.`}),t[56]=z):z=t[56];let B;t[57]===R?B=t[58]:(B=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[N,R,z]}),t[57]=R,t[58]=B);let V;t[59]!==n||t[60]!==i||t[61]!==m||t[62]!==r?(V=m&&(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitAllowedStartTime`,children:`Window start`}),(0,X.jsx)(wX,{disabled:i,id:`waitAllowedStartTime`,onChange:e=>r({waitAllowedStartTime:e.target.value}),placeholder:`09:00`,value:_0(n,`waitAllowedStartTime`)})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`waitAllowedEndTime`,children:`Window end`}),(0,X.jsx)(wX,{disabled:i,id:`waitAllowedEndTime`,onChange:e=>r({waitAllowedEndTime:e.target.value}),placeholder:`17:00`,value:_0(n,`waitAllowedEndTime`)})]}),(0,X.jsx)(`p`,{className:`col-span-2 text-muted-foreground text-xs`,children:`Use 24-hour format (HH:MM). Start must be before end. Requires timezone below.`})]}),t[59]=n,t[60]=i,t[61]=m,t[62]=r,t[63]=V):V=t[63];let H=m?` (required for send window)`:` (optional)`,U;t[64]===H?U=t[65]:(U=(0,X.jsxs)(TX,{htmlFor:`waitTimezone`,children:[`Timezone`,H]}),t[64]=H,t[65]=U);let W;t[66]===r?W=t[67]:(W=e=>r({waitTimezone:e}),t[66]=r,t[67]=W);let G;t[68]===n?G=t[69]:(G=v0(n,`waitTimezone`,`UTC`),t[68]=n,t[69]=G);let K;t[70]!==i||t[71]!==W||t[72]!==G?(K=(0,X.jsx)(ahe,{disabled:i,id:`waitTimezone`,onValueChange:W,value:G}),t[70]=i,t[71]=W,t[72]=G,t[73]=K):K=t[73];let q=m&&` Also determines when the daily send window applies.`,J;t[74]===q?J=t[75]:(J=(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Used when the target date/time does not include an offset.`,q]}),t[74]=q,t[75]=J);let ee;t[76]!==U||t[77]!==K||t[78]!==J?(ee=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[U,K,J]}),t[76]=U,t[77]=K,t[78]=J,t[79]=ee):ee=t[79];let te;return t[80]!==w||t[81]!==T||t[82]!==M||t[83]!==B||t[84]!==V||t[85]!==ee?(te=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[_,w,T,M,B,V,ee]}),t[80]=w,t[81]=T,t[82]=M,t[83]=B,t[84]=V,t[85]=ee,t[86]=te):te=t[86],te}function __e(e){return[e,``]}function v_e(e){let t=(0,Z.c)(35),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Wait for Event`}),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=(0,X.jsx)(s_e,{config:n,disabled:i,onUpdateConfig:r}),t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(TX,{htmlFor:`waitTimeout`,children:`Stop waiting after`}),t[5]=s):s=t[5];let c;t[6]===r?c=t[7]:(c=e=>r({waitTimeout:e}),t[6]=r,t[7]=c);let l;t[8]===n?l=t[9]:(l=_0(n,`waitTimeout`),t[8]=n,t[9]=l);let u;t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,X.jsx)(g8,{disabled:i,fieldType:s4.waitTimeout.type,id:`waitTimeout`,onChange:c,placeholder:`7d`,value:l}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13];let d;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Required. A wait with no end holds a run, and a place in the run list, until somebody notices.`}),t[14]=d):d=t[14];let f;t[15]===u?f=t[16]:(f=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,u,d]}),t[15]=u,t[16]=f);let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(TX,{htmlFor:`waitTimeoutBehavior`,children:`On timeout`}),t[17]=p):p=t[17];let m;t[18]===r?m=t[19]:(m=e=>r({waitTimeoutBehavior:e}),t[18]=r,t[19]=m);let h;t[20]===n?h=t[21]:(h=v0(n,`waitTimeoutBehavior`,`continue`),t[20]=n,t[21]=h);let g;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(W6,{className:`w-full`,id:`waitTimeoutBehavior`,children:(0,X.jsx)(U6,{placeholder:`Select timeout behavior`})}),t[22]=g):g=t[22];let _;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`continue`,children:`Continue workflow`}),(0,X.jsx)(K6,{value:`skip`,children:`Skip remaining branch`})]}),t[23]=_):_=t[23];let v;t[24]!==i||t[25]!==m||t[26]!==h?(v=(0,X.jsxs)(V6,{disabled:i,onValueChange:m,value:h,children:[g,_]}),t[24]=i,t[25]=m,t[26]=h,t[27]=v):v=t[27];let y;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Choose whether to continue downstream nodes or halt the branch when the timeout expires.`}),t[28]=y):y=t[28];let b;t[29]===v?b=t[30]:(b=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,v,y]}),t[29]=v,t[30]=b);let x;return t[31]!==b||t[32]!==o||t[33]!==f?(x=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-md border bg-muted/30 p-3`,children:[a,o,f,b]}),t[31]=b,t[32]=o,t[33]=f,t[34]=x):x=t[34],x}function y_e(e){let t=(0,Z.c)(31),{config:n,onUpdateConfig:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=v0(n,`waitMode`,`delay`),t[0]=n,t[1]=a);let o=a,s;t[2]!==n||t[3]!==r?(s=e=>{let t={...n,waitMode:e},i=Object.fromEntries(u4(t).map(b_e));r({...i,waitMode:e,...e===`event`&&!(_0(n,`waitTimeout`)??``).trim()?{waitTimeout:`7d`}:{}})},t[2]=n,t[3]=r,t[4]=s):s=t[4];let c=s,l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,X.jsx)(TX,{htmlFor:`waitMode`,children:`How should this step wait?`}),t[5]=l):l=t[5];let u;t[6]===c?u=t[7]:(u=H6(c),t[6]=c,t[7]=u);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(W6,{className:`w-full`,id:`waitMode`,children:(0,X.jsx)(U6,{placeholder:`Select wait mode`})}),t[8]=d):d=t[8];let f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsxs)(G6,{children:[(0,X.jsx)(K6,{value:`delay`,children:`Wait for time`}),(0,X.jsx)(K6,{value:`event`,children:`Wait for an event`})]}),t[9]=f):f=t[9];let p;t[10]!==i||t[11]!==u||t[12]!==o?(p=(0,X.jsxs)(V6,{disabled:i,onValueChange:u,value:o,children:[d,f]}),t[10]=i,t[11]=u,t[12]=o,t[13]=p):p=t[13];let m;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Resume on a clock, or when an event arrives that this step's match accepts.`}),t[14]=m):m=t[14];let h;t[15]===p?h=t[16]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[l,p,m]}),t[15]=p,t[16]=h);let g;t[17]!==n||t[18]!==i||t[19]!==r||t[20]!==o?(g=o===`delay`&&(0,X.jsx)(g_e,{config:n,disabled:i,onUpdateConfig:r}),t[17]=n,t[18]=i,t[19]=r,t[20]=o,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==i||t[24]!==r||t[25]!==o?(_=o===`event`&&(0,X.jsx)(v_e,{config:n,disabled:i,onUpdateConfig:r}),t[22]=n,t[23]=i,t[24]=r,t[25]=o,t[26]=_):_=t[26];let v;return t[27]!==g||t[28]!==_||t[29]!==h?(v=(0,X.jsxs)(X.Fragment,{children:[h,g,_]}),t[27]=g,t[28]=_,t[29]=h,t[30]=v):v=t[30],v}function b_e(e){return[e,``]}function x_e(e){let t=(0,Z.c)(9),{actionType:n,config:r,onUpdateConfig:i,disabled:a}=e;switch(n){case b1.condition:{let e;return t[0]!==r||t[1]!==a||t[2]!==i?(e=(0,X.jsx)(p_e,{config:r,disabled:a,onUpdateConfig:i}),t[0]=r,t[1]=a,t[2]=i,t[3]=e):e=t[3],e}case b1.eventSplit:{let e;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(m_e,{}),t[4]=e):e=t[4],e}case b1.wait:{let e;return t[5]!==r||t[6]!==a||t[7]!==i?(e=(0,X.jsx)(y_e,{config:r,disabled:a,onUpdateConfig:i}),t[5]=r,t[6]=a,t[7]=i,t[8]=e):e=t[8],e}default:return null}}function S_e(){let e=(0,Z.c)(2),t=yy(),n;if(e[0]!==t){let r=yne(t);n=Object.fromEntries(Object.entries(r).map(C_e)),e[0]=t,e[1]=n}else n=e[1];return n}function C_e(e){let[t,n]=e;return[t,n.map(w_e)]}function w_e(e){return{id:e.id,label:e.label,logoUrl:e.logoUrl,integration:e.integration}}function T_e(e,t){return Py(e,t)?.category??null}function E_e(e){let t=(0,Z.c)(81),{config:n,onUpdateConfig:r,disabled:i,isOwner:a}=e,o=a===void 0||a,s=yy(),c=_0(n,`actionType`),l=S_e(),u;t[0]===l?u=t[1]:(u=Object.keys(l).filter(k_e).toSorted(),t[0]=l,t[1]=u);let d=u,f=c&&T_e(s,c)||``,p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=i0(),t[2]=p):p=t[2];let{data:m}=Xe(p),h;t[3]===m?h=t[4]:(h=m===void 0?[]:m,t[3]=m,t[4]=h);let g=h,{push:_}=RY(),v;t[5]!==l||t[6]!==r?(v=e=>{let t=l[e]?.[0];t&&r({actionType:t.id})},t[5]=l,t[6]=r,t[7]=v):v=t[7];let y=v,b;t[8]===r?b=t[9]:(b=e=>{r({actionType:e})},t[8]=r,t[9]=b);let x=b,S=c?Py(s,c):void 0,C=S?.integration,w;if(t[10]!==g||t[11]!==C){let e;t[13]===C?e=t[14]:(e=e=>e.type===C,t[13]=C,t[14]=e),w=g.some(e),t[10]=g,t[11]=C,t[12]=w}else w=t[12];let T=w,E;t[15]!==C||t[16]!==r||t[17]!==_?(E=()=>{C&&_(C3,{type:C,onSuccess:e=>{r({integrationId:e})}})},t[15]=C,t[16]=r,t[17]=_,t[18]=E):E=t[18];let D=E,O;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,X.jsx)(TX,{className:`ml-1`,htmlFor:`actionCategory`,children:`Service`}),t[19]=O):O=t[19];let k;t[20]===y?k=t[21]:(k=H6(y),t[20]=y,t[21]=k);let A=f||void 0,j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(W6,{className:`w-full`,id:`actionCategory`,children:(0,X.jsx)(U6,{placeholder:`Select category`})}),t[22]=j):j=t[22];let M;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,X.jsx)(K6,{value:`System`,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(dy,{className:`size-4`}),(0,X.jsx)(`span`,{children:`System`})]})}),t[23]=M):M=t[23];let N;t[24]===d.length?N=t[25]:(N=d.length>0&&(0,X.jsx)(wme,{}),t[24]=d.length,t[25]=N);let P;if(t[26]!==l||t[27]!==d){let e;t[29]===l?e=t[30]:(e=e=>{let t=l[e],n=t?.[0]?.integration,r=t?.map(O_e).find(D_e);return(0,X.jsx)(K6,{value:e,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b5,{fallback:n?(0,X.jsx)(b3,{className:`size-4`,integration:n}):(0,X.jsx)(gy,{className:`size-4`}),label:e,logoUrl:r}),(0,X.jsx)(`span`,{children:e})]})},e)},t[29]=l,t[30]=e),P=d.map(e),t[26]=l,t[27]=d,t[28]=P}else P=t[28];let F;t[31]!==N||t[32]!==P?(F=(0,X.jsxs)(G6,{children:[M,N,P]}),t[31]=N,t[32]=P,t[33]=F):F=t[33];let I;t[34]!==i||t[35]!==k||t[36]!==A||t[37]!==F?(I=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[O,(0,X.jsxs)(V6,{disabled:i,onValueChange:k,value:A,children:[j,F]})]}),t[34]=i,t[35]=k,t[36]=A,t[37]=F,t[38]=I):I=t[38];let L;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(TX,{className:`ml-1`,htmlFor:`actionType`,children:`Action`}),t[39]=L):L=t[39];let R=i||!f,z;t[40]===x?z=t[41]:(z=H6(x),t[40]=x,t[41]=z);let B=c||void 0,V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,X.jsx)(W6,{className:`w-full`,id:`actionType`,children:(0,X.jsx)(U6,{placeholder:`Select action`})}),t[42]=V):V=t[42];let H;t[43]!==l||t[44]!==f?(H=f&&l[f]?.map(e=>{let t;return t=f===`System`?(0,X.jsx)(dy,{className:`size-4`}):e.integration?(0,X.jsx)(b3,{className:`size-4`,integration:e.integration}):(0,X.jsx)(gy,{className:`size-4`}),(0,X.jsx)(K6,{value:e.id,children:(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b5,{fallback:t,label:e.label,logoUrl:e.logoUrl}),(0,X.jsx)(`span`,{children:e.label})]})},e.id)}),t[43]=l,t[44]=f,t[45]=H):H=t[45];let U;t[46]===H?U=t[47]:(U=(0,X.jsx)(G6,{children:H}),t[46]=H,t[47]=U);let W;t[48]!==R||t[49]!==z||t[50]!==B||t[51]!==U?(W=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[L,(0,X.jsxs)(V6,{disabled:R,onValueChange:z,value:B,children:[V,U]})]}),t[48]=R,t[49]=z,t[50]=B,t[51]=U,t[52]=W):W=t[52];let G;t[53]!==I||t[54]!==W?(G=(0,X.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[I,W]}),t[53]=I,t[54]=W,t[55]=G):G=t[55];let K;t[56]!==n||t[57]!==i||t[58]!==T||t[59]!==C||t[60]!==o||t[61]!==r||t[62]!==D?(K=C&&o&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`ml-1 flex items-center justify-between`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(TX,{children:`Connection`}),(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[(0,X.jsx)(D8,{render:(0,X.jsx)(`span`,{className:`inline-flex`,children:(0,X.jsx)(Zv,{className:`size-3.5 text-muted-foreground`})}),children:(0,X.jsx)(`span`,{className:`sr-only`,children:`Connection help`})}),(0,X.jsx)(O8,{children:(0,X.jsx)(`p`,{children:`API key or OAuth credentials for this service`})})]})})]}),T&&(0,X.jsx)(zv,{"aria-label":`Add connection`,className:`size-6`,disabled:i,onClick:D,size:`icon`,variant:`ghost`,children:(0,X.jsx)(cy,{className:`size-4`})})]}),(0,X.jsx)(wpe,{disabled:i,integrationType:C,onChange:e=>r({integrationId:e}),value:_0(n,`integrationId`)})]}),t[56]=n,t[57]=i,t[58]=T,t[59]=C,t[60]=o,t[61]=r,t[62]=D,t[63]=K):K=t[63];let q;t[64]===n?q=t[65]:(q=_0(n,`actionType`)??``,t[64]=n,t[65]=q);let J;t[66]!==n||t[67]!==i||t[68]!==r||t[69]!==q?(J=(0,X.jsx)(x_e,{actionType:q,config:n,disabled:i,onUpdateConfig:r}),t[66]=n,t[67]=i,t[68]=r,t[69]=q,t[70]=J):J=t[70];let ee;t[71]!==S||t[72]!==n||t[73]!==i||t[74]!==r?(ee=S&&S.configFields.length>0&&(0,X.jsx)(Vhe,{config:n,disabled:i,fields:S.configFields,onUpdateConfig:r}),t[71]=S,t[72]=n,t[73]=i,t[74]=r,t[75]=ee):ee=t[75];let te;return t[76]!==G||t[77]!==K||t[78]!==J||t[79]!==ee?(te=(0,X.jsxs)(X.Fragment,{children:[G,K,J,ee]}),t[76]=G,t[77]=K,t[78]=J,t[79]=ee,t[80]=te):te=t[80],te}function D_e(e){return typeof e==`string`&&e.trim().length>0}function O_e(e){return e.logoUrl}function k_e(e){return e!==`System`}var x5=Y.createContext(void 0);function S5(e){let t=Y.useContext(x5);if(t===void 0&&!e)throw Error(Gg(33));return t}var C5=Y.createContext(void 0);function w5(e){let t=Y.useContext(C5);if(t===void 0&&!e)throw Error(Gg(36));return t}var A_e=Y.createContext(void 0);function T5(e=!0){let t=Y.useContext(A_e);if(t===void 0&&!e)throw Error(Gg(25));return t}function j_e(e){let{closeOnClick:t,highlighted:n,id:r,nodeId:i,store:a,typingRef:o,itemRef:s,itemMetadata:c}=e,{events:l}=a.useState(`floatingTreeRoot`),u=a.useState(`open`),d=T5(!0),f=d!==void 0;return Y.useMemo(()=>({id:r,role:`menuitem`,tabIndex:u&&n?0:-1,onKeyDown(e){e.key===` `&&o?.current&&e.preventDefault()},onMouseMove(e){i&&l.emit(`itemhover`,{nodeId:i,target:e.currentTarget})},onClick(e){t&&l.emit(`close`,{domEvent:e,reason:fH})},onMouseUp(e){if(d){let t=d.initialCursorPointRef.current;if(d.initialCursorPointRef.current=null,f&&t&&Math.abs(e.clientX-t.x)<=1&&Math.abs(e.clientY-t.y)<=1||f&&!YH&&e.button===2)return}s.current&&a.context.allowMouseUpTriggerRef.current&&(!f||e.button===2)&&c.type===`regular-item`&&Yg(s.current,e,{detail:1})}}),[t,n,r,l,i,u,a,o,s,d,f,c])}var E5={type:`regular-item`};function D5(e){let{closeOnClick:t,disabled:n,highlighted:r,id:i,store:a,typingRef:o=a.context.typingRef,nativeButton:s,itemMetadata:c,nodeId:l}=e,u=Y.useRef(null),{getButtonProps:d,buttonRef:f}=Xg({disabled:n,focusableWhenDisabled:!0,native:s,composite:!0}),p=j_e({closeOnClick:t,highlighted:r,id:i,nodeId:l,store:a,typingRef:o,itemRef:u,itemMetadata:c}),m=Y.useCallback(e=>Fg(p,{onMouseEnter(){c.type===`submenu-trigger`&&c.setActive()}},e,d),[p,d,c]),h=Qg(u,f);return Y.useMemo(()=>({getItemProps:m,itemRef:h}),[m,h])}var O5=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),k5={checked(e){return e?{[O5.checked]:``}:{[O5.unchecked]:``}},...XV},M_e=Y.createContext(void 0),N_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!0,style:l,...u}=e,d=P6({guess:!0,label:a}),f=S5(!0),p=PH(i),{store:m}=w5(),h=m.useState(`disabled`),g=s||h,_=m.useState(`isActive`,d.index),v=m.useState(`itemProps`),{getItemProps:y,itemRef:b}=D5({closeOnClick:c,disabled:g,highlighted:_,id:p,store:m,nativeButton:o,nodeId:f?.context.nodeId,itemMetadata:E5});return o_(`div`,e,{state:{disabled:g,highlighted:_},props:[v,u,y],ref:[b,t,d.ref]})}),A5=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s}=w5(),{side:c,align:l}=S5(),u=D6(!0)!=null,d=s.useState(`open`),f=s.useState(`transitionStatus`),p=s.useState(`popupProps`),m=s.useState(`mounted`),h=s.useState(`instantType`),g=s.useState(`activeTriggerElement`),_=s.useState(`parent`),v=s.useState(`lastOpenChangeReason`),y=s.useState(`rootId`),b=s.useState(`floatingRootContext`),x=s.useState(`floatingTreeRoot`),S=s.useState(`closeDelay`),C=s.useState(`hoverEnabled`),w=s.useState(`disabled`),T=s.useState(`openMethod`),E=_.type===`context-menu`;vq({open:d,ref:s.context.popupRef,onComplete(){d&&s.context.onOpenChangeComplete?.(!0)}}),Y.useEffect(()=>{function e(e){s.setOpen(!1,DH(e.reason,e.domEvent))}return x.events.on(`close`,e),()=>{x.events.off(`close`,e)}},[x.events,s]),$q(b,{enabled:C&&!w&&!E&&_.type!==`menubar`,closeDelay:S});let D=s.useStateSetter(`popupElement`),O=o_(`div`,e,{state:{transitionStatus:f,side:c,align:l,open:d,nested:_.type===`menu`,instant:h},ref:[t,s.context.popupRef,D],stateAttributesMapping:aH,props:[p,{onKeyDown(e){u&&TJ.has(e.key)&&e.stopPropagation()}},S6(f),o,{"data-rootownerid":y}]}),k=_.type===void 0||E;return(g||_.type===`menubar`&&v!==`outside-press`)&&(k=!0),(0,X.jsx)(HG,{context:b,openInteractionType:T,modal:E,disabled:!m,returnFocus:a===void 0?k:a,initialFocus:_.type!==`menu`,restoreFocus:!0,externalTree:_.type===`menubar`?void 0:x,previousFocusableElement:g,nextFocusableElement:_.type===void 0?s.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:_.type===void 0?s.context.beforeContentFocusGuardRef:void 0,children:O})}),j5=Y.createContext(void 0);function P_e(){let e=Y.useContext(j5);if(e===void 0)throw Error(Gg(32));return e}var M5=Y.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=w5();return i.useState(`mounted`)||n?(0,X.jsx)(j5.Provider,{value:n,children:(0,X.jsx)(CG,{ref:t,...r})}):null}),N5=Y.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o,align:s,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=gG,style:g,..._}=e,{store:v}=w5(),y=P_e(),b=T5(!0),x=v.useState(`parent`),S=v.useState(`floatingRootContext`),C=v.useState(`floatingTreeRoot`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`modal`),D=v.useState(`openMethod`),O=v.useState(`activeTriggerElement`),k=v.useState(`transitionStatus`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`adaptiveOrigin`),N=v.useState(`lastOpenChangeReason`),P=v.useState(`floatingNodeId`),F=v.useState(`floatingParentNodeId`),I=S.useState(`domReferenceElement`),L=Y.useRef(null),R=_q(A),z=n,B=c,V=l,H=s,U=h;x.type===`context-menu`&&(z=n??x.context?.anchor,H??=`start`,!o&&H!==`center`&&(V=e.alignOffset??2,B=e.sideOffset??-5));let W=o,G=H;x.type===`menu`?(W??=`inline-end`,G??=`start`,U=e.collisionAvoidance??_G):x.type===`menubar`&&(W??=x.context.orientation===`vertical`?`inline-end`:`bottom`,G??=`start`);let K=x.type===`context-menu`,q=g6({anchor:z,floatingRootContext:S,positionMethod:b?`fixed`:r,mounted:w,side:W,sideOffset:B,align:G,alignOffset:V,arrowPadding:K?0:f,collisionBoundary:u,collisionPadding:d,sticky:p,nodeId:P,keepMounted:y,disableAnchorTracking:m,collisionAvoidance:U,shift:K?{crossAxis:!(`side`in U&&U.side===`flip`),rootBoundary:`layoutViewport`}:void 0,externalTree:C,adaptiveOrigin:M});Y.useEffect(()=>{function e(e){e.open&&(e.parentNodeId===P&&v.set(`hoverEnabled`,!1),e.nodeId!==P&&e.parentNodeId===v.select(`floatingParentNodeId`)&&v.setOpen(!1,DH(CH)))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[v,C.events,P]),Y.useEffect(()=>{if(v.select(`floatingParentNodeId`)==null)return;function e(e){if(e.open||e.nodeId!==v.select(`floatingParentNodeId`))return;let t=e.reason??`sibling-open`;v.setOpen(!1,DH(t))}return C.events.on(`menuopenchange`,e),()=>{C.events.off(`menuopenchange`,e)}},[C.events,v]);let J=zH();Y.useEffect(()=>{T||J.clear()},[T,J]),Y.useEffect(()=>{function e(e){if(!(!T||e.nodeId!==v.select(`floatingParentNodeId`))){if(e.target&&O&&O!==e.target){let e=v.select(`closeDelay`);e>0?J.isStarted()||J.start(e,()=>{v.setOpen(!1,DH(CH))}):v.setOpen(!1,DH(CH))}else J.clear()}}return C.events.on(`itemhover`,e),()=>{C.events.off(`itemhover`,e)}},[C.events,T,O,v,J]),Y.useEffect(()=>{let e={open:T,nodeId:P,parentNodeId:F,reason:v.select(`lastOpenChangeReason`)};C.events.emit(`menuopenchange`,e)},[C.events,T,v,P,F]),Mg(()=>{let e=I,t=L.current;if(e&&(L.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return R(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[I,R,v]);let ee={open:T,side:q.side,align:q.align,anchorHidden:q.anchorHidden,nested:x.type===`menu`,instant:j},te=x.type===`menubar`&&x.context.modal;w6(T&&(te||E&&N!==`trigger-hover`),D===`touch`,A,O);let ne=C6(e,ee,{styles:q.positionerStyles,transitionStatus:k,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!w,inert:!T}),re=w&&x.type!==`menu`&&(x.type!==`menubar`&&E&&N!==`trigger-hover`||x.type===`menubar`&&x.context.modal),ie=null;return x.type===`menubar`?ie=x.context.contentElement:x.type===void 0&&(ie=O),(0,X.jsxs)(x5.Provider,{value:q,children:[re&&(0,X.jsx)(IJ,{ref:x.type===`context-menu`||x.type===`nested-context-menu`?x.context.internalBackdropRef:null,inert:FJ(!T),cutout:ie}),(0,X.jsx)(jG,{id:P,children:(0,X.jsx)(l6,{elementsRef:v.context.itemDomElements,labelsRef:v.context.itemLabels,children:ne})})]})}),P5=Y.createContext(void 0);function F_e(){let e=Y.useContext(P5);if(e===void 0)throw Error(Gg(34));return e}var I_e=Y.memo(Y.forwardRef(function(e,t){let{render:n,className:r,value:i,defaultValue:a,onValueChange:o,disabled:s=!1,style:c,"aria-labelledby":l,...u}=e,[d,f]=Y.useState(void 0),[p,m]=A3({controlled:i,default:a,name:`MenuRadioGroup`}),h=kg((e,t)=>{o?.(e,t),!t.isCanceled&&m(e)}),g=o_(`div`,e,{state:{disabled:s},ref:t,props:{role:`group`,"aria-labelledby":l??d,"aria-disabled":s||void 0,...u}}),_=Y.useMemo(()=>({value:p,setValue:h,disabled:s}),[p,h,s]);return(0,X.jsx)(M_e.Provider,{value:f,children:(0,X.jsx)(P5.Provider,{value:_,children:g})})})),F5=Y.createContext(void 0);function L_e(){let e=Y.useContext(F5);if(e===void 0)throw Error(Gg(35));return e}var R_e=Y.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:s=!1,closeOnClick:c=!1,value:l,style:u,...d}=e,f=P6({guess:!0,label:a}),p=S5(!0),m=PH(i),{store:h}=w5(),g=h.useState(`isActive`,f.index),_=h.useState(`itemProps`),{value:v,setValue:y,disabled:b}=F_e(),x=h.useState(`disabled`),S=s||b||x,C=v===l,{getItemProps:w,itemRef:T}=D5({closeOnClick:c,disabled:S,highlighted:g,id:m,store:h,nativeButton:o,nodeId:p?.context.nodeId,itemMetadata:E5}),E=Y.useMemo(()=>({disabled:S,highlighted:g,checked:C}),[S,g,C]);function D(e){let t=DH(fH,e.nativeEvent,void 0,{preventUnmountOnClose:r_});y(l,t)}let O=o_(`div`,e,{state:E,stateAttributesMapping:k5,props:[_,{role:`menuitemradio`,"aria-checked":C,onClick:D},d,w],ref:[T,t,f.ref]});return(0,X.jsx)(F5.Provider,{value:E,children:O})}),z_e=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=L_e(),c=Y.useRef(null),{transitionStatus:l,mounted:u,setMounted:d}=gq(s.checked);return vq({open:s.checked,ref:c,onComplete(){s.checked||d(!1)}}),o_(`span`,e,{state:{checked:s.checked,disabled:s.disabled,highlighted:s.highlighted,transitionStatus:l},stateAttributesMapping:k5,ref:[t,c],props:{"aria-hidden":!0,...o},enabled:a||u})}),B_e=Y.createContext(null);function I5(e){let t=Y.useContext(B_e);if(t===null&&!e)throw Error(Gg(5));return t}var V_e={...Vq,disabled:e=>e.parent.type===`menubar`&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type===`context-menu`)&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type===`menu`?e.parent.store.select(`rootId`):e.parent.type===void 0?e.rootId:e.parent.context.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type===`menu`?e.parent.store.select(`floatingTreeRoot`):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type===`menu`)return e.parent.store.select(`keyboardEventRelay`)}},H_e=class extends fq{constructor(e){super({...W_e(),...e},U_e(),V_e),this.unsubscribeParentListener=this.observe(`parent`,e=>{if(this.unsubscribeParentListener?.(),e.type===`menu`){let t=e.store.select(`rootId`),n=e.store.select(`floatingTreeRoot`),r=e.store.select(`keyboardEventRelay`);this.unsubscribeParentListener=e.store.subscribe(()=>{let i=e.store.select(`rootId`),a=e.store.select(`floatingTreeRoot`),o=e.store.select(`keyboardEventRelay`);(t!==i||n!==a||r!==o)&&(t=i,n=a,r=o,this.notifyAll())}),this.context.allowMouseUpTriggerRef=e.store.context.allowMouseUpTriggerRef;return}e.type!==void 0&&(this.context.allowMouseUpTriggerRef=e.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(e,t){this.state.floatingRootContext.context.events.emit(`setOpen`,{open:e,eventDetails:t})}unsubscribeParentListener=null};function U_e(){return{positionerRef:Y.createRef(),popupRef:Y.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:Y.createRef(),beforeContentFocusGuardRef:Y.createRef(),onOpenChangeComplete:void 0,triggerElements:new Mq}}function W_e(){return{...Pq(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new TG,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:a_,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}var L5=Y.createContext(void 0);function R5(){return Y.useContext(L5)}var z5=rq(function(e){let{children:t,open:n,onOpenChange:r,onOpenChangeComplete:i,defaultOpen:a=!1,disabled:o=!1,modal:s,loopFocus:c=!0,orientation:l=`vertical`,actionsRef:u,closeParentOnEsc:d=!1,handle:f,triggerId:p,defaultTriggerId:m=null,highlightItemOnHover:h=!0}=e,g=T5(!0),_=w5(!0),v=I5(!0),y=R5(),b=Y.useMemo(()=>y&&_?{type:`menu`,store:_.store}:v?{type:`menubar`,context:v}:g&&!_?{type:`context-menu`,context:g}:{type:void 0},[g,_,v,y]),x=G_e({open:a,openProp:n,activeTriggerId:m,triggerIdProp:p,parent:b});x.useControlledProp(`openProp`,n),x.useControlledProp(`triggerIdProp`,p),x.useContextCallback(`onOpenChangeComplete`,i);let S=NH(),C=NH(),w=x.useState(`floatingTreeRoot`),T=AG(w),E=OG(),D=x.useState(`open`),O=x.useState(`activeTriggerElement`),k=x.useState(`positionerElement`),A=x.useState(`hoverEnabled`),j=x.useState(`disabled`),M=x.useState(`lastOpenChangeReason`),N=x.useState(`parent`),P=x.useState(`activeIndex`),F=x.useState(`payload`),I=x.useState(`floatingParentNodeId`),L=Y.useRef(null),R=Y.useRef(N.type!==`context-menu`),z=zH(),B=Y.useRef(!0),V=zH(),H=I!=null,{openMethod:U,triggerProps:W}=sY(D);x.useSyncedValues({disabled:o,highlightItemOnHover:h,modal:N.type===void 0?s:void 0,openMethod:U,rootId:S}),Oq(x);let{forceUnmount:G}=kq(D,x,()=>{x.set(`allowMouseEnter`,!1)});Mg(()=>{g&&!_?x.update({parent:{type:`context-menu`,context:g},floatingNodeId:T,floatingParentNodeId:E}):_&&x.update({floatingNodeId:T,floatingParentNodeId:E})},[g,_,T,E,x]),Y.useEffect(()=>{if(D||(L.current=null),N.type===`context-menu`){if(!D){z.clear(),R.current=!1;return}z.start(500,()=>{R.current=!0})}},[z,D,N.type]),Mg(()=>{!D&&!A&&x.set(`hoverEnabled`,!0)},[D,A,x]);let K=kg((e,t)=>{let n=t.reason;if(!e&&!x.select(`open`)||D===e&&t.trigger===O&&M===n)return;let i=Tq(t);if(!e&&t.trigger==null&&(t.trigger=O??void 0),r?.(e,t),t.isCanceled)return;x.state.floatingRootContext.dispatchOpenChange(e,t);let a=t.event;if(e===!1&&a?.type===`click`&&a.pointerType===`touch`&&!B.current)return;e&&n===`trigger-focus`?(B.current=!1,V.start(300,()=>{B.current=!0})):(B.current=!0,V.clear());let o=(n===`trigger-press`||n===`item-press`)&&a.detail===0,s=!e&&(n===`escape-key`||n==null),c={open:e,openChangeReason:n};L.current=t.event,wq(c,e,t.trigger,i()),x.update(c),N.type===`menubar`&&(n===`trigger-focus`||n===`focus-out`||n===`trigger-hover`||n===`list-navigation`||n===`sibling-open`)?x.set(`instantType`,`group`):o||s?x.set(`instantType`,o?`click`:`dismiss`):x.set(`instantType`,void 0)}),q=hq({popupStore:x,floatingId:C,nested:E!=null,onOpenChange:K}),J=q.context.events;Mg(()=>{let e=({open:e,eventDetails:t})=>K(e,t);return J.on(`setOpen`,e),()=>{J?.off(`setOpen`,e)}},[J,K]);let ee=Y.useCallback(()=>{x.setOpen(!1,DH(TH))},[x]);Y.useImperativeHandle(u,()=>({unmount:G,close:ee}),[G,ee]);let te;N.type===`context-menu`&&(te=N.context),Y.useImperativeHandle(te?.positionerRef,()=>k,[k]),Y.useImperativeHandle(te?.actionsRef,()=>({setOpen:K}),[K]);let ne=YG(q,{enabled:!j,bubbles:{escapeKey:d&&N.type===`menu`},outsidePress(){return N.type!==`context-menu`||L.current?.type===`contextmenu`||R.current},externalTree:H?w:void 0}),re=d6(),ie=Y.useCallback(e=>{x.select(`activeIndex`)!==e&&x.set(`activeIndex`,e)},[x]),ae=lJ(q,{enabled:!j,listRef:x.context.itemDomElements,activeIndex:P,nested:N.type!==void 0,loopFocus:c,orientation:l,parentOrientation:N.type===`menubar`?N.context.orientation:void 0,rtl:re===`rtl`,disabledIndices:i_,onNavigate:ie,openOnArrowKeyDown:N.type!==`context-menu`,externalTree:H?w:void 0,focusItemOnHover:h}),oe=Y.useCallback(e=>{x.context.typingRef.current=e},[x]),se=uJ(q,{enabled:!j,listRef:x.context.itemLabels,elementsRef:x.context.itemDomElements,activeIndex:P,resetMs:500,onMatch:e=>{D&&e!==P&&x.set(`activeIndex`,e)},onTyping:oe});Aq(x,{floatingRootContext:q,activeTriggerProps:Y.useMemo(()=>{let e=Fg(se.reference,ae.reference,ne.reference,{onMouseMove(){x.set(`allowMouseEnter`,!0)}},W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=D,e},[x,se.reference,ae.reference,ne.reference,W,D]),inactiveTriggerProps:Y.useMemo(()=>{let e=Fg(ae.trigger,ne.trigger,W);return e[`aria-haspopup`]=`menu`,e[`aria-expanded`]=!1,e},[ae.trigger,ne.trigger,W]),popupProps:Y.useMemo(()=>Fg(yq,{id:C,role:`menu`,"aria-labelledby":O?.id,onMouseMove(){x.set(`allowMouseEnter`,!0),N.type===`menu`&&x.set(`hoverEnabled`,!1)},onClick(){x.select(`hoverEnabled`)&&x.set(`hoverEnabled`,!1)},onKeyDown(e){let t=x.select(`keyboardEventRelay`);t&&!e.isPropagationStopped()&&t(e)}},se.floating,ae.floating,ne.floating),[O,C,N.type,x,se.floating,ae.floating,ne.floating]),itemProps:ae.item??a_});let ce=Y.useMemo(()=>({store:x,parent:b}),[x,b]),le=(0,X.jsxs)(C5.Provider,{value:ce,children:[f&&(0,X.jsx)(Sq,{handle:f,store:x}),typeof t==`function`?t({payload:F}):t]});return N.type===void 0||N.type===`context-menu`?(0,X.jsx)(MG,{externalTree:w,children:le}):le});function G_e(e){return Eg(()=>new H_e(e)).current}function K_e(e){let t=w5().store,n=Y.useMemo(()=>({parentMenu:t}),[t]);return(0,X.jsx)(L5.Provider,{value:n,children:(0,X.jsx)(z5,{...e})})}function q_e(e={}){let{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=qg(),{ref:i,index:a}=P6(e),o=n===a,s=Y.useRef(null),c=Qg(i,s);return{compositeProps:{tabIndex:o?0:-1,onFocus(){r(a)},onMouseMove(){let e=s.current;if(!t||!e)return;let n=e.hasAttribute(`disabled`)||e.ariaDisabled===`true`;!o&&!n&&e.focus()}},compositeRef:c,index:a}}function B5(e){let{render:t,className:n,style:r,state:i=a_,props:a=i_,refs:o=i_,metadata:s,stateAttributesMapping:c,tag:l=`div`,...u}=e,{compositeProps:d,compositeRef:f}=q_e({metadata:s});return o_(l,e,{state:i,ref:[f,...o],props:[d,...a,u],stateAttributesMapping:c})}function V5(e){if(ag(e)&&e.hasAttribute(`data-rootownerid`))return e.getAttribute(`data-rootownerid`);if(!_g(e))return V5(bg(e))}function J_e(e,t){let n=Y.useRef(null);function r(t){Xi.flushSync(()=>{e.setOpen(!1,DH(_H,t.nativeEvent,t.currentTarget))}),JW(n.current)?.focus()}function i(n){let r=e.select(`positionerElement`);if(r&&YW(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{Xi.flushSync(()=>{e.setOpen(!1,DH(_H,n.nativeEvent,n.currentTarget))});let i=qW(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&mU(r,i);){let e=i;if(i=WW(i),i===e)break}i?.focus()}}return{preFocusGuardRef:n,handlePreFocusGuardFocus:r,handleFocusTargetFocus:i}}function Y_e(e){let{enabled:t=!0,mouseDownAction:n,open:r}=e,i=Y.useRef(!1);return Y.useMemo(()=>t?{onMouseDown:e=>{(n===`open`&&!r||n===`close`&&r)&&(i.current=!0,Jg(e.currentTarget).addEventListener(`click`,()=>{i.current=!1},{once:!0}))},onClick:e=>{i.current&&(i.current=!1,e.preventBaseUIHandler())}}:a_,[t,n,r])}var X_e=iq(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,openOnHover:c,delay:l=100,closeDelay:u=0,handle:d,payload:f,...p}=e,m=w5(!0),h=Hq(d)??m?.store;if(!h)throw Error(Gg(85));let g=PH(s),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),y=h.useState(`isOpenedByTrigger`,g),b=h.useState(`triggerPopupId`,g),x=Y.useRef(null),S=Q_e(),C=qg(!0),w=kG(),T=Y.useMemo(()=>w??new TG,[w]),{registerTrigger:E,isMountedByThisTrigger:D}=Dq(g,x,h,{payload:f,closeDelay:u,parent:S,floatingTreeRoot:T,floatingNodeId:AG(T),floatingParentNodeId:OG(),keyboardEventRelay:C?.relayKeyboardEvent}),O=S.type===`menubar`,k=h.useState(`disabled`),A=a||k||O&&S.context.disabled,{getButtonProps:j,buttonRef:M}=Xg({disabled:A,native:o});Y.useEffect(()=>{!y&&S.type===void 0&&(h.context.allowMouseUpTriggerRef.current=!1)},[h,y,S.type]);let N=Y.useRef(null),P=zH(),F=kg(e=>{if(!N.current)return;P.clear(),h.context.allowMouseUpTriggerRef.current=!1;let t=e.target;mU(N.current,t)||mU(h.select(`positionerElement`),t)||t===N.current||(t==null||V5(t)!==h.select(`rootId`))&&(s6(e,N.current)||T.events.emit(`close`,{domEvent:e,reason:SH}))});Y.useEffect(()=>{y&&h.select(`lastOpenChangeReason`)===`trigger-hover`&&Jg(N.current).addEventListener(`mouseup`,F,{once:!0})},[y,F,h]);let I=O&&S.context.hasSubmenuOpen,L=tJ(v,{enabled:(c??I)&&!A&&(!O||I&&!D),handleClose:vJ({blockPointerEvents:!O}),mouseOnly:!0,move:!1,restMs:S.type===void 0?l:void 0,delay:{close:u},triggerElementRef:x,externalTree:T,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),R=Z_e(y,h.select(`lastOpenChangeReason`)),z=UG(v,{enabled:!A,event:y&&O?`click`:`mousedown`,toggle:!0,ignoreMouse:!1,stickIfOpen:S.type===void 0&&R}),B=qq(v,{enabled:!A&&I}),V=Y_e({open:y,enabled:O,mouseDownAction:`open`}),H=Y.useMemo(()=>Fg(B.reference,z.reference),[B.reference,z.reference]),U=h.useState(`triggerProps`,D),{preFocusGuardRef:W,handlePreFocusGuardFocus:G,handleFocusTargetFocus:K}=J_e(h,x),q={disabled:A,open:y},J=[N,t,M,E,x],ee=[H,L??a_,U,{"aria-haspopup":`menu`,"aria-controls":b,id:g,onMouseDown:e=>{h.select(`open`)||(P.start(200,()=>{h.context.allowMouseUpTriggerRef.current=!0}),Jg(e.currentTarget).addEventListener(`mouseup`,F,{once:!0}))}},O?{role:`menuitem`}:{},V,p,j],te=o_(`button`,e,{enabled:!O,stateAttributesMapping:rH,state:q,ref:J,props:ee});return O?(0,X.jsx)(B5,{tag:`button`,render:n,className:r,style:i,state:q,refs:J,props:ee,stateAttributesMapping:rH}):y?(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(WU,{ref:W,onFocus:G},`${g}-pre-focus-guard`),(0,X.jsx)(Y.Fragment,{children:te},g),(0,X.jsx)(WU,{ref:h.context.triggerFocusTargetRef,onFocus:K},`${g}-post-focus-guard`)]}):(0,X.jsx)(Y.Fragment,{children:te},g)});function Z_e(e,t){let n=zH(),[r,i]=Y.useState(!1);return Mg(()=>{e&&t===`trigger-hover`?(i(!0),n.start(500,()=>{i(!1)})):e||(n.clear(),i(!1))},[e,t,n]),r}function Q_e(){let e=I5(!0);return Y.useMemo(()=>e?{type:`menubar`,context:e}:{type:void 0},[e])}var $_e=Y.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return o_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})}),eve={"aria-expanded":void 0},tve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,label:a,id:o,nativeButton:s=!1,openOnHover:c=!0,delay:l=100,closeDelay:u=0,disabled:d=!1,...f}=e,p=R5();if(!p?.parentMenu)throw Error(Gg(37));let m=P6({guess:!0,label:a}),h=S5(),{store:g}=w5(),_=PH(o),v=g.useState(`open`),y=g.useState(`floatingRootContext`),b=g.useState(`floatingTreeRoot`),x=g.useState(`triggerPopupId`,_),S=Cq(_,g),C=Y.useCallback(e=>{let t=S(e);return e!==null&&g.select(`open`)&&g.select(`activeTriggerId`)==null&&g.update({activeTriggerId:_,activeTriggerElement:e,closeDelay:u}),t},[S,u,g,_]),w=Y.useRef(null),T=Y.useCallback(e=>{w.current=e,g.set(`activeTriggerElement`,e)},[g]);g.useSyncedValue(`closeDelay`,u);let E=p.parentMenu,D=g.useState(`disabled`),O=E.useState(`disabled`),k=d||D||O,A=E.useState(`itemProps`),j=E.useState(`isActive`,m.index),M=Y.useMemo(()=>({type:`submenu-trigger`,setActive(){E.select(`highlightItemOnHover`)&&E.set(`activeIndex`,m.index)}}),[E,m.index]),{getItemProps:N,itemRef:P}=D5({closeOnClick:!1,disabled:k,highlighted:j,id:_,store:g,typingRef:E.context.typingRef,nativeButton:s,itemMetadata:M,nodeId:h?.context.nodeId}),F=tJ(y,{enabled:g.useState(`hoverEnabled`)&&c&&!k,handleClose:vJ({blockPointerEvents:!0}),mouseOnly:!0,move:!0,restMs:l,delay:{open:l,close:u},shouldOpen:l>0?()=>E.select(`allowMouseEnter`):void 0,triggerElementRef:w,externalTree:b,isClosing:()=>g.select(`transitionStatus`)===`ending`,guardStaleOpen:!0}),I=UG(y,{enabled:!k,event:`mousedown`,toggle:!c,ignoreMouse:c,stickIfOpen:!1}).reference??a_,L=g.useState(`triggerProps`,!0);delete L.id;let R={disabled:k,highlighted:j,open:v},z=g.useState(`openMethod`),B=g.useState(`lastOpenChangeReason`)===`list-navigation`||z===`keyboard`;return o_(`div`,e,{state:R,stateAttributesMapping:nH,props:[I,F,L,A,v&&B&&$H?eve:void 0,{"aria-controls":x,tabIndex:v||j?0:-1,onBlur(){j&&E.set(`activeIndex`,null)}},f,N],ref:[t,m.ref,P,C,T]})});function H5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(z5,{"data-slot":`dropdown-menu`,...n}),t[2]=n,t[3]=r),r}function U5(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(X_e,{"data-slot":`dropdown-menu-trigger`,...n}),t[2]=n,t[3]=r),r}function W5(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--available-height) min-w-[8rem] origin-(--transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(A5,{className:s,"data-slot":`dropdown-menu-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(M5,{children:(0,X.jsx)(N5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function G5(e){let t=(0,Z.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,inset:r,variant:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`default`:a,s;t[5]===n?s=t[6]:(s=Q(`data-[variant=destructive]:*:[svg]:!text-destructive relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[variant=destructive]:data-[highlighted]:bg-destructive/10 data-[variant=destructive]:data-[highlighted]:text-destructive data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[variant=destructive]:text-destructive data-[disabled]:opacity-50 dark:data-[variant=destructive]:data-[highlighted]:bg-destructive/20 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,n),t[5]=n,t[6]=s);let c;return t[7]!==r||t[8]!==i||t[9]!==s||t[10]!==o?(c=(0,X.jsx)(N_e,{className:s,"data-inset":r,"data-slot":`dropdown-menu-item`,"data-variant":o,...i}),t[7]=r,t[8]=i,t[9]=s,t[10]=o,t[11]=c):c=t[11],c}function nve(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(I_e,{"data-slot":`dropdown-menu-radio-group`,...n}),t[2]=n,t[3]=r),r}function K5(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=Q(`relative flex cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden data-[disabled]:pointer-events-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,X.jsx)(z_e,{children:(0,X.jsx)(Qv,{className:`size-2 fill-current`})})}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,X.jsxs)(R_e,{className:a,"data-slot":`dropdown-menu-radio-item`,...i,children:[o,n]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function q5(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`-mx-1 my-1 h-px bg-border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)($_e,{className:i,"data-slot":`dropdown-menu-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function rve(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(K_e,{"data-slot":`dropdown-menu-sub`,...n}),t[2]=n,t[3]=r),r}function ive(e){let t=(0,Z.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,inset:i,children:n,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o;t[5]===r?o=t[6]:(o=Q(`flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[highlighted]:bg-accent data-[popup-open]:bg-accent data-[inset]:pl-8 data-[highlighted]:text-accent-foreground data-[popup-open]:text-accent-foreground [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[5]=r,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(Xv,{className:`ml-auto size-4`}),t[7]=s):s=t[7];let c;return t[8]!==n||t[9]!==i||t[10]!==a||t[11]!==o?(c=(0,X.jsxs)(tve,{className:o,"data-inset":i,"data-slot":`dropdown-menu-sub-trigger`,...a,children:[n,s]}),t[8]=n,t[9]=i,t[10]=a,t[11]=o,t[12]=c):c=t[12],c}function ave(e){let t=(0,Z.c)(14),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,children:n,sideOffset:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?4:a,s;t[5]===r?s=t[6]:(s=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[closed]:animate-out data-[open]:animate-in`,r),t[5]=r,t[6]=s);let c;t[7]!==n||t[8]!==s?(c=(0,X.jsx)(A5,{className:s,"data-slot":`dropdown-menu-sub-content`,children:n}),t[7]=n,t[8]=s,t[9]=c):c=t[9];let l;return t[10]!==i||t[11]!==o||t[12]!==c?(l=(0,X.jsx)(M5,{children:(0,X.jsx)(N5,{className:`z-50`,sideOffset:o,...i,children:c})}),t[10]=i,t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function ove(){return`ontouchstart`in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function sve(){return yy().actions}function cve(e){let t=(0,Z.c)(4),{group:n}=e,r=n.actions[0];if(r?.integration){let e;return t[0]===r.integration?e=t[1]:(e=(0,X.jsx)(b3,{className:`size-4`,integration:r.integration}),t[0]=r.integration,t[1]=e),e}if(n.category===`System`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(dy,{className:`size-4`}),t[2]=e):e=t[2],e}let i;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(gy,{className:`size-4`}),t[3]=i):i=t[3],i}function lve(e){let t=(0,Z.c)(11),{action:n,className:r}=e;if(n.integration){let e;return t[0]!==n.integration||t[1]!==r?(e=(0,X.jsx)(b3,{className:r,integration:n.integration}),t[0]=n.integration,t[1]=r,t[2]=e):e=t[2],e}if(n.category===`System`){let e;t[3]===r?e=t[4]:(e=Q(r,`text-muted-foreground`),t[3]=r,t[4]=e);let n;return t[5]===e?n=t[6]:(n=(0,X.jsx)(dy,{className:e}),t[5]=e,t[6]=n),n}let i;t[7]===r?i=t[8]:(i=Q(r,`text-muted-foreground`),t[7]=r,t[8]=i);let a;return t[9]===i?a=t[10]:(a=(0,X.jsx)(gy,{className:i}),t[9]=i,t[10]=a),a}var J5=`workflow-action-grid-hidden-groups`,Y5=`workflow-action-grid-view-mode`;function uve(){if(typeof window>`u`)return new Set;try{let e=localStorage.getItem(J5);return e?new Set(JSON.parse(e)):new Set}catch{return new Set}}function dve(){if(typeof window>`u`)return`list`;try{return localStorage.getItem(Y5)===`grid`?`grid`:`list`}catch{return`list`}}function fve(e){let t=(0,Z.c)(72),{onSelectAction:n,disabled:r,isNewlyCreated:i}=e,[a,o]=(0,Y.useState)(``),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=new Set,t[0]=s):s=t[0];let[c,l]=(0,Y.useState)(s),[u,d]=(0,Y.useState)(uve),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(dve),g=sve(),_;t[1]===m?_=t[2]:(_=()=>{let e=m===`list`?`grid`:`list`;h(e),localStorage.setItem(Y5,e)},t[1]=m,t[2]=_);let v=_,y;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{l(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[3]=y):y=t[3];let b=y,x;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{d(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),localStorage.setItem(J5,JSON.stringify([...n])),n})},t[4]=x):x=t[4];let S=x,C;if(t[5]!==g||t[6]!==a){let e;t[8]===a?e=t[9]:(e=e=>{let t=a.toLowerCase();return e.label.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.category.toLowerCase().includes(t)},t[8]=a,t[9]=e),C=g.filter(e),t[5]=g,t[6]=a,t[7]=C}else C=t[7];let w=C,T;if(t[10]!==w){let e={};for(let t of w){let n=t.category;e[n]||(e[n]=[]),e[n].push(t)}T=Object.keys(e).toSorted(pve).map(t=>({category:t,actions:e[t]})),t[10]=w,t[11]=T}else T=t[11];let E=T,D;bb0:{if(f){D=E;break bb0}let e;if(t[12]!==E||t[13]!==u){let n;t[15]===u?n=t[16]:(n=e=>!u.has(e.category),t[15]=u,t[16]=n),e=E.filter(n),t[12]=E,t[13]=u,t[14]=e}else e=t[14];D=e}let O=D,k=u.size,A;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[17]=A):A=t[17];let j;t[18]===i?j=t[19]:(j=i===!0&&!ove(),t[18]=i,t[19]=j);let M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>o(e.target.value),t[20]=M):M=t[20];let N;t[21]!==r||t[22]!==a||t[23]!==j?(N=(0,X.jsxs)(`div`,{className:`relative flex-1`,children:[A,(0,X.jsx)(wX,{autoFocus:j,className:`pl-9`,"data-testid":`action-search-input`,disabled:r,id:`action-filter`,onChange:M,placeholder:`Search actions...`,value:a})]}),t[21]=r,t[22]=a,t[23]=j,t[24]=N):N=t[24];let P;t[25]===v?P=t[26]:(P=(0,X.jsx)(zv,{className:`shrink-0`,onClick:v,size:`icon`,variant:`ghost`}),t[25]=v,t[26]=P);let F;t[27]===m?F=t[28]:(F=m===`list`?(0,X.jsx)(pte,{className:`size-4`}):(0,X.jsx)(vte,{className:`size-4`}),t[27]=m,t[28]=F);let I;t[29]!==P||t[30]!==F?(I=(0,X.jsx)(D8,{render:P,children:F}),t[29]=P,t[30]=F,t[31]=I):I=t[31];let L=m===`list`?`Grid view`:`List view`,R;t[32]===L?R=t[33]:(R=(0,X.jsx)(O8,{children:L}),t[32]=L,t[33]=R);let z;t[34]!==I||t[35]!==R?(z=(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[I,R]})}),t[34]=I,t[35]=R,t[36]=z):z=t[36];let B;t[37]!==k||t[38]!==f?(B=k>0&&(0,X.jsx)(T8,{children:(0,X.jsxs)(E8,{children:[(0,X.jsx)(D8,{render:(0,X.jsx)(zv,{className:Q(`shrink-0`,f&&`bg-muted`),onClick:()=>p(!f),size:`icon`,variant:`ghost`}),children:f?(0,X.jsx)(ry,{className:`size-4`}):(0,X.jsx)(ny,{className:`size-4`})}),(0,X.jsx)(O8,{children:f?`Hide hidden groups`:`Show ${k} hidden group${k>1?`s`:``}`})]})}),t[37]=k,t[38]=f,t[39]=B):B=t[39];let V;t[40]!==N||t[41]!==z||t[42]!==B?(V=(0,X.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[N,z,B]}),t[40]=N,t[41]=z,t[42]=B,t[43]=V):V=t[43];let H;t[44]===w.length?H=t[45]:(H=w.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`No actions found`}),t[44]=w.length,t[45]=H);let U;t[46]!==w.length||t[47]!==O?(U=w.length>0&&O.length===0&&(0,X.jsx)(`p`,{className:`py-4 text-center text-muted-foreground text-sm`,children:`All groups are hidden`}),t[46]=w.length,t[47]=O,t[48]=U):U=t[48];let W;t[49]!==r||t[50]!==w||t[51]!==u||t[52]!==n||t[53]!==f||t[54]!==m||t[55]!==O?(W=m===`grid`&&O.length>0&&(0,X.jsx)(`div`,{className:`grid gap-2 p-1`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(72px, 1fr))`},children:w.filter(e=>f||!u.has(e.category)).map(e=>(0,X.jsxs)(`button`,{className:Q(`flex aspect-square flex-col items-center justify-center gap-1.5 rounded-lg border border-transparent p-2 text-center transition-colors hover:border-border hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:[(0,X.jsx)(lve,{action:e,className:`size-6`}),(0,X.jsx)(`span`,{className:`line-clamp-2 font-medium text-xs leading-tight`,children:e.label})]},e.id))}),t[49]=r,t[50]=w,t[51]=u,t[52]=n,t[53]=f,t[54]=m,t[55]=O,t[56]=W):W=t[56];let G;t[57]!==c||t[58]!==r||t[59]!==u||t[60]!==n||t[61]!==m||t[62]!==O?(G=m===`list`&&O.length>0&&O.map((e,t)=>{let i=c.has(e.category),a=u.has(e.category);return(0,X.jsxs)(`div`,{children:[t>0&&(0,X.jsx)(`div`,{className:`my-2 h-px bg-border`}),(0,X.jsxs)(`div`,{className:Q(`sticky top-0 z-10 mb-1 flex items-center gap-2 bg-background px-3 py-2 font-medium text-muted-foreground text-xs uppercase tracking-wider`,a&&`opacity-50`),children:[(0,X.jsxs)(`button`,{className:`flex flex-1 items-center gap-2 text-left hover:text-foreground`,onClick:()=>b(e.category),type:`button`,children:[(0,X.jsx)(Xv,{className:Q(`size-3.5 transition-transform`,!i&&`rotate-90`)}),(0,X.jsx)(cve,{group:e}),e.category]}),(0,X.jsxs)(H5,{children:[(0,X.jsx)(U5,{render:(0,X.jsx)(`button`,{className:`rounded p-0.5 hover:bg-muted hover:text-foreground`,type:`button`}),children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsx)(W5,{align:`end`,children:(0,X.jsx)(G5,{onClick:()=>S(e.category),children:a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Show group`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Hide group`]})})})]})]}),!i&&e.actions.map(e=>(0,X.jsx)(`button`,{className:Q(`flex w-full items-center rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted`,r&&`pointer-events-none opacity-50`),"data-testid":`action-option-${e.id.toLowerCase().replace(/\s+/g,`-`)}`,disabled:r,onClick:()=>n(e.id),type:`button`,children:(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.label}),e.description&&(0,X.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[` `,`- `,e.description]})]})},e.id))]},e.category)}),t[57]=c,t[58]=r,t[59]=u,t[60]=n,t[61]=m,t[62]=O,t[63]=G):G=t[63];let K;t[64]!==H||t[65]!==U||t[66]!==W||t[67]!==G?(K=(0,X.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pb-4`,"data-testid":`action-grid`,children:[H,U,W,G]}),t[64]=H,t[65]=U,t[66]=W,t[67]=G,t[68]=K):K=t[68];let q;return t[69]!==V||t[70]!==K?(q=(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[V,K]}),t[69]=V,t[70]=K,t[71]=q):q=t[71],q}function pve(e,t){return e===`System`?-1:t===`System`?1:e.localeCompare(t)}function mve(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function X5(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...F3}}var hve=Y.createContext({disabled:!1});function Z5(){return Y.useContext(hve)}function Q5(e,t,n,r=!0,i){let[a,o]=Y.useState(),s=PH(i?`${i}-label`:void 0),c=e??t??a;return Mg(()=>{let i=e||t||!r?void 0:gve(n.current,s);a!==i&&o(i)}),c}function gve(e,t){let n=_ve(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function _ve(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}var vve=Y.createContext(void 0);function yve(){return Y.useContext(vve)}var $5=Y.createContext(void 0);function bve(){let e=Y.useContext($5);if(e===void 0)throw Error(Gg(14));return e}var xve=`data-parent`,Sve=Y.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i=!1,"aria-labelledby":a,disabled:o=!1,form:s,id:c,indeterminate:l=!1,inputRef:u,name:d,onCheckedChange:f,parent:p=!1,readOnly:m=!1,render:h,required:g=!1,uncheckedValue:_,value:v,nativeButton:y=!1,style:b,...x}=e,{clearErrors:S}=e6(),{disabled:C,name:w,setDirty:T,setFilled:E,setFocused:D,setTouched:O,state:k,validationMode:A,validityData:j,validation:M}=R3(),N=Z5(),{labelId:P,controlId:F,registerControlId:I,getDescriptionProps:L}=B3(),R=yve(),z=R?.allValues===void 0?void 0:R.parent,B=z!==void 0,V=C||N.disabled||R?.disabled||o,H=w??d,U=v??H,W=PH(),G=PH(),K=c||F;B&&(p?K=G:U===void 0?K||=G:K=`${z.id}-${U}`);let q={};B&&(p?q=z.getParentProps():U!==void 0&&(q=z.getChildProps(U)));let{checked:J=n,indeterminate:ee=l,onCheckedChange:te,...ne}=q,re=R?.value,ie=Y.useRef(null),ae=Eg(()=>Symbol()),oe=Y.useRef(!1),{getButtonProps:se,buttonRef:ce}=Xg({disabled:V,native:y}),le=R?.validation??M,[ue,de]=A3({controlled:U!==void 0&&re!==void 0&&!p?re.includes(U):J,default:i,name:`Checkbox`,state:`checked`}),fe=B?!!J:ue,pe=B&&ee||l;Mg(()=>{I!==r_&&(oe.current=!0,I(ae.current,K))},[K,I,ae]),Y.useEffect(()=>{let e=ae.current;return()=>{!oe.current||I===r_||(oe.current=!1,I(e,void 0))}},[I,ae]),z3(ie,W,ue,void 0,!R&&!V,d);let me=Y.useRef(null),he=le.registerInput,ge=R?U:void 0,_e=Y.useCallback(e=>he(e,{controlRef:ie,value:ge}),[he,ge]),ve=Qg(u,me,p?void 0:_e),ye=Q5(a,P,me,!y,K??void 0);Mg(()=>{me.current&&(me.current.indeterminate=pe,ue&&E(!0))},[ue,pe,E]),aY(ue,()=>{R||(S(H),E(ue),T(ue!==j.initialValue),le.change(ue))});let be=Fg({checked:ue,disabled:V,form:s,name:p?void 0:H,id:y?void 0:K??void 0,required:g,ref:ve,style:H?UU:HU,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(m){e.preventDefault();return}let t=e.currentTarget.checked,n=DH(sH,e.nativeEvent);if(f?.(t,n),!n.isCanceled&&(te?.(t,n),!n.isCanceled&&(de(t),U!==void 0&&R!==void 0&&!p&&!B))){let e=t?[...R.value,U]:R.value.filter(e=>e!==U);R.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){ie.current?.focus()}},v===void 0?a_:{value:(R?ue&&v:v)||``},L,e=>le.getValidationProps(V,e));Y.useEffect(()=>{if(!z||U===void 0)return;let e=z.disabledStatesRef.current;return e.set(U,V),()=>{e.delete(U)}},[z,V,U]);let xe=Y.useMemo(()=>({...k,checked:fe,disabled:V,readOnly:m,required:g,indeterminate:pe}),[k,fe,V,m,g,pe]),Se=X5(xe),Ce=o_(`span`,e,{state:xe,ref:[ce,ie,t],props:[{id:y?K??void 0:W,role:`checkbox`,"aria-checked":pe?`mixed`:fe,"aria-readonly":m||void 0,"aria-required":g||void 0,"aria-labelledby":ye,[xve]:p?``:void 0,onFocus(){V||D(!0)},onBlur(){let e=me.current;e&&(O(!0),D(!1),A===`onBlur`&&le.commit(R?re:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=me.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),tg(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||mve(t)?.click()})},onClick(e){if(m||V)return;e.preventDefault();let t=me.current;t&&Yg(t,e)}},x,ne,se,L,e=>le.getValidationProps(V,e)],stateAttributesMapping:Se});return(0,X.jsxs)($5.Provider,{value:xe,children:[Ce,!ue&&!R&&H&&!p&&_!==void 0&&(0,X.jsx)(`input`,{type:`hidden`,form:s,name:H,value:_,disabled:V}),(0,X.jsx)(`input`,{...be,suppressHydrationWarning:!0})]})}),Cve=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=bve(),c=s.checked||s.indeterminate,{mounted:l,transitionStatus:u,setMounted:d}=gq(c),f=Y.useRef(null),p={...s,transitionStatus:u};vq({open:c,ref:f,onComplete(){c||d(!1)}});let m={...X5(s),...XV},h=a||l,g=o_(`span`,e,{ref:[t,f],state:p,stateAttributesMapping:m,props:o});return h?g:null});function e7(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`peer inline-grid size-4 shrink-0 place-content-center rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[disabled]:cursor-not-allowed data-[checked]:border-primary data-[invalid]:border-destructive data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:opacity-50 data-[invalid]:ring-destructive/20 dark:bg-input/30 dark:data-[checked]:bg-primary dark:data-[invalid]:ring-destructive/40`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Cve,{className:`grid place-content-center text-current transition-none`,"data-slot":`checkbox-indicator`,children:(0,X.jsx)(qv,{className:`size-3.5`})}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Sve,{className:i,"data-slot":`checkbox`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}var t7={checked(e){return e?{"data-checked":``}:{"data-unchecked":``}},...XV,...F3},wve=`data-composite-item-active`,n7=Y.createContext(void 0);function Tve(){return Y.useContext(n7)}var r7=Y.createContext(void 0);function Eve(){let e=Y.useContext(r7);if(e===void 0)throw Error(Gg(52));return e}var Dve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,readOnly:a=!1,required:o=!1,"aria-labelledby":s,value:c,inputRef:l,nativeButton:u=!1,id:d,style:f,...p}=e,m=Tve(),{disabled:h,readOnly:g,required:_,form:v,checkedValue:y,touched:b=!1,validation:x,name:S,setCheckedValue:C=r_,setTouched:w=r_,registerInputRef:T=r_}=m??{},{setTouched:E,setFilled:D,state:O,disabled:k}=R3(),A=Z5(),{labelId:j,getDescriptionProps:M}=B3(),N=k||A.disabled||h||i,P=g||a,F=_||o,I=v,L=m?y===c:c===``,R=Y.useRef(null),z=Y.useRef(null),B=x?.registerInput,V=Qg(l,z,T,Y.useCallback(e=>B?.(e,{controlRef:R,value:void 0}),[B]));Mg(()=>{z.current?.checked&&D(!0)},[D]),Mg(()=>{if(z.current){if(N&&L){T(null);return}T(z.current)}},[L,N,T]);let H=PH(),U=V3({id:d,implicit:!1,controlRef:R}),W=u?void 0:U,G={role:`radio`,"aria-checked":L,"aria-labelledby":Q5(s,j,z,!u,W),[wve]:L?``:void 0,id:u?U:H,onKeyDown(e){e.key===`Enter`&&e.preventDefault()},onClick(e){if(e.defaultPrevented||N||P)return;e.preventDefault();let t=z.current;t&&Yg(t,e)},onFocus(e){e.defaultPrevented||N||P||!b||(z.current?.click(),w(!1))}},{getButtonProps:K,buttonRef:q}=Xg({disabled:N,native:u,composite:!1}),J={type:`radio`,ref:V,form:I,id:W,name:S,tabIndex:-1,style:S?UU:HU,"aria-hidden":!0,...c===void 0?a_:{value:q3(c)},disabled:N,checked:L,required:F,readOnly:P,onChange(e){if(e.nativeEvent.defaultPrevented||N||P||c===void 0)return;let t=DH(sH,e.nativeEvent);C(c,t),!t.isCanceled&&E(!0)},onClick(e){e.stopPropagation()},onFocus(){R.current?.focus()}},ee=Y.useMemo(()=>({...O,required:F,disabled:N,readOnly:P,checked:L}),[O,N,P,L,F]),te=ee,ne=m!==void 0,re=[t,R,q],ie=[G,p,K,M,x?e=>x.getValidationProps(N,e):a_],ae=o_(`span`,e,{enabled:!ne,state:ee,ref:re,props:ie,stateAttributesMapping:t7});return(0,X.jsxs)(r7.Provider,{value:te,children:[ne?(0,X.jsx)(B5,{tag:`span`,render:n,className:r,style:f,state:ee,refs:re,props:ie,stateAttributesMapping:t7}):ae,(0,X.jsx)(`input`,{...J,suppressHydrationWarning:!0})]})}),Ove=Y.forwardRef(function(e,t){let{render:n,className:r,style:i,keepMounted:a=!1,...o}=e,s=Eve(),c=s.checked,{mounted:l,transitionStatus:u,setMounted:d}=gq(c),f={...s,transitionStatus:u},p=Y.useRef(null),m=a||l,h=o_(`span`,e,{ref:[t,p],state:f,props:o,stateAttributesMapping:t7});return vq({open:c,ref:p,onComplete(){c||d(!1)}}),m?h:null}),kve=[];function Ave(e){let{loopFocus:t=!0,orientation:n=`both`,grid:r,onLoop:i,direction:a,highlightedIndex:o,onHighlightedIndexChange:s,rootRef:c,enableHomeAndEndKeys:l=!1,stopEventPropagation:u,disabledIndices:d,modifierKeys:f=kve}=e,[p,m]=Y.useState(0),h=r!=null,g=Y.useRef(null),_=Qg(g,c),v=Y.useRef([]),y=Y.useRef(!1),b=o??p,x=kg((e,t=!1)=>{if((s??m)(e),t){let t=v.current[e];AJ(g.current,t,a,n)}}),S=kg(e=>{if(e.size===0||y.current)return;y.current=!0;let t=Array.from(e.keys()),r=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=r?e.get(r)?.index??-1:-1;if(i!==-1)x(i);else if(wW(t,b,d)){let e=SW(t,{disabledIndices:d});yW(t,e)||x(e)}AJ(g.current,r,a,n)});Mg(()=>{if(d==null||o!=null||!y.current)return;let e=v.current;if(wW(e,b,d)){let t=SW(e,{disabledIndices:d});yW(e,t)||x(t)}},[d,o,b,v,x]);let C=kg((e,t,n)=>i?i(e,t,n,v):n),w=kg(e=>{let o=e.key===`Home`||e.key===`End`;if(!TJ.has(e.key)||!l&&o||jve(e,f)||!g.current)return;let s=a===`rtl`,c=s?CJ:wJ,p=s?wJ:CJ,m=n===`vertical`?SJ:c,_=n===`vertical`?xJ:p,y=hU(e.nativeEvent);if(y!=null&&kJ(y)&&!k3(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==_&&t<r.length||e.key!==m&&t>0)return}let S=b,w=bW(v,d),T=xW(v,d);r!=null&&(S=r({disabledIndices:d,elementsRef:v,event:e,highlightedIndex:b,loopFocus:t,maxIndex:T,minIndex:w,onLoop:C,orientation:n,rtl:s}));let E=n!==`vertical`&&e.key===c||n!==`horizontal`&&e.key===`ArrowDown`,D=n!==`vertical`&&e.key===p||n!==`horizontal`&&e.key===`ArrowUp`;l&&(e.key===`Home`?S=w:e.key===`End`&&(S=T)),S===b&&(E||D)&&(t&&S===T&&E?(S=w,i&&(S=i(e,b,S,v))):t&&S===w&&D?(S=T,i&&(S=i(e,b,S,v))):S=SW(v.current,{startingIndex:S,decrement:D,disabledIndices:d})),S!==b&&!yW(v.current,S)&&(u&&e.stopPropagation(),(h||o||E||D)&&e.preventDefault(),x(S,!0),queueMicrotask(()=>{v.current[S]?.focus()}))});return{props:{ref:_,onFocus(e){let t=g.current,n=hU(e.nativeEvent);!t||n==null||!kJ(n)||n.setSelectionRange(0,n.value.length)},onKeyDown:w},highlightedIndex:b,onHighlightedIndexChange:x,elementsRef:v,onMapChange:S,relayKeyboardEvent:w}}function jve(e,t){for(let n of DJ)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Mve(e){let{render:t,className:n,style:r,refs:i=i_,props:a=i_,state:o=a_,stateAttributesMapping:s,highlightedIndex:c,onHighlightedIndexChange:l,orientation:u,grid:d,loopFocus:f,onLoop:p,enableHomeAndEndKeys:m,onMapChange:h,stopEventPropagation:g=!0,rootRef:_,disabledIndices:v,modifierKeys:y,highlightItemOnHover:b=!1,tag:x=`div`,...S}=e,{props:C,highlightedIndex:w,onHighlightedIndexChange:T,elementsRef:E,onMapChange:D,relayKeyboardEvent:O}=Ave({grid:d,loopFocus:f,onLoop:p,orientation:u,highlightedIndex:c,onHighlightedIndexChange:l,rootRef:_,stopEventPropagation:g,enableHomeAndEndKeys:m,direction:d6(),disabledIndices:v,modifierKeys:y}),k=o_(x,e,{state:o,ref:i,props:[C,...a,S],stateAttributesMapping:s}),A=Y.useMemo(()=>({highlightedIndex:w,onHighlightedIndexChange:T,highlightItemOnHover:b,relayKeyboardEvent:O}),[w,T,b,O]);return(0,X.jsx)(Kg.Provider,{value:A,children:(0,X.jsx)(l6,{elementsRef:E,onMapChange:e=>{h?.(e),D(e)},children:k})})}Object.keys(N3);function Nve(e,t){return e.matches(`:disabled`)?!1:!t||e.form===t||e.form===null&&!e.hasAttribute(`form`)}var Pve=Y.createContext(void 0);function Fve(e=!1){let t=Y.useContext(Pve);if(!t&&!e)throw Error(Gg(86));return t}var Ive=[EJ],Lve=Y.forwardRef(function(e,t){let{render:n,className:r,disabled:i,readOnly:a,required:o,onValueChange:s,value:c,defaultValue:l,form:u,name:d,inputRef:f,id:p,style:m,...h}=e,{setTouched:g,setFocused:_,validationMode:v,name:y,disabled:b,state:x,validation:S,setDirty:C,setFilled:w,validityData:T}=R3(),{labelId:E}=B3(),{clearErrors:D,elementRef:O}=e6(),k=Fve(!0),A=b||i,j=y??d,M=PH(p),[N,P]=A3({controlled:c,default:l,name:`RadioGroup`,state:`value`}),[F,I]=Y.useState(!1),L=kg((e,t)=>{s?.(e,t),!t.isCanceled&&P(e)}),R=S.getInputControl,z=Y.useMemo(()=>({get current(){return R()}}),[R]),B=Y.useRef(null),V=Y.useRef(null);function H(e){let t;return f&&(typeof f==`function`?t=f(e):f.current=e),B.current=e,t}let U=kg(e=>{if(!e||e.disabled)return;V.current||=e;let t=B.current,n=e.checked||t==null||t.disabled?H(e):void 0;return()=>{V.current===e&&(V.current=null),B.current===e?n?(n(),B.current=null):H(null):n?.()}}),W=kg(()=>{let e=O.current;if(!e)return N??null;for(let t of S.registeredInputs.keys())if(t.checked&&Nve(t,e))return N??null;return null});z3(z,M,N??null,W,!A,d),aY(N,()=>{D(j),C(N!==T.initialValue),w(N!=null),S.change(N);let e=V.current;N==null&&e&&!e.disabled&&H(e)});let G=E??k?.legendId,K={...x,disabled:A??!1,required:o??!1,readOnly:a??!1},q=Y.useMemo(()=>({checkedValue:N,disabled:A,form:u,validation:S,name:j,readOnly:a,registerInputRef:U,required:o,setCheckedValue:L,setTouched:I,touched:F}),[N,A,u,S,j,a,U,o,L,I,F]),J={id:p,role:`radiogroup`,"aria-required":o||void 0,"aria-disabled":A||void 0,"aria-readonly":a||void 0,"aria-labelledby":G,onFocus(){_(!0)},onBlur(e){mU(e.currentTarget,e.relatedTarget)||(g(!0),_(!1),v===`onBlur`&&S.commit(N))},onKeyDownCapture(e){e.key.startsWith(`Arrow`)&&(I(!0),_(!0))}};return(0,X.jsx)(n7.Provider,{value:q,children:(0,X.jsx)(Mve,{render:n,className:r,style:m,state:K,props:[J,h,e=>S.getValidationProps(A??!1,e)],refs:[t],stateAttributesMapping:F3,enableHomeAndEndKeys:!1,modifierKeys:Ive})})});function Rve(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`space-y-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(Lve,{className:i,"data-slot":`radio-group`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function zve(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex size-4 shrink-0 items-center justify-center rounded-full border border-input bg-background outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 data-[checked]:border-primary data-[checked]:bg-primary data-[checked]:text-primary-foreground data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50`,n),t[3]=n,t[4]=i);let a;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(Ove,{className:`flex items-center justify-center before:size-1.5 before:rounded-full before:bg-current data-[unchecked]:hidden`}),t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==i?(o=(0,X.jsx)(Dve,{className:i,"data-slot":`radio`,...r,children:a}),t[6]=r,t[7]=i,t[8]=o):o=t[8],o}function Bve(e){let t=(0,Z.c)(95),{config:n,onUpdateConfig:r,disabled:i}=e,a=(0,Y.useId)(),o=(0,Y.useId)(),s=(0,Y.useId)(),c=(0,Y.useId)(),l=yy(),u,d;t[0]!==l||t[1]!==n?(u=C1(n)??S1,d=aue({rules:u,catalog:l}),t[0]=l,t[1]=n,t[2]=u,t[3]=d):(u=t[2],d=t[3]);let f=d,p;t[4]===r?p=t[5]:(p=e=>{r({lifecycleRules:e})},t[4]=r,t[5]=p);let m=p,h;t[6]!==u||t[7]!==m?(h=e=>{m(A1({...u,startEvents:e}))},t[6]=u,t[7]=m,t[8]=h):h=t[8];let g=h,_;t[9]!==u||t[10]!==m?(_=e=>{m(A1({...u,cancelEvents:e}))},t[9]=u,t[10]=m,t[11]=_):_=t[11];let v=_,y;t[12]!==u||t[13]!==m?(y=e=>{m(A1({...u,concurrency:e}))},t[12]=u,t[13]=m,t[14]=y):y=t[14];let b=y,x;t[15]!==u||t[16]!==m?(x=(e,t)=>{let n=t.trim(),r={...u.correlationPaths};n?r[e]=n:delete r[e],m({...u,correlationPaths:Object.keys(r).length>0?r:void 0})},t[15]=u,t[16]=m,t[17]=x):x=t[17];let S=x,C=l.events.length>0,w;t[18]!==l.events||t[19]!==i||t[20]!==u.startEvents||t[21]!==g||t[22]!==a?(w=(0,X.jsx)(y5,{choices:l.events,disabled:i,inputId:a,onValueChange:g,value:u.startEvents}),t[18]=l.events,t[19]=i,t[20]=u.startEvents,t[21]=g,t[22]=a,t[23]=w):w=t[23];let T;t[24]!==l||t[25]!==i||t[26]!==u||t[27]!==S||t[28]!==g?(T=u.startEvents.map(e=>(0,X.jsx)(a7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>g(u.startEvents.filter(t=>t!==e)),request:k1({rules:u,catalog:l,eventName:e,role:`start`})},e)),t[24]=l,t[25]=i,t[26]=u,t[27]=S,t[28]=g,t[29]=T):T=t[29];let E;t[30]!==a||t[31]!==C||t[32]!==w||t[33]!==T?(E=(0,X.jsxs)(i7,{help:`A run starts when one of these Events arrives. Naming several is how one workflow answers an appointment being booked and being moved: Concurrency decides what happens to the run already going.`,hasEvents:C,inputId:a,label:`Start Events`,children:[w,T]}),t[30]=a,t[31]=C,t[32]=w,t[33]=T,t[34]=E):E=t[34];let D;t[35]===s?D=t[36]:(D=(0,X.jsx)(TX,{id:s,children:`Concurrency`}),t[35]=s,t[36]=D);let O=u.concurrency,k;t[37]!==i||t[38]!==u.concurrency?(k=Gve.map(e=>(0,X.jsxs)(`label`,{className:Q(`flex w-full cursor-pointer items-start gap-2 rounded-md border p-2 transition-colors`,u.concurrency===e.value?`border-primary bg-muted/50`:`border-input hover:bg-muted/30`,i&&`pointer-events-none opacity-50`),children:[(0,X.jsx)(zve,{className:`mt-0.5`,value:e.value}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]})]},e.value)),t[37]=i,t[38]=u.concurrency,t[39]=k):k=t[39];let A;t[40]!==s||t[41]!==i||t[42]!==u.concurrency||t[43]!==b||t[44]!==k?(A=(0,X.jsx)(Rve,{"aria-labelledby":s,disabled:i,onValueChange:b,value:O,children:k}),t[40]=s,t[41]=i,t[42]=u.concurrency,t[43]=b,t[44]=k,t[45]=A):A=t[45];let j;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The entity is the value at the Correlation Path. A start carrying no payload uses the workflow itself, so every manual run is about the same entity.`}),t[46]=j):j=t[46];let M;t[47]!==D||t[48]!==A?(M=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[D,A,j]}),t[47]=D,t[48]=A,t[49]=M):M=t[49];let N=u.allowManualStart===!0,P;t[50]!==u||t[51]!==m?(P=e=>m({...u,allowManualStart:e}),t[50]=u,t[51]=m,t[52]=P):P=t[52];let F;t[53]!==i||t[54]!==c||t[55]!==N||t[56]!==P?(F=(0,X.jsx)(e7,{checked:N,disabled:i,id:c,onCheckedChange:P}),t[53]=i,t[54]=c,t[55]=N,t[56]=P,t[57]=F):F=t[57];let I;t[58]===c?I=t[59]:(I=(0,X.jsx)(TX,{htmlFor:c,children:`Allow manual runs`}),t[58]=c,t[59]=I);let L;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`The Run button and the execute route. With this off, only a Start Event starts a run.`}),t[60]=L):L=t[60];let R;t[61]===u.startEvents.length?R=t[62]:(R=u.startEvents.length===0?(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`A manual run's payload is described by nothing, so downstream nodes are offered no fields to reference. Add a Start Event to give them its payload.`}):null,t[61]=u.startEvents.length,t[62]=R);let z;t[63]!==I||t[64]!==R?(z=(0,X.jsxs)(`div`,{className:`space-y-0.5`,children:[I,L,R]}),t[63]=I,t[64]=R,t[65]=z):z=t[65];let B;t[66]!==F||t[67]!==z?(B=(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[F,z]}),t[66]=F,t[67]=z,t[68]=B):B=t[68];let V=l.events.length>0,H;t[69]!==o||t[70]!==l.events||t[71]!==i||t[72]!==u.cancelEvents||t[73]!==v?(H=(0,X.jsx)(y5,{choices:l.events,disabled:i,inputId:o,onValueChange:v,value:u.cancelEvents}),t[69]=o,t[70]=l.events,t[71]=i,t[72]=u.cancelEvents,t[73]=v,t[74]=H):H=t[74];let U;t[75]!==l||t[76]!==i||t[77]!==u||t[78]!==v||t[79]!==S?(U=u.cancelEvents.map(e=>(0,X.jsx)(a7,{catalog:l,disabled:i,eventName:e,label:Ny(l,e)?.label,onCommitPath:S,onRemove:()=>v(u.cancelEvents.filter(t=>t!==e)),request:k1({rules:u,catalog:l,eventName:e,role:`cancel`})},e)),t[75]=l,t[76]=i,t[77]=u,t[78]=v,t[79]=S,t[80]=U):U=t[80];let W;t[81]!==o||t[82]!==V||t[83]!==H||t[84]!==U?(W=(0,X.jsxs)(i7,{hasEvents:V,help:`When one of these arrives, Workflow Graph reads its Entity Value at the Correlation Path you set for it and cancels the runs already going for that entity. A canceled run leaves through the Canceled outlet.`,inputId:o,label:`Cancel Events`,children:[H,U]}),t[81]=o,t[82]=V,t[83]=H,t[84]=U,t[85]=W):W=t[85];let G;t[86]!==f.error||t[87]!==f.valid?(G=f.valid?null:(0,X.jsx)(v5,{title:`This will not save`,children:f.error}),t[86]=f.error,t[87]=f.valid,t[88]=G):G=t[88];let K;return t[89]!==E||t[90]!==M||t[91]!==B||t[92]!==W||t[93]!==G?(K=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[E,M,B,W,G]}),t[89]=E,t[90]=M,t[91]=B,t[92]=W,t[93]=G,t[94]=K):K=t[94],K}function i7(e){let t=(0,Z.c)(12),{label:n,inputId:r,hasEvents:i,help:a,children:o}=e,s;t[0]!==r||t[1]!==n?(s=(0,X.jsx)(TX,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==o||t[4]!==i?(c=i?o:(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`This server declares no Events. Whoever runs it passes them to`,(0,X.jsx)(`code`,{className:`mx-1 font-mono text-xs`,children:`createWfGraphApp`}),`, and they appear here.`]}),t[3]=o,t[4]=i,t[5]=c):c=t[5];let l;t[6]===a?l=t[7]:(l=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:a}),t[6]=a,t[7]=l);let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[s,c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function a7(e){let t=(0,Z.c)(19),{eventName:n,label:r,request:i,catalog:a,onCommitPath:o,onRemove:s,disabled:c}=e,l=r??n,u;t[0]!==n||t[1]!==l?(u=(0,X.jsx)(`p`,{className:`min-w-0 truncate text-xs`,title:n,children:l}),t[0]=n,t[1]=l,t[2]=u):u=t[2];let d=`Remove ${n}`,f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(hy,{className:`size-3.5`}),t[3]=f):f=t[3];let p;t[4]!==c||t[5]!==s||t[6]!==d?(p=(0,X.jsx)(zv,{"aria-label":d,className:`size-7 shrink-0`,disabled:c,onClick:s,size:`icon`,type:`button`,variant:`ghost`,children:f}),t[4]=c,t[5]=s,t[6]=d,t[7]=p):p=t[7];let m;t[8]!==u||t[9]!==p?(m=(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[u,p]}),t[8]=u,t[9]=p,t[10]=m):m=t[10];let h;t[11]!==a||t[12]!==c||t[13]!==o||t[14]!==i?(h=i?(0,X.jsx)(Vve,{catalog:a,disabled:c,onCommit:o,request:i}):null,t[11]=a,t[12]=c,t[13]=o,t[14]=i,t[15]=h):h=t[15];let g;return t[16]!==m||t[17]!==h?(g=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-2`,children:[m,h]}),t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Vve(e){let t=(0,Z.c)(47),{request:n,catalog:r,disabled:i,onCommit:a}=e,o=(0,Y.useId)(),{eventName:s,declaredPath:c,suppliedPath:l}=n,u,d,f,p,m,h,g,_,v,y;if(t[0]!==r||t[1]!==c||t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==l){let e=Wve(r,s,c,l);v=`space-y-1`,t[17]!==s||t[18]!==o?(y=(0,X.jsx)(TX,{className:`sr-only`,htmlFor:o,children:s}),t[17]=s,t[18]=o,t[19]=y):y=t[19],d=V6,m=i,t[20]!==c||t[21]!==s||t[22]!==a?(h=e=>a(s,e===c||e===null?``:e),t[20]=c,t[21]=s,t[22]=a,t[23]=h):h=t[23],g=l??c??null;let n;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(U6,{}),t[24]=n):n=t[24],t[25]===o?_=t[26]:(_=(0,X.jsx)(W6,{className:`w-full`,id:o,children:n}),t[25]=o,t[26]=_),u=G6,t[27]===c?f=t[28]:(f=c?null:(0,X.jsx)(K6,{value:null,children:`Choose a path`}),t[27]=c,t[28]=f),p=e.map(Hve),t[0]=r,t[1]=c,t[2]=i,t[3]=s,t[4]=o,t[5]=a,t[6]=l,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else u=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[29]!==u||t[30]!==f||t[31]!==p?(b=(0,X.jsxs)(u,{children:[f,p]}),t[29]=u,t[30]=f,t[31]=p,t[32]=b):b=t[32];let x;t[33]!==d||t[34]!==m||t[35]!==h||t[36]!==g||t[37]!==_||t[38]!==b?(x=(0,X.jsxs)(d,{disabled:m,onValueChange:h,value:g,children:[_,b]}),t[33]=d,t[34]=m,t[35]=h,t[36]=g,t[37]=_,t[38]=b,t[39]=x):x=t[39];let S=c?`Runs are matched on this payload path. The Event declares ${c}; a path here is read instead.`:`Runs are matched on this payload path. This Event declares none, so choose the one holding the value that identifies the entity.`,C;t[40]===S?C=t[41]:(C=(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:S}),t[40]=S,t[41]=C);let w;return t[42]!==x||t[43]!==C||t[44]!==v||t[45]!==y?(w=(0,X.jsxs)(`div`,{className:v,children:[y,x,C]}),t[42]=x,t[43]=C,t[44]=v,t[45]=y,t[46]=w):w=t[46],w}function Hve(e){return(0,X.jsx)(K6,{value:e,children:e},e)}var Uve=new Set([`string`,`number`]);function Wve(e,t,n,r){return Ya(Ka([...(Ny(e,t)?.payloadFields??[]).filter(e=>Uve.has(e.type??``)).map(e=>e.path),n,r]))}var Gve=[{value:`unlimited`,label:`Unlimited`,description:`Every Event starts its own run.`},{value:`newest-wins`,label:`Newest wins`,description:`A new run for the same entity supersedes the ones already going, which end with that status.`},{value:`first-wins`,label:`First wins`,description:`A run already going for the same entity keeps it. The arriving Event is recorded as a Refused Start.`}];function Kve(e){let[t]=o8({currentNodeId:e.nodeId,nodes:e.nodes,edges:e.edges,catalog:e.catalog});if(!t)return;let n=L2(t),r=a4(n);return{conditionModel:t4(n),condition:r.valid?r.expression:``}}function qve(){let e=(0,Z.c)(17),t=yy(),n=_A(),r=Fe(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={from:`/workflows/$workflowId`},e[0]=i):i=e[0];let a=Gi(i),o=wA(H4),s=TA(m3),c=TA(hpe),l;e[1]!==t||e[2]!==r||e[3]!==o||e[4]!==n||e[5]!==s?(l=e=>{let i=n.get(Q4),a=i.find(e=>e.id===o);if(!a)return;let c=typeof e.actionType==`string`&&!!a.data.config?.integrationId,l={...a.data.config,...e,...c?{integrationId:void 0}:{}};e.actionType===b1.condition&&!l.conditionModel&&Object.assign(l,Kve({nodeId:a.id,nodes:i,edges:n.get($4),catalog:t}));let u=r.getQueryData(i0().queryKey),d=u?J0(t,{...a,data:{...a.data,config:l}},u).data.config:l;s({id:a.id,data:{config:d}})},e[1]=t,e[2]=r,e[3]=o,e[4]=n,e[5]=s,e[6]=l):l=e[6];let u=l,d;e[7]===r?d=e[8]:(d=()=>s0(r),e[7]=r,e[8]=d);let f=d,p;e[9]!==c||e[10]!==a||e[11]!==r?(p=r0.workflow.deleteExecutions.mutationOptions({onSuccess:async()=>{c(),a({search:{},replace:!0}),await s0(r),Ty.success(`All runs deleted`)},meta:{errorMessage:`Failed to delete runs`}}),e[9]=c,e[10]=a,e[11]=r,e[12]=p):p=e[12];let m=Ze(p),h;return e[13]!==m||e[14]!==f||e[15]!==u?(h={updateConfig:u,refreshRuns:f,deleteRuns:m},e[13]=m,e[14]=f,e[15]=u,e[16]=h):h=e[16],h}var Jve=[`pending`,`running`,`waiting`,`completed`,`canceled`,`superseded`,`failed`],Yve=[`pending`,`running`,`waiting`];function o7(e){return Yve.some(t=>t===e)}function Xve(e){return{supersededCount:e.supersededCount,refusedStarts:e.refusedStarts.map(e=>({...e,createdAt:new Date(e.createdAt)})),executions:e.items.map(e=>({...e,startedAt:new Date(e.startedAt),waitingAt:e.waitingAt?new Date(e.waitingAt):null,cancelledAt:e.cancelledAt?new Date(e.cancelledAt):null,completedAt:e.completedAt?new Date(e.completedAt):null}))}}function Zve(e){return{logs:s7(e),waits:e.waits.map(e=>({...e,waitUntil:e.waitUntil?new Date(e.waitUntil):null})),execution:{...Qve(e.execution),workflowVersionId:e.execution.workflowVersionId}}}function Qve(e){return{id:e.id,workflowId:e.workflowId,status:$ve(e.status),startSource:e.startSource,runMode:e.runMode,startEventName:e.startEventName,entityValue:e.entityValue,workflowRunId:null,startedAt:new Date(e.startedAt),waitingAt:null,cancelledAt:null,completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,error:e.error}}function $ve(e){for(let t of Jve)if(t===e)return t;return`failed`}function eye(e){return iye(s7(e))}function tye(e){return{workflowId:e.execution.workflowId,workflowVersionId:e.execution.workflowVersionId}}function nye(e){return e.events.map(e=>({...e,createdAt:new Date(e.createdAt)}))}function s7(e){return aye(e.logs.map(e=>({id:e.id,nodeId:e.nodeId,nodeName:e.nodeName,nodeType:e.nodeType,status:e.status,startedAt:new Date(e.startedAt),completedAt:e.completedAt?new Date(e.completedAt):null,duration:e.duration,input:e.input,output:e.output,error:e.error})),e.execution.status)}function rye(e){return new Date(e.startedAt).getTime()}function iye(e){let t={};for(let n of e){let e=t[n.nodeId];e?.startedAt!==void 0&&rye(n)<new Date(e.startedAt).getTime()||(t[n.nodeId]={nodeId:n.nodeId,nodeName:n.nodeName,nodeType:n.nodeType,status:n.status,input:n.input,output:n.output,startedAt:n.startedAt,completedAt:n.completedAt})}return t}function aye(e,t){return t!==`canceled`&&t!==`superseded`?e:e.map(e=>e.status===`pending`||e.status===`running`?{...e,status:`cancelled`,error:e.error||`Run cancelled before step completion`}:e)}function c7(){let e=(0,Z.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={from:`/workflows/$workflowId`},e[0]=t):t=e[0];let n=Gi(t),r;return e[1]===n?r=e[2]:(r=()=>{n({search:{},replace:!0})},e[1]=n,e[2]=r),r}function l7(){let e=(0,Z.c)(3),t=c7(),n=TA(g2),r;return e[0]!==t||e[1]!==n?(r=()=>{n(`properties`),t()},e[0]=t,e[1]=n,e[2]=r):r=e[2],r}function u7(e,t){return`${e} ${t}${e===1?``:`s`} ago`}function d7(e){let t=new Date,n=new Date(e),r=Math.floor((t.getTime()-n.getTime())/1e3);if(r<60)return`just now`;let i=Math.floor(r/60);if(i<60)return u7(i,`min`);let a=Math.floor(i/60);if(a<24)return u7(a,`hour`);let o=Math.floor(a/24);if(o<7)return u7(o,`day`);let s=Math.floor(o/7);if(s<4)return u7(s,`week`);let c=Math.floor(o/30);return c<12?u7(c,`month`):u7(Math.floor(o/365),`year`)}function f7(e){let t=(0,Z.c)(5),{refusedStarts:n}=e;if(n.length===0)return null;let r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(Kv,{className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:`Refused Starts`})]}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=n.map(oye),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[r,(0,X.jsx)(`div`,{className:`divide-y`,children:i})]}),t[3]=i,t[4]=a),a}function oye(e){return(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-foreground text-xs`,children:e.message}),(0,X.jsx)(`p`,{className:`shrink-0 text-muted-foreground text-xs tabular-nums`,title:e.createdAt.toLocaleString(),children:d7(e.createdAt)})]},e.id)}var sye=jy(`workflow`,`run`),cye={pending:`muted`,running:`info`,waiting:`pending`,completed:`good`,canceled:`quiet`,superseded:`quiet`,failed:`bad`},lye={pending:`muted`,running:`info`,success:`good`,error:`bad`,cancelled:`quiet`};function p7(e){return cye[e]??lye[e]??`muted`}var uye={good:`bg-success`,bad:`bg-destructive`,info:`bg-info`,pending:`bg-warning`,quiet:`bg-cancelled`,muted:`bg-muted-foreground`},dye={pending:`Pending`,running:`Running`,waiting:`Waiting`,completed:`Completed`,canceled:`Canceled`,superseded:`Superseded`,failed:`Failed`},fye={pending:`Pending`,running:`Running`,success:`Success`,error:`Error`,cancelled:`Cancelled`},pye={good:`border-success/30 bg-success/10 text-success`,bad:`border-destructive/30 bg-destructive/10 text-destructive`,info:`border-info/30 bg-info/10 text-info`,pending:`border-warning/30 bg-warning/10 text-warning`,quiet:`border-cancelled/30 bg-cancelled/10 text-cancelled`,muted:`border-muted bg-muted/40 text-muted-foreground`};function m7(e){return uye[p7(e)]}function h7(e){return dye[e]??fye[e]??`Unknown`}function g7(e){return pye[p7(e)]}function _7(e){let t=Number.parseInt(e,10);return t<1e3?`${e}ms`:`${(t/1e3).toFixed(2)}s`}var mye=Wh(Ch({base64:yh.check(Lh(101))}));function v7(e){return mye(e)?.base64??null}function hye(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function y7(e){let t=(0,Z.c)(4),{data:n}=e,r;t[0]===n?r=t[1]:(r=JSON.stringify(n,null,2).split(/("https?:\/\/[^"]+"|"[^"]*")/g).map(gye),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,X.jsx)(X.Fragment,{children:r}),t[2]=r,t[3]=i),i}function gye(e){if(e.startsWith(`"`)&&e.endsWith(`"`)){let t=e.slice(1,-1);if(hye(t))return(0,X.jsx)(`a`,{className:`text-info underline underline-offset-2 hover:text-info/80`,href:t,rel:`noopener noreferrer`,target:`_blank`,children:e},t)}return e}function _ye({data:e,isError:t=!1}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(zv,{className:`h-7 px-2`,onClick:async n=>{n.stopPropagation();try{let n=t?String(e):JSON.stringify(e,null,2);await navigator.clipboard.writeText(n),r(!0),setTimeout(()=>r(!1),2e3)}catch(e){sye.error(`Failed to copy the run payload`,{error:e})}},size:`sm`,type:`button`,variant:`ghost`,children:n?(0,X.jsx)(qv,{className:`size-3 text-success`}):(0,X.jsx)($v,{className:`size-3`})})}function b7(e){let t=(0,Z.c)(21),{title:n,children:r,defaultExpanded:i,copyData:a,isError:o}=e,s=i!==void 0&&i,c=o!==void 0&&o,[l,u]=(0,Y.useState)(s),d;t[0]===l?d=t[1]:(d=()=>u(!l),t[0]=l,t[1]=d);let f;t[2]===l?f=t[3]:(f=l?(0,X.jsx)(Jv,{className:`size-3 text-muted-foreground`}):(0,X.jsx)(Xv,{className:`size-3 text-muted-foreground`}),t[2]=l,t[3]=f);let p;t[4]===n?p=t[5]:(p=(0,X.jsx)(`span`,{className:`font-medium text-muted-foreground text-sm`,children:n}),t[4]=n,t[5]=p);let m;t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,X.jsxs)(`button`,{className:`flex items-center gap-1.5`,onClick:d,type:`button`,children:[f,p]}),t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==a||t[11]!==c?(h=a===void 0?null:(0,X.jsx)(_ye,{data:a,isError:c}),t[10]=a,t[11]=c,t[12]=h):h=t[12];let g;t[13]===h?g=t[14]:(g=(0,X.jsx)(`div`,{className:`flex items-center gap-1`,children:h}),t[13]=h,t[14]=g);let _;t[15]!==m||t[16]!==g?(_=(0,X.jsxs)(`div`,{className:`mb-2 flex w-full items-center justify-between`,children:[m,g]}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v=l?r:null,y;return t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20],y}function vye(e,t){let n=t?.integration;if(!n)return;let r=`${n}/`;if(t.id.startsWith(r))return e[n]?.outputComponents?.[t.id.slice(r.length)]}function yye(e){let t=(0,Z.c)(22),{output:n,input:r,actionType:i}=e,a=yy(),o=xy(),s;t[0]!==i||t[1]!==a||t[2]!==o?(s=i?vye(o,Py(a,i)):void 0,t[0]=i,t[1]=a,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]!==c||t[5]!==n?(l=c?null:v7(n),t[4]=c,t[5]=n,t[6]=l):l=t[6];let u=l,d;t[7]!==c||t[8]!==u||t[9]!==r||t[10]!==n?(d=c?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(c,{input:r,output:n})}):u?(0,X.jsx)(`div`,{className:`overflow-hidden rounded-lg border bg-muted/50 p-3`,children:(0,X.jsx)(`img`,{alt:`Step output`,className:`max-h-96 w-auto rounded`,height:384,src:`data:image/png;base64,${u}`,width:384})}):null,t[7]=c,t[8]=u,t[9]=r,t[10]=n,t[11]=d):d=t[11];let f=d,p;t[12]===n?p=t[13]:(p=(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(y7,{data:n})}),t[12]=n,t[13]=p);let m;t[14]!==n||t[15]!==p?(m=(0,X.jsx)(b7,{copyData:n,title:`Output`,children:p}),t[14]=n,t[15]=p,t[16]=m):m=t[16];let h;t[17]===f?h=t[18]:(h=f?(0,X.jsx)(b7,{defaultExpanded:!0,title:`Result`,children:f}):null,t[17]=f,t[18]=h);let g;return t[19]!==m||t[20]!==h?(g=(0,X.jsxs)(X.Fragment,{children:[m,h]}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}var x7=`grid w-full grid-cols-[1.5rem_minmax(0,1fr)_5rem] items-start gap-3 px-1 py-3 text-left`;function bye(e){return e.type===`back`?(0,X.jsx)(`button`,{"aria-label":`Back to runs list`,className:`mt-0.5 flex size-6 shrink-0 items-center justify-center rounded-md transition-colors hover:bg-muted`,onClick:e.onBack,type:`button`,children:(0,X.jsx)(ate,{className:`size-4 text-muted-foreground`})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`size-6 shrink-0`})}function xye(e,t){return t.type===`cancel`?(0,X.jsx)(`div`,{className:`flex w-20 justify-end`,children:(0,X.jsxs)(zv,{className:`w-full`,disabled:t.isCanceling,onClick:()=>t.onCancel(e.id),size:`sm`,variant:`outline`,children:[t.isCanceling?(0,X.jsx)(ay,{className:`mr-1 size-3 animate-spin`}):(0,X.jsx)(Kv,{className:`mr-1 size-3`}),`Cancel`]})}):(0,X.jsx)(`div`,{"aria-hidden":!0,className:`w-20 shrink-0`})}function Sye(e){let t=(0,Z.c)(41),{execution:n,runNumber:r,showStartEventName:i}=e,a;t[0]===n.status?a=t[1]:(a=Q(`mt-1 size-2.5 shrink-0 rounded-full`,m7(n.status)),t[0]=n.status,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,X.jsx)(`div`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,X.jsxs)(`span`,{className:`font-medium text-sm`,children:[`Run #`,r]}),t[4]=r,t[5]=s);let c;t[6]===n.status?c=t[7]:(c=Q(`rounded border px-1.5 py-0.5 font-medium text-xs uppercase`,g7(n.status)),t[6]=n.status,t[7]=c);let l;t[8]===n.status?l=t[9]:(l=h7(n.status),t[8]=n.status,t[9]=l);let u;t[10]!==c||t[11]!==l?(u=(0,X.jsx)(`span`,{className:c,children:l}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;t[13]===n.runMode?d=t[14]:(d=n.runMode===`test`?(0,X.jsx)(`span`,{className:`rounded border border-warning/40 bg-warning/10 px-1.5 py-0.5 font-medium text-xs text-warning uppercase`,children:`Test Mode`}):null,t[13]=n.runMode,t[14]=d);let f;t[15]!==s||t[16]!==u||t[17]!==d?(f=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,u,d]}),t[15]=s,t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;t[19]===n.startedAt?p=t[20]:(p=d7(n.startedAt),t[19]=n.startedAt,t[20]=p);let m;t[21]===p?m=t[22]:(m=(0,X.jsx)(`span`,{children:p}),t[21]=p,t[22]=m);let h;t[23]===n.startSource?h=t[24]:(h=n.startSource?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`capitalize`,children:n.startSource})]}):null,t[23]=n.startSource,t[24]=h);let g;t[25]!==n.startEventName||t[26]!==i?(g=i&&n.startEventName?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{children:n.startEventName})]}):null,t[25]=n.startEventName,t[26]=i,t[27]=g):g=t[27];let _;t[28]===n.duration?_=t[29]:(_=n.duration?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:`·`}),(0,X.jsx)(`span`,{className:`font-mono tabular-nums`,children:_7(n.duration)})]}):null,t[28]=n.duration,t[29]=_);let v;t[30]!==m||t[31]!==h||t[32]!==g||t[33]!==_?(v=(0,X.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2 text-muted-foreground text-xs`,children:[m,h,g,_]}),t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v):v=t[34];let y;t[35]!==v||t[36]!==f?(y=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,v]}),t[35]=v,t[36]=f,t[37]=y):y=t[37];let b;return t[38]!==y||t[39]!==o?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[o,y]}),t[38]=y,t[39]=o,t[40]=b):b=t[40],b}function S7(e){let t=(0,Z.c)(21),{execution:n,runNumber:r,leading:i,trailing:a,onClick:o,selected:s,showStartEventName:c}=e,l=s!==void 0&&s,u=c!==void 0&&c,d;t[0]===i?d=t[1]:(d=bye(i),t[0]=i,t[1]=d);let f;t[2]!==n||t[3]!==r||t[4]!==u?(f=(0,X.jsx)(Sye,{execution:n,runNumber:r,showStartEventName:u}),t[2]=n,t[3]=r,t[4]=u,t[5]=f):f=t[5];let p;t[6]!==n||t[7]!==a?(p=xye(n,a),t[6]=n,t[7]=a,t[8]=p):p=t[8];let m;t[9]!==d||t[10]!==f||t[11]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[d,f,p]}),t[9]=d,t[10]=f,t[11]=p,t[12]=m):m=t[12];let h=m;if(o){let e=l&&`bg-muted/50`,n;t[13]===e?n=t[14]:(n=Q(x7,`transition-colors hover:bg-muted/50`,e),t[13]=e,t[14]=n);let r;return t[15]!==h||t[16]!==o||t[17]!==n?(r=(0,X.jsx)(`button`,{className:n,"data-testid":`workflow-run-summary-row`,onClick:o,type:`button`,children:h}),t[15]=h,t[16]=o,t[17]=n,t[18]=r):r=t[18],r}let g;return t[19]===h?g=t[20]:(g=(0,X.jsx)(`div`,{className:x7,"data-testid":`workflow-run-summary-row`,children:h}),t[19]=h,t[20]=g),g}function Cye(e){let t=(0,Z.c)(36),{log:n,isLast:r}=e,[i,a]=(0,Y.useState)(!1),o;t[0]===r?o=t[1]:(o=r?null:(0,X.jsx)(`div`,{className:`absolute top-5 bottom-0 left-2 w-px bg-border`}),t[0]=r,t[1]=o);let s;t[2]===n.status?s=t[3]:(s=Q(`size-4 rounded-full ring-2 ring-background`,m7(n.status)),t[2]=n.status,t[3]=s);let c;t[4]===s?c=t[5]:(c=(0,X.jsx)(`div`,{className:`relative z-10 mt-1.5 flex shrink-0 items-center justify-center`,children:(0,X.jsx)(`div`,{className:s})}),t[4]=s,t[5]=c);let l;t[6]===i?l=t[7]:(l=()=>a(!i),t[6]=i,t[7]=l);let u=n.nodeName||n.nodeType,d;t[8]===u?d=t[9]:(d=(0,X.jsx)(`span`,{className:`truncate font-medium text-sm transition-colors group-hover:text-foreground`,children:u}),t[8]=u,t[9]=d);let f;t[10]===n.status?f=t[11]:(f=h7(n.status),t[10]=n.status,t[11]=f);let p;t[12]===f?p=t[13]:(p=(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:f}),t[12]=f,t[13]=p);let m;t[14]===n.duration?m=t[15]:(m=n.duration?(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground text-xs tabular-nums`,children:_7(n.duration)}):null,t[14]=n.duration,t[15]=m);let h;t[16]!==d||t[17]!==p||t[18]!==m?(h=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[d,p,m]}),t[16]=d,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==h||t[21]!==l?(g=(0,X.jsx)(`button`,{className:`group w-full text-left`,onClick:l,type:`button`,children:h}),t[20]=h,t[21]=l,t[22]=g):g=t[22];let _;t[23]!==i||t[24]!==n.error||t[25]!==n.input||t[26]!==n.nodeType||t[27]!==n.output?(_=i?(0,X.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[n.input!==null&&n.input!==void 0?(0,X.jsx)(b7,{copyData:n.input,title:`Input`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border bg-muted/50 p-3 font-mono text-xs leading-relaxed`,children:(0,X.jsx)(y7,{data:n.input})})}):null,n.output!==null&&n.output!==void 0?(0,X.jsx)(yye,{actionType:n.nodeType,input:n.input,output:n.output}):null,n.error?(0,X.jsx)(b7,{copyData:n.error,defaultExpanded:!0,isError:!0,title:`Error`,children:(0,X.jsx)(`pre`,{className:`overflow-auto rounded-lg border border-destructive/20 bg-destructive/5 p-3 font-mono text-destructive text-xs leading-relaxed`,children:n.error})}):null,n.input||n.output||n.error?null:(0,X.jsx)(`div`,{className:`rounded-lg border bg-muted/30 py-4 text-center text-muted-foreground text-xs`,children:`No data recorded`})]}):null,t[23]=i,t[24]=n.error,t[25]=n.input,t[26]=n.nodeType,t[27]=n.output,t[28]=_):_=t[28];let v;t[29]!==g||t[30]!==_?(v=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1 pb-4`,children:[g,_]}),t[29]=g,t[30]=_,t[31]=v):v=t[31];let y;return t[32]!==o||t[33]!==v||t[34]!==c?(y=(0,X.jsxs)(`div`,{className:`relative flex gap-3`,children:[o,c,v]}),t[32]=o,t[33]=v,t[34]=c,t[35]=y):y=t[35],y}function wye(e){let t=(0,Z.c)(7),{logs:n}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`py-8 text-center text-muted-foreground text-xs`,children:`No steps recorded`}),t[0]=e):e=t[0],e}let r;if(t[1]!==n){let e;t[3]===n.length?e=t[4]:(e=(e,t)=>(0,X.jsx)(Cye,{isLast:t===n.length-1,log:e},e.id),t[3]=n.length,t[4]=e),r=n.map(e),t[1]=n,t[2]=r}else r=t[2];let i;return t[5]===r?i=t[6]:(i=(0,X.jsx)(`div`,{className:`pl-1`,children:r}),t[5]=r,t[6]=i),i}function Tye(e){let t=(0,Z.c)(32),{execution:n,runNumber:r,notice:i,logs:a,events:o,waits:s,isCanceling:c,isResuming:l,onBack:u,onCancel:d,onResume:f}=e,p;t[0]===a?p=t[1]:(p=a.toSorted(Dye),t[0]=a,t[1]=p);let m=p,h;t[2]===u?h=t[3]:(h={onBack:u,type:`back`},t[2]=u,t[3]=h);let g;t[4]!==n.status||t[5]!==c||t[6]!==d?(g=o7(n.status)?{isCanceling:c,onCancel:d,type:`cancel`}:{type:`spacer`},t[4]=n.status,t[5]=c,t[6]=d,t[7]=g):g=t[7];let _;t[8]!==n||t[9]!==r||t[10]!==h||t[11]!==g?(_=(0,X.jsx)(S7,{execution:n,leading:h,runNumber:r,showStartEventName:!0,trailing:g}),t[8]=n,t[9]=r,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v;t[13]===i?v=t[14]:(v=i?(0,X.jsx)(`p`,{className:`rounded-md border bg-muted/30 p-2 text-muted-foreground text-xs`,children:i}):null,t[13]=i,t[14]=v);let y;if(t[15]!==l||t[16]!==f||t[17]!==s){let e;t[19]!==l||t[20]!==f?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-1.5 rounded-md border bg-muted/30 p-2`,children:[(0,X.jsxs)(`p`,{className:`font-medium text-xs`,children:[`Parked at `,e.nodeName]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.subscribedEvents.length>0?`Waiting for ${e.subscribedEvents.join(`, `)}`:`Waiting on a timer`}),e.resumeToken?(0,X.jsx)(zv,{disabled:l,onClick:()=>f(e.resumeToken??``),size:`sm`,type:`button`,variant:`outline`,children:`Resume now`}):null]},e.id),t[19]=l,t[20]=f,t[21]=e):e=t[21],y=s.map(e),t[15]=l,t[16]=f,t[17]=s,t[18]=y}else y=t[18];let b;t[22]===m?b=t[23]:(b=(0,X.jsx)(wye,{logs:m}),t[22]=m,t[23]=b);let x;t[24]===o?x=t[25]:(x=o.length>0?(0,X.jsx)(b7,{title:`Audit Events`,children:(0,X.jsx)(`div`,{className:`space-y-2`,children:o.map(Eye)})}):null,t[24]=o,t[25]=x);let S;return t[26]!==_||t[27]!==v||t[28]!==y||t[29]!==b||t[30]!==x?(S=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v,y,b,x]}),t[26]=_,t[27]=v,t[28]=y,t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function Eye(e){return(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border bg-muted/30 px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsx)(`div`,{className:`truncate font-medium text-xs`,children:e.message}),(0,X.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.eventType})]}),(0,X.jsx)(`div`,{className:`ml-3 shrink-0 text-xs text-muted-foreground`,children:d7(e.createdAt)})]},e.id)}function Dye(e,t){return new Date(e.startedAt).getTime()-new Date(t.startedAt).getTime()}function Oye(e){let t=(0,Z.c)(10),{executions:n,selectedId:r,onSelect:i}=e,a;if(t[0]!==n||t[1]!==i||t[2]!==r){let e;t[4]!==n.length||t[5]!==i||t[6]!==r?(e=(e,t)=>{let a=r===e.id,o=n.length-t;return(0,X.jsx)(S7,{execution:e,leading:{type:`spacer`},onClick:()=>i(e.id),runNumber:o,selected:a,trailing:{type:`spacer`}},e.id)},t[4]=n.length,t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[0]=n,t[1]=i,t[2]=r,t[3]=a}else a=t[3];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`divide-y`,children:a}),t[8]=a,t[9]=o),o}var C7=2e3,w7=50,kye=`This run has left the runs list, so what it shows stops here. A newer start supersedes the runs going for the same entity, and the list holds the newest 50.`,Aye=ma(`/workflows/$workflowId`);function jye(){let e=(0,Z.c)(80),t=wA(Q0),n=wA(O2),r=Fe(),{executionId:i}=Aye.useSearch(),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={from:`/workflows/$workflowId`},e[0]=a):a=e[0];let o=Gi(a),s=c7(),[c,l]=(0,Y.useState)(!1),u=c||i!==void 0,d;e[1]!==t||e[2]!==u?(d=r0.workflow.getExecutions.queryOptions({input:{workflowId:t??``,includeSuperseded:u},select:Xve}),e[1]=t,e[2]=u,e[3]=d):d=e[3];let f=t!==null,p;e[4]!==d||e[5]!==f?(p={...d,enabled:f,staleTime:0,refetchInterval:C7,placeholderData:L},e[4]=d,e[5]=f,e[6]=p):p=e[6];let m=Xe(p),h;e[7]===m.data?.executions?h=e[8]:(h=m.data?.executions??[],e[7]=m.data?.executions,e[8]=h);let g=h,_=m.data?.supersededCount??0,v;e[9]===m.data?.refusedStarts?v=e[10]:(v=m.data?.refusedStarts??[],e[9]=m.data?.refusedStarts,e[10]=v);let y=v,b;e[11]!==i||e[12]!==g?(b=i===void 0?-1:g.findIndex(e=>e.id===i),e[11]=i,e[12]=g,e[13]=b):b=e[13];let x=b,S=x>=0?g[x]:void 0,C=o7(S?.status)?C7:!1,w;e[14]===i?w=e[15]:(w=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:i??``},select:Zve}),e[14]=i,e[15]=w);let T=i!==void 0,E;e[16]!==C||e[17]!==w||e[18]!==T?(E={...w,enabled:T,staleTime:0,refetchInterval:C},e[16]=C,e[17]=w,e[18]=T,e[19]=E):E=e[19];let D=Xe(E),O;e[20]===i?O=e[21]:(O=r0.workflow.getExecutionEvents.queryOptions({input:{executionId:i??``},select:nye}),e[20]=i,e[21]=O);let k=i!==void 0,A;e[22]!==C||e[23]!==O||e[24]!==k?(A={...O,enabled:k,staleTime:0,refetchInterval:C},e[22]=C,e[23]=O,e[24]=k,e[25]=A):A=e[25];let j=Xe(A),M;e[26]===r?M=e[27]:(M=r0.workflow.cancelExecution.mutationOptions({onSuccess:()=>s0(r),meta:{errorMessage:`Failed to cancel run`}}),e[26]=r,e[27]=M);let N=Ze(M),P;e[28]===r?P=e[29]:(P=r0.workflow.resumeWait.mutationOptions({onSuccess:()=>s0(r),meta:{errorMessage:`Failed to resume the run`}}),e[28]=r,e[29]=P);let F=Ze(P),I;e[30]===o?I=e[31]:(I=e=>{o({search:{executionId:e}})},e[30]=o,e[31]=I);let R=I;if(m.isPending&&i===void 0){let t;return e[32]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[32]=t):t=e[32],t}let z;e[33]!==c||e[34]!==_?(z=_>0?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-1 pb-2`,children:[(0,X.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[_===1?`1 run was superseded by a newer start`:`${_} runs were superseded by newer starts`,_>w7?`, of which the newest ${w7} can be shown`:``]}),(0,X.jsx)(zv,{onClick:()=>l(Mye),size:`sm`,type:`button`,variant:`ghost`,children:c?`Hide`:`Show`})]}):null,e[33]=c,e[34]=_,e[35]=z):z=e[35];let B=z;if(i!==void 0){let t=S??D.data?.execution;if(!t){if(!D.isError&&(D.isPending||m.isPending)){let t;return e[36]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,X.jsx)(_y,{})}),e[36]=t):t=e[36],t}let t;e[37]===s?t=e[38]:(t=(0,X.jsx)(zv,{"aria-label":`Back to runs list`,onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:`Back`}),e[37]=s,e[38]=t);let n;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This run could not be loaded.`}),e[39]=n):n=e[39];let r;return e[40]===t?r=e[41]:(r=(0,X.jsxs)(`div`,{className:`space-y-2 px-1 py-2`,children:[t,n]}),e[40]=t,e[41]=r),r}let n=x>=0?g.length-x:0,r;e[42]===j.data?r=e[43]:(r=j.data??[],e[42]=j.data,e[43]=r);let i=N.isPending&&N.variables?.executionId===t.id,a;e[44]===D.data?.logs?a=e[45]:(a=D.data?.logs??[],e[44]=D.data?.logs,e[45]=a);let o=S?void 0:kye,c;e[46]===N?c=e[47]:(c=e=>N.mutate({executionId:e}),e[46]=N,e[47]=c);let l;e[48]===F?l=e[49]:(l=e=>F.mutate({token:e}),e[48]=F,e[49]=l);let u;e[50]===D.data?.waits?u=e[51]:(u=D.data?.waits??[],e[50]=D.data?.waits,e[51]=u);let d;return e[52]!==t||e[53]!==s||e[54]!==F.isPending||e[55]!==n||e[56]!==r||e[57]!==i||e[58]!==a||e[59]!==o||e[60]!==c||e[61]!==l||e[62]!==u?(d=(0,X.jsx)(Tye,{events:r,execution:t,isCanceling:i,isResuming:F.isPending,logs:a,notice:o,onBack:s,onCancel:c,onResume:l,runNumber:n,waits:u}),e[52]=t,e[53]=s,e[54]=F.isPending,e[55]=n,e[56]=r,e[57]=i,e[58]=a,e[59]=o,e[60]=c,e[61]=l,e[62]=u,e[63]=d):d=e[63],d}if(g.length===0){let t;e[64]===y?t=e[65]:(t=(0,X.jsx)(f7,{refusedStarts:y}),e[64]=y,e[65]=t);let n;e[66]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16`,children:[(0,X.jsx)(`div`,{className:`mb-3 rounded-lg border border-dashed p-4`,children:(0,X.jsx)(sy,{className:`size-6 text-muted-foreground`})}),(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:`No runs yet`}),(0,X.jsx)(`div`,{className:`mt-1 text-muted-foreground text-xs`,children:`Execute your workflow to see runs here`})]}),e[66]=n):n=e[66];let r;return e[67]!==B||e[68]!==t?(r=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,t,n]}),e[67]=B,e[68]=t,e[69]=r):r=e[69],r}let V;e[70]===y?V=e[71]:(V=(0,X.jsx)(f7,{refusedStarts:y}),e[70]=y,e[71]=V);let H;e[72]!==g||e[73]!==R||e[74]!==n?(H=(0,X.jsx)(Oye,{executions:g,onSelect:R,selectedId:n}),e[72]=g,e[73]=R,e[74]=n,e[75]=H):H=e[75];let U;return e[76]!==B||e[77]!==V||e[78]!==H?(U=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[B,V,H]}),e[76]=B,e[77]=V,e[78]=H,e[79]=U):U=e[79],U}function Mye(e){return!e}function T7(){let e=(0,Z.c)(3),t=wA(E2),n=TA(g2),r;return e[0]!==n||e[1]!==t?(r={validActiveTab:t,setActiveTab:n},e[0]=n,e[1]=t,e[2]=r):r=e[2],r}function Nye(){let{validActiveTab:e}=T7(),t=wA(H4),n=wA(U4);return e===`runs`?`Runs`:t?`Properties`:n?`Connection`:`Workflow`}function Pye(e){let t=(0,Z.c)(27),{placement:n,activeTab:r,onSelect:i,propertiesLabel:a,showRuns:o}=e;if(n===`bottom`){let e=`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`properties`?`text-foreground`:`text-muted-foreground`}`,n;t[0]===i?n=t[1]:(n=()=>i(`properties`),t[0]=i,t[1]=n);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,X.jsx)(uy,{className:`size-5`}),t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==e||t[5]!==n?(c=(0,X.jsxs)(`button`,{className:e,onClick:n,type:`button`,children:[s,a]}),t[3]=a,t[4]=e,t[5]=n,t[6]=c):c=t[6];let l;t[7]!==r||t[8]!==i||t[9]!==o?(l=o?(0,X.jsxs)(`button`,{className:`flex flex-1 flex-col items-center gap-1 py-3 font-medium text-xs transition-colors ${r===`runs`?`text-foreground`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:[(0,X.jsx)(sy,{className:`size-5`}),`Runs`]}):null,t[7]=r,t[8]=i,t[9]=o,t[10]=l):l=t[10];let u;return t[11]!==c||t[12]!==l?(u=(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center justify-around border-t bg-background pb-safe`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}let s=`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`properties`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,c;t[14]===i?c=t[15]:(c=()=>i(`properties`),t[14]=i,t[15]=c);let l;t[16]!==a||t[17]!==s||t[18]!==c?(l=(0,X.jsx)(`button`,{className:s,onClick:c,type:`button`,children:a}),t[16]=a,t[17]=s,t[18]=c,t[19]=l):l=t[19];let u;t[20]!==r||t[21]!==i||t[22]!==o?(u=o?(0,X.jsx)(`button`,{className:`inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center rounded-sm px-2 py-1 font-medium text-sm transition-[color,box-shadow] ${r===`runs`?`bg-background text-foreground shadow-sm`:`text-muted-foreground`}`,onClick:()=>i(`runs`),type:`button`,children:`Runs`}):null,t[20]=r,t[21]=i,t[22]=o,t[23]=u):u=t[23];let d;return t[24]!==l||t[25]!==u?(d=(0,X.jsx)(`div`,{className:`shrink-0 border-b px-4 py-2.5`,children:(0,X.jsxs)(`div`,{className:`inline-flex h-9 w-full items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground`,children:[l,u]})}),t[24]=l,t[25]=u,t[26]=d):d=t[26],d}function E7(e){let t=(0,Z.c)(82),{frame:n}=e,{updateConfig:r,refreshRuns:i,deleteRuns:a}=qve(),{validActiveTab:o,setActiveTab:s}=T7(),c=wA(H4),l=wA(U4),u=wA(Q4),d=wA($4),f=wA(T2),p=wA(Q0),m=wA($0),h=TA(pde),[g,_]=EA(n2),v=wA(t2),y=TA(m3),b=TA(h3),x=TA(X4),S=TA(Xfe),C=TA(Z4),w=TA(fpe),T=TA(g3),E=l0(),[D,O]=EA(a3),k,A,j,M,N;if(t[0]!==T||t[1]!==p||t[2]!==m||t[3]!==C||t[4]!==b||t[5]!==a||t[6]!==w||t[7]!==E||t[8]!==d||t[9]!==n||t[10]!==i||t[11]!==r||t[12]!==f||t[13]!==v||t[14]!==D||t[15]!==u||t[16]!==h||t[17]!==l||t[18]!==c||t[19]!==s||t[20]!==S||t[21]!==O||t[22]!==_||t[23]!==x||t[24]!==y||t[25]!==o||t[26]!==g){let e;t[32]===c?e=t[33]:(e=e=>e.id===c,t[32]=c,t[33]=e);let P=u.find(e),F;if(t[34]!==d||t[35]!==l){let e;t[37]===l?e=t[38]:(e=e=>e.id===l,t[37]=l,t[38]=e),F=d.find(e),t[34]=d,t[35]=l,t[36]=F}else F=t[36];let I=F,L;t[39]===u?L=t[40]:(L=u.filter(Iye),t[39]=u,t[40]=L);let R=L,z;t[41]===d?z=t[42]:(z=d.filter(Fye),t[41]=d,t[42]=z);let B=z,V=R.length+B.length>1,H;t[43]!==B.length||t[44]!==R.length?(H=[],R.length>0&&H.push(`${R.length} ${R.length===1?`step`:`steps`}`),B.length>0&&H.push(`${B.length} ${B.length===1?`connection`:`connections`}`),t[43]=B.length,t[44]=R.length,t[45]=H):H=t[45];let U=H.join(` and `),W=e=>{P&&y({id:P.id,data:{label:e}})},G=e=>{P&&y({id:P.id,data:{description:e}})},K=P&&D0(P)?B0(u).has(P.id):!1,q=!!(P&&!P.parentId&&(P.data.type===`action`||D0(P))),J=P?D0(P)?K:P.data.enabled===!1:!1,ee=()=>{if(P){if(D0(P)){S({groupId:P.id,enabled:K});return}y({id:P.id,data:{enabled:P.data.enabled===!1}})}},te;t[46]!==h||t[47]!==_?(te=async e=>{let t=await h(e);t&&_(t.message||`Failed to update workflow name`)},t[46]=h,t[47]=_,t[48]=te):te=t[48];let ne=te,re=()=>{if(!P)return;let e=P.id;n.confirm({title:`Delete Step`,message:`Are you sure you want to delete this step? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{b(e),n.dismiss?.()}})},ie;t[49]!==C||t[50]!==n||t[51]!==l?(ie=()=>{l&&n.confirm({title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{C(l),n.dismiss?.()}})},t[49]=C,t[50]=n,t[51]=l,t[52]=ie):ie=t[52];let ae=ie,oe;t[53]!==w||t[54]!==n||t[55]!==U?(oe=()=>{n.confirm({title:`Delete Selected Items`,message:`Are you sure you want to delete ${U}? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{w(),n.dismiss?.()}})},t[53]=w,t[54]=n,t[55]=U,t[56]=oe):oe=t[56];let se=oe,ce;t[57]!==p||t[58]!==a||t[59]!==n?(ce=()=>{n.confirm({title:`Delete All Runs`,message:`Are you sure you want to delete all workflow runs? This action cannot be undone.`,confirmLabel:`Delete`,onConfirm:()=>{p&&a.mutate({workflowId:p})}})},t[57]=p,t[58]=a,t[59]=n,t[60]=ce):ce=t[60];let le=ce,ue;t[61]!==T||t[62]!==n?(ue=()=>{n.confirm({title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,onConfirm:()=>T()})},t[61]=T,t[62]=n,t[63]=ue):ue=t[63];let de=ue,fe;t[64]!==p||t[65]!==m||t[66]!==E||t[67]!==n?(fe=()=>{n.confirm({title:`Delete Workflow`,message:`Are you sure you want to delete "${m}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,onConfirm:()=>{p&&E.mutate({workflowId:p},{onSuccess:()=>n.dismiss?.()})}})},t[64]=p,t[65]=m,t[66]=E,t[67]=n,t[68]=fe):fe=t[68];let pe=fe,me=P?.data.type===`action`&&!P.data.config?.actionType&&v,he;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`You are viewing a public workflow. Duplicate it to make changes.`})}),t[69]=he):he=t[69];let ge=he,_e=()=>V?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{children:`Selection`}),(0,X.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[U,` selected`]})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:se,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):I&&!P?(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-id`,children:`Connection ID`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-id`,value:I.id})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-source`,children:`Source`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-source`,value:I.source})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`edge-target`,children:`Target`}),(0,X.jsx)(wX,{disabled:!0,id:`edge-target`,value:I.target})]}),v?(0,X.jsx)(`div`,{className:`flex items-center gap-2 pt-4`,children:(0,X.jsxs)(zv,{onClick:ae,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})}):null]}):P?me?(0,X.jsx)(`div`,{className:`px-4 pt-4`,children:(0,X.jsx)(fve,{disabled:f,isNewlyCreated:P.id===D,onSelectAction:e=>{r({actionType:e}),P.id===D&&O(null)}},P.id)}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[P.data.type===`group`?(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Lookups and a Condition in a single-entry, single-exit frame. Lookups may run side by side and join at the Condition. True continues; False with no outgoing edge ends that path.`}):null,P.data.type===`lifecycle`?(0,X.jsx)(Bve,{config:P.data.config||{},disabled:f||!v,onUpdateConfig:r}):null,P.data.type===`action`&&!P.data.config?.actionType?(0,X.jsx)(`div`,{className:`rounded-lg border border-muted bg-muted/30 p-3`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No action configured for this step.`})}):null,P.data.type===`action`&&P.data.config?.actionType?(0,X.jsx)(E_e,{config:P.data.config||{},disabled:f||!v,isOwner:v,onUpdateConfig:r},P.id):null,P.data.type!==`action`||P.data.config?.actionType?(0,X.jsxs)(`div`,{className:P.data.type===`lifecycle`?`space-y-3 rounded-md border border-muted/70 bg-muted/20 p-3`:`space-y-4`,children:[P.data.type===`lifecycle`?(0,X.jsx)(`p`,{className:`font-medium text-muted-foreground text-sm`,children:`Node Metadata`}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`label`,children:`Label`}),(0,X.jsx)(wX,{disabled:f||!v,id:`label`,onChange:e=>W(e.target.value),value:P.data.label})]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`description`,children:`Description`}),(0,X.jsx)(wX,{disabled:f||!v,id:`description`,onChange:e=>G(e.target.value),placeholder:`Optional description`,value:P.data.description||``})]})]}):null,v?null:ge,v&&P.parentId?(0,X.jsx)(`p`,{className:`pt-4 text-muted-foreground text-xs`,children:`This step runs with its Group. Select the frame to switch it off.`}):null,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[q?(0,X.jsx)(zv,{onClick:ee,size:`sm`,variant:`outline`,children:J?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ny,{className:`mr-2 size-4`}),`Disabled`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ry,{className:`mr-2 size-4`}),`Enabled`]})}):null,P4(P)?(0,X.jsxs)(zv,{onClick:()=>x(P.id),size:`sm`,variant:`outline`,children:[(0,X.jsx)(my,{className:`mr-2 size-4`}),`Ungroup`]}):null,M4([P])?null:(0,X.jsxs)(zv,{onClick:re,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}):(0,X.jsxs)(`div`,{className:`space-y-4 p-4`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`workflow-name`,children:`Workflow Name`}),(0,X.jsx)(wX,{className:g?`border-destructive`:void 0,disabled:!v,id:`workflow-name`,onChange:e=>ne(e.target.value),value:m}),g?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:g}):null]}),(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(TX,{htmlFor:`workflow-id`,children:`Workflow ID`}),(0,X.jsx)(wX,{disabled:!0,id:`workflow-id`,value:p||`Not saved`})]}),v?null:ge,v?(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-4`,children:[(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:de,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear`]}),(0,X.jsxs)(zv,{onClick:pe,size:`sm`,variant:`outline`,children:[(0,X.jsx)(fy,{className:`mr-2 size-4 text-destructive`}),(0,X.jsx)(`span`,{className:`text-destructive`,children:`Delete`})]})]}):null]}),ve=P||I||V?`Properties`:`Workflow`,ye;t[70]!==n.tabs||t[71]!==v||t[72]!==s||t[73]!==ve||t[74]!==o?(ye=(0,X.jsx)(Pye,{activeTab:o,onSelect:s,placement:n.tabs,propertiesLabel:ve,showRuns:v}),t[70]=n.tabs,t[71]=v,t[72]=s,t[73]=ve,t[74]=o,t[75]=ye):ye=t[75],N=ye,k=`flex min-h-0 flex-1 flex-col`,A=`properties-panel`,j=n.tabs===`top`?N:null,M=o===`properties`?(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain [scrollbar-gutter:stable_both-edges]`,children:_e()}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b px-4 py-2`,children:[(0,X.jsxs)(zv,{onClick:i,size:`sm`,variant:`outline`,children:[(0,X.jsx)(Dte,{className:`mr-2 size-4`}),`Refresh`]}),(0,X.jsxs)(zv,{className:`text-muted-foreground`,onClick:le,size:`sm`,variant:`ghost`,children:[(0,X.jsx)(ty,{className:`mr-2 size-4`}),`Clear All`]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable_both-edges]`,children:(0,X.jsx)(jye,{})})]}),t[0]=T,t[1]=p,t[2]=m,t[3]=C,t[4]=b,t[5]=a,t[6]=w,t[7]=E,t[8]=d,t[9]=n,t[10]=i,t[11]=r,t[12]=f,t[13]=v,t[14]=D,t[15]=u,t[16]=h,t[17]=l,t[18]=c,t[19]=s,t[20]=S,t[21]=O,t[22]=_,t[23]=x,t[24]=y,t[25]=o,t[26]=g,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31];let P=n.tabs===`bottom`?N:null,F;return t[76]!==k||t[77]!==A||t[78]!==j||t[79]!==M||t[80]!==P?(F=(0,X.jsxs)(`div`,{className:k,"data-testid":A,children:[j,M,P]}),t[76]=k,t[77]=A,t[78]=j,t[79]=M,t[80]=P,t[81]=F):F=t[81],F}function Fye(e){return e.selected}function Iye(e){return e.selected}function D7(e){let t=(0,Z.c)(16),{overlayId:n}=e,{push:r,closeAll:i}=RY(),a=Nye(),o=jY(),s;t[0]!==i||t[1]!==o?(s=()=>{o||i()},t[0]=i,t[1]=o,t[2]=s):s=t[2],vY(o,s);let c;t[3]===r?c=t[4]:(c=e=>{let{title:t,message:n,confirmLabel:i,onConfirm:a}=e;return r(CX,{title:t,message:n,confirmLabel:i,confirmVariant:`destructive`,destructive:!0,onConfirm:a})},t[3]=r,t[4]=c);let l;t[5]!==i||t[6]!==c?(l={confirm:c,dismiss:i,tabs:`bottom`},t[5]=i,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]!==n||t[9]!==a?(d=(0,X.jsx)(xX,{overlayId:n,title:a}),t[8]=n,t[9]=a,t[10]=d):d=t[10];let f;t[11]===u?f=t[12]:(f=(0,X.jsx)(E7,{frame:u}),t[11]=u,t[12]=f);let p;return t[13]!==d||t[14]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-full max-h-[80vh] flex-col`,children:[d,f]}),t[13]=d,t[14]=f,t[15]=p):p=t[15],p}function O7(){let e=(0,Z.c)(11),{open:t,push:n}=RY(),r=l7(),i;e[0]===r?i=e[1]:(i=()=>{AY()&&r()},e[0]=r,e[1]=i);let a=i,o;e[2]!==a||e[3]!==t?(o=()=>{t(D7,{},{onClose:a})},e[2]=a,e[3]=t,e[4]=o):o=e[4];let s=o,c;e[5]!==a||e[6]!==n?(c=()=>{n(D7,{},{onClose:a})},e[5]=a,e[6]=n,e[7]=c):c=e[7];let l=c,u;return e[8]!==s||e[9]!==l?(u={openSheet:s,pushSheet:l},e[8]=s,e[9]=l,e[10]=u):u=e[10],u}function Lye(){let e=(0,Z.c)(2),t=rE(Rye),n;return e[0]===t?n=e[1]:(n=()=>{document.documentElement.style.setProperty(`--rf-zoom`,String(t))},e[0]=t,e[1]=n),vY(t,n),null}function Rye(e){return e.transform[2]}var zye=e=>{let t=(0,Z.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({children:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`Backspace`,`Delete`],t[3]=i):i=t[3];let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=[`Meta`,`Control`,`Shift`],t[4]=a):a=t[4];let o,s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(Lye,{}),s=(0,X.jsx)(tk,{bgColor:`var(--sidebar)`,color:`var(--border)`,gap:24,size:2}),t[5]=o,t[6]=s):(o=t[5],s=t[6]);let c;return t[7]!==n||t[8]!==r?(c=(0,X.jsxs)(WO,{deleteKeyCode:i,fitView:!0,multiSelectionKeyCode:a,panActivationKeyCode:null,selectionOnDrag:!1,zoomOnDoubleClick:!1,zoomOnPinch:!0,...r,children:[o,s,n]}),t[7]=n,t[8]=r,t[9]=c):c=t[9],c},Bye=16,Vye=16;function k7(e){return mT({...e,borderRadius:Bye,offset:Vye})}var Hye=e=>{let t=(0,Z.c)(15),{fromX:n,fromY:r,fromPosition:i,toX:a,toY:o,toPosition:s}=e,c;t[0]!==i||t[1]!==n||t[2]!==r||t[3]!==s||t[4]!==a||t[5]!==o?(c=k7({sourceX:n,sourceY:r,sourcePosition:i,targetX:a,targetY:o,targetPosition:s}),t[0]=i,t[1]=n,t[2]=r,t[3]=s,t[4]=a,t[5]=o,t[6]=c):c=t[6];let[l]=c,u;t[7]===l?u=t[8]:(u=(0,X.jsx)(`path`,{className:`animated`,d:l,fill:`none`,stroke:`var(--color-ring)`,strokeDasharray:`5, 5`,strokeWidth:1}),t[7]=l,t[8]=u);let d;t[9]!==a||t[10]!==o?(d=(0,X.jsx)(`circle`,{cx:a,cy:o,fill:`#fff`,r:3,stroke:`var(--color-ring)`,strokeWidth:1}),t[9]=a,t[10]=o,t[11]=d):d=t[11];let f;return t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`g`,{children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14],f},Uye=d_(`flex w-fit shrink-0 items-stretch has-[>[data-slot=button-group]]:gap-2 [&>*]:focus-visible:relative [&>*]:focus-visible:z-10 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`[&>*:not(:first-child)]:rounded-l-none [&>*:not(:first-child)]:border-l-0 [&>*:not(:last-child)]:rounded-r-none`,vertical:`flex-col [&>*:not(:first-child)]:rounded-t-none [&>*:not(:first-child)]:border-t-0 [&>*:not(:last-child)]:rounded-b-none`}},defaultVariants:{orientation:`horizontal`}});function A7(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,orientation:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==r?(a=Q(Uye({orientation:r}),n),t[4]=n,t[5]=r,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,X.jsx)(`div`,{className:a,"data-orientation":r,"data-slot":`button-group`,role:`group`,...i}),t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}var Wye=e=>{let t=(0,Z.c)(33),{onReflow:n,canReflow:r}=e,i=r===void 0||r,{zoomIn:a,zoomOut:o,fitView:s}=RE(),[c,l]=EA(_2),u;t[0]===a?u=t[1]:(u=()=>{a()},t[0]=a,t[1]=u);let d=u,f;t[2]===o?f=t[3]:(f=()=>{o()},t[2]=o,t[3]=f);let p=f,m;t[4]===s?m=t[5]:(m=()=>{s({padding:.2,duration:300})},t[4]=s,t[5]=m);let h=m,g;t[6]!==l||t[7]!==c?(g=()=>{l(!c)},t[6]=l,t[7]=c,t[8]=g):g=t[8];let _=g,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Pte,{className:`size-4`}),t[9]=v):v=t[9];let y;t[10]===d?y=t[11]:(y=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:d,size:`icon`,title:`Zoom in`,variant:`secondary`,children:v}),t[10]=d,t[11]=y);let b;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsx)(Fte,{className:`size-4`}),t[12]=b):b=t[12];let x;t[13]===p?x=t[14]:(x=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:p,size:`icon`,title:`Zoom out`,variant:`secondary`,children:b}),t[13]=p,t[14]=x);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(xte,{className:`size-4`}),t[15]=S):S=t[15];let C;t[16]===h?C=t[17]:(C=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:h,size:`icon`,title:`Fit view`,variant:`secondary`,children:S}),t[16]=h,t[17]=C);let w=c?`Hide minimap`:`Show minimap`,T;t[18]===c?T=t[19]:(T=c?(0,X.jsx)(bte,{className:`size-4`}):(0,X.jsx)(yte,{className:`size-4`}),t[18]=c,t[19]=T);let E;t[20]!==_||t[21]!==w||t[22]!==T?(E=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,onClick:_,size:`icon`,title:w,variant:`secondary`,children:T}),t[20]=_,t[21]=w,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==i||t[25]!==n?(D=n?(0,X.jsx)(zv,{"aria-label":`Reflow nodes`,className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:!i,onClick:n,size:`icon`,title:`Reflow nodes`,variant:`secondary`,children:(0,X.jsx)(Ete,{className:`size-4`})}):null,t[24]=i,t[25]=n,t[26]=D):D=t[26];let O;return t[27]!==C||t[28]!==E||t[29]!==D||t[30]!==y||t[31]!==x?(O=(0,X.jsxs)(A7,{orientation:`vertical`,children:[y,x,C,E,D]}),t[27]=C,t[28]=E,t[29]=D,t[30]=y,t[31]=x,t[32]=O):O=t[32],O};function j7(e){return new Date(e).toLocaleDateString(`en-US`,{month:`short`,day:`numeric`,year:`numeric`})}function Gye(e){navigator.clipboard.writeText(e),Ty.success(`Copied to clipboard`)}function Kye(e){let t=(0,Z.c)(19),{overlayId:n,onCreated:r}=e,{pop:i}=RY(),a=Fe(),[o,s]=(0,Y.useState)(``),c;t[0]!==r||t[1]!==i||t[2]!==a?(c=r0.apiKey.create.mutationOptions({onSuccess:async e=>{r(e.key),Ty.success(`API key created successfully`),await a.invalidateQueries({queryKey:r0.apiKey.key()}),i()},meta:{errorMessage:`Failed to create API key`}}),t[0]=r,t[1]=i,t[2]=a,t[3]=c):c=t[3];let l=Ze(c),u;t[4]!==l||t[5]!==o?(u=()=>l.mutate({name:o||null}),t[4]=l,t[5]=o,t[6]=u):u=t[6];let d;t[7]!==l.isPending||t[8]!==u?(d=[{label:`Create`,onClick:u,loading:l.isPending}],t[7]=l.isPending,t[8]=u,t[9]=d):d=t[9];let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(`p`,{className:`mb-4 text-muted-foreground text-sm`,children:`Create a new API key for webhook authentication`}),t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(TX,{htmlFor:`key-name`,children:`Label (optional)`}),t[11]=p):p=t[11];let m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=e=>s(e.target.value),t[12]=m):m=t[12];let h;t[13]===o?h=t[14]:(h=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[p,(0,X.jsx)(wX,{id:`key-name`,onChange:m,placeholder:`e.g., Production, Testing`,value:o})]}),t[13]=o,t[14]=h);let g;return t[15]!==n||t[16]!==d||t[17]!==h?(g=(0,X.jsxs)(SX,{actions:d,overlayId:n,title:`Create API Key`,children:[f,h]}),t[15]=n,t[16]=d,t[17]=h,t[18]=g):g=t[18],g}function qye(e){let t=(0,Z.c)(26),{overlayId:n}=e,{push:r,closeAll:i}=RY(),a=Fe(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...r0.apiKey.getAll.queryOptions({input:{}}),meta:{errorMessage:`Failed to load API keys`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,[d,f]=(0,Y.useState)(null),p;t[3]===a?p=t[4]:(p=r0.apiKey.delete.mutationOptions({onSuccess:async()=>{Ty.success(`API key deleted`),await a.invalidateQueries({queryKey:r0.apiKey.key()})},meta:{errorMessage:`Failed to delete API key`}}),t[3]=a,t[4]=p);let m=Ze(p),h=m.isPending?m.variables?.keyId:void 0,g;t[5]!==m||t[6]!==r?(g=e=>{r(CX,{title:`Delete API Key`,message:`Are you sure you want to delete this API key? Any webhooks using this key will stop working immediately.`,confirmLabel:`Delete`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>m.mutate({keyId:e})})},t[5]=m,t[6]=r,t[7]=g):g=t[7];let _=g,v;t[8]===r?v=t[9]:(v={label:`New API Key`,variant:`outline`,onClick:()=>r(Kye,{onCreated:f})},t[8]=r,t[9]=v);let y;t[10]===i?y=t[11]:(y={label:`Done`,onClick:i},t[10]=i,t[11]=y);let b;t[12]!==v||t[13]!==y?(b=[v,y],t[12]=v,t[13]=y,t[14]=b):b=t[14];let x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys for webhook authentication`}),t[15]=x):x=t[15];let S;t[16]!==u||t[17]!==h||t[18]!==c||t[19]!==d||t[20]!==_?(S=c?(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}):(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d&&(0,X.jsxs)(`div`,{className:`rounded-md border border-warning/50 bg-warning/10 p-3`,children:[(0,X.jsx)(`p`,{className:`mb-2 font-medium text-sm text-warning`,children:`Copy your API key now. You won't be able to see it again!`}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`code`,{className:`flex-1 rounded bg-muted px-2 py-1 font-mono text-xs`,children:d}),(0,X.jsx)(zv,{onClick:()=>Gye(d),size:`sm`,variant:`outline`,children:(0,X.jsx)($v,{className:`size-4`})})]}),(0,X.jsx)(zv,{className:`mt-2`,onClick:()=>f(null),size:`sm`,variant:`ghost`,children:`Dismiss`})]}),u.length===0?(0,X.jsxs)(`div`,{className:`py-8 text-center text-muted-foreground text-sm`,children:[(0,X.jsx)(iy,{className:`mx-auto mb-2 size-8 opacity-50`}),(0,X.jsx)(`p`,{children:`No API keys yet`}),(0,X.jsx)(`p`,{className:`text-xs`,children:`Create an API key to authenticate webhook requests`})]}):(0,X.jsx)(`div`,{className:`space-y-2`,children:u.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border p-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsxs)(`code`,{className:`rounded bg-muted px-1.5 py-0.5 font-mono text-xs`,children:[e.keyPrefix,`...`]}),e.name&&(0,X.jsx)(`span`,{className:`truncate text-sm`,children:e.name})]}),(0,X.jsxs)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:[`Created `,j7(e.createdAt),e.lastUsedAt&&` · Last used ${j7(e.lastUsedAt)}`]})]}),(0,X.jsx)(zv,{disabled:h===e.id,onClick:()=>_(e.id),size:`sm`,variant:`ghost`,children:h===e.id?(0,X.jsx)(_y,{className:`size-4`}):(0,X.jsx)(fy,{className:`size-4 text-destructive`})})]},e.id))})]}),t[16]=u,t[17]=h,t[18]=c,t[19]=d,t[20]=_,t[21]=S):S=t[21];let C;return t[22]!==n||t[23]!==S||t[24]!==b?(C=(0,X.jsxs)(SX,{actions:b,overlayId:n,title:`API Keys`,children:[x,S]}),t[22]=n,t[23]=S,t[24]=b,t[25]=C):C=t[25],C}function Jye(e){let t=(0,Z.c)(24),{filter:n}=e,r=n===void 0?``:n,i=yy(),{push:a}=RY(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={...i0(),meta:{errorMessage:`Failed to load integrations`}},t[0]=o):o=t[0];let{data:s,isPending:c}=Xe(o),l;t[1]===s?l=t[2]:(l=s===void 0?[]:s,t[1]=s,t[2]=l);let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=r0.integration.testConnection.mutationOptions({onSuccess:S3,meta:{errorMessage:`Connection test failed`}}),t[3]=d):d=t[3];let f=Ze(d),p;if(t[4]!==i||t[5]!==r||t[6]!==u){let e=r.toLowerCase(),n;t[8]===i?n=t[9]:(n=e=>{let t=Fy(i,e.type);return{...e,label:t?.label??e.type,hasTest:t?.hasTest===!0,known:t!==void 0}},t[8]=i,t[9]=n),p=u.map(n).filter(t=>!r||t.label.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||t.type.toLowerCase().includes(e)).toSorted(Yye),t[4]=i,t[5]=r,t[6]=u,t[7]=p}else p=t[7];let m=p,h;t[10]===a?h=t[11]:(h=e=>{a(w3,{integration:e})},t[10]=a,t[11]=h);let g=h,_;t[12]===a?_=t[13]:(_=e=>{a(T3,{integration:e})},t[12]=a,t[13]=_);let v=_,y=f.isPending?f.variables?.integrationId:void 0;if(c){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,X.jsx)(_y,{})}),t[14]=e):e=t[14],e}let b;t[15]!==v||t[16]!==g||t[17]!==u.length||t[18]!==m||t[19]!==f||t[20]!==y?(b=()=>u.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections configured yet`})}):m.length===0?(0,X.jsx)(`div`,{className:`py-8 text-center`,children:(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No connections match your filter`})}):(0,X.jsx)(`div`,{className:`space-y-1`,children:m.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center justify-between rounded-md px-2 py-1.5`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(b3,{className:`size-4`,integration:e.type}),(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:e.label}),(0,X.jsx)(`span`,{className:`text-muted-foreground text-sm`,children:e.name}),e.known?null:(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Not available in this build`})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.hasTest&&(0,X.jsx)(zv,{className:`h-7 px-2`,disabled:y===e.id,onClick:()=>f.mutate({integrationId:e.id}),size:`sm`,variant:`outline`,children:y===e.id?(0,X.jsx)(_y,{className:`size-3`}):(0,X.jsx)(`span`,{className:`text-xs`,children:`Test`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>g(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(oy,{className:`size-3`})}),(0,X.jsx)(zv,{className:`size-7`,onClick:()=>v(e),size:`icon`,variant:`outline`,children:(0,X.jsx)(fy,{className:`size-3`})})]})]},e.id))}),t[15]=v,t[16]=g,t[17]=u.length,t[18]=m,t[19]=f,t[20]=y,t[21]=b):b=t[21];let x=b,S;return t[22]===x?S=t[23]:(S=(0,X.jsx)(`div`,{className:`space-y-1`,children:x()}),t[22]=x,t[23]=S),S}function Yye(e,t){let n=e.label.localeCompare(t.label);return n===0?e.name.localeCompare(t.name):n}function Xye(e){let t=(0,Z.c)(25),{overlayId:n}=e,{push:r,closeAll:i}=RY(),[a,o]=(0,Y.useState)(``),s;t[0]===r?s=t[1]:(s=()=>{r(bpe,{})},t[0]=r,t[1]=s);let c=s,l;t[2]===i?l=t[3]:(l=()=>i(),t[2]=i,t[3]=l);let u=l,d;t[4]===c?d=t[5]:(d={label:`Add Connection`,variant:`outline`,onClick:c},t[4]=c,t[5]=d);let f;t[6]===u?f=t[7]:(f={label:`Done`,onClick:u},t[6]=u,t[7]=f);let p;t[8]!==d||t[9]!==f?(p=[d,f],t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`p`,{className:`-mt-2 mb-4 text-muted-foreground text-sm`,children:`Manage API keys and credentials used by your workflows`}),t[11]=m):m=t[11];let h;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(ly,{className:`absolute top-1/2 left-3 size-4 -translate-y-1/2 text-muted-foreground`}),t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>o(e.target.value),t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=(0,X.jsxs)(`div`,{className:`relative`,children:[h,(0,X.jsx)(wX,{className:`pl-9`,onChange:g,placeholder:`Filter connections...`,value:a})]}),t[14]=a,t[15]=_);let v;t[16]===a?v=t[17]:(v=(0,X.jsx)(`div`,{className:`max-h-[300px] overflow-y-auto`,children:(0,X.jsx)(Jye,{filter:a})}),t[16]=a,t[17]=v);let y;t[18]!==v||t[19]!==_?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[_,v]}),t[18]=v,t[19]=_,t[20]=y):y=t[20];let b;return t[21]!==n||t[22]!==y||t[23]!==p?(b=(0,X.jsxs)(SX,{actions:p,overlayId:n,title:`Connections`,children:[m,y]}),t[21]=n,t[22]=y,t[23]=p,t[24]=b):b=t[24],b}var Zye=()=>{let e=(0,Z.c)(25),{theme:t,setTheme:n}=eX(),{open:r}=RY(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(U5,{render:(0,X.jsx)(zv,{className:`h-9`,size:`sm`,variant:`outline`}),children:`Settings`}),e[0]=i):i=e[0];let a;e[1]===r?a=e[2]:(a=()=>r(Xye),e[1]=r,e[2]=a);let o,s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,X.jsx)(wte,{className:`size-4`}),s=(0,X.jsx)(`span`,{children:`Connections`}),e[3]=o,e[4]=s):(o=e[3],s=e[4]);let c;e[5]===a?c=e[6]:(c=(0,X.jsxs)(G5,{onClick:a,children:[o,s]}),e[5]=a,e[6]=c);let l;e[7]===r?l=e[8]:(l=()=>r(qye),e[7]=r,e[8]=l);let u,d;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(iy,{className:`size-4`}),d=(0,X.jsx)(`span`,{children:`API Keys`}),e[9]=u,e[10]=d):(u=e[9],d=e[10]);let f;e[11]===l?f=e[12]:(f=(0,X.jsxs)(G5,{onClick:l,children:[u,d]}),e[11]=l,e[12]=f);let p;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(q5,{}),e[13]=p):p=e[13];let m;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsxs)(ive,{children:[(0,X.jsx)(jte,{className:`size-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0`}),(0,X.jsx)(Ste,{className:`absolute size-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100`}),(0,X.jsx)(`span`,{children:`Theme`})]}),e[14]=m):m=e[14];let h,g,_;e[15]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(K5,{value:`light`,children:`Light`}),g=(0,X.jsx)(K5,{value:`dark`,children:`Dark`}),_=(0,X.jsx)(K5,{value:`system`,children:`System`}),e[15]=h,e[16]=g,e[17]=_):(h=e[15],g=e[16],_=e[17]);let v;e[18]!==n||e[19]!==t?(v=(0,X.jsxs)(rve,{children:[m,(0,X.jsx)(ave,{children:(0,X.jsxs)(nve,{onValueChange:n,value:t,children:[h,g,_]})})]}),e[18]=n,e[19]=t,e[20]=v):v=e[20];let y;return e[21]!==v||e[22]!==c||e[23]!==f?(y=(0,X.jsxs)(H5,{children:[i,(0,X.jsxs)(W5,{align:`end`,className:`w-56`,children:[c,f,p,v]})]}),e[21]=v,e[22]=c,e[23]=f,e[24]=y):y=e[24],y};function Qye(e){let t=(0,Z.c)(5),{className:n}=e,r,i,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M125.776 0C120.929 1.64945e-05 117 3.9291 117 8.77539V61.4248C117 66.2711 120.929 70.2002 125.776 70.2002H160.875L161.253 70.2051C169.032 70.4023 175.301 76.6734 175.495 84.4531L175.5 84.8252V143.325C175.5 148.171 179.429 152.101 184.276 152.101H219.375L219.753 152.105C227.53 152.303 233.798 158.571 233.995 166.348L234 166.726V225.225C234 230.071 237.929 234 242.776 234H295.425C300.271 234 304.2 230.071 304.2 225.225V172.575C304.2 167.729 300.271 163.8 295.425 163.8H260.25C252.334 163.76 245.905 157.43 245.705 149.553L245.7 149.176V90.6758C245.7 85.8295 241.771 81.9004 236.925 81.9004H201.825C193.874 81.9004 187.405 75.5551 187.205 67.6523L187.2 67.2754V8.77539C187.2 3.9291 183.271 1.64951e-05 178.425 0H125.776Z`}),i=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M67.2755 81.9004C62.4293 81.9004 58.5002 85.8295 58.5002 90.6758V143.325C58.5004 148.171 62.4294 152.101 67.2755 152.101H102.375L102.753 152.105C110.53 152.303 116.798 158.571 116.995 166.348L117 166.726V225.225C117 230.071 120.929 234 125.776 234H178.425C183.271 234 187.2 230.071 187.2 225.225V172.575C187.2 167.729 183.271 163.8 178.425 163.8H143.25C135.334 163.76 128.905 157.43 128.705 149.553L128.7 149.176V90.6758C128.7 85.8295 124.771 81.9004 119.925 81.9004H67.2755Z`}),a=(0,X.jsx)(`path`,{className:`fill-foreground`,d:`M8.77454 163.8C3.92844 163.8 0.00012207 167.729 0.00012207 172.575V225.225C0.00012207 230.071 3.92844 234 8.77454 234H61.4249C66.2712 234 70.2003 230.071 70.2003 225.225V172.575C70.2003 167.729 66.2712 163.8 61.4249 163.8H8.77454Z`}),t[0]=r,t[1]=i,t[2]=a):(r=t[0],i=t[1],a=t[2]);let o;return t[3]===n?o=t[4]:(o=(0,X.jsxs)(`svg`,{className:n,fill:`none`,height:`16`,viewBox:`0 0 305 234`,width:`16`,xmlns:`http://www.w3.org/2000/svg`,children:[r,i,a]}),t[3]=n,t[4]=o),o}function $ye(e){let t=new Set(e.map(e=>e.toLowerCase())),n=`New Workflow`;if(!t.has(`new workflow`))return n;let r=2;for(;t.has(`${n} (${r})`.toLowerCase());)r+=1;return`${n} (${r})`}function M7(e){let t=(0,Z.c)(50),{open:n,onOpenChange:r,existingWorkflowNames:i,onCreated:a}=e,o;t[0]===i?o=t[1]:(o=()=>$ye(i),t[0]=i,t[1]=o);let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(null),d=Fe(),f;if(t[2]!==a||t[3]!==r||t[4]!==d){let e;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(e=e=>{u(e instanceof X1?e.message:`Failed to create workflow`)},t[6]=e):e=t[6],f=r0.workflow.create.mutationOptions({onSuccess:async e=>{await a0(d),await a(e.id),r(!1),Ty.success(`Workflow created`)},onError:e,meta:{errorShownByCaller:!0}}),t[2]=a,t[3]=r,t[4]=d,t[5]=f}else f=t[5];let p=Ze(f),m=p.isPending,h;t[7]!==p||t[8]!==s?(h=()=>{let e=s.trim();if(!e){u(`Workflow name is required.`);return}u(null),p.mutate({name:e,graph:B1({nodes:[],edges:[]})})},t[7]=p,t[8]=s,t[9]=h):h=t[9];let g=h,_;t[10]!==m||t[11]!==r?(_=e=>{e||m||r(!1)},t[10]=m,t[11]=r,t[12]=_):_=t[12];let v=_,y=!m,b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(fY,{children:[(0,X.jsx)(mY,{children:`Create Workflow`}),(0,X.jsx)(hY,{children:`Choose a name for the new workflow.`})]}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,X.jsx)(TX,{htmlFor:`create-workflow-name`,children:`Name`}),t[14]=x):x=t[14];let S=l?!0:void 0,C;t[15]===l?C=t[16]:(C=e=>{c(e.target.value),l&&u(null)},t[15]=l,t[16]=C);let w;t[17]===g?w=t[18]:(w=e=>{e.key===`Enter`&&(e.preventDefault(),g())},t[17]=g,t[18]=w);let T;t[19]!==m||t[20]!==w||t[21]!==S||t[22]!==C||t[23]!==s?(T=(0,X.jsx)(wX,{"aria-invalid":S,autoFocus:!0,disabled:m,id:`create-workflow-name`,onChange:C,onKeyDown:w,placeholder:`Workflow name`,value:s}),t[19]=m,t[20]=w,t[21]=S,t[22]=C,t[23]=s,t[24]=T):T=t[24];let E;t[25]===l?E=t[26]:(E=l?(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:l}):null,t[25]=l,t[26]=E);let D;t[27]!==T||t[28]!==E?(D=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[x,T,E]}),t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===r?O=t[31]:(O=()=>{r(!1)},t[30]=r,t[31]=O);let k;t[32]!==m||t[33]!==O?(k=(0,X.jsx)(zv,{disabled:m,onClick:O,type:`button`,variant:`outline`,children:`Cancel`}),t[32]=m,t[33]=O,t[34]=k):k=t[34];let A=m?`Creating...`:`Create Workflow`,j;t[35]!==g||t[36]!==m||t[37]!==A?(j=(0,X.jsx)(zv,{disabled:m,onClick:g,type:`button`,children:A}),t[35]=g,t[36]=m,t[37]=A,t[38]=j):j=t[38];let M;t[39]!==k||t[40]!==j?(M=(0,X.jsxs)(pY,{children:[k,j]}),t[39]=k,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==D||t[43]!==M||t[44]!==y?(N=(0,X.jsxs)(dY,{showCloseButton:y,children:[b,D,M]}),t[42]=D,t[43]=M,t[44]=y,t[45]=N):N=t[45];let P;return t[46]!==v||t[47]!==n||t[48]!==N?(P=(0,X.jsx)(cY,{onOpenChange:v,open:n,children:N}),t[46]=v,t[47]=n,t[48]=N,t[49]=P):P=t[49],P}function ebe(e){let t=(0,Z.c)(10),{isPublishing:n,disabled:r,handlePublish:i}=e,a=r||n,o=n?`Publishing...`:`Publish workflow`,s;t[0]===n?s=t[1]:(s=n?(0,X.jsx)(ay,{className:`size-4 animate-spin`,"data-icon":`inline-start`}):(0,X.jsx)(Nte,{className:`size-4`,"data-icon":`inline-start`}),t[0]=n,t[1]=s);let c=n?`Publishing`:`Publish`,l;t[2]===c?l=t[3]:(l=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:c}),t[2]=c,t[3]=l);let u;return t[4]!==i||t[5]!==a||t[6]!==o||t[7]!==s||t[8]!==l?(u=(0,X.jsxs)(zv,{className:`relative gap-1.5`,disabled:a,onClick:i,size:`default`,title:o,variant:`default`,children:[s,l]}),t[4]=i,t[5]=a,t[6]=o,t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function tbe(e){let t=(0,Z.c)(9),{state:n,handleSave:r}=e,i;t[0]===n.nodes?i=t[1]:(i=n.nodes.some(nbe),t[0]=n.nodes,t[1]=i);let a=!i||n.isGenerating||n.isSaving,o=n.isSaving?`Saving...`:`Save workflow`,s;t[2]===n.isSaving?s=t[3]:(s=n.isSaving?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(Ote,{className:`size-4`}),t[2]=n.isSaving,t[3]=s);let c;return t[4]!==r||t[5]!==a||t[6]!==o||t[7]!==s?(c=(0,X.jsx)(zv,{className:`relative border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:a,onClick:r,size:`icon`,title:o,variant:`secondary`,children:s}),t[4]=r,t[5]=a,t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function nbe(e){return e.type!==`add`}function rbe(e){let t=(0,Z.c)(8),{state:n,actions:r}=e,i=n.isExecuting||n.nodes.length===0||n.isGenerating||!n.currentWorkflowId,a;t[0]===r?a=t[1]:(a=()=>r.handleExecute(),t[0]=r,t[1]=a);let o;t[2]===n.isExecuting?o=t[3]:(o=n.isExecuting?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)(sy,{className:`size-4`}),t[2]=n.isExecuting,t[3]=o);let s;return t[4]!==i||t[5]!==a||t[6]!==o?(s=(0,X.jsx)(A7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:i,onClick:a,size:`icon`,title:`Run Workflow`,variant:`secondary`,children:o})}),t[4]=i,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function ibe(e){let t=(0,Z.c)(6),{isDuplicating:n,onDuplicate:r}=e,i;t[0]===n?i=t[1]:(i=n?(0,X.jsx)(ay,{className:`mr-2 size-4 animate-spin`}):(0,X.jsx)($v,{className:`mr-2 size-4`}),t[0]=n,t[1]=i);let a;return t[2]!==n||t[3]!==r||t[4]!==i?(a=(0,X.jsxs)(zv,{className:`h-9 border hover:bg-secondary dark:hover:bg-secondary`,disabled:n,onClick:r,size:`sm`,title:`Duplicate to your workflows`,variant:`secondary`,children:[i,`Duplicate`]}),t[2]=n,t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function abe(e){let t=(0,Z.c)(79),{workflowId:n,state:r,actions:i}=e,{push:a}=RY(),{openSheet:o}=O7(),[s]=EA(H4),[c]=EA(U4),l=wA(Q4),u=wA($4),d=TA(h3),f=TA(Z4),{screenToFlowPosition:p}=RE(),m=jY(),h=wA(n3),g;if(t[0]!==l||t[1]!==s){let e;t[3]===s?e=t[4]:(e=e=>e.id===s,t[3]=s,t[4]=e),g=l.find(e),t[0]=l,t[1]=s,t[2]=g}else g=t[2];let _=g,v;if(t[5]!==u||t[6]!==c){let e;t[8]===c?e=t[9]:(e=e=>e.id===c,t[8]=c,t[9]=e),v=u.find(e),t[5]=u,t[6]=c,t[7]=v}else v=t[7];let y=_||v,b;t[10]!==h||t[11]!==r?(b=h||r.isSaving||!r.nodes.some(obe),t[10]=h,t[11]=r,t[12]=b):b=t[12];let x=b;if(n&&!r.isOwner)return null;let S;t[13]!==f||t[14]!==d||t[15]!==a||t[16]!==c||t[17]!==s?(S=()=>{let e=s?`Node`:`Connection`;a(CX,{title:`Delete ${e}`,message:`Are you sure you want to delete this ${e.toLowerCase()}? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s?d(s):c&&f(c)}})},t[13]=f,t[14]=d,t[15]=a,t[16]=c,t[17]=s,t[18]=S):S=t[18];let C=S,w;t[19]!==p||t[20]!==r?(w=()=>{let e=document.querySelector(`.react-flow`);if(!e)return;let t=e.getBoundingClientRect(),n=t.left+t.width/2,i=t.top+t.height/2,a=p({x:n,y:i});a.x-=96,a.y-=56;let o={...a},s=!0,c=0;for(;s&&c<20;)s=r.nodes.some(e=>Math.abs(e.position.x-o.x)<192&&Math.abs(e.position.y-o.y)<112),s&&(o.x+=20,o.y+=20,c+=1);let l={id:u0(),type:`action`,position:o,data:{label:``,description:``,type:`action`,config:{},status:`idle`}};r.addNode(l),r.setSelectedNodeId(l.id),r.setActiveTab(`properties`)},t[19]=p,t[20]=r,t[21]=w):w=t[21];let T=w,E;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(cy,{className:`size-4`}),t[22]=E):E=t[22];let D;t[23]!==T||t[24]!==r.isGenerating?(D=(0,X.jsx)(A7,{className:`flex`,orientation:`horizontal`,children:(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:r.isGenerating,onClick:T,size:`icon`,title:`Add Step`,variant:`secondary`,children:E})}),t[23]=T,t[24]=r.isGenerating,t[25]=D):D=t[25];let O=m?``:`hidden`,k;t[26]===O?k=t[27]:(k=Q(`flex`,O),t[26]=O,t[27]=k);let A;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,X.jsx)(uy,{className:`size-4`}),t[28]=A):A=t[28];let j;t[29]===o?j=t[30]:(j=(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:o,size:`icon`,title:`Configuration`,variant:`secondary`,children:A}),t[29]=o,t[30]=j);let M;t[31]!==C||t[32]!==y?(M=y&&(0,X.jsx)(zv,{className:`border hover:bg-secondary dark:hover:bg-secondary`,onClick:C,size:`icon`,title:`Delete`,variant:`secondary`,children:(0,X.jsx)(fy,{className:`size-4`})}),t[31]=C,t[32]=y,t[33]=M):M=t[33];let N;t[34]!==j||t[35]!==M||t[36]!==k?(N=(0,X.jsxs)(A7,{className:k,orientation:`horizontal`,children:[j,M]}),t[34]=j,t[35]=M,t[36]=k,t[37]=N):N=t[37];let P=!r.canUndo||r.isGenerating,F;t[38]===r?F=t[39]:(F=()=>r.undo(),t[38]=r,t[39]=F);let I;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,X.jsx)(Mte,{className:`size-4`}),t[40]=I):I=t[40];let L;t[41]!==P||t[42]!==F?(L=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:P,onClick:F,size:`icon`,title:`Undo`,variant:`secondary`,children:I}),t[41]=P,t[42]=F,t[43]=L):L=t[43];let R=!r.canRedo||r.isGenerating,z;t[44]===r?z=t[45]:(z=()=>r.redo(),t[44]=r,t[45]=z);let B;t[46]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,X.jsx)(Tte,{className:`size-4`}),t[46]=B):B=t[46];let V;t[47]!==R||t[48]!==z?(V=(0,X.jsx)(zv,{className:`border hover:bg-secondary disabled:opacity-100 dark:hover:bg-secondary disabled:[&>svg]:text-muted-foreground`,disabled:R,onClick:z,size:`icon`,title:`Redo`,variant:`secondary`,children:B}),t[47]=R,t[48]=z,t[49]=V):V=t[49];let H;t[50]!==L||t[51]!==V?(H=(0,X.jsxs)(A7,{className:`flex`,orientation:`horizontal`,children:[L,V]}),t[50]=L,t[51]=V,t[52]=H):H=t[52];let U;t[53]!==i.handleSave||t[54]!==r?(U=(0,X.jsx)(tbe,{handleSave:i.handleSave,state:r}),t[53]=i.handleSave,t[54]=r,t[55]=U):U=t[55];let W;t[56]!==i.handlePublish||t[57]!==i.isPublishing||t[58]!==x?(W=(0,X.jsx)(ebe,{disabled:x,handlePublish:i.handlePublish,isPublishing:i.isPublishing}),t[56]=i.handlePublish,t[57]=i.isPublishing,t[58]=x,t[59]=W):W=t[59];let G;t[60]!==U||t[61]!==W?(G=(0,X.jsxs)(A7,{className:`flex`,orientation:`horizontal`,children:[U,W]}),t[60]=U,t[61]=W,t[62]=G):G=t[62];let K;t[63]!==i||t[64]!==r?(K=(0,X.jsx)(rbe,{actions:i,state:r}),t[63]=i,t[64]=r,t[65]=K):K=t[65];let q;t[66]!==i||t[67]!==r.isGenerating||t[68]!==r.isSaving||t[69]!==r.workflowMode||t[70]!==n?(q=n&&(0,X.jsx)(A7,{"aria-label":`Workflow mode`,className:`flex`,orientation:`horizontal`,role:`radiogroup`,children:[`live`,`test`].map(e=>{let t=r.workflowMode===e;return(0,X.jsx)(zv,{"aria-checked":t,className:`border`,disabled:r.isSaving||r.isGenerating,onClick:()=>i.handleSetWorkflowMode(e),role:`radio`,size:`default`,variant:t?`default`:`outline`,children:e===`live`?`Live`:`Test`},e)})}),t[66]=i,t[67]=r.isGenerating,t[68]=r.isSaving,t[69]=r.workflowMode,t[70]=n,t[71]=q):q=t[71];let J;return t[72]!==N||t[73]!==H||t[74]!==G||t[75]!==K||t[76]!==q||t[77]!==D?(J=(0,X.jsxs)(X.Fragment,{children:[D,N,H,G,K,q]}),t[72]=N,t[73]=H,t[74]=G,t[75]=K,t[76]=q,t[77]=D,t[78]=J):J=t[78],J}function obe(e){return e.type!==`add`}function sbe(e){let t=(0,Z.c)(52),{workflowId:n,state:r,actions:i}=e,a=Gi(),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(0),u;t[0]===a?u=t[1]:(u=()=>a({to:`/`}),t[0]=a,t[1]=u);let d,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,X.jsx)(Qye,{className:`size-4 shrink-0`}),f=(0,X.jsx)(`span`,{className:`hidden @xl:inline`,children:`Dashboard`}),t[2]=d,t[3]=f):(d=t[2],f=t[3]);let p;t[4]===u?p=t[5]:(p=(0,X.jsxs)(`button`,{className:`flex h-full shrink-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,onClick:u,type:`button`,children:[d,f]}),t[4]=u,t[5]=p);let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted-foreground/60`,children:`/`}),t[6]=m):m=t[6];let h;t[7]===i?h=t[8]:(h=e=>e&&i.loadWorkflows(),t[7]=i,t[8]=h);let g=r.workflowName||`Untitled workflow`,_;t[9]===g?_=t[10]:(_=(0,X.jsx)(`p`,{className:`truncate font-medium text-sm`,children:g}),t[9]=g,t[10]=_);let v;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Jv,{className:`size-3 shrink-0 opacity-50`}),t[11]=v):v=t[11];let y;t[12]===_?y=t[13]:(y=(0,X.jsxs)(U5,{className:`flex h-full min-w-0 cursor-pointer items-center gap-2 px-3 font-medium text-sm transition-all hover:bg-accent dark:hover:bg-accent`,children:[_,v]}),t[12]=_,t[13]=y);let b,x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,X.jsxs)(G5,{className:`flex items-center gap-2`,onClick:()=>{l(ube),s(!0)},children:[(0,X.jsx)(cy,{className:`size-4`}),`New Workflow...`]}),x=(0,X.jsx)(q5,{}),t[14]=b,t[15]=x):(b=t[14],x=t[15]);let S;t[16]!==a||t[17]!==r.allWorkflows||t[18]!==r.currentWorkflowId?(S=r.allWorkflows.length===0?(0,X.jsx)(G5,{disabled:!0,children:`No workflows found`}):r.allWorkflows.filter(lbe).map(e=>(0,X.jsxs)(G5,{className:`flex items-center justify-between`,onClick:()=>a({to:`/workflows/$workflowId`,params:{workflowId:e.id}}),children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.name}),e.id===r.currentWorkflowId&&(0,X.jsx)(qv,{className:`size-4 shrink-0`})]},e.id)),t[16]=a,t[17]=r.allWorkflows,t[18]=r.currentWorkflowId,t[19]=S):S=t[19];let C;t[20]!==i||t[21]!==r.isOwner||t[22]!==n?(C=n&&r.isOwner&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q5,{}),(0,X.jsxs)(G5,{className:`flex items-center gap-2`,disabled:i.isDuplicating,onClick:i.handleDuplicate,children:[i.isDuplicating?(0,X.jsx)(ay,{className:`size-4 animate-spin`}):(0,X.jsx)($v,{className:`size-4`}),`Duplicate`]}),(0,X.jsxs)(G5,{className:`flex items-center gap-2 text-destructive focus:text-destructive`,onClick:i.handleDeleteWorkflow,children:[(0,X.jsx)(fy,{className:`size-4`}),`Delete Workflow`]})]}),t[20]=i,t[21]=r.isOwner,t[22]=n,t[23]=C):C=t[23];let w;t[24]!==S||t[25]!==C?(w=(0,X.jsxs)(W5,{align:`start`,className:`w-64`,children:[b,x,S,C]}),t[24]=S,t[25]=C,t[26]=w):w=t[26];let T;t[27]!==y||t[28]!==w||t[29]!==h?(T=(0,X.jsxs)(H5,{onOpenChange:h,children:[y,w]}),t[27]=y,t[28]=w,t[29]=h,t[30]=T):T=t[30];let E;t[31]!==T||t[32]!==p?(E=(0,X.jsxs)(`div`,{className:`flex h-9 max-w-[260px] items-center overflow-hidden rounded-md border bg-secondary text-secondary-foreground sm:max-w-none`,children:[p,m,T]}),t[31]=T,t[32]=p,t[33]=E):E=t[33];let D;t[34]!==r.isOwner||t[35]!==n?(D=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs @xl:hidden`,children:`Read-only`}),t[34]=r.isOwner,t[35]=n,t[36]=D):D=t[36];let O;t[37]!==E||t[38]!==D?(O=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[E,D]}),t[37]=E,t[38]=D,t[39]=O):O=t[39];let k;t[40]===r.allWorkflows?k=t[41]:(k=r.allWorkflows.map(cbe),t[40]=r.allWorkflows,t[41]=k);let A;t[42]===a?A=t[43]:(A=e=>a({to:`/workflows/$workflowId`,params:{workflowId:e}}),t[42]=a,t[43]=A);let j;t[44]!==c||t[45]!==o||t[46]!==k||t[47]!==A?(j=(0,X.jsx)(M7,{existingWorkflowNames:k,onCreated:A,onOpenChange:s,open:o},c),t[44]=c,t[45]=o,t[46]=k,t[47]=A,t[48]=j):j=t[48];let M;return t[49]!==O||t[50]!==j?(M=(0,X.jsxs)(X.Fragment,{children:[O,j]}),t[49]=O,t[50]=j,t[51]=M):M=t[51],M}function cbe(e){return e.name}function lbe(e){return e.name!==`__current__`}function ube(e){return e+1}function dbe(e,t){if(!t)return;let n=t.trim();if(!n)return;let r=Ka(n.split(`.`)),i=e;for(let e of r){if(i==null)return;if(Array.isArray(i)){if(!/^\d+$/.test(e))return;let t=Number(e);if(!Number.isSafeInteger(t))return;i=i[t];continue}if(typeof i==`object`){i=i[e];continue}return}return i}function fbe(e,t,n){let r=Ka(t.trim().split(`.`)),i=r.pop();if(!i)return e;let a=e;for(let e of r){let t=a[e],n=typeof t==`object`&&t&&!Array.isArray(t)?t:{};a[e]=n,a=n}return a[i]=n,e}function pbe(e){return!e.path.includes(`[`)&&e.type!==`array`&&e.type!==`object`}function mbe(e){return e.enumValues&&e.enumValues.length>0?`select`:e.type===`boolean`?`checkbox`:e.type===`number`?`number`:e.type===`timestamp`?`datetime`:`text`}function N7(e){return e?e.payloadFields.filter(pbe).map(e=>({path:e.path,...e.description?{description:e.description}:{},control:mbe(e),...e.enumValues?{options:[...e.enumValues]}:{},optional:e.nullable===!0})):[]}function hbe(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function P7(e,t){let n={};for(let r of e){let e=dbe(t,r.path);if(e==null){n[r.path]=``;continue}let i=typeof e==`string`?e:JSON.stringify(e);n[r.path]=r.control===`datetime`?hbe(i):i}return n}function gbe(e,t){let n=t.trim();if(n){if(e.control===`checkbox`)return n===`true`;if(e.control===`number`){let e=Number(n);return Number.isFinite(e)?e:n}if(e.control===`datetime`){let e=new Date(n);return Number.isNaN(e.getTime())?n:Hde(e)}return n}}function _be(e,t,n={}){let r=structuredClone(n);for(let n of e){let e=gbe(n,t[n.path]??``);e!==void 0&&fbe(r,n.path,e)}return r}function F7(e){let t=e.trim();if(!t)return{ok:!0,payload:{}};let n;try{n=JSON.parse(t)}catch{return{ok:!1,error:`This is not valid JSON.`}}let r=lue(n);return r?{ok:!0,payload:r}:{ok:!1,error:`A payload has to be a JSON object.`}}function I7(e){return e.find(e=>e.data.type===`lifecycle`)}function vbe(e){return C1(I7(e)?.data.config)}function L7(e){return due(I7(e)?.data.config)??{}}function ybe(e,t){return t.eventName?{...e,byEvent:{...e.byEvent,[t.eventName]:t.input}}:{...e,manual:t.input}}var R7=``;function bbe(e,t){return Ny(e,t)?.label??t}function xbe(e){let t=(0,Z.c)(29),{field:n,value:r,onChange:i}=e;if(n.control===`checkbox`){let e=r===`true`,a;t[0]===i?a=t[1]:(a=e=>i(e?`true`:`false`),t[0]=i,t[1]=a);let o;return t[2]!==n.path||t[3]!==e||t[4]!==a?(o=(0,X.jsx)(e7,{checked:e,id:n.path,onCheckedChange:a}),t[2]=n.path,t[3]=e,t[4]=a,t[5]=o):o=t[5],o}if(n.control===`select`){let e;t[6]===i?e=t[7]:(e=H6(i),t[6]=i,t[7]=e);let a;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(U6,{placeholder:`Choose a value`}),t[8]=a):a=t[8];let o;t[9]===n.path?o=t[10]:(o=(0,X.jsx)(W6,{className:`w-full`,id:n.path,children:a}),t[9]=n.path,t[10]=o);let s;t[11]===n.options?s=t[12]:(s=n.options??[],t[11]=n.options,t[12]=s);let c;t[13]===s?c=t[14]:(c=s.map(z7),t[13]=s,t[14]=c);let l;t[15]===c?l=t[16]:(l=(0,X.jsx)(G6,{children:c}),t[15]=c,t[16]=l);let u;return t[17]!==e||t[18]!==o||t[19]!==l||t[20]!==r?(u=(0,X.jsxs)(V6,{onValueChange:e,value:r,children:[o,l]}),t[17]=e,t[18]=o,t[19]=l,t[20]=r,t[21]=u):u=t[21],u}let a;t[22]===i?a=t[23]:(a=e=>i(e.target.value),t[22]=i,t[23]=a);let o=n.control===`number`?`number`:n.control===`datetime`?`datetime-local`:`text`,s;return t[24]!==n.path||t[25]!==a||t[26]!==o||t[27]!==r?(s=(0,X.jsx)(wX,{id:n.path,onChange:a,type:o,value:r}),t[24]=n.path,t[25]=a,t[26]=o,t[27]=r,t[28]=s):s=t[28],s}function z7(e){return(0,X.jsx)(K6,{value:e,children:e},e)}function Sbe(e){let t=(0,Z.c)(10),{fields:n,values:r,onChange:i}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This Event declares no payload field the form can draw. Use the JSON tab to write the payload.`}),t[0]=e):e=t[0],e}let a;if(t[1]!==n||t[2]!==i||t[3]!==r){let e;t[5]!==i||t[6]!==r?(e=e=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(TX,{className:`font-mono text-xs`,htmlFor:e.path,children:[e.path,e.optional&&(0,X.jsx)(`span`,{className:`ml-2 font-sans text-muted-foreground`,children:`optional`})]}),(0,X.jsx)(xbe,{field:e,onChange:t=>i(e.path,t),value:r[e.path]??``}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:e.description})]},e.path),t[5]=i,t[6]=r,t[7]=e):e=t[7],a=n.map(e),t[1]=n,t[2]=i,t[3]=r,t[4]=a}else a=t[4];let o;return t[8]===a?o=t[9]:(o=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[8]=a,t[9]=o),o}function Cbe(e){let t=(0,Z.c)(92),{overlayId:n,startEvents:r,allowManualStart:i,hasEventSplit:a,savedPayloads:o,onRun:s}=e,c=yy(),{closeAll:l}=RY(),[u,d]=(0,Y.useState)(r[0]??R7),[f,p]=(0,Y.useState)(`form`),m=u===R7?void 0:u,h;t[0]!==m||t[1]!==o?(h=N1(o,m),t[0]=m,t[1]=o,t[2]=h):h=t[2];let g=h,_;t[3]!==c||t[4]!==m?(_=N7(m?Ny(c,m):void 0),t[3]=c,t[4]=m,t[5]=_):_=t[5];let v=_,y;t[6]!==v||t[7]!==g?(y=()=>P7(v,g),t[6]=v,t[7]=g,t[8]=y):y=t[8];let[b,x]=(0,Y.useState)(y),S;t[9]===g?S=t[10]:(S=()=>JSON.stringify(g??{},null,2),t[9]=g,t[10]=S);let[C,w]=(0,Y.useState)(S),[T,E]=(0,Y.useState)(null),D;t[11]===g?D=t[12]:(D=()=>g??{},t[11]=g,t[12]=D);let[O,k]=(0,Y.useState)(D),A;t[13]!==c||t[14]!==o?(A=e=>{d(e);let t=e===R7?void 0:e,n=N1(o,t)??{},r=N7(t?Ny(c,t):void 0);x(P7(r,n)),w(JSON.stringify(n,null,2)),k(n),E(null)},t[13]=c,t[14]=o,t[15]=A):A=t[15];let j=A,M;t[16]!==O||t[17]!==v||t[18]!==b?(M=()=>_be(v,b,O),t[16]=O,t[17]=v,t[18]=b,t[19]=M):M=t[19];let N=M,P;t[20]===N?P=t[21]:(P=()=>{w(JSON.stringify(N(),null,2)),E(null),p(`json`)},t[20]=N,t[21]=P);let F=P,I;t[22]!==v||t[23]!==C?(I=()=>{let e=F7(C);if(!e.ok){E(e.error);return}x(P7(v,e.payload)),k(e.payload),E(null),p(`form`)},t[22]=v,t[23]=C,t[24]=I):I=t[24];let L=I,R=!a||m!==void 0,z;t[25]!==l||t[26]!==N||t[27]!==m||t[28]!==C||t[29]!==s||t[30]!==f?(z=()=>{if(f===`json`){let e=F7(C);if(!e.ok){E(e.error);return}s({...m?{eventName:m}:{},input:e.payload}),l();return}s({...m?{eventName:m}:{},input:N()}),l()},t[25]=l,t[26]=N,t[27]=m,t[28]=C,t[29]=s,t[30]=f,t[31]=z):z=t[31];let B=z,V;t[32]===l?V=t[33]:(V={label:`Cancel`,variant:`outline`,onClick:l},t[32]=l,t[33]=V);let H=!R,U;t[34]!==B||t[35]!==H?(U={label:`Run`,onClick:B,disabled:H},t[34]=B,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==V||t[38]!==U?(W=[V,U],t[37]=V,t[38]=U,t[39]=W):W=t[39];let G;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,X.jsx)(TX,{htmlFor:`testRunEvent`,children:`Which Event does this run stand in for?`}),t[40]=G):G=t[40];let K;t[41]===j?K=t[42]:(K=H6(j),t[41]=j,t[42]=K);let q;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,X.jsx)(W6,{className:`w-full`,id:`testRunEvent`,children:(0,X.jsx)(U6,{placeholder:`Choose an Event`})}),t[43]=q):q=t[43];let J;if(t[44]!==c||t[45]!==r){let e;t[47]===c?e=t[48]:(e=e=>(0,X.jsx)(K6,{value:e,children:bbe(c,e)},e),t[47]=c,t[48]=e),J=r.map(e),t[44]=c,t[45]=r,t[46]=J}else J=t[46];let ee;t[49]!==i||t[50]!==a?(ee=i&&(0,X.jsx)(K6,{disabled:a,value:R7,children:`No Event (manual start)`}),t[49]=i,t[50]=a,t[51]=ee):ee=t[51];let te;t[52]!==J||t[53]!==ee?(te=(0,X.jsxs)(G6,{children:[J,ee]}),t[52]=J,t[53]=ee,t[54]=te):te=t[54];let ne;t[55]!==u||t[56]!==K||t[57]!==te?(ne=(0,X.jsxs)(V6,{onValueChange:K,value:u,children:[q,te]}),t[55]=u,t[56]=K,t[57]=te,t[58]=ne):ne=t[58];let re;t[59]===a?re=t[60]:(re=a&&(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This workflow splits on the Event a run is on, so a run has to name one.`}),t[59]=a,t[60]=re);let ie;t[61]!==ne||t[62]!==re?(ie=(0,X.jsxs)(`div`,{className:`space-y-2`,children:[G,ne,re]}),t[61]=ne,t[62]=re,t[63]=ie):ie=t[63];let ae;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,X.jsx)(`span`,{className:`font-medium text-sm`,children:`Payload`}),t[64]=ae):ae=t[64];let oe=f===`form`?`secondary`:`ghost`,se;t[65]!==L||t[66]!==oe?(se=(0,X.jsx)(zv,{onClick:L,size:`sm`,variant:oe,children:`Form`}),t[65]=L,t[66]=oe,t[67]=se):se=t[67];let ce=f===`json`?`secondary`:`ghost`,le;t[68]!==F||t[69]!==ce?(le=(0,X.jsx)(zv,{onClick:F,size:`sm`,variant:ce,children:`JSON`}),t[68]=F,t[69]=ce,t[70]=le):le=t[70];let ue;t[71]!==se||t[72]!==le?(ue=(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[ae,(0,X.jsxs)(`div`,{className:`flex gap-1`,children:[se,le]})]}),t[71]=se,t[72]=le,t[73]=ue):ue=t[73];let de;t[74]!==v||t[75]!==C||t[76]!==f||t[77]!==b?(de=f===`form`?(0,X.jsx)(Sbe,{fields:v,onChange:(e,t)=>x(n=>({...n,[e]:t})),values:b}):(0,X.jsx)(`textarea`,{"aria-label":`Payload JSON`,className:`min-h-64 w-full rounded-md border border-input bg-transparent p-3 font-mono text-xs shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,onChange:e=>{w(e.target.value),E(null)},spellCheck:!1,value:C}),t[74]=v,t[75]=C,t[76]=f,t[77]=b,t[78]=de):de=t[78];let fe;t[79]===T?fe=t[80]:(fe=T&&(0,X.jsx)(`p`,{className:`text-destructive text-xs`,children:T}),t[79]=T,t[80]=fe);let pe;t[81]!==ue||t[82]!==de||t[83]!==fe?(pe=(0,X.jsxs)(`div`,{className:`space-y-3`,children:[ue,de,fe]}),t[81]=ue,t[82]=de,t[83]=fe,t[84]=pe):pe=t[84];let me;t[85]!==ie||t[86]!==pe?(me=(0,X.jsxs)(`div`,{className:`space-y-6`,children:[ie,pe]}),t[85]=ie,t[86]=pe,t[87]=me):me=t[87];let he;return t[88]!==n||t[89]!==W||t[90]!==me?(he=(0,X.jsx)(SX,{actions:W,description:`A test run carries the payload an Event would have sent, so every template downstream resolves the way it will in production.`,overlayId:n,title:`Test run`,children:me}),t[88]=n,t[89]=W,t[90]=me,t[91]=he):he=t[91],he}function B7(e){let t=(0,Z.c)(38),{overlayId:n,issues:r,onGoToStep:i,onRunAnyway:a,allowRunAnyway:o}=e,s=o!==void 0&&o,{push:c,closeAll:l}=RY(),{pushSheet:u}=O7(),d=jY(),f=E3(),{brokenReferences:p,missingRequiredFields:m,missingIntegrations:h}=r,g=p.length+m.length+h.length,_;t[0]!==l||t[1]!==d||t[2]!==i||t[3]!==u?(_=(e,t)=>{i(e,t),d?u():l()},t[0]=l,t[1]=d,t[2]=i,t[3]=u,t[4]=_):_=t[4];let v=_,y;t[5]!==c||t[6]!==f?(y=e=>{c(C3,{type:e,onSuccess:()=>void f()})},t[5]=c,t[6]=f,t[7]=y):y=t[7];let b=y,x;t[8]!==l||t[9]!==a?(x=()=>{a&&(l(),a())},t[8]=l,t[9]=a,t[10]=x):x=t[10];let S=x,C=m.length+h.length,w;t[11]!==s||t[12]!==l||t[13]!==S||t[14]!==a?(w=s&&a?[{label:`Run Anyway`,variant:`outline`,onClick:S},{label:`Cancel`,onClick:l}]:[{label:`Close`,onClick:l}],t[11]=s,t[12]=l,t[13]=S,t[14]=a,t[15]=w):w=t[15];let T=`Workflow Issues (${g})`,E;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsxs)(`div`,{className:`flex items-center gap-2 text-warning`,children:[(0,X.jsx)(py,{className:`size-5`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`This workflow has issues that may cause it to fail.`})]}),t[16]=E):E=t[16];let D;t[17]===C?D=t[18]:(D=C>0&&(0,X.jsx)(`p`,{className:`mt-2 text-destructive text-sm`,children:`Resolve blocking issues before running this workflow.`}),t[17]=C,t[18]=D);let O;t[19]!==b||t[20]!==h?(O=h.length>0&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Connections`}),h.map(e=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-1`,children:[(0,X.jsx)(b3,{className:`size-4 shrink-0`,integration:e.integrationType}),(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-sm`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.integrationLabel}),(0,X.jsxs)(`span`,{className:`text-muted-foreground`,children:[` — `,e.nodeNames.length>3?`${e.nodeNames.slice(0,3).join(`, `)} +${e.nodeNames.length-3} more`:e.nodeNames.join(`, `)]})]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>b(e.integrationType),size:`sm`,variant:`outline`,children:`Add`})]},e.integrationType))]}),t[19]=b,t[20]=h,t[21]=O):O=t[21];let k;t[22]!==p||t[23]!==v?(k=p.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Broken References`}),p.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.brokenReferences.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsxs)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:[(0,X.jsx)(`span`,{className:`font-mono`,children:t.displayText}),` in `,t.fieldLabel]}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}-${t.displayText}-${t.fieldLabel}`))})]},e.nodeId))]}),t[22]=p,t[23]=v,t[24]=k):k=t[24];let A;t[25]!==v||t[26]!==m?(A=m.length>0&&(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`h4`,{className:`font-medium text-muted-foreground text-sm`,children:`Missing Required Fields`}),m.map(e=>(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`font-medium text-sm`,children:e.nodeLabel}),(0,X.jsx)(`div`,{className:`mt-1 space-y-0.5`,children:e.missingFields.map(t=>(0,X.jsxs)(`div`,{className:`flex items-center gap-3 py-0.5 pl-3`,children:[(0,X.jsx)(`p`,{className:`min-w-0 flex-1 text-muted-foreground text-sm`,children:t.fieldLabel}),(0,X.jsx)(zv,{className:`shrink-0`,onClick:()=>v(e.nodeId,t.fieldKey),size:`sm`,variant:`outline`,children:`Fix`})]},`${e.nodeId}-${t.fieldKey}`))})]},e.nodeId))]}),t[25]=v,t[26]=m,t[27]=A):A=t[27];let j;t[28]!==k||t[29]!==A||t[30]!==O?(j=(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[O,k,A]}),t[28]=k,t[29]=A,t[30]=O,t[31]=j):j=t[31];let M;return t[32]!==n||t[33]!==j||t[34]!==w||t[35]!==T||t[36]!==D?(M=(0,X.jsxs)(SX,{actions:w,overlayId:n,title:T,children:[E,D,j]}),t[32]=n,t[33]=j,t[34]=w,t[35]=T,t[36]=D,t[37]=M):M=t[37],M}function V7(e){return e instanceof HTMLElement&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable)}var wbe=jy(`workflow`,`run`),Tbe={workflow_paused:`Workflow is paused and cannot start new runs.`,concurrency_first_wins:`A run for this entity is already going, and this workflow keeps the first one.`,entity_value_missing:`This payload carries nothing at the workflow's Correlation Path, and its Concurrency needs an entity to compare.`,manual_start_not_allowed:`This workflow does not list manual runs as a start source.`,start_event_required:`This workflow splits on the Event a run is on, so a run has to name one.`};function H7(e,t,n){t(e.map(e=>({nodeId:e.id,status:n})))}function Ebe(e){let t=I7(e.nodes);t&&e.updateNodeData({id:t.id,data:{config:{...t.data.config,testPayloads:ybe(L7(e.nodes),e.request)}}})}async function Dbe({runWorkflow:e,nodes:t,setNodeStatuses:n,setIsExecuting:r,navigateToExecution:i}){H7(t,n,`idle`),n(t.filter(e=>e.data.type===`lifecycle`).map(e=>({nodeId:e.id,status:`running`})));try{let a=await e();if(a.status!==`running`||!a.executionId){Ty.message(a.status===`ignored`?Tbe[a.reason]:`Execution completed without starting a new run.`),r(!1),H7(t,n,`idle`);return}if(typeof a.supersededExecutions==`number`&&a.supersededExecutions>0){let e=Array.isArray(a.failedToSupersede)?a.failedToSupersede.length:0,t=`Superseded ${a.supersededExecutions} run${a.supersededExecutions===1?``:`s`} for this entity and started a new one.`;e>0?Ty.error(`${t} ${e} could not be signalled and may still be running. Cancel them from the Runs panel.`):Ty.success(t)}await i(a.executionId)}catch(e){wbe.error(`Failed to execute the workflow`,{error:e}),H7(t,n,`error`),r(!1)}}function Obe(e){let t=(0,Z.c)(53),{currentWorkflowId:n,workflowName:r,nodes:i,edges:a,updateNodeData:o,isExecuting:s,setIsExecuting:c,setCurrentWorkflowName:l,setWorkflowNameError:u,setIsTransitioningFromHomepage:d,setActiveTab:f,setSelectedNodeId:p,userIntegrations:m}=e,h=yy(),[g,_]=(0,Y.useState)(null),{open:v}=RY(),y=Gi(),b=Fe(),x=TA(ape),S=TA(V4),C=TA(y3),w=TA(d2),T=TA(hde),E;t[0]===b?E=t[1]:(E=r0.workflow.execute.mutationOptions({onSuccess:()=>s0(b)}),t[0]=b,t[1]=E);let D=Ze(E),O;t[2]!==T||t[3]!==n||t[4]!==a||t[5]!==y||t[6]!==i||t[7]!==w||t[8]!==l||t[9]!==d||t[10]!==u||t[11]!==r?(O=async()=>{if(!i.some(kbe)){u(`Add at least one step before saving.`);return}let e=r.trim();if(!e){u(`Workflow name is required.`);return}if(n){let t=await w({name:e,nodes:i,edges:a},{immediate:!0});if(t&&!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}l(e),u(null);return}let t=await T({name:e,nodes:i,edges:a});if(!t.ok){u(t.error.message||`Failed to save workflow. Please try again.`);return}d(!0),await y({to:`/workflows/$workflowId`,params:{workflowId:t.workflow.id},replace:!0})},t[2]=T,t[3]=n,t[4]=a,t[5]=y,t[6]=i,t[7]=w,t[8]=l,t[9]=d,t[10]=u,t[11]=r,t[12]=O):O=t[12];let k=O,A;t[13]!==x||t[14]!==n||t[15]!==y||t[16]!==i||t[17]!==D||t[18]!==f||t[19]!==S||t[20]!==c||t[21]!==C||t[22]!==p||t[23]!==o?(A=async e=>{if(!n){Ty.error(`Please save the workflow before executing`);return}Ebe({nodes:i,updateNodeData:o,request:e}),f(`runs`),S(null),x(),p(null),c(!0),await Dbe({runWorkflow:()=>D.mutateAsync({workflowId:n,input:e.input,...e.eventName?{eventName:e.eventName}:{}}),nodes:i,setNodeStatuses:C,setIsExecuting:c,navigateToExecution:e=>y({to:`/workflows/$workflowId`,params:{workflowId:n},search:{executionId:e}})})},t[13]=x,t[14]=n,t[15]=y,t[16]=i,t[17]=D,t[18]=f,t[19]=S,t[20]=c,t[21]=C,t[22]=p,t[23]=o,t[24]=A):A=t[24];let j=A,M;t[25]!==j||t[26]!==i||t[27]!==v?(M=()=>{let e=vbe(i)??S1;v(Cbe,{startEvents:e.startEvents,allowManualStart:E1(e),hasEventSplit:i.some(Z6),savedPayloads:L7(i),onRun:e=>{j(e)}})},t[25]=j,t[26]=i,t[27]=v,t[28]=M):M=t[28];let N=M,P;t[29]!==f||t[30]!==p?(P=(e,t)=>{p(e),f(`properties`),_(t??null)},t[29]=f,t[30]=p,t[31]=P):P=t[31];let F=P,I;t[32]===g?I=t[33]:(I=()=>{if(!g)return;_(null);let e=document.getElementById(g);e&&(e.focus(),e.scrollIntoView({behavior:`smooth`,block:`center`}))},t[32]=g,t[33]=I),yY(g,I);let L;t[34]!==h||t[35]!==F||t[36]!==s||t[37]!==i||t[38]!==v||t[39]!==N||t[40]!==m?(L=async()=>{if(s)return;let e=y4({nodes:G1(i),catalog:h,integrations:m});if(e.length>0){let t=b4(e);v(B7,{issues:x4(e),onGoToStep:F,onRunAnyway:t?void 0:N,allowRunAnyway:!t});return}N()},t[34]=h,t[35]=F,t[36]=s,t[37]=i,t[38]=v,t[39]=N,t[40]=m,t[41]=L):L=t[41];let R=L,z;t[42]!==h||t[43]!==F||t[44]!==i||t[45]!==v||t[46]!==m?(z=()=>{let e=y4({nodes:G1(i),catalog:h,integrations:m});v(B7,{issues:x4(e),onGoToStep:F,allowRunAnyway:!1})},t[42]=h,t[43]=F,t[44]=i,t[45]=v,t[46]=m,t[47]=z):z=t[47];let B=z,V;return t[48]!==R||t[49]!==F||t[50]!==k||t[51]!==B?(V={handleSave:k,handleExecute:R,handleShowIssues:B,handleGoToStep:F},t[48]=R,t[49]=F,t[50]=k,t[51]=B,t[52]=V):V=t[52],V}function kbe(e){return e.type!==`add`}function Abe(){let e=(0,Z.c)(33),t=wA(Q4),n=wA($4),[r,i]=EA(w2),[a]=EA(T2),o=TA(g3),s=TA(m3),[c]=EA(Q0),[l,u]=EA($0),[d,f]=EA(e2),p=TA(n2),m=TA(v2),h=wA(t2),g=wA(a2),_=wA(o2),v=TA(_3),y=TA(v3),b=TA(u3),[x]=EA(ppe),[S]=EA(mpe),C=TA(g2),w=TA(H4),T;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=i0(),e[0]=T):T=e[0];let{data:E}=Xe(T),D;e[1]===E?D=e[2]:(D=E===void 0?[]:E,e[1]=E,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=Pue(),e[3]=k):k=e[3];let{data:A}=Xe(k),j;e[4]===A?j=e[5]:(j=A===void 0?[]:A,e[4]=A,e[5]=j);let M=j,N;return e[6]!==b||e[7]!==M||e[8]!==S||e[9]!==x||e[10]!==o||e[11]!==c||e[12]!==n||e[13]!==_||e[14]!==r||e[15]!==a||e[16]!==h||e[17]!==g||e[18]!==t||e[19]!==y||e[20]!==C||e[21]!==f||e[22]!==u||e[23]!==i||e[24]!==m||e[25]!==w||e[26]!==p||e[27]!==v||e[28]!==s||e[29]!==O||e[30]!==d||e[31]!==l?(N={nodes:t,edges:n,isExecuting:r,setIsExecuting:i,isGenerating:a,clearWorkflow:o,updateNodeData:s,currentWorkflowId:c,workflowName:l,workflowMode:d,setCurrentWorkflowName:u,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,isOwner:h,isSaving:g,hasUnsavedChanges:_,undo:v,redo:y,addNode:b,canUndo:x,canRedo:S,allWorkflows:M,setActiveTab:C,setSelectedNodeId:w,userIntegrations:O},e[6]=b,e[7]=M,e[8]=S,e[9]=x,e[10]=o,e[11]=c,e[12]=n,e[13]=_,e[14]=r,e[15]=a,e[16]=h,e[17]=g,e[18]=t,e[19]=y,e[20]=C,e[21]=f,e[22]=u,e[23]=i,e[24]=m,e[25]=w,e[26]=p,e[27]=v,e[28]=s,e[29]=O,e[30]=d,e[31]=l,e[32]=N):N=e[32],N}function jbe(e){let t=(0,Z.c)(62),n=yy(),{open:r}=RY(),i=Gi(),a=Fe(),o=l0(),s=TA(mde),{currentWorkflowId:c,workflowName:l,workflowMode:u,setCurrentWorkflowName:d,setCurrentWorkflowMode:f,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,clearWorkflow:b,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C}=e,w;t[0]!==c||t[1]!==g||t[2]!==v||t[3]!==h||t[4]!==x||t[5]!==d||t[6]!==y||t[7]!==m||t[8]!==S||t[9]!==p||t[10]!==_||t[11]!==C||t[12]!==l?(w={currentWorkflowId:c,workflowName:l,nodes:h,edges:g,updateNodeData:_,isExecuting:v,setIsExecuting:y,setCurrentWorkflowName:d,setWorkflowNameError:p,setIsTransitioningFromHomepage:m,setActiveTab:x,setSelectedNodeId:S,userIntegrations:C},t[0]=c,t[1]=g,t[2]=v,t[3]=h,t[4]=x,t[5]=d,t[6]=y,t[7]=m,t[8]=S,t[9]=p,t[10]=_,t[11]=C,t[12]=l,t[13]=w):w=t[13];let{handleSave:T,handleExecute:E,handleShowIssues:D,handleGoToStep:O}=Obe(w),k;t[14]===E?k=t[15]:(k=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(V7(e.target)||(e.preventDefault(),e.stopPropagation(),E()))},t[14]=E,t[15]=k);let A=k,j;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(j={capture:!0},t[16]=j):j=t[16],_Y(document,`keydown`,A,j);let M;t[17]!==b||t[18]!==r?(M=()=>{r(CX,{title:`Clear Workflow`,message:`Remove every step and connection? The Lifecycle Node is kept, and this saves right away.`,confirmLabel:`Clear Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{b()}})},t[17]=b,t[18]=r,t[19]=M):M=t[19];let N=M,P;t[20]!==c||t[21]!==o||t[22]!==r||t[23]!==l?(P=()=>{r(CX,{title:`Delete Workflow`,message:`Are you sure you want to delete "${l}"? This will permanently delete the workflow. This cannot be undone.`,confirmLabel:`Delete Workflow`,confirmVariant:`destructive`,destructive:!0,onConfirm:()=>{c&&o.mutate({workflowId:c})}})},t[20]=c,t[21]=o,t[22]=r,t[23]=l,t[24]=P):P=t[24];let F=P,I;t[25]===a?I=t[26]:(I=()=>a0(a),t[25]=a,t[26]=I);let L=I,R;t[27]!==L||t[28]!==i?(R=r0.workflow.duplicate.mutationOptions({onSuccess:async e=>{Ty.success(`Workflow duplicated successfully`),await L(),await i({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},meta:{errorMessage:`Failed to duplicate workflow. Please try again.`}}),t[27]=L,t[28]=i,t[29]=R):R=t[29];let z=Ze(R),B;t[30]!==L||t[31]!==a?(B=r0.workflow.publish.mutationOptions({onSuccess:e=>{Ty.success(`Published version ${e.publishedVersion}`),o0(a,e),L()}}),t[30]=L,t[31]=a,t[32]=B):B=t[32];let V=Ze(B),H;t[33]!==c||t[34]!==z?(H=()=>{c&&z.mutate({workflowId:c})},t[33]=c,t[34]=z,t[35]=H):H=t[35];let U=H,W;t[36]!==n||t[37]!==c||t[38]!==g||t[39]!==O||t[40]!==h||t[41]!==r||t[42]!==V||t[43]!==C?(W=()=>{if(!c)return;let e=y4({nodes:G1(h),catalog:n,integrations:C});if(b4(e)){r(B7,{issues:x4(e),onGoToStep:O,allowRunAnyway:!1});return}V.mutate({workflowId:c,graph:Y1({nodes:h,edges:g})})},t[36]=n,t[37]=c,t[38]=g,t[39]=O,t[40]=h,t[41]=r,t[42]=V,t[43]=C,t[44]=W):W=t[44];let G=W,K;t[45]!==c||t[46]!==f||t[47]!==s||t[48]!==u?(K=async e=>{if(!c||u===e)return;let t=await s(e);if(!t?.ok){Ty.error(`Failed to update workflow mode`);return}f(t.workflow.mode),Ty.success(e===`test`?`Workflow set to Test mode`:`Workflow set to Live mode`)},t[45]=c,t[46]=f,t[47]=s,t[48]=u,t[49]=K):K=t[49];let q=K,J;return t[50]!==z.isPending||t[51]!==N||t[52]!==F||t[53]!==U||t[54]!==E||t[55]!==G||t[56]!==T||t[57]!==q||t[58]!==D||t[59]!==L||t[60]!==V.isPending?(J={handleSave:T,handleExecute:E,handleShowIssues:D,handleClearWorkflow:N,handleDeleteWorkflow:F,loadWorkflows:L,handleDuplicate:U,isDuplicating:z.isPending,handlePublish:G,isPublishing:V.isPending,handleSetWorkflowMode:q},t[50]=z.isPending,t[51]=N,t[52]=F,t[53]=U,t[54]=E,t[55]=G,t[56]=T,t[57]=q,t[58]=D,t[59]=L,t[60]=V.isPending,t[61]=J):J=t[61],J}function Mbe(e){let t=(0,Z.c)(7),{onOpen:n}=e,r=wA(C4),i=wA(Pfe),a=wA(t2),o=`${r.length} ${r.length===1?`issue`:`issues`}`;if(!a)return null;let s;t[0]!==i||t[1]!==r.length||t[2]!==o||t[3]!==n?(s=r.length>0&&(0,X.jsxs)(`button`,{className:Q(`flex items-center gap-1.5 whitespace-nowrap rounded-md border px-2 py-1 font-medium text-xs transition-colors`,i?`border-warning/40 bg-warning/10 text-warning hover:bg-warning/20`:`bg-card text-muted-foreground hover:bg-accent`),onClick:n,title:`Show what is wrong with this workflow`,type:`button`,children:[(0,X.jsx)(py,{className:`size-3.5 shrink-0`}),(0,X.jsx)(`span`,{className:`tabular-nums`,children:o})]}),t[0]=i,t[1]=r.length,t[2]=o,t[3]=n,t[4]=s):s=t[4];let c;return t[5]===s?c=t[6]:(c=(0,X.jsx)(`output`,{"aria-live":`polite`,className:`shrink-0`,children:s}),t[5]=s,t[6]=c),c}function Nbe(e){let t=(0,Z.c)(3),{isPublished:n,hasUnpublishedChanges:r}=e;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:`Never published`}),t[0]=e):e=t[0],e}let i=r?`Unpublished changes`:`Published`,a;return t[1]===i?a=t[2]:(a=(0,X.jsx)(`span`,{className:`rounded-md border bg-card px-2 py-1 font-medium text-muted-foreground text-xs`,children:i}),t[1]=i,t[2]=a),a}function Pbe(e){return e.isSaving?`saving`:e.lastSaveError?`failed`:e.hasUnsavedChanges?`unsaved`:`saved`}var Fbe={saving:`Saving`,unsaved:`Unsaved changes`,failed:`Save failed`,saved:`Saved`},Ibe={saving:`text-muted-foreground`,unsaved:`text-warning`,failed:`text-destructive`,saved:`text-muted-foreground`};function Lbe(){let e=(0,Z.c)(14),t=wA(a2),n=wA(o2),r=wA(s2),i=wA(t2),a;e[0]!==n||e[1]!==t||e[2]!==r?(a=Pbe({isSaving:t,hasUnsavedChanges:n,lastSaveError:r}),e[0]=n,e[1]=t,e[2]=r,e[3]=a):a=e[3];let o=a,s=i&&(n||t),c;if(e[4]===s?c=e[5]:(c={enabled:s},e[4]=s,e[5]=c),_Y(window,`beforeunload`,Rbe,c),!i)return null;let l=Ibe[o],u;e[6]===l?u=e[7]:(u=Q(`flex shrink-0 items-center gap-1.5 whitespace-nowrap px-1 font-medium text-xs`,l),e[6]=l,e[7]=u);let d;e[8]===o?d=e[9]:(d=o===`saving`&&(0,X.jsx)(ay,{className:`size-3 animate-spin`}),e[8]=o,e[9]=d);let f=Fbe[o],p;return e[10]!==u||e[11]!==d||e[12]!==f?(p=(0,X.jsxs)(`output`,{"aria-live":`polite`,className:u,children:[d,f]}),e[10]=u,e[11]=d,e[12]=f,e[13]=p):p=e[13],p}function Rbe(e){e.preventDefault()}var zbe=e=>{let t=(0,Z.c)(57),{workflowId:n}=e,r=Abe(),i=jbe(r),a;if(t[0]!==r.allWorkflows||t[1]!==r.currentWorkflowId){let e;t[3]===r.currentWorkflowId?e=t[4]:(e=e=>e.id===r.currentWorkflowId,t[3]=r.currentWorkflowId,t[4]=e),a=r.allWorkflows.find(e),t[0]=r.allWorkflows,t[1]=r.currentWorkflowId,t[2]=a}else a=t[2];let o=!!a?.publishedVersionId,s=n??``,c;t[5]===s?c=t[6]:(c=Iue(s),t[5]=s,t[6]=c);let l=!!n,u;t[7]!==c||t[8]!==l?(u={...c,enabled:l},t[7]=c,t[8]=l,t[9]=u):u=t[9];let{data:d}=Xe(u),f=d!==void 0&&d,p;t[10]!==i||t[11]!==r||t[12]!==n?(p=(0,X.jsx)(sbe,{actions:i,state:r,workflowId:n}),t[10]=i,t[11]=r,t[12]=n,t[13]=p):p=t[13];let m;t[14]!==r.workflowMode||t[15]!==n?(m=n&&r.workflowMode===`test`&&(0,X.jsx)(`span`,{className:`rounded-md border border-warning/40 bg-warning/10 px-2 py-1 font-medium text-warning text-xs`,children:`Test mode`}),t[14]=r.workflowMode,t[15]=n,t[16]=m):m=t[16];let h;t[17]!==f||t[18]!==o||t[19]!==n?(h=n&&(0,X.jsx)(Nbe,{hasUnpublishedChanges:f,isPublished:o}),t[17]=f,t[18]=o,t[19]=n,t[20]=h):h=t[20];let g;t[21]!==r.isOwner||t[22]!==n?(g=n&&!r.isOwner&&(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Read-only`}),t[21]=r.isOwner,t[22]=n,t[23]=g):g=t[23];let _;t[24]===i.handleShowIssues?_=t[25]:(_=(0,X.jsx)(Mbe,{onOpen:i.handleShowIssues}),t[24]=i.handleShowIssues,t[25]=_);let v;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,X.jsx)(Lbe,{}),t[26]=v):v=t[26];let y;t[27]!==g||t[28]!==_||t[29]!==p||t[30]!==m||t[31]!==h?(y=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex min-w-0 flex-wrap items-center gap-2`,children:[p,m,h,g,_,v]}),t[27]=g,t[28]=_,t[29]=p,t[30]=m,t[31]=h,t[32]=y):y=t[32];let b;t[33]!==i||t[34]!==r||t[35]!==n?(b=(0,X.jsx)(abe,{actions:i,state:r,workflowId:n}),t[33]=i,t[34]=r,t[35]=n,t[36]=b):b=t[36];let x;t[37]!==i.handleDuplicate||t[38]!==i.isDuplicating||t[39]!==r.isOwner||t[40]!==n?(x=n&&!r.isOwner&&(0,X.jsx)(ibe,{isDuplicating:i.isDuplicating,onDuplicate:i.handleDuplicate}),t[37]=i.handleDuplicate,t[38]=i.isDuplicating,t[39]=r.isOwner,t[40]=n,t[41]=x):x=t[41];let S;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(Zye,{}),t[42]=S):S=t[42];let C;t[43]===x?C=t[44]:(C=(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[x,S]}),t[43]=x,t[44]=C);let w;t[45]!==b||t[46]!==C?(w=(0,X.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2 overflow-x-auto @xl:justify-end`,children:[b,C]}),t[45]=b,t[46]=C,t[47]=w):w=t[47];let T;t[48]!==y||t[49]!==w?(T=(0,X.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-4 top-4 z-10 flex flex-col items-stretch gap-2 @container @xl:flex-row @xl:items-start @xl:justify-between`,children:[y,w]}),t[48]=y,t[49]=w,t[50]=T):T=t[50];let E;t[51]!==r.workflowMode||t[52]!==n?(E=n&&r.workflowMode===`test`&&(0,X.jsxs)(`div`,{className:`-translate-x-1/2 pointer-events-none absolute bottom-4 left-1/2 z-10 max-w-xl rounded-md border border-warning/30 bg-warning/10 px-4 py-2 text-xs`,children:[(0,X.jsx)(`p`,{className:`font-medium text-warning`,children:`Test mode active`}),(0,X.jsx)(`p`,{className:`font-medium text-foreground`,children:`No real email or SMS is sent unless a node is configured to route to a test recipient.`})]}),t[51]=r.workflowMode,t[52]=n,t[53]=E):E=t[53];let D;return t[54]!==T||t[55]!==E?(D=(0,X.jsxs)(X.Fragment,{children:[T,E]}),t[54]=T,t[55]=E,t[56]=D):D=t[56],D};function U7(e,t){return e?.data.label?.trim()||t}function Bbe(e){return e.data.type===`lifecycle`||E0(e)||Z6(e)}function Vbe(e){return w0(e.sourceHandle)||(typeof e.sourceHandle==`string`&&e.sourceHandle.length>0?e.sourceHandle:``)}function Hbe(e){let{joinNodeId:t,predecessorIds:n,edges:r}=e;if(n.length===0)return new Set;let i=null;for(let e of n){let t=q6(e,r);if(!i){i=t;continue}for(let e of i)t.has(e)||i.delete(e)}let a=q6(t,r);for(let e of i??[])a.delete(e);return a}function Ube(e){if(e.nodeById.get(e.nodeId)?.data.type===`lifecycle`)return!0;for(let t of q6(e.nodeId,e.edges))if(e.nodeById.get(t)?.data.type===`lifecycle`)return!0;return!1}function Wbe(e){let{joinNodeId:t,nodes:n,edges:r}=e,i=new Map(n.map(e=>[e.id,e])),a=U7(i.get(t),t),o=r.filter(e=>e.target===t).map(e=>e.source),s=q6(t,r);for(let e of o)if(!Ube({nodeId:e,nodeById:i,edges:r}))return`Node "${a}" cannot join an unreachable branch (found "${U7(i.get(e),e)}")`;let c=new Map;for(let e of r){if(e.target!==t&&!s.has(e.target))continue;let n=i.get(e.source);if(!n||!Bbe(n))continue;let r=c.get(n.id)??new Set;r.add(Vbe(e)),c.set(n.id,r)}for(let[e,t]of c){if(t.size<=1)continue;let n=i.get(e);return n?.data.type===`lifecycle`?`Node "${a}" cannot join the Started and Canceled branches`:`Node "${a}" cannot join mutually exclusive branches from "${U7(n,e)}"`}for(let e of Hbe({joinNodeId:t,predecessorIds:o,edges:r})){let t=i.get(e);if(t&&x0(t))return`Node "${a}" cannot join branches that include a Wait (found "${U7(t,e)}")`}return null}function Gbe(e){let t=new Map;for(let n of e.edges)t.set(n.target,(t.get(n.target)??0)+1);for(let[n,r]of t){if(r<=1)continue;let t=Wbe({joinNodeId:n,nodes:e.nodes,edges:e.edges});if(t)return t}return null}function Kbe(e,t){return Gue(e)??t?.displayLabel??null}var W7=(e,t,n,r)=>{let i=e.internals.handleBounds?.[t];if(!(i&&i.length>0))return[0,0];let a=(r?i.find(e=>(e.id??null)===r):void 0)??i.find(e=>e.position===n)??i[0];if(!a)return[0,0];let o=a.width/2,s=a.height/2;switch(n){case _w.Left:o=0;break;case _w.Right:o=a.width;break;case _w.Top:s=0;break;case _w.Bottom:s=a.height;break;default:throw Error(`Invalid handle position`)}return[e.internals.positionAbsolute.x+a.x+o,e.internals.positionAbsolute.y+a.y+s]},qbe=(e,t,n,r)=>{let i=_w.Bottom,[a,o]=W7(e,`source`,i,n),s=_w.Top,[c,l]=W7(t,`target`,s,r);return{sx:a,sy:o,tx:c,ty:l,sourcePos:i,targetPos:s}},Jbe={Animated:(0,Y.memo)(function(e){let t=(0,Z.c)(27),{id:n,source:r,sourceHandleId:i,target:a,targetHandleId:o,style:s,selected:c,data:l}=e,u=JO(r),d=JO(a);if(!(u&&d))return null;let f;if(t[0]!==i||t[1]!==u||t[2]!==o||t[3]!==d){let{sx:e,sy:n,tx:r,ty:a,sourcePos:s,targetPos:c}=qbe(u,d,i,o);f=k7({sourceX:e,sourceY:n,sourcePosition:s,targetX:r,targetY:a,targetPosition:c}),t[0]=i,t[1]=u,t[2]=o,t[3]=d,t[4]=f}else f=t[4];let[p,m,h]=f,g;t[5]!==l||t[6]!==i?(g=Kbe(i,l),t[5]=l,t[6]=i,t[7]=g):g=t[7];let _=g,v=l?.inactive===!0,y=c?`var(--primary)`:v?`var(--canvas-line-muted)`:`var(--canvas-line)`,b=v?`4, 8`:`5`,x;t[8]===v?x=t[9]:(x=v?{}:{animation:`dashdraw 0.5s linear infinite`},t[8]=v,t[9]=x);let S;t[10]!==s||t[11]!==y||t[12]!==b||t[13]!==x?(S={...s,stroke:y,strokeWidth:2,strokeDasharray:b,...x},t[10]=s,t[11]=y,t[12]=b,t[13]=x,t[14]=S):S=t[14];let C;t[15]!==p||t[16]!==n||t[17]!==S?(C=(0,X.jsx)(GD,{id:n,path:p,style:S}),t[15]=p,t[16]=n,t[17]=S,t[18]=C):C=t[18];let w;t[19]!==_||t[20]!==v||t[21]!==m||t[22]!==h?(w=_&&(0,X.jsx)(KO,{children:(0,X.jsx)(`div`,{className:`pointer-events-none absolute rounded-sm border bg-background px-1.5 py-0.5 font-medium text-xs text-muted-foreground leading-none`,style:{transform:`translate(-50%, -50%) translate(${m}px,${h}px)`,...v?{opacity:.7}:{}},children:_})}),t[19]=_,t[20]=v,t[21]=m,t[22]=h,t[23]=w):w=t[23];let T;return t[24]!==C||t[25]!==w?(T=(0,X.jsxs)(X.Fragment,{children:[C,w]}),t[24]=C,t[25]=w,t[26]=T):T=t[26],T})},Ybe=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`m-4 rounded-md border bg-card p-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(cE,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function Xbe(e,t){let n=t.filter(t=>t.source===e);return n.some(e=>w0(e.sourceHandle)===`true`)?n.some(e=>w0(e.sourceHandle)===`false`)?`true`:`false`:`true`}function Zbe(e){let{nodes:t,edges:n,sourceNodeId:r,catalog:i}=e,a=t8({targetNodeId:r,nodes:t,edges:n,catalog:i}),o=new Set(n.filter(e=>e.source===r).map(e=>e.sourceHandle)),s=a.find(e=>!o.has(Y6(e.name)))??a[0];return s?Y6(s.name):null}function G7(e){let{nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:a}=e,o=w0(i);if(o)return o;let s=t.find(e=>e.id===r);if(D0(s))return A0(s)??i??null;if(s?.data.type===`lifecycle`)return Cde(i)?i:k2;if(Z6(s)){let e=X6(i);return e?Y6(e):Zbe({nodes:t,edges:n,sourceNodeId:r,catalog:a})}return E0(s)?Xbe(r,n):i??null}var Qbe=e=>{let t=(0,Z.c)(12),{className:n}=e,r;t[0]===n?r=t[1]:(r=Q(`pointer-events-none absolute inset-0 animate-border-mask rounded-[inherit]`,n),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(`svg`,{className:`size-full overflow-visible`,xmlns:`http://www.w3.org/2000/svg`,children:(0,X.jsx)(`rect`,{fill:`none`,height:`calc(100% - 2px)`,rx:`6`,stroke:`var(--info)`,strokeWidth:`2`,width:`calc(100% - 2px)`,x:`1`,y:`1`})}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,X.jsx)(`div`,{className:r,children:i}),t[3]=r,t[4]=a);let o;t[5]===n?o=t[6]:(o=Q(`pointer-events-none absolute inset-0 rounded-[inherit] border-2 border-info/20`,n),t[5]=n,t[6]=o);let s;t[7]===o?s=t[8]:(s=(0,X.jsx)(`div`,{className:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,X.jsxs)(X.Fragment,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c},$be=d_(`flex flex-col rounded-xl border text-card-foreground shadow-sm`,{variants:{size:{default:`gap-6 py-6`,sm:`gap-4 py-4`}},defaultVariants:{size:`default`}});function exe(e){let t=(0,Z.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,size:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`default`:i,o;t[4]!==n||t[5]!==a?(o=Q($be({size:a}),n),t[4]=n,t[5]=a,t[6]=o):o=t[6];let s;return t[7]!==r||t[8]!==a||t[9]!==o?(s=(0,X.jsx)(`div`,{className:o,"data-size":a,"data-slot":`card`,...r}),t[7]=r,t[8]=a,t[9]=o,t[10]=s):s=t[10],s}function txe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold leading-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function nxe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`card-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var rxe={running:{label:`Running`,Icon:ay,className:`bg-primary/5 text-foreground`,iconClassName:`animate-spin motion-reduce:animate-none`},success:{label:`Succeeded`,Icon:qv,className:`bg-success/10 text-success`,iconClassName:``},error:{label:`Failed`,Icon:cte,className:`bg-destructive/10 text-destructive`,iconClassName:``},cancelled:{label:`Cancelled`,Icon:Kv,className:`bg-cancelled/10 text-cancelled`,iconClassName:``}},ixe=e=>{let t=(0,Z.c)(11),{status:n}=e;if(!n||n===`idle`)return null;let r=rxe[n],i;t[0]===r.className?i=t[1]:(i=Q(`absolute top-2 right-2 z-10 flex items-center gap-1 rounded-sm py-0.5 pr-2 pl-1.5 font-medium text-xs leading-none`,r.className),t[0]=r.className,t[1]=i);let a=r.Icon,o;t[2]===r.iconClassName?o=t[3]:(o=Q(`size-3`,r.iconClassName),t[2]=r.iconClassName,t[3]=o);let s;t[4]!==r.Icon||t[5]!==o?(s=(0,X.jsx)(a,{className:o,strokeWidth:2.5}),t[4]=r.Icon,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==r.label||t[8]!==i||t[9]!==s?(c=(0,X.jsxs)(`div`,{className:i,role:`status`,children:[s,r.label]}),t[7]=r.label,t[8]=i,t[9]=s,t[10]=c):c=t[10],c};function K7(e,t){return t===!1?null:t===!0?(0,X.jsx)(dD,{position:e===`source`?_w.Bottom:_w.Top,type:e}):t.map(t=>{let n=[e,t.position,t.style?.top,t.style?.right,t.style?.bottom,t.style?.left].join(`:`);return(0,X.jsx)(dD,{className:t.className,id:t.id,position:t.position,style:t.style,type:e},t.id??n)})}var q7=e=>{let t=(0,Z.c)(25),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({handles:r,className:n,status:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===`success`&&`border-2 border-success`,s=a===`error`&&`border-2 border-destructive`,c=a===`cancelled`&&`border-2 border-cancelled`,l;t[5]!==n||t[6]!==o||t[7]!==s||t[8]!==c?(l=Q(`node-container relative flex flex-col items-center justify-center gap-0 overflow-visible rounded-md border-[1.5px] border-canvas-line bg-card p-0 shadow-none transition-all duration-150 ease-out`,o,s,c,n),t[5]=n,t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]===a?u=t[11]:(u=a===`running`&&(0,X.jsx)(Qbe,{}),t[10]=a,t[11]=u);let d;t[12]===a?d=t[13]:(d=(0,X.jsx)(ixe,{status:a}),t[12]=a,t[13]=d);let f;t[14]===r.target?f=t[15]:(f=K7(`target`,r.target),t[14]=r.target,t[15]=f);let p;t[16]===r.source?p=t[17]:(p=K7(`source`,r.source),t[16]=r.source,t[17]=p);let m;return t[18]!==i||t[19]!==l||t[20]!==u||t[21]!==d||t[22]!==f||t[23]!==p?(m=(0,X.jsxs)(exe,{className:l,...i,children:[u,d,f,p,i.children]}),t[18]=i,t[19]=l,t[20]=u,t[21]=d,t[22]=f,t[23]=p,t[24]=m):m=t[24],m},J7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-base`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(txe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},Y7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`w-full truncate text-xs`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(nxe,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},X7=e=>{let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex w-full flex-col items-center justify-center gap-1 px-3 py-2 text-center`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};function axe(e){if(!e)return``;let t=e.messages.length,n=t===1?`issue`:`issues`;return e.severity===`blocking`?`${t} blocking ${n}`:`${t} ${n}`}function Z7(e){let t=(0,Z.c)(13),{issues:n,placement:r}=e,i=r===void 0?`corner`:r;if(!n)return null;let a,o;t[0]===n.messages?(a=t[1],o=t[2]):([a,...o]=n.messages,t[0]=n.messages,t[1]=a,t[2]=o);let s;t[3]===n?s=t[4]:(s=axe(n),t[3]=n,t[4]=s);let c=i===`corner`?`absolute top-2 left-2 z-10`:`shrink-0`,l=n.severity===`blocking`?`bg-warning/50`:`bg-muted-foreground/40`,u;t[5]!==c||t[6]!==l?(u=Q(`rounded-full p-1`,c,l),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=o.length>0?`${a} and ${o.length} more`:a,f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,X.jsx)(py,{className:`size-3.5 text-background`}),t[8]=f):f=t[8];let p;return t[9]!==s||t[10]!==u||t[11]!==d?(p=(0,X.jsx)(`div`,{"aria-label":s,className:u,role:`img`,title:d,children:f}),t[9]=s,t[10]=u,t[11]=d,t[12]=p):p=t[12],p}var oxe=/(-?\d+(?:\.\d+)?)\s*(ms|s|m|h|d|w)/gi,sxe=/(Z|[+-]\d{2}:\d{2})$/i,cxe=/^(-)?P(?:(\d+(?:\.\d+)?)W)?(?:(\d+(?:\.\d+)?)D)?(?:T(?:(\d+(?:\.\d+)?)H)?(?:(\d+(?:\.\d+)?)M)?(?:(\d+(?:\.\d+)?)S)?)?$/i,lxe=/^-?\d+(?:\.\d+)?$/,uxe=/^\d+$/,dxe=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2}))?)?$/;function Q7(e){switch(e){case`ms`:return 1;case`s`:return 1e3;case`m`:return 6e4;case`h`:return 36e5;case`d`:return 864e5;case`w`:return 6048e5;default:return NaN}}function fxe(e){let t=cxe.exec(e.trim());if(!t)return null;let n=t[1]?-1:1,r=Number.parseFloat(t[2]??`0`),i=Number.parseFloat(t[3]??`0`),a=Number.parseFloat(t[4]??`0`),o=Number.parseFloat(t[5]??`0`),s=Number.parseFloat(t[6]??`0`);return n*(r*Q7(`w`)+i*Q7(`d`)+a*Q7(`h`)+o*Q7(`m`)+s*Q7(`s`))}function $7(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return null;let t=e.trim();if(!t)return null;if(lxe.test(t))return Number.parseFloat(t);let n=fxe(t);if(n!==null)return n;let r=0,i=!1;for(let e of t.matchAll(oxe)){let t=Number.parseFloat(e[1]),n=Q7(e[2].toLowerCase());if(!Number.isFinite(t)||Number.isNaN(n))return null;i=!0,r+=t*n}return i?r:null}function pxe(e){let t=dxe.exec(e);return t?{year:Number.parseInt(t[1],10),month:Number.parseInt(t[2],10),day:Number.parseInt(t[3],10),hour:Number.parseInt(t[4]??`0`,10),minute:Number.parseInt(t[5]??`0`,10),second:Number.parseInt(t[6]??`0`,10)}:null}function e9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1}).formatToParts(e),r=Object.fromEntries(n.map(e=>[e.type,e.value]));return Date.UTC(Number.parseInt(r.year,10),Number.parseInt(r.month,10)-1,Number.parseInt(r.day,10),Number.parseInt(r.hour,10),Number.parseInt(r.minute,10),Number.parseInt(r.second,10))-e.getTime()}function mxe(e,t){let n=pxe(e);if(!n)return null;let r=new Date(Date.UTC(n.year,n.month-1,n.day,n.hour,n.minute,n.second)),i=e9(r,t),a=new Date(r.getTime()-i),o=e9(a,t);return o===i?a:new Date(r.getTime()-o)}function t9(e,t){if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e==`number`)return n9(e);if(typeof e!=`string`)return null;let n=e.trim();return n?hxe(n)??gxe(n)??_xe(n,t):null}function n9(e){if(typeof e==`number`&&!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t}function hxe(e){if(!uxe.test(e))return null;let t=Number.parseInt(e,10);return n9(e.length<=10?t*1e3:t)}function gxe(e){return sxe.test(e)?n9(e):null}function _xe(e,t){if(t){let n=mxe(e,t);if(n)return n}return n9(e)}function vxe(e,t,n,r){let i=e9(e,r),a=e.getTime()+i,o=new Date(a),s=o.getUTCHours()*60+o.getUTCMinutes();if(s>=t&&s<n)return e;let c=Math.floor(t/60),l=t%60,u=s<t?0:1,d=new Date(a);d.setUTCDate(d.getUTCDate()+u),d.setUTCHours(c,l,0,0);let f=new Date(d.getTime()-i),p=e9(f,r);return p===i?f:new Date(d.getTime()-p)}function yxe(e){let t=f4(e.waitAllowedHoursMode);if(t===`off`)return{date:e.candidate};let n=_fe({mode:t,startTime:e.waitAllowedStartTime,endTime:e.waitAllowedEndTime});if(n.length>0)return{date:e.candidate,error:n.map(e=>e.message).join(` `)};if(!e.timeZone)return{date:e.candidate,error:`Timezone is required when allowed-hours window is enabled.`};let r=p4(e.waitAllowedStartTime),i=p4(e.waitAllowedEndTime);return r===null||i===null?{date:e.candidate,error:`Invalid allowed-hours time format after validation.`}:{date:vxe(e.candidate,r,i,e.timeZone)}}function r9(e){let t=e.now??new Date,n=typeof e.waitTimezone==`string`&&e.waitTimezone.trim()?e.waitTimezone.trim():void 0,r;if(e.waitUntil!==void 0&&e.waitUntil!==``){let t=t9(e.waitUntil,n);if(!t)return{error:`Invalid waitUntil value. Use an ISO timestamp or unix epoch.`};let i=$7(e.waitOffset);if(e.waitOffset!==void 0&&e.waitOffset!==``&&i===null)return{error:`Invalid waitOffset value. Use duration like -1d, 6h, 30m, or ISO duration.`};r=new Date(t.getTime()+(i??0))}else{let n=$7(e.waitDuration);if(n===null)return{error:`Invalid waitDuration value. Use milliseconds, duration tokens (e.g. 24h), or ISO duration.`};r=new Date(t.getTime()+n)}let i=yxe({candidate:r,waitAllowedHoursMode:e.waitAllowedHoursMode,waitAllowedStartTime:e.waitAllowedStartTime,waitAllowedEndTime:e.waitAllowedEndTime,timeZone:n});return i.error?{error:i.error}:{waitUntil:i.date}}var bxe={};function xxe(){let e=(0,Z.c)(5),t=wA(O2),n;e[0]===t?n=e[1]:(n=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:t??``},select:eye}),e[0]=t,e[1]=n);let r=t!==null,i;e[2]!==n||e[3]!==r?(i={...n,enabled:r},e[2]=n,e[3]=r,e[4]=i):i=e[4];let{data:a}=Xe(i);return a??bxe}var Sxe=Wh(Ch({waitMode:ph(Rh),waitTimezone:ph(Rh),waitDuration:ph(gh),waitUntil:ph(gh),waitOffset:ph(gh),waitTimeout:ph(gh)}));function i9(e){return typeof e==`string`&&e.includes(`{{`)&&e.includes(`}}`)}function a9(e){let t=Math.max(Math.floor(e/1e3),0),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=t%60;return`${n} ${n===1?`day`:`days`} ${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function o9(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,month:`long`,day:`numeric`,year:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0,timeZoneName:`short`}),r=Object.fromEntries(n.formatToParts(e).map(e=>[e.type,e.value])),i=r.dayPeriod?` ${r.dayPeriod.toUpperCase()}`:``,a=r.timeZoneName?` ${r.timeZoneName}`:``;return`${r.month} ${r.day}, ${r.year} ${r.hour}:${r.minute}${i}${a}`}function Cxe(e,t){let n=(0,Z.c)(15),r=v0(t,`waitMode`,`delay`),i=e===b1.wait&&(r===`delay`||r===`event`),a=t?.waitDuration,o=t?.waitUntil,s=t?.waitOffset,c;n[0]===t?c=n[1]:(c=typeof t?.waitTimezone==`string`&&t.waitTimezone.trim()?t.waitTimezone.trim():void 0,n[0]=t,n[1]=c);let l=c,u=i9(a)||i9(o)||i9(s),d;bb0:{if(!i||u||r===`event`){d=null;break bb0}let e;n[2]!==a||n[3]!==s||n[4]!==l||n[5]!==o?(e=r9({waitDuration:a,waitUntil:o,waitOffset:s,waitTimezone:l}),n[2]=a,n[3]=s,n[4]=l,n[5]=o,n[6]=e):e=n[6],d=e}let f=d;if(!i)return null;if(r===`event`){let e;return n[7]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Waiting for event`,triggerTime:`Resumes when a matching event arrives`},n[7]=e):e=n[7],e}if(u){let e;return n[8]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Runtime-calculated`,triggerTime:`Trigger time comes from workflow data`},n[8]=e):e=n[8],e}if(!f?.waitUntil){let e;return n[9]===Symbol.for(`react.memo_cache_sentinel`)?(e={countdown:`Set wait duration`,triggerTime:`Add a valid wait time`},n[9]=e):e=n[9],e}let p;n[10]!==f.waitUntil||n[11]!==l?(p=o9(f.waitUntil,l),n[10]=f.waitUntil,n[11]=l,n[12]=p):p=n[12];let m;return n[13]===p?m=n[14]:(m={countdown:`Delay configured`,triggerTime:p},n[13]=p,n[14]=m),m}function wxe(e,t,n){let r=(0,Z.c)(16),i=e===b1.wait&&t!==null&&n!==void 0&&(n.status===`running`||n.status===`pending`),a;r[0]===i?a=r[1]:(a={intervalMs:1e3,enabled:i},r[0]=i,r[1]=a);let o=SY(a);n?.input;let s;bb0:{if(!i){s=null;break bb0}let e;r[2]===n?.input?e=r[3]:(e=Sxe(n?.input)??null,r[2]=n?.input,r[3]=e),s=e}let c=s,l,u,d;if(r[4]!==n||r[5]!==o||r[6]!==c||r[7]!==i){d=Symbol.for(`react.early_return_sentinel`);bb1:{let e=i&&n?.startedAt!==void 0?t9(n.startedAt):null;if(!(i&&c&&e)){d=null;break bb1}let t=c.waitMode||`delay`,a=c.waitTimezone||void 0;if(t===`event`){let t=r9({now:e,waitDuration:c.waitTimeout});if(!t.waitUntil){d={countdown:`Waiting for event`,triggerTime:`Resumes when matching event arrives`};break bb1}d={countdown:a9(t.waitUntil.getTime()-o),triggerTime:o9(t.waitUntil,a)};break bb1}let s=r9({now:e,waitDuration:c.waitDuration,waitUntil:c.waitUntil,waitOffset:c.waitOffset,waitTimezone:a});if(!s.waitUntil){d={countdown:`Runtime-calculated`,triggerTime:`Waiting timestamp unavailable`};break bb1}let f=s.waitUntil.getTime()-o;r[11]===f?l=r[12]:(l=a9(f),r[11]=f,r[12]=l),u=o9(s.waitUntil,a)}r[4]=n,r[5]=o,r[6]=c,r[7]=i,r[8]=l,r[9]=u,r[10]=d}else l=r[8],u=r[9],d=r[10];if(d!==Symbol.for(`react.early_return_sentinel`))return d;let f;return r[13]!==l||r[14]!==u?(f={countdown:l,triggerTime:u},r[13]=l,r[14]=u,r[15]=f):f=r[15],f}var Txe=e=>({"gpt-5":`GPT-5`,"openai/gpt-5.1-instant":`GPT-5.1 Instant`,"openai/gpt-5.1-codex":`GPT-5.1 Codex`,"openai/gpt-5.1-codex-mini":`GPT-5.1 Codex Mini`,"openai/gpt-5.1-thinking":`GPT-5.1 Thinking`,"gpt-4":`GPT-4`,"gpt-4o":`GPT-4o`,"gpt-4o-mini":`GPT-4o Mini`,"claude-3-5-sonnet":`Claude 3.5`,"claude-3-opus":`Claude 3 Opus`,"anthropic/claude-opus-4.5":`Claude Opus 4.5`,"anthropic/claude-sonnet-4.5":`Claude Sonnet 4.5`,"anthropic/claude-haiku-4.5":`Claude Haiku 4.5`,"google/gemini-3-pro-preview":`Gemini 3 Pro Preview`,"google/gemini-2.5-flash-lite":`Gemini 2.5 Flash Lite`,"google/gemini-2.5-flash":`Gemini 2.5 Flash`,"google/gemini-2.5-pro":`Gemini 2.5 Pro`,"meta/llama-4-scout":`Llama 4 Scout`,"meta/llama-3.3-70b":`Llama 3.3 70B`,"meta/llama-3.1-8b":`Llama 3.1 8B`,"moonshotai/kimi-k2-0905":`Kimi K2`,"openai/gpt-oss-120b":`GPT OSS 120B`,"openai/gpt-oss-safeguard-20b":`GPT OSS Safeguard 20B`,"openai/gpt-oss-20b":`GPT OSS 20B`,"o1-preview":`o1 Preview`,"o1-mini":`o1 Mini`,"bfl/flux-2-pro":`FLUX.2 Pro`,"bfl/flux-1-pro":`FLUX.1 Pro`,"openai/dall-e-3":`DALL-E 3`,"google/imagen-4.0-generate":`Imagen 4.0`})[e]||e,Exe=(e,t)=>{let n=Py(e,t)?.integration;return n&&Fy(e,n)?.label||`System`},s9=e=>{let t=(0,Z.c)(19),{actionType:n,catalog:r,className:i}=e,a=i===void 0?O4:i,o=xy();switch(n){case b1.condition:{let e;t[0]===a?e=t[1]:(e=Q(a,`text-node-condition`),t[0]=a,t[1]=e);let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(fte,{className:e,strokeWidth:1.5}),t[2]=e,t[3]=n),n}case b1.eventSplit:{let e;t[4]===a?e=t[5]:(e=Q(a,`text-node-split`),t[4]=a,t[5]=e);let n;return t[6]===e?n=t[7]:(n=(0,X.jsx)(Ate,{className:e,strokeWidth:1.5}),t[6]=e,t[7]=n),n}case b1.wait:{let e;t[8]===a?e=t[9]:(e=Q(a,`text-node-wait`),t[8]=a,t[9]=e);let n;return t[10]===e?n=t[11]:(n=(0,X.jsx)(hte,{className:e,strokeWidth:1.5}),t[10]=e,t[11]=n),n}}let s=Py(r,n)?.integration;if(s){let e=o[s];if(e){let n=e.icon,r;return t[12]!==n||t[13]!==a?(r=(0,X.jsx)(n,{className:a}),t[12]=n,t[13]=a,t[14]=r):r=t[14],r}}let c;t[15]===a?c=t[16]:(c=Q(a,`text-node-wait`),t[15]=a,t[16]=c);let l;return t[17]===c?l=t[18]:(l=(0,X.jsx)(gy,{className:c,strokeWidth:1.5}),t[17]=c,t[18]=l),l};function Dxe(e){let t=(0,Z.c)(14),{base64:n}=e,[r,i]=(0,Y.useState)(!1),a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Q(O4,`relative cursor-zoom-in overflow-hidden rounded-lg transition-transform hover:scale-105`),o=e=>{e.stopPropagation(),i(!0)},t[0]=a,t[1]=o):(a=t[0],o=t[1]);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=Q(O4,`object-cover`),t[2]=s):s=t[2];let c=`data:image/png;base64,${n}`,l;t[3]===c?l=t[4]:(l=(0,X.jsx)(`button`,{className:a,onClick:o,type:`button`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:s,height:20,src:c,width:20})}),t[3]=c,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(mY,{className:`sr-only`,children:`Generated Image`}),t[5]=u):u=t[5];let d=`data:image/png;base64,${n}`,f;t[6]===d?f=t[7]:(f=(0,X.jsxs)(dY,{className:`max-w-3xl p-2`,showCloseButton:!1,children:[u,(0,X.jsx)(`div`,{className:`relative aspect-square w-full overflow-hidden rounded-lg`,children:(0,X.jsx)(`img`,{alt:`Generated output`,className:`h-auto w-full object-contain`,height:768,src:d,width:768})})]}),t[6]=d,t[7]=f);let p;t[8]!==r||t[9]!==f?(p=(0,X.jsx)(cY,{onOpenChange:i,open:r,children:f}),t[8]=r,t[9]=f,t[10]=p):p=t[10];let m;return t[11]!==l||t[12]!==p?(m=(0,X.jsxs)(X.Fragment,{children:[l,p]}),t[11]=l,t[12]=p,t[13]=m):m=t[13],m}var c9=`38%`,l9=`62%`;function u9(e,t){return`${(e+.5)/t*100}%`}var d9=`group-child-handle`,Oxe=[{position:_w.Top,className:d9}],kxe=[{position:_w.Bottom,className:d9}],Axe=[{id:`true`,position:_w.Bottom,className:d9,style:{left:c9}},{id:`false`,position:_w.Bottom,className:d9,style:{left:l9}}];function jxe(e){let t=(0,Z.c)(26),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=_0(n?.config,`actionType`),c=T0(s),l;if(t[0]!==i||t[1]!==o?(l=()=>{o(i)},t[0]=i,t[1]=o,t[2]=l):l=t[2],yY(c,l),!n)return null;let u=n.label||(s?Py(a,s)?.label:void 0)||s||`Action`,d=r&&`border-primary`,f=n.enabled===!1&&`opacity-50`,p;t[3]!==d||t[4]!==f?(p=Q(`nodrag flex h-14 w-[188px] flex-row items-center shadow-none transition-all duration-150 ease-out`,d,f),t[3]=d,t[4]=f,t[5]=p):p=t[5];let m=`action-node-${i}`,h=c?Axe:kxe,g;t[6]===h?g=t[7]:(g={target:Oxe,source:h},t[6]=h,t[7]=g);let _;t[8]!==s||t[9]!==a?(_=s?(0,X.jsx)(s9,{actionType:s,catalog:a,className:Q(O4,`shrink-0`)}):(0,X.jsx)(gy,{className:Q(O4,`shrink-0 text-muted-foreground`),strokeWidth:1.5}),t[8]=s,t[9]=a,t[10]=_):_=t[10];let v;t[11]===u?v=t[12]:(v=(0,X.jsx)(J7,{className:`truncate text-sm`,children:u}),t[11]=u,t[12]=v);let y;t[13]!==n.enabled||t[14]!==n.issues?(y=n.enabled!==!1&&(0,X.jsx)(Z7,{issues:n.issues,placement:`inline`}),t[13]=n.enabled,t[14]=n.issues,t[15]=y):y=t[15];let b;t[16]!==y||t[17]!==_||t[18]!==v?(b=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2 px-3`,children:[_,v,y]}),t[16]=y,t[17]=_,t[18]=v,t[19]=b):b=t[19];let x;return t[20]!==n.status||t[21]!==b||t[22]!==p||t[23]!==m||t[24]!==g?(x=(0,X.jsx)(q7,{className:p,"data-testid":m,handles:g,status:n.status,children:b}),t[20]=n.status,t[21]=b,t[22]=p,t[23]=m,t[24]=g,t[25]=x):x=t[25],x}var f9=(0,Y.memo)(e=>{let t=(0,Z.c)(99),{data:n,selected:r,id:i}=e,a=yy(),o=qO(),s=wA(O2),c=xxe()[i],l,u,d;t[0]===n?.config?(l=t[1],u=t[2],d=t[3]):(l=_0(n?.config,`actionType`),u=T0(l),d=Dme(l),t[0]=n?.config,t[1]=l,t[2]=u,t[3]=d);let f=d,p=k8(f?i:null),m=wxe(l??``,s,c),h=Cxe(l??``,n?.config),g=m??h,_;t[4]!==f||t[5]!==p?(_=f?p.map(Mxe).join(`|`):null,t[4]=f,t[5]=p,t[6]=_):_=t[6];let v=_,y;if(t[7]!==i||t[8]!==u||t[9]!==f||t[10]!==o?(y=()=>{(u||f)&&o(i)},t[7]=i,t[8]=u,t[9]=f,t[10]=o,t[11]=y):y=t[11],yY(u?i:v,y),!n)return null;let b=n.status,x;t[12]!==l||t[13]!==c?.output||t[14]!==s?(x=s&&l===`Generate Image`?v7(c?.output):null,t[12]=l,t[13]=c?.output,t[14]=s,t[15]=x):x=t[15];let S=x;if(!l){let e=n.enabled===!1,a=r&&`border-primary`,o=e&&`opacity-50`,s;t[16]!==a||t[17]!==o?(s=Q(a,o),t[16]=a,t[17]=o,t[18]=s):s=t[18];let c=`action-node-${i}`,l;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(l={target:!0,source:!0},t[19]=l):l=t[19];let u;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(u=T4(),t[20]=u):u=t[20];let d;t[21]===e?d=t[22]:(d=e&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[21]=e,t[22]=d);let f;t[23]!==n.issues||t[24]!==e?(f=!e&&(0,X.jsx)(Z7,{issues:n.issues}),t[23]=n.issues,t[24]=e,t[25]=f):f=t[25];let p;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,X.jsx)(gy,{className:Q(O4,`text-muted-foreground`),strokeWidth:1.5}),t[26]=p):p=t[26];let m=n.label||`Action`,h;t[27]===m?h=t[28]:(h=(0,X.jsx)(J7,{children:m}),t[27]=m,t[28]=h);let g;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(Y7,{children:`Select an action`}),t[29]=g):g=t[29];let _;t[30]===h?_=t[31]:(_=(0,X.jsxs)(X7,{children:[p,h,g]}),t[30]=h,t[31]=_);let v;return t[32]!==b||t[33]!==d||t[34]!==f||t[35]!==_||t[36]!==s||t[37]!==c?(v=(0,X.jsxs)(q7,{className:s,"data-testid":c,handles:l,status:b,style:u,children:[d,f,_]}),t[32]=b,t[33]=d,t[34]=f,t[35]=_,t[36]=s,t[37]=c,t[38]=v):v=t[38],v}let C;t[39]!==l||t[40]!==a?(C=Py(a,l),t[39]=l,t[40]=a,t[41]=C):C=t[41];let w=C,T=n.label||w?.label||l,E;t[42]!==l||t[43]!==n.config?(E=()=>l===`Generate Text`?v0(n.config,`aiModel`,`meta/llama-4-scout`):l===`Generate Image`?v0(n.config,`imageModel`,`google/imagen-4.0-generate`):null,t[42]=l,t[43]=n.config,t[44]=E):E=t[44];let D=E,O,k;if(t[45]!==l||t[46]!==a||t[47]!==n.description||t[48]!==n.enabled||t[49]!==D||t[50]!==g){let e=D();O=n.enabled===!1,k=g?g.countdown:e?Txe(e):n.description||Exe(a,l),t[45]=l,t[46]=a,t[47]=n.description,t[48]=n.enabled,t[49]=D,t[50]=g,t[51]=O,t[52]=k}else O=t[51],k=t[52];let A=k,j=r&&`border-primary`,M=O&&`opacity-50`,N;t[53]!==j||t[54]!==M?(N=Q(j,M),t[53]=j,t[54]=M,t[55]=N):N=t[55];let P=`action-node-${i}`,F;t[56]!==u||t[57]!==f||t[58]!==p?(F=u?[{id:`true`,position:_w.Bottom,style:{left:c9,width:12,height:12}},{id:`false`,position:_w.Bottom,style:{left:l9,width:12,height:12}}]:!f||p.map((e,t)=>({id:Y6(e.name),position:_w.Bottom,style:{left:u9(t,p.length),width:12,height:12}})),t[56]=u,t[57]=f,t[58]=p,t[59]=F):F=t[59];let I;t[60]===F?I=t[61]:(I={target:!0,source:F},t[60]=F,t[61]=I);let L;t[62]!==f||t[63]!==p?(L=T4(f?D4(p.length):192),t[62]=f,t[63]=p,t[64]=L):L=t[64];let R;t[65]===O?R=t[66]:(R=O&&(0,X.jsx)(`div`,{className:`absolute top-2 left-2 rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[65]=O,t[66]=R);let z;t[67]!==n.issues||t[68]!==O?(z=!O&&(0,X.jsx)(Z7,{issues:n.issues}),t[67]=n.issues,t[68]=O,t[69]=z):z=t[69];let B;t[70]===u?B=t[71]:(B=u&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[38%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`True`}),(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 left-[62%] -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,children:`False`})]}),t[70]=u,t[71]=B);let V;t[72]!==f||t[73]!==p?(V=f&&p.map((e,t)=>(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 max-w-28 -translate-x-1/2 truncate rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:u9(t,p.length)},title:e.name,children:e.label},e.name)),t[72]=f,t[73]=p,t[74]=V):V=t[74];let H;t[75]!==l||t[76]!==a||t[77]!==S?(H=S?(0,X.jsx)(Dxe,{base64:S}):(0,X.jsx)(s9,{actionType:l,catalog:a}),t[75]=l,t[76]=a,t[77]=S,t[78]=H):H=t[78];let U;t[79]===T?U=t[80]:(U=(0,X.jsx)(J7,{children:T}),t[79]=T,t[80]=U);let W;t[81]!==A||t[82]!==g?(W=A&&(0,X.jsx)(Y7,{className:g?`font-medium tabular-nums`:void 0,children:A}),t[81]=A,t[82]=g,t[83]=W):W=t[83];let G;t[84]!==H||t[85]!==U||t[86]!==W?(G=(0,X.jsxs)(X7,{children:[H,U,W]}),t[84]=H,t[85]=U,t[86]=W,t[87]=G):G=t[87];let K;return t[88]!==b||t[89]!==N||t[90]!==P||t[91]!==I||t[92]!==L||t[93]!==R||t[94]!==z||t[95]!==B||t[96]!==V||t[97]!==G?(K=(0,X.jsxs)(q7,{className:N,"data-testid":P,handles:I,status:b,style:L,children:[R,z,B,V,G]}),t[88]=b,t[89]=N,t[90]=P,t[91]=I,t[92]=L,t[93]=R,t[94]=z,t[95]=B,t[96]=V,t[97]=G,t[98]=K):K=t[98],K});f9.displayName=`StandaloneActionNode`;var p9=(0,Y.memo)(e=>{let t=(0,Z.c)(4);if(e.parentId){let n;return t[0]===e?n=t[1]:(n=(0,X.jsx)(jxe,{...e}),t[0]=e,t[1]=n),n}let n;return t[2]===e?n=t[3]:(n=(0,X.jsx)(f9,{...e}),t[2]=e,t[3]=n),n});p9.displayName=`ActionNode`;function Mxe(e){return e.name}function Nxe(e){let t=(0,Z.c)(3),{data:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(cy,{className:`size-4`}),t[0]=r):r=t[0];let i;return t[1]===n.onClick?i=t[2]:(i=(0,X.jsx)(`div`,{className:`flex items-center justify-center rounded-lg border border-border border-dashed bg-background/50 p-8 backdrop-blur-sm`,children:(0,X.jsxs)(zv,{className:`gap-2 shadow-lg`,onClick:n.onClick,size:`default`,children:[r,`Add a Step`]})}),t[1]=n.onClick,t[2]=i),i}var m9=(0,Y.memo)(e=>{let t=(0,Z.c)(19),{data:n,selected:r,id:i}=e;if(!n||!D0({data:n}))return null;let a=n.enabled===!1,o=r&&`border-primary`,s=a&&`opacity-50`,c;t[0]!==o||t[1]!==s?(c=Q(`flex h-full w-full flex-col rounded-md border-[1.5px] border-canvas-line bg-muted shadow-none`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=`group-node-${i}`,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,X.jsx)(dD,{position:_w.Top,type:`target`}),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a&&(0,X.jsx)(`span`,{className:`rounded-full bg-muted-foreground/50 p-1`,children:(0,X.jsx)(ny,{className:`size-3.5 text-background`})}),t[4]=a,t[5]=d);let f=n.label||`Group`,p;t[6]!==d||t[7]!==f?(p=(0,X.jsxs)(`div`,{className:`flex h-9 shrink-0 items-center gap-2 border-canvas-line/60 border-b px-3 font-medium text-sm`,children:[d,f]}),t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==n||t[10]!==i?(m=A0({data:n,id:i}),t[9]=n,t[10]=i,t[11]=m):m=t[11];let h;t[12]===m?h=t[13]:(h=(0,X.jsx)(dD,{id:m,position:_w.Bottom,type:`source`}),t[12]=m,t[13]=h);let g;return t[14]!==h||t[15]!==c||t[16]!==l||t[17]!==p?(g=(0,X.jsxs)(`div`,{className:c,"data-testid":l,children:[u,p,h]}),t[14]=h,t[15]=c,t[16]=l,t[17]=p,t[18]=g):g=t[18],g});m9.displayName=`GroupNode`;var h9=`25%`,g9=`75%`;function Pxe(e){let t=C1(e);return t?.startEvents.length?`On ${t.startEvents.join(`, `)}`:E1(t)?`Manual runs only`:`Nothing starts this yet`}var _9=(0,Y.memo)(e=>{let t=(0,Z.c)(33),{data:n,selected:r}=e;if(!n)return null;let i=n.label||`Lifecycle`,a;t[0]===n.config?a=t[1]:(a=Pxe(n.config),t[0]=n.config,t[1]=a);let o=a,s=n.description||o,c=n.status,l;t[2]===n.config?l=t[3]:(l=w1(n.config),t[2]=n.config,t[3]=l);let u=!l,d=r&&`border-primary`,f;t[4]===d?f=t[5]:(f=Q(d),t[4]=d,t[5]=f);let p;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p={id:k2,position:_w.Bottom,style:{left:h9,width:12,height:12}},t[6]=p):p=t[6];let m;t[7]===u?m=t[8]:(m={target:!1,source:[p,{id:A2,position:_w.Bottom,style:{left:g9,width:12,height:12,...u?{opacity:.45}:{}}}]},t[7]=u,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=T4(),t[9]=h):h=t[9];let g;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,X.jsx)(`div`,{className:`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,style:{left:h9},children:`Started`}),t[10]=g):g=t[10];let _=u&&`opacity-50`,v;t[11]===_?v=t[12]:(v=Q(`pointer-events-none absolute -bottom-8 -translate-x-1/2 rounded-sm border bg-card px-1.5 py-0.5 text-xs text-muted-foreground leading-none`,_),t[11]=_,t[12]=v);let y;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(y={left:g9},t[13]=y):y=t[13];let b;t[14]===v?b=t[15]:(b=(0,X.jsx)(`div`,{className:v,style:y,children:`Canceled`}),t[14]=v,t[15]=b);let x;t[16]===n.issues?x=t[17]:(x=(0,X.jsx)(Z7,{issues:n.issues}),t[16]=n.issues,t[17]=x);let S;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,X.jsx)(sy,{className:Q(O4,`text-node-lifecycle`),strokeWidth:1.5}),t[18]=S):S=t[18];let C;t[19]===i?C=t[20]:(C=(0,X.jsx)(J7,{children:i}),t[19]=i,t[20]=C);let w;t[21]===s?w=t[22]:(w=s&&(0,X.jsx)(Y7,{children:s}),t[21]=s,t[22]=w);let T;t[23]!==C||t[24]!==w?(T=(0,X.jsxs)(X7,{children:[S,C,w]}),t[23]=C,t[24]=w,t[25]=T):T=t[25];let E;return t[26]!==c||t[27]!==b||t[28]!==x||t[29]!==T||t[30]!==f||t[31]!==m?(E=(0,X.jsxs)(q7,{className:f,handles:m,status:c,style:h,children:[g,b,x,T]}),t[26]=c,t[27]=b,t[28]=x,t[29]=T,t[30]=f,t[31]=m,t[32]=E):E=t[32],E});_9.displayName=`LifecycleNode`;function Fxe(e){let t=(0,Z.c)(8),n=TA(d3),r=TA(f3),i=TA(p3),a=TA(Y4),o=yy(),s;t[0]!==o||t[1]!==n||t[2]!==i||t[3]!==a||t[4]!==r?(s=e=>{if(!(e.metaKey||e.ctrlKey)||e.shiftKey||e.altKey||V7(e.target))return;let t=e.key.toLowerCase();if(t===`c`){n()&&e.preventDefault();return}if(t===`v`){r()&&e.preventDefault();return}if(t===`d`){i()&&e.preventDefault();return}t===`g`&&a({catalog:o})&&e.preventDefault()},t[0]=o,t[1]=n,t[2]=i,t[3]=a,t[4]=r,t[5]=s):s=t[5];let c=s,l;t[6]===e?l=t[7]:(l={enabled:e},t[6]=e,t[7]=l),_Y(window,`keydown`,c,l)}var Ixe=300;function Lxe(){let e=(0,Z.c)(8),t=wA(Q4),n=yy(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i0(),e[0]=r):r=e[0];let{data:i}=Xe(r),a=TA(C4),o=bY(t,Ixe),s;bb0:{if(!i){s=S4;break bb0}let t;e[1]!==n||e[2]!==i||e[3]!==o?(t=y4({nodes:G1(o),catalog:n,integrations:i}),e[1]=n,e[2]=i,e[3]=o,e[4]=t):t=e[4],s=t}let c=s,l;e[5]!==c||e[6]!==a?(l=()=>{a(e=>Lfe(e,c)?e:c)},e[5]=c,e[6]=a,e[7]=l):l=e[7],vY(c,l)}var Rxe=8,zxe=280;function Bxe(e){let t=(0,Z.c)(106),{menuState:n,onClose:r}=e,i=wA(Q4),a=wA($4),o=TA(h3),s=TA(Z4),c=TA(u3),l=TA(d3),u=TA(f3),d=TA(p3),f=TA(Y4),p=TA(X4),m=wA(lpe),h=TA(H4),g=TA(g2),_=yy(),{open:v}=RY(),{openSheet:y}=O7(),b=jY(),x=(0,Y.useRef)(null),S;t[0]!==o||t[1]!==n||t[2]!==r||t[3]!==v?(S=()=>{if(n?.nodeId){let e=n.nodeId;r(),v(CX,{title:`Delete Step`,message:`Are you sure you want to delete this node? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{o(e)}})}},t[0]=o,t[1]=n,t[2]=r,t[3]=v,t[4]=S):S=t[4];let C=S,w;t[5]!==b||t[6]!==n||t[7]!==r||t[8]!==y||t[9]!==g||t[10]!==h?(w=()=>{if(n?.nodeId){let e=n.nodeId;r(),h(e),g(`properties`),b&&y()}},t[5]=b,t[6]=n,t[7]=r,t[8]=y,t[9]=g,t[10]=h,t[11]=w):w=t[11];let T=w,E;t[12]!==s||t[13]!==n||t[14]!==r||t[15]!==v?(E=()=>{if(n?.edgeId){let e=n.edgeId;r(),v(CX,{title:`Delete Connection`,message:`Are you sure you want to delete this connection? This action cannot be undone.`,confirmLabel:`Delete`,confirmVariant:`destructive`,onConfirm:()=>{s(e)}})}},t[12]=s,t[13]=n,t[14]=r,t[15]=v,t[16]=E):E=t[16];let D=E,O;t[17]!==c||t[18]!==n||t[19]!==r||t[20]!==g||t[21]!==h?(O=()=>{if(n?.flowPosition){let e={id:u0(),type:`action`,position:{x:n.flowPosition.x,y:n.flowPosition.y-56},data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};c(e),h(e.id),g(`properties`)}r()},t[17]=c,t[18]=n,t[19]=r,t[20]=g,t[21]=h,t[22]=O):O=t[22];let k=O,A;t[23]!==l||t[24]!==n||t[25]!==r?(A=()=>{n?.nodeId&&l(n.nodeId),r()},t[23]=l,t[24]=n,t[25]=r,t[26]=A):A=t[26];let j=A,M;t[27]!==d||t[28]!==n||t[29]!==r?(M=()=>{n?.nodeId&&d(n.nodeId),r()},t[27]=d,t[28]=n,t[29]=r,t[30]=M):M=t[30];let N=M,P;t[31]!==_||t[32]!==f||t[33]!==n||t[34]!==r?(P=()=>{if(n?.type!==`node`){r();return}f({catalog:_,selectedIds:n.selectedIds??new Set}),r()},t[31]=_,t[32]=f,t[33]=n,t[34]=r,t[35]=P):P=t[35];let F=P,I;t[36]!==n||t[37]!==r||t[38]!==p?(I=()=>{n?.nodeId&&p(n.nodeId),r()},t[36]=n,t[37]=r,t[38]=p,t[39]=I):I=t[39];let L=I,R;t[40]!==n?.flowPosition||t[41]!==r||t[42]!==u?(R=()=>{u(n?.flowPosition),r()},t[40]=n?.flowPosition,t[41]=r,t[42]=u,t[43]=R):R=t[43];let z=R,B;t[44]===r?B=t[45]:(B=e=>{let t=e.target;x.current&&!(t instanceof globalThis.Node&&x.current.contains(t))&&r()},t[44]=r,t[45]=B);let V=B,H;t[46]===r?H=t[47]:(H=e=>{e.key===`Escape`&&r()},t[46]=r,t[47]=H);let U=H,W=n!==null,G;t[48]===W?G=t[49]:(G={deferAttach:!0,enabled:W},t[48]=W,t[49]=G),_Y(document,`mousedown`,V,G);let K;t[50]===W?K=t[51]:(K={enabled:W},t[50]=W,t[51]=K),_Y(document,`keydown`,U,K);let q;if(t[52]===W?q=t[53]:(q={enabled:W},t[52]=W,t[53]=q),_Y(window,`resize`,r,q),!n)return null;let J,ee,te,ne,re,ie;if(t[54]!==_||t[55]!==a||t[56]!==n.nodeId||t[57]!==n.selectedIds||t[58]!==i){ee=n.nodeId?i.find(e=>e.id===n.nodeId):void 0,ne=ee?.data.type===`lifecycle`;let e;t[65]===n.selectedIds?e=t[66]:(e=n.selectedIds??new Set,t[65]=n.selectedIds,t[66]=e);let r=e,o;t[67]!==_||t[68]!==a||t[69]!==r||t[70]!==i?(o=P0(i,a,r,_),t[67]=_,t[68]=a,t[69]=r,t[70]=i,t[71]=o):o=t[71],te=o,J=te.ok,re=P4(ee),ie=ee?M4([ee]):null,t[54]=_,t[55]=a,t[56]=n.nodeId,t[57]=n.selectedIds,t[58]=i,t[59]=J,t[60]=ee,t[61]=te,t[62]=ne,t[63]=re,t[64]=ie}else J=t[59],ee=t[60],te=t[61],ne=t[62],re=t[63],ie=t[64];let ae=ie,oe=n.position.y+zxe+Rxe>window.innerHeight,se=ee?.data.label||`Step`,ce=`min(${n.position.x}px, calc(100vw - 296px))`,le;t[72]!==n.position.y||t[73]!==oe?(le=oe?{bottom:`calc(100vh - ${n.position.y}px)`}:{top:n.position.y},t[72]=n.position.y,t[73]=oe,t[74]=le):le=t[74];let ue;t[75]!==ce||t[76]!==le?(ue={left:ce,...le},t[75]=ce,t[76]=le,t[77]=ue):ue=t[77];let de;t[78]!==J||t[79]!==ae||t[80]!==te.error||t[81]!==te.ok||t[82]!==j||t[83]!==C||t[84]!==N||t[85]!==T||t[86]!==F||t[87]!==L||t[88]!==ne||t[89]!==n.type||t[90]!==se||t[91]!==re?(de=n.type===`node`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y9,{icon:(0,X.jsx)(kte,{className:`size-4`}),label:`Edit ${se}`,onClick:T}),(0,X.jsx)(y9,{disabled:ne,icon:(0,X.jsx)($v,{className:`size-4`}),label:`Copy`,onClick:j,shortcut:v9(`C`)}),(0,X.jsx)(y9,{disabled:ne,icon:(0,X.jsx)(ute,{className:`size-4`}),label:`Duplicate`,onClick:N,shortcut:v9(`D`)}),(0,X.jsx)(y9,{disabled:!J,hint:!J&&!te.ok?te.error:void 0,icon:(0,X.jsx)(mte,{className:`size-4`}),label:`Group`,onClick:F,shortcut:v9(`G`)}),(0,X.jsx)(y9,{disabled:!re,icon:(0,X.jsx)(my,{className:`size-4`}),label:`Ungroup`,onClick:L}),(0,X.jsx)(y9,{disabled:ne||!!ae,hint:ae??void 0,icon:(0,X.jsx)(fy,{className:`size-4`}),label:`Delete ${se}`,onClick:C,variant:`destructive`})]}),t[78]=J,t[79]=ae,t[80]=te.error,t[81]=te.ok,t[82]=j,t[83]=C,t[84]=N,t[85]=T,t[86]=F,t[87]=L,t[88]=ne,t[89]=n.type,t[90]=se,t[91]=re,t[92]=de):de=t[92];let fe;t[93]!==D||t[94]!==n.type?(fe=n.type===`edge`&&(0,X.jsx)(y9,{icon:(0,X.jsx)(_te,{className:`size-4`}),label:`Delete Connection`,onClick:D,variant:`destructive`}),t[93]=D,t[94]=n.type,t[95]=fe):fe=t[95];let pe;t[96]!==k||t[97]!==z||t[98]!==m||t[99]!==n.type?(pe=n.type===`pane`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(y9,{icon:(0,X.jsx)(cy,{className:`size-4`}),label:`Add Step`,onClick:k}),(0,X.jsx)(y9,{disabled:!m,icon:(0,X.jsx)(lte,{className:`size-4`}),label:`Paste`,onClick:z,shortcut:v9(`V`)})]}),t[96]=k,t[97]=z,t[98]=m,t[99]=n.type,t[100]=pe):pe=t[100];let me;return t[101]!==ue||t[102]!==de||t[103]!==fe||t[104]!==pe?(me=(0,Xi.createPortal)((0,X.jsxs)(`div`,{className:`fade-in-0 zoom-in-95 fixed z-50 max-h-[calc(100vh-1rem)] w-fit min-w-[8rem] max-w-72 animate-in overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md`,ref:x,style:ue,children:[de,fe,pe]}),document.body),t[101]=ue,t[102]=de,t[103]=fe,t[104]=pe,t[105]=me):me=t[105],me}function v9(e){return typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.userAgent)?`⌘${e}`:`Ctrl+${e}`}function y9(e){let t=(0,Z.c)(23),{icon:n,label:r,onClick:i,variant:a,disabled:o,hint:s,shortcut:c}=e,l=(a===void 0?`default`:a)===`destructive`&&`text-destructive hover:bg-destructive/10 hover:text-destructive focus:bg-destructive/10 focus:text-destructive`,u=o&&`pointer-events-none opacity-50`,d;t[0]!==l||t[1]!==u?(d=Q(`relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none`,`hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground`,l,u),t[0]=l,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,X.jsx)(`span`,{className:`shrink-0`,children:n}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,X.jsx)(`span`,{className:`w-full truncate`,children:r}),t[5]=r,t[6]=p);let m;t[7]===s?m=t[8]:(m=s?(0,X.jsx)(`span`,{className:`text-muted-foreground text-xs leading-tight`,children:s}):null,t[7]=s,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col items-start text-left`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]!==o||t[13]!==c?(g=c&&!o?(0,X.jsx)(`span`,{className:`ml-auto shrink-0 pl-4 text-muted-foreground text-xs tracking-widest`,children:c}):null,t[12]=o,t[13]=c,t[14]=g):g=t[14];let _;return t[15]!==o||t[16]!==s||t[17]!==i||t[18]!==d||t[19]!==f||t[20]!==h||t[21]!==g?(_=(0,X.jsxs)(`button`,{className:d,disabled:o,onClick:i,title:s,type:`button`,children:[f,h,g]}),t[15]=o,t[16]=s,t[17]=i,t[18]=d,t[19]=f,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function Vxe(e,t,n){let r=(0,Z.c)(12),i;r[0]!==n||r[1]!==t?(i=(e,r)=>{e.preventDefault(),t({type:`node`,position:{x:e.clientX,y:e.clientY},nodeId:r.id,selectedIds:n()})},r[0]=n,r[1]=t,r[2]=i):i=r[2];let a=i,o;r[3]===t?o=r[4]:(o=(e,n)=>{e.preventDefault(),t({type:`edge`,position:{x:e.clientX,y:e.clientY},edgeId:n.id})},r[3]=t,r[4]=o);let s=o,c;r[5]!==e||r[6]!==t?(c=n=>{n.preventDefault();let r=e({x:n.clientX,y:n.clientY});t({type:`pane`,position:{x:n.clientX,y:n.clientY},flowPosition:r})},r[5]=e,r[6]=t,r[7]=c):c=r[7];let l=c,u;return r[8]!==s||r[9]!==a||r[10]!==l?(u={onNodeContextMenu:a,onEdgeContextMenu:s,onPaneContextMenu:l},r[8]=s,r[9]=a,r[10]=l,r[11]=u):u=r[11],u}var b9=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),x9=b9((e,t)=>{var n=Object.defineProperty,r=(e,t,r)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,i=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),a=(e,t,n)=>r(e,typeof t==`symbol`?t:t+``,n),o=i((e,t)=>{var n=class{constructor(e){a(this,`_isDirected`,!0),a(this,`_isMultigraph`,!1),a(this,`_isCompound`,!1),a(this,`_label`),a(this,`_defaultNodeLabelFn`,()=>{}),a(this,`_defaultEdgeLabelFn`,()=>{}),a(this,`_nodes`,{}),a(this,`_in`,{}),a(this,`_preds`,{}),a(this,`_out`,{}),a(this,`_sucs`,{}),a(this,`_edgeObjs`,{}),a(this,`_edgeLabels`,{}),a(this,`_nodeCount`,0),a(this,`_edgeCount`,0),a(this,`_parent`),a(this,`_children`),e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){var t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,a=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],a=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=o(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(e,t,n);var u=s(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?c(this._isDirected,arguments[0]):o(this._isDirected,e,t,n),a=this._edgeObjs[r];return a&&(e=a.v,t=a.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}filterEdges(e,t,n){if(e){var r=Object.values(e);return n?r.filter(function(e){return e.v===t&&e.w===n||e.v===n&&e.w===t}):r}}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function s(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function c(e,t){return o(e,t.v,t.w,t.name)}t.exports=n}),s=i((e,t)=>{t.exports=`3.0.2`}),c=i((e,t)=>{t.exports={Graph:o(),version:s()}}),l=i((e,t)=>{var n=o();t.exports={write:r,read:s};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function s(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}}),u=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r,a){return i(e,String(t),r||n,a||function(t){return e.outEdges(t)})}function i(e,t,n,r){var i={},a=!0,o=0,s=e.nodes(),c=function(e){var t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){var n=t.v===e?t.v:t.w;c({v:n,w:n===t.v?t.w:t.v})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0}});for(var u=s.length,d=1;d<u&&(a=!1,o++,l(),a);d++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}}),d=i((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}}),f=i((e,t)=>{t.exports=class{constructor(){a(this,`_arr`,[]),a(this,`_keyIndices`,{})}size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}}),p=i((e,t)=>{var n=f();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}}),m=i((e,t)=>{var n=p();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}}),h=i((e,t)=>{t.exports=n;function n(e,t,n){if(e[t].predecessor!==void 0)throw Error(`Invalid source vertex`);if(e[n].predecessor===void 0&&n!==t)throw Error(`Invalid destination vertex`);return{weight:e[n].distance,path:r(e,t,n)}}function r(e,t,n){for(var r=[],i=n;i!==t;)r.push(i),i=e[i].predecessor;return r.push(t),r.reverse()}}),g=i((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}}),_=i((e,t)=>{var n=g();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}}),v=i((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}}),y=i((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r}),b=i((e,t)=>{var n=y();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}}),x=i((e,t)=>{t.exports=n;function n(e,t,n,i,a){Array.isArray(t)||(t=[t]);var o=(e.isDirected()?e.successors:e.neighbors).bind(e),s={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);a=r(e,t,n===`post`,s,o,i,a)}),a}function r(e,t,n,i,a,o,s){return Object.hasOwn(i,t)||(i[t]=!0,n||(s=o(s,t)),a(t).forEach(function(t){s=r(e,t,n,i,a,o,s)}),n&&(s=o(s,t))),s}}),S=i((e,t)=>{var n=x();t.exports=r;function r(e,t,r){return n(e,t,r,function(e,t){return e.push(t),e},[])}}),C=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`post`)}}),w=i((e,t)=>{var n=S();t.exports=r;function r(e,t){return n(e,t,`pre`)}}),T=i((e,t)=>{var n=o(),r=f();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}e.nodeEdges(s).forEach(c)}return i}}),E=i((e,t)=>{var n=p(),r=u();t.exports=i;function i(e,t,n,r){return a(e,t,n,r||function(t){return e.outEdges(t)})}function a(e,t,i,a){if(i===void 0)return n(e,t,i,a);for(var o=!1,s=e.nodes(),c=0;c<s.length;c++){for(var l=a(s[c]),u=0;u<l.length;u++){var d=l[u],f=d.v===s[c]?d.v:d.w;i({v:f,w:f===d.v?d.w:d.v})<0&&(o=!0)}if(o)return r(e,t,i,a)}return n(e,t,i,a)}}),D=i((e,t)=>{t.exports={bellmanFord:u(),components:d(),dijkstra:p(),dijkstraAll:m(),extractPath:h(),findCycles:_(),floydWarshall:v(),isAcyclic:b(),postorder:C(),preorder:w(),prim:T(),shortestPaths:E(),reduce:x(),tarjan:g(),topsort:y()}}),O=c();t.exports={Graph:O.Graph,json:l(),alg:D(),version:O.version}}),Hxe=b9((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n}),Uxe=b9((e,t)=>{var n=x9().Graph,r=Hxe();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}}),S9=b9((e,t)=>{var n=x9().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}}),Wxe=b9((e,t)=>{var n=Uxe(),r=S9().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}}),Gxe=b9((e,t)=>{var n=S9();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}}),C9=b9((e,t)=>{var{applyWithChunking:n}=S9();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}}),w9=b9((e,t)=>{var n=x9().Graph,r=C9().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}}),Kxe=b9((e,t)=>{var n=w9(),r=C9().slack,i=C9().longestPath,a=x9().alg.preorder,o=x9().alg.postorder,s=S9().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}}),qxe=b9((e,t)=>{var n=C9().longestPath,r=w9(),i=Kxe();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}}),Jxe=b9((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}}),Yxe=b9((e,t)=>{var n=S9();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}}),Xxe=b9((e,t)=>{var n=S9();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}}),Zxe=b9((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}}),Qxe=b9((e,t)=>{var n=S9();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}}),$xe=b9((e,t)=>{var n=S9().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}}),eSe=b9((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}}),tSe=b9((e,t)=>{var n=S9();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}}),nSe=b9((e,t)=>{var n=S9();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}),rSe=b9((e,t)=>{var n=eSe(),r=tSe(),i=nSe();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}}),iSe=b9((e,t)=>{var n=x9().Graph,r=S9();t.exports=i;function i(e,t,r,i){i||=e.nodes();let o=a(e),s=new n({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(t=>e.node(t));return i.forEach(n=>{let i=e.node(n),a=e.parent(n);(i.rank===t||i.minRank<=t&&t<=i.maxRank)&&(s.setNode(n),s.setParent(n,a||o),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=s.edge(r,n),a=i===void 0?0:i.weight;s.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(i,`minRank`)&&s.setNode(n,{borderLeft:i.borderLeft[t],borderRight:i.borderRight[t]}))}),s}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}}),aSe=b9((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}}),oSe=b9((e,t)=>{var n=Qxe(),r=$xe(),i=rSe(),a=iSe(),o=aSe(),s=x9().Graph,c=S9();t.exports=l;function l(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t.disableOptimalOrderHeuristic)return;let p=1/0,m,h=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2,h),s=c.buildLayerMatrix(e);let i=r(e,s);i<p?(n=0,m=Object.assign({},s),p=i):i===p&&(m=structuredClone(s))}f(e,m)}function u(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return a(e,t,n,r.get(t)||[])})}function d(e,t,n){let r=new s;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let a=e.graph().root,s=i(e,a,r,t);s.vs.forEach((t,n)=>e.node(t).order=n),o(e,r,s.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}}),sSe=b9((e,t)=>{var n=x9().Graph,r=S9();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}}),cSe=b9((e,t)=>{var n=S9(),r=sSe().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=e.graph().rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}}),lSe=b9((e,t)=>{var n=Wxe(),r=Gxe(),i=qxe(),a=S9().normalizeRanks,o=Jxe(),s=S9().removeEmptyRanks,c=Yxe(),l=Xxe(),u=Zxe(),d=oSe(),f=cSe(),p=S9(),m=x9().Graph;t.exports=h;function h(e,t={}){let n=t.debugTiming?p.time:p.notime;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));return n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r)),r})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>I(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>L(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>R(e)),t(` removeBorderNodes`,()=>F(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`,rankalign:`center`},b=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=B(e.graph());return t.setGraph(Object.assign({},y,z(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=z(B(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=B(e.edge(n));t.setEdge(n,Object.assign({},w,z(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function F(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function I(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function L(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function R(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function z(e,t){return p.mapValues(p.pick(e,t),Number)}function B(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}}),uSe=b9((e,t)=>{var n=S9(),r=x9().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}}),dSe=b9((e,t)=>{t.exports=`2.0.4`}),T9=b9((e,t)=>{t.exports={graphlib:x9(),layout:lSe(),debug:uSe(),util:{time:S9().time,notime:S9().notime},version:dSe()}})();function fSe(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function pSe(){return this.eachAfter(fSe)}function mSe(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function hSe(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function gSe(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function _Se(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function vSe(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function ySe(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function bSe(e){for(var t=this,n=xSe(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function xSe(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function SSe(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function CSe(){return Array.from(this)}function wSe(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function TSe(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*ESe(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function E9(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=kSe)):t===void 0&&(t=OSe);for(var n=new D9(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new D9(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(jSe)}function DSe(){return E9(this).eachBefore(ASe)}function OSe(e){return e.children}function kSe(e){return Array.isArray(e)?e[1]:null}function ASe(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function jSe(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function D9(e){this.data=e,this.depth=this.height=0,this.parent=null}D9.prototype=E9.prototype={constructor:D9,count:pSe,each:mSe,eachAfter:gSe,eachBefore:hSe,find:_Se,sum:vSe,sort:ySe,path:bSe,ancestors:SSe,descendants:CSe,leaves:wSe,links:TSe,copy:DSe,[Symbol.iterator]:ESe};function MSe(e,t){return e.parent===t.parent?1:2}function O9(e){var t=e.children;return t?t[0]:e.t}function k9(e){var t=e.children;return t?t[t.length-1]:e.t}function NSe(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function PSe(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function FSe(e,t,n){return e.a.parent===t.parent?e.a:n}function A9(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}A9.prototype=Object.create(D9.prototype);function ISe(e){for(var t=new A9(e,0),n,r=[t],i,a,o,s;n=r.pop();)if(a=n._.children)for(n.children=Array(s=a.length),o=s-1;o>=0;--o)r.push(i=n.children[o]=new A9(a[o],o)),i.parent=n;return(t.parent=new A9(null,0)).children=[t],t}function LSe(){var e=MSe,t=1,n=1,r=null;function i(i){var s=ISe(i);if(s.eachAfter(a),s.parent.m=-s.z,s.eachBefore(o),r)i.eachBefore(c);else{var l=i,u=i,d=i;i.eachBefore(function(e){e.x<l.x&&(l=e),e.x>u.x&&(u=e),e.depth>d.depth&&(d=e)});var f=l===u?1:e(l,u)/2,p=f-l.x,m=t/(u.x+f+p),h=n/(d.depth||1);i.eachBefore(function(e){e.x=(e.x+p)*m,e.y=e.depth*h})}return i}function a(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){PSe(t);var a=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+e(t._,i._));t.parent.A=s(t,i,t.parent.A||r[0])}function o(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function s(t,n,r){if(n){for(var i=t,a=t,o=n,s=i.parent.children[0],c=i.m,l=a.m,u=o.m,d=s.m,f;o=k9(o),i=O9(i),o&&i;)s=O9(s),a=k9(a),a.a=t,f=o.z+u-i.z-c+e(o._,i._),f>0&&(NSe(FSe(o,t,r),t,f),c+=f,l+=f),u+=o.m,c+=i.m,d+=s.m,l+=a.m;o&&!k9(a)&&(a.t=o,a.m+=u-l),i&&!O9(s)&&(s.t=i,s.m+=c-d,r=t)}return r}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i}var RSe=`TB`,j9=40,M9=`__workflow-root__`;function N9(e,t){return e.x!==t.x||e.y!==t.y}function zSe(e){return e.sourceHandle===`true`?4:e.sourceHandle===`false`?3:X6(e.sourceHandle)?4:6}function BSe(e){return typeof e==`number`&&Number.isFinite(e)&&e<1024?{nodeSpacing:96,rankSpacing:72}:{nodeSpacing:132,rankSpacing:88}}function VSe(e,t){let n=e.node(t);return n?.x===void 0||n.y===void 0?null:{x:n.x,y:n.y}}var P9=new Map([[`true`,0],[`false`,1],[k2,0],[A2,1]]),HSe=2**53-1;function USe(e){if(D0(e.node)){let t=e.nodes.filter(t=>t.parentId===e.node.id).map(e=>e.id),n=new Set(t),{bounds:r}=H0(t,e.edges.filter(e=>n.has(e.source)&&n.has(e.target)),O0(e.node)),i=E4(r.columns,r.rows);return{width:i.width,height:i.height,handleRanks:P9}}if(!Z6(e.node))return{width:192,height:112,handleRanks:P9};let t=t8({targetNodeId:e.node.id,nodes:e.nodes,edges:e.edges,catalog:e.catalog});return{width:D4(t.length),height:112,handleRanks:new Map(t.map((e,t)=>[Y6(e.name),t]))}}function WSe(e){let t=t=>e.ranks.get(t.sourceHandle??``)??HSe,n=t=>e.positionXById.get(t)??0;return e.edges.toSorted((e,r)=>{let i=t(e)-t(r);return i===0?n(e.target)-n(r.target):i})}function GSe(e){let t=new Map(e.nodes.map(e=>[e.id,e.position.x])),n=new Map(e.nodes.map(e=>[e.id,[]]));for(let t of e.edges)n.get(t.source)?.push(t);let r=new Map,i=new Map;for(let a of e.nodes){let o=USe({node:a,nodes:e.allNodes,edges:e.allEdges,catalog:e.catalog});r.set(a.id,o.width),i.set(a.id,o.height),n.set(a.id,WSe({edges:n.get(a.id)??[],ranks:o.handleRanks,positionXById:t}))}return{nodes:e.nodes.toSorted((e,t)=>e.position.x-t.position.x),widthById:r,heightById:i,outEdgesBySource:n}}function KSe(e){let t=new T9.graphlib.Graph({directed:!0,multigraph:!1,compound:!1});t.setGraph({rankdir:RSe,nodesep:e.spacing.nodeSpacing,ranksep:e.spacing.rankSpacing,marginx:j9,marginy:j9}),t.setDefaultEdgeLabel(()=>({}));let n=t=>e.model.widthById.get(t)??192,r=t=>e.model.heightById.get(t)??112;for(let i of e.model.nodes)t.setNode(i.id,{width:n(i.id),height:r(i.id)});for(let n of e.model.nodes)for(let r of e.model.outEdgesBySource.get(n.id)??[])t.setEdge(r.source,r.target,{weight:zSe(r)});T9.layout(t);let i=!1;return{nodes:e.nodes.map(e=>{let a=VSe(t,e.id);if(!a)return e;let o={x:Math.round(a.x-n(e.id)/2),y:Math.round(a.y-r(e.id)/2)};return N9(e.position,o)?(i=!0,{...e,position:o}):e}),changed:i}}function qSe(e){let t=new Map(e.nodes.map(e=>[e.id,0]));for(let n of e.model.outEdgesBySource.values())for(let e of n)if(e.source===e.target||(t.set(e.target,(t.get(e.target)??0)+1),(t.get(e.target)??0)>1))return null;let n=e.model.nodes.filter(e=>(t.get(e.id)??0)===0);if(n.length===0)return null;let r=new Set,i=new Set;function a(t){if(i.has(t))return null;i.add(t),r.add(t);let n=e.model.outEdgesBySource.get(t)??[],o=[];for(let e of n){let t=a(e.target);if(!t)return null;o.push(t)}return i.delete(t),o.length===0?{id:t}:{id:t,children:o}}let o=[];for(let e of n){let t=a(e.id);if(!t)return null;o.push(t)}return r.size===e.nodes.length?{id:M9,children:o}:null}function JSe(e){if(e.nodes.some(e=>D0(e)))return null;let t=qSe({nodes:e.nodes,model:e.model});if(!t)return null;let n=t=>e.model.widthById.get(t)??192,r=E9(t,e=>e.children??[]),i=192+e.spacing.nodeSpacing;LSe().nodeSize([i,112+e.spacing.rankSpacing]).separation((t,r)=>{let a=t.parent===r.parent?e.spacing.nodeSpacing:e.spacing.nodeSpacing*2;return(n(t.data.id)/2+n(r.data.id)/2+a)/i})(r);let a=r.descendants().filter(e=>e.data.id!==M9);if(a.length===0)return{nodes:e.nodes,changed:!1};let o=new Map;for(let e of a){let t=e.x??0,r=e.y??0;o.set(e.data.id,{x:t-n(e.data.id)/2,y:r-56})}let s=Array.from(o.values()),c=Math.min(...s.map(e=>e.x)),l=Math.min(...s.map(e=>e.y)),u=!1;return{nodes:e.nodes.map(e=>{let t=o.get(e.id);if(!t)return e;let n={x:Math.round(t.x-c+j9),y:Math.round(t.y-l+j9)};return N9(e.position,n)?(u=!0,{...e,position:n}):e}),changed:u}}function YSe(e){return e.type!==`add`&&!e.parentId}function XSe(e){let t=e.nodes.filter(YSe);if(t.length===0)return{nodes:e.nodes,changed:!1};let n=new Set(t.map(e=>e.id)),r=Jue(e.nodes,e.edges).filter(e=>n.has(e.source)&&n.has(e.target)),i=BSe(e.availableWidth),a=GSe({nodes:t,allNodes:e.nodes,edges:r,allEdges:e.edges,catalog:e.catalog}),o=JSe({nodes:t,model:a,spacing:i})??KSe({nodes:t,model:a,spacing:i}),s=new Map(o.nodes.map(e=>[e.id,e])),c=Hfe(e.nodes.map(e=>{let t=s.get(e.id);return t?{...e,position:t.position}:e}),e.edges),l=new Map(e.nodes.map(e=>[e.id,e]));return{nodes:c,changed:c.some(e=>{let t=l.get(e.id);return!t||N9(t.position,e.position)||t.width!==e.width||t.height!==e.height})}}var ZSe={[U1]:Jbe.Animated},QSe={type:U1},$Se={lifecycle:_9,action:p9,add:Nxe,group:m9};function eCe(){let e=yy(),t=wA($fe),n=wA(epe),r=wA($4),i=wA(n3),a=wA(Q0),[o]=EA(_2),s=jY(),{openSheet:c}=O7(),l=wA(xde),u=s?null:l,[d,f]=EA(v2),p=TA(spe),m=TA(cpe),h=TA(H4),g=TA(U4),_=TA(u3),v=TA(upe),y=TA(Zfe),b=TA(ope),x=TA(ipe),S=TA(_3),C=TA(v3),w=TA(g2),{screenToFlowPosition:T,fitView:E,getViewport:D,setViewport:O}=RE(),k=(0,Y.useRef)(null),A=(0,Y.useRef)(null),j=(0,Y.useRef)(null),M=(0,Y.useRef)(!1),N=(0,Y.useRef)(!1),P=(0,Y.useRef)(null),F=(0,Y.useRef)(0),I=(0,Y.useRef)(!1),[L,R]=(0,Y.useState)(!1),[z,B]=(0,Y.useState)(!1),[V,H]=(0,Y.useState)(null),U=(0,Y.useRef)(new Set);_Y(window,`pointerdown`,e=>{e.button===2&&(U.current=new Set(t.filter(e=>e.selected).map(e=>e.id)))},{capture:!0,enabled:!i});let{onNodeContextMenu:W,onEdgeContextMenu:G,onPaneContextMenu:K}=Vxe(T,H,(0,Y.useCallback)(()=>U.current,[])),q=(0,Y.useCallback)(()=>{H(null)},[]),J=t.some(e=>e.type!==`add`),ee=(0,Y.useMemo)(()=>t.filter(e=>e.type!==`add`).length,[t]),te=(0,Y.useRef)(!1);vY(d,()=>{if(!d||te.current||(te.current=!0,document.cookie.split(`; `).find(e=>e.startsWith(`sidebar-collapsed=`))?.split(`=`)[1]===`true`))return;let e=D(),t=window.innerWidth*.3/2;O({...e,x:e.x-t},{duration:0})}),yY(a,()=>{if(d&&N.current){R(!0),f(!1);return}E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0),f(!1)}),yY(!a&&J,()=>{a||!J||(E({maxZoom:1,minZoom:.5,padding:.2,duration:0}),N.current=!0,R(!0))});let ne=(0,Y.useCallback)(e=>{!(e.metaKey||e.ctrlKey)||e.key.toLowerCase()!==`z`||V7(e.target)||i||(e.preventDefault(),e.shiftKey?C():S())},[S,C,i]);_Y(window,`keydown`,ne),Fxe(!i),Lxe();let re=(0,Y.useCallback)(e=>{(e.metaKey||e.ctrlKey)&&e.key===`/`&&(e.preventDefault(),E({padding:.2,duration:300}))},[E]);_Y(window,`keydown`,re);let ie=(0,Y.useCallback)(()=>{if(i||ee<2||I.current)return;I.current=!0,B(!0);let r=F.current+1;F.current=r;try{let i=P.current?.getBoundingClientRect().width??(typeof window<`u`?window.innerWidth:void 0),{nodes:a,changed:o}=XSe({nodes:t,edges:n,availableWidth:i,catalog:e});if(r!==F.current)return;o&&v(a),window.requestAnimationFrame(()=>{Promise.resolve(E({maxZoom:1,minZoom:.5,padding:.2,duration:300})).catch(()=>void 0)})}finally{r===F.current&&(I.current=!1,B(!1))}},[v,n,E,i,t,ee,e]),ae=(0,Y.useCallback)((e,n)=>{let r=t.find(t=>t.id===e);return!r||r.type===`add`||r.parentId?!1:n!==`target`||r.type!==`lifecycle`},[t]),oe=(0,Y.useCallback)(i=>{let a=i.source,o=i.target;if(!(a&&o)||a===o)return!1;let s=t.find(e=>e.id===a),c=t.find(e=>e.id===o);if(s?.parentId||c?.parentId)return!1;let l=`id`in i&&typeof i.id==`string`?i.id:null,u=G7({nodes:t,edges:n,sourceNodeId:a,sourceHandle:`sourceHandle`in i?i.sourceHandle:void 0,catalog:e}),d=F0({nodes:t,edges:r,sourceId:a,targetId:o,sourceHandle:u,excludeEdgeId:l});if(d.length===0)return!1;let f=[...r.filter(e=>e.id!==l),...d];return!Gbe({nodes:t,edges:f})},[e,n,t,r]),se=(0,Y.useCallback)((r,i)=>G7({nodes:t,edges:n,sourceNodeId:r,sourceHandle:i,catalog:e}),[t,n,e]),ce=(0,Y.useCallback)(e=>{if(!(e.source&&e.target)||!oe(e))return;let t=se(e.source,e.sourceHandle),n={id:u0(),...e,sourceHandle:t};y(n)},[se,oe,y]),le=(0,Y.useCallback)(({nodes:e,edges:t})=>!(e.some(e=>e.data.type!==`lifecycle`)||t.length>0)||N4(e)?Promise.resolve(!1):(x(),Promise.resolve(!0)),[x]),ue=(0,Y.useCallback)((e,t)=>{h(t.id),w(`properties`),s&&c()},[h,w,s,c]),de=(0,Y.useCallback)((e,t)=>{k.current=t.nodeId,A.current=t.handleType,j.current=t.handleId??null},[]),fe=(0,Y.useCallback)(e=>({clientX:`changedTouches`in e?e.changedTouches[0].clientX:e.clientX,clientY:`changedTouches`in e?e.changedTouches[0].clientY:e.clientY}),[]),pe=(0,Y.useCallback)((e,t,n)=>{let r=(e.target instanceof Element?e.target:void 0)?.closest(`.react-flow`)?.getBoundingClientRect();return{adjustedX:r?t-r.left:t,adjustedY:r?n-r.top:n}},[]),me=(0,Y.useCallback)(e=>{let t=e.getAttribute(`data-id`),n=A.current===`source`,r=n?`target`:`source`,i=k.current;if(t&&i&&t!==i&&ae(t,r)){let e=n?i:t,r=n?t:i,a=se(e,n?j.current:null),o=n?null:j.current;ce({source:e,target:r,sourceHandle:a,targetHandle:o})}},[ae,se,ce]),he=(0,Y.useCallback)((e,t,n)=>{let r=k.current;if(!r)return;let i=A.current===`source`;if(!(i||oe({source:`__new_node__`,target:r,sourceHandle:null,targetHandle:null})))return;let{adjustedX:a,adjustedY:o}=pe(e,t,n),s=T({x:a,y:o});s.y-=56;let c={id:u0(),type:`action`,position:s,data:{label:``,description:``,type:`action`,config:{},status:`idle`},selected:!0};_(c),h(c.id),w(`properties`),setTimeout(()=>{b(c.id)},50);let l=i?r:c.id,u=i?c.id:r,d=se(l,i?j.current:null),f=i?null:j.current;ce({source:l,target:u,sourceHandle:d,targetHandle:f}),M.current=!0,setTimeout(()=>{M.current=!1},100)},[pe,T,_,b,h,w,se,ce,oe]),ge=(0,Y.useCallback)(e=>{if(!k.current)return;let{clientX:t,clientY:n}=fe(e),r;if(r=`changedTouches`in e?document.elementFromPoint(t,n):e.target instanceof Element?e.target:null,!r){k.current=null,A.current=null,j.current=null;return}let i=r.closest(`.react-flow__node`),a=r.closest(`.react-flow__handle`);if(i&&!a&&A.current){me(i),k.current=null,A.current=null,j.current=null;return}i||a||he(e,t,n),k.current=null,A.current=null,j.current=null},[fe,me,he]),_e=(0,Y.useCallback)(()=>{M.current||(h(null),g(null),q())},[h,g,q]),ve=(0,Y.useCallback)(({nodes:e})=>{M.current&&e.length===0||(e.length===0?h(null):e.length===1&&h(e[0].id))},[h]);return(0,X.jsxs)(`div`,{className:`relative h-full bg-background`,"data-testid":`workflow-canvas`,ref:P,style:{opacity:+!!L,width:u?`calc(100% - ${u})`:`100%`,transition:`opacity 300ms`},children:[(0,X.jsx)(`div`,{className:`pointer-events-auto`,children:(0,X.jsx)(zbe,{workflowId:a??void 0})}),(0,X.jsxs)(zye,{className:`bg-background`,connectionLineComponent:Hye,connectionMode:dw.Strict,defaultEdgeOptions:QSe,edges:n,edgeTypes:ZSe,elementsSelectable:!i,isValidConnection:oe,nodes:t,nodesConnectable:!i,nodesDraggable:!i,nodeTypes:$Se,onBeforeDelete:le,onConnect:i?void 0:ce,onConnectEnd:i?void 0:ge,onConnectStart:i?void 0:de,onEdgeContextMenu:i?void 0:G,onEdgesChange:i?void 0:m,onNodeClick:i?void 0:ue,onNodeContextMenu:i?void 0:W,onNodesChange:i?void 0:p,onPaneClick:_e,onPaneContextMenu:i?void 0:K,onSelectionChange:i?void 0:ve,children:[(0,X.jsx)(Ybe,{className:`workflow-controls-panel border-none bg-transparent p-0`,position:`bottom-left`,children:(0,X.jsx)(Wye,{canReflow:!i&&ee>1&&!z,onReflow:i?void 0:ie})}),o&&(0,X.jsx)(Ek,{bgColor:`var(--sidebar)`,className:`rounded-lg border shadow-sm`,maskColor:`color-mix(in oklch, var(--muted) 60%, transparent)`,nodeColor:`var(--muted-foreground)`,nodeStrokeColor:`var(--border)`})]}),(0,X.jsx)(Bxe,{menuState:V,onClose:q})]})}var tCe=/^\/workflows\/[^/]+$/;function nCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={select:rCe},e[0]=t):t=e[0];let n=za(t);if(!tCe.test(n))return null;let r;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,X.jsx)(`div`,{className:`fixed inset-0 z-0`,children:(0,X.jsx)(eCe,{})}),e[1]=r):r=e[1],r}function rCe(e){return e.location.pathname}var F9=pA(),I9=`The workflow could not be loaded. Try again.`;function iCe(e){return e instanceof X1&&e.status===404?{notFound:!0,message:null}:{notFound:!1,message:I9}}function aCe(e){return e?`runs`:null}var oCe=ma(`/workflows/$workflowId`);function sCe(){let e=(0,Z.c)(19),t=wA(Q0),[n,r]=EA(O2),i=TA(V4),a=TA(gpe),{executionId:o}=oCe.useSearch(),s;e[0]===o?s=e[1]:(s=r0.workflow.getExecutionLogs.queryOptions({input:{executionId:o??``},select:tye}),e[0]=o,e[1]=s);let c=o!==void 0,l;e[2]!==s||e[3]!==c?(l={...s,enabled:c,staleTime:0},e[2]=s,e[3]=c,e[4]=l):l=e[4];let u=Xe(l),d=u.data?.workflowVersionId,f;e[5]===d?f=e[6]:(f=r0.workflow.getVersionGraph.queryOptions({input:{versionId:d??``},select:lCe}),e[5]=d,e[6]=f);let p=d!==void 0,m;e[7]!==f||e[8]!==p?(m={...f,enabled:p,staleTime:1/0},e[7]=f,e[8]=p,e[9]=m):m=e[9];let h=Xe(m),g=u.data,_=h.data,v=g!==void 0&&_!==void 0&&g.workflowId===t,y;e[10]!==t||e[11]!==g||e[12]!==o||e[13]!==_||e[14]!==a||e[15]!==n||e[16]!==i||e[17]!==r?(y=()=>{if(o===void 0){r(null),i(null);return}if(n!==o&&a(),r(o),g===void 0||_===void 0||g.workflowId!==t){i(null);return}let e=H1(_);i({nodes:e.nodes.map(cCe),edges:e.edges.map(J1)})},e[10]=t,e[11]=g,e[12]=o,e[13]=_,e[14]=a,e[15]=n,e[16]=i,e[17]=r,e[18]=y):y=e[18],vY(o===void 0?`closed`:v?`ready:${o}:${t}`:`open:${o}:${t??``}`,y)}function cCe(e){return{...q1(e),selected:!1}}function lCe(e){return e.graph}function uCe(){return sCe(),null}function dCe(e){return eY(`alert-dialog`,e)}function L9(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(dCe,{"data-slot":`alert-dialog`,...n}),t[2]=n,t[3]=r),r}function fCe(e){let t=(0,Z.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,X.jsx)(LJ,{"data-slot":`alert-dialog-portal`,...n}),t[2]=n,t[3]=r),r}function pCe(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`data-[starting-style]:fade-in-0 data-[ending-style]:fade-out-0 fixed inset-0 z-50 bg-foreground/50 data-[closed]:animate-out data-[open]:animate-in`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(oH,{className:i,"data-slot":`alert-dialog-overlay`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function R9(e){let t=(0,Z.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,X.jsx)(pCe,{}),t[3]=i):i=t[3];let a;t[4]===n?a=t[5]:(a=Q(`data-[starting-style]:fade-in-0 data-[starting-style]:zoom-in-95 data-[ending-style]:fade-out-0 data-[ending-style]:zoom-out-95 grid w-full max-w-lg gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 data-[closed]:animate-out data-[open]:animate-in`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==a?(o=(0,X.jsxs)(fCe,{children:[i,(0,X.jsx)(nY,{className:`fixed inset-0 z-50 flex items-center justify-center p-4`,children:(0,X.jsx)(PJ,{className:a,"data-slot":`alert-dialog-content`,...r})})]}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function z9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col gap-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(`div`,{className:i,"data-slot":`alert-dialog-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`font-semibold text-lg`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(rY,{className:i,"data-slot":`alert-dialog-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function H9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(FH,{className:i,"data-slot":`alert-dialog-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U9(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=Q(Rv({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,X.jsx)(kH,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}function W9(e){let t=(0,Z.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=Q(Rv({variant:`outline`}),n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,X.jsx)(kH,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mCe(e){let t=(0,Z.c)(18),{open:n,onOpenChange:r,onConfirm:i,title:a,description:o,confirmLabel:s}=e,c=a===void 0?`Delete`:a,l=o===void 0?`Are you sure? This action cannot be undone.`:o,u=s===void 0?`Delete`:s,d;t[0]===c?d=t[1]:(d=(0,X.jsx)(V9,{children:c}),t[0]=c,t[1]=d);let f;t[2]===l?f=t[3]:(f=(0,X.jsx)(H9,{children:l}),t[2]=l,t[3]=f);let p;t[4]!==d||t[5]!==f?(p=(0,X.jsxs)(z9,{children:[d,f]}),t[4]=d,t[5]=f,t[6]=p):p=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,X.jsx)(W9,{children:`Cancel`}),t[7]=m):m=t[7];let h;t[8]!==u||t[9]!==i?(h=(0,X.jsxs)(B9,{children:[m,(0,X.jsx)(U9,{onClick:i,variant:`destructive`,children:u})]}),t[8]=u,t[9]=i,t[10]=h):h=t[10];let g;t[11]!==p||t[12]!==h?(g=(0,X.jsxs)(R9,{children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;return t[14]!==r||t[15]!==n||t[16]!==g?(_=(0,X.jsx)(L9,{onOpenChange:r,open:n,children:g}),t[14]=r,t[15]=n,t[16]=g,t[17]=_):_=t[17],_}var hCe=4;function gCe(){let e=(0,Z.c)(11),[t,n]=(0,Y.useState)(null),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={confirm:n,tabs:`top`},e[0]=r):r=e[0];let i=r,a;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,X.jsx)(E7,{frame:i}),e[1]=a):a=e[1];let o=t?.confirmLabel,s=t?.message,c;e[2]===t?c=e[3]:(c=()=>t?.onConfirm(),e[2]=t,e[3]=c);let l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=e=>{e||n(null)},e[4]=l):l=e[4];let u=t!==null,d=t?.title,f;return e[5]!==o||e[6]!==s||e[7]!==c||e[8]!==u||e[9]!==d?(f=(0,X.jsxs)(`aside`,{className:`flex size-full flex-col overflow-hidden bg-card`,children:[a,(0,X.jsx)(mCe,{confirmLabel:o,description:s,onConfirm:c,onOpenChange:l,open:u,title:d})]}),e[5]=o,e[6]=s,e[7]=c,e[8]=u,e[9]=d,e[10]=f):f=e[10],f}function _Ce(){let e=(0,Z.c)(29),t=jY(),[n,r]=EA(b2),[i,a]=EA(S2),o=wA(H4),{hasOverlays:s}=RY(),{openSheet:c}=O7(),l=l7(),u;e[0]!==s||e[1]!==t||e[2]!==c||e[3]!==o?(u=()=>{t&&o&&!s&&c()},e[0]=s,e[1]=t,e[2]=c,e[3]=o,e[4]=u):u=e[4],vY(t,u);let d;e[5]!==l||e[6]!==r?(d=e=>{e&&l(),r(e)},e[5]=l,e[6]=r,e[7]=d):d=e[7];let f=d,[p,m]=(0,Y.useState)(!1),h=(0,Y.useRef)(!1),g;e[8]!==n||e[9]!==f?(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`b`&&(e.preventDefault(),f(!n))},e[8]=n,e[9]=f,e[10]=g):g=e[10],_Y(window,`keydown`,g);let _;e[11]!==n||e[12]!==f||e[13]!==a?(_=e=>{e.preventDefault(),h.current=!0,m(!0);let t=e.clientX,r=!1,i=e=>{if(!h.current||(Math.abs(e.clientX-t)>hCe&&(r=!0),!r))return;let n=(window.innerWidth-e.clientX)/window.innerWidth*100;a(Math.min(50,Math.max(20,n)))},o=()=>{h.current=!1,m(!1),document.removeEventListener(`pointermove`,i),document.removeEventListener(`pointerup`,o),document.removeEventListener(`pointercancel`,o),document.body.style.cursor=``,document.body.style.userSelect=``,r||f(!n)};document.addEventListener(`pointermove`,i),document.addEventListener(`pointerup`,o),document.addEventListener(`pointercancel`,o),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`},e[11]=n,e[12]=f,e[13]=a,e[14]=_):_=e[14];let v=_,y;e[15]!==t||e[16]!==n||e[17]!==f?(y=!t&&n&&(0,X.jsx)(`button`,{className:`pointer-events-auto absolute top-1/2 right-0 z-20 flex size-6 -translate-y-1/2 items-center justify-center rounded-l-full border border-r-0 bg-background shadow-sm transition-colors hover:bg-muted`,onClick:()=>{f(!1)},type:`button`,children:(0,X.jsx)(Yv,{className:`size-4`})}),e[15]=t,e[16]=n,e[17]=f,e[18]=y):y=e[18];let b;e[19]!==v||e[20]!==p||e[21]!==t||e[22]!==n||e[23]!==i||e[24]!==f?(b=!t&&(0,X.jsxs)(`div`,{className:`workflow-sidebar-panel pointer-events-auto absolute inset-y-0 right-0 z-20 border-l bg-sidebar transition-transform duration-200 ease-out`,style:{width:C2(i),transform:n?`translateX(100%)`:`translateX(0)`},children:[(0,X.jsxs)(`div`,{"aria-label":`Resize properties panel. Click to collapse.`,"aria-orientation":`vertical`,"aria-valuenow":i,className:`group absolute inset-y-0 left-0 z-10 w-3 cursor-col-resize`,onPointerDown:v,role:`separator`,tabIndex:0,children:[(0,X.jsx)(`div`,{className:`absolute inset-y-0 left-0 w-1 bg-transparent transition-colors group-hover:bg-ring group-active:bg-primary`}),!(p||n)&&(0,X.jsx)(`button`,{"aria-label":`Collapse panel`,className:`absolute top-1/2 left-0 flex size-6 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-full border bg-background shadow-sm transition-opacity hover:bg-muted focus-visible:opacity-100 lg:opacity-0 lg:group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),f(!0)},onPointerDown:vCe,type:`button`,children:(0,X.jsx)(Xv,{className:`size-4`})})]}),(0,X.jsx)(gCe,{})]}),e[19]=v,e[20]=p,e[21]=t,e[22]=n,e[23]=i,e[24]=f,e[25]=b):b=e[25];let x;return e[26]!==y||e[27]!==b?(x=(0,X.jsxs)(X.Fragment,{children:[y,b]}),e[26]=y,e[27]=b,e[28]=x):x=e[28],x}function vCe(e){return e.stopPropagation()}var yCe=500,bCe=()=>{let e=(0,Z.c)(33),t=wA(T2),n=wA(s2),r=wA(Q4),i=wA($4),[a]=EA(Q0),[o]=EA(O2),s=wA(t3),c=TA(w2),l=TA(d2),u=TA(y3),d=wA(r2),f=wA(i2),p;e[0]===n?p=e[1]:(p=()=>{n&&Ty.error(n.message||`Failed to save workflow`)},e[0]=n,e[1]=p),vY(n,p);let m;e[2]!==a||e[3]!==i||e[4]!==t||e[5]!==r||e[6]!==l?(m=async()=>{if(!a||t)return;let e=await l({nodes:r,edges:i},{immediate:!0});e&&!e.ok&&Ty.error(e.error.message||`Failed to save workflow`)},e[2]=a,e[3]=i,e[4]=t,e[5]=r,e[6]=l,e[7]=m):m=e[7];let h=m,g;e[8]===h?g=e[9]:(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),e.stopPropagation(),h())},e[8]=h,e[9]=g);let _=g,v;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(v={capture:!0},e[10]=v):v=e[10],_Y(document,`keydown`,_,v);let y;e[11]===o?y=e[12]:(y=r0.workflow.getExecutionStatus.queryOptions({input:{executionId:o??``}}),e[11]=o,e[12]=y);let b=o!==null,x;e[13]!==y||e[14]!==b?(x={...y,enabled:b,staleTime:0,refetchIntervalInBackground:!1,refetchInterval:xCe},e[13]=y,e[14]=b,e[15]=x):x=e[15];let S=Xe(x).data,C;e[16]===S?.nodeStatuses?C=e[17]:(C=S?.nodeStatuses.map(SCe).join(`,`)??``,e[16]=S?.nodeStatuses,e[17]=C);let w=C,T;e[18]!==S||e[19]!==r||e[20]!==o||e[21]!==c||e[22]!==u?(T=()=>{if(!o){u(r.map(CCe)),c(!1);return}S&&(u(S.nodeStatuses.map(wCe)),c(o7(S.status)))},e[18]=S,e[19]=r,e[20]=o,e[21]=c,e[22]=u,e[23]=T):T=e[23],vY(o===null?`idle`:`${o}:${s}:${S===void 0?`loading`:`${S.status}:${w}`}`,T);let E;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,X.jsx)(uCe,{}),e[24]=E):E=e[24];let D;e[25]===d?D=e[26]:(D=d&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Workflow Not Found`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:`The workflow you're looking for doesn't exist or has been deleted.`}),(0,X.jsx)(zv,{render:(0,X.jsx)(fa,{to:`/`}),children:`Go to Dashboard`})]})}),e[25]=d,e[26]=D);let O;e[27]===f?O=e[28]:(O=f&&(0,X.jsx)(`div`,{className:`pointer-events-auto absolute inset-0 z-20 flex items-center justify-center`,children:(0,X.jsxs)(`div`,{className:`rounded-lg border bg-background p-8 text-center shadow-lg`,children:[(0,X.jsx)(`h1`,{className:`mb-2 font-semibold text-2xl`,children:`Couldn't Load Workflow`}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground`,children:f}),(0,X.jsx)(zv,{onClick:TCe,children:`Try Again`})]})}),e[27]=f,e[28]=O);let k;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,X.jsx)(_Ce,{}),e[29]=k):k=e[29];let A;return e[30]!==D||e[31]!==O?(A=(0,X.jsxs)(`div`,{className:`flex h-dvh w-full flex-col overflow-hidden`,children:[E,D,O,k]}),e[30]=D,e[31]=O,e[32]=A):A=e[32],A};function xCe(e){return o7(e.state.data?.status)?yCe:!1}function SCe(e){return`${e.nodeId}=${e.status}`}function CCe(e){return{nodeId:e.id,status:`idle`}}function wCe(e){return{nodeId:e.nodeId,status:e.status===`pending`?`idle`:e.status}}function TCe(){return window.location.reload()}var ECe=jy(`workflows`),G9=3,K9=[`running`,`waiting`,`failed`,`completed`,`canceled`,`pending`],DCe=[...K9,`superseded`];function OCe(e){if(!e)return`-`;let t=Number.parseInt(e,10);return Number.isNaN(t)?e:t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}var kCe=100;function ACe(e){return e.toSorted(jCe)}function jCe(e,t){return new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()}function MCe(e){return e===`pause`?`Paused`:e===`resume`?`Resumed`:`Deleted`}function q9(e,t,n){return e===1?t:n}function NCe(){let e=(0,Z.c)(165),t=Gi(),n=Fe(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,e[0]=r):r=e[0];let[i,a]=(0,Y.useState)(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Set,e[1]=o):o=e[1];let[s,c]=(0,Y.useState)(o),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(null),y;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(y=r0.workflow.getAll.queryOptions({input:{},select:ACe,meta:{errorMessage:`Failed to load workflows`}}),e[2]=y):y=e[2];let{data:b,isPending:x}=Xe(y),S;e[3]===b?S=e[4]:(S=b===void 0?[]:b,e[3]=b,e[4]=S);let C=S,w;e[5]===C?w=e[6]:(w=C.filter(WCe),e[5]=C,e[6]=w);let T=w,E;e[7]===i?E=e[8]:(E=Array.from(i),e[7]=i,e[8]=E);let D=E,O;e[9]!==D||e[10]!==T?(O=D.filter(e=>T.some(t=>t.id===e&&t.isOwner!==!1)),e[9]=D,e[10]=T,e[11]=O):O=e[11];let k=O,A;e[12]!==i||e[13]!==T?(A=T.length>0&&T.every(e=>i.has(e.id)),e[12]=i,e[13]=T,e[14]=A):A=e[14];let j=A,M=l&&k.length>0,N;e[15]!==M||e[16]!==k||e[17]!==s?(N=OQ({workflowIds:M?k.toSorted():void 0,statuses:s.size>0?Array.from(s).toSorted():K9.toSorted(),limit:kCe},DQ),e[15]=M,e[16]=k,e[17]=s,e[18]=N):N=e[18];let P=N,F;e[19]===P?F=e[20]:(F=r0.workflow.getExecutionsGlobal.infiniteOptions({input:e=>({...P,cursor:e}),initialPageParam:void 0,getNextPageParam:UCe,meta:{errorMessage:`Failed to load workflow runs`}}),e[19]=P,e[20]=F);let I=Qe(F),L;e[21]===I.data?.pages?L=e[22]:(L=I.data?.pages.flatMap(HCe)??[],e[21]=I.data?.pages,e[22]=L);let R=L,z=I.isPending,B=I.isFetchingNextPage,V;e[23]===n?V=e[24]:(V=()=>a0(n),e[23]=n,e[24]=V);let H=V,U;e[25]===n?U=e[26]:(U=()=>s0(n),e[25]=n,e[26]=U);let W=U,G;e[27]===H?G=e[28]:(G=r0.workflow.update.mutationOptions({onSuccess:async(e,t)=>{let{mode:n}=t;await H(),Ty.success(n===`test`?`Switched workflow to Test mode`:`Switched workflow to Live mode`)},meta:{errorMessage:`Failed to switch workflow mode`}}),e[27]=H,e[28]=G);let K=Ze(G),q;e[29]===T?q=e[30]:(q=e=>{if(!e){a(new Set);return}a(new Set(T.map(VCe)))},e[29]=T,e[30]=q);let J=q,ee;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(e,t)=>{a(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},e[31]=ee):ee=e[31];let te=ee,ne;e[32]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},e[32]=ne):ne=e[32];let re=ne,ie;e[33]===n?ie=e[34]:(ie=r0.workflow.bulkLifecycle.mutationOptions({onSuccess:async(e,t)=>{let{action:r}=t;if(e.summary.failed===0?Ty.success(`${MCe(r)} ${e.summary.succeeded} workflow${q9(e.summary.succeeded,``,`s`)}`):Ty.error(`${r} finished with ${e.summary.failed} failure${q9(e.summary.failed,``,`s`)}`),await a0(n),r!==`delete`)return;let i=new Set(e.results.filter(BCe).map(zCe));a(e=>{let t=new Set;for(let n of e)i.has(n)||t.add(n);return t}),await s0(n)},onError:RCe,meta:{errorShownByCaller:!0}}),e[33]=n,e[34]=ie);let ae=Ze(ie),oe=ae.isPending?ae.variables.action:null,se=ae.mutate,ce;e[35]===se?ce=e[36]:(ce=(e,t)=>{t.length!==0&&se({workflowIds:t,action:e})},e[35]=se,e[36]=ce);let le=ce,ue;e[37]===C?ue=e[38]:(ue=e=>{if(e.length===0)return;let t=new Map(C.map(LCe)),n=e.map(e=>t.get(e)??`Untitled workflow`),r=e.length===1?`Delete Workflow`:`Delete Workflows`,i=e.length===1?`This will permanently delete "${n[0]}" and all of its runs and events. This cannot be undone.`:`This will permanently delete ${e.length} workflows and all of their runs and events. This cannot be undone.`;v({workflowIds:e,workflowNames:n,title:r,description:i})},e[37]=C,e[38]=ue);let de=ue,fe;e[39]!==j||e[40]!==x||e[41]!==oe||e[42]!==t||e[43]!==de||e[44]!==le||e[45]!==i||e[46]!==K||e[47]!==J||e[48]!==T?(fe=()=>x&&T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading workflows...`}):T.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No workflows found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`w-10 px-4 py-2`,children:(0,X.jsx)(e7,{"aria-label":`Select all workflows`,checked:j,onCheckedChange:e=>{J(e)}})}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Name`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`State`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Mode`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Updated`}),(0,X.jsx)(`th`,{className:`w-10`})]})}),(0,X.jsx)(`tbody`,{children:T.map(e=>{let n=i.has(e.id),r=e.isOwner!==!1,a=e.isPaused?`border-amber-500/30 bg-amber-500/10 text-amber-700`:`border-emerald-500/30 bg-emerald-500/10 text-emerald-700`,o=e.isPaused?`Paused`:`Active`,s=e.mode===`test`?`border-destructive/30 bg-destructive/10 text-destructive`:`border-zinc-500/30 bg-zinc-500/10 text-zinc-700`,c=e.mode===`test`?`Test`:`Live`,l=e.isPaused?`resume`:`pause`,u=e.isPaused?`Resume`:`Pause`;return(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsx)(`td`,{className:`px-4 py-3`,children:(0,X.jsx)(e7,{"aria-label":`Select ${e.name}`,checked:n,onCheckedChange:t=>{te(e.id,t)}})}),(0,X.jsxs)(`td`,{className:`px-2 py-3`,children:[(0,X.jsx)(`button`,{className:`text-left font-medium text-foreground hover:underline`,onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.id}})},type:`button`,children:e.name}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.id})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs transition-colors duration-200 ${a}`,children:o})}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase transition-colors duration-200 ${s}`,children:c})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:d7(e.updatedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsxs)(H5,{children:[(0,X.jsx)(U5,{className:`inline-flex size-8 items-center justify-center rounded-md border border-input bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50`,disabled:!r||oe!==null,children:(0,X.jsx)(ey,{className:`size-4`})}),(0,X.jsxs)(W5,{align:`end`,children:[(0,X.jsx)(G5,{onClick:()=>{K.mutate({workflowId:e.id,mode:e.mode===`test`?`live`:`test`})},children:e.mode===`test`?`Switch to Live`:`Switch to Test`}),(0,X.jsx)(G5,{onClick:()=>{le(l,[e.id])},children:u}),(0,X.jsx)(q5,{}),(0,X.jsx)(G5,{onClick:()=>{de([e.id])},variant:`destructive`,children:`Delete`})]})]})})]},e.id)})})]}),e[39]=j,e[40]=x,e[41]=oe,e[42]=t,e[43]=de,e[44]=le,e[45]=i,e[46]=K,e[47]=J,e[48]=T,e[49]=fe):fe=e[49];let pe=fe,me;e[50]!==z||e[51]!==t||e[52]!==R?(me=()=>z&&R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`Loading runs...`}):R.length===0?(0,X.jsx)(`div`,{className:`p-6 text-muted-foreground text-sm`,children:`No runs found.`}):(0,X.jsxs)(`table`,{className:`w-full text-left text-sm`,children:[(0,X.jsx)(`thead`,{className:`sticky top-0 bg-card`,children:(0,X.jsxs)(`tr`,{className:`border-b`,children:[(0,X.jsx)(`th`,{className:`px-4 py-2`,children:`Workflow`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Status`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Started`}),(0,X.jsx)(`th`,{className:`px-2 py-2`,children:`Duration`}),(0,X.jsx)(`th`,{className:`px-4 py-2 text-right`,children:`Open`})]})}),(0,X.jsx)(`tbody`,{children:R.map(e=>(0,X.jsxs)(`tr`,{className:`border-b last:border-b-0`,children:[(0,X.jsxs)(`td`,{className:`px-4 py-3`,children:[(0,X.jsx)(`div`,{className:`font-medium text-foreground text-sm`,children:e.workflowName}),(0,X.jsx)(`div`,{className:`font-mono text-muted-foreground text-xs`,children:e.workflowId})]}),(0,X.jsx)(`td`,{className:`px-2 py-3`,children:(0,X.jsx)(`span`,{className:`inline-flex rounded border px-2 py-0.5 font-medium text-xs uppercase ${g7(e.status)}`,children:e.status})}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:d7(e.startedAt)}),(0,X.jsx)(`td`,{className:`px-2 py-3 text-muted-foreground text-xs`,children:OCe(e.duration)}),(0,X.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,X.jsx)(zv,{onClick:()=>{t({to:`/workflows/$workflowId`,params:{workflowId:e.workflowId},search:{executionId:e.id}})},size:`sm`,type:`button`,variant:`outline`,children:`Open`})})]},e.id))})]}),e[50]=z,e[51]=t,e[52]=R,e[53]=me):me=e[53];let he=me,ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,X.jsx)(`h1`,{className:`font-semibold text-2xl text-foreground`,children:`Workflow Dashboard`}),e[54]=ge):ge=e[54];let _e;e[55]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[ge,(0,X.jsx)(zv,{onClick:()=>{m(ICe),f(!0)},type:`button`,children:`New Workflow`})]}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`Manage workflows in bulk and review runs across every workflow. Paused workflows block new starts. Test mode makes runs execute with test-mode action behavior.`})]}),e[55]=_e):_e=e[55];let ve;e[56]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`Workflows`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Select one or more workflows to run bulk actions.`})]}),e[56]=ve):ve=e[56];let ye=x||oe!==null,be;e[57]!==H||e[58]!==ye?(be=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[ve,(0,X.jsx)(zv,{disabled:ye,onClick:H,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[57]=H,e[58]=ye,e[59]=be):be=e[59];let xe=k.length===0||oe!==null,Se;e[60]!==le||e[61]!==k?(Se=()=>{le(`pause`,k)},e[60]=le,e[61]=k,e[62]=Se):Se=e[62];let Ce;e[63]!==xe||e[64]!==Se?(Ce=(0,X.jsx)(zv,{disabled:xe,onClick:Se,size:`sm`,type:`button`,variant:`outline`,children:`Pause Selected`}),e[63]=xe,e[64]=Se,e[65]=Ce):Ce=e[65];let we=k.length===0||oe!==null,Te;e[66]!==le||e[67]!==k?(Te=()=>{le(`resume`,k)},e[66]=le,e[67]=k,e[68]=Te):Te=e[68];let Ee;e[69]!==we||e[70]!==Te?(Ee=(0,X.jsx)(zv,{disabled:we,onClick:Te,size:`sm`,type:`button`,variant:`outline`,children:`Resume Selected`}),e[69]=we,e[70]=Te,e[71]=Ee):Ee=e[71];let De=k.length===0||oe!==null,Oe;e[72]!==de||e[73]!==k?(Oe=()=>{de(k)},e[72]=de,e[73]=k,e[74]=Oe):Oe=e[74];let ke;e[75]!==De||e[76]!==Oe?(ke=(0,X.jsx)(zv,{disabled:De,onClick:Oe,size:`sm`,type:`button`,variant:`destructive`,children:`Delete Selected`}),e[75]=De,e[76]=Oe,e[77]=ke):ke=e[77];let Ae;e[78]!==Ce||e[79]!==Ee||e[80]!==ke?(Ae=(0,X.jsx)(`div`,{className:`border-b px-4 py-2`,children:(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Ce,Ee,ke]})}),e[78]=Ce,e[79]=Ee,e[80]=ke,e[81]=Ae):Ae=e[81];let je;e[82]===pe?je=e[83]:(je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:pe()}),e[82]=pe,e[83]=je);let Me;e[84]!==be||e[85]!==Ae||e[86]!==je?(Me=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[be,Ae,je]}),e[84]=be,e[85]=Ae,e[86]=je,e[87]=Me):Me=e[87];let Ne;e[88]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`h2`,{className:`font-medium text-foreground text-sm`,children:`All Runs`}),(0,X.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Combined run history across workflows.`})]}),e[88]=Ne):Ne=e[88];let Pe=z||B,Ie;e[89]===W?Ie=e[90]:(Ie=()=>{W()},e[89]=W,e[90]=Ie);let Le;e[91]!==Pe||e[92]!==Ie?(Le=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b px-4 py-3`,children:[Ne,(0,X.jsx)(zv,{disabled:Pe,onClick:Ie,size:`sm`,type:`button`,variant:`outline`,children:`Refresh`})]}),e[91]=Pe,e[92]=Ie,e[93]=Le):Le=e[93];let Re;e[94]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>{c(new Set)},e[94]=Re):Re=e[94];let ze=s.size===0?`secondary`:`outline`,Be;e[95]===ze?Be=e[96]:(Be=(0,X.jsx)(zv,{onClick:Re,size:`sm`,type:`button`,variant:ze,children:`All statuses`}),e[95]=ze,e[96]=Be);let Ve;e[97]===s?Ve=e[98]:(Ve=DCe.map(e=>(0,X.jsx)(zv,{onClick:()=>{re(e)},size:`sm`,type:`button`,variant:s.has(e)?`secondary`:`outline`,children:e},e)),e[97]=s,e[98]=Ve);let He=k.length===0,Ue;e[99]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=()=>{u(FCe)},e[99]=Ue):Ue=e[99];let We=l?`secondary`:`outline`,Ge=l?`Showing selected workflows`:`Show selected workflows only`,Ke;e[100]!==He||e[101]!==We||e[102]!==Ge?(Ke=(0,X.jsx)(zv,{disabled:He,onClick:Ue,size:`sm`,type:`button`,variant:We,children:Ge}),e[100]=He,e[101]=We,e[102]=Ge,e[103]=Ke):Ke=e[103];let qe;e[104]!==Be||e[105]!==Ve||e[106]!==Ke?(qe=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b px-4 py-2`,children:[Be,Ve,Ke]}),e[104]=Be,e[105]=Ve,e[106]=Ke,e[107]=qe):qe=e[107];let Je;e[108]===he?Je=e[109]:(Je=(0,X.jsx)(`div`,{className:`max-h-[65vh] overflow-auto`,children:he()}),e[108]=he,e[109]=Je);let Ye;e[110]!==B||e[111]!==I?(Ye=I.hasNextPage?(0,X.jsx)(`div`,{className:`border-t px-4 py-3`,children:(0,X.jsx)(zv,{disabled:B,onClick:()=>{I.fetchNextPage()},size:`sm`,type:`button`,variant:`outline`,children:B?`Loading...`:`Load more`})}):null,e[110]=B,e[111]=I,e[112]=Ye):Ye=e[112];let $e;e[113]!==Le||e[114]!==qe||e[115]!==Je||e[116]!==Ye?($e=(0,X.jsxs)(`section`,{className:`rounded-xl border bg-card`,children:[Le,qe,Je,Ye]}),e[113]=Le,e[114]=qe,e[115]=Je,e[116]=Ye,e[117]=$e):$e=e[117];let et;e[118]!==Me||e[119]!==$e?(et=(0,X.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1600px] flex-col gap-6 p-6`,children:[_e,(0,X.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 xl:grid-cols-[1fr_1.5fr]`,children:[Me,$e]})]}),e[118]=Me,e[119]=$e,e[120]=et):et=e[120];let tt;e[121]===Symbol.for(`react.memo_cache_sentinel`)?(tt=e=>{e||(v(null),g(``))},e[121]=tt):tt=e[121];let nt=_!==null,rt=_?.title,it;e[122]===rt?it=e[123]:(it=(0,X.jsx)(V9,{children:rt}),e[122]=rt,e[123]=it);let at=_?.description,ot;e[124]===at?ot=e[125]:(ot=(0,X.jsx)(H9,{children:at}),e[124]=at,e[125]=ot);let st;e[126]!==it||e[127]!==ot?(st=(0,X.jsxs)(z9,{children:[it,ot]}),e[126]=it,e[127]=ot,e[128]=st):st=e[128];let ct;e[129]===_?ct=e[130]:(ct=_&&_.workflowNames.length>1?(0,X.jsxs)(`ul`,{className:`list-disc pl-5 text-muted-foreground text-sm`,children:[_.workflowIds.slice(0,3).map((e,t)=>(0,X.jsx)(`li`,{children:_.workflowNames[t]},e)),_.workflowNames.length>3?(0,X.jsxs)(`li`,{children:[`and `,_.workflowNames.length-3,` more`]}):null]}):null,e[129]=_,e[130]=ct);let lt;e[131]!==_||e[132]!==h?(lt=_&&_.workflowIds.length>G9?(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(TX,{htmlFor:`delete-challenge`,children:[`Type `,_.workflowIds.length,` to confirm`]}),(0,X.jsx)(wX,{autoComplete:`off`,id:`delete-challenge`,inputMode:`numeric`,onChange:e=>{g(e.target.value)},value:h})]}):null,e[131]=_,e[132]=h,e[133]=lt):lt=e[133];let ut;e[134]===Symbol.for(`react.memo_cache_sentinel`)?(ut=(0,X.jsx)(W9,{children:`Cancel`}),e[134]=ut):ut=e[134];let dt;e[135]!==_||e[136]!==h?(dt=_!==null&&_.workflowIds.length>G9&&h.trim()!==String(_.workflowIds.length),e[135]=_,e[136]=h,e[137]=dt):dt=e[137];let ft;e[138]!==_||e[139]!==le?(ft=()=>{_&&(le(`delete`,_.workflowIds),v(null),g(``))},e[138]=_,e[139]=le,e[140]=ft):ft=e[140];let pt;e[141]!==dt||e[142]!==ft?(pt=(0,X.jsxs)(B9,{children:[ut,(0,X.jsx)(U9,{disabled:dt,onClick:ft,variant:`destructive`,children:`Delete`})]}),e[141]=dt,e[142]=ft,e[143]=pt):pt=e[143];let mt;e[144]!==st||e[145]!==ct||e[146]!==lt||e[147]!==pt?(mt=(0,X.jsxs)(R9,{children:[st,ct,lt,pt]}),e[144]=st,e[145]=ct,e[146]=lt,e[147]=pt,e[148]=mt):mt=e[148];let ht;e[149]!==nt||e[150]!==mt?(ht=(0,X.jsx)(L9,{onOpenChange:tt,open:nt,children:mt}),e[149]=nt,e[150]=mt,e[151]=ht):ht=e[151];let gt;e[152]===C?gt=e[153]:(gt=C.map(PCe),e[152]=C,e[153]=gt);let _t;e[154]===t?_t=e[155]:(_t=e=>t({to:`/workflows/$workflowId`,params:{workflowId:e}}),e[154]=t,e[155]=_t);let vt;e[156]!==p||e[157]!==d||e[158]!==gt||e[159]!==_t?(vt=(0,X.jsx)(M7,{existingWorkflowNames:gt,onCreated:_t,onOpenChange:f,open:d},p),e[156]=p,e[157]=d,e[158]=gt,e[159]=_t,e[160]=vt):vt=e[160];let yt;return e[161]!==et||e[162]!==ht||e[163]!==vt?(yt=(0,X.jsxs)(`div`,{className:`pointer-events-auto h-dvh overflow-auto bg-background`,children:[et,ht,vt]}),e[161]=et,e[162]=ht,e[163]=vt,e[164]=yt):yt=e[164],yt}function PCe(e){return e.name}function FCe(e){return!e}function ICe(e){return e+1}function LCe(e){return[e.id,e.name]}function RCe(e,t){let{action:n}=t;ECe.error(`Failed to ${n} workflows`,{action:n,error:e}),Ty.error(`Failed to ${n} workflows`)}function zCe(e){return e.workflowId}function BCe(e){return e.ok&&e.deleted===!0}function VCe(e){return e.id}function HCe(e){return e.items}function UCe(e){return e.nextCursor??void 0}function WCe(e){return e.name!==`__current__`}function GCe(e){return{executionId:typeof e.executionId==`string`&&e.executionId.length>0?e.executionId:void 0}}function KCe(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(nCe,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsxs)(BO,{children:[t,(0,X.jsx)(`div`,{className:`pointer-events-none relative z-10`,children:(0,X.jsx)(ka,{})})]}),e[1]=n):n=e[1],n}function qCe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(cX,{attribute:`class`,defaultTheme:`system`,disableTransitionOnChange:!0,enableSystem:!0,children:(0,X.jsx)(vA,{store:F9,children:(0,X.jsxs)(FY,{children:[(0,X.jsx)(KCe,{}),(0,X.jsx)(dX,{}),(0,X.jsx)(qY,{})]})})}),e[0]=t):t=e[0],t}function J9(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsx)(bCe,{}),e[0]=t):t=e[0],t}var Y9=ya({component:qCe}),JCe=_a({getParentRoute:()=>Y9,path:`/`,component:NCe}),YCe=_a({getParentRoute:()=>Y9,path:`/workflows`,component:()=>(0,X.jsx)(Ki,{replace:!0,to:`/`})}),XCe=_a({getParentRoute:()=>Y9,path:`/workflows/$workflowId`,validateSearch:GCe,beforeLoad:({search:e})=>{let t=aCe(e.executionId);t!==null&&F9.set(g2,t)},loader:async({params:e})=>{F9.set(r2,!1),F9.set(i2,null);let[t,n]=await Promise.allSettled([My.fetchQuery(r0.workflow.getById.queryOptions({input:{workflowId:e.workflowId},staleTime:0})),My.fetchQuery(i0())]);if(t.status===`rejected`){let e=iCe(t.reason);throw F9.set(r2,e.notFound),F9.set(i2,e.message),t.reason}if(n.status===`rejected`)throw F9.set(i2,I9),n.reason;let r=t0(t.value);F9.set(npe,{...r,nodes:Y0(By(),r.nodes,n.value)})},errorComponent:J9,component:J9}),ZCe=Fa({routeTree:Y9.addChildren([JCe,YCe,XCe]),defaultPreload:`intent`,basepath:Sy()}),X9=e=>typeof e==`string`&&e.includes(`ResizeObserver loop`);function QCe(e){if(typeof e==`string`)return e;if(typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)return e.message}(()=>{if(window.__resizeObserverPatched||!window.ResizeObserver)return;let e=window.ResizeObserver;window.ResizeObserver=class extends e{constructor(e){super((t,n)=>{window.requestAnimationFrame(()=>e(t,n))})}},window.__resizeObserverPatched=!0})(),window.addEventListener(`error`,e=>{X9(e.message)&&(e.preventDefault(),e.stopImmediatePropagation())}),window.addEventListener(`unhandledrejection`,e=>{X9(QCe(e.reason))&&e.preventDefault()});var Z9=document.getElementById(`root`);if(!Z9)throw Error(`Root element not found`);var Q9=(0,Pee.createRoot)(Z9);Q9.render((0,X.jsx)(Ite,{}));var $9=await One();Q9.render($9.ok?(0,X.jsx)(Bte,{value:By(),children:(0,X.jsx)(Vte,{value:Qh,children:(0,X.jsx)(Ie,{client:My,children:(0,X.jsx)(Ra,{router:ZCe})})})}):(0,X.jsx)(Rte,{endpoint:`${Sy()}/api/extensions`,reason:$9.reason}));
|