1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownViewer-BJSZOqBD.js","assets/dist-Dwy9VqNa.js","assets/chunk-QTnfLwEv.js","assets/vs-DUNctDVq.js","assets/highlight-BvlNL7nJ.js","assets/objectWithoutProperties-DYCyohDT.js","assets/objectWithoutPropertiesLoose-Cck-yhK0.js","assets/lib-DtwLzBRI.js","assets/layout-D66QUpPl.js"])))=>i.map(i=>d[i]); 2import{n as e,r as t,t as n}from"./chunk-QTnfLwEv.js";import{C as r,E as i,M as a,X as o,b as s,d as c,nt as l,o as u,rt as d,tt as f,x as p}from"./dist-Dwy9VqNa.js";import{c as m,t as h,u as g}from"./react-dom-HmaMECB0.js";import{F as _,G as v,H as y,O as b,R as x,W as S,h as C,i as w,j as T}from"./dist-CWbWvQrf.js";import{At as E,Cn as D,Dt as O,G as k,Kt as A,N as j,Pt as M,Qt as N,S as P,T as F,Wt as I,Xt as L,b as R,en as ee,fn as z,j as te,mn as B,nn as ne,rn as re,u as V,vt as ie,x as ae,y as oe,yn as se,zt as ce}from"./dist-ANAaXWpR.js";import{h as le}from"./svg-DtNqJVFy.js";import{n as ue}from"./theme-ej_kzrAb.js";import{f as de}from"./notifications-B3GOfRFO.js";import{b as H,m as fe}from"./dist-C1L--aIk.js";import{r as pe}from"./navigation-ChlVAqY1.js";import{n as me,t as he}from"./vs-DUNctDVq.js";import{t as ge}from"./material-dark-DtR67_3e.js";import{t as _e}from"./AnimatedHeight-DHchK51g.js";import{n as ve}from"./text-B0H_bNyb.js";import{i as ye,n as be,t as xe}from"./translations-UhDJf-VD.js";import{t as Se}from"./translate-B2IX8zct.js";import{i as Ce,n as we}from"./layout-D66QUpPl.js";import{a as Te,c as Ee,f as De,h as U,i as Oe,l as ke,m as Ae,n as je,o as Me,p as Ne,r as Pe,s as Fe,t as W,u as Ie}from"./shallow-BS5bm5LC.js";import{n as Le,t as Re}from"./lib-DtwLzBRI.js";import{t as ze}from"./index.es-BJEEF7a0.js";import{i as Be,r as Ve}from"./decode-BRduyrXn.js";var He=n(((e,t)=>{function n(e){this._maxSize=e,this.clear()}n.prototype.clear=function(){this._size=0,this._values=Object.create(null)},n.prototype.get=function(e){return this._values[e]},n.prototype.set=function(e,t){return this._size>=this._maxSize&&this.clear(),e in this._values||this._size++,this._values[e]=t};var r=/[^.^\]^[]+|(?=\[\]|\.\.)/g,i=/^\d+$/,a=/^\d/,o=/[~`!#$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g,s=/^\s*(['"]?)(.*?)(\1)\s*$/,c=512,l=new n(c),u=new n(c),d=new n(c);t.exports={Cache:n,split:p,normalizePath:f,setter:function(e){var t=f(e);return u.get(e)||u.set(e,function(e,n){for(var r=0,i=t.length,a=e;r<i-1;){var o=t[r];if(o===`__proto__`||o===`constructor`||o===`prototype`)return e;a=a[t[r++]]}a[t[r]]=n})},getter:function(e,t){var n=f(e);return d.get(e)||d.set(e,function(e){for(var r=0,i=n.length;r<i;)if(e!=null||!t)e=e[n[r++]];else return;return e})},join:function(e){return e.reduce(function(e,t){return e+(h(t)||i.test(t)?`[`+t+`]`:(e?`.`:``)+t)},``)},forEach:function(e,t,n){m(Array.isArray(e)?e:p(e),t,n)}};function f(e){return l.get(e)||l.set(e,p(e).map(function(e){return e.replace(s,`$2`)}))}function p(e){return e.match(r)||[``]}function m(e,t,n){var r=e.length,i,a,o,s;for(a=0;a<r;a++)i=e[a],i&&(v(i)&&(i=`"`+i+`"`),s=h(i),o=!s&&/^\d+$/.test(i),t.call(n,i,s,o,a,e))}function h(e){return typeof e==`string`&&e&&[`'`,`"`].indexOf(e.charAt(0))!==-1}function g(e){return e.match(a)&&!e.match(i)}function _(e){return o.test(e)}function v(e){return!h(e)&&(g(e)||_(e))}})),Ue=n(((e,t)=>{var n=/[A-Z\xc0-\xd6\xd8-\xde]?[a-z\xdf-\xf6\xf8-\xff]+(?:['â](?:d|ll|m|re|s|t|ve))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde]|$)|(?:[A-Z\xc0-\xd6\xd8-\xde]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['â](?:D|LL|M|RE|S|T|VE))?(?=[\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000]|[A-Z\xc0-\xd6\xd8-\xde](?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])|$)|[A-Z\xc0-\xd6\xd8-\xde]?(?:[a-z\xdf-\xf6\xf8-\xff]|[^\ud800-\udfff\xac\xb1\xd7\xf7\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\xbf\u2000-\u206f \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\d+\u2700-\u27bfa-z\xdf-\xf6\xf8-\xffA-Z\xc0-\xd6\xd8-\xde])+(?:['â](?:d|ll|m|re|s|t|ve))?|[A-Z\xc0-\xd6\xd8-\xde]+(?:['â](?:D|LL|M|RE|S|T|VE))?|\d*(?:1ST|2ND|3RD|(?![123])\dTH)(?=\b|[a-z_])|\d*(?:1st|2nd|3rd|(?![123])\dth)(?=\b|[A-Z_])|\d+|(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?(?:\u200d(?:[^\ud800-\udfff]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff])[\ufe0e\ufe0f]?(?:[\u0300-\u036f\ufe20-\ufe2f\u20d0-\u20ff]|\ud83c[\udffb-\udfff])?)*/g,r=e=>e.match(n)||[],i=e=>e[0].toUpperCase()+e.slice(1),a=(e,t)=>r(e).join(t).toLowerCase(),o=e=>r(e).reduce((e,t)=>
2`${e}${e?t[0].toUpperCase()+t.slice(1).toLowerCase():t.toLowerCase()}`,``);t.exports={words:r,upperFirst:i,camelCase:o,pascalCase:e=>i(o(e)),snakeCase:e=>a(e,`_`),kebabCase:e=>a(e,`-`),sentenceCase:e=>i(a(e,` `)),titleCase:e=>r(e).map(i).join(` `)}})),We=n(((e,t)=>{t.exports=function(e){return n(r(e),e)},t.exports.array=n;function n(e,t){var n=e.length,r=Array(n),o={},s=n,c=i(t),l=a(e);for(t.forEach(function(e){if(!l.has(e[0])||!l.has(e[1]))throw Error(`Unknown node. There is an unknown node in the supplied edges.`)});s--;)o[s]||u(e[s],s,new Set);return r;function u(e,t,i){if(i.has(e)){var a;try{a=`, node was:`+JSON.stringify(e)}catch{a=``}throw Error(`Cyclic dependency`+a)}if(!l.has(e))throw Error(`Found unknown node. Make sure to provided all involved nodes. Unknown node: `+JSON.stringify(e));if(!o[t]){o[t]=!0;var s=c.get(e)||new Set;if(s=Array.from(s),t=s.length){i.add(e);do{var d=s[--t];u(d,l.get(d),i)}while(t);i.delete(e)}r[--n]=e}}}function r(e){for(var t=new Set,n=0,r=e.length;n<r;n++){var i=e[n];t.add(i[0]),t.add(i[1])}return Array.from(t)}function i(e){for(var t=new Map,n=0,r=e.length;n<r;n++){var i=e[n];t.has(i[0])||t.set(i[0],new Set),t.has(i[1])||t.set(i[1],new Set),t.get(i[0]).add(i[1])}return t}function a(e){for(var t=new Map,n=0,r=e.length;n<r;n++)t.set(e[n],n);return t}})),Ge=He(),Ke=Ue(),qe=t(We()),Je=Object.prototype.toString,Ye=Error.prototype.toString,Xe=RegExp.prototype.toString,Ze=typeof Symbol<`u`?Symbol.prototype.toString:()=>``,Qe=/^Symbol\((.*)\)(.*)$/;function $e(e){return e==+e?e===0&&1/e<0?`-0`:``+e:`NaN`}function et(e,t=!1){if(e==null||e===!0||e===!1)return``+e;let n=typeof e;if(n===`number`)return $e(e);if(n===`string`)return t?`"${e}"`:e;if(n===`function`)return`[Function `+(e.name||`anonymous`)+`]`;if(n===`symbol`)return Ze.call(e).replace(Qe,`Symbol($1)`);let r=Je.call(e).slice(8,-1);return r===`Date`?isNaN(e.getTime())?``+e:e.toISOString(e):r===`Error`||e instanceof Error?`[`+Ye.call(e)+`]`:r===`RegExp`?Xe.call(e):null}function tt(e,t){let n=et(e,t);return n===null?JSON.stringify(e,function(e,n){let r=et(this[e],t);return r===null?n:r},2):n}function nt(e){return e==null?[]:[].concat(e)}var rt,it,at,ot=/\$\{\s*(\w+)\s*\}/g;rt=Symbol.toStringTag;var st=class{constructor(e,t,n,r){this.name=void 0,this.message=void 0,this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=void 0,this.inner=void 0,this[rt]=`Error`,this.name=`ValidationError`,this.value=t,this.path=n,this.type=r,this.errors=[],this.inner=[],nt(e).forEach(e=>{if(ct.isError(e)){this.errors.push(...e.errors);let t=e.inner.length?e.inner:[e];this.inner.push(...t)}else this.errors.push(e)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0]}};it=Symbol.hasInstance,at=Symbol.toStringTag;var ct=class e extends Error{static formatError(e,t){let n=t.label||t.path||`this`;return n!==t.path&&(t=Object.assign({},t,{path:n})),typeof e==`string`?e.replace(ot,(e,n)=>tt(t[n])):typeof e==`function`?e(t):e}static isError(e){return e&&e.name===`ValidationError`}constructor(t,n,r,i,a){let o=new st(t,n,r,i);if(a)return o;super(),this.value=void 0,this.path=void 0,this.type=void 0,this.params=void 0,this.errors=[],this.inner=[],this[at]=`Error`,this.name=o.name,this.message=o.message,this.type=o.type,this.value=o.value,this.path=o.path,this.errors=o.errors,this.inner=o.inner,Error.captureStackTrace&&Error.captureStackTrace(this,e)}static[it](e){return st[Symbol.hasInstance](e)||super[Symbol.hasInstance](e)}},lt={default:"${path} is invalid",required:"${path} is a required field",defined:"${path} must be defined",notNull:"${path} cannot be null",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:e,type:t,value:n,originalValue:r})=>{let i=r!=null&&r!==n?` (cast from the value \`${tt(r,!0)}\`).`:`.`;return t===`mixed`?`${e} must match the configured type. The validated value was: \`${tt(n,!0)}\``+i:`${e} must be a \`${t}\` type, but the final value was: \`${tt(n,!0)}\``+i}},ut={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",datetime:"${path} must be a valid ISO date-time",datetime_precision:"${path} must be a valid ISO date-time with a sub-second precision of exactly ${precision} digits",datetime_offset:'${path} must be a valid ISO date-time with UTC "Z" timezone',trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},dt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},ft={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},pt={isValue:"${path} field must be ${value}"},mt={noUnknown:"${path} field has unspecified keys: ${unknown}"},ht={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},gt={notType:e=>{let{path:t,value:n,spec:r}=e,i=r.types.length;if(Array.isArray(n)){if(n.length<i)return`${t} tuple value has too few items, expected a length of ${i} but got ${n.length} for value: \`${tt(n,!0)}\``;if(n.length>i)return`${t} tuple value has too many items, expected a length of ${i} but got ${n.length} for value: \`${tt(n,!0)}\``}return ct.formatError(lt.notType,e)}};Object.assign(Object.create(null),{mixed:lt,string:ut,number:dt,date:ft,object:mt,array:ht,boolean:pt,tuple:gt});var _t=e=>e&&e.__isYupSchema__,vt=class e{static fromOptions(t,n){if(!n.then&&!n.otherwise)throw TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:r,then:i,otherwise:a}=n,o=typeof r==`function`?r:(...e)=>e.every(e=>e===r);return new e(t,(e,t)=>(o(...e)?i:a)?.(t)??t)}constructor(e,t){this.fn=void 0,this.refs=e,this.refs=e,this.fn=t}resolve(e,t){let n=this.refs.map(e=>e.getValue(t?.value,t?.parent,t?.context)),r=this.fn(n,e,t);if(r===void 0||r===e)return e;if(!_t(r))throw TypeError(`conditions must return a schema object`);return r.resolve(t)}},yt={context:`$`,value:`.`},bt=class{constructor(e,t={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!=`string`)throw TypeError(`ref must be a string, got: `+e);if(this.key=e.trim(),e===``)throw TypeError(`ref must be a non-empty string`);this.isContext=this.key[0]===yt.context,this.isValue=this.key[0]===yt.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?yt.context:this.isValue?yt.value:``;this.path=this.key.slice(n.length),this.getter=this.path&&(0,Ge.getter)(this.path,!0),this.map=t.map}getValue(e,t,n){let r=this.isContext?n:this.isValue?e:t;return this.getter&&(r=this.getter(r||{})),this.map&&(r=this.map(r)),r}cast(e,t){return this.getValue(e,t?.parent,t?.context)}resolve(){return this}describe(){return{type:`ref`,key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}};bt.prototype.__isYupRef=!0;var xt=e=>e==null;function St(e){function t({value:t,path:n=``,options:r,originalValue:i,schema:a},o,s){let{name:c,test:l,params:u,message:d,skipAbsent:f}
2=e,{parent:p,context:m,abortEarly:h=a.spec.abortEarly,disableStackTrace:g=a.spec.disableStackTrace}=r;function _(e){return bt.isRef(e)?e.getValue(t,p,m):e}function v(e={}){let r=Object.assign({value:t,originalValue:i,label:a.spec.label,path:e.path||n,spec:a.spec,disableStackTrace:e.disableStackTrace||g},u,e.params);for(let e of Object.keys(r))r[e]=_(r[e]);let o=new ct(ct.formatError(e.message||d,r),t,r.path,e.type||c,r.disableStackTrace);return o.params=r,o}let y=h?o:s,b={path:n,parent:p,type:c,from:r.from,createError:v,resolve:_,options:r,originalValue:i,schema:a},x=e=>{ct.isError(e)?y(e):e?s(null):y(v())},S=e=>{ct.isError(e)?y(e):o(e)};if(f&&xt(t))return x(!0);let C;try{if(C=l.call(b,t,b),typeof C?.then==`function`){if(r.sync)throw Error(`Validation test of type: "${b.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`);return Promise.resolve(C).then(x,S)}}catch(e){S(e);return}x(C)}return t.OPTIONS=e,t}function Ct(e,t,n,r=n){let i,a,o;return t?((0,Ge.forEach)(t,(s,c,l)=>{let u=c?s.slice(1,s.length-1):s;e=e.resolve({context:r,parent:i,value:n});let d=e.type===`tuple`,f=l?parseInt(u,10):0;if(e.innerType||d){if(d&&!l)throw Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${o}" must contain an index to the tuple element, e.g. "${o}[0]"`);if(n&&f>=n.length)throw Error(`Yup.reach cannot resolve an array item at index: ${s}, in the path: ${t}. because there is no value at that index. `);i=n,n&&=n[f],e=d?e.spec.types[f]:e.innerType}if(!l){if(!e.fields||!e.fields[u])throw Error(`The schema does not contain the path: ${t}. (failed at: ${o} which is a type: "${e.type}")`);i=n,n&&=n[u],e=e.fields[u]}a=u,o=c?`[`+s+`]`:`.`+s}),{schema:e,parent:i,parentPath:a}):{parent:i,parentPath:t,schema:e}}var wt=class e extends Set{describe(){let e=[];for(let t of this.values())e.push(bt.isRef(t)?t.describe():t);return e}resolveAll(e){let t=[];for(let n of this.values())t.push(e(n));return t}clone(){return new e(this.values())}merge(e,t){let n=this.clone();return e.forEach(e=>n.add(e)),t.forEach(e=>n.delete(e)),n}};function Tt(e,t=new Map){if(_t(e)||!e||typeof e!=`object`)return e;if(t.has(e))return t.get(e);let n;if(e instanceof Date)n=new Date(e.getTime()),t.set(e,n);else if(e instanceof RegExp)n=new RegExp(e),t.set(e,n);else if(Array.isArray(e)){n=Array(e.length),t.set(e,n);for(let r=0;r<e.length;r++)n[r]=Tt(e[r],t)}else if(e instanceof Map){n=new Map,t.set(e,n);for(let[r,i]of e.entries())n.set(r,Tt(i,t))}else if(e instanceof Set){n=new Set,t.set(e,n);for(let r of e)n.add(Tt(r,t))}else if(e instanceof Object){n={},t.set(e,n);for(let[r,i]of Object.entries(e))n[r]=Tt(i,t)}else throw Error(`Unable to clone ${e}`);return n}var Et=class{constructor(e){this.type=void 0,this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this.internalTests={},this._whitelist=new wt,this._blacklist=new wt,this.exclusiveTests=Object.create(null),this._typeCheck=void 0,this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(lt.notType)}),this.type=e.type,this._typeCheck=e.check,this.spec=Object.assign({strip:!1,strict:!1,abortEarly:!0,recursive:!0,disableStackTrace:!1,nullable:!1,optional:!0,coerce:!0},e?.spec),this.withMutation(e=>{e.nonNullable()})}get _type(){return this.type}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;let t=Object.create(Object.getPrototypeOf(this));return t.type=this.type,t._typeCheck=this._typeCheck,t._whitelist=this._whitelist.clone(),t._blacklist=this._blacklist.clone(),t.internalTests=Object.assign({},this.internalTests),t.exclusiveTests=Object.assign({},this.exclusiveTests),t.deps=[...this.deps],t.conditions=[...this.conditions],t.tests=[...this.tests],t.transforms=[...this.transforms],t.spec=Tt(Object.assign({},this.spec,e)),t}label(e){let t=this.clone();return t.spec.label=e,t}meta(...e){if(e.length===0)return this.spec.meta;let t=this.clone();return t.spec.meta=Object.assign(t.spec.meta||{},e[0]),t}withMutation(e){let t=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=t,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!==`mixed`)throw TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let t=this,n=e.clone();return n.spec=Object.assign({},t.spec,n.spec),n.internalTests=Object.assign({},t.internalTests,n.internalTests),n._whitelist=t._whitelist.merge(e._whitelist,e._blackl
2ist),n._blacklist=t._blacklist.merge(e._blacklist,e._whitelist),n.tests=t.tests,n.exclusiveTests=t.exclusiveTests,n.withMutation(t=>{e.tests.forEach(e=>{t.test(e.OPTIONS)})}),n.transforms=[...t.transforms,...n.transforms],n}isType(e){return e==null?!!(this.spec.nullable&&e===null||this.spec.optional&&e===void 0):this._typeCheck(e)}resolve(e){let t=this;if(t.conditions.length){let n=t.conditions;t=t.clone(),t.conditions=[],t=n.reduce((t,n)=>n.resolve(t,e),t),t=t.resolve(e)}return t}resolveOptions(e){return Object.assign({},e,{from:e.from||[],strict:e.strict??this.spec.strict,abortEarly:e.abortEarly??this.spec.abortEarly,recursive:e.recursive??this.spec.recursive,disableStackTrace:e.disableStackTrace??this.spec.disableStackTrace})}cast(e,t={}){let n=this.resolve(Object.assign({value:e},t)),r=t.assert===`ignore-optionality`,i=n._cast(e,t);if(t.assert!==!1&&!n.isType(i)){if(r&&xt(i))return i;let a=tt(e),o=tt(i);throw TypeError(`The value of ${t.path||`field`} could not be cast to a value that satisfies the schema type: "${n.type}". \n\nattempted value: ${a} \n`+(o===a?``:`result of cast: ${o}`))}return i}_cast(e,t){let n=e===void 0?e:this.transforms.reduce((t,n)=>n.call(this,t,e,this),e);return n===void 0&&(n=this.getDefault(t)),n}_validate(e,t={},n,r){let{path:i,originalValue:a=e,strict:o=this.spec.strict}=t,s=e;o||(s=this._cast(s,Object.assign({assert:!1},t)));let c=[];for(let e of Object.values(this.internalTests))e&&c.push(e);this.runTests({path:i,value:s,originalValue:a,options:t,tests:c},n,e=>{if(e.length)return r(e,s);this.runTests({path:i,value:s,originalValue:a,options:t,tests:this.tests},n,r)})}runTests(e,t,n){let r=!1,{tests:i,value:a,originalValue:o,path:s,options:c}=e,l=e=>{r||(r=!0,t(e,a))},u=e=>{r||(r=!0,n(e,a))},d=i.length,f=[];if(!d)return u([]);let p={value:a,originalValue:o,path:s,options:c,schema:this};for(let e=0;e<i.length;e++){let t=i[e];t(p,l,function(e){e&&(Array.isArray(e)?f.push(...e):f.push(e)),--d<=0&&u(f)})}}asNestedTest({key:e,index:t,parent:n,parentPath:r,originalParent:i,options:a}){let o=e??t;if(o==null)throw TypeError("Must include `key` or `index` for nested validations");let s=typeof o==`number`,c=n[o],l=Object.assign({},a,{strict:!0,parent:n,value:c,originalValue:i[o],key:void 0,[s?`index`:`key`]:o,path:s||o.includes(`.`)?`${r||``}[${s?o:`"${o}"`}]`:(r?`${r}.`:``)+e});return(e,t,n)=>this.resolve(l)._validate(c,l,t,n)}validate(e,t){let n=this.resolve(Object.assign({},t,{value:e})),r=t?.disableStackTrace??n.spec.disableStackTrace;return new Promise((i,a)=>n._validate(e,t,(e,t)=>{ct.isError(e)&&(e.value=t),a(e)},(e,t)=>{e.length?a(new ct(e,t,void 0,void 0,r)):i(t)}))}validateSync(e,t){let n=this.resolve(Object.assign({},t,{value:e})),r,i=t?.disableStackTrace??n.spec.disableStackTrace;return n._validate(e,Object.assign({},t,{sync:!0}),(e,t)=>{throw ct.isError(e)&&(e.value=t),e},(t,n)=>{if(t.length)throw new ct(t,e,void 0,void 0,i);r=n}),r}isValid(e,t){return this.validate(e,t).then(()=>!0,e=>{if(ct.isError(e))return!1;throw e})}isValidSync(e,t){try{return this.validateSync(e,t),!0}catch(e){if(ct.isError(e))return!1;throw e}}_getDefault(e){let t=this.spec.default;return t==null?t:typeof t==`function`?t.call(this,e):Tt(t)}getDefault(e){return this.resolve(e||{})._getDefault(e)}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){return this.clone({strict:e})}nullability(e,t){let n=this.clone({nullable:e});return n.internalTests.nullable=St({message:t,name:`nullable`,test(e){return e===null?this.schema.spec.nullable:!0}}),n}optionality(e,t){let n=this.clone({optional:e});return n.internalTests.optionality=St({message:t,name:`optionality`,test(e){return e===void 0?this.schema.spec.optional:!0}}),n}optional(){return this.optionality(!0)}defined(e=lt.defined){return this.optionality(!1,e)}nullable(){return this.nullability(!0)}nonNullable(e=lt.notNull){return this.nullability(!1,e)}required(e=lt.required){return this.clone().withMutation(t=>t.nonNullable(e).defined(e))}notRequired(){return this.clone().withMutation(e=>e.nullable().optional())}transform(e){let t=this.clone();return t.transforms.push(e),t}test(...e){let t;if(t=e.length===1?typeof e[0]==`function`?{test:e[0]}:e[0]:e.length===2?{name:e[0],test:e[1]}:{name:e[0],message:e[1],test:e[2]},t.message===void 0&&(t.message=lt.default),typeof t.test!=`function`)throw TypeError("`test` is a required parameters");let n=this.clone(),r=St(t),i=t.exclusive||t.name&&n.exclusiveTests[t.name]===!0;if(t.exclusive&&!t.name)throw TypeError("Exclusive tests must provide a unique `name` identifying the test");return t.name&&(n.exclusiveTests[t.name]=!!t.exclusive),n.tests=n.tests.filter(e=>!(e.OPTIONS.name===t.name&&(i||e.OPTIONS.test===r.OPTIONS.test))),n.tests.push(r),n}when(e,t){!Array.isArray(e)&&typeof e!=`string`&&(t=e,e=`.`);let n=this.clone(),r=nt(e).map(e=>new bt(e));
2return r.forEach(e=>{e.isSibling&&n.deps.push(e.key)}),n.conditions.push(typeof t==`function`?new vt(r,t):vt.fromOptions(r,t)),n}typeError(e){let t=this.clone();return t.internalTests.typeError=St({message:e,name:`typeError`,skipAbsent:!0,test(e){return this.schema._typeCheck(e)?!0:this.createError({params:{type:this.schema.type}})}}),t}oneOf(e,t=lt.oneOf){let n=this.clone();return e.forEach(e=>{n._whitelist.add(e),n._blacklist.delete(e)}),n.internalTests.whiteList=St({message:t,name:`oneOf`,skipAbsent:!0,test(e){let t=this.schema._whitelist,n=t.resolveAll(this.resolve);return n.includes(e)?!0:this.createError({params:{values:Array.from(t).join(`, `),resolved:n}})}}),n}notOneOf(e,t=lt.notOneOf){let n=this.clone();return e.forEach(e=>{n._blacklist.add(e),n._whitelist.delete(e)}),n.internalTests.blacklist=St({message:t,name:`notOneOf`,test(e){let t=this.schema._blacklist,n=t.resolveAll(this.resolve);return n.includes(e)?this.createError({params:{values:Array.from(t).join(`, `),resolved:n}}):!0}}),n}strip(e=!0){let t=this.clone();return t.spec.strip=e,t}describe(e){let t=(e?this.resolve(e):this).clone(),{label:n,meta:r,optional:i,nullable:a}=t.spec;return{meta:r,label:n,optional:i,nullable:a,default:t.getDefault(e),type:t.type,oneOf:t._whitelist.describe(),notOneOf:t._blacklist.describe(),tests:t.tests.map(e=>({name:e.OPTIONS.name,params:e.OPTIONS.params})).filter((e,t,n)=>n.findIndex(t=>t.name===e.name)===t)}}};Et.prototype.__isYupSchema__=!0;for(let e of[`validate`,`validateSync`])Et.prototype[`${e}At`]=function(t,n,r={}){let{parent:i,parentPath:a,schema:o}=Ct(this,t,n,r.context);return o[e](i&&i[a],Object.assign({},r,{parent:i,path:t}))};for(let e of[`equals`,`is`])Et.prototype[e]=Et.prototype.oneOf;for(let e of[`not`,`nope`])Et.prototype[e]=Et.prototype.notOneOf;var Dt=()=>!0;function Ot(e){return new kt(e)}var kt=class extends Et{constructor(e){super(typeof e==`function`?{type:`mixed`,check:e}:Object.assign({type:`mixed`,check:Dt},e))}};Ot.prototype=kt.prototype;function At(){return new jt}var jt=class extends Et{constructor(){super({type:`boolean`,check(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e==`boolean`}}),this.withMutation(()=>{this.transform((e,t,n)=>{if(n.spec.coerce&&!n.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}isTrue(e=pt.isValue){return this.test({message:e,name:`is-value`,exclusive:!0,params:{value:`true`},test(e){return xt(e)||e===!0}})}isFalse(e=pt.isValue){return this.test({message:e,name:`is-value`,exclusive:!0,params:{value:`false`},test(e){return xt(e)||e===!1}})}default(e){return super.default(e)}defined(e){return super.defined(e)}optional(){return super.optional()}required(e){return super.required(e)}notRequired(){return super.notRequired()}nullable(){return super.nullable()}nonNullable(e){return super.nonNullable(e)}strip(e){return super.strip(e)}};At.prototype=jt.prototype;var Mt=/^(\d{4}|[+-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,.](\d{1,}))?)?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?)?)?$/;function Nt(e){let t=Pt(e);if(!t)return Date.parse?Date.parse(e):NaN;if(t.z===void 0&&t.plusMinus===void 0)return new Date(t.year,t.month,t.day,t.hour,t.minute,t.second,t.millisecond).valueOf();let n=0;return t.z!==`Z`&&t.plusMinus!==void 0&&(n=t.hourOffset*60+t.minuteOffset,t.plusMinus===`+`&&(n=0-n)),Date.UTC(t.year,t.month,t.day,t.hour,t.minute+n,t.second,t.millisecond)}function Pt(e){let t=Mt.exec(e);return t?{year:Ft(t[1]),month:Ft(t[2],1)-1,day:Ft(t[3],1),hour:Ft(t[4]),minute:Ft(t[5]),second:Ft(t[6]),millisecond:t[7]?Ft(t[7].substring(0,3)):0,precision:t[7]?.length??void 0,z:t[8]||void 0,plusMinus:t[9]||void 0,hourOffset:Ft(t[10]),minuteOffset:Ft(t[11])}:null}function Ft(e,t=0){return Number(e)||t}var It=/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Lt=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,Rt=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,zt=RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$`),Bt=e=>xt(e)||e===e.trim(),Vt={}.toString();function Ht(){return new Ut}
2var Ut=class extends Et{constructor(){super({type:`string`,check(e){return e instanceof String&&(e=e.valueOf()),typeof e==`string`}}),this.withMutation(()=>{this.transform((e,t,n)=>{if(!n.spec.coerce||n.isType(e)||Array.isArray(e))return e;let r=e!=null&&e.toString?e.toString():e;return r===Vt?e:r})})}required(e){return super.required(e).withMutation(t=>t.test({message:e||lt.required,name:`required`,skipAbsent:!0,test:e=>!!e.length}))}notRequired(){return super.notRequired().withMutation(e=>(e.tests=e.tests.filter(e=>e.OPTIONS.name!==`required`),e))}length(e,t=ut.length){return this.test({message:t,name:`length`,exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t=ut.min){return this.test({message:t,name:`min`,exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t=ut.max){return this.test({name:`max`,exclusive:!0,message:t,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}matches(e,t){let n=!1,r,i;return t&&(typeof t==`object`?{excludeEmptyString:n=!1,message:r,name:i}=t:r=t),this.test({name:i||`matches`,message:r||ut.matches,params:{regex:e},skipAbsent:!0,test:t=>t===``&&n||t.search(e)!==-1})}email(e=ut.email){return this.matches(It,{name:`email`,message:e,excludeEmptyString:!0})}url(e=ut.url){return this.matches(Lt,{name:`url`,message:e,excludeEmptyString:!0})}uuid(e=ut.uuid){return this.matches(Rt,{name:`uuid`,message:e,excludeEmptyString:!1})}datetime(e){let t=``,n,r;return e&&(typeof e==`object`?{message:t=``,allowOffset:n=!1,precision:r=void 0}=e:t=e),this.matches(zt,{name:`datetime`,message:t||ut.datetime,excludeEmptyString:!0}).test({name:`datetime_offset`,message:t||ut.datetime_offset,params:{allowOffset:n},skipAbsent:!0,test:e=>{if(!e||n)return!0;let t=Pt(e);return t?!!t.z:!1}}).test({name:`datetime_precision`,message:t||ut.datetime_precision,params:{precision:r},skipAbsent:!0,test:e=>{if(!e||r==null)return!0;let t=Pt(e);return t?t.precision===r:!1}})}ensure(){return this.default(``).transform(e=>e===null?``:e)}trim(e=ut.trim){return this.transform(e=>e==null?e:e.trim()).test({message:e,name:`trim`,test:Bt})}lowercase(e=ut.lowercase){return this.transform(e=>xt(e)?e:e.toLowerCase()).test({message:e,name:`string_case`,exclusive:!0,skipAbsent:!0,test:e=>xt(e)||e===e.toLowerCase()})}uppercase(e=ut.uppercase){return this.transform(e=>xt(e)?e:e.toUpperCase()).test({message:e,name:`string_case`,exclusive:!0,skipAbsent:!0,test:e=>xt(e)||e===e.toUpperCase()})}};Ht.prototype=Ut.prototype;var Wt=e=>e!=+e;function Gt(){return new Kt}var Kt=class extends Et{constructor(){super({type:`number`,check(e){return e instanceof Number&&(e=e.valueOf()),typeof e==`number`&&!Wt(e)}}),this.withMutation(()=>{this.transform((e,t,n)=>{if(!n.spec.coerce)return e;let r=e;if(typeof r==`string`){if(r=r.replace(/\s/g,``),r===``)return NaN;r=+r}return n.isType(r)||r===null?r:parseFloat(r)})})}min(e,t=dt.min){return this.test({message:t,name:`min`,exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t>=this.resolve(e)}})}max(e,t=dt.max){return this.test({message:t,name:`max`,exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t<=this.resolve(e)}})}lessThan(e,t=dt.lessThan){return this.test({message:t,name:`max`,exclusive:!0,params:{less:e},skipAbsent:!0,test(t){return t<this.resolve(e)}})}moreThan(e,t=dt.moreThan){return this.test({message:t,name:`min`,exclusive:!0,params:{more:e},skipAbsent:!0,test(t){return t>this.resolve(e)}})}positive(e=dt.positive){return this.moreThan(0,e)}negative(e=dt.negative){return this.lessThan(0,e)}integer(e=dt.integer){return this.test({name:`integer`,message:e,ski
2pAbsent:!0,test:e=>Number.isInteger(e)})}truncate(){return this.transform(e=>xt(e)?e:e|0)}round(e){let t=[`ceil`,`floor`,`round`,`trunc`];if(e=e?.toLowerCase()||`round`,e===`trunc`)return this.truncate();if(t.indexOf(e.toLowerCase())===-1)throw TypeError(`Only valid options for round() are: `+t.join(`, `));return this.transform(t=>xt(t)?t:Math[e](t))}};Gt.prototype=Kt.prototype;var qt=new Date(``),Jt=e=>Object.prototype.toString.call(e)===`[object Date]`;function Yt(){return new Xt}var Xt=class e extends Et{constructor(){super({type:`date`,check(e){return Jt(e)&&!isNaN(e.getTime())}}),this.withMutation(()=>{this.transform((t,n,r)=>!r.spec.coerce||r.isType(t)||t===null?t:(t=Nt(t),isNaN(t)?e.INVALID_DATE:new Date(t)))})}prepareParam(e,t){let n;if(bt.isRef(e))n=e;else{let r=this.cast(e);if(!this._typeCheck(r))throw TypeError(`\`${t}\` must be a Date or a value that can be \`cast()\` to a Date`);n=r}return n}min(e,t=ft.min){let n=this.prepareParam(e,`min`);return this.test({message:t,name:`min`,exclusive:!0,params:{min:e},skipAbsent:!0,test(e){return e>=this.resolve(n)}})}max(e,t=ft.max){let n=this.prepareParam(e,`max`);return this.test({message:t,name:`max`,exclusive:!0,params:{max:e},skipAbsent:!0,test(e){return e<=this.resolve(n)}})}};Xt.INVALID_DATE=qt,Yt.prototype=Xt.prototype,Yt.INVALID_DATE=qt;function Zt(e,t=[]){let n=[],r=new Set,i=new Set(t.map(([e,t])=>`${e}-${t}`));function a(e,t){let a=(0,Ge.split)(e)[0];r.add(a),i.has(`${t}-${a}`)||n.push([t,a])}for(let t of Object.keys(e)){let n=e[t];r.add(t),bt.isRef(n)&&n.isSibling?a(n.path,t):_t(n)&&`deps`in n&&n.deps.forEach(e=>a(e,t))}return qe.default.array(Array.from(r),n).reverse()}function Qt(e,t){let n=1/0;return e.some((e,r)=>{var i;if((i=t.path)!=null&&i.includes(e))return n=r,!0}),n}function $t(e){return(t,n)=>Qt(e,t)-Qt(e,n)}var en=(e,t,n)=>{if(typeof e!=`string`)return e;let r=e;try{r=JSON.parse(e)}catch{}return n.isType(r)?r:e};function tn(e){if(`fields`in e){let t={};for(let[n,r]of Object.entries(e.fields))t[n]=tn(r);return e.setFields(t)}if(e.type===`array`){let t=e.optional();return t.innerType&&=tn(t.innerType),t}return e.type===`tuple`?e.optional().clone({types:e.spec.types.map(tn)}):`optional`in e?e.optional():e}var nn=(e,t)=>{let n=[...(0,Ge.normalizePath)(t)];if(n.length===1)return n[0]in e;let r=n.pop(),i=(0,Ge.getter)((0,Ge.join)(n),!0)(e);return!!(i&&r in i)},rn=e=>Object.prototype.toString.call(e)===`[object Object]`;function an(e,t){let n=Object.keys(e.fields);return Object.keys(t).filter(e=>n.indexOf(e)===-1)}var on=$t([]);function sn(e){return new cn(e)}var cn=class extends Et{constructor(e){super({type:`object`,check(e){return rn(e)||typeof e==`function`}}),this.fields=Object.create(null),this._sortErrors=on,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{e&&this.shape(e)})}_cast(e,t={}){let n=super._cast(e,t);if(n===void 0)return this.getDefault(t);if(!this._typeCheck(n))return n;let r=this.fields,i=t.stripUnknown??this.spec.noUnknown,a=[].concat(this._nodes,Object.keys(n).filter(e=>!this._nodes.includes(e))),o={},s=Object.assign({},t,{parent:o,__validating:t.__validating||!1}),c=!1;for(let e of a){let a=r[e],l=e in n;if(a){let r,i=n[e];s.path=(t.path?`${t.path}.`:``)+e,a=a.resolve({value:i,context:t.context,parent:o});let l=a instanceof Et?a.spec:void 0,u=l?.strict;if(l!=null&&l.strip){c||=e in n;continue}r=!t.__validating||!u?a.cast(n[e],s):n[e],r!==void 0&&(o[e]=r)}else l&&!i&&(o[e]=n[e]);(l!==e in o||o[e]!==n[e])&&(c=!0)}return c?o:n}_validate(e,t={},n,r){let{from:i=[],originalValue:a=e,recursive:o=this.spec.recursive}=t;t.from=[{schema:this,value:a},...i],t.__validating=!0,t.originalValue=a,super._validate(e,t,n,(e,i)=>{if(!o||!rn(i)){r(e,i);return}a||=i;let s=[];for(let e of this._nodes){let n=this.fields[e];!n||bt.isRef(n)||s.push(n.asNestedTest({options:t,key:e,parent:i,parentPath:t.path,originalParent:a}))}this.runTests({tests:s,value:i,originalValue:a,options:t},n,t=>{r(t.sort(this._sortErrors).concat(e),i)})})}clone(e){let t=super.clone(e);return t.fields=Object.assign({},this.fields),t._nodes=this._nodes,t._excludedEdges=this._excludedEdges,t._sortErrors=this._sortErrors,t}concat(e){let t=super.concat(e),n=t.fields;for(let[e,t]of Object.entries(this.fields)){let r=n[e];n[e]=r===void 0?t:r}return t.withMutation(t=>t.setFields(n,[...this._excludedEdges,...e._excludedEdges]))}_getDefault(e){if(`default`in this.spec)return super._getDefault(e);if(!this._nodes.length)return;let t={};
2return this._nodes.forEach(n=>{var r;let i=this.fields[n],a=e;(r=a)!=null&&r.value&&(a=Object.assign({},a,{parent:a.value,value:a.value[n]})),t[n]=i&&`getDefault`in i?i.getDefault(a):void 0}),t}setFields(e,t){let n=this.clone();return n.fields=e,n._nodes=Zt(e,t),n._sortErrors=$t(Object.keys(e)),t&&(n._excludedEdges=t),n}shape(e,t=[]){return this.clone().withMutation(n=>{let r=n._excludedEdges;return t.length&&(Array.isArray(t[0])||(t=[t]),r=[...n._excludedEdges,...t]),n.setFields(Object.assign(n.fields,e),r)})}partial(){let e={};for(let[t,n]of Object.entries(this.fields))e[t]=`optional`in n&&n.optional instanceof Function?n.optional():n;return this.setFields(e)}deepPartial(){return tn(this)}pick(e){let t={};for(let n of e)this.fields[n]&&(t[n]=this.fields[n]);return this.setFields(t,this._excludedEdges.filter(([t,n])=>e.includes(t)&&e.includes(n)))}omit(e){let t=[];for(let n of Object.keys(this.fields))e.includes(n)||t.push(n);return this.pick(t)}from(e,t,n){let r=(0,Ge.getter)(e,!0);return this.transform(i=>{if(!i)return i;let a=i;return nn(i,e)&&(a=Object.assign({},i),n||delete a[e],a[t]=r(i)),a})}json(){return this.transform(en)}noUnknown(e=!0,t=mt.noUnknown){typeof e!=`boolean`&&(t=e,e=!0);let n=this.test({name:`noUnknown`,exclusive:!0,message:t,test(t){if(t==null)return!0;let n=an(this.schema,t);return!e||n.length===0||this.createError({params:{unknown:n.join(`, `)}})}});return n.spec.noUnknown=e,n}unknown(e=!0,t=mt.noUnknown){return this.noUnknown(!e,t)}transformKeys(e){return this.transform(t=>{if(!t)return t;let n={};for(let r of Object.keys(t))n[e(r)]=t[r];return n})}camelCase(){return this.transformKeys(Ke.camelCase)}snakeCase(){return this.transformKeys(Ke.snakeCase)}constantCase(){return this.transformKeys(e=>(0,Ke.snakeCase)(e).toUpperCase())}describe(e){let t=(e?this.resolve(e):this).clone(),n=super.describe(e);n.fields={};for(let[i,a]of Object.entries(t.fields)){var r;let t=e;(r=t)!=null&&r.value&&(t=Object.assign({},t,{parent:t.value,value:t.value[i]})),n.fields[i]=a.describe(t)}return n}};sn.prototype=cn.prototype;function ln(e){return new un(e)}var un=class extends Et{constructor(e){super({type:`array`,spec:{types:e},check(e){return Array.isArray(e)}}),this.innerType=void 0,this.innerType=e}_cast(e,t){let n=super._cast(e,t);if(!this._typeCheck(n)||!this.innerType)return n;let r=!1,i=n.map((e,n)=>{let i=this.innerType.cast(e,Object.assign({},t,{path:`${t.path||``}[${n}]`}));return i!==e&&(r=!0),i});return r?i:n}_validate(e,t={},n,r){let i=this.innerType,a=t.recursive??this.spec.recursive;t.originalValue!=null&&t.originalValue,super._validate(e,t,n,(o,s)=>{if(!a||!i||!this._typeCheck(s)){r(o,s);return}let c=Array(s.length);for(let n=0;n<s.length;n++)c[n]=i.asNestedTest({options:t,index:n,parent:s,parentPath:t.path,originalParent:t.originalValue??e});this.runTests({value:s,tests:c,originalValue:t.originalValue??e,options:t},n,e=>r(e.concat(o),s))})}clone(e){let t=super.clone(e);return t.innerType=this.innerType,t}json(){return this.transform(en)}concat(e){let t=super.concat(e);return t.innerType=this.innerType,e.innerType&&(t.innerType=t.innerType?t.innerType.concat(e.innerType):e.innerType),t}of(e){let t=this.clone();if(!_t(e))throw TypeError("`array.of()` sub-schema must be a valid yup schema not: "+tt(e));return t.innerType=e,t.spec=Object.assign({},t.spec,{types:e}),t}length(e,t=ht.length){return this.test({message:t,name:`length`,exclusive:!0,params:{length:e},skipAbsent:!0,test(t){return t.length===this.resolve(e)}})}min(e,t){return t||=ht.min,this.test({message:t,name:`min`,exclusive:!0,params:{min:e},skipAbsent:!0,test(t){return t.length>=this.resolve(e)}})}max(e,t){return t||=ht.max,this.test({message:t,name:`max`,exclusive:!0,params:{max:e},skipAbsent:!0,test(t){return t.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,t)=>this._typeCheck(e)?e:t==null?[]:[].concat(t))}compact(e){let t=e?(t,n,r)=>!e(t,n,r):e=>!!e;return this.transform(e=>e==null?e:e.filter(t))}describe(e){let t=(e?this.resolve(e):this).clone(),n=super.describe(e);if(t.innerType){var r;let i=e;(r=i)!=null&&r.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[0]})),n.innerType=t.innerType.describe(i)}return n}};ln.prototype=un.prototype;function dn(e){return new fn(e)}
2var fn=class extends Et{constructor(e){super({type:`tuple`,spec:{types:e},check(e){let t=this.spec.types;return Array.isArray(e)&&e.length===t.length}}),this.withMutation(()=>{this.typeError(gt.notType)})}_cast(e,t){let{types:n}=this.spec,r=super._cast(e,t);if(!this._typeCheck(r))return r;let i=!1,a=n.map((e,n)=>{let a=e.cast(r[n],Object.assign({},t,{path:`${t.path||``}[${n}]`}));return a!==r[n]&&(i=!0),a});return i?a:r}_validate(e,t={},n,r){let i=this.spec.types;super._validate(e,t,n,(a,o)=>{if(!this._typeCheck(o)){r(a,o);return}let s=[];for(let[n,r]of i.entries())s[n]=r.asNestedTest({options:t,index:n,parent:o,parentPath:t.path,originalParent:t.originalValue??e});this.runTests({value:o,tests:s,originalValue:t.originalValue??e,options:t},n,e=>r(e.concat(a),o))})}describe(e){let t=(e?this.resolve(e):this).clone(),n=super.describe(e);return n.innerType=t.spec.types.map((t,n)=>{var r;let i=e;return(r=i)!=null&&r.value&&(i=Object.assign({},i,{parent:i.value,value:i.value[n]})),t.describe(i)}),n}};dn.prototype=fn.prototype;var G=o(),pn=/^(?![0-9])[a-z0-9\-]+$/,mn=(e=36)=>Ht().required(`slugIsRequired`).min(2,`min2Characters`).max(e,`max${e}Characters`).matches(/^[a-z0-9\-]+$/,`slugMatches`),hn=Ht().required(`slugIsRequired`).min(2,`min2Characters`).max(36,`max36Characters`).matches(pn,`quickCommandStepsSlugValidation`);function gn(e){return(0,G.deburr)(e).toLowerCase().replaceAll(/^-+|-+$/g,``).replace(/ /g,`-`).replace(/(-)+/g,`-`).replace(/[^a-z-\d]/g,``).slice(0,e.length>36?36:e.length)}var _n={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`},vn=[[-1/0,-1/0],[1/0,1/0]],yn=[`Enter`,` `,`Escape`],bn={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},xn;(function(e){e.Strict=`strict`,e.Loose=`loose`})(xn||={});var Sn;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(Sn||={});var Cn;(function(e){e.Partial=`partial`,e.Full=`full`})(Cn||={});var wn={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null},Tn;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(Tn||={});var En;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(En||={});var K;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(K||={});var Dn={[K.Left]:K.Right,[K.Right]:K.Left,[K.Top]:K.Bottom,[K.Bottom]:K.Top};function On(e,t){if(!e&&!t)return!0;
2if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(let n of e.keys())if(!t.has(n))return!1;return!0}function kn(e,t,n){if(!n)return;let r=[];e.forEach((e,n)=>{t?.has(n)||r.push(e)}),r.length&&n(r)}function An(e){return e===null?null:e?`valid`:`invalid`}var jn=e=>`id`in e&&`source`in e&&`target`in e,Mn=e=>`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),Nn=e=>`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),Pn=(e,t,n)=>{if(!e.id)return[];let r=new Set;return n.forEach(t=>{t.target===e.id&&r.add(t.source)}),t.filter(e=>r.has(e.id))},Fn=(e,t=[0,0])=>{let{width:n,height:r}=mr(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},In=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:Zn(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):Nn(n)?n:t.nodeLookup.get(n.id)),Yn(e,i?$n(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Ln=(e,t={})=>{if(e.size===0)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(e=>{if(t.filter===void 0||t.filter(e)){let t=$n(e);n=Yn(n,t)}}),Zn(n)},Rn=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s={...or(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??null,l=e.height??t.height??t.initialHeight??null,u=tr(s,Qn(t)),d=(i??0)*(l??0),f=a&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&c.push(t)}return c},zn=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function Bn(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{e.measured.width&&e.measured.height&&(t?.includeHiddenNodes||!e.hidden)&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}
2async function Vn({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return Promise.resolve(!0);let s=dr(Ln(Bn(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),Promise.resolve(!0)}function Hn({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,_n.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&pr(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=pr(d)?Gn(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,_n.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function Un({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=zn(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var Wn=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Gn=(e={x:0,y:0},t,n)=>({x:Wn(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Wn(e.y,t[0][1],t[1][1]-(n?.height??0))});function Kn(e,t,n){let{width:r,height:i}=mr(n),{x:a,y:o}=n.internals.positionAbsolute;return Gn(e,[[a,o],[a+r,o+i]],t)}var qn=(e,t,n)=>e<t?Wn(Math.abs(e-t),1,t)/t:e>n?-Wn(Math.abs(e-n),1,t)/t:0,Jn=(e,t,n=15,r=40)=>[qn(e.x,r,t.width-r)*n,qn(e.y,r,t.height-r)*n],Yn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Xn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Zn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Qn=(e,t=[0,0])=>{let{x:n,y:r}=Nn(e)?e.internals.positionAbsolute:Fn(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},$n=(e,t=[0,0])=>{let{x:n,y:r}=Nn(e)?e.internals.positionAbsolute:Fn(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},er=(e,t)=>Zn(Yn(Xn(e),Xn(t))),tr=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},nr=e=>rr(e.width)&&rr(e.height)&&rr(e.x)&&rr(e.y),rr=e=>!isNaN(e)&&isFinite(e),ir=(e,t)=>{},ar=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),or=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?ar(s,o):s},sr=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function cr(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function lr(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=cr(e,n),i=cr(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=cr(e.top??e.y??0,n),i=cr(e.bottom??e.y??0,n),a=cr(e.left??e.x??0,t),o=cr(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ur(e,t,n,r,i,a){let{x:o,y:s}=sr(e,[t,n,r]),{x:c,y:l}=sr({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var dr=(e,t,n,r,i,a)=>{let o=lr(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=Wn(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=ur(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}}
2,fr=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function pr(e){return e!==void 0&&e!==`parent`}function mr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function hr(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function gr(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function _r(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function vr(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function yr(e){return{...bn,...e||{}}}function br(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=Er(e),s=or({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?ar(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var xr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Sr=e=>e?.getRootNode?.()||window?.document,Cr=[`INPUT`,`SELECT`,`TEXTAREA`];function wr(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?Cr.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var Tr=e=>`clientX`in e,Er=(e,t)=>{let n=Tr(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Dr=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...xr(t)}})};function Or({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function kr(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ar({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case K.Left:return[t-kr(t-r,a),n];case K.Right:return[t+kr(r-t,a),n];case K.Top:return[t,n-kr(n-i,a)];case K.Bottom:return[t,n+kr(i-n,a)]}}function jr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top,curvature:o=.25}){let[s,c]=Ar({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=Ar({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Or({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function Mr({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Nr({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r,elevateOnSelect:i=!1}){return r===void 0?(i&&n?1e3:0)+Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0):r}function Pr({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=Yn($n(e),$n(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),tr({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},Zn(a))>0}var Fr=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,Ir=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Lr=(e,t)=>{if(!e.source||!e.target)return _n.error006(),t;let n;return n=jn(e)?{...e}:{...e,id:Fr(e)},Ir(n,t)?t:(n.sourceHandle===null&&delete n.sourceHandle,n.targetHandle===null&&delete n.targetHandle,t.concat(n))};function Rr({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Mr({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var zr={[K.Left]:{x:-1,y:0},[K.Right]:{x:1,y:0},[K.Top]:{x:0,y:-1},[K.Bottom]:{x:0,y:1}},Br=({source:e,sourcePosition:t=K.Bottom,target:n})=>t===K.Left||t===K.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Vr=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function Hr({source:e,sourcePosition:t=K.Bottom,target:n,targetPosition:r=K.Top,center:i,offset:a}){let o=zr[t],s=zr[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=Br({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p=[],m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=Mr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]
2);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function Ur(e,t,n,r){let i=Math.min(Vr(e,t)/2,Vr(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function Wr({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20}){let[u,d,f,p,m]=Hr({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l});return[u.reduce((e,t,n)=>{let r=``;return r=n>0&&n<u.length-1?Ur(u[n-1],t,u[n+1],o):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),d,f,p,m]}function Gr(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Kr(e){let{sourceNode:t,targetNode:n}=e;if(!Gr(t)||!Gr(n))return null;let r=t.internals.handleBounds||qr(t.handles),i=n.internals.handleBounds||qr(n.handles),a=Yr(r?.source??[],e.sourceHandle),o=Yr(e.connectionMode===xn.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,_n.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||K.Bottom,c=o?.position||K.Top,l=Jr(t,a,s),u=Jr(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function qr(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function Jr(e,t,n=K.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??mr(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case K.Top:return{x:i+o/2,y:a};case K.Right:return{x:i+o,y:a+s/2};case K.Bottom:return{x:i+o/2,y:a+s};case K.Left:return{x:i,y:a+s/2}}}function Yr(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Xr(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function Zr(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=Xr(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var Qr={nodeOrigin:[0,0],nodeExtent:vn,elevateNodesOnSelect:!0,defaults:{}},$r={...Qr,checkEquality:!0};function ei(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function ti(e,t,n){let r=ei(Qr,n);for(let n of e.values())if(n.parentId)ii(n,e,t,r);else{let e=Gn(Fn(n,r.nodeOrigin),pr(n.extent)?n.extent:r.nodeExtent,mr(n));n.internals.positionAbsolute=e}}function ni(e,t,n,r){let i=ei($r,r),a=e.length>0,o=new Map(t),s=i?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(let c of e){let e=o.get(c.id);if(i.checkEquality&&c===e?.internals.userNode)t.set(c.id,e);else{let n=Gn(Fn(c,i.nodeOrigin),pr(c.extent)?c.extent:i.nodeExtent,mr(c));e={...i.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:n,handleBounds:c.measured?e?.internals.handleBounds:void 0,z:ai(c,s),userNode:c}},t.set(c.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(a=!1),c.parentId&&ii(e,t,n,r)}return a}function ri(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function ii(e,t,n,r){let{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:o}
2=ei(Qr,r),s=e.parentId,c=t.get(s);if(!c){console.warn(`Parent node ${s} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}ri(e,n);let{x:l,y:u,z:d}=oi(e,c,a,o,i?1e3:0),{positionAbsolute:f}=e.internals,p=l!==f.x||u!==f.y;(p||d!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:l,y:u}:f,z:d}})}function ai(e,t){return(rr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function oi(e,t,n,r,i){let{x:a,y:o}=t.internals.positionAbsolute,s=mr(e),c=Fn(e,n),l=pr(e.extent)?Gn(c,e.extent,s):c,u=Gn({x:a+l.x,y:o+l.y},r,s);e.extent===`parent`&&(u=Kn(u,s,t));let d=ai(e,i),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=d?f+1:d}}function si(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=er(a.get(n.parentId)?.expandedRect??Qn(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=mr(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function ci(e,t,n,r,i,a){let o=r?.querySelector(`.xyflow__viewport`),s=!1;if(!o)return{changes:[],updatedInternals:s};let c=[],l=window.getComputedStyle(o),{m22:u}=new window.DOMMatrixReadOnly(l.transform),d=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}let o=xr(r.nodeElement),l=e.measured.width!==o.width||e.measured.height!==o.height;if(o.width&&o.height&&(l||!e.internals.handleBounds||r.force)){let f=r.nodeElement.getBoundingClientRect(),p=pr(e.extent)?e.extent:a,{positionAbsolute:m}=e.internals;e.parentId&&e.extent===`parent`?m=Kn(m,o,t.get(e.parentId)):p&&(m=Gn(m,p,o));let h={...e,measured:o,internals:{...e.internals,positionAbsolute:m,handleBounds:{source:Dr(`source`,r.nodeElement,f,u,e.id),target:Dr(`target`,r.nodeElement,f,u,e.id)}}};t.set(e.id,h),e.parentId&&ii(h,t,n,{nodeOrigin:i}),s=!0,l&&(c.push({id:e.id,type:`dimensions`,dimensions:o}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:Qn(h,i)}))}}if(d.length>0){let e=si(d,t,n,i);c.push(...e)}return{changes:c,updatedInternals:s}}async function li({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r),s=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(s)}function ui(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function di(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;ui(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),ui(`target`,s,c,e,i,o),t.set(r.id,r)}}function fi(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:fi(n,t):!1}function pi(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function mi(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!fi(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function hi({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function gi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1;function h({noDragClassName:h,handleSelector:g,domNode:_,isSelectable:v,nodeId:y,nodeClickDistance:b=0}){f=Ae(_);function x({x:e,y:n}
2,i){let{nodeLookup:o,nodeExtent:c,snapGrid:l,snapToGrid:u,nodeOrigin:d,onNodeDrag:f,onSelectionDrag:p,onError:h,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v={x:0,y:0,x2:0,y2:0};s.size>1&&c&&(v=Xn(Ln(s)));for(let[t,r]of s){if(!o.has(t))continue;let i={x:e-r.distance.x,y:n-r.distance.y};u&&(i=ar(i,l));let a=[[c[0][0],c[0][1]],[c[1][0],c[1][1]]];if(s.size>1&&c&&!r.extent){let{positionAbsolute:e}=r.internals,t=e.x-v.x+c[0][0],n=e.x+r.measured.width-v.x2+c[1][0],i=e.y-v.y+c[0][1],o=e.y+r.measured.height-v.y2+c[1][1];a=[[t,i],[n,o]]}let{position:f,positionAbsolute:p}=Hn({nodeId:t,nextPosition:i,nodeLookup:o,nodeExtent:a,nodeOrigin:d,onError:h});_=_||r.position.x!==f.x||r.position.y!==f.y,r.position=f,r.internals.positionAbsolute=p}if(m||=_,_&&(g(s,!0),i&&(r||f||!y&&p))){let[e,t]=hi({nodeId:y,dragItems:s,nodeLookup:o});r?.(i,s,e,t),f?.(i,e,t),y||p?.(i,t)}}async function S(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=Jn(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&x(a,null)),o=requestAnimationFrame(S)}function C(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!v)&&!o&&y&&(i.get(y)?.selected||_()),v&&m&&y&&e?.(y);let b=br(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=b,s=mi(i,c,b,y),s.size>0&&(n||h||!y&&g)){let[e,t]=hi({nodeId:y,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),y||g?.(r.sourceEvent,t)}}let w=De().clickDistance(b).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,r===0&&C(e),a=br(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=Er(e.sourceEvent,u)}).on(`drag`,e=>
2{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),h=br(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if((e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||y&&!m.has(y))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,S()),!d){let t=h.xSnapped-(a.x??0),n=h.ySnapped-(a.y??0);Math.sqrt(t*t+n*n)>f&&C(e)}(a.x!==h.xSnapped||a.y!==h.ySnapped)&&s&&d&&(l=Er(e.sourceEvent,u),x(h,e.sourceEvent))}}).on(`end`,e=>{if(!(!d||p)&&(c=!1,d=!1,cancelAnimationFrame(o),s.size>0)){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!y&&o){let[t,r]=hi({nodeId:y,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),y||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!h||!pi(t,`.${h}`,_))&&(!g||pi(t,g,_))});f.call(w)}function g(){f?.on(`.drag`,null)}return{update:h,destroy:g}}function _i(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())tr(i,Qn(e))>0&&r.push(e);return r}var vi=250;function yi(e,t,n,r){let i=[],a=1/0,o=_i(e,n,t+vi);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=Jr(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function bi(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...Jr(o,c,c.position,!0)}:c}function xi(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Si(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var Ci=()=>!0;function wi(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNo
2de:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=Ci,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1}){let w=Sr(e.target),T=0,E,{x:D,y:O}=Er(e),k=w?.elementFromPoint(D,O),A=xi(a,k),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=bi(i,A,r,c,t);if(!N)return;let P=Er(e,j),F=!1,I=null,L=!1,R=null;function ee(){if(!u||!j)return;let[e,t]=Jn(P,j,S);f({x:e,y:t}),T=requestAnimationFrame(ee)}let z={...N,nodeId:i,type:A,position:N.position},te=c.get(i),B={inProgress:!0,isValid:null,from:Jr(te,z,K.Left,!0),fromHandle:z,fromPosition:z.position,fromNode:te,to:P,toHandle:null,toPosition:Dn[z.position],toNode:null};function ne(){M=!0,y(B),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ne();function re(e){if(!M){let{x:t,y:n}=Er(e),r=t-D,i=n-O;if(!(r*r+i*i>C*C))return;ne()}if(!x()||!z){V(e);return}let a=b();P=Er(e,j),E=yi(or(P,a,!1,[1,1]),n,c,z),F||=(ee(),!0);let s=Ti(e,{handle:E,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:w,lib:l,flowId:d,nodeLookup:c});R=s.handleDomNode,I=s.connection,L=Si(!!E,s.isValid);let u={...B,isValid:L,to:s.toHandle&&L?sr({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:L&&s.toHandle?s.toHandle.position:Dn[z.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null};L&&E&&B.toHandle&&u.toHandle&&B.toHandle.type===u.toHandle.type&&B.toHandle.nodeId===u.toHandle.nodeId&&B.toHandle.id===u.toHandle.id&&B.to.x===u.to.x&&B.to.y===u.to.y||(y(u),B=u)}function V(e){if(M){(E||R)&&I&&L&&h?.(I);let{inProgress:t,...n}=B,r={...n,toPosition:B.toHandle?B.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(T),F=!1,L=!1,I=null,R=null,w.removeEventListener(`mousemove`,re),w.removeEventListener(`mouseup`,V),w.removeEventListener(`touchmove`,re),w.removeEventListener(`touchend`,V)}w.addEventListener(`mousemove`,re),w.addEventListener(`mouseup`,V),w.addEventListener(`touchmove`,re),w.addEventListener(`touchend`,V)}function Ti(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=Ci,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=Er(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=xi(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===xn.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=bi(t,e,a,u,n,!0)}return _}var Ei={onPointerDown:wi,isValid:Ti};function Di({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=Ae(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=10,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{let r=n();if(e.sourceEvent.type!==`wheel`||!t)return;let i=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,a=r[2]*2**i;t.scaleTo(a)},f=[0,0],p=Me().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:Ne}}var Oi=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,ki=e=>({x:e.x,y:e.y,zoom:e.k}),Ai=({x:e,y:t,zoom:n})=>Fe.translate(e,t).scale(n),ji=(e,t)=>e.target.closest(`.${t}`),Mi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Ni=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Pi=(e,t=0,n=Ni,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},Fi=e=>{let t=e.ctrlKey&&fr()?10:1;
2return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Ii({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(ji(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=Ne(u),t=d*2**Fi(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===Sn.Vertical?0:u.deltaX*f,m=i===Sn.Horizontal?0:u.deltaY*f;!fr()&&u.shiftKey&&i!==Sn.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=ki(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,s?.(u,h)),e.isPanScrolling&&(c?.(u,h),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150))}}function Li({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=ji(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function Ri({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=ki(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function zi({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&Mi(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,ki(a.transform))}}function Bi({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&Mi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i&&Oi(e.prevViewport,o.transform))){let t=ki(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function Vi({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l}){return u=>{let d=e||t,f=n&&u.ctrlKey;if(u.button===1&&u.type===`mousedown`&&(ji(u,`${l}-flow__node`)||ji(u,`${l}-flow__edge`)))return!0;if(!r&&!d&&!i&&!a&&!n||o||ji(u,s)&&u.type===`wheel`||ji(u,c)&&(u.type!==`wheel`||i&&u.type===`wheel`&&!e)||!n&&u.ctrlKey&&u.type===`wheel`)return!1;if(!n&&u.type===`touchstart`&&u.touches?.length>1)return u.preventDefault(),!1;if(!d&&!i&&!f&&u.type===`wheel`||!r&&(u.type===`mousedown`||u.type===`touchstart`)||Array.isArray(r)&&!r.includes(u.button)&&u.type===`mousedown`)return!1;let p=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||u.type===`wheel`)&&p}}function Hi({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:r,translateExtent:i,viewport:a,onPanZoom:o,onPanZoomStart:s,onPanZoomEnd:c,onDraggingChange:l}){let u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Me().clickDistance(!rr(r)||r<0?0:r).scaleExtent([t,n]).translateExtent(i),p=Ae(e).call(f);y({x:a.x,y:a.y,zoom:Wn(a.zoom,t,n)},[[0,0],[d.width,d.height]],i);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(Fi);function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Ie:ke).transform(Pi(p,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:a,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w}){r&&!u.isZoomingOrPanning&&v();let T=i&&!S&&!r?Ii({zoomPanValues:u,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:s,onPanZoom:o,onPanZoomEnd:c}):Li({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});if(p.on(`wheel.zoom`,T,{passive:!1}),!r){let e=Ri({zoomPanValues:u,onDraggingChange:l,onPanZoomStart:s});f.on(`start`,e);let t=zi({zoomPanValues:u,panOnDrag:a,onPaneContextMenu:!!n,onPanZoom:o,onTransformChange:w});f.on(`zoom`,t);let r=Bi({zoomPanValues:u,panOnDrag:a,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:c,onDraggingChange:l});f.on(`end`,r)}let E=Vi({zoomActivationKeyPressed:S,panOnDrag:a,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C});
2f.filter(E),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=Ai(e),i=f?.constrain()(r,t,n);return i&&await g(i),new Promise(e=>e(i))}async function b(e,t){let n=Ai(e);return await g(n,t),new Promise(e=>e(n))}function x(e){if(p){let t=Ai(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?Ee(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Ie:ke).scaleTo(Pi(p,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?Ie:ke).scaleBy(Pi(p,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!rr(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var Ui;(function(e){e.Line=`line`,e.Handle=`handle`})(Ui||={});function Wi({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function Gi(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function Ki(e,t){return Math.max(0,t-e)}function qi(e,t){return Math.max(0,e-t)}function Ji(e,t,n){return Math.max(0,t-e,e-n)}function Yi(e,t){return e?!t:t}function Xi(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=Ji(E,h,g),j=Ji(D,_,v);if(o){let e=0,t=0;c&&w<0?e=Ki(y+w+O,o[0][0]):!c&&w>0&&(e=qi(y+E+O,o[1][0])),l&&T<0?t=Ki(b+T+k,o[0][1]):!l&&T>0&&(t=qi(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=qi(y+w,s[0][0]):!c&&w<0&&(e=Ki(y+E,s[1][0])),l&&T>0?t=qi(b+T,s[0][1]):!l&&T<0&&(t=Ki(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=Ji(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?qi(b+k+E/C,o[1][1])*C:Ki(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?Ki(b+E/C,s[1][1])*C:qi(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=Ji(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?qi(y+D*C+O,o[1][0])/C:Ki(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?Ki(y+D*C,s[1][0])/C:qi(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(Yi(c,l)?-w:w)/C:w=(Yi(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var Zi={width:0,height:0,x:0,y:0},Qi={...Zi,pointerX:0,pointerY:0,aspectRatio:1};function $i(e){return[[0,0],[e.measured.width,e.measured.height]]}function ea(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function ta({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=Ae(e);function o({controlPosition:e,boundaries:o,keepAspectRatio:s,resizeDirection:c,onResizeStart:l,onResize:u,onResizeEnd:d,shouldResize:f}){let p={...Zi},m={...Qi},h=Gi(e),g,_=null,v=[],y,b,x,S=De().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:u,ySnapped:d}=br(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});p={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},m={...p,pointerX:u,pointerY:d,aspectRatio:p.width/p.height},y=void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId),b=y&&g.extent===`parent`?$i(y):void 0),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=ea(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}l?.(e,{...p})}).on(`drag`,e=>
2{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:l}=n(),d=br(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),S=[];if(!g)return;let{x:C,y:w,width:T,height:E}=p,D={},O=g.origin??l,{width:k,height:A,x:j,y:M}=Xi(m,h,d,o,s,O,b,x),N=k!==T,P=A!==E,F=j!==C&&N,I=M!==w&&P;if(!F&&!I&&!N&&!P)return;if((F||I||O[0]===1||O[1]===1)&&(D.x=F?j:p.x,D.y=I?M:p.y,p.x=D.x,p.y=D.y,v.length>0)){let e=j-C,t=M-w;for(let n of v)n.position={x:n.position.x-e+O[0]*(k-T),y:n.position.y-t+O[1]*(A-E)},S.push(n)}if((N||P)&&(D.width=N&&(!c||c===`horizontal`)?k:p.width,D.height=P&&(!c||c===`vertical`)?A:p.height,p.width=D.width,p.height=D.height),y&&g.expandParent){let e=O[0]*(D.width??0);D.x&&D.x<e&&(p.x=e,m.x-=D.x-e);let t=O[1]*(D.height??0);D.y&&D.y<t&&(p.y=t,m.y-=D.y-t)}let L=Wi({width:p.width,prevWidth:T,height:p.height,prevHeight:E,affectsX:h.affectsX,affectsY:h.affectsY}),R={...p,direction:L};f?.(e,R)!==!1&&(u?.(e,R),r(D,S))}).on(`end`,e=>{d?.(e,{...p}),i?.({...p})});a.call(S)}function s(){a.on(`.drag`,null)}return{update:o,destroy:s}}var q=l(),J=t(d());h();var na=(0,J.createContext)(null),ra=na.Provider,ia=_n.error001();function Y(e,t){let n=(0,J.useContext)(na);if(n===null)throw Error(ia);return Pe(n,e,t)}function X(){let e=(0,J.useContext)(na);if(e===null)throw Error(ia);return(0,J.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var aa={display:`none`},oa={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},sa=`react-flow__node-desc`,ca=`react-flow__edge-desc`,la=`react-flow__aria-live`,ua=e=>e.ariaLiveMessage,da=e=>e.ariaLabelConfig;function fa({rfId:e}){let t=Y(ua);return(0,q.jsx)(`div`,{id:`${la}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:oa,children:t})}function pa({rfId:e,disableKeyboardA11y:t}){let n=Y(da);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{id:`${sa}-${e}`,style:aa,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,q.jsx)(`div`,{id:`${ca}-${e}`,style:aa,children:n[`edge.a11yDescription.default`]}),!t&&(0,q.jsx)(fa,{rfId:e})]})}var ma=(0,J.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,q.jsx)(`div`,{className:U([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));ma.displayName=`Panel`;function ha({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,q.jsx)(ma,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev`,children:(0,q.jsx)(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ga=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},_a=e=>e.id;function va(e,t){return W(e.selectedNodes.map(_a),t.selectedNodes.map(_a))&&W(e.selectedEdges.map(_a),t.selectedEdges.map(_a))}function ya({onSelectionChange:e}){let t=X(),{selectedNodes:n,selectedEdges:r}=Y(ga,va);return(0,J.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var ba=e=>!!e.onSelectionChangeHandlers;function xa({onSelectionChange:e}){let t=Y(ba);return e||t?(0,q.jsx)(ya,{onSelectionChange:e}):null}var Sa=[0,0],Ca={x:0,y:0,zoom:1},wa=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.paneClickDistance.ariaLabelConfig`.split(`.`),`rfId`],Ta=e=>
2({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),Ea={translateExtent:vn,nodeOrigin:Sa,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`,paneClickDistance:0};function Da(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c,setPaneClickDistance:l}=Y(Ta,W),u=X();(0,J.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Ea,s()}),[]);let d=(0,J.useRef)(Ea);return(0,J.useEffect)(()=>{for(let s of wa){let c=e[s];c!==d.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`paneClickDistance`?l(c):s===`ariaLabelConfig`?u.setState({ariaLabelConfig:yr(c)}):s===`fitView`?u.setState({fitViewQueued:c}):s===`fitViewOptions`?u.setState({fitViewOptions:c}):u.setState({[s]:c}))}d.current=e},wa.map(t=>e[t])),null}function Oa(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function ka(e){let[t,n]=(0,J.useState)(e===`system`?null:e);return(0,J.useEffect)(()=>{if(e!==`system`){n(e);return}let t=Oa(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?Oa()?.matches?`dark`:`light`:t}var Aa=typeof document<`u`?document:null;function ja(e=null,t={target:Aa,actInsideInputWithModifier:!0}){let[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(!1),a=(0,J.useRef)(new Set([])),[o,s]=(0,J.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,` 3`).replace(` 4 5`,` 6+`).split(` 7`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,J.useEffect)(()=>{let n=t?.target??Aa,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&wr(e))return!1;let n=Na(e.code,s);if(a.current.add(e[n]),Ma(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=Na(e.code,s);Ma(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function Ma(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Na(e,t){return t.includes(e)?`code`:`key`}var Pa=()=>{let e=X();return(0,J.useMemo)(()=>({zoomIn:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=dr(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>
7{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return or(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=sr(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function Fa(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)Ia(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function Ia(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function La(e,t){return Fa(e,t)}function Ra(e,t){return Fa(e,t)}function za(e,t){return{id:e,type:`select`,selected:t}}function Ba(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(za(a.id,e)))}return r}function Va({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function Ha(e){return{id:e.id,type:`remove`}}var Ua=e=>Mn(e),Wa=e=>jn(e);function Ga(e){return(0,J.forwardRef)(e)}var Ka=typeof window<`u`?J.useLayoutEffect:J.useEffect;function qa(e){let[t,n]=(0,J.useState)(BigInt(0)),[r]=(0,J.useState)(()=>Ja(()=>n(e=>e+BigInt(1))));return Ka(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function Ja(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var Ya=(0,J.createContext)(null);function Xa({children:e}){let t=X(),n=qa((0,J.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s}=t.getState(),c=n;for(let t of e)c=typeof t==`function`?t(c):t;let l=Va({items:c,lookup:o});i&&r(c),l.length>0?a?.(l):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=qa((0,J.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(Va({items:s,lookup:o}))},[])),i=(0,J.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,q.jsx)(Ya.Provider,{value:i,children:e})}function Za(){let e=(0,J.useContext)(Ya);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var Qa=e=>!!e.panZoom;function $a(){let e=Pa(),t=X(),n=Za(),r=Y(Qa),i=(0,J.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=Ua(e)?e:n.get(e.id),a=i.parentId?gr(i.position,i.measured,i.parentId,n,r):i.position;return Qn({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Ua(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&Wa(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await Un({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(Ha);o?.(f),c(e)}if(m){let e=d.map(Ha);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=nr(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=tr(Qn(s?r:a),o);return n&&c>0||c>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=nr(e)?e:a(e);if(!r)return!1;let i=tr(r,t);return n&&i>0||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)}
7,getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return In(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??vr();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,J.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var eo=e=>e.selected,to=typeof window<`u`?window:void 0;function no({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=X(),{deleteElements:r}=$a(),i=ja(e,{actInsideInputWithModifier:!1}),a=ja(t,{target:to});(0,J.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(eo),edges:e.filter(eo)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,J.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function ro(e){let t=X();(0,J.useEffect)(()=>{let n=()=>{if(!e.current)return!1;let n=xr(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,_n.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var io={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},ao=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function oo({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=Sn.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y}){let b=X(),x=(0,J.useRef)(null),{userSelectionActive:S,lib:C}=Y(ao,W),w=ja(f),T=(0,J.useRef)();ro(x);let E=(0,J.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||b.setState({transform:e})},[_,v]);return(0,J.useEffect)(()=>{if(x.current){T.current=Hi({domNode:x.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,paneClickDistance:y,onDraggingChange:e=>b.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=b.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=b.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=b.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=T.current.getViewport();return b.setState({panZoom:T.current,transform:[e,t,n],domNode:x.current.closest(`.react-flow`)}),()=>{T.current?.destroy()}}},[]),(0,J.useEffect)(()=>{T.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:w,preventScrolling:p,noPanClassName:g,userSelectionActive:S,noWheelClassName:h,lib:C,onTransformChange:E})},[e,t,n,r,i,a,o,s,w,p,g,S,h,C,E]),(0,q.jsx)(`div`,{className:`react-flow__renderer`,ref:x,style:io,children:m})}var so=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function co(){let{userSelectionActive:e,userSelectionRect:t}=Y(so,W);return e&&t?(0,q.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var lo=(e,t)=>n=>{n.target===t.current&&e?.(n)},uo=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function fo({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Cn.Full,panOnDrag:r,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:o,onPaneClick:s,onPaneContextMenu:c,onPaneScroll:l,onPaneMouseEnter:u,onPaneMouseMove:d,onPaneMouseLeave:f,children:p}){let m=X(),{userSelectionActive:h,elementsSelectable:g,dragging:_,connectionInProgress:v}=Y(uo,W),y=g&&(e||h),b=(0,J.useRef)(null),x=(0,J.useRef)(),S=(0,J.useRef)(new Set),C=(0,J.useRef)(new Set),w=(0,J.useRef)(!1),T=(0,J.useRef)(!1),E=e=>{if(w.current||v){w.current=!1;return}s?.(e),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1})},D=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}c?.(e)},O=l?e=>l(e):void 0;return(0,q.jsxs)(`div`,{className:U([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:_,selection:e}]),onClick:y?void 0:lo(E,b),onContextMenu:lo(D,b),onWheel:lo(O,b),onPointerEnter:y?void 0:u,onPointerDown:y?t=>{let{resetSelectedElements:n,domNode:r}=m.getState();if(x.current=r?.getBoundingClientRect(),!g||!e||t.button!==0||t.target!==b.current||!x.current)return;t.target?.setPointerCapture?.(t.pointerId),T.current=!0,w.current=!1;let{x:i,y:o}=Er(t.nativeEvent,x.current);n(),m.setState({userSelectionRect:{width:0,height:0,startX:i,startY:o,x:i,y:o}}),a?.(t)}:d,onPointerMove:y?e=>{let{userSelectionRect:t,transform:r,nodeLookup:i,edgeLookup:a,connectionLookup:o,triggerNodeChanges:s,triggerEdgeChanges:c,defaultEdgeOptions:l}=m.getState();if(!x.current||!t)return;w.current=!0;let{x:u,y:d}=Er(e.nativeEvent,x.current),{startX:f,startY:p}=t,h={startX:f,startY:p,x:u<f?u:f,y:d<p?d:p,width:Math.abs(u-f),height:Math.abs(d-p)},g=S.current,_=C.current;
7S.current=new Set(Rn(i,h,r,n===Cn.Partial,!0).map(e=>e.id)),C.current=new Set;let v=l?.selectable??!0;for(let e of S.current){let t=o.get(e);if(t)for(let{edgeId:e}of t.values()){let t=a.get(e);t&&(t.selectable??v)&&C.current.add(e)}}_r(g,S.current)||s(Ba(i,S.current,!0)),_r(_,C.current)||c(Ba(a,C.current)),m.setState({userSelectionRect:h,userSelectionActive:!0,nodesSelectionActive:!1})}:d,onPointerUp:y?e=>{if(e.button!==0||!T.current)return;e.target?.releasePointerCapture?.(e.pointerId);let{userSelectionRect:n}=m.getState();!h&&n&&e.target===b.current&&E?.(e),m.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:S.current.size>0}),o?.(e),(t||i)&&(w.current=!1),T.current=!1}:void 0,onPointerLeave:f,ref:b,style:io,children:[p,(0,q.jsx)(co,{})]})}function po({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,_n.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function mo({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=X(),[c,l]=(0,J.useState)(!1),u=(0,J.useRef)();return(0,J.useEffect)(()=>{u.current=gi({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{po({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),(0,J.useEffect)(()=>{if(t)u.current?.destroy();else if(e.current)return u.current?.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o}),()=>{u.current?.destroy()}},[n,r,t,a,e,i]),c}var ho=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function go(){let e=X();return(0,J.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=ho(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=ar(t,i));let{position:a,positionAbsolute:s}=Hn({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var _o=(0,J.createContext)(null),vo=_o.Provider;_o.Consumer;var yo=()=>(0,J.useContext)(_o),bo=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),xo=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o,u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===xn.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function So({type:e=`source`,position:t=K.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=X(),_=yo(),{connectOnClick:v,noPanClassName:y,rfId:b}=Y(bo,W),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=Y(xo(_,m,e),W);_||g.getState().onError?.(`010`,_n.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(Lr(i,e))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=Tr(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();Ei.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||t.isValidConnection,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,q.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:U([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=Sr(t.target),h=n||c,{connection:v,isValid:y}=Ei.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var Co=(0,J.memo)(Ga(So));function wo({data:e,isConnectable:t,sourcePosition:n=K.Bottom}){return(0,q.jsxs)(q.Fragment,{children:[e?.label,(0,q.jsx)(Co,{type:`source`,position:n,isConnectable:t})]})}function To({data:e,isConnectable:t,targetPosition:n=K.Top,sourcePosition:r=K.Bottom}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Co,{type:`target`,position:n,isConnectable:t}),e?.label,(0,q.jsx)(Co,{type:`source`,position:r,isConnectable:t})]})}function Eo(){return null}function Do({data:e,isConnectable:t,targetPosition:n=K.Top}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Co,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Oo={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ko={input:wo,default:To,output:Do,group:Eo};function Ao(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var jo=e=>{let{width:t,height:n,x:r,y:i}=Ln(e.nodeLookup,{filter:e=>!!e.selected});return{width:rr(t)?t:null,height:rr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Mo({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=X(),{width:i,height:a,transformString:o,userSelectionActive:s}=Y(jo,W),c=go(),l=(0,J.useRef)(null);if((0,J.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]),mo({nodeRef:l}),s||!i||!a)return null;let u=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,q.jsx)(`div`,{className:U([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,q.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Oo,e.key)&&(e.preventDefault(),c({direction:Oo[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var No=typeof window<`u`?window:void 0,Po=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Fo({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,preventScrolling:k,onSelectionContextMenu:A,noWheelClassName:j,noPanClassName:M,disableKeyboardA11y:N,onViewportChange:P,isControlledViewport:F}){let{nodesSelectionActive:I,userSelectionActive:L}=Y(Po),R=ja(l,{target:No}),ee=ja(h,{target:No}),z=ee||w,te=ee||b,B=u&&z!==!0,ne=R||L||B;return no({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,q.jsx)(oo,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:te,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!R&&z,defaultViewport:T,translateExtent:E,minZoom:D,maxZoom:O,zoomActivationKeyCode:g,preventScrolling:k,noWheelClassName:j,noPanClassName:M,onViewportChange:P,isControlledViewport:F,paneClickDistance:s,children:(0,q.jsxs)(fo,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:z,isSelecting:!!ne,selectionMode:d,selectionKeyPressed:R,selectionOnDrag:B,children:[e,I&&(0,q.jsx)(Mo,{onSelectionContextMenu:A,noPanClassName:M,disableKeyboardA11y:N})]})})}Fo.displayName=`FlowRenderer`;var Io=(0,J.memo)(Fo),Lo=e=>t=>e?Rn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Ro(e){return Y((0,J.useCallback)(Lo(e),[e]),W)}var zo=e=>e.updateNodeInternals;function Bo(){let e=Y(zo),[t]=(0,J.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;
7t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,J.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Vo({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=X(),a=(0,J.useRef)(null),o=(0,J.useRef)(null),s=(0,J.useRef)(e.sourcePosition),c=(0,J.useRef)(e.targetPosition),l=(0,J.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,J.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,J.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,J.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Ho({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=Y(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},W),S=y.type||`default`,C=g?.[S]||ko[S];C===void 0&&(v?.(`003`,_n.error003(S)),S=`default`,C=ko.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=X(),k=hr(y),A=Vo({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=mo({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=go();if(y.hidden)return null;let N=mr(y),P=Ao(y),F=T||w||t||n||r||i,I=n?e=>n(e,{...b.userNode}):void 0,L=r?e=>r(e,{...b.userNode}):void 0,R=i?e=>i(e,{...b.userNode}):void 0,ee=a?e=>a(e,{...b.userNode}):void 0,z=o?e=>o(e,{...b.userNode}):void 0,te=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&po({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},B=t=>{if(!(wr(t.nativeEvent)||m)){if(yn.includes(t.key)&&T)po({id:e,store:O,unselect:t.key===`Escape`,nodeRef:A});else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Oo,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Oo[t.key],factor:t.shiftKey?4:1})}}},ne=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(Rn(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,q.jsx)(`div`,{className:U([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:F?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:I,onMouseMove:L,onMouseLeave:R,onContextMenu:ee,onClick:te,onDoubleClick:z,onKeyDown:D?B:void 0,tabIndex:D?0:void 0,onFocus:D?ne:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${sa}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,q.jsx)(vo,{value:e,children:(0,q.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Uo=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,no
7desFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Wo(e){let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:a}=Y(Uo,W),o=Ro(e.onlyRenderVisibleElements),s=Bo();return(0,q.jsx)(`div`,{className:`react-flow__nodes`,style:io,children:o.map(o=>(0,q.jsx)(Ho,{id:o,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,nodeClickDistance:e.nodeClickDistance,onError:a},o))})}Wo.displayName=`NodeRenderer`;var Go=(0,J.memo)(Wo);function Ko(e){return Y((0,J.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&Pr({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),W)}var qo=({color:e=`none`,strokeWidth:t=1})=>(0,q.jsx)(`polyline`,{style:{stroke:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,points:`-5,-4 0,0 -5,4`}),Jo=({color:e=`none`,strokeWidth:t=1})=>(0,q.jsx)(`polyline`,{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),Yo={[En.Arrow]:qo,[En.ArrowClosed]:Jo};function Xo(e){let t=X();return(0,J.useMemo)(()=>Object.prototype.hasOwnProperty.call(Yo,e)?Yo[e]:(t.getState().onError?.(`009`,_n.error009(e)),null),[e])}var Zo=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Xo(t);return c?(0,q.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,q.jsx)(c,{color:n,strokeWidth:o})}):null},Qo=({defaultColor:e,rfId:t})=>{let n=Y(e=>e.edges),r=Y(e=>e.defaultEdgeOptions),i=(0,J.useMemo)(()=>Zr(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,q.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,q.jsx)(`defs`,{children:i.map(e=>(0,q.jsx)(Zo,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Qo.displayName=`MarkerDefinitions`;var $o=(0,J.memo)(Qo);function es({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,J.useState)({x:1,y:0,width:0,height:0}),p=U([`react-flow__edge-textwrapper`,l]),m=(0,J.useRef)(null);return(0,J.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,q.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,q.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,q.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}es.displayName=`EdgeText`;var ts=(0,J.memo)(es);function ns({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=2
70,...u}){return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`path`,{...u,d:e,fill:`none`,className:U([`react-flow__edge-path`,u.className])}),l&&(0,q.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}),r&&rr(t)&&rr(n)?(0,q.jsx)(ts,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function rs({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===K.Left||e===K.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function is({sourceX:e,sourceY:t,sourcePosition:n=K.Bottom,targetX:r,targetY:i,targetPosition:a=K.Top}){let[o,s]=rs({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=rs({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Or({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function as(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=is({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,q.jsx)(ns,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var os=as({isInternal:!1}),ss=as({isInternal:!0});os.displayName=`SimpleBezierEdge`,ss.displayName=`SimpleBezierEdgeInternal`;function cs(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=K.Bottom,targetPosition:m=K.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=Wr({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset});return(0,q.jsx)(ns,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var ls=cs({isInternal:!1}),us=cs({isInternal:!0});ls.displayName=`SmoothStepEdge`,us.displayName=`SmoothStepEdgeInternal`;function ds(e){return(0,J.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,q.jsx)(ls,{...n,id:r,pathOptions:(0,J.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var fs=ds({isInternal:!1}),ps=ds({isInternal:!0});fs.displayName=`StepEdge`,ps.displayName=`StepEdgeInternal`;function ms(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=Rr({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,q.jsx)(ns,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var hs=ms({isInternal:!1}),gs=ms({isInternal:!0});hs.displayName=`StraightEdge`,gs.displayName=`StraightEdgeInternal`;function _s(e){return(0,J.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=K.Bottom,targetPosition:s=K.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=jr({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,q.jsx)(ns,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var vs=_s({isInternal:!1}),ys=_s({isInternal:!0});vs.displayName=`BezierEdge`,ys.displayName=`BezierEdgeInternal`;var bs={default:ys,straight:gs,step:ps,smoothstep:us,simplebezier:ss},xs={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Ss=(e,t,n)=>n===K.Left?e-t:n===K.Right?e+t:e,Cs=(e,t,n)=>n===K.Top?e-t:n===K.Bottom?e+t:e,ws=`react-flow__edgeupdater`;function Ts({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,q.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:U([ws,`${ws}-${s}`]),cx:Ss(t,r,e),cy:Cs(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function Es({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=X(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,isValidConnection:a,connectionMode:o,connectionRadius:s,lib:c,onConnectStart:p,onConnectEnd:h,cancelConnection:g,nodeLookup:_,rfId:v,panBy:y,updateConnection:b}=m.getState(),x=t.type===`target`;Ei.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:o,connectionRadius:s,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:_,isTarget:x,edgeUpdaterType:t.type,lib:c,flowId:v,cancelConnection:g,panBy:y,isValidConnection:a,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),p?.(r,i)},onConnectEnd:h,onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:b,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,q.jsxs)(q.Fragment,{children:[(e===!0||e===`source`)&&(0,q.jsx)(Ts,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,q.jsx)(Ts,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function Ds({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=Y(t=>t.edgeLookup.get(e)),b=Y(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||bs[x];S===void 0&&(_?.(`011`,_n.error011(x)),x=`default`,S=bs.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,J.useRef)(null),[D,O]=(0,J.useState)(!1),[k,A]=(0,J.useState)(!1),j=X(),{zIndex:M,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R}=Y((0,J.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return{zIndex:y.zIndex,...xs};let i=Kr({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_});return{zIndex:Nr({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect}),...i||xs}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),W),ee=(0,J.useMemo)(()=>y.markerStart?`url('#${Xr(y.markerStart,m)}')`:void 0,[y.markerStart,m]),z=(0,J.useMemo)(()=>y.markerEnd?`url('#${Xr(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||F===null||I===null)return null;let te=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},B=a?e=>{a(e,{...y})}:void 0,ne=o?e=>{o(e,{...y})}:void 0,re=s?e=>{s(e,{...y})}:void 0,V=c?e=>{c(e,{...y})}:void 0,ie=l?e=>{l(e,{...y})}:void 0;return(0,q.jsx)(`svg`,{style:{zIndex:M},children:(0,q.jsxs)(`g`,{className:U([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:te,onDoubleClick:B,onContextMenu:ne,onMouseEnter:re,onMouseMove:V,onMouseLeave:ie,onKeyDown:C?t=>{if(!v&&yn.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${ca}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,q.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:ee,markerEnd:z,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}
7),w&&(0,q.jsx)(Es,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:F,targetY:I,sourcePosition:L,targetPosition:R,setUpdateHover:O,setReconnecting:A})]})})}var Os=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function ks({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=Y(Os,W),b=Ko(t);return(0,q.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,q.jsx)($o,{defaultColor:e,rfId:n}),b.map(e=>(0,q.jsx)(Ds,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}ks.displayName=`EdgeRenderer`;var As=(0,J.memo)(ks),js=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ms({children:e}){return(0,q.jsx)(`div`,{className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:Y(js)},children:e})}function Ns(e){let t=$a(),n=(0,J.useRef)(!1);(0,J.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var Ps=e=>e.panZoom?.syncViewport;function Fs(e){let t=Y(Ps),n=X();return(0,J.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Is(e){return e.connection.inProgress?{...e.connection,to:or(e.connection.to,e.transform)}:{...e.connection}}function Ls(e){return e?t=>e(Is(t)):Is}function Rs(e){return Y(Ls(e),W)}var zs=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Bs({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=Y(zs,W);return a&&i&&c?(0,q.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,q.jsx)(`g`,{className:U([`react-flow__connection`,An(s)]),children:(0,q.jsx)(Vs,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var Vs=({style:e,type:t=Tn.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f}=Rs();if(!i)return;if(n)return(0,q.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:An(r),toNode:u,toHandle:d});let p=``,m={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Tn.Bezier:[p]=jr(m);break;case Tn.SimpleBezier:[p]=is(m);break;case Tn.Step:[p]=Wr({...m,borderRadius:0});break;case Tn.SmoothStep:[p]=Wr(m);break;default:[p]=Rr(m)}return(0,q.jsx)(`path`,{d:p,fill:`none`,className:`react-flow__connection-path`,style:e})};Vs.displayName=`ConnectionLine`;var Hs={};function Us(e=Hs){(0,J.useRef)(e),X(),(0,J.useEffect)(()=>{},[e])}function Ws(){X(),(0,J.useRef)(!1),(0,J.useEffect)(()=>{},[])}function Gs({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,zoomOnDoubleClick:R,panOnDrag:ee,onPaneClick:z,onPaneMouseEnter:te,onPaneMouseMove:B,onPaneMouseLeave:ne,onPaneScroll:re,onPaneContextMenu:V,paneClickDistance:ie,nodeClickDistance:ae,onEdgeContextMenu:oe,onEdgeMouseEnter:se,onEdgeMouseMove:ce,onEdgeMouseLeave:le,reconnectRadius:ue,onReconnect:de,onReconnectStart:H,onReconnectEnd:fe,noDragClassName:pe,noWheelClassName:me,noPanClassName:he,disableKeyboardA11y:ge,nodeExtent:_e,rfId:ve,viewport:ye,onViewportChange:be}
7){return Us(e),Us(t),Ws(),Ns(n),Fs(ye),(0,q.jsx)(Io,{onPaneClick:z,onPaneMouseEnter:te,onPaneMouseMove:B,onPaneMouseLeave:ne,onPaneContextMenu:V,onPaneScroll:re,paneClickDistance:ie,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:R,panOnScroll:F,panOnScrollSpeed:I,panOnScrollMode:L,panOnDrag:ee,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:pe,noWheelClassName:me,noPanClassName:he,disableKeyboardA11y:ge,onViewportChange:be,isControlledViewport:!!ye,children:(0,q.jsxs)(Ms,{children:[(0,q.jsx)(As,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:de,onReconnectStart:H,onReconnectEnd:fe,onlyRenderVisibleElements:T,onEdgeContextMenu:oe,onEdgeMouseEnter:se,onEdgeMouseMove:ce,onEdgeMouseLeave:le,reconnectRadius:ue,defaultMarkerColor:M,noPanClassName:he,disableKeyboardA11y:ge,rfId:ve}),(0,q.jsx)(Bs,{style:h,type:m,component:g,containerStyle:_}),(0,q.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,q.jsx)(Go,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:ae,onlyRenderVisibleElements:T,noPanClassName:he,noDragClassName:pe,disableKeyboardA11y:ge,nodeExtent:_e,rfId:ve}),(0,q.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}Gs.displayName=`GraphView`;var Ks=(0,J.memo)(Gs),qs=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d}={})=>{let f=new Map,p=new Map,m=new Map,h=new Map,g=r??t??[],_=n??e??[],v=u??[0,0],y=d??vn;di(m,h,g);let b=ni(_,f,p,{nodeOrigin:v,nodeExtent:y,elevateNodesOnSelect:!1}),x=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=dr(Ln(f,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);x=[e,t,n]}return{rfId:`1`,width:0,height:0,transform:x,nodes:_,nodesInitialized:b,nodeLookup:f,parentLookup:p,edges:g,edgeLookup:h,connectionLookup:m,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:vn,nodeExtent:y,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:xn.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...wn},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:ir,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:bn}},Js=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d})=>je((f,p)=>{async function m(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=p();t&&(await Vn({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),f({fitViewResolver:null}))}return{...qs({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a}=p(),o=ni(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0});a&&o?(m(),f({nodes:e,nodesInitialized:o,fitViewQueued:!1,fitViewOptions:void 0})):f({nodes:e,nodesInitialized:o})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=p();di(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=p();t(e),f({hasDefaultNodes:!0})}if(t){let{setEdges:e}=p();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c}=p(),{changes:l,updatedInternals:u}=ci(e,n,r,i,a,o);u&&(ti(n,r,{nodeOrigin:a,nodeExtent:o}),c?(m(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),l?.length>0&&(s&&console.log(`React Flow: trigger node changes`,l),t?.(l)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a}=p();for(let[a,o]of e){let e=i.get(a),s=!!(e?.expandParent&&e?.parentId&&o?.position),c={id:a,type:`position`,position:s?{x:Math.max(0,o.position.x),y:Math.max(0,o.position.y)}:o.position,dragging:t};s&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...o.internals.positionAbsolute,width:o.measured.width??0,height:o.measured.height??0}}),r.push(c)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=p(),a=si(n,i,e,t);r.push(...a)}a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=p();
7e?.length&&(i&&n(La(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=p();e?.length&&(i&&n(Ra(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p();if(t){i(e.map(e=>za(e,!0)));return}i(Ba(r,new Set([...e]),!0)),a(Ba(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=p();if(t){a(e.map(e=>za(e,!0)));return}a(Ba(n,new Set([...e]))),i(Ba(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=p(),s=e||r,c=t||n,l=s.map(e=>{let t=i.get(e.id);return t&&(t.selected=!1),za(e.id,!1)}),u=c.map(e=>za(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),f({translateExtent:e})},setPaneClickDistance:e=>{p().panZoom?.setClickDistance(e)},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=p();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,za(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,za(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o}=p();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(ni(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1}),f({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=p();return li({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=p();if(!o)return Promise.resolve(!1);let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...wn}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...qs()})}},Object.is);function Ys({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,children:f}){let[p]=(0,J.useState)(()=>Js({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d}));return(0,q.jsx)(ra,{value:p,children:(0,q.jsx)(Xa,{children:f})})}function Xs({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f}){return(0,J.useContext)(na)?(0,q.jsx)(q.Fragment,{children:e}):(0,q.jsx)(Ys,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,children:e})}var Zs={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function Qs({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onBeforeDelete:I,connectionMode:L,connectionLineType:R=Tn.Bezier,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:te,deleteKeyCode:B=`Backspace`,selectionKeyCode:ne=`Shift`,selectionOnDrag:re=!1,selectionMode:V=Cn.Full,panActivationKeyCode:ie=`Space`,multiSelectionKeyCode:ae=fr()?`Meta`:`Control`,zoomActivationKeyCode:oe=fr()?`Meta`:`Control`,snapToGri
7d:se,snapGrid:ce,onlyRenderVisibleElements:le=!1,selectNodesOnDrag:ue,nodesDraggable:de,autoPanOnNodeFocus:H,nodesConnectable:fe,nodesFocusable:pe,nodeOrigin:me=Sa,edgesFocusable:he,edgesReconnectable:ge,elementsSelectable:_e=!0,defaultViewport:ve=Ca,minZoom:ye=.5,maxZoom:be=2,translateExtent:xe=vn,preventScrolling:Se=!0,nodeExtent:Ce,defaultMarkerColor:we=`#b1b1b7`,zoomOnScroll:Te=!0,zoomOnPinch:Ee=!0,panOnScroll:De=!1,panOnScrollSpeed:Oe=.5,panOnScrollMode:ke=Sn.Free,zoomOnDoubleClick:Ae=!0,panOnDrag:je=!0,onPaneClick:Me,onPaneMouseEnter:Ne,onPaneMouseMove:Pe,onPaneMouseLeave:Fe,onPaneScroll:W,onPaneContextMenu:Ie,paneClickDistance:Le=0,nodeClickDistance:Re=0,children:ze,onReconnect:Be,onReconnectStart:Ve,onReconnectEnd:He,onEdgeContextMenu:Ue,onEdgeDoubleClick:We,onEdgeMouseEnter:Ge,onEdgeMouseMove:Ke,onEdgeMouseLeave:qe,reconnectRadius:Je=10,onNodesChange:Ye,onEdgesChange:Xe,noDragClassName:Ze=`nodrag`,noWheelClassName:Qe=`nowheel`,noPanClassName:$e=`nopan`,fitView:et,fitViewOptions:tt,connectOnClick:nt,attributionPosition:rt,proOptions:it,defaultEdgeOptions:at,elevateNodesOnSelect:ot,elevateEdgesOnSelect:st,disableKeyboardA11y:ct=!1,autoPanOnConnect:lt,autoPanOnNodeDrag:ut,autoPanSpeed:dt,connectionRadius:ft,isValidConnection:pt,onError:mt,style:ht,id:gt,nodeDragThreshold:_t,connectionDragThreshold:vt,viewport:yt,onViewportChange:bt,width:xt,height:St,colorMode:Ct=`light`,debug:wt,onScroll:Tt,ariaLabelConfig:Et,...Dt},Ot){let kt=gt||`1`,At=ka(Ct),jt=(0,J.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Tt?.(e)},[Tt]);return(0,q.jsx)(`div`,{"data-testid":`rf__wrapper`,...Dt,onScroll:jt,style:{...ht,...Zs},ref:Ot,className:U([`react-flow`,i,At]),id:gt,role:`application`,children:(0,q.jsxs)(Xs,{nodes:e,edges:t,width:xt,height:St,fitView:et,fitViewOptions:tt,minZoom:ye,maxZoom:be,nodeOrigin:me,nodeExtent:Ce,children:[(0,q.jsx)(Ks,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:R,connectionLineStyle:ee,connectionLineComponent:z,connectionLineContainerStyle:te,selectionKeyCode:ne,selectionOnDrag:re,selectionMode:V,deleteKeyCode:B,multiSelectionKeyCode:ae,panActivationKeyCode:ie,zoomActivationKeyCode:oe,onlyRenderVisibleElements:le,defaultViewport:ve,translateExtent:xe,minZoom:ye,maxZoom:be,preventScrolling:Se,zoomOnScroll:Te,zoomOnPinch:Ee,zoomOnDoubleClick:Ae,panOnScroll:De,panOnScrollSpeed:Oe,panOnScrollMode:ke,panOnDrag:je,onPaneClick:Me,onPaneMouseEnter:Ne,onPaneMouseMove:Pe,onPaneMouseLeave:Fe,onPaneScroll:W,onPaneContextMenu:Ie,paneClickDistance:Le,nodeClickDistance:Re,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:F,onReconnect:Be,onReconnectStart:Ve,onReconnectEnd:He,onEdgeContextMenu:Ue,onEdgeDoubleClick:We,onEdgeMouseEnter:Ge,onEdgeMouseMove:Ke,onEdgeMouseLeave:qe,reconnectRadius:Je,defaultMarkerColor:we,noDragClassName:Ze,noWheelClassName:Qe,noPanClassName:$e,rfId:kt,disableKeyboardA11y:ct,nodeExtent:Ce,viewport:yt,onViewportChange:bt}),(0,q.jsx)(Da,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:de,autoPanOnNodeFocus:H,nodesConnectable:fe,nodesFocusable:pe,edgesFocusable:he,edgesReconnectable:ge,elementsSelectable:_e,elevateNodesOnSelect:ot,elevateEdgesOnSelect:st,minZoom:ye,maxZoom:be,nodeExtent:Ce,onNodesChange:Ye,onEdgesChange:Xe,snapToGrid:se,snapGrid:ce,connectionMode:L,translateExtent:xe,connectOnClick:nt,defaultEdgeOptions:at,fitView:et,fitViewOptions:tt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,
7noPanClassName:$e,nodeOrigin:me,rfId:kt,autoPanOnConnect:lt,autoPanOnNodeDrag:ut,autoPanSpeed:dt,onError:mt,connectionRadius:ft,isValidConnection:pt,selectNodesOnDrag:ue,nodeDragThreshold:_t,connectionDragThreshold:vt,onBeforeDelete:I,paneClickDistance:Le,debug:wt,ariaLabelConfig:Et}),(0,q.jsx)(xa,{onSelectionChange:k}),ze,(0,q.jsx)(ha,{proOptions:it,position:rt}),(0,q.jsx)(pa,{rfId:kt,disableKeyboardA11y:ct})]})})}var $s=Ga(Qs),ec=_n.error014();function tc({id:e,handleType:t,handleId:n,onConnect:r,onDisconnect:i}={}){let a=yo(),o=e??a;if(!o)throw Error(ec);let s=(0,J.useRef)(null),c=Y(e=>e.connectionLookup.get(`${o}${t?n?`-${t}-${n}`:`-${t}`:``}`),On);return(0,J.useEffect)(()=>{if(s.current&&s.current!==c){let e=c??new Map;kn(s.current,e,i),kn(e,s.current,r)}s.current=c??new Map},[c,r,i]),(0,J.useMemo)(()=>Array.from(c?.values()??[]),[c])}function nc({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,q.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:U([`react-flow__background-pattern`,n,r])})}function rc({radius:e,className:t}){return(0,q.jsx)(`circle`,{cx:e,cy:e,r:e,className:U([`react-flow__background-pattern`,`dots`,t])})}var ic;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(ic||={});var ac={[ic.Dots]:1,[ic.Lines]:1,[ic.Cross]:6},oc=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sc({id:e,variant:t=ic.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,J.useRef)(null),{transform:f,patternId:p}=Y(oc,W),m=r||ac[t],h=t===ic.Dots,g=t===ic.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,q.jsxs)(`svg`,{className:U([`react-flow__background`,l]),style:{...c,...io,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,q.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,q.jsx)(rc,{radius:y/2,className:u}):(0,q.jsx)(nc,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,q.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}sc.displayName=`Background`;var cc=(0,J.memo)(sc);function lc(){return(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,q.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function uc(){return(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,q.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function dc(){return(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,q.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function fc(){return(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,q.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function pc(){return(0,q.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,q.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function mc({children:e,className:t,...n}){return(0,q.jsx)(`button`,{type:`button`,className:U([`react-flow__controls-button`,t]),...n,children:e})}var hc=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function gc({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=X(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=Y(hc,W),{zoomIn:y,zoomOut:b,fitView:x}=$a();return(0,q.jsxs)(ma,{className:U([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(mc,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,q.jsx)(lc,{})}),(0,q.jsx)(mc,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,q.jsx)(uc,{})})]}
7),n&&(0,q.jsx)(mc,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,q.jsx)(dc,{})}),r&&(0,q.jsx)(mc,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,q.jsx)(pc,{}):(0,q.jsx)(fc,{})}),u]})}gc.displayName=`Controls`;var _c=(0,J.memo)(gc);function vc({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,q.jsx)(`rect`,{className:U([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var yc=(0,J.memo)(vc),bc=e=>e.nodes.map(e=>e.id),xc=e=>e instanceof Function?e:()=>e;function Sc({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=yc,onClick:o}){let s=Y(bc,W),c=xc(t),l=xc(e),u=xc(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,q.jsx)(q.Fragment,{children:s.map(e=>(0,q.jsx)(wc,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function Cc({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=Y(t=>{let{internals:n}=t.nodeLookup.get(e),r=n.userNode,{x:i,y:a}=n.positionAbsolute,{width:o,height:s}=mr(r);return{node:r,x:i,y:a,width:o,height:s}},W);return!l||l.hidden||!hr(l)?null:(0,q.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var wc=(0,J.memo)(Cc),Tc=(0,J.memo)(Sc),Ec=200,Dc=150,Oc=e=>!e.hidden,kc=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?er(Ln(e.nodeLookup,{filter:Oc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},Ac=`react-flow__minimap-desc`;function jc({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=10,offsetScale:b=5}){let x=X(),S=(0,J.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=Y(kc,W),j=e?.width??Ec,M=e?.height??Dc,N=C.width/j,P=C.height/M,F=Math.max(N,P),I=F*j,L=F*M,R=b*F,ee=C.x-(I-C.width)/2-R,z=C.y-(L-C.height)/2-R,te=I+R*2,B=L+R*2,ne=`${Ac}-${T}`,re=(0,J.useRef)(0),V=(0,J.useRef)();re.current=F,(0,J.useEffect)(()=>{if(S.current&&E)return V.current=Di({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>re.current}),()=>{V.current?.destroy()}},[E]),(0,J.useEffect)(()=>{V.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let ie=p?e=>{let[t,n]=V.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ae=m?(0,J.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,oe=_??A[`minimap.ariaLabel`];return(0,q.jsx)(ma,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*F:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:U([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,q.jsxs)(`svg`,{width:j,height:M,viewBox:`${ee} ${z} ${te} ${B}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ne,ref:S,onClick:ie,children:[oe&&(0,q.jsx)(`title`,{id:ne,children:oe}),(0,q.jsx)(Tc,{onClick:ae,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,q.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${ee-R},${z-R}h${te+R*2}v${B+R*2}h${-te-R*2}z 8 M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}jc.displayName=`MiniMap`,(0,J.memo)(jc);var Mc=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,Nc={[Ui.Line]:`right`,[Ui.Handle]:`bottom-right`};function Pc({nodeId:e,position:t,variant:n=Ui.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l
8=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=yo(),y=typeof e==`string`?e:v,b=X(),x=(0,J.useRef)(null),S=n===Ui.Handle,C=Y((0,J.useCallback)(Mc(S&&p),[S,p]),W),w=(0,J.useRef)(null),T=t??Nc[n];return(0,J.useEffect)(()=>{if(!(!x.current||!y))return w.current||=ta({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=si([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...gr({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,q.jsx)(`div`,{className:U([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,J.memo)(Pc);var Fc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function Ic(e){return typeof e==`string`&&Fc.test(e)}var Lc=[];for(let e=0;e<256;++e)Lc.push((e+256).toString(16).slice(1));function Rc(e,t=0){return(Lc[e[t+0]]+Lc[e[t+1]]+Lc[e[t+2]]+Lc[e[t+3]]+`-`+Lc[e[t+4]]+Lc[e[t+5]]+`-`+Lc[e[t+6]]+Lc[e[t+7]]+`-`+Lc[e[t+8]]+Lc[e[t+9]]+`-`+Lc[e[t+10]]+Lc[e[t+11]]+Lc[e[t+12]]+Lc[e[t+13]]+Lc[e[t+14]]+Lc[e[t+15]]).toLowerCase()}var zc,Bc=new Uint8Array(16);function Vc(){if(!zc){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);zc=crypto.getRandomValues.bind(crypto)}return zc(Bc)}var Hc={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Uc(e,t,n){if(Hc.randomUUID&&!t&&!e)return Hc.randomUUID();e||={};let r=e.random??e.rng?.()??Vc();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Rc(r)}var Wc=t(Te(),1),{useDebugValue:Gc}=J.default,{useSyncExternalStoreWithSelector:Kc}=Wc.default,qc=e=>e;function Jc(e,t=qc,n){let r=Kc(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Gc(r),r}var Yc=e=>{let t=typeof e==`function`?Oe(e):e,n=(e,n)=>Jc(t,e,n);return Object.assign(n,t),n},Xc=e=>e?Yc(e):Yc,Zc=(e,t,n)=>(r,i)=>({pastStates:n?.pastStates||[],futureStates:n?.futureStates||[],undo:(a=1)=>{if(i().pastStates.length){let o=n?.partialize?.(t())||t(),s=i().pastStates.splice(-a,a),c=s.shift();e(c),r({pastStates:i().pastStates,futureStates:i().futureStates.concat(n?.diff?.(o,c)||o,s.reverse())})}},redo:(a=1)=>{if(i().futureStates.length){let o=n?.partialize?.(t())||t(),s=i().futureStates.splice(-a,a),c=s.shift();e(c),r({pastStates:i().pastStates.concat(n?.diff?.(o,c)||o,s.reverse()),futureStates:i().futureStates})}},clear:()=>r({pastStates:[],futureStates:[]}),isTracking:!0,pause:()=>r({isTracking:!1}),resume:()=>r({isTracking:!0}),setOnSave:e=>r({_onSave:e}),_onSave:n?.onSave,_handleSet:(e,t,a,o)=>{n?.limit&&i().pastStates.length>=n?.limit&&i().pastStates.shift(),i()._onSave?.(e,a),r({pastStates:i().pastStates.concat(o||e),futureStates:[]})}}),Qc=(e,t)=>(n,r,i)=>{i.temporal=Oe(t?.wrapTemporal?.(Zc(n,r,t))||Zc(n,r,t));let a=t?.handleSet?.(i.temporal.getState()._handleSet)||i.temporal.getState()._handleSet,o=e=>{if(!i.temporal.getState().isTracking)return;let n=t?.partialize?.(r())||r(),o=t?.diff?.(e,n);o===null||t?.equality?.(e,n)||a(e,void 0,n,o)},s=i.setState;return i.setState=(...e)=>{let n=t?.partialize?.(r())||r();s(...e),o(n)},e((...e)=>{let i=t?.partialize?.(r())||r();n(...e),o(i)},r,i)},$c=[{value:`abap`,label:`ABAP`,extensions:[`.abap`]},{value:`ada`,label:`ADA`,extensions:[`.ada`,`.adb`,`.ads`]},{value:`aes`,label:`AES - Advanced Encryption Standard`,extensions:[`.aes`]},{value:`apex`,label:`Apex`,extensions:[`.cls`]},{value:`azcli`,label:`Azure CLI`,extensions:[`.azcli`]},{value:`bat`,label:`BAT`,extensions:[`.bat`,`.cmd`]}
8,{value:`bicep`,label:`Bicep`,extensions:[`.bicep`]},{value:`c`,label:`C`,extensions:[`.c`,`.h`]},{value:`csharp`,label:`C#`,extensions:[`.cs`]},{value:`cpp`,label:`C++`,extensions:[`.cpp`,`.cc`,`.cxx`,`.h`,`.hh`,`.hpp`,`.hxx`]},{value:`cameligo`,label:`Cameligo`,extensions:[`.mligo`]},{value:`clojure`,label:`Clojure`,extensions:[`.clj`,`.cljs`,`.cljc`,`.edn`]},{value:`cobol`,label:`COBOL`,extensions:[`.cob`,`.cbl`]},{value:`coffeescript`,label:`CoffeeScript`,extensions:[`.coffee`]},{value:`csp`,label:`CSP`,extensions:[`.csp`]},{value:`css`,label:`CSS`,extensions:[`.css`]},{value:`csv`,label:`CSV`,extensions:[`.csv`]},{value:`d`,label:`D`,extensions:[`.d`]},{value:`dart`,label:`Dart`,extensions:[`.dart`]},{value:`dockerfile`,label:`Dockerfile`,extensions:[`.dockerfile`]},{value:`ecl`,label:`ECL`,extensions:[`.ecl`]},{value:`elixir`,label:`Elixir`,extensions:[`.ex`,`.exs`]},{value:`erlang`,label:`Erlang`,extensions:[`.erl`,`.hrl`]},{value:`fsharp`,label:`F#`,extensions:[`.fs`,`.fsi`,`.ml`,`.mli`]},{value:`flow9`,label:`Flow 9`,extensions:[`.flow`]},{value:`fortran`,label:`Fortran`,extensions:[`.f90`,`.f`,`.for`,`.f77`]},{value:`freemarker2`,label:`Freemarker 2`,extensions:[`.ftl`]},{value:`go`,label:`GO`,extensions:[`.go`]},{value:`graphql`,label:`GraphQL`,extensions:[`.graphql`,`.gql`]},{value:`groovy`,label:`Groovy`,extensions:[`.groovy`,`.gvy`,`.gy`,`.gsh`]},{value:`handlebars`,label:`Handlebars`,extensions:[`.handlebars`,`.hbs`]},{value:`haskell`,label:`Haskell`,extensions:[`.hs`]},{value:`hcl`,label:`HCL`,extensions:[`.hcl`,`.tf`]},{value:`html`,label:`HTML`,extensions:[`.html`,`.htm`]},{value:`ini`,label:`INI`,extensions:[`.ini`]},{value:`java`,label:`Java`,extensions:[`.java`]},{value:`javascript`,label:`JavaScript`,extensions:[`.js`,`.mjs`,`.jsx`]},{value:`json`,label:`JSON`,extensions:[`.json`]},{value:`julia`,label:`Julia`,extensions:[`.jl`]},{value:`kotlin`,label:`Kotlin`,extensions:[`.kt`,`.kts`]},{value:`less`,label:`LESS`,extensions:[`.less`]},{value:`lexon`,label:`Lexon`,extensions:[`.lex`]},{value:`liquid`,label:`Liquid`,extensions:[`.liquid`]},{value:`lua`,label:`Lua`,extensions:[`.lua`]},{value:`m3`,label:`M3`,extensions:[`.m3`]},{value:`markdown`,label:`Markdown`,extensions:[`.md`]},{value:`msdax`,label:`Microsoft DAX`,extensions:[`.dax`]},{value:`mips`,label:`MIPS Assembly Language`,extensions:[`.asm`]},{value:`mysql`,label:`MySQL`,extensions:[`.sql`]},{value:`objective-c`,label:`Objective-C`,extensions:[`.m`,`.h`]},{value:`ocaml`,label:`OCAML`,extensions:[`.ml`,`.mli`]},{value:`octave`,label:`Octave`,extensions:[`.m`]},{value:`pascal`,label:`Pascal`,extensions:[`.pas`,`.pp`]},{value:`pascaligo`,label:`Pascaligo`,extensions:[`.ligo`]},{value:`perl`,label:`Perl`,extensions:[`.pl`,`.pm`]},{value:`php`,label:`PHP`,extensions:[`.php`]},{value:`pla`,label:`PLA`,extensions:[`.pla`]},{value:`plaintext`,label:`Plain Text`,extensions:[`.txt`]},{value:`pgsql`,label:`PostgreSQL`,extensions:[`.sql`]},{value:`postiats`,label:`Postiats`,extensions:[`.dats`,`.sats`,`.hats`]},{value:`powerquery`,label:`Power Query`,extensions:[`.pq`]},{value:`powershell`,label:`PowerShell`,extensions:[`.ps1`,`.psm1`,`.psd1`]},{value:`proto`,label:`Proto`,extensions:[`.proto`]},{value:`pug`,label:`PUG`,extensions:[`.pug`]},{value:`python`,label:`Python`,extensions:[`.py`]},{value:`qsharp`,label:`Q#`,extensions:[`.qs`]},{value:`r`,label:`R`,extensions:[`.r`]},{value:`racket`,label:`Racket`,extensions:[`.rkt`]},{value:`razor`,label:`Razor`,extensions:[`.cshtml`]},{value:`redis`,label:`Redis`,extensions:[`.redis`]},{value:`redshift`,label:`Redshift`,extensions:[`.sql`]},{value:`rego`,label:`Rego`,extensions:[`.rego`]},{value:`restructuredtext`,label:`Restructured Text`,extensions:[`.rst`]},{value:`ruby`,label:`Ruby`,extensions:[`.rb`]},{value:`rust`,label:`Rust`,extensions:[`.rs`]},{value:`sb`,label:`SB`,extensions:[`.sb`]},{value:`sbcl`,label:`SBCL`,extensions:[`.lisp`]},{value:`scala`,label:`Scala`,extensions:[`.scala`]},{value:`scheme`,label:`Scheme`,extensions:[`.scm`]},{value:`scss`,label:`SCSS`,extensions:[`.scss`]},{value:`shell`,label:`Shell`,extensions:[`.sh`]},{value:`sol`,label:`SOL`,extensions:[`.sol`]},{value:`sparql`,label:`SPARQL`,extensions:[`.rq`]},{value:`sql`,label:`SQL`,extensions:[`.sql`]},{value:`st`,label:`ST`,extensions:[`.st`]},{value:`swift`,label:`Swift`,extensions:[`.swift`]},{value:`systemverilog`,label:`System Verilog`,extensions:[`.sv`]},{value:`tcl`,label:`TCL`,extensions:[`.tcl`]},{value:`twig`,label:`Twig`,extensions:[`.twig`]},{value:`typescript`,label:`TypeScript`,extensions:[`.ts`,`.tsx`]},{value:`vb`,label:`VB`,extensions:[`.vb`]},{value:`verilog`,label:`Verilog`,extensions:[`.v`]},{value:`xml`,label:`XML`,extensions:[`.xml`]},{value:`yaml`,label:`YAML`,extensions:[`.yaml`,`.yml`]}],el=f.code` 9 background-color: var(--light-500); 10 padding: 4px; 11 border-radius: 2px; 12`,tl=f.code` 13 background: ${c.color.light[500]}; 14 border-radius: 6px; 15 overflow: hidden; 16 17 .highlighter { 18 margin: 0 !important; 19 } 20 21 code { 22 font-size: 13px !important; 23 font-family: Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace !important; 24 background-color: transparent !important; 25 26 .linenumber { 27 color: ${c.color.light.contrastText} !important; 28 opacity: 0.6;
29 min-width: 20px !important; 30 } 31 } 32 33 .header-code { 34 display: flex; 35 flex-direction: row; 36 justify-content: space-between; 37 background: ${c.color.light[600]}; 38 padding: 4px 6px; 39 border-top-left-radius: 6px; 40 border-top-right-radius: 6px; 41 42 .action-bar { 43 display: flex; 44 flex-direction: row; 45 46 button { 47 background: transparent; 48 border: none; 49 opacity: 0.75; 50 transition: opacity 0.2s; 51 52 &:hover { 53 opacity: 1; 54 } 55 } 56 } 57 } 58 59 &.light { 60 border: 1px solid rgb(221, 221, 221); 61 62 > div { 63 border: none !important; 64 } 65 66 .action-bar { 67 background: rgba(0, 0, 0, 0.1); 68 } 69 } 70`,nl={userSelect:`none`},rl=({className:e,onInsertCode:t,onNewFile:n,onCopyCode:r,language:i,children:a,showActionBar:o,showLineNumbers:c=!0,...l})=>{let d=g(ol),f=u(),[p,m]=(0,J.useState)(c),h=/language-(\w+)/.exec(e||``),_=i??(h??[])[1]?.toLowerCase()??`txt`,v=String(a??``).replaceAll(/\n\t/g,` 71`).trim(),y=$c.find(e=>e.value===_)?.extensions?.[0]??`.txt`;function b(){t?.(v,_)}function x(){n?.(v,_)}function S(){r?.(v,_),al(v)}return a===void 0?(0,q.jsx)(q.Fragment,{}):_===`txt`?(0,q.jsx)(el,{...l,className:e,children:a}):(0,q.jsxs)(tl,{className:[`code-box`,f,e].join(` `),children:[o&&(0,q.jsxs)(`div`,{className:`header-code`,children:[(0,q.jsx)(`div`,{children:(0,q.jsx)(s,{appearance:`code2`,children:_??``})}),(0,q.jsxs)(`div`,{className:`action-bar`,role:`toolbar`,children:[(0,q.jsx)(R,{"aria-label":p?d.hideLines:d.showLines,title:p?d.hideLines:d.showLines,onClick:()=>m(e=>!e),style:{position:`relative`,transform:p?void 0:`rotate(180deg)`,transition:`transform 0.2s`},children:(0,q.jsx)(ee,{})}),(0,q.jsx)(R,{"aria-label":d.downloadCode,title:d.downloadCode,onClick:()=>{try{let e=`download${y}`,t=new Blob([v],{type:`text/plain;charset=utf-8`}),n=document.createElement(`a`);n.href=URL.createObjectURL(t),n.download=e,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(n.href)}catch(e){console.error(d.downloadError,e)}},children:(0,q.jsx)(A,{})}),(0,q.jsx)(R,{"aria-label":d.copy,title:d.copy,onClick:S,style:{position:`relative`},children:(0,q.jsx)(L,{})}),t?(0,q.jsx)(R,{"aria-label":d.insert,title:d.insert,onClick:b,style:{position:`relative`},children:(0,q.jsx)(z,{style:{transform:`rotate(90deg)`}})}):null,n?(0,q.jsx)(R,{"aria-label":d.newFile,title:d.newFile,onClick:x,style:{position:`relative`},children:(0,q.jsx)(D,{})}):null]})]}),(0,q.jsx)(`div`,{children:(0,q.jsx)(me,{...l,className:`highlighter`,style:f===`dark`?ge:he,language:_,PreTag:`div`,showLineNumbers:p,lineNumberContainerStyle:nl,lineNumberStyle:nl,children:v})})]})};function il(e){let t=document.createElement(`input`);t.value=e,t.style.position=`absolute`,t.style.left=`-99999px`,document.body.appendChild(t),t.select();try{document.execCommand(`copy`)}catch{}finally{document.body.removeChild(t)}}async function al(e){try{await navigator.clipboard.writeText(e)}catch{il(e)}}var ol={en:{copy:`Copy code to the clipboard`,insert:`Inject code into editor`,newFile:`Creates a new file with this code as its content`,hideLines:`Hide line numbers`,showLines:`Show line numbers`,downloadCode:`Download the code`,downloadError:`Error downloading code`},pt:{copy:`Copiar código para a área de transferência`,insert:`Inserir código no editor`,newFile:`Criar um novo arquivo com este código como conteúdo`,hideLines:`Esconder números das linhas`,showLines:`Mostrar números das linhas`,downloadCode:`Fazer download do código`,downloadError:`Erro ao fazer download do código`}},sl=(e,t)=>(0,q.jsx)(J.Fragment,{children:typeof e==`string`?e.split(` 72`).map((e,t,n)=>(0,q.jsxs)(J.Fragment,{children:[e,t<n.length-1?(0,q.jsx)(`br`,{}):null]},t)):e},t),cl=({onNewFile:e,onCopyCode:t,children:n,key:r,...i})=>(0,q.jsx)(Le,{remarkPlugins:[[Re]],components:{code:n=>(0,J.createElement)(rl,{...n,...i,key:r,onNewFile:e,onCopyCode:t,showActionBar:i.showActionBar??!0}),pre:({children:e})=>(0,q.jsx)(q.Fragment,{children:e}),p:({children:e})=>(0,q.jsx)(`p`,{children:J.Children.map(e,sl)}),h3:({children:e})=>(0,q.jsx)(s,{appearance:`h4`,children:e}),li:({children:e})=>(0,q.jsx)(`p`,{children:e})},children:n},r),ll={start:`warning`,end:`success`,error:`danger`,unknown:`light`},ul=f(v)` 73 gap: 10px; 74 75 .output-info { 76 flex: 1; 77 align-items: start; 78 gap: 4px; 79 } 80 81 .code-box { 82 border: 1px solid ${c.color.light[500]}; 83 height: 100%; 84 background-color: ${c.color.light[300]}; 85 86 .header-code { 87 background-color: ${c.color.light[300]}; 88 color: ${c.color.light[700]}; 89 } 90 91 .highlighter { 92 background-color: ${c.color.light[300]} !important; 93 } 94 } 95`,dl=({node:e})=>{let t=g(gl),n=e.data.try?.statusResult?.toLowerCase()??`unknown`,r=e.data.try?.started,{formatDateWithTime:i}=le(),a=e.data.try?.result?JSON.stringify(e.data.try?.result):``;return(0,q.jsxs)(S,{gap:12,children:[(0,q.jsx)(y,{weight:500,children:t.outputData}),(0,q.jsxs)(v,{children:[(0,q.jsxs)(S,{className:`output-info`,children:[(0,q.jsx)(y,{color:`light.700`,children:`Status`}),(0,q.jsx)(_,{colorScheme:ll[n],children:t[n]})]}),e.data.try?.statusResult!==`ERROR`&&r&&(0,q.jsxs)(S,{className:`output-info`,children:[(0,q.jsx)(y,{color:`light.700`,children:t.processedAt}),(0,q.jsx)(y,{children:i(r)})]})]}),(0,q.jsx)(cl,{children:["```python",a??``,"```"].join(` 96`)})]})},fl=e=>{try{return new URL(e),!0}catch{return!1}},pl=({node:e})=>{let[t,n]=(0,J.useState)(),[r,i]=(0,J.useState)(!1),a=e.data.try?.logs,o=async()=>
96{if(a&&fl(a)){i(!0);try{let e=await fetch(a);if(!e.ok)throw Error(`Error downloading log, ${e}`);n(await e.text())}catch(e){console.log(e)}finally{i(!1)}}};return(0,J.useEffect)(()=>{o()},[a]),r?(0,q.jsx)(oe,{}):(0,q.jsx)(ml,{$maxHeight:`65vh`,children:(0,q.jsx)(cl,{children:["```raw",t??a??``,"```"].join(` 97`)})})},ml=f(S)` 98 .highlighter { 99 max-height: ${e=>e.$maxHeight||`80vh`}; 100 } 101`,hl=({node:e})=>{let t=g(gl),n=e.data.try?.duration;return(0,q.jsxs)(ul,{alignItems:`stretch`,children:[(0,q.jsx)(ml,{w:`49%`,children:(0,q.jsx)(cl,{children:["```python",e.data.step?.script??``,"```"].join(` 102`)})}),(0,q.jsx)(b,{direction:`vertical`}),(0,q.jsxs)(S,{gap:12,w:`49%`,children:[(0,q.jsxs)(T,{bgLevel:500,p:5,gap:10,children:[(0,q.jsxs)(v,{gap:8,children:[(0,q.jsx)(C,{icon:`Clock`,color:`blue.300`}),(0,q.jsx)(y,{color:`light.700`,appearance:`microtext1`,children:t.executionTime})]}),(0,q.jsx)(y,{children:n&&n>0?n:`-`})]}),(0,q.jsx)(w,{tabs:[{key:`output`,label:t.output,content:(0,q.jsx)(dl,{node:e})},{key:`console`,label:t.consoleOutput,content:(0,q.jsx)(pl,{node:e})}]})]})]})},gl={en:{executionTime:`Execution time`,output:`Output`,outputData:`Output data`,consoleOutput:`Console output`,start:`Running`,end:`Success`,error:`Failed`,unknown:`Unknown`,processedAt:`Processed at`},pt:{executionTime:`Tempo de execução`,output:`SaÃda`,outputData:`Dados de saÃda`,consoleOutput:`SaÃda do console`,start:`Executando`,end:`Sucesso`,error:`Falhou`,unknown:`Desconhecido`,processedAt:`Processado em`}},_l={en:{modalInfoTitle:`Quick Command Information`,modalInfoDescription:`Fill in the fields with your Quick Command information.`,name:`Name`,command:`Command`,description:`Description`,modalWebRequestTitle:`Web request`,modalWebRequestDescription:`Configure the fields for the Web Request to function.`,modalPromptTitle:`Prompt`,modalPromptDescription:`Write a prompt, link Knowledge Sources, and Agents.`,customPrompt:`Prompt`,knowledgeSource:`Knowledge Source`,agents:`Agents`,agent:`Agent`,selectAgent:`Select the Agent`,selectAgentDescription:`They will be consulted when the user utilizes this prompt.`,agentsAccountFilter:`Account`,agentsPersonalFilter:`Personal`,agentsSharedFilter:`Shared`,agentsListError:`Unable to list agents`,knowledgeSourceDescription:`Select the Knowledge Sources`,knowledgeSourceDetail:`They will be consulted when the user utilizes this prompt.`,unableToListKnowledgeSources:`Unable to list Knowledge Sources`,viewKO:`View `,koList:`Knowledge objects list`,modalEndTitle:`Quick Command Utilization`,modalEndDescription:`Customize how the user will interact with your Quick Command in the IDE.`,back:`Back`,finish:`Finish`,defaultFinalResult:`The Quick Command was successfully executed.`,finishFlow:`Finish`,start:`Start`,conditional:`Conditional`,replaceOption:`Replace the selected code`,aboveOption:`Above the selected code`,belowOption:`Below the selected code`,popoverTitleChatContext:`Chat Context`,popoverContentChatContext:`Chat history: This advanced feature uses Quick Command history to improve your experience in chat sessions. When 'Use Chat Context' is turned on, StackSpot AI considers past interactions to make conversations more efficient.`,popoverLinkText:`View Documentation`,account:`Account`,personal:`Personal`,workspaces:`Workspaces`,fieldWithInvalidValue:`There is incorrect information in the $type step.`,messageRequiredFieldEmpty:`There are mandatory fields that have not been filled out in the $type step.`,messageFieldType:`Quick Command Utilization `,confirmTryTitle:`Save and Try`,confirmTrySubTitle:`To test this quick command, you need to save it first. Would you like to save it now?`,confirmTryButtonConfirm:`Save and Try`,confirmBackTitle:`Save changes before leaving?`,confirmBackSubTitle:`You are about to leave the page of a Quick Command. Do you want to save your changes or discard them?`,confirmBackButtonConfirm:`Save`,confirmBackButtonCancel:`Discard`,try:`Try`,stackspotCodegenDescription:`The StackSpot CodeGen is an advanced artificial intelligence agent designed to optimize and accelerate software development. Integrated directly into your integrated development environment, StackSpot CodeGen offers real-time code suggestions, helping developers write high-quality code more efficiently. StackSpot CodeGen contextualizes your development needs to provide the best answers and code suggestions.`,unableToValidateSlug:`Unable to validate Slug.`,interfaceOption:`Interface`,
102interfaceDescription:`When selecting the Interface option, when the user gives the command, the content will be generated in the sidebar of the StackSpot AI extension.`,codeOption:`Code`,codeDescription:`When selecting the Code option, when the user gives the command, the content will be pasted directly into the code.`,codeInsertionLabel:`How will the code be inserted?`,route:`Route`,routeDefaultErrorMessage:`Error message default`,customInputInvalid:`Custom input $slug is invalid. Check if it has both question and slug.`,popoverTitleContextSharing:`Step Context Sharing`,popoverContentContextSharing:`When enabled, the context of the steps is shared automatically. When disabled, only explicit references using Jinja will have access to the context of other steps.`,tooltipPreserveConversation:`Disable Context Sharing to use Preserve Conversation`,tooltipContextBetweenSteps:`Disable Preserve Conversation to use Context Sharing`,scriptExecution:`Script Execution`,executionResult:`Execution result`,slugChangedInJinja:`We found the slug you've just changed in a jinja expression in end node. Please check your jinjas expressions`,totalObjects:`Total number of objects`,preserveConversation:`Use chat context`,shareContextBetweenSteps:`Step Context Sharing`,agentDetails:`Agent details`,quickCommand:`Quick Command`,parallelStart:`Start Parallel Execution`,parallelEnd:`Finish Parallel Execution`,tryNotAvailableTitle:`Action not available in Quick Command`,tryNotAvailableDescription:`The option to execute Quick Command with parallel steps is not available for the Try functionality.`,continue:`Continue`,singleNode:`Creating a parallel with a single internal node is not allowed`,invalidPath:`At least one parallel path is not finishing in a parallel end node`,closeModal:`Close modal`},pt:{modalInfoTitle:`Informação Quick Command`,modalInfoDescription:`Preencha os campos com as informações do seu Quick Command.`,name:`Nome`,command:`Comando`,description:`Descrição`,modalWebRequestTitle:`Requisições Web`,modalWebRequestDescription:`Configure os campos da Requisição Web.`,modalPromptTitle:`Prompt`,modalPromptDescription:`Escreva um prompt, vincule Knowledge Sources e Agentes.`,customPrompt:`Prompt`,knowledgeSource:`Knowledge Source`,agents:`Agentes`,agent:`Agente`,selectAgent:`Selecione o Agente`,selectAgentDescription:`Eles serão consultados quando o usuário utilizar este prompt.`,agentsAccountFilter:`Conta`,agentsPersonalFilter:`Pessoal`,agentsSharedFilter:`Compartilhado`,agentsListError:`Não foi possÃvel listar os agentes`,knowledgeSourceDescription:`Selecione os Knowledge Sources`,knowledgeSourceDetail:`Eles serão consultados quando o usuário utilizar este prompt.`,unableToListKnowledgeSources:`Não foi possÃvel listar os Knowledge Sources`,viewKO:`Ver `,koList:`Lista de Knowledge objects`,modalEndTitle:`Utilização do Quick Command `,modalEndDescription:`Personalize como o usuário irá interagir com seu Quick Command na IDE.`,back:`Voltar`,finish:`Finalizar`,defaultFinalResult:`O Quick Command foi executado com sucesso.`,finishFlow:`Finalizar`,start:`InÃcio`,conditional:`Condicional`,replaceOption:`Substituir o código selecionado`,aboveOption:`Em cima do código selecionado`,belowOption:`Abaixo do código selecionado`,popoverTitleChatContext:`Contexto do Chat`,popoverContentChatContext:`Histórico do chat: Esse recurso avançado usa o histórico de Quick Commands para melhorar sua experiência nas sessões de chat. Ao ativar 'Usar Contexto do Chat', a StackSpot AI considera interações anteriores para tornar as conversas mais eficientes`,popoverLinkText:`Ver Documentação`,account:`Conta`,personal:`Pessoal`,workspaces:`Workspaces`,fieldWithInvalidValue:`Há informações incorretas nesta na etapa $type.`,messageRequiredFieldEmpty:`Há campos obrigatórios que não foram preenchidos na etapa $type.`,messageFieldType:`utilização do Quick Command`,confirmTryTitle:`Salvar e Testar`,confirmTrySubTitle:`Para testar este quick command, você precisa salvá-lo primeiro. Gostaria de salvá-lo agora?`,confirmTryButtonConfirm:`Salvar e Testar`,confirmBackTitle:`Salvar alterações antes de sair?`,confirmBackSubTitle:`Você está prestes a sair da pagina de Quick Command. Deseja salvar suas alterações ou descartá-las?`,confirmBackButtonConfirm:`Salvar`,confirmBackButtonCancel:`Descartar`,try:`Testar`,stackspotCodegenDescription:`O StackSpot CodeGen é um agente avançado de inteligência artificial projetado para otimizar e acelerar o desenvolvimento de softw
102are. Integrado diretamente ao seu ambiente de desenvolvimento integrado, StackSpot CodeGen oferece sugestões de código em tempo real, ajudando os desenvolvedores a escrever código de alta qualidade com mais eficiência. StackSpot CodeGen contextualiza suas necessidades de desenvolvimento para fornecer as melhores respostas e sugestões de código.`,unableToValidateSlug:`Não foi possÃvel validar o Slug.`,interfaceOption:`Interface`,interfaceDescription:`Ao selecionar a opção Interface, quando o usuário der o comando, o conteúdo será gerado na barra lateral da extensão StackSpot AI.`,codeOption:`Código`,codeDescription:`Ao selecionar a opção Código, quando o usuário der o comando, o conteúdo será colado diretamente no código.`,codeInsertionLabel:`Como o código será inserido?`,route:`Rota`,routeDefaultErrorMessage:`Mensagem de erro padrão`,customInputInvalid:`O inputs customizável $slug está inválido. Verifique se tanto a pergunta quanto slug estão preenchidos.`,popoverTitleContextSharing:`Compartilhamento de Contexto`,popoverContentContextSharing:`Quando ativado, o contexto dos steps é compartilhado automaticamente. Quando desativado, apenas referências explÃcitas via Jinja terão acesso ao contexto de outros steps.`,tooltipPreserveConversation:`Desative o Compartilhamento de Contexto para usar o Contexto do Chat`,tooltipContextBetweenSteps:`Desative o Contexto do Chat para usar Compartilhamento de Contexto`,scriptExecution:`Execução de Script`,executionResult:`Resultado da execução`,slugChangedInJinja:`Encontramos o slug que você acabou de alterar em uma expressão Jinja no nó final. Por favor, verifique suas expressões Jinja.`,totalObjects:`Número total de objetos`,preserveConversation:`Usar contexto do chat`,shareContextBetweenSteps:`Compartilhamento de Contexto entre Steps`,agentDetails:`Detalhes do agente`,quickCommand:`Quick Command`,parallelStart:`Começar Execução Paralela`,parallelEnd:`Finalizar Execução Paralela`,tryNotAvailableTitle:`Ação não disponÃvel no Quick Command`,tryNotAvailableDescription:`A opção de executar Quick Command com execuções paralelas não está disponÃvel para a funcionalidade Try.`,continue:`Continuar`,singleNode:`Criar um paralelo com um único nó interno não é permitido`,invalidPath:`Pelo menos um dos caminhos com execução paralela não passa pelo nó de finalizar execução paralela`,closeModal:`Fechar modal`}},vl=(0,J.createContext)(null),yl=vl.Provider,bl={error001:()=>`[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The React Flow parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?`target`:`source`} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},xl=bl.error001();function Sl(e,t){let n=(0,J.useContext)(vl);if(n===null)throw Error(xl);return Pe(n,e,t)}var Cl=()=>{let e=(0,J.useContext)(vl);if(e===null)throw Error(xl);return(0,J.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},wl=e=>e.userSelectionActive?`none`:`all`;function Tl({position:e,children:t,className:n,style:r,...i}){let a=Sl(wl),o=`${e}`.split(`-`);return J.createElement(`div`,{className:U([`react-flow__panel`,n,...o]),style:{...r,pointerEvents:a},...i},t)}function El({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:J.createElement(Tl,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro`},J.createElement(`a`,{href:`https://reactflow.dev`,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`},`React Flow`))}var Dl=(0,J.memo)(({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u})=>{let d=(0,J.useRef)(null),[f,p]=(0,J.useState)({x:0,y:0,width:0,height:0}),m=U([`react-flow__edge-textwrapper`,l]);return(0,J.useEffect)(()=>
vendor: 75,283 bytes, line 102
102{if(d.current){let e=d.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n===void 0||!n?null:J.createElement(`g`,{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:m,visibility:f.width?`visible`:`hidden`,...u},i&&J.createElement(`rect`,{width:f.width+2*o[0],x:-o[0],y:-o[1],height:f.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),J.createElement(`text`,{className:`react-flow__edge-text`,y:f.height/2,dy:`0.3em`,ref:d,style:r},n),c)}),Ol=e=>({width:e.offsetWidth,height:e.offsetHeight}),kl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Al=(e={x:0,y:0},t)=>({x:kl(e.x,t[0][0],t[1][0]),y:kl(e.y,t[0][1],t[1][1])}),jl=(e,t,n)=>e<t?kl(Math.abs(e-t),1,50)/50:e>n?-kl(Math.abs(e-n),1,50)/50:0,Ml=(e,t)=>[jl(e.x,35,t.width-35)*20,jl(e.y,35,t.height-35)*20],Nl=e=>e.getRootNode?.()||window?.document,Pl=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Fl=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Il=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ll=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Rl=(e,t)=>{let n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},zl=e=>Bl(e.width)&&Bl(e.height)&&Bl(e.x)&&Bl(e.y),Bl=e=>!isNaN(e)&&isFinite(e),Vl=Symbol.for(`internals`),Hl=[`Enter`,` `,`Escape`],Ul=(e,t)=>{},Wl=e=>`nativeEvent`in e;function Gl(e){let t=(Wl(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return[`INPUT`,`SELECT`,`TEXTAREA`].includes(t?.nodeName)||t?.hasAttribute(`contenteditable`)||!!t?.closest(`.nokey`)}var Kl=e=>`clientX`in e,ql=(e,t)=>{let n=Kl(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},Jl=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0,Yl=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p=20})=>J.createElement(J.Fragment,null,J.createElement(`path`,{id:e,style:u,d:t,fill:`none`,className:`react-flow__edge-path`,markerEnd:d,markerStart:f}),p&&J.createElement(`path`,{d:t,fill:`none`,strokeOpacity:0,strokeWidth:p,className:`react-flow__edge-interaction`}),i&&Bl(n)&&Bl(r)?J.createElement(Dl,{x:n,y:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l}):null);Yl.displayName=`BaseEdge`;function Xl(e,t,n){return n===void 0?n:r=>{let i=t().edges.find(t=>t.id===e);i&&n(r,{...i})}}function Zl({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function Ql({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}var $l;(function(e){e.Strict=`strict`,e.Loose=`loose`})($l||={});var eu;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(eu||={});var tu;(function(e){e.Partial=`partial`,e.Full=`full`})(tu||={});var nu;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(nu||={});var ru;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(ru||={});var Z;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})(Z||={});function iu({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===Z.Left||e===Z.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function au({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:a=Z.Top}){let[o,s]=iu({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=iu({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=Ql({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}var ou=(0,J.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Z.Bottom,targetPosition:a=Z.Top,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=au({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a});return J.createElement(Yl,{path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})});ou.displayName=`SimpleBezierEdge`;var su={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},cu=({source:e,sourcePosition:t=Z.Bottom,target:n})=>t===Z.Left||t===Z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},lu=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function uu({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:r=Z.Top,center:i,offset:a}){let o=su[t],s=su[r],c={x:e.x+o.x*a,y:e.y+o.y*a},l={x:n.x+s.x*a,y:n.y+s.y*a},u=cu({source:c,sourcePosition:t,target:l}),d=u.x===0?`y`:`x`,f=u[d],p=[],m,h,g={x:0,y:0},_={x:0,y:0},[v,y,b,x]=Zl({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(o[d]*s[d]===-1){m=i.x??v,h=i.y??y;let e=[{x:m,y:c.y},{x:m,y:l.y}],t=[{x:c.x,y:h},{x:l.x,y:h}];p=o[d]===f?d===`x`?e:t:d===`x`?t:e}else{let i=[{x:c.x,y:l.y}],u=[{x:l.x,y:c.y}];if(p=d===`x`?o.x===f?u:i:o.y===f?i:u,t===r){let t=Math.abs(e[d]-n[d]);if(t<=a){let r=Math.min(a-1,a-t);o[d]===f?g[d]=(c[d]>e[d]?-1:1)*r:_[d]=(l[d]>n[d]?-1:1)*r}}if(t!==r){let e=d===`x`?`y`:`x`,t=o[d]===s[e],n=c[e]>l[e],r=c[e]<l[e];(o[d]===1&&(!t&&n||t&&r)||o[d]!==1&&(!t&&r||t&&n))&&(p=d===`x`?i:u)}let v={x:c.x+g.x,y:c.y+g.y},y={x:l.x+_.x,y:l.y+_.y};Math.max(Math.abs(v.x-p[0].x),Math.abs(y.x-p[0].x))>=Math.max(Math.abs(v.y-p[0].y),Math.abs(y.y-p[0].y))?(m=(v.x+y.x)/2,h=p[0].y):(m=p[0].x,h=(v.y+y.y)/2)}return[[e,{x:c.x+g.x,y:c.y+g.y},...p,{x:l.x+_.x,y:l.y+_.y},n],m,h,b,x]}function du(e,t,n,r){let i=Math.min(lu(e,t)/2,lu(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function fu({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:a=Z.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20}){let[u,d,f,p,m]=uu({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l});return[u.reduce((e,t,n)=>{let r=``;return r=n>0&&n<u.length-1?du(u[n-1],t,u[n+1],o):`${n===0?`M`:`L`}${t.x} ${t.y}`,e+=r,e},``),d,f,p,m]}var pu=(0,J.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,sourcePosition:d=Z.Bottom,targetPosition:f=Z.Top,markerEnd:p,markerStart:m,pathOptions:h,interactionWidth:g})=>{let[_,v,y]=fu({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:h?.borderRadius,offset:h?.offset});return J.createElement(Yl,{path:_,labelX:v,labelY:y,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:p,markerStart:m,interactionWidth:g})});pu.displayName=`SmoothStepEdge`;var mu=(0,J.memo)(e=>J.createElement(pu,{...e,pathOptions:(0,J.useMemo)(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));mu.displayName=`StepEdge`;function hu({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=Zl({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var gu=(0,J.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p})=>{let[m,h,g]=hu({sourceX:e,sourceY:t,targetX:n,targetY:r});return J.createElement(Yl,{path:m,labelX:h,labelY:g,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:c,labelBgBorderRadius:l,style:u,markerEnd:d,markerStart:f,interactionWidth:p})});gu.displayName=`StraightEdge`;function _u(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vu({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case Z.Left:return[t-_u(t-r,a),n];case Z.Right:return[t+_u(r-t,a),n];case Z.Top:return[t,n-_u(n-i,a)];case Z.Bottom:return[t,n+_u(i-n,a)]}}function yu({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:r,targetY:i,targetPosition:a=Z.Top,curvature:o=.25}){let[s,c]=vu({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=vu({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=Ql({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}var bu=(0,J.memo)(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Z.Bottom,targetPosition:a=Z.Top,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,pathOptions:h,interactionWidth:g})=>{let[_,v,y]=yu({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:a,curvature:h?.curvature});return J.createElement(Yl,{path:_,labelX:v,labelY:y,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:g})});bu.displayName=`BezierEdge`;var xu=(0,J.createContext)(null),Su=xu.Provider;xu.Consumer;var Cu=()=>(0,J.useContext)(xu),wu=e=>`id`in e&&`source`in e&&`target`in e,Tu=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||``}-${n}${r||``}`,Eu=(e,t)=>e===void 0?``:typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`,Du=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),Ou=(e,t)=>{if(!e.source||!e.target)return bl.error006(),t;let n;return n=wu(e)?{...e}:{...e,id:Tu(e)},Du(n,t)?t:t.concat(n)},ku=(e,t,n,r={shouldReplaceId:!0})=>{let{id:i,...a}=e;if(!t.source||!t.target)return bl.error006(),n;if(!n.find(e=>e.id===i))return bl.error007(i),n;let o={...a,id:r.shouldReplaceId?Tu(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(e=>e.id!==i).concat(o)},Au=({x:e,y:t},[n,r,i],a,[o,s])=>{let c={x:(e-n)/i,y:(t-r)/i};return a?{x:o*Math.round(c.x/o),y:s*Math.round(c.y/s)}:c},ju=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),Mu=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};let n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},Nu=(e,t=[0,0])=>e.length===0?{x:0,y:0,width:0,height:0}:Il(e.reduce((e,n)=>{let{x:r,y:i}=Mu(n,t).positionAbsolute;return Pl(e,Fl({x:r,y:i,width:n.width||0,height:n.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),Pu=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{let c={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(e=>{let{width:t,height:n,selectable:r=!0,hidden:i=!1}=e;if(o&&!r||i)return!1;let{positionAbsolute:u}=Mu(e,s),d=Rl(c,{x:u.x,y:u.y,width:t||0,height:n||0}),f=t===void 0||n===void 0||t===null||n===null,p=a&&d>0,m=(t||0)*(n||0);(f||p||d>=m||e.dragging)&&l.push(e)}),l},Fu=(e,t)=>{let n=e.map(e=>e.id);return t.filter(e=>n.includes(e.source)||n.includes(e.target))},Iu=(e,t,n,r,i,a=.1)=>{let o=t/(e.width*(1+a)),s=n/(e.height*(1+a)),c=kl(Math.min(o,s),r,i),l=e.x+e.width/2,u=e.y+e.height/2;return{x:t/2-l*c,y:n/2-u*c,zoom:c}},Lu=(e,t=0)=>e.transition().duration(t);function Ru(e,t,n,r){return(t[n]||[]).reduce((t,i)=>(`${e.id}-${i.id}-${n}`!==r&&t.push({id:i.id||null,type:n,nodeId:e.id,x:(e.positionAbsolute?.x??0)+i.x+i.width/2,y:(e.positionAbsolute?.y??0)+i.y+i.height/2}),t),[])}function zu(e,t,n,r,i,a){let{x:o,y:s}=ql(e),c=t.elementsFromPoint(o,s).find(e=>e.classList.contains(`react-flow__handle`));if(c){let e=c.getAttribute(`data-nodeid`);if(e){let t=Wu(void 0,c),r=c.getAttribute(`data-handleid`),o=a({nodeId:e,id:r,type:t});if(o){let a=i.find(n=>n.nodeId===e&&n.type===t&&n.id===r);return{handle:{id:r,type:t,nodeId:e,x:a?.x||n.x,y:a?.y||n.y},validHandleResult:o}}}}let l=[],u=1/0;if(i.forEach(e=>{let t=Math.sqrt((e.x-n.x)**2+(e.y-n.y)**2);if(t<=r){let n=a(e);t<=u&&(t<u?l=[{handle:e,validHandleResult:n}]:t===u&&l.push({handle:e,validHandleResult:n}),u=t)}}),!l.length)return{handle:null,validHandleResult:Vu()};if(l.length===1)return l[0];let d=l.some(({validHandleResult:e})=>e.isValid),f=l.some(({handle:e})=>e.type===`target`);return l.find(({handle:e,validHandleResult:t})=>f?e.type===`target`:d?t.isValid:!0)||l[0]}var Bu={source:null,target:null,sourceHandle:null,targetHandle:null},Vu=()=>({handleDomNode:null,isValid:!1,connection:Bu,endHandle:null});function Hu(e,t,n,r,i,a,o){let s=i===`target`,c=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...Vu(),handleDomNode:c};if(c){let e=Wu(void 0,c),i=c.getAttribute(`data-nodeid`),o=c.getAttribute(`data-handleid`),u=c.classList.contains(`connectable`),d=c.classList.contains(`connectableend`),f={source:s?i:n,sourceHandle:s?o:r,target:s?n:i,targetHandle:s?r:o};l.connection=f,u&&d&&(t===$l.Strict?s&&e===`source`||!s&&e===`target`:i!==n||o!==r)&&(l.endHandle={nodeId:i,handleId:o,type:e},l.isValid=a(f))}return l}function Uu({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((e,i)=>{if(i[Vl]){let{handleBounds:a}=i[Vl],o=[],s=[];a&&(o=Ru(i,a,`source`,`${t}-${n}-${r}`),s=Ru(i,a,`target`,`${t}-${n}-${r}`)),e.push(...o,...s)}return e},[])}function Wu(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function Gu(e){e?.classList.remove(`valid`,`connecting`,`react-flow__handle-valid`,`react-flow__handle-connecting`)}function Ku(e,t){let n=null;return t?n=`valid`:e&&!t&&(n=`invalid`),n}function qu({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:c,onReconnectEnd:l}){let u=Nl(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:p,connectionRadius:m,onConnectStart:h,panBy:g,getNodes:_,cancelConnection:v}=a(),y=0,b,{x,y:S}=ql(e),C=u?.elementFromPoint(x,S),w=Wu(c,C),T=f?.getBoundingClientRect();if(!T||!w)return;let E,D=ql(e,T),O=!1,k=null,A=!1,j=null,M=Uu({nodes:_(),nodeId:n,handleId:t,handleType:w}),N=()=>{if(!p)return;let[e,t]=Ml(D,T);g({x:e,y:t}),y=requestAnimationFrame(N)};o({connectionPosition:D,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:w,connectionStartHandle:{nodeId:n,handleId:t,type:w},connectionEndHandle:null}),h?.(e,{nodeId:n,handleId:t,handleType:w});function P(e){let{transform:r}=a();D=ql(e,T);let{handle:c,validHandleResult:l}=zu(e,u,Au(D,r,!1,[1,1]),m,M,e=>Hu(e,d,n,t,i?`target`:`source`,s,u));if(b=c,O||=(N(),!0),j=l.handleDomNode,k=l.connection,A=l.isValid,o({connectionPosition:b&&A?ju({x:b.x,y:b.y},r):D,connectionStatus:Ku(!!b,A),connectionEndHandle:l.endHandle}),!b&&!A&&!j)return Gu(E);k.source!==k.target&&j&&(Gu(E),E=j,j.classList.add(`connecting`,`react-flow__handle-connecting`),j.classList.toggle(`valid`,A),j.classList.toggle(`react-flow__handle-valid`,A))}function F(e){(b||j)&&k&&A&&r?.(k),a().onConnectEnd?.(e),c&&l?.(e),Gu(E),v(),cancelAnimationFrame(y),O=!1,A=!1,k=null,j=null,u.removeEventListener(`mousemove`,P),u.removeEventListener(`mouseup`,F),u.removeEventListener(`touchmove`,P),u.removeEventListener(`touchend`,F)}u.addEventListener(`mousemove`,P),u.addEventListener(`mouseup`,F),u.addEventListener(`touchmove`,P),u.addEventListener(`touchend`,F)}var Ju=()=>!0,Yu=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),Xu=(e,t,n)=>r=>{let{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=r;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===n||a?.nodeId===e&&a?.handleId===t&&a?.type===n,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===n}},Zu=(0,J.forwardRef)(({type:e=`source`,position:t=Z.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p)=>{let m=o||null,h=e===`target`,g=Cl(),_=Cu(),{connectOnClick:v,noPanClassName:y}=Sl(Yu,W),{connecting:b,clickConnecting:x}=Sl(Xu(_,m,e),W);_||g.getState().onError?.(`010`,bl.error010());let S=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t}=g.getState();t(Ou(i,e))}n?.(i),s?.(i)},C=e=>{if(!_)return;let t=Kl(e);i&&(t&&e.button===0||!t)&&qu({event:e,handleId:m,nodeId:_,onConnect:S,isTarget:h,getState:g.getState,setState:g.setState,isValidConnection:n||g.getState().isValidConnection||Ju}),t?u?.(e):d?.(e)};return J.createElement(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${_}-${m}-${e}`,className:U([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,connecting:x,connectionindicator:r&&(i&&!b||a&&b)}]),onMouseDown:C,onTouchStart:C,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,handleId:m}});return}let l=Nl(t.target),u=n||c||Ju,{connection:d,isValid:f}=Hu({nodeId:_,id:m,type:e},s,o.nodeId,o.handleId||null,o.type,u,l);f&&S(d),a?.(t),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f},c)});Zu.displayName=`Handle`;var Qu=(0,J.memo)(Zu),$u=({data:e,isConnectable:t,targetPosition:n=Z.Top,sourcePosition:r=Z.Bottom})=>J.createElement(J.Fragment,null,J.createElement(Qu,{type:`target`,position:n,isConnectable:t}),e?.label,J.createElement(Qu,{type:`source`,position:r,isConnectable:t}));$u.displayName=`DefaultNode`;var ed=(0,J.memo)($u),td=({data:e,isConnectable:t,sourcePosition:n=Z.Bottom})=>J.createElement(J.Fragment,null,e?.label,J.createElement(Qu,{type:`source`,position:n,isConnectable:t}));td.displayName=`InputNode`;var nd=(0,J.memo)(td),rd=({data:e,isConnectable:t,targetPosition:n=Z.Top})=>J.createElement(J.Fragment,null,J.createElement(Qu,{type:`target`,position:n,isConnectable:t}),e?.label);rd.displayName=`OutputNode`;var id=(0,J.memo)(rd),ad=()=>null;ad.displayName=`GroupNode`;var od=e=>({selectedNodes:e.getNodes().filter(e=>e.selected),selectedEdges:e.edges.filter(e=>e.selected).map(e=>({...e}))}),sd=e=>e.id;function cd(e,t){return W(e.selectedNodes.map(sd),t.selectedNodes.map(sd))&&W(e.selectedEdges.map(sd),t.selectedEdges.map(sd))}var ld=(0,J.memo)(({onSelectionChange:e})=>{let t=Cl(),{selectedNodes:n,selectedEdges:r}=Sl(od,cd);return(0,J.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChange.forEach(e=>e(i))},[n,r,e]),null});ld.displayName=`SelectionListener`;var ud=e=>!!e.onSelectionChange;function dd({onSelectionChange:e}){let t=Sl(ud);return e||t?J.createElement(ld,{onSelectionChange:e}):null}var fd=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function pd(e,t){(0,J.useEffect)(()=>{e!==void 0&&t(e)},[e])}function Q(e,t,n){(0,J.useEffect)(()=>{t!==void 0&&n({[e]:t})},[t])}var md=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:c,nodesDraggable:l,nodesConnectable:u,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:p,elevateNodesOnSelect:m,minZoom:h,maxZoom:g,nodeExtent:_,onNodesChange:v,onEdgesChange:y,elementsSelectable:b,connectionMode:x,snapGrid:S,snapToGrid:C,translateExtent:w,connectOnClick:T,defaultEdgeOptions:E,fitView:D,fitViewOptions:O,onNodesDelete:k,onEdgesDelete:A,onNodeDrag:j,onNodeDragStart:M,onNodeDragStop:N,onSelectionDrag:P,onSelectionDragStart:F,onSelectionDragStop:I,noPanClassName:L,nodeOrigin:R,rfId:ee,autoPanOnConnect:z,autoPanOnNodeDrag:te,onError:B,connectionRadius:ne,isValidConnection:re,nodeDragThreshold:V})=>{let{setNodes:ie,setEdges:ae,setDefaultNodesAndEdges:oe,setMinZoom:se,setMaxZoom:ce,setTranslateExtent:le,setNodeExtent:ue,reset:de}=Sl(fd,W),H=Cl();return(0,J.useEffect)(()=>{let e=r?.map(e=>({...e,...E}));return oe(n,e),()=>{de()}},[]),Q(`defaultEdgeOptions`,E,H.setState),Q(`connectionMode`,x,H.setState),Q(`onConnect`,i,H.setState),Q(`onConnectStart`,a,H.setState),Q(`onConnectEnd`,o,H.setState),Q(`onClickConnectStart`,s,H.setState),Q(`onClickConnectEnd`,c,H.setState),Q(`nodesDraggable`,l,H.setState),Q(`nodesConnectable`,u,H.setState),Q(`nodesFocusable`,d,H.setState),Q(`edgesFocusable`,f,H.setState),Q(`edgesUpdatable`,p,H.setState),Q(`elementsSelectable`,b,H.setState),Q(`elevateNodesOnSelect`,m,H.setState),Q(`snapToGrid`,C,H.setState),Q(`snapGrid`,S,H.setState),Q(`onNodesChange`,v,H.setState),Q(`onEdgesChange`,y,H.setState),Q(`connectOnClick`,T,H.setState),Q(`fitViewOnInit`,D,H.setState),Q(`fitViewOnInitOptions`,O,H.setState),Q(`onNodesDelete`,k,H.setState),Q(`onEdgesDelete`,A,H.setState),Q(`onNodeDrag`,j,H.setState),Q(`onNodeDragStart`,M,H.setState),Q(`onNodeDragStop`,N,H.setState),Q(`onSelectionDrag`,P,H.setState),Q(`onSelectionDragStart`,F,H.setState),Q(`onSelectionDragStop`,I,H.setState),Q(`noPanClassName`,L,H.setState),Q(`nodeOrigin`,R,H.setState),Q(`rfId`,ee,H.setState),Q(`autoPanOnConnect`,z,H.setState),Q(`autoPanOnNodeDrag`,te,H.setState),Q(`onError`,B,H.setState),Q(`connectionRadius`,ne,H.setState),Q(`isValidConnection`,re,H.setState),Q(`nodeDragThreshold`,V,H.setState),pd(e,ie),pd(t,ae),pd(h,se),pd(g,ce),pd(w,le),pd(_,ue),null},hd={display:`none`},gd={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},_d=`react-flow__node-desc`,vd=`react-flow__edge-desc`,yd=`react-flow__aria-live`,bd=e=>e.ariaLiveMessage;function xd({rfId:e}){let t=Sl(bd);return J.createElement(`div`,{id:`${yd}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:gd},t)}function Sd({rfId:e,disableKeyboardA11y:t}){return J.createElement(J.Fragment,null,J.createElement(`div`,{id:`${_d}-${e}`,style:hd},`Press enter or space to select a node.`,!t&&`You can then use the arrow keys to move the node around.`,` Press delete to remove it and escape to cancel.`,` `),J.createElement(`div`,{id:`${vd}-${e}`,style:hd},`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`),!t&&J.createElement(xd,{rfId:e}))}var Cd=(e=null,t={actInsideInputWithModifier:!0})=>{let[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(!1),a=(0,J.useRef)(new Set([])),[o,s]=(0,J.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.split(`+`));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,J.useEffect)(()=>{let n=typeof document<`u`?document:null,c=t?.target||n;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&Gl(e))return!1;let n=Td(e.code,s);a.current.add(e[n]),wd(o,a.current,!1)&&(e.preventDefault(),r(!0))},n=e=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&Gl(e))return!1;let n=Td(e.code,s);wd(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[n]),e.key===`Meta`&&a.current.clear(),i.current=!1},l=()=>{a.current.clear(),r(!1)};return c?.addEventListener(`keydown`,e),c?.addEventListener(`keyup`,n),window.addEventListener(`blur`,l),()=>{c?.removeEventListener(`keydown`,e),c?.removeEventListener(`keyup`,n),window.removeEventListener(`blur`,l)}}},[e,r]),n};function wd(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Td(e,t){return t.includes(e)?`code`:`key`}function Ed(e,t,n,r){let i=e.parentNode||e.parentId;if(!i)return n;let a=t.get(i),o=Mu(a,r);return Ed(a,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(a[Vl]?.z??0)>(n.z??0)?a[Vl]?.z??0:n.z??0},r)}function Dd(e,t,n){e.forEach(r=>{let i=r.parentNode||r.parentId;if(i&&!e.has(i))throw Error(`Parent node ${i} not found`);if(i||n?.[r.id]){let{x:i,y:a,z:o}=Ed(r,e,{...r.position,z:r[Vl]?.z??0},t);r.positionAbsolute={x:i,y:a},r[Vl].z=o,n?.[r.id]&&(r[Vl].isParent=!0)}})}function Od(e,t,n,r){let i=new Map,a={},o=r?1e3:0;return e.forEach(e=>{let n=(Bl(e.zIndex)?e.zIndex:0)+(e.selected?o:0),r=t.get(e.id),s={...e,positionAbsolute:{x:e.position.x,y:e.position.y}},c=e.parentNode||e.parentId;c&&(a[c]=!0);let l=r?.type&&r?.type!==e.type;Object.defineProperty(s,Vl,{enumerable:!1,value:{handleBounds:l?void 0:r?.[Vl]?.handleBounds,z:n}}),i.set(e.id,s)}),Dd(i,n,a),i}function kd(e,t={}){let{getNodes:n,width:r,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:c,fitViewOnInitDone:l,fitViewOnInit:u,nodeOrigin:d}=e(),f=t.initial&&!l&&u;if(s&&c&&(f||!t.initial)){let e=n().filter(e=>{let n=t.includeHiddenNodes?e.width&&e.height:!e.hidden;return t.nodes?.length?n&&t.nodes.some(t=>t.id===e.id):n}),l=e.every(e=>e.width&&e.height);if(e.length>0&&l){let{x:n,y:l,zoom:u}=Iu(Nu(e,d),r,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),f=Fe.translate(n,l).scale(u);return typeof t.duration==`number`&&t.duration>0?s.transform(Lu(c,t.duration),f):s.transform(c,f),!0}}return!1}function Ad(e,t){return e.forEach(e=>{let n=t.get(e.id);n&&t.set(n.id,{...n,[Vl]:n[Vl],selected:e.selected})}),new Map(t)}function jd(e,t){return t.map(t=>{let n=e.find(e=>e.id===t.id);return n&&(t.selected=n.selected),t})}function Md({changedNodes:e,changedEdges:t,get:n,set:r}){let{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:c,hasDefaultEdges:l}=n();e?.length&&(c&&r({nodeInternals:Ad(e,i)}),o?.(e)),t?.length&&(l&&r({edges:jd(t,a)}),s?.(t))}var Nd=()=>{},Pd={zoomIn:Nd,zoomOut:Nd,zoomTo:Nd,getZoom:()=>1,setViewport:Nd,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Nd,fitBounds:Nd,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},Fd=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Id=()=>{let e=Cl(),{d3Zoom:t,d3Selection:n}=Sl(Fd,W);return(0,J.useMemo)(()=>n&&t?{zoomIn:e=>t.scaleBy(Lu(n,e?.duration),1.2),zoomOut:e=>t.scaleBy(Lu(n,e?.duration),1/1.2),zoomTo:(e,r)=>t.scaleTo(Lu(n,r?.duration),e),getZoom:()=>e.getState().transform[2],setViewport:(r,i)=>{let[a,o,s]=e.getState().transform,c=Fe.translate(r.x??a,r.y??o).scale(r.zoom??s);t.transform(Lu(n,i?.duration),c)},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},fitView:t=>kd(e.getState,t),setCenter:(r,i,a)=>{let{width:o,height:s,maxZoom:c}=e.getState(),l=a?.zoom===void 0?c:a.zoom,u=o/2-r*l,d=s/2-i*l,f=Fe.translate(u,d).scale(l);t.transform(Lu(n,a?.duration),f)},fitBounds:(r,i)=>{let{width:a,height:o,minZoom:s,maxZoom:c}=e.getState(),{x:l,y:u,zoom:d}=Iu(r,a,o,s,c,i?.padding??.1),f=Fe.translate(l,u).scale(d);t.transform(Lu(n,i?.duration),f)},project:t=>{let{transform:n,snapToGrid:r,snapGrid:i}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Au(t,n,r,i)},screenToFlowPosition:t=>{let{transform:n,snapToGrid:r,snapGrid:i,domNode:a}=e.getState();if(!a)return t;let{x:o,y:s}=a.getBoundingClientRect();return Au({x:t.x-o,y:t.y-s},n,r,i)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=ju(t,n);return{x:o.x+i,y:o.y+a}},viewportInitialized:!0}:Pd,[t,n])};function Ld(){let e=Id(),t=Cl(),n=(0,J.useCallback)(()=>t.getState().getNodes().map(e=>({...e})),[]),r=(0,J.useCallback)(e=>t.getState().nodeInternals.get(e),[]),i=(0,J.useCallback)(()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},[]),a=(0,J.useCallback)(e=>{let{edges:n=[]}=t.getState();return n.find(t=>t.id===e)},[]),o=(0,J.useCallback)(e=>{let{getNodes:n,setNodes:r,hasDefaultNodes:i,onNodesChange:a}=t.getState(),o=n(),s=typeof e==`function`?e(o):e;i?r(s):a&&a(s.length===0?o.map(e=>({type:`remove`,id:e.id})):s.map(e=>({item:e,type:`reset`})))},[]),s=(0,J.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a}=t.getState(),o=typeof e==`function`?e(n):e;i?r(o):a&&a(o.length===0?n.map(e=>({type:`remove`,id:e.id})):o.map(e=>({item:e,type:`reset`})))},[]),c=(0,J.useCallback)(e=>{let n=Array.isArray(e)?e:[e],{getNodes:r,setNodes:i,hasDefaultNodes:a,onNodesChange:o}=t.getState();a?i([...r(),...n]):o&&o(n.map(e=>({item:e,type:`add`})))},[]),l=(0,J.useCallback)(e=>{let n=Array.isArray(e)?e:[e],{edges:r=[],setEdges:i,hasDefaultEdges:a,onEdgesChange:o}=t.getState();a?i([...r,...n]):o&&o(n.map(e=>({item:e,type:`add`})))},[]),u=(0,J.useCallback)(()=>{let{getNodes:e,edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e().map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},[]),d=(0,J.useCallback)(({nodes:e,edges:n})=>{let{nodeInternals:r,getNodes:i,edges:a,hasDefaultNodes:o,hasDefaultEdges:s,onNodesDelete:c,onEdgesDelete:l,onNodesChange:u,onEdgesChange:d}=t.getState(),f=(e||[]).map(e=>e.id),p=(n||[]).map(e=>e.id),m=i().reduce((e,t)=>{let n=t.parentNode||t.parentId,r=!f.includes(t.id)&&n&&e.find(e=>e.id===n);return(typeof t.deletable!=`boolean`||t.deletable)&&(f.includes(t.id)||r)&&e.push(t),e},[]),h=a.filter(e=>typeof e.deletable==`boolean`?e.deletable:!0),g=h.filter(e=>p.includes(e.id));if(m||g){let e=Fu(m,h),n=[...g,...e],i=n.reduce((e,t)=>(e.includes(t.id)||e.push(t.id),e),[]);(s||o)&&(s&&t.setState({edges:a.filter(e=>!i.includes(e.id))}),o&&(m.forEach(e=>{r.delete(e.id)}),t.setState({nodeInternals:new Map(r)}))),i.length>0&&(l?.(n),d&&d(i.map(e=>({id:e,type:`remove`})))),m.length>0&&(c?.(m),u&&u(m.map(e=>({id:e.id,type:`remove`}))))}},[]),f=(0,J.useCallback)(e=>{let n=zl(e),r=n?null:t.getState().nodeInternals.get(e.id);return!n&&!r?[null,null,n]:[n?e:Ll(r),r,n]},[]),p=(0,J.useCallback)((e,n=!0,r)=>{let[i,a,o]=f(e);return i?(r||t.getState().getNodes()).filter(e=>{if(!o&&(e.id===a.id||!e.positionAbsolute))return!1;let t=Rl(Ll(e),i);return n&&t>0||t>=i.width*i.height}):[]},[]),m=(0,J.useCallback)((e,t,n=!0)=>{let[r]=f(e);if(!r)return!1;let i=Rl(r,t);return n&&i>0||i>=r.width*r.height},[]);return(0,J.useMemo)(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:c,addEdges:l,toObject:u,deleteElements:d,getIntersectingNodes:p,isNodeIntersecting:m}),[e,n,r,i,a,o,s,c,l,u,d,p,m])}var Rd={actInsideInputWithModifier:!1},zd=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{let n=Cl(),{deleteElements:r}=Ld(),i=Cd(e,Rd),a=Cd(t);(0,J.useEffect)(()=>{if(i){let{edges:e,getNodes:t}=n.getState();r({nodes:t().filter(e=>e.selected),edges:e.filter(e=>e.selected)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,J.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])};function Bd(e){let t=Cl();(0,J.useEffect)(()=>{let n,r=()=>{if(!e.current)return;let n=Ol(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,bl.error004()),t.setState({width:n.width||500,height:n.height||500})};return r(),window.addEventListener(`resize`,r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener(`resize`,r),n&&e.current&&n.unobserve(e.current)}},[])}var Vd={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},Hd=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,Ud=e=>({x:e.x,y:e.y,zoom:e.k}),Wd=(e,t)=>e.target.closest(`.${t}`),Gd=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kd=e=>{let t=e.ctrlKey&&Jl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},qd=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Jd=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:c=eu.Free,zoomOnDoubleClick:l=!0,elementsSelectable:u,panOnDrag:d=!0,defaultViewport:f,translateExtent:p,minZoom:m,maxZoom:h,zoomActivationKeyCode:g,preventScrolling:_=!0,children:v,noWheelClassName:y,noPanClassName:b})=>{let x=(0,J.useRef)(),S=Cl(),C=(0,J.useRef)(!1),w=(0,J.useRef)(!1),T=(0,J.useRef)(null),E=(0,J.useRef)({x:0,y:0,zoom:0}),{d3Zoom:D,d3Selection:O,d3ZoomHandler:k,userSelectionActive:A}=Sl(qd,W),j=Cd(g),M=(0,J.useRef)(0),N=(0,J.useRef)(!1),P=(0,J.useRef)();return Bd(T),(0,J.useEffect)(()=>{if(T.current){let e=T.current.getBoundingClientRect(),t=Me().scaleExtent([m,h]).translateExtent(p),n=Ae(T.current).call(t),r=Fe.translate(f.x,f.y).scale(kl(f.zoom,m,h)),i=[[0,0],[e.width,e.height]],a=t.constrain()(r,i,p);t.transform(n,a),t.wheelDelta(Kd),S.setState({d3Zoom:t,d3Selection:n,d3ZoomHandler:n.on(`wheel.zoom`),transform:[a.x,a.y,a.k],domNode:T.current.closest(`.react-flow`)})}},[]),(0,J.useEffect)(()=>{O&&D&&(o&&!j&&!A?O.on(`wheel.zoom`,r=>{if(Wd(r,y))return!1;r.preventDefault(),r.stopImmediatePropagation();let i=O.property(`__zoom`).k||1;if(r.ctrlKey&&a){let e=Ne(r),t=i*2**Kd(r);D.scaleTo(O,t,e,r);return}let o=r.deltaMode===1?20:1,l=c===eu.Vertical?0:r.deltaX*o,u=c===eu.Horizontal?0:r.deltaY*o;!Jl()&&r.shiftKey&&c!==eu.Vertical&&(l=r.deltaY*o,u=0),D.translateBy(O,-(l/i)*s,-(u/i)*s,{internal:!0});let d=Ud(O.property(`__zoom`)),{onViewportChangeStart:f,onViewportChange:p,onViewportChangeEnd:m}=S.getState();clearTimeout(P.current),N.current||(N.current=!0,t?.(r,d),f?.(d)),N.current&&(e?.(r,d),p?.(d),P.current=setTimeout(()=>{n?.(r,d),m?.(d),N.current=!1},150))},{passive:!1}):k!==void 0&&O.on(`wheel.zoom`,function(e,t){if(!_&&e.type===`wheel`&&!e.ctrlKey||Wd(e,y))return null;e.preventDefault(),k.call(this,e,t)},{passive:!1}))},[A,o,c,O,D,k,j,a,_,y,t,e,n]),(0,J.useEffect)(()=>{D&&D.on(`start`,e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;M.current=e.sourceEvent?.button;let{onViewportChangeStart:n}=S.getState(),r=Ud(e.transform);C.current=!0,E.current=r,e.sourceEvent?.type===`mousedown`&&S.setState({paneDragging:!0}),n?.(r),t?.(e.sourceEvent,r)})},[D,t]),(0,J.useEffect)(()=>{D&&(A&&!C.current?D.on(`zoom`,null):A||D.on(`zoom`,t=>{let{onViewportChange:n}=S.getState();if(S.setState({transform:[t.transform.x,t.transform.y,t.transform.k]}),w.current=!!(r&&Gd(d,M.current??0)),(e||n)&&!t.sourceEvent?.internal){let r=Ud(t.transform);n?.(r),e?.(t.sourceEvent,r)}}))},[A,D,e,d,r]),(0,J.useEffect)(()=>{D&&D.on(`end`,e=>{if(!e.sourceEvent||e.sourceEvent.internal)return null;let{onViewportChangeEnd:t}=S.getState();if(C.current=!1,S.setState({paneDragging:!1}),r&&Gd(d,M.current??0)&&!w.current&&r(e.sourceEvent),w.current=!1,(n||t)&&Hd(E.current,e.transform)){let r=Ud(e.transform);E.current=r,clearTimeout(x.current),x.current=setTimeout(()=>{t?.(r),n?.(e.sourceEvent,r)},o?150:0)}})},[D,o,d,n,r]),(0,J.useEffect)(()=>{D&&D.filter(e=>{let t=j||i,n=a&&e.ctrlKey;if((d===!0||Array.isArray(d)&&d.includes(1))&&e.button===1&&e.type===`mousedown`&&(Wd(e,`react-flow__node`)||Wd(e,`react-flow__edge`)))return!0;if(!d&&!t&&!o&&!l&&!a||A||!l&&e.type===`dblclick`||Wd(e,y)&&e.type===`wheel`||Wd(e,b)&&(e.type!==`wheel`||o&&e.type===`wheel`&&!j)||!a&&e.ctrlKey&&e.type===`wheel`||!t&&!o&&!n&&e.type===`wheel`||!d&&(e.type===`mousedown`||e.type===`touchstart`)||Array.isArray(d)&&!d.includes(e.button)&&e.type===`mousedown`)return!1;let r=Array.isArray(d)&&d.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||e.type===`wheel`)&&r})},[A,D,i,a,o,l,d,u,j]),J.createElement(`div`,{className:`react-flow__renderer`,ref:T,style:Vd},v)},Yd=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Xd(){let{userSelectionActive:e,userSelectionRect:t}=Sl(Yd,W);return e&&t?J.createElement(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function Zd(e,t){let n=t.parentNode||t.parentId,r=e.find(e=>e.id===n);if(r){let e=t.position.x+t.width-r.width,n=t.position.y+t.height-r.height;if(e>0||n>0||t.position.x<0||t.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,e>0&&(r.style.width+=e),n>0&&(r.style.height+=n),t.position.x<0){let e=Math.abs(t.position.x);r.position.x=r.position.x-e,r.style.width+=e,t.position.x=0}if(t.position.y<0){let e=Math.abs(t.position.y);r.position.y=r.position.y-e,r.style.height+=e,t.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function Qd(e,t){if(e.some(e=>e.type===`reset`))return e.filter(e=>e.type===`reset`).map(e=>e.item);let n=e.filter(e=>e.type===`add`).map(e=>e.item);return t.reduce((t,n)=>{let r=e.filter(e=>e.id===n.id);if(r.length===0)return t.push(n),t;let i={...n};for(let e of r)if(e)switch(e.type){case`select`:i.selected=e.selected;break;case`position`:e.position!==void 0&&(i.position=e.position),e.positionAbsolute!==void 0&&(i.positionAbsolute=e.positionAbsolute),e.dragging!==void 0&&(i.dragging=e.dragging),i.expandParent&&Zd(t,i);break;case`dimensions`:e.dimensions!==void 0&&(i.width=e.dimensions.width,i.height=e.dimensions.height),e.updateStyle!==void 0&&(i.style={...i.style||{},...e.dimensions}),typeof e.resizing==`boolean`&&(i.resizing=e.resizing),i.expandParent&&Zd(t,i);break;case`remove`:return t}return t.push(i),t},n)}function $d(e,t){return Qd(e,t)}var ef=(e,t)=>({id:e,type:`select`,selected:t});function tf(e,t){return e.reduce((e,n)=>{let r=t.includes(n.id);return!n.selected&&r?(n.selected=!0,e.push(ef(n.id,!0))):n.selected&&!r&&(n.selected=!1,e.push(ef(n.id,!1))),e},[])}var nf=(e,t)=>n=>{n.target===t.current&&e?.(n)},rf=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),af=(0,J.memo)(({isSelecting:e,selectionMode:t=tu.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:c,onPaneMouseMove:l,onPaneMouseLeave:u,children:d})=>{let f=(0,J.useRef)(null),p=Cl(),m=(0,J.useRef)(0),h=(0,J.useRef)(0),g=(0,J.useRef)(),{userSelectionActive:_,elementsSelectable:v,dragging:y}=Sl(rf,W),b=()=>{p.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,h.current=0},x=e=>{a?.(e),p.getState().resetSelectedElements(),p.setState({nodesSelectionActive:!1})},S=e=>{if(Array.isArray(n)&&n?.includes(2)){e.preventDefault();return}o?.(e)},C=s?e=>s(e):void 0,w=t=>{let{resetSelectedElements:n,domNode:i}=p.getState();if(g.current=i?.getBoundingClientRect(),!v||!e||t.button!==0||t.target!==f.current||!g.current)return;let{x:a,y:o}=ql(t,g.current);n(),p.setState({userSelectionRect:{width:0,height:0,startX:a,startY:o,x:a,y:o}}),r?.(t)},T=n=>{let{userSelectionRect:r,nodeInternals:i,edges:a,transform:o,onNodesChange:s,onEdgesChange:c,nodeOrigin:l,getNodes:u}=p.getState();if(!e||!g.current||!r)return;p.setState({userSelectionActive:!0,nodesSelectionActive:!1});let d=ql(n,g.current),f=r.startX??0,_=r.startY??0,v={...r,x:d.x<f?d.x:f,y:d.y<_?d.y:_,width:Math.abs(d.x-f),height:Math.abs(d.y-_)},y=u(),b=Pu(i,v,o,t===tu.Partial,!0,l),x=Fu(b,a).map(e=>e.id),S=b.map(e=>e.id);if(m.current!==S.length){m.current=S.length;let e=tf(y,S);e.length&&s?.(e)}if(h.current!==x.length){h.current=x.length;let e=tf(a,x);e.length&&c?.(e)}p.setState({userSelectionRect:v})},E=e=>{if(e.button!==0)return;let{userSelectionRect:t}=p.getState();!_&&t&&e.target===f.current&&x?.(e),p.setState({nodesSelectionActive:m.current>0}),b(),i?.(e)},D=e=>{_&&(p.setState({nodesSelectionActive:m.current>0}),i?.(e)),b()},O=v&&(e||_);return J.createElement(`div`,{className:U([`react-flow__pane`,{dragging:y,selection:e}]),onClick:O?void 0:nf(x,f),onContextMenu:nf(S,f),onWheel:nf(C,f),onMouseEnter:O?void 0:c,onMouseDown:O?w:void 0,onMouseMove:O?T:l,onMouseUp:O?E:void 0,onMouseLeave:O?D:u,ref:f,style:Vd},d,J.createElement(Xd,null))});af.displayName=`Pane`;function of(e,t){let n=e.parentNode||e.parentId;if(!n)return!1;let r=t.get(n);return r?r.selected?!0:of(r,t):!1}function sf(e,t,n){let r=e;do{if(r?.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function cf(e,t,n,r){return Array.from(e.values()).filter(n=>(n.selected||n.id===r)&&(!n.parentNode||n.parentId||!of(n,e))&&(n.draggable||t&&n.draggable===void 0)).map(e=>({id:e.id,position:e.position||{x:0,y:0},positionAbsolute:e.positionAbsolute||{x:0,y:0},distance:{x:n.x-(e.positionAbsolute?.x??0),y:n.y-(e.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:e.extent,parentNode:e.parentNode||e.parentId,parentId:e.parentNode||e.parentId,width:e.width,height:e.height,expandParent:e.expandParent}))}function lf(e,t){return!t||t===`parent`?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function uf(e,t,n,r,i=[0,0],a){let o=lf(e,e.extent||r),s=o,c=e.parentNode||e.parentId;if(e.extent===`parent`&&!e.expandParent)if(c&&e.width&&e.height){let t=n.get(c),{x:r,y:a}=Mu(t,i).positionAbsolute;s=t&&Bl(r)&&Bl(a)&&Bl(t.width)&&Bl(t.height)?[[r+e.width*i[0],a+e.height*i[1]],[r+t.width-e.width+e.width*i[0],a+t.height-e.height+e.height*i[1]]]:s}else a?.(`005`,bl.error005()),s=o;else if(e.extent&&c&&e.extent!==`parent`){let{x:t,y:r}=Mu(n.get(c),i).positionAbsolute;s=[[e.extent[0][0]+t,e.extent[0][1]+r],[e.extent[1][0]+t,e.extent[1][1]+r]]}let l={x:0,y:0};c&&(l=Mu(n.get(c),i).positionAbsolute);let u=s&&s!==`parent`?Al(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function df({nodeId:e,dragItems:t,nodeInternals:n}){let r=t.map(e=>({...n.get(e.id),position:e.position,positionAbsolute:e.positionAbsolute}));return[e?r.find(t=>t.id===e):r[0],r]}var ff=(e,t,n,r)=>{let i=t.querySelectorAll(e);if(!i||!i.length)return null;let a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*r[0],y:o.height*r[1]};return a.map(e=>{let t=e.getBoundingClientRect();return{id:e.getAttribute(`data-handleid`),position:e.getAttribute(`data-handlepos`),x:(t.left-o.left-s.x)/n,y:(t.top-o.top-s.y)/n,...Ol(e)}})};function pf(e,t,n){return n===void 0?n:r=>{let i=t().nodeInternals.get(e);i&&n(r,{...i})}}function mf({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,bl.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function hf(){let e=Cl();return(0,J.useCallback)(({sourceEvent:t})=>{let{transform:n,snapGrid:r,snapToGrid:i}=e.getState(),a=t.touches?t.touches[0].clientX:t.clientX,o=t.touches?t.touches[0].clientY:t.clientY,s={x:(a-n[0])/n[2],y:(o-n[1])/n[2]};return{xSnapped:i?r[0]*Math.round(s.x/r[0]):s.x,ySnapped:i?r[1]*Math.round(s.y/r[1]):s.y,...s}},[])}function gf(e){return(t,n,r)=>e?.(t,r)}function _f({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){let s=Cl(),[c,l]=(0,J.useState)(!1),u=(0,J.useRef)([]),d=(0,J.useRef)({x:null,y:null}),f=(0,J.useRef)(0),p=(0,J.useRef)(null),m=(0,J.useRef)({x:0,y:0}),h=(0,J.useRef)(null),g=(0,J.useRef)(!1),_=(0,J.useRef)(!1),v=(0,J.useRef)(!1),y=hf();return(0,J.useEffect)(()=>{if(e?.current){let c=Ae(e.current),b=({x:e,y:t})=>{let{nodeInternals:n,onNodeDrag:r,onSelectionDrag:a,updateNodePositions:o,nodeExtent:c,snapGrid:f,snapToGrid:p,nodeOrigin:m,onError:g}=s.getState();d.current={x:e,y:t};let _=!1,v={x:0,y:0,x2:0,y2:0};if(u.current.length>1&&c&&(v=Fl(Nu(u.current,m))),u.current=u.current.map(r=>{let i={x:e-r.distance.x,y:t-r.distance.y};p&&(i.x=f[0]*Math.round(i.x/f[0]),i.y=f[1]*Math.round(i.y/f[1]));let a=[[c[0][0],c[0][1]],[c[1][0],c[1][1]]];u.current.length>1&&c&&!r.extent&&(a[0][0]=r.positionAbsolute.x-v.x+c[0][0],a[1][0]=r.positionAbsolute.x+(r.width??0)-v.x2+c[1][0],a[0][1]=r.positionAbsolute.y-v.y+c[0][1],a[1][1]=r.positionAbsolute.y+(r.height??0)-v.y2+c[1][1]);let o=uf(r,i,n,a,m,g);return _=_||r.position.x!==o.position.x||r.position.y!==o.position.y,r.position=o.position,r.positionAbsolute=o.positionAbsolute,r}),!_)return;o(u.current,!0,!0),l(!0);let y=i?r:gf(a);if(y&&h.current){let[e,t]=df({nodeId:i,dragItems:u.current,nodeInternals:n});y(h.current,e,t)}},x=()=>{if(!p.current)return;let[e,t]=Ml(m.current,p.current);if(e!==0||t!==0){let{transform:n,panBy:r}=s.getState();d.current.x=(d.current.x??0)-e/n[2],d.current.y=(d.current.y??0)-t/n[2],r({x:e,y:t})&&b(d.current)}f.current=requestAnimationFrame(x)},S=t=>{let{nodeInternals:n,multiSelectionActive:r,nodesDraggable:c,unselectNodesAndEdges:l,onNodeDragStart:f,onSelectionDragStart:p}=s.getState();_.current=!0;let m=i?f:gf(p);(!o||!a)&&!r&&i&&(n.get(i)?.selected||l()),i&&a&&o&&mf({id:i,store:s,nodeRef:e});let h=y(t);if(d.current=h,u.current=cf(n,c,h,i),m&&u.current){let[e,r]=df({nodeId:i,dragItems:u.current,nodeInternals:n});m(t.sourceEvent,e,r)}};if(t)c.on(`.drag`,null);else{let t=De().on(`start`,e=>{let{domNode:t,nodeDragThreshold:n}=s.getState();n===0&&S(e),v.current=!1,d.current=y(e),p.current=t?.getBoundingClientRect()||null,m.current=ql(e.sourceEvent,p.current)}).on(`drag`,e=>{let t=y(e),{autoPanOnNodeDrag:n,nodeDragThreshold:r}=s.getState();if(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1&&(v.current=!0),!v.current){if(!g.current&&_.current&&n&&(g.current=!0,x()),!_.current){let n=t.xSnapped-(d?.current?.x??0),i=t.ySnapped-(d?.current?.y??0);Math.sqrt(n*n+i*i)>r&&S(e)}(d.current.x!==t.xSnapped||d.current.y!==t.ySnapped)&&u.current&&_.current&&(h.current=e.sourceEvent,m.current=ql(e.sourceEvent,p.current),b(t))}}).on(`end`,e=>{if(!(!_.current||v.current)&&(l(!1),g.current=!1,_.current=!1,cancelAnimationFrame(f.current),u.current)){let{updateNodePositions:t,nodeInternals:n,onNodeDragStop:r,onSelectionDragStop:a}=s.getState(),o=i?r:gf(a);if(t(u.current,!1,!1),o){let[t,r]=df({nodeId:i,dragItems:u.current,nodeInternals:n});o(e.sourceEvent,t,r)}}}).filter(t=>{let i=t.target;return!t.button&&(!n||!sf(i,`.${n}`,e))&&(!r||sf(i,r,e))});return c.call(t),()=>{c.on(`.drag`,null)}}}},[e,t,n,r,a,s,i,o,y]),c}function vf(){let e=Cl();return(0,J.useCallback)(t=>{let{nodeInternals:n,nodeExtent:r,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:s,onError:c,nodesDraggable:l}=e.getState(),u=a().filter(e=>e.selected&&(e.draggable||l&&e.draggable===void 0)),d=o?s[0]:5,f=o?s[1]:5,p=t.isShiftPressed?4:1,m=t.x*d*p,h=t.y*f*p;i(u.map(e=>{if(e.positionAbsolute){let t={x:e.positionAbsolute.x+m,y:e.positionAbsolute.y+h};o&&(t.x=s[0]*Math.round(t.x/s[0]),t.y=s[1]*Math.round(t.y/s[1]));let{positionAbsolute:i,position:a}=uf(e,t,n,r,void 0,c);e.position=a,e.positionAbsolute=i}return e}),!0,!1)},[])}var yf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},bf=e=>{let t=({id:t,type:n,data:r,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:s,selected:c,onClick:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onContextMenu:p,onDoubleClick:m,style:h,className:g,isDraggable:_,isSelectable:v,isConnectable:y,isFocusable:b,selectNodesOnDrag:x,sourcePosition:S,targetPosition:C,hidden:w,resizeObserver:T,dragHandle:E,zIndex:D,isParent:O,noDragClassName:k,noPanClassName:A,initialized:j,disableKeyboardA11y:M,ariaLabel:N,rfId:P,hasHandleBounds:F})=>{let I=Cl(),L=(0,J.useRef)(null),R=(0,J.useRef)(null),ee=(0,J.useRef)(S),z=(0,J.useRef)(C),te=(0,J.useRef)(n),B=v||_||l||u||d||f,ne=vf(),re=pf(t,I.getState,u),V=pf(t,I.getState,d),ie=pf(t,I.getState,f),ae=pf(t,I.getState,p),oe=pf(t,I.getState,m),se=e=>{let{nodeDragThreshold:n}=I.getState();if(v&&(!x||!_||n>0)&&mf({id:t,store:I,nodeRef:L}),l){let n=I.getState().nodeInternals.get(t);n&&l(e,{...n})}},ce=e=>{Gl(e)||M||(Hl.includes(e.key)&&v?mf({id:t,store:I,unselect:e.key===`Escape`,nodeRef:L}):_&&c&&Object.prototype.hasOwnProperty.call(yf,e.key)&&(I.setState({ariaLiveMessage:`Moved selected node ${e.key.replace(`Arrow`,``).toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ne({x:yf[e.key].x,y:yf[e.key].y,isShiftPressed:e.shiftKey})))};(0,J.useEffect)(()=>()=>{R.current&&=(T?.unobserve(R.current),null)},[]),(0,J.useEffect)(()=>{if(L.current&&!w){let e=L.current;(!j||!F||R.current!==e)&&(R.current&&T?.unobserve(R.current),T?.observe(e),R.current=e)}},[w,j,F]),(0,J.useEffect)(()=>{let e=te.current!==n,r=ee.current!==S,i=z.current!==C;L.current&&(e||r||i)&&(e&&(te.current=n),r&&(ee.current=S),i&&(z.current=C),I.getState().updateNodeDimensions([{id:t,nodeElement:L.current,forceUpdate:!0}]))},[t,n,S,C]);let le=_f({nodeRef:L,disabled:w||!_,noDragClassName:k,handleSelector:E,nodeId:t,isSelectable:v,selectNodesOnDrag:x});return w?null:J.createElement(`div`,{className:U([`react-flow__node`,`react-flow__node-${n}`,{[A]:_},g,{selected:c,selectable:v,parent:O,dragging:le}]),ref:L,style:{zIndex:D,transform:`translate(${o}px,${s}px)`,pointerEvents:B?`all`:`none`,visibility:j?`visible`:`hidden`,...h},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:re,onMouseMove:V,onMouseLeave:ie,onContextMenu:ae,onClick:se,onDoubleClick:oe,onKeyDown:b?ce:void 0,tabIndex:b?0:void 0,role:b?`button`:void 0,"aria-describedby":M?void 0:`${_d}-${P}`,"aria-label":N},J.createElement(Su,{value:t},J.createElement(e,{id:t,data:r,type:n,xPos:i,yPos:a,selected:c,isConnectable:y,sourcePosition:S,targetPosition:C,dragging:le,dragHandle:E,zIndex:D})))};return t.displayName=`NodeWrapper`,(0,J.memo)(t)},xf=e=>({...Nu(e.getNodes().filter(e=>e.selected),e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive});function Sf({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=Cl(),{width:i,height:a,x:o,y:s,transformString:c,userSelectionActive:l}=Sl(xf,W),u=vf(),d=(0,J.useRef)(null);if((0,J.useEffect)(()=>{n||d.current?.focus({preventScroll:!0})},[n]),_f({nodeRef:d}),l||!i||!a)return null;let f=e?t=>{e(t,r.getState().getNodes().filter(e=>e.selected))}:void 0;return J.createElement(`div`,{className:U([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:c}},J.createElement(`div`,{ref:d,className:`react-flow__nodesselection-rect`,onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(yf,e.key)&&u({x:yf[e.key].x,y:yf[e.key].y,isShiftPressed:e.shiftKey})},style:{width:i,height:a,top:s,left:o}}))}var Cf=(0,J.memo)(Sf),wf=e=>e.nodesSelectionActive,Tf=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:c,onMoveStart:l,onMoveEnd:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:p,onSelectionStart:m,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:_,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:w,zoomOnDoubleClick:T,panOnDrag:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,onSelectionContextMenu:M,noWheelClassName:N,noPanClassName:P,disableKeyboardA11y:F})=>{let I=Sl(wf),L=Cd(d),R=Cd(_),ee=R||E,z=R||S,te=L||f&&ee!==!0;return zd({deleteKeyCode:s,multiSelectionKeyCode:g}),J.createElement(Jd,{onMove:c,onMoveStart:l,onMoveEnd:u,onPaneContextMenu:a,elementsSelectable:y,zoomOnScroll:b,zoomOnPinch:x,panOnScroll:z,panOnScrollSpeed:C,panOnScrollMode:w,zoomOnDoubleClick:T,panOnDrag:!L&&ee,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,zoomActivationKeyCode:v,preventScrolling:j,noWheelClassName:N,noPanClassName:P},J.createElement(af,{onSelectionStart:m,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:ee,isSelecting:!!te,selectionMode:p},e,I&&J.createElement(Cf,{onSelectionContextMenu:M,noPanClassName:P,disableKeyboardA11y:F})))};Tf.displayName=`FlowRenderer`;var Ef=(0,J.memo)(Tf);function Df(e){return Sl((0,J.useCallback)(t=>e?Pu(t.nodeInternals,{x:0,y:0,width:t.width,height:t.height},t.transform,!0):t.getNodes(),[e]))}function Of(e){let t={input:bf(e.input||nd),default:bf(e.default||ed),output:bf(e.output||id),group:bf(e.group||ad)},n=Object.keys(e).filter(e=>![`input`,`default`,`output`,`group`].includes(e)).reduce((t,n)=>(t[n]=bf(e[n]||ed),t),{});return{...t,...n}}var kf=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r||i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},Af=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),jf=e=>{let{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:a,onError:o}=Sl(Af,W),s=Df(e.onlyRenderVisibleElements),c=(0,J.useRef)(),l=(0,J.useMemo)(()=>{if(typeof ResizeObserver>`u`)return null;let e=new ResizeObserver(e=>{a(e.map(e=>({id:e.target.getAttribute(`data-id`),nodeElement:e.target,forceUpdate:!0})))});return c.current=e,e},[]);return(0,J.useEffect)(()=>()=>{c?.current?.disconnect()},[]),J.createElement(`div`,{className:`react-flow__nodes`,style:Vd},s.map(a=>{let s=a.type||`default`;e.nodeTypes[s]||(o?.(`003`,bl.error003(s)),s=`default`);let c=e.nodeTypes[s]||e.nodeTypes.default,u=!!(a.draggable||t&&a.draggable===void 0),d=!!(a.selectable||i&&a.selectable===void 0),f=!!(a.connectable||n&&a.connectable===void 0),p=!!(a.focusable||r&&a.focusable===void 0),m=e.nodeExtent?Al(a.positionAbsolute,e.nodeExtent):a.positionAbsolute,h=m?.x??0,g=m?.y??0,_=kf({x:h,y:g,width:a.width??0,height:a.height??0,origin:e.nodeOrigin});return J.createElement(c,{key:a.id,id:a.id,className:a.className,style:a.style,type:s,data:a.data,sourcePosition:a.sourcePosition||Z.Bottom,targetPosition:a.targetPosition||Z.Top,hidden:a.hidden,xPos:h,yPos:g,xPosOrigin:_.x,yPosOrigin:_.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!a.selected,isDraggable:u,isSelectable:d,isConnectable:f,isFocusable:p,resizeObserver:l,dragHandle:a.dragHandle,zIndex:a[Vl]?.z??0,isParent:!!a[Vl]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!a.width&&!!a.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:a.ariaLabel,hasHandleBounds:!!a[Vl]?.handleBounds})}))};jf.displayName=`NodeRenderer`;var Mf=(0,J.memo)(jf),Nf=(e,t,n)=>n===Z.Left?e-t:n===Z.Right?e+t:e,Pf=(e,t,n)=>n===Z.Top?e-t:n===Z.Bottom?e+t:e,Ff=`react-flow__edgeupdater`,If=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>J.createElement(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:U([Ff,`${Ff}-${s}`]),cx:Nf(t,r,e),cy:Pf(n,r,e),r,stroke:`transparent`,fill:`transparent`}),Lf=()=>!0,Rf=e=>{let t=({id:t,className:n,type:r,data:i,onClick:a,onEdgeDoubleClick:o,selected:s,animated:c,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,style:h,source:g,target:_,sourceX:v,sourceY:y,targetX:b,targetY:x,sourcePosition:S,targetPosition:C,elementsSelectable:w,hidden:T,sourceHandleId:E,targetHandleId:D,onContextMenu:O,onMouseEnter:k,onMouseMove:A,onMouseLeave:j,reconnectRadius:M,onReconnect:N,onReconnectStart:P,onReconnectEnd:F,markerEnd:I,markerStart:L,rfId:R,ariaLabel:ee,isFocusable:z,isReconnectable:te,pathOptions:B,interactionWidth:ne,disableKeyboardA11y:re})=>{let V=(0,J.useRef)(null),[ie,ae]=(0,J.useState)(!1),[oe,se]=(0,J.useState)(!1),ce=Cl(),le=(0,J.useMemo)(()=>`url('#${Eu(L,R)}')`,[L,R]),ue=(0,J.useMemo)(()=>`url('#${Eu(I,R)}')`,[I,R]);if(T)return null;let de=e=>{let{edges:n,addSelectedEdges:r,unselectNodesAndEdges:i,multiSelectionActive:o}=ce.getState(),s=n.find(e=>e.id===t);s&&(w&&(ce.setState({nodesSelectionActive:!1}),s.selected&&o?(i({nodes:[],edges:[s]}),V.current?.blur()):r([t])),a&&a(e,s))},H=Xl(t,ce.getState,o),fe=Xl(t,ce.getState,O),pe=Xl(t,ce.getState,k),me=Xl(t,ce.getState,A),he=Xl(t,ce.getState,j),ge=(e,n)=>{if(e.button!==0)return;let{edges:r,isValidConnection:i}=ce.getState(),a=n?_:g,o=(n?D:E)||null,s=n?`target`:`source`,c=i||Lf,l=n,u=r.find(e=>e.id===t);se(!0),P?.(e,u,s),qu({event:e,handleId:o,nodeId:a,onConnect:e=>N?.(u,e),isTarget:l,getState:ce.getState,setState:ce.setState,isValidConnection:c,edgeUpdaterType:s,onReconnectEnd:e=>{se(!1),F?.(e,u,s)}})},_e=e=>ge(e,!0),ve=e=>ge(e,!1),ye=()=>ae(!0),be=()=>ae(!1),xe=!w&&!a;return J.createElement(`g`,{className:U([`react-flow__edge`,`react-flow__edge-${r}`,n,{selected:s,animated:c,inactive:xe,updating:ie}]),onClick:de,onDoubleClick:H,onContextMenu:fe,onMouseEnter:pe,onMouseMove:me,onMouseLeave:he,onKeyDown:z?e=>{if(!re&&Hl.includes(e.key)&&w){let{unselectNodesAndEdges:n,addSelectedEdges:r,edges:i}=ce.getState();e.key===`Escape`?(V.current?.blur(),n({edges:[i.find(e=>e.id===t)]})):r([t])}}:void 0,tabIndex:z?0:void 0,role:z?`button`:`img`,"data-testid":`rf__edge-${t}`,"aria-label":ee===null?void 0:ee||`Edge from ${g} to ${_}`,"aria-describedby":z?`${vd}-${R}`:void 0,ref:V},!oe&&J.createElement(e,{id:t,source:g,target:_,selected:s,animated:c,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:m,data:i,style:h,sourceX:v,sourceY:y,targetX:b,targetY:x,sourcePosition:S,targetPosition:C,sourceHandleId:E,targetHandleId:D,markerStart:le,markerEnd:ue,pathOptions:B,interactionWidth:ne}),te&&J.createElement(J.Fragment,null,(te===`source`||te===!0)&&J.createElement(If,{position:S,centerX:v,centerY:y,radius:M,onMouseDown:_e,onMouseEnter:ye,onMouseOut:be,type:`source`}),(te===`target`||te===!0)&&J.createElement(If,{position:C,centerX:b,centerY:x,radius:M,onMouseDown:ve,onMouseEnter:ye,onMouseOut:be,type:`target`})))};return t.displayName=`EdgeWrapper`,(0,J.memo)(t)};function zf(e){let t={default:Rf(e.default||bu),straight:Rf(e.bezier||gu),step:Rf(e.step||mu),smoothstep:Rf(e.step||pu),simplebezier:Rf(e.simplebezier||ou)},n=Object.keys(e).filter(e=>![`default`,`bezier`].includes(e)).reduce((t,n)=>(t[n]=Rf(e[n]||bu),t),{});return{...t,...n}}function Bf(e,t,n=null){let r=(n?.x||0)+t.x,i=(n?.y||0)+t.y,a=n?.width||t.width,o=n?.height||t.height;switch(e){case Z.Top:return{x:r+a/2,y:i};case Z.Right:return{x:r+a,y:i+o/2};case Z.Bottom:return{x:r+a/2,y:i+o};case Z.Left:return{x:r,y:i+o/2}}}function Vf(e,t){return e?e.length===1||!t?e[0]:t&&e.find(e=>e.id===t)||null:null}var Hf=(e,t,n,r,i,a)=>{let o=Bf(n,e,t),s=Bf(a,r,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function Uf({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:a,width:o,height:s,transform:c}){let l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);let u=Fl({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:o/c[2],height:s/c[2]}),d=Math.max(0,Math.min(u.x2,l.x2)-Math.max(u.x,l.x)),f=Math.max(0,Math.min(u.y2,l.y2)-Math.max(u.y,l.y));return Math.ceil(d*f)>0}function Wf(e){let t=e?.[Vl]?.handleBounds||null,n=t&&e?.width&&e?.height&&e?.positionAbsolute?.x!==void 0&&e?.positionAbsolute?.y!==void 0;return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!n]}var Gf=[{level:0,isMaxLevel:!0,edges:[]}];function Kf(e,t,n=!1){let r=-1,i=e.reduce((e,i)=>{let a=Bl(i.zIndex),o=a?i.zIndex:0;if(n){let e=t.get(i.target),n=t.get(i.source),r=i.selected||e?.selected||n?.selected,s=Math.max(n?.[Vl]?.z||0,e?.[Vl]?.z||0,1e3);o=(a?i.zIndex:0)+(r?s:0)}return e[o]?e[o].push(i):e[o]=[i],r=o>r?o:r,e},{}),a=Object.entries(i).map(([e,t])=>{let n=+e;return{edges:t,level:n,isMaxLevel:n===r}});return a.length===0?Gf:a}function qf(e,t,n){return Kf(Sl((0,J.useCallback)(n=>e?n.edges.filter(e=>{let r=t.get(e.source),i=t.get(e.target);return r?.width&&r?.height&&i?.width&&i?.height&&Uf({sourcePos:r.positionAbsolute||{x:0,y:0},targetPos:i.positionAbsolute||{x:0,y:0},sourceWidth:r.width,sourceHeight:r.height,targetWidth:i.width,targetHeight:i.height,width:n.width,height:n.height,transform:n.transform})}):n.edges,[e,t])),t,n)}var Jf=({color:e=`none`,strokeWidth:t=1})=>J.createElement(`polyline`,{style:{stroke:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`,points:`-5,-4 0,0 -5,4`}),Yf=({color:e=`none`,strokeWidth:t=1})=>J.createElement(`polyline`,{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),Xf={[ru.Arrow]:Jf,[ru.ArrowClosed]:Yf};function Zf(e){let t=Cl();return(0,J.useMemo)(()=>Object.prototype.hasOwnProperty.call(Xf,e)?Xf[e]:(t.getState().onError?.(`009`,bl.error009(e)),null),[e])}var Qf=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Zf(t);return c?J.createElement(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`},J.createElement(c,{color:n,strokeWidth:o})):null},$f=({defaultColor:e,rfId:t})=>n=>{let r=[];return n.edges.reduce((n,i)=>([i.markerStart,i.markerEnd].forEach(i=>{if(i&&typeof i==`object`){let a=Eu(i,t);r.includes(a)||(n.push({id:a,color:i.color||e,...i}),r.push(a))}}),n),[]).sort((e,t)=>e.id.localeCompare(t.id))},ep=({defaultColor:e,rfId:t})=>{let n=Sl((0,J.useCallback)($f({defaultColor:e,rfId:t}),[e,t]),(e,t)=>!(e.length!==t.length||e.some((e,n)=>e.id!==t[n].id)));return J.createElement(`defs`,null,n.map(e=>J.createElement(Qf,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient})))};ep.displayName=`MarkerDefinitions`;var tp=(0,J.memo)(ep),np=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),rp=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,reconnectRadius:h,children:g,disableKeyboardA11y:_})=>{let{edgesFocusable:v,edgesUpdatable:y,elementsSelectable:b,width:x,height:S,connectionMode:C,nodeInternals:w,onError:T}=Sl(np,W),E=qf(t,w,n);return x?J.createElement(J.Fragment,null,E.map(({level:t,edges:n,isMaxLevel:g})=>J.createElement(`svg`,{key:t,style:{zIndex:t},width:x,height:S,className:`react-flow__edges react-flow__container`},g&&J.createElement(tp,{defaultColor:e,rfId:r}),J.createElement(`g`,null,n.map(e=>{let[t,n,g]=Wf(w.get(e.source)),[x,S,E]=Wf(w.get(e.target));if(!g||!E)return null;let D=e.type||`default`;i[D]||(T?.(`011`,bl.error011(D)),D=`default`);let O=i[D]||i.default,k=C===$l.Strict?S.target:(S.target??[]).concat(S.source??[]),A=Vf(n.source,e.sourceHandle),j=Vf(k,e.targetHandle),M=A?.position||Z.Bottom,N=j?.position||Z.Top,P=!!(e.focusable||v&&e.focusable===void 0),F=e.reconnectable||e.updatable,I=f!==void 0&&(F||y&&F===void 0);if(!A||!j)return T?.(`008`,bl.error008(A,e)),null;let{sourceX:L,sourceY:R,targetX:ee,targetY:z}=Hf(t,A,M,x,j,N);return J.createElement(O,{key:e.id,id:e.id,className:U([e.className,a]),type:D,data:e.data,selected:!!e.selected,animated:!!e.animated,hidden:!!e.hidden,label:e.label,labelStyle:e.labelStyle,labelShowBg:e.labelShowBg,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,source:e.source,target:e.target,sourceHandleId:e.sourceHandle,targetHandleId:e.targetHandle,markerEnd:e.markerEnd,markerStart:e.markerStart,sourceX:L,sourceY:R,targetX:ee,targetY:z,sourcePosition:M,targetPosition:N,elementsSelectable:b,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,onEdgeDoubleClick:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:m,reconnectRadius:h,rfId:r,ariaLabel:e.ariaLabel,isFocusable:P,isReconnectable:I,pathOptions:`pathOptions`in e?e.pathOptions:void 0,interactionWidth:e.interactionWidth,disableKeyboardA11y:_})})))),g):null};rp.displayName=`EdgeRenderer`;var ip=(0,J.memo)(rp),ap=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function op({children:e}){let t=Sl(ap);return J.createElement(`div`,{className:`react-flow__viewport react-flow__container`,style:{transform:t}},e)}function sp(e){let t=Ld(),n=(0,J.useRef)(!1);(0,J.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var cp={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top},lp=({nodeId:e,handleType:t,style:n,type:r=nu.Bezier,CustomComponent:i,connectionStatus:a})=>{let{fromNode:o,handleId:s,toX:c,toY:l,connectionMode:u}=Sl((0,J.useCallback)(t=>({fromNode:t.nodeInternals.get(e),handleId:t.connectionHandleId,toX:(t.connectionPosition.x-t.transform[0])/t.transform[2],toY:(t.connectionPosition.y-t.transform[1])/t.transform[2],connectionMode:t.connectionMode}),[e]),W),d=o?.[Vl]?.handleBounds,f=d?.[t];if(u===$l.Loose&&(f||=d?.[t===`source`?`target`:`source`]),!o||!f)return null;let p=s?f.find(e=>e.id===s):f[0],m=p?p.x+p.width/2:(o.width??0)/2,h=p?p.y+p.height/2:o.height??0,g=(o.positionAbsolute?.x??0)+m,_=(o.positionAbsolute?.y??0)+h,v=p?.position,y=v?cp[v]:null;if(!v||!y)return null;if(i)return J.createElement(i,{connectionLineType:r,connectionLineStyle:n,fromNode:o,fromHandle:p,fromX:g,fromY:_,toX:c,toY:l,fromPosition:v,toPosition:y,connectionStatus:a});let b=``,x={sourceX:g,sourceY:_,sourcePosition:v,targetX:c,targetY:l,targetPosition:y};return r===nu.Bezier?[b]=yu(x):r===nu.Step?[b]=fu({...x,borderRadius:0}):r===nu.SmoothStep?[b]=fu(x):r===nu.SimpleBezier?[b]=au(x):b=`M${g},${_} ${c},${l}`,J.createElement(`path`,{d:b,fill:`none`,className:`react-flow__connection-path`,style:n})};lp.displayName=`ConnectionLine`;var up=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function dp({containerStyle:e,style:t,type:n,component:r}){let{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:c,connectionStatus:l}=Sl(up,W);return i&&a&&s&&o?J.createElement(`svg`,{style:e,width:s,height:c,className:`react-flow__edges react-flow__connectionline react-flow__container`},J.createElement(`g`,{className:U([`react-flow__connection`,l])},J.createElement(lp,{nodeId:i,handleType:a,style:t,type:n,CustomComponent:r,connectionStatus:l}))):null}function fp(e,t){return(0,J.useRef)(null),Cl(),(0,J.useMemo)(()=>t(e),[e])}var pp=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:c,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:h,onSelectionEnd:g,connectionLineType:_,connectionLineStyle:v,connectionLineComponent:y,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:S,selectionMode:C,multiSelectionKeyCode:w,panActivationKeyCode:T,zoomActivationKeyCode:E,deleteKeyCode:D,onlyRenderVisibleElements:O,elementsSelectable:k,selectNodesOnDrag:A,defaultViewport:j,translateExtent:M,minZoom:N,maxZoom:P,preventScrolling:F,defaultMarkerColor:I,zoomOnScroll:L,zoomOnPinch:R,panOnScroll:ee,panOnScrollSpeed:z,panOnScrollMode:te,zoomOnDoubleClick:B,panOnDrag:ne,onPaneClick:re,onPaneMouseEnter:V,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,onEdgeContextMenu:ce,onEdgeMouseEnter:le,onEdgeMouseMove:ue,onEdgeMouseLeave:de,onReconnect:H,onReconnectStart:fe,onReconnectEnd:pe,reconnectRadius:me,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,elevateEdgesOnSelect:ve,disableKeyboardA11y:ye,nodeOrigin:be,nodeExtent:xe,rfId:Se})=>{let Ce=fp(e,Of),we=fp(t,zf);return sp(a),J.createElement(Ef,{onPaneClick:re,onPaneMouseEnter:V,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,deleteKeyCode:D,selectionKeyCode:x,selectionOnDrag:S,selectionMode:C,onSelectionStart:h,onSelectionEnd:g,multiSelectionKeyCode:w,panActivationKeyCode:T,zoomActivationKeyCode:E,elementsSelectable:k,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:L,zoomOnPinch:R,zoomOnDoubleClick:B,panOnScroll:ee,panOnScrollSpeed:z,panOnScrollMode:te,panOnDrag:ne,defaultViewport:j,translateExtent:M,minZoom:N,maxZoom:P,onSelectionContextMenu:m,preventScrolling:F,noDragClassName:he,noWheelClassName:ge,noPanClassName:_e,disableKeyboardA11y:ye},J.createElement(op,null,J.createElement(ip,{edgeTypes:we,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:O,onEdgeContextMenu:ce,onEdgeMouseEnter:le,onEdgeMouseMove:ue,onEdgeMouseLeave:de,onReconnect:H,onReconnectStart:fe,onReconnectEnd:pe,reconnectRadius:me,defaultMarkerColor:I,noPanClassName:_e,elevateEdgesOnSelect:!!ve,disableKeyboardA11y:ye,rfId:Se},J.createElement(dp,{style:v,type:_,component:y,containerStyle:b})),J.createElement(`div`,{className:`react-flow__edgelabel-renderer`}),J.createElement(Mf,{nodeTypes:Ce,onNodeClick:o,onNodeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:p,selectNodesOnDrag:A,onlyRenderVisibleElements:O,noPanClassName:_e,noDragClassName:he,disableKeyboardA11y:ye,nodeOrigin:be,nodeExtent:xe,rfId:Se})))};pp.displayName=`GraphView`;var mp=(0,J.memo)(pp),hp=[[-1/0,-1/0],[1/0,1/0]],gp={rfId:`1`,width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:hp,nodeExtent:hp,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:`source`,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:$l.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Ul,isValidConnection:void 0},_p=()=>je((e,t)=>({...gp,setNodes:n=>{let{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:Od(n,r,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{let{defaultEdgeOptions:r={}}=t();e({edges:n.map(e=>({...r,...e}))})},setDefaultNodesAndEdges:(n,r)=>{let i=n!==void 0,a=r!==void 0;e({nodeInternals:i?Od(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map,edges:a?r:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:n=>{let{onNodesChange:r,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:c,nodeOrigin:l}=t(),u=c?.querySelector(`.react-flow__viewport`);if(!u)return;let d=window.getComputedStyle(u),{m22:f}=new window.DOMMatrixReadOnly(d.transform),p=n.reduce((e,t)=>{let n=i.get(t.id);if(n?.hidden)i.set(n.id,{...n,[Vl]:{...n[Vl],handleBounds:void 0}});else if(n){let r=Ol(t.nodeElement);r.width&&r.height&&(n.width!==r.width||n.height!==r.height||t.forceUpdate)&&(i.set(n.id,{...n,[Vl]:{...n[Vl],handleBounds:{source:ff(`.source`,t.nodeElement,f,l),target:ff(`.target`,t.nodeElement,f,l)}},...r}),e.push({id:n.id,type:`dimensions`,dimensions:r}))}return e},[]);Dd(i,l);let m=o||a&&!o&&kd(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:m}),p?.length>0&&r?.(p)},updateNodePositions:(e,n=!0,r=!1)=>{let{triggerNodeChanges:i}=t();i(e.map(e=>{let t={id:e.id,type:`position`,dragging:r};return n&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t}))},triggerNodeChanges:n=>{let{onNodesChange:r,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:c}=t();n?.length&&(a&&e({nodeInternals:Od($d(n,s()),i,o,c)}),r?.(n))},addSelectedNodes:n=>{let{multiSelectionActive:r,edges:i,getNodes:a}=t(),o,s=null;r?o=n.map(e=>ef(e,!0)):(o=tf(a(),n),s=tf(i,[])),Md({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{let{multiSelectionActive:r,edges:i,getNodes:a}=t(),o,s=null;r?o=n.map(e=>ef(e,!0)):(o=tf(i,n),s=tf(a(),[])),Md({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{let{edges:i,getNodes:a}=t(),o=n||a(),s=r||i;Md({changedNodes:o.map(e=>(e.selected=!1,ef(e.id,!1))),changedEdges:s.map(e=>ef(e.id,!1)),get:t,set:e})},setMinZoom:n=>{let{d3Zoom:r,maxZoom:i}=t();r?.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{let{d3Zoom:r,minZoom:i}=t();r?.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{t().d3Zoom?.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{let{edges:n,getNodes:r}=t();Md({changedNodes:r().filter(e=>e.selected).map(e=>ef(e.id,!1)),changedEdges:n.filter(e=>e.selected).map(e=>ef(e.id,!1)),get:t,set:e})},setNodeExtent:n=>{let{nodeInternals:r}=t();r.forEach(e=>{e.positionAbsolute=Al(e.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:e=>{let{transform:n,width:r,height:i,d3Zoom:a,d3Selection:o,translateExtent:s}=t();if(!a||!o||!e.x&&!e.y)return!1;let c=Fe.translate(n[0]+e.x,n[1]+e.y).scale(n[2]),l=[[0,0],[r,i]],u=a?.constrain()(c,l,s);return a.transform(o,u),n[0]!==u.x||n[1]!==u.y||n[2]!==u.k},cancelConnection:()=>e({connectionNodeId:gp.connectionNodeId,connectionHandleId:gp.connectionHandleId,connectionHandleType:gp.connectionHandleType,connectionStatus:gp.connectionStatus,connectionStartHandle:gp.connectionStartHandle,connectionEndHandle:gp.connectionEndHandle}),reset:()=>e({...gp})}),Object.is),vp=({children:e})=>{let t=(0,J.useRef)(null);return t.current||=_p(),J.createElement(yl,{value:t.current},e)};vp.displayName=`ReactFlowProvider`;var yp=({children:e})=>(0,J.useContext)(vl)?J.createElement(J.Fragment,null,e):J.createElement(vp,null,e);yp.displayName=`ReactFlowWrapper`;var bp={input:nd,default:ed,output:id,group:ad},xp={default:bu,straight:gu,step:mu,smoothstep:pu,simplebezier:ou},Sp=[0,0],Cp=[15,15],wp={x:0,y:0,zoom:1},Tp={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0},Ep=(0,J.forwardRef)(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a=bp,edgeTypes:o=xp,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onSelectionChange:O,onSelectionDragStart:k,onSelectionDrag:A,onSelectionDragStop:j,onSelectionContextMenu:M,onSelectionStart:N,onSelectionEnd:P,connectionMode:F=$l.Strict,connectionLineType:I=nu.Bezier,connectionLineStyle:L,connectionLineComponent:R,connectionLineContainerStyle:ee,deleteKeyCode:z=`Backspace`,selectionKeyCode:te=`Shift`,selectionOnDrag:B=!1,selectionMode:ne=tu.Full,panActivationKeyCode:re=`Space`,multiSelectionKeyCode:V=Jl()?`Meta`:`Control`,zoomActivationKeyCode:ie=Jl()?`Meta`:`Control`,snapToGri
102d:ae=!1,snapGrid:oe=Cp,onlyRenderVisibleElements:se=!1,selectNodesOnDrag:ce=!0,nodesDraggable:le,nodesConnectable:ue,nodesFocusable:de,nodeOrigin:H=Sp,edgesFocusable:fe,edgesUpdatable:pe,elementsSelectable:me,defaultViewport:he=wp,minZoom:ge=.5,maxZoom:_e=2,translateExtent:ve=hp,preventScrolling:ye=!0,nodeExtent:be,defaultMarkerColor:xe=`#b1b1b7`,zoomOnScroll:Se=!0,zoomOnPinch:Ce=!0,panOnScroll:we=!1,panOnScrollSpeed:Te=.5,panOnScrollMode:Ee=eu.Free,zoomOnDoubleClick:De=!0,panOnDrag:Oe=!0,onPaneClick:ke,onPaneMouseEnter:Ae,onPaneMouseMove:je,onPaneMouseLeave:Me,onPaneScroll:Ne,onPaneContextMenu:Pe,children:Fe,onEdgeContextMenu:W,onEdgeDoubleClick:Ie,onEdgeMouseEnter:Le,onEdgeMouseMove:Re,onEdgeMouseLeave:ze,onEdgeUpdate:Be,onEdgeUpdateStart:Ve,onEdgeUpdateEnd:He,onReconnect:Ue,onReconnectStart:We,onReconnectEnd:Ge,reconnectRadius:Ke=10,edgeUpdaterRadius:qe=10,onNodesChange:Je,onEdgesChange:Ye,noDragClassName:Xe=`nodrag`,noWheelClassName:Ze=`nowheel`,noPanClassName:Qe=`nopan`,fitView:$e=!1,fitViewOptions:et,connectOnClick:tt=!0,attributionPosition:nt,proOptions:rt,defaultEdgeOptions:it,elevateNodesOnSelect:at=!0,elevateEdgesOnSelect:ot=!1,disableKeyboardA11y:st=!1,autoPanOnConnect:ct=!0,autoPanOnNodeDrag:lt=!0,connectionRadius:ut=20,isValidConnection:dt,onError:ft,style:pt,id:mt,nodeDragThreshold:ht,...gt},_t)=>{let vt=mt||`1`;return J.createElement(`div`,{...gt,style:{...pt,...Tp},ref:_t,className:U([`react-flow`,i]),"data-testid":`rf__wrapper`,id:mt},J.createElement(yp,null,J.createElement(mp,{onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:I,connectionLineStyle:L,connectionLineComponent:R,connectionLineContainerStyle:ee,selectionKeyCode:te,selectionOnDrag:B,selectionMode:ne,deleteKeyCode:z,multiSelectionKeyCode:V,panActivationKeyCode:re,zoomActivationKeyCode:ie,onlyRenderVisibleElements:se,selectNodesOnDrag:ce,defaultViewport:he,translateExtent:ve,minZoom:ge,maxZoom:_e,preventScrolling:ye,zoomOnScroll:Se,zoomOnPinch:Ce,zoomOnDoubleClick:De,panOnScroll:we,panOnScrollSpeed:Te,panOnScrollMode:Ee,panOnDrag:Oe,onPaneClick:ke,onPaneMouseEnter:Ae,onPaneMouseMove:je,onPaneMouseLeave:Me,onPaneScroll:Ne,onPaneContextMenu:Pe,onSelectionContextMenu:M,onSelectionStart:N,onSelectionEnd:P,onEdgeContextMenu:W,onEdgeDoubleClick:Ie,onEdgeMouseEnter:Le,onEdgeMouseMove:Re,onEdgeMouseLeave:ze,onReconnect:Ue??Be,onReconnectStart:We??Ve,onReconnectEnd:Ge??He,reconnectRadius:Ke??qe,defaultMarkerColor:xe,noDragClassName:Xe,noWheelClassName:Ze,noPanClassName:Qe,elevateEdgesOnSelect:ot,rfId:vt,disableKeyboardA11y:st,nodeOrigin:H,nodeExtent:be}),J.createElement(md,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:le,nodesConnectable:ue,nodesFocusable:de,edgesFocusable:fe,edgesUpdatable:pe,elementsSelectable:me,elevateNodesOnSelect:at,minZoom:ge,maxZoom:_e,nodeExtent:be,onNodesChange:Je,onEdgesChange:Ye,snapToGrid:ae,snapGrid:oe,connectionMode:F,translateExtent:ve,connectOnClick:tt,defaultEdgeOptions:it,fitView:$e,fitViewOptions:et,onNodesDelete:E,onEdgesDelete:D,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:A,onSelectionDragStart:k,onSelectionDragStop:j,noPanClassName:Qe,nodeOrigin:H,rfId:vt,autoPanOnConnect:ct,autoPanOnNodeDrag:lt,onError:ft,connectionRadius:ut,isValidConnection:dt,nodeDragThreshold:ht}),J.createElement(dd,{onSelectionChange:O}),Fe,J.createElement(El,{proOptions:rt,position:nt}),J.createElement(Sd,{rfId:vt,disableKeyboardA11y:st})))});Ep.displayName=`ReactFlow`;var Dp=`button-try`,Op=`button-back`,kp=`button_close_try`,Ap=e=>e?.map(e=>{if(!e.condition)return e;let t=(0,G.cloneDeep)(e),{and:n,or:r,...i}=t.condition??{},a=e=>!isNaN(Number(e))&&(0,G.isString)(e)&&e?.trim()!==``?Number(e):e===`true`?!0:e===`false`?!1:e,o=(e,n)=>(e?.forEach(e=>{`left`in e&&(e.left=a(e.left)),`right`in e&&(e.right=a(e.right))}),e?.length===1?(t.condition={...i,...e[0]},delete t.condition[n===`and`?`or`:`and`],!0):!1);return o(n,`and`)||o(r,`or`),t}),jp=e=>(0,G.isEmpty)(e)?e:e.map(e=>{if(!e.condition)return e;let t=(0,G.cloneDeep)(e),{condition:n}=t;return n?.and&&n?.and?.length>1||n?.or&&n?.or?.length>1||(n?.and&&n.and?.length===1?t.condition={...n.and[0],...(0,G.omit)(n,[`and`,`or`])}:n?.or&&n.or?.length===1?t.condition={...n.or[0],...(0,G.omit)(n,[`and`,`or`])}:n?.left&&n?.operator&&n?.right&&(t.condition={...(0,G.omit)(n,[`left`,`operator`,`right`,`and`,`or`]),and:[{left:n.left,operator:n.operator,right:n.right}]})),t}),Mp=e=>e.reduce((e,{key:t,value:n,keyId:r,valueId:i})=>(t&&(e[r??t]=i??n),e),{}),Np={prompt:`LLM`,httpRequest:`FETCH`,router:`ROUTER`,script:`SCRIPT`,parallelStart:`PARALLEL_START`,parallelEnd:`PARALLEL_END`},Pp=(e,t,n)=>{let r=e?.find(e=>e?.type===`start`)?.data?.step?.next_step_slug,i=(0,G.orderBy)(e.filter(e=>e.type!==`start`&&e.type!==`end`).map(n=>{delete n.data.isNodeFormValid,n.type===`prompt`&&n.data.step?.agent_data&&delete n.data.step?.agent_data;let i=(0,G.cloneDeep)(n.data);i.step&&(i.step.type=Np[n.type]);let a=yy(n.id,e,t);if(i.order=r===i?.step?.slug?-1:a.length,n.type===`prompt`&&delete i.step?.continue_on_error,n.type===`httpRequest`&&i.step?.frontHeaders)try{i.step.headers=JSON.parse(JSON.stringify(Mp(i.step.frontHeaders))),delete i.step.frontHeaders}catch{}return n.type===`router`&&i.step?.routes&&(i.step.routes=Ap(i.step?.routes)),(n.type===`parallelStart`||n.type===`parallelEnd`)&&delete i.step?.count,{...i}}),[`order`]).map(e=>({...e.step})),a=e.filter(e=>e.type===`start`||e.type===`end`).map(e=>(delete e.data.isNodeFormValid,e.type===`end`&&e.data.step&&(e.data.step.preserve_conversation??=!1,e.data.step.share_context_between_steps??=!1),{...(0,G.cloneDeep)(e.data).step}));return{flow:{nodes:e,edges:t},steps:i,custom_inputs:n,...Object.assign({},...a)}},Fp=(e,t,n,r,i)=>{let a=t?.map(({id:e,data:t,type:n})=>({id:e,data:t,type:n})),o=n?.map(({id:e,data:t,type:n})=>({id:e,data:t,type:n}));return!((0,G.isEqual)(a,o)&&(0,G.isEqual)(r,i))&&!!e.length},Ip=(e,t)=>!(0,G.isEqual)(e,t),Lp=e=>{let{width:t,height:n,...r}=e;return r},Rp=(e,t)=>{if(!e)return;let n=Fu([e],t).find(t=>t.source===e.id&&(0,G.isNil)(t.sourceHandle));if(n)return ku(n,{source:n.source,sourceHandle:`${e.id}-right`,target:n.target,targetHandle:n.targetHandle??``},t)},zp=(e,t)=>{let n;return{updatedNodes:e.map(e=>(e.type!==`start`&&e.type!==`end`&&(n=Rp(e,t)),Lp(e))),updatedEdges:n}},Bp=(e,t,n)=>e?.map(e=>{let r=e.type!==`start`&&e.data.step?.slug?t?.find(t=>t.slug===e.data?.step?.slug):void 0;if(e.type===`end`)return e.data.step={...e.data.step,...n},delete e.data.step.slug,e;if(!r)return e;let i=(0,G.isObject)(r.headers);if(r.headers&&i){let t=e.data.step?.frontHeaders?e.data.step?.frontHeaders:Object.entries(r.headers).map(([e,t])=>({key:e,value:t}));return e.data.step={...r,frontHeaders:t},e}if(e.type===`router`&&r.routes){let t={...r};return t.routes=jp(t.routes??[]),e.data.step=t,e}return e.type===`prompt`&&(e.data?.step?.next_failure_step_slug||e.data?.step?.continue_on_error)?(e.data.step={...r,continue_on_error:e.data?.step?.continue_on_error},e):e.type===`parallelStart`||e.type===`parallelEnd`?(e.data.step={...r,count:e.data?.step?.count},e):(e.data.step=r,e)}),Vp=(e,t,n)=>{let r=RegExp(`{{\\s*${t}(\\.[^\\s}]*)?\\s*}}`,`g`);return e.replace(r,e=>e.replace(t,n))},Hp=(e,t,n)=>{let{step:r}=e;return r?.prompt&&(r.prompt=Vp(r.prompt,n,t)),r?.next_step_slug===n&&(r.next_step_slug=t),r?.next_failure_step_slug===n&&(r.next_failure_step_slug=t),r},Up=(e,t,n)=>{let{step:r}=e;return r?.next_step_slug===n&&(r.next_step_slug=r.next_step_slug.replace(n,t)),r?.routes?.forEach(e
102=>{e?.next_step_slug===n&&(e.next_step_slug=e.next_step_slug.replace(n,t)),e.condition?.jinja_expression&&(e.condition.jinja_expression=Vp(e.condition.jinja_expression,n,t)),e.condition?.left&&(0,G.isString)(e.condition.left)&&(e.condition.left=Vp(e.condition.left,n,t)),e.condition?.right&&(0,G.isString)(e.condition.right)&&(e.condition.right=Vp(e.condition.right,n,t)),e.condition?.and?.forEach(e=>{e?.left&&(0,G.isString)(e?.left)&&(e.left=Vp(e.left,n,t)),e?.right&&(0,G.isString)(e?.right)&&(e.right=Vp(e.right,n,t))}),e.condition?.or?.forEach(e=>{e?.left&&(0,G.isString)(e?.left)&&(e.left=Vp(e.left,n,t)),e?.right&&(0,G.isString)(e?.right)&&(e.right=Vp(e.right,n,t))})}),r},Wp=(e,t,n)=>{let{step:r}=e,i=r?.next_steps_slugs?.findIndex(e=>e===n);return r?.next_steps_slugs&&i!==void 0&&i>=0&&(r.next_steps_slugs[i]=t),r},Gp=(e,t,n)=>{let{step:r}=e;return r?.final_result&&(r.final_result=r.final_result.replaceAll(`{{${n}.answer}}`,`{{${t}.answer}}`),RegExp(`{%[^}]*\\b${n}\\b[^}]*%}`,`g`).test(r?.final_result)&&setTimeout(()=>{fe.showToaster({type:`error`,message:m(_l).slugChangedInJinja})},500)),r},Kp=(e,t,n,r)=>(0,G.cloneDeep)(e).map(e=>{if(e.id===n)return{...e,data:{...e.data,...t}};let i=t?.step?.slug;return e.type===`prompt`&&r&&i&&(e.data.step=Hp(e.data,i,r)),e.type===`router`&&r&&i&&(e.data.step=Up(e.data,i,r)),e.type===`parallelStart`&&r&&i&&(e.data.step=Wp(e.data,i,r)),e.type===`end`&&r&&i&&(e.data.step=Gp(e.data,i,r)),e}),qp=(e,t)=>(e.type===`start`&&e.data&&e.data.step&&(e.data.step.name=t.name?.toString(),e.data.step.description=t.description?.toString()),e),Jp=({nodeType:e,positionEnd:t,prefix:n,nodes:r,addSingleNode:i,updateNode:a})=>{if(e===`parallelStart`){i(`parallelEnd`,t,n);let e=r.find(e=>e.type===`end`);e&&e.data.step&&(e.data.step.share_context_between_steps=!1,a(e.id,e.data))}},Yp=e=>e?document.getElementById(e):null,Xp=e=>e?.dataset.navType===`edge`,Zp=e=>e?.dataset.keyboardNavType===`node`,Qp=()=>{let{getNextElement:e,getPreviousElement:t,setElementFocus:n,handleNodeStartFocus:r}=$p();return{handleTab:t=>e(t.target,t),handleShiftTab:e=>t(e.target,e),handleNodeStartFocus:r,setElementFocus:n}},$p=()=>{let{edges:e,getNodeById:t,setElementFocusedId:n,nodes:r,isNodeFullConnected:i}=Sy(),a=()=>{o(Yp(r.find(e=>e.type===`start`)?.id??``))},o=(e,t)=>{e&&(n(t??e.id),setTimeout(()=>e.focus(),50))},s=e=>!i({id:e.id,type:e?.type,data:e?.data}),c=(e,t)=>{let n=r.findIndex(t=>t.id===e.id),i=(t===`next`?r.slice(n+1):r.slice(0,n).reverse()).find(e=>(t===`next`?e.type!==`end`:e.type!==`start`)&&s(e)),a=r.find(e=>e.type===`start`&&s(e)),o=r.find(e=>e.type===`end`&&s(e));return e.type===`end`?t===`next`?a??i:i??a:e.type===`start`||t===`next`?i??o:i??a},l=e=>c(e,`next`),u=e=>c(e,`previous`),d=(n,r)=>{let i=t(n);if(!i)return;let a=(i?Fu([i],e):[]).find(e=>e.source===i?.id);if(a){r.preventDefault(),o(Yp(a.id));return}let s=l(i);if(i.type===`end`){if(s)r.preventDefault(),ue(Yp(Op));else{let e=Yp(Dp),t=Yp(kp);e?.disabled||(r.preventDefault(),ue(e??t))}return}if(s&&s.id!==i.id){r.preventDefault(),o(Yp(s?.id));return}},f=(n,i)=>{let a=t(n),s=Fu([a],e).find(e=>e.target===a?.id);if(!s){if(a.type===`start`)return;let e=u(a);if(e&&e.id!==a.id)i.preventDefault(),o(Yp(e?.id));else{i.preventDefault();let e=r.find(e=>e.type===`end`)?.id;o(Yp(e))}return}let c=Yp(s.id);i.preventDefault(),o(c)},p=n=>{o(Yp(t(e.find(e=>e.id===n)?.target)?.id))},m=(n,r)=>{let i=e.find(e=>e.id===n);if(!i)return;let a=t(i?.source),s=em(Yp(a?.id));r.preventDefault(),o(s,a?.id)};return{getNextElement:(e,t)=>{if(!e)return;let n=e.closest(`[data-keyboard-nav-id]`);if(Xp(n)){t.preventDefault(),p(n.id);return}let r=em(n),i=r===document.activeElement||r===e;Zp(n)&&i&&d(n.id,t)},getPreviousElement:(e,t)=>{if(!e||!e.id)return;if(e?.id===`button-try`){let e=r.find(e=>e.type===`end`)?.id;o(Yp(e));return}let n=e.closest(`[data-keyboard-nav-id]`);Xp(n)&&m(n.id,t),Zp(n)&&(n===document.activeElement||n===e)&&f(n.id,t)},setElementFocus:o,handleNodeStartFocus:a}};function em(e){return e?Array.from(e.querySelectorAll(` 103 a[href]:not([aria-hidden="true"]), 104 button:not([aria-hidden="true"]), 105 input:not([aria-hidden="true"]), 106 select:not([aria-hidden="true"]), 107 textarea:not([aria-hidden="true"]),
108 [tabindex]:not([aria-hidden="true"]):not([tabindex="-1"]) 109`)).reverse().find(e=>!e.closest(`[aria-hidden="true"]`)):null}var tm=()=>{let{addEdge:e}=Sy(),t=g(nm);return{handleAddEdge:n=>{try{e(n)}catch(e){if(e?.message===`MAX_REACHED_parallelStart`){fe.showToaster({type:`error`,message:t.errorMaxConnectionsReached,title:t.error});return}if(e?.message===`UNSUPPORTED_PARALLEL_INSIDE_PARALLEL`){fe.showToaster({type:`error`,message:t.unsupportedParallel,title:t.error});return}if(e?.message===`UNSUPPORTED_PARALLEL_WITHOUT_INNER_NODES`){fe.showToaster({type:`error`,message:t.unsupportedWithoutInnerNodes,title:t.error});return}if(e?.message===`DUPLICATED_EDGE_NOT_ALLOWED`){fe.showToaster({type:`error`,message:t.duplicatedEdgeNotAllowed,title:t.error});return}}}}},nm={en:{error:`Error!`,errorMaxConnectionsReached:`The Parallel cannot exceed the limit of 5 records.`,unsupportedParallel:`Parallel inside parallel is not allowed`,unsupportedWithoutInnerNodes:`Parallel without inner nodes is not allowed`,duplicatedEdgeNotAllowed:`This connection already exists`},pt:{error:`Erro!`,errorMaxConnectionsReached:`A execução paralela não pode exceder o limite de 5 ligações`,unsupportedParallel:`Não é permitido uma execução paralela dentro de outra execução paralela`,unsupportedWithoutInnerNodes:`Execução paralela sem nós internos não é permitida`,duplicatedEdgeNotAllowed:`Essa ligação já existe`}},rm=()=>{let{nodes:e,deleteNode:t,updateNode:n,getNodeBySlug:r}=Sy(),{handleNodeStartFocus:i}=Qp(),a=(0,J.useCallback)(t=>{let r=``;t.type===`prompt`?r=`{{${t.data?.step?.slug}.answer}}`:(t.type===`script`||t.type===`httpRequest`)&&(r=`{{${t.data?.step?.slug}}}`),e.forEach(e=>{let i=!1,a={...e.data};e.type===`end`&&a.step?.final_result?.includes(r)&&(a.step.final_result=a.step.final_result.replaceAll(r,``),i=!0),e.type===`prompt`&&a.step?.prompt?.includes(r)&&(a.step.prompt=a.step.prompt.replaceAll(r,``),i=!0),e.type===`prompt`&&a.step?.prompt?.includes(r)&&(a.step.prompt=a.step.prompt.replaceAll(r,``),i=!0);let o=t.data?.step?.slug;e.type===`parallelStart`&&o&&a?.step?.next_steps_slugs&&a?.step?.next_steps_slugs?.includes(o)&&(a.step.next_steps_slugs=a.step.next_steps_slugs.filter(e=>e!==o),i=!0),i&&n(e.id,a)})},[e,n]),o=(e,n)=>{let o=n?.split(e===`parallelStart`?`-start`:`-end`)[0],s=r(`${o}${e===`parallelStart`?`-end`:`-start`}`);s&&(a(s),i(),t(s))};return{onDelete:e=>{(e.type===`parallelStart`||e.type===`parallelEnd`)&&o(e.type,e.data.step?.slug),a(e),i(),t(e,!0)}}};function im(){return im=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},im.apply(null,arguments)}var am=[`shift`,`alt`,`meta`,`mod`,`ctrl`],om={esc:`escape`,return:`enter`,".":`period`,",":`comma`,"-":`slash`," ":`space`,"`":`backquote`,"#":`backslash`,"+":`bracketright`,ShiftLeft:`shift`,ShiftRight:`shift`,AltLeft:`alt`,AltRight:`alt`,MetaLeft:`meta`,MetaRight:`meta`,OSLeft:`meta`,OSRight:`meta`,ControlLeft:`ctrl`,ControlRight:`ctrl`};function sm(e){return(e&&om[e]||e||``).trim().toLowerCase().replace(/key|digit|numpad|arrow/,``)}function cm(e){return am.includes(e)}function lm(e,t){return t===void 0&&(t=`,`),e.split(t)}function um(e,t,n){t===void 0&&(t=`+`);var r=e.toLocaleLowerCase().split(t).map(function(e){return sm(e)}),i={alt:r.includes(`alt`),ctrl:r.includes(`ctrl`)||r.includes(`control`),shift:r.includes(`shift`),meta:r.includes(`meta`),mod:r.includes(`mod`)},a=r.filter(function(e){return!am.includes(e)});return im({},i,{keys:a,description:n})}(function(){typeof document<`u`&&(document.addEventListener(`keydown`,function(e){e.key!==void 0&&mm([sm(e.key),sm(e.code)])}),document.addEventListener(`keyup`,function(e){e.key!==void 0&&hm([sm(e.key),sm(e.code)])})),typeof window<`u`&&window.addEventListener(`blur`,function(){dm.clear()})})();var dm=new Set;function fm(e){return Array.isArray(e)}function pm(e,t){return t===void 0&&(t=`,`),(fm(e)?e:e.split(t)).every(function(e){return dm.has(e.trim().toLowerCase())})}function mm(e){var t=Array.isArray(e)?e:[e];dm.has(`meta`)&&dm.forEach(function(e){return!cm(e)&&dm.delete(e.toLowerCase())}),t.forEach(function(e){return dm.add(e.toLowerCase())})}function hm(e){e===`meta`?dm.clear():(Array.isArray(e)?e:[e]).forEac
109h(function(e){return dm.delete(e.toLowerCase())})}function gm(e,t,n){(typeof n==`function`&&n(e,t)||n===!0)&&e.preventDefault()}function _m(e,t,n){return typeof n==`function`?n(e,t):n===!0||n===void 0}function vm(e){return ym(e,[`input`,`textarea`,`select`])}function ym(e,t){var n=e.target;t===void 0&&(t=!1);var r=n&&n.tagName;return fm(t)?!!(r&&t&&t.some(function(e){return e.toLowerCase()===r.toLowerCase()})):!!(r&&t&&t===!0)}function bm(e,t){return e.length===0&&t?(console.warn(`A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>`),!0):t?e.some(function(e){return t.includes(e)})||e.includes(`*`):!0}var xm=function(e,t,n){n===void 0&&(n=!1);var r=t.alt,i=t.meta,a=t.mod,o=t.shift,s=t.ctrl,c=t.keys,l=e.key,u=e.code,d=e.ctrlKey,f=e.metaKey,p=e.shiftKey,m=e.altKey,h=sm(u),g=l.toLowerCase();if(!(c!=null&&c.includes(h))&&!(c!=null&&c.includes(g))&&![`ctrl`,`control`,`unknown`,`meta`,`alt`,`shift`,`os`].includes(h))return!1;if(!n){if(r===!m&&g!==`alt`||o===!p&&g!==`shift`)return!1;if(a){if(!f&&!d)return!1}else if(i===!f&&g!==`meta`&&g!==`os`||s===!d&&g!==`ctrl`&&g!==`control`)return!1}return c&&c.length===1&&(c.includes(g)||c.includes(h))?!0:c?pm(c):!c},Sm=(0,J.createContext)(void 0),Cm=function(){return(0,J.useContext)(Sm)};function wm(e,t){return e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&wm(e[r],t[r])},!0):e===t}var Tm=(0,J.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),Em=function(){return(0,J.useContext)(Tm)};function Dm(e){var t=(0,J.useRef)(void 0);return wm(t.current,e)||(t.current=e),t.current}var Om=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},km=typeof window<`u`?J.useLayoutEffect:J.useEffect;function Am(e,t,n,r){var i=(0,J.useState)(null),a=i[0],o=i[1],s=(0,J.useRef)(!1),c=n instanceof Array?r instanceof Array?void 0:r:n,l=fm(e)?e.join(c?.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,d=(0,J.useCallback)(t,u??[]),f=(0,J.useRef)(d);u?f.current=d:f.current=t;var p=Dm(c),m=Em().enabledScopes,h=Cm();return km(function(){if(!(p?.enabled===!1||!bm(m,p?.scopes))){var e=function(e,t){var n;
109if(t===void 0&&(t=!1),!(vm(e)&&!ym(e,p?.enableOnFormTags))){if(a!==null){var r=a.getRootNode();if((r instanceof Document||r instanceof ShadowRoot)&&r.activeElement!==a&&!a.contains(r.activeElement)){Om(e);return}}(n=e.target)!=null&&n.isContentEditable&&!(p!=null&&p.enableOnContentEditable)||lm(l,p?.splitKey).forEach(function(n){var r,i=um(n,p?.combinationKey);if(xm(e,i,p?.ignoreModifiers)||(r=i.keys)!=null&&r.includes(`*`)){if(p!=null&&p.ignoreEventWhen!=null&&p.ignoreEventWhen(e)||t&&s.current)return;if(gm(e,i,p?.preventDefault),!_m(e,i,p?.enabled)){Om(e);return}f.current(e,i),t||(s.current=!0)}})}},t=function(t){t.key!==void 0&&(mm(sm(t.code)),(p?.keydown===void 0&&p?.keyup!==!0||p!=null&&p.keydown)&&e(t))},n=function(t){t.key!==void 0&&(hm(sm(t.code)),s.current=!1,p!=null&&p.keyup&&e(t,!0))},r=a||c?.document||document;return r.addEventListener(`keyup`,n),r.addEventListener(`keydown`,t),h&&lm(l,p?.splitKey).forEach(function(e){return h.addHotkey(um(e,p?.combinationKey,p?.description))}),function(){r.removeEventListener(`keyup`,n),r.removeEventListener(`keydown`,t),h&&lm(l,p?.splitKey).forEach(function(e){return h.removeHotkey(um(e,p?.combinationKey,p?.description))})}}},[a,l,p,m]),o}var jm=f.div` 110 position: relative; 111 112 .selection-list { 113 position: absolute; 114 top: 0; 115 left: 30px; 116 width: 200px; 117 } 118`,Mm={prompt:{icon:(0,q.jsx)(ne,{}),color:`primary.500`,appearance:`text`,bg:null},httpRequest:{icon:(0,q.jsx)(O,{}),color:`blue.500`,appearance:`text`,bg:null},router:{icon:(0,q.jsx)(N,{}),color:`pink.500`,appearance:`text`,bg:null},end:{icon:(0,q.jsx)(ie,{}),color:`secondary.contrastText`,appearance:`square`,bg:`secondary.500`}},Nm=`node-menu`,Pm=({node:e,nodes:t,edges:n,enableCopy:r=!0,enableDelete:i=!0,enableConnection:a=!0,enableMove:o=!0,ariaLabelTranslateCard:s,nodeName:c,actionHandlers:l})=>{let u=Se(`qc`,xe),[d,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),h=(0,J.useRef)(null),g=(0,J.useCallback)(()=>{f(!1),m(!1),setTimeout(()=>h.current?.focus(),100)},[]),_=(0,J.useCallback)(t=>n=>{n.stopPropagation(),n.preventDefault(),t(e),g()},[e,g]),v=(0,J.useCallback)((t,n)=>{t.stopPropagation(),t.preventDefault(),l?.onConnect?.(e,n),g()},[e,l,g]),y=(0,J.useMemo)(()=>[a&&{label:`Connect to`,icon:(0,q.jsx)(N,{}),onClick:e=>{e.stopPropagation(),e.preventDefault(),f(!1),m(!0)}},o&&{label:`Move`,icon:(0,q.jsx)(se,{}),onClick:_(l?.onSelect)},r&&{label:`Duplicate`,icon:(0,q.jsx)(L,{}),onClick:_(l?.onCopy)},i&&{label:`Remove`,icon:(0,q.jsx)(k,{}),onClick:_(l?.onDelete)}].filter(Boolean),[a,r,i,_]),b=Am(`escape`,g);return(0,q.jsxs)(jm,{children:[(0,q.jsx)(R,{ref:h,onClick:e=>{e.stopPropagation(),e.preventDefault(),f(e=>!e)},"aria-controls":Nm,"aria-expanded":d,"data-keyboard-nav":`true`,"data-node-id":e.id,tabIndex:0,id:Uc(),"aria-label":`${u.qc.moreOptions} ${u.qc[s||`start`]} ${c}`,children:(0,q.jsx)(I,{})}),(0,q.jsxs)(`div`,{ref:b,tabIndex:-1,children:[(0,q.jsx)(H,{id:Nm,visible:d,onHide:()=>f(!1),items:y}),p&&(0,q.jsx)(H,{id:Nm,visible:p,onHide:()=>m(!1),after:(0,q.jsx)(Fm,{onSelect:v,node:e,nodes:t,edges:n}),items:[],style:{minWidth:`300px`}})]})]})},Fm=({onSelect:e,node:t,nodes:n,edges:o})=>{let c=Se(`qc`,xe),[l,u]=(0,J.useState)(``),d=(0,J.useMemo)(()=>{let e=o.find(e=>e.target===t.id);return n.filter(n=>n.id!==t.id&&n.type!==`start`&&e?.source!==n.id&&(t.type===`start`?n.type!==`end`:!0)).filter(e=>e.data.step?.slug?.toLowerCase().includes(l.toLowerCase())||e.type?.toLowerCase().includes(l.toLowerCase()))},[n,t,o,l]);return(0,q.jsx)(i,{flexDirection:`column`,onClick:e=>e.stopPropagation(),children:(0,q.jsxs)(a,{m:4,mb:5,children:[(0,q.jsxs)(ae,{children:[(0,q.jsx)(P,{children:(0,q.jsx)(r,{colorIcon:`light`,children:(0,q.jsx)(E,{})})}),(0,q.jsx)(p,{id:`input-filter-${t.id}`,value:l,onChange:e=>u(e.target.value),autoFocus:!0})]}),d.map(t=>{let n=Mm[t.type]||Mm.prompt;return(0,q.jsx)(F,{sx:{width:`100%`},as:be,clickable:!0,onClick:n=>e(n,t),"aria-label":`${c.qc.connectTo} ${t.data.step?.slug??c.qc.end}`,children:(0,q.jsxs)(i,{gap:!0,p:5,alignItems:`center`,children:[(0,q.jsx)(r,{appearance:n.appearance,colorIcon:n.color,colorBg:n.bg,sx:{mr:3},children:n.icon}),(0,q.jsx)(s,{children:t.data.step?.slug??c.qc.end})]})},t.id)})]})})},Im=({node:e,enableCopy:t=!0,enableDelete:n=!0,enableConnection:r=!0,ariaLabelTranslateCard:i,nodeName:a})=>{let{getNodeById:o,copyNode:s,nodes:c,edges:l}=Sy(),{handleAddEdge:u}=tm(),{setElementFocus:d}=Qp(),{onDelete:f}=rm();return(0,q.jsx)(Pm,{node:e,nodes:c,edges:l,enableCopy:t,enableDelete:n,enableConnection:r,ariaLabelTranslateCard:i,nodeName:a,actionHandlers:{onCopy:e=>{let t=s(o(e.id));setTimeout(()=>d(document.getElementById(t.id)),200)},onDelete:e=>{f(o(e.id))},onConnect:(e,t)=>
118{u({source:e.id,sourceHandle:`${e.id}-right`,target:t.id,targetHandle:`${t.id}-left`})},onSelect:e=>{document.getElementById(e.id)?.focus()}}})},Lm={en:{sendMessage:`Enter to send, Shift+Enter for a new line.`,codeLabel:`Code Example`,codePlaceholder:`If necessary, please insert a`,codePlaceholderTesting:`testing`,codePlaceholderCodeExample:`code example`,more:`more`,for:`for`,thinking:`Thinking...`,couldNotLoadKnowledgeObjects:`Could not load knowledge object`,ready:`All set! Enter your prompt to get started!`,error:`Oops! We couldn't process your request.`,codeTooltip:`You can insert your own code and we will use the code as part of the context to bring a answer. This means that if you have a code and want to ask something related to it, you can insert it here.`,addCodeExample:`Insert code example`,feedbackResponse:`Thank you for your valuable feedback. Your insights are crucial in our ongoing efforts to enhance StackSpot AI and to provide an increasingly better experience.`,feedbackFormTitle:`Why did you choose this rating?`,others:`Others`,wrongAnswer:`Wrong answer`,collapseCode:`Collapse text editor`,like:`Like`,dislike:`Dislike`,close:`close`,copy:`Copy`,copied:`Copied!`},pt:{sendMessage:`Enter para enviar, Shift+Enter para uma nova linha.`,codeLabel:`Exemplo de código`,codePlaceholder:`Se necessário, insira um`,codePlaceholderTesting:`teste`,codePlaceholderCodeExample:`código de exemplo`,more:`mais`,for:`para`,thinking:`Pensando...`,couldNotLoadKnowledgeObjects:`Não foi possÃvel carregar o Knowledge Object`,ready:`Tudo pronto! Digite seu prompt para começar!`,error:`Ops! Não foi possÃvel processar sua solicitação.`,codeTooltip:`Você pode inserir seu próprio código e nós usaremos esse código como parte do contexto para trazer uma resposta. Isso significa que, se você tem um código e quer perguntar algo relacionado a ele, você pode inseri-lo aqui.`,addCodeExample:`Inserir exemplo de código`,feedbackResponse:`Obrigado pelo seu valioso feedback. Seus insights são cruciais em nossos esforços contÃnuos para aprimorar o StackSpot AI e fornecer uma experiência cada vez melhor`,feedbackFormTitle:`Por que você escolheu esta avaliação?`,others:`Outros`,wrongAnswer:`Resposta incorreta`,collapseCode:`Recolher editor de texto`,like:`Gostei`,dislike:`Não gostei`,close:`fechar`,copy:`Copiar`,copied:`Copiado!`}},Rm=({sources:e,onClick:t,className:n,maxItems:r=1})=>{let[i,a]=(0,J.useState)(e.length<r),o=Se(`chatTranslations`,Lm),c=(0,J.useMemo)(()=>e.filter(e=>e.type===`knowledge_source`),[e]);return(0,J.useEffect)(()=>{c.length<r?a(!0):i&&c.length>=r&&a(!1)},[c.length]),(0,q.jsx)(q.Fragment,{children:c?.length?(0,q.jsxs)(Ce,{className:n,children:[(0,q.jsx)(s,{appearance:`body2`,mb:3,children:`Knowledge Sources:`}),(0,q.jsx)(we,{gap:`12px`,children:i?c.map(e=>(0,q.jsx)(j,{className:`tag`,onClick:()=>t?.(e),children:e.name},e.document_id)):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(j,{className:`tag`,onClick:()=>t?.(c[0]),children:(0,q.jsx)(ve,{children:c[0].name})}),c.length>1&&(0,q.jsxs)(j,{className:`tag`,onClick:()=>a(!0),children:[`+`,c.length-1,` `,o.chatTranslations.more]})]})})]}):null})},zm=(0,J.lazy)(()=>de(()=>import(`./MarkdownViewer-BJSZOqBD.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8]))),Bm=({...e})=>(0,q.jsx)(J.Suspense,{fallback:(0,q.jsx)(V,{}),children:(0,q.jsx)(zm,{...e})}),Vm={both:[`equals`,`notEquals`,`contains`,`notContains`,`startsWith`,`endsWith`,`greater`,`smaller`,`greaterEqual`,`smallerEqual`],uniq:[`isEmpty`,`isNotEmpty`,`isDefined`,`isUndefined`]},Hm={start:[`description`,`name`,`slug`],prompt:[`prompt`,`slug`],httpRequest:[`method`,`slug`,`url`],script:[`script`],end:[],parallelEnd:[],parallelStart:[],router:[`routes`]},Um={IDE:[`return_type`,`final_result`],REMOTE:[`final_result`]},Wm={start:[],prompt:[],httpRequest:[`frontHeaders`],end:[],script:[],router:[],parallelEnd:[],parallelStart:[`next_steps_slugs`]},Gm=e=>{let t=e.find(e=>e&&e.errorMessage!==null);if(!t)return!0;let{errorMessage:n,node:r,updateNode:i}=t;return r?.data&&i?.(r.id,{...r.data,isNodeFormValid:!1,errorDetail:n}),fe.showToaster({type:`error`,message:n}),!1},Km=e=>!!e&&pn.test(e),qm=(e,t,n,r)=>{let i=m(_l),a=i.messageRequiredFieldEmpty,o=`${i.fieldWithInvalidValue}`,s=(0,G.isEmpty)(n?.slug)?e.type:n?.slug;if((0,G.isNil)(n)||!(t in n)||!n[t])return{node:e,errorMessage:a.replace(`$type`,`${s}`),updateNode:r};if((e.type===`prompt`||e.type===`httpRequest`)&&t===`slug`&&!Km(n[t]))return{node:e,errorMessage:o.replace(`$type`,`${s}`),updateNode:r};if(e.type===`router`){if(!(0,G.isEmpty)(Xm(n.routes)?.[0]))return{node:e,errorMessage:a.replace(`$type`,`${s}`),updateNode:r};Zm(n.routes)}return e.type===`parallelStart`&&e.data?.step?.next_steps_slugs?.length===1?{node:e,errorMessage:i.singleNode,updateNode:r}:e.type===`httpRequest`&&t===`frontHeaders`&&!(n[t]?.filter(({key:e,value:t})=>e.trim()!==``||t.trim()!==``)).every(({key:e,value:t})=>e===``&&t===``||e.trim()!==``&&t.trim()!==``)?{node:e,errorMessage:o.replace(`$type`,`${s}`),updateNode:r}:null},Jm=(e,t)=>
118{let n=e.flow?.nodes||[],r=e.flow?.edges||[],i=n.find(e=>e.type===`start`)?.data.step?.type||`IDE`,a=m(_l),o=e?.custom_inputs?.map(e=>{let t=!!e.question&&!!e.slug;return!t&&fe.showToaster({type:`error`,message:a.customInputInvalid.replace(`$slug`,e.slug??e.question)}),t})??[],s=[];return n.map(e=>{if(t?.(e.id,{...e.data,isNodeFormValid:!0,errorDetail:void 0}),e.data?.errorDetail)return fe.showToaster({type:`error`,message:e.data.errorDetail}),t?.(e.id,{...e.data,isNodeFormValid:!1}),!1;let o=e.type,c=e.data.step,l=(o===`end`?Um[i]:Hm[o]).map(n=>qm(e,n,c,t)),u=Wm[o].map(n=>qm(e,n,c,t));return o===`parallelStart`&&($m(e,n,r)||(fe.showToaster({type:`error`,message:a.invalidPath}),s.push(!1))),Gm(l.concat(u))}).concat(s).concat(o)},Ym=e=>e?.trim().replaceAll(/\s\s+/g,` `),Xm=e=>{if(!e)return;let t=e=>e?.map(e=>{if(e.operator&&Vm.both.includes(e.operator)){if((0,G.isEmpty)(e.left.toString())||(0,G.isEmpty)(e.right.toString()))return`error both`;if((0,G.isEmpty)(e.left))return`error uniq`}}).filter(Boolean)||[],n=e.flatMap(e=>[...t(e.condition?.and),...t(e.condition?.or)]);return n.length?n:void 0},Zm=e=>{e?.forEach(e=>{[`and`,`or`].forEach(t=>{e?.condition?.[t]?.forEach(e=>Vm.uniq.includes(e.operator)&&delete e.right)})})},Qm=(e,t,n)=>e===`router`?`router-${t.length}-${Uc()}`:e===`script`?`script-step-${t.length}`:e===`parallelStart`?`step-${Uc()}-start`:e===`parallelEnd`?`${n}-end`:`step-${t.length}`,$m=(e,t,n)=>{let r=th(n),i=new Map,a=e?.data.step?.slug?.split(`-start`)?.[0],o=t.find(e=>e.data.step?.slug===`${a}-end`);if(!o)return!1;let s=r.get(e.id)||[];if(s.length===0)return!1;for(let e of s){let t=eh(e,o.id,new Set,[],r);if(t.length===0||t.some(e=>e.slice(0,-1).some(e=>i.get(e)?.type===`parallelEnd`&&e!==o.id)))return!1}return!0};function eh(e,t,n,r,i){let a=[...r,e];if(e===t)return[a];n.add(e);let o=[],s=i.get(e)||[];for(let e of s)if(!n.has(e)){let r=eh(e,t,new Set(n),a,i);o.push(...r)}return o}function th(e){let t=new Map;return e.forEach(e=>{t.has(e.source)||t.set(e.source,[]),t.get(e.source).push(e.target)}),t}var nh=(e,t,n)=>{let r=t.find(e=>e.type===`start`),i=th(n),a=eh(r.id,e.id,new Set,[],i);if(a.length===0)return!1;let o=new Map;t.forEach(e=>o.set(e.id,e));for(let e of a){let t=0,n=0;for(let r=0;r<e.length-1;r++){let i=e[r],a=o.get(i);a&&(a.type===`parallelStart`?t++:a.type===`parallelEnd`&&n++)}if(t>n)return!0}return!1},rh={};function ih(e){let t=rh[e];if(t)return t;t=rh[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function ah(e,t){typeof t!=`string`&&(t=ah.defaultChars);let n=ih(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}ah.defaultChars=`;/?:@&=+$,#`,ah.componentChars=``;var oh={};function sh(e){let t=oh[e];if(t)return t;t=oh[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function ch(e,t,n){typeof t!=`string`&&(n=t,t=ch.defaultChars),n===void 0&&(n=!0);let r=sh(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}ch.defaultChars=`;/?:@&=+$,-_.!~*'()#`,ch.componentChars=`-_.!~*'()`;function lh(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function uh(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var dh=/^([a-z0-9.+-]+:)/i,fh=/:[0-9]*$/,ph=/^(\/\/?(?!\/)[^\?\s]
vendor: 9,569 bytes, lines 118-119
118*)(\?[^\s]*)?$/,mh=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,` 119`,` `],hh=[`/`,`?`,`#`],gh=255,_h=/^[+a-z0-9A-Z_-]{0,63}$/,vh=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,yh={javascript:!0,"javascript:":!0},bh={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function xh(e,t){if(e&&e instanceof uh)return e;let n=new uh;return n.parse(e,t),n}uh.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=ph.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=dh.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&yh[o])&&(a=a.substr(2),this.slashes=!0)),!yh[o]&&(i||o&&!bh[o])){let e=-1;for(let t=0;t<hh.length;t++)r=a.indexOf(hh[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<mh.length;t++)r=a.indexOf(mh[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(_h)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(_h)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(vh);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>gh&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),bh[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},uh.prototype.parseHost=function(e){let t=fh.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Sh=e({decode:()=>ah,encode:()=>ch,format:()=>lh,parse:()=>xh}),Ch=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,wh=/[\0-\x1F\x7F-\x9F]/,Th=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Eh=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,Dh=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,Oh=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,kh=e({Any:()=>Ch,Cc:()=>wh,Cf:()=>Th,P:()=>Eh,S:()=>Dh,Z:()=>Oh}),Ah=e({arrayReplaceAt:()=>Ih,asciiTrim:()=>ig,assign:()=>Fh,escapeHtml:()=>Yh,escapeRE:()=>Zh,fromCodePoint:()=>Rh,has:()=>Ph,isMdAsciiPunct:()=>tg,isPunctChar:()=>$h,isPunctCharCode:()=>eg,isSpace:()=>$,isString:()=>Mh,isValidEntityCode:()=>Lh,isWhiteSpace:()=>Qh,lib:()=>ag,normalizeReference:()=>ng,unescapeAll:()=>Wh,unescapeMd:()=>Uh});function jh(e){return Object.prototype.toString.call(e)}function Mh(e){return jh(e)===`[object String]`}var Nh=Object.prototype.hasOwnProperty;function Ph(e,t){return Nh.call(e,t)}function Fh(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function Ih(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function Lh(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Rh(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var zh=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,Bh=RegExp(zh.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),Vh=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Hh(e,t){if(t.charCodeAt(0)===35&&Vh.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Lh(n)?Rh(n):e}let n=Ve(e);return n===e?e:n}function Uh(e){return e.indexOf(`\\`)<0?e:e.replace(zh,`$1`)}function Wh(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(Bh,function(e,t,n){return t||Hh(e,n)})}var Gh=/[&<>"]/,Kh=/[&<>"]/g,qh={"&":`&`,"<":`<`,">":`>`,'"':`"`};function Jh(e){return qh[e]}function Yh(e){return Gh.test(e)?e.replace(Kh,Jh):e}var Xh=/[.?*+^$[\]\\(){}|-]/g;function Zh(e){return e.replace(Xh,`\\$&`)}function $(e){switch(e){case 9:case 32:return!0}return!1}function Qh(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function $h(e){return Eh.test(e)||Dh.test(e)}function eg(e){return $h(Rh(e))}function tg(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case
11961:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function ng(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function rg(e){return e===32||e===9||e===10||e===13}function ig(e){let t=0;for(;t<e.length&&rg(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&rg(e.charCodeAt(n));n--);return e.slice(t,n+1)}var ag={mdurl:Sh,ucmicro:kh};function og(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function sg(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=Wh(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=Wh(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function cg(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=Wh(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=Wh(e.slice(t,a)),o}var lg=e({parseLinkDestination:()=>sg,parseLinkLabel:()=>og,parseLinkTitle:()=>cg}),ug={};ug.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+Yh(a.content)+`</code>`},ug.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+Yh(e[t].content)+`</code></pre> 120`},ug.fence=function(e,t,n,r,i){let a=e[t],o=a.info?Wh(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||Yh(a.content),l.indexOf(`<pre`)===0)return l+` 121`;if(o){let e=a.attrIndex(`class`),t=a.attrs?a.attrs.slice():[];e<0?t.push([`class`,n.langPrefix+s]):(t[e]=t[e].slice(),t[e][1]+=` `+n.langPrefix+s);let r={attrs:t};return`<pre><code${i.renderAttrs(r)}>${l}</code></pre>\n`}return`<pre><code${i.renderAttrs(a)}>${l}</code></pre>\n`},ug.image=function(e,t,n,r,i){let a=e[t];return a.attrs[a.attrIndex(`alt`)][1]=i.renderInlineAsText(a.children,n,r),i.renderToken(e,t,n)},ug.hardbreak=function(e,t,n){return n.xhtmlOut?`<br /> 122`:`<br> 123`},ug.softbreak=function(e,t,n){return n.breaks?n.xhtmlOut?`<br /> 124`:`<br> 125`:` 126`},ug.text=function(e,t){return Yh(e[t].content)},ug.html_block=function(e,t){return e[t].content},ug.html_inline=function(e,t){return e[t].content};function dg(){this.rules=Fh({},ug)}dg.prototype.renderAttrs=function(e){let t,n,r;if(!e.attrs)return``;for(r=``,t=0,n=e.attrs.length;t<n;t++)r+=` `+Yh(e.attrs[t][0])+`="`+Yh(e.attrs[t][1])+`"`;return r},dg.prototype.renderToken=function(e,t,n){let r=e[t],i=``;if(r.hidden)return``;r.block&&r.nesting!==-1&&t&&e[t-1].hidden&&(i+=` 127`),i+=(r.nesting===-1?`</`:`<`)+r.tag,i+=this.renderAttrs(r),r.nesting===0&&n.xhtmlOut&&(i+=` /`);let a=!1;if(r.block&&(a=!0,r.nesting===1&&t+1<e.length)){let n=e[t+1];(n.type===`inline`||n.hidden||n.nesting===-1&&n.tag===r.tag)&&(a=!1)}return i+=a?`> 128`:`>`,i},dg.prototype.renderInline=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;i[o]===void 0?r+=this.renderToken(e,a,t):r+=i[o](e,a,t,n,this)}return r},dg.prototype.renderInlineAsText=function(e,t,n){let r=``;for(let i=0,a=e.length;i<a;i++)switch(e[i].type){case`text`:r+=e[i].content;break;case`image`:r+=this.renderInlineAsText(e[i].children,t,n);break;case`html_inline`:case`html_block`:r+=e[i].content;break;case`softbreak`:case`hardbreak`:r+=` 129`;break;default:}return r},dg.prototype.render=function(e,t,n){let r=``,i=this.rules;for(let a=0,o=e.length;a<o;a++){let o=e[a].type;o===`inline`?r+=this.renderInline(e[a].children,t,n):i[o]===void 0?r+=this.renderToken(e,a,t,n):r+=i[o](e,a,t,n,this)}return r};function fg(){this.__rules__=[],this.__cache__=null}fg.prototype.__find__=function(e){for(let t=0;t<this.__rules__.length;t++)if(this.__rules__[t].name===e)return t;return-1},fg.prototype.__compile__=function(){let e=this,t=[``];e.__rules__.forEach(function(e){e.enabled&&e.alt.forEach(function(e){t.indexOf(e)<0&&t.push(e)})}),e.__cache__={},t.forEach(function(t){e.__cache__[t]=[],e.__rules__.forEach(function(n){n.enabled&&(t&&n.alt.indexOf(t)<0||e.__cache__[t].push(n.fn))})})},fg.prototype.at=function(e,t,n){let r=this.__find__(e),i=n||{};if(r===-1)throw Error(`Parser rule not found: `+e);this.__rules__[r].fn=t,this.__rules__[r].alt=i.alt||[],this.__cache__=null},fg.prototype.before=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},fg.prototype.after=function(e,t,n,r){let i=this.__find__(e),a=r||{};if(i===-1)throw Error(`Parser rule not found: `+e);this.__rules__.splice(i+1,0,{name:t,enabled:!0,fn:n,alt:a.alt||[]}),this.__cache__=null},fg.prototype.push=function(e,t,n){let r=n||{};this.__rules__.push({name:e,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null},fg.prototype.enable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);
129if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!0,n.push(e)},this),this.__cache__=null,n},fg.prototype.enableOnly=function(e,t){Array.isArray(e)||(e=[e]),this.__rules__.forEach(function(e){e.enabled=!1}),this.enable(e,t)},fg.prototype.disable=function(e,t){Array.isArray(e)||(e=[e]);let n=[];return e.forEach(function(e){let r=this.__find__(e);if(r<0){if(t)return;throw Error(`Rules manager: invalid rule name `+e)}this.__rules__[r].enabled=!1,n.push(e)},this),this.__cache__=null,n},fg.prototype.getRules=function(e){return this.__cache__===null&&this.__compile__(),this.__cache__[e]||[]};function pg(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content=``,this.markup=``,this.info=``,this.meta=null,this.block=!1,this.hidden=!1}pg.prototype.attrIndex=function(e){if(!this.attrs)return-1;let t=this.attrs;for(let n=0,r=t.length;n<r;n++)if(t[n][0]===e)return n;return-1},pg.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]},pg.prototype.attrSet=function(e,t){let n=this.attrIndex(e),r=[e,t];n<0?this.attrPush(r):this.attrs[n]=r},pg.prototype.attrGet=function(e){let t=this.attrIndex(e),n=null;return t>=0&&(n=this.attrs[t][1]),n},pg.prototype.attrJoin=function(e,t){let n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=this.attrs[n][1]+` `+t};function mg(e,t,n){this.src=e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}mg.prototype.Token=pg;var hg=/\r\n?|\n/g,gg=/\0/g;function _g(e){let t;t=e.src.replace(hg,` 130`),t=t.replace(gg,`�`),e.src=t}function vg(e){let t;e.inlineMode?(t=new e.Token(`inline`,``,0),t.content=e.src,t.map=[0,1],t.children=[],e.tokens.push(t)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function yg(e){let t=e.tokens;for(let n=0,r=t.length;n<r;n++){let r=t[n];r.type===`inline`&&e.md.inline.parse(r.content,e.md,e.env,r.children)}}function bg(e){return/^<a[>\s]/i.test(e)}function xg(e){return/^<\/a\s*>/i.test(e)}function Sg(e){let t=e.tokens;if(e.md.options.linkify)for(let n=0,r=t.length;n<r;n++){if(t[n].type!==`inline`||!e.md.linkify.pretest(t[n].content))continue;let r=t[n].children,i=0;for(let a=r.length-1;a>=0;a--){let o=r[a];if(o.type===`link_close`){for(a--;r[a].level!==o.level&&r[a].type!==`link_open`;)a--;continue}if(o.type===`html_inline`&&(bg(o.content)&&i>0&&i--,xg(o.content)&&i++),!(i>0)&&o.type===`text`&&e.md.linkify.test(o.content)){let i=o.content,s=e.md.linkify.match(i),c=[],l=o.level,u=0;s.length>0&&s[0].index===0&&a>0&&r[a-1].type===`text_special`&&(s=s.slice(1));for(let t=0;t<s.length;t++){let n=s[t].url,r=e.md.normalizeLink(n);if(!e.md.validateLink(r))continue;let a=s[t].text;a=s[t].schema?s[t].schema===`mailto:`&&!/^mailto:/i.test(a)?e.md.normalizeLinkText(`mailto:`+a).replace(/^mailto:/,``):e.md.normalizeLinkText(a):e.md.normalizeLinkText(`http://`+a).replace(/^http:\/\//,``);let o=s[t].index;if(o>u){let t=new e.Token(`text`,``,0);t.content=i.slice(u,o),t.level=l,c.push(t)}let d=new e.Token(`link_open`,`a`,1);d.attrs=[[`href`,r]],d.level=l++,d.markup=`linkify`,d.info=`auto`,c.push(d);let f=new e.Token(`text`,``,0);f.content=a,f.level=l,c.push(f);let p=new e.Token(`link_close`,`a`,-1);p.level=--l,p.markup=`linkify`,p.info=`auto`,c.push(p),u=s[t].lastIndex}if(u<i.length){let t=new e.Token(`text`,``,0);t.content=i.slice(u),t.level=l,c.push(t)}t[n].children=r=Ih(r,a,c)}}}}var Cg=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,wg=/\((c|tm|r)\)/i,Tg=/\((c|tm|r)\)/gi,Eg={c:`©`,r:`®`,tm:`â¢`};function Dg(e,t){return Eg[t.toLowerCase()]}function Og(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&(r.content=r.content.replace(Tg,Dg)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function kg(e){let t=0;for(let n=e.length-1;n>=0;n--){let r=e[n];r.type===`text`&&!t&&Cg.test(r.content)&&(r.content=r.content.replace(/\+-/g,`±`).replace(/\.{2,}/g,`â¦`).replace(/([?!])â¦/g,`$1..`).replace(/([?!]){4,}/g,`$1$1$1`).replace(/,{2,}/g,`,`).replace(/(^|[^-])---(?=[^-]|$)/gm,`$1â`).replace(/(^|\s)--(?=\s|$)/gm,`$1â`).replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,`$1â`)),r.type===`link_open`&&r.info===`auto`&&t--,r.type===`link_close`&&r.info===`auto`&&t++}}function Ag(e){let t;if(e.md.options.typographer)for(t=e.tokens.length-1;t>=0;t--)e.tokens[t].type===`inline`&&(wg.test(e.tokens[t].content)&&Og(e.tokens[t].children),Cg.test(e.tokens[t].content)&&kg(e.tokens[t].children))}var jg=/['"]/,Mg=/['"]/g,Ng=`â`;function Pg(e,t,n,r){e[t]||(e[t]=[]),e[t].push({pos:n,ch:r})}function Fg(e,t){let n=``,r=0;t.sort((e,t)=>
130e.pos-t.pos);for(let i=0;i<t.length;i++){let a=t[i];n+=e.slice(r,a.pos)+a.ch,r=a.pos+1}return n+e.slice(r)}function Ig(e,t){let n,r=[],i={};for(let a=0;a<e.length;a++){let o=e[a],s=e[a].level;for(n=r.length-1;n>=0&&!(r[n].level<=s);n--);if(r.length=n+1,o.type!==`text`)continue;let c=o.content,l=0,u=c.length;OUTER:for(;l<u;){Mg.lastIndex=l;let o=Mg.exec(c);if(!o)break;let d=!0,f=!0;l=o.index+1;let p=o[0]===`'`,m=32;if(o.index-1>=0)m=c.charCodeAt(o.index-1);else for(n=a-1;n>=0&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let h=32;if(l<u)h=c.charCodeAt(l);else for(n=a+1;n<e.length&&!(e[n].type===`softbreak`||e[n].type===`hardbreak`);n++)if(e[n].content){h=e[n].content.charCodeAt(0);break}let g=tg(m)||eg(m),_=tg(h)||eg(h),v=Qh(m),y=Qh(h);if(y?d=!1:_&&(v||g||(d=!1)),v?f=!1:g&&(y||_||(f=!1)),h===34&&o[0]===`"`&&m>=48&&m<=57&&(f=d=!1),d&&f&&(d=g,f=_),!d&&!f){p&&Pg(i,a,o.index,Ng);continue}if(f)for(n=r.length-1;n>=0;n--){let e=r[n];if(r[n].level<s)break;if(e.single===p&&r[n].level===s){e=r[n];let s,c;p?(s=t.md.options.quotes[2],c=t.md.options.quotes[3]):(s=t.md.options.quotes[0],c=t.md.options.quotes[1]),Pg(i,a,o.index,c),Pg(i,e.token,e.pos,s),r.length=n;continue OUTER}}d?r.push({token:a,pos:o.index,single:p,level:s}):f&&p&&Pg(i,a,o.index,Ng)}
vendor: 16,845 bytes, lines 130-131
130}Object.keys(i).forEach(function(t){e[t].content=Fg(e[t].content,i[t])})}function Lg(e){if(e.md.options.typographer)for(let t=e.tokens.length-1;t>=0;t--)e.tokens[t].type!==`inline`||!jg.test(e.tokens[t].content)||Ig(e.tokens[t].children,e)}function Rg(e){let t,n,r=e.tokens,i=r.length;for(let e=0;e<i;e++){if(r[e].type!==`inline`)continue;let i=r[e].children,a=i.length;for(t=0;t<a;t++)i[t].type===`text_special`&&(i[t].type=`text`);for(t=n=0;t<a;t++)i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}}var zg=[[`normalize`,_g],[`block`,vg],[`inline`,yg],[`linkify`,Sg],[`replacements`,Ag],[`smartquotes`,Lg],[`text_join`,Rg]];function Bg(){this.ruler=new fg;for(let e=0;e<zg.length;e++)this.ruler.push(zg[e][0],zg[e][1])}Bg.prototype.process=function(e){let t=this.ruler.getRules(``);for(let n=0,r=t.length;n<r;n++)t[n](e)},Bg.prototype.State=mg;function Vg(e,t,n,r){this.src=e,this.md=t,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType=`root`,this.level=0;let i=this.src;for(let e=0,t=0,n=0,r=0,a=i.length,o=!1;t<a;t++){let s=i.charCodeAt(t);if(!o)if($(s)){n++,s===9?r+=4-r%4:r++;continue}else o=!0;(s===10||t===a-1)&&(s!==10&&t++,this.bMarks.push(e),this.eMarks.push(t),this.tShift.push(n),this.sCount.push(r),this.bsCount.push(0),o=!1,n=0,r=0,e=t+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}Vg.prototype.push=function(e,t,n){let r=new pg(e,t,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r},Vg.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]},Vg.prototype.skipEmptyLines=function(e){for(let t=this.lineMax;e<t&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e},Vg.prototype.skipSpaces=function(e){for(let t=this.src.length;e<t&&$(this.src.charCodeAt(e));e++);return e},Vg.prototype.skipSpacesBack=function(e,t){if(e<=t)return e;for(;e>t;)if(!$(this.src.charCodeAt(--e)))return e+1;return e},Vg.prototype.skipChars=function(e,t){for(let n=this.src.length;e<n&&this.src.charCodeAt(e)===t;e++);return e},Vg.prototype.skipCharsBack=function(e,t,n){if(e<=n)return e;for(;e>n;)if(t!==this.src.charCodeAt(--e))return e+1;return e},Vg.prototype.getLines=function(e,t,n,r){if(e>=t)return``;let i=Array(t-e);for(let a=0,o=e;o<t;o++,a++){let e=0,s=this.bMarks[o],c=s,l;for(l=o+1<t||r?this.eMarks[o]+1:this.eMarks[o];c<l&&e<n;){let t=this.src.charCodeAt(c);if($(t))t===9?e+=4-(e+this.bsCount[o])%4:e++;else if(c-s<this.tShift[o])e++;else break;c++}e>n?i[a]=Array(e-n+1).join(` `)+this.src.slice(c,l):i[a]=this.src.slice(c,l)}return i.join(``)},Vg.prototype.Token=pg;var Hg=65536;function Ug(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t];return e.src.slice(n,r)}function Wg(e){let t=[],n=e.length,r=0,i=e.charCodeAt(r),a=!1,o=0,s=``;for(;r<n;)i===124&&(a?(s+=e.substring(o,r-1),o=r):(t.push(s+e.substring(o,r)),s=``,o=r+1)),a=i===92,r++,i=e.charCodeAt(r);return t.push(s+e.substring(o)),t}function Gg(e,t,n,r){if(t+2>n)return!1;let i=t+1;if(e.sCount[i]<e.blkIndent||e.sCount[i]-e.blkIndent>=4)return!1;let a=e.bMarks[i]+e.tShift[i];if(a>=e.eMarks[i])return!1;let o=e.src.charCodeAt(a++);if(o!==124&&o!==45&&o!==58||a>=e.eMarks[i])return!1;let s=e.src.charCodeAt(a++);if(s!==124&&s!==45&&s!==58&&!$(s)||o===45&&$(s))return!1;for(;a<e.eMarks[i];){let t=e.src.charCodeAt(a);if(t!==124&&t!==45&&t!==58&&!$(t))return!1;a++}let c=Ug(e,t+1),l=c.split(`|`),u=[];for(let e=0;e<l.length;e++){let t=l[e].trim();if(!t){if(e===0||e===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(t))return!1;t.charCodeAt(t.length-1)===58?u.push(t.charCodeAt(0)===58?`center`:`right`):t.charCodeAt(0)===58?u.push(`left`):u.push(``)}if(c=Ug(e,t).trim(),c.indexOf(`|`)===-1||e.sCount[t]-e.blkIndent>=4)return!1;l=Wg(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop();let d=l.length;if(d===0||d!==u.length)return!1;if(r)return!0;let f=e.parentType;e.parentType=`table`;let p=e.md.block.ruler.getRules(`blockquote`),m=e.push(`table_open`,`table`,1),h=[t,0];m.map=h;let g=e.push(`thead_open`,`thead`,1);g.map=[t,t+1];let _=e.push(`tr_open`,`tr`,1);_.map=[t,t+1];for(let t=0;t<l.length;t++){let n=e.push(`th_open`,`th`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t].trim(),r.children=[],e.push(`th_close`,`th`,-1)}e.push(`tr_close`,`tr`,-1),e.push(`thead_close`,`thead`,-1);let v,y=0;for(i=t+2;i<n&&!(e.sCount[i]<e.blkIndent);i++){let r=!1;for(let t=0,a=p.length;t<a;t++)if(p[t](e,i,n,!0)){r=!0;break}if(r||(c=Ug(e,i).trim(),!c)||e.sCount[i]-e.blkIndent>=4||(l=Wg(c),l.length&&l[0]===``&&l.shift(),l.length&&l[l.length-1]===``&&l.pop(),y+=d-l.length,y>Hg))break;if(i===t+2){let n=e.push(`tbody_open`,`tbody`,1);n.map=v=[t+2,0]}let a=e.push(`tr_open`,`tr`,1);a.map=[i,i+1];for(let t=0;t<d;t++){let n=e.push(`td_open`,`td`,1);u[t]&&(n.attrs=[[`style`,`text-align:`+u[t]]]);let r=e.push(`inline`,``,0);r.content=l[t]?l[t].trim():``,r.children=[],e.push(`td_close`,`td`,-1)}e.push(`tr_close`,`tr`,-1)}return v&&(e.push(`tbody_close`,`tbody`,-1),v[1]=i),e.push(`table_close`,`table`,-1),h[1]=i,e.parentType=f,e.line=i,!0}function Kg(e,t,n){if(e.sCount[t]-e.blkIndent<4)return!1;let r=t+1,i=r;for(;r<n;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,i=r;continue}break}e.line=i;let a=e.push(`code_block`,`code`,0);return a.content=e.getLines(t,i,4+e.blkIndent,!1)+` 131`,a.map=[t,e.line],!0}function qg(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||i+3>a)return!1;let o=e.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let s=i;i=e.skipChars(i,o);let c=i-s;if(c<3)return!1;let l=e.src.slice(s,i),u=e.src.slice(i,a);if(o===96&&u.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=t,f=!1;for(;d++,!(d>=n||(i=s=e.bMarks[d]+e.tShift[d],a=e.eMarks[d],i<a&&e.sCount[d]<e.blkIndent));)if(e.src.charCodeAt(i)===o&&!(e.sCount[d]-e.blkIndent>=4)&&(i=e.skipChars(i,o),!(i-s<c)&&(i=e.skipSpaces(i),!(i<a)))){f=!0;break}c=e.sCount[t],e.line=d+ +!!f;let p=e.push(`fence`,`code`,0);return p.info=u,p.content=e.getLines(t+1,d,c,!0),p.markup=l,p.map=[t,e.line],!0}function Jg(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=e.lineMax;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==62)return!1;if(r)return!0;let s=[],c=[],l=[],u=[],d=e.md.block.ruler.getRules(`blockquote`),f=e.parentType;e.parentType=`blockquote`;let p=!1,m;for(m=t;m<n;m++){let t=e.sCount[m]<e.blkIndent;if(i=e.bMarks[m]+e.tShift[m],a=e.eMarks[m],i>=a)break;if(e.src.charCodeAt(i++)===62&&!t){let t=e.sCount[m]+1,n,r;e.src.charCodeAt(i)===32?(i++,t++,r=!1,n=!0):e.src.charCodeAt(i)===9?(n=!0,(e.bsCount[m]+t)%4==3?(i++,t++,r=!1):r=!0):n=!1;let o=t;for(s.push(e.bMarks[m]),e.bMarks[m]=i;i<a;){let t=e.src.charCodeAt(i);if($(t))t===9?o+=4-(o+e.bsCount[m]+ +!!r)%4:o++;else break;i++}p=i>=a,c.push(e.bsCount[m]),e.bsCount[m]=e.sCount[m]+1+ +!!n,l.push(e.sCount[m]),e.sCount[m]=o-t,u.push(e.tShift[m]),e.tShift[m]=i-e.bMarks[m];continue}if(p)break;let r=!1;for(let t=0,i=d.length;t<i;t++)if(d[t](e,m,n,!0)){r=!0;break}if(r){e.lineMax=m,e.blkIndent!==0&&(s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]-=e.blkIndent);break}s.push(e.bMarks[m]),c.push(e.bsCount[m]),u.push(e.tShift[m]),l.push(e.sCount[m]),e.sCount[m]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push(`blockquote_open`,`blockquote`,1);g.markup=`>`;let _=[t,0];g.map=_,e.md.block.tokenize(e,t,m);let v=e.push(`blockquote_close`,`blockquote`,-1);v.markup=`>`,e.lineMax=o,e.parentType=f,_[1]=e.line;for(let n=0;n<u.length;n++)e.bMarks[n+t]=s[n],e.tShift[n+t]=u[n],e.sCount[n+t]=l[n],e.bsCount[n+t]=c[n];return e.blkIndent=h,!0}function Yg(e,t,n,r){let i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let a=e.bMarks[t]+e.tShift[t],o=e.src.charCodeAt(a++);if(o!==42&&o!==45&&o!==95)return!1;let s=1;for(;a<i;){let t=e.src.charCodeAt(a++);if(t!==o&&!$(t))return!1;t===o&&s++}if(s<3)return!1;if(r)return!0;e.line=t+1;let c=e.push(`hr`,`hr`,0);return c.map=[t,e.line],c.markup=Array(s+1).join(String.fromCharCode(o)),!0}function Xg(e,t){let n=e.eMarks[t],r=e.bMarks[t]+e.tShift[t],i=e.src.charCodeAt(r++);return i!==42&&i!==45&&i!==43||r<n&&!$(e.src.charCodeAt(r))?-1:r}function Zg(e,t){let n=e.bMarks[t]+e.tShift[t],r=e.eMarks[t],i=n;if(i+1>=r)return-1;let a=e.src.charCodeAt(i++);if(a<48||a>57)return-1;for(;;){if(i>=r)return-1;if(a=e.src.charCodeAt(i++),a>=48&&a<=57){if(i-n>=10)return-1;continue}if(a===41||a===46)break;return-1}return i<r&&(a=e.src.charCodeAt(i),!$(a))?-1:i}function Qg(e,t){let n=e.level+2;for(let r=t+2,i=e.tokens.length-2;r<i;r++)e.tokens[r].level===n&&e.tokens[r].type===`paragraph_open`&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function $g(e,t,n,r){let i,a,o,s,c=t,l=!0;if(e.sCount[c]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[c]-e.listIndent>=4&&e.sCount[c]<e.blkIndent)return!1;let u=!1;r&&e.parentType===`paragraph`&&e.sCount[c]>=e.blkIndent&&(u=!0);let d,f,p;if((p=Zg(e,c))>=0){if(d=!0,o=e.bMarks[c]+e.tShift[c],f=Number(e.src.slice(o,p-1)),u&&f!==1)return!1}else if((p=Xg(e,c))>=0)d=!1;else return!1;if(u&&e.skipSpaces(p)>=e.eMarks[c])return!1;if(r)return!0;let m=e.src.charCodeAt(p-1),h=e.tokens.length;d?(s=e.push(`ordered_list_open`,`ol`,1),f!==1&&(s.attrs=[[`start`,f]])):s=e.push(`bullet_list_open`,`ul`,1);let g=[c,0];s.map=g,s.markup=String.fromCharCode(m);let _=!1,v=e.md.block.ruler.getRules(`list`),y=e.parentType;for(e.parentType=`list`;c<n;){a=p,i=e.eMarks[c];let t=e.sCount[c]+p-(e.bMarks[c]+e.tShift[c]),r=t;for(;a<i;){let t=e.src.charCodeAt(a);if(t===9)r+=4-(r+e.bsCount[c])%4;else if(t===32)r++;else break;a++}let u=a,f;f=u>=i?1:r-t,f>4&&(f=1);let h=t+f;s=e.push(`list_item_open`,`li`,1),s.markup=String.fromCharCode(m);let g=[c,0];s.map=g,d&&(s.info=e.src.slice(o,p-1));let y=e.tight,b=e.tShift[c],x=e.sCount[c],S=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=h,e.tight=!0,e.tShift[c]=u-e.bMarks[c],e.sCount[c]=r,u>=i&&e.isEmpty(c+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,c,n,!0),(!e.tight||_)&&(l=!1),_=e.line-c>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=S,e.tShift[c]=b,e.sCount[c]=x,e.tight=y,s=e.push(`list_item_close`,`li`,-1),s.markup=String.fromCharCode(m),c=e.line,g[1]=c,c>=n||e.sCount[c]<e.blkIndent||e.sCount[c]-e.blkIndent>=4)break;let C=!1;for(let t=0,r=v.length;t<r;t++)if(v[t](e,c,n,!0)){C=!0;break}if(C)break;if(d){if(p=Zg(e,c),p<0)break;o=e.bMarks[c]+e.tShift[c]}else if(p=Xg(e,c),p<0)break;if(m!==e.src.charCodeAt(p-1))break}return s=d?e.push(`ordered_list_close`,`ol`,-1):e.push(`bullet_list_close`,`ul`,-1),s.markup=String.fromCharCode(m),g[1]=c,e.line=c,e.parentType=y,l&&Qg(e,h),!0}function e_(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t],o=t+1;if(e.sCount[t]-e.blkIndent>=4||e.src.charCodeAt(i)!==91)return!1;function s(t){let n=e.lineMax;if(t>=n||e.isEmpty(t))return null;let r=!1;if(e.sCount[t]-e.blkIndent>3&&(r=!0),e.sCount[t]<0&&(r=!0),!r){let r=e.md.block.ruler.getRules(`reference`),i=e.parentType;e.parentType=`reference`;let a=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,t,n,!0)){a=!0;break}if(e.parentType=i,a)return null}let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];return e.src.slice(i,a+1)}let c=e.src.slice(i,a+1);a=c.length;let l=-1;for(i=1;i<a;i++){let e=c.charCodeAt(i);if(e===91)return!1;if(e===93){l=i;break}else if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(e===92&&(i++,i<a&&c.charCodeAt(i)===10)){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}}if(l<0||c.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!$(e))break}let u=e.md.helpers.parseLinkDestination(c,i,a);if(!u.ok)return!1;let d=e.md.normalizeLink(u.str);if(!e.md.validateLink(d))return!1;i=u.pos;let f=i,p=o,m=i;for(;i<a;i++){let e=c.charCodeAt(i);if(e===10){let e=s(o);e!==null&&(c+=e,a=c.length,o++)}else if(!$(e))break}let h=e.md.helpers.parseLinkTitle(c,i,a);for(;h.can_continue;){let t=s(o);if(t===null)break;c+=t,i=a,a=c.length,o++,h=e.md.helpers.parseLinkTitle(c,i,a,h)}let g;for(i<a&&m!==i&&h.ok?(g=h.str,i=h.pos):(g=``,i=f,o=p);i<a&&$(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10&&g)for(g=``,i=f,o=p;i<a&&$(c.charCodeAt(i));)i++;if(i<a&&c.charCodeAt(i)!==10)return!1;let _=ng(c.slice(1,l));return _?r?!0:(e.env.references===void 0&&(e.env.references={}),e.env.references[_]===void 0&&(e.env.references[_]={title:g,href:d}),e.line=o,!0):!1}var t_=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),n_=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`),r_=RegExp(`^(?:<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>|<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>)`),i_=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[RegExp(`^</?(`+t_.join(`|`)+`)(?=(\\s|/?>|$))`,`i`),/^$/,!0],[RegExp(r_.source+`\\s*$`),/^$/,!1]];function a_(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(i)!==60)return!1;let o=e.src.slice(i,a),s=0;for(;s<i_.length&&!i_[s][0].test(o);s++);if(s===i_.length)return!1;if(r)return i_[s][2];let c=t+1,l=i_[s][1].test(``);if(!i_[s][1].test(o)){for(;c<n&&!(e.sCount[c]<e.blkIndent&&(l||!e.isEmpty(c)));c++)if(i=e.bMarks[c]+e.tShift[c],a=e.eMarks[c],o=e.src.slice(i,a),i_[s][1].test(o)){o.length!==0&&c++;break}}e.line=c;let u=e.push(`html_block`,``,0);return u.map=[t,c],u.content=e.getLines(t,c,e.blkIndent,!0),!0}function o_(e,t,n,r){let i=e.bMarks[t]+e.tShift[t],a=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let o=e.src.charCodeAt(i);if(o!==35||i>=a)return!1;let s=1;for(o=e.src.charCodeAt(++i);o===35&&i<a&&s<=6;)s++,o=e.src.charCodeAt(++i);if(s>6||i<a&&!$(o))return!1;if(r)return!0;a=e.skipSpacesBack(a,i);let c=e.skipCharsBack(a,35,i);c>i&&$(e.src.charCodeAt(c-1))&&(a=c),e.line=t+1;let l=e.push(`heading_open`,`h`+String(s),1);l.markup=`########`.slice(0,s),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=ig(e.src.slice(i,a)),u.map=[t,e.line],u.children=[];let d=e.push(`heading_close`,`h`+String(s),-1);return d.markup=`########`.slice(0,s),!0}function s_(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`);if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.parentType;e.parentType=`paragraph`;let a=0,o,s=t+1;for(;s<n&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3)continue;if(e.sCount[s]>=e.blkIndent){let t=e.bMarks[s]+e.tShift[s],n=e.eMarks[s];if(t<n&&(o=e.src.charCodeAt(t),(o===45||o===61)&&(t=e.skipChars(t,o),t=e.skipSpaces(t),t>=n))){a=o===61?1:2;break}}if(e.sCount[s]<0)continue;let t=!1;for(let i=0,a=r.length;i<a;i++)if(r[i](e,s,n,!0)){t=!0;break}if(t)break}if(!a)return e.parentType=i,!1;let c=ig(e.getLines(t,s,e.blkIndent,!1));e.line=s+1;let l=e.push(`heading_open`,`h`+String(a),1);l.markup=String.fromCharCode(o),l.map=[t,e.line];let u=e.push(`inline`,``,0);u.content=c,u.map=[t,e.line-1],u.children=[];let d=e.push(`heading_close`,`h`+String(a),-1);return d.markup=String.fromCharCode(o),e.parentType=i,!0}function c_(e,t,n){let r=e.md.block.ruler.getRules(`paragraph`),i=e.parentType,a=t+1;for(e.parentType=`paragraph`;a<n&&!e.isEmpty(a);a++){if(e.sCount[a]-e.blkIndent>3||e.sCount[a]<0)continue;let t=!1;for(let i=0,o=r.length;i<o;i++)if(r[i](e,a,n,!0)){t=!0;break}if(t)break}let o=ig(e.getLines(t,a,e.blkIndent,!1));e.line=a;let s=e.push(`paragraph_open`,`p`,1);s.map=[t,e.line];let c=e.push(`inline`,``,0);return c.content=o,c.map=[t,e.line],c.children=[],e.push(`paragraph_close`,`p`,-1),e.parentType=i,!0}var l_=[[`table`,Gg,[`paragraph`,`reference`]],[`code`,Kg],[`fence`,qg,[`paragraph`,`reference`,`blockquote`,`list`]],[`blockquote`,Jg,[`paragraph`,`reference`,`blockquote`,`list`]],[`hr`,Yg,[`paragraph`,`reference`,`blockquote`,`list`]],[`list`,$g,[`paragraph`,`reference`,`blockquote`]],[`reference`,e_],[`html_block`,a_,[`paragraph`,`reference`,`blockquote`]],[`heading`,o_,[`paragraph`,`reference`,`blockquote`]],[`lheading`,s_],[`paragraph`,c_]];
131function u_(){this.ruler=new fg;for(let e=0;e<l_.length;e++)this.ruler.push(l_[e][0],l_[e][1],{alt:(l_[e][2]||[]).slice()})}u_.prototype.tokenize=function(e,t,n){let r=this.ruler.getRules(``),i=r.length,a=e.md.options.maxNesting,o=t,s=!1;for(;o<n&&(e.line=o=e.skipEmptyLines(o),!(o>=n||e.sCount[o]<e.blkIndent));){if(e.level>=a){e.line=n;break}let t=e.line,c=!1;for(let a=0;a<i;a++)if(c=r[a](e,o,n,!1),c){if(t>=e.line)throw Error(`block rule didn't increment state.line`);break}if(!c)throw Error(`none of the block rules matched`);e.tight=!s,e.isEmpty(e.line-1)&&(s=!0),o=e.line,o<n&&e.isEmpty(o)&&(s=!0,o++,e.line=o)}},u_.prototype.parse=function(e,t,n,r){if(!e)return;let i=new this.State(e,t,n,r);this.tokenize(i,i.line,i.lineMax)},u_.prototype.State=Vg;function d_(e,t,n,r){this.src=e,this.env=n,this.md=t,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending=``,this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}d_.prototype.pushPending=function(){let e=new pg(`text`,``,0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending=``,e},d_.prototype.push=function(e,t,n){this.pending&&this.pushPending();let r=new pg(e,t,n),i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r},d_.prototype.scanDelims=function(e,t){let n=this.posMax,r=this.src.charCodeAt(e),i;if(e===0)i=32;else if(e===1)i=this.src.charCodeAt(0),(i&63488)==55296&&(i=65533);else if(i=this.src.charCodeAt(e-1),(i&64512)==56320){let t=this.src.charCodeAt(e-2);i=(t&64512)==55296?65536+(t-55296<<10)+(i-56320):65533}else (i&64512)==55296&&(i=65533);let a=e;for(;a<n&&this.src.charCodeAt(a)===r;)a++;let o=a-e,s=a<n?this.src.charCodeAt(a):32;if((s&64512)==55296){let e=this.src.charCodeAt(a+1);s=(e&64512)==56320?65536+(s-55296<<10)+(e-56320):65533}else (s&64512)==56320&&(s=65533);let c=tg(i)||eg(i),l=tg(s)||eg(s),u=Qh(i),d=Qh(s),f=!d&&(!l||u||c),p=!u&&(!c||d||l);return{can_open:f&&(t||!p||c),can_close:p&&(t||!f||l),length:o}},d_.prototype.Token=pg;function f_(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function p_(e,t){let n=e.pos;for(;n<e.posMax&&!f_(e.src.charCodeAt(n));)n++;return n===e.pos?!1:(t||(e.pending+=e.src.slice(e.pos,n)),e.pos=n,!0)}var m_=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function h_(e,t){if(!e.md.options.linkify||e.linkLevel>0)return!1;let n=e.pos,r=e.posMax;if(n+3>r||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;let i=e.pending.match(m_);if(!i)return!1;let a=i[1],o=e.md.linkify.matchAtStart(e.src.slice(n-a.length));if(!o)return!1;let s=o.url;if(s.length<=a.length)return!1;let c=s.length;for(;c>0&&s.charCodeAt(c-1)===42;)c--;c!==s.length&&(s=s.slice(0,c));let l=e.md.normalizeLink(s);if(!e.md.validateLink(l))return!1;if(!t){e.pending=e.pending.slice(0,-a.length);let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,l]],t.markup=`linkify`,t.info=`auto`;let n=e.push(`text`,``,0);n.content=e.md.normalizeLinkText(s);let r=e.push(`link_close`,`a`,-1);r.markup=`linkify`,r.info=`auto`}return e.pos+=s.length-a.length,!0}function g_(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;let r=e.pending.length-1,i=e.posMax;if(!t)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let t=r-1;for(;t>=1&&e.pending.charCodeAt(t-1)===32;)t--;e.pending=e.pending.slice(0,t),e.push(`hardbreak`,`br`,0)}else e.pending=e.pending.slice(0,-1),e.push(`softbreak`,`br`,0);else e.push(`softbreak`,`br`,0);for(n++;n<i&&$(e.src.charCodeAt(n));)n++;return e.pos=n,!0}var __=[];for(let e=0;e<256;e++)__.push(0);`\\!"#$%&'()*+,./:;<=>?@[]^_\`{|}~-`.split(``).forEach(function(e){__[e.charCodeAt(0)]=1});function v_(e,t){let n=e.pos,r=e.posMax;
131if(e.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=e.src.charCodeAt(n);if(i===10){for(t||e.push(`hardbreak`,`br`,0),n++;n<r&&(i=e.src.charCodeAt(n),$(i));)n++;return e.pos=n,!0}let a=e.src[n];if(i>=55296&&i<=56319&&n+1<r){let t=e.src.charCodeAt(n+1);t>=56320&&t<=57343&&(a+=e.src[n+1],n++)}let o=`\\`+a;if(!t){let t=e.push(`text_special`,``,0);i<256&&__[i]!==0?t.content=a:t.content=o,t.markup=o,t.info=`escape`}return e.pos=n+1,!0}function y_(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==96)return!1;let r=n;n++;let i=e.posMax;for(;n<i&&e.src.charCodeAt(n)===96;)n++;let a=e.src.slice(r,n),o=a.length;if(e.backticksScanned&&(e.backticks[o]||0)<=r)return t||(e.pending+=a),e.pos+=o,!0;let s=n,c;for(;(c=e.src.indexOf("`",s))!==-1;){for(s=c+1;s<i&&e.src.charCodeAt(s)===96;)s++;let r=s-c;if(r===o){if(!t){let t=e.push(`code_inline`,`code`,0);t.markup=a,t.content=e.src.slice(n,c).replace(/\n/g,` `).replace(/^ (.+) $/,`$1`)}return e.pos=s,!0}e.backticks[r]=c}return e.backticksScanned=!0,t||(e.pending+=a),e.pos+=o,!0}function b_(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==126)return!1;let i=e.scanDelims(e.pos,!0),a=i.length,o=String.fromCharCode(r);if(a<2)return!1;let s;a%2&&(s=e.push(`text`,``,0),s.content=o,a--);for(let t=0;t<a;t+=2)s=e.push(`text`,``,0),s.content=o+o,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return e.pos+=i.length,!0}function x_(e,t){let n,r=[],i=t.length;for(let a=0;a<i;a++){let i=t[a];if(i.marker!==126||i.end===-1)continue;let o=t[i.end];n=e.tokens[i.token],n.type=`s_open`,n.tag=`s`,n.nesting=1,n.markup=`~~`,n.content=``,n=e.tokens[o.token],n.type=`s_close`,n.tag=`s`,n.nesting=-1,n.markup=`~~`,n.content=``,e.tokens[o.token-1].type===`text`&&e.tokens[o.token-1].content===`~`&&r.push(o.token-1)}for(;r.length;){let t=r.pop(),i=t+1;for(;i<e.tokens.length&&e.tokens[i].type===`s_close`;)i++;i--,t!==i&&(n=e.tokens[i],e.tokens[i]=e.tokens[t],e.tokens[t]=n)}}function S_(e){let t=e.tokens_meta,n=e.tokens_meta.length;x_(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&x_(e,t[r].delimiters)}var C_={tokenize:b_,postProcess:S_};function w_(e,t){let n=e.pos,r=e.src.charCodeAt(n);if(t||r!==95&&r!==42)return!1;let i=e.scanDelims(e.pos,r===42);for(let t=0;t<i.length;t++){let t=e.push(`text`,``,0);t.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:i.length,token:e.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return e.pos+=i.length,!0}function T_(e,t){let n=t.length;for(let r=n-1;r>=0;r--){let n=t[r];if(n.marker!==95&&n.marker!==42||n.end===-1)continue;let i=t[n.end],a=r>0&&t[r-1].end===n.end+1&&t[r-1].marker===n.marker&&t[r-1].token===n.token-1&&t[n.end+1].token===i.token+1,o=String.fromCharCode(n.marker),s=e.tokens[n.token];s.type=a?`strong_open`:`em_open`,s.tag=a?`strong`:`em`,s.nesting=1,s.markup=a?o+o:o,s.content=``;let c=e.tokens[i.token];c.type=a?`strong_close`:`em_close`,c.tag=a?`strong`:`em`,c.nesting=-1,c.markup=a?o+o:o,c.content=``,a&&(e.tokens[t[r-1].token].content=``,e.tokens[t[n.end+1].token].content=``,r--)}}function E_(e){let t=e.tokens_meta,n=e.tokens_meta.length;T_(e,e.delimiters);for(let r=0;r<n;r++)t[r]&&t[r].delimiters&&T_(e,t[r].delimiters)}var D_={tokenize:w_,postProcess:E_};function O_(e,t){let n,r,i,a,o=``,s=``,c=e.pos,l=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let u=e.pos,d=e.posMax,f=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let m=p+1;if(m<d&&e.src.charCodeAt(m)===40){for(l=!1,m++;m<d&&(n=e.src.charCodeAt(m),!(!$(n)&&n!==10));m++);if(m>=d)return!1;if(c=m,i=e.md.helpers.parseLinkDestination(e.src,m,e.posMax),i.ok){for(o=e.md.normalizeLink(i.str),e.md.validateLink(o)?m=i.pos:o=``,c=m;m<d&&(n=e.src.charCodeAt(m),!(!$(n)&&n!==10));m++);if(i=e.md.helpers.parseLinkTitle(e.src,m,e.posMax),m<d&&c!==m&&i.ok)for(s=i.str,m=i.pos;m<d&&(n=e.src.charCodeAt(m),!(!$(n)&&n!==10));m++);}(m>=d||e.src.charCodeAt(m)!==41)&&(l=!0),m++}if(l){if(e.env.references===void 0)return!1;if(m<d&&e.src.charCodeAt(m)===91?(c=m+1,m=e.md.helpers.parseLinkLabel(e,m),m>=0?r=e.src.slice(c,m++):m=p+1):m=p+1,r||=e.src.slice(f,p),a=e.env.references[ng(r)],!a)return e.pos=u,!1;o=a.href,s=a.title}if(!t){e.pos=f,e.posMax=p;let t=e.push(`link_open`,`a`,1),n=[[`href`,o]];t.attrs=n,s&&n.push([`title`,s]),e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push(`link_close`,`a`,-1)}return e.pos=m,e.posMax=d,!0}function k_(e,t){let n,r,i,a,o,s,c,l,u=``,d=e.pos,f=e.posMax;
vendor: 7,200 bytes, line 131
131if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,m=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(m<0)return!1;if(a=m+1,a<f&&e.src.charCodeAt(a)===40){for(a++;a<f&&(n=e.src.charCodeAt(a),!(!$(n)&&n!==10));a++);if(a>=f)return!1;for(l=a,s=e.md.helpers.parseLinkDestination(e.src,a,e.posMax),s.ok&&(u=e.md.normalizeLink(s.str),e.md.validateLink(u)?a=s.pos:u=``),l=a;a<f&&(n=e.src.charCodeAt(a),!(!$(n)&&n!==10));a++);if(s=e.md.helpers.parseLinkTitle(e.src,a,e.posMax),a<f&&l!==a&&s.ok)for(c=s.str,a=s.pos;a<f&&(n=e.src.charCodeAt(a),!(!$(n)&&n!==10));a++);else c=``;if(a>=f||e.src.charCodeAt(a)!==41)return e.pos=d,!1;a++}else{if(e.env.references===void 0)return!1;if(a<f&&e.src.charCodeAt(a)===91?(l=a+1,a=e.md.helpers.parseLinkLabel(e,a),a>=0?i=e.src.slice(l,a++):a=m+1):a=m+1,i||=e.src.slice(p,m),o=e.env.references[ng(i)],!o)return e.pos=d,!1;u=o.href,c=o.title}if(!t){r=e.src.slice(p,m);let t=[];e.md.inline.parse(r,e.md,e.env,t);let n=e.push(`image`,`img`,0),i=[[`src`,u],[`alt`,``]];n.attrs=i,n.children=t,n.content=r,c&&i.push([`title`,c])}return e.pos=a,e.posMax=f,!0}var A_=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,j_=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function M_(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==60)return!1;let r=e.pos,i=e.posMax;for(;;){if(++n>=i)return!1;let t=e.src.charCodeAt(n);if(t===60)return!1;if(t===62)break}let a=e.src.slice(r+1,n);if(j_.test(a)){let n=e.md.normalizeLink(a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}if(A_.test(a)){let n=e.md.normalizeLink(`mailto:`+a);if(!e.md.validateLink(n))return!1;if(!t){let t=e.push(`link_open`,`a`,1);t.attrs=[[`href`,n]],t.markup=`autolink`,t.info=`auto`;let r=e.push(`text`,``,0);r.content=e.md.normalizeLinkText(a);let i=e.push(`link_close`,`a`,-1);i.markup=`autolink`,i.info=`auto`}return e.pos+=a.length+2,!0}return!1}function N_(e){return/^<a[>\s]/i.test(e)}function P_(e){return/^<\/a\s*>/i.test(e)}function F_(e){let t=e|32;return t>=97&&t<=122}function I_(e,t){if(!e.md.options.html)return!1;let n=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=n)return!1;let i=e.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!F_(i))return!1;let a=e.src.slice(r).match(n_);if(!a)return!1;if(!t){let t=e.push(`html_inline`,``,0);t.content=a[0],N_(t.content)&&e.linkLevel++,P_(t.content)&&e.linkLevel--}return e.pos+=a[0].length,!0}var L_=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,R_=/^&([a-z][a-z0-9]{1,31});/i;function z_(e,t){let n=e.pos,r=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=r)return!1;if(e.src.charCodeAt(n+1)===35){let r=e.src.slice(n).match(L_);if(r){if(!t){let t=r[1][0].toLowerCase()===`x`?parseInt(r[1].slice(1),16):parseInt(r[1],10),n=e.push(`text_special`,``,0);n.content=Lh(t)?Rh(t):Rh(65533),n.markup=r[0],n.info=`entity`}return e.pos+=r[0].length,!0}}else{let r=e.src.slice(n).match(R_);if(r){let n=Be(r[0]);if(n!==r[0]){if(!t){let t=e.push(`text_special`,``,0);t.content=n,t.markup=r[0],t.info=`entity`}return e.pos+=r[0].length,!0}}}return!1}function B_(e){let t={},n=e.length;if(!n)return;let r=0,i=-2,a=[];for(let o=0;o<n;o++){let n=e[o];if(a.push(0),(e[r].marker!==n.marker||i!==n.token-1)&&(r=o),i=n.token,n.length=n.length||0,!n.close)continue;t.hasOwnProperty(n.marker)||(t[n.marker]=[-1,-1,-1,-1,-1,-1]);let s=t[n.marker][(n.open?3:0)+n.length%3],c=r-a[r]-1,l=c;for(;c>s;c-=a[c]+1){let t=e[c];if(t.marker===n.marker&&t.open&&t.end<0){let r=!1;if((t.close||n.open)&&(t.length+n.length)%3==0&&(t.length%3!=0||n.length%3!=0)&&(r=!0),!r){let r=c>0&&!e[c-1].open?a[c-1]+1:0;a[o]=o-c+r,a[c]=r,n.open=!1,t.end=o,t.close=!1,l=-1,i=-2;break}}}l!==-1&&(t[n.marker][(n.open?3:0)+(n.length||0)%3]=l)}}function V_(e){let t=e.tokens_meta,n=e.tokens_meta.length;B_(e.delimiters);for(let e=0;e<n;e++)t[e]&&t[e].delimiters&&B_(t[e].delimiters)}function H_(e){let t,n,r=0,i=e.tokens,a=e.tokens.length;for(t=n=0;t<a;t++)i[t].nesting<0&&r--,i[t].level=r,i[t].nesting>0&&r++,i[t].type===`text`&&t+1<a&&i[t+1].type===`text`?i[t+1].content=i[t].content+i[t+1].content:(t!==n&&(i[n]=i[t]),n++);t!==n&&(i.length=n)}var U_=[[`text`,p_],[`linkify`,h_],[`newline`,g_],[`escape`,v_],[`backticks`,y_],[`strikethrough`,C_.tokenize],[`emphasis`,D_.tokenize],[`link`,O_],[`image`,k_],[`autolink`,M_],[`html_inline`,I_],[`entity`,z_]],W_=[[`balance_pairs`,V_],[`strikethrough`,C_.postProcess],[`emphasis`,D_.postProcess],[`fragments_join`,H_]];function G_(){this.ruler=new fg;for(let e=0;e<U_.length;e++)this.ruler.push(U_[e][0],U_[e][1]);this.ruler2=new fg;for(let e=0;e<W_.length;e++)this.ruler2.push(W_[e][0],W_[e][1])}G_.prototype.skipToken=function(e){let t=e.pos,n=this.ruler.getRules(``),r=n.length,i=e.md.options.maxNesting,a=e.cache;if(a[t]!==void 0){e.pos=a[t];return}let o=!1;if(e.level<i){for(let i=0;i<r;i++)if(e.level++,o=n[i](e,!0),e.level--,o){if(t>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}else e.pos=e.posMax;o||e.pos++,a[t]=e.pos},G_.prototype.tokenize=function(e){let t=this.ruler.getRules(``),n=t.length,r=e.posMax,i=e.md.options.maxNesting;for(;e.pos<r;){let a=e.pos,o=!1;if(e.level<i){for(let r=0;r<n;r++)if(o=t[r](e,!1),o){if(a>=e.pos)throw Error(`inline rule didn't increment state.pos`);break}}if(o){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()},G_.prototype.parse=function(e,t,n,r){let i=new this.State(e,t,n,r);this.tokenize(i);let a=this.ruler2.getRules(``),o=a.length;for(let e=0;e<o;e++)a[e](i)},G_.prototype.State=d_;function K_(e){let t={};e||={},t.src_Any=Ch.source,t.src_Cc=wh.source,t.src_Z=Oh.source,t.src_P=Eh.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join(`|`),t.src_ZCc=[t.src_Z,t.src_Cc].join(`|`);let n=`[><ï½]`;return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4=`(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)`,t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port=`(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?`,t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e[`---`]?`-(?!--)|`:`-|`}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e[`---`]?`\\-(?!--(?:[^-]|$))(?:-*)|`:`\\-+|`)+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name=`[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}`,t.src_xn=`xn--[a-z0-9\\-]{1,59}`,t.src_domain_root=`(?:`+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain=`(?:`+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}
131))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy=`(?:`+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uff5c]|${t.src_ZPCc}))((?![$+<=>^\`|\uff5c])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function q_(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function J_(e){return Object.prototype.toString.call(e)}function Y_(e){return J_(e)===`[object String]`}function X_(e){return J_(e)===`[object Object]`}function Z_(e){return J_(e)===`[object RegExp]`}function Q_(e){return J_(e)===`[object Function]`}function $_(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,`\\$&`)}var ev={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function tv(e){return Object.keys(e||{}).reduce(function(e,t){return e||ev.hasOwnProperty(t)},!1)}var nv={"http:":{validate:function(e,t,n){let r=e.slice(t);return n.re.http||(n.re.http=RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,`i`)),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":`http:`,"ftp:":`http:`,"//":{validate:function(e,t,n){let r=e.slice(t);return n.re.no_http||(n.re.no_http=RegExp(`^`+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,`i`)),n.re.no_http.test(r)?t>=3&&e[t-3]===`:`||t>=3&&e[t-3]===`/`?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){let r=e.slice(t);return n.re.mailto||(n.re.mailto=RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,`i`)),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},rv=`a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]`,iv=`biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|ÑÑ`.split(`|`);function av(e){return function(t,n){let r=t.slice(n);return e.test(r)?r.match(e)[0].length:0}}function ov(){return function(e,t){t.normalize(e)}}function sv(e){let t=e.re=K_(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(rv),n.push(t.src_xn),t.src_tlds=n.join(`|`);function r(e){return e.replace(`%TLDS%`,t.src_tlds)}t.email_fuzzy=RegExp(r(t.tpl_email_fuzzy),`i`),t.email_fuzzy_global=RegExp(r(t.tpl_email_fuzzy),`ig`),t.link_fuzzy=RegExp(r(t.tpl_link_fuzzy),`i`),t.link_fuzzy_global=RegExp(r(t.tpl_link_fuzzy),`ig`),t.link_no_ip_fuzzy=RegExp(r(t.tpl_link_no_ip_fuzzy),`i`),t.link_no_ip_fuzzy_global=RegExp(r(t.tpl_link_no_ip_fuzzy),`ig`),t.host_fuzzy_test=RegExp(r(t.tpl_host_fuzzy_test),`i`);let i=[];e.__compiled__={};function a(e,t){throw Error(`(LinkifyIt) Invalid schema "${e}": ${t}`)}Object.keys(e.__schemas__).forEach(function(t){let n=e.__schemas__[t];if(n===null)return;let r={validate:null,link:null};if(e.__compiled__[t]=r,X_(n)){Z_(n.validate)?r.validate=av(n.validate):Q_(n.validate)?r.validate=n.validate:a(t,n),Q_(n.normalize)?r.normalize=n.normalize:n.normalize?a(t,n):r.normalize=ov();return}if(Y_(n)){i.push(t);return}a(t,n)}
vendor: 5,521 bytes, line 131
131),i.forEach(function(t){e.__compiled__[e.__schemas__[t]]&&(e.__compiled__[t].validate=e.__compiled__[e.__schemas__[t]].validate,e.__compiled__[t].normalize=e.__compiled__[e.__schemas__[t]].normalize)}),e.__compiled__[``]={validate:null,normalize:ov()};let o=Object.keys(e.__compiled__).filter(function(t){return t.length>0&&e.__compiled__[t]}).map($_).join(`|`);e.re.schema_test=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`i`),e.re.schema_search=RegExp(`(^|(?!_)(?:[><\uff5c]|${t.src_ZPCc}))(${o})`,`ig`),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,`i`),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,`i`)}function cv(e,t,n,r){let i=e.slice(n,r);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=r,this.raw=i,this.text=i,this.url=i}function lv(e,t){if(!(this instanceof lv))return new lv(e,t);t||tv(e)&&(t=e,e={}),this.__opts__=q_({},ev,t),this.__schemas__=q_({},nv,e),this.__compiled__={},this.__tlds__=iv,this.__tlds_replaced__=!1,this.re={},sv(this)}lv.prototype.add=function(e,t){return this.__schemas__[e]=t,sv(this),this},lv.prototype.set=function(e){return this.__opts__=q_(this.__opts__,e),this},lv.prototype.test=function(e){if(!e.length)return!1;let t,n;if(this.re.schema_test.test(e)){for(n=this.re.schema_search,n.lastIndex=0;(t=n.exec(e))!==null;)if(this.testSchemaAt(e,t[2],n.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__[`http:`]&&e.search(this.re.host_fuzzy_test)>=0&&e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`]&&e.indexOf(`@`)>=0&&e.match(this.re.email_fuzzy)!==null)},lv.prototype.pretest=function(e){return this.re.pretest.test(e)},lv.prototype.testSchemaAt=function(e,t,n){return this.__compiled__[t.toLowerCase()]?this.__compiled__[t.toLowerCase()].validate(e,n,this):0},lv.prototype.match=function(e){let t=[],n=[],r=[],i=[],a,o,s;function c(e,t){return e?t?e.index===t.index?e.lastIndex>=t.lastIndex?e:t:e.index<t.index?e:t:e:t}if(!e.length)return null;if(this.re.schema_test.test(e))for(s=this.re.schema_search,s.lastIndex=0;(a=s.exec(e))!==null;)o=this.testSchemaAt(e,a[2],s.lastIndex),o&&n.push({schema:a[2],index:a.index+a[1].length,lastIndex:a.index+a[0].length+o});if(this.__opts__.fuzzyLink&&this.__compiled__[`http:`])for(s=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)r.push({schema:``,index:a.index+a[1].length,lastIndex:a.index+a[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__[`mailto:`])for(s=this.re.email_fuzzy_global,s.lastIndex=0;(a=s.exec(e))!==null;)i.push({schema:`mailto:`,index:a.index+a[1].length,lastIndex:a.index+a[0].length});let l=[0,0,0],u=0;for(;;){let a=[n[l[0]],i[l[1]],r[l[2]]],o=c(c(a[0],a[1]),a[2]);if(!o)break;if(o===a[0]?l[0]++:o===a[1]?l[1]++:l[2]++,o.index<u)continue;let s=new cv(e,o.schema,o.index,o.lastIndex);this.__compiled__[s.schema].normalize(s,this),t.push(s),u=o.lastIndex}return t.length?t:null},lv.prototype.matchAtStart=function(e){if(!e.length)return null;let t=this.re.schema_at_start.exec(e);if(!t)return null;let n=this.testSchemaAt(e,t[2],t[0].length);if(!n)return null;let r=new cv(e,t[2],t.index+t[1].length,t.index+t[0].length+n);return this.__compiled__[r.schema].normalize(r,this),r},lv.prototype.tlds=function(e,t){return e=Array.isArray(e)?e:[e],t?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(e,t,n){return e!==n[t-1]}).reverse(),sv(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,sv(this),this)},lv.prototype.normalize=function(e){e.schema||(e.url=`http://${e.url}`),e.schema===`mailto:`&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)},lv.prototype.onCompile=function(){};var uv=2147483647,dv=36,fv=1,pv=26,mv=38,hv=700,gv=72,_v=128,vv=`-`,yv=/^xn--/,bv=/[^\0-\x7F]/,xv=/[\x2E\u3002\uFF0E\uFF61]/g,Sv={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},Cv=dv-fv,wv=Math.floor,Tv=String.fromCharCode;function Ev(e){throw RangeError(Sv[e])}function Dv(e,t){let n=[],r=e.length;for(;r--;)n[r]=t(e[r]);return n}function Ov(e,t){let n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(xv,`.`);let i=Dv(e.split(`.`),t).join(`.`);return r+i}function kv(e){let t=[],n=0,r=e.length;for(;n<r;){let i=e.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){let r=e.charCodeAt(n++);(r&64512)==56320?t.push(((i&1023)<<10)+(r&1023)+65536):(t.push(i),n--)}else t.push(i)}return t}var Av=e=>String.fromCodePoint(...e),jv=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:dv},Mv=function(e,t){return e+22+75*(e<26)-((t!=0)<<5)},Nv=function(e,t,n){let r=0;for(e=n?wv(e/hv):e>>1,e+=wv(e/t);e>455;r+=dv)e=wv(e/Cv);return wv(r+36*e/(e+mv))},Pv=function(e){let t=[],n=e.length,r=0,i=_v,a=gv,o=e.lastIndexOf(vv);o<0&&(o=0);for(let n=0;n<o;++n)e.charCodeAt(n)>=128&&Ev(`not-basic`),t.push(e.charCodeAt(n));for(let s=o>0?o+1:0;s<n;){let o=r;for(let t=1,i=dv;;i+=dv){s>=n&&Ev(`invalid-input`);let o=jv(e.charCodeAt(s++));o>=dv&&Ev(`invalid-input`),o>wv((uv-r)/t)&&Ev(`overflow`),r+=o*t;let c=i<=a?fv:i>=a+pv?pv:i-a;if(o<c)break;let l=dv-c;t>wv(uv/l)&&Ev(`overflow`),t*=l}let c=t.length+1;a=Nv(r-o,c,o==0),wv(r/c)>uv-i&&Ev(`overflow`),i+=wv(r/c),r%=c,t.splice(r++,0,i)}return String.fromCodePoint(...t)},Fv=function(e){let t=[];e=kv(e);let n=e.length,r=_v,i=0,a=gv;for(let n of e)n<128&&t.push(Tv(n));let o=t.length,s=o;
131for(o&&t.push(vv);s<n;){let n=uv;for(let t of e)t>=r&&t<n&&(n=t);let c=s+1;n-r>wv((uv-i)/c)&&Ev(`overflow`),i+=(n-r)*c,r=n;for(let n of e)if(n<r&&++i>uv&&Ev(`overflow`),n===r){let e=i;for(let n=dv;;n+=dv){let r=n<=a?fv:n>=a+pv?pv:n-a;if(e<r)break;let i=e-r,o=dv-r;t.push(Tv(Mv(r+i%o,0))),e=wv(i/o)}t.push(Tv(Mv(e,0))),a=Nv(i,c,s===o),i=0,++s}++i,++r}return t.join(``)},Iv={version:`2.3.1`,ucs2:{decode:kv,encode:Av},decode:Pv,encode:Fv,toASCII:function(e){return Ov(e,function(e){return bv.test(e)?`xn--`+Fv(e):e})},toUnicode:function(e){return Ov(e,function(e){return yv.test(e)?Pv(e.slice(4).toLowerCase()):e})}},Lv={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`ââââ`,highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`ââââ`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`paragraph`]},inline:{rules:[`text`],rules2:[`balance_pairs`,`fragments_join`]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:`language-`,linkify:!1,typographer:!1,quotes:`ââââ`,highlight:null,maxNesting:20},components:{core:{rules:[`normalize`,`block`,`inline`,`text_join`]},block:{rules:[`blockquote`,`code`,`fence`,`heading`,`hr`,`html_block`,`lheading`,`list`,`reference`,`paragraph`]},inline:{rules:[`autolink`,`backticks`,`emphasis`,`entity`,`escape`,`html_inline`,`image`,`link`,`newline`,`text`],rules2:[`balance_pairs`,`emphasis`,`fragments_join`]}}}},Rv=/^(vbscript|javascript|file|data):/,zv=/^data:image\/(gif|png|jpeg|webp);/;function Bv(e){let t=e.trim().toLowerCase();return Rv.test(t)?zv.test(t):!0}var Vv=[`http:`,`https:`,`mailto:`];function Hv(e){let t=xh(e,!0);if(t.hostname&&(!t.protocol||Vv.indexOf(t.protocol)>=0))try{t.hostname=Iv.toASCII(t.hostname)}catch{}return ch(lh(t))}function Uv(e){let t=xh(e,!0);if(t.hostname&&(!t.protocol||Vv.indexOf(t.protocol)>=0))try{t.hostname=Iv.toUnicode(t.hostname)}catch{}return ah(lh(t),ah.defaultChars+`%`)}function Wv(e,t){if(!(this instanceof Wv))return new Wv(e,t);t||Mh(e)||(t=e||{},e=`default`),this.inline=new G_,this.block=new u_,this.core=new Bg,this.renderer=new dg,this.linkify=new lv,this.validateLink=Bv,this.normalizeLink=Hv,this.normalizeLinkText=Uv,this.utils=Ah,this.helpers=Fh({},lg),this.options={},this.configure(e),t&&this.set(t)}Wv.prototype.set=function(e){return Fh(this.options,e),this},Wv.prototype.configure=function(e){let t=this;if(Mh(e)){let t=e;if(e=Lv[t],!e)throw Error('Wrong `markdown-it` preset "'+t+`", check name`)}if(!e)throw Error("Wrong `markdown-it` preset, can't be empty");return e.options&&t.set(e.options),e.components&&Object.keys(e.components).forEach(function(n){e.components[n].rules&&t[n].ruler.enableOnly(e.components[n].rules),e.components[n].rules2&&t[
131n].ruler2.enableOnly(e.components[n].rules2)}),this},Wv.prototype.enable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.enable(e,!0))},this),n=n.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to enable unknown rule(s): `+r);return this},Wv.prototype.disable=function(e,t){let n=[];Array.isArray(e)||(e=[e]),[`core`,`block`,`inline`].forEach(function(t){n=n.concat(this[t].ruler.disable(e,!0))},this),n=n.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(function(e){return n.indexOf(e)<0});if(r.length&&!t)throw Error(`MarkdownIt. Failed to disable unknown rule(s): `+r);return this},Wv.prototype.use=function(e){let t=[this].concat(Array.prototype.slice.call(arguments,1));return e.apply(e,t),this},Wv.prototype.parse=function(e,t){if(typeof e!=`string`)throw Error(`Input data should be a String`);let n=new this.core.State(e,this,t);return this.core.process(n),n.tokens},Wv.prototype.render=function(e,t){return t||={},this.renderer.render(this.parse(e,t),this.options,t)},Wv.prototype.parseInline=function(e,t){let n=new this.core.State(e,this,t);return n.inlineMode=!0,this.core.process(n),n.tokens},Wv.prototype.renderInline=function(e,t){return t||={},this.renderer.render(this.parseInline(e,t),this.options,t)};function Gv(e,t){if(!e)return[];if(e.length<=t)return[e];let n=new Wv().parse(e,{}),r=e.split(` 132`),i=n.filter(e=>e.map&&e.level===0&&(e.type.endsWith(`_open`)||e.type===`fence`||e.type===`code_block`||e.type===`html_block`)).map(e=>{let[t,n]=e.map;return r.slice(t,n).join(` 133`)}),a=[],o=``;for(let e of i)(o+e).length>t&&o&&(a.push(o.trim()),o=``),o+=(o?` 134`:``)+e;return o&&a.push(o.trim()),a}var Kv=f(a)` 135 position: relative; 136 margin-top: .5rem; 137 border: ${({$hasBorder:e})=>e?`2px solid `+c.color.light[600]:null}; 138 border-radius: 4px; 139 140 .code { 141 max-height: 90px; 142 overflow: hidden; 143 background: ${c.color.light[500]}; 144 padding: 0 .5rem; 145 border-radius: 4px; 146 147 *, p { 148 line-height: 1.5rem; 149 } 150 } 151 152 .icon { 153 position: absolute; 154 right: 0; 155 bottom: 0px; 156 padding: 0.8rem; 157 cursor: pointer; 158 } 159`,qv=f(a)` 160 width: 100vw; 161 height: 100vh; 162 i { 163 cursor: 'pointer'; 164 } 165 .content-prompt{ 166 height: 100%; 167 overflow: auto; 168 padding: 1rem; 169 } 170 171 .content { 172 height: 100%; 173 } 174 175 .header { 176 background: ${c.color.light[300]}; 177 padding: 1rem; 178 } 179 180 181 .card { 182 height: calc(100% - 32px); 183 overflow: auto; 184 margin-top: 0.25rem; 185 .code { 186 display: inline; 187 } 188 189 .code *, p { 190 line-height: 1.5rem; 191 margin: 0; 192 display: inline; 193 } 194 195 .ks-list { 196 padding: 1rem; 197 border-radius: 4px; 198 background: ${c.color.light[300]}; 199 color: ${c.color.light[700]}; 200 } 201 } 202`,Jv=({node:e})=>{let t=(0,J.useMemo)(()=>{let t=e?.data?.try?.response?.slice(0,15e3);return Ym(t)},[e]);return(0,q.jsxs)(Kv,{$hasBorder:e.type===`end`,children:[(0,q.jsx)(Bm,{showLineNumbers:!1,className:`code`,children:t}),(0,q.jsx)(r,{className:`icon`,size:`xs`,children:(0,q.jsx)(M,{})})]})},Yv=15e3,Xv=({node:e})=>{let t=g(Zv),n=(0,J.useRef)(null),{getNodeById:r,useOnly:i}=Sy(),o=r(e.id),l=o?.data?.try?.response,u=o?.data?.try?.sources,d=(0,J.useMemo)(()=>l?Gv(l,Yv):[],[l,Yv]),[f,p]=(0,J.useState)(1),m=()=>{p(e=>Math.min(e+1,d.length))},h=()=>{n.current?.scrollIntoView({behavior:`smooth`})};(0,J.useEffect)(()=>{h()},[d,u]);let _=()=>{fe.closeModal()},v=o?.data?.step;return(0,q.jsx)(qv,{bg:`inverse.contrastText`,children:(0,q.jsxs)(Ce,{className:`content`,children:[(0,q.jsxs)(we,{justify:`space-between`,className:`header`,children:[(0,q.jsx)(s,{appearance:`h6`,children:!i&&e?.data.step?.slug}),(0,q.jsx)(ye,{onClick:_,colorScheme:`light`,size:`md`,"aria-label":t.closeResponse,children:t.closeResponse})]}),(0,q.jsxs)(we,{gap:`2rem`,className:`content-prompt`,flex:1,children:[!i&&(0,q.jsxs)(a,{w:12,children:[(0,q.jsx)(s,{appearance:`body2`,role:`h6`,children:t.prompt}),(0,q.jsx)(F,{className:`card`,sx:{px:3,py:4},children:(0,q.jsx)(cl,{children:v?.prompt??v?.url??v?.final_result},l?.length)})]}),(0,q.jsxs)(a,{w:12,children:[(0,q.jsx)(s,{appearance:`body2`,role:`h6`,children:t.response}),(0,q.jsxs)(F,{className:`card`,id:`scrollableDiv`,sx:{background:c.color.inverse.contrastText,maxHeight:`calc(100vh - 100px)`,overflow:`auto`}
202,children:[(0,q.jsx)(ze,{dataLength:f,next:m,hasMore:f<d.length,loader:(0,q.jsx)(oe,{}),scrollableTarget:`scrollableDiv`,children:d.slice(0,f).map((e,t)=>(0,q.jsx)(cl,{children:e},t+(l?.length||0)))}),!!u&&(0,q.jsx)(Rm,{sources:JSON.parse(u),maxItems:5,className:`ks-list`}),(0,q.jsx)(`div`,{ref:n})]})]})]})]})})},Zv={en:{done:`Done`,response:`Response`,prompt:`Prompt`,closeResponse:`Close response`},pt:{done:`ConcluÃdo`,response:`Response`,prompt:`Prompt`,closeResponse:`Fechar response`}},Qv=f.div` 203 opacity: 0.9; 204 width: ${({$width:e})=>e}; 205 min-width: 100px; 206 max-width: 350px; 207 min-height: 24px; 208 padding: 1rem; 209 position: relative; 210 font-size: 12px; 211 border-radius: 1px; 212 border: ${({$isValid:e=!0})=>e?`2px solid ${c.color.light[500]}`:`2px solid ${c.color.danger[500]}`}; 213 background: ${({$bgColorVariant:e})=>c.color.light[e]}; 214 box-shadow: ${({$hasBorderLeft:e,$color:t,$isValid:n=!0})=>e&&n?`-2px 0px 0px 0px ${c.color[t][600]}`:`none`}; 215 ${({$selected:e,$color:t})=>e?` 216 border: 2px solid ${c.color[t][500]}; 217 box-shadow: 'none'; 218 transition: all 0.2s ease-in-out; 219 `:``} 220 &:focus { 221 outline: auto; 222 }; 223 ${({$useOnly:e})=>e?` 224 pointer-events: none; 225 `:``} 226 227 .try-result { 228 pointer-events: all; 229 }; 230 231 &:focus { 232 outline: auto; 233 }; 234 & ~ .react-flow__handle { 235 border: none; 236 background: transparent; 237 width: 14px; 238 height: 14px; 239 }; 240 & ~ .react-flow__handle.react-flow__handle-connecting:not(.react-flow__handle-valid) { 241 background: ${c.color.danger[500]}!important; 242 }; 243 &:hover ~ .react-flow__handle, & ~ .react-flow__handle.react-flow__handle-valid, & ~ .react-flow__handle:hover { 244 background: ${c.color.light.contrastText}; 245 }; 246 247 .icon-status { 248 cursor: pointer; 249 svg path { 250 fill: ${c.color.light[500]}; 251 } 252 } 253 254 & > div { 255 overflow-y: initial; 256 } 257 258 & .box-animate { 259 display: block; 260 .content { 261 overflow: inherit; 262 } 263 } 264`,$v=e=>{let t=e?.data?.isNodeFormValid!==!1,n=e?.data?.try?.statusResult!==`ERROR`;return t&&n},ey=({node:e,showStatus:t,isValid:n})=>e.type===`start`||e.type===`end`?(0,q.jsxs)(i,{sx:{position:`relative`,gap:`0.5rem`},alignItems:`center`,justifyContent:`center`,flexDirection:`column`,children:[(0,q.jsx)(v,{style:{position:`absolute`,top:0,right:0},children:t&&(0,q.jsx)(oy,{isValid:n,node:e})}),(0,q.jsx)(V,{width:`32px`,height:`32px`}),(0,q.jsx)(V,{width:`73px`,height:`24px`})]}):(0,q.jsxs)(i,{sx:{gap:`0.5rem`},flex:1,flexDirection:`column`,children:[(0,q.jsxs)(i,{sx:{gap:`0.5rem`},alignItems:`center`,flexWrap:`nowrap`,flex:1,children:[(0,q.jsx)(V,{width:`24px`,height:`24px`}),(0,q.jsx)(V,{width:`100%`,height:`24px`}),t&&(0,q.jsx)(oy,{isValid:n,node:e})]}),(0,q.jsx)(V,{width:`100%`,height:`24px`}),(0,q.jsx)(V,{width:`100%`,height:`24px`})]}),ty=({node:e,bgVariant:t=300,color:n=`light`,hasBorderLeft:r=!0,icon:o,className:s,onClick:c,enableCopy:l,enableDelete:u,enableConnection:d,width:f,hasActions:p=!0,children:m,colorIcon:h,colorIconBg:g})=>{let _=pe(),y=Se(`qc`,xe),b=$a(),{isNodeFullConnected:x,getNodeById:S,updateNode:C,elementFocusedId:w,useOnly:T,isViewer:E}=Sy(),D=_?.params?.bypassFullConnected,O=x({id:e.id,type:e?.type,data:e?.data});(0,J.useEffect)(()=>{let t=O?void 0:y.qc.tooltipErrorConnect;!D&&(!O||(0,G.isBoolean)(e.data.isNodeFormValid))?C(e.id,{...e.data,isNodeFormValid:O,errorDetail:t}):e.data.errorDetail&&C(e.id,{...e.data,errorDetail:void 0})},[O,y,D]),(0,J.useEffect)(()=>{e.id===w&&b.fitView({maxZoom:1,minZoom:1,duration:600,nodes:[{id:e.id}]})},[w,e.id]);let k=_?.params?.id===e.id,A=!D&&(!k||O),j=S(e.id),M=(0,J.useMemo)(()=>D||$v(j),[D,j]),N=e.type===`start`||e.id===w||!O?0:-1,P=`ariaLabel${e.type.charAt(0).toUpperCase()+e.type.slice(1)}Card`,F=e.type!==`start`&&e.type!==`end`?e.data.step?.slug:``;return(0,q.jsxs)(Qv,{className:s,onClick:c,$selected:k,$width:f??`350px`,$bgColorVariant:t,$color:n,$hasBorderLeft:r,$isValid:M,$useOnly:T,"data-keyboard-nav-type":`node`,"data-keyboard-nav-id":e.id,id:e.id,tabIndex:N,"aria-label":y.qc[P]+F,"data-test-hint":`flow_mode`,children:[T?(0,q.jsx)(ey,{node:e,showStatus:A,isValid:M}):(0,q.jsxs)(v,{justifyContent:`space-between`,gap:`.5rem`,children:[(0,q.jsxs)(i,{alignItems:`center`,flex:1,sx:{gap:`.5rem`},flexWrap:`nowrap`,as:be,"aria-label":y.qc.openModal+y.qc[P]+F,children:[(0,q.jsx)(ay,{node:e,colorIcon:h,colorBg:g,icon:o}),A&&(0,q.jsx)(oy,{isValid:M,node:e})]}),p&&E===!1&&(0,q.jsx)(Im,{node:e,enableCopy:l,enableDelete:u,enableConnection:d,ariaLabelTranslateCard:P,nodeName:F})]}),(0,q.jsx)(_e,{className:`box-animate`,children:(0,q.jsx)(a,{children:m})})]})},ny=f(ty)` 265 opacity: ${({$active:e})=>e?1:.4}; 266 267 ${({$finishRunning:e,$hasError:t})=>e&&!t&&`box-shadow: -2px 0px 0px 0px ${c.color.success[500]};`} 268 269 & ~ .react-flow__handle, & ~ .react-flow__handle.connectionindicator { 270 opacity: 0; 271 pointer-events: none; 272 }; 273 274 .icon-status { 275 display: ${({$finishRunning:e})=>e?`flex`:`none`}; 276 } 277 278 div.code { 279 display: -webkit-box; 280 -webkit-box-orient: vertical; 281 -webkit-line-clamp: 3; 282 overflow: hidden; 283 line-height: 1.3rem; 284 padding-bottom: 5px; 285 padding-right: 1.5rem; 286 word-break: break-word; 287 min-height: 40px; 288 } 289`,ry=({node:e,children:t,alreadyTreatedItem:n=!1,...r})=>{let{useOnly:i}=Sy(),a=!!e?.data?.try?.response||!!e?.data?.try?.statusResult,o=e?.data?.try?.statusResult===`END`||e?.data?.try?.statusResult===`ERROR`,s=e?.data?.try?.statusResult===`ERROR`,c=Se(`createQuickCommand`,_l),l=(0,J.useMemo)(()=>(0,q.jsx)(Jv,{node:e}),[e]);return(0,q.jsxs)(ny,{onClick:()=>{e.type===`parallelEnd`||e.type===`parallelStart`||(e.type===`script`?fe.showModal({title:c.createQuickCommand.executionResult,size:`large`,children:(0,q.jsx)(hl,{node:e})}):fe.showCustomModal((0,q.jsx)(Xv,{node:e}),{size:`full`}))},node:e,$finishRunning:o,$hasError:s,$active:a,hasActions:!1,...r,children:[(n||!i)&&t,(0,q.jsx)(`span`,{className:`try-result`,children:!!e?.data?.try?.response&&l})]})},iy=f(_)` 290 background-color: ${({$bgColor:e})=>e}; 291 color: ${({$color:e})=>e}; 292`,ay=({node:e,icon:t,colorIcon:n,colorBg:i})=>{let a=Se(`createQuickCommand`,_l),{data:o,type:l}=e,u=e?.data.step?.count??0,d={script:{color:c.color.gray[50],backgroundColor:c.color.gray[800],text:`Python`,appearance:`square`},parallelEnd:{color:c.color.blue[50],backgroundColor:c.color.blue[800],text:`${u}`,appearance:`circle`},parallelStart:{color:c.color.blue[50],backgroundColor:c.color.blue[800],text:`${u}`,appearance:`circle`}}[l],f=(0,J.useMemo)(()=>{switch(l){case`start`:return a.createQuickCommand.start;case`end`:return a.createQuickCommand.finishFlow;case`router`:return a.createQuickCommand.conditional;case`parallelStart`:return a.createQuickCommand.parallelStart;case`parallelEnd`:return a.createQuickCommand.parallelEnd;case`script`:return o.step?.name||a.createQuickCommand.scriptExecution;default:return o.step?.slug}},[l,o.step?.slug,o.step?.name,a]),p=t??null;return(0,q.jsxs)(v,{justifyContent:`space-between`,gap:`0.25rem`,children:[(0,q.jsxs)(v,{gap:`.25rem`,style:{flexGrow:1}
292,children:[!!p&&(0,q.jsx)(r,{appearance:`square`,colorIcon:n,colorBg:i,children:(0,q.jsx)(p,{})}),f&&(0,q.jsx)(s,{colorScheme:`light.contrastText`,appearance:`body1`,weight:`medium`,style:{maxWidth:`220px`},nowrapEllipsis:!0,children:f})]}),d&&(0,q.jsx)(iy,{appearance:d.appearance,$bgColor:d.backgroundColor,$color:d.color,children:d.text})]})},oy=({isValid:e,node:t})=>{let n=e?B:ce,i=!(0,G.isNil)(t?.data?.errorDetail)&&!e;return(0,q.jsx)(r,{appearance:`circle`,size:`xs`,className:`icon-status`,bg:e?`success.500`:`danger.500`,color:`light.contrastText`,children:i?(0,q.jsx)(te,{text:t?.data?.errorDetail,className:`tooltip`,position:`right`,offset:{x:40},children:(0,q.jsx)(n,{})}):(0,q.jsx)(n,{})})},sy=`import stackspot_ai_utils 293from pathlib import Path 294 295# 1. Get input data (if any) 296input_data = stackspot_ai_utils.get_quick_command_input_data() 297 298# 2. Get custom inputs (if any) 299custom_inputs = stackspot_ai_utils.get_quick_command_custom_inputs() 300 301# 3. Get a file path for an uploaded file (simulate with a filename) 302# (Assume a file named 'example.txt' was uploaded) 303file_name = 'example.txt' 304file_path = stackspot_ai_utils.get_uploaded_file_path(file_name) 305 306# 4. Read uploaded file as text and bytes 307try: 308 file_text = stackspot_ai_utils.read_uploaded_file_text(file_name) 309except Exception as e: 310 file_text = f"Could not read as text: {e}" 311 312try: 313 file_bytes = stackspot_ai_utils.read_uploaded_file_bytes(file_name) 314except Exception as e: 315 file_bytes = f"Could not read as bytes: {e}" 316 317# 5. Get a quick command step (simulate with a slug) 318step_slug = 'example-step' 319step_data = stackspot_ai_utils.get_quick_command_step(step_slug) 320 321# 6. Prepare and generate result 322result = { 323 "input_data": input_data, 324 "custom_inputs": custom_inputs, 325 "file_path": str(file_path) if file_path else None, 326 "file_text": file_text, 327 "file_bytes_type": str(type(file_bytes)), 328 "step_data": step_data 329} 330 331stackspot_ai_utils.generate_result(result) 332`,cy=({nodeId:e})=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Co,{type:`source`,position:K.Left,id:`${e}-left`}),(0,q.jsx)(Co,{type:`source`,position:K.Right,id:`${e}-right`}),(0,q.jsx)(Co,{type:`source`,position:K.Top,id:`${e}-top`}),(0,q.jsx)(Co,{type:`source`,position:K.Bottom,id:`${e}-bottom`})]}),ly=f(S)` 333 padding: .5rem; 334 border-radius: 5px; 335 flex: 1; 336 border: 1px solid ${c.color.light[400]}; 337 justify-content: center; 338`,uy=f(T)` 339 height: 90px; 340 overflow: hidden; 341 padding: 8px 16px; 342 color: ${c.color.light[700]}; 343 h1 { 344 margin: 0; 345 } 346`,dy=e=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ty,{node:e,color:`purple`,colorIcon:`purple.500`,icon:re,children:(0,q.jsx)(py,{nodeData:e.data})}),(0,q.jsx)(cy,{nodeId:e.id})]}),fy=e=>(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ry,{node:e,color:`purple`,icon:re,children:(0,q.jsx)(py,{nodeData:e.data})}),(0,q.jsx)(cy,{nodeId:e.id})]}),py=({nodeData:e})=>{let{useOnly:t}=Sy(),n=`\`\`\`python\n${e.step?.script||sy}\n\`\`\``;return(0,q.jsx)(q.Fragment,{children:t?(0,q.jsx)(x,{width:`100%`,height:`90px`}):(0,q.jsx)(ly,{children:(0,q.jsx)(uy,{children:(0,q.jsx)(cl,{showLineNumbers:!0,showActionBar:!1,children:n})})})})},my=[{id:Uc(),default:!1,condition:{label:`${m(_l).route} 1`,and:[{left:``,operator:`equals`,right:``}]}},{id:Uc(),default:!0,default_error_message:m(_l).routeDefaultErrorMessage}],hy={script:sy,use_uploaded_files:!1},gy=(e,t)=>{if(t?.type===`start`||t?.type===`end`)return e.length>0;if(t?.type===`router`)return e.some(e=>e.target===t.id);if(t?.type===`prompt`&&t?.data?.step?.continue_on_error){let n=e.some(e=>e.target===t.id),r=e.some(e=>e.sourceHandle?.includes(`error`));return n&&r}return e.length>1},_y=(e,t,n,r)=>({id:Uc(),type:e,animated:!0,position:t,data:{step:{slug:n,...e===`router`?{routes:my,max_executions:5}:{},...e===`script`?hy:{},...e===`parallelEnd`||e===`parallelStart`?{count:r?r+1:1}:{}}}}),vy=e=>({id:Uc(),type:`smoothstep`,...e}),yy=(e,t,n,r=new Set)=>{let i=t.find(t=>t.id===e);if(!i||r.has(e))return[];r.add(e);let a=Pn(i,t,n),o=[...a];return a.forEach(e=>{o=[...o,...yy(e.id,t,n,r)]}),o},by=[{id:Uc(),type:`start`,data:{},position:{x:0,y:0}},{id:Uc(),type:`end`,data:{step:{final_result:`The Quick Command was successfully executed.`,return_type:`CHAT`,preserve_conversation:!1,share_context_between_steps:!0}},position:{x:600,y:0}}],xy=e=>e.type!==`end`&&e.type!==`start`,Sy=(e=>{let t=e;t.use={};for(let e of Object.keys(t.getState()))t.use[e]=()=>t(t=>t[e]);return t})(Xc()(Qc((e,t)=>(e({nodes:by,edges:[],steps:[],selectedNodes:[],selectedEdges:[],inputs:[],isViewer:!1,visibilityLevel:void 0,useOnly:!1}),{nodes:t().nodes,edges:t().edges,steps:t().steps,inputs:t().inputs,selectedNodes:t().selectedNodes,selectedEdges:t().selectedEdges,isViewer:t().isViewer,isEdit:t().isEdit,visibilityLevel:t().visibilityLevel,useOnly:t().useOnly,elementFocusedId:t().elementFocusedId,getFlowSlug:()=>t()?.nodes?.find(e=>e.type===`start`)?.data?.step?.slug||``,isFlowFullConnected:()=>{let{nodes:e,edges:n}=t();return e?.every(e=>gy(zn([e],n),e))},isNodeFullConnected:e=>{let{edges:n}=t();return!!gy(zn([e],n),e)},getNodeById:e=>t()?.nodes.find(t=>
346t.id===e),getNodeBySlug:e=>t().nodes.find(t=>t?.data?.step?.slug===e),setNodeFormValidBySlug:(n,r,i)=>{e({nodes:t().nodes.map(e=>e?.data?.step?.slug===n?{...e,data:{...e.data,isNodeFormValid:r,errorDetail:i}}:e)})},getPreviousNode:e=>yy(e,t()?.nodes,t()?.edges),setNodes:t=>e({nodes:t}),setInputs:t=>e({inputs:t}),setSteps:t=>e({steps:t}),setIsViewer:t=>e({isViewer:t}),setIsEdit:t=>e({isEdit:t}),setEdges:t=>e({edges:t}),setVisibilityLevel:t=>e({visibilityLevel:t}),setUseOnly:t=>e({useOnly:t}),onNodesChange:n=>{[`dimensions`].includes(n[0].type)||e({nodes:La(n,t().nodes)})},onEdgesChange:n=>{e({edges:Ra(n,t().edges)})},onSelectionChange:({nodes:t,edges:n})=>{e({selectedNodes:t,selectedEdges:n})},addSingleNode:(n,r,i)=>{let a=Qm(n,t().nodes,i),o=t().nodes.filter(e=>e.type===n).length,s=_y(n,r,a,o);return e(e=>{let t=e.nodes.findIndex(e=>e.id===s.id);if(t===-1)return{nodes:[...e.nodes,s]};let n=e.nodes.slice();return n[t]=s,{nodes:n}}),s},copyNode:n=>{let r=e=>e+(Math.random()*400-200),i=(0,G.cloneDeepWith)(n,e=>({id:Uc(),type:e.type,position:{x:r(e.position.x)+100,y:r(e.position.y)},data:{...e.data,step:{...e.data.step,slug:(`copy-of-`+e.data.step.slug).substring(0,36)}}}));return e({nodes:[...t().nodes,i]}),i},addEdge:n=>{if(!n.source||!n.target)return;let r=vy(n),i=t().edges,a=t()?.nodes.find(e=>e.id===n.target),o=t()?.nodes.find(e=>e.id===n.source);if(o.type===`router`){let o=i.filter(e=>e.sourceHandle!==n.sourceHandle);if(a.type===`parallelStart`&&nh(a,t().nodes,[...o,r]))throw Error(`UNSUPPORTED_PARALLEL_INSIDE_PARALLEL`);e({edges:[...o,r]});return}if(a.type===`parallelStart`&&nh(a,t().nodes,[...i,r]))throw Error(`UNSUPPORTED_PARALLEL_INSIDE_PARALLEL`);if(o.type===`parallelStart`){if(i.some(e=>e.source===r.source&&e.target===r.target))throw Error(`DUPLICATED_EDGE_NOT_ALLOWED`);if(a.type===`parallelEnd`)throw Error(`UNSUPPORTED_PARALLEL_WITHOUT_INNER_NODES`);if(i.filter(e=>e.source===n.source).length>=5)throw Error(`MAX_REACHED_parallelStart`);o.data.step&&(o.data.step.next_steps_slugs=o.data.step?.next_steps_slugs?o.data.step?.next_steps_slugs.concat(a.data.step?.slug??a.type):[a.data.step?.slug??a.type],e({nodes:Kp(t().nodes,{...o.data,errorDetail:void 0},o.id)})),e({edges:[...i,r]});return}if(o?.data?.step)if(o.type===`prompt`&&o?.data?.step?.continue_on_error&&r.sourceHandle){r.sourceHandle.includes(`success`)?o.data.step.next_step_slug=a.data.step?.slug??a.type:o.data.step.next_failure_step_slug=a.data.step?.slug??a.type,e({nodes:t().nodes.map(e=>e.id===n.source?o:e)}),e({edges:[...i.filter(e=>e.sourceHandle!==n.sourceHandle),r]});return}else o.data.step.next_step_slug=a.data.step?.slug??a.type,e({nodes:t().nodes.map(e=>e.id===n.source?o:e)});e({edges:[...i.filter(e=>e.source!==n.source),r]})},deleteNode:(n,r)=>{if(!xy(n))return;let i=t().edges,a=zn([n],t().edges),o=i.filter(e=>!a.includes(e)),s=t().nodes.filter(e=>e.id!==n.id);if(r&&(n.type===`parallelStart`||n.type===`parallelEnd`)){let e=n.data?.step?.count;s.filter(e=>e.type===`parallelStart`||e.type===`parallelEnd`).map(t=>{t.data.step?.count&&e&&t.data.step.count>e&&(t.data.step.count=t.data.step.count-1)})}e({nodes:[...s],edges:[...o]})},deleteEdge:n=>{e({edges:t().edges.filter(e=>e.id!==n.id)})},updateNode(n,r,i){let a=Kp(t().nodes,r,n,i);return e({nodes:a}),a},updateNodePosition:(n,r)=>{e({nodes:t().nodes.map(e=>e.id===n?{...e,position:r}:e)})},reset:()=>{e({nodes:by,edges:[],visibilityLevel:void 0})},unselectNodesAndEdges:()=>{e({nodes:t().nodes.map(e=>({...e,selected:!1})),edges:t().edges.map(e=>({...e,selected:!1}))})},selectNodeAndEdge:(n,r)=>{e({nodes:t().nodes.map(e=>e.id===n?{...e,selected:!0}:e),edges:t().edges.map(e=>e.id===r?{...e,selected:!0}:e)})},setElementFocusedId:t=>{e({elementFocusedId:t})}}),{partialize:e=>({nodes:e?.nodes,edges:e?.edges}),equality:(e,t)=>(0,G.isEqual)(e,t)})));export{Gt as $,_l as A,$s as B,Ip as C,qp as D,Mp as E,cc as F,xn as G,$a as H,_c as I,gn as J,K,Co as L,Vc as M,Rc as N,pu as O,Ic as P,sn as Q,ma as R,Pp as S,Bp as T,Y as U,tc as V,Tn as W,mn as X,hn as Y,ln as Z,Op as _,fy as a,Jp as b,ry as c,Bm as d,Ht as et,Pm as f,Qp as g,tm as h,dy as i,Uc as j,Fu as k,Jm as l,rm as m,by as n,Ot as nt,sy as o,Am as p,In as q,Sy as r,ty as s,xy as t,At as tt,Ym as u,kp as v,Fp as w,zp as x,Dp as y,Ys as z};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.