@reddb-io/ui 0.1.1
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/LICENSE +17 -0
- package/bin/red-ui.js +259 -0
- package/build/CNAME +1 -0
- package/build/_app/env.js +1 -0
- package/build/_app/immutable/assets/0.C63jY5jX.css +1 -0
- package/build/_app/immutable/assets/10.Dblyk0Kr.css +1 -0
- package/build/_app/immutable/assets/EmptyState.RXcH7ryE.css +1 -0
- package/build/_app/immutable/assets/Workspace.BCzG1DsH.css +1 -0
- package/build/_app/immutable/assets/inter-cyrillic-ext-wght-normal.BOeWTOD4.woff2 +0 -0
- package/build/_app/immutable/assets/inter-cyrillic-wght-normal.DqGufNeO.woff2 +0 -0
- package/build/_app/immutable/assets/inter-greek-ext-wght-normal.DlzME5K_.woff2 +0 -0
- package/build/_app/immutable/assets/inter-greek-wght-normal.CkhJZR-_.woff2 +0 -0
- package/build/_app/immutable/assets/inter-latin-ext-wght-normal.DO1Apj_S.woff2 +0 -0
- package/build/_app/immutable/assets/inter-latin-wght-normal.Dx4kXJAl.woff2 +0 -0
- package/build/_app/immutable/assets/inter-vietnamese-wght-normal.CBcvBZtf.woff2 +0 -0
- package/build/_app/immutable/assets/jetbrains-mono-cyrillic-wght-normal.D73BlboJ.woff2 +0 -0
- package/build/_app/immutable/assets/jetbrains-mono-greek-wght-normal.Bw9x6K1M.woff2 +0 -0
- package/build/_app/immutable/assets/jetbrains-mono-latin-ext-wght-normal.DBQx-q_a.woff2 +0 -0
- package/build/_app/immutable/assets/jetbrains-mono-latin-wght-normal.B9CIFXIH.woff2 +0 -0
- package/build/_app/immutable/assets/jetbrains-mono-vietnamese-wght-normal.Bt-aOZkq.woff2 +0 -0
- package/build/_app/immutable/chunks/3j4cZ58b.js +1 -0
- package/build/_app/immutable/chunks/69_IOA4Y.js +1 -0
- package/build/_app/immutable/chunks/ALqaDrNQ.js +2 -0
- package/build/_app/immutable/chunks/BGcIe2ep.js +2 -0
- package/build/_app/immutable/chunks/BMHKbvs8.js +1 -0
- package/build/_app/immutable/chunks/BQHbwf54.js +916 -0
- package/build/_app/immutable/chunks/Bgso8cDH.js +311 -0
- package/build/_app/immutable/chunks/Bmgx1mfv.js +310 -0
- package/build/_app/immutable/chunks/BrvvOVaJ.js +1 -0
- package/build/_app/immutable/chunks/Bzak7iHL.js +1 -0
- package/build/_app/immutable/chunks/D9CTkMjK.js +1 -0
- package/build/_app/immutable/chunks/DIeogL5L.js +1 -0
- package/build/_app/immutable/chunks/DXY_Rxa7.js +113 -0
- package/build/_app/immutable/chunks/DhEqZVGG.js +1 -0
- package/build/_app/immutable/chunks/Ov8N-vxt.js +1 -0
- package/build/_app/immutable/chunks/oiO4RLqp.js +1 -0
- package/build/_app/immutable/entry/app.D_IVtpdv.js +2 -0
- package/build/_app/immutable/entry/start.3oC0UQ_Q.js +1 -0
- package/build/_app/immutable/nodes/0.CHPiFxDo.js +1 -0
- package/build/_app/immutable/nodes/1.BC_4YZ0h.js +1 -0
- package/build/_app/immutable/nodes/10.B7DMKSNc.js +60 -0
- package/build/_app/immutable/nodes/2.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/3.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/4.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/5.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/6.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/7.BZX9Iird.js +134 -0
- package/build/_app/immutable/nodes/8.CAG5_cGP.js +1 -0
- package/build/_app/immutable/nodes/9.CAG5_cGP.js +1 -0
- package/build/_app/version.json +1 -0
- package/build/favicon.png +0 -0
- package/build/index.html +59 -0
- package/dist/embed/RedUiEmbedRoot-BGoLxJf1.js +26562 -0
- package/dist/embed/RedUiEmbedRoot-BGoLxJf1.js.map +1 -0
- package/dist/embed/bundle-mjs-UuVRz3O4.js +3047 -0
- package/dist/embed/bundle-mjs-UuVRz3O4.js.map +1 -0
- package/dist/embed/core-QuRYvMt8.js +118 -0
- package/dist/embed/core-QuRYvMt8.js.map +1 -0
- package/dist/embed/index-B6ZQhCsu.js +577 -0
- package/dist/embed/index-B6ZQhCsu.js.map +1 -0
- package/dist/embed/index-client-ItCEU64C.js +3087 -0
- package/dist/embed/index-client-ItCEU64C.js.map +1 -0
- package/dist/embed/index-fad77a13.esm-BqPj0saH.js +1318 -0
- package/dist/embed/index-fad77a13.esm-BqPj0saH.js.map +1 -0
- package/dist/embed/index.js +11 -0
- package/dist/embed/index.js.map +1 -0
- package/dist/embed/sigma-node-border.esm-CGtlgqmo.js +432 -0
- package/dist/embed/sigma-node-border.esm-CGtlgqmo.js.map +1 -0
- package/dist/embed/sigma.esm-y0qgY-OC.js +2355 -0
- package/dist/embed/sigma.esm-y0qgY-OC.js.map +1 -0
- package/dist/embed/ui.css +1 -0
- package/package.json +101 -0
- package/src/app.css +238 -0
- package/src/lib/ActivityIndicator.svelte +100 -0
- package/src/lib/ClusterNode.svelte +119 -0
- package/src/lib/ClusterView.svelte +541 -0
- package/src/lib/CollectionHistory.svelte +266 -0
- package/src/lib/CollectionsView.svelte +14 -0
- package/src/lib/CommandPalette.svelte +237 -0
- package/src/lib/ConnectDropdown.svelte +222 -0
- package/src/lib/EmptyState.svelte +27 -0
- package/src/lib/LiveChanges.svelte +195 -0
- package/src/lib/MasterPasswordDialog.svelte +168 -0
- package/src/lib/PageHeader.svelte +32 -0
- package/src/lib/PendingChangesPanel.svelte +153 -0
- package/src/lib/QueryEditor.svelte +122 -0
- package/src/lib/ResultsPane.svelte +747 -0
- package/src/lib/SchemaTree.svelte +193 -0
- package/src/lib/SecurityView.svelte +255 -0
- package/src/lib/ShortcutOverlay.svelte +104 -0
- package/src/lib/Splash.svelte +46 -0
- package/src/lib/StatusBar.svelte +163 -0
- package/src/lib/SubNav.svelte +62 -0
- package/src/lib/Topbar.svelte +119 -0
- package/src/lib/Workspace.svelte +247 -0
- package/src/lib/activity.svelte.ts +91 -0
- package/src/lib/build-info.ts +41 -0
- package/src/lib/capability.ts +221 -0
- package/src/lib/cn.ts +6 -0
- package/src/lib/collection-catalog.ts +116 -0
- package/src/lib/collection-pages.ts +33 -0
- package/src/lib/connection-history.ts +301 -0
- package/src/lib/connections.svelte.ts +493 -0
- package/src/lib/embed/RedUiEmbedRoot.svelte +31 -0
- package/src/lib/embed/index.ts +234 -0
- package/src/lib/graph-loader/contract.ts +336 -0
- package/src/lib/graph-loader/drilldown.ts +334 -0
- package/src/lib/graph-loader/index.ts +13 -0
- package/src/lib/index.ts +114 -0
- package/src/lib/pending-changes.svelte.ts +149 -0
- package/src/lib/query-tabs.svelte.ts +130 -0
- package/src/lib/reddb/boot-params.ts +254 -0
- package/src/lib/reddb/cdc-stream-client.ts +234 -0
- package/src/lib/reddb/client.ts +698 -0
- package/src/lib/reddb/connection-bootstrap.ts +260 -0
- package/src/lib/reddb/connection-provider.contract.ts +72 -0
- package/src/lib/reddb/connection-provider.ts +72 -0
- package/src/lib/reddb/index.ts +14 -0
- package/src/lib/reddb/injected-client-provider.ts +76 -0
- package/src/lib/reddb/local-url-provider.ts +245 -0
- package/src/lib/reddb/secure-store.ts +41 -0
- package/src/lib/reddb/server-capabilities.ts +71 -0
- package/src/lib/reddb/tauri-encrypted-store.ts +64 -0
- package/src/lib/reddb/transports.ts +89 -0
- package/src/lib/reddb/types.ts +32 -0
- package/src/lib/reddb/uri.ts +54 -0
- package/src/lib/reddb/web-encrypted-store.ts +201 -0
- package/src/lib/renderers/DiffRenderer.svelte +184 -0
- package/src/lib/renderers/DocumentRenderer.svelte +134 -0
- package/src/lib/renderers/GraphRenderer.svelte +1328 -0
- package/src/lib/renderers/HypertableRenderer.svelte +253 -0
- package/src/lib/renderers/JsonRenderer.svelte +30 -0
- package/src/lib/renderers/KvRenderer.svelte +150 -0
- package/src/lib/renderers/QueueRenderer.svelte +286 -0
- package/src/lib/renderers/StatsRenderer.svelte +123 -0
- package/src/lib/renderers/TableRenderer.svelte +440 -0
- package/src/lib/renderers/VectorRenderer.svelte +388 -0
- package/src/lib/renderers/diff-render.ts +122 -0
- package/src/lib/renderers/diff.ts +9 -0
- package/src/lib/renderers/document-render.ts +64 -0
- package/src/lib/renderers/document.ts +9 -0
- package/src/lib/renderers/graph-render.ts +631 -0
- package/src/lib/renderers/graph-sigma.ts +395 -0
- package/src/lib/renderers/graph.ts +9 -0
- package/src/lib/renderers/hypertable-render.ts +320 -0
- package/src/lib/renderers/hypertable.ts +9 -0
- package/src/lib/renderers/index.ts +42 -0
- package/src/lib/renderers/json-render.ts +89 -0
- package/src/lib/renderers/json.ts +10 -0
- package/src/lib/renderers/kv-render.ts +193 -0
- package/src/lib/renderers/kv.ts +9 -0
- package/src/lib/renderers/queue-render.ts +197 -0
- package/src/lib/renderers/queue.ts +9 -0
- package/src/lib/renderers/registry.ts +68 -0
- package/src/lib/renderers/stats-render.ts +73 -0
- package/src/lib/renderers/stats.ts +9 -0
- package/src/lib/renderers/table-render.ts +156 -0
- package/src/lib/renderers/table.ts +11 -0
- package/src/lib/renderers/types.ts +33 -0
- package/src/lib/renderers/vector-render.ts +154 -0
- package/src/lib/renderers/vector.ts +9 -0
- package/src/lib/router.svelte.ts +163 -0
- package/src/lib/secureStore.svelte.ts +148 -0
- package/src/lib/shadow-dom-spike/ShadowDomSpikeCore.svelte +198 -0
- package/src/lib/shadow-dom-spike/mount-shadow-dom-spike.ts +94 -0
- package/src/lib/shortcuts.ts +22 -0
- package/src/lib/surface.ts +80 -0
- package/src/lib/tabs.svelte.ts +115 -0
- package/src/lib/theme.svelte.ts +63 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g as Y,e as O,d as Z,c as j,i as Q,n as Re,o as Ne,p as Me,N as Ge,a as Ie,E as Fe,h as v,f as c,j as ne,r as ge,m as ve,k as ze,_ as Ae}from"./Bgso8cDH.js";import{s as Ue,A as He,t as Be}from"./Bmgx1mfv.js";var ue=(function(s){function n(){var i;return Z(this,n),i=j(this,n),i.rawEmitter=i,i}return Y(n,s),O(n)})(Ue.EventEmitter),We=He();const Oe=Be(We);var Ze=function(n){return n},_e=function(n){return n*n},Ve=function(n){return n*(2-n)},qe=function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)},Ye=function(n){return n*n*n},je=function(n){return--n*n*n+1},Xe=function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)},Ke={linear:Ze,quadraticIn:_e,quadraticOut:Ve,quadraticInOut:qe,cubicIn:Ye,cubicOut:je,cubicInOut:Xe},Je={easing:"quadraticInOut",duration:150};function N(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function ee(s,n,i){return s[0]=n,s[4]=typeof i=="number"?i:n,s}function fe(s,n){var i=Math.sin(n),e=Math.cos(n);return s[0]=e,s[1]=i,s[3]=-i,s[4]=e,s}function me(s,n,i){return s[6]=n,s[7]=i,s}function W(s,n){var i=s[0],e=s[1],t=s[2],a=s[3],r=s[4],o=s[5],h=s[6],d=s[7],l=s[8],u=n[0],g=n[1],f=n[2],m=n[3],p=n[4],y=n[5],E=n[6],b=n[7],x=n[8];return s[0]=u*i+g*a+f*h,s[1]=u*e+g*r+f*d,s[2]=u*t+g*o+f*l,s[3]=m*i+p*a+y*h,s[4]=m*e+p*r+y*d,s[5]=m*t+p*o+y*l,s[6]=E*i+b*a+x*h,s[7]=E*e+b*r+x*d,s[8]=E*t+b*o+x*l,s}function de(s,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,e=s[0],t=s[1],a=s[3],r=s[4],o=s[6],h=s[7],d=n.x,l=n.y;return{x:d*e+l*a+o*i,y:d*t+l*r+h*i}}function Qe(s,n){var i=s.height/s.width,e=n.height/n.width;return i<1&&e>1||i>1&&e<1?1:Math.min(Math.max(e,1/e),Math.max(1/i,i))}function X(s,n,i,e,t){var a=s.angle,r=s.ratio,o=s.x,h=s.y,d=n.width,l=n.height,u=N(),g=Math.min(d,l)-2*e,f=Qe(n,i);return t?(W(u,me(N(),o,h)),W(u,ee(N(),r)),W(u,fe(N(),a)),W(u,ee(N(),d/g/2/f,l/g/2/f))):(W(u,ee(N(),2*(g/d)*f,2*(g/l)*f)),W(u,fe(N(),-a)),W(u,ee(N(),1/r)),W(u,me(N(),-o,-h))),u}function $e(s,n,i){var e=de(s,{x:Math.cos(n.angle),y:Math.sin(n.angle)},0),t=e.x,a=e.y;return 1/Math.sqrt(Math.pow(t,2)+Math.pow(a,2))/i.width}function et(s){if(!s.order)return{x:[0,1],y:[0,1]};var n=1/0,i=-1/0,e=1/0,t=-1/0;return s.forEachNode(function(a,r){var o=r.x,h=r.y;o<n&&(n=o),o>i&&(i=o),h<e&&(e=h),h>t&&(t=h)}),{x:[n,i],y:[e,t]}}function tt(s){if(!Oe(s))throw new Error("Sigma: invalid graph instance.");s.forEachNode(function(n,i){if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw new Error("Sigma: Coordinates of node ".concat(n," are invalid. A node must have a numeric 'x' and 'y' attribute."))})}function it(s,n,i){var e=document.createElement(s);if(n)for(var t in n)e.style[t]=n[t];if(i)for(var a in i)e.setAttribute(a,i[a]);return e}function pe(){return typeof window.devicePixelRatio<"u"?window.devicePixelRatio:1}function ye(s,n,i){return i.sort(function(e,t){var a=n(e)||0,r=n(t)||0;return a<r?-1:a>r?1:0})}function be(s){var n=Q(s.x,2),i=n[0],e=n[1],t=Q(s.y,2),a=t[0],r=t[1],o=Math.max(e-i,r-a),h=(e+i)/2,d=(r+a)/2;(o===0||Math.abs(o)===1/0||isNaN(o))&&(o=1),isNaN(h)&&(h=0),isNaN(d)&&(d=0);var l=function(g){return{x:.5+(g.x-h)/o,y:.5+(g.y-d)/o}};return l.applyTo=function(u){u.x=.5+(u.x-h)/o,u.y=.5+(u.y-d)/o},l.inverse=function(u){return{x:h+o*(u.x-.5),y:d+o*(u.y-.5)}},l.ratio=o,l}function le(s){"@babel/helpers - typeof";return le=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},le(s)}function xe(s,n){var i=n.size;if(i!==0){var e=s.length;s.length+=i;var t=0;n.forEach(function(a){s[e+t]=a,t++})}}function se(s){s=s||{};for(var n=0,i=arguments.length<=1?0:arguments.length-1;n<i;n++){var e=n+1<1||arguments.length<=n+1?void 0:arguments[n+1];e&&Object.assign(s,e)}return s}var ce={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,renderEdgeLabels:!1,enableEdgeEvents:!1,defaultNodeColor:"#999",defaultNodeType:"circle",defaultEdgeColor:"#ccc",defaultEdgeType:"line",labelFont:"Arial",labelSize:14,labelWeight:"normal",labelColor:{color:"#000"},edgeLabelFont:"Arial",edgeLabelSize:14,edgeLabelWeight:"normal",edgeLabelColor:{attribute:"color"},stagePadding:30,defaultDrawEdgeLabel:Me,defaultDrawNodeLabel:Ne,defaultDrawNodeHover:Re,minEdgeThickness:1.7,antiAliasingFeather:1,dragTimeout:100,draggedEventsTolerance:3,inertiaDuration:200,inertiaRatio:3,zoomDuration:250,zoomingRatio:1.7,doubleClickTimeout:300,doubleClickZoomingRatio:2.2,doubleClickZoomingDuration:200,tapMoveTolerance:10,zoomToSizeRatioFunction:Math.sqrt,itemSizesReference:"screen",autoRescale:!0,autoCenter:!0,labelDensity:1,labelGridCellSize:100,labelRenderedSizeThreshold:6,nodeReducer:null,edgeReducer:null,zIndex:!1,minCameraRatio:null,maxCameraRatio:null,enableCameraZooming:!0,enableCameraPanning:!0,enableCameraRotation:!0,cameraPanBoundaries:null,allowInvalidContainer:!1,nodeProgramClasses:{},nodeHoverProgramClasses:{},edgeProgramClasses:{}},at={circle:Ge},rt={arrow:Fe,line:Ie};function oe(s){if(typeof s.labelDensity!="number"||s.labelDensity<0)throw new Error("Settings: invalid `labelDensity`. Expecting a positive number.");var n=s.minCameraRatio,i=s.maxCameraRatio;if(typeof n=="number"&&typeof i=="number"&&i<n)throw new Error("Settings: invalid camera ratio boundaries. Expecting `maxCameraRatio` to be greater than `minCameraRatio`.")}function nt(s){var n=se({},ce,s);return n.nodeProgramClasses=se({},at,n.nodeProgramClasses),n.edgeProgramClasses=se({},rt,n.edgeProgramClasses),n}var te=1.5,Ce=(function(s){function n(){var i;return Z(this,n),i=j(this,n),c(i,"x",.5),c(i,"y",.5),c(i,"angle",0),c(i,"ratio",1),c(i,"minRatio",null),c(i,"maxRatio",null),c(i,"enabledZooming",!0),c(i,"enabledPanning",!0),c(i,"enabledRotation",!0),c(i,"clean",null),c(i,"nextFrame",null),c(i,"previousState",null),c(i,"enabled",!0),i.previousState=i.getState(),i}return Y(n,s),O(n,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"hasState",value:function(e){return this.x===e.x&&this.y===e.y&&this.ratio===e.ratio&&this.angle===e.angle}},{key:"getPreviousState",value:function(){var e=this.previousState;return e?{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}:null}},{key:"getBoundedRatio",value:function(e){var t=e;return typeof this.minRatio=="number"&&(t=Math.max(t,this.minRatio)),typeof this.maxRatio=="number"&&(t=Math.min(t,this.maxRatio)),t}},{key:"validateState",value:function(e){var t={};return this.enabledPanning&&typeof e.x=="number"&&(t.x=e.x),this.enabledPanning&&typeof e.y=="number"&&(t.y=e.y),this.enabledZooming&&typeof e.ratio=="number"&&(t.ratio=this.getBoundedRatio(e.ratio)),this.enabledRotation&&typeof e.angle=="number"&&(t.angle=e.angle),this.clean?this.clean(v(v({},this.getState()),t)):t}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"setState",value:function(e){if(!this.enabled)return this;this.previousState=this.getState();var t=this.validateState(e);return typeof t.x=="number"&&(this.x=t.x),typeof t.y=="number"&&(this.y=t.y),typeof t.ratio=="number"&&(this.ratio=t.ratio),typeof t.angle=="number"&&(this.angle=t.angle),this.hasState(this.previousState)||this.emit("updated",this.getState()),this}},{key:"updateState",value:function(e){return this.setState(e(this.getState())),this}},{key:"animate",value:function(e){var t=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;if(!r)return new Promise(function(f){return t.animate(e,a,f)});if(this.enabled){var o=v(v({},Je),a),h=this.validateState(e),d=typeof o.easing=="function"?o.easing:Ke[o.easing],l=Date.now(),u=this.getState(),g=function(){var m=(Date.now()-l)/o.duration;if(m>=1){t.nextFrame=null,t.setState(h),t.animationCallback&&(t.animationCallback.call(null),t.animationCallback=void 0);return}var p=d(m),y={};typeof h.x=="number"&&(y.x=u.x+(h.x-u.x)*p),typeof h.y=="number"&&(y.y=u.y+(h.y-u.y)*p),t.enabledRotation&&typeof h.angle=="number"&&(y.angle=u.angle+(h.angle-u.angle)*p),typeof h.ratio=="number"&&(y.ratio=u.ratio+(h.ratio-u.ratio)*p),t.setState(y),t.nextFrame=requestAnimationFrame(g)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=requestAnimationFrame(g)):g(),this.animationCallback=r}}},{key:"animatedZoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||te)},e):this.animate({ratio:this.ratio/te})}},{key:"animatedUnzoom",value:function(e){return e?typeof e=="number"?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||te)},e):this.animate({ratio:this.ratio*te})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}},{key:"copy",value:function(){return n.from(this.getState())}}],[{key:"from",value:function(e){var t=new n;return t.setState(e)}}])})(ue);function M(s,n){var i=n.getBoundingClientRect();return{x:s.clientX-i.left,y:s.clientY-i.top}}function F(s,n){var i=v(v({},M(s,n)),{},{sigmaDefaultPrevented:!1,preventSigmaDefault:function(){i.sigmaDefaultPrevented=!0},original:s});return i}function K(s){var n="x"in s?s:v(v({},s.touches[0]||s.previousTouches[0]),{},{original:s.original,sigmaDefaultPrevented:s.sigmaDefaultPrevented,preventSigmaDefault:function(){s.sigmaDefaultPrevented=!0,n.sigmaDefaultPrevented=!0}});return n}function st(s,n){return v(v({},F(s,n)),{},{delta:Te(s)})}var ot=2;function ie(s){for(var n=[],i=0,e=Math.min(s.length,ot);i<e;i++)n.push(s[i]);return n}function J(s,n,i){var e={touches:ie(s.touches).map(function(t){return M(t,i)}),previousTouches:n.map(function(t){return M(t,i)}),sigmaDefaultPrevented:!1,preventSigmaDefault:function(){e.sigmaDefaultPrevented=!0},original:s};return e}function Te(s){if(typeof s.deltaY<"u")return s.deltaY*-3/360;if(typeof s.detail<"u")return s.detail/-9;throw new Error("Captor: could not extract delta from event.")}var De=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n),t.container=i,t.renderer=e,t}return Y(n,s),O(n)})(ue),ht=["doubleClickTimeout","doubleClickZoomingDuration","doubleClickZoomingRatio","dragTimeout","draggedEventsTolerance","inertiaDuration","inertiaRatio","zoomDuration","zoomingRatio"],dt=ht.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),lt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"draggedEvents",0),c(t,"downStartTime",null),c(t,"lastMouseX",null),c(t,"lastMouseY",null),c(t,"isMouseDown",!1),c(t,"isMoving",!1),c(t,"movingTimeout",null),c(t,"startCameraState",null),c(t,"clicks",0),c(t,"doubleClickTimeout",null),c(t,"currentWheelDirection",0),c(t,"settings",dt),t.handleClick=t.handleClick.bind(t),t.handleRightClick=t.handleRightClick.bind(t),t.handleDown=t.handleDown.bind(t),t.handleUp=t.handleUp.bind(t),t.handleMove=t.handleMove.bind(t),t.handleWheel=t.handleWheel.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleEnter=t.handleEnter.bind(t),i.addEventListener("click",t.handleClick,{capture:!1}),i.addEventListener("contextmenu",t.handleRightClick,{capture:!1}),i.addEventListener("mousedown",t.handleDown,{capture:!1}),i.addEventListener("wheel",t.handleWheel,{capture:!1}),i.addEventListener("mouseleave",t.handleLeave,{capture:!1}),i.addEventListener("mouseenter",t.handleEnter,{capture:!1}),document.addEventListener("mousemove",t.handleMove,{capture:!1}),document.addEventListener("mouseup",t.handleUp,{capture:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("contextmenu",this.handleRightClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("wheel",this.handleWheel),e.removeEventListener("mouseleave",this.handleLeave),e.removeEventListener("mouseenter",this.handleEnter),document.removeEventListener("mousemove",this.handleMove),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,this.clicks===2)return this.clicks=0,typeof this.doubleClickTimeout=="number"&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},this.settings.doubleClickTimeout),this.draggedEvents<this.settings.draggedEventsTolerance&&this.emit("click",F(e,this.container))}}},{key:"handleRightClick",value:function(e){this.enabled&&this.emit("rightClick",F(e,this.container))}},{key:"handleDoubleClick",value:function(e){if(this.enabled){e.preventDefault(),e.stopPropagation();var t=F(e,this.container);if(this.emit("doubleClick",t),!t.sigmaDefaultPrevented){var a=this.renderer.getCamera(),r=a.getBoundedRatio(a.getState().ratio/this.settings.doubleClickZoomingRatio);a.animate(this.renderer.getViewportZoomedState(M(e,this.container),r),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}}},{key:"handleDown",value:function(e){if(this.enabled){if(e.button===0){this.startCameraState=this.renderer.getCamera().getState();var t=M(e,this.container),a=t.x,r=t.y;this.lastMouseX=a,this.lastMouseY=r,this.draggedEvents=0,this.downStartTime=Date.now(),this.isMouseDown=!0}this.emit("mousedown",F(e,this.container))}}},{key:"handleUp",value:function(e){var t=this;if(!(!this.enabled||!this.isMouseDown)){var a=this.renderer.getCamera();this.isMouseDown=!1,typeof this.movingTimeout=="number"&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=M(e,this.container),o=r.x,h=r.y,d=a.getState(),l=a.getPreviousState()||{x:0,y:0};this.isMoving?a.animate({x:d.x+this.settings.inertiaRatio*(d.x-l.x),y:d.y+this.settings.inertiaRatio*(d.y-l.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"}):(this.lastMouseX!==o||this.lastMouseY!==h)&&a.setState({x:d.x,y:d.y}),this.isMoving=!1,setTimeout(function(){var u=t.draggedEvents>0;t.draggedEvents=0,u&&t.renderer.getSetting("hideEdgesOnMove")&&t.renderer.refresh()},0),this.emit("mouseup",F(e,this.container))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){var a=F(e,this.container);if(this.emit("mousemovebody",a),(e.target===this.container||e.composedPath()[0]===this.container)&&this.emit("mousemove",a),!a.sigmaDefaultPrevented&&this.isMouseDown){this.isMoving=!0,this.draggedEvents++,typeof this.movingTimeout=="number"&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},this.settings.dragTimeout);var r=this.renderer.getCamera(),o=M(e,this.container),h=o.x,d=o.y,l=this.renderer.viewportToFramedGraph({x:this.lastMouseX,y:this.lastMouseY}),u=this.renderer.viewportToFramedGraph({x:h,y:d}),g=l.x-u.x,f=l.y-u.y,m=r.getState(),p=m.x+g,y=m.y+f;r.setState({x:p,y}),this.lastMouseX=h,this.lastMouseY=d,e.preventDefault(),e.stopPropagation()}}}},{key:"handleLeave",value:function(e){this.emit("mouseleave",F(e,this.container))}},{key:"handleEnter",value:function(e){this.emit("mouseenter",F(e,this.container))}},{key:"handleWheel",value:function(e){var t=this,a=this.renderer.getCamera();if(!(!this.enabled||!a.enabledZooming)){var r=Te(e);if(r){var o=st(e,this.container);if(this.emit("wheel",o),o.sigmaDefaultPrevented){e.preventDefault(),e.stopPropagation();return}var h=a.getState().ratio,d=r>0?1/this.settings.zoomingRatio:this.settings.zoomingRatio,l=a.getBoundedRatio(h*d),u=r>0?1:-1,g=Date.now();h!==l&&(e.preventDefault(),e.stopPropagation(),!(this.currentWheelDirection===u&&this.lastWheelTriggerTime&&g-this.lastWheelTriggerTime<this.settings.zoomDuration/5)&&(a.animate(this.renderer.getViewportZoomedState(M(e,this.container),l),{easing:"quadraticOut",duration:this.settings.zoomDuration},function(){t.currentWheelDirection=0}),this.currentWheelDirection=u,this.lastWheelTriggerTime=g))}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De),ut=["dragTimeout","inertiaDuration","inertiaRatio","doubleClickTimeout","doubleClickZoomingRatio","doubleClickZoomingDuration","tapMoveTolerance"],ct=ut.reduce(function(s,n){return v(v({},s),{},c({},n,ce[n]))},{}),gt=(function(s){function n(i,e){var t;return Z(this,n),t=j(this,n,[i,e]),c(t,"enabled",!0),c(t,"isMoving",!1),c(t,"hasMoved",!1),c(t,"touchMode",0),c(t,"startTouchesPositions",[]),c(t,"lastTouches",[]),c(t,"lastTap",null),c(t,"settings",ct),t.handleStart=t.handleStart.bind(t),t.handleLeave=t.handleLeave.bind(t),t.handleMove=t.handleMove.bind(t),i.addEventListener("touchstart",t.handleStart,{capture:!1}),i.addEventListener("touchcancel",t.handleLeave,{capture:!1}),document.addEventListener("touchend",t.handleLeave,{capture:!1,passive:!1}),document.addEventListener("touchmove",t.handleMove,{capture:!1,passive:!1}),t}return Y(n,s),O(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("touchstart",this.handleStart),e.removeEventListener("touchcancel",this.handleLeave),document.removeEventListener("touchend",this.handleLeave),document.removeEventListener("touchmove",this.handleMove)}},{key:"getDimensions",value:function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}}},{key:"handleStart",value:function(e){var t=this;if(this.enabled){e.preventDefault();var a=ie(e.touches);if(this.touchMode=a.length,this.startCameraState=this.renderer.getCamera().getState(),this.startTouchesPositions=a.map(function(f){return M(f,t.container)}),this.touchMode===2){var r=Q(this.startTouchesPositions,2),o=r[0],h=o.x,d=o.y,l=r[1],u=l.x,g=l.y;this.startTouchesAngle=Math.atan2(g-d,u-h),this.startTouchesDistance=Math.sqrt(Math.pow(u-h,2)+Math.pow(g-d,2))}this.emit("touchdown",J(e,this.lastTouches,this.container)),this.lastTouches=a,this.lastTouchesPositions=this.startTouchesPositions}}},{key:"handleLeave",value:function(e){if(!(!this.enabled||!this.startTouchesPositions.length)){switch(e.cancelable&&e.preventDefault(),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(e.touches.length===1){this.handleStart(e),e.preventDefault();break}case 1:if(this.isMoving){var t=this.renderer.getCamera(),a=t.getState(),r=t.getPreviousState()||{x:0,y:0};t.animate({x:a.x+this.settings.inertiaRatio*(a.x-r.x),y:a.y+this.settings.inertiaRatio*(a.y-r.y)},{duration:this.settings.inertiaDuration,easing:"quadraticOut"})}this.hasMoved=!1,this.isMoving=!1,this.touchMode=0;break}if(this.emit("touchup",J(e,this.lastTouches,this.container)),!e.touches.length){var o=M(this.lastTouches[0],this.container),h=this.startTouchesPositions[0],d=Math.pow(o.x-h.x,2)+Math.pow(o.y-h.y,2);if(!e.touches.length&&d<Math.pow(this.settings.tapMoveTolerance,2))if(this.lastTap&&Date.now()-this.lastTap.time<this.settings.doubleClickTimeout){var l=J(e,this.lastTouches,this.container);if(this.emit("doubletap",l),this.lastTap=null,!l.sigmaDefaultPrevented){var u=this.renderer.getCamera(),g=u.getBoundedRatio(u.getState().ratio/this.settings.doubleClickZoomingRatio);u.animate(this.renderer.getViewportZoomedState(o,g),{easing:"quadraticInOut",duration:this.settings.doubleClickZoomingDuration})}}else{var f=J(e,this.lastTouches,this.container);this.emit("tap",f),this.lastTap={time:Date.now(),position:f.touches[0]||f.previousTouches[0]}}}this.lastTouches=ie(e.touches),this.startTouchesPositions=[]}}},{key:"handleMove",value:function(e){var t=this;if(!(!this.enabled||!this.startTouchesPositions.length)){e.preventDefault();var a=ie(e.touches),r=a.map(function(B){return M(B,t.container)}),o=this.lastTouches;this.lastTouches=a,this.lastTouchesPositions=r;var h=J(e,o,this.container);if(this.emit("touchmove",h),!h.sigmaDefaultPrevented&&(this.hasMoved||(this.hasMoved=r.some(function(B,ae){var G=t.startTouchesPositions[ae];return G&&(B.x!==G.x||B.y!==G.y)})),!!this.hasMoved)){this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout(function(){t.isMoving=!1},this.settings.dragTimeout);var d=this.renderer.getCamera(),l=this.startCameraState,u=this.renderer.getSetting("stagePadding");switch(this.touchMode){case 1:{var g=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0]),f=g.x,m=g.y,p=this.renderer.viewportToFramedGraph(r[0]),y=p.x,E=p.y;d.setState({x:l.x+f-y,y:l.y+m-E});break}case 2:{var b={x:.5,y:.5,angle:0,ratio:1},x=r[0],C=x.x,I=x.y,A=r[1],w=A.x,k=A.y,T=Math.atan2(k-I,w-C)-this.startTouchesAngle,L=Math.hypot(k-I,w-C)/this.startTouchesDistance,D=d.getBoundedRatio(l.ratio/L);b.ratio=D,b.angle=l.angle+T;var S=this.getDimensions(),_=this.renderer.viewportToFramedGraph((this.startTouchesPositions||[])[0],{cameraState:l}),P=Math.min(S.width,S.height)-2*u,R=P/S.width,U=P/S.height,$=D/P,q=C-P/2/R,V=I-P/2/U,H=[q*Math.cos(-b.angle)-V*Math.sin(-b.angle),V*Math.cos(-b.angle)+q*Math.sin(-b.angle)];q=H[0],V=H[1],b.x=_.x-q*$,b.y=_.y+V*$,d.setState(b);break}}}}}},{key:"setSettings",value:function(e){this.settings=e}}])})(De);function vt(s){if(Array.isArray(s))return Ae(s)}function ft(s){if(typeof Symbol<"u"&&s[Symbol.iterator]!=null||s["@@iterator"]!=null)return Array.from(s)}function mt(){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 Ee(s){return vt(s)||ft(s)||ze(s)||mt()}function pt(s,n){if(s==null)return{};var i={};for(var e in s)if({}.hasOwnProperty.call(s,e)){if(n.indexOf(e)!==-1)continue;i[e]=s[e]}return i}function he(s,n){if(s==null)return{};var i,e,t=pt(s,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(s);for(e=0;e<a.length;e++)i=a[e],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(s,i)&&(t[i]=s[i])}return t}var we=(function(){function s(n,i){Z(this,s),this.key=n,this.size=i}return O(s,null,[{key:"compare",value:function(i,e){return i.size>e.size?-1:i.size<e.size||i.key>e.key?1:-1}}])})(),Le=(function(){function s(){Z(this,s),c(this,"width",0),c(this,"height",0),c(this,"cellSize",0),c(this,"columns",0),c(this,"rows",0),c(this,"cells",{})}return O(s,[{key:"resizeAndClear",value:function(i,e){this.width=i.width,this.height=i.height,this.cellSize=e,this.columns=Math.ceil(i.width/e),this.rows=Math.ceil(i.height/e),this.cells={}}},{key:"getIndex",value:function(i){var e=Math.floor(i.x/this.cellSize),t=Math.floor(i.y/this.cellSize);return t*this.columns+e}},{key:"add",value:function(i,e,t){var a=new we(i,e),r=this.getIndex(t),o=this.cells[r];o||(o=[],this.cells[r]=o),o.push(a)}},{key:"organize",value:function(){for(var i in this.cells){var e=this.cells[i];e.sort(we.compare)}}},{key:"getLabelsToDisplay",value:function(i,e){var t=this.cellSize*this.cellSize,a=t/i/i,r=a*e/t,o=Math.ceil(r),h=[];for(var d in this.cells)for(var l=this.cells[d],u=0;u<Math.min(o,l.length);u++)h.push(l[u].key);return h}}])})();function yt(s){var n=s.graph,i=s.hoveredNode,e=s.highlightedNodes,t=s.displayedNodeLabels,a=[];return n.forEachEdge(function(r,o,h,d){(h===i||d===i||e.has(h)||e.has(d)||t.has(h)&&t.has(d))&&a.push(r)}),a}var Se=150,Pe=50,z=Object.prototype.hasOwnProperty;function bt(s,n,i){if(!z.call(i,"x")||!z.call(i,"y"))throw new Error('Sigma: could not find a valid position (x, y) for node "'.concat(n,'". All your nodes must have a number "x" and "y". Maybe your forgot to apply a layout or your "nodeReducer" is not returning the correct data?'));return i.color||(i.color=s.defaultNodeColor),!i.label&&i.label!==""&&(i.label=null),i.label!==void 0&&i.label!==null?i.label=""+i.label:i.label=null,i.size||(i.size=2),z.call(i,"hidden")||(i.hidden=!1),z.call(i,"highlighted")||(i.highlighted=!1),z.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=s.defaultNodeType),i.zIndex||(i.zIndex=0),i}function xt(s,n,i){return i.color||(i.color=s.defaultEdgeColor),i.label||(i.label=""),i.size||(i.size=.5),z.call(i,"hidden")||(i.hidden=!1),z.call(i,"forceLabel")||(i.forceLabel=!1),(!i.type||i.type==="")&&(i.type=s.defaultEdgeType),i.zIndex||(i.zIndex=0),i}var Ct=(function(s){function n(i,e){var t,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(Z(this,n),t=j(this,n),c(t,"elements",{}),c(t,"canvasContexts",{}),c(t,"webGLContexts",{}),c(t,"pickingLayers",new Set),c(t,"textures",{}),c(t,"frameBuffers",{}),c(t,"activeListeners",{}),c(t,"labelGrid",new Le),c(t,"nodeDataCache",{}),c(t,"edgeDataCache",{}),c(t,"nodeProgramIndex",{}),c(t,"edgeProgramIndex",{}),c(t,"nodesWithForcedLabels",new Set),c(t,"edgesWithForcedLabels",new Set),c(t,"nodeExtent",{x:[0,1],y:[0,1]}),c(t,"nodeZExtent",[1/0,-1/0]),c(t,"edgeZExtent",[1/0,-1/0]),c(t,"matrix",N()),c(t,"invMatrix",N()),c(t,"correctionRatio",1),c(t,"customBBox",null),c(t,"normalizationFunction",be({x:[0,1],y:[0,1]})),c(t,"graphToViewportRatio",1),c(t,"itemIDsIndex",{}),c(t,"nodeIndices",{}),c(t,"edgeIndices",{}),c(t,"width",0),c(t,"height",0),c(t,"pixelRatio",pe()),c(t,"pickingDownSizingRatio",2*t.pixelRatio),c(t,"displayedNodeLabels",new Set),c(t,"displayedEdgeLabels",new Set),c(t,"highlightedNodes",new Set),c(t,"hoveredNode",null),c(t,"hoveredEdge",null),c(t,"renderFrame",null),c(t,"renderHighlightedNodesFrame",null),c(t,"needToProcess",!1),c(t,"checkEdgesEventsFrame",null),c(t,"nodePrograms",{}),c(t,"nodeHoverPrograms",{}),c(t,"edgePrograms",{}),t.settings=nt(a),oe(t.settings),tt(i),!(e instanceof HTMLElement))throw new Error("Sigma: container should be an html element.");t.graph=i,t.container=e,t.createWebGLContext("edges",{picking:a.enableEdgeEvents}),t.createCanvasContext("edgeLabels"),t.createWebGLContext("nodes",{picking:!0}),t.createCanvasContext("labels"),t.createCanvasContext("hovers"),t.createWebGLContext("hoverNodes"),t.createCanvasContext("mouse",{style:{touchAction:"none",userSelect:"none"}}),t.resize();for(var r in t.settings.nodeProgramClasses)t.registerNodeProgram(r,t.settings.nodeProgramClasses[r],t.settings.nodeHoverProgramClasses[r]);for(var o in t.settings.edgeProgramClasses)t.registerEdgeProgram(o,t.settings.edgeProgramClasses[o]);return t.camera=new Ce,t.bindCameraHandlers(),t.mouseCaptor=new lt(t.elements.mouse,t),t.mouseCaptor.setSettings(t.settings),t.touchCaptor=new gt(t.elements.mouse,t),t.touchCaptor.setSettings(t.settings),t.bindEventHandlers(),t.bindGraphHandlers(),t.handleSettingsUpdate(),t.refresh(),t}return Y(n,s),O(n,[{key:"registerNodeProgram",value:function(e,t,a){return this.nodePrograms[e]&&this.nodePrograms[e].kill(),this.nodeHoverPrograms[e]&&this.nodeHoverPrograms[e].kill(),this.nodePrograms[e]=new t(this.webGLContexts.nodes,this.frameBuffers.nodes,this),this.nodeHoverPrograms[e]=new(a||t)(this.webGLContexts.hoverNodes,null,this),this}},{key:"registerEdgeProgram",value:function(e,t){return this.edgePrograms[e]&&this.edgePrograms[e].kill(),this.edgePrograms[e]=new t(this.webGLContexts.edges,this.frameBuffers.edges,this),this}},{key:"unregisterNodeProgram",value:function(e){if(this.nodePrograms[e]){var t=this.nodePrograms,a=t[e],r=he(t,[e].map(ne));a.kill(),this.nodePrograms=r}if(this.nodeHoverPrograms[e]){var o=this.nodeHoverPrograms,h=o[e],d=he(o,[e].map(ne));h.kill(),this.nodePrograms=d}return this}},{key:"unregisterEdgeProgram",value:function(e){if(this.edgePrograms[e]){var t=this.edgePrograms,a=t[e],r=he(t,[e].map(ne));a.kill(),this.edgePrograms=r}return this}},{key:"resetWebGLTexture",value:function(e){var t=this.webGLContexts[e],a=this.frameBuffers[e],r=this.textures[e];r&&t.deleteTexture(r);var o=t.createTexture();return t.bindFramebuffer(t.FRAMEBUFFER,a),t.bindTexture(t.TEXTURE_2D,o),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,null),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,o,0),this.textures[e]=o,this}},{key:"bindCameraHandlers",value:function(){var e=this;return this.activeListeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.activeListeners.camera),this}},{key:"unbindCameraHandlers",value:function(){return this.camera.removeListener("updated",this.activeListeners.camera),this}},{key:"getNodeAtPosition",value:function(e){var t=e.x,a=e.y,r=ge(this.webGLContexts.nodes,this.frameBuffers.nodes,t,a,this.pixelRatio,this.pickingDownSizingRatio),o=ve.apply(void 0,Ee(r)),h=this.itemIDsIndex[o];return h&&h.type==="node"?h.id:null}},{key:"bindEventHandlers",value:function(){var e=this;this.activeListeners.handleResize=function(){e.scheduleRefresh()},window.addEventListener("resize",this.activeListeners.handleResize),this.activeListeners.handleMove=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}},h=e.getNodeAtPosition(r);if(h&&e.hoveredNode!==h&&!e.nodeDataCache[h].hidden){e.hoveredNode&&e.emit("leaveNode",v(v({},o),{},{node:e.hoveredNode})),e.hoveredNode=h,e.emit("enterNode",v(v({},o),{},{node:h})),e.scheduleHighlightedNodesRender();return}if(e.hoveredNode&&e.getNodeAtPosition(r)!==e.hoveredNode){var d=e.hoveredNode;e.hoveredNode=null,e.emit("leaveNode",v(v({},o),{},{node:d})),e.scheduleHighlightedNodesRender();return}if(e.settings.enableEdgeEvents){var l=e.hoveredNode?null:e.getEdgeAtPoint(o.event.x,o.event.y);l!==e.hoveredEdge&&(e.hoveredEdge&&e.emit("leaveEdge",v(v({},o),{},{edge:e.hoveredEdge})),l&&e.emit("enterEdge",v(v({},o),{},{edge:l})),e.hoveredEdge=l)}},this.activeListeners.handleMoveBody=function(a){var r=K(a);e.emit("moveBody",{event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}})},this.activeListeners.handleLeave=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}};e.hoveredNode&&(e.emit("leaveNode",v(v({},o),{},{node:e.hoveredNode})),e.scheduleHighlightedNodesRender()),e.settings.enableEdgeEvents&&e.hoveredEdge&&(e.emit("leaveEdge",v(v({},o),{},{edge:e.hoveredEdge})),e.scheduleHighlightedNodesRender()),e.emit("leaveStage",v({},o))},this.activeListeners.handleEnter=function(a){var r=K(a),o={event:r,preventSigmaDefault:function(){r.preventSigmaDefault()}};e.emit("enterStage",v({},o))};var t=function(r){return function(o){var h=K(o),d={event:h,preventSigmaDefault:function(){h.preventSigmaDefault()}},l=e.getNodeAtPosition(h);if(l)return e.emit("".concat(r,"Node"),v(v({},d),{},{node:l}));if(e.settings.enableEdgeEvents){var u=e.getEdgeAtPoint(h.x,h.y);if(u)return e.emit("".concat(r,"Edge"),v(v({},d),{},{edge:u}))}return e.emit("".concat(r,"Stage"),d)}};return this.activeListeners.handleClick=t("click"),this.activeListeners.handleRightClick=t("rightClick"),this.activeListeners.handleDoubleClick=t("doubleClick"),this.activeListeners.handleWheel=t("wheel"),this.activeListeners.handleDown=t("down"),this.activeListeners.handleUp=t("up"),this.mouseCaptor.on("mousemove",this.activeListeners.handleMove),this.mouseCaptor.on("mousemovebody",this.activeListeners.handleMoveBody),this.mouseCaptor.on("click",this.activeListeners.handleClick),this.mouseCaptor.on("rightClick",this.activeListeners.handleRightClick),this.mouseCaptor.on("doubleClick",this.activeListeners.handleDoubleClick),this.mouseCaptor.on("wheel",this.activeListeners.handleWheel),this.mouseCaptor.on("mousedown",this.activeListeners.handleDown),this.mouseCaptor.on("mouseup",this.activeListeners.handleUp),this.mouseCaptor.on("mouseleave",this.activeListeners.handleLeave),this.mouseCaptor.on("mouseenter",this.activeListeners.handleEnter),this.touchCaptor.on("touchdown",this.activeListeners.handleDown),this.touchCaptor.on("touchdown",this.activeListeners.handleMove),this.touchCaptor.on("touchup",this.activeListeners.handleUp),this.touchCaptor.on("touchmove",this.activeListeners.handleMove),this.touchCaptor.on("tap",this.activeListeners.handleClick),this.touchCaptor.on("doubletap",this.activeListeners.handleDoubleClick),this.touchCaptor.on("touchmove",this.activeListeners.handleMoveBody),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph,a=new Set(["x","y","zIndex","type"]);return this.activeListeners.eachNodeAttributesUpdatedGraphUpdate=function(r){var o,h=(o=r.hints)===null||o===void 0?void 0:o.attributes;e.graph.forEachNode(function(l){return e.updateNode(l)});var d=!h||h.some(function(l){return a.has(l)});e.refresh({partialGraph:{nodes:t.nodes()},skipIndexation:!d,schedule:!0})},this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate=function(r){var o,h=(o=r.hints)===null||o===void 0?void 0:o.attributes;e.graph.forEachEdge(function(l){return e.updateEdge(l)});var d=h&&["zIndex","type"].some(function(l){return h==null?void 0:h.includes(l)});e.refresh({partialGraph:{edges:t.edges()},skipIndexation:!d,schedule:!0})},this.activeListeners.addNodeGraphUpdate=function(r){var o=r.key;e.addNode(o),e.refresh({partialGraph:{nodes:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.updateNodeGraphUpdate=function(r){var o=r.key;e.refresh({partialGraph:{nodes:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropNodeGraphUpdate=function(r){var o=r.key;e.removeNode(o),e.refresh({schedule:!0})},this.activeListeners.addEdgeGraphUpdate=function(r){var o=r.key;e.addEdge(o),e.refresh({partialGraph:{edges:[o]},schedule:!0})},this.activeListeners.updateEdgeGraphUpdate=function(r){var o=r.key;e.refresh({partialGraph:{edges:[o]},skipIndexation:!1,schedule:!0})},this.activeListeners.dropEdgeGraphUpdate=function(r){var o=r.key;e.removeEdge(o),e.refresh({schedule:!0})},this.activeListeners.clearEdgesGraphUpdate=function(){e.clearEdgeState(),e.clearEdgeIndices(),e.refresh({schedule:!0})},this.activeListeners.clearGraphUpdate=function(){e.clearEdgeState(),e.clearNodeState(),e.clearEdgeIndices(),e.clearNodeIndices(),e.refresh({schedule:!0})},t.on("nodeAdded",this.activeListeners.addNodeGraphUpdate),t.on("nodeDropped",this.activeListeners.dropNodeGraphUpdate),t.on("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),t.on("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),t.on("edgeAdded",this.activeListeners.addEdgeGraphUpdate),t.on("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),t.on("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),t.on("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),t.on("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),t.on("cleared",this.activeListeners.clearGraphUpdate),this}},{key:"unbindGraphHandlers",value:function(){var e=this.graph;e.removeListener("nodeAdded",this.activeListeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.activeListeners.dropNodeGraphUpdate),e.removeListener("nodeAttributesUpdated",this.activeListeners.updateNodeGraphUpdate),e.removeListener("eachNodeAttributesUpdated",this.activeListeners.eachNodeAttributesUpdatedGraphUpdate),e.removeListener("edgeAdded",this.activeListeners.addEdgeGraphUpdate),e.removeListener("edgeDropped",this.activeListeners.dropEdgeGraphUpdate),e.removeListener("edgeAttributesUpdated",this.activeListeners.updateEdgeGraphUpdate),e.removeListener("eachEdgeAttributesUpdated",this.activeListeners.eachEdgeAttributesUpdatedGraphUpdate),e.removeListener("edgesCleared",this.activeListeners.clearEdgesGraphUpdate),e.removeListener("cleared",this.activeListeners.clearGraphUpdate)}},{key:"getEdgeAtPoint",value:function(e,t){var a=ge(this.webGLContexts.edges,this.frameBuffers.edges,e,t,this.pixelRatio,this.pickingDownSizingRatio),r=ve.apply(void 0,Ee(a)),o=this.itemIDsIndex[r];return o&&o.type==="edge"?o.id:null}},{key:"process",value:function(){var e=this;this.emit("beforeProcess");var t=this.graph,a=this.settings,r=this.getDimensions();if(this.nodeExtent=et(this.graph),!this.settings.autoRescale){var o=r.width,h=r.height,d=this.nodeExtent,l=d.x,u=d.y;this.nodeExtent={x:[(l[0]+l[1])/2-o/2,(l[0]+l[1])/2+o/2],y:[(u[0]+u[1])/2-h/2,(u[0]+u[1])/2+h/2]}}this.normalizationFunction=be(this.customBBox||this.nodeExtent);var g=new Ce,f=X(g.getState(),r,this.getGraphDimensions(),this.getStagePadding());this.labelGrid.resizeAndClear(r,a.labelGridCellSize);for(var m={},p={},y={},E={},b=1,x=t.nodes(),C=0,I=x.length;C<I;C++){var A=x[C],w=this.nodeDataCache[A],k=t.getNodeAttributes(A);w.x=k.x,w.y=k.y,this.normalizationFunction.applyTo(w),typeof w.label=="string"&&!w.hidden&&this.labelGrid.add(A,w.size,this.framedGraphToViewport(w,{matrix:f})),m[w.type]=(m[w.type]||0)+1}this.labelGrid.organize();for(var T in this.nodePrograms){if(!z.call(this.nodePrograms,T))throw new Error('Sigma: could not find a suitable program for node type "'.concat(T,'"!'));this.nodePrograms[T].reallocate(m[T]||0),m[T]=0}this.settings.zIndex&&this.nodeZExtent[0]!==this.nodeZExtent[1]&&(x=ye(this.nodeZExtent,function(re){return e.nodeDataCache[re].zIndex},x));for(var L=0,D=x.length;L<D;L++){var S=x[L];p[S]=b,E[p[S]]={type:"node",id:S},b++;var _=this.nodeDataCache[S];this.addNodeToProgram(S,p[S],m[_.type]++)}for(var P={},R=t.edges(),U=0,$=R.length;U<$;U++){var q=R[U],V=this.edgeDataCache[q];P[V.type]=(P[V.type]||0)+1}this.settings.zIndex&&this.edgeZExtent[0]!==this.edgeZExtent[1]&&(R=ye(this.edgeZExtent,function(re){return e.edgeDataCache[re].zIndex},R));for(var H in this.edgePrograms){if(!z.call(this.edgePrograms,H))throw new Error('Sigma: could not find a suitable program for edge type "'.concat(H,'"!'));this.edgePrograms[H].reallocate(P[H]||0),P[H]=0}for(var B=0,ae=R.length;B<ae;B++){var G=R[B];y[G]=b,E[y[G]]={type:"edge",id:G},b++;var ke=this.edgeDataCache[G];this.addEdgeToProgram(G,y[G],P[ke.type]++)}return this.itemIDsIndex=E,this.nodeIndices=p,this.edgeIndices=y,this.emit("afterProcess"),this}},{key:"handleSettingsUpdate",value:function(e){var t=this,a=this.settings;if(this.camera.minRatio=a.minCameraRatio,this.camera.maxRatio=a.maxCameraRatio,this.camera.enabledZooming=a.enableCameraZooming,this.camera.enabledPanning=a.enableCameraPanning,this.camera.enabledRotation=a.enableCameraRotation,a.cameraPanBoundaries?this.camera.clean=function(l){return t.cleanCameraState(l,a.cameraPanBoundaries&&le(a.cameraPanBoundaries)==="object"?a.cameraPanBoundaries:{})}:this.camera.clean=null,this.camera.setState(this.camera.validateState(this.camera.getState())),e){if(e.edgeProgramClasses!==a.edgeProgramClasses){for(var r in a.edgeProgramClasses)a.edgeProgramClasses[r]!==e.edgeProgramClasses[r]&&this.registerEdgeProgram(r,a.edgeProgramClasses[r]);for(var o in e.edgeProgramClasses)a.edgeProgramClasses[o]||this.unregisterEdgeProgram(o)}if(e.nodeProgramClasses!==a.nodeProgramClasses||e.nodeHoverProgramClasses!==a.nodeHoverProgramClasses){for(var h in a.nodeProgramClasses)(a.nodeProgramClasses[h]!==e.nodeProgramClasses[h]||a.nodeHoverProgramClasses[h]!==e.nodeHoverProgramClasses[h])&&this.registerNodeProgram(h,a.nodeProgramClasses[h],a.nodeHoverProgramClasses[h]);for(var d in e.nodeProgramClasses)a.nodeProgramClasses[d]||this.unregisterNodeProgram(d)}}return this.mouseCaptor.setSettings(this.settings),this.touchCaptor.setSettings(this.settings),this}},{key:"cleanCameraState",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=t.tolerance,r=a===void 0?0:a,o=t.boundaries,h=v({},e),d=o||this.nodeExtent,l=Q(d.x,2),u=l[0],g=l[1],f=Q(d.y,2),m=f[0],p=f[1],y=[this.graphToViewport({x:u,y:m},{cameraState:e}),this.graphToViewport({x:g,y:m},{cameraState:e}),this.graphToViewport({x:u,y:p},{cameraState:e}),this.graphToViewport({x:g,y:p},{cameraState:e})],E=1/0,b=-1/0,x=1/0,C=-1/0;y.forEach(function(P){var R=P.x,U=P.y;E=Math.min(E,R),b=Math.max(b,R),x=Math.min(x,U),C=Math.max(C,U)});var I=b-E,A=C-x,w=this.getDimensions(),k=w.width,T=w.height,L=0,D=0;if(I>=k?b<k-r?L=b-(k-r):E>r&&(L=E-r):b>k+r?L=b-(k+r):E<-r&&(L=E+r),A>=T?C<T-r?D=C-(T-r):x>r&&(D=x-r):C>T+r?D=C-(T+r):x<-r&&(D=x+r),L||D){var S=this.viewportToFramedGraph({x:0,y:0},{cameraState:e}),_=this.viewportToFramedGraph({x:L,y:D},{cameraState:e});L=_.x-S.x,D=_.y-S.y,h.x+=L,h.y+=D}return h}},{key:"renderLabels",value:function(){if(!this.settings.renderLabels)return this;var e=this.camera.getState(),t=this.labelGrid.getLabelsToDisplay(e.ratio,this.settings.labelDensity);xe(t,this.nodesWithForcedLabels),this.displayedNodeLabels=new Set;for(var a=this.canvasContexts.labels,r=0,o=t.length;r<o;r++){var h=t[r],d=this.nodeDataCache[h];if(!this.displayedNodeLabels.has(h)&&!d.hidden){var l=this.framedGraphToViewport(d),u=l.x,g=l.y,f=this.scaleSize(d.size);if(!(!d.forceLabel&&f<this.settings.labelRenderedSizeThreshold)&&!(u<-Se||u>this.width+Se||g<-Pe||g>this.height+Pe)){this.displayedNodeLabels.add(h);var m=this.settings.defaultDrawNodeLabel,p=this.nodePrograms[d.type],y=(p==null?void 0:p.drawLabel)||m;y(a,v(v({key:h},d),{},{size:f,x:u,y:g}),this.settings)}}}return this}},{key:"renderEdgeLabels",value:function(){if(!this.settings.renderEdgeLabels)return this;var e=this.canvasContexts.edgeLabels;e.clearRect(0,0,this.width,this.height);var t=yt({graph:this.graph,hoveredNode:this.hoveredNode,displayedNodeLabels:this.displayedNodeLabels,highlightedNodes:this.highlightedNodes});xe(t,this.edgesWithForcedLabels);for(var a=new Set,r=0,o=t.length;r<o;r++){var h=t[r],d=this.graph.extremities(h),l=this.nodeDataCache[d[0]],u=this.nodeDataCache[d[1]],g=this.edgeDataCache[h];if(!a.has(h)&&!(g.hidden||l.hidden||u.hidden)){var f=this.settings.defaultDrawEdgeLabel,m=this.edgePrograms[g.type],p=(m==null?void 0:m.drawLabel)||f;p(e,v(v({key:h},g),{},{size:this.scaleSize(g.size)}),v(v(v({key:d[0]},l),this.framedGraphToViewport(l)),{},{size:this.scaleSize(l.size)}),v(v(v({key:d[1]},u),this.framedGraphToViewport(u)),{},{size:this.scaleSize(u.size)}),this.settings),a.add(h)}}return this.displayedEdgeLabels=a,this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.canvasContexts.hovers;t.clearRect(0,0,this.width,this.height);var a=function(f){var m=e.nodeDataCache[f],p=e.framedGraphToViewport(m),y=p.x,E=p.y,b=e.scaleSize(m.size),x=e.settings.defaultDrawNodeHover,C=e.nodePrograms[m.type],I=(C==null?void 0:C.drawHover)||x;I(t,v(v({key:f},m),{},{size:b,x:y,y:E}),e.settings)},r=[];this.hoveredNode&&!this.nodeDataCache[this.hoveredNode].hidden&&r.push(this.hoveredNode),this.highlightedNodes.forEach(function(g){g!==e.hoveredNode&&r.push(g)}),r.forEach(function(g){return a(g)});var o={};r.forEach(function(g){var f=e.nodeDataCache[g].type;o[f]=(o[f]||0)+1});for(var h in this.nodeHoverPrograms)this.nodeHoverPrograms[h].reallocate(o[h]||0),o[h]=0;r.forEach(function(g){var f=e.nodeDataCache[g];e.nodeHoverPrograms[f.type].process(0,o[f.type]++,f)}),this.webGLContexts.hoverNodes.clear(this.webGLContexts.hoverNodes.COLOR_BUFFER_BIT);var d=this.getRenderParams();for(var l in this.nodeHoverPrograms){var u=this.nodeHoverPrograms[l];u.render(d)}}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;this.renderHighlightedNodesFrame||this.renderFrame||(this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes(),e.renderEdgeLabels()}))}},{key:"render",value:function(){var e=this;this.emit("beforeRender");var t=function(){return e.emit("afterRender"),e};if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.resize(),this.needToProcess&&this.process(),this.needToProcess=!1,this.clear(),this.pickingLayers.forEach(function(y){return e.resetWebGLTexture(y)}),!this.graph.order)return t();var a=this.mouseCaptor,r=this.camera.isAnimated()||a.isMoving||a.draggedEvents||a.currentWheelDirection,o=this.camera.getState(),h=this.getDimensions(),d=this.getGraphDimensions(),l=this.getStagePadding();this.matrix=X(o,h,d,l),this.invMatrix=X(o,h,d,l,!0),this.correctionRatio=$e(this.matrix,o,h),this.graphToViewportRatio=this.getGraphToViewportRatio();var u=this.getRenderParams();for(var g in this.nodePrograms){var f=this.nodePrograms[g];f.render(u)}if(!this.settings.hideEdgesOnMove||!r)for(var m in this.edgePrograms){var p=this.edgePrograms[m];p.render(u)}return this.settings.hideLabelsOnMove&&r||(this.renderLabels(),this.renderEdgeLabels(),this.renderHighlightedNodes()),t()}},{key:"addNode",value:function(e){var t=Object.assign({},this.graph.getNodeAttributes(e));this.settings.nodeReducer&&(t=this.settings.nodeReducer(e,t));var a=bt(this.settings,e,t);this.nodeDataCache[e]=a,this.nodesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.nodesWithForcedLabels.add(e),this.highlightedNodes.delete(e),a.highlighted&&!a.hidden&&this.highlightedNodes.add(e),this.settings.zIndex&&(a.zIndex<this.nodeZExtent[0]&&(this.nodeZExtent[0]=a.zIndex),a.zIndex>this.nodeZExtent[1]&&(this.nodeZExtent[1]=a.zIndex))}},{key:"updateNode",value:function(e){this.addNode(e);var t=this.nodeDataCache[e];this.normalizationFunction.applyTo(t)}},{key:"removeNode",value:function(e){delete this.nodeDataCache[e],delete this.nodeProgramIndex[e],this.highlightedNodes.delete(e),this.hoveredNode===e&&(this.hoveredNode=null),this.nodesWithForcedLabels.delete(e)}},{key:"addEdge",value:function(e){var t=Object.assign({},this.graph.getEdgeAttributes(e));this.settings.edgeReducer&&(t=this.settings.edgeReducer(e,t));var a=xt(this.settings,e,t);this.edgeDataCache[e]=a,this.edgesWithForcedLabels.delete(e),a.forceLabel&&!a.hidden&&this.edgesWithForcedLabels.add(e),this.settings.zIndex&&(a.zIndex<this.edgeZExtent[0]&&(this.edgeZExtent[0]=a.zIndex),a.zIndex>this.edgeZExtent[1]&&(this.edgeZExtent[1]=a.zIndex))}},{key:"updateEdge",value:function(e){this.addEdge(e)}},{key:"removeEdge",value:function(e){delete this.edgeDataCache[e],delete this.edgeProgramIndex[e],this.hoveredEdge===e&&(this.hoveredEdge=null),this.edgesWithForcedLabels.delete(e)}},{key:"clearNodeIndices",value:function(){this.labelGrid=new Le,this.nodeExtent={x:[0,1],y:[0,1]},this.nodeDataCache={},this.edgeProgramIndex={},this.nodesWithForcedLabels=new Set,this.nodeZExtent=[1/0,-1/0],this.highlightedNodes=new Set}},{key:"clearEdgeIndices",value:function(){this.edgeDataCache={},this.edgeProgramIndex={},this.edgesWithForcedLabels=new Set,this.edgeZExtent=[1/0,-1/0]}},{key:"clearIndices",value:function(){this.clearEdgeIndices(),this.clearNodeIndices()}},{key:"clearNodeState",value:function(){this.displayedNodeLabels=new Set,this.highlightedNodes=new Set,this.hoveredNode=null}},{key:"clearEdgeState",value:function(){this.displayedEdgeLabels=new Set,this.highlightedNodes=new Set,this.hoveredEdge=null}},{key:"clearState",value:function(){this.clearEdgeState(),this.clearNodeState()}},{key:"addNodeToProgram",value:function(e,t,a){var r=this.nodeDataCache[e],o=this.nodePrograms[r.type];if(!o)throw new Error('Sigma: could not find a suitable program for node type "'.concat(r.type,'"!'));o.process(t,a,r),this.nodeProgramIndex[e]=a}},{key:"addEdgeToProgram",value:function(e,t,a){var r=this.edgeDataCache[e],o=this.edgePrograms[r.type];if(!o)throw new Error('Sigma: could not find a suitable program for edge type "'.concat(r.type,'"!'));var h=this.graph.extremities(e),d=this.nodeDataCache[h[0]],l=this.nodeDataCache[h[1]];o.process(t,a,d,l,r),this.edgeProgramIndex[e]=a}},{key:"getRenderParams",value:function(){return{matrix:this.matrix,invMatrix:this.invMatrix,width:this.width,height:this.height,pixelRatio:this.pixelRatio,zoomRatio:this.camera.ratio,cameraAngle:this.camera.angle,sizeRatio:1/this.scaleSize(),correctionRatio:this.correctionRatio,downSizingRatio:this.pickingDownSizingRatio,minEdgeThickness:this.settings.minEdgeThickness,antiAliasingFeather:this.settings.antiAliasingFeather}}},{key:"getStagePadding",value:function(){var e=this.settings,t=e.stagePadding,a=e.autoRescale;return a&&t||0}},{key:"createLayer",value:function(e,t){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(this.elements[e])throw new Error('Sigma: a layer named "'.concat(e,'" already exists'));var r=it(t,{position:"absolute"},{class:"sigma-".concat(e)});return a.style&&Object.assign(r.style,a.style),this.elements[e]=r,"beforeLayer"in a&&a.beforeLayer?this.elements[a.beforeLayer].before(r):"afterLayer"in a&&a.afterLayer?this.elements[a.afterLayer].after(r):this.container.appendChild(r),r}},{key:"createCanvas",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.createLayer(e,"canvas",t)}},{key:"createCanvasContext",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=this.createCanvas(e,t),r={preserveDrawingBuffer:!1,antialias:!1};return this.canvasContexts[e]=a.getContext("2d",r),this}},{key:"createWebGLContext",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=(t==null?void 0:t.canvas)||this.createCanvas(e,t);t.hidden&&a.remove();var r=v({preserveDrawingBuffer:!1,antialias:!1},t),o;o=a.getContext("webgl2",r),o||(o=a.getContext("webgl",r)),o||(o=a.getContext("experimental-webgl",r));var h=o;if(this.webGLContexts[e]=h,h.blendFunc(h.ONE,h.ONE_MINUS_SRC_ALPHA),t.picking){this.pickingLayers.add(e);var d=h.createFramebuffer();if(!d)throw new Error("Sigma: cannot create a new frame buffer for layer ".concat(e));this.frameBuffers[e]=d}return h}},{key:"killLayer",value:function(e){var t=this.elements[e];if(!t)throw new Error("Sigma: cannot kill layer ".concat(e,", which does not exist"));if(this.webGLContexts[e]){var a,r=this.webGLContexts[e];(a=r.getExtension("WEBGL_lose_context"))===null||a===void 0||a.loseContext(),delete this.webGLContexts[e]}else this.canvasContexts[e]&&delete this.canvasContexts[e];return t.remove(),delete this.elements[e],this}},{key:"getCamera",value:function(){return this.camera}},{key:"setCamera",value:function(e){this.unbindCameraHandlers(),this.camera=e,this.bindCameraHandlers()}},{key:"getContainer",value:function(){return this.container}},{key:"getGraph",value:function(){return this.graph}},{key:"setGraph",value:function(e){e!==this.graph&&(this.hoveredNode&&!e.hasNode(this.hoveredNode)&&(this.hoveredNode=null),this.hoveredEdge&&!e.hasEdge(this.hoveredEdge)&&(this.hoveredEdge=null),this.unbindGraphHandlers(),this.checkEdgesEventsFrame!==null&&(cancelAnimationFrame(this.checkEdgesEventsFrame),this.checkEdgesEventsFrame=null),this.graph=e,this.bindGraphHandlers(),this.refresh())}},{key:"getMouseCaptor",value:function(){return this.mouseCaptor}},{key:"getTouchCaptor",value:function(){return this.touchCaptor}},{key:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"getGraphDimensions",value:function(){var e=this.customBBox||this.nodeExtent;return{width:e.x[1]-e.x[0]||1,height:e.y[1]-e.y[0]||1}}},{key:"getNodeDisplayData",value:function(e){var t=this.nodeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getEdgeDisplayData",value:function(e){var t=this.edgeDataCache[e];return t?Object.assign({},t):void 0}},{key:"getNodeDisplayedLabels",value:function(){return new Set(this.displayedNodeLabels)}},{key:"getEdgeDisplayedLabels",value:function(){return new Set(this.displayedEdgeLabels)}},{key:"getSettings",value:function(){return v({},this.settings)}},{key:"getSetting",value:function(e){return this.settings[e]}},{key:"setSetting",value:function(e,t){var a=v({},this.settings);return this.settings[e]=t,oe(this.settings),this.handleSettingsUpdate(a),this.scheduleRefresh(),this}},{key:"updateSetting",value:function(e,t){return this.setSetting(e,t(this.settings[e])),this}},{key:"setSettings",value:function(e){var t=v({},this.settings);return this.settings=v(v({},this.settings),e),oe(this.settings),this.handleSettingsUpdate(t),this.scheduleRefresh(),this}},{key:"resize",value:function(e){var t=this.width,a=this.height;if(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight,this.pixelRatio=pe(),this.width===0)if(this.settings.allowInvalidContainer)this.width=1;else throw new Error("Sigma: Container has no width. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(this.height===0)if(this.settings.allowInvalidContainer)this.height=1;else throw new Error("Sigma: Container has no height. You can set the allowInvalidContainer setting to true to stop seeing this error.");if(!e&&t===this.width&&a===this.height)return this;for(var r in this.elements){var o=this.elements[r];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var h in this.canvasContexts)this.elements[h].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[h].setAttribute("height",this.height*this.pixelRatio+"px"),this.pixelRatio!==1&&this.canvasContexts[h].scale(this.pixelRatio,this.pixelRatio);for(var d in this.webGLContexts){this.elements[d].setAttribute("width",this.width*this.pixelRatio+"px"),this.elements[d].setAttribute("height",this.height*this.pixelRatio+"px");var l=this.webGLContexts[d];if(l.viewport(0,0,this.width*this.pixelRatio,this.height*this.pixelRatio),this.pickingLayers.has(d)){var u=this.textures[d];u&&l.deleteTexture(u)}}return this.emit("resize"),this}},{key:"clear",value:function(){return this.emit("beforeClear"),this.webGLContexts.nodes.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.nodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.edges.bindFramebuffer(WebGLRenderingContext.FRAMEBUFFER,null),this.webGLContexts.edges.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.webGLContexts.hoverNodes.clear(WebGLRenderingContext.COLOR_BUFFER_BIT),this.canvasContexts.labels.clearRect(0,0,this.width,this.height),this.canvasContexts.hovers.clearRect(0,0,this.width,this.height),this.canvasContexts.edgeLabels.clearRect(0,0,this.width,this.height),this.emit("afterClear"),this}},{key:"refresh",value:function(e){var t=this,a=(e==null?void 0:e.skipIndexation)!==void 0?e==null?void 0:e.skipIndexation:!1,r=(e==null?void 0:e.schedule)!==void 0?e.schedule:!1,o=!e||!e.partialGraph;if(o)this.clearEdgeIndices(),this.clearNodeIndices(),this.graph.forEachNode(function(C){return t.addNode(C)}),this.graph.forEachEdge(function(C){return t.addEdge(C)});else{for(var h,d,l=((h=e.partialGraph)===null||h===void 0?void 0:h.nodes)||[],u=0,g=(l==null?void 0:l.length)||0;u<g;u++){var f=l[u];if(this.updateNode(f),a){var m=this.nodeProgramIndex[f];if(m===void 0)throw new Error('Sigma: node "'.concat(f,`" can't be repaint`));this.addNodeToProgram(f,this.nodeIndices[f],m)}}for(var p=(e==null||(d=e.partialGraph)===null||d===void 0?void 0:d.edges)||[],y=0,E=p.length;y<E;y++){var b=p[y];if(this.updateEdge(b),a){var x=this.edgeProgramIndex[b];if(x===void 0)throw new Error('Sigma: edge "'.concat(b,`" can't be repaint`));this.addEdgeToProgram(b,this.edgeIndices[b],x)}}}return(o||!a)&&(this.needToProcess=!0),r?this.scheduleRender():this.render(),this}},{key:"scheduleRender",value:function(){var e=this;return this.renderFrame||(this.renderFrame=requestAnimationFrame(function(){e.render()})),this}},{key:"scheduleRefresh",value:function(e){return this.refresh(v(v({},e),{},{schedule:!0}))}},{key:"getViewportZoomedState",value:function(e,t){var a=this.camera.getState(),r=a.ratio,o=a.angle,h=a.x,d=a.y,l=this.settings,u=l.minCameraRatio,g=l.maxCameraRatio;typeof g=="number"&&(t=Math.min(t,g)),typeof u=="number"&&(t=Math.max(t,u));var f=t/r,m={x:this.width/2,y:this.height/2},p=this.viewportToFramedGraph(e),y=this.viewportToFramedGraph(m);return{angle:o,x:(p.x-y.x)*(1-f)+h,y:(p.y-y.y)*(1-f)+d,ratio:t}}},{key:"viewRectangle",value:function(){var e=this.viewportToFramedGraph({x:0,y:0}),t=this.viewportToFramedGraph({x:this.width,y:0}),a=this.viewportToFramedGraph({x:0,y:this.height});return{x1:e.x,y1:e.y,x2:t.x,y2:t.y,height:t.y-a.y}}},{key:"framedGraphToViewport",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!t.cameraState||!!t.viewportDimensions||!!t.graphDimensions,r=t.matrix?t.matrix:a?X(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding()):this.matrix,o=de(r,e);return{x:(1+o.x)*this.width/2,y:(1-o.y)*this.height/2}}},{key:"viewportToFramedGraph",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=!!t.cameraState||!!t.viewportDimensions||!t.graphDimensions,r=t.matrix?t.matrix:a?X(t.cameraState||this.camera.getState(),t.viewportDimensions||this.getDimensions(),t.graphDimensions||this.getGraphDimensions(),t.padding||this.getStagePadding(),!0):this.invMatrix,o=de(r,{x:e.x/this.width*2-1,y:1-e.y/this.height*2});return isNaN(o.x)&&(o.x=0),isNaN(o.y)&&(o.y=0),o}},{key:"viewportToGraph",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.normalizationFunction.inverse(this.viewportToFramedGraph(e,t))}},{key:"graphToViewport",value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.framedGraphToViewport(this.normalizationFunction(e),t)}},{key:"getGraphToViewportRatio",value:function(){var e={x:0,y:0},t={x:1,y:1},a=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),r=this.graphToViewport(e),o=this.graphToViewport(t),h=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2));return h/a}},{key:"getBBox",value:function(){return this.nodeExtent}},{key:"getCustomBBox",value:function(){return this.customBBox}},{key:"setCustomBBox",value:function(e){return this.customBBox=e,this.scheduleRender(),this}},{key:"kill",value:function(){this.emit("kill"),this.removeAllListeners(),this.unbindCameraHandlers(),window.removeEventListener("resize",this.activeListeners.handleResize),this.mouseCaptor.kill(),this.touchCaptor.kill(),this.unbindGraphHandlers(),this.clearIndices(),this.clearState(),this.nodeDataCache={},this.edgeDataCache={},this.highlightedNodes.clear(),this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var e=this.container;e.firstChild;)e.removeChild(e.firstChild);for(var t in this.nodePrograms)this.nodePrograms[t].kill();for(var a in this.nodeHoverPrograms)this.nodeHoverPrograms[a].kill();for(var r in this.edgePrograms)this.edgePrograms[r].kill();this.nodePrograms={},this.nodeHoverPrograms={},this.edgePrograms={};for(var o in this.elements)this.killLayer(o);this.canvasContexts={},this.webGLContexts={},this.elements={}}},{key:"scaleSize",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.camera.ratio;return e/this.settings.zoomToSizeRatioFunction(t)*(this.getSetting("itemSizesReference")==="positions"?t*this.graphToViewportRatio:1)}},{key:"getCanvases",value:function(){var e={};for(var t in this.elements)this.elements[t]instanceof HTMLCanvasElement&&(e[t]=this.elements[t]);return e}}])})(ue),Lt=Ct;export{Ce as Camera,lt as MouseCaptor,Ct as Sigma,gt as TouchCaptor,Lt as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var He=Object.defineProperty;var ye=t=>{throw TypeError(t)};var $e=(t,e,r)=>e in t?He(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Q=(t,e,r)=>$e(t,typeof e!="symbol"?e+"":e,r),ae=(t,e,r)=>e.has(t)||ye("Cannot "+r);var s=(t,e,r)=>(ae(t,e,"read from private field"),r?r.call(t):e.get(t)),_=(t,e,r)=>e.has(t)?ye("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),f=(t,e,r,n)=>(ae(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r),p=(t,e,r)=>(ae(t,e,"access private method"),r);import{ag as Be,am as Se,b2 as je,bs as Ye,aB as Ee,a_ as Y,bk as De,ax as d,ay as N,Q as x,B as Te,Z as qe,aw as me,r as ze,s as we,_ as V,a5 as q,aV as oe,a6 as W,aO as Xe,a8 as Ue,bb as re,bc as se,bd as Ne,d as Ge,au as Qe,V as Oe,a2 as Me,aD as Ze,ac as fe,be as z,aQ as Je,bj as Ke,aE as Z,m as et,l as tt,bn as rt,bm as st,a9 as nt,by as it,bo as at,a4 as ot,ar as C,aI as ft,T as Ce,K as ut,R as lt,e as be,O as ct,aN as dt,M as Ae,aC as le,q as ht,as as _t,p as ce,bf as J,az as pt,a1 as vt,a3 as gt,X as mt,aZ as bt,o as yt,aA as Et,aW as Tt}from"./oiO4RLqp.js";function wt(t){let e=0,r=De(0),n;return()=>{Be()&&(Se(r),je(()=>(e===0&&(n=Ye(()=>t(()=>Ee(r)))),e+=1,()=>{Y(()=>{e-=1,e===0&&(n==null||n(),n=void 0,Ee(r))})})))}}var Nt=et|tt;function At(t,e,r,n){new kt(t,e,r,n)}var T,X,A,$,m,k,v,w,S,B,L,j,U,G,D,ne,u,Le,xe,Fe,de,ee,te,he,_e;class kt{constructor(e,r,n,o){_(this,u);Q(this,"parent");Q(this,"is_pending",!1);Q(this,"transform_error");_(this,T);_(this,X,N?d:null);_(this,A);_(this,$);_(this,m);_(this,k,null);_(this,v,null);_(this,w,null);_(this,S,null);_(this,B,0);_(this,L,0);_(this,j,!1);_(this,U,new Set);_(this,G,new Set);_(this,D,null);_(this,ne,wt(()=>(f(this,D,De(s(this,B))),()=>{f(this,D,null)})));var i;f(this,T,e),f(this,A,r),f(this,$,a=>{var h=x;h.b=this,h.f|=Te,n(a)}),this.parent=x.b,this.transform_error=o??((i=this.parent)==null?void 0:i.transform_error)??(a=>a),f(this,m,qe(()=>{if(N){const a=s(this,X);me();const h=a.data===ze;if(a.data.startsWith(we)){const c=JSON.parse(a.data.slice(we.length));p(this,u,xe).call(this,c)}else h?p(this,u,Fe).call(this):p(this,u,Le).call(this)}else p(this,u,de).call(this)},Nt)),N&&f(this,T,d)}defer_effect(e){Ue(e,s(this,U),s(this,G))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!s(this,A).pending}update_pending_count(e,r){p(this,u,he).call(this,e,r),f(this,B,s(this,B)+e),!(!s(this,D)||s(this,j))&&(f(this,j,!0),Y(()=>{f(this,j,!1),s(this,D)&&Ze(s(this,D),s(this,B))}))}get_effect_pending(){return s(this,ne).call(this),Se(s(this,D))}error(e){var r;if(!s(this,A).onerror&&!s(this,A).failed)throw e;(r=W)!=null&&r.is_fork?(s(this,k)&&W.skip_effect(s(this,k)),s(this,v)&&W.skip_effect(s(this,v)),s(this,w)&&W.skip_effect(s(this,w)),W.on_fork_commit(()=>{p(this,u,_e).call(this,e)})):p(this,u,_e).call(this,e)}}T=new WeakMap,X=new WeakMap,A=new WeakMap,$=new WeakMap,m=new WeakMap,k=new WeakMap,v=new WeakMap,w=new WeakMap,S=new WeakMap,B=new WeakMap,L=new WeakMap,j=new WeakMap,U=new WeakMap,G=new WeakMap,D=new WeakMap,ne=new WeakMap,u=new WeakSet,Le=function(){try{f(this,k,V(()=>s(this,$).call(this,s(this,T))))}catch(e){this.error(e)}},xe=function(e){const r=s(this,A).failed;r&&f(this,w,V(()=>{r(s(this,T),()=>e,()=>()=>{})}))},Fe=function(){const e=s(this,A).pending;e&&(this.is_pending=!0,f(this,v,V(()=>e(s(this,T)))),Y(()=>{var r=f(this,S,document.createDocumentFragment()),n=q();r.append(n),f(this,k,p(this,u,te).call(this,()=>V(()=>s(this,$).call(this,n)))),s(this,L)===0&&(s(this,T).before(r),f(this,S,null),oe(s(this,v),()=>{f(this,v,null)}),p(this,u,ee).call(this,W))}))},de=function(){try{if(this.is_pending=this.has_pending_snippet(),f(this,L,0),f(this,B,0),f(this,k,V(()=>{s(this,$).call(this,s(this,T))})),s(this,L)>0){var e=f(this,S,document.createDocumentFragment());Xe(s(this,k),e);const r=s(this,A).pending;f(this,v,V(()=>r(s(this,T))))}else p(this,u,ee).call(this,W)}catch(r){this.error(r)}},ee=function(e){this.is_pending=!1,e.transfer_effects(s(this,U),s(this,G))},te=function(e){var r=x,n=Oe,o=Me;re(s(this,m)),se(s(this,m)),Ne(s(this,m).ctx);try{return Ge.ensure(),e()}catch(i){return Qe(i),null}finally{re(r),se(n),Ne(o)}},he=function(e,r){var n;if(!this.has_pending_snippet()){this.parent&&p(n=this.parent,u,he).call(n,e,r);return}f(this,L,s(this,L)+e),s(this,L)===0&&(p(this,u,ee).call(this,r),s(this,v)&&oe(s(this,v),()=>{f(this,v,null)}),s(this,S)&&(s(this,T).before(s(this,S)),f(this,S,null)))},_e=function(e){s(this,k)&&(fe(s(this,k)),f(this,k,null)),s(this,v)&&(fe(s(this,v)),f(this,v,null)),s(this,w)&&(fe(s(this,w)),f(this,w,null)),N&&(z(s(this,X)),Je(),z(Ke()));var r=s(this,A).onerror;let n=s(this,A).failed;var o=!1,i=!1;const a=()=>{if(o){st();return}o=!0,i&&rt(),s(this,w)!==null&&oe(s(this,w),()=>{f(this,w,null)}),p(this,u,te).call(this,()=>{p(this,u,de).call(this)})},h=l=>{try{i=!0,r==null||r(l,a),i=!1}catch(c){Z(c,s(this,m)&&s(this,m).parent)}n&&f(this,w,p(this,u,te).call(this,()=>{try{return V(()=>{var c=x;c.b=this,c.f|=Te,n(s(this,T),()=>l,()=>a)})}catch(c){return Z(c,s(this,m).parent),null}}))};Y(()=>{var l;try{l=this.transform_error(e)}catch(c){Z(c,s(this,m)&&s(this,m).parent);return}l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(h,c=>Z(c,s(this,m)&&s(this,m).parent)):h(l)})};function Pt(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const Rt=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function Vt(t){return Rt.includes(t)}const St={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject",novalidate:"noValidate",allowfullscreen:"allowFullscreen",disablepictureinpicture:"disablePictureInPicture",disableremoteplayback:"disableRemotePlayback"};function Wt(t){return t=t.toLowerCase(),St[t]??t}const Dt=["touchstart","touchmove"];function Ot(t){return Dt.includes(t)}const Mt=["textarea","script","style","title"];function Ht(t){return Mt.includes(t)}const H=Symbol("events"),Ie=new Set,pe=new Set;function Pe(t,e,r,n={}){function o(i){if(n.capture||ve.call(e,i),!i.cancelBubble)return it(()=>r==null?void 0:r.call(this,i))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Y(()=>{e.addEventListener(t,o,n)}):e.addEventListener(t,o,n),o}function $t(t,e,r,n={}){var o=Pe(e,t,r,n);return()=>{t.removeEventListener(e,o,n)}}function Bt(t,e,r,n,o){var i={capture:n,passive:o},a=Pe(t,e,r,i);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&at(()=>{e.removeEventListener(t,a,i)})}function jt(t,e,r){(e[H]??(e[H]={}))[t]=r}function Yt(t){for(var e=0;e<t.length;e++)Ie.add(t[e]);for(var r of pe)r(t)}let ke=null;function ve(t){var I,E;var e=this,r=e.ownerDocument,n=t.type,o=((I=t.composedPath)==null?void 0:I.call(t))||[],i=o[0]||t.target;ke=t;var a=0,h=ke===t&&t[H];if(h){var l=o.indexOf(h);if(l!==-1&&(e===document||e===window)){t[H]=e;return}var c=o.indexOf(e);if(c===-1)return;l<=c&&(a=l)}if(i=o[a]||t.target,i!==e){nt(t,"currentTarget",{configurable:!0,get(){return i||r}});var O=Oe,F=x;se(null),re(null);try{for(var M,b=[];i!==null;){var g=i.assignedSlot||i.parentNode||i.host||null;try{var y=(E=i[H])==null?void 0:E[n];y!=null&&(!i.disabled||t.target===i)&&y.call(i,t)}catch(P){M?b.push(P):M=P}if(t.cancelBubble||g===e||g===null)break;i=g}if(M){for(let P of b)queueMicrotask(()=>{throw P});throw M}}finally{t[H]=e,delete t.currentTarget,se(O),re(F)}}}var Re;const ue=((Re=globalThis==null?void 0:globalThis.window)==null?void 0:Re.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:t=>t});function Ct(t){return(ue==null?void 0:ue.createHTML(t))??t}function Ve(t){var e=ot("template");return e.innerHTML=Ct(t.replaceAll("<!>","<!---->")),e.content}function R(t,e){var r=x;r.nodes===null&&(r.nodes={start:t,end:e,a:null,t:null})}function qt(t,e){var r=(e&Ce)!==0,n=(e&ut)!==0,o,i=!t.startsWith("<!>");return()=>{if(N)return R(d,null),d;o===void 0&&(o=Ve(i?t:"<!>"+t),r||(o=C(o)));var a=n||ft?document.importNode(o,!0):o.cloneNode(!0);if(r){var h=C(a),l=a.lastChild;R(h,l)}else R(a,a);return a}}function Lt(t,e,r="svg"){var n=!t.startsWith("<!>"),o=(e&Ce)!==0,i=`<${r}>${n?t:"<!>"+t}</${r}>`,a;return()=>{if(N)return R(d,null),d;if(!a){var h=Ve(i),l=C(h);if(o)for(a=document.createDocumentFragment();C(l);)a.appendChild(C(l));else a=C(l)}var c=a.cloneNode(!0);if(o){var O=C(c),F=c.lastChild;R(O,F)}else R(c,c);return c}}function zt(t,e){return Lt(t,e,"svg")}function Xt(t=""){if(!N){var e=q(t+"");return R(e,e),e}var r=d;return r.nodeType!==ct?(r.before(r=q()),z(r)):dt(r),R(r,r),r}function Ut(){if(N)return R(d,null),d;var t=document.createDocumentFragment(),e=document.createComment(""),r=q();return t.append(e,r),R(e,r),t}function Gt(t,e){if(N){var r=x;((r.f<)===0||r.nodes.end===null)&&(r.nodes.end=d),me();return}t!==null&&t.before(e)}function Qt(){var t,e;if(N&&d&&d.nodeType===be&&((t=d.textContent)!=null&&t.startsWith("$"))){const r=d.textContent.substring(1);return me(),r}return(e=window.__svelte??(window.__svelte={})).uid??(e.uid=1),`c${window.__svelte.uid++}`}function Zt(t,e){var n;var r=e==null?"":typeof e=="object"?`${e}`:e;r!==(t[n=Ae]??(t[n]=t.nodeValue))&&(t[Ae]=r,t.nodeValue=`${r}`)}function xt(t,e){return We(t,e)}function Jt(t,e){le(),e.intro=e.intro??!1;const r=e.target,n=N,o=d;try{for(var i=C(r);i&&(i.nodeType!==be||i.data!==ht);)i=_t(i);if(!i)throw ce;J(!0),z(i);const a=We(t,{...e,anchor:i});return J(!1),a}catch(a){if(a instanceof Error&&a.message.split(`
|
|
2
|
+
`).some(h=>h.startsWith("https://svelte.dev/e/")))throw a;return a!==ce&&console.warn("Failed to hydrate: ",a),e.recover===!1&&pt(),le(),vt(r),J(!1),xt(t,e)}finally{J(n),z(o)}}const K=new Map;function We(t,{target:e,anchor:r,props:n={},events:o,context:i,intro:a=!0,transformError:h}){le();var l=void 0,c=gt(()=>{var O=r??e.appendChild(q());At(O,{pending:()=>{}},b=>{bt({});var g=Me;if(i&&(g.c=i),o&&(n.$$events=o),N&&R(b,null),l=t(b,n)||{},N&&(x.nodes.end=d,d===null||d.nodeType!==be||d.data!==yt))throw Et(),ce;Tt()},h);var F=new Set,M=b=>{for(var g=0;g<b.length;g++){var y=b[g];if(!F.has(y)){F.add(y);var I=Ot(y);for(const ie of[e,document]){var E=K.get(ie);E===void 0&&(E=new Map,K.set(ie,E));var P=E.get(y);P===void 0?(ie.addEventListener(y,ve,{passive:I}),E.set(y,1)):E.set(y,P+1)}}}};return M(mt(Ie)),pe.add(M),()=>{var I;for(var b of F)for(const E of[e,document]){var g=K.get(E),y=g.get(b);--y==0?(E.removeEventListener(b,ve),g.delete(b),g.size===0&&K.delete(E)):g.set(b,y)}pe.delete(M),O!==r&&((I=O.parentNode)==null||I.removeChild(O))}});return ge.set(l,c),l}let ge=new WeakMap;function Kt(t,e){const r=ge.get(t);return r?(ge.delete(t),r(e)):Promise.resolve()}export{Gt as a,R as b,Vt as c,Ut as d,wt as e,Pe as f,Yt as g,jt as h,Bt as i,qt as j,zt as k,Jt as l,Pt as m,Ht as n,xt as o,Wt as p,$t as q,Qt as r,Zt as s,Xt as t,Kt as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var rt=e=>{throw TypeError(e)};var Vt=(e,t,n)=>t.has(e)||rt("Cannot "+n);var y=(e,t,n)=>(Vt(e,t,"read from private field"),n?n.call(e):t.get(e)),A=(e,t,n)=>t.has(e)?rt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);import{aR as $e,b7 as Bt,aU as at,bl as T,am as I,b9 as P,bq as we,bg as Kt}from"./oiO4RLqp.js";const M=[];function Ke(e,t=$e){let n=null;const r=new Set;function a(s){if(Bt(e,s)&&(e=s,n)){const l=!M.length;for(const c of r)c[1](),M.push(c,e);if(l){for(let c=0;c<M.length;c+=2)M[c][0](M[c+1]);M.length=0}}}function o(s){a(s(e))}function i(s,l=$e){const c=[s,l];return r.add(c),r.size===1&&(n=t(a,o)||$e),s(e),()=>{r.delete(c),r.size===0&&n&&(n(),n=null)}}return{set:a,update:o,subscribe:i}}class Me{constructor(t,n){this.status=t,typeof n=="string"?this.body={message:n}:n?this.body=n:this.body={message:`Error: ${t}`}}toString(){return JSON.stringify(this.body)}}class ze{constructor(t,n){try{new Headers({location:n})}catch{throw new Error(`Invalid redirect location ${JSON.stringify(n)}: this string contains characters that cannot be used in HTTP headers`)}this.status=t,this.location=n}}class Fe extends Error{constructor(t,n,r){super(r),this.status=t,this.text=n}}new URL("sveltekit-internal://");function Mt(e,t){return e==="/"||t==="ignore"?e:t==="never"?e.endsWith("/")?e.slice(0,-1):e:t==="always"&&!e.endsWith("/")?e+"/":e}function zt(e){return e.split("%25").map(decodeURI).join("%25")}function Ft(e){for(const t in e)e[t]=decodeURIComponent(e[t]);return e}function Oe({href:e}){return e.split("#")[0]}function j(){}function Gt(...e){let t=5381;for(const n of e)if(typeof n=="string"){let r=n.length;for(;r;)t=t*33^n.charCodeAt(--r)}else if(ArrayBuffer.isView(n)){const r=new Uint8Array(n.buffer,n.byteOffset,n.byteLength);let a=r.length;for(;a;)t=t*33^r[--a]}else throw new TypeError("value must be a string or TypedArray");return(t>>>0).toString(36)}new TextEncoder;function Ht(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}const Wt=window.fetch;window.fetch=(e,t)=>((e instanceof Request?e.method:(t==null?void 0:t.method)||"GET")!=="GET"&&X.delete(Ge(e)),Wt(e,t));const X=new Map;function Jt(e,t){const n=Ge(e,t),r=document.querySelector(n);if(r!=null&&r.textContent){r.remove();let{body:a,...o}=JSON.parse(r.textContent);const i=r.getAttribute("data-ttl");return i&&X.set(n,{body:a,init:o,ttl:1e3*Number(i)}),r.getAttribute("data-b64")!==null&&(a=Ht(a)),Promise.resolve(new Response(a,o))}return window.fetch(e,t)}function Yt(e,t,n){if(X.size>0){const r=Ge(e,n),a=X.get(r);if(a){if(performance.now()<a.ttl&&["default","force-cache","only-if-cached",void 0].includes(n==null?void 0:n.cache))return new Response(a.body,a.init);X.delete(r)}}return window.fetch(t,n)}function Ge(e,t){let r=`script[data-sveltekit-fetched][data-url=${JSON.stringify(e instanceof Request?e.url:e)}]`;if(t!=null&&t.headers||t!=null&&t.body){const a=[];t.headers&&a.push([...new Headers(t.headers)].join(",")),t.body&&(typeof t.body=="string"||ArrayBuffer.isView(t.body))&&a.push(t.body),r+=`[data-hash="${Gt(...a)}"]`}return r}const Xt=/^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/,Qt=/^\/\((?:[^)]+)\)$/;function Zt(e){const t=[];return{pattern:e==="/"||Qt.test(e)?/^\/$/:new RegExp(`^${tn(e).map(r=>{const a=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(r);if(a)return t.push({name:a[1],matcher:a[2],optional:!1,rest:!0,chained:!0}),"(?:/([^]*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(r);if(o)return t.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!r)return;const i=r.split(/\[(.+?)\](?!\])/);return"/"+i.map((l,c)=>{if(c%2){if(l.startsWith("x+"))return Ce(String.fromCharCode(parseInt(l.slice(2),16)));if(l.startsWith("u+"))return Ce(String.fromCharCode(...l.slice(2).split("-").map(m=>parseInt(m,16))));const u=Xt.exec(l),[,h,_,p,f]=u;return t.push({name:p,matcher:f,optional:!!h,rest:!!_,chained:_?c===1&&i[0]==="":!1}),_?"([^]*?)":h?"([^/]*)?":"([^/]+?)"}return Ce(l)}).join("")}).join("")}/?$`),params:t}}function en(e){return e!==""&&!/^\([^)]+\)$/.test(e)}function tn(e){return e.slice(1).split("/").filter(en)}function nn(e,t,n){const r={},a=e.slice(1),o=a.filter(s=>s!==void 0);let i=0;for(let s=0;s<t.length;s+=1){const l=t[s];let c=a[s-i];if(l.chained&&l.rest&&i&&(c=a.slice(s-i,s+1).filter(u=>u).join("/"),i=0),c===void 0)if(l.rest)c="";else continue;if(!l.matcher||n[l.matcher](c)){r[l.name]=c;const u=t[s+1],h=a[s+1];u&&!u.rest&&u.optional&&h&&l.chained&&(i=0),!u&&!h&&Object.keys(r).length===o.length&&(i=0);continue}if(l.optional&&l.chained){i++;continue}return}if(!i)return r}function Ce(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function rn({nodes:e,server_loads:t,dictionary:n,matchers:r}){const a=new Set(t);return Object.entries(n).map(([s,[l,c,u]])=>{const{pattern:h,params:_}=Zt(s),p={id:s,exec:f=>{const m=h.exec(f);if(m)return nn(m,_,r)},errors:[1,...u||[]].map(f=>e[f]),layouts:[0,...c||[]].map(i),leaf:o(l)};return p.errors.length=p.layouts.length=Math.max(p.errors.length,p.layouts.length),p});function o(s){const l=s<0;return l&&(s=~s),[l,e[s]]}function i(s){return s===void 0?s:[a.has(s),e[s]]}}function wt(e,t=JSON.parse){try{return t(sessionStorage[e])}catch{}}function ot(e,t,n=JSON.stringify){const r=n(t);try{sessionStorage[e]=r}catch{}}var ht;const U=((ht=globalThis.__sveltekit_1601qfm)==null?void 0:ht.base)??"";var pt;const an=((pt=globalThis.__sveltekit_1601qfm)==null?void 0:pt.assets)??U??"",on="1780461815305",vt="sveltekit:snapshot",yt="sveltekit:scroll",bt="sveltekit:states",sn="sveltekit:pageurl",F="sveltekit:history",Z="sveltekit:navigation",V={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},Ue=location.origin;function He(e){if(e instanceof URL)return e;let t=document.baseURI;if(!t){const n=document.getElementsByTagName("base");t=n.length?n[0].href:document.URL}return new URL(e,t)}function B(){return{x:pageXOffset,y:pageYOffset}}function z(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const st={...V,"":V.hover};function kt(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function St(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=kt(e)}}function qe(e,t,n){let r;try{if(r=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI),n&&r.hash.match(/^#[^/]/)){const s=location.hash.split("#")[1]||"/";r.hash=`#${s}${r.hash}`}}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,o=!r||!!a||Ae(r,t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),i=(r==null?void 0:r.origin)===Ue&&e.hasAttribute("download");return{url:r,external:o,target:a,download:i}}function ve(e){let t=null,n=null,r=null,a=null,o=null,i=null,s=e;for(;s&&s!==document.documentElement;)r===null&&(r=z(s,"preload-code")),a===null&&(a=z(s,"preload-data")),t===null&&(t=z(s,"keepfocus")),n===null&&(n=z(s,"noscroll")),o===null&&(o=z(s,"reload")),i===null&&(i=z(s,"replacestate")),s=kt(s);function l(c){switch(c){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:st[r??"off"],preload_data:st[a??"off"],keepfocus:l(t),noscroll:l(n),reload:l(o),replace_state:l(i)}}function it(e){const t=Ke(e);let n=!0;function r(){n=!0,t.update(i=>i)}function a(i){n=!1,t.set(i)}function o(i){let s;return t.subscribe(l=>{(s===void 0||n&&l!==s)&&i(s=l)})}return{notify:r,set:a,subscribe:o}}const Et={v:j};function ln(){const{set:e,subscribe:t}=Ke(!1);let n;async function r(){clearTimeout(n);try{const a=await fetch(`${an}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!a.ok)return!1;const i=(await a.json()).version!==on;return i&&(e(!0),Et.v(),clearTimeout(n)),i}catch{return!1}}return{subscribe:t,check:r}}function Ae(e,t,n){return e.origin!==Ue||!e.pathname.startsWith(t)?!0:n?e.pathname!==location.pathname:!1}function On(e){}const Rt=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...Rt];const cn=new Set([...Rt]);[...cn];function fn(e){return e.filter(t=>t!=null)}function me(e,t){return e+"/"+t}function We(e){return e instanceof Me||e instanceof Fe?e.status:500}function un(e){return e instanceof Fe?e.text:"Internal Error"}let x,ee,je;const dn=at.toString().includes("$$")||/function \w+\(\) \{\}/.test(at.toString()),lt="a:";var oe,se,ie,le,ce,fe,ue,de,gt,he,mt,pe,_t;dn?(x={data:{},form:null,error:null,params:{},route:{id:null},state:{},status:-1,url:new URL(lt)},ee={current:null},je={current:!1}):(x=new(gt=class{constructor(){A(this,oe,T({}));A(this,se,T(null));A(this,ie,T(null));A(this,le,T({}));A(this,ce,T({id:null}));A(this,fe,T({}));A(this,ue,T(-1));A(this,de,T(new URL(lt)))}get data(){return I(y(this,oe))}set data(t){P(y(this,oe),t)}get form(){return I(y(this,se))}set form(t){P(y(this,se),t)}get error(){return I(y(this,ie))}set error(t){P(y(this,ie),t)}get params(){return I(y(this,le))}set params(t){P(y(this,le),t)}get route(){return I(y(this,ce))}set route(t){P(y(this,ce),t)}get state(){return I(y(this,fe))}set state(t){P(y(this,fe),t)}get status(){return I(y(this,ue))}set status(t){P(y(this,ue),t)}get url(){return I(y(this,de))}set url(t){P(y(this,de),t)}},oe=new WeakMap,se=new WeakMap,ie=new WeakMap,le=new WeakMap,ce=new WeakMap,fe=new WeakMap,ue=new WeakMap,de=new WeakMap,gt),ee=new(mt=class{constructor(){A(this,he,T(null))}get current(){return I(y(this,he))}set current(t){P(y(this,he),t)}},he=new WeakMap,mt),je=new(_t=class{constructor(){A(this,pe,T(!1))}get current(){return I(y(this,pe))}set current(t){P(y(this,pe),t)}},pe=new WeakMap,_t),Et.v=()=>je.current=!0);function xt(e){Object.assign(x,e)}const hn=new Set(["icon","shortcut icon","apple-touch-icon"]);let J=null;const q=wt(yt)??{},te=wt(vt)??{},N={url:it({}),page:it({}),navigating:Ke(null),updated:ln()};function Je(e){q[e]=B()}function pn(e,t){let n=e+1;for(;q[n];)delete q[n],n+=1;for(n=t+1;te[n];)delete te[n],n+=1}function ne(e,t=!1){return t?location.replace(e.href):location.href=e.href,new Promise(j)}async function Lt(){if("serviceWorker"in navigator){const e=await navigator.serviceWorker.getRegistration(U||"/");e&&await e.update()}}let Ye,De,ye,$,Ve,S;const be=[],ke=[];let v=null;function Se(){var e;(e=v==null?void 0:v.fork)==null||e.then(t=>t==null?void 0:t.discard()),v=null}const _e=new Map,Ut=new Set,gn=new Set,Q=new Set;let w={branch:[],error:null,url:null},At=!1,Ee=!1,ct=!0,re=!1,Y=!1,Tt=!1,Xe=!1,It,k,L,C;const Re=new Set,ft=new Map,ut=new Map;async function qn(e,t,n){var o,i,s,l;globalThis.__sveltekit_1601qfm&&(globalThis.__sveltekit_1601qfm.query,globalThis.__sveltekit_1601qfm.prerender),document.URL!==location.href&&(location.href=location.href),S=e,await((i=(o=e.hooks).init)==null?void 0:i.call(o)),Ye=rn(e),$=document.documentElement,Ve=t,De=e.nodes[0],ye=e.nodes[1],De(),ye(),k=(s=history.state)==null?void 0:s[F],L=(l=history.state)==null?void 0:l[Z],k||(k=L=Date.now(),history.replaceState({...history.state,[F]:k,[Z]:L},""));const r=q[k];function a(){r&&(history.scrollRestoration="manual",scrollTo(r.x,r.y))}n?(a(),await Un(Ve,n)):(await G({type:"enter",url:He(S.hash?In(new URL(location.href)):location.href),replace_state:!0}),a()),Ln()}function mn(){be.length=0,Xe=!1}function Pt(e){ke.some(t=>t==null?void 0:t.snapshot)&&(te[e]=ke.map(t=>{var n;return(n=t==null?void 0:t.snapshot)==null?void 0:n.capture()}))}function $t(e){var t;(t=te[e])==null||t.forEach((n,r)=>{var a,o;(o=(a=ke[r])==null?void 0:a.snapshot)==null||o.restore(n)})}function dt(){Je(k),ot(yt,q),Pt(L),ot(vt,te)}async function Ot(e,t,n,r){let a,o;t.invalidateAll&&Se(),await G({type:"goto",url:He(e),keepfocus:t.keepFocus,noscroll:t.noScroll,replace_state:t.replaceState,state:t.state,redirect_count:n,nav_token:r,accept:()=>{if(t.invalidateAll){Xe=!0,a=new Set;for(const[i,s]of ft)for(const l of s.keys())a.add(me(i,l));o=new Set;for(const[i,s]of ut)for(const l of s.keys())o.add(me(i,l))}t.invalidate&&t.invalidate.forEach(xn)}}),t.invalidateAll&&we().then(we).then(()=>{for(const[i,s]of ft)for(const[l,{resource:c}]of s)a!=null&&a.has(me(i,l))&&c.refresh();for(const[i,s]of ut)for(const[l,{resource:c}]of s)o!=null&&o.has(me(i,l))&&c.reconnect()})}async function _n(e){if(e.id!==(v==null?void 0:v.id)){Se();const t={};Re.add(t),v={id:e.id,token:t,promise:jt({...e,preload:t}).then(n=>(Re.delete(t),n.type==="loaded"&&n.state.error&&Se(),n)),fork:null}}return v.promise}async function Ne(e){var n;const t=(n=await Te(e,!1))==null?void 0:n.route;t&&await Promise.all([...t.layouts,t.leaf].filter(Boolean).map(r=>r[1]()))}async function Ct(e,t,n){var a;const r={params:w.params,route:{id:((a=w.route)==null?void 0:a.id)??null},url:new URL(location.href)};if(w={...e.state,nav:r},xt(e.props.page),It=new S.root({target:t,props:{...e.props,stores:N,components:ke},hydrate:n,sync:!1,transformError:void 0}),await Promise.resolve(),$t(L),n){const o={from:null,to:{...r,scroll:q[k]??B()},willUnload:!1,type:"enter",complete:Promise.resolve()};Q.forEach(i=>i(o))}Ee=!0}async function xe({url:e,params:t,branch:n,errors:r,status:a,error:o,route:i,form:s}){let l="never";if(U&&(e.pathname===U||e.pathname===U+"/"))l="always";else for(const f of n)(f==null?void 0:f.slash)!==void 0&&(l=f.slash);e.pathname=Mt(e.pathname,l),e.search=e.search;const c={type:"loaded",state:{url:e,params:t,branch:n,error:o,route:i},props:{constructors:fn(n).map(f=>f.node.component),page:nt(x)}};s!==void 0&&(c.props.form=s);let u={},h=!x,_=0;for(let f=0;f<Math.max(n.length,w.branch.length);f+=1){const m=n[f],d=w.branch[f];(m==null?void 0:m.data)!==(d==null?void 0:d.data)&&(h=!0),m&&(u={...u,...m.data},h&&(c.props[`data_${_}`]=u),_+=1)}return(!w.url||e.href!==w.url.href||w.error!==o||s!==void 0&&s!==x.form||h)&&(c.props.page={error:o,params:t,route:{id:(i==null?void 0:i.id)??null},state:{},status:a,url:new URL(e),form:s??null,data:h?u:x.data}),c}async function Qe({loader:e,parent:t,url:n,params:r,route:a,server_data_node:o}){var c,u;let i=null;const s={dependencies:new Set,params:new Set,parent:!1,route:!1,url:!1,search_params:new Set},l=await e();return{node:l,loader:e,server:o,universal:(c=l.universal)!=null&&c.load?{type:"data",data:i,uses:s}:null,data:i??(o==null?void 0:o.data)??null,slash:((u=l.universal)==null?void 0:u.trailingSlash)??(o==null?void 0:o.slash)}}function wn(e,t,n){let r=e instanceof Request?e.url:e;const a=new URL(r,n);a.origin===n.origin&&(r=a.href.slice(n.origin.length));const o=Ee?Yt(r,a.href,t):Jt(r,t);return{resolved:a,promise:o}}function vn(e,t,n,r,a,o){if(Xe)return!0;if(!a)return!1;if(a.parent&&e||a.route&&t||a.url&&n)return!0;for(const i of a.search_params)if(r.has(i))return!0;for(const i of a.params)if(o[i]!==w.params[i])return!0;for(const i of a.dependencies)if(be.some(s=>s(new URL(i))))return!0;return!1}function Ze(e,t){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?t??null:null}function yn(e,t){if(!e)return new Set(t.searchParams.keys());const n=new Set([...e.searchParams.keys(),...t.searchParams.keys()]);for(const r of n){const a=e.searchParams.getAll(r),o=t.searchParams.getAll(r);a.every(i=>o.includes(i))&&o.every(i=>a.includes(i))&&n.delete(r)}return n}function bn({error:e,url:t,route:n,params:r}){return{type:"loaded",state:{error:e,url:t,route:n,params:r,branch:[]},props:{page:nt(x),constructors:[]}}}async function jt({id:e,invalidating:t,url:n,params:r,route:a,preload:o}){if((v==null?void 0:v.id)===e)return Re.delete(v.token),v.promise;const{errors:i,layouts:s,leaf:l}=a,c=[...s,l];i.forEach(d=>d==null?void 0:d().catch(j)),c.forEach(d=>d==null?void 0:d[1]().catch(j));const u=w.url?e!==Le(w.url):!1,h=w.route?a.id!==w.route.id:!1,_=yn(w.url,n);let p=!1;const f=c.map(async(d,g)=>{var O;if(!d)return;const b=w.branch[g];return d[1]===(b==null?void 0:b.loader)&&!vn(p,h,u,_,(O=b.universal)==null?void 0:O.uses,r)?b:(p=!0,Qe({loader:d[1],url:n,params:r,route:a,parent:async()=>{var ge;const D={};for(let K=0;K<g;K+=1)Object.assign(D,(ge=await f[K])==null?void 0:ge.data);return D},server_data_node:Ze(d[0]?{type:"skip"}:null,d[0]?b==null?void 0:b.server:void 0)}))});for(const d of f)d.catch(j);const m=[];for(let d=0;d<c.length;d+=1)if(c[d])try{m.push(await f[d])}catch(g){if(g instanceof ze)return{type:"redirect",location:g.location};if(Re.has(o))return bn({error:await ae(g,{params:r,url:n,route:{id:a.id}}),url:n,params:r,route:a});let b=We(g),R;if(g instanceof Me)R=g.body;else{if(await N.updated.check())return await Lt(),await ne(n);R=await ae(g,{params:r,url:n,route:{id:a.id}})}const O=await kn(d,m,i);return O?xe({url:n,params:r,branch:m.slice(0,O.idx).concat(O.node),errors:i,status:b,error:R,route:a}):await qt(n,{id:a.id},R,b)}else m.push(void 0);return xe({url:n,params:r,branch:m,errors:i,status:200,error:null,route:a,form:t?void 0:null})}async function kn(e,t,n){for(;e--;)if(n[e]){let r=e;for(;!t[r];)r-=1;try{return{idx:r+1,node:{node:await n[e](),loader:n[e],data:{},server:null,universal:null}}}catch{continue}}}async function et({status:e,error:t,url:n,route:r}){const a={};let o=null;try{const i=await Qe({loader:De,url:n,params:a,route:r,parent:()=>Promise.resolve({}),server_data_node:Ze(o)}),s={node:await ye(),loader:ye,universal:null,server:null,data:null};return xe({url:n,params:a,branch:[i,s],status:e,error:t,errors:[],route:null})}catch(i){if(i instanceof ze)return Ot(new URL(i.location,location.href),{},0);throw i}}async function Sn(e){const t=e.href;if(_e.has(t))return _e.get(t);let n;try{const r=(async()=>{let a=await S.hooks.reroute({url:new URL(e),fetch:async(o,i)=>wn(o,i,e).promise})??e;if(typeof a=="string"){const o=new URL(e);S.hash?o.hash=a:o.pathname=a,a=o}return a})();_e.set(t,r),n=await r}catch{_e.delete(t);return}return n}async function Te(e,t){if(e&&!Ae(e,U,S.hash)){const n=await Sn(e);if(!n)return;const r=En(n);for(const a of Ye){const o=a.exec(r);if(o)return{id:Le(e),invalidating:t,route:a,params:Ft(o),url:e}}}}function En(e){return zt(S.hash?e.hash.replace(/^#/,"").replace(/[?#].+/,""):e.pathname.slice(U.length))||"/"}function Le(e){return(S.hash?e.hash.replace(/^#/,""):e.pathname)+e.search}function Nt({url:e,type:t,intent:n,delta:r,event:a,scroll:o}){let i=!1;const s=tt(w,n,e,t,o??null);r!==void 0&&(s.navigation.delta=r),a!==void 0&&(s.navigation.event=a);const l={...s.navigation,cancel:()=>{i=!0,s.reject(new Error("navigation cancelled"))}};return re||Ut.forEach(c=>c(l)),i?null:s}async function G({type:e,url:t,popped:n,keepfocus:r,noscroll:a,replace_state:o,state:i={},redirect_count:s=0,nav_token:l={},accept:c=j,block:u=j,event:h}){var K;const _=C;C=l;const p=await Te(t,!1),f=e==="enter"?tt(w,p,t,e):Nt({url:t,type:e,delta:n==null?void 0:n.delta,intent:p,scroll:n==null?void 0:n.scroll,event:h});if(!f){u(),C===l&&(C=_);return}const m=k,d=L;c(),re=!0,Ee&&f.navigation.type!=="enter"&&N.navigating.set(ee.current=f.navigation);let g=p&&await jt(p);if(!g){if(Ae(t,U,S.hash))return await ne(t,o);g=await qt(t,{id:null},await ae(new Fe(404,"Not Found",`Not found: ${t.pathname}`),{url:t,params:{},route:{id:null}}),404,o)}if(t=(p==null?void 0:p.url)||t,C!==l)return f.reject(new Error("navigation aborted")),!1;if(g.type==="redirect"){if(s<20){await G({type:e,url:new URL(g.location,t),popped:n,keepfocus:r,noscroll:a,replace_state:o,state:i,redirect_count:s+1,nav_token:l}),f.fulfil(void 0);return}g=await et({status:500,error:await ae(new Error("Redirect loop"),{url:t,params:{},route:{id:null}}),url:t,route:{id:null}})}else g.props.page.status>=400&&await N.updated.check()&&(await Lt(),await ne(t,o));if(mn(),Je(m),Pt(d),g.props.page.url.pathname!==t.pathname&&(t.pathname=g.props.page.url.pathname),i=n?n.state:i,!n){const E=o?0:1,H={[F]:k+=E,[Z]:L+=E,[bt]:i};(o?history.replaceState:history.pushState).call(history,H,"",t),o||pn(k,L)}const b=p&&(v==null?void 0:v.id)===p.id?v.fork:null;v!=null&&v.fork&&!b&&Se(),v=null,g.props.page.state=i;let R;if(Ee){const E=(await Promise.all(Array.from(gn,W=>W(f.navigation)))).filter(W=>typeof W=="function");if(E.length>0){let W=function(){E.forEach(Pe=>{Q.delete(Pe)})};E.push(W),E.forEach(Pe=>{Q.add(Pe)})}const H=f.navigation.to;w={...g.state,nav:{params:H.params,route:H.route,url:H.url}},g.props.page&&(g.props.page.url=t);const Ie=b&&await b;Ie?R=Ie.commit():(J=null,It.$set(g.props),J&&Object.assign(g.props.page,J),xt(g.props.page),R=(K=Kt)==null?void 0:K()),Tt=!0}else await Ct(g,Ve,!1);const{activeElement:O}=document;if(await R,await we(),await we(),C!==l)return f.reject(new Error("navigation aborted")),!1;g.props.page&&J&&Object.assign(g.props.page,J);let D=null;if(ct){const E=n?n.scroll:a?B():null;E?scrollTo(E.x,E.y):(D=t.hash&&document.getElementById(Dt(t)))?D.scrollIntoView():scrollTo(0,0)}const ge=document.activeElement!==O&&document.activeElement!==document.body;!r&&!ge&&Tn(t,!D),ct=!0,re=!1,e==="popstate"&&$t(L),f.fulfil(void 0),f.navigation.to&&(f.navigation.to.scroll=B()),Q.forEach(E=>E(f.navigation)),N.navigating.set(ee.current=null)}async function qt(e,t,n,r,a){return e.origin===Ue&&e.pathname===location.pathname&&!At?await et({status:r,error:n,url:e,route:t}):await ne(e,a)}function Rn(){let e,t={element:void 0,href:void 0},n;$.addEventListener("mousemove",s=>{const l=s.target;clearTimeout(e),e=setTimeout(()=>{o(l,V.hover)},20)});function r(s){s.defaultPrevented||o(s.composedPath()[0],V.tap)}$.addEventListener("mousedown",r),$.addEventListener("touchstart",r,{passive:!0});const a=new IntersectionObserver(s=>{for(const l of s)l.isIntersecting&&(Ne(new URL(l.target.href)),a.unobserve(l.target))},{threshold:0});async function o(s,l){const c=St(s,$),u=c===t.element&&(c==null?void 0:c.href)===t.href&&l>=n;if(!c||u)return;const{url:h,external:_,download:p}=qe(c,U,S.hash);if(_||p)return;const f=ve(c),m=h&&Le(w.url)===Le(h);if(!(f.reload||m))if(l<=f.preload_data){t={element:c,href:c.href},n=V.tap;const d=await Te(h,!1);if(!d)return;_n(d)}else l<=f.preload_code&&(t={element:c,href:c.href},n=l,Ne(h))}function i(){a.disconnect();for(const s of $.querySelectorAll("a")){const{url:l,external:c,download:u}=qe(s,U,S.hash);if(c||u)continue;const h=ve(s);h.reload||(h.preload_code===V.viewport&&a.observe(s),h.preload_code===V.eager&&Ne(l))}}Q.add(i),i()}function ae(e,t){if(e instanceof Me)return e.body;const n=We(e),r=un(e);return S.hooks.handleError({error:e,event:t,status:n,message:r})??{message:r}}function Dn(e,t={}){return e=new URL(He(e)),e.origin!==Ue?Promise.reject(new Error("goto: invalid URL")):Ot(e,t,0)}function xn(e){if(typeof e=="function")be.push(e);else{const{href:t}=new URL(e,location.href);be.push(n=>n.href===t)}}function Ln(){var t,n;history.scrollRestoration="manual",addEventListener("beforeunload",r=>{let a=!1;if(dt(),!re){const o=tt(w,void 0,null,"leave"),i={...o.navigation,cancel:()=>{a=!0,o.reject(new Error("navigation cancelled"))}};Ut.forEach(s=>s(i))}a?(r.preventDefault(),r.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&dt()}),!((t=navigator.connection)!=null&&t.saveData)&&!/2g/.test((n=navigator.connection)==null?void 0:n.effectiveType)&&Rn(),$.addEventListener("click",async r=>{if(r.button||r.which!==1||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.defaultPrevented)return;const a=St(r.composedPath()[0],$);if(!a)return;const{url:o,external:i,target:s,download:l}=qe(a,U,S.hash);if(!o)return;if(s==="_parent"||s==="_top"){if(window.parent!==window)return}else if(s&&s!=="_self")return;const c=ve(a);if(!(a instanceof SVGAElement)&&o.protocol!==location.protocol&&!(o.protocol==="https:"||o.protocol==="http:")||l)return;const[h,_]=(S.hash?o.hash.replace(/^#/,""):o.href).split("#"),p=h===Oe(location);if(i||c.reload&&(!p||!_)){Nt({url:o,type:"link",event:r})?re=!0:r.preventDefault();return}if(_!==void 0&&p){const[,f]=w.url.href.split("#");if(f===_){if(r.preventDefault(),_===""||_==="top"&&a.ownerDocument.getElementById("top")===null)scrollTo({top:0});else{const m=a.ownerDocument.getElementById(decodeURIComponent(_));m&&(m.scrollIntoView(),m.focus())}return}if(Y=!0,Je(k),e(o),!c.replace_state)return;Y=!1}r.preventDefault(),await new Promise(f=>{requestAnimationFrame(()=>{setTimeout(f,0)}),setTimeout(f,100)}),await G({type:"link",url:o,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??o.href===location.href,event:r})}),$.addEventListener("submit",r=>{if(r.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(r.target),o=r.submitter;if(((o==null?void 0:o.formTarget)||a.target)==="_blank"||((o==null?void 0:o.formMethod)||a.method)!=="get")return;const l=new URL((o==null?void 0:o.hasAttribute("formaction"))&&(o==null?void 0:o.formAction)||a.action);if(Ae(l,U,!1))return;const c=r.target,u=ve(c);if(u.reload)return;r.preventDefault(),r.stopPropagation();const h=new FormData(c,o);l.search=new URLSearchParams(h).toString(),G({type:"form",url:l,keepfocus:u.keepfocus,noscroll:u.noscroll,replace_state:u.replace_state??l.href===location.href,event:r})}),addEventListener("popstate",async r=>{var a;if(!Be){if((a=r.state)!=null&&a[F]){const o=r.state[F];if(C={},o===k)return;const i=q[o],s=r.state[bt]??{},l=new URL(r.state[sn]??location.href),c=r.state[Z],u=w.url?Oe(location)===Oe(w.url):!1;if(c===L&&(Tt||u)){s!==x.state&&(x.state=s),e(l),q[k]=B(),i&&scrollTo(i.x,i.y),k=o;return}const _=o-k;await G({type:"popstate",url:l,popped:{state:s,scroll:i,delta:_},accept:()=>{k=o,L=c},block:()=>{history.go(-_)},nav_token:C,event:r})}else if(!Y){const o=new URL(location.href);e(o),S.hash&&location.reload()}}}),addEventListener("hashchange",()=>{Y&&(Y=!1,history.replaceState({...history.state,[F]:++k,[Z]:L},"",location.href))});for(const r of document.querySelectorAll("link"))hn.has(r.rel)&&(r.href=r.href);addEventListener("pageshow",r=>{r.persisted&&N.navigating.set(ee.current=null)});function e(r){w.url=x.url=r,N.page.set(nt(x)),N.page.notify()}}async function Un(e,{status:t=200,error:n,node_ids:r,params:a,route:o,server_route:i,data:s,form:l}){At=!0;const c=new URL(location.href);let u;({params:a={},route:o={id:null}}=await Te(c,!1)||{}),u=Ye.find(({id:p})=>p===o.id);let h,_=!0;try{const p=r.map(async(m,d)=>{const g=s[d];return g!=null&&g.uses&&(g.uses=An(g.uses)),Qe({loader:S.nodes[m],url:c,params:a,route:o,parent:async()=>{const b={};for(let R=0;R<d;R+=1)Object.assign(b,(await p[R]).data);return b},server_data_node:Ze(g)})}),f=await Promise.all(p);if(u){const m=u.layouts;for(let d=0;d<m.length;d++)m[d]||f.splice(d,0,void 0)}h=await xe({url:c,params:a,branch:f,status:t,error:n,errors:u==null?void 0:u.errors,form:l,route:u??null})}catch(p){if(p instanceof ze){await ne(new URL(p.location,location.href));return}h=await et({status:We(p),error:await ae(p,{url:c,params:a,route:o}),url:c,route:o}),e.textContent="",_=!1}finally{}h.props.page&&(h.props.page.state={}),await Ct(h,e,_)}function An(e){return{dependencies:new Set((e==null?void 0:e.dependencies)??[]),params:new Set((e==null?void 0:e.params)??[]),parent:!!(e!=null&&e.parent),route:!!(e!=null&&e.route),url:!!(e!=null&&e.url),search_params:new Set((e==null?void 0:e.search_params)??[])}}let Be=!1;function Tn(e,t=!0){const n=document.querySelector("[autofocus]");if(n)n.focus();else{const r=Dt(e);if(r&&document.getElementById(r)){const{x:o,y:i}=B();setTimeout(()=>{const s=history.state;Be=!0,location.replace(new URL(`#${r}`,location.href)),history.replaceState(s,"",e),t&&scrollTo(o,i),Be=!1})}else{const o=document.body,i=o.getAttribute("tabindex");o.tabIndex=-1,o.focus({preventScroll:!0,focusVisible:!1}),i!==null?o.setAttribute("tabindex",i):o.removeAttribute("tabindex")}const a=getSelection();if(a&&a.type!=="None"){const o=[];for(let i=0;i<a.rangeCount;i+=1)o.push(a.getRangeAt(i));setTimeout(()=>{if(a.rangeCount===o.length){for(let i=0;i<a.rangeCount;i+=1){const s=o[i],l=a.getRangeAt(i);if(s.commonAncestorContainer!==l.commonAncestorContainer||s.startContainer!==l.startContainer||s.endContainer!==l.endContainer||s.startOffset!==l.startOffset||s.endOffset!==l.endOffset)return}a.removeAllRanges()}})}}}function tt(e,t,n,r,a=null){var c,u;let o,i;const s=new Promise((h,_)=>{o=h,i=_});return s.catch(j),{navigation:{from:{params:e.params,route:{id:((c=e.route)==null?void 0:c.id)??null},url:e.url,scroll:B()},to:n&&{params:(t==null?void 0:t.params)??null,route:{id:((u=t==null?void 0:t.route)==null?void 0:u.id)??null},url:n,scroll:a},willUnload:!t,type:r,complete:s},fulfil:o,reject:i}}function nt(e){return{data:e.data,error:e.error,form:e.form,params:e.params,route:e.route,state:e.state,status:e.status,url:e.url}}function In(e){const t=new URL(e);return t.hash=decodeURIComponent(e.hash),t}function Dt(e){let t;if(S.hash){const[,,n]=e.hash.split("#",3);t=n??""}else t=e.hash.slice(1);return decodeURIComponent(t)}export{N as a,U as b,Dn as g,On as l,x as p,qn as s};
|