bK&&(r.y=1)}function im(e,r){e.min=e.min+r,e.max=e.max+r}function xK(e,r,n,o,a=.5){const i=Lr(e.min,e.max,a);r9(e,r,n,i,o)}function sm(e,r){xK(e.x,r.x,r.scaleX,r.scale,r.originX),xK(e.y,r.y,r.scaleY,r.scale,r.originY)}function wK(e,r){return fK(jHe(e.getBoundingClientRect(),r))}function FHe(e,r,n){const o=wK(e,n),{scroll:a}=r;return a&&(im(o.x,a.offset.x),im(o.y,a.offset.y)),o}const kK={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},lm={};for(const e in kK)lm[e]={isEnabled:r=>kK[e].some(n=>!!r[n])};const _K=()=>({translate:0,scale:1,origin:0,originPoint:0}),cm=()=>({x:_K(),y:_K()}),EK=()=>({min:0,max:0}),Zr=()=>({x:EK(),y:EK()}),n9=typeof window<"u",fk={current:null},o9={current:!1};function SK(){if(o9.current=!0,!!n9)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),r=()=>fk.current=e.matches;e.addEventListener("change",r),r()}else fk.current=!1}function pk(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function ly(e){return typeof e=="string"||Array.isArray(e)}const a9=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],i9=["initial",...a9];function mk(e){return pk(e.animate)||i9.some(r=>ly(e[r]))}function CK(e){return!!(mk(e)||e.variants)}function HHe(e,r,n){for(const o in r){const a=r[o],i=n[o];if(Qn(a))e.addValue(o,a);else if(Qn(i))e.addValue(o,lh(a,{owner:e}));else if(i!==a)if(e.hasValue(o)){const s=e.getValue(o);s.liveStyle===!0?s.jump(a):s.hasAnimated||s.set(a)}else{const s=e.getStaticValue(o);e.addValue(o,lh(s!==void 0?s:a,{owner:e}))}}for(const o in n)r[o]===void 0&&e.removeValue(o);return r}const TK=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class AK{scrapeMotionValuesFromProps(r,n,o){return{}}constructor({parent:r,props:n,presenceContext:o,reducedMotionConfig:a,blockInitialAnimation:i,visualState:s},l={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=I8,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const p=aa.now();this.renderScheduledAtthis.bindToMotionValue(o,n)),o9.current||SK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:fk.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),vu(this.notifyUpdate),vu(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(r){this.children.add(r),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(r)}removeChild(r){this.children.delete(r),this.enteringChildren&&this.enteringChildren.delete(r)}bindToMotionValue(r,n){this.valueSubscriptions.has(r)&&this.valueSubscriptions.get(r)();const o=om.has(r);o&&this.onBindTransform&&this.onBindTransform();const a=n.on("change",s=>{this.latestValues[r]=s,this.props.onUpdate&&Mr.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,r,n)),this.valueSubscriptions.set(r,()=>{a(),i&&i(),n.owner&&n.stop()})}sortNodePosition(r){return!this.current||!this.sortInstanceNodePosition||this.type!==r.type?0:this.sortInstanceNodePosition(this.current,r.current)}updateFeatures(){let r="animation";for(r in lm){const n=lm[r];if(!n)continue;const{isEnabled:o,Feature:a}=n;if(!this.features[r]&&a&&o(this.props)&&(this.features[r]=new a(this)),this.features[r]){const i=this.features[r];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Zr()}getStaticValue(r){return this.latestValues[r]}setStaticValue(r,n){this.latestValues[r]=n}update(r,n){(r.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=r,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let o=0;on.variantChildren.delete(r)}addValue(r,n){const o=this.values.get(r);n!==o&&(o&&this.removeValue(r),this.bindToMotionValue(r,n),this.values.set(r,n),this.latestValues[r]=n.get())}removeValue(r){this.values.delete(r);const n=this.valueSubscriptions.get(r);n&&(n(),this.valueSubscriptions.delete(r)),delete this.latestValues[r],this.removeValueFromRenderState(r,this.renderState)}hasValue(r){return this.values.has(r)}getValue(r,n){if(this.props.values&&this.props.values[r])return this.props.values[r];let o=this.values.get(r);return o===void 0&&n!==void 0&&(o=lh(n===null?void 0:n,{owner:this}),this.addValue(r,o)),o}readValue(r,n){let o=this.latestValues[r]!==void 0||!this.current?this.latestValues[r]:this.getBaseTargetFromProps(this.props,r)??this.readValueFromInstance(this.current,r,this.options);return o!=null&&(typeof o=="string"&&(qX(o)||WX(o))?o=parseFloat(o):!hHe(o)&&wu.test(n)&&(o=XG(r,n)),this.setBaseTarget(r,Qn(o)?o.get():o)),Qn(o)?o.get():o}setBaseTarget(r,n){this.baseTarget[r]=n}getBaseTarget(r){const{initial:n}=this.props;let o;if(typeof n=="string"||typeof n=="object"){const i=G8(this.props,n,this.presenceContext?.custom);i&&(o=i[r])}if(n&&o!==void 0)return o;const a=this.getBaseTargetFromProps(this.props,r);return a!==void 0&&!Qn(a)?a:this.initialValues[r]!==void 0&&o===void 0?void 0:this.baseTarget[r]}on(r,n){return this.events[r]||(this.events[r]=new c8),this.events[r].add(n)}notify(r,...n){this.events[r]&&this.events[r].notify(...n)}scheduleRenderMicrotask(){U8.render(this.render)}}class NK extends AK{constructor(){super(...arguments),this.KeyframeResolver=rHe}sortInstanceNodePosition(r,n){return r.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(r,n){return r.style?r.style[n]:void 0}removeValueFromRenderState(r,{vars:n,style:o}){delete n[r],delete o[r]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:r}=this.props;Qn(r)&&(this.childSubscription=r.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}const UHe={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},VHe=nm.length;function qHe(e,r,n){let o="",a=!0;for(let i=0;itypeof e=="string"&&e.toLowerCase()==="svg";function JHe(e,r,n,o){RK(e,r,void 0,o);for(const a in r.attrs)e.setAttribute(OK.has(a)?a:Z8(a),r.attrs[a])}function LK(e,r,n){const o=l9(e,r,n);for(const a in e)if(Qn(e[a])||Qn(r[a])){const i=nm.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;o[i]=e[a]}return o}class IK extends NK{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Zr}getBaseTargetFromProps(r,n){return r[n]}readValueFromInstance(r,n){if(om.has(n)){const o=WG(n);return o&&o.default||0}return n=OK.has(n)?n:Z8(n),r.getAttribute(n)}scrapeMotionValuesFromProps(r,n,o){return LK(r,n,o)}build(r,n,o){MK(r,n,this.isSVGTag,o.transformTemplate,o.style)}renderInstance(r,n,o,a){JHe(r,n,o,a)}mount(r){this.isSVGTag=DK(r.tagName),super.mount(r)}}function eUe(e){const r={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Y8(e)&&!aK(e)?new IK(r):new PK(r);n.mount(e),sy.set(e,n)}function tUe(e){const r={presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}},n=new GHe(r);n.mount(e),sy.set(e,n)}function zK(e,r,n){const o=Qn(e)?e:lh(e);return o.start(Q8("",o,r,n)),o.animation}function rUe(e,r){return Qn(e)||typeof e=="number"||typeof e=="string"&&!W8(r)}function jK(e,r,n,o){const a=[];if(rUe(e,r))a.push(zK(e,W8(r)&&r.default||r,n&&(n.default||n)));else{const i=iK(e,r,o),s=i.length;for(let l=0;l{o.push(...jK(s,a,i))}),o}function oUe(e){return Array.isArray(e)&&e.some(Array.isArray)}function aUe(e){function r(n,o,a){let i=[],s;if(oUe(n))i=nUe(n,o,e);else{const{onComplete:c,...u}=a||{};typeof c=="function"&&(s=c),i=jK(n,o,u,e)}const l=new VFe(i);return s&&l.finished.then(s),l}return r}const iUe=aUe();function sUe(e,r){const n=aa.now(),o=({timestamp:a})=>{const i=a-n;i>=r&&(vu(o),e(i-r))};return Mr.setup(o,!0),()=>vu(o)}const BK=(e,r)=>Math.abs(e-r);function lUe(e,r){const n=BK(e.x,r.x),o=BK(e.y,r.y);return Math.sqrt(n**2+o**2)}const uy=E.createContext({});function um(e){const r=E.useRef(null);return r.current===null&&(r.current=e()),r.current}const c9=n9?E.useLayoutEffect:E.useEffect,gk=E.createContext(null),uh=E.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function FK(e,r){if(typeof e=="function")return e(r);e!=null&&(e.current=r)}function cUe(...e){return r=>{let n=!1;const o=e.map(a=>{const i=FK(a,r);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let a=0;a{const{width:u,height:d,top:h,left:p,right:g}=s.current;if(r||!i.current||!u||!d)return;const y=n==="left"?`left: ${p}`:`right: ${g}`;i.current.dataset.motionPopId=a;const x=document.createElement("style");l&&(x.nonce=l);const w=o??document.head;return w.appendChild(x),x.sheet&&x.sheet.insertRule(`
- [data-motion-pop-id="${a}"] {
- position: absolute !important;
- width: ${u}px !important;
- height: ${d}px !important;
- ${y}px !important;
- top: ${h}px !important;
- }
- `),()=>{w.contains(x)&&w.removeChild(x)}},[r]),b.jsx(dUe,{isPresent:r,childRef:i,sizeRef:s,children:E.cloneElement(e,{ref:c})})}const fUe=({children:e,initial:r,isPresent:n,onExitComplete:o,custom:a,presenceAffectsLayout:i,mode:s,anchorX:l,root:c})=>{const u=um(pUe),d=E.useId();let h=!0,p=E.useMemo(()=>(h=!1,{id:d,initial:r,isPresent:n,custom:a,onExitComplete:g=>{u.set(g,!0);for(const y of u.values())if(!y)return;o&&o()},register:g=>(u.set(g,!1),()=>u.delete(g))}),[n,u,o]);return i&&h&&(p={...p}),E.useMemo(()=>{u.forEach((g,y)=>u.set(y,!1))},[n]),E.useEffect(()=>{!n&&!u.size&&o&&o()},[n]),s==="popLayout"&&(e=b.jsx(hUe,{isPresent:n,anchorX:l,root:c,children:e})),b.jsx(gk.Provider,{value:p,children:e})};function pUe(){return new Map}function HK(e=!0){const r=E.useContext(gk);if(r===null)return[!0,null];const{isPresent:n,onExitComplete:o,register:a}=r,i=E.useId();E.useEffect(()=>{if(e)return a(i)},[e]);const s=E.useCallback(()=>e&&o&&o(i),[i,o,e]);return!n&&o?[!1,s]:[!0]}const yk=e=>e.key||"";function UK(e){const r=[];return E.Children.forEach(e,n=>{E.isValidElement(n)&&r.push(n)}),r}const Pa=({children:e,custom:r,initial:n=!0,onExitComplete:o,presenceAffectsLayout:a=!0,mode:i="sync",propagate:s=!1,anchorX:l="left",root:c})=>{const[u,d]=HK(s),h=E.useMemo(()=>UK(e),[e]),p=s&&!u?[]:h.map(yk),g=E.useRef(!0),y=E.useRef(h),x=um(()=>new Map),[w,k]=E.useState(h),[C,_]=E.useState(h);c9(()=>{g.current=!1,y.current=h;for(let N=0;N{const $=yk(N),R=s&&!u?!1:h===C||p.includes($),M=()=>{if(x.has($))x.set($,!0);else return;let O=!0;x.forEach(B=>{B||(O=!1)}),O&&(A?.(),_(y.current),s&&d?.(),o&&o())};return b.jsx(fUe,{isPresent:R,initial:!g.current||n?void 0:!1,custom:r,presenceAffectsLayout:a,mode:i,root:c,onExitComplete:R?void 0:M,anchorX:l,children:N},$)})})},mUe=E.createContext(null);function gUe(){const e=E.useRef(!1);return c9(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function yUe(){const e=gUe(),[r,n]=E.useState(0),o=E.useCallback(()=>{e.current&&n(r+1)},[r]);return[E.useCallback(()=>Mr.postRender(o),[o]),r]}const bUe=e=>!e.isLayoutDirty&&e.willUpdate(!1);function vUe(){const e=new Set,r=new WeakMap,n=()=>e.forEach(bUe);return{add:o=>{e.add(o),r.set(o,o.addEventListener("willUpdate",n))},remove:o=>{e.delete(o);const a=r.get(o);a&&(a(),r.delete(o)),n()},dirty:n}}const VK=e=>e===!0,xUe=e=>VK(e===!0)||e==="id",dm=({children:e,id:r,inherit:n=!0})=>{const o=E.useContext(uy),a=E.useContext(mUe),[i,s]=yUe(),l=E.useRef(null),c=o.id||a;l.current===null&&(xUe(n)&&c&&(r=r?c+"-"+r:c),l.current={id:r,group:VK(n)&&o.group||vUe()});const u=E.useMemo(()=>({...l.current,forceRender:i}),[s]);return b.jsx(uy.Provider,{value:u,children:e})},u9=E.createContext({strict:!1});function d9(e){for(const r in e)lm[r]={...lm[r],...e[r]}}function wUe({children:e,features:r,strict:n=!1}){const[,o]=E.useState(!h9(r)),a=E.useRef(void 0);if(!h9(r)){const{renderer:i,...s}=r;a.current=i,d9(s)}return E.useEffect(()=>{h9(r)&&r().then(({renderer:i,...s})=>{d9(s),a.current=i,o(!0)})},[]),b.jsx(u9.Provider,{value:{renderer:a.current,strict:n},children:e})}function h9(e){return typeof e=="function"}const kUe=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function bk(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||kUe.has(e)}let qK=e=>!bk(e);function YK(e){typeof e=="function"&&(qK=r=>r.startsWith("on")?!bk(r):e(r))}try{YK(require("@emotion/is-prop-valid").default)}catch{}function _Ue(e,r,n){const o={};for(const a in e)a==="values"&&typeof e.values=="object"||(qK(a)||n===!0&&bk(a)||!r&&!bk(a)||e.draggable&&a.startsWith("onDrag"))&&(o[a]=e[a]);return o}function EUe({children:e,isValidProp:r,...n}){r&&YK(r),n={...E.useContext(uh),...n},n.isStatic=um(()=>n.isStatic);const o=E.useMemo(()=>n,[JSON.stringify(n.transition),n.transformPagePoint,n.reducedMotion]);return b.jsx(uh.Provider,{value:o,children:e})}const vk=E.createContext({});function SUe(e,r){if(mk(e)){const{initial:n,animate:o}=e;return{initial:n===!1||ly(n)?n:void 0,animate:ly(o)?o:void 0}}return e.inherit!==!1?r:{}}function CUe(e){const{initial:r,animate:n}=SUe(e,E.useContext(vk));return E.useMemo(()=>({initial:r,animate:n}),[WK(r),WK(n)])}function WK(e){return Array.isArray(e)?e.join(" "):e}const f9=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function XK(e,r,n){for(const o in r)!Qn(r[o])&&!$K(o,n)&&(e[o]=r[o])}function TUe({transformTemplate:e},r){return E.useMemo(()=>{const n=f9();return s9(n,r,e),Object.assign({},n.vars,n.style)},[r])}function AUe(e,r){const n=e.style||{},o={};return XK(o,n,e),Object.assign(o,TUe(e,r)),o}function NUe(e,r){const n={},o=AUe(e,r);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=o,n}const GK=()=>({...f9(),attrs:{}});function RUe(e,r,n,o){const a=E.useMemo(()=>{const i=GK();return MK(i,r,DK(o),e.transformTemplate,e.style),{...i.attrs,style:{...i.style}}},[r]);if(e.style){const i={};XK(i,e.style,e),a.style={...i,...a.style}}return a}const $Ue=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function p9(e){return typeof e!="string"||e.includes("-")?!1:!!($Ue.indexOf(e)>-1||/[A-Z]/u.test(e))}function PUe(e,r,n,{latestValues:o},a,i=!1){const s=(p9(e)?RUe:NUe)(r,o,a,e),l=_Ue(r,typeof e=="string",i),c=e!==E.Fragment?{...l,...s,ref:n}:{},{children:u}=r,d=E.useMemo(()=>Qn(u)?u.get():u,[u]);return E.createElement(e,{...c,children:d})}function xk(e){return Qn(e)?e.get():e}function MUe({scrapeMotionValuesFromProps:e,createRenderState:r},n,o,a){return{latestValues:OUe(n,o,a,e),renderState:r()}}function OUe(e,r,n,o){const a={},i=o(e,{});for(const p in i)a[p]=xk(i[p]);let{initial:s,animate:l}=e;const c=mk(e),u=CK(e);r&&u&&!c&&e.inherit!==!1&&(s===void 0&&(s=r.initial),l===void 0&&(l=r.animate));let d=n?n.initial===!1:!1;d=d||s===!1;const h=d?l:s;if(h&&typeof h!="boolean"&&!pk(h)){const p=Array.isArray(h)?h:[h];for(let g=0;g(r,n)=>{const o=E.useContext(vk),a=E.useContext(gk),i=()=>MUe(e,r,o,a);return n?i():um(i)},DUe=KK({scrapeMotionValuesFromProps:l9,createRenderState:f9}),LUe=KK({scrapeMotionValuesFromProps:LK,createRenderState:GK}),IUe=Symbol.for("motionComponentSymbol");function hm(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function zUe(e,r,n){return E.useCallback(o=>{o&&e.onMount&&e.onMount(o),r&&(o?r.mount(o):r.unmount()),n&&(typeof n=="function"?n(o):hm(n)&&(n.current=o))},[r])}const ZK=E.createContext({});function jUe(e,r,n,o,a){const{visualElement:i}=E.useContext(vk),s=E.useContext(u9),l=E.useContext(gk),c=E.useContext(uh).reducedMotion,u=E.useRef(null);o=o||s.renderer,!u.current&&o&&(u.current=o(e,{visualState:r,parent:i,props:n,presenceContext:l,blockInitialAnimation:l?l.initial===!1:!1,reducedMotionConfig:c}));const d=u.current,h=E.useContext(ZK);d&&!d.projection&&a&&(d.type==="html"||d.type==="svg")&&BUe(u.current,n,a,h);const p=E.useRef(!1);E.useInsertionEffect(()=>{d&&p.current&&d.update(n,l)});const g=n[dK],y=E.useRef(!!g&&!window.MotionHandoffIsComplete?.(g)&&window.MotionHasOptimisedAnimation?.(g));return c9(()=>{d&&(p.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),y.current&&d.animationState&&d.animationState.animateChanges())}),E.useEffect(()=>{d&&(!y.current&&d.animationState&&d.animationState.animateChanges(),y.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(g)}),y.current=!1),d.enteringChildren=void 0)}),d}function BUe(e,r,n,o){const{layoutId:a,layout:i,drag:s,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=r;e.projection=new n(e.latestValues,r["data-framer-portal-id"]?void 0:QK(e.parent)),e.projection.setOptions({layoutId:a,layout:i,alwaysMeasureLayout:!!s||l&&hm(l),visualElement:e,animationType:typeof i=="string"?i:"both",initialPromotionConfig:o,crossfade:d,layoutScroll:c,layoutRoot:u})}function QK(e){if(e)return e.options.allowProjection!==!1?e.projection:QK(e.parent)}function wk(e,{forwardMotionProps:r=!1}={},n,o){n&&d9(n);const a=p9(e)?LUe:DUe;function i(l,c){let u;const d={...E.useContext(uh),...l,layoutId:FUe(l)},{isStatic:h}=d,p=CUe(l),g=a(l,h);if(!h&&n9){HUe();const y=UUe(d);u=y.MeasureLayout,p.visualElement=jUe(e,g,d,o,y.ProjectionNode)}return b.jsxs(vk.Provider,{value:p,children:[u&&p.visualElement?b.jsx(u,{visualElement:p.visualElement,...d}):null,PUe(e,l,zUe(g,p.visualElement,c),g,h,r)]})}i.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const s=E.forwardRef(i);return s[IUe]=e,s}function FUe({layoutId:e}){const r=E.useContext(uy).id;return r&&e!==void 0?r+"-"+e:e}function HUe(e,r){E.useContext(u9).strict}function UUe(e){const{drag:r,layout:n}=lm;if(!r&&!n)return{};const o={...r,...n};return{MeasureLayout:r?.isEnabled(e)||n?.isEnabled(e)?o.MeasureLayout:void 0,ProjectionNode:o.ProjectionNode}}function VUe(e,r){if(typeof Proxy>"u")return wk;const n=new Map,o=(i,s)=>wk(i,s,e,r),a=(i,s)=>o(i,s);return new Proxy(a,{get:(i,s)=>s==="create"?o:(n.has(s)||n.set(s,wk(s,void 0,e,r)),n.get(s))})}const cs=VUe(),qUe=(e,r)=>p9(e)?new IK(r):new PK(r,{allowProjection:e!==E.Fragment});function JK(e,r,n,o=0,a=1){const i=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(r),s=e.size,l=(s-1)*o;return typeof n=="function"?n(i,s):a===1?i*o:l-i*o}function m9(e,r,n={}){const o=am(e,r,n.type==="exit"?e.presenceContext?.custom:void 0);let{transition:a=e.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(a=n.transitionOverride);const i=o?()=>Promise.all(J8(e,o,n)):()=>Promise.resolve(),s=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:h}=a;return YUe(e,r,c,u,d,h,n)}:()=>Promise.resolve(),{when:l}=a;if(l){const[c,u]=l==="beforeChildren"?[i,s]:[s,i];return c().then(()=>u())}else return Promise.all([i(),s(n.delay)])}function YUe(e,r,n=0,o=0,a=0,i=1,s){const l=[];for(const c of e.variantChildren)c.notify("AnimationStart",r),l.push(m9(c,r,{...s,delay:n+(typeof o=="function"?0:o)+JK(e.variantChildren,c,o,a,i)}).then(()=>c.notify("AnimationComplete",r)));return Promise.all(l)}function WUe(e,r,n={}){e.notify("AnimationStart",r);let o;if(Array.isArray(r)){const a=r.map(i=>m9(e,i,n));o=Promise.all(a)}else if(typeof r=="string")o=m9(e,r,n);else{const a=typeof r=="function"?am(e,r,n.custom):r;o=Promise.all(J8(e,a,n))}return o.then(()=>{e.notify("AnimationComplete",r)})}function eZ(e,r){if(!Array.isArray(r))return!1;const n=r.length;if(n!==e.length)return!1;for(let o=0;oPromise.all(r.map(({animation:n,options:o})=>WUe(e,n,o)))}function QUe(e){let r=ZUe(e),n=rZ(),o=!0;const a=c=>(u,d)=>{const h=am(e,d,c==="exit"?e.presenceContext?.custom:void 0);if(h){const{transition:p,transitionEnd:g,...y}=h;u={...u,...y,...g}}return u};function i(c){r=c(e)}function s(c){const{props:u}=e,d=tZ(e.parent)||{},h=[],p=new Set;let g={},y=1/0;for(let w=0;wy&&T,M=!1;const O=Array.isArray(_)?_:[_];let B=O.reduce(a(k),{});A===!1&&(B={});const{prevResolvedValues:I={}}=C,Y={...I,...B},D=L=>{R=!0,p.has(L)&&(M=!0,p.delete(L)),C.needsAnimating[L]=!0;const U=e.getValue(L);U&&(U.liveStyle=!1)};for(const L in Y){const U=B[L],q=I[L];if(g.hasOwnProperty(L))continue;let X=!1;X8(U)&&X8(q)?X=!eZ(U,q):X=U!==q,X?U!=null?D(L):p.add(L):U!==void 0&&p.has(L)?D(L):C.protectedKeys[L]=!0}C.prevProp=_,C.prevResolvedValues=B,C.isActive&&(g={...g,...B}),o&&e.blockInitialAnimation&&(R=!1);const V=N&&$;R&&(!V||M)&&h.push(...O.map(L=>{const U={type:k};if(typeof L=="string"&&o&&!V&&e.manuallyAnimateOnMount&&e.parent){const{parent:q}=e,X=am(q,L);if(q.enteringChildren&&X){const{delayChildren:F}=X.transition||{};U.delay=JK(q.enteringChildren,e,F)}}return{animation:L,options:U}}))}if(p.size){const w={};if(typeof u.initial!="boolean"){const k=am(e,Array.isArray(u.initial)?u.initial[0]:u.initial);k&&k.transition&&(w.transition=k.transition)}p.forEach(k=>{const C=e.getBaseTarget(k),_=e.getValue(k);_&&(_.liveStyle=!0),w[k]=C??null}),h.push({animation:w})}let x=!!h.length;return o&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(x=!1),o=!1,x?r(h):Promise.resolve()}function l(c,u){if(n[c].isActive===u)return Promise.resolve();e.variantChildren?.forEach(h=>h.animationState?.setActive(c,u)),n[c].isActive=u;const d=s(c);for(const h in n)n[h].protectedKeys={};return d}return{animateChanges:s,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=rZ(),o=!0}}}function JUe(e,r){return typeof r=="string"?r!==e:Array.isArray(r)?!eZ(r,e):!1}function dh(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function rZ(){return{animate:dh(!0),whileInView:dh(),whileHover:dh(),whileTap:dh(),whileDrag:dh(),whileFocus:dh(),exit:dh()}}class ku{constructor(r){this.isMounted=!1,this.node=r}update(){}}class eVe extends ku{constructor(r){super(r),r.animationState||(r.animationState=QUe(r))}updateAnimationControlsSubscription(){const{animate:r}=this.node.getProps();pk(r)&&(this.unmountControls=r.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:r}=this.node.getProps(),{animate:n}=this.node.prevProps||{};r!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let tVe=0;class rVe extends ku{constructor(){super(...arguments),this.id=tVe++}update(){if(!this.node.presenceContext)return;const{isPresent:r,onExitComplete:n}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||r===o)return;const a=this.node.animationState.setActive("exit",!r);n&&!r&&a.then(()=>{n(this.id)})}mount(){const{register:r,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),r&&(this.unmount=r(this.id))}unmount(){}}const nVe={animation:{Feature:eVe},exit:{Feature:rVe}};function dy(e,r,n,o={passive:!0}){return e.addEventListener(r,n,o),()=>e.removeEventListener(r,n)}function hy(e){return{point:{x:e.pageX,y:e.pageY}}}const oVe=e=>r=>V8(r)&&e(r,hy(r));function fy(e,r,n,o){return dy(e,r,oVe(n),o)}const nZ=1e-4,aVe=1-nZ,iVe=1+nZ,oZ=.01,sVe=0-oZ,lVe=0+oZ;function Vo(e){return e.max-e.min}function cVe(e,r,n){return Math.abs(e-r)<=n}function aZ(e,r,n,o=.5){e.origin=o,e.originPoint=Lr(r.min,r.max,e.origin),e.scale=Vo(n)/Vo(r),e.translate=Lr(n.min,n.max,e.origin)-e.originPoint,(e.scale>=aVe&&e.scale<=iVe||isNaN(e.scale))&&(e.scale=1),(e.translate>=sVe&&e.translate<=lVe||isNaN(e.translate))&&(e.translate=0)}function py(e,r,n,o){aZ(e.x,r.x,n.x,o?o.originX:void 0),aZ(e.y,r.y,n.y,o?o.originY:void 0)}function iZ(e,r,n){e.min=n.min+r.min,e.max=e.min+Vo(r)}function uVe(e,r,n){iZ(e.x,r.x,n.x),iZ(e.y,r.y,n.y)}function sZ(e,r,n){e.min=r.min-n.min,e.max=e.min+Vo(r)}function my(e,r,n){sZ(e.x,r.x,n.x),sZ(e.y,r.y,n.y)}function fi(e){return[e("x"),e("y")]}const lZ=({current:e})=>e?e.ownerDocument.defaultView:null;class cZ{constructor(r,n,{transformPagePoint:o,contextWindow:a=window,dragSnapToOrigin:i=!1,distanceThreshold:s=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const p=y9(this.lastMoveEventInfo,this.history),g=this.startEvent!==null,y=lUe(p.offset,{x:0,y:0})>=this.distanceThreshold;if(!g&&!y)return;const{point:x}=p,{timestamp:w}=mo;this.history.push({...x,timestamp:w});const{onStart:k,onMove:C}=this.handlers;g||(k&&k(this.lastMoveEvent,p),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,p)},this.handlePointerMove=(p,g)=>{this.lastMoveEvent=p,this.lastMoveEventInfo=g9(g,this.transformPagePoint),Mr.update(this.updatePoint,!0)},this.handlePointerUp=(p,g)=>{this.end();const{onEnd:y,onSessionEnd:x,resumeAnimation:w}=this.handlers;if(this.dragSnapToOrigin&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=y9(p.type==="pointercancel"?this.lastMoveEventInfo:g9(g,this.transformPagePoint),this.history);this.startEvent&&y&&y(p,k),x&&x(p,k)},!V8(r))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=o,this.distanceThreshold=s,this.contextWindow=a||window;const l=hy(r),c=g9(l,this.transformPagePoint),{point:u}=c,{timestamp:d}=mo;this.history=[{...u,timestamp:d}];const{onSessionStart:h}=n;h&&h(r,y9(c,this.history)),this.removeListeners=Q1(fy(this.contextWindow,"pointermove",this.handlePointerMove),fy(this.contextWindow,"pointerup",this.handlePointerUp),fy(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(r){this.handlers=r}end(){this.removeListeners&&this.removeListeners(),vu(this.updatePoint)}}function g9(e,r){return r?{point:r(e.point)}:e}function uZ(e,r){return{x:e.x-r.x,y:e.y-r.y}}function y9({point:e},r){return{point:e,delta:uZ(e,dZ(r)),offset:uZ(e,dVe(r)),velocity:hVe(r,.1)}}function dVe(e){return e[0]}function dZ(e){return e[e.length-1]}function hVe(e,r){if(e.length<2)return{x:0,y:0};let n=e.length-1,o=null;const a=dZ(e);for(;n>=0&&(o=e[n],!(a.timestamp-o.timestamp>ss(r)));)n--;if(!o)return{x:0,y:0};const i=hi(a.timestamp-o.timestamp);if(i===0)return{x:0,y:0};const s={x:(a.x-o.x)/i,y:(a.y-o.y)/i};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function fVe(e,{min:r,max:n},o){return r!==void 0&&en&&(e=o?Lr(n,e,o.max):Math.min(e,n)),e}function hZ(e,r,n){return{min:r!==void 0?e.min+r:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function pVe(e,{top:r,left:n,bottom:o,right:a}){return{x:hZ(e.x,n,a),y:hZ(e.y,r,o)}}function fZ(e,r){let n=r.min-e.min,o=r.max-e.max;return r.max-r.mino?n=em(r.min,r.max-o,e.min):o>a&&(n=em(e.min,e.max-a,r.min)),rc(0,1,n)}function yVe(e,r){const n={};return r.min!==void 0&&(n.min=r.min-e.min),r.max!==void 0&&(n.max=r.max-e.min),n}const b9=.35;function bVe(e=b9){return e===!1?e=0:e===!0&&(e=b9),{x:pZ(e,"left","right"),y:pZ(e,"top","bottom")}}function pZ(e,r,n){return{min:mZ(e,r),max:mZ(e,n)}}function mZ(e,r){return typeof e=="number"?e:e[r]||0}const vVe=new WeakMap;class xVe{constructor(r){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Zr(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=r}start(r,{snapToCursor:n=!1,distanceThreshold:o}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const i=h=>{const{dragSnapToOrigin:p}=this.getProps();p?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(hy(h).point)},s=(h,p)=>{const{drag:g,dragPropagation:y,onDragStart:x}=this.getProps();if(g&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=aHe(g),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=p,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),fi(k=>{let C=this.getAxisMotionValue(k).get()||0;if(sl.test(C)){const{projection:_}=this.visualElement;if(_&&_.layout){const T=_.layout.layoutBox[k];T&&(C=Vo(T)*(parseFloat(C)/100))}}this.originPoint[k]=C}),x&&Mr.postRender(()=>x(h,p)),K8(this.visualElement,"transform");const{animationState:w}=this.visualElement;w&&w.setActive("whileDrag",!0)},l=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p;const{dragPropagation:g,dragDirectionLock:y,onDirectionLock:x,onDrag:w}=this.getProps();if(!g&&!this.openDragLock)return;const{offset:k}=p;if(y&&this.currentDirection===null){this.currentDirection=wVe(k),this.currentDirection!==null&&x&&x(this.currentDirection);return}this.updateAxis("x",p.point,k),this.updateAxis("y",p.point,k),this.visualElement.render(),w&&w(h,p)},c=(h,p)=>{this.latestPointerEvent=h,this.latestPanInfo=p,this.stop(h,p),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>fi(h=>this.getAnimationState(h)==="paused"&&this.getAxisMotionValue(h).animation?.play()),{dragSnapToOrigin:d}=this.getProps();this.panSession=new cZ(r,{onSessionStart:i,onStart:s,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:o,contextWindow:lZ(this.visualElement)})}stop(r,n){const o=r||this.latestPointerEvent,a=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!a||!o)return;const{velocity:s}=a;this.startAnimation(s);const{onDragEnd:l}=this.getProps();l&&Mr.postRender(()=>l(o,a))}cancel(){this.isDragging=!1;const{projection:r,animationState:n}=this.visualElement;r&&(r.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(r,n,o){const{drag:a}=this.getProps();if(!o||!kk(r,a,this.currentDirection))return;const i=this.getAxisMotionValue(r);let s=this.originPoint[r]+o[r];this.constraints&&this.constraints[r]&&(s=fVe(s,this.constraints[r],this.elastic[r])),i.set(s)}resolveConstraints(){const{dragConstraints:r,dragElastic:n}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;r&&hm(r)?this.constraints||(this.constraints=this.resolveRefConstraints()):r&&o?this.constraints=pVe(o.layoutBox,r):this.constraints=!1,this.elastic=bVe(n),a!==this.constraints&&o&&this.constraints&&!this.hasMutatedConstraints&&fi(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=yVe(o.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:r,onMeasureDragConstraints:n}=this.getProps();if(!r||!hm(r))return!1;const o=r.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const i=FHe(o,a.root,this.visualElement.getTransformPagePoint());let s=mVe(a.layout.layoutBox,i);if(n){const l=n(zHe(s));this.hasMutatedConstraints=!!l,l&&(s=fK(l))}return s}startAnimation(r){const{drag:n,dragMomentum:o,dragElastic:a,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=fi(d=>{if(!kk(d,n,this.currentDirection))return;let h=c&&c[d]||{};s&&(h={min:0,max:0});const p=a?200:1e6,g=a?40:1e7,y={type:"inertia",velocity:o?r[d]:0,bounceStiffness:p,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(r,n){const o=this.getAxisMotionValue(r);return K8(this.visualElement,r),o.start(Q8(r,o,0,n,this.visualElement,!1))}stopAnimation(){fi(r=>this.getAxisMotionValue(r).stop())}pauseAnimation(){fi(r=>this.getAxisMotionValue(r).animation?.pause())}getAnimationState(r){return this.getAxisMotionValue(r).animation?.state}getAxisMotionValue(r){const n=`_drag${r.toUpperCase()}`,o=this.visualElement.getProps();return o[n]||this.visualElement.getValue(r,(o.initial?o.initial[r]:void 0)||0)}snapToCursor(r){fi(n=>{const{drag:o}=this.getProps();if(!kk(n,o,this.currentDirection))return;const{projection:a}=this.visualElement,i=this.getAxisMotionValue(n);if(a&&a.layout){const{min:s,max:l}=a.layout.layoutBox[n];i.set(r[n]-Lr(s,l,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:r,dragConstraints:n}=this.getProps(),{projection:o}=this.visualElement;if(!hm(n)||!o||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};fi(s=>{const l=this.getAxisMotionValue(s);if(l&&this.constraints!==!1){const c=l.get();a[s]=gVe({min:c,max:c},this.constraints[s])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.resolveConstraints(),fi(s=>{if(!kk(s,r,null))return;const l=this.getAxisMotionValue(s),{min:c,max:u}=this.constraints[s];l.set(Lr(c,u,a[s]))})}addListeners(){if(!this.visualElement.current)return;vVe.set(this.visualElement,this);const r=this.visualElement.current,n=fy(r,"pointerdown",c=>{const{drag:u,dragListener:d=!0}=this.getProps();u&&d&&this.start(c)}),o=()=>{const{dragConstraints:c}=this.getProps();hm(c)&&c.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,i=a.addEventListener("measure",o);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),Mr.read(o);const s=dy(window,"resize",()=>this.scalePositionWithinConstraints()),l=a.addEventListener("didUpdate",(({delta:c,hasLayoutChanged:u})=>{this.isDragging&&u&&(fi(d=>{const h=this.getAxisMotionValue(d);h&&(this.originPoint[d]+=c[d].translate,h.set(h.get()+c[d].translate))}),this.visualElement.render())}));return()=>{s(),n(),i(),l&&l()}}getProps(){const r=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:o=!1,dragPropagation:a=!1,dragConstraints:i=!1,dragElastic:s=b9,dragMomentum:l=!0}=r;return{...r,drag:n,dragDirectionLock:o,dragPropagation:a,dragConstraints:i,dragElastic:s,dragMomentum:l}}}function kk(e,r,n){return(r===!0||r===e)&&(n===null||n===e)}function wVe(e,r=10){let n=null;return Math.abs(e.y)>r?n="y":Math.abs(e.x)>r&&(n="x"),n}class kVe extends ku{constructor(r){super(r),this.removeGroupControls=di,this.removeListeners=di,this.controls=new xVe(r)}mount(){const{dragControls:r}=this.node.getProps();r&&(this.removeGroupControls=r.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||di}unmount(){this.removeGroupControls(),this.removeListeners()}}const gZ=e=>(r,n)=>{e&&Mr.postRender(()=>e(r,n))};class _Ve extends ku{constructor(){super(...arguments),this.removePointerDownListener=di}onPointerDown(r){this.session=new cZ(r,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:lZ(this.node)})}createPanHandlers(){const{onPanSessionStart:r,onPanStart:n,onPan:o,onPanEnd:a}=this.node.getProps();return{onSessionStart:gZ(r),onStart:gZ(n),onMove:o,onEnd:(i,s)=>{delete this.session,a&&Mr.postRender(()=>a(i,s))}}}mount(){this.removePointerDownListener=fy(this.node.current,"pointerdown",r=>this.onPointerDown(r))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const _k={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function yZ(e,r){return r.max===r.min?0:e/(r.max-r.min)*100}const gy={correct:(e,r)=>{if(!r.target)return e;if(typeof e=="string")if(vt.test(e))e=parseFloat(e);else return e;const n=yZ(e,r.target.x),o=yZ(e,r.target.y);return`${n}% ${o}%`}},EVe={correct:(e,{treeScale:r,projectionDelta:n})=>{const o=e,a=wu.parse(e);if(a.length>5)return o;const i=wu.createTransformer(e),s=typeof a[0]!="number"?1:0,l=n.x.scale*r.x,c=n.y.scale*r.y;a[0+s]/=l,a[1+s]/=c;const u=Lr(l,c,.5);return typeof a[2+s]=="number"&&(a[2+s]/=u),typeof a[3+s]=="number"&&(a[3+s]/=u),i(a)}};let v9=!1;class SVe extends E.Component{componentDidMount(){const{visualElement:r,layoutGroup:n,switchLayoutGroup:o,layoutId:a}=this.props,{projection:i}=r;YHe(CVe),i&&(n.group&&n.group.add(i),o&&o.register&&a&&o.register(i),v9&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),_k.hasEverUpdated=!0}getSnapshotBeforeUpdate(r){const{layoutDependency:n,visualElement:o,drag:a,isPresent:i}=this.props,{projection:s}=o;return s&&(s.isPresent=i,v9=!0,a||r.layoutDependency!==n||n===void 0||r.isPresent!==i?s.willUpdate():this.safeToRemove(),r.isPresent!==i&&(i?s.promote():s.relegate()||Mr.postRender(()=>{const l=s.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:r}=this.props.visualElement;r&&(r.root.didUpdate(),U8.postRender(()=>{!r.currentAnimation&&r.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:r,layoutGroup:n,switchLayoutGroup:o}=this.props,{projection:a}=r;v9=!0,a&&(a.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(a),o&&o.deregister&&o.deregister(a))}safeToRemove(){const{safeToRemove:r}=this.props;r&&r()}render(){return null}}function bZ(e){const[r,n]=HK(),o=E.useContext(uy);return b.jsx(SVe,{...e,layoutGroup:o,switchLayoutGroup:E.useContext(ZK),isPresent:r,safeToRemove:n})}const CVe={borderRadius:{...gy,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:gy,borderTopRightRadius:gy,borderBottomLeftRadius:gy,borderBottomRightRadius:gy,boxShadow:EVe},TVe=(e,r)=>e.depth-r.depth;class AVe{constructor(){this.children=[],this.isDirty=!1}add(r){i8(this.children,r),this.isDirty=!0}remove(r){ak(this.children,r),this.isDirty=!0}forEach(r){this.isDirty&&this.children.sort(TVe),this.isDirty=!1,this.children.forEach(r)}}const vZ=["TopLeft","TopRight","BottomLeft","BottomRight"],NVe=vZ.length,xZ=e=>typeof e=="string"?parseFloat(e):e,wZ=e=>typeof e=="number"||vt.test(e);function RVe(e,r,n,o,a,i){a?(e.opacity=Lr(0,n.opacity??1,$Ve(o)),e.opacityExit=Lr(r.opacity??1,0,PVe(o))):i&&(e.opacity=Lr(r.opacity??1,n.opacity??1,o));for(let s=0;sor?1:n(em(e,r,o))}function EZ(e,r){e.min=r.min,e.max=r.max}function pi(e,r){EZ(e.x,r.x),EZ(e.y,r.y)}function SZ(e,r){e.translate=r.translate,e.scale=r.scale,e.originPoint=r.originPoint,e.origin=r.origin}function CZ(e,r,n,o,a){return e-=r,e=hk(e,1/n,o),a!==void 0&&(e=hk(e,1/a,o)),e}function MVe(e,r=0,n=1,o=.5,a,i=e,s=e){if(sl.test(r)&&(r=parseFloat(r),r=Lr(s.min,s.max,r/100)-s.min),typeof r!="number")return;let l=Lr(i.min,i.max,o);e===i&&(l-=r),e.min=CZ(e.min,r,n,l,a),e.max=CZ(e.max,r,n,l,a)}function TZ(e,r,[n,o,a],i,s){MVe(e,r[n],r[o],r[a],r.scale,i,s)}const OVe=["x","scaleX","originX"],DVe=["y","scaleY","originY"];function AZ(e,r,n,o){TZ(e.x,r,OVe,n?n.x:void 0,o?o.x:void 0),TZ(e.y,r,DVe,n?n.y:void 0,o?o.y:void 0)}function NZ(e){return e.translate===0&&e.scale===1}function RZ(e){return NZ(e.x)&&NZ(e.y)}function $Z(e,r){return e.min===r.min&&e.max===r.max}function LVe(e,r){return $Z(e.x,r.x)&&$Z(e.y,r.y)}function PZ(e,r){return Math.round(e.min)===Math.round(r.min)&&Math.round(e.max)===Math.round(r.max)}function MZ(e,r){return PZ(e.x,r.x)&&PZ(e.y,r.y)}function OZ(e){return Vo(e.x)/Vo(e.y)}function DZ(e,r){return e.translate===r.translate&&e.scale===r.scale&&e.originPoint===r.originPoint}class IVe{constructor(){this.members=[]}add(r){i8(this.members,r),r.scheduleRender()}remove(r){if(ak(this.members,r),r===this.prevLead&&(this.prevLead=void 0),r===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(r){const n=this.members.findIndex(a=>r===a);if(n===0)return!1;let o;for(let a=n;a>=0;a--){const i=this.members[a];if(i.isPresent!==!1){o=i;break}}return o?(this.promote(o),!0):!1}promote(r,n){const o=this.lead;if(r!==o&&(this.prevLead=o,this.lead=r,r.show(),o)){o.instance&&o.scheduleRender(),r.scheduleRender(),r.resumeFrom=o,n&&(r.resumeFrom.preserveOpacity=!0),o.snapshot&&(r.snapshot=o.snapshot,r.snapshot.latestValues=o.animationValues||o.latestValues),r.root&&r.root.isUpdating&&(r.isLayoutDirty=!0);const{crossfade:a}=r.options;a===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(r=>{const{options:n,resumingFrom:o}=r;n.onExitComplete&&n.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(r=>{r.instance&&r.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function zVe(e,r,n){let o="";const a=e.x.translate/r.x,i=e.y.translate/r.y,s=n?.z||0;if((a||i||s)&&(o=`translate3d(${a}px, ${i}px, ${s}px) `),(r.x!==1||r.y!==1)&&(o+=`scale(${1/r.x}, ${1/r.y}) `),n){const{transformPerspective:u,rotate:d,rotateX:h,rotateY:p,skewX:g,skewY:y}=n;u&&(o=`perspective(${u}px) ${o}`),d&&(o+=`rotate(${d}deg) `),h&&(o+=`rotateX(${h}deg) `),p&&(o+=`rotateY(${p}deg) `),g&&(o+=`skewX(${g}deg) `),y&&(o+=`skewY(${y}deg) `)}const l=e.x.scale*r.x,c=e.y.scale*r.y;return(l!==1||c!==1)&&(o+=`scale(${l}, ${c})`),o||"none"}const x9=["","X","Y","Z"],jVe=1e3;let BVe=0;function w9(e,r,n,o){const{latestValues:a}=r;a[e]&&(n[e]=a[e],r.setStaticValue(e,0),o&&(o[e]=0))}function LZ(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:r}=e.options;if(!r)return;const n=hK(r);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:a,layoutId:i}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Mr,!(a||i))}const{parent:o}=e;o&&!o.hasCheckedOptimisedAppear&&LZ(o)}function IZ({attachResizeListener:e,defaultParent:r,measureScroll:n,checkIsScrollRoot:o,resetTransform:a}){return class{constructor(i={},s=r?.()){this.id=BVe++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(UVe),this.nodes.forEach(WVe),this.nodes.forEach(XVe),this.nodes.forEach(VVe)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;Mr.read(()=>{d=window.innerWidth}),e(i,()=>{const p=window.innerWidth;p!==d&&(d=p,this.root.updateBlockedByResize=!0,u&&u(),u=sUe(h,250),_k.hasAnimatedSinceResize&&(_k.hasAnimatedSinceResize=!1,this.nodes.forEach(BZ)))})}s&&this.root.registerSharedNode(s,this),this.options.animate!==!1&&c&&(s||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||c.getDefaultTransition()||JVe,{onLayoutAnimationStart:y,onLayoutAnimationComplete:x}=c.getProps(),w=!this.targetLayout||!MZ(this.targetLayout,p),k=!d&&h;if(this.options.layoutRoot||this.resumeFrom||k||d&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...B8(g,"layout"),onPlay:y,onComplete:x};(c.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(u,k)}else d||BZ(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),vu(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(GVe),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&LZ(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Vo(this.snapshot.measuredBox.x)&&!Vo(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const T=_/1e3;FZ(d.x,i.x,T),FZ(d.y,i.y,T),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(my(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),ZVe(this.relativeTarget,this.relativeTargetOrigin,h,T),C&&LVe(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=Zr()),pi(C,this.relativeTarget)),y&&(this.animationValues=u,RVe(u,c,this.latestValues,T,k,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=T},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(vu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Mr.update(()=>{_k.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=lh(0)),this.currentAnimation=zK(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:s=>{this.mixTargetDelta(s),i.onUpdate&&i.onUpdate(s)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(jVe),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:s,target:l,layout:c,latestValues:u}=i;if(!(!s||!l||!c)){if(this!==i&&this.layout&&c&&YZ(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Zr();const d=Vo(this.layout.layoutBox.x);l.x.min=i.target.x.min,l.x.max=l.x.min+d;const h=Vo(this.layout.layoutBox.y);l.y.min=i.target.y.min,l.y.max=l.y.min+h}pi(s,l),sm(s,u),py(this.projectionDeltaWithTransform,this.layoutCorrected,s,u)}}registerSharedNode(i,s){this.sharedNodes.has(i)||this.sharedNodes.set(i,new IVe),this.sharedNodes.get(i).add(s);const l=s.options.initialPromotionConfig;s.promote({transition:l?l.transition:void 0,preserveFollowOpacity:l&&l.shouldPreserveFollowOpacity?l.shouldPreserveFollowOpacity(s):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){const{layoutId:i}=this.options;return i?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:i}=this.options;return i?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:s,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),i&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let s=!1;const{latestValues:l}=i;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(s=!0),!s)return;const c={};l.z&&w9("z",i,c,this.animationValues);for(let u=0;ui.currentAnimation?.stop()),this.root.nodes.forEach(zZ),this.root.sharedNodes.clear()}}}function FVe(e){e.updateLayout()}function HVe(e){const r=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&r&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:o}=e.layout,{animationType:a}=e.options,i=r.source!==e.layout.source;a==="size"?fi(d=>{const h=i?r.measuredBox[d]:r.layoutBox[d],p=Vo(h);h.min=n[d].min,h.max=h.min+p}):YZ(a,r.layoutBox,n)&&fi(d=>{const h=i?r.measuredBox[d]:r.layoutBox[d],p=Vo(n[d]);h.max=h.min+p,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+p)});const s=cm();py(s,n,r.layoutBox);const l=cm();i?py(l,e.applyTransform(o,!0),r.measuredBox):py(l,n,r.layoutBox);const c=!RZ(s);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:h,layout:p}=d;if(h&&p){const g=Zr();my(g,r.layoutBox,h.layoutBox);const y=Zr();my(y,n,p.layoutBox),MZ(g,y)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=y,e.relativeTargetOrigin=g,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:r,delta:l,layoutDelta:s,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function UVe(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function VVe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function qVe(e){e.clearSnapshot()}function zZ(e){e.clearMeasurements()}function jZ(e){e.isLayoutDirty=!1}function YVe(e){const{visualElement:r}=e.options;r&&r.getProps().onBeforeLayoutMeasure&&r.notify("BeforeLayoutMeasure"),e.resetTransform()}function BZ(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function WVe(e){e.resolveTargetDelta()}function XVe(e){e.calcProjection()}function GVe(e){e.resetSkewAndRotation()}function KVe(e){e.removeLeadSnapshot()}function FZ(e,r,n){e.translate=Lr(r.translate,0,n),e.scale=Lr(r.scale,1,n),e.origin=r.origin,e.originPoint=r.originPoint}function HZ(e,r,n,o){e.min=Lr(r.min,n.min,o),e.max=Lr(r.max,n.max,o)}function ZVe(e,r,n,o){HZ(e.x,r.x,n.x,o),HZ(e.y,r.y,n.y,o)}function QVe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const JVe={duration:.45,ease:[.4,0,.1,1]},UZ=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),VZ=UZ("applewebkit/")&&!UZ("chrome/")?Math.round:di;function qZ(e){e.min=VZ(e.min),e.max=VZ(e.max)}function eqe(e){qZ(e.x),qZ(e.y)}function YZ(e,r,n){return e==="position"||e==="preserve-aspect"&&!cVe(OZ(r),OZ(n),.2)}function tqe(e){return e!==e.root&&e.scroll?.wasRoot}const rqe=IZ({attachResizeListener:(e,r)=>dy(e,"resize",r),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),k9={current:void 0},WZ=IZ({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!k9.current){const e=new rqe({});e.mount(window),e.setOptions({layoutScroll:!0}),k9.current=e}return k9.current},resetTransform:(e,r)=>{e.style.transform=r!==void 0?r:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),nqe={pan:{Feature:_Ve},drag:{Feature:kVe,ProjectionNode:WZ,MeasureLayout:bZ}};function XZ(e,r,n){const{props:o}=e;e.animationState&&o.whileHover&&e.animationState.setActive("whileHover",n==="Start");const a="onHover"+n,i=o[a];i&&Mr.postRender(()=>i(r,hy(r)))}class oqe extends ku{mount(){const{current:r}=this.node;r&&(this.unmount=iHe(r,(n,o)=>(XZ(this.node,o,"Start"),a=>XZ(this.node,a,"End"))))}unmount(){}}class aqe extends ku{constructor(){super(...arguments),this.isActive=!1}onFocus(){let r=!1;try{r=this.node.current.matches(":focus-visible")}catch{r=!0}!r||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Q1(dy(this.node.current,"focus",()=>this.onFocus()),dy(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function GZ(e,r,n){const{props:o}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&o.whileTap&&e.animationState.setActive("whileTap",n==="Start");const a="onTap"+(n==="End"?"":n),i=o[a];i&&Mr.postRender(()=>i(r,hy(r)))}class iqe extends ku{mount(){const{current:r}=this.node;r&&(this.unmount=uHe(r,(n,o)=>(GZ(this.node,o,"Start"),(a,{success:i})=>GZ(this.node,a,i?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const _9=new WeakMap,E9=new WeakMap,sqe=e=>{const r=_9.get(e.target);r&&r(e)},lqe=e=>{e.forEach(sqe)};function cqe({root:e,...r}){const n=e||document;E9.has(n)||E9.set(n,{});const o=E9.get(n),a=JSON.stringify(r);return o[a]||(o[a]=new IntersectionObserver(lqe,{root:e,...r})),o[a]}function uqe(e,r,n){const o=cqe(r);return _9.set(e,n),o.observe(e),()=>{_9.delete(e),o.unobserve(e)}}const dqe={some:0,all:1};class hqe extends ku{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:r={}}=this.node.getProps(),{root:n,margin:o,amount:a="some",once:i}=r,s={root:n?n.current:void 0,rootMargin:o,threshold:typeof a=="number"?a:dqe[a]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,i&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:h}=this.node.getProps(),p=u?d:h;p&&p(c)};return uqe(this.node.current,s,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:r,prevProps:n}=this.node;["amount","margin","root"].some(fqe(r,n))&&this.startObserver()}unmount(){}}function fqe({viewport:e={}},{viewport:r={}}={}){return n=>e[n]!==r[n]}const pqe={inView:{Feature:hqe},tap:{Feature:iqe},focus:{Feature:aqe},hover:{Feature:oqe}},mqe={layout:{ProjectionNode:WZ,MeasureLayout:bZ}},gqe={renderer:qUe,...nVe,...pqe},yqe={...gqe,...nqe,...mqe};function KZ(e){const r=um(()=>lh(e)),{isStatic:n}=E.useContext(uh);if(n){const[,o]=E.useState(e);E.useEffect(()=>r.on("change",o),[])}return r}function bqe(){!o9.current&&SK();const[e]=E.useState(fk.current);return e}function ZZ(){const e=bqe(),{reducedMotion:r}=E.useContext(uh);return r==="never"?!1:r==="always"?!0:e}class vqe{constructor(){this.componentControls=new Set}subscribe(r){return this.componentControls.add(r),()=>this.componentControls.delete(r)}start(r,n){this.componentControls.forEach(o=>{o.start(r.nativeEvent||r,n)})}cancel(){this.componentControls.forEach(r=>{r.cancel()})}stop(){this.componentControls.forEach(r=>{r.stop()})}}const xqe=()=>new vqe;function wqe(){return um(xqe)}const S9=E.createContext(null);S9.displayName="ElementDetailsActorContext";const kqe=()=>{const e=E.useContext(S9);if(e===null)throw new Error("ElementDetailsActorRef is not provided");return e},us=(e,r,n)=>{const o=a=>({[e]:"__ignore__",...r,...Pd(a)});return{recipeFn:(a,i=!0)=>{const s=TB({conditions:{shift:PB,finalize:$B,breakpoints:{keys:["base","xs","sm","md","lg","xl"]}},utility:{toHash:(c,u)=>u(c.join(":")),transform:(c,u)=>(KSe(e,n,a,c),u==="__ignore__"?{className:e}:(u=VS(u),{className:`${e}--${c}_${u}`}))}}),l=o(a);if(i){const c=KS(n,l);return Je(s(l),ye(c))}return s(l)},getVariantProps:o,__getCompoundVariantCss__:a=>KS(n,o(a))}},oc=(e,r)=>{if(e&&!r)return e;if(!e&&r)return r;const n=(...i)=>Je(e(...i),r(...i)),o=XS(e.variantKeys,r.variantKeys),a=o.reduce((i,s)=>(i[s]=XS(e.variantMap[s],r.variantMap[s]),i),{});return Object.assign(n,{__recipe__:!0,__name__:`${e.__name__} ${r.__name__}`,raw:i=>i,variantKeys:o,variantMap:a,splitVariantProps(i){return Yn(i,o)}})},C9=us("action-btn",{size:"md",radius:"md",variant:"filled"},[]),QZ={variant:["transparent","filled"],size:["sm","md"],radius:["sm","md"]},JZ=Object.keys(QZ),Ek=Object.assign(co(C9.recipeFn),{__recipe__:!0,__name__:"actionBtn",__getCompoundVariantCss__:C9.__getCompoundVariantCss__,raw:e=>e,variantKeys:JZ,variantMap:QZ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,JZ)},getVariantProps:C9.getVariantProps}),T9=us("likec4-compound-node",{},[]),eQ={isTransparent:["false","true"],inverseColor:["true","false"],borderStyle:["solid","dashed","dotted","none"]},tQ=Object.keys(eQ),_qe=Object.assign(co(T9.recipeFn),{__recipe__:!0,__name__:"compoundNode",__getCompoundVariantCss__:T9.__getCompoundVariantCss__,raw:e=>e,variantKeys:tQ,variantMap:eQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,tQ)},getVariantProps:T9.getVariantProps}),A9=us("likec4-edge-action-btn",{},[]),rQ={},nQ=Object.keys(rQ),Eqe=Object.assign(co(A9.recipeFn),{__recipe__:!0,__name__:"edgeActionBtn",__getCompoundVariantCss__:A9.__getCompoundVariantCss__,raw:e=>e,variantKeys:nQ,variantMap:rQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,nQ)},getVariantProps:A9.getVariantProps}),N9=us("likec4-element-node-data",{},[]),oQ={},aQ=Object.keys(oQ),Sqe=Object.assign(co(N9.recipeFn),{__recipe__:!0,__name__:"elementNodeData",__getCompoundVariantCss__:N9.__getCompoundVariantCss__,raw:e=>e,variantKeys:aQ,variantMap:oQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,aQ)},getVariantProps:N9.getVariantProps}),R9=us("likec4-element-shape",{},[]),iQ={shapetype:["html","svg"]},sQ=Object.keys(iQ),lQ=Object.assign(co(R9.recipeFn),{__recipe__:!0,__name__:"elementShapeRecipe",__getCompoundVariantCss__:R9.__getCompoundVariantCss__,raw:e=>e,variantKeys:sQ,variantMap:iQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,sQ)},getVariantProps:R9.getVariantProps}),$9=us("likec4-tag",{autoTextColor:!1},[]),cQ={autoTextColor:["false","true"]},uQ=Object.keys(cQ),Cqe=Object.assign(co($9.recipeFn),{__recipe__:!0,__name__:"likec4tag",__getCompoundVariantCss__:$9.__getCompoundVariantCss__,raw:e=>e,variantKeys:uQ,variantMap:cQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,uQ)},getVariantProps:$9.getVariantProps}),P9=us("likec4-markdown-block",{uselikec4palette:!1,value:"markdown"},[]),dQ={uselikec4palette:["true","false"],value:["markdown","plaintext"]},hQ=Object.keys(dQ),Tqe=Object.assign(co(P9.recipeFn),{__recipe__:!0,__name__:"markdownBlock",__getCompoundVariantCss__:P9.__getCompoundVariantCss__,raw:e=>e,variantKeys:hQ,variantMap:dQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,hQ)},getVariantProps:P9.getVariantProps}),M9=us("likec4-navigation-panel-icon",{variant:"default"},[]),fQ={variant:["default","filled"]},pQ=Object.keys(fQ),Aqe=Object.assign(co(M9.recipeFn),{__recipe__:!0,__name__:"navigationPanelActionIcon",__getCompoundVariantCss__:M9.__getCompoundVariantCss__,raw:e=>e,variantKeys:pQ,variantMap:fQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,pQ)},getVariantProps:M9.getVariantProps}),O9=us("likec4-overlay",{fullscreen:!1,withBackdrop:!0},[]),mQ={fullscreen:["false","true"],withBackdrop:["false","true"]},gQ=Object.keys(mQ),Nqe=Object.assign(co(O9.recipeFn),{__recipe__:!0,__name__:"overlay",__getCompoundVariantCss__:O9.__getCompoundVariantCss__,raw:e=>e,variantKeys:gQ,variantMap:mQ,merge(e){return oc(this,e)},splitVariantProps(e){return Yn(e,gQ)},getVariantProps:O9.getVariantProps}),yQ={isStepEdge:!1,cursor:"default"},Rqe=[],$qe=[["root","likec4-edge-label__root"],["stepNumber","likec4-edge-label__stepNumber"],["labelContents","likec4-edge-label__labelContents"],["labelText","likec4-edge-label__labelText"],["labelTechnology","likec4-edge-label__labelTechnology"]],Pqe=$qe.map(([e,r])=>[e,us(r,yQ,WS(Rqe,e))]),Mqe=co((e={})=>Object.fromEntries(Pqe.map(([r,n])=>[r,n.recipeFn(e)]))),bQ=["cursor","isStepEdge"],Oqe=e=>({...yQ,...Pd(e)}),Dqe=Object.assign(Mqe,{__recipe__:!1,__name__:"edgeLabel",raw:e=>e,classNameMap:{},variantKeys:bQ,variantMap:{cursor:["pointer","default"],isStepEdge:["false","true"]},splitVariantProps(e){return Yn(e,bQ)},getVariantProps:Oqe}),vQ={truncateLabel:!1},Lqe=[],Iqe=[["root","likec4-navlink__root"],["body","likec4-navlink__body"],["section","likec4-navlink__section"],["label","likec4-navlink__label"],["description","likec4-navlink__description"]],zqe=Iqe.map(([e,r])=>[e,us(r,vQ,WS(Lqe,e))]),jqe=co((e={})=>Object.fromEntries(zqe.map(([r,n])=>[r,n.recipeFn(e)]))),xQ=["truncateLabel"],Bqe=e=>({...vQ,...Pd(e)}),Fqe=Object.assign(jqe,{__recipe__:!1,__name__:"navigationLink",raw:e=>e,classNameMap:{},variantKeys:xQ,variantMap:{truncateLabel:["true","false"]},splitVariantProps(e){return Yn(e,xQ)},getVariantProps:Bqe});function Hqe(){return up()}function D9(e,r){return At(it(e),Xn)}function L9(){return pr()}function wQ(e){return X7e(e)}const Uqe=e=>Math.round(e.transform[2]*100)/100;function Vqe(){return At(Uqe)}const qqe=e=>e.transform[2]<.2;function Yqe(){return At(qqe)}const{abs:yy,cos:ac,sin:fm,acos:Wqe,atan2:by,sqrt:_u,pow:mi}=Math;function vy(e){return e<0?-mi(-e,.3333333333333333):mi(e,.3333333333333333)}const kQ=Math.PI,Sk=2*kQ,Eu=kQ/2,Xqe=1e-6,I9=Number.MAX_SAFE_INTEGER||9007199254740991,z9=Number.MIN_SAFE_INTEGER||-9007199254740991,Gqe={x:0,y:0,z:0},Ye={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(e,r){const n=r(e);let o=n.x*n.x+n.y*n.y;return typeof n.z<"u"&&(o+=n.z*n.z),_u(o)},compute:function(e,r,n){if(e===0)return r[0].t=0,r[0];const o=r.length-1;if(e===1)return r[o].t=1,r[o];const a=1-e;let i=r;if(o===0)return r[0].t=e,r[0];if(o===1){const l={x:a*i[0].x+e*i[1].x,y:a*i[0].y+e*i[1].y,t:e};return n&&(l.z=a*i[0].z+e*i[1].z),l}if(o<4){let l=a*a,c=e*e,u,d,h,p=0;o===2?(i=[i[0],i[1],i[2],Gqe],u=l,d=a*e*2,h=c):o===3&&(u=l*a,d=l*e*3,h=a*c*3,p=e*c);const g={x:u*i[0].x+d*i[1].x+h*i[2].x+p*i[3].x,y:u*i[0].y+d*i[1].y+h*i[2].y+p*i[3].y,t:e};return n&&(g.z=u*i[0].z+d*i[1].z+h*i[2].z+p*i[3].z),g}const s=JSON.parse(JSON.stringify(r));for(;s.length>1;){for(let l=0;l1;a--,i--){const s=[];for(let l=0,c;l"u")e=.5;else if(e===0||e===1)return e;const n=mi(e,r)+mi(1-e,r),o=n-1;return yy(o/n)},projectionratio:function(e,r){if(r!==2&&r!==3)return!1;if(typeof e>"u")e=.5;else if(e===0||e===1)return e;const n=mi(1-e,r),o=mi(e,r)+n;return n/o},lli8:function(e,r,n,o,a,i,s,l){const c=(e*o-r*n)*(a-s)-(e-n)*(a*l-i*s),u=(e*o-r*n)*(i-l)-(r-o)*(a*l-i*s),d=(e-n)*(i-l)-(r-o)*(a-s);return d==0?!1:{x:c/d,y:u/d}},lli4:function(e,r,n,o){const a=e.x,i=e.y,s=r.x,l=r.y,c=n.x,u=n.y,d=o.x,h=o.y;return Ye.lli8(a,i,s,l,c,u,d,h)},lli:function(e,r){return Ye.lli4(e,e.c,r,r.c)},makeline:function(e,r){return new Ir(e.x,e.y,(e.x+r.x)/2,(e.y+r.y)/2,r.x,r.y)},findbbox:function(e){let r=I9,n=I9,o=z9,a=z9;return e.forEach(function(i){const s=i.bbox();r>s.x.min&&(r=s.x.min),n>s.y.min&&(n=s.y.min),o0&&(d.c1=c,d.c2=u,d.s1=e,d.s2=n,i.push(d))})}),i},makeshape:function(e,r,n){const o=r.points.length,a=e.points.length,i=Ye.makeline(r.points[o-1],e.points[0]),s=Ye.makeline(e.points[a-1],r.points[0]),l={startcap:i,forward:e,back:r,endcap:s,bbox:Ye.findbbox([i,e,r,s])};return l.intersections=function(c){return Ye.shapeintersections(l,l.bbox,c,c.bbox,n)},l},getminmax:function(e,r,n){if(!n)return{min:0,max:0};let o=I9,a=z9,i,s;n.indexOf(0)===-1&&(n=[0].concat(n)),n.indexOf(1)===-1&&n.push(1);for(let l=0,c=n.length;la&&(a=s[r]);return{min:o,mid:(o+a)/2,max:a,size:a-o}},align:function(e,r){const n=r.p1.x,o=r.p1.y,a=-by(r.p2.y-o,r.p2.x-n),i=function(s){return{x:(s.x-n)*ac(a)-(s.y-o)*fm(a),y:(s.x-n)*fm(a)+(s.y-o)*ac(a)}};return e.map(i)},roots:function(e,r){r=r||{p1:{x:0,y:0},p2:{x:1,y:0}};const n=e.length-1,o=Ye.align(e,r),a=function($){return 0<=$&&$<=1};if(n===2){const $=o[0].y,R=o[1].y,M=o[2].y,O=$-2*R+M;if(O!==0){const B=-_u(R*R-$*M),I=-$+R,Y=-(B+I)/O,D=-(-B+I)/O;return[Y,D].filter(a)}else if(R!==M&&O===0)return[(2*R-M)/(2*R-2*M)].filter(a);return[]}const i=o[0].y,s=o[1].y,l=o[2].y,c=o[3].y;let u=-i+3*s-3*l+c,d=3*i-6*s+3*l,h=-3*i+3*s,p=i;if(Ye.approximately(u,0)){if(Ye.approximately(d,0))return Ye.approximately(h,0)?[]:[-p/h].filter(a);const $=_u(h*h-4*d*p),R=2*d;return[($-h)/R,(-h-$)/R].filter(a)}d/=u,h/=u,p/=u;const g=(3*h-d*d)/3,y=g/3,x=(2*d*d*d-9*d*h+27*p)/27,w=x/2,k=w*w+y*y*y;let C,_,T,A,N;if(k<0){const $=-g/3,R=$*$*$,M=_u(R),O=-x/(2*M),B=O<-1?-1:O>1?1:O,I=Wqe(B),Y=vy(M),D=2*Y;return T=D*ac(I/3)-d/3,A=D*ac((I+Sk)/3)-d/3,N=D*ac((I+2*Sk)/3)-d/3,[T,A,N].filter(a)}else{if(k===0)return C=w<0?vy(-w):-vy(w),T=2*C-d/3,A=-C-d/3,[T,A].filter(a);{const $=_u(k);return C=vy(-w+$),_=vy(w+$),[C-_-d/3].filter(a)}}},droots:function(e){if(e.length===3){const r=e[0],n=e[1],o=e[2],a=r-2*n+o;if(a!==0){const i=-_u(n*n-r*o),s=-r+n,l=-(i+s)/a,c=-(-i+s)/a;return[l,c]}else if(n!==o&&a===0)return[(2*n-o)/(2*(n-o))];return[]}if(e.length===2){const r=e[0],n=e[1];return r!==n?[r/(r-n)]:[]}return[]},curvature:function(e,r,n,o,a){let i,s,l,c,u=0,d=0;const h=Ye.compute(e,r),p=Ye.compute(e,n),g=h.x*h.x+h.y*h.y;if(o?(i=_u(mi(h.y*p.z-p.y*h.z,2)+mi(h.z*p.x-p.z*h.x,2)+mi(h.x*p.y-p.x*h.y,2)),s=mi(g+h.z*h.z,3/2)):(i=h.x*p.y-h.y*p.x,s=mi(g,3/2)),i===0||s===0)return{k:0,r:0};if(u=i/s,d=s/i,!a){const y=Ye.curvature(e-.001,r,n,o,!0).k,x=Ye.curvature(e+.001,r,n,o,!0).k;c=(x-u+(u-y))/2,l=(yy(x-u)+yy(u-y))/2}return{k:u,r:d,dk:c,adk:l}},inflections:function(e){if(e.length<4)return[];const r=Ye.align(e,{p1:e[0],p2:e.slice(-1)[0]}),n=r[2].x*r[1].y,o=r[3].x*r[1].y,a=r[1].x*r[2].y,i=r[3].x*r[2].y,s=18*(-3*n+2*o+3*a-i),l=18*(3*n-o-3*a),c=18*(a-n);if(Ye.approximately(s,0)){if(!Ye.approximately(l,0)){let p=-c/l;if(0<=p&&p<=1)return[p]}return[]}const u=2*s;if(Ye.approximately(u,0))return[];const d=l*l-4*s*c;if(d<0)return[];const h=Math.sqrt(d);return[(h-l)/u,-(l+h)/u].filter(function(p){return 0<=p&&p<=1})},bboxoverlap:function(e,r){const n=["x","y"],o=n.length;for(let a=0,i,s,l,c;a=c)return!1;return!0},expandbox:function(e,r){r.x.mine.x.max&&(e.x.max=r.x.max),r.y.max>e.y.max&&(e.y.max=r.y.max),r.z&&r.z.max>e.z.max&&(e.z.max=r.z.max),e.x.mid=(e.x.min+e.x.max)/2,e.y.mid=(e.y.min+e.y.max)/2,e.z&&(e.z.mid=(e.z.min+e.z.max)/2),e.x.size=e.x.max-e.x.min,e.y.size=e.y.max-e.y.min,e.z&&(e.z.size=e.z.max-e.z.min)},pairiteration:function(e,r,n){const o=e.bbox(),a=r.bbox(),i=1e5,s=n||.5;if(o.x.size+o.y.sizeN||N>$)&&(A+=Sk),A>$&&(R=$,$=A,A=R)):$4){if(arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");a=!0}}else if(i!==6&&i!==8&&i!==9&&i!==12&&arguments.length!==1)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");const s=this._3d=!a&&(i===9||i===12)||r&&r[0]&&typeof r[0].z<"u",l=this.points=[];for(let g=0,y=s?3:2;gg+wy(y.y),0)"u"&&(a=.5),a===0)return new Ir(n,n,o);if(a===1)return new Ir(r,n,n);const i=Ir.getABC(2,r,n,o,a);return new Ir(r,i.A,o)}static cubicFromPoints(r,n,o,a,i){typeof a>"u"&&(a=.5);const s=Ir.getABC(3,r,n,o,a);typeof i>"u"&&(i=Ye.dist(n,s.C));const l=i*(1-a)/a,c=Ye.dist(r,o),u=(o.x-r.x)/c,d=(o.y-r.y)/c,h=i*u,p=i*d,g=l*u,y=l*d,x={x:n.x-h,y:n.y-p},w={x:n.x+g,y:n.y+y},k=s.A,C={x:k.x+(x.x-k.x)/(1-a),y:k.y+(x.y-k.y)/(1-a)},_={x:k.x+(w.x-k.x)/a,y:k.y+(w.y-k.y)/a},T={x:r.x+(C.x-r.x)/a,y:r.y+(C.y-r.y)/a},A={x:o.x+(_.x-o.x)/(1-a),y:o.y+(_.y-o.y)/(1-a)};return new Ir(r,T,A,o)}static getUtils(){return Ye}getUtils(){return Ir.getUtils()}static get PolyBezier(){return xy}valueOf(){return this.toString()}toString(){return Ye.pointsToString(this.points)}toSVG(){if(this._3d)return!1;const r=this.points,n=r[0].x,o=r[0].y,a=["M",n,o,this.order===2?"Q":"C"];for(let i=1,s=r.length;i0}length(){return Ye.length(this.derivative.bind(this))}static getABC(r=2,n,o,a,i=.5){const s=Ye.projectionratio(i,r),l=1-s,c={x:s*n.x+l*a.x,y:s*n.y+l*a.y},u=Ye.abcratio(i,r);return{A:{x:o.x+(o.x-c.x)/u,y:o.y+(o.y-c.y)/u},B:o,C:c,S:n,E:a}}getABC(r,n){n=n||this.get(r);let o=this.points[0],a=this.points[this.order];return Ir.getABC(this.order,o,n,a,r)}getLUT(r){if(this.verify(),r=r||100,this._lut.length===r+1)return this._lut;this._lut=[],r++,this._lut=[];for(let n=0,o,a;n1?1:h,p=this.compute(h),p.t=h,p.d=u,p}get(r){return this.compute(r)}point(r){return this.points[r]}compute(r){return this.ratios?Ye.computeWithRatios(r,this.points,this.ratios,this._3d):Ye.compute(r,this.points,this._3d,this.ratios)}raise(){const r=this.points,n=[r[0]],o=r.length;for(let a=1,i,s;a1;){o=[];for(let s=0,l,c=n.length-1;s=0&&s<=1}),n=n.concat(r[o].sort(Ye.numberSort))}).bind(this)),r.values=n.sort(Ye.numberSort).filter(function(o,a){return n.indexOf(o)===a}),r}bbox(){const r=this.extrema(),n={};return this.dims.forEach((function(o){n[o]=Ye.getminmax(this,o,r[o])}).bind(this)),n}overlaps(r){const n=this.bbox(),o=r.bbox();return Ye.bboxoverlap(n,o)}offset(r,n){if(typeof n<"u"){const o=this.get(r),a=this.normal(r),i={c:o,n:a,x:o.x+a.x*n,y:o.y+a.y*n};return this._3d&&(i.z=o.z+a.z*n),i}if(this._linear){const o=this.normal(0),a=this.points.map(function(i){const s={x:i.x+r*o.x,y:i.y+r*o.y};return i.z&&o.z&&(s.z=i.z+r*o.z),s});return[new Ir(a)]}return this.reduce().map(function(o){return o._linear?o.offset(r)[0]:o.scale(r)})}simple(){if(this.order===3){const a=Ye.angle(this.points[0],this.points[3],this.points[1]),i=Ye.angle(this.points[0],this.points[3],this.points[2]);if(a>0&&i<0||a<0&&i>0)return!1}const r=this.normal(0),n=this.normal(1);let o=r.x*n.x+r.y*n.y;return this._3d&&(o+=r.z*n.z),wy(Qqe(o))(1-l/a)*n+l/a*o);return new Ir(this.points.map((s,l)=>({x:s.x+r.x*i[l],y:s.y+r.y*i[l]})))}scale(r){const n=this.order;let o=!1;if(typeof r=="function"&&(o=r),o&&n===2)return this.raise().scale(o);const a=this.clockwise,i=this.points;if(this._linear)return this.translate(this.normal(0),o?o(0):r,o?o(1):r);const s=o?o(0):r,l=o?o(1):r,c=[this.offset(0,10),this.offset(1,10)],u=[],d=Ye.lli4(c[0],c[0].c,c[1],c[1].c);if(!d)throw new Error("cannot scale this curve. Try reducing it first.");return[0,1].forEach(function(h){const p=u[h*n]=Ye.copy(i[h*n]);p.x+=(h?l:s)*c[h].n.x,p.y+=(h?l:s)*c[h].n.y}),o?([0,1].forEach(function(h){if(!(n===2&&h)){var p=i[h+1],g={x:p.x-d.x,y:p.y-d.y},y=o?o((h+1)/n):r;o&&!a&&(y=-y);var x=ky(g.x*g.x+g.y*g.y);g.x/=x,g.y/=x,u[h+1]={x:p.x+y*g.x,y:p.y+y*g.y}}}),new Ir(u)):([0,1].forEach(h=>{if(n===2&&h)return;const p=u[h*n],g=this.derivative(h),y={x:p.x+g.x,y:p.y+g.y};u[h+1]=Ye.lli4(p,y,d,i[h+1])}),new Ir(u))}outline(r,n,o,a){if(n=n===void 0?r:n,this._linear){const A=this.normal(0),N=this.points[0],$=this.points[this.points.length-1];let R,M,O;o===void 0&&(o=r,a=n),R={x:N.x+A.x*r,y:N.y+A.y*r},O={x:$.x+A.x*o,y:$.y+A.y*o},M={x:(R.x+O.x)/2,y:(R.y+O.y)/2};const B=[R,M,O];R={x:N.x-A.x*n,y:N.y-A.y*n},O={x:$.x-A.x*a,y:$.y-A.y*a},M={x:(R.x+O.x)/2,y:(R.y+O.y)/2};const I=[O,M,R],Y=Ye.makeline(I[2],B[0]),D=Ye.makeline(B[2],I[0]),V=[Y,new Ir(B),D,new Ir(I)];return new xy(V)}const i=this.reduce(),s=i.length,l=[];let c=[],u,d=0,h=this.length();const p=typeof o<"u"&&typeof a<"u";function g(A,N,$,R,M){return function(O){const B=R/$,I=(R+M)/$,Y=N-A;return Ye.map(O,0,1,A+B*Y,A+I*Y)}}i.forEach(function(A){const N=A.length();p?(l.push(A.scale(g(r,o,h,d,N))),c.push(A.scale(g(-n,-a,h,d,N)))):(l.push(A.scale(r)),c.push(A.scale(-n))),d+=N}),c=c.map(function(A){return u=A.points,u[3]?A.points=[u[3],u[2],u[1],u[0]]:A.points=[u[2],u[1],u[0]],A}).reverse();const y=l[0].points[0],x=l[s-1].points[l[s-1].points.length-1],w=c[s-1].points[c[s-1].points.length-1],k=c[0].points[0],C=Ye.makeline(w,y),_=Ye.makeline(x,k),T=[C].concat(l).concat([_]).concat(c);return new xy(T)}outlineshapes(r,n,o){n=n||r;const a=this.outline(r,n).curves,i=[];for(let s=1,l=a.length;s1,c.endcap.virtual=s{var l=this.get(s);return Ye.between(l.x,n,a)&&Ye.between(l.y,o,i)})}selfintersects(r){const n=this.reduce(),o=n.length-2,a=[];for(let i=0,s,l,c;i0&&(i=i.concat(l))}),i}arcs(r){return r=r||.5,this._iterate(r,[])}_error(r,n,o,a){const i=(a-o)/4,s=this.get(o+i),l=this.get(a-i),c=Ye.dist(r,n),u=Ye.dist(r,s),d=Ye.dist(r,l);return wy(u-c)+wy(d-c)}_iterate(r,n){let o=0,a=1,i;do{i=0,a=1;let s=this.get(o),l,c,u,d,h=!1,p=!1,g,y=a,x=1;do if(p=h,d=u,y=(o+a)/2,l=this.get(y),c=this.get(a),u=Ye.getccenter(s,l,c),u.interval={start:o,end:a},h=this._error(u,s,o,a)<=r,g=p&&!h,g||(x=a),h){if(a>=1){if(u.interval.end=x=1,d=u,a>1){let w={x:u.x+u.r*Kqe(u.e),y:u.y+u.r*Zqe(u.e)};u.e+=Ye.angle({x:u.x,y:u.y},w,this.get(1))}break}a=a+(a-o)/2}else a=y;while(!g&&i++<100);if(i>=100)break;d=d||u,n.push(d),o=x}while(a<1);return n}}function SQ(e){let[r,...n]=e.points;nt(r,"start should be defined");const o=[];for(;To(n,3);){const[a,i,s,...l]=n,c=new Ir(r[0],r[1],a[0],a[1],i[0],i[1],s[0],s[1]),u=c.inflections();u.length===0&&u.push(.5),u.forEach(d=>{const{x:h,y:p}=c.get(d);o.push({x:Math.round(h),y:Math.round(p)})}),n=l,r=s}return nt(n.length===0,"all points should be consumed"),o}const CQ=(e,r)=>Math.abs(e-r)<3.1;function _y(e,r){const[n,o]=F6(e)?e:[e.x,e.y],[a,i]=F6(r)?r:[r.x,r.y];return CQ(n,a)&&CQ(o,i)}function cn(e){return e.stopPropagation()}function eYe(e){const{width:r,height:n}=Wn(e);return{x:e.internals.positionAbsolute.x+r/2,y:e.internals.positionAbsolute.y+n/2}}function tYe(e){let[r,...n]=e;nt(r,"start should be defined");let o=`M ${r[0]},${r[1]}`;for(;To(n,3);){const[a,i,s,...l]=n;o=o+` C ${a[0]},${a[1]} ${i[0]},${i[1]} ${s[0]},${s[1]}`,n=l}return nt(n.length===0,"all points should be consumed"),o}const Ck=E.forwardRef(({tag:e,cursor:r,className:n,style:o,...a},i)=>{const s=Dze(e);return b.jsxs(Vr,{ref:i,"data-likec4-tag":e,className:Je(Cqe({autoTextColor:nB(s)}),n),...a,style:{cursor:r,...o},children:[b.jsx("span",{children:"#"}),b.jsx("span",{children:e})]})}),rYe=(e,r)=>e.data.width===r.data.width&&ut(e.data.tags,r.data.tags)&&(e.data.hovered??!1)===(r.data.hovered??!1),Ey=E.memo(({id:e,data:{tags:r,width:n,hovered:o=!1}})=>{const{hovered:a,ref:i}=aC(),{hovered:s,ref:l}=aC(),[c,u]=aPe(!1,o?120:300);E.useEffect(()=>{u(w=>w?o||a||s:o&&(a||s))},[a,s,o]);const d=Vqe(),h=d>1.2,p=Wt(),g=w=>{p.send({type:"tag.highlight",tag:w})},y=E.useCallback(()=>{p.send({type:"tag.unhighlight"})},[]);if(!r||r.length===0)return null;const x=Math.max(Math.round(n*d)-10,200);return b.jsxs(b.Fragment,{children:[b.jsx("div",{ref:i,className:Je("likec4-element-tags",Uo({pointerEvents:"all",gap:"1",alignItems:"flex-end",justifyItems:"stretch",position:"absolute",width:"100%",bottom:"0",left:"0",padding:"1",_shapeCylinder:{bottom:"[5px]"},_shapeStorage:{bottom:"[5px]"},_shapeQueue:{bottom:"0",paddingLeft:"[14px]"}})),onClick:cn,children:r.map(w=>b.jsx(Vr,{"data-likec4-tag":w,className:ye({layerStyle:"likec4.tag",flex:"1",display:"flex",alignItems:"center",justifyContent:"center",maxWidth:50,height:5,_whenHovered:{height:12,borderRadius:4,transitionDelay:".08s"},transition:"fast"})},e+"#"+w))}),b.jsx(jU,{isVisible:c,align:"start",position:tt.Bottom,children:b.jsx(xn,{ref:l,css:{gap:"0.5",alignItems:"baseline",flexWrap:"wrap",pb:"sm",translate:"auto",x:"[-8px]",maxWidth:x},children:r.map(w=>b.jsx(Ck,{tag:w,cursor:"pointer",className:ye({userSelect:"none",...h&&{fontSize:"lg",borderRadius:"[4px]",px:"1.5"}}),onClick:k=>{k.stopPropagation(),p.openSearch(`#${w}`)},onMouseEnter:()=>g(w),onMouseLeave:y},w))})})]})},rYe);Ey.displayName="ElementTags";const nYe=E.forwardRef((e,r)=>b.jsx("svg",{height:"24",width:"24",fill:"currentColor",...e,viewBox:"0 0 24 24",ref:r,children:b.jsx("path",{d:"M12 1C5.923 1 1 5.923 1 12c0 4.867 3.149 8.979 7.521 10.436.55.096.756-.233.756-.522 0-.262-.013-1.128-.013-2.049-2.764.509-3.479-.674-3.699-1.292-.124-.317-.66-1.293-1.127-1.554-.385-.207-.936-.715-.014-.729.866-.014 1.485.797 1.691 1.128.99 1.663 2.571 1.196 3.204.907.096-.715.385-1.196.701-1.471-2.448-.275-5.005-1.224-5.005-5.432 0-1.196.426-2.186 1.128-2.956-.111-.275-.496-1.402.11-2.915 0 0 .921-.288 3.024 1.128a10.193 10.193 0 0 1 2.75-.371c.936 0 1.871.123 2.75.371 2.104-1.43 3.025-1.128 3.025-1.128.605 1.513.221 2.64.111 2.915.701.77 1.127 1.747 1.127 2.956 0 4.222-2.571 5.157-5.019 5.432.399.344.743 1.004.743 2.035 0 1.471-.014 2.654-.014 3.025 0 .289.206.632.756.522C19.851 20.979 23 16.854 23 12c0-6.077-4.922-11-11-11Z"})}));/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const oYe=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],TQ=yt("outline","check","Check",oYe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const aYe=[["path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z",key:"svg-0"}],["path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1",key:"svg-1"}]],iYe=yt("outline","copy","Copy",aYe),AQ="https://github.com/",j9=E.forwardRef(({value:e,className:r,...n},o)=>{const a=e.url.includes("://")?e.url:new window.URL(e.url,window.location.href).toString();let i=a.startsWith(AQ);return b.jsx(Gl,{ref:o,variant:"default",radius:"sm",size:"sm",tt:"none",leftSection:e.title?b.jsx(b.Fragment,{children:e.title}):null,rightSection:b.jsx(cW,{value:a,timeout:1500,children:({copy:s,copied:l})=>b.jsx(or,{className:ye({opacity:l?1:.45,transition:"fast",_hover:{opacity:1}}),tabIndex:-1,size:"20",variant:l?"light":"transparent",color:l?"teal":"gray","data-active":l,onClick:c=>{c.stopPropagation(),c.preventDefault(),s()},children:l?b.jsx(TQ,{}):b.jsx(iYe,{stroke:2.5})})}),...n,className:Je(r,"group"),classNames:{root:ye({flexWrap:"nowrap",minHeight:24,maxWidth:500,userSelect:"all",pr:"0",backgroundColor:{base:"transparent",_hover:{base:"mantine.colors.gray[1]",_dark:"mantine.colors.dark[5]"}}}),section:ye({'&:is([data-position="left"])':{color:"mantine.colors.dimmed",userSelect:"none",pointerEvents:"none",_groupHover:{color:"[var(--badge-color)]",opacity:.7}}})},children:b.jsxs(Ql.a,{href:a,target:"_blank",style:{color:"var(--badge-color)",cursor:"pointer"},css:{transition:"fast",opacity:{base:.7,_hover:1},textDecoration:{base:"none",_hover:"underline"}},children:[i&&b.jsx(nYe,{height:"12",width:"12",style:{verticalAlign:"middle",marginRight:"4px"}}),i?a.replace(AQ,""):a]})})});function NQ(){const e=E.useContext(OT);if(!e)throw new Error("No LikeC4ViewModel in context found");return e}const Tk="--_blur",Ak="--_opacity",sYe=ye({boxSizing:"border-box",margin:"0",padding:"0",position:"fixed",inset:"0",width:"100vw",height:"100vh",maxWidth:"100vw",maxHeight:"100vh",background:"transparent",border:"transparent",_backdrop:{backdropFilter:"auto",backdropBlur:`var(${Tk})`,backgroundColor:`[rgb(36 36 36 / var(${Ak}, 5%))]`}}),lYe=ye({position:"absolute",pointerEvents:"all",display:"flex",flexDirection:"column",padding:"4",gap:"lg",justifyContent:"stretch",color:"mantine.colors.text",backgroundColor:{base:"mantine.colors.body",_dark:"mantine.colors.dark[6]"},boxShadow:"md",overflow:"hidden",border:"none",backgroundImage:`
- linear-gradient(180deg,
- color-mix(in srgb, var(--likec4-palette-fill) 60%, transparent),
- color-mix(in srgb, var(--likec4-palette-fill) 20%, transparent) 8px,
- color-mix(in srgb, var(--likec4-palette-fill) 14%, transparent) 20px,
- transparent 80px
- ),
- linear-gradient(180deg, var(--likec4-palette-fill), var(--likec4-palette-fill) 4px, transparent 4px)
- `,"& .react-flow__attribution":{display:"none"}}),cYe=ye({flex:0,cursor:"move"}),uYe=ye({display:"block",fontFamily:"likec4.element",fontOpticalSizing:"auto",fontStyle:"normal",fontWeight:600,fontSize:"24px",lineHeight:"xs"}),B9="40px",dYe=ye({flex:`0 0 ${B9}`,height:B9,width:B9,display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"flex-start",cursor:"move",_dark:{mixBlendMode:"hard-light"},"& :where(svg, img)":{width:"100%",height:"auto",maxHeight:"100%",pointerEvents:"none",filter:`
- drop-shadow(0 0 3px rgb(0 0 0 / 10%))
- drop-shadow(0 1px 8px rgb(0 0 0 / 5%))
- drop-shadow(1px 1px 16px rgb(0 0 0 / 2%))
- `},"& img":{objectFit:"contain"}}),Nk="--view-title-color",Rk="--icon-color",hYe=ye({width:"100%",background:"mantine.colors.body",borderRadius:"sm",padding:"[10px 8px]",transition:"fast",border:"1px dashed",borderColor:"mantine.colors.defaultBorder",[Nk]:"{colors.mantine.colors.dark[1]}",_hover:{background:"mantine.colors.defaultHover",[Rk]:"{colors.mantine.colors.dark[1]}",[Nk]:"{colors.mantine.colors.defaultColor}"},_dark:{background:"mantine.colors.dark[6]"},_light:{[Rk]:"{colors.mantine.colors.gray[6]}",[Nk]:"{colors.mantine.colors.gray[7]}",_hover:{[Rk]:"{colors.mantine.colors.gray[7]}"}},"& .mantine-ThemeIcon-root":{transition:"fast",color:`[var(${Rk}, {colors.mantine.colors.dark[2]})]`,"--ti-size":"22px",_hover:{color:"mantine.colors.defaultColor"}},"& > *":{transition:"all 130ms {easings.inOut}"},"&:hover > *":{transitionTimingFunction:"out",transform:"translateX(1.6px)"}}),fYe=ye({transition:"fast",color:`[var(${Nk}, {colors.mantine.colors.gray[7]})]`,fontSize:"15px",fontWeight:500,lineHeight:"1.4"}),pYe=ye({flex:1,display:"flex",flexDirection:"column",justifyContent:"stretch",overflow:"hidden",gap:"sm"}),mYe=ye({background:"mantine.colors.gray[1]",borderRadius:"sm",flexWrap:"nowrap",gap:"1.5",padding:"1",_dark:{background:"mantine.colors.dark[7]"}}),gYe=ye({fontSize:"xs",fontWeight:500,flexGrow:1,padding:"[6px 8px]",transition:"fast",borderRadius:"sm",color:"mantine.colors.gray[7]",_hover:{transitionTimingFunction:"out",color:"mantine.colors.defaultColor",background:"mantine.colors.gray[3]"},"&[data-active]":{transition:"none",background:"mantine.colors.white",shadow:"xs",color:"mantine.colors.defaultColor"},_dark:{color:"mantine.colors.dark[1]",_hover:{color:"mantine.colors.white",background:"mantine.colors.dark[6]"},"&:is([data-active])":{color:"mantine.colors.white",background:"mantine.colors.dark[5]"}}}),yYe=ye({flex:1,overflow:"hidden",position:"relative","&:not(:has(.mantine-ScrollArea-root))":{paddingLeft:"1",paddingRight:"1"},"& .mantine-ScrollArea-root":{width:"100%",height:"100%","& > div":{paddingLeft:"1",paddingRight:"1"}}}),bYe=ye({flex:1,display:"grid",gridTemplateColumns:"min-content 1fr",gridAutoRows:"min-content max-content",gap:"[24px 20px]",alignItems:"baseline",justifyItems:"stretch"}),vYe=ye({justifySelf:"end",textAlign:"right",userSelect:"none"}),xYe=ye({position:"absolute",width:"14px",height:"14px",border:"3.5px solid",borderColor:"mantine.colors.dark[3]",borderTop:"none",borderLeft:"none",borderRadius:"2px",bottom:"0.5",right:"0.5",transition:"fast",cursor:"se-resize",_hover:{borderWidth:"4px",borderColor:"mantine.colors.dark[1]"}}),wYe=ye({"&[data-level='1']":{marginBottom:"sm"}}),kYe=ye({cursor:"default",marginTop:"0",marginBottom:"0"}),RQ=ye({transition:"fast",color:"mantine.colors.gray[7]",_dark:{color:"mantine.colors.dark[1]"},"& > *":{transition:"fast"},_hover:{transitionTimingFunction:"out","& > :not([data-no-transform])":{transitionTimingFunction:"out",transform:"translateX(1px)"}}}),_Ye=Je(RQ),EYe=Je(RQ,ye({cursor:"pointer",width:"100%",justifyContent:"stretch",flexWrap:"nowrap",height:"36px",paddingInlineStart:"[16px]",paddingInlineEnd:"2.5",borderRadius:"sm",alignItems:"center",color:"mantine.colors.gray[7]",_dark:{color:"mantine.colors.gray.lightColor"},_hover:{background:"mantine.colors.gray.lightHover"},"& .tabler-icon":{transition:"fast",width:"90%",opacity:.65}}));/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const SYe=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 9h.01",key:"svg-1"}],["path",{d:"M11 12h1v4h1",key:"svg-2"}]],F9=yt("outline","info-circle","InfoCircle",SYe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const CYe=[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M12 12m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0",key:"svg-1"}],["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-2"}]],TYe=yt("outline","target","Target",CYe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const AYe=[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M8 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-4"}],["path",{d:"M16 16l-2.5 -2.5",key:"svg-5"}]],gi=yt("outline","zoom-scan","ZoomScan",AYe),NYe=({node:e})=>b.jsxs(Ur,{className:_Ye,gap:6,align:"baseline",wrap:"nowrap",children:[b.jsxs(wt,{component:"div",fz:11,c:"dimmed",children:[e.kind,":"]}),b.jsx(wt,{component:"div",fz:"sm",fw:"500",children:e.title})]}),RYe=({instance:e})=>{const r=Wt(),n=r.currentView.id,o=[...e.views()];return b.jsxs(Ur,{className:EYe,gap:4,children:[b.jsx(ci,{color:"gray",variant:"transparent",size:"xs",flex:0,children:b.jsx(TYe,{stroke:1.2})}),b.jsx(wt,{component:"div",fz:"sm",fw:"500",flex:"1 1 100%",children:e.title}),b.jsxs(Se,{onClick:cn,pos:"relative","data-no-transform":!0,flex:0,children:[o.length===0&&b.jsx(Zn,{size:"compact-xs",variant:"transparent",color:"gray",disabled:!0,children:"no views"}),o.length>0&&b.jsxs(fo,{shadow:"md",withinPortal:!1,position:"bottom-start",offset:0,closeOnClickOutside:!0,clickOutsideEvents:["pointerdown","mousedown","click"],closeOnEscape:!0,trapFocus:!0,children:[b.jsx(fo.Target,{children:b.jsxs(Zn,{size:"compact-xs",variant:"subtle",color:"gray",children:[o.length," view",o.length>1?"s":""]})}),b.jsx(fo.Dropdown,{children:o.map(a=>b.jsx(fo.Item,{px:"xs",py:4,disabled:a.id===n,leftSection:b.jsx(ci,{size:"sm",variant:"transparent",color:"gray",children:b.jsx(gi,{stroke:1.8,opacity:.65})}),styles:{itemSection:{marginInlineEnd:Ne(8)}},onClick:i=>{i.stopPropagation(),r.navigateTo(a.id)},children:a.title},a.id))})]})]})]})},$Ye=()=>{},PYe=E.memo(({elementFqn:e})=>{const r=Ho().element(e),n=[...r.deployments()],o=Y1({multiple:!1});o.setHoveredNode=$Ye;const a=E.useMemo(()=>{let i=[],s=new Map;for(const l of r.deployments()){let c={label:b.jsx(RYe,{instance:l}),value:l.id,type:"instance",children:[]};s.set(l.id,c);let u=l.parent;for(;u;){let d=s.get(u.id);if(d){d.children.push(c);break}d={label:b.jsx(NYe,{node:u}),value:u.id,type:"node",children:[c]},s.set(u.id,d),c=d,u=u.parent}!u&&!i.includes(c)&&i.push(c)}return i},[r]);return E.useEffect(()=>{o.expandAllNodes()},[a]),n.length===0?b.jsx(M3,{variant:"light",color:"gray",icon:b.jsx(F9,{}),children:"This element does not have any deployments"}):b.jsx(Bp,{levelOffset:"sm",allowRangeSelection:!1,classNames:{node:wYe,label:kYe},styles:{root:{position:"relative",width:"min-content",minWidth:300}},data:a,tree:o,renderNode:({node:i,selected:s,elementProps:l,hasChildren:c})=>b.jsx(Se,{...l,style:{...!c&&{marginBottom:Ne(4)}},children:c?b.jsx(Zn,{fullWidth:!0,color:"gray",variant:s?"transparent":"subtle",size:"xs",justify:"flex-start",styles:{root:{position:"unset",paddingInlineStart:Ne(16)}},children:i.label}):i.label})})}),MYe=()=>{},$Q=(e,r)=>{if(e===r)return!0;if(e.length!==r.length)return!1;for(const[n,o]of e.entries())if(o!==r[n]&&!Xn(o,r[n]))return!1;return!0};function $k(e,r,n,o){const a=FB();BB(a?MYe:e,r,$Q,o)}function OYe(){const e=typeof window<"u"&&typeof window.devicePixelRatio=="number"?window.devicePixelRatio:1;return Ki(Math.floor(e),{min:1,max:4})}let Pk;function yi(e){return Pk??=OYe(),Pk<2?Math.round(e):Math.round(e*Pk)/Pk}function DYe(e){switch(e){case"dots":return Gi.Dots;case"lines":return Gi.Lines;case"cross":return Gi.Cross;default:Ga(e)}}function LYe({background:e}){return typeof e=="string"?b.jsx(LU,{variant:DYe(e),size:2,gap:20}):b.jsx(LU,{...e})}const ds={Compound:1,Edge:20,Element:20,Max:30},hs=.05,H9=3,Mk={default:"16px",withControls:{top:"50px",left:"16px",right:"16px",bottom:"16px"}},PQ=(e,r)=>(e.data.dimmed??!1)===r?e:{...e,data:{...e.data,dimmed:r}};function IYe(e,r){return r!==void 0?PQ(e,r):n=>PQ(n,e)}const MQ=(e,r)=>(e.data.hovered??!1)===r?e:{...e,data:{...e.data,hovered:r}};function zYe(e,r){return r!==void 0?MQ(e,r):n=>MQ(n,e)}function OQ(e,r){return DRe(e.data,r)?e:{...e,data:{...e.data,...r}}}function jYe(e,r){return r!==void 0?OQ(e,r):n=>OQ(n,e)}const Jt={setDimmed:IYe,setHovered:zYe,setData:jYe};function U9({nodes:e,edges:r,onEdgesChange:n,onNodesChange:o,className:a,pannable:i=!0,zoomable:s=!0,nodesSelectable:l=!0,nodesDraggable:c=!1,background:u="dots",children:d,colorMode:h,fitViewPadding:p=0,fitView:g=!0,zoomOnDoubleClick:y=!1,onViewportResize:x,onMoveEnd:w,onNodeMouseEnter:k,onNodeMouseLeave:C,onEdgeMouseEnter:_,onEdgeMouseLeave:T,...A}){const N=u!=="transparent"&&u!=="solid",$=Yqe(),R=L9(),{colorScheme:M}=SMe();return h||(h=M==="auto"?"system":M),b.jsxs(Y7e,{colorMode:h,nodes:e,edges:r,className:Je(u==="transparent"&&"bg-transparent",a),...$&&{"data-likec4-zoom-small":!0},zoomOnPinch:s,zoomOnScroll:!i&&s,...!s&&{zoomActivationKeyCode:null},zoomOnDoubleClick:y,maxZoom:s?H9:1,minZoom:s?hs:1,fitView:g,fitViewOptions:{minZoom:hs,maxZoom:1,padding:p,includeHiddenNodes:!1},preventScrolling:s||i,defaultMarkerColor:"var(--xy-edge-stroke)",noDragClassName:"nodrag",noPanClassName:"nopan",noWheelClassName:"nowheel",panOnScroll:i,panOnDrag:i,...!i&&{panActivationKeyCode:null,selectionKeyCode:null},elementsSelectable:l,nodesFocusable:c||l,edgesFocusable:!1,nodesDraggable:c,nodeDragThreshold:4,nodeClickDistance:3,paneClickDistance:3,elevateNodesOnSelect:!1,selectNodesOnDrag:!1,onNodesChange:o,onEdgesChange:n,onMoveEnd:it((O,{x:B,y:I,zoom:Y})=>{const D=yi(B),V=yi(I);(B!==D||I!==V)&&R.setState({transform:[D,V,Y]}),w?.(O,{x:D,y:V,zoom:Y})}),onNodeMouseEnter:it((O,B)=>{if(k){k(O,B);return}B.data.hovered||o([{id:B.id,type:"replace",item:Jt.setHovered(B,!0)}])}),onNodeMouseLeave:it((O,B)=>{if(C){C(O,B);return}B.data.hovered&&o([{id:B.id,type:"replace",item:Jt.setHovered(B,!1)}])}),onEdgeMouseEnter:it((O,B)=>{if(_){_(O,B);return}B.data.hovered||n([{id:B.id,type:"replace",item:Jt.setHovered(B,!0)}])}),onEdgeMouseLeave:it((O,B)=>{if(T){T(O,B);return}B.data.hovered&&n([{id:B.id,type:"replace",item:Jt.setHovered(B,!1)}])}),onNodeDoubleClick:cn,onEdgeDoubleClick:cn,...A,children:[N&&b.jsx(LYe,{background:u}),x&&b.jsx(FYe,{onViewportResize:x}),d]})}const BYe=({width:e,height:r})=>(e||1)*(r||1),FYe=({onViewportResize:e})=>{const r=At(BYe);return $k(e,[r]),null},DQ=E.createContext(null);function LQ(){return mt(E.useContext(DQ),"No RelationshipsBrowserActorContext")}function Ok(e,r=Xn){const n=LQ();return wn(n,it(e),r)}function Sy(){const e=LQ();return E.useMemo(()=>({actor:e,get rootElementId(){return`relationships-browser-${e.sessionId.replaceAll(":","_")}`},getState:()=>e.getSnapshot().context,send:e.send,updateView:r=>{e.send({type:"update.view",layouted:r})},changeScope:r=>{e.send({type:"change.scope",scope:r})},navigateTo:(r,n)=>{e.send({type:"navigate.to",subject:r,fromNode:n})},fitDiagram:()=>{e.send({type:"fitDiagram"})},close:()=>{e._parent?e._parent?.send({type:"close",actorId:e.id}):e.send({type:"close"})}}),[e])}var V9,IQ;function q9(){if(IQ)return V9;IQ=1;var e="\0",r="\0",n="";class o{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(d){d&&(this._isDirected=Object.hasOwn(d,"directed")?d.directed:!0,this._isMultigraph=Object.hasOwn(d,"multigraph")?d.multigraph:!1,this._isCompound=Object.hasOwn(d,"compound")?d.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[r]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(d){return this._label=d,this}graph(){return this._label}setDefaultNodeLabel(d){return this._defaultNodeLabelFn=d,typeof d!="function"&&(this._defaultNodeLabelFn=()=>d),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var d=this;return this.nodes().filter(h=>Object.keys(d._in[h]).length===0)}sinks(){var d=this;return this.nodes().filter(h=>Object.keys(d._out[h]).length===0)}setNodes(d,h){var p=arguments,g=this;return d.forEach(function(y){p.length>1?g.setNode(y,h):g.setNode(y)}),this}setNode(d,h){return Object.hasOwn(this._nodes,d)?(arguments.length>1&&(this._nodes[d]=h),this):(this._nodes[d]=arguments.length>1?h:this._defaultNodeLabelFn(d),this._isCompound&&(this._parent[d]=r,this._children[d]={},this._children[r][d]=!0),this._in[d]={},this._preds[d]={},this._out[d]={},this._sucs[d]={},++this._nodeCount,this)}node(d){return this._nodes[d]}hasNode(d){return Object.hasOwn(this._nodes,d)}removeNode(d){var h=this;if(Object.hasOwn(this._nodes,d)){var p=g=>h.removeEdge(h._edgeObjs[g]);delete this._nodes[d],this._isCompound&&(this._removeFromParentsChildList(d),delete this._parent[d],this.children(d).forEach(function(g){h.setParent(g)}),delete this._children[d]),Object.keys(this._in[d]).forEach(p),delete this._in[d],delete this._preds[d],Object.keys(this._out[d]).forEach(p),delete this._out[d],delete this._sucs[d],--this._nodeCount}return this}setParent(d,h){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(h===void 0)h=r;else{h+="";for(var p=h;p!==void 0;p=this.parent(p))if(p===d)throw new Error("Setting "+h+" as parent of "+d+" would create a cycle");this.setNode(h)}return this.setNode(d),this._removeFromParentsChildList(d),this._parent[d]=h,this._children[h][d]=!0,this}_removeFromParentsChildList(d){delete this._children[this._parent[d]][d]}parent(d){if(this._isCompound){var h=this._parent[d];if(h!==r)return h}}children(d=r){if(this._isCompound){var h=this._children[d];if(h)return Object.keys(h)}else{if(d===r)return this.nodes();if(this.hasNode(d))return[]}}predecessors(d){var h=this._preds[d];if(h)return Object.keys(h)}successors(d){var h=this._sucs[d];if(h)return Object.keys(h)}neighbors(d){var h=this.predecessors(d);if(h){const g=new Set(h);for(var p of this.successors(d))g.add(p);return Array.from(g.values())}}isLeaf(d){var h;return this.isDirected()?h=this.successors(d):h=this.neighbors(d),h.length===0}filterNodes(d){var h=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});h.setGraph(this.graph());var p=this;Object.entries(this._nodes).forEach(function([x,w]){d(x)&&h.setNode(x,w)}),Object.values(this._edgeObjs).forEach(function(x){h.hasNode(x.v)&&h.hasNode(x.w)&&h.setEdge(x,p.edge(x))});var g={};function y(x){var w=p.parent(x);return w===void 0||h.hasNode(w)?(g[x]=w,w):w in g?g[w]:y(w)}return this._isCompound&&h.nodes().forEach(x=>h.setParent(x,y(x))),h}setDefaultEdgeLabel(d){return this._defaultEdgeLabelFn=d,typeof d!="function"&&(this._defaultEdgeLabelFn=()=>d),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(d,h){var p=this,g=arguments;return d.reduce(function(y,x){return g.length>1?p.setEdge(y,x,h):p.setEdge(y,x),x}),this}setEdge(){var d,h,p,g,y=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(d=x.v,h=x.w,p=x.name,arguments.length===2&&(g=arguments[1],y=!0)):(d=x,h=arguments[1],p=arguments[3],arguments.length>2&&(g=arguments[2],y=!0)),d=""+d,h=""+h,p!==void 0&&(p=""+p);var w=s(this._isDirected,d,h,p);if(Object.hasOwn(this._edgeLabels,w))return y&&(this._edgeLabels[w]=g),this;if(p!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(d),this.setNode(h),this._edgeLabels[w]=y?g:this._defaultEdgeLabelFn(d,h,p);var k=l(this._isDirected,d,h,p);return d=k.v,h=k.w,Object.freeze(k),this._edgeObjs[w]=k,a(this._preds[h],d),a(this._sucs[d],h),this._in[h][w]=k,this._out[d][w]=k,this._edgeCount++,this}edge(d,h,p){var g=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,d,h,p);return this._edgeLabels[g]}edgeAsObj(){const d=this.edge(...arguments);return typeof d!="object"?{label:d}:d}hasEdge(d,h,p){var g=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,d,h,p);return Object.hasOwn(this._edgeLabels,g)}removeEdge(d,h,p){var g=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,d,h,p),y=this._edgeObjs[g];return y&&(d=y.v,h=y.w,delete this._edgeLabels[g],delete this._edgeObjs[g],i(this._preds[h],d),i(this._sucs[d],h),delete this._in[h][g],delete this._out[d][g],this._edgeCount--),this}inEdges(d,h){var p=this._in[d];if(p){var g=Object.values(p);return h?g.filter(y=>y.v===h):g}}outEdges(d,h){var p=this._out[d];if(p){var g=Object.values(p);return h?g.filter(y=>y.w===h):g}}nodeEdges(d,h){var p=this.inEdges(d,h);if(p)return p.concat(this.outEdges(d,h))}}function a(u,d){u[d]?u[d]++:u[d]=1}function i(u,d){--u[d]||delete u[d]}function s(u,d,h,p){var g=""+d,y=""+h;if(!u&&g>y){var x=g;g=y,y=x}return g+n+y+n+(p===void 0?e:p)}function l(u,d,h,p){var g=""+d,y=""+h;if(!u&&g>y){var x=g;g=y,y=x}var w={v:g,w:y};return p&&(w.name=p),w}function c(u,d){return s(u,d.v,d.w,d.name)}return V9=o,V9}var zQ,jQ;function HYe(){return jQ||(jQ=1,zQ="2.2.4"),zQ}var BQ,FQ;function UYe(){return FQ||(FQ=1,BQ={Graph:q9(),version:HYe()}),BQ}var Y9,HQ;function VYe(){if(HQ)return Y9;HQ=1;var e=q9();Y9={write:r,read:a};function r(i){var s={options:{directed:i.isDirected(),multigraph:i.isMultigraph(),compound:i.isCompound()},nodes:n(i),edges:o(i)};return i.graph()!==void 0&&(s.value=structuredClone(i.graph())),s}function n(i){return i.nodes().map(function(s){var l=i.node(s),c=i.parent(s),u={v:s};return l!==void 0&&(u.value=l),c!==void 0&&(u.parent=c),u})}function o(i){return i.edges().map(function(s){var l=i.edge(s),c={v:s.v,w:s.w};return s.name!==void 0&&(c.name=s.name),l!==void 0&&(c.value=l),c})}function a(i){var s=new e(i.options).setGraph(i.value);return i.nodes.forEach(function(l){s.setNode(l.v,l.value),l.parent&&s.setParent(l.v,l.parent)}),i.edges.forEach(function(l){s.setEdge({v:l.v,w:l.w,name:l.name},l.value)}),s}return Y9}var W9,UQ;function qYe(){if(UQ)return W9;UQ=1,W9=e;function e(r){var n={},o=[],a;function i(s){Object.hasOwn(n,s)||(n[s]=!0,a.push(s),r.successors(s).forEach(i),r.predecessors(s).forEach(i))}return r.nodes().forEach(function(s){a=[],i(s),a.length&&o.push(a)}),o}return W9}var X9,VQ;function qQ(){if(VQ)return X9;VQ=1;class e{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(n){return n.key})}has(n){return Object.hasOwn(this._keyIndices,n)}priority(n){var o=this._keyIndices[n];if(o!==void 0)return this._arr[o].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(n,o){var a=this._keyIndices;if(n=String(n),!Object.hasOwn(a,n)){var i=this._arr,s=i.length;return a[n]=s,i.push({key:n,priority:o}),this._decrease(s),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key}decrease(n,o){var a=this._keyIndices[n];if(o>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+o);this._arr[a].priority=o,this._decrease(a)}_heapify(n){var o=this._arr,a=2*n,i=a+1,s=n;a>1,!(o[i].priority1;function n(a,i,s,l){return o(a,String(i),s||r,l||function(c){return a.outEdges(c)})}function o(a,i,s,l){var c={},u=new e,d,h,p=function(g){var y=g.v!==d?g.v:g.w,x=c[y],w=s(g),k=h.distance+w;if(w<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+g+" Weight: "+w);k0&&(d=u.removeMin(),h=c[d],h.distance!==Number.POSITIVE_INFINITY);)l(d).forEach(p);return c}return G9}var K9,XQ;function YYe(){if(XQ)return K9;XQ=1;var e=WQ();K9=r;function r(n,o,a){return n.nodes().reduce(function(i,s){return i[s]=e(n,s,o,a),i},{})}return K9}var Z9,GQ;function KQ(){if(GQ)return Z9;GQ=1,Z9=e;function e(r){var n=0,o=[],a={},i=[];function s(l){var c=a[l]={onStack:!0,lowlink:n,index:n++};if(o.push(l),r.successors(l).forEach(function(h){Object.hasOwn(a,h)?a[h].onStack&&(c.lowlink=Math.min(c.lowlink,a[h].index)):(s(h),c.lowlink=Math.min(c.lowlink,a[h].lowlink))}),c.lowlink===c.index){var u=[],d;do d=o.pop(),a[d].onStack=!1,u.push(d);while(l!==d);i.push(u)}}return r.nodes().forEach(function(l){Object.hasOwn(a,l)||s(l)}),i}return Z9}var Q9,ZQ;function WYe(){if(ZQ)return Q9;ZQ=1;var e=KQ();Q9=r;function r(n){return e(n).filter(function(o){return o.length>1||o.length===1&&n.hasEdge(o[0],o[0])})}return Q9}var J9,QQ;function XYe(){if(QQ)return J9;QQ=1,J9=r;var e=()=>1;function r(o,a,i){return n(o,a||e,i||function(s){return o.outEdges(s)})}function n(o,a,i){var s={},l=o.nodes();return l.forEach(function(c){s[c]={},s[c][c]={distance:0},l.forEach(function(u){c!==u&&(s[c][u]={distance:Number.POSITIVE_INFINITY})}),i(c).forEach(function(u){var d=u.v===c?u.w:u.v,h=a(u);s[c][d]={distance:h,predecessor:c}})}),l.forEach(function(c){var u=s[c];l.forEach(function(d){var h=s[d];l.forEach(function(p){var g=h[c],y=u[p],x=h[p],w=g.distance+y.distance;wa.successors(h):h=>a.neighbors(h),c=s==="post"?r:n,u=[],d={};return i.forEach(h=>{if(!a.hasNode(h))throw new Error("Graph does not have node: "+h);c(h,l,d,u)}),u}function r(a,i,s,l){for(var c=[[a,!1]];c.length>0;){var u=c.pop();u[1]?l.push(u[0]):Object.hasOwn(s,u[0])||(s[u[0]]=!0,c.push([u[0],!0]),o(i(u[0]),d=>c.push([d,!1])))}}function n(a,i,s,l){for(var c=[a];c.length>0;){var u=c.pop();Object.hasOwn(s,u)||(s[u]=!0,l.push(u),o(i(u),d=>c.push(d)))}}function o(a,i){for(var s=a.length;s--;)i(a[s],s,a);return a}return rA}var nA,oJ;function KYe(){if(oJ)return nA;oJ=1;var e=nJ();nA=r;function r(n,o){return e(n,o,"post")}return nA}var oA,aJ;function ZYe(){if(aJ)return oA;aJ=1;var e=nJ();oA=r;function r(n,o){return e(n,o,"pre")}return oA}var aA,iJ;function QYe(){if(iJ)return aA;iJ=1;var e=q9(),r=qQ();aA=n;function n(o,a){var i=new e,s={},l=new r,c;function u(h){var p=h.v===c?h.w:h.v,g=l.priority(p);if(g!==void 0){var y=a(h);y0;){if(c=l.removeMin(),Object.hasOwn(s,c))i.setEdge(c,s[c]);else{if(d)throw new Error("Input graph is not connected: "+o);d=!0}o.nodeEdges(c).forEach(u)}return i}return aA}var sJ,lJ;function JYe(){return lJ||(lJ=1,sJ={components:qYe(),dijkstra:WQ(),dijkstraAll:YYe(),findCycles:WYe(),floydWarshall:XYe(),isAcyclic:GYe(),postorder:KYe(),preorder:ZYe(),prim:QYe(),tarjan:KQ(),topsort:eJ()}),sJ}var iA,cJ;function fs(){if(cJ)return iA;cJ=1;var e=UYe();return iA={Graph:e.Graph,json:VYe(),alg:JYe(),version:e.version},iA}var sA,uJ;function eWe(){if(uJ)return sA;uJ=1;class e{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,i=a._prev;if(i!==a)return r(i),i}enqueue(a){let i=this._sentinel;a._prev&&a._next&&r(a),a._next=i._next,i._next._prev=a,i._next=a,a._prev=i}toString(){let a=[],i=this._sentinel,s=i._prev;for(;s!==i;)a.push(JSON.stringify(s,n)),s=s._prev;return"["+a.join(", ")+"]"}}function r(o){o._prev._next=o._next,o._next._prev=o._prev,delete o._next,delete o._prev}function n(o,a){if(o!=="_next"&&o!=="_prev")return a}return sA=e,sA}var lA,dJ;function tWe(){if(dJ)return lA;dJ=1;let e=fs().Graph,r=eWe();lA=o;let n=()=>1;function o(u,d){if(u.nodeCount()<=1)return[];let h=s(u,d||n);return a(h.graph,h.buckets,h.zeroIdx).flatMap(p=>u.outEdges(p.v,p.w))}function a(u,d,h){let p=[],g=d[d.length-1],y=d[0],x;for(;u.nodeCount();){for(;x=y.dequeue();)i(u,d,h,x);for(;x=g.dequeue();)i(u,d,h,x);if(u.nodeCount()){for(let w=d.length-2;w>0;--w)if(x=d[w].dequeue(),x){p=p.concat(i(u,d,h,x,!0));break}}}return p}function i(u,d,h,p,g){let y=g?[]:void 0;return u.inEdges(p.v).forEach(x=>{let w=u.edge(x),k=u.node(x.v);g&&y.push({v:x.v,w:x.w}),k.out-=w,l(d,h,k)}),u.outEdges(p.v).forEach(x=>{let w=u.edge(x),k=x.w,C=u.node(k);C.in-=w,l(d,h,C)}),u.removeNode(p.v),y}function s(u,d){let h=new e,p=0,g=0;u.nodes().forEach(w=>{h.setNode(w,{v:w,in:0,out:0})}),u.edges().forEach(w=>{let k=h.edge(w.v,w.w)||0,C=d(w),_=k+C;h.setEdge(w.v,w.w,_),g=Math.max(g,h.node(w.v).out+=C),p=Math.max(p,h.node(w.w).in+=C)});let y=c(g+p+3).map(()=>new r),x=p+1;return h.nodes().forEach(w=>{l(y,x,h.node(w))}),{graph:h,buckets:y,zeroIdx:x}}function l(u,d,h){h.out?h.in?u[h.out-h.in+d].enqueue(h):u[u.length-1].enqueue(h):u[0].enqueue(h)}function c(u){const d=[];for(let h=0;hM.setNode(O,R.node(O))),R.edges().forEach(O=>{let B=M.edge(O.v,O.w)||{weight:0,minlen:1},I=R.edge(O);M.setEdge(O.v,O.w,{weight:B.weight+I.weight,minlen:Math.max(B.minlen,I.minlen)})}),M}function o(R){let M=new e({multigraph:R.isMultigraph()}).setGraph(R.graph());return R.nodes().forEach(O=>{R.children(O).length||M.setNode(O,R.node(O))}),R.edges().forEach(O=>{M.setEdge(O,R.edge(O))}),M}function a(R){let M=R.nodes().map(O=>{let B={};return R.outEdges(O).forEach(I=>{B[I.w]=(B[I.w]||0)+R.edge(I).weight}),B});return $(R.nodes(),M)}function i(R){let M=R.nodes().map(O=>{let B={};return R.inEdges(O).forEach(I=>{B[I.v]=(B[I.v]||0)+R.edge(I).weight}),B});return $(R.nodes(),M)}function s(R,M){let O=R.x,B=R.y,I=M.x-O,Y=M.y-B,D=R.width/2,V=R.height/2;if(!I&&!Y)throw new Error("Not possible to find intersection inside of the rectangle");let L,U;return Math.abs(Y)*D>Math.abs(I)*V?(Y<0&&(V=-V),L=V*I/Y,U=V):(I<0&&(D=-D),L=D,U=D*Y/I),{x:O+L,y:B+U}}function l(R){let M=T(y(R)+1).map(()=>[]);return R.nodes().forEach(O=>{let B=R.node(O),I=B.rank;I!==void 0&&(M[I][B.order]=O)}),M}function c(R){let M=R.nodes().map(B=>{let I=R.node(B).rank;return I===void 0?Number.MAX_VALUE:I}),O=g(Math.min,M);R.nodes().forEach(B=>{let I=R.node(B);Object.hasOwn(I,"rank")&&(I.rank-=O)})}function u(R){let M=R.nodes().map(D=>R.node(D).rank),O=g(Math.min,M),B=[];R.nodes().forEach(D=>{let V=R.node(D).rank-O;B[V]||(B[V]=[]),B[V].push(D)});let I=0,Y=R.graph().nodeRankFactor;Array.from(B).forEach((D,V)=>{D===void 0&&V%Y!==0?--I:D!==void 0&&I&&D.forEach(L=>R.node(L).rank+=I)})}function d(R,M,O,B){let I={width:0,height:0};return arguments.length>=4&&(I.rank=O,I.order=B),r(R,"border",I,M)}function h(R,M=p){const O=[];for(let B=0;Bp){const O=h(M);return R.apply(null,O.map(B=>R.apply(null,B)))}else return R.apply(null,M)}function y(R){const M=R.nodes().map(O=>{let B=R.node(O).rank;return B===void 0?Number.MIN_VALUE:B});return g(Math.max,M)}function x(R,M){let O={lhs:[],rhs:[]};return R.forEach(B=>{M(B)?O.lhs.push(B):O.rhs.push(B)}),O}function w(R,M){let O=Date.now();try{return M()}finally{console.log(R+" time: "+(Date.now()-O)+"ms")}}function k(R,M){return M()}let C=0;function _(R){var M=++C;return R+(""+M)}function T(R,M,O=1){M==null&&(M=R,R=0);let B=Y=>YMB[M]),Object.entries(R).reduce((B,[I,Y])=>(B[I]=O(Y,I),B),{})}function $(R,M){return R.reduce((O,B,I)=>(O[B]=M[I],O),{})}return cA}var uA,fJ;function rWe(){if(fJ)return uA;fJ=1;let e=tWe(),r=_n().uniqueId;uA={run:n,undo:a};function n(i){(i.graph().acyclicer==="greedy"?e(i,s(i)):o(i)).forEach(l=>{let c=i.edge(l);i.removeEdge(l),c.forwardName=l.name,c.reversed=!0,i.setEdge(l.w,l.v,c,r("rev"))});function s(l){return c=>l.edge(c).weight}}function o(i){let s=[],l={},c={};function u(d){Object.hasOwn(c,d)||(c[d]=!0,l[d]=!0,i.outEdges(d).forEach(h=>{Object.hasOwn(l,h.w)?s.push(h):u(h.w)}),delete l[d])}return i.nodes().forEach(u),s}function a(i){i.edges().forEach(s=>{let l=i.edge(s);if(l.reversed){i.removeEdge(s);let c=l.forwardName;delete l.reversed,delete l.forwardName,i.setEdge(s.w,s.v,l,c)}})}return uA}var dA,pJ;function nWe(){if(pJ)return dA;pJ=1;let e=_n();dA={run:r,undo:o};function r(a){a.graph().dummyChains=[],a.edges().forEach(i=>n(a,i))}function n(a,i){let s=i.v,l=a.node(s).rank,c=i.w,u=a.node(c).rank,d=i.name,h=a.edge(i),p=h.labelRank;if(u===l+1)return;a.removeEdge(i);let g,y,x;for(x=0,++l;l{let s=a.node(i),l=s.edgeLabel,c;for(a.setEdge(s.edgeObj,l);s.dummy;)c=a.successors(i)[0],a.removeNode(i),l.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(l.x=s.x,l.y=s.y,l.width=s.width,l.height=s.height),i=c,s=a.node(i)})}return dA}var hA,mJ;function Dk(){if(mJ)return hA;mJ=1;const{applyWithChunking:e}=_n();hA={longestPath:r,slack:n};function r(o){var a={};function i(s){var l=o.node(s);if(Object.hasOwn(a,s))return l.rank;a[s]=!0;let c=o.outEdges(s).map(d=>d==null?Number.POSITIVE_INFINITY:i(d.w)-o.edge(d).minlen);var u=e(Math.min,c);return u===Number.POSITIVE_INFINITY&&(u=0),l.rank=u}o.sources().forEach(i)}function n(o,a){return o.node(a.w).rank-o.node(a.v).rank-o.edge(a).minlen}return hA}var fA,gJ;function yJ(){if(gJ)return fA;gJ=1;var e=fs().Graph,r=Dk().slack;fA=n;function n(s){var l=new e({directed:!1}),c=s.nodes()[0],u=s.nodeCount();l.setNode(c,{});for(var d,h;o(l,s){var h=d.v,p=u===h?d.w:h;!s.hasNode(p)&&!r(l,d)&&(s.setNode(p,{}),s.setEdge(u,p,{}),c(p))})}return s.nodes().forEach(c),s.nodeCount()}function a(s,l){return l.edges().reduce((c,u)=>{let d=Number.POSITIVE_INFINITY;return s.hasNode(u.v)!==s.hasNode(u.w)&&(d=r(l,u)),dl.node(u).rank+=c)}return fA}var pA,bJ;function oWe(){if(bJ)return pA;bJ=1;var e=yJ(),r=Dk().slack,n=Dk().longestPath,o=fs().alg.preorder,a=fs().alg.postorder,i=_n().simplify;pA=s,s.initLowLimValues=d,s.initCutValues=l,s.calcCutValue=u,s.leaveEdge=p,s.enterEdge=g,s.exchangeEdges=y;function s(C){C=i(C),n(C);var _=e(C);d(_),l(_,C);for(var T,A;T=p(_);)A=g(_,C,T),y(_,C,T,A)}function l(C,_){var T=a(C,C.nodes());T=T.slice(0,T.length-1),T.forEach(A=>c(C,_,A))}function c(C,_,T){var A=C.node(T),N=A.parent;C.edge(T,N).cutvalue=u(C,_,T)}function u(C,_,T){var A=C.node(T),N=A.parent,$=!0,R=_.edge(T,N),M=0;return R||($=!1,R=_.edge(N,T)),M=R.weight,_.nodeEdges(T).forEach(O=>{var B=O.v===T,I=B?O.w:O.v;if(I!==N){var Y=B===$,D=_.edge(O).weight;if(M+=Y?D:-D,w(C,T,I)){var V=C.edge(T,I).cutvalue;M+=Y?-V:V}}}),M}function d(C,_){arguments.length<2&&(_=C.nodes()[0]),h(C,{},1,_)}function h(C,_,T,A,N){var $=T,R=C.node(A);return _[A]=!0,C.neighbors(A).forEach(M=>{Object.hasOwn(_,M)||(T=h(C,_,T,M,A))}),R.low=$,R.lim=T++,N?R.parent=N:delete R.parent,T}function p(C){return C.edges().find(_=>C.edge(_).cutvalue<0)}function g(C,_,T){var A=T.v,N=T.w;_.hasEdge(A,N)||(A=T.w,N=T.v);var $=C.node(A),R=C.node(N),M=$,O=!1;$.lim>R.lim&&(M=R,O=!0);var B=_.edges().filter(I=>O===k(C,C.node(I.v),M)&&O!==k(C,C.node(I.w),M));return B.reduce((I,Y)=>r(_,Y)!_.node(N).parent),A=o(C,T);A=A.slice(1),A.forEach(N=>{var $=C.node(N).parent,R=_.edge(N,$),M=!1;R||(R=_.edge($,N),M=!0),_.node(N).rank=_.node($).rank+(M?R.minlen:-R.minlen)})}function w(C,_,T){return C.hasEdge(_,T)}function k(C,_,T){return T.low<=_.lim&&_.lim<=T.lim}return pA}var mA,vJ;function aWe(){if(vJ)return mA;vJ=1;var e=Dk(),r=e.longestPath,n=yJ(),o=oWe();mA=a;function a(c){var u=c.graph().ranker;if(u instanceof Function)return u(c);switch(c.graph().ranker){case"network-simplex":l(c);break;case"tight-tree":s(c);break;case"longest-path":i(c);break;case"none":break;default:l(c)}}var i=r;function s(c){r(c),n(c)}function l(c){o(c)}return mA}var gA,xJ;function iWe(){if(xJ)return gA;xJ=1,gA=e;function e(o){let a=n(o);o.graph().dummyChains.forEach(i=>{let s=o.node(i),l=s.edgeObj,c=r(o,a,l.v,l.w),u=c.path,d=c.lca,h=0,p=u[h],g=!0;for(;i!==l.w;){if(s=o.node(i),g){for(;(p=u[h])!==d&&o.node(p).maxRanku||d>a[h].lim));for(p=h,h=s;(h=o.parent(h))!==p;)c.push(h);return{path:l.concat(c.reverse()),lca:p}}function n(o){let a={},i=0;function s(l){let c=i;o.children(l).forEach(s),a[l]={low:c,lim:i++}}return o.children().forEach(s),a}return gA}var yA,wJ;function sWe(){if(wJ)return yA;wJ=1;let e=_n();yA={run:r,cleanup:i};function r(s){let l=e.addDummyNode(s,"root",{},"_root"),c=o(s),u=Object.values(c),d=e.applyWithChunking(Math.max,u)-1,h=2*d+1;s.graph().nestingRoot=l,s.edges().forEach(g=>s.edge(g).minlen*=h);let p=a(s)+1;s.children().forEach(g=>n(s,l,h,p,d,c,g)),s.graph().nodeRankFactor=h}function n(s,l,c,u,d,h,p){let g=s.children(p);if(!g.length){p!==l&&s.setEdge(l,p,{weight:0,minlen:c});return}let y=e.addBorderNode(s,"_bt"),x=e.addBorderNode(s,"_bb"),w=s.node(p);s.setParent(y,p),w.borderTop=y,s.setParent(x,p),w.borderBottom=x,g.forEach(k=>{n(s,l,c,u,d,h,k);let C=s.node(k),_=C.borderTop?C.borderTop:k,T=C.borderBottom?C.borderBottom:k,A=C.borderTop?u:2*u,N=_!==T?1:d-h[p]+1;s.setEdge(y,_,{weight:A,minlen:N,nestingEdge:!0}),s.setEdge(T,x,{weight:A,minlen:N,nestingEdge:!0})}),s.parent(p)||s.setEdge(l,y,{weight:0,minlen:d+h[p]})}function o(s){var l={};function c(u,d){var h=s.children(u);h&&h.length&&h.forEach(p=>c(p,d+1)),l[u]=d}return s.children().forEach(u=>c(u,1)),l}function a(s){return s.edges().reduce((l,c)=>l+s.edge(c).weight,0)}function i(s){var l=s.graph();s.removeNode(l.nestingRoot),delete l.nestingRoot,s.edges().forEach(c=>{var u=s.edge(c);u.nestingEdge&&s.removeEdge(c)})}return yA}var bA,kJ;function lWe(){if(kJ)return bA;kJ=1;let e=_n();bA=r;function r(o){function a(i){let s=o.children(i),l=o.node(i);if(s.length&&s.forEach(a),Object.hasOwn(l,"minRank")){l.borderLeft=[],l.borderRight=[];for(let c=l.minRank,u=l.maxRank+1;co(c.node(u))),c.edges().forEach(u=>o(c.edge(u)))}function o(c){let u=c.width;c.width=c.height,c.height=u}function a(c){c.nodes().forEach(u=>i(c.node(u))),c.edges().forEach(u=>{let d=c.edge(u);d.points.forEach(i),Object.hasOwn(d,"y")&&i(d)})}function i(c){c.y=-c.y}function s(c){c.nodes().forEach(u=>l(c.node(u))),c.edges().forEach(u=>{let d=c.edge(u);d.points.forEach(l),Object.hasOwn(d,"x")&&l(d)})}function l(c){let u=c.x;c.x=c.y,c.y=u}return vA}var xA,EJ;function uWe(){if(EJ)return xA;EJ=1;let e=_n();xA=r;function r(n){let o={},a=n.nodes().filter(u=>!n.children(u).length),i=a.map(u=>n.node(u).rank),s=e.applyWithChunking(Math.max,i),l=e.range(s+1).map(()=>[]);function c(u){if(o[u])return;o[u]=!0;let d=n.node(u);l[d.rank].push(u),n.successors(u).forEach(c)}return a.sort((u,d)=>n.node(u).rank-n.node(d).rank).forEach(c),l}return xA}var wA,SJ;function dWe(){if(SJ)return wA;SJ=1;let e=_n().zipObject;wA=r;function r(o,a){let i=0;for(let s=1;sg)),l=a.flatMap(p=>o.outEdges(p).map(g=>({pos:s[g.w],weight:o.edge(g).weight})).sort((g,y)=>g.pos-y.pos)),c=1;for(;c{let g=p.pos+c;d[g]+=p.weight;let y=0;for(;g>0;)g%2&&(y+=d[g+1]),g=g-1>>1,d[g]+=p.weight;h+=p.weight*y}),h}return wA}var kA,CJ;function hWe(){if(CJ)return kA;CJ=1,kA=e;function e(r,n=[]){return n.map(o=>{let a=r.inEdges(o);if(a.length){let i=a.reduce((s,l)=>{let c=r.edge(l),u=r.node(l.v);return{sum:s.sum+c.weight*u.order,weight:s.weight+c.weight}},{sum:0,weight:0});return{v:o,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:o}})}return kA}var _A,TJ;function fWe(){if(TJ)return _A;TJ=1;let e=_n();_A=r;function r(a,i){let s={};a.forEach((c,u)=>{let d=s[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:u};c.barycenter!==void 0&&(d.barycenter=c.barycenter,d.weight=c.weight)}),i.edges().forEach(c=>{let u=s[c.v],d=s[c.w];u!==void 0&&d!==void 0&&(d.indegree++,u.out.push(s[c.w]))});let l=Object.values(s).filter(c=>!c.indegree);return n(l)}function n(a){let i=[];function s(c){return u=>{u.merged||(u.barycenter===void 0||c.barycenter===void 0||u.barycenter>=c.barycenter)&&o(c,u)}}function l(c){return u=>{u.in.push(c),--u.indegree===0&&a.push(u)}}for(;a.length;){let c=a.pop();i.push(c),c.in.reverse().forEach(s(c)),c.out.forEach(l(c))}return i.filter(c=>!c.merged).map(c=>e.pick(c,["vs","i","barycenter","weight"]))}function o(a,i){let s=0,l=0;a.weight&&(s+=a.barycenter*a.weight,l+=a.weight),i.weight&&(s+=i.barycenter*i.weight,l+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=s/l,a.weight=l,a.i=Math.min(i.i,a.i),i.merged=!0}return _A}var EA,AJ;function pWe(){if(AJ)return EA;AJ=1;let e=_n();EA=r;function r(a,i){let s=e.partition(a,y=>Object.hasOwn(y,"barycenter")),l=s.lhs,c=s.rhs.sort((y,x)=>x.i-y.i),u=[],d=0,h=0,p=0;l.sort(o(!!i)),p=n(u,c,p),l.forEach(y=>{p+=y.vs.length,u.push(y.vs),d+=y.barycenter*y.weight,h+=y.weight,p=n(u,c,p)});let g={vs:u.flat(!0)};return h&&(g.barycenter=d/h,g.weight=h),g}function n(a,i,s){let l;for(;i.length&&(l=i[i.length-1]).i<=s;)i.pop(),a.push(l.vs),s++;return s}function o(a){return(i,s)=>i.barycenters.barycenter?1:a?s.i-i.i:i.i-s.i}return EA}var SA,NJ;function mWe(){if(NJ)return SA;NJ=1;let e=hWe(),r=fWe(),n=pWe();SA=o;function o(s,l,c,u){let d=s.children(l),h=s.node(l),p=h?h.borderLeft:void 0,g=h?h.borderRight:void 0,y={};p&&(d=d.filter(C=>C!==p&&C!==g));let x=e(s,d);x.forEach(C=>{if(s.children(C.v).length){let _=o(s,C.v,c,u);y[C.v]=_,Object.hasOwn(_,"barycenter")&&i(C,_)}});let w=r(x,c);a(w,y);let k=n(w,u);if(p&&(k.vs=[p,k.vs,g].flat(!0),s.predecessors(p).length)){let C=s.node(s.predecessors(p)[0]),_=s.node(s.predecessors(g)[0]);Object.hasOwn(k,"barycenter")||(k.barycenter=0,k.weight=0),k.barycenter=(k.barycenter*k.weight+C.order+_.order)/(k.weight+2),k.weight+=2}return k}function a(s,l){s.forEach(c=>{c.vs=c.vs.flatMap(u=>l[u]?l[u].vs:u)})}function i(s,l){s.barycenter!==void 0?(s.barycenter=(s.barycenter*s.weight+l.barycenter*l.weight)/(s.weight+l.weight),s.weight+=l.weight):(s.barycenter=l.barycenter,s.weight=l.weight)}return SA}var CA,RJ;function gWe(){if(RJ)return CA;RJ=1;let e=fs().Graph,r=_n();CA=n;function n(a,i,s){let l=o(a),c=new e({compound:!0}).setGraph({root:l}).setDefaultNodeLabel(u=>a.node(u));return a.nodes().forEach(u=>{let d=a.node(u),h=a.parent(u);(d.rank===i||d.minRank<=i&&i<=d.maxRank)&&(c.setNode(u),c.setParent(u,h||l),a[s](u).forEach(p=>{let g=p.v===u?p.w:p.v,y=c.edge(g,u),x=y!==void 0?y.weight:0;c.setEdge(g,u,{weight:a.edge(p).weight+x})}),Object.hasOwn(d,"minRank")&&c.setNode(u,{borderLeft:d.borderLeft[i],borderRight:d.borderRight[i]}))}),c}function o(a){for(var i;a.hasNode(i=r.uniqueId("_root")););return i}return CA}var TA,$J;function yWe(){if($J)return TA;$J=1,TA=e;function e(r,n,o){let a={},i;o.forEach(s=>{let l=r.parent(s),c,u;for(;l;){if(c=r.parent(l),c?(u=a[c],a[c]=l):(u=i,i=l),u&&u!==l){n.setEdge(u,l);return}l=c}})}return TA}var AA,PJ;function bWe(){if(PJ)return AA;PJ=1;let e=uWe(),r=dWe(),n=mWe(),o=gWe(),a=yWe(),i=fs().Graph,s=_n();AA=l;function l(h,p){if(p&&typeof p.customOrder=="function"){p.customOrder(h,l);return}let g=s.maxRank(h),y=c(h,s.range(1,g+1),"inEdges"),x=c(h,s.range(g-1,-1,-1),"outEdges"),w=e(h);if(d(h,w),p&&p.disableOptimalOrderHeuristic)return;let k=Number.POSITIVE_INFINITY,C;for(let _=0,T=0;T<4;++_,++T){u(_%2?y:x,_%4>=2),w=s.buildLayerMatrix(h);let A=r(h,w);Ay.node(k).order=C),a(y,g,w.vs)})}function d(h,p){Object.values(p).forEach(g=>g.forEach((y,x)=>h.node(y).order=x))}return AA}var NA,MJ;function vWe(){if(MJ)return NA;MJ=1;let e=fs().Graph,r=_n();NA={positionX:g,findType1Conflicts:n,findType2Conflicts:o,addConflict:i,hasConflict:s,verticalAlignment:l,horizontalCompaction:c,alignCoordinates:h,findSmallestWidthAlignment:d,balance:p};function n(w,k){let C={};function _(T,A){let N=0,$=0,R=T.length,M=A[A.length-1];return A.forEach((O,B)=>{let I=a(w,O),Y=I?w.node(I).order:R;(I||O===M)&&(A.slice($,B+1).forEach(D=>{w.predecessors(D).forEach(V=>{let L=w.node(V),U=L.order;(U{O=A[B],w.node(O).dummy&&w.predecessors(O).forEach(I=>{let Y=w.node(I);Y.dummy&&(Y.orderM)&&i(C,I,O)})})}function T(A,N){let $=-1,R,M=0;return N.forEach((O,B)=>{if(w.node(O).dummy==="border"){let I=w.predecessors(O);I.length&&(R=w.node(I[0]).order,_(N,M,B,$,R),M=B,$=R)}_(N,M,N.length,R,A.length)}),N}return k.length&&k.reduce(T),C}function a(w,k){if(w.node(k).dummy)return w.predecessors(k).find(C=>w.node(C).dummy)}function i(w,k,C){if(k>C){let T=k;k=C,C=T}let _=w[k];_||(w[k]=_={}),_[C]=!0}function s(w,k,C){if(k>C){let _=k;k=C,C=_}return!!w[k]&&Object.hasOwn(w[k],C)}function l(w,k,C,_){let T={},A={},N={};return k.forEach($=>{$.forEach((R,M)=>{T[R]=R,A[R]=R,N[R]=M})}),k.forEach($=>{let R=-1;$.forEach(M=>{let O=_(M);if(O.length){O=O.sort((I,Y)=>N[I]-N[Y]);let B=(O.length-1)/2;for(let I=Math.floor(B),Y=Math.ceil(B);I<=Y;++I){let D=O[I];A[M]===M&&RMath.max(I,A[Y.v]+N.edge(Y)),0)}function O(B){let I=N.outEdges(B).reduce((D,V)=>Math.min(D,A[V.w]-N.edge(V)),Number.POSITIVE_INFINITY),Y=w.node(B);I!==Number.POSITIVE_INFINITY&&Y.borderType!==$&&(A[B]=Math.max(A[B],I))}return R(M,N.predecessors.bind(N)),R(O,N.successors.bind(N)),Object.keys(_).forEach(B=>A[B]=A[C[B]]),A}function u(w,k,C,_){let T=new e,A=w.graph(),N=y(A.nodesep,A.edgesep,_);return k.forEach($=>{let R;$.forEach(M=>{let O=C[M];if(T.setNode(O),R){var B=C[R],I=T.edge(B,O);T.setEdge(B,O,Math.max(N(w,M,R),I||0))}R=M})}),T}function d(w,k){return Object.values(k).reduce((C,_)=>{let T=Number.NEGATIVE_INFINITY,A=Number.POSITIVE_INFINITY;Object.entries(_).forEach(([$,R])=>{let M=x(w,$)/2;T=Math.max(R+M,T),A=Math.min(R-M,A)});const N=T-A;return N{["l","r"].forEach(N=>{let $=A+N,R=w[$];if(R===k)return;let M=Object.values(R),O=_-r.applyWithChunking(Math.min,M);N!=="l"&&(O=T-r.applyWithChunking(Math.max,M)),O&&(w[$]=r.mapValues(R,B=>B+O))})})}function p(w,k){return r.mapValues(w.ul,(C,_)=>{if(k)return w[k.toLowerCase()][_];{let T=Object.values(w).map(A=>A[_]).sort((A,N)=>A-N);return(T[1]+T[2])/2}})}function g(w){let k=r.buildLayerMatrix(w),C=Object.assign(n(w,k),o(w,k)),_={},T;["u","d"].forEach(N=>{T=N==="u"?k:Object.values(k).reverse(),["l","r"].forEach($=>{$==="r"&&(T=T.map(B=>Object.values(B).reverse()));let R=(N==="u"?w.predecessors:w.successors).bind(w),M=l(w,T,C,R),O=c(w,T,M.root,M.align,$==="r");$==="r"&&(O=r.mapValues(O,B=>-B)),_[N+$]=O})});let A=d(w,_);return h(_,A),p(_,w.graph().align)}function y(w,k,C){return(_,T,A)=>{let N=_.node(T),$=_.node(A),R=0,M;if(R+=N.width/2,Object.hasOwn(N,"labelpos"))switch(N.labelpos.toLowerCase()){case"l":M=-N.width/2;break;case"r":M=N.width/2;break}if(M&&(R+=C?M:-M),M=0,R+=(N.dummy?k:w)/2,R+=($.dummy?k:w)/2,R+=$.width/2,Object.hasOwn($,"labelpos"))switch($.labelpos.toLowerCase()){case"l":M=$.width/2;break;case"r":M=-$.width/2;break}return M&&(R+=C?M:-M),M=0,R}}function x(w,k){return w.node(k).width}return NA}var RA,OJ;function xWe(){if(OJ)return RA;OJ=1;let e=_n(),r=vWe().positionX;RA=n;function n(a){a=e.asNonCompoundGraph(a),o(a),Object.entries(r(a)).forEach(([i,s])=>a.node(i).x=s)}function o(a){let i=e.buildLayerMatrix(a),s=a.graph().ranksep,l=0;i.forEach(c=>{const u=c.reduce((d,h)=>{const p=a.node(h).height;return d>p?d:p},0);c.forEach(d=>a.node(d).y=l+u/2),l+=u+s})}return RA}var $A,DJ;function wWe(){if(DJ)return $A;DJ=1;let e=rWe(),r=nWe(),n=aWe(),o=_n().normalizeRanks,a=iWe(),i=_n().removeEmptyRanks,s=sWe(),l=lWe(),c=cWe(),u=bWe(),d=xWe(),h=_n(),p=fs().Graph;$A=g;function g(z,W){let G=W&&W.debugTiming?h.time:h.notime;G("layout",()=>{let Z=G(" buildLayoutGraph",()=>R(z));G(" runLayout",()=>y(Z,G,W)),G(" updateInputGraph",()=>x(z,Z))})}function y(z,W,G){W(" makeSpaceForEdgeLabels",()=>M(z)),W(" removeSelfEdges",()=>q(z)),W(" acyclic",()=>e.run(z)),W(" nestingGraph.run",()=>s.run(z)),W(" rank",()=>n(h.asNonCompoundGraph(z))),W(" injectEdgeLabelProxies",()=>O(z)),W(" removeEmptyRanks",()=>i(z)),W(" nestingGraph.cleanup",()=>s.cleanup(z)),W(" normalizeRanks",()=>o(z)),W(" assignRankMinMax",()=>B(z)),W(" removeEdgeLabelProxies",()=>I(z)),W(" normalize.run",()=>r.run(z)),W(" parentDummyChains",()=>a(z)),W(" addBorderSegments",()=>l(z)),W(" order",()=>u(z,G)),W(" insertSelfEdges",()=>X(z)),W(" adjustCoordinateSystem",()=>c.adjust(z)),W(" position",()=>d(z)),W(" positionSelfEdges",()=>F(z)),W(" removeBorderNodes",()=>U(z)),W(" normalize.undo",()=>r.undo(z)),W(" fixupEdgeLabelCoords",()=>V(z)),W(" undoCoordinateSystem",()=>c.undo(z)),W(" translateGraph",()=>Y(z)),W(" assignNodeIntersects",()=>D(z)),W(" reversePoints",()=>L(z)),W(" acyclic.undo",()=>e.undo(z))}function x(z,W){z.nodes().forEach(G=>{let Z=z.node(G),oe=W.node(G);Z&&(Z.x=oe.x,Z.y=oe.y,Z.rank=oe.rank,W.children(G).length&&(Z.width=oe.width,Z.height=oe.height))}),z.edges().forEach(G=>{let Z=z.edge(G),oe=W.edge(G);Z.points=oe.points,Object.hasOwn(oe,"x")&&(Z.x=oe.x,Z.y=oe.y)}),z.graph().width=W.graph().width,z.graph().height=W.graph().height}let w=["nodesep","edgesep","ranksep","marginx","marginy"],k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},C=["acyclicer","ranker","rankdir","align"],_=["width","height","rank"],T={width:0,height:0},A=["minlen","weight","width","height","labeloffset"],N={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},$=["labelpos"];function R(z){let W=new p({multigraph:!0,compound:!0}),G=Q(z.graph());return W.setGraph(Object.assign({},k,J(G,w),h.pick(G,C))),z.nodes().forEach(Z=>{let oe=Q(z.node(Z));const ee=J(oe,_);Object.keys(T).forEach(re=>{ee[re]===void 0&&(ee[re]=T[re])}),W.setNode(Z,ee),W.setParent(Z,z.parent(Z))}),z.edges().forEach(Z=>{let oe=Q(z.edge(Z));W.setEdge(Z,Object.assign({},N,J(oe,A),h.pick(oe,$)))}),W}function M(z){let W=z.graph();W.ranksep/=2,z.edges().forEach(G=>{let Z=z.edge(G);Z.minlen*=2,Z.labelpos.toLowerCase()!=="c"&&(W.rankdir==="TB"||W.rankdir==="BT"?Z.width+=Z.labeloffset:Z.height+=Z.labeloffset)})}function O(z){z.edges().forEach(W=>{let G=z.edge(W);if(G.width&&G.height){let Z=z.node(W.v),oe={rank:(z.node(W.w).rank-Z.rank)/2+Z.rank,e:W};h.addDummyNode(z,"edge-proxy",oe,"_ep")}})}function B(z){let W=0;z.nodes().forEach(G=>{let Z=z.node(G);Z.borderTop&&(Z.minRank=z.node(Z.borderTop).rank,Z.maxRank=z.node(Z.borderBottom).rank,W=Math.max(W,Z.maxRank))}),z.graph().maxRank=W}function I(z){z.nodes().forEach(W=>{let G=z.node(W);G.dummy==="edge-proxy"&&(z.edge(G.e).labelRank=G.rank,z.removeNode(W))})}function Y(z){let W=Number.POSITIVE_INFINITY,G=0,Z=Number.POSITIVE_INFINITY,oe=0,ee=z.graph(),re=ee.marginx||0,he=ee.marginy||0;function Ce(ce){let de=ce.x,be=ce.y,De=ce.width,Ge=ce.height;W=Math.min(W,de-De/2),G=Math.max(G,de+De/2),Z=Math.min(Z,be-Ge/2),oe=Math.max(oe,be+Ge/2)}z.nodes().forEach(ce=>Ce(z.node(ce))),z.edges().forEach(ce=>{let de=z.edge(ce);Object.hasOwn(de,"x")&&Ce(de)}),W-=re,Z-=he,z.nodes().forEach(ce=>{let de=z.node(ce);de.x-=W,de.y-=Z}),z.edges().forEach(ce=>{let de=z.edge(ce);de.points.forEach(be=>{be.x-=W,be.y-=Z}),Object.hasOwn(de,"x")&&(de.x-=W),Object.hasOwn(de,"y")&&(de.y-=Z)}),ee.width=G-W+re,ee.height=oe-Z+he}function D(z){z.edges().forEach(W=>{let G=z.edge(W),Z=z.node(W.v),oe=z.node(W.w),ee,re;G.points?(ee=G.points[0],re=G.points[G.points.length-1]):(G.points=[],ee=oe,re=Z),G.points.unshift(h.intersectRect(Z,ee)),G.points.push(h.intersectRect(oe,re))})}function V(z){z.edges().forEach(W=>{let G=z.edge(W);if(Object.hasOwn(G,"x"))switch((G.labelpos==="l"||G.labelpos==="r")&&(G.width-=G.labeloffset),G.labelpos){case"l":G.x-=G.width/2+G.labeloffset;break;case"r":G.x+=G.width/2+G.labeloffset;break}})}function L(z){z.edges().forEach(W=>{let G=z.edge(W);G.reversed&&G.points.reverse()})}function U(z){z.nodes().forEach(W=>{if(z.children(W).length){let G=z.node(W),Z=z.node(G.borderTop),oe=z.node(G.borderBottom),ee=z.node(G.borderLeft[G.borderLeft.length-1]),re=z.node(G.borderRight[G.borderRight.length-1]);G.width=Math.abs(re.x-ee.x),G.height=Math.abs(oe.y-Z.y),G.x=ee.x+G.width/2,G.y=Z.y+G.height/2}}),z.nodes().forEach(W=>{z.node(W).dummy==="border"&&z.removeNode(W)})}function q(z){z.edges().forEach(W=>{if(W.v===W.w){var G=z.node(W.v);G.selfEdges||(G.selfEdges=[]),G.selfEdges.push({e:W,label:z.edge(W)}),z.removeEdge(W)}})}function X(z){var W=h.buildLayerMatrix(z);W.forEach(G=>{var Z=0;G.forEach((oe,ee)=>{var re=z.node(oe);re.order=ee+Z,(re.selfEdges||[]).forEach(he=>{h.addDummyNode(z,"selfedge",{width:he.label.width,height:he.label.height,rank:re.rank,order:ee+ ++Z,e:he.e,label:he.label},"_se")}),delete re.selfEdges})})}function F(z){z.nodes().forEach(W=>{var G=z.node(W);if(G.dummy==="selfedge"){var Z=z.node(G.e.v),oe=Z.x+Z.width/2,ee=Z.y,re=G.x-oe,he=Z.height/2;z.setEdge(G.e,G.label),z.removeNode(W),G.label.points=[{x:oe+2*re/3,y:ee-he},{x:oe+5*re/6,y:ee-he},{x:oe+re,y:ee},{x:oe+5*re/6,y:ee+he},{x:oe+2*re/3,y:ee+he}],G.label.x=G.x,G.label.y=G.y}})}function J(z,W){return h.mapValues(h.pick(z,W),Number)}function Q(z){var W={};return z&&Object.entries(z).forEach(([G,Z])=>{typeof G=="string"&&(G=G.toLowerCase()),W[G]=Z}),W}return $A}var PA,LJ;function kWe(){if(LJ)return PA;LJ=1;let e=_n(),r=fs().Graph;PA={debugOrdering:n};function n(o){let a=e.buildLayerMatrix(o),i=new r({compound:!0,multigraph:!0}).setGraph({});return o.nodes().forEach(s=>{i.setNode(s,{label:s}),i.setParent(s,"layer"+o.node(s).rank)}),o.edges().forEach(s=>i.setEdge(s.v,s.w,{},s.name)),a.forEach((s,l)=>{let c="layer"+l;i.setNode(c,{rank:"same"}),s.reduce((u,d)=>(i.setEdge(u,d,{style:"invis"}),d))}),i}return PA}var IJ,zJ;function _We(){return zJ||(zJ=1,IJ="1.1.5"),IJ}var jJ,BJ;function EWe(){return BJ||(BJ=1,jJ={graphlib:fs(),layout:wWe(),debug:kWe(),util:{time:_n().time,notime:_n().notime},version:_We()}),jJ}var SWe=EWe();const Lk=$6(SWe),go={dagre:{ranksep:60,nodesep:35,edgesep:25},edgeLabel:{width:140,height:10,minlen:1,weight:1},emptyNodeOffset:120,nodeWidth:330,nodeHeight:180,compound:{labelHeight:2,paddingTop:50,paddingBottom:32}};function CWe(){const e=new Lk.graphlib.Graph({directed:!0,compound:!0,multigraph:!0});return e.setGraph({...go.dagre,rankdir:"LR"}),e.setDefaultEdgeLabel(()=>({...go.edgeLabel})),e.setDefaultNodeLabel(()=>({})),e}const MA="-port";function OA(e,r,n){const o=new lo(i=>({id:`${e}-${i}`,portId:`${e}-${i}`})),a=zx(r);for(const i of a.sorted){const s=a.children(i).length>0,l=i.id,c=`${e}-${l}`,u=s?`${c}${MA}`:c;o.set(l,{id:c,portId:u}),n.setNode(c,{column:e,element:i,isCompound:s,portId:u,inPorts:[],outPorts:[],width:go.nodeWidth,height:go.nodeHeight}),s&&(n.setNode(u,{element:i,portId:u,isCompound:s,inPorts:[],outPorts:[],width:go.nodeWidth-go.dagre.ranksep,height:go.compound.labelHeight}),n.setParent(u,c));const d=a.parent(i);d&&n.setParent(c,`${e}-${d.id}`)}return{...a,byId:i=>{const s=a.byId(i),l=o.get(s.id);return{element:s,graph:l}},graphNodes:o}}function TWe(e){return Lk.layout(e,{}),r=>{const n=e.node(r),{x:o,y:a,width:i,height:s}=n;return{position:{x:o-Math.round(i/2),y:a-Math.round(s/2)},width:i,height:s}}}var Ik;(e=>{e.Empty="@empty"})(Ik||(Ik={}));function AWe(e,r){const n=CWe(),o=OA("incomers",e.incomers,n),a=OA("subjects",e.subjects,n),i=OA("outgoers",e.outgoers,n),s=[];yn(cRe(yn(K0(e.incoming),Ao(T=>({id:T.source.id,sourceFqn:T.source.id,targetFqn:T.target.id,source:o.byId(T.source.id).graph,target:a.byId(T.target.id).graph,relation:T}))),yn(K0(e.outgoing),Ao(T=>({id:T.target.id,sourceFqn:T.source.id,targetFqn:T.target.id,source:a.byId(T.source.id).graph,target:i.byId(T.target.id).graph,relation:T})))),Ao(T=>({...T,expr:`${T.source.id}->${T.target.id}`})),NRe(Ca("expr")),TRe(T=>{const A=T[0].source,N=T[0].target,$=T[0].expr;n.node(A.id).outPorts.push(N.id),n.node(N.id).inPorts.push(A.id),n.setEdge(A.portId,N.portId,{...go.edgeLabel},$),s.push({name:$,sourceFqn:T[0].sourceFqn,targetFqn:T[0].targetFqn,source:A.id,sourceHandle:A.id+"_out"+(n.node(A.id).outPorts.length-1),target:N.id,targetHandle:N.id+"_in"+(n.node(N.id).inPorts.length-1),relations:Ao(T,Ca("relation"))})}));for(const T of a.graphNodes.values()){const A=T.id,N=n.node(A);if(N.isCompound)continue;const $=Math.max(n.inEdges(A)?.length??0,n.outEdges(A)?.length??0);$>2&&(N.height=N.height+($-3)*14)}const l=[...o.graphNodes.values(),...a.graphNodes.values(),...i.graphNodes.values()];if(o.graphNodes.size==0){const T="incomers-empty";n.setNode(T,{column:"incomers",element:null,isCompound:!1,portId:T,inPorts:[],outPorts:[],width:go.nodeWidth,height:go.nodeHeight});for(const A of a.graphNodes.values())n.setEdge(T,A.portId);l.push({id:T,portId:T})}if(i.graphNodes.size==0){const T="outgoers-empty";n.setNode(T,{column:"outgoers",element:null,isCompound:!1,portId:T,inPorts:[],outPorts:[],width:go.nodeWidth,height:go.nodeHeight});for(const A of a.graphNodes.values())n.setEdge(A.portId,T);l.push({id:T,portId:T})}const c=n.edgeCount();if(c>10)for(const T of n.edges())n.setEdge(T,{...go.edgeLabel,width:c>25?800:400});const u=TWe(n),d=yn(l,dp(T=>T.id===T.portId),E1(T=>[T.id,u(T.id)]));function h(T){return d[T]??=yn(n.children(T)??[],dp(A=>!A.endsWith(MA)),Ao(A=>h(A)),uV(A=>{nt(A.length>0,`Node ${T} has no nested nodes`)}),fp((A,N)=>({minY:Math.min(A.minY,N.position.y),maxY:Math.max(A.maxY,N.position.y+N.height)}),{minY:1/0,maxY:-1/0}),({minY:A,maxY:N})=>{const{position:{x:$},width:R}=u(T);return A=A-go.compound.paddingTop,N=N+go.compound.paddingBottom,{position:{x:$,y:A},width:R,height:N-A}})}function p(T){const A=n.parent(T);return A?p(A)+1:0}function g(T){const A=n.children(T)??[];return A.length===0?0:1+Math.max(...A.map(g))}const y=(T,A,N)=>yn(N,Ao(($,R)=>({port:T+"_"+A+R,topY:h($).position.y})),jw(Ca("topY")),Ao(Ca("port")));let x=0,w=0;const[k]=[...a.root];nt(k,"Subjects should not be empty");let C=h(a.graphNodes.get(k.id).id);const _=l.map(({id:T})=>{const{element:A,inPorts:N,outPorts:$,column:R}=n.node(T);let{position:M,width:O,height:B}=h(T);if(!A){if(B=Math.min(C.height,300),M.y=C.position.y+C.height/2-B/2,R==="incomers")O=C.position.x-go.emptyNodeOffset-M.x;else{const q=M.x+O;M.x=C.position.x+C.width+go.emptyNodeOffset,O=q-M.x}return{id:T,parent:null,x:M.x,y:M.y,title:"empty node",description:Kt.EMPTY,technology:null,tags:[],links:[],color:"muted",shape:"rectangle",style:{border:"dashed",opacity:50},kind:Ik.Empty,level:0,labelBBox:{x:M.x,y:M.y,width:O,height:B},children:[],width:O,height:B,column:R,ports:{in:[],out:[]},existsInCurrentView:!1}}const I=n.parent(T),Y=(n.children(T)??[]).filter(q=>!q.endsWith(MA));x=Math.min(x,M.x),w=Math.min(w,M.y);const D=r?G0(A.scopedViews(),q=>q.id!==r.id)?.id??null:null,V=r?.findNodeWithElement(A.id),L=r&&!V?G0(A.ancestors(),q=>!!r.findNodeWithElement(q.id))?.id:null,U=V??(L&&r?.findNodeWithElement(L));return{id:T,parent:I??null,x:M.x,y:M.y,title:A.title,description:A.summary,technology:A.technology,tags:[...A.tags],links:null,color:U?.color??A.color,shape:V?.shape??A.shape,icon:V?.icon??A.icon??"none",modelRef:A.id,kind:A.kind,level:p(T),labelBBox:{x:M.x,y:M.y,width:O,height:B},style:Vd({...(V??U)?.style,...A.$element.style},["color","shape","icon"]),navigateTo:D,...Y.length>0&&{depth:g(T)},children:Y,width:O,height:B,column:R,ports:{in:y(T,"in",N),out:y(T,"out",$)},existsInCurrentView:!!V}});return{subjectExistsInScope:!r||r.includesElement(k.id),bounds:{x:Math.min(x,0),y:Math.min(w,0),width:n.graph().width??100,height:n.graph().height??100},nodes:_,edges:n.edges().reduce((T,A)=>{const N=n.edge(A),$=A.name;if(!$)return T;const{name:R,source:M,sourceFqn:O,target:B,targetFqn:I,relations:Y,sourceHandle:D,targetHandle:V}=mt(Iw(s,F=>F.name===$)),L=zw(Y),U=L?.title??"untitled",q=Y.length>1,X=zw(Y6(Y.flatMap(F=>F.navigateTo?.id?F.navigateTo.id:[])));return T.push(V0({id:R,sourceFqn:O,source:M,sourceHandle:D,targetFqn:I,target:B,targetHandle:V,label:q?`${Y.length} relationships`:U,navigateTo:X,color:L?.color??"gray",existsInCurrentView:!r||Y.every(F=>r.includesRelation(F.id)),points:N.points.map(F=>[F.x,F.y]),line:L?.line??"dashed",head:L?.head,tail:L?.tail,relations:Y.map(F=>F.id),parent:null})),T},[])}}function NWe(e,r,n){const o=Ho();return E.useMemo(()=>{const a=r?o.findView(r):null,i=AWe(dB(e,o,r,n),n==="view"?a:null);return a&&(n==="global"||!i.subjectExistsInScope)&&(i.edges=i.edges.map(s=>(s.existsInCurrentView=s.relations.every(l=>a.includesRelation(l)),s))),Object.assign(i,{subject:e})},[o,e,r,n,dB])}const Cy=(e,r)=>rx(e.label,r.label);function DA(e){return{label:e.title,value:e.id,children:[...e.children()].map(DA).sort(Cy)}}function RWe(e){const r=Ho();return E.useMemo(()=>e?[...r.view(e).roots()].map(DA).sort(Cy):[...r.roots()].map(DA).sort(Cy),[r,e??null])}const $We=ye({margin:"0"}),PWe=ye({_hover:{backgroundColor:"mantine.colors.gray[0]",_dark:{backgroundColor:"mantine.colors.defaultHover",color:"mantine.colors.white"}}}),FJ=ye({maxHeight:["70vh","calc(100cqh - 70px)"]}),MWe=Object.freeze(Object.defineProperty({__proto__:null,label:PWe,node:$We,scrollArea:FJ},Symbol.toStringTag,{value:"Module"}));/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const OWe=[["path",{d:"M8 9l4 -4l4 4",key:"svg-0"}],["path",{d:"M16 15l-4 4l-4 -4",key:"svg-1"}]],LA=yt("outline","selector","Selector",OWe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const DWe=[["path",{d:"M9 6l6 6l-6 6",key:"svg-0"}]],hh=yt("outline","chevron-right","ChevronRight",DWe),LWe=e=>{const r=e.context.layouted?.subjectExistsInScope??!1;return{subjectId:e.context.subject,viewId:e.context.viewId,scope:e.context.scope,subjectExistsInScope:r,enableSelectSubject:e.context.enableSelectSubject,enableChangeScope:e.context.enableChangeScope}},IWe=()=>{},zWe=E.memo(()=>{const e=Sy(),{subjectId:r,viewId:n,scope:o,subjectExistsInScope:a,enableSelectSubject:i,enableChangeScope:s}=Ok(LWe),l=E.useRef(null),c=E.useRef(null),u=Ho().findElement(r),d=RWe(o==="view"&&n?n:void 0),h=Y1({multiple:!1});return h.setHoveredNode=IWe,E.useEffect(()=>{bd(r).reverse().forEach(p=>{h.expand(p)}),h.select(r)},[r]),b.jsxs(Ur,{ref:l,gap:"xs",pos:"relative",children:[i&&b.jsxs(Ur,{gap:4,wrap:"nowrap",children:[b.jsx(Se,{fz:"xs",fw:"500",style:{whiteSpace:"nowrap",userSelect:"none"},children:"Relationships of"}),b.jsx(Se,{pos:"relative",children:b.jsxs(mr,{position:"bottom-start",shadow:"md",keepMounted:!1,withinPortal:!1,closeOnClickOutside:!0,clickOutsideEvents:["pointerdown","mousedown","click"],offset:4,onOpen:()=>{setTimeout(()=>{c.current?.querySelector(`[data-value="${r}"]`)?.scrollIntoView({behavior:"instant",block:"nearest"})},100)},children:[b.jsx(pu,{children:b.jsx(Zn,{size:"xs",variant:"default",maw:250,rightSection:b.jsx(LA,{size:16}),children:b.jsx(wt,{fz:"xs",fw:"500",truncate:!0,children:u?.title??"???"})})}),b.jsx(Xl,{p:0,miw:250,maw:400,children:b.jsx(ta,{scrollbars:"y",type:"never",viewportRef:c,className:FJ,children:b.jsx(Bp,{allowRangeSelection:!1,selectOnClick:!1,tree:h,data:d,classNames:MWe,levelOffset:8,styles:{root:{maxWidth:400,overflow:"hidden"},label:{paddingTop:5,paddingBottom:6}},renderNode:({node:p,selected:g,expanded:y,elementProps:x,hasChildren:w})=>b.jsxs(Ur,{gap:2,wrap:"nowrap",...x,py:"3",children:[b.jsx(or,{variant:"subtle",size:18,c:"dimmed",style:{visibility:w?"visible":"hidden"},children:b.jsx(hh,{stroke:3.5,style:{transition:"transform 150ms ease",transform:`rotate(${y?"90deg":"0"})`,width:"80%"}})}),b.jsx(Se,{flex:"1 1 100%",w:"100%",onClick:k=>{k.stopPropagation(),h.select(p.value),h.expand(p.value),e.navigateTo(p.value)},children:b.jsx(wt,{fz:"sm",fw:g?"600":"400",truncate:"end",children:p.label})})]})})})})]})})]}),s&&b.jsxs(Ur,{gap:4,wrap:"nowrap",children:[i&&b.jsx(Se,{fz:"xs",fw:"500",...!a&&{c:"dimmed"},style:{whiteSpace:"nowrap",userSelect:"none"},children:"Scope"}),b.jsx("div",{children:b.jsx(po,{color:"orange",label:b.jsxs(b.Fragment,{children:["This element does not exist in the current view",o==="view"&&b.jsxs(b.Fragment,{children:[b.jsx("br",{}),"Scope is set to global"]})]}),position:"bottom-start",disabled:a,portalProps:{target:l.current},children:b.jsx(U1,{flex:"1 0 auto",size:"xs",withItemsBorders:!1,value:o,styles:{label:{paddingLeft:8,paddingRight:8}},onChange:p=>{e.changeScope(p)},data:[{label:"Global",value:"global"},{label:b.jsx("span",{children:"Current view"}),value:"view",disabled:!a}]})})})]})]})}),zk=(e,r)=>Math.abs(e-r)<2.5,jWe=(e,r)=>e.id===r.id&&ut(e.selected??!1,r.selected??!1)&&ut(e.animated??!1,r.animated??!1)&&ut(e.source,r.source)&&ut(e.sourceHandleId??null,r.sourceHandleId??null)&&ut(e.sourcePosition,r.sourcePosition)&&ut(e.target,r.target)&&ut(e.targetHandleId??null,r.targetHandleId??null)&&ut(e.targetPosition,r.targetPosition)&&zk(e.sourceX,r.sourceX)&&zk(e.sourceY,r.sourceY)&&zk(e.targetX,r.targetX)&&zk(e.targetY,r.targetY)&&ut(e.data,r.data);function IA(e){return E.memo(e,jWe)}const BWe=["Controls","ReadOnly","FocusMode","NavigateTo","ElementDetails","RelationshipDetails","RelationshipBrowser","Search","NavigationButtons","Notations","DynamicViewWalkthrough","EdgeEditing","FitView","Vscode","ElementTags"],HJ=E1(BWe,e=>[`enable${e}`,!1]),zA=E.createContext(HJ),FWe=e=>{let{enableReadOnly:r,enableEdgeEditing:n,...o}=e;return r&&(n=!1),{enableReadOnly:r,enableEdgeEditing:n,...o}};function fh({children:e,features:r,overrides:n}){const o=E.useContext(zA),[a,i]=E.useState(o);return E.useEffect(()=>{i(s=>{const l=FWe({...o,...r,...n});return Xn(s,l)?s:l})},[o,r,n]),b.jsx(zA.Provider,{value:a,children:e})}fh.Overlays=({children:e})=>b.jsx(fh,{overrides:{enableControls:!1,enableReadOnly:!0,enableEdgeEditing:!1},children:e});function wr(){return E.useContext(zA)}function HWe({feature:e,children:r,and:n=!0}){return wr()[`enable${e}`]===!0&&n?b.jsx(b.Fragment,{children:r}):null}function jA(e,r){return wk(e,r)}const ps=jA("button"),Qr=jA("div"),UWe=jA("span"),Ty=E.forwardRef(({edgeProps:{id:e,data:{label:r,technology:n,hovered:o=!1},selected:a=!1,selectable:i=!1},className:s,style:l,children:c,...u},d)=>{const h=v0(e)?BL(e):null,p=Dqe({isStepEdge:h!==null,cursor:i||h!==null?"pointer":"default"}),g=Sa(r)||Sa(n);return b.jsxs(Qr,{ref:d,className:Je(p.root,"likec4-edge-label",s),"data-edge-id":e,animate:{scale:o&&!a?1.06:1},...u,children:[h!==null&&b.jsx(Vr,{className:p.stepNumber,children:h}),g&&b.jsxs(Vr,{className:p.labelContents,children:[Sa(r)&&b.jsx(Vr,{className:Je(p.labelText,ye({lineClamp:5})),children:r}),Sa(n)&&b.jsx(Vr,{className:p.labelTechnology,children:"[ "+n+" ]"}),c]})]})});Ty.displayName="EdgeLabel";function jk({icon:e,onClick:r}){return b.jsx(or,{className:Je("nodrag nopan",Eqe()),onPointerDownCapture:cn,onClick:r,role:"button",onDoubleClick:cn,children:e??b.jsx(gi,{})})}const VWe=".react-flow__edge.selected",qWe=ye({_reduceGraphics:{transition:"none"}}),YWe=ye({pointerEvents:"none",fill:"none",strokeWidth:"calc(var(--xy-edge-stroke-width) + 2)",strokeOpacity:.08,_noReduceGraphics:{transitionProperty:"stroke-width, stroke-opacity",transitionDuration:"fast",transitionTimingFunction:"inOut"},_whenHovered:{transitionTimingFunction:"out",strokeWidth:"calc(var(--xy-edge-stroke-width) + 4)",strokeOpacity:.2},_whenSelected:{strokeWidth:"calc(var(--xy-edge-stroke-width) + 6)",strokeOpacity:.25,_whenHovered:{strokeOpacity:.4}}}),WWe=ye({fill:"[var(--xy-edge-stroke)]",stroke:"[var(--xy-edge-stroke)]"}),XWe=ye({fill:"none",strokeDashoffset:0,_noReduceGraphics:{animationStyle:"xyedgeAnimated",animationPlayState:"paused",transition:"stroke 130ms ease-out,stroke-width 130ms ease-out"},":where([data-edge-dir='back']) &":{animationDirection:"reverse"},_whenHovered:{_noReduceGraphics:{animationPlayState:"running",animationDelay:"450ms"}},[`:where(${VWe}, [data-edge-active='true'], [data-edge-animated='true']) &`]:{_noReduceGraphics:{animationPlayState:"running",animationDelay:"0ms"}},_whenDimmed:{animationPlayState:"paused"},_smallZoom:{animationName:"none"},_whenPanning:{strokeDasharray:"none !important",animationPlayState:"paused"}});function Ay({className:e,component:r="g",data:{color:n="gray",hovered:o=!1,active:a=!1,dimmed:i=!1,...s},children:l,style:c}){const u={className:Je(e,qWe,"likec4-edge-container"),"data-likec4-color":n,"data-edge-dir":s.dir??"forward","data-edge-active":a,"data-edge-animated":a,"data-likec4-hovered":o,...i!==!1&&{"data-likec4-dimmed":i}};return r==="svg"?b.jsx("svg",{style:c,...u,children:l}):(nt(r==="g",'EdgeContainer: component must be "g" or "svg"'),b.jsx("g",{style:c,...u,children:l}))}const GWe=e=>b.jsx("marker",{viewBox:"-4 -4 14 16",refX:5,refY:4,markerWidth:"7",markerHeight:"8",preserveAspectRatio:"xMaxYMid meet",orient:"auto-start-reverse",...e,children:b.jsx("path",{d:"M0,0 L7,4 L0,8 L4,4 Z",stroke:"context-stroke",fill:"context-stroke",strokeDasharray:0,strokeWidth:1,strokeLinecap:"round"})}),KWe=e=>b.jsx("marker",{viewBox:"-1 -1 12 10",refX:4,refY:3,markerWidth:"8",markerHeight:"6",preserveAspectRatio:"xMaxYMid meet",orient:"auto-start-reverse",...e,children:b.jsx("path",{d:"M 0 0 L 8 3 L 0 6 L 1 3 z",fill:"context-stroke",strokeWidth:0})}),ZWe=e=>b.jsx("marker",{viewBox:"-1 -1 12 12",refX:8,refY:4,markerWidth:"8",markerHeight:"8",preserveAspectRatio:"xMaxYMid meet",orient:"auto-start-reverse",...e,children:b.jsx("path",{d:"M 8 0 L 0 4 L 8 8 M 8 4 L 0 4",fill:"none",strokeWidth:1})}),QWe=e=>b.jsx("marker",{viewBox:"-1 -1 12 10",refX:4,refY:3,markerWidth:"8",markerHeight:"6",preserveAspectRatio:"xMaxYMid meet",orient:"auto-start-reverse",...e,children:b.jsx("path",{d:"M 0 0 L 8 3 L 0 6 L 1 3 z",stroke:"context-stroke",fill:"context-stroke",strokeWidth:1.25,strokeLinejoin:"miter",strokeLinecap:"square"})}),JWe=e=>b.jsx("marker",{viewBox:"-4 -4 16 14",refX:5,refY:4,markerWidth:"10",markerHeight:"8",preserveAspectRatio:"xMaxYMid meet",orient:"auto-start-reverse",...e,children:b.jsx("path",{d:"M5,0 L10,4 L5,8 L0,4 Z",fill:"context-stroke",strokeWidth:0,strokeLinecap:"round"})}),eXe=e=>b.jsx("marker",{viewBox:"-4 -4 16 14",refX:6,refY:4,markerWidth:"10",markerHeight:"8",preserveAspectRatio:"xMaxYMid meet",orient:"auto-start-reverse",...e,children:b.jsx("path",{d:"M5,0 L10,4 L5,8 L0,4 Z",stroke:"context-stroke",fill:"context-stroke",strokeWidth:1.25,strokeLinecap:"round"})}),tXe=e=>b.jsx("marker",{viewBox:"0 0 10 10",refX:4,refY:4,markerWidth:"6",markerHeight:"6",...e,children:b.jsx("circle",{strokeWidth:0,fill:"context-stroke",cx:4,cy:4,r:3})}),rXe=e=>b.jsx("marker",{viewBox:"0 0 10 10",refX:4,refY:4,markerWidth:"6",markerHeight:"6",...e,children:b.jsx("circle",{strokeWidth:1.25,stroke:"context-stroke",fill:"context-stroke",cx:4,cy:4,r:3})}),UJ={Arrow:KWe,Crow:ZWe,OArrow:QWe,Open:GWe,Diamond:JWe,ODiamond:eXe,Dot:tXe,ODot:rXe};function VJ(e){if(!(!e||e==="none"))switch(e){case"normal":return"Arrow";case"crow":return"Crow";case"onormal":return"OArrow";case"diamond":return"Diamond";case"odiamond":return"ODiamond";case"open":case"vee":return"Open";case"dot":return"Dot";case"odot":return"ODot";default:Ga(e)}}const Ny=E.forwardRef(({edgeProps:{id:e,data:{line:r,dir:n,tail:o,head:a},selectable:i=!0,style:s,interactionWidth:l},onEdgePointerDown:c,strokeWidth:u,svgPath:d},h)=>{let p=VJ(o),g=VJ(a??"normal");n==="back"&&([p,g]=[g,p]);const y=p?UJ[p]:null,x=g?UJ[g]:null,w=r==="dotted",k=w||r==="dashed";let C;return w?C="1,8":k&&(C="8,10"),b.jsxs(b.Fragment,{children:[i&&b.jsx("path",{className:Je("react-flow__edge-interaction","hide-on-reduced-graphics",ye({fill:"none"})),d,style:{strokeWidth:l??10,stroke:"currentcolor",strokeOpacity:0}}),b.jsxs("g",{className:WWe,onPointerDown:c,children:[b.jsxs("defs",{children:[y&&b.jsx(y,{id:"start"+e}),x&&b.jsx(x,{id:"end"+e})]}),b.jsx("path",{className:Je("react-flow__edge-path","hide-on-reduced-graphics",YWe),d,style:s,strokeLinecap:"round"}),b.jsx("path",{ref:h,className:Je("react-flow__edge-path",i&&"react-flow__edge-interaction",XWe),d,style:s,strokeWidth:u,strokeLinecap:"round",strokeDasharray:C,markerStart:y?`url(#start${e})`:void 0,markerEnd:x?`url(#end${e})`:void 0})]})]})});Ny.displayName="EdgePath";const qJ=e=>{if(e!==void 0)return nV(e)?`${Math.round(e)}px`:e};function Bk({edgeProps:{id:e,data:{hovered:r=!1,active:n=!1,dimmed:o=!1,labelBBox:a,color:i="gray"}},labelPosition:s,className:l,style:c,children:u,...d}){let h=D9(E.useCallback(x=>x.edgeLookup.get(e)?.zIndex??ds.Edge,[e]));(r||n)&&(h+=100);let p=s?.x??a?.x,g=s?.y??a?.y;if(p===void 0||g===void 0)return null;const y=s?.translate;return b.jsx(OU,{children:b.jsx("div",{...d,className:Je("nodrag nopan","likec4-edge-label-container",l),"data-likec4-hovered":r,"data-likec4-color":i,"data-edge-active":n,"data-edge-animated":n,...o!==!1&&{"data-likec4-dimmed":o},style:{...a&&{maxWidth:a.width+18},zIndex:h,...c,transform:`translate(${qJ(p)}, ${qJ(g)}) ${y||""}`},children:u},e)})}const nXe=IA(e=>{const r=Sy(),{enableNavigateTo:n}=wr(),{data:{navigateTo:o,relations:a,existsInCurrentView:i}}=e,[s,l,c]=kw(e),u=Wt(),d=a.length>1||!i,h=d?{...e,data:{...e.data,line:"solid",color:"amber"}}:e;let p=b.jsx(Ty,{edgeProps:h,className:ye({transition:"fast"}),children:n&&o&&b.jsx(jk,{...e,onClick:g=>{g.stopPropagation(),u.navigateTo(o)}})});return i||(p=b.jsx(po,{color:"orange",c:"black",label:"This relationship is not included in the current view",portalProps:{target:`#${r.rootElementId}`},openDelay:800,children:p})),b.jsxs(Ay,{...h,children:[b.jsx(Ny,{edgeProps:h,svgPath:s,...d&&{strokeWidth:5}}),b.jsx(Bk,{edgeProps:h,labelPosition:{x:l,y:c,translate:"translate(-50%, 0)"},style:{maxWidth:Math.min(Math.abs(e.targetX-e.sourceX-70),250)},children:p})]})}),oXe=ye({width:"100%",height:"100%",border:"3px dashed",borderColor:"mantine.colors.defaultBorder",borderRadius:"md",display:"flex",justifyContent:"center",alignItems:"center"});function aXe({data:{column:e}}){return b.jsx(Se,{className:oXe,children:b.jsxs(wt,{c:"dimmed",fz:"lg",fw:500,children:["No ",e==="incomers"?"incoming":"outgoing"]})})}const iXe=e=>e.context.view.id;function Fk(){const e=Jp();return wn(e,iXe)}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const sXe=[["path",{d:"M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11",key:"svg-0"}]],lXe=yt("outline","bolt","Bolt",sXe),cXe=Uo({position:"absolute",zIndex:1,justifyContent:"center",alignItems:"center",_smallZoom:{display:"none"}}),uXe=Uo({gap:"1.5",justifyContent:"center",alignItems:"center"});function Hk({selected:e=!1,data:{hovered:r=!1},buttons:n}){const o=Ta();return n.length?b.jsx(Vr,{className:cXe,style:{top:"calc(100% - 30px)",transform:"translateX(-50%)",left:"50%",width:"auto",minHeight:30},children:b.jsx(Qr,{layoutRoot:!0,initial:!1,style:{originY:0},animate:{opacity:r||e?1:.75,scale:r?1.1:e?.9:.8,y:r||e?6:0},"data-likec4-hovered":r,className:Je("nodrag nopan",uXe),children:n.map((a,i)=>b.jsx(or,{component:ps,className:Ek({}),initial:!1,whileTap:{scale:1},whileHover:{scale:1.3},onClick:a.onClick,onDoubleClick:cn,children:a.icon||b.jsx(lXe,{})},`${o}-${a.key??i}`))},`${o}-action-buttons`)}):null}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const dXe=[["path",{d:"M3 6a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-0"}],["path",{d:"M21 11v-3a2 2 0 0 0 -2 -2h-6l3 3m0 -6l-3 3",key:"svg-1"}],["path",{d:"M3 13v3a2 2 0 0 0 2 2h6l-3 -3m0 6l3 -3",key:"svg-2"}],["path",{d:"M15 18a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-3"}]],Ry=yt("outline","transform","Transform",dXe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const hXe=[["path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5",key:"svg-0"}],["path",{d:"M9 17l3 -3l-3 -3",key:"svg-1"}],["path",{d:"M14 3v4a1 1 0 0 0 1 1h4",key:"svg-2"}],["path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5",key:"svg-3"}]],pm=yt("outline","file-symlink","FileSymlink",hXe),fXe=e=>{const{enableNavigateTo:r,enableVscode:n}=wr(),o=Wt(),a=Fk(),i=Sy(),s=Ok(d=>d.context.subject),l=[],{navigateTo:c,fqn:u}=e.data;return c&&r&&a!==c&&l.push({key:"navigate",icon:b.jsx(gi,{}),onClick:d=>{d.stopPropagation(),o.navigateTo(c)}}),u!==s&&l.push({key:"relationships",icon:b.jsx(Ry,{}),onClick:d=>{d.stopPropagation(),i.navigateTo(u,e.id)}}),n&&l.push({key:"goToSource",icon:b.jsx(pm,{}),onClick:d=>{d.stopPropagation(),o.openSource({element:u})}}),b.jsx(Hk,{buttons:l,...e})};function $y({nodeProps:{data:{hovered:e=!1,dimmed:r=!1,...n}},className:o,children:a,style:i,...s}){let l=Ki(n.style.opacity??100,{min:0,max:100});const c=l<99,u=65,d=u+Ki((100-u)*(l/100),{min:0,max:100-u}),h=_qe({isTransparent:c,inverseColor:l<60,borderStyle:n.style.border??(c?"dashed":"none")}),p=Ki(n.depth??1,{min:1,max:5});return b.jsx(Qr,{className:Je(h,o),initial:!1,"data-likec4-hovered":e,"data-likec4-color":n.color,"data-compound-depth":p,...r!==!1&&{"data-likec4-dimmed":r},style:{...i,"--_border-transparency":`${d}%`,"--_compound-transparency":`${l}%`},...s,children:a})}function Py({data:e}){const r=Vx({element:e,className:"likec4-compound-icon"});return b.jsxs("div",{className:"likec4-compound-title-container",children:[r,b.jsx(wt,{component:"h3",className:"likec4-compound-title",truncate:"end",children:e.title})]})}const YJ=J0({base:{transitionDuration:"normal"},variants:{delay:{true:{transitionDelay:{base:"0.2s",_hover:"0s"}}}}});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const pXe=[["path",{d:"M3 4m0 3a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3z",key:"svg-0"}],["path",{d:"M9 10m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M15 8l2 0",key:"svg-2"}],["path",{d:"M15 12l2 0",key:"svg-3"}],["path",{d:"M7 16l10 0",key:"svg-4"}]],BA=yt("outline","id","Id",pXe);function WJ({data:{hovered:e=!1},icon:r,onClick:n}){const o=tC(e,e?130:0)[0]&&e;return b.jsx(Qr,{initial:!1,animate:{scale:o?1.2:1},whileHover:{scale:1.4},whileTap:{scale:1},className:"likec4-compound-details details-button",children:b.jsx(or,{className:Je("nodrag nopan",YJ({delay:e&&!o}),Ek({variant:"transparent"})),onClick:n,onDoubleClick:cn,children:r??b.jsx(BA,{stroke:1.8,style:{width:"75%"}})})})}const mXe=ye({position:"relative",width:"100%",height:"100%",padding:"0",margin:"0",display:"flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",_before:{content:'" "',position:"absolute",top:"[calc(100% - 4px)]",left:"0",width:"100%",height:"24px",background:"[transparent]",pointerEvents:"all"},_focusVisible:{outline:"none"},_reduceGraphicsOnPan:{_before:{display:"none"}},":where(.react-flow__node.selectable:not(.dragging)) &":{cursor:"pointer"}}),mm=E.forwardRef(({nodeProps:{selected:e=!1,selectable:r=!1,data:{hovered:n=!1,dimmed:o=!1,...a}},className:i,style:s,children:l,...c},u)=>{let d=1;switch(!0){case n:d=1.05;break;case e:d=1.02;break}const{size:h,padding:p,textSize:g}=ex(a.style??{});return b.jsx(Qr,{ref:u,className:Je(mXe,"group","likec4-element-node",i),initial:!1,...r&&{animate:{scale:d},whileTap:{scale:.98}},"data-likec4-hovered":n,"data-likec4-color":a.color,"data-likec4-shape":a.shape,"data-likec4-shape-size":h,"data-likec4-spacing":p,"data-likec4-text-size":g,...o!==!1&&{"data-likec4-dimmed":o},style:{...s},...c,children:l})});mm.displayName="ElementNodeContainer";function XJ(e,r,n=.065){const o=Math.round(e/2),a=o,i=yi(n*o),s=r-2*i;return{path:` M ${e},${i}
- a ${a},${i} 0,0,0 ${-e} 0
- l 0,${s}
- a ${a},${i} 0,0,0 ${e} 0
- l 0,${-s}
- z
- `.replace(/\s+/g," ").trim(),ry:i,rx:a}}function GJ(e,r,n=.185){const o=r,a=Math.round(o/2),i=yi(o/2*n),s=e-2*i;return{path:`
- M ${i},0
- a ${i},${a} 0,0,0 0 ${o}
- l ${s},0
- a ${i},${a} 0,0,0 0 ${-o}
- z`.replace(/\s+/g," ").trim(),ry:a,rx:i}}const ph={width:115,height:120,path:"M57.9197 0C10.9124 0 33.5766 54.75 33.5766 54.75C38.6131 62.25 45.3285 60.75 45.3285 66C45.3285 70.5 39.4526 72 33.5766 72.75C24.3431 72.75 15.9489 71.25 7.55474 84.75C2.51825 93 0 120 0 120H115C115 120 112.482 93 108.285 84.75C99.8905 70.5 91.4963 72.75 82.2628 72C76.3869 71.25 70.5109 69.75 70.5109 65.25C70.5109 60.75 77.2263 62.25 82.2628 54C82.2628 54.75 104.927 0 57.9197 0V0Z"};function KJ({shape:e,w:r,h:n}){switch(e){case"mobile":return b.jsxs(b.Fragment,{children:[b.jsx("rect",{width:r,height:n,rx:6,"data-likec4-fill":"mix-stroke",strokeWidth:0}),b.jsxs("g",{"data-likec4-fill":"fill",strokeWidth:0,children:[b.jsx("circle",{cx:17,cy:n/2,r:12}),b.jsx("rect",{x:33,y:12,width:r-44,height:n-24,rx:5})]})]});case"browser":return b.jsxs(b.Fragment,{children:[b.jsx("rect",{width:r,height:n,rx:6,"data-likec4-fill":"mix-stroke",strokeWidth:0}),b.jsxs("g",{"data-likec4-fill":"fill",strokeWidth:0,children:[b.jsx("circle",{cx:16,cy:17,r:7}),b.jsx("circle",{cx:36,cy:17,r:7}),b.jsx("circle",{cx:56,cy:17,r:7}),b.jsx("rect",{x:70,y:8,width:r-80,height:17,rx:4}),b.jsx("rect",{x:10,y:32,width:r-20,height:n-42,rx:4})]})]});case"person":return b.jsxs(b.Fragment,{children:[b.jsx("rect",{width:r,height:n,rx:6,strokeWidth:0}),b.jsx("svg",{x:r-ph.width-6,y:n-ph.height,width:ph.width,height:ph.height,viewBox:`0 0 ${ph.width} ${ph.height}`,"data-likec4-fill":"mix-stroke",children:b.jsx("path",{strokeWidth:0,d:ph.path})})]});case"queue":{const{path:o,rx:a,ry:i}=GJ(r,n);return b.jsxs(b.Fragment,{children:[b.jsx("path",{d:o,strokeWidth:2}),b.jsx("ellipse",{cx:a,cy:i,ry:i-.75,rx:a,"data-likec4-fill":"mix-stroke",strokeWidth:2})]})}case"storage":case"cylinder":{const{path:o,rx:a,ry:i}=XJ(r,n);return b.jsxs(b.Fragment,{children:[b.jsx("path",{d:o,strokeWidth:2}),b.jsx("ellipse",{cx:a,cy:i,ry:i,rx:a-.75,"data-likec4-fill":"mix-stroke",strokeWidth:2})]})}default:return Ga(e)}}function gXe({shape:e,w:r,h:n}){let o;switch(e){case"queue":o=b.jsx("path",{d:GJ(r,n).path});break;case"storage":case"cylinder":{o=b.jsx("path",{d:XJ(r,n).path});break}default:{o=b.jsx("rect",{x:-1,y:-1,width:r+2,height:n+2,rx:6});break}}return b.jsx("g",{className:"likec4-shape-outline",children:o})}function yXe({multiple:e,withOutLine:r}){return b.jsxs("div",{className:lQ({shapetype:"html"}),children:[e&&b.jsx("div",{className:"likec4-shape-multiple"}),r&&b.jsx("div",{className:"likec4-shape-outline"})]})}function gm({data:e,width:r,height:n,showSeletionOutline:o=!0}){let a=r&&r>10?r:e.width,i=n&&n>10?n:e.height;const s=e.style?.multiple??!1;if(e.shape==="rectangle")return b.jsx(yXe,{multiple:s,withOutLine:o});const l=lQ({shapetype:"svg"});return b.jsxs(b.Fragment,{children:[s&&b.jsx("svg",{className:l,"data-likec4-shape-multiple":"true",viewBox:`0 0 ${a} ${i}`,children:b.jsx(KJ,{shape:e.shape,w:a,h:i})}),b.jsxs("svg",{className:l,viewBox:`0 0 ${a} ${i}`,children:[o&&b.jsx(gXe,{shape:e.shape,w:a,h:i}),b.jsx(KJ,{shape:e.shape,w:a,h:i})]})]})}const mh=E.forwardRef(({value:e,textScale:r=1,uselikec4palette:n=!1,hideIfEmpty:o=!1,emptyText:a="no content",className:i,style:s,fontSize:l,...c},u)=>{if(e.isEmpty&&o)return null;const d=e.nonEmpty?e.isMarkdown?{dangerouslySetInnerHTML:{__html:e.html}}:{children:b.jsx("p",{children:e.text})}:{children:b.jsx(wt,{component:"span",fz:"xs",c:"dimmed",style:{userSelect:"none"},children:a})};return b.jsx(Vr,{ref:u,...c,className:Je(Tqe({uselikec4palette:n,value:e.isMarkdown?"markdown":"plaintext"}),i),style:{...s,...l&&{"--text-fz":`var(--font-sizes-${l}, var(--font-sizes-md))`},"--mantine-scale":r},...d})});mh.displayName="Markdown";const ZJ=E.forwardRef(({className:e,...r},n)=>b.jsx("div",{...r,ref:n,className:Je(e,Sqe(),"likec4-element")})),QJ=({data:e,...r})=>b.jsx(Vx,{element:e,...r}),JJ=E.forwardRef(({className:e,...r},n)=>b.jsx("div",{...r,className:Je(e,"likec4-element-node-content"),ref:n})),eee=E.forwardRef(({data:{title:e,style:r},className:n,...o},a)=>{const{size:i}=ex(r),s=i==="sm"||i==="xs";return b.jsx(wt,{component:"div",...o,className:Je(n,"likec4-element-title"),"data-likec4-node-title":"",lineClamp:s?2:3,ref:a,children:e})}),tee=E.forwardRef(({data:e,children:r,className:n,...o},a)=>{const i=e?.technology??r;return Sa(i)?b.jsx(wt,{component:"div",...o,className:Je(n,"likec4-element-technology"),"data-likec4-node-technology":"",ref:a,children:i}):null}),ree=E.forwardRef(({data:{description:e,style:r},className:n,...o},a)=>{if(!e?.nonEmpty)return null;const{size:i}=ex(r),s=i==="sm"||i==="xs";return b.jsx(mh,{...o,className:Je(n,"likec4-element-description"),"data-likec4-node-description":"",value:e,uselikec4palette:!0,hideIfEmpty:!0,maxHeight:e.isMarkdown?"8rem ":void 0,lineClamp:s?3:5,ref:a})});function ms({iconSize:e,data:r}){return b.jsxs(ZJ,{style:nV(e)?{"--likec4-icon-size":`${e}px`}:void 0,children:[b.jsx(QJ,{data:r}),b.jsxs(JJ,{children:[b.jsx(eee,{data:r}),b.jsx(tee,{data:r}),b.jsx(ree,{data:r})]})]})}ms.Root=ZJ,ms.Icon=QJ,ms.Content=JJ,ms.Title=eee,ms.Technology=tee,ms.Description=ree;const bXe=ye({position:"absolute",top:"0.5",right:"0.5",_shapeBrowser:{right:"[5px]"},_shapeCylinder:{top:"[14px]"},_shapeStorage:{top:"[14px]"},_shapeQueue:{top:"[1px]",right:"3"},_smallZoom:{display:"none"}});function FA({selected:e=!1,data:{hovered:r=!1},icon:n,onClick:o}){const a=Ta();return b.jsx(Vr,{className:Je(bXe,"details-button"),children:b.jsx(or,{className:Je("nodrag nopan",Ek({variant:"transparent"})),component:ps,initial:!1,style:{originX:.45,originY:.55},animate:r||e?{scale:1.2,opacity:.8}:{scale:1,opacity:.5},whileHover:{scale:1.4,opacity:1},whileTap:{scale:1.15},onClick:o,onDoubleClick:cn,children:n??b.jsx(BA,{stroke:1.8,style:{width:"75%"}})},a)})}const vXe=e=>{const r=Wt();return b.jsx(FA,{...e,onClick:n=>{n.stopPropagation(),r.openElementDetails(e.data.fqn)}})};function xXe(e){const{enableElementTags:r}=wr();return b.jsxs(mm,{layoutId:e.id,nodeProps:e,children:[b.jsx(gm,{...e}),b.jsx(ms,{...e}),r&&b.jsx(Ey,{...e}),b.jsx(vXe,{...e}),b.jsx(fXe,{...e}),b.jsx(kXe,{...e})]},e.id)}function wXe(e){const r=Wt();return b.jsxs($y,{layoutId:e.id,nodeProps:e,children:[b.jsx(Py,{...e}),b.jsx(WJ,{...e,onClick:n=>{n.stopPropagation(),r.openElementDetails(e.data.fqn)}}),b.jsx(_Xe,{...e})]},e.id)}const kXe=({data:{ports:e,height:r}})=>b.jsxs(b.Fragment,{children:[e.in.map((n,o)=>b.jsx(uo,{id:n,type:"target",position:tt.Left,style:{visibility:"hidden",top:`${15+(o+1)*((r-30)/(e.in.length+1))}px`}},n)),e.out.map((n,o)=>b.jsx(uo,{id:n,type:"source",position:tt.Right,style:{visibility:"hidden",top:`${15+(o+1)*((r-30)/(e.out.length+1))}px`}},n))]}),_Xe=({data:e})=>b.jsxs(b.Fragment,{children:[e.ports.in.map((r,n)=>b.jsx(uo,{id:r,type:"target",position:tt.Left,style:{visibility:"hidden",top:`${20*(n+1)}px`}},r)),e.ports.out.map((r,n)=>b.jsx(uo,{id:r,type:"source",position:tt.Right,style:{visibility:"hidden",top:`${20*(n+1)}px`}},r))]});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const EXe=[["path",{d:"M15 6l-6 6l6 6",key:"svg-0"}]],nee=yt("outline","chevron-left","ChevronLeft",EXe),SXe={element:xXe,compound:wXe,empty:aXe},CXe={relationship:nXe};function oee({actorRef:e}){const r=E.useRef(null);return r.current==null&&(r.current={initialNodes:[],initialEdges:[]}),b.jsx(DQ.Provider,{value:e,children:b.jsx(Mw,{...r.current,children:b.jsx(dm,{id:e.sessionId,inherit:!1,children:b.jsx(Pa,{children:b.jsx(NXe,{})})})})})}const TXe=e=>({isActive:e.hasTag("active"),nodes:e.context.xynodes,edges:e.context.xyedges}),AXe=(e,r)=>e.isActive===r.isActive&&Xn(e.nodes,r.nodes)&&Xn(e.edges,r.edges),NXe=E.memo(()=>{const e=Sy(),{isActive:r,nodes:n,edges:o}=Ok(TXe,AXe);return b.jsx(U9,{id:e.rootElementId,nodes:n,edges:o,className:Je(r?"initialized":"not-initialized","relationships-browser"),nodeTypes:SXe,edgeTypes:CXe,fitView:!1,onNodeClick:it((a,i)=>{a.stopPropagation(),e.send({type:"xyflow.nodeClick",node:i})}),onEdgeClick:it((a,i)=>{a.stopPropagation(),e.send({type:"xyflow.edgeClick",edge:i})}),onPaneClick:it(a=>{a.stopPropagation(),e.send({type:"xyflow.paneClick"})}),onDoubleClick:it(a=>{e.send({type:"xyflow.paneDblClick"})}),onViewportResize:it(()=>{e.send({type:"xyflow.resized"})}),onNodesChange:it(a=>{e.send({type:"xyflow.applyNodeChanges",changes:a})}),onEdgesChange:it(a=>{e.send({type:"xyflow.applyEdgeChanges",changes:a})}),onEdgeMouseEnter:it((a,i)=>{i.data.hovered||e.send({type:"xyflow.edgeMouseEnter",edge:i})}),onEdgeMouseLeave:it((a,i)=>{i.data.hovered&&e.send({type:"xyflow.edgeMouseLeave",edge:i})}),onSelectionChange:it(a=>{e.send({type:"xyflow.selectionChange",...a})}),nodesDraggable:!1,pannable:!0,zoomable:!0,children:b.jsx($Xe,{})})}),RXe=e=>({subjectId:e.context.subject,viewId:e.context.viewId,scope:e.context.scope,closeable:e.context.closeable}),$Xe=E.memo(()=>{const e=Sy(),{subjectId:r,viewId:n,scope:o,closeable:a}=Ok(RXe),i=pr(),s=up();E.useEffect(()=>{s.viewportInitialized&&e.send({type:"xyflow.init",instance:s,store:i})},[i,s.viewportInitialized,e]);const l=NWe(r,n,o),[c,u,{history:d,current:h}]=YV(r);E.useEffect(()=>{c!==r&&u.set(r)},[r]),E.useEffect(()=>{c!==r&&e.navigateTo(c)},[c,e]),HB(()=>{e.updateView(l)},[l,e]);const p=h>0,g=h+1u.back(),onStepForward:()=>u.forward()}),a&&b.jsx(ou,{position:"top-right",children:b.jsx(or,{variant:"default",color:"gray",onClick:y=>{y.stopPropagation(),e.close()},children:b.jsx(Hp,{})})})]})}),PXe=({hasStepBack:e,hasStepForward:r,onStepBack:n,onStepForward:o})=>b.jsx(ou,{position:"top-left",children:b.jsxs(Ur,{gap:4,wrap:"nowrap",children:[b.jsxs(Pa,{mode:"popLayout",children:[e&&b.jsx(cs.div,{layout:!0,initial:{opacity:.05,transform:"translateX(-5px)"},animate:{opacity:1,transform:"translateX(0)"},exit:{opacity:.05,transform:"translateX(-10px)"},children:b.jsx(or,{variant:"default",color:"gray",onClick:a=>{a.stopPropagation(),n()},children:b.jsx(nee,{})})},"back"),r&&b.jsx(cs.div,{layout:!0,initial:{opacity:.05,transform:"translateX(5px)"},animate:{opacity:1,transform:"translateX(0)"},exit:{opacity:0,transform:"translateX(5px)"},children:b.jsx(or,{variant:"default",color:"gray",onClick:a=>{a.stopPropagation(),o()},children:b.jsx(hh,{})})},"forward")]}),b.jsx(zWe,{})]})}),MXe=ye({display:"inline-block",fontSize:"sm",fontWeight:500,whiteSpace:"nowrap",padding:"[3px 6px]",borderRadius:3,background:"var(--likec4-palette-fill)/75",lineHeight:1.2,color:"var(--likec4-palette-hiContrast)"}),OXe=ye({_light:{background:"mantine.colors.gray[1]","&[data-missing":{}},"&[data-missing]":{color:"mantine.colors.orange[4]",background:"mantine.colors.orange[8]/15",borderColor:"mantine.colors.orange[5]/20",_light:{color:"mantine.colors.orange[8]"}}}),DXe=ye({flex:"1 1 100%",position:"relative",width:"100%",height:"100%",background:"mantine.colors.body",border:"1px solid {colors.mantine.colors.defaultBorder}",borderRadius:"sm",_light:{borderColor:"mantine.colors.gray[3]",background:"mantine.colors.gray[1]"}});ye({_before:{content:'"scope:"',position:"absolute",top:"0",left:"2",fontSize:"xxs",fontWeight:500,lineHeight:"1",color:"mantine.colors.dimmed",opacity:.85,transform:"translateY(-100%) translateY(-2px)"},_light:{"& .mantine-SegmentedControl-root":{background:"mantine.colors.gray[3]"}}}),ye({display:"inline-block",fontSize:"xl",fontWeight:600,padding:"[1px 5px]",minWidth:24,textAlign:"center",borderRadius:"sm",background:"mantine.colors.dark[7]",color:"mantine.colors.defaultColor","&[data-zero]":{color:"mantine.colors.dimmed"},"&[data-missing]":{color:"mantine.colors.orange[4]",background:"mantine.colors.orange[8]/20"}});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const LXe=[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M13 18l6 -6",key:"svg-1"}],["path",{d:"M13 6l6 6",key:"svg-2"}]],ym=yt("outline","arrow-right","ArrowRight",LXe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const IXe=[["path",{d:"M12 6h-6a2 2 0 0 0 -2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-6",key:"svg-0"}],["path",{d:"M11 13l9 -9",key:"svg-1"}],["path",{d:"M15 4h5v5",key:"svg-2"}]],aee=yt("outline","external-link","ExternalLink",IXe),zXe=po.withProps({color:"dark",fz:"xs",openDelay:600,closeDelay:120,label:"",children:null,offset:8,withinPortal:!1});function jXe({node:e,element:r}){const n=VX(),o=kqe(),a=wn(o,d=>d.children[`${o.id}-relationships`]),i=[...r.incoming()].map(d=>d.id),s=[...r.outgoing()].map(d=>d.id),l=e?Y6([...e.incoming()].flatMap(d=>d.$edge.relations)):[],c=e?Y6([...e.outgoing()].flatMap(d=>d.$edge.relations)):[],u=[...i,...s].filter(d=>!l.includes(d)&&!c.includes(d)).length;return b.jsxs(ra,{gap:"xs",pos:"relative",w:"100%",h:"100%",children:[i.length+s.length>0&&b.jsxs(Ur,{gap:"xs",wrap:"nowrap",align:"center",children:[b.jsx(Se,{children:b.jsxs(Ur,{gap:8,mb:4,wrap:"nowrap",children:[b.jsx(iee,{title:"incoming",total:i.length,included:l.length}),b.jsx(ci,{size:"sm",variant:"transparent",c:"dimmed",children:b.jsx(ym,{style:{width:16}})}),b.jsx(wt,{className:MXe,children:g0(r.id)}),b.jsx(ci,{size:"sm",variant:"transparent",c:"dimmed",children:b.jsx(ym,{style:{width:16}})}),b.jsx(iee,{title:"outgoing",total:s.length,included:c.length})]})}),u>0&&b.jsx(zXe,{label:"Current view does not include some relationships",children:b.jsxs(Ur,{mt:"xs",gap:6,c:"orange",style:{cursor:"pointer"},children:[b.jsx(F9,{style:{width:14}}),b.jsxs(wt,{fz:"sm",children:[u," relationship",u>1?"s are":" is"," hidden"]})]})})]}),b.jsx(Se,{className:DXe,children:a&&b.jsxs(b.Fragment,{children:[b.jsx(oee,{actorRef:a}),b.jsx(Se,{pos:"absolute",top:12,right:12,children:b.jsx(or,{size:"md",variant:"default",radius:"sm",onClick:d=>{d.stopPropagation();const{subject:h,scope:p,viewId:g}=a.getSnapshot().context;n.send({type:"open.relationshipsBrowser",subject:h,scope:p,viewId:g})},children:b.jsx(aee,{stroke:1.6,style:{width:"70%"}})})})]})})]})}function iee({title:e,total:r,included:n}){return b.jsx(Rp,{withBorder:!0,shadow:"none",className:OXe,px:"md",py:"xs",radius:"md",mod:{zero:r===0,missing:r!==n},children:b.jsxs(ra,{gap:4,align:"flex-end",children:[b.jsx(wt,{component:"div",c:r!==n?"orange":"dimmed",tt:"uppercase",fw:600,fz:10,lh:1,children:e}),b.jsx(wt,{fw:600,fz:"xl",component:"div",lh:1,children:r!==n?b.jsxs(b.Fragment,{children:[n," / ",r]}):b.jsx(b.Fragment,{children:r})})]})})}const BXe=ye({marginTop:"sm",marginBottom:"sm"}),FXe=ye({display:"inline-flex",transition:"fast",border:"1px dashed",borderColor:"mantine.colors.defaultBorder",borderRadius:"sm",px:"md",py:"xs",alignItems:"center",cursor:"pointer",color:"mantine.colors.gray[7]",_dark:{color:"mantine.colors.dark[1]"},"& > *":{transition:"fast"},_hover:{transitionTimingFunction:"out",borderStyle:"solid",color:"mantine.colors.defaultColor",background:"mantine.colors.defaultHover","& > *":{transitionTimingFunction:"out",transform:"translateX(1px)"}}}),HA=({element:e})=>b.jsx(Se,{className:FXe,children:b.jsx(wt,{component:"div",fz:"sm",fw:"500",children:e.title})}),HXe=()=>{};function UXe({element:e}){const r=Y1({multiple:!1});r.setHoveredNode=HXe;const n=E.useMemo(()=>{let o=1;const a=s=>({label:s,value:`msg${o++}`,type:"message",children:[]}),i={label:b.jsx(HA,{type:"current",element:e}),value:e.id,element:e,type:"current",children:[...e.children()].map(s=>({label:b.jsx(HA,{type:"descedant",element:s}),value:s.id,element:s,type:"descedant",children:[]}))};return i.children.length===0&&i.children.push(a(b.jsx(U3,{radius:"sm",children:"no nested"}))),[[...e.ancestors()].reduce((s,l)=>({label:b.jsx(HA,{type:"ancestor",element:l}),value:l.id,element:l,type:"ancestor",children:[s]}),i)]},[e]);return E.useEffect(()=>{r.expandAllNodes()},[n]),b.jsxs(b.Fragment,{children:[b.jsxs(M3,{variant:"light",color:"orange",title:"In development",icon:b.jsx(F9,{}),children:["We need your feedback. Share your thoughts and ideas -"," ",b.jsx(rT,{fz:"sm",fw:500,underline:"hover",c:"orange",href:"https://github.com/likec4/likec4/discussions/",target:"_blank",children:"GitHub discussions"})]}),b.jsx(Bp,{levelOffset:"xl",allowRangeSelection:!1,expandOnClick:!1,expandOnSpace:!1,classNames:{label:BXe},data:n,tree:r})]})}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const VXe=[["path",{d:"M12 4l-8 4l8 4l8 -4l-8 -4",key:"svg-0"}],["path",{d:"M4 12l8 4l8 -4",key:"svg-1"}],["path",{d:"M4 16l8 4l8 -4",key:"svg-2"}]],UA=yt("outline","stack-2","Stack2",VXe),see=Lp.withProps({mb:8,labelPosition:"left",variant:"dashed"}),lee=po.withProps({color:"dark",fz:"xs",openDelay:400,closeDelay:150,label:"",children:null,offset:4}),cee=wt.withProps({component:"div",fz:11,fw:500,c:"dimmed",lh:1}),My=wt.withProps({component:"div",fz:"xs",c:"dimmed",className:vYe}),bm=24,qXe=["Properties","Relationships","Views","Structure","Deployments"];function YXe({viewId:e,fromNode:r,rectFromNode:n,fqn:o,onClose:a}){const[i,s]=E.useState(!1),l=_Pe(),c=l.width||window.innerWidth||1200,u=l.height||window.innerHeight||800,[d,h]=bPe({key:"likec4:element-details:active-tab",defaultValue:"Properties"}),p=Wt(),g=NQ(),y=r?g.findNode(r):g.findNodeWithElement(o),x=g.$model.element(o),[w,k]=yn([...x.views()],Ao(Q=>Q.$view),sV(Q=>Q._type==="element"&&Q.viewOf===o));let C=y?.navigateTo?.$view??x.defaultView?.$view??null;C?.id===e&&(C=null);const _=zw(x.links),T=wqe(),A=(y?.$node.children?.length??0)>0,N=Math.min(700,c-bm*2),$=Math.min(650,u-bm*2),R=n?{x:n.x+(A?n.width-N/2:n.width/2),y:n.y+(A?0:n.height/2)}:{x:c/2,y:u/2},M=n?Math.min(n.width/N,n.height/$,.9):1,O=Math.round(Ki(R.x-N/2,{min:bm,max:c-N-bm})),B=Math.round(Ki(R.y-(A?0:60),{min:bm,max:u-$-bm})),I=Ki((R.x-O)/N,{min:.1,max:.9}),Y=Ki((R.y-B)/$,{min:.1,max:.9}),D=KZ(N),V=KZ($);$k(()=>{D.set(N),V.set($)},[N,$]);const L=E.useCallback((Q,z)=>{D.set(Math.max(D.get()+z.delta.x,320)),V.set(Math.max(V.get()+z.delta.y,300))},[]),U=E.useRef(null),q=Kf(a),X=qx(()=>{q.current()},[],50),F=y?.$node.notation??null,J=Vx({element:{id:o,title:x.title,icon:y?.icon??x.icon},className:dYe});return Wx(()=>{U.current?.open||U.current?.showModal()},20),Wx(()=>{s(!0)},220),b.jsx(cs.dialog,{ref:U,className:Je(sYe,S1.classNames.fullWidth),layout:!0,initial:{[Tk]:"0px",[Ak]:"5%"},animate:{[Tk]:"3px",[Ak]:"60%"},exit:{[Tk]:"0px",[Ak]:"0%",transition:{duration:.1}},onClick:Q=>{Q.stopPropagation(),Q.target?.nodeName?.toUpperCase()==="DIALOG"&&U.current?.close()},onDoubleClick:cn,onPointerDown:cn,onClose:Q=>{Q.stopPropagation(),X()},children:b.jsx(S1,{forwardProps:!0,removeScrollBar:!1,children:b.jsxs(cs.div,{layout:!0,layoutRoot:!0,drag:!0,dragControls:T,dragElastic:0,dragMomentum:!1,dragListener:!1,"data-likec4-color":y?.color??x.color,className:lYe,initial:{top:B,left:O,width:N,height:$,opacity:0,originX:I,originY:Y,scale:Math.max(M,.65)},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9,translateY:-10,transition:{duration:.1}},style:{width:D,height:V},children:[b.jsxs("div",{className:cYe,onPointerDown:Q=>T.start(Q),children:[b.jsxs(xn,{alignItems:"start",justify:"space-between",gap:"sm",mb:"sm",flexWrap:"nowrap",children:[b.jsxs(xn,{alignItems:"start",gap:"sm",style:{cursor:"default"},flexWrap:"nowrap",children:[J,b.jsxs("div",{children:[b.jsx(wt,{component:"div",className:uYe,children:x.title}),F&&b.jsx(wt,{component:"div",c:"dimmed",fz:"sm",fw:500,lh:1.3,lineClamp:1,children:F})]})]}),b.jsx(Kd,{size:"lg",onClick:Q=>{Q.stopPropagation(),X()}})]}),b.jsxs(xn,{alignItems:"baseline",gap:"sm",flexWrap:"nowrap",children:[b.jsxs("div",{children:[b.jsx(cee,{children:"kind"}),b.jsx(Gl,{radius:"sm",size:"sm",fw:600,color:"gray",style:{cursor:"pointer"},onClick:Q=>{Q.stopPropagation(),p.openSearch(`kind:${x.kind}`)},children:x.kind})]}),b.jsxs("div",{style:{flex:1},children:[b.jsx(cee,{children:"tags"}),b.jsxs(Op,{gap:4,flex:1,mt:6,wrap:"wrap",children:[x.tags.map(Q=>b.jsx(Ck,{tag:Q,cursor:"pointer",onClick:z=>{z.stopPropagation(),p.openSearch(`#${Q}`)}},Q)),x.tags.length===0&&b.jsx(Gl,{radius:"sm",size:"sm",fw:600,color:"gray",children:"—"})]})]}),b.jsxs(T3,{style:{alignSelf:"flex-start"},children:[_&&b.jsx(or,{component:"a",href:_.url,target:"_blank",size:"lg",variant:"default",radius:"sm",children:b.jsx(aee,{stroke:1.6,style:{width:"65%"}})}),b.jsx(HWe,{feature:"Vscode",children:b.jsx(lee,{label:"Open source",children:b.jsx(or,{size:"lg",variant:"default",radius:"sm",onClick:Q=>{Q.stopPropagation(),p.openSource({element:x.id})},children:b.jsx(pm,{stroke:1.8,style:{width:"62%"}})})})}),C&&b.jsx(lee,{label:"Open default view",children:b.jsx(or,{size:"lg",variant:"default",radius:"sm",onClick:Q=>{Q.stopPropagation(),p.navigateTo(C.id,r??void 0)},children:b.jsx(gi,{style:{width:"70%"}})})})]})]})]}),b.jsxs(Jd,{value:d,onChange:Q=>h(Q),variant:"none",classNames:{root:pYe,list:mYe,tab:gYe,panel:yYe},children:[b.jsx(q1,{children:qXe.map(Q=>b.jsx(jp,{value:Q,children:Q},Q))}),b.jsx(Zl,{value:"Properties",children:b.jsx(os,{scrollbars:"y",type:"scroll",offsetScrollbars:!0,children:b.jsxs(Se,{className:bYe,pt:"xs",children:[x.hasSummary&&b.jsxs(b.Fragment,{children:[b.jsx(My,{children:"summary"}),b.jsx(mh,{value:x.summary})]}),b.jsxs(b.Fragment,{children:[b.jsx(My,{children:"description"}),b.jsx(mh,{value:x.description,emptyText:"no description"})]}),x.technology&&b.jsx(WXe,{title:"technology",children:x.technology}),x.links.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(My,{children:"links"}),b.jsx(xn,{gap:"xs",flexWrap:"wrap",children:x.links.map((Q,z)=>b.jsx(j9,{value:Q},z))})]}),x.$element.metadata&&b.jsx(XXe,{value:x.$element.metadata})]})})}),b.jsx(Zl,{value:"Relationships",children:b.jsx(fh,{overrides:{enableRelationshipBrowser:!1,enableNavigateTo:!1},children:i&&d==="Relationships"&&b.jsx(jXe,{element:x,node:y??null})})}),b.jsx(Zl,{value:"Views",children:b.jsx(os,{scrollbars:"y",type:"auto",children:b.jsxs(ra,{gap:"lg",children:[w.length>0&&b.jsxs(Se,{children:[b.jsx(see,{label:"views of the element (scoped)"}),b.jsx(ra,{gap:"sm",children:w.map(Q=>b.jsx(uee,{view:Q,onNavigateTo:z=>p.navigateTo(z,r??void 0)},Q.id))})]}),k.length>0&&b.jsxs(Se,{children:[b.jsx(see,{label:"views including this element"}),b.jsx(ra,{gap:"sm",children:k.map(Q=>b.jsx(uee,{view:Q,onNavigateTo:z=>p.navigateTo(z,r??void 0)},Q.id))})]})]})})}),b.jsx(Zl,{value:"Structure",children:b.jsx(os,{scrollbars:"y",type:"auto",children:b.jsx(UXe,{element:x})})}),b.jsx(Zl,{value:"Deployments",children:b.jsx(os,{scrollbars:"y",type:"auto",children:b.jsx(PYe,{elementFqn:x.id})})})]}),b.jsx(cs.div,{className:xYe,drag:!0,dragElastic:0,dragMomentum:!1,onDrag:L,dragConstraints:{top:0,left:0,right:0,bottom:0}})]})})})}const uee=({view:e,onNavigateTo:r})=>b.jsx(Pr,{className:hYe,onClick:n=>r(e.id,n),children:b.jsxs(Ur,{gap:6,align:"start",wrap:"nowrap",children:[b.jsx(ci,{size:"sm",variant:"transparent",children:e._type==="deployment"?b.jsx(UA,{stroke:1.8}):b.jsx(gi,{stroke:1.8})}),b.jsx(Se,{children:b.jsx(wt,{component:"div",className:fYe,lineClamp:1,children:e.title||"untitled"})})]})});function WXe({title:e,emptyValue:r="undefined",children:n,style:o,...a}){return b.jsxs(b.Fragment,{children:[b.jsx(My,{children:e}),b.jsx(wt,{component:"div",...rV(n)&&{c:"dimmed"},fz:"md",style:{whiteSpace:"preserve-breaks",userSelect:"all",...o},...a,children:n||r})]})}function XXe({value:e}){return b.jsxs(b.Fragment,{children:[b.jsx(My,{children:"metadata"}),b.jsx(Se,{className:ye({flex:1,display:"grid",gridTemplateColumns:"min-content 1fr",gridAutoRows:"min-content max-content",gap:"[4px 4px]",alignItems:"baseline",justifyItems:"stretch",paddingRight:"xxs"}),children:B6(e).map(([r,n])=>b.jsxs("div",{style:{display:"contents"},className:"group",children:[b.jsxs("div",{className:ye({fontSize:"sm",fontWeight:500,justifySelf:"end",whiteSpace:"nowrap"}),children:[r,":"]}),b.jsx("div",{className:ye({}),children:b.jsx(os.Autosize,{type:"auto",mah:200,classNames:{root:ye({transitionProperty:"all",transitionDuration:"fast",transitionTimingFunction:"inOut",rounded:"sm",color:"mantine.colors.gray[8]",_dark:{color:"mantine.colors.dark[1]"},_groupHover:{transitionTimingFunction:"out",color:"mantine.colors.defaultColor",background:"mantine.colors.defaultHover"}}),viewport:ye({overscrollBehavior:"none"})},children:b.jsx("div",{className:ye({fontSize:"sm",padding:"xxs",whiteSpace:"pre",fontFamily:"mono",userSelect:"all"}),children:n})})})]},r))})]})}function GXe({actorRef:e,onClose:r}){const n=wn(e,it(o=>({viewId:o.context.currentView.id,fromNode:o.context.initiatedFrom.node,rectFromNode:o.context.initiatedFrom.clientRect,fqn:o.context.subject})),Xn);return b.jsx(S9.Provider,{value:e,children:b.jsx(YXe,{onClose:r,...n})})}const Uk="--_blur",Vk="--_opacity",KXe="--_level",Oy=E.forwardRef(({onClose:e,className:r,classes:n,overlayLevel:o=0,children:a,fullscreen:i=!1,withBackdrop:s=!0,backdrop:l,openDelay:c=130,...u},d)=>{const[h,p]=E.useState(c===0),g=IV(h),y=E.useRef(null),x=E.useRef(!1),w=ZZ()!==!0,k=E.useRef(e);k.current=e;const C=qx(()=>{x.current||(x.current=!0,k.current())},[],50);E.useLayoutEffect(()=>{y.current?.open||y.current?.showModal()},[]),Wx(()=>{p(!0)},c>0?c:void 0);const _=Nqe({fullscreen:i,withBackdrop:s});let T=o>0?"50%":"60%";return l?.opacity!==void 0&&(T=`${l.opacity*100}%`),b.jsx(cs.dialog,{ref:Rr(y,g,d),className:Je(n?.dialog,r,_,i&&S1.classNames.fullWidth),layout:!0,style:{[KXe]:o},...w?{initial:{[Uk]:"0px",[Vk]:"0%",scale:.95,originY:0,translateY:-20,opacity:0},animate:{[Uk]:o>0?"4px":"8px",[Vk]:T,scale:1,opacity:1,translateY:0,transition:{delay:.075}},exit:{opacity:0,scale:.98,translateY:-20,transition:{duration:.1},[Uk]:"0px",[Vk]:"0%"}}:{initial:{[Uk]:"8px",[Vk]:T}},onClick:A=>{if(A.stopPropagation(),A.target?.nodeName?.toUpperCase()==="DIALOG"){y.current?.close();return}},onCancel:A=>{A.preventDefault(),A.stopPropagation(),C()},onDoubleClick:cn,onPointerDown:cn,onClose:A=>{A.stopPropagation(),C()},...u,children:b.jsx(S1,{forwardProps:!0,children:b.jsx("div",{className:Je(n?.body,"likec4-overlay-body"),children:h&&b.jsx(b.Fragment,{children:a})})})})});Oy.displayName="Overlay";const qk=(e,r)=>e.size>2&&r.size!==e.size?new Set(qc([...zx(e).flatten(),...r])):e.size>1?new Set(qc([...e])):e;function ZXe(e,r){const n=new Set,o=new Set,a=new Set,i={sources:new Set,targets:new Set},s=(l,c)=>{c==="source"?(n.add(l),i.sources.add(l)):(a.add(l),i.targets.add(l))};for(const l of e){const c=r.findEdge(l),u=c?[...c.relationships("model")]:[];if(!c||!To(u,1)||!c.source.hasElement()||!c.target.hasElement())continue;const d=c.source.element,h=c.target.element;s(d,"source"),s(h,"target");for(const p of u){if(o.add(p),p.source!==d){s(p.source,"source");for(const g of p.source.ancestors()){if(g===d)break;n.add(g)}}if(p.target!==h){s(p.target,"target");for(const g of p.target.ancestors()){if(g===h)break;a.add(g)}}}}return{sources:qk(n,i.sources),targets:qk(a,i.targets),relationships:o}}function QXe({source:e,target:r}){const n=new Set,o=new Set,a=new Set,i={sources:new Set,targets:new Set},s=(c,u)=>{u==="source"?(n.add(c),i.sources.add(c)):(a.add(c),i.targets.add(c))};e&&s(e,"source"),r&&s(r,"target");const[l]=Z4e.findConnection(e,r,"directed");if(!l)return{sources:n,targets:a,relationships:o};for(const c of l.relations){const u=c.source,d=c.target;if(s(u,"source"),s(d,"target"),o.add(c),e!==u){nt(Un(e,u),`${e.id} is not an ancestor of ${u.id}`);for(const h of u.ancestors()){if(h===e)break;n.add(h)}}if(r!==d){nt(Un(r,d),`${r.id} is not an ancestor of ${d.id}`);for(const h of d.ancestors()){if(h===r)break;a.add(h)}}}return{sources:qk(n,i.sources),targets:qk(a,i.targets),relationships:o}}const dee=E.createContext(null);function VA(){return mt(E.useContext(dee),"No RelationshipDetailsActorContext")}function hee(e,r=Xn){const n=it(e),o=VA();return wn(o,n,r)}function qA(){const e=VA();return E.useMemo(()=>({actor:e,get rootElementId(){return`relationship-details-${e.sessionId.replaceAll(":","_")}`},getState:()=>e.getSnapshot().context,send:e.send,navigateTo:(...r)=>{r.length===1?e.send({type:"navigate.to",params:{edgeId:r[0]}}):e.send({type:"navigate.to",params:{source:r[0],target:r[1]}})},fitDiagram:()=>{e.send({type:"fitDiagram"})},close:()=>{e._parent?e._parent?.send({type:"close",actorId:e.id}):e.send({type:"close"})}}),[e])}const gs={dagre:{ranksep:60,nodesep:35,edgesep:25},edgeLabel:{width:220,height:14},nodeWidth:330,nodeHeight:180,compound:{labelHeight:2,paddingTop:50,paddingBottom:32}};function JXe(){const e=new Lk.graphlib.Graph({directed:!0,compound:!0,multigraph:!0});return e.setGraph({...gs.dagre,rankdir:"LR"}),e.setDefaultEdgeLabel(()=>({...gs.edgeLabel})),e.setDefaultNodeLabel(()=>({})),e}const YA="-port";function fee(e,r,n){const o=new lo(i=>({id:`${e}-${i}`,portId:`${e}-${i}`})),a=zx(r);for(const i of a.sorted){const s=a.children(i).length>0,l=i.id,c=`${e}-${l}`,u=s?`${c}${YA}`:c;o.set(l,{id:c,portId:u}),n.setNode(c,{column:e,element:i,isCompound:s,portId:u,inPorts:[],outPorts:[],width:gs.nodeWidth,height:gs.nodeHeight}),s&&(n.setNode(u,{element:i,portId:u,isCompound:s,inPorts:[],outPorts:[],width:gs.nodeWidth-gs.dagre.ranksep,height:gs.compound.labelHeight}),n.setParent(u,c));const d=a.parent(i);d&&n.setParent(c,`${e}-${d.id}`)}return{...a,byId:i=>{const s=a.byId(i),l=o.get(s.id);return{element:s,graph:l}},graphNodes:o}}function eGe(e){return Lk.layout(e,{}),r=>{const n=e.node(r),{x:o,y:a,width:i,height:s}=n;return{position:{x:o-Math.round(i/2),y:a-Math.round(s/2)},width:i,height:s}}}function tGe(e,r){const n=JXe(),o=fee("sources",e.sources,n),a=fee("targets",e.targets,n),i=Array.from(e.relationships).map(k=>{const C=o.byId(k.source.id).graph,_=a.byId(k.target.id).graph,T=k.id;return n.node(C.id).outPorts.push(_.id),n.node(_.id).inPorts.push(C.id),n.setEdge(C.portId,_.portId,{...gs.edgeLabel},T),{name:T,source:C.id,sourceHandle:C.id+"_out"+(n.node(C.id).outPorts.length-1),target:_.id,targetHandle:_.id+"_in"+(n.node(_.id).inPorts.length-1),relationship:k}}),s=[...o.graphNodes.values(),...a.graphNodes.values()];for(const{id:k}of s){const C=n.node(k);if(C.isCompound)continue;const _=Math.max(n.inEdges(k)?.length??0,n.outEdges(k)?.length??0);_>3&&(C.height=C.height+(_-4)*14)}const l=n.edgeCount();if(l>5)for(const k of n.edges())n.setEdge(k,{...gs.edgeLabel,width:l>10?800:400});const c=eGe(n),u=yn(s,dp(k=>k.id===k.portId),E1(k=>[k.id,c(k.id)]));function d(k){return u[k]??=yn(n.children(k)??[],dp(C=>!C.endsWith(YA)),Ao(C=>d(C)),uV(C=>{nt(C.length>0,`Node ${k} has no nested nodes`)}),fp((C,_)=>({minY:Math.min(C.minY,_.position.y),maxY:Math.max(C.maxY,_.position.y+_.height)}),{minY:1/0,maxY:-1/0}),({minY:C,maxY:_})=>{const{position:{x:T},width:A}=c(k);return C=C-gs.compound.paddingTop,_=_+gs.compound.paddingBottom,{position:{x:T,y:C},width:A,height:_-C}})}function h(k){const C=n.parent(k);return C?h(C)+1:0}function p(k){const C=n.children(k)??[];return C.length===0?0:1+Math.max(...C.map(p))}const g=(k,C,_)=>yn(_,Ao((T,A)=>({port:k+"_"+C+A,topY:d(T).position.y})),jw(Ca("topY")),Ao(Ca("port")));let y=0,x=0;const w=s.map(({id:k})=>{const{element:C,inPorts:_,outPorts:T,column:A}=n.node(k);let{position:N,width:$,height:R}=d(k);const M=n.parent(k),O=(n.children(k)??[]).filter(V=>!V.endsWith(YA));y=Math.min(y,N.x),x=Math.min(x,N.y);const B=r?G0(C.scopedViews(),V=>V.id!==r.id)?.id??null:null,I=r?.findNodeWithElement(C.id),Y=r&&!I?G0(C.ancestors(),V=>!!r.findNodeWithElement(V.id))?.id:null,D=I??(Y&&r?.findNodeWithElement(Y));return V0({id:k,parent:M??null,x:N.x,y:N.y,title:C.title,description:C.summary,technology:C.technology,tags:[...C.tags],links:null,color:D?.color??C.color,shape:I?.shape??C.shape,icon:I?.icon??C.icon??"none",modelRef:C.id,kind:C.kind,level:h(k),labelBBox:{x:N.x,y:N.y,width:$,height:R},style:Vd({...(I??D)?.style,...C.$element.style},["shape","color","icon"]),navigateTo:B,...O.length>0&&{depth:p(k)},children:O,width:$,height:R,column:A,ports:{in:g(k,"in",_),out:g(k,"out",T)}})});return{bounds:{x:Math.min(y,0),y:Math.min(x,0),width:n.graph().width??100,height:n.graph().height??100},nodes:w,edges:n.edges().reduce((k,C)=>{const _=n.edge(C),T=C.name;if(!T)return k;const{name:A,source:N,target:$,relationship:R,sourceHandle:M,targetHandle:O}=Iw(i,V=>V.name===T),B=R.title??"untitled",I=R.navigateTo?.id??null,Y=R.description??null,D=R.technology??null;return k.push({id:A,source:N,sourceHandle:M,target:$,targetHandle:O,label:B,color:R.color,...I&&{navigateTo:I},...Y&&{description:Y},...D&&{technology:D},points:_.points.map(V=>[V.x,V.y]),line:R.line,relationId:R.id,parent:null}),k},[])}}const WA=ye.raw({display:"inline-flex",alignItems:"center",padding:"[6px 2px 0 2px]","& .mantine-Text-root":{color:"mantine.colors.text/90",fontSize:"xs",fontWeight:500,lineHeight:"1.2"}}),pee=ye({paddingLeft:"1",gridColumn:1},WA),rGe=ye({gridColumn:2},WA),mee=ye({gridColumn:3,paddingRight:"1"},WA),gee="likec4-edge-label",nGe=Je(gee,ye({display:"grid",gridColumnStart:1,gridColumnEnd:4,borderBottom:"1px solid",borderBottomColor:"mantine.colors.defaultBorder",marginBottom:"0",padding:"[0 4px 5px 4px]",width:"100%","& .mantine-Text-root":{fontSize:"xxs",fontWeight:400,lineHeight:"xs",color:"mantine.colors.dimmed"}})),oGe=ye({display:"contents",[`&:last-child .${gee}`]:{borderBottom:"none",marginBottom:"0"},"& > *":{transition:"all 0.15s ease-in"},"&:is(:hover, [data-selected=true]) > *":{transition:"all 0.15s ease-out",cursor:"pointer",backgroundColor:"mantine.colors.defaultHover"}}),aGe=ye({display:"grid",gridTemplateColumns:"1fr 30px 1fr",gridAutoRows:"min-content max-content",gap:"0",alignItems:"stretch"});ye({display:"grid",gridTemplateColumns:"min-content 1fr",gridAutoRows:"min-content max-content",gap:"[10px 12px]",alignItems:"baseline",justifyItems:"start"});const iGe=ye({maxHeight:["70vh","calc(100cqh - 70px)"]}),sGe=({edge:e,view:r})=>{const n=qA(),o=E.useRef(null),a=r.nodes.find(l=>l.id===e.source),i=r.nodes.find(l=>l.id===e.target),s=r.edges.flatMap(l=>{const c=r.nodes.find(d=>d.id===l.source),u=r.nodes.find(d=>d.id===l.target);return c&&u?{id:l.id,source:c,target:u,label:l.label}:[]});return!a||!i||s.length===0?null:b.jsxs(mr,{position:"bottom-start",shadow:"md",keepMounted:!0,withinPortal:!1,closeOnClickOutside:!0,clickOutsideEvents:["pointerdown","mousedown","click"],onOpen:()=>{setTimeout(()=>{o.current?.querySelector(`[data-edge-id="${e.id}"]`)?.scrollIntoView({behavior:"instant",block:"nearest"})},100)},children:[b.jsx(pu,{children:b.jsxs(Zn,{size:"xs",variant:"default",fw:"500",style:{padding:"0.25rem 0.75rem"},rightSection:b.jsx(LA,{size:16}),children:[b.jsx(Se,{className:pee,maw:160,p:0,mod:{"likec4-color":a.color},children:b.jsx(wt,{component:"span",truncate:!0,children:a.title})}),b.jsx(ci,{color:"dark",variant:"transparent",size:"xs",children:b.jsx(ym,{style:{width:"80%"}})}),b.jsx(Se,{className:mee,maw:160,p:0,mod:{"likec4-color":i.color},children:b.jsx(wt,{component:"span",truncate:!0,children:i.title})})]})}),b.jsx(Xl,{p:0,miw:250,maw:400,children:b.jsx(ta,{className:iGe,scrollbars:"y",type:"never",viewportRef:o,children:b.jsx(Se,{className:aGe,p:"xs",maw:400,children:s.map(l=>b.jsxs("div",{className:oGe,"data-selected":l.id===e.id,onClick:c=>{c.stopPropagation(),n.navigateTo(l.id)},children:[b.jsx(Se,{className:pee,mod:{"edge-id":l.id,"likec4-color":l.source.color},children:b.jsx(wt,{component:"span",truncate:!0,children:l.source.title})}),b.jsx(Se,{className:rGe,children:b.jsx(ci,{color:"dark",variant:"transparent",size:"xs",children:b.jsx(ym,{style:{width:"80%"}})})}),b.jsx(Se,{className:mee,mod:{"likec4-color":l.target.color},children:b.jsx(wt,{component:"span",truncate:!0,children:l.target.title})}),b.jsx(Se,{className:nGe,children:b.jsx(wt,{component:"span",truncate:!0,children:l.label||"untitled"})})]},l.id))})})})]})},lGe=IA(e=>{const{enableNavigateTo:r}=wr(),{data:{navigateTo:n}}=e,[o,a,i]=kw(e),s=Wt();return b.jsxs(Ay,{...e,children:[b.jsx(Ny,{edgeProps:e,svgPath:o}),b.jsx(Bk,{edgeProps:e,labelPosition:{x:a,y:i,translate:"translate(-50%, 0)"},style:{maxWidth:Math.abs(e.targetX-e.sourceX-100)},children:b.jsx(Ty,{edgeProps:e,children:r&&n&&b.jsx(jk,{...e,onClick:l=>{l.stopPropagation(),s.navigateTo(n)}})})})]})}),cGe=e=>{const{enableNavigateTo:r,enableVscode:n}=wr(),o=Wt(),a=Fk(),i=[],{navigateTo:s,fqn:l}=e.data;return s&&r&&a!==s&&i.push({key:"navigate",icon:b.jsx(gi,{}),onClick:c=>{c.stopPropagation(),o.navigateTo(s)}}),l&&i.push({key:"relationships",icon:b.jsx(Ry,{}),onClick:c=>{c.stopPropagation(),o.openRelationshipsBrowser(l)}}),l&&n&&i.push({key:"goToSource",icon:b.jsx(pm,{}),onClick:c=>{c.stopPropagation(),o.openSource({element:l})}}),b.jsx(Hk,{buttons:i,...e})};function uGe(e,r){return e.id===r.id&&ut(e.selected??!1,r.selected??!1)&&ut(e.dragging??!1,r.dragging??!1)&&ut(e.width??0,r.width??0)&&ut(e.height??0,r.height??0)&&ut(e.zIndex??0,r.zIndex??0)&&ut(e.data,r.data)}const yee=Symbol.for("isMemoized");function ic(e){if(e.hasOwnProperty(yee))return e;const r=E.memo(e,uGe);return r.displayName="Node",Object.defineProperty(r,yee,{enumerable:!1,writable:!1,value:!0}),r}const bee=e=>{const r=Wt();return b.jsx(FA,{...e,onClick:n=>{n.stopPropagation(),r.openElementDetails(e.data.fqn)}})},dGe=ic(e=>{const{enableElementTags:r}=wr();return b.jsxs(mm,{nodeProps:e,children:[b.jsx(gm,{...e}),b.jsx(ms,{...e}),r&&b.jsx(Ey,{...e}),b.jsx(bee,{...e}),b.jsx(cGe,{...e}),b.jsx(fGe,{...e})]})}),hGe=ic(e=>b.jsxs($y,{nodeProps:e,children:[b.jsx(bee,{...e}),b.jsx(Py,{...e}),b.jsx(pGe,{...e})]})),fGe=({data:{ports:e,height:r}})=>b.jsxs(b.Fragment,{children:[e.in.map((n,o)=>b.jsx(uo,{id:n,type:"target",position:tt.Left,style:{visibility:"hidden",top:`${15+(o+1)*((r-30)/(e.in.length+1))}px`}},n)),e.out.map((n,o)=>b.jsx(uo,{id:n,type:"source",position:tt.Right,style:{visibility:"hidden",top:`${15+(o+1)*((r-30)/(e.out.length+1))}px`}},n))]}),pGe=({data:e})=>b.jsxs(b.Fragment,{children:[e.ports.in.map((r,n)=>b.jsx(uo,{id:r,type:"target",position:tt.Left,style:{visibility:"hidden",top:`${20*(n+1)}px`}},r)),e.ports.out.map((r,n)=>b.jsx(uo,{id:r,type:"source",position:tt.Right,style:{visibility:"hidden",top:`${20*(n+1)}px`}},r))]}),mGe={element:dGe,compound:hGe},gGe={relationship:lGe};function yGe({actorRef:e}){const r=E.useRef(null);return r.current==null&&(r.current={defaultNodes:[],defaultEdges:[]}),b.jsx(dee.Provider,{value:e,children:b.jsx(Mw,{...r.current,children:b.jsx(dm,{id:e.sessionId,inherit:!1,children:b.jsxs(Pa,{children:[b.jsx(wGe,{},"xyflow"),b.jsx(vGe,{},"sync")]})})})})}const bGe=e=>({...e.context.subject,viewId:e.context.viewId}),vGe=E.memo(()=>{const e=VA(),r=wn(e,bGe,ut),n=Ho(),o=n.findView(r.viewId)??null,a=E.useMemo(()=>{let l;if("edgeId"in r&&Sa(r.edgeId)){nt(o,`view ${r.viewId} not found`);const c=mt(o.findEdge(r.edgeId),`edge ${r.edgeId} not found in ${r.viewId}`);l=ZXe([c.id],o)}else if(r.source&&r.target)l=QXe({source:n.element(r.source),target:n.element(r.target)});else return null;return tGe(l,o)},[r,o,n]),i=pr(),s=up();return E.useEffect(()=>{s.viewportInitialized&&e.send({type:"xyflow.init",instance:s,store:i})},[i,s.viewportInitialized,e]),E.useEffect(()=>{a!==null&&e.send({type:"update.layoutData",data:a})},[a,e]),null}),xGe=({context:e})=>({initialized:e.initialized.xydata&&e.initialized.xyflow,nodes:e.xynodes,edges:e.xyedges}),wGe=E.memo(()=>{const e=qA(),{initialized:r,nodes:n,edges:o}=hee(xGe,ut);return b.jsxs(U9,{id:e.rootElementId,nodes:n,edges:o,className:Je(r?"initialized":"not-initialized","likec4-relationship-details"),nodeTypes:mGe,edgeTypes:gGe,onNodesChange:it(a=>{e.send({type:"xyflow.applyNodeChanges",changes:a})}),onEdgesChange:it(a=>{e.send({type:"xyflow.applyEdgeChanges",changes:a})}),fitViewPadding:.05,onNodeClick:it((a,i)=>{a.stopPropagation(),e.send({type:"xyflow.nodeClick",node:i})}),onEdgeClick:it((a,i)=>{a.stopPropagation(),e.send({type:"xyflow.edgeClick",edge:i})}),onPaneClick:it(()=>{e.send({type:"xyflow.paneClick"})}),onDoubleClick:it(()=>{e.send({type:"xyflow.paneDblClick"})}),onViewportResize:it(()=>{e.send({type:"xyflow.resized"})}),onEdgeMouseEnter:it((a,i)=>{i.data.hovered||e.send({type:"xyflow.edgeMouseEnter",edge:i})}),onEdgeMouseLeave:it((a,i)=>{i.data.hovered&&e.send({type:"xyflow.edgeMouseLeave",edge:i})}),onSelectionChange:it(a=>{e.send({type:"xyflow.selectionChange",...a})}),nodesDraggable:!1,fitView:!1,pannable:!0,zoomable:!0,children:[b.jsx(_Ge,{}),b.jsx(ou,{position:"top-right",children:b.jsx(or,{variant:"default",color:"gray",onClick:a=>{a.stopPropagation(),e.close()},children:b.jsx(Hp,{})})})]})}),kGe=({context:e})=>({subject:e.subject,viewId:e.viewId}),_Ge=E.memo(()=>{const{subject:e,viewId:r}=hee(kGe,ut),n=Ho().findView(r);if(!n||!n.isDiagram())return null;const o=[...n.edges()];let a="edgeId"in e&&Sa(e.edgeId)?o.find(i=>i.id===e.edgeId):Iw(o,i=>i.source.element?.id===e.source&&i.target.element?.id===e.target)||Iw(o,i=>(i.source.element?.id===e.source||Un(i.source.element?.id??"__",e.source??"__"))&&(i.target.element?.id===e.target||Un(i.target.element?.id??"__",e.target??"__")));return a?b.jsx(EGe,{edge:a.$edge,view:n.$view}):null}),EGe=({edge:e,view:r})=>{const n=qA(),o=e.id,[a,i,{history:s,current:l}]=YV(e.id);E.useEffect(()=>{a!==o&&i.set(o)},[o]),E.useEffect(()=>{a!==o&&n.navigateTo(a)},[a]);const c=l>0,u=l+1{d.stopPropagation(),i.back()},children:b.jsx(nee,{})})},"back"),u&&b.jsx(cs.div,{layout:!0,initial:{opacity:.05,transform:"translateX(5px)"},animate:{opacity:1,transform:"translateX(0)"},exit:{opacity:0,transform:"translateX(5px)"},children:b.jsx(or,{variant:"default",color:"gray",onClick:d=>{d.stopPropagation(),i.forward()},children:b.jsx(hh,{})})},"forward"),b.jsx(Ur,{gap:"xs",wrap:"nowrap",ml:"sm",children:b.jsx(sGe,{edge:e,view:r})})]})})})},SGe=e=>e.context.overlays.map(r=>{switch(r.type){case"relationshipsBrowser":return e.children[r.id]?{type:r.type,actorRef:e.children[r.id]}:null;case"relationshipDetails":return e.children[r.id]?{type:r.type,actorRef:e.children[r.id]}:null;case"elementDetails":return e.children[r.id]?{type:r.type,actorRef:e.children[r.id]}:null;default:Ga(r)}}).filter(tV),CGe=(e,r)=>e.length===r.length&&e.every((n,o)=>n.actorRef===r[o].actorRef);function TGe({overlaysActorRef:e}){const r=D9(c=>c.domNode),n=E.useMemo(()=>r?.querySelector(".react-flow__renderer")??null,[r]),o=wn(e,SGe,CGe),a=ZZ()??!1,i=o.some(c=>c.type==="elementDetails");E.useEffect(()=>{!n||a||iUe(n,{opacity:i?.7:1,filter:i?"grayscale(1)":"grayscale(0)",transform:i?"perspective(400px) translateZ(-12px) translateY(3px)":"translateY(0)"},{duration:i?.35:.17})},[i,n]);const s=c=>{e.send({type:"close",actorId:c.id})},l=o.map((c,u)=>{switch(c.type){case"relationshipsBrowser":return b.jsx(Oy,{overlayLevel:u,onClose:()=>s(c.actorRef),children:b.jsx(oee,{actorRef:c.actorRef})},c.actorRef.sessionId);case"relationshipDetails":return b.jsx(Oy,{overlayLevel:u,onClose:()=>s(c.actorRef),children:b.jsx(yGe,{actorRef:c.actorRef})},c.actorRef.sessionId);case"elementDetails":return b.jsx(GXe,{actorRef:c.actorRef,onClose:()=>s(c.actorRef)},c.actorRef.sessionId);default:Ga(c)}});return b.jsx(fh.Overlays,{children:b.jsx(jT,{FallbackComponent:BT,onReset:()=>e.send({type:"close.all"}),children:b.jsx(dm,{children:b.jsx(Pa,{children:l})})})})}const[AGe,Su]=ri("SearchActorContext"),NGe=e=>e.context.searchValue;function RGe(){const e=Su(),r=wn(e,NGe),n=E.useCallback(o=>{e.send({type:"change.search",search:o})},[e]);return[r,n]}const $Ge=e=>{const r=e.context.searchValue.trim().toLowerCase();return r.length>1?r:""};function XA(){const e=Su();return E.useDeferredValue(wn(e,$Ge))}function PGe(){const e=Su();return E.useCallback(r=>{e.send({type:"change.search",search:r})},[e])}const MGe=e=>e.context.pickViewFor;function OGe(){const e=Su();return wn(e,MGe)}const GA=ye.raw({outline:"none",background:"mantine.colors.primary[8]",borderColor:"mantine.colors.primary[9]"}),Yk=".mantine-Tree-node:focus > .mantine-Tree-label &",DGe=ye.raw({display:"flex",width:"100%",background:"mantine.colors.body",rounded:"sm",padding:"[12px 8px 12px 14px]",minHeight:"60px",gap:"2",border:"1px solid",borderColor:"mantine.colors.defaultBorder",_hover:{...GA,borderColor:"mantine.colors.primary[9]",background:"mantine.colors.primary[8]/60"},_focus:GA,[Yk]:GA,_dark:{borderColor:"transparent",background:"mantine.colors.dark[6]/80"},_light:{background:"mantine.colors.white/80",_hover:{borderColor:"mantine.colors.primary[6]",backgroundColor:"mantine.colors.primary[5]"}}}),Wk="likec4-focusable",Xk={ref:"var(--likec4-icon-size, 24px)"},LGe=ye.raw({color:{base:"mantine.colors.dimmed",_light:"mantine.colors.gray[5]",_groupHover:"mantine.colors.primary[0]",_groupFocus:"mantine.colors.primary[0]"},[Yk]:{color:"mantine.colors.primary[0]"},flex:`0 0 ${Xk.ref}`,height:Xk.ref,width:Xk.ref,display:"flex",alignItems:"center",justifyContent:"center",alignSelf:"flex-start","--ti-size":Xk.ref,"& svg, & img":{width:"100%",height:"auto",maxHeight:"100%",pointerEvents:"none"},"& img":{objectFit:"contain"},"&.likec4-shape-icon svg":{strokeWidth:1.5}}),IGe=ye.raw({fontSize:"16px",fontWeight:500,lineHeight:"1.1",":where([data-disabled]) &":{opacity:.4},color:{base:"mantine.colors.dark[1]",_light:"mantine.colors.gray[7]",_groupHover:{base:"mantine.colors.primary[1]",_light:"mantine.colors.white"},_groupFocus:{base:"mantine.colors.primary[1]",_light:"mantine.colors.white"}},[Yk]:{color:{base:"mantine.colors.primary[1]",_light:"mantine.colors.white"}}}),vee=ye.raw({color:{base:"mantine.colors.dimmed",_groupHover:{base:"mantine.colors.primary[1]",_light:"mantine.colors.primary[0]"},_groupFocus:"mantine.colors.primary[0]"},[Yk]:{color:"mantine.colors.primary[0]"}}),zGe=ye.raw(vee,{marginTop:"1",fontSize:"12px",lineHeight:"1.4",":where([data-disabled]) &":{opacity:.85}}),jGe=ye({width:"100%",height:"100%",border:"2px dashed",borderColor:"mantine.colors.defaultBorder",rounded:"md",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"md",color:"mantine.colors.dimmed",padding:"md",paddingBlock:"xl"}),xee=ZSe({slots:["root","icon","title","description","descriptionColor"],className:"search-button",base:{root:DGe,icon:LGe,title:IGe,description:zGe,descriptionColor:vee}}),KA="@container likec4-tree (max-width: 450px)",BGe=ye({outline:"none",marginBottom:"2"}),FGe=ye(oX.raw({containerName:"likec4-tree"}),{containerType:"inline-size",height:"100%"}),HGe=ye({display:"flex",alignItems:"baseline",outline:"none !important",gap:"1"}),UGe=ye({marginTop:"2"}),VGe=ye({color:"mantine.colors.dimmed"}),qGe=ye({[KA]:{flexDirection:"column-reverse",alignItems:"flex-start",gap:"0.5"}}),YGe=ye({fontSize:"10px",lineHeight:"1.3",display:"block",fontWeight:500,whiteSpace:"nowrap",padding:"[1px 5px]",borderRadius:"4px",background:"mantine.colors.dark[9]/30",_light:{background:"mantine.colors.gray[3]/20"}}),WGe=ye({"--likec4-icon-size":"24px",[KA]:{"--likec4-icon-size":"18px"}}),XGe=ye({flex:0,fontSize:"10px",fontWeight:500,whiteSpace:"nowrap",lineHeight:"1.1",[KA]:{display:"none"}});function bi(e){e.stopPropagation(),e.preventDefault()}function wee(e){const r=e.getBoundingClientRect();return r.y+Math.floor(r.height/2)}function Dy(e){if(!e){console.error("moveFocusToSearchInput: from is null or undefined");return}const r=e.getRootNode();if(!_1(r.querySelector)){console.error("moveFocusToSearchInput: root.querySelector is not a function");return}let n=r.querySelector("[data-likec4-search-input]");if(n){const o=n.value.length;n.focus(),n.setSelectionRange(o,o)}}function Gk(e){if(!e){console.error("focusToFirstFoundElement: from is null or undefined");return}const r=e.getRootNode();if(!_1(r.querySelector)){console.error("focusToFirstFoundElement: root.querySelector is not a function");return}r.querySelector(`[data-likec4-search] .${Wk}`)?.focus()}function kee(e,r,n=`.${Wk}`){if(!e)return console.error("queryAllFocusable: from is null or undefined"),[];const o=e.getRootNode();return _1(o.querySelectorAll)?[...o.querySelectorAll(`[data-likec4-search-${r}] ${n}`)]:(console.error("queryAllFocusable: root.querySelectorAll is not a function"),[])}const GGe="likec4-view-btn",KGe=Je(ye({flexWrap:"nowrap",display:"flex","&[data-disabled] .mantine-ThemeIcon-root":{opacity:.45}}),GGe);ye({marginTop:"1",fontSize:"13px",lineHeight:"1.4",":where(.likec4-view-btn[data-disabled]) &":{opacity:.85}});const _ee=()=>b.jsx(Vr,{className:jGe,children:"Nothing found"}),ZGe=E.memo(()=>{const e=E.useRef(null);let r=[...Ho().views()],n=XA();return n&&(n.startsWith("kind:")?r=[]:r=r.filter(o=>n.startsWith("#")?o.tags.some(a=>a.toLocaleLowerCase().includes(n.slice(1))):`${o.id} ${o.title} ${o.description.text}`.toLocaleLowerCase().includes(n))),b.jsxs(ra,{ref:e,renderRoot:o=>b.jsx(Qr,{layout:!0,...o}),gap:8,"data-likec4-search-views":!0,onKeyDown:o=>{if(o.key==="ArrowLeft"||o.key==="ArrowRight"){const a=o.target.getBoundingClientRect().y,i=kee(e.current,"elements",".likec4-element-button");let s=i.length>1?i.find((l,c,u)=>wee(l)>a||c===u.length-1):null;s??=hp(i),s&&(o.stopPropagation(),s.focus());return}},children:[r.length===0&&b.jsx(_ee,{}),r.length>0&&b.jsx(_3,{children:b.jsx(Pr,{"data-likec4-view":!0,tabIndex:-1,onFocus:o=>{o.stopPropagation(),Dy(e.current)}})}),r.map((o,a)=>b.jsx(Qr,{layoutId:`@view${o.id}`,children:b.jsx(ZA,{view:o,search:n,tabIndex:a===0?0:-1})},o.id))]})}),Kk=xee();function ZA({className:e,view:r,loop:n=!1,search:o,...a}){const i=Su(),s=Wt(),l=Fk(),c=r.id===l,u=()=>{i.send({type:"close"}),setTimeout(()=>{s.navigateTo(r.id)},100)};return b.jsxs(Pr,{...a,className:Je(Kk.root,"group",Wk,KGe,e),"data-likec4-view":r.id,...c&&{"data-disabled":!0},onClick:d=>{d.stopPropagation(),u()},onKeyDown:T1({siblingSelector:"[data-likec4-view]",parentSelector:"[data-likec4-search-views]",activateOnFocus:!1,loop:n,orientation:"vertical",onKeyDown:d=>{d.nativeEvent.code==="Space"&&(d.stopPropagation(),u())}}),children:[b.jsx(ci,{variant:"transparent",className:Kk.icon,children:r.isDeploymentView()?b.jsx(UA,{stroke:1.8}):b.jsx(gi,{stroke:1.8})}),b.jsxs(Vr,{style:{flexGrow:1},children:[b.jsxs(Ur,{gap:"xs",wrap:"nowrap",align:"center",children:[b.jsx(Kl,{component:"div",highlight:o,className:Kk.title,children:r.title||"untitled"}),c&&b.jsx(Gl,{size:"xs",fz:9,radius:"sm",children:"current"})]}),b.jsx(Kl,{highlight:r.description.nonEmpty?o:"",component:"div",className:Kk.description,lineClamp:1,children:r.description.text||"No description"})]})]})}const vm=xee(),QGe=E.memo(()=>{const e=Ho(),r=XA(),n=E.useMemo(()=>{const a=r.split(".");let i;iu(a)||a[0]==="kind:"?i=e.elements():i=Rd(e.elements(),u=>r.startsWith("kind:")?u.kind.toLocaleLowerCase().startsWith(r.slice(5)):r.startsWith("#")?u.tags.some(d=>d.toLocaleLowerCase().includes(r.slice(1))):(u.title+" "+u.id+" "+u.summary.text).toLocaleLowerCase().includes(r));const s={},{all:l,roots:c}=yn([...i],qc,fp((u,d)=>{const h={label:d.title,value:d.id,element:d,searchTerms:a,children:[]};s[h.value]=h;const p=u.all.findLast(g=>Un(g.value,h.value));return p?(p.children.push(h),p.children.length>1&&p.children.sort(Cy)):u.roots.push(h),u.all.push(h),u},{all:[],roots:[]}));return{all:l,byid:s,roots:c.sort(Cy)}},[e,r]),o=Eee();return n.all.length===0?b.jsx(_ee,{}):b.jsx(eKe,{data:n,handleClick:o})}),JGe=()=>{};function eKe({data:{all:e,byid:r,roots:n},handleClick:o}){const a=Y1({multiple:!1});a.setHoveredNode=JGe,E.useEffect(()=>{a.collapseAllNodes();for(const s of e)s.children.length>0&&a.expand(s.value)},[e]);const i=it(s=>{const l=s.target,c=l.getAttribute("data-value"),u=!!c&&r[c];if(u){if(s.key==="ArrowUp"){c===n[0]?.value&&(bi(s),Dy(l));return}if(s.key==="ArrowRight"){if(u.children.length>0&&a.expandedState[c]===!1)return;const d=(s.target.querySelector(".mantine-Tree-label")??l).getBoundingClientRect().y,h=kee(l,"views");let p=h.length>1?h.find((g,y,x)=>wee(g)>d||y===x.length-1):null;p??=hp(h),p&&(bi(s),p.focus());return}if(s.key===" "||s.key==="Enter"){bi(s),o(u.element);return}}});return b.jsx(Bp,{"data-likec4-search-elements":!0,allowRangeSelection:!1,clearSelectionOnOutsideClick:!0,selectOnClick:!1,tree:a,data:n,levelOffset:"lg",classNames:{root:FGe,node:Je(Wk,BGe),label:HGe,subtree:UGe},onKeyDownCapture:i,renderNode:tKe})}function tKe({node:e,elementProps:r,hasChildren:n,expanded:o}){const{element:a,searchTerms:i}=e,s=h6e({element:{id:a.id,title:a.title,shape:a.shape,icon:a.icon},className:Je(vm.icon,WGe)}),l=[...a.views()],c=Eee(),u=`@tree.${e.value}`;return b.jsxs(Qr,{layoutId:u,...r,children:[b.jsx(or,{variant:"transparent",size:16,tabIndex:-1,className:Je(VGe),style:{visibility:n?"visible":"hidden"},children:b.jsx(hh,{stroke:3.5,style:{transition:"transform 150ms ease",transform:`rotate(${o?"90deg":"0"})`,width:"100%"}})}),b.jsxs(Pr,{component:ps,layout:!0,tabIndex:-1,"data-value":a.id,className:Je(vm.root,"group","likec4-element-button"),...l.length>0&&{onClick:d=>{(!n||o)&&(d.stopPropagation(),c(a))}},children:[s,b.jsxs(Se,{style:{flexGrow:1},children:[b.jsxs(Ur,{gap:"xs",wrap:"nowrap",align:"center",className:qGe,children:[b.jsx(Kl,{component:"div",highlight:i,className:vm.title,children:e.label}),b.jsx(po,{label:a.id,withinPortal:!1,fz:"xs",disabled:!a.id.includes("."),children:b.jsx(Kl,{component:"div",highlight:i,className:Je(YGe,vm.descriptionColor),children:g0(a.id)})})]}),b.jsx(Kl,{component:"div",highlight:i,className:vm.description,lineClamp:1,children:a.summary.text||"No description"})]}),b.jsx(wt,{component:"div",className:Je(XGe,vm.descriptionColor),fz:"xs",children:l.length===0?"No views":b.jsxs(b.Fragment,{children:[l.length," view",l.length>1?"s":""]})})]})]})}function Eee(){const e=Wt(),r=Su();return it(n=>{const o=[...n.views()];if(o.length===0)return;const a=zw(o);if(a){r.send({type:"close"}),a.id!==e.currentView.id&&setTimeout(()=>{e.navigateTo(a.id)},100);return}r.send({type:"pickview.open",elementFqn:n.id})})}const rKe=ye({border:"transparent",background:{base:"transparent",_focusWithin:{base:"mantine.colors.gray[4]/55 !important",_dark:"mantine.colors.dark[5]/55 !important"},_groupHover:{base:"mantine.colors.gray[3]/35",_dark:"mantine.colors.dark[5]/35"}}}),nKe=ye({position:"absolute",inset:"0",width:"100%",height:"100%",backgroundColor:"[rgb(34 34 34 / 0.7)]",zIndex:902,backdropFilter:"auto",backdropBlur:"10px",_light:{backgroundColor:"[rgb(255 255 255 / 0.6)]"}}),oKe=ye({position:"absolute",top:"[2rem]",left:"[50%]",width:"100%",maxWidth:"600px",minWidth:"200px",transform:"translateX(-50%)",zIndex:903}),See=ye({marginTop:"2","& + &":{marginTop:"[32px]"}});ye({height:["100%","100cqh"],"& .mantine-ScrollArea-viewport":{minHeight:"100%","& > div":{minHeight:"100%",height:"100%"}}});function aKe({elementFqn:e}){const r=Su(),n=Ho().element(e),o=[],a=[];for(const s of n.views())s.viewOf===n?o.push(s):a.push(s);const i=()=>{r.send({type:"pickview.close"})};return xp("keydown",s=>{try{s.key==="Escape"&&(s.stopPropagation(),s.preventDefault(),i())}catch(l){console.warn(l)}},{capture:!0}),b.jsxs(b.Fragment,{children:[b.jsx(Qr,{className:nKe,onClick:s=>{s.stopPropagation(),i()}},"pickview-backdrop"),b.jsx(C3,{children:b.jsxs(Qr,{initial:{opacity:0,scale:.95,originY:0,translateX:"-50%",translateY:-20},animate:{opacity:1,scale:1,translateY:0},exit:{opacity:0,scale:.98,translateY:-20,transition:{duration:.1}},className:oKe,"data-likec4-search-views":!0,children:[b.jsxs(Ur,{px:"sm",py:"md",justify:"space-between",children:[b.jsx(eh,{order:2,lh:1,children:"Select view"}),b.jsx(or,{size:"md",variant:"default",onClick:s=>{s.stopPropagation(),i()},children:b.jsx(Hp,{})})]}),b.jsxs(ta,{mah:"calc(100vh - 110px)",type:"never",children:[o.length>0&&b.jsxs(ra,{gap:"sm",px:"sm",className:See,children:[b.jsx(eh,{order:6,c:"dimmed",children:"scoped views of the element"}),o.map((s,l)=>b.jsx(ZA,{view:s,search:"",loop:!0,mod:{autofocus:l===0}},s.id))]}),a.length>0&&b.jsxs(ra,{gap:"sm",px:"sm",className:See,children:[b.jsx(eh,{order:6,c:"dimmed",children:"views including this element"}),a.map((s,l)=>b.jsx(ZA,{view:s,search:"",loop:!0,mod:{autofocus:l===0&&o.length===0}},s.id))]})]})]},"pickview")})]})}function iKe(){const e=E.useRef(null);let r=Ho().tagsSortedByUsage,n=PGe(),o=XA(),a=r.length;if(o.startsWith("#")){const s=o.slice(1);r=r.filter(({tag:l})=>l.toLocaleLowerCase().includes(s))}if(r.length===0)return null;const i=r.length!==a;return b.jsxs(xn,{ref:e,css:{gap:"md",paddingLeft:"[48px]",flexWrap:"nowrap"},children:[b.jsx(xn,{css:{gap:"1.5",flexWrap:"wrap",opacity:i?1:.3,grayscale:i?0:.9,filter:"auto",transition:"fast",_groupHover:{opacity:1,grayscale:0},_groupFocusWithin:{opacity:1,grayscale:0}},children:r.map(({tag:s})=>b.jsx(Ck,{tag:s,className:ye({userSelect:"none",cursor:"pointer"}),onClick:l=>{l.stopPropagation(),n(`#${s}`),setTimeout(()=>{Gk(e.current)},350)}},s))}),i&&b.jsx(Zn,{size:"compact-xs",variant:"light",onClick:s=>{s.stopPropagation(),n(""),Dy(e.current)},rightSection:b.jsx(Hp,{size:14}),children:"Clear"})]})}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const sKe=[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]],QA=yt("outline","search","Search",sKe);function Cee(e){return e.match(/^(k|ki|kin|kind|kind:)$/)!=null}const lKe=["#","kind:"],cKe=E.memo(()=>{const e=Su(),r=Ho(),n=E.useRef(null),{ref:o,focused:a}=$Pe(),[i,s]=RGe(),l=tW({scrollBehavior:"smooth",loop:!1});xp("keydown",d=>{try{!a&&(d.key==="Backspace"||d.key.startsWith("Arrow")||d.key.match(new RegExp("^\\p{L}$","u")))&&Dy(n.current)}catch(h){console.warn(h)}});let c=[],u=!1;switch(!0){case i.startsWith("#"):{const d=i.toLocaleLowerCase().slice(1),h=r.tags.filter(p=>p.toLocaleLowerCase().includes(d));h.length===0?(u=!1,c=[b.jsx(I1,{children:"No tags found"},"empty-tags")]):(u=r.tags.some(p=>p.toLocaleLowerCase()===d),c=h.map(p=>b.jsxs(z1,{value:`#${p}`,children:[b.jsx(wt,{component:"span",opacity:.5,mr:1,fz:"sm",children:"#"}),p]},p)));break}case i.startsWith("kind:"):case Cee(i):{const d=i.length>5?i.slice(5).toLocaleLowerCase():"";let h=q6(r.specification.elements);d&&(h=h.filter(p=>p.toLocaleLowerCase().includes(d))),h.length===0?(u=!1,c=[b.jsx(I1,{children:"No kinds found"},"empty-kinds")]):(u=h.some(p=>p.toLocaleLowerCase()===d),c=h.map(p=>b.jsxs(z1,{value:`kind:${p}`,children:[b.jsx(wt,{component:"span",opacity:.5,mr:1,fz:"sm",children:"kind:"}),p]},p)));break}}return b.jsxs(Kn,{onOptionSubmit:d=>{s(d),l.resetSelectedOption(),lKe.includes(d)||(l.closeDropdown(),setTimeout(()=>{Gk(n.current)},350))},width:"max-content",position:"bottom-start",shadow:"md",offset:{mainAxis:4,crossAxis:50},store:l,withinPortal:!1,children:[b.jsx(cT,{children:b.jsx(Ra,{ref:Rr(n,o),placeholder:"Search by title, description or start with # or kind:",autoFocus:!0,"data-autofocus":!0,"data-likec4-search-input":!0,tabIndex:0,classNames:{input:rKe},size:"lg",value:i,leftSection:b.jsx(QA,{style:{width:Ne(20)},stroke:2}),rightSection:b.jsx(Ra.ClearButton,{onClick:d=>{d.stopPropagation();const h=e.getSnapshot().context.openedWithSearch;i===""||i===h?e.send({type:"close"}):s("")}}),rightSectionPointerEvents:"auto",onChange:d=>{s(d.currentTarget.value),l.openDropdown(),l.updateSelectedOptionIndex()},onClick:()=>l.openDropdown(),onFocus:()=>l.openDropdown(),onBlur:()=>l.closeDropdown(),onKeyDownCapture:d=>{if(d.key==="Tab"){switch(!0){case l.getSelectedOptionIndex()>=0:return l.clickSelectedOption(),bi(d);case c.length===1:return l.selectFirstOption()&&l.clickSelectedOption(),bi(d);case Cee(i):return s("kind:"),bi(d)}return}if(d.key==="Backspace"&&l.dropdownOpened){if(i==="kind:")return s(""),l.resetSelectedOption(),bi(d);if(i.startsWith("kind:")&&u)return s("kind:"),l.resetSelectedOption(),bi(d);if(i.startsWith("#")&&u)return s("#"),l.resetSelectedOption(),bi(d)}if(d.key==="Escape"&&l.dropdownOpened&&c.length>0){bi(d),l.closeDropdown();return}if(d.key==="ArrowUp"&&l.dropdownOpened&&i===""&&l.getSelectedOptionIndex()===0){l.closeDropdown(),bi(d);return}if(d.key==="ArrowDown"&&(!l.dropdownOpened||c.length===0||u||i===""&&l.getSelectedOptionIndex()===c.length-1)){l.closeDropdown(),bi(d),Gk(n.current);return}}})}),b.jsx(O3,{hidden:c.length===0,style:{minWidth:300},children:b.jsx(D3,{children:b.jsx(ta,{mah:"min(322px, calc(100cqh - 50px))",type:"scroll",children:c})})})]})}),uKe=ye({backgroundColor:"[rgb(34 34 34 / var(--_opacity, 95%))]",_light:{backgroundColor:"[rgb(250 250 250 / var(--_opacity, 95%))]"},backdropFilter:"auto",backdropBlur:"var(--_blur, 10px)"}),dKe=ye({width:"100%",height:"100%",maxHeight:"100vh",overflow:"hidden",display:"flex",flexDirection:"column",justifyContent:"stretch",gap:"sm",paddingTop:"[20px]",paddingLeft:"md",paddingRight:"md",paddingBottom:"sm",background:"[transparent]"}),hKe=e=>!e.matches("inactive");function fKe({searchActorRef:e}){const r=wn(e,hKe),n=()=>{e.send({type:"open"})},o=it(()=>{e.send({type:"close"})});return APe([["mod+k",n,{preventDefault:!0}],["mod+f",n,{preventDefault:!0}]]),b.jsx(AGe,{value:e,children:b.jsx(fh.Overlays,{children:b.jsx(jT,{FallbackComponent:BT,onReset:o,children:b.jsx(Pa,{children:r&&b.jsx(Oy,{fullscreen:!0,withBackdrop:!1,backdrop:{opacity:.9},classes:{dialog:uKe,body:dKe},openDelay:0,onClose:o,"data-likec4-search":"true",children:b.jsx(pKe,{searchActorRef:e})})})})})})}const Tee=ye({height:["100%","100cqh"],"& .mantine-ScrollArea-viewport":{minHeight:"100%","& > div":{minHeight:"100%",height:"100%"}}}),pKe=({searchActorRef:e})=>{const r=E.useRef(null),n=OGe();return Wx(()=>{Sa(e.getSnapshot().context.openedWithSearch)&&Gk(r.current)},150),b.jsxs(Vr,{ref:r,display:"contents",children:[b.jsx(Ur,{className:"group",wrap:"nowrap",onClick:o=>{o.stopPropagation(),Dy(r.current)},children:b.jsxs(Fp,{flex:1,px:"sm",children:[b.jsx(cKe,{}),b.jsx(iKe,{})]})}),b.jsxs(B1,{children:[b.jsx(Zd,{span:6,children:b.jsx(eh,{component:"div",order:6,c:"dimmed",pl:"sm",children:"Elements"})}),b.jsx(Zd,{span:6,children:b.jsx(eh,{component:"div",order:6,c:"dimmed",pl:"sm",children:"Views"})})]}),b.jsxs(B1,{className:ye({containerName:"likec4-search-elements",containerType:"size",overflow:"hidden",flexGrow:1}),children:[b.jsx(Zd,{span:6,children:b.jsx(os,{type:"scroll",className:Tee,pr:"xs",scrollbars:"y",children:b.jsx(Pa,{children:b.jsx(dm,{id:"likec4-search-elements",children:b.jsx(QGe,{})})})})}),b.jsx(Zd,{span:6,children:b.jsx(os,{type:"scroll",className:Tee,pr:"xs",scrollbars:"y",children:b.jsx(Pa,{children:b.jsx(dm,{id:"likec4-search-views",children:b.jsx(ZGe,{})})})})})]}),n&&b.jsx(aKe,{elementFqn:n})]})};function mKe({children:e}){const r=E.useContext(MT);if(!r)throw new Error("PortalToContainer must be used within RootContainer");return b.jsx(D1,{target:r.ref.current??`#${r.id}`,children:e})}const Aee={onChange:null,onNavigateTo:null,onNodeClick:null,onNodeContextMenu:null,onCanvasContextMenu:null,onEdgeClick:null,onEdgeContextMenu:null,onCanvasClick:null,onCanvasDblClick:null,onBurgerMenuClick:null,onOpenSource:null,onInitialized:null},JA=q6(Aee),Nee=E.createContext({...E1(JA,e=>[e,null]),handlersRef:{current:Aee}});function gKe({handlers:e,children:r}){const n=Kf(e),o=JA.map(i=>_1(e[i])),a=E.useMemo(()=>({...E1(JA,i=>n.current[i]?[i,(...s)=>n.current[i]?.(...s)]:[i,null]),handlersRef:n}),[n,...o]);return b.jsx(Nee.Provider,{value:a,children:r})}function sc(){return E.useContext(Nee)}const yKe=ec({delays:{"open timeout":({context:e})=>e.openTimeout,"close timeout":600,"long idle":1500},actions:{"update edgeId":et(({context:e,event:r})=>(Ut(r,["xyedge.select","xyedge.mouseEnter"]),{edgeId:r.edgeId,edgeSelected:e.edgeSelected||r.type==="xyedge.select"})),"increase open timeout":et(()=>({openTimeout:800})),"decrease open timeout":et(()=>({openTimeout:300})),"reset edgeId":et({edgeId:null,edgeSelected:!1})},guards:{"edge was selected":({context:e})=>e.edgeSelected,"edge was hovered":({context:e})=>!e.edgeSelected}}).createMachine({id:"breadcrumbs",context:()=>({edgeId:null,edgeSelected:!1,openTimeout:800}),initial:"idle",on:{close:{target:"#idle",actions:["reset edgeId","increase open timeout"]}},states:{idle:{id:"idle",on:{"xyedge.mouseEnter":{target:"opening",actions:"update edgeId"},"xyedge.select":{target:"active",actions:"update edgeId"}},after:{"long idle":{actions:"increase open timeout"}}},opening:{on:{"xyedge.mouseLeave":{target:"idle"},"xyedge.select":{target:"active",actions:"update edgeId"}},after:{"open timeout":{actions:"decrease open timeout",target:"active"}}},active:{tags:["opened"],initial:"opened",exit:"reset edgeId",on:{"xyedge.unselect":{target:"idle",actions:"increase open timeout"},"xyedge.select":{actions:"update edgeId"}},states:{opened:{on:{"dropdown.mouseEnter":{target:"hovered"},"xyedge.mouseLeave":{guard:"edge was hovered",target:"closing"}}},hovered:{on:{"dropdown.mouseLeave":[{guard:"edge was selected",target:"opened"},{target:"closing"}]}},closing:{on:{"xyedge.mouseEnter":{guard:"edge was hovered",target:"opened",actions:"update edgeId"},"xyedge.select":{target:"opened",actions:"update edgeId"},"dropdown.mouseEnter":{target:"hovered"}},after:{"close timeout":{target:"#idle"}}}}}}}),bKe=yKe,Ree=ye({display:"block",fontSize:"xxs",fontWeight:500,whiteSpace:"nowrap",paddingX:"1",paddingY:"0.5",borderRadius:"[2px]",background:{_light:"var(--likec4-palette-fill)/90",_dark:"var(--likec4-palette-fill)/60"},lineHeight:"1",color:{_light:"var(--likec4-palette-hiContrast)",_dark:"var(--likec4-palette-loContrast)"}}),vKe=ye({whiteSpaceCollapse:"preserve-breaks",fontSize:"sm",lineHeight:"sm",userSelect:"all"});function xKe(e){let r=null;for(const n of e.xyedges)if(n.selected){if(r){r=null;break}r=n.data.id}return{viewId:e.view.id,selected:r}}const wKe=E.memo(()=>{const e=Ho(),r=n8(bKe),n=Wt(),{viewId:o,selected:a}=$a(xKe),i=wn(r,g=>g.hasTag("opened")?g.context.edgeId:null);is("navigateTo",()=>{r.send({type:"close"})}),is("edgeMouseEnter",({edge:g})=>{r.send({type:"xyedge.mouseEnter",edgeId:g.data.id})}),is("edgeMouseLeave",()=>{r.send({type:"xyedge.mouseLeave"})}),is("edgeEditingStarted",()=>{r.send({type:"close"})}),is("walkthroughStarted",()=>{r.send({type:"close"})}),E.useEffect(()=>{a?r.send({type:"xyedge.select",edgeId:a}):r.send({type:"xyedge.unselect"})},[a]);const s=E.useCallback(g=>{if(!i)return;r.send({type:"dropdown.mouseEnter"});const y=n.findEdge(i);y&&!y.data.hovered&&n.send({type:"xyflow.edgeMouseEnter",edge:y,event:g})},[r,n,i]),l=E.useCallback(g=>{if(!i)return;r.send({type:"dropdown.mouseLeave"});const y=n.findEdge(i);y?.data.hovered&&n.send({type:"xyflow.edgeMouseLeave",edge:y,event:g})},[r,n,i]),{diagramEdge:c,sourceNode:u,targetNode:d}=$a(g=>{const y=i?o8(g,i):null,x=y?Qp(g,y.source):null,w=y?Qp(g,y.target):null;return{diagramEdge:y,sourceNode:x,targetNode:w}},Xn,[i]);if(!c||!u||!d||iu(c.relations))return null;const[h,p]=yn(c.relations,Ao(g=>{try{return e.relationship(g)}catch(y){return console.error(`View is cached and likec4model missing relationship ${g} from ${u.id} -> ${d.id}`,y),null}}),dp(Sa),sV(g=>g.source.id===u.id&&g.target.id===d.id));return h.length===0&&p.length===0?(console.warn("No relationships found diagram edge",{diagramEdge:c,sourceNode:u,targetNode:d}),null):b.jsx(mKe,{children:b.jsx(_Ke,{viewId:o,direct:h,nested:p,diagramEdge:c,sourceNode:u,targetNode:d,onMouseEnter:s,onMouseLeave:l})})}),kKe=(e,r)=>r?.querySelector(`.likec4-edge-label[data-edge-id="${e}"]`)??null,e7=8,_Ke=({viewId:e,diagramEdge:r,direct:n,nested:o,sourceNode:a,targetNode:i,onMouseEnter:s,onMouseLeave:l})=>{const c=E.useRef(null),{enableNavigateTo:u,enableVscode:d}=wr(),{onOpenSource:h}=sc(),p=wze(),[g,y]=E.useState(null);E.useLayoutEffect(()=>{y(kKe(r.id,p.current))},[r]),E.useEffect(()=>{const k=g,C=c.current;if(!k||!C)return;let _=!1;const T=m3(k,C,()=>{Vq(k,C,{placement:"bottom-start",middleware:[Bq(4),sDe({crossAxis:!0,padding:e7,allowedPlacements:["bottom-start","top-start","right-start","right-end","left-end"]}),Fq({padding:e7,apply({availableHeight:A,availableWidth:N,elements:$}){_||Object.assign($.floating.style,{maxWidth:`${Ki(yi(N),{min:200,max:400})}px`,maxHeight:`${Ki(yi(A),{min:0,max:500})}px`})}}),Hq({padding:e7*2})]}).then(({x:A,y:N,middlewareData:$})=>{_||(C.style.transform=`translate(${yi(A)}px, ${yi(N)}px)`,C.style.visibility=$.hide?.referenceHidden?"hidden":"visible")})},{ancestorResize:!1,animationFrame:!0});return()=>{_=!0,T()}},[g]);const x=Wt(),w=E.useCallback((k,C)=>b.jsxs(E.Fragment,{children:[C>0&&b.jsx(Lp,{}),b.jsx(EKe,{viewId:e,relationship:k,sourceNode:a,targetNode:i,onNavigateTo:u?_=>{x.navigateTo(_)}:void 0,...h&&d&&{onOpenSource:()=>h({relation:k.id})}})]},k.id),[e,a,i,x,u,h,d]);return b.jsx(ta,{ref:c,onMouseEnter:s,onMouseLeave:l,type:"auto",scrollbars:"y",scrollbarSize:6,styles:{viewport:{overscrollBehavior:"contain",minWidth:180}},className:Je(ye({layerStyle:"likec4.dropdown",p:"0",pointerEvents:{base:"all",_whenPanning:"none"},position:"absolute",top:"0",left:"0",width:"max-content",cursor:"default"})),children:b.jsxs(Fp,{css:{gap:"3",padding:"4",paddingTop:"2"},children:[b.jsx(Zn,{variant:"default",color:"gray",size:"compact-xs",style:{alignSelf:"flex-start",fontWeight:500,"--button-fz":"var(--font-sizes-xxs)"},onClick:k=>{k.stopPropagation(),x.openRelationshipDetails(r.id)},children:"browse relationships"}),n.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(xm,{children:"DIRECT RELATIONSHIPS"}),n.map(w)]}),o.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(xm,{css:{mt:n.length>0?"2":"0"},children:"RESOLVED FROM NESTED"}),o.map(w)]})]})})},EKe=E.forwardRef(({viewId:e,relationship:r,sourceNode:n,targetNode:o,onNavigateTo:a,onOpenSource:i},s)=>{const l=$ee(r,"source",n),c=$ee(r,"target",o),u=a&&r.navigateTo?.id!==e?r.navigateTo?.id:void 0,d=r.links;return b.jsxs(Fp,{ref:s,className:sX({block:"2",inline:"2",paddingY:"2.5",paddingX:"2",gap:"1",rounded:"sm",backgroundColor:{_hover:{base:"mantine.colors.gray[1]",_dark:"mantine.colors.dark[5]/70"}}}),children:[b.jsx(xn,{gap:"0.5",children:b.jsxs(Qd,{openDelay:200,children:[b.jsx(Zk,{label:l.full,offset:2,position:"top-start",children:b.jsx(wt,{component:"div","data-likec4-color":n.color,className:Ree,children:l.short})}),b.jsx(ym,{stroke:2.5,size:"11px",opacity:.65}),b.jsx(Zk,{label:c.full,offset:2,position:"top-start",children:b.jsx(wt,{component:"div","data-likec4-color":o.color,className:Ree,children:c.short})}),u&&b.jsx(Zk,{label:"Open dynamic view",children:b.jsx(or,{size:"sm",radius:"sm",variant:"default",onClick:h=>{h.stopPropagation(),a?.(u)},style:{alignSelf:"flex-end"},role:"button",children:b.jsx(gi,{size:"80%",stroke:2})})}),i&&b.jsx(Zk,{label:"Open source",children:b.jsx(or,{size:"sm",radius:"sm",variant:"default",onClick:h=>{h.stopPropagation(),i()},role:"button",children:b.jsx(pm,{size:"80%",stroke:2})})})]})}),b.jsx(Vr,{className:vKe,children:r.title||"untitled"}),r.kind&&b.jsxs(xn,{gap:"2",children:[b.jsx(xm,{children:"kind"}),b.jsx(wt,{size:"xs",className:ye({userSelect:"all"}),children:r.kind})]}),r.technology&&b.jsxs(xn,{gap:"2",children:[b.jsx(xm,{children:"technology"}),b.jsx(wt,{size:"xs",className:ye({userSelect:"all"}),children:r.technology})]}),r.description.nonEmpty&&b.jsxs(b.Fragment,{children:[b.jsx(xm,{children:"description"}),b.jsx(Vr,{css:{paddingLeft:"2.5",py:"1.5",borderLeft:"2px dotted",borderLeftColor:{base:"mantine.colors.gray[3]",_dark:"mantine.colors.dark[4]"}},children:b.jsx(mh,{value:r.description,fontSize:"sm"})})]}),d.length>0&&b.jsxs(b.Fragment,{children:[b.jsx(xm,{children:"links"}),b.jsx(xn,{gap:"1",flexWrap:"wrap",children:d.map(h=>b.jsx(j9,{size:"sm",value:h},h.url))})]})]})}),xm=Ql("div",{base:{display:"block",fontSize:"xxs",fontWeight:500,userSelect:"none",lineHeight:"sm",color:"mantine.colors.dimmed"}}),Zk=po.withProps({color:"dark",fz:"xs",label:"",children:null,offset:8,withinPortal:!1});function $ee(e,r,n){const o=e.isDeploymentRelation()?n.id:n.modelRef||"",a=e[r].id,i=g0(o)+a.slice(o.length);return{full:a,short:i}}function wm(){const e=kze();return E.useMemo(()=>e?{portalProps:{target:e},withinPortal:!0}:{withinPortal:!1},[e])}const SKe=ec({delays:{"open timeout":500,"close timeout":350},actions:{"update activatedBy":et({activatedBy:({context:e,event:r})=>{switch(!0){case r.type.includes("click"):return"click";case r.type.includes("mouseEnter"):return"hover";default:return e.activatedBy}}}),"keep dropdown open":et({activatedBy:"click"}),"update selected folder":et(({event:e})=>e.type==="breadcrumbs.click.root"?{selectedFolder:""}:(Ut(e,["breadcrumbs.click.folder","select.folder"]),{selectedFolder:e.folderPath})),"reset selected folder":et({selectedFolder:({context:e})=>e.viewModel.folder.path}),"update inputs":et(({context:e,event:r})=>{Ut(r,"update.inputs");const n=r.inputs.viewModel.id!==e.viewModel.id;let o=e.selectedFolder;return r.inputs.viewModel.folder.path.startsWith(o)||(o=r.inputs.viewModel.folder.path),{viewModel:r.inputs.viewModel,selectedFolder:o,activatedBy:n?"hover":e.activatedBy}}),"reset search query":et({searchQuery:""}),"update search query":et(({event:e})=>(Ut(e,"searchQuery.change"),{searchQuery:e.value??""})),"emit navigateTo":ui(({event:e})=>(Ut(e,"select.view"),{type:"navigateTo",viewId:e.viewId}))},guards:{"was opened on hover":({context:e})=>e.activatedBy==="hover","has search query":({context:e})=>!iu(e.searchQuery),"search query is empty":({context:e})=>iu(e.searchQuery)}}).createMachine({id:"breadcrumbs",context:({input:e})=>({...e,breadcrumbs:[],activatedBy:"hover",selectedFolder:"",searchQuery:"",folderColumns:[]}),initial:"idle",entry:["update activatedBy","reset selected folder"],on:{"update.inputs":{actions:"update inputs"},"searchQuery.change":{actions:["update search query",sn({type:"searchQuery.changed"})]}},states:{idle:{id:"idle",on:{"breadcrumbs.mouseEnter.*":{target:"pending",actions:"update activatedBy"},"breadcrumbs.click.*":{target:"active",actions:"update activatedBy"}}},pending:{on:{"breadcrumbs.mouseEnter.*":{actions:"update activatedBy"},"breadcrumbs.mouseLeave.*":{target:"idle"},"breadcrumbs.click.*":{target:"active",actions:"update activatedBy"}},after:{"open timeout":{target:"active"}}},active:{tags:["active"],initial:"decide",on:{"dropdown.dismiss":{target:"#idle"},"breadcrumbs.mouseLeave":{guard:"was opened on hover",target:".closing"},"dropdown.mouseLeave":{guard:"was opened on hover",target:".closing"},"searchQuery.changed":{target:".decide"}},states:{decide:{always:[{guard:"has search query",target:"search"},{target:"opened"}]},opened:{on:{"searchQuery.changed":{guard:"has search query",actions:"keep dropdown open",target:"search"},"breadcrumbs.click.viewtitle":{actions:"reset selected folder"},"breadcrumbs.click.*":{actions:"update selected folder"},"select.folder":{actions:["keep dropdown open","update selected folder"]},"select.view":{actions:["emit navigateTo"]}}},search:{on:{"breadcrumbs.click.viewtitle":{actions:["reset search query","reset selected folder"],target:"opened"},"breadcrumbs.click.*":{actions:["reset search query","update selected folder"],target:"opened"},"select.view":{actions:["emit navigateTo"]}}},closing:{on:{"breadcrumbs.mouseEnter.*":{target:"decide"},"dropdown.mouseEnter":{target:"decide"}},after:{"close timeout":{target:"#idle"}}}}}}}),CKe=SKe,t7=E.createContext(null);t7.displayName="NavigationPanelActorSafeContext";const TKe=t7.Provider,r7=()=>{const e=E.useContext(t7);if(e===null)throw new Error("NavigationPanelActorRef is not found in the context");return e};function Pee(e,r=Xn){const n=r7();return wn(n,e,r)}function AKe(e,r=Xn){return Pee(n=>e(n.context),r)}function Ly(){const e=r7();return E.useMemo(()=>({actorRef:e,send:r=>e.send(r),selectFolder:r=>e.send({type:"select.folder",folderPath:r}),selectView:r=>e.send({type:"select.view",viewId:r}),isOpened:()=>e.getSnapshot().hasTag("active"),clearSearch:()=>e.send({type:"searchQuery.change",value:""}),closeDropdown:()=>e.send({type:"dropdown.dismiss"})}),[e])}const Mee=po.withProps({color:"dark",fz:"xs",openDelay:600,closeDelay:120,label:"",children:null,offset:8,withinPortal:!1}),Oee=()=>b.jsx(ci,{variant:"transparent",size:16,className:ye({display:{base:"none","@/md":"flex"},color:{base:"mantine.colors.gray[5]",_dark:"mantine.colors.dark[3]"}}),children:b.jsx(hh,{})});L3.withProps({separator:b.jsx(Oee,{}),separatorMargin:4});const gh=E.forwardRef(({variant:e="default",className:r,disabled:n=!1,...o},a)=>b.jsx(or,{size:"md",variant:"transparent",radius:"sm",component:ps,...!n&&{whileHover:{scale:1.085},whileTap:{scale:1,translateY:1}},disabled:n,...o,className:Je(r,Aqe({variant:e})),ref:a})),Qk=J0({base:{fontSize:"sm",fontWeight:"500",transition:"fast",color:{base:"mantine.colors.text/90",_hover:"[var(--mantine-color-bright)]"}},variants:{truncate:{true:{truncate:!0}},dimmed:{true:{color:{base:"mantine.colors.dimmed",_hover:"mantine.colors.text"}}}}}),NKe=E.forwardRef((e,r)=>b.jsxs("svg",{ref:r,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 222 56",...e,children:[b.jsx("path",{fill:"#5E98AF",d:"M33.95 33.78V0H2.37A2.37 2.37 0 0 0 0 2.35V33.9h33.95v-.12ZM38.57 33.78H55.6v-14.6c0-1.3-1.06-2.35-2.36-2.35H38.57v16.95ZM33.95 38.37H17.04v14.6c0 1.29 1.06 2.35 2.36 2.35h14.67V38.37h-.12ZM38.57 38.37v16.95h14.67c1.3 0 2.36-1.06 2.36-2.36v-14.6H38.57Z"}),b.jsx("path",{className:ye({fill:"[#FCFBF7]",_light:{fill:"[#222221]"}}),d:"M71.61 12.08c-.06 3.61.3 29.95.23 31.87 0 1.8 0 3.6.06 5.41 0 .3.18.58.47.58 4.1.18 8.13-.17 12.22-.11 1.34.05 2.69 0 3.97 0 1.29-.06 1.4-.59 1.35-1.63-.06-1.63-.06-3.08-.06-4.65-.06-.82-.53-1.11-1.23-1.11-2.4.06-4.8-.06-7.19.06-.4.06-.82.06-1.23.06-.7-.06-.87-.24-.93-1v-.86c-.18-4.83.17-9.83.17-14.66-.06-4.07 0-7.73-.06-11.34 0-1.57 0-3.14-.05-4.65-.06-.93 0-1.92-.24-2.85-.11-.35-.29-.81-.7-.81h-5.5c-.93 0-1.22.64-1.28 1.57v4.12ZM103.81 35c-.17-6.63-.1-13.67-.05-20.24 0-2.04-.12-4.25-.12-6.28 0-2.21-.87-2.1-2.04-2.15-1.7-.06-2.46-.06-4.15-.06-1.11-.06-1.58.23-1.58 1.34 0 5.7-.18 21.8-.12 24.13.06 2.33.3 12.91.18 15.24-.06.81 0 1.62.06 2.44.05.29.23.58.7.58 1.93-.12 3.74-.12 5.67-.17.7-.06 1.28-.24 1.58-1 .05-.4-.12-11.04-.12-13.83Zm13.92 4.47c0-2.03-.3-7.56-.23-8.72 0-.17.11-.4.17-.4.12 0 .35.11.41.17 1.87 2.44 10.64 19.36 11.7 19.42.28.06.58.06.87.06 1.99-.12 3.74 0 5.73 0 2.04 0 .7-1.98.35-2.5-.53-.76-7.48-13.14-7.9-13.9-1.16-1.98-2.16-4.13-3.32-6.05-.12-.23-.24-.58-.18-.81.12-.7.3-1.34.59-1.98a93.18 93.18 0 0 1 4.55-8.14c1.88-2.97 2.93-4.83 4.45-7.5.35-.64.58-1.34.82-2.1.05-.29-.18-.58-.53-.58-1.11-.05-5.15 0-6.43 0-.59 0-1.17.12-1.46.64-.76 1.46-8.6 15.7-9.35 16.98-.06.12-.24.18-.41.18 0 0-.12-.18-.12-.3-.06-3.25.53-13.9.4-16.04-.05-1.28-.28-1.4-1.57-1.46-1.4-.05-3.33-.05-4.73-.05-1.3 0-1.4.7-1.58 1.62-.06.18-.06 5.64-.06 8.09 0 3.54-.3 25.76.11 32.8 0 .7.18 1.1.77 1.1 1.57-.12 3.91 0 5.49 0 1.11 0 1.29-.12 1.29-1.98 0-2.5.23-4.77.23-7.85 0-.23-.06-.46-.06-.7Zm25.66-1.4h-.06c0 1.46-.05 2.97 0 4.49.06 1.86.18 3.72.3 5.58 0 .64.17.81.76.93 1.22.29 2.4.35 3.62.35 3.16-.12 6.31.11 9.47 0 1.29-.06 1.87.06 3.16-.18 1.17-.23 1.58-.87 1.58-2.61-.12-1.1-.06-1.57-.06-2.91 0-1.92-1.35-2.56-2.52-2.5-.81.06-4.73-.06-6.31-.06-2.63.06-2.22.4-2.22-2.33 0-2.2.06-5.05.06-7.32 0-1.22.11-1.63 1.28-1.63h7.31c1.17.17 1.99-.64 1.99-1.86 0-1.22.12-1.28.12-2.5l-.18-1.75c-.12-.99-.47-1.33-1.46-1.33-.64 0-1.29.05-1.93.11-2.52.18-3.68-.17-6.14 0-.82 0-.93-.11-1-.87-.23-2.27 0-4.77.24-7.04.06-.93.3-1.1 1.17-1.16l8.24-.06c1.11-.11 1.46-.06 1.4-1.16-.11-1.69.06-3.43-.11-5.12-.12-.93-.41-1.1-1.46-1.1-1.76.05-2.17.05-3.92.17-1.75.06-8.77.06-10.46.06-2.46 0-2.63-.18-2.7 2.8-.1 2.32-.05 4.7-.05 7.09 0 4.07-.23 18.66-.12 21.92Zm47.76-24.82c.06-1.92 0-3.5 0-5.35 0-2.15-3.92-1.92-5.32-1.86a18.95 18.95 0 0 0-15.08 9.77c-.82 1.57-1.4 3.2-1.81 4.88a34 34 0 0 0-.59 12.15c.41 3.78 1.4 7.56 3.74 10.59 4.04 5.3 11.46 7.15 17.83 6.16.3-.06.59-.11.82-.29.18-.11.35-.35.35-.58l.18-3.31c.06-1.05 0-1 0-2.04 0-1.4-2.93-.35-4.74-.35-1.75 0-3.62-.06-5.2-.87-2.8-1.57-4.38-4.71-5.26-7.68-1-3.2-1.23-6.63-.64-9.88.7-4.25 2.74-9.13 7.25-10.59 2.57-.87 5.31-.58 7.89-.29.35.06.58-.17.58-.46Zm26.77 15.3c.06-2.5 0-14.84 0-18.38.06-.82 0-1.63-.11-2.45-.06-.99-.24-1.28-1.29-1.33h-4.44c-.82 0-1.35.4-1.82 1.27-1.34 3.2-10.75 24.02-12.15 26.58-.53.99-1 1.63-1 2.68v4.24c0 .76-.06 1.28 1.23 1.28l11.1-.06c1.47 0 1.47.3 1.47 1.1 0 .88-.12 4.9-.12 5.3 0 .58.12 1.16 1.23 1.16h5.08c1.23 0 1.23-.7 1.23-2.03.06-1.17-.06-3.5-.06-4.66 0-.93.18-.98 1.76-.98 1.22 0 1.75-.12 1.75-.88.06-1.57 0-2.67 0-4.42 0-1.04-.93-.98-2.92-.98-.65 0-.7-.18-.7-1.05-.12-1.8-.24-4.6-.24-6.4Zm-7.25-5.94c-.05.7-.11 10.82-.11 12.27-.06.81-.24 1.05-1 1.1-1.93.06-3.85.06-5.78.06-.47 0-.65-.4-.41-.87.23-.4 4.85-11.57 6.13-14.48.18-.17.24-.35.41-.52.18-.12.41-.18.59-.23.06 0 .23.29.23.46 0 .76-.06 1.51-.06 2.21Z"})]})),RKe=E.forwardRef((e,r)=>b.jsx("svg",{ref:r,xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 56 56",...e,children:b.jsx("path",{fill:"#5E98AF",d:"M33.95 33.78V0H2.37A2.37 2.37 0 0 0 0 2.35V33.9h33.95v-.12ZM38.57 33.78H55.6v-14.6c0-1.3-1.06-2.35-2.36-2.35H38.57v16.95ZM33.95 38.37H17.04v14.6c0 1.29 1.06 2.35 2.36 2.35h14.67V38.37h-.12ZM38.57 38.37v16.95h14.67c1.3 0 2.36-1.06 2.36-2.36v-14.6H38.57Z"})})),$Ke=()=>{const e=Ly(),{onBurgerMenuClick:r}=sc();return b.jsx(Qr,{layout:"position",children:b.jsxs(Pr,{onMouseEnter:()=>{e.send({type:"breadcrumbs.mouseEnter.root"})},onMouseLeave:()=>{e.send({type:"breadcrumbs.mouseLeave.root"})},onClick:n=>{n.stopPropagation(),r&&e.isOpened()&&setTimeout(()=>{r()},100),e.send({type:"breadcrumbs.click.root"})},className:Je("mantine-active",Uo({padding:"0.5",width:{base:"[20px]","@/md":"[64px]"}})),children:[b.jsx(NKe,{className:ye({display:{base:"none","@/md":"block"}})}),b.jsx(RKe,{className:ye({display:{base:"block","@/md":"none"}})})]})})};/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const PKe=[["path",{d:"M5 12l14 0",key:"svg-0"}],["path",{d:"M5 12l6 6",key:"svg-1"}],["path",{d:"M5 12l6 -6",key:"svg-2"}]],MKe=yt("outline","arrow-left","ArrowLeft",PKe),OKe=()=>{const e=Wt(),{hasStepBack:r,hasStepForward:n}=$a(o=>({hasStepBack:o.navigationHistory.currentIndex>0,hasStepForward:o.navigationHistory.currentIndex{o.stopPropagation(),e.navigate("back")},children:b.jsx(MKe,{size:14})}),b.jsx(gh,{disabled:!n,onClick:o=>{o.stopPropagation(),e.navigate("forward")},children:b.jsx(ym,{size:14})})]})};/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const DKe=[["path",{d:"M9 15l6 -6",key:"svg-0"}],["path",{d:"M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464",key:"svg-1"}],["path",{d:"M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463",key:"svg-2"}]],LKe=yt("outline","link","Link",DKe),IKe=({context:e})=>{const r=e.viewModel;return{id:r.id,title:r.titleOrUntitled,description:r.description,tags:r.tags,links:r.links}},zKe=e=>{const[r,n]=E.useState(!1),o=Pee(IKe),a=wm();return b.jsxs(mr,{position:"bottom-end",shadow:"xl",clickOutsideEvents:["pointerdown","mousedown","click"],offset:{mainAxis:4},opened:r,onChange:n,...a,...e,children:[b.jsx(jKe,{linksCount:o.links.length,onOpen:()=>n(!0)}),r&&b.jsx(BKe,{data:o,onClose:()=>n(!1)})]})},jKe=({linksCount:e,onOpen:r})=>b.jsx(mr.Target,{children:b.jsxs(Pr,{component:ps,layout:"position",whileTap:{scale:.95,translateY:1},onClick:n=>{n.stopPropagation(),r()},className:Je("group",Uo({gap:"2",paddingInline:"2",paddingBlock:"1",rounded:"sm",userSelect:"none",cursor:"pointer",color:{base:"likec4.panel.action-icon.text",_hover:"likec4.panel.action-icon.text.hover"},backgroundColor:{_hover:"likec4.panel.action-icon.bg.hover"},display:{base:"none","@/xs":"flex"}}),""),children:[b.jsx(BA,{size:16,stroke:1.8}),e>0&&b.jsxs(xn,{gap:"[1px]",children:[b.jsx(LKe,{size:14,stroke:2}),b.jsx(Vr,{css:{fontSize:"11px",fontWeight:600,lineHeight:1,opacity:.8},children:e})]})]})}),Dee=Ql("div",{base:{fontSize:"xs",color:"mantine.colors.dimmed",fontWeight:500,userSelect:"none",mb:"xxs"}}),BKe=({data:{id:e,title:r,description:n,tags:o,links:a},onClose:i})=>{const s=Wt();return is("paneClick",i),is("nodeClick",i),b.jsxs(mr.Dropdown,{className:Je("nowheel nopan nodrag",X1({margin:"xs",layerStyle:"likec4.dropdown",gap:"md",padding:"md",paddingBottom:"lg",pointerEvents:"all",maxWidth:"calc(100cqw - 52px)",minWidth:"200px",maxHeight:"calc(100cqh - 100px)",width:"max-content",cursor:"default",overflow:"auto",overscrollBehavior:"contain","@/sm":{minWidth:400,maxWidth:550},"@/lg":{maxWidth:700}})),children:[b.jsxs("section",{children:[b.jsx(wt,{component:"div",fw:500,size:"xl",lh:"sm",children:r}),b.jsxs(xn,{alignItems:"flex-start",mt:"1",children:[b.jsx(FKe,{label:"id",value:e}),b.jsx(xn,{gap:"xs",flexWrap:"wrap",children:o.map(l=>b.jsx(Ck,{tag:l,cursor:"pointer",onClick:c=>{c.stopPropagation(),s.openSearch(`#${l}`)}},l))})]})]}),a.length>0&&b.jsxs("section",{className:Uo({alignItems:"baseline"}),children:[b.jsx(Dee,{children:"Links"}),b.jsx(xn,{gap:"xs",flexWrap:"wrap",children:a.map((l,c)=>b.jsx(j9,{value:l},`${c}-${l.url}`))})]}),n.isEmpty&&b.jsx(wt,{component:"div",fw:500,size:"xs",c:"dimmed",style:{userSelect:"none"},children:"No description"}),n.nonEmpty&&b.jsxs("section",{children:[b.jsx(Dee,{children:"Description"}),b.jsx(mh,{value:n,fontSize:"sm",emptyText:"No description",className:ye({userSelect:"all"})})]})]})},FKe=({label:e,value:r})=>b.jsxs(xn,{gap:"0.5",children:[b.jsx(HKe,{children:e}),b.jsx(Gl,{size:"sm",radius:"sm",variant:"light",color:"gray",tt:"none",fw:500,classNames:{root:ye({width:"max-content",overflow:"visible",px:"1",color:{_dark:"mantine.colors.gray[4]",_light:"mantine.colors.gray[8]"}}),label:ye({overflow:"visible"}),section:ye({opacity:.5,userSelect:"none",marginInlineEnd:"0.5"})},children:r})]}),HKe=Ql("div",{base:{color:"mantine.colors.dimmed",fontWeight:500,fontSize:"xxs",userSelect:"none"}}),UKe=()=>{const e=Fk(),{enableVscode:r}=wr(),{onOpenSource:n}=sc();return r?b.jsx(Mee,{label:"Open View Source",children:b.jsx(gh,{onClick:o=>{o.stopPropagation(),n?.({view:e})},children:b.jsx(pm,{style:{width:"60%",height:"60%"}})})}):null};/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const VKe=[["path",{d:"M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6z",key:"svg-0"}],["path",{d:"M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M8 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]],qKe=yt("outline","lock","Lock",VKe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const YKe=[["path",{d:"M3 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M9 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0",key:"svg-1"}],["path",{d:"M13 11v-4a4 4 0 1 1 8 0v4",key:"svg-2"}]],WKe=yt("outline","lock-open-2","LockOpen2",YKe),XKe=e=>({visible:e.features.enableReadOnly!==!0,isReadOnly:e.toggledFeatures.enableReadOnly??e.features.enableReadOnly}),GKe=()=>{const{visible:e,isReadOnly:r}=$a(XKe),n=Wt();return e?b.jsxs(Pr,{component:ps,layout:"position",onClick:o=>{o.stopPropagation(),n.toggleFeature("ReadOnly")},whileTap:{translateY:1},className:Je("group",Uo({gap:"0.5",paddingInline:"xxs",paddingBlock:"xxs",rounded:"sm",userSelect:"none",cursor:"pointer",color:{base:"likec4.panel.action-icon.text",_hover:"likec4.panel.action-icon.text.hover"},backgroundColor:{_hover:"likec4.panel.action-icon.bg.hover"}})),children:[r?b.jsx(qKe,{size:14,stroke:2}):b.jsx(WKe,{size:14,stroke:2}),r&&b.jsx(Qr,{className:ye({fontSize:"11px",fontWeight:600,lineHeight:1,opacity:.8}),children:"Unlock"})]}):null};/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const KKe=[["path",{d:"M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z",key:"svg-0"}]],ZKe=yt("filled","player-play-filled","PlayerPlayFilled",KKe),Lee=E.forwardRef((e,r)=>b.jsx(Zn,{variant:"filled",size:"xs",fw:"500",...e,ref:r,component:ps,layoutId:"trigger-dynamic-walkthrough",className:ye({flexShrink:0})}));function QKe(){const e=Wt(),r=Ly();return b.jsx(Mee,{label:"Start Dynamic View Walkthrough",children:b.jsx(Lee,{onClick:n=>{n.stopPropagation(),r.closeDropdown(),e.startWalkthrough()},size:"compact-xs",h:26,classNames:{label:ye({display:{base:"none","@/md":"[inherit]"}}),section:ye({marginInlineStart:{base:"0","@/md":"2"}})},rightSection:b.jsx(ZKe,{size:10}),children:"Start"})})}function JKe({value:e,onChange:r}){return b.jsx(Qr,{layout:"position",children:b.jsx(U1,{size:"xs",value:e,component:Qr,onChange:n=>{nt(n==="diagram"||n==="sequence","Invalid dynamic view variant"),r(n)},classNames:{label:ye({fontSize:"xxs"})},data:[{value:"diagram",label:"Diagram"},{value:"sequence",label:"Sequence"}]})})}function eZe(){const e=$a(n=>n.dynamicViewVariant),r=Wt();return b.jsxs(b.Fragment,{children:[b.jsx(JKe,{value:e,onChange:n=>{r.switchDynamicViewVariant(n)}},"dynamic-view-mode-switcher"),b.jsx(QKe,{},"trigger-dynamic-walkthrough")]})}function tZe(){const e=Wt(),r=ap();return b.jsxs(Pr,{component:ps,layout:"position",onClick:n=>{n.stopPropagation(),e.openSearch()},whileTap:{scale:.95,translateY:1},className:Je("group",Uo({gap:"xxs",paddingInline:"sm",paddingBlock:"xxs",rounded:"sm",userSelect:"none",cursor:"pointer",color:{base:"likec4.panel.action-icon.text",_hover:"likec4.panel.action-icon.text.hover"},backgroundColor:{base:"likec4.panel.action-icon.bg",_hover:"likec4.panel.action-icon.bg.hover"},display:{base:"none","@/md":"flex"}})),children:[b.jsx(QA,{size:14,stroke:2.5}),b.jsx(Vr,{css:{fontSize:"11px",fontWeight:600,lineHeight:1,opacity:.8,whiteSpace:"nowrap"},children:r?"⌘ + K":"Ctrl + K"})]})}const rZe=({context:e})=>{const r=e.viewModel.folder;return{folders:r.isRoot?[]:r.breadcrumbs.map(n=>({folderPath:n.path,title:n.title})),viewId:e.viewModel.id,viewTitle:e.viewModel.titleOrUntitled,isDynamicView:e.viewModel.isDynamicView()}},nZe=()=>{const e=Ly(),{enableSearch:r,enableNavigationButtons:n,enableDynamicViewWalkthrough:o}=wr(),{folders:a,viewTitle:i,isDynamicView:s}=wn(e.actorRef,rZe,ut),l=a.flatMap(({folderPath:u,title:d},h)=>[b.jsx(Pr,{component:ps,className:Je(Qk({dimmed:!0,truncate:!0}),"mantine-active",ye({userSelect:"none",maxWidth:"200px",display:{base:"none","@/md":"block"}})),title:d,onMouseEnter:()=>e.send({type:"breadcrumbs.mouseEnter.folder",folderPath:u}),onMouseLeave:()=>e.send({type:"breadcrumbs.mouseLeave.folder",folderPath:u}),onClick:p=>{p.stopPropagation(),e.send({type:"breadcrumbs.click.folder",folderPath:u})},children:d},u),b.jsx(Oee,{},`separator-${h}`)]),c=b.jsx(Pr,{component:ps,className:Je("mantine-active",Qk({truncate:!0}),ye({userSelect:"none"})),title:i,onMouseEnter:()=>e.send({type:"breadcrumbs.mouseEnter.viewtitle"}),onMouseLeave:()=>e.send({type:"breadcrumbs.mouseLeave.viewtitle"}),onClick:u=>{u.stopPropagation(),e.send({type:"breadcrumbs.click.viewtitle"})},children:i},"view-title");return b.jsxs(Pa,{propagate:!0,children:[b.jsx($Ke,{},"burger-button"),n&&b.jsx(OKe,{},"nav-buttons"),b.jsxs(Qr,{layout:"position",className:Uo({gap:"1",flexShrink:1,flexGrow:1,overflow:"hidden"}),children:[l,c]},"breadcrumbs"),b.jsxs(Qr,{layout:"position",className:Uo({gap:"0.5",flexGrow:0,_empty:{display:"none"}}),children:[b.jsx(zKe,{onOpen:()=>e.closeDropdown()}),b.jsx(UKe,{}),b.jsx(GKe,{})]},"actions"),o&&s&&b.jsx(eZe,{},"dynamic-view-controls"),r&&b.jsx(tZe,{},"search-control")]})},n7=E.forwardRef(({className:e,truncateLabel:r=!0,...n},o)=>b.jsx(ST,{...n,component:"button",classNames:Fqe({truncateLabel:r}),className:Je("group","mantine-active",e),ref:o}));n7.displayName="NavigationLink";const oZe=E.createContext(null),aZe=[],iZe=()=>{},sZe={projects:aZe,onProjectChange:iZe};function lZe(){return E.useContext(oZe)??sZe}function cZe(){const e=E.useContext(W1);if(!e)throw new Error("No LikeC4ModelContext found");return e.projectId}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const uZe=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],dZe=yt("outline","chevron-down","ChevronDown",uZe);function hZe(e){const{projects:r,onProjectChange:n}=lZe(),o=cZe();return r.length<=1?null:b.jsxs(xn,{gap:"0.5",alignItems:"baseline",children:[b.jsx(Vr,{css:{fontWeight:"400",fontSize:"xxs",color:"mantine.colors.dimmed",userSelect:"none"},children:"Project"}),b.jsxs(fo,{withinPortal:!1,shadow:"md",position:"bottom-start",offset:{mainAxis:2},children:[b.jsx(F3,{children:b.jsx(Zn,{tabIndex:-1,autoFocus:!1,variant:"subtle",size:"compact-xs",color:"gray",classNames:{root:ye({fontWeight:"400",fontSize:"xxs",height:"auto",lineHeight:1.1,color:{_light:"mantine.colors.gray[9]"}}),section:ye({'&:is([data-position="right"])':{marginInlineStart:"1"}})},rightSection:b.jsx(dZe,{opacity:.5,size:12,stroke:1.5}),...e,children:o})}),b.jsx(F1,{children:r.map(({id:a,title:i})=>b.jsx(H1,{onClick:s=>{if(o===a){s.stopPropagation();return}n(a)},children:i??a},a))})]})]})}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const fZe=[["path",{d:"M10.52 2.614a2.095 2.095 0 0 1 2.835 -.117l.126 .117l7.905 7.905c.777 .777 .816 2.013 .117 2.836l-.117 .126l-7.905 7.905a2.094 2.094 0 0 1 -2.836 .117l-.126 -.117l-7.907 -7.906a2.096 2.096 0 0 1 -.115 -2.835l.117 -.126l7.905 -7.905zm5.969 9.535l.01 -.116l-.003 -.12l-.016 -.114l-.03 -.11l-.044 -.112l-.052 -.098l-.076 -.105l-.07 -.081l-3.5 -3.5l-.095 -.083a1 1 0 0 0 -1.226 0l-.094 .083l-.083 .094a1 1 0 0 0 0 1.226l.083 .094l1.792 1.793h-5.085l-.117 .007a1 1 0 0 0 0 1.986l.117 .007h5.085l-1.792 1.793l-.083 .094a1 1 0 0 0 1.403 1.403l.094 -.083l3.5 -3.5l.097 -.112l.05 -.074l.037 -.067l.05 -.112l.023 -.076l.025 -.117z",key:"svg-0"}]],pZe=yt("filled","direction-sign-filled","DirectionSignFilled",fZe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const mZe=[["path",{d:"M8.243 7.34l-6.38 .925l-.113 .023a1 1 0 0 0 -.44 1.684l4.622 4.499l-1.09 6.355l-.013 .11a1 1 0 0 0 1.464 .944l5.706 -3l5.693 3l.1 .046a1 1 0 0 0 1.352 -1.1l-1.091 -6.355l4.624 -4.5l.078 -.085a1 1 0 0 0 -.633 -1.62l-6.38 -.926l-2.852 -5.78a1 1 0 0 0 -1.794 0l-2.853 5.78z",key:"svg-0"}]],gZe=yt("filled","star-filled","StarFilled",mZe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const yZe=[["path",{d:"M9 3a1 1 0 0 1 .608 .206l.1 .087l2.706 2.707h6.586a3 3 0 0 1 2.995 2.824l.005 .176v8a3 3 0 0 1 -2.824 2.995l-.176 .005h-14a3 3 0 0 1 -2.995 -2.824l-.005 -.176v-11a3 3 0 0 1 2.824 -2.995l.176 -.005h4z",key:"svg-0"}]],bZe=yt("filled","folder-filled","FolderFilled",yZe),Iee=T1({siblingSelector:"[data-likec4-focusable]",parentSelector:"[data-likec4-breadcrumbs-dropdown]",activateOnFocus:!1,loop:!0,orientation:"vertical"});function vZe(){const e=Ly(),r=wn(e.actorRef,a=>a.context.searchQuery);is("paneClick",()=>{e.closeDropdown()}),is("nodeClick",()=>{e.closeDropdown()});const n=OPe(a=>{e.send({type:"searchQuery.change",value:a})},250),o=r.trim().length>=2;return b.jsxs(Xl,{className:Je("nowheel",X1({layerStyle:"likec4.dropdown",gap:"xs",pointerEvents:"all"})),"data-likec4-breadcrumbs-dropdown":!0,onMouseLeave:()=>e.send({type:"dropdown.mouseLeave"}),onMouseEnter:()=>e.send({type:"dropdown.mouseEnter"}),children:[b.jsx(hZe,{}),b.jsx(xn,{gap:"xs",children:b.jsx(RZe,{value:r,onChange:n,"data-likec4-focusable":!0,onKeyDown:Iee})}),b.jsx(ta,{scrollbars:"x",type:"auto",offsetScrollbars:"present",classNames:{root:ye({maxWidth:["calc(100vw - 50px)","calc(100cqw - 50px)"]})},styles:{viewport:{overscrollBehavior:"none"}},children:o?b.jsx(wZe,{searchQuery:Fx(r).toLowerCase()}):b.jsx(TZe,{})})]})}const xZe=RL(ka);function wZe({searchQuery:e}){const r=Ho(),n=Ly(),o=e.includes(ka),a=yn(r.views(),Rd(s=>o&&s.$view.title?Fx(s.$view.title).toLowerCase().includes(e):s.id.toLowerCase().includes(e)||!!s.title?.toLowerCase().includes(e)),z4e(20),K0(),r$e((s,l)=>xZe(s.folder.path,l.folder.path)));if(a.length===0)return b.jsx("div",{children:"no results"});const i=o?e.split(ka):e;return b.jsx(ta,{scrollbars:"xy",offsetScrollbars:!1,className:ye({width:"100%",maxWidth:["calc(100vw - 250px)","calc(100cqw - 250px)"],maxHeight:["calc(100vh - 200px)","calc(100cqh - 200px)"]}),children:b.jsx(Fp,{gap:"0.5",children:a.map(s=>b.jsx(_Ze,{view:s,highlight:i,onClick:l=>{l.stopPropagation(),n.selectView(s.id)},"data-likec4-focusable":!0,onKeyDown:Iee},s.id))})})}const kZe=Uo({gap:"xxs",rounded:"sm",px:"xs",py:"xxs",_hover:{backgroundColor:{base:"mantine.colors.gray[1]",_dark:"mantine.colors.dark[5]"}},_focus:{outline:"none",color:"mantine.colors.primary.lightColor!",backgroundColor:"mantine.colors.primary.lightHover!"}}),zee=ye({_groupFocus:{color:"[inherit!]",transition:"none"}});function _Ze({view:e,highlight:r,...n}){const o=e.folder,a=Bee[e.id==="index"?"index":e._type],i=b.jsx(Kl,{component:"div",className:Je(zee,Qk({truncate:!0}),ye({"& > mark":{backgroundColor:{base:"mantine.colors.yellow[2]/90",_dark:"mantine.colors.yellow[5]/80",_groupFocus:"[transparent]"},color:{_groupFocus:"[inherit!]"}}})),maw:350,highlight:r,children:e.title??e.id},e.id),s=Je(n.className,"group",kZe);if(o.isRoot)return b.jsxs(Pr,{...n,className:s,children:[a,i]});const l=o.breadcrumbs.map(c=>b.jsx(Kl,{component:"div",className:Je(ye({_groupHover:{color:"mantine.colors.dimmed"}}),zee,Qk({dimmed:!0,truncate:!0})),maw:170,highlight:F6(r)?r:[],children:c.title},c.path));return l.push(b.jsxs(xn,{gap:"[4px]",children:[a,i]})),b.jsxs(Pr,{...n,className:s,children:[jee,b.jsx(L3,{separator:b.jsx(hh,{size:12,stroke:1.5}),separatorMargin:3,children:l})]})}const EZe=b.jsx(hh,{size:12,stroke:1.5,className:"mantine-rotate-rtl"}),jee=b.jsx(bZe,{size:16,className:ye({opacity:{base:.3,_groupHover:.5,_groupActive:.5,_groupFocus:.5}})}),Jk=ye({opacity:{base:.3,_dark:.5,_groupHover:.8,_groupActive:.8,_groupFocus:.8}}),Bee={index:b.jsx(gZe,{size:16,className:Jk}),element:b.jsx(gi,{size:18,stroke:2,className:Jk}),deployment:b.jsx(UA,{size:16,stroke:1.5,className:Jk}),dynamic:b.jsx(pZe,{size:18,className:Jk})},SZe=ta.withProps({scrollbars:"y",className:ye({maxHeight:["calc(100vh - 160px)","calc(100cqh - 160px)"]})});function Fee(e,r){return{folderPath:e.path,items:[...e.folders.map(n=>({type:"folder",folderPath:n.path,title:n.title,selected:r.selectedFolder.startsWith(n.path)})),...e.views.map(n=>({type:"view",viewType:n.id==="index"?"index":n._type,viewId:n.id,title:n.title??n.id,description:n.description.nonEmpty&&n.description.text||null,selected:n.id===r.viewModel.id}))]}}const CZe=e=>{const r=e.viewModel.$model,n=[Fee(r.rootViewFolder,e)],o=r.viewFolder(e.selectedFolder);if(!o.isRoot)for(const a of o.breadcrumbs)n.push(Fee(a,e));return n};function TZe(){const e=AKe(CZe,ut);return b.jsx(xn,{gap:"xs",alignItems:"stretch",children:e.flatMap((r,n)=>[n>0&&b.jsx(Lp,{orientation:"vertical"},"divider"+n),b.jsx(AZe,{data:r,isLast:n==e.length-1},r.folderPath)])})}function AZe({data:e,isLast:r}){const n=E.useRef(null),o=r7(),a=i=>s=>{s.stopPropagation(),i.type==="folder"?o.send({type:"select.folder",folderPath:i.folderPath}):o.send({type:"select.view",viewId:i.viewId})};return y6e(()=>{r&&n.current&&n.current.scrollIntoView({inline:"nearest",behavior:"smooth"})}),b.jsx(Vr,{mb:"1",ref:n,children:b.jsx(SZe,{children:b.jsx(Fp,{gap:"0.5",children:e.items.map((i,s)=>b.jsx(NZe,{columnItem:i,onClick:a(i)},`${e.folderPath}/${i.type}/${s}`))})})})}function NZe({columnItem:e,...r}){switch(e.type){case"folder":return b.jsx(n7,{variant:"light",active:e.selected,label:e.title,leftSection:jee,rightSection:EZe,maw:"300px",miw:"200px",...r},e.folderPath);case"view":return b.jsx(n7,{variant:"filled",active:e.selected,label:e.title,description:e.description,leftSection:Bee[e.viewType],maw:"300px",miw:"200px",...r},e.viewId);default:Ga(e)}}function RZe({onKeyDown:e,...r}){const[n,o]=Vl({...r,finalValue:""});return b.jsx(Ra,{size:"xs",placeholder:"Search by title or id",variant:"unstyled",height:Ne(26),value:n,onKeyDown:e,onChange:a=>o(a.currentTarget.value),classNames:{wrapper:ye({flexGrow:1,backgroundColor:{base:"mantine.colors.gray[1]",_dark:"mantine.colors.dark[5]/80",_hover:{base:"mantine.colors.gray[2]",_dark:"mantine.colors.dark[4]"},_focus:{base:"mantine.colors.gray[2]",_dark:"mantine.colors.dark[4]"}},rounded:"sm"}),input:ye({_placeholder:{color:"mantine.colors.dimmed"},_focus:{outline:"none"}})},style:{"--input-fz":"var(--mantine-font-size-sm)"},leftSection:b.jsx(QA,{size:14}),rightSectionPointerEvents:"all",rightSectionWidth:"min-content",rightSection:!r.value||iu(r.value)?null:b.jsx(Zn,{variant:"subtle",h:"100%",size:"compact-xs",color:"gray",onClick:a=>{a.stopPropagation(),o("")},children:"clear"})})}const $Ze=Ql("div",{base:{fontSize:"xs",color:"mantine.colors.dimmed",fontWeight:500,userSelect:"none",mb:"xxs"}});function PZe(e){const r=IRe(e.activeWalkthrough),n=r?e.xyedges.findIndex(o=>o.id===e.activeWalkthrough?.stepId):-1;return{isActive:r,isParallel:r&&Sa(e.activeWalkthrough?.parallelPrefix),hasNext:r&&n0,notes:r?e.xyedges[n]?.data?.notes??Kt.EMPTY:null}}const MZe=()=>{const{notes:e}=$a(PZe);return!e||e.isEmpty?null:b.jsx(Ql.div,{position:"relative",children:b.jsxs(ta,{className:Je("nowheel nopan nodrag",X1({position:"absolute",layerStyle:"likec4.dropdown",gap:"sm",padding:"md",paddingTop:"xxs",pointerEvents:"all",maxWidth:"calc(100cqw - 32px)",minWidth:"calc(100cqw - 50px)",maxHeight:"calc(100cqh - 100px)",width:"max-content",cursor:"default",overflow:"auto",overscrollBehavior:"contain","@/sm":{minWidth:400,maxWidth:550},"@/lg":{maxWidth:700}})),type:"scroll",children:[b.jsx($Ze,{children:"Notes"}),b.jsx(mh,{value:e,fontSize:"sm",emptyText:"No description",className:ye({userSelect:"all"})})]})})},e_=po.withProps({color:"dark",fz:"xs",openDelay:600,closeDelay:120,label:"",children:null,offset:8,position:"right"});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const OZe=[["path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0",key:"svg-0"}],["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-1"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-2"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-3"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-4"}]],DZe=yt("outline","focus-centered","FocusCentered",OZe),LZe=()=>{const e=Wt();return b.jsx(e_,{label:"Center camera",children:b.jsx(gh,{onClick:()=>e.fitDiagram(),children:b.jsx(DZe,{})})})};ye({gap:"xxs",_empty:{display:"none"}}),ye({top:"md",left:"md",margin:"0",pointerEvents:"none","& :where(button, .action-icon, [role='dialog'])":{pointerEvents:"all"},"& .action-icon":{"--ai-size":"2rem"},"& .tabler-icon":{width:"65%",height:"65%"},_reduceGraphics:{"& .action-icon":{"--ai-radius":"0px"}}}),ye({shadow:{base:"md",_whenPanning:"none"}}),ye({"& .tabler-icon":{width:"65%",height:"65%"}});const t_=ye({flex:"1 1 40%",textAlign:"center",fontWeight:500,padding:"[4px 6px]",fontSize:"11px",zIndex:1}),IZe=ye({background:"mantine.colors.gray[2]",borderRadius:"sm",border:"1px solid",borderColor:"mantine.colors.gray[4]",_dark:{background:"mantine.colors.dark[5]",borderColor:"mantine.colors.dark[4]"}}),zZe=ye({position:"relative",borderRadius:"sm",background:"mantine.colors.gray[3]",boxShadow:"inset 1px 1px 3px 0px #00000024",_dark:{background:"mantine.colors.dark[7]"}}),jZe=ye({position:"absolute",width:8,height:8,border:"2px solid",borderColor:"mantine.colors.gray[5]",borderRadius:3,transform:"translate(-50%, -50%)"});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const BZe=[["path",{d:"M5 4h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1",key:"svg-0"}],["path",{d:"M5 16h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1",key:"svg-1"}],["path",{d:"M15 12h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1",key:"svg-2"}],["path",{d:"M15 4h4a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-2a1 1 0 0 1 1 -1",key:"svg-3"}]],FZe=yt("outline","layout-dashboard","LayoutDashboard",BZe),HZe=e=>({viewId:e.view.id,autoLayout:e.view.autoLayout}),UZe=()=>{const{onChange:e}=sc(),r=Wt(),[n,o]=E.useState(null),[a,i]=E.useState({}),{autoLayout:s,viewId:l}=$a(HZe),{ref:c,hovered:u}=aC(),d=g=>y=>{a[g]=y,i(a)},h=g=>y=>{y.stopPropagation(),e?.({change:{op:"change-autolayout",layout:{...s,direction:g}}})},p=(g,y)=>{r.fitDiagram(),e?.({change:{op:"change-autolayout",layout:{...s,nodeSep:g,rankSep:y}}})};return b.jsxs(mr,{position:"right-start",clickOutsideEvents:["pointerdown"],radius:"xs",shadow:"lg",offset:{mainAxis:10},children:[b.jsx(pu,{children:b.jsx(e_,{label:"Change Auto Layout",children:b.jsx(gh,{children:b.jsx(FZe,{})})})}),b.jsx(Xl,{className:"likec4-top-left-panel",p:8,pt:6,opacity:u?.6:1,children:b.jsxs(Se,{pos:"relative",ref:o,children:[b.jsx(P3,{target:a[s.direction],parent:n,className:IZe}),b.jsx(Se,{mb:10,children:b.jsx(wt,{inline:!0,fz:"xs",c:"dimmed",fw:500,children:"Auto layout:"})}),b.jsxs(Op,{gap:2,wrap:"wrap",justify:"stretch",maw:160,children:[b.jsx(Pr,{className:t_,ref:d("TB"),onClick:h("TB"),children:"Top-Bottom"}),b.jsx(Pr,{className:t_,ref:d("BT"),onClick:h("BT"),children:"Bottom-Top"}),b.jsx(Pr,{className:t_,ref:d("LR"),onClick:h("LR"),children:"Left-Right"}),b.jsx(Pr,{className:t_,ref:d("RL"),onClick:h("RL"),children:"Right-Left"})]}),b.jsx(Se,{my:10,children:b.jsx(wt,{inline:!0,fz:"xs",c:"dimmed",fw:500,children:"Spacing:"})}),b.jsx(VZe,{ref:c,isVertical:s.direction==="TB"||s.direction==="BT",nodeSep:s.nodeSep,rankSep:s.rankSep,onChange:p},l)]})})]})},km=400,VZe=E.forwardRef(({isVertical:e,nodeSep:r,rankSep:n,onChange:o},a)=>{e||([r,n]=[n,r]);const i=qx(({x:p,y:g})=>{e||([p,g]=[g,p]),o(Math.round(p*km),Math.round(g*km))},[o,e],250,2e3),[s,l]=Vl({defaultValue:vPe({x:(r??100)/km,y:(n??120)/km}),onChange:i}),{ref:c}=BV(l);let u=Math.round(s.x*km),d=Math.round(s.y*km);e||([u,d]=[d,u]);const h=Rr(c,a);return b.jsxs(Se,{ref:h,className:zZe,pt:"100%",children:[b.jsx(Se,{className:jZe,style:{left:`${s.x*100}%`,top:`${s.y*100}%`}}),b.jsx(Se,{pos:"absolute",left:2,bottom:2,children:b.jsxs(wt,{component:"div",fz:8,c:"dimmed",fw:500,children:[d,", ",u]})})]})});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const qZe=[["path",{d:"M12 9v4",key:"svg-0"}],["path",{d:"M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0z",key:"svg-1"}],["path",{d:"M12 16h.01",key:"svg-2"}]],Hee=yt("outline","alert-triangle","AlertTriangle",qZe),YZe=()=>{const e=wm();return $a(r=>r.view.hasLayoutDrift??!1)?b.jsxs(Ip,{position:"right-start",openDelay:200,closeDelay:100,...e,children:[b.jsx(vT,{children:b.jsx(or,{color:"orange",c:"orange",className:ye({bg:"mantine.colors.orange.light"}),children:b.jsx(Hee,{})})}),b.jsx(yT,{p:"0",children:b.jsxs(V3,{color:"orange",withBorder:!1,withCloseButton:!1,title:"Manual layout issues",children:[b.jsxs(wt,{mt:2,size:"sm",lh:"xs",children:["View contains new elements or their sizes have changed,",b.jsx("br",{}),"last manual layout can not be applied."]}),b.jsxs(wt,{mt:"xs",size:"sm",lh:"xs",children:["Update view predicates or remove ",b.jsx(j3,{children:"@likec4-generated"})]})]})})]}):null};/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const WZe=[["path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M10 4l4 16",key:"svg-1"}],["path",{d:"M12 12l-8 2",key:"svg-2"}]],XZe=yt("outline","layout-collage","LayoutCollage",WZe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const GZe=[["path",{d:"M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M4 12h8",key:"svg-1"}],["path",{d:"M12 15h8",key:"svg-2"}],["path",{d:"M12 9h8",key:"svg-3"}],["path",{d:"M12 4v16",key:"svg-4"}]],Uee=yt("outline","layout-board-split","LayoutBoardSplit",GZe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const KZe=[["path",{d:"M4 4l0 16",key:"svg-0"}],["path",{d:"M8 9m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z",key:"svg-1"}]],ZZe=yt("outline","layout-align-left","LayoutAlignLeft",KZe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const QZe=[["path",{d:"M12 4l0 5",key:"svg-0"}],["path",{d:"M12 15l0 5",key:"svg-1"}],["path",{d:"M6 9m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z",key:"svg-2"}]],JZe=yt("outline","layout-align-center","LayoutAlignCenter",QZe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const eQe=[["path",{d:"M20 4l0 16",key:"svg-0"}],["path",{d:"M4 9m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z",key:"svg-1"}]],tQe=yt("outline","layout-align-right","LayoutAlignRight",eQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const rQe=[["path",{d:"M4 4l16 0",key:"svg-0"}],["path",{d:"M9 8m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z",key:"svg-1"}]],nQe=yt("outline","layout-align-top","LayoutAlignTop",rQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const oQe=[["path",{d:"M4 12l5 0",key:"svg-0"}],["path",{d:"M15 12l5 0",key:"svg-1"}],["path",{d:"M9 6m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z",key:"svg-2"}]],aQe=yt("outline","layout-align-middle","LayoutAlignMiddle",oQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const iQe=[["path",{d:"M4 20l16 0",key:"svg-0"}],["path",{d:"M9 4m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z",key:"svg-1"}]],sQe=yt("outline","layout-align-bottom","LayoutAlignBottom",iQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const lQe=[["path",{d:"M6 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-0"}],["path",{d:"M18 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0",key:"svg-1"}],["path",{d:"M12 19h4.5c.71 0 1.372 -.212 1.924 -.576m1.545 -2.459a3.5 3.5 0 0 0 -3.469 -3.965h-.499m-4 0h-3.501a3.5 3.5 0 0 1 -2.477 -5.972m2.477 -1.028h3.5",key:"svg-2"}],["path",{d:"M3 3l18 18",key:"svg-3"}]],cQe=yt("outline","route-off","RouteOff",lQe),lc=({label:e,icon:r,onClick:n})=>b.jsx(e_,{label:e,withinPortal:!1,position:"top",children:b.jsx(gh,{classNames:{root:"action-icon",icon:ye({"& > svg":{width:"70%",height:"70%"}})},onClick:n,children:r})}),uQe=e=>{const r=Wt(),n=wm();return b.jsxs(mr,{position:"right",offset:{mainAxis:12},clickOutsideEvents:["pointerdown"],...n,...e,children:[b.jsx(pu,{children:b.jsx(e_,{label:"Manual layouting tools",children:b.jsx(gh,{children:b.jsx(XZe,{})})})}),b.jsx(Xl,{className:Uo({gap:"0.5",layerStyle:"likec4.panel",padding:"1",pointerEvents:"all"}),children:b.jsxs(Qd,{children:[b.jsx(lc,{label:"Align in columns",icon:b.jsx(Uee,{}),onClick:o=>{o.stopPropagation(),r.align("Column")}}),b.jsx(lc,{label:"Align left",icon:b.jsx(ZZe,{}),onClick:o=>{o.stopPropagation(),r.align("Left")}}),b.jsx(lc,{label:"Align center",icon:b.jsx(JZe,{}),onClick:o=>{o.stopPropagation(),r.align("Center")}}),b.jsx(lc,{label:"Align right",icon:b.jsx(tQe,{}),onClick:o=>{o.stopPropagation(),r.align("Right")}}),b.jsx(lc,{label:"Align in rows",icon:b.jsx(Uee,{style:{transform:"rotate(90deg)"}}),onClick:o=>{o.stopPropagation(),r.align("Row")}}),b.jsx(lc,{label:"Align top",icon:b.jsx(nQe,{}),onClick:o=>{o.stopPropagation(),r.align("Top")}}),b.jsx(lc,{label:"Align middle",icon:b.jsx(aQe,{}),onClick:o=>{o.stopPropagation(),r.align("Middle")}}),b.jsx(lc,{label:"Align bottom",icon:b.jsx(sQe,{}),onClick:o=>{o.stopPropagation(),r.align("Bottom")}}),b.jsx(lc,{label:"Reset all control points",icon:b.jsx(cQe,{}),onClick:o=>{o.stopPropagation(),r.resetEdgeControlPoints()}})]})})]})};function dQe(){const{enableReadOnly:e}=wr();return b.jsx(Pa,{children:!e&&b.jsx(Qr,{layout:"position",className:X1({gap:"xs",layerStyle:"likec4.panel",position:"relative",cursor:"pointer",padding:"xxs",pointerEvents:"all"}),initial:{opacity:0,translateX:-20},animate:{opacity:1,translateX:0},exit:{opacity:0,translateX:-20},children:b.jsxs(Qd,{openDelay:600,closeDelay:120,children:[b.jsx(UZe,{}),b.jsx(uQe,{}),b.jsx(YZe,{}),b.jsx(LZe,{})]})})})}/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const hQe=[["path",{d:"M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z",key:"svg-0"}]],fQe=yt("filled","player-stop-filled","PlayerStopFilled",hQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const pQe=[["path",{d:"M19.496 4.136l-12 7a1 1 0 0 0 0 1.728l12 7a1 1 0 0 0 1.504 -.864v-14a1 1 0 0 0 -1.504 -.864z",key:"svg-0"}],["path",{d:"M4 4a1 1 0 0 1 .993 .883l.007 .117v14a1 1 0 0 1 -1.993 .117l-.007 -.117v-14a1 1 0 0 1 1 -1z",key:"svg-1"}]],mQe=yt("filled","player-skip-back-filled","PlayerSkipBackFilled",pQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const gQe=[["path",{d:"M3 5v14a1 1 0 0 0 1.504 .864l12 -7a1 1 0 0 0 0 -1.728l-12 -7a1 1 0 0 0 -1.504 .864z",key:"svg-0"}],["path",{d:"M20 4a1 1 0 0 1 .993 .883l.007 .117v14a1 1 0 0 1 -1.993 .117l-.007 -.117v-14a1 1 0 0 1 1 -1z",key:"svg-1"}]],yQe=yt("filled","player-skip-forward-filled","PlayerSkipForwardFilled",gQe),Vee=Zn.withProps({component:ps,variant:"light",size:"xs",fw:"500"}),bQe=()=>{const{portalProps:e}=wm();return b.jsx(D1,{...e,children:b.jsx(Vr,{css:{position:"absolute",margin:"0",padding:"0",top:"0",left:"0",width:"100%",height:"100%",border:"2px solid",borderColor:"mantine.colors.orange[6]",pointerEvents:"none",md:{borderWidth:4}}})})};function vQe(){const e=Wt(),{isParallel:r,hasNext:n,hasPrevious:o,currentStep:a,totalSteps:i}=$a(s=>{const l=s.xyedges.findIndex(c=>c.id===s.activeWalkthrough?.stepId);return{isParallel:Sa(s.activeWalkthrough?.parallelPrefix),hasNext:l0,currentStep:l+1,totalSteps:s.xyedges.length}});return b.jsxs(Pa,{propagate:!0,children:[b.jsx(Lee,{variant:"light",size:"xs",color:"orange",mr:"sm",onClick:s=>{s.stopPropagation(),e.stopWalkthrough()},rightSection:b.jsx(fQe,{size:10}),children:"Stop"},"stop-walkthrough"),b.jsx(Vee,{disabled:!o,onClick:()=>e.walkthroughStep("previous"),leftSection:b.jsx(mQe,{size:10}),children:"Previous"},"prev"),b.jsx(Gl,{component:Qr,size:"md",radius:"sm",variant:r?"gradient":"transparent",gradient:{from:"red",to:"orange",deg:90},rightSection:b.jsx(Qr,{className:ye({fontSize:"xxs",display:r?"block":"none"}),children:"parallel"}),className:ye({alignItems:"baseline"}),children:b.jsxs(UWe,{children:[a," / ",i]})},"step-badge"),b.jsx(Vee,{disabled:!n,onClick:()=>e.walkthroughStep("next"),rightSection:b.jsx(yQe,{size:10}),children:"Next"},"next"),r&&b.jsx(bQe,{},"parallel-frame")]})}const qee=E.memo(()=>{const e=Jp(),r=NQ(),n=n8(CKe,{input:{viewModel:r}});return E.useEffect(()=>{const o=n.on("navigateTo",a=>{e.getSnapshot().context.view.id!==a.viewId&&e.send({type:"navigate.to",viewId:a.viewId})});return()=>o.unsubscribe()},[n,e]),UB(()=>{n.send({type:"update.inputs",inputs:{viewModel:r}})},[r]),b.jsx(Fp,{css:{alignItems:"flex-start",pointerEvents:"none",position:"absolute",top:"0",left:"0",margin:"0",width:"100%",gap:"xxs",maxWidth:["calc(100vw)","calc(100cqw)"],"@/sm":{margin:"xs",gap:"xs",width:"max-content",maxWidth:["calc(100vw - 2 * {spacing.md})","calc(100cqw - 2 * {spacing.md})"]}},children:b.jsxs(TKe,{value:n,children:[b.jsx(xQe,{actor:n}),b.jsx(dQe,{}),b.jsx(MZe,{})]})})});qee.displayName="NavigationPanel";const xQe=({actor:e})=>{const r=wn(e,o=>o.hasTag("active")),n=wm();return b.jsxs(mr,{offset:{mainAxis:4},opened:r,position:"bottom-start",trapFocus:!0,...n,clickOutsideEvents:["pointerdown","mousedown","click"],onDismiss:()=>e.send({type:"dropdown.dismiss"}),children:[b.jsx(wQe,{actor:e}),r&&b.jsx(vZe,{})]})},wQe=({actor:e})=>{const r=$a(n=>n.activeWalkthrough!==null);return b.jsx(dm,{children:b.jsx(pu,{children:b.jsx(Qr,{layout:!0,className:Uo({layerStyle:"likec4.panel",position:"relative",gap:"xs",cursor:"pointer",paddingRight:"md",pointerEvents:"all",width:"100%"}),onMouseLeave:()=>e.send({type:"breadcrumbs.mouseLeave"}),children:b.jsx(Pa,{mode:"popLayout",children:r?b.jsx(vQe,{}):b.jsx(nZe,{})})})})})},o7=ye({position:"absolute",bottom:"0",right:"0",padding:"2",margin:"0",width:"min-content",height:"min-content"}),kQe=ye({"--ai-radius":"0px",_noReduceGraphics:{"--ai-radius":"{radii.md}"}}),_Qe=ye({cursor:"default",userSelect:"none",minWidth:200,maxWidth:"calc(100vw - 20px)",backgroundColor:"mantine.colors.body/80",sm:{minWidth:300,maxWidth:"65vw"},md:{maxWidth:"40vw"},_dark:{backgroundColor:"mantine.colors.dark[6]/80"}}),EQe=ye({padding:"xxs"}),SQe=ye({backgroundColor:"transparent",transition:"all 100ms ease-in",_hover:{transition:"all 120ms ease-out",backgroundColor:"mantine.colors.primary[2]/50"},_dark:{_hover:{backgroundColor:"mantine.colors.dark[3]/40"}}});ye({fill:"var(--likec4-palette-fill)",stroke:"var(--likec4-palette-stroke)",strokeWidth:1,overflow:"visible",width:"100%",height:"auto",filter:`
- drop-shadow(0 2px 3px rgb(0 0 0 / 22%))
- drop-shadow(0 1px 8px rgb(0 0 0 / 10%))
- `});const CQe=ye({fontWeight:500,letterSpacing:"0.2px",paddingTop:"0",paddingBottom:"0",textTransform:"lowercase",transition:"all 150ms ease-in-out",cursor:"pointer","--badge-radius":"2px","--badge-fz":"9.5px","--badge-padding-x":"3px","--badge-height":"13.5px","--badge-lh":"1","--badge-bg":"var(--likec4-palette-fill)","--badge-color":"var(--likec4-palette-hiContrast)"});/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const TQe=[["path",{d:"M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0",key:"svg-0"}],["path",{d:"M12 16v.01",key:"svg-1"}],["path",{d:"M12 13a2 2 0 0 0 .914 -3.782a1.98 1.98 0 0 0 -2.414 .483",key:"svg-2"}]],AQe=yt("outline","help-circle","HelpCircle",TQe);/**
- * @license @tabler/icons-react v3.35.0 - MIT
- *
- * This source code is licensed under the MIT license.
- * See the LICENSE file in the root directory of this source tree.
- */const NQe=[["path",{d:"M7 7l10 10",key:"svg-0"}],["path",{d:"M17 8l0 9l-9 0",key:"svg-1"}]],RQe=yt("outline","arrow-down-right","ArrowDownRight",NQe),$Qe=({value:e})=>{const{title:r,color:n="primary",shape:o="rectangle"}=e,[a,i]=E.useState(null),s=Wt(),l=300,c=200;return b.jsx(z3,{shadow:"none",px:"xs",py:"sm",className:Je(SQe),"data-likec4-color":n,onMouseEnter:()=>{i(null),s.highlightNotation(e)},onMouseLeave:()=>{i(null),s.unhighlightNotation()},children:b.jsxs(Ur,{gap:"sm",align:"stretch",wrap:"nowrap",children:[b.jsx(Se,{flex:"0 0 70px",style:{position:"relative",width:70,height:sRe(70*(c/l),0)},children:b.jsx(gm,{data:{shape:o,width:l,height:c}})}),b.jsxs(ra,{gap:4,flex:1,children:[b.jsx(Ur,{gap:4,flex:"0 0 auto",children:e.kinds.map(u=>b.jsx(Gl,{className:Je(CQe),onMouseEnter:()=>{i(u),s.highlightNotation(e,u)},onMouseLeave:()=>{i(null),s.highlightNotation(e)},opacity:tV(a)&&a!==u?.25:1,children:u},u))}),b.jsx(wt,{component:"div",fz:"sm",fw:500,lh:"1.25",style:{textWrap:"pretty"},children:r})]})]})})},PQe=e=>({id:e.view.id,notations:e.view.notation?.nodes??[],isVisible:!0}),MQe=E.memo(()=>{const e=D9(c=>c.height),{id:r,notations:n,isVisible:o}=$a(PQe),[a,i]=yPe({key:"notation-webview-collapsed",defaultValue:!0}),s=n.length>0,l=wm();return b.jsxs(Pa,{children:[!s&&o&&b.jsx(cs.div,{initial:{opacity:.75,translateX:"50%"},animate:{opacity:1,translateX:0},exit:{translateX:"100%",opacity:.6},className:o7,children:b.jsx(po,{label:"View has no notations",color:"orange",...l,children:b.jsx(ci,{size:"lg",variant:"light",color:"orange",radius:"md",children:b.jsx(Hee,{})})})},"empty"),s&&o&&a&&b.jsx(cs.div,{initial:{opacity:.75,translateX:"50%"},animate:{opacity:1,translateX:0},exit:{translateX:"100%",opacity:.6},className:o7,children:b.jsx(po,{label:"Show notation",color:"dark",fz:"xs",...l,children:b.jsx(or,{size:"lg",variant:"default",color:"gray",className:kQe,onClick:()=>i(!1),children:b.jsx(AQe,{stroke:1.5})})})},"collapsed"),s&&o&&!a&&b.jsx(cs.div,{initial:{opacity:.75,scale:.2},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.25},className:Je("react-flow__panel",o7),style:{transformOrigin:"bottom right"},children:b.jsx(Rp,{radius:"sm",withBorder:!0,shadow:"lg",className:_Qe,children:b.jsxs(Jd,{defaultValue:"first",radius:"xs",children:[b.jsxs(q1,{children:[b.jsx(or,{size:"md",variant:"subtle",color:"gray",ml:2,style:{alignSelf:"center"},onClick:()=>i(!0),children:b.jsx(RQe,{stroke:2})}),b.jsx(jp,{value:"first",fz:"xs",children:"Elements"}),b.jsx(jp,{value:"second",fz:"xs",disabled:!0,children:"Relationships"})]}),b.jsx(Zl,{value:"first",className:EQe,hidden:a,children:b.jsx(ta,{viewportProps:{style:{maxHeight:`min(40vh, ${Math.max(e-60,50)}px)`}},children:b.jsx(ra,{gap:0,children:n.map((c,u)=>b.jsx($Qe,{value:c},u))})})})]})})},r)]})}),Yee=E.memo(()=>{const{enableControls:e,enableNotations:r,enableSearch:n,enableRelationshipDetails:o}=wr(),a=v6e(),i=VX(),s=vBe();return b.jsxs(lX,{onReset:a,children:[e&&b.jsx(Tze,{children:b.jsx(qee,{})}),i&&b.jsx(TGe,{overlaysActorRef:i}),r&&b.jsx(MQe,{}),n&&s&&b.jsx(fKe,{searchActorRef:s}),o&&b.jsx(wKe,{})]})});Yee.displayName="DiagramUI";function _m(e){return function(){return e}}const Wee=1e-12,a7=Math.PI,i7=2*a7,yh=1e-6,OQe=i7-yh;function Xee(e){this._+=e[0];for(let r=1,n=e.length;r=0))throw new Error(`invalid digits: ${e}`);if(r>15)return Xee;const n=10**r;return function(o){this._+=o[0];for(let a=1,i=o.length;ayh)if(!(Math.abs(h*c-u*d)>yh)||!i)this._append`L${this._x1=r},${this._y1=n}`;else{let g=o-s,y=a-l,x=c*c+u*u,w=g*g+y*y,k=Math.sqrt(x),C=Math.sqrt(p),_=i*Math.tan((a7-Math.acos((x+p-w)/(2*k*C)))/2),T=_/C,A=_/k;Math.abs(T-1)>yh&&this._append`L${r+T*d},${n+T*h}`,this._append`A${i},${i},0,0,${+(h*g>d*y)},${this._x1=r+A*c},${this._y1=n+A*u}`}}arc(r,n,o,a,i,s){if(r=+r,n=+n,o=+o,s=!!s,o<0)throw new Error(`negative radius: ${o}`);let l=o*Math.cos(a),c=o*Math.sin(a),u=r+l,d=n+c,h=1^s,p=s?a-i:i-a;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>yh||Math.abs(this._y1-d)>yh)&&this._append`L${u},${d}`,o&&(p<0&&(p=p%i7+i7),p>OQe?this._append`A${o},${o},0,1,${h},${r-l},${n-c}A${o},${o},0,1,${h},${this._x1=u},${this._y1=d}`:p>yh&&this._append`A${o},${o},0,${+(p>=a7)},${h},${this._x1=r+o*Math.cos(i)},${this._y1=n+o*Math.sin(i)}`)}rect(r,n,o,a){this._append`M${this._x0=this._x1=+r},${this._y0=this._y1=+n}h${o=+o}v${+a}h${-o}Z`}toString(){return this._}}function IQe(e){let r=3;return e.digits=function(n){if(!arguments.length)return r;if(n==null)r=null;else{const o=Math.floor(n);if(!(o>=0))throw new RangeError(`invalid digits: ${n}`);r=o}return e},()=>new LQe(r)}function zQe(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Gee(e){this._context=e}Gee.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,r){switch(e=+e,r=+r,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 1:this._point=2;default:this._context.lineTo(e,r);break}}};function jQe(e){return new Gee(e)}function BQe(e){return e[0]}function FQe(e){return e[1]}function HQe(e,r){var n=_m(!0),o=null,a=jQe,i=null,s=IQe(l);e=typeof e=="function"?e:e===void 0?BQe:_m(e),r=typeof r=="function"?r:r===void 0?FQe:_m(r);function l(c){var u,d=(c=zQe(c)).length,h,p=!1,g;for(o==null&&(i=a(g=s())),u=0;u<=d;++u)!(uWee){var l=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);o=(o*l-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,a=(a*l-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>Wee){var u=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,d=3*e._l23_a*(e._l23_a+e._l12_a);i=(i*u+e._x1*e._l23_2a-r*e._l12_2a)/d,s=(s*u+e._y1*e._l23_2a-n*e._l12_2a)/d}e._context.bezierCurveTo(o,a,i,s,e._x2,e._y2)}function Zee(e,r){this._context=e,this._alpha=r}Zee.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,r){if(e=+e,r=+r,this._point){var n=this._x2-e,o=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+o*o,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,r):this._context.moveTo(e,r);break;case 1:this._point=2;break;case 2:this._point=3;default:Kee(this,e,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=r}},(function e(r){function n(o){return r?new Zee(o,r):new l7(o,0)}return n.alpha=function(o){return e(+o)},n})(.5);function Qee(e,r){this._context=e,this._alpha=r}Qee.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,r){if(e=+e,r=+r,this._point){var n=this._x2-e,o=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+o*o,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Kee(this,e,r);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=r}};const UQe=(function e(r){function n(o){return r?new Qee(o,r):new c7(o,0)}return n.alpha=function(o){return e(+o)},n})(.5);class ia{constructor(r,n){this.x=r,this.y=n}static create(r){return new ia(r.x,r.y)}static add(r,n){return{x:r.x+n.x,y:r.y+n.y}}static sub(r,n){return{x:r.x-n.x,y:r.y-n.y}}static mul(r,n){return{x:r.x*n,y:r.y*n}}static dot(r,n){return r.x*n.x+r.y*n.y}static cross(r,n){return new ia(r.y*n.x-r.x*n.y,r.x*n.y-r.y*n.x)}static setLength(r,n){return bh(r).setLength(n)}add(r){return new ia(this.x+r.x,this.y+r.y)}sub(r){return new ia(this.x-r.x,this.y-r.y)}mul(r){return new ia(this.x*r,this.y*r)}dot(r){return this.x*r.x+this.y*r.y}cross(r){return new ia(this.y*r.x-this.x*r.y,this.x*r.y-this.y*r.x)}abs(){return Math.sqrt(this.x*this.x+this.y*this.y)}setLength(r){return this.mul(r/this.abs())}}function bh(e){return ia.create(e)}const VQe=".react-flow__edge.selected",qQe=ye({overflow:"visible",position:"absolute",pointerEvents:"none",top:"0",left:"0",mixBlendMode:"normal"}),YQe=ye({fill:"var(--likec4-palette-relation-stroke)",stroke:"var(--likec4-palette-relation-stroke)",fillOpacity:.75,strokeWidth:1,cursor:"grab",pointerEvents:"auto",visibility:"hidden",_hover:{fillOpacity:1,stroke:"mantine.colors.primary.filledHover",strokeWidth:10,transition:"stroke 100ms ease-out, stroke-width 100ms ease-out"},[`:where(${VQe}, [data-likec4-hovered='true']) &`]:{visibility:"visible",transition:"fill-opacity 150ms ease-out, stroke 150ms ease-out, stroke-width 150ms ease-out",transitionDelay:"50ms",fillOpacity:1,strokeWidth:5}}),WQe=ye({cursor:"grabbing","& *":{cursor:"grabbing !important"},"& .react-flow__edge-interaction":{cursor:"grabbing !important"}});function XQe(e){const{width:r,height:n}=Wn(e),{x:o,y:a}=e.internals.positionAbsolute;return{x:o+r/2,y:a+n/2}}function r_(e,r,n=0){const o=XQe(e),{width:a,height:i}=Wn(e),s=new ia(r.x,r.y).sub(o),l=(n+(a||0)/2)/s.x,c=(n+(i||0)/2)/s.y,u=Math.min(Math.abs(l),Math.abs(c));return bh(s).mul(u).add(o)}const GQe=HQe().curve(UQe).x(e=>e.x).y(e=>e.y),KQe=IA(e=>{const[r,n]=E.useState(!1),o=L9(),a=Hqe(),i=Wt(),{enableNavigateTo:s,enableEdgeEditing:l}=wr(),{id:c,source:u,sourceX:d,sourceY:h,target:p,targetX:g,targetY:y,selected:x=!1,data:{id:w,points:k,hovered:C=!1,active:_=!1,labelBBox:T,labelXY:A,...N},style:$={}}=e,R=s?N.navigateTo:void 0,M=mt(wQ(u),`source node ${u} not found`),O=mt(wQ(p),`target node ${p} not found`),B=Sa(N.controlPoints)||!_y(M.internals.positionAbsolute,M.data)||!_y(O.internals.positionAbsolute,O.data);let I=N.controlPoints??SQ(e.data),Y;if(B){const W={x:d,y:h},G={x:g,y},Z=6,oe=N.dir==="back"?[G,r_(O,hp(I)??W,Z),...I,r_(M,Ud(I)??G,Z),W]:[W,r_(M,hp(I)??G,Z),...I,r_(O,Ud(I)??W,Z),G];Y=mt(GQe(oe))}else Y=tYe(k);let D=T?.x??0,V=T?.y??0;const[L,U]=E.useState({x:A?.x??D,y:A?.y??V}),q=E.useRef(null);E.useEffect(()=>{const W=q.current;if(!W)return;const G=W.getPointAtLength(W.getTotalLength()*.5),Z={x:yi(G.x),y:yi(G.y)};U(oe=>_y(oe,Z)?oe:Z)},[Y]),g6e(()=>{!T||T.x===L.x&&T.y===L.y||i.updateEdgeData(c,{labelXY:{x:L.x,y:L.y}})},[L],50,300),(B||r)&&(D=L.x,V=L.y);const X=(W,G,Z)=>{const{addSelectedEdges:oe}=o.getState();oe([c]);const ee=i.cancelSaveManualLayout();G.stopPropagation();let re=!1,he={x:G.clientX,y:G.clientY};const Ce=be=>{const De={x:be.clientX,y:be.clientY};if(!_y(he,De)){n(!0),re||(i.send({type:"xyflow.edgeEditingStarted",edge:e.data}),re=!0),he=De;const{x:Ge,y:Xe}=a.screenToFlowPosition(he,{snapToGrid:!1}),_t=I.slice();_t[W]={x:yi(Ge),y:yi(Xe)},i.updateEdgeData(c,{controlPoints:_t})}be.stopPropagation()},ce=be=>{Z.removeEventListener("pointermove",Ce,{capture:!0}),re&&be.stopPropagation(),(re||ee)&&i.scheduleSaveManualLayout(),n(!1)},de=be=>{be.stopPropagation(),be.preventDefault()};Z.addEventListener("pointermove",Ce,{capture:!0}),Z.addEventListener("pointerup",ce,{once:!0,capture:!0}),Z.addEventListener("click",de,{capture:!0,once:!0})},F=(W,G,Z)=>{if(I.length<=1)return;const oe=ee=>{const re=I.slice();re.splice(W,1),ee.stopPropagation(),setTimeout(()=>{i.updateEdgeData(c,{controlPoints:re}),i.scheduleSaveManualLayout()},10)};Z.addEventListener("pointerup",oe,{once:!0,capture:!0}),G.stopPropagation()},J=(W,G)=>{const{domNode:Z}=o.getState();if(!(!Z||G.pointerType!=="mouse"))switch(G.button){case 0:X(W,G,Z);break;case 2:F(W,G,Z);break}},Q=W=>{const{domNode:G}=o.getState();if(!G||W.pointerType!=="mouse"||W.button!==2)return;const Z=[new ia(d,h),...I.map(bh)||[],new ia(g,y)];let oe={x:W.clientX,y:W.clientY};const ee=bh(a.screenToFlowPosition(oe,{snapToGrid:!1}));let re=0,he=1/0;for(let ce=0;ce{W.stopPropagation(),i.navigateTo(R)}})})})]}),l&&I.length>0&&(x||C||r)&&b.jsx(OU,{children:b.jsx(Ay,{component:"svg",className:qQe,...e,style:{...$,zIndex:z},children:b.jsx("g",{onContextMenu:W=>{W.preventDefault(),W.stopPropagation()},children:I.map((W,G)=>b.jsx("circle",{onPointerDown:Z=>J(G,Z),className:Je("nodrag nopan",YQe),cx:Math.round(W.x),cy:Math.round(W.y),r:3},"controlPoints"+w+"#"+G))})})})]})}),n_=16;function ZQe(e){const r=Wt(),{navigateTo:n}=e.data,o=e.source===e.target,a=e.sourceX>e.targetX,[i]=_w({sourceX:e.sourceX,sourceY:e.sourceY,sourcePosition:e.sourcePosition,targetX:e.targetX,targetY:e.targetY,targetPosition:e.targetPosition,...o&&{offset:30,borderRadius:16}});let s=e.sourceX;switch(!0){case o:s=e.sourceX+24+n_;break;case a:s=e.sourceX-n_;break;default:s=e.sourceX+n_;break}return b.jsxs(Ay,{...e,children:[b.jsx(Ny,{edgeProps:e,svgPath:i}),b.jsx(Bk,{edgeProps:e,labelPosition:{x:s,y:e.sourceY+(o?0:n_),translate:a?"translate(-100%, 0)":void 0},children:b.jsx(Ty,{edgeProps:e,children:n&&b.jsx(jk,{onClick:l=>{l.stopPropagation(),r.navigateTo(n)}})})})]})}const Jee=({extraButtons:e,...r})=>{const{enableNavigateTo:n,enableRelationshipBrowser:o}=wr(),a=Wt(),{navigateTo:i,modelFqn:s}=r.data;let l=E.useMemo(()=>{const c=[];return i&&n&&c.push({key:"navigate",icon:b.jsx(gi,{}),onClick:u=>{u.stopPropagation(),a.navigateTo(i,r.data.id)}}),o&&c.push({key:"relationships",icon:b.jsx(Ry,{}),onClick:u=>{u.stopPropagation(),a.openRelationshipsBrowser(s)}}),c},[n,o,a,s,i,r.data.id]);return e&&To(e,1)&&(l=[...l,...e]),b.jsx(Hk,{...r,buttons:l})},QQe=({extraButtons:e,...r})=>{const{enableNavigateTo:n,enableRelationshipBrowser:o}=wr(),a=Wt(),{id:i,navigateTo:s,modelFqn:l}=r.data;let c=E.useMemo(()=>{const u=[];return s&&n&&u.push({key:"navigate",icon:b.jsx(gi,{}),onClick:d=>{d.stopPropagation(),a.navigateTo(s,i)}}),o&&l&&u.push({key:"relationships",icon:b.jsx(Ry,{}),onClick:d=>{d.stopPropagation(),a.openRelationshipsBrowser(l)}}),u},[n,o,a,l,s,i]);return e&&To(e,1)&&(c=[...c,...e]),b.jsx(Hk,{...r,buttons:c})};function JQe({data:{hovered:e=!1},icon:r,onClick:n}){const o=tC(e,e?130:0)[0]&&e;return b.jsx(Qr,{initial:!1,animate:{scale:o?1.2:1,x:o?-1:0,y:o?-1:0},whileHover:{scale:1.4,x:-3,y:-1},className:"likec4-compound-navigation compound-action",whileTap:{scale:1},onClick:cn,children:b.jsx(or,{className:Je("nodrag nopan",YJ({delay:e&&!o}),Ek({variant:"transparent"})),onClick:n,onDoubleClick:cn,children:r??b.jsx(gi,{stroke:2})})})}const ete=e=>{const{enableNavigateTo:r}=wr(),n=Wt(),{navigateTo:o}=e.data;return o&&r?b.jsx(JQe,{onClick:a=>{a.stopPropagation(),n.navigateTo(o,e.id)},...e}):null},tte=["primary","secondary","muted"],rte=po.withProps({color:"dark",fz:"xs",openDelay:400,closeDelay:150,label:"",children:null,offset:4,withinPortal:!1});function o_(e,r){const{onChange:n}=sc(),o=Wt(),[a,i]=E.useState(null),s=it(c=>{if(c===null){nt(a,"originalColor is null"),i(null),o.updateNodeData(r.data.id,{color:a});return}i(u=>u??r.data.color),o.updateNodeData(r.data.id,{color:c})}),l=it(c=>{n?.({change:{op:"change-element-style",style:c,targets:[e]}});const{shape:u,color:d,...h}=c;o.updateNodeData(r.data.id,{...u&&{shape:u},...d&&{color:d},style:h})});return{elementColor:a??r.data.color,onColorPreview:s,onChange:l}}function a_({fqn:e}){const r=Wt();return b.jsx(rte,{label:"Browse relationships",children:b.jsx(or,{size:"sm",variant:"subtle",color:"gray",onClick:n=>{n.stopPropagation(),r.openRelationshipsBrowser(e)},children:b.jsx(Ry,{stroke:2,style:{width:"72%",height:"72%"}})})})}function i_(e){const{onOpenSource:r}=sc();return r?b.jsx(rte,{label:"Open source",children:b.jsx(or,{size:"sm",variant:"subtle",color:"gray",onClick:n=>{n.stopPropagation(),e.elementId?r?.({element:e.elementId}):e.deploymentId&&r?.({deployment:e.deploymentId})},children:b.jsx(pm,{stroke:1.8,style:{width:"70%"}})})}):null}function nte(){const e=E.useContext(W1);e||console.error("No LikeC4ModelContext found");const r=e?.$styles??TL.DEFAULT,[n,o]=E.useState(r);return E.useEffect(()=>{o(a=>a.equals(r)?a:r)},[r]),n}function s_({elementColor:e,elementOpacity:r,onColorPreview:n,isOpacityEditable:o=!1,onChange:a,...i}){const{theme:s}=nte();return b.jsxs(mr,{clickOutsideEvents:["pointerdown","mousedown","click"],position:"right-end",offset:2,withinPortal:!1,...i,children:[b.jsx(pu,{children:b.jsx(Zn,{variant:"subtle",color:"gray",size:"compact-xs",px:3,children:b.jsx(j1,{color:s.colors[e].elements.fill,size:14,withShadow:!0,style:{color:"#fff",cursor:"pointer"}})})}),b.jsxs(Xl,{p:"xs",children:[b.jsx(eJe,{theme:s,elementColor:e,onColorPreview:n,onChange:l=>a({color:l})}),o&&b.jsxs(b.Fragment,{children:[b.jsx(RT,{h:"xs"}),b.jsx(Lp,{label:"opacity",labelPosition:"left"}),b.jsx(RT,{h:"xs"}),b.jsx(tJe,{elementOpacity:r,onOpacityChange:l=>{a({opacity:l})}})]})]})]})}function eJe({theme:e,elementColor:r,onColorPreview:n,onChange:o}){const a=s=>l=>{l.stopPropagation(),n(null),r!==s&&o(s)},i=q6(e.colors).filter(s=>!tte.includes(s));return b.jsx(ra,{gap:2,onMouseLeave:()=>n(null),children:b.jsxs(Qd,{openDelay:1e3,closeDelay:300,children:[b.jsx(Op,{maw:120,gap:"6",justify:"flex-start",align:"flex-start",direction:"row",wrap:"wrap",children:tte.map(s=>b.jsx(po,{label:s,fz:"xs",color:"dark",offset:2,withinPortal:!1,transitionProps:{duration:140,transition:"slide-up"},children:b.jsx(j1,{color:e.colors[s].elements.fill,size:18,withShadow:!0,onMouseEnter:()=>n(s),onClick:a(s),style:{color:"#fff",cursor:"pointer"},children:r===s&&b.jsx(rW,{style:{width:Ne(10),height:Ne(10)}})})},s))}),b.jsx(Op,{mt:"sm",maw:110,gap:"6",justify:"flex-start",align:"flex-start",direction:"row",wrap:"wrap",children:i.map(s=>b.jsx(po,{label:s,fz:"xs",color:"dark",offset:2,transitionProps:{duration:140,transition:"slide-up"},children:b.jsx(j1,{color:e.colors[s].elements.fill,size:18,onMouseEnter:()=>n(s),onClick:a(s),style:{color:"#fff",cursor:"pointer"},children:r===s&&b.jsx(rW,{style:{width:Ne(10),height:Ne(10)}})})},s))})]})})}function tJe({elementOpacity:e=100,onOpacityChange:r}){const[n,o]=E.useState(e);return UB(()=>{o(e)},[e]),b.jsx(NT,{size:"sm",color:"dark",value:n,onChange:o,onChangeEnd:r})}const rJe=ye({color:"mantine.colors.dimmed",fontSize:"10px",fontWeight:600,maxWidth:"220px",cursor:"default",userSelect:"all",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap"}),nJe=()=>$a(e=>e.xynodes.filter(r=>r.selected).length);function l_({title:e,children:r,nodeProps:n,...o}){const a=nJe(),{selected:i=!1,dragging:s=!1,data:{hovered:l=!1}}=n,c=l&&a===0||i&&a===1;let u=150;c?i?u=100:u=1e3:a>0&&(u=50);const[d]=tC(c,u);return d?b.jsx(jU,{isVisible:!s,offset:4,...o,children:b.jsx(Rp,{className:Je("nodrag","nopan"),px:5,pb:8,pt:4,radius:"sm",shadow:"xl",onDoubleClickCapture:cn,onPointerDown:cn,onClick:cn,onDoubleClick:cn,withBorder:!0,children:b.jsxs(ra,{gap:"6px",children:[b.jsx(Se,{px:"4px",children:b.jsx(wt,{className:rJe,children:e})}),b.jsx(Ur,{gap:4,children:r})]})})}):null}function oJe(e){const{enableVscode:r,enableRelationshipBrowser:n}=wr(),{data:{style:o,modelFqn:a}}=e,{elementColor:i,onColorPreview:s,onChange:l}=o_(a,e),c=o?.opacity??100;return b.jsxs(l_,{nodeProps:e,title:a,align:"start",children:[b.jsx(s_,{elementColor:i,onColorPreview:s,isOpacityEditable:!0,elementOpacity:c,onChange:l,position:"left-start"}),b.jsx(ote,{elementBorderStyle:o?.border??(c<99?"dashed":"none"),onChange:l}),r&&b.jsx(i_,{elementId:a}),n&&b.jsx(a_,{fqn:a})]})}function aJe(e){const{enableVscode:r,enableRelationshipBrowser:n}=wr(),{data:{deploymentFqn:o,style:a,modelFqn:i}}=e,{elementColor:s,onColorPreview:l,onChange:c}=o_(o,e);return b.jsxs(l_,{nodeProps:e,title:o,align:"start",children:[b.jsx(s_,{elementColor:s,onColorPreview:l,isOpacityEditable:!0,elementOpacity:a?.opacity,onChange:c,position:"left-start"}),b.jsx(ote,{elementBorderStyle:a?.border,onChange:c}),r&&b.jsx(i_,{deploymentId:o}),n&&i&&b.jsx(a_,{fqn:i})]})}function ote({elementBorderStyle:e="dashed",onChange:r}){const[n,o]=E.useState(e);return E.useEffect(()=>{o(e)},[e]),b.jsx(Se,{children:b.jsx(U1,{size:"xs",fullWidth:!0,withItemsBorders:!1,value:n,onChange:a=>{const i=a;o(i),r({border:i})},styles:{label:{paddingTop:"0.5",paddingBottom:"0.5"}},data:[{label:"Solid",value:"solid"},{label:"Dashed",value:"dashed"},{label:"Dotted",value:"dotted"},{label:"None",value:"none"}]})})}function iJe(e){const{enableVscode:r,enableRelationshipBrowser:n}=wr(),{data:{shape:o,modelFqn:a}}=e,{elementColor:i,onColorPreview:s,onChange:l}=o_(a,e);return b.jsxs(l_,{nodeProps:e,title:a,align:"start",children:[b.jsx(ate,{elementShape:o,onChange:l}),b.jsx(s_,{elementColor:i,onColorPreview:s,onChange:l,position:"right-end"}),r&&b.jsx(i_,{elementId:a}),n&&b.jsx(a_,{fqn:a})]})}function sJe(e){const{enableVscode:r,enableRelationshipBrowser:n}=wr(),{data:{shape:o,deploymentFqn:a,modelFqn:i}}=e,{elementColor:s,onColorPreview:l,onChange:c}=o_(a,e);return b.jsxs(l_,{nodeProps:e,title:a,align:"start",children:[b.jsx(ate,{elementShape:o,onChange:c}),b.jsx(s_,{elementColor:s,onColorPreview:l,onChange:c,position:"right-end"}),r&&b.jsx(i_,{deploymentId:a}),n&&i&&b.jsx(a_,{fqn:i})]})}function ate({elementShape:e,onChange:r}){return b.jsxs(fo,{openDelay:300,closeDelay:450,floatingStrategy:"fixed",closeOnClickOutside:!0,clickOutsideEvents:["pointerdown","mousedown","click"],closeOnEscape:!0,closeOnItemClick:!1,position:"top-start",offset:2,styles:{item:{padding:"calc(var(--mantine-spacing-xs) / 1.5) var(--mantine-spacing-xs)"}},withinPortal:!1,children:[b.jsx(F3,{children:b.jsx(Zn,{variant:"light",color:"gray",size:"compact-xs",rightSection:b.jsx(LA,{size:12}),children:e})}),b.jsx(F1,{onDoubleClick:cn,onClick:cn,children:Lye.map(n=>b.jsx(H1,{fz:12,fw:500,value:n,rightSection:e===n?b.jsx(TQ,{size:12}):void 0,onClick:o=>{o.stopPropagation(),r({shape:n})},children:n},n))})]})}const c_={top:"50%",left:"50%",right:"unset",bottom:"unset",visibility:"hidden",width:5,height:5,transform:"translate(-50%, -50%)"},Iy=()=>b.jsxs(b.Fragment,{children:[b.jsx(uo,{type:"target",position:tt.Top,style:c_}),b.jsx(uo,{type:"target",position:tt.Left,style:c_}),b.jsx(uo,{type:"source",position:tt.Right,style:c_}),b.jsx(uo,{type:"source",position:tt.Bottom,style:c_})]});function u7(e){const{enableElementDetails:r}=wr(),n=Wt(),o=e.data.modelFqn;return!r||!o?null:b.jsx(FA,{...e,onClick:a=>{a.stopPropagation(),n.openElementDetails(o,e.id)}})}function ite(e){const{enableElementDetails:r}=wr(),n=Wt(),o=e.data.modelFqn;return!r||!o?null:b.jsx(WJ,{...e,onClick:a=>{a.stopPropagation(),n.openElementDetails(o,e.id)}})}function lJe(e){const{enableElementTags:r,enableReadOnly:n}=wr();return b.jsxs(mm,{nodeProps:e,children:[b.jsx(gm,{...e}),b.jsx(ms,{...e}),r&&b.jsx(Ey,{...e}),b.jsx(Jee,{...e}),b.jsx(u7,{...e}),!n&&b.jsx(iJe,{...e}),b.jsx(Iy,{})]})}function cJe(e){const{enableElementTags:r,enableReadOnly:n}=wr();return b.jsxs(mm,{nodeProps:e,children:[b.jsx(gm,{...e}),b.jsx(ms,{...e}),r&&b.jsx(Ey,{...e}),b.jsx(QQe,{...e}),b.jsx(u7,{...e}),!n&&b.jsx(sJe,{...e}),b.jsx(Iy,{})]})}function uJe(e){const{enableElementDetails:r,enableReadOnly:n}=wr();return b.jsxs($y,{nodeProps:e,children:[b.jsx(Py,{...e}),b.jsx(ete,{...e}),r&&b.jsx(ite,{...e}),!n&&b.jsx(oJe,{...e}),b.jsx(Iy,{})]})}function dJe(e){const{enableElementDetails:r,enableReadOnly:n}=wr();return b.jsxs($y,{nodeProps:e,children:[b.jsx(Py,{...e}),b.jsx(ete,{...e}),r&&b.jsx(ite,{...e}),!n&&b.jsx(aJe,{...e}),b.jsx(Iy,{})]})}function hJe(e){return b.jsxs($y,{nodeProps:e,children:[b.jsx(Py,{...e}),b.jsx(Iy,{})]})}const fJe={left:tt.Left,right:tt.Right,top:tt.Top,bottom:tt.Bottom},pJe=({data:e,port:r})=>b.jsxs(b.Fragment,{children:[b.jsx(Vr,{"data-likec4-color":e.color,className:ye({position:"absolute",backgroundColor:"var(--likec4-palette-fill)",rounded:"xs",width:{base:"5px",_whenHovered:"7px",_whenSelected:"7px"},transition:"fast",translateX:"-1/2",translateY:"-1/2",translate:"auto"}),style:{top:r.cy,left:r.cx,height:r.height}}),b.jsx(uo,{id:r.id,type:r.type,position:fJe[r.position],style:{top:r.cy-3,left:r.cx-3,width:6,height:6,right:"unset",bottom:"unset",visibility:"hidden",transform:r.position==="left"?"translate(-150%, 0)":"translate(100%, 0)"}})]}),mJe=e=>Sa(e.modelFqn);function gJe(e){const r=e.data,{positionAbsoluteY:n,data:{viewHeight:o,hovered:a=!1,ports:i}}=e;return b.jsxs(b.Fragment,{children:[b.jsx(Vr,{"data-likec4-color":"gray",className:ye({position:"absolute",rounded:"xs",top:"1",pointerEvents:"none",transition:"fast",translateX:"-1/2",translate:"auto"}),style:{backgroundColor:"var(--likec4-palette-stroke)",opacity:a?.6:.4,left:"50%",width:a?3:2,height:o-n,zIndex:-1,pointerEvents:"none"}}),b.jsxs(mm,{nodeProps:e,children:[b.jsx(gm,{...e}),b.jsx(ms,{...e}),mJe(r)&&b.jsxs(b.Fragment,{children:[b.jsx(Jee,{...e,data:r}),b.jsx(u7,{...e,data:r})]})]}),i.map(s=>b.jsx(pJe,{port:s,data:e.data},s.id))]})}function yJe(e){return b.jsx(Vr,{"data-likec4-color":e.data.color,css:{width:"100%",height:"100%",border:"default",rounded:"sm",borderWidth:1,"--_color":{base:"var(--likec4-palette-stroke)",_dark:"[color-mix(in srgb, var(--likec4-palette-hiContrast) 40%, var(--likec4-palette-fill))]"},borderColor:"[var(--_color)/30]",backgroundColor:"var(--likec4-palette-fill)/15",pointerEvents:"none",paddingLeft:"2",paddingTop:"0.5",fontSize:"xs",fontWeight:"bold",letterSpacing:".75px",color:"[var(--_color)/75]"},children:"PARALLEL"})}const vh={ElementNode:lJe,DeploymentNode:cJe,CompoundElementNode:uJe,CompoundDeploymentNode:dJe,ViewGroupNode:hJe,SequenceActorNode:gJe,SequenceParallelArea:yJe},ste={RelationshipEdge:KQe,SequenceStepEdge:ZQe};class Em{static LeftPadding=40;static RightPadding=40;static TopPadding=55;static BottomPadding=40;id;minX=1/0;minY=1/0;maxX=-1/0;maxY=-1/0;get positionAbsolute(){return{x:this.minX,y:this.minY}}set positionAbsolute(r){const n=Math.round(r.x),o=Math.round(r.y);this.maxX+=n-this.minX,this.maxY+=o-this.minY,this.minX=n,this.minY=o}get dimensions(){return{width:this.maxX-this.minX,height:this.maxY-this.minY}}get position(){const r=this.positionAbsolute;if(!this.parent)return r;const n=this.parent.positionAbsolute;return{x:r.x-n.x,y:r.y-n.y}}constructor(r,n=null){this.id=r.id,this.positionAbsolute=n?{x:r.position.x+n.minX,y:r.position.y+n.minY}:r.position;const{width:o,height:a}=Wn(r);this.maxX=this.minX+Math.ceil(o),this.maxY=this.minY+Math.ceil(a),n&&n.children.push(this)}}class d7 extends Em{constructor(r,n=null){super(r,n),this.parent=n}children=[]}class bJe extends Em{constructor(r,n=null){super(r,n),this.parent=n}}function lte(e,r){const{parentLookup:n,nodeLookup:o}=e.getState(),a=new Map,i=g=>{const y=[];let x=o.get(g)?.parentId,w;for(;x&&(w=o.get(x));)y.push(w.id),x=w.parentId;return y},s=new Set(r.flatMap(i)),l=[...o.values()].flatMap(g=>g.parentId?[]:{xynode:g,parent:null});for(;l.length>0;){const{xynode:g,parent:y}=l.shift();if(!r.includes(g.id)&&g.type!=="element"&&g.type!=="deployment"&&s.has(g.id)){const x=new d7(g,y);a.set(g.id,x),n.get(g.id)?.forEach(w=>{l.push({xynode:w,parent:x})})}else a.set(g.id,new bJe(g,y))}const c=[...a.values()];u(c);function u(g){for(const y of g){if(!(y instanceof d7))continue;u(y.children);const x={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const w of y.children)x.minX=Math.min(x.minX,w.minX),x.minY=Math.min(x.minY,w.minY),x.maxX=Math.max(x.maxX,w.maxX),x.maxY=Math.max(x.maxY,w.maxY);y.minX=x.minX-Em.LeftPadding,y.minY=x.minY-Em.TopPadding,y.maxX=x.maxX+Em.RightPadding,y.maxY=x.maxY+Em.BottomPadding}}function d(){u(c),e.getState().triggerNodeChanges(c.reduce((g,y)=>(g.push({id:y.id,type:"position",dragging:!1,position:y.position,positionAbsolute:y.positionAbsolute}),y instanceof d7&&g.push({id:y.id,type:"dimensions",setAttributes:!0,dimensions:y.dimensions}),g),[]))}let h=null;function p(){c.length!==0&&(h??=requestAnimationFrame(()=>{h=null;const{nodeLookup:g}=e.getState();for(const y of r){const x=mt(a.get(y)),w=mt(g.get(y));x.positionAbsolute=w.internals.positionAbsolute}d()}))}return{rects:a,updateXYFlowNodes:d,onMove:p}}function vJe(){const e=L9(),r=Wt(),n=E.useRef(void 0);return E.useMemo(()=>{let o=!1;const a={x:0,y:0};let i=!1;return{onNodeDragStart:(s,l)=>{o=r.cancelSaveManualLayout();const{nodeLookup:c}=e.getState(),u=yn(Array.from(c.values()),dp(d=>d.draggable!==!1&&(d.dragging===!0||d.id===l.id||d.selected===!0)));To(u,1)&&(n.current=lte(e,Ao(u,d=>d.id))),a.x=s.clientX,a.y=s.clientY,i=!1},onNodeDrag:s=>{i=Math.abs(s.clientX-a.x)>4||Math.abs(s.clientY-a.y)>4,n.current?.onMove()},onNodeDragStop:s=>{i=Math.abs(s.clientX-a.x)>4||Math.abs(s.clientY-a.y)>4,(o||i)&&r.scheduleSaveManualLayout(),n.current=void 0}}},[e,r])}const xJe={relationship:ste.RelationshipEdge,"seq-step":ste.SequenceStepEdge},Cu={element:ic(vh.ElementNode),deployment:ic(vh.DeploymentNode),"compound-element":ic(vh.CompoundElementNode),"compound-deployment":ic(vh.CompoundDeploymentNode),"view-group":ic(vh.ViewGroupNode),"seq-actor":ic(vh.SequenceActorNode),"seq-parallel":ic(vh.SequenceParallelArea)};function wJe(e){return!e||iu(e)?Cu:{element:e.element??Cu.element,deployment:e.deployment??Cu.deployment,"compound-element":e.compoundElement??Cu["compound-element"],"compound-deployment":e.compoundDeployment??Cu["compound-deployment"],"view-group":e.viewGroup??Cu["view-group"],"seq-actor":e.seqActor??Cu["seq-actor"],"seq-parallel":e.seqParallel??Cu["seq-parallel"]}}const kJe=e=>({initialized:e.initialized.xydata&&e.initialized.xyflow,nodes:e.xynodes,edges:e.xyedges,pannable:e.pannable,zoomable:e.zoomable,fitViewPadding:e.fitViewPadding,enableFitView:e.features.enableFitView,enableReadOnly:e.features.enableReadOnly||e.toggledFeatures.enableReadOnly||e.dynamicViewVariant==="sequence"&&e.view._type==="dynamic",...!e.features.enableFitView&&{viewport:{x:-Math.min(e.view.bounds.x,0),y:-Math.min(e.view.bounds.y,0),zoom:1}}}),_Je=(e,r)=>e.initialized===r.initialized&&e.pannable===r.pannable&&e.zoomable===r.zoomable&&e.enableFitView===r.enableFitView&&e.enableReadOnly===r.enableReadOnly&&ut(e.fitViewPadding,r.fitViewPadding)&&Xn(e.nodes,r.nodes)&&Xn(e.edges,r.edges)&&Xn(e.viewport??null,r.viewport??null);function EJe({background:e="dots",nodesDraggable:r=!1,nodesSelectable:n=!1,reactFlowProps:o={},children:a,renderNodes:i}){const s=Wt(),{initialized:l,nodes:c,edges:u,enableReadOnly:d,enableFitView:h,...p}=$a(kJe,_Je),{onNodeContextMenu:g,onCanvasContextMenu:y,onEdgeContextMenu:x,onNodeClick:w,onEdgeClick:k,onCanvasClick:C,onCanvasDblClick:_}=sc(),T=!d,A=_ze(),N=vJe(),$=Sze(),R=VV(()=>{$.set(!0)},A?120:400),M=vp(()=>{R.clear(),$.get()&&$.set(!1)},A?350:200),O=it(D=>{D&&($.get()||R.start(),M())}),B=it((D,V)=>{R.clear(),s.send({type:"xyflow.viewportMoved",viewport:V,manually:!!D})}),I=it(()=>{s.send({type:"xyflow.resized"})}),Y=VB(()=>wJe(i),[i],$Q);return $k(()=>{console.warn("renderNodes changed - this might degrade performance")},[Y]),b.jsx(U9,{nodes:c,edges:u,className:Je(l?"initialized":"not-initialized"),nodeTypes:Y,edgeTypes:xJe,onNodesChange:it(D=>{s.send({type:"xyflow.applyNodeChanges",changes:D})}),onEdgesChange:it(D=>{s.send({type:"xyflow.applyEdgeChanges",changes:D})}),background:l?e:"transparent",fitView:!1,onNodeClick:it((D,V)=>{D.stopPropagation(),s.send({type:"xyflow.nodeClick",node:V}),w?.(s.findDiagramNode(V.id),D)}),onEdgeClick:it((D,V)=>{D.stopPropagation(),s.send({type:"xyflow.edgeClick",edge:V}),k?.(s.findDiagramEdge(V.id),D)}),onPaneClick:it(D=>{D.stopPropagation(),s.send({type:"xyflow.paneClick"}),C?.(D)}),onDoubleClick:it(D=>{D.stopPropagation(),D.preventDefault(),s.send({type:"xyflow.paneDblClick"}),_?.(D)}),onNodeMouseEnter:it((D,V)=>{D.stopPropagation(),V.data.hovered||s.send({type:"xyflow.nodeMouseEnter",node:V})}),onNodeMouseLeave:it((D,V)=>{D.stopPropagation(),V.data.hovered&&s.send({type:"xyflow.nodeMouseLeave",node:V})}),onEdgeMouseEnter:it((D,V)=>{D.stopPropagation(),V.data.hovered||s.send({type:"xyflow.edgeMouseEnter",edge:V,event:D})}),onEdgeMouseLeave:it((D,V)=>{D.stopPropagation(),V.data.hovered&&s.send({type:"xyflow.edgeMouseLeave",edge:V,event:D})}),onMove:O,onMoveEnd:B,onInit:it(D=>{s.send({type:"xyflow.init",instance:D})}),onNodeContextMenu:it((D,V)=>{const L=mt(s.findDiagramNode(V.id),`diagramNode ${V.id} not found`);g?.(L,D)}),onEdgeContextMenu:it((D,V)=>{const L=mt(s.findDiagramEdge(V.id),`diagramEdge ${V.id} not found`);x?.(L,D)}),onPaneContextMenu:it(D=>{y?.(D)}),...h&&{onViewportResize:I},nodesDraggable:T&&r,nodesSelectable:n,edgesFocusable:!1,...T&&r&&N,...p,...o,children:a})}function SJe(e){const{view:r,nodesSelectable:n}=e,o=[],a=[],i=new Map,s=E4.from(r.nodes.reduce((h,p)=>(i.set(p.id,p),p.parent||h.push({node:p,parent:null}),h),[]));let l=h=>!0;if(e.where)try{const h=Nd(e.where);l=p=>h({...lV(p,["tags","kind"]),..."source"in p?{source:u(p.source)}:p,..."target"in p?{target:u(p.target)}:p})}catch(h){console.error("Error in where filter:",h)}const c="",u=h=>mt(i.get(h),`Node not found: ${h}`);let d;for(;d=s.dequeue();){const{node:h,parent:p}=d,g=To(h.children,1)||h.kind==vd;if(g)for(const A of h.children)s.enqueue({node:u(A),parent:h});const y={x:h.x,y:h.y};p&&(y.x-=p.x,y.y-=p.y);const x={id:c+h.id,selectable:n&&h.kind!==vd,focusable:n&&h.kind!==vd,deletable:!1,position:y,zIndex:g?ds.Compound:ds.Element,style:{width:h.width,height:h.height},initialWidth:h.width,initialHeight:h.height,hidden:h.kind!==vd&&!l(h),...p&&{parentId:c+p.id}},w={viewId:r.id,id:h.id,title:h.title,color:h.color,shape:h.shape,style:h.style,depth:h.depth??0,icon:h.icon??"none",tags:h.tags??null,x:h.x,y:h.y},k={viewId:r.id,id:h.id,title:h.title,technology:h.technology??null,description:Kt.from(h.description),height:h.height,width:h.width,level:h.level,color:h.color,shape:h.shape,style:h.style,icon:h.icon??null,tags:h.tags,x:h.x,y:h.y,isMultiple:h.style?.multiple??!1};if(h.kind===vd){o.push({...x,type:"view-group",data:{isViewGroup:!0,...w},dragHandle:".likec4-compound-title"});continue}const C=h.modelRef??null,_=h.deploymentRef??null;if(!C&&!_)throw console.error("Invalid node",h),new Error("Element should have either modelRef or deploymentRef");const T={navigateTo:h.navigateTo??null};switch(!0){case(g&&!!_):{o.push({...x,type:"compound-deployment",data:{...w,...T,deploymentFqn:_,modelFqn:C},dragHandle:".likec4-compound-title"});break}case g:{nt(!!C,"ModelRef expected"),o.push({...x,type:"compound-element",data:{...w,...T,modelFqn:C},dragHandle:".likec4-compound-title"});break}case!!_:{o.push({...x,type:"deployment",data:{...k,...T,deploymentFqn:_,modelFqn:C}});break}default:nt(!!C,"ModelRef expected"),o.push({...x,type:"element",data:{...k,...T,modelFqn:C}})}}for(const h of r.edges){const p=h.source,g=h.target,y=c+h.id;if(!To(h.points,2)){console.error("edge should have at least 2 points",h);continue}a.push({id:y,type:"relationship",source:c+p,target:c+g,zIndex:ds.Edge,selectable:n,hidden:!l(h),deletable:!1,data:{id:h.id,label:h.label,technology:h.technology,notes:Kt.from(h.notes),navigateTo:h.navigateTo,controlPoints:h.controlPoints??null,labelBBox:h.labelBBox??null,labelXY:h.labelBBox?{x:h.labelBBox.x,y:h.labelBBox.y}:null,points:h.points,color:h.color??"gray",line:h.line??"dashed",dir:h.dir??"forward",head:h.head??"normal",tail:h.tail??"none",astPath:h.astPath},interactionWidth:20})}return{bounds:r.bounds,xynodes:o,xyedges:a}}const cte={parallel:1,actor:10},u_={default:"gray",active:"amber"};function CJe(e){const{actors:r,steps:n,compounds:o,parallelAreas:a,bounds:i}=e.sequenceLayout,s=[],l=[],c=u=>mt(e.nodes.find(d=>d.id===u));for(const u of o)s.push(TJe(u,c(u.origin),e));for(const u of a)s.push(AJe(u,e));for(const u of r)s.push(NJe(u,c(u.id),i,e));for(const u of n){const d=e.edges.find(h=>h.id===u.id);if(!d)throw new Error(`Edge ${u.id} not found`);l.push(RJe(u,d))}return{bounds:i,xynodes:s,xyedges:l}}function TJe({id:e,x:r,y:n,width:o,height:a,depth:i},s,l){return{id:e,type:"view-group",data:{id:s.id,title:s.title,color:s.color??"gray",shape:s.shape,style:s.style,tags:s.tags,x:r,y:n,viewId:l.id,depth:i,isViewGroup:!0},position:{x:r,y:n},draggable:!1,selectable:!1,focusable:!1,style:{pointerEvents:"none"},width:o,initialWidth:o,height:a,initialHeight:a}}function AJe({parallelPrefix:e,x:r,y:n,width:o,height:a},i){return{id:`seq-parallel-${e}`,type:"seq-parallel",data:{id:`seq-parallel-${e}`,title:"PARALLEL",technology:null,color:u_.default,shape:"rectangle",style:{},tags:[],x:r,y:n,level:0,icon:null,width:o,height:a,description:Kt.EMPTY,viewId:i.id,parallelPrefix:e},zIndex:cte.parallel,position:{x:r,y:n},draggable:!1,deletable:!1,selectable:!1,focusable:!1,style:{pointerEvents:"none"},width:o,initialWidth:o,height:a,initialHeight:a}}function NJe({id:e,x:r,y:n,width:o,height:a,ports:i},s,l,c){return{id:e,type:"seq-actor",data:{id:s.id,x:r,y:n,level:0,icon:s.icon??null,isMultiple:s.style.multiple??!1,title:s.title,width:o,height:a,color:s.color,navigateTo:s.navigateTo??null,shape:s.shape,style:s.style,tags:s.tags,modelFqn:s.modelRef??null,technology:s.technology??null,description:Kt.from(s.description),viewHeight:l.height,viewId:c.id,ports:i},deletable:!1,selectable:!0,zIndex:cte.actor,position:{x:r,y:n},width:o,initialWidth:o,height:a,initialHeight:a}}function RJe({id:e,labelBBox:r,sourceHandle:n,targetHandle:o},a){return{id:e,type:"seq-step",data:{id:e,label:a.label,technology:a.technology,notes:Kt.from(a.notes),navigateTo:a.navigateTo,controlPoints:null,labelBBox:{x:0,y:0,width:r?.width??a.labelBBox?.width??32,height:r?.height??a.labelBBox?.height??32},labelXY:null,points:a.points,color:a.color,line:a.line,dir:"forward",head:a.head??"normal",tail:a.tail??"none",astPath:a.astPath},selectable:!0,focusable:!1,zIndex:20,interactionWidth:40,source:a.source,sourceHandle:n,target:a.target,targetHandle:o}}function $Je({dynamicViewVariant:e,...r}){const n=r.view,o=n._type==="dynamic",{bounds:a,xynodes:i,xyedges:s}=o&&e==="sequence"?CJe(n):SJe(r);return o&&n.variant!==e?{view:{...n,bounds:a,variant:e},xynodes:i,xyedges:s}:{view:a===n.bounds?n:{...n,bounds:a},xynodes:i,xyedges:s}}function ute(e,r){return r.map(n=>{const o=e.find(a=>a.id===n.id);return o&&ut(o.type,n.type)?ut(o.hidden??!1,n.hidden??!1)&&ut(o.source,n.source)&&ut(o.sourceHandle??null,n.sourceHandle??null)&&ut(o.target,n.target)&&ut(o.targetHandle??null,n.targetHandle??null)&&ut(o.zIndex??0,n.zIndex??0)&&ut(o.data,n.data)?o:{...Vd(o,["hidden","zIndex"]),...n,data:n.data}:n})}function dte(e,r){return H6(r)?ute(e,r):(r=e,n=>ute(n,r))}function hte(e,r){return r.map(n=>{const o=e.find(a=>a.id===n.id);if(o&&ut(o.type,n.type)){const{width:a,height:i}=Wn(o);return ut(a,n.initialWidth)&&ut(i,n.initialHeight)&&ut(o.parentId??null,n.parentId??null)&&ut(o.hidden??!1,n.hidden??!1)&&ut(o.zIndex??0,n.zIndex??0)&&ut(o.position,n.position)&&ut(o.data,n.data)?o:{...Vd(o,["measured","parentId","hidden","zIndex"]),...n,width:n.initialWidth,height:n.initialHeight,data:n.data}}return n})}function h7(e,r){return H6(r)?hte(e,r):(r=e,n=>hte(n,r))}const f7={top:"40px",bottom:"16px",left:"16px",right:"16px"};function fte(e){const r=[],n=[],o=new Map,a=E4.from(e.nodes.reduce((l,c)=>(o.set(c.id,c),c.parent||l.push({node:c,parent:null}),l),[])),i=l=>mt(o.get(l),`Node not found: ${l}`);let s;for(;s=a.dequeue();){const{node:l,parent:c}=s,u=To(l.children,1)||l.kind==vd;if(u)for(const x of l.children)a.enqueue({node:i(x),parent:l});const d={x:l.x,y:l.y};c&&(d.x-=c.x,d.y-=c.y);const h=l.id,p={id:h,draggable:!1,selectable:!0,focusable:!0,position:d,zIndex:u?ds.Compound:ds.Element,style:{width:l.width,height:l.height},initialWidth:l.width,initialHeight:l.height,...c&&{parentId:c.id}},g=l.modelRef??null,y={navigateTo:l.navigateTo??null};switch(!0){case l.kind===Ik.Empty:{r.push({...p,type:"empty",data:{column:l.column}});break}case(u&&!!g):{r.push({...p,type:"compound",data:{id:h,column:l.column,title:l.title,color:l.color,shape:l.shape,style:l.style,depth:l.depth??0,icon:l.icon??"none",ports:l.ports,existsInCurrentView:l.existsInCurrentView,fqn:g,...y}});break}default:nt(g,"Element should have either modelRef or deploymentRef"),r.push({...p,type:"element",data:{id:h,column:l.column,fqn:g,title:l.title,technology:l.technology,description:l.description,height:l.height,width:l.width,color:l.color,shape:l.shape,icon:l.icon??"none",ports:l.ports,style:l.style,existsInCurrentView:l.existsInCurrentView,tags:l.tags,...y}})}}for(const l of e.edges){const c=l.source,u=l.target,d=l.id;if(!To(l.points,2)){console.error("edge should have at least 2 points",l);continue}if(!To(l.relations,1)){console.error("edge should have at least 1 relation",l);continue}n.push({id:d,type:"relationship",source:c,target:u,sourceHandle:l.sourceHandle,targetHandle:l.targetHandle,data:{sourceFqn:l.sourceFqn,targetFqn:l.targetFqn,relations:l.relations,color:l.color??"gray",label:l.label,navigateTo:l.navigateTo??null,line:l.line??"dashed",existsInCurrentView:l.existsInCurrentView},interactionWidth:20})}return{xynodes:r,xyedges:n}}const pte=e=>e.find(r=>r.data.column==="subjects"&&rV(r.parentId)),PJe=Kje(async({input:e,self:r,signal:n})=>{const{subjectId:o,navigateFromNode:a,xyflow:i,xystore:s,update:l}=e;let{nodes:c,width:u,height:d}=s.getState();const h=fte(l),p=()=>{const{nodes:R,edges:M}=s.getState();return{xynodes:h7(R,h.xynodes),xyedges:dte(M,h.xyedges)}},g=mt(r._parent);let y=i.getZoom();const x=Math.max(y,1),w=tu(l.bounds,u,d,hs,x,f7),k=h.xynodes.find(R=>R.type!=="empty"&&R.data.column==="subjects"&&R.data.fqn===o)??pte(h.xynodes),C=pte(c),_=a?c.find(R=>R.id===a):c.find(R=>R.type!=="empty"&&R.data.column!=="subjects"&&R.data.fqn===o);if(!k||!_||k.type==="empty"||!C||k.data.fqn===C.data.fqn)return await i.setViewport(w),p();const T={x:k.position.x+(k.initialWidth??0)/2,y:k.position.y+(k.initialHeight??0)/2},A=i.getInternalNode(C.id),N=eYe(A),$=new Set;return c.forEach(R=>{if(R.id!==_.id){if(R.data.column==="subjects"){$.add(R.id);return}R.parentId&&(R.parentId===_.id||$.has(R.parentId))&&$.add(R.id)}}),c=h7(c,c.flatMap(R=>$.has(R.id)?[]:R.id!==_.id?{...R,data:{...R.data,dimmed:R.data.column==="subjects"?"immediate":!0}}:{...Vd(R,["parentId"]),position:{x:N.x-R.initialWidth/2,y:N.y-R.initialHeight/2},zIndex:ds.Max,hidden:!1,data:{...R.data,dimmed:!1}})),g.send({type:"update.xydata",xynodes:c,xyedges:[]}),await F4e(120),h.xynodes=h.xynodes.map(Jt.setDimmed(!1)),n.aborted||(await i.setCenter(N.x,N.y,{zoom:y,duration:300}),await i.setCenter(T.x,T.y,{zoom:y})),p()}),MJe=ec({actors:{layouter:PJe},guards:{hasViewId:({context:e})=>e.viewId!==null,isReady:({context:e})=>e.xyflow!==null&&e.xystore!==null&&e.layouted!==null,anotherSubject:({context:e,event:r})=>r.type==="update.view"?e.layouted?.subject!==r.layouted.subject:!1},actions:{"xyflow.init":et(({event:e})=>(Ut(e,"xyflow.init"),{xyflow:e.instance,xystore:e.store})),"update.view":et(({event:e})=>(Ut(e,"update.view"),{layouted:e.layouted,...fte(e.layouted)})),"xyflow:updateNodeInternals":({context:e})=>{nt(e.xystore,"xystore is not initialized");const{domNode:r,updateNodeInternals:n}=e.xystore.getState(),o=new Set(e.xyedges.flatMap(i=>[i.source,i.target]));if(o.size===0||!r)return;const a=new Map;for(const i of o){const s=r.querySelector(`.react-flow__node[data-id="${i}"]`);s&&a.set(i,{id:i,nodeElement:s,force:!0})}n(a,{triggerFitView:!1})},"xyflow:fitDiagram":({context:e},r)=>{let{duration:n,bounds:o}=r??{};n??=450;const{xyflow:a,xystore:i}=e;nt(a,"xyflow is not initialized"),nt(i,"xystore is not initialized"),o??=e.layouted?.bounds;const s=Math.max(a.getZoom(),1);if(o){const{width:l,height:c}=i.getState(),u=tu(o,l,c,hs,s,f7);a.setViewport(u,n>0?{duration:n}:void 0).catch(console.error)}else a.fitView({minZoom:hs,maxZoom:s,padding:f7,...n>0&&{duration:n}}).catch(console.error)},"xyflow.applyNodeChanges":et(({context:e,event:r})=>(Ut(r,"xyflow.applyNodeChanges"),{xynodes:Aw(r.changes,e.xynodes)})),"xyflow.applyEdgeChanges":et(({context:e,event:r})=>(Ut(r,"xyflow.applyEdgeChanges"),{xyedges:Nw(r.changes,e.xyedges)}))}}).createMachine({id:"relationships-browser",context:({input:e})=>({subject:e.subject,viewId:e.viewId,scope:e.viewId?e.scope:"global",closeable:e.closeable??!0,enableSelectSubject:e.enableSelectSubject??!0,enableChangeScope:e.enableChangeScope??!0,xyflow:null,xystore:null,layouted:null,navigateFromNode:null,xynodes:[],xyedges:[]}),initial:"initializing",on:{"xyflow.applyNodeChanges":{actions:"xyflow.applyNodeChanges"},"xyflow.applyEdgeChanges":{actions:"xyflow.applyEdgeChanges"}},states:{initializing:{on:{"xyflow.init":{actions:"xyflow.init",target:"isReady"},"update.view":{actions:"update.view",target:"isReady"},stop:"closed",close:"closed"}},isReady:{always:[{guard:"isReady",actions:[{type:"xyflow:fitDiagram",params:{duration:0}},sn({type:"xyflow.updateNodeInternals"},{delay:150})],target:"active"},{target:"initializing"}]},active:{initial:"idle",tags:["active"],on:{"xyflow.nodeClick":{actions:ln(({event:e,enqueue:r})=>{if("fqn"in e.node.data){const n=e.node.data.fqn;r.raise({type:"navigate.to",subject:n,fromNode:e.node.id})}})},"xyflow.edgeClick":{guard:"hasViewId",actions:ln(({event:e,context:r,system:n,enqueue:o})=>{(e.edge.selected||e.edge.data.relations.length>1)&&o.sendTo(tc(n).overlaysActorRef,{type:"open.relationshipDetails",viewId:r.viewId,source:e.edge.data.sourceFqn,target:e.edge.data.targetFqn})})},"navigate.to":{actions:[et({subject:({event:e})=>e.subject,viewId:({event:e,context:r})=>e.viewId??r.viewId??null,navigateFromNode:({event:e})=>e.fromNode??null})]},"xyflow.paneDblClick":{actions:"xyflow:fitDiagram"},"update.view":{actions:"update.view",target:".layouting"},"change.scope":{actions:et({scope:({event:e})=>e.scope})},"xyflow.updateNodeInternals":{actions:"xyflow:updateNodeInternals"},fitDiagram:{actions:{type:"xyflow:fitDiagram",params:Ca("event")}},"xyflow.resized":{actions:[oa("fitDiagram"),sn({type:"fitDiagram"},{id:"fitDiagram",delay:300})]},"xyflow.init":{actions:"xyflow.init"},"xyflow.unmount":{target:"initializing"},close:"closed"},states:{idle:{on:{"xyflow.edgeMouseEnter":{actions:[et({xyedges:({context:e,event:r})=>{const n=e.xyedges.some(o=>o.data.dimmed!==!1||o.selected);return e.xyedges.map(o=>o.id===r.edge.id?Jt.setData(o,{hovered:!0,dimmed:!1}):n&&!o.selected?Jt.setDimmed(o,"immediate"):o)}}),oa("undim.edges"),oa("dim.nonhovered.edges"),sn({type:"dim.nonhovered.edges"},{id:"dim.nonhovered.edges",delay:200})]},"xyflow.edgeMouseLeave":{actions:[et({xyedges:({context:e,event:r})=>e.xyedges.map(n=>n.id===r.edge.id?Jt.setHovered(n,!1):n)}),oa("dim.nonhovered.edges"),sn({type:"undim.edges"},{id:"undim.edges",delay:400})]},"dim.nonhovered.edges":{actions:et({xyedges:({context:e})=>e.xyedges.map(r=>r.data.hovered?r:Jt.setDimmed(r,r.data.dimmed==="immediate"?"immediate":!0))})},"undim.edges":{actions:et({xyedges:({context:e})=>e.xyedges.map(Jt.setDimmed(!1))})},"xyflow.selectionChange":{actions:ln(({event:e,context:r,enqueue:n})=>{e.edges.length===0&&r.xyedges.some(o=>o.data.dimmed)&&!r.xyedges.some(o=>o.data.hovered)&&n.raise({type:"undim.edges"})})}}},layouting:{invoke:{id:"layouter",src:"layouter",input:({context:e})=>({subjectId:e.subject,navigateFromNode:e.navigateFromNode,xyflow:mt(e.xyflow),xystore:mt(e.xystore),update:mt(e.layouted)}),onDone:{target:"idle",actions:ln(({enqueue:e,event:r})=>{e.assign({xynodes:r.output.xynodes,xyedges:r.output.xyedges,navigateFromNode:null}),e.raise({type:"fitDiagram",duration:200},{id:"fitDiagram",delay:50});for(let n=0;n<6;n++)e.raise({type:"xyflow.updateNodeInternals"},{delay:100+n*100})})}},on:{"update.xydata":{actions:et({xynodes:({event:e})=>e.xynodes,xyedges:({event:e})=>e.xyedges})},"xyflow.applyEdgeChanges":{},"xyflow.applyNodeChanges":{}}}}},closed:{id:"closed",type:"final"}},exit:et({xyflow:null,layouted:null,xystore:null,xyedges:[],xynodes:[]})}),mte=MJe,OJe=ec({actors:{relationshipsBrowserLogic:mte}}).createMachine({id:"element-details",context:({input:e})=>({...e,initiatedFrom:{node:e.initiatedFrom?.node??null,clientRect:e.initiatedFrom?.clientRect??null}}),initial:"active",states:{active:{entry:qp("relationshipsBrowserLogic",{id:({self:e})=>`${e.id}-relationships`,input:({context:e})=>({subject:e.subject,viewId:e.currentView.id,scope:"view",enableSelectSubject:!1,enableChangeScope:!0,closeable:!1})}),exit:[il(({self:e})=>`${e.id}-relationships`,{type:"close"}),yu(({self:e})=>`${e.id}-relationships`)],on:{"change.subject":{actions:et({subject:({event:e})=>e.subject})},close:"closed"}},closed:{id:"closed",type:"final"}}}),DJe=OJe;function LJe(e){const r=[],n=[],o=new Map,a=E4.from(e.nodes.reduce((l,c)=>(o.set(c.id,c),c.parent||l.push({node:c,parent:null}),l),[])),i=l=>mt(o.get(l),`Node not found: ${l}`);let s;for(;s=a.dequeue();){const{node:l,parent:c}=s,u=To(l.children,1);if(u)for(const x of l.children)a.enqueue({node:i(x),parent:l});const d={x:l.x,y:l.y};c&&(d.x-=c.x,d.y-=c.y);const h=l.id,p={id:h,draggable:!1,selectable:!0,focusable:!0,deletable:!1,position:d,zIndex:u?ds.Compound:ds.Element,style:{width:l.width,height:l.height},initialWidth:l.width,initialHeight:l.height,...c&&{parentId:c.id}},g=l.modelRef,y={navigateTo:l.navigateTo??null};switch(!0){case u:{r.push({...p,type:"compound",data:{id:h,column:l.column,title:l.title,color:l.color,style:l.style,depth:l.depth??0,icon:l.icon??"none",ports:l.ports,fqn:g,...y}});break}default:r.push({...p,type:"element",data:{id:h,column:l.column,fqn:g,title:l.title,technology:l.technology,description:Kt.from(l.description),height:l.height,width:l.width,color:l.color,shape:l.shape,icon:l.icon??"none",ports:l.ports,style:l.style,tags:l.tags,...y}})}}for(const{source:l,target:c,relationId:u,label:d,technology:h,description:p,navigateTo:g=null,color:y="gray",line:x="dashed",...w}of e.edges){const k=w.id;n.push({id:k,type:"relationship",source:l,target:c,sourceHandle:w.sourceHandle,targetHandle:w.targetHandle,deletable:!1,data:{relationId:u,label:d,color:y,navigateTo:g,line:x,description:Kt.from(p),...h&&{technology:h}}})}return{xynodes:r,xyedges:n,bounds:e.bounds}}function gte(e){return"edgeId"in e?(nt(V6(e.edgeId),"edgeId is required"),{edgeId:e.edgeId}):{source:e.source,target:e.target}}const IJe=ec({actions:{"xyflow:fitDiagram":({context:e},r)=>{let{duration:n,bounds:o}=r??{};n??=450;const{xyflow:a,xystore:i}=e;nt(a,"xyflow is not initialized"),nt(i,"xystore is not initialized"),o??=e.bounds;const s=Math.max(a.getZoom(),1);if(o){const{width:l,height:c}=i.getState(),u=tu(o,l,c,hs,s,.1);a.setViewport(u,n>0?{duration:n}:void 0).catch(console.error)}else a.fitView({minZoom:hs,maxZoom:s,padding:.1,...n>0&&{duration:n}}).catch(console.error)},"xyflow:updateNodeInternals":({context:e})=>{nt(e.xystore,"xystore is not initialized");const{domNode:r,updateNodeInternals:n}=e.xystore.getState(),o=new Set(e.xyedges.flatMap(i=>[i.source,i.target]));if(o.size===0||!r)return;const a=new Map;for(const i of o){const s=r.querySelector(`.react-flow__node[data-id="${i}"]`);s&&a.set(i,{id:i,nodeElement:s,force:!0})}n(a,{triggerFitView:!1})},updateXYFlow:et(({context:e,event:r})=>{Ut(r,"xyflow.init");let n=e.initialized;return n.xyflow||(n={...n,xyflow:!0}),{initialized:n,xyflow:r.instance,xystore:r.store}}),updateLayoutData:et(({context:e,event:r})=>{Ut(r,"update.layoutData");const{xynodes:n,xyedges:o,bounds:a}=LJe(r.data);let i=e.initialized;return i.xydata||(i={...i,xydata:!0}),{initialized:i,xynodes:h7(e.xynodes,n),xyedges:dte(e.xyedges,o),bounds:Xn(e.bounds,a)?e.bounds:a}})},guards:{isReady:({context:e})=>e.initialized.xydata&&e.initialized.xyflow,"enable: navigate.to":()=>!0}}).createMachine({initial:"initializing",context:({input:e})=>({subject:gte(e),viewId:e.viewId,bounds:{x:0,y:0,width:200,height:200},initialized:{xydata:!1,xyflow:!1},xyflow:null,xystore:null,xynodes:[],xyedges:[]}),states:{initializing:{on:{"xyflow.init":{actions:"updateXYFlow",target:"isReady"},"update.layoutData":{actions:"updateLayoutData",target:"isReady"},close:{target:"closed"}}},isReady:{always:[{guard:"isReady",actions:[{type:"xyflow:fitDiagram",params:{duration:0}},sn({type:"xyflow.updateNodeInternals"},{delay:50})],target:"ready"},{target:"initializing"}]},ready:{on:{"xyflow.edgeMouseEnter":{actions:[et({xyedges:({context:e,event:r})=>{const n=e.xyedges.some(o=>o.data.dimmed===!0||o.data.dimmed==="immediate");return e.xyedges.map(o=>o.id===r.edge.id?Jt.setData(o,{hovered:!0,dimmed:!1}):n&&!o.selected?Jt.setDimmed(o,"immediate"):o)}}),oa("undim.edges"),oa("dim.nonhovered.edges"),sn({type:"dim.nonhovered.edges"},{id:"dim.nonhovered.edges",delay:100})]},"xyflow.edgeMouseLeave":{actions:[et({xyedges:({context:e,event:r})=>e.xyedges.map(n=>n.id===r.edge.id?Jt.setHovered(n,!1):n)}),oa("dim.nonhovered.edges"),sn({type:"undim.edges"},{id:"undim.edges",delay:400})]},"dim.nonhovered.edges":{actions:et({xyedges:({context:e})=>e.xyedges.map(r=>Jt.setDimmed(r,r.data.hovered!==!0))})},"undim.edges":{actions:et({xyedges:({context:e})=>e.xyedges.some(r=>r.selected===!0)?e.xyedges.map(r=>Jt.setDimmed(r,r.selected!==!0?r.data.dimmed||"immediate":!1)):e.xyedges.map(Jt.setDimmed(!1))})},"xyflow.selectionChange":{actions:ln(({event:e,context:r,enqueue:n})=>{e.edges.length===0&&r.xyedges.some(o=>o.data.dimmed)&&!r.xyedges.some(o=>o.data.hovered)&&n.raise({type:"undim.edges"})})},"update.layoutData":{actions:["updateLayoutData",oa("fitDiagram"),sn({type:"fitDiagram",duration:0},{id:"fitDiagram",delay:50}),sn({type:"xyflow.updateNodeInternals"},{delay:75})]},"xyflow.init":{actions:"updateXYFlow"},"xyflow.applyNodeChanges":{actions:et({xynodes:({context:e,event:r})=>Aw(r.changes,e.xynodes)})},"xyflow.applyEdgeChanges":{actions:et({xyedges:({context:e,event:r})=>Nw(r.changes,e.xyedges)})},"xyflow.paneDblClick":{actions:"xyflow:fitDiagram"},"navigate.to":{actions:et({subject:({event:e})=>gte(e.params),viewId:({context:e,event:r})=>r.params.viewId??e.viewId})},close:{target:"closed"}},exit:et({xyedges:[],xynodes:[],initialized:{xydata:!1,xyflow:!1},xyflow:null,xystore:null})},closed:{type:"final"}},on:{fitDiagram:{actions:{type:"xyflow:fitDiagram",params:Ca("event")}},"xyflow.resized":{actions:[oa("fitDiagram"),sn({type:"fitDiagram"},{id:"fitDiagram",delay:200})]},"xyflow.updateNodeInternals":{actions:"xyflow:updateNodeInternals"}}}),zJe=IJe,jJe=zX(({sendBack:e})=>{const r=oC([["Escape",n=>{n.stopPropagation(),e({type:"close"})},{preventDefault:!0}]]);return document.body.addEventListener("keydown",r,{capture:!0}),()=>{document.body.removeEventListener("keydown",r,{capture:!0})}}),BJe=ec({actors:{relationshipDetails:zJe,elementDetails:DJe,relationshipsBrowser:mte,hotkey:jJe},actions:{closeLastOverlay:ln(({context:e,enqueue:r})=>{if(e.overlays.length===0)return;const n=Ud(e.overlays)?.id;n&&(r.sendTo(n,{type:"close"}),r.stopChild(n),r.assign({overlays:e.overlays.filter(o=>o.id!==n)}))}),closeSpecificOverlay:ln(({context:e,enqueue:r},n)=>{const o=e.overlays.find(a=>a.id===n.actorId)?.id;o&&(r.sendTo(o,{type:"close"}),r.stopChild(o),r.assign({overlays:e.overlays.filter(a=>a.id!==o)}))}),closeAllOverlays:ln(({context:e,enqueue:r})=>{for(const{id:n}of e$e(e.overlays))r.sendTo(n,{type:"close"}),r.stopChild(n);r.assign({overlays:[]})}),openElementDetails:ln(({context:e,enqueue:r,event:n})=>{if(Ut(n,"open.elementDetails"),e.overlays.some(a=>a.type==="elementDetails"&&a.subject===n.subject))return;const o=`elementDetails-${e.seq}`;r.spawnChild("elementDetails",{id:o,input:n}),r.assign({seq:e.seq+1,overlays:[...e.overlays,{type:"elementDetails",id:o,subject:n.subject}]})}),openRelationshipDetails:ln(({context:e,enqueue:r,event:n})=>{Ut(n,"open.relationshipDetails");const o=Ud(e.overlays);if(o?.type==="relationshipDetails"){r.sendTo(o.id,{...n,type:"navigate.to"});return}const a=`relationshipDetails-${e.seq}`;r.spawnChild("relationshipDetails",{id:a,input:n}),r.assign({seq:e.seq+1,overlays:[...e.overlays,{type:"relationshipDetails",id:a}]})}),openRelationshipsBrowser:ln(({context:e,enqueue:r,event:n})=>{Ut(n,"open.relationshipsBrowser");const o=Ud(e.overlays);if(o?.type==="relationshipsBrowser"){r.sendTo(o.id,{type:"navigate.to",subject:n.subject,viewId:n.viewId});return}const a=`relationshipsBrowser-${e.seq}`;r.spawnChild("relationshipsBrowser",{id:a,input:n}),r.assign({seq:e.seq+1,overlays:[...e.overlays,{type:"relationshipsBrowser",id:a,subject:n.subject}]})}),listenToEsc:qp("hotkey",{id:"hotkey"}),stopListeningToEsc:yu("hotkey")},guards:{"has overlays?":({context:e})=>e.overlays.length>0,"close specific overlay?":({context:e,event:r})=>(Ut(r,"close"),V6(r.actorId)&&e.overlays.some(n=>n.id===r.actorId)),"last: is relationshipDetails?":({context:e})=>Ud(e.overlays)?.type==="relationshipDetails","last: is relationshipsBrowser?":({context:e})=>Ud(e.overlays)?.type==="relationshipsBrowser"}}).createMachine({id:"overlays",context:()=>({seq:1,overlays:[]}),initial:"idle",on:{"open.elementDetails":{actions:"openElementDetails",target:".active",reenter:!1},"open.relationshipDetails":{actions:"openRelationshipDetails",target:".active",reenter:!1},"open.relationshipsBrowser":{actions:"openRelationshipsBrowser",target:".active",reenter:!1}},states:{idle:{},active:{entry:"listenToEsc",exit:"stopListeningToEsc",on:{close:[{guard:"close specific overlay?",actions:{type:"closeSpecificOverlay",params:({event:e})=>({actorId:e.actorId})},target:"closing"},{actions:"closeLastOverlay",target:"closing"}],"close.all":{actions:["closeAllOverlays","stopListeningToEsc"],target:"idle"}}},closing:{always:[{guard:"has overlays?",target:"active"},{actions:"stopListeningToEsc",target:"idle"}]}},exit:["stopListeningToEsc","closeAllOverlays"]}),FJe=BJe,HJe=ec({actions:{"change searchValue":et({searchValue:({event:e,context:r})=>(Ut(e,["change.search","open"]),e.search??r.searchValue)}),"reset pickViewFor":et({pickViewFor:()=>null})}}).createMachine({id:"search",context:{openedWithSearch:null,searchValue:"",pickViewFor:null},initial:"inactive",on:{close:{target:".inactive",actions:"reset pickViewFor"}},states:{inactive:{on:{open:{target:"opened",actions:[et({openedWithSearch:({event:e})=>e.search??null,searchValue:({event:e,context:r})=>e.search??r.searchValue})]}}},opened:{on:{open:{actions:"change searchValue"},"change.search":{actions:"change searchValue"},"pickview.open":{target:"pickView",actions:et({pickViewFor:({event:e})=>e.elementFqn})}}},pickView:{on:{"pickview.close":{target:"opened",actions:"reset pickViewFor"}}}}}),UJe=HJe;class yte{}class Sm extends yte{constructor(r,n,o){super(),this.getEdgePosition=r,this.computePosition=n,this.propertyToEdit=o}alignTo;computeLayout(r){this.alignTo=this.getEdgePosition(r)}applyPosition(r){return{[this.propertyToEdit]:this.computePosition(this.alignTo,r)}}}class VJe extends yte{layout=new Map;axisPreset;get primaryAxisCoord(){return this.axisPreset.primaryAxisCoord}get secondaryAxisCoord(){return this.axisPreset.secondaryAxisCoord}get primaryAxisDimension(){return this.axisPreset.primaryAxisDimension}get secondaryAxisDimension(){return this.axisPreset.secondaryAxisDimension}constructor(r){super(),this.axisPreset=r==="Column"?{primaryAxisDimension:"width",secondaryAxisDimension:"height",primaryAxisCoord:"x",secondaryAxisCoord:"y"}:{primaryAxisDimension:"height",secondaryAxisDimension:"width",primaryAxisCoord:"y",secondaryAxisCoord:"x"}}applyPosition(r){return this.layout?.get(r.id)??{}}computeLayout(r){const n=yn(r,jw(i=>i[this.primaryAxisCoord])),o=this.getLayoutRect(n),a=this.getLayers(n);this.layout=this.buildLayout(a,o,n)}getLayoutRect(r){const n=Math.min(...r.map(s=>s.x)),o=Math.min(...r.map(s=>s.y)),a=Math.max(...r.map(s=>s.x+s.width)),i=Math.max(...r.map(s=>s.y+s.height));return{x:n,y:o,width:a-n,height:i-o}}getLayers(r){const n=[];let o=0,a=null;for(let i of r)if(a&&i[this.primaryAxisCoord]i.nodes.sort((s,l)=>s[this.secondaryAxisCoord]-l[this.secondaryAxisCoord])),n}buildLayout(r,n,o){const a=new Map(o.map(y=>[y.id,y])),i=[],s=r.reduce((y,x)=>y+x.primaryAxisSize,0),l=r.length>1?(n[this.primaryAxisDimension]-s)/(r.length-1):0,c=r.reduce((y,x,w)=>r[y].occupiedSpacey+x.primaryAxisSize+l,n[this.primaryAxisCoord]),h=this.buildLayerLayout(u,n,d,a,null);u.layout=h,i.push(...h.nodePositions);let p=d+u.primaryAxisSize+l,g=u;for(let y=c+1;y=0;y--){const x=r[y];p-=x.primaryAxisSize+l,x.layout=this.buildLayerLayout(x,n,p,a,g),i.push(...x.layout.nodePositions),g=x.layout.refLayer??x}return new Map(i)}buildLayerLayout(r,n,o,a,i){let s=this.scoreLayout(this.spaceAround(r,n,o),a);if(r.nodes.length!=1){const l=this.scoreLayout(this.spaceBetween(r,n,o),a);s=l[0]=r.nodes.length){const l=this.scoreLayout(this.placeInGaps(r,o,i),a);s=l[0]