@skill-map/cli 0.28.0 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/tutorial/sm-tutorial.md +94 -20
- package/dist/cli.js +1561 -1214
- package/dist/cli.js.map +1 -1
- package/dist/index.js +116 -99
- package/dist/index.js.map +1 -1
- package/dist/kernel/index.d.ts +903 -1004
- package/dist/kernel/index.js +116 -99
- package/dist/kernel/index.js.map +1 -1
- package/dist/ui/chunk-3SI3TVER.js +7 -0
- package/dist/ui/{chunk-4GTCV7V4.js → chunk-47OZB7LR.js} +1 -1
- package/dist/ui/{chunk-JMP2LDMI.js → chunk-5JBW2LUN.js} +1 -1
- package/dist/ui/{chunk-Y7MXGXU3.js → chunk-DZBSELHN.js} +1 -1
- package/dist/ui/{chunk-Z2667C3S.js → chunk-FEPH4VNB.js} +1 -1
- package/dist/ui/{chunk-PY2R7LHN.js → chunk-FQOZBFJ5.js} +1 -1
- package/dist/ui/chunk-HOJFYUH4.js +123 -0
- package/dist/ui/{chunk-WOLLYGGL.js → chunk-KJQEO6P3.js} +1 -1
- package/dist/ui/chunk-LNRQ7VKE.js +1 -0
- package/dist/ui/{chunk-VO6NF24F.js → chunk-LS2NXZQZ.js} +1 -1
- package/dist/ui/{chunk-J3YWUNFO.js → chunk-LTQTJU54.js} +1 -1
- package/dist/ui/{chunk-6BG7PBUN.js → chunk-NGIFGXW7.js} +1 -1
- package/dist/ui/{chunk-5W6J6H76.js → chunk-SBCO7ZSP.js} +1 -1
- package/dist/ui/chunk-VB56BUGO.js +1 -0
- package/dist/ui/{chunk-UXCAEDR6.js → chunk-VDQLDTTR.js} +1 -1
- package/dist/ui/{chunk-AD7RBRD3.js → chunk-WJLIYGWJ.js} +5 -5
- package/dist/ui/chunk-YQIWQVJ6.js +317 -0
- package/dist/ui/favicon-matrix.svg +15 -0
- package/dist/ui/index.html +12 -2
- package/dist/ui/main-X5YGJFU6.js +2 -0
- package/dist/ui/{styles-IKG3B6AM.css → styles-2WO3KNOY.css} +1 -1
- package/package.json +10 -7
- package/dist/ui/chunk-BGDH7CDV.js +0 -1
- package/dist/ui/chunk-H2J55DNK.js +0 -7
- package/dist/ui/chunk-Q7L6LLAK.js +0 -1
- package/dist/ui/chunk-VH5GRUT7.js +0 -255
- package/dist/ui/chunk-XCUOAV77.js +0 -123
- package/dist/ui/main-TZL26MZU.js +0 -2
|
@@ -1,255 +0,0 @@
|
|
|
1
|
-
import{c as Rt}from"./chunk-WOLLYGGL.js";import{a as ko,b as Fn,c as No,d as Ro,e as sh,f as ch,g as dh}from"./chunk-Z2667C3S.js";import{b as Wp,e as bo,f as $p,j as Ve,k as Re,l as eh,m as Eo,n as Do,o as Mo,p as th,q as nh,r as ih,s as Nu,t as hi,u as En,w as oh,x as Dn}from"./chunk-PY2R7LHN.js";import{c as Io,d as To,f as rh,g as ah}from"./chunk-AD7RBRD3.js";import{h as Mn,i as kn,j as Nn,m as Rn,n as On}from"./chunk-VO6NF24F.js";import{$ as _t,$a as Zt,$b as nn,Aa as _e,Ab as Gp,Ba as be,Bc as wn,Eb as rt,Fb as Be,Gb as J,Gc as Xp,Hb as ge,Hc as qp,Ib as Jt,Ic as Sn,J as y,Jb as en,Jc as wo,K as fo,Ka as X,Lc as Yp,M as pe,N as Cn,Na as S,O as d,Oa as I,Oc as Zp,Pc as Qp,Qa as Ne,Qb as tn,R as Np,Ra as ee,S as Dt,Sa as te,Sb as gt,T as G,Ta as E,Tb as D,U as j,Ua as f,V as Qe,Va as p,Vc as pi,W as Rp,Wa as B,Wb as Ee,Wc as So,X as Je,Xa as U,Xb as F,Y as po,Ya as $,Yb as Se,Z as We,Za as Mt,Zb as vo,_a as Yt,_b as Mu,aa as ui,ab as bn,bb as go,bd as In,cb as yo,cc as xe,cd as Tn,da as W,db as ce,dc as Ke,ea as ae,eb as Eu,fa as xn,fb as K,g as C,ga as ne,gd as Pn,hb as m,hd as Jp,ia as we,ib as Qt,id as kt,ja as ho,jb as Pe,jd as ku,ka as Op,kb as Vp,la as Tu,mb as St,mc as jp,md as Po,n as Mp,na as Fp,nb as It,nd as Nt,oa as c,ob as Du,oc as Up,pa as Ap,pb as ut,pc as Co,qa as Lp,qb as it,qc as xo,ra as Bp,sa as Pu,sb as ot,ta as mo,tb as re,u as kp,ub as Hp,vb as Le,wa as Z,wb as _,xa as _o,xb as v,ya as Ce,yb as ze,za as zp,zb as fi}from"./chunk-J3YWUNFO.js";import{V as Kp}from"./chunk-H2J55DNK.js";import{a as se,b as li}from"./chunk-Q7L6LLAK.js";var on=class{constructor(i,e,n,o,r){this.center=i,this.radiusX=e,this.radiusY=n,this.startAngle=o,this.endAngle=r}},A=class t{static castToPoint(i){return i||t.initialize()}static initialize(i=0,e=0){return{x:i,y:e}}static copy(i){return t.initialize(i.x,i.y)}static isEqual(i,e){return i.x===e.x&&i.y===e.y}static sum(i,e){return{x:i.x+e.x,y:i.y+e.y}}static sub(i,e){return{x:i.x-e.x,y:i.y-e.y}}static div(i,e){return{x:i.x/e,y:i.y/e}}static mult(i,e){return{x:i.x*e,y:i.y*e}}static interpolatePoints(i,e,n){let o=1-n;return t.initialize(i.x*o+e.x*n,i.y*o+e.y*n)}static roundTo(i,e){let n=Math.trunc(i.x/e),o=Math.trunc(i.y/e);return{x:n*e,y:o*e}}static hypotenuse(i,e){let n=e.x-i.x,o=e.y-i.y;return Math.abs(Math.sqrt(n*n+o*o))}static distance(i,e){let n=i.x-e.x,o=i.y-e.y;return Math.sqrt(n*n+o*o)}static getMinimum(i,e){return t.initialize(Math.min(i.x,e.x),Math.min(i.y,e.y))}static getMaximum(i,e){return t.initialize(Math.max(i.x,e.x),Math.max(i.y,e.y))}static matrixTransform(i,e){let n=t.initialize(i.x,i.y),o=e.getScreenCTM();if(o){let r=e.createSVGPoint();r.x=i.x,r.y=i.y,n=r.matrixTransform(o.inverse())}return n}static elementTransform(i,e){let n=t.initialize(i.x,i.y),o=e.getBoundingClientRect();return n=t.sub(n,t.initialize(o.left,o.top)),n}},Y=class t{constructor(i=0,e=0){this.x=i,this.y=e}static fromPoint(i){return new t(i.x,i.y)}add(i){let e=A.sum(this,i);return t.fromPoint(e)}sub(i){let e=A.sub(this,i);return t.fromPoint(e)}subNumber(i){let e=A.sub(this,new t(i,i));return t.fromPoint(e)}div(i){let e=A.div(this,i);return t.fromPoint(e)}mult(i){let e=A.mult(this,i);return t.fromPoint(e)}matrixTransform(i){let e=A.matrixTransform(this,i);return t.fromPoint(e)}elementTransform(i){let e=A.elementTransform(this,i);return t.fromPoint(e)}},mi=class{static initialize(i=A.initialize(),e=A.initialize()){return{point1:i,point2:e}}static copy(i){return{point1:i.point1,point2:i.point2}}static hypotenuse(i){return Math.sqrt(Math.pow(i.point1.x-i.point2.x,2)+Math.pow(i.point1.y-i.point2.y,2))}},rn=class{constructor(i,e){this.point1=i,this.point2=e}},H=class t{static initialize(i=0,e=0,n=0,o=0){n<0&&(i=i+n,n=-n),o<0&&(e=e+o,o=-o);let r=A.initialize(i+n/2,e+o/2);return{x:i,y:e,width:n,height:o,gravityCenter:r}}static copy(i){return t.initialize(i.x,i.y,i.width,i.height)}static fromElement(i){let{x:e,y:n,width:o,height:r}=i.getBoundingClientRect();return t.initialize(e,n,o,r)}static isIncludePoint(i,e){return e.x>=t.left(i)&&e.x<=t.right(i)&&e.y>=t.top(i)&&e.y<=t.bottom(i)}static intersectionWithRect(i,e){return!(i.x+i.width<e.x||e.x+e.width<i.x||i.y+i.height<e.y||e.y+e.height<i.y)}static left(i){return i.x}static top(i){return i.y}static right(i){return i.x+i.width}static bottom(i){return i.y+i.height}static addPoint(i,e){let n=t.copy(i);return n.x+=e.x,n.y+=e.y,this.initialize(n.x,n.y,n.width,n.height)}static mult(i,e){let n=t.copy(i);return n.x*=e,n.y*=e,n.width*=e,n.height*=e,this.initialize(n.x,n.y,n.width,n.height)}static div(i,e){let n=t.copy(i);return n.x/=e,n.y/=e,n.width/=e,n.height/=e,this.initialize(n.x,n.y,n.width,n.height)}static addPointToSize(i,e){let n=t.copy(i);return n.width+=e.x,n.height+=e.y,this.initialize(n.x,n.y,n.width,n.height)}static union(i){return!i||i.length===0?null:i.reduce((e,n)=>{let o=Math.min(e.x,n.x),r=Math.min(e.y,n.y),a=Math.max(e.x+e.width,n.x+n.width),s=Math.max(e.y+e.height,n.y+n.height);return t.initialize(o,r,a-o,s-r)},i[0])}static elementTransform(i,e){let n=e.getBoundingClientRect(),o=A.sub(i,A.initialize(n.left,n.top));return t.initialize(o.x,o.y,i.width,i.height)}static updateIsNotFinite(i){return!Number.isFinite(i.width)||!Number.isFinite(i.height)||!Number.isFinite(i.x)||!Number.isFinite(i.y)?t.initialize(0,0,0,0):i}};function lh(t,i){let e=Math.max(t.width,i),n=Math.max(t.height,i),o=(e-t.width)/2,r=(n-t.height)/2;return H.initialize(t.x-o,t.y-r,e,n)}function Ou(t,i){t=H.updateIsNotFinite(t),i.setAttribute("x",t.x.toString()),i.setAttribute("y",t.y.toString()),i.setAttribute("width",t.width.toString()),i.setAttribute("height",t.height.toString())}function uh(t,i){t=H.updateIsNotFinite(t),i.setAttribute("viewBox",`${t.x} ${t.y} ${t.width} ${t.height}`)}var De=class t{constructor(i=0,e=0,n=0,o=0,r=0,a=0,s=0,l=0){this.x=i,this.y=e,this.width=n,this.height=o,this.radius1=r,this.radius2=a,this.radius3=s,this.radius4=l,this.gravityCenter=A.initialize(),this.gravityCenter=this.calculateGravityCenter(this)}calculateGravityCenter(i){return new Y(i.x+i.width/2,i.y+i.height/2)}static fromRect(i){return new t(i.x,i.y,i.width,i.height)}static fromRoundedRect(i){return new t(i.x,i.y,i.width,i.height,i.radius1,i.radius2,i.radius3,i.radius4)}static fromCenter(i,e,n){return new t(i.gravityCenter.x-e/2,i.gravityCenter.y-n/2,e,n,i.radius1,i.radius2,i.radius3,i.radius4)}static fromPoint(i){return new t(i.x,i.y)}addPoint(i){let e=t.fromRoundedRect(this);return e.x+=i.x,e.y+=i.y,e.gravityCenter=this.calculateGravityCenter(e),e}},ft=class t{static initialize(i=0,e=0){return{width:i,height:e}}static isEqual(i,e){return i.width===e.width&&i.height===e.height}static offsetFromElement(i){if(i instanceof SVGGraphicsElement){let e=i.getBBox();return t.initialize(e.width,e.height)}else if(i instanceof HTMLElement)return t.initialize(i.offsetWidth,i.offsetHeight)}};function bg(){return{position:A.initialize(),scaledPosition:A.initialize(),scale:1,rotate:0}}function wg(t){let i;if(t){t=t.replace("matrix(",""),t=t.replace(")","");let e=t.split(" ");i={position:{x:Number(e[4]),y:Number(e[5])},scaledPosition:A.initialize(),scale:Number(e[0]),rotate:0}}return i}var Ot=class{static toString(i){let e=A.sum(i.position,i.scaledPosition);return`matrix(${i.scale}, 0, 0, ${i.scale}, ${e.x}, ${e.y})`}static fromString(i){return wg(i)}static default(){return bg()}},et=class t{static initialize(i=0,e=0){return A.initialize(i,e)}static fromPoints(i,e){return t.initialize(e.x-i.x,e.y-i.y)}static vectorLength(i){return Math.sqrt(t.magnitudeSquared(i))}static magnitudeSquared(i){return i.x*i.x+i.y*i.y}static dotProduct(i,e){return i.x*e.x+i.y*e.y}static crossProduct(i,e){return i.x*e.y-i.y*e.x}static subtract(i,e){return t.initialize(i.x-e.x,i.y-e.y)}static add(i,e){return t.initialize(i.x+e.x,i.y+e.y)}static scale(i,e){return t.initialize(i.x*e,i.y*e)}static angle(i,e){let n=Math.acos(Math.max(-1,Math.min(t.dotProduct(i,e)/(t.vectorLength(i)*t.vectorLength(e)),1)));return t.crossProduct(i,e)<0?-n:n}},Ru=class{static parseRoundedRect(i){let e=Math.PI*.5,n=i.x,o=i.y,r=i.x+i.width,a=i.y+i.height,s=i.x+i.radius1,l=i.y+i.radius1,u=i.x+i.width-i.radius2,h=i.y+i.radius2,g=i.x+i.width-i.radius3,w=i.y+i.height-i.radius3,b=i.x+i.radius4,P=i.y+i.height-i.radius4;return[new on({x:s,y:l},i.radius1,i.radius1,2*e,3*e),new rn({x:s,y:o},{x:u,y:o}),new on({x:u,y:h},i.radius2,i.radius2,3*e,4*e),new rn({x:r,y:h},{x:r,y:w}),new on({x:g,y:w},i.radius3,i.radius3,0,e),new rn({x:g,y:a},{x:b,y:a}),new on({x:b,y:P},i.radius4,i.radius4,e,2*e),new rn({x:n,y:P},{x:n,y:l})]}},An=class{static getRoundedRectIntersections(i,e,n){let o=Ru.parseRoundedRect(n);for(let r of o)if(r instanceof on){let a=this.intersectArcWithLine(r,i,e);if(a.length>0)return a}else if(r instanceof rn){let a=this.intersectLineSegments(i,e,r.point1,r.point2);if(a)return[a]}return[]}static getRoundedRectIntersectionsWithSVGPath(i,e){let n=i.getTotalLength(),o=[];for(let r=0;r<=n;r+=1){let a=i.getPointAtLength(r);o.push({x:a.x,y:a.y})}for(let r=1;r<o.length;r++){let a=this.getRoundedRectIntersections(o[r-1],o[r],e);if(a.length>0)return a}return[]}static intersectArcWithLine(i,e,n){return this.filterPointsWithinArc(this.findEllipseLineIntersections(i.center,i.radiusX,i.radiusY,e,n),i)}static intersectLineSegments(i,e,n,o){let r=e.x-i.x,a=e.y-i.y,s=o.x-n.x,l=o.y-n.y,u=(-a*(i.x-n.x)+r*(i.y-n.y))/(-s*a+r*l),h=(s*(i.y-n.y)-l*(i.x-n.x))/(-s*a+r*l);return u>=0&&u<=1&&h>=0&&h<=1?{x:i.x+h*r,y:i.y+h*a}:null}static filterPointsWithinArc(i,e){let{center:n,startAngle:o,endAngle:r}=e;if(i.length===0)return i;r<o&&([o,r]=[r,o]),(o<0||r<0)&&(o+=2*Math.PI,r+=2*Math.PI);let a=[];for(let s of i){let l=this.normalizeAngle(et.angle(et.initialize(1,0),et.initialize(s.x-n.x,s.y-n.y)));l<o&&(l+=2*Math.PI),o<=l&&l<=r&&a.push(s)}return a}static normalizeAngle(i){let e=i%(2*Math.PI);return e<0?e+2*Math.PI:e}static findEllipseLineIntersections(i,e,n,o,r){let a=et.initialize(o.x,o.y),s=et.fromPoints(o,r),l=et.initialize(i.x,i.y),u=et.subtract(a,l),h=et.initialize(s.x/(e*e),s.y/(n*n)),g=et.initialize(u.x/(e*e),u.y/(n*n)),w=et.dotProduct(s,h),b=et.dotProduct(s,g),P=et.dotProduct(u,g)-1,T=b*b-w*P;return T<0?[]:this.calculateIntersectionPoints(T,w,b,o,r)}static calculateIntersectionPoints(i,e,n,o,r){let a=[];if(i>0){let s=Math.sqrt(i),l=(-n-s)/e,u=(-n+s)/e;l>=0&&l<=1&&a.push(A.interpolatePoints(o,r,l)),u>=0&&u<=1&&a.push(A.interpolatePoints(o,r,u))}else{let s=-n/e;s>=0&&s<=1&&a.push(A.interpolatePoints(o,r,s))}return a}};var Fu=class{handle(i,e){let n=!0;if(this.validator&&(n=e.get(this.validator).handle(i)),!!n)return e.get(this.execution).handle(i)}execute(i,e){return e.get(this.execution).handle(i)}setValidator(i){this.validator=i}setExecution(i){this.execution=i}},R=class t{constructor(){this._injector=d(Je)}static registerPipeline(i,e,n){if(!i||!i.fToken)throw new Error("Type must have a fToken static property.");let o=this.pipelines.get(i.fToken)||new Fu;n?o.setValidator(e):o.setExecution(e),this.pipelines.set(i.fToken,o)}send(i){let e=t.pipelines.get(i.constructor.fToken);if(e)return e.handle(i,this._injector);throw new Error("Handler not registered for request type.")}execute(i){return t.pipelines.get(i.constructor.fToken).execute(i,this._injector)}};R.pipelines=new Map;R.\u0275fac=function(i){return new(i||R)};R.\u0275prov=y({token:R,factory:R.\u0275fac});function x(t){return function(i){R.registerPipeline(t,i,!1)}}var Sg=(()=>{class t{setItem(e,n){localStorage.setItem(e,n)}getItem(e){return localStorage.getItem(e)}removeItem(e){localStorage.removeItem(e)}clear(){localStorage.clear()}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Ig=(()=>{class t{storage={};setItem(e,n){this.storage[e]=n}getItem(e){return this.storage[e]||null}removeItem(e){delete this.storage[e]}clear(){this.storage={}}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Tg=new pe("F_LOCAL_STORAGE",{providedIn:"root",factory:()=>xo(d(ho))?d(Sg):d(Ig)}),Pg=(()=>{class t{getComputedStyle(e){return window.getComputedStyle(e)}get innerWidth(){return window.innerWidth}get innerHeight(){return window.innerHeight}get pageXOffset(){return window.pageXOffset}get pageYOffset(){return window.pageYOffset}isMediaQuery(e){return window.matchMedia(e).matches}requestAnimationFrame(e){return window.requestAnimationFrame(e)}get location(){return window.location}open(e,n,o){window.open(e,n,o)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Eg=(()=>{class t{getComputedStyle(e){return new Proxy({getPropertyValue:n=>"0"},{get:(n,o)=>o==="getPropertyValue"?n.getPropertyValue:"0"})}get innerWidth(){return 0}get innerHeight(){return 0}get pageXOffset(){return 0}get pageYOffset(){return 0}isMediaQuery(e){return!1}requestAnimationFrame(e){return setTimeout(e,0)}get location(){return{href:"",pathname:"",search:"",hash:"",origin:""}}open(e,n,o){}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Dg=new pe("F_WINDOW",{providedIn:"root",factory:()=>xo(d(ho))?d(Pg):d(Eg)}),Ft=(function(t){return t.MAC_OS="macos",t.IOS="ios",t.WINDOWS="windows",t.ANDROID="android",t.LINUX="linux",t})(Ft||{}),Au;try{Au=typeof Intl<"u"&&Intl.v8BreakIterator}catch{Au=!1}var Lu=(()=>{class t{_platformId;isBrowser=!1;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||Au)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(e){this._platformId=e,this.isBrowser=this._platformId?xo(this._platformId):typeof document=="object"&&!!document}getOS(){let e=navigator.userAgent.toLowerCase(),n=/(macintosh|macintel|macppc|mac68k|macos)/i,o=/(win32|win64|windows|wince)/i,r;return n.test(e)?r=Ft.MAC_OS:this.IOS?r=Ft.IOS:o.test(e)?r=Ft.WINDOWS:this.ANDROID?r=Ft.ANDROID:!r&&/linux/.test(e)&&(r=Ft.LINUX),r}static \u0275fac=function(n){return new(n||t)(Cn(ho))};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),ke=(()=>{class t{injectedDocument;windowService;localStorageService;platformService;constructor(e,n,o,r){this.injectedDocument=e,this.windowService=n,this.localStorageService=o,this.platformService=r}isBrowser(){return this.platformService.isBrowser}get window(){return this.windowService}get localStorage(){return this.localStorageService}get document(){return this.injectedDocument}toPixels(e,n,o,r){if(e.endsWith("px"))return parseFloat(e);if(e.endsWith("%")){let a=parseFloat(e)/100;return Math.max(n,o)*a}else{if(e.endsWith("em"))return parseFloat(e)*parseFloat(r);if(e.endsWith("rem"))return parseFloat(e)*parseFloat(getComputedStyle(this.document.documentElement).fontSize);if(e.endsWith("vh")){let a=this.window.innerHeight/100;return parseFloat(e)*a}else if(e.endsWith("vw")){let a=this.window.innerWidth/100;return parseFloat(e)*a}}return parseFloat(e)||0}static \u0275fac=function(n){return new(n||t)(Cn(po),Cn(Dg),Cn(Tg),Cn(Lu))};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function Bu(t,i){return t.reduce((e,n)=>[...e,...i(n)],[])}function zu(t){let i=t.cloneNode(!0),e=i.querySelectorAll("[id]"),n=t.nodeName.toLowerCase();i.removeAttribute("id");for(let o=0;o<e.length;o++)e[o].removeAttribute("id");return n==="canvas"?hh(t,i):(n==="input"||n==="select"||n==="textarea")&&ph(t,i),fh("canvas",t,i,hh),fh("input, textarea, select",t,i,ph),i}function fh(t,i,e,n){let o=i.querySelectorAll(t);if(o.length){let r=e.querySelectorAll(t);for(let a=0;a<o.length;a++)n(o[a],r[a])}}var Mg=0;function ph(t,i){i.type!=="file"&&(i.value=t.value),i.type==="radio"&&i.name&&(i.name=`mat-clone-${i.name}-${Mg++}`)}function hh(t,i){let e=i.getContext("2d");if(e)try{e.drawImage(t,0,0)}catch{}}function Vu(t,i,e){for(let n in i)if(i.hasOwnProperty(n)){let o=i[n];o?t.setProperty(n,o,e?.has(n)?"important":""):t.removeProperty(n)}return t}function mh(t){Vu(t.style,{"touch-action":"none","-webkit-user-drag":"none","-webkit-tap-highlight-color":"transparent","user-select":"none","-ms-user-select":"none","-webkit-user-select":"none","-moz-user-select":"none"})}function _h(t,i,e){return kg(t,e).dataset[i]}function kg(t,i){return t.closest(i)}function Hu(t,i){let e=t.rootNodes;if(e.length===1&&e[0].nodeType===i.ELEMENT_NODE)return e[0];let n=i.createElement("div");return e.forEach(o=>n.appendChild(o)),n}function _i(t,i){let e=Ng(t,i);return!!e&&!e.classList.contains(i+"-disabled")}function Ng(t,i){return t.closest(i)}function Tt(t){return t.match(/^[a-zA-Z_]/)||(t="_"+t),t.replace(/[^a-zA-Z0-9_\-:.]/g,"_")}function Ln(t,i,e){let n=e[t.toUpperCase()]||Rg(e,t.toLowerCase());if(n===void 0)throw new Error(`Unknown ${i}: ${t}. Accepted values: ${Object.keys(e).join(", ")}`);return n}function Rg(t,i){return Object.keys(t).find(e=>t[e]===i)}var Og=["markerElement"],Fg=["fConnectionGradientRenderer",""],Ag=["f-connection-path",""],Lg=["fConnectionSelection",""],Bg=["f-connection-drag-handle-start",""],zg=["f-connection-drag-handle-end",""],Vg=["defs"],Hg=["*"],Gg=["fGroupsContainer"],jg=["fNodesContainer"],Ug=["fConnectionsContainer"],Wg=[[["","fGroup",""],["","fGroups",""]],[["f-snap-connection"]],[["f-connection"],["","fConnections",""]],[["f-connection-for-create"]],[["","fNode",""],["","fNodes",""]]],$g=["[fGroup], [fGroups]","f-snap-connection","f-connection, [fConnections]","f-connection-for-create","[fNode], [fNodes]"],Kg=[[["svg","fMarker",""]],[["f-connection-marker-circle"],["f-connection-marker-arrow"]],[["f-connection-gradient"]],[["f-connection-waypoints"]],[["","fConnectionContent",""]]],Xg=["svg[fMarker]","f-connection-marker-circle, f-connection-marker-arrow","f-connection-gradient","f-connection-waypoints","[fConnectionContent]"];function qg(t,i){t&1&&(Qe(),B(0,"linearGradient",3)),t&2&&E("fConnectionGradientRendererFor",i)}function Yg(t,i){t&1&&(Qe(),B(0,"circle",6))}function Zg(t,i){t&1&&Pe(0,4)}var Qg="[_nghost-%COMP%]{display:block;position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;pointer-events:none;-webkit-user-select:none;user-select:none}",Jg=[[["","fDefinitions",""]],[["f-background"]],[["f-line-alignment"]],[["f-canvas"]],[["f-selection-area"]],"*"],e0=["[fDefinitions]","f-background","f-line-alignment","f-canvas","f-selection-area","*"],$u=new pe("F_BACKGROUND_PATTERN"),rc=class{fPattern;static fToken=Symbol("AddPatternToBackgroundRequest");constructor(i){this.fPattern=i}},Gn=class{_items=[];_byId=new Map;get(i){return this._byId.get(i)}require(i){let e=this._byId.get(i);if(!e)throw new Error(`${this.kind} not found: ${i}`);return e}has(i){return this._byId.has(i)}getAll(){return this._items}size(){return this._items.length}add(i){let e=i.fId();if(this._byId.has(e))throw new Error(`${this.kind} already exists: ${e}`);this._items.push(i),this._byId.set(e,i)}addMany(i){for(let e of i)this.add(e)}remove(i){let e=i.fId(),n=this._byId.get(e);if(!n)return!1;this._byId.delete(e);let o=this._items.indexOf(n);return o>=0&&this._items.splice(o,1),!0}removeById(i){let e=this._byId.get(i);if(!e)return;this._byId.delete(i);let n=this._items.indexOf(e);return n>=0&&this._items.splice(n,1),e}clear(){this._items.length=0,this._byId.clear()}};function an(t){return{name:t}}var Ku=class{_instances=new Map;get(i){return this._instances.get(i.name)}require(i){let e=this.get(i);if(!e)throw new Error(`Instance not found: ${i.name}`);return e}has(i){return this._instances.has(i.name)}add(i,e){if(this._instances.has(i.name))throw new Error(`${i.name} already exists`);this._instances.set(i.name,e)}remove(i){if(!this._instances.has(i.name))throw new Error(`${i.name} does not exist`);return this._instances.delete(i.name),!0}clear(){this._instances.clear()}},vi=class extends Gn{kind;constructor(i){super(),this.kind=i}},Xu=class extends Gn{kind="Connection Marker"},qu=class extends Gn{kind="Connection";_instancesForCreate;_instancesForSnap;getForSnap(){return this._instancesForSnap}getForCreate(){return this._instancesForCreate}addForCreate(i){this._instancesForCreate=i}addForSnap(i){this._instancesForSnap=i}removeInstanceForCreate(){this._instancesForCreate=void 0}removeInstanceForSnap(){this._instancesForSnap=void 0}},Yu=class extends Gn{kind="Node"},zn=class{notifyOnSubscribe;static fToken=Symbol("ListenConnectionsChangesRequest");constructor(i=!0){this.notifyOnSubscribe=i}};function t0(){return t=>{let i=null,e=null,n=()=>{i!==null&&cancelAnimationFrame(i),e!==null&&cancelAnimationFrame(e),i=e=null};return{callback:()=>{n(),i=requestAnimationFrame(()=>{i=null,e=requestAnimationFrame(()=>{e=null,t()})})},cleanup:n}}}function n0(){return t=>{let i=null;return{callback:()=>{i!==null&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=null,t()})},cleanup:()=>{i!==null&&cancelAnimationFrame(i),i=null}}}}function ac(t){return i=>{let e=null;return{callback:()=>{e!==null&&clearTimeout(e),e=setTimeout(()=>{e=null,i()},t)},cleanup:()=>{e!==null&&clearTimeout(e),e=null}}}}var ct=class{_listeners=new Set;notify(){this._listeners.forEach(i=>i())}listen(i){return this._listeners.add(i),()=>this.stop(i)}stop(i){this._listeners.delete(i)}},Zu=class extends ct{_htmlElement;_observer=new ResizeObserver(()=>this.notify());_isObserving=!1;constructor(i){super(),this._htmlElement=i}listen(i){return this._isObserving||(this._observer.observe(this._htmlElement),this._isObserving=!0),super.listen(i)}stop(i){super.stop(i),this._listeners.size===0&&this._disconnect()}_disconnect(){this._observer.unobserve(this._htmlElement),this._observer.disconnect(),this._isObserving=!1}},vt=class t{_channels=[];_operators=[];constructor(...i){this._channels=[...i]}pipe(...i){let e=new t(...this._channels);return e._operators=[...this._operators,...i],e}listen(i,e){let n=e,o=[],r=[],a=[];for(let g of[...this._operators].reverse()){let w=g(n);n=w.callback,w.cleanup&&o.push(w.cleanup),w.onSubscribe&&r.push(w.onSubscribe),w.setTeardown&&a.push(w.setTeardown)}let s=this._channels.map(g=>g.listen(()=>n())),l=null,u=!1,h=()=>{u||(u=!0,l?.(),l=null,s.forEach(g=>g()),o.forEach(g=>g()))};a.slice().reverse().forEach(g=>g(h)),r.slice().reverse().forEach(g=>g(n)),l=i.onDestroy(h)}};function Fl(){return t=>{let i=!0;return{callback:t,onSubscribe:e=>{queueMicrotask(()=>{i&&e()})},cleanup:()=>{i=!1}}}}function gh(){return t=>{let i=!1,e=null;return{setTeardown:n=>e=n,callback:()=>{if(!i){i=!0;try{t()}finally{e?.()}}}}}}var i0=(()=>{let t=class Ao{_store=d(M);handle({notifyOnSubscribe:e}){return e?new vt(this._store.connectionsChanges$).pipe(Fl(),ac(1)):new vt(this._store.connectionsChanges$).pipe(ac(1))}static \u0275fac=function(n){return new(n||Ao)};static \u0275prov=y({token:Ao,factory:Ao.\u0275fac})};return t=C([x(zn)],t),t})(),Qu=class{static fToken=Symbol("ListenNodesChangesRequest")},o0=(()=>{let t=class Lo{_store=d(M);handle(e){return new vt(this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||Lo)};static \u0275prov=y({token:Lo,factory:Lo.\u0275fac})};return t=C([x(Qu)],t),t})(),sc=class{static fToken=Symbol("ListenTransformChangesRequest")},r0=(()=>{let t=class Bo{_store=d(M);handle(e){return new vt(this._store.transformChanges$,this._store.connectionsChanges$,this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||Bo)};static \u0275prov=y({token:Bo,factory:Bo.\u0275fac})};return t=C([x(sc)],t),t})(),sn=class{static fToken=Symbol("EmitConnectionsChangesRequest")},a0=(()=>{let t=class zo{_store=d(M);handle(e){this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||zo)};static \u0275prov=y({token:zo,factory:zo.\u0275fac})};return t=C([x(sn)],t),t})(),Bt=class{static fToken=Symbol("NotifyTransformChangedRequest")},M=(()=>{class t{transformChanges$=new ct;viewportAnimationChanges$=new ct;connectionsChanges$=new ct;_connectionsRevision=0;connectionsRenderedChanges$=new ct;_connectionsRenderedRevision=0;_connectionsRenderedNodesRevision=0;_viewportAnimationCount=0;nodesChanges$=new ct;_nodesRevision=0;progressiveRenderChanges$=new ct;_pendingProgressiveRenderCount=0;get connectionsRevision(){return this._connectionsRevision}get connectionsRenderedRevision(){return this._connectionsRenderedRevision}get connectionsRenderedNodesRevision(){return this._connectionsRenderedNodesRevision}get nodesRevision(){return this._nodesRevision}get hasPendingProgressiveRender(){return this._pendingProgressiveRenderCount>0}get isViewportAnimating(){return this._viewportAnimationCount>0}get flowHost(){return this.fFlow?.hostElement}fFlow;fCanvas;get transform(){return this.fCanvas?.transform}nodes=new Yu;connections=new qu;connectionMarkers=new Xu;outputs=new vi("Output");inputs=new vi("Input");outlets=new vi("Outlet");instances=new Ku;fDraggable;emitNodeChanges(){this._nodesRevision++,this.nodesChanges$.notify()}emitConnectionChanges(){this._connectionsRevision++,this.connectionsChanges$.notify()}completeConnectionsRender(e,n){e<this._connectionsRenderedRevision||e===this._connectionsRenderedRevision&&n<=this._connectionsRenderedNodesRevision||(this._connectionsRenderedRevision=Math.min(e,this._connectionsRevision),this._connectionsRenderedNodesRevision=n,this.connectionsRenderedChanges$.notify())}beginProgressiveRender(){this._pendingProgressiveRenderCount++,this.progressiveRenderChanges$.notify()}endProgressiveRender(){this._pendingProgressiveRenderCount&&(this._pendingProgressiveRenderCount--,this.progressiveRenderChanges$.notify())}transformChanged(){this.transformChanges$.notify()}beginViewportAnimation(){this._viewportAnimationCount++,this.viewportAnimationChanges$.notify()}endViewportAnimation(){this._viewportAnimationCount&&(this._viewportAnimationCount--,this.viewportAnimationChanges$.notify())}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ye={MAGNETIC_LINES:an("magnetic-lines"),MAGNETIC_RECTS:an("magnetic-rects"),ZOOM:an("zoom-controls"),BACKGROUND:an("background"),SELECTION_AREA:an("selection-area"),MINIMAP:an("minimap"),AUTO_PAN:an("auto-pan")},s0=(()=>{let t=class Vo{_store=d(M);handle(e){this._store.transformChanged()}static \u0275fac=function(n){return new(n||Vo)};static \u0275prov=y({token:Vo,factory:Vo.\u0275fac})};return t=C([x(Bt)],t),t})(),zt=class{key;instance;static fToken=Symbol("RegisterPluginInstanceRequest");constructor(i,e){this.key=i,this.instance=e}},c0=(()=>{let t=class Ho{_store=d(M);handle({key:e,instance:n}){this._store.instances.add(e,n)}static \u0275fac=function(n){return new(n||Ho)};static \u0275prov=y({token:Ho,factory:Ho.\u0275fac})};return t=C([x(zt)],t),t})(),Vt=class{key;static fToken=Symbol("RemovePluginInstanceRequest");constructor(i){this.key=i}},d0=(()=>{let t=class Go{_store=d(M);handle({key:e}){this._store.instances.remove(e)}static \u0275fac=function(n){return new(n||Go)};static \u0275prov=y({token:Go,factory:Go.\u0275fac})};return t=C([x(Vt)],t),t})(),l0=[M,o0,i0,r0,a0,s0,c0,d0],u0=0,f0=(()=>{let t=class jo{_store=d(M);_browser=d(ke);get _backgroundElement(){return this._store.instances.get(ye.BACKGROUND)?.hostElement}handle(e){let n=this._getPatterns(e.fPattern?.hostElement);if(!n?.length)return;let o=Hn("defs",this._browser);if(e.fPattern?.hostElement.remove(),n.forEach(r=>{o.append(r)}),n.length){this._backgroundElement?.firstChild?.appendChild(o),n[n.length-1].id="f-background-pattern-"+u0++;let r=n[n.length-1].id,a=Hn("rect",this._browser);a.setAttribute("fill","url(#"+r+")"),a.setAttribute("width","100%"),a.setAttribute("height","100%"),this._backgroundElement?.firstChild?.appendChild(a);let s=this._store.fCanvas?.transform||Ot.default();e.fPattern?.setTransform(s)}}_getPatterns(e){return Array.from(e?.getElementsByTagName("pattern")||[])}static \u0275fac=function(n){return new(n||jo)};static \u0275prov=y({token:jo,factory:jo.\u0275fac})};return t=C([x(rc)],t),t})(),Ci=class{fTransform;static fToken=Symbol("SetBackgroundTransformRequest");constructor(i){this.fTransform=i}},p0=(()=>{let t=class Uo{_store=d(M);handle(e){this._store.instances.get(ye.BACKGROUND)?.setTransform(e.fTransform)}static \u0275fac=function(n){return new(n||Uo)};static \u0275prov=y({token:Uo,factory:Uo.\u0275fac})};return t=C([x(Ci)],t),t})(),h0=[f0,p0],cc=class{instance;static fToken=Symbol("AddCanvasToStoreRequest");constructor(i){this.instance=i}},m0=(()=>{let t=class Wo{_store=d(M);handle({instance:e}){this._store.fCanvas=e}static \u0275fac=function(n){return new(n||Wo)};static \u0275prov=y({token:Wo,factory:Wo.\u0275fac})};return t=C([x(cc)],t),t})(),dc=class{id;animated;static fToken=Symbol("CenterGroupOrNodeRequest");constructor(i,e){this.id=i,this.animated=e}},_0=(()=>{let t=class $o{_store=d(M);_mediator=d(R);get _transform(){return this._store.transform}handle({id:e,animated:n}){let o=this._store.nodes.get(e);o&&(this._toCenter(this._getNodeRect(o),this._getFlowRect(),o._position),this._mediator.execute(new jn(n,cn.VIEWPORT_ONLY)))}_toCenter(e,n,o){this._transform.scaledPosition=A.initialize(),this._transform.position=A.initialize((n.width-e.width)/2-o.x*this._transform.scale,(n.height-e.height)/2-o.y*this._transform.scale)}_getNodeRect(e){return H.fromElement(e.hostElement)}_getFlowRect(){return H.fromElement(this._store.flowHost)}static \u0275fac=function(n){return new(n||$o)};static \u0275prov=y({token:$o,factory:$o.\u0275fac})};return t=C([x(dc)],t),t})(),lc=class{toCenter;animated;static fToken=Symbol("FitToFlowRequest");constructor(i,e){this.toCenter=i,this.animated=e}},g0=(()=>{let t=class Ko{_store=d(M);get _transform(){return this._store.transform}_mediator=d(R);handle({toCenter:e,animated:n}){let o=this._mediator.execute(new Yn)||H.initialize();o.width===0||o.height===0||(this.fitToParent(o,H.fromElement(this._store.flowHost),this._store.nodes.getAll().map(r=>r._position),e),this._mediator.execute(new jn(n,cn.VIEWPORT_ONLY)))}fitToParent(e,n,o,r){this._transform.scaledPosition=A.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let a=e.width/this._transform.scale+r.x,s=e.height/this._transform.scale+r.y;(a>n.width||s>n.height||a<n.width&&s<n.height)&&(this._transform.scale=Math.min(n.width/a,n.height/s));let l=(n.width-a*this._transform.scale)/2-this._transform.position.x*this._transform.scale,u=(n.height-s*this._transform.scale)/2-this._transform.position.y*this._transform.scale;this._transform.position=A.initialize(l+r.x/2*this._transform.scale,u+r.y/2*this._transform.scale)}_getZeroPositionWithoutScale(e){let n=e.length?Math.min(...e.map(r=>r.x)):0,o=e.length?Math.min(...e.map(r=>r.y)):0;return A.initialize(n,o)}static \u0275fac=function(n){return new(n||Ko)};static \u0275prov=y({token:Ko,factory:Ko.\u0275fac})};return t=C([x(lc)],t),t})(),uc=class{transform;position;static fToken=Symbol("InputCanvasPositionRequest");constructor(i,e){this.transform=i,this.position=e}},y0=(()=>{let t=class Xo{_store=d(M);handle({transform:e,position:n}){n&&(A.isEqual(this._calculateTransformPosition(e),n)||(e.position=n,e.scaledPosition=A.initialize(),this._store.fCanvas?.redraw()))}_calculateTransformPosition(e){return A.sum(e.position,e.scaledPosition)}static \u0275fac=function(n){return new(n||Xo)};static \u0275prov=y({token:Xo,factory:Xo.\u0275fac})};return t=C([x(uc)],t),t})(),fc=class{transform;scale;static fToken=Symbol("InputCanvasScaleRequest");constructor(i,e){this.transform=i,this.scale=e}},v0=(()=>{let t=class qo{_store=d(M);handle(e){!e.scale&&e.scale!==0||(e.transform.scale=e.scale,this._store.fCanvas?.redraw())}static \u0275fac=function(n){return new(n||qo)};static \u0275prov=y({token:qo,factory:qo.\u0275fac})};return t=C([x(fc)],t),t})(),cn=(function(t){return t.VIEWPORT_ONLY="VIEWPORT_ONLY",t.WITH_CONNECTION_CHANGES="WITH_CONNECTION_CHANGES",t})(cn||{}),jn=class{animated;context;static fToken=Symbol("RedrawCanvasWithAnimationRequest");constructor(i,e=cn.WITH_CONNECTION_CHANGES){this.animated=i,this.context=e}};function Uh(t,i){let e=n=>{n.propertyName==="transform"&&(t.removeEventListener("transitionend",e),i(n))};t.addEventListener("transitionend",e)}var C0=(()=>{let t=class Yo{_store=d(M);get _canvas(){return this._store.fCanvas}handle(e){e.animated?this._redrawWithAnimation(e.context):this._redraw(e.context),this._canvas?.emitCanvasChangeEvent()}_redrawWithAnimation(e){this._store.beginViewportAnimation(),this._canvas?.redrawWithAnimation(),Uh(this._canvas.hostElement,()=>{this._store.endViewportAnimation(),e===cn.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()})}_redraw(e){this._canvas?.redraw(),e===cn.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Yo)};static \u0275prov=y({token:Yo,factory:Yo.\u0275fac})};return t=C([x(jn)],t),t})(),pc=class{static fToken=Symbol("RemoveCanvasFromStoreRequest")},x0=(()=>{let t=class Zo{_store=d(M);handle(e){this._store.fCanvas=void 0}static \u0275fac=function(n){return new(n||Zo)};static \u0275prov=y({token:Zo,factory:Zo.\u0275fac})};return t=C([x(pc)],t),t})(),hc=class{static fToken=Symbol("ResetScaleRequest")},b0=(()=>{let t=class Qo{_store=d(M);get _transform(){return this._store.transform}handle(e){this._transform.scale=1,this._transform.scaledPosition=A.initialize()}static \u0275fac=function(n){return new(n||Qo)};static \u0275prov=y({token:Qo,factory:Qo.\u0275fac})};return t=C([x(hc)],t),t})(),mc=class{animated;static fToken=Symbol("ResetScaleAndCenterRequest");constructor(i){this.animated=i}},w0=(()=>{let t=class Jo{_mediator=d(R);_store=d(M);get _transform(){return this._store.transform}handle({animated:e}){let n=this._mediator.execute(new Yn)||H.initialize();n.width===0||n.height===0||(this._oneToOneCentering(n,H.fromElement(this._store.flowHost),this._store.nodes.getAll().map(o=>o._position)),this._mediator.execute(new jn(e,cn.VIEWPORT_ONLY)))}_oneToOneCentering(e,n,o){this._transform.scaledPosition=A.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let r=(n.width-e.width/this._transform.scale)/2-this._transform.position.x,a=(n.height-e.height/this._transform.scale)/2-this._transform.position.y;this._transform.scale=1,this._transform.position=A.initialize(r,a)}_getZeroPositionWithoutScale(e){let n=e.length?Math.min(...e.map(r=>r.x)):0,o=e.length?Math.min(...e.map(r=>r.y)):0;return A.initialize(n,o)}static \u0275fac=function(n){return new(n||Jo)};static \u0275prov=y({token:Jo,factory:Jo.\u0275fac})};return t=C([x(mc)],t),t})(),_c=class{scale;toPosition;static fToken=Symbol("UpdateScaleRequest");constructor(i,e){this.scale=i,this.toPosition=e}},S0=(()=>{let t=class er{_store=d(M);get _transform(){return this._store.transform}handle({scale:e,toPosition:n}){if(e===this._transform.scale)return;let o=A.sum(this._transform.scaledPosition,this._transform.position),r=n.x-(n.x-o.x)*e/this._transform.scale,a=n.y-(n.y-o.y)*e/this._transform.scale;this._transform.scale=e,this._transform.scaledPosition=A.sub(A.initialize(r,a),this._transform.position)}static \u0275fac=function(n){return new(n||er)};static \u0275prov=y({token:er,factory:er.\u0275fac})};return t=C([x(_c)],t),t})(),I0=[m0,_0,g0,y0,v0,C0,x0,b0,w0,S0],Ju=class{connection;static fToken=Symbol("AddConnectionForCreateToStoreRequest");constructor(i){this.connection=i}},T0=(()=>{let t=class tr{_store=d(M);handle({connection:e}){this._store.connections.addForCreate(e)}static \u0275fac=function(n){return new(n||tr)};static \u0275prov=y({token:tr,factory:tr.\u0275fac})};return t=C([x(Ju)],t),t})(),gc=class{instance;static fToken=Symbol("AddConnectionMarkerToStoreRequest");constructor(i){this.instance=i}},P0=(()=>{let t=class nr{_store=d(M);handle({instance:e}){this._store.connectionMarkers.add(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||nr)};static \u0275prov=y({token:nr,factory:nr.\u0275fac})};return t=C([x(gc)],t),t})(),yc=class{connection;static fToken=Symbol("AddConnectionToStoreRequest");constructor(i){this.connection=i}},E0=(()=>{let t=class ir{_store=d(M);handle({connection:e}){this._store.connections.add(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||ir)};static \u0275prov=y({token:ir,factory:ir.\u0275fac})};return t=C([x(yc)],t),t})(),ef=class{connection;static fToken=Symbol("AddSnapConnectionToStoreRequest");constructor(i){this.connection=i}},D0=(()=>{let t=class or{_store=d(M);handle({connection:e}){this._store.connections.addForSnap(e)}static \u0275fac=function(n){return new(n||or)};static \u0275prov=y({token:or,factory:or.\u0275fac})};return t=C([x(ef)],t),t})(),Un=class{connection;static fToken=Symbol("CreateConnectionMarkersRequest");constructor(i){this.connection=i}},yh=new pe("F_CONNECTION_CONTENT");var vc=class t{points;cumulativeLengths;segmentTangents;totalLength;constructor(i){let e=t._removeConsecutiveDuplicates(i);if(e.length<2){this.points=[{x:0,y:0},{x:1,y:0}],this.cumulativeLengths=[0,1],this.segmentTangents=[{x:1,y:0}],this.totalLength=1;return}this.points=e;let n=this.points.length,o=n-1,r=new Array(n).fill(0),a=new Array(o),s=0;for(let l=0;l<o;l++){let u=this.points[l+1].x-this.points[l].x,h=this.points[l+1].y-this.points[l].y,g=Math.hypot(u,h),w=g?u/g:1,b=g?h/g:0;a[l]={x:w,y:b},s+=g,r[l+1]=s}this.cumulativeLengths=r,this.segmentTangents=a,this.totalLength=s||1}static from(i){return new t(i.map(e=>({x:e.x,y:e.y})))}static _removeConsecutiveDuplicates(i){let e=[];for(let n of i){let o=e[e.length-1];(!o||o.x!==n.x||o.y!==n.y)&&e.push({x:n.x,y:n.y})}return e}},tf=class t{_polyline;constructor(i=[]){this._polyline=new vc(i)}updatePoints(i){return this._polyline=new vc(i),this._polyline.totalLength}calculateTotalLength(i){return this.updatePoints(i)}get totalLength(){return this._polyline.totalLength}getPointAtProgress(i){let{points:e,cumulativeLengths:n,segmentTangents:o,totalLength:r}=this._polyline,s=t._clamp(i,0,1)*r,l=.5;if(s<=l)return{point:e[0],tangent:o[0]??{x:1,y:0},atEdge:!0};if(r-s<=l){let O=e.length-1;return{point:e[O],tangent:o[O-1]??{x:1,y:0},atEdge:!0}}let u=t._findRightIndex(n,s),h=Math.max(1,u),g=n[h-1],w=n[h],b=t._safeRatio(s-g,w-g),P=e[h-1],T=e[h],k={x:t._lerp(P.x,T.x,b),y:t._lerp(P.y,T.y,b)},N=o[h-1]??{x:1,y:0};return{point:k,tangent:N,atEdge:!1}}getPointAtLength(i){return this.getPointAtProgress(i)}getPointAtDistance(i){let e=this._polyline.totalLength?i/this._polyline.totalLength:0;return this.getPointAtProgress(e)}static _findRightIndex(i,e){let n=0,o=i.length-1;for(;n<o;){let r=n+o>>1;i[r]<e?n=r+1:o=r}return n}static _lerp(i,e,n){return i+(e-i)*n}static _clamp(i,e,n){return i<e?e:i>n?n:i}static _safeRatio(i,e){let n=Math.abs(e)<1e-6?1e-6:e;return i/n}},Wh=(function(t){return t.NONE="none",t.ALONG="along",t})(Wh||{}),nf=class{compute(i,e){let n=this._clamp01(e.position()),{point:o,tangent:r}=i.getPointAtLength(n),a={x:-r.y,y:r.x},s=e.offset()??0,l=o.x+a.x*s,u=o.y+a.y*s,g=this._sizeAlongDirection(e.hostElement,r)*.5,w=n*i.totalLength,b=i.totalLength-w,P=this._applyEdgeGuard(l,u,r,w,b,g),T=this._calculateContentRotation(e.align(),r);return{position:P,rotationDeg:T}}_clamp01(i){return i<=0?0:i>=1?1:i}_applyEdgeGuard(i,e,n,o,r,a){if(o<=a){let s=a-o;return{x:i+n.x*s,y:e+n.y*s}}if(r<=a){let s=a-r;return{x:i-n.x*s,y:e-n.y*s}}return{x:i,y:e}}_sizeAlongDirection(i,e){let n=H.fromElement(i);return Math.abs(e.x)*n.width+Math.abs(e.y)*n.height}_normalize180(i){let e=(i+180)%360;return e<0&&(e+=360),e-180}_keepUpright(i){let e=this._normalize180(i);return e>90?e-=180:e<-90&&(e+=180),e}_calculateContentRotation(i,e){let n=0;return i===Wh.ALONG&&(n=Math.atan2(e.y,e.x)*180/Math.PI,n=this._keepUpright(n)),n}},of=class{_placement;constructor(i=new nf){this._placement=i}layout(i,e){let n=new tf(i),o=n.totalLength;for(let r of e){let{position:a,rotationDeg:s}=this._placement.compute(n,r);r.hostElement.style.transform=this._createTransformString(a,s)}return o}_createTransformString(i,e){return`translate3d(${i.x}px, ${i.y}px, 0) translate(-50%, -50%) rotate(${e}deg)`}};var vh=new pe("F_CONNECTION_WAYPOINTS");function $h(t,i,e){return(t.x-i.x)**2+(t.y-i.y)**2<=e**2}function M0(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.candidates().find(o=>$h(i,o,n))}function k0(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.waypoints().find(o=>$h(i,o,n))}function N0(t,i){for(let e of t){let n=k0(e,i);if(n&&e.fWaypoints()?.visibility())return{connection:e,waypoint:n};let o=M0(e,i);if(o&&e.fWaypoints()?.visibility())return{connection:e,candidate:o}}}var Al=new pe("F_CONNECTION_COMPONENTS_PARENT");var fe=(function(t){return t.START="f-connection-marker-start",t.END="f-connection-marker-end",t.SELECTED_START="f-connection-selected-marker-start",t.SELECTED_END="f-connection-selected-marker-end",t.START_ALL_STATES="f-connection-marker-start-all-states",t.END_ALL_STATES="f-connection-marker-end-all-states",t})(fe||{}),Cc=new pe("F_CONNECTION_MARKER"),R0=0,xc=class{fId=W(`f-marker-${R0++}`);hostElement=d(we).nativeElement};function Kh(t,i=fe.START){if(typeof t!="string")return i;let e=t.trim().toLowerCase();return e?O0(e)??i:i}function O0(t){switch(t){case"start":case"f-connection-marker-start":return fe.START;case"end":case"f-connection-marker-end":return fe.END;case"selected-start":case"f-connection-selected-marker-start":return fe.SELECTED_START;case"selected-end":case"f-connection-selected-marker-end":return fe.SELECTED_END;case"start-all-states":case"f-connection-marker-start-all-states":case"start-all":case"all-start":return fe.START_ALL_STATES;case"end-all-states":case"f-connection-marker-end-all-states":case"end-all":case"all-end":return fe.END_ALL_STATES;default:return null}}var Xh=(()=>{class t extends xc{_markerElement=Se.required("markerElement");_type=F(fe.END_ALL_STATES,{alias:"type",transform:e=>Kh(e,fe.END_ALL_STATES)});get markerElement(){return this._markerElement().nativeElement}width=6;height=7;refX=5.5;refY=3.5;get type(){return this._type()}orient="auto";markerUnits="strokeWidth";static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-connection-marker-arrow"]],viewQuery:function(n,o){n&1&&ut(o._markerElement,Og,5),n&2&&it()},hostAttrs:[1,"f-component",2,"display","none"],inputs:{_type:[1,"type","_type"]},features:[ge([{provide:Cc,useExisting:t}]),_e],decls:3,vars:0,consts:[["markerElement",""],["viewBox","0 0 6 6",1,"f-marker"],["d","M0,0 L6,3 0,6Z"]],template:function(n,o){n&1&&(Qe(),U(0,"svg",1,0),Mt(2,"path",2),$())},encapsulation:2})}return t})();var qh=(()=>{class t extends xc{_mediator=d(R);markerElement=this.hostElement;width=0;height=0;refX=0;refY=0;type=fe.START;orient="auto";markerUnits="strokeWidth";ngOnInit(){this.hostElement.style.display="none",this._mediator.execute(new gc(this))}ngOnDestroy(){this._mediator.execute(new Uc(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,selectors:[["svg","fMarker",""]],hostAttrs:[1,"f-component","f-marker"],inputs:{width:"width",height:"height",refX:"refX",refY:"refY",type:[2,"type","type",e=>Kh(e,fe.START)],orient:"orient",markerUnits:"markerUnits"},standalone:!1,features:[ge([{provide:Cc,useExisting:t}]),_e]})}return t})(),At=(function(t){return t.FIXED="fixed",t.FIXED_CENTER="fixed_center",t.FLOATING="floating",t})(At||{}),Xe=(function(t){return t.DEFAULT="default",t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.CALCULATE="calculate",t.CALCULATE_HORIZONTAL="calculate_horizontal",t.CALCULATE_VERTICAL="calculate_vertical",t})(Xe||{});function F0({sourceRect:t,targetRect:i}){return{point1:t.gravityCenter,point2:i.gravityCenter}}var L=(function(t){return t.LEFT="left",t.TOP="top",t.RIGHT="right",t.BOTTOM="bottom",t.CALCULATE="calculate",t.CALCULATE_HORIZONTAL="calculate_horizontal",t.CALCULATE_VERTICAL="calculate_vertical",t.AUTO="auto",t})(L||{}),Bn=(function(t){return t.SEGMENT="segment",t.STRAIGHT="straight",t.BEZIER="bezier",t.ADAPTIVE_CURVE="adaptive-curve",t})(Bn||{});function A0({sourceRect:t,sourceConnectableSide:i,targetRect:e,targetConnectableSide:n}){return{point1:Ch(t,i===L.AUTO?L.BOTTOM:i),point2:Ch(e,n===L.AUTO?L.TOP:n)}}function Ch(t,i){switch(i){case L.TOP:return{x:t.x+t.width/2,y:t.y};case L.BOTTOM:return{x:t.x+t.width/2,y:t.y+t.height};case L.LEFT:return{x:t.x,y:t.y+t.height/2};case L.RIGHT:return{x:t.x+t.width,y:t.y+t.height/2};default:throw new Error(`Unknown side: ${i}`)}}function Yh(t,i,e,n){if(!n||!n.rotationDeg)return An.getRoundedRectIntersections(t,i,e)[0];let o=rr(t,-n.rotationDeg,n.pivot),r=rr(i,-n.rotationDeg,n.pivot),a=L0(e,-n.rotationDeg,n.pivot),s=An.getRoundedRectIntersections(o,r,a)[0];return s?rr(s,n.rotationDeg,n.pivot):void 0}function L0(t,i,e){let n=rr(B0(t),i,e);return new De(n.x-t.width/2,n.y-t.height/2,t.width,t.height,t.radius1,t.radius2,t.radius3,t.radius4)}function B0(t){return{x:t.x+t.width/2,y:t.y+t.height/2}}function rr(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,a=Math.cos(r),s=Math.sin(r);return{x:n*a-o*s+e.x,y:n*s+o*a+e.y}}function z0({sourceRect:t,targetRect:i,sourceRotationContext:e,targetRotationContext:n}){return G0(V0(t,i,e),H0(t,i,n),t,i)}function V0(t,i,e){return Yh(t.gravityCenter,i.gravityCenter,t,e)}function H0(t,i,e){return Yh(i.gravityCenter,t.gravityCenter,i,e)}function G0(t,i,e,n){return{point1:t||e.gravityCenter,point2:i||n.gravityCenter}}var Oo=.5,j0={[At.FLOATING]:z0,[At.FIXED_CENTER]:F0,[At.FIXED]:A0},ni=(()=>{class t{handle(e){let n=this._calculateDirectionalVectors(e.sourceRect.gravityCenter.x,e.sourceRect.gravityCenter.y,e.targetRect.gravityCenter.x,e.targetRect.gravityCenter.y),o=this._determineSourceSide(e,n),r=this._determineTargetSide(e,n);return e.connection._applyResolvedSidesToConnection(o,r),this._getBehaviorHandler(e.connection.fBehavior)({sourceRect:e.sourceRect,targetRect:e.targetRect,sourceConnectableSide:o,targetConnectableSide:r,sourceRotationContext:e.sourceRotationContext,targetRotationContext:e.targetRotationContext})}_calculateDirectionalVectors(e,n,o,r){let a=o-e,s=r-n;return{sourceToTargetX:a,sourceToTargetY:s,targetToSourceX:-a,targetToSourceY:-s}}_determineSourceSide(e,n){return this._resolveConnectableSide(e.connection.fOutputSide(),n.sourceToTargetX,n.sourceToTargetY,e.sourceConnectableSide)}_determineTargetSide(e,n){return this._resolveConnectableSide(e.connection.fInputSide(),n.targetToSourceX,n.targetToSourceY,e.targetConnectableSide)}_resolveConnectableSide(e,n,o,r){if(e===Xe.DEFAULT)return r;let a=Math.abs(n),s=Math.abs(o);if(a<Oo&&s<Oo)return r;let u=a>=s;switch(e){case Xe.CALCULATE:return u?n>=0?L.RIGHT:L.LEFT:o>=0?L.BOTTOM:L.TOP;case Xe.CALCULATE_HORIZONTAL:return a<Oo?r:n>=0?L.RIGHT:L.LEFT;case Xe.CALCULATE_VERTICAL:return s<Oo?r:o>=0?L.BOTTOM:L.TOP;case Xe.TOP:return L.TOP;case Xe.BOTTOM:return L.BOTTOM;case Xe.LEFT:return L.LEFT;case Xe.RIGHT:return L.RIGHT;default:return r}}_getBehaviorHandler(e){let n=j0[e];if(!n)throw new Error(`[Behavior] No handler for behavior: ${e}`);return n}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),ht=class{sourceRect;targetRect;connection;sourceConnectableSide;targetConnectableSide;sourceRotationContext;targetRotationContext;constructor(i,e,n,o,r,a,s){this.sourceRect=i,this.targetRect=e,this.connection=n,this.sourceConnectableSide=o,this.targetConnectableSide=r,this.sourceRotationContext=a,this.targetRotationContext=s}};function Ll(t,i,e){return[t,...e??[],i]}function U0(t,i){let e=Math.abs(i.x-t.x)/2,n=i.x<t.x?i.x+e:i.x-e,o=Math.abs(i.y-t.y)/2,r=i.y<t.y?i.y+o:i.y-o;return{x:n,y:r}}function W0(t,i=32){let e=new Array(i+1);e[0]=se({},t[0]);for(let n=1;n<=i;n++)e[n]=Zh(t[0],t[1],t[2],t[3],n/i);return e}function Zh(t,i,e,n,o){let r=1-o,a=o*o,s=r*r,l=s*r,u=a*o;return{x:l*t.x+3*s*o*i.x+3*r*a*e.x+u*n.x,y:l*t.y+3*s*o*i.y+3*r*a*e.y+u*n.y}}function Qh(t){return t.map(i=>Zh(i.p0,i.c1,i.c2,i.p3,.5))}function $0(t){if(t.length<2)throw new Error("Polylines must be at least two points");let i=K0(t);return i<=0?[se({},t[0])]:[X0(t,i/2)]}function K0(t){let i=0;for(let e=0;e<t.length-1;e++)i+=Jh(t[e],t[e+1]);return i}function X0(t,i){let e=0;for(let o=0;o<t.length-1;o++){let r=t[o],a=t[o+1],s=Jh(r,a);if(!(s<=0)){if(e+s>=i){let l=(i-e)/s;return{x:r.x+(a.x-r.x)*l,y:r.y+(a.y-r.y)*l}}e+=s}}let n=t[t.length-1];return{x:n.x,y:n.y}}function Jh(t,i){return Math.hypot(i.x-t.x,i.y-t.y)}function q0(t){let i=[];for(let e of t)for(let n of e){let o=i[i.length-1];(!o||o.x!==n.x||o.y!==n.y)&&i.push(n)}return i}function em(t){if(!t.length)return"";let i=`M ${t[0].p0.x} ${t[0].p0.y}`;for(let e=0;e<t.length;e++){let n=t[e],o=e===t.length-1,r=o?n.p3.x+2e-4:n.p3.x,a=o?n.p3.y+2e-4:n.p3.y;i+=` C ${n.c1.x} ${n.c1.y}, ${n.c2.x} ${n.c2.y}, ${r} ${a}`}return i}function tm(t,i=16){if(!t.length)return[];let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=W0([o.p0,o.c1,o.c2,o.p3],i);n>0&&r.shift(),e.push(...r)}return e}function Y0(t,i=1e-6){let e=t.length;if(e<=2)return t;let n=[];n.push(t[0]);for(let r=1;r<e;r++){let a=t[r],s=n[n.length-1];(Math.abs(a.x-s.x)>i||Math.abs(a.y-s.y)>i)&&n.push(a)}if(n.length<=2)return n;let o=[];o.push(n[0]);for(let r=1;r<n.length-1;r++){let a=o[o.length-1],s=n[r],l=n[r+1],u=Math.abs(a.x-s.x)<=i&&Math.abs(s.x-l.x)<=i,h=Math.abs(a.y-s.y)<=i&&Math.abs(s.y-l.y)<=i;!u&&!h&&o.push(s)}return o.push(n[n.length-1]),o}var rf=class t{static _dir(i){switch(i){case L.LEFT:return{x:-1,y:0};case L.RIGHT:return{x:1,y:0};case L.TOP:return{x:0,y:-1};case L.BOTTOM:return{x:0,y:1};case L.AUTO:return{x:0,y:0}}return{x:0,y:0}}static _isHorizontal(i){return i===L.LEFT||i===L.RIGHT}static _handleLength(i,e,n,o){let r=Math.abs(e.x-i.x),a=Math.abs(e.y-i.y),s=Math.hypot(r,a),l=n===L.AUTO?Math.max(r,a):this._isHorizontal(n)?r:a,u=Math.max(8,o),h=o+.5*s,g=o*1.05+l*.3;return Math.min(h,Math.max(u,g))}static _softControl(i,e,n,o){let r=this._dir(i),a=n.x-e.x,s=n.y-e.y,l=Math.hypot(a,s)||1,u=a/l,h=s/l;if(i===L.AUTO)return{x:e.x+u*o,y:e.y+h*o};let g=r.x*u+r.y*h,w=.12,b=Math.max(0,-g)*.08,P=Math.min(.2,w+b),T=r.x*(1-P)+u*P,k=r.y*(1-P)+h*P,N=Math.hypot(T,k)||1;return{x:e.x+T/N*o,y:e.y+k/N*o}}handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:a}){let s=Math.max(0,r??0),l=Ll(i,n,a),u=[];for(let g=0;g<l.length-1;g++){let w=l[g],b=l[g+1],P=t._handleLength(w,b,e,s),T=t._handleLength(b,w,o,s),k=t._softControl(e,w,b,P),N=t._softControl(o,b,w,T);u.push({p0:w,c1:k,c2:N,p3:b,chainIndex:g})}let h=tm(u,12);return{path:em(u),secondPoint:u[0]?.c1??i,penultimatePoint:u[u.length-1]?.c2??n,points:h,candidates:Qh(u)}}},af=class{handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:a}){let s=Ll(i,n,a),l=[];for(let h=0;h<s.length-1;h++){let g=s[h],w=s[h+1],b=xh(e,g,w,r??0),P=xh(o,w,g,r??0);l.push({p0:g,c1:b,c2:P,p3:w,chainIndex:h})}let u=tm(l,12);return{path:em(l),secondPoint:l[0]?.c1??i,penultimatePoint:l[l.length-1]?.c2??n,points:u,candidates:Qh(l)}}};function xh(t,i,e,n){let o={x:i.x,y:i.y};switch(t){case L.LEFT:o.x-=Fo(i.x-e.x,n);break;case L.RIGHT:o.x+=Fo(e.x-i.x,n);break;case L.TOP:o.y-=Fo(i.y-e.y,n);break;case L.BOTTOM:o.y+=Fo(e.y-i.y,n);break;case L.AUTO:break}return o}function Fo(t,i){return t>=i?t:i*Math.sqrt(i-t)}function Z0(t){let{axis:i,source:e,target:n,sourceSide:o,targetSide:r,sourceGap:a,targetGap:s,sourceDir:l,targetDir:u,currentDir:h,offset:g,sourceGapOffset:w,targetGapOffset:b}=t,P=Q0(a,s),T=J0(i,l,h,P);return o===r?ey(i,e,n,g,l,h,a,s,w,b):T=ty(i,l,u,a,s,P,T),T}function Q0(t,i){return{sourceTarget:[{x:t.x,y:i.y}],targetSource:[{x:i.x,y:t.y}]}}function J0(t,i,e,n){return t==="x"?i.x===e?n.targetSource:n.sourceTarget:i.y===e?n.sourceTarget:n.targetSource}function ey(t,i,e,n,o,r,a,s,l,u){let h=Math.abs(i[t]-e[t]);if(h>n)return;let g=Math.min(n-1,n-h);g<=0||(o[t]===r?l[t]=(a[t]>i[t]?-1:1)*g:u[t]=(s[t]>e[t]?-1:1)*g)}function ty(t,i,e,n,o,r,a){let s=t==="x"?"y":"x",l=i[t]===e[s],u=n[s]>o[s],h=n[s]<o[s];return i[t]===1&&(!l&&u||l&&h)||i[t]!==1&&(!l&&h||l&&u)?t==="x"?r.sourceTarget:r.targetSource:a}var gi=1e-6,bh=2e-4,ny=.75;function iy(t,i){let e=t.length,n=[];n.push(`M ${t[0].x} ${t[0].y}`);for(let r=1;r<e-1;r++)n.push(oy(t[r-1],t[r],t[r+1],i));let o=t[e-1];return n.push(`L ${o.x+bh} ${o.y+bh}`),n.join(" ")}function oy(t,i,e,n){let o=i.x,r=i.y;if(n<=0)return`L ${o} ${r}`;let a=Math.abs(t.x-o)<=gi&&Math.abs(o-e.x)<=gi,s=Math.abs(t.y-r)<=gi&&Math.abs(r-e.y)<=gi;if(a||s)return`L ${o} ${r}`;let l=Math.hypot(o-t.x,r-t.y),u=Math.hypot(e.x-o,e.y-r),h=Math.min(l*.5,u*.5,n);if(h<ny)return`L ${o} ${r}`;if(Math.abs(t.y-r)<=gi){let k=t.x<e.x?-1:1,N=t.y<e.y?1:-1,O=o+h*k,V=r+h*N;return`L ${O} ${r} Q ${o} ${r} ${o} ${V}`}let w=t.x<e.x?1:-1,b=t.y<e.y?-1:1,P=r+h*b,T=o+h*w;return`L ${o} ${P} Q ${o} ${r} ${T} ${r}`}var wh={[L.LEFT]:A.initialize(-1,0),[L.RIGHT]:A.initialize(1,0),[L.TOP]:A.initialize(0,-1),[L.BOTTOM]:A.initialize(0,1),[L.AUTO]:A.initialize(0,0)},sf=class{handle({source:i,sourceSide:e,target:n,targetSide:o,waypoints:r,offset:a,radius:s}){let l=Ll(i,n,r),u=[],h=[];for(let P=0;P<l.length-1;P++){let T=l[P],k=l[P+1],N=this._getPathPoints(T,e,k,o,a??0);u.push(N),h.push(...$0(N))}let g=Y0(q0(u)),w=g.length>1?g[g.length-2]:i,b=g.length>1?g[1]:n;return{path:iy(g,s??0),penultimatePoint:w,secondPoint:b,points:g,candidates:h}}_getPathPoints(i,e,n,o,r){let a=wh[e],s=wh[o],l={x:i.x+a.x*r,y:i.y+a.y*r},u={x:n.x+s.x*r,y:n.y+s.y*r},h=this._getDirection(l,e,u),g=h.x!==0?"x":"y",w=h[g],b=[],P=A.initialize(),T=A.initialize(),k=U0(i,n);if(a[g]*s[g]===-1){let N=[{x:k.x,y:l.y},{x:k.x,y:u.y}],O=[{x:l.x,y:k.y},{x:u.x,y:k.y}];a[g]===w?b=g==="x"?N:O:b=g==="x"?O:N}else b=Z0({axis:g,source:i,target:n,sourceSide:e,targetSide:o,sourceGap:l,targetGap:u,sourceDir:a,targetDir:s,currentDir:w,offset:r,sourceGapOffset:P,targetGapOffset:T});return[i,{x:l.x+P.x,y:l.y+P.y},...b,{x:u.x+T.x,y:u.y+T.y},n]}_getDirection(i,e,n){return e===L.LEFT||e===L.RIGHT?i.x<n.x?A.initialize(1,0):A.initialize(-1,0):i.y<n.y?A.initialize(0,1):A.initialize(0,-1)}},Sh=2e-4,cf=class{handle(i){let e=Ll(i.source,i.target,i.waypoints),n=e.length,o=e[0],r=`M ${o.x} ${o.y}`,a=new Array(n-1);for(let s=0;s<n-1;s++){let l=e[s],u=e[s+1],h=s===n-2,g=h?u.x+Sh:u.x,w=h?u.y+Sh:u.y;r+=` L ${g} ${w}`,a[s]={x:(l.x+u.x)*.5,y:(l.y+u.y)*.5}}return{path:r,candidates:a,points:e,secondPoint:e[1]??i.target,penultimatePoint:e[n-2]??i.source}}},ry=new pe("F_CONNECTION_BUILDERS"),nm=(()=>{class t{_builtinBuilders={[Bn.STRAIGHT]:new cf,[Bn.BEZIER]:new af,[Bn.ADAPTIVE_CURVE]:new rf,[Bn.SEGMENT]:new sf};_providedBuilders;_builders;constructor(){this._providedBuilders=d(ry,{optional:!0})||{},this._builders=se(se({},this._builtinBuilders),this._providedBuilders)}handle({type:e,payload:n}){let o=this._builders[e];if(!o)throw this._createBuilderNotFoundError(e);return o.handle(n)}_createBuilderNotFoundError(e){let n=Object.keys(this._builtinBuilders).sort(),o=Object.keys(this._providedBuilders).sort(),r=Object.keys(this._builders).sort(),a=n.filter(l=>l in this._providedBuilders).sort(),s=[`Connection Builder Error: builder type "${e}" not found.`,`Registered types: ${r.length?r.join(", "):"(none)"}`,`Built-in types: ${n.length?n.join(", "):"(none)"}`,`Provided (F_CONNECTION_BUILDERS) types: ${o.length?o.join(", "):"(none)"}`,a.length?`Overridden built-ins: ${a.join(", ")}`:null,"Tip: ensure you pass a valid Connection Type or provide a builder via F_CONNECTION_BUILDERS."].filter(Boolean);return new Error(s.join(`
|
|
2
|
-
`))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();function ay(t,i,e){return Tt("connection_"+t+i+e)}function sy(t,i,e){return Tt("connection_for_selection_"+t+i+e)}function im(t){return Tt("connection_gradient_"+t)}function cy(t){return`url(#${im(t)})`}var dy=(()=>{class t{_connection=d(Al);_hostElement=d(we).nativeElement;_injector=d(Je);_hostAttributes=new Map;_startColor;_endColor;gradientId=D(()=>im(this._connection.fId()));ngOnInit(){this._listenColorChanges()}_listenColorChanges(){ae(()=>{this.gradient().fStartColor(),this.gradient().fEndColor(),gt(()=>{this._updateGradient()})},{injector:this._injector})}get stop1Element(){return this._hostElement.children.item(0)}get stop2Element(){return this._hostElement.children.item(1)}redraw(e){let n=e.point2.x-e.point1.x,o=e.point2.y-e.point1.y,r=Math.sqrt(n*n+o*o)||.01,a=new Y(.5-.5*n/r,.5-.5*o/r);this._setHostAttribute("x1",a.x.toString()),this._setHostAttribute("y1",a.y.toString());let s=new Y(.5+.5*n/r,.5+.5*o/r);this._setHostAttribute("x2",s.x.toString()),this._setHostAttribute("y2",s.y.toString()),this._updateGradient()}_updateGradient(){let e=this.gradient();this._setFromColor(e.fStartColor()),this._setToColor(e.fEndColor())}_setFromColor(e){let n=e||"transparent";this._startColor!==n&&(this._startColor=n,this.stop1Element.setAttribute("stop-color",n),this.stop1Element.style.setProperty("stop-color",n))}_setToColor(e){let n=e||"transparent";this._endColor!==n&&(this._endColor=n,this.stop2Element.setAttribute("stop-color",n),this.stop2Element.style.setProperty("stop-color",n))}_setHostAttribute(e,n){this._hostAttributes.get(e)!==n&&(this._hostAttributes.set(e,n),this._hostElement.setAttribute(e,n))}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,standalone:!1})}return t})(),df=(()=>{class t extends dy{gradient=F.required({alias:"fConnectionGradientRendererFor"});static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["linearGradient","fConnectionGradientRenderer",""]],hostVars:1,hostBindings:function(n,o){n&2&&X("id",o.gradientId())},inputs:{gradient:[1,"fConnectionGradientRendererFor","gradient"]},features:[_e],attrs:Fg,decls:3,vars:0,consts:[[0,"xmlns","svg","http://www.w3.org/2000/svg"],["offset","0%"],["offset","100%"]],template:function(n,o){n&1&&(go(0,0),Qe(),Mt(1,"stop",1)(2,"stop",2),yo())},encapsulation:2,changeDetection:0})}return t})(),Ih=new pe("F_CONNECTION_GRADIENT");var lf=new pe("F_CONNECTION_PATH"),uf=class{hostElement=d(we).nativeElement},ly=(()=>{class t extends uf{_connection=d(Al);useGradient=F(!1);linkToGradient=D(()=>this.useGradient()?cy(this._connection.fId()):null);get fPathId(){return this._connection.fId()}get attrConnectionId(){return ay(this._connection.fId(),this._connection.fOutputId(),this._connection.fInputId())}initialize(){this.deselect()}setPath(e){this.hostElement.setAttribute("d",`${e}`)}select(){this.hostElement.setAttribute("marker-start",`url(#${py(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${hy(this._connection.fId())})`)}deselect(){this.hostElement.setAttribute("marker-start",`url(#${uy(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${fy(this._connection.fId())})`)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["path","f-connection-path",""]],hostAttrs:[1,"f-component","f-connection-path"],hostVars:4,hostBindings:function(n,o){n&2&&(X("id",o.attrConnectionId)("data-f-path-id",o.fPathId),ot("stroke",o.linkToGradient()))},inputs:{useGradient:[1,"useGradient"]},standalone:!1,features:[ge([{provide:lf,useExisting:t}]),_e],attrs:Ag,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})();function uy(t){return Tt(`f-connection-marker-start-${t}`)}function fy(t){return Tt(`f-connection-marker-end-${t}`)}function py(t){return Tt(`f-connection-selected-marker-start-${t}`)}function hy(t){return Tt(`f-connection-selected-marker-end-${t}`)}var ff=new pe("F_CONNECTION_SELECTION"),pf=class{hostElement=d(we).nativeElement},my=(()=>{class t extends pf{_connection=d(Al);get connectionForSelectionId(){return sy(this._connection.fId(),this._connection.fOutputId(),this._connection.fInputId())}setPath(e){this.hostElement.setAttribute("d",`${e}`)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["path","fConnectionSelection",""]],hostAttrs:[1,"f-component","f-connection-selection"],hostVars:1,hostBindings:function(n,o){n&2&&X("id",o.connectionForSelectionId)},standalone:!1,features:[ge([{provide:ff,useExisting:t}]),_e],attrs:Lg,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})(),hf=new pe("F_CONNECTION_DRAG_HANDLE_END"),mf=new pe("F_CONNECTION_DRAG_HANDLE_START"),bc=class{hostElement=d(we).nativeElement;point=A.initialize();class="f-connection-drag-handle";calculateCircleCenter(i,e,n){let o={x:e.x-i.x,y:e.y-i.y},r=Math.sqrt(o.x*o.x+o.y*o.y)||1,a={x:o.x/r,y:o.y/r},s={x:a.x*n,y:a.y*n};return{x:e.x-s.x,y:e.y-s.y}}},_y=(()=>{class t extends bc{redraw(e,n){this.point=this.calculateCircleCenter(e,n,8),this.hostElement.setAttribute("cx",this.point.x.toString()),this.hostElement.setAttribute("cy",this.point.y.toString())}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["circle","f-connection-drag-handle-start",""]],hostVars:2,hostBindings:function(n,o){n&2&&Le(o.class)},standalone:!1,features:[ge([{provide:mf,useExisting:t}]),_e],attrs:Bg,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),gy=(()=>{class t extends bc{redraw(e,n){this.point=this.calculateCircleCenter(e,n,8),this.hostElement.setAttribute("cx",this.point.x.toString()),this.hostElement.setAttribute("cy",this.point.y.toString())}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["circle","f-connection-drag-handle-end",""]],hostVars:2,hostBindings:function(n,o){n&2&&Le(o.class)},standalone:!1,features:[ge([{provide:hf,useExisting:t}]),_e],attrs:zg,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),Gu="f-selected";function om(t){return class extends t{fId=W("");fSelectionDisabled=W(!1);unmarkAsSelected(){this.unmarkChildrenAsSelected?.(),this.hostElement.classList.remove(Gu)}markAsSelected(){this.markChildrenAsSelected?.(),this.isSelected()||this.hostElement.classList.add(Gu)}isSelected(){return this.hostElement.classList.contains(Gu)}markChildrenAsSelected(){}unmarkChildrenAsSelected(){}constructor(...i){super(...i)}}}function yy(t){return class extends t{show(){this.hostElement.style.display="unset"}hide(){this.hostElement.style.display="none"}constructor(...i){super(...i)}}}var vy=om(yy(class{hostElement;constructor(t){this.hostElement=t}})),Cy=(()=>{class t extends vy{_fConnectionBuilder=d(nm);path="";line=mi.initialize();fReassignableStart=W(!1);fDraggingDisabled=W(!1);fSelectionDisabled=W(!1);fDefs=Se.required("defs");fPath=Se.required(lf);fDragHandleStart=Se(mf);fDragHandleEnd=Se.required(hf);fSelection=Se.required(ff);fContents=Mu(yh,{descendants:!0});fMarkers=Mu(Cc,{descendants:!0});fGradient=vo(Ih);_fGradientRenderer=Se(df);fWaypoints=vo(vh);fInputSide=W(Xe.DEFAULT);_contentLayoutEngine=new of;_sourceSide=L.AUTO;fOutputSide=W(Xe.DEFAULT);_targetSide=L.AUTO;_penultimatePoint=A.initialize();_secondPoint=A.initialize();constructor(){super(d(we).nativeElement)}initialize(){this.redraw(),this.isSelected()?this.markChildrenAsSelected():this.unmarkChildrenAsSelected()}isContains(e){return(this.hostElement.firstChild?.lastChild).contains(e)||Array.from(this.fContents()?.values()??[]).some(n=>n.hostElement?.contains(e))||this.fWaypoints()?.hostElement?.contains(e)}setLine({point1:e,point2:n}){this.line=mi.initialize(e,n);let{path:o,points:r,penultimatePoint:a,secondPoint:s,candidates:l}=this._getPathResult(e,n);this.path=o,this._penultimatePoint=a||e,this._secondPoint=s||n,this.fWaypoints()?.candidates.set(l||[]),this._contentLayoutEngine.layout(r||[],this._contents())}_contents(){return Array.from(this.fContents()?.values()??[])}_getPathResult(e,n){return this._fConnectionBuilder.handle({type:this.fType,payload:{source:e,sourceSide:this._sourceSide,target:n,targetSide:this._targetSide,radius:this.fRadius,offset:this.fOffset,waypoints:this.fWaypoints()?.waypoints()||[]}})}markChildrenAsSelected(){this.fPath().select()}unmarkChildrenAsSelected(){this.fPath().deselect()}redraw(){this.fPath().setPath(this.path),this.fSelection().setPath(this.path),this.fDragHandleEnd().redraw(this._penultimatePoint,this.line.point2),this.fDragHandleStart()?.redraw(this._secondPoint,this.line.point1),this._fGradientRenderer()?.redraw(this.line)}getResolvedSides(){return{sourceSide:this._sourceSide,targetSide:this._targetSide}}_applyResolvedSidesToConnection(e,n){this._sourceSide=e,this._targetSide=n}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,contentQueries:function(n,o,r){n&1&&Du(r,o.fContents,yh,5)(r,o.fMarkers,Cc,5)(r,o.fGradient,Ih,5)(r,o.fWaypoints,vh,5),n&2&&it(4)},viewQuery:function(n,o){n&1&&ut(o.fDefs,Vg,5)(o.fPath,lf,5)(o.fDragHandleStart,mf,5)(o.fDragHandleEnd,hf,5)(o.fSelection,ff,5)(o._fGradientRenderer,df,5),n&2&&it(6)},standalone:!1,features:[_e]})}return t})(),xy=(()=>{let t=class ar{_browser=d(ke);_markerCache=new WeakMap;handle({connection:e}){let n=this._findConnectionMarkers(e),o=e.fDefs();if(!o)return!1;let r=by(n),a=this._markerCache.get(e);if(a?.signature===r&&a.defsElement===o.nativeElement)return!1;let s=am("defs",this._browser);return n.forEach(l=>{rm(l.type).forEach(u=>{let h=wy(u,l,e.fId(),this._browser),g=l.markerElement.cloneNode(!0);g.setAttribute("height",`${l.height}`),g.setAttribute("width",`${l.width}`),g.removeAttribute("markerUnits"),g.style.display="unset",h.append(g),s.append(h)})}),o.nativeElement.innerHTML=s.innerHTML,this._markerCache.set(e,{signature:r,defsElement:o.nativeElement}),this._makeSafariCompatible(e),!0}_findConnectionMarkers(e){return Array.from(e.fMarkers()??[])}_makeSafariCompatible(e){e.fPath().hostElement.replaceWith(e.fPath().hostElement)}static \u0275fac=function(n){return new(n||ar)};static \u0275prov=y({token:ar,factory:ar.\u0275fac})};return t=C([x(Un)],t),t})();function by(t){return t.map(i=>[...rm(i.type),i.width,i.height,i.refX,i.refY,i.orient,i.markerUnits,i.markerElement.outerHTML].join("|")).join("||")}function wy(t,i,e,n){let o=am("marker",n);return o.setAttribute("id",Tt(t+"-"+e)),o.setAttribute("markerHeight",`${i.height}`),o.setAttribute("markerWidth",`${i.width}`),o.setAttribute("orient",`${i.orient}`),o.setAttribute("refX",`${i.refX}`),o.setAttribute("refY",`${i.refY}`),o.setAttribute("markerUnits",`${i.markerUnits}`),o}function rm(t){switch(t){case fe.START:return[fe.START];case fe.END:return[fe.END];case fe.SELECTED_START:return[fe.SELECTED_START];case fe.SELECTED_END:return[fe.SELECTED_END];case fe.START_ALL_STATES:return[fe.START,fe.SELECTED_START];case fe.END_ALL_STATES:return[fe.END,fe.SELECTED_END];default:return[]}}function am(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}var Bl=(()=>{class t{renderTicket=0;_connectedInPreviousRender=new Set;beginRender(){return++this.renderTicket}resetConnectedConnectors(){for(let e of this._connectedInPreviousRender)e.resetConnected();this._connectedInPreviousRender.clear()}trackConnectedConnectors(e,n){this._connectedInPreviousRender.add(e),this._connectedInPreviousRender.add(n)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Sy=String.raw`
|
|
3
|
-
const EPSILON = 0.5;
|
|
4
|
-
|
|
5
|
-
addEventListener('message', (event) => {
|
|
6
|
-
const data = event?.data;
|
|
7
|
-
const requestId = data?.requestId;
|
|
8
|
-
const items = Array.isArray(data?.items) ? data.items : [];
|
|
9
|
-
|
|
10
|
-
try {
|
|
11
|
-
const results = items.map((item) => calculateItem(item));
|
|
12
|
-
postMessage({ requestId, results });
|
|
13
|
-
} catch (error) {
|
|
14
|
-
const message = error instanceof Error ? error.message : 'Connection worker failed.';
|
|
15
|
-
postMessage({ requestId, error: message });
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
function calculateItem(item) {
|
|
20
|
-
const sourceCenterX = item.sourceRect.x + item.sourceRect.width / 2;
|
|
21
|
-
const sourceCenterY = item.sourceRect.y + item.sourceRect.height / 2;
|
|
22
|
-
const targetCenterX = item.targetRect.x + item.targetRect.width / 2;
|
|
23
|
-
const targetCenterY = item.targetRect.y + item.targetRect.height / 2;
|
|
24
|
-
|
|
25
|
-
const sourceSide = resolveConnectableSide(
|
|
26
|
-
item.outputSide,
|
|
27
|
-
targetCenterX - sourceCenterX,
|
|
28
|
-
targetCenterY - sourceCenterY,
|
|
29
|
-
item.sourceConnectableSide,
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const targetSide = resolveConnectableSide(
|
|
33
|
-
item.inputSide,
|
|
34
|
-
sourceCenterX - targetCenterX,
|
|
35
|
-
sourceCenterY - targetCenterY,
|
|
36
|
-
item.targetConnectableSide,
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
if (item.behavior === 'fixed_center') {
|
|
40
|
-
return {
|
|
41
|
-
originalIndex: item.originalIndex,
|
|
42
|
-
supported: true,
|
|
43
|
-
sourceSide,
|
|
44
|
-
targetSide,
|
|
45
|
-
line: {
|
|
46
|
-
point1: { x: sourceCenterX, y: sourceCenterY },
|
|
47
|
-
point2: { x: targetCenterX, y: targetCenterY },
|
|
48
|
-
},
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
if (item.sourceRotation || item.targetRotation) {
|
|
53
|
-
return { originalIndex: item.originalIndex, supported: false };
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
if (item.behavior !== 'fixed') {
|
|
57
|
-
if (item.behavior !== 'floating') {
|
|
58
|
-
return { originalIndex: item.originalIndex, supported: false };
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (hasRoundedCorners(item.sourceRect) || hasRoundedCorners(item.targetRect)) {
|
|
62
|
-
return { originalIndex: item.originalIndex, supported: false };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return {
|
|
66
|
-
originalIndex: item.originalIndex,
|
|
67
|
-
supported: true,
|
|
68
|
-
sourceSide,
|
|
69
|
-
targetSide,
|
|
70
|
-
line: buildFloatingLine(item.sourceRect, item.targetRect),
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
const line = buildFixedLine(item.sourceRect, item.targetRect, sourceSide, targetSide);
|
|
75
|
-
if (!line) {
|
|
76
|
-
return { originalIndex: item.originalIndex, supported: false };
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
originalIndex: item.originalIndex,
|
|
81
|
-
supported: true,
|
|
82
|
-
sourceSide,
|
|
83
|
-
targetSide,
|
|
84
|
-
line,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function resolveConnectableSide(requestedSide, deltaX, deltaY, fallbackSide) {
|
|
89
|
-
if (requestedSide === 'default') {
|
|
90
|
-
return fallbackSide;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const absX = Math.abs(deltaX);
|
|
94
|
-
const absY = Math.abs(deltaY);
|
|
95
|
-
const nearZero = absX < EPSILON && absY < EPSILON;
|
|
96
|
-
|
|
97
|
-
if (nearZero) {
|
|
98
|
-
return fallbackSide;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const horizontalDominant = absX >= absY;
|
|
102
|
-
|
|
103
|
-
switch (requestedSide) {
|
|
104
|
-
case 'calculate':
|
|
105
|
-
return horizontalDominant ? (deltaX >= 0 ? 'right' : 'left') : deltaY >= 0 ? 'bottom' : 'top';
|
|
106
|
-
|
|
107
|
-
case 'calculate_horizontal':
|
|
108
|
-
if (absX < EPSILON) {
|
|
109
|
-
return fallbackSide;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
return deltaX >= 0 ? 'right' : 'left';
|
|
113
|
-
|
|
114
|
-
case 'calculate_vertical':
|
|
115
|
-
if (absY < EPSILON) {
|
|
116
|
-
return fallbackSide;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return deltaY >= 0 ? 'bottom' : 'top';
|
|
120
|
-
|
|
121
|
-
case 'top':
|
|
122
|
-
case 'bottom':
|
|
123
|
-
case 'left':
|
|
124
|
-
case 'right':
|
|
125
|
-
return requestedSide;
|
|
126
|
-
|
|
127
|
-
default:
|
|
128
|
-
return fallbackSide;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function buildFixedLine(sourceRect, targetRect, sourceSide, targetSide) {
|
|
133
|
-
const sourceAnchor = sourceSide === 'auto' ? 'bottom' : sourceSide;
|
|
134
|
-
const targetAnchor = targetSide === 'auto' ? 'top' : targetSide;
|
|
135
|
-
|
|
136
|
-
const point1 = getSidePoint(sourceRect, sourceAnchor);
|
|
137
|
-
const point2 = getSidePoint(targetRect, targetAnchor);
|
|
138
|
-
|
|
139
|
-
if (!point1 || !point2) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
return { point1, point2 };
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function buildFloatingLine(sourceRect, targetRect) {
|
|
147
|
-
const sourceCenter = getRectCenter(sourceRect);
|
|
148
|
-
const targetCenter = getRectCenter(targetRect);
|
|
149
|
-
|
|
150
|
-
return {
|
|
151
|
-
point1: getRectBorderIntersection(sourceRect, sourceCenter, targetCenter),
|
|
152
|
-
point2: getRectBorderIntersection(targetRect, targetCenter, sourceCenter),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function hasRoundedCorners(rect) {
|
|
157
|
-
return !!(rect.radius1 || rect.radius2 || rect.radius3 || rect.radius4);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function getRectCenter(rect) {
|
|
161
|
-
return {
|
|
162
|
-
x: rect.x + rect.width / 2,
|
|
163
|
-
y: rect.y + rect.height / 2,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function getRectBorderIntersection(rect, from, to) {
|
|
168
|
-
const halfWidth = rect.width / 2;
|
|
169
|
-
const halfHeight = rect.height / 2;
|
|
170
|
-
const center = getRectCenter(rect);
|
|
171
|
-
|
|
172
|
-
const dx = to.x - from.x;
|
|
173
|
-
const dy = to.y - from.y;
|
|
174
|
-
|
|
175
|
-
if (Math.abs(dx) < EPSILON && Math.abs(dy) < EPSILON) {
|
|
176
|
-
return center;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const scaleX = Math.abs(dx) < EPSILON ? Number.POSITIVE_INFINITY : halfWidth / Math.abs(dx);
|
|
180
|
-
const scaleY = Math.abs(dy) < EPSILON ? Number.POSITIVE_INFINITY : halfHeight / Math.abs(dy);
|
|
181
|
-
const scale = Math.min(scaleX, scaleY);
|
|
182
|
-
|
|
183
|
-
return {
|
|
184
|
-
x: center.x + dx * scale,
|
|
185
|
-
y: center.y + dy * scale,
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function getSidePoint(rect, side) {
|
|
190
|
-
const centerX = rect.x + rect.width / 2;
|
|
191
|
-
const centerY = rect.y + rect.height / 2;
|
|
192
|
-
|
|
193
|
-
switch (side) {
|
|
194
|
-
case 'top':
|
|
195
|
-
return { x: centerX, y: rect.y };
|
|
196
|
-
|
|
197
|
-
case 'right':
|
|
198
|
-
return { x: rect.x + rect.width, y: centerY };
|
|
199
|
-
|
|
200
|
-
case 'bottom':
|
|
201
|
-
return { x: centerX, y: rect.y + rect.height };
|
|
202
|
-
|
|
203
|
-
case 'left':
|
|
204
|
-
return { x: rect.x, y: centerY };
|
|
205
|
-
|
|
206
|
-
default:
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
`.trim();function sm(t){return!!cm(t)}function cm(t){let i=t,e=i?.Blob,n=i?.Worker,o=i?.URL;return!e||!n||typeof o?.createObjectURL!="function"||typeof o.revokeObjectURL!="function"?null:{blobCtor:e,workerCtor:n,urlApi:o}}function Iy(t){let i=new t.blobCtor([Sy],{type:"text/javascript"});return t.urlApi.createObjectURL(i)}function dm(t,i){if(!t)return;let e=i??(typeof URL>"u"?null:URL);typeof e?.revokeObjectURL=="function"&&e.revokeObjectURL(t)}var _n=(()=>{class t{worker=null;workerUrl=null;nextRequestId=0;isDisabled=!1;pending=new Map;resetRuntime(e){this.pending.forEach(n=>n.reject(e)),this.pending.clear(),this.worker?.terminate(),this.worker=null,dm(this.workerUrl),this.workerUrl=null}dispose(){this.resetRuntime(new Error("Connection worker was destroyed."))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),wc=class{connection;line;static fToken=Symbol("ApplyConnectionRenderRequest");constructor(i,e){this.connection=i,this.line=e}},Ty=(()=>{let t=class sr{_mediator=d(R);_renderCache=new WeakMap;handle({connection:e,line:n}){!this._mediator.execute(new Un(e))&&!this._shouldRender(e,n)||(e.setLine(n),e.initialize())}_shouldRender(e,n){let o=e.fPath().hostElement,r=this._createConnectionRenderSignature(e,n),a=this._renderCache.get(e);return a?.signature===r&&a.pathElement===o?!1:(this._renderCache.set(e,{signature:r,pathElement:o}),!0)}_createConnectionRenderSignature(e,n){let{sourceSide:o,targetSide:r}=e.getResolvedSides();return[e.fBehavior,e.fType,e.fRadius,e.fOffset,e.fReassignableStart(),this._serializeContents([...e.fContents()||[]]),o,r,this._serializePoint(n.point1),this._serializePoint(n.point2),this._serializeWaypoints(e.fWaypoints()?.waypoints()||[])].join("|")}_serializePoint(e){return`${e.x}:${e.y}`}_serializeWaypoints(e){return e.map(this._serializePoint).join(";")}_serializeContents(e){return e.map(n=>[n.position(),n.offset(),n.align()].join(":")).join(";")}static \u0275fac=function(n){return new(n||sr)};static \u0275prov=y({token:sr,factory:sr.\u0275fac})};return t=C([x(wc)],t),t})(),Sc=class{source;target;static fToken=Symbol("MarkConnectionConnectorsAsConnectedRequest");constructor(i,e){this.source=i,this.target=e}},Py=(()=>{let t=class cr{_state=d(Bl);handle({source:e,target:n}){e.setConnected(n),n.setConnected(e),this._state.trackConnectedConnectors(e,n)}static \u0275fac=function(n){return new(n||cr)};static \u0275prov=y({token:cr,factory:cr.\u0275fac})};return t=C([x(Sc)],t),t})(),Ht=class{element;cache;static fToken=Symbol("GetNormalizedConnectorRectRequest");constructor(i,e=!0){this.element=i,this.cache=e}},Ey={enabled:!1},Ct=new pe("F_CACHE_OPTIONS",{providedIn:"root",factory:()=>se({},Ey)});var Ic=class{id;nodeId;kind;element;static fToken=Symbol("RegisterFCacheConnectorRequest");constructor(i,e,n,o){this.id=i,this.nodeId=e,this.kind=n,this.element=o}},xt=(()=>{class t{nodeEntries=new Map;nodeIdByElement=new WeakMap;connectorEntries=new Map;connectorKeysByNodeId=new Map;connectorKeyByElement=new WeakMap;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),_f=class{key;id;kind;nodeId;element;rect;constructor(i,e,n,o,r,a){this.key=i,this.id=e,this.kind=n,this.nodeId=o,this.element=r,this.rect=a}},xi=class{static build(i,e){return`${i}:${e}`}},gf=class{id;element;reference;rect;constructor(i,e,n,o){this.id=i,this.element=e,this.reference=n,this.rect=o}},Wn=class{nodeId;reason;static fToken=Symbol("InvalidateFCacheNodeRequest");constructor(i,e="manual"){this.nodeId=i,this.reason=e}},Dy=(()=>{let t=class dr{_store=d(xt);_options=d(Ct);handle({nodeId:e,reason:n}){if(!this._options.enabled)return;let o=this._store.nodeEntries.get(e);if(!o)return;o.rect=void 0;let r=this._store.connectorKeysByNodeId.get(e);if(r?.size)for(let a of r){let s=this._store.connectorEntries.get(a);s&&(s.rect=void 0)}}static \u0275fac=function(n){return new(n||dr)};static \u0275prov=y({token:dr,factory:dr.\u0275fac})};return t=C([x(Wn)],t),t})(),Tc=class{id;element;reference;static fToken=Symbol("RegisterFCacheNodeRequest");constructor(i,e,n){this.id=i,this.element=e,this.reference=n}},My=(()=>{let t=class lr{_store=d(xt);_options=d(Ct);handle({id:e,element:n,reference:o}){if(!this._options.enabled)return;let r=new gf(e,n,o);this._store.nodeEntries.set(e,r),this._store.nodeIdByElement.set(n,e),this._store.connectorKeysByNodeId.set(e,this._store.connectorKeysByNodeId.get(e)??new Set)}static \u0275fac=function(n){return new(n||lr)};static \u0275prov=y({token:lr,factory:lr.\u0275fac})};return t=C([x(Tc)],t),t})(),Pc=class{id;static fToken=Symbol("UnregisterFCacheNodeRequest");constructor(i){this.id=i}},ky=(()=>{let t=class ur{_store=d(xt);_mediator=d(R);_options=d(Ct);handle({id:e}){if(!this._options.enabled)return;let n=this._store.nodeEntries.get(e);if(!n)return;this._store.nodeEntries.delete(e),this._store.nodeIdByElement.delete(n.element);let o=Array.from(this._store.connectorKeysByNodeId.get(e)??[]);for(let r of o){let a=this._store.connectorEntries.get(r);a&&this._mediator.execute(new bi(a.id,a.kind))}this._store.connectorKeysByNodeId.delete(e)}static \u0275fac=function(n){return new(n||ur)};static \u0275prov=y({token:ur,factory:ur.\u0275fac})};return t=C([x(Pc)],t),t})(),Ny=(()=>{let t=class fr{_store=d(xt);_mediator=d(R);_options=d(Ct);handle({id:e,nodeId:n,kind:o,element:r}){if(!this._options.enabled)return;let a=xi.build(e,o),s=this._store.connectorEntries.get(a);s&&(this._detachConnectorFromNode(s.key,s.nodeId),this._store.connectorKeyByElement.delete(s.element));let l=new _f(a,e,o,n,r);this._store.connectorEntries.set(a,l),this._store.connectorKeyByElement.set(r,a);let u=this._store.connectorKeysByNodeId.get(n)??new Set;u.add(a),this._store.connectorKeysByNodeId.set(n,u),this._mediator.execute(new Wn(n,"connector-registered"))}_detachConnectorFromNode(e,n){let o=this._store.connectorKeysByNodeId.get(n);o&&(o.delete(e),o.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||fr)};static \u0275prov=y({token:fr,factory:fr.\u0275fac})};return t=C([x(Ic)],t),t})(),bi=class{connectorId;kind;static fToken=Symbol("UnregisterFCacheConnectorRequest");constructor(i,e){this.connectorId=i,this.kind=e}},Ry=(()=>{let t=class pr{_store=d(xt);_mediator=d(R);_options=d(Ct);handle({connectorId:e,kind:n}){if(!this._options.enabled)return;let o=xi.build(e,n),r=this._store.connectorEntries.get(o);r&&(this._store.connectorEntries.delete(o),this._store.connectorKeyByElement.delete(r.element),this._detachConnectorFromNode(o,r.nodeId),this._store.nodeEntries.has(r.nodeId)&&this._mediator.execute(new Wn(r.nodeId,"connector-unregistered")))}_detachConnectorFromNode(e,n){let o=this._store.connectorKeysByNodeId.get(n);o&&(o.delete(e),o.size||this._store.connectorKeysByNodeId.delete(n))}static \u0275fac=function(n){return new(n||pr)};static \u0275prov=y({token:pr,factory:pr.\u0275fac})};return t=C([x(bi)],t),t})(),$n=class{element;static fToken=Symbol("GetCachedFCacheRectRequest");constructor(i){this.element=i}},Oy=(()=>{let t=class hr{_store=d(xt);_options=d(Ct);handle({element:e}){if(!this._options.enabled)return;let n=this._store.nodeIdByElement.get(e);if(n){let r=this._store.nodeEntries.get(n)?.rect;if(r)return r}let o=this._store.connectorKeyByElement.get(e);if(o)return this._store.connectorEntries.get(o)?.rect??void 0}static \u0275fac=function(n){return new(n||hr)};static \u0275prov=y({token:hr,factory:hr.\u0275fac})};return t=C([x($n)],t),t})(),dn=class{connectorId;kind;rect;static fToken=Symbol("SetFCacheConnectorRectRequest");constructor(i,e,n){this.connectorId=i,this.kind=e,this.rect=n}},Fy=(()=>{let t=class mr{_store=d(xt);_options=d(Ct);handle({connectorId:e,kind:n,rect:o}){if(!this._options.enabled)return;let r=xi.build(e,n),a=this._store.connectorEntries.get(r);a&&(a.rect=De.fromRoundedRect(o))}static \u0275fac=function(n){return new(n||mr)};static \u0275prov=y({token:mr,factory:mr.\u0275fac})};return t=C([x(dn)],t),t})(),ln=class{nodeId;rect;static fToken=Symbol("SetFCacheNodeRectRequest");constructor(i,e){this.nodeId=i,this.rect=e}},Ay=(()=>{let t=class _r{_store=d(xt);_options=d(Ct);handle({nodeId:e,rect:n}){if(!this._options.enabled)return;let o=this._store.nodeEntries.get(e);if(!o)return;let r=o.rect;o.rect=H.initialize(n.x,n.y,n.width,n.height),r&&this._updateConnectorRectsByNodeRect(e,r,o.rect)}_updateConnectorRectsByNodeRect(e,n,o){let r=this._store.connectorKeysByNodeId.get(e);if(!r?.size)return;let a=o.x-n.x,s=o.y-n.y,l=n.width!==0,u=n.height!==0,h=l?o.width/n.width:1,g=u?o.height/n.height:1;for(let w of r){let b=this._store.connectorEntries.get(w);if(!b?.rect)continue;let P=b.rect,T=P.gravityCenter,k=l?o.x+(T.x-n.x)*h:T.x+a,N=u?o.y+(T.y-n.y)*g:T.y+s;b.rect=new De(k-P.width/2,N-P.height/2,P.width,P.height,P.radius1,P.radius2,P.radius3,P.radius4)}}static \u0275fac=function(n){return new(n||_r)};static \u0275prov=y({token:_r,factory:_r.\u0275fac})};return t=C([x(ln)],t),t})(),wi=class{element;rect;static fToken=Symbol("UpdateFCacheRectByElementRequest");constructor(i,e){this.element=i,this.rect=e}},Ly=(()=>{let t=class gr{_store=d(xt);_options=d(Ct);handle({element:e,rect:n}){if(!this._options.enabled)return;let o=this._store.nodeIdByElement.get(e);if(o){let s=this._store.nodeEntries.get(o);s&&(s.rect=n);return}let r=this._store.connectorKeyByElement.get(e);if(!r)return;let a=this._store.connectorEntries.get(r);a&&(a.rect=n)}static \u0275fac=function(n){return new(n||gr)};static \u0275prov=y({token:gr,factory:gr.\u0275fac})};return t=C([x(wi)],t),t})(),By=[xt,My,ky,Dy,Ny,Ry,Oy,Ay,Fy,Ly];function ii(t,i,e){return i?Y.fromPoint(t).elementTransform(i).sub(e.scaledPosition).sub(e.position).div(e.scale):Y.fromPoint(t)}function lm(){return{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}}function Kn(t){return t?`${t}`:void 0}var zy=(()=>{let t=class yr{_store=d(M);_mediator=d(R);_browser=d(ke);get _transform(){return this._store.transform}handle({element:e,cache:n}){let o=this._mediator.execute(new $n(e));if(o&&n)return o;let r=this._getElementRoundedRect(e),a=this._normalizePosition(r),s=this._unscaleSize(r),l=this._getUnscaledRect(a,s,r),u=this._getOffsetSize(e,s),h=De.fromCenter(l,u.width,u.height);return this._mediator.execute(new wi(e,h)),h}_getElementRoundedRect(e){return this._getRoundedRect(H.fromElement(e),e,this._getComputedStyle(e))}_getRoundedRect(e,n,o){let[r,a,s,l]=this._normalizeCircularBorderRadii(e.width,e.height,[this._getSystemRadius(o.borderTopLeftRadius,n,o.fontSize),this._getSystemRadius(o.borderTopRightRadius,n,o.fontSize),this._getSystemRadius(o.borderBottomRightRadius,n,o.fontSize),this._getSystemRadius(o.borderBottomLeftRadius,n,o.fontSize)]);return new De(e.x,e.y,e.width,e.height,r,a,s,l)}_getComputedStyle(e){return this._browser.window.getComputedStyle(e)}_toPixels(e,n,o){return this._browser.toPixels(e,n.clientWidth,n.clientHeight,o)||0}_getSystemRadius(e,n,o){return this._toPixels(e,n,o)*this._transform.scale}_normalizeCircularBorderRadii(e,n,o){let[r,a,s,l]=o.map(h=>Math.max(0,h)),u=Math.min(1,this._getRadiusScaleFactor(e,r+a),this._getRadiusScaleFactor(n,a+s),this._getRadiusScaleFactor(e,s+l),this._getRadiusScaleFactor(n,l+r));return[r*u,a*u,s*u,l*u]}_getRadiusScaleFactor(e,n){return n<=0?1:e<=0?0:e/n}_normalizePosition(e){return ii(e,this._store.flowHost,this._transform)}_unscaleSize(e){return ft.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n,o){return new De(e.x,e.y,n.width,n.height,this._unscaleRadius(o.radius1),this._unscaleRadius(o.radius2),this._unscaleRadius(o.radius3),this._unscaleRadius(o.radius4))}_unscaleRadius(e){return e/this._transform.scale}_getOffsetSize(e,n){return ft.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||yr)};static \u0275prov=y({token:yr,factory:yr.\u0275fac})};return t=C([x(Ht)],t),t})(),Ec=class{connector;cache;static fToken=Symbol("ResolveConnectionEndpointRectRequest");constructor(i,e){this.connector=i,this.cache=e}},Vy=(()=>{let t=class vr{_mediator=d(R);handle({connector:e,cache:n}){let o=this._buildCacheKey(e),r=n.get(o)??this._calculateRect(e);return n.set(o,r),r}_buildCacheKey(e){return`${e.kind}::${e.fId()}`}_calculateRect(e){return this._mediator.execute(new Ht(e.hostElement))}static \u0275fac=function(n){return new(n||vr)};static \u0275prov=y({token:vr,factory:vr.\u0275fac})};return t=C([x(Ec)],t),t})(),Dc=class{connection;static fToken=Symbol("ResolveConnectionEndpointsRequest");constructor(i){this.connection=i}},Hy=(()=>{let t=class Cr{_store=d(M);handle({connection:e}){let n=this._store.outputs.get(e.fOutputId()),o=this._store.inputs.get(e.fInputId());return!n||!o?null:{source:n,target:o}}static \u0275fac=function(n){return new(n||Cr)};static \u0275prov=y({token:Cr,factory:Cr.\u0275fac})};return t=C([x(Dc)],t),t})(),Si=class{connection;cache;static fToken=Symbol("ResolveConnectionGeometryRequest");constructor(i,e){this.connection=i,this.cache=e}},Gy=(()=>{let t=class xr{_mediator=d(R);handle({connection:e,cache:n}){let o=this._resolveConnectionEndpoints(e);return o?li(se({},o),{sourceRect:this._resolveEndpointRect(o.source,n),targetRect:this._resolveEndpointRect(o.target,n)}):null}_resolveConnectionEndpoints(e){return this._mediator.execute(new Dc(e))}_resolveEndpointRect(e,n){return this._mediator.execute(new Ec(e,n))}static \u0275fac=function(n){return new(n||xr)};static \u0275prov=y({token:xr,factory:xr.\u0275fac})};return t=C([x(Si)],t),t})(),Ie=class{element;static fToken=Symbol("GetNormalizedElementRectRequest");constructor(i){this.element=i}},jy=(()=>{let t=class br{_store=d(M);_mediator=d(R);get _transform(){return this._store.transform}handle({element:e}){let n=this._mediator.execute(new $n(e));if(n)return n;let o=H.fromElement(e),r=this._normalizePosition(o),a=this._unscaleSize(o),s=this._getUnscaledRect(r,a),l=this._getOffsetSize(e,a),u=this._fromCenter(s,l.width,l.height);return this._mediator.execute(new wi(e,u)),u}_fromCenter(e,n,o){return H.initialize(e.gravityCenter.x-n/2,e.gravityCenter.y-o/2,n,o)}_normalizePosition(e){return ii(e,this._store.flowHost,this._transform)}_unscaleSize(e){return ft.initialize(e.width/this._transform.scale,e.height/this._transform.scale)}_getUnscaledRect(e,n){return new De(e.x,e.y,n.width,n.height)}_getOffsetSize(e,n){return ft.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||br)};static \u0275prov=y({token:br,factory:br.\u0275fac})};return t=C([x(Ie)],t),t})(),Et=class{connector;static fToken=Symbol("ResolveConnectionEndpointRotationContextRequest");constructor(i){this.connector=i}},Uy=(()=>{let t=class wr{_store=d(M);_mediator=d(R);handle({connector:e}){if(!e)return;let n=this._store.nodes.get(e.fNodeId);if(!n||!n._rotate)return;let o=this._mediator.execute(new Ie(n.hostElement));return{rotationDeg:n._rotate,pivot:o.gravityCenter}}static \u0275fac=function(n){return new(n||wr)};static \u0275prov=y({token:wr,factory:wr.\u0275fac})};return t=C([x(Et)],t),t})(),Mc=class{connection;geometry;static fToken=Symbol("BuildConnectionLineRequest");constructor(i,e){this.connection=i,this.geometry=e}},Wy=(()=>{let t=class Sr{_mediator=d(R);_connectionBehaviour=d(ni);handle({connection:e,geometry:n}){return this._connectionBehaviour.handle(new ht(n.sourceRect,n.targetRect,e,n.source.fConnectableSide,n.target.fConnectableSide,this._resolveRotationContext(n.source),this._resolveRotationContext(n.target)))}_resolveRotationContext(e){return this._mediator.execute(new Et(e))}static \u0275fac=function(n){return new(n||Sr)};static \u0275prov=y({token:Sr,factory:Sr.\u0275fac})};return t=C([x(Mc)],t),t})(),Ii=class{connection;source;target;line;static fToken=Symbol("RenderConnectionWithLineRequest");constructor(i,e,n,o){this.connection=i,this.source=e,this.target=n,this.line=o}},$y=(()=>{let t=class Ir{_mediator=d(R);handle({connection:e,source:n,target:o,line:r}){this._mediator.execute(new Sc(n,o)),this._mediator.execute(new wc(e,r))}static \u0275fac=function(n){return new(n||Ir)};static \u0275prov=y({token:Ir,factory:Ir.\u0275fac})};return t=C([x(Ii)],t),t})(),Ti=class{connection;geometry;static fToken=Symbol("RenderConnectionFromGeometryRequest");constructor(i,e){this.connection=i,this.geometry=e}},Ky=(()=>{let t=class Tr{_mediator=d(R);handle({connection:e,geometry:n}){let o=this._mediator.execute(new Mc(e,n));this._mediator.execute(new Ii(e,n.source,n.target,o))}static \u0275fac=function(n){return new(n||Tr)};static \u0275prov=y({token:Tr,factory:Tr.\u0275fac})};return t=C([x(Ti)],t),t})(),kc=class{connection;cache;static fToken=Symbol("RenderConnectionRequest");constructor(i,e){this.connection=i,this.cache=e}},Xy=(()=>{let t=class Pr{_mediator=d(R);handle({connection:e,cache:n}){let o=this._mediator.execute(new Si(e,n));o&&this._mediator.execute(new Ti(e,o))}static \u0275fac=function(n){return new(n||Pr)};static \u0275prov=y({token:Pr,factory:Pr.\u0275fac})};return t=C([x(kc)],t),t})(),un=class{session;static fToken=Symbol("IsConnectionRedrawCurrentRequest");constructor(i){this.session=i}},qy=(()=>{let t=class Er{_store=d(M);_state=d(Bl);handle({session:e}){return e.renderTicket===this._state.renderTicket&&e.nodesRevision===this._store.nodesRevision}static \u0275fac=function(n){return new(n||Er)};static \u0275prov=y({token:Er,factory:Er.\u0275fac})};return t=C([x(un)],t),t})(),Pi=class{session;static fToken=Symbol("CompleteConnectionRedrawRequest");constructor(i){this.session=i}},Yy=(()=>{let t=class Dr{_mediator=d(R);_store=d(M);handle({session:e}){this._mediator.execute(new un(e))&&this._store.completeConnectionsRender(e.connectionsRevision,e.nodesRevision)}static \u0275fac=function(n){return new(n||Dr)};static \u0275prov=y({token:Dr,factory:Dr.\u0275fac})};return t=C([x(Pi)],t),t})(),Nc=class{batchItem;result;static fToken=Symbol("ApplyConnectionWorkerResultRequest");constructor(i,e){this.batchItem=i,this.result=e}},Zy=(()=>{let t=class Mr{_mediator=d(R);handle({batchItem:e,result:n}){if(e){if(!this._isSupportedWorkerResult(n)){this._fallbackToMainThread(e);return}try{e.connection._applyResolvedSidesToConnection(n.sourceSide,n.targetSide),this._mediator.execute(new Ii(e.connection,e.geometry.source,e.geometry.target,n.line))}catch{this._fallbackToMainThread(e)}}}_fallbackToMainThread(e){this._mediator.execute(new Ti(e.connection,e.geometry))}_isSupportedWorkerResult(e){return!!(e?.supported&&e.sourceSide&&e.targetSide&&e.line)}static \u0275fac=function(n){return new(n||Mr)};static \u0275prov=y({token:Mr,factory:Mr.\u0275fac})};return t=C([x(Nc)],t),t})(),Lt=class{connections;cache;startIndex;session;batchItems;workerResults;static fToken=Symbol("RunConnectionRedrawSliceRequest");constructor(i,e,n,o,r,a){this.connections=i,this.cache=e,this.startIndex=n,this.session=o,this.batchItems=r,this.workerResults=a}},Qy=500,Jy=6,ev=(()=>{let t=class kr{_mediator=d(R);_browser=d(ke);handle({connections:e,cache:n,startIndex:o,session:r,batchItems:a,workerResults:s}){if(!this._isCurrent(r))return;let l=this._now(),u=o,h=0;for(;u<e.length&&h<Qy&&this._isWithinSliceBudget(l);){let g=e[u];if(a?this._mediator.execute(new Nc(a[u]??null,s?.[u])):this._mediator.execute(new kc(g,n)),u++,h++,!this._isCurrent(r))return}if(u>=e.length){this._mediator.execute(new Pi(r));return}this._requestAnimationFrame(()=>this._mediator.execute(new Lt(e,n,u,r,a,s)))}_isCurrent(e){return this._mediator.execute(new un(e))}_requestAnimationFrame(e){let n=this._browser.document.defaultView;if(!n){e();return}n.requestAnimationFrame(e)}_now(){let e=this._browser.document.defaultView?.performance;return e?e.now():Date.now()}_isWithinSliceBudget(e){return this._browser.isBrowser()?this._now()-e<Jy:!0}static \u0275fac=function(n){return new(n||kr)};static \u0275prov=y({token:kr,factory:kr.\u0275fac})};return t=C([x(Lt)],t),t})(),Rc=class{static fToken=Symbol("StartConnectionRedrawRequest")},tv=(()=>{let t=class Nr{_store=d(M);_state=d(Bl);handle(e){return this._state.resetConnectedConnectors(),{renderTicket:this._state.beginRender(),connectionsRevision:this._store.connectionsRevision,nodesRevision:this._store.nodesRevision}}static \u0275fac=function(n){return new(n||Nr)};static \u0275prov=y({token:Nr,factory:Nr.\u0275fac})};return t=C([x(Rc)],t),t})(),Ei=class{static fToken=Symbol("RedrawConnectionsRequest")},Oc=class{connectionCount;static fToken=Symbol("ShouldUseConnectionWorkerRequest");constructor(i){this.connectionCount=i}},Di=class{static fToken=Symbol("IsConnectionWorkerEnabledRequest")},nv=(()=>{let t=class Rr{_browser=d(ke);_state=d(_n);handle(e){if(this._state.isDisabled||!this._isWorkerAvailable())return!1;let n=this._browser.document.defaultView;return sm(n)}_isWorkerAvailable(){return this._browser.isBrowser()}static \u0275fac=function(n){return new(n||Rr)};static \u0275prov=y({token:Rr,factory:Rr.\u0275fac})};return t=C([x(Di)],t),t})(),iv=(()=>{let t=class Or{_mediator=d(R);handle({connectionCount:e}){return e>0&&this._mediator.execute(new Di)}static \u0275fac=function(n){return new(n||Or)};static \u0275prov=y({token:Or,factory:Or.\u0275fac})};return t=C([x(Oc)],t),t})(),Fc=class{connection;geometry;originalIndex;static fToken=Symbol("BuildConnectionWorkerPayloadItemRequest");constructor(i,e,n){this.connection=i,this.geometry=e,this.originalIndex=n}},ov=(()=>{let t=class Fr{_store=d(M);handle({connection:e,geometry:n,originalIndex:o}){let{source:r,target:a,sourceRect:s,targetRect:l}=n;return{originalIndex:o,behavior:e.fBehavior,outputSide:e.fOutputSide(),inputSide:e.fInputSide(),sourceConnectableSide:r.fConnectableSide,targetConnectableSide:a.fConnectableSide,sourceRotation:this._store.nodes.get(r.fNodeId)?._rotate||0,targetRotation:this._store.nodes.get(a.fNodeId)?._rotate||0,sourceRect:{x:s.x,y:s.y,width:s.width,height:s.height,radius1:s.radius1,radius2:s.radius2,radius3:s.radius3,radius4:s.radius4},targetRect:{x:l.x,y:l.y,width:l.width,height:l.height,radius1:l.radius1,radius2:l.radius2,radius3:l.radius3,radius4:l.radius4}}}static \u0275fac=function(n){return new(n||Fr)};static \u0275prov=y({token:Fr,factory:Fr.\u0275fac})};return t=C([x(Fc)],t),t})(),Ac=class{connections;cache;static fToken=Symbol("BuildConnectionWorkerBatchRequest");constructor(i,e){this.connections=i,this.cache=e}},rv=(()=>{let t=class Ar{_mediator=d(R);handle({connections:e,cache:n}){let o=new Array(e.length),r=[];for(let a=0;a<e.length;a++){let s=this._buildBatchItem(e[a],n,a);o[a]=s,s&&r.push(s.payload)}return{items:o,payload:r}}_buildBatchItem(e,n,o){let r=this._mediator.execute(new Si(e,n));return r?{connection:e,geometry:r,payload:this._mediator.execute(new Fc(e,r,o))}:null}static \u0275fac=function(n){return new(n||Ar)};static \u0275prov=y({token:Ar,factory:Ar.\u0275fac})};return t=C([x(Ac)],t),t})(),Lc=class{error;static fToken=Symbol("DisableConnectionWorkerRequest");constructor(i){this.error=i}},Mi=class{error;static fToken=Symbol("ResetConnectionWorkerRuntimeRequest");constructor(i){this.error=i}},av=(()=>{let t=class Lr{_state=d(_n);handle({error:e}){this._state.resetRuntime(e)}static \u0275fac=function(n){return new(n||Lr)};static \u0275prov=y({token:Lr,factory:Lr.\u0275fac})};return t=C([x(Mi)],t),t})(),sv=(()=>{let t=class Br{_state=d(_n);_mediator=d(R);handle({error:e}){this._state.isDisabled=!0,this._mediator.execute(new Mi(e))}static \u0275fac=function(n){return new(n||Br)};static \u0275prov=y({token:Br,factory:Br.\u0275fac})};return t=C([x(Lc)],t),t})(),Bc=class{message;static fToken=Symbol("HandleConnectionWorkerMessageRequest");constructor(i){this.message=i}},cv=(()=>{let t=class zr{_state=d(_n);handle({message:e}){if(!e||typeof e.requestId!="number")return;let n=this._state.pending.get(e.requestId);if(n){if(this._state.pending.delete(e.requestId),e.error){n.reject(new Error(e.error));return}n.resolve(e.results??[])}}static \u0275fac=function(n){return new(n||zr)};static \u0275prov=y({token:zr,factory:zr.\u0275fac})};return t=C([x(Bc)],t),t})(),zc=class{static fToken=Symbol("EnsureConnectionWorkerRequest")},dv=(()=>{let t=class Vr{_browser=d(ke);_state=d(_n);_mediator=d(R);handle(e){if(this._state.worker)return this._state.worker;let n=this._browser.document.defaultView;if(!sm(n))return null;let o=cm(n);if(!o)return null;let r=Iy(o);try{let a=new o.workerCtor(r,{name:"f-flow-connection-worker"});return a.onmessage=s=>{this._mediator.execute(new Bc(s.data))},a.onerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker runtime error."))},a.onmessageerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker message deserialization error."))},this._state.workerUrl=r,this._state.worker=a,a}catch(a){return dm(r,o.urlApi),this._disableWorker(a instanceof Error?a:new Error("Connection worker initialization failed.")),null}}_disableWorker(e){this._mediator.execute(new Lc(e))}_resetWorkerAfterRuntimeError(e){this._mediator.execute(new Mi(e))}static \u0275fac=function(n){return new(n||Vr)};static \u0275prov=y({token:Vr,factory:Vr.\u0275fac})};return t=C([x(zc)],t),t})(),Vc=class{payload;static fToken=Symbol("RunConnectionWorkerRequest");constructor(i){this.payload=i}},lv=(()=>{let t=class Hr{_state=d(_n);_mediator=d(R);handle({payload:e}){if(!e.length)return Promise.resolve([]);if(!this._mediator.execute(new Di))return Promise.reject(new Error("Connection worker is disabled."));this._interruptPendingRequests();let n=this._mediator.execute(new zc);if(!n)return Promise.reject(new Error("Unable to initialize connection worker."));let o=++this._state.nextRequestId;return new Promise((r,a)=>{this._state.pending.set(o,{resolve:r,reject:a});try{n.postMessage({requestId:o,items:e})}catch(s){this._state.pending.delete(o),a(s instanceof Error?s:new Error("Unknown error while posting message to connection worker."))}})}_interruptPendingRequests(){if(!this._state.pending.size)return;let e=new Error("Connection worker request was superseded by a newer redraw.");this._state.pending.forEach(n=>n.reject(e)),this._state.pending.clear()}static \u0275fac=function(n){return new(n||Hr)};static \u0275prov=y({token:Hr,factory:Hr.\u0275fac})};return t=C([x(Vc)],t),t})(),Hc=class{batch;static fToken=Symbol("RunConnectionWorkerBatchRequest");constructor(i){this.batch=i}},uv=(()=>{let t=class Gr{_mediator=d(R);handle({batch:e}){return e.payload.length?this._mediator.execute(new Vc(e.payload)):Promise.resolve([])}static \u0275fac=function(n){return new(n||Gr)};static \u0275prov=y({token:Gr,factory:Gr.\u0275fac})};return t=C([x(Hc)],t),t})(),Gc=class{connections;cache;session;static fToken=Symbol("StartConnectionWorkerRedrawRequest");constructor(i,e,n){this.connections=i,this.cache=e,this.session=n}},fv=(()=>{let t=class jr{_mediator=d(R);handle({connections:e,cache:n,session:o}){let r=this._mediator.execute(new Ac(e,n));if(!r.payload.length){this._mediator.execute(new Lt(e,n,0,o,r.items));return}this._mediator.execute(new Hc(r)).then(a=>{this._mediator.execute(new un(o))&&this._mediator.execute(new Lt(e,n,0,o,r.items,this._alignWorkerResults(a,e.length)))}).catch(()=>{this._mediator.execute(new un(o))&&this._mediator.execute(new Lt(e,n,0,o,r.items))})}_alignWorkerResults(e,n){let o=new Array(n);for(let r of e){let a=r.originalIndex;a<0||a>=n||(o[a]=r)}return o}static \u0275fac=function(n){return new(n||jr)};static \u0275prov=y({token:jr,factory:jr.\u0275fac})};return t=C([x(Gc)],t),t})(),pv=(()=>{let t=class Ur{_mediator=d(R);_store=d(M);handle(e){let n=this._mediator.execute(new Rc);this._createMarkersForCreate(),this._createMarkersForSnap();let o=[...this._store.connections.getAll()],r=new Map;if(!o.length){this._mediator.execute(new Pi(n));return}this._shouldUseConnectionWorker(o.length)?this._redrawUsingWorker(o,r,n):this._redrawWithoutWorker(o,r,n)}_createMarkersForCreate(){let e=this._store.connections.getForCreate();e&&this._mediator.execute(new Un(e))}_createMarkersForSnap(){let e=this._store.connections.getForSnap();e&&this._mediator.execute(new Un(e))}_shouldUseConnectionWorker(e){return this._mediator.execute(new Oc(e))}_redrawUsingWorker(e,n,o){this._mediator.execute(new Gc(e,n,o))}_redrawWithoutWorker(e,n,o){this._mediator.execute(new Lt(e,n,0,o))}static \u0275fac=function(n){return new(n||Ur)};static \u0275prov=y({token:Ur,factory:Ur.\u0275fac})};return t=C([x(Ei)],t),t})(),yf=class{static fToken=Symbol("RemoveConnectionForCreateFromStoreRequest")},hv=(()=>{let t=class Wr{_store=d(M);handle(e){this._store.connections.removeInstanceForCreate()}static \u0275fac=function(n){return new(n||Wr)};static \u0275prov=y({token:Wr,factory:Wr.\u0275fac})};return t=C([x(yf)],t),t})(),jc=class{connection;static fToken=Symbol("RemoveConnectionFromStoreRequest");constructor(i){this.connection=i}},mv=(()=>{let t=class $r{_store=d(M);handle({connection:e}){this._store.connections.remove(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||$r)};static \u0275prov=y({token:$r,factory:$r.\u0275fac})};return t=C([x(jc)],t),t})(),Uc=class{instance;static fToken=Symbol("RemoveConnectionMarkerFromStoreRequest");constructor(i){this.instance=i}},_v=(()=>{let t=class Kr{_store=d(M);handle({instance:e}){this._store.connectionMarkers.remove(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Kr)};static \u0275prov=y({token:Kr,factory:Kr.\u0275fac})};return t=C([x(Uc)],t),t})(),vf=class{waypointIndex;connectionId;static fToken=Symbol("RemoveConnectionWaypointRequest");constructor(i,e){this.waypointIndex=i,this.connectionId=e}},Wc=class{static fToken=Symbol("EmitEndDragSequenceEventRequest")},gv=(()=>{let t=class Xr{_store=d(M);_dragSession=d(Q);handle(e){this._store.flowHost.classList.remove(Oe.DRAG_AND_DROP.DRAGGING),this._dragSession.reset(),this._emitEvent()}_emitEvent(){this._store.fDraggable?.fDragEnded?.emit()}static \u0275fac=function(n){return new(n||Xr)};static \u0275prov=y({token:Xr,factory:Xr.\u0275fac})};return t=C([x(Wc)],t),t})(),$c=class{static fToken=Symbol("EmitStartDragSequenceEventRequest")},yv=(()=>{let t=class qr{_mediator=d(R);_store=d(M);_dragContext=d(Q);handle(e){this._dragContext.draggableItems.length>0&&(this._store.flowHost.classList.add(Oe.DRAG_AND_DROP.DRAGGING),this._mediator.execute(new ki),this._emitDragStarted())}_emitDragStarted(){let e=this._dragContext.draggableItems[0].getEvent();this._store.fDraggable?.fDragStarted?.emit(new Qc(e.kind,e.data?se({},e.data):void 0,e.fEventType))}static \u0275fac=function(n){return new(n||qr)};static \u0275prov=y({token:qr,factory:qr.\u0275fac})};return t=C([x($c)],t),t})(),ki=class{static fToken=Symbol("EmitSelectionChangeEventRequest")},fn=class{_event;_target;get originalEvent(){return this._event}get targetElement(){return this._target||this.originalEvent.target}get touchEvent(){return this._event}get touches(){return this.touchEvent.touches}constructor(i,e){this._event=i,this._target=e}setTarget(i){this._target=i}preventDefault(){this.originalEvent.preventDefault()}get isEventInLockedContext(){return this.targetElement.closest("[fLockedContext]")!==null}},Kc=class extends fn{constructor(i,e){super(i,e)}isMouseLeftButton(){return this.originalEvent.button===0}isMouseRightButton(){return this.originalEvent.buttons===2}getPosition(){return{x:this.originalEvent.clientX,y:this.originalEvent.clientY}}},Cf=class extends fn{constructor(i,e){super(i,e)}isMouseLeftButton(){let i=this.originalEvent;return i.pointerType==="mouse"&&i.button===0||i.pointerType==="touch"}isMouseRightButton(){let i=this.originalEvent;return i.pointerType==="mouse"&&i.button===2||i.pointerType==="touch"}getPosition(){let i=this.originalEvent;return{x:i.clientX,y:i.clientY}}getPointerType(){return this.originalEvent.pointerType}getPointerId(){return this.originalEvent.pointerId}},xf=class extends fn{constructor(i){super(i)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let i=this.originalEvent.touches;return{x:i[0].clientX,y:i[0].clientY}}},bf=class extends fn{constructor(i,e){super(i,e)}isMouseLeftButton(){return!0}isMouseRightButton(){return!1}getPosition(){let i=this.originalEvent.targetTouches[0];return{x:i.clientX,y:i.clientY}}},he=(()=>{class t{static _isSupported;static _isPassiveEventListenerSupported(){if(t._isSupported==null&&typeof window<"u")try{window.addEventListener("test",t.emptyListener,{passive:!0}),t._isSupported=!0}catch{t._isSupported=!1}return t._isSupported}static _passiveEventListener(e){return t._isPassiveEventListenerSupported()?e:!!e.capture}static activeListener(){return t._passiveEventListener({passive:!1})}static passiveListener(){return t._passiveEventListener({passive:!0})}static activeCaptureListener(){return t._passiveEventListener({passive:!1,capture:!0})}static emptyListener(){return()=>{}}}return t})(),vv=800,wf=class{_document=d(po);_ngZone=d(ui,{optional:!0});_mouseListeners=he.emptyListener();_touchListeners=he.emptyListener();_startListeners=he.emptyListener();isSyntheticEvent(i){return!!this._lastTouchEventTime&&this._lastTouchEventTime+vv>Date.now()}_lastTouchEventTime=0;isDragStarted=!1;_dragStartThreshold=3;_dragStartDelay=0;_dragStartTime=0;_dragStartPosition={x:0,y:0};_moveHandler=this._checkDragSequenceToStart;_pointerDownElement=null;_onMouseDown=i=>{let e=this.isSyntheticEvent(i),n=xv(i),o=new Kc(i);if(e||n||this.disabled||this.isDragStarted)return;this._pointerDownElement=o.targetElement,this.onPointerDown(o)&&(this._dragStartTime=Date.now(),this._dragStartPosition=o.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,he.activeListener()),this._listen("mousemove",this._onMouseMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,he.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,he.activeCaptureListener())}),this._mouseListeners=()=>{this._unlisten("selectstart",this._onSelectStart,he.activeListener()),this._unlisten("mousemove",this._onMouseMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,he.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,he.activeCaptureListener())})};_onTouchDown=i=>{let e=bv(i),n=new xf(i);if(e||this.disabled||this.isDragStarted)return;this._pointerDownElement=n.targetElement,this.onPointerDown(n)&&(this._dragStartTime=Date.now(),this._dragStartPosition=n.getPosition(),this._ngZone?.runOutsideAngular(()=>{this._listen("selectstart",this._onSelectStart,he.activeListener()),this._listen("touchmove",this._onTouchMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,he.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,he.activeCaptureListener())}),this._touchListeners=()=>{this._unlisten("selectstart",this._onSelectStart,he.activeListener()),this._unlisten("touchmove",this._onTouchMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,he.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,he.activeCaptureListener())})};_onSelectStart=i=>{this.onSelect(i)};_onMouseMove=i=>{this._moveHandler(new Kc(i))};_onTouchMove=i=>{this._moveHandler(new bf(i))};_checkDragSequenceToStart(i){let e=i.getPosition();if(!this.isDragStarted&&this._pointerDownElement){i.setTarget(this._pointerDownElement);let n=Math.abs(e.x-this._dragStartPosition.x),o=Math.abs(e.y-this._dragStartPosition.y);if(n+o>=this._dragStartThreshold){if(!(Date.now()>=this._dragStartTime+this._dragStartDelay)){this._endDragSequence();return}i.preventDefault(),this.prepareDragSequence(i),this.isDragStarted=!0,this._moveHandler=this.onPointerMove,Cv(i.originalEvent)&&(this._lastTouchEventTime=Date.now())}}}_onPointerUpEvent=i=>{this.isDragStarted&&this.onPointerUp(new Cf(i)),this._endDragSequence()};_endDragSequence(){this.isDragStarted=!1,this._pointerDownElement=null,this._moveHandler=this._checkDragSequenceToStart,this._mouseListeners(),this._mouseListeners=he.emptyListener(),this._touchListeners(),this._touchListeners=he.emptyListener(),this.finalizeDragSequence()}subscribe(){this.unsubscribe(),this._ngZone?.runOutsideAngular(()=>{this._listen("mousedown",this._onMouseDown,he.activeListener()),this._listen("touchstart",this._onTouchDown,he.passiveListener())}),this._startListeners=()=>{this._unlisten("mousedown",this._onMouseDown,he.activeListener()),this._unlisten("touchstart",this._onTouchDown,he.passiveListener())}}unsubscribe(){this._startListeners(),this._startListeners=he.emptyListener(),this._touchListeners(),this._touchListeners=he.emptyListener(),this._mouseListeners(),this._mouseListeners=he.emptyListener()}_listen(i,e,n){this._document.addEventListener(i,e,n)}_unlisten(i,e,n){this._document.removeEventListener(i,e,n)}_preventDuringDrag=i=>{this.isDragStarted&&i.preventDefault()}};function Cv(t){return t.type[0]==="t"}function xv(t){return t.buttons===0||t.offsetX===0&&t.offsetY===0}function bv(t){let i=t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0];return!!i&&i.identifier===-1&&(i.radiusX==null||i.radiusX===1)&&(i.radiusY==null||i.radiusY===1)}var Sf=class extends fn{_position;_isMouseLeftButton;_isMouseRightButton;constructor(i){super(i.originalEvent,i.targetElement),this._position=i.getPosition(),this._isMouseLeftButton=i.isMouseLeftButton(),this._isMouseRightButton=i.isMouseRightButton()}isMouseLeftButton(){return this._isMouseLeftButton}isMouseRightButton(){return this._isMouseRightButton}getPosition(){return se({},this._position)}};function wv(t){return new Sf(t)}var Q=(()=>{class t{selectedItems=[];isSelectedChanged=!1;onPointerDownScale=1;onPointerDownPosition=new Y(0,0);draggableItems=[];autoPanFrameId=null;lastPointerEvent=null;lastPointerPosition=null;isAutoPanCanvasMoved=!1;reset(){for(let e of this.draggableItems)try{e.destroy?.()}catch{console.error(`Error while destroying drag handler of type ${e.type}`)}this.draggableItems=[],this.onPointerDownScale=1,this.onPointerDownPosition=new Y(0,0),this.autoPanFrameId=null,this.lastPointerEvent=null,this.lastPointerPosition=null,this.isAutoPanCanvasMoved=!1}markSelectionAsChanged(){this.isSelectedChanged=!0}rememberPointerEvent(e){this.lastPointerEvent=wv(e),this.lastPointerPosition=this.lastPointerEvent.getPosition()}isEmpty(){return!this.draggableItems.length}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),If=class{nodeIds;groupIds;connectionIds;get fNodeIds(){return this.nodeIds}get fGroupIds(){return this.groupIds}get fConnectionIds(){return this.connectionIds}constructor(i,e,n){this.nodeIds=i,this.groupIds=e,this.connectionIds=n}},Sv=(()=>{let t=class Yr{_mediator=d(R);_store=d(M);_dragSession=d(Q);handle(e){this._dragSession.isSelectedChanged&&(this._emitSelectionChange(this._getSelection()),this._dragSession.isSelectedChanged=!1,this._mediator.execute(new Bt))}_getSelection(){return this._mediator.execute(new eo)}_emitSelectionChange(e){this._store.fDraggable?.fSelectionChange.emit(new If(e.fNodeIds,e.fGroupIds,e.fConnectionIds))}static \u0275fac=function(n){return new(n||Yr)};static \u0275prov=y({token:Yr,factory:Yr.\u0275fac})};return t=C([x(ki)],t),t})(),Tf=class{nodeOrGroup;static fToken=Symbol("GetNormalizedParentNodeRectRequest");constructor(i){this.nodeOrGroup=i}},Iv=(()=>{let t=class Zr{_store=d(M);_mediator=d(R);handle({nodeOrGroup:e}){let n=H.initialize(-1/0,-1/0,1/0,1/0),o=this._getNode(e.fParentId());return o&&(n=this._getParentRect(o)),n}_getNode(e){return this._store.nodes.get(e)}_getParentRect(e){let n=this._getNodeRect(e),o=this._getNodePadding(e,n);return H.initialize(n.x+o[0],n.y+o[1],n.width-o[0]-o[2],n.height-o[1]-o[3])}_getNodeRect(e){return this._mediator.execute(new Ie(e.hostElement))}_getNodePadding(e,n){return this._mediator.execute(new hn(e,n))}static \u0275fac=function(n){return new(n||Zr)};static \u0275prov=y({token:Zr,factory:Zr.\u0275fac})};return t=C([x(Tf)],t),t})(),Pf=class{fParentNodes;fDraggedNodes;static fToken=Symbol("IsArrayHasParentNodeRequest");constructor(i,e){this.fParentNodes=i,this.fDraggedNodes=e}},Tv=(()=>{let t=class Qr{handle(e){return this._isParentNodeInArray(this._getParentNodeIds(e.fParentNodes),e.fDraggedNodes)}_getParentNodeIds(e){return e.map(n=>n.fId())}_isParentNodeInArray(e,n){return n.some(o=>e.includes(o.fId()))}static \u0275fac=function(n){return new(n||Qr)};static \u0275prov=y({token:Qr,factory:Qr.\u0275fac})};return t=C([x(Pf)],t),t})(),Ef=class{fNodeId;fConnectionIds;constructor(i,e){this.fNodeId=i,this.fConnectionIds=e}},Xc=class extends Ef{nodeId;connectionIds;constructor(i,e){super(i,e),this.nodeId=i,this.connectionIds=e}},qc=class{nodeOrGroup;static fToken=Symbol("DetectConnectionsUnderDragNodeRequest");constructor(i){this.nodeOrGroup=i}},Pv=(()=>{let t=class Jr{_mediator=d(R);_store=d(M);handle({nodeOrGroup:e}){let n=this._collectConnectableConnectorIds(e,"source"),o=this._collectConnectableConnectorIds(e,"target");if(!n.size||!o.size)return;let r=this._collectAttachedConnectionIds(n,o),a=this._collectConnectionsUnderNode(e),s=[];for(let l of a){let u=l.fId();r.has(u)||s.push(u)}s.length&&(this._store.fDraggable?.fNodeIntersectedWithConnections.emit(new Xc(e.fId(),s)),this._store.fDraggable?.fNodeConnectionsIntersection.emit(new Xc(e.fId(),s)))}_collectConnectableConnectorIds(e,n){let o=n==="source"?this._store.outputs.getAll():this._store.inputs.getAll(),r=new Set;for(let a of o)a.canBeConnected&&e.isContains(a.hostElement)&&r.add(a.fId());return r}_collectAttachedConnectionIds(e,n){let o=new Set;for(let r of this._store.connections.getAll())(e.has(r.fOutputId())||n.has(r.fInputId()))&&o.add(r.fId());return o}_collectConnectionsUnderNode(e){let n=this._mediator.execute(new Ht(e.hostElement,!1)),o=[];for(let r of this._store.connections.getAll())this._hasIntersection(r,n)&&o.push(r);return o}_hasIntersection(e,n){return An.getRoundedRectIntersectionsWithSVGPath(e.fPath().hostElement,n).length>0}static \u0275fac=function(n){return new(n||Jr)};static \u0275prov=y({token:Jr,factory:Jr.\u0275fac})};return t=C([x(qc)],t),t})(),Ev=[yv,gv,Sv,Iv,Tv,Pv],Dv=new Set(["create-connection","reassign-connection","drag-node"]),Mv=new Set(["selection-area"]),kv=new Set(["assign-to-container"]);function um(t){let i=null;for(let e of t){if(kv.has(e))continue;let n=Dv.has(e)?"rebase":Mv.has(e)?"direct":null;if(!n)return null;if(!i){i=n;continue}if(i!==n)return null}return i}function fm(t,i,e,n,o){return A.initialize(Th(t.x,i.left,i.right,e,n,o),Th(t.y,i.top,i.bottom,e,n,o))}function Th(t,i,e,n,o,r){let a=Math.max(0,n),s=Math.max(0,o);if(!a||!s)return 0;if(t<=i+a){let l=Eh((i+a-t)/a,0,1);return Ph(l,s,r)}if(t>=e-a){let l=Eh((t-(e-a))/a,0,1);return-Ph(l,s,r)}return 0}function Nv(t,i,e){let n=e||1;return Y.fromPoint(t).add(Y.fromPoint(i).div(n))}function Ph(t,i,e){return e?i*t:i}function Eh(t,i,e){return Math.max(i,Math.min(e,t))}var Yc=class{static fToken=Symbol("RunAutoPanFrameRequest")},Gt=class{static fToken=Symbol("StopAutoPanRequest")},Rv=(()=>{let t=class ea{_store=d(M);_dragContext=d(Q);handle(e){this._dragContext.autoPanFrameId!==null&&(cancelAnimationFrame(this._dragContext.autoPanFrameId),this._dragContext.autoPanFrameId=null),this._dragContext.isAutoPanCanvasMoved&&(this._store.fCanvas?.emitCanvasChangeEvent(),this._dragContext.isAutoPanCanvasMoved=!1)}static \u0275fac=function(n){return new(n||ea)};static \u0275prov=y({token:ea,factory:ea.\u0275fac})};return t=C([x(Gt)],t),t})(),Ni=class{static fToken=Symbol("SyncAutoPanRequest")},Ov=(()=>{let t=class ta{_mediator=d(R);_store=d(M);_dragContext=d(Q);handle(e){if(!this._canAutoPan()||!this._hasAutoPanDelta()){this._mediator.execute(new Gt);return}this._dragContext.autoPanFrameId===null&&(this._dragContext.autoPanFrameId=requestAnimationFrame(()=>{this._dragContext.autoPanFrameId=null,this._mediator.execute(new Yc)}))}_canAutoPan(){return!!this._store.fFlow&&!!this._store.fCanvas&&!!this._store.fDraggable?.isDragStarted&&!!this._autoPan()&&!!this._getAutoPanMode()&&this._edgeThreshold()>0&&this._speed()>0}_hasAutoPanDelta(){let e=this._getAutoPanDelta();return!!e.x||!!e.y}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?A.initialize():fm(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_getAutoPanMode(){return um(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_edgeThreshold(){return Math.max(0,this._autoPan()?.fEdgeThreshold()??0)}_speed(){return Math.max(0,this._autoPan()?.fSpeed()??0)}_acceleration(){return!!this._autoPan()?.fAcceleration()}_autoPan(){return this._store.instances.get(ye.AUTO_PAN)}static \u0275fac=function(n){return new(n||ta)};static \u0275prov=y({token:ta,factory:ta.\u0275fac})};return t=C([x(Ni)],t),t})(),Fv=(()=>{let t=class na{_mediator=d(R);_store=d(M);_dragContext=d(Q);handle(e){let n=this._getAutoPanMode();if(!this._canAutoPan(n)){this._mediator.execute(new Gt);return}let o=this._getAutoPanDelta();if(!o.x&&!o.y){this._mediator.execute(new Gt);return}this._applyCanvasDelta(o,n),this._replayLastPointerMove(),this._mediator.execute(new Ni)}_applyCanvasDelta(e,n){let o=this._store.transform;n==="rebase"&&(this._dragContext.onPointerDownPosition=Nv(this._dragContext.onPointerDownPosition,e,this._dragContext.onPointerDownScale||o.scale||1)),o.position=Y.fromPoint(o.position).add(e),this._store.fCanvas?.redraw(),this._dragContext.isAutoPanCanvasMoved=!0}_replayLastPointerMove(){let e=this._dragContext.lastPointerEvent;if(!e)return;let n=this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition);this._dragContext.draggableItems.forEach(o=>{o.onPointerMove(se({},n),e)})}_getPointerPositionInCanvas(e){return Y.fromPoint(e.getPosition()).elementTransform(this._store.flowHost)}_canAutoPan(e){return!!this._store.fFlow&&!!this._store.fCanvas&&!!this._store.fDraggable?.isDragStarted&&!!this._autoPan()&&!!e&&this._edgeThreshold()>0&&this._speed()>0}_getAutoPanMode(){return um(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?A.initialize():fm(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_edgeThreshold(){return Math.max(0,this._autoPan()?.fEdgeThreshold()??0)}_speed(){return Math.max(0,this._autoPan()?.fSpeed()??0)}_acceleration(){return!!this._autoPan()?.fAcceleration()}_autoPan(){return this._store.instances.get(ye.AUTO_PAN)}static \u0275fac=function(n){return new(n||na)};static \u0275prov=y({token:na,factory:na.\u0275fac})};return t=C([x(Yc)],t),t})(),Av=[Ov,Fv,Rv],Zc=class{event;static fToken=Symbol("DragCanvasFinalizeRequest");constructor(i){this.event=i}},Qc=class{kind;data;fEventType;get fData(){return this.data}constructor(i,e,n){this.kind=i,this.data=e,this.fEventType=n??i}},qe=class{data(){}_features=[];getEvent(){return new Qc(this.kind,this.data(),this.type)}attachFeature(i){this._features.push(i)}featuresPrepare(i){for(let e of this._features)e.onPrepare?.(i)}featuresMove(i,e){for(let n of this._features)n.onMove?.(i,e)}featuresFinalize(i,e){for(let n of this._features)n.onFinalize?.(i,e)}featuresEnd(i){for(let e of this._features)e.onEnd?.(i)}},Jc=class{_isConnected=!1;get isConnected(){return this._isConnected}toConnector=[];isSelfConnectable=!0;fConnectableSide=L.AUTO;userFConnectableSide=L.AUTO;isContains(i){return this.hostElement.contains(i)}setConnected(i){this._isConnected=!0,this.toConnector.push(i)}resetConnected(){this._isConnected=!1,this.toConnector=[]}},Lv=new pe("F_NODE_INPUT"),Bv=(()=>{class t extends Jc{kind="input";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,standalone:!1,features:[_e]})}return t})(),yt=(function(t){return t.LEFT="left",t.LEFT_TOP="left-top",t.TOP="top",t.RIGHT_TOP="right-top",t.RIGHT="right",t.RIGHT_BOTTOM="right-bottom",t.BOTTOM="bottom",t.LEFT_BOTTOM="left-bottom",t})(yt||{});function zv(t){return _i(t,".f-rotate-handle")}var pm=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,selectors:[["","fDragHandle",""]],hostAttrs:[1,"f-drag-handle","f-component"],standalone:!1})}return t})(),zl=new pe("F_NODE"),Vv=om(class{hostElement;constructor(t){this.hostElement=t}}),ed=class extends Vv{_injector=d(Je);renderer=d(Bp);browser=d(ke);stateChanges=new ct;_position=A.initialize();_rotate=0;_size;connectors=[];positionChanges(){ae(()=>{let i=this.position();gt(()=>{A.isEqual(this._position,i)||(this._position=i,this.redraw(),this.refresh())})},{injector:this._injector})}sizeChanges(){ae(()=>{let i=this.size();gt(()=>{this._isSizeEqual(i)||(this._size=i,this.redraw(),this.refresh())})},{injector:this._injector})}rotateChanges(){ae(()=>{let i=this.rotate();gt(()=>{this._rotate!==i&&(this._rotate=i,this.redraw(),this.refresh())})},{injector:this._injector})}parentChanges(){ae(()=>{this.fParentId(),this.fIncludePadding(),this.fAutoSizeToFitChildren(),gt(()=>this.refresh())},{injector:this._injector})}_isSizeEqual(i){return this._size?.width===i?.width&&this._size?.height===i?.height}isContains(i){return this.hostElement.contains(i)}redraw(){this._size&&(this.setStyle("width",""+this._size.width+"px"),this.setStyle("height",""+this._size.height+"px")),this.setStyle("transform",`translate(${this._position.x}px,${this._position.y}px) rotate(${this._rotate}deg)`)}resetSize(){this.removeStyle("width"),this.removeStyle("height")}updatePosition(i){this._position=i}updateRotate(i){this._rotate=i}updateSize(i){this._size=i}setClass(i){this.hostElement.classList.add(i)}removeClass(i){this.hostElement.classList.remove(i)}addConnector(i){this.connectors.push(i),this.refresh()}removeConnector(i){let e=this.connectors.indexOf(i);e!==-1&&this.connectors.splice(e,1),this.refresh()}},Hv=0,Gv=3,Df=(()=>{class t extends ed{_debounceTimer=null;_destroyRef=d(We);_mediator=d(R);fId=F(`f-group-${Hv++}`,{alias:"fGroupId"});fParentId=F(null,{alias:"fGroupParentId"});position=nn(A.initialize(),{alias:"fGroupPosition"});size=F(void 0,{alias:"fGroupSize"});sizeChange=Ee({alias:"fGroupSizeChange"});rotate=nn(0,{alias:"fGroupRotate"});fConnectOnNode=F(!0,{transform:xe});fMinimapClass=F([]);fDraggingDisabled=F(!1,{alias:"fGroupDraggingDisabled",transform:xe});fSelectionDisabled=F(!1,{alias:"fGroupSelectionDisabled",transform:xe});fIncludePadding=F(!0,{transform:xe});fAutoExpandOnChildHit=F(!1,{transform:xe});fAutoSizeToFitChildren=F(!1,{transform:xe});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Ki(this))}setStyle(e,n){this.renderer.setStyle(this.hostElement,e,n)}removeStyle(e){this.renderer.removeStyle(this.hostElement,e)}redraw(){super.redraw(),this._mediator.execute(new Bt),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),Gv))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new qn(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new qi(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new Yi(this))}static \u0275fac=function(n){return new(n||t)(Pu(we))};static \u0275dir=Ce({type:t,selectors:[["","fGroup",""]],hostAttrs:[1,"f-group","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(X("data-f-group-id",o.fId()),re("f-group-dragging-disabled",o.fDraggingDisabled())("f-group-selection-disabled",o.fSelectionDisabled()))},inputs:{fId:[1,"fGroupId","fId"],fParentId:[1,"fGroupParentId","fParentId"],position:[1,"fGroupPosition","position"],size:[1,"fGroupSize","size"],rotate:[1,"fGroupRotate","rotate"],fConnectOnNode:[1,"fConnectOnNode"],fMinimapClass:[1,"fMinimapClass"],fDraggingDisabled:[1,"fGroupDraggingDisabled","fDraggingDisabled"],fSelectionDisabled:[1,"fGroupSelectionDisabled","fSelectionDisabled"],fIncludePadding:[1,"fIncludePadding"],fAutoExpandOnChildHit:[1,"fAutoExpandOnChildHit"],fAutoSizeToFitChildren:[1,"fAutoSizeToFitChildren"]},outputs:{position:"fGroupPositionChange",sizeChange:"fGroupSizeChange",rotate:"fGroupRotateChange"},exportAs:["fComponent"],standalone:!1,features:[ge([{provide:zl,useExisting:t}]),_e]})}return t})(),Dh=0,jv=3,Vl=(()=>{class t extends ed{_debounceTimer=null;_destroyRef=d(We);_mediator=d(R);fId=F(`f-node-${Dh++}`,{alias:"fNodeId",transform:e=>Kn(e)||`f-node-${Dh++}`});fParentId=F(null,{alias:"fNodeParentId"});position=nn(A.initialize(),{alias:"fNodePosition"});size=F(void 0,{alias:"fNodeSize"});sizeChange=Ee({alias:"fNodeSizeChange"});rotate=nn(0,{alias:"fNodeRotate"});fConnectOnNode=F(!0,{transform:xe});fMinimapClass=F([]);fDraggingDisabled=F(!1,{alias:"fNodeDraggingDisabled",transform:xe});fSelectionDisabled=F(!1,{alias:"fNodeSelectionDisabled",transform:xe});fIncludePadding=F(!0,{transform:xe});fAutoExpandOnChildHit=F(!1,{transform:xe});fAutoSizeToFitChildren=F(!1,{transform:xe});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Ki(this))}setStyle(e,n){this.renderer.setStyle(this.hostElement,e,n)}removeStyle(e){this.renderer.removeStyle(this.hostElement,e)}redraw(){super.redraw(),this._mediator.execute(new Bt),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),jv))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new qn(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new qi(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new Yi(this))}static \u0275fac=function(n){return new(n||t)(Pu(we))};static \u0275dir=Ce({type:t,selectors:[["","fNode",""]],hostAttrs:[1,"f-node","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(X("data-f-node-id",o.fId()),re("f-node-dragging-disabled",o.fDraggingDisabled())("f-node-selection-disabled",o.fSelectionDisabled()))},inputs:{fId:[1,"fNodeId","fId"],fParentId:[1,"fNodeParentId","fParentId"],position:[1,"fNodePosition","position"],size:[1,"fNodeSize","size"],rotate:[1,"fNodeRotate","rotate"],fConnectOnNode:[1,"fConnectOnNode"],fMinimapClass:[1,"fMinimapClass"],fDraggingDisabled:[1,"fNodeDraggingDisabled","fDraggingDisabled"],fSelectionDisabled:[1,"fNodeSelectionDisabled","fSelectionDisabled"],fIncludePadding:[1,"fIncludePadding"],fAutoExpandOnChildHit:[1,"fAutoExpandOnChildHit"],fAutoSizeToFitChildren:[1,"fAutoSizeToFitChildren"]},outputs:{position:"fNodePositionChange",sizeChange:"fNodeSizeChange",rotate:"fNodeRotateChange"},exportAs:["fComponent"],standalone:!1,features:[ge([{provide:zl,useExisting:t}]),_e]})}return t})();function Uv(t){return!!t.closest("[fNode]")}var Mh=0,hm=(()=>{class t extends Bv{hostElement=d(we).nativeElement;_mediator=d(R);_node=d(zl);fId=F(`f-node-input-${Mh++}`,{alias:"fInputId",transform:e=>Kn(e)||`f-node-input-${Mh++}`});category=F(void 0,{alias:"fInputCategory",transform:Kn});multiple=F(!0,{alias:"fInputMultiple",transform:xe});disabled=F(!1,{alias:"fInputDisabled",transform:xe});userFConnectableSide=L.AUTO;get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Ui(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(Oe.CONNECTOR.INPUT_CONNECTED,!0),this.hostElement.classList.toggle(Oe.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(Oe.CONNECTOR.INPUT_CONNECTED,!1),this.hostElement.classList.toggle(Oe.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new Zi(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,selectors:[["","fNodeInput",""]],hostAttrs:[1,"f-component","f-node-input"],hostVars:5,hostBindings:function(n,o){n&2&&(X("data-f-input-id",o.fId()),re("f-node-input-multiple",o.multiple)("f-node-input-disabled",o.disabled()))},inputs:{fId:[1,"fInputId","fId"],category:[1,"fInputCategory","category"],multiple:[1,"fInputMultiple","multiple"],disabled:[1,"fInputDisabled","disabled"],userFConnectableSide:[2,"fInputConnectableSide","userFConnectableSide",e=>Ln(e,"fInputConnectableSide",L)]},exportAs:["fNodeInput"],standalone:!1,features:[ge([{provide:Lv,useExisting:t}]),_e,xn]})}return t})(),Wv=(()=>{class t extends Jc{get hasConnectionLimits(){return!!this.canBeConnectedInputs&&this.canBeConnectedInputs.length>0}canConnectTo(e){return[e.fId(),e.category()].some(o=>o&&this.canBeConnectedInputs?.includes(o))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,standalone:!1,features:[_e]})}return t})();function mm(t){return!!t.closest("[fNodeOutlet]")}var $v=new pe("F_NODE_OUTPUT"),Kv=(()=>{class t extends Wv{kind="output";get canBeConnected(){return!this.disabled()&&(this.multiple()?!0:!this.isConnected)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,standalone:!1,features:[_e]})}return t})();function _m(t){return!!t.closest("[fNodeOutput]")}var kh=0,gm=(()=>{class t extends Kv{hostElement=d(we).nativeElement;_mediator=d(R);_node=d(zl);fId=F(`f-node-output-${kh++}`,{alias:"fOutputId",transform:e=>Kn(e)||`f-node-output-${kh++}`});multiple=F(!1,{alias:"fOutputMultiple",transform:xe});disabled=F(!1,{alias:"fOutputDisabled",transform:xe});userFConnectableSide=L.AUTO;isSelfConnectable=!0;canBeConnectedInputs=[];get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Ui(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(Oe.CONNECTOR.OUTPUT_CONNECTED,!0),this.hostElement.classList.toggle(Oe.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(Oe.CONNECTOR.OUTPUT_CONNECTED,!1),this.hostElement.classList.toggle(Oe.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new Zi(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,selectors:[["","fNodeOutput",""]],hostAttrs:[1,"f-component","f-node-output"],hostVars:7,hostBindings:function(n,o){n&2&&(X("data-f-output-id",o.fId()),re("f-node-output-multiple",o.multiple)("f-node-output-disabled",o.disabled())("f-node-output-self-connectable",o.isSelfConnectable))},inputs:{fId:[1,"fOutputId","fId"],multiple:[1,"fOutputMultiple","multiple"],disabled:[1,"fOutputDisabled","disabled"],userFConnectableSide:[2,"fOutputConnectableSide","userFConnectableSide",e=>Ln(e,"fOutputConnectableSide",L)],isSelfConnectable:"isSelfConnectable",canBeConnectedInputs:[0,"fCanBeConnectedInputs","canBeConnectedInputs"]},exportAs:["fNodeOutput"],standalone:!1,features:[ge([{provide:$v,useExisting:t}]),_e,xn]})}return t})();var td=class{event;static fToken=Symbol("CreateConnectionFinalizeRequest");constructor(i){this.event=i}},Ri=class{outlet;static fToken=Symbol("ResolveConnectableOutputForOutletRequest");constructor(i){this.outlet=i}},Xv=(()=>{let t=class ia{_store=d(M);handle({outlet:e}){let n=this._findOwnerNode(e);if(!n)throw new Error("The fOutlet must belong to an fNode");let o=this._findFirstConnectableOutputInNode(n);if(!o)throw new Error("Outlet requires at least one connectable output in the same node.");return o}_findOwnerNode(e){let n=e.hostElement;return this._store.nodes.getAll().find(o=>o.isContains(n))}_findFirstConnectableOutputInNode(e){return this._store.outputs.getAll().find(n=>e.isContains(n.hostElement)&&n.canBeConnected)}static \u0275fac=function(n){return new(n||ia)};static \u0275prov=y({token:ia,factory:ia.\u0275fac})};return t=C([x(Ri)],t),t})(),Mf=class{sourceId;targetId;dropPosition;fOutputId;fInputId;fDropPosition;constructor(i,e,n){this.sourceId=i,this.targetId=e,this.dropPosition=n,this.fOutputId=i,this.fInputId=e,this.fDropPosition=n}},nd=(()=>{class t extends qe{type="create-connection";kind="create-connection";data(){return{fOutputOrOutletId:this._sourceRef.connector.fId()}}_result=d(Ut);_mediator=d(R);_connectionBehaviour=d(ni);_store=d(M);get _connection(){return this._store.connections.getForCreate()}get _snapConnection(){return this._store.connections.getForSnap()}_targets=[];_sourceRef;_pointerDown=new De;initialize(e,n){this._sourceRef=this._mediator.execute(new at(e)),this._pointerDown=De.fromRect(H.initialize(n.x,n.y))}prepareDragSequence(){this._collectAndMarkTargets(),this._initSnapConnection(),this._initCreateConnection(),this._connection.show(),this.onPointerMove(A.initialize()),this._result.setData({toConnectorRect:this._pointerDown,canBeConnectedInputs:this._targets,fOutputId:this._sourceRef.connector.fId()})}_collectAndMarkTargets(){this._targets=this._mediator.execute(new $i(this._sourceRef.connector,this._sourceRef.rect.gravityCenter)),this._mediator.execute(new Qn(this._targets.map(e=>e.connector)))}_initSnapConnection(){this._snapConnection&&(this._snapConnection.fOutputId.set(this._sourceRef.connector.fId()),this._snapConnection.initialize())}_initCreateConnection(){this._connection.fOutputId.set(this._sourceRef.connector.fId()),this._connection.initialize()}onPointerMove(e){let n=this._pointerDown.addPoint(e),o=this._findClosestTarget(n),r=o?.connector.fConnectableSide||L.TOP;this._drawCreateConnection(n,r);let a=this._snapConnection;if(!a)return;let s=o&&o.distance<a.fSnapThreshold?o:void 0;this._drawSnapConnection(s)}_findClosestTarget(e){return this._mediator.execute(new pn(e,this._targets))}_drawCreateConnection(e,n){let o=this._connectionBehaviour.handle(new ht(this._sourceRef.rect,e,this._connection,this._sourceRef.connector.fConnectableSide,n,this._resolveRotationContext(this._sourceRef.connector)));this._connection.setLine(o),this._connection.redraw()}_drawSnapConnection(e){let n=this._snapConnection;if(!n)return;if(!e){n.hide();return}let o=this._connectionBehaviour.handle(new ht(this._sourceRef.rect,e.rect,n,this._sourceRef.connector.fConnectableSide,e.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(e.connector)));n.show(),n.setLine(o),n.redraw()}onPointerUp(){this._connection.redraw(),this._connection.hide(),this._snapConnection?.hide(),this._mediator.execute(new Jn(this._targets.map(e=>e.connector)))}_resolveRotationContext(e){return this._mediator.execute(new Et(e))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),qv=(()=>{let t=class oa{_result=d(Ut);_mediator=d(R);_store=d(M);_dragContext=d(Q);get _dragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isValid()&&(this._emitEvent(e.event),this._dragHandler.onPointerUp())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof nd)}_getTargetOutput(e){if(!e)throw new Error(`Output with fOutputId ${this._result.getData().fOutputId} not found. Make sure there is no f-connection to a non-existent fOutput.`);return mm(e.hostElement)?this._mediator.execute(new Ri(e)):e}_getOutput(){return this._store.outputs.get(this._result.getData().fOutputId)}_getOutlet(){return this._store.outlets.get(this._result.getData().fOutputId)}_emitEvent(e){this._store.fDraggable?.fCreateConnection.emit(new Mf(this._getTargetOutput(this._getOutput()||this._getOutlet()).fId(),this._getInputUnderPointer(e)?.fId(),e.getPosition()))}_getInputUnderPointer(e){return this._mediator.execute(new Wi(e.getPosition(),this._result.getData().canBeConnectedInputs))}static \u0275fac=function(n){return new(n||oa)};static \u0275prov=y({token:oa,factory:oa.\u0275fac})};return t=C([x(td)],t),t})(),Oi=class{eventPosition;source;static fToken=Symbol("CreateConnectionCreateDragHandlerRequest");constructor(i,e){this.eventPosition=i,this.source=e}},Yv=(()=>{let t=class ra{_store=d(M);_dragContext=d(Q);_dragInjector=d(je);get _transform(){return this._store.transform}handle({source:e,eventPosition:n}){this._dragContext.onPointerDownScale=this._transform.scale;let o=this._toFlowSpace(n);this._dragContext.onPointerDownPosition=o;let r=this._toCanvasSpace(o),a=this._dragInjector.get(nd);a.initialize(e,r),this._dragContext.draggableItems=[a]}_toFlowSpace(e){return Y.fromPoint(e).elementTransform(this._store.flowHost).div(this._transform.scale)}_toCanvasSpace(e){return Y.fromPoint(e).mult(this._transform.scale).sub(this._transform.position).sub(this._transform.scaledPosition).div(this._transform.scale)}static \u0275fac=function(n){return new(n||ra)};static \u0275prov=y({token:ra,factory:ra.\u0275fac})};return t=C([x(Oi)],t),t})(),id=class{event;node;static fToken=Symbol("CreateConnectionFromOutletPreparationRequest");constructor(i,e){this.event=i,this.node=e}},Zv=(()=>{let t=class aa{_mediator=d(R);_store=d(M);handle({event:e,node:n}){let o=this._findOutlet(n);if(!o||(o.setOutputs(this._getOutputs(n)),!o.canBeConnected))return;let r=o.isConnectionFromOutlet?o:this._resolveOutput(o);!r||!r.canBeConnected||this._startDrag(e.getPosition(),r)}_findOutlet(e){return this._store.outlets.getAll().find(n=>e.isContains(n.hostElement))}_getOutputs(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement))}_resolveOutput(e){return this._mediator.execute(new Ri(e))}_startDrag(e,n){this._mediator.execute(new Oi(e,n))}static \u0275fac=function(n){return new(n||aa)};static \u0275prov=y({token:aa,factory:aa.\u0275fac})};return t=C([x(id)],t),t})(),od=class{event;node;static fToken=Symbol("CreateConnectionFromOutputPreparationRequest");constructor(i,e){this.event=i,this.node=e}},Qv=(()=>{let t=class sa{_mediator=d(R);_store=d(M);handle({event:e,node:n}){if(!_m(e.targetElement)||this._hasOutlet(n))return;let o=this._findOutput(e.targetElement);!o||!o.canBeConnected||this._startDrag(e.getPosition(),o)}_hasOutlet(e){return this._store.outlets.getAll().some(n=>e.isContains(n.hostElement))}_findOutput(e){return this._store.outputs.getAll().find(n=>n.hostElement.contains(e))}_startDrag(e,n){this._mediator.execute(new Oi(e,n))}static \u0275fac=function(n){return new(n||sa)};static \u0275prov=y({token:sa,factory:sa.\u0275fac})};return t=C([x(od)],t),t})(),rd=class{event;fTrigger;static fToken=Symbol("CreateConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Jv=(()=>{let t=class ca{_mediator=d(R);_store=d(M);_dragContext=d(Q);handle({event:e,fTrigger:n}){if(!this._isValidConditions()||!this._isValidTrigger(e,n))return;let o=mm(e.targetElement),r=!o&&_m(e.targetElement);if(!o&&!r)return;let a=this._findOwnerNode(e.targetElement);a&&(o?this._mediator.execute(new id(e,a)):this._mediator.execute(new od(e,a)))}_findOwnerNode(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_isValidConditions(){return this._dragContext.isEmpty()&&!!this._store.connections.getForCreate()}_isValidTrigger(e,n){return dt(e.originalEvent,n)}static \u0275fac=function(n){return new(n||ca)};static \u0275prov=y({token:ca,factory:ca.\u0275fac})};return t=C([x(rd)],t),t})(),ad=class{event;static fToken=Symbol("ReassignConnectionFinalizeRequest");constructor(i){this.event=i}},kf=class{connectionId;endpoint;previousSourceId;nextSourceId;previousTargetId;nextTargetId;dropPosition;isSourceReassign;isTargetReassign;oldSourceId;newSourceId;oldTargetId;newTargetId;dropPoint;constructor(i,e,n,o,r,a,s){this.connectionId=i,this.endpoint=e,this.previousSourceId=n,this.nextSourceId=o,this.previousTargetId=r,this.nextTargetId=a,this.dropPosition=s,this.isSourceReassign=e==="source",this.isTargetReassign=e==="target",this.oldSourceId=n,this.newSourceId=o,this.oldTargetId=r,this.newTargetId=a,this.dropPoint=s}},eC=(()=>{let t=class da{_dragResult=d(Ut);_mediator=d(R);_store=d(M);_dragContext=d(Q);get _dragDirective(){return this._store.fDraggable}handle({event:e}){let n=this._findReassignHandler();n&&(this._emitIfChanged(e),n.onPointerUp())}_findReassignHandler(){return this._dragContext.draggableItems.find(n=>n.getEvent().fEventType==="reassign-connection")}_emitIfChanged(e){let n=this._dragResult.getData(),o=this._findConnectableConnector(e,n.candidates);o&&!this._isReassignedToDifferentConnector(n,o)||this._dragDirective.fReassignConnection.emit(this._buildEvent(n,e,o))}_findConnectableConnector(e,n){return this._mediator.execute(new Wi(e.getPosition(),n))}_isReassignedToDifferentConnector(e,n){let o=e.connection;return e.draggedEnd==="target"?o.fInputId()!==n.fId():o.fOutputId()!==n.fId()}_buildEvent(e,n,o){let r=e.connection;return new kf(r.fId(),e.draggedEnd,r.fOutputId(),e.draggedEnd==="source"?o?.fId():void 0,r.fInputId(),e.draggedEnd==="target"?o?.fId():void 0,n.getPosition())}static \u0275fac=function(n){return new(n||da)};static \u0275prov=y({token:da,factory:da.\u0275fac})};return t=C([x(ad)],t),t})(),sd=class{event;fTrigger;static fToken=Symbol("ReassignConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function tC(t,i){return ym(t,i)||nC(t,i)}function ym(t,i){return t.fDragHandleEnd()?.point&&vm(i,t.fDragHandleEnd().point)&&!t.fDraggingDisabled()}function nC(t,i){return!!t.fDragHandleStart()?.point&&vm(i,t.fDragHandleStart().point)&&!t.fDraggingDisabled()&&t.fReassignableStart()}function vm(t,i){return(t.x-i.x)**2+(t.y-i.y)**2<=8**2}function Cm(t,i){return t&&t.distance<i.fSnapThreshold?t:void 0}function cd(t){return De.fromRect(H.initialize(t.x,t.y))}var Nf=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(i,e,n,o,r){this._mediator=i,this._behaviour=e,this._connection=n,this._sourceRef=o,this._targetRef=r,this._anchorRect=cd(this._connection.line.point1)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new ul(this._target,this._targetRef.rect.gravityCenter)),this._candidates.some(i=>i.connector.fId()===this._source.fId())||this._candidates.push(this._sourceRef),this._mediator.execute(new Qn(this._candidates.map(i=>i.connector)))}setSnapConnection(i){this._snap=i,i&&(i.fInputId.set(this._connection.fInputId()),i.initialize())}onPointerMove(i){let e=this._anchorRect.addPoint(i),n=this._findClosest(e.gravityCenter),o=n?.connector.fConnectableSide??this._source.fConnectableSide;this._draw(e,o);let r=this._snap;r&&this._drawSnap(Cm(n,r))}_findClosest(i){return this._mediator.execute(new pn(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new ht(i,this._targetRef.rect,this._connection,e,this._targetRef.connector.fConnectableSide,void 0,this._resolveRotationContext(this._targetRef.connector)));this._connection.setLine(n),this._connection.redraw()}_drawSnap(i){let e=this._snap;if(!e)return;if(!i){e.hide();return}let n=this._behaviour.handle(new ht(i.rect,this._targetRef.rect,e,i.connector.fConnectableSide,this._target.fConnectableSide,this._resolveRotationContext(i.connector),this._resolveRotationContext(this._targetRef.connector)));e.show(),e.setLine(n),e.redraw()}onPointerUp(){this._draw(this._anchorRect,this._sourceRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Jn(this._candidates.map(i=>i.connector)))}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},Rf=class{_mediator;_behaviour;_connection;_sourceRef;_targetRef;_candidates=[];_snap;_anchorRect;get _source(){return this._sourceRef.connector}get _target(){return this._targetRef.connector}constructor(i,e,n,o,r){this._mediator=i,this._behaviour=e,this._connection=n,this._sourceRef=o,this._targetRef=r,this._anchorRect=cd(this._connection.line.point2)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new $i(this._source,this._sourceRef.rect.gravityCenter));let i=this._connection.fInputId();i&&!this._candidates.some(e=>e.connector.fId()===i)&&this._candidates.push(this._targetRef),this._mediator.execute(new Qn(this._candidates.map(e=>e.connector)))}setSnapConnection(i){this._snap=i,i&&(i.fOutputId.set(this._connection.fOutputId()),i.initialize())}onPointerMove(i){let e=this._anchorRect.addPoint(i),n=this._findClosest(e.gravityCenter),o=n?.connector.fConnectableSide??this._target.fConnectableSide;this._draw(e,o);let r=this._snap;r&&this._drawSnap(Cm(n,r))}onPointerUp(){this._draw(this._anchorRect,this._targetRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new Jn(this._candidates.map(i=>i.connector)))}_findClosest(i){return this._mediator.execute(new pn(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new ht(this._sourceRef.rect,i,this._connection,this._source.fConnectableSide,e,this._resolveRotationContext(this._sourceRef.connector),void 0));this._connection.setLine(n),this._connection.redraw()}_drawSnap(i){let e=this._snap;if(!e)return;if(!i){e.hide();return}let n=this._behaviour.handle(new ht(this._sourceRef.rect,i.rect,e,this._source.fConnectableSide,i.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(i.connector)));e.show(),e.setLine(n),e.redraw()}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},Of=(()=>{class t extends qe{type="reassign-connection";kind="reassign-connection";data(){return{fConnectionId:this._connection.fId()}}_result=d(Ut);_mediator=d(R);_connectionBehaviour=d(ni);_store=d(M);get _snapConnection(){return this._store.connections.getForSnap()}_connection;_draggedEnd;_sourceRef;_targetRef;_reassignHandler;initialize(e,n){this._connection=e,this._draggedEnd=n?"target":"source",this._sourceRef=this._mediator.execute(new at(this._store.outputs.require(this._connection.fOutputId()))),this._targetRef=this._mediator.execute(new at(this._store.inputs.require(this._connection.fInputId()))),this._reassignHandler=this._draggedEnd==="target"?this._createTargetHandler():this._createSourceHandler()}_createSourceHandler(){return new Nf(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}_createTargetHandler(){return new Rf(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}prepareDragSequence(){this._reassignHandler.collectAndMarkCandidates(),this._reassignHandler.setSnapConnection(this._snapConnection),this._result.setData({draggedEnd:this._draggedEnd,sourceAnchorRect:cd(this._connection.line.point1),targetAnchorRect:cd(this._connection.line.point2),candidates:this._reassignHandler.candidates(),connection:this._connection})}onPointerMove(e){this._reassignHandler.onPointerMove(e)}onPointerUp(){this._reassignHandler.onPointerUp()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),iC=(()=>{let t=class la{_mediator=d(R);_store=d(M);_dragContext=d(Q);_dragInjector=d(je);get _canvas(){return this._store.fCanvas}get _transform(){return this._store.transform}get _connections(){return this._store.connections.getAll()}handle(e){if(!this._dragContext.isEmpty()||!this._isValidTrigger(e))return;let n=ii(e.event.getPosition(),this._store.flowHost,this._transform),o=this._findConnectionAt(n);o&&(this._capturePointerDown(e),this._startDrag(o,n),queueMicrotask(()=>this._bringToFront(o)))}_findConnectionAt(e){return this._connections.find(n=>tC(n,e))}_capturePointerDown(e){this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=Y.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(this._transform.scale)}_startDrag(e,n){let o=this._dragInjector.get(Of);o.initialize(e,ym(e,n)),this._dragContext.draggableItems=[o]}_isValidTrigger(e){return dt(e.event.originalEvent,e.fTrigger)}_bringToFront(e){this._mediator.execute(new mn(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||la)};static \u0275prov=y({token:la,factory:la.\u0275fac})};return t=C([x(sd)],t),t})(),dd=class{event;static fToken=Symbol("DragConnectionWaypointFinalizeRequest");constructor(i){this.event=i}},ld=class{connectionId;waypoints;constructor(i,e){this.connectionId=i,this.waypoints=e}},ud=(()=>{class t extends qe{type="move-connection-waypoint";kind="drag-connection-waypoint";_store=d(M);_point;_pick;get _waypointsComponent(){return this._pick?.connection.fWaypoints()}get _connection(){return this._pick?.connection}setPick(e){this._pick=e}prepareDragSequence(){this._pick?.candidate?(this._point=se({},this._pick.candidate),this._waypointsComponent.insert(this._pick.candidate)):this._pick?.waypoint&&(this._point=se({},this._pick.waypoint),this._waypointsComponent.select(this._pick.waypoint)),this._redrawConnection()}onPointerMove(e){this._waypointsComponent.move(A.sum(this._point,e)),this._redrawConnection()}onPointerUp(){this._waypointsComponent.update(),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._eventFromPick())}_redrawConnection(){this._connection.setLine(this._connection.line),this._connection.redraw()}_eventFromPick(){return new ld(this._connection.fId(),this._connection.fWaypoints()?.waypoints()||[])}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),oC=(()=>{let t=class ua{_dragContext=d(Q);get _fDragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isDroppedConnectionReassignEvent()&&this._fDragHandler.onPointerUp()}_isDroppedConnectionReassignEvent(){return this._dragContext.draggableItems.some(e=>e instanceof ud)}static \u0275fac=function(n){return new(n||ua)};static \u0275prov=y({token:ua,factory:ua.\u0275fac})};return t=C([x(dd)],t),t})(),fd=class{event;fTrigger;static fToken=Symbol("DragConnectionWaypointPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},rC=(()=>{let t=class fa{_mediator=d(R);_store=d(M);_dragContext=d(Q);_dragInjector=d(je);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _flowHost(){return this._store.flowHost}get _connections(){return this._store.connections.getAll()}handle(e){let n=ii(e.event.getPosition(),this._flowHost,this._transform),o=this._pickControlPoint(n);if(!o||!this._isValidTrigger(e))return;let r=this._dragInjector.get(ud);r.setPick(o),this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=Y.fromPoint(e.event.getPosition()).elementTransform(this._flowHost).div(this._transform.scale),this._dragContext.draggableItems=[r],queueMicrotask(()=>this._updateConnectionLayer(o.connection))}_pickControlPoint(e){if(this._dragContext.isEmpty())return N0(this._connections,e)}_isValidTrigger(e){return dt(e.event.originalEvent,e.fTrigger)}_updateConnectionLayer(e){this._mediator.execute(new mn(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||fa)};static \u0275prov=y({token:fa,factory:fa.\u0275fac})};return t=C([x(fd)],t),t})(),aC=[qv,Yv,Zv,Xv,Qv,Jv,eC,iC,rC,oC],pd=class{event;static fToken=Symbol("DropToGroupFinalizeRequest");constructor(i){this.event=i}},sC=1,Fi=(()=>{class t extends qe{type="move-node-to-parent";kind="assign-to-container";_store=d(M);_dragSession=d(Q);get _transform(){return this._store.transform}_candidateGroups=[];_debounceTimer=null;_activeTarget=null;get activeTarget(){return this._activeTarget}initialize(e){this._candidateGroups=e}prepareDragSequence(){for(let{node:e}of this._candidateGroups)e.hostElement.classList.add(Oe.GROUPING.DROP_ACTIVE)}onPointerMove(e){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateActiveTarget(e),sC)}onPointerUp(){this._clearActiveTarget();for(let{node:e}of this._candidateGroups)e.hostElement.classList.remove(Oe.GROUPING.DROP_ACTIVE);this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}_updateActiveTarget(e){let n=this._getPointerInFlow(e),o=this._findTargetUnderPointer(n);o?this._setActiveTarget(o):this._clearActiveTarget()}_getPointerInFlow(e){let n=Y.fromPoint(this._dragSession.onPointerDownPosition).add(e),o=Y.fromPoint(this._transform.position).add(this._transform.scaledPosition).div(this._transform.scale);return n.sub(o)}_findTargetUnderPointer(e){return this._candidateGroups.find(n=>H.isIncludePoint(n.rect,e))}_setActiveTarget(e){this._activeTarget?.node!==e.node&&(this._clearActiveTarget(),this._activeTarget=e,e.node.setClass(Oe.GROUPING.OVER_BOUNDARY))}_clearActiveTarget(){this._activeTarget?.node.removeClass(Oe.GROUPING.OVER_BOUNDARY),this._activeTarget=null}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),hd=class{nodesAndGroups;static fToken=Symbol("CreateDragNodeHierarchyRequest");constructor(i){this.nodesAndGroups=i}},Ff=class{rootHandlers;participants;constructor(i,e){this.rootHandlers=i,this.participants=e}},Af=class{fNodeIds;constructor(i){this.fNodeIds=i}},cp="move-node",dp="drag-node";function cC(t){return t.getEvent().kind===dp||t.getEvent().fEventType===cp}var jt=(()=>{class t extends qe{type=cp;kind=dp;data(){return new Af(this.items.map(e=>e.nodeOrGroup.fId()))}_magneticLines=null;_magneticRects=null;items;roots;initialize(e,n){this.items=e,this.roots=n}setMagneticLines(e){this._magneticLines=e}setMagneticRects(e){this._magneticRects=e}calculateMagneticLinesGuides(e){return this.calculateMagneticSnaps(e).lines}calculateMagneticSnaps(e){this._previewRoots(e);let n=this._rootsUnionRect();return{lines:this._magneticLines?._computeGuides(n),rects:this._magneticRects?._computeRects(n)}}prepareDragSequence(){for(let e of this.roots)e.prepareDragSequence()}onPointerMove(e){this._previewRoots(e);let n=this._rootsUnionRect();this._magneticLines?.scheduleRender(n),this._magneticRects?.scheduleRender(n)}onPointerUp(){for(let e of this.roots)e.onPointerUp();this._magneticLines?.clearGuides(),this._magneticRects?.clearGuides(),requestAnimationFrame(()=>this._refreshDraggedNodes())}_previewRoots(e){for(let n of this.roots)n.onPointerMove(e)}_rootsUnionRect(){let e=null;for(let n of this.roots){let o=n.getLastRect();e=e?H.union([e,o]):o}return e??H.initialize()}_refreshDraggedNodes(){for(let{nodeOrGroup:e}of this.roots)e.refresh()}destroy(){for(let e of this.roots??[])e.destroy?.()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),md=class{_limits;_quantizeStep;constructor(i,e=.5){this._limits=i,this._quantizeStep=e}applyInto(i,e){let{min:n,max:o}=this._limits,r=this._clamp(i.x,n.x,o.x),a=this._clamp(i.y,n.y,o.y),s=i.x-r,l=i.y-a,u=this._quantizeSigned(s,this._quantizeStep),h=this._quantizeSigned(l,this._quantizeStep);e.value.x=r,e.value.y=a,e.edges.left=u<0,e.edges.right=u>0,e.edges.top=h<0,e.edges.bottom=h>0,e.overflow.x=Math.abs(u),e.overflow.y=Math.abs(h)}_quantizeSigned(i,e){if(e<=0||i===0)return 0;let n=i/e;return(i>0?Math.ceil(n):Math.floor(n))*e}_clamp(i,e,n){return Math.min(Math.max(i,e),n)}},Lf=class{_pointerDown;_vCellSize;_hCellSize;_snapWhileDragging;constructor(i,e){this._pointerDown=e,this._vCellSize=i.vCellSize(),this._hCellSize=i.hCellSize(),this._snapWhileDragging=i.fCellSizeWhileDragging()}snap(i,e){let n=e||this._snapWhileDragging;return this._strategies[+n](i)}_strategies={0:this._noSnap.bind(this),1:this._snapWithCellSize.bind(this)};_snapWithCellSize(i){return{x:this._snapToGrid(this._pointerDown.x+i.x,this._hCellSize)-this._pointerDown.x,y:this._snapToGrid(this._pointerDown.y+i.y,this._vCellSize)-this._pointerDown.y}}_noSnap(i){return i}_snapToGrid(i,e){return Math.round(i/e)*e}};function Nh(){return{value:{x:0,y:0},overflow:{x:0,y:0},edges:{left:!1,right:!1,top:!1,bottom:!1}}}var Bf=class{_snapper;_hardClamp;_hardResult=Nh();_softClamps=[];_softResults=[];constructor(i,e,n){let o=i.get(M).fDraggable;this._snapper=new Lf(o,e),this._hardClamp=new md(n.hard,.5);for(let r of n.soft)this._softClamps.push(new md(r.limits,.5)),this._softResults.push(Nh())}apply(i,e=!1){let n=this._snapper.snap(i,e);this._hardClamp.applyInto(n,this._hardResult);let o={x:this._hardResult.value.x,y:this._hardResult.value.y};for(let r=0;r<this._softClamps.length;r++)this._softClamps[r].applyInto(o,this._softResults[r]);return{hardDelta:o,soft:this._softResults}}finalize(i){return this.apply(i,!0)}};function Rh(t,i,e){let{x:n,y:o,width:r,height:a}=t;return e.right&&i.x>0&&(r+=i.x),e.left&&i.x>0&&(n-=i.x,r+=i.x),e.bottom&&i.y>0&&(a+=i.y),e.top&&i.y>0&&(o-=i.y,a+=i.y),H.initialize(n,o,r,a)}var zf=class extends qe{_injector;nodeOrGroup;children;sourceConnectionHandlers;targetConnectionHandlers;type=cp;kind=dp;_startPosition=A.initialize();_startRect=H.initialize();_applyConstraints=i=>i;_lastSoftResults=[];_deltaConstraints;_constraints;_lastPosition=A.initialize();_softParentConnectionHandlers=[];_mediator;constructor(i,e,n=[],o=[],r=[]){super(),this._injector=i,this.nodeOrGroup=e,this.children=n,this.sourceConnectionHandlers=o,this.targetConnectionHandlers=r,this._mediator=i.get(R),this._startRect=this._mediator.execute(new Ie(e.hostElement)),this._startPosition=se({},e._position)}setConstraints(i){this._constraints=i,this._deltaConstraints=new Bf(this._injector,this._startPosition,i),this._applyConstraints=e=>{let n=this._deltaConstraints.apply(e);return this._applySoftExpansions(n.soft),n.hardDelta}}setSoftParentConnectionHandlers(i){this._softParentConnectionHandlers=i}finalizeConstraints(){this._applyConstraints=i=>{let e=this._deltaConstraints.finalize(i);return this._applySoftExpansions(e.soft),e.hardDelta}}getLastRect(){return H.initialize(this._lastPosition.x,this._lastPosition.y,this._startRect.width,this._startRect.height)}prepareDragSequence(){for(let i of this.children)i.prepareDragSequence();this.nodeOrGroup.hostElement.classList.add(Oe.DRAG_AND_DROP.DRAGGING)}onPointerMove(i){let e=this._applyConstraints(i);for(let n of this.children)n.onPointerMove(e);this._redraw(this._startPlus(e));for(let n of this.sourceConnectionHandlers)n.setSourceDelta(e);for(let n of this.targetConnectionHandlers)n.setTargetDelta(e)}onPointerUp(){for(let i of this.children)i.onPointerUp();this.nodeOrGroup.position.set(this.nodeOrGroup._position),this.nodeOrGroup.hostElement.classList.remove(Oe.DRAG_AND_DROP.DRAGGING),this._emitExpandedEvent()}_startPlus(i){return A.sum(this._startPosition,i)}_redraw(i){this._lastPosition=i,this.nodeOrGroup.updatePosition(i),this._mediator.execute(new ln(this.nodeOrGroup.fId(),H.initialize(i.x,i.y,this._startRect.width,this._startRect.height))),this.nodeOrGroup.redraw()}_applySoftExpansions(i){this._lastSoftResults=i;for(let e=0;e<i.length;e++){let n=i[e],o=this._constraints.soft[e],r=Rh(o.boundingRect,n.overflow,n.edges);this._commitParentRect(o.nodeOrGroup,r)&&this._updateParentConnectionHandlers(e)}}_commitParentRect(i,e){let n=i._position.x!==e.x||i._position.y!==e.y||i._size?.width!==e.width||i._size?.height!==e.height;return i.updateSize({width:e.width,height:e.height}),i.updatePosition({x:e.x,y:e.y}),this._mediator.execute(new ln(i.fId(),e)),i.redraw(),n}_updateParentConnectionHandlers(i){let e=this._softParentConnectionHandlers[i];if(!e)return;let n=new Map;for(let o of e.source){let r=this._readConnectorRect(o.connector,n);o.handler.setSourceDelta(this._buildDelta(o.baselineRect,r))}for(let o of e.target){let r=this._readConnectorRect(o.connector,n);o.handler.setTargetDelta(this._buildDelta(o.baselineRect,r))}}_readConnectorRect(i,e){let n=`${i.kind}::${i.fId()}`,o=e.get(n);if(o)return o;let r=this._mediator.execute(new at(i)).rect;return e.set(n,r),r}_buildDelta(i,e){return A.initialize(e.x-i.x,e.y-i.y)}_emitExpandedEvent(){for(let i=0;i<this._lastSoftResults.length;i++){let e=this._lastSoftResults[i];if(!e.overflow.x&&!e.overflow.y)continue;let n=this._constraints.soft[i],o=Rh(n.boundingRect,e.overflow,e.edges);n.nodeOrGroup.sizeChange.emit(o)}}destroy(){for(let i of this.children)i.destroy?.();this.children=[],this.sourceConnectionHandlers=[],this.targetConnectionHandlers=[],this._lastSoftResults=[],this._applyConstraints=i=>i,this._softParentConnectionHandlers=[]}},dC=(()=>{let t=class pa{_injector=d(Je);handle({nodesAndGroups:e}){let n=this._createHandlerByNodeId(e),o=this._linkParentsAndCollectRoots(e,n);return new Ff(o,Array.from(n.values()))}_createHandlerByNodeId(e){let n=new Map;for(let o of e)n.set(o.fId(),new zf(this._injector,o));return n}_linkParentsAndCollectRoots(e,n){let o=[];for(let r of e){let a=n.get(r.fId());if(!a)continue;let s=r.fParentId(),l=s?n.get(s):void 0;l?l.children.push(a):o.push(a)}return o}static \u0275fac=function(n){return new(n||pa)};static \u0275prov=y({token:pa,factory:pa.\u0275fac})};return t=C([x(hd)],t),t})(),_d=class{nodeOrGroup;static fToken=Symbol("BuildDragNodeConstraintsRequest");constructor(i){this.nodeOrGroup=i}},Ai=class{nodeOrGroup;childrenPaddings;static fToken=Symbol("ReadNodeBoundsWithPaddingsRequest");constructor(i,e){this.nodeOrGroup=i,this.childrenPaddings=e}},Vf=class{nodeOrGroup;boundingRect;innerRect;paddings;constructor(i,e,n,o){this.nodeOrGroup=i,this.boundingRect=e,this.innerRect=n,this.paddings=o}},lC=(()=>{let t=class ha{_mediator=d(R);handle({nodeOrGroup:e,childrenPaddings:n}){let o=this._readBoundingRect(e),r=this._readOwnPaddings(e,o),a=[r[0]+n[0],r[1]+n[1],r[2]+n[2],r[3]+n[3]],s=H.initialize(o.x+a[0],o.y+a[1],o.width-a[0]-a[2],o.height-a[1]-a[3]);return new Vf(e,o,s,a)}_readBoundingRect(e){return this._mediator.execute(new Ie(e.hostElement))}_readOwnPaddings(e,n){return this._mediator.execute(new hn(e,n))}static \u0275fac=function(n){return new(n||ha)};static \u0275prov=y({token:ha,factory:ha.\u0275fac})};return t=C([x(Ai)],t),t})(),uC=(()=>{let t=class ma{_mediator=d(R);handle({nodeOrGroup:e}){let n=this._readCurrentRect(e),o=this._readParentsChain(e);return this._buildConstraints(o,n)}_readCurrentRect(e){return this._mediator.execute(new Ie(e.hostElement))}_readParentsChain(e){return this._mediator.execute(new Zn(e))??[]}_buildConstraints(e,n){let o=[],r=lm(),a=[0,0,0,0];for(let s of e){let l=this._readParentBounds(s,a);a=l.paddings;let u=this._calculateDifference(l.innerRect,n);if(this._isAutoExpand(s))o.push(this._makeSoftLimit(s,l.boundingRect,u));else{r=u;break}}return{soft:o,hard:r}}_readParentBounds(e,n){return this._mediator.execute(new Ai(e,n))}_calculateDifference(e,n){return{min:this._calculateMinimumDifference(e,n),max:this._calculateMaximumDifference(e,n)}}_calculateMinimumDifference(e,n){return A.initialize(e.x-n.x,e.y-n.y)}_calculateMaximumDifference(e,n){return A.initialize(e.x+e.width-(n.x+n.width),e.y+e.height-(n.y+n.height))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeSoftLimit(e,n,o){return{nodeOrGroup:e,boundingRect:n,initialSize:e._size,limits:o}}static \u0275fac=function(n){return new(n||ma)};static \u0275prov=y({token:ma,factory:ma.\u0275fac})};return t=C([x(_d)],t),t})(),gd=class{rootHandlers;participants;static fToken=Symbol("CreateDragNodeHandlerRequest");constructor(i,e){this.rootHandlers=i,this.participants=e}},yd=class{dragHandler;constraints;handlerPool;static fToken=Symbol("AttachSoftParentConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.constraints=e,this.handlerPool=n}},Li=class{_mediator=d(R);_store=d(M);_behaviour=d(ni);_source;_target;_sourceRef;_targetRef;_sourceDelta=A.initialize();_targetDelta=A.initialize();connection;initialize(i){this.connection=i,this._source=this._store.outputs.require(this.connection.fOutputId()),this._target=this._store.inputs.require(this.connection.fInputId()),this._sourceRef=this._readRectRef(this._source),this._targetRef=this._readRectRef(this._target)}setSourceDelta(i){this._sourceDelta=i,this._mediator.execute(new dn(this._source.fId(),this._source.kind,this._withDelta(this._sourceRef.rect,i)))}setTargetDelta(i){this._targetDelta=i,this._mediator.execute(new dn(this._target.fId(),this._target.kind,this._withDelta(this._targetRef.rect,i)))}redraw(){let i=this._buildLine();this.connection.setLine(i),this.connection.redraw()}_buildLine(){let i=De.fromRoundedRect(this._sourceRef.rect).addPoint(this._sourceDelta),e=De.fromRoundedRect(this._targetRef.rect).addPoint(this._targetDelta);return this._behaviour.handle(new ht(i,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(i){return this._mediator.execute(new at(i))}_withDelta(i,e){return De.fromRoundedRect(i).addPoint(e)}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},Bi=(()=>{class t extends Li{setSourceDelta(e){super.setSourceDelta(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),zi=(()=>{class t extends Li{_sourceUpdated=!1;_targetUpdated=!1;setSourceDelta(e){super.setSourceDelta(e),this._sourceUpdated=!0,this._redrawIfReady()}setTargetDelta(e){super.setTargetDelta(e),this._targetUpdated=!0,this._redrawIfReady()}_redrawIfReady(){!this._sourceUpdated||!this._targetUpdated||(this._sourceUpdated=!1,this._targetUpdated=!1,this.redraw())}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Vi=(()=>{class t extends Li{setTargetDelta(e){super.setTargetDelta(e),this.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),fC=(()=>{let t=class _a{_store=d(M);_mediator=d(R);_dragInjector=d(je);handle({dragHandler:e,constraints:n,handlerPool:o}){let r=n.soft.map(a=>this._buildParentConnectionHandlers(a.nodeOrGroup,o));e.setSoftParentConnectionHandlers(r)}_buildParentConnectionHandlers(e,n){let o=this._store.outputs.getAll().filter(h=>h.fNodeId===e.fId()),r=this._store.inputs.getAll().filter(h=>h.fNodeId===e.fId());if(!o.length&&!r.length)return{source:[],target:[]};let a=new Set(o.map(h=>h.fId())),s=new Set(r.map(h=>h.fId())),l=new Map,u={source:[],target:[]};for(let h of this._store.connections.getAll()){let g=a.has(h.fOutputId()),w=s.has(h.fInputId());if(!g&&!w)continue;let b=this._getExistingConnectionHandler(n,h);if(b||(b=this._createConnectionHandler(h,g,w),n.push(b)),g){let P=this._store.outputs.require(h.fOutputId());u.source.push({handler:b,connector:P,baselineRect:this._readConnectorRect(P,l)})}if(w){let P=this._store.inputs.require(h.fInputId());u.target.push({handler:b,connector:P,baselineRect:this._readConnectorRect(P,l)})}}return u}_getExistingConnectionHandler(e,n){return e.find(o=>o.connection.fId()===n.fId())}_createConnectionHandler(e,n,o){let r;return n&&o?r=this._dragInjector.createInstance(zi):n?r=this._dragInjector.createInstance(Bi):r=this._dragInjector.createInstance(Vi),r.initialize(e),r}_readConnectorRect(e,n){let o=`${e.kind}::${e.fId()}`,r=n.get(o);if(r)return r;let a=this._mediator.execute(new at(e)).rect;return n.set(o,a),a}static \u0275fac=function(n){return new(n||_a)};static \u0275prov=y({token:_a,factory:_a.\u0275fac})};return t=C([x(yd)],t),t})(),pC=(()=>{let t=class ga{_dragInjector=d(je);_mediator=d(R);handle({rootHandlers:e,participants:n}){let o=this._collectConnectionHandlers(n);this._applyConstraintsToRoots(e,o);let r=this._dragInjector.createInstance(jt);return r.initialize(n,e),r}_applyConstraintsToRoots(e,n){for(let o of e){let r=this._calculateConstraints(o.nodeOrGroup);o.setConstraints(r),this._attachSoftParentConnectionHandlers(o,r,n)}}_collectConnectionHandlers(e){let n=new Map;for(let o of e){for(let r of o.sourceConnectionHandlers)n.set(r.connection.fId(),r);for(let r of o.targetConnectionHandlers)n.set(r.connection.fId(),r)}return Array.from(n.values())}_attachSoftParentConnectionHandlers(e,n,o){this._mediator.execute(new yd(e,n,o))}_calculateConstraints(e){return this._mediator.execute(new _d(e))}static \u0275fac=function(n){return new(n||ga)};static \u0275prov=y({token:ga,factory:ga.\u0275fac})};return t=C([x(gd)],t),t})(),vd=class{dragHandler;sourceIds;handlerPool;static fToken=Symbol("AttachTargetConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.sourceIds=e,this.handlerPool=n}},hC=(()=>{let t=class ya{_store=d(M);_dragInjector=d(je);get _connections(){return this._store.connections.getAll()}handle(e){this._getInputConnections(e.dragHandler.nodeOrGroup).forEach(n=>{this._createAndSetConnectionToNodeHandler(n,e)})}_getInputConnections(e){let n=new Set(this._getNodeInputIds(e));return this._connections.filter(o=>n.has(o.fInputId()))}_getNodeInputIds(e){return this._store.inputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let o=this._getExistingConnectionHandler(n.handlerPool,e);o||(o=this._createConnectionHandler(n.sourceIds,e),n.handlerPool.push(o)),n.dragHandler.targetConnectionHandlers.push(o)}_getExistingConnectionHandler(e,n){return e.find(o=>o.connection.fId()===n.fId())}_createConnectionHandler(e,n){let o;return e.includes(n.fOutputId())?o=this._dragInjector.createInstance(zi):o=this._dragInjector.createInstance(Vi),o.initialize(n),o}static \u0275fac=function(n){return new(n||ya)};static \u0275prov=y({token:ya,factory:ya.\u0275fac})};return t=C([x(vd)],t),t})(),Cd=class{dragHandler;targetIds;handlerPool;static fToken=Symbol("AttachSourceConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.targetIds=e,this.handlerPool=n}},mC=(()=>{let t=class va{_store=d(M);_dragInjector=d(je);get _connections(){return this._store.connections.getAll()}handle(e){this._getOutputConnections(e.dragHandler.nodeOrGroup).forEach(n=>{this._createAndSetConnectionToNodeHandler(n,e)})}_getOutputConnections(e){let n=new Set(this._getNodeOutputIds(e));return this._connections.filter(o=>n.has(o.fOutputId()))}_getNodeOutputIds(e){return this._store.outputs.getAll().filter(n=>e.isContains(n.hostElement)).map(n=>n.fId())}_createAndSetConnectionToNodeHandler(e,n){let o=this._getExistingConnectionHandler(n.handlerPool,e);o||(o=this._createConnectionHandler(n.targetIds,e),n.handlerPool.push(o)),n.dragHandler.sourceConnectionHandlers.push(o)}_getExistingConnectionHandler(e,n){return e.find(o=>o.connection.fId()===n.fId())}_createConnectionHandler(e,n){let o;return e.includes(n.fInputId())?o=this._dragInjector.createInstance(zi):o=this._dragInjector.createInstance(Bi),o.initialize(n),o}static \u0275fac=function(n){return new(n||va)};static \u0275prov=y({token:va,factory:va.\u0275fac})};return t=C([x(Cd)],t),t})(),xd=class{nodeOrGroup;static fToken=Symbol("AttachDragNodeHandlerFromSelectionRequest");constructor(i){this.nodeOrGroup=i}},_C=(()=>{let t=class Ca{_mediator=d(R);_store=d(M);_dragSession=d(Q);handle({nodeOrGroup:e}){let n=this._collectSelected(e),o=this._withDeepChildren(n),r=this._mediator.execute(new hd(o)),a=this._collectSourceConnectorIds(o),s=this._collectTargetConnectorIds(o);return this._attachConnectionHandlers(r.participants,a,s),this._mediator.execute(new gd(r.rootHandlers,r.participants))}_collectSelected(e){let n=[];for(let o of this._dragSession.selectedItems){let r=this._findNodeByHost(o.hostElement);r&&n.push(r)}return e&&!n.includes(e)&&n.push(e),n}_findNodeByHost(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_withDeepChildren(e){let n=[];for(let o of e){n.push(o);let r=this._mediator.execute(new ti(o.fId()));n.push(...r)}return n}_collectSourceConnectorIds(e){return Bu(e,n=>this._store.outputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_collectTargetConnectorIds(e){return Bu(e,n=>this._store.inputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_attachConnectionHandlers(e,n,o){let r=[];for(let a of e)this._mediator.execute(new Cd(a,o,r)),this._mediator.execute(new vd(a,n,r))}static \u0275fac=function(n){return new(n||Ca)};static \u0275prov=y({token:Ca,factory:Ca.\u0275fac})};return t=C([x(xd)],t),t})(),gC=[dC,uC,pC,hC,mC,fC,lC,_C];function yC(t,i,e=10){let n=i.x,o=i.y,r=n+i.width,a=o+i.height,s=i.gravityCenter.x,l=i.gravityCenter.y,u,h,g=1/0,w,b,P=1/0,T=(N,O)=>{let V=O<0?-O:O;V<=e&&V<g&&(g=V,u=N,h=O)},k=(N,O)=>{let V=O<0?-O:O;V<=e&&V<P&&(P=V,w=N,b=O)};for(let N=0;N<t.length;N++){let O=t[N],V=O.x,z=O.y,q=V+O.width,ie=z+O.height,Te=O.gravityCenter.x,ue=O.gravityCenter.y;T(V,n-V),T(q,n-q),T(Te,s-Te),T(V,r-V),T(q,r-q),k(z,o-z),k(ie,o-ie),k(ue,l-ue),k(z,a-z),k(ie,a-ie)}return{x:{guide:u,delta:h},y:{guide:w,delta:b}}}var Oh=["left","top","width","height"],bd=class{_element;constructor(i,e,n="f-line"){this._element=i.document.createElement("div"),this._element.classList.add(n),this._element.style.position="absolute",this._element.style.display="none",e.appendChild(this._element)}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}render(i){for(let e of Oh){let n=i[e];n!=null&&(this._element.style[e]=`${n}px`)}}clearRect(){for(let i of Oh)this._element.style.removeProperty(i)}destroy(){this._element.remove()}},Hf=class{_horizontal;_vertical;constructor(i,e){this._horizontal=new bd(i,e),this._vertical=new bd(i,e),this._horizontal.hide(),this._vertical.hide()}drawVerticalLine(i,e,n){this._vertical.show(),this._vertical.render({left:i*n.scale+n.position.x+n.scaledPosition.x,top:0,width:1,height:e.height})}drawHorizontalLine(i,e,n){this._horizontal.show(),this._horizontal.render({left:0,top:i*n.scale+n.position.y+n.scaledPosition.y,width:e.width,height:1})}hideVertical(){this._vertical.hide()}hideHorizontal(){this._horizontal.hide()}hideAll(){this._vertical.hide(),this._horizontal.hide()}destroy(){this._vertical.destroy(),this._horizontal.destroy()}},wd=class{static fToken=Symbol("MagneticLinesPreparationRequest")},vC=(()=>{let t=class xa{_mediator=d(R);_store=d(M);_browser=d(ke);_injector=d(Je);_dragSession=d(Q);_renderer;handle(e){let n=this._store.instances.get(ye.MAGNETIC_LINES);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof jt);o&&o.setMagneticLines(new Gf(this._injector,this._renderer??this._createRenderer(n),this._flowHostSize(),this._notDraggedRects(this._draggedNodes(o.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_flowHostSize(){return this._store.flowHost.getBoundingClientRect()}_createRenderer({hostElement:e}){return this._renderer=new Hf(this._browser,e),this._renderer}_notDraggedRects(e){let n=new Set(e);return this._store.nodes.getAll().filter(r=>!n.has(r)).map(r=>this._mediator.execute(new Ie(r.hostElement)))}static \u0275fac=function(n){return new(n||xa)};static \u0275prov=y({token:xa,factory:xa.\u0275fac})};return t=C([x(wd)],t),t})(),Gf=class{_renderer;_size;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;constructor(i,e,n,o){this._renderer=e,this._size=n,this._rects=o;let r=i.get(M);this._alignThreshold=r.instances.require(ye.MAGNETIC_LINES).threshold(),this._canvasTransform=r.transform}scheduleRender(i){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderGuides(this._computeGuides(i)),15)}_renderGuides(i){this._renderVertical(i),this._renderHorizontal(i)}_renderVertical(i){i.x.guide!==void 0?this._renderer.drawVerticalLine(i.x.guide,this._size,this._canvasTransform):this._renderer.hideVertical()}_renderHorizontal(i){i.y.guide!==void 0?this._renderer.drawHorizontalLine(i.y.guide,this._size,this._canvasTransform):this._renderer.hideHorizontal()}_computeGuides(i){return yC(this._rects,i,this._alignThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},Fh=["top","center","bottom"],Ah=["left","center","right"];function CC(t,i,e=10,n=10){let o=i.x,r=i.y,a=o+i.width,s=r+i.height,l=i.gravityCenter.x,u=i.gravityCenter.y,h=xC(t,i,o,r,a,s,l,u,e,n),g=bC(t,i,o,r,a,s,l,u,e,n);return h&&(!g||h.absDelta<=g.absDelta)?{axis:"x",delta:h.delta,gap:h.gap,rects:h.rects,alignMode:h.alignMode,crossDelta:h.crossDelta}:g?{axis:"y",delta:g.delta,gap:g.gap,rects:g.rects,alignMode:g.alignMode,crossDelta:g.crossDelta}:{rects:[]}}function xC(t,i,e,n,o,r,a,s,l,u){let h=1/0,g,w=0,b,P=[],T=0,k=[],N=[],O=[];for(let V=0;V<Fh.length;V++){let z=V===0?n:V===1?s:r;k.length=0,N.length=0,O.length=0;let q=1/0,ie=-1/0,Te=0,ue=1/0,Ge=1/0;for(let me=0;me<t.length;me++){let de=t[me],si=V===0?de.y:V===1?de.gravityCenter.y:de.y+de.height,Iu=z-si,wt=Vn(Iu);if(wt>l)continue;k.push(me),N.push(de.x),O.push(de.x+de.width);let ci=de.y,di=de.y+de.height;ci<q&&(q=ci),di>ie&&(ie=di),(wt<ue||wt===ue&&me<Ge)&&(ue=wt,Te=si,Ge=me)}let oe=k.length;if(oe<2)continue;xm(k,N,O);let le=0;for(;le<oe&&N[le]<=a;)le++;let Ue=le>0&&le<oe,ve,tt;Ue?(ve=le-1,tt=le):le<=0?(ve=0,tt=1):(ve=oe-2,tt=oe-1);let nt=N[tt]-O[ve];if(nt<0)continue;let Ae;if(Ue){Ae=O[ve]+nt;let me=Ae+i.width,de=N[tt]-me;if(Vn(de-nt)>u)continue}else le<=0?Ae=N[0]-nt-i.width:Ae=O[oe-1]+nt;let ai=e-Ae,qt=Vn(ai);if(qt>u||qt>=h)continue;let lt=wC(k,N,O,q,ie);if(Ue){let me=Ae,de=Ae+i.width;lt.push({left:O[ve],top:q,width:me-O[ve],height:ie-q}),lt.push({left:de,top:q,width:N[tt]-de,height:ie-q})}else if(le<=0){let me=Ae+i.width;lt.push({left:me,top:q,width:N[0]-me,height:ie-q})}else lt.push({left:O[oe-1],top:q,width:Ae-O[oe-1],height:ie-q});let Su=z-Te;h=qt,g=ai,w=nt,b=Fh[V],P=lt,T=Su}if(!(g===void 0||b===void 0))return{delta:g,absDelta:h,gap:w,rects:P,alignMode:b,crossDelta:T}}function bC(t,i,e,n,o,r,a,s,l,u){let h=1/0,g,w=0,b,P=[],T=0,k=[],N=[],O=[];for(let V=0;V<Ah.length;V++){let z=V===0?e:V===1?a:o;k.length=0,N.length=0,O.length=0;let q=1/0,ie=-1/0,Te=0,ue=1/0,Ge=1/0;for(let me=0;me<t.length;me++){let de=t[me],si=V===0?de.x:V===1?de.gravityCenter.x:de.x+de.width,Iu=z-si,wt=Vn(Iu);if(wt>l)continue;k.push(me),N.push(de.y),O.push(de.y+de.height);let ci=de.x,di=de.x+de.width;ci<q&&(q=ci),di>ie&&(ie=di),(wt<ue||wt===ue&&me<Ge)&&(ue=wt,Te=si,Ge=me)}let oe=k.length;if(oe<2)continue;xm(k,N,O);let le=0;for(;le<oe&&N[le]<=s;)le++;let Ue=le>0&&le<oe,ve,tt;Ue?(ve=le-1,tt=le):le<=0?(ve=0,tt=1):(ve=oe-2,tt=oe-1);let nt=N[tt]-O[ve];if(nt<0)continue;let Ae;if(Ue){Ae=O[ve]+nt;let me=Ae+i.height,de=N[tt]-me;if(Vn(de-nt)>u)continue}else le<=0?Ae=N[0]-nt-i.height:Ae=O[oe-1]+nt;let ai=n-Ae,qt=Vn(ai);if(qt>u||qt>=h)continue;let lt=SC(k,N,O,q,ie);if(Ue){let me=Ae,de=Ae+i.height;lt.push({left:q,top:O[ve],width:ie-q,height:me-O[ve]}),lt.push({left:q,top:de,width:ie-q,height:N[tt]-de})}else if(le<=0){let me=Ae+i.height;lt.push({left:q,top:me,width:ie-q,height:N[0]-me})}else lt.push({left:q,top:O[oe-1],width:ie-q,height:Ae-O[oe-1]});let Su=z-Te;h=qt,g=ai,w=nt,b=Ah[V],P=lt,T=Su}if(!(g===void 0||b===void 0))return{delta:g,absDelta:h,gap:w,rects:P,alignMode:b,crossDelta:T}}function wC(t,i,e,n,o){let r=[],a=o-n;for(let s=0;s<t.length-1;s++){let l=i[s+1]-e[s];l<0||r.push({left:e[s],top:n,width:l,height:a})}return r}function SC(t,i,e,n,o){let r=[],a=o-n;for(let s=0;s<t.length-1;s++){let l=i[s+1]-e[s];l<0||r.push({left:n,top:e[s],width:a,height:l})}return r}function xm(t,i,e){for(let n=1;n<i.length;n++){let o=i[n],r=e[n],a=t[n],s=n-1;for(;s>=0;){let l=i[s],u=t[s];if(l<o||l===o&&u<a)break;i[s+1]=l,e[s+1]=e[s],t[s+1]=u,s--}i[s+1]=o,e[s+1]=r,t[s+1]=a}}function Vn(t){return t<0?-t:t}var jf=class{_element;_isVisible=!1;_left=Number.NaN;_top=Number.NaN;_width=Number.NaN;_height=Number.NaN;constructor(i,e,n="f-rect"){this._element=i.document.createElement("div"),this._element.classList.add(n);let o=this._element.style;o.position="absolute",o.display="none",o.boxSizing="border-box",o.pointerEvents="none",e.appendChild(this._element)}show(){this._isVisible||(this._isVisible=!0,this._element.style.display="block")}hide(){this._isVisible&&(this._isVisible=!1,this._element.style.display="none")}render(i,e,n,o){let r=this._element.style;i!==this._left&&(this._left=i,r.left=i+"px"),e!==this._top&&(this._top=e,r.top=e+"px"),n!==this._width&&(this._width=n,r.width=n+"px"),o!==this._height&&(this._height=o,r.height=o+"px")}clearRect(){this._left=Number.NaN,this._top=Number.NaN,this._width=Number.NaN,this._height=Number.NaN;let i=this._element.style;i.removeProperty("left"),i.removeProperty("top"),i.removeProperty("width"),i.removeProperty("height")}destroy(){this._element.remove()}},Uf=class{_browser;_hostElement;_className;_pool=[];_activeCount=0;constructor(i,e,n="f-rect"){this._browser=i,this._hostElement=e,this._className=n}draw(i,e){let n=e.scale,o=e.position.x+e.scaledPosition.x,r=e.position.y+e.scaledPosition.y;for(let a=0;a<i.length;a++){let s=this._getOrCreate(a),l=i[a];s.show(),s.render(l.left*n+o,l.top*n+r,l.width*n,l.height*n)}for(let a=i.length;a<this._activeCount;a++)this._pool[a].hide();this._activeCount=i.length}hideAll(){for(let i=0;i<this._activeCount;i++)this._pool[i].hide();this._activeCount=0}destroy(){for(let i of this._pool)i.destroy();this._pool.length=0,this._activeCount=0}_getOrCreate(i){if(i<this._pool.length)return this._pool[i];let e=new jf(this._browser,this._hostElement,this._className);return this._pool.push(e),e}},Sd=class{static fToken=Symbol("MagneticRectsPreparationRequest")},IC=(()=>{let t=class ba{_mediator=d(R);_store=d(M);_browser=d(ke);_injector=d(Je);_dragSession=d(Q);_renderer;handle(e){let n=this._store.instances.get(ye.MAGNETIC_RECTS);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof jt);o&&o.setMagneticRects(new Wf(this._injector,this._getRenderer(n),this._notDraggedRects(this._draggedNodes(o.items))))}_draggedNodes(e){return e.map(n=>n.nodeOrGroup)}_getRenderer(e){return this._renderer||(this._renderer=new Uf(this._browser,e.hostElement)),this._renderer?.destroy(),this._renderer}_notDraggedRects(e){let n=new Set(e);return this._store.nodes.getAll().filter(r=>!n.has(r)).map(r=>this._mediator.execute(new Ie(r.hostElement)))}static \u0275fac=function(n){return new(n||ba)};static \u0275prov=y({token:ba,factory:ba.\u0275fac})};return t=C([x(Sd)],t),t})(),Wf=class{_renderer;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;_spacingThreshold=10;constructor(i,e,n){this._renderer=e,this._rects=n;let o=i.get(M),r=o.instances.require(ye.MAGNETIC_RECTS);this._alignThreshold=r.alignThreshold(),this._spacingThreshold=r.spacingThreshold(),this._canvasTransform=o.transform}scheduleRender(i){this._timerId&&clearTimeout(this._timerId),this._timerId=setTimeout(()=>this._renderRects(this._computeRects(i)),15)}_renderRects(i){if(i.axis!==void 0&&i.delta!==void 0&&i.rects.length>0){this._renderer.draw(i.rects,this._canvasTransform);return}this._renderer.hideAll()}_computeRects(i){return CC(this._rects,i,this._alignThreshold,this._spacingThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},Id=class{event;static fToken=Symbol("DragNodeFinalizeRequest");constructor(i){this.event=i}},$f=class{nodes;fNodes;constructor(i){this.nodes=i,this.fNodes=i}},TC=(()=>{let t=class wa{_mediator=d(R);_store=d(M);_dragSession=d(Q);_dragHandler;handle({event:e}){if(this._dragHandler=this._getDragHandler(),!this._dragHandler)return;let n=this._buildDragDelta(e.getPosition()),o=this._dragHandler.calculateMagneticSnaps(n),r=this._applySnapToDelta(n,o.lines,o.rects);this._finalizeMove(this._dragHandler,r),this._emitNodeIntersectIfNeeded(this._dragHandler)}_getDragHandler(){return this._dragSession.draggableItems.find(cC)}_buildDragDelta(e){return Y.fromPoint(e).elementTransform(this._store.flowHost).div(this._dragSession.onPointerDownScale).sub(this._dragSession.onPointerDownPosition)}_applySnapToDelta(e,n,o){let r=e.x,a=e.y;return n&&(r=this._hasLineSnapValue(n.x)?e.x-(n.x.delta||0):r,a=this._hasLineSnapValue(n.y)?e.y-(n.y.delta||0):a),this._hasRectSnapValue(o)&&(o.axis==="x"?(r=e.x-o.delta,a=e.y-(o.crossDelta??0)):(a=e.y-o.delta,r=e.x-(o.crossDelta??0))),{x:r,y:a}}_hasLineSnapValue(e){return e.guide!==void 0&&e.guide!==null}_hasRectSnapValue(e){return!!e&&e.axis!==void 0&&e.delta!==void 0}_finalizeMove(e,n){for(let o of e.roots)o.finalizeConstraints();e.onPointerMove(n),e.onPointerUp?.(),this._store.fDraggable?.fMoveNodes.emit(this._buildMoveNodesEvent(e))}_buildMoveNodesEvent(e){let n=e.getEvent(),a=((n.data??n.fData)?.fNodeIds??[]).map(s=>({id:s,position:this._store.nodes.get(s)?._position}));return new $f(a)}_emitNodeIntersectIfNeeded(e){if(!this._isDraggedJustOneNode(e)||!this._store.fDraggable?.fEmitOnNodeIntersect)return;let n=e.roots[0].nodeOrGroup;queueMicrotask(()=>this._mediator.execute(new qc(n)))}_isDraggedJustOneNode(e){return e.roots.length===1}static \u0275fac=function(n){return new(n||wa)};static \u0275prov=y({token:wa,factory:wa.\u0275fac})};return t=C([x(Id)],t),t})(),Td=class{event;trigger;static fToken=Symbol("DragNodePreparationRequest");constructor(i,e){this.event=i,this.trigger=e}},PC=(()=>{let t=class Sa{_mediator=d(R);_store=d(M);_dragSession=d(Q);handle({event:e,trigger:n}){if(!this._canStartDrag(e,n))return;let o=this._findDraggableNode(e.targetElement);o&&(this._storePointerDownContext(e),this._dragSession.draggableItems=[this._buildDragNodeHandler(o)],this._mediator.execute(new wd),this._mediator.execute(new Sd))}_canStartDrag(e,n){return this._dragSession.isEmpty()&&this._isDragHandle(e.targetElement)&&dt(e.originalEvent,n)}_isDragHandle(e){return _i(e,".f-drag-handle")}_findDraggableNode(e){let n=this._store.nodes.getAll();for(let o of n)if(!o.fDraggingDisabled()&&o.isContains(e))return o}_storePointerDownContext(e){this._dragSession.onPointerDownScale=this._store.transform.scale,this._dragSession.onPointerDownPosition=Y.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(this._store.transform.scale)}_buildDragNodeHandler(e){return(e.fSelectionDisabled()||!e.isSelected())&&queueMicrotask(()=>{this._mediator.execute(new ei(e))}),this._mediator.execute(new xd(e))}static \u0275fac=function(n){return new(n||Sa)};static \u0275prov=y({token:Sa,factory:Sa.\u0275fac})};return t=C([x(Td)],t),t})(),EC=[...gC,vC,IC,TC,PC],Kf=class{targetGroupId;nodeIds;dropPosition;fTargetNode;fNodes;fDropPosition;constructor(i,e,n){this.targetGroupId=i,this.nodeIds=e,this.dropPosition=n,this.fTargetNode=i,this.fNodes=e,this.fDropPosition=n}},DC=(()=>{let t=class Ia{_dragSession=d(Q);_store=d(M);handle({event:e}){let n=this._findDropHandler();if(!n)return;let o=n.activeTarget?.node;o&&this._emitDropToGroupEvent(o.fId(),e),n.onPointerUp?.()}_findDropHandler(){return this._dragSession.draggableItems.find(e=>e instanceof Fi)}_emitDropToGroupEvent(e,n){this._store.fDraggable?.fDropToGroup.emit(new Kf(e,this._getTopLevelDraggedIds(),n.getPosition()))}_getTopLevelDraggedIds(){let n=this._getMoveSummaryHandler().items.map(a=>a.nodeOrGroup),o=new Set(n.map(a=>a.fId())),r=[];for(let a of n){let s=a.fParentId();(!s||!o.has(s))&&r.push(a.fId())}return r}_getMoveSummaryHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof jt);if(!e)throw new Error("DropToGroup requires DragNodeHandler.");return e}static \u0275fac=function(n){return new(n||Ia)};static \u0275prov=y({token:Ia,factory:Ia.\u0275fac})};return t=C([x(pd)],t),t})(),Pd=class{event;static fToken=Symbol("DropToGroupPreparationRequest");constructor(i){this.event=i}},Ed=class{candidates;static fToken=Symbol("SortDropCandidatesByLayerRequest");constructor(i){this.candidates=i}},MC=(()=>{let t=class Ta{handle({candidates:e}){let n=e.map((o,r)=>({candidate:o,index:r}));return n.sort((o,r)=>{let a=this._compareDomOrder(o.candidate.node.hostElement,r.candidate.node.hostElement);return a!==0?-a:o.index-r.index}),n.map(o=>o.candidate)}_compareDomOrder(e,n){if(e===n)return 0;let o=e.compareDocumentPosition(n);if((o&Node.DOCUMENT_POSITION_FOLLOWING)!==0)return-1;if((o&Node.DOCUMENT_POSITION_PRECEDING)!==0)return 1;if(o&Node.DOCUMENT_POSITION_DISCONNECTED){let r=e.getBoundingClientRect?.()??{top:0,left:0},a=n.getBoundingClientRect?.()??{top:0,left:0};return r.top!==a.top?r.top<a.top?-1:1:r.left!==a.left?r.left<a.left?-1:1:0}return 0}static \u0275fac=function(n){return new(n||Ta)};static \u0275prov=y({token:Ta,factory:Ta.\u0275fac})};return t=C([x(Ed)],t),t})(),Xf=class{_onPointerDown;_limit;_vCellSize;_hCellSize;_adjustCellSize;constructor(i,e,n){this._onPointerDown=e,this._limit=n;let o=i.get(M);this._vCellSize=o.fDraggable.vCellSize(),this._hCellSize=o.fDraggable.hCellSize(),this._adjustCellSize=o.fDraggable.fCellSizeWhileDragging()}limit(i){let{min:e,max:n}=this._limit,{x:o,y:r}=this._cellSizeStrategies[+this._adjustCellSize](i);return{x:this._clamp(o,e.x,n.x),y:this._clamp(r,e.y,n.y)}}_cellSizeStrategies={0:this._skipCellSize.bind(this),1:this._applyCellSize.bind(this)};_applyCellSize(i){return{x:this._snapToGrid(this._onPointerDown.x+i.x,this._hCellSize)-this._onPointerDown.x,y:this._snapToGrid(this._onPointerDown.y+i.y,this._vCellSize)-this._onPointerDown.y}}_skipCellSize(i){return i}_clamp(i,e,n){return Math.min(Math.max(i,e),n)}_snapToGrid(i,e){return Math.round(i/e)*e}},Dd=class{externalItem;static fToken=Symbol("DragExternalItemCreatePlaceholderRequest");constructor(i){this.externalItem=i}},kC=(()=>{let t=class Pa{_browser=d(ke);_containerRef=d(mo);handle({externalItem:e}){let{hostElement:n,placeholder:o}=e,r=o(),a=r?this._fromTemplate(r):this._fromHost(n);return a.classList.add("f-external-item-placeholder"),a.style.pointerEvents="none",a}_fromTemplate(e){return Hu(this._createViewRef(e),this._browser.document)}_fromHost(e){return zu(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}static \u0275fac=function(n){return new(n||Pa)};static \u0275prov=y({token:Pa,factory:Pa.\u0275fac})};return t=C([x(Dd)],t),t})(),Md=class{externalItem;static fToken=Symbol("DragExternalItemCreatePreviewRequest");constructor(i){this.externalItem=i}},NC=(()=>{let t=class Ea{_browser=d(ke);_containerRef=d(mo);handle({externalItem:e}){let{hostElement:n,preview:o}=e,r=o(),a=r?this._fromTemplate(r):this._fromHost(n);return this._setPreviewStyles(a),mh(a),a.classList.add("f-external-item-preview"),a}_fromTemplate(e){return Hu(this._createViewRef(e),this._browser.document)}_fromHost(e){return zu(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}_setPreviewStyles(e){Vu(e.style,{"pointer-events":"none",margin:"showPopover"in e?"0 auto 0 0":"0",position:"fixed",top:"0",left:"0","z-index":"1000"},new Set(["position"]))}static \u0275fac=function(n){return new(n||Ea)};static \u0275prov=y({token:Ea,factory:Ea.\u0275fac})};return t=C([x(Md)],t),t})(),kd=class{event;static fToken=Symbol("DragExternalItemFinalizeRequest");constructor(i){this.event=i}},qf=class{externalItemRect;data;targetContainerId;dropPosition;rect;fTargetNode;fDropPosition;constructor(i,e,n,o){this.externalItemRect=i,this.data=e,this.targetContainerId=n,this.dropPosition=o,this.rect=i,this.fTargetNode=n,this.fDropPosition=o}},RC="external-item",OC="drag-external-item";function FC(t){return t.getEvent().kind===OC||t.getEvent().fEventType===RC}var AC=(()=>{let t=class Da{_result=d(Ut);_mediator=d(R);_store=d(M);_dragSession=d(Q);_browser=d(ke);get _createNodeEmitter(){return this._store.fDraggable?.fCreateNode}handle(e){let n=this._findExternalItemHandler();if(!n)return;let o=this._getDestinationNodeOrGroupId();this._emitEvent(this._getElementsFromPoint(e.event.getPosition()),o,e.event.getPosition()),n.onPointerUp(),this._dragSession.draggableItems=[]}_findExternalItemHandler(){return this._dragSession.draggableItems.find(e=>FC(e))}_getDestinationNodeOrGroupId(){let e=this._getDropToGroupHandler(),n=e.activeTarget?.node.fId();return e.onPointerUp?.(),n}_getDropToGroupHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof Fi);if(!e)throw new Error("NodeDragToParentDragHandler not found");return e}_getElementsFromPoint(e){return this._browser.document.elementsFromPoint(e.x,e.y).filter(n=>!n.closest(".f-external-item")&&!n.closest(".f-external-item-preview"))}_emitEvent(e,n,o){this._isPointerInCanvasRect(e)&&this._createNodeEmitter?.emit(new qf(this._getPreviewRect(),this._result.getData().externalItem.data(),n,n?o:void 0))}_isPointerInCanvasRect(e){return e.length?this._store.flowHost.contains(e[0]):!1}_getPreviewRect(){return this._mediator.execute(new Ie(this._result.getData().preview))}static \u0275fac=function(n){return new(n||Da)};static \u0275prov=y({token:Da,factory:Da.\u0275fac})};return t=C([x(kd)],t),t})(),Yf=class{data;constructor(i){this.data=i}},Nd=class extends qe{_externalItem;_pointerDownClientPosition;type="external-item";kind="drag-external-item";data(){return new Yf(this._externalItem.data())}_result;_mediator;_browser;_store;_previewEl;_placeholderEl;_startRect=H.initialize();_pointerDownRect=H.initialize();_absoluteOffsetFromFlow=A.initialize();_grabOffsetFromPointer=A.initialize();_originalParent;_originalNextSibling;_originalDisplay;_applyConstraints=i=>i;constructor(i,e,n){super(),this._externalItem=e,this._pointerDownClientPosition=n,this._store=i.get(M),this._result=i.get(Ut),this._mediator=i.get(R),this._browser=i.get(ke),this._originalDisplay=this._host.style.display,this._initConstraints(i)}get _host(){return this._externalItem.hostElement}get _overlayRoot(){return this._browser.document.fullscreenElement??this._browser.document.body}get _transform(){return this._store.transform}_initConstraints(i){this._startRect=this._getStartRect();let e=new Xf(i,this._startRect,lm());this._applyConstraints=n=>e.limit(n)}_getStartRect(){return this._mediator.execute(new Ie(this._externalItem.hostElement))}prepareDragSequence(){this._pointerDownRect=this._readAbsoluteRect(this._host),this._absoluteOffsetFromFlow=Y.fromPoint(this._pointerDownRect).sub(this._toAbsolutePoint(this._startRect)),this._grabOffsetFromPointer=this._clientToAbsolute(this._pointerDownClientPosition).sub(this._pointerDownRect),this._rememberOriginalPlacement(),this._previewEl=this._createPreview(),this._placeholderEl=this._createPlaceholder(),this._placePreviewIntoOverlay(),this._swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(),this._result.setData({preview:this._previewEl,externalItem:this._externalItem})}_rememberOriginalPlacement(){let i=this._host.parentNode;if(!i){this._originalParent=void 0,this._originalNextSibling=null;return}this._originalParent=i,this._originalNextSibling=this._host.nextSibling}_createPreview(){let i=this._mediator.execute(new Md(this._externalItem));return this._externalItem.previewMatchSize()&&this._matchSize(i,this._pointerDownRect),i.style.transform=Lh(this._pointerDownRect),i}_createPlaceholder(){return this._mediator.execute(new Dd(this._externalItem))}_placePreviewIntoOverlay(){this._overlayRoot.appendChild(this._previewEl)}_swapOriginalWithPlaceholderAndMoveOriginalIntoOverlay(){let i=this._originalParent,e=this._placeholderEl;if(!i||!e)return;let n=i.replaceChild(e,this._host);this._overlayRoot.appendChild(n),this._host.style.display="none"}onPointerMove(i,e){if(!this._previewEl)return;let n=this._resolveDeltaFromPointer(i,e),o=this._applyConstraints(n),r=Y.fromPoint(this._startRect).add(o),a=this._toAbsolutePoint(r).add(this._absoluteOffsetFromFlow);this._previewEl.style.transform=Lh(a)}onPointerUp(){this._previewEl&&this._previewEl.parentNode&&this._previewEl.parentNode.removeChild(this._previewEl),this._restoreOriginalInParent(),this._host.style.display=this._originalDisplay||"block",this._previewEl=void 0,this._placeholderEl=void 0,this._originalParent=void 0,this._originalNextSibling=null}_restoreOriginalInParent(){let i=this._originalParent,e=this._placeholderEl;if(!(!i||!e)){if(e.parentNode===i){i.replaceChild(this._host,e);return}this._originalNextSibling&&this._originalNextSibling.parentNode===i?i.insertBefore(this._host,this._originalNextSibling):i.appendChild(this._host)}}_matchSize(i,e){i.style.width=`${e.width}px`,i.style.height=`${e.height}px`}_readAbsoluteRect(i){let e=i.getBoundingClientRect(),n=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,o=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return H.initialize(e.left+o,e.top+n,e.width,e.height)}_toAbsolutePoint(i){let e=Y.fromPoint(this._transform.position).add(this._transform.scaledPosition);return Y.fromPoint(i).mult(this._transform.scale).add(e).add(this._getFlowHostAbsolutePosition())}_resolveDeltaFromPointer(i,e){let n=e?.getPosition();if(!n)return i;let o=this._clientToAbsolute(n).sub(this._grabOffsetFromPointer),r=this._toFlowPoint(o);return Y.fromPoint(r).sub(this._startRect)}_toFlowPoint(i){let e=this._getFlowHostAbsolutePosition(),n=Y.fromPoint(this._transform.position).add(this._transform.scaledPosition);return Y.fromPoint(i).sub(e).sub(n).div(this._transform.scale)}_getFlowHostAbsolutePosition(){let i=this._store.flowHost.getBoundingClientRect(),e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return A.initialize(i.left+n,i.top+e)}_clientToAbsolute(i){let e=this._browser.window.pageYOffset||this._browser.document.documentElement.scrollTop,n=this._browser.window.pageXOffset||this._browser.document.documentElement.scrollLeft;return Y.fromPoint(i).add(A.initialize(n,e))}};function Lh({x:t,y:i}){return`translate3d(${Math.round(t)}px, ${Math.round(i)}px, 0)`}var Rd=class{event;fTrigger;static fToken=Symbol("DragExternalItemPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function LC(t){return!!t.closest?.("[fExternalItem]")}function BC(t){return t.closest("[fExternalItem]")}var zC=(()=>{class t{_byHost=new Map;_items=W([]);items=D(()=>this._items());getByElement(e){let n=BC(e);return n?this._byHost.get(n):void 0}getByHost(e){return this._byHost.get(e)}register(e){let n=e.hostElement,o=this._byHost.get(n);o!==e&&(o&&o!==e&&this._byHost.delete(n),this._byHost.set(n,e),this._sync())}remove(e){let n=e.hostElement;this._byHost.get(n)===e&&(this._byHost.delete(n),this._sync())}_sync(){this._items.set([...this._byHost.values()])}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var VC=(()=>{let t=class Ma{_apiService=d(zC);_dragSession=d(Q);_store=d(M);_injector=d(Je);get _flowHost(){return this._store.flowHost}get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!dt(e.originalEvent,n))return;let o=this._resolveExternalItem(e.targetElement);if(!o||o.disabled())return;let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=Y.fromPoint(e.getPosition()).elementTransform(this._flowHost).div(r),this._dragSession.draggableItems=[new Nd(this._injector,o,e.getPosition())]}_resolveExternalItem(e){return this._apiService.getByElement(e)}static \u0275fac=function(n){return new(n||Ma)};static \u0275prov=y({token:Ma,factory:Ma.\u0275fac})};return t=C([x(Rd)],t),t})(),Od=class{event;static fToken=Symbol("PreventDefaultIsExternalItemRequest");constructor(i){this.event=i}},HC=(()=>{let t=class ka{handle(e){this._isTargetItemExternal(e.event)&&e.event.preventDefault()}_isTargetItemExternal(e){let n=this._isExternalItem(e.target),o=this._isExternalItem(e.target.parentNode);return n||o}_isExternalItem(e){let n=!1;try{n=LC(e)}catch{}return n}static \u0275fac=function(n){return new(n||ka)};static \u0275prov=y({token:ka,factory:ka.\u0275fac})};return t=C([x(Od)],t),t})(),GC=[kC,NC,AC,VC,HC],jC=(()=>{let t=class Na{_mediator=d(R);_dragContext=d(Q);_store=d(M);_dragInjector=d(je);get _allNodes(){return this._store.nodes.getAll()}handle({event:e}){if(!this._canPrepare())return;let n=this._allNodes.find(a=>a.isContains(e.targetElement));if(!n&&!this._hasExternalDrag())throw new Error("Drag target node not found");let o=this._sortedTargetsForDrop();if(n){let a=n.fParentId(),s=this._mediator.execute(new ll(a));s.length&&(o=o.filter(l=>s.includes(l.node.fId())))}let r=this._dragInjector.get(Fi);r.initialize(o),this._dragContext.draggableItems.push(r)}_canPrepare(){return this._hasMoveDrag()||this._hasExternalDrag()}_hasMoveDrag(){return this._dragContext.draggableItems.some(e=>e instanceof jt)}_hasExternalDrag(){return this._dragContext.draggableItems.some(e=>e instanceof Nd)}_sortedTargetsForDrop(){let e=this._getDraggedNodes(),n=e.some(s=>s instanceof Df),o=this._withParents(e),a=this._eligibleTargets(o,n).map(s=>{let l=this._mediator.execute(new Ie(s.hostElement));return{node:s,rect:l}});return this._mediator.execute(new Ed(a))}_getDraggedNodes(){let e=this._dragContext.draggableItems.find(n=>n instanceof jt);return e?e.items.map(n=>n.nodeOrGroup):[]}_withParents(e){return e.reduce((n,o)=>{n.push(o);let r=this._mediator.execute(new Zn(o));return n.push(...r),n},[])}_eligibleTargets(e,n){let o=this._allNodes.filter(r=>!e.includes(r));return n?o.filter(r=>r instanceof Df):o}static \u0275fac=function(n){return new(n||Na)};static \u0275prov=y({token:Na,factory:Na.\u0275fac})};return t=C([x(Pd)],t),t})(),UC=[MC,jC,DC],Fd=class{event;static fToken=Symbol("PinchToZoomFinalizeRequest");constructor(i){this.event=i}},WC=.5,Ad=(()=>{class t extends qe{type="pinch-to-zoom";kind="pinch-to-zoom";_store=d(M);get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.require(ye.ZOOM)}_startDistance=null;_startScale=null;_touches;initialize(e){this._touches=e}prepareDragSequence(){let e=Bh(this._touches);e!=null&&(this._startDistance=e,this._startScale=this._canvas.transform.scale)}onPointerMove(e,n){if(n.touches.length!==2||this._startDistance==null||this._startScale==null)return;let o=Bh(n.touches),r=$C(n.touches);if(o==null||r==null){this._reset();return}if(Math.abs(o-this._startDistance)<WC)return;n.preventDefault();let a=o/this._startDistance,s=this._clamp(this._startScale*a);this._canvas.setScale(s,this._castPositionToFlow(r)),this._canvas.redraw()}_clamp(e){return Math.max(this._zoomComponent.minimum,Math.min(e,this._zoomComponent.maximum))}_castPositionToFlow(e){return Y.fromPoint(e).elementTransform(this._flowHost)}_reset(){this._startScale=null,this._startDistance=null}onPointerUp(){this._reset(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();function $C(t){if(t.length!==2)return null;let i=t[0],e=t[1];return A.initialize((i.clientX+e.clientX)/2,(i.clientY+e.clientY)/2)}function Bh(t){if(t.length!==2)return null;let i=t[0],e=t[1];return Math.hypot(e.clientX-i.clientX,e.clientY-i.clientY)}var KC=(()=>{let t=class Ra{_dragSession=d(Q);handle(e){if(this._hasPinchZoomHandler())for(let n of this._dragSession.draggableItems)n.onPointerUp?.()}_hasPinchZoomHandler(){return this._dragSession.draggableItems.some(e=>e instanceof Ad)}static \u0275fac=function(n){return new(n||Ra)};static \u0275prov=y({token:Ra,factory:Ra.\u0275fac})};return t=C([x(Fd)],t),t})(),Ld=class{event;static fToken=Symbol("PinchToZoomPreparationRequest");constructor(i){this.event=i}},XC=(()=>{let t=class Oa{_dragInjector=d(je);_store=d(M);_dragSession=d(Q);handle({event:e}){this._canStart(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=new Y,this._dragSession.draggableItems=[this._getHandler(e)])}_canStart(e){return this._dragSession.isEmpty()&&e.touches?.length===2&&!e.isEventInLockedContext&&this._hasZoomComponent()}_hasZoomComponent(){return this._store.instances.has(ye.ZOOM)}_getHandler(e){let n=this._dragInjector.get(Ad);return n.initialize(e.touches),n}static \u0275fac=function(n){return new(n||Oa)};static \u0275prov=y({token:Oa,factory:Oa.\u0275fac})};return t=C([x(Ld)],t),t})(),qC=[XC,KC],Bd=class{event;static fToken=Symbol("SelectionAreaFinalizeRequest");constructor(i){this.event=i}},YC=(()=>{let t=class Fa{_dragSession=d(Q);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>e.getEvent().kind==="selection-area")}static \u0275fac=function(n){return new(n||Fa)};static \u0275prov=y({token:Fa,factory:Fa.\u0275fac})};return t=C([x(Bd)],t),t})(),Zf=(()=>{class t extends qe{type="selection-area";kind="selection-area";_store=d(M);_dragSession=d(Q);_mediator=d(R);_canBeSelected=[];_selectedByMove=[];get _transform(){return this._store.transform}get _canvasPosition(){return Y.fromPoint(this._transform.position).add(this._transform.scaledPosition)}get _instance(){return this._store.instances.require(ye.SELECTION_AREA)}prepareDragSequence(){this._canBeSelected=this._mediator.execute(new bl),this._show(),this._draw(H.initialize(this._dragSession.onPointerDownPosition.x,this._dragSession.onPointerDownPosition.y))}onPointerMove(e){let n=Y.fromPoint(e).add(this._dragSession.onPointerDownPosition),o=this._getMinimumPoint(this._dragSession.onPointerDownPosition,n),r=Math.abs(e.x),a=Math.abs(e.y),s=H.initialize(o.x,o.y,r,a);this._draw(s),this._selectedByMove=[],this._canBeSelected.forEach(l=>{l.element.unmarkAsSelected();let u=H.addPoint(H.mult(l.fRect,this._transform.scale),this._canvasPosition);H.intersectionWithRect(u,s)&&(l.element.markAsSelected(),this._selectedByMove.push(l.element))}),this._mediator.execute(new Bt)}_getMinimumPoint(e,n){return A.initialize(Math.min(e.x,n.x),Math.min(e.y,n.y))}onPointerUp(){this._hide(),this._dragSession.selectedItems.push(...this._selectedByMove),this._selectedByMove.length>0&&(this._dragSession.isSelectedChanged=!0)}_draw(e){let n=this._instance.hostElement.style;n.left=e.x+"px",n.top=e.y+"px",n.width=e.width+"px",n.height=e.height+"px"}_show(){this._instance.hostElement.style.display="block"}_hide(){this._instance.hostElement.style.display="none"}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),zd=class{event;static fToken=Symbol("SelectionAreaPreparationRequest");constructor(i){this.event=i}},ZC=(()=>{let t=class Aa{_store=d(M);_dragSession=d(Q);_dragInjector=d(je);get _instance(){return this._store.instances.get(ye.SELECTION_AREA)}handle(e){this._isValid(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=Y.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost),this._dragSession.draggableItems=[this._dragInjector.createInstance(Zf)])}_isValid(e){return!!this._instance&&this._dragSession.isEmpty()&&dt(e.event.originalEvent,this._instance.fTrigger)}static \u0275fac=function(n){return new(n||Aa)};static \u0275prov=y({token:Aa,factory:Aa.\u0275fac})};return t=C([x(zd)],t),t})(),QC=[ZC,YC],Vd=class{rect;childrenBounds;static fToken=Symbol("ApplyChildResizeConstraintsRequest");constructor(i,e){this.rect=i,this.childrenBounds=e}},JC=(()=>{let t=class La{handle({rect:e,childrenBounds:n}){n&&this._apply(e,n)}_apply(e,n){this._restrictLeft(e,n),this._restrictTop(e,n),this._restrictRight(e,n),this._restrictBottom(e,n),e.width=Math.max(0,e.width),e.height=Math.max(0,e.height)}_restrictLeft(e,n){let o=e.x-n.x;o>0&&(e.x-=o,e.width+=o)}_restrictTop(e,n){let o=e.y-n.y;o>0&&(e.y-=o,e.height+=o)}_restrictRight(e,n){let o=n.x+n.width;e.x+e.width<=o&&(e.width=o-e.x)}_restrictBottom(e,n){let o=n.y+n.height;e.y+e.height<=o&&(e.height=o-e.y)}static \u0275fac=function(n){return new(n||La)};static \u0275prov=y({token:La,factory:La.\u0275fac})};return t=C([x(Vd)],t),t})(),Hd=class{rect;limits;static fToken=Symbol("ApplyParentResizeConstraintsRequest");constructor(i,e){this.rect=i,this.limits=e}},ex=(()=>{let t=class Ba{_mediator=d(R);handle({rect:e,limits:n}){this._applyResizeConstraints(e,n)}_applyResizeConstraints(e,n){if(!n)return;let o=this._clampedCopyForCalculation(e,n);this._applySoftParentExpansions(o,n.softLimits),n.hardLimit&&this._clampRectToInner(e,n.hardLimit.innerRect)}_clampedCopyForCalculation(e,n){let o=se({},e);return n.hardLimit&&this._clampRectToInner(o,n.hardLimit.innerRect),o}_clampRectToInner(e,n){if(e.x<n.x){let a=n.x-e.x;e.x+=a,e.width-=a}if(e.y<n.y){let a=n.y-e.y;e.y+=a,e.height-=a}let o=n.x+n.width;e.x+e.width>o&&(e.width=o-e.x);let r=n.y+n.height;e.y+e.height>r&&(e.height=r-e.y),e.width=Math.max(0,e.width),e.height=Math.max(0,e.height)}_applySoftParentExpansions(e,n){if(n?.length)for(let o of n)this._expandParentFromOriginalIfOverflow(e,o)}_expandParentFromOriginalIfOverflow(e,n){let o=n.innerRect,r=n.boundingRect,a=this._computeOverflow(o,e);if(!this._hasOverflow(a)){this._applyParentRect(n,r);return}let s=this._buildExpandedParentRect(r,a);this._applyParentRect(n,s)}_hasOverflow(e){return!!(e.left||e.top||e.right||e.bottom)}_computeOverflow(e,n){let o=Math.max(0,e.x-n.x),r=Math.max(0,e.y-n.y),a=Math.max(0,n.x+n.width-(e.x+e.width)),s=Math.max(0,n.y+n.height-(e.y+e.height));return{left:o,top:r,right:a,bottom:s}}_buildExpandedParentRect(e,n){let o=se({},e);return n.left&&(o.x=e.x-n.left,o.width=e.width+n.left),n.top&&(o.y=e.y-n.top,o.height=e.height+n.top),n.right&&(o.width=(o.width??e.width)+n.right),n.bottom&&(o.height=(o.height??e.height)+n.bottom),o}_applyParentRect(e,n){e.nodeOrGroup.updatePosition(n),e.nodeOrGroup.updateSize(n),this._mediator.execute(new ln(e.nodeOrGroup.fId(),n)),e.nodeOrGroup.redraw()}static \u0275fac=function(n){return new(n||Ba)};static \u0275prov=y({token:Ba,factory:Ba.\u0275fac})};return t=C([x(Hd)],t),t})(),Gd=class{originalRect;difference;handleType;minimumSize;static fToken=Symbol("CalculateChangedRectFromDifferenceRequest");constructor(i,e,n,o){this.originalRect=i,this.difference=e,this.handleType=n,this.minimumSize=o}},zh={[yt.LEFT]:{x:-1,y:0},[yt.LEFT_TOP]:{x:-1,y:-1},[yt.TOP]:{x:0,y:-1},[yt.RIGHT_TOP]:{x:1,y:-1},[yt.RIGHT]:{x:1,y:0},[yt.RIGHT_BOTTOM]:{x:1,y:1},[yt.BOTTOM]:{x:0,y:1},[yt.LEFT_BOTTOM]:{x:-1,y:1}},tx=(()=>{let t=class za{handle({originalRect:e,difference:n,handleType:o,minimumSize:r}){let a=this._changeSizeInRect(e,n,zh[o],r);return this._changePosition(e,n,zh[o],a)}_changeSizeInRect(e,n,o,r){let a=e.width+o.x*n.x,s=e.height+o.y*n.y,l=0,u=0;return a<0&&(l=a,a=Math.abs(a)),a<r.width&&(o.x===-1&&(l+=a-r.width),a=r.width),s<0&&(u=s,s=Math.abs(s)),s<r.height&&(o.y===-1&&(u+=s-r.height),s=r.height),H.initialize(l,u,a,s)}_changePosition(e,n,o,r){let a=e.x+(o.x===-1?n.x:0)+r.x,s=e.y+(o.y===-1?n.y:0)+r.y;return H.initialize(a,s,r.width,r.height)}static \u0275fac=function(n){return new(n||za)};static \u0275prov=y({token:za,factory:za.\u0275fac})};return t=C([x(Gd)],t),t})(),jd=class{nodeOrGroup;paddings;static fToken=Symbol("CalculateDirectChildrenUnionRectRequest");constructor(i,e){this.nodeOrGroup=i,this.paddings=e}},nx=(()=>{let t=class Va{_mediator=d(R);_store=d(M);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle({nodeOrGroup:e,paddings:n}){let o=H.union(this._calculateDirectChildren(e.fId()).map(r=>this._normalizeRect(r)));return o?this._concatRectWithParentPadding(o,n):null}_calculateDirectChildren(e){return this._allNodesAndGroups.filter(n=>n.fParentId()===e)}_normalizeRect(e){return this._mediator.execute(new Ie(e.hostElement))}_concatRectWithParentPadding(e,n){return H.initialize(e.x-n[0],e.y-n[1],e.width+n[0]+n[2],e.height+n[1]+n[3])}static \u0275fac=function(n){return new(n||Va)};static \u0275prov=y({token:Va,factory:Va.\u0275fac})};return t=C([x(jd)],t),t})(),Hi=class{nodeOrGroup;rect;static fToken=Symbol("CalculateResizeLimitsRequest");constructor(i,e){this.nodeOrGroup=i,this.rect=e}},ix=(()=>{let t=class Ha{_mediator=d(R);handle({nodeOrGroup:e,rect:n}){let o=this._getParentsChain(e),r=this._calculateNodePaddings(e,n);return{limits:this._buildSoftHardLimits(o),childrenBounds:this._getNormalizedChildrenBounds(e,r),minimumSize:ft.initialize(r[0]+r[2],r[1]+r[3])}}_calculateNodePaddings(e,n){return this._mediator.execute(new hn(e,n))}_getNormalizedChildrenBounds(e,n){return this._mediator.execute(new jd(e,n))}_getParentsChain(e){return this._mediator.execute(new Zn(e))??[]}_buildSoftHardLimits(e){let n=[],o,r=[0,0,0,0];for(let a of e){let s=this._getParentInfo(a,r);if(r=s.paddings,this._isAutoExpand(a))n.push(this._makeLimit(a,s));else{o=this._makeLimit(a,s);break}}return{softLimits:n,hardLimit:o}}_getParentInfo(e,n){return this._mediator.execute(new Ai(e,n))}_isAutoExpand(e){return e.fAutoExpandOnChildHit()}_makeLimit(e,{boundingRect:n,innerRect:o}){return{nodeOrGroup:e,boundingRect:n,innerRect:o}}static \u0275fac=function(n){return new(n||Ha)};static \u0275prov=y({token:Ha,factory:Ha.\u0275fac})};return t=C([x(Hi)],t),t})(),Ud=class{event;static fToken=Symbol("ResizeNodeFinalizeRequest");constructor(i){this.event=i}},bm="node-resize",wm="resize-node";function ox(t){return t.getEvent().kind===wm||t.getEvent().fEventType===bm}var rx=(()=>{let t=class Ga{_dragSession=d(Q);handle(e){this._isNodeResizeHandler()&&this._dragSession.draggableItems.forEach(n=>n.onPointerUp?.())}_isNodeResizeHandler(){return this._dragSession.draggableItems.some(e=>ox(e))}static \u0275fac=function(n){return new(n||Ga)};static \u0275prov=y({token:Ga,factory:Ga.\u0275fac})};return t=C([x(Ud)],t),t})(),Qf=class{fNodeId;constructor(i){this.fNodeId=i}},Jf=(()=>{class t extends qe{type=bm;kind=wm;data(){return new Qf(this._nodeOrGroup.fId())}_mediator=d(R);_baselineRect;_constraints;_lastRect=null;_nodeOrGroup;_handleType;_nodeConnections={source:[],target:[]};_softParentConnections=[];initialize(e,n){this._nodeOrGroup=e,this._handleType=n}setNodeConnectionHandlers(e){this._nodeConnections=e}setSoftParentConnectionHandlers(e){this._softParentConnections=e}prepareDragSequence(){this._baselineRect=this._readBaselineRect(),this._constraints=this._buildConstraints(this._baselineRect),this._lastRect=this._baselineRect}onPointerMove(e){let n=this._calcNextRect(e);this._applyConstraints(n),this._commitRect(n),this._applyConnectionHandlers(this._nodeConnections);for(let o of this._softParentConnections)this._applyConnectionHandlers(o);this._lastRect=n}onPointerUp(){let e=this._lastRect??this._fallbackRectFromModel();this._nodeOrGroup.sizeChange.emit(e),requestAnimationFrame(()=>this._nodeOrGroup.refresh())}_readBaselineRect(){return this._mediator.execute(new Ie(this._nodeOrGroup.hostElement))}_buildConstraints(e){return this._mediator.execute(new Hi(this._nodeOrGroup,e))}_calcNextRect(e){return this._mediator.execute(new Gd(this._baselineRect,e,this._handleType,this._constraints.minimumSize))}_applyConstraints(e){this._mediator.execute(new Vd(e,this._constraints.childrenBounds)),this._mediator.execute(new Hd(e,this._constraints.limits))}_commitRect(e){this._nodeOrGroup.updatePosition({x:e.x,y:e.y}),this._nodeOrGroup.updateSize({width:e.width,height:e.height}),this._mediator.execute(new ln(this._nodeOrGroup.fId(),e)),this._nodeOrGroup.redraw()}_fallbackRectFromModel(){return H.initialize(this._nodeOrGroup._position.x,this._nodeOrGroup._position.y,this._nodeOrGroup._size?.width,this._nodeOrGroup._size?.height)}_applyConnectionHandlers(e){if(!e.source.length&&!e.target.length)return;let n=new Map;for(let o of e.source){let r=this._readConnectorRect(o.connector,n);o.handler.setSourceRect(r)}for(let o of e.target){let r=this._readConnectorRect(o.connector,n);o.handler.setTargetRect(r)}}_readConnectorRect(e,n){let o=`${e.kind}::${e.fId()}`,r=n.get(o);if(r)return r;let a=this._mediator.execute(new Ht(e.hostElement,!1));return n.set(o,a),a}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Gi=class{_mediator=d(R);_store=d(M);_behaviour=d(ni);_source;_target;_sourceRef;_targetRef;_sourceRect;_targetRect;connection;initialize(i){this.connection=i,this._source=this._store.outputs.require(this.connection.fOutputId()),this._target=this._store.inputs.require(this.connection.fInputId()),this._sourceRef=this._readRectRef(this._source),this._targetRef=this._readRectRef(this._target),this._sourceRect=De.fromRoundedRect(this._sourceRef.rect),this._targetRect=De.fromRoundedRect(this._targetRef.rect)}setSourceRect(i){this._sourceRect=De.fromRoundedRect(i),this._mediator.execute(new dn(this._source.fId(),this._source.kind,this._sourceRect))}setTargetRect(i){this._targetRect=De.fromRoundedRect(i),this._mediator.execute(new dn(this._target.fId(),this._target.kind,this._targetRect))}redraw(){let i=this._buildLine();this.connection.setLine(i),this.connection.redraw()}_buildLine(){let i=De.fromRoundedRect(this._sourceRect),e=De.fromRoundedRect(this._targetRect);return this._behaviour.handle(new ht(i,e,this.connection,this._sourceRef.connector.fConnectableSide,this._targetRef.connector.fConnectableSide,this._resolveRotationContext(this._sourceRef.connector),this._resolveRotationContext(this._targetRef.connector)))}_readRectRef(i){return{connector:i,rect:this._mediator.execute(new Ht(i.hostElement,!1))}}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},ax=(()=>{class t extends Gi{_sourceUpdated=!1;_targetUpdated=!1;setSourceRect(e){super.setSourceRect(e),this._sourceUpdated=!0,this._redrawIfReady()}setTargetRect(e){super.setTargetRect(e),this._targetUpdated=!0,this._redrawIfReady()}_redrawIfReady(){!this._sourceUpdated||!this._targetUpdated||(this._sourceUpdated=!1,this._targetUpdated=!1,super.redraw())}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),sx=(()=>{class t extends Gi{setSourceRect(e){super.setSourceRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),cx=(()=>{class t extends Gi{setTargetRect(e){super.setTargetRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Wd=class{event;fTrigger;static fToken=Symbol("ResizeNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},$d=class{handler;nodeOrGroup;static fToken=Symbol("AttachResizeConnectionDragHandlersToNodeRequest");constructor(i,e){this.handler=i,this.nodeOrGroup=e}},dx=(()=>{let t=class ja{_store=d(M);_mediator=d(R);_dragInjector=d(je);handle({handler:e,nodeOrGroup:n}){let o=this._readSoftParents(n),r=[n,...o],a=this._collectSourceConnectorIds(r),s=this._collectTargetConnectorIds(r),l=new Map;e.setNodeConnectionHandlers(this._buildConnectionHandlersForNode(n,a,s,l)),e.setSoftParentConnectionHandlers(o.map(u=>this._buildConnectionHandlersForNode(u,a,s,l)))}_readSoftParents(e){let n=this._mediator.execute(new Ie(e.hostElement));return this._mediator.execute(new Hi(e,n)).limits.softLimits.map(r=>r.nodeOrGroup)}_collectSourceConnectorIds(e){let n=new Set(e.map(o=>o.fId()));return new Set(this._store.outputs.getAll().filter(o=>n.has(o.fNodeId)).map(o=>o.fId()))}_collectTargetConnectorIds(e){let n=new Set(e.map(o=>o.fId()));return new Set(this._store.inputs.getAll().filter(o=>n.has(o.fNodeId)).map(o=>o.fId()))}_buildConnectionHandlersForNode(e,n,o,r){let a=this._store.outputs.getAll().filter(g=>g.fNodeId===e.fId()),s=this._store.inputs.getAll().filter(g=>g.fNodeId===e.fId());if(!a.length&&!s.length)return{source:[],target:[]};let l=new Set(a.map(g=>g.fId())),u=new Set(s.map(g=>g.fId())),h={source:[],target:[]};for(let g of this._store.connections.getAll()){let w=l.has(g.fOutputId()),b=u.has(g.fInputId());if(!w&&!b)continue;let P=r.get(g.fId())??this._createConnectionHandler(g,n,o);if(r.set(g.fId(),P),w){let T=this._store.outputs.require(g.fOutputId());h.source.push({handler:P,connector:T})}if(b){let T=this._store.inputs.require(g.fInputId());h.target.push({handler:P,connector:T})}}return h}_createConnectionHandler(e,n,o){let r=n.has(e.fOutputId()),a=o.has(e.fInputId()),s=r&&a?this._dragInjector.createInstance(ax):r?this._dragInjector.createInstance(sx):this._dragInjector.createInstance(cx);return s.initialize(e),s}static \u0275fac=function(n){return new(n||ja)};static \u0275prov=y({token:ja,factory:ja.\u0275fac})};return t=C([x($d)],t),t})(),lx=(()=>{let t=class Ua{_mediator=d(R);_store=d(M);_dragSession=d(Q);_dragInjector=d(je);get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!this._isResizeHandle(e.targetElement)||!dt(e.originalEvent,n))return;let o=this._findResizableNode(e.targetElement);if(!o)return;this._selectBeforeResize(o);let r=this._transform.scale??1;this._dragSession.onPointerDownScale=r,this._dragSession.onPointerDownPosition=Y.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(r);let a=this._dragInjector.createInstance(Jf);a.initialize(o,this._readResizeHandleType(e.targetElement)),this._mediator.execute(new $d(a,o)),this._dragSession.draggableItems=[a]}_isResizeHandle(e){return _i(e,".f-resize-handle")}_findResizableNode(e){let n=this._store.nodes.getAll().find(o=>o.isContains(e));if(n)return n.fDraggingDisabled()?void 0:n}_selectBeforeResize(e){queueMicrotask(()=>{this._mediator.execute(new ei(e))})}_readResizeHandleType(e){let n=_h(e,"fResizeHandleType",".f-resize-handle");return yt[n]}static \u0275fac=function(n){return new(n||Ua)};static \u0275prov=y({token:Ua,factory:Ua.\u0275fac})};return t=C([x(Wd)],t),t})(),ux=[JC,ex,tx,nx,ix,dx,rx,lx],Kd=class{event;static fToken=Symbol("RotateNodeFinalizeRequest");constructor(i){this.event=i}},Sm="node-rotate",Im="rotate-node";function fx(t){return t.getEvent().kind===Im||t.getEvent().fEventType===Sm}var px=(()=>{let t=class Wa{_dragSession=d(Q);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>fx(e))}static \u0275fac=function(n){return new(n||Wa)};static \u0275prov=y({token:Wa,factory:Wa.\u0275fac})};return t=C([x(Kd)],t),t})(),Xd=class{event;fTrigger;static fToken=Symbol("RotateNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},ep=class{fNodeId;constructor(i){this.fNodeId=i}};function hx(t,i,e){let{x:n,y:o}=mx(t,i,e),r=n-t.x,a=o-t.y;return{x:r,y:a}}function mx(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,a=Math.cos(r),s=Math.sin(r),l=n*a-o*s,u=n*s+o*a,h=l+e.x,g=u+e.y;return{x:h,y:g}}var tp=(()=>{class t extends qe{type=Sm;kind=Im;data(){return new ep(this._nodeOrGroup.fId())}_store=d(M);_mediator=d(R);_dragSession=d(Q);_nodeOrGroup;_sourceConnections;_targetConnections;_startRotation=0;_nodeRect;_nodeCenter;_pointerDownInFlow;_rotationOffsetDeg=0;get _transform(){return this._store.transform}initialize(e,n,o){this._nodeOrGroup=e,this._sourceConnections=n,this._targetConnections=o,this._startRotation=this._nodeOrGroup._rotate}prepareDragSequence(){this._nodeRect=this._readNodeRect(),this._nodeCenter=this._nodeRect.gravityCenter,this._pointerDownInFlow=this._calculatePointerDownInFlow();let e=this._angleDeg(this._pointerDownInFlow);this._rotationOffsetDeg=e-this._startRotation}onPointerMove(e){let n=A.sum(this._pointerDownInFlow,e),r=this._angleDeg(n)-this._rotationOffsetDeg;this._applyRotation(r);let a=r-this._startRotation;for(let s of this._sourceConnections)s.connection.setSourceDelta(this._deltaAfterRotation(s.connector,a));for(let s of this._targetConnections)s.connection.setTargetDelta(this._deltaAfterRotation(s.connector,a))}onPointerUp(){this._nodeOrGroup.rotate.set(this._nodeOrGroup._rotate),this._nodeOrGroup.refresh()}_readNodeRect(){return this._mediator.execute(new Ie(this._nodeOrGroup.hostElement))}_calculatePointerDownInFlow(){return A.sub(this._dragSession.onPointerDownPosition,A.sum(this._transform.position,this._transform.scaledPosition))}_angleDeg(e){return Math.atan2(e.y-this._nodeCenter.y,e.x-this._nodeCenter.x)*(180/Math.PI)}_applyRotation(e){this._nodeOrGroup.updateRotate(e),this._nodeOrGroup.redraw()}_deltaAfterRotation(e,n){return hx(e,n,this._nodeCenter)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),_x=(()=>{let t=class $a{_mediator=d(R);_store=d(M);_dragContext=d(Q);_dragInjector=d(je);get _transform(){return this._store.transform}handle(e){if(!this._isPreparationAllowed(e))return;let n=this._findRotatableNode(e.event.targetElement);if(!n)return;this._selectBeforeRotate(n);let o=this._transform.scale;this._dragContext.onPointerDownScale=o,this._dragContext.onPointerDownPosition=Y.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(o);let r=this._dragInjector.createInstance(tp);r.initialize(n,this._buildOutputConnectionHandlers(n),this._buildInputConnectionHandlers(n)),this._dragContext.draggableItems=[r]}_isPreparationAllowed({event:e,fTrigger:n}){return this._dragContext.isEmpty()&&zv(e.targetElement)&&dt(e.originalEvent,n)}_findRotatableNode(e){for(let n of this._store.nodes.getAll())if(!n.fDraggingDisabled()&&n.isContains(e))return n}_selectBeforeRotate(e){queueMicrotask(()=>{this._mediator.execute(new ei(e))})}_buildInputConnectionHandlers(e){return this._mediator.execute(new el(e)).map(n=>{let o=this._store.inputs.require(n.fInputId()),r=this._mediator.execute(new at(o)),a=this._dragInjector.get(Vi);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}_buildOutputConnectionHandlers(e){return this._mediator.execute(new dl(e)).map(n=>{let o=this._store.outputs.require(n.fOutputId()),r=this._mediator.execute(new at(o)),a=this._dragInjector.get(Bi);return a.initialize(n),{connection:a,connector:r.rect.gravityCenter}})}static \u0275fac=function(n){return new(n||$a)};static \u0275prov=y({token:$a,factory:$a.\u0275fac})};return t=C([x(Xd)],t),t})(),gx=[px,_x],ji=class{flowRect;canvasPosition;eventPoint;minimap;static fToken=Symbol("CalculateFlowPointFromMinimapPointRequest");constructor(i,e,n,o){this.flowRect=i,this.canvasPosition=e,this.eventPoint=n,this.minimap=o}},yx=(()=>{let t=class Ka{_store=d(M);get _canvasScale(){return this._store.transform.scale||1}handle(e){return A.sub(e.canvasPosition,A.sub(this._getPositionInViewBox(e.eventPoint,e.minimap),this._getNormalizedFlowCenter(e.flowRect)))}_getNormalizedFlowCenter(e){return Y.fromPoint(e.gravityCenter).sub(e)}_getPositionInViewBox(e,n){let o=this.normalizeEventPoint(e,n);return A.sum(o,H.mult(n.viewBox,this._canvasScale))}normalizeEventPoint(e,n){return this._getEventPointInMinimap(e,n).mult(n.scale).mult(this._canvasScale)}_getEventPointInMinimap(e,n){return Y.fromPoint(e).elementTransform(n.element)}static \u0275fac=function(n){return new(n||Ka)};static \u0275prov=y({token:Ka,factory:Ka.\u0275fac})};return t=C([x(ji)],t),t})(),qd=class{event;static fToken=Symbol("DragMinimapFinalizeRequest");constructor(i){this.event=i}},vx=(()=>{let t=class Xa{_dragSession=d(Q);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(Cx)}static \u0275fac=function(n){return new(n||Xa)};static \u0275prov=y({token:Xa,factory:Xa.\u0275fac})};return t=C([x(qd)],t),t})(),Tm="minimap",Pm="minimap";function Cx(t){return t.getEvent().kind===Pm||t.getEvent().fEventType===Tm}var np=(()=>{class t extends qe{type=Tm;kind=Pm;_store=d(M);_mediator=d(R);_lastDelta=null;_flowRect;_startCanvasPosition;_eventPoint;_minimap;initialize(e,n,o,r){this._flowRect=e,this._startCanvasPosition=n,this._eventPoint=o,this._minimap=r}prepareDragSequence(){this._store.fCanvas?.hostElement.classList.add("f-scaled-animate")}onPointerMove(e){this._lastDelta&&this._isSamePoint(e,this._lastDelta)||(this._lastDelta=e,this._store.fCanvas?.setPosition(this._getNewPosition(Y.fromPoint(this._eventPoint).add(e))),this._store.fCanvas?.redraw())}_isSamePoint(e,n){return e.x===n.x&&e.y===n.y}_getNewPosition(e){return this._mediator.execute(new ji(this._flowRect,this._startCanvasPosition,e,this._minimap))}onPointerUp(){this._store.fCanvas?.hostElement.classList.remove("f-scaled-animate"),this._store.fCanvas?.emitCanvasChangeEvent()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Yd=class{event;static fToken=Symbol("DragMinimapPreparationRequest");constructor(i){this.event=i}},xx=(()=>{let t=class qa{_store=d(M);_mediator=d(R);_dragSession=d(Q);_dragInjector=d(je);get _canvas(){return this._store.fCanvas}get _flowHost(){return this._store.flowHost}handle({event:e}){if(!this._isValid(e))return;let n=this._store.instances.require(ye.MINIMAP).state,o=e.getPosition(),r=Y.fromPoint(this._store.transform.position),a=H.fromElement(this._flowHost);this._canvas.setPosition(this._calculateCanvasPosition(a,o,n)),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent(),this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=Y.fromPoint(o).elementTransform(this._flowHost);let s=this._dragInjector.createInstance(np);s.initialize(a,r,o,n),this._dragSession.draggableItems=[s]}_isValid(e){return!(!this._dragSession.isEmpty()||!this._flowHost.contains(e.targetElement)||!e.targetElement.closest(".f-minimap")||!this._store.instances.get(ye.MINIMAP))}_calculateCanvasPosition(e,n,o){return this._mediator.execute(new ji(e,Y.fromPoint(this._canvas.transform.position),n,o))}static \u0275fac=function(n){return new(n||qa)};static \u0275prov=y({token:qa,factory:qa.\u0275fac})};return t=C([x(Yd)],t),t})(),bx=[yx,vx,xx];function wx(t){return!!t&&typeof t.destroy=="function"}var je=(()=>{class t{_injector=d(Je);_dragInjector=null;_created=[];create(){this._dragInjector=Je.create({providers:[{provide:Zd,useClass:Zd},{provide:ud,useClass:ud},{provide:nd,useClass:nd},{provide:Of,useClass:Of},{provide:Fi,useClass:Fi},{provide:Bi,useClass:Bi},{provide:Vi,useClass:Vi},{provide:zi,useClass:zi},{provide:jt,useClass:jt},{provide:Ad,useClass:Ad},{provide:Zf,useClass:Zf},{provide:Jf,useClass:Jf},{provide:tp,useClass:tp},{provide:np,useClass:np}],parent:this._injector}),this._created=[]}get(e){if(!this._dragInjector)throw new Error("DragHandlerInjector has not been created. Call create() before using get().");return this._dragInjector.get(e)}createInstance(e){if(!this._dragInjector)throw new Error("DragHandlerInjector is not created");let n=Np(this._dragInjector,()=>new e);return this._created.push(n),n}destroy(){for(let e of this._created)wx(e)&&e.destroy();this._created=[],this._dragInjector?.destroy?.(),this._dragInjector=null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Ut=(()=>{class t{_data;setData(e){this._data=se(se({},this._data),e)}getData(){return this._data}clear(){this._data=void 0}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Vh="f-canvas-dragging",Hh="canvas-dragging",Zd=(()=>{class t extends qe{type="canvas-move";kind="drag-canvas";_store=d(M);_onPointerDownPosition=A.initialize();constructor(){super(),this._store.fCanvas?.hostElement.classList.add(Vh,Hh)}prepareDragSequence(){this._onPointerDownPosition=this._store.transform.position}onPointerMove(e){this._store.fCanvas?.setPosition(Y.fromPoint(this._onPointerDownPosition).add(e)),this._store.fCanvas?.redraw()}onPointerUp(){this._store.fCanvas?.emitCanvasChangeEvent(),this._store.fCanvas?.hostElement.classList.remove(Vh,Hh)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Sx=(()=>{let t=class Ya{_dragContext=d(Q);handle(e){this._isValid()&&this._dragContext.draggableItems.forEach(n=>n.onPointerUp?.())}_isValid(){return this._dragContext.draggableItems.some(e=>e instanceof Zd)}static \u0275fac=function(n){return new(n||Ya)};static \u0275prov=y({token:Ya,factory:Ya.\u0275fac})};return t=C([x(Zc)],t),t})(),Qd=class{event;fTrigger;static fToken=Symbol("DragCanvasPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Ix=(()=>{let t=class Za{_store=d(M);_dragContext=d(Q);_dragInjector=d(je);handle({event:e,fTrigger:n}){!this._isValid(e)||!this._isValidTrigger(e,n)||(this._dragContext.onPointerDownScale=1,this._dragContext.onPointerDownPosition=Y.fromPoint(e.getPosition()).elementTransform(this._store.flowHost),this._dragContext.draggableItems=[this._dragInjector.get(Zd)])}_isValid(e){return this._dragContext.isEmpty()&&(this._isBackgroundElement(e.targetElement)||this._isDragOnHost(e.targetElement))}_isBackgroundElement(e){return this._store.instances.get(ye.BACKGROUND)?.hostElement.contains(e)}_isDragOnHost(e){return this._store.flowHost.contains(e)&&!this._getNode(e)}_getNode(e){let n=this._store.nodes.getAll().find(o=>o.isContains(e));return n&&n.fDraggingDisabled()&&(n=void 0),n}_isValidTrigger(e,n){return dt(e.originalEvent,n)}static \u0275fac=function(n){return new(n||Za)};static \u0275prov=y({token:Za,factory:Za.\u0275fac})};return t=C([x(Qd)],t),t})(),Tx=[Sx,Ix],Jd=class{event;trigger;static fToken=Symbol("SelectByPointerRequest");constructor(i,e){this.event=i,this.trigger=e}},Px=(()=>{let t=class Qa{_mediator=d(R);_store=d(M);_dragSession=d(Q);handle({event:e,trigger:n}){if(!this._isSelectionAllowed(e))return;let o=this._resolveSelectable(e.targetElement);this._deferRaiseLayerFor(o),dt(e.originalEvent,n)?this._applyToggleSelect(o):this._applySingleSelect(o)}_isSelectionAllowed(e){return this._store.flowHost.contains(e.targetElement)&&this._dragSession.isEmpty()}_resolveSelectable(e){return this._findNodeOrGroupAt(e)??this._findConnectionAt(e)}_findNodeOrGroupAt(e){return this._store.nodes.getAll().find(n=>n.isContains(e))}_findConnectionAt(e){return this._store.connections.getAll().find(n=>n.isContains(e))}_deferRaiseLayerFor(e){e&&queueMicrotask(()=>{this._mediator.execute(new mn(e,e.hostElement.parentElement))})}_applySingleSelect(e){if(!e||e.fSelectionDisabled()){this._clearSelection();return}e.isSelected()||(this._clearSelection(),this._select(e))}_applyToggleSelect(e){!e||e.fSelectionDisabled()||(e.isSelected()?this._deselect(e):this._select(e))}_clearSelection(){if(this._dragSession.selectedItems.length){for(let e of this._dragSession.selectedItems)e.unmarkAsSelected();this._dragSession.markSelectionAsChanged(),this._dragSession.selectedItems=[]}}_select(e){this._dragSession.selectedItems.push(e),e.markAsSelected(),this._dragSession.markSelectionAsChanged()}_deselect(e){let n=this._dragSession.selectedItems.indexOf(e);n>=0&&this._dragSession.selectedItems.splice(n,1),e.unmarkAsSelected(),this._dragSession.markSelectionAsChanged()}static \u0275fac=function(n){return new(n||Qa)};static \u0275prov=y({token:Qa,factory:Qa.\u0275fac})};return t=C([x(Jd)],t),t})(),Ex=[Px];var ip=class extends wf{hostElement=d(we).nativeElement};function Dx(t){return _i(t,".f-drag-blocker")}var Em=(()=>{class t extends ip{_result=d(Ut);_mediator=d(R);_platform=d(Lu);disabled=!1;fMultiSelectTrigger=e=>this._platform.getOS()===Ft.MAC_OS?e.metaKey:e.ctrlKey;fReassignConnectionTrigger=pt;fCreateConnectionTrigger=pt;fConnectionWaypointsTrigger=F(pt);fMoveControlPointTrigger=pt;fNodeResizeTrigger=pt;fNodeRotateTrigger=pt;fNodeMoveTrigger=pt;fCanvasMoveTrigger=pt;fExternalItemTrigger=pt;fSelectionChange=new _t;fNodeIntersectedWithConnections=new _t;fNodeConnectionsIntersection=Ee();fEmitOnNodeIntersect=!1;fCreateNode=new _t;fMoveNodes=new _t;fReassignConnection=new _t;fCreateConnection=new _t;fConnectionWaypointsChanged=Ee();fDropToGroup=new _t;vCellSize=F(1,{transform:e=>Ke(e,1)});hCellSize=F(1,{transform:e=>Ke(e,1)});fCellSizeWhileDragging=F(!1,{transform:e=>xe(e)});fDragStarted=new _t;fDragEnded=new _t;_dragHandlerInjector=d(je);ngOnInit(){this._mediator.execute(new il(this))}ngAfterViewInit(){super.subscribe()}onPointerDown(e){if(Dx(e.targetElement))return!1;this._dragHandlerInjector.create(),this._result.clear(),this._mediator.execute(new rl),this._mediator.execute(new zd(e)),this._mediator.execute(new Yd(e)),this._mediator.execute(new Ld(e)),this._mediator.execute(new Jd(e,this.fMultiSelectTrigger)),this._mediator.execute(new sd(e,this.fReassignConnectionTrigger)),this._mediator.execute(new rd(e,this.fCreateConnectionTrigger)),this._mediator.execute(new fd(e,this.fConnectionWaypointsTrigger()));let n=e.isMouseLeftButton();return n||this.finalizeDragSequence(),n}prepareDragSequence(e){this._mediator.execute(new Wd(e,this.fNodeResizeTrigger)),this._mediator.execute(new Xd(e,this.fNodeRotateTrigger)),this._mediator.execute(new Td(e,this.fNodeMoveTrigger)),this._mediator.execute(new Rd(e,this.fExternalItemTrigger)),this._mediator.execute(new Pd(e)),this._mediator.execute(new Qd(e,this.fCanvasMoveTrigger)),this._mediator.execute(new al)}onSelect(e){this._mediator.execute(new Od(e))}onPointerMove(e){this._mediator.execute(new ol(e))}onPointerUp(e){this._mediator.execute(new qd(e)),this._mediator.execute(new Bd(e)),this._mediator.execute(new ad(e)),this._mediator.execute(new td(e)),this._mediator.execute(new Ud(e)),this._mediator.execute(new Kd(e)),this._mediator.execute(new Id(e)),this._mediator.execute(new kd(e)),this._mediator.execute(new pd(e)),this._mediator.execute(new Zc(e)),this._mediator.execute(new Fd(e)),this._mediator.execute(new dd(e)),this._mediator.execute(new Wc)}finalizeDragSequence(){this._mediator.execute(new Gt),this._mediator.execute(new ki),this._result.clear(),this._dragHandlerInjector.destroy()}ngOnDestroy(){this._mediator.execute(new Gt),this._mediator.execute(new sl),super.unsubscribe()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,selectors:[["f-flow","fDraggable",""]],inputs:{disabled:[2,"fDraggableDisabled","disabled",xe],fMultiSelectTrigger:"fMultiSelectTrigger",fReassignConnectionTrigger:"fReassignConnectionTrigger",fCreateConnectionTrigger:"fCreateConnectionTrigger",fConnectionWaypointsTrigger:[1,"fConnectionWaypointsTrigger"],fMoveControlPointTrigger:"fMoveControlPointTrigger",fNodeResizeTrigger:"fNodeResizeTrigger",fNodeRotateTrigger:"fNodeRotateTrigger",fNodeMoveTrigger:"fNodeMoveTrigger",fCanvasMoveTrigger:"fCanvasMoveTrigger",fExternalItemTrigger:"fExternalItemTrigger",fEmitOnNodeIntersect:[2,"fEmitOnNodeIntersect","fEmitOnNodeIntersect",xe],vCellSize:[1,"vCellSize"],hCellSize:[1,"hCellSize"],fCellSizeWhileDragging:[1,"fCellSizeWhileDragging"]},outputs:{fSelectionChange:"fSelectionChange",fNodeIntersectedWithConnections:"fNodeIntersectedWithConnections",fNodeConnectionsIntersection:"fNodeConnectionsIntersection",fCreateNode:"fCreateNode",fMoveNodes:"fMoveNodes",fReassignConnection:"fReassignConnection",fCreateConnection:"fCreateConnection",fConnectionWaypointsChanged:"fConnectionWaypointsChanged",fDropToGroup:"fDropToGroup",fDragStarted:"fDragStarted",fDragEnded:"fDragEnded"},exportAs:["fDraggable"],standalone:!1,features:[ge([Ut,je]),_e]})}return t})(),Mx=[...Tx,...aC,...Ev,...Ex,...GC,...Av,...bx,...EC,...UC,...ux,...gx,...QC,...qC],kx=(()=>{let t=class Ja{_store=d(M);handle({waypointIndex:e,connectionId:n}){let o=this._store.connections.require(n),r=o.fWaypoints()?.waypoints().slice();if(!r)throw new Error("Connection waypoints not found");r.splice(e,1),o.fWaypoints()?.waypoints.set(r),this._store.fDraggable?.fConnectionWaypointsChanged.emit(this._changeEvent(o))}_changeEvent(e){return new ld(e.fId(),e.fWaypoints()?.waypoints()||[])}static \u0275fac=function(n){return new(n||Ja)};static \u0275prov=y({token:Ja,factory:Ja.\u0275fac})};return t=C([x(vf)],t),t})(),op=class{static fToken=Symbol("RemoveSnapConnectionFromStoreRequest")},Nx=(()=>{let t=class es{_store=d(M);handle(e){this._store.connections.removeInstanceForSnap()}static \u0275fac=function(n){return new(n||es)};static \u0275prov=y({token:es,factory:es.\u0275fac})};return t=C([x(op)],t),t})(),Rx=[Bl,_n,T0,P0,E0,D0,xy,Zy,Ty,Wy,rv,ov,Yy,sv,dv,cv,qy,nv,Py,pv,Xy,Ky,$y,Vy,Uy,Hy,Gy,av,ev,lv,uv,iv,tv,fv,hv,mv,_v,Nx,kx],Ui=class{instance;static fToken=Symbol("AddConnectorToStoreRequest");constructor(i){this.instance=i}},Ox=(()=>{let t=class ts{_store=d(M);_mediator=d(R);handle({instance:e}){switch(e.kind){case"input":this._addInput(e);break;case"output":this._addOutput(e);break;case"outlet":this._addOutlet(e);break;default:throw new Error(`Unknown connector kind: ${e.kind}`)}}_addInput(e){this._store.inputs.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_addOutput(e){this._store.outputs.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_addOutlet(e){this._store.outlets.add(e),this._store.emitNodeChanges(),this._geometryRegister(e)}_geometryRegister(e){this._mediator.execute(new Ic(e.fId(),e.fNodeId,e.kind,e.hostElement))}static \u0275fac=function(n){return new(n||ts)};static \u0275prov=y({token:ts,factory:ts.\u0275fac})};return t=C([x(Ui)],t),t})(),pn=class{position;connectorRefs;static fToken=Symbol("CalculateClosestConnectorRequest");constructor(i,e){this.position=i,this.connectorRefs=e}},Fx=(()=>{let t=class ns{handle({position:e,connectorRefs:n}){let o,r=1/0;for(let a of n){let s=this._distanceToRect(e,a.rect);s<r&&(r=s,o=a)}return o?li(se({},o),{distance:r}):void 0}_distanceToRect(e,{x:n,y:o,width:r,height:a}){let s=this._clamp(e.x,n,n+r),l=this._clamp(e.y,o,o+a),u=e.x-s,h=e.y-l;return Math.sqrt(u*u+h*h)}_clamp(e,n,o){return Math.max(n,Math.min(o,e))}static \u0275fac=function(n){return new(n||ns)};static \u0275prov=y({token:ns,factory:ns.\u0275fac})};return t=C([x(pn)],t),t})(),Wi=class{pointerPosition;connectableConnectors;static fToken=Symbol("FindConnectableConnectorUsingPriorityAndPositionRequest");constructor(i,e){this.pointerPosition=i,this.connectableConnectors=e}},Ax=(()=>{let t=class is{_mediator=d(R);_store=d(M);_browser=d(ke);get _transform(){return this._store.transform}get _flowHost(){return this._store.flowHost}get _fNodes(){return this._store.nodes.getAll()}get _snapConnection(){return this._store.connections.getForSnap()}handle(e){let n=this._findConnectorAtPosition(e);return n.length>0?n[0]:void 0}_findConnectorAtPosition(e){let n=[];n.push(...this._filterConnectorsThatLocatedAtPosition(e));let o=this._isSnapConnectionEnabledAndHasClosestConnector(e);o&&n.unshift(o.connector);let r=this._getFirstConnectableConnectorOfNodeAtPosition(e);return r&&n.push(r),n}_filterConnectorsThatLocatedAtPosition(e){return e.connectableConnectors.filter(n=>H.isIncludePoint(n.rect,this._calculatePointerInFlow(e.pointerPosition))).map(n=>n.connector)}_calculatePointerInFlow(e){return ii(e,this._flowHost,this._transform)}_isSnapConnectionEnabledAndHasClosestConnector(e){if(!this._snapConnection)return;let n=this._mediator.execute(new pn(this._calculatePointerInFlow(e.pointerPosition),e.connectableConnectors));return this._isValidClosestInput(n)?n:void 0}_isValidClosestInput(e){return!!e&&e.distance<this._snapConnection.fSnapThreshold}_getFirstConnectableConnectorOfNodeAtPosition(e){return this._getElementsFromPoint(e.pointerPosition).map(n=>this._findConnectableNode(n)).filter(n=>!!n).map(n=>this._findFirstConnectableConnectorOfNode(e.connectableConnectors,n)).find(n=>!!n)}_getElementsFromPoint(e){return this._browser.document.elementsFromPoint(e.x,e.y)}_findConnectableNode(e){return this._fNodes.find(n=>n.isContains(e)&&n.fConnectOnNode())}_findFirstConnectableConnectorOfNode(e,n){return e.find(o=>o.connector.fNodeId===n.fId())?.connector}static \u0275fac=function(n){return new(n||is)};static \u0275prov=y({token:is,factory:is.\u0275fac})};return t=C([x(Wi)],t),t})(),$i=class{source;pointer;static fToken=Symbol("CalculateTargetConnectorsToConnectRequest");constructor(i,e){this.source=i,this.pointer=e}},at=class{connector;static fToken=Symbol("GetConnectorRectReferenceRequest");constructor(i){this.connector=i}},Lx=(()=>{let t=class os{_mediator=d(R);handle({connector:e}){return{connector:e,rect:this._getRect(e)}}_getRect(e){return this._mediator.execute(new Ht(e.hostElement))}static \u0275fac=function(n){return new(n||os)};static \u0275prov=y({token:os,factory:os.\u0275fac})};return t=C([x(at)],t),t})(),Ki=class{nodeOrGroup;static fToken=Symbol("AddNodeToStoreRequest");constructor(i){this.nodeOrGroup=i}},Bx=(()=>{let t=class rs{_store=d(M);_mediator=d(R);handle({nodeOrGroup:e}){this._store.nodes.add(e),this._mediator.execute(new Tc(e.fId(),e.hostElement,e)),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||rs)};static \u0275prov=y({token:rs,factory:rs.\u0275fac})};return t=C([x(Ki)],t),t})(),el=class{nodeOrGroup;static fToken=Symbol("CalculateInputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},zx=(()=>{let t=class as{_store=d(M);handle({nodeOrGroup:e}){let n=this._collectInputIds(e);return this._collectConnections(n)}_collectInputIds(e){let n=new Set,o=this._store.inputs.getAll();for(let r of o)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],o=this._store.connections.getAll();for(let r of o)e.has(r.fInputId())&&n.push(r);return n}static \u0275fac=function(n){return new(n||as)};static \u0275prov=y({token:as,factory:as.\u0275fac})};return t=C([x(el)],t),t})(),Xn=class{connector;pointerPosition;static fToken=Symbol("CalculateConnectableSideByConnectedPositionsRequest");constructor(i,e){this.connector=i,this.pointerPosition=e}},Gh=2,$e=(function(t){return t[t.NONE=0]="NONE",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.TOP=4]="TOP",t[t.BOTTOM=8]="BOTTOM",t[t.ALL=15]="ALL",t})($e||{});function Vx(t,i,e,n,o){let r=Hx(o),a=e-t,s=n-i,l=Gx(a,s);return jx(l,r)?l:Ux(a,s,r,l)}function Hx(t){if(!t||t.length===0)return $e.ALL;let i=$e.NONE;for(let e=0;e<t.length;e++)switch(t[e]){case L.LEFT:i|=$e.LEFT;break;case L.RIGHT:i|=$e.RIGHT;break;case L.TOP:i|=$e.TOP;break;case L.BOTTOM:i|=$e.BOTTOM;break}return i||$e.ALL}function Gx(t,i){let e=t<0?-t:t,n=i<0?-i:i;return e-n>Gh?t<0?L.LEFT:L.RIGHT:(n-e>Gh,i<0?L.TOP:L.BOTTOM)}function jx(t,i){switch(t){case L.LEFT:return(i&$e.LEFT)!==0;case L.RIGHT:return(i&$e.RIGHT)!==0;case L.TOP:return(i&$e.TOP)!==0;case L.BOTTOM:return(i&$e.BOTTOM)!==0;default:return!0}}function Ux(t,i,e,n){let o=n,r=-1/0;if(e&$e.RIGHT){let a=t;a>r&&(r=a,o=L.RIGHT)}if(e&$e.LEFT){let a=-t;a>r&&(r=a,o=L.LEFT)}if(e&$e.BOTTOM){let a=i;a>r&&(r=a,o=L.BOTTOM)}if(e&$e.TOP){let a=-i;a>r&&(r=a,o=L.TOP)}return o}function tl(t){return t===L.CALCULATE||t===L.CALCULATE_HORIZONTAL||t===L.CALCULATE_VERTICAL}var Wx={[L.CALCULATE]:[L.TOP,L.BOTTOM,L.LEFT,L.RIGHT],[L.CALCULATE_HORIZONTAL]:[L.LEFT,L.RIGHT],[L.CALCULATE_VERTICAL]:[L.TOP,L.BOTTOM]},$x=(()=>{let t=class ss{_mediator=d(R);handle({connector:e,pointerPosition:n}){let o=e.userFConnectableSide,r=this._getConnectorRect(e.hostElement).gravityCenter,a=this._accumulateConnectedCenters(e.hostElement,e.toConnector,n),s=a.sumX/a.count,l=a.sumY/a.count;return Vx(r.x,r.y,s,l,Wx[o])}_accumulateConnectedCenters(e,n,o){let r=o?.x||0,a=o?.y||0,s=o?1:0;if(n&&n.length)for(let l=0;l<n.length;l++){let u=n[l].hostElement;if(u===e)continue;let h=this._getConnectorRect(u).gravityCenter;r+=h.x,a+=h.y,s++}return{sumX:r,sumY:a,count:s}}_getConnectorRect(e){return this._mediator.execute(new Ie(e))}static \u0275fac=function(n){return new(n||ss)};static \u0275prov=y({token:ss,factory:ss.\u0275fac})};return t=C([x(Xn)],t),t})(),nl=class{connector;static fToken=Symbol("CalculateConnectableSideByInternalPositionRequest");constructor(i){this.connector=i}},il=class{fComponent;static fToken=Symbol("AddDndToStoreRequest");constructor(i){this.fComponent=i}},Kx=(()=>{let t=class cs{_store=d(M);handle(e){this._store.fDraggable=e.fComponent}static \u0275fac=function(n){return new(n||cs)};static \u0275prov=y({token:cs,factory:cs.\u0275fac})};return t=C([x(il)],t),t})(),ol=class{event;static fToken=Symbol("OnPointerMoveRequest");constructor(i){this.event=i}},Xx=(()=>{let t=class ds{_mediator=d(R);_store=d(M);get _hostElement(){return this._store.fDraggable?.hostElement}_dragContext=d(Q);handle({event:e}){this._dragContext.rememberPointerEvent(e),this._setDifferenceToDraggableItems(this._getDifferenceBetweenPointerAndPointerDown(e),e),this._mediator.execute(new Ni)}_setDifferenceToDraggableItems(e,n){this._dragContext.draggableItems.forEach(o=>{o.onPointerMove(se({},e),n)})}_getDifferenceBetweenPointerAndPointerDown(e){return this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition)}_getPointerPositionInCanvas(e){return Y.fromPoint(e.getPosition()).elementTransform(this._hostElement)}static \u0275fac=function(n){return new(n||ds)};static \u0275prov=y({token:ds,factory:ds.\u0275fac})};return t=C([x(ol)],t),t})(),rl=class{static fToken=Symbol("InitializeDragSequenceRequest")},qx=(()=>{let t=class ls{_dragContext=d(Q);handle(e){this._dragContext.reset()}static \u0275fac=function(n){return new(n||ls)};static \u0275prov=y({token:ls,factory:ls.\u0275fac})};return t=C([x(rl)],t),t})(),Wt=class{static fToken=Symbol("IsDragStartedRequest")},Yx=(()=>{let t=class us{_store=d(M);handle(e){return!!this._store.fDraggable?.isDragStarted}static \u0275fac=function(n){return new(n||us)};static \u0275prov=y({token:us,factory:us.\u0275fac})};return t=C([x(Wt)],t),t})(),al=class{static fToken=Symbol("PrepareDragSequenceRequest")},Zx=(()=>{let t=class fs{_mediator=d(R);_dragContext=d(Q);handle(e){this._callPrepareDragSequence(),this._mediator.execute(new $c)}_callPrepareDragSequence(){this._dragContext.draggableItems.forEach(e=>e.prepareDragSequence?.())}static \u0275fac=function(n){return new(n||fs)};static \u0275prov=y({token:fs,factory:fs.\u0275fac})};return t=C([x(al)],t),t})(),sl=class{static fToken=Symbol("RemoveDndFromStoreRequest")},Qx=(()=>{let t=class ps{_store=d(M);handle(e){this._store.fDraggable=void 0}static \u0275fac=function(n){return new(n||ps)};static \u0275prov=y({token:ps,factory:ps.\u0275fac})};return t=C([x(sl)],t),t})(),Jx=[Kx,Xx,qx,Zx,Yx,Qx],eb=new pe("CONNECTABLE_SIDE_EPSILON"),tb=(()=>{let t=class hs{_mediator=d(R);_lastSide=new WeakMap;_epsilon=Math.max(0,d(eb,{optional:!0})??2);handle({connector:e}){if(this._isDragging()){let o=this._lastSide.get(e);if(o!==void 0)return o;let r=this._getSideByDelta(e.hostElement,e.fNodeHost,e);return this._lastSide.set(e,r),r}let n=this._getSideByDelta(e.hostElement,e.fNodeHost,e);return this._lastSide.set(e,n),n}_getSideByDelta(e,n,o){let r=H.fromElement(e),a=n.getBoundingClientRect(),s=r.gravityCenter.x,l=r.gravityCenter.y,u=s-a.left,h=a.right-s,g=l-a.top,w=a.bottom-l,b=0,P=u,T=[u,h,g,w];for(let O=1;O<4;O++){let V=T[O];V<P&&(P=V,b=O)}let k=b===0?L.LEFT:b===1?L.RIGHT:b===2?L.TOP:L.BOTTOM,N=this._lastSide.get(o);if(N!==void 0&&N!==k){let O=N===L.LEFT?0:N===L.RIGHT?1:N===L.TOP?2:3;(O===0?u:O===1?h:O===2?g:w)-P<=this._epsilon&&(k=N)}return k}_isDragging(){return this._mediator.execute(new Wt)}static \u0275fac=function(n){return new(n||hs)};static \u0275prov=y({token:hs,factory:hs.\u0275fac})};return t=C([x(nl)],t),t})(),qn=class{nodeOrGroup;static fToken=Symbol("CalculateConnectorsConnectableSidesRequest");constructor(i){this.nodeOrGroup=i}},nb=(()=>{let t=class ms{_mediator=d(R);handle({nodeOrGroup:e}){let n=e.connectors,o=n.length;for(let a=0;a<o;a++){let s=n[a];s.fConnectableSide=this._resolveSideForConnectorFast(s)}let r=new Set;for(let a=0;a<o;a++){let l=n[a].toConnector;if(l&&l.length)for(let u=0,h=l.length;u<h;u++){let g=l[u],w=g.userFConnectableSide;tl(w)&&r.add(g)}}r.size>0&&r.forEach(a=>{a.fConnectableSide=this._calculateByConnectedPositions(a)})}_resolveSideForConnectorFast(e){let n=e.userFConnectableSide;return n===L.AUTO?this._mediator.execute(new nl(e)):tl(n)?this._calculateByConnectedPositions(e):n}_calculateByConnectedPositions(e){return this._mediator.execute(new Xn(e))}static \u0275fac=function(n){return new(n||ms)};static \u0275prov=y({token:ms,factory:ms.\u0275fac})};return t=C([x(qn)],t),t})(),Yn=class{static fToken=Symbol("CalculateNodesBoundingBoxRequest")},ib=(()=>{let t=class _s{_store=d(M);handle(e){return H.union(this._nodesRects())}_nodesRects(){return this._store.nodes.getAll().map(e=>H.fromElement(e.hostElement))}static \u0275fac=function(n){return new(n||_s)};static \u0275prov=y({token:_s,factory:_s.\u0275fac})};return t=C([x(Yn)],t),t})(),cl=class{fNodes;static fToken=Symbol("CalculateNodesBoundingBoxNormalizedPositionRequest");constructor(i){this.fNodes=i}},ob=(()=>{let t=class gs{_store=d(M);_mediator=d(R);handle(e){return H.union(this._getNodesRects(e.fNodes||this._store.nodes.getAll()))}_getNodesRects(e){return e.map(n=>this._getNodeRect(n))}_getNodeRect(e){let n=this._mediator.execute(new $n(e.hostElement));if(n)return this._getElementRect(e,n);let o=this._mediator.execute(new Ie(e.hostElement));return this._getElementRect(e,o)}_getElementRect(e,n){return H.initialize(e._position.x,e._position.y,n.width,n.height)}static \u0275fac=function(n){return new(n||gs)};static \u0275prov=y({token:gs,factory:gs.\u0275fac})};return t=C([x(cl)],t),t})(),dl=class{nodeOrGroup;static fToken=Symbol("CalculateOutputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},rb=(()=>{let t=class ys{_store=d(M);handle({nodeOrGroup:e}){let n=this._collectOutputIds(e);return this._collectConnections(n)}_collectOutputIds(e){let n=new Set,o=this._store.outputs.getAll();for(let r of o)e.isContains(r.hostElement)&&n.add(r.fId());return n}_collectConnections(e){let n=[],o=this._store.connections.getAll();for(let r of o)e.has(r.fOutputId())&&n.push(r);return n}static \u0275fac=function(n){return new(n||ys)};static \u0275prov=y({token:ys,factory:ys.\u0275fac})};return t=C([x(dl)],t),t})(),Xi=class{nodeOrGroup;static fToken=Symbol("FitToChildNodesAndGroupsRequest");constructor(i){this.nodeOrGroup=i}},hn=class{fNode;rect;static fToken=Symbol("GetNodePaddingRequest");constructor(i,e){this.fNode=i,this.rect=e}},ab=(()=>{let t=class vs{_browser=d(ke);handle(e){return e.fNode.fIncludePadding()?this._getPaddingData(e.fNode,e.rect):[0,0,0,0]}_getPaddingData(e,n){let o=this._browser.window.getComputedStyle(e.hostElement);return[this._browser.toPixels(o.paddingLeft,n.width,n.height,o.fontSize),this._browser.toPixels(o.paddingTop,n.width,n.height,o.fontSize),this._browser.toPixels(o.paddingRight,n.width,n.height,o.fontSize),this._browser.toPixels(o.paddingBottom,n.width,n.height,o.fontSize)]}static \u0275fac=function(n){return new(n||vs)};static \u0275prov=y({token:vs,factory:vs.\u0275fac})};return t=C([x(hn)],t),t})(),sb=(()=>{let t=class Cs{_mediator=d(R);_store=d(M);get _nodes(){return this._store.nodes.getAll()}handle({nodeOrGroup:e}){if(e.fAutoSizeToFitChildren()){let r=this._calculateDirectChildren(e);if(r.length){let a=this._boundingRect(e),s=this._calculateChildrenBounding(r,this._paddings(e,a));e.updatePosition(s),e.updateSize(s),e.redraw()}}let n=e.fParentId();if(!n)return;let o=this._nodes.find(r=>r.fId()===n);o&&this._mediator.execute(new Xi(o))}_calculateDirectChildren(e){return this._nodes.filter(n=>n.fParentId()===e.fId())}_unionRect(e){return H.union(e.map(n=>this._boundingRect(n)))||H.initialize()}_boundingRect(e){return this._mediator.execute(new Ie(e.hostElement))}_paddings(e,n){return this._mediator.execute(new hn(e,n))}_calculateChildrenBounding(e,[n,o,r,a]){let s=this._unionRect(e);return s=H.initialize(s.x-n,s.y-o,s.width+n+r,s.height+o+a),s}static \u0275fac=function(n){return new(n||Cs)};static \u0275prov=y({token:Cs,factory:Cs.\u0275fac})};return t=C([x(Xi)],t),t})(),ll=class{id;static fToken=Symbol("GetChildNodeIdsRequest");constructor(i){this.id=i}},cb=(()=>{let t=class xs{_store=d(M);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle(e){if(!e.id)return[];let n=new Set,o=[];return this._collectDescendants(e.id,o,n),o}_collectDescendants(e,n,o){if(o.has(e))throw new Error(`Circular reference detected in the node hierarchy. Node id: ${e}`);o.add(e);let r=this._allNodesAndGroups.filter(a=>a.fParentId()===e).map(a=>a.fId());n.push(...r);for(let a of r)this._collectDescendants(a,n,o)}static \u0275fac=function(n){return new(n||xs)};static \u0275prov=y({token:xs,factory:xs.\u0275fac})};return t=C([x(ll)],t),t})(),Zn=class{nodeOrGroup;static fToken=Symbol("GetParentNodesRequest");constructor(i){this.nodeOrGroup=i}},db=(()=>{let t=class bs{_store=d(M);handle({nodeOrGroup:e}){return this._getParentNodes(e,new Set,[])}_getParentNodes(e,n,o){if(n.has(e.fId()))throw new Error("Circular reference detected in the node hierarchy. Node id: "+e.fId());n.add(e.fId());let r=this._store.nodes.get(e.fParentId());return r?(o.push(r),this._getParentNodes(r,n,o)):o}static \u0275fac=function(n){return new(n||bs)};static \u0275prov=y({token:bs,factory:bs.\u0275fac})};return t=C([x(Zn)],t),t})(),qi=class{nodeOrGroup;destroyRef;static fToken=Symbol("UpdateNodeWhenStateOrSizeChangedRequest");constructor(i,e){this.nodeOrGroup=i,this.destroyRef=e}},lb=(()=>{let t=class ws{_mediator=d(R);handle({nodeOrGroup:e,destroyRef:n}){let{hostElement:o,stateChanges:r}=e;new vt(new Zu(o),r).listen(n,()=>{this._mediator.execute(new sn),this._isDragging()||(this._mediator.execute(new Wn(e.fId(),"UpdateNodeWhenStateOrSizeChanged")),this._mediator.execute(new qn(e)),this._mediator.execute(new Xi(e)))})}_isDragging(){return this._mediator.execute(new Wt)}static \u0275fac=function(n){return new(n||ws)};static \u0275prov=y({token:ws,factory:ws.\u0275fac})};return t=C([x(qi)],t),t})(),Yi=class{instance;static fToken=Symbol("RemoveNodeFromStoreRequest");constructor(i){this.instance=i}},ub=(()=>{let t=class Ss{_store=d(M);_mediator=d(R);handle({instance:e}){this._store.nodes.remove(e),this._mediator.execute(new Pc(e.fId())),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Ss)};static \u0275prov=y({token:Ss,factory:Ss.\u0275fac})};return t=C([x(Yi)],t),t})(),fb=[Bx,$x,tb,zx,nb,ib,ob,rb,sb,cb,ab,db,lb,ub],pb=(()=>{let t=class Is{_mediator=d(R);_store=d(M);get _targets(){return this._store.inputs.getAll()}handle({source:e,pointer:n}){let o=this._getConnectableTargets(e),r=[];for(let a of o)r.push(this._mediator.execute(new at(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableTargets(e){if(e.hasConnectionLimits)return this._targets.filter(o=>e.canConnectTo(o));let n=this._targets.filter(o=>o.canBeConnected);return e.isSelfConnectable||(n=n.filter(o=>o.fNodeId!==e.fNodeId)),n}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:o}of e)tl(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Xn(e,n))}static \u0275fac=function(n){return new(n||Is)};static \u0275prov=y({token:Is,factory:Is.\u0275fac})};return t=C([x($i)],t),t})(),ul=class{target;pointer;static fToken=Symbol("CalculateSourceConnectorsToConnectRequest");constructor(i,e){this.target=i,this.pointer=e}},hb=(()=>{let t=class Ts{_mediator=d(R);_store=d(M);get _sources(){return this._store.outputs.getAll()}handle({target:e,pointer:n}){let o=this._getConnectableSources(e),r=[];for(let a of o)r.push(this._mediator.execute(new at(a)));return this._scheduleApplyCalculatedSides(r,n),r}_getConnectableSources(e){return this._sources.filter(n=>{let o=n.canBeConnected;return o&&n.hasConnectionLimits&&(o=n.canConnectTo(e)),o})}_scheduleApplyCalculatedSides(e,n){queueMicrotask(()=>this._applyCalculatedConnectableSides(e,n))}_applyCalculatedConnectableSides(e,n){for(let{connector:o}of e)tl(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new Xn(e,n))}static \u0275fac=function(n){return new(n||Ts)};static \u0275prov=y({token:Ts,factory:Ts.\u0275fac})};return t=C([x(ul)],t),t})(),Qn=class{connectors;static fToken=Symbol("MarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},Oe={DRAG_AND_DROP:{DRAGGING:"f-dragging",CONNECTIONS_DRAGGING:"f-connections-dragging"},GROUPING:{OVER_BOUNDARY:"f-grouping-over-boundary",DROP_ACTIVE:"f-grouping-drop-active"},CONNECTOR:{OUTPUT_CONNECTED:"f-node-output-connected",OUTPUT_NOT_CONNECTABLE:"f-node-output-not-connectable",INPUT_CONNECTED:"f-node-input-connected",INPUT_NOT_CONNECTABLE:"f-node-input-not-connectable",CONNECTABLE:"f-connector-connectable"}},mb=(()=>{let t=class Ps{_store=d(M);handle({connectors:e}){this._store.flowHost.classList.add(Oe.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._markConnector(n))}_markConnector({hostElement:e}){e.classList.add(Oe.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||Ps)};static \u0275prov=y({token:Ps,factory:Ps.\u0275fac})};return t=C([x(Qn)],t),t})(),Zi=class{instance;static fToken=Symbol("RemoveConnectorFromStoreRequest");constructor(i){this.instance=i}},_b=(()=>{let t=class Es{_store=d(M);_mediator=d(R);handle({instance:e}){switch(e.kind){case"input":this._removeInput(e);break;case"output":this._removeOutput(e);break;case"outlet":this._removeOutlet(e);break;default:throw new Error(`Unknown connector kind: ${e.kind}`)}}_removeInput(e){this._store.inputs.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_removeOutput(e){this._store.outputs.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_removeOutlet(e){this._store.outlets.removeById(e.fId()),this._store.emitNodeChanges(),this._geometryUnregister(e)}_geometryUnregister(e){this._mediator.execute(new bi(e.fId(),e.kind))}static \u0275fac=function(n){return new(n||Es)};static \u0275prov=y({token:Es,factory:Es.\u0275fac})};return t=C([x(Zi)],t),t})(),Jn=class{connectors;static fToken=Symbol("UnmarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},gb=(()=>{let t=class Ds{_store=d(M);handle({connectors:e}){this._store.flowHost.classList.remove(Oe.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._unmarkConnector(n))}_unmarkConnector({hostElement:e}){e.classList.remove(Oe.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||Ds)};static \u0275prov=y({token:Ds,factory:Ds.\u0275fac})};return t=C([x(Jn)],t),t})(),yb=[Ox,_b,Fx,Ax,hb,pb,Lx,mb,gb],fl=class{instance;static fToken=Symbol("AddFlowToStoreRequest");constructor(i){this.instance=i}};var yi=(function(t){return t.MANUAL="manual",t.AUTO="auto",t})(yi||{});function vb(t){let i=[...t.nodes.map(jh),...t.groups.map(jh)],e=new Set(t.nodes.map(s=>s.id)),n=new Set(t.groups.map(s=>s.id)),o=new Map,r=new Map;for(let s of[...t.nodes,...t.groups]){for(let l of s.fOutputs)o.set(l.id,s.id);for(let l of s.fInputs)r.set(l.id,s.id)}let a=t.connections.reduce((s,l)=>{let u=o.get(l.fOutputId),h=r.get(l.fInputId);return!u||!h||s.push({source:u,target:h}),s},[]);return{nodes:i,connections:a,nodeIds:e,groupIds:n}}function jh(t){return{id:t.id,size:t.measuredSize?se({},t.measuredSize):t.size?se({},t.size):void 0}}var Cb=1,Dm=(()=>{class t{_destroyRef=d(We);_flows=new Map;_engine;constructor(){this._destroyRef.onDestroy(()=>{Array.from(this._flows.keys()).forEach(e=>this.unregisterFlow(e)),this._engine=void 0})}attachEngine(e){this._engine=e}registerFlow(e,n){let o=e.fId();this.unregisterFlow(o);let r={flow:e,store:n,nodeSignature:this._buildNodeSignature(n),connectionSignature:this._buildConnectionSignature(n),timeoutId:null,raf1:null,raf2:null,unsubs:[],runId:0,isApplying:!1};r.unsubs.push(n.nodesChanges$.listen(()=>this._handleNodesChanges(o)),n.connectionsChanges$.listen(()=>this._handleConnectionsChanges(o))),this._flows.set(o,r),this._engine?.getMode()===yi.AUTO&&this._scheduleRelayout(o)}unregisterFlow(e){let n=this._flows.get(e);n&&(n.unsubs.forEach(o=>o()),this._clearScheduledWork(n),this._flows.delete(e))}handleModeChanged(e){if(e===yi.AUTO)for(let n of this._flows.keys())this._scheduleRelayout(n)}async relayout(e){if(this._engine){if(e){let n=this._flows.get(e);n&&await this._relayoutRegisteredFlow(e,n);return}for(let[n,o]of this._flows.entries())await this._relayoutRegisteredFlow(n,o)}}_handleNodesChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let o=this._buildNodeSignature(n.store);o!==n.nodeSignature&&(n.nodeSignature=o,this._scheduleRelayout(e))}_handleConnectionsChanges(e){let n=this._flows.get(e);if(!n||n.isApplying)return;let o=this._buildConnectionSignature(n.store);o!==n.connectionSignature&&(n.connectionSignature=o,this._scheduleRelayout(e))}_scheduleRelayout(e){let n=this._flows.get(e);!n||!this._engine||this._engine.getMode()!==yi.AUTO||(n.timeoutId!==null&&clearTimeout(n.timeoutId),this._cancelAnimationFrames(n),n.timeoutId=setTimeout(()=>{n.timeoutId=null,this._runAfterNextPaint(n,()=>{this._relayoutFlowIfReady(e)})},Cb))}async _relayoutFlowIfReady(e){let n=this._flows.get(e);if(!(!n||!this._engine||this._engine.getMode()!==yi.AUTO)){if(n.store.hasPendingProgressiveRender){this._scheduleRelayout(e);return}await this._relayoutRegisteredFlow(e,n)}}async _relayoutRegisteredFlow(e,n){if(!this._engine)return;let o=vb(n.flow.getState({measuredSize:!0})),r=++n.runId,a=await this._engine.calculate(o.nodes,o.connections,{flowId:e,mode:this._engine.getMode()}),s=this._flows.get(e);if(!(!s||s.runId!==r||!this._applyPositions(s.store,a.nodes).length)){s.isApplying=!0;try{s.flow.redraw(),this._emitWriteback(e,a.nodes,o.nodeIds,o.groupIds)}finally{queueMicrotask(()=>{let u=this._flows.get(e);u&&(u.isApplying=!1)})}}}_emitWriteback(e,n,o,r){let a=this._engine?.getWriteback();a&&a({flowId:e,nodes:n.filter(s=>o.has(s.id)),groups:n.filter(s=>r.has(s.id))})}_applyPositions(e,n){return n.filter(o=>{let r=e.nodes.get(o.id);return!r||A.isEqual(r._position,o.position)?!1:(r.position.set(se({},o.position)),!0)})}_buildNodeSignature(e){return e.nodes.getAll().map(n=>n.fId()).sort().join("|")}_buildConnectionSignature(e){return e.connections.getAll().map(n=>`${n.fId()}:${n.fOutputId()}:${n.fInputId()}`).sort().join("|")}_runAfterNextPaint(e,n){if(this._cancelAnimationFrames(e),typeof requestAnimationFrame!="function"){n();return}e.raf1=requestAnimationFrame(()=>{e.raf1=null,e.raf2=requestAnimationFrame(()=>{e.raf2=null,n()})})}_clearScheduledWork(e){e.timeoutId!==null&&(clearTimeout(e.timeoutId),e.timeoutId=null),this._cancelAnimationFrames(e)}_cancelAnimationFrames(e){e.raf1!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(e.raf1),e.raf1=null),e.raf2!==null&&typeof cancelAnimationFrame=="function"&&(cancelAnimationFrame(e.raf2),e.raf2=null)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();var xb=(()=>{let t=class Ms{_store=d(M);_layoutController=d(Dm,{optional:!0});handle({instance:e}){this._store.fFlow=e,this._layoutController?.registerFlow(e,this._store)}static \u0275fac=function(n){return new(n||Ms)};static \u0275prov=y({token:Ms,factory:Ms.\u0275fac})};return t=C([x(fl)],t),t})(),pl=class{static fToken=Symbol("GetFlowRequest")},bb=(()=>{let t=class ks{_store=d(M);handle(e){let n=this._store.fFlow;if(!n)throw new Error("Flow not found in store");return n}static \u0275fac=function(n){return new(n||ks)};static \u0275prov=y({token:ks,factory:ks.\u0275fac})};return t=C([x(pl)],t),t})(),hl=class{static fToken=Symbol("CalculateConnectionsStateRequest")},wb=(()=>{let t=class Ns{_store=d(M);handle(e){return this._store.connections.getAll().map(this._mapToConnectionState)}_mapToConnectionState(e){return{id:e.fId(),fOutputId:e.fOutputId(),fInputId:e.fInputId(),fType:e.fType,fBehavior:e.fBehavior,isSelected:e.isSelected(),waypoints:e.fWaypoints()?.waypoints()||[],fInputSide:e.fInputSide(),fOutputSide:e.fOutputSide()}}static \u0275fac=function(n){return new(n||Ns)};static \u0275prov=y({token:Ns,factory:Ns.\u0275fac})};return t=C([x(hl)],t),t})(),Qi=class{component;measuredSize;static fToken=Symbol("CalculateNodesStateRequest");constructor(i,e=!1){this.component=i,this.measuredSize=e}},Sb=(()=>{let t=class Rs{_store=d(M);_mediator=d(R);handle({component:e,measuredSize:n}){return this._store.nodes.getAll().filter(o=>o instanceof e).map(o=>{let r=n?this._mediator.execute(new Ie(o.hostElement)):null;return{id:o.fId(),parentId:o.fParentId()??void 0,position:se({},o._position),size:o._size?se({},o._size):void 0,measuredSize:r?{width:r.width,height:r.height}:void 0,rotate:o._rotate,fOutputs:this._getOutputs(o.hostElement),fInputs:this._getInputs(o.hostElement),isSelected:o.isSelected()}})}_getOutputs(e){return this._store.outputs.getAll().filter(n=>e.contains(n.hostElement)).map(n=>({id:n.fId(),fConnectableSide:n.fConnectableSide}))}_getInputs(e){return this._store.inputs.getAll().filter(n=>e.contains(n.hostElement)).map(n=>({id:n.fId(),fConnectableSide:n.fConnectableSide}))}static \u0275fac=function(n){return new(n||Rs)};static \u0275prov=y({token:Rs,factory:Rs.\u0275fac})};return t=C([x(Qi)],t),t})(),ml=class{measuredSize;static fToken=Symbol("CalculateFlowStateRequest");constructor(i=!1){this.measuredSize=i}},Ib=(()=>{let t=class Os{_mediator=d(R);_store=d(M);get _canvas(){return this._store.fCanvas}get _transform(){return this._canvas.transform}get _canvasPosition(){return A.sum(this._transform.position,this._transform.scaledPosition)}handle({measuredSize:e}){return{position:this._canvasPosition,scale:this._canvas.transform.scale,nodes:this._mediator.execute(new Qi(Vl,e)),groups:this._mediator.execute(new Qi(Df,e)),connections:this._mediator.execute(new hl)}}static \u0275fac=function(n){return new(n||Os)};static \u0275prov=y({token:Os,factory:Os.\u0275fac})};return t=C([x(ml)],t),t})(),Tb=[Ib,Sb,wb],_l=class{instance;static fToken=Symbol("RemoveFlowFromStoreRequest");constructor(i){this.instance=i}},Pb=(()=>{let t=class Fs{_store=d(M);_layoutController=d(Dm,{optional:!0});handle({instance:e}){this._layoutController?.unregisterFlow(e.fId()),this._store.fFlow=void 0}static \u0275fac=function(n){return new(n||Fs)};static \u0275prov=y({token:Fs,factory:Fs.\u0275fac})};return t=C([x(_l)],t),t})(),Hl=(()=>{class t{isNodesRendered=!1;isFullRendered=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),gl=class{static fToken=Symbol("NotifyNodesRenderedRequest")},lp=new pe("F_FLOW"),rp=class{},Eb=(()=>{let t=class As{_state=d(Hl);_fFlow=d(lp);handle(e){this._state.isNodesRendered||(this._state.isNodesRendered=!0,this._fFlow.fNodesRendered.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||As)};static \u0275prov=y({token:As,factory:As.\u0275fac})};return t=C([x(gl)],t),t})(),yl=class{static fToken=Symbol("NotifyFullRenderedRequest")},Db=(()=>{let t=class Ls{_state=d(Hl);_fFlow=d(lp);handle(e){this._state.isFullRendered||(this._state.isFullRendered=!0,this._fFlow.fFullRendered.emit(this._fFlow.fId()),this._fFlow.fLoaded.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||Ls)};static \u0275prov=y({token:Ls,factory:Ls.\u0275fac})};return t=C([x(yl)],t),t})(),Ji=class{targetConnectionsRevision;targetNodesRevision;callback;destroyRef;static fToken=Symbol("WaitForConnectionsRenderedRequest");constructor(i,e,n,o){this.targetConnectionsRevision=i,this.targetNodesRevision=e,this.callback=n,this.destroyRef=o}},Mb=(()=>{let t=class Bs{_store=d(M);handle({targetConnectionsRevision:e,targetNodesRevision:n,callback:o,destroyRef:r}){if(this._store.connectionsRenderedRevision>=e&&this._store.connectionsRenderedNodesRevision>=n){o();return}let a=this._store.connectionsRenderedChanges$.listen(()=>{this._store.connectionsRenderedRevision<e||this._store.connectionsRenderedNodesRevision<n||(a(),o())});r.onDestroy(a)}static \u0275fac=function(n){return new(n||Bs)};static \u0275prov=y({token:Bs,factory:Bs.\u0275fac})};return t=C([x(Ji)],t),t})(),vl=class{static fToken=Symbol("ResetRenderLifecycleRequest")},kb=(()=>{let t=class zs{_state=d(Hl);handle(e){this._state.isNodesRendered=!1,this._state.isFullRendered=!1}static \u0275fac=function(n){return new(n||zs)};static \u0275prov=y({token:zs,factory:zs.\u0275fac})};return t=C([x(vl)],t),t})(),Cl=class{destroyRef;static fToken=Symbol("QueueConnectionRedrawRequest");constructor(i){this.destroyRef=i}},Mm=(()=>{class t{isWaitingForViewportAnimation=!1;pendingRedraw=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})(),Nb=(()=>{let t=class Vs{_state=d(Mm);_store=d(M);_mediator=d(R);handle(e){if(this._state.pendingRedraw=!0,this._state.isWaitingForViewportAnimation)return;this._state.isWaitingForViewportAnimation=!0;let n=this._store.viewportAnimationChanges$.listen(()=>{if(this._store.isViewportAnimating)return;let o=this._state.pendingRedraw;n(),this._state.isWaitingForViewportAnimation=!1,this._state.pendingRedraw=!1,o&&this._mediator.execute(new Ei)});e.destroyRef.onDestroy(n)}static \u0275fac=function(n){return new(n||Vs)};static \u0275prov=y({token:Vs,factory:Vs.\u0275fac})};return t=C([x(Cl)],t),t})(),Rb=[xb,bb,...Tb,Pb,Hl,Eb,Db,Mb,kb,Mm,Nb],xl=class{static fToken=Symbol("ClearSelectionRequest")},Ob=(()=>{let t=class Hs{_dragContext=d(Q);handle(e){this._dragContext.selectedItems.forEach(n=>n.unmarkAsSelected()),this._dragContext.selectedItems=[],this._dragContext.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Hs)};static \u0275prov=y({token:Hs,factory:Hs.\u0275fac})};return t=C([x(xl)],t),t})(),bl=class{static fToken=Symbol("CalculateSelectableItemsRequest")},Fb=(()=>{let t=class Gs{_mediator=d(R);_store=d(M);_dragContext=d(Q);get _nodes(){return this._store.nodes.getAll()}get _connections(){return this._store.connections.getAll()}handle(){return[...this._nodeRects(),...this._connectionRects()].filter(e=>!this._dragContext.selectedItems.includes(e.element))}_nodeRects(){return this._nodes.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new Ie(e.hostElement))}))}_connectionRects(){return this._connections.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new Ie(e.boundingElement))}))}static \u0275fac=function(n){return new(n||Gs)};static \u0275prov=y({token:Gs,factory:Gs.\u0275fac})};return t=C([x(bl)],t),t})(),eo=class{static fToken=Symbol("GetCurrentSelectionRequest")},Ab=(()=>{let t=class js{_dragContext=d(Q);handle(){return{fNodeIds:this._getSelectedNodes(),fGroupIds:this._getSelectedGroups(),fConnectionIds:this._getSelectedConnections()}}_getSelectedNodes(){return this._dragContext.selectedItems.filter(e=>e.hostElement.classList.contains("f-node")).map(e=>e.hostElement.dataset.fNodeId)}_getSelectedGroups(){return this._dragContext.selectedItems.filter(e=>e.hostElement.classList.contains("f-group")).map(e=>e.hostElement.dataset.fGroupId)}_getSelectedConnections(){return this._dragContext.selectedItems.filter(e=>!e.hostElement.classList.contains("f-node")&&!e.hostElement.classList.contains("f-group")).map(e=>e.hostElement.id)}static \u0275fac=function(n){return new(n||js)};static \u0275prov=y({token:js,factory:js.\u0275fac})};return t=C([x(eo)],t),t})(),wl=class{nodes;connections;isSelectedChanged;static fToken=Symbol("SelectRequest");constructor(i,e,n=!0){this.nodes=i,this.connections=e,this.isSelectedChanged=n}},Lb=(()=>{let t=class Us{_dragContext=d(Q);_store=d(M);handle(e){this._dragContext.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragContext.selectedItems=[],e.nodes.forEach(n=>{let o=this._store.nodes.get(n);o&&(o.markAsSelected(),this._dragContext.selectedItems.push(o))}),e.connections.forEach(n=>{let o=this._store.connections.get(n);o&&(o.markAsSelected(),this._dragContext.selectedItems.push(o))}),this._dragContext.isSelectedChanged=e.isSelectedChanged}static \u0275fac=function(n){return new(n||Us)};static \u0275prov=y({token:Us,factory:Us.\u0275fac})};return t=C([x(wl)],t),t})(),Sl=class{static fToken=Symbol("SelectAllRequest")},Bb=(()=>{let t=class Ws{_dragSession=d(Q);_store=d(M);handle(e){this._dragSession.selectedItems.forEach(n=>{n.unmarkAsSelected()}),this._dragSession.selectedItems=[],this._store.nodes.getAll().forEach(n=>{n.markAsSelected(),this._dragSession.selectedItems.push(n)}),this._store.connections.getAll().forEach(n=>{n.markAsSelected(),this._dragSession.selectedItems.push(n)}),this._dragSession.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Ws)};static \u0275prov=y({token:Ws,factory:Ws.\u0275fac})};return t=C([x(Sl)],t),t})(),ei=class{nodeOrGroup;static fToken=Symbol("SelectAndUpdateNodeLayerRequest");constructor(i){this.nodeOrGroup=i}},Il=class{fItemsContainer;allElements;elementsThatShouldBeInFront;targetIndex;static fToken=Symbol("MoveFrontElementsBeforeTargetElementRequest");constructor(i,e,n,o){this.fItemsContainer=i,this.allElements=e,this.elementsThatShouldBeInFront=n,this.targetIndex=o}},zb=(()=>{let t=class $s{handle(e){let n=[];for(let o=e.targetIndex+1;o<e.allElements.length;o++){let r=e.allElements[o];e.elementsThatShouldBeInFront.includes(r)||n.push(r)}n.forEach(o=>{e.fItemsContainer.removeChild(o),e.fItemsContainer.insertBefore(o,e.allElements[e.targetIndex])})}static \u0275fac=function(n){return new(n||$s)};static \u0275prov=y({token:$s,factory:$s.\u0275fac})};return t=C([x(Il)],t),t})(),mn=class{item;itemContainer;static fToken=Symbol("UpdateItemAndChildrenLayersRequest");constructor(i,e){this.item=i,this.itemContainer=e}},ti=class{nodeOrGroupId;static fToken=Symbol("GetDeepChildrenNodesAndGroupsRequest");constructor(i){this.nodeOrGroupId=i}},Vb=(()=>{let t=class Ks{_store=d(M);handle({nodeOrGroupId:e}){return this._getChildrenNodes(e)}_getChildrenNodes(e,n=new Set){if(n.has(e))throw new Error("Circular reference detected in the node hierarchy. Node id: "+e);n.add(e);let o=this._store.nodes.getAll().filter(r=>r.fParentId()===e);return o.reduce((r,a)=>r.concat(this._getChildrenNodes(a.fId(),n)),o)}static \u0275fac=function(n){return new(n||Ks)};static \u0275prov=y({token:Ks,factory:Ks.\u0275fac})};return t=C([x(ti)],t),t})(),Hb=(()=>{let t=class Xs{_store=d(M);_mediator=d(R);get _canvas(){return this._store.fCanvas}get _groupsContainer(){return this._canvas.fGroupsContainer().nativeElement}get _nodesContainer(){return this._canvas.fNodesContainer().nativeElement}get _connectionsContainer(){return this._canvas.fConnectionsContainer().nativeElement}handle(e){switch(e.itemContainer){case this._groupsContainer:this._handleGroup(e);break;case this._nodesContainer:this._handleNode(e);break;case this._connectionsContainer:this._handleConnection(e);break;default:throw new Error("Unknown container")}}_handleGroup(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),o=this._getChildrenGroups(n);this._updateLayers(this._groupsContainer,e.item.hostElement,o);let r=this._getChildrenNodes(n);r.length&&this._updateLayers(this._nodesContainer,r[0],r)}_handleNode(e){let n=this._getChildrenNodesAndGroups(e.item.fId()),o=this._getChildrenNodes(n);this._updateLayers(e.itemContainer,e.item.hostElement,o)}_handleConnection(e){this._updateLayers(e.itemContainer,e.item.hostElement,[])}_updateLayers(e,n,o){let r=Array.from(e.children),a=r.findIndex(s=>s===n);this._isAnythingNeedToBeMoved(r,a,o)&&this._mediator.execute(new Il(e,r,o,a))}_isAnythingNeedToBeMoved(e,n,o){for(let r=n+1;r<e.length;r++)if(!o.includes(e[r]))return!0;return!1}_getChildrenGroups(e){let n=Array.from(this._groupsContainer.children);return e.filter(o=>this._groupsContainer.contains(o)).sort((o,r)=>n.indexOf(o)-n.indexOf(r))}_getChildrenNodes(e){let n=Array.from(this._nodesContainer.children);return e.filter(o=>this._nodesContainer.contains(o)).sort((o,r)=>n.indexOf(o)-n.indexOf(r))}_getChildrenNodesAndGroups(e){return this._mediator.execute(new ti(e)).map(n=>n.hostElement)}static \u0275fac=function(n){return new(n||Xs)};static \u0275prov=y({token:Xs,factory:Xs.\u0275fac})};return t=C([x(mn)],t),t})(),Gb=(()=>{let t=class qs{_dragSession=d(Q);_mediator=d(R);handle({nodeOrGroup:e}){this._selectNodeIfNotSelected(e),this._mediator.execute(new mn(e,e.hostElement.parentElement))}_selectNodeIfNotSelected(e){e.fSelectionDisabled()||this._dragSession.selectedItems.includes(e)||(this._dragSession.selectedItems.push(e),e.markAsSelected(),this._dragSession.isSelectedChanged=!0)}static \u0275fac=function(n){return new(n||qs)};static \u0275prov=y({token:qs,factory:qs.\u0275fac})};return t=C([x(ei)],t),t})(),jb=[Ob,Fb,Ab,Lb,Bb,Gb],Tl=class{static fToken=Symbol("ResetZoomRequest")},Ub=(()=>{let t=class Ys{_store=d(M);get _canvas(){return this._store.fCanvas}handle(e){this._canvas.resetScale(),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=function(n){return new(n||Ys)};static \u0275prov=y({token:Ys,factory:Ys.\u0275fac})};return t=C([x(Tl)],t),t})(),Pl=class{position;step;direction;animate;static fToken=Symbol("SetZoomRequest");constructor(i,e,n,o=!1){this.position=i,this.step=e,this.direction=n,this.animate=o}},Wb=new Set(["drag-node","drag-external-item","resize-node","rotate-node","create-connection","reassign-connection","drag-connection-waypoint","assign-to-container"]),$b=new Set(["drag-canvas","selection-area"]),Kb=(()=>{let t=class Zs{_mediator=d(R);_store=d(M);_dragContext=d(Q,{optional:!0});get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.get(ye.ZOOM)}get _isDragStarted(){return this._mediator.execute(new Wt)}handle(e){if(!this._zoomComponent)return;let n=this._canvas.transform.scale,o=this._clamp(n+e.step*e.direction);if(o===n)return;let r=this._castPositionToFlow(e.position);if(this._isDragStarted){let a=this._getDragZoomMode();if(a==="blocked")return;a==="rebase"&&this._rebaseDragContext(r,o)}this._canvas.setScale(o,r),e.animate?this._canvas.redrawWithAnimation():this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}_clamp(e){return Math.max(this._zoomComponent?.minimum||1,Math.min(e,this._zoomComponent?.maximum||1))}_castPositionToFlow(e){return Y.fromPoint(e).elementTransform(this._flowHost)}_getDragZoomMode(){if(this._dragContext?.isEmpty())return"blocked";let e=!1;for(let n of this._dragContext?.draggableItems??[]){let o=n.getEvent().kind;if(Wb.has(o)){e=!0;continue}if(!$b.has(o))return"blocked"}return e?"rebase":"direct"}_rebaseDragContext(e,n){if(!this._dragContext)return;let o=this._dragContext.onPointerDownScale;if(!o||o===n){this._dragContext.onPointerDownScale=n;return}let r=1/n-1/o;this._dragContext.onPointerDownPosition=Y.fromPoint(this._dragContext.onPointerDownPosition).add(Y.fromPoint(e).mult(r)),this._dragContext.onPointerDownScale=n}static \u0275fac=function(n){return new(n||Zs)};static \u0275prov=y({token:Zs,factory:Zs.\u0275fac})};return t=C([x(Pl)],t),t})(),Xb=[Ub,Kb],El=class{static fToken=Symbol("MinimapDrawNodesRequest")},qb=(()=>{let t=class Qs{_browser=d(ke);_store=d(M);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;return!n||!o?[]:this._store.nodes.getAll().map(a=>this._renderNode(a,n,o))}_renderNode(e,n,o){let r=Hn("rect",this._browser);Ou(this._nodeRect(e,n,o),r);let a=e instanceof Vl;return r.classList.add("f-component",a?"f-minimap-node":"f-minimap-group"),r.classList.add(...this._minimapClasses(e)),e.isSelected()&&r.classList.add("f-selected"),r}_nodeRect(e,n,o){let r=H.elementTransform(H.fromElement(e.hostElement),n.hostElement);return H.div(r,o.transform.scale)}_minimapClasses(e){let n=e.fMinimapClass();return Array.isArray(n)?n:[n]}static \u0275fac=function(n){return new(n||Qs)};static \u0275prov=y({token:Qs,factory:Qs.\u0275fac})};return t=C([x(El)],t),t})(),Dl=class{svg;minSize;static fToken=Symbol("MinimapCalculateViewportRequest");constructor(i,e){this.svg=i,this.minSize=e}},Yb=(()=>{let t=class Js{_mediator=d(R);_store=d(M);handle({svg:e,minSize:n}){let o=this._store.fFlow,r=this._store.fCanvas;if(!o||!r)return{scale:1,viewBox:H.initialize(0,0,0,0)};let a=this._contentRectInMinimapSpace(o,r,n),s=this._minimapRectInFlowSpace(e,o),l=this._viewportScale(a,s),u=this._viewportViewBox(a,s,l);return{scale:l,viewBox:u}}_contentRectInMinimapSpace(e,n,o){let r=this._nodesBoundingBox(),a=H.elementTransform(r,e.hostElement),s=H.div(a,n.transform.scale);return lh(s,o)}_nodesBoundingBox(){return this._mediator.execute(new Yn)??H.initialize(0,0,0,0)}_minimapRectInFlowSpace(e,n){return H.elementTransform(H.fromElement(e),n.hostElement)}_viewportScale(e,n){let o=n.width||1,r=n.height||1;return Math.max(e.width/o,e.height/r)}_viewportViewBox(e,n,o){let r=this._viewportSize(n,o),a=e.x-(r.width-e.width)/2,s=e.y-(r.height-e.height)/2;return H.initialize(a,s,r.width,r.height)}_viewportSize(e,n){return ft.initialize(e.width*n||0,e.height*n||0)}static \u0275fac=function(n){return new(n||Js)};static \u0275prov=y({token:Js,factory:Js.\u0275fac})};return t=C([x(Dl)],t),t})(),Ml=class{static fToken=Symbol("MinimapCalculateViewRectRequest")},Zb=(()=>{let t=class ec{_store=d(M);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;if(!n||!o)return H.initialize();let r=H.div(H.fromElement(n.hostElement),o.transform.scale);return r.x=0,r.y=0,r}static \u0275fac=function(n){return new(n||ec)};static \u0275prov=y({token:ec,factory:ec.\u0275fac})};return t=C([x(Ml)],t),t})(),kl=class{element;scale;viewBox;constructor(i,e=1,n=H.initialize(0,0,0,0)){this.element=i,this.scale=e,this.viewBox=n}},Qb=[qb,Yb,Zb],Nl=class{position;static fToken=Symbol("GetNormalizedPointRequest");constructor(i){this.position=i}},Jb=(()=>{let t=class tc{_store=d(M);handle({position:e}){return ii(e,this._store.flowHost,this._store.transform)}static \u0275fac=function(n){return new(n||tc)};static \u0275prov=y({token:tc,factory:tc.\u0275fac})};return t=C([x(Nl)],t),t})(),Rl=class{static fToken=Symbol("SortNodeLayersRequest")},ew=(()=>{let t=class nc{_store=d(M);_mediator=d(R);_browser=d(ke);get _canvas(){return this._store.fCanvas}get _groupsContainer(){return this._canvas.fGroupsContainer().nativeElement}get _nodesContainer(){return this._canvas.fNodesContainer().nativeElement}get _fNodeElements(){return Array.from(this._nodesContainer.children)}handle(e){this._getGroups().forEach(n=>{this._moveChildrenNodes(this._getSortedChildrenNodes(n))})}_getGroups(){return this._store.nodes.getAll().filter(e=>this._groupsContainer.contains(e.hostElement))}_getSortedChildrenNodes(e){let n=this._fNodeElements;return this._getChildrenNodes(e.fId()).sort((o,r)=>n.indexOf(o)-n.indexOf(r))}_getChildrenNodes(e){return this._mediator.execute(new ti(e)).filter(n=>this._nodesContainer.contains(n.hostElement)).map(n=>n.hostElement)}_moveChildrenNodes(e){let n=this._browser.document.createDocumentFragment();e.forEach(o=>{n.appendChild(o)}),this._nodesContainer.appendChild(n)}static \u0275fac=function(n){return new(n||nc)};static \u0275prov=y({token:nc,factory:nc.\u0275fac})};return t=C([x(Rl)],t),t})(),to=class{itemsContainer;static fToken=Symbol("SortItemsByParentRequest");constructor(i){this.itemsContainer=i}},tw=(()=>{let t=class ic{_store=d(M);_browser=d(ke);handle({itemsContainer:e}){let n=Array.from(e.children);if(n.length<2)return;let o=this._buildPositions(n),r=this._store.nodes.getAll().filter(l=>e.contains(l.hostElement));if(r.length<2||!r.some(l=>!!l.fParentId()))return;let a=this._buildChildrenByParentId(r),s=new Map;for(let l of r){let u=this._getSortedChildrenBeforeParent(e,o,l,a,s);u.length&&this._moveBeforeNextSibling(e,u,l.hostElement.nextElementSibling)}}_buildPositions(e){let n=new Map;for(let o=0;o<e.length;o++)n.set(e[o],o);return n}_getSortedChildrenBeforeParent(e,n,o,r,a){let s=n.get(o.hostElement);if(s===void 0)return[];let l=this._getDeepChildren(o.fId(),r,a);if(!l.length)return[];let u=[];for(let h of l){let g=h.hostElement;if(!e.contains(g))continue;let w=n.get(g);w===void 0||w>=s||u.push(g)}return u.sort((h,g)=>(n.get(h)??0)-(n.get(g)??0)),u}_buildChildrenByParentId(e){let n=new Map;for(let o of e){let r=o.fParentId();if(!r)continue;let a=n.get(r)??[];a.push(o),n.set(r,a)}return n}_getDeepChildren(e,n,o){let r=o.get(e);if(r)return r;let a=[],s=[...n.get(e)??[]],l=new Set([e]);for(;s.length;){let u=s.pop();if(!u)continue;let h=u.fId();if(l.has(h))continue;l.add(h),a.push(u);let g=n.get(h);g?.length&&s.push(...g)}return o.set(e,a),a}_moveBeforeNextSibling(e,n,o){let r=this._browser.document.createDocumentFragment();for(let a of n)r.appendChild(a);e.insertBefore(r,o)}static \u0275fac=function(n){return new(n||ic)};static \u0275prov=y({token:ic,factory:ic.\u0275fac})};return t=C([x(to)],t),t})(),Ol=class{static fToken=Symbol("SortItemLayersRequest")},nw=(()=>{let t=class oc{_store=d(M);_mediator=d(R);get _canvas(){return this._store.fCanvas}handle(e){if(!this._canvas)return;let n=this._store.nodes.getAll();n.length<2||!n.some(o=>!!o.fParentId())||(this._mediator.execute(new to(this._canvas.fGroupsContainer().nativeElement)),this._mediator.execute(new Rl),this._mediator.execute(new to(this._canvas.fNodesContainer().nativeElement)))}static \u0275fac=function(n){return new(n||oc)};static \u0275prov=y({token:oc,factory:oc.\u0275fac})};return t=C([x(Ol)],t),t})();function Hn(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}function dt(t,i){return i(t)}function pt(t){return!0}function iw(){return/android|iPad|iPhone|iPod/i.test(navigator.userAgent||navigator.vendor||window.opera)}var ow=[...I0,...Rx,...h0,...yb,...Jx,...Rb,...fb,...jb,...Xb,...Qb,...By,Vb,zy,jy,Jb,nw,tw,ew,Hb,zb],rw=0,km=(()=>{class t{_destroyRef=d(We);_elementReference=d(we);_fBrowser=d(ke);_stateChanges=new ct;get hostElement(){return this._elementReference.nativeElement}id=F(`f-pattern-${rw++}`);vColor=F("rgba(0,0,0,0.1)");hColor=F("rgba(0,0,0,0.1)");vSize=F(20,{transform:Ke});hSize=F(20,{transform:Ke});_transform=Ot.default();_position=A.initialize();_size=ft.initialize(this.hSize(),this.vSize());_pattern;_vLine;_hLine;constructor(){this._createPattern()}_createPattern(){this._pattern=Hn("pattern",this._fBrowser),this._pattern.setAttribute("patternUnits","userSpaceOnUse"),this.hostElement.appendChild(this._pattern),this._vLine=Hn("line",this._fBrowser),this._pattern.appendChild(this._vLine),this._hLine=Hn("line",this._fBrowser),this._pattern.appendChild(this._hLine)}ngOnInit(){this._listenStateChanges()}_listenStateChanges(){new vt(this._stateChanges).pipe(Fl()).listen(this._destroyRef,()=>this._redraw())}ngOnChanges(e){(e.vSize||e.hSize||e.vColor||e.hColor)&&this._refresh()}_redraw(){this._calculatePattern(),this._redrawPattern(),this._redrawLine(this._vLine,this.vColor(),this._size.width,0,this._size.width,this._size.height),this._redrawLine(this._hLine,this.hColor(),0,this._size.height,this._size.width,this._size.height)}_calculatePattern(){this._position.x=this._transform.position.x+this._transform.scaledPosition.x,this._position.y=this._transform.position.y+this._transform.scaledPosition.y,this._size=ft.initialize(this.hSize()*this._transform.scale,this.vSize()*this._transform.scale)}_redrawPattern(){this._pattern.setAttribute("x",`${this._position.x}`),this._pattern.setAttribute("y",`${this._position.y}`),this._pattern.setAttribute("width",`${this._size.width}`),this._pattern.setAttribute("height",`${this._size.height}`)}_redrawLine(e,n,o,r,a,s){e.setAttribute("stroke",`${n}`),e.setAttribute("x1",`${o}`),e.setAttribute("x2",`${a}`),e.setAttribute("y1",`${r}`),e.setAttribute("y2",`${s}`)}setTransform(e){this._transform=e,this._refresh()}_refresh(){this._stateChanges.notify()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=Z({type:t,selectors:[["f-rect-pattern"]],hostVars:1,hostBindings:function(n,o){n&2&&X("id",o.id)},inputs:{id:[1,"id"],vColor:[1,"vColor"],hColor:[1,"hColor"],vSize:[1,"vSize"],hSize:[1,"hSize"]},features:[ge([{provide:$u,useExisting:t}]),xn],decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})();var aw=new pe("F_BACKGROUND"),sw=(()=>{class t{hostElement=d(we).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,standalone:!1})}return t})(),Nm=(()=>{class t extends sw{_mediator=d(R);fBackgroundPattern=vo($u);ngOnInit(){this._mediator.execute(new zt(ye.BACKGROUND,this))}ngAfterContentInit(){this._mediator.execute(new rc(this.fBackgroundPattern()))}setTransform(e){this.fBackgroundPattern()?.setTransform(e)}ngOnDestroy(){this._mediator.execute(new Vt(ye.BACKGROUND))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-background"]],contentQueries:function(n,o,r){n&1&&Du(r,o.fBackgroundPattern,$u,5),n&2&&it()},hostAttrs:[1,"f-component","f-background"],features:[ge([{provide:aw,useExisting:t}]),_e],ngContentSelectors:Hg,decls:2,vars:0,template:function(n,o){n&1&&(Qt(),Qe(),U(0,"svg"),Pe(1),$())},styles:["[_nghost-%COMP%]{position:absolute;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{width:100%;height:100%}"],changeDetection:0})}return t})();var ap=class{position;scale;constructor(i,e){this.position=i,this.scale=e}},cw=new pe("F_CANVAS"),dw=(()=>{class t{transform=Ot.default();_fCanvasChange=new ct;destroyRef=d(We);getPosition(){return this.transform.position}setPosition(e){this.transform.position=e}emitCanvasChangeEvent(){this._fCanvasChange.notify()}subscribeOnCanvasChange(){new vt(this._fCanvasChange).pipe(ac(this.debounce())).listen(this.destroyRef,()=>{this.fCanvasChange.emit(new ap(A.sum(this.transform.position,this.transform.scaledPosition),this.transform.scale))})}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,standalone:!1})}return t})(),no=(()=>{class t extends dw{_mediator=d(R);_componentsStore=d(M);_elementReference=d(we);_injector=d(Je);_flowId;fCanvasChange=Ee();position=F(A.initialize(),{transform:A.castToPoint});scale=F(1,{transform:Ke});debounceTime=F(0,{transform:Ke});debounce=D(()=>this.debounceTime()<0?0:this.debounceTime());get hostElement(){return this._elementReference.nativeElement}fGroupsContainer=Se.required("fGroupsContainer");fNodesContainer=Se.required("fNodesContainer");fConnectionsContainer=Se.required("fConnectionsContainer");get flowId(){return this._flowId||""}ngOnInit(){this._flowId=this._mediator.execute(new pl).fId(),this._mediator.execute(new cc(this)),this._positionChange(),this._scaleChange(),super.subscribeOnCanvasChange()}_positionChange(){ae(()=>{this._mediator.execute(new uc(this.transform,this.position()))},{injector:this._injector})}_scaleChange(){ae(()=>{this._mediator.execute(new fc(this.transform,this.scale()))},{injector:this._injector})}redraw(){this._mediator.execute(new Ci(this.transform)),this.hostElement.style.removeProperty("transition"),this.hostElement.style.transform=Ot.toString(this.transform),this._mediator.execute(new Bt)}redrawWithAnimation(){this._mediator.execute(new Ci(this.transform)),this.hostElement.style.transition=`transform ${iw()?80:150}ms ease-in-out`,this.hostElement.style.transform=Ot.toString(this.transform),Uh(this.hostElement,()=>this.redraw())}centerGroupOrNode(e,n=!0){this._afterRedraw(()=>{this._mediator.execute(new dc(e,n))})}fitToScreen(e=A.initialize(),n=!0){this._afterRedraw(()=>{this._mediator.execute(new lc(e,n))})}resetScaleAndCenter(e=!0){this._afterRedraw(()=>{this._mediator.execute(new mc(e))})}getScale(){return this.transform.scale||1}setScale(e,n=A.initialize()){this._mediator.execute(new _c(e,n))}resetScale(){this._mediator.execute(new hc)}ngOnDestroy(){this._mediator.execute(new pc)}_afterRedraw(e){this._mediator.execute(new Ji(this._componentsStore.connectionsRevision,this._componentsStore.nodesRevision,()=>Ap(e,{injector:this._injector}),this.destroyRef))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-canvas"]],viewQuery:function(n,o){n&1&&ut(o.fGroupsContainer,Gg,5)(o.fNodesContainer,jg,5)(o.fConnectionsContainer,Ug,5),n&2&&it(3)},hostAttrs:[1,"f-component","f-canvas"],inputs:{position:[1,"position"],scale:[1,"scale"],debounceTime:[1,"debounceTime"]},outputs:{fCanvasChange:"fCanvasChange"},features:[ge([{provide:cw,useExisting:t}]),_e],ngContentSelectors:$g,decls:12,vars:0,consts:[["fGroupsContainer",""],["fConnectionsContainer",""],["fNodesContainer",""],[1,"f-connections-container"]],template:function(n,o){n&1&&(Qt(Wg),go(0),U(1,"div",null,0),Pe(3),$(),U(4,"div",3,1),Pe(6,1),Pe(7,2),Pe(8,3),$(),U(9,"div",null,2),Pe(11,4),$(),yo())},styles:["[_nghost-%COMP%]{position:absolute;overflow:visible;width:100%;height:100%;left:0;top:0;transform-origin:0 0;pointer-events:none}.f-canvas-dragging[_nghost-%COMP%], .canvas-dragging[_nghost-%COMP%]{transform:translateZ(0)}.f-connections-container[_ngcontent-%COMP%]{position:absolute;z-index:2}"],changeDetection:0})}return t})();var lw=0,Rm=(()=>{class t extends Cy{fId=F(`f-connection-${lw++}`,{alias:"fConnectionId"});fOutputId=F("",{transform:e=>Kn(e)||""});fInputId=F("",{transform:e=>Kn(e)||""});fRadius=8;fOffset=12;fBehavior=At.FIXED;fType=Bn.STRAIGHT;fSelectionDisabled=F(!1,{transform:xe});fReassignableStart=F(!1,{transform:xe});fDraggingDisabled=F(!1,{alias:"fReassignDisabled",transform:xe});fInputSide=F(Xe.DEFAULT,{transform:e=>Ln(e,"fInputSide",Xe)});fOutputSide=F(Xe.DEFAULT,{transform:e=>Ln(e,"fOutputSide",Xe)});get boundingElement(){return this.fPath().hostElement}_mediator=d(R);ngOnInit(){this._mediator.execute(new yc(this))}ngOnChanges(){this._mediator.execute(new sn)}ngOnDestroy(){this._mediator.execute(new jc(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-connection"]],hostAttrs:[1,"f-component","f-connection"],hostVars:5,hostBindings:function(n,o){n&2&&(X("id",o.fId()),re("f-connection-selection-disabled",o.fSelectionDisabled())("f-connection-reassign-disabled",o.fDraggingDisabled()))},inputs:{fId:[1,"fConnectionId","fId"],fOutputId:[1,"fOutputId"],fInputId:[1,"fInputId"],fRadius:[2,"fRadius","fRadius",Ke],fOffset:[2,"fOffset","fOffset",Ke],fBehavior:[2,"fBehavior","fBehavior",e=>Ln(e,"fBehavior",At)],fType:"fType",fSelectionDisabled:[1,"fSelectionDisabled"],fReassignableStart:[1,"fReassignableStart"],fDraggingDisabled:[1,"fReassignDisabled","fDraggingDisabled"],fInputSide:[1,"fInputSide"],fOutputSide:[1,"fOutputSide"]},exportAs:["fComponent"],standalone:!1,features:[ge([{provide:Al,useExisting:t}]),_e,xn],ngContentSelectors:Xg,decls:15,vars:6,consts:[["defs",""],["xmlns","http://www.w3.org/2000/svg"],[1,"f-connection-group"],["fConnectionGradientRenderer","",3,"fConnectionGradientRendererFor"],["fConnectionSelection",""],["f-connection-path","",3,"useGradient"],["f-connection-drag-handle-start","","r","8"],["f-connection-drag-handle-end","","r","8"]],template:function(n,o){if(n&1&&(Qt(Kg),Qe(),f(0,"svg",1),B(1,"defs",null,0),Pe(3),f(4,"g",2),S(5,qg,1,1,":svg:linearGradient",3),B(6,"path",4),f(7,"g"),B(8,"path",5),S(9,Yg,1,0,":svg:circle",6),B(10,"circle",7),p()()(),Pe(11,1),Pe(12,2),Pe(13,3),S(14,Zg,1,0)),n&2){let r;c(5),I((r=o.fGradient())?5:-1,r),c(),X("d",o.path),c(2),E("useGradient",!!o.fGradient()),X("d",o.path),c(),I(o.fReassignableStart()?9:-1),c(5),I(o.fContents().length?14:-1)}},dependencies:[df,_y,gy,ly,my],styles:["[_nghost-%COMP%]{pointer-events:none}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{display:block;vertical-align:middle;overflow:visible!important;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%] .f-connection-group[_ngcontent-%COMP%]{pointer-events:all}[_nghost-%COMP%] .f-connection-content[_ngcontent-%COMP%]{pointer-events:all}"],changeDetection:0})}return t})();var uw=new pe("F_MAGNETIC_LINES"),fw=(()=>{class t{hostElement=d(we).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,standalone:!1})}return t})();var Om=(()=>{class t extends fw{threshold=F(10,{transform:Ke,alias:"fAlignThreshold"});_mediator=d(R);ngOnInit(){this._mediator.execute(new zt(ye.MAGNETIC_LINES,this))}ngOnDestroy(){this._mediator.execute(new Vt(ye.MAGNETIC_LINES))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-line-alignment"]],hostAttrs:[1,"f-line-alignment","f-component"],inputs:{threshold:[1,"fAlignThreshold","threshold"]},exportAs:["fComponent"],standalone:!1,features:[ge([{provide:uw,useExisting:t}]),_e],decls:0,vars:0,template:function(n,o){},styles:[Qg]})}return t})();var ju=(()=>{class t{fMinSize=F(1e3);_mediator=d(R);hostElement=d(we).nativeElement;model=new kl(this.hostElement);redraw(){let{scale:e,viewBox:n}=this._mediator.execute(new Dl(this.hostElement,this.fMinSize()));this.model=new kl(this.hostElement,e,n),uh(n,this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,selectors:[["svg","fMinimapFlow",""]],inputs:{fMinSize:[1,"fMinSize"]}})}return t})(),Uu=(()=>{class t{_mediator=d(R);_elementRef=d(we);hostElement=this._elementRef.nativeElement;redraw(){this.clear();let e=this._elementRef.nativeElement.ownerDocument.createDocumentFragment();this._mediator.execute(new El).forEach(n=>{e.appendChild(n)}),this.hostElement.appendChild(e)}clear(){this.hostElement.replaceChildren()}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,selectors:[["g","fMinimapCanvas",""]]})}return t})(),Wu=(()=>{class t{_mediator=d(R);hostElement=d(we).nativeElement;redraw(){Ou(this._mediator.execute(new Ml),this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,selectors:[["rect","fMinimapView",""]],hostAttrs:[1,"f-component","f-minimap-view"]})}return t})(),pw=new pe("F_MINIMAP_BASE"),hw=(()=>{class t{hostElement=d(we).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,standalone:!1})}return t})(),Fm=(()=>{class t extends hw{_destroyRef=d(We);_mediator=d(R);_browser=d(ke);_store=d(M);_canvas=Se.required(Uu);_flow=Se.required(ju);_minimapView=Se.required(Wu);fMinSize=F(1e3);fNodeRenderLimit=F(1500,{transform:Ke});get state(){return this._flow().model}ngOnInit(){this._mediator.execute(new zt(ye.MINIMAP,this))}ngAfterViewInit(){this._listenTransformChanges()}_listenTransformChanges(){this._mediator.execute(new sc).pipe(Fl(),n0()).listen(this._destroyRef,()=>{this._redraw()})}_redraw(){if(this._browser.isBrowser()){if(this._isOverNodeRenderLimit()){this._canvas().clear();return}this._flow().redraw(),this._minimapView().redraw(),this._canvas().redraw()}}_isOverNodeRenderLimit(){let e=this.fNodeRenderLimit();return e>0&&this._store.nodes.size()>e}ngOnDestroy(){this._mediator.execute(new Vt(ye.MINIMAP))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-minimap"]],viewQuery:function(n,o){n&1&&ut(o._canvas,Uu,5)(o._flow,ju,5)(o._minimapView,Wu,5),n&2&&it(3)},hostAttrs:[1,"f-component","f-minimap"],inputs:{fMinSize:[1,"fMinSize"],fNodeRenderLimit:[1,"fNodeRenderLimit"]},exportAs:["fComponent"],features:[ge([{provide:pw,useExisting:t}]),_e],decls:3,vars:1,consts:[["fMinimapFlow","","width","100%","height","100%","fLockedContext","",3,"fMinSize"],["fMinimapCanvas",""],["fMinimapView","","x","0","y","0","width","100%","height","100%","stroke","none"]],template:function(n,o){n&1&&(Qe(),f(0,"svg",0),B(1,"g",1)(2,"rect",2),p()),n&2&&E("fMinSize",o.fMinSize())},dependencies:[ju,Uu,Wu],styles:["[_nghost-%COMP%]{display:block;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0})}return t})();var mw=(()=>{class t{hostElement=d(we).nativeElement;initialize(){this.hostElement.style.display="none"}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,standalone:!1})}return t})(),Am=(()=>{class t extends mw{_mediator=d(R);fTrigger=e=>e.shiftKey;ngOnInit(){this._mediator.execute(new zt(ye.SELECTION_AREA,this)),super.initialize()}ngOnDestroy(){this._mediator.execute(new Vt(ye.SELECTION_AREA))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-selection-area"]],hostAttrs:[1,"f-selection-area","f-component"],inputs:{fTrigger:"fTrigger"},features:[_e],decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{position:absolute}"]})}return t})();var _w=0,gw=120,io=(()=>{class t extends rp{_destroyRef=d(We);_mediator=d(R);_browser=d(ke);_componentsStore=d(M);_cache=d(Ct);_injector=d(Je);fId=F(`f-flow-${_w++}`,{alias:"fFlowId"});fCache=F(!1,{transform:xe});hostElement=d(we).nativeElement;fNodesRendered=Ee();fFullRendered=Ee();fLoaded=Ee();ngOnInit(){this._mediator.execute(new fl(this)),this._listenCacheChanges()}ngAfterContentInit(){this._browser.isBrowser()&&(this._listenNodesChanges(),this._listenConnectionsChanges())}_listenCacheChanges(){ae(()=>{this._cache.enabled=this.fCache()},{injector:this._injector})}_listenNodesChanges(){new vt(this._componentsStore.nodesChanges$,this._componentsStore.progressiveRenderChanges$).pipe(Fl(),ac(gw),t0()).listen(this._destroyRef,()=>{this._mediator.execute(new Wt)||this._componentsStore.hasPendingProgressiveRender||(this._mediator.execute(new Ol),this._mediator.execute(new gl),this._mediator.execute(new Ji(this._componentsStore.connectionsRevision+1,this._componentsStore.nodesRevision,()=>this._mediator.execute(new yl),this._destroyRef)),this._mediator.execute(new sn))})}_listenConnectionsChanges(){this._mediator.execute(new zn).listen(this._destroyRef,()=>{if(!this._mediator.execute(new Wt)){if(this._componentsStore.isViewportAnimating){this._mediator.execute(new Cl(this._destroyRef));return}this._mediator.execute(new Ei)}})}redraw(){this._mediator.execute(new sn)}reset(){this._mediator.execute(new vl)}getNodesBoundingBox(){return this._mediator.execute(new cl)}getSelection(){return this._mediator.execute(new eo)}getPositionInFlow(e){return this._mediator.execute(new Nl(e))}getState(e){return this._mediator.execute(new ml(e?.measuredSize??!1))}selectAll(){this._mediator.execute(new zn).pipe(gh()).listen(this._destroyRef,()=>{this._mediator.execute(new Sl)})}select(e,n,o=!0){this._mediator.execute(new zn).pipe(gh()).listen(this._destroyRef,()=>{this._mediator.execute(new wl(e,n,o))})}clearSelection(){this._mediator.execute(new xl)}ngOnDestroy(){this._mediator.execute(new _l(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["f-flow"]],hostAttrs:[1,"f-component","f-flow"],hostVars:1,hostBindings:function(n,o){n&2&&X("id",o.fId())},inputs:{fId:[1,"fFlowId","fId"],fCache:[1,"fCache"]},outputs:{fNodesRendered:"fNodesRendered",fFullRendered:"fFullRendered",fLoaded:"fLoaded"},features:[ge([R,...l0,nm,ni,...ow,Q,...Mx,{provide:lp,useExisting:t}]),_e],ngContentSelectors:e0,decls:7,vars:0,template:function(n,o){n&1&&(Qt(Jg),go(0),Pe(1),Pe(2,1),Pe(3,2),Pe(4,3),Pe(5,4),Pe(6,5),yo())},styles:["[_nghost-%COMP%]{display:block;position:relative;width:100%;height:100%;overflow:hidden;pointer-events:all;-webkit-user-select:none;user-select:none;touch-action:none} .f-connection-content{position:absolute;left:0;top:0;inline-size:max-content;pointer-events:all;transform-origin:50% 50%} .f-node, .f-group{position:absolute!important;transform-origin:center;-webkit-user-select:none;user-select:none;pointer-events:all;left:0!important;top:0!important;box-sizing:border-box} .f-group{z-index:1} .f-connection-content{z-index:3} .f-node{z-index:4}.hidden[_ngcontent-%COMP%]{opacity:0}"],changeDetection:0})}return t})();var Lm=(()=>{class t{fVirtualForOf=[];fVirtualForTrackBy;_vc=d(mo);_tpl=d(Lp);_zone=d(ui);_componentsStore=d(M,{optional:!0});_views=[];_rafId=null;_isProgressiveRenderActive=!1;ngOnChanges(e){e.fVirtualForOf&&(this._reset(),this._renderProgressively())}ngOnDestroy(){this._reset()}_reset(){this._rafId!==null&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._finishProgressiveRender(),this._vc.clear(),this._views.length=0}_renderProgressively(){let n=0;this._startProgressiveRender(),this._zone.runOutsideAngular(()=>{let o=()=>{let r=performance.now();for(;n<this.fVirtualForOf.length&&performance.now()-r<10;){let a=this.fVirtualForOf[n],s=this._vc.createEmbeddedView(this._tpl,{$implicit:a,index:n});this._views.push(s),n++}if(n<this.fVirtualForOf.length){this._rafId=requestAnimationFrame(o);return}this._rafId=null,this._finishProgressiveRender()};this._rafId=requestAnimationFrame(o)})}_startProgressiveRender(){this._isProgressiveRenderActive||(this._isProgressiveRenderActive=!0,this._componentsStore?.beginProgressiveRender())}_finishProgressiveRender(){this._isProgressiveRenderActive&&(this._isProgressiveRenderActive=!1,this._componentsStore?.endProgressiveRender())}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Ce({type:t,selectors:[["","fVirtualFor","","fVirtualForOf",""]],inputs:{fVirtualForOf:"fVirtualForOf",fVirtualForTrackBy:"fVirtualForTrackBy"},features:[xn]})}return t})();var Pt=(function(t){return t[t.ZOOM_IN=1]="ZOOM_IN",t[t.ZOOM_OUT=-1]="ZOOM_OUT",t})(Pt||{}),yw=new pe("F_ZOOM"),sp=class{},vw=.1,Cw=1,xw=.5,bw=60,ww=.5;function Sw(t){return Math.abs(t.deltaY)>=Math.abs(t.deltaX)?t.deltaY:t.deltaX}function Iw(t,i,e){return Tw(t)?Ew(i,e):Pw(i,e)}function Tw(t){return(t.ctrlKey||t.metaKey)&&t.deltaMode===WheelEvent.DOM_DELTA_PIXEL}function Pw(t,i){let e=Math.abs(t)/100,n=Bm(e,vw,Cw);return i*n}function Ew(t,i){if(Math.abs(t)<xw)return 0;let e=Math.abs(t)/bw,n=Bm(e,0,ww);return i*n}function Bm(t,i,e){return Math.max(i,Math.min(e,t))}var oo=(()=>{class t extends sp{_mediator=d(R);_injector=d(Je);_store=d(M);_triggersListener=he.emptyListener();isEnabled=F(!1,{alias:"fZoom",transform:xe});fWheelTrigger=pt;fDblClickTrigger=pt;minimum=.1;maximum=4;step=.1;dblClickStep=.5;get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}ngOnInit(){this._mediator.execute(new zt(ye.ZOOM,this))}ngAfterViewInit(){this._listenZoomEnabledChanges()}_listenZoomEnabledChanges(){ae(()=>{this.isEnabled(),gt(()=>this._listenTriggers())},{injector:this._injector})}_listenTriggers(){this._flowHost&&(this._disposeListeners(),this.isEnabled()&&(this._listen("wheel",this._onWheel,he.activeListener()),this._listen("dblclick",this._onDoubleClick),this._triggersListener=()=>{this._unlisten("wheel",this._onWheel,he.activeListener()),this._unlisten("dblclick",this._onDoubleClick)}))}_onWheel=e=>{if(!dt(e,this.fWheelTrigger)||(e.preventDefault(),e.target?.closest("[fLockedContext]")))return;let o=Sw(e);if(o===0)return;let r=this._normalizeWheelStep(e,o);r!==0&&this.setZoom(A.initialize(e.clientX,e.clientY),r,this._calculateDirection(o),!1)};_normalizeWheelStep(e,n){return Iw(e,n,this.step)}_calculateDirection(e){return e>0?Pt.ZOOM_OUT:Pt.ZOOM_IN}_onDoubleClick=e=>{if(!dt(e,this.fDblClickTrigger))return;e.preventDefault();let n=e.target;Uv(n)||n?.closest("[fLockedContext]")||this.setZoom(A.initialize(e.clientX,e.clientY),this.dblClickStep,Pt.ZOOM_IN,!0)};_getToCenterPosition(e,n){return A.initialize(e?.x||n.gravityCenter.x,e?.y||n.gravityCenter.y)}zoomIn(e){this._onZoomToCenter(Pt.ZOOM_IN,e)}zoomOut(e){this._onZoomToCenter(Pt.ZOOM_OUT,e)}_onZoomToCenter(e,n){this.setZoom(this._getToCenterPosition(n,H.fromElement(this._flowHost)),this.step,e,!1)}setZoom(e,n,o,r){this._mediator.execute(new Pl(e,n,o,r))}getZoomValue(){return this._canvas.transform.scale||1}reset(){this._mediator.execute(new Tl)}_disposeListeners(){this._triggersListener(),this._triggersListener=he.emptyListener()}ngOnDestroy(){this._disposeListeners(),this._mediator.execute(new Vt(ye.ZOOM))}_listen(e,n,o){this._flowHost.addEventListener(e,n,o)}_unlisten(e,n,o){this._flowHost.removeEventListener(e,n,o)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Ce({type:t,selectors:[["f-canvas","fZoom",""]],hostAttrs:[1,"f-zoom","f-component"],inputs:{isEnabled:[1,"fZoom","isEnabled"],fWheelTrigger:"fWheelTrigger",fDblClickTrigger:"fDblClickTrigger",minimum:[2,"fZoomMinimum","minimum",Ke],maximum:[2,"fZoomMaximum","maximum",Ke],step:[2,"fZoomStep","step",Ke],dblClickStep:[2,"fZoomDblClickStep","dblClickStep",Ke]},features:[ge([{provide:yw,useExisting:t}]),_e]})}return t})();var zm=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=_o({type:t});static \u0275inj=fo({imports:[Co]})}return t})();var up={loading:"Loading collection",errorTitle:"Failed to load",emptyTitle:"No nodes match",emptyDesc:"Adjust or reset the filters above.",a11y:{toolbar:"Graph controls",panel:"Selected node details"},toolbar:{zoomIn:"Zoom in",zoomOut:"Zoom out",fitToScreen:"Fit to screen",resetLayoutLabel:"Reset layout",resetLayoutTooltip:"Reset layout (re-run auto layout, clear saved positions)"},panel:{resizeLabel:"Resize panel"},resetLayoutConfirm:{header:"Reset layout?",message:"Reset all node positions to the automatic layout. This cannot be undone.",accept:"Reset",reject:"Cancel"}};var oi={graph:{perf:{cache:!0,virtualization:!1},perfHud:!0},inspector:{actionMocks:!1}};var Vm={a11y:{toolbarLabel:"Toggle node kinds"},favorites:{label:"Favorites"}};function Mw(t,i){if(t&1&&Mt(0,"i",4),t&2){let e=m();Le(e.piClass()),ot("font-size",e.size(),"px")}}function kw(t,i){if(t&1&&(Qe(),U(0,"svg",1),Mt(1,"path"),$()),t&2){let e=m();X("width",e.size())("height",e.size()),c(),X("d",e.svgPath())}}function Nw(t,i){if(t&1&&(U(0,"span",4),_(1),$()),t&2){let e=m();ot("font-size",e.size(),"px")("line-height",e.size(),"px"),c(),v(e.emoji())}}function Rw(t,i){if(t&1&&(U(0,"span",5),_(1),$()),t&2){let e=m();ot("font-size",e.size(),"px")("line-height",e.size(),"px"),c(),v(e.letter())}}var $t=class t{kindRegistry=d(En);kind=F.required();size=F(18);provider=F(null);resolvedUi=D(()=>{let i=this.kindRegistry.lookup(this.kind());if(!i)return;let e=this.provider();if(e){let n=i.providers[e];if(n&&(n.icon||n.emoji))return n}return i});variant=D(()=>{let i=this.resolvedUi();return i?.icon?.kind==="pi"?"pi":i?.icon?.kind==="svg"?"svg":i?.emoji?"emoji":"letter"});piClass=D(()=>{let i=this.resolvedUi()?.icon;return i?.kind==="pi"?`pi ${i.id}`:""});svgPath=D(()=>{let i=this.resolvedUi()?.icon;return i?.kind==="svg"?i.path:""});emoji=D(()=>this.resolvedUi()?.emoji??"");letter=D(()=>this.kindRegistry.labelOf(this.kind()).charAt(0).toUpperCase());static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-kind-icon"]],inputs:{kind:[1,"kind"],size:[1,"size"],provider:[1,"provider"]},decls:4,vars:1,consts:[["aria-hidden","true",3,"class","font-size"],["viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2.2","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["aria-hidden","true",3,"font-size","line-height"],["aria-hidden","true",1,"kind-icon__letter",3,"font-size","line-height"],["aria-hidden","true"],["aria-hidden","true",1,"kind-icon__letter"]],template:function(e,n){if(e&1&&S(0,Mw,1,4,"i",0)(1,kw,2,3,":svg:svg",1)(2,Nw,2,5,"span",2)(3,Rw,2,5,"span",3),e&2){let o;I((o=n.variant())==="pi"?0:o==="svg"?1:o==="emoji"?2:o==="letter"?3:-1)}},styles:["[_nghost-%COMP%]{display:inline-flex;align-items:center;justify-content:center;line-height:1}"],changeDetection:0})};var jm=()=>({class:"kind-palette__content"}),Um=t=>({content:t}),Ow=(t,i)=>i.kind;function Fw(t,i){if(t&1&&(B(0,"sm-kind-icon",5),f(1,"span"),_(2),p()),t&2){let e=m().$implicit;E("kind",e.kind)("size",16),c(2),v(e.count)}}function Aw(t,i){if(t&1){let e=ce();f(0,"p-togglebutton",4),K("ngModelChange",function(){let o=G(e).$implicit,r=m();return j(r.toggle(o.kind))}),be(1,Fw,3,3,"ng-template",null,0,tn),p()}if(t&2){let e=i.$implicit,n=m();E("ngModel",n.isActive(e.kind))("pTooltip",e.label)("ariaLabel",e.label)("styleClass","kind-palette__btn kind-palette__btn--"+e.kind)("pt",en(7,Um,Jt(6,jm))),X("data-testid","kind-palette-"+e.kind)}}function Lw(t,i){if(t&1&&(B(0,"i",7),f(1,"span"),_(2),p()),t&2){let e=m(2);re("pi-star-fill",e.favoritesActive())("pi-star",!e.favoritesActive()),c(2),v(e.favoritesCount())}}function Bw(t,i){if(t&1){let e=ce();f(0,"p-togglebutton",6),K("ngModelChange",function(){G(e);let o=m();return j(o.toggleFavoritesOnly())}),be(1,Lw,3,5,"ng-template",null,0,tn),p()}if(t&2){let e=m();E("ngModel",e.favoritesActive())("pTooltip",e.texts.favorites.label)("ariaLabel",e.texts.favorites.label)("pt",en(5,Um,Jt(4,jm)))}}var Gl=class t{loader=d(Nt);filters=d(Dn);kindRegistry=d(En);texts=Vm;entries=D(()=>{let i=new Map;for(let e of this.loader.nodes())i.set(e.kind,(i.get(e.kind)??0)+1);return this.kindRegistry.kinds().map(e=>({kind:e.name,label:e.label,count:i.get(e.name)??0}))});favoritesCount=D(()=>this.loader.nodes().filter(i=>i.isFavorite===!0).length);showFavorites=D(()=>this.loader.hasAnyFavorites()||this.filters.favoritesOnly());favoritesActive=D(()=>this.filters.favoritesOnly());isActive(i){return this.filters.isKindActive(i)}toggle(i){this.filters.toggleKind(i)}toggleFavoritesOnly(){this.filters.setFavoritesOnly(!this.filters.favoritesOnly())}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-kind-palette"]],decls:4,vars:2,consts:[["content",""],["role","toolbar","data-testid","kind-palette",1,"kind-palette"],[3,"ngModel","pTooltip","ariaLabel","styleClass","pt"],["styleClass","kind-palette__btn kind-palette__btn--favorites","data-testid","kind-palette-favorites",3,"ngModel","pTooltip","ariaLabel","pt"],[3,"ngModelChange","ngModel","pTooltip","ariaLabel","styleClass","pt"],[3,"kind","size"],["styleClass","kind-palette__btn kind-palette__btn--favorites","data-testid","kind-palette-favorites",3,"ngModelChange","ngModel","pTooltip","ariaLabel","pt"],["aria-hidden","true",1,"pi"]],template:function(e,n){e&1&&(f(0,"div",1),ee(1,Aw,3,9,"p-togglebutton",2,Ow),S(3,Bw,3,7,"p-togglebutton",3),p()),e&2&&(X("aria-label",n.texts.a11y.toolbarLabel),c(),te(n.entries()),c(2),I(n.showFavorites()?3:-1))},dependencies:[Nn,Mn,kn,On,Rn,Re,Ve,$t],styles:["[_nghost-%COMP%]{display:block;pointer-events:auto}.kind-palette[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:2px;padding:4px;background:color-mix(in srgb,var(--sm-bg-content) 80%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid var(--sm-border);border-radius:.65rem;box-shadow:var(--sm-shadow-floating)}.kind-palette__btn[_ngcontent-%COMP%]{--p-togglebutton-padding: 0;--p-togglebutton-content-padding: 0 .55rem;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-gap: .4rem;--p-togglebutton-background: transparent;--p-togglebutton-checked-background: transparent;--p-togglebutton-hover-background: transparent;--p-togglebutton-border-color: transparent;--p-togglebutton-checked-border-color: transparent;--p-togglebutton-content-checked-background: var(--sm-bg-hover);--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-color);--p-togglebutton-icon-color: var(--p-text-muted-color);--p-togglebutton-icon-hover-color: var(--p-text-color);--p-togglebutton-icon-checked-color: var(--p-text-color);width:56px;height:30px;font-size:.72rem;font-weight:600;font-variant-numeric:tabular-nums}[_nghost-%COMP%] .kind-palette__content{width:100%;height:100%;justify-content:flex-start;display:flex;align-items:center;gap:.4rem}[_nghost-%COMP%] .kind-palette__content>span{flex:1;text-align:right}[_nghost-%COMP%] .kind-palette__btn sm-kind-icon{display:inline-flex;align-items:center;color:var(--p-text-muted-color)}[_nghost-%COMP%] .kind-palette__btn[aria-pressed=true] sm-kind-icon{color:var(--p-text-color)}[_nghost-%COMP%] .kind-palette__btn--skill[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-skill)}[_nghost-%COMP%] .kind-palette__btn--agent[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-agent)}[_nghost-%COMP%] .kind-palette__btn--command[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-command)}[_nghost-%COMP%] .kind-palette__btn--markdown[aria-pressed=true] sm-kind-icon{color:var(--sm-kind-markdown)}[_nghost-%COMP%] .kind-palette__btn--favorites .pi{font-size:.95rem;line-height:1;color:var(--p-text-muted-color)}[_nghost-%COMP%] .kind-palette__btn--favorites:hover .pi{color:var(--p-text-color)}[_nghost-%COMP%] .kind-palette__btn--favorites[aria-pressed=true] .pi{color:var(--p-primary-color)}"],changeDetection:0})};var bt={a11y:{toolbarLabel:"Link kind filters"},kinds:{invokes:"Invokes",references:"References",mentions:"Mentions",supersedes:"Supersedes"},tooltips:{invokes:`Invokes:
|
|
211
|
-
"/skill-command"`,references:`References:
|
|
212
|
-
"[link](./link.md)"`,mentions:`Mention:
|
|
213
|
-
"@agent.md"`,supersedes:`Supersedes:
|
|
214
|
-
.sm annotation`}};var zw=()=>({class:"link-kind-palette__content"}),Vw=t=>({content:t}),Hw=(t,i)=>i.kind;function Gw(t,i){if(t&1&&_(0),t&2){let e=m(2).$implicit;ze(" ",e.text," ")}}function jw(t,i){if(t&1&&B(0,"i"),t&2){let e=m(2).$implicit;Le(e.icon)}}function Uw(t,i){if(t&1&&(f(0,"span",4),S(1,Gw,1,1)(2,jw,1,2,"i",5),p()),t&2){let e=m().$implicit;c(),I(e.text?1:e.icon?2:-1)}}function Ww(t,i){if(t&1){let e=ce();f(0,"p-togglebutton",3),K("ngModelChange",function(){let o=G(e).$implicit,r=m();return j(r.toggle(o.kind))}),be(1,Uw,3,1,"ng-template",null,0,tn),p()}if(t&2){let e=i.$implicit,n=m();E("ngModel",n.isActive(e.kind))("pTooltip",e.tooltip)("ariaLabel",e.label)("styleClass","link-kind-palette__btn link-kind-palette__btn--"+e.kind)("pt",en(7,Vw,Jt(6,zw))),X("data-testid","link-kind-palette-"+e.kind)}}var jl=class t{filters=d(Dn);texts=bt;entries=[{kind:"invokes",label:bt.kinds.invokes,tooltip:bt.tooltips.invokes,text:"/"},{kind:"references",label:bt.kinds.references,tooltip:bt.tooltips.references,icon:"pi pi-link"},{kind:"mentions",label:bt.kinds.mentions,tooltip:bt.tooltips.mentions,text:"@"},{kind:"supersedes",label:bt.kinds.supersedes,tooltip:bt.tooltips.supersedes,icon:"pi pi-angle-double-right"}];constructor(){for(let i of this.entries)if(!oh.includes(i.kind))throw new Error(`link-kind-palette: unknown link kind "${i.kind}"`)}isActive(i){return this.filters.isLinkKindActive(i)}toggle(i){this.filters.toggleLinkKind(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-link-kind-palette"]],decls:3,vars:1,consts:[["content",""],["role","toolbar","data-testid","link-kind-palette",1,"link-kind-palette"],["tooltipStyleClass","link-kind-palette__tooltip",3,"ngModel","pTooltip","ariaLabel","styleClass","pt"],["tooltipStyleClass","link-kind-palette__tooltip",3,"ngModelChange","ngModel","pTooltip","ariaLabel","styleClass","pt"],["aria-hidden","true",1,"link-kind-palette__glyph"],[3,"class"]],template:function(e,n){e&1&&(f(0,"div",1),ee(1,Ww,3,9,"p-togglebutton",2,Hw),p()),e&2&&(X("aria-label",n.texts.a11y.toolbarLabel),c(),te(n.entries))},dependencies:[Nn,Mn,kn,On,Rn,Re,Ve],styles:["[_nghost-%COMP%]{display:block;width:100%;pointer-events:auto}.link-kind-palette[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(2,1fr);gap:2px;padding:4px;background:color-mix(in srgb,var(--sm-bg-content) 80%,transparent);backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);border:1px solid var(--sm-border);border-radius:.65rem;box-shadow:var(--sm-shadow-floating)}.link-kind-palette__btn[_ngcontent-%COMP%]{--p-togglebutton-padding: 0;--p-togglebutton-content-padding: 0;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-background: transparent;--p-togglebutton-checked-background: transparent;--p-togglebutton-hover-background: transparent;--p-togglebutton-border-color: transparent;--p-togglebutton-checked-border-color: transparent;--p-togglebutton-content-checked-background: var(--sm-bg-hover);--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-color);width:100%;height:30px}[_nghost-%COMP%] .link-kind-palette__content{width:100%;height:100%;display:flex;align-items:center;justify-content:center}[_nghost-%COMP%] .link-kind-palette__glyph{font-size:.95rem;line-height:1;font-weight:600;display:inline-flex;align-items:center;justify-content:center}[_nghost-%COMP%] .link-kind-palette__btn--invokes .link-kind-palette__glyph{color:var(--sm-edge-invokes)}[_nghost-%COMP%] .link-kind-palette__btn--invokes[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-invokes-active)}[_nghost-%COMP%] .link-kind-palette__btn--references .link-kind-palette__glyph{color:var(--sm-edge-references)}[_nghost-%COMP%] .link-kind-palette__btn--references[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-references-active)}[_nghost-%COMP%] .link-kind-palette__btn--mentions .link-kind-palette__glyph{color:var(--sm-edge-mentions)}[_nghost-%COMP%] .link-kind-palette__btn--mentions[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-mentions-active)}[_nghost-%COMP%] .link-kind-palette__btn--supersedes .link-kind-palette__glyph{color:var(--sm-edge-supersedes)}[_nghost-%COMP%] .link-kind-palette__btn--supersedes[aria-pressed=true] .link-kind-palette__glyph{color:var(--sm-edge-supersedes-active)}[_nghost-%COMP%] .link-kind-palette__tooltip .p-tooltip-text{white-space:pre-line;text-align:center;line-height:1.35}"],changeDetection:0})};var gn={llm:{what:{label:"what",tooltip:"What it does (LLM-inferred summary)"},when:{label:"when",tooltip:"When to use (LLM-inferred)"},style:{label:"style",tooltip:"Interaction style (LLM-inferred)"},does:{label:"does",tooltip:"Capabilities (LLM-inferred)"},steps:{label:"steps",tooltip:"Recipe / ordered steps (LLM-inferred)"},pre:{label:"pre",tooltip:"Preconditions (LLM-inferred)"},out:{label:"out",tooltip:"Outputs / produced artifacts (LLM-inferred)"},fx:{label:"fx",tooltip:"Side effects (LLM-inferred)"},eg:{label:"eg",tooltip:"Invocation example (LLM-inferred)"},topics:{label:"topics",tooltip:"Topics covered (LLM-inferred)"},facts:{label:"facts",tooltip:"Key facts (LLM-inferred discrete claims)"}},meta:{model:"model",allowed:"allowed",tags:"tags"},stats:{errors:t=>`${t} error${t===1?"":"s"}`,warns:t=>`${t} warning${t===1?"":"s"}`,bytes:t=>`${t.toLocaleString("en-US")} bytes`,tokens:t=>`${t.toLocaleString("en-US")} tokens`},stability:{experimental:"experimental",deprecated:"deprecated"},sidecar:{staleBody:"Stale: body content changed since the last bump.",staleFrontmatter:"Stale: frontmatter changed since the last bump.",staleBoth:"Stale: body and frontmatter changed since the last bump."},confidence:t=>`LLM summary \xB7 confidence ${t.toFixed(2)}`,ariaExpand:"Expand",ariaFavoriteAdd:"Add to favorites",ariaFavoriteRemove:"Remove from favorites",favoriteAddTooltip:"Mark as favorite",favoriteRemoveTooltip:"Unfavorite"};var $w={claude:{label:"Claude",color:"#cc785c",colorDark:"#e89270"},gemini:{label:"Gemini",color:"#4285f4",colorDark:"#669df6"},"agent-skills":{label:"Open Skills",color:"#64748b",colorDark:"#94a3b8"}},Kw=new Set(["markdown"]),Xw={label:"",color:"#9ca3af",colorDark:"#6b7280"};function Wm(t){if(!t||Kw.has(t))return null;let i=$w[t];return i||li(se({},Xw),{label:t})}function fp(t){let i=t.normalize("NFD");return i=i.replace(new RegExp("\\p{Mn}+","gu"),""),i=i.toLowerCase(),i=i.replace(/[-_\s]+/g," "),i=i.replace(/\s+/g," "),i.trim()}function $m(t){let i=new Map;return qw(t,i),Yw(t,i),i}function qw(t,i){for(let e of t){let n=Km(e);if(n===null)continue;let o=fp(n);i.has(o)||i.set(o,e.path)}}function Yw(t,i){for(let e of t){if(Km(e)!==null)continue;let n=pp(e.path);if(n.length===0)continue;let o=fp(n);i.has(o)||i.set(o,e.path)}}function Km(t){let i=t.frontmatter?.name;return typeof i!="string"||i.length===0?null:i}function pp(t){let i=t.split("/").filter(n=>n.length>0);if(i.length===0)return t;let e=i[i.length-1];return e==="SKILL.md"&&i.length>=2?i[i.length-2]:e.replace(/\.md$/,"")}function Xm(t,i,e){let n=t.charAt(0);if(n!=="/"&&n!=="@")return t;let o=i!==null?i.replace(/^[/@]/,"").trim():fp(t.slice(1));return e.get(o)??t}var Zw=(t,i)=>i.source+":"+i.tag,Qw=(t,i)=>i.step,Jw=(t,i)=>i.analyzerId+i.message;function eS(t,i){if(t&1&&(f(0,"span",33),_(1),p()),t&2){let e=m(),n=J(1),o=J(3);re("sm-gnode__llm-marker--low",o==="low")("sm-gnode__llm-marker--med",o==="med")("sm-gnode__llm-marker--high",o==="high"),E("pTooltip",e.texts.confidence(n.confidence)),c(),ze("",e.confidencePct(),"%")}}function tS(t,i){t&1&&(f(0,"span",9),_(1),p()),t&2&&(c(),v(i))}function nS(t,i){if(t&1&&(f(0,"span",13)(1,"span",34),_(2,"T"),p(),_(3),p()),t&2){let e=m(),n=J(2);E("pTooltip",e.texts.stats.tokens(n.tokensTotal)),c(3),v(e.tokensShort())}}function iS(t,i){if(t&1&&(f(0,"span",14)(1,"span",34),_(2,"B"),p(),_(3),p()),t&2){let e=m(),n=J(2);E("pTooltip",e.texts.stats.bytes(n.bytesTotal)),c(3),v(e.bytesShort())}}function oS(t,i){if(t&1&&(f(0,"span",35),_(1),p()),t&2){let e=i;m();let n=J(0);ot("--provider-color",e.color)("--provider-color-dark",e.colorDark??e.color),E("pTooltip",n.provider),c(),v(e.label)}}function rS(t,i){if(t&1&&(f(0,"span",38),_(1),p()),t&2){let e=i.$implicit;re("sm-gnode__tag-chip--author",e.source==="author")("sm-gnode__tag-chip--user",e.source==="user"),X("data-tag-source",e.source),c(),v(e.tag)}}function aS(t,i){if(t&1&&(f(0,"span",37),_(1),p()),t&2){m(2);let e=J(5);c(),ze("+",e," more")}}function sS(t,i){if(t&1&&(f(0,"div",19),ee(1,rS,2,6,"span",36,Zw),S(3,aS,2,1,"span",37),p()),t&2){m();let e=J(4),n=J(5);c(),te(e),c(2),I(n>0?3:-1)}}function cS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.what.tooltip),c(),v(n.texts.llm.what.label),c(2),v(e.whatItCovers)}}function dS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function lS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,dS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.topics.tooltip),c(),v(n.texts.llm.topics.label),c(2),te(e.topics)}}function uS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function fS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,uS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.facts.tooltip),c(),v(n.texts.llm.facts.label),c(2),te(e.keyFacts)}}function pS(t,i){if(t&1&&(S(0,cS,5,3,"div",39),S(1,lS,6,2,"div",39),S(2,fS,6,2,"div",39)),t&2){let e=i,n=m(2);I(n.showLlmWhat?0:-1),c(),I(e.topics!=null&&e.topics.length?1:-1),c(),I(e.keyFacts!=null&&e.keyFacts.length?2:-1)}}function hS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.what.tooltip),c(),v(n.texts.llm.what.label),c(2),v(e.whatItDoes)}}function mS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.when.tooltip),c(),v(n.texts.llm.when.label),c(2),v(e.whenToUse)}}function _S(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.style.tooltip),c(),v(n.texts.llm.style.label),c(2),v(e.interactionStyle)}}function gS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function yS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,gS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.does.tooltip),c(),v(n.texts.llm.does.label),c(2),te(e.capabilities)}}function vS(t,i){if(t&1&&(S(0,hS,5,3,"div",39),S(1,mS,5,3,"div",39),S(2,_S,5,3,"div",39),S(3,yS,6,2,"div",39)),t&2){let e=i,n=m(2);I(n.showLlmWhat?0:-1),c(),I(e.whenToUse?1:-1),c(),I(e.interactionStyle?2:-1),c(),I(e.capabilities!=null&&e.capabilities.length?3:-1)}}function CS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.what.tooltip),c(),v(n.texts.llm.what.label),c(2),v(e.whatItDoes)}}function xS(t,i){if(t&1&&_(0),t&2){let e=i.$implicit,n=i.$index,o=i.$count;Gp("",e.step,". ",e.description,"",n===o-1?"":" \xB7 ")}}function bS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),ee(4,xS,1,3,null,null,Qw),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.steps.tooltip),c(),v(n.texts.llm.steps.label),c(2),te(e.recipe)}}function wS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function SS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,wS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.pre.tooltip),c(),v(n.texts.llm.pre.label),c(2),te(e.preconditions)}}function IS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function TS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,IS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.out.tooltip),c(),v(n.texts.llm.out.label),c(2),te(e.outputs)}}function PS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function ES(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,PS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.fx.tooltip),c(),v(n.texts.llm.fx.label),c(2),te(e.sideEffects)}}function DS(t,i){if(t&1&&(S(0,CS,5,3,"div",39),S(1,bS,6,2,"div",39),S(2,SS,6,2,"div",39),S(3,TS,6,2,"div",39),S(4,ES,6,2,"div",39)),t&2){let e=i,n=m(2);I(n.showLlmWhat?0:-1),c(),I(e.recipe!=null&&e.recipe.length?1:-1),c(),I(e.preconditions!=null&&e.preconditions.length?2:-1),c(),I(e.outputs!=null&&e.outputs.length?3:-1),c(),I(e.sideEffects!=null&&e.sideEffects.length?4:-1)}}function MS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"span"),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.what.tooltip),c(),v(n.texts.llm.what.label),c(2),v(e.whatItDoes)}}function kS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"code",43),_(4),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.eg.tooltip),c(),v(n.texts.llm.eg.label),c(2),v(e.invocationExample)}}function NS(t,i){if(t&1&&(f(0,"span",42),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function RS(t,i){if(t&1&&(f(0,"div",39)(1,"span",40),_(2),p(),f(3,"div",41),ee(4,NS,2,1,"span",42,Ne),p()()),t&2){let e=m(),n=m(2);c(),E("pTooltip",n.texts.llm.fx.tooltip),c(),v(n.texts.llm.fx.label),c(2),te(e.sideEffects)}}function OS(t,i){if(t&1&&(S(0,MS,5,3,"div",39),S(1,kS,5,3,"div",39),S(2,RS,6,2,"div",39)),t&2){let e=i,n=m(2);I(n.showLlmWhat?0:-1),c(),I(e.invocationExample?1:-1),c(),I(e.sideEffects!=null&&e.sideEffects.length?2:-1)}}function FS(t,i){if(t&1&&(f(0,"div",24),S(1,pS,3,3),S(2,vS,4,4),S(3,DS,5,5),S(4,OS,3,3),p()),t&2){let e,n,o,r,a=m();c(),I((e=a.summaryMarkdown())?1:-1,e),c(),I((n=a.summaryAgent())?2:-1,n),c(),I((o=a.summarySkill())?3:-1,o),c(),I((r=a.summaryCommand())?4:-1,r)}}function AS(t,i){if(t&1&&(f(0,"div",25),_(1),p()),t&2){let e=m();c(),v(e.description())}}function LS(t,i){if(t&1&&(f(0,"div",44)(1,"div",45)(2,"span",46),_(3),p(),f(4,"span",47),_(5),p()()()),t&2){let e=m(),n=m();c(3),v(n.texts.meta.model),c(2),v(e.model)}}function BS(t,i){t&1&&S(0,LS,6,2,"div",44),t&2&&I(i.model?0:-1)}function zS(t,i){if(t&1&&(f(0,"div",49),B(1,"i",50),f(2,"code",51),_(3),p(),f(4,"span",52),_(5),p()()),t&2){let e=i.$implicit;re("sm-gnode__issue--error",e.severity==="error")("sm-gnode__issue--warn",e.severity==="warn"),E("pTooltip",e.detail??e.analyzerId+" \xB7 "+e.message),c(),re("pi",!0)("pi-times-circle",e.severity==="error")("pi-exclamation-triangle",e.severity==="warn"),c(2),v(e.analyzerId),c(2),v(e.message)}}function VS(t,i){if(t&1&&(f(0,"div",26),ee(1,zS,6,13,"div",48,Jw),p()),t&2){let e=m();c(),te(e.visibleIssues())}}function HS(t,i){if(t&1&&(f(0,"span",29),B(1,"i",53),f(2,"span",54),_(3),p()()),t&2){let e=m();E("pTooltip",e.texts.stats.errors(e.errorCount())),c(3),v(e.errorCount())}}function GS(t,i){if(t&1&&(f(0,"span",30),B(1,"i",55),f(2,"span",54),_(3),p()()),t&2){let e=m();E("pTooltip",e.texts.stats.warns(e.warnCount())),c(3),v(e.warnCount())}}var jS={selected:!1,highlighted:!1,dimmed:!1},Ul=class t{node=F.required();stats=F({linksIn:0,linksOut:0});summary=F(null);issues=F([]);selection=F(jS);isFavorite=F(!1);favoriteToggle=Ee();texts=gn;showLlmWhat=!1;showLlmConfidence=!1;expanded=nn(!1);fmAgent=D(()=>{let i=this.node();return i.kind==="agent"?i.frontmatter:null});summaryAgent=D(()=>{let i=this.summary();return i?.kind==="agent"?i:null});summarySkill=D(()=>{let i=this.summary();return i?.kind==="skill"?i:null});summaryCommand=D(()=>{let i=this.summary();return i?.kind==="command"?i:null});summaryMarkdown=D(()=>{let i=this.summary();return i?.kind==="markdown"?i:null});hasLlmCluster=D(()=>{let i=this.summary();return i===null?!1:this.showLlmWhat?!0:this.hasNonWhatLlmContent(i)});hasNonWhatLlmContent(i){switch(i.kind){case"markdown":return(i.topics?.length??0)>0||(i.keyFacts?.length??0)>0;case"agent":return!!i.whenToUse||!!i.interactionStyle||(i.capabilities?.length??0)>0;case"skill":return(i.recipe?.length??0)>0||(i.preconditions?.length??0)>0||(i.outputs?.length??0)>0||(i.sideEffects?.length??0)>0;case"command":return!!i.invocationExample||(i.sideEffects?.length??0)>0;default:return!1}}confidenceTier=D(()=>{let i=this.summary();return i?i.confidence>.8?"high":i.confidence>=.5?"med":"low":null});confidencePct=D(()=>{let i=this.summary();return i?Math.round(i.confidence*100):null});visibleIssues=D(()=>this.issues().filter(i=>i.severity==="error"||i.severity==="warn"));errorCount=D(()=>this.visibleIssues().filter(i=>i.severity==="error").length);warnCount=D(()=>this.visibleIssues().filter(i=>i.severity==="warn").length);nodeColor=D(()=>this.agentVendorColor());kindRegistry=d(En);providerAccent=D(()=>{let i=this.node();if(!i.provider)return null;let e=this.kindRegistry.lookup(i.kind);return!e||i.provider===e.primaryProviderId?null:e.providers[i.provider]?.color??null});providerChip=D(()=>Wm(this.node().provider));bytesShort=D(()=>{let i=this.stats().bytesTotal;return i===void 0?null:Nu(i)});tokensShort=D(()=>{let i=this.stats().tokensTotal;return i===void 0?null:Nu(i)});version=D(()=>Do(this.node()));stability=D(()=>Mo(this.node()));tagChips=D(()=>{let i=this.node(),e=[],o=i.frontmatter.tags;if(Array.isArray(o))for(let s of o)typeof s=="string"&&s.length>0&&e.push({tag:s,source:"author"});let a=i.sidecar?.annotations?.tags;if(Array.isArray(a))for(let s of a)typeof s=="string"&&s.length>0&&e.push({tag:s,source:"user"});else{let s=Eo(i.frontmatter)?.tags;if(Array.isArray(s))for(let l of s)typeof l=="string"&&l.length>0&&e.push({tag:l,source:"user"})}return e});visibleTagChips=D(()=>this.tagChips().slice(0,3));moreTagsCount=D(()=>Math.max(0,this.tagChips().length-3));agentVendorColor=D(()=>{let i=this.node();if(i.kind!=="agent")return null;let n=i.frontmatter.color;return typeof n=="string"&&n.length>0?n:null});displayName=D(()=>{let i=this.node().frontmatter;return i.name?i.name:pp(this.node().path)});description=D(()=>this.node().frontmatter.description??"");toggleExpanded(i){i.stopPropagation(),this.expanded.update(e=>!e)}toggleFavorite(i){i.stopPropagation();let e=!this.isFavorite();this.favoriteToggle.emit({path:this.node().path,value:e})}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-node-card"]],hostAttrs:[1,"sm-gnode"],hostVars:17,hostBindings:function(e,n){e&2&&(X("data-kind",n.node().kind),ot("--node-color",n.nodeColor())("--accent",n.providerAccent()),re("sm-gnode--with-color",!!n.nodeColor())("sm-gnode--deprecated",n.stability()==="deprecated")("sm-gnode--expanded",n.expanded())("sm-gnode--selected",n.selection().selected)("sm-gnode--highlighted",n.selection().highlighted)("sm-gnode--dimmed",n.selection().dimmed))},inputs:{node:[1,"node"],stats:[1,"stats"],summary:[1,"summary"],issues:[1,"issues"],selection:[1,"selection"],isFavorite:[1,"isFavorite"],expanded:[1,"expanded"]},outputs:{favoriteToggle:"favoriteToggle",expanded:"expandedChange"},decls:42,vars:38,consts:[[1,"sm-gnode__main"],["aria-hidden","true",1,"sm-gnode__icon-box"],[3,"kind","provider","size"],[1,"sm-gnode__content"],[1,"sm-gnode__name-row"],[1,"sm-gnode__name",3,"pTooltip"],["slot","card.title.right",3,"node"],[1,"sm-gnode__actions"],[1,"sm-gnode__confidence",3,"sm-gnode__llm-marker--low","sm-gnode__llm-marker--med","sm-gnode__llm-marker--high","pTooltip"],["data-testid","node-card-version",1,"sm-gnode__name-version"],["type","button",1,"sm-gnode__chevron",3,"click"],["aria-hidden","true",1,"pi","pi-chevron-down"],[1,"sm-gnode__sub"],[1,"sm-gnode__sub-stat","sm-gnode__sub-stat--tokens",3,"pTooltip"],[1,"sm-gnode__sub-stat","sm-gnode__sub-stat--bytes",3,"pTooltip"],["data-testid","node-card-provider",1,"sm-gnode__provider",3,"--provider-color","--provider-color-dark","pTooltip"],["type","button","data-testid","node-card-favorite",1,"sm-gnode__favorite",3,"click","pTooltip"],["aria-hidden","true",1,"pi"],["slot","card.subtitle.left",3,"node"],["data-testid","node-card-tags",1,"sm-gnode__tagrow"],[1,"sm-gnode__panel"],["data-testid","node-card-path",1,"sm-gnode__path",3,"pTooltip"],["aria-hidden","true",1,"fa-regular","fa-folder-open","sm-gnode__path-icon"],[1,"sm-gnode__path-value"],[1,"sm-gnode__llm"],[1,"sm-gnode__desc"],[1,"sm-gnode__issues-block"],[1,"sm-gnode__footer"],["slot","card.footer.left",3,"node"],[1,"sm-gnode__stat","sm-gnode__stat--error",3,"pTooltip"],[1,"sm-gnode__stat","sm-gnode__stat--warn",3,"pTooltip"],[1,"sm-gnode__footer-right-cluster"],["slot","card.footer.right",3,"node"],[1,"sm-gnode__confidence",3,"pTooltip"],[1,"sm-gnode__sub-key"],["data-testid","node-card-provider",1,"sm-gnode__provider",3,"pTooltip"],[1,"sm-gnode__tag-chip",3,"sm-gnode__tag-chip--author","sm-gnode__tag-chip--user"],["data-testid","node-card-tags-more",1,"sm-gnode__tag-more"],[1,"sm-gnode__tag-chip"],[1,"sm-gnode__llm-line"],[1,"sm-gnode__llm-label",3,"pTooltip"],[1,"sm-gnode__chips"],[1,"sm-gnode__chip","sm-gnode__chip--llm"],[1,"sm-gnode__llm-code"],[1,"sm-gnode__meta"],[1,"sm-gnode__meta-row"],[1,"sm-gnode__meta-label"],[1,"sm-gnode__meta-value","sm-gnode__meta-value--mono"],[1,"sm-gnode__issue",3,"sm-gnode__issue--error","sm-gnode__issue--warn","pTooltip"],[1,"sm-gnode__issue",3,"pTooltip"],["aria-hidden","true",1,"sm-gnode__issue-icon"],[1,"sm-gnode__issue-rule"],[1,"sm-gnode__issue-msg"],["aria-hidden","true",1,"fa-solid","fa-circle-xmark"],[1,"sm-gnode__stat-num"],["aria-hidden","true",1,"fa-solid","fa-triangle-exclamation"]],template:function(e,n){if(e&1&&(rt(0)(1)(2)(3)(4)(5),f(6,"div",0)(7,"div",1),B(8,"sm-kind-icon",2),p(),f(9,"div",3)(10,"div",4)(11,"span",5),_(12),p(),B(13,"sm-view-contributions-host",6),p()(),f(14,"div",7),S(15,eS,2,8,"span",8),S(16,tS,2,1,"span",9),f(17,"button",10),K("click",function(r){return n.toggleExpanded(r)}),B(18,"i",11),p()(),f(19,"div",12),S(20,nS,4,2,"span",13),S(21,iS,4,2,"span",14),S(22,oS,2,6,"span",15),f(23,"button",16),K("click",function(r){return n.toggleFavorite(r)}),B(24,"i",17),p(),B(25,"sm-view-contributions-host",18),p()(),S(26,sS,4,1,"div",19),f(27,"div",20)(28,"div",21),B(29,"i",22),f(30,"span",23),_(31),p()(),S(32,FS,5,4,"div",24),S(33,AS,2,1,"div",25),S(34,BS,1,1),S(35,VS,3,0,"div",26),p(),f(36,"div",27),B(37,"sm-view-contributions-host",28),S(38,HS,4,2,"span",29),S(39,GS,4,2,"span",30),f(40,"div",31),B(41,"sm-view-contributions-host",32),p()()),e&2){let o,r,a,s=Be(n.node());c();let l=Be(n.summary());c(),Be(n.stats()),c();let u=Be(n.confidenceTier());c();let h=Be(n.visibleTagChips());c(),Be(n.moreTagsCount()),c(3),E("kind",s.kind)("provider",s.provider)("size",18),c(3),E("pTooltip",n.displayName()),c(),v(n.displayName()),c(),E("node",n.node()),c(2),I(n.showLlmConfidence&&l!==null&&u!==null?15:-1),c(),I((o=n.version())?16:-1,o),c(),X("aria-label",n.texts.ariaExpand),c(3),I(n.tokensShort()!==null?20:-1),c(),I(n.bytesShort()!==null?21:-1),c(),I((r=n.providerChip())?22:-1,r),c(),re("sm-gnode__favorite--on",n.isFavorite()),E("pTooltip",n.isFavorite()?n.texts.favoriteRemoveTooltip:n.texts.favoriteAddTooltip),X("aria-label",n.isFavorite()?n.texts.ariaFavoriteRemove:n.texts.ariaFavoriteAdd),c(),re("pi-star-fill",n.isFavorite())("pi-star",!n.isFavorite()),c(),E("node",n.node()),c(),I(h.length?26:-1),c(2),E("pTooltip",s.path),c(3),v(s.path),c(),I(n.hasLlmCluster()?32:-1),c(),I(n.description()?33:-1),c(),I((a=n.fmAgent())?34:-1,a),c(),I(n.visibleIssues().length?35:-1),c(2),E("node",n.node()),c(),I(n.errorCount()>0?38:-1),c(),I(n.warnCount()>0?39:-1),c(2),E("node",n.node())}},dependencies:[$t,Re,Ve,Rt],styles:['[_nghost-%COMP%]{--accent: var(--sm-kind-markdown);position:relative;display:inline-block;width:260px;background:var(--sm-bg-content);border:1px solid var(--sm-border);border-radius:8px;box-shadow:var(--sm-shadow-card);overflow:hidden;transition:box-shadow .12s ease,border-color .12s ease,transform .12s ease;-webkit-user-select:none;user-select:none;text-align:start}[_nghost-%COMP%]:hover{box-shadow:var(--sm-shadow-card-hover)}[_nghost-%COMP%]:before{content:"";position:absolute;top:0;left:0;right:0;height:3px;background:var(--accent)}[data-kind="skill"][_nghost-%COMP%]{--accent: var(--sm-kind-skill)}[data-kind="agent"][_nghost-%COMP%]{--accent: var(--sm-kind-agent)}[data-kind="command"][_nghost-%COMP%]{--accent: var(--sm-kind-command)}[data-kind="markdown"][_nghost-%COMP%]{--accent: var(--sm-kind-markdown)}.sm-gnode--deprecated[_nghost-%COMP%]{opacity:.55}.sm-gnode--selected[_nghost-%COMP%]{border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color),0 4px 16px color-mix(in srgb,var(--p-primary-color) 25%,transparent)}.sm-gnode--highlighted[_nghost-%COMP%]{border-color:var(--p-primary-color);box-shadow:var(--sm-shadow-card-hover)}.sm-gnode--dimmed[_nghost-%COMP%]{opacity:.25}.sm-gnode__main[_ngcontent-%COMP%]{display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:.6rem;row-gap:.3rem;align-items:start;padding:.6rem .65rem}.sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-markdown-bg);--kind-fg: var(--sm-kind-markdown-fg);width:38px;height:38px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--kind-bg);color:var(--kind-fg);flex:none;font-size:1.05rem;grid-row:1 / span 2;align-self:center}[data-kind="skill"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-skill-bg);--kind-fg: var(--sm-kind-skill-fg)}[data-kind="agent"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-agent-bg);--kind-fg: var(--sm-kind-agent-fg)}[data-kind="command"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-command-bg);--kind-fg: var(--sm-kind-command-fg)}[data-kind="markdown"][_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-markdown-bg);--kind-fg: var(--sm-kind-markdown-fg)}.sm-gnode__content[_ngcontent-%COMP%]{min-width:0;width:100%;justify-self:stretch;display:flex;flex-direction:column;gap:.15rem}.sm-gnode__name-row[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:.35rem;min-width:0}.sm-gnode__name-row[_ngcontent-%COMP%] > sm-view-contributions-host[_ngcontent-%COMP%]{margin-left:auto;align-self:center}.sm-gnode__name[_ngcontent-%COMP%]{font-size:.9rem;font-weight:600;line-height:1.2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--p-text-color);flex:0 1 auto;min-width:0}.sm-gnode__name-version[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.65rem;color:var(--sm-text-muted);background:color-mix(in srgb,var(--accent) 10%,transparent);padding:.05rem .35rem;border-radius:var(--sm-radius-sm);line-height:1.2;flex:none;align-self:center}.sm-gnode--with-color[_nghost-%COMP%] .sm-gnode__name[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--node-color) 7%,transparent);padding:.05rem .4rem;border-radius:var(--sm-radius-sm)}.sm-gnode__actions[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.2rem}.sm-gnode__confidence[_ngcontent-%COMP%]{display:flex;align-items:flex-start;font-size:.65rem;font-weight:600;font-variant-numeric:tabular-nums;line-height:1;flex:none;cursor:help;padding-top:.35rem}.sm-gnode__llm-marker--high[_ngcontent-%COMP%]{color:var(--sm-severity-success)}.sm-gnode__llm-marker--med[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__llm-marker--low[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.sm-gnode__chevron[_ngcontent-%COMP%]{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;border:none;background:transparent;cursor:pointer;color:var(--sm-text-muted);border-radius:var(--sm-radius-md);transition:transform .16s ease,background .12s ease,color .12s ease}.sm-gnode__chevron[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.7rem;line-height:1}.sm-gnode__chevron[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover);color:var(--p-text-color)}.sm-gnode--expanded[_nghost-%COMP%] .sm-gnode__chevron[_ngcontent-%COMP%]{transform:rotate(180deg)}.sm-gnode__favorite[_ngcontent-%COMP%]{position:absolute;top:-3px;right:0;width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;border:none;background:transparent;cursor:pointer;color:var(--sm-text-muted);border-radius:var(--sm-radius-md);flex:none;transition:background .12s ease,color .12s ease}.sm-gnode__favorite[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.8rem;line-height:1}.sm-gnode__favorite[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover);color:var(--p-text-color)}.sm-gnode__favorite--on[_ngcontent-%COMP%], .sm-gnode__favorite--on[_ngcontent-%COMP%]:hover{color:var(--p-primary-color)}.sm-gnode__sub[_ngcontent-%COMP%]{position:relative;grid-column:2 / -1;grid-row:2;display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-family:var(--sm-font-mono);font-size:.6rem;color:var(--sm-text-muted);line-height:1.2;margin-top:.1rem;min-width:0;width:100%;padding-right:28px}.sm-gnode__sub-stat[_ngcontent-%COMP%]{padding:.08rem .35rem;border-radius:var(--sm-radius-sm);background:var(--sm-bg-hover);font-family:var(--sm-font-mono);font-size:.6rem;color:var(--sm-text-muted);font-weight:400;flex:none}.sm-gnode__sub-stat[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.15rem;cursor:help}.sm-gnode__sub-stat[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.65rem}.sm-gnode__sub-key[_ngcontent-%COMP%]{font-weight:700}.sm-gnode__sub-stat--tokens[_ngcontent-%COMP%]{background:var(--sm-stat-tokens-bg)}.sm-gnode__sub-stat--bytes[_ngcontent-%COMP%]{background:var(--sm-stat-bytes-bg)}.sm-gnode__provider[_ngcontent-%COMP%]{padding:.08rem .4rem;border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.6rem;font-weight:600;letter-spacing:.02em;color:var(--provider-color);background:color-mix(in srgb,var(--provider-color) 14%,transparent);cursor:help;flex:none;display:inline-flex;align-items:center}.app-dark[_nghost-%COMP%] .sm-gnode__provider[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__provider[_ngcontent-%COMP%]{color:var(--provider-color-dark);background:color-mix(in srgb,var(--provider-color-dark) 24%,transparent)}.sm-gnode__panel[_ngcontent-%COMP%]{display:none;border-top:1px solid var(--sm-border)}.sm-gnode--expanded[_nghost-%COMP%] .sm-gnode__panel[_ngcontent-%COMP%]{display:block}.sm-gnode__llm[_ngcontent-%COMP%]{padding:.5rem .7rem;display:flex;flex-direction:column;gap:.25rem;font-size:.75rem;line-height:1.4}.sm-gnode__llm-line[_ngcontent-%COMP%]{display:flex;gap:.4rem;align-items:baseline;color:var(--p-text-color);font-style:italic;min-width:0}.sm-gnode__llm-label[_ngcontent-%COMP%]{flex:none;font-style:normal;color:var(--sm-text-muted);font-size:.6rem;letter-spacing:.04em;text-transform:uppercase;font-weight:600;min-width:2.2rem;padding-top:.2rem;cursor:help}.sm-gnode__chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.25rem;flex:1;min-width:0}.sm-gnode__chip[_ngcontent-%COMP%]{font-size:.65rem;padding:.1rem .4rem;border-radius:var(--sm-radius-sm);border:1px solid var(--sm-border);background:var(--sm-bg-hover);color:var(--p-text-color);line-height:1.3}.sm-gnode__chip--mono[_ngcontent-%COMP%]{font-family:var(--sm-font-mono)}.sm-gnode__chip--allowed[_ngcontent-%COMP%]{border-style:dashed;background:transparent;color:var(--sm-text-muted)}.sm-gnode__chip--llm[_ngcontent-%COMP%]{font-style:italic}.sm-gnode__chip-required[_ngcontent-%COMP%]{color:var(--sm-severity-error);margin-left:2px}.sm-gnode__llm-code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);background:var(--sm-bg-hover);padding:.1rem .4rem;border-radius:var(--sm-radius-sm);font-size:.7rem;font-style:normal;color:var(--p-text-color)}.sm-gnode__path[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.35rem;padding:.4rem .7rem;font-family:var(--sm-font-mono);font-size:.68rem;color:var(--sm-text-muted);background:var(--sm-bg-hover);border-top:1px solid var(--sm-border);min-width:0}.sm-gnode__path-icon[_ngcontent-%COMP%]{flex:none;font-size:.7rem;color:var(--sm-text-muted)}.sm-gnode__path-value[_ngcontent-%COMP%]{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;direction:rtl;unicode-bidi:plaintext;text-align:left}.sm-gnode__desc[_ngcontent-%COMP%]{padding:.55rem .7rem;font-size:.78rem;line-height:1.45;color:var(--p-text-color);max-height:140px;overflow-y:auto;overscroll-behavior:contain;border-top:1px solid var(--sm-border);scrollbar-width:thin;scrollbar-color:var(--sm-border) transparent}.sm-gnode__desc[_ngcontent-%COMP%]::-webkit-scrollbar{width:6px}.sm-gnode__desc[_ngcontent-%COMP%]::-webkit-scrollbar-track{background:transparent}.sm-gnode__desc[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{background:var(--sm-border);border-radius:var(--sm-radius-sm)}.sm-gnode__meta[_ngcontent-%COMP%]{padding:.5rem .7rem;border-top:1px solid var(--sm-border);display:flex;flex-direction:column;gap:.35rem}.sm-gnode__meta-row[_ngcontent-%COMP%]{display:flex;align-items:flex-start;gap:.5rem;font-size:.7rem;min-width:0}.sm-gnode__meta-label[_ngcontent-%COMP%]{color:var(--sm-text-muted);text-transform:uppercase;letter-spacing:.04em;font-weight:600;font-size:.6rem;flex:none;min-width:60px;padding-top:.15rem}.sm-gnode__meta-value[_ngcontent-%COMP%]{color:var(--p-text-color);font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.sm-gnode__meta-value--mono[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);background:var(--sm-bg-hover);padding:.08rem .4rem;border-radius:var(--sm-radius-sm);font-size:.68rem}.sm-gnode__issues-block[_ngcontent-%COMP%]{padding:.5rem .7rem;border-top:1px solid var(--sm-border);display:flex;flex-direction:column;gap:.25rem}.sm-gnode__issue[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:.35rem;font-size:.7rem;line-height:1.35;min-width:0}.sm-gnode__issue-icon[_ngcontent-%COMP%]{font-size:.7rem;flex:none}.sm-gnode__issue--error[_ngcontent-%COMP%] .sm-gnode__issue-icon[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.sm-gnode__issue--warn[_ngcontent-%COMP%] .sm-gnode__issue-icon[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__issue-rule[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);color:var(--sm-text-muted);flex:none;font-size:.65rem}.sm-gnode__issue-msg[_ngcontent-%COMP%]{color:var(--p-text-color);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.sm-gnode__footer[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.7rem;min-height:1.4rem;padding:.4rem .7rem;border-top:1px solid var(--sm-border);background:var(--sm-bg-hover);font-size:.7rem;color:var(--sm-text-muted)}.sm-gnode__footer-right-cluster[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.7rem;margin-left:auto}.sm-gnode__stat[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.3rem;line-height:1}.sm-gnode__stat[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.6rem;line-height:1;display:block}.sm-gnode__stat[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{transform:translateY(1px)}.sm-gnode__stat-num[_ngcontent-%COMP%]{font-weight:600;color:var(--p-text-color);line-height:1;display:block}.sm-gnode__stat--error[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error);padding:.1rem .4rem;border-radius:var(--sm-radius-sm)}.sm-gnode__stat--error[_ngcontent-%COMP%] .sm-gnode__stat-num[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.sm-gnode__stat--warn[_ngcontent-%COMP%]{background:var(--sm-severity-warn-bg);color:var(--sm-severity-warn);padding:.1rem .4rem;border-radius:var(--sm-radius-sm)}.sm-gnode__stat--warn[_ngcontent-%COMP%] .sm-gnode__stat-num[_ngcontent-%COMP%], .sm-gnode__stat--stale[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__tagrow[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.25rem;padding:0 .65rem .35rem}.sm-gnode__tag-chip[_ngcontent-%COMP%]{font-size:.6rem;font-family:var(--sm-font-mono);padding:.05rem .35rem;border-radius:var(--sm-radius-sm);background:var(--sm-bg-hover);color:var(--sm-text-muted);border:1px solid var(--sm-border);line-height:1.4}.sm-gnode__tag-chip--author[_ngcontent-%COMP%]{background:transparent;border-color:var(--accent);color:var(--accent)}.sm-gnode__tag-more[_ngcontent-%COMP%]{font-size:.6rem;color:var(--sm-text-muted);font-style:italic}'],changeDetection:0})};var qm={a11y:{expand:"Expand performance HUD",collapse:"Collapse performance HUD"},units:{fps:t=>`${t} fps`,ms:t=>`${t}ms`,mb:t=>`${t} MB`,longTasks:t=>`${t} long`,domNodes:t=>`${t} dom`,nodes:(t,i)=>`${t}/${i} nodes`,edges:t=>`${t} edges`,cacheAge:t=>`cache ${t}s`}};var US=["sparkline"],WS=()=>({class:"perf-hud__content"}),$S=t=>({content:t});function KS(t,i){if(t&1&&(f(0,"span",5),_(1,"\xB7"),p(),f(2,"span",3),_(3),p()),t&2){let e=m(3);c(3),v(e.texts.units.mb(e.heapMb()))}}function XS(t,i){if(t&1&&(f(0,"span",5),_(1,"\xB7"),p(),f(2,"span",3),_(3),p()),t&2){let e=m(3);c(3),v(e.texts.units.cacheAge(e.cacheAgeSec()))}}function qS(t,i){if(t&1&&(B(0,"canvas",4,1),f(2,"span",5),_(3,"\xB7"),p(),f(4,"span",3),_(5),p(),S(6,KS,4,1),f(7,"span",5),_(8,"\xB7"),p(),f(9,"span",3),_(10),p(),f(11,"span",5),_(12,"\xB7"),p(),f(13,"span",3),_(14),p(),f(15,"span",5),_(16,"\xB7"),p(),f(17,"span",3),_(18),p(),f(19,"span",5),_(20,"\xB7"),p(),f(21,"span",3),_(22),p(),S(23,XS,4,1)),t&2){let e=m(2);c(5),v(e.texts.units.ms(e.frameTimeMs())),c(),I(e.hasHeap()?6:-1),c(4),v(e.texts.units.longTasks(e.longTasks())),c(4),v(e.texts.units.domNodes(e.domNodes())),c(4),v(e.texts.units.nodes(e.visible(),e.total())),c(4),v(e.texts.units.edges(e.edges())),c(),I(e.cacheAgeSec()!==null?23:-1)}}function YS(t,i){if(t&1&&(f(0,"span",3),_(1),p(),S(2,qS,24,7)),t&2){let e=m();c(),v(e.texts.units.fps(e.fps())),c(),I(e.expanded()?2:-1)}}var ZS=30,hp=60,Wl=14,$l=class t{visible=F(0);total=F(0);edges=F(0);cacheAt=F(null);texts=qm;destroyRef=d(We);zone=d(ui);fps=W(0);frameTimeMs=W(0);fpsSamples=W([]);sparklineCanvas=Se("sparkline");heapMb=W(null);longTasks=W(0);domNodes=W(0);nowTick=W(performance.now());expanded=W(QS());cacheAgeSec=D(()=>{let i=this.cacheAt();return i===null?null:Math.max(0,Math.floor((this.nowTick()-i)/1e3))});hasHeap=D(()=>this.heapMb()!==null);constructor(){let i=0,e=0,n=performance.now(),o=n,r=0,a=l=>{let u=l-n;if(n=l,i+=1,e+=u,l-o>=1e3){let h=(l-o)/1e3,g=Math.round(i/h);this.fps.set(g),this.frameTimeMs.set(Math.round(e/Math.max(i,1))),this.heapMb.set(eI()),this.domNodes.set(document.querySelectorAll("*").length),this.nowTick.set(l),this.fpsSamples.update(w=>{let b=w.length>=ZS?w.slice(1):w.slice();return b.push(g),b}),i=0,e=0,o=l}r=requestAnimationFrame(a)};this.zone.runOutsideAngular(()=>{r=requestAnimationFrame(a)});let s=null;if(typeof PerformanceObserver<"u")try{s=new PerformanceObserver(l=>{this.longTasks.update(u=>u+l.getEntries().length)}),s.observe({type:"longtask",buffered:!0})}catch{}this.destroyRef.onDestroy(()=>{cancelAnimationFrame(r),s?.disconnect()}),ae(()=>{let l=this.sparklineCanvas(),u=this.fpsSamples();l&&tI(l.nativeElement,u)})}setExpanded(i){this.expanded.set(i),JS(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-perf-hud"]],viewQuery:function(e,n){e&1&&ut(n.sparklineCanvas,US,5),e&2&&it()},inputs:{visible:[1,"visible"],total:[1,"total"],edges:[1,"edges"],cacheAt:[1,"cacheAt"]},decls:3,vars:6,consts:[["content",""],["sparkline",""],["styleClass","perf-hud","data-testid","perf-hud",3,"ngModelChange","ngModel","ariaLabel","pt"],[1,"perf-hud__cell"],["aria-hidden","true",1,"perf-hud__sparkline"],["aria-hidden","true",1,"perf-hud__sep"]],template:function(e,n){e&1&&(f(0,"p-togglebutton",2),K("ngModelChange",function(r){return n.setExpanded(r)}),be(1,YS,3,2,"ng-template",null,0,tn),p()),e&2&&E("ngModel",n.expanded())("ariaLabel",n.expanded()?n.texts.a11y.collapse:n.texts.a11y.expand)("pt",en(4,$S,Jt(3,WS)))},dependencies:[Nn,Mn,kn,On,Rn],styles:["[_nghost-%COMP%]{position:absolute;bottom:16px;left:16px;z-index:2;pointer-events:none}.perf-hud[_ngcontent-%COMP%]{pointer-events:auto;--p-togglebutton-padding: 0;--p-togglebutton-content-padding: .25rem .7rem;--p-togglebutton-border-radius: var(--sm-radius-pill);--p-togglebutton-content-border-radius: var(--sm-radius-pill);--p-togglebutton-gap: .4rem;--p-togglebutton-background: var(--sm-bg-content);--p-togglebutton-checked-background: var(--sm-bg-content);--p-togglebutton-hover-background: var(--sm-bg-content);--p-togglebutton-border-color: var(--sm-border);--p-togglebutton-checked-border-color: var(--sm-border);--p-togglebutton-content-checked-background: transparent;--p-togglebutton-color: var(--p-text-muted-color);--p-togglebutton-hover-color: var(--p-text-color);--p-togglebutton-checked-color: var(--p-text-muted-color);box-shadow:var(--sm-shadow-floating);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.7rem;font-weight:500;line-height:14px;opacity:.75;transition:opacity .15s ease,color .15s ease}.perf-hud[_ngcontent-%COMP%]:hover{opacity:1}[_nghost-%COMP%] .perf-hud__content{display:inline-flex;align-items:center;gap:.4rem}.perf-hud__cell[_ngcontent-%COMP%]{white-space:nowrap;font-variant-numeric:tabular-nums}.perf-hud__sep[_ngcontent-%COMP%]{opacity:.45}.perf-hud__sparkline[_ngcontent-%COMP%]{width:60px;height:14px;opacity:.6}"],changeDetection:0})},Ym="sm.perf-hud.expanded";function QS(){try{return localStorage.getItem(Ym)==="1"}catch{return!1}}function JS(t){try{localStorage.setItem(Ym,t?"1":"0")}catch{}}function eI(){let t=performance.memory;return t?Math.round(t.usedJSHeapSize/1024/1024):null}function tI(t,i){let e=window.devicePixelRatio||1,n=hp*e,o=Wl*e;(t.width!==n||t.height!==o)&&(t.width=n,t.height=o);let r=t.getContext("2d");if(!r||(r.setTransform(e,0,0,e,0,0),r.clearRect(0,0,hp,Wl),i.length<2))return;let a=Math.max(60,...i),s=hp/(i.length-1);r.beginPath();for(let l=0;l<i.length;l+=1){let u=l*s,h=Wl-i[l]/a*Wl;l===0?r.moveTo(u,h):r.lineTo(u,h)}r.strokeStyle=getComputedStyle(t).color,r.lineWidth=1,r.stroke()}var nI="debug-perf",Kl=class t{visible=W(this.resolveInitial());resolveInitial(){let e=new URLSearchParams(window.location.search).get(nI);return e==="1"||e==="true"?!0:e==="0"||e==="false"?!1:oi.graph.perfHud}static \u0275fac=function(e){return new(e||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})};var Zm=`
|
|
215
|
-
.p-card {
|
|
216
|
-
background: dt('card.background');
|
|
217
|
-
color: dt('card.color');
|
|
218
|
-
box-shadow: dt('card.shadow');
|
|
219
|
-
border-radius: dt('card.border.radius');
|
|
220
|
-
display: flex;
|
|
221
|
-
flex-direction: column;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
.p-card-caption {
|
|
225
|
-
display: flex;
|
|
226
|
-
flex-direction: column;
|
|
227
|
-
gap: dt('card.caption.gap');
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.p-card-body {
|
|
231
|
-
padding: dt('card.body.padding');
|
|
232
|
-
display: flex;
|
|
233
|
-
flex-direction: column;
|
|
234
|
-
gap: dt('card.body.gap');
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.p-card-title {
|
|
238
|
-
font-size: dt('card.title.font.size');
|
|
239
|
-
font-weight: dt('card.title.font.weight');
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
.p-card-subtitle {
|
|
243
|
-
color: dt('card.subtitle.color');
|
|
244
|
-
}
|
|
245
|
-
`;var iI=["header"],oI=["title"],rI=["subtitle"],aI=["content"],sI=["footer"],cI=["*",[["p-header"]],[["p-footer"]]],dI=["*","p-header","p-footer"];function lI(t,i){t&1&&bn(0)}function uI(t,i){if(t&1&&(f(0,"div",1),Pe(1,1),be(2,lI,1,0,"ng-container",2),p()),t&2){let e=m();Le(e.cx("header")),E("pBind",e.ptm("header")),c(2),E("ngTemplateOutlet",e.headerTemplate||e._headerTemplate)}}function fI(t,i){if(t&1&&(Yt(0),_(1),Zt()),t&2){let e=m(2);c(),v(e.header)}}function pI(t,i){t&1&&bn(0)}function hI(t,i){if(t&1&&(f(0,"div",1),be(1,fI,2,1,"ng-container",3)(2,pI,1,0,"ng-container",2),p()),t&2){let e=m();Le(e.cx("title")),E("pBind",e.ptm("title")),c(),E("ngIf",e.header&&!e._titleTemplate&&!e.titleTemplate),c(),E("ngTemplateOutlet",e.titleTemplate||e._titleTemplate)}}function mI(t,i){if(t&1&&(Yt(0),_(1),Zt()),t&2){let e=m(2);c(),v(e.subheader)}}function _I(t,i){t&1&&bn(0)}function gI(t,i){if(t&1&&(f(0,"div",1),be(1,mI,2,1,"ng-container",3)(2,_I,1,0,"ng-container",2),p()),t&2){let e=m();Le(e.cx("subtitle")),E("pBind",e.ptm("subtitle")),c(),E("ngIf",e.subheader&&!e._subtitleTemplate&&!e.subtitleTemplate),c(),E("ngTemplateOutlet",e.subtitleTemplate||e._subtitleTemplate)}}function yI(t,i){t&1&&bn(0)}function vI(t,i){t&1&&bn(0)}function CI(t,i){if(t&1&&(f(0,"div",1),Pe(1,2),be(2,vI,1,0,"ng-container",2),p()),t&2){let e=m();Le(e.cx("footer")),E("pBind",e.ptm("footer")),c(2),E("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}var xI=`
|
|
246
|
-
${Zm}
|
|
247
|
-
|
|
248
|
-
.p-card {
|
|
249
|
-
display: block;
|
|
250
|
-
}
|
|
251
|
-
`,bI={root:"p-card p-component",header:"p-card-header",body:"p-card-body",caption:"p-card-caption",title:"p-card-title",subtitle:"p-card-subtitle",content:"p-card-content",footer:"p-card-footer"},Qm=(()=>{class t extends Yp{name="card";style=xI;classes=bI;static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=y({token:t,factory:t.\u0275fac})}return t})();var Jm=new pe("CARD_INSTANCE"),ro=(()=>{class t extends Qp{componentName="Card";$pcCard=d(Jm,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=d(pi,{self:!0});_componentStyle=d(Qm);onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["host","root"]))}header;subheader;set style(e){Kp(this._style(),e)||(this._style.set(e),this.el?.nativeElement&&e&&Object.keys(e).forEach(n=>{this.el.nativeElement.style[n]=e[n]}))}get style(){return this._style()}styleClass;headerFacet;footerFacet;headerTemplate;titleTemplate;subtitleTemplate;contentTemplate;footerTemplate;_headerTemplate;_titleTemplate;_subtitleTemplate;_contentTemplate;_footerTemplate;_style=W(null);getBlockableElement(){return this.el.nativeElement}templates;onAfterContentInit(){this.templates.forEach(e=>{switch(e.getType()){case"header":this._headerTemplate=e.template;break;case"title":this._titleTemplate=e.template;break;case"subtitle":this._subtitleTemplate=e.template;break;case"content":this._contentTemplate=e.template;break;case"footer":this._footerTemplate=e.template;break;default:this._contentTemplate=e.template;break}})}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=Z({type:t,selectors:[["p-card"]],contentQueries:function(n,o,r){if(n&1&&Vp(r,Xp,5)(r,qp,5)(r,iI,4)(r,oI,4)(r,rI,4)(r,aI,4)(r,sI,4)(r,Sn,4),n&2){let a;St(a=It())&&(o.headerFacet=a.first),St(a=It())&&(o.footerFacet=a.first),St(a=It())&&(o.headerTemplate=a.first),St(a=It())&&(o.titleTemplate=a.first),St(a=It())&&(o.subtitleTemplate=a.first),St(a=It())&&(o.contentTemplate=a.first),St(a=It())&&(o.footerTemplate=a.first),St(a=It())&&(o.templates=a)}},hostVars:4,hostBindings:function(n,o){n&2&&(Hp(o._style()),Le(o.cn(o.cx("root"),o.styleClass)))},inputs:{header:"header",subheader:"subheader",style:"style",styleClass:"styleClass"},features:[ge([Qm,{provide:Jm,useExisting:t},{provide:Zp,useExisting:t}]),zp([pi]),_e],ngContentSelectors:dI,decls:8,vars:11,consts:[[3,"pBind","class",4,"ngIf"],[3,"pBind"],[4,"ngTemplateOutlet"],[4,"ngIf"]],template:function(n,o){n&1&&(Qt(cI),be(0,uI,3,4,"div",0),f(1,"div",1),be(2,hI,3,5,"div",0)(3,gI,3,5,"div",0),f(4,"div",1),Pe(5),be(6,yI,1,0,"ng-container",2),p(),be(7,CI,3,4,"div",0),p()),n&2&&(E("ngIf",o.headerFacet||o.headerTemplate||o._headerTemplate),c(),Le(o.cx("body")),E("pBind",o.ptm("body")),c(),E("ngIf",o.header||o.titleTemplate||o._titleTemplate),c(),E("ngIf",o.subheader||o.subtitleTemplate||o._subtitleTemplate),c(),Le(o.cx("content")),E("pBind",o.ptm("content")),c(2),E("ngTemplateOutlet",o.contentTemplate||o._contentTemplate),c(),E("ngIf",o.footerFacet||o.footerTemplate||o._footerTemplate))},dependencies:[Co,jp,Up,wo,So,pi],encapsulation:2,changeDetection:0})}return t})(),Xl=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=_o({type:t});static \u0275inj=fo({imports:[ro,wo,So,wo,So]})}return t})();var Xt={emptyNoSelection:{title:"No node selected",descPrefix:"Pick a node from the ",listLink:"list",descMiddle:" or ",graphLink:"graph",descSuffix:"."},emptyNotFound:{title:"Node not found",descSuffix:" does not exist in the collection. ",backLink:"Back to list",descAfterLink:"."},backToList:"\u2190 back to list",cards:{agent:"Agent",body:"Body"},body:{loading:"Loading body\u2026",empty:"This file has no body content (only frontmatter).",unavailable:"Body content unavailable. The source file may have moved or been deleted since the last scan.",renderError:"Failed to render markdown body.",refreshLabel:"Refresh body"},placeholders:{enrichmentTitle:"Enrichment",summaryTitle:"Summary",findingsTitle:"Findings",body:"Available in v0.8.0"},cardsAnnotations:"Annotations",bump:{label:"Bump version",tooltipEnabled:"Increment the sidecar version and refresh hashes.",tooltipDisabledFresh:"No drift detected (bump is only available when the body or frontmatter has changed since the last bump).",errorPrefix:"Bump failed:",errorFresh:"This node is fresh; nothing to bump.",errorNotFound:"Node not found on the server.",errorGeneric:"Could not bump the sidecar.",consentHeader:"Save extra info alongside your files?",consentMessage:`Skill-map can keep a small companion file (*.sm) next to each of your markdown files. It tracks version, history and tags so you can see how each one evolves over time.
|
|
252
|
-
|
|
253
|
-
We use a separate \`.sm\` file so your markdown stays clean, no metadata gets mixed into the content you wrote.
|
|
254
|
-
|
|
255
|
-
Your preference stays on your computer, it does not travel with the project, and we won't ask again.`,consentAccept:"Yes, allow",consentReject:"Not now",consentDialogAriaLabel:"Sidecar consent"},stats:{bytes:"Bytes",tokens:"Tokens",links:"Links",out:"out",in:"in",ext:"ext"},pluginsHeader:"Plugin contributions",audit:{header:"Audit",headerSummary:(t,i)=>`last bumped ${t} by ${i}`,headerEmpty:"never bumped",fields:{lastBumpedAt:"Last bumped",lastBumpedBy:"by",createdAt:"Created",createdBy:"by"}},supersededByBanner:t=>`Superseded by ${t}`,debugToggleAriaLabel:"Toggle debug panel",debugToggleTooltip:"Show diagnostic fields (hash diffs, resolved provider/kind, sidecar status enum).",close:{label:"Close",tooltip:"Close inspector"}};var ql=class t{dataSource=d(kt);wsEvents=d(Po);loader=d(Nt);destroyRef=d(We);constructor(){this.wsEvents.sidecarBumped$.pipe(Pn(this.destroyRef)).subscribe(i=>{this.loader.patchSidecarFromBump({nodePath:i.data.nodePath,version:i.data.version,status:i.data.status})})}async bump(i,e={}){return this.dataSource.bumpSidecar(i,e)}static \u0275fac=function(e){return new(e||t)};static \u0275prov=y({token:t,factory:t.\u0275fac,providedIn:"root"})};var t_={cardHeader:"Annotations",emptyOverlay:"No sidecar (.sm) file present for this node.",emptyAnnotations:"Sidecar present but no annotations are declared yet.",sections:{lifecycle:"Lifecycle",supersession:"Supersession",provenance:"Provenance",taxonomy:"Taxonomy",docs:"Docs"},fields:{version:"Version",stability:"Stability",supersedes:"Supersedes",supersededBy:"Superseded by",authors:"Authors",license:"License",source:"Source",sourceVersion:"Source version",tags:"Tags",docsUrl:"Docs URL"},brokenRefTooltip:"This path does not resolve to a node in the current scan scope."};var II=(t,i)=>"a:"+i,TI=(t,i)=>"u:"+i;function PI(t,i){if(t&1&&(f(0,"p",0),_(1),p()),t&2){let e=m(2);c(),v(e.texts.emptyOverlay)}}function EI(t,i){if(t&1&&(f(0,"p",1),_(1),p()),t&2){let e=m(2);c(),v(e.texts.emptyAnnotations)}}function DI(t,i){if(t&1&&S(0,PI,2,1,"p",0)(1,EI,2,1,"p",1),t&2){let e,n=m();I((e=n.overlay())!=null&&e.present?1:0)}}function MI(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd",9)(3,"code"),_(4),p()()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.version),c(3),v(e.version)}}function kI(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd"),B(3,"p-tag",10),p()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.stability),c(2),E("value",e.stability)("severity",n.stabilitySeverity(e.stability))("rounded",!0)}}function NI(t,i){if(t&1&&(rt(0),f(1,"section",2)(2,"h4",7),_(3),p(),f(4,"dl",8),S(5,MI,5,2),S(6,kI,4,4),p()()),t&2){let e=m(2),n=Be(e.lifecycle());c(3),v(e.texts.sections.lifecycle),c(2),I(n.version!==null?5:-1),c(),I(n.stability!==null?6:-1)}}function RI(t,i){if(t&1){let e=ce();f(0,"h5"),_(1),p(),f(2,"div",11)(3,"p-chip",12),K("click",function(){G(e),m();let o=J(0),r=m(2);return j(r.onOpenPath(o.supersededBy))}),p()()}if(t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.supersededBy),c(2),E("label",e.supersededBy)("styleClass",n.isBroken(e.supersededBy)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e.supersededBy)?n.texts.brokenRefTooltip:"")}}function OI(t,i){if(t&1){let e=ce();f(0,"p-chip",12),K("click",function(){let o=G(e).$implicit,r=m(4);return j(r.onOpenPath(o))}),p()}if(t&2){let e=i.$implicit,n=m(4);E("label",e)("styleClass",n.isBroken(e)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e)?n.texts.brokenRefTooltip:"")}}function FI(t,i){if(t&1&&(f(0,"h5"),_(1),p(),f(2,"div",11),ee(3,OI,1,3,"p-chip",13,Ne),p()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.supersedes),c(2),te(e.supersedes)}}function AI(t,i){if(t&1&&(rt(0),f(1,"section",3)(2,"h4",7),_(3),p(),S(4,RI,4,4),S(5,FI,5,1),p()),t&2){let e=m(2),n=Be(e.supersession());c(3),v(e.texts.sections.supersession),c(),I(n.supersededBy!==null?4:-1),c(),I(n.supersedes.length?5:-1)}}function LI(t,i){if(t&1&&B(0,"p-chip",14),t&2){let e=i.$implicit;E("label",e)}}function BI(t,i){if(t&1&&(f(0,"h5"),_(1),p(),f(2,"div",11),ee(3,LI,1,1,"p-chip",14,Ne),p()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.authors),c(2),te(e.authors)}}function zI(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd"),_(3),p()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.license),c(2),v(e.license)}}function VI(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"a",15),_(4),p()()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.source),c(2),E("href",e.source,Tu),c(),v(e.source)}}function HI(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.sourceVersion),c(3),v(e.sourceVersion)}}function GI(t,i){if(t&1&&(rt(0),f(1,"section",4)(2,"h4",7),_(3),p(),S(4,BI,5,1),f(5,"dl",8),S(6,zI,4,2),S(7,VI,5,3),S(8,HI,5,2),p()()),t&2){let e=m(2),n=Be(e.provenance());c(3),v(e.texts.sections.provenance),c(),I(n.authors.length?4:-1),c(2),I(n.license!==null?6:-1),c(),I(n.source!==null?7:-1),c(),I(n.sourceVersion!==null?8:-1)}}function jI(t,i){if(t&1){let e=ce();f(0,"p-chip",19),K("click",function(){let o=G(e).$implicit,r=m(3);return j(r.tagClick.emit(o))})("keydown.enter",function(){let o=G(e).$implicit,r=m(3);return j(r.tagClick.emit(o))})("keydown.space",function(o){let r=G(e).$implicit;return m(3).tagClick.emit(r),j(o.preventDefault())}),p()}if(t&2){let e=i.$implicit,n=m(3);E("label",e)("styleClass","ann-panel__chip ann-panel__chip--author"+(n.isActiveTag(e)?" ann-panel__chip--active":""))}}function UI(t,i){if(t&1){let e=ce();f(0,"p-chip",20),K("click",function(){let o=G(e).$implicit,r=m(3);return j(r.tagClick.emit(o))})("keydown.enter",function(){let o=G(e).$implicit,r=m(3);return j(r.tagClick.emit(o))})("keydown.space",function(o){let r=G(e).$implicit;return m(3).tagClick.emit(r),j(o.preventDefault())}),p()}if(t&2){let e=i.$implicit,n=m(3);E("label",e)("styleClass","ann-panel__chip ann-panel__chip--user"+(n.isActiveTag(e)?" ann-panel__chip--active":""))}}function WI(t,i){if(t&1&&(f(0,"section",5)(1,"h4",7),_(2),p(),f(3,"h5"),_(4),p(),f(5,"div",16),ee(6,jI,1,2,"p-chip",17,II),ee(8,UI,1,2,"p-chip",18,TI),p()()),t&2){let e=m(2),n=e.taxonomy();c(2),v(e.texts.sections.taxonomy),c(2),v(e.texts.fields.tags),c(2),te(n.authorTags),c(2),te(n.userTags)}}function $I(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"a",15),_(4),p()()),t&2){m();let e=J(0),n=m(2);c(),v(n.texts.fields.docsUrl),c(2),E("href",e.docsUrl,Tu),c(),v(e.docsUrl)}}function KI(t,i){if(t&1&&(rt(0),f(1,"section",6)(2,"h4",7),_(3),p(),f(4,"dl",8),S(5,$I,5,3),p()()),t&2){let e=m(2),n=Be(e.docs());c(3),v(e.texts.sections.docs),c(2),I(n.docsUrl!==null?5:-1)}}function XI(t,i){if(t&1&&(S(0,NI,7,4,"section",2),S(1,AI,6,4,"section",3),S(2,GI,9,6,"section",4),S(3,WI,10,2,"section",5),S(4,KI,6,3,"section",6)),t&2){let e=m();I(e.hasLifecycle()?0:-1),c(),I(e.hasSupersession()?1:-1),c(),I(e.hasProvenance()?2:-1),c(),I(e.hasTaxonomy()?3:-1),c(),I(e.hasDocs()?4:-1)}}var Zl=class t{overlay=F(void 0);authorTags=F([]);knownPaths=F(null);openPath=Ee();tagClick=Ee();activeTag=F(null);isActiveTag(i){return this.activeTag()===i}texts=t_;annotations=D(()=>{let i=this.overlay();return!i||!i.present?null:i.annotations??null});hasAnnotations=D(()=>{let i=this.annotations();return i!==null&&Object.keys(i).length>0});hasAnyContent=D(()=>this.hasLifecycle()||this.hasSupersession()||this.hasProvenance()||this.hasTaxonomy()||this.hasDocs());lifecycle=D(()=>{let i=this.annotations()??{};return{version:qI(i.version),stability:YI(i.stability)}});hasLifecycle=D(()=>Yl(this.lifecycle()));supersession=D(()=>{let i=this.annotations()??{};return{supersedes:_p(i.supersedes),supersededBy:mp(i.supersededBy)}});hasSupersession=D(()=>Yl(this.supersession()));provenance=D(()=>{let i=this.annotations()??{};return{authors:_p(i.authors),license:mp(i.license),source:n_(i.source),sourceVersion:mp(i.sourceVersion)}});hasProvenance=D(()=>Yl(this.provenance()));taxonomy=D(()=>{let i=this.annotations()??{};return{authorTags:this.authorTags(),userTags:_p(i.tags)}});hasTaxonomy=D(()=>{let i=this.taxonomy();return i.authorTags.length>0||i.userTags.length>0});docs=D(()=>{let i=this.annotations()??{};return{docsUrl:n_(i.docsUrl)}});hasDocs=D(()=>Yl(this.docs()));stabilitySeverity(i){return sh[i]}isBroken(i){let e=this.knownPaths();return e?!e.has(i):!1}onOpenPath(i){this.isBroken(i)||this.openPath.emit(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-annotations-panel"]],inputs:{overlay:[1,"overlay"],authorTags:[1,"authorTags"],knownPaths:[1,"knownPaths"],activeTag:[1,"activeTag"]},outputs:{openPath:"openPath",tagClick:"tagClick"},decls:2,vars:1,consts:[["data-testid","annotations-panel-empty-overlay",1,"ann-panel__empty"],["data-testid","annotations-panel-empty-annotations",1,"ann-panel__empty"],["data-testid","annotations-section-lifecycle",1,"ann-panel__section"],["data-testid","annotations-section-supersession",1,"ann-panel__section"],["data-testid","annotations-section-provenance",1,"ann-panel__section"],["data-testid","annotations-section-taxonomy",1,"ann-panel__section"],["data-testid","annotations-section-docs",1,"ann-panel__section"],[1,"ann-panel__section-title"],[1,"ann-panel__kv"],["data-testid","annotations-version"],["data-testid","annotations-stability",3,"value","severity","rounded"],[1,"ann-panel__chips"],[3,"click","label","styleClass","pTooltip"],[3,"label","styleClass","pTooltip"],[3,"label"],["target","_blank","rel","noopener noreferrer",3,"href"],["data-testid","annotations-tags",1,"ann-panel__chips"],["data-tag-source","author","role","button","tabindex","0",3,"label","styleClass"],["data-tag-source","user","role","button","tabindex","0",3,"label","styleClass"],["data-tag-source","author","role","button","tabindex","0",3,"click","keydown.enter","keydown.space","label","styleClass"],["data-tag-source","user","role","button","tabindex","0",3,"click","keydown.enter","keydown.space","label","styleClass"]],template:function(e,n){e&1&&S(0,DI,2,1)(1,XI,5,5),e&2&&I(n.hasAnyContent()?1:0)},dependencies:[Fn,ko,Ro,No,Re,Ve],styles:["[_nghost-%COMP%]{display:block}.ann-panel__empty[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-style:italic;font-size:.85rem;margin:0}.ann-panel__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem;padding:.4rem 0}.ann-panel__section[_ngcontent-%COMP%] + .ann-panel__section[_ngcontent-%COMP%]{border-top:1px solid var(--sm-border);padding-top:.6rem}.ann-panel__section-title[_ngcontent-%COMP%]{font-size:.7rem;text-transform:uppercase;letter-spacing:.06em;color:var(--sm-text-muted);margin:0 0 .2rem;font-weight:600}.ann-panel__section[_ngcontent-%COMP%] h5[_ngcontent-%COMP%]{margin:.4rem 0 .2rem;font-size:.78rem;font-weight:600;color:var(--p-text-color)}.ann-panel__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.85rem}.ann-panel__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:500}.ann-panel__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;color:var(--p-text-color);word-break:break-word}.ann-panel__chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.3rem}[_nghost-%COMP%] .chip--broken{background:var(--sm-bg-hover);color:var(--sm-text-muted);text-decoration:line-through;cursor:not-allowed}[_nghost-%COMP%] .ann-panel__chip--author{background:transparent;border:1px solid var(--p-primary-color);color:var(--p-primary-color)}[_nghost-%COMP%] .ann-panel__chip--user{background:var(--p-chip-background);color:var(--p-chip-color)}[_nghost-%COMP%] .ann-panel__chip--author, [_nghost-%COMP%] .ann-panel__chip--user{cursor:pointer;transition:filter .1s ease,box-shadow .1s ease}[_nghost-%COMP%] .ann-panel__chip--author:hover, [_nghost-%COMP%] .ann-panel__chip--user:hover{filter:brightness(1.05)}[_nghost-%COMP%] .ann-panel__chip--author:focus-visible, [_nghost-%COMP%] .ann-panel__chip--user:focus-visible{outline:2px solid var(--p-primary-color);outline-offset:1px}[_nghost-%COMP%] .ann-panel__chip--active{background:var(--p-primary-color);color:var(--p-primary-color-text);border-color:var(--p-primary-color);box-shadow:0 0 0 2px var(--p-primary-color-200)}"],changeDetection:0})};function qI(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function mp(t){return typeof t=="string"&&t.length>0?t:null}function n_(t){if(typeof t!="string"||t.length===0)return null;try{let i=new URL(t);return i.protocol==="http:"||i.protocol==="https:"?t:null}catch{return null}}function YI(t){return t==="stable"||t==="experimental"||t==="deprecated"?t:null}function _p(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"&&i.length>0):[]}function Yl(t){for(let i of Object.values(t))if(i!=null){if(Array.isArray(i)){if(i.length>0)return!0;continue}if(typeof i=="string"){if(i.length>0)return!0;continue}return!0}return!1}var Ql=class t{title=F.required();body=F.required();icon=F("pi pi-clock");testId=F(null);static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-empty-state"]],inputs:{title:[1,"title"],body:[1,"body"],icon:[1,"icon"],testId:[1,"testId"]},decls:6,vars:5,consts:[[1,"empty-state-card"],["aria-hidden","true",1,"empty-state-card__icon"],[1,"empty-state-card__title"],[1,"empty-state-card__body"]],template:function(e,n){if(e&1&&(U(0,"div",0),Mt(1,"span",1),U(2,"p",2),_(3),$(),U(4,"p",3),_(5),$()()),e&2){let o=n.testId();X("data-testid",o),c(),Le(n.icon()),c(2),v(n.title()),c(2),v(n.body())}},styles:["[_nghost-%COMP%]{display:block}.empty-state-card[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:flex-start;gap:.5rem;padding:1rem 1.25rem;border:1px dashed var(--p-content-border-color);border-radius:var(--p-border-radius-md);background:var(--p-content-background);color:var(--p-text-muted-color)}.empty-state-card__icon[_ngcontent-%COMP%]{font-size:1.25rem;color:var(--p-text-muted-color);opacity:.7}.empty-state-card__title[_ngcontent-%COMP%]{margin:0;font-weight:600;color:var(--p-text-color)}.empty-state-card__body[_ngcontent-%COMP%]{margin:0;font-size:.85rem;line-height:1.4}"],changeDetection:0})};var i_={cardHeader:"Linked nodes",refreshLabel:"Refresh links",outgoingHeader:"Outgoing",incomingHeader:"Incoming",loading:"Loading links\u2026",error:"Failed to load links.",emptyOutgoing:"No outgoing links from this node.",emptyIncoming:"No incoming links to this node.",confidence:{high:"high",medium:"medium",low:"low"},sourcesPrefix:"detected by ",sourcesSeparator:", "};var r_=(t,i)=>i.source+"|"+i.target+"|"+i.kind+"|"+((i.trigger==null?null:i.trigger.normalizedTrigger)??"");function QI(t,i){if(t&1){let e=ce();f(0,"div",4)(1,"h3",5),_(2),p(),f(3,"p-button",6),K("onClick",function(){G(e);let o=m(2);return j(o.refresh())}),p()()}if(t&2){let e=m(2);c(2),v(e.texts.cardHeader),c(),E("rounded",!0)("text",!0)("ariaLabel",e.texts.refreshLabel)("pTooltip",e.texts.refreshLabel)("disabled",e.state()==="loading")}}function JI(t,i){if(t&1&&(f(0,"p",2),_(1),p()),t&2){let e=m(2);c(),v(e.texts.loading)}}function e1(t,i){if(t&1&&(f(0,"p",3),_(1),p()),t&2){let e=m(2);c(),v(e.texts.error)}}function t1(t,i){if(t&1&&(f(0,"p",9),_(1),p()),t&2){let e=m(3);c(),v(e.texts.emptyOutgoing)}}function n1(t,i){if(t&1&&(f(0,"span",17),_(1),p()),t&2){let e=m().$implicit,n=m(4);c(),fi(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function i1(t,i){if(t&1){let e=ce();f(0,"li",13),B(1,"p-tag",14),f(2,"p-button",15),K("onClick",function(){let o=G(e).$implicit,r=m(4);return j(r.onOpen(o.target))}),p(),B(3,"p-tag",16),S(4,n1,2,2,"span",17),p()}if(t&2){let e=i.$implicit,n=m(4);X("data-testid","linked-nodes-outgoing-row-"+e.target),c(),E("value",e.kind)("severity",n.kindSeverity(e.kind)),c(),E("link",!0)("label",e.target),X("data-testid","linked-nodes-outgoing-link-"+e.target),c(),E("value",n.confidenceLabel(e.confidence))("severity",n.confidenceSeverity(e.confidence))("rounded",!0),c(),I(e.sources.length?4:-1)}}function o1(t,i){if(t&1&&(f(0,"ul",10),ee(1,i1,5,10,"li",13,r_),p()),t&2){let e=m(3);c(),te(e.outgoing())}}function r1(t,i){if(t&1&&(f(0,"p",12),_(1),p()),t&2){let e=m(3);c(),v(e.texts.emptyIncoming)}}function a1(t,i){if(t&1&&(f(0,"span",17),_(1),p()),t&2){let e=m().$implicit,n=m(4);c(),fi(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function s1(t,i){if(t&1){let e=ce();f(0,"li",13),B(1,"p-tag",14),f(2,"p-button",15),K("onClick",function(){let o=G(e).$implicit,r=m(4);return j(r.onOpen(o.source))}),p(),B(3,"p-tag",16),S(4,a1,2,2,"span",17),p()}if(t&2){let e=i.$implicit,n=m(4);X("data-testid","linked-nodes-incoming-row-"+e.source),c(),E("value",e.kind)("severity",n.kindSeverity(e.kind)),c(),E("link",!0)("label",e.source),X("data-testid","linked-nodes-incoming-link-"+e.source),c(),E("value",n.confidenceLabel(e.confidence))("severity",n.confidenceSeverity(e.confidence))("rounded",!0),c(),I(e.sources.length?4:-1)}}function c1(t,i){if(t&1&&(f(0,"ul",10),ee(1,s1,5,10,"li",13,r_),p()),t&2){let e=m(3);c(),te(e.incoming())}}function d1(t,i){if(t&1&&(f(0,"section",7)(1,"h4",8),_(2),p(),S(3,t1,2,1,"p",9)(4,o1,3,0,"ul",10),p(),f(5,"section",11)(6,"h4",8),_(7),p(),S(8,r1,2,1,"p",12)(9,c1,3,0,"ul",10),p()),t&2){let e=m(2);c(2),v(e.texts.outgoingHeader),c(),I(e.outgoing().length===0?3:4),c(4),v(e.texts.incomingHeader),c(),I(e.incoming().length===0?8:9)}}function l1(t,i){if(t&1&&(f(0,"p-card",0),be(1,QI,4,6,"ng-template",1),S(2,JI,2,1,"p",2)(3,e1,2,1,"p",3)(4,d1,10,4),p()),t&2){let e,n=m();c(2),I((e=n.state())==="loading"?2:e==="error"?3:e==="ready"?4:-1)}}var Jl=class t{dataSource=d(kt);wsEvents=d(Po);destroyRef=d(We);texts=i_;path=F(null);openPath=Ee();state=W("idle");outgoing=W([]);incoming=W([]);fetchToken=0;hasResults=D(()=>this.state()==="ready"&&(this.outgoing().length>0||this.incoming().length>0));constructor(){this.wsEvents.scanCompleted$.pipe(Pn(this.destroyRef)).subscribe(()=>{let i=this.path();i&&this.fetch(i)}),ae(()=>{let i=this.path();if(!i){this.fetchToken++,this.state.set("idle"),this.outgoing.set([]),this.incoming.set([]);return}this.fetch(i)})}refresh(){let i=this.path();i&&this.fetch(i)}onOpen(i){this.openPath.emit(i)}kindSeverity(i){return ch[i]??"secondary"}confidenceSeverity(i){return dh[i]??"info"}confidenceLabel(i){return this.texts.confidence[i]??i}async fetch(i){let e=++this.fetchToken;this.state.set("loading");try{let[n,o]=await Promise.all([this.dataSource.listLinks({from:i}),this.dataSource.listLinks({to:i})]);if(e!==this.fetchToken)return;this.outgoing.set(n.items),this.incoming.set(o.items),this.state.set("ready")}catch{if(e!==this.fetchToken)return;this.outgoing.set([]),this.incoming.set([]),this.state.set("error")}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-linked-nodes-panel"]],inputs:{path:[1,"path"]},outputs:{openPath:"openPath"},decls:1,vars:1,consts:[["styleClass","linked-nodes-panel","data-testid","linked-nodes-panel"],["pTemplate","header"],["data-testid","linked-nodes-loading",1,"linked-nodes-panel__status"],["data-testid","linked-nodes-error",1,"linked-nodes-panel__status","linked-nodes-panel__status--warn"],[1,"linked-nodes-panel__header"],[1,"linked-nodes-panel__title"],["icon","pi pi-refresh","severity","secondary","data-testid","linked-nodes-refresh",3,"onClick","rounded","text","ariaLabel","pTooltip","disabled"],["data-testid","linked-nodes-outgoing",1,"linked-nodes-panel__section"],[1,"linked-nodes-panel__section-title"],["data-testid","linked-nodes-outgoing-empty",1,"linked-nodes-panel__status"],[1,"linked-nodes-panel__rows"],["data-testid","linked-nodes-incoming",1,"linked-nodes-panel__section"],["data-testid","linked-nodes-incoming-empty",1,"linked-nodes-panel__status"],[1,"linked-nodes-panel__row"],[3,"value","severity"],["severity","primary","styleClass","linked-nodes-panel__path",3,"onClick","link","label"],[3,"value","severity","rounded"],[1,"linked-nodes-panel__sources"]],template:function(e,n){e&1&&S(0,l1,5,1,"p-card",0),e&2&&I(n.path()?0:-1)},dependencies:[Xl,ro,Sn,Ro,No,Fn,Tn,In,Re,Ve],styles:["[_nghost-%COMP%]{display:block}.linked-nodes-panel__header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.75rem 1rem 0}.linked-nodes-panel__title[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600}.linked-nodes-panel__status[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--p-text-muted-color);font-style:italic}.linked-nodes-panel__status--warn[_ngcontent-%COMP%]{color:var(--sm-severity-warn);font-style:normal}.linked-nodes-panel__section[_ngcontent-%COMP%] + .linked-nodes-panel__section[_ngcontent-%COMP%]{margin-top:1rem}.linked-nodes-panel__section-title[_ngcontent-%COMP%]{margin:0 0 .5rem;font-size:.8rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color)}.linked-nodes-panel__rows[_ngcontent-%COMP%]{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:.5rem}.linked-nodes-panel__row[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;padding:.4rem .5rem;border-radius:var(--sm-radius-md);background:var(--p-content-background);border:1px solid var(--p-content-border-color)}.linked-nodes-panel__path[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.85rem;padding:0;text-underline-offset:2px}.linked-nodes-panel__sources[_ngcontent-%COMP%]{font-size:.75rem;color:var(--p-text-muted-color);margin-left:auto}"],changeDetection:0})};var a_={providerSpecificHeader:"Provider-specific",fieldCount:t=>`${t} field${t===1?"":"s"}`,fields:{tools:"Tools",model:"Model",skills:"Skills",disallowedTools:"Disallowed tools",initialPrompt:"Initial prompt",permissionMode:"Permission mode",maxTurns:"Max turns",memory:"Memory",background:"Background",effort:"Effort",isolation:"Isolation",mcpServers:"MCP servers",hooks:"Hooks"},initialPromptToggle:"Toggle initial prompt"};var u1=(t,i)=>i.name,f1=(t,i)=>i.event;function p1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){let e=m(4);c(),v(e.texts.fields.model),c(3),v(i)}}function h1(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;E("label",e)}}function m1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd",11),ee(3,h1,1,1,"p-chip",12,Ne),p()),t&2){let e=m(4);c(),v(e.texts.fields.tools),c(2),te(e.tools())}}function _1(t,i){if(t&1){let e=ce();f(0,"p-chip",14),K("click",function(){let o=G(e).$implicit,r=m(5);return j(r.onSkillChipClick(o))}),p()}if(t&2){let e=i.$implicit,n=m(5);E("label",e)("styleClass",n.isSkillKnown(e)?"chip--link":"")}}function g1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd",11),ee(3,_1,1,2,"p-chip",13,Ne),p()),t&2){let e=m(4);c(),v(e.texts.fields.skills),c(2),te(e.skills())}}function y1(t,i){if(t&1&&B(0,"p-chip",15),t&2){let e=i.$implicit;E("label",e)}}function v1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd",11),ee(3,y1,1,1,"p-chip",15,Ne),p()),t&2){let e=m(4);c(),v(e.texts.fields.disallowedTools),c(2),te(e.disallowedTools())}}function C1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){let e=m(4);c(),v(e.texts.fields.permissionMode),c(3),v(i)}}function x1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd"),_(3),p()),t&2){let e=m(4);c(),v(e.texts.fields.maxTurns),c(2),v(e.maxTurns())}}function b1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){let e=m(4);c(),v(e.texts.fields.effort),c(3),v(i)}}function w1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){let e=m(4);c(),v(e.texts.fields.memory),c(3),v(i)}}function S1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4,"true"),p()()),t&2){let e=m(4);c(),v(e.texts.fields.background)}}function I1(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){let e=m(4);c(),v(e.texts.fields.isolation),c(3),v(i)}}function T1(t,i){if(t&1&&(f(0,"blockquote",18),_(1),p()),t&2){let e=m();c(),v(e)}}function P1(t,i){if(t&1&&(f(0,"p",19),_(1),p()),t&2){let e=m();c(),fi("",e.slice(0,80),"",e.length>80?"\u2026":"")}}function E1(t,i){if(t&1){let e=ce();f(0,"div",9)(1,"h5",16)(2,"button",17),K("click",function(){G(e);let o=m(4);return j(o.toggleInitialPrompt())}),B(3,"i",4),_(4),p()(),S(5,T1,2,1,"blockquote",18)(6,P1,2,2,"p",19),p()}if(t&2){let e=m(4);c(2),X("aria-label",e.texts.initialPromptToggle),c(),re("pi-chevron-right",!e.initialPromptExpanded())("pi-chevron-down",e.initialPromptExpanded()),c(),ze(" ",e.texts.fields.initialPrompt," "),c(),I(e.initialPromptExpanded()?5:6)}}function D1(t,i){if(t&1&&(f(0,"code",23),_(1),p()),t&2){let e=m().$implicit;c(),v(e.command)}}function M1(t,i){if(t&1&&(f(0,"li",21)(1,"code",22),_(2),p(),S(3,D1,2,1,"code",23),p()),t&2){let e=i.$implicit;c(2),v(e.name),c(),I(e.command!==null?3:-1)}}function k1(t,i){if(t&1&&(f(0,"div",10)(1,"h5",16),_(2),p(),f(3,"ul",20),ee(4,M1,4,2,"li",21,u1),p()()),t&2){let e=m(4);c(2),v(e.texts.fields.mcpServers),c(2),te(e.mcpServers())}}function N1(t,i){if(t&1&&(f(0,"code"),_(1),p(),_(2)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;c(),v(e),c(),ze("",n===o-1?"":", "," ")}}function R1(t,i){if(t&1&&(f(0,"span",24),ee(1,N1,3,2,null,null,Ne),p()),t&2){let e=m().$implicit;c(),te(e.keys)}}function O1(t,i){if(t&1&&(f(0,"li",21)(1,"code",22),_(2),p(),S(3,R1,3,0,"span",24),p()),t&2){let e=i.$implicit;c(2),v(e.event),c(),I(e.keys.length?3:-1)}}function F1(t,i){if(t&1&&(f(0,"div",10)(1,"h5",16),_(2),p(),f(3,"ul",20),ee(4,O1,4,2,"li",21,f1),p()()),t&2){let e=m(4);c(2),v(e.texts.fields.hooks),c(2),te(e.hooks())}}function A1(t,i){if(t&1&&(f(0,"dl",8),S(1,p1,5,2),S(2,m1,5,1),S(3,g1,5,1),S(4,v1,5,1),S(5,C1,5,2),S(6,x1,4,2),S(7,b1,5,2),S(8,w1,5,2),S(9,S1,5,1),S(10,I1,5,2),p(),S(11,E1,7,7,"div",9),S(12,k1,6,1,"div",10),S(13,F1,6,1,"div",10)),t&2){let e,n,o,r,a,s,l=m(3);c(),I((e=l.model())?1:-1,e),c(),I(l.tools().length?2:-1),c(),I(l.skills().length?3:-1),c(),I(l.disallowedTools().length?4:-1),c(),I((n=l.permissionMode())?5:-1,n),c(),I(l.maxTurns()!==null?6:-1),c(),I((o=l.effort())?7:-1,o),c(),I((r=l.memory())?8:-1,r),c(),I(l.background()?9:-1),c(),I((a=l.isolation())?10:-1,a),c(),I((s=l.initialPrompt())?11:-1,s),c(),I(l.mcpServers().length?12:-1),c(),I(l.hooks().length?13:-1)}}function L1(t,i){if(t&1&&(f(0,"dt"),_(1,"when_to_use"),p(),f(2,"dd"),_(3),p()),t&2){m();let e=J(0);c(3),v(e.when_to_use)}}function B1(t,i){if(t&1&&(f(0,"dt"),_(1,"argument-hint"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.argumentHint)}}function z1(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;E("label",e)}}function V1(t,i){if(t&1&&(f(0,"dt"),_(1,"arguments"),p(),f(2,"dd",11),ee(3,z1,1,1,"p-chip",12,Ne),p()),t&2){m();let e=J(0);c(3),te(e.arguments)}}function H1(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;E("label",e)}}function G1(t,i){if(t&1&&(f(0,"dt"),_(1,"allowed-tools"),p(),f(2,"dd",11),ee(3,H1,1,1,"p-chip",12,Ne),p()),t&2){m();let e=J(0);c(3),te(e.allowedTools)}}function j1(t,i){if(t&1&&(f(0,"dt"),_(1,"model"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.model)}}function U1(t,i){if(t&1&&(f(0,"dt"),_(1,"effort"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.effort)}}function W1(t,i){if(t&1&&(f(0,"dt"),_(1,"context"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.context)}}function $1(t,i){if(t&1&&(f(0,"dt"),_(1,"agent"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.agent)}}function K1(t,i){if(t&1&&(f(0,"dt"),_(1,"shell"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.shell)}}function X1(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;E("label",e)}}function q1(t,i){if(t&1&&(f(0,"dt"),_(1,"paths"),p(),f(2,"dd",11),ee(3,X1,1,1,"p-chip",12,Ne),p()),t&2){m();let e=J(0);c(3),te(e.paths)}}function Y1(t,i){t&1&&(f(0,"dt"),_(1,"disable-model-invocation"),p(),f(2,"dd")(3,"code"),_(4,"true"),p()())}function Z1(t,i){if(t&1&&(f(0,"dt"),_(1,"user-invocable"),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0);c(4),v(e.userInvocable)}}function Q1(t,i){if(t&1&&(rt(0),f(1,"dl",7),S(2,L1,4,1),S(3,B1,5,1),S(4,V1,5,0),S(5,G1,5,0),S(6,j1,5,1),S(7,U1,5,1),S(8,W1,5,1),S(9,$1,5,1),S(10,K1,5,1),S(11,q1,5,0),S(12,Y1,5,0),S(13,Z1,5,1),p()),t&2){let e=Be(m(3).skillBase());c(2),I(e.when_to_use!==null?2:-1),c(),I(e.argumentHint!==null?3:-1),c(),I(e.arguments.length?4:-1),c(),I(e.allowedTools.length?5:-1),c(),I(e.model!==null?6:-1),c(),I(e.effort!==null?7:-1),c(),I(e.context!==null?8:-1),c(),I(e.agent!==null?9:-1),c(),I(e.shell!==null?10:-1),c(),I(e.paths.length?11:-1),c(),I(e.disableModelInvocation?12:-1),c(),I(e.userInvocable!==null?13:-1)}}function J1(t,i){if(t&1&&(f(0,"div",6),S(1,A1,14,13)(2,Q1,14,13,"dl",7),p()),t&2){let e=m(2);c(),I(e.isAgent()?1:e.isSkillOrCommand()?2:-1)}}function eT(t,i){if(t&1){let e=ce();f(0,"div",0)(1,"section",1)(2,"h4",2)(3,"button",3),K("click",function(){G(e);let o=m();return j(o.toggleSection())}),B(4,"i",4),_(5),f(6,"span",5),_(7),p()()(),S(8,J1,3,1,"div",6),p()()}if(t&2){let e=m();c(3),X("aria-expanded",e.sectionExpanded()),c(),re("pi-chevron-right",!e.sectionExpanded())("pi-chevron-down",e.sectionExpanded()),c(),ze(" ",e.texts.providerSpecificHeader," "),c(2),ze("(",e.texts.fieldCount(e.populatedFieldCount()),")"),c(),I(e.sectionExpanded()?8:-1)}}var tu=class t{frontmatter=F.required();kind=F.required();provider=F(void 0);knownPaths=F(null);onSkillClick=F(null);texts=a_;hasVendorSurface=D(()=>{let i=this.kind();return i==="agent"||i==="skill"||i==="command"});isAgent=D(()=>this.kind()==="agent");isSkillOrCommand=D(()=>{let i=this.kind();return i==="skill"||i==="command"});tools=D(()=>eu(this.fm().tools));model=D(()=>st(this.fm().model));skills=D(()=>eu(this.fm().skills));disallowedTools=D(()=>eu(this.fm().disallowedTools));initialPrompt=D(()=>st(this.fm().initialPrompt));initialPromptExpanded=W(!1);permissionMode=D(()=>st(this.fm().permissionMode));maxTurns=D(()=>tT(this.fm().maxTurns));memory=D(()=>st(this.fm().memory));background=D(()=>this.fm().background===!0);effort=D(()=>st(this.fm().effort));isolation=D(()=>st(this.fm().isolation));mcpServers=D(()=>{let i=this.fm().mcpServers;return Array.isArray(i)?i.filter(e=>typeof e=="object"&&e!==null).map((e,n)=>({name:typeof e.name=="string"&&e.name.length>0?e.name:`mcpServer[${n}]`,command:typeof e.command=="string"?e.command:null})):[]});hooks=D(()=>{let i=this.fm().hooks;if(typeof i!="object"||i===null)return[];let e=[];for(let[n,o]of Object.entries(i)){let r=typeof o=="object"&&o!==null?Object.keys(o):[];e.push({event:n,keys:r})}return e});skillBase=D(()=>{let i=this.fm();return{when_to_use:st(i.when_to_use),argumentHint:st(i["argument-hint"]),arguments:gp(i.arguments),disableModelInvocation:i["disable-model-invocation"]===!0,userInvocable:typeof i["user-invocable"]=="boolean"?i["user-invocable"]:null,allowedTools:gp(i["allowed-tools"]),model:st(i.model),effort:st(i.effort),context:st(i.context),agent:st(i.agent),paths:gp(i.paths),shell:st(i.shell)}});populatedFieldCount=D(()=>{if(this.isAgent()){let i=0;return this.model()!==null&&i++,this.tools().length&&i++,this.skills().length&&i++,this.disallowedTools().length&&i++,this.permissionMode()!==null&&i++,this.maxTurns()!==null&&i++,this.effort()!==null&&i++,this.memory()!==null&&i++,this.background()&&i++,this.isolation()!==null&&i++,this.initialPrompt()!==null&&i++,this.mcpServers().length&&i++,this.hooks().length&&i++,i}if(this.isSkillOrCommand()){let i=this.skillBase(),e=0;return i.when_to_use!==null&&e++,i.argumentHint!==null&&e++,i.arguments.length&&e++,i.allowedTools.length&&e++,i.model!==null&&e++,i.effort!==null&&e++,i.context!==null&&e++,i.agent!==null&&e++,i.shell!==null&&e++,i.paths.length&&e++,i.disableModelInvocation&&e++,i.userInvocable!==null&&e++,e}return 0});hasAnyContent=D(()=>this.hasVendorSurface()&&this.populatedFieldCount()>0);sectionExpanded=W(!1);toggleSection(){this.sectionExpanded.update(i=>!i)}toggleInitialPrompt(){this.initialPromptExpanded.update(i=>!i)}onSkillChipClick(i){let e=this.onSkillClick();e&&e(i)}isSkillKnown(i){let e=this.knownPaths();return e?e.has(i):!1}fm(){return this.frontmatter()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-vendor-frontmatter"]],inputs:{frontmatter:[1,"frontmatter"],kind:[1,"kind"],provider:[1,"provider"],knownPaths:[1,"knownPaths"],onSkillClick:[1,"onSkillClick"]},decls:1,vars:1,consts:[["data-testid","vendor-frontmatter",1,"vfm"],["data-testid","vendor-frontmatter-section",1,"vfm__section"],[1,"vfm__section-toggle"],["type","button","data-testid","vendor-frontmatter-section-toggle",1,"vfm__inline-toggle",3,"click"],["aria-hidden","true",1,"pi"],[1,"vfm__count"],["data-testid","vendor-frontmatter-section-body",1,"vfm__body"],["data-testid","vendor-frontmatter-skill-base",1,"vfm__kv"],[1,"vfm__kv"],["data-testid","vendor-frontmatter-initial-prompt-row",1,"vfm__row"],[1,"vfm__row"],[1,"vfm__chips"],[3,"label"],[3,"label","styleClass"],[3,"click","label","styleClass"],["styleClass","chip--danger",3,"label"],[1,"vfm__label"],["type","button","data-testid","vendor-frontmatter-initial-prompt-toggle",1,"vfm__inline-toggle",3,"click"],["data-testid","vendor-frontmatter-initial-prompt",1,"vfm__quote"],[1,"vfm__quote-collapsed"],[1,"vfm__list"],[1,"vfm__list-row"],[1,"vfm__list-key"],[1,"vfm__list-cmd"],[1,"vfm__list-keys"]],template:function(e,n){e&1&&S(0,eT,9,8,"div",0),e&2&&I(n.hasAnyContent()?0:-1)},dependencies:[Fn,ko,Re],styles:["[_nghost-%COMP%]{display:block}.vfm[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.6rem}.vfm__section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.4rem}.vfm__body[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.6rem}.vfm__row[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.25rem}.vfm__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.25rem;margin:0;font-size:.85rem}.vfm__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:500}.vfm__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}.vfm__chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.3rem}.vfm__label[_ngcontent-%COMP%]{margin:.25rem 0;font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:var(--sm-text-muted);font-weight:600}.vfm__section-toggle[_ngcontent-%COMP%]{margin:0}.vfm__inline-toggle[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.35rem;background:transparent;border:none;padding:0;font:inherit;font-size:.85rem;font-weight:600;color:var(--p-text-color);cursor:pointer}.vfm__inline-toggle[_ngcontent-%COMP%]:hover{color:var(--p-primary-color)}.vfm__count[_ngcontent-%COMP%]{font-weight:400;color:var(--sm-text-muted)}.vfm__quote[_ngcontent-%COMP%]{margin:.35rem 0 0;padding:.5rem .75rem;border-left:3px solid var(--sm-border);background:var(--sm-bg-hover);font-style:italic;font-size:.85rem;white-space:pre-wrap;border-radius:0 4px 4px 0}.vfm__quote-collapsed[_ngcontent-%COMP%]{margin:.25rem 0 0;font-size:.8rem;color:var(--sm-text-muted);font-style:italic}.vfm__list[_ngcontent-%COMP%]{margin:.25rem 0 0;padding:0;list-style:none;display:flex;flex-direction:column;gap:.2rem}.vfm__list-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:baseline;gap:.4rem;font-size:.8rem}.vfm__list-key[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-weight:600;background:var(--sm-bg-hover);padding:.05rem .35rem;border-radius:var(--sm-radius-sm)}.vfm__list-cmd[_ngcontent-%COMP%], .vfm__list-keys[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.75rem;color:var(--sm-text-muted)}[_nghost-%COMP%] .chip--danger{background:var(--sm-severity-error-bg);color:var(--sm-severity-error)}"],changeDetection:0})};function st(t){return typeof t=="string"&&t.length>0?t:null}function tT(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function eu(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"&&i.length>0):[]}function gp(t){return typeof t=="string"?t.length>0?[t]:[]:Array.isArray(t)?eu(t):[]}var s_={header:"Plugin contributions",count:t=>`${t} namespace${t===1?"":"s"}`,unregisteredBadge:"unregistered",rootContribBadge:t=>`from plugin: ${t}`,empty:"No plugin contributions on this sidecar."};var l_=(t,i)=>i.key,nT=(t,i)=>i.pluginId;function iT(t,i){if(t&1&&(f(0,"p",0),_(1),p()),t&2){let e=m();c(),v(e.texts.empty)}}function oT(t,i){if(t&1&&(f(0,"span",5),_(1),p()),t&2){let e=m().$implicit,n=m(3);c(),v(n.texts.rootContribBadge(e.pluginId))}}function rT(t,i){if(t&1&&(f(0,"div",3)(1,"code",4),_(2),p(),S(3,oT,2,1,"span",5),f(4,"pre",6),_(5),p()()),t&2){let e=i.$implicit;c(2),v(e.key),c(),I(e.pluginId!==null?3:-1),c(2),v(e.value)}}function aT(t,i){if(t&1&&(f(0,"div",1),ee(1,rT,6,3,"div",3,l_),p()),t&2){let e=m(2);c(),te(e.rootContributions())}}function sT(t,i){if(t&1&&(f(0,"span",10),_(1),p()),t&2){let e=m(4);c(),v(e.texts.unregisteredBadge)}}function cT(t,i){if(t&1&&(f(0,"dt",12),_(1),p(),f(2,"dd")(3,"pre"),_(4),p()()),t&2){let e=i.$implicit;E("pTooltip",e.description??""),c(),v(e.key),c(3),v(e.value)}}function dT(t,i){if(t&1&&(f(0,"section",7)(1,"h5",8)(2,"span",9),_(3),p(),S(4,sT,2,1,"span",10),p(),f(5,"dl",11),ee(6,cT,5,3,null,null,l_),p()()),t&2){let e=i.$implicit;X("data-testid","plugin-contributions-ns-"+e.pluginId),c(3),v(e.pluginId),c(),I(e.registered?-1:4),c(2),te(e.rows)}}function lT(t,i){if(t&1&&(f(0,"div",2),ee(1,dT,8,3,"section",7,nT),p()),t&2){let e=m(2);c(),te(e.namespaces())}}function uT(t,i){if(t&1&&(S(0,aT,3,0,"div",1),S(1,lT,3,0,"div",2)),t&2){let e=m();I(e.rootContributions().length?0:-1),c(),I(e.namespaces().length?1:-1)}}var c_=new Set(["identity","annotations","settings","audit"]),nu=class t{dataSource=d(kt);sidecarRoot=F(void 0);texts=s_;catalog=W(null);constructor(){this.fetchCatalog()}namespaces=D(()=>{let i=this.sidecarRoot();if(!i)return[];let e=this.catalog(),n=new Map;if(e)for(let r of e){if(r.location!=="namespaced")continue;let a=n.get(r.pluginId);a?a.push(r):n.set(r.pluginId,[r])}let o=[];for(let[r,a]of Object.entries(i)){if(c_.has(r)||this.isRegisteredRootKey(r))continue;let l=typeof a=="object"&&a!==null&&!Array.isArray(a)?a:{value:a},u=n.has(r),h=n.get(r)??[],g=Object.entries(l).map(([w,b])=>({key:w,value:d_(b),description:u?fT(h,w):null}));o.push({pluginId:r,registered:u,rows:g})}return o});rootContributions=D(()=>{let i=this.sidecarRoot();if(!i)return[];let e=this.catalog();if(!e)return[];let n=new Map;for(let r of e)r.location==="root"&&n.set(r.key,r);let o=[];for(let[r,a]of Object.entries(i)){if(c_.has(r))continue;let s=n.get(r);s&&o.push({key:r,pluginId:s.pluginId,value:d_(a)})}return o});count=D(()=>this.namespaces().length+this.rootContributions().length);isEmpty=D(()=>this.count()===0);isRegisteredRootKey(i){let e=this.catalog();return e?e.some(n=>n.location==="root"&&n.key===i):!1}async fetchCatalog(){try{let i=await this.dataSource.getRegisteredAnnotations();this.catalog.set(i)}catch{this.catalog.set([])}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-plugin-contributions"]],inputs:{sidecarRoot:[1,"sidecarRoot"]},decls:2,vars:1,consts:[["data-testid","plugin-contributions-empty",1,"pcp__empty"],["data-testid","plugin-contributions-roots",1,"pcp__roots"],[1,"pcp__namespaces"],[1,"pcp__root-row"],[1,"pcp__root-key"],[1,"pcp__root-badge"],[1,"pcp__root-value"],[1,"pcp__ns"],[1,"pcp__ns-header"],[1,"pcp__ns-name"],["data-testid","plugin-contributions-unregistered-badge",1,"pcp__ns-badge"],[1,"pcp__kv"],[3,"pTooltip"]],template:function(e,n){e&1&&S(0,iT,2,1,"p",0)(1,uT,2,2),e&2&&I(n.isEmpty()?0:1)},dependencies:[Re,Ve],styles:["[_nghost-%COMP%]{display:block}.pcp__empty[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--sm-text-muted);font-style:italic}.pcp__roots[_ngcontent-%COMP%], .pcp__namespaces[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.6rem}.pcp__root-row[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;font-size:.85rem}.pcp__root-key[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);background:var(--sm-bg-hover);padding:.1rem .4rem;border-radius:var(--sm-radius-sm);font-weight:600}.pcp__root-badge[_ngcontent-%COMP%]{font-size:.7rem;color:var(--sm-text-muted);font-style:italic;background:var(--sm-bg-hover);padding:.05rem .35rem;border-radius:var(--sm-radius-sm)}.pcp__root-value[_ngcontent-%COMP%]{flex:1 1 100%;margin:.2rem 0 0;padding:.45rem .6rem;background:var(--sm-bg-hover);border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.8rem;white-space:pre-wrap;word-break:break-word}.pcp__ns[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:.35rem}.pcp__ns[_ngcontent-%COMP%] + .pcp__ns[_ngcontent-%COMP%]{border-top:1px solid var(--sm-border);padding-top:.5rem}.pcp__ns-header[_ngcontent-%COMP%]{margin:0;display:inline-flex;align-items:center;gap:.5rem;font-size:.85rem;font-weight:600}.pcp__ns-name[_ngcontent-%COMP%]{font-family:var(--sm-font-mono)}.pcp__ns-badge[_ngcontent-%COMP%]{font-size:.65rem;font-weight:500;text-transform:uppercase;letter-spacing:.04em;color:var(--sm-text-muted);background:var(--sm-bg-hover);padding:.05rem .4rem;border-radius:var(--sm-radius-sm)}.pcp__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.85rem}.pcp__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:500;font-family:var(--sm-font-mono);cursor:help}.pcp__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}.pcp__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{margin:0;font-family:var(--sm-font-mono);font-size:.8rem;white-space:pre-wrap;word-break:break-word}"],changeDetection:0})};function d_(t){if(t===null)return"null";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t,null,2)}catch{return String(t)}}function fT(t,i){for(let e of t)if(e.key===i){let n=e.schema.description;return typeof n=="string"&&n.length>0?n:null}return null}var iu=class t{node=F(null);static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-inspector-slots-panel"]],inputs:{node:[1,"node"]},decls:6,vars:6,consts:[["slot","inspector.body.panel.breakdown",3,"node"],["slot","inspector.body.panel.records",3,"node"],["slot","inspector.body.panel.tree",3,"node"],["slot","inspector.body.panel.key-values",3,"node"],["slot","inspector.body.panel.link-list",3,"node"],["slot","inspector.body.panel.markdown",3,"node"]],template:function(e,n){e&1&&B(0,"sm-view-contributions-host",0)(1,"sm-view-contributions-host",1)(2,"sm-view-contributions-host",2)(3,"sm-view-contributions-host",3)(4,"sm-view-contributions-host",4)(5,"sm-view-contributions-host",5),e&2&&(E("node",n.node()),c(),E("node",n.node()),c(),E("node",n.node()),c(),E("node",n.node()),c(),E("node",n.node()),c(),E("node",n.node()))},dependencies:[Rt],encapsulation:2,changeDetection:0})};var u_={header:"Debug",toggleAriaLabel:"Toggle debug panel",fields:{forPath:"for.path",bodyHashStored:"for.bodyHash (stored)",bodyHashLive:"node.bodyHash (live)",frontmatterHashStored:"for.frontmatterHash (stored)",frontmatterHashLive:"node.frontmatterHash (live)",resolvedProvider:"for.resolvedAs.provider",resolvedKind:"for.resolvedAs.kind",sidecarStatus:"sidecar.status",sidecarPresent:"sidecar.present"},diffMarker:"!=",absentMarker:"(absent)",notSetMarker:"(not set)"};function pT(t,i){t&1&&(U(0,"code"),_(1),$()),t&2&&(c(),v(i))}function hT(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.absentMarker)}}function mT(t,i){if(t&1&&(U(0,"code"),_(1),$()),t&2){let e=m();re("dbg__diff",e.bodyHashDrift()),c(),v(i)}}function _T(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.absentMarker)}}function gT(t,i){if(t&1&&(U(0,"code"),_(1),$()),t&2){let e=m();re("dbg__diff",e.bodyHashDrift()),c(),v(i)}}function yT(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.absentMarker)}}function vT(t,i){if(t&1&&(U(0,"code"),_(1),$()),t&2){let e=m();re("dbg__diff",e.frontmatterHashDrift()),c(),v(i)}}function CT(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.absentMarker)}}function xT(t,i){if(t&1&&(U(0,"code"),_(1),$()),t&2){let e=m();re("dbg__diff",e.frontmatterHashDrift()),c(),v(i)}}function bT(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.absentMarker)}}function wT(t,i){t&1&&(U(0,"code"),_(1),$()),t&2&&(c(),v(i))}function ST(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.notSetMarker)}}function IT(t,i){t&1&&(U(0,"code"),_(1),$()),t&2&&(c(),v(i))}function TT(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.notSetMarker)}}function PT(t,i){t&1&&(U(0,"code"),_(1),$()),t&2&&(c(),v(i))}function ET(t,i){if(t&1&&(U(0,"span",2),_(1),$()),t&2){let e=m();c(),v(e.texts.absentMarker)}}var ou=class t{node=F.required();sidecarRoot=F(null);overlay=F(void 0);texts=u_;identityBlock=D(()=>{let i=this.sidecarRoot(),e={path:null,bodyHash:null,frontmatterHash:null,resolvedProvider:null,resolvedKind:null};if(!i)return e;let n=i.identity;if(typeof n!="object"||n===null)return e;let o=n,r=typeof o.resolvedAs=="object"&&o.resolvedAs!==null?o.resolvedAs:null;return{path:typeof o.path=="string"?o.path:null,bodyHash:typeof o.bodyHash=="string"?o.bodyHash:null,frontmatterHash:typeof o.frontmatterHash=="string"?o.frontmatterHash:null,resolvedProvider:r&&typeof r.provider=="string"?r.provider:null,resolvedKind:r&&typeof r.kind=="string"?r.kind:null}});bodyHashLive=D(()=>this.node().bodyHash??null);frontmatterHashLive=D(()=>this.node().frontmatterHash??null);bodyHashDrift=D(()=>{let i=this.identityBlock().bodyHash,e=this.bodyHashLive();return i!==null&&e!==null&&i!==e});frontmatterHashDrift=D(()=>{let i=this.identityBlock().frontmatterHash,e=this.frontmatterHashLive();return i!==null&&e!==null&&i!==e});sidecarStatusLiteral=D(()=>{let i=this.overlay();if(!i)return null;let e=i.status??null;return e===null?null:String(e)});sidecarPresent=D(()=>this.overlay()?.present===!0);static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-inspector-debug-panel"]],inputs:{node:[1,"node"],sidecarRoot:[1,"sidecarRoot"],overlay:[1,"overlay"]},decls:46,vars:18,consts:[["data-testid","inspector-debug-panel",1,"dbg__kv"],["data-testid","dbg-for-path"],[1,"dbg__absent"],["data-testid","dbg-body-hash-stored"],[3,"dbg__diff"],["data-testid","dbg-body-hash-live"],["data-testid","dbg-fm-hash-stored"],["data-testid","dbg-fm-hash-live"],["data-testid","dbg-resolved-provider"],["data-testid","dbg-resolved-kind"],["data-testid","dbg-sidecar-status"],["data-testid","dbg-sidecar-present"]],template:function(e,n){if(e&1&&(U(0,"dl",0)(1,"dt"),_(2),$(),U(3,"dd",1),S(4,pT,2,1,"code")(5,hT,2,1,"span",2),$(),U(6,"dt"),_(7),$(),U(8,"dd",3),S(9,mT,2,3,"code",4)(10,_T,2,1,"span",2),$(),U(11,"dt"),_(12),$(),U(13,"dd",5),S(14,gT,2,3,"code",4)(15,yT,2,1,"span",2),$(),U(16,"dt"),_(17),$(),U(18,"dd",6),S(19,vT,2,3,"code",4)(20,CT,2,1,"span",2),$(),U(21,"dt"),_(22),$(),U(23,"dd",7),S(24,xT,2,3,"code",4)(25,bT,2,1,"span",2),$(),U(26,"dt"),_(27),$(),U(28,"dd",8),S(29,wT,2,1,"code")(30,ST,2,1,"span",2),$(),U(31,"dt"),_(32),$(),U(33,"dd",9),S(34,IT,2,1,"code")(35,TT,2,1,"span",2),$(),U(36,"dt"),_(37),$(),U(38,"dd",10),S(39,PT,2,1,"code")(40,ET,2,1,"span",2),$(),U(41,"dt"),_(42),$(),U(43,"dd",11)(44,"code"),_(45),$()()()),e&2){let o,r,a,s,l,u,h,g;c(2),v(n.texts.fields.forPath),c(2),I((o=n.identityBlock().path)?4:5,o),c(3),v(n.texts.fields.bodyHashStored),c(2),I((r=n.identityBlock().bodyHash)?9:10,r),c(3),v(n.texts.fields.bodyHashLive),c(2),I((a=n.bodyHashLive())?14:15,a),c(3),v(n.texts.fields.frontmatterHashStored),c(2),I((s=n.identityBlock().frontmatterHash)?19:20,s),c(3),v(n.texts.fields.frontmatterHashLive),c(2),I((l=n.frontmatterHashLive())?24:25,l),c(3),v(n.texts.fields.resolvedProvider),c(2),I((u=n.identityBlock().resolvedProvider)?29:30,u),c(3),v(n.texts.fields.resolvedKind),c(2),I((h=n.identityBlock().resolvedKind)?34:35,h),c(3),v(n.texts.fields.sidecarStatus),c(2),I((g=n.sidecarStatusLiteral())?39:40,g),c(3),v(n.texts.fields.sidecarPresent),c(3),v(n.sidecarPresent())}},styles:["[_nghost-%COMP%]{display:block}.dbg__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.8rem}.dbg__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-family:var(--sm-font-mono);font-weight:500}.dbg__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0}.dbg__kv[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem;background:var(--sm-bg-hover);padding:.05rem .3rem;border-radius:var(--sm-radius-sm);word-break:break-all}.dbg__diff[_ngcontent-%COMP%]{background:var(--sm-severity-error-bg);color:var(--sm-severity-error)}.dbg__absent[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem;color:var(--sm-text-muted);font-style:italic}"],changeDetection:0})};function DT(t,i){if(t&1&&(U(0,"span",3),_(1),U(2,"code"),_(3),$()()),t&2){m(2);let e=J(0),n=m();c(),ze(" ",n.texts.fields.lastBumpedBy," "),c(2),v(e.lastBumpedBy)}}function MT(t,i){if(t&1&&(U(0,"dt"),_(1),$(),U(2,"dd")(3,"span",2),_(4),$(),S(5,DT,4,2,"span",3),$()),t&2){m();let e=J(0),n=m();c(),v(n.texts.fields.lastBumpedAt),c(2),Eu("title",e.lastBumpedAt),c(),v(n.lastBumpedRel()),c(),I(e.lastBumpedBy!==null?5:-1)}}function kT(t,i){if(t&1&&(U(0,"span",3),_(1),U(2,"code"),_(3),$()()),t&2){m(2);let e=J(0),n=m();c(),ze(" ",n.texts.fields.createdBy," "),c(2),v(e.createdBy)}}function NT(t,i){if(t&1&&(U(0,"dt"),_(1),$(),U(2,"dd")(3,"span",2),_(4),$(),S(5,kT,4,2,"span",3),$()),t&2){m();let e=J(0),n=m();c(),v(n.texts.fields.createdAt),c(2),Eu("title",e.createdAt),c(),v(n.createdRel()),c(),I(e.createdBy!==null?5:-1)}}function RT(t,i){if(t&1&&(rt(0),U(1,"dl",0),S(2,MT,6,4),S(3,NT,6,4),$()),t&2){let e=Be(m().audit());c(2),I(e.lastBumpedAt!==null?2:-1),c(),I(e.createdAt!==null?3:-1)}}function OT(t,i){if(t&1&&(U(0,"p",1),_(1),$()),t&2){let e=m();c(),v(e.texts.headerEmpty)}}var au=class t{sidecarRoot=F(null);texts=Xt.audit;audit=D(()=>{let i=this.sidecarRoot(),e={lastBumpedAt:null,lastBumpedBy:null,createdAt:null,createdBy:null};if(!i)return e;let n=i.audit;if(typeof n!="object"||n===null)return e;let o=n;return{lastBumpedAt:ru(o.lastBumpedAt),lastBumpedBy:ru(o.lastBumpedBy),createdAt:ru(o.createdAt),createdBy:ru(o.createdBy)}});hasContent=D(()=>{let i=this.audit();return i.lastBumpedAt!==null||i.lastBumpedBy!==null||i.createdAt!==null||i.createdBy!==null});lastBumpedRel=D(()=>{let i=this.audit().lastBumpedAt;return i===null?null:hi(i)});createdRel=D(()=>{let i=this.audit().createdAt;return i===null?null:hi(i)});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-inspector-audit-panel"]],inputs:{sidecarRoot:[1,"sidecarRoot"]},decls:2,vars:1,consts:[["data-testid","inspector-audit-panel",1,"audit__kv"],["data-testid","inspector-audit-panel-empty",1,"audit__empty"],[3,"title"],[1,"audit__by"]],template:function(e,n){e&1&&S(0,RT,4,3,"dl",0)(1,OT,2,1,"p",1),e&2&&I(n.hasContent()?0:1)},styles:["[_nghost-%COMP%]{display:block}.audit__kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;column-gap:.6rem;row-gap:.2rem;margin:0;font-size:.85rem}.audit__kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:500}.audit__kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0}.audit__by[_ngcontent-%COMP%]{color:var(--sm-text-muted)}.audit__by[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.78rem}.audit__empty[_ngcontent-%COMP%]{margin:0;font-style:italic;color:var(--sm-text-muted);font-size:.85rem}"],changeDetection:0})};function ru(t){return typeof t=="string"&&t.length>0?t:null}var FT=["closeBtn"];function AT(t,i){if(t&1&&(f(0,"span",11),B(1,"i",19),p()),t&2){let e=m();E("pTooltip",e.headerStaleTooltip())}}function LT(t,i){if(t&1&&(f(0,"span",12),Qe(),f(1,"svg",20),B(2,"path",21)(3,"path",22)(4,"path",23),p()()),t&2){let e=m();E("pTooltip",e.cardTexts.stability.experimental)}}function BT(t,i){if(t&1&&(f(0,"span",12),B(1,"i",24),p()),t&2){let e=m();E("pTooltip",e.cardTexts.stability.deprecated)}}function zT(t,i){t&1&&(f(0,"span",13),_(1),p()),t&2&&(c(),v(i))}function VT(t,i){if(t&1){let e=ce();f(0,"button",25,0),K("click",function(o){G(e);let r=m();return j(r.onCloseClick(o))}),B(2,"i",26),p()}if(t&2){let e=m();E("pTooltip",e.texts.close.tooltip),X("aria-label",e.texts.close.label)}}function HT(t,i){t&1&&(f(0,"div",17)(1,"span",27),_(2,"Actions"),p(),f(3,"button",28),B(4,"i",29),f(5,"span"),_(6,"Generate summary"),p()(),f(7,"button",30),B(8,"i",31),f(9,"span"),_(10,"Run audit"),p()(),f(11,"button",32),B(12,"i",33),f(13,"span"),_(14,"Validate"),p()()())}function GT(t,i){if(t&1&&(f(0,"span",34),_(1),p()),t&2){let e=i.$implicit;c(),v(e)}}function jT(t,i){if(t&1&&(f(0,"div",18),ee(1,GT,2,1,"span",34,Ne),p()),t&2){let e=m();c(),te(e.headerTools())}}var UT=new Set(["red","orange","yellow","green","cyan","blue","purple","pink"]),su=class t{node=F.required();mode=F("standalone");showActionMocks=F(!1);close=Ee();favoriteToggle=Ee();texts=Xt;cardTexts=gn;closeBtn=Se("closeBtn");constructor(){ae(()=>{this.mode()==="embedded"&&(this.node(),queueMicrotask(()=>this.closeBtn()?.nativeElement.focus({preventScroll:!0})))})}headerVersion=D(()=>Do(this.node()));headerStability=D(()=>Mo(this.node()));headerTitleColor=D(()=>{let i=this.node(),n=i.frontmatter.color;return typeof n=="string"&&UT.has(n)?n:`var(--sm-kind-${i.kind})`});headerTools=D(()=>th(this.node()));headerIsStale=D(()=>nh(this.node()));headerStaleTooltip=D(()=>ih(this.node(),gn.sidecar));onCloseClick(i){i.stopPropagation(),this.close.emit()}onFavoriteClick(i){i.stopPropagation(),this.favoriteToggle.emit(this.node().path)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-inspector-header"]],viewQuery:function(e,n){e&1&&ut(n.closeBtn,FT,5),e&2&&it()},inputs:{node:[1,"node"],mode:[1,"mode"],showActionMocks:[1,"showActionMocks"]},outputs:{close:"close",favoriteToggle:"favoriteToggle"},decls:21,vars:32,consts:[["closeBtn",""],["data-testid","inspector-title",1,"inspector__header"],["aria-hidden","true",1,"inspector__icon-box"],[3,"kind","provider","size"],[1,"inspector__content"],[1,"inspector__name-row"],["data-testid","inspector-title-text",1,"inspector__name"],["data-testid","inspector-path",1,"inspector__path-code"],[1,"inspector__actions-cluster"],["type","button","data-testid","inspector-favorite",1,"inspector__favorite",3,"click","pTooltip"],["aria-hidden","true",1,"pi"],["data-testid","inspector-stale-badge",1,"inspector__stale-icon",3,"pTooltip"],["data-testid","inspector-stability-tag",1,"inspector__stability-icon",3,"pTooltip"],["data-testid","inspector-version",1,"inspector__name-version"],["slot","inspector.header.badge.counter",3,"node"],["slot","inspector.header.badge.tag",3,"node"],["type","button","data-testid","inspector-close",1,"inspector__close",3,"pTooltip"],["data-testid","inspector-plugin-actions",1,"inspector__plugin-actions"],["data-testid","inspector-header-tools",1,"inspector__tools"],["aria-hidden","true",1,"pi","pi-clock"],["width","14","height","14","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round","aria-hidden","true"],["d","M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"],["d","M6.453 15h11.094"],["d","M8.5 2h7"],["aria-hidden","true",1,"pi","pi-ban"],["type","button","data-testid","inspector-close",1,"inspector__close",3,"click","pTooltip"],["aria-hidden","true",1,"pi","pi-times"],[1,"inspector__plugin-actions-label"],["type","button","data-testid","inspector-plugin-btn-summary",1,"inspector__plugin-btn"],["aria-hidden","true",1,"pi","pi-sparkles"],["type","button","data-testid","inspector-plugin-btn-audit",1,"inspector__plugin-btn"],["aria-hidden","true",1,"pi","pi-search"],["type","button","data-testid","inspector-plugin-btn-validate",1,"inspector__plugin-btn"],["aria-hidden","true",1,"pi","pi-check-circle"],[1,"inspector__tool-tag"]],template:function(e,n){if(e&1&&(f(0,"header",1)(1,"div",2),B(2,"sm-kind-icon",3),p(),f(3,"div",4)(4,"div",5)(5,"h2",6),_(6),p()(),f(7,"code",7),_(8),p()(),f(9,"div",8)(10,"button",9),K("click",function(r){return n.onFavoriteClick(r)}),B(11,"i",10),p(),S(12,AT,2,1,"span",11),S(13,LT,5,1,"span",12),S(14,BT,2,1,"span",12),S(15,zT,2,1,"span",13),B(16,"sm-view-contributions-host",14)(17,"sm-view-contributions-host",15),S(18,VT,3,2,"button",16),p(),S(19,HT,15,0,"div",17),S(20,jT,3,0,"div",18),p()),e&2){let o,r=n.node();ot("--node-color",n.headerTitleColor()),re("inspector__header--skill",r.kind==="skill")("inspector__header--agent",r.kind==="agent")("inspector__header--command",r.kind==="command")("inspector__header--markdown",r.kind==="markdown"),c(2),E("kind",r.kind)("provider",r.provider)("size",18),c(4),v(r.frontmatter.name),c(2),v(r.path),c(2),re("inspector__favorite--on",r.isFavorite===!0),E("pTooltip",r.isFavorite===!0?n.cardTexts.favoriteRemoveTooltip:n.cardTexts.favoriteAddTooltip),X("aria-label",r.isFavorite===!0?n.cardTexts.ariaFavoriteRemove:n.cardTexts.ariaFavoriteAdd),c(),re("pi-star-fill",r.isFavorite===!0)("pi-star",r.isFavorite!==!0),c(),I(n.headerIsStale()?12:-1),c(),I(n.headerStability()==="experimental"?13:-1),c(),I(n.headerStability()==="deprecated"?14:-1),c(),I((o=n.headerVersion())?15:-1,o),c(),E("node",r),c(),E("node",r),c(),I(n.mode()==="embedded"?18:-1),c(),I(n.showActionMocks()?19:-1),c(),I(n.headerTools().length>0?20:-1)}},dependencies:[Re,Ve,$t,Rt],styles:["[_nghost-%COMP%]{--hero-fg: #fff;--hero-fg-bold: rgba(255, 255, 255, .95);--hero-fg-soft: rgba(255, 255, 255, .85);--hero-fg-muted: rgba(255, 255, 255, .7);--hero-fg-faint: rgba(255, 255, 255, .5);--hero-divider: rgba(255, 255, 255, .18);--hero-divider-strong: rgba(255, 255, 255, .32);--hero-divider-stronger: rgba(255, 255, 255, .45);--hero-overlay: rgba(255, 255, 255, .08);--hero-overlay-soft: rgba(255, 255, 255, .16);--hero-overlay-strong: rgba(255, 255, 255, .2);--hero-overlay-hover: rgba(255, 255, 255, .26);--hero-warn-fg: #fde68a;--hero-slate-fg: #475569}.inspector__header[_ngcontent-%COMP%]{--accent: var(--sm-kind-markdown);position:relative;display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:.75rem;row-gap:.3rem;align-items:start;padding:.85rem 1rem;background:linear-gradient(to bottom,transparent 0%,transparent 75%,var(--sm-bg-content) 100%),color-mix(in srgb,var(--accent) 75%,var(--hero-slate-fg));color:var(--hero-fg);overflow:hidden}.inspector__header--skill[_ngcontent-%COMP%]{--accent: var(--sm-kind-skill)}.inspector__header--agent[_ngcontent-%COMP%]{--accent: var(--sm-kind-agent)}.inspector__header--command[_ngcontent-%COMP%]{--accent: var(--sm-kind-command)}.inspector__header--markdown[_ngcontent-%COMP%]{--accent: var(--sm-kind-markdown)}.inspector-view--embedded[_nghost-%COMP%] .inspector__header[_ngcontent-%COMP%], .inspector-view--embedded [_nghost-%COMP%] .inspector__header[_ngcontent-%COMP%]{margin:-1rem -1.1rem 0}.inspector__icon-box[_ngcontent-%COMP%]{width:42px;height:42px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--hero-overlay-strong);color:var(--hero-fg);flex:none;font-size:1.1rem;grid-row:1 / span 3;align-self:center}.inspector__content[_ngcontent-%COMP%]{min-width:0;width:100%;display:flex;flex-direction:column;gap:.25rem}.inspector__name-row[_ngcontent-%COMP%]{display:flex;align-items:baseline;gap:.35rem;min-width:0}.inspector__name[_ngcontent-%COMP%]{margin:0;font-size:1.05rem;font-weight:600;line-height:1.25;letter-spacing:-.01em;word-break:break-word;color:var(--hero-fg);flex:0 1 auto;min-width:0}.inspector__path-code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.7rem;color:var(--hero-fg-soft);background:var(--hero-overlay-soft);padding:.1rem .4rem;border-radius:var(--sm-radius-sm);word-break:break-all;align-self:flex-start;max-width:100%}.inspector__actions-cluster[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.3rem;align-self:center}.inspector__favorite[_ngcontent-%COMP%]{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;background:transparent;border:0;padding:0;cursor:pointer;color:var(--hero-fg-soft);border-radius:var(--sm-radius-md);flex:none;transition:background .12s ease,color .12s ease}.inspector__favorite[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.85rem;line-height:1}.inspector__favorite[_ngcontent-%COMP%]:hover{background:var(--hero-divider);color:var(--hero-fg)}.inspector__favorite[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--hero-fg-muted);outline-offset:1px}.inspector__favorite--on[_ngcontent-%COMP%]{color:var(--hero-fg)}.inspector__stability-icon[_ngcontent-%COMP%], .inspector__stale-icon[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;color:var(--hero-fg-soft);cursor:help}.inspector__stale-icon[_ngcontent-%COMP%]{color:var(--hero-warn-fg)}.inspector__stability-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .inspector__stability-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%], .inspector__stale-icon[_ngcontent-%COMP%] i[_ngcontent-%COMP%], .inspector__stale-icon[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{font-size:.7rem;width:1em;height:1em;line-height:1}.inspector__close[_ngcontent-%COMP%]{width:22px;height:22px;display:inline-flex;align-items:center;justify-content:center;background:var(--hero-overlay-soft);border:1px solid var(--hero-divider-strong);border-radius:var(--sm-radius-md);padding:0;margin-left:.25rem;color:var(--hero-fg);cursor:pointer;flex:none;transition:background .12s ease,border-color .12s ease}.inspector__close[_ngcontent-%COMP%] .pi[_ngcontent-%COMP%]{font-size:.75rem;line-height:1}.inspector__close[_ngcontent-%COMP%]:hover{background:var(--hero-overlay-hover);border-color:var(--hero-divider-stronger)}.inspector__close[_ngcontent-%COMP%]:focus-visible{outline:2px solid var(--hero-fg-muted);outline-offset:1px}.inspector__name-version[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.66rem;color:var(--hero-fg-bold);background:var(--hero-overlay-strong);padding:.06rem .4rem;border-radius:var(--sm-radius-sm);line-height:1.2;flex:none}.inspector__plugin-actions[_ngcontent-%COMP%]{grid-column:1 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:.4rem;margin-top:.55rem}.inspector__plugin-actions-label[_ngcontent-%COMP%]{font-size:.6rem;text-transform:uppercase;letter-spacing:.06em;font-weight:600;color:var(--hero-fg-muted);margin-right:.15rem}.inspector__plugin-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;padding:.4rem .75rem;border:1px solid var(--hero-divider-strong);border-radius:var(--sm-radius-pill);background:var(--hero-overlay-soft);color:var(--hero-fg);font-size:.78rem;font-weight:500;cursor:pointer;transition:background .12s ease,border-color .12s ease,transform .12s ease;font-family:inherit}.inspector__plugin-btn[_ngcontent-%COMP%]:hover{background:var(--hero-overlay-hover);border-color:var(--hero-divider-stronger)}.inspector__plugin-btn[_ngcontent-%COMP%]:active{transform:translateY(1px)}.inspector__plugin-btn[_ngcontent-%COMP%] i[_ngcontent-%COMP%]{font-size:.85rem}.inspector__tools[_ngcontent-%COMP%]{grid-column:1 / -1;display:flex;flex-wrap:wrap;align-items:center;gap:.3rem;padding:.45rem 1rem .55rem;margin:.6rem -1rem -.85rem}.inspector__tool-tag[_ngcontent-%COMP%]{display:inline-flex;align-items:center;padding:.12rem .5rem;border-radius:var(--sm-radius-sm);background:var(--sm-bg-hover);color:var(--p-text-color);font-family:var(--sm-font-mono);font-size:.66rem;font-weight:500;line-height:1.3;flex:none}"],changeDetection:0})};function yp(t){Dt(yp);let{path:i,dataSource:e,markdown:n}=t,o=W("idle"),r=W(null),a=0,s=async(u,h)=>{try{let g=await e.getNode(u,{includeBody:!0});if(h!==a)return;if(g===null){o.set("unavailable");return}let w=g.item.body;if(w===null){o.set("unavailable");return}if(w===void 0||w.trim().length===0){o.set("empty");return}let b=await n.render(w);if(h!==a)return;r.set(b),o.set("ready")}catch{if(h!==a)return;o.set("error")}};ae(()=>{let u=i(),h=++a;if(r.set(null),!u){o.set("idle");return}o.set("loading"),s(u,h)});let l=()=>{let u=i();if(!u||o()==="loading")return;let h=++a;r.set(null),o.set("loading"),s(u,h)};return{bodyState:o.asReadonly(),bodyHtml:r.asReadonly(),refresh:l}}function vp(t){Dt(vp);let{node:i,sidecarService:e,confirmation:n}=t,o=Xt,r=D(()=>{let P=i();if(!P)return!1;let T=P.sidecar;return!T||T.present===!1?!0:T.status==="fresh"?!1:eh(T)}),a=W(!1),s=W(null),l=D(()=>r()?o.bump.tooltipEnabled:o.bump.tooltipDisabledFresh),u=P=>{if(P instanceof ku)switch(P.code){case"sidecar-fresh":return`${o.bump.errorPrefix} ${o.bump.errorFresh}`;case"not-found":return`${o.bump.errorPrefix} ${o.bump.errorNotFound}`;default:return`${o.bump.errorPrefix} ${P.message||o.bump.errorGeneric}`}let T=P instanceof Error?P.message:String(P);return`${o.bump.errorPrefix} ${T||o.bump.errorGeneric}`},h=async P=>{if(!a()){a.set(!0),s.set(null);try{await e.bump(P,{confirm:!0})}catch(T){s.set(u(T))}finally{a.set(!1)}}},g=P=>{n.confirm({header:o.bump.consentHeader,message:o.bump.consentMessage,acceptLabel:o.bump.consentAccept,rejectLabel:o.bump.consentReject,acceptButtonProps:{severity:"primary"},rejectButtonProps:{severity:"secondary"},accept:()=>{h(P)}})},w=async()=>{let P=i();if(P&&r()&&!a()){a.set(!0),s.set(null);try{await e.bump(P.path)}catch(T){if(T instanceof ku&&T.code==="confirm-required"&&WT(T.details)){g(P.path);return}s.set(u(T))}finally{a.set(!1)}}},b=()=>{s.set(null)};return{canBump:r,bumpInFlight:a.asReadonly(),bumpError:s.asReadonly(),bumpTooltip:l,onBumpClick:w,dismissBumpError:b}}function WT(t){return typeof t!="object"||t===null?!1:t.key==="allowEditSmFiles"}function Cp(t){Dt(Cp);let{path:i,pathSet:e,dataSource:n}=t,o=W(new Set),r=W(new Set),a=W(new Set);return ae(()=>{i(),o.set(new Set),r.set(new Set),a.set(new Set)}),{linkStatus:h=>e().has(h)||o().has(h)?"live":r().has(h)?"dead-confirmed":"dead-heuristic",isVerifying:h=>a().has(h),verifyDeadLink:async h=>{if(!(o().has(h)||r().has(h))&&!a().has(h)){a.update(g=>new Set(g).add(h));try{await n.getNode(h)===null?r.update(w=>new Set(w).add(h)):o.update(w=>new Set(w).add(h))}catch{}finally{a.update(g=>{let w=new Set(g);return w.delete(h),w})}}}}}function xp(t){Dt(xp);let i=W(!1),e=W(!1),n=W(!1);return ae(()=>{t.path(),i.set(!1),e.set(!1),n.set(!1)}),{auditExpanded:i.asReadonly(),pluginsExpanded:e.asReadonly(),debugVisible:n.asReadonly(),toggleAudit:()=>i.update(o=>!o),togglePlugins:()=>e.update(o=>!o),toggleDebug:()=>n.update(o=>!o)}}var $T=new Set(["inspector.body.panel.breakdown","inspector.body.panel.records","inspector.body.panel.tree","inspector.body.panel.key-values","inspector.body.panel.link-list","inspector.body.panel.markdown"]),KT=new Set(["identity","annotations","settings","audit"]),XT=new Set(["agent","skill","command"]);function f_(t){let{node:i,texts:e}=t,n=D(()=>{let l=i()?.sidecar;if(!l||!l.present)return null;if(l.root)return l.root;let u={};return l.annotations&&(u.annotations=l.annotations),u}),o=D(()=>{let l=i()?.kind;return l!==void 0&&XT.has(l)}),r=D(()=>{let l=n();if(!l)return!1;for(let u of Object.keys(l))if(!KT.has(u))return!0;return!1}),a=D(()=>{let l=i()?.contributions??[];for(let u of l)if($T.has(u.slot))return!0;return!1}),s=D(()=>{let l=n();if(!l)return e.audit.headerEmpty;let u=l.audit;if(typeof u!="object"||u===null)return e.audit.headerEmpty;let h=u,g=typeof h.lastBumpedAt=="string"?h.lastBumpedAt:null,w=typeof h.lastBumpedBy=="string"?h.lastBumpedBy:null;return g===null?e.audit.headerEmpty:e.audit.headerSummary(hi(g),w??"?")});return{sidecarRoot:n,hasVendorFrontmatter:o,hasPluginContributions:r,hasViewContributions:a,auditSummary:s}}function YT(t,i){if(t&1&&(f(0,"section",0)(1,"div",1),B(2,"span",2),f(3,"p",3),_(4),p(),f(5,"p",4)(6,"span"),_(7),p(),f(8,"a",5),_(9),p(),f(10,"span"),_(11),p(),f(12,"a",6),_(13),p(),f(14,"span"),_(15),p()()()()),t&2){let e=m();c(4),v(e.texts.emptyNoSelection.title),c(3),v(e.texts.emptyNoSelection.descPrefix),c(2),v(e.texts.emptyNoSelection.listLink),c(2),v(e.texts.emptyNoSelection.descMiddle),c(2),v(e.texts.emptyNoSelection.graphLink),c(2),v(e.texts.emptyNoSelection.descSuffix)}}function ZT(t,i){if(t&1&&(f(0,"section",0)(1,"div",7),B(2,"span",8),f(3,"p",3),_(4),p(),f(5,"p",4)(6,"code"),_(7),p(),f(8,"span"),_(9),p(),f(10,"a",5),_(11),p(),f(12,"span"),_(13),p()()()()),t&2){let e=m();c(4),v(e.texts.emptyNotFound.title),c(3),v(e.path()),c(2),v(e.texts.emptyNotFound.descSuffix),c(2),v(e.texts.emptyNotFound.backLink),c(2),v(e.texts.emptyNotFound.descAfterLink)}}function QT(t,i){if(t&1&&(f(0,"a",14),_(1),p()),t&2){let e=m(2);c(),v(e.texts.backToList)}}function JT(t,i){if(t&1&&(f(0,"div",15),B(1,"i",38),f(2,"span"),_(3),p()()),t&2){let e=m(2);c(3),v(e.texts.supersededByBanner(i))}}function eP(t,i){if(t&1){let e=ce();f(0,"div",16)(1,"span"),_(2),p(),f(3,"button",39),K("click",function(){G(e);let o=m(2);return j(o.dismissBumpError())}),B(4,"i",40),p()()}t&2&&(c(2),v(i))}function tP(t,i){if(t&1&&(f(0,"p",17),_(1),p()),t&2){m();let e=J(1);c(),v(e.description)}}function nP(t,i){if(t&1&&(f(0,"div",18),B(1,"sm-inspector-debug-panel",41),p()),t&2){m();let e=J(0),n=m();c(),E("node",e)("sidecarRoot",n.sidecarRoot())("overlay",e.sidecar)}}function iP(t,i){if(t&1&&B(0,"sm-empty-state",42)(1,"sm-empty-state",43)(2,"sm-empty-state",44),t&2){let e=m(2);E("title",e.texts.placeholders.enrichmentTitle)("body",e.texts.placeholders.body),c(),E("title",e.texts.placeholders.summaryTitle)("body",e.texts.placeholders.body),c(),E("title",e.texts.placeholders.findingsTitle)("body",e.texts.placeholders.body)}}function oP(t,i){if(t&1){let e=ce();f(0,"p-card",20)(1,"sm-annotations-panel",45),K("openPath",function(o){G(e);let r=m(2);return j(r.openPath(o))})("tagClick",function(o){G(e);let r=m(2);return j(r.tagSelect.emit(o))}),p()()}if(t&2){m();let e=J(0),n=m();E("header",n.texts.cardsAnnotations),c(),E("overlay",e.sidecar)("authorTags",n.authorTags())("knownPaths",n.pathSet())("activeTag",n.activeTag())}}function rP(t,i){if(t&1&&(f(0,"p-card",21),B(1,"sm-vendor-frontmatter",46),p()),t&2){m();let e=J(0),n=J(1),o=m();E("header",o.texts.cards.agent),c(),E("frontmatter",n)("kind",e.kind)("provider",e.provider)("knownPaths",o.pathSet())("onSkillClick",o.onSkillChip)}}function aP(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0),n=m();c(),v(n.texts.stats.bytes),c(3),v(e.bytesTotal)}}function sP(t,i){if(t&1&&(f(0,"dt"),_(1),p(),f(2,"dd")(3,"code"),_(4),p()()),t&2){m();let e=J(0),n=m();c(),v(n.texts.stats.tokens),c(3),v(e.tokensTotal)}}function cP(t,i){if(t&1&&(_(0," \xB7 "),f(1,"code"),_(2),p(),_(3)),t&2){m();let e=J(0),n=m();c(2),v(e.externalRefsCount),c(),ze(" ",n.texts.stats.ext," ")}}function dP(t,i){if(t&1){let e=ce();f(0,"button",47),K("click",function(){G(e);let o=m(2);return j(o.toggleAudit())}),B(1,"i",48),f(2,"span",49),_(3),p(),f(4,"span",50),_(5),p()()}if(t&2){let e=m(2);X("aria-expanded",e.auditExpanded()),c(),re("pi-chevron-right",!e.auditExpanded())("pi-chevron-down",e.auditExpanded()),c(2),v(e.texts.audit.header),c(2),ze(" \xB7 ",e.auditSummary()," ")}}function lP(t,i){if(t&1&&B(0,"sm-inspector-audit-panel",28),t&2){let e=m(2);E("sidecarRoot",e.sidecarRoot())}}function uP(t,i){if(t&1){let e=ce();f(0,"button",51),K("click",function(){G(e);let o=m(3);return j(o.togglePlugins())}),B(1,"i",48),f(2,"span",49),_(3),p()()}if(t&2){let e=m(3);X("aria-expanded",e.pluginsExpanded()),c(),re("pi-chevron-right",!e.pluginsExpanded())("pi-chevron-down",e.pluginsExpanded()),c(2),v(e.texts.pluginsHeader)}}function fP(t,i){if(t&1&&B(0,"sm-plugin-contributions",28),t&2){let e=m(3);E("sidecarRoot",e.sidecarRoot())}}function pP(t,i){if(t&1&&(f(0,"p-card",29),be(1,uP,4,6,"ng-template",27),S(2,fP,1,1,"sm-plugin-contributions",28),p()),t&2){let e=m(2);c(2),I(e.pluginsExpanded()?2:-1)}}function hP(t,i){if(t&1&&(f(0,"p-card",30),B(1,"sm-inspector-slots-panel",52),p()),t&2){let e=m(2);c(),E("node",e.node())}}function mP(t,i){if(t&1){let e=ce();f(0,"div",53)(1,"h3",54),_(2),p(),f(3,"p-button",55),K("onClick",function(){G(e);let o=m(2);return j(o.refreshBody())}),p()()}if(t&2){let e=m(2);c(2),v(e.texts.cards.body),c(),E("rounded",!0)("text",!0)("ariaLabel",e.texts.body.refreshLabel)("pTooltip",e.texts.body.refreshLabel)("disabled",e.bodyState()==="loading"||!e.path())("loading",e.bodyState()==="loading")}}function _P(t,i){if(t&1&&(f(0,"p",32),_(1),p()),t&2){let e=m(2);c(),v(e.texts.body.loading)}}function gP(t,i){if(t&1&&(f(0,"p",33),_(1),p()),t&2){let e=m(2);c(),v(e.texts.body.empty)}}function yP(t,i){if(t&1&&(f(0,"p",34),_(1),p()),t&2){let e=m(2);c(),v(e.texts.body.unavailable)}}function vP(t,i){if(t&1&&(f(0,"p",35),_(1),p()),t&2){let e=m(2);c(),v(e.texts.body.renderError)}}function CP(t,i){if(t&1&&B(0,"div",36),t&2){let e=m(2);E("innerHTML",e.bodyHtml(),Op)}}function xP(t,i){if(t&1){let e=ce();rt(0)(1),f(2,"section",0)(3,"sm-inspector-header",9),K("close",function(){G(e);let o=m();return j(o.onHeaderClose())})("favoriteToggle",function(o){G(e);let r=m();return j(r.onHeaderFavoriteToggle(o))}),p(),f(4,"div",10)(5,"button",11),K("click",function(){G(e);let o=m();return j(o.toggleDebug())}),B(6,"i",12),p(),f(7,"p-button",13),K("onClick",function(){G(e);let o=m();return j(o.onBumpClick())}),p(),S(8,QT,2,1,"a",14),p(),S(9,JT,4,1,"div",15),S(10,eP,5,1,"div",16),S(11,tP,2,1,"p",17),S(12,nP,2,3,"div",18),f(13,"div",19),S(14,iP,3,6),S(15,oP,2,5,"p-card",20),S(16,rP,2,6,"p-card",21),f(17,"div",22)(18,"sm-linked-nodes-panel",23),K("openPath",function(o){G(e);let r=m();return j(r.openPath(o))}),p()(),f(19,"p-card",24)(20,"dl",25),S(21,aP,5,2),S(22,sP,5,2),f(23,"dt"),_(24),p(),f(25,"dd")(26,"code"),_(27),p(),_(28),f(29,"code"),_(30),p(),_(31),S(32,cP,4,2),p()()(),f(33,"p-card",26),be(34,dP,6,7,"ng-template",27),S(35,lP,1,1,"sm-inspector-audit-panel",28),p(),S(36,pP,3,1,"p-card",29),S(37,hP,2,1,"p-card",30),f(38,"p-card",31),be(39,mP,4,7,"ng-template",27),S(40,_P,2,1,"p",32)(41,gP,2,1,"p",33)(42,yP,2,1,"p",34)(43,vP,2,1,"p",35)(44,CP,1,1,"div",36),p()(),B(45,"p-confirmdialog",37),p()}if(t&2){let e,n,o,r=m(),a=Be(r.node());c();let s=Be(a.frontmatter);c(2),E("node",a)("mode",r.mode())("showActionMocks",r.showActionMocks),c(2),re("inspector__debug-toggle--active",r.debugVisible()),E("pTooltip",r.texts.debugToggleTooltip),X("aria-label",r.texts.debugToggleAriaLabel)("aria-pressed",r.debugVisible()),c(2),E("label",r.texts.bump.label)("disabled",!r.canBump()||r.bumpInFlight())("loading",r.bumpInFlight())("pTooltip",r.bumpTooltip()),c(),I(r.mode()==="standalone"?8:-1),c(),I((e=r.headerSupersededBy())?9:-1,e),c(),I((n=r.bumpError())?10:-1,n),c(),I(s.description?11:-1),c(),I(r.debugVisible()?12:-1),c(2),I(r.mode()==="standalone"?14:-1),c(),I(a.sidecar!=null&&a.sidecar.present||r.authorTags().length>0?15:-1),c(),I(r.hasVendorFrontmatter()?16:-1),c(2),E("path",a.path),c(3),I(a.bytesTotal!==void 0?21:-1),c(),I(a.tokensTotal!==void 0?22:-1),c(2),v(r.texts.stats.links),c(3),v(a.linksOutCount??0),c(),ze(" ",r.texts.stats.out," \xB7 "),c(2),v(a.linksInCount??0),c(),ze(" ",r.texts.stats.in," "),c(),I(a.externalRefsCount!==void 0&&a.externalRefsCount>0?32:-1),c(3),I(r.auditExpanded()?35:-1),c(),I(r.hasPluginContributions()?36:-1),c(),I(r.hasViewContributions()?37:-1),c(3),I((o=r.bodyState())==="loading"?40:o==="empty"?41:o==="unavailable"?42:o==="error"?43:o==="ready"?44:-1),c(5),E("ariaLabel",r.texts.bump.consentDialogAriaLabel)}}var cu=class t{loader=d(Nt);router=d(bo);dataSource=d(kt);markdown=d(ah);sidecarService=d(ql);confirmation=d(wn);texts=Xt;cardTexts=gn;showActionMocks=oi.inspector.actionMocks;path=F(void 0);mode=F("standalone");activeTag=F(null);close=Ee();tagSelect=Ee();node=D(()=>{let i=this.path();return i?this.loader.nodes().find(e=>e.path===i)??null:null});pathSet=D(()=>{let i=new Set;for(let e of this.loader.nodes())i.add(e.path);return i});authorTags=D(()=>{let e=(this.node()?.frontmatter??{}).tags;if(!Array.isArray(e))return[];let n=e.filter(o=>typeof o=="string"&&o.length>0);return[...new Set(n)].sort()});headerSupersededBy=D(()=>{let i=this.node();if(!i)return null;let n=i.sidecar?.annotations?.supersededBy;if(typeof n=="string"&&n.length>0)return n;let o=Eo(i.frontmatter)?.supersededBy;return typeof o=="string"&&o.length>0?o:null});bodyHandle=yp({path:this.path,dataSource:this.dataSource,markdown:this.markdown});bodyState=this.bodyHandle.bodyState;bodyHtml=this.bodyHandle.bodyHtml;deadLink=Cp({path:this.path,pathSet:this.pathSet,dataSource:this.dataSource});sectionCollapse=xp({path:this.path});auditExpanded=this.sectionCollapse.auditExpanded;pluginsExpanded=this.sectionCollapse.pluginsExpanded;debugVisible=this.sectionCollapse.debugVisible;derivations=f_({node:this.node,texts:this.texts});sidecarRoot=this.derivations.sidecarRoot;hasVendorFrontmatter=this.derivations.hasVendorFrontmatter;hasPluginContributions=this.derivations.hasPluginContributions;hasViewContributions=this.derivations.hasViewContributions;auditSummary=this.derivations.auditSummary;ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}openPath(i){this.router.navigate(["/graph"],{queryParams:{path:i}})}onSkillChip=i=>{this.openPath(i)};pathExists(i){return this.pathSet().has(i)}linkStatus(i){return this.deadLink.linkStatus(i)}isVerifying(i){return this.deadLink.isVerifying(i)}verifyDeadLink(i){return this.deadLink.verifyDeadLink(i)}refreshBody(){this.bodyHandle.refresh()}onHeaderFavoriteToggle(i){let e=this.node();!e||e.path!==i||this.loader.toggleFavorite(i,!e.isFavorite)}onHeaderClose(){this.close.emit()}toggleAudit(){this.sectionCollapse.toggleAudit()}togglePlugins(){this.sectionCollapse.togglePlugins()}toggleDebug(){this.sectionCollapse.toggleDebug()}bumpHandle=vp({node:this.node,sidecarService:this.sidecarService,confirmation:this.confirmation});canBump=this.bumpHandle.canBump;bumpInFlight=this.bumpHandle.bumpInFlight;bumpError=this.bumpHandle.bumpError;bumpTooltip=this.bumpHandle.bumpTooltip;onBumpClick(){return this.bumpHandle.onBumpClick()}dismissBumpError(){this.bumpHandle.dismissBumpError()}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-inspector-view"]],hostVars:2,hostBindings:function(e,n){e&2&&re("inspector-view--embedded",n.mode()==="embedded")},inputs:{path:[1,"path"],mode:[1,"mode"],activeTag:[1,"activeTag"]},outputs:{close:"close",tagSelect:"tagSelect"},features:[ge([wn])],decls:3,vars:1,consts:[["data-testid","inspector-view",1,"inspector"],["data-testid","inspector-empty-no-selection",1,"empty-state"],[1,"empty-state__icon","pi","pi-eye"],[1,"empty-state__title"],[1,"empty-state__desc"],["routerLink","/list",1,"inspector__back"],["routerLink","/graph",1,"inspector__back"],["data-testid","inspector-empty-not-found",1,"empty-state"],[1,"empty-state__icon","empty-state__icon--warn","pi","pi-question-circle"],[3,"close","favoriteToggle","node","mode","showActionMocks"],[1,"inspector__toolbar"],["type","button","data-testid","inspector-debug-toggle",1,"inspector__debug-toggle",3,"click","pTooltip"],["aria-hidden","true",1,"pi","pi-info-circle"],["icon","pi pi-arrow-up-right","severity","secondary","size","small","data-testid","inspector-bump",3,"onClick","label","disabled","loading","pTooltip"],["routerLink","/list","data-testid","inspector-back",1,"inspector__back"],["data-testid","inspector-superseded-banner",1,"inspector__superseded"],["data-testid","inspector-bump-error",1,"inspector__bump-error"],["data-testid","inspector-description",1,"inspector__desc"],["data-testid","inspector-debug-section",1,"inspector__debug"],[1,"inspector__grid"],["styleClass","inspector__card inspector__card--full","data-testid","inspector-card-annotations",3,"header"],["styleClass","inspector__card inspector__card--full","data-testid","inspector-card-vendor-frontmatter",3,"header"],["data-testid","inspector-card-linked-nodes",1,"inspector__card","inspector__card--full"],[3,"openPath","path"],["styleClass","inspector__card inspector__card--full inspector__card--stats","data-testid","inspector-card-stats"],[1,"kv"],["styleClass","inspector__card inspector__card--full inspector__card--collapsible","data-testid","inspector-card-audit"],["pTemplate","header"],[3,"sidecarRoot"],["styleClass","inspector__card inspector__card--full inspector__card--collapsible","data-testid","inspector-card-plugins"],["styleClass","inspector__card inspector__card--full","data-testid","inspector-card-view-contributions"],["styleClass","inspector__card inspector__card--full inspector__body","data-testid","inspector-card-body"],["data-testid","inspector-body-loading",1,"inspector__body-status"],["data-testid","inspector-body-empty",1,"inspector__body-status"],["data-testid","inspector-body-unavailable",1,"inspector__body-status","inspector__body-status--warn"],["data-testid","inspector-body-error",1,"inspector__body-status","inspector__body-status--warn"],["data-testid","inspector-body-rendered",1,"inspector__body-rendered",3,"innerHTML"],["data-testid","inspector-bump-consent","styleClass","sm-consent-dialog",3,"ariaLabel"],["aria-hidden","true",1,"pi","pi-arrow-up-right"],["type","button","aria-label","Dismiss",1,"inspector__bump-error-dismiss",3,"click"],["aria-hidden","true",1,"pi","pi-times"],[3,"node","sidecarRoot","overlay"],["icon","pi pi-sparkles","testId","inspector-empty-enrichment",3,"title","body"],["icon","pi pi-file","testId","inspector-empty-summary",3,"title","body"],["icon","pi pi-search","testId","inspector-empty-findings",3,"title","body"],[3,"openPath","tagClick","overlay","authorTags","knownPaths","activeTag"],[3,"frontmatter","kind","provider","knownPaths","onSkillClick"],["type","button","data-testid","inspector-audit-toggle",1,"inspector__collapsible-header",3,"click"],["aria-hidden","true",1,"pi"],[1,"inspector__collapsible-title"],["data-testid","inspector-audit-summary",1,"inspector__collapsible-summary"],["type","button","data-testid","inspector-plugins-toggle",1,"inspector__collapsible-header",3,"click"],[3,"node"],[1,"inspector__body-header"],[1,"inspector__body-title"],["icon","pi pi-refresh","severity","secondary","data-testid","inspector-body-refresh",3,"onClick","rounded","text","ariaLabel","pTooltip","disabled","loading"]],template:function(e,n){e&1&&S(0,YT,16,6,"section",0)(1,ZT,14,5,"section",0)(2,xP,46,36,"section",0),e&2&&I(n.path()?n.node()?2:1:0)},dependencies:[$p,Xl,ro,Sn,Tn,In,Re,Ve,To,Io,Ql,Jl,Zl,tu,nu,iu,ou,au,su],styles:["[_nghost-%COMP%]{display:block}.inspector[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem}.inspector--empty[_ngcontent-%COMP%]{padding:2rem;color:var(--p-text-muted-color)}.inspector--empty[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .35rem;border-radius:var(--sm-radius-md);font-size:.85rem}.inspector__toolbar[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem}.inspector__back[_ngcontent-%COMP%]{font-size:.9rem;color:var(--p-primary-color)}.inspector__desc[_ngcontent-%COMP%]{margin:0;color:var(--p-text-color);font-size:1rem;line-height:1.5;max-width:70ch}.inspector__grid[_ngcontent-%COMP%]{display:grid;grid-template-columns:1fr 1fr;gap:1rem}.inspector__card--full[_ngcontent-%COMP%]{grid-column:1 / -1}[_nghost-%COMP%] .inspector__card--hero{border-left:3px solid var(--p-primary-color)}.inspector__body[_ngcontent-%COMP%]{display:block}.inspector__body-header[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:space-between;gap:.5rem;padding:.75rem 1rem 0}.inspector__body-title[_ngcontent-%COMP%]{margin:0;font-size:.95rem;font-weight:600}.inspector__body-status[_ngcontent-%COMP%]{margin:0;font-size:.85rem;color:var(--p-text-muted-color);font-style:italic}.inspector__body-status--warn[_ngcontent-%COMP%]{color:var(--sm-severity-warn);font-style:normal}.inspector__body-rendered[_ngcontent-%COMP%]{font-size:.9rem;line-height:1.55;max-height:600px;overflow:auto}.inspector__body-rendered[_ngcontent-%COMP%] [_ngcontent-%COMP%]:first-child{margin-top:0}.inspector__body-rendered[_ngcontent-%COMP%] [_ngcontent-%COMP%]:last-child{margin-bottom:0}.inspector__body-rendered[_ngcontent-%COMP%] pre[_ngcontent-%COMP%]{background:var(--p-content-background);border:1px solid var(--p-content-border-color);border-radius:var(--sm-radius-md);padding:.75rem;margin:.75rem 0;white-space:pre-wrap;word-wrap:break-word;font-family:var(--sm-font-mono);font-size:.85rem;line-height:1.5;overflow-x:auto}.inspector__body-rendered[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--p-content-background);padding:.1rem .3rem;border-radius:var(--sm-radius-sm);font-family:var(--sm-font-mono);font-size:.85em}.inspector__body-rendered[_ngcontent-%COMP%] pre[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:transparent;padding:0;border-radius:0}.kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.25rem .75rem;margin:0 0 .5rem;font-size:.9rem}.kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--p-text-muted-color);font-weight:500}.kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}.kv[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .35rem;border-radius:var(--sm-radius-md);font-size:.85rem}.kv[_ngcontent-%COMP%] a[_ngcontent-%COMP%]{color:var(--p-primary-color);word-break:break-all}h4[_ngcontent-%COMP%]{margin:1rem 0 .5rem;font-size:.85rem;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color);font-weight:600}h4[_ngcontent-%COMP%]:first-child{margin-top:0}.chips[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;gap:.4rem}[_nghost-%COMP%] .chip--link{cursor:pointer;background:var(--p-primary-50);color:var(--p-primary-color);transition:background .15s ease}[_nghost-%COMP%] .chip--link:hover{background:var(--p-primary-100)}[_nghost-%COMP%] .chip--warn{background:var(--sm-kind-command-bg);color:var(--sm-kind-command-fg)}.rel-chip[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.2rem}.rel-chip__verify[_ngcontent-%COMP%]{background:none;border:none;padding:.15rem;cursor:pointer;color:var(--p-text-muted-color);border-radius:50%;display:inline-flex;align-items:center;justify-content:center;transition:color .15s ease,background .15s ease}.rel-chip__verify[_ngcontent-%COMP%]:hover:not(:disabled){color:var(--p-primary-color);background:var(--sm-bg-hover)}.rel-chip__verify[_ngcontent-%COMP%]:disabled{cursor:wait;opacity:.6}.rel-chip__verify--confirmed[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.rel-chip__verify--confirmed[_ngcontent-%COMP%]:hover:not(:disabled){color:var(--sm-severity-error)}.args[_ngcontent-%COMP%]{margin:0;padding-left:1.25rem;display:flex;flex-direction:column;gap:.35rem;font-size:.9rem}.args[_ngcontent-%COMP%] code[_ngcontent-%COMP%]{background:var(--sm-bg-hover);padding:.1rem .35rem;border-radius:var(--sm-radius-md);font-size:.8rem;font-weight:500}.args__type[_ngcontent-%COMP%]{color:var(--p-text-muted-color);font-style:italic;margin-left:.25rem}.args__req[_ngcontent-%COMP%]{display:inline-block;margin-left:.5rem;padding:0 .4rem;font-size:.7rem;background:var(--sm-kind-command-bg);color:var(--sm-kind-command-fg);border-radius:var(--sm-radius-md);text-transform:uppercase;letter-spacing:.04em;font-weight:600}.cond[_ngcontent-%COMP%]{font-size:.8rem;word-break:break-all}@media(max-width:1280px){.inspector__grid[_ngcontent-%COMP%]{grid-template-columns:1fr}}.inspector-view--embedded[_nghost-%COMP%] .inspector[_ngcontent-%COMP%]{padding:1rem 1.1rem 1.25rem;gap:.85rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__desc[_ngcontent-%COMP%]{font-size:.9rem;line-height:1.45;max-width:none}.inspector-view--embedded[_nghost-%COMP%] .inspector__grid[_ngcontent-%COMP%]{grid-template-columns:1fr;gap:.75rem}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-annotations][_ngcontent-%COMP%]{order:1}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-vendor-frontmatter][_ngcontent-%COMP%]{order:2}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-linked-nodes][_ngcontent-%COMP%]{order:3}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-stats][_ngcontent-%COMP%]{order:4}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-audit][_ngcontent-%COMP%]{order:5}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-plugins][_ngcontent-%COMP%]{order:6}.inspector-view--embedded[_nghost-%COMP%] [data-testid=inspector-card-body][_ngcontent-%COMP%]{order:7}.inspector-view--embedded[_nghost-%COMP%] .inspector__card .p-card-body{padding:.75rem .85rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card .p-card-title{font-size:.9rem;margin-bottom:.5rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] h4[_ngcontent-%COMP%]{font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:var(--p-text-muted-color);margin:.5rem 0 .35rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] .kv[_ngcontent-%COMP%]{display:grid;grid-template-columns:max-content 1fr;gap:.25rem .65rem;margin:0;font-size:.85rem}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] .kv[_ngcontent-%COMP%] dt[_ngcontent-%COMP%]{color:var(--p-text-muted-color)}.inspector-view--embedded[_nghost-%COMP%] .inspector__card[_ngcontent-%COMP%] .kv[_ngcontent-%COMP%] dd[_ngcontent-%COMP%]{margin:0;word-break:break-word}.inspector__bump-error[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.6rem;padding:.5rem .75rem;margin:.5rem 0;background:var(--sm-severity-error-bg);color:var(--sm-severity-error);border-radius:var(--sm-radius-md);font-size:.85rem}.inspector__bump-error-dismiss[_ngcontent-%COMP%]{margin-left:auto;background:transparent;border:none;cursor:pointer;color:inherit;display:inline-flex;align-items:center;justify-content:center}.inspector__superseded[_ngcontent-%COMP%]{display:flex;align-items:center;gap:.5rem;padding:.55rem .85rem;background:var(--sm-severity-warn-bg);color:var(--sm-severity-warn);border-radius:var(--sm-radius-md);font-size:.85rem;font-family:var(--sm-font-mono)}.inspector__debug-toggle[_ngcontent-%COMP%]{width:30px;height:30px;border-radius:50%;border:1px solid var(--sm-border);background:transparent;color:var(--sm-text-muted);display:inline-flex;align-items:center;justify-content:center;cursor:pointer;transition:color .12s ease,border-color .12s ease,background .12s ease}.inspector__debug-toggle[_ngcontent-%COMP%]:hover{color:var(--p-primary-color);border-color:var(--p-primary-color)}.inspector__debug-toggle--active[_ngcontent-%COMP%]{color:var(--p-primary-color);border-color:var(--p-primary-color);background:color-mix(in srgb,var(--p-primary-color) 10%,transparent)}.inspector__debug[_ngcontent-%COMP%]{padding:.6rem .85rem;border:1px solid var(--sm-border);border-radius:var(--sm-radius-md);background:var(--sm-bg-hover)}.inspector__collapsible-header[_ngcontent-%COMP%]{width:100%;display:flex;align-items:center;gap:.5rem;padding:.65rem 1rem;background:transparent;border:none;text-align:left;cursor:pointer;font-size:.9rem;color:var(--p-text-color)}.inspector__collapsible-header[_ngcontent-%COMP%]:hover{background:var(--sm-bg-hover)}.inspector__collapsible-title[_ngcontent-%COMP%]{font-weight:600}.inspector__collapsible-summary[_ngcontent-%COMP%]{color:var(--sm-text-muted);font-weight:400;font-size:.85rem;font-style:italic}"],changeDetection:0})};var du=class t{smMiddleMousePan=F.required();origin=null;rafId=null;pendingPosition=null;onMouseDown(i){if(i.button!==1)return;let e=this.smMiddleMousePan();if(!e)return;i.preventDefault();let n=e.getPosition()??{x:0,y:0};this.origin={mouseX:i.clientX,mouseY:i.clientY,canvasX:n.x,canvasY:n.y},document.addEventListener("mousemove",this.onMove),document.addEventListener("mouseup",this.onEnd)}ngOnDestroy(){this.onEnd()}onMove=i=>{this.origin&&(this.pendingPosition={x:this.origin.canvasX+(i.clientX-this.origin.mouseX),y:this.origin.canvasY+(i.clientY-this.origin.mouseY)},this.rafId===null&&(this.rafId=requestAnimationFrame(()=>{this.rafId=null;let e=this.smMiddleMousePan();!e||!this.pendingPosition||(e.setPosition(this.pendingPosition),e.redraw())})))};onEnd=()=>{this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null),this.pendingPosition=null,this.origin=null,document.removeEventListener("mousemove",this.onMove),document.removeEventListener("mouseup",this.onEnd),this.smMiddleMousePan()?.emitCanvasChangeEvent()};static \u0275fac=function(e){return new(e||t)};static \u0275dir=Ce({type:t,selectors:[["","smMiddleMousePan",""]],hostBindings:function(e,n){e&1&&K("mousedown",function(r){return n.onMouseDown(r)})},inputs:{smMiddleMousePan:[1,"smMiddleMousePan"]}})};function bp(t,i){var e,n=1;t==null&&(t=0),i==null&&(i=0);function o(){var r,a=e.length,s,l=0,u=0;for(r=0;r<a;++r)s=e[r],l+=s.x,u+=s.y;for(l=(l/a-t)*n,u=(u/a-i)*n,r=0;r<a;++r)s=e[r],s.x-=l,s.y-=u}return o.initialize=function(r){e=r},o.x=function(r){return arguments.length?(t=+r,o):t},o.y=function(r){return arguments.length?(i=+r,o):i},o.strength=function(r){return arguments.length?(n=+r,o):n},o}function p_(t){let i=+this._x.call(null,t),e=+this._y.call(null,t);return h_(this.cover(i,e),i,e,t)}function h_(t,i,e,n){if(isNaN(i)||isNaN(e))return t;var o,r=t._root,a={data:n},s=t._x0,l=t._y0,u=t._x1,h=t._y1,g,w,b,P,T,k,N,O;if(!r)return t._root=a,t;for(;r.length;)if((T=i>=(g=(s+u)/2))?s=g:u=g,(k=e>=(w=(l+h)/2))?l=w:h=w,o=r,!(r=r[N=k<<1|T]))return o[N]=a,t;if(b=+t._x.call(null,r.data),P=+t._y.call(null,r.data),i===b&&e===P)return a.next=r,o?o[N]=a:t._root=a,t;do o=o?o[N]=new Array(4):t._root=new Array(4),(T=i>=(g=(s+u)/2))?s=g:u=g,(k=e>=(w=(l+h)/2))?l=w:h=w;while((N=k<<1|T)===(O=(P>=w)<<1|b>=g));return o[O]=r,o[N]=a,t}function m_(t){var i,e,n=t.length,o,r,a=new Array(n),s=new Array(n),l=1/0,u=1/0,h=-1/0,g=-1/0;for(e=0;e<n;++e)isNaN(o=+this._x.call(null,i=t[e]))||isNaN(r=+this._y.call(null,i))||(a[e]=o,s[e]=r,o<l&&(l=o),o>h&&(h=o),r<u&&(u=r),r>g&&(g=r));if(l>h||u>g)return this;for(this.cover(l,u).cover(h,g),e=0;e<n;++e)h_(this,a[e],s[e],t[e]);return this}function __(t,i){if(isNaN(t=+t)||isNaN(i=+i))return this;var e=this._x0,n=this._y0,o=this._x1,r=this._y1;if(isNaN(e))o=(e=Math.floor(t))+1,r=(n=Math.floor(i))+1;else{for(var a=o-e||1,s=this._root,l,u;e>t||t>=o||n>i||i>=r;)switch(u=(i<n)<<1|t<e,l=new Array(4),l[u]=s,s=l,a*=2,u){case 0:o=e+a,r=n+a;break;case 1:e=o-a,r=n+a;break;case 2:o=e+a,n=r-a;break;case 3:e=o-a,n=r-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=e,this._y0=n,this._x1=o,this._y1=r,this}function g_(){var t=[];return this.visit(function(i){if(!i.length)do t.push(i.data);while(i=i.next)}),t}function y_(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function He(t,i,e,n,o){this.node=t,this.x0=i,this.y0=e,this.x1=n,this.y1=o}function v_(t,i,e){var n,o=this._x0,r=this._y0,a,s,l,u,h=this._x1,g=this._y1,w=[],b=this._root,P,T;for(b&&w.push(new He(b,o,r,h,g)),e==null?e=1/0:(o=t-e,r=i-e,h=t+e,g=i+e,e*=e);P=w.pop();)if(!(!(b=P.node)||(a=P.x0)>h||(s=P.y0)>g||(l=P.x1)<o||(u=P.y1)<r))if(b.length){var k=(a+l)/2,N=(s+u)/2;w.push(new He(b[3],k,N,l,u),new He(b[2],a,N,k,u),new He(b[1],k,s,l,N),new He(b[0],a,s,k,N)),(T=(i>=N)<<1|t>=k)&&(P=w[w.length-1],w[w.length-1]=w[w.length-1-T],w[w.length-1-T]=P)}else{var O=t-+this._x.call(null,b.data),V=i-+this._y.call(null,b.data),z=O*O+V*V;if(z<e){var q=Math.sqrt(e=z);o=t-q,r=i-q,h=t+q,g=i+q,n=b.data}}return n}function C_(t){if(isNaN(h=+this._x.call(null,t))||isNaN(g=+this._y.call(null,t)))return this;var i,e=this._root,n,o,r,a=this._x0,s=this._y0,l=this._x1,u=this._y1,h,g,w,b,P,T,k,N;if(!e)return this;if(e.length)for(;;){if((P=h>=(w=(a+l)/2))?a=w:l=w,(T=g>=(b=(s+u)/2))?s=b:u=b,i=e,!(e=e[k=T<<1|P]))return this;if(!e.length)break;(i[k+1&3]||i[k+2&3]||i[k+3&3])&&(n=i,N=k)}for(;e.data!==t;)if(o=e,!(e=e.next))return this;return(r=e.next)&&delete e.next,o?(r?o.next=r:delete o.next,this):i?(r?i[k]=r:delete i[k],(e=i[0]||i[1]||i[2]||i[3])&&e===(i[3]||i[2]||i[1]||i[0])&&!e.length&&(n?n[N]=e:this._root=e),this):(this._root=r,this)}function x_(t){for(var i=0,e=t.length;i<e;++i)this.remove(t[i]);return this}function b_(){return this._root}function w_(){var t=0;return this.visit(function(i){if(!i.length)do++t;while(i=i.next)}),t}function S_(t){var i=[],e,n=this._root,o,r,a,s,l;for(n&&i.push(new He(n,this._x0,this._y0,this._x1,this._y1));e=i.pop();)if(!t(n=e.node,r=e.x0,a=e.y0,s=e.x1,l=e.y1)&&n.length){var u=(r+s)/2,h=(a+l)/2;(o=n[3])&&i.push(new He(o,u,h,s,l)),(o=n[2])&&i.push(new He(o,r,h,u,l)),(o=n[1])&&i.push(new He(o,u,a,s,h)),(o=n[0])&&i.push(new He(o,r,a,u,h))}return this}function I_(t){var i=[],e=[],n;for(this._root&&i.push(new He(this._root,this._x0,this._y0,this._x1,this._y1));n=i.pop();){var o=n.node;if(o.length){var r,a=n.x0,s=n.y0,l=n.x1,u=n.y1,h=(a+l)/2,g=(s+u)/2;(r=o[0])&&i.push(new He(r,a,s,h,g)),(r=o[1])&&i.push(new He(r,h,s,l,g)),(r=o[2])&&i.push(new He(r,a,g,h,u)),(r=o[3])&&i.push(new He(r,h,g,l,u))}e.push(n)}for(;n=e.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this}function T_(t){return t[0]}function P_(t){return arguments.length?(this._x=t,this):this._x}function E_(t){return t[1]}function D_(t){return arguments.length?(this._y=t,this):this._y}function yn(t,i,e){var n=new wp(i??T_,e??E_,NaN,NaN,NaN,NaN);return t==null?n:n.addAll(t)}function wp(t,i,e,n,o,r){this._x=t,this._y=i,this._x0=e,this._y0=n,this._x1=o,this._y1=r,this._root=void 0}function M_(t){for(var i={data:t.data},e=i;t=t.next;)e=e.next={data:t.data};return i}var Ze=yn.prototype=wp.prototype;Ze.copy=function(){var t=new wp(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root,e,n;if(!i)return t;if(!i.length)return t._root=M_(i),t;for(e=[{source:i,target:t._root=new Array(4)}];i=e.pop();)for(var o=0;o<4;++o)(n=i.source[o])&&(n.length?e.push({source:n,target:i.target[o]=new Array(4)}):i.target[o]=M_(n));return t};Ze.add=p_;Ze.addAll=m_;Ze.cover=__;Ze.data=g_;Ze.extent=y_;Ze.find=v_;Ze.remove=C_;Ze.removeAll=x_;Ze.root=b_;Ze.size=w_;Ze.visit=S_;Ze.visitAfter=I_;Ze.x=P_;Ze.y=D_;function Fe(t){return function(){return t}}function mt(t){return(t()-.5)*1e-6}function bP(t){return t.x+t.vx}function wP(t){return t.y+t.vy}function lu(t){var i,e,n,o=1,r=1;typeof t!="function"&&(t=Fe(t==null?1:+t));function a(){for(var u,h=i.length,g,w,b,P,T,k,N=0;N<r;++N)for(g=yn(i,bP,wP).visitAfter(s),u=0;u<h;++u)w=i[u],T=e[w.index],k=T*T,b=w.x+w.vx,P=w.y+w.vy,g.visit(O);function O(V,z,q,ie,Te){var ue=V.data,Ge=V.r,oe=T+Ge;if(ue){if(ue.index>w.index){var le=b-ue.x-ue.vx,Ue=P-ue.y-ue.vy,ve=le*le+Ue*Ue;ve<oe*oe&&(le===0&&(le=mt(n),ve+=le*le),Ue===0&&(Ue=mt(n),ve+=Ue*Ue),ve=(oe-(ve=Math.sqrt(ve)))/ve*o,w.vx+=(le*=ve)*(oe=(Ge*=Ge)/(k+Ge)),w.vy+=(Ue*=ve)*oe,ue.vx-=le*(oe=1-oe),ue.vy-=Ue*oe)}return}return z>b+oe||ie<b-oe||q>P+oe||Te<P-oe}}function s(u){if(u.data)return u.r=e[u.data.index];for(var h=u.r=0;h<4;++h)u[h]&&u[h].r>u.r&&(u.r=u[h].r)}function l(){if(i){var u,h=i.length,g;for(e=new Array(h),u=0;u<h;++u)g=i[u],e[g.index]=+t(g,u,i)}}return a.initialize=function(u,h){i=u,n=h,l()},a.iterations=function(u){return arguments.length?(r=+u,a):r},a.strength=function(u){return arguments.length?(o=+u,a):o},a.radius=function(u){return arguments.length?(t=typeof u=="function"?u:Fe(+u),l(),a):t},a}function SP(t){return t.index}function k_(t,i){var e=t.get(i);if(!e)throw new Error("node not found: "+i);return e}function uu(t){var i=SP,e=g,n,o=Fe(30),r,a,s,l,u,h=1;t==null&&(t=[]);function g(k){return 1/Math.min(s[k.source.index],s[k.target.index])}function w(k){for(var N=0,O=t.length;N<h;++N)for(var V=0,z,q,ie,Te,ue,Ge,oe;V<O;++V)z=t[V],q=z.source,ie=z.target,Te=ie.x+ie.vx-q.x-q.vx||mt(u),ue=ie.y+ie.vy-q.y-q.vy||mt(u),Ge=Math.sqrt(Te*Te+ue*ue),Ge=(Ge-r[V])/Ge*k*n[V],Te*=Ge,ue*=Ge,ie.vx-=Te*(oe=l[V]),ie.vy-=ue*oe,q.vx+=Te*(oe=1-oe),q.vy+=ue*oe}function b(){if(a){var k,N=a.length,O=t.length,V=new Map(a.map((q,ie)=>[i(q,ie,a),q])),z;for(k=0,s=new Array(N);k<O;++k)z=t[k],z.index=k,typeof z.source!="object"&&(z.source=k_(V,z.source)),typeof z.target!="object"&&(z.target=k_(V,z.target)),s[z.source.index]=(s[z.source.index]||0)+1,s[z.target.index]=(s[z.target.index]||0)+1;for(k=0,l=new Array(O);k<O;++k)z=t[k],l[k]=s[z.source.index]/(s[z.source.index]+s[z.target.index]);n=new Array(O),P(),r=new Array(O),T()}}function P(){if(a)for(var k=0,N=t.length;k<N;++k)n[k]=+e(t[k],k,t)}function T(){if(a)for(var k=0,N=t.length;k<N;++k)r[k]=+o(t[k],k,t)}return w.initialize=function(k,N){a=k,u=N,b()},w.links=function(k){return arguments.length?(t=k,b(),w):t},w.id=function(k){return arguments.length?(i=k,w):i},w.iterations=function(k){return arguments.length?(h=+k,w):h},w.strength=function(k){return arguments.length?(e=typeof k=="function"?k:Fe(+k),P(),w):e},w.distance=function(k){return arguments.length?(o=typeof k=="function"?k:Fe(+k),T(),w):o},w}var IP={value:()=>{}};function R_(){for(var t=0,i=arguments.length,e={},n;t<i;++t){if(!(n=arguments[t]+"")||n in e||/[\s.]/.test(n))throw new Error("illegal type: "+n);e[n]=[]}return new fu(e)}function fu(t){this._=t}function TP(t,i){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");if(o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),e&&!i.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}fu.prototype=R_.prototype={constructor:fu,on:function(t,i){var e=this._,n=TP(t+"",e),o,r=-1,a=n.length;if(arguments.length<2){for(;++r<a;)if((o=(t=n[r]).type)&&(o=PP(e[o],t.name)))return o;return}if(i!=null&&typeof i!="function")throw new Error("invalid callback: "+i);for(;++r<a;)if(o=(t=n[r]).type)e[o]=N_(e[o],t.name,i);else if(i==null)for(o in e)e[o]=N_(e[o],t.name,null);return this},copy:function(){var t={},i=this._;for(var e in i)t[e]=i[e].slice();return new fu(t)},call:function(t,i){if((o=arguments.length-2)>0)for(var e=new Array(o),n=0,o,r;n<o;++n)e[n]=arguments[n+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],n=0,o=r.length;n<o;++n)r[n].value.apply(i,e)},apply:function(t,i,e){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],o=0,r=n.length;o<r;++o)n[o].value.apply(i,e)}};function PP(t,i){for(var e=0,n=t.length,o;e<n;++e)if((o=t[e]).name===i)return o.value}function N_(t,i,e){for(var n=0,o=t.length;n<o;++n)if(t[n].name===i){t[n]=IP,t=t.slice(0,n).concat(t.slice(n+1));break}return e!=null&&t.push({name:i,value:e}),t}var Sp=R_;var ri=0,so=0,ao=0,F_=1e3,pu,co,hu=0,vn=0,mu=0,lo=typeof performance=="object"&&performance.now?performance:Date,A_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Pp(){return vn||(A_(EP),vn=lo.now()+mu)}function EP(){vn=0}function Ip(){this._call=this._time=this._next=null}Ip.prototype=_u.prototype={constructor:Ip,restart:function(t,i,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?Pp():+e)+(i==null?0:+i),!this._next&&co!==this&&(co?co._next=this:pu=this,co=this),this._call=t,this._time=e,Tp()},stop:function(){this._call&&(this._call=null,this._time=1/0,Tp())}};function _u(t,i,e){var n=new Ip;return n.restart(t,i,e),n}function L_(){Pp(),++ri;for(var t=pu,i;t;)(i=vn-t._time)>=0&&t._call.call(void 0,i),t=t._next;--ri}function O_(){vn=(hu=lo.now())+mu,ri=so=0;try{L_()}finally{ri=0,MP(),vn=0}}function DP(){var t=lo.now(),i=t-hu;i>F_&&(mu-=i,hu=t)}function MP(){for(var t,i=pu,e,n=1/0;i;)i._call?(n>i._time&&(n=i._time),t=i,i=i._next):(e=i._next,i._next=null,i=t?t._next=e:pu=e);co=t,Tp(n)}function Tp(t){if(!ri){so&&(so=clearTimeout(so));var i=t-vn;i>24?(t<1/0&&(so=setTimeout(O_,t-lo.now()-mu)),ao&&(ao=clearInterval(ao))):(ao||(hu=lo.now(),ao=setInterval(DP,F_)),ri=1,A_(O_))}}function B_(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function z_(t){return t.x}function V_(t){return t.y}var kP=10,NP=Math.PI*(3-Math.sqrt(5));function gu(t){var i,e=1,n=.001,o=1-Math.pow(n,1/300),r=0,a=.6,s=new Map,l=_u(g),u=Sp("tick","end"),h=B_();t==null&&(t=[]);function g(){w(),u.call("tick",i),e<n&&(l.stop(),u.call("end",i))}function w(T){var k,N=t.length,O;T===void 0&&(T=1);for(var V=0;V<T;++V)for(e+=(r-e)*o,s.forEach(function(z){z(e)}),k=0;k<N;++k)O=t[k],O.fx==null?O.x+=O.vx*=a:(O.x=O.fx,O.vx=0),O.fy==null?O.y+=O.vy*=a:(O.y=O.fy,O.vy=0);return i}function b(){for(var T=0,k=t.length,N;T<k;++T){if(N=t[T],N.index=T,N.fx!=null&&(N.x=N.fx),N.fy!=null&&(N.y=N.fy),isNaN(N.x)||isNaN(N.y)){var O=kP*Math.sqrt(.5+T),V=T*NP;N.x=O*Math.cos(V),N.y=O*Math.sin(V)}(isNaN(N.vx)||isNaN(N.vy))&&(N.vx=N.vy=0)}}function P(T){return T.initialize&&T.initialize(t,h),T}return b(),i={tick:w,restart:function(){return l.restart(g),i},stop:function(){return l.stop(),i},nodes:function(T){return arguments.length?(t=T,b(),s.forEach(P),i):t},alpha:function(T){return arguments.length?(e=+T,i):e},alphaMin:function(T){return arguments.length?(n=+T,i):n},alphaDecay:function(T){return arguments.length?(o=+T,i):+o},alphaTarget:function(T){return arguments.length?(r=+T,i):r},velocityDecay:function(T){return arguments.length?(a=1-T,i):1-a},randomSource:function(T){return arguments.length?(h=T,s.forEach(P),i):h},force:function(T,k){return arguments.length>1?(k==null?s.delete(T):s.set(T,P(k)),i):s.get(T)},find:function(T,k,N){var O=0,V=t.length,z,q,ie,Te,ue;for(N==null?N=1/0:N*=N,O=0;O<V;++O)Te=t[O],z=T-Te.x,q=k-Te.y,ie=z*z+q*q,ie<N&&(ue=Te,N=ie);return ue},on:function(T,k){return arguments.length>1?(u.on(T,k),i):u.on(T)}}}function yu(){var t,i,e,n,o=Fe(-30),r,a=1,s=1/0,l=.81;function u(b){var P,T=t.length,k=yn(t,z_,V_).visitAfter(g);for(n=b,P=0;P<T;++P)i=t[P],k.visit(w)}function h(){if(t){var b,P=t.length,T;for(r=new Array(P),b=0;b<P;++b)T=t[b],r[T.index]=+o(T,b,t)}}function g(b){var P=0,T,k,N=0,O,V,z;if(b.length){for(O=V=z=0;z<4;++z)(T=b[z])&&(k=Math.abs(T.value))&&(P+=T.value,N+=k,O+=k*T.x,V+=k*T.y);b.x=O/N,b.y=V/N}else{T=b,T.x=T.data.x,T.y=T.data.y;do P+=r[T.data.index];while(T=T.next)}b.value=P}function w(b,P,T,k){if(!b.value)return!0;var N=b.x-i.x,O=b.y-i.y,V=k-P,z=N*N+O*O;if(V*V/l<z)return z<s&&(N===0&&(N=mt(e),z+=N*N),O===0&&(O=mt(e),z+=O*O),z<a&&(z=Math.sqrt(a*z)),i.vx+=N*b.value*n/z,i.vy+=O*b.value*n/z),!0;if(b.length||z>=s)return;(b.data!==i||b.next)&&(N===0&&(N=mt(e),z+=N*N),O===0&&(O=mt(e),z+=O*O),z<a&&(z=Math.sqrt(a*z)));do b.data!==i&&(V=r[b.data.index]*n/z,i.vx+=N*V,i.vy+=O*V);while(b=b.next)}return u.initialize=function(b,P){t=b,e=P,h()},u.strength=function(b){return arguments.length?(o=typeof b=="function"?b:Fe(+b),h(),u):o},u.distanceMin=function(b){return arguments.length?(a=b*b,u):Math.sqrt(a)},u.distanceMax=function(b){return arguments.length?(s=b*b,u):Math.sqrt(s)},u.theta=function(b){return arguments.length?(l=b*b,u):Math.sqrt(l)},u}function vu(t){var i=Fe(.1),e,n,o;typeof t!="function"&&(t=Fe(t==null?0:+t));function r(s){for(var l=0,u=e.length,h;l<u;++l)h=e[l],h.vx+=(o[l]-h.x)*n[l]*s}function a(){if(e){var s,l=e.length;for(n=new Array(l),o=new Array(l),s=0;s<l;++s)n[s]=isNaN(o[s]=+t(e[s],s,e))?0:+i(e[s],s,e)}}return r.initialize=function(s){e=s,a()},r.strength=function(s){return arguments.length?(i=typeof s=="function"?s:Fe(+s),a(),r):i},r.x=function(s){return arguments.length?(t=typeof s=="function"?s:Fe(+s),a(),r):t},r}function Cu(t){var i=Fe(.1),e,n,o;typeof t!="function"&&(t=Fe(t==null?0:+t));function r(s){for(var l=0,u=e.length,h;l<u;++l)h=e[l],h.vy+=(o[l]-h.y)*n[l]*s}function a(){if(e){var s,l=e.length;for(n=new Array(l),o=new Array(l),s=0;s<l;++s)n[s]=isNaN(o[s]=+t(e[s],s,e))?0:+i(e[s],s,e)}}return r.initialize=function(s){e=s,a()},r.strength=function(s){return arguments.length?(i=typeof s=="function"?s:Fe(+s),a(),r):i},r.y=function(s){return arguments.length?(t=typeof s=="function"?s:Fe(+s),a(),r):t},r}var uo=260,Ep=120;function RP(t,i){let e=t.map(o=>o.path).sort(),n=i.map(o=>o.id).sort();return`${e.length}|${e.join(",")}|${n.length}|${n.join(",")}`}function H_(){let t=null;return(i,e)=>{let n=new Set(i.map(b=>b.path)),o=$m(i),r=new Map,a=e?.links??[];for(let b of a){if(!n.has(b.source))continue;let P=Xm(b.target,b.trigger?.normalizedTrigger??null,o);if(!n.has(P)||b.source===P)continue;let T=AP(b.kind,b.source,P);r.has(T)||r.set(T,{id:T,from:b.source,to:P,kind:b.kind})}let s=[...r.values()],l=new Map;for(let b of i)l.set(b.path,b);let u=new Map;for(let b of e?.nodes??[])u.set(b.path,b);let h=RP(i,s);if(t&&t.fingerprint===h)return{nodesByPath:l,apiNodesByPath:u,edges:t.edges,positions:t.positions,computedAt:t.computedAt};let g=OP(i,s),w=performance.now();return t={fingerprint:h,positions:g,edges:s,computedAt:w},{nodesByPath:l,apiNodesByPath:u,edges:s,positions:g,computedAt:w}}}function OP(t,i){let e=t.map(s=>({id:s.path})),n=i.map(s=>({source:s.from,target:s.to})),o=gu(e).force("link",uu(n).id(s=>s.id).distance(90).strength(1)).force("charge",yu().strength(-200)).force("center",bp(0,0)).force("x",vu(0).strength(.06)).force("y",Cu(0).strength(.06)).force("collide",lu(uo/2+12)).stop(),r=400;for(let s=0;s<r;s++)o.tick();let a=new Map;for(let s of e)a.set(s.id,{x:(s.x??0)-uo/2,y:(s.y??0)-Ep/2});return a}function G_(t,i,e,n){let o=new Set(n),r=t.map(h=>{let g={id:h.path};if(o.has(h.path))return g;let w=e[h.path];if(!w)return g;let b=w.x+uo/2,P=w.y+Ep/2;return g.x=b,g.y=P,g.fx=b,g.fy=P,g}),a=i.map(h=>({source:h.from,target:h.to})),s=gu(r).force("link",uu(a).id(h=>h.id).distance(90).strength(1)).force("charge",yu().strength(-200)).force("x",vu(0).strength(.06)).force("y",Cu(0).strength(.06)).force("collide",lu(uo/2+12)).stop(),l=200;for(let h=0;h<l;h++)s.tick();let u=new Map;for(let h of r)o.has(h.id)&&u.set(h.id,{x:(h.x??0)-uo/2,y:(h.y??0)-Ep/2});return u}function j_(t,i,e,n=null){let o=t.edges.filter(l=>i.has(l.from)&&i.has(l.to)&&(n===null||n.has(l.kind))),r=new Map,a=new Map;for(let l of o)r.set(l.from,(r.get(l.from)??0)+1),a.set(l.to,(a.get(l.to)??0)+1);let s=[];for(let l of i){let u=t.nodesByPath.get(l);if(!u)continue;let h=t.apiNodesByPath.get(l),g=e[l],w=t.positions.get(l)??{x:0,y:0},b=g?{x:g.x,y:g.y}:w;s.push({id:l,path:l,view:u,kind:u.kind,position:b,stats:{linksIn:a.get(l)??0,linksOut:r.get(l)??0,bytesTotal:h?.bytes.total,tokensTotal:h?.tokens?.total,externalRefsCount:h?.externalRefsCount},summary:FP(u)})}return{nodes:s,edges:o}}function FP(t){let i={injectionDetected:!1,contentQuality:"clean"},e=(t.frontmatter.description??t.frontmatter.name??"").trim();return{kind:"markdown",confidence:.6,safety:i,whatItCovers:e||`${t.kind} entry`,topics:[],keyFacts:[]}}function AP(t,i,e){return`${t}:${i}::${e}`}function U_(t,i){if(t.size===0)return{next:t,dirty:!1};let e=!1,n=new Set;for(let o of t)i.has(o)?n.add(o):e=!0;return{next:e?n:t,dirty:e}}function W_(t){let{nodes:i,current:e,layout:n,edges:o}=t,r=new Set(i.map(u=>u.path)),a=!1,s=se({},e);for(let u of Object.keys(s))r.has(u)||(delete s[u],a=!0);let l=[];for(let u of r)u in s||l.push(u);if(l.length>0){if(Object.keys(s).length===0)for(let u of l){let h=n.positions.get(u);h&&(s[u]={x:h.x,y:h.y})}else{let u=G_(i,o,s,l);for(let h of l){let g=u.get(h);g&&(s[h]=g)}}a=!0}return{next:s,dirty:a}}function $_(t){let{selectedPath:i,setSelectedNodeId:e,readSelectedNodeId:n,graphNodes:o,router:r,route:a}=t,s=Jp(a.queryParamMap.pipe(Mp(l=>l.get("path"))),{initialValue:a.snapshot.queryParamMap.get("path")});ae(()=>{let l=s(),u=o();if(u.length===0||!l)return;let h=gt(()=>n());if(h!==null&&u.find(b=>b.id===h)?.view.path===l)return;let g=u.find(w=>w.view.path===l);g&&e(g.id)}),ae(()=>{let l=i(),u=gt(()=>s());(l??null)!==(u??null)&&r.navigate([],{relativeTo:a,queryParams:{path:l??null},queryParamsHandling:"merge",replaceUrl:!0})})}function K_(t,i){let n=t.frontmatter.tags;if(Array.isArray(n)&&n.includes(i))return!0;let r=t.sidecar?.annotations?.tags;return!!(Array.isArray(r)&&r.includes(i))}function X_(t){if(typeof t!="object"||t===null)return!1;let i=t;return typeof i.x=="number"&&typeof i.y=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)}function q_(t){if(typeof t!="object"||t===null)return!1;let i=t;return typeof i.x=="number"&&typeof i.y=="number"&&typeof i.scale=="number"&&Number.isFinite(i.x)&&Number.isFinite(i.y)&&Number.isFinite(i.scale)&&i.scale>0}function Y_(t){return t.querySelector(".p-overlay-mask, .p-dialog, .p-overlay")!==null}var Z_="sm.graph.viewport",Q_="sm.graph.node-positions",J_="sm.graph.node-expanded",eg="sm.graph.panel-width";function tg(){let t=null;try{t=localStorage.getItem(Z_)}catch{return null}if(!t)return null;let i;try{i=JSON.parse(t)}catch{return null}return q_(i)?i:null}function ng(t){try{localStorage.setItem(Z_,JSON.stringify(t))}catch{}}function ig(){let t=null;try{t=localStorage.getItem(Q_)}catch{return{}}if(!t)return{};let i;try{i=JSON.parse(t)}catch{return{}}if(typeof i!="object"||i===null)return{};let e={};for(let[n,o]of Object.entries(i))X_(o)&&(e[n]={x:o.x,y:o.y});return e}function xu(t){try{localStorage.setItem(Q_,JSON.stringify(t))}catch{}}function og(){let t=null;try{t=localStorage.getItem(J_)}catch{return new Set}if(!t)return new Set;let i;try{i=JSON.parse(t)}catch{return new Set}if(!Array.isArray(i))return new Set;let e=new Set;for(let n of i)typeof n=="string"&&n.length>0&&e.add(n);return e}function bu(t){try{localStorage.setItem(J_,JSON.stringify([...t]))}catch{}}function rg(){let t=null;try{t=localStorage.getItem(eg)}catch{return null}if(!t)return null;let i=Number(t);return!Number.isFinite(i)||i<=0?null:i}function ag(t){try{localStorage.setItem(eg,String(Math.round(t)))}catch{}}var sg=400,wu=400,cg=80;function dg(t){let i=W(t.initialWidth),e=W(typeof window>"u"?1920:window.innerWidth);typeof window<"u"&&kp(window,"resize").pipe(Pn(t.destroyRef)).subscribe(()=>e.set(window.innerWidth));let n=D(()=>{let g=Math.max(wu,e()-cg),w=i();return w>g||w<wu?Math.min(sg,g):w}),o=null,r=null,a=null,s=()=>{a=null,r!==null&&(i.set(r),r=null)},l=g=>{if(!o)return;let w=g.clientX-o.mouseX,b=o.widthAtStart-w,P=Math.max(wu,e()-cg);r=Math.min(P,Math.max(wu,b)),a===null&&typeof window<"u"&&(a=window.requestAnimationFrame(s))},u=()=>{o&&(o=null,document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u),a!==null&&typeof window<"u"&&(window.cancelAnimationFrame(a),a=null),r!==null&&(i.set(r),r=null),t.onCommit(i()))};return{clampedPanelWidth:n,onPanelResizeStart:g=>{g.button===0&&(g.preventDefault(),g.stopPropagation(),o={mouseX:g.clientX,widthAtStart:n()},document.addEventListener("mousemove",l),document.addEventListener("mouseup",u))}}}function lg(t){let{points:i,wrap:e,panelW:n,zoomMin:o}=t;if(i.length===0)return null;let r=1/0,a=1/0,s=-1/0,l=-1/0;for(let z of i)z.x<r&&(r=z.x),z.y<a&&(a=z.y),z.x+260>s&&(s=z.x+260),z.y+120>l&&(l=z.y+120);let u=Math.max(1,e.width-n),h=Math.max(1,s-r),g=Math.max(1,l-a),w=Math.max(1,u-160),b=Math.max(1,e.height-160),P=Math.min(w/h,b/g),T=Math.min(2,Math.max(o,P)),k=(r+s)/2,N=(a+l)/2,O=u/2-k*T,V=e.height/2-N*T;return{position:{x:O,y:V},scale:T}}function ug(t,i,e){if(typeof requestAnimationFrame>"u"||e<=0){t.writePosition(i.position),t.writeScale(i.scale);return}let n=t.readPosition(),o=t.readScale(),r=performance.now(),a=s=>{if(t.isStaleToken())return;let l=Math.min(1,(s-r)/e),u=LP(l);t.writePosition({x:n.x+(i.position.x-n.x)*u,y:n.y+(i.position.y-n.y)*u}),t.writeScale(o+(i.scale-o)*u),l<1&&requestAnimationFrame(a)};requestAnimationFrame(a)}function LP(t){return 1-Math.pow(1-t,3)}var fg=320;function pg(t){let i=W(null),e=null,n=0,o=(l,u)=>{let h=++n;ug({readPosition:()=>t.viewportPosition(),readScale:()=>t.viewportScale(),writePosition:g=>t.viewportPosition.set(g),writeScale:g=>t.viewportScale.set(g),isStaleToken:()=>h!==n},l,u)},r=l=>{let u=t.canvasWrap();if(!u||l.length===0)return;let h=t.fullLayout(),g=[];for(let b of l){let P=h.positions.get(b);P&&g.push(P)}if(g.length===0)return;let w=lg({points:g,wrap:u,panelW:t.selectedNodeId()!==null?t.clampedPanelWidth():0,zoomMin:t.zoomMin});w&&o(w,fg)},a=()=>{let l=e;l&&(e=null,o({position:l.position,scale:l.scale},fg))};return{activeTagSelection:i,onTagSelect:l=>{let u=t.flow();if(!u)return;if(i()===l){u.clearSelection(),i.set(null),a();return}let h=t.nodes().filter(g=>K_(g,l)).map(g=>g.path);if(h.length===0){u.clearSelection(),i.set(null),a();return}e===null&&(e={position:se({},t.viewportPosition()),scale:t.viewportScale()}),u.select(h,[]),i.set(l),r(h)}}}var Dp=.1,BP=4;function hg(t){let i=W(t.savedViewport?{x:t.savedViewport.x,y:t.savedViewport.y}:{x:0,y:0}),e=W(t.savedViewport?.scale??1),n=D(()=>e()<BP-1e-6),o=D(()=>e()>Dp+1e-6);return{viewportPosition:i,viewportScale:e,canZoomIn:n,canZoomOut:o,onCanvasChange:a=>{let s=i();(s.x!==a.position.x||s.y!==a.position.y)&&i.set({x:a.position.x,y:a.position.y}),e()!==a.scale&&e.set(a.scale),t.hasCompletedInitialLayout()&&ng({x:a.position.x,y:a.position.y,scale:a.scale})}}}function mg(t){let i=D(()=>{let l=new Map;for(let u of t.graph().edges)l.has(u.from)||l.set(u.from,new Set),l.has(u.to)||l.set(u.to,new Set),l.get(u.from).add(u.to),l.get(u.to).add(u.from);return l}),e=l=>t.selectedNodeId()===l,n=l=>{let u=t.selectedNodeId();return u===null||u===l?!1:i().get(u)?.has(l)??!1},o=l=>{if(t.activeTagSelection()!==null)return!1;let u=t.selectedNodeId();return u===null||u===l?!1:!(i().get(u)?.has(l)??!1)},r=l=>{let u=t.selectedNodeId();return u!==null&&(l.from===u||l.to===u)},a=l=>{if(t.activeTagSelection()!==null)return!1;let u=t.selectedNodeId();return u===null?!1:l.from!==u&&l.to!==u},s=D(()=>{let l=t.selectedNodeId(),u=t.activeTagSelection()!==null,h=l!==null?i().get(l)??null:null,g=new Map;for(let w of t.graph().nodes){let b=w.id,P=l===b,T=!P&&l!==null&&(h?.has(b)??!1),k=!u&&l!==null&&!P&&!(h?.has(b)??!1);g.set(b,{selected:P,highlighted:T,dimmed:k})}return g});return{isSelected:e,isHighlighted:n,isDimmed:o,isEdgeHighlighted:r,isEdgeDimmed:a,selectionView:s}}function _g(t){let i=t.onCommit??xu,e=null,n=!1,o=null,r=()=>{queueMicrotask(()=>{if(!n){o=null;return}n=!1,o&&(t.nodePositions.set(o),o=null),i(t.nodePositions())})},a=(u,h)=>{o||(o=se({},t.nodePositions())),o[u]={x:h.x,y:h.y},n=!0},s=u=>{e={x:u.clientX,y:u.clientY},document.addEventListener("mouseup",r,{once:!0})},l=u=>{let h=e;if(e=null,!h)return!0;let g=u.clientX-h.x,w=u.clientY-h.y;return Math.hypot(g,w)<=4};return t.destroyRef.onDestroy(()=>{document.removeEventListener("mouseup",r)}),{onNodePositionChange:a,onNodePointerDown:s,isClickWithoutDrag:l}}function gg(t){let i=W(og());return ae(()=>{let r=new Set(t.nodes().map(s=>s.path));if(r.size===0)return;let a=U_(i(),r);a.dirty&&(i.set(a.next),bu(a.next))}),{isExpanded:r=>i().has(r),setExpanded:(r,a)=>{let s=i();if(s.has(r)===a)return;let l=new Set(s);a?l.add(r):l.delete(r),i.set(l),bu(l)},resetAll:()=>{i.set(new Set),bu(new Set)}}}function yg(t){let i=!1,e=null;return ae(()=>{let n=t.visibleNodes();i||n.length!==0&&queueMicrotask(()=>{i=!0,t.savedViewport||t.canvas()?.fitToScreen({x:40,y:40},!1)})}),ae(()=>{let n=t.pathsFingerprint();if(!i){e=n;return}e!==n&&(e=n,queueMicrotask(()=>t.canvas()?.fitToScreen({x:40,y:40},!0)))}),{hasCompletedInitialLayout:()=>i}}var zP=["canvasWrap"],xg=(t,i)=>i.id;function VP(t,i){if(t&1&&(f(0,"div",2),B(1,"span",7),f(2,"p",8),_(3),p()()),t&2){let e=m();c(3),v(e.texts.loading)}}function HP(t,i){if(t&1&&(f(0,"div",3),B(1,"span",9),f(2,"p",8),_(3),p(),f(4,"p",10),_(5),p()()),t&2){let e=m();c(3),v(e.texts.errorTitle),c(2),v(e.error())}}function GP(t,i){if(t&1&&(f(0,"div",4),B(1,"span",11),f(2,"p",8),_(3),p(),f(4,"p",10),_(5),p()()),t&2){let e=m();c(3),v(e.texts.emptyTitle),c(2),v(e.texts.emptyDesc)}}function jP(t,i){if(t&1&&(f(0,"f-connection",30),Qe(),f(1,"svg",31),B(2,"circle",32),p(),Rp(),B(3,"f-connection-marker-arrow",33),p()),t&2){let e=i.$implicit,n=m(2);Le("f-conn--"+e.kind),re("f-conn--highlighted",n.isEdgeHighlighted(e))("f-conn--dimmed",n.isEdgeDimmed(e)),E("fOutputId",e.from+"-out")("fInputId",e.to+"-in")("fType",n.connectionType())("fBehavior",n.connectionBehavior)("fReassignDisabled",!0),c(),E("type",n.markerStart)("width",9)("height",9)("refX",4.5)("refY",4.5),c(2),E("type",n.markerEnd)}}function UP(t,i){if(t&1){let e=ce();Yt(0,18),f(1,"div",35),K("fNodePositionChange",function(o){let r=G(e).$implicit,a=m(3);return j(a.onNodePositionChange(r.id,o))})("pointerdown",function(o){G(e);let r=m(3);return j(r.onNodePointerDown(o))})("click",function(o){let r=G(e).$implicit,a=m(3);return j(a.selectNode(r,o))})("dblclick",function(){let o=G(e).$implicit,r=m(3);return j(r.openNode(o))}),f(2,"sm-node-card",36),K("expandedChange",function(o){let r=G(e).$implicit,a=m(3);return j(a.setExpanded(r.id,o))})("favoriteToggle",function(o){G(e);let r=m(3);return j(r.onFavoriteToggle(o))}),p(),f(3,"div",37),B(4,"sm-view-contributions-host",38),p()(),Zt()}if(t&2){let e=i.$implicit,n=m(3);c(),E("fNodeId",e.id)("fNodePosition",e.position)("fInputId",e.id+"-in")("fOutputId",e.id+"-out"),X("data-testid","graph-node-"+e.id),c(),E("node",e.view)("stats",e.stats)("summary",e.summary)("selection",n.selectionFor(e.id))("expanded",n.isExpanded(e.id))("isFavorite",e.view.isFavorite===!0),c(2),E("node",e.view)}}function WP(t,i){if(t&1&&be(0,UP,5,12,"ng-container",34),t&2){let e=m(2);E("fVirtualForOf",e.graph().nodes)}}function $P(t,i){if(t&1){let e=ce();f(0,"div",35),K("fNodePositionChange",function(o){let r=G(e).$implicit,a=m(3);return j(a.onNodePositionChange(r.id,o))})("pointerdown",function(o){G(e);let r=m(3);return j(r.onNodePointerDown(o))})("click",function(o){let r=G(e).$implicit,a=m(3);return j(a.selectNode(r,o))})("dblclick",function(){let o=G(e).$implicit,r=m(3);return j(r.openNode(o))}),f(1,"sm-node-card",36),K("expandedChange",function(o){let r=G(e).$implicit,a=m(3);return j(a.setExpanded(r.id,o))})("favoriteToggle",function(o){G(e);let r=m(3);return j(r.onFavoriteToggle(o))}),p(),f(2,"div",37),B(3,"sm-view-contributions-host",38),p()()}if(t&2){let e=i.$implicit,n=m(3);E("fNodeId",e.id)("fNodePosition",e.position)("fInputId",e.id+"-in")("fOutputId",e.id+"-out"),X("data-testid","graph-node-"+e.id),c(),E("node",e.view)("stats",e.stats)("summary",e.summary)("selection",n.selectionFor(e.id))("expanded",n.isExpanded(e.id))("isFavorite",e.view.isFavorite===!0),c(2),E("node",e.view)}}function KP(t,i){if(t&1&&(Yt(0,18),ee(1,$P,4,12,"div",39,xg),Zt()),t&2){let e=m(2);c(),te(e.graph().nodes)}}function XP(t,i){if(t&1&&B(0,"sm-perf-hud",23),t&2){let e=m(2);E("visible",e.visibleCount())("total",e.totalCount())("edges",e.edgeCount())("cacheAt",e.layoutComputedAt())}}function qP(t,i){if(t&1){let e=ce();f(0,"div",12,0),K("click",function(o){G(e);let r=m();return j(r.onCanvasClick(o))}),f(2,"f-flow",13),K("fLoaded",function(){G(e);let o=m();return j(o.onLoaded())}),B(3,"f-selection-area"),f(4,"f-background"),B(5,"f-rect-pattern"),p(),B(6,"f-line-alignment",14),f(7,"f-canvas",15),K("fCanvasChange",function(o){G(e);let r=m();return j(r.onCanvasChange(o))}),Yt(8,16),ee(9,jP,4,17,"f-connection",17,xg),Zt(),S(11,WP,1,1,"ng-container",18)(12,KP,3,0,"ng-container",18),p(),B(13,"f-minimap"),p(),f(14,"div",19),B(15,"sm-kind-palette")(16,"sm-link-kind-palette"),p(),f(17,"aside",20)(18,"div",21),K("mousedown",function(o){G(e);let r=m();return j(r.onPanelResizeStart(o))}),p(),f(19,"sm-inspector-view",22),K("close",function(){G(e);let o=m();return j(o.closePanel())})("tagSelect",function(o){G(e);let r=m();return j(r.onTagSelect(o))}),p()(),S(20,XP,1,4,"sm-perf-hud",23),f(21,"div",24)(22,"p-button",25),K("onClick",function(){G(e);let o=m();return j(o.zoomIn())}),p(),f(23,"p-button",26),K("onClick",function(){G(e);let o=m();return j(o.zoomOut())}),p(),f(24,"p-button",27),K("onClick",function(){G(e);let o=m();return j(o.fitToScreen())}),p(),B(25,"span",28),f(26,"p-button",29),K("onClick",function(){G(e);let o=m();return j(o.resetLayout())}),p()()()}if(t&2){let e=m();E("smMiddleMousePan",e.canvas()),c(2),E("fCache",e.perf.cache),c(4),E("fAlignThreshold",20),c(),E("position",e.viewportPosition())("scale",e.viewportScale())("fZoomStep",.06)("fZoomDblClickStep",.35)("debounceTime",150),c(2),te(e.graph().edges),c(2),I(e.perf.virtualization?11:12),c(6),ot("width",e.clampedPanelWidth(),"px"),re("is-open",e.selectedNodeId()!==null),X("aria-label",e.texts.a11y.panel),c(),X("aria-label",e.texts.panel.resizeLabel),c(),E("path",e.selectedPath())("activeTag",e.activeTagSelection()),c(),I(e.perfHud()?20:-1),c(),X("aria-label",e.texts.a11y.toolbar),c(),E("ariaLabel",e.texts.toolbar.zoomIn)("pTooltip",e.texts.toolbar.zoomIn)("text",!0)("rounded",!0)("disabled",!e.canZoomIn()),c(),E("ariaLabel",e.texts.toolbar.zoomOut)("pTooltip",e.texts.toolbar.zoomOut)("text",!0)("rounded",!0)("disabled",!e.canZoomOut()),c(),E("ariaLabel",e.texts.toolbar.fitToScreen)("pTooltip",e.texts.toolbar.fitToScreen)("text",!0)("rounded",!0),c(2),E("ariaLabel",e.texts.toolbar.resetLayoutLabel)("pTooltip",e.texts.toolbar.resetLayoutTooltip)("text",!0)("rounded",!0)}}var vg=.2,YP={selected:!1,highlighted:!1,dimmed:!1},Cg=class t{loader=d(Nt);filters=d(Dn);graphPreferences=d(rh);router=d(bo);route=d(Wp);confirmationService=d(wn);destroyRef=d(We);flow=Se(io);canvas=Se(no);zoom=Se(oo);canvasWrap=Se("canvasWrap");connectionType=this.graphPreferences.connectionType;connectionBehavior=At.FIXED;markerStart=fe.START_ALL_STATES;markerEnd=fe.END_ALL_STATES;perf=oi.graph.perf;perfHud=d(Kl).visible;savedViewport=tg();viewportStore=hg({savedViewport:this.savedViewport,hasCompletedInitialLayout:()=>this.layoutFit.hasCompletedInitialLayout()});viewportPosition=this.viewportStore.viewportPosition;viewportScale=this.viewportStore.viewportScale;canZoomIn=this.viewportStore.canZoomIn;canZoomOut=this.viewportStore.canZoomOut;texts=up;nodePositions=W(ig());nodeDrag=_g({destroyRef:this.destroyRef,nodePositions:this.nodePositions});expansion=gg({nodes:this.loader.nodes});panelResize=dg({destroyRef:this.destroyRef,initialWidth:rg()??400,onCommit:i=>ag(i)});clampedPanelWidth=this.panelResize.clampedPanelWidth;loading=this.loader.loading;error=this.loader.error;visibleNodes=D(()=>this.filters.apply(this.loader.nodes()));computeLayout=H_();fullLayout=D(()=>this.computeLayout(this.loader.nodes(),this.loader.scan()));graph=D(()=>{let i=new Set(this.visibleNodes().map(o=>o.path)),e=this.filters.selectedLinkKinds(),n=e.length>0?new Set(e):null;return j_(this.fullLayout(),i,this.nodePositions(),n)});hasData=D(()=>this.graph().nodes.length>0);visibleCount=D(()=>this.graph().nodes.length);totalCount=D(()=>this.loader.nodes().length);edgeCount=D(()=>this.graph().edges.length);layoutComputedAt=D(()=>this.fullLayout().computedAt);selectedNodeId=W(null);selectedPath=D(()=>{let i=this.selectedNodeId();return i?this.graph().nodes.find(n=>n.id===i)?.view.path:void 0});selectionGuard=ae(()=>{let i=this.selectedNodeId();if(i===null)return;this.graph().nodes.some(n=>n.id===i)||this.selectedNodeId.set(null)});pathsFingerprint=D(()=>this.loader.nodes().map(i=>i.path).sort().join("|"));layoutFit=yg({visibleNodes:this.visibleNodes,pathsFingerprint:this.pathsFingerprint,canvas:()=>this.canvas(),savedViewport:this.savedViewport});constructor(){$_({selectedPath:this.selectedPath,setSelectedNodeId:i=>this.selectedNodeId.set(i),readSelectedNodeId:()=>this.selectedNodeId(),graphNodes:D(()=>this.graph().nodes),router:this.router,route:this.route}),ae(()=>{let i=this.loader.nodes();if(i.length===0)return;let e=this.fullLayout(),n=W_({nodes:i,current:this.nodePositions(),layout:e,edges:e.edges});n.dirty&&(this.nodePositions.set(n.next),xu(n.next))})}ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}onLoaded(){}onCanvasChange=this.viewportStore.onCanvasChange;onNodePositionChange(i,e){this.nodeDrag.onNodePositionChange(i,e)}zoomIn(){this.zoom()?.setZoom(this.getViewportCenter(),vg,Pt.ZOOM_IN,!0)}zoomOut(){this.zoom()?.setZoom(this.getViewportCenter(),vg,Pt.ZOOM_OUT,!0)}fitToScreen(){this.canvas()?.fitToScreen({x:40,y:40},!0)}resetLayout(){let i=up.resetLayoutConfirm;this.confirmationService.confirm({header:i.header,message:i.message,icon:"pi pi-exclamation-triangle",acceptButtonProps:{label:i.accept,severity:"danger"},rejectButtonProps:{label:i.reject,severity:"secondary",outlined:!0},accept:()=>{this.nodePositions.set({}),this.expansion.resetAll(),queueMicrotask(()=>this.canvas()?.fitToScreen({x:40,y:40},!0))}})}getViewportCenter(){let i=this.canvasWrap()?.nativeElement;if(!i)return{x:0,y:0};let e=i.getBoundingClientRect();return{x:e.width/2,y:e.height/2}}onNodePointerDown(i){this.nodeDrag.onNodePointerDown(i)}selectNode(i,e){this.nodeDrag.isClickWithoutDrag(e)&&this.selectedNodeId.set(i.id)}tagSelection=pg({flow:this.flow,nodes:this.loader.nodes,fullLayout:D(()=>this.fullLayout()),canvasWrap:()=>{let i=this.canvasWrap()?.nativeElement;return i?{width:i.clientWidth,height:i.clientHeight}:null},selectedNodeId:this.selectedNodeId,clampedPanelWidth:this.clampedPanelWidth,zoomMin:Dp,viewportPosition:this.viewportPosition,viewportScale:this.viewportScale});activeTagSelection=this.tagSelection.activeTagSelection;selectionState=mg({graph:this.graph,selectedNodeId:this.selectedNodeId,activeTagSelection:this.activeTagSelection});onTagSelect(i){this.tagSelection.onTagSelect(i)}closePanel(){this.selectedNodeId.set(null)}onEscape(){this.selectedNodeId()!==null&&(typeof document<"u"&&Y_(document)||this.closePanel())}onPanelResizeStart(i){this.panelResize.onPanelResizeStart(i)}openNode(i){this.selectedNodeId.set(i.id)}onCanvasClick(i){let e=i.target;e?.closest(".sm-gnode")||e?.closest(".graph__toolbar")||e?.closest(".perf-hud")||e?.closest(".kind-palette")||e?.closest(".graph__panel")||this.selectedNodeId.set(null)}isSelected(i){return this.selectionState.isSelected(i)}isHighlighted(i){return this.selectionState.isHighlighted(i)}isDimmed(i){return this.selectionState.isDimmed(i)}selectionFor(i){return this.selectionState.selectionView().get(i)??YP}isExpanded(i){return this.expansion.isExpanded(i)}setExpanded(i,e){this.expansion.setExpanded(i,e)}onFavoriteToggle(i){this.loader.toggleFavorite(i.path,i.value)}isEdgeHighlighted(i){return this.selectionState.isEdgeHighlighted(i)}isEdgeDimmed(i){return this.selectionState.isEdgeDimmed(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=Z({type:t,selectors:[["sm-graph-view"]],viewQuery:function(e,n){e&1&&ut(n.flow,io,5)(n.canvas,no,5)(n.zoom,oo,5)(n.canvasWrap,zP,5),e&2&&it(4)},hostBindings:function(e,n){e&1&&K("keydown.escape",function(){return n.onEscape()},Fp)},features:[ge([wn])],decls:6,vars:2,consts:[["canvasWrap",""],["data-testid","graph-view",1,"graph"],["data-testid","graph-loading",1,"empty-state"],["data-testid","graph-error",1,"empty-state"],["data-testid","graph-empty",1,"empty-state"],["data-testid","graph-canvas-wrap",1,"graph__canvas-wrap",3,"smMiddleMousePan"],["styleClass","graph__confirm","maskStyleClass","graph__confirm-mask","data-testid","graph-reset-layout-confirm",3,"ariaLabel"],[1,"empty-state__icon","fa-solid","fa-spinner","fa-spin"],[1,"empty-state__title"],[1,"empty-state__icon","empty-state__icon--error","fa-solid","fa-circle-exclamation"],[1,"empty-state__desc"],[1,"empty-state__icon","fa-solid","fa-filter-circle-xmark"],["data-testid","graph-canvas-wrap",1,"graph__canvas-wrap",3,"click","smMiddleMousePan"],["fDraggable","",3,"fLoaded","fCache"],[3,"fAlignThreshold"],["fZoom","",3,"fCanvasChange","position","scale","fZoomStep","fZoomDblClickStep","debounceTime"],["ngProjectAs","[fConnections]",5,["","fConnections",""]],[3,"fOutputId","fInputId","fType","fBehavior","fReassignDisabled","class","f-conn--highlighted","f-conn--dimmed"],["ngProjectAs","[fNodes]",5,["","fNodes",""]],[1,"graph__filter-stack"],["role","complementary","data-testid","graph-panel",1,"graph__panel"],["role","separator","aria-orientation","vertical","data-testid","graph-panel-resize",1,"graph__panel-resize",3,"mousedown"],["mode","embedded",3,"close","tagSelect","path","activeTag"],[3,"visible","total","edges","cacheAt"],["role","toolbar","data-testid","graph-toolbar",1,"graph__toolbar"],["icon","pi pi-search-plus","severity","secondary","size","small","data-testid","graph-zoom-in",3,"onClick","ariaLabel","pTooltip","text","rounded","disabled"],["icon","pi pi-search-minus","severity","secondary","size","small","data-testid","graph-zoom-out",3,"onClick","ariaLabel","pTooltip","text","rounded","disabled"],["icon","pi pi-stop","severity","secondary","size","small","data-testid","graph-fit-to-screen",3,"onClick","ariaLabel","pTooltip","text","rounded"],["aria-hidden","true",1,"graph__toolbar-sep"],["icon","pi pi-history","severity","secondary","size","small","data-testid","graph-reset-layout",3,"onClick","ariaLabel","pTooltip","text","rounded"],[3,"fOutputId","fInputId","fType","fBehavior","fReassignDisabled"],["fMarker","","viewBox","0 0 9 9","markerUnits","userSpaceOnUse",1,"sm-edge-dot",3,"type","width","height","refX","refY"],["cx","4.5","cy","4.5","r","3.5"],[3,"type"],["ngProjectAs","[fNodes]",5,["","fNodes",""],4,"fVirtualFor","fVirtualForOf"],["fNode","","fDragHandle","","fNodeInput","","fNodeOutput","","fInputConnectableSide","top","fOutputConnectableSide","bottom",1,"sm-gnode-host",3,"fNodePositionChange","pointerdown","click","dblclick","fNodeId","fNodePosition","fInputId","fOutputId"],[3,"expandedChange","favoriteToggle","node","stats","summary","selection","expanded","isFavorite"],[1,"sm-gnode__marker-anchor"],["slot","graph.node.alert",3,"node"],["fNode","","fDragHandle","","fNodeInput","","fNodeOutput","","fInputConnectableSide","top","fOutputConnectableSide","bottom",1,"sm-gnode-host",3,"fNodeId","fNodePosition","fInputId","fOutputId"]],template:function(e,n){e&1&&(f(0,"section",1),S(1,VP,4,1,"div",2)(2,HP,6,2,"div",3)(3,GP,6,2,"div",4)(4,qP,27,37,"div",5),B(5,"p-confirmdialog",6),p()),e&2&&(c(),I(n.loading()&&!n.hasData()?1:n.error()&&!n.hasData()?2:n.hasData()?4:3),c(4),E("ariaLabel",n.texts.resetLayoutConfirm.header))},dependencies:[zm,io,no,Nm,km,oo,Am,Xh,qh,Rm,hm,gm,Om,Fm,Vl,pm,Lm,Em,Gl,jl,Ul,$l,cu,Tn,In,To,Io,Re,Ve,Rt,du],styles:["[_nghost-%COMP%]{display:block;height:100%}.graph[_ngcontent-%COMP%]{display:flex;flex-direction:column;height:100%}.graph__canvas-wrap[_ngcontent-%COMP%]{position:relative;flex:1;min-height:0;background:var(--sm-bg-content);overflow:hidden;--ff-connection-drag-handle-stroke: transparent;--ff-connection-drag-handle-fill: transparent;--ff-canvas-background-color: transparent}.graph__filter-stack[_ngcontent-%COMP%]{position:absolute;top:16px;left:16px;z-index:2;display:flex;flex-direction:column;gap:8px;pointer-events:none}.graph__filter-stack[_ngcontent-%COMP%] > *[_ngcontent-%COMP%]{pointer-events:auto}.graph__canvas-wrap[_ngcontent-%COMP%] f-flow[_ngcontent-%COMP%]{width:100%;height:100%}.graph__canvas-wrap[_ngcontent-%COMP%] .f-connection-drag-handle{fill:transparent;stroke:transparent}.graph__panel[_ngcontent-%COMP%]{position:absolute;top:0;right:0;bottom:0;background:var(--sm-bg-content);border-left:1px solid var(--sm-border);box-shadow:0 4px 24px #0000002e;transform:translate(100%);transition:transform .22s ease;z-index:20;pointer-events:none;overflow-y:auto}.graph__panel.is-open[_ngcontent-%COMP%]{transform:translate(0);pointer-events:auto}.graph__panel-resize[_ngcontent-%COMP%]{position:absolute;top:0;left:0;bottom:0;width:6px;cursor:ew-resize;z-index:2;background:transparent;transition:background .12s ease}.graph__panel-resize[_ngcontent-%COMP%]:hover, .graph__panel-resize[_ngcontent-%COMP%]:active{background:color-mix(in srgb,var(--p-primary-color) 30%,transparent)}.graph__toolbar[_ngcontent-%COMP%]{position:absolute;bottom:16px;left:50%;transform:translate(-50%);display:flex;align-items:center;gap:2px;padding:4px;background:var(--sm-bg-content);border:1px solid var(--sm-border);border-radius:var(--sm-radius-pill);box-shadow:var(--sm-shadow-floating);z-index:2;pointer-events:auto}.graph__toolbar-sep[_ngcontent-%COMP%]{width:1px;height:18px;margin:0 2px;background:var(--sm-border);flex-shrink:0}.sm-gnode-host[_ngcontent-%COMP%]{position:relative;display:inline-block;cursor:pointer;--ff-node-width: auto;--ff-node-min-height: 0;--ff-node-padding: 0;--ff-node-background-color: transparent;--ff-node-border-color: transparent;--ff-node-border-color-selected: transparent;--ff-node-border-radius: 0;--ff-node-shadow: none;--ff-node-shadow-selected: none}.sm-gnode-host.f-selected[_ngcontent-%COMP%]{filter:drop-shadow(0 0 6px var(--p-primary-color-300))}.sm-gnode-host.f-selected[_ngcontent-%COMP%] > .sm-gnode[_ngcontent-%COMP%]{box-shadow:0 0 0 3px var(--p-primary-color),var(--sm-shadow-card)}.f-conn--invokes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-invokes);--ff-connection-width: 1.5px;--ff-marker-color: var(--sm-edge-invokes)}.f-conn--references[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-references);--ff-connection-width: 1.25px;--ff-marker-color: var(--sm-edge-references)}.f-conn--mentions[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-mentions);--ff-connection-width: 1px;--ff-marker-color: var(--sm-edge-mentions)}.f-conn--supersedes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-supersedes);--ff-connection-width: 1.25px;--ff-marker-color: var(--sm-edge-supersedes)}.graph__canvas-wrap[_ngcontent-%COMP%] .f-conn--supersedes .f-connection-path{stroke-dasharray:none}.f-conn--highlighted[_ngcontent-%COMP%]{--ff-connection-width: 2px}.f-conn--dimmed[_ngcontent-%COMP%]{opacity:.15}.f-connection.f-selected[_ngcontent-%COMP%]{--ff-connection-width: 2.5px}.f-conn--invokes.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-invokes-active);--ff-connection-selected-color: var(--sm-edge-invokes-active);--ff-marker-color: var(--sm-edge-invokes-active)}.f-conn--references.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-references-active);--ff-connection-selected-color: var(--sm-edge-references-active);--ff-marker-color: var(--sm-edge-references-active)}.f-conn--mentions.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-mentions-active);--ff-connection-selected-color: var(--sm-edge-mentions-active);--ff-marker-color: var(--sm-edge-mentions-active)}.f-conn--supersedes.f-selected[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-supersedes-active);--ff-connection-selected-color: var(--sm-edge-supersedes-active);--ff-marker-color: var(--sm-edge-supersedes-active)}.sm-gnode__marker-anchor[_ngcontent-%COMP%]{position:absolute;top:-10px;right:-10px;z-index:4;display:inline-flex;align-items:center;gap:.25rem;pointer-events:none}"],changeDetection:0})};export{Cg as GraphView};
|