@reqvire-org/reqvire 1.3.1 → 1.4.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/artifacts/reqvire-darwin-arm64.tar.gz +0 -0
- package/artifacts/reqvire-darwin-x86_64.tar.gz +0 -0
- package/artifacts/reqvire-linux-x86_64.tar.gz +0 -0
- package/explorer-dist/assets/brand/README.md +28 -0
- package/explorer-dist/assets/explorer-KnowledgeGraphCanvasImpl.js +1 -0
- package/explorer-dist/assets/{explorer-abnfDiagram-VCTEODGH.js → explorer-abnfDiagram-WEYOIA3C.js} +1 -1
- package/explorer-dist/assets/explorer-actionscript-3.js +1 -1
- package/explorer-dist/assets/explorer-ada.js +1 -1
- package/explorer-dist/assets/explorer-ahk.js +1 -0
- package/explorer-dist/assets/explorer-ahk2.js +1 -0
- package/explorer-dist/assets/explorer-apex.js +1 -1
- package/explorer-dist/assets/explorer-architectureDiagram-ZHVYKT53.js +36 -0
- package/explorer-dist/assets/explorer-asciidoc.js +1 -1
- package/explorer-dist/assets/explorer-bat.js +1 -1
- package/explorer-dist/assets/explorer-beancount.js +1 -1
- package/explorer-dist/assets/explorer-bird2.js +1 -1
- package/explorer-dist/assets/explorer-blockDiagram-RJAE7QA3.js +140 -0
- package/explorer-dist/assets/explorer-bsl.js +1 -1
- package/explorer-dist/assets/explorer-c3.js +1 -1
- package/explorer-dist/assets/explorer-c4Diagram-XDPPPE54.js +38 -0
- package/explorer-dist/assets/explorer-catppuccin-frappe.js +1 -1
- package/explorer-dist/assets/explorer-catppuccin-latte.js +1 -1
- package/explorer-dist/assets/explorer-catppuccin-macchiato.js +1 -1
- package/explorer-dist/assets/explorer-catppuccin-mocha.js +1 -1
- package/explorer-dist/assets/explorer-chapel.js +1 -0
- package/explorer-dist/assets/{explorer-chunk-SVP7TREG.js → explorer-chunk-2E7WHVMD.js} +4 -4
- package/explorer-dist/assets/explorer-chunk-4EMNKR2T.js +1 -0
- package/explorer-dist/assets/explorer-chunk-55XCU76K.js +1 -0
- package/explorer-dist/assets/explorer-chunk-ZCHMQSOR.js +2 -0
- package/explorer-dist/assets/explorer-clarity.js +1 -1
- package/explorer-dist/assets/explorer-classDiagram-v2-4MYWR3UA.js +217 -0
- package/explorer-dist/assets/explorer-coq.js +1 -1
- package/explorer-dist/assets/explorer-cose-bilkent-JH36ORCC.js +1 -1
- package/explorer-dist/assets/explorer-cpp.js +1 -1
- package/explorer-dist/assets/explorer-csharp.js +1 -1
- package/explorer-dist/assets/explorer-css.js +1 -1
- package/explorer-dist/assets/explorer-cynefin-EF2NZ3EQ.js +141 -0
- package/explorer-dist/assets/{explorer-cynefinDiagram-5FMLGOSQ.js → explorer-cynefinDiagram-WF24UDRP.js} +2 -2
- package/explorer-dist/assets/explorer-cytoscape.esm.js +23 -23
- package/explorer-dist/assets/explorer-dagre-NK4GIZVX.js +4 -0
- package/explorer-dist/assets/explorer-dart.js +1 -1
- package/explorer-dist/assets/{explorer-diagram-VX7I27RA.js → explorer-diagram-CBK3MWTC.js} +2 -2
- package/explorer-dist/assets/explorer-diagram-I5XIIV2D.js +24 -0
- package/explorer-dist/assets/{explorer-diagram-S7CK7UJ4.js → explorer-diagram-ODIL2UCW.js} +5 -5
- package/explorer-dist/assets/explorer-diagram-PFBEJUXE.js +3 -0
- package/explorer-dist/assets/explorer-diagram-RJA3I4VV.js +41 -0
- package/explorer-dist/assets/explorer-diagram-TYUNFSNR.js +200 -0
- package/explorer-dist/assets/explorer-dotenv.js +1 -1
- package/explorer-dist/assets/{explorer-ebnfDiagram-PWID7BFC.js → explorer-ebnfDiagram-V4P3TTPT.js} +1 -1
- package/explorer-dist/assets/explorer-elk-QONTBCTQ.js +27 -0
- package/explorer-dist/assets/explorer-emacs-lisp.js +1 -1
- package/explorer-dist/assets/explorer-erDiagram-KYQIGQAA.js +99 -0
- package/explorer-dist/assets/explorer-flowDiagram-IUGLLWBU.js +213 -0
- package/explorer-dist/assets/explorer-ganttDiagram-R7GPNTJY.js +292 -0
- package/explorer-dist/assets/explorer-gdscript.js +1 -1
- package/explorer-dist/assets/{explorer-gitGraphDiagram-WWUBYQGX.js → explorer-gitGraphDiagram-PDYL7XHY.js} +5 -5
- package/explorer-dist/assets/explorer-gn.js +1 -1
- package/explorer-dist/assets/explorer-graph.js +1 -0
- package/explorer-dist/assets/explorer-hack.js +1 -1
- package/explorer-dist/assets/explorer-handlebars.js +1 -1
- package/explorer-dist/assets/explorer-haxe.js +1 -1
- package/explorer-dist/assets/explorer-hxml.js +1 -1
- package/explorer-dist/assets/explorer-index.js +312 -0
- package/explorer-dist/assets/explorer-infoDiagram-MVDRKAX5.js +2 -0
- package/explorer-dist/assets/{explorer-ishikawaDiagram-5VMMS53U.js → explorer-ishikawaDiagram-HPEHV2GE.js} +4 -4
- package/explorer-dist/assets/{explorer-journeyDiagram-3NMN7TZE.js → explorer-journeyDiagram-BOSHW7O7.js} +1 -1
- package/explorer-dist/assets/explorer-julia.js +1 -1
- package/explorer-dist/assets/explorer-just.js +1 -1
- package/explorer-dist/assets/explorer-kanagawa-dragon.js +1 -1
- package/explorer-dist/assets/explorer-kanagawa-lotus.js +1 -1
- package/explorer-dist/assets/explorer-kanagawa-wave.js +1 -1
- package/explorer-dist/assets/{explorer-kanban-definition-UXKFOSKX.js → explorer-kanban-definition-FNSA4HC5.js} +7 -7
- package/explorer-dist/assets/explorer-katex.js +18 -18
- package/explorer-dist/assets/explorer-latex.js +1 -1
- package/explorer-dist/assets/explorer-linear.js +1 -1
- package/explorer-dist/assets/explorer-llvm.js +1 -1
- package/explorer-dist/assets/explorer-luau.js +1 -1
- package/explorer-dist/assets/explorer-marko.js +1 -1
- package/explorer-dist/assets/explorer-mdc.js +1 -1
- package/explorer-dist/assets/explorer-mermaid.core.js +150 -148
- package/explorer-dist/assets/explorer-mermaid.js +1 -1
- package/explorer-dist/assets/explorer-mindmap-definition-6OY57UG3.js +98 -0
- package/explorer-dist/assets/explorer-mojo.js +1 -1
- package/explorer-dist/assets/explorer-monokai.js +1 -1
- package/explorer-dist/assets/explorer-moonbit.js +1 -1
- package/explorer-dist/assets/explorer-move.js +1 -1
- package/explorer-dist/assets/explorer-nextflow-groovy.js +1 -1
- package/explorer-dist/assets/explorer-nextflow.js +1 -1
- package/explorer-dist/assets/explorer-nsis.js +1 -0
- package/explorer-dist/assets/explorer-nushell.js +1 -1
- package/explorer-dist/assets/explorer-one-dark-pro.js +1 -1
- package/explorer-dist/assets/explorer-ontologyGraphRendererImpl.js +616 -0
- package/explorer-dist/assets/explorer-org.js +1 -0
- package/explorer-dist/assets/{explorer-pegDiagram-XKGWAZYB.js → explorer-pegDiagram-ECIUJNBX.js} +1 -1
- package/explorer-dist/assets/explorer-php.js +1 -1
- package/explorer-dist/assets/explorer-pieDiagram-GNMPY74T.js +39 -0
- package/explorer-dist/assets/explorer-powershell.js +1 -1
- package/explorer-dist/assets/explorer-prisma.js +1 -1
- package/explorer-dist/assets/{explorer-quadrantDiagram-AXDQQJYC.js → explorer-quadrantDiagram-D57K4MC3.js} +1 -1
- package/explorer-dist/assets/explorer-r.js +1 -1
- package/explorer-dist/assets/{explorer-railroadDiagram-O6MQD6OU.js → explorer-railroadDiagram-Y72NRBL7.js} +1 -1
- package/explorer-dist/assets/explorer-rbs.js +1 -0
- package/explorer-dist/assets/explorer-red.js +1 -1
- package/explorer-dist/assets/explorer-requirementDiagram-EQYSW5RA.js +84 -0
- package/explorer-dist/assets/explorer-rose-pine-dawn.js +1 -1
- package/explorer-dist/assets/explorer-rose-pine-moon.js +1 -1
- package/explorer-dist/assets/explorer-rose-pine.js +1 -1
- package/explorer-dist/assets/explorer-rst.js +1 -1
- package/explorer-dist/assets/explorer-ruby.js +1 -1
- package/explorer-dist/assets/explorer-rust.js +1 -1
- package/explorer-dist/assets/{explorer-sankeyDiagram-P5KCCOFB.js → explorer-sankeyDiagram-SY24JHO5.js} +4 -4
- package/explorer-dist/assets/explorer-scala.js +1 -1
- package/explorer-dist/assets/explorer-sequenceDiagram-BLEHNHQU.js +169 -0
- package/explorer-dist/assets/explorer-smalltalk.js +1 -1
- package/explorer-dist/assets/explorer-smithy.js +1 -0
- package/explorer-dist/assets/explorer-solarized-dark.js +1 -1
- package/explorer-dist/assets/explorer-solarized-light.js +1 -1
- package/explorer-dist/assets/explorer-solidity.js +1 -1
- package/explorer-dist/assets/explorer-sql.js +1 -1
- package/explorer-dist/assets/explorer-stateDiagram-v2-A6IESKWZ.js +291 -0
- package/explorer-dist/assets/explorer-surrealql.js +1 -1
- package/explorer-dist/assets/explorer-svelte.js +1 -1
- package/explorer-dist/assets/explorer-swift.js +1 -1
- package/explorer-dist/assets/explorer-swimlanes-B3ENRKFQ.js +1 -0
- package/explorer-dist/assets/explorer-swimlanesDiagram-AYQRV4AK.js +8 -0
- package/explorer-dist/assets/explorer-system-verilog.js +1 -1
- package/explorer-dist/assets/explorer-timeline-definition-JXYKGLGB.js +120 -0
- package/explorer-dist/assets/explorer-twig.js +1 -1
- package/explorer-dist/assets/explorer-typespec.js +1 -1
- package/explorer-dist/assets/explorer-typst.js +1 -1
- package/explorer-dist/assets/explorer-usecaseDiagram-WPOLBNNX.js +370 -0
- package/explorer-dist/assets/explorer-v.js +1 -1
- package/explorer-dist/assets/explorer-vb.js +1 -1
- package/explorer-dist/assets/explorer-vennDiagram-Q3Y3IDCW.js +34 -0
- package/explorer-dist/assets/explorer-verilog.js +1 -1
- package/explorer-dist/assets/explorer-vue.js +1 -1
- package/explorer-dist/assets/{explorer-wardleyDiagram-VM6X3IG4.js → explorer-wardleyDiagram-IVAIDKWA.js} +3 -3
- package/explorer-dist/assets/explorer-xychartDiagram-4URNHDU4.js +7 -0
- package/explorer-dist/assets/explorer.css +1 -1
- package/explorer-dist/assets/explorer.js +40 -1152
- package/explorer-dist/assets/fonts/.gitkeep +0 -0
- package/package.json +1 -1
- package/explorer-dist/assets/explorer-architectureDiagram-5GKGNRK7.js +0 -36
- package/explorer-dist/assets/explorer-blockDiagram-I7D4REHJ.js +0 -129
- package/explorer-dist/assets/explorer-c4Diagram-7LVT6UL2.js +0 -38
- package/explorer-dist/assets/explorer-chunk-F27PBJKO.js +0 -1
- package/explorer-dist/assets/explorer-chunk-IMKFNOWR.js +0 -231
- package/explorer-dist/assets/explorer-chunk-TICWLB2K.js +0 -206
- package/explorer-dist/assets/explorer-classDiagram-ZZMXUADV.js +0 -1
- package/explorer-dist/assets/explorer-classDiagram-v2-VYDZK3BY.js +0 -1
- package/explorer-dist/assets/explorer-cynefin-OW5HDTMX.js +0 -178
- package/explorer-dist/assets/explorer-dagre-GXQ25YYZ.js +0 -4
- package/explorer-dist/assets/explorer-diagram-UQ7AKVKN.js +0 -41
- package/explorer-dist/assets/explorer-diagram-VSXAHHWV.js +0 -3
- package/explorer-dist/assets/explorer-diagram-Z3DM3KII.js +0 -24
- package/explorer-dist/assets/explorer-erDiagram-RLTQ6QDP.js +0 -99
- package/explorer-dist/assets/explorer-flowDiagram-HODETNUW.js +0 -168
- package/explorer-dist/assets/explorer-ganttDiagram-EL5Y4UJY.js +0 -292
- package/explorer-dist/assets/explorer-infoDiagram-27XIBGKW.js +0 -2
- package/explorer-dist/assets/explorer-layout.js +0 -1
- package/explorer-dist/assets/explorer-mindmap-definition-YA3MSWOX.js +0 -96
- package/explorer-dist/assets/explorer-pieDiagram-E7YTZNPT.js +0 -39
- package/explorer-dist/assets/explorer-requirementDiagram-BXWQKSXE.js +0 -84
- package/explorer-dist/assets/explorer-sequenceDiagram-WJ2MYXX4.js +0 -162
- package/explorer-dist/assets/explorer-stateDiagram-D77RDMKH.js +0 -1
- package/explorer-dist/assets/explorer-stateDiagram-v2-MP3YSRHH.js +0 -1
- package/explorer-dist/assets/explorer-swimlanes-42K2YHIH.js +0 -1
- package/explorer-dist/assets/explorer-swimlanesDiagram-VR7AAH4N.js +0 -8
- package/explorer-dist/assets/explorer-timeline-definition-24CTP7MA.js +0 -120
- package/explorer-dist/assets/explorer-vennDiagram-4TSXK5OY.js +0 -34
- package/explorer-dist/assets/explorer-xychartDiagram-S5SC5T6Z.js +0 -7
- /package/explorer-dist/assets/{explorer-chunk-POPQ4Y6H.js → explorer-chunk-VQ5W62QI.js} +0 -0
|
@@ -0,0 +1,616 @@
|
|
|
1
|
+
var qn=Object.defineProperty;var Wn=(n,o,s)=>o in n?qn(n,o,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[o]=s;var ur=(n,o,s)=>Wn(n,typeof o!="symbol"?o+"":o,s);import{f as St,E as mr,D as br,e as Xn,N as Yn,G as pt,S as Kn,n as Qn,a as Zn}from"./explorer-index.js";import{c as F,F as Jn,E as fr}from"./explorer.js";function Dn(n,o){if(typeof n!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var a=s.call(n,o);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(n)}function _r(n){var o=Dn(n,"string");return typeof o=="symbol"?o:o+""}function xr(n,o,s){return(o=_r(o))in n?Object.defineProperty(n,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[o]=s,n}function dr(n,o){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);o&&(a=a.filter(function(h){return Object.getOwnPropertyDescriptor(n,h).enumerable})),s.push.apply(s,a)}return s}function je(n){for(var o=1;o<arguments.length;o++){var s=arguments[o]!=null?arguments[o]:{};o%2?dr(Object(s),!0).forEach(function(a){xr(n,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):dr(Object(s)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))})}return n}function eo(n,o){if(!(n instanceof o))throw new TypeError("Cannot call a class as a function")}function to(n,o){for(var s=0;s<o.length;s++){var a=o[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,_r(a.key),a)}}function ro(n,o,s){return o&&to(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function tt(n){return tt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},tt(n)}function wr(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(wr=function(){return!!n})()}function Tr(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function no(n,o){if(o&&(typeof o=="object"||typeof o=="function"))return o;if(o!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Tr(n)}function oo(n,o,s){return o=tt(o),no(n,wr()?Reflect.construct(o,s||[],tt(n).constructor):o.apply(n,s))}function vt(n,o){return vt=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},vt(n,o)}function io(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(o&&o.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),o&&vt(n,o)}function yt(n,o){(o==null||o>n.length)&&(o=n.length);for(var s=0,a=Array(o);s<o;s++)a[s]=n[s];return a}function so(n){if(Array.isArray(n))return yt(n)}function ao(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function co(n,o){if(n){if(typeof n=="string")return yt(n,o);var s={}.toString.call(n).slice(8,-1);return s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set"?Array.from(n):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?yt(n,o):void 0}}function lo(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ht(n){return so(n)||ao(n)||co(n)||lo()}function Sr(n,o,s,a){var h=Math.pow(1-n,2)*o.x+2*(1-n)*n*s.x+Math.pow(n,2)*a.x,m=Math.pow(1-n,2)*o.y+2*(1-n)*n*s.y+Math.pow(n,2)*a.y;return{x:h,y:m}}function uo(n,o,s){for(var a=20,h=0,m=n,w=0;w<a;w++){var T=Sr((w+1)/a,n,o,s);h+=Math.sqrt(Math.pow(m.x-T.x,2)+Math.pow(m.y-T.y,2)),m=T}return h}function Er(n){var o=n.curvatureAttribute,s=n.defaultCurvature,a=n.keepLabelUpright,h=a===void 0?!0:a;return function(m,w,T,O,S){var y=S.edgeLabelSize,I=w[o]||s,M=S.edgeLabelFont,P=S.edgeLabelWeight,$=S.edgeLabelColor.attribute?w[S.edgeLabelColor.attribute]||S.edgeLabelColor.color||"#000":S.edgeLabelColor.color,C=w.label;if(C){m.fillStyle=$,m.font="".concat(P," ").concat(y,"px ").concat(M);var j=!h||T.x<O.x,b=j?T.x:O.x,_=j?T.y:O.y,v=j?O.x:T.x,R=j?O.y:T.y,U=(b+v)/2,G=(_+R)/2,z=v-b,X=R-_,q=Math.sqrt(Math.pow(z,2)+Math.pow(X,2)),V=j?1:-1,J=U+X*I*V,Y=G-z*I*V,le=w.size*.7+5,oe={x:Y-_,y:-(J-b)},ie=Math.sqrt(Math.pow(oe.x,2)+Math.pow(oe.y,2)),f={x:R-Y,y:-(v-J)},u=Math.sqrt(Math.pow(f.x,2)+Math.pow(f.y,2));b+=le*oe.x/ie,_+=le*oe.y/ie,v+=le*f.x/u,R+=le*f.y/u,J+=le*X/q,Y-=le*z/q;var g={x:J,y:Y},A={x:b,y:_},d={x:v,y:R},k=uo(A,g,d);if(!(k<T.size+O.size)){var B=m.measureText(C).width,D=k-T.size-O.size;if(B>D){var te="…";for(C=C+te,B=m.measureText(C).width;B>D&&C.length>1;)C=C.slice(0,-2)+te,B=m.measureText(C).width;if(C.length<4)return}for(var ue={},ge=0,ve=C.length;ge<ve;ge++){var pe=C[ge];ue[pe]||(ue[pe]=m.measureText(pe).width*(1+I*.35))}for(var Te=.5-B/k/2,Ae=0,Fe=C.length;Ae<Fe;Ae++){var ke=C[Ae],Se=Sr(Te,A,g,d),nt=2*(1-Te)*(J-b)+2*Te*(v-J),ot=2*(1-Te)*(Y-_)+2*Te*(R-Y),Le=Math.atan2(ot,nt);m.save(),m.translate(Se.x,Se.y),m.rotate(Le),m.fillText(ke,0,0),m.restore(),Te+=ue[ke]/k}}}}}function fo(n){var o=n.arrowHead,s=(o==null?void 0:o.extremity)==="target"||(o==null?void 0:o.extremity)==="both",a=(o==null?void 0:o.extremity)==="source"||(o==null?void 0:o.extremity)==="both",h=`
|
|
3
|
+
precision highp float;
|
|
4
|
+
|
|
5
|
+
varying vec4 v_color;
|
|
6
|
+
varying float v_thickness;
|
|
7
|
+
varying float v_feather;
|
|
8
|
+
varying vec2 v_cpA;
|
|
9
|
+
varying vec2 v_cpB;
|
|
10
|
+
varying vec2 v_cpC;
|
|
11
|
+
`.concat(s?`
|
|
12
|
+
varying float v_targetSize;
|
|
13
|
+
varying vec2 v_targetPoint;`:"",`
|
|
14
|
+
`).concat(a?`
|
|
15
|
+
varying float v_sourceSize;
|
|
16
|
+
varying vec2 v_sourcePoint;`:"",`
|
|
17
|
+
`).concat(o?`
|
|
18
|
+
uniform float u_lengthToThicknessRatio;
|
|
19
|
+
uniform float u_widenessToThicknessRatio;`:"",`
|
|
20
|
+
|
|
21
|
+
float det(vec2 a, vec2 b) {
|
|
22
|
+
return a.x * b.y - b.x * a.y;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
vec2 getDistanceVector(vec2 b0, vec2 b1, vec2 b2) {
|
|
26
|
+
float a = det(b0, b2), b = 2.0 * det(b1, b0), d = 2.0 * det(b2, b1);
|
|
27
|
+
float f = b * d - a * a;
|
|
28
|
+
vec2 d21 = b2 - b1, d10 = b1 - b0, d20 = b2 - b0;
|
|
29
|
+
vec2 gf = 2.0 * (b * d21 + d * d10 + a * d20);
|
|
30
|
+
gf = vec2(gf.y, -gf.x);
|
|
31
|
+
vec2 pp = -f * gf / dot(gf, gf);
|
|
32
|
+
vec2 d0p = b0 - pp;
|
|
33
|
+
float ap = det(d0p, d20), bp = 2.0 * det(d10, d0p);
|
|
34
|
+
float t = clamp((ap + bp) / (2.0 * a + b + d), 0.0, 1.0);
|
|
35
|
+
return mix(mix(b0, b1, t), mix(b1, b2, t), t);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
float distToQuadraticBezierCurve(vec2 p, vec2 b0, vec2 b1, vec2 b2) {
|
|
39
|
+
return length(getDistanceVector(b0 - p, b1 - p, b2 - p));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
43
|
+
|
|
44
|
+
void main(void) {
|
|
45
|
+
float dist = distToQuadraticBezierCurve(gl_FragCoord.xy, v_cpA, v_cpB, v_cpC);
|
|
46
|
+
float thickness = v_thickness;
|
|
47
|
+
`).concat(s?`
|
|
48
|
+
float distToTarget = length(gl_FragCoord.xy - v_targetPoint);
|
|
49
|
+
float targetArrowLength = v_targetSize + thickness * u_lengthToThicknessRatio;
|
|
50
|
+
if (distToTarget < targetArrowLength) {
|
|
51
|
+
thickness = (distToTarget - v_targetSize) / (targetArrowLength - v_targetSize) * u_widenessToThicknessRatio * thickness;
|
|
52
|
+
}`:"",`
|
|
53
|
+
`).concat(a?`
|
|
54
|
+
float distToSource = length(gl_FragCoord.xy - v_sourcePoint);
|
|
55
|
+
float sourceArrowLength = v_sourceSize + thickness * u_lengthToThicknessRatio;
|
|
56
|
+
if (distToSource < sourceArrowLength) {
|
|
57
|
+
thickness = (distToSource - v_sourceSize) / (sourceArrowLength - v_sourceSize) * u_widenessToThicknessRatio * thickness;
|
|
58
|
+
}`:"",`
|
|
59
|
+
|
|
60
|
+
float halfThickness = thickness / 2.0;
|
|
61
|
+
if (dist < halfThickness) {
|
|
62
|
+
#ifdef PICKING_MODE
|
|
63
|
+
gl_FragColor = v_color;
|
|
64
|
+
#else
|
|
65
|
+
float t = smoothstep(
|
|
66
|
+
halfThickness - v_feather,
|
|
67
|
+
halfThickness,
|
|
68
|
+
dist
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
gl_FragColor = mix(v_color, transparent, t);
|
|
72
|
+
#endif
|
|
73
|
+
} else {
|
|
74
|
+
gl_FragColor = transparent;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
`);return h}function go(n){var o=n.arrowHead,s=(o==null?void 0:o.extremity)==="target"||(o==null?void 0:o.extremity)==="both",a=(o==null?void 0:o.extremity)==="source"||(o==null?void 0:o.extremity)==="both",h=`
|
|
78
|
+
attribute vec4 a_id;
|
|
79
|
+
attribute vec4 a_color;
|
|
80
|
+
attribute float a_direction;
|
|
81
|
+
attribute float a_thickness;
|
|
82
|
+
attribute vec2 a_source;
|
|
83
|
+
attribute vec2 a_target;
|
|
84
|
+
attribute float a_current;
|
|
85
|
+
attribute float a_curvature;
|
|
86
|
+
`.concat(s?`attribute float a_targetSize;
|
|
87
|
+
`:"",`
|
|
88
|
+
`).concat(a?`attribute float a_sourceSize;
|
|
89
|
+
`:"",`
|
|
90
|
+
|
|
91
|
+
uniform mat3 u_matrix;
|
|
92
|
+
uniform float u_sizeRatio;
|
|
93
|
+
uniform float u_pixelRatio;
|
|
94
|
+
uniform vec2 u_dimensions;
|
|
95
|
+
uniform float u_minEdgeThickness;
|
|
96
|
+
uniform float u_feather;
|
|
97
|
+
|
|
98
|
+
varying vec4 v_color;
|
|
99
|
+
varying float v_thickness;
|
|
100
|
+
varying float v_feather;
|
|
101
|
+
varying vec2 v_cpA;
|
|
102
|
+
varying vec2 v_cpB;
|
|
103
|
+
varying vec2 v_cpC;
|
|
104
|
+
`).concat(s?`
|
|
105
|
+
varying float v_targetSize;
|
|
106
|
+
varying vec2 v_targetPoint;`:"",`
|
|
107
|
+
`).concat(a?`
|
|
108
|
+
varying float v_sourceSize;
|
|
109
|
+
varying vec2 v_sourcePoint;`:"",`
|
|
110
|
+
`).concat(o?`
|
|
111
|
+
uniform float u_widenessToThicknessRatio;`:"",`
|
|
112
|
+
|
|
113
|
+
const float bias = 255.0 / 254.0;
|
|
114
|
+
const float epsilon = 0.7;
|
|
115
|
+
|
|
116
|
+
vec2 clipspaceToViewport(vec2 pos, vec2 dimensions) {
|
|
117
|
+
return vec2(
|
|
118
|
+
(pos.x + 1.0) * dimensions.x / 2.0,
|
|
119
|
+
(pos.y + 1.0) * dimensions.y / 2.0
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
vec2 viewportToClipspace(vec2 pos, vec2 dimensions) {
|
|
124
|
+
return vec2(
|
|
125
|
+
pos.x / dimensions.x * 2.0 - 1.0,
|
|
126
|
+
pos.y / dimensions.y * 2.0 - 1.0
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
void main() {
|
|
131
|
+
float minThickness = u_minEdgeThickness;
|
|
132
|
+
|
|
133
|
+
// Selecting the correct position
|
|
134
|
+
// Branchless "position = a_source if a_current == 1.0 else a_target"
|
|
135
|
+
vec2 position = a_source * max(0.0, a_current) + a_target * max(0.0, 1.0 - a_current);
|
|
136
|
+
position = (u_matrix * vec3(position, 1)).xy;
|
|
137
|
+
|
|
138
|
+
vec2 source = (u_matrix * vec3(a_source, 1)).xy;
|
|
139
|
+
vec2 target = (u_matrix * vec3(a_target, 1)).xy;
|
|
140
|
+
|
|
141
|
+
vec2 viewportPosition = clipspaceToViewport(position, u_dimensions);
|
|
142
|
+
vec2 viewportSource = clipspaceToViewport(source, u_dimensions);
|
|
143
|
+
vec2 viewportTarget = clipspaceToViewport(target, u_dimensions);
|
|
144
|
+
|
|
145
|
+
vec2 delta = viewportTarget.xy - viewportSource.xy;
|
|
146
|
+
float len = length(delta);
|
|
147
|
+
vec2 normal = vec2(-delta.y, delta.x) * a_direction;
|
|
148
|
+
vec2 unitNormal = normal / len;
|
|
149
|
+
float boundingBoxThickness = len * a_curvature;
|
|
150
|
+
|
|
151
|
+
float curveThickness = max(minThickness, a_thickness / u_sizeRatio);
|
|
152
|
+
v_thickness = curveThickness * u_pixelRatio;
|
|
153
|
+
v_feather = u_feather;
|
|
154
|
+
|
|
155
|
+
v_cpA = viewportSource;
|
|
156
|
+
v_cpB = 0.5 * (viewportSource + viewportTarget) + unitNormal * a_direction * boundingBoxThickness;
|
|
157
|
+
v_cpC = viewportTarget;
|
|
158
|
+
|
|
159
|
+
vec2 viewportOffsetPosition = (
|
|
160
|
+
viewportPosition +
|
|
161
|
+
unitNormal * (boundingBoxThickness / 2.0 + sign(boundingBoxThickness) * (`).concat(o?"curveThickness * u_widenessToThicknessRatio":"curveThickness",` + epsilon)) *
|
|
162
|
+
max(0.0, a_direction) // NOTE: cutting the bounding box in half to avoid overdraw
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
position = viewportToClipspace(viewportOffsetPosition, u_dimensions);
|
|
166
|
+
gl_Position = vec4(position, 0, 1);
|
|
167
|
+
|
|
168
|
+
`).concat(s?`
|
|
169
|
+
v_targetSize = a_targetSize * u_pixelRatio / u_sizeRatio;
|
|
170
|
+
v_targetPoint = viewportTarget;
|
|
171
|
+
`:"",`
|
|
172
|
+
`).concat(a?`
|
|
173
|
+
v_sourceSize = a_sourceSize * u_pixelRatio / u_sizeRatio;
|
|
174
|
+
v_sourcePoint = viewportSource;
|
|
175
|
+
`:"",`
|
|
176
|
+
|
|
177
|
+
#ifdef PICKING_MODE
|
|
178
|
+
// For picking mode, we use the ID as the color:
|
|
179
|
+
v_color = a_id;
|
|
180
|
+
#else
|
|
181
|
+
// For normal mode, we use the color:
|
|
182
|
+
v_color = a_color;
|
|
183
|
+
#endif
|
|
184
|
+
|
|
185
|
+
v_color.a *= bias;
|
|
186
|
+
}
|
|
187
|
+
`);return h}var kr=.25,po={arrowHead:null,curvatureAttribute:"curvature",defaultCurvature:kr},ho={edgeIndexAttribute:"parallelIndex",edgeMinIndexAttribute:"parallelMinIndex",edgeMaxIndexAttribute:"parallelMaxIndex"};function vo(n,o){var s=je(je({},ho),{}),a={},h={},m={},w=0;n.forEachNode(function(G){a[G]=++w+""}),n.forEachEdge(function(G,z,X,q){var V=a[X],J=a[q],Y=[V,J].join("-");h[G]=Y,m[Y]=[V,J].sort().join("-")});var T={},O={};n.forEachEdge(function(G){var z=h[G],X=m[z];T[z]=T[z]||[],T[z].push(G),O[X]=O[X]||[],O[X].push(G)});for(var S in T){var y=T[S],I=y.length,M=O[m[S]].length;if(I===1&&M===1){var P=y[0];n.setEdgeAttribute(P,s.edgeIndexAttribute,null),n.setEdgeAttribute(P,s.edgeMaxIndexAttribute,null)}else if(I===1){var $=y[0];n.setEdgeAttribute($,s.edgeIndexAttribute,1),n.setEdgeAttribute($,s.edgeMaxIndexAttribute,1)}else if(I===M)for(var C=(I-1)/2,j=-C,b=0;b<I;b++){var _=y[b],v=-(I-1)/2+b;n.setEdgeAttribute(_,s.edgeIndexAttribute,v),n.setEdgeAttribute(_,s.edgeMinIndexAttribute,j),n.setEdgeAttribute(_,s.edgeMaxIndexAttribute,C)}else for(var R=0;R<I;R++){var U=y[R];n.setEdgeAttribute(U,s.edgeIndexAttribute,R+1),n.setEdgeAttribute(U,s.edgeMaxIndexAttribute,I)}}}var Rr=WebGLRenderingContext,gr=Rr.UNSIGNED_BYTE,Ce=Rr.FLOAT;function He(n){var o=je(je({},po),n||{}),s=o,a=s.arrowHead,h=s.curvatureAttribute,m=s.drawLabel,w=(a==null?void 0:a.extremity)==="target"||(a==null?void 0:a.extremity)==="both",T=(a==null?void 0:a.extremity)==="source"||(a==null?void 0:a.extremity)==="both",O=["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness"].concat(ht(a?["u_lengthToThicknessRatio","u_widenessToThicknessRatio"]:[]));return(function(S){io(y,S);function y(){var I;eo(this,y);for(var M=arguments.length,P=new Array(M),$=0;$<M;$++)P[$]=arguments[$];return I=oo(this,y,[].concat(P)),xr(Tr(I),"drawLabel",m||Er(o)),I}return ro(y,[{key:"getDefinition",value:function(){return{VERTICES:6,VERTEX_SHADER_SOURCE:go(o),FRAGMENT_SHADER_SOURCE:fo(o),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:O,ATTRIBUTES:[{name:"a_source",size:2,type:Ce},{name:"a_target",size:2,type:Ce}].concat(ht(w?[{name:"a_targetSize",size:1,type:Ce}]:[]),ht(T?[{name:"a_sourceSize",size:1,type:Ce}]:[]),[{name:"a_thickness",size:1,type:Ce},{name:"a_curvature",size:1,type:Ce},{name:"a_color",size:4,type:gr,normalized:!0},{name:"a_id",size:4,type:gr,normalized:!0}]),CONSTANT_ATTRIBUTES:[{name:"a_current",size:1,type:Ce},{name:"a_direction",size:1,type:Ce}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[0,-1],[1,1],[1,-1]]}}},{key:"processVisibleItem",value:function(M,P,$,C,j){var b,_=j.size||1,v=$.x,R=$.y,U=C.x,G=C.y,z=St(j.color),X=(b=j[h])!==null&&b!==void 0?b:kr,q=this.array;q[P++]=v,q[P++]=R,q[P++]=U,q[P++]=G,w&&(q[P++]=C.size),T&&(q[P++]=$.size),q[P++]=_,q[P++]=X,q[P++]=z,q[P++]=M}},{key:"setUniforms",value:function(M,P){var $=P.gl,C=P.uniformLocations,j=C.u_matrix,b=C.u_pixelRatio,_=C.u_feather,v=C.u_sizeRatio,R=C.u_dimensions,U=C.u_minEdgeThickness;if($.uniformMatrix3fv(j,!1,M.matrix),$.uniform1f(b,M.pixelRatio),$.uniform1f(v,M.sizeRatio),$.uniform1f(_,M.antiAliasingFeather),$.uniform2f(R,M.width*M.pixelRatio,M.height*M.pixelRatio),$.uniform1f(U,M.minEdgeThickness),a){var G=C.u_lengthToThicknessRatio,z=C.u_widenessToThicknessRatio;$.uniform1f(G,a.lengthToThicknessRatio),$.uniform1f(z,a.widenessToThicknessRatio)}}}]),y})(mr)}He();He({arrowHead:br});He({arrowHead:je(je({},br),{},{extremity:"both"})});function mt(n,o){(o==null||o>n.length)&&(o=n.length);for(var s=0,a=Array(o);s<o;s++)a[s]=n[s];return a}function yo(n){if(Array.isArray(n))return mt(n)}function mo(n){if(typeof Symbol<"u"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function bo(n,o){if(n){if(typeof n=="string")return mt(n,o);var s={}.toString.call(n).slice(8,-1);return s==="Object"&&n.constructor&&(s=n.constructor.name),s==="Map"||s==="Set"?Array.from(n):s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s)?mt(n,o):void 0}}function _o(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
188
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Et(n){return yo(n)||mo(n)||bo(n)||_o()}function kt(n,o){if(!(n instanceof o))throw new TypeError("Cannot call a class as a function")}function xo(n,o){if(typeof n!="object"||!n)return n;var s=n[Symbol.toPrimitive];if(s!==void 0){var a=s.call(n,o);if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(o==="string"?String:Number)(n)}function Or(n){var o=xo(n,"string");return typeof o=="symbol"?o:o+""}function wo(n,o){for(var s=0;s<o.length;s++){var a=o[s];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(n,Or(a.key),a)}}function Rt(n,o,s){return o&&wo(n.prototype,o),Object.defineProperty(n,"prototype",{writable:!1}),n}function Me(n){return Me=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(o){return o.__proto__||Object.getPrototypeOf(o)},Me(n)}function Cr(){try{var n=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Cr=function(){return!!n})()}function xe(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function To(n,o){if(o&&(typeof o=="object"||typeof o=="function"))return o;if(o!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xe(n)}function Ar(n,o,s){return o=Me(o),To(n,Cr()?Reflect.construct(o,s||[],Me(n).constructor):o.apply(n,s))}function So(n,o){for(;!{}.hasOwnProperty.call(n,o)&&(n=Me(n))!==null;);return n}function bt(){return bt=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(n,o,s){var a=So(n,o);if(a){var h=Object.getOwnPropertyDescriptor(a,o);return h.get?h.get.call(arguments.length<3?n:s):h.value}},bt.apply(null,arguments)}function pr(n,o,s,a){var h=bt(Me(n.prototype),o,s);return typeof h=="function"?function(m){return h.apply(s,m)}:h}function _t(n,o){return _t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(s,a){return s.__proto__=a,s},_t(n,o)}function Nr(n,o){if(typeof o!="function"&&o!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(o&&o.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),o&&_t(n,o)}function ce(n,o,s){return(o=Or(o))in n?Object.defineProperty(n,o,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[o]=s,n}function Eo(n,o){if(n==null)return{};var s={};for(var a in n)if({}.hasOwnProperty.call(n,a)){if(o.includes(a))continue;s[a]=n[a]}return s}function ko(n,o){if(n==null)return{};var s,a,h=Eo(n,o);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(n);for(a=0;a<m.length;a++)s=m[a],o.includes(s)||{}.propertyIsEnumerable.call(n,s)&&(h[s]=n[s])}return h}function hr(n,o){var s=Object.keys(n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(n);o&&(a=a.filter(function(h){return Object.getOwnPropertyDescriptor(n,h).enumerable})),s.push.apply(s,a)}return s}function me(n){for(var o=1;o<arguments.length;o++){var s=arguments[o]!=null?arguments[o]:{};o%2?hr(Object(s),!0).forEach(function(a){ce(n,a,s[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(s)):hr(Object(s)).forEach(function(a){Object.defineProperty(n,a,Object.getOwnPropertyDescriptor(s,a))})}return n}function Ro(n){var o=n.texturesCount,s=`
|
|
189
|
+
precision highp float;
|
|
190
|
+
|
|
191
|
+
varying vec4 v_color;
|
|
192
|
+
varying vec2 v_diffVector;
|
|
193
|
+
varying float v_radius;
|
|
194
|
+
varying vec4 v_texture;
|
|
195
|
+
varying float v_textureIndex;
|
|
196
|
+
|
|
197
|
+
uniform sampler2D u_atlas[`.concat(o,`];
|
|
198
|
+
uniform float u_correctionRatio;
|
|
199
|
+
uniform float u_cameraAngle;
|
|
200
|
+
uniform float u_percentagePadding;
|
|
201
|
+
uniform bool u_colorizeImages;
|
|
202
|
+
uniform bool u_keepWithinCircle;
|
|
203
|
+
|
|
204
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
205
|
+
|
|
206
|
+
const float radius = 0.5;
|
|
207
|
+
|
|
208
|
+
void main(void) {
|
|
209
|
+
float border = 2.0 * u_correctionRatio;
|
|
210
|
+
float dist = length(v_diffVector);
|
|
211
|
+
vec4 color = gl_FragColor;
|
|
212
|
+
|
|
213
|
+
float c = cos(-u_cameraAngle);
|
|
214
|
+
float s = sin(-u_cameraAngle);
|
|
215
|
+
vec2 diffVector = mat2(c, s, -s, c) * (v_diffVector);
|
|
216
|
+
|
|
217
|
+
// No antialiasing for picking mode:
|
|
218
|
+
#ifdef PICKING_MODE
|
|
219
|
+
border = 0.0;
|
|
220
|
+
color = v_color;
|
|
221
|
+
|
|
222
|
+
#else
|
|
223
|
+
// First case: No image to display
|
|
224
|
+
if (v_texture.w <= 0.0) {
|
|
225
|
+
if (!u_colorizeImages) {
|
|
226
|
+
color = v_color;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Second case: Image loaded into the texture
|
|
231
|
+
else {
|
|
232
|
+
float paddingRatio = 1.0 + 2.0 * u_percentagePadding;
|
|
233
|
+
float coef = u_keepWithinCircle ? 1.0 : `).concat(Math.SQRT2,`;
|
|
234
|
+
vec2 coordinateInTexture = diffVector * vec2(paddingRatio, -paddingRatio) / v_radius / 2.0 * coef + vec2(0.5, 0.5);
|
|
235
|
+
int index = int(v_textureIndex + 0.5); // +0.5 avoid rounding errors
|
|
236
|
+
|
|
237
|
+
bool noTextureFound = false;
|
|
238
|
+
vec4 texel;
|
|
239
|
+
|
|
240
|
+
`).concat(Et(new Array(o)).map(function(a,h){return"if (index == ".concat(h,") texel = texture2D(u_atlas[").concat(h,"], (v_texture.xy + coordinateInTexture * v_texture.zw), -1.0);")}).join(`
|
|
241
|
+
else `)+`else {
|
|
242
|
+
texel = texture2D(u_atlas[0], (v_texture.xy + coordinateInTexture * v_texture.zw), -1.0);
|
|
243
|
+
noTextureFound = true;
|
|
244
|
+
}`,`
|
|
245
|
+
|
|
246
|
+
if (noTextureFound) {
|
|
247
|
+
color = v_color;
|
|
248
|
+
} else {
|
|
249
|
+
// Colorize all visible image pixels:
|
|
250
|
+
if (u_colorizeImages) {
|
|
251
|
+
color = mix(gl_FragColor, v_color, texel.a);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Colorize background pixels, keep image pixel colors:
|
|
255
|
+
else {
|
|
256
|
+
color = vec4(mix(v_color, texel, texel.a).rgb, max(texel.a, v_color.a));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Erase pixels "in the padding":
|
|
260
|
+
if (abs(diffVector.x) > v_radius / paddingRatio || abs(diffVector.y) > v_radius / paddingRatio) {
|
|
261
|
+
color = u_colorizeImages ? gl_FragColor : v_color;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
#endif
|
|
266
|
+
|
|
267
|
+
// Crop in a circle when u_keepWithinCircle is truthy:
|
|
268
|
+
if (u_keepWithinCircle) {
|
|
269
|
+
if (dist < v_radius - border) {
|
|
270
|
+
gl_FragColor = color;
|
|
271
|
+
} else if (dist < v_radius) {
|
|
272
|
+
gl_FragColor = mix(transparent, color, (v_radius - dist) / border);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// Crop in a square else:
|
|
277
|
+
else {
|
|
278
|
+
float squareHalfSize = v_radius * `).concat(Math.SQRT1_2*Math.cos(Math.PI/12),`;
|
|
279
|
+
if (abs(diffVector.x) > squareHalfSize || abs(diffVector.y) > squareHalfSize) {
|
|
280
|
+
gl_FragColor = transparent;
|
|
281
|
+
} else {
|
|
282
|
+
gl_FragColor = color;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
`);return s}var Oo=`
|
|
287
|
+
attribute vec4 a_id;
|
|
288
|
+
attribute vec4 a_color;
|
|
289
|
+
attribute vec2 a_position;
|
|
290
|
+
attribute float a_size;
|
|
291
|
+
attribute float a_angle;
|
|
292
|
+
attribute vec4 a_texture;
|
|
293
|
+
attribute float a_textureIndex;
|
|
294
|
+
|
|
295
|
+
uniform mat3 u_matrix;
|
|
296
|
+
uniform float u_sizeRatio;
|
|
297
|
+
uniform float u_correctionRatio;
|
|
298
|
+
|
|
299
|
+
varying vec4 v_color;
|
|
300
|
+
varying vec2 v_diffVector;
|
|
301
|
+
varying float v_radius;
|
|
302
|
+
varying vec4 v_texture;
|
|
303
|
+
varying float v_textureIndex;
|
|
304
|
+
|
|
305
|
+
const float bias = 255.0 / 254.0;
|
|
306
|
+
const float marginRatio = 1.05;
|
|
307
|
+
|
|
308
|
+
void main() {
|
|
309
|
+
float size = a_size * u_correctionRatio / u_sizeRatio * 4.0;
|
|
310
|
+
vec2 diffVector = size * vec2(cos(a_angle), sin(a_angle));
|
|
311
|
+
vec2 position = a_position + diffVector * marginRatio;
|
|
312
|
+
gl_Position = vec4(
|
|
313
|
+
(u_matrix * vec3(position, 1)).xy,
|
|
314
|
+
0,
|
|
315
|
+
1
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
v_diffVector = diffVector;
|
|
319
|
+
v_radius = size / 2.0 / marginRatio;
|
|
320
|
+
|
|
321
|
+
#ifdef PICKING_MODE
|
|
322
|
+
// For picking mode, we use the ID as the color:
|
|
323
|
+
v_color = a_id;
|
|
324
|
+
#else
|
|
325
|
+
// For normal mode, we use the color:
|
|
326
|
+
v_color = a_color;
|
|
327
|
+
|
|
328
|
+
// Pass the texture coordinates:
|
|
329
|
+
v_textureIndex = a_textureIndex;
|
|
330
|
+
v_texture = a_texture;
|
|
331
|
+
#endif
|
|
332
|
+
|
|
333
|
+
v_color.a *= bias;
|
|
334
|
+
}
|
|
335
|
+
`,Co=Oo;function Ne(){Ne=function(){return o};var n,o={},s=Object.prototype,a=s.hasOwnProperty,h=Object.defineProperty||function(f,u,g){f[u]=g.value},m=typeof Symbol=="function"?Symbol:{},w=m.iterator||"@@iterator",T=m.asyncIterator||"@@asyncIterator",O=m.toStringTag||"@@toStringTag";function S(f,u,g){return Object.defineProperty(f,u,{value:g,enumerable:!0,configurable:!0,writable:!0}),f[u]}try{S({},"")}catch{S=function(u,g,A){return u[g]=A}}function y(f,u,g,A){var d=u&&u.prototype instanceof b?u:b,k=Object.create(d.prototype),B=new oe(A||[]);return h(k,"_invoke",{value:V(f,g,B)}),k}function I(f,u,g){try{return{type:"normal",arg:f.call(u,g)}}catch(A){return{type:"throw",arg:A}}}o.wrap=y;var M="suspendedStart",P="suspendedYield",$="executing",C="completed",j={};function b(){}function _(){}function v(){}var R={};S(R,w,function(){return this});var U=Object.getPrototypeOf,G=U&&U(U(ie([])));G&&G!==s&&a.call(G,w)&&(R=G);var z=v.prototype=b.prototype=Object.create(R);function X(f){["next","throw","return"].forEach(function(u){S(f,u,function(g){return this._invoke(u,g)})})}function q(f,u){function g(d,k,B,D){var te=I(f[d],f,k);if(te.type!=="throw"){var ue=te.arg,ge=ue.value;return ge&&typeof ge=="object"&&a.call(ge,"__await")?u.resolve(ge.__await).then(function(ve){g("next",ve,B,D)},function(ve){g("throw",ve,B,D)}):u.resolve(ge).then(function(ve){ue.value=ve,B(ue)},function(ve){return g("throw",ve,B,D)})}D(te.arg)}var A;h(this,"_invoke",{value:function(d,k){function B(){return new u(function(D,te){g(d,k,D,te)})}return A=A?A.then(B,B):B()}})}function V(f,u,g){var A=M;return function(d,k){if(A===$)throw Error("Generator is already running");if(A===C){if(d==="throw")throw k;return{value:n,done:!0}}for(g.method=d,g.arg=k;;){var B=g.delegate;if(B){var D=J(B,g);if(D){if(D===j)continue;return D}}if(g.method==="next")g.sent=g._sent=g.arg;else if(g.method==="throw"){if(A===M)throw A=C,g.arg;g.dispatchException(g.arg)}else g.method==="return"&&g.abrupt("return",g.arg);A=$;var te=I(f,u,g);if(te.type==="normal"){if(A=g.done?C:P,te.arg===j)continue;return{value:te.arg,done:g.done}}te.type==="throw"&&(A=C,g.method="throw",g.arg=te.arg)}}}function J(f,u){var g=u.method,A=f.iterator[g];if(A===n)return u.delegate=null,g==="throw"&&f.iterator.return&&(u.method="return",u.arg=n,J(f,u),u.method==="throw")||g!=="return"&&(u.method="throw",u.arg=new TypeError("The iterator does not provide a '"+g+"' method")),j;var d=I(A,f.iterator,u.arg);if(d.type==="throw")return u.method="throw",u.arg=d.arg,u.delegate=null,j;var k=d.arg;return k?k.done?(u[f.resultName]=k.value,u.next=f.nextLoc,u.method!=="return"&&(u.method="next",u.arg=n),u.delegate=null,j):k:(u.method="throw",u.arg=new TypeError("iterator result is not an object"),u.delegate=null,j)}function Y(f){var u={tryLoc:f[0]};1 in f&&(u.catchLoc=f[1]),2 in f&&(u.finallyLoc=f[2],u.afterLoc=f[3]),this.tryEntries.push(u)}function le(f){var u=f.completion||{};u.type="normal",delete u.arg,f.completion=u}function oe(f){this.tryEntries=[{tryLoc:"root"}],f.forEach(Y,this),this.reset(!0)}function ie(f){if(f||f===""){var u=f[w];if(u)return u.call(f);if(typeof f.next=="function")return f;if(!isNaN(f.length)){var g=-1,A=function d(){for(;++g<f.length;)if(a.call(f,g))return d.value=f[g],d.done=!1,d;return d.value=n,d.done=!0,d};return A.next=A}}throw new TypeError(typeof f+" is not iterable")}return _.prototype=v,h(z,"constructor",{value:v,configurable:!0}),h(v,"constructor",{value:_,configurable:!0}),_.displayName=S(v,O,"GeneratorFunction"),o.isGeneratorFunction=function(f){var u=typeof f=="function"&&f.constructor;return!!u&&(u===_||(u.displayName||u.name)==="GeneratorFunction")},o.mark=function(f){return Object.setPrototypeOf?Object.setPrototypeOf(f,v):(f.__proto__=v,S(f,O,"GeneratorFunction")),f.prototype=Object.create(z),f},o.awrap=function(f){return{__await:f}},X(q.prototype),S(q.prototype,T,function(){return this}),o.AsyncIterator=q,o.async=function(f,u,g,A,d){d===void 0&&(d=Promise);var k=new q(y(f,u,g,A),d);return o.isGeneratorFunction(u)?k:k.next().then(function(B){return B.done?B.value:k.next()})},X(z),S(z,O,"Generator"),S(z,w,function(){return this}),S(z,"toString",function(){return"[object Generator]"}),o.keys=function(f){var u=Object(f),g=[];for(var A in u)g.push(A);return g.reverse(),function d(){for(;g.length;){var k=g.pop();if(k in u)return d.value=k,d.done=!1,d}return d.done=!0,d}},o.values=ie,oe.prototype={constructor:oe,reset:function(f){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(le),!f)for(var u in this)u.charAt(0)==="t"&&a.call(this,u)&&!isNaN(+u.slice(1))&&(this[u]=n)},stop:function(){this.done=!0;var f=this.tryEntries[0].completion;if(f.type==="throw")throw f.arg;return this.rval},dispatchException:function(f){if(this.done)throw f;var u=this;function g(te,ue){return k.type="throw",k.arg=f,u.next=te,ue&&(u.method="next",u.arg=n),!!ue}for(var A=this.tryEntries.length-1;A>=0;--A){var d=this.tryEntries[A],k=d.completion;if(d.tryLoc==="root")return g("end");if(d.tryLoc<=this.prev){var B=a.call(d,"catchLoc"),D=a.call(d,"finallyLoc");if(B&&D){if(this.prev<d.catchLoc)return g(d.catchLoc,!0);if(this.prev<d.finallyLoc)return g(d.finallyLoc)}else if(B){if(this.prev<d.catchLoc)return g(d.catchLoc,!0)}else{if(!D)throw Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return g(d.finallyLoc)}}}},abrupt:function(f,u){for(var g=this.tryEntries.length-1;g>=0;--g){var A=this.tryEntries[g];if(A.tryLoc<=this.prev&&a.call(A,"finallyLoc")&&this.prev<A.finallyLoc){var d=A;break}}d&&(f==="break"||f==="continue")&&d.tryLoc<=u&&u<=d.finallyLoc&&(d=null);var k=d?d.completion:{};return k.type=f,k.arg=u,d?(this.method="next",this.next=d.finallyLoc,j):this.complete(k)},complete:function(f,u){if(f.type==="throw")throw f.arg;return f.type==="break"||f.type==="continue"?this.next=f.arg:f.type==="return"?(this.rval=this.arg=f.arg,this.method="return",this.next="end"):f.type==="normal"&&u&&(this.next=u),j},finish:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var g=this.tryEntries[u];if(g.finallyLoc===f)return this.complete(g.completion,g.afterLoc),le(g),j}},catch:function(f){for(var u=this.tryEntries.length-1;u>=0;--u){var g=this.tryEntries[u];if(g.tryLoc===f){var A=g.completion;if(A.type==="throw"){var d=A.arg;le(g)}return d}}throw Error("illegal catch attempt")},delegateYield:function(f,u,g){return this.delegate={iterator:ie(f),resultName:u,nextLoc:g},this.method==="next"&&(this.arg=n),j}},o}function vr(n,o,s,a,h,m,w){try{var T=n[m](w),O=T.value}catch(S){return void s(S)}T.done?o(O):Promise.resolve(O).then(a,h)}function Ot(n){return function(){var o=this,s=arguments;return new Promise(function(a,h){var m=n.apply(o,s);function w(O){vr(m,a,h,w,T,"next",O)}function T(O){vr(m,a,h,w,T,"throw",O)}w(void 0)})}}var Ct={size:{mode:"max",value:512},objectFit:"cover",correctCentering:!1,maxTextureSize:4096,debounceTimeout:500,crossOrigin:"anonymous"},Ao=1;function xt(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.crossOrigin;return new Promise(function(a,h){var m=new Image;m.addEventListener("load",function(){a(m)},{once:!0}),m.addEventListener("error",function(w){h(w.error)},{once:!0}),s&&m.setAttribute("crossOrigin",s),m.src=n})}function No(n){return wt.apply(this,arguments)}function wt(){return wt=Ot(Ne().mark(function n(o){var s,a,h,m,w,T,O,S,y,I,M,P,$,C=arguments;return Ne().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(s=C.length>1&&C[1]!==void 0?C[1]:{},a=s.size,h=s.crossOrigin,h!=="use-credentials"){b.next=7;break}return b.next=4,fetch(o,{credentials:"include"});case 4:m=b.sent,b.next=10;break;case 7:return b.next=9,fetch(o);case 9:m=b.sent;case 10:return b.next=12,m.text();case 12:if(w=b.sent,T=new DOMParser().parseFromString(w,"image/svg+xml"),O=T.documentElement,S=O.getAttribute("width"),y=O.getAttribute("height"),!(!S||!y)){b.next=19;break}throw new Error("loadSVGImage: cannot use `size` if target SVG has no definite dimensions.");case 19:return typeof a=="number"&&(O.setAttribute("width",""+a),O.setAttribute("height",""+a)),I=new XMLSerializer().serializeToString(T),M=new Blob([I],{type:"image/svg+xml"}),P=URL.createObjectURL(M),$=xt(P),$.finally(function(){return URL.revokeObjectURL(P)}),b.abrupt("return",$);case 26:case"end":return b.stop()}},n)})),wt.apply(this,arguments)}function Lo(n){return Tt.apply(this,arguments)}function Tt(){return Tt=Ot(Ne().mark(function n(o){var s,a,h,m,w,T,O=arguments;return Ne().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if(a=O.length>1&&O[1]!==void 0?O[1]:{},h=a.size,m=a.crossOrigin,w=((s=o.split(/[#?]/)[0].split(".").pop())===null||s===void 0?void 0:s.trim().toLowerCase())==="svg",!(w&&h)){y.next=16;break}return y.prev=3,y.next=6,No(o,{size:h,crossOrigin:m});case 6:T=y.sent,y.next=14;break;case 9:return y.prev=9,y.t0=y.catch(3),y.next=13,xt(o,{crossOrigin:m});case 13:T=y.sent;case 14:y.next=19;break;case 16:return y.next=18,xt(o,{crossOrigin:m});case 18:T=y.sent;case 19:return y.abrupt("return",T);case 20:case"end":return y.stop()}},n,null,[[3,9]])})),Tt.apply(this,arguments)}function Po(n,o,s){var a=s.objectFit,h=s.size,m=s.correctCentering,w=a==="contain"?Math.max(n.width,n.height):Math.min(n.width,n.height),T=h.mode==="auto"?w:h.mode==="force"?h.value:Math.min(h.value,w),O=(n.width-w)/2,S=(n.height-w)/2;if(m){var y=o.getCorrectionOffset(n,w);O=y.x,S=y.y}return{sourceX:O,sourceY:S,sourceSize:w,destinationSize:T}}function $o(n,o,s){for(var a=o.canvas,h=a.width,m=a.height,w=[],T=s.x,O=s.y,S=s.rowHeight,y=s.maxRowWidth,I={},M=0,P=n.length;M<P;M++){var $=n[M],C=$.key,j=$.image,b=$.sourceSize,_=$.sourceX,v=$.sourceY,R=$.destinationSize,U=R+Ao;O+U>m||T+U>h&&O+U+S>m||(T+U>h&&(y=Math.max(y,T),T=0,O+=S,S=U),w.push({key:C,image:j,sourceX:_,sourceY:v,sourceSize:b,destinationX:T,destinationY:O,destinationSize:R}),I[C]={x:T,y:O,size:R},T+=U,S=Math.max(S,U))}y=Math.max(y,T);for(var G=y,z=O+S,X=0,q=w.length;X<q;X++){var V=w[X],J=V.image,Y=V.sourceSize,le=V.sourceX,oe=V.sourceY,ie=V.destinationSize,f=V.destinationX,u=V.destinationY;o.drawImage(J,le,oe,Y,Y,f,u,ie,ie)}return{atlas:I,texture:o.getImageData(0,0,G,z),cursor:{x:T,y:O,rowHeight:S,maxRowWidth:y}}}function zo(n,o,s){var a=n.atlas,h=n.textures,m=n.cursor,w={atlas:me({},a),textures:Et(h.slice(0,-1)),cursor:me({},m)},T=[];for(var O in o){var S,y=o[O];if(y.status==="ready"){var I=(S=a[O])===null||S===void 0?void 0:S.textureIndex;typeof I!="number"&&T.push(me({key:O},y))}}for(var M=function(){var $=$o(T,s,w.cursor),C=$.atlas,j=$.texture,b=$.cursor;w.cursor=b;var _=[];T.forEach(function(v){C[v.key]?w.atlas[v.key]=me(me({},C[v.key]),{},{textureIndex:w.textures.length}):_.push(v)}),w.textures.push(j),T=_,T.length&&(w.cursor={x:0,y:0,rowHeight:0,maxRowWidth:0},s.clearRect(0,0,s.canvas.width,s.canvas.height))};T.length;)M();return w}var Io=(function(){function n(){kt(this,n),this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",{willReadFrequently:!0})}return Rt(n,[{key:"getCorrectionOffset",value:function(s,a){this.canvas.width=a,this.canvas.height=a,this.context.clearRect(0,0,a,a),this.context.drawImage(s,0,0,a,a);for(var h=this.context.getImageData(0,0,a,a).data,m=new Uint8ClampedArray(h.length/4),w=0;w<h.length;w++)m[w]=h[w*4+3];for(var T=0,O=0,S=0,y=0;y<a;y++)for(var I=0;I<a;I++){var M=m[y*a+I];S+=M,T+=M*I,O+=M*y}var P=T/S,$=O/S;return{x:P-a/2,y:$-a/2}}}]),n})(),et=(function(n){Nr(o,n);function o(){var s,a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return kt(this,o),s=Ar(this,o),ce(xe(s),"canvas",document.createElement("canvas")),ce(xe(s),"ctx",s.canvas.getContext("2d",{willReadFrequently:!0})),ce(xe(s),"corrector",new Io),ce(xe(s),"imageStates",{}),ce(xe(s),"textures",[s.ctx.getImageData(0,0,1,1)]),ce(xe(s),"lastTextureCursor",{x:0,y:0,rowHeight:0,maxRowWidth:0}),ce(xe(s),"atlas",{}),s.options=me(me({},Ct),a),s.canvas.width=s.options.maxTextureSize,s.canvas.height=s.options.maxTextureSize,s}return Rt(o,[{key:"scheduleGenerateTexture",value:function(){var a=this;typeof this.frameId!="number"&&(typeof this.options.debounceTimeout=="number"?this.frameId=window.setTimeout(function(){a.generateTextures(),a.frameId=void 0},this.options.debounceTimeout):this.generateTextures())}},{key:"generateTextures",value:function(){var a=zo({atlas:this.atlas,textures:this.textures,cursor:this.lastTextureCursor},this.imageStates,this.ctx),h=a.atlas,m=a.textures,w=a.cursor;this.atlas=h,this.textures=m,this.lastTextureCursor=w,this.emit(o.NEW_TEXTURE_EVENT,{atlas:h,textures:m})}},{key:"registerImage",value:(function(){var s=Ot(Ne().mark(function h(m){var w,T;return Ne().wrap(function(S){for(;;)switch(S.prev=S.next){case 0:if(!this.imageStates[m]){S.next=2;break}return S.abrupt("return");case 2:return this.imageStates[m]={status:"loading"},S.prev=3,w=this.options.size,S.next=7,Lo(m,{size:w.mode==="force"?w.value:void 0,crossOrigin:this.options.crossOrigin||void 0});case 7:T=S.sent,this.imageStates[m]=me({status:"ready",image:T},Po(T,this.corrector,this.options)),this.scheduleGenerateTexture(),S.next=15;break;case 12:S.prev=12,S.t0=S.catch(3),this.imageStates[m]={status:"error"};case 15:case"end":return S.stop()}},h,this,[[3,12]])}));function a(h){return s.apply(this,arguments)}return a})()},{key:"getAtlas",value:function(){return this.atlas}},{key:"getTextures",value:function(){return this.textures}}]),o})(Xn.EventEmitter);ce(et,"NEW_TEXTURE_EVENT","newTexture");var jo=["drawHover","drawLabel","drawingMode","keepWithinCircle","padding","colorAttribute","imageAttribute"],Lr=WebGLRenderingContext,yr=Lr.UNSIGNED_BYTE,Ue=Lr.FLOAT,Mo=me(me({},Ct),{},{drawingMode:"background",keepWithinCircle:!0,drawLabel:void 0,drawHover:void 0,padding:0,colorAttribute:"color",imageAttribute:"image"}),Fo=["u_sizeRatio","u_correctionRatio","u_cameraAngle","u_percentagePadding","u_matrix","u_colorizeImages","u_keepWithinCircle","u_atlas"];function rt(n){var o,s=document.createElement("canvas").getContext("webgl"),a=Math.min(s.getParameter(s.MAX_TEXTURE_SIZE),Ct.maxTextureSize);s.canvas.remove();var h=me(me(me({},Mo),{maxTextureSize:a}),n||{}),m=h.drawHover,w=h.drawLabel,T=h.drawingMode,O=h.keepWithinCircle,S=h.padding,y=h.colorAttribute,I=h.imageAttribute,M=ko(h,jo),P=new et(M);return o=(function($){Nr(C,$);function C(j,b,_){var v;return kt(this,C),v=Ar(this,C,[j,b,_]),ce(xe(v),"drawLabel",w),ce(xe(v),"drawHover",m),ce(xe(v),"textureManagerCallback",null),v.textureManagerCallback=function(R){var U=R.atlas,G=R.textures,z=G.length!==v.textures.length;v.atlas=U,v.textureImages=G,z&&v.upgradeShaders(),v.bindTextures(),v.latestRenderParams&&v.render(v.latestRenderParams),v.renderer&&v.renderer.refresh&&v.renderer.refresh()},P.on(et.NEW_TEXTURE_EVENT,v.textureManagerCallback),v.atlas=P.getAtlas(),v.textureImages=P.getTextures(),v.textures=v.textureImages.map(function(){return j.createTexture()}),v.bindTextures(),v}return Rt(C,[{key:"getDefinition",value:function(){return{VERTICES:3,VERTEX_SHADER_SOURCE:Co,FRAGMENT_SHADER_SOURCE:Ro({texturesCount:P.getTextures().length}),METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:Fo,ATTRIBUTES:[{name:"a_position",size:2,type:Ue},{name:"a_size",size:1,type:Ue},{name:"a_color",size:4,type:yr,normalized:!0},{name:"a_id",size:4,type:yr,normalized:!0},{name:"a_texture",size:4,type:Ue},{name:"a_textureIndex",size:1,type:Ue}],CONSTANT_ATTRIBUTES:[{name:"a_angle",size:1,type:Ue}],CONSTANT_DATA:[[C.ANGLE_1],[C.ANGLE_2],[C.ANGLE_3]]}}},{key:"upgradeShaders",value:function(){var b=this.getDefinition(),_=this.normalProgram,v=_.program,R=_.buffer,U=_.vertexShader,G=_.fragmentShader,z=_.gl;z.deleteProgram(v),z.deleteBuffer(R),z.deleteShader(U),z.deleteShader(G),this.normalProgram=this.getProgramInfo("normal",z,b.VERTEX_SHADER_SOURCE,b.FRAGMENT_SHADER_SOURCE,null)}},{key:"kill",value:function(){var b,_=(b=this.normalProgram)===null||b===void 0?void 0:b.gl;if(_)for(var v=0;v<this.textures.length;v++)_.deleteTexture(this.textures[v]);this.textureManagerCallback&&(P.off(et.NEW_TEXTURE_EVENT,this.textureManagerCallback),this.textureManagerCallback=null),pr(C,"kill",this)([])}},{key:"bindTextures",value:function(){for(var b=this.normalProgram.gl,_=0;_<this.textureImages.length;_++){if(_>=this.textures.length){var v=b.createTexture();v&&this.textures.push(v)}b.activeTexture(b.TEXTURE0+_),b.bindTexture(b.TEXTURE_2D,this.textures[_]),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,this.textureImages[_]),b.generateMipmap(b.TEXTURE_2D)}}},{key:"renderProgram",value:function(b,_){if(!_.isPicking)for(var v=_.gl,R=0;R<this.textureImages.length;R++)v.activeTexture(v.TEXTURE0+R),v.bindTexture(v.TEXTURE_2D,this.textures[R]);pr(C,"renderProgram",this)([b,_])}},{key:"processVisibleItem",value:function(b,_,v){var R=this.array,U=St(v[y]),G=v[I],z=G?this.atlas[G]:void 0;if(typeof G=="string"&&!z&&P.registerImage(G),R[_++]=v.x,R[_++]=v.y,R[_++]=v.size,R[_++]=U,R[_++]=b,z&&typeof z.textureIndex=="number"){var X=this.textureImages[z.textureIndex],q=X.width,V=X.height;R[_++]=z.x/q,R[_++]=z.y/V,R[_++]=z.size/q,R[_++]=z.size/V,R[_++]=z.textureIndex}else R[_++]=0,R[_++]=0,R[_++]=0,R[_++]=0,R[_++]=0}},{key:"setUniforms",value:function(b,_){var v=_.gl,R=_.uniformLocations,U=R.u_sizeRatio,G=R.u_correctionRatio,z=R.u_matrix,X=R.u_atlas,q=R.u_colorizeImages,V=R.u_keepWithinCircle,J=R.u_cameraAngle,Y=R.u_percentagePadding;this.latestRenderParams=b,v.uniform1f(G,b.correctionRatio),v.uniform1f(U,O?b.sizeRatio:b.sizeRatio/Math.SQRT2),v.uniform1f(J,b.cameraAngle),v.uniform1f(Y,S),v.uniformMatrix3fv(z,!1,b.matrix),v.uniform1iv(X,Et(new Array(this.textureImages.length)).map(function(le,oe){return oe})),v.uniform1i(q,T==="color"?1:0),v.uniform1i(V,O?1:0)}}]),C})(Yn),ce(o,"ANGLE_1",0),ce(o,"ANGLE_2",2*Math.PI/3),ce(o,"ANGLE_3",4*Math.PI/3),ce(o,"textureManager",P),o}rt();rt({keepWithinCircle:!1,size:{mode:"force",value:256},drawingMode:"color",correctCentering:!0});function Vo(n,o,s={}){const a=s.onSelect,h=new Jn;o={nodes:(o==null?void 0:o.nodes)??[],edges:(o==null?void 0:o.edges)??[]};const m={destroy(){},filter(){},focusNode(){},clearSelection(){},resetLayout(){},setFilter(){}};function w({drawLabel:e,marker:t="diamond"}={}){const{UNSIGNED_BYTE:r,FLOAT:i}=WebGLRenderingContext,l=t==="hollowTriangle"?2:1,c=t==="diamond"?1:0,x=8,E=16,L=`
|
|
336
|
+
attribute vec4 a_id;
|
|
337
|
+
attribute vec4 a_color;
|
|
338
|
+
attribute float a_direction;
|
|
339
|
+
attribute float a_thickness;
|
|
340
|
+
attribute vec2 a_source;
|
|
341
|
+
attribute vec2 a_target;
|
|
342
|
+
attribute float a_current;
|
|
343
|
+
attribute float a_curvature;
|
|
344
|
+
attribute float a_sourceSize;
|
|
345
|
+
attribute float a_targetSize;
|
|
346
|
+
|
|
347
|
+
uniform mat3 u_matrix;
|
|
348
|
+
uniform float u_sizeRatio;
|
|
349
|
+
uniform float u_pixelRatio;
|
|
350
|
+
uniform vec2 u_dimensions;
|
|
351
|
+
uniform float u_minEdgeThickness;
|
|
352
|
+
uniform float u_feather;
|
|
353
|
+
uniform float u_widenessToThicknessRatio;
|
|
354
|
+
|
|
355
|
+
varying vec4 v_color;
|
|
356
|
+
varying float v_thickness;
|
|
357
|
+
varying float v_feather;
|
|
358
|
+
varying vec2 v_cpA;
|
|
359
|
+
varying vec2 v_cpB;
|
|
360
|
+
varying vec2 v_cpC;
|
|
361
|
+
varying vec2 v_sourcePoint;
|
|
362
|
+
varying vec2 v_targetPoint;
|
|
363
|
+
varying float v_sourceSize;
|
|
364
|
+
varying float v_targetSize;
|
|
365
|
+
|
|
366
|
+
const float bias = 255.0 / 254.0;
|
|
367
|
+
const float epsilon = 0.7;
|
|
368
|
+
|
|
369
|
+
vec2 clipspaceToViewport(vec2 pos, vec2 dimensions) {
|
|
370
|
+
return vec2((pos.x + 1.0) * dimensions.x / 2.0, (pos.y + 1.0) * dimensions.y / 2.0);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
vec2 viewportToClipspace(vec2 pos, vec2 dimensions) {
|
|
374
|
+
return vec2(pos.x / dimensions.x * 2.0 - 1.0, pos.y / dimensions.y * 2.0 - 1.0);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
void main() {
|
|
378
|
+
vec2 position = a_source * max(0.0, a_current) + a_target * max(0.0, 1.0 - a_current);
|
|
379
|
+
position = (u_matrix * vec3(position, 1)).xy;
|
|
380
|
+
|
|
381
|
+
vec2 source = (u_matrix * vec3(a_source, 1)).xy;
|
|
382
|
+
vec2 target = (u_matrix * vec3(a_target, 1)).xy;
|
|
383
|
+
|
|
384
|
+
vec2 viewportPosition = clipspaceToViewport(position, u_dimensions);
|
|
385
|
+
vec2 viewportSource = clipspaceToViewport(source, u_dimensions);
|
|
386
|
+
vec2 viewportTarget = clipspaceToViewport(target, u_dimensions);
|
|
387
|
+
|
|
388
|
+
vec2 delta = viewportTarget.xy - viewportSource.xy;
|
|
389
|
+
float len = max(1.0, length(delta));
|
|
390
|
+
vec2 normal = vec2(-delta.y, delta.x) * a_direction;
|
|
391
|
+
vec2 unitNormal = normal / len;
|
|
392
|
+
float boundingBoxThickness = len * a_curvature;
|
|
393
|
+
|
|
394
|
+
float curveThickness = max(u_minEdgeThickness, a_thickness);
|
|
395
|
+
v_thickness = curveThickness * u_pixelRatio;
|
|
396
|
+
v_feather = u_feather;
|
|
397
|
+
|
|
398
|
+
v_cpA = viewportSource;
|
|
399
|
+
v_cpB = 0.5 * (viewportSource + viewportTarget) + unitNormal * a_direction * boundingBoxThickness;
|
|
400
|
+
v_cpC = viewportTarget;
|
|
401
|
+
v_sourcePoint = viewportSource;
|
|
402
|
+
v_targetPoint = viewportTarget;
|
|
403
|
+
v_sourceSize = a_sourceSize * u_pixelRatio / u_sizeRatio;
|
|
404
|
+
v_targetSize = a_targetSize * u_pixelRatio / u_sizeRatio;
|
|
405
|
+
|
|
406
|
+
vec2 viewportOffsetPosition = (
|
|
407
|
+
viewportPosition +
|
|
408
|
+
unitNormal * (boundingBoxThickness / 2.0 + sign(boundingBoxThickness) * (curveThickness * u_widenessToThicknessRatio + 28.0 + epsilon)) *
|
|
409
|
+
max(0.0, a_direction)
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
position = viewportToClipspace(viewportOffsetPosition, u_dimensions);
|
|
413
|
+
gl_Position = vec4(position, 0, 1);
|
|
414
|
+
|
|
415
|
+
#ifdef PICKING_MODE
|
|
416
|
+
v_color = a_id;
|
|
417
|
+
#else
|
|
418
|
+
v_color = a_color;
|
|
419
|
+
#endif
|
|
420
|
+
v_color.a *= bias;
|
|
421
|
+
}
|
|
422
|
+
`,p=`
|
|
423
|
+
precision highp float;
|
|
424
|
+
|
|
425
|
+
varying vec4 v_color;
|
|
426
|
+
varying float v_thickness;
|
|
427
|
+
varying float v_feather;
|
|
428
|
+
varying vec2 v_cpA;
|
|
429
|
+
varying vec2 v_cpB;
|
|
430
|
+
varying vec2 v_cpC;
|
|
431
|
+
varying vec2 v_sourcePoint;
|
|
432
|
+
varying vec2 v_targetPoint;
|
|
433
|
+
varying float v_sourceSize;
|
|
434
|
+
varying float v_targetSize;
|
|
435
|
+
|
|
436
|
+
uniform float u_lengthToThicknessRatio;
|
|
437
|
+
uniform float u_widenessToThicknessRatio;
|
|
438
|
+
uniform float u_markerKind;
|
|
439
|
+
uniform float u_targetArrowFill;
|
|
440
|
+
uniform float u_dashLength;
|
|
441
|
+
uniform float u_dashPeriod;
|
|
442
|
+
uniform float u_pixelRatio;
|
|
443
|
+
|
|
444
|
+
const vec4 transparent = vec4(0.0, 0.0, 0.0, 0.0);
|
|
445
|
+
|
|
446
|
+
float det(vec2 a, vec2 b) {
|
|
447
|
+
return a.x * b.y - b.x * a.y;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
vec2 getDistanceVector(vec2 b0, vec2 b1, vec2 b2) {
|
|
451
|
+
float a = det(b0, b2), b = 2.0 * det(b1, b0), d = 2.0 * det(b2, b1);
|
|
452
|
+
float f = b * d - a * a;
|
|
453
|
+
vec2 d21 = b2 - b1, d10 = b1 - b0, d20 = b2 - b0;
|
|
454
|
+
vec2 gf = 2.0 * (b * d21 + d * d10 + a * d20);
|
|
455
|
+
gf = vec2(gf.y, -gf.x);
|
|
456
|
+
vec2 pp = -f * gf / dot(gf, gf);
|
|
457
|
+
vec2 d0p = b0 - pp;
|
|
458
|
+
float ap = det(d0p, d20), bp = 2.0 * det(d10, d0p);
|
|
459
|
+
float t = clamp((ap + bp) / (2.0 * a + b + d), 0.0, 1.0);
|
|
460
|
+
return mix(mix(b0, b1, t), mix(b1, b2, t), t);
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
float distToQuadraticBezierCurve(vec2 p, vec2 b0, vec2 b1, vec2 b2) {
|
|
464
|
+
return length(getDistanceVector(b0 - p, b1 - p, b2 - p));
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
float distToSegment(vec2 p, vec2 a, vec2 b) {
|
|
468
|
+
vec2 pa = p - a;
|
|
469
|
+
vec2 ba = b - a;
|
|
470
|
+
float h = clamp(dot(pa, ba) / max(dot(ba, ba), 1.0), 0.0, 1.0);
|
|
471
|
+
return length(pa - ba * h);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
float approximateCurveT(vec2 p) {
|
|
475
|
+
vec2 chord = v_cpC - v_cpA;
|
|
476
|
+
float chordLength = max(1.0, dot(chord, chord));
|
|
477
|
+
return clamp(dot(p - v_cpA, chord) / chordLength, 0.0, 1.0);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
void main(void) {
|
|
481
|
+
vec2 p = gl_FragCoord.xy;
|
|
482
|
+
vec2 sourceTangentSeed = mix(v_cpB - v_cpA, v_cpC - v_cpB, 0.08);
|
|
483
|
+
if (length(sourceTangentSeed) < 0.5) sourceTangentSeed = v_cpC - v_cpA;
|
|
484
|
+
vec2 sourceTangent = normalize(sourceTangentSeed);
|
|
485
|
+
vec2 sourceNormal = vec2(-sourceTangent.y, sourceTangent.x);
|
|
486
|
+
vec2 targetTangentSeed = mix(v_cpB - v_cpA, v_cpC - v_cpB, 0.92);
|
|
487
|
+
if (length(targetTangentSeed) < 0.5) targetTangentSeed = v_cpC - v_cpA;
|
|
488
|
+
vec2 targetTangent = normalize(targetTangentSeed);
|
|
489
|
+
vec2 targetNormal = vec2(-targetTangent.y, targetTangent.x);
|
|
490
|
+
|
|
491
|
+
float diamondRadius = 7.5 * u_pixelRatio;
|
|
492
|
+
float diamondStroke = max(1.15 * u_pixelRatio, v_thickness * 0.45);
|
|
493
|
+
vec2 diamondCenter = v_sourcePoint + sourceTangent * (v_sourceSize + diamondRadius + 3.0 * u_pixelRatio);
|
|
494
|
+
vec2 diamondRel = p - diamondCenter;
|
|
495
|
+
float diamondSignedDistance = abs(dot(diamondRel, sourceTangent)) + abs(dot(diamondRel, sourceNormal)) - diamondRadius;
|
|
496
|
+
bool diamondStrokeHit = u_markerKind < 1.5 && abs(diamondSignedDistance) <= diamondStroke;
|
|
497
|
+
|
|
498
|
+
float triangleLength = 11.0 * u_pixelRatio;
|
|
499
|
+
float triangleWidth = 6.6 * u_pixelRatio;
|
|
500
|
+
float triangleStroke = max(1.05 * u_pixelRatio, v_thickness * 0.4);
|
|
501
|
+
vec2 triangleTip = v_targetPoint - targetTangent * (v_targetSize + 3.0 * u_pixelRatio);
|
|
502
|
+
vec2 triangleBase = triangleTip - targetTangent * triangleLength;
|
|
503
|
+
vec2 triangleLeft = triangleBase + targetNormal * triangleWidth;
|
|
504
|
+
vec2 triangleRight = triangleBase - targetNormal * triangleWidth;
|
|
505
|
+
float triangleDistance = min(
|
|
506
|
+
distToSegment(p, triangleTip, triangleLeft),
|
|
507
|
+
min(distToSegment(p, triangleTip, triangleRight), distToSegment(p, triangleLeft, triangleRight))
|
|
508
|
+
);
|
|
509
|
+
bool triangleStrokeHit = u_markerKind > 1.5 && triangleDistance <= triangleStroke;
|
|
510
|
+
|
|
511
|
+
float dist = distToQuadraticBezierCurve(p, v_cpA, v_cpB, v_cpC);
|
|
512
|
+
float thickness = v_thickness;
|
|
513
|
+
float distToTarget = length(p - v_targetPoint);
|
|
514
|
+
float targetArrowLength = v_targetSize + thickness * u_lengthToThicknessRatio;
|
|
515
|
+
if (u_targetArrowFill > 0.5 && distToTarget < targetArrowLength) {
|
|
516
|
+
thickness = (distToTarget - v_targetSize) / (targetArrowLength - v_targetSize) * u_widenessToThicknessRatio * thickness;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
float t = approximateCurveT(p);
|
|
520
|
+
float dashPosition = mod(t * length(v_cpC - v_cpA), u_dashPeriod);
|
|
521
|
+
bool dashVisible = dashPosition < u_dashLength || (u_targetArrowFill > 0.5 && distToTarget < targetArrowLength);
|
|
522
|
+
float halfThickness = thickness / 2.0;
|
|
523
|
+
|
|
524
|
+
if (diamondStrokeHit || triangleStrokeHit || (dashVisible && dist < halfThickness)) {
|
|
525
|
+
#ifdef PICKING_MODE
|
|
526
|
+
gl_FragColor = v_color;
|
|
527
|
+
#else
|
|
528
|
+
float edgeAlpha = 1.0 - smoothstep(max(halfThickness - v_feather, 0.0), halfThickness, dist);
|
|
529
|
+
float diamondAlpha = 1.0 - smoothstep(max(diamondStroke - v_feather, 0.0), diamondStroke, abs(diamondSignedDistance));
|
|
530
|
+
float triangleAlpha = 1.0 - smoothstep(max(triangleStroke - v_feather, 0.0), triangleStroke, triangleDistance);
|
|
531
|
+
gl_FragColor = vec4(v_color.rgb, v_color.a * max(edgeAlpha, max(diamondAlpha, triangleAlpha)));
|
|
532
|
+
#endif
|
|
533
|
+
} else {
|
|
534
|
+
gl_FragColor = transparent;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
`;return class extends mr{constructor(){super(...arguments);ur(this,"drawLabel",e)}getDefinition(){return{VERTICES:6,VERTEX_SHADER_SOURCE:L,FRAGMENT_SHADER_SOURCE:p,METHOD:WebGLRenderingContext.TRIANGLES,UNIFORMS:["u_matrix","u_sizeRatio","u_dimensions","u_pixelRatio","u_feather","u_minEdgeThickness","u_lengthToThicknessRatio","u_widenessToThicknessRatio","u_markerKind","u_targetArrowFill","u_dashLength","u_dashPeriod"],ATTRIBUTES:[{name:"a_source",size:2,type:i},{name:"a_target",size:2,type:i},{name:"a_sourceSize",size:1,type:i},{name:"a_targetSize",size:1,type:i},{name:"a_thickness",size:1,type:i},{name:"a_curvature",size:1,type:i},{name:"a_color",size:4,type:r,normalized:!0},{name:"a_id",size:4,type:r,normalized:!0}],CONSTANT_ATTRIBUTES:[{name:"a_current",size:1,type:i},{name:"a_direction",size:1,type:i}],CONSTANT_DATA:[[0,1],[0,-1],[1,1],[0,-1],[1,1],[1,-1]]}}processVisibleItem(W,H,Q,Z,de){const be=St(de.color),ae=Number(de.curvature??.25),we=Number(de.size||1),_e=this.array;_e[H++]=Q.x,_e[H++]=Q.y,_e[H++]=Z.x,_e[H++]=Z.y,_e[H++]=Q.size,_e[H++]=Z.size,_e[H++]=we,_e[H++]=ae,_e[H++]=be,_e[H++]=W}setUniforms(W,{gl:H,uniformLocations:Q}){H.uniformMatrix3fv(Q.u_matrix,!1,W.matrix),H.uniform1f(Q.u_pixelRatio,W.pixelRatio),H.uniform1f(Q.u_sizeRatio,W.sizeRatio),H.uniform1f(Q.u_feather,W.antiAliasingFeather),H.uniform2f(Q.u_dimensions,W.width*W.pixelRatio,W.height*W.pixelRatio),H.uniform1f(Q.u_minEdgeThickness,W.minEdgeThickness),H.uniform1f(Q.u_lengthToThicknessRatio,3.2),H.uniform1f(Q.u_widenessToThicknessRatio,2.1),H.uniform1f(Q.u_markerKind,l),H.uniform1f(Q.u_targetArrowFill,c),H.uniform1f(Q.u_dashLength,x*W.pixelRatio),H.uniform1f(Q.u_dashPeriod,E*W.pixelRatio)}}}function T(e={}){return w({...e,marker:"diamond"})}function O(e={}){return w({...e,marker:"hollowTriangle"})}if(!o||!o.nodes.length)return m;const S=F("--bg-sunken"),y=F("--text-strong"),I=F("--text-body"),M=F("--text-muted"),P=F("--slate-0"),$=F("--slate-950"),C=F("--color-role-edge-default"),j={"semantic-query":{fill:F("--color-role-ontology"),stroke:F("--color-role-ontology-ink"),text:y},class:{fill:F("--color-role-rdf-class"),stroke:y,text:y},"object-property":{fill:F("--color-role-rdf-objprop"),stroke:I,text:y},"datatype-property":{fill:F("--color-role-rdf-dtprop"),stroke:I,text:P},"rdf-property":{fill:F("--color-role-rdf-rdfprop"),stroke:I,text:P},"skos-concept":{fill:F("--color-role-rdf-concept"),stroke:F("--color-role-ontology-ink"),text:y},"named-individual":{fill:F("--color-role-rdf-individual"),stroke:F("--color-role-requirement-ink"),text:P},datatype:{fill:F("--color-role-rdf-datatype"),stroke:F("--color-role-ontology-ink"),text:y},restriction:{fill:F("--color-role-rdf-restriction"),stroke:y,text:y},"class-expression":{fill:F("--color-role-rdf-classexpr"),stroke:y,text:y},"node-shape":{fill:F("--color-role-rdf-nodeshape"),stroke:F("--color-role-rdf-propshape"),text:P},"property-shape":{fill:F("--color-role-rdf-propshape"),stroke:F("--color-role-rdf-nodeshape"),text:P},resource:{fill:S,stroke:F("--color-role-other-ink"),text:y}},b={concepts:{fill:F("--color-role-rdf-concept"),stroke:F("--color-role-ontology-ink"),text:y},"reqvire-context":{fill:F("--info"),stroke:F("--info-border"),text:P},"external-source":{fill:F("--color-role-other"),stroke:F("--color-role-other-ink"),text:y}},_={mutedNode:-10,base:0,focusedEdge:100,focusedNeighborNode:200,focusedNode:300},v=Er({curvatureAttribute:"curvature",defaultCurvature:.08,keepLabelUpright:!0});function R(e){return e.layer&&e.layer!=="authored"?b[e.layer]||j.resource:j[e.semantic_type]||j.resource}const U=new Map;o.edges.forEach(e=>{U.set(e.source,(U.get(e.source)||0)+1),U.set(e.target,(U.get(e.target)||0)+1)});const G=o.nodes.map(e=>{const t=fe(e),r=nn(e),i=String(t||"").length,l=U.get(e.id)||0,c=Math.max(46,Math.min(92,46+Math.sqrt(l)*9)),x=Math.max(86,Math.min(238,i*6.5+26));return{...e,display_label:t,shape:r,width:r==="class-anchor"?c:x,height:r==="class-anchor"?c:34}}),z=new Map(G.map(e=>[e.id,e])),X=G.filter(Ge),q=new Set(o.edges.filter(e=>e.source_kind==="query").map(e=>ee(e.target))),V=G.filter(e=>!Ge(e)||q.has(e.id)),J=Dr(o.edges,z,X),Y=new Map(V.map(e=>[e.id,e])),le=en(V,J),oe=new Map(V.map(e=>[e.id,new Set([e.id])])),ie=new Map(V.map(e=>[e.id,[]]));J.forEach(e=>{const t=typeof e.source=="string"?e.source:e.source.id,r=typeof e.target=="string"?e.target:e.target.id;oe.has(t)&&oe.get(t).add(r),oe.has(r)&&oe.get(r).add(t),ie.has(t)&&ie.get(t).push(e),r!==t&&ie.has(r)&&ie.get(r).push(e)});const f={role:new Set(["ontology-term","semantic-query","shacl-shape","resource","external-reference"]),origin:new Set(["authored","registry","construct"]),layer:new Set(["layer-authored","layer-concepts"]),construct:new Set(["domain-range","subclass","membership","disjoint","equivalence","inverse","property-chain","property-characteristic","class-expression","shape-overlay"])};let u=new Set(["class-membership","class-disjointness","class-expressions"]);G.forEach(e=>{e._ontologyRoles=Nn(e),e._ontologyConstructs=jn(e),e._ontologyOrigins=Ln(e),e._ontologyLayers=Pn(e)}),J.forEach(e=>{e._ontologyConstructs=Mn(e),e._ontologyLayers=$n(e)}),s.initialFilters&&cr(s.initialFilters);let g=tr(),A=null,d=null,k=null,B=null,D=null,te=!1,ue=!1,ge=!1,ve=!1,pe=null,Te=0,Ae="",Fe=new Set,ke=null;function Se(e){n.style.cursor=e,n.querySelectorAll("canvas").forEach(t=>{t.style.cursor=e})}try{nt()}catch(e){throw h.cancel(),k==null||k.kill(),e}function nt(){n&&(Pr(),d=new pt({type:"directed",multi:!0,allowSelfLoops:!0}),At(V),V.forEach(e=>{const t=R(e),r=Ke(e),i=e.semantic_type==="semantic-query";d.addNode(e.id,{...e,type:i?"queryGlyph":r?"constructGlyph":"circle",image:i?Mt():r?Ye(e):void 0,mutedImage:i?Mt(!0):r?Ye(e,!0):void 0,label:Gt(e),fullLabel:Bt(e),x:e.x,y:e.y,size:zt(e),color:t.fill,borderColor:t.stroke,hidden:!er(e)})}),J.forEach((e,t)=>{const r=ee(e.source),i=ee(e.target);!d.hasNode(r)||!d.hasNode(i)||d.addDirectedEdgeWithKey(`o${t}`,r,i,{...e,source:r,target:i,type:Gr(e),label:Je(e),size:It(e),color:Mr(e),hidden:!Ie(e)})}),Ur(),it(),$r(),k=new Kn(d,n,{allowInvalidContainer:!0,defaultEdgeType:"curvedArrow",zIndex:!0,nodeProgramClasses:{queryGlyph:rt({objectFit:"contain",keepWithinCircle:!0,correctCentering:!0,padding:0,drawingMode:"background",size:{mode:"force",value:256}}),constructGlyph:rt({objectFit:"contain",keepWithinCircle:!0,correctCentering:!0,padding:.08,drawingMode:"background",size:{mode:"force",value:256}})},edgeProgramClasses:{curvedArrow:He({arrowHead:{extremity:"target",lengthToThicknessRatio:2.5,widenessToThicknessRatio:2},drawLabel:Xe}),subclassTriangleArrow:O({drawLabel:Xe}),restrictionConnectorArrow:He({arrowHead:{extremity:"target",lengthToThicknessRatio:2.8,widenessToThicknessRatio:1.8},drawLabel:Xe}),constructDiamondArrow:T({drawLabel:Xe})},renderEdgeLabels:!0,labelColor:{color:$},labelWeight:"600",edgeLabelSize:12,edgeLabelWeight:"600",edgeLabelColor:{color:y},labelDensity:.14,labelGridCellSize:88,labelRenderedSizeThreshold:8,nodeReducer:(e,t)=>{const r={...t},i=ft(),l=or(),c=dt(),x=ir(),E=i.length>0,L=E&&c.some(Q=>l.has(Q)),p=E||c.length>0,K=Ke(t),re=B===e,W=D===e;if(E){const Q=l.has(e),Z=L&&x.has(e);if(!Q&&!Z&&!W)return r.hidden=!0,r.label="",r.forceLabel=!1,r.highlighted=!1,r.zIndex=_.base,r;r.hidden=!1,r.focused=L?c.includes(e):i.includes(e),r.inFocusNeighborhood=L?Z:Q}else r.focused=c.includes(e),r.inFocusNeighborhood=x.has(e);const H=E&&L?l.has(e)&&!x.has(e)&&!W:p&&!r.inFocusNeighborhood&&!W;return r.highlighted=p&&(r.inFocusNeighborhood||W||re),r.zIndex=r.focused||W?_.focusedNode:r.inFocusNeighborhood?_.focusedNeighborNode:_.base,!p&&!W?(r.label="",r.forceLabel=!1):(r.inFocusNeighborhood||W||re)&&(r.label=K?t.label||Qe(t):t.fullLabel||t.label||"",r.forceLabel=!0),H&&(r.color=Ut(t.color||F("--color-role-other"),.2),r.label="",r.forceLabel=!1,r.zIndex=_.mutedNode),t.semantic_type==="semantic-query"&&(r.image=H?t.mutedImage:t.image),K&&(r.image=H?t.mutedImage||Ye(t,!0):t.image||Ye(t),r.color=H?r.color:t.color||R(t).fill,p&&r.inFocusNeighborhood&&!H&&!r.label&&(r.label=t.label||Qe(t),r.forceLabel=!0)),r},edgeReducer:(e,t)=>{const r={...t},i=ft(),l=or(),c=dt(),x=ir(),E=i.length>0,L=E&&c.some(W=>l.has(W)),p=E||c.length>0,K=L?c:i,re=L?x:l;return r.hidden=!Ie(t)||!p||(E?!sr(t,K,re):!sr(t,c,x)),r.zIndex=r.hidden?_.base:_.focusedEdge,r.hidden?(r.label="",r.forceLabel=!1,r):(r.color=Fr(t),r.size=Math.max(.8,Number(t.size||It(t))),r.label=p?Je(t):"",r.forceLabel=p,r)}}),k.on("clickNode",e=>{if(ve){ve=!1,Le();return}Le(),window.focusOntologyNode(e.node)}),k.on("clickStage",()=>{if(Se(""),ge){ge=!1,pe&&(window.clearTimeout(pe),pe=null);return}window.clearOntologySelection()}),k.on("enterNode",e=>{B=e.node,Se("pointer"),k.refresh()}),k.on("leaveNode",e=>{B===e.node&&(B=null,k.refresh()),Se("")}),ot())}function ot(){if(!k||!d)return;k.on("downNode",t=>{var r;g.has(t.node)&&(h.cancel(),Ve(),(r=s.onLayoutState)==null||r.call(s,"ready"),Se("grabbing"),te=!0,D=t.node,ue=!1,Le(),k.getCustomBBox()||k.setCustomBBox(k.getBBox()),Ee())}),k.on("moveBody",({event:t})=>{if(!te||!D||!d.hasNode(D))return;const r=k.viewportToGraph(t);d.mergeNodeAttributes(D,{x:r.x,y:r.y}),ue=!0,Ee(),t.preventSigmaDefault&&t.preventSigmaDefault(),t.original&&(t.original.preventDefault(),t.original.stopPropagation())});const e=()=>{!te&&!D||(ue&&(ve=!0,Le()),te=!1,D=null,ue=!1,Se(B?"pointer":""),Ee())};k.on("upNode",e),k.on("upStage",e)}function Le(){ge=!0,pe&&window.clearTimeout(pe),pe=window.setTimeout(()=>{ge=!1,pe=null},0)}function Pr(){const e=Math.max(window.innerHeight-50,520);(!n.clientHeight||n.clientHeight<20)&&(n.style.height=`${e}px`)}function At(e){const t=new Map;e.forEach(i=>{const l=rn(i);t.has(l)||t.set(l,[]),t.get(l).push(i)});const r={shacl:[-7,-5],concept:[-1,0],value:[6,2],construct:[2,6]};for(const[i,l]of t.entries()){const[c,x]=r[i]||r.concept,E=Math.max(2.5,Math.sqrt(l.length)*.85);l.forEach((L,p)=>{const K=p/Math.max(l.length,1)*Math.PI*2,re=E*(.42+p%13/13);L.x=c+Math.cos(K)*re,L.y=x+Math.sin(K)*re})}}function it(e=!1){var r;const t=new pt({type:"directed",multi:!0,allowSelfLoops:!0});V.forEach(i=>{if(!g.has(i.id)||!d.hasNode(i.id))return;const l=d.getNodeAttributes(i.id);t.addNode(i.id,{x:he(i.x,0),y:he(i.y,0),size:he(l.size,zt(i))})}),J.forEach((i,l)=>{if(!Ie(i))return;const c=ee(i.source),x=ee(i.target);!t.hasNode(c)||!t.hasNode(x)||t.addDirectedEdgeWithKey(`l${l}`,c,x)}),(r=s.onLayoutState)==null||r.call(s,"pending"),h.run(t,i=>{var l;Ir(i),qe(),e&&nr(),(l=s.onLayoutState)==null||l.call(s,"ready")},()=>{var i;return(i=s.onLayoutState)==null?void 0:i.call(s,"failed")})}function $r(){d&&d.updateEachNodeAttributes((e,t)=>Object.assign(t,{baseX:he(t.x,0),baseY:he(t.y,0)}),{attributes:["baseX","baseY"]})}function he(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}function st(e){if(!d||!d.hasNode(e))return null;const t=d.getNodeAttributes(e);return{x:he(t.baseX,he(t.x,0)),y:he(t.baseY,he(t.y,0))}}function Nt(e){const t=he(e.size,6),r=String(e.fullLabel||e.label||"");return Math.max(3,Math.min(20,t*.45+r.length*.14))}function Ve(){ke&&(ke(),ke=null)}function Lt(e,t){if(!d)return null;const r={};return e.forEach(i=>{at(r,i,st(i))}),Pt(r,t)}function at(e,t,r){if(!r||!(d!=null&&d.hasNode(t)))return;const i=d.getNodeAttributes(t);(i.x!==r.x||i.y!==r.y)&&(e[t]=r)}function Pt(e,t){return Object.keys(e).length?Zn(d,e,{duration:250,easing:"quadraticOut"},t):null}function $t(){return d?new Set(d.nodes()):new Set}function zr(e,t,r){if(!d||!d.hasNode(e)||!g.has(e))return Lt(t,r);const i=[...gt([e])].filter(Z=>g.has(Z)&&d.hasNode(Z)),l=new Set(i),c={};t.forEach(Z=>{l.has(Z)||at(c,Z,st(Z))});const x=()=>Pt(c,r);if(i.length<2||i.length>120)return x();const E=d.getNodeAttributes(e),L=st(e)||{x:he(E.x,0),y:he(E.y,0)},p=new pt({type:"undirected",multi:!1,allowSelfLoops:!1}),K=i.filter(Z=>Z!==e).sort(),re=Math.min(3,Math.floor(K.length/12)),W=Math.max(28,Math.sqrt(K.length)*12);p.addNode(e,{x:L.x,y:L.y,size:Nt(E)}),K.forEach((Z,de)=>{const be=d.getNodeAttributes(Z),ae=de/Math.max(K.length,1)*Math.PI*2,we=W*(1+Math.floor(de/10)*.75);p.addNode(Z,{x:L.x+Math.cos(ae)*we*1.75,y:L.y+Math.sin(ae)*we*1.1,size:Nt(be)})}),i.forEach(Z=>{(ie.get(Z)||[]).forEach(de=>{if(!Ie(de))return;const be=ee(de.source),ae=ee(de.target);!p.hasNode(be)||!p.hasNode(ae)||be===ae||p.hasEdge(be,ae)||p.addUndirectedEdge(be,ae)})});try{Qn.assign(p,{maxIterations:120,settings:{gridSize:Math.max(1,Math.ceil(Math.sqrt(i.length))),margin:2.4+re*.8,expansion:1.45+re*.12,ratio:1,speed:2}})}catch{return x()}const H=p.getNodeAttributes(e),Q={x:L.x-H.x,y:L.y-H.y};return p.forEachNode((Z,de)=>{const be=de.x+Q.x,ae=de.y+Q.y,we=Z===e?1:1.35;at(c,Z,{x:L.x+(be-L.x)*we,y:L.y+(ae-L.y)*we})}),x()}function qe({centerSelection:e=!1}={}){if(!(!d||!k)){if(Ve(),!A||!d.hasNode(A)||!g.has(A)){ke=Lt($t(),()=>Ee()),Ee();return}ke=zr(A,$t(),()=>{Ee(),e&&ar(A)}),e&&ar(A),Ee()}}function Ir(e){const t=new Map(e.map(i=>[i.id,i])),r=new Map;d.updateEachNodeAttributes((i,l)=>{const c=t.get(i);if(c&&Object.assign(l,{x:c.x,y:c.y}),g.has(i)){const x=`${Math.round(l.x*10)}:${Math.round(l.y*10)}`,E=r.get(x)||0;r.set(x,E+1),E>0&&(l.x+=Math.cos(E)*E*.12,l.y+=Math.sin(E)*E*.12)}return Object.assign(l,{baseX:he(l.x,0),baseY:he(l.y,0)})},{attributes:e.length?["x","y","baseX","baseY"]:["baseX","baseY"]})}function zt(e){const t=le.get(e.id)||0,r=e.shape==="class-anchor"?8:6;return Math.max(5,Math.min(18,r+Math.sqrt(t)*1.7))}function jr(e){return e.shape==="class-anchor"?120:160}function It(e){return e.rendered_kind==="property"?1.55:We(e)||ne(e,"subclass")?1.35:ne(e,"disjoint")?1.2:1}function Mr(e){return e.rendered_kind==="property"||We(e)||ne(e,"subclass")?y:ne(e,"disjoint")?F("--color-role-rdf-nodeshape"):ne(e,"inverse")?F("--color-role-rdf-individual"):C}function Fr(e){return We(e)||e.rendered_kind==="property"||ne(e,"subclass")?y:ne(e,"disjoint")?F("--color-role-rdf-nodeshape"):M}function Gr(e){return jt(e)?"constructDiamondArrow":ne(e,"subclass")?"subclassTriangleArrow":ne(e,"restriction")?"restrictionConnectorArrow":"curvedArrow"}function We(e){return jt(e)}function jt(e){return ne(e,"class-expression")}function Br(e){const t=Number(e.parallelIndex);if(!Number.isFinite(t))return .22;const r=Math.max(1,Math.abs(Number(e.parallelMaxIndex)||0),Math.abs(Number(e.parallelMinIndex)||0)),i=t/r;return Math.abs(i)<.01?.08:Math.max(-.48,Math.min(.48,i*.28))}function Ur(){vo(d),d.forEachEdge((e,t)=>{d.setEdgeAttribute(e,"curvature",Br(t))})}function Xe(e,t,r,i,l){if(!t.label)return;const c=Qr(t);c&&v(e,{...t,label:c},r,i,{...l,edgeLabelColor:{color:ne(t,"subclass")?M:I}})}function Mt(e=!1){const t=e?Ut(F("--color-role-ontology"),.2):F("--color-role-ontology"),r=e?M:y,i=`<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256"><circle cx="128" cy="128" r="120" fill="${Re(t)}"/><text x="128" y="172" font-family="monospace" font-size="144" font-weight="700" text-anchor="middle" fill="${Re(r)}">${fr["semantic-query"].glyph}</text></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`}function Ye(e,t=!1){const r=Qe(e),i=ye(e,"restriction"),l=t?M:y,c=t?"0.2":"1",E=`<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 256 256">
|
|
538
|
+
${i?Vr(r,l,c):Hr(Kr({label:r}),l,c)}
|
|
539
|
+
</svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(E)}`}function Hr(e,t,r){const i=Re(e||"U");return`<text x="128" y="142" font-family="Arial, Helvetica, sans-serif" font-size="112" font-weight="800" text-anchor="middle" fill="${Re(t)}" fill-opacity="${Re(r)}">${i}</text>`}function Vr(e,t,r){const i=Re(e||"R");return`<text x="128" y="142" font-family="Arial, Helvetica, sans-serif" font-size="112" font-weight="800" text-anchor="middle" fill="${Re(t)}" fill-opacity="${Re(r)}">${i}</text>`}function Ke(e){return ye(e,"class-expression")||ye(e,"restriction")}function ye(e,t){return qr(e).has(t)}function qr(e){const t=new Set;if(!e)return t;const r=String(e.semantic_type||"");return r==="restriction"&&t.add("restriction"),r==="class-expression"&&t.add("class-expression"),(e.constructs||[]).forEach(i=>{Jt(i).forEach(l=>t.add(l))}),t}function Qe(e){return ye(e,"restriction")?Xr(e):Ft(e)}function Wr(e){if(ye(e,"restriction"))return Yr(e);const t=String(Ft(e)||"").toLowerCase();return t.includes("intersection")?"Intersection":t.includes("complement")?"Complement":t.includes("union")?"Union":"Class expression"}function Ft(e){const t=(e.constructs||[]).find(r=>{const i=String(r.kind||""),l=String(r.family||""),c=String(r.label||r.class_expression_kind||r.classExpressionKind||"").toLowerCase();return i==="class-expression"||l==="class-expression"||c==="union"||c==="intersection"||c==="complement"});return t?t.label||t.class_expression_kind||t.classExpressionKind||"":fe(e)}function Xr(e){const t=(e.constructs||[]).find(i=>{const l=String(i.kind||""),c=String(i.family||"");return l==="restriction"||c==="restriction"}),r=String(t&&(t.label||t.restriction_kind||t.restrictionKind)||fe(e)||"").toLowerCase();return r.includes("universal")?"∀":r.includes("existential")?"∃":r.includes("min")?"≥":r.includes("max")?"≤":r.includes("cardinality")?"=":"R"}function Yr(e){const t=(e.constructs||[]).find(i=>{const l=String(i.kind||""),c=String(i.family||"");return l==="restriction"||c==="restriction"}),r=String(t&&(t.label||t.restriction_kind||t.restrictionKind)||fe(e)||"").toLowerCase();return r.includes("universal")?"Universal restriction":r.includes("existential")?"Existential restriction":r.includes("min")?"Min cardinality":r.includes("max")?"Max cardinality":r.includes("cardinality")?"Cardinality restriction":"Restriction"}function Kr(e){const t=String(Je(e)||e.class_expression_kind||e.classExpressionKind||"").toLowerCase();return t.includes("intersection")?"∩":t.includes("complement")?"¬":t.includes("union")?"∪":"U"}function Qr(e){const t=Je(e);return We(e)||ne(e,"shape-overlay")&&Zr(t)?"":ne(e,"subclass")?"Subclass of":ne(e,"membership")?"member":t}function Zr(e){return String(e||"").toLowerCase().includes("shape overlay")}function Gt(e){if(Ke(e))return Qe(e);const t=on(e.display_label||fe(e),jr(e)),r=ut(e);return r?`${t} ${r}`:t}function Bt(e){if(Ke(e))return Wr(e);const t=e.display_label||fe(e),r=ut(e);return r?`${t} ${r}`:t}function Ut(e,t){const r=Vt(Ht(e)),i=Vt(F("--bg-canvas"));if(!r||!i)return e;const l=Math.round(r.r*t+i.r*(1-t)),c=Math.round(r.g*t+i.g*(1-t)),x=Math.round(r.b*t+i.b*(1-t));return`#${[l,c,x].map(E=>E.toString(16).padStart(2,"0")).join("")}`}function Ht(e){if(!e)return"";const t=String(e).trim();if(t.startsWith("var(")){const r=t.match(/^var\((--[a-z0-9-]+)(?:,\s*([^)]+))?\)$/i);if(r)return F(r[1])}return t}function Vt(e){var E;const t=Ht(e);if(!t)return null;if(t.startsWith("#"))return Jr(t);const r=t.match(/rgba?\(\s*([\d.]+)(?:,|\s+)\s*([\d.]+)(?:,|\s+)\s*([\d.]+)(?:\s*[,/]\s*([\d.]+%?))?/i);if(!r)return null;const i=Number(r[1]),l=Number(r[2]),c=Number(r[3]),x=(E=r[4])!=null&&E.endsWith("%")?Number(r[4].slice(0,-1))/100:r[4]===void 0?1:Number(r[4]);return!Number.isNaN(x)&&x<=0||[i,l,c].some(L=>Number.isNaN(L))?null:{r:i,g:l,b:c}}function Jr(e){const t=e.slice(1),r=t.length===3?t.split("").map(x=>x+x).join(""):t.padEnd(6,"0").slice(0,6),i=parseInt(r.slice(0,2),16),l=parseInt(r.slice(2,4),16),c=parseInt(r.slice(4,6),16);return[i,l,c].some(x=>Number.isNaN(x))?null:{r:i,g:l,b:c}}function Dr(e,t,r){const i=[],l=new Set;return e.forEach(c=>{const x=ee(c.source),E=ee(c.target);!x||!E||c.source_kind!=="query"&&(Ge(t.get(x))||Ge(t.get(E)))||qt(i,l,{...c,source:x,target:E,rendered_kind:"construct"})}),r.forEach(c=>{const x=Ze(c.domain),E=Ze(c.range);x.forEach(L=>{E.forEach(p=>{L.iri!==p.iri&&qt(i,l,{source:L.iri,target:p.iri,label:fe(c),rendered_kind:"property",property_node_id:c.id,property_kind:c.semantic_type||"rdf-property"})})})}),i}function qt(e,t,r){const i=ee(r.source),l=ee(r.target);if(!i||!l||!ct(i)||!ct(l))return;const c=[i,l,r.label||"",r.rendered_kind||"",r.property_node_id||""].join("|");t.has(c)||(t.add(c),e.push(r))}function ct(e){const t=z.get(e);return!!(t&&(!Ge(t)||q.has(e)))}function Ze(e){return(e||[]).filter(t=>t&&t.iri&&ct(t.iri))}function Ge(e){const t=String(e&&e.semantic_type||"");return t==="object-property"||t==="datatype-property"||t==="rdf-property"}function en(e,t){const r=new Map(e.map(i=>[i.id,0]));return t.forEach(i=>{if(!tn(i))return;const l=ee(i.source),c=ee(i.target);r.has(l)&&r.set(l,r.get(l)+1),r.has(c)&&c!==l&&r.set(c,r.get(c)+1)}),r}function tn(e){return e.property_kind!=="datatype-property"}function Je(e){return e.display_label||e.label||""}function rn(e){const t=String(e.semantic_type||"");return t==="node-shape"||t==="property-shape"?"shacl":t.endsWith("property")?"property":t==="named-individual"||t==="datatype"||t==="resource"?"value":ye(e,"restriction")||ye(e,"class-expression")?"construct":"concept"}function nn(e){return String(e.semantic_type||"")==="class"||ye(e,"restriction")||ye(e,"class-expression")?"class-anchor":"box"}function on(e,t){const r=String(e||""),i=Math.max(8,Math.floor((t-20)/7));return r.length>i?`${r.slice(0,i-1)}...`:r}function N(e){return String(e||"").replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'")}function sn(e,t){const r=new DOMParser().parseFromString(`<body>${t}</body>`,"text/html");e.replaceChildren(...Array.from(r.body.childNodes))}function an(e){const t=document.createElement("p");t.className="text-gray-500 italic m-0",t.textContent="Search or select a graph node to inspect URI, RDF type, comments, and SHACL constraints.",e.replaceChildren(t)}function Re(e){return N(e)}function Be(e){const t=String(e||""),r=t.split(/[/#]/).filter(Boolean);return r.length?r[r.length-1]:t}function cn(e){const t=(e.constructs||[]).find(l=>l.kind==="class-expression"),r=t?t.members||[]:[];if(!r.length)return e.label||"Class expression";const i=t.label==="Intersection"?" ∩ ":t.label==="Complement"?" ∖ ":" ∪ ";return r.map(Be).join(i)}function fe(e){if(!e||e.semantic_type!=="class-expression")return e&&(e.label||e.id)||"";const t=(e.constructs||[]).find(c=>c.kind==="property-domain"||c.kind==="property-range"),r=cn(e);if(!t)return r;const i=Be(t.subject||t.property||""),l=t.kind==="property-domain"?"domain":"range";return i?`${i} ${l}: ${r}`:`${l}: ${r}`}function lt(e){return`${e.label} (symbol ${e.symbol})`}function ln(e){return!e||!e.length?"":`<div class="ontology-badge-row">${e.map(r=>{const i=N(lt(r));return`<span class="ontology-badge" role="img" aria-label="${i}" title="${i}"><span class="ontology-badge-symbol" aria-hidden="true">${N(r.symbol)}</span><span class="ontology-badge-text">${N(r.label)}</span></span>`}).join("")}</div>`}function un(e){const t=String(e&&e.kind||"");return t==="subset-or-equal"?"subclass":t==="member-of"?"membership":t==="disjointness"?"disjoint":t==="logical-equivalence"?"equivalence":t==="inverse-property"?"inverse":["functional","inverse-functional","symmetric","asymmetric","reflexive","irreflexive","transitive"].includes(t)?"property-characteristic":t==="universal-restriction"||t==="existential-restriction"?"restriction":t==="intersection"||t==="union"||t==="set-difference"?"class-expression":""}function fn(e){return(e.badges||[]).filter(t=>{const r=un(t);return r?f.construct.has(r)&&Un(r):!0})}function ut(e){return fn(e).map(t=>t.symbol).join(" ")}function Wt(e){return e.constructs||[]}function dn(e){return e.slot_facets||[]}function gn(e){const t=String(e||""),r=t.startsWith("equivalence:")?t.slice(12):t;return r?r.split("|").filter(Boolean):[]}function Xt(e){return!e||!e.length?'<span class="text-gray-400 italic">None</span>':e.map(t=>`<span class="ontology-rel-pill" title="${N(t)}">${N(Be(t))}</span>`).join("")}const pn={"semantic-query":"Semantic query","object-property":"Object property","datatype-property":"Datatype property","rdf-property":"RDF property",class:"Class","named-individual":"Named individual","node-shape":"SHACL node shape","property-shape":"SHACL property shape",restriction:"OWL restriction","class-expression":"Class expression",datatype:"Datatype","skos-concept":"SKOS concept","skos-concept-scheme":"SKOS concept scheme",literal:"Literal",resource:"Resource"};function De(e){return pn[e]||e||"Resource"}function Pe(e,t){return!e||!e.length?`<span class="text-gray-400 italic">${N(t)}</span>`:e.map(r=>{const i=String(r.kind||"class"),l=N(r.iri||r.label||"");return`<span class="ontology-term-ref ontology-term-${N(i)}" title="${l}">${N(r.label||r.iri||"")}<span class="ontology-term-kind">${N(i)}</span></span>`}).join("")}function hn(e){return!e||!e.length?"":`<div class="ontology-meta-section">
|
|
540
|
+
<div class="ontology-meta-title">Literal Values</div>
|
|
541
|
+
${e.map(t=>`<div class="ontology-literal-value"><span>${N(t.predicate||"value")}</span><strong>${N(t.value||"")}</strong></div>`).join("")}
|
|
542
|
+
</div>`}function vn(e){return!e||!e.length?'<span class="text-gray-400 italic">No source recorded.</span>':e.map(t=>{const r=t.source_name||t.source||t.file_path||"source",i=t.line_number?`${t.file_path}:${t.line_number}`:t.file_path||"",l=t.kind?`<span class="ontology-source-kind">${N(t.kind)}</span>`:"",c=t.link?N(t.link):"",x=N(t.source||i||r),E=c?`<a class="ontology-source-name" href="${c}" title="${x}">${N(r)}</a>`:`<span>${N(r)}</span>`,L=c?`<a class="ontology-source-loc" href="${c}" title="${x}">${N(i)}</a>`:`<span class="ontology-source-loc">${N(i)}</span>`;return`<div class="ontology-source"><span>${E}${l}</span>${L}</div>`}).join("")}function yn(e){const t=(e.members||[]).map(l=>N(Be(l))),r=t.length?t.join('<span class="ontology-chain-sep">∘</span>'):'<span class="text-gray-400 italic">Empty chain</span>',i=e.source?`<div class="ontology-chain-source">${N(e.source)}</div>`:"";return`<div class="ontology-chain"><div>${r}</div>${i}</div>`}function mn(e){const t=e.id,r=[];return X.forEach(i=>{const l=Ze(i.domain),c=Ze(i.range),x=l.some(L=>L.iri===t),E=c.some(L=>L.iri===t);!x&&!E||r.push({isDomain:x,isRange:E,property:i,domains:l,ranges:c,facets:x?bn(i,e):[]})}),r.sort((i,l)=>{const c=fe(i.property).localeCompare(fe(l.property));if(c)return c;const x=Yt(i),E=Yt(l);return x.localeCompare(E)}),r}function bn(e,t){return(t.slot_facets||[]).filter(r=>r.slot_iri===e.id)}function _n(e){const t=mn(e);return t.length?`<div class="ontology-meta-section">
|
|
543
|
+
<div class="ontology-meta-title">Properties</div>
|
|
544
|
+
${t.map(xn).join("")}
|
|
545
|
+
</div>`:""}function xn(e){const t=e.property,r=fe(t)||t.id,i=De(t.semantic_type),l=e.facets&&e.facets.length?`<div class="ontology-slot-facet-values">${e.facets.flatMap(c=>c.facets||[]).map(c=>`<span class="ontology-slot-facet-pill"><span>${N(c.name)}</span>${N(c.value)}</span>`).join("")}</div>`:"";return`<div class="ontology-property-usage"><div class="ontology-property-usage-title"><strong title="${N(t.full_uri||t.id)}">${N(r)}</strong><span class="ontology-property-kind">${N(i)}</span></div><div class="ontology-property-usage-body">${wn(e)}</div>`+l+"</div>"}function Yt(e){return e.isDomain&&e.isRange?"domain and range":e.isDomain?"domain":"range"}function wn(e){return e.isDomain&&e.isRange?`<span>domain/range</span> property; Domain ${Pe(e.domains,"Any")}; Range ${Pe(e.ranges,"Any")}`:e.isDomain?`<span>domain</span> property; Range ${Pe(e.ranges,"Any")}`:`<span>range</span> property; Domain ${Pe(e.domains,"Any")}`}function Tn(e){if(e.kind==="class-expression")return Kt(e);const t=e.badge?`<span class="ontology-construct-symbol" title="${N(lt(e.badge))}">${N(e.badge.symbol)}</span>`:"",r=[];e.subject&&r.push(`subject=${e.subject}`),e.predicate&&r.push(`predicate=${e.predicate}`),e.property&&r.push(`property=${e.property}`),e.object&&r.push(`object=${e.object}`),e.members&&e.members.length&&r.push(`members=${e.members.join(" -> ")}`);const i=e.source&&(e.source.source_name||e.source.source||e.source.file_path)?`source=${e.source.source_name||e.source.source||e.source.file_path}${e.source.line_number?":"+e.source.line_number:""}`:"";i&&r.push(i);const l=r.length?`<div class="ontology-construct-meta">${N(r.join(" | "))}</div>`:"";return`<div class="ontology-construct"><div class="ontology-construct-title">${t}<span>${N(e.label||e.kind||"Construct")}</span></div>`+l+"</div>"}function Kt(e){const t=e.badge?`<span class="ontology-construct-symbol" title="${N(lt(e.badge))}">${N(e.badge.symbol)}</span>`:"",r=(e.members||[]).length?`<div class="ontology-construct-members">${e.members.map((l,c)=>`<div class="ontology-construct-member"><strong>${c+1}.</strong> ${N(Be(l))}</div>`).join("")}</div>`:'<span class="text-gray-400 italic">No members recorded.</span>',i=e.source&&(e.source.source_name||e.source.source||e.source.file_path)?`<div class="ontology-construct-meta">source=${N(e.source.source_name||e.source.source||e.source.file_path)}${e.source.line_number?":"+N(e.source.line_number):""}</div>`:"";return`<div class="ontology-construct"><div class="ontology-construct-title">${t}<span>${N(e.label||"Class expression")}</span></div>`+r+i+"</div>"}function Sn(e){return String(e||"").startsWith("_:")}function En(e){return Wt(e).filter(t=>t.kind==="class-expression")}function kn(e){const t=e.id;return J.filter(r=>ee(r.source)===t||ee(r.target)===t).map(r=>{const i=ee(r.source),l=ee(r.target),c=Y.get(i),x=Y.get(l),E=i===t?"to":"from",L=i===t?x:c;return{label:r.label||"relation",direction:E,other:L?L.label||L.id:E==="to"?l:i}})}function Rn(e){if(e.semantic_type!=="class-expression")return"";const t=En(e),r=t.length?`<div class="ontology-meta-section">
|
|
546
|
+
<div class="ontology-meta-title">Expression Members</div>
|
|
547
|
+
${t.map(Kt).join("")}
|
|
548
|
+
</div>`:"",i=kn(e).filter(c=>!["union","intersection","complement"].includes(String(c.label||""))),l=i.length?`<div class="ontology-meta-section">
|
|
549
|
+
<div class="ontology-meta-title">Used As</div>
|
|
550
|
+
<div class="ontology-construct-usages">${i.map(c=>`<div class="ontology-construct-usage"><strong>${N(c.label)}</strong> ${N(c.direction)} ${N(c.other)}</div>`).join("")}</div>
|
|
551
|
+
</div>`:"";return r+l}function On(e,t){const r=e.full_uri||"";return Sn(r)&&e.semantic_type==="class-expression"?`<details class="ontology-raw-details">
|
|
552
|
+
<summary>Raw Details</summary>
|
|
553
|
+
<div class="ontology-meta-title">Blank Node Identifier</div>
|
|
554
|
+
<div class="ontology-uri-block">${N(r)}</div>
|
|
555
|
+
</details>`:`<div class="ontology-meta-section">
|
|
556
|
+
<div class="ontology-meta-title">${N(t)}</div>
|
|
557
|
+
<div class="ontology-uri-block">${N(r)}</div>
|
|
558
|
+
</div>`}function Cn(e,t){const r=t==="property",i=(e.facets||[]).length?`<div class="ontology-slot-facet-values">${e.facets.map(p=>`<span class="ontology-slot-facet-pill"><span>${N(p.name)}</span>${N(p.value)}</span>`).join("")}</div>`:'<span class="text-gray-400 italic">No explicit facets.</span>',l=e.slot_label||e.slot_iri||"slot",c=e.target_class_label||e.target_class_iri||"target class",x=r?`Class ${c}`:l,E=r?e.target_class_iri||e.target_class_label||"":e.slot_iri||e.slot_label||"",L=r?`<div class="ontology-slot-facet-target">Path ${N(l)}</div>`:e.target_class_label?`<div class="ontology-slot-facet-target">Class ${N(e.target_class_label)}</div>`:"";return`<div class="ontology-slot-facet"><div class="ontology-slot-facet-title"><strong title="${N(E)}">${N(x)}</strong><span class="ontology-slot-facet-source">${N(e.source_shape_label||"shape")}</span></div>`+L+i+"</div>"}function An(e){const t=(e.badges||[]).map(p=>`${p.label} ${p.symbol} ${p.code_point}`).join(" "),r=(e.property_chains||[]).map(p=>`${(p.members||[]).join(" ")} ${p.source||""}`).join(" "),i=[].concat(e.domain||[],e.range||[]).map(p=>`${p.label||""} ${p.iri||""} ${p.kind||""}`).join(" "),l=(e.constraints||[]).map(p=>`${p.property||""} ${p.value||""}`).join(" "),c=(e.sources||[]).map(p=>`${p.source||""} ${p.source_name||""} ${p.file_path||""} ${p.kind||""}`).join(" "),x=(e.constructs||[]).map(p=>[p.id,p.family,p.kind,p.label,p.subject,p.predicate,p.object,p.property,(p.members||[]).join(" "),p.source?`${p.source.source||""} ${p.source.source_name||""} ${p.source.file_path||""}`:"",p.badge?`${p.badge.label||""} ${p.badge.symbol||""} ${p.badge.code_point||""}`:""].join(" ")).join(" "),E=(e.slot_facets||[]).map(p=>[p.slot_label,p.slot_iri,p.target_class_label,p.target_class_iri,p.source_shape_label,p.source_shape_iri,(p.facets||[]).map(K=>`${K.name} ${K.value}`).join(" ")].join(" ")).join(" "),L=(e.literal_values||[]).map(p=>`${p.predicate||""} ${p.value||""} ${p.source&&(p.source.source_name||p.source.source||p.source.file_path)||""}`).join(" ");return[fe(e),e.label,e.full_uri,e.ontology_document||"",e.type||"",e.semantic_type||"",(e.rdf_types||[]).join(" "),t,e.equivalence_group||"",(e.inverse_properties||[]).join(" "),r,i,l,L,E,c,x].join(" ").toLowerCase()}function Qt(e){a==null||a(e);const t=document.getElementById("ontology-inspector-title"),r=document.getElementById("ontology-inspector-body"),i=document.getElementById("ontology-inspector-clear");if(!t||!r||!i)return;t.textContent=fe(e)||e.id,i.style.display="block";const l=String(e.full_uri||"").startsWith("_:")?"Blank Node Identifier":"Full URI",c=e.rdf_types&&e.rdf_types.length?e.rdf_types.map(Oe=>`<span class="ontology-type-pill">${N(Oe)}</span>`).join(""):`<span class="text-gray-400 italic">Implicit ${N(e.type)} entity</span>`,x=e.constraints&&e.constraints.length?`<div class="ontology-meta-section">
|
|
559
|
+
<div class="ontology-meta-title">Raw SHACL Evidence</div>
|
|
560
|
+
${e.constraints.map(Oe=>`<div class="ontology-constraint"><span>${N(Oe.property)}</span><strong>${N(Oe.value)}</strong></div>`).join("")}
|
|
561
|
+
</div>`:"",E=ln(e.badges||[]),L=e.equivalence_group?`<div class="ontology-meta-section">
|
|
562
|
+
<div class="ontology-meta-title">Equivalence Group</div>
|
|
563
|
+
<div>${Xt(gn(e.equivalence_group))}</div>
|
|
564
|
+
</div>`:"",p=e.inverse_properties&&e.inverse_properties.length?`<div class="ontology-meta-section">
|
|
565
|
+
<div class="ontology-meta-title">Inverse Properties</div>
|
|
566
|
+
<div>${Xt(e.inverse_properties)}</div>
|
|
567
|
+
</div>`:"",K=e.property_chains&&e.property_chains.length?`<div class="ontology-meta-section">
|
|
568
|
+
<div class="ontology-meta-title">Property Chains</div>
|
|
569
|
+
${e.property_chains.map(yn).join("")}
|
|
570
|
+
</div>`:"",re=Wt(e).filter(Oe=>e.semantic_type!=="class-expression"?!0:!["class-expression","property-domain","property-range"].includes(Oe.kind)),W=re.length?`<div class="ontology-meta-section">
|
|
571
|
+
<div class="ontology-meta-title">Projection Constructs</div>
|
|
572
|
+
${re.map(Tn).join("")}
|
|
573
|
+
</div>`:"",H=Rn(e),Q=hn(e.literal_values),Z=On(e,l),de=e.ontology_document?`<div class="ontology-meta-section">
|
|
574
|
+
<div class="ontology-meta-title">OWL Document</div>
|
|
575
|
+
<div class="ontology-uri-block">${N(e.ontology_document)}</div>
|
|
576
|
+
</div>`:"",be=_n(e),ae=String(e.semantic_type||"").endsWith("property")||e.domain&&e.domain.length||e.range&&e.range.length,we=dn(e),_e=we.length?`<div class="ontology-meta-section">
|
|
577
|
+
<div class="ontology-meta-title">${ae?"Used As Slot / Facets":"Slots / Facets"}</div>
|
|
578
|
+
${we.map(Oe=>Cn(Oe,ae?"property":"class")).join("")}
|
|
579
|
+
</div>`:"",Hn=ae?`<div class="ontology-meta-section">
|
|
580
|
+
<div class="ontology-meta-title">Domain</div>
|
|
581
|
+
<div>${Pe(e.domain,"Any (unconstrained)")}</div>
|
|
582
|
+
</div>`:"",Vn=ae?`<div class="ontology-meta-section">
|
|
583
|
+
<div class="ontology-meta-title">Range</div>
|
|
584
|
+
<div>${Pe(e.range,"Any (unconstrained)")}</div>
|
|
585
|
+
</div>`:"";sn(r,`
|
|
586
|
+
${E}
|
|
587
|
+
<div class="ontology-meta-section">
|
|
588
|
+
<div class="ontology-meta-title">Kind</div>
|
|
589
|
+
<div><span class="ontology-kind-pill">${N(De(e.semantic_type))}</span></div>
|
|
590
|
+
</div>
|
|
591
|
+
<div class="ontology-meta-section">
|
|
592
|
+
<div class="ontology-meta-title">RDF Type</div>
|
|
593
|
+
<div>${c}</div>
|
|
594
|
+
</div>
|
|
595
|
+
${Z}
|
|
596
|
+
${de}
|
|
597
|
+
<div class="ontology-meta-section">
|
|
598
|
+
<div class="ontology-meta-title">Description</div>
|
|
599
|
+
<p class="m-0">${N(e.comment||"None specified.")}</p>
|
|
600
|
+
</div>
|
|
601
|
+
${Q}
|
|
602
|
+
${H}
|
|
603
|
+
${be}
|
|
604
|
+
${Hn}
|
|
605
|
+
${Vn}
|
|
606
|
+
${_e}
|
|
607
|
+
${L}
|
|
608
|
+
${p}
|
|
609
|
+
${K}
|
|
610
|
+
${W}
|
|
611
|
+
<div class="ontology-meta-section">
|
|
612
|
+
<div class="ontology-meta-title">Sources</div>
|
|
613
|
+
${vn(e.sources)}
|
|
614
|
+
</div>
|
|
615
|
+
${x}
|
|
616
|
+
`)}function ee(e){return typeof e=="string"?e:e&&e.id?e.id:""}function $e(e,t){for(const r of e||[])if(t.has(r))return!0;return!1}function Nn(e){return new Set([zn(e)])}function Ln(e){const t=new Set;return ze(e)&&t.add("construct"),Dt(e)&&t.add("authored"),t.size||t.add("registry"),t}function Pn(e){return new Set([Zt(e&&e.layer)])}function $n(e){return new Set([Zt(e&&e.layer)])}function Zt(e){return e==="concepts"?"layer-concepts":e==="reqvire-context"?"layer-reqvire-context":e==="external-source"?"layer-external-source":"layer-authored"}function zn(e){if(In(e))return"external-reference";const t=e.semantic_type||"resource";return t==="semantic-query"?"semantic-query":q.has(e.id)?"ontology-term":["object-property","datatype-property","rdf-property"].includes(t)?"property":["node-shape","property-shape"].includes(t)?"shacl-shape":t==="resource"?"resource":"ontology-term"}function In(e){const t=String(e.full_uri||e.id||"");return t.startsWith("http://www.w3.org/2001/XMLSchema#")||t.startsWith("http://www.w3.org/1999/02/22-rdf-syntax-ns#")||t.startsWith("http://www.w3.org/2000/01/rdf-schema#")||t.startsWith("http://www.w3.org/2002/07/owl#")||t.startsWith("http://www.w3.org/ns/shacl#")}function jn(e){const t=new Set,r=String(e.semantic_type||"");return r==="restriction"&&t.add("restriction"),r==="class-expression"&&t.add("class-expression"),(e.constructs||[]).forEach(i=>{Jt(i).forEach(l=>t.add(l))}),(e.inverse_properties||[]).length&&t.add("inverse"),(e.property_chains||[]).length&&t.add("property-chain"),((e.domain||[]).length||(e.range||[]).length)&&t.add("domain-range"),(e.slot_facets||[]).length&&t.add("shape-overlay"),t}function Mn(e){const t=new Set,r=String(e.label||"");return e.rendered_kind==="property"&&t.add("domain-range"),(r==="domain"||r==="range")&&t.add("domain-range"),r==="subclass"&&t.add("subclass"),r==="member"&&t.add("membership"),r==="disjoint"&&t.add("disjoint"),r==="inverse"&&t.add("inverse"),(r==="on property"||r.endsWith("restriction"))&&t.add("restriction"),["intersection","union","complement","class-expression"].includes(r)&&t.add("class-expression"),r.includes("shape overlay")&&t.add("shape-overlay"),t}function Jt(e){const t=String(e&&e.kind||""),r=String(e&&e.family||""),i=new Set;return(t==="property-domain"||t==="property-range"||r==="property-domain-range")&&i.add("domain-range"),t==="subclass-inclusion"&&i.add("subclass"),t==="membership"&&i.add("membership"),t==="disjointness"&&i.add("disjoint"),t==="equivalence-group"&&i.add("equivalence"),t==="inverse-property"&&i.add("inverse"),(t==="property-chain"||r==="property-chain")&&i.add("property-chain"),(t==="property-characteristic"||r==="property-characteristic")&&i.add("property-characteristic"),(t==="restriction"||r==="restriction")&&i.add("restriction"),(t==="class-expression"||r==="class-expression")&&i.add("class-expression"),(t==="shape-overlay"||r==="shape-overlay")&&i.add("shape-overlay"),i}function ze(e){const t=String(e.id||e.full_uri||"");return ye(e,"restriction")||ye(e,"class-expression")?!0:t.startsWith("urn:reqvire:ontology-construct")||t.startsWith("urn:reqvire:ontology-member")||t.startsWith("urn:reqvire:ontology-symbol")}function Dt(e){return(e.sources||[]).some(t=>t.kind==="ontology"||t.kind==="shapes"||t.kind==="query")}function er(e){return!$e(e._ontologyLayers,f.layer)||!$e(e._ontologyRoles,f.role)||!$e(e._ontologyOrigins,f.origin)||!Gn(e)?!1:ze(e)?$e(e._ontologyConstructs,f.construct):(e.layer||"authored")!=="authored"?!0:Dt(e)}function Fn(e){const t=e._ontologyConstructs&&e._ontologyConstructs.size>0;return!$e(e._ontologyLayers,f.layer)||!Bn(e)?!1:e.source_kind==="query"||(e.layer||"authored")!=="authored"?!0:t&&$e(e._ontologyConstructs,f.construct)}function Gn(e){return!(!u.has("class-expressions")&&ye(e,"class-expression")||!u.has("restrictions")&&ye(e,"restriction"))}function Bn(e){return!(!u.has("class-disjointness")&&ne(e,"disjoint")||!u.has("class-membership")&&ne(e,"membership")||!u.has("restrictions")&&ne(e,"restriction")||!u.has("class-expressions")&&ne(e,"class-expression")||!f.role.has("shacl-shape")&&ne(e,"shape-overlay"))}function ne(e,t){return!!(e._ontologyConstructs&&e._ontologyConstructs.has(t))}function Un(e){return!(e==="membership"&&!u.has("class-membership")||e==="disjoint"&&!u.has("class-disjointness")||e==="restriction"&&!u.has("restrictions")||e==="class-expression"&&!u.has("class-expressions")||e==="shape-overlay"&&!f.role.has("shacl-shape"))}function tr(){const e=new Set;return V.forEach(t=>{er(t)&&e.add(t.id)}),e}function Ie(e){const t=ee(e.source),r=ee(e.target);return Fn(e)&&g.has(t)&&g.has(r)}function rr(){g=tr(),Te+=1,Ae="",d&&(V.forEach(t=>{d.hasNode(t.id)&&(d.setNodeAttribute(t.id,"hidden",!g.has(t.id)),d.setNodeAttribute(t.id,"label",Gt(t)),d.setNodeAttribute(t.id,"fullLabel",Bt(t)))}),J.forEach((t,r)=>{const i=`o${r}`;d.hasEdge(i)&&d.setEdgeAttribute(i,"hidden",!Ie(t))})),document.querySelectorAll(".ontology-filter-toggle").forEach(t=>{const r=t.dataset.filterCategory,i=t.dataset.filterValue,l=r==="relation"?u.has(i):!!(f[r]&&f[r].has(i));t.classList.toggle("is-active",l),t.setAttribute("aria-pressed",l?"true":"false")});const e=document.getElementById("ontology-graph-search");e&&e.value.trim()&&window.filterOntologyGraph(e.value),A&&Y.has(A)&&Qt(Y.get(A)),qe(),it()}window.filterOntologyGraph=function(e){const t=document.getElementById("ontology-graph-results");if(!t)return;const r=e.trim().toLowerCase();if(!r){t.style.display="none",t.replaceChildren();return}t.style.listStyle="none",t.style.overflowY="auto";const i=V.filter(l=>g.has(l.id)&&An(l).includes(r)).slice(0,40);if(!i.length){const l=document.createElement("li");l.className="ontology-graph-result text-gray-400",l.style.listStyle="none",l.textContent="No matching nodes found",t.replaceChildren(l),t.style.display="block";return}t.replaceChildren(...i.map(l=>{const c=document.createElement("li");c.style.listStyle="none",c.setAttribute("role","presentation");const x=document.createElement("button");x.type="button",x.className="ontology-graph-result",c.style.listStyle="none",x.setAttribute("aria-label",`Focus ${fe(l)} (${De(l.semantic_type)})`),x.addEventListener("click",()=>window.focusOntologyNode(l.id));const E=document.createElement("span");E.className="ontology-graph-result-label",E.textContent=fe(l),E.title=fe(l);const L=document.createElement("span");L.className="ontology-graph-result-glyph",L.setAttribute("data-semantic-type",String(l.semantic_type||l.node_type||"resource")),L.title=De(l.semantic_type),l.semantic_type==="semantic-query"&&(L.textContent=fr["semantic-query"].glyph);const p=ut(l);if(p){const K=document.createElement("span");K.className="ontology-graph-badge",K.textContent=p,K.title=p,x.append(L,E,K)}else x.append(L,E);return c.append(x),c})),t.style.display="block"},window.focusOntologyNode=function(e){const t=Y.get(e);if(!t||!g.has(e)||!d||!d.hasNode(e))return;A=e,a==null||a(t);const r=document.getElementById("ontology-graph-results"),i=document.getElementById("ontology-graph-search");r&&(r.style.display="none"),i&&(i.value=""),Qt(t),qe({centerSelection:!0})},window.clearOntologySelection=function(){A=null,B=null,a==null||a(null);const e=document.getElementById("ontology-inspector-clear"),t=document.getElementById("ontology-inspector-title"),r=document.getElementById("ontology-inspector-body");e&&(e.style.display="none"),t&&(t.textContent="Node Inspector"),r&&an(r),qe()};function nr(){!k||!d||k.getCamera().animatedReset({duration:250})}window.fitOntologyGraph=nr,window.resetOntologyGraphLayout=function(){d&&(At(V),Ve(),it(!0),Ee())};function Ee(){k&&k.refresh()}function ft(){const e=[];return A&&g.has(A)&&e.push(A),e}function dt(){const e=[];return B&&B!==A&&g.has(B)&&e.push(B),e}function or(){const e=ft().filter(r=>g.has(r));if(!e.length)return new Set;const t=`${Te}|${e.join("")}`;return Ae===t||(Ae=t,Fe=gt(e)),Fe}function ir(){const e=dt().filter(t=>g.has(t));return e.length?gt(e):new Set}function gt(e){const t=new Set(e),r=new Set,i=[],l=new Set;for(e.forEach(c=>{g.has(c)&&(r.add(c),i.push(c))});i.length;){const c=i.shift();if(l.has(c))continue;const x=Y.get(c);(t.has(c)||x&&ze(x))&&(l.add(c),(ie.get(c)||[]).forEach(L=>{if(!Ie(L))return;const p=ee(L.source),K=ee(L.target);if(p!==c&&K!==c)return;const re=p===c?K:p;if(!g.has(re))return;r.add(re);const W=Y.get(re);W&&ze(W)&&!l.has(re)&&i.push(re)}))}return r}function sr(e,t,r){const i=ee(e.source),l=ee(e.target);if(!r.has(i)||!r.has(l))return!1;if(t.some(E=>i===E||l===E))return!0;const c=Y.get(i),x=Y.get(l);return!!(c&&ze(c)||x&&ze(x))}function ar(e){if(!k||!d||!d.hasNode(e))return;const t=k.getNodeDisplayData(e);if(!t)return;const r=k.getCamera(),i=r.getState();r.animate({x:t.x,y:t.y,ratio:Math.min(i.ratio,.9)},{duration:280})}window.setOntologyGraphFilter=function(e,t,r){if(!t)return;const i=e==="relation"?u:f[e];!i||i.has(t)===r||(r?i.add(t):i.delete(t),rr())};function cr(e){const t=new Set(e||[]),r={role:new Set(["ontology-term","shacl-shape","resource","external-reference"]),construct:new Set(["domain-range","subclass","membership","disjoint","equivalence","inverse","property-chain","property-characteristic","class-expression","shape-overlay"].filter(c=>t.has(c))),origin:new Set(["authored","registry","construct"].filter(c=>t.has(c))),layer:new Set(["layer-authored","layer-concepts","layer-reqvire-context","layer-external-source"].filter(c=>t.has(c)))};t.has("semantic-query")&&r.role.add("semantic-query");const i=new Set(["class-membership"]);["class-disjointness","class-expressions"].forEach(c=>{t.has(c)&&i.add(c)});const l=(c,x)=>c.size===x.size&&[...c].every(E=>x.has(E));return Object.keys(r).every(c=>l(f[c],r[c]))&&l(u,i)?!1:(Object.assign(f,r),u=i,!0)}window.syncOntologyGraphFilters=function(e){cr(e)&&rr()};const se={filterOntologyGraph:window.filterOntologyGraph,focusOntologyNode:window.focusOntologyNode,clearOntologySelection:window.clearOntologySelection,fitOntologyGraph:window.fitOntologyGraph,resetOntologyGraphLayout:window.resetOntologyGraphLayout,setOntologyGraphFilter:window.setOntologyGraphFilter,syncOntologyGraphFilters:window.syncOntologyGraphFilters},lr=()=>Ee();return window.addEventListener("resize",lr),{destroy(){h.cancel(),pe&&(window.clearTimeout(pe),pe=null),Ve(),window.removeEventListener("resize",lr),k&&(Se(""),k.kill()),Object.entries(se).forEach(([e,t])=>{window[e]===t&&delete window[e]})},filter(e){var t;(t=se.filterOntologyGraph)==null||t.call(se,e)},focusNode(e){var t;(t=se.focusOntologyNode)==null||t.call(se,e)},clearSelection(){var e;(e=se.clearOntologySelection)==null||e.call(se)},resetLayout(){var e;(e=se.resetOntologyGraphLayout)==null||e.call(se)},setFilter(e,t,r){var i;(i=se.setOntologyGraphFilter)==null||i.call(se,e,t,r)}}}export{Vo as mountOntologyGraph};
|