@skill-map/cli 0.17.0 → 0.18.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 +8 -0
- package/dist/cli.js +8246 -5744
- package/dist/cli.js.map +1 -1
- package/dist/conformance/index.js +36 -14
- package/dist/conformance/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +529 -61
- package/dist/index.js.map +1 -1
- package/dist/kernel/index.d.ts +418 -85
- package/dist/kernel/index.js +529 -61
- package/dist/kernel/index.js.map +1 -1
- package/dist/migrations/002_sidecar_columns.sql +53 -0
- package/dist/migrations/003_drop_node_author.sql +20 -0
- package/dist/migrations/004_sidecar_root_json.sql +23 -0
- package/dist/migrations/005_node_favorites.sql +20 -0
- package/dist/ui/chunk-3R7E3HPC.js +7 -0
- package/dist/ui/chunk-JKJGGXCS.js +1025 -0
- package/dist/ui/chunk-SX2A3WBX.js +247 -0
- package/dist/ui/{chunk-WMWULWZX.js → chunk-TWZHUCAT.js} +1 -1
- package/dist/ui/chunk-UJOZYR5I.js +1 -0
- package/dist/ui/chunk-WTAL2RK4.js +1 -0
- package/dist/ui/{chunk-LUDNWV6G.js → chunk-Z3UJHHTC.js} +38 -38
- package/dist/ui/index.html +1 -1
- package/dist/ui/main-AAYGMON4.js +1 -0
- package/migrations/002_sidecar_columns.sql +53 -0
- package/migrations/003_drop_node_author.sql +20 -0
- package/migrations/004_sidecar_root_json.sql +23 -0
- package/migrations/005_node_favorites.sql +20 -0
- package/package.json +6 -6
- package/dist/ui/chunk-5ZGVBIPP.js +0 -1031
- package/dist/ui/chunk-BWUDZKB6.js +0 -247
- package/dist/ui/main-7LR4JN4M.js +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import{b as Vh}from"./chunk-WTAL2RK4.js";import{d as vo,e as Co,f as xo,i as bo,j as wo,k as So,l as xn,m as Io,n as bn}from"./chunk-TWZHUCAT.js";import{$ as b,A as X,Aa as _u,Ab as kh,B as pe,Ba as St,C as mn,Ca as ut,Cb as Rh,D as ne,E as Se,Ea as st,Eb as ho,F as io,Fa as le,Fb as Nh,G as yh,Ga as Th,H as hu,Ha as ve,I as vh,Ia as m,J as Ch,Ja as y,K as c,Ka as Ve,L as xh,La as Qn,M as bh,Ma as Eh,N as wh,O as pu,Ob as Fh,P as oo,Pb as Ah,Q as te,Qa as Ze,Qb as gn,R as ro,Ra as Fe,Rb as po,S as Me,Sa as Y,T as Sh,Ta as De,Tb as Lh,U as ye,V as Ie,Wb as mo,Xb as Bh,Y as Z,Yb as zh,Zb as Gh,aa as w,ab as Jn,ba as me,bb as _t,ca as J,cb as E,d as C,da as ee,db as nt,dc as ei,ea as P,eb as F,ec as _o,f as Ji,fa as u,fb as ke,g as _h,ga as f,gb as co,ha as B,hb as gu,i as eo,ia as H,ib as qt,ja as j,ka as Pt,kb as Ce,l as g,la as Ut,lb as $e,lc as yn,m as to,ma as $t,mc as vn,n as ce,na as _n,o as pn,oa as so,p as d,pa as ao,q as gh,qa as de,qb as Ph,qc as Qe,r as $,ra as mu,rc as He,s as W,sa as Q,sb as Mh,sc as Cn,t as Ue,ta as p,tb as lo,tc as Xt,u as Ke,ua as Wt,ub as uo,uc as Mt,v as no,va as Te,vc as go,w as Ye,wa as Ih,wb as Dh,wc as Kt,x as rt,xb as fo,xc as Dt,y as Zn,ya as bt,za as wt,zc as yo}from"./chunk-JKJGGXCS.js";import{V as Oh}from"./chunk-3R7E3HPC.js";import{a as he,b as fu}from"./chunk-Q7L6LLAK.js";var Yt=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}},q=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)}},ti=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))}},Zt=class{constructor(i,e){this.point1=i,this.point2=e}},G=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),s=Math.max(e.x+e.width,n.x+n.width),a=Math.max(e.y+e.height,n.y+n.height);return t.initialize(o,r,s-o,a-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 Hh(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 G.initialize(t.x-o,t.y-r,e,n)}function vu(t,i){t=G.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 jh(t,i){t=G.updateIsNotFinite(t),i.setAttribute("viewBox",`${t.x} ${t.y} ${t.width} ${t.height}`)}var Ee=class t{constructor(i=0,e=0,n=0,o=0,r=0,s=0,a=0,l=0){this.x=i,this.y=e,this.width=n,this.height=o,this.radius1=r,this.radius2=s,this.radius3=a,this.radius4=l,this.gravityCenter=A.initialize(),this.gravityCenter=this.calculateGravityCenter(this)}calculateGravityCenter(i){return new q(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 w_(){return{position:A.initialize(),scaledPosition:A.initialize(),scale:1,rotate:0}}function S_(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 kt=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 S_(i)}static default(){return w_()}},Je=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}},yu=class{static parseRoundedRect(i){let e=Math.PI*.5,n=i.x,o=i.y,r=i.x+i.width,s=i.y+i.height,a=i.x+i.radius1,l=i.y+i.radius1,h=i.x+i.width-i.radius2,_=i.y+i.radius2,v=i.x+i.width-i.radius3,S=i.y+i.height-i.radius3,I=i.x+i.radius4,N=i.y+i.height-i.radius4;return[new Yt({x:a,y:l},i.radius1,i.radius1,2*e,3*e),new Zt({x:a,y:o},{x:h,y:o}),new Yt({x:h,y:_},i.radius2,i.radius2,3*e,4*e),new Zt({x:r,y:_},{x:r,y:S}),new Yt({x:v,y:S},i.radius3,i.radius3,0,e),new Zt({x:v,y:s},{x:I,y:s}),new Yt({x:I,y:N},i.radius4,i.radius4,e,2*e),new Zt({x:n,y:N},{x:n,y:l})]}},wn=class{static getRoundedRectIntersections(i,e,n){let o=yu.parseRoundedRect(n);for(let r of o)if(r instanceof Yt){let s=this.intersectArcWithLine(r,i,e);if(s.length>0)return s}else if(r instanceof Zt){let s=this.intersectLineSegments(i,e,r.point1,r.point2);if(s)return[s]}return[]}static getRoundedRectIntersectionsWithSVGPath(i,e){let n=i.getTotalLength(),o=[];for(let r=0;r<=n;r+=1){let s=i.getPointAtLength(r);o.push({x:s.x,y:s.y})}for(let r=1;r<o.length;r++){let s=this.getRoundedRectIntersections(o[r-1],o[r],e);if(s.length>0)return s}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,s=e.y-i.y,a=o.x-n.x,l=o.y-n.y,h=(-s*(i.x-n.x)+r*(i.y-n.y))/(-a*s+r*l),_=(a*(i.y-n.y)-l*(i.x-n.x))/(-a*s+r*l);return h>=0&&h<=1&&_>=0&&_<=1?{x:i.x+_*r,y:i.y+_*s}: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 s=[];for(let a of i){let l=this.normalizeAngle(Je.angle(Je.initialize(1,0),Je.initialize(a.x-n.x,a.y-n.y)));l<o&&(l+=2*Math.PI),o<=l&&l<=r&&s.push(a)}return s}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 s=Je.initialize(o.x,o.y),a=Je.fromPoints(o,r),l=Je.initialize(i.x,i.y),h=Je.subtract(s,l),_=Je.initialize(a.x/(e*e),a.y/(n*n)),v=Je.initialize(h.x/(e*e),h.y/(n*n)),S=Je.dotProduct(a,_),I=Je.dotProduct(a,v),N=Je.dotProduct(h,v)-1,D=I*I-S*N;return D<0?[]:this.calculateIntersectionPoints(D,S,I,o,r)}static calculateIntersectionPoints(i,e,n,o,r){let s=[];if(i>0){let a=Math.sqrt(i),l=(-n-a)/e,h=(-n+a)/e;l>=0&&l<=1&&s.push(A.interpolatePoints(o,r,l)),h>=0&&h<=1&&s.push(A.interpolatePoints(o,r,h))}else{let a=-n/e;a>=0&&a<=1&&s.push(A.interpolatePoints(o,r,a))}return s}};var Cu=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(Ke)}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 Cu;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=g({token:R,factory:R.\u0275fac});function x(t){return function(i){R.registerPipeline(t,i,!1)}}var I_=(()=>{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=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),T_=(()=>{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=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),E_=new ce("F_LOCAL_STORAGE",{providedIn:"root",factory:()=>uo(d(io))?d(I_):d(T_)}),P_=(()=>{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=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),M_=(()=>{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=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),D_=new ce("F_WINDOW",{providedIn:"root",factory:()=>uo(d(io))?d(P_):d(M_)}),Rt=(function(t){return t.MAC_OS="macos",t.IOS="ios",t.WINDOWS="windows",t.ANDROID="android",t.LINUX="linux",t})(Rt||{}),xu;try{xu=typeof Intl<"u"&&Intl.v8BreakIterator}catch{xu=!1}var bu=(()=>{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||xu)&&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?uo(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=Rt.MAC_OS:this.IOS?r=Rt.IOS:o.test(e)?r=Rt.WINDOWS:this.ANDROID?r=Rt.ANDROID:!r&&/linux/.test(e)&&(r=Rt.LINUX),r}static \u0275fac=function(n){return new(n||t)(pn(io))};static \u0275prov=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Pe=(()=>{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 s=parseFloat(e)/100;return Math.max(n,o)*s}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 s=this.window.innerHeight/100;return parseFloat(e)*s}else if(e.endsWith("vw")){let s=this.window.innerWidth/100;return parseFloat(e)*s}}return parseFloat(e)||0}static \u0275fac=function(n){return new(n||t)(pn(no),pn(D_),pn(E_),pn(bu))};static \u0275prov=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function wu(t,i){return t.reduce((e,n)=>[...e,...i(n)],[])}function Su(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"?Wh(t,i):(n==="input"||n==="select"||n==="textarea")&&$h(t,i),Uh("canvas",t,i,Wh),Uh("input, textarea, select",t,i,$h),i}function Uh(t,i,e,n){let o=i.querySelectorAll(t);if(o.length){let r=e.querySelectorAll(t);for(let s=0;s<o.length;s++)n(o[s],r[s])}}var k_=0;function $h(t,i){i.type!=="file"&&(i.value=t.value),i.type==="radio"&&i.name&&(i.name=`mat-clone-${i.name}-${k_++}`)}function Wh(t,i){let e=i.getContext("2d");if(e)try{e.drawImage(t,0,0)}catch{}}function Iu(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 qh(t){Iu(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 Xh(t,i,e){return R_(t,e).dataset[i]}function R_(t,i){return t.closest(i)}function Tu(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 ni(t,i){let e=N_(t,i);return!!e&&!e.classList.contains(i+"-disabled")}function N_(t,i){return t.closest(i)}function It(t){return t.match(/^[a-zA-Z_]/)||(t="_"+t),t.replace(/[^a-zA-Z0-9_\-:.]/g,"_")}function Sn(t,i,e){let n=e[t.toUpperCase()]||O_(e,t.toLowerCase());if(n===void 0)throw new Error(`Unknown ${i}: ${t}. Accepted values: ${Object.keys(e).join(", ")}`);return n}function O_(t,i){return Object.keys(t).find(e=>t[e]===i)}var F_=["markerElement"],A_=["fConnectionGradientRenderer",""],L_=["f-connection-path",""],B_=["fConnectionSelection",""],z_=["f-connection-drag-handle-start",""],G_=["f-connection-drag-handle-end",""],V_=["defs"],H_=["*"],j_=["fGroupsContainer"],U_=["fNodesContainer"],$_=["fConnectionsContainer"],W_=[[["","fGroup",""],["","fGroups",""]],[["f-snap-connection"]],[["f-connection"],["","fConnections",""]],[["f-connection-for-create"]],[["","fNode",""],["","fNodes",""]]],q_=["[fGroup], [fGroups]","f-snap-connection","f-connection, [fConnections]","f-connection-for-create","[fNode], [fNodes]"],X_=[[["svg","fMarker",""]],[["f-connection-marker-circle"],["f-connection-marker-arrow"]],[["f-connection-gradient"]],[["f-connection-waypoints"]],[["","fConnectionContent",""]]],K_=["svg[fMarker]","f-connection-marker-circle, f-connection-marker-arrow","f-connection-gradient","f-connection-waypoints","[fConnectionContent]"];function Y_(t,i){t&1&&(Ue(),B(0,"linearGradient",3)),t&2&&P("fConnectionGradientRendererFor",i)}function Z_(t,i){t&1&&(Ue(),B(0,"circle",6))}function Q_(t,i){t&1&&Te(0,4)}var J_="[_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}",eg=[[["","fDefinitions",""]],[["f-background"]],[["f-line-alignment"]],[["f-canvas"]],[["f-selection-area"]],"*"],tg=["[fDefinitions]","f-background","f-line-alignment","f-canvas","f-selection-area","*"],ku=new ce("F_BACKGROUND_PATTERN"),Za=class{fPattern;static fToken=Symbol("AddPatternToBackgroundRequest");constructor(i){this.fPattern=i}},Pn=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 Qt(t){return{name:t}}var Ru=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()}},ri=class extends Pn{kind;constructor(i){super(),this.kind=i}},Nu=class extends Pn{kind="Connection Marker"},Ou=class extends Pn{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}},Fu=class extends Pn{kind="Node"},In=class{notifyOnSubscribe;static fToken=Symbol("ListenConnectionsChangesRequest");constructor(i=!0){this.notifyOnSubscribe=i}};function ng(){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 ig(){return t=>{let i=null;return{callback:()=>{i!==null&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=null,t()})},cleanup:()=>{i!==null&&cancelAnimationFrame(i),i=null}}}}function Qa(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 at=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)}},Au=class extends at{_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}},yt=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=[],s=[];for(let v of[...this._operators].reverse()){let S=v(n);n=S.callback,S.cleanup&&o.push(S.cleanup),S.onSubscribe&&r.push(S.onSubscribe),S.setTeardown&&s.push(S.setTeardown)}let a=this._channels.map(v=>v.listen(()=>n())),l=null,h=!1,_=()=>{h||(h=!0,l?.(),l=null,a.forEach(v=>v()),o.forEach(v=>v()))};s.slice().reverse().forEach(v=>v(_)),r.slice().reverse().forEach(v=>v(n)),l=i.onDestroy(_)}};function wl(){return t=>{let i=!0;return{callback:t,onSubscribe:e=>{queueMicrotask(()=>{i&&e()})},cleanup:()=>{i=!1}}}}function Kh(){return t=>{let i=!1,e=null;return{setTeardown:n=>e=n,callback:()=>{if(!i){i=!0;try{t()}finally{e?.()}}}}}}var og=(()=>{let t=class Po{_store=d(T);handle({notifyOnSubscribe:e}){return e?new yt(this._store.connectionsChanges$).pipe(wl(),Qa(1)):new yt(this._store.connectionsChanges$).pipe(Qa(1))}static \u0275fac=function(n){return new(n||Po)};static \u0275prov=g({token:Po,factory:Po.\u0275fac})};return t=C([x(In)],t),t})(),Lu=class{static fToken=Symbol("ListenNodesChangesRequest")},rg=(()=>{let t=class Mo{_store=d(T);handle(e){return new yt(this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||Mo)};static \u0275prov=g({token:Mo,factory:Mo.\u0275fac})};return t=C([x(Lu)],t),t})(),Ja=class{static fToken=Symbol("ListenTransformChangesRequest")},sg=(()=>{let t=class Do{_store=d(T);handle(e){return new yt(this._store.transformChanges$,this._store.connectionsChanges$,this._store.nodesChanges$)}static \u0275fac=function(n){return new(n||Do)};static \u0275prov=g({token:Do,factory:Do.\u0275fac})};return t=C([x(Ja)],t),t})(),Jt=class{static fToken=Symbol("EmitConnectionsChangesRequest")},ag=(()=>{let t=class ko{_store=d(T);handle(e){this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||ko)};static \u0275prov=g({token:ko,factory:ko.\u0275fac})};return t=C([x(Jt)],t),t})(),At=class{static fToken=Symbol("NotifyTransformChangedRequest")},T=(()=>{class t{transformChanges$=new at;viewportAnimationChanges$=new at;connectionsChanges$=new at;_connectionsRevision=0;connectionsRenderedChanges$=new at;_connectionsRenderedRevision=0;_connectionsRenderedNodesRevision=0;_viewportAnimationCount=0;nodesChanges$=new at;_nodesRevision=0;progressiveRenderChanges$=new at;_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 Fu;connections=new Ou;connectionMarkers=new Nu;outputs=new ri("Output");inputs=new ri("Input");outlets=new ri("Outlet");instances=new Ru;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=g({token:t,factory:t.\u0275fac})}return t})(),xe={MAGNETIC_LINES:Qt("magnetic-lines"),MAGNETIC_RECTS:Qt("magnetic-rects"),ZOOM:Qt("zoom-controls"),BACKGROUND:Qt("background"),SELECTION_AREA:Qt("selection-area"),MINIMAP:Qt("minimap"),AUTO_PAN:Qt("auto-pan")},cg=(()=>{let t=class Ro{_store=d(T);handle(e){this._store.transformChanged()}static \u0275fac=function(n){return new(n||Ro)};static \u0275prov=g({token:Ro,factory:Ro.\u0275fac})};return t=C([x(At)],t),t})(),en=class{key;instance;static fToken=Symbol("RegisterPluginInstanceRequest");constructor(i,e){this.key=i,this.instance=e}},dg=(()=>{let t=class No{_store=d(T);handle({key:e,instance:n}){this._store.instances.add(e,n)}static \u0275fac=function(n){return new(n||No)};static \u0275prov=g({token:No,factory:No.\u0275fac})};return t=C([x(en)],t),t})(),tn=class{key;static fToken=Symbol("RemovePluginInstanceRequest");constructor(i){this.key=i}},lg=(()=>{let t=class Oo{_store=d(T);handle({key:e}){this._store.instances.remove(e)}static \u0275fac=function(n){return new(n||Oo)};static \u0275prov=g({token:Oo,factory:Oo.\u0275fac})};return t=C([x(tn)],t),t})(),ug=[T,rg,og,sg,ag,cg,dg,lg],fg=0,hg=(()=>{let t=class Fo{_store=d(T);_browser=d(Pe);get _backgroundElement(){return this._store.instances.get(xe.BACKGROUND)?.hostElement}handle(e){let n=this._getPatterns(e.fPattern?.hostElement);if(!n?.length)return;let o=En("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-"+fg++;let r=n[n.length-1].id,s=En("rect",this._browser);s.setAttribute("fill","url(#"+r+")"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),this._backgroundElement?.firstChild?.appendChild(s);let a=this._store.fCanvas?.transform||kt.default();e.fPattern?.setTransform(a)}}_getPatterns(e){return Array.from(e?.getElementsByTagName("pattern")||[])}static \u0275fac=function(n){return new(n||Fo)};static \u0275prov=g({token:Fo,factory:Fo.\u0275fac})};return t=C([x(Za)],t),t})(),si=class{fTransform;static fToken=Symbol("SetBackgroundTransformRequest");constructor(i){this.fTransform=i}},pg=(()=>{let t=class Ao{_store=d(T);handle(e){this._store.instances.get(xe.BACKGROUND)?.setTransform(e.fTransform)}static \u0275fac=function(n){return new(n||Ao)};static \u0275prov=g({token:Ao,factory:Ao.\u0275fac})};return t=C([x(si)],t),t})(),mg=[hg,pg],ec=class{instance;static fToken=Symbol("AddCanvasToStoreRequest");constructor(i){this.instance=i}},_g=(()=>{let t=class Lo{_store=d(T);handle({instance:e}){this._store.fCanvas=e}static \u0275fac=function(n){return new(n||Lo)};static \u0275prov=g({token:Lo,factory:Lo.\u0275fac})};return t=C([x(ec)],t),t})(),tc=class{id;animated;static fToken=Symbol("CenterGroupOrNodeRequest");constructor(i,e){this.id=i,this.animated=e}},gg=(()=>{let t=class Bo{_store=d(T);_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 Mn(n,nn.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 G.fromElement(e.hostElement)}_getFlowRect(){return G.fromElement(this._store.flowHost)}static \u0275fac=function(n){return new(n||Bo)};static \u0275prov=g({token:Bo,factory:Bo.\u0275fac})};return t=C([x(tc)],t),t})(),nc=class{toCenter;animated;static fToken=Symbol("FitToFlowRequest");constructor(i,e){this.toCenter=i,this.animated=e}},yg=(()=>{let t=class zo{_store=d(T);get _transform(){return this._store.transform}_mediator=d(R);handle({toCenter:e,animated:n}){let o=this._mediator.execute(new An)||G.initialize();o.width===0||o.height===0||(this.fitToParent(o,G.fromElement(this._store.flowHost),this._store.nodes.getAll().map(r=>r._position),e),this._mediator.execute(new Mn(n,nn.VIEWPORT_ONLY)))}fitToParent(e,n,o,r){this._transform.scaledPosition=A.initialize(),this._transform.position=this._getZeroPositionWithoutScale(o);let s=e.width/this._transform.scale+r.x,a=e.height/this._transform.scale+r.y;(s>n.width||a>n.height||s<n.width&&a<n.height)&&(this._transform.scale=Math.min(n.width/s,n.height/a));let l=(n.width-s*this._transform.scale)/2-this._transform.position.x*this._transform.scale,h=(n.height-a*this._transform.scale)/2-this._transform.position.y*this._transform.scale;this._transform.position=A.initialize(l+r.x/2*this._transform.scale,h+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||zo)};static \u0275prov=g({token:zo,factory:zo.\u0275fac})};return t=C([x(nc)],t),t})(),ic=class{transform;position;static fToken=Symbol("InputCanvasPositionRequest");constructor(i,e){this.transform=i,this.position=e}},vg=(()=>{let t=class Go{_store=d(T);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||Go)};static \u0275prov=g({token:Go,factory:Go.\u0275fac})};return t=C([x(ic)],t),t})(),oc=class{transform;scale;static fToken=Symbol("InputCanvasScaleRequest");constructor(i,e){this.transform=i,this.scale=e}},Cg=(()=>{let t=class Vo{_store=d(T);handle(e){!e.scale&&e.scale!==0||(e.transform.scale=e.scale,this._store.fCanvas?.redraw())}static \u0275fac=function(n){return new(n||Vo)};static \u0275prov=g({token:Vo,factory:Vo.\u0275fac})};return t=C([x(oc)],t),t})(),nn=(function(t){return t.VIEWPORT_ONLY="VIEWPORT_ONLY",t.WITH_CONNECTION_CHANGES="WITH_CONNECTION_CHANGES",t})(nn||{}),Mn=class{animated;context;static fToken=Symbol("RedrawCanvasWithAnimationRequest");constructor(i,e=nn.WITH_CONNECTION_CHANGES){this.animated=i,this.context=e}};function bp(t,i){let e=n=>{n.propertyName==="transform"&&(t.removeEventListener("transitionend",e),i(n))};t.addEventListener("transitionend",e)}var xg=(()=>{let t=class Ho{_store=d(T);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(),bp(this._canvas.hostElement,()=>{this._store.endViewportAnimation(),e===nn.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()})}_redraw(e){this._canvas?.redraw(),e===nn.WITH_CONNECTION_CHANGES&&this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Ho)};static \u0275prov=g({token:Ho,factory:Ho.\u0275fac})};return t=C([x(Mn)],t),t})(),rc=class{static fToken=Symbol("RemoveCanvasFromStoreRequest")},bg=(()=>{let t=class jo{_store=d(T);handle(e){this._store.fCanvas=void 0}static \u0275fac=function(n){return new(n||jo)};static \u0275prov=g({token:jo,factory:jo.\u0275fac})};return t=C([x(rc)],t),t})(),sc=class{static fToken=Symbol("ResetScaleRequest")},wg=(()=>{let t=class Uo{_store=d(T);get _transform(){return this._store.transform}handle(e){this._transform.scale=1,this._transform.scaledPosition=A.initialize()}static \u0275fac=function(n){return new(n||Uo)};static \u0275prov=g({token:Uo,factory:Uo.\u0275fac})};return t=C([x(sc)],t),t})(),ac=class{animated;static fToken=Symbol("ResetScaleAndCenterRequest");constructor(i){this.animated=i}},Sg=(()=>{let t=class $o{_mediator=d(R);_store=d(T);get _transform(){return this._store.transform}handle({animated:e}){let n=this._mediator.execute(new An)||G.initialize();n.width===0||n.height===0||(this._oneToOneCentering(n,G.fromElement(this._store.flowHost),this._store.nodes.getAll().map(o=>o._position)),this._mediator.execute(new Mn(e,nn.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,s=(n.height-e.height/this._transform.scale)/2-this._transform.position.y;this._transform.scale=1,this._transform.position=A.initialize(r,s)}_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||$o)};static \u0275prov=g({token:$o,factory:$o.\u0275fac})};return t=C([x(ac)],t),t})(),cc=class{scale;toPosition;static fToken=Symbol("UpdateScaleRequest");constructor(i,e){this.scale=i,this.toPosition=e}},Ig=(()=>{let t=class Wo{_store=d(T);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,s=n.y-(n.y-o.y)*e/this._transform.scale;this._transform.scale=e,this._transform.scaledPosition=A.sub(A.initialize(r,s),this._transform.position)}static \u0275fac=function(n){return new(n||Wo)};static \u0275prov=g({token:Wo,factory:Wo.\u0275fac})};return t=C([x(cc)],t),t})(),Tg=[_g,gg,yg,vg,Cg,xg,bg,wg,Sg,Ig],Bu=class{connection;static fToken=Symbol("AddConnectionForCreateToStoreRequest");constructor(i){this.connection=i}},Eg=(()=>{let t=class qo{_store=d(T);handle({connection:e}){this._store.connections.addForCreate(e)}static \u0275fac=function(n){return new(n||qo)};static \u0275prov=g({token:qo,factory:qo.\u0275fac})};return t=C([x(Bu)],t),t})(),zu=class{instance;static fToken=Symbol("AddConnectionMarkerToStoreRequest");constructor(i){this.instance=i}},Pg=(()=>{let t=class Xo{_store=d(T);handle({instance:e}){this._store.connectionMarkers.add(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Xo)};static \u0275prov=g({token:Xo,factory:Xo.\u0275fac})};return t=C([x(zu)],t),t})(),dc=class{connection;static fToken=Symbol("AddConnectionToStoreRequest");constructor(i){this.connection=i}},Mg=(()=>{let t=class Ko{_store=d(T);handle({connection:e}){this._store.connections.add(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Ko)};static \u0275prov=g({token:Ko,factory:Ko.\u0275fac})};return t=C([x(dc)],t),t})(),Gu=class{connection;static fToken=Symbol("AddSnapConnectionToStoreRequest");constructor(i){this.connection=i}},Dg=(()=>{let t=class Yo{_store=d(T);handle({connection:e}){this._store.connections.addForSnap(e)}static \u0275fac=function(n){return new(n||Yo)};static \u0275prov=g({token:Yo,factory:Yo.\u0275fac})};return t=C([x(Gu)],t),t})(),Dn=class{connection;static fToken=Symbol("CreateConnectionMarkersRequest");constructor(i){this.connection=i}},Yh=new ce("F_CONNECTION_CONTENT");var lc=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),s=new Array(o),a=0;for(let l=0;l<o;l++){let h=this.points[l+1].x-this.points[l].x,_=this.points[l+1].y-this.points[l].y,v=Math.hypot(h,_),S=v?h/v:1,I=v?_/v:0;s[l]={x:S,y:I},a+=v,r[l+1]=a}this.cumulativeLengths=r,this.segmentTangents=s,this.totalLength=a||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}},Vu=class t{_polyline;constructor(i=[]){this._polyline=new lc(i)}updatePoints(i){return this._polyline=new lc(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,a=t._clamp(i,0,1)*r,l=.5;if(a<=l)return{point:e[0],tangent:o[0]??{x:1,y:0},atEdge:!0};if(r-a<=l){let O=e.length-1;return{point:e[O],tangent:o[O-1]??{x:1,y:0},atEdge:!0}}let h=t._findRightIndex(n,a),_=Math.max(1,h),v=n[_-1],S=n[_],I=t._safeRatio(a-v,S-v),N=e[_-1],D=e[_],M={x:t._lerp(N.x,D.x,I),y:t._lerp(N.y,D.y,I)},k=o[_-1]??{x:1,y:0};return{point:M,tangent:k,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}},wp=(function(t){return t.NONE="none",t.ALONG="along",t})(wp||{}),Hu=class{compute(i,e){let n=this._clamp01(e.position()),{point:o,tangent:r}=i.getPointAtLength(n),s={x:-r.y,y:r.x},a=e.offset()??0,l=o.x+s.x*a,h=o.y+s.y*a,v=this._sizeAlongDirection(e.hostElement,r)*.5,S=n*i.totalLength,I=i.totalLength-S,N=this._applyEdgeGuard(l,h,r,S,I,v),D=this._calculateContentRotation(e.align(),r);return{position:N,rotationDeg:D}}_clamp01(i){return i<=0?0:i>=1?1:i}_applyEdgeGuard(i,e,n,o,r,s){if(o<=s){let a=s-o;return{x:i+n.x*a,y:e+n.y*a}}if(r<=s){let a=s-r;return{x:i-n.x*a,y:e-n.y*a}}return{x:i,y:e}}_sizeAlongDirection(i,e){let n=G.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===wp.ALONG&&(n=Math.atan2(e.y,e.x)*180/Math.PI,n=this._keepUpright(n)),n}},ju=class{_placement;constructor(i=new Hu){this._placement=i}layout(i,e){let n=new Vu(i),o=n.totalLength;for(let r of e){let{position:s,rotationDeg:a}=this._placement.compute(n,r);r.hostElement.style.transform=this._createTransformString(s,a)}return o}_createTransformString(i,e){return`translate3d(${i.x}px, ${i.y}px, 0) translate(-50%, -50%) rotate(${e}deg)`}};var Zh=new ce("F_CONNECTION_WAYPOINTS");function Sp(t,i,e){return(t.x-i.x)**2+(t.y-i.y)**2<=e**2}function kg(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.candidates().find(o=>Sp(i,o,n))}function Rg(t,i){let e=t.fWaypoints(),n=e?.radius()||8;return e?.waypoints().find(o=>Sp(i,o,n))}function Ng(t,i){for(let e of t){let n=Rg(e,i);if(n&&e.fWaypoints()?.visibility())return{connection:e,waypoint:n};let o=kg(e,i);if(o&&e.fWaypoints()?.visibility())return{connection:e,candidate:o}}}var Sl=new ce("F_CONNECTION_COMPONENTS_PARENT");var _e=(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})(_e||{}),Uu=new ce("F_CONNECTION_MARKER"),Og=0,$u=class{fId=X(`f-marker-${Og++}`);hostElement=d(Se).nativeElement};function Fg(t,i=_e.START){if(typeof t!="string")return i;let e=t.trim().toLowerCase();return e?Ag(e)??i:i}function Ag(t){switch(t){case"start":case"f-connection-marker-start":return _e.START;case"end":case"f-connection-marker-end":return _e.END;case"selected-start":case"f-connection-selected-marker-start":return _e.SELECTED_START;case"selected-end":case"f-connection-selected-marker-end":return _e.SELECTED_END;case"start-all-states":case"f-connection-marker-start-all-states":case"start-all":case"all-start":return _e.START_ALL_STATES;case"end-all-states":case"f-connection-marker-end-all-states":case"end-all":case"all-end":return _e.END_ALL_STATES;default:return null}}var Ip=(()=>{class t extends $u{_markerElement=ke.required("markerElement");_type=F(_e.END_ALL_STATES,{alias:"type",transform:e=>Fg(e,_e.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=te({type:t,selectors:[["f-connection-marker-arrow"]],viewQuery:function(n,o){n&1&&St(o._markerElement,F_,5),n&2&&ut()},hostAttrs:[1,"f-component",2,"display","none"],inputs:{_type:[1,"type","_type"]},features:[De([{provide:Uu,useExisting:t}]),ye],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&&(Ue(),H(0,"svg",1,0),Pt(2,"path",2),j())},encapsulation:2})}return t})();var Ot=(function(t){return t.FIXED="fixed",t.FIXED_CENTER="fixed_center",t.FLOATING="floating",t})(Ot||{}),We=(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})(We||{});function Lg({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||{}),Nt=(function(t){return t.SEGMENT="segment",t.STRAIGHT="straight",t.BEZIER="bezier",t.ADAPTIVE_CURVE="adaptive-curve",t})(Nt||{});function Bg({sourceRect:t,sourceConnectableSide:i,targetRect:e,targetConnectableSide:n}){return{point1:Qh(t,i===L.AUTO?L.BOTTOM:i),point2:Qh(e,n===L.AUTO?L.TOP:n)}}function Qh(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 Tp(t,i,e,n){if(!n||!n.rotationDeg)return wn.getRoundedRectIntersections(t,i,e)[0];let o=Zo(t,-n.rotationDeg,n.pivot),r=Zo(i,-n.rotationDeg,n.pivot),s=zg(e,-n.rotationDeg,n.pivot),a=wn.getRoundedRectIntersections(o,r,s)[0];return a?Zo(a,n.rotationDeg,n.pivot):void 0}function zg(t,i,e){let n=Zo(Gg(t),i,e);return new Ee(n.x-t.width/2,n.y-t.height/2,t.width,t.height,t.radius1,t.radius2,t.radius3,t.radius4)}function Gg(t){return{x:t.x+t.width/2,y:t.y+t.height/2}}function Zo(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,s=Math.cos(r),a=Math.sin(r);return{x:n*s-o*a+e.x,y:n*a+o*s+e.y}}function Vg({sourceRect:t,targetRect:i,sourceRotationContext:e,targetRotationContext:n}){return Ug(Hg(t,i,e),jg(t,i,n),t,i)}function Hg(t,i,e){return Tp(t.gravityCenter,i.gravityCenter,t,e)}function jg(t,i,e){return Tp(i.gravityCenter,t.gravityCenter,i,e)}function Ug(t,i,e,n){return{point1:t||e.gravityCenter,point2:i||n.gravityCenter}}var To=.5,$g={[Ot.FLOATING]:Vg,[Ot.FIXED_CENTER]:Lg,[Ot.FIXED]:Bg},Hn=(()=>{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 s=o-e,a=r-n;return{sourceToTargetX:s,sourceToTargetY:a,targetToSourceX:-s,targetToSourceY:-a}}_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===We.DEFAULT)return r;let s=Math.abs(n),a=Math.abs(o);if(s<To&&a<To)return r;let h=s>=a;switch(e){case We.CALCULATE:return h?n>=0?L.RIGHT:L.LEFT:o>=0?L.BOTTOM:L.TOP;case We.CALCULATE_HORIZONTAL:return s<To?r:n>=0?L.RIGHT:L.LEFT;case We.CALCULATE_VERTICAL:return a<To?r:o>=0?L.BOTTOM:L.TOP;case We.TOP:return L.TOP;case We.BOTTOM:return L.BOTTOM;case We.LEFT:return L.LEFT;case We.RIGHT:return L.RIGHT;default:return r}}_getBehaviorHandler(e){let n=$g[e];if(!n)throw new Error(`[Behavior] No handler for behavior: ${e}`);return n}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),pt=class{sourceRect;targetRect;connection;sourceConnectableSide;targetConnectableSide;sourceRotationContext;targetRotationContext;constructor(i,e,n,o,r,s,a){this.sourceRect=i,this.targetRect=e,this.connection=n,this.sourceConnectableSide=o,this.targetConnectableSide=r,this.sourceRotationContext=s,this.targetRotationContext=a}};function Il(t,i,e){return[t,...e??[],i]}function Wg(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 qg(t,i=32){let e=new Array(i+1);e[0]=he({},t[0]);for(let n=1;n<=i;n++)e[n]=Ep(t[0],t[1],t[2],t[3],n/i);return e}function Ep(t,i,e,n,o){let r=1-o,s=o*o,a=r*r,l=a*r,h=s*o;return{x:l*t.x+3*a*o*i.x+3*r*s*e.x+h*n.x,y:l*t.y+3*a*o*i.y+3*r*s*e.y+h*n.y}}function Pp(t){return t.map(i=>Ep(i.p0,i.c1,i.c2,i.p3,.5))}function Xg(t){if(t.length<2)throw new Error("Polylines must be at least two points");let i=Kg(t);return i<=0?[he({},t[0])]:[Yg(t,i/2)]}function Kg(t){let i=0;for(let e=0;e<t.length-1;e++)i+=Mp(t[e],t[e+1]);return i}function Yg(t,i){let e=0;for(let o=0;o<t.length-1;o++){let r=t[o],s=t[o+1],a=Mp(r,s);if(!(a<=0)){if(e+a>=i){let l=(i-e)/a;return{x:r.x+(s.x-r.x)*l,y:r.y+(s.y-r.y)*l}}e+=a}}let n=t[t.length-1];return{x:n.x,y:n.y}}function Mp(t,i){return Math.hypot(i.x-t.x,i.y-t.y)}function Zg(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 Dp(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,s=o?n.p3.y+2e-4:n.p3.y;i+=` C ${n.c1.x} ${n.c1.y}, ${n.c2.x} ${n.c2.y}, ${r} ${s}`}return i}function kp(t,i=16){if(!t.length)return[];let e=[];for(let n=0;n<t.length;n++){let o=t[n],r=qg([o.p0,o.c1,o.c2,o.p3],i);n>0&&r.shift(),e.push(...r)}return e}function Qg(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 s=t[r],a=n[n.length-1];(Math.abs(s.x-a.x)>i||Math.abs(s.y-a.y)>i)&&n.push(s)}if(n.length<=2)return n;let o=[];o.push(n[0]);for(let r=1;r<n.length-1;r++){let s=o[o.length-1],a=n[r],l=n[r+1],h=Math.abs(s.x-a.x)<=i&&Math.abs(a.x-l.x)<=i,_=Math.abs(s.y-a.y)<=i&&Math.abs(a.y-l.y)<=i;!h&&!_&&o.push(a)}return o.push(n[n.length-1]),o}var Wu=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),s=Math.abs(e.y-i.y),a=Math.hypot(r,s),l=n===L.AUTO?Math.max(r,s):this._isHorizontal(n)?r:s,h=Math.max(8,o),_=o+.5*a,v=o*1.05+l*.3;return Math.min(_,Math.max(h,v))}static _softControl(i,e,n,o){let r=this._dir(i),s=n.x-e.x,a=n.y-e.y,l=Math.hypot(s,a)||1,h=s/l,_=a/l;if(i===L.AUTO)return{x:e.x+h*o,y:e.y+_*o};let v=r.x*h+r.y*_,S=.12,I=Math.max(0,-v)*.08,N=Math.min(.2,S+I),D=r.x*(1-N)+h*N,M=r.y*(1-N)+_*N,k=Math.hypot(D,M)||1;return{x:e.x+D/k*o,y:e.y+M/k*o}}handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:s}){let a=Math.max(0,r??0),l=Il(i,n,s),h=[];for(let v=0;v<l.length-1;v++){let S=l[v],I=l[v+1],N=t._handleLength(S,I,e,a),D=t._handleLength(I,S,o,a),M=t._softControl(e,S,I,N),k=t._softControl(o,I,S,D);h.push({p0:S,c1:M,c2:k,p3:I,chainIndex:v})}let _=kp(h,12);return{path:Dp(h),secondPoint:h[0]?.c1??i,penultimatePoint:h[h.length-1]?.c2??n,points:_,candidates:Pp(h)}}},qu=class{handle({source:i,sourceSide:e,target:n,targetSide:o,offset:r,waypoints:s}){let a=Il(i,n,s),l=[];for(let _=0;_<a.length-1;_++){let v=a[_],S=a[_+1],I=Jh(e,v,S,r??0),N=Jh(o,S,v,r??0);l.push({p0:v,c1:I,c2:N,p3:S,chainIndex:_})}let h=kp(l,12);return{path:Dp(l),secondPoint:l[0]?.c1??i,penultimatePoint:l[l.length-1]?.c2??n,points:h,candidates:Pp(l)}}};function Jh(t,i,e,n){let o={x:i.x,y:i.y};switch(t){case L.LEFT:o.x-=Eo(i.x-e.x,n);break;case L.RIGHT:o.x+=Eo(e.x-i.x,n);break;case L.TOP:o.y-=Eo(i.y-e.y,n);break;case L.BOTTOM:o.y+=Eo(e.y-i.y,n);break;case L.AUTO:break}return o}function Eo(t,i){return t>=i?t:i*Math.sqrt(i-t)}function Jg(t){let{axis:i,source:e,target:n,sourceSide:o,targetSide:r,sourceGap:s,targetGap:a,sourceDir:l,targetDir:h,currentDir:_,offset:v,sourceGapOffset:S,targetGapOffset:I}=t,N=e0(s,a),D=t0(i,l,_,N);return o===r?n0(i,e,n,v,l,_,s,a,S,I):D=i0(i,l,h,s,a,N,D),D}function e0(t,i){return{sourceTarget:[{x:t.x,y:i.y}],targetSource:[{x:i.x,y:t.y}]}}function t0(t,i,e,n){return t==="x"?i.x===e?n.targetSource:n.sourceTarget:i.y===e?n.sourceTarget:n.targetSource}function n0(t,i,e,n,o,r,s,a,l,h){let _=Math.abs(i[t]-e[t]);if(_>n)return;let v=Math.min(n-1,n-_);v<=0||(o[t]===r?l[t]=(s[t]>i[t]?-1:1)*v:h[t]=(a[t]>e[t]?-1:1)*v)}function i0(t,i,e,n,o,r,s){let a=t==="x"?"y":"x",l=i[t]===e[a],h=n[a]>o[a],_=n[a]<o[a];return i[t]===1&&(!l&&h||l&&_)||i[t]!==1&&(!l&&_||l&&h)?t==="x"?r.sourceTarget:r.targetSource:s}var ii=1e-6,ep=2e-4,o0=.75;function r0(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(s0(t[r-1],t[r],t[r+1],i));let o=t[e-1];return n.push(`L ${o.x+ep} ${o.y+ep}`),n.join(" ")}function s0(t,i,e,n){let o=i.x,r=i.y;if(n<=0)return`L ${o} ${r}`;let s=Math.abs(t.x-o)<=ii&&Math.abs(o-e.x)<=ii,a=Math.abs(t.y-r)<=ii&&Math.abs(r-e.y)<=ii;if(s||a)return`L ${o} ${r}`;let l=Math.hypot(o-t.x,r-t.y),h=Math.hypot(e.x-o,e.y-r),_=Math.min(l*.5,h*.5,n);if(_<o0)return`L ${o} ${r}`;if(Math.abs(t.y-r)<=ii){let M=t.x<e.x?-1:1,k=t.y<e.y?1:-1,O=o+_*M,z=r+_*k;return`L ${O} ${r} Q ${o} ${r} ${o} ${z}`}let S=t.x<e.x?1:-1,I=t.y<e.y?-1:1,N=r+_*I,D=o+_*S;return`L ${o} ${N} Q ${o} ${r} ${D} ${r}`}var tp={[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)},Xu=class{handle({source:i,sourceSide:e,target:n,targetSide:o,waypoints:r,offset:s,radius:a}){let l=Il(i,n,r),h=[],_=[];for(let N=0;N<l.length-1;N++){let D=l[N],M=l[N+1],k=this._getPathPoints(D,e,M,o,s??0);h.push(k),_.push(...Xg(k))}let v=Qg(Zg(h)),S=v.length>1?v[v.length-2]:i,I=v.length>1?v[1]:n;return{path:r0(v,a??0),penultimatePoint:S,secondPoint:I,points:v,candidates:_}}_getPathPoints(i,e,n,o,r){let s=tp[e],a=tp[o],l={x:i.x+s.x*r,y:i.y+s.y*r},h={x:n.x+a.x*r,y:n.y+a.y*r},_=this._getDirection(l,e,h),v=_.x!==0?"x":"y",S=_[v],I=[],N=A.initialize(),D=A.initialize(),M=Wg(i,n);if(s[v]*a[v]===-1){let k=[{x:M.x,y:l.y},{x:M.x,y:h.y}],O=[{x:l.x,y:M.y},{x:h.x,y:M.y}];s[v]===S?I=v==="x"?k:O:I=v==="x"?O:k}else I=Jg({axis:v,source:i,target:n,sourceSide:e,targetSide:o,sourceGap:l,targetGap:h,sourceDir:s,targetDir:a,currentDir:S,offset:r,sourceGapOffset:N,targetGapOffset:D});return[i,{x:l.x+N.x,y:l.y+N.y},...I,{x:h.x+D.x,y:h.y+D.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)}},np=2e-4,Ku=class{handle(i){let e=Il(i.source,i.target,i.waypoints),n=e.length,o=e[0],r=`M ${o.x} ${o.y}`,s=new Array(n-1);for(let a=0;a<n-1;a++){let l=e[a],h=e[a+1],_=a===n-2,v=_?h.x+np:h.x,S=_?h.y+np:h.y;r+=` L ${v} ${S}`,s[a]={x:(l.x+h.x)*.5,y:(l.y+h.y)*.5}}return{path:r,candidates:s,points:e,secondPoint:e[1]??i.target,penultimatePoint:e[n-2]??i.source}}},a0=new ce("F_CONNECTION_BUILDERS"),Rp=(()=>{class t{_builtinBuilders={[Nt.STRAIGHT]:new Ku,[Nt.BEZIER]:new qu,[Nt.ADAPTIVE_CURVE]:new Wu,[Nt.SEGMENT]:new Xu};_providedBuilders;_builders;constructor(){this._providedBuilders=d(a0,{optional:!0})||{},this._builders=he(he({},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(),s=n.filter(l=>l in this._providedBuilders).sort(),a=[`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)"}`,s.length?`Overridden built-ins: ${s.join(", ")}`:null,"Tip: ensure you pass a valid Connection Type or provide a builder via F_CONNECTION_BUILDERS."].filter(Boolean);return new Error(a.join(`
|
|
2
|
+
`))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})();function c0(t,i,e){return It("connection_"+t+i+e)}function d0(t,i,e){return It("connection_for_selection_"+t+i+e)}function Np(t){return It("connection_gradient_"+t)}function l0(t){return`url(#${Np(t)})`}var u0=(()=>{class t{_connection=d(Sl);_hostElement=d(Se).nativeElement;_injector=d(Ke);_hostAttributes=new Map;_startColor;_endColor;gradientId=E(()=>Np(this._connection.fId()));ngOnInit(){this._listenColorChanges()}_listenColorChanges(){pe(()=>{this.gradient().fStartColor(),this.gradient().fEndColor(),_t(()=>{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,s=new q(.5-.5*n/r,.5-.5*o/r);this._setHostAttribute("x1",s.x.toString()),this._setHostAttribute("y1",s.y.toString());let a=new q(.5+.5*n/r,.5+.5*o/r);this._setHostAttribute("x2",a.x.toString()),this._setHostAttribute("y2",a.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=Me({type:t,standalone:!1})}return t})(),Yu=(()=>{class t extends u0{gradient=F.required({alias:"fConnectionGradientRendererFor"});static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["linearGradient","fConnectionGradientRenderer",""]],hostVars:1,hostBindings:function(n,o){n&2&&Z("id",o.gradientId())},inputs:{gradient:[1,"fConnectionGradientRendererFor","gradient"]},features:[ye],attrs:A_,decls:3,vars:0,consts:[[0,"xmlns","svg","http://www.w3.org/2000/svg"],["offset","0%"],["offset","100%"]],template:function(n,o){n&1&&(so(0,0),Ue(),Pt(1,"stop",1)(2,"stop",2),ao())},encapsulation:2,changeDetection:0})}return t})(),ip=new ce("F_CONNECTION_GRADIENT");var Zu=new ce("F_CONNECTION_PATH"),Qu=class{hostElement=d(Se).nativeElement},f0=(()=>{class t extends Qu{_connection=d(Sl);useGradient=F(!1);linkToGradient=E(()=>this.useGradient()?l0(this._connection.fId()):null);get fPathId(){return this._connection.fId()}get attrConnectionId(){return c0(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(#${m0(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${_0(this._connection.fId())})`)}deselect(){this.hostElement.setAttribute("marker-start",`url(#${h0(this._connection.fId())})`),this.hostElement.setAttribute("marker-end",`url(#${p0(this._connection.fId())})`)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["path","f-connection-path",""]],hostAttrs:[1,"f-component","f-connection-path"],hostVars:4,hostBindings:function(n,o){n&2&&(Z("id",o.attrConnectionId)("data-f-path-id",o.fPathId),st("stroke",o.linkToGradient()))},inputs:{useGradient:[1,"useGradient"]},standalone:!1,features:[De([{provide:Zu,useExisting:t}]),ye],attrs:L_,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})();function h0(t){return It(`f-connection-marker-start-${t}`)}function p0(t){return It(`f-connection-marker-end-${t}`)}function m0(t){return It(`f-connection-selected-marker-start-${t}`)}function _0(t){return It(`f-connection-selected-marker-end-${t}`)}var Ju=new ce("F_CONNECTION_SELECTION"),ef=class{hostElement=d(Se).nativeElement},g0=(()=>{class t extends ef{_connection=d(Sl);get connectionForSelectionId(){return d0(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=te({type:t,selectors:[["path","fConnectionSelection",""]],hostAttrs:[1,"f-component","f-connection-selection"],hostVars:1,hostBindings:function(n,o){n&2&&Z("id",o.connectionForSelectionId)},standalone:!1,features:[De([{provide:Ju,useExisting:t}]),ye],attrs:B_,decls:0,vars:0,template:function(n,o){},styles:["[_nghost-%COMP%]{fill:none;pointer-events:stroke}"],changeDetection:0})}return t})(),tf=new ce("F_CONNECTION_DRAG_HANDLE_END"),nf=new ce("F_CONNECTION_DRAG_HANDLE_START"),uc=class{hostElement=d(Se).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,s={x:o.x/r,y:o.y/r},a={x:s.x*n,y:s.y*n};return{x:e.x-a.x,y:e.y-a.y}}},y0=(()=>{class t extends uc{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=te({type:t,selectors:[["circle","f-connection-drag-handle-start",""]],hostVars:2,hostBindings:function(n,o){n&2&&ve(o.class)},standalone:!1,features:[De([{provide:nf,useExisting:t}]),ye],attrs:z_,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),v0=(()=>{class t extends uc{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=te({type:t,selectors:[["circle","f-connection-drag-handle-end",""]],hostVars:2,hostBindings:function(n,o){n&2&&ve(o.class)},standalone:!1,features:[De([{provide:tf,useExisting:t}]),ye],attrs:G_,decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})(),Eu="f-selected";function Op(t){return class extends t{fId=X("");fSelectionDisabled=X(!1);unmarkAsSelected(){this.unmarkChildrenAsSelected?.(),this.hostElement.classList.remove(Eu)}markAsSelected(){this.markChildrenAsSelected?.(),this.isSelected()||this.hostElement.classList.add(Eu)}isSelected(){return this.hostElement.classList.contains(Eu)}markChildrenAsSelected(){}unmarkChildrenAsSelected(){}constructor(...i){super(...i)}}}function C0(t){return class extends t{show(){this.hostElement.style.display="unset"}hide(){this.hostElement.style.display="none"}constructor(...i){super(...i)}}}var x0=Op(C0(class{hostElement;constructor(t){this.hostElement=t}})),b0=(()=>{class t extends x0{_fConnectionBuilder=d(Rp);path="";line=ti.initialize();fReassignableStart=X(!1);fDraggingDisabled=X(!1);fSelectionDisabled=X(!1);fDefs=ke.required("defs");fPath=ke.required(Zu);fDragHandleStart=ke(nf);fDragHandleEnd=ke.required(tf);fSelection=ke.required(Ju);fContents=gu(Yh,{descendants:!0});fMarkers=gu(Uu,{descendants:!0});fGradient=co(ip);_fGradientRenderer=ke(Yu);fWaypoints=co(Zh);fInputSide=X(We.DEFAULT);_contentLayoutEngine=new ju;_sourceSide=L.AUTO;fOutputSide=X(We.DEFAULT);_targetSide=L.AUTO;_penultimatePoint=A.initialize();_secondPoint=A.initialize();constructor(){super(d(Se).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=ti.initialize(e,n);let{path:o,points:r,penultimatePoint:s,secondPoint:a,candidates:l}=this._getPathResult(e,n);this.path=o,this._penultimatePoint=s||e,this._secondPoint=a||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=Me({type:t,contentQueries:function(n,o,r){n&1&&_u(r,o.fContents,Yh,5)(r,o.fMarkers,Uu,5)(r,o.fGradient,ip,5)(r,o.fWaypoints,Zh,5),n&2&&ut(4)},viewQuery:function(n,o){n&1&&St(o.fDefs,V_,5)(o.fPath,Zu,5)(o.fDragHandleStart,nf,5)(o.fDragHandleEnd,tf,5)(o.fSelection,Ju,5)(o._fGradientRenderer,Yu,5),n&2&&ut(6)},standalone:!1,features:[ye]})}return t})(),w0=(()=>{let t=class Qo{_browser=d(Pe);_markerCache=new WeakMap;handle({connection:e}){let n=this._findConnectionMarkers(e),o=e.fDefs();if(!o)return!1;let r=S0(n),s=this._markerCache.get(e);if(s?.signature===r&&s.defsElement===o.nativeElement)return!1;let a=Ap("defs",this._browser);return n.forEach(l=>{Fp(l.type).forEach(h=>{let _=I0(h,l,e.fId(),this._browser),v=l.markerElement.cloneNode(!0);v.setAttribute("height",`${l.height}`),v.setAttribute("width",`${l.width}`),v.removeAttribute("markerUnits"),v.style.display="unset",_.append(v),a.append(_)})}),o.nativeElement.innerHTML=a.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||Qo)};static \u0275prov=g({token:Qo,factory:Qo.\u0275fac})};return t=C([x(Dn)],t),t})();function S0(t){return t.map(i=>[...Fp(i.type),i.width,i.height,i.refX,i.refY,i.orient,i.markerUnits,i.markerElement.outerHTML].join("|")).join("||")}function I0(t,i,e,n){let o=Ap("marker",n);return o.setAttribute("id",It(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 Fp(t){switch(t){case _e.START:return[_e.START];case _e.END:return[_e.END];case _e.SELECTED_START:return[_e.SELECTED_START];case _e.SELECTED_END:return[_e.SELECTED_END];case _e.START_ALL_STATES:return[_e.START,_e.SELECTED_START];case _e.END_ALL_STATES:return[_e.END,_e.SELECTED_END];default:return[]}}function Ap(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}var Tl=(()=>{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=g({token:t,factory:t.\u0275fac})}return t})(),T0=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 Lp(t){return!!Bp(t)}function Bp(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 E0(t){let i=new t.blobCtor([T0],{type:"text/javascript"});return t.urlApi.createObjectURL(i)}function zp(t,i){if(!t)return;let e=i??(typeof URL>"u"?null:URL);typeof e?.revokeObjectURL=="function"&&e.revokeObjectURL(t)}var un=(()=>{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,zp(this.workerUrl),this.workerUrl=null}dispose(){this.resetRuntime(new Error("Connection worker was destroyed."))}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),fc=class{connection;line;static fToken=Symbol("ApplyConnectionRenderRequest");constructor(i,e){this.connection=i,this.line=e}},P0=(()=>{let t=class Jo{_mediator=d(R);_renderCache=new WeakMap;handle({connection:e,line:n}){!this._mediator.execute(new Dn(e))&&!this._shouldRender(e,n)||(e.setLine(n),e.initialize())}_shouldRender(e,n){let o=e.fPath().hostElement,r=this._createConnectionRenderSignature(e,n),s=this._renderCache.get(e);return s?.signature===r&&s.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||Jo)};static \u0275prov=g({token:Jo,factory:Jo.\u0275fac})};return t=C([x(fc)],t),t})(),hc=class{source;target;static fToken=Symbol("MarkConnectionConnectorsAsConnectedRequest");constructor(i,e){this.source=i,this.target=e}},M0=(()=>{let t=class er{_state=d(Tl);handle({source:e,target:n}){e.setConnected(n),n.setConnected(e),this._state.trackConnectedConnectors(e,n)}static \u0275fac=function(n){return new(n||er)};static \u0275prov=g({token:er,factory:er.\u0275fac})};return t=C([x(hc)],t),t})(),Lt=class{element;cache;static fToken=Symbol("GetNormalizedConnectorRectRequest");constructor(i,e=!0){this.element=i,this.cache=e}},D0={enabled:!1},vt=new ce("F_CACHE_OPTIONS",{providedIn:"root",factory:()=>he({},D0)});var pc=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}},Ct=(()=>{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=g({token:t,factory:t.\u0275fac})}return t})(),of=class{key;id;kind;nodeId;element;rect;constructor(i,e,n,o,r,s){this.key=i,this.id=e,this.kind=n,this.nodeId=o,this.element=r,this.rect=s}},ai=class{static build(i,e){return`${i}:${e}`}},rf=class{id;element;reference;rect;constructor(i,e,n,o){this.id=i,this.element=e,this.reference=n,this.rect=o}},kn=class{nodeId;reason;static fToken=Symbol("InvalidateFCacheNodeRequest");constructor(i,e="manual"){this.nodeId=i,this.reason=e}},k0=(()=>{let t=class tr{_store=d(Ct);_options=d(vt);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 s of r){let a=this._store.connectorEntries.get(s);a&&(a.rect=void 0)}}static \u0275fac=function(n){return new(n||tr)};static \u0275prov=g({token:tr,factory:tr.\u0275fac})};return t=C([x(kn)],t),t})(),mc=class{id;element;reference;static fToken=Symbol("RegisterFCacheNodeRequest");constructor(i,e,n){this.id=i,this.element=e,this.reference=n}},R0=(()=>{let t=class nr{_store=d(Ct);_options=d(vt);handle({id:e,element:n,reference:o}){if(!this._options.enabled)return;let r=new rf(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||nr)};static \u0275prov=g({token:nr,factory:nr.\u0275fac})};return t=C([x(mc)],t),t})(),_c=class{id;static fToken=Symbol("UnregisterFCacheNodeRequest");constructor(i){this.id=i}},N0=(()=>{let t=class ir{_store=d(Ct);_mediator=d(R);_options=d(vt);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 s=this._store.connectorEntries.get(r);s&&this._mediator.execute(new ci(s.id,s.kind))}this._store.connectorKeysByNodeId.delete(e)}static \u0275fac=function(n){return new(n||ir)};static \u0275prov=g({token:ir,factory:ir.\u0275fac})};return t=C([x(_c)],t),t})(),O0=(()=>{let t=class or{_store=d(Ct);_mediator=d(R);_options=d(vt);handle({id:e,nodeId:n,kind:o,element:r}){if(!this._options.enabled)return;let s=ai.build(e,o),a=this._store.connectorEntries.get(s);a&&(this._detachConnectorFromNode(a.key,a.nodeId),this._store.connectorKeyByElement.delete(a.element));let l=new of(s,e,o,n,r);this._store.connectorEntries.set(s,l),this._store.connectorKeyByElement.set(r,s);let h=this._store.connectorKeysByNodeId.get(n)??new Set;h.add(s),this._store.connectorKeysByNodeId.set(n,h),this._mediator.execute(new kn(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||or)};static \u0275prov=g({token:or,factory:or.\u0275fac})};return t=C([x(pc)],t),t})(),ci=class{connectorId;kind;static fToken=Symbol("UnregisterFCacheConnectorRequest");constructor(i,e){this.connectorId=i,this.kind=e}},F0=(()=>{let t=class rr{_store=d(Ct);_mediator=d(R);_options=d(vt);handle({connectorId:e,kind:n}){if(!this._options.enabled)return;let o=ai.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 kn(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||rr)};static \u0275prov=g({token:rr,factory:rr.\u0275fac})};return t=C([x(ci)],t),t})(),Rn=class{element;static fToken=Symbol("GetCachedFCacheRectRequest");constructor(i){this.element=i}},A0=(()=>{let t=class sr{_store=d(Ct);_options=d(vt);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||sr)};static \u0275prov=g({token:sr,factory:sr.\u0275fac})};return t=C([x(Rn)],t),t})(),on=class{connectorId;kind;rect;static fToken=Symbol("SetFCacheConnectorRectRequest");constructor(i,e,n){this.connectorId=i,this.kind=e,this.rect=n}},L0=(()=>{let t=class ar{_store=d(Ct);_options=d(vt);handle({connectorId:e,kind:n,rect:o}){if(!this._options.enabled)return;let r=ai.build(e,n),s=this._store.connectorEntries.get(r);s&&(s.rect=Ee.fromRoundedRect(o))}static \u0275fac=function(n){return new(n||ar)};static \u0275prov=g({token:ar,factory:ar.\u0275fac})};return t=C([x(on)],t),t})(),rn=class{nodeId;rect;static fToken=Symbol("SetFCacheNodeRectRequest");constructor(i,e){this.nodeId=i,this.rect=e}},B0=(()=>{let t=class cr{_store=d(Ct);_options=d(vt);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=G.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 s=o.x-n.x,a=o.y-n.y,l=n.width!==0,h=n.height!==0,_=l?o.width/n.width:1,v=h?o.height/n.height:1;for(let S of r){let I=this._store.connectorEntries.get(S);if(!I?.rect)continue;let N=I.rect,D=N.gravityCenter,M=l?o.x+(D.x-n.x)*_:D.x+s,k=h?o.y+(D.y-n.y)*v:D.y+a;I.rect=new Ee(M-N.width/2,k-N.height/2,N.width,N.height,N.radius1,N.radius2,N.radius3,N.radius4)}}static \u0275fac=function(n){return new(n||cr)};static \u0275prov=g({token:cr,factory:cr.\u0275fac})};return t=C([x(rn)],t),t})(),di=class{element;rect;static fToken=Symbol("UpdateFCacheRectByElementRequest");constructor(i,e){this.element=i,this.rect=e}},z0=(()=>{let t=class dr{_store=d(Ct);_options=d(vt);handle({element:e,rect:n}){if(!this._options.enabled)return;let o=this._store.nodeIdByElement.get(e);if(o){let a=this._store.nodeEntries.get(o);a&&(a.rect=n);return}let r=this._store.connectorKeyByElement.get(e);if(!r)return;let s=this._store.connectorEntries.get(r);s&&(s.rect=n)}static \u0275fac=function(n){return new(n||dr)};static \u0275prov=g({token:dr,factory:dr.\u0275fac})};return t=C([x(di)],t),t})(),G0=[Ct,R0,N0,k0,O0,F0,A0,B0,L0,z0];function jn(t,i,e){return i?q.fromPoint(t).elementTransform(i).sub(e.scaledPosition).sub(e.position).div(e.scale):q.fromPoint(t)}function Gp(){return{min:{x:-1/0,y:-1/0},max:{x:1/0,y:1/0}}}function Nn(t){return t?`${t}`:void 0}var V0=(()=>{let t=class lr{_store=d(T);_mediator=d(R);_browser=d(Pe);get _transform(){return this._store.transform}handle({element:e,cache:n}){let o=this._mediator.execute(new Rn(e));if(o&&n)return o;let r=this._getElementRoundedRect(e),s=this._normalizePosition(r),a=this._unscaleSize(r),l=this._getUnscaledRect(s,a,r),h=this._getOffsetSize(e,a),_=Ee.fromCenter(l,h.width,h.height);return this._mediator.execute(new di(e,_)),_}_getElementRoundedRect(e){return this._getRoundedRect(G.fromElement(e),e,this._getComputedStyle(e))}_getRoundedRect(e,n,o){let[r,s,a,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 Ee(e.x,e.y,e.width,e.height,r,s,a,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,s,a,l]=o.map(_=>Math.max(0,_)),h=Math.min(1,this._getRadiusScaleFactor(e,r+s),this._getRadiusScaleFactor(n,s+a),this._getRadiusScaleFactor(e,a+l),this._getRadiusScaleFactor(n,l+r));return[r*h,s*h,a*h,l*h]}_getRadiusScaleFactor(e,n){return n<=0?1:e<=0?0:e/n}_normalizePosition(e){return jn(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 Ee(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||lr)};static \u0275prov=g({token:lr,factory:lr.\u0275fac})};return t=C([x(Lt)],t),t})(),gc=class{connector;cache;static fToken=Symbol("ResolveConnectionEndpointRectRequest");constructor(i,e){this.connector=i,this.cache=e}},H0=(()=>{let t=class ur{_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 Lt(e.hostElement))}static \u0275fac=function(n){return new(n||ur)};static \u0275prov=g({token:ur,factory:ur.\u0275fac})};return t=C([x(gc)],t),t})(),yc=class{connection;static fToken=Symbol("ResolveConnectionEndpointsRequest");constructor(i){this.connection=i}},j0=(()=>{let t=class fr{_store=d(T);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||fr)};static \u0275prov=g({token:fr,factory:fr.\u0275fac})};return t=C([x(yc)],t),t})(),li=class{connection;cache;static fToken=Symbol("ResolveConnectionGeometryRequest");constructor(i,e){this.connection=i,this.cache=e}},U0=(()=>{let t=class hr{_mediator=d(R);handle({connection:e,cache:n}){let o=this._resolveConnectionEndpoints(e);return o?fu(he({},o),{sourceRect:this._resolveEndpointRect(o.source,n),targetRect:this._resolveEndpointRect(o.target,n)}):null}_resolveConnectionEndpoints(e){return this._mediator.execute(new yc(e))}_resolveEndpointRect(e,n){return this._mediator.execute(new gc(e,n))}static \u0275fac=function(n){return new(n||hr)};static \u0275prov=g({token:hr,factory:hr.\u0275fac})};return t=C([x(li)],t),t})(),be=class{element;static fToken=Symbol("GetNormalizedElementRectRequest");constructor(i){this.element=i}},$0=(()=>{let t=class pr{_store=d(T);_mediator=d(R);get _transform(){return this._store.transform}handle({element:e}){let n=this._mediator.execute(new Rn(e));if(n)return n;let o=G.fromElement(e),r=this._normalizePosition(o),s=this._unscaleSize(o),a=this._getUnscaledRect(r,s),l=this._getOffsetSize(e,s),h=this._fromCenter(a,l.width,l.height);return this._mediator.execute(new di(e,h)),h}_fromCenter(e,n,o){return G.initialize(e.gravityCenter.x-n/2,e.gravityCenter.y-o/2,n,o)}_normalizePosition(e){return jn(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 Ee(e.x,e.y,n.width,n.height)}_getOffsetSize(e,n){return ft.offsetFromElement(e)||n}static \u0275fac=function(n){return new(n||pr)};static \u0275prov=g({token:pr,factory:pr.\u0275fac})};return t=C([x(be)],t),t})(),Et=class{connector;static fToken=Symbol("ResolveConnectionEndpointRotationContextRequest");constructor(i){this.connector=i}},W0=(()=>{let t=class mr{_store=d(T);_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 be(n.hostElement));return{rotationDeg:n._rotate,pivot:o.gravityCenter}}static \u0275fac=function(n){return new(n||mr)};static \u0275prov=g({token:mr,factory:mr.\u0275fac})};return t=C([x(Et)],t),t})(),vc=class{connection;geometry;static fToken=Symbol("BuildConnectionLineRequest");constructor(i,e){this.connection=i,this.geometry=e}},q0=(()=>{let t=class _r{_mediator=d(R);_connectionBehaviour=d(Hn);handle({connection:e,geometry:n}){return this._connectionBehaviour.handle(new pt(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||_r)};static \u0275prov=g({token:_r,factory:_r.\u0275fac})};return t=C([x(vc)],t),t})(),ui=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}},X0=(()=>{let t=class gr{_mediator=d(R);handle({connection:e,source:n,target:o,line:r}){this._mediator.execute(new hc(n,o)),this._mediator.execute(new fc(e,r))}static \u0275fac=function(n){return new(n||gr)};static \u0275prov=g({token:gr,factory:gr.\u0275fac})};return t=C([x(ui)],t),t})(),fi=class{connection;geometry;static fToken=Symbol("RenderConnectionFromGeometryRequest");constructor(i,e){this.connection=i,this.geometry=e}},K0=(()=>{let t=class yr{_mediator=d(R);handle({connection:e,geometry:n}){let o=this._mediator.execute(new vc(e,n));this._mediator.execute(new ui(e,n.source,n.target,o))}static \u0275fac=function(n){return new(n||yr)};static \u0275prov=g({token:yr,factory:yr.\u0275fac})};return t=C([x(fi)],t),t})(),Cc=class{connection;cache;static fToken=Symbol("RenderConnectionRequest");constructor(i,e){this.connection=i,this.cache=e}},Y0=(()=>{let t=class vr{_mediator=d(R);handle({connection:e,cache:n}){let o=this._mediator.execute(new li(e,n));o&&this._mediator.execute(new fi(e,o))}static \u0275fac=function(n){return new(n||vr)};static \u0275prov=g({token:vr,factory:vr.\u0275fac})};return t=C([x(Cc)],t),t})(),sn=class{session;static fToken=Symbol("IsConnectionRedrawCurrentRequest");constructor(i){this.session=i}},Z0=(()=>{let t=class Cr{_store=d(T);_state=d(Tl);handle({session:e}){return e.renderTicket===this._state.renderTicket&&e.nodesRevision===this._store.nodesRevision}static \u0275fac=function(n){return new(n||Cr)};static \u0275prov=g({token:Cr,factory:Cr.\u0275fac})};return t=C([x(sn)],t),t})(),hi=class{session;static fToken=Symbol("CompleteConnectionRedrawRequest");constructor(i){this.session=i}},Q0=(()=>{let t=class xr{_mediator=d(R);_store=d(T);handle({session:e}){this._mediator.execute(new sn(e))&&this._store.completeConnectionsRender(e.connectionsRevision,e.nodesRevision)}static \u0275fac=function(n){return new(n||xr)};static \u0275prov=g({token:xr,factory:xr.\u0275fac})};return t=C([x(hi)],t),t})(),xc=class{batchItem;result;static fToken=Symbol("ApplyConnectionWorkerResultRequest");constructor(i,e){this.batchItem=i,this.result=e}},J0=(()=>{let t=class br{_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 ui(e.connection,e.geometry.source,e.geometry.target,n.line))}catch{this._fallbackToMainThread(e)}}}_fallbackToMainThread(e){this._mediator.execute(new fi(e.connection,e.geometry))}_isSupportedWorkerResult(e){return!!(e?.supported&&e.sourceSide&&e.targetSide&&e.line)}static \u0275fac=function(n){return new(n||br)};static \u0275prov=g({token:br,factory:br.\u0275fac})};return t=C([x(xc)],t),t})(),Ft=class{connections;cache;startIndex;session;batchItems;workerResults;static fToken=Symbol("RunConnectionRedrawSliceRequest");constructor(i,e,n,o,r,s){this.connections=i,this.cache=e,this.startIndex=n,this.session=o,this.batchItems=r,this.workerResults=s}},ey=500,ty=6,ny=(()=>{let t=class wr{_mediator=d(R);_browser=d(Pe);handle({connections:e,cache:n,startIndex:o,session:r,batchItems:s,workerResults:a}){if(!this._isCurrent(r))return;let l=this._now(),h=o,_=0;for(;h<e.length&&_<ey&&this._isWithinSliceBudget(l);){let v=e[h];if(s?this._mediator.execute(new xc(s[h]??null,a?.[h])):this._mediator.execute(new Cc(v,n)),h++,_++,!this._isCurrent(r))return}if(h>=e.length){this._mediator.execute(new hi(r));return}this._requestAnimationFrame(()=>this._mediator.execute(new Ft(e,n,h,r,s,a)))}_isCurrent(e){return this._mediator.execute(new sn(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<ty:!0}static \u0275fac=function(n){return new(n||wr)};static \u0275prov=g({token:wr,factory:wr.\u0275fac})};return t=C([x(Ft)],t),t})(),bc=class{static fToken=Symbol("StartConnectionRedrawRequest")},iy=(()=>{let t=class Sr{_store=d(T);_state=d(Tl);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||Sr)};static \u0275prov=g({token:Sr,factory:Sr.\u0275fac})};return t=C([x(bc)],t),t})(),pi=class{static fToken=Symbol("RedrawConnectionsRequest")},wc=class{connectionCount;static fToken=Symbol("ShouldUseConnectionWorkerRequest");constructor(i){this.connectionCount=i}},mi=class{static fToken=Symbol("IsConnectionWorkerEnabledRequest")},oy=(()=>{let t=class Ir{_browser=d(Pe);_state=d(un);handle(e){if(this._state.isDisabled||!this._isWorkerAvailable())return!1;let n=this._browser.document.defaultView;return Lp(n)}_isWorkerAvailable(){return this._browser.isBrowser()}static \u0275fac=function(n){return new(n||Ir)};static \u0275prov=g({token:Ir,factory:Ir.\u0275fac})};return t=C([x(mi)],t),t})(),ry=(()=>{let t=class Tr{_mediator=d(R);handle({connectionCount:e}){return e>0&&this._mediator.execute(new mi)}static \u0275fac=function(n){return new(n||Tr)};static \u0275prov=g({token:Tr,factory:Tr.\u0275fac})};return t=C([x(wc)],t),t})(),Sc=class{connection;geometry;originalIndex;static fToken=Symbol("BuildConnectionWorkerPayloadItemRequest");constructor(i,e,n){this.connection=i,this.geometry=e,this.originalIndex=n}},sy=(()=>{let t=class Er{_store=d(T);handle({connection:e,geometry:n,originalIndex:o}){let{source:r,target:s,sourceRect:a,targetRect:l}=n;return{originalIndex:o,behavior:e.fBehavior,outputSide:e.fOutputSide(),inputSide:e.fInputSide(),sourceConnectableSide:r.fConnectableSide,targetConnectableSide:s.fConnectableSide,sourceRotation:this._store.nodes.get(r.fNodeId)?._rotate||0,targetRotation:this._store.nodes.get(s.fNodeId)?._rotate||0,sourceRect:{x:a.x,y:a.y,width:a.width,height:a.height,radius1:a.radius1,radius2:a.radius2,radius3:a.radius3,radius4:a.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||Er)};static \u0275prov=g({token:Er,factory:Er.\u0275fac})};return t=C([x(Sc)],t),t})(),Ic=class{connections;cache;static fToken=Symbol("BuildConnectionWorkerBatchRequest");constructor(i,e){this.connections=i,this.cache=e}},ay=(()=>{let t=class Pr{_mediator=d(R);handle({connections:e,cache:n}){let o=new Array(e.length),r=[];for(let s=0;s<e.length;s++){let a=this._buildBatchItem(e[s],n,s);o[s]=a,a&&r.push(a.payload)}return{items:o,payload:r}}_buildBatchItem(e,n,o){let r=this._mediator.execute(new li(e,n));return r?{connection:e,geometry:r,payload:this._mediator.execute(new Sc(e,r,o))}:null}static \u0275fac=function(n){return new(n||Pr)};static \u0275prov=g({token:Pr,factory:Pr.\u0275fac})};return t=C([x(Ic)],t),t})(),Tc=class{error;static fToken=Symbol("DisableConnectionWorkerRequest");constructor(i){this.error=i}},_i=class{error;static fToken=Symbol("ResetConnectionWorkerRuntimeRequest");constructor(i){this.error=i}},cy=(()=>{let t=class Mr{_state=d(un);handle({error:e}){this._state.resetRuntime(e)}static \u0275fac=function(n){return new(n||Mr)};static \u0275prov=g({token:Mr,factory:Mr.\u0275fac})};return t=C([x(_i)],t),t})(),dy=(()=>{let t=class Dr{_state=d(un);_mediator=d(R);handle({error:e}){this._state.isDisabled=!0,this._mediator.execute(new _i(e))}static \u0275fac=function(n){return new(n||Dr)};static \u0275prov=g({token:Dr,factory:Dr.\u0275fac})};return t=C([x(Tc)],t),t})(),Ec=class{message;static fToken=Symbol("HandleConnectionWorkerMessageRequest");constructor(i){this.message=i}},ly=(()=>{let t=class kr{_state=d(un);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||kr)};static \u0275prov=g({token:kr,factory:kr.\u0275fac})};return t=C([x(Ec)],t),t})(),Pc=class{static fToken=Symbol("EnsureConnectionWorkerRequest")},uy=(()=>{let t=class Rr{_browser=d(Pe);_state=d(un);_mediator=d(R);handle(e){if(this._state.worker)return this._state.worker;let n=this._browser.document.defaultView;if(!Lp(n))return null;let o=Bp(n);if(!o)return null;let r=E0(o);try{let s=new o.workerCtor(r,{name:"f-flow-connection-worker"});return s.onmessage=a=>{this._mediator.execute(new Ec(a.data))},s.onerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker runtime error."))},s.onmessageerror=()=>{this._resetWorkerAfterRuntimeError(new Error("Connection worker message deserialization error."))},this._state.workerUrl=r,this._state.worker=s,s}catch(s){return zp(r,o.urlApi),this._disableWorker(s instanceof Error?s:new Error("Connection worker initialization failed.")),null}}_disableWorker(e){this._mediator.execute(new Tc(e))}_resetWorkerAfterRuntimeError(e){this._mediator.execute(new _i(e))}static \u0275fac=function(n){return new(n||Rr)};static \u0275prov=g({token:Rr,factory:Rr.\u0275fac})};return t=C([x(Pc)],t),t})(),Mc=class{payload;static fToken=Symbol("RunConnectionWorkerRequest");constructor(i){this.payload=i}},fy=(()=>{let t=class Nr{_state=d(un);_mediator=d(R);handle({payload:e}){if(!e.length)return Promise.resolve([]);if(!this._mediator.execute(new mi))return Promise.reject(new Error("Connection worker is disabled."));this._interruptPendingRequests();let n=this._mediator.execute(new Pc);if(!n)return Promise.reject(new Error("Unable to initialize connection worker."));let o=++this._state.nextRequestId;return new Promise((r,s)=>{this._state.pending.set(o,{resolve:r,reject:s});try{n.postMessage({requestId:o,items:e})}catch(a){this._state.pending.delete(o),s(a instanceof Error?a: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||Nr)};static \u0275prov=g({token:Nr,factory:Nr.\u0275fac})};return t=C([x(Mc)],t),t})(),Dc=class{batch;static fToken=Symbol("RunConnectionWorkerBatchRequest");constructor(i){this.batch=i}},hy=(()=>{let t=class Or{_mediator=d(R);handle({batch:e}){return e.payload.length?this._mediator.execute(new Mc(e.payload)):Promise.resolve([])}static \u0275fac=function(n){return new(n||Or)};static \u0275prov=g({token:Or,factory:Or.\u0275fac})};return t=C([x(Dc)],t),t})(),kc=class{connections;cache;session;static fToken=Symbol("StartConnectionWorkerRedrawRequest");constructor(i,e,n){this.connections=i,this.cache=e,this.session=n}},py=(()=>{let t=class Fr{_mediator=d(R);handle({connections:e,cache:n,session:o}){let r=this._mediator.execute(new Ic(e,n));if(!r.payload.length){this._mediator.execute(new Ft(e,n,0,o,r.items));return}this._mediator.execute(new Dc(r)).then(s=>{this._mediator.execute(new sn(o))&&this._mediator.execute(new Ft(e,n,0,o,r.items,this._alignWorkerResults(s,e.length)))}).catch(()=>{this._mediator.execute(new sn(o))&&this._mediator.execute(new Ft(e,n,0,o,r.items))})}_alignWorkerResults(e,n){let o=new Array(n);for(let r of e){let s=r.originalIndex;s<0||s>=n||(o[s]=r)}return o}static \u0275fac=function(n){return new(n||Fr)};static \u0275prov=g({token:Fr,factory:Fr.\u0275fac})};return t=C([x(kc)],t),t})(),my=(()=>{let t=class Ar{_mediator=d(R);_store=d(T);handle(e){let n=this._mediator.execute(new bc);this._createMarkersForCreate(),this._createMarkersForSnap();let o=[...this._store.connections.getAll()],r=new Map;if(!o.length){this._mediator.execute(new hi(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 Dn(e))}_createMarkersForSnap(){let e=this._store.connections.getForSnap();e&&this._mediator.execute(new Dn(e))}_shouldUseConnectionWorker(e){return this._mediator.execute(new wc(e))}_redrawUsingWorker(e,n,o){this._mediator.execute(new kc(e,n,o))}_redrawWithoutWorker(e,n,o){this._mediator.execute(new Ft(e,n,0,o))}static \u0275fac=function(n){return new(n||Ar)};static \u0275prov=g({token:Ar,factory:Ar.\u0275fac})};return t=C([x(pi)],t),t})(),sf=class{static fToken=Symbol("RemoveConnectionForCreateFromStoreRequest")},_y=(()=>{let t=class Lr{_store=d(T);handle(e){this._store.connections.removeInstanceForCreate()}static \u0275fac=function(n){return new(n||Lr)};static \u0275prov=g({token:Lr,factory:Lr.\u0275fac})};return t=C([x(sf)],t),t})(),Rc=class{connection;static fToken=Symbol("RemoveConnectionFromStoreRequest");constructor(i){this.connection=i}},gy=(()=>{let t=class Br{_store=d(T);handle({connection:e}){this._store.connections.remove(e),this._store.emitConnectionChanges()}static \u0275fac=function(n){return new(n||Br)};static \u0275prov=g({token:Br,factory:Br.\u0275fac})};return t=C([x(Rc)],t),t})(),af=class{instance;static fToken=Symbol("RemoveConnectionMarkerFromStoreRequest");constructor(i){this.instance=i}},yy=(()=>{let t=class zr{_store=d(T);handle({instance:e}){this._store.connectionMarkers.remove(e),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||zr)};static \u0275prov=g({token:zr,factory:zr.\u0275fac})};return t=C([x(af)],t),t})(),cf=class{waypointIndex;connectionId;static fToken=Symbol("RemoveConnectionWaypointRequest");constructor(i,e){this.waypointIndex=i,this.connectionId=e}},Nc=class{static fToken=Symbol("EmitEndDragSequenceEventRequest")},vy=(()=>{let t=class Gr{_store=d(T);_dragSession=d(K);handle(e){this._store.flowHost.classList.remove(Re.DRAG_AND_DROP.DRAGGING),this._dragSession.reset(),this._emitEvent()}_emitEvent(){this._store.fDraggable?.fDragEnded?.emit()}static \u0275fac=function(n){return new(n||Gr)};static \u0275prov=g({token:Gr,factory:Gr.\u0275fac})};return t=C([x(Nc)],t),t})(),Oc=class{static fToken=Symbol("EmitStartDragSequenceEventRequest")},Cy=(()=>{let t=class Vr{_mediator=d(R);_store=d(T);_dragContext=d(K);handle(e){this._dragContext.draggableItems.length>0&&(this._store.flowHost.classList.add(Re.DRAG_AND_DROP.DRAGGING),this._mediator.execute(new gi),this._emitDragStarted())}_emitDragStarted(){let e=this._dragContext.draggableItems[0].getEvent();this._store.fDraggable?.fDragStarted?.emit(new Gc(e.kind,e.data?he({},e.data):void 0,e.fEventType))}static \u0275fac=function(n){return new(n||Vr)};static \u0275prov=g({token:Vr,factory:Vr.\u0275fac})};return t=C([x(Oc)],t),t})(),gi=class{static fToken=Symbol("EmitSelectionChangeEventRequest")},an=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}},Fc=class extends an{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}}},df=class extends an{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}},lf=class extends an{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}}},uf=class extends an{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}}},ue=(()=>{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})(),xy=800,ff=class{_document=d(no);_ngZone=d(Zn,{optional:!0});_mouseListeners=ue.emptyListener();_touchListeners=ue.emptyListener();_startListeners=ue.emptyListener();isSyntheticEvent(i){return!!this._lastTouchEventTime&&this._lastTouchEventTime+xy>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=wy(i),o=new Fc(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,ue.activeListener()),this._listen("mousemove",this._onMouseMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,ue.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,ue.activeCaptureListener())}),this._mouseListeners=()=>{this._unlisten("selectstart",this._onSelectStart,ue.activeListener()),this._unlisten("mousemove",this._onMouseMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,ue.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,ue.activeCaptureListener())})};_onTouchDown=i=>{let e=Sy(i),n=new lf(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,ue.activeListener()),this._listen("touchmove",this._onTouchMove),this._listen("pointerup",this._onPointerUpEvent),this._listen("pointercancel",this._onPointerUpEvent,ue.activeCaptureListener()),this._listen("contextmenu",this._preventDuringDrag,ue.activeCaptureListener())}),this._touchListeners=()=>{this._unlisten("selectstart",this._onSelectStart,ue.activeListener()),this._unlisten("touchmove",this._onTouchMove),this._unlisten("pointerup",this._onPointerUpEvent),this._unlisten("pointercancel",this._onPointerUpEvent,ue.activeCaptureListener()),this._unlisten("contextmenu",this._preventDuringDrag,ue.activeCaptureListener())})};_onSelectStart=i=>{this.onSelect(i)};_onMouseMove=i=>{this._moveHandler(new Fc(i))};_onTouchMove=i=>{this._moveHandler(new uf(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,by(i.originalEvent)&&(this._lastTouchEventTime=Date.now())}}}_onPointerUpEvent=i=>{this.isDragStarted&&this.onPointerUp(new df(i)),this._endDragSequence()};_endDragSequence(){this.isDragStarted=!1,this._pointerDownElement=null,this._moveHandler=this._checkDragSequenceToStart,this._mouseListeners(),this._mouseListeners=ue.emptyListener(),this._touchListeners(),this._touchListeners=ue.emptyListener(),this.finalizeDragSequence()}subscribe(){this.unsubscribe(),this._ngZone?.runOutsideAngular(()=>{this._listen("mousedown",this._onMouseDown,ue.activeListener()),this._listen("touchstart",this._onTouchDown,ue.passiveListener())}),this._startListeners=()=>{this._unlisten("mousedown",this._onMouseDown,ue.activeListener()),this._unlisten("touchstart",this._onTouchDown,ue.passiveListener())}}unsubscribe(){this._startListeners(),this._startListeners=ue.emptyListener(),this._touchListeners(),this._touchListeners=ue.emptyListener(),this._mouseListeners(),this._mouseListeners=ue.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 by(t){return t.type[0]==="t"}function wy(t){return t.buttons===0||t.offsetX===0&&t.offsetY===0}function Sy(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 hf=class extends an{_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 he({},this._position)}};function Iy(t){return new hf(t)}var K=(()=>{class t{selectedItems=[];isSelectedChanged=!1;onPointerDownScale=1;onPointerDownPosition=new q(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 q(0,0),this.autoPanFrameId=null,this.lastPointerEvent=null,this.lastPointerPosition=null,this.isAutoPanCanvasMoved=!1}markSelectionAsChanged(){this.isSelectedChanged=!0}rememberPointerEvent(e){this.lastPointerEvent=Iy(e),this.lastPointerPosition=this.lastPointerEvent.getPosition()}isEmpty(){return!this.draggableItems.length}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),pf=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}},Ty=(()=>{let t=class Hr{_mediator=d(R);_store=d(T);_dragSession=d(K);handle(e){this._dragSession.isSelectedChanged&&(this._emitSelectionChange(this._getSelection()),this._dragSession.isSelectedChanged=!1,this._mediator.execute(new At))}_getSelection(){return this._mediator.execute(new Gi)}_emitSelectionChange(e){this._store.fDraggable?.fSelectionChange.emit(new pf(e.fNodeIds,e.fGroupIds,e.fConnectionIds))}static \u0275fac=function(n){return new(n||Hr)};static \u0275prov=g({token:Hr,factory:Hr.\u0275fac})};return t=C([x(gi)],t),t})(),mf=class{nodeOrGroup;static fToken=Symbol("GetNormalizedParentNodeRectRequest");constructor(i){this.nodeOrGroup=i}},Ey=(()=>{let t=class jr{_store=d(T);_mediator=d(R);handle({nodeOrGroup:e}){let n=G.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 G.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 be(e.hostElement))}_getNodePadding(e,n){return this._mediator.execute(new dn(e,n))}static \u0275fac=function(n){return new(n||jr)};static \u0275prov=g({token:jr,factory:jr.\u0275fac})};return t=C([x(mf)],t),t})(),_f=class{fParentNodes;fDraggedNodes;static fToken=Symbol("IsArrayHasParentNodeRequest");constructor(i,e){this.fParentNodes=i,this.fDraggedNodes=e}},Py=(()=>{let t=class Ur{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||Ur)};static \u0275prov=g({token:Ur,factory:Ur.\u0275fac})};return t=C([x(_f)],t),t})(),gf=class{fNodeId;fConnectionIds;constructor(i,e){this.fNodeId=i,this.fConnectionIds=e}},Ac=class extends gf{nodeId;connectionIds;constructor(i,e){super(i,e),this.nodeId=i,this.connectionIds=e}},Lc=class{nodeOrGroup;static fToken=Symbol("DetectConnectionsUnderDragNodeRequest");constructor(i){this.nodeOrGroup=i}},My=(()=>{let t=class $r{_mediator=d(R);_store=d(T);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),s=this._collectConnectionsUnderNode(e),a=[];for(let l of s){let h=l.fId();r.has(h)||a.push(h)}a.length&&(this._store.fDraggable?.fNodeIntersectedWithConnections.emit(new Ac(e.fId(),a)),this._store.fDraggable?.fNodeConnectionsIntersection.emit(new Ac(e.fId(),a)))}_collectConnectableConnectorIds(e,n){let o=n==="source"?this._store.outputs.getAll():this._store.inputs.getAll(),r=new Set;for(let s of o)s.canBeConnected&&e.isContains(s.hostElement)&&r.add(s.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 Lt(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 wn.getRoundedRectIntersectionsWithSVGPath(e.fPath().hostElement,n).length>0}static \u0275fac=function(n){return new(n||$r)};static \u0275prov=g({token:$r,factory:$r.\u0275fac})};return t=C([x(Lc)],t),t})(),Dy=[Cy,vy,Ty,Ey,Py,My],ky=new Set(["create-connection","reassign-connection","drag-node"]),Ry=new Set(["selection-area"]),Ny=new Set(["assign-to-container"]);function Vp(t){let i=null;for(let e of t){if(Ny.has(e))continue;let n=ky.has(e)?"rebase":Ry.has(e)?"direct":null;if(!n)return null;if(!i){i=n;continue}if(i!==n)return null}return i}function Hp(t,i,e,n,o){return A.initialize(op(t.x,i.left,i.right,e,n,o),op(t.y,i.top,i.bottom,e,n,o))}function op(t,i,e,n,o,r){let s=Math.max(0,n),a=Math.max(0,o);if(!s||!a)return 0;if(t<=i+s){let l=sp((i+s-t)/s,0,1);return rp(l,a,r)}if(t>=e-s){let l=sp((t-(e-s))/s,0,1);return-rp(l,a,r)}return 0}function Oy(t,i,e){let n=e||1;return q.fromPoint(t).add(q.fromPoint(i).div(n))}function rp(t,i,e){return e?i*t:i}function sp(t,i,e){return Math.max(i,Math.min(e,t))}var Bc=class{static fToken=Symbol("RunAutoPanFrameRequest")},Bt=class{static fToken=Symbol("StopAutoPanRequest")},Fy=(()=>{let t=class Wr{_store=d(T);_dragContext=d(K);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||Wr)};static \u0275prov=g({token:Wr,factory:Wr.\u0275fac})};return t=C([x(Bt)],t),t})(),yi=class{static fToken=Symbol("SyncAutoPanRequest")},Ay=(()=>{let t=class qr{_mediator=d(R);_store=d(T);_dragContext=d(K);handle(e){if(!this._canAutoPan()||!this._hasAutoPanDelta()){this._mediator.execute(new Bt);return}this._dragContext.autoPanFrameId===null&&(this._dragContext.autoPanFrameId=requestAnimationFrame(()=>{this._dragContext.autoPanFrameId=null,this._mediator.execute(new Bc)}))}_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():Hp(e,n.getBoundingClientRect(),this._edgeThreshold(),this._speed(),this._acceleration())}_getAutoPanMode(){return Vp(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(xe.AUTO_PAN)}static \u0275fac=function(n){return new(n||qr)};static \u0275prov=g({token:qr,factory:qr.\u0275fac})};return t=C([x(yi)],t),t})(),Ly=(()=>{let t=class Xr{_mediator=d(R);_store=d(T);_dragContext=d(K);handle(e){let n=this._getAutoPanMode();if(!this._canAutoPan(n)){this._mediator.execute(new Bt);return}let o=this._getAutoPanDelta();if(!o.x&&!o.y){this._mediator.execute(new Bt);return}this._applyCanvasDelta(o,n),this._replayLastPointerMove(),this._mediator.execute(new yi)}_applyCanvasDelta(e,n){let o=this._store.transform;n==="rebase"&&(this._dragContext.onPointerDownPosition=Oy(this._dragContext.onPointerDownPosition,e,this._dragContext.onPointerDownScale||o.scale||1)),o.position=q.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(he({},n),e)})}_getPointerPositionInCanvas(e){return q.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 Vp(this._dragContext.draggableItems.map(e=>e.getEvent().kind))}_getAutoPanDelta(){let e=this._dragContext.lastPointerPosition,n=this._store.fFlow?.hostElement;return!e||!n?A.initialize():Hp(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(xe.AUTO_PAN)}static \u0275fac=function(n){return new(n||Xr)};static \u0275prov=g({token:Xr,factory:Xr.\u0275fac})};return t=C([x(Bc)],t),t})(),By=[Ay,Ly,Fy],zc=class{event;static fToken=Symbol("DragCanvasFinalizeRequest");constructor(i){this.event=i}},Gc=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 Gc(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)}},Vc=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=[]}},zy=new ce("F_NODE_INPUT"),Gy=(()=>{class t extends Vc{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=Me({type:t,standalone:!1,features:[ye]})}return t})(),gt=(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})(gt||{});function Vy(t){return ni(t,".f-rotate-handle")}var jp=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,selectors:[["","fDragHandle",""]],hostAttrs:[1,"f-drag-handle","f-component"],standalone:!1})}return t})(),El=new ce("F_NODE"),Hy=Op(class{hostElement;constructor(t){this.hostElement=t}}),Hc=class extends Hy{_injector=d(Ke);renderer=d(wh);browser=d(Pe);stateChanges=new at;_position=A.initialize();_rotate=0;_size;connectors=[];positionChanges(){pe(()=>{let i=this.position();_t(()=>{A.isEqual(this._position,i)||(this._position=i,this.redraw(),this.refresh())})},{injector:this._injector})}sizeChanges(){pe(()=>{let i=this.size();_t(()=>{this._isSizeEqual(i)||(this._size=i,this.redraw(),this.refresh())})},{injector:this._injector})}rotateChanges(){pe(()=>{let i=this.rotate();_t(()=>{this._rotate!==i&&(this._rotate=i,this.redraw(),this.refresh())})},{injector:this._injector})}parentChanges(){pe(()=>{this.fParentId(),this.fIncludePadding(),this.fAutoSizeToFitChildren(),_t(()=>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()}},jy=0,Uy=3,yf=(()=>{class t extends Hc{_debounceTimer=null;_destroyRef=d(Ye);_mediator=d(R);fId=F(`f-group-${jy++}`,{alias:"fGroupId"});fParentId=F(null,{alias:"fGroupParentId"});position=qt(A.initialize(),{alias:"fGroupPosition"});size=F(void 0,{alias:"fGroupSize"});sizeChange=nt({alias:"fGroupSizeChange"});rotate=qt(0,{alias:"fGroupRotate"});fConnectOnNode=F(!0,{transform:Ce});fMinimapClass=F([]);fDraggingDisabled=F(!1,{alias:"fGroupDraggingDisabled",transform:Ce});fSelectionDisabled=F(!1,{alias:"fGroupSelectionDisabled",transform:Ce});fIncludePadding=F(!0,{transform:Ce});fAutoExpandOnChildHit=F(!1,{transform:Ce});fAutoSizeToFitChildren=F(!1,{transform:Ce});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Ni(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 At),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),Uy))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Fn(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new Fi(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new Ai(this))}static \u0275fac=function(n){return new(n||t)(pu(Se))};static \u0275dir=Me({type:t,selectors:[["","fGroup",""]],hostAttrs:[1,"f-group","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(Z("data-f-group-id",o.fId()),le("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:[De([{provide:El,useExisting:t}]),ye]})}return t})(),ap=0,$y=3,Pl=(()=>{class t extends Hc{_debounceTimer=null;_destroyRef=d(Ye);_mediator=d(R);fId=F(`f-node-${ap++}`,{alias:"fNodeId",transform:e=>Nn(e)||`f-node-${ap++}`});fParentId=F(null,{alias:"fNodeParentId"});position=qt(A.initialize(),{alias:"fNodePosition"});size=F(void 0,{alias:"fNodeSize"});sizeChange=nt({alias:"fNodeSizeChange"});rotate=qt(0,{alias:"fNodeRotate"});fConnectOnNode=F(!0,{transform:Ce});fMinimapClass=F([]);fDraggingDisabled=F(!1,{alias:"fNodeDraggingDisabled",transform:Ce});fSelectionDisabled=F(!1,{alias:"fNodeSelectionDisabled",transform:Ce});fIncludePadding=F(!0,{transform:Ce});fAutoExpandOnChildHit=F(!1,{transform:Ce});fAutoSizeToFitChildren=F(!1,{transform:Ce});constructor(e){super(e.nativeElement),super.positionChanges(),super.sizeChanges(),super.rotateChanges(),super.parentChanges()}ngOnInit(){super.redraw(),this._mediator.execute(new Ni(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 At),this._updateConnectorsSides()}_updateConnectorsSides(){this.connectors.length&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._calculateNodeConnectorsConnectableSides(),$y))}_calculateNodeConnectorsConnectableSides(){this._mediator.execute(new Fn(this))}ngAfterViewInit(){this.browser.isBrowser()&&this._listenStateSizeChanges()}_listenStateSizeChanges(){this._mediator.execute(new Fi(this,this._destroyRef))}refresh(){this.stateChanges.notify()}ngOnDestroy(){this._mediator.execute(new Ai(this))}static \u0275fac=function(n){return new(n||t)(pu(Se))};static \u0275dir=Me({type:t,selectors:[["","fNode",""]],hostAttrs:[1,"f-node","f-component"],hostVars:5,hostBindings:function(n,o){n&2&&(Z("data-f-node-id",o.fId()),le("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:[De([{provide:El,useExisting:t}]),ye]})}return t})();function Wy(t){return!!t.closest("[fNode]")}var cp=0,Up=(()=>{class t extends Gy{hostElement=d(Se).nativeElement;_mediator=d(R);_node=d(El);fId=F(`f-node-input-${cp++}`,{alias:"fInputId",transform:e=>Nn(e)||`f-node-input-${cp++}`});category=F(void 0,{alias:"fInputCategory",transform:Nn});multiple=F(!0,{alias:"fInputMultiple",transform:Ce});disabled=F(!1,{alias:"fInputDisabled",transform:Ce});userFConnectableSide=L.AUTO;get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Di(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(Re.CONNECTOR.INPUT_CONNECTED,!0),this.hostElement.classList.toggle(Re.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(Re.CONNECTOR.INPUT_CONNECTED,!1),this.hostElement.classList.toggle(Re.CONNECTOR.INPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new Li(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Me({type:t,selectors:[["","fNodeInput",""]],hostAttrs:[1,"f-component","f-node-input"],hostVars:5,hostBindings:function(n,o){n&2&&(Z("data-f-input-id",o.fId()),le("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=>Sn(e,"fInputConnectableSide",L)]},exportAs:["fNodeInput"],standalone:!1,features:[De([{provide:zy,useExisting:t}]),ye,mn]})}return t})(),qy=(()=>{class t extends Vc{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=Me({type:t,standalone:!1,features:[ye]})}return t})();function $p(t){return!!t.closest("[fNodeOutlet]")}var Xy=new ce("F_NODE_OUTPUT"),Ky=(()=>{class t extends qy{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=Me({type:t,standalone:!1,features:[ye]})}return t})();function Wp(t){return!!t.closest("[fNodeOutput]")}var dp=0,qp=(()=>{class t extends Ky{hostElement=d(Se).nativeElement;_mediator=d(R);_node=d(El);fId=F(`f-node-output-${dp++}`,{alias:"fOutputId",transform:e=>Nn(e)||`f-node-output-${dp++}`});multiple=F(!1,{alias:"fOutputMultiple",transform:Ce});disabled=F(!1,{alias:"fOutputDisabled",transform:Ce});userFConnectableSide=L.AUTO;isSelfConnectable=!0;canBeConnectedInputs=[];get fNodeId(){return this._node.fId()}get fNodeHost(){return this._node.hostElement}ngOnInit(){this._mediator.execute(new Di(this)),this._node.addConnector(this)}ngOnChanges(e){e.userFConnectableSide&&this._node.refresh()}setConnected(e){super.setConnected(e),this.hostElement.classList.toggle(Re.CONNECTOR.OUTPUT_CONNECTED,!0),this.hostElement.classList.toggle(Re.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}resetConnected(){super.resetConnected(),this.hostElement.classList.toggle(Re.CONNECTOR.OUTPUT_CONNECTED,!1),this.hostElement.classList.toggle(Re.CONNECTOR.OUTPUT_NOT_CONNECTABLE,!this.canBeConnected)}ngOnDestroy(){this._node.removeConnector(this),this._mediator.execute(new Li(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Me({type:t,selectors:[["","fNodeOutput",""]],hostAttrs:[1,"f-component","f-node-output"],hostVars:7,hostBindings:function(n,o){n&2&&(Z("data-f-output-id",o.fId()),le("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=>Sn(e,"fOutputConnectableSide",L)],isSelfConnectable:"isSelfConnectable",canBeConnectedInputs:[0,"fCanBeConnectedInputs","canBeConnectedInputs"]},exportAs:["fNodeOutput"],standalone:!1,features:[De([{provide:Xy,useExisting:t}]),ye,mn]})}return t})();var jc=class{event;static fToken=Symbol("CreateConnectionFinalizeRequest");constructor(i){this.event=i}},vi=class{outlet;static fToken=Symbol("ResolveConnectableOutputForOutletRequest");constructor(i){this.outlet=i}},Yy=(()=>{let t=class Kr{_store=d(T);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||Kr)};static \u0275prov=g({token:Kr,factory:Kr.\u0275fac})};return t=C([x(vi)],t),t})(),vf=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}},Uc=(()=>{class t extends qe{type="create-connection";kind="create-connection";data(){return{fOutputOrOutletId:this._sourceRef.connector.fId()}}_result=d(Gt);_mediator=d(R);_connectionBehaviour=d(Hn);_store=d(T);get _connection(){return this._store.connections.getForCreate()}get _snapConnection(){return this._store.connections.getForSnap()}_targets=[];_sourceRef;_pointerDown=new Ee;initialize(e,n){this._sourceRef=this._mediator.execute(new it(e)),this._pointerDown=Ee.fromRect(G.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 Ri(this._sourceRef.connector,this._sourceRef.rect.gravityCenter)),this._mediator.execute(new Bn(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 s=this._snapConnection;if(!s)return;let a=o&&o.distance<s.fSnapThreshold?o:void 0;this._drawSnapConnection(a)}_findClosestTarget(e){return this._mediator.execute(new cn(e,this._targets))}_drawCreateConnection(e,n){let o=this._connectionBehaviour.handle(new pt(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 pt(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 zn(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=g({token:t,factory:t.\u0275fac})}return t})(),Zy=(()=>{let t=class Yr{_result=d(Gt);_mediator=d(R);_store=d(T);_dragContext=d(K);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 Uc)}_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 $p(e.hostElement)?this._mediator.execute(new vi(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 vf(this._getTargetOutput(this._getOutput()||this._getOutlet()).fId(),this._getInputUnderPointer(e)?.fId(),e.getPosition()))}_getInputUnderPointer(e){return this._mediator.execute(new ki(e.getPosition(),this._result.getData().canBeConnectedInputs))}static \u0275fac=function(n){return new(n||Yr)};static \u0275prov=g({token:Yr,factory:Yr.\u0275fac})};return t=C([x(jc)],t),t})(),Ci=class{eventPosition;source;static fToken=Symbol("CreateConnectionCreateDragHandlerRequest");constructor(i,e){this.eventPosition=i,this.source=e}},Qy=(()=>{let t=class Zr{_store=d(T);_dragContext=d(K);_dragInjector=d(ze);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),s=this._dragInjector.get(Uc);s.initialize(e,r),this._dragContext.draggableItems=[s]}_toFlowSpace(e){return q.fromPoint(e).elementTransform(this._store.flowHost).div(this._transform.scale)}_toCanvasSpace(e){return q.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||Zr)};static \u0275prov=g({token:Zr,factory:Zr.\u0275fac})};return t=C([x(Ci)],t),t})(),$c=class{event;node;static fToken=Symbol("CreateConnectionFromOutletPreparationRequest");constructor(i,e){this.event=i,this.node=e}},Jy=(()=>{let t=class Qr{_mediator=d(R);_store=d(T);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 vi(e))}_startDrag(e,n){this._mediator.execute(new Ci(e,n))}static \u0275fac=function(n){return new(n||Qr)};static \u0275prov=g({token:Qr,factory:Qr.\u0275fac})};return t=C([x($c)],t),t})(),Wc=class{event;node;static fToken=Symbol("CreateConnectionFromOutputPreparationRequest");constructor(i,e){this.event=i,this.node=e}},ev=(()=>{let t=class Jr{_mediator=d(R);_store=d(T);handle({event:e,node:n}){if(!Wp(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 Ci(e,n))}static \u0275fac=function(n){return new(n||Jr)};static \u0275prov=g({token:Jr,factory:Jr.\u0275fac})};return t=C([x(Wc)],t),t})(),qc=class{event;fTrigger;static fToken=Symbol("CreateConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},tv=(()=>{let t=class es{_mediator=d(R);_store=d(T);_dragContext=d(K);handle({event:e,fTrigger:n}){if(!this._isValidConditions()||!this._isValidTrigger(e,n))return;let o=$p(e.targetElement),r=!o&&Wp(e.targetElement);if(!o&&!r)return;let s=this._findOwnerNode(e.targetElement);s&&(o?this._mediator.execute(new $c(e,s)):this._mediator.execute(new Wc(e,s)))}_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 ct(e.originalEvent,n)}static \u0275fac=function(n){return new(n||es)};static \u0275prov=g({token:es,factory:es.\u0275fac})};return t=C([x(qc)],t),t})(),Xc=class{event;static fToken=Symbol("ReassignConnectionFinalizeRequest");constructor(i){this.event=i}},Cf=class{connectionId;endpoint;previousSourceId;nextSourceId;previousTargetId;nextTargetId;dropPosition;isSourceReassign;isTargetReassign;oldSourceId;newSourceId;oldTargetId;newTargetId;dropPoint;constructor(i,e,n,o,r,s,a){this.connectionId=i,this.endpoint=e,this.previousSourceId=n,this.nextSourceId=o,this.previousTargetId=r,this.nextTargetId=s,this.dropPosition=a,this.isSourceReassign=e==="source",this.isTargetReassign=e==="target",this.oldSourceId=n,this.newSourceId=o,this.oldTargetId=r,this.newTargetId=s,this.dropPoint=a}},nv=(()=>{let t=class ts{_dragResult=d(Gt);_mediator=d(R);_store=d(T);_dragContext=d(K);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 ki(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 Cf(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||ts)};static \u0275prov=g({token:ts,factory:ts.\u0275fac})};return t=C([x(Xc)],t),t})(),Kc=class{event;fTrigger;static fToken=Symbol("ReassignConnectionPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function iv(t,i){return Xp(t,i)||ov(t,i)}function Xp(t,i){return t.fDragHandleEnd()?.point&&Kp(i,t.fDragHandleEnd().point)&&!t.fDraggingDisabled()}function ov(t,i){return!!t.fDragHandleStart()?.point&&Kp(i,t.fDragHandleStart().point)&&!t.fDraggingDisabled()&&t.fReassignableStart()}function Kp(t,i){return(t.x-i.x)**2+(t.y-i.y)**2<=8**2}function Yp(t,i){return t&&t.distance<i.fSnapThreshold?t:void 0}function Yc(t){return Ee.fromRect(G.initialize(t.x,t.y))}var xf=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=Yc(this._connection.line.point1)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Jd(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 Bn(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(Yp(n,r))}_findClosest(i){return this._mediator.execute(new cn(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new pt(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 pt(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 zn(this._candidates.map(i=>i.connector)))}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},bf=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=Yc(this._connection.line.point2)}candidates(){return this._candidates}collectAndMarkCandidates(){this._candidates=this._mediator.execute(new Ri(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 Bn(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(Yp(n,r))}onPointerUp(){this._draw(this._anchorRect,this._targetRef.connector.fConnectableSide),this._snap?.hide(),this._mediator.execute(new zn(this._candidates.map(i=>i.connector)))}_findClosest(i){return this._mediator.execute(new cn(i,this._candidates))}_draw(i,e){let n=this._behaviour.handle(new pt(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 pt(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))}},wf=(()=>{class t extends qe{type="reassign-connection";kind="reassign-connection";data(){return{fConnectionId:this._connection.fId()}}_result=d(Gt);_mediator=d(R);_connectionBehaviour=d(Hn);_store=d(T);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 it(this._store.outputs.require(this._connection.fOutputId()))),this._targetRef=this._mediator.execute(new it(this._store.inputs.require(this._connection.fInputId()))),this._reassignHandler=this._draggedEnd==="target"?this._createTargetHandler():this._createSourceHandler()}_createSourceHandler(){return new xf(this._mediator,this._connectionBehaviour,this._connection,this._sourceRef,this._targetRef)}_createTargetHandler(){return new bf(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:Yc(this._connection.line.point1),targetAnchorRect:Yc(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=g({token:t,factory:t.\u0275fac})}return t})(),rv=(()=>{let t=class ns{_mediator=d(R);_store=d(T);_dragContext=d(K);_dragInjector=d(ze);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=jn(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=>iv(n,e))}_capturePointerDown(e){this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=q.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(this._transform.scale)}_startDrag(e,n){let o=this._dragInjector.get(wf);o.initialize(e,Xp(e,n)),this._dragContext.draggableItems=[o]}_isValidTrigger(e){return ct(e.event.originalEvent,e.fTrigger)}_bringToFront(e){this._mediator.execute(new ln(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||ns)};static \u0275prov=g({token:ns,factory:ns.\u0275fac})};return t=C([x(Kc)],t),t})(),Zc=class{event;static fToken=Symbol("DragConnectionWaypointFinalizeRequest");constructor(i){this.event=i}},Qc=class{connectionId;waypoints;constructor(i,e){this.connectionId=i,this.waypoints=e}},Jc=(()=>{class t extends qe{type="move-connection-waypoint";kind="drag-connection-waypoint";_store=d(T);_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=he({},this._pick.candidate),this._waypointsComponent.insert(this._pick.candidate)):this._pick?.waypoint&&(this._point=he({},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 Qc(this._connection.fId(),this._connection.fWaypoints()?.waypoints()||[])}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),sv=(()=>{let t=class is{_dragContext=d(K);get _fDragHandler(){return this._dragContext.draggableItems[0]}handle(e){this._isDroppedConnectionReassignEvent()&&this._fDragHandler.onPointerUp()}_isDroppedConnectionReassignEvent(){return this._dragContext.draggableItems.some(e=>e instanceof Jc)}static \u0275fac=function(n){return new(n||is)};static \u0275prov=g({token:is,factory:is.\u0275fac})};return t=C([x(Zc)],t),t})(),ed=class{event;fTrigger;static fToken=Symbol("DragConnectionWaypointPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},av=(()=>{let t=class os{_mediator=d(R);_store=d(T);_dragContext=d(K);_dragInjector=d(ze);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=jn(e.event.getPosition(),this._flowHost,this._transform),o=this._pickControlPoint(n);if(!o||!this._isValidTrigger(e))return;let r=this._dragInjector.get(Jc);r.setPick(o),this._dragContext.onPointerDownScale=this._transform.scale,this._dragContext.onPointerDownPosition=q.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 Ng(this._connections,e)}_isValidTrigger(e){return ct(e.event.originalEvent,e.fTrigger)}_updateConnectionLayer(e){this._mediator.execute(new ln(e,this._canvas.fConnectionsContainer().nativeElement))}static \u0275fac=function(n){return new(n||os)};static \u0275prov=g({token:os,factory:os.\u0275fac})};return t=C([x(ed)],t),t})(),cv=[Zy,Qy,Jy,Yy,ev,tv,nv,rv,av,sv],td=class{event;static fToken=Symbol("DropToGroupFinalizeRequest");constructor(i){this.event=i}},dv=1,xi=(()=>{class t extends qe{type="move-node-to-parent";kind="assign-to-container";_store=d(T);_dragSession=d(K);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(Re.GROUPING.DROP_ACTIVE)}onPointerMove(e){this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>this._updateActiveTarget(e),dv)}onPointerUp(){this._clearActiveTarget();for(let{node:e}of this._candidateGroups)e.hostElement.classList.remove(Re.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=q.fromPoint(this._dragSession.onPointerDownPosition).add(e),o=q.fromPoint(this._transform.position).add(this._transform.scaledPosition).div(this._transform.scale);return n.sub(o)}_findTargetUnderPointer(e){return this._candidateGroups.find(n=>G.isIncludePoint(n.rect,e))}_setActiveTarget(e){this._activeTarget?.node!==e.node&&(this._clearActiveTarget(),this._activeTarget=e,e.node.setClass(Re.GROUPING.OVER_BOUNDARY))}_clearActiveTarget(){this._activeTarget?.node.removeClass(Re.GROUPING.OVER_BOUNDARY),this._activeTarget=null}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),nd=class{nodesAndGroups;static fToken=Symbol("CreateDragNodeHierarchyRequest");constructor(i){this.nodesAndGroups=i}},Sf=class{rootHandlers;participants;constructor(i,e){this.rootHandlers=i,this.participants=e}},If=class{fNodeIds;constructor(i){this.fNodeIds=i}},Zf="move-node",Qf="drag-node";function lv(t){return t.getEvent().kind===Qf||t.getEvent().fEventType===Zf}var zt=(()=>{class t extends qe{type=Zf;kind=Qf;data(){return new If(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?G.union([e,o]):o}return e??G.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=g({token:t,factory:t.\u0275fac})}return t})(),id=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),s=this._clamp(i.y,n.y,o.y),a=i.x-r,l=i.y-s,h=this._quantizeSigned(a,this._quantizeStep),_=this._quantizeSigned(l,this._quantizeStep);e.value.x=r,e.value.y=s,e.edges.left=h<0,e.edges.right=h>0,e.edges.top=_<0,e.edges.bottom=_>0,e.overflow.x=Math.abs(h),e.overflow.y=Math.abs(_)}_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)}},Tf=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 lp(){return{value:{x:0,y:0},overflow:{x:0,y:0},edges:{left:!1,right:!1,top:!1,bottom:!1}}}var Ef=class{_snapper;_hardClamp;_hardResult=lp();_softClamps=[];_softResults=[];constructor(i,e,n){let o=i.get(T).fDraggable;this._snapper=new Tf(o,e),this._hardClamp=new id(n.hard,.5);for(let r of n.soft)this._softClamps.push(new id(r.limits,.5)),this._softResults.push(lp())}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 up(t,i,e){let{x:n,y:o,width:r,height:s}=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&&(s+=i.y),e.top&&i.y>0&&(o-=i.y,s+=i.y),G.initialize(n,o,r,s)}var Pf=class extends qe{_injector;nodeOrGroup;children;sourceConnectionHandlers;targetConnectionHandlers;type=Zf;kind=Qf;_startPosition=A.initialize();_startRect=G.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 be(e.hostElement)),this._startPosition=he({},e._position)}setConstraints(i){this._constraints=i,this._deltaConstraints=new Ef(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 G.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(Re.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(Re.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 rn(this.nodeOrGroup.fId(),G.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=up(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 rn(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 it(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=up(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=[]}},uv=(()=>{let t=class rs{_injector=d(Ke);handle({nodesAndGroups:e}){let n=this._createHandlerByNodeId(e),o=this._linkParentsAndCollectRoots(e,n);return new Sf(o,Array.from(n.values()))}_createHandlerByNodeId(e){let n=new Map;for(let o of e)n.set(o.fId(),new Pf(this._injector,o));return n}_linkParentsAndCollectRoots(e,n){let o=[];for(let r of e){let s=n.get(r.fId());if(!s)continue;let a=r.fParentId(),l=a?n.get(a):void 0;l?l.children.push(s):o.push(s)}return o}static \u0275fac=function(n){return new(n||rs)};static \u0275prov=g({token:rs,factory:rs.\u0275fac})};return t=C([x(nd)],t),t})(),od=class{nodeOrGroup;static fToken=Symbol("BuildDragNodeConstraintsRequest");constructor(i){this.nodeOrGroup=i}},bi=class{nodeOrGroup;childrenPaddings;static fToken=Symbol("ReadNodeBoundsWithPaddingsRequest");constructor(i,e){this.nodeOrGroup=i,this.childrenPaddings=e}},Mf=class{nodeOrGroup;boundingRect;innerRect;paddings;constructor(i,e,n,o){this.nodeOrGroup=i,this.boundingRect=e,this.innerRect=n,this.paddings=o}},fv=(()=>{let t=class ss{_mediator=d(R);handle({nodeOrGroup:e,childrenPaddings:n}){let o=this._readBoundingRect(e),r=this._readOwnPaddings(e,o),s=[r[0]+n[0],r[1]+n[1],r[2]+n[2],r[3]+n[3]],a=G.initialize(o.x+s[0],o.y+s[1],o.width-s[0]-s[2],o.height-s[1]-s[3]);return new Mf(e,o,a,s)}_readBoundingRect(e){return this._mediator.execute(new be(e.hostElement))}_readOwnPaddings(e,n){return this._mediator.execute(new dn(e,n))}static \u0275fac=function(n){return new(n||ss)};static \u0275prov=g({token:ss,factory:ss.\u0275fac})};return t=C([x(bi)],t),t})(),hv=(()=>{let t=class as{_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 be(e.hostElement))}_readParentsChain(e){return this._mediator.execute(new Ln(e))??[]}_buildConstraints(e,n){let o=[],r=Gp(),s=[0,0,0,0];for(let a of e){let l=this._readParentBounds(a,s);s=l.paddings;let h=this._calculateDifference(l.innerRect,n);if(this._isAutoExpand(a))o.push(this._makeSoftLimit(a,l.boundingRect,h));else{r=h;break}}return{soft:o,hard:r}}_readParentBounds(e,n){return this._mediator.execute(new bi(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||as)};static \u0275prov=g({token:as,factory:as.\u0275fac})};return t=C([x(od)],t),t})(),rd=class{rootHandlers;participants;static fToken=Symbol("CreateDragNodeHandlerRequest");constructor(i,e){this.rootHandlers=i,this.participants=e}},sd=class{dragHandler;constraints;handlerPool;static fToken=Symbol("AttachSoftParentConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.constraints=e,this.handlerPool=n}},wi=class{_mediator=d(R);_store=d(T);_behaviour=d(Hn);_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 on(this._source.fId(),this._source.kind,this._withDelta(this._sourceRef.rect,i)))}setTargetDelta(i){this._targetDelta=i,this._mediator.execute(new on(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=Ee.fromRoundedRect(this._sourceRef.rect).addPoint(this._sourceDelta),e=Ee.fromRoundedRect(this._targetRef.rect).addPoint(this._targetDelta);return this._behaviour.handle(new pt(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 it(i))}_withDelta(i,e){return Ee.fromRoundedRect(i).addPoint(e)}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},Si=(()=>{class t extends wi{setSourceDelta(e){super.setSourceDelta(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),Ii=(()=>{class t extends wi{_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=g({token:t,factory:t.\u0275fac})}return t})(),Ti=(()=>{class t extends wi{setTargetDelta(e){super.setTargetDelta(e),this.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),pv=(()=>{let t=class cs{_store=d(T);_mediator=d(R);_dragInjector=d(ze);handle({dragHandler:e,constraints:n,handlerPool:o}){let r=n.soft.map(s=>this._buildParentConnectionHandlers(s.nodeOrGroup,o));e.setSoftParentConnectionHandlers(r)}_buildParentConnectionHandlers(e,n){let o=this._store.outputs.getAll().filter(_=>_.fNodeId===e.fId()),r=this._store.inputs.getAll().filter(_=>_.fNodeId===e.fId());if(!o.length&&!r.length)return{source:[],target:[]};let s=new Set(o.map(_=>_.fId())),a=new Set(r.map(_=>_.fId())),l=new Map,h={source:[],target:[]};for(let _ of this._store.connections.getAll()){let v=s.has(_.fOutputId()),S=a.has(_.fInputId());if(!v&&!S)continue;let I=this._getExistingConnectionHandler(n,_);if(I||(I=this._createConnectionHandler(_,v,S),n.push(I)),v){let N=this._store.outputs.require(_.fOutputId());h.source.push({handler:I,connector:N,baselineRect:this._readConnectorRect(N,l)})}if(S){let N=this._store.inputs.require(_.fInputId());h.target.push({handler:I,connector:N,baselineRect:this._readConnectorRect(N,l)})}}return h}_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(Ii):n?r=this._dragInjector.createInstance(Si):r=this._dragInjector.createInstance(Ti),r.initialize(e),r}_readConnectorRect(e,n){let o=`${e.kind}::${e.fId()}`,r=n.get(o);if(r)return r;let s=this._mediator.execute(new it(e)).rect;return n.set(o,s),s}static \u0275fac=function(n){return new(n||cs)};static \u0275prov=g({token:cs,factory:cs.\u0275fac})};return t=C([x(sd)],t),t})(),mv=(()=>{let t=class ds{_dragInjector=d(ze);_mediator=d(R);handle({rootHandlers:e,participants:n}){let o=this._collectConnectionHandlers(n);this._applyConstraintsToRoots(e,o);let r=this._dragInjector.createInstance(zt);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 sd(e,n,o))}_calculateConstraints(e){return this._mediator.execute(new od(e))}static \u0275fac=function(n){return new(n||ds)};static \u0275prov=g({token:ds,factory:ds.\u0275fac})};return t=C([x(rd)],t),t})(),ad=class{dragHandler;sourceIds;handlerPool;static fToken=Symbol("AttachTargetConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.sourceIds=e,this.handlerPool=n}},_v=(()=>{let t=class ls{_store=d(T);_dragInjector=d(ze);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(Ii):o=this._dragInjector.createInstance(Ti),o.initialize(n),o}static \u0275fac=function(n){return new(n||ls)};static \u0275prov=g({token:ls,factory:ls.\u0275fac})};return t=C([x(ad)],t),t})(),cd=class{dragHandler;targetIds;handlerPool;static fToken=Symbol("AttachSourceConnectionDragHandlersToNodeRequest");constructor(i,e,n){this.dragHandler=i,this.targetIds=e,this.handlerPool=n}},gv=(()=>{let t=class us{_store=d(T);_dragInjector=d(ze);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(Ii):o=this._dragInjector.createInstance(Si),o.initialize(n),o}static \u0275fac=function(n){return new(n||us)};static \u0275prov=g({token:us,factory:us.\u0275fac})};return t=C([x(cd)],t),t})(),dd=class{nodeOrGroup;static fToken=Symbol("AttachDragNodeHandlerFromSelectionRequest");constructor(i){this.nodeOrGroup=i}},yv=(()=>{let t=class fs{_mediator=d(R);_store=d(T);_dragSession=d(K);handle({nodeOrGroup:e}){let n=this._collectSelected(e),o=this._withDeepChildren(n),r=this._mediator.execute(new nd(o)),s=this._collectSourceConnectorIds(o),a=this._collectTargetConnectorIds(o);return this._attachConnectionHandlers(r.participants,s,a),this._mediator.execute(new rd(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 Vn(o.fId()));n.push(...r)}return n}_collectSourceConnectorIds(e){return wu(e,n=>this._store.outputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_collectTargetConnectorIds(e){return wu(e,n=>this._store.inputs.getAll().filter(o=>o.fNodeId===n.fId()).map(o=>o.fId()))}_attachConnectionHandlers(e,n,o){let r=[];for(let s of e)this._mediator.execute(new cd(s,o,r)),this._mediator.execute(new ad(s,n,r))}static \u0275fac=function(n){return new(n||fs)};static \u0275prov=g({token:fs,factory:fs.\u0275fac})};return t=C([x(dd)],t),t})(),vv=[uv,hv,mv,_v,gv,pv,fv,yv];function Cv(t,i,e=10){let n=i.x,o=i.y,r=n+i.width,s=o+i.height,a=i.gravityCenter.x,l=i.gravityCenter.y,h,_,v=1/0,S,I,N=1/0,D=(k,O)=>{let z=O<0?-O:O;z<=e&&z<v&&(v=z,h=k,_=O)},M=(k,O)=>{let z=O<0?-O:O;z<=e&&z<N&&(N=z,S=k,I=O)};for(let k=0;k<t.length;k++){let O=t[k],z=O.x,V=O.y,U=z+O.width,ie=V+O.height,we=O.gravityCenter.x,ae=O.gravityCenter.y;D(z,n-z),D(U,n-U),D(we,a-we),D(z,r-z),D(U,r-U),M(V,o-V),M(ie,o-ie),M(ae,l-ae),M(V,s-V),M(ie,s-ie)}return{x:{guide:h,delta:_},y:{guide:S,delta:I}}}var fp=["left","top","width","height"],ld=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 fp){let n=i[e];n!=null&&(this._element.style[e]=`${n}px`)}}clearRect(){for(let i of fp)this._element.style.removeProperty(i)}destroy(){this._element.remove()}},Df=class{_horizontal;_vertical;constructor(i,e){this._horizontal=new ld(i,e),this._vertical=new ld(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()}},ud=class{static fToken=Symbol("MagneticLinesPreparationRequest")},xv=(()=>{let t=class hs{_mediator=d(R);_store=d(T);_browser=d(Pe);_injector=d(Ke);_dragSession=d(K);_renderer;handle(e){let n=this._store.instances.get(xe.MAGNETIC_LINES);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof zt);o&&o.setMagneticLines(new kf(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 Df(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 be(r.hostElement)))}static \u0275fac=function(n){return new(n||hs)};static \u0275prov=g({token:hs,factory:hs.\u0275fac})};return t=C([x(ud)],t),t})(),kf=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(T);this._alignThreshold=r.instances.require(xe.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 Cv(this._rects,i,this._alignThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},hp=["top","center","bottom"],pp=["left","center","right"];function bv(t,i,e=10,n=10){let o=i.x,r=i.y,s=o+i.width,a=r+i.height,l=i.gravityCenter.x,h=i.gravityCenter.y,_=wv(t,i,o,r,s,a,l,h,e,n),v=Sv(t,i,o,r,s,a,l,h,e,n);return _&&(!v||_.absDelta<=v.absDelta)?{axis:"x",delta:_.delta,gap:_.gap,rects:_.rects,alignMode:_.alignMode,crossDelta:_.crossDelta}:v?{axis:"y",delta:v.delta,gap:v.gap,rects:v.rects,alignMode:v.alignMode,crossDelta:v.crossDelta}:{rects:[]}}function wv(t,i,e,n,o,r,s,a,l,h){let _=1/0,v,S=0,I,N=[],D=0,M=[],k=[],O=[];for(let z=0;z<hp.length;z++){let V=z===0?n:z===1?a:r;M.length=0,k.length=0,O.length=0;let U=1/0,ie=-1/0,we=0,ae=1/0,Be=1/0;for(let fe=0;fe<t.length;fe++){let re=t[fe],Xn=z===0?re.y:z===1?re.gravityCenter.y:re.y+re.height,uu=V-Xn,xt=Tn(uu);if(xt>l)continue;M.push(fe),k.push(re.x),O.push(re.x+re.width);let Kn=re.y,Yn=re.y+re.height;Kn<U&&(U=Kn),Yn>ie&&(ie=Yn),(xt<ae||xt===ae&&fe<Be)&&(ae=xt,we=Xn,Be=fe)}let oe=M.length;if(oe<2)continue;Zp(M,k,O);let se=0;for(;se<oe&&k[se]<=s;)se++;let Ge=se>0&&se<oe,ge,et;Ge?(ge=se-1,et=se):se<=0?(ge=0,et=1):(ge=oe-2,et=oe-1);let tt=k[et]-O[ge];if(tt<0)continue;let Oe;if(Ge){Oe=O[ge]+tt;let fe=Oe+i.width,re=k[et]-fe;if(Tn(re-tt)>h)continue}else se<=0?Oe=k[0]-tt-i.width:Oe=O[oe-1]+tt;let qn=e-Oe,jt=Tn(qn);if(jt>h||jt>=_)continue;let lt=Iv(M,k,O,U,ie);if(Ge){let fe=Oe,re=Oe+i.width;lt.push({left:O[ge],top:U,width:fe-O[ge],height:ie-U}),lt.push({left:re,top:U,width:k[et]-re,height:ie-U})}else if(se<=0){let fe=Oe+i.width;lt.push({left:fe,top:U,width:k[0]-fe,height:ie-U})}else lt.push({left:O[oe-1],top:U,width:Oe-O[oe-1],height:ie-U});let lu=V-we;_=jt,v=qn,S=tt,I=hp[z],N=lt,D=lu}if(!(v===void 0||I===void 0))return{delta:v,absDelta:_,gap:S,rects:N,alignMode:I,crossDelta:D}}function Sv(t,i,e,n,o,r,s,a,l,h){let _=1/0,v,S=0,I,N=[],D=0,M=[],k=[],O=[];for(let z=0;z<pp.length;z++){let V=z===0?e:z===1?s:o;M.length=0,k.length=0,O.length=0;let U=1/0,ie=-1/0,we=0,ae=1/0,Be=1/0;for(let fe=0;fe<t.length;fe++){let re=t[fe],Xn=z===0?re.x:z===1?re.gravityCenter.x:re.x+re.width,uu=V-Xn,xt=Tn(uu);if(xt>l)continue;M.push(fe),k.push(re.y),O.push(re.y+re.height);let Kn=re.x,Yn=re.x+re.width;Kn<U&&(U=Kn),Yn>ie&&(ie=Yn),(xt<ae||xt===ae&&fe<Be)&&(ae=xt,we=Xn,Be=fe)}let oe=M.length;if(oe<2)continue;Zp(M,k,O);let se=0;for(;se<oe&&k[se]<=a;)se++;let Ge=se>0&&se<oe,ge,et;Ge?(ge=se-1,et=se):se<=0?(ge=0,et=1):(ge=oe-2,et=oe-1);let tt=k[et]-O[ge];if(tt<0)continue;let Oe;if(Ge){Oe=O[ge]+tt;let fe=Oe+i.height,re=k[et]-fe;if(Tn(re-tt)>h)continue}else se<=0?Oe=k[0]-tt-i.height:Oe=O[oe-1]+tt;let qn=n-Oe,jt=Tn(qn);if(jt>h||jt>=_)continue;let lt=Tv(M,k,O,U,ie);if(Ge){let fe=Oe,re=Oe+i.height;lt.push({left:U,top:O[ge],width:ie-U,height:fe-O[ge]}),lt.push({left:U,top:re,width:ie-U,height:k[et]-re})}else if(se<=0){let fe=Oe+i.height;lt.push({left:U,top:fe,width:ie-U,height:k[0]-fe})}else lt.push({left:U,top:O[oe-1],width:ie-U,height:Oe-O[oe-1]});let lu=V-we;_=jt,v=qn,S=tt,I=pp[z],N=lt,D=lu}if(!(v===void 0||I===void 0))return{delta:v,absDelta:_,gap:S,rects:N,alignMode:I,crossDelta:D}}function Iv(t,i,e,n,o){let r=[],s=o-n;for(let a=0;a<t.length-1;a++){let l=i[a+1]-e[a];l<0||r.push({left:e[a],top:n,width:l,height:s})}return r}function Tv(t,i,e,n,o){let r=[],s=o-n;for(let a=0;a<t.length-1;a++){let l=i[a+1]-e[a];l<0||r.push({left:n,top:e[a],width:s,height:l})}return r}function Zp(t,i,e){for(let n=1;n<i.length;n++){let o=i[n],r=e[n],s=t[n],a=n-1;for(;a>=0;){let l=i[a],h=t[a];if(l<o||l===o&&h<s)break;i[a+1]=l,e[a+1]=e[a],t[a+1]=h,a--}i[a+1]=o,e[a+1]=r,t[a+1]=s}}function Tn(t){return t<0?-t:t}var Rf=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()}},Nf=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 s=0;s<i.length;s++){let a=this._getOrCreate(s),l=i[s];a.show(),a.render(l.left*n+o,l.top*n+r,l.width*n,l.height*n)}for(let s=i.length;s<this._activeCount;s++)this._pool[s].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 Rf(this._browser,this._hostElement,this._className);return this._pool.push(e),e}},fd=class{static fToken=Symbol("MagneticRectsPreparationRequest")},Ev=(()=>{let t=class ps{_mediator=d(R);_store=d(T);_browser=d(Pe);_injector=d(Ke);_dragSession=d(K);_renderer;handle(e){let n=this._store.instances.get(xe.MAGNETIC_RECTS);if(!n)return;let o=this._dragSession.draggableItems.find(r=>r instanceof zt);o&&o.setMagneticRects(new Of(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 Nf(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 be(r.hostElement)))}static \u0275fac=function(n){return new(n||ps)};static \u0275prov=g({token:ps,factory:ps.\u0275fac})};return t=C([x(fd)],t),t})(),Of=class{_renderer;_rects;_timerId=null;_canvasTransform;_alignThreshold=10;_spacingThreshold=10;constructor(i,e,n){this._renderer=e,this._rects=n;let o=i.get(T),r=o.instances.require(xe.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 bv(this._rects,i,this._alignThreshold,this._spacingThreshold)}clearGuides(){this._renderer.hideAll(),this._timerId&&(clearTimeout(this._timerId),this._timerId=null)}},hd=class{event;static fToken=Symbol("DragNodeFinalizeRequest");constructor(i){this.event=i}},Ff=class{nodes;fNodes;constructor(i){this.nodes=i,this.fNodes=i}},Pv=(()=>{let t=class ms{_mediator=d(R);_store=d(T);_dragSession=d(K);_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(lv)}_buildDragDelta(e){return q.fromPoint(e).elementTransform(this._store.flowHost).div(this._dragSession.onPointerDownScale).sub(this._dragSession.onPointerDownPosition)}_applySnapToDelta(e,n,o){let r=e.x,s=e.y;return n&&(r=this._hasLineSnapValue(n.x)?e.x-(n.x.delta||0):r,s=this._hasLineSnapValue(n.y)?e.y-(n.y.delta||0):s),this._hasRectSnapValue(o)&&(o.axis==="x"?(r=e.x-o.delta,s=e.y-(o.crossDelta??0)):(s=e.y-o.delta,r=e.x-(o.crossDelta??0))),{x:r,y:s}}_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(),s=((n.data??n.fData)?.fNodeIds??[]).map(a=>({id:a,position:this._store.nodes.get(a)?._position}));return new Ff(s)}_emitNodeIntersectIfNeeded(e){if(!this._isDraggedJustOneNode(e)||!this._store.fDraggable?.fEmitOnNodeIntersect)return;let n=e.roots[0].nodeOrGroup;queueMicrotask(()=>this._mediator.execute(new Lc(n)))}_isDraggedJustOneNode(e){return e.roots.length===1}static \u0275fac=function(n){return new(n||ms)};static \u0275prov=g({token:ms,factory:ms.\u0275fac})};return t=C([x(hd)],t),t})(),pd=class{event;trigger;static fToken=Symbol("DragNodePreparationRequest");constructor(i,e){this.event=i,this.trigger=e}},Mv=(()=>{let t=class _s{_mediator=d(R);_store=d(T);_dragSession=d(K);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 ud),this._mediator.execute(new fd))}_canStartDrag(e,n){return this._dragSession.isEmpty()&&this._isDragHandle(e.targetElement)&&ct(e.originalEvent,n)}_isDragHandle(e){return ni(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=q.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(this._store.transform.scale)}_buildDragNodeHandler(e){return(e.fSelectionDisabled()||!e.isSelected())&&queueMicrotask(()=>{this._mediator.execute(new Gn(e))}),this._mediator.execute(new dd(e))}static \u0275fac=function(n){return new(n||_s)};static \u0275prov=g({token:_s,factory:_s.\u0275fac})};return t=C([x(pd)],t),t})(),Dv=[...vv,xv,Ev,Pv,Mv],Af=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}},kv=(()=>{let t=class gs{_dragSession=d(K);_store=d(T);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 xi)}_emitDropToGroupEvent(e,n){this._store.fDraggable?.fDropToGroup.emit(new Af(e,this._getTopLevelDraggedIds(),n.getPosition()))}_getTopLevelDraggedIds(){let n=this._getMoveSummaryHandler().items.map(s=>s.nodeOrGroup),o=new Set(n.map(s=>s.fId())),r=[];for(let s of n){let a=s.fParentId();(!a||!o.has(a))&&r.push(s.fId())}return r}_getMoveSummaryHandler(){let e=this._dragSession.draggableItems.find(n=>n instanceof zt);if(!e)throw new Error("DropToGroup requires DragNodeHandler.");return e}static \u0275fac=function(n){return new(n||gs)};static \u0275prov=g({token:gs,factory:gs.\u0275fac})};return t=C([x(td)],t),t})(),md=class{event;static fToken=Symbol("DropToGroupPreparationRequest");constructor(i){this.event=i}},_d=class{candidates;static fToken=Symbol("SortDropCandidatesByLayerRequest");constructor(i){this.candidates=i}},Rv=(()=>{let t=class ys{handle({candidates:e}){let n=e.map((o,r)=>({candidate:o,index:r}));return n.sort((o,r)=>{let s=this._compareDomOrder(o.candidate.node.hostElement,r.candidate.node.hostElement);return s!==0?-s: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},s=n.getBoundingClientRect?.()??{top:0,left:0};return r.top!==s.top?r.top<s.top?-1:1:r.left!==s.left?r.left<s.left?-1:1:0}return 0}static \u0275fac=function(n){return new(n||ys)};static \u0275prov=g({token:ys,factory:ys.\u0275fac})};return t=C([x(_d)],t),t})(),Lf=class{_onPointerDown;_limit;_vCellSize;_hCellSize;_adjustCellSize;constructor(i,e,n){this._onPointerDown=e,this._limit=n;let o=i.get(T);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}},gd=class{externalItem;static fToken=Symbol("DragExternalItemCreatePlaceholderRequest");constructor(i){this.externalItem=i}},Nv=(()=>{let t=class vs{_browser=d(Pe);_containerRef=d(oo);handle({externalItem:e}){let{hostElement:n,placeholder:o}=e,r=o(),s=r?this._fromTemplate(r):this._fromHost(n);return s.classList.add("f-external-item-placeholder"),s.style.pointerEvents="none",s}_fromTemplate(e){return Tu(this._createViewRef(e),this._browser.document)}_fromHost(e){return Su(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}static \u0275fac=function(n){return new(n||vs)};static \u0275prov=g({token:vs,factory:vs.\u0275fac})};return t=C([x(gd)],t),t})(),yd=class{externalItem;static fToken=Symbol("DragExternalItemCreatePreviewRequest");constructor(i){this.externalItem=i}},Ov=(()=>{let t=class Cs{_browser=d(Pe);_containerRef=d(oo);handle({externalItem:e}){let{hostElement:n,preview:o}=e,r=o(),s=r?this._fromTemplate(r):this._fromHost(n);return this._setPreviewStyles(s),qh(s),s.classList.add("f-external-item-preview"),s}_fromTemplate(e){return Tu(this._createViewRef(e),this._browser.document)}_fromHost(e){return Su(e)}_createViewRef(e){let n=this._containerRef.createEmbeddedView(e);return n.detectChanges(),n}_setPreviewStyles(e){Iu(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||Cs)};static \u0275prov=g({token:Cs,factory:Cs.\u0275fac})};return t=C([x(yd)],t),t})(),vd=class{event;static fToken=Symbol("DragExternalItemFinalizeRequest");constructor(i){this.event=i}},Bf=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}},Fv="external-item",Av="drag-external-item";function Lv(t){return t.getEvent().kind===Av||t.getEvent().fEventType===Fv}var Bv=(()=>{let t=class xs{_result=d(Gt);_mediator=d(R);_store=d(T);_dragSession=d(K);_browser=d(Pe);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=>Lv(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 xi);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 Bf(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 be(this._result.getData().preview))}static \u0275fac=function(n){return new(n||xs)};static \u0275prov=g({token:xs,factory:xs.\u0275fac})};return t=C([x(vd)],t),t})(),zf=class{data;constructor(i){this.data=i}},Cd=class extends qe{_externalItem;_pointerDownClientPosition;type="external-item";kind="drag-external-item";data(){return new zf(this._externalItem.data())}_result;_mediator;_browser;_store;_previewEl;_placeholderEl;_startRect=G.initialize();_pointerDownRect=G.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(T),this._result=i.get(Gt),this._mediator=i.get(R),this._browser=i.get(Pe),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 Lf(i,this._startRect,Gp());this._applyConstraints=n=>e.limit(n)}_getStartRect(){return this._mediator.execute(new be(this._externalItem.hostElement))}prepareDragSequence(){this._pointerDownRect=this._readAbsoluteRect(this._host),this._absoluteOffsetFromFlow=q.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 yd(this._externalItem));return this._externalItem.previewMatchSize()&&this._matchSize(i,this._pointerDownRect),i.style.transform=mp(this._pointerDownRect),i}_createPlaceholder(){return this._mediator.execute(new gd(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=q.fromPoint(this._startRect).add(o),s=this._toAbsolutePoint(r).add(this._absoluteOffsetFromFlow);this._previewEl.style.transform=mp(s)}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 G.initialize(e.left+o,e.top+n,e.width,e.height)}_toAbsolutePoint(i){let e=q.fromPoint(this._transform.position).add(this._transform.scaledPosition);return q.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 q.fromPoint(r).sub(this._startRect)}_toFlowPoint(i){let e=this._getFlowHostAbsolutePosition(),n=q.fromPoint(this._transform.position).add(this._transform.scaledPosition);return q.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 q.fromPoint(i).add(A.initialize(n,e))}};function mp({x:t,y:i}){return`translate3d(${Math.round(t)}px, ${Math.round(i)}px, 0)`}var xd=class{event;fTrigger;static fToken=Symbol("DragExternalItemPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}};function zv(t){return!!t.closest?.("[fExternalItem]")}function Gv(t){return t.closest("[fExternalItem]")}var Vv=(()=>{class t{_byHost=new Map;_items=X([]);items=E(()=>this._items());getByElement(e){let n=Gv(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=g({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var Hv=(()=>{let t=class bs{_apiService=d(Vv);_dragSession=d(K);_store=d(T);_injector=d(Ke);get _flowHost(){return this._store.flowHost}get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!ct(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=q.fromPoint(e.getPosition()).elementTransform(this._flowHost).div(r),this._dragSession.draggableItems=[new Cd(this._injector,o,e.getPosition())]}_resolveExternalItem(e){return this._apiService.getByElement(e)}static \u0275fac=function(n){return new(n||bs)};static \u0275prov=g({token:bs,factory:bs.\u0275fac})};return t=C([x(xd)],t),t})(),bd=class{event;static fToken=Symbol("PreventDefaultIsExternalItemRequest");constructor(i){this.event=i}},jv=(()=>{let t=class ws{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=zv(e)}catch{}return n}static \u0275fac=function(n){return new(n||ws)};static \u0275prov=g({token:ws,factory:ws.\u0275fac})};return t=C([x(bd)],t),t})(),Uv=[Nv,Ov,Bv,Hv,jv],$v=(()=>{let t=class Ss{_mediator=d(R);_dragContext=d(K);_store=d(T);_dragInjector=d(ze);get _allNodes(){return this._store.nodes.getAll()}handle({event:e}){if(!this._canPrepare())return;let n=this._allNodes.find(s=>s.isContains(e.targetElement));if(!n&&!this._hasExternalDrag())throw new Error("Drag target node not found");let o=this._sortedTargetsForDrop();if(n){let s=n.fParentId(),a=this._mediator.execute(new Qd(s));a.length&&(o=o.filter(l=>a.includes(l.node.fId())))}let r=this._dragInjector.get(xi);r.initialize(o),this._dragContext.draggableItems.push(r)}_canPrepare(){return this._hasMoveDrag()||this._hasExternalDrag()}_hasMoveDrag(){return this._dragContext.draggableItems.some(e=>e instanceof zt)}_hasExternalDrag(){return this._dragContext.draggableItems.some(e=>e instanceof Cd)}_sortedTargetsForDrop(){let e=this._getDraggedNodes(),n=e.some(a=>a instanceof yf),o=this._withParents(e),s=this._eligibleTargets(o,n).map(a=>{let l=this._mediator.execute(new be(a.hostElement));return{node:a,rect:l}});return this._mediator.execute(new _d(s))}_getDraggedNodes(){let e=this._dragContext.draggableItems.find(n=>n instanceof zt);return e?e.items.map(n=>n.nodeOrGroup):[]}_withParents(e){return e.reduce((n,o)=>{n.push(o);let r=this._mediator.execute(new Ln(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 yf):o}static \u0275fac=function(n){return new(n||Ss)};static \u0275prov=g({token:Ss,factory:Ss.\u0275fac})};return t=C([x(md)],t),t})(),Wv=[Rv,$v,kv],wd=class{event;static fToken=Symbol("PinchToZoomFinalizeRequest");constructor(i){this.event=i}},qv=.5,Sd=(()=>{class t extends qe{type="pinch-to-zoom";kind="pinch-to-zoom";_store=d(T);get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.require(xe.ZOOM)}_startDistance=null;_startScale=null;_touches;initialize(e){this._touches=e}prepareDragSequence(){let e=_p(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=_p(n.touches),r=Xv(n.touches);if(o==null||r==null){this._reset();return}if(Math.abs(o-this._startDistance)<qv)return;n.preventDefault();let s=o/this._startDistance,a=this._clamp(this._startScale*s);this._canvas.setScale(a,this._castPositionToFlow(r)),this._canvas.redraw()}_clamp(e){return Math.max(this._zoomComponent.minimum,Math.min(e,this._zoomComponent.maximum))}_castPositionToFlow(e){return q.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=g({token:t,factory:t.\u0275fac})}return t})();function Xv(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 _p(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 Kv=(()=>{let t=class Is{_dragSession=d(K);handle(e){if(this._hasPinchZoomHandler())for(let n of this._dragSession.draggableItems)n.onPointerUp?.()}_hasPinchZoomHandler(){return this._dragSession.draggableItems.some(e=>e instanceof Sd)}static \u0275fac=function(n){return new(n||Is)};static \u0275prov=g({token:Is,factory:Is.\u0275fac})};return t=C([x(wd)],t),t})(),Id=class{event;static fToken=Symbol("PinchToZoomPreparationRequest");constructor(i){this.event=i}},Yv=(()=>{let t=class Ts{_dragInjector=d(ze);_store=d(T);_dragSession=d(K);handle({event:e}){this._canStart(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=new q,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(xe.ZOOM)}_getHandler(e){let n=this._dragInjector.get(Sd);return n.initialize(e.touches),n}static \u0275fac=function(n){return new(n||Ts)};static \u0275prov=g({token:Ts,factory:Ts.\u0275fac})};return t=C([x(Id)],t),t})(),Zv=[Yv,Kv],Td=class{event;static fToken=Symbol("SelectionAreaFinalizeRequest");constructor(i){this.event=i}},Qv=(()=>{let t=class Es{_dragSession=d(K);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||Es)};static \u0275prov=g({token:Es,factory:Es.\u0275fac})};return t=C([x(Td)],t),t})(),Gf=(()=>{class t extends qe{type="selection-area";kind="selection-area";_store=d(T);_dragSession=d(K);_mediator=d(R);_canBeSelected=[];_selectedByMove=[];get _transform(){return this._store.transform}get _canvasPosition(){return q.fromPoint(this._transform.position).add(this._transform.scaledPosition)}get _instance(){return this._store.instances.require(xe.SELECTION_AREA)}prepareDragSequence(){this._canBeSelected=this._mediator.execute(new ll),this._show(),this._draw(G.initialize(this._dragSession.onPointerDownPosition.x,this._dragSession.onPointerDownPosition.y))}onPointerMove(e){let n=q.fromPoint(e).add(this._dragSession.onPointerDownPosition),o=this._getMinimumPoint(this._dragSession.onPointerDownPosition,n),r=Math.abs(e.x),s=Math.abs(e.y),a=G.initialize(o.x,o.y,r,s);this._draw(a),this._selectedByMove=[],this._canBeSelected.forEach(l=>{l.element.unmarkAsSelected();let h=G.addPoint(G.mult(l.fRect,this._transform.scale),this._canvasPosition);G.intersectionWithRect(h,a)&&(l.element.markAsSelected(),this._selectedByMove.push(l.element))}),this._mediator.execute(new At)}_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=g({token:t,factory:t.\u0275fac})}return t})(),Ed=class{event;static fToken=Symbol("SelectionAreaPreparationRequest");constructor(i){this.event=i}},Jv=(()=>{let t=class Ps{_store=d(T);_dragSession=d(K);_dragInjector=d(ze);get _instance(){return this._store.instances.get(xe.SELECTION_AREA)}handle(e){this._isValid(e)&&(this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=q.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost),this._dragSession.draggableItems=[this._dragInjector.createInstance(Gf)])}_isValid(e){return!!this._instance&&this._dragSession.isEmpty()&&ct(e.event.originalEvent,this._instance.fTrigger)}static \u0275fac=function(n){return new(n||Ps)};static \u0275prov=g({token:Ps,factory:Ps.\u0275fac})};return t=C([x(Ed)],t),t})(),eC=[Jv,Qv],Pd=class{rect;childrenBounds;static fToken=Symbol("ApplyChildResizeConstraintsRequest");constructor(i,e){this.rect=i,this.childrenBounds=e}},tC=(()=>{let t=class Ms{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||Ms)};static \u0275prov=g({token:Ms,factory:Ms.\u0275fac})};return t=C([x(Pd)],t),t})(),Md=class{rect;limits;static fToken=Symbol("ApplyParentResizeConstraintsRequest");constructor(i,e){this.rect=i,this.limits=e}},nC=(()=>{let t=class Ds{_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=he({},e);return n.hardLimit&&this._clampRectToInner(o,n.hardLimit.innerRect),o}_clampRectToInner(e,n){if(e.x<n.x){let s=n.x-e.x;e.x+=s,e.width-=s}if(e.y<n.y){let s=n.y-e.y;e.y+=s,e.height-=s}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,s=this._computeOverflow(o,e);if(!this._hasOverflow(s)){this._applyParentRect(n,r);return}let a=this._buildExpandedParentRect(r,s);this._applyParentRect(n,a)}_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),s=Math.max(0,n.x+n.width-(e.x+e.width)),a=Math.max(0,n.y+n.height-(e.y+e.height));return{left:o,top:r,right:s,bottom:a}}_buildExpandedParentRect(e,n){let o=he({},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 rn(e.nodeOrGroup.fId(),n)),e.nodeOrGroup.redraw()}static \u0275fac=function(n){return new(n||Ds)};static \u0275prov=g({token:Ds,factory:Ds.\u0275fac})};return t=C([x(Md)],t),t})(),Dd=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}},gp={[gt.LEFT]:{x:-1,y:0},[gt.LEFT_TOP]:{x:-1,y:-1},[gt.TOP]:{x:0,y:-1},[gt.RIGHT_TOP]:{x:1,y:-1},[gt.RIGHT]:{x:1,y:0},[gt.RIGHT_BOTTOM]:{x:1,y:1},[gt.BOTTOM]:{x:0,y:1},[gt.LEFT_BOTTOM]:{x:-1,y:1}},iC=(()=>{let t=class ks{handle({originalRect:e,difference:n,handleType:o,minimumSize:r}){let s=this._changeSizeInRect(e,n,gp[o],r);return this._changePosition(e,n,gp[o],s)}_changeSizeInRect(e,n,o,r){let s=e.width+o.x*n.x,a=e.height+o.y*n.y,l=0,h=0;return s<0&&(l=s,s=Math.abs(s)),s<r.width&&(o.x===-1&&(l+=s-r.width),s=r.width),a<0&&(h=a,a=Math.abs(a)),a<r.height&&(o.y===-1&&(h+=a-r.height),a=r.height),G.initialize(l,h,s,a)}_changePosition(e,n,o,r){let s=e.x+(o.x===-1?n.x:0)+r.x,a=e.y+(o.y===-1?n.y:0)+r.y;return G.initialize(s,a,r.width,r.height)}static \u0275fac=function(n){return new(n||ks)};static \u0275prov=g({token:ks,factory:ks.\u0275fac})};return t=C([x(Dd)],t),t})(),kd=class{nodeOrGroup;paddings;static fToken=Symbol("CalculateDirectChildrenUnionRectRequest");constructor(i,e){this.nodeOrGroup=i,this.paddings=e}},oC=(()=>{let t=class Rs{_mediator=d(R);_store=d(T);get _allNodesAndGroups(){return this._store.nodes.getAll()}handle({nodeOrGroup:e,paddings:n}){let o=G.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 be(e.hostElement))}_concatRectWithParentPadding(e,n){return G.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||Rs)};static \u0275prov=g({token:Rs,factory:Rs.\u0275fac})};return t=C([x(kd)],t),t})(),Ei=class{nodeOrGroup;rect;static fToken=Symbol("CalculateResizeLimitsRequest");constructor(i,e){this.nodeOrGroup=i,this.rect=e}},rC=(()=>{let t=class Ns{_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 dn(e,n))}_getNormalizedChildrenBounds(e,n){return this._mediator.execute(new kd(e,n))}_getParentsChain(e){return this._mediator.execute(new Ln(e))??[]}_buildSoftHardLimits(e){let n=[],o,r=[0,0,0,0];for(let s of e){let a=this._getParentInfo(s,r);if(r=a.paddings,this._isAutoExpand(s))n.push(this._makeLimit(s,a));else{o=this._makeLimit(s,a);break}}return{softLimits:n,hardLimit:o}}_getParentInfo(e,n){return this._mediator.execute(new bi(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||Ns)};static \u0275prov=g({token:Ns,factory:Ns.\u0275fac})};return t=C([x(Ei)],t),t})(),Rd=class{event;static fToken=Symbol("ResizeNodeFinalizeRequest");constructor(i){this.event=i}},Qp="node-resize",Jp="resize-node";function sC(t){return t.getEvent().kind===Jp||t.getEvent().fEventType===Qp}var aC=(()=>{let t=class Os{_dragSession=d(K);handle(e){this._isNodeResizeHandler()&&this._dragSession.draggableItems.forEach(n=>n.onPointerUp?.())}_isNodeResizeHandler(){return this._dragSession.draggableItems.some(e=>sC(e))}static \u0275fac=function(n){return new(n||Os)};static \u0275prov=g({token:Os,factory:Os.\u0275fac})};return t=C([x(Rd)],t),t})(),Vf=class{fNodeId;constructor(i){this.fNodeId=i}},Hf=(()=>{class t extends qe{type=Qp;kind=Jp;data(){return new Vf(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 be(this._nodeOrGroup.hostElement))}_buildConstraints(e){return this._mediator.execute(new Ei(this._nodeOrGroup,e))}_calcNextRect(e){return this._mediator.execute(new Dd(this._baselineRect,e,this._handleType,this._constraints.minimumSize))}_applyConstraints(e){this._mediator.execute(new Pd(e,this._constraints.childrenBounds)),this._mediator.execute(new Md(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 rn(this._nodeOrGroup.fId(),e)),this._nodeOrGroup.redraw()}_fallbackRectFromModel(){return G.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 s=this._mediator.execute(new Lt(e.hostElement,!1));return n.set(o,s),s}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),Pi=class{_mediator=d(R);_store=d(T);_behaviour=d(Hn);_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=Ee.fromRoundedRect(this._sourceRef.rect),this._targetRect=Ee.fromRoundedRect(this._targetRef.rect)}setSourceRect(i){this._sourceRect=Ee.fromRoundedRect(i),this._mediator.execute(new on(this._source.fId(),this._source.kind,this._sourceRect))}setTargetRect(i){this._targetRect=Ee.fromRoundedRect(i),this._mediator.execute(new on(this._target.fId(),this._target.kind,this._targetRect))}redraw(){let i=this._buildLine();this.connection.setLine(i),this.connection.redraw()}_buildLine(){let i=Ee.fromRoundedRect(this._sourceRect),e=Ee.fromRoundedRect(this._targetRect);return this._behaviour.handle(new pt(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 Lt(i.hostElement,!1))}}_resolveRotationContext(i){return this._mediator.execute(new Et(i))}},cC=(()=>{class t extends Pi{_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=g({token:t,factory:t.\u0275fac})}return t})(),dC=(()=>{class t extends Pi{setSourceRect(e){super.setSourceRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),lC=(()=>{class t extends Pi{setTargetRect(e){super.setTargetRect(e),super.redraw()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),Nd=class{event;fTrigger;static fToken=Symbol("ResizeNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},Od=class{handler;nodeOrGroup;static fToken=Symbol("AttachResizeConnectionDragHandlersToNodeRequest");constructor(i,e){this.handler=i,this.nodeOrGroup=e}},uC=(()=>{let t=class Fs{_store=d(T);_mediator=d(R);_dragInjector=d(ze);handle({handler:e,nodeOrGroup:n}){let o=this._readSoftParents(n),r=[n,...o],s=this._collectSourceConnectorIds(r),a=this._collectTargetConnectorIds(r),l=new Map;e.setNodeConnectionHandlers(this._buildConnectionHandlersForNode(n,s,a,l)),e.setSoftParentConnectionHandlers(o.map(h=>this._buildConnectionHandlersForNode(h,s,a,l)))}_readSoftParents(e){let n=this._mediator.execute(new be(e.hostElement));return this._mediator.execute(new Ei(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 s=this._store.outputs.getAll().filter(v=>v.fNodeId===e.fId()),a=this._store.inputs.getAll().filter(v=>v.fNodeId===e.fId());if(!s.length&&!a.length)return{source:[],target:[]};let l=new Set(s.map(v=>v.fId())),h=new Set(a.map(v=>v.fId())),_={source:[],target:[]};for(let v of this._store.connections.getAll()){let S=l.has(v.fOutputId()),I=h.has(v.fInputId());if(!S&&!I)continue;let N=r.get(v.fId())??this._createConnectionHandler(v,n,o);if(r.set(v.fId(),N),S){let D=this._store.outputs.require(v.fOutputId());_.source.push({handler:N,connector:D})}if(I){let D=this._store.inputs.require(v.fInputId());_.target.push({handler:N,connector:D})}}return _}_createConnectionHandler(e,n,o){let r=n.has(e.fOutputId()),s=o.has(e.fInputId()),a=r&&s?this._dragInjector.createInstance(cC):r?this._dragInjector.createInstance(dC):this._dragInjector.createInstance(lC);return a.initialize(e),a}static \u0275fac=function(n){return new(n||Fs)};static \u0275prov=g({token:Fs,factory:Fs.\u0275fac})};return t=C([x(Od)],t),t})(),fC=(()=>{let t=class As{_mediator=d(R);_store=d(T);_dragSession=d(K);_dragInjector=d(ze);get _transform(){return this._store.transform}handle({event:e,fTrigger:n}){if(!this._dragSession.isEmpty()||!this._isResizeHandle(e.targetElement)||!ct(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=q.fromPoint(e.getPosition()).elementTransform(this._store.flowHost).div(r);let s=this._dragInjector.createInstance(Hf);s.initialize(o,this._readResizeHandleType(e.targetElement)),this._mediator.execute(new Od(s,o)),this._dragSession.draggableItems=[s]}_isResizeHandle(e){return ni(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 Gn(e))})}_readResizeHandleType(e){let n=Xh(e,"fResizeHandleType",".f-resize-handle");return gt[n]}static \u0275fac=function(n){return new(n||As)};static \u0275prov=g({token:As,factory:As.\u0275fac})};return t=C([x(Nd)],t),t})(),hC=[tC,nC,iC,oC,rC,uC,aC,fC],Fd=class{event;static fToken=Symbol("RotateNodeFinalizeRequest");constructor(i){this.event=i}},em="node-rotate",tm="rotate-node";function pC(t){return t.getEvent().kind===tm||t.getEvent().fEventType===em}var mC=(()=>{let t=class Ls{_dragSession=d(K);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(e=>pC(e))}static \u0275fac=function(n){return new(n||Ls)};static \u0275prov=g({token:Ls,factory:Ls.\u0275fac})};return t=C([x(Fd)],t),t})(),Ad=class{event;fTrigger;static fToken=Symbol("RotateNodePreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},jf=class{fNodeId;constructor(i){this.fNodeId=i}};function _C(t,i,e){let{x:n,y:o}=gC(t,i,e),r=n-t.x,s=o-t.y;return{x:r,y:s}}function gC(t,i,e){let n=t.x-e.x,o=t.y-e.y,r=i*Math.PI/180,s=Math.cos(r),a=Math.sin(r),l=n*s-o*a,h=n*a+o*s,_=l+e.x,v=h+e.y;return{x:_,y:v}}var Uf=(()=>{class t extends qe{type=em;kind=tm;data(){return new jf(this._nodeOrGroup.fId())}_store=d(T);_mediator=d(R);_dragSession=d(K);_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 s=r-this._startRotation;for(let a of this._sourceConnections)a.connection.setSourceDelta(this._deltaAfterRotation(a.connector,s));for(let a of this._targetConnections)a.connection.setTargetDelta(this._deltaAfterRotation(a.connector,s))}onPointerUp(){this._nodeOrGroup.rotate.set(this._nodeOrGroup._rotate),this._nodeOrGroup.refresh()}_readNodeRect(){return this._mediator.execute(new be(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 _C(e,n,this._nodeCenter)}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),yC=(()=>{let t=class Bs{_mediator=d(R);_store=d(T);_dragContext=d(K);_dragInjector=d(ze);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=q.fromPoint(e.event.getPosition()).elementTransform(this._store.flowHost).div(o);let r=this._dragInjector.createInstance(Uf);r.initialize(n,this._buildOutputConnectionHandlers(n),this._buildInputConnectionHandlers(n)),this._dragContext.draggableItems=[r]}_isPreparationAllowed({event:e,fTrigger:n}){return this._dragContext.isEmpty()&&Vy(e.targetElement)&&ct(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 Gn(e))})}_buildInputConnectionHandlers(e){return this._mediator.execute(new Hd(e)).map(n=>{let o=this._store.inputs.require(n.fInputId()),r=this._mediator.execute(new it(o)),s=this._dragInjector.get(Ti);return s.initialize(n),{connection:s,connector:r.rect.gravityCenter}})}_buildOutputConnectionHandlers(e){return this._mediator.execute(new Zd(e)).map(n=>{let o=this._store.outputs.require(n.fOutputId()),r=this._mediator.execute(new it(o)),s=this._dragInjector.get(Si);return s.initialize(n),{connection:s,connector:r.rect.gravityCenter}})}static \u0275fac=function(n){return new(n||Bs)};static \u0275prov=g({token:Bs,factory:Bs.\u0275fac})};return t=C([x(Ad)],t),t})(),vC=[mC,yC],Mi=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}},CC=(()=>{let t=class zs{_store=d(T);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 q.fromPoint(e.gravityCenter).sub(e)}_getPositionInViewBox(e,n){let o=this.normalizeEventPoint(e,n);return A.sum(o,G.mult(n.viewBox,this._canvasScale))}normalizeEventPoint(e,n){return this._getEventPointInMinimap(e,n).mult(n.scale).mult(this._canvasScale)}_getEventPointInMinimap(e,n){return q.fromPoint(e).elementTransform(n.element)}static \u0275fac=function(n){return new(n||zs)};static \u0275prov=g({token:zs,factory:zs.\u0275fac})};return t=C([x(Mi)],t),t})(),Ld=class{event;static fToken=Symbol("DragMinimapFinalizeRequest");constructor(i){this.event=i}},xC=(()=>{let t=class Gs{_dragSession=d(K);handle(e){this._isValid()&&this._dragSession.draggableItems.forEach(n=>{n.onPointerUp?.()})}_isValid(){return this._dragSession.draggableItems.some(bC)}static \u0275fac=function(n){return new(n||Gs)};static \u0275prov=g({token:Gs,factory:Gs.\u0275fac})};return t=C([x(Ld)],t),t})(),nm="minimap",im="minimap";function bC(t){return t.getEvent().kind===im||t.getEvent().fEventType===nm}var $f=(()=>{class t extends qe{type=nm;kind=im;_store=d(T);_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(q.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 Mi(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=g({token:t,factory:t.\u0275fac})}return t})(),Bd=class{event;static fToken=Symbol("DragMinimapPreparationRequest");constructor(i){this.event=i}},wC=(()=>{let t=class Vs{_store=d(T);_mediator=d(R);_dragSession=d(K);_dragInjector=d(ze);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(xe.MINIMAP).state,o=e.getPosition(),r=q.fromPoint(this._store.transform.position),s=G.fromElement(this._flowHost);this._canvas.setPosition(this._calculateCanvasPosition(s,o,n)),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent(),this._dragSession.onPointerDownScale=1,this._dragSession.onPointerDownPosition=q.fromPoint(o).elementTransform(this._flowHost);let a=this._dragInjector.createInstance($f);a.initialize(s,r,o,n),this._dragSession.draggableItems=[a]}_isValid(e){return!(!this._dragSession.isEmpty()||!this._flowHost.contains(e.targetElement)||!e.targetElement.closest(".f-minimap")||!this._store.instances.get(xe.MINIMAP))}_calculateCanvasPosition(e,n,o){return this._mediator.execute(new Mi(e,q.fromPoint(this._canvas.transform.position),n,o))}static \u0275fac=function(n){return new(n||Vs)};static \u0275prov=g({token:Vs,factory:Vs.\u0275fac})};return t=C([x(Bd)],t),t})(),SC=[CC,xC,wC];function IC(t){return!!t&&typeof t.destroy=="function"}var ze=(()=>{class t{_injector=d(Ke);_dragInjector=null;_created=[];create(){this._dragInjector=Ke.create({providers:[{provide:zd,useClass:zd},{provide:Jc,useClass:Jc},{provide:Uc,useClass:Uc},{provide:wf,useClass:wf},{provide:xi,useClass:xi},{provide:Si,useClass:Si},{provide:Ti,useClass:Ti},{provide:Ii,useClass:Ii},{provide:zt,useClass:zt},{provide:Sd,useClass:Sd},{provide:Gf,useClass:Gf},{provide:Hf,useClass:Hf},{provide:Uf,useClass:Uf},{provide:$f,useClass:$f}],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=gh(this._dragInjector,()=>new e);return this._created.push(n),n}destroy(){for(let e of this._created)IC(e)&&e.destroy();this._created=[],this._dragInjector?.destroy?.(),this._dragInjector=null}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),Gt=(()=>{class t{_data;setData(e){this._data=he(he({},this._data),e)}getData(){return this._data}clear(){this._data=void 0}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),yp="f-canvas-dragging",vp="canvas-dragging",zd=(()=>{class t extends qe{type="canvas-move";kind="drag-canvas";_store=d(T);_onPointerDownPosition=A.initialize();constructor(){super(),this._store.fCanvas?.hostElement.classList.add(yp,vp)}prepareDragSequence(){this._onPointerDownPosition=this._store.transform.position}onPointerMove(e){this._store.fCanvas?.setPosition(q.fromPoint(this._onPointerDownPosition).add(e)),this._store.fCanvas?.redraw()}onPointerUp(){this._store.fCanvas?.emitCanvasChangeEvent(),this._store.fCanvas?.hostElement.classList.remove(yp,vp)}static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),TC=(()=>{let t=class Hs{_dragContext=d(K);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||Hs)};static \u0275prov=g({token:Hs,factory:Hs.\u0275fac})};return t=C([x(zc)],t),t})(),Gd=class{event;fTrigger;static fToken=Symbol("DragCanvasPreparationRequest");constructor(i,e){this.event=i,this.fTrigger=e}},EC=(()=>{let t=class js{_store=d(T);_dragContext=d(K);_dragInjector=d(ze);handle({event:e,fTrigger:n}){!this._isValid(e)||!this._isValidTrigger(e,n)||(this._dragContext.onPointerDownScale=1,this._dragContext.onPointerDownPosition=q.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(xe.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 ct(e.originalEvent,n)}static \u0275fac=function(n){return new(n||js)};static \u0275prov=g({token:js,factory:js.\u0275fac})};return t=C([x(Gd)],t),t})(),PC=[TC,EC],Vd=class{event;trigger;static fToken=Symbol("SelectByPointerRequest");constructor(i,e){this.event=i,this.trigger=e}},MC=(()=>{let t=class Us{_mediator=d(R);_store=d(T);_dragSession=d(K);handle({event:e,trigger:n}){if(!this._isSelectionAllowed(e))return;let o=this._resolveSelectable(e.targetElement);this._deferRaiseLayerFor(o),ct(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 ln(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||Us)};static \u0275prov=g({token:Us,factory:Us.\u0275fac})};return t=C([x(Vd)],t),t})(),DC=[MC];var Wf=class extends ff{hostElement=d(Se).nativeElement};function kC(t){return ni(t,".f-drag-blocker")}var om=(()=>{class t extends Wf{_result=d(Gt);_mediator=d(R);_platform=d(bu);disabled=!1;fMultiSelectTrigger=e=>this._platform.getOS()===Rt.MAC_OS?e.metaKey:e.ctrlKey;fReassignConnectionTrigger=ht;fCreateConnectionTrigger=ht;fConnectionWaypointsTrigger=F(ht);fMoveControlPointTrigger=ht;fNodeResizeTrigger=ht;fNodeRotateTrigger=ht;fNodeMoveTrigger=ht;fCanvasMoveTrigger=ht;fExternalItemTrigger=ht;fSelectionChange=new rt;fNodeIntersectedWithConnections=new rt;fNodeConnectionsIntersection=nt();fEmitOnNodeIntersect=!1;fCreateNode=new rt;fMoveNodes=new rt;fReassignConnection=new rt;fCreateConnection=new rt;fConnectionWaypointsChanged=nt();fDropToGroup=new rt;vCellSize=F(1,{transform:e=>$e(e,1)});hCellSize=F(1,{transform:e=>$e(e,1)});fCellSizeWhileDragging=F(!1,{transform:e=>Ce(e)});fDragStarted=new rt;fDragEnded=new rt;_dragHandlerInjector=d(ze);ngOnInit(){this._mediator.execute(new $d(this))}ngAfterViewInit(){super.subscribe()}onPointerDown(e){if(kC(e.targetElement))return!1;this._dragHandlerInjector.create(),this._result.clear(),this._mediator.execute(new qd),this._mediator.execute(new Ed(e)),this._mediator.execute(new Bd(e)),this._mediator.execute(new Id(e)),this._mediator.execute(new Vd(e,this.fMultiSelectTrigger)),this._mediator.execute(new Kc(e,this.fReassignConnectionTrigger)),this._mediator.execute(new qc(e,this.fCreateConnectionTrigger)),this._mediator.execute(new ed(e,this.fConnectionWaypointsTrigger()));let n=e.isMouseLeftButton();return n||this.finalizeDragSequence(),n}prepareDragSequence(e){this._mediator.execute(new Nd(e,this.fNodeResizeTrigger)),this._mediator.execute(new Ad(e,this.fNodeRotateTrigger)),this._mediator.execute(new pd(e,this.fNodeMoveTrigger)),this._mediator.execute(new xd(e,this.fExternalItemTrigger)),this._mediator.execute(new md(e)),this._mediator.execute(new Gd(e,this.fCanvasMoveTrigger)),this._mediator.execute(new Xd)}onSelect(e){this._mediator.execute(new bd(e))}onPointerMove(e){this._mediator.execute(new Wd(e))}onPointerUp(e){this._mediator.execute(new Ld(e)),this._mediator.execute(new Td(e)),this._mediator.execute(new Xc(e)),this._mediator.execute(new jc(e)),this._mediator.execute(new Rd(e)),this._mediator.execute(new Fd(e)),this._mediator.execute(new hd(e)),this._mediator.execute(new vd(e)),this._mediator.execute(new td(e)),this._mediator.execute(new zc(e)),this._mediator.execute(new wd(e)),this._mediator.execute(new Zc(e)),this._mediator.execute(new Nc)}finalizeDragSequence(){this._mediator.execute(new Bt),this._mediator.execute(new gi),this._result.clear(),this._dragHandlerInjector.destroy()}ngOnDestroy(){this._mediator.execute(new Bt),this._mediator.execute(new Kd),super.unsubscribe()}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275dir=Me({type:t,selectors:[["f-flow","fDraggable",""]],inputs:{disabled:[2,"fDraggableDisabled","disabled",Ce],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",Ce],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:[De([Gt,ze]),ye]})}return t})(),RC=[...PC,...cv,...Dy,...DC,...Uv,...By,...SC,...Dv,...Wv,...hC,...vC,...eC,...Zv],NC=(()=>{let t=class $s{_store=d(T);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 Qc(e.fId(),e.fWaypoints()?.waypoints()||[])}static \u0275fac=function(n){return new(n||$s)};static \u0275prov=g({token:$s,factory:$s.\u0275fac})};return t=C([x(cf)],t),t})(),qf=class{static fToken=Symbol("RemoveSnapConnectionFromStoreRequest")},OC=(()=>{let t=class Ws{_store=d(T);handle(e){this._store.connections.removeInstanceForSnap()}static \u0275fac=function(n){return new(n||Ws)};static \u0275prov=g({token:Ws,factory:Ws.\u0275fac})};return t=C([x(qf)],t),t})(),FC=[Tl,un,Eg,Pg,Mg,Dg,w0,J0,P0,q0,ay,sy,Q0,dy,uy,ly,Z0,oy,M0,my,Y0,K0,X0,H0,W0,j0,U0,cy,ny,fy,hy,ry,iy,py,_y,gy,yy,OC,NC],Di=class{instance;static fToken=Symbol("AddConnectorToStoreRequest");constructor(i){this.instance=i}},AC=(()=>{let t=class qs{_store=d(T);_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 pc(e.fId(),e.fNodeId,e.kind,e.hostElement))}static \u0275fac=function(n){return new(n||qs)};static \u0275prov=g({token:qs,factory:qs.\u0275fac})};return t=C([x(Di)],t),t})(),cn=class{position;connectorRefs;static fToken=Symbol("CalculateClosestConnectorRequest");constructor(i,e){this.position=i,this.connectorRefs=e}},LC=(()=>{let t=class Xs{handle({position:e,connectorRefs:n}){let o,r=1/0;for(let s of n){let a=this._distanceToRect(e,s.rect);a<r&&(r=a,o=s)}return o?fu(he({},o),{distance:r}):void 0}_distanceToRect(e,{x:n,y:o,width:r,height:s}){let a=this._clamp(e.x,n,n+r),l=this._clamp(e.y,o,o+s),h=e.x-a,_=e.y-l;return Math.sqrt(h*h+_*_)}_clamp(e,n,o){return Math.max(n,Math.min(o,e))}static \u0275fac=function(n){return new(n||Xs)};static \u0275prov=g({token:Xs,factory:Xs.\u0275fac})};return t=C([x(cn)],t),t})(),ki=class{pointerPosition;connectableConnectors;static fToken=Symbol("FindConnectableConnectorUsingPriorityAndPositionRequest");constructor(i,e){this.pointerPosition=i,this.connectableConnectors=e}},BC=(()=>{let t=class Ks{_mediator=d(R);_store=d(T);_browser=d(Pe);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=>G.isIncludePoint(n.rect,this._calculatePointerInFlow(e.pointerPosition))).map(n=>n.connector)}_calculatePointerInFlow(e){return jn(e,this._flowHost,this._transform)}_isSnapConnectionEnabledAndHasClosestConnector(e){if(!this._snapConnection)return;let n=this._mediator.execute(new cn(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||Ks)};static \u0275prov=g({token:Ks,factory:Ks.\u0275fac})};return t=C([x(ki)],t),t})(),Ri=class{source;pointer;static fToken=Symbol("CalculateTargetConnectorsToConnectRequest");constructor(i,e){this.source=i,this.pointer=e}},it=class{connector;static fToken=Symbol("GetConnectorRectReferenceRequest");constructor(i){this.connector=i}},zC=(()=>{let t=class Ys{_mediator=d(R);handle({connector:e}){return{connector:e,rect:this._getRect(e)}}_getRect(e){return this._mediator.execute(new Lt(e.hostElement))}static \u0275fac=function(n){return new(n||Ys)};static \u0275prov=g({token:Ys,factory:Ys.\u0275fac})};return t=C([x(it)],t),t})(),Ni=class{nodeOrGroup;static fToken=Symbol("AddNodeToStoreRequest");constructor(i){this.nodeOrGroup=i}},GC=(()=>{let t=class Zs{_store=d(T);_mediator=d(R);handle({nodeOrGroup:e}){this._store.nodes.add(e),this._mediator.execute(new mc(e.fId(),e.hostElement,e)),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||Zs)};static \u0275prov=g({token:Zs,factory:Zs.\u0275fac})};return t=C([x(Ni)],t),t})(),Hd=class{nodeOrGroup;static fToken=Symbol("CalculateInputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},VC=(()=>{let t=class Qs{_store=d(T);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||Qs)};static \u0275prov=g({token:Qs,factory:Qs.\u0275fac})};return t=C([x(Hd)],t),t})(),On=class{connector;pointerPosition;static fToken=Symbol("CalculateConnectableSideByConnectedPositionsRequest");constructor(i,e){this.connector=i,this.pointerPosition=e}},Cp=2,je=(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})(je||{});function HC(t,i,e,n,o){let r=jC(o),s=e-t,a=n-i,l=UC(s,a);return $C(l,r)?l:WC(s,a,r,l)}function jC(t){if(!t||t.length===0)return je.ALL;let i=je.NONE;for(let e=0;e<t.length;e++)switch(t[e]){case L.LEFT:i|=je.LEFT;break;case L.RIGHT:i|=je.RIGHT;break;case L.TOP:i|=je.TOP;break;case L.BOTTOM:i|=je.BOTTOM;break}return i||je.ALL}function UC(t,i){let e=t<0?-t:t,n=i<0?-i:i;return e-n>Cp?t<0?L.LEFT:L.RIGHT:(n-e>Cp,i<0?L.TOP:L.BOTTOM)}function $C(t,i){switch(t){case L.LEFT:return(i&je.LEFT)!==0;case L.RIGHT:return(i&je.RIGHT)!==0;case L.TOP:return(i&je.TOP)!==0;case L.BOTTOM:return(i&je.BOTTOM)!==0;default:return!0}}function WC(t,i,e,n){let o=n,r=-1/0;if(e&je.RIGHT){let s=t;s>r&&(r=s,o=L.RIGHT)}if(e&je.LEFT){let s=-t;s>r&&(r=s,o=L.LEFT)}if(e&je.BOTTOM){let s=i;s>r&&(r=s,o=L.BOTTOM)}if(e&je.TOP){let s=-i;s>r&&(r=s,o=L.TOP)}return o}function jd(t){return t===L.CALCULATE||t===L.CALCULATE_HORIZONTAL||t===L.CALCULATE_VERTICAL}var qC={[L.CALCULATE]:[L.TOP,L.BOTTOM,L.LEFT,L.RIGHT],[L.CALCULATE_HORIZONTAL]:[L.LEFT,L.RIGHT],[L.CALCULATE_VERTICAL]:[L.TOP,L.BOTTOM]},XC=(()=>{let t=class Js{_mediator=d(R);handle({connector:e,pointerPosition:n}){let o=e.userFConnectableSide,r=this._getConnectorRect(e.hostElement).gravityCenter,s=this._accumulateConnectedCenters(e.hostElement,e.toConnector,n),a=s.sumX/s.count,l=s.sumY/s.count;return HC(r.x,r.y,a,l,qC[o])}_accumulateConnectedCenters(e,n,o){let r=o?.x||0,s=o?.y||0,a=o?1:0;if(n&&n.length)for(let l=0;l<n.length;l++){let h=n[l].hostElement;if(h===e)continue;let _=this._getConnectorRect(h).gravityCenter;r+=_.x,s+=_.y,a++}return{sumX:r,sumY:s,count:a}}_getConnectorRect(e){return this._mediator.execute(new be(e))}static \u0275fac=function(n){return new(n||Js)};static \u0275prov=g({token:Js,factory:Js.\u0275fac})};return t=C([x(On)],t),t})(),Ud=class{connector;static fToken=Symbol("CalculateConnectableSideByInternalPositionRequest");constructor(i){this.connector=i}},$d=class{fComponent;static fToken=Symbol("AddDndToStoreRequest");constructor(i){this.fComponent=i}},KC=(()=>{let t=class ea{_store=d(T);handle(e){this._store.fDraggable=e.fComponent}static \u0275fac=function(n){return new(n||ea)};static \u0275prov=g({token:ea,factory:ea.\u0275fac})};return t=C([x($d)],t),t})(),Wd=class{event;static fToken=Symbol("OnPointerMoveRequest");constructor(i){this.event=i}},YC=(()=>{let t=class ta{_mediator=d(R);_store=d(T);get _hostElement(){return this._store.fDraggable?.hostElement}_dragContext=d(K);handle({event:e}){this._dragContext.rememberPointerEvent(e),this._setDifferenceToDraggableItems(this._getDifferenceBetweenPointerAndPointerDown(e),e),this._mediator.execute(new yi)}_setDifferenceToDraggableItems(e,n){this._dragContext.draggableItems.forEach(o=>{o.onPointerMove(he({},e),n)})}_getDifferenceBetweenPointerAndPointerDown(e){return this._getPointerPositionInCanvas(e).div(this._dragContext.onPointerDownScale).sub(this._dragContext.onPointerDownPosition)}_getPointerPositionInCanvas(e){return q.fromPoint(e.getPosition()).elementTransform(this._hostElement)}static \u0275fac=function(n){return new(n||ta)};static \u0275prov=g({token:ta,factory:ta.\u0275fac})};return t=C([x(Wd)],t),t})(),qd=class{static fToken=Symbol("InitializeDragSequenceRequest")},ZC=(()=>{let t=class na{_dragContext=d(K);handle(e){this._dragContext.reset()}static \u0275fac=function(n){return new(n||na)};static \u0275prov=g({token:na,factory:na.\u0275fac})};return t=C([x(qd)],t),t})(),Vt=class{static fToken=Symbol("IsDragStartedRequest")},QC=(()=>{let t=class ia{_store=d(T);handle(e){return!!this._store.fDraggable?.isDragStarted}static \u0275fac=function(n){return new(n||ia)};static \u0275prov=g({token:ia,factory:ia.\u0275fac})};return t=C([x(Vt)],t),t})(),Xd=class{static fToken=Symbol("PrepareDragSequenceRequest")},JC=(()=>{let t=class oa{_mediator=d(R);_dragContext=d(K);handle(e){this._callPrepareDragSequence(),this._mediator.execute(new Oc)}_callPrepareDragSequence(){this._dragContext.draggableItems.forEach(e=>e.prepareDragSequence?.())}static \u0275fac=function(n){return new(n||oa)};static \u0275prov=g({token:oa,factory:oa.\u0275fac})};return t=C([x(Xd)],t),t})(),Kd=class{static fToken=Symbol("RemoveDndFromStoreRequest")},ex=(()=>{let t=class ra{_store=d(T);handle(e){this._store.fDraggable=void 0}static \u0275fac=function(n){return new(n||ra)};static \u0275prov=g({token:ra,factory:ra.\u0275fac})};return t=C([x(Kd)],t),t})(),tx=[KC,YC,ZC,JC,QC,ex],nx=new ce("CONNECTABLE_SIDE_EPSILON"),ix=(()=>{let t=class sa{_mediator=d(R);_lastSide=new WeakMap;_epsilon=Math.max(0,d(nx,{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=G.fromElement(e),s=n.getBoundingClientRect(),a=r.gravityCenter.x,l=r.gravityCenter.y,h=a-s.left,_=s.right-a,v=l-s.top,S=s.bottom-l,I=0,N=h,D=[h,_,v,S];for(let O=1;O<4;O++){let z=D[O];z<N&&(N=z,I=O)}let M=I===0?L.LEFT:I===1?L.RIGHT:I===2?L.TOP:L.BOTTOM,k=this._lastSide.get(o);if(k!==void 0&&k!==M){let O=k===L.LEFT?0:k===L.RIGHT?1:k===L.TOP?2:3;(O===0?h:O===1?_:O===2?v:S)-N<=this._epsilon&&(M=k)}return M}_isDragging(){return this._mediator.execute(new Vt)}static \u0275fac=function(n){return new(n||sa)};static \u0275prov=g({token:sa,factory:sa.\u0275fac})};return t=C([x(Ud)],t),t})(),Fn=class{nodeOrGroup;static fToken=Symbol("CalculateConnectorsConnectableSidesRequest");constructor(i){this.nodeOrGroup=i}},ox=(()=>{let t=class aa{_mediator=d(R);handle({nodeOrGroup:e}){let n=e.connectors,o=n.length;for(let s=0;s<o;s++){let a=n[s];a.fConnectableSide=this._resolveSideForConnectorFast(a)}let r=new Set;for(let s=0;s<o;s++){let l=n[s].toConnector;if(l&&l.length)for(let h=0,_=l.length;h<_;h++){let v=l[h],S=v.userFConnectableSide;jd(S)&&r.add(v)}}r.size>0&&r.forEach(s=>{s.fConnectableSide=this._calculateByConnectedPositions(s)})}_resolveSideForConnectorFast(e){let n=e.userFConnectableSide;return n===L.AUTO?this._mediator.execute(new Ud(e)):jd(n)?this._calculateByConnectedPositions(e):n}_calculateByConnectedPositions(e){return this._mediator.execute(new On(e))}static \u0275fac=function(n){return new(n||aa)};static \u0275prov=g({token:aa,factory:aa.\u0275fac})};return t=C([x(Fn)],t),t})(),An=class{static fToken=Symbol("CalculateNodesBoundingBoxRequest")},rx=(()=>{let t=class ca{_store=d(T);handle(e){return G.union(this._nodesRects())}_nodesRects(){return this._store.nodes.getAll().map(e=>G.fromElement(e.hostElement))}static \u0275fac=function(n){return new(n||ca)};static \u0275prov=g({token:ca,factory:ca.\u0275fac})};return t=C([x(An)],t),t})(),Yd=class{fNodes;static fToken=Symbol("CalculateNodesBoundingBoxNormalizedPositionRequest");constructor(i){this.fNodes=i}},sx=(()=>{let t=class da{_store=d(T);_mediator=d(R);handle(e){return G.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 Rn(e.hostElement));if(n)return this._getElementRect(e,n);let o=this._mediator.execute(new be(e.hostElement));return this._getElementRect(e,o)}_getElementRect(e,n){return G.initialize(e._position.x,e._position.y,n.width,n.height)}static \u0275fac=function(n){return new(n||da)};static \u0275prov=g({token:da,factory:da.\u0275fac})};return t=C([x(Yd)],t),t})(),Zd=class{nodeOrGroup;static fToken=Symbol("CalculateOutputConnectionsRequest");constructor(i){this.nodeOrGroup=i}},ax=(()=>{let t=class la{_store=d(T);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||la)};static \u0275prov=g({token:la,factory:la.\u0275fac})};return t=C([x(Zd)],t),t})(),Oi=class{nodeOrGroup;static fToken=Symbol("FitToChildNodesAndGroupsRequest");constructor(i){this.nodeOrGroup=i}},dn=class{fNode;rect;static fToken=Symbol("GetNodePaddingRequest");constructor(i,e){this.fNode=i,this.rect=e}},cx=(()=>{let t=class ua{_browser=d(Pe);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||ua)};static \u0275prov=g({token:ua,factory:ua.\u0275fac})};return t=C([x(dn)],t),t})(),dx=(()=>{let t=class fa{_mediator=d(R);_store=d(T);get _nodes(){return this._store.nodes.getAll()}handle({nodeOrGroup:e}){if(e.fAutoSizeToFitChildren()){let r=this._calculateDirectChildren(e);if(r.length){let s=this._boundingRect(e),a=this._calculateChildrenBounding(r,this._paddings(e,s));e.updatePosition(a),e.updateSize(a),e.redraw()}}let n=e.fParentId();if(!n)return;let o=this._nodes.find(r=>r.fId()===n);o&&this._mediator.execute(new Oi(o))}_calculateDirectChildren(e){return this._nodes.filter(n=>n.fParentId()===e.fId())}_unionRect(e){return G.union(e.map(n=>this._boundingRect(n)))||G.initialize()}_boundingRect(e){return this._mediator.execute(new be(e.hostElement))}_paddings(e,n){return this._mediator.execute(new dn(e,n))}_calculateChildrenBounding(e,[n,o,r,s]){let a=this._unionRect(e);return a=G.initialize(a.x-n,a.y-o,a.width+n+r,a.height+o+s),a}static \u0275fac=function(n){return new(n||fa)};static \u0275prov=g({token:fa,factory:fa.\u0275fac})};return t=C([x(Oi)],t),t})(),Qd=class{id;static fToken=Symbol("GetChildNodeIdsRequest");constructor(i){this.id=i}},lx=(()=>{let t=class ha{_store=d(T);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(s=>s.fParentId()===e).map(s=>s.fId());n.push(...r);for(let s of r)this._collectDescendants(s,n,o)}static \u0275fac=function(n){return new(n||ha)};static \u0275prov=g({token:ha,factory:ha.\u0275fac})};return t=C([x(Qd)],t),t})(),Ln=class{nodeOrGroup;static fToken=Symbol("GetParentNodesRequest");constructor(i){this.nodeOrGroup=i}},ux=(()=>{let t=class pa{_store=d(T);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||pa)};static \u0275prov=g({token:pa,factory:pa.\u0275fac})};return t=C([x(Ln)],t),t})(),Fi=class{nodeOrGroup;destroyRef;static fToken=Symbol("UpdateNodeWhenStateOrSizeChangedRequest");constructor(i,e){this.nodeOrGroup=i,this.destroyRef=e}},fx=(()=>{let t=class ma{_mediator=d(R);handle({nodeOrGroup:e,destroyRef:n}){let{hostElement:o,stateChanges:r}=e;new yt(new Au(o),r).listen(n,()=>{this._mediator.execute(new Jt),this._isDragging()||(this._mediator.execute(new kn(e.fId(),"UpdateNodeWhenStateOrSizeChanged")),this._mediator.execute(new Fn(e)),this._mediator.execute(new Oi(e)))})}_isDragging(){return this._mediator.execute(new Vt)}static \u0275fac=function(n){return new(n||ma)};static \u0275prov=g({token:ma,factory:ma.\u0275fac})};return t=C([x(Fi)],t),t})(),Ai=class{instance;static fToken=Symbol("RemoveNodeFromStoreRequest");constructor(i){this.instance=i}},hx=(()=>{let t=class _a{_store=d(T);_mediator=d(R);handle({instance:e}){this._store.nodes.remove(e),this._mediator.execute(new _c(e.fId())),this._store.emitNodeChanges()}static \u0275fac=function(n){return new(n||_a)};static \u0275prov=g({token:_a,factory:_a.\u0275fac})};return t=C([x(Ai)],t),t})(),px=[GC,XC,ix,VC,ox,rx,sx,ax,dx,lx,cx,ux,fx,hx],mx=(()=>{let t=class ga{_mediator=d(R);_store=d(T);get _targets(){return this._store.inputs.getAll()}handle({source:e,pointer:n}){let o=this._getConnectableTargets(e),r=[];for(let s of o)r.push(this._mediator.execute(new it(s)));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)jd(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new On(e,n))}static \u0275fac=function(n){return new(n||ga)};static \u0275prov=g({token:ga,factory:ga.\u0275fac})};return t=C([x(Ri)],t),t})(),Jd=class{target;pointer;static fToken=Symbol("CalculateSourceConnectorsToConnectRequest");constructor(i,e){this.target=i,this.pointer=e}},_x=(()=>{let t=class ya{_mediator=d(R);_store=d(T);get _sources(){return this._store.outputs.getAll()}handle({target:e,pointer:n}){let o=this._getConnectableSources(e),r=[];for(let s of o)r.push(this._mediator.execute(new it(s)));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)jd(o.userFConnectableSide)&&(o.fConnectableSide=this._calculateByConnectedPositions(o,n))}_calculateByConnectedPositions(e,n){return this._mediator.execute(new On(e,n))}static \u0275fac=function(n){return new(n||ya)};static \u0275prov=g({token:ya,factory:ya.\u0275fac})};return t=C([x(Jd)],t),t})(),Bn=class{connectors;static fToken=Symbol("MarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},Re={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"}},gx=(()=>{let t=class va{_store=d(T);handle({connectors:e}){this._store.flowHost.classList.add(Re.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._markConnector(n))}_markConnector({hostElement:e}){e.classList.add(Re.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||va)};static \u0275prov=g({token:va,factory:va.\u0275fac})};return t=C([x(Bn)],t),t})(),Li=class{instance;static fToken=Symbol("RemoveConnectorFromStoreRequest");constructor(i){this.instance=i}},yx=(()=>{let t=class Ca{_store=d(T);_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 ci(e.fId(),e.kind))}static \u0275fac=function(n){return new(n||Ca)};static \u0275prov=g({token:Ca,factory:Ca.\u0275fac})};return t=C([x(Li)],t),t})(),zn=class{connectors;static fToken=Symbol("UnmarkConnectableConnectorsRequest");constructor(i){this.connectors=i}},vx=(()=>{let t=class xa{_store=d(T);handle({connectors:e}){this._store.flowHost.classList.remove(Re.DRAG_AND_DROP.CONNECTIONS_DRAGGING),e.forEach(n=>this._unmarkConnector(n))}_unmarkConnector({hostElement:e}){e.classList.remove(Re.CONNECTOR.CONNECTABLE)}static \u0275fac=function(n){return new(n||xa)};static \u0275prov=g({token:xa,factory:xa.\u0275fac})};return t=C([x(zn)],t),t})(),Cx=[AC,yx,LC,BC,_x,mx,zC,gx,vx],el=class{instance;static fToken=Symbol("AddFlowToStoreRequest");constructor(i){this.instance=i}};var oi=(function(t){return t.MANUAL="manual",t.AUTO="auto",t})(oi||{});function xx(t){let i=[...t.nodes.map(xp),...t.groups.map(xp)],e=new Set(t.nodes.map(a=>a.id)),n=new Set(t.groups.map(a=>a.id)),o=new Map,r=new Map;for(let a of[...t.nodes,...t.groups]){for(let l of a.fOutputs)o.set(l.id,a.id);for(let l of a.fInputs)r.set(l.id,a.id)}let s=t.connections.reduce((a,l)=>{let h=o.get(l.fOutputId),_=r.get(l.fInputId);return!h||!_||a.push({source:h,target:_}),a},[]);return{nodes:i,connections:s,nodeIds:e,groupIds:n}}function xp(t){return{id:t.id,size:t.measuredSize?he({},t.measuredSize):t.size?he({},t.size):void 0}}var bx=1,rm=(()=>{class t{_destroyRef=d(Ye);_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()===oi.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===oi.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()!==oi.AUTO||(n.timeoutId!==null&&clearTimeout(n.timeoutId),this._cancelAnimationFrames(n),n.timeoutId=setTimeout(()=>{n.timeoutId=null,this._runAfterNextPaint(n,()=>{this._relayoutFlowIfReady(e)})},bx))}async _relayoutFlowIfReady(e){let n=this._flows.get(e);if(!(!n||!this._engine||this._engine.getMode()!==oi.AUTO)){if(n.store.hasPendingProgressiveRender){this._scheduleRelayout(e);return}await this._relayoutRegisteredFlow(e,n)}}async _relayoutRegisteredFlow(e,n){if(!this._engine)return;let o=xx(n.flow.getState({measuredSize:!0})),r=++n.runId,s=await this._engine.calculate(o.nodes,o.connections,{flowId:e,mode:this._engine.getMode()}),a=this._flows.get(e);if(!(!a||a.runId!==r||!this._applyPositions(a.store,s.nodes).length)){a.isApplying=!0;try{a.flow.redraw(),this._emitWriteback(e,s.nodes,o.nodeIds,o.groupIds)}finally{queueMicrotask(()=>{let h=this._flows.get(e);h&&(h.isApplying=!1)})}}}_emitWriteback(e,n,o,r){let s=this._engine?.getWriteback();s&&s({flowId:e,nodes:n.filter(a=>o.has(a.id)),groups:n.filter(a=>r.has(a.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(he({},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=g({token:t,factory:t.\u0275fac})}return t})();var wx=(()=>{let t=class ba{_store=d(T);_layoutController=d(rm,{optional:!0});handle({instance:e}){this._store.fFlow=e,this._layoutController?.registerFlow(e,this._store)}static \u0275fac=function(n){return new(n||ba)};static \u0275prov=g({token:ba,factory:ba.\u0275fac})};return t=C([x(el)],t),t})(),tl=class{static fToken=Symbol("GetFlowRequest")},Sx=(()=>{let t=class wa{_store=d(T);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||wa)};static \u0275prov=g({token:wa,factory:wa.\u0275fac})};return t=C([x(tl)],t),t})(),nl=class{static fToken=Symbol("CalculateConnectionsStateRequest")},Ix=(()=>{let t=class Sa{_store=d(T);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||Sa)};static \u0275prov=g({token:Sa,factory:Sa.\u0275fac})};return t=C([x(nl)],t),t})(),Bi=class{component;measuredSize;static fToken=Symbol("CalculateNodesStateRequest");constructor(i,e=!1){this.component=i,this.measuredSize=e}},Tx=(()=>{let t=class Ia{_store=d(T);_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 be(o.hostElement)):null;return{id:o.fId(),parentId:o.fParentId()??void 0,position:he({},o._position),size:o._size?he({},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||Ia)};static \u0275prov=g({token:Ia,factory:Ia.\u0275fac})};return t=C([x(Bi)],t),t})(),il=class{measuredSize;static fToken=Symbol("CalculateFlowStateRequest");constructor(i=!1){this.measuredSize=i}},Ex=(()=>{let t=class Ta{_mediator=d(R);_store=d(T);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 Bi(Pl,e)),groups:this._mediator.execute(new Bi(yf,e)),connections:this._mediator.execute(new nl)}}static \u0275fac=function(n){return new(n||Ta)};static \u0275prov=g({token:Ta,factory:Ta.\u0275fac})};return t=C([x(il)],t),t})(),Px=[Ex,Tx,Ix],ol=class{instance;static fToken=Symbol("RemoveFlowFromStoreRequest");constructor(i){this.instance=i}},Mx=(()=>{let t=class Ea{_store=d(T);_layoutController=d(rm,{optional:!0});handle({instance:e}){this._layoutController?.unregisterFlow(e.fId()),this._store.fFlow=void 0}static \u0275fac=function(n){return new(n||Ea)};static \u0275prov=g({token:Ea,factory:Ea.\u0275fac})};return t=C([x(ol)],t),t})(),Ml=(()=>{class t{isNodesRendered=!1;isFullRendered=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),rl=class{static fToken=Symbol("NotifyNodesRenderedRequest")},Jf=new ce("F_FLOW"),Xf=class{},Dx=(()=>{let t=class Pa{_state=d(Ml);_fFlow=d(Jf);handle(e){this._state.isNodesRendered||(this._state.isNodesRendered=!0,this._fFlow.fNodesRendered.emit(this._fFlow.fId()))}static \u0275fac=function(n){return new(n||Pa)};static \u0275prov=g({token:Pa,factory:Pa.\u0275fac})};return t=C([x(rl)],t),t})(),sl=class{static fToken=Symbol("NotifyFullRenderedRequest")},kx=(()=>{let t=class Ma{_state=d(Ml);_fFlow=d(Jf);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||Ma)};static \u0275prov=g({token:Ma,factory:Ma.\u0275fac})};return t=C([x(sl)],t),t})(),zi=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}},Rx=(()=>{let t=class Da{_store=d(T);handle({targetConnectionsRevision:e,targetNodesRevision:n,callback:o,destroyRef:r}){if(this._store.connectionsRenderedRevision>=e&&this._store.connectionsRenderedNodesRevision>=n){o();return}let s=this._store.connectionsRenderedChanges$.listen(()=>{this._store.connectionsRenderedRevision<e||this._store.connectionsRenderedNodesRevision<n||(s(),o())});r.onDestroy(s)}static \u0275fac=function(n){return new(n||Da)};static \u0275prov=g({token:Da,factory:Da.\u0275fac})};return t=C([x(zi)],t),t})(),al=class{static fToken=Symbol("ResetRenderLifecycleRequest")},Nx=(()=>{let t=class ka{_state=d(Ml);handle(e){this._state.isNodesRendered=!1,this._state.isFullRendered=!1}static \u0275fac=function(n){return new(n||ka)};static \u0275prov=g({token:ka,factory:ka.\u0275fac})};return t=C([x(al)],t),t})(),cl=class{destroyRef;static fToken=Symbol("QueueConnectionRedrawRequest");constructor(i){this.destroyRef=i}},sm=(()=>{class t{isWaitingForViewportAnimation=!1;pendingRedraw=!1;static \u0275fac=function(n){return new(n||t)};static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})(),Ox=(()=>{let t=class Ra{_state=d(sm);_store=d(T);_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 pi)});e.destroyRef.onDestroy(n)}static \u0275fac=function(n){return new(n||Ra)};static \u0275prov=g({token:Ra,factory:Ra.\u0275fac})};return t=C([x(cl)],t),t})(),Fx=[wx,Sx,...Px,Mx,Ml,Dx,kx,Rx,Nx,sm,Ox],dl=class{static fToken=Symbol("ClearSelectionRequest")},Ax=(()=>{let t=class Na{_dragContext=d(K);handle(e){this._dragContext.selectedItems.forEach(n=>n.unmarkAsSelected()),this._dragContext.selectedItems=[],this._dragContext.isSelectedChanged=!0}static \u0275fac=function(n){return new(n||Na)};static \u0275prov=g({token:Na,factory:Na.\u0275fac})};return t=C([x(dl)],t),t})(),ll=class{static fToken=Symbol("CalculateSelectableItemsRequest")},Lx=(()=>{let t=class Oa{_mediator=d(R);_store=d(T);_dragContext=d(K);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 be(e.hostElement))}))}_connectionRects(){return this._connections.filter(e=>!e.fSelectionDisabled()).map(e=>({element:e,fRect:this._mediator.execute(new be(e.boundingElement))}))}static \u0275fac=function(n){return new(n||Oa)};static \u0275prov=g({token:Oa,factory:Oa.\u0275fac})};return t=C([x(ll)],t),t})(),Gi=class{static fToken=Symbol("GetCurrentSelectionRequest")},Bx=(()=>{let t=class Fa{_dragContext=d(K);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||Fa)};static \u0275prov=g({token:Fa,factory:Fa.\u0275fac})};return t=C([x(Gi)],t),t})(),ul=class{nodes;connections;isSelectedChanged;static fToken=Symbol("SelectRequest");constructor(i,e,n=!0){this.nodes=i,this.connections=e,this.isSelectedChanged=n}},zx=(()=>{let t=class Aa{_dragContext=d(K);_store=d(T);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||Aa)};static \u0275prov=g({token:Aa,factory:Aa.\u0275fac})};return t=C([x(ul)],t),t})(),fl=class{static fToken=Symbol("SelectAllRequest")},Gx=(()=>{let t=class La{_dragSession=d(K);_store=d(T);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||La)};static \u0275prov=g({token:La,factory:La.\u0275fac})};return t=C([x(fl)],t),t})(),Gn=class{nodeOrGroup;static fToken=Symbol("SelectAndUpdateNodeLayerRequest");constructor(i){this.nodeOrGroup=i}},hl=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}},Vx=(()=>{let t=class Ba{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||Ba)};static \u0275prov=g({token:Ba,factory:Ba.\u0275fac})};return t=C([x(hl)],t),t})(),ln=class{item;itemContainer;static fToken=Symbol("UpdateItemAndChildrenLayersRequest");constructor(i,e){this.item=i,this.itemContainer=e}},Vn=class{nodeOrGroupId;static fToken=Symbol("GetDeepChildrenNodesAndGroupsRequest");constructor(i){this.nodeOrGroupId=i}},Hx=(()=>{let t=class za{_store=d(T);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,s)=>r.concat(this._getChildrenNodes(s.fId(),n)),o)}static \u0275fac=function(n){return new(n||za)};static \u0275prov=g({token:za,factory:za.\u0275fac})};return t=C([x(Vn)],t),t})(),jx=(()=>{let t=class Ga{_store=d(T);_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),s=r.findIndex(a=>a===n);this._isAnythingNeedToBeMoved(r,s,o)&&this._mediator.execute(new hl(e,r,o,s))}_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 Vn(e)).map(n=>n.hostElement)}static \u0275fac=function(n){return new(n||Ga)};static \u0275prov=g({token:Ga,factory:Ga.\u0275fac})};return t=C([x(ln)],t),t})(),Ux=(()=>{let t=class Va{_dragSession=d(K);_mediator=d(R);handle({nodeOrGroup:e}){this._selectNodeIfNotSelected(e),this._mediator.execute(new ln(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||Va)};static \u0275prov=g({token:Va,factory:Va.\u0275fac})};return t=C([x(Gn)],t),t})(),$x=[Ax,Lx,Bx,zx,Gx,Ux],pl=class{static fToken=Symbol("ResetZoomRequest")},Wx=(()=>{let t=class Ha{_store=d(T);get _canvas(){return this._store.fCanvas}handle(e){this._canvas.resetScale(),this._canvas.redraw(),this._canvas.emitCanvasChangeEvent()}static \u0275fac=function(n){return new(n||Ha)};static \u0275prov=g({token:Ha,factory:Ha.\u0275fac})};return t=C([x(pl)],t),t})(),ml=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}},qx=new Set(["drag-node","drag-external-item","resize-node","rotate-node","create-connection","reassign-connection","drag-connection-waypoint","assign-to-container"]),Xx=new Set(["drag-canvas","selection-area"]),Kx=(()=>{let t=class ja{_mediator=d(R);_store=d(T);_dragContext=d(K,{optional:!0});get _flowHost(){return this._store.flowHost}get _canvas(){return this._store.fCanvas}get _zoomComponent(){return this._store.instances.get(xe.ZOOM)}get _isDragStarted(){return this._mediator.execute(new Vt)}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 s=this._getDragZoomMode();if(s==="blocked")return;s==="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 q.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(qx.has(o)){e=!0;continue}if(!Xx.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=q.fromPoint(this._dragContext.onPointerDownPosition).add(q.fromPoint(e).mult(r)),this._dragContext.onPointerDownScale=n}static \u0275fac=function(n){return new(n||ja)};static \u0275prov=g({token:ja,factory:ja.\u0275fac})};return t=C([x(ml)],t),t})(),Yx=[Wx,Kx],_l=class{static fToken=Symbol("MinimapDrawNodesRequest")},Zx=(()=>{let t=class Ua{_browser=d(Pe);_store=d(T);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;return!n||!o?[]:this._store.nodes.getAll().map(s=>this._renderNode(s,n,o))}_renderNode(e,n,o){let r=En("rect",this._browser);vu(this._nodeRect(e,n,o),r);let s=e instanceof Pl;return r.classList.add("f-component",s?"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=G.elementTransform(G.fromElement(e.hostElement),n.hostElement);return G.div(r,o.transform.scale)}_minimapClasses(e){let n=e.fMinimapClass();return Array.isArray(n)?n:[n]}static \u0275fac=function(n){return new(n||Ua)};static \u0275prov=g({token:Ua,factory:Ua.\u0275fac})};return t=C([x(_l)],t),t})(),gl=class{svg;minSize;static fToken=Symbol("MinimapCalculateViewportRequest");constructor(i,e){this.svg=i,this.minSize=e}},Qx=(()=>{let t=class $a{_mediator=d(R);_store=d(T);handle({svg:e,minSize:n}){let o=this._store.fFlow,r=this._store.fCanvas;if(!o||!r)return{scale:1,viewBox:G.initialize(0,0,0,0)};let s=this._contentRectInMinimapSpace(o,r,n),a=this._minimapRectInFlowSpace(e,o),l=this._viewportScale(s,a),h=this._viewportViewBox(s,a,l);return{scale:l,viewBox:h}}_contentRectInMinimapSpace(e,n,o){let r=this._nodesBoundingBox(),s=G.elementTransform(r,e.hostElement),a=G.div(s,n.transform.scale);return Hh(a,o)}_nodesBoundingBox(){return this._mediator.execute(new An)??G.initialize(0,0,0,0)}_minimapRectInFlowSpace(e,n){return G.elementTransform(G.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),s=e.x-(r.width-e.width)/2,a=e.y-(r.height-e.height)/2;return G.initialize(s,a,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||$a)};static \u0275prov=g({token:$a,factory:$a.\u0275fac})};return t=C([x(gl)],t),t})(),yl=class{static fToken=Symbol("MinimapCalculateViewRectRequest")},Jx=(()=>{let t=class Wa{_store=d(T);handle(e){let n=this._store.fFlow,o=this._store.fCanvas;if(!n||!o)return G.initialize();let r=G.div(G.fromElement(n.hostElement),o.transform.scale);return r.x=0,r.y=0,r}static \u0275fac=function(n){return new(n||Wa)};static \u0275prov=g({token:Wa,factory:Wa.\u0275fac})};return t=C([x(yl)],t),t})(),vl=class{element;scale;viewBox;constructor(i,e=1,n=G.initialize(0,0,0,0)){this.element=i,this.scale=e,this.viewBox=n}},eb=[Zx,Qx,Jx],Cl=class{position;static fToken=Symbol("GetNormalizedPointRequest");constructor(i){this.position=i}},tb=(()=>{let t=class qa{_store=d(T);handle({position:e}){return jn(e,this._store.flowHost,this._store.transform)}static \u0275fac=function(n){return new(n||qa)};static \u0275prov=g({token:qa,factory:qa.\u0275fac})};return t=C([x(Cl)],t),t})(),xl=class{static fToken=Symbol("SortNodeLayersRequest")},nb=(()=>{let t=class Xa{_store=d(T);_mediator=d(R);_browser=d(Pe);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 Vn(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||Xa)};static \u0275prov=g({token:Xa,factory:Xa.\u0275fac})};return t=C([x(xl)],t),t})(),Vi=class{itemsContainer;static fToken=Symbol("SortItemsByParentRequest");constructor(i){this.itemsContainer=i}},ib=(()=>{let t=class Ka{_store=d(T);_browser=d(Pe);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 s=this._buildChildrenByParentId(r),a=new Map;for(let l of r){let h=this._getSortedChildrenBeforeParent(e,o,l,s,a);h.length&&this._moveBeforeNextSibling(e,h,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,s){let a=n.get(o.hostElement);if(a===void 0)return[];let l=this._getDeepChildren(o.fId(),r,s);if(!l.length)return[];let h=[];for(let _ of l){let v=_.hostElement;if(!e.contains(v))continue;let S=n.get(v);S===void 0||S>=a||h.push(v)}return h.sort((_,v)=>(n.get(_)??0)-(n.get(v)??0)),h}_buildChildrenByParentId(e){let n=new Map;for(let o of e){let r=o.fParentId();if(!r)continue;let s=n.get(r)??[];s.push(o),n.set(r,s)}return n}_getDeepChildren(e,n,o){let r=o.get(e);if(r)return r;let s=[],a=[...n.get(e)??[]],l=new Set([e]);for(;a.length;){let h=a.pop();if(!h)continue;let _=h.fId();if(l.has(_))continue;l.add(_),s.push(h);let v=n.get(_);v?.length&&a.push(...v)}return o.set(e,s),s}_moveBeforeNextSibling(e,n,o){let r=this._browser.document.createDocumentFragment();for(let s of n)r.appendChild(s);e.insertBefore(r,o)}static \u0275fac=function(n){return new(n||Ka)};static \u0275prov=g({token:Ka,factory:Ka.\u0275fac})};return t=C([x(Vi)],t),t})(),bl=class{static fToken=Symbol("SortItemLayersRequest")},ob=(()=>{let t=class Ya{_store=d(T);_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 Vi(this._canvas.fGroupsContainer().nativeElement)),this._mediator.execute(new xl),this._mediator.execute(new Vi(this._canvas.fNodesContainer().nativeElement)))}static \u0275fac=function(n){return new(n||Ya)};static \u0275prov=g({token:Ya,factory:Ya.\u0275fac})};return t=C([x(bl)],t),t})();function En(t,i){return i.document.createElementNS("http://www.w3.org/2000/svg",t)}function ct(t,i){return i(t)}function ht(t){return!0}function rb(){return/android|iPad|iPhone|iPod/i.test(navigator.userAgent||navigator.vendor||window.opera)}var sb=[...Tg,...FC,...mg,...Cx,...tx,...Fx,...px,...$x,...Yx,...eb,...G0,Hx,V0,$0,tb,ob,ib,nb,jx,Vx],ab=0,am=(()=>{class t{_destroyRef=d(Ye);_elementReference=d(Se);_fBrowser=d(Pe);_stateChanges=new at;get hostElement(){return this._elementReference.nativeElement}id=F(`f-pattern-${ab++}`);vColor=F("rgba(0,0,0,0.1)");hColor=F("rgba(0,0,0,0.1)");vSize=F(20,{transform:$e});hSize=F(20,{transform:$e});_transform=kt.default();_position=A.initialize();_size=ft.initialize(this.hSize(),this.vSize());_pattern;_vLine;_hLine;constructor(){this._createPattern()}_createPattern(){this._pattern=En("pattern",this._fBrowser),this._pattern.setAttribute("patternUnits","userSpaceOnUse"),this.hostElement.appendChild(this._pattern),this._vLine=En("line",this._fBrowser),this._pattern.appendChild(this._vLine),this._hLine=En("line",this._fBrowser),this._pattern.appendChild(this._hLine)}ngOnInit(){this._listenStateChanges()}_listenStateChanges(){new yt(this._stateChanges).pipe(wl()).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,s,a){e.setAttribute("stroke",`${n}`),e.setAttribute("x1",`${o}`),e.setAttribute("x2",`${s}`),e.setAttribute("y1",`${r}`),e.setAttribute("y2",`${a}`)}setTransform(e){this._transform=e,this._refresh()}_refresh(){this._stateChanges.notify()}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=te({type:t,selectors:[["f-rect-pattern"]],hostVars:1,hostBindings:function(n,o){n&2&&Z("id",o.id)},inputs:{id:[1,"id"],vColor:[1,"vColor"],hColor:[1,"hColor"],vSize:[1,"vSize"],hSize:[1,"hSize"]},features:[De([{provide:ku,useExisting:t}]),mn],decls:0,vars:0,template:function(n,o){},encapsulation:2,changeDetection:0})}return t})();var cb=new ce("F_BACKGROUND"),db=(()=>{class t{hostElement=d(Se).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,standalone:!1})}return t})(),cm=(()=>{class t extends db{_mediator=d(R);fBackgroundPattern=co(ku);ngOnInit(){this._mediator.execute(new en(xe.BACKGROUND,this))}ngAfterContentInit(){this._mediator.execute(new Za(this.fBackgroundPattern()))}setTransform(e){this.fBackgroundPattern()?.setTransform(e)}ngOnDestroy(){this._mediator.execute(new tn(xe.BACKGROUND))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["f-background"]],contentQueries:function(n,o,r){n&1&&_u(r,o.fBackgroundPattern,ku,5),n&2&&ut()},hostAttrs:[1,"f-component","f-background"],features:[De([{provide:cb,useExisting:t}]),ye],ngContentSelectors:H_,decls:2,vars:0,template:function(n,o){n&1&&(Wt(),Ue(),H(0,"svg"),Te(1),j())},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 Kf=class{position;scale;constructor(i,e){this.position=i,this.scale=e}},lb=new ce("F_CANVAS"),ub=(()=>{class t{transform=kt.default();_fCanvasChange=new at;destroyRef=d(Ye);getPosition(){return this.transform.position}setPosition(e){this.transform.position=e}emitCanvasChangeEvent(){this._fCanvasChange.notify()}subscribeOnCanvasChange(){new yt(this._fCanvasChange).pipe(Qa(this.debounce())).listen(this.destroyRef,()=>{this.fCanvasChange.emit(new Kf(A.sum(this.transform.position,this.transform.scaledPosition),this.transform.scale))})}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,standalone:!1})}return t})(),Hi=(()=>{class t extends ub{_mediator=d(R);_componentsStore=d(T);_elementReference=d(Se);_injector=d(Ke);_flowId;fCanvasChange=nt();position=F(A.initialize(),{transform:A.castToPoint});scale=F(1,{transform:$e});debounceTime=F(0,{transform:$e});debounce=E(()=>this.debounceTime()<0?0:this.debounceTime());get hostElement(){return this._elementReference.nativeElement}fGroupsContainer=ke.required("fGroupsContainer");fNodesContainer=ke.required("fNodesContainer");fConnectionsContainer=ke.required("fConnectionsContainer");get flowId(){return this._flowId||""}ngOnInit(){this._flowId=this._mediator.execute(new tl).fId(),this._mediator.execute(new ec(this)),this._positionChange(),this._scaleChange(),super.subscribeOnCanvasChange()}_positionChange(){pe(()=>{this._mediator.execute(new ic(this.transform,this.position()))},{injector:this._injector})}_scaleChange(){pe(()=>{this._mediator.execute(new oc(this.transform,this.scale()))},{injector:this._injector})}redraw(){this._mediator.execute(new si(this.transform)),this.hostElement.style.removeProperty("transition"),this.hostElement.style.transform=kt.toString(this.transform),this._mediator.execute(new At)}redrawWithAnimation(){this._mediator.execute(new si(this.transform)),this.hostElement.style.transition=`transform ${rb()?80:150}ms ease-in-out`,this.hostElement.style.transform=kt.toString(this.transform),bp(this.hostElement,()=>this.redraw())}centerGroupOrNode(e,n=!0){this._afterRedraw(()=>{this._mediator.execute(new tc(e,n))})}fitToScreen(e=A.initialize(),n=!0){this._afterRedraw(()=>{this._mediator.execute(new nc(e,n))})}resetScaleAndCenter(e=!0){this._afterRedraw(()=>{this._mediator.execute(new ac(e))})}getScale(){return this.transform.scale||1}setScale(e,n=A.initialize()){this._mediator.execute(new cc(e,n))}resetScale(){this._mediator.execute(new sc)}ngOnDestroy(){this._mediator.execute(new rc)}_afterRedraw(e){this._mediator.execute(new zi(this._componentsStore.connectionsRevision,this._componentsStore.nodesRevision,()=>xh(e,{injector:this._injector}),this.destroyRef))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["f-canvas"]],viewQuery:function(n,o){n&1&&St(o.fGroupsContainer,j_,5)(o.fNodesContainer,U_,5)(o.fConnectionsContainer,$_,5),n&2&&ut(3)},hostAttrs:[1,"f-component","f-canvas"],inputs:{position:[1,"position"],scale:[1,"scale"],debounceTime:[1,"debounceTime"]},outputs:{fCanvasChange:"fCanvasChange"},features:[De([{provide:lb,useExisting:t}]),ye],ngContentSelectors:q_,decls:12,vars:0,consts:[["fGroupsContainer",""],["fConnectionsContainer",""],["fNodesContainer",""],[1,"f-connections-container"]],template:function(n,o){n&1&&(Wt(W_),so(0),H(1,"div",null,0),Te(3),j(),H(4,"div",3,1),Te(6,1),Te(7,2),Te(8,3),j(),H(9,"div",null,2),Te(11,4),j(),ao())},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 fb=0,dm=(()=>{class t extends b0{fId=F(`f-connection-${fb++}`,{alias:"fConnectionId"});fOutputId=F("",{transform:e=>Nn(e)||""});fInputId=F("",{transform:e=>Nn(e)||""});fRadius=8;fOffset=12;fBehavior=Ot.FIXED;fType=Nt.STRAIGHT;fSelectionDisabled=F(!1,{transform:Ce});fReassignableStart=F(!1,{transform:Ce});fDraggingDisabled=F(!1,{alias:"fReassignDisabled",transform:Ce});fInputSide=F(We.DEFAULT,{transform:e=>Sn(e,"fInputSide",We)});fOutputSide=F(We.DEFAULT,{transform:e=>Sn(e,"fOutputSide",We)});get boundingElement(){return this.fPath().hostElement}_mediator=d(R);ngOnInit(){this._mediator.execute(new dc(this))}ngOnChanges(){this._mediator.execute(new Jt)}ngOnDestroy(){this._mediator.execute(new Rc(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["f-connection"]],hostAttrs:[1,"f-component","f-connection"],hostVars:5,hostBindings:function(n,o){n&2&&(Z("id",o.fId()),le("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",$e],fOffset:[2,"fOffset","fOffset",$e],fBehavior:[2,"fBehavior","fBehavior",e=>Sn(e,"fBehavior",Ot)],fType:"fType",fSelectionDisabled:[1,"fSelectionDisabled"],fReassignableStart:[1,"fReassignableStart"],fDraggingDisabled:[1,"fReassignDisabled","fDraggingDisabled"],fInputSide:[1,"fInputSide"],fOutputSide:[1,"fOutputSide"]},exportAs:["fComponent"],standalone:!1,features:[De([{provide:Sl,useExisting:t}]),ye,mn],ngContentSelectors:K_,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&&(Wt(X_),Ue(),u(0,"svg",1),B(1,"defs",null,0),Te(3),u(4,"g",2),b(5,Y_,1,1,":svg:linearGradient",3),B(6,"path",4),u(7,"g"),B(8,"path",5),b(9,Z_,1,0,":svg:circle",6),B(10,"circle",7),f()()(),Te(11,1),Te(12,2),Te(13,3),b(14,Q_,1,0)),n&2){let r;c(5),w((r=o.fGradient())?5:-1,r),c(),Z("d",o.path),c(2),P("useGradient",!!o.fGradient()),Z("d",o.path),c(),w(o.fReassignableStart()?9:-1),c(5),w(o.fContents().length?14:-1)}},dependencies:[Yu,y0,v0,f0,g0],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 hb=new ce("F_MAGNETIC_LINES"),pb=(()=>{class t{hostElement=d(Se).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,standalone:!1})}return t})();var lm=(()=>{class t extends pb{threshold=F(10,{transform:$e,alias:"fAlignThreshold"});_mediator=d(R);ngOnInit(){this._mediator.execute(new en(xe.MAGNETIC_LINES,this))}ngOnDestroy(){this._mediator.execute(new tn(xe.MAGNETIC_LINES))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["f-line-alignment"]],hostAttrs:[1,"f-line-alignment","f-component"],inputs:{threshold:[1,"fAlignThreshold","threshold"]},exportAs:["fComponent"],standalone:!1,features:[De([{provide:hb,useExisting:t}]),ye],decls:0,vars:0,template:function(n,o){},styles:[J_]})}return t})();var Pu=(()=>{class t{fMinSize=F(1e3);_mediator=d(R);hostElement=d(Se).nativeElement;model=new vl(this.hostElement);redraw(){let{scale:e,viewBox:n}=this._mediator.execute(new gl(this.hostElement,this.fMinSize()));this.model=new vl(this.hostElement,e,n),jh(n,this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,selectors:[["svg","fMinimapFlow",""]],inputs:{fMinSize:[1,"fMinSize"]}})}return t})(),Mu=(()=>{class t{_mediator=d(R);_elementRef=d(Se);hostElement=this._elementRef.nativeElement;redraw(){this.clear();let e=this._elementRef.nativeElement.ownerDocument.createDocumentFragment();this._mediator.execute(new _l).forEach(n=>{e.appendChild(n)}),this.hostElement.appendChild(e)}clear(){this.hostElement.replaceChildren()}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,selectors:[["g","fMinimapCanvas",""]]})}return t})(),Du=(()=>{class t{_mediator=d(R);hostElement=d(Se).nativeElement;redraw(){vu(this._mediator.execute(new yl),this.hostElement)}static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,selectors:[["rect","fMinimapView",""]],hostAttrs:[1,"f-component","f-minimap-view"]})}return t})(),mb=new ce("F_MINIMAP_BASE"),_b=(()=>{class t{hostElement=d(Se).nativeElement;static \u0275fac=function(n){return new(n||t)};static \u0275dir=Me({type:t,standalone:!1})}return t})(),um=(()=>{class t extends _b{_destroyRef=d(Ye);_mediator=d(R);_browser=d(Pe);_store=d(T);_canvas=ke.required(Mu);_flow=ke.required(Pu);_minimapView=ke.required(Du);fMinSize=F(1e3);fNodeRenderLimit=F(1500,{transform:$e});get state(){return this._flow().model}ngOnInit(){this._mediator.execute(new en(xe.MINIMAP,this))}ngAfterViewInit(){this._listenTransformChanges()}_listenTransformChanges(){this._mediator.execute(new Ja).pipe(wl(),ig()).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 tn(xe.MINIMAP))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["f-minimap"]],viewQuery:function(n,o){n&1&&St(o._canvas,Mu,5)(o._flow,Pu,5)(o._minimapView,Du,5),n&2&&ut(3)},hostAttrs:[1,"f-component","f-minimap"],inputs:{fMinSize:[1,"fMinSize"],fNodeRenderLimit:[1,"fNodeRenderLimit"]},exportAs:["fComponent"],features:[De([{provide:mb,useExisting:t}]),ye],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&&(Ue(),u(0,"svg",0),B(1,"g",1)(2,"rect",2),f()),n&2&&P("fMinSize",o.fMinSize())},dependencies:[Pu,Mu,Du],styles:["[_nghost-%COMP%]{display:block;position:absolute}[_nghost-%COMP%] svg[_ngcontent-%COMP%]{overflow:hidden}"],changeDetection:0})}return t})();var gb=0,yb=120,fm=(()=>{class t extends Xf{_destroyRef=d(Ye);_mediator=d(R);_browser=d(Pe);_componentsStore=d(T);_cache=d(vt);_injector=d(Ke);fId=F(`f-flow-${gb++}`,{alias:"fFlowId"});fCache=F(!1,{transform:Ce});hostElement=d(Se).nativeElement;fNodesRendered=nt();fFullRendered=nt();fLoaded=nt();ngOnInit(){this._mediator.execute(new el(this)),this._listenCacheChanges()}ngAfterContentInit(){this._browser.isBrowser()&&(this._listenNodesChanges(),this._listenConnectionsChanges())}_listenCacheChanges(){pe(()=>{this._cache.enabled=this.fCache()},{injector:this._injector})}_listenNodesChanges(){new yt(this._componentsStore.nodesChanges$,this._componentsStore.progressiveRenderChanges$).pipe(wl(),Qa(yb),ng()).listen(this._destroyRef,()=>{this._mediator.execute(new Vt)||this._componentsStore.hasPendingProgressiveRender||(this._mediator.execute(new bl),this._mediator.execute(new rl),this._mediator.execute(new zi(this._componentsStore.connectionsRevision+1,this._componentsStore.nodesRevision,()=>this._mediator.execute(new sl),this._destroyRef)),this._mediator.execute(new Jt))})}_listenConnectionsChanges(){this._mediator.execute(new In).listen(this._destroyRef,()=>{if(!this._mediator.execute(new Vt)){if(this._componentsStore.isViewportAnimating){this._mediator.execute(new cl(this._destroyRef));return}this._mediator.execute(new pi)}})}redraw(){this._mediator.execute(new Jt)}reset(){this._mediator.execute(new al)}getNodesBoundingBox(){return this._mediator.execute(new Yd)}getSelection(){return this._mediator.execute(new Gi)}getPositionInFlow(e){return this._mediator.execute(new Cl(e))}getState(e){return this._mediator.execute(new il(e?.measuredSize??!1))}selectAll(){this._mediator.execute(new In).pipe(Kh()).listen(this._destroyRef,()=>{this._mediator.execute(new fl)})}select(e,n,o=!0){this._mediator.execute(new In).pipe(Kh()).listen(this._destroyRef,()=>{this._mediator.execute(new ul(e,n,o))})}clearSelection(){this._mediator.execute(new dl)}ngOnDestroy(){this._mediator.execute(new ol(this))}static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275cmp=te({type:t,selectors:[["f-flow"]],hostAttrs:[1,"f-component","f-flow"],hostVars:1,hostBindings:function(n,o){n&2&&Z("id",o.fId())},inputs:{fId:[1,"fFlowId","fId"],fCache:[1,"fCache"]},outputs:{fNodesRendered:"fNodesRendered",fFullRendered:"fFullRendered",fLoaded:"fLoaded"},features:[De([R,...ug,Rp,Hn,...sb,K,...RC,{provide:Jf,useExisting:t}]),ye],ngContentSelectors:tg,decls:7,vars:0,template:function(n,o){n&1&&(Wt(eg),so(0),Te(1),Te(2,1),Te(3,2),Te(4,3),Te(5,4),Te(6,5),ao())},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 hm=(()=>{class t{fVirtualForOf=[];fVirtualForTrackBy;_vc=d(oo);_tpl=d(bh);_zone=d(Zn);_componentsStore=d(T,{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 s=this.fVirtualForOf[n],a=this._vc.createEmbeddedView(this._tpl,{$implicit:s,index:n});this._views.push(a),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=Me({type:t,selectors:[["","fVirtualFor","","fVirtualForOf",""]],inputs:{fVirtualForOf:"fVirtualForOf",fVirtualForTrackBy:"fVirtualForTrackBy"},features:[mn]})}return t})();var Tt=(function(t){return t[t.ZOOM_IN=1]="ZOOM_IN",t[t.ZOOM_OUT=-1]="ZOOM_OUT",t})(Tt||{}),vb=new ce("F_ZOOM"),Yf=class{},Cb=.1,xb=1,bb=.5,wb=60,Sb=.5;function Ib(t){return Math.abs(t.deltaY)>=Math.abs(t.deltaX)?t.deltaY:t.deltaX}function Tb(t,i,e){return Eb(t)?Mb(i,e):Pb(i,e)}function Eb(t){return(t.ctrlKey||t.metaKey)&&t.deltaMode===WheelEvent.DOM_DELTA_PIXEL}function Pb(t,i){let e=Math.abs(t)/100,n=pm(e,Cb,xb);return i*n}function Mb(t,i){if(Math.abs(t)<bb)return 0;let e=Math.abs(t)/wb,n=pm(e,0,Sb);return i*n}function pm(t,i,e){return Math.max(i,Math.min(e,t))}var ji=(()=>{class t extends Yf{_mediator=d(R);_injector=d(Ke);_store=d(T);_triggersListener=ue.emptyListener();isEnabled=F(!1,{alias:"fZoom",transform:Ce});fWheelTrigger=ht;fDblClickTrigger=ht;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 en(xe.ZOOM,this))}ngAfterViewInit(){this._listenZoomEnabledChanges()}_listenZoomEnabledChanges(){pe(()=>{this.isEnabled(),_t(()=>this._listenTriggers())},{injector:this._injector})}_listenTriggers(){this._flowHost&&(this._disposeListeners(),this.isEnabled()&&(this._listen("wheel",this._onWheel,ue.activeListener()),this._listen("dblclick",this._onDoubleClick),this._triggersListener=()=>{this._unlisten("wheel",this._onWheel,ue.activeListener()),this._unlisten("dblclick",this._onDoubleClick)}))}_onWheel=e=>{if(!ct(e,this.fWheelTrigger)||(e.preventDefault(),e.target?.closest("[fLockedContext]")))return;let o=Ib(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 Tb(e,n,this.step)}_calculateDirection(e){return e>0?Tt.ZOOM_OUT:Tt.ZOOM_IN}_onDoubleClick=e=>{if(!ct(e,this.fDblClickTrigger))return;e.preventDefault();let n=e.target;Wy(n)||n?.closest("[fLockedContext]")||this.setZoom(A.initialize(e.clientX,e.clientY),this.dblClickStep,Tt.ZOOM_IN,!0)};_getToCenterPosition(e,n){return A.initialize(e?.x||n.gravityCenter.x,e?.y||n.gravityCenter.y)}zoomIn(e){this._onZoomToCenter(Tt.ZOOM_IN,e)}zoomOut(e){this._onZoomToCenter(Tt.ZOOM_OUT,e)}_onZoomToCenter(e,n){this.setZoom(this._getToCenterPosition(n,G.fromElement(this._flowHost)),this.step,e,!1)}setZoom(e,n,o,r){this._mediator.execute(new ml(e,n,o,r))}getZoomValue(){return this._canvas.transform.scale||1}reset(){this._mediator.execute(new pl)}_disposeListeners(){this._triggersListener(),this._triggersListener=ue.emptyListener()}ngOnDestroy(){this._disposeListeners(),this._mediator.execute(new tn(xe.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=Me({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",$e],maximum:[2,"fZoomMaximum","maximum",$e],step:[2,"fZoomStep","step",$e],dblClickStep:[2,"fZoomDblClickStep","dblClickStep",$e]},features:[De([{provide:vb,useExisting:t}]),ye]})}return t})();var mm=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=ro({type:t});static \u0275inj=to({imports:[lo]})}return t})();var eh={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:{closeLabel:"Close panel",resizeLabel:"Resize panel"},resetLayoutConfirm:"Reset all node positions to the automatic layout? This cannot be undone."};var th={graph:{perf:{cache:!0,virtualization:!1},perfHud:!0}};var _m={a11y:{toolbarLabel:"Toggle node kinds"},favorites:{label:"Favorites"}};function kb(t,i){if(t&1&&Pt(0,"i",4),t&2){let e=p();ve(e.piClass()),st("font-size",e.size(),"px")}}function Rb(t,i){if(t&1&&(Ue(),H(0,"svg",1),Pt(1,"path"),j()),t&2){let e=p();Z("width",e.size())("height",e.size()),c(),Z("d",e.svgPath())}}function Nb(t,i){if(t&1&&(H(0,"span",4),m(1),j()),t&2){let e=p();st("font-size",e.size(),"px")("line-height",e.size(),"px"),c(),y(e.emoji())}}function Ob(t,i){if(t&1&&(H(0,"span",5),m(1),j()),t&2){let e=p();st("font-size",e.size(),"px")("line-height",e.size(),"px"),c(),y(e.letter())}}var Ht=class t{kindRegistry=d(Dt);kind=F.required();size=F(18);variant=E(()=>{let i=this.kindRegistry.lookup(this.kind());return i?.icon?.kind==="pi"?"pi":i?.icon?.kind==="svg"?"svg":i?.emoji?"emoji":"letter"});piClass=E(()=>{let i=this.kindRegistry.lookup(this.kind())?.icon;return i?.kind==="pi"?`pi ${i.id}`:""});svgPath=E(()=>{let i=this.kindRegistry.lookup(this.kind())?.icon;return i?.kind==="svg"?i.path:""});emoji=E(()=>this.kindRegistry.lookup(this.kind())?.emoji??"");letter=E(()=>this.kindRegistry.labelOf(this.kind()).charAt(0).toUpperCase());static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({type:t,selectors:[["sm-kind-icon"]],inputs:{kind:[1,"kind"],size:[1,"size"]},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&&b(0,kb,1,4,"i",0)(1,Rb,2,3,":svg:svg",1)(2,Nb,2,5,"span",2)(3,Ob,2,5,"span",3),e&2){let o;w((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 Lb=(t,i)=>i.kind;function Bb(t,i){if(t&1&&(B(0,"sm-kind-icon",5),u(1,"span"),m(2),f()),t&2){let e=p().$implicit;P("kind",e.kind)("size",16),c(2),y(e.count)}}function zb(t,i){if(t&1){let e=de();u(0,"p-togglebutton",4),Q("ngModelChange",function(){let o=$(e).$implicit,r=p();return W(r.toggle(o.kind))}),Ie(1,Bb,3,3,"ng-template",null,0,Jn),f()}if(t&2){let e=i.$implicit,n=p();P("ngModel",n.isActive(e.kind))("pTooltip",e.label)("ariaLabel",e.label)("styleClass","kind-palette__btn kind-palette__btn--"+e.kind),Z("data-testid","kind-palette-"+e.kind)}}function Gb(t,i){if(t&1&&(B(0,"i",7),u(1,"span"),m(2),f()),t&2){let e=p(2);ve(e.favoritesActive()?"pi pi-heart-fill":"pi pi-heart"),c(2),y(e.favoritesCount())}}function Vb(t,i){if(t&1){let e=de();u(0,"p-togglebutton",6),Q("ngModelChange",function(){$(e);let o=p();return W(o.toggleFavoritesOnly())}),Ie(1,Gb,3,3,"ng-template",null,0,Jn),f()}if(t&2){let e=p();P("ngModel",e.favoritesActive())("pTooltip",e.texts.favorites.label)("ariaLabel",e.texts.favorites.label)}}var Dl=class t{loader=d(Mt);filters=d(yo);kindRegistry=d(Dt);texts=_m;entries=E(()=>{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=E(()=>this.loader.nodes().filter(i=>i.isFavorite===!0).length);showFavorites=E(()=>this.loader.hasAnyFavorites()||this.filters.favoritesOnly());favoritesActive=E(()=>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=te({type:t,selectors:[["app-kind-palette"]],decls:4,vars:2,consts:[["content",""],["role","toolbar","data-testid","kind-palette",1,"kind-palette"],[3,"ngModel","pTooltip","ariaLabel","styleClass"],["styleClass","kind-palette__btn kind-palette__btn--favorites","data-testid","kind-palette-favorites",3,"ngModel","pTooltip","ariaLabel"],[3,"ngModelChange","ngModel","pTooltip","ariaLabel","styleClass"],[3,"kind","size"],["styleClass","kind-palette__btn kind-palette__btn--favorites","data-testid","kind-palette-favorites",3,"ngModelChange","ngModel","pTooltip","ariaLabel"],["aria-hidden","true"]],template:function(e,n){e&1&&(u(0,"div",1),J(1,zb,3,5,"p-togglebutton",2,Lb),b(3,Vb,3,3,"p-togglebutton",3),f()),e&2&&(Z("aria-label",n.texts.a11y.toolbarLabel),c(),ee(n.entries()),c(2),w(n.showFavorites()?3:-1))},dependencies:[xo,vo,Co,wo,bo,He,Qe,Ht],styles:["[_nghost-%COMP%]{position:absolute;top:16px;left:16px;z-index:2;pointer-events:none}.kind-palette[_ngcontent-%COMP%]{pointer-events:auto;display:flex;flex-direction:column;gap:2px;padding:4px;background:var(--sm-bg-content);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: 999px;--p-togglebutton-content-border-radius: 999px;--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__btn .p-togglebutton-content{width:100%;height:100%;justify-content:flex-start;display:flex;align-items:center;gap:.4rem}[_nghost-%COMP%] .kind-palette__btn .p-togglebutton-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 Ui={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",tools:"tools",tags:"tags"},stats:{errors:t=>`${t} error${t===1?"":"s"}`,warns:t=>`${t} warning${t===1?"":"s"}`,tools:t=>`${t} tool${t===1?"":"s"}`,toolsBreakdown:(t,i)=>`${t} allowlist + ${i} pre-approved`,linksIn:t=>`${t} incoming link${t===1?"":"s"}`,linksOut:t=>`${t} outgoing link${t===1?"":"s"}`,extRefs:t=>`${t} external URL${t===1?"":"s"} in body`,bytes:t=>`${t.toLocaleString("en-US")} bytes`,tokens:t=>`${t.toLocaleString("en-US")} tokens`,daysAgo:(t,i)=>`updated ${t} (${i} day${i===1?"":"s"} ago)`},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."},safety:{injection:t=>`injection${t?`: ${t}`:""}`},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"};function kl(t){if(!t)return null;let i=t.sidecar?.annotations;if(i&&typeof i.version=="number")return`v${i.version}`;let e=Kt(t.frontmatter)?.version;return typeof e=="string"&&e.length>0?`v${e}`:null}function Rl(t){if(!t)return null;let e=t.sidecar?.annotations?.stability;if(e==="stable"||e==="experimental"||e==="deprecated")return e;let n=Kt(t.frontmatter)?.stability;return n==="stable"||n==="experimental"||n==="deprecated"?n:null}function gm(t){if(!t)return null;let i=t.sidecar?.root?.audit;if(!i||typeof i!="object"||Array.isArray(i))return null;let e=i.lastBumpedAt;if(typeof e!="string"||e.length===0)return null;let n=new Date(e);if(isNaN(n.getTime()))return null;let o=Math.max(0,Math.floor((Date.now()-n.getTime())/864e5));return{short:`${o}d`,iso:e,days:o}}function nh(t){if(!t)return{agentTools:0,skillBaseAllowedTools:0};let i=t.frontmatter,e=t.kind==="agent"&&Array.isArray(i.tools)?i.tools.length:0,n=0;if(t.kind==="skill"||t.kind==="command"){let o=i["allowed-tools"];Array.isArray(o)?n=o.length:typeof o=="string"&&o.length>0&&(n=1)}return{agentTools:e,skillBaseAllowedTools:n}}function ym(t){let{agentTools:i,skillBaseAllowedTools:e}=nh(t);return i+e}function vm(t){if(!t)return[];let i=t.frontmatter,e=[];if(t.kind==="agent"&&Array.isArray(i.tools))for(let n of i.tools)typeof n=="string"&&n.length>0&&e.push(n);if(t.kind==="skill"||t.kind==="command"){let n=i["allowed-tools"];if(Array.isArray(n))for(let o of n)typeof o=="string"&&o.length>0&&e.push(o);else typeof n=="string"&&n.length>0&&e.push(n)}return e}function Nl(t){return go(t?.sidecar)}function Ol(t,i){switch(t?.sidecar?.status){case"stale-body":return i.staleBody;case"stale-frontmatter":return i.staleFrontmatter;case"stale-both":return i.staleBoth;default:return""}}function ih(t){return t<1e3?`${t}`:t<1e4?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}k`:`${Math.round(t/1e3)}k`}function Cm(t){let i=new Date(t);if(isNaN(i.getTime()))return t;let e=Date.now()-i.getTime(),n=Math.floor(e/1e3);if(n<60)return"just now";let o=Math.floor(n/60);if(o<60)return`${o} minute${o===1?"":"s"} ago`;let r=Math.floor(o/60);if(r<24)return`${r} hour${r===1?"":"s"} ago`;let s=Math.floor(r/24);if(s<30)return`${s} day${s===1?"":"s"} ago`;let a=Math.floor(s/30);if(a<12)return`${a} month${a===1?"":"s"} ago`;let l=Math.floor(s/365);return`${l} year${l===1?"":"s"} ago`}var Hb=(t,i)=>i.step,jb=(t,i)=>i.ruleId+i.message;function Ub(t,i){if(t&1&&(u(0,"span",29),m(1),f()),t&2){let e=p(),n=Y(0),o=Y(2);ve("sm-gnode__llm-marker--"+o),P("pTooltip",e.texts.confidence(n.confidence)),c(),Ve("",e.confidencePct(),"%")}}function $b(t,i){t&1&&(u(0,"span",8),m(1),f()),t&2&&(c(),y(i))}function Wb(t,i){if(t&1&&(u(0,"span",12)(1,"span",30),m(2,"T"),f(),m(3),f()),t&2){let e=p(),n=Y(1);P("pTooltip",e.texts.stats.tokens(n.tokensTotal)),c(3),y(e.tokensShort())}}function qb(t,i){if(t&1&&(u(0,"span",13)(1,"span",30),m(2,"B"),f(),m(3),f()),t&2){let e=p(),n=Y(1);P("pTooltip",e.texts.stats.bytes(n.bytesTotal)),c(3),y(e.bytesShort())}}function Xb(t,i){if(t&1&&(u(0,"span",14),B(1,"i",31),m(2),f()),t&2){let e=i,n=p();P("pTooltip",n.texts.stats.daysAgo(e.iso,e.days)),c(2),y(e.short)}}function Kb(t,i){if(t&1&&(u(0,"span",32),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function Yb(t,i){if(t&1&&(u(0,"span",33),m(1),f()),t&2){p(2);let e=Y(4);c(),Ve("+",e," more")}}function Zb(t,i){if(t&1&&(u(0,"div",17),J(1,Kb,2,1,"span",32,me),b(3,Yb,2,1,"span",33),f()),t&2){p();let e=Y(3),n=Y(4);c(),ee(e),c(2),w(n>0?3:-1)}}function Qb(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.what.tooltip),c(),y(n.texts.llm.what.label),c(2),y(e.whatItCovers)}}function Jb(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function ew(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,Jb,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.topics.tooltip),c(),y(n.texts.llm.topics.label),c(2),ee(e.topics)}}function tw(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function nw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,tw,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.facts.tooltip),c(),y(n.texts.llm.facts.label),c(2),ee(e.keyFacts)}}function iw(t,i){if(t&1&&(b(0,Qb,5,3,"div",34),b(1,ew,6,2,"div",34),b(2,nw,6,2,"div",34)),t&2){let e=i,n=p(2);w(n.showLlmWhat?0:-1),c(),w(e.topics!=null&&e.topics.length?1:-1),c(),w(e.keyFacts!=null&&e.keyFacts.length?2:-1)}}function ow(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.what.tooltip),c(),y(n.texts.llm.what.label),c(2),y(e.whatItDoes)}}function rw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.when.tooltip),c(),y(n.texts.llm.when.label),c(2),y(e.whenToUse)}}function sw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.style.tooltip),c(),y(n.texts.llm.style.label),c(2),y(e.interactionStyle)}}function aw(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function cw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,aw,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.does.tooltip),c(),y(n.texts.llm.does.label),c(2),ee(e.capabilities)}}function dw(t,i){if(t&1&&(b(0,ow,5,3,"div",34),b(1,rw,5,3,"div",34),b(2,sw,5,3,"div",34),b(3,cw,6,2,"div",34)),t&2){let e=i,n=p(2);w(n.showLlmWhat?0:-1),c(),w(e.whenToUse?1:-1),c(),w(e.interactionStyle?2:-1),c(),w(e.capabilities!=null&&e.capabilities.length?3:-1)}}function lw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.what.tooltip),c(),y(n.texts.llm.what.label),c(2),y(e.whatItDoes)}}function uw(t,i){if(t&1&&m(0),t&2){let e=i.$implicit,n=i.$index,o=i.$count;Eh("",e.step,". ",e.description,"",n===o-1?"":" \xB7 ")}}function fw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),J(4,uw,1,3,null,null,Hb),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.steps.tooltip),c(),y(n.texts.llm.steps.label),c(2),ee(e.recipe)}}function hw(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function pw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,hw,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.pre.tooltip),c(),y(n.texts.llm.pre.label),c(2),ee(e.preconditions)}}function mw(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function _w(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,mw,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.out.tooltip),c(),y(n.texts.llm.out.label),c(2),ee(e.outputs)}}function gw(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function yw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,gw,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.fx.tooltip),c(),y(n.texts.llm.fx.label),c(2),ee(e.sideEffects)}}function vw(t,i){if(t&1&&(b(0,lw,5,3,"div",34),b(1,fw,6,2,"div",34),b(2,pw,6,2,"div",34),b(3,_w,6,2,"div",34),b(4,yw,6,2,"div",34)),t&2){let e=i,n=p(2);w(n.showLlmWhat?0:-1),c(),w(e.recipe!=null&&e.recipe.length?1:-1),c(),w(e.preconditions!=null&&e.preconditions.length?2:-1),c(),w(e.outputs!=null&&e.outputs.length?3:-1),c(),w(e.sideEffects!=null&&e.sideEffects.length?4:-1)}}function Cw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"span"),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.what.tooltip),c(),y(n.texts.llm.what.label),c(2),y(e.whatItDoes)}}function xw(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"code",38),m(4),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.eg.tooltip),c(),y(n.texts.llm.eg.label),c(2),y(e.invocationExample)}}function bw(t,i){if(t&1&&(u(0,"span",37),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function ww(t,i){if(t&1&&(u(0,"div",34)(1,"span",35),m(2),f(),u(3,"div",36),J(4,bw,2,1,"span",37,me),f()()),t&2){let e=p(),n=p(2);c(),P("pTooltip",n.texts.llm.fx.tooltip),c(),y(n.texts.llm.fx.label),c(2),ee(e.sideEffects)}}function Sw(t,i){if(t&1&&(b(0,Cw,5,3,"div",34),b(1,xw,5,3,"div",34),b(2,ww,6,2,"div",34)),t&2){let e=i,n=p(2);w(n.showLlmWhat?0:-1),c(),w(e.invocationExample?1:-1),c(),w(e.sideEffects!=null&&e.sideEffects.length?2:-1)}}function Iw(t,i){if(t&1&&(u(0,"div",19),b(1,iw,3,3),b(2,dw,4,4),b(3,vw,5,5),b(4,Sw,3,3),f()),t&2){let e,n,o,r,s=p();c(),w((e=s.summaryMarkdown())?1:-1,e),c(),w((n=s.summaryAgent())?2:-1,n),c(),w((o=s.summarySkill())?3:-1,o),c(),w((r=s.summaryCommand())?4:-1,r)}}function Tw(t,i){if(t&1&&(u(0,"div",20),m(1),f()),t&2){let e=p();c(),y(e.description())}}function Ew(t,i){if(t&1&&(u(0,"div",39)(1,"div",40)(2,"span",41),m(3),f(),u(4,"span",42),m(5),f()()()),t&2){let e=p(),n=p();c(3),y(n.texts.meta.model),c(2),y(e.model)}}function Pw(t,i){t&1&&b(0,Ew,6,2,"div",39),t&2&&w(i.model?0:-1)}function Mw(t,i){if(t&1&&(u(0,"div",44),B(1,"i",45),u(2,"code",46),m(3),f(),u(4,"span",47),m(5),f()()),t&2){let e=i.$implicit;ve("sm-gnode__issue--"+e.severity),P("pTooltip",e.detail??e.ruleId+" \xB7 "+e.message),c(),le("pi",!0)("pi-times-circle",e.severity==="error")("pi-exclamation-triangle",e.severity==="warn"),c(2),y(e.ruleId),c(2),y(e.message)}}function Dw(t,i){if(t&1&&(u(0,"div",21),J(1,Mw,6,11,"div",43,jb),f()),t&2){let e=p();c(),ee(e.visibleIssues())}}function kw(t,i){if(t&1&&(u(0,"span",23),B(1,"i",48),u(2,"span",49),m(3),f()()),t&2){let e=p();P("pTooltip",e.texts.stats.errors(e.errorCount())),c(3),y(e.errorCount())}}function Rw(t,i){if(t&1&&(u(0,"span",24),B(1,"i",50),u(2,"span",49),m(3),f()()),t&2){let e=p();P("pTooltip",e.texts.stats.warns(e.warnCount())),c(3),y(e.warnCount())}}function Nw(t,i){if(t&1&&(u(0,"span",25),B(1,"i",51),u(2,"span",49),m(3),f()()),t&2){let e=p();P("pTooltip",e.toolsTooltip()),c(3),y(e.toolsCount())}}function Ow(t,i){if(t&1&&(u(0,"span",26),B(1,"i",52),u(2,"span",49),m(3),f()()),t&2){let e=p();P("pTooltip",e.texts.stats.linksIn(e.linksIn())),c(3),y(e.linksIn())}}function Fw(t,i){if(t&1&&(u(0,"span",27),B(1,"i",53),u(2,"span",49),m(3),f()()),t&2){let e=p();P("pTooltip",e.texts.stats.linksOut(e.linksOut())),c(3),y(e.linksOut())}}function Aw(t,i){if(t&1&&(u(0,"span",25),B(1,"i",54),u(2,"span",49),m(3),f()()),t&2){let e=p(),n=Y(1);P("pTooltip",e.texts.stats.extRefs(n.externalRefsCount)),c(3),y(n.externalRefsCount)}}function Lw(t,i){if(t&1&&(u(0,"span",55),B(1,"i",57),f()),t&2){let e=p(2);P("pTooltip",e.sidecarTooltip()),Z("data-testid","node-card-stale-badge")}}function Bw(t,i){if(t&1&&(u(0,"span",25),Ue(),u(1,"svg",58),B(2,"path",59)(3,"path",60)(4,"path",61),f()()),t&2){let e=p(2);P("pTooltip",e.texts.stability.experimental)}}function zw(t,i){if(t&1&&(u(0,"span",25),B(1,"i",62),f()),t&2){let e=p(2);P("pTooltip",e.texts.stability.deprecated)}}function Gw(t,i){if(t&1&&(u(0,"span",56),Ue(),u(1,"svg",58),B(2,"path",63)(3,"line",64)(4,"line",65),f()()),t&2){let e=p(2);P("pTooltip",e.texts.safety.injection(e.injectionType()))}}function Vw(t,i){if(t&1&&(u(0,"div",28),b(1,Lw,2,2,"span",55),b(2,Bw,5,1,"span",25),b(3,zw,2,1,"span",25),b(4,Gw,5,1,"span",56),f()),t&2){let e=p();c(),w(e.isStale()?1:-1),c(),w(e.stability()==="experimental"?2:-1),c(),w(e.stability()==="deprecated"?3:-1),c(),w(e.hasInjection()?4:-1)}}var Fl=class t{node=F.required();stats=F({linksIn:0,linksOut:0});summary=F(null);issues=F([]);selected=F(!1);highlighted=F(!1);dimmed=F(!1);isFavorite=F(!1);favoriteToggle=nt();texts=Ui;showLlmWhat=!1;showLlmConfidence=!1;expanded=qt(!1);fmAgent=E(()=>{let i=this.node();return i.kind==="agent"?i.frontmatter:null});summaryAgent=E(()=>{let i=this.summary();return i?.kind==="agent"?i:null});summarySkill=E(()=>{let i=this.summary();return i?.kind==="skill"?i:null});summaryCommand=E(()=>{let i=this.summary();return i?.kind==="command"?i:null});summaryMarkdown=E(()=>{let i=this.summary();return i?.kind==="markdown"?i:null});hasLlmCluster=E(()=>{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}}hasInjection=E(()=>this.summary()?.safety.injectionDetected===!0);confidenceTier=E(()=>{let i=this.summary();return i?i.confidence>.8?"high":i.confidence>=.5?"med":"low":null});confidencePct=E(()=>{let i=this.summary();return i?Math.round(i.confidence*100):null});injectionType=E(()=>{let i=this.summary();return i?.safety.injectionDetected?i.safety.injectionType??null:null});visibleIssues=E(()=>this.issues().filter(i=>i.severity==="error"||i.severity==="warn"));errorCount=E(()=>this.visibleIssues().filter(i=>i.severity==="error").length);warnCount=E(()=>this.visibleIssues().filter(i=>i.severity==="warn").length);nodeColor=E(()=>this.agentVendorColor());kindRegistry=d(Dt);providerAccent=E(()=>{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});bytesShort=E(()=>{let i=this.stats().bytesTotal;return i===void 0?null:ih(i)});tokensShort=E(()=>{let i=this.stats().tokensTotal;return i===void 0?null:ih(i)});daysAgo=E(()=>gm(this.node()));version=E(()=>kl(this.node()));stability=E(()=>Rl(this.node()));tags=E(()=>{let e=this.node().sidecar?.annotations?.tags;if(Array.isArray(e))return e.filter(o=>typeof o=="string"&&o.length>0);let n=Kt(this.node().frontmatter)?.tags;return Array.isArray(n)?n.filter(o=>typeof o=="string"&&o.length>0):[]});visibleTags=E(()=>this.tags().slice(0,3));moreTagsCount=E(()=>Math.max(0,this.tags().length-3));agentVendorColor=E(()=>{let i=this.node();if(i.kind!=="agent")return null;let n=i.frontmatter.color;return typeof n=="string"&&n.length>0?n:null});linksOut=E(()=>this.node().linksOutCount??this.stats().linksOut??0);linksIn=E(()=>this.node().linksInCount??this.stats().linksIn??0);isStale=E(()=>Nl(this.node()));sidecarStatus=E(()=>this.node().sidecar?.status??null);sidecarTooltip=E(()=>Ol(this.node(),this.texts.sidecar));displayName=E(()=>this.node().frontmatter.name||this.node().path);description=E(()=>this.node().frontmatter.description??"");toolsCount=E(()=>ym(this.node()));toolsTooltip=E(()=>{let{agentTools:i,skillBaseAllowedTools:e}=nh(this.node());return this.texts.stats.toolsBreakdown(i,e)});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=te({type:t,selectors:[["sm-node-card"]],hostAttrs:[1,"sm-gnode"],hostVars:26,hostBindings:function(e,n){e&2&&(st("--node-color",n.nodeColor())("--accent",n.providerAccent()),le("sm-gnode--skill",n.node().kind==="skill")("sm-gnode--agent",n.node().kind==="agent")("sm-gnode--command",n.node().kind==="command")("sm-gnode--markdown",n.node().kind==="markdown")("sm-gnode--danger",n.hasInjection())("sm-gnode--with-color",!!n.nodeColor())("sm-gnode--deprecated",n.stability()==="deprecated")("sm-gnode--expanded",n.expanded())("sm-gnode--selected",n.selected())("sm-gnode--highlighted",n.highlighted())("sm-gnode--dimmed",n.dimmed()))},inputs:{node:[1,"node"],stats:[1,"stats"],summary:[1,"summary"],issues:[1,"issues"],selected:[1,"selected"],highlighted:[1,"highlighted"],dimmed:[1,"dimmed"],isFavorite:[1,"isFavorite"],expanded:[1,"expanded"]},outputs:{favoriteToggle:"favoriteToggle",expanded:"expandedChange"},decls:37,vars:33,consts:[[1,"sm-gnode__main"],["aria-hidden","true",1,"sm-gnode__icon-box"],[3,"kind","size"],[1,"sm-gnode__content"],[1,"sm-gnode__name-row"],[1,"sm-gnode__name",3,"pTooltip"],[1,"sm-gnode__actions"],[1,"sm-gnode__confidence",3,"class","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"],[1,"sm-gnode__sub-stat","sm-gnode__sub-stat--date",3,"pTooltip"],["type","button","data-testid","node-card-favorite",1,"sm-gnode__favorite",3,"click","pTooltip"],["aria-hidden","true"],["data-testid","node-card-tags",1,"sm-gnode__tagrow"],[1,"sm-gnode__panel"],[1,"sm-gnode__llm"],[1,"sm-gnode__desc"],[1,"sm-gnode__issues-block"],[1,"sm-gnode__footer"],[1,"sm-gnode__stat","sm-gnode__stat--error",3,"pTooltip"],[1,"sm-gnode__stat","sm-gnode__stat--warn",3,"pTooltip"],[1,"sm-gnode__stat",3,"pTooltip"],["data-testid","node-card-links-in",1,"sm-gnode__stat",3,"pTooltip"],["data-testid","node-card-links-out",1,"sm-gnode__stat",3,"pTooltip"],[1,"sm-gnode__footer-end"],[1,"sm-gnode__confidence",3,"pTooltip"],[1,"sm-gnode__sub-key"],["aria-hidden","true",1,"pi","pi-calendar"],[1,"sm-gnode__tag-chip"],["data-testid","node-card-tags-more",1,"sm-gnode__tag-more"],[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,"class","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,"pi","pi-times-circle"],[1,"sm-gnode__stat-num"],["aria-hidden","true",1,"pi","pi-exclamation-triangle"],["aria-hidden","true",1,"pi","pi-wrench"],["aria-hidden","true",1,"pi","pi-arrow-down"],["aria-hidden","true",1,"pi","pi-arrow-up"],["aria-hidden","true",1,"pi","pi-link"],[1,"sm-gnode__stat","sm-gnode__stat--stale",3,"pTooltip"],[1,"sm-gnode__stat","sm-gnode__stat--danger",3,"pTooltip"],["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"],["d","M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"],["x1","12","y1","8","x2","12","y2","12"],["x1","12","y1","16","x2","12.01","y2","16"]],template:function(e,n){if(e&1&&(Ze(0)(1)(2)(3)(4),u(5,"div",0)(6,"div",1),B(7,"sm-kind-icon",2),f(),u(8,"div",3)(9,"div",4)(10,"span",5),m(11),f()()(),u(12,"div",6),b(13,Ub,2,4,"span",7),b(14,$b,2,1,"span",8),u(15,"button",9),Q("click",function(r){return n.toggleExpanded(r)}),B(16,"i",10),f()(),u(17,"div",11),b(18,Wb,4,2,"span",12),b(19,qb,4,2,"span",13),b(20,Xb,3,2,"span",14),u(21,"button",15),Q("click",function(r){return n.toggleFavorite(r)}),B(22,"i",16),f()()(),b(23,Zb,4,1,"div",17),u(24,"div",18),b(25,Iw,5,4,"div",19),b(26,Tw,2,1,"div",20),b(27,Pw,1,1),b(28,Dw,3,0,"div",21),f(),u(29,"div",22),b(30,kw,4,2,"span",23),b(31,Rw,4,2,"span",24),b(32,Nw,4,2,"span",25),b(33,Ow,4,2,"span",26),b(34,Fw,4,2,"span",27),b(35,Aw,4,2,"span",25),b(36,Vw,5,4,"div",28),f()),e&2){let o,r,s,a=n.node(),l=Fe(n.summary());c();let h=Fe(n.stats());c();let _=Fe(n.confidenceTier());c();let v=Fe(n.visibleTags());c(),Fe(n.moreTagsCount()),c(3),P("kind",a.kind)("size",18),c(3),P("pTooltip",n.displayName()),c(),y(n.displayName()),c(2),w(n.showLlmConfidence&&l!==null&&_!==null?13:-1),c(),w((o=n.version())?14:-1,o),c(),Z("aria-label",n.texts.ariaExpand),c(3),w(n.tokensShort()!==null?18:-1),c(),w(n.bytesShort()!==null?19:-1),c(),w((r=n.daysAgo())?20:-1,r),c(),le("sm-gnode__favorite--on",n.isFavorite()),P("pTooltip",n.isFavorite()?n.texts.favoriteRemoveTooltip:n.texts.favoriteAddTooltip),Z("aria-label",n.isFavorite()?n.texts.ariaFavoriteRemove:n.texts.ariaFavoriteAdd),c(),ve(n.isFavorite()?"pi pi-heart-fill":"pi pi-heart"),c(),w(v.length?23:-1),c(2),w(n.hasLlmCluster()?25:-1),c(),w(n.description()?26:-1),c(),w((s=n.fmAgent())?27:-1,s),c(),w(n.visibleIssues().length?28:-1),c(2),w(n.errorCount()>0?30:-1),c(),w(n.warnCount()>0?31:-1),c(),w(n.toolsCount()>0?32:-1),c(),w(n.linksIn()>0?33:-1),c(),w(n.linksOut()>0?34:-1),c(),w(h.externalRefsCount&&h.externalRefsCount>0?35:-1),c(),w(n.stability()==="experimental"||n.stability()==="deprecated"||n.hasInjection()||n.isStale()?36:-1)}},dependencies:[Ht,He,Qe],styles:['[_nghost-%COMP%]{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,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, var(--sm-kind-markdown))}.sm-gnode--skill[_nghost-%COMP%]{--accent: var(--sm-kind-skill)}.sm-gnode--agent[_nghost-%COMP%]{--accent: var(--sm-kind-agent)}.sm-gnode--command[_nghost-%COMP%]{--accent: var(--sm-kind-command)}.sm-gnode--markdown[_nghost-%COMP%]{--accent: var(--sm-kind-markdown)}.sm-gnode--danger[_nghost-%COMP%]{--accent: var(--sm-severity-error)}.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%]{width:38px;height:38px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:var(--kind-bg, var(--sm-kind-markdown-bg));color:var(--kind-fg, var(--sm-kind-markdown-fg));flex:none;font-size:1.05rem;grid-row:1 / span 2;align-self:center}.sm-gnode--skill[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-skill-bg);--kind-fg: var(--sm-kind-skill-fg)}.sm-gnode--agent[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-agent-bg);--kind-fg: var(--sm-kind-agent-fg)}.sm-gnode--command[_nghost-%COMP%] .sm-gnode__icon-box[_ngcontent-%COMP%]{--kind-bg: var(--sm-kind-command-bg);--kind-fg: var(--sm-kind-command-fg)}.sm-gnode--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[_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, var(--sm-kind-markdown)) 10%,transparent);padding:.05rem .35rem;border-radius:3px;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:3px}.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:4px;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%]{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:4px;margin-left:auto;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%]{grid-column:2 / -1;grid-row:2;display:flex;flex-wrap:nowrap;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%}.sm-gnode__sub-stat[_ngcontent-%COMP%]{padding:.08rem .35rem;border-radius:3px;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:color-mix(in srgb,var(--sm-kind-agent) 7%,transparent)}.sm-gnode__sub-stat--bytes[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-command) 7%,transparent)}.sm-gnode__sub-stat--date[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-skill) 7%,transparent)}.app-dark[_nghost-%COMP%] .sm-gnode__sub-stat--tokens[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__sub-stat--tokens[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-agent) 22%,transparent);color:var(--sm-kind-agent-fg)}.app-dark[_nghost-%COMP%] .sm-gnode__sub-stat--bytes[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__sub-stat--bytes[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-command) 22%,transparent);color:var(--sm-kind-command-fg)}.app-dark[_nghost-%COMP%] .sm-gnode__sub-stat--date[_ngcontent-%COMP%], .app-dark [_nghost-%COMP%] .sm-gnode__sub-stat--date[_ngcontent-%COMP%]{background:color-mix(in srgb,var(--sm-kind-skill) 22%,transparent);color:var(--sm-kind-skill-fg)}.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:3px;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:3px;font-size:.7rem;font-style:normal;color:var(--p-text-color)}.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:3px}.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:3px;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-end[_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%], .sm-gnode__stat[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{font-size:.6rem;line-height:1;display:block}.sm-gnode__stat[_ngcontent-%COMP%] svg[_ngcontent-%COMP%]{width:1em;height:1em}.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:3px}.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:3px}.sm-gnode__stat--warn[_ngcontent-%COMP%] .sm-gnode__stat-num[_ngcontent-%COMP%]{color:var(--sm-severity-warn)}.sm-gnode__stat--danger[_ngcontent-%COMP%]{color:var(--sm-severity-error)}.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:3px;background:var(--sm-bg-hover);color:var(--sm-text-muted);border:1px solid var(--sm-border);line-height:1.4}.sm-gnode__tag-more[_ngcontent-%COMP%]{font-size:.6rem;color:var(--sm-text-muted);font-style:italic}'],changeDetection:0})};var xm={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 Hw=["sparkline"];function jw(t,i){if(t&1&&(u(0,"span",5),m(1,"\xB7"),f(),u(2,"span",3),m(3),f()),t&2){let e=p(3);c(3),y(e.texts.units.mb(e.heapMb()))}}function Uw(t,i){if(t&1&&(u(0,"span",5),m(1,"\xB7"),f(),u(2,"span",3),m(3),f()),t&2){let e=p(3);c(3),y(e.texts.units.cacheAge(e.cacheAgeSec()))}}function $w(t,i){if(t&1&&(B(0,"canvas",4,1),u(2,"span",5),m(3,"\xB7"),f(),u(4,"span",3),m(5),f(),b(6,jw,4,1),u(7,"span",5),m(8,"\xB7"),f(),u(9,"span",3),m(10),f(),u(11,"span",5),m(12,"\xB7"),f(),u(13,"span",3),m(14),f(),u(15,"span",5),m(16,"\xB7"),f(),u(17,"span",3),m(18),f(),u(19,"span",5),m(20,"\xB7"),f(),u(21,"span",3),m(22),f(),b(23,Uw,4,1)),t&2){let e=p(2);c(5),y(e.texts.units.ms(e.frameTimeMs())),c(),w(e.hasHeap()?6:-1),c(4),y(e.texts.units.longTasks(e.longTasks())),c(4),y(e.texts.units.domNodes(e.domNodes())),c(4),y(e.texts.units.nodes(e.visible(),e.total())),c(4),y(e.texts.units.edges(e.edges())),c(),w(e.cacheAgeSec()!==null?23:-1)}}function Ww(t,i){if(t&1&&(u(0,"span",3),m(1),f(),b(2,$w,24,7)),t&2){let e=p();c(),y(e.texts.units.fps(e.fps())),c(),w(e.expanded()?2:-1)}}var qw=30,oh=60,Al=14,Ll=class t{visible=F(0);total=F(0);edges=F(0);cacheAt=F(null);texts=xm;destroyRef=d(Ye);zone=d(Zn);fps=X(0);frameTimeMs=X(0);fpsSamples=X([]);sparklineCanvas=ke("sparkline");heapMb=X(null);longTasks=X(0);domNodes=X(0);nowTick=X(performance.now());expanded=X(Xw());cacheAgeSec=E(()=>{let i=this.cacheAt();return i===null?null:Math.max(0,Math.floor((this.nowTick()-i)/1e3))});hasHeap=E(()=>this.heapMb()!==null);constructor(){let i=0,e=0,n=performance.now(),o=n,r=0,s=l=>{let h=l-n;if(n=l,i+=1,e+=h,l-o>=1e3){let _=(l-o)/1e3,v=Math.round(i/_);this.fps.set(v),this.frameTimeMs.set(Math.round(e/Math.max(i,1))),this.heapMb.set(Yw()),this.domNodes.set(document.querySelectorAll("*").length),this.nowTick.set(l),this.fpsSamples.update(S=>{let I=S.length>=qw?S.slice(1):S.slice();return I.push(v),I}),i=0,e=0,o=l}r=requestAnimationFrame(s)};this.zone.runOutsideAngular(()=>{r=requestAnimationFrame(s)});let a=null;if(typeof PerformanceObserver<"u")try{a=new PerformanceObserver(l=>{this.longTasks.update(h=>h+l.getEntries().length)}),a.observe({type:"longtask",buffered:!0})}catch{}this.destroyRef.onDestroy(()=>{cancelAnimationFrame(r),a?.disconnect()}),pe(()=>{let l=this.sparklineCanvas(),h=this.fpsSamples();l&&Zw(l.nativeElement,h)})}setExpanded(i){this.expanded.set(i),Kw(i)}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({type:t,selectors:[["app-perf-hud"]],viewQuery:function(e,n){e&1&&St(n.sparklineCanvas,Hw,5),e&2&&ut()},inputs:{visible:[1,"visible"],total:[1,"total"],edges:[1,"edges"],cacheAt:[1,"cacheAt"]},decls:3,vars:2,consts:[["content",""],["sparkline",""],["styleClass","perf-hud","data-testid","perf-hud",3,"ngModelChange","ngModel","ariaLabel"],[1,"perf-hud__cell"],["aria-hidden","true",1,"perf-hud__sparkline"],["aria-hidden","true",1,"perf-hud__sep"]],template:function(e,n){e&1&&(u(0,"p-togglebutton",2),Q("ngModelChange",function(r){return n.setExpanded(r)}),Ie(1,Ww,3,2,"ng-template",null,0,Jn),f()),e&2&&P("ngModel",n.expanded())("ariaLabel",n.expanded()?n.texts.a11y.collapse:n.texts.a11y.expand)},dependencies:[xo,vo,Co,wo,bo],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: 999px;--p-togglebutton-content-border-radius: 999px;--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 .p-togglebutton-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})},bm="sm.perf-hud.expanded";function Xw(){try{return localStorage.getItem(bm)==="1"}catch{return!1}}function Kw(t){try{localStorage.setItem(bm,t?"1":"0")}catch{}}function Yw(){let t=performance.memory;return t?Math.round(t.usedJSHeapSize/1024/1024):null}function Zw(t,i){let e=window.devicePixelRatio||1,n=oh*e,o=Al*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,oh,Al),i.length<2))return;let s=Math.max(60,...i),a=oh/(i.length-1);r.beginPath();for(let l=0;l<i.length;l+=1){let h=l*a,_=Al-i[l]/s*Al;l===0?r.moveTo(h,_):r.lineTo(h,_)}r.strokeStyle=getComputedStyle(t).color,r.lineWidth=1,r.stroke()}var wm=`
|
|
211
|
+
.p-card {
|
|
212
|
+
background: dt('card.background');
|
|
213
|
+
color: dt('card.color');
|
|
214
|
+
box-shadow: dt('card.shadow');
|
|
215
|
+
border-radius: dt('card.border.radius');
|
|
216
|
+
display: flex;
|
|
217
|
+
flex-direction: column;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.p-card-caption {
|
|
221
|
+
display: flex;
|
|
222
|
+
flex-direction: column;
|
|
223
|
+
gap: dt('card.caption.gap');
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.p-card-body {
|
|
227
|
+
padding: dt('card.body.padding');
|
|
228
|
+
display: flex;
|
|
229
|
+
flex-direction: column;
|
|
230
|
+
gap: dt('card.body.gap');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.p-card-title {
|
|
234
|
+
font-size: dt('card.title.font.size');
|
|
235
|
+
font-weight: dt('card.title.font.weight');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.p-card-subtitle {
|
|
239
|
+
color: dt('card.subtitle.color');
|
|
240
|
+
}
|
|
241
|
+
`;var Qw=["header"],Jw=["title"],eS=["subtitle"],tS=["content"],nS=["footer"],iS=["*",[["p-header"]],[["p-footer"]]],oS=["*","p-header","p-footer"];function rS(t,i){t&1&&_n(0)}function sS(t,i){if(t&1&&(u(0,"div",1),Te(1,1),Ie(2,rS,1,0,"ng-container",2),f()),t&2){let e=p();ve(e.cx("header")),P("pBind",e.ptm("header")),c(2),P("ngTemplateOutlet",e.headerTemplate||e._headerTemplate)}}function aS(t,i){if(t&1&&(Ut(0),m(1),$t()),t&2){let e=p(2);c(),y(e.header)}}function cS(t,i){t&1&&_n(0)}function dS(t,i){if(t&1&&(u(0,"div",1),Ie(1,aS,2,1,"ng-container",3)(2,cS,1,0,"ng-container",2),f()),t&2){let e=p();ve(e.cx("title")),P("pBind",e.ptm("title")),c(),P("ngIf",e.header&&!e._titleTemplate&&!e.titleTemplate),c(),P("ngTemplateOutlet",e.titleTemplate||e._titleTemplate)}}function lS(t,i){if(t&1&&(Ut(0),m(1),$t()),t&2){let e=p(2);c(),y(e.subheader)}}function uS(t,i){t&1&&_n(0)}function fS(t,i){if(t&1&&(u(0,"div",1),Ie(1,lS,2,1,"ng-container",3)(2,uS,1,0,"ng-container",2),f()),t&2){let e=p();ve(e.cx("subtitle")),P("pBind",e.ptm("subtitle")),c(),P("ngIf",e.subheader&&!e._subtitleTemplate&&!e.subtitleTemplate),c(),P("ngTemplateOutlet",e.subtitleTemplate||e._subtitleTemplate)}}function hS(t,i){t&1&&_n(0)}function pS(t,i){t&1&&_n(0)}function mS(t,i){if(t&1&&(u(0,"div",1),Te(1,2),Ie(2,pS,1,0,"ng-container",2),f()),t&2){let e=p();ve(e.cx("footer")),P("pBind",e.ptm("footer")),c(2),P("ngTemplateOutlet",e.footerTemplate||e._footerTemplate)}}var _S=`
|
|
242
|
+
${wm}
|
|
243
|
+
|
|
244
|
+
.p-card {
|
|
245
|
+
display: block;
|
|
246
|
+
}
|
|
247
|
+
`,gS={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"},Sm=(()=>{class t extends Lh{name="card";style=_S;classes=gS;static \u0275fac=(()=>{let e;return function(o){return(e||(e=ne(t)))(o||t)}})();static \u0275prov=g({token:t,factory:t.\u0275fac})}return t})();var Im=new ce("CARD_INSTANCE"),$i=(()=>{class t extends Gh{componentName="Card";$pcCard=d(Im,{optional:!0,skipSelf:!0})??void 0;bindDirectiveInstance=d(ei,{self:!0});_componentStyle=d(Sm);onAfterViewChecked(){this.bindDirectiveInstance.setAttrs(this.ptms(["host","root"]))}header;subheader;set style(e){Oh(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=X(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=te({type:t,selectors:[["p-card"]],contentQueries:function(n,o,r){if(n&1&&Ih(r,Fh,5)(r,Ah,5)(r,Qw,4)(r,Jw,4)(r,eS,4)(r,tS,4)(r,nS,4)(r,gn,4),n&2){let s;bt(s=wt())&&(o.headerFacet=s.first),bt(s=wt())&&(o.footerFacet=s.first),bt(s=wt())&&(o.headerTemplate=s.first),bt(s=wt())&&(o.titleTemplate=s.first),bt(s=wt())&&(o.subtitleTemplate=s.first),bt(s=wt())&&(o.contentTemplate=s.first),bt(s=wt())&&(o.footerTemplate=s.first),bt(s=wt())&&(o.templates=s)}},hostVars:4,hostBindings:function(n,o){n&2&&(Th(o._style()),ve(o.cn(o.cx("root"),o.styleClass)))},inputs:{header:"header",subheader:"subheader",style:"style",styleClass:"styleClass"},features:[De([Sm,{provide:Im,useExisting:t},{provide:zh,useExisting:t}]),Sh([ei]),ye],ngContentSelectors:oS,decls:8,vars:11,consts:[[3,"pBind","class",4,"ngIf"],[3,"pBind"],[4,"ngTemplateOutlet"],[4,"ngIf"]],template:function(n,o){n&1&&(Wt(iS),Ie(0,sS,3,4,"div",0),u(1,"div",1),Ie(2,dS,3,5,"div",0)(3,fS,3,5,"div",0),u(4,"div",1),Te(5),Ie(6,hS,1,0,"ng-container",2),f(),Ie(7,mS,3,4,"div",0),f()),n&2&&(P("ngIf",o.headerFacet||o.headerTemplate||o._headerTemplate),c(),ve(o.cx("body")),P("pBind",o.ptm("body")),c(),P("ngIf",o.header||o.titleTemplate||o._titleTemplate),c(),P("ngIf",o.subheader||o.subtitleTemplate||o._subtitleTemplate),c(),ve(o.cx("content")),P("pBind",o.ptm("content")),c(2),P("ngTemplateOutlet",o.contentTemplate||o._contentTemplate),c(),P("ngIf",o.footerFacet||o.footerTemplate||o._footerTemplate))},dependencies:[lo,Ph,Mh,po,_o,ei],encapsulation:2,changeDetection:0})}return t})(),Bl=(()=>{class t{static \u0275fac=function(n){return new(n||t)};static \u0275mod=ro({type:t});static \u0275inj=to({imports:[$i,po,_o,po,_o]})}return t})();var zl={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 \u2014 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 \u2014 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."},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)."};var Gl=class t{sanitizer=d(kh);libsPromise=null;async render(i){let e=await this.loadLibs(),n=e.md.render(i),o=e.purify.sanitize(n);return this.sanitizer.bypassSecurityTrustHtml(o)}async renderToHtml(i){let e=await this.loadLibs(),n=e.md.render(i);return e.purify.sanitize(n)}loadLibs(){return this.libsPromise||(this.libsPromise=yS()),this.libsPromise}static \u0275fac=function(e){return new(e||t)};static \u0275prov=g({token:t,factory:t.\u0275fac,providedIn:"root"})};async function yS(){let[t,i]=await Promise.all([import("./chunk-STE4Z72W.js"),import("./chunk-N2C45VIA.js")]),e=t.default,n=new e({html:!1,linkify:!0}),o=i.default;return{md:n,purify:o}}var Vl=class t{http=d(fo);dataSource=d(Cn);loader=d(Mt);destroyRef=d(Ye);constructor(){this.dataSource.events().pipe(eo(i=>Vh(i)),mo(this.destroyRef)).subscribe(i=>{let e=i;this.loader.patchSidecarFromBump({nodePath:e.data.nodePath,version:e.data.version,status:e.data.status})})}async bump(i,e={}){let n={nodePath:i};e.force!==void 0&&(n.force=e.force);try{return await Ji(this.http.post("/api/sidecar/bump",n))}catch(o){throw vS(o)}}static \u0275fac=function(e){return new(e||t)};static \u0275prov=g({token:t,factory:t.\u0275fac,providedIn:"root"})};function vS(t){if(t instanceof Xt)return t;if(t instanceof Dh){let e=CS(t.error);return e?new Xt(e.error.code,e.error.message,e.error.details):new Xt("internal",t.message||"Request failed.")}let i=t instanceof Error?t.message:String(t);return new Xt("internal",i)}function CS(t){if(typeof t!="object"||t===null)return null;let i=t;if(i.ok!==!1)return null;let e=i.error;if(typeof e!="object"||e===null)return null;let n=e;return typeof n.code!="string"||typeof n.message!="string"?null:{ok:!1,error:{code:n.code,message:n.message,details:n.details}}}var Em={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",requires:"Requires",conflictsWith:"Conflicts with",related:"Related",authors:"Authors",license:"License",source:"Source",sourceVersion:"Source version",tags:"Tags",hidden:"Hidden",docsUrl:"Docs URL"},brokenRefTooltip:"This path does not resolve to a node in the current scan scope."};function wS(t,i){if(t&1&&(u(0,"p",0),m(1),f()),t&2){let e=p();c(),y(e.texts.emptyOverlay)}}function SS(t,i){if(t&1&&(u(0,"p",1),m(1),f()),t&2){let e=p();c(),y(e.texts.emptyAnnotations)}}function IS(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd",9)(3,"code"),m(4),f()()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.version),c(3),y(e.version)}}function TS(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd"),B(3,"p-tag",10),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.stability),c(2),P("value",e.stability)("severity",n.stabilitySeverity(e.stability))("rounded",!0)}}function ES(t,i){if(t&1&&(Ze(0),u(1,"section",2)(2,"h4",7),m(3),f(),u(4,"dl",8),b(5,IS,5,2),b(6,TS,4,4),f()()),t&2){let e=p(2),n=Fe(e.lifecycle());c(3),y(e.texts.sections.lifecycle),c(2),w(n.version!==null?5:-1),c(),w(n.stability!==null?6:-1)}}function PS(t,i){if(t&1){let e=de();u(0,"h5"),m(1),f(),u(2,"div",11)(3,"p-chip",12),Q("click",function(){$(e),p();let o=Y(0),r=p(2);return W(r.onOpenPath(o.supersededBy))}),f()()}if(t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.supersededBy),c(2),P("label",e.supersededBy)("styleClass",n.isBroken(e.supersededBy)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e.supersededBy)?n.texts.brokenRefTooltip:"")}}function MS(t,i){if(t&1){let e=de();u(0,"p-chip",12),Q("click",function(){let o=$(e).$implicit,r=p(4);return W(r.onOpenPath(o))}),f()}if(t&2){let e=i.$implicit,n=p(4);P("label",e)("styleClass",n.isBroken(e)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e)?n.texts.brokenRefTooltip:"")}}function DS(t,i){if(t&1&&(u(0,"h5"),m(1),f(),u(2,"div",11),J(3,MS,1,3,"p-chip",13,me),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.supersedes),c(2),ee(e.supersedes)}}function kS(t,i){if(t&1){let e=de();u(0,"p-chip",12),Q("click",function(){let o=$(e).$implicit,r=p(4);return W(r.onOpenPath(o))}),f()}if(t&2){let e=i.$implicit,n=p(4);P("label",e)("styleClass",n.isBroken(e)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e)?n.texts.brokenRefTooltip:"")}}function RS(t,i){if(t&1&&(u(0,"h5"),m(1),f(),u(2,"div",11),J(3,kS,1,3,"p-chip",13,me),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.requires),c(2),ee(e.requires)}}function NS(t,i){if(t&1){let e=de();u(0,"p-chip",12),Q("click",function(){let o=$(e).$implicit,r=p(4);return W(r.onOpenPath(o))}),f()}if(t&2){let e=i.$implicit,n=p(4);P("label",e)("styleClass",n.isBroken(e)?"chip--broken":"chip--link")("pTooltip",n.isBroken(e)?n.texts.brokenRefTooltip:"")}}function OS(t,i){if(t&1&&(u(0,"h5"),m(1),f(),u(2,"div",11),J(3,NS,1,3,"p-chip",13,me),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.related),c(2),ee(e.related)}}function FS(t,i){if(t&1&&B(0,"p-chip",14),t&2){let e=i.$implicit;P("label",e)}}function AS(t,i){if(t&1&&(u(0,"h5"),m(1),f(),u(2,"div",11),J(3,FS,1,1,"p-chip",14,me),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.conflictsWith),c(2),ee(e.conflictsWith)}}function LS(t,i){if(t&1&&(Ze(0),u(1,"section",3)(2,"h4",7),m(3),f(),b(4,PS,4,4),b(5,DS,5,1),b(6,RS,5,1),b(7,OS,5,1),b(8,AS,5,1),f()),t&2){let e=p(2),n=Fe(e.supersession());c(3),y(e.texts.sections.supersession),c(),w(n.supersededBy!==null?4:-1),c(),w(n.supersedes.length?5:-1),c(),w(n.requires.length?6:-1),c(),w(n.related.length?7:-1),c(),w(n.conflictsWith.length?8:-1)}}function BS(t,i){if(t&1&&B(0,"p-chip",15),t&2){let e=i.$implicit;P("label",e)}}function zS(t,i){if(t&1&&(u(0,"h5"),m(1),f(),u(2,"div",11),J(3,BS,1,1,"p-chip",15,me),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.authors),c(2),ee(e.authors)}}function GS(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd"),m(3),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.license),c(2),y(e.license)}}function VS(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"a",16),m(4),f()()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.source),c(2),P("href",e.source,hu),c(),y(e.source)}}function HS(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.sourceVersion),c(3),y(e.sourceVersion)}}function jS(t,i){if(t&1&&(Ze(0),u(1,"section",4)(2,"h4",7),m(3),f(),b(4,zS,5,1),u(5,"dl",8),b(6,GS,4,2),b(7,VS,5,3),b(8,HS,5,2),f()()),t&2){let e=p(2),n=Fe(e.provenance());c(3),y(e.texts.sections.provenance),c(),w(n.authors.length?4:-1),c(2),w(n.license!==null?6:-1),c(),w(n.source!==null?7:-1),c(),w(n.sourceVersion!==null?8:-1)}}function US(t,i){if(t&1&&B(0,"p-chip",15),t&2){let e=i.$implicit;P("label",e)}}function $S(t,i){if(t&1&&(u(0,"h5"),m(1),f(),u(2,"div",11),J(3,US,1,1,"p-chip",15,me),f()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.tags),c(2),ee(e.tags)}}function WS(t,i){if(t&1&&(u(0,"dl",8)(1,"dt"),m(2),f(),u(3,"dd",17)(4,"code"),m(5,"true"),f()()()),t&2){let e=p(3);c(2),y(e.texts.fields.hidden)}}function qS(t,i){if(t&1&&(Ze(0),u(1,"section",5)(2,"h4",7),m(3),f(),b(4,$S,5,1),b(5,WS,6,1,"dl",8),f()),t&2){let e=p(2),n=Fe(e.taxonomy());c(3),y(e.texts.sections.taxonomy),c(),w(n.tags.length?4:-1),c(),w(n.hidden===!0?5:-1)}}function XS(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"a",16),m(4),f()()),t&2){p();let e=Y(0),n=p(2);c(),y(n.texts.fields.docsUrl),c(2),P("href",e.docsUrl,hu),c(),y(e.docsUrl)}}function KS(t,i){if(t&1&&(Ze(0),u(1,"section",6)(2,"h4",7),m(3),f(),u(4,"dl",8),b(5,XS,5,3),f()()),t&2){let e=p(2),n=Fe(e.docs());c(3),y(e.texts.sections.docs),c(2),w(n.docsUrl!==null?5:-1)}}function YS(t,i){if(t&1&&(b(0,ES,7,4,"section",2),b(1,LS,9,7,"section",3),b(2,jS,9,6,"section",4),b(3,qS,6,4,"section",5),b(4,KS,6,3,"section",6)),t&2){let e=p();w(e.hasLifecycle()?0:-1),c(),w(e.hasSupersession()?1:-1),c(),w(e.hasProvenance()?2:-1),c(),w(e.hasTaxonomy()?3:-1),c(),w(e.hasDocs()?4:-1)}}var ZS={stable:"success",experimental:"info",deprecated:"warn"},Hl=class t{overlay=F(void 0);knownPaths=F(null);openPath=new rt;texts=Em;annotations=E(()=>{let i=this.overlay();return!i||!i.present?null:i.annotations??null});hasAnnotations=E(()=>{let i=this.annotations();return i!==null&&Object.keys(i).length>0});lifecycle=E(()=>{let i=this.annotations()??{};return{version:QS(i.version),stability:JS(i.stability)}});hasLifecycle=E(()=>qi(this.lifecycle()));supersession=E(()=>{let i=this.annotations()??{};return{supersedes:$n(i.supersedes),supersededBy:Wi(i.supersededBy),requires:$n(i.requires),conflictsWith:$n(i.conflictsWith),related:$n(i.related)}});hasSupersession=E(()=>qi(this.supersession()));provenance=E(()=>{let i=this.annotations()??{};return{authors:$n(i.authors),license:Wi(i.license),source:Wi(i.source),sourceVersion:Wi(i.sourceVersion)}});hasProvenance=E(()=>qi(this.provenance()));taxonomy=E(()=>{let i=this.annotations()??{};return{tags:$n(i.tags),hidden:i.hidden===!0?!0:null}});hasTaxonomy=E(()=>qi(this.taxonomy()));docs=E(()=>{let i=this.annotations()??{};return{docsUrl:Wi(i.docsUrl)}});hasDocs=E(()=>qi(this.docs()));stabilitySeverity(i){return ZS[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=te({type:t,selectors:[["sm-annotations-panel"]],inputs:{overlay:[1,"overlay"],knownPaths:[1,"knownPaths"]},outputs:{openPath:"openPath"},decls:3,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"],["styleClass","chip--warn",3,"label"],[3,"label"],["target","_blank","rel","noopener",3,"href"],["data-testid","annotations-hidden"]],template:function(e,n){if(e&1&&b(0,wS,2,1,"p",0)(1,SS,2,1,"p",1)(2,YS,5,5),e&2){let o;w((o=n.overlay())!=null&&o.present?n.hasAnnotations()?2:1:0)}},dependencies:[bn,Io,xn,So,He,Qe],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 .p-chip{background:var(--sm-bg-hover);color:var(--sm-text-muted);text-decoration:line-through;cursor:not-allowed}"],changeDetection:0})};function QS(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function Wi(t){return typeof t=="string"&&t.length>0?t:null}function JS(t){return t==="stable"||t==="experimental"||t==="deprecated"?t:null}function $n(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"&&i.length>0):[]}function qi(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 jl=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=te({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&&(H(0,"div",0),Pt(1,"span",1),H(2,"p",2),m(3),j(),H(4,"p",3),m(5),j()()),e&2){let o=n.testId();Z("data-testid",o),c(),ve(n.icon()),c(2),y(n.title()),c(2),y(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 Pm={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 Dm=(t,i)=>i.source+"|"+i.target+"|"+i.kind+"|"+((i.trigger==null?null:i.trigger.normalizedTrigger)??"");function tI(t,i){if(t&1){let e=de();u(0,"div",4)(1,"h3",5),m(2),f(),u(3,"p-button",6),Q("onClick",function(){$(e);let o=p(2);return W(o.refresh())}),f()()}if(t&2){let e=p(2);c(2),y(e.texts.cardHeader),c(),P("rounded",!0)("text",!0)("ariaLabel",e.texts.refreshLabel)("pTooltip",e.texts.refreshLabel)("disabled",e.state()==="loading")}}function nI(t,i){if(t&1&&(u(0,"p",2),m(1),f()),t&2){let e=p(2);c(),y(e.texts.loading)}}function iI(t,i){if(t&1&&(u(0,"p",3),m(1),f()),t&2){let e=p(2);c(),y(e.texts.error)}}function oI(t,i){if(t&1&&(u(0,"p",9),m(1),f()),t&2){let e=p(3);c(),y(e.texts.emptyOutgoing)}}function rI(t,i){if(t&1&&(u(0,"span",17),m(1),f()),t&2){let e=p().$implicit,n=p(4);c(),Qn(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function sI(t,i){if(t&1){let e=de();u(0,"li",13),B(1,"p-tag",14),u(2,"button",15),Q("click",function(){let o=$(e).$implicit,r=p(4);return W(r.onOpen(o.target))}),m(3),f(),B(4,"p-tag",16),b(5,rI,2,2,"span",17),f()}if(t&2){let e=i.$implicit,n=p(4);Z("data-testid","linked-nodes-outgoing-row-"+e.target),c(),P("value",e.kind)("severity",n.kindSeverity(e.kind)),c(),Z("data-testid","linked-nodes-outgoing-link-"+e.target),c(),Ve(" ",e.target," "),c(),P("value",n.confidenceLabel(e.confidence))("severity",n.confidenceSeverity(e.confidence))("rounded",!0),c(),w(e.sources.length?5:-1)}}function aI(t,i){if(t&1&&(u(0,"ul",10),J(1,sI,6,9,"li",13,Dm),f()),t&2){let e=p(3);c(),ee(e.outgoing())}}function cI(t,i){if(t&1&&(u(0,"p",12),m(1),f()),t&2){let e=p(3);c(),y(e.texts.emptyIncoming)}}function dI(t,i){if(t&1&&(u(0,"span",17),m(1),f()),t&2){let e=p().$implicit,n=p(4);c(),Qn(" ",n.texts.sourcesPrefix,"",e.sources.join(n.texts.sourcesSeparator)," ")}}function lI(t,i){if(t&1){let e=de();u(0,"li",13),B(1,"p-tag",14),u(2,"button",15),Q("click",function(){let o=$(e).$implicit,r=p(4);return W(r.onOpen(o.source))}),m(3),f(),B(4,"p-tag",16),b(5,dI,2,2,"span",17),f()}if(t&2){let e=i.$implicit,n=p(4);Z("data-testid","linked-nodes-incoming-row-"+e.source),c(),P("value",e.kind)("severity",n.kindSeverity(e.kind)),c(),Z("data-testid","linked-nodes-incoming-link-"+e.source),c(),Ve(" ",e.source," "),c(),P("value",n.confidenceLabel(e.confidence))("severity",n.confidenceSeverity(e.confidence))("rounded",!0),c(),w(e.sources.length?5:-1)}}function uI(t,i){if(t&1&&(u(0,"ul",10),J(1,lI,6,9,"li",13,Dm),f()),t&2){let e=p(3);c(),ee(e.incoming())}}function fI(t,i){if(t&1&&(u(0,"section",7)(1,"h4",8),m(2),f(),b(3,oI,2,1,"p",9)(4,aI,3,0,"ul",10),f(),u(5,"section",11)(6,"h4",8),m(7),f(),b(8,cI,2,1,"p",12)(9,uI,3,0,"ul",10),f()),t&2){let e=p(2);c(2),y(e.texts.outgoingHeader),c(),w(e.outgoing().length===0?3:4),c(4),y(e.texts.incomingHeader),c(),w(e.incoming().length===0?8:9)}}function hI(t,i){if(t&1&&(u(0,"p-card",0),Ie(1,tI,4,6,"ng-template",1),b(2,nI,2,1,"p",2)(3,iI,2,1,"p",3)(4,fI,10,4),f()),t&2){let e,n=p();c(2),w((e=n.state())==="loading"?2:e==="error"?3:e==="ready"?4:-1)}}var pI={invokes:"warn",references:"info",mentions:"secondary",supersedes:"success"},mI={high:"success",medium:"info",low:"warn"},Ul=class t{dataSource=d(Cn);destroyRef=d(Ye);texts=Pm;path=F(null);openPath=nt();state=X("idle");outgoing=X([]);incoming=X([]);fetchToken=0;hasResults=E(()=>this.state()==="ready"&&(this.outgoing().length>0||this.incoming().length>0));constructor(){this.dataSource.events().pipe(eo(i=>i.type==="scan.completed"),mo(this.destroyRef)).subscribe(()=>{let i=this.path();i&&this.fetch(i)}),pe(()=>{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 pI[i]??"secondary"}confidenceSeverity(i){return mI[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=te({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"],["type","button",1,"linked-nodes-panel__path",3,"click"],[3,"value","severity","rounded"],[1,"linked-nodes-panel__sources"]],template:function(e,n){e&1&&b(0,hI,5,1,"p-card",0),e&2&&w(n.path()?0:-1)},dependencies:[Bl,$i,gn,xn,So,bn,vn,yn,He,Qe],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:4px;background:var(--p-content-background);border:1px solid var(--p-content-border-color)}.linked-nodes-panel__path[_ngcontent-%COMP%]{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:.85rem;color:var(--p-primary-color);background:none;border:none;padding:0;cursor:pointer;text-decoration:underline;text-underline-offset:2px}.linked-nodes-panel__path[_ngcontent-%COMP%]:hover{text-decoration:none}.linked-nodes-panel__sources[_ngcontent-%COMP%]{font-size:.75rem;color:var(--p-text-muted-color);margin-left:auto}"],changeDetection:0})};var km={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 _I=(t,i)=>i.name,gI=(t,i)=>i.event;function yI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){let e=p(4);c(),y(e.texts.fields.model),c(3),y(i)}}function vI(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;P("label",e)}}function CI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd",11),J(3,vI,1,1,"p-chip",12,me),f()),t&2){let e=p(4);c(),y(e.texts.fields.tools),c(2),ee(e.tools())}}function xI(t,i){if(t&1){let e=de();u(0,"p-chip",14),Q("click",function(){let o=$(e).$implicit,r=p(5);return W(r.onSkillChipClick(o))}),f()}if(t&2){let e=i.$implicit,n=p(5);P("label",e)("styleClass",n.isSkillKnown(e)?"chip--link":"")}}function bI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd",11),J(3,xI,1,2,"p-chip",13,me),f()),t&2){let e=p(4);c(),y(e.texts.fields.skills),c(2),ee(e.skills())}}function wI(t,i){if(t&1&&B(0,"p-chip",15),t&2){let e=i.$implicit;P("label",e)}}function SI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd",11),J(3,wI,1,1,"p-chip",15,me),f()),t&2){let e=p(4);c(),y(e.texts.fields.disallowedTools),c(2),ee(e.disallowedTools())}}function II(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){let e=p(4);c(),y(e.texts.fields.permissionMode),c(3),y(i)}}function TI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd"),m(3),f()),t&2){let e=p(4);c(),y(e.texts.fields.maxTurns),c(2),y(e.maxTurns())}}function EI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){let e=p(4);c(),y(e.texts.fields.effort),c(3),y(i)}}function PI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){let e=p(4);c(),y(e.texts.fields.memory),c(3),y(i)}}function MI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4,"true"),f()()),t&2){let e=p(4);c(),y(e.texts.fields.background)}}function DI(t,i){if(t&1&&(u(0,"dt"),m(1),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){let e=p(4);c(),y(e.texts.fields.isolation),c(3),y(i)}}function kI(t,i){if(t&1&&(u(0,"blockquote",18),m(1),f()),t&2){let e=p();c(),y(e)}}function RI(t,i){if(t&1&&(u(0,"p",19),m(1),f()),t&2){let e=p();c(),Qn("",e.slice(0,80),"",e.length>80?"\u2026":"")}}function NI(t,i){if(t&1){let e=de();u(0,"div",9)(1,"h5",16)(2,"button",17),Q("click",function(){$(e);let o=p(4);return W(o.toggleInitialPrompt())}),B(3,"i",4),m(4),f()(),b(5,kI,2,1,"blockquote",18)(6,RI,2,2,"p",19),f()}if(t&2){let e=p(4);c(2),Z("aria-label",e.texts.initialPromptToggle),c(),le("pi-chevron-right",!e.initialPromptExpanded())("pi-chevron-down",e.initialPromptExpanded()),c(),Ve(" ",e.texts.fields.initialPrompt," "),c(),w(e.initialPromptExpanded()?5:6)}}function OI(t,i){if(t&1&&(u(0,"code",23),m(1),f()),t&2){let e=p().$implicit;c(),y(e.command)}}function FI(t,i){if(t&1&&(u(0,"li",21)(1,"code",22),m(2),f(),b(3,OI,2,1,"code",23),f()),t&2){let e=i.$implicit;c(2),y(e.name),c(),w(e.command!==null?3:-1)}}function AI(t,i){if(t&1&&(u(0,"div",10)(1,"h5",16),m(2),f(),u(3,"ul",20),J(4,FI,4,2,"li",21,_I),f()()),t&2){let e=p(4);c(2),y(e.texts.fields.mcpServers),c(2),ee(e.mcpServers())}}function LI(t,i){if(t&1&&(u(0,"code"),m(1),f(),m(2)),t&2){let e=i.$implicit,n=i.$index,o=i.$count;c(),y(e),c(),Ve("",n===o-1?"":", "," ")}}function BI(t,i){if(t&1&&(u(0,"span",24),J(1,LI,3,2,null,null,me),f()),t&2){let e=p().$implicit;c(),ee(e.keys)}}function zI(t,i){if(t&1&&(u(0,"li",21)(1,"code",22),m(2),f(),b(3,BI,3,0,"span",24),f()),t&2){let e=i.$implicit;c(2),y(e.event),c(),w(e.keys.length?3:-1)}}function GI(t,i){if(t&1&&(u(0,"div",10)(1,"h5",16),m(2),f(),u(3,"ul",20),J(4,zI,4,2,"li",21,gI),f()()),t&2){let e=p(4);c(2),y(e.texts.fields.hooks),c(2),ee(e.hooks())}}function VI(t,i){if(t&1&&(u(0,"dl",8),b(1,yI,5,2),b(2,CI,5,1),b(3,bI,5,1),b(4,SI,5,1),b(5,II,5,2),b(6,TI,4,2),b(7,EI,5,2),b(8,PI,5,2),b(9,MI,5,1),b(10,DI,5,2),f(),b(11,NI,7,7,"div",9),b(12,AI,6,1,"div",10),b(13,GI,6,1,"div",10)),t&2){let e,n,o,r,s,a,l=p(3);c(),w((e=l.model())?1:-1,e),c(),w(l.tools().length?2:-1),c(),w(l.skills().length?3:-1),c(),w(l.disallowedTools().length?4:-1),c(),w((n=l.permissionMode())?5:-1,n),c(),w(l.maxTurns()!==null?6:-1),c(),w((o=l.effort())?7:-1,o),c(),w((r=l.memory())?8:-1,r),c(),w(l.background()?9:-1),c(),w((s=l.isolation())?10:-1,s),c(),w((a=l.initialPrompt())?11:-1,a),c(),w(l.mcpServers().length?12:-1),c(),w(l.hooks().length?13:-1)}}function HI(t,i){if(t&1&&(u(0,"dt"),m(1,"when_to_use"),f(),u(2,"dd"),m(3),f()),t&2){p();let e=Y(0);c(3),y(e.when_to_use)}}function jI(t,i){if(t&1&&(u(0,"dt"),m(1,"argument-hint"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.argumentHint)}}function UI(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;P("label",e)}}function $I(t,i){if(t&1&&(u(0,"dt"),m(1,"arguments"),f(),u(2,"dd",11),J(3,UI,1,1,"p-chip",12,me),f()),t&2){p();let e=Y(0);c(3),ee(e.arguments)}}function WI(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;P("label",e)}}function qI(t,i){if(t&1&&(u(0,"dt"),m(1,"allowed-tools"),f(),u(2,"dd",11),J(3,WI,1,1,"p-chip",12,me),f()),t&2){p();let e=Y(0);c(3),ee(e.allowedTools)}}function XI(t,i){if(t&1&&(u(0,"dt"),m(1,"model"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.model)}}function KI(t,i){if(t&1&&(u(0,"dt"),m(1,"effort"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.effort)}}function YI(t,i){if(t&1&&(u(0,"dt"),m(1,"context"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.context)}}function ZI(t,i){if(t&1&&(u(0,"dt"),m(1,"agent"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.agent)}}function QI(t,i){if(t&1&&(u(0,"dt"),m(1,"shell"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.shell)}}function JI(t,i){if(t&1&&B(0,"p-chip",12),t&2){let e=i.$implicit;P("label",e)}}function e1(t,i){if(t&1&&(u(0,"dt"),m(1,"paths"),f(),u(2,"dd",11),J(3,JI,1,1,"p-chip",12,me),f()),t&2){p();let e=Y(0);c(3),ee(e.paths)}}function t1(t,i){t&1&&(u(0,"dt"),m(1,"disable-model-invocation"),f(),u(2,"dd")(3,"code"),m(4,"true"),f()())}function n1(t,i){if(t&1&&(u(0,"dt"),m(1,"user-invocable"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.userInvocable)}}function i1(t,i){if(t&1&&(Ze(0),u(1,"dl",7),b(2,HI,4,1),b(3,jI,5,1),b(4,$I,5,0),b(5,qI,5,0),b(6,XI,5,1),b(7,KI,5,1),b(8,YI,5,1),b(9,ZI,5,1),b(10,QI,5,1),b(11,e1,5,0),b(12,t1,5,0),b(13,n1,5,1),f()),t&2){let e=Fe(p(3).skillBase());c(2),w(e.when_to_use!==null?2:-1),c(),w(e.argumentHint!==null?3:-1),c(),w(e.arguments.length?4:-1),c(),w(e.allowedTools.length?5:-1),c(),w(e.model!==null?6:-1),c(),w(e.effort!==null?7:-1),c(),w(e.context!==null?8:-1),c(),w(e.agent!==null?9:-1),c(),w(e.shell!==null?10:-1),c(),w(e.paths.length?11:-1),c(),w(e.disableModelInvocation?12:-1),c(),w(e.userInvocable!==null?13:-1)}}function o1(t,i){if(t&1&&(u(0,"div",6),b(1,VI,14,13)(2,i1,14,13,"dl",7),f()),t&2){let e=p(2);c(),w(e.isAgent()?1:e.isSkillOrCommand()?2:-1)}}function r1(t,i){if(t&1){let e=de();u(0,"div",0)(1,"section",1)(2,"h4",2)(3,"button",3),Q("click",function(){$(e);let o=p();return W(o.toggleSection())}),B(4,"i",4),m(5),u(6,"span",5),m(7),f()()(),b(8,o1,3,1,"div",6),f()()}if(t&2){let e=p();c(3),Z("aria-expanded",e.sectionExpanded()),c(),le("pi-chevron-right",!e.sectionExpanded())("pi-chevron-down",e.sectionExpanded()),c(),Ve(" ",e.texts.providerSpecificHeader," "),c(2),Ve("(",e.texts.fieldCount(e.populatedFieldCount()),")"),c(),w(e.sectionExpanded()?8:-1)}}var Wl=class t{frontmatter=F.required();kind=F.required();provider=F(void 0);knownPaths=F(null);onSkillClick=F(null);texts=km;hasVendorSurface=E(()=>{let i=this.kind();return i==="agent"||i==="skill"||i==="command"});isAgent=E(()=>this.kind()==="agent");isSkillOrCommand=E(()=>{let i=this.kind();return i==="skill"||i==="command"});tools=E(()=>$l(this.fm().tools));model=E(()=>ot(this.fm().model));skills=E(()=>$l(this.fm().skills));disallowedTools=E(()=>$l(this.fm().disallowedTools));initialPrompt=E(()=>ot(this.fm().initialPrompt));initialPromptExpanded=X(!1);permissionMode=E(()=>ot(this.fm().permissionMode));maxTurns=E(()=>s1(this.fm().maxTurns));memory=E(()=>ot(this.fm().memory));background=E(()=>this.fm().background===!0);effort=E(()=>ot(this.fm().effort));isolation=E(()=>ot(this.fm().isolation));mcpServers=E(()=>{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=E(()=>{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=E(()=>{let i=this.fm();return{when_to_use:ot(i.when_to_use),argumentHint:ot(i["argument-hint"]),arguments:rh(i.arguments),disableModelInvocation:i["disable-model-invocation"]===!0,userInvocable:typeof i["user-invocable"]=="boolean"?i["user-invocable"]:null,allowedTools:rh(i["allowed-tools"]),model:ot(i.model),effort:ot(i.effort),context:ot(i.context),agent:ot(i.agent),paths:rh(i.paths),shell:ot(i.shell)}});populatedFieldCount=E(()=>{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=E(()=>this.hasVendorSurface()&&this.populatedFieldCount()>0);sectionExpanded=X(!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=te({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&&b(0,r1,9,8,"div",0),e&2&&w(n.hasAnyContent()?0:-1)},dependencies:[bn,Io,He],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:3px}.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 .p-chip{background:var(--sm-severity-error-bg);color:var(--sm-severity-error)}"],changeDetection:0})};function ot(t){return typeof t=="string"&&t.length>0?t:null}function s1(t){return typeof t=="number"&&Number.isFinite(t)?t:null}function $l(t){return Array.isArray(t)?t.filter(i=>typeof i=="string"&&i.length>0):[]}function rh(t){return typeof t=="string"?t.length>0?[t]:[]:Array.isArray(t)?$l(t):[]}var Rm={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 Fm=(t,i)=>i.key,a1=(t,i)=>i.pluginId;function c1(t,i){if(t&1&&(u(0,"p",0),m(1),f()),t&2){let e=p();c(),y(e.texts.empty)}}function d1(t,i){if(t&1&&(u(0,"span",5),m(1),f()),t&2){let e=p().$implicit,n=p(3);c(),y(n.texts.rootContribBadge(e.pluginId))}}function l1(t,i){if(t&1&&(u(0,"div",3)(1,"code",4),m(2),f(),b(3,d1,2,1,"span",5),u(4,"pre",6),m(5),f()()),t&2){let e=i.$implicit;c(2),y(e.key),c(),w(e.pluginId!==null?3:-1),c(2),y(e.value)}}function u1(t,i){if(t&1&&(u(0,"div",1),J(1,l1,6,3,"div",3,Fm),f()),t&2){let e=p(2);c(),ee(e.rootContributions())}}function f1(t,i){if(t&1&&(u(0,"span",10),m(1),f()),t&2){let e=p(4);c(),y(e.texts.unregisteredBadge)}}function h1(t,i){if(t&1&&(u(0,"dt",12),m(1),f(),u(2,"dd")(3,"pre"),m(4),f()()),t&2){let e=i.$implicit;P("pTooltip",e.description??""),c(),y(e.key),c(3),y(e.value)}}function p1(t,i){if(t&1&&(u(0,"section",7)(1,"h5",8)(2,"span",9),m(3),f(),b(4,f1,2,1,"span",10),f(),u(5,"dl",11),J(6,h1,5,3,null,null,Fm),f()()),t&2){let e=i.$implicit;Z("data-testid","plugin-contributions-ns-"+e.pluginId),c(3),y(e.pluginId),c(),w(e.registered?-1:4),c(2),ee(e.rows)}}function m1(t,i){if(t&1&&(u(0,"div",2),J(1,p1,8,3,"section",7,a1),f()),t&2){let e=p(2);c(),ee(e.namespaces())}}function _1(t,i){if(t&1&&(b(0,u1,3,0,"div",1),b(1,m1,3,0,"div",2)),t&2){let e=p();w(e.rootContributions().length?0:-1),c(),w(e.namespaces().length?1:-1)}}var Nm=new Set(["for","annotations","settings","audit"]),ql=class t{http=d(fo);sidecarRoot=F(void 0);texts=Rm;catalog=X(null);constructor(){this.fetchCatalog()}namespaces=E(()=>{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 s=n.get(r.pluginId);s?s.push(r):n.set(r.pluginId,[r])}let o=[];for(let[r,s]of Object.entries(i)){if(Nm.has(r)||this.isRegisteredRootKey(r))continue;let l=typeof s=="object"&&s!==null&&!Array.isArray(s)?s:{value:s},h=n.has(r),_=n.get(r)??[],v=Object.entries(l).map(([S,I])=>({key:S,value:Om(I),description:h?g1(_,S):null}));o.push({pluginId:r,registered:h,rows:v})}return o});rootContributions=E(()=>{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,s]of Object.entries(i)){if(Nm.has(r))continue;let a=n.get(r);a&&o.push({key:r,pluginId:a.pluginId,value:Om(s)})}return o});count=E(()=>this.namespaces().length+this.rootContributions().length);isEmpty=E(()=>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 Ji(this.http.get("/api/annotations/registered"));this.catalog.set(i.items)}catch{this.catalog.set([])}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({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&&b(0,c1,2,1,"p",0)(1,_1,2,2),e&2&&w(n.isEmpty()?0:1)},dependencies:[He,Qe],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:3px;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:3px}.pcp__root-value[_ngcontent-%COMP%]{flex:1 1 100%;margin:.2rem 0 0;padding:.45rem .6rem;background:var(--sm-bg-hover);border-radius:3px;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:3px}.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 Om(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 g1(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 Am={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 y1(t,i){t&1&&(H(0,"code"),m(1),j()),t&2&&(c(),y(i))}function v1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.absentMarker)}}function C1(t,i){if(t&1&&(H(0,"code"),m(1),j()),t&2){let e=p();le("dbg__diff",e.bodyHashDrift()),c(),y(i)}}function x1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.absentMarker)}}function b1(t,i){if(t&1&&(H(0,"code"),m(1),j()),t&2){let e=p();le("dbg__diff",e.bodyHashDrift()),c(),y(i)}}function w1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.absentMarker)}}function S1(t,i){if(t&1&&(H(0,"code"),m(1),j()),t&2){let e=p();le("dbg__diff",e.frontmatterHashDrift()),c(),y(i)}}function I1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.absentMarker)}}function T1(t,i){if(t&1&&(H(0,"code"),m(1),j()),t&2){let e=p();le("dbg__diff",e.frontmatterHashDrift()),c(),y(i)}}function E1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.absentMarker)}}function P1(t,i){t&1&&(H(0,"code"),m(1),j()),t&2&&(c(),y(i))}function M1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.notSetMarker)}}function D1(t,i){t&1&&(H(0,"code"),m(1),j()),t&2&&(c(),y(i))}function k1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.notSetMarker)}}function R1(t,i){t&1&&(H(0,"code"),m(1),j()),t&2&&(c(),y(i))}function N1(t,i){if(t&1&&(H(0,"span",2),m(1),j()),t&2){let e=p();c(),y(e.texts.absentMarker)}}var Xl=class t{node=F.required();sidecarRoot=F(null);overlay=F(void 0);texts=Am;forBlock=E(()=>{let i=this.sidecarRoot(),e={path:null,bodyHash:null,frontmatterHash:null,resolvedProvider:null,resolvedKind:null};if(!i)return e;let n=i.for;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=E(()=>this.node().bodyHash??null);frontmatterHashLive=E(()=>this.node().frontmatterHash??null);bodyHashDrift=E(()=>{let i=this.forBlock().bodyHash,e=this.bodyHashLive();return i!==null&&e!==null&&i!==e});frontmatterHashDrift=E(()=>{let i=this.forBlock().frontmatterHash,e=this.frontmatterHashLive();return i!==null&&e!==null&&i!==e});sidecarStatusLiteral=E(()=>{let i=this.overlay();if(!i)return null;let e=i.status??null;return e===null?null:String(e)});sidecarPresent=E(()=>this.overlay()?.present===!0);static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({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&&(H(0,"dl",0)(1,"dt"),m(2),j(),H(3,"dd",1),b(4,y1,2,1,"code")(5,v1,2,1,"span",2),j(),H(6,"dt"),m(7),j(),H(8,"dd",3),b(9,C1,2,3,"code",4)(10,x1,2,1,"span",2),j(),H(11,"dt"),m(12),j(),H(13,"dd",5),b(14,b1,2,3,"code",4)(15,w1,2,1,"span",2),j(),H(16,"dt"),m(17),j(),H(18,"dd",6),b(19,S1,2,3,"code",4)(20,I1,2,1,"span",2),j(),H(21,"dt"),m(22),j(),H(23,"dd",7),b(24,T1,2,3,"code",4)(25,E1,2,1,"span",2),j(),H(26,"dt"),m(27),j(),H(28,"dd",8),b(29,P1,2,1,"code")(30,M1,2,1,"span",2),j(),H(31,"dt"),m(32),j(),H(33,"dd",9),b(34,D1,2,1,"code")(35,k1,2,1,"span",2),j(),H(36,"dt"),m(37),j(),H(38,"dd",10),b(39,R1,2,1,"code")(40,N1,2,1,"span",2),j(),H(41,"dt"),m(42),j(),H(43,"dd",11)(44,"code"),m(45),j()()()),e&2){let o,r,s,a,l,h,_,v;c(2),y(n.texts.fields.forPath),c(2),w((o=n.forBlock().path)?4:5,o),c(3),y(n.texts.fields.bodyHashStored),c(2),w((r=n.forBlock().bodyHash)?9:10,r),c(3),y(n.texts.fields.bodyHashLive),c(2),w((s=n.bodyHashLive())?14:15,s),c(3),y(n.texts.fields.frontmatterHashStored),c(2),w((a=n.forBlock().frontmatterHash)?19:20,a),c(3),y(n.texts.fields.frontmatterHashLive),c(2),w((l=n.frontmatterHashLive())?24:25,l),c(3),y(n.texts.fields.resolvedProvider),c(2),w((h=n.forBlock().resolvedProvider)?29:30,h),c(3),y(n.texts.fields.resolvedKind),c(2),w((_=n.forBlock().resolvedKind)?34:35,_),c(3),y(n.texts.fields.sidecarStatus),c(2),w((v=n.sidecarStatusLiteral())?39:40,v),c(3),y(n.texts.fields.sidecarPresent),c(3),y(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:3px;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 O1(t,i){if(t&1&&(H(0,"span",3),m(1),H(2,"code"),m(3),j()()),t&2){p(2);let e=Y(0),n=p();c(),Ve(" ",n.texts.fields.lastBumpedBy," "),c(2),y(e.lastBumpedBy)}}function F1(t,i){if(t&1&&(H(0,"dt"),m(1),j(),H(2,"dd")(3,"span",2),m(4),j(),b(5,O1,4,2,"span",3),j()),t&2){p();let e=Y(0),n=p();c(),y(n.texts.fields.lastBumpedAt),c(2),mu("title",e.lastBumpedAt),c(),y(n.lastBumpedRel()),c(),w(e.lastBumpedBy!==null?5:-1)}}function A1(t,i){if(t&1&&(H(0,"span",3),m(1),H(2,"code"),m(3),j()()),t&2){p(2);let e=Y(0),n=p();c(),Ve(" ",n.texts.fields.createdBy," "),c(2),y(e.createdBy)}}function L1(t,i){if(t&1&&(H(0,"dt"),m(1),j(),H(2,"dd")(3,"span",2),m(4),j(),b(5,A1,4,2,"span",3),j()),t&2){p();let e=Y(0),n=p();c(),y(n.texts.fields.createdAt),c(2),mu("title",e.createdAt),c(),y(n.createdRel()),c(),w(e.createdBy!==null?5:-1)}}function B1(t,i){if(t&1&&(Ze(0),H(1,"dl",0),b(2,F1,6,4),b(3,L1,6,4),j()),t&2){let e=Fe(p().audit());c(2),w(e.lastBumpedAt!==null?2:-1),c(),w(e.createdAt!==null?3:-1)}}function z1(t,i){if(t&1&&(H(0,"p",1),m(1),j()),t&2){let e=p();c(),y(e.texts.headerEmpty)}}var Yl=class t{sidecarRoot=F(null);texts=zl.audit;audit=E(()=>{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:Kl(o.lastBumpedAt),lastBumpedBy:Kl(o.lastBumpedBy),createdAt:Kl(o.createdAt),createdBy:Kl(o.createdBy)}});hasContent=E(()=>{let i=this.audit();return i.lastBumpedAt!==null||i.lastBumpedBy!==null||i.createdAt!==null||i.createdBy!==null});headerSummary=E(()=>{let i=this.audit();if(i.lastBumpedAt===null)return this.texts.headerEmpty;let e=sh(i.lastBumpedAt);return this.texts.headerSummary(e,i.lastBumpedBy??"?")});lastBumpedRel=E(()=>{let i=this.audit().lastBumpedAt;return i===null?null:sh(i)});createdRel=E(()=>{let i=this.audit().createdAt;return i===null?null:sh(i)});static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({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&&b(0,B1,4,3,"dl",0)(1,z1,2,1,"p",1),e&2&&w(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 Kl(t){return typeof t=="string"&&t.length>0?t:null}function sh(t){let i=new Date(t);if(isNaN(i.getTime()))return t;let e=Date.now()-i.getTime(),n=Math.floor(e/1e3);if(n<60)return"just now";let o=Math.floor(n/60);if(o<60)return`${o} minute${o===1?"":"s"} ago`;let r=Math.floor(o/60);if(r<24)return`${r} hour${r===1?"":"s"} ago`;let s=Math.floor(r/24);if(s<30)return`${s} day${s===1?"":"s"} ago`;let a=Math.floor(s/30);if(a<12)return`${a} month${a===1?"":"s"} ago`;let l=Math.floor(s/365);return`${l} year${l===1?"":"s"} ago`}function G1(t,i){if(t&1&&(u(0,"section",0)(1,"div",1),B(2,"span",2),u(3,"p",3),m(4),f(),u(5,"p",4),m(6),u(7,"a",5),m(8),f(),m(9),u(10,"a",6),m(11),f(),m(12),f()()()),t&2){let e=p();c(4),y(e.texts.emptyNoSelection.title),c(2),y(e.texts.emptyNoSelection.descPrefix),c(2),y(e.texts.emptyNoSelection.listLink),c(),y(e.texts.emptyNoSelection.descMiddle),c(2),y(e.texts.emptyNoSelection.graphLink),c(),y(e.texts.emptyNoSelection.descSuffix)}}function V1(t,i){if(t&1&&(u(0,"section",0)(1,"div",7),B(2,"span",8),u(3,"p",3),m(4),f(),u(5,"p",4)(6,"code"),m(7),f(),m(8),u(9,"a",5),m(10),f(),m(11),f()()()),t&2){let e=p();c(4),y(e.texts.emptyNotFound.title),c(3),y(e.path()),c(),y(e.texts.emptyNotFound.descSuffix),c(2),y(e.texts.emptyNotFound.backLink),c(),y(e.texts.emptyNotFound.descAfterLink)}}function H1(t,i){if(t&1&&(u(0,"span",19),B(1,"i",58),f()),t&2){let e=p(2);P("pTooltip",e.headerStaleTooltip())}}function j1(t,i){if(t&1&&(u(0,"span",20),Ue(),u(1,"svg",59),B(2,"path",60)(3,"path",61)(4,"path",62),f()()),t&2){let e=p(2);P("pTooltip",e.cardTexts.stability.experimental)}}function U1(t,i){if(t&1&&(u(0,"span",20),B(1,"i",63),f()),t&2){let e=p(2);P("pTooltip",e.cardTexts.stability.deprecated)}}function $1(t,i){t&1&&(u(0,"span",21),m(1),f()),t&2&&(c(),y(i))}function W1(t,i){if(t&1&&(u(0,"span",64),m(1),f()),t&2){let e=i.$implicit;c(),y(e)}}function q1(t,i){if(t&1&&(u(0,"div",30),J(1,W1,2,1,"span",64,me),f()),t&2){let e=p(2);c(),ee(e.headerTools())}}function X1(t,i){if(t&1&&(u(0,"a",35),m(1),f()),t&2){let e=p(2);c(),y(e.texts.backToList)}}function K1(t,i){if(t&1&&(u(0,"div",36),B(1,"i",65),u(2,"span"),m(3),f()()),t&2){let e=p(2);c(3),y(e.texts.supersededByBanner(i))}}function Y1(t,i){if(t&1){let e=de();u(0,"div",37)(1,"span"),m(2),f(),u(3,"button",66),Q("click",function(){$(e);let o=p(2);return W(o.dismissBumpError())}),B(4,"i",67),f()()}t&2&&(c(2),y(i))}function Z1(t,i){if(t&1&&(u(0,"p",38),m(1),f()),t&2){p();let e=Y(1);c(),y(e.description)}}function Q1(t,i){if(t&1&&(u(0,"div",39),B(1,"sm-inspector-debug-panel",68),f()),t&2){p();let e=Y(0),n=p();c(),P("node",e)("sidecarRoot",n.sidecarRoot())("overlay",e.sidecar)}}function J1(t,i){if(t&1&&B(0,"sm-empty-state",69)(1,"sm-empty-state",70)(2,"sm-empty-state",71),t&2){let e=p(2);P("title",e.texts.placeholders.enrichmentTitle)("body",e.texts.placeholders.body),c(),P("title",e.texts.placeholders.summaryTitle)("body",e.texts.placeholders.body),c(),P("title",e.texts.placeholders.findingsTitle)("body",e.texts.placeholders.body)}}function eT(t,i){if(t&1){let e=de();u(0,"p-card",41)(1,"sm-annotations-panel",72),Q("openPath",function(o){$(e);let r=p(2);return W(r.openPath(o))}),f()()}if(t&2){p();let e=Y(0),n=p();P("header",n.texts.cardsAnnotations),c(),P("overlay",e.sidecar)("knownPaths",n.pathSet())}}function tT(t,i){if(t&1&&(u(0,"dt"),m(1,"Bytes"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.bytesTotal)}}function nT(t,i){if(t&1&&(u(0,"dt"),m(1,"Tokens"),f(),u(2,"dd")(3,"code"),m(4),f()()),t&2){p();let e=Y(0);c(4),y(e.tokensTotal)}}function iT(t,i){if(t&1&&(m(0," \xB7 "),u(1,"code"),m(2),f(),m(3," ext ")),t&2){p();let e=Y(0);c(2),y(e.externalRefsCount)}}function oT(t,i){if(t&1){let e=de();u(0,"button",73),Q("click",function(){$(e);let o=p(2);return W(o.toggleAudit())}),B(1,"i",74),u(2,"span",75),m(3),f(),u(4,"span",76),m(5),f()()}if(t&2){let e=p(2);Z("aria-expanded",e.auditExpanded()),c(),le("pi-chevron-right",!e.auditExpanded())("pi-chevron-down",e.auditExpanded()),c(2),y(e.texts.audit.header),c(2),Ve(" \xB7 ",e.auditSummary()," ")}}function rT(t,i){if(t&1&&B(0,"sm-inspector-audit-panel",50),t&2){let e=p(2);P("sidecarRoot",e.sidecarRoot())}}function sT(t,i){if(t&1){let e=de();u(0,"button",77),Q("click",function(){$(e);let o=p(2);return W(o.togglePlugins())}),B(1,"i",74),u(2,"span",75),m(3,"Plugin contributions"),f()()}if(t&2){let e=p(2);Z("aria-expanded",e.pluginsExpanded()),c(),le("pi-chevron-right",!e.pluginsExpanded())("pi-chevron-down",e.pluginsExpanded())}}function aT(t,i){if(t&1&&B(0,"sm-plugin-contributions",50),t&2){let e=p(2);P("sidecarRoot",e.sidecarRoot())}}function cT(t,i){if(t&1){let e=de();u(0,"div",78)(1,"h3",79),m(2),f(),u(3,"p-button",80),Q("onClick",function(){$(e);let o=p(2);return W(o.refreshBody())}),f()()}if(t&2){let e=p(2);c(2),y(e.texts.cards.body),c(),P("rounded",!0)("text",!0)("ariaLabel",e.texts.body.refreshLabel)("pTooltip",e.texts.body.refreshLabel)("disabled",e.bodyState()==="loading"||!e.path())}}function dT(t,i){if(t&1&&(u(0,"p",53),m(1),f()),t&2){let e=p(2);c(),y(e.texts.body.loading)}}function lT(t,i){if(t&1&&(u(0,"p",54),m(1),f()),t&2){let e=p(2);c(),y(e.texts.body.empty)}}function uT(t,i){if(t&1&&(u(0,"p",55),m(1),f()),t&2){let e=p(2);c(),y(e.texts.body.unavailable)}}function fT(t,i){if(t&1&&(u(0,"p",56),m(1),f()),t&2){let e=p(2);c(),y(e.texts.body.renderError)}}function hT(t,i){if(t&1&&B(0,"div",57),t&2){let e=p(2);P("innerHTML",e.bodyHtml(),yh)}}function pT(t,i){if(t&1){let e=de();Ze(0)(1),u(2,"section",0)(3,"header",9)(4,"div",10),B(5,"sm-kind-icon",11),f(),u(6,"div",12)(7,"div",13)(8,"h2",14),m(9),f()(),u(10,"code",15),m(11),f()(),u(12,"div",16)(13,"button",17),Q("click",function(o){$(e);let r=p();return W(r.toggleFavorite(o))}),B(14,"i",18),f(),b(15,H1,2,1,"span",19),b(16,j1,5,1,"span",20),b(17,U1,2,1,"span",20),b(18,$1,2,1,"span",21),f(),u(19,"div",22)(20,"span",23),m(21,"Actions"),f(),u(22,"button",24),B(23,"i",25),u(24,"span"),m(25,"Generate summary"),f()(),u(26,"button",26),B(27,"i",27),u(28,"span"),m(29,"Run audit"),f()(),u(30,"button",28),B(31,"i",29),u(32,"span"),m(33,"Validate"),f()()(),b(34,q1,3,0,"div",30),f(),u(35,"div",31)(36,"button",32),Q("click",function(){$(e);let o=p();return W(o.toggleDebug())}),B(37,"i",33),f(),u(38,"p-button",34),Q("onClick",function(){$(e);let o=p();return W(o.onBumpClick())}),f(),b(39,X1,2,1,"a",35),f(),b(40,K1,4,1,"div",36),b(41,Y1,5,1,"div",37),b(42,Z1,2,1,"p",38),b(43,Q1,2,3,"div",39),u(44,"div",40),b(45,J1,3,6),b(46,eT,2,3,"p-card",41),u(47,"p-card",42),B(48,"sm-vendor-frontmatter",43),f(),u(49,"div",44)(50,"sm-linked-nodes-panel",45),Q("openPath",function(o){$(e);let r=p();return W(r.openPath(o))}),f()(),u(51,"p-card",46)(52,"dl",47),b(53,tT,5,1),b(54,nT,5,1),u(55,"dt"),m(56,"Links"),f(),u(57,"dd")(58,"code"),m(59),f(),m(60," out \xB7 "),u(61,"code"),m(62),f(),m(63," in "),b(64,iT,4,1),f()()(),u(65,"p-card",48),Ie(66,oT,6,7,"ng-template",49),b(67,rT,1,1,"sm-inspector-audit-panel",50),f(),u(68,"p-card",51),Ie(69,sT,4,5,"ng-template",49),b(70,aT,1,1,"sm-plugin-contributions",50),f(),u(71,"p-card",52),Ie(72,cT,4,6,"ng-template",49),b(73,dT,2,1,"p",53)(74,lT,2,1,"p",54)(75,uT,2,1,"p",55)(76,fT,2,1,"p",56)(77,hT,1,1,"div",57),f()()()}if(t&2){let e,n,o,r,s=p(),a=Fe(s.node());c();let l=Fe(a.frontmatter);c(2),st("--node-color",s.headerTitleColor()),le("inspector__header--skill",a.kind==="skill")("inspector__header--agent",a.kind==="agent")("inspector__header--command",a.kind==="command")("inspector__header--markdown",a.kind==="markdown"),c(2),P("kind",a.kind)("size",18),c(4),y(l.name),c(2),y(a.path),c(2),le("inspector__favorite--on",a.isFavorite===!0),P("pTooltip",a.isFavorite===!0?s.cardTexts.favoriteRemoveTooltip:s.cardTexts.favoriteAddTooltip),Z("aria-label",a.isFavorite===!0?s.cardTexts.ariaFavoriteRemove:s.cardTexts.ariaFavoriteAdd),c(),ve(a.isFavorite===!0?"pi pi-heart-fill":"pi pi-heart"),c(),w(s.headerIsStale()?15:-1),c(),w(s.headerStability()==="experimental"?16:-1),c(),w(s.headerStability()==="deprecated"?17:-1),c(),w((e=s.headerVersion())?18:-1,e),c(16),w(s.headerTools().length>0?34:-1),c(2),le("inspector__debug-toggle--active",s.debugVisible()),P("pTooltip",s.texts.debugToggleTooltip),Z("aria-label",s.texts.debugToggleAriaLabel)("aria-pressed",s.debugVisible()),c(2),P("label",s.texts.bump.label)("disabled",!s.canBump()||s.bumpInFlight())("loading",s.bumpInFlight())("pTooltip",s.bumpTooltip()),c(),w(s.mode()==="standalone"?39:-1),c(),w((n=s.headerSupersededBy())?40:-1,n),c(),w((o=s.bumpError())?41:-1,o),c(),w(l.description?42:-1),c(),w(s.debugVisible()?43:-1),c(2),w(s.mode()==="standalone"?45:-1),c(),w(a.sidecar!=null&&a.sidecar.present?46:-1),c(),P("header",s.texts.cards.agent),c(),P("frontmatter",l)("kind",a.kind)("provider",a.provider)("knownPaths",s.pathSet())("onSkillClick",s.onSkillChip),c(2),P("path",a.path),c(3),w(a.bytesTotal!==void 0?53:-1),c(),w(a.tokensTotal!==void 0?54:-1),c(5),y(a.linksOutCount??0),c(3),y(a.linksInCount??0),c(2),w(a.externalRefsCount!==void 0&&a.externalRefsCount>0?64:-1),c(3),w(s.auditExpanded()?67:-1),c(3),w(s.pluginsExpanded()?70:-1),c(3),w((r=s.bodyState())==="loading"?73:r==="empty"?74:r==="unavailable"?75:r==="error"?76:r==="ready"?77:-1)}}var mT={stable:"success",experimental:"info",deprecated:"warn"},Zl=class t{loader=d(Mt);router=d(ho);kindRegistry=d(Dt);dataSource=d(Cn);markdown=d(Gl);sidecarService=d(Vl);texts=zl;cardTexts=Ui;path=F(void 0);mode=F("standalone");node=E(()=>{let i=this.path();return i?this.loader.nodes().find(e=>e.path===i)??null:null});pathSet=E(()=>{let i=new Set;for(let e of this.loader.nodes())i.add(e.path);return i});headerVersion=E(()=>kl(this.node()));headerStability=E(()=>Rl(this.node()));headerTitleColor=E(()=>{let i=this.node();if(!i)return null;let n=i.frontmatter.color;return typeof n=="string"&&n.length>0?n:`var(--sm-kind-${i.kind})`});headerTools=E(()=>vm(this.node()));headerIsStale=E(()=>Nl(this.node()));headerStaleTooltip=E(()=>Ol(this.node(),Ui.sidecar));headerSupersededBy=E(()=>{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=Kt(i.frontmatter)?.supersededBy;return typeof o=="string"&&o.length>0?o:null});bodyState=X("idle");bodyHtml=X(null);fetchToken=0;verifiedAlive=X(new Set);verifiedDead=X(new Set);verifyInFlight=X(new Set);auditExpanded=X(!1);pluginsExpanded=X(!1);debugVisible=X(!1);constructor(){pe(()=>{let i=this.path(),e=++this.fetchToken;if(this.bodyHtml.set(null),!i){this.bodyState.set("idle");return}this.bodyState.set("loading"),this.fetchAndRenderBody(i,e)}),pe(()=>{this.path(),this.verifiedAlive.set(new Set),this.verifiedDead.set(new Set),this.verifyInFlight.set(new Set)}),pe(()=>{this.path(),this.auditExpanded.set(!1),this.pluginsExpanded.set(!1),this.debugVisible.set(!1)})}ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}kindLabel(i){return this.kindRegistry.labelOf(i)}kindStyle(i){return{background:`var(--sm-kind-${i}-bg)`,color:`var(--sm-kind-${i}-fg)`}}stabilitySeverity(i){return mT[i]}openPath(i){this.router.navigate(["/graph"],{queryParams:{path:i}})}onSkillChip=i=>{this.openPath(i)};pathExists(i){return this.pathSet().has(i)}sidecarRoot=E(()=>{let i=this.node()?.sidecar;if(!i||!i.present)return null;if(i.root)return i.root;let e={};return i.annotations&&(e.annotations=i.annotations),e});auditSummary=E(()=>{let i=this.sidecarRoot();if(!i)return this.texts.audit.headerEmpty;let e=i.audit;if(typeof e!="object"||e===null)return this.texts.audit.headerEmpty;let n=e,o=typeof n.lastBumpedAt=="string"?n.lastBumpedAt:null,r=typeof n.lastBumpedBy=="string"?n.lastBumpedBy:null;return o===null?this.texts.audit.headerEmpty:this.texts.audit.headerSummary(Cm(o),r??"?")});linkStatus(i){return this.pathSet().has(i)||this.verifiedAlive().has(i)?"live":this.verifiedDead().has(i)?"dead-confirmed":"dead-heuristic"}isVerifying(i){return this.verifyInFlight().has(i)}async verifyDeadLink(i){if(!(this.verifiedAlive().has(i)||this.verifiedDead().has(i))&&!this.verifyInFlight().has(i)){this.verifyInFlight.update(e=>new Set(e).add(i));try{await this.dataSource.getNode(i)===null?this.verifiedDead.update(n=>new Set(n).add(i)):this.verifiedAlive.update(n=>new Set(n).add(i))}catch{}finally{this.verifyInFlight.update(e=>{let n=new Set(e);return n.delete(i),n})}}}refreshBody(){let i=this.path();if(!i||this.bodyState()==="loading")return;let e=++this.fetchToken;this.bodyHtml.set(null),this.bodyState.set("loading"),this.fetchAndRenderBody(i,e)}toggleFavorite(i){i.stopPropagation();let e=this.node();e&&this.loader.toggleFavorite(e.path,!e.isFavorite)}toggleAudit(){this.auditExpanded.update(i=>!i)}togglePlugins(){this.pluginsExpanded.update(i=>!i)}toggleDebug(){this.debugVisible.update(i=>!i)}canBump=E(()=>{let i=this.node();if(!i)return!1;let e=i.sidecar;return!e||e.present===!1?!0:e.status==="fresh"?!1:go(e)});bumpInFlight=X(!1);bumpError=X(null);bumpTooltip=E(()=>this.canBump()?this.texts.bump.tooltipEnabled:this.texts.bump.tooltipDisabledFresh);async onBumpClick(){let i=this.node();if(i&&this.canBump()&&!this.bumpInFlight()){this.bumpInFlight.set(!0),this.bumpError.set(null);try{await this.sidecarService.bump(i.path)}catch(e){this.bumpError.set(this.formatBumpError(e))}finally{this.bumpInFlight.set(!1)}}}dismissBumpError(){this.bumpError.set(null)}formatBumpError(i){if(i instanceof Xt)switch(i.code){case"sidecar-fresh":return`${this.texts.bump.errorPrefix} ${this.texts.bump.errorFresh}`;case"not-found":return`${this.texts.bump.errorPrefix} ${this.texts.bump.errorNotFound}`;default:return`${this.texts.bump.errorPrefix} ${i.message||this.texts.bump.errorGeneric}`}let e=i instanceof Error?i.message:String(i);return`${this.texts.bump.errorPrefix} ${e||this.texts.bump.errorGeneric}`}async fetchAndRenderBody(i,e){try{let n=await this.dataSource.getNode(i,{includeBody:!0});if(e!==this.fetchToken)return;if(n===null){this.bodyState.set("unavailable");return}let o=n.item.body;if(o===null){this.bodyState.set("unavailable");return}if(o===void 0||o.trim().length===0){this.bodyState.set("empty");return}let r=await this.markdown.render(o);if(e!==this.fetchToken)return;this.bodyHtml.set(r),this.bodyState.set("ready")}catch{if(e!==this.fetchToken)return;this.bodyState.set("error")}}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({type:t,selectors:[["app-inspector-view"]],hostVars:2,hostBindings:function(e,n){e&2&&le("inspector-view--embedded",n.mode()==="embedded")},inputs:{path:[1,"path"],mode:[1,"mode"]},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","pi","pi-question-circle",2,"color","var(--sm-severity-warn)","opacity","1"],["data-testid","inspector-title",1,"inspector__header"],["aria-hidden","true",1,"inspector__icon-box"],[3,"kind","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"],["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"],["data-testid","inspector-plugin-actions",1,"inspector__plugin-actions"],[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"],["data-testid","inspector-header-tools",1,"inspector__tools"],[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"],[3,"frontmatter","kind","provider","knownPaths","onSkillClick"],["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 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"],["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"],[1,"inspector__tool-tag"],["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","overlay","knownPaths"],["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"],[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"]],template:function(e,n){e&1&&b(0,G1,13,6,"section",0)(1,V1,12,5,"section",0)(2,pT,78,58,"section",0),e&2&&w(n.path()?n.node()?2:1:0)},dependencies:[Nh,xn,gn,Bl,$i,vn,yn,He,Qe,jl,Ul,Hl,Wl,ql,Xl,Yl,Ht],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:.25rem;font-size:.85rem}.inspector__header[_ngcontent-%COMP%]{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:var(--accent, var(--sm-kind-markdown));color:#fff;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__icon-box[_ngcontent-%COMP%]{width:42px;height:42px;border-radius:8px;display:flex;align-items:center;justify-content:center;background:#fff3;color:#fff;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:#fff;flex:0 1 auto;min-width:0}.inspector__path-code[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.7rem;color:#ffffffeb;background:#ffffff29;padding:.1rem .4rem;border-radius:3px;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:#ffffffeb;border-radius:4px;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:#ffffff2e;color:#fff}.inspector__favorite[_ngcontent-%COMP%]:focus-visible{outline:2px solid rgba(255,255,255,.7);outline-offset:1px}.inspector__favorite--on[_ngcontent-%COMP%]{color:#fff}.inspector__stability-icon[_ngcontent-%COMP%], .inspector__stale-icon[_ngcontent-%COMP%]{display:inline-flex;align-items:center;justify-content:center;color:#ffffffeb;cursor:help}.inspector__stale-icon[_ngcontent-%COMP%]{color:#fde68a}.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__name-version[_ngcontent-%COMP%]{font-family:var(--sm-font-mono);font-size:.66rem;color:#fffffff2;background:#fff3;padding:.06rem .4rem;border-radius:3px;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:#ffffffbf;margin-right:.15rem}.inspector__plugin-btn[_ngcontent-%COMP%]{display:inline-flex;align-items:center;gap:.4rem;padding:.4rem .75rem;border:1px solid rgba(255,255,255,.32);border-radius:999px;background:#ffffff29;color:#fff;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:#ffffff42;border-color:#ffffff73}.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:.5rem 1rem;margin:.6rem -1rem -.85rem;border-top:1px solid rgba(255,255,255,.2);background:#0000002e}.inspector__tool-tag[_ngcontent-%COMP%]{display:inline-flex;align-items:center;padding:.12rem .5rem;border-radius:3px;background:#ffffff2e;color:#fffffff2;font-family:var(--sm-font-mono);font-size:.66rem;font-weight:500;line-height:1.3;flex:none}.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 .p-card{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:4px;padding:.75rem;margin:.75rem 0;white-space:pre-wrap;word-wrap:break-word;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;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:3px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;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:.25rem;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 .p-chip{cursor:pointer;background:var(--p-primary-50);color:var(--p-primary-color);transition:background .15s ease}[_nghost-%COMP%] .chip--link:hover .p-chip{background:var(--p-primary-100)}[_nghost-%COMP%] .chip--dead .p-chip{background:var(--sm-bg-hover);color:var(--p-text-muted-color);text-decoration:line-through;cursor:not-allowed}[_nghost-%COMP%] .chip--warn .p-chip{background:var(--sm-kind-command-bg);color:var(--sm-kind-command-fg)}[_nghost-%COMP%] .chip--dead-confirmed .p-chip{background:var(--sm-bg-hover);color:var(--sm-severity-error);border:1px dashed var(--sm-severity-error)}.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:.25rem;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:.25rem;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__header[_ngcontent-%COMP%]{margin:-1rem -1.1rem 0}.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:4px;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:4px;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:4px;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})};function ah(t,i){var e,n=1;t==null&&(t=0),i==null&&(i=0);function o(){var r,s=e.length,a,l=0,h=0;for(r=0;r<s;++r)a=e[r],l+=a.x,h+=a.y;for(l=(l/s-t)*n,h=(h/s-i)*n,r=0;r<s;++r)a=e[r],a.x-=l,a.y-=h}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 Lm(t){let i=+this._x.call(null,t),e=+this._y.call(null,t);return Bm(this.cover(i,e),i,e,t)}function Bm(t,i,e,n){if(isNaN(i)||isNaN(e))return t;var o,r=t._root,s={data:n},a=t._x0,l=t._y0,h=t._x1,_=t._y1,v,S,I,N,D,M,k,O;if(!r)return t._root=s,t;for(;r.length;)if((D=i>=(v=(a+h)/2))?a=v:h=v,(M=e>=(S=(l+_)/2))?l=S:_=S,o=r,!(r=r[k=M<<1|D]))return o[k]=s,t;if(I=+t._x.call(null,r.data),N=+t._y.call(null,r.data),i===I&&e===N)return s.next=r,o?o[k]=s:t._root=s,t;do o=o?o[k]=new Array(4):t._root=new Array(4),(D=i>=(v=(a+h)/2))?a=v:h=v,(M=e>=(S=(l+_)/2))?l=S:_=S;while((k=M<<1|D)===(O=(N>=S)<<1|I>=v));return o[O]=r,o[k]=s,t}function zm(t){var i,e,n=t.length,o,r,s=new Array(n),a=new Array(n),l=1/0,h=1/0,_=-1/0,v=-1/0;for(e=0;e<n;++e)isNaN(o=+this._x.call(null,i=t[e]))||isNaN(r=+this._y.call(null,i))||(s[e]=o,a[e]=r,o<l&&(l=o),o>_&&(_=o),r<h&&(h=r),r>v&&(v=r));if(l>_||h>v)return this;for(this.cover(l,h).cover(_,v),e=0;e<n;++e)Bm(this,s[e],a[e],t[e]);return this}function Gm(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 s=o-e||1,a=this._root,l,h;e>t||t>=o||n>i||i>=r;)switch(h=(i<n)<<1|t<e,l=new Array(4),l[h]=a,a=l,s*=2,h){case 0:o=e+s,r=n+s;break;case 1:e=o-s,r=n+s;break;case 2:o=e+s,n=r-s;break;case 3:e=o-s,n=r-s;break}this._root&&this._root.length&&(this._root=a)}return this._x0=e,this._y0=n,this._x1=o,this._y1=r,this}function Vm(){var t=[];return this.visit(function(i){if(!i.length)do t.push(i.data);while(i=i.next)}),t}function Hm(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 Le(t,i,e,n,o){this.node=t,this.x0=i,this.y0=e,this.x1=n,this.y1=o}function jm(t,i,e){var n,o=this._x0,r=this._y0,s,a,l,h,_=this._x1,v=this._y1,S=[],I=this._root,N,D;for(I&&S.push(new Le(I,o,r,_,v)),e==null?e=1/0:(o=t-e,r=i-e,_=t+e,v=i+e,e*=e);N=S.pop();)if(!(!(I=N.node)||(s=N.x0)>_||(a=N.y0)>v||(l=N.x1)<o||(h=N.y1)<r))if(I.length){var M=(s+l)/2,k=(a+h)/2;S.push(new Le(I[3],M,k,l,h),new Le(I[2],s,k,M,h),new Le(I[1],M,a,l,k),new Le(I[0],s,a,M,k)),(D=(i>=k)<<1|t>=M)&&(N=S[S.length-1],S[S.length-1]=S[S.length-1-D],S[S.length-1-D]=N)}else{var O=t-+this._x.call(null,I.data),z=i-+this._y.call(null,I.data),V=O*O+z*z;if(V<e){var U=Math.sqrt(e=V);o=t-U,r=i-U,_=t+U,v=i+U,n=I.data}}return n}function Um(t){if(isNaN(_=+this._x.call(null,t))||isNaN(v=+this._y.call(null,t)))return this;var i,e=this._root,n,o,r,s=this._x0,a=this._y0,l=this._x1,h=this._y1,_,v,S,I,N,D,M,k;if(!e)return this;if(e.length)for(;;){if((N=_>=(S=(s+l)/2))?s=S:l=S,(D=v>=(I=(a+h)/2))?a=I:h=I,i=e,!(e=e[M=D<<1|N]))return this;if(!e.length)break;(i[M+1&3]||i[M+2&3]||i[M+3&3])&&(n=i,k=M)}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[M]=r:delete i[M],(e=i[0]||i[1]||i[2]||i[3])&&e===(i[3]||i[2]||i[1]||i[0])&&!e.length&&(n?n[k]=e:this._root=e),this):(this._root=r,this)}function $m(t){for(var i=0,e=t.length;i<e;++i)this.remove(t[i]);return this}function Wm(){return this._root}function qm(){var t=0;return this.visit(function(i){if(!i.length)do++t;while(i=i.next)}),t}function Xm(t){var i=[],e,n=this._root,o,r,s,a,l;for(n&&i.push(new Le(n,this._x0,this._y0,this._x1,this._y1));e=i.pop();)if(!t(n=e.node,r=e.x0,s=e.y0,a=e.x1,l=e.y1)&&n.length){var h=(r+a)/2,_=(s+l)/2;(o=n[3])&&i.push(new Le(o,h,_,a,l)),(o=n[2])&&i.push(new Le(o,r,_,h,l)),(o=n[1])&&i.push(new Le(o,h,s,a,_)),(o=n[0])&&i.push(new Le(o,r,s,h,_))}return this}function Km(t){var i=[],e=[],n;for(this._root&&i.push(new Le(this._root,this._x0,this._y0,this._x1,this._y1));n=i.pop();){var o=n.node;if(o.length){var r,s=n.x0,a=n.y0,l=n.x1,h=n.y1,_=(s+l)/2,v=(a+h)/2;(r=o[0])&&i.push(new Le(r,s,a,_,v)),(r=o[1])&&i.push(new Le(r,_,a,l,v)),(r=o[2])&&i.push(new Le(r,s,v,_,h)),(r=o[3])&&i.push(new Le(r,_,v,l,h))}e.push(n)}for(;n=e.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this}function Ym(t){return t[0]}function Zm(t){return arguments.length?(this._x=t,this):this._x}function Qm(t){return t[1]}function Jm(t){return arguments.length?(this._y=t,this):this._y}function fn(t,i,e){var n=new ch(i??Ym,e??Qm,NaN,NaN,NaN,NaN);return t==null?n:n.addAll(t)}function ch(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 e_(t){for(var i={data:t.data},e=i;t=t.next;)e=e.next={data:t.data};return i}var Xe=fn.prototype=ch.prototype;Xe.copy=function(){var t=new ch(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=e_(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]=e_(n));return t};Xe.add=Lm;Xe.addAll=zm;Xe.cover=Gm;Xe.data=Vm;Xe.extent=Hm;Xe.find=jm;Xe.remove=Um;Xe.removeAll=$m;Xe.root=Wm;Xe.size=qm;Xe.visit=Xm;Xe.visitAfter=Km;Xe.x=Zm;Xe.y=Jm;function Ne(t){return function(){return t}}function mt(t){return(t()-.5)*1e-6}function _T(t){return t.x+t.vx}function gT(t){return t.y+t.vy}function Ql(t){var i,e,n,o=1,r=1;typeof t!="function"&&(t=Ne(t==null?1:+t));function s(){for(var h,_=i.length,v,S,I,N,D,M,k=0;k<r;++k)for(v=fn(i,_T,gT).visitAfter(a),h=0;h<_;++h)S=i[h],D=e[S.index],M=D*D,I=S.x+S.vx,N=S.y+S.vy,v.visit(O);function O(z,V,U,ie,we){var ae=z.data,Be=z.r,oe=D+Be;if(ae){if(ae.index>S.index){var se=I-ae.x-ae.vx,Ge=N-ae.y-ae.vy,ge=se*se+Ge*Ge;ge<oe*oe&&(se===0&&(se=mt(n),ge+=se*se),Ge===0&&(Ge=mt(n),ge+=Ge*Ge),ge=(oe-(ge=Math.sqrt(ge)))/ge*o,S.vx+=(se*=ge)*(oe=(Be*=Be)/(M+Be)),S.vy+=(Ge*=ge)*oe,ae.vx-=se*(oe=1-oe),ae.vy-=Ge*oe)}return}return V>I+oe||ie<I-oe||U>N+oe||we<N-oe}}function a(h){if(h.data)return h.r=e[h.data.index];for(var _=h.r=0;_<4;++_)h[_]&&h[_].r>h.r&&(h.r=h[_].r)}function l(){if(i){var h,_=i.length,v;for(e=new Array(_),h=0;h<_;++h)v=i[h],e[v.index]=+t(v,h,i)}}return s.initialize=function(h,_){i=h,n=_,l()},s.iterations=function(h){return arguments.length?(r=+h,s):r},s.strength=function(h){return arguments.length?(o=+h,s):o},s.radius=function(h){return arguments.length?(t=typeof h=="function"?h:Ne(+h),l(),s):t},s}function yT(t){return t.index}function t_(t,i){var e=t.get(i);if(!e)throw new Error("node not found: "+i);return e}function Jl(t){var i=yT,e=v,n,o=Ne(30),r,s,a,l,h,_=1;t==null&&(t=[]);function v(M){return 1/Math.min(a[M.source.index],a[M.target.index])}function S(M){for(var k=0,O=t.length;k<_;++k)for(var z=0,V,U,ie,we,ae,Be,oe;z<O;++z)V=t[z],U=V.source,ie=V.target,we=ie.x+ie.vx-U.x-U.vx||mt(h),ae=ie.y+ie.vy-U.y-U.vy||mt(h),Be=Math.sqrt(we*we+ae*ae),Be=(Be-r[z])/Be*M*n[z],we*=Be,ae*=Be,ie.vx-=we*(oe=l[z]),ie.vy-=ae*oe,U.vx+=we*(oe=1-oe),U.vy+=ae*oe}function I(){if(s){var M,k=s.length,O=t.length,z=new Map(s.map((U,ie)=>[i(U,ie,s),U])),V;for(M=0,a=new Array(k);M<O;++M)V=t[M],V.index=M,typeof V.source!="object"&&(V.source=t_(z,V.source)),typeof V.target!="object"&&(V.target=t_(z,V.target)),a[V.source.index]=(a[V.source.index]||0)+1,a[V.target.index]=(a[V.target.index]||0)+1;for(M=0,l=new Array(O);M<O;++M)V=t[M],l[M]=a[V.source.index]/(a[V.source.index]+a[V.target.index]);n=new Array(O),N(),r=new Array(O),D()}}function N(){if(s)for(var M=0,k=t.length;M<k;++M)n[M]=+e(t[M],M,t)}function D(){if(s)for(var M=0,k=t.length;M<k;++M)r[M]=+o(t[M],M,t)}return S.initialize=function(M,k){s=M,h=k,I()},S.links=function(M){return arguments.length?(t=M,I(),S):t},S.id=function(M){return arguments.length?(i=M,S):i},S.iterations=function(M){return arguments.length?(_=+M,S):_},S.strength=function(M){return arguments.length?(e=typeof M=="function"?M:Ne(+M),N(),S):e},S.distance=function(M){return arguments.length?(o=typeof M=="function"?M:Ne(+M),D(),S):o},S}var vT={value:()=>{}};function i_(){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 eu(e)}function eu(t){this._=t}function CT(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}})}eu.prototype=i_.prototype={constructor:eu,on:function(t,i){var e=this._,n=CT(t+"",e),o,r=-1,s=n.length;if(arguments.length<2){for(;++r<s;)if((o=(t=n[r]).type)&&(o=xT(e[o],t.name)))return o;return}if(i!=null&&typeof i!="function")throw new Error("invalid callback: "+i);for(;++r<s;)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 eu(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 xT(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]=vT,t=t.slice(0,n).concat(t.slice(n+1));break}return e!=null&&t.push({name:i,value:e}),t}var dh=i_;var Wn=0,Ki=0,Xi=0,r_=1e3,tu,Yi,nu=0,hn=0,iu=0,Zi=typeof performance=="object"&&performance.now?performance:Date,s_=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function fh(){return hn||(s_(bT),hn=Zi.now()+iu)}function bT(){hn=0}function lh(){this._call=this._time=this._next=null}lh.prototype=ou.prototype={constructor:lh,restart:function(t,i,e){if(typeof t!="function")throw new TypeError("callback is not a function");e=(e==null?fh():+e)+(i==null?0:+i),!this._next&&Yi!==this&&(Yi?Yi._next=this:tu=this,Yi=this),this._call=t,this._time=e,uh()},stop:function(){this._call&&(this._call=null,this._time=1/0,uh())}};function ou(t,i,e){var n=new lh;return n.restart(t,i,e),n}function a_(){fh(),++Wn;for(var t=tu,i;t;)(i=hn-t._time)>=0&&t._call.call(void 0,i),t=t._next;--Wn}function o_(){hn=(nu=Zi.now())+iu,Wn=Ki=0;try{a_()}finally{Wn=0,ST(),hn=0}}function wT(){var t=Zi.now(),i=t-nu;i>r_&&(iu-=i,nu=t)}function ST(){for(var t,i=tu,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:tu=e);Yi=t,uh(n)}function uh(t){if(!Wn){Ki&&(Ki=clearTimeout(Ki));var i=t-hn;i>24?(t<1/0&&(Ki=setTimeout(o_,t-Zi.now()-iu)),Xi&&(Xi=clearInterval(Xi))):(Xi||(nu=Zi.now(),Xi=setInterval(wT,r_)),Wn=1,s_(o_))}}function c_(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}function d_(t){return t.x}function l_(t){return t.y}var IT=10,TT=Math.PI*(3-Math.sqrt(5));function ru(t){var i,e=1,n=.001,o=1-Math.pow(n,1/300),r=0,s=.6,a=new Map,l=ou(v),h=dh("tick","end"),_=c_();t==null&&(t=[]);function v(){S(),h.call("tick",i),e<n&&(l.stop(),h.call("end",i))}function S(D){var M,k=t.length,O;D===void 0&&(D=1);for(var z=0;z<D;++z)for(e+=(r-e)*o,a.forEach(function(V){V(e)}),M=0;M<k;++M)O=t[M],O.fx==null?O.x+=O.vx*=s:(O.x=O.fx,O.vx=0),O.fy==null?O.y+=O.vy*=s:(O.y=O.fy,O.vy=0);return i}function I(){for(var D=0,M=t.length,k;D<M;++D){if(k=t[D],k.index=D,k.fx!=null&&(k.x=k.fx),k.fy!=null&&(k.y=k.fy),isNaN(k.x)||isNaN(k.y)){var O=IT*Math.sqrt(.5+D),z=D*TT;k.x=O*Math.cos(z),k.y=O*Math.sin(z)}(isNaN(k.vx)||isNaN(k.vy))&&(k.vx=k.vy=0)}}function N(D){return D.initialize&&D.initialize(t,_),D}return I(),i={tick:S,restart:function(){return l.restart(v),i},stop:function(){return l.stop(),i},nodes:function(D){return arguments.length?(t=D,I(),a.forEach(N),i):t},alpha:function(D){return arguments.length?(e=+D,i):e},alphaMin:function(D){return arguments.length?(n=+D,i):n},alphaDecay:function(D){return arguments.length?(o=+D,i):+o},alphaTarget:function(D){return arguments.length?(r=+D,i):r},velocityDecay:function(D){return arguments.length?(s=1-D,i):1-s},randomSource:function(D){return arguments.length?(_=D,a.forEach(N),i):_},force:function(D,M){return arguments.length>1?(M==null?a.delete(D):a.set(D,N(M)),i):a.get(D)},find:function(D,M,k){var O=0,z=t.length,V,U,ie,we,ae;for(k==null?k=1/0:k*=k,O=0;O<z;++O)we=t[O],V=D-we.x,U=M-we.y,ie=V*V+U*U,ie<k&&(ae=we,k=ie);return ae},on:function(D,M){return arguments.length>1?(h.on(D,M),i):h.on(D)}}}function su(){var t,i,e,n,o=Ne(-30),r,s=1,a=1/0,l=.81;function h(I){var N,D=t.length,M=fn(t,d_,l_).visitAfter(v);for(n=I,N=0;N<D;++N)i=t[N],M.visit(S)}function _(){if(t){var I,N=t.length,D;for(r=new Array(N),I=0;I<N;++I)D=t[I],r[D.index]=+o(D,I,t)}}function v(I){var N=0,D,M,k=0,O,z,V;if(I.length){for(O=z=V=0;V<4;++V)(D=I[V])&&(M=Math.abs(D.value))&&(N+=D.value,k+=M,O+=M*D.x,z+=M*D.y);I.x=O/k,I.y=z/k}else{D=I,D.x=D.data.x,D.y=D.data.y;do N+=r[D.data.index];while(D=D.next)}I.value=N}function S(I,N,D,M){if(!I.value)return!0;var k=I.x-i.x,O=I.y-i.y,z=M-N,V=k*k+O*O;if(z*z/l<V)return V<a&&(k===0&&(k=mt(e),V+=k*k),O===0&&(O=mt(e),V+=O*O),V<s&&(V=Math.sqrt(s*V)),i.vx+=k*I.value*n/V,i.vy+=O*I.value*n/V),!0;if(I.length||V>=a)return;(I.data!==i||I.next)&&(k===0&&(k=mt(e),V+=k*k),O===0&&(O=mt(e),V+=O*O),V<s&&(V=Math.sqrt(s*V)));do I.data!==i&&(z=r[I.data.index]*n/V,i.vx+=k*z,i.vy+=O*z);while(I=I.next)}return h.initialize=function(I,N){t=I,e=N,_()},h.strength=function(I){return arguments.length?(o=typeof I=="function"?I:Ne(+I),_(),h):o},h.distanceMin=function(I){return arguments.length?(s=I*I,h):Math.sqrt(s)},h.distanceMax=function(I){return arguments.length?(a=I*I,h):Math.sqrt(a)},h.theta=function(I){return arguments.length?(l=I*I,h):Math.sqrt(l)},h}function au(t){var i=Ne(.1),e,n,o;typeof t!="function"&&(t=Ne(t==null?0:+t));function r(a){for(var l=0,h=e.length,_;l<h;++l)_=e[l],_.vx+=(o[l]-_.x)*n[l]*a}function s(){if(e){var a,l=e.length;for(n=new Array(l),o=new Array(l),a=0;a<l;++a)n[a]=isNaN(o[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return r.initialize=function(a){e=a,s()},r.strength=function(a){return arguments.length?(i=typeof a=="function"?a:Ne(+a),s(),r):i},r.x=function(a){return arguments.length?(t=typeof a=="function"?a:Ne(+a),s(),r):t},r}function cu(t){var i=Ne(.1),e,n,o;typeof t!="function"&&(t=Ne(t==null?0:+t));function r(a){for(var l=0,h=e.length,_;l<h;++l)_=e[l],_.vy+=(o[l]-_.y)*n[l]*a}function s(){if(e){var a,l=e.length;for(n=new Array(l),o=new Array(l),a=0;a<l;++a)n[a]=isNaN(o[a]=+t(e[a],a,e))?0:+i(e[a],a,e)}}return r.initialize=function(a){e=a,s()},r.strength=function(a){return arguments.length?(i=typeof a=="function"?a:Ne(+a),s(),r):i},r.y=function(a){return arguments.length?(t=typeof a=="function"?a:Ne(+a),s(),r):t},r}var Qi=260,hh=120;function ET(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 u_(){let t=null;return(i,e)=>{let n=new Set(i.map(S=>S.path)),o=new Map,r=e?.links??[];for(let S of r){if(!n.has(S.source)||!n.has(S.target)||S.source===S.target)continue;let I=DT(S.kind,S.source,S.target);o.has(I)||o.set(I,{id:I,from:S.source,to:S.target,kind:S.kind})}let s=[...o.values()],a=new Map;for(let S of i)a.set(S.path,S);let l=new Map;for(let S of e?.nodes??[])l.set(S.path,S);let h=ET(i,s);if(t&&t.fingerprint===h)return{nodesByPath:a,apiNodesByPath:l,edges:t.edges,positions:t.positions,computedAt:t.computedAt};let _=PT(i,s),v=performance.now();return t={fingerprint:h,positions:_,edges:s,computedAt:v},{nodesByPath:a,apiNodesByPath:l,edges:s,positions:_,computedAt:v}}}function PT(t,i){let e=t.map(a=>({id:a.path})),n=i.map(a=>({source:a.from,target:a.to})),o=ru(e).force("link",Jl(n).id(a=>a.id).distance(90).strength(1)).force("charge",su().strength(-200)).force("center",ah(0,0)).force("x",au(0).strength(.06)).force("y",cu(0).strength(.06)).force("collide",Ql(Qi/2+12)).stop(),r=400;for(let a=0;a<r;a++)o.tick();let s=new Map;for(let a of e)s.set(a.id,{x:(a.x??0)-Qi/2,y:(a.y??0)-hh/2});return s}function f_(t,i,e,n){let o=new Set(n),r=t.map(_=>{let v={id:_.path};if(o.has(_.path))return v;let S=e[_.path];if(!S)return v;let I=S.x+Qi/2,N=S.y+hh/2;return v.x=I,v.y=N,v.fx=I,v.fy=N,v}),s=i.map(_=>({source:_.from,target:_.to})),a=ru(r).force("link",Jl(s).id(_=>_.id).distance(90).strength(1)).force("charge",su().strength(-200)).force("x",au(0).strength(.06)).force("y",cu(0).strength(.06)).force("collide",Ql(Qi/2+12)).stop(),l=200;for(let _=0;_<l;_++)a.tick();let h=new Map;for(let _ of r)o.has(_.id)&&h.set(_.id,{x:(_.x??0)-Qi/2,y:(_.y??0)-hh/2});return h}function h_(t,i,e){let n=t.edges.filter(a=>i.has(a.from)&&i.has(a.to)),o=new Map,r=new Map;for(let a of n)o.set(a.from,(o.get(a.from)??0)+1),r.set(a.to,(r.get(a.to)??0)+1);let s=[];for(let a of i){let l=t.nodesByPath.get(a);if(!l)continue;let h=t.apiNodesByPath.get(a),_=e[a],v=t.positions.get(a)??{x:0,y:0},S=_?{x:_.x,y:_.y}:v;s.push({id:a,path:a,view:l,kind:l.kind,position:S,stats:{linksIn:r.get(a)??0,linksOut:o.get(a)??0,bytesTotal:h?.bytes.total,tokensTotal:h?.tokens?.total,externalRefsCount:h?.externalRefsCount},summary:MT(l)})}return{nodes:s,edges:n}}function MT(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 DT(t,i,e){let[n,o]=[i,e].sort();return`${t}:${n}::${o}`}var kT=["canvasWrap"],RT=["panelCloseBtn"],y_=(t,i)=>i.id;function NT(t,i){if(t&1&&(u(0,"div",3),B(1,"span",7),u(2,"p",8),m(3),f()()),t&2){let e=p();c(3),y(e.texts.loading)}}function OT(t,i){if(t&1&&(u(0,"div",4),B(1,"span",9),u(2,"p",8),m(3),f(),u(4,"p",10),m(5),f()()),t&2){let e=p();c(3),y(e.texts.errorTitle),c(2),y(e.error())}}function FT(t,i){if(t&1&&(u(0,"div",5),B(1,"span",11),u(2,"p",8),m(3),f(),u(4,"p",10),m(5),f()()),t&2){let e=p();c(3),y(e.texts.emptyTitle),c(2),y(e.texts.emptyDesc)}}function AT(t,i){if(t&1&&(u(0,"f-connection",30),B(1,"f-connection-marker-arrow",31),f()),t&2){let e=i.$implicit,n=p(2);ve("f-conn--"+e.kind),le("f-conn--highlighted",n.isEdgeHighlighted(e))("f-conn--dimmed",n.isEdgeDimmed(e)),P("fOutputId",e.from+"-out")("fInputId",e.to+"-in")("fType",n.connectionType)("fBehavior",n.connectionBehavior)("fOffset",4)("fReassignDisabled",!0)("fSelectionDisabled",!0),c(),P("type",n.markerEnd)}}function LT(t,i){if(t&1){let e=de();Ut(0,18),u(1,"div",33),Q("fNodePositionChange",function(o){let r=$(e).$implicit,s=p(3);return W(s.onNodePositionChange(r.id,o))})("pointerdown",function(o){$(e);let r=p(3);return W(r.onNodePointerDown(o))})("click",function(o){let r=$(e).$implicit,s=p(3);return W(s.selectNode(r,o))})("dblclick",function(){let o=$(e).$implicit,r=p(3);return W(r.openNode(o))}),B(2,"div",34),u(3,"sm-node-card",35),Q("expandedChange",function(o){let r=$(e).$implicit,s=p(3);return W(s.setExpanded(r.id,o))})("favoriteToggle",function(o){$(e);let r=p(3);return W(r.onFavoriteToggle(o))}),f(),B(4,"div",36),f(),$t()}if(t&2){let e=i.$implicit,n=p(3);c(),P("fNodeId",e.id)("fNodePosition",e.position),Z("data-testid","graph-node-"+e.id),c(),P("fInputId",e.id+"-in")("fInputConnectableSide",n.inputSide),c(),P("node",e.view)("stats",e.stats)("summary",e.summary)("selected",n.isSelected(e.id))("highlighted",n.isHighlighted(e.id))("dimmed",n.isDimmed(e.id))("expanded",n.isExpanded(e.id))("isFavorite",e.view.isFavorite===!0),c(),P("fOutputId",e.id+"-out")("fOutputConnectableSide",n.outputSide)}}function BT(t,i){if(t&1&&Ie(0,LT,5,15,"ng-container",32),t&2){let e=p(2);P("fVirtualForOf",e.graph().nodes)}}function zT(t,i){if(t&1){let e=de();u(0,"div",33),Q("fNodePositionChange",function(o){let r=$(e).$implicit,s=p(3);return W(s.onNodePositionChange(r.id,o))})("pointerdown",function(o){$(e);let r=p(3);return W(r.onNodePointerDown(o))})("click",function(o){let r=$(e).$implicit,s=p(3);return W(s.selectNode(r,o))})("dblclick",function(){let o=$(e).$implicit,r=p(3);return W(r.openNode(o))}),B(1,"div",34),u(2,"sm-node-card",35),Q("expandedChange",function(o){let r=$(e).$implicit,s=p(3);return W(s.setExpanded(r.id,o))})("favoriteToggle",function(o){$(e);let r=p(3);return W(r.onFavoriteToggle(o))}),f(),B(3,"div",36),f()}if(t&2){let e=i.$implicit,n=p(3);P("fNodeId",e.id)("fNodePosition",e.position),Z("data-testid","graph-node-"+e.id),c(),P("fInputId",e.id+"-in")("fInputConnectableSide",n.inputSide),c(),P("node",e.view)("stats",e.stats)("summary",e.summary)("selected",n.isSelected(e.id))("highlighted",n.isHighlighted(e.id))("dimmed",n.isDimmed(e.id))("expanded",n.isExpanded(e.id))("isFavorite",e.view.isFavorite===!0),c(),P("fOutputId",e.id+"-out")("fOutputConnectableSide",n.outputSide)}}function GT(t,i){if(t&1&&(Ut(0,18),J(1,zT,4,15,"div",37,y_),$t()),t&2){let e=p(2);c(),ee(e.graph().nodes)}}function VT(t,i){if(t&1&&B(0,"app-perf-hud",23),t&2){let e=p(2);P("visible",e.visibleCount())("total",e.totalCount())("edges",e.edgeCount())("cacheAt",e.layoutComputedAt())}}function HT(t,i){if(t&1){let e=de();u(0,"div",12,0),Q("mousedown",function(o){$(e);let r=p();return W(r.onCanvasMouseDown(o))})("click",function(o){$(e);let r=p();return W(r.onCanvasClick(o))}),u(2,"f-flow",13),Q("fLoaded",function(){$(e);let o=p();return W(o.onLoaded())}),u(3,"f-background"),B(4,"f-rect-pattern"),f(),B(5,"f-line-alignment",14),u(6,"f-canvas",15),Q("fCanvasChange",function(o){$(e);let r=p();return W(r.onCanvasChange(o))}),Ut(7,16),J(8,AT,2,14,"f-connection",17,y_),$t(),b(10,BT,1,1,"ng-container",18)(11,GT,3,0,"ng-container",18),f(),B(12,"f-minimap"),f(),B(13,"app-kind-palette"),u(14,"aside",19)(15,"div",20),Q("mousedown",function(o){$(e);let r=p();return W(r.onPanelResizeStart(o))}),f(),u(16,"p-button",21,1),Q("onClick",function(){$(e);let o=p();return W(o.closePanel())}),f(),B(18,"app-inspector-view",22),f(),b(19,VT,1,4,"app-perf-hud",23),u(20,"div",24)(21,"p-button",25),Q("onClick",function(){$(e);let o=p();return W(o.zoomIn())}),f(),u(22,"p-button",26),Q("onClick",function(){$(e);let o=p();return W(o.zoomOut())}),f(),u(23,"p-button",27),Q("onClick",function(){$(e);let o=p();return W(o.fitToScreen())}),f(),B(24,"span",28),u(25,"p-button",29),Q("onClick",function(){$(e);let o=p();return W(o.resetLayout())}),f()()()}if(t&2){let e=p();c(2),P("fCache",e.perf.cache),c(3),P("fAlignThreshold",20),c(),P("position",e.viewportPosition())("scale",e.viewportScale())("fZoomStep",.06)("fZoomDblClickStep",.35)("debounceTime",150),c(2),ee(e.graph().edges),c(2),w(e.perf.virtualization?10:11),c(4),st("width",e.clampedPanelWidth(),"px"),le("is-open",e.selectedNodeId()!==null),Z("aria-label",e.texts.a11y.panel),c(),Z("aria-label",e.texts.panel.resizeLabel),c(),P("ariaLabel",e.texts.panel.closeLabel)("pTooltip",e.texts.panel.closeLabel)("text",!0)("rounded",!0),c(2),P("path",e.selectedPath()),c(),w(e.perfHud?19:-1),c(),Z("aria-label",e.texts.a11y.toolbar),c(),P("ariaLabel",e.texts.toolbar.zoomIn)("pTooltip",e.texts.toolbar.zoomIn)("text",!0)("rounded",!0)("disabled",!e.canZoomIn()),c(),P("ariaLabel",e.texts.toolbar.zoomOut)("pTooltip",e.texts.toolbar.zoomOut)("text",!0)("rounded",!0)("disabled",!e.canZoomOut()),c(),P("ariaLabel",e.texts.toolbar.fitToScreen)("pTooltip",e.texts.toolbar.fitToScreen)("text",!0)("rounded",!0),c(2),P("ariaLabel",e.texts.toolbar.resetLayoutLabel)("pTooltip",e.texts.toolbar.resetLayoutTooltip)("text",!0)("rounded",!0)}}var jT=.1,UT=4,p_=.2,v_="sm.graph.viewport",C_="sm.graph.node-positions",x_="sm.graph.node-expanded",b_="sm.graph.panel-width",ph=400,du=280,m_=80,__=class t{loader=d(Mt);filters=d(yo);router=d(ho);route=d(Rh);canvas=ke(Hi);zoom=ke(ji);canvasWrap=ke("canvasWrap");panelCloseBtn=ke("panelCloseBtn");outputSide=L.BOTTOM;inputSide=L.TOP;connectionType=Nt.SEGMENT;connectionBehavior=Ot.FIXED;markerEnd=_e.END_ALL_STATES;perf=th.graph.perf;perfHud=th.graph.perfHud;pointerDownAt=null;savedViewport=$T();hasCompletedInitialLayout=!1;viewportPosition=X(this.savedViewport?{x:this.savedViewport.x,y:this.savedViewport.y}:{x:0,y:0});viewportScale=X(this.savedViewport?.scale??1);canZoomIn=E(()=>this.viewportScale()<UT-1e-6);canZoomOut=E(()=>this.viewportScale()>jT+1e-6);texts=eh;middlePanOrigin=null;nodePositions=X(WT());expandedNodeIds=X(qT());panelWidth=X(XT()??ph);viewportWidth=X(typeof window>"u"?1920:window.innerWidth);clampedPanelWidth=E(()=>{let i=Math.max(du,this.viewportWidth()-m_),e=this.panelWidth();return e>i||e<du?Math.min(ph,i):e});panelResizeStart=null;loading=this.loader.loading;error=this.loader.error;visibleNodes=E(()=>this.filters.apply(this.loader.nodes()));computeLayout=u_();fullLayout=E(()=>this.computeLayout(this.loader.nodes(),this.loader.scan()));graph=E(()=>{let i=new Set(this.visibleNodes().map(e=>e.path));return h_(this.fullLayout(),i,this.nodePositions())});hasData=E(()=>this.graph().nodes.length>0);visibleCount=E(()=>this.graph().nodes.length);totalCount=E(()=>this.loader.nodes().length);edgeCount=E(()=>this.graph().edges.length);layoutComputedAt=E(()=>this.fullLayout().computedAt);selectedNodeId=X(null);selectedPath=E(()=>{let i=this.selectedNodeId();return i?this.graph().nodes.find(n=>n.id===i)?.view.path:void 0});adjacency=E(()=>{let i=new Map;for(let e of this.graph().edges)i.has(e.from)||i.set(e.from,new Set),i.has(e.to)||i.set(e.to,new Set),i.get(e.from).add(e.to),i.get(e.to).add(e.from);return i});selectionGuard=pe(()=>{let i=this.selectedNodeId();if(i===null)return;this.graph().nodes.some(n=>n.id===i)||this.selectedNodeId.set(null)});deepLinkPath=Bh(this.route.queryParamMap.pipe(_h(i=>i.get("path"))),{initialValue:this.route.snapshot.queryParamMap.get("path")});deepLinkEffect=pe(()=>{let i=this.deepLinkPath(),e=this.graph().nodes;if(e.length===0||!i)return;let n=_t(()=>this.selectedNodeId());if(n!==null&&e.find(s=>s.id===n)?.view.path===i)return;let o=e.find(r=>r.view.path===i);o&&this.selectedNodeId.set(o.id)});urlWriterEffect=pe(()=>{let i=this.selectedPath(),e=_t(()=>this.deepLinkPath());(i??null)!==(e??null)&&this.router.navigate([],{relativeTo:this.route,queryParams:{path:i??null},queryParamsHandling:"merge",replaceUrl:!0})});lastSelectionWasNonNull=!1;panelFocusEffect=pe(()=>{let i=this.selectedNodeId(),e=i!==null&&!this.lastSelectionWasNonNull;this.lastSelectionWasNonNull=i!==null,e&&queueMicrotask(()=>{this.panelCloseBtn()?.nativeElement?.querySelector("button")?.focus()})});pathsFingerprint=E(()=>this.loader.nodes().map(i=>i.path).sort().join("|"));lastPathsFingerprint=null;constructor(){pe(()=>{let i=this.visibleNodes();this.hasCompletedInitialLayout||i.length!==0&&queueMicrotask(()=>{this.hasCompletedInitialLayout=!0,this.savedViewport||this.canvas()?.fitToScreen({x:40,y:40},!1)})}),pe(()=>{let i=this.pathsFingerprint();if(!this.hasCompletedInitialLayout){this.lastPathsFingerprint=i;return}this.lastPathsFingerprint!==i&&(this.lastPathsFingerprint=i,queueMicrotask(()=>this.canvas()?.fitToScreen({x:40,y:40},!0)))}),pe(()=>{let i=new Set(this.loader.nodes().map(r=>r.path));if(i.size===0)return;let e=this.expandedNodeIds();if(e.size===0)return;let n=!1,o=new Set;for(let r of e)i.has(r)?o.add(r):n=!0;n&&(this.expandedNodeIds.set(o),mh(o))}),pe(()=>{let i=this.loader.nodes();if(i.length===0)return;let e=this.nodePositions(),n=new Set(i.map(a=>a.path)),o=!1,r=he({},e);for(let a of Object.keys(r))n.has(a)||(delete r[a],o=!0);let s=[];for(let a of n)a in r||s.push(a);if(s.length>0){let a=this.fullLayout();if(Object.keys(r).length===0)for(let l of s){let h=a.positions.get(l);h&&(r[l]={x:h.x,y:h.y})}else{let l=f_(i,a.edges,r,s);for(let h of s){let _=l.get(h);_&&(r[h]=_)}}o=!0}o&&(this.nodePositions.set(r),g_(r))})}ngOnInit(){this.loader.nodes().length===0&&!this.loader.loading()&&this.loader.load()}onLoaded(){}onCanvasChange(i){if(this.viewportPosition.set({x:i.position.x,y:i.position.y}),this.viewportScale.set(i.scale),!this.hasCompletedInitialLayout)return;let e={x:i.position.x,y:i.position.y,scale:i.scale};try{localStorage.setItem(v_,JSON.stringify(e))}catch{}}onNodePositionChange(i,e){this.dragBuffer||(this.dragBuffer=he({},this.nodePositions())),this.dragBuffer[i]={x:e.x,y:e.y},this.nodeDragInProgress=!0}zoomIn(){this.zoom()?.setZoom(this.getViewportCenter(),p_,Tt.ZOOM_IN,!0)}zoomOut(){this.zoom()?.setZoom(this.getViewportCenter(),p_,Tt.ZOOM_OUT,!0)}fitToScreen(){this.canvas()?.fitToScreen({x:40,y:40},!0)}resetLayout(){window.confirm(eh.resetLayoutConfirm)&&(this.nodePositions.set({}),this.expandedNodeIds.set(new Set),mh(new Set),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}}onCanvasMouseDown(i){if(i.button!==1)return;i.preventDefault();let e=this.canvas()?.getPosition()??{x:0,y:0};this.middlePanOrigin={mouseX:i.clientX,mouseY:i.clientY,canvasX:e.x,canvasY:e.y},document.addEventListener("mousemove",this.onMiddlePanMove),document.addEventListener("mouseup",this.onMiddlePanEnd)}middlePanRafId=null;pendingPanPosition=null;onMiddlePanMove=i=>{this.middlePanOrigin&&(this.pendingPanPosition={x:this.middlePanOrigin.canvasX+(i.clientX-this.middlePanOrigin.mouseX),y:this.middlePanOrigin.canvasY+(i.clientY-this.middlePanOrigin.mouseY)},this.middlePanRafId===null&&(this.middlePanRafId=requestAnimationFrame(()=>{this.middlePanRafId=null;let e=this.canvas();!e||!this.pendingPanPosition||(e.setPosition(this.pendingPanPosition),e.redraw())})))};onMiddlePanEnd=()=>{this.middlePanRafId!==null&&(cancelAnimationFrame(this.middlePanRafId),this.middlePanRafId=null),this.pendingPanPosition=null,this.middlePanOrigin=null,document.removeEventListener("mousemove",this.onMiddlePanMove),document.removeEventListener("mouseup",this.onMiddlePanEnd),this.canvas()?.emitCanvasChangeEvent()};ngOnDestroy(){this.onMiddlePanEnd()}onNodePointerDown(i){this.pointerDownAt={x:i.clientX,y:i.clientY},document.addEventListener("mouseup",this.onNodeMouseUp,{once:!0})}nodeDragInProgress=!1;dragBuffer=null;onNodeMouseUp=()=>{queueMicrotask(()=>{if(!this.nodeDragInProgress){this.dragBuffer=null;return}this.nodeDragInProgress=!1,this.dragBuffer&&(this.nodePositions.set(this.dragBuffer),this.dragBuffer=null),g_(this.nodePositions())})};selectNode(i,e){this.isClickWithoutDrag(e)&&this.selectedNodeId.set(i.id)}closePanel(){this.selectedNodeId.set(null)}onEscape(){this.selectedNodeId()!==null&&this.closePanel()}onWindowResize(){typeof window>"u"||this.viewportWidth.set(window.innerWidth)}onPanelResizeStart(i){i.button===0&&(i.preventDefault(),i.stopPropagation(),this.panelResizeStart={mouseX:i.clientX,widthAtStart:this.clampedPanelWidth()},document.addEventListener("mousemove",this.onPanelResizeMove),document.addEventListener("mouseup",this.onPanelResizeEnd))}onPanelResizeMove=i=>{if(!this.panelResizeStart)return;let e=i.clientX-this.panelResizeStart.mouseX,n=this.panelResizeStart.widthAtStart-e,o=Math.max(du,this.viewportWidth()-m_),r=Math.min(o,Math.max(du,n));this.panelWidth.set(r)};onPanelResizeEnd=()=>{this.panelResizeStart&&(this.panelResizeStart=null,document.removeEventListener("mousemove",this.onPanelResizeMove),document.removeEventListener("mouseup",this.onPanelResizeEnd),KT(this.panelWidth()))};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.selectedNodeId()===i}isHighlighted(i){let e=this.selectedNodeId();return e===null||e===i?!1:this.adjacency().get(e)?.has(i)??!1}isDimmed(i){let e=this.selectedNodeId();return e===null||e===i?!1:!(this.adjacency().get(e)?.has(i)??!1)}isExpanded(i){return this.expandedNodeIds().has(i)}setExpanded(i,e){let n=this.expandedNodeIds();if(n.has(i)===e)return;let o=new Set(n);e?o.add(i):o.delete(i),this.expandedNodeIds.set(o),mh(o)}onFavoriteToggle(i){this.loader.toggleFavorite(i.path,i.value)}isEdgeHighlighted(i){let e=this.selectedNodeId();return e!==null&&(i.from===e||i.to===e)}isEdgeDimmed(i){let e=this.selectedNodeId();return e===null?!1:i.from!==e&&i.to!==e}isClickWithoutDrag(i){let e=this.pointerDownAt;if(this.pointerDownAt=null,!e)return!0;let n=i.clientX-e.x,o=i.clientY-e.y;return Math.hypot(n,o)<=4}static \u0275fac=function(e){return new(e||t)};static \u0275cmp=te({type:t,selectors:[["app-graph-view"]],viewQuery:function(e,n){e&1&&St(n.canvas,Hi,5)(n.zoom,ji,5)(n.canvasWrap,kT,5)(n.panelCloseBtn,RT,5),e&2&&ut(4)},hostBindings:function(e,n){e&1&&Q("keydown.escape",function(){return n.onEscape()},Ch)("resize",function(){return n.onWindowResize()},vh)},decls:5,vars:1,consts:[["canvasWrap",""],["panelCloseBtn",""],["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"],[1,"empty-state__icon","pi","pi-spin","pi-spinner"],[1,"empty-state__title"],[1,"empty-state__icon","pi","pi-exclamation-circle",2,"color","var(--sm-severity-error)","opacity","1"],[1,"empty-state__desc"],[1,"empty-state__icon","pi","pi-filter-slash"],["data-testid","graph-canvas-wrap",1,"graph__canvas-wrap",3,"mousedown","click"],["fDraggable","",3,"fLoaded","fCache"],[3,"fAlignThreshold"],["fZoom","",3,"fCanvasChange","position","scale","fZoomStep","fZoomDblClickStep","debounceTime"],["ngProjectAs","[fConnections]",5,["","fConnections",""]],[3,"fOutputId","fInputId","fType","fBehavior","fOffset","fReassignDisabled","fSelectionDisabled","class","f-conn--highlighted","f-conn--dimmed"],["ngProjectAs","[fNodes]",5,["","fNodes",""]],["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"],["icon","pi pi-times","severity","secondary","size","small","styleClass","graph__panel-close","data-testid","graph-panel-close",3,"onClick","ariaLabel","pTooltip","text","rounded"],["mode","embedded",3,"path"],[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-refresh","severity","secondary","size","small","data-testid","graph-reset-layout",3,"onClick","ariaLabel","pTooltip","text","rounded"],[3,"fOutputId","fInputId","fType","fBehavior","fOffset","fReassignDisabled","fSelectionDisabled"],[3,"type"],["ngProjectAs","[fNodes]",5,["","fNodes",""],4,"fVirtualFor","fVirtualForOf"],["fNode","","fDragHandle","",1,"sm-gnode-host",3,"fNodePositionChange","pointerdown","click","dblclick","fNodeId","fNodePosition"],["fNodeInput","",1,"sm-gnode__connector","sm-gnode__connector--in",3,"fInputId","fInputConnectableSide"],[3,"expandedChange","favoriteToggle","node","stats","summary","selected","highlighted","dimmed","expanded","isFavorite"],["fNodeOutput","",1,"sm-gnode__connector","sm-gnode__connector--out",3,"fOutputId","fOutputConnectableSide"],["fNode","","fDragHandle","",1,"sm-gnode-host",3,"fNodeId","fNodePosition"]],template:function(e,n){e&1&&(u(0,"section",2),b(1,NT,4,1,"div",3)(2,OT,6,2,"div",4)(3,FT,6,2,"div",5)(4,HT,26,39,"div",6),f()),e&2&&(c(),w(n.loading()&&!n.hasData()?1:n.error()&&!n.hasData()?2:n.hasData()?4:3))},dependencies:[mm,fm,Hi,cm,am,ji,Ip,dm,Up,qp,lm,um,Pl,jp,hm,om,Dl,Fl,Ll,Zl,vn,yn,He,Qe],styles:["[_nghost-%COMP%]{display:block;height:100%}.graph[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:1rem;height:100%}.graph__canvas-wrap[_ngcontent-%COMP%]{position:relative;flex:1;min-height:0;border:1px solid var(--sm-border);border-radius:.75rem;background:var(--sm-bg-content);overflow:hidden;--ff-connection-drag-handle-stroke: transparent;--ff-connector-background-color: transparent;--ff-connector-border-color: transparent;--ff-connector-connected-color: transparent;--ff-connector-node-ring-color: transparent;--ff-canvas-background-color: transparent}.graph__canvas-wrap[_ngcontent-%COMP%] f-flow[_ngcontent-%COMP%]{width:100%;height:100%}.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-close[_ngcontent-%COMP%]{position:absolute;top:.5rem;right:.5rem;z-index:1}.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:999px;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__connector[_ngcontent-%COMP%]{position:absolute;pointer-events:none}.sm-gnode__connector--out[_ngcontent-%COMP%]{bottom:calc(var(--ff-connector-size) / -2);left:50%;transform:translate(-50%)}.sm-gnode__connector--in[_ngcontent-%COMP%]{top:calc(var(--ff-connector-size) / -2);left:50%;transform:translate(-50%)}.f-conn--invokes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-invokes);--ff-connection-width: 2.5px;--ff-marker-color: var(--sm-edge-invokes)}.f-conn--references[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-references);--ff-connection-width: 2px;--ff-marker-color: var(--sm-edge-references)}.f-conn--mentions[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-mentions);--ff-connection-width: 1.5px;--ff-marker-color: var(--sm-edge-mentions)}.f-conn--supersedes[_ngcontent-%COMP%]{--ff-connection-color: var(--sm-edge-supersedes);--ff-connection-width: 2px;--ff-marker-color: var(--sm-edge-supersedes)}.graph__canvas-wrap[_ngcontent-%COMP%] .f-conn--supersedes .f-connection-path{stroke-dasharray:8 4}.f-conn--highlighted[_ngcontent-%COMP%]{--ff-connection-width: 3px}.f-conn--dimmed[_ngcontent-%COMP%]{opacity:.15}"],changeDetection:0})};function $T(){let t=null;try{t=localStorage.getItem(v_)}catch{return null}if(!t)return null;let i;try{i=JSON.parse(t)}catch{return null}return ZT(i)?i:null}function WT(){let t=null;try{t=localStorage.getItem(C_)}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))YT(o)&&(e[n]={x:o.x,y:o.y});return e}function g_(t){try{localStorage.setItem(C_,JSON.stringify(t))}catch{}}function qT(){let t=null;try{t=localStorage.getItem(x_)}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 mh(t){try{localStorage.setItem(x_,JSON.stringify([...t]))}catch{}}function XT(){let t=null;try{t=localStorage.getItem(b_)}catch{return null}if(!t)return null;let i=Number(t);return!Number.isFinite(i)||i<=0?null:i}function KT(t){try{localStorage.setItem(b_,String(Math.round(t)))}catch{}}function YT(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 ZT(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}export{__ as GraphView};
|