@kweaver-ai/kweaver-sdk 0.8.2 → 0.8.4

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.
Files changed (107) hide show
  1. package/README.md +26 -52
  2. package/README.zh.md +27 -46
  3. package/dist/api/agent-chat.d.ts +10 -2
  4. package/dist/api/agent-chat.js +19 -5
  5. package/dist/api/datasources.d.ts +14 -0
  6. package/dist/api/datasources.js +14 -0
  7. package/dist/api/resources.d.ts +94 -0
  8. package/dist/api/resources.js +166 -0
  9. package/dist/cli.js +103 -23
  10. package/dist/client.d.ts +10 -4
  11. package/dist/client.js +12 -6
  12. package/dist/commands/agent-members.js +27 -11
  13. package/dist/commands/agent.js +383 -272
  14. package/dist/commands/auth.js +184 -71
  15. package/dist/commands/bkn-metric.js +37 -16
  16. package/dist/commands/bkn-ops.d.ts +1 -1
  17. package/dist/commands/bkn-ops.js +192 -93
  18. package/dist/commands/bkn-query.js +99 -31
  19. package/dist/commands/bkn-schema.d.ts +3 -3
  20. package/dist/commands/bkn-schema.js +127 -86
  21. package/dist/commands/bkn.js +158 -116
  22. package/dist/commands/call.js +23 -13
  23. package/dist/commands/config.js +22 -12
  24. package/dist/commands/context-loader.js +98 -92
  25. package/dist/commands/dataflow.js +14 -6
  26. package/dist/commands/ds.d.ts +0 -31
  27. package/dist/commands/ds.js +18 -426
  28. package/dist/commands/explore-bkn.d.ts +7 -1
  29. package/dist/commands/explore-bkn.js +32 -3
  30. package/dist/commands/explore.js +18 -15
  31. package/dist/commands/model.js +53 -42
  32. package/dist/commands/resource.d.ts +1 -0
  33. package/dist/commands/{dataview.js → resource.js} +62 -84
  34. package/dist/commands/skill.js +201 -65
  35. package/dist/commands/token.js +11 -0
  36. package/dist/commands/tool.js +46 -29
  37. package/dist/commands/toolbox.js +31 -15
  38. package/dist/commands/vega.js +466 -250
  39. package/dist/help/format.d.ts +65 -0
  40. package/dist/help/format.js +141 -0
  41. package/dist/index.d.ts +3 -3
  42. package/dist/index.js +2 -2
  43. package/dist/resources/datasources.d.ts +7 -0
  44. package/dist/resources/datasources.js +7 -0
  45. package/dist/resources/{dataviews.d.ts → resources.d.ts} +10 -11
  46. package/dist/resources/{dataviews.js → resources.js} +12 -13
  47. package/dist/templates/explorer/bkn.js +860 -9
  48. package/dist/templates/explorer/index.html +1 -0
  49. package/dist/templates/explorer/style.css +225 -0
  50. package/dist/templates/explorer/vendor/g6.min.js +68 -0
  51. package/dist/trace-ai/eval-set/schemas.d.ts +1 -0
  52. package/dist/trace-ai/eval-set/schemas.js +4 -0
  53. package/dist/trace-ai/eval-set/types.d.ts +2 -0
  54. package/dist/trace-ai/exp/capture-fingerprint.d.ts +10 -0
  55. package/dist/trace-ai/exp/capture-fingerprint.js +12 -0
  56. package/dist/trace-ai/exp/context/context-assembler.d.ts +18 -0
  57. package/dist/trace-ai/exp/context/context-assembler.js +42 -0
  58. package/dist/trace-ai/exp/context/failure-analyzer.d.ts +22 -0
  59. package/dist/trace-ai/exp/context/failure-analyzer.js +59 -0
  60. package/dist/trace-ai/exp/context/kn-data-prober.d.ts +13 -0
  61. package/dist/trace-ai/exp/context/kn-data-prober.js +38 -0
  62. package/dist/trace-ai/exp/context/kn-schema-client.d.ts +14 -0
  63. package/dist/trace-ai/exp/context/kn-schema-client.js +41 -0
  64. package/dist/trace-ai/exp/context/retrieval-health.d.ts +32 -0
  65. package/dist/trace-ai/exp/context/retrieval-health.js +138 -0
  66. package/dist/trace-ai/exp/context/vega-catalog-client.d.ts +14 -0
  67. package/dist/trace-ai/exp/context/vega-catalog-client.js +15 -0
  68. package/dist/trace-ai/exp/coordinator.d.ts +34 -21
  69. package/dist/trace-ai/exp/coordinator.js +246 -24
  70. package/dist/trace-ai/exp/eval-runner.js +4 -2
  71. package/dist/trace-ai/exp/exp-store/events-jsonl.d.ts +1 -0
  72. package/dist/trace-ai/exp/exp-store/events-jsonl.js +18 -0
  73. package/dist/trace-ai/exp/exp-store/expected-fingerprint.d.ts +3 -0
  74. package/dist/trace-ai/exp/exp-store/expected-fingerprint.js +31 -0
  75. package/dist/trace-ai/exp/exp-store/index.d.ts +63 -2
  76. package/dist/trace-ai/exp/exp-store/index.js +2 -1
  77. package/dist/trace-ai/exp/exp-store/rollback-yaml.d.ts +12 -0
  78. package/dist/trace-ai/exp/exp-store/rollback-yaml.js +29 -0
  79. package/dist/trace-ai/exp/index.d.ts +2 -0
  80. package/dist/trace-ai/exp/index.js +68 -3
  81. package/dist/trace-ai/exp/info.js +1 -1
  82. package/dist/trace-ai/exp/patch/index.d.ts +13 -2
  83. package/dist/trace-ai/exp/patch/index.js +65 -10
  84. package/dist/trace-ai/exp/patch/kn-api-client.d.ts +40 -0
  85. package/dist/trace-ai/exp/patch/kn-api-client.js +14 -0
  86. package/dist/trace-ai/exp/patch/kn.d.ts +8 -0
  87. package/dist/trace-ai/exp/patch/kn.js +36 -0
  88. package/dist/trace-ai/exp/patch/skill-api-client.d.ts +17 -0
  89. package/dist/trace-ai/exp/patch/skill-api-client.js +14 -0
  90. package/dist/trace-ai/exp/patch/skill-content.d.ts +9 -0
  91. package/dist/trace-ai/exp/patch/skill-content.js +12 -0
  92. package/dist/trace-ai/exp/preflight.d.ts +77 -0
  93. package/dist/trace-ai/exp/preflight.js +148 -0
  94. package/dist/trace-ai/exp/providers/synthesizer-client.d.ts +3 -14
  95. package/dist/trace-ai/exp/providers/synthesizer-client.js +53 -35
  96. package/dist/trace-ai/exp/providers/triage-client.d.ts +15 -2
  97. package/dist/trace-ai/exp/providers/triage-client.js +143 -28
  98. package/dist/trace-ai/exp/run-preflight.d.ts +19 -0
  99. package/dist/trace-ai/exp/run-preflight.js +56 -0
  100. package/dist/trace-ai/exp/schemas.d.ts +402 -44
  101. package/dist/trace-ai/exp/schemas.js +131 -18
  102. package/dist/utils/deprecation.d.ts +1 -0
  103. package/dist/utils/deprecation.js +18 -0
  104. package/package.json +2 -1
  105. package/dist/api/dataviews.d.ts +0 -117
  106. package/dist/api/dataviews.js +0 -265
  107. package/dist/commands/dataview.d.ts +0 -8
@@ -0,0 +1,68 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).G6={})}(this,function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,n);if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function r(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach(function(e){r(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function a(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function l(t,e){if(t){if("string"==typeof t)return c(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}function u(t){return function(t){if(Array.isArray(t))return c(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function d(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(d=function(){return!!t})()}function f(t,n){if(n&&("object"==e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function g(t,e,n){return e=h(e),f(t,d()?Reflect.construct(e,n||[],h(t).constructor):e.apply(t,n))}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}function m(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=n){var r,i,o,A,s=[],a=!0,c=!1;try{if(o=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;a=!1}else for(;!(a=(r=o.call(n)).done)&&(s.push(r.value),s.length!==e);a=!0);}catch(t){c=!0,i=t}finally{try{if(!a&&null!=n.return&&(A=n.return(),Object(A)!==A))return}finally{if(c)throw i}}return s}}(t,e)||l(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var w={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function i(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function o(t,e,r,o,A){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||t,A),a=n?n+e:e;return t._events[a]?t._events[a].fn?t._events[a]=[t._events[a],s]:t._events[a].push(s):(t._events[a]=s,t._eventsCount++),t}function A(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var t,r,i=[];if(0===this._eventsCount)return i;for(r in t=this._events)e.call(t,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},s.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,A=new Array(o);i<o;i++)A[i]=r[i].fn;return A},s.prototype.listenerCount=function(t){var e=n?n+t:t,r=this._events[e];return r?r.fn?1:r.length:0},s.prototype.emit=function(t,e,r,i,o,A){var s=n?n+t:t;if(!this._events[s])return!1;var a,c,l=this._events[s],u=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),u){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,r),!0;case 4:return l.fn.call(l.context,e,r,i),!0;case 5:return l.fn.call(l.context,e,r,i,o),!0;case 6:return l.fn.call(l.context,e,r,i,o,A),!0}for(c=1,a=new Array(u-1);c<u;c++)a[c-1]=arguments[c];l.fn.apply(l.context,a)}else{var h,d=l.length;for(c=0;c<d;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),u){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,r);break;case 4:l[c].fn.call(l[c].context,e,r,i);break;default:if(!a)for(h=1,a=new Array(u-1);h<u;h++)a[h-1]=arguments[h];l[c].fn.apply(l[c].context,a)}}return!0},s.prototype.on=function(t,e,n){return o(this,t,e,n,!1)},s.prototype.once=function(t,e,n){return o(this,t,e,n,!0)},s.prototype.removeListener=function(t,e,r,i){var o=n?n+t:t;if(!this._events[o])return this;if(!e)return A(this,o),this;var s=this._events[o];if(s.fn)s.fn!==e||i&&!s.once||r&&s.context!==r||A(this,o);else{for(var a=0,c=[],l=s.length;a<l;a++)(s[a].fn!==e||i&&!s[a].once||r&&s[a].context!==r)&&c.push(s[a]);c.length?this._events[o]=1===c.length?c[0]:c:A(this,o)}return this},s.prototype.removeAllListeners=function(t){var e;return t?(e=n?n+t:t,this._events[e]&&A(this,e)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,t.exports=s}(w);var b=y(w.exports),B=1e-6,E="undefined"!=typeof Float32Array?Float32Array:Array;function x(){var t=new E(9);return E!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function C(){var t=new E(16);return E!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t}function M(t){var e=new E(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function F(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function k(t,e,n,r,i,o,A,s,a,c,l,u,h,d,f,g){var p=new E(16);return p[0]=t,p[1]=e,p[2]=n,p[3]=r,p[4]=i,p[5]=o,p[6]=A,p[7]=s,p[8]=a,p[9]=c,p[10]=l,p[11]=u,p[12]=h,p[13]=d,p[14]=f,p[15]=g,p}function S(t,e,n,r,i,o,A,s,a,c,l,u,h,d,f,g,p){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=A,t[6]=s,t[7]=a,t[8]=c,t[9]=l,t[10]=u,t[11]=h,t[12]=d,t[13]=f,t[14]=g,t[15]=p,t}function Q(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function U(t,e){if(t===e){var n=e[1],r=e[2],i=e[3],o=e[6],A=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=n,t[6]=e[9],t[7]=e[13],t[8]=r,t[9]=o,t[11]=e[14],t[12]=i,t[13]=A,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}function N(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],A=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11],f=e[12],g=e[13],p=e[14],v=e[15],m=n*s-r*A,y=n*a-i*A,w=n*c-o*A,b=r*a-i*s,B=r*c-o*s,E=i*c-o*a,x=l*g-u*f,C=l*p-h*f,M=l*v-d*f,F=u*p-h*g,k=u*v-d*g,S=h*v-d*p,Q=m*S-y*k+w*F+b*M-B*C+E*x;return Q?(Q=1/Q,t[0]=(s*S-a*k+c*F)*Q,t[1]=(i*k-r*S-o*F)*Q,t[2]=(g*E-p*B+v*b)*Q,t[3]=(h*B-u*E-d*b)*Q,t[4]=(a*M-A*S-c*C)*Q,t[5]=(n*S-i*M+o*C)*Q,t[6]=(p*w-f*E-v*y)*Q,t[7]=(l*E-h*w+d*y)*Q,t[8]=(A*k-s*M+c*x)*Q,t[9]=(r*M-n*k-o*x)*Q,t[10]=(f*B-g*w+v*m)*Q,t[11]=(u*w-l*B-d*m)*Q,t[12]=(s*C-A*F-a*x)*Q,t[13]=(n*F-r*C+i*x)*Q,t[14]=(g*y-f*b-p*m)*Q,t[15]=(l*b-u*y+h*m)*Q,t):null}function T(t){var e=t[0],n=t[1],r=t[2],i=t[3],o=t[4],A=t[5],s=t[6],a=t[7],c=t[8],l=t[9],u=t[10],h=t[11],d=t[12],f=t[13],g=t[14],p=e*A-n*o,v=e*s-r*o,m=n*s-r*A,y=c*f-l*d,w=c*g-u*d,b=l*g-u*f;return a*(e*b-n*w+r*y)-i*(o*b-A*w+s*y)+t[15]*(c*m-l*v+u*p)-h*(d*m-f*v+g*p)}function O(t,e,n){var r=e[0],i=e[1],o=e[2],A=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],g=e[12],p=e[13],v=e[14],m=e[15],y=n[0],w=n[1],b=n[2],B=n[3];return t[0]=y*r+w*s+b*u+B*g,t[1]=y*i+w*a+b*h+B*p,t[2]=y*o+w*c+b*d+B*v,t[3]=y*A+w*l+b*f+B*m,y=n[4],w=n[5],b=n[6],B=n[7],t[4]=y*r+w*s+b*u+B*g,t[5]=y*i+w*a+b*h+B*p,t[6]=y*o+w*c+b*d+B*v,t[7]=y*A+w*l+b*f+B*m,y=n[8],w=n[9],b=n[10],B=n[11],t[8]=y*r+w*s+b*u+B*g,t[9]=y*i+w*a+b*h+B*p,t[10]=y*o+w*c+b*d+B*v,t[11]=y*A+w*l+b*f+B*m,y=n[12],w=n[13],b=n[14],B=n[15],t[12]=y*r+w*s+b*u+B*g,t[13]=y*i+w*a+b*h+B*p,t[14]=y*o+w*c+b*d+B*v,t[15]=y*A+w*l+b*f+B*m,t}function I(t,e,n){var r,i,o,A,s,a,c,l,u,h,d,f,g=n[0],p=n[1],v=n[2];return e===t?(t[12]=e[0]*g+e[4]*p+e[8]*v+e[12],t[13]=e[1]*g+e[5]*p+e[9]*v+e[13],t[14]=e[2]*g+e[6]*p+e[10]*v+e[14],t[15]=e[3]*g+e[7]*p+e[11]*v+e[15]):(r=e[0],i=e[1],o=e[2],A=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],d=e[10],f=e[11],t[0]=r,t[1]=i,t[2]=o,t[3]=A,t[4]=s,t[5]=a,t[6]=c,t[7]=l,t[8]=u,t[9]=h,t[10]=d,t[11]=f,t[12]=r*g+s*p+u*v+e[12],t[13]=i*g+a*p+h*v+e[13],t[14]=o*g+c*p+d*v+e[14],t[15]=A*g+l*p+f*v+e[15]),t}function L(t,e,n){var r=n[0],i=n[1],o=n[2];return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t[3]=e[3]*r,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*o,t[9]=e[9]*o,t[10]=e[10]*o,t[11]=e[11]*o,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function P(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[4],A=e[5],s=e[6],a=e[7],c=e[8],l=e[9],u=e[10],h=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=o*i+c*r,t[5]=A*i+l*r,t[6]=s*i+u*r,t[7]=a*i+h*r,t[8]=c*i-o*r,t[9]=l*i-A*r,t[10]=u*i-s*r,t[11]=h*i-a*r,t}function D(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],A=e[1],s=e[2],a=e[3],c=e[8],l=e[9],u=e[10],h=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i-c*r,t[1]=A*i-l*r,t[2]=s*i-u*r,t[3]=a*i-h*r,t[8]=o*r+c*i,t[9]=A*r+l*i,t[10]=s*r+u*i,t[11]=a*r+h*i,t}function R(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t}function H(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function _(t,e,n){var r,i,o,A=n[0],s=n[1],a=n[2],c=Math.sqrt(A*A+s*s+a*a);return c<B?null:(A*=c=1/c,s*=c,a*=c,r=Math.sin(e),o=1-(i=Math.cos(e)),t[0]=A*A*o+i,t[1]=s*A*o+a*r,t[2]=a*A*o-s*r,t[3]=0,t[4]=A*s*o-a*r,t[5]=s*s*o+i,t[6]=a*s*o+A*r,t[7]=0,t[8]=A*a*o+s*r,t[9]=s*a*o-A*r,t[10]=a*a*o+i,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)}function G(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=r,t[6]=n,t[7]=0,t[8]=0,t[9]=-n,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function K(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=0,t[2]=-n,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=n,t[9]=0,t[10]=r,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function j(t,e){var n=Math.sin(e),r=Math.cos(e);return t[0]=r,t[1]=n,t[2]=0,t[3]=0,t[4]=-n,t[5]=r,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function z(t,e,n){var r=e[0],i=e[1],o=e[2],A=e[3],s=r+r,a=i+i,c=o+o,l=r*s,u=r*a,h=r*c,d=i*a,f=i*c,g=o*c,p=A*s,v=A*a,m=A*c;return t[0]=1-(d+g),t[1]=u+m,t[2]=h-v,t[3]=0,t[4]=u-m,t[5]=1-(l+g),t[6]=f+p,t[7]=0,t[8]=h+v,t[9]=f-p,t[10]=1-(l+d),t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t}function V(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t}function W(t,e){var n=e[0],r=e[1],i=e[2],o=e[4],A=e[5],s=e[6],a=e[8],c=e[9],l=e[10];return t[0]=Math.sqrt(n*n+r*r+i*i),t[1]=Math.sqrt(o*o+A*A+s*s),t[2]=Math.sqrt(a*a+c*c+l*l),t}function Y(t,e){var n=new E(3);W(n,e);var r=1/n[0],i=1/n[1],o=1/n[2],A=e[0]*r,s=e[1]*i,a=e[2]*o,c=e[4]*r,l=e[5]*i,u=e[6]*o,h=e[8]*r,d=e[9]*i,f=e[10]*o,g=A+l+f,p=0;return g>0?(p=2*Math.sqrt(g+1),t[3]=.25*p,t[0]=(u-d)/p,t[1]=(h-a)/p,t[2]=(s-c)/p):A>l&&A>f?(p=2*Math.sqrt(1+A-l-f),t[3]=(u-d)/p,t[0]=.25*p,t[1]=(s+c)/p,t[2]=(h+a)/p):l>f?(p=2*Math.sqrt(1+l-A-f),t[3]=(h-a)/p,t[0]=(s+c)/p,t[1]=.25*p,t[2]=(u+d)/p):(p=2*Math.sqrt(1+f-A-l),t[3]=(s-c)/p,t[0]=(h+a)/p,t[1]=(u+d)/p,t[2]=.25*p),t}function X(t,e,n,r,i){var o=e[0],A=e[1],s=e[2],a=e[3],c=o+o,l=A+A,u=s+s,h=o*c,d=o*l,f=o*u,g=A*l,p=A*u,v=s*u,m=a*c,y=a*l,w=a*u,b=r[0],B=r[1],E=r[2],x=i[0],C=i[1],M=i[2],F=(1-(g+v))*b,k=(d+w)*b,S=(f-y)*b,Q=(d-w)*B,U=(1-(h+v))*B,N=(p+m)*B,T=(f+y)*E,O=(p-m)*E,I=(1-(h+g))*E;return t[0]=F,t[1]=k,t[2]=S,t[3]=0,t[4]=Q,t[5]=U,t[6]=N,t[7]=0,t[8]=T,t[9]=O,t[10]=I,t[11]=0,t[12]=n[0]+x-(F*x+Q*C+T*M),t[13]=n[1]+C-(k*x+U*C+O*M),t[14]=n[2]+M-(S*x+N*C+I*M),t[15]=1,t}function q(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],A=n+n,s=r+r,a=i+i,c=n*A,l=r*A,u=r*s,h=i*A,d=i*s,f=i*a,g=o*A,p=o*s,v=o*a;return t[0]=1-u-f,t[1]=l+v,t[2]=h-p,t[3]=0,t[4]=l-v,t[5]=1-c-f,t[6]=d+g,t[7]=0,t[8]=h+p,t[9]=d-g,t[10]=1-c-u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function $(t,e,n,r,i){var o=1/Math.tan(e/2);if(t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){var A=1/(r-i);t[10]=(i+r)*A,t[14]=2*i*r*A}else t[10]=-1,t[14]=-2*r;return t}var Z=$;function J(t,e,n,r,i,o,A){var s=1/(e-n),a=1/(r-i),c=1/(o-A);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*a,t[14]=(A+o)*c,t[15]=1,t}var tt=J;function et(t,e,n,r,i,o,A){var s=1/(e-n),a=1/(r-i),c=1/(o-A);return t[0]=-2*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=c,t[11]=0,t[12]=(e+n)*s,t[13]=(i+r)*a,t[14]=o*c,t[15]=1,t}function nt(t,e,n,r){var i,o,A,s,a,c,l,u,h,d,f=e[0],g=e[1],p=e[2],v=r[0],m=r[1],y=r[2],w=n[0],b=n[1],E=n[2];return Math.abs(f-w)<B&&Math.abs(g-b)<B&&Math.abs(p-E)<B?Q(t):(l=f-w,u=g-b,h=p-E,i=m*(h*=d=1/Math.sqrt(l*l+u*u+h*h))-y*(u*=d),o=y*(l*=d)-v*h,A=v*u-m*l,(d=Math.sqrt(i*i+o*o+A*A))?(i*=d=1/d,o*=d,A*=d):(i=0,o=0,A=0),s=u*A-h*o,a=h*i-l*A,c=l*o-u*i,(d=Math.sqrt(s*s+a*a+c*c))?(s*=d=1/d,a*=d,c*=d):(s=0,a=0,c=0),t[0]=i,t[1]=s,t[2]=l,t[3]=0,t[4]=o,t[5]=a,t[6]=u,t[7]=0,t[8]=A,t[9]=c,t[10]=h,t[11]=0,t[12]=-(i*f+o*g+A*p),t[13]=-(s*f+a*g+c*p),t[14]=-(l*f+u*g+h*p),t[15]=1,t)}function rt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t[3]=e[3]-n[3],t[4]=e[4]-n[4],t[5]=e[5]-n[5],t[6]=e[6]-n[6],t[7]=e[7]-n[7],t[8]=e[8]-n[8],t[9]=e[9]-n[9],t[10]=e[10]-n[10],t[11]=e[11]-n[11],t[12]=e[12]-n[12],t[13]=e[13]-n[13],t[14]=e[14]-n[14],t[15]=e[15]-n[15],t}function it(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]}var ot=O,At=rt,st=Object.freeze({__proto__:null,add:function(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t[3]=e[3]+n[3],t[4]=e[4]+n[4],t[5]=e[5]+n[5],t[6]=e[6]+n[6],t[7]=e[7]+n[7],t[8]=e[8]+n[8],t[9]=e[9]+n[9],t[10]=e[10]+n[10],t[11]=e[11]+n[11],t[12]=e[12]+n[12],t[13]=e[13]+n[13],t[14]=e[14]+n[14],t[15]=e[15]+n[15],t},adjoint:function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],A=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11],f=e[12],g=e[13],p=e[14],v=e[15],m=n*s-r*A,y=n*a-i*A,w=n*c-o*A,b=r*a-i*s,B=r*c-o*s,E=i*c-o*a,x=l*g-u*f,C=l*p-h*f,M=l*v-d*f,F=u*p-h*g,k=u*v-d*g,S=h*v-d*p;return t[0]=s*S-a*k+c*F,t[1]=i*k-r*S-o*F,t[2]=g*E-p*B+v*b,t[3]=h*B-u*E-d*b,t[4]=a*M-A*S-c*C,t[5]=n*S-i*M+o*C,t[6]=p*w-f*E-v*y,t[7]=l*E-h*w+d*y,t[8]=A*k-s*M+c*x,t[9]=r*M-n*k-o*x,t[10]=f*B-g*w+v*m,t[11]=u*w-l*B-d*m,t[12]=s*C-A*F-a*x,t[13]=n*F-r*C+i*x,t[14]=g*y-f*b-p*m,t[15]=l*b-u*y+h*m,t},clone:M,copy:F,create:C,decompose:function(t,e,n,r){e[0]=r[12],e[1]=r[13],e[2]=r[14];var i=r[0],o=r[1],A=r[2],s=r[4],a=r[5],c=r[6],l=r[8],u=r[9],h=r[10];n[0]=Math.sqrt(i*i+o*o+A*A),n[1]=Math.sqrt(s*s+a*a+c*c),n[2]=Math.sqrt(l*l+u*u+h*h);var d=1/n[0],f=1/n[1],g=1/n[2],p=i*d,v=o*f,m=A*g,y=s*d,w=a*f,b=c*g,B=l*d,E=u*f,x=h*g,C=p+w+x,M=0;return C>0?(M=2*Math.sqrt(C+1),t[3]=.25*M,t[0]=(b-E)/M,t[1]=(B-m)/M,t[2]=(v-y)/M):p>w&&p>x?(M=2*Math.sqrt(1+p-w-x),t[3]=(b-E)/M,t[0]=.25*M,t[1]=(v+y)/M,t[2]=(B+m)/M):w>x?(M=2*Math.sqrt(1+w-p-x),t[3]=(B-m)/M,t[0]=(v+y)/M,t[1]=.25*M,t[2]=(b+E)/M):(M=2*Math.sqrt(1+x-p-w),t[3]=(v-y)/M,t[0]=(B+m)/M,t[1]=(b+E)/M,t[2]=.25*M),t},determinant:T,equals:function(t,e){var n=t[0],r=t[1],i=t[2],o=t[3],A=t[4],s=t[5],a=t[6],c=t[7],l=t[8],u=t[9],h=t[10],d=t[11],f=t[12],g=t[13],p=t[14],v=t[15],m=e[0],y=e[1],w=e[2],b=e[3],E=e[4],x=e[5],C=e[6],M=e[7],F=e[8],k=e[9],S=e[10],Q=e[11],U=e[12],N=e[13],T=e[14],O=e[15];return Math.abs(n-m)<=B*Math.max(1,Math.abs(n),Math.abs(m))&&Math.abs(r-y)<=B*Math.max(1,Math.abs(r),Math.abs(y))&&Math.abs(i-w)<=B*Math.max(1,Math.abs(i),Math.abs(w))&&Math.abs(o-b)<=B*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(A-E)<=B*Math.max(1,Math.abs(A),Math.abs(E))&&Math.abs(s-x)<=B*Math.max(1,Math.abs(s),Math.abs(x))&&Math.abs(a-C)<=B*Math.max(1,Math.abs(a),Math.abs(C))&&Math.abs(c-M)<=B*Math.max(1,Math.abs(c),Math.abs(M))&&Math.abs(l-F)<=B*Math.max(1,Math.abs(l),Math.abs(F))&&Math.abs(u-k)<=B*Math.max(1,Math.abs(u),Math.abs(k))&&Math.abs(h-S)<=B*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(d-Q)<=B*Math.max(1,Math.abs(d),Math.abs(Q))&&Math.abs(f-U)<=B*Math.max(1,Math.abs(f),Math.abs(U))&&Math.abs(g-N)<=B*Math.max(1,Math.abs(g),Math.abs(N))&&Math.abs(p-T)<=B*Math.max(1,Math.abs(p),Math.abs(T))&&Math.abs(v-O)<=B*Math.max(1,Math.abs(v),Math.abs(O))},exactEquals:it,frob:function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]+t[3]*t[3]+t[4]*t[4]+t[5]*t[5]+t[6]*t[6]+t[7]*t[7]+t[8]*t[8]+t[9]*t[9]+t[10]*t[10]+t[11]*t[11]+t[12]*t[12]+t[13]*t[13]+t[14]*t[14]+t[15]*t[15])},fromQuat:q,fromQuat2:function(t,e){var n=new E(3),r=-e[0],i=-e[1],o=-e[2],A=e[3],s=e[4],a=e[5],c=e[6],l=e[7],u=r*r+i*i+o*o+A*A;return u>0?(n[0]=2*(s*A+l*r+a*o-c*i)/u,n[1]=2*(a*A+l*i+c*r-s*o)/u,n[2]=2*(c*A+l*o+s*i-a*r)/u):(n[0]=2*(s*A+l*r+a*o-c*i),n[1]=2*(a*A+l*i+c*r-s*o),n[2]=2*(c*A+l*o+s*i-a*r)),z(t,e,n),t},fromRotation:_,fromRotationTranslation:z,fromRotationTranslationScale:function(t,e,n,r){var i=e[0],o=e[1],A=e[2],s=e[3],a=i+i,c=o+o,l=A+A,u=i*a,h=i*c,d=i*l,f=o*c,g=o*l,p=A*l,v=s*a,m=s*c,y=s*l,w=r[0],b=r[1],B=r[2];return t[0]=(1-(f+p))*w,t[1]=(h+y)*w,t[2]=(d-m)*w,t[3]=0,t[4]=(h-y)*b,t[5]=(1-(u+p))*b,t[6]=(g+v)*b,t[7]=0,t[8]=(d+m)*B,t[9]=(g-v)*B,t[10]=(1-(u+f))*B,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},fromRotationTranslationScaleOrigin:X,fromScaling:H,fromTranslation:R,fromValues:k,fromXRotation:G,fromYRotation:K,fromZRotation:j,frustum:function(t,e,n,r,i,o,A){var s=1/(n-e),a=1/(i-r),c=1/(o-A);return t[0]=2*o*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*o*a,t[6]=0,t[7]=0,t[8]=(n+e)*s,t[9]=(i+r)*a,t[10]=(A+o)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=A*o*2*c,t[15]=0,t},getRotation:Y,getScaling:W,getTranslation:V,identity:Q,invert:N,lookAt:nt,mul:ot,multiply:O,multiplyScalar:function(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*n,t[9]=e[9]*n,t[10]=e[10]*n,t[11]=e[11]*n,t[12]=e[12]*n,t[13]=e[13]*n,t[14]=e[14]*n,t[15]=e[15]*n,t},multiplyScalarAndAdd:function(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t[3]=e[3]+n[3]*r,t[4]=e[4]+n[4]*r,t[5]=e[5]+n[5]*r,t[6]=e[6]+n[6]*r,t[7]=e[7]+n[7]*r,t[8]=e[8]+n[8]*r,t[9]=e[9]+n[9]*r,t[10]=e[10]+n[10]*r,t[11]=e[11]+n[11]*r,t[12]=e[12]+n[12]*r,t[13]=e[13]+n[13]*r,t[14]=e[14]+n[14]*r,t[15]=e[15]+n[15]*r,t},ortho:tt,orthoNO:J,orthoZO:et,perspective:Z,perspectiveFromFieldOfView:function(t,e,n,r){var i=Math.tan(e.upDegrees*Math.PI/180),o=Math.tan(e.downDegrees*Math.PI/180),A=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),a=2/(A+s),c=2/(i+o);return t[0]=a,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(A-s)*a*.5,t[9]=(i-o)*c*.5,t[10]=r/(n-r),t[11]=-1,t[12]=0,t[13]=0,t[14]=r*n/(n-r),t[15]=0,t},perspectiveNO:$,perspectiveZO:function(t,e,n,r,i){var o=1/Math.tan(e/2);if(t[0]=o/n,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=o,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0){var A=1/(r-i);t[10]=i*A,t[14]=i*r*A}else t[10]=-1,t[14]=-r;return t},rotate:function(t,e,n,r){var i,o,A,s,a,c,l,u,h,d,f,g,p,v,m,y,w,b,E,x,C,M,F,k,S=r[0],Q=r[1],U=r[2],N=Math.sqrt(S*S+Q*Q+U*U);return N<B?null:(S*=N=1/N,Q*=N,U*=N,i=Math.sin(n),A=1-(o=Math.cos(n)),s=e[0],a=e[1],c=e[2],l=e[3],u=e[4],h=e[5],d=e[6],f=e[7],g=e[8],p=e[9],v=e[10],m=e[11],y=S*S*A+o,w=Q*S*A+U*i,b=U*S*A-Q*i,E=S*Q*A-U*i,x=Q*Q*A+o,C=U*Q*A+S*i,M=S*U*A+Q*i,F=Q*U*A-S*i,k=U*U*A+o,t[0]=s*y+u*w+g*b,t[1]=a*y+h*w+p*b,t[2]=c*y+d*w+v*b,t[3]=l*y+f*w+m*b,t[4]=s*E+u*x+g*C,t[5]=a*E+h*x+p*C,t[6]=c*E+d*x+v*C,t[7]=l*E+f*x+m*C,t[8]=s*M+u*F+g*k,t[9]=a*M+h*F+p*k,t[10]=c*M+d*F+v*k,t[11]=l*M+f*F+m*k,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},rotateX:P,rotateY:D,rotateZ:function(t,e,n){var r=Math.sin(n),i=Math.cos(n),o=e[0],A=e[1],s=e[2],a=e[3],c=e[4],l=e[5],u=e[6],h=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=o*i+c*r,t[1]=A*i+l*r,t[2]=s*i+u*r,t[3]=a*i+h*r,t[4]=c*i-o*r,t[5]=l*i-A*r,t[6]=u*i-s*r,t[7]=h*i-a*r,t},scale:L,set:S,str:function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},sub:At,subtract:rt,targetTo:function(t,e,n,r){var i=e[0],o=e[1],A=e[2],s=r[0],a=r[1],c=r[2],l=i-n[0],u=o-n[1],h=A-n[2],d=l*l+u*u+h*h;d>0&&(l*=d=1/Math.sqrt(d),u*=d,h*=d);var f=a*h-c*u,g=c*l-s*h,p=s*u-a*l;return(d=f*f+g*g+p*p)>0&&(f*=d=1/Math.sqrt(d),g*=d,p*=d),t[0]=f,t[1]=g,t[2]=p,t[3]=0,t[4]=u*p-h*g,t[5]=h*f-l*p,t[6]=l*g-u*f,t[7]=0,t[8]=l,t[9]=u,t[10]=h,t[11]=0,t[12]=i,t[13]=o,t[14]=A,t[15]=1,t},translate:I,transpose:U});function at(){var t=new E(3);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ct(t){var e=new E(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function lt(t){var e=t[0],n=t[1],r=t[2];return Math.sqrt(e*e+n*n+r*r)}function ut(t,e,n){var r=new E(3);return r[0]=t,r[1]=e,r[2]=n,r}function ht(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function dt(t,e,n,r){return t[0]=e,t[1]=n,t[2]=r,t}function ft(t,e,n){return t[0]=e[0]+n[0],t[1]=e[1]+n[1],t[2]=e[2]+n[2],t}function gt(t,e,n){return t[0]=e[0]-n[0],t[1]=e[1]-n[1],t[2]=e[2]-n[2],t}function pt(t,e,n){return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t}function vt(t,e){var n=e[0],r=e[1],i=e[2],o=n*n+r*r+i*i;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t[2]=e[2]*o,t}function mt(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function yt(t,e,n){var r=e[0],i=e[1],o=e[2],A=n[0],s=n[1],a=n[2];return t[0]=i*a-o*s,t[1]=o*A-r*a,t[2]=r*s-i*A,t}function wt(t,e,n,r){var i=e[0],o=e[1],A=e[2];return t[0]=i+r*(n[0]-i),t[1]=o+r*(n[1]-o),t[2]=A+r*(n[2]-A),t}function bt(t,e,n){var r=e[0],i=e[1],o=e[2],A=n[3]*r+n[7]*i+n[11]*o+n[15];return A=A||1,t[0]=(n[0]*r+n[4]*i+n[8]*o+n[12])/A,t[1]=(n[1]*r+n[5]*i+n[9]*o+n[13])/A,t[2]=(n[2]*r+n[6]*i+n[10]*o+n[14])/A,t}function Bt(t,e){var n=t[0],r=t[1],i=t[2],o=e[0],A=e[1],s=e[2];return Math.abs(n-o)<=B*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(r-A)<=B*Math.max(1,Math.abs(r),Math.abs(A))&&Math.abs(i-s)<=B*Math.max(1,Math.abs(i),Math.abs(s))}var Et=gt,xt=function(t,e){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},Ct=lt;function Mt(){var t=new E(4);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Ft(t,e,n,r){var i=new E(4);return i[0]=t,i[1]=e,i[2]=n,i[3]=r,i}function kt(t,e,n){var r=e[0],i=e[1],o=e[2],A=e[3];return t[0]=n[0]*r+n[4]*i+n[8]*o+n[12]*A,t[1]=n[1]*r+n[5]*i+n[9]*o+n[13]*A,t[2]=n[2]*r+n[6]*i+n[10]*o+n[14]*A,t[3]=n[3]*r+n[7]*i+n[11]*o+n[15]*A,t}function St(){var t=new E(4);return E!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Qt(t,e,n){n*=.5;var r=Math.sin(n);return t[0]=r*e[0],t[1]=r*e[1],t[2]=r*e[2],t[3]=Math.cos(n),t}function Ut(t,e,n){var r=e[0],i=e[1],o=e[2],A=e[3],s=n[0],a=n[1],c=n[2],l=n[3];return t[0]=r*l+A*s+i*c-o*a,t[1]=i*l+A*a+o*s-r*c,t[2]=o*l+A*c+r*a-i*s,t[3]=A*l-r*s-i*a-o*c,t}function Nt(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],A=n*n+r*r+i*i+o*o,s=A?1/A:0;return t[0]=-n*s,t[1]=-r*s,t[2]=-i*s,t[3]=o*s,t}function Tt(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"zyx",o=Math.PI/360;e*=o,r*=o,n*=o;var A=Math.sin(e),s=Math.cos(e),a=Math.sin(n),c=Math.cos(n),l=Math.sin(r),u=Math.cos(r);switch(i){case"xyz":t[0]=A*c*u+s*a*l,t[1]=s*a*u-A*c*l,t[2]=s*c*l+A*a*u,t[3]=s*c*u-A*a*l;break;case"xzy":t[0]=A*c*u-s*a*l,t[1]=s*a*u-A*c*l,t[2]=s*c*l+A*a*u,t[3]=s*c*u+A*a*l;break;case"yxz":t[0]=A*c*u+s*a*l,t[1]=s*a*u-A*c*l,t[2]=s*c*l-A*a*u,t[3]=s*c*u+A*a*l;break;case"yzx":t[0]=A*c*u+s*a*l,t[1]=s*a*u+A*c*l,t[2]=s*c*l-A*a*u,t[3]=s*c*u-A*a*l;break;case"zxy":t[0]=A*c*u-s*a*l,t[1]=s*a*u+A*c*l,t[2]=s*c*l+A*a*u,t[3]=s*c*u-A*a*l;break;case"zyx":t[0]=A*c*u-s*a*l,t[1]=s*a*u+A*c*l,t[2]=s*c*l-A*a*u,t[3]=s*c*u+A*a*l;break;default:throw new Error("Unknown angle order "+i)}return t}at(),function(){var t=Mt()}();var Ot=Ft,It=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Lt=function(t,e,n,r,i){return t[0]=e,t[1]=n,t[2]=r,t[3]=i,t},Pt=Ut,Dt=function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],A=n*n+r*r+i*i+o*o;return A>0&&(A=1/Math.sqrt(A)),t[0]=n*A,t[1]=r*A,t[2]=i*A,t[3]=o*A,t};function Rt(){var t=new E(2);return E!=Float32Array&&(t[0]=0,t[1]=0),t}at(),ut(1,0,0),ut(0,1,0),St(),St(),x(),function(){var t=Rt()}();var Ht=function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)},_t=function(t,e){return void 0===e&&(e=[]),function(t,e){if(!Ht(t))return t;for(var n=[],r=0;r<t.length;r++){var i=t[r];e(i,r)&&n.push(i)}return n}(t,function(t){return!function(t,e){return!!Ht(t)&&t.indexOf(e)>-1}(e,t)})};function Gt(t){return"function"==typeof t}function Kt(t){return null==t}function jt(t){return Array.isArray(t)}var zt=function(t){var e=typeof t;return null!==t&&"object"===e||"function"===e};function Vt(t,e){if(t)if(jt(t))for(var n=0,r=t.length;n<r&&!1!==e(t[n],n);n++);else if(zt(t))for(var i in t)if(t.hasOwnProperty(i)&&!1===e(t[i],i))break}var Wt=function(t){return"object"==typeof t&&null!==t},Yt={}.toString,Xt=function(t,e){return Yt.call(t)==="[object "+e+"]"},qt=function(t){if(!Wt(t)||!Xt(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function $t(t){if(!Array.isArray(t))return-1/0;var e=t.length;if(!e)return-1/0;for(var n=t[0],r=1;r<e;r++)n=Math.max(n,t[r]);return n}var Zt=function(t){if(jt(t))return t.reduce(function(t,e){return Math.min(t,e)},t[0])};function Jt(t){return"string"==typeof t}var te=Object.prototype.hasOwnProperty;function ee(t,e){if(!e||!jt(t))return{};for(var n,r={},i=Gt(e)?e:function(t){return t[e]},o=0;o<t.length;o++){var A=t[o];n=i(A),te.call(r,n)?r[n].push(A):r[n]=[A]}return r}var ne=function(t,e,n){return t<e?e:t>n?n:t};function re(t){return"number"==typeof t}function ie(t,e,n){return void 0===n&&(n=1e-5),t===e||Math.abs(t-e)<n}var oe=function(t,e){if(jt(t)){for(var n,r=-1/0,i=0;i<t.length;i++){var o=t[i],A=Gt(e)?e(o):o[e];A>r&&(n=o,r=A)}return n}},Ae=function(t,e){if(jt(t)){for(var n,r=1/0,i=0;i<t.length;i++){var o=t[i],A=Gt(e)?e(o):o[e];A<r&&(n=o,r=A)}return n}},se=function(t,e){return(t%e+e)%e},ae=function(t){return Kt(t)?"":t.toString()};var ce=function(t){var e=ae(t);return e.charAt(0).toUpperCase()+e.substring(1)},le={}.toString,ue=function(t){return Xt(t,"Boolean")};var he=Object.prototype,de=function(t){return void 0===t};function fe(t,e){for(var n in e)e.hasOwnProperty(n)&&"constructor"!==n&&void 0!==e[n]&&(t[n]=e[n])}var ge=function(t){if("object"!=typeof t||null===t)return t;var e;if(jt(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=ge(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=ge(t[i]):e[i]=t[i];return e};function pe(t,e,n){var r;return function(){var n=this,i=arguments;clearTimeout(r),r=setTimeout(function(){r=null,t.apply(n,i)},e)}}var ve=new Map;function me(t,e,n){void 0===n&&(n=128);return function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0];ve.has(t)||ve.set(t,function(t){var e,n,r,i=t||1;function o(t,o){++e>i&&(r=n,A(1),++e),n[t]=o}function A(t){e=0,n=Object.create(null),t||(r=Object.create(null))}return A(),{clear:A,has:function(t){return void 0!==n[t]||void 0!==r[t]},get:function(t){var e=n[t];return void 0!==e?e:void 0!==(e=r[t])?(o(t,e),e):void 0},set:function(t,e){void 0!==n[t]?n[t]=e:o(t,e)}}}(n));var A=ve.get(t);if(A.has(o))return A.get(o);var s=t.apply(this,r);return A.set(o,s),s}}function ye(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function we(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(ye(e,i)){var o=e[i];null!==o&&qt(o)?(qt(t[i])||(t[i]={}),n<r?we(t[i],o,n+1,r):t[i]=e[i]):jt(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}var be=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)we(t,e[r]);return t},Be=Object.prototype.hasOwnProperty;function Ee(t){if(Kt(t))return!0;if(Ht(t))return!t.length;var e=function(t){return le.call(t).replace(/^\[object /,"").replace(/]$/,"")}(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||he)}(t))return!Object.keys(t).length;for(var n in t)if(Be.call(t,n))return!1;return!0}var xe=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(Jt(t)||Jt(e))return!1;if(Ht(t)||Ht(e)){if(t.length!==e.length)return!1;for(var n=!0,r=0;r<t.length&&(n=xe(t[r],e[r]));r++);return n}if(Wt(t)||Wt(e)){var i=Object.keys(t),o=Object.keys(e);if(i.length!==o.length)return!1;for(n=!0,r=0;r<i.length&&(n=xe(t[i[r]],e[i[r]]));r++);return n}return!1},Ce=function(t,e,n){for(var r=0,i=Jt(e)?e.split("."):e;t&&r<i.length;)t=t[i[r++]];return void 0===t||r<i.length?n:t},Me=function(t,e,n){var r=t,i=Jt(e)?e.split("."):e;return i.forEach(function(t,e){e<i.length-1?(zt(r[t])||(r[t]=re(i[e+1])?[]:{}),r=r[t]):r[t]=n}),t},Fe=Object.prototype.hasOwnProperty,ke=function(t,e){if(null===t||!qt(t))return{};var n={};return Vt(e,function(e){Fe.call(t,e)&&(n[e]=t[e])}),n},Se=function(t,e){return function(t,e,n){if(!jt(t)&&!qt(t))return t;var r=n;return Vt(t,function(t,n){r=e(r,t,n)}),r}(t,function(t,n,r){return e.includes(r)||(t[r]=n),t},{})},Qe=function(t,e,n){var r,i,o,A,s=0;n||(n={});var a=function(){s=!1===n.leading?0:Date.now(),r=null,A=t.apply(i,o),r||(i=o=null)},c=function(){var c=Date.now();s||!1!==n.leading||(s=c);var l=e-(c-s);return i=this,o=arguments,l<=0||l>e?(r&&(clearTimeout(r),r=null),s=c,A=t.apply(i,o),r||(i=o=null)):r||!1===n.trailing||(r=setTimeout(a,l)),A};return c.cancel=function(){clearTimeout(r),s=0,r=i=o=null},c},Ue={},Ne=function(){},Te=function(t){return t},Oe=function(t,e){return Oe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Oe(t,e)};function Ie(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Oe(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Le=function(){return Le=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Le.apply(this,arguments)};function Pe(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function De(t,e,n,r){return new(n||(n=Promise))(function(i,o){function A(t){try{a(r.next(t))}catch(t){o(t)}}function s(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(A,s)}a((r=r.apply(t,e||[])).next())})}function Re(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function He(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),A=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)A.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return A}function _e(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function Ge(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)}"function"==typeof SuppressedError&&SuppressedError;var Ke={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function je(t,e,n){if(t[n].length>7){t[n].shift();for(var r=t[n],i=n;r.length;)e[n]="A",t.splice(i+=1,0,["C"].concat(r.splice(0,6)));t.splice(n,1)}}var ze={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function Ve(t){return Array.isArray(t)&&t.every(function(t){var e=t[0].toLowerCase();return ze[e]===t.length-1&&"achlmqstvz".includes(e)})}function We(t){return Ve(t)&&t.every(function(t){var e=t[0];return e===e.toUpperCase()})}function Ye(t){return We(t)&&t.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}function Xe(t){for(var e=t.pathValue[t.segmentStart],n=e.toLowerCase(),r=t.data;r.length>=ze[n]&&("m"===n&&r.length>2?(t.segments.push([e].concat(r.splice(0,2))),n="l",e="m"===e?"l":"L"):t.segments.push([e].concat(r.splice(0,ze[n]))),ze[n]););}function qe(t){var e=t.index,n=t.pathValue,r=n.charCodeAt(e);return 48===r?(t.param=0,void(t.index+=1)):49===r?(t.param=1,void(t.index+=1)):void(t.err='[path-util]: invalid Arc flag "'.concat(n[e],'", expecting 0 or 1 at index ').concat(e))}function $e(t){return t>=48&&t<=57||43===t||45===t||46===t}function Ze(t){return t>=48&&t<=57}function Je(t){var e,n=t.max,r=t.pathValue,i=t.index,o=i,A=!1,s=!1,a=!1,c=!1;if(o>=n)t.err="[path-util]: Invalid path value at index ".concat(o,', "pathValue" is missing param');else if(43!==(e=r.charCodeAt(o))&&45!==e||(o+=1,e=r.charCodeAt(o)),Ze(e)||46===e){if(46!==e){if(A=48===e,o+=1,e=r.charCodeAt(o),A&&o<n&&e&&Ze(e))return void(t.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(r[i],'" illegal number'));for(;o<n&&Ze(r.charCodeAt(o));)o+=1,s=!0;e=r.charCodeAt(o)}if(46===e){for(c=!0,o+=1;Ze(r.charCodeAt(o));)o+=1,a=!0;e=r.charCodeAt(o)}if(101===e||69===e){if(c&&!s&&!a)return void(t.err="[path-util]: Invalid path value at index ".concat(o,', "').concat(r[o],'" invalid float exponent'));if(o+=1,43!==(e=r.charCodeAt(o))&&45!==e||(o+=1),!(o<n&&Ze(r.charCodeAt(o))))return void(t.err="[path-util]: Invalid path value at index ".concat(o,', "').concat(r[o],'" invalid integer exponent'));for(;o<n&&Ze(r.charCodeAt(o));)o+=1}t.index=o,t.param=+t.pathValue.slice(i,o)}else t.err="[path-util]: Invalid path value at index ".concat(o,', "').concat(r[o],'" is not a number')}function tn(t){return 10===t||13===t||8232===t||8233===t||32===t||9===t||11===t||12===t||160===t||t>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(t)}function en(t){for(var e=t.pathValue,n=t.max;t.index<n&&tn(e.charCodeAt(t.index));)t.index+=1}function nn(t){return 97==(32|t)}function rn(t){var e=t.max,n=t.pathValue,r=t.index,i=n.charCodeAt(r),o=ze[n[r].toLowerCase()];if(t.segmentStart=r,function(t){switch(32|t){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}}(i))if(t.index+=1,en(t),t.data=[],o){for(;;){for(var A=o;A>0;A-=1){if(!nn(i)||3!==A&&4!==A?Je(t):qe(t),t.err.length)return;t.data.push(t.param),en(t),t.index<e&&44===n.charCodeAt(t.index)&&(t.index+=1,en(t))}if(t.index>=t.max)break;if(!$e(n.charCodeAt(t.index)))break}Xe(t)}else Xe(t);else t.err='[path-util]: Invalid path value "'.concat(n[r],'" is not a path command')}var on=function(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""};function An(t){if(We(t))return[].concat(t);var e=function(t){if(Ve(t))return[].concat(t);var e=new on(t);for(en(e);e.index<e.max&&!e.err.length;)rn(e);return e.err?e.err:e.segments}(t),n=0,r=0,i=0,o=0;return e.map(function(t){var e,A=t.slice(1).map(Number),s=t[0],a=s.toUpperCase();if("M"===s)return n=A[0],r=A[1],i=n,o=r,["M",n,r];if(s!==a)switch(a){case"A":e=[a,A[0],A[1],A[2],A[3],A[4],A[5]+n,A[6]+r];break;case"V":e=[a,A[0]+r];break;case"H":e=[a,A[0]+n];break;default:var c=A.map(function(t,e){return t+(e%2?r:n)});e=[a].concat(c)}else e=[a].concat(A);var l=e.length;switch(a){case"Z":n=i,r=o;break;case"H":n=e[1];break;case"V":r=e[1];break;default:n=e[l-2],r=e[l-1],"M"===a&&(i=n,o=r)}return e})}function sn(t,e){var n=t[0],r=e.x1,i=e.y1,o=e.x2,A=e.y2,s=t.slice(1).map(Number),a=t;if("TQ".includes(n)||(e.qx=null,e.qy=null),"H"===n)a=["L",t[1],i];else if("V"===n)a=["L",r,t[1]];else if("S"===n){var c=2*r-o,l=2*i-A;e.x1=c,e.y1=l,a=["C",c,l].concat(s)}else if("T"===n){var u=2*r-e.qx,h=2*i-e.qy;e.qx=u,e.qy=h,a=["Q",u,h].concat(s)}else if("Q"===n){var d=s[0],f=s[1];e.qx=d,e.qy=f}return a}function an(t){if(Ye(t))return[].concat(t);for(var e=An(t),n=Le({},Ke),r=0;r<e.length;r+=1){e[r]=sn(e[r],n);var i=e[r],o=i.length;n.x1=+i[o-2],n.y1=+i[o-1],n.x2=+i[o-4]||n.x1,n.y2=+i[o-3]||n.y1}return e}function cn(t,e,n){return{x:t*Math.cos(n)-e*Math.sin(n),y:t*Math.sin(n)+e*Math.cos(n)}}function ln(t,e,n,r,i,o,A,s,a,c){var l,u,h,d,f,g=t,p=e,v=n,m=r,y=s,w=a,b=120*Math.PI/180,B=Math.PI/180*(+i||0),E=[];if(c)u=c[0],h=c[1],d=c[2],f=c[3];else{g=(l=cn(g,p,-B)).x,p=l.y;var x=(g-(y=(l=cn(y,w,-B)).x))/2,C=(p-(w=l.y))/2,M=x*x/(v*v)+C*C/(m*m);M>1&&(v*=M=Math.sqrt(M),m*=M);var F=v*v,k=m*m,S=(o===A?-1:1)*Math.sqrt(Math.abs((F*k-F*C*C-k*x*x)/(F*C*C+k*x*x)));d=S*v*C/m+(g+y)/2,f=S*-m*x/v+(p+w)/2,u=Math.asin(((p-f)/m*Math.pow(10,9)|0)/Math.pow(10,9)),h=Math.asin(((w-f)/m*Math.pow(10,9)|0)/Math.pow(10,9)),u=g<d?Math.PI-u:u,h=y<d?Math.PI-h:h,u<0&&(u=2*Math.PI+u),h<0&&(h=2*Math.PI+h),A&&u>h&&(u-=2*Math.PI),!A&&h>u&&(h-=2*Math.PI)}var Q=h-u;if(Math.abs(Q)>b){var U=h,N=y,T=w;h=u+b*(A&&h>u?1:-1),E=ln(y=d+v*Math.cos(h),w=f+m*Math.sin(h),v,m,i,0,A,N,T,[h,U,d,f])}Q=h-u;var O=Math.cos(u),I=Math.sin(u),L=Math.cos(h),P=Math.sin(h),D=Math.tan(Q/4),R=4/3*v*D,H=4/3*m*D,_=[g,p],G=[g+R*I,p-H*O],K=[y+R*P,w-H*L],j=[y,w];if(G[0]=2*_[0]-G[0],G[1]=2*_[1]-G[1],c)return G.concat(K,j,E);for(var z=[],V=0,W=(E=G.concat(K,j,E)).length;V<W;V+=1)z[V]=V%2?cn(E[V-1],E[V],B).y:cn(E[V],E[V+1],B).x;return z}function un(t,e,n){var r=t[0],i=t[1];return[r+(e[0]-r)*n,i+(e[1]-i)*n]}var hn=function(t,e,n,r){return _e(_e([],un([t,e],[n,r],.5),!0),[n,r,n,r],!1)};function dn(t,e){var n,r,i,o,A,s,a,c,l,u=t[0],h=t.slice(1).map(Number),d=h[0],f=h[1],g=e.x1,p=e.y1,v=e.x,m=e.y;switch("TQ".includes(u)||(e.qx=null,e.qy=null),u){case"M":return e.x=d,e.y=f,t;case"A":return n=[g,p].concat(h),["C"].concat(ln(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9]));case"Q":return e.qx=d,e.qy=f,n=[g,p].concat(h),["C"].concat((r=n[0],i=n[1],o=n[2],A=n[3],s=n[4],a=n[5],[(c=1/3)*r+(l=2/3)*o,c*i+l*A,c*s+l*o,c*a+l*A,s,a]));case"L":return["C"].concat(hn(g,p,d,f));case"Z":return g===v&&p===m?["C",g,p,v,m,v,m]:["C"].concat(hn(g,p,v,m))}return t}function fn(t,e){if(void 0===e&&(e=!1),function(t){return Ye(t)&&t.every(function(t){var e=t[0];return"MC".includes(e)})}(t)){var n=[].concat(t);return e?[n,[]]:n}for(var r,i,o=an(t),A=Le({},Ke),s=[],a="",c=o.length,l=[],u=0;u<c;u+=1){o[u]&&(a=o[u][0]),s[u]=a;var h=dn(o[u],A);o[u]=h,je(o,s,u),c=o.length,"Z"===a&&l.push(u),i=(r=o[u]).length,A.x1=+r[i-2],A.y1=+r[i-1],A.x2=+r[i-4]||A.x1,A.y2=+r[i-3]||A.y1}return e?[o,l]:o}function gn(t,e){return Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1]))}function pn(t,e,n,r,i){var o=gn([t,e],[n,r]),A={x:0,y:0};if("number"==typeof i)if(i<=0)A={x:t,y:e};else if(i>=o)A={x:n,y:r};else{var s=un([t,e],[n,r],i/o);A={x:s[0],y:s[1]}}return{length:o,point:A,min:{x:Math.min(t,n),y:Math.min(e,r)},max:{x:Math.max(t,n),y:Math.max(e,r)}}}function vn(t,e){var n=t.x,r=t.y,i=e.x,o=e.y,A=n*i+r*o,s=Math.sqrt((Math.pow(n,2)+Math.pow(r,2))*(Math.pow(i,2)+Math.pow(o,2)));return(n*o-r*i<0?-1:1)*Math.acos(A/s)}function mn(t,e,n,r,i,o,A,s,a,c){var l=Math.abs,u=Math.sin,h=Math.cos,d=Math.sqrt,f=Math.PI,g=l(n),p=l(r),v=(i%360+360)%360*(f/180);if(t===s&&e===a)return{x:t,y:e};if(0===g||0===p)return pn(t,e,s,a,c).point;var m=(t-s)/2,y=(e-a)/2,w={x:h(v)*m+u(v)*y,y:-u(v)*m+h(v)*y},b=Math.pow(w.x,2)/Math.pow(g,2)+Math.pow(w.y,2)/Math.pow(p,2);b>1&&(g*=d(b),p*=d(b));var B=(Math.pow(g,2)*Math.pow(p,2)-Math.pow(g,2)*Math.pow(w.y,2)-Math.pow(p,2)*Math.pow(w.x,2))/(Math.pow(g,2)*Math.pow(w.y,2)+Math.pow(p,2)*Math.pow(w.x,2)),E=(o!==A?1:-1)*d(B=B<0?0:B),x=E*(g*w.y/p),C=E*(-p*w.x/g),M=h(v)*x-u(v)*C+(t+s)/2,F=u(v)*x+h(v)*C+(e+a)/2,k={x:(w.x-x)/g,y:(w.y-C)/p},S=vn({x:1,y:0},k),Q=vn(k,{x:(-w.x-x)/g,y:(-w.y-C)/p});!A&&Q>0?Q-=2*f:A&&Q<0&&(Q+=2*f);var U=S+(Q%=2*f)*c,N=g*h(U),T=p*u(U);return{x:h(v)*N-u(v)*T+M,y:u(v)*N+h(v)*T+F}}function yn(t,e,n,r,i,o,A,s,a,c,l){var u,h=l.bbox,d=void 0===h||h,f=l.length,g=void 0===f||f,p=l.sampleSize,v=void 0===p?30:p,m="number"==typeof c,y=t,w=e,b=0,B=[y,w,b],E=[y,w],x={x:0,y:0},C=[{x:y,y:w}];m&&c<=0&&(x={x:y,y:w});for(var M=0;M<=v;M+=1){if(y=(u=mn(t,e,n,r,i,o,A,s,a,M/v)).x,w=u.y,d&&C.push({x:y,y:w}),g&&(b+=gn(E,[y,w])),E=[y,w],m&&b>=c&&c>B[2]){var F=(b-c)/(b-B[2]);x={x:E[0]*(1-F)+B[0]*F,y:E[1]*(1-F)+B[1]*F}}B=[y,w,b]}return m&&c>=b&&(x={x:s,y:a}),{length:b,point:x,min:{x:Math.min.apply(null,C.map(function(t){return t.x})),y:Math.min.apply(null,C.map(function(t){return t.y}))},max:{x:Math.max.apply(null,C.map(function(t){return t.x})),y:Math.max.apply(null,C.map(function(t){return t.y}))}}}function wn(t,e,n,r,i,o,A,s,a){var c=1-a;return{x:Math.pow(c,3)*t+3*Math.pow(c,2)*a*n+3*c*Math.pow(a,2)*i+Math.pow(a,3)*A,y:Math.pow(c,3)*e+3*Math.pow(c,2)*a*r+3*c*Math.pow(a,2)*o+Math.pow(a,3)*s}}function bn(t,e,n,r,i,o,A,s,a,c){var l,u=c.bbox,h=void 0===u||u,d=c.length,f=void 0===d||d,g=c.sampleSize,p=void 0===g?10:g,v="number"==typeof a,m=t,y=e,w=0,b=[m,y,w],B=[m,y],E={x:0,y:0},x=[{x:m,y:y}];v&&a<=0&&(E={x:m,y:y});for(var C=0;C<=p;C+=1){if(m=(l=wn(t,e,n,r,i,o,A,s,C/p)).x,y=l.y,h&&x.push({x:m,y:y}),f&&(w+=gn(B,[m,y])),B=[m,y],v&&w>=a&&a>b[2]){var M=(w-a)/(w-b[2]);E={x:B[0]*(1-M)+b[0]*M,y:B[1]*(1-M)+b[1]*M}}b=[m,y,w]}return v&&a>=w&&(E={x:A,y:s}),{length:w,point:E,min:{x:Math.min.apply(null,x.map(function(t){return t.x})),y:Math.min.apply(null,x.map(function(t){return t.y}))},max:{x:Math.max.apply(null,x.map(function(t){return t.x})),y:Math.max.apply(null,x.map(function(t){return t.y}))}}}function Bn(t,e,n,r,i,o,A){var s=1-A;return{x:Math.pow(s,2)*t+2*s*A*n+Math.pow(A,2)*i,y:Math.pow(s,2)*e+2*s*A*r+Math.pow(A,2)*o}}function En(t,e,n,r,i,o,A,s){var a,c=s.bbox,l=void 0===c||c,u=s.length,h=void 0===u||u,d=s.sampleSize,f=void 0===d?10:d,g="number"==typeof A,p=t,v=e,m=0,y=[p,v,m],w=[p,v],b={x:0,y:0},B=[{x:p,y:v}];g&&A<=0&&(b={x:p,y:v});for(var E=0;E<=f;E+=1){if(p=(a=Bn(t,e,n,r,i,o,E/f)).x,v=a.y,l&&B.push({x:p,y:v}),h&&(m+=gn(w,[p,v])),w=[p,v],g&&m>=A&&A>y[2]){var x=(m-A)/(m-y[2]);b={x:w[0]*(1-x)+y[0]*x,y:w[1]*(1-x)+y[1]*x}}y=[p,v,m]}return g&&A>=m&&(b={x:i,y:o}),{length:m,point:b,min:{x:Math.min.apply(null,B.map(function(t){return t.x})),y:Math.min.apply(null,B.map(function(t){return t.y}))},max:{x:Math.max.apply(null,B.map(function(t){return t.x})),y:Math.max.apply(null,B.map(function(t){return t.y}))}}}function xn(t,e,n){for(var r,i,o,A,s,a,c,l,u,h=an(t),d="number"==typeof e,f=[],g=0,p=0,v=0,m=0,y=[],w=[],b=0,B={x:0,y:0},E=B,x=B,C=B,M=0,F=0,k=h.length;F<k;F+=1)f=(c="M"===(l=(u=h[F])[0]))?f:[g,p].concat(u.slice(1)),c?(E=B={x:v=u[1],y:m=u[2]},b=0,d&&e<.001&&(C=B)):"L"===l?(b=(r=pn(f[0],f[1],f[2],f[3],(e||0)-M)).length,B=r.min,E=r.max,x=r.point):"A"===l?(b=(i=yn(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],(e||0)-M,n||{})).length,B=i.min,E=i.max,x=i.point):"C"===l?(b=(o=bn(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],(e||0)-M,n||{})).length,B=o.min,E=o.max,x=o.point):"Q"===l?(b=(A=En(f[0],f[1],f[2],f[3],f[4],f[5],(e||0)-M,n||{})).length,B=A.min,E=A.max,x=A.point):"Z"===l&&(b=(s=pn((f=[g,p,v,m])[0],f[1],f[2],f[3],(e||0)-M)).length,B=s.min,E=s.max,x=s.point),d&&M<e&&M+b>=e&&(C=x),w.push(E),y.push(B),M+=b,g=(a="Z"!==l?u.slice(-2):[v,m])[0],p=a[1];return d&&e>=M&&(C={x:g,y:p}),{length:M,point:C,min:{x:Math.min.apply(null,y.map(function(t){return t.x})),y:Math.min.apply(null,y.map(function(t){return t.y}))},max:{x:Math.max.apply(null,w.map(function(t){return t.x})),y:Math.max.apply(null,w.map(function(t){return t.y}))}}}function Cn(t,e){var n=t.length-1,r=[],i=0,o=function(t){var e=t.length,n=e-1;return t.map(function(r,i){return t.map(function(r,o){var A,s=i+o;return 0===o||t[s]&&"M"===t[s][0]?(A=t[s],["M"].concat(A.slice(-2))):(s>=e&&(s-=n),t[s])})})}(t);return o.forEach(function(o,A){t.slice(1).forEach(function(r,o){i+=gn(t[(A+o)%n].slice(-2),e[o%n].slice(-2))}),r[A]=i,i=0}),o[r.indexOf(Math.min.apply(null,r))]}function Mn(t){return function(t){var e=0,n=0,r=0;return fn(t).map(function(t){var i;if("M"===t[0])return e=t[1],n=t[2],0;var o=t.slice(1),A=o[0],s=o[1],a=o[2],c=o[3],l=o[4],u=o[5];return r=function(t,e,n,r,i,o,A,s){return 3*((s-e)*(n+i)-(A-t)*(r+o)+r*(t-i)-n*(e-o)+s*(i+t/3)-A*(o+e/3))/20}(e,n,A,s,a,c,l,u),i=t.slice(-2),e=i[0],n=i[1],r}).reduce(function(t,e){return t+e},0)}(t)>=0}function Fn(t){return t.map(function(t,e,n){var r,i=e&&n[e-1].slice(-2).concat(t.slice(1)),o=e?bn(i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],i[8],{bbox:!1}).length:0;return r=e?o?function(t,e){void 0===e&&(e=.5);var n=t.slice(0,2),r=t.slice(2,4),i=t.slice(4,6),o=t.slice(6,8),A=un(n,r,e),s=un(r,i,e),a=un(i,o,e),c=un(A,s,e),l=un(s,a,e),u=un(c,l,e);return[["C"].concat(A,c,u),["C"].concat(l,a,o)]}(i):[t,t]:[t],{s:t,ss:r,l:o}})}function kn(t,e,n,r){if(void 0===r&&(r=0),r>50)return console.warn("Maximum recursion depth reached in equalizeSegments"),[t,e];var i=Fn(t),o=Fn(e),A=i.length,s=o.length,a=i.filter(function(t){return t.l}).length,c=o.filter(function(t){return t.l}).length,l=i.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/a||0,u=o.filter(function(t){return t.l}).reduce(function(t,e){return t+e.l},0)/c||0,h=n||Math.max(A,s),d=[l,u],f=[h-A,h-s],g=0,p=[i,o].map(function(t,e){return t.l===h?t.map(function(t){return t.s}):t.map(function(t,n){return g=n&&f[e]&&t.l>=d[e],f[e]-=g?1:0,g?t.ss:[t.s]}).flat()});return p[0].length===p[1].length?p:kn(p[0],p[1],h,r+1)}function Sn(t){var e=document.createElement("div");e.innerHTML=t;var n=e.childNodes[0];return n&&e.contains(n)&&e.removeChild(n),n}function Qn(){return Qn="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(arguments.length<3?t:n):i.value}},Qn.apply(null,arguments)}function Un(t,e,n,r){var i=Qn(h(t.prototype),e,n);return"function"==typeof i?function(t){return i.apply(n,t)}:i}
2
+ /*!
3
+ * @antv/g-math
4
+ * @description Geometry util
5
+ * @version 3.1.0
6
+ * @date 12/22/2025, 3:02:36 AM
7
+ * @author AntVis
8
+ * @docs https://g.antv.antgroup.com/
9
+ */function Nn(t,e,n,r){var i=t-n,o=e-r;return Math.sqrt(i*i+o*o)}function Tn(t,e){var n=Math.min.apply(Math,u(t)),r=Math.min.apply(Math,u(e));return{x:n,y:r,width:Math.max.apply(Math,u(t))-n,height:Math.max.apply(Math,u(e))-r}}function On(t,e,n,r,i,o){return n*Math.cos(i)*Math.cos(o)-r*Math.sin(i)*Math.sin(o)+t}function In(t,e,n,r,i,o){return n*Math.sin(i)*Math.cos(o)+r*Math.cos(i)*Math.sin(o)+e}function Ln(t,e,n,r,i,o,A){for(var s=function(t,e,n){return Math.atan(-e/t*Math.tan(n))}(n,r,i),a=1/0,c=-1/0,l=[o,A],u=2*-Math.PI;u<=2*Math.PI;u+=Math.PI){var h=s+u;o<A?o<h&&h<A&&l.push(h):A<h&&h<o&&l.push(h)}for(var d=0;d<l.length;d++){var f=On(t,0,n,r,i,l[d]);f<a&&(a=f),f>c&&(c=f)}for(var g=function(t,e,n){return Math.atan(e/(t*Math.tan(n)))}(n,r,i),p=1/0,v=-1/0,m=[o,A],y=2*-Math.PI;y<=2*Math.PI;y+=Math.PI){var w=g+y;o<A?o<w&&w<A&&m.push(w):A<w&&w<o&&m.push(w)}for(var b=0;b<m.length;b++){var B=In(0,e,n,r,i,m[b]);B<p&&(p=B),B>v&&(v=B)}return{x:a,y:p,width:c-a,height:v-p}}function Pn(t,e,n,r,i,o){var A=-1,s=1/0,a=[n,r],c=20;o&&o>200&&(c=o/10);for(var l=1/c,h=l/10,d=0;d<=c;d++){var f=d*l,g=[i.apply(void 0,u(t.concat([f]))),i.apply(void 0,u(e.concat([f])))],p=Nn(a[0],a[1],g[0],g[1]);p<s&&(A=f,s=p)}if(0===A)return{x:t[0],y:e[0]};if(1===A){var v=t.length;return{x:t[v-1],y:e[v-1]}}s=1/0;for(var m=0;m<32&&!(h<1e-4);m++){var y=A-h,w=A+h,b=[i.apply(void 0,u(t.concat([y]))),i.apply(void 0,u(e.concat([y])))],B=Nn(a[0],a[1],b[0],b[1]);if(y>=0&&B<s)A=y,s=B;else{var E=[i.apply(void 0,u(t.concat([w]))),i.apply(void 0,u(e.concat([w])))],x=Nn(a[0],a[1],E[0],E[1]);w<=1&&x<s?(A=w,s=x):h*=.5}}return{x:i.apply(void 0,u(t.concat([A]))),y:i.apply(void 0,u(e.concat([A])))}}function Dn(t,e,n,r){return Nn(t,e,n,r)}function Rn(t,e,n,r,i){return{x:(1-i)*t+i*n,y:(1-i)*e+i*r}}function Hn(t,e,n,r,i,o){var A=[n-t,r-e];if(function(t,e){return t[0]===e[0]&&t[1]===e[1]}(A,[0,0]))return Math.sqrt((i-t)*(i-t)+(o-e)*(o-e));var s=[-A[1],A[0]];!function(t,e){var n=e[0],r=e[1],i=n*n+r*r;i>0&&(i=1/Math.sqrt(i)),t[0]=e[0]*i,t[1]=e[1]*i}(s,s);var a=[i-t,o-e];return Math.abs(function(t,e){return t[0]*e[0]+t[1]*e[1]}(a,s))}function _n(t,e,n,r,i){var o=1-i;return o*o*o*t+3*e*i*o*o+3*n*i*i*o+r*i*i*i}function Gn(t,e,n,r){var i,o,A,s=-3*t+9*e-9*n+3*r,a=6*t-12*e+6*n,c=3*e-3*t,l=[];if(ie(s,0))ie(a,0)||(i=-c/a)>=0&&i<=1&&l.push(i);else{var u=a*a-4*s*c;ie(u,0)?l.push(-a/(2*s)):u>0&&(o=(-a-(A=Math.sqrt(u)))/(2*s),(i=(-a+A)/(2*s))>=0&&i<=1&&l.push(i),o>=0&&o<=1&&l.push(o))}return l}function Kn(t,e,n,r,i,o,A,s){for(var a=[t,A],c=[e,s],l=Gn(t,n,i,A),u=Gn(e,r,o,s),h=0;h<l.length;h++)a.push(_n(t,n,i,A,l[h]));for(var d=0;d<u.length;d++)c.push(_n(e,r,o,s,u[d]));return Tn(a,c)}function jn(t,e,n,r,i,o,A,s,a,c,l){var u=function(t,e,n,r,i,o,A,s,a,c,l){return Pn([t,n,i,A],[e,r,o,s],a,c,_n,l)}(t,e,n,r,i,o,A,s,a,c,l);return Nn(u.x,u.y,a,c)}function zn(t){return function(t){if(t.length<2)return 0;for(var e=0,n=0;n<t.length-1;n++){var r=t[n],i=t[n+1];e+=Nn(r[0],r[1],i[0],i[1])}return e}(t)}function Vn(t,e,n,r){var i=1-r;return i*i*t+2*r*i*e+r*r*n}function Wn(t,e,n){var r=t+n-2*e;if(ie(r,0))return[.5];var i=(t-e)/r;return i<=1&&i>=0?[i]:[]}function Yn(t,e,n,r,i,o){var A=Wn(t,n,i)[0],s=Wn(e,r,o)[0],a=[t,i],c=[e,o];return void 0!==A&&a.push(Vn(t,n,i,A)),void 0!==s&&c.push(Vn(e,r,o,s)),Tn(a,c)}function Xn(t,e,n,r,i,o,A,s){var a=function(t,e,n,r,i,o,A,s){return Pn([t,n,i],[e,r,o],A,s,Vn)}(t,e,n,r,i,o,A,s);return Nn(a.x,a.y,A,s)}function qn(t,e){this.v=t,this.k=e}function $n(t,e,n,r){var i=Object.defineProperty;try{i({},"",{})}catch(t){i=0}$n=function(t,e,n,r){function o(e,n){$n(t,e,function(t){return this._invoke(e,n,t)})}e?i?i(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(o("next",0),o("throw",1),o("return",2))},$n(t,e,n,r)}function Zn(){
10
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
11
+ var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",i=n.toStringTag||"@@toStringTag";function o(n,r,i,o){var a=r&&r.prototype instanceof s?r:s,c=Object.create(a.prototype);return $n(c,"_invoke",function(n,r,i){var o,s,a,c=0,l=i||[],u=!1,h={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,n){return o=e,s=0,a=t,h.n=n,A}};function d(n,r){for(s=n,a=r,e=0;!u&&c&&!i&&e<l.length;e++){var i,o=l[e],d=h.p,f=o[2];n>3?(i=f===r)&&(a=o[(s=o[4])?5:(s=3,3)],o[4]=o[5]=t):o[0]<=d&&((i=n<2&&d<o[1])?(s=0,h.v=r,h.n=o[1]):d<f&&(i=n<3||o[0]>r||r>f)&&(o[4]=n,o[5]=r,h.n=f,s=0))}if(i||n>1)return A;throw u=!0,r}return function(i,l,f){if(c>1)throw TypeError("Generator is already running");for(u&&1===l&&d(l,f),s=l,a=f;(e=s<2?t:a)||!u;){o||(s?s<3?(s>1&&(h.n=-1),d(s,a)):h.n=a:h.v=a);try{if(c=2,o){if(s||(i="next"),e=o[i]){if(!(e=e.call(o,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,s<2&&(s=0)}else 1===s&&(e=o.return)&&e.call(o),s<2&&(a=TypeError("The iterator does not provide a '"+i+"' method"),s=1);o=t}else if((e=(u=h.n<0)?a:n.call(r,h))!==A)break}catch(e){o=t,s=1,a=e}finally{c=1}}return{value:e,done:u}}}(n,i,o),!0),c}var A={};function s(){}function a(){}function c(){}e=Object.getPrototypeOf;var l=[][r]?e(e([][r]())):($n(e={},r,function(){return this}),e),u=c.prototype=s.prototype=Object.create(l);function h(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,$n(t,i,"GeneratorFunction")),t.prototype=Object.create(u),t}return a.prototype=c,$n(u,"constructor",c),$n(c,"constructor",a),a.displayName="GeneratorFunction",$n(c,i,"GeneratorFunction"),$n(u),$n(u,i,"Generator"),$n(u,r,function(){return this}),$n(u,"toString",function(){return"[object Generator]"}),(Zn=function(){return{w:o,m:h}})()}function Jn(t,e){function n(r,i,o,A){try{var s=t[r](i),a=s.value;return a instanceof qn?e.resolve(a.v).then(function(t){n("next",t,o,A)},function(t){n("throw",t,o,A)}):e.resolve(a).then(function(t){s.value=t,o(s)},function(t){return n("throw",t,o,A)})}catch(t){A(t)}}var r;this.next||($n(Jn.prototype),$n(Jn.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),$n(this,"_invoke",function(t,i,o){function A(){return new e(function(e,r){n(t,o,e,r)})}return r=r?r.then(A,A):A()},!0)}function tr(t,e,n,r,i){return new Jn(Zn().w(t,e,n,r),i||Promise)}function er(t,e,n,r,i){var o=tr(t,e,n,r,i);return o.next().then(function(t){return t.done?t.value:o.next()})}function nr(t){var e=Object(t),n=[];for(var r in e)n.unshift(r);return function t(){for(;n.length;)if((r=n.pop())in e)return t.value=r,t.done=!1,t;return t.done=!0,t}}function rr(t){if(null!=t){var n=t["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],r=0;if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}}}throw new TypeError(e(t)+" is not iterable")}function ir(){var t=Zn(),e=t.m(ir),n=(Object.getPrototypeOf?Object.getPrototypeOf(e):e.__proto__).constructor;function r(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===n||"GeneratorFunction"===(e.displayName||e.name))}var i={throw:1,return:2,break:3,continue:3};function o(t){var e,n;return function(r){e||(e={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(t,e){return n(r.a,i[t],e)},delegateYield:function(t,i,o){return e.resultName=i,n(r.d,rr(t),o)},finish:function(t){return n(r.f,t)}},n=function(t,n,i){r.p=e.prev,r.n=e.next;try{return t(n,i)}finally{e.next=r.n}}),e.resultName&&(e[e.resultName]=r.v,e.resultName=void 0),e.sent=r.v,e.next=r.n;try{return t.call(this,e)}finally{r.p=e.prev,r.n=e.next}}}return(ir=function(){return{wrap:function(e,n,r,i){return t.w(o(e),n,r,i&&i.reverse())},isGeneratorFunction:r,mark:t.m,awrap:function(t,e){return new qn(t,e)},AsyncIterator:Jn,async:function(t,e,n,i,A){return(r(e)?tr:er)(o(t),e,n,i,A)},keys:nr,values:rr}})()}function or(t,e,n,r,i,o,A){try{var s=t[o](A),a=s.value}catch(t){return void n(t)}s.done?e(a):Promise.resolve(a).then(r,i)}function Ar(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var o=t.apply(e,n);function A(t){or(o,r,i,A,s,"next",t)}function s(t){or(o,r,i,A,s,"throw",t)}A(void 0)})}}function sr(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=l(t))||e){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,A=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return A=t.done,t},e:function(t){s=!0,o=t},f:function(){try{A||null==n.return||n.return()}finally{if(s)throw o}}}}function ar(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;n[r]=t[r]}return n}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],-1===e.indexOf(n)&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}
12
+ /*!
13
+ * @antv/g-lite
14
+ * @description A core module for rendering engine implements DOM API.
15
+ * @version 2.7.0
16
+ * @date 12/24/2025, 11:55:20 AM
17
+ * @author AntVis
18
+ * @docs https://g.antv.antgroup.com/
19
+ */var cr=function(t){return t.GROUP="g",t.FRAGMENT="fragment",t.CIRCLE="circle",t.ELLIPSE="ellipse",t.IMAGE="image",t.RECT="rect",t.LINE="line",t.POLYLINE="polyline",t.POLYGON="polygon",t.TEXT="text",t.PATH="path",t.HTML="html",t.MESH="mesh",t}({}),lr=function(t){return t[t.ZERO=0]="ZERO",t[t.NEGATIVE_ONE=1]="NEGATIVE_ONE",t}({}),ur=function(){return a(function t(){A(this,t),this.plugins=[]},[{key:"addRenderingPlugin",value:function(t){this.plugins.push(t),this.context.renderingPlugins.push(t)}},{key:"removeAllRenderingPlugins",value:function(){var t=this;this.plugins.forEach(function(e){var n=t.context.renderingPlugins.indexOf(e);n>=0&&t.context.renderingPlugins.splice(n,1)})}}])}(),hr=function(){return a(function t(e){A(this,t),this.clipSpaceNearZ=lr.NEGATIVE_ONE,this.plugins=[],this.config=o({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},e)},[{key:"registerPlugin",value:function(t){var e=this.plugins.findIndex(function(e){return e===t});-1===e&&this.plugins.push(t)}},{key:"unregisterPlugin",value:function(t){var e=this.plugins.findIndex(function(e){return e===t});e>-1&&this.plugins.splice(e,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(t){return this.plugins.find(function(e){return e.name===t})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(t){Object.assign(this.config,t)}}])}(),dr=ft,fr=ht,gr=function(t,e,n){return t[0]=Math.max(e[0],n[0]),t[1]=Math.max(e[1],n[1]),t[2]=Math.max(e[2],n[2]),t},pr=function(t,e,n){return t[0]=Math.min(e[0],n[0]),t[1]=Math.min(e[1],n[1]),t[2]=Math.min(e[2],n[2]),t},vr=pt,mr=Et,yr=function(){function t(){A(this,t),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return a(t,[{key:"update",value:function(t,e){fr(this.center,t),fr(this.halfExtents,e),mr(this.min,this.center,this.halfExtents),dr(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(t,e){dr(this.center,e,t),vr(this.center,this.center,.5),mr(this.halfExtents,e,t),vr(this.halfExtents,this.halfExtents,.5),fr(this.min,t),fr(this.max,e)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!t.isEmpty(e))if(t.isEmpty(this))this.setMinMax(e.getMin(),e.getMax());else{var n=this.center,r=n[0],i=n[1],o=n[2],A=this.halfExtents,s=A[0],a=A[1],c=A[2],l=r-s,u=r+s,h=i-a,d=i+a,f=o-c,g=o+c,p=e.center,v=p[0],m=p[1],y=p[2],w=e.halfExtents,b=w[0],B=w[1],E=w[2],x=v-b,C=v+b,M=m-B,F=m+B,k=y-E,S=y+E;x<l&&(l=x),C>u&&(u=C),M<h&&(h=M),F>d&&(d=F),k<f&&(f=k),S>g&&(g=S),n[0]=.5*(l+u),n[1]=.5*(h+d),n[2]=.5*(f+g),A[0]=.5*(u-l),A[1]=.5*(d-h),A[2]=.5*(g-f),this.min[0]=l,this.min[1]=h,this.min[2]=f,this.max[0]=u,this.max[1]=d,this.max[2]=g}}},{key:"setFromTransformedAABB",value:function(t,e){var n=this.center,r=this.halfExtents,i=t.center,o=t.halfExtents,A=e[0],s=e[4],a=e[8],c=e[1],l=e[5],u=e[9],h=e[2],d=e[6],f=e[10],g=Math.abs(A),p=Math.abs(s),v=Math.abs(a),m=Math.abs(c),y=Math.abs(l),w=Math.abs(u),b=Math.abs(h),B=Math.abs(d),E=Math.abs(f);n[0]=e[12]+A*i[0]+s*i[1]+a*i[2],n[1]=e[13]+c*i[0]+l*i[1]+u*i[2],n[2]=e[14]+h*i[0]+d*i[1]+f*i[2],r[0]=g*o[0]+p*o[1]+v*o[2],r[1]=m*o[0]+y*o[1]+w*o[2],r[2]=b*o[0]+B*o[1]+E*o[2],mr(this.min,n,r),dr(this.max,n,r)}},{key:"intersects",value:function(t){var e=this.getMax(),n=this.getMin(),r=t.getMax(),i=t.getMin();return n[0]<=r[0]&&e[0]>=i[0]&&n[1]<=r[1]&&e[1]>=i[1]&&n[2]<=r[2]&&e[2]>=i[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new t,r=gr([0,0,0],this.getMin(),e.getMin()),i=pr([0,0,0],this.getMax(),e.getMax());return n.setMinMax(r,i),n}},{key:"getNegativeFarPoint",value:function(t){return 273===t.pnVertexFlag?fr([0,0,0],this.min):272===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:257===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:256===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:17===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:16===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:1===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(t){return 273===t.pnVertexFlag?fr([0,0,0],this.max):272===t.pnVertexFlag?[this.max[0],this.max[1],this.min[2]]:257===t.pnVertexFlag?[this.max[0],this.min[1],this.max[2]]:256===t.pnVertexFlag?[this.max[0],this.min[1],this.min[2]]:17===t.pnVertexFlag?[this.min[0],this.max[1],this.max[2]]:16===t.pnVertexFlag?[this.min[0],this.max[1],this.min[2]]:1===t.pnVertexFlag?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(t){return!t||0===t.halfExtents[0]&&0===t.halfExtents[1]&&0===t.halfExtents[2]}}])}(),wr=function(){return a(function t(e,n){A(this,t),this.distance=e||0,this.normal=n||ut(0,1,0),this.updatePNVertexFlag()},[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(Number(this.normal[0]>=0)<<8)+(Number(this.normal[1]>=0)<<4)+Number(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(t){return mt(t,this.normal)-this.distance}},{key:"normalize",value:function(){var t=1/Ct(this.normal);pt(this.normal,this.normal,t),this.distance*=t}},{key:"intersectsLine",value:function(t,e,n){var r=this.distanceToPoint(t),i=r/(r-this.distanceToPoint(e)),o=i>=0&&i<=1;return o&&n&&wt(n,t,e,i),o}}])}(),br=function(t){return t[t.OUTSIDE=4294967295]="OUTSIDE",t[t.INSIDE=0]="INSIDE",t[t.INDETERMINATE=2147483647]="INDETERMINATE",t}({}),Br=function(){return a(function t(e){if(A(this,t),this.planes=[],e)this.planes=e;else for(var n=0;n<6;n++)this.planes.push(new wr)},[{key:"extractFromVPMatrix",value:function(t){var e=m(t,16),n=e[0],r=e[1],i=e[2],o=e[3],A=e[4],s=e[5],a=e[6],c=e[7],l=e[8],u=e[9],h=e[10],d=e[11],f=e[12],g=e[13],p=e[14],v=e[15];dt(this.planes[0].normal,o-n,c-A,d-l),this.planes[0].distance=v-f,dt(this.planes[1].normal,o+n,c+A,d+l),this.planes[1].distance=v+f,dt(this.planes[2].normal,o+r,c+s,d+u),this.planes[2].distance=v+g,dt(this.planes[3].normal,o-r,c-s,d-u),this.planes[3].distance=v-g,dt(this.planes[4].normal,o-i,c-a,d-h),this.planes[4].distance=v-p,dt(this.planes[5].normal,o+i,c+a,d+h),this.planes[5].distance=v+p,this.planes.forEach(function(t){t.normalize(),t.updatePNVertexFlag()})}}])}(),Er=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A(this,t),this.x=0,this.y=0,this.x=e,this.y=n}return a(t,[{key:"clone",value:function(){return new t(this.x,this.y)}},{key:"copyFrom",value:function(t){this.x=t.x,this.y=t.y}}])}(),xr=function(){function t(e,n,r,i){A(this,t),this.x=e,this.y=n,this.width=r,this.height=i,this.left=e,this.right=e+r,this.top=n,this.bottom=n+i}return a(t,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new t(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var r=Ft(e.x,e.y,0,1),i=Ft(e.x+e.width,e.y,0,1),o=Ft(e.x,e.y+e.height,0,1),A=Ft(e.x+e.width,e.y+e.height,0,1),s=Mt(),a=Mt(),c=Mt(),l=Mt();kt(s,r,n),kt(a,i,n),kt(c,o,n),kt(l,A,n);var u=Math.min(s[0],a[0],c[0],l[0]),h=Math.min(s[1],a[1],c[1],l[1]),d=Math.max(s[0],a[0],c[0],l[0]),f=Math.max(s[1],a[1],c[1],l[1]);return t.fromRect({x:u,y:h,width:d-u,height:f-h})}}])}(),Cr="Method not implemented.",Mr="Use document.documentElement instead.";function Fr(t){return void 0===t?0:t>360||t<-360?t%360:t}var kr=at();function Sr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return Array.isArray(t)&&3===t.length?r?ct(t):ht(kr,t):re(t)?r?ut(t,e,n):dt(kr,t,e,n):r?ut(t[0],t[1]||e,t[2]||n):dt(kr,t[0],t[1]||e,t[2]||n)}var Qr=Math.PI/180;function Ur(t){return t*Qr}var Nr=180/Math.PI;function Tr(t){return t*Nr}var Or=Math.PI/2;function Ir(t,e){return 16===e.length?function(t,e){var n,r,i=m(W(at(),e),3),o=i[0],A=i[1],s=i[2],a=Math.asin(-e[2]/o);return a<Or?a>-Or?(n=Math.atan2(e[6]/A,e[10]/s),r=Math.atan2(e[1]/o,e[0]/o)):(r=0,n=-Math.atan2(e[4]/A,e[5]/A)):(r=0,n=Math.atan2(e[4]/A,e[5]/A)),t[0]=n,t[1]=a,t[2]=r,t}(t,e):function(t,e){var n=e[0],r=e[1],i=e[2],o=e[3],A=r*r,s=i*i,a=o*o,c=n*n+A+s+a,l=n*o-r*i;return l>.499995*c?(t[0]=Or,t[1]=2*Math.atan2(r,n),t[2]=0):l<-.499995*c?(t[0]=-Or,t[1]=2*Math.atan2(r,n),t[2]=0):(t[0]=Math.asin(2*(n*i-o*r)),t[1]=Math.atan2(2*(n*o+r*i),1-2*(s+a)),t[2]=Math.atan2(2*(n*r+i*o),1-2*(A+s))),t}(t,e)}function Lr(t,e,n,r,i){var o,A,s,a,c,l,u,h,d,f,g=Math.cos(t),p=Math.sin(t);return o=r*g,A=i*p,s=0,a=-r*p,c=i*g,l=0,u=e,h=n,d=1,(f=new E(9))[0]=o,f[1]=A,f[2]=s,f[3]=a,f[4]=c,f[5]=l,f[6]=u,f[7]=h,f[8]=d,f}function Pr(t){var e=t[0],n=t[1],r=t[3],i=t[4],o=Math.sqrt(e*e+n*n),A=Math.sqrt(r*r+i*i);if(e*i-n*r<0&&(e<i?o=-o:A=-A),o){var s=1/o;e*=s,n*=s}if(A){var a=1/A;r*=a,i*=a}var c=Tr(Math.atan2(n,e));return[t[6],t[7],o,A,c]}var Dr=C(),Rr=C(),Hr=Mt(),_r=[at(),at(),at()],Gr=at();function Kr(t,e,n,r,i){t[0]=e[0]*r+n[0]*i,t[1]=e[1]*r+n[1]*i,t[2]=e[2]*r+n[2]*i}var jr=function(t){return t[t.ORBITING=0]="ORBITING",t[t.EXPLORING=1]="EXPLORING",t[t.TRACKING=2]="TRACKING",t}({}),zr=function(t){return t[t.DEFAULT=0]="DEFAULT",t[t.ROTATIONAL=1]="ROTATIONAL",t[t.TRANSLATIONAL=2]="TRANSLATIONAL",t[t.CINEMATIC=3]="CINEMATIC",t}({}),Vr=function(t){return t[t.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",t[t.PERSPECTIVE=1]="PERSPECTIVE",t}({}),Wr="updated",Yr=2e-4,Xr=function(){return a(function t(){A(this,t),this.clipSpaceNearZ=lr.NEGATIVE_ONE,this.eventEmitter=new b,this.matrix=C(),this.right=ut(1,0,0),this.up=ut(0,1,0),this.forward=ut(0,0,1),this.position=ut(0,0,1),this.focalPoint=ut(0,0,0),this.distanceVector=ut(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=C(),this.projectionMatrixInverse=C(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=jr.EXPLORING,this.trackingMode=zr.DEFAULT,this.projectionMode=Vr.PERSPECTIVE,this.frustum=new Br,this.orthoMatrix=C()},[{key:"isOrtho",value:function(){return this.projectionMode===Vr.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(t){this.enableUpdate=t}},{key:"setType",value:function(t,e){return this.type=t,this.type===jr.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===jr.TRACKING&&void 0!==e&&this.setTrackingMode(e),this}},{key:"setProjectionMode",value:function(t){return this.projectionMode=t,this}},{key:"setTrackingMode",value:function(t){if(this.type!==jr.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=t,this}},{key:"setWorldRotation",value:function(t){return this.rotateWorld=t,this._getAngles(),this}},{key:"getViewTransform",value:function(){return N(C(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(t,e){var n=R(C(),[t,e,0]);this.jitteredProjectionMatrix=O(C(),n,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(t){return this.matrix=t,this._update(),this}},{key:"setProjectionMatrix",value:function(t){this.projectionMatrix=t}},{key:"setFov",value:function(t){return this.setPerspective(this.near,this.far,t,this.aspect),this}},{key:"setAspect",value:function(t){return this.setPerspective(this.near,this.far,this.fov,t),this}},{key:"setNear",value:function(t){return this.projectionMode===Vr.PERSPECTIVE?this.setPerspective(t,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,t,this.far),this}},{key:"setFar",value:function(t){return this.projectionMode===Vr.PERSPECTIVE?this.setPerspective(this.near,t,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,t),this}},{key:"setViewOffset",value:function(t,e,n,r,i,o){return this.aspect=t/e,void 0===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=o,this.projectionMode===Vr.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return void 0!==this.view&&(this.view.enabled=!1),this.projectionMode===Vr.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(t){return this.zoom=t,this.projectionMode===Vr.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===Vr.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(t,e){var n=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),r=n.x,i=n.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(r,i),this.setFocalPoint(r,i),this.setZoom(t),this.rotate(0,0,o);var A=this.canvas.viewport2Canvas({x:e[0],y:e[1]}),s=ut(A.x-r,A.y-i,0),a=mt(s,this.right)/lt(this.right),c=mt(s,this.up)/lt(this.up),l=m(this.getPosition(),2),u=l[0],h=l[1],d=m(this.getFocalPoint(),2),f=d[0],g=d[1];return this.setPosition(u-a,h-c),this.setFocalPoint(f-a,g-c),this}},{key:"setPerspective",value:function(t,e,n,r){var i;this.projectionMode=Vr.PERSPECTIVE,this.fov=n,this.near=t,this.far=e,this.aspect=r;var o=this.near*Math.tan(Ur(.5*this.fov))/this.zoom,A=2*o,s=this.aspect*A,a=-.5*s;if(null!==(i=this.view)&&void 0!==i&&i.enabled){var c=this.view.fullWidth,l=this.view.fullHeight;a+=this.view.offsetX*s/c,o-=this.view.offsetY*A/l,s*=this.view.width/c,A*=this.view.height/l}return function(t,e,n,r,i,o,A){var s,a,c=2*o,l=n-e,u=r-i,h=c/l,d=c/u,f=(n+e)/l,g=(r+i)/u,p=A-o,v=A*o;arguments.length>7&&void 0!==arguments[7]&&arguments[7]?(s=-A/p,a=-v/p):(s=-(A+o)/p,a=-2*v/p),t[0]=h,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=d,t[6]=0,t[7]=0,t[8]=f,t[9]=g,t[10]=s,t[11]=-1,t[12]=0,t[13]=0,t[14]=a,t[15]=0}(this.projectionMatrix,a,a+s,o-A,o,t,this.far,this.clipSpaceNearZ===lr.ZERO),N(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(t,e,n,r,i,o){var A;this.projectionMode=Vr.ORTHOGRAPHIC,this.rright=e,this.left=t,this.top=n,this.bottom=r,this.near=i,this.far=o;var s=(this.rright-this.left)/(2*this.zoom),a=(this.top-this.bottom)/(2*this.zoom),c=(this.rright+this.left)/2,l=(this.top+this.bottom)/2,u=c-s,h=c+s,d=l+a,f=l-a;if(null!==(A=this.view)&&void 0!==A&&A.enabled){var g=(this.rright-this.left)/this.view.fullWidth/this.zoom,p=(this.top-this.bottom)/this.view.fullHeight/this.zoom;h=(u+=g*this.view.offsetX)+g*this.view.width,f=(d-=p*this.view.offsetY)-p*this.view.height}return this.clipSpaceNearZ===lr.NEGATIVE_ONE?tt(this.projectionMatrix,u,h,d,f,i,o):et(this.projectionMatrix,u,h,d,f,i,o),N(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(t){var e=Sr(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.position[1],arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.position[2]);return this._setPosition(e),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.focalPoint[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.focalPoint[2],r=ut(0,1,0);if(this.focalPoint=Sr(t,e,n),this.trackingMode===zr.CINEMATIC){var i=gt(at(),this.focalPoint,this.position);t=i[0],e=i[1],n=i[2];var o=lt(i),A=Tr(Math.asin(e/o)),s=90+Tr(Math.atan2(n,t)),a=C();D(a,a,Ur(s)),P(a,a,Ur(A)),r=bt(at(),[0,1,0],a)}return N(this.matrix,nt(C(),this.position,this.focalPoint,r)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(t){if(this.distance===t||t<0)return this;this.distance=t,this.distance<Yr&&(this.distance=Yr),this.dollyingStep=this.distance/100;var e=at();t=this.distance;var n=this.forward,r=this.focalPoint;return e[0]=t*n[0]+r[0],e[1]=t*n[1]+r[1],e[2]=t*n[2]+r[2],this._setPosition(e),this.triggerUpdate(),this}},{key:"setMaxDistance",value:function(t){return this.maxDistance=t,this}},{key:"setMinDistance",value:function(t){return this.minDistance=t,this}},{key:"setAzimuth",value:function(t){return this.azimuth=Fr(t),this.computeMatrix(),this._getAxes(),this.type===jr.ORBITING||this.type===jr.EXPLORING?this._getPosition():this.type===jr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getAzimuth",value:function(){return this.azimuth}},{key:"setElevation",value:function(t){return this.elevation=Fr(t),this.computeMatrix(),this._getAxes(),this.type===jr.ORBITING||this.type===jr.EXPLORING?this._getPosition():this.type===jr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getElevation",value:function(){return this.elevation}},{key:"setRoll",value:function(t){return this.roll=Fr(t),this.computeMatrix(),this._getAxes(),this.type===jr.ORBITING||this.type===jr.EXPLORING?this._getPosition():this.type===jr.TRACKING&&this._getFocalPoint(),this.triggerUpdate(),this}},{key:"getRoll",value:function(){return this.roll}},{key:"_update",value:function(){this._getAxes(),this._getPosition(),this._getDistance(),this._getAngles(),this._getOrthoMatrix(),this.triggerUpdate()}},{key:"computeMatrix",value:function(){var t=Qt(St(),[0,0,1],Ur(this.roll));Q(this.matrix);var e=Qt(St(),[1,0,0],Ur((this.rotateWorld&&this.type!==jr.TRACKING||this.type===jr.TRACKING?1:-1)*this.elevation)),n=Qt(St(),[0,1,0],Ur((this.rotateWorld&&this.type!==jr.TRACKING||this.type===jr.TRACKING?1:-1)*this.azimuth)),r=Ut(St(),n,e);r=Ut(St(),r,t);var i=q(C(),r);this.type===jr.ORBITING||this.type===jr.EXPLORING?(I(this.matrix,this.matrix,this.focalPoint),O(this.matrix,this.matrix,i),I(this.matrix,this.matrix,[0,0,this.distance])):this.type===jr.TRACKING&&(I(this.matrix,this.matrix,this.position),O(this.matrix,this.matrix,i))}},{key:"_setPosition",value:function(t,e,n){this.position=Sr(t,e,n);var r=this.matrix;r[12]=this.position[0],r[13]=this.position[1],r[14]=this.position[2],r[15]=1,this._getOrthoMatrix()}},{key:"_getAxes",value:function(){ht(this.right,Sr(kt(Mt(),[1,0,0,0],this.matrix))),ht(this.up,Sr(kt(Mt(),[0,1,0,0],this.matrix))),ht(this.forward,Sr(kt(Mt(),[0,0,1,0],this.matrix))),vt(this.right,this.right),vt(this.up,this.up),vt(this.forward,this.forward)}},{key:"_getAngles",value:function(){var t=this.distanceVector[0],e=this.distanceVector[1],n=this.distanceVector[2],r=lt(this.distanceVector);if(0===r)return this.elevation=0,void(this.azimuth=0);this.type===jr.TRACKING||this.rotateWorld?(this.elevation=Tr(Math.asin(e/r)),this.azimuth=Tr(Math.atan2(-t,-n))):(this.elevation=-Tr(Math.asin(e/r)),this.azimuth=-Tr(Math.atan2(-t,-n)))}},{key:"_getPosition",value:function(){ht(this.position,Sr(kt(Mt(),[0,0,0,1],this.matrix))),this._getDistance()}},{key:"_getFocalPoint",value:function(){!function(t,e,n){var r=e[0],i=e[1],o=e[2];t[0]=r*n[0]+i*n[3]+o*n[6],t[1]=r*n[1]+i*n[4]+o*n[7],t[2]=r*n[2]+i*n[5]+o*n[8]}(this.distanceVector,[0,0,-this.distance],function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t}(x(),this.matrix)),ft(this.focalPoint,this.position,this.distanceVector),this._getDistance()}},{key:"_getDistance",value:function(){this.distanceVector=gt(at(),this.focalPoint,this.position),this.distance=lt(this.distanceVector),this.dollyingStep=this.distance/100}},{key:"_getOrthoMatrix",value:function(){if(this.projectionMode===Vr.ORTHOGRAPHIC){var t=this.position,e=Qt(St(),[0,0,1],-this.roll*Math.PI/180);X(this.orthoMatrix,e,ut((this.rright-this.left)/2-t[0],(this.top-this.bottom)/2-t[1],0),ut(this.zoom,this.zoom,1),t)}}},{key:"triggerUpdate",value:function(){if(this.enableUpdate){var t=this.getViewTransform(),e=O(C(),this.getPerspective(),t);this.getFrustum().extractFromVPMatrix(e),this.eventEmitter.emit(Wr)}}},{key:"rotate",value:function(t,e,n){throw new Error(Cr)}},{key:"pan",value:function(t,e){throw new Error(Cr)}},{key:"dolly",value:function(t){throw new Error(Cr)}},{key:"createLandmark",value:function(t,e){throw new Error(Cr)}},{key:"gotoLandmark",value:function(t,e){throw new Error(Cr)}},{key:"cancelLandmarkAnimation",value:function(){throw new Error(Cr)}}])}(),qr=function(t){return t[t.Standard=0]="Standard",t}({}),$r=function(t){return t[t.ADDED=0]="ADDED",t[t.REMOVED=1]="REMOVED",t[t.Z_INDEX_CHANGED=2]="Z_INDEX_CHANGED",t}({}),Zr=at(),Jr=C(),ti=St();function ei(t){if(t.localDirtyFlag){if(0!==t.localSkew[0]||0!==t.localSkew[1]){X(t.localTransform,t.localRotation,t.localPosition,ut(1,1,1),t.origin),0===t.localSkew[0]&&0===t.localSkew[1]||(Q(Jr),Jr[4]=Math.tan(t.localSkew[0]),Jr[1]=Math.tan(t.localSkew[1]),O(t.localTransform,t.localTransform,Jr));var e=X(Jr,Lt(ti,0,0,0,1),dt(Zr,1,1,1),t.localScale,t.origin);O(t.localTransform,t.localTransform,e)}else{var n=t.localTransform,r=t.localPosition,i=t.localRotation,o=t.localScale,A=t.origin,s=0!==r[0]||0!==r[1]||0!==r[2],a=1!==i[3]||0!==i[0]||0!==i[1]||0!==i[2],c=1!==o[0]||1!==o[1]||1!==o[2],l=0!==A[0]||0!==A[1]||0!==A[2];a||c||l?X(n,i,r,o,A):s?R(n,r):Q(n)}t.localDirtyFlag=!1}}var ni={absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new xr(0,0,0,0)},ri=function(t){return t.COORDINATE="<coordinate>",t.COLOR="<color>",t.PAINT="<paint>",t.NUMBER="<number>",t.ANGLE="<angle>",t.OPACITY_VALUE="<opacity-value>",t.SHADOW_BLUR="<shadow-blur>",t.LENGTH="<length>",t.PERCENTAGE="<percentage>",t.LENGTH_PERCENTAGE="<length> | <percentage>",t.LENGTH_PERCENTAGE_12="[<length> | <percentage>]{1,2}",t.LENGTH_PERCENTAGE_14="[<length> | <percentage>]{1,4}",t.LIST_OF_POINTS="<list-of-points>",t.PATH="<path>",t.FILTER="<filter>",t.Z_INDEX="<z-index>",t.OFFSET_DISTANCE="<offset-distance>",t.DEFINED_PATH="<defined-path>",t.MARKER="<marker>",t.TRANSFORM="<transform>",t.TRANSFORM_ORIGIN="<transform-origin>",t.TEXT="<text>",t.TEXT_TRANSFORM="<text-transform>",t}({});function ii(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function oi(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Ai(){}var si=.7,ai=1/si,ci="\\s*([+-]?\\d+)\\s*",li="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ui="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hi=/^#([0-9a-f]{3,8})$/,di=new RegExp(`^rgb\\(${ci},${ci},${ci}\\)$`),fi=new RegExp(`^rgb\\(${ui},${ui},${ui}\\)$`),gi=new RegExp(`^rgba\\(${ci},${ci},${ci},${li}\\)$`),pi=new RegExp(`^rgba\\(${ui},${ui},${ui},${li}\\)$`),vi=new RegExp(`^hsl\\(${li},${ui},${ui}\\)$`),mi=new RegExp(`^hsla\\(${li},${ui},${ui},${li}\\)$`),yi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function wi(){return this.rgb().formatHex()}function bi(){return this.rgb().formatRgb()}function Bi(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=hi.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Ei(e):3===n?new Ci(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?xi(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?xi(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=di.exec(t))?new Ci(e[1],e[2],e[3],1):(e=fi.exec(t))?new Ci(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=gi.exec(t))?xi(e[1],e[2],e[3],e[4]):(e=pi.exec(t))?xi(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=vi.exec(t))?Ui(e[1],e[2]/100,e[3]/100,1):(e=mi.exec(t))?Ui(e[1],e[2]/100,e[3]/100,e[4]):yi.hasOwnProperty(t)?Ei(yi[t]):"transparent"===t?new Ci(NaN,NaN,NaN,0):null}function Ei(t){return new Ci(t>>16&255,t>>8&255,255&t,1)}function xi(t,e,n,r){return r<=0&&(t=e=n=NaN),new Ci(t,e,n,r)}function Ci(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Mi(){return`#${Qi(this.r)}${Qi(this.g)}${Qi(this.b)}`}function Fi(){const t=ki(this.opacity);return`${1===t?"rgb(":"rgba("}${Si(this.r)}, ${Si(this.g)}, ${Si(this.b)}${1===t?")":`, ${t})`}`}function ki(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Si(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Qi(t){return((t=Si(t))<16?"0":"")+t.toString(16)}function Ui(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ti(t,e,n,r)}function Ni(t){if(t instanceof Ti)return new Ti(t.h,t.s,t.l,t.opacity);if(t instanceof Ai||(t=Bi(t)),!t)return new Ti;if(t instanceof Ti)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),A=NaN,s=o-i,a=(o+i)/2;return s?(A=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=a<.5?o+i:2-o-i,A*=60):s=a>0&&a<1?0:A,new Ti(A,s,a,t.opacity)}function Ti(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Oi(t){return(t=(t||0)%360)<0?t+360:t}function Ii(t){return Math.max(0,Math.min(1,t||0))}function Li(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Pi(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var A=e?e.apply(this,i):i[0],s=n.cache;if(s.has(A))return s.get(A);var a=t.apply(this,i);return n.cache=s.set(A,a)||s,a};return n.cache=new(Pi.Cache||Map),Pi.cacheList.push(n.cache),n}ii(Ai,Bi,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:wi,formatHex:wi,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Ni(this).formatHsl()},formatRgb:bi,toString:bi}),ii(Ci,function(t,e,n,r){return 1===arguments.length?function(t){return t instanceof Ai||(t=Bi(t)),t?new Ci((t=t.rgb()).r,t.g,t.b,t.opacity):new Ci}(t):new Ci(t,e,n,null==r?1:r)},oi(Ai,{brighter(t){return t=null==t?ai:Math.pow(ai,t),new Ci(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?si:Math.pow(si,t),new Ci(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Ci(Si(this.r),Si(this.g),Si(this.b),ki(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mi,formatHex:Mi,formatHex8:function(){return`#${Qi(this.r)}${Qi(this.g)}${Qi(this.b)}${Qi(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Fi,toString:Fi})),ii(Ti,function(t,e,n,r){return 1===arguments.length?Ni(t):new Ti(t,e,n,null==r?1:r)},oi(Ai,{brighter(t){return t=null==t?ai:Math.pow(ai,t),new Ti(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?si:Math.pow(si,t),new Ti(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Ci(Li(t>=240?t-240:t+120,i,r),Li(t,i,r),Li(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ti(Oi(this.h),Ii(this.s),Ii(this.l),ki(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=ki(this.opacity);return`${1===t?"hsl(":"hsla("}${Oi(this.h)}, ${100*Ii(this.s)}%, ${100*Ii(this.l)}%${1===t?")":`, ${t})`}`}})),Pi.Cache=Map,Pi.cacheList=[],Pi.clearCache=function(){Pi.cacheList.forEach(function(t){return t.clear()})};var Di=function(t){return t[t.kUnknown=0]="kUnknown",t[t.kNumber=1]="kNumber",t[t.kPercentage=2]="kPercentage",t[t.kEms=3]="kEms",t[t.kPixels=4]="kPixels",t[t.kRems=5]="kRems",t[t.kDegrees=6]="kDegrees",t[t.kRadians=7]="kRadians",t[t.kGradians=8]="kGradians",t[t.kTurns=9]="kTurns",t[t.kMilliseconds=10]="kMilliseconds",t[t.kSeconds=11]="kSeconds",t[t.kInteger=12]="kInteger",t}({}),Ri=function(t){return t[t.kUNumber=0]="kUNumber",t[t.kUPercent=1]="kUPercent",t[t.kULength=2]="kULength",t[t.kUAngle=3]="kUAngle",t[t.kUTime=4]="kUTime",t[t.kUOther=5]="kUOther",t}({}),Hi=function(t){return t[t.kYes=0]="kYes",t[t.kNo=1]="kNo",t}({}),_i=function(t){return t[t.kYes=0]="kYes",t[t.kNo=1]="kNo",t}({}),Gi=[{name:"em",unit_type:Di.kEms},{name:"px",unit_type:Di.kPixels},{name:"deg",unit_type:Di.kDegrees},{name:"rad",unit_type:Di.kRadians},{name:"grad",unit_type:Di.kGradians},{name:"ms",unit_type:Di.kMilliseconds},{name:"s",unit_type:Di.kSeconds},{name:"rem",unit_type:Di.kRems},{name:"turn",unit_type:Di.kTurns}],Ki=function(t){return t[t.kUnknownType=0]="kUnknownType",t[t.kUnparsedType=1]="kUnparsedType",t[t.kKeywordType=2]="kKeywordType",t[t.kUnitType=3]="kUnitType",t[t.kSumType=4]="kSumType",t[t.kProductType=5]="kProductType",t[t.kNegateType=6]="kNegateType",t[t.kInvertType=7]="kInvertType",t[t.kMinType=8]="kMinType",t[t.kMaxType=9]="kMaxType",t[t.kClampType=10]="kClampType",t[t.kTransformType=11]="kTransformType",t[t.kPositionType=12]="kPositionType",t[t.kURLImageType=13]="kURLImageType",t[t.kColorType=14]="kColorType",t[t.kUnsupportedColorType=15]="kUnsupportedColorType",t}({}),ji=function(t){return t?"number"===t?Di.kNumber:"percent"===t||"%"===t?Di.kPercentage:function(t){return Gi.find(function(e){return e.name===t}).unit_type}(t):Di.kUnknown},zi=function(t){var e=1;switch(t){case Di.kPixels:case Di.kDegrees:case Di.kSeconds:break;case Di.kMilliseconds:e=.001;break;case Di.kRadians:e=180/Math.PI;break;case Di.kGradians:e=.9;break;case Di.kTurns:e=360}return e},Vi=function(t){switch(t){case Di.kNumber:case Di.kInteger:return"";case Di.kPercentage:return"%";case Di.kEms:return"em";case Di.kRems:return"rem";case Di.kPixels:return"px";case Di.kDegrees:return"deg";case Di.kRadians:return"rad";case Di.kGradians:return"grad";case Di.kMilliseconds:return"ms";case Di.kSeconds:return"s";case Di.kTurns:return"turn"}return""},Wi=function(){return a(function t(){A(this,t)},[{key:"toString",value:function(){return this.buildCSSText(Hi.kNo,_i.kNo,"")}},{key:"isNumericValue",value:function(){return this.getType()>=Ki.kUnitType&&this.getType()<=Ki.kClampType}}],[{key:"isAngle",value:function(t){return t===Di.kDegrees||t===Di.kRadians||t===Di.kGradians||t===Di.kTurns}},{key:"isLength",value:function(t){return t>=Di.kEms&&t<Di.kDegrees}},{key:"isRelativeUnit",value:function(t){return t===Di.kPercentage||t===Di.kEms||t===Di.kRems}},{key:"isTime",value:function(t){return t===Di.kSeconds||t===Di.kMilliseconds}}])}(),Yi=function(t){function e(t){var n;return A(this,e),(n=g(this,e)).colorSpace=t,n}return v(e,t),a(e,[{key:"getType",value:function(){return Ki.kColorType}},{key:"to",value:function(t){return this}}])}(Wi),Xi=function(t){return t[t.Constant=0]="Constant",t[t.LinearGradient=1]="LinearGradient",t[t.RadialGradient=2]="RadialGradient",t}({}),qi=function(t){function e(t,n){var r;return A(this,e),(r=g(this,e)).type=t,r.value=n,r}return v(e,t),a(e,[{key:"clone",value:function(){return new e(this.type,this.value)}},{key:"buildCSSText",value:function(t,e,n){return n}},{key:"getType",value:function(){return Ki.kColorType}}])}(Wi),$i=function(t){function e(t){var n;return A(this,e),(n=g(this,e)).value=t,n}return v(e,t),a(e,[{key:"clone",value:function(){return new e(this.value)}},{key:"getType",value:function(){return Ki.kKeywordType}},{key:"buildCSSText",value:function(t,e,n){return n+this.value}}])}(Wi),Zi=function(t){return function(t){switch(t){case Ri.kUNumber:return Di.kNumber;case Ri.kULength:return Di.kPixels;case Ri.kUPercent:return Di.kPercentage;case Ri.kUTime:return Di.kSeconds;case Ri.kUAngle:return Di.kDegrees;default:return Di.kUnknown}}(function(t){switch(t){case Di.kNumber:case Di.kInteger:return Ri.kUNumber;case Di.kPercentage:return Ri.kUPercent;case Di.kPixels:return Ri.kULength;case Di.kMilliseconds:case Di.kSeconds:return Ri.kUTime;case Di.kDegrees:case Di.kRadians:case Di.kGradians:case Di.kTurns:return Ri.kUAngle;default:return Ri.kUOther}}(t))},Ji=function(t){function e(t){var n,r,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Di.kNumber;return A(this,e),n=g(this,e),r="string"==typeof i?ji(i):i,n.unit=r,n.value=t,n}return v(e,t),a(e,[{key:"clone",value:function(){return new e(this.value,this.unit)}},{key:"equals",value:function(t){var e=t;return this.value===e.value&&this.unit===e.unit}},{key:"getType",value:function(){return Ki.kUnitType}},{key:"convertTo",value:function(t){if(this.unit===t)return new e(this.value,this.unit);var n=Zi(this.unit);if(n!==Zi(t)||n===Di.kUnknown)return null;var r=zi(this.unit)/zi(t);return new e(this.value*r,t)}},{key:"buildCSSText",value:function(t,e,n){var r;switch(this.unit){case Di.kUnknown:break;case Di.kInteger:r=Number(this.value).toFixed(0);break;case Di.kNumber:case Di.kPercentage:case Di.kEms:case Di.kRems:case Di.kPixels:case Di.kDegrees:case Di.kRadians:case Di.kGradians:case Di.kMilliseconds:case Di.kSeconds:case Di.kTurns:var i=this.value,o=Vi(this.unit);if(i<-999999||i>999999){var A=Vi(this.unit);r=!Number.isFinite(i)||Number.isNaN(i)?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(Number.isFinite(t)?"NaN":t>0?"infinity":"-infinity")+e}(i,A):i+(A||"")}else r="".concat(i).concat(o)}return n+=r}}])}(Wi),to=new Ji(0,"px");new Ji(1,"px");var eo=new Ji(0,"deg"),no=function(t){function e(t,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,s=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return A(this,e),(i=g(this,e,["rgb"])).r=t,i.g=n,i.b=r,i.alpha=o,i.isNone=s,i}return v(e,t),a(e,[{key:"clone",value:function(){return new e(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(t,e,n){return"".concat(n,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(Yi),ro=new $i("unset"),io={"":ro,unset:ro,initial:new $i("initial"),inherit:new $i("inherit")},oo=new no(0,0,0,0,!0),Ao=new no(0,0,0,0),so=Pi(function(t,e,n,r){return new no(t,e,n,r)},function(t,e,n,r){return"rgba(".concat(t,",").concat(e,",").concat(n,",").concat(r,")")}),ao=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Di.kNumber;return new Ji(t,e)};function co(t){var e=t.type,n=t.value;return"hex"===e?"#".concat(n):"literal"===e?n:"rgb"===e?"rgb(".concat(n.join(","),")"):"rgba(".concat(n.join(","),")")}new Ji(50,"%");var lo=function(){var t=/^(linear\-gradient)/i,e=/^(repeating\-linear\-gradient)/i,n=/^(radial\-gradient)/i,r=/^(repeating\-radial\-gradient)/i,i=/^(conic\-gradient)/i,o=/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,A=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,s=/^(left|center|right|top|bottom)/i,a=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,c=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,h=/^\(/,d=/^\)/,f=/^,/,g=/^\#([0-9a-fA-F]+)/,p=/^([a-zA-Z]+)/,v=/^rgb/i,m=/^rgba/i,y=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,w="";function b(t){throw new Error("".concat(w,": ").concat(t))}function B(){var t=N(E);return w.length>0&&b("Invalid input not EOF"),t}function E(){return x("linear-gradient",t,M)||x("repeating-linear-gradient",e,M)||x("radial-gradient",n,F)||x("repeating-radial-gradient",r,F)||x("conic-gradient",i,F)}function x(t,e,n){return C(e,function(e){var r=n();return r&&(D(f)||b("Missing comma before color stops")),{type:t,orientation:r,colorStops:N(T)}})}function C(t,e){var n=D(t);if(n){D(h)||b("Missing (");var r=e(n);return D(d)||b("Missing )"),r}}function M(){return P("directional",o,1)||P("angular",u,1)}function F(){var t,e,n=k();return n&&((t=[]).push(n),e=w,D(f)&&((n=k())?t.push(n):w=e)),t}function k(){var t=function(){var t=P("shape",/^(circle)/i,0);t&&(t.style=L()||S());return t}()||function(){var t=P("shape",/^(ellipse)/i,0);t&&(t.style=I()||S());return t}();if(t)t.at=Q();else{var e=S();if(e){t=e;var n=Q();n&&(t.at=n)}else{var r=U();r&&(t={type:"default-radial",at:r})}}return t}function S(){return P("extent-keyword",A,1)}function Q(){if(P("position",/^at/,0)){var t=U();return t||b("Missing positioning value"),t}}function U(){var t={x:I(),y:I()};if(t.x||t.y)return{type:"position",value:t}}function N(t){var e=t(),n=[];if(e)for(n.push(e);D(f);)(e=t())?n.push(e):b("One extra comma");return n}function T(){var t=P("hex",g,1)||C(m,function(){return{type:"rgba",value:N(O)}})||C(v,function(){return{type:"rgb",value:N(O)}})||P("literal",p,0);return t||b("Expected color definition"),t.length=I(),t}function O(){return D(y)[1]}function I(){return P("%",c,1)||P("position-keyword",s,1)||L()}function L(){return P("px",a,1)||P("em",l,1)}function P(t,e,n){var r=D(e);if(r)return{type:t,value:r[n]}}function D(t){var e=/^[\n\r\t\s]+/.exec(w);e&&R(e[0].length);var n=t.exec(w);return n&&R(n[0].length),n}function R(t){w=w.substring(t)}return function(t){return w=t,B()}}();var uo=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,ho=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,fo=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,go=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;var po={left:180,top:-90,bottom:90,right:0,"left top":225,"top left":225,"left bottom":135,"bottom left":135,"right top":-45,"top right":-45,"right bottom":45,"bottom right":45},vo=Pi(function(t){var e;return e="angular"===t.type?Number(t.value):po[t.value]||0,ao(e,"deg")}),mo=Pi(function(t){var e=50,n=50,r="%",i="%";if("position"===(null==t?void 0:t.type)){var o=t.value,A=o.x,s=o.y;"position-keyword"===(null==A?void 0:A.type)&&("left"===A.value?e=0:"center"===A.value?e=50:"right"===A.value?e=100:"top"===A.value?n=0:"bottom"===A.value&&(n=100)),"position-keyword"===(null==s?void 0:s.type)&&("left"===s.value?e=0:"center"===s.value?n=50:"right"===s.value?e=100:"top"===s.value?n=0:"bottom"===s.value&&(n=100)),"px"!==(null==A?void 0:A.type)&&"%"!==(null==A?void 0:A.type)&&"em"!==(null==A?void 0:A.type)||(r=null==A?void 0:A.type,e=Number(A.value)),"px"!==(null==s?void 0:s.type)&&"%"!==(null==s?void 0:s.type)&&"em"!==(null==s?void 0:s.type)||(i=null==s?void 0:s.type,n=Number(s.value))}return{cx:ao(e,r),cy:ao(n,i)}}),yo=Pi(function(t){if(t.indexOf("linear")>-1||t.indexOf("radial")>-1)return lo(t).map(function(t){var e=t.type,n=t.orientation,r=t.colorStops;!function(t){var e,n,r=t.length;t[r-1].length=null!==(e=t[r-1].length)&&void 0!==e?e:{type:"%",value:"100"},r>1&&(t[0].length=null!==(n=t[0].length)&&void 0!==n?n:{type:"%",value:"0"});for(var i=0,o=Number(t[0].length.value),A=1;A<r;A++){var s,a=null===(s=t[A].length)||void 0===s?void 0:s.value;if(!Kt(a)&&!Kt(o)){for(var c=1;c<A-i;c++)t[i+c].length={type:"%",value:"".concat(o+(Number(a)-o)*c/(A-i))};i=A,o=Number(a)}}}(r);var i=r.map(function(t){return{offset:ao(Number(t.length.value),"%"),color:co(t)}});if("linear-gradient"===e)return new qi(Xi.LinearGradient,{angle:n?vo(n):eo,steps:i});if("radial-gradient"===e&&(n||(n=[{type:"shape",value:"circle"}]),"shape"===n[0].type&&"circle"===n[0].value)){var o,A=mo(n[0].at),s=A.cx,a=A.cy;if(n[0].style){var c=n[0].style,l=c.type,u=c.value;o="extent-keyword"===l?function(t){return io[t]||(io[t]=new $i(t)),io[t]}(u):ao(u,l)}return new qi(Xi.RadialGradient,{cx:s,cy:a,size:o,steps:i})}});var e=t[0];if("("===t[1]||"("===t[2])if("l"===e){var n=uo.exec(t);if(n){var r,i=(null===(r=n[2].match(go))||void 0===r?void 0:r.map(function(t){return t.split(":")}))||[];return[new qi(Xi.LinearGradient,{angle:ao(parseFloat(n[1]),"deg"),steps:i.map(function(t){var e=m(t,2),n=e[0],r=e[1];return{offset:ao(100*Number(n),"%"),color:r}})})]}}else if("r"===e){var o=function(t){var e=ho.exec(t);if(e){var n,r=(null===(n=e[4].match(go))||void 0===n?void 0:n.map(function(t){return t.split(":")}))||[];return{cx:ao(50,"%"),cy:ao(50,"%"),steps:r.map(function(t){var e=m(t,2),n=e[0],r=e[1];return{offset:ao(100*Number(n),"%"),color:r}})}}return null}(t);if(o){if(!Jt(o))return[new qi(Xi.RadialGradient,o)];t=o}}else if("p"===e)return function(t){var e=fo.exec(t);if(e){var n=e[1],r=e[2];switch(n){case"a":n="repeat";break;case"x":n="repeat-x";break;case"y":n="repeat-y";break;default:n="no-repeat"}return{image:r,repetition:n}}return null}(t)});function wo(t){return t&&!!t.image}function bo(t){return t&&!Kt(t.r)&&!Kt(t.g)&&!Kt(t.b)}var Bo=Pi(function(t){if(wo(t))return o({repetition:"repeat"},t);if(Kt(t)&&(t=""),"transparent"===t)return Ao;if("currentColor"===t)t="black";else if("none"===t)return oo;var e=yo(t);if(e)return e;var n=Bi(t),r=[0,0,0,0];return null!==n&&(r[0]=n.r||0,r[1]=n.g||0,r[2]=n.b||0,r[3]=n.opacity),so.apply(void 0,r)});function Eo(t,e){if(bo(t)&&bo(e))return[[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],[Number(e.r),Number(e.g),Number(e.b),Number(e.alpha)],function(t){var e=t.slice();if(e[3])for(var n=0;n<3;n++)e[n]=Math.round(ne(e[n],0,255));return e[3]=ne(e[3],0,1),"rgba(".concat(e.join(","),")")}]}function xo(t,e){if(Kt(e))return ao(0,"px");if(e="".concat(e).trim().toLowerCase(),isFinite(Number(e))){if("px".search(t)>=0)return ao(Number(e),"px");if("deg".search(t)>=0)return ao(Number(e),"deg")}var n=[];e=e.replace(t,function(t){return n.push(t),"U".concat(t)});var r="U(".concat(t.source,")");return n.map(function(t){return ao(Number(e.replace(new RegExp("U".concat(t),"g"),"").replace(new RegExp(r,"g"),"*0")),t)})[0]}var Co=function(t){return xo(new RegExp("px","g"),t)},Mo=Pi(Co);Pi(function(t){return xo(new RegExp("%","g"),t)});var Fo=function(t){return re(t)||isFinite(Number(t))?ao(Number(t)||0,"px"):xo(new RegExp("px|%|em|rem","g"),t)},ko=Pi(Fo),So=function(t){return xo(new RegExp("deg|rad|grad|turn","g"),t)},Qo=Pi(So);function Uo(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,o="",A=t.value||0,s=e.value||0,a=Zi(t.unit),c=t.convertTo(a),l=e.convertTo(a);return c&&l?(A=c.value,s=l.value,o=Vi(t.unit)):(Ji.isLength(t.unit)||Ji.isLength(e.unit))&&(A=Oo(t,i,n),s=Oo(e,i,n),o="px"),[A,s,function(t){return t+o}]}function No(t){var e=0;return t.unit===Di.kDegrees?e=t.value:t.unit===Di.kRadians?e=Tr(Number(t.value)):t.unit===Di.kTurns?e=360*Number(t.value):t.value&&(e=t.value),e}function To(t,e){var n;return Array.isArray(t)?n=t.map(function(t){return Number(t)}):Jt(t)?n=t.split(" ").map(function(t){return Number(t)}):re(t)&&(n=[t]),2===e?1===n.length?[n[0],n[0]]:[n[0],n[1]]:4===e?1===n.length?[n[0],n[0],n[0],n[0]]:2===n.length?[n[0],n[1],n[0],n[1]]:3===n.length?[n[0],n[1],n[2],n[1]]:[n[0],n[1],n[2],n[3]]:"even"===e&&n.length%2==1?[].concat(u(n),u(n)):n}function Oo(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.unit===Di.kPixels)return Number(t.value);if(t.unit===Di.kPercentage&&n){var i=n.nodeName===cr.GROUP?n.getLocalBounds():n.getGeometryBounds();return(r?i.min[e]:0)+t.value/100*i.halfExtents[e]*2}return 0}var Io=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Lo(t){return t.toString()}var Po=function(t){return"number"==typeof t?ao(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?ao(Number(t)):ao(0)},Do=Pi(Po);function Ro(t,e){return[t,e,Lo]}function Ho(t,e){return function(n,r){return[n,r,function(n){return Lo(ne(n,t,e))}]}}function _o(t,e){if(t.length===e.length)return[t,e,function(t){return t}]}function Go(t){var e;return 0===t.parsedStyle.d.totalLength&&(t.parsedStyle.d.totalLength=xn(t.parsedStyle.d.absolutePath,void 0,Le(Le({},e),{bbox:!1,length:!0})).length),t.parsedStyle.d.totalLength}function Ko(t,e){return t[0]===e[0]&&t[1]===e[1]}function jo(t,e){var n=t.prePoint,r=t.currentPoint,i=t.nextPoint,o=Math.pow(r[0]-n[0],2)+Math.pow(r[1]-n[1],2),A=Math.pow(r[0]-i[0],2)+Math.pow(r[1]-i[1],2),s=Math.pow(n[0]-i[0],2)+Math.pow(n[1]-i[1],2),a=Math.acos((o+A-s)/(2*Math.sqrt(o)*Math.sqrt(A)));if(!a||0===Math.sin(a)||ie(a,0))return{xExtra:0,yExtra:0};var c=Math.abs(Math.atan2(i[1]-r[1],i[0]-r[0])),l=Math.abs(Math.atan2(i[0]-r[0],i[1]-r[1]));return c=c>Math.PI/2?Math.PI-c:c,l=l>Math.PI/2?Math.PI-l:l,{xExtra:Math.cos(a/2-c)*(e/2*(1/Math.sin(a/2)))-e/2||0,yExtra:Math.cos(l-a/2)*(e/2*(1/Math.sin(a/2)))-e/2||0}}function zo(t,e){return[e[0]+(e[0]-t[0]),e[1]+(e[1]-t[1])]}Pi(function(t){return Jt(t)?t.split(" ").map(Do):t.map(Do)});var Vo=function(t,e){var n=t.x*e.x+t.y*e.y,r=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2)));return(t.x*e.y-t.y*e.x<0?-1:1)*Math.acos(n/r)},Wo=function(t,e,n,r,i,o,A,s){e=Math.abs(e),n=Math.abs(n);var a=Ur(r=se(r,360));if(t.x===A.x&&t.y===A.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(0===e||0===n)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-A.x)/2,l=(t.y-A.y)/2,u={x:Math.cos(a)*c+Math.sin(a)*l,y:-Math.sin(a)*c+Math.cos(a)*l},h=Math.pow(u.x,2)/Math.pow(e,2)+Math.pow(u.y,2)/Math.pow(n,2);h>1&&(e*=Math.sqrt(h),n*=Math.sqrt(h));var d=(Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(u.y,2)-Math.pow(n,2)*Math.pow(u.x,2))/(Math.pow(e,2)*Math.pow(u.y,2)+Math.pow(n,2)*Math.pow(u.x,2));d=d<0?0:d;var f=(i!==o?1:-1)*Math.sqrt(d),g=f*(e*u.y/n),p=f*(-n*u.x/e),v={x:Math.cos(a)*g-Math.sin(a)*p+(t.x+A.x)/2,y:Math.sin(a)*g+Math.cos(a)*p+(t.y+A.y)/2},m={x:(u.x-g)/e,y:(u.y-p)/n},y=Vo({x:1,y:0},m),w=Vo(m,{x:(-u.x-g)/e,y:(-u.y-p)/n});!o&&w>0?w-=2*Math.PI:o&&w<0&&(w+=2*Math.PI);var b=y+(w%=2*Math.PI)*s,B=e*Math.cos(b),E=n*Math.sin(b);return{x:Math.cos(a)*B-Math.sin(a)*E+v.x,y:Math.sin(a)*B+Math.cos(a)*E+v.y,ellipticalArcStartAngle:y,ellipticalArcEndAngle:y+w,ellipticalArcAngle:b,ellipticalArcCenter:v,resultantRx:e,resultantRy:n}};function Yo(t,e){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=t.arcParams,i=r.rx,o=void 0===i?0:i,A=r.ry,s=void 0===A?0:A,a=r.xRotation,c=r.arcFlag,l=r.sweepFlag,u=Wo({x:t.prePoint[0],y:t.prePoint[1]},o,s,a,!!c,!!l,{x:t.currentPoint[0],y:t.currentPoint[1]},e),h=Wo({x:t.prePoint[0],y:t.prePoint[1]},o,s,a,!!c,!!l,{x:t.currentPoint[0],y:t.currentPoint[1]},n?e+.005:e-.005),d=h.x-u.x,f=h.y-u.y,g=Math.sqrt(d*d+f*f);return{x:-d/g,y:-f/g}}function Xo(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function qo(t,e){return Xo(t)*Xo(e)?(t[0]*e[0]+t[1]*e[1])/(Xo(t)*Xo(e)):1}function $o(t,e){return(t[0]*e[1]<t[1]*e[0]?-1:1)*Math.acos(qo(t,e))}function Zo(t,e){var n=e[1],r=e[2],i=se(Ur(e[3]),2*Math.PI),o=e[4],A=e[5],s=t[0],a=t[1],c=e[6],l=e[7],u=Math.cos(i)*(s-c)/2+Math.sin(i)*(a-l)/2,h=-1*Math.sin(i)*(s-c)/2+Math.cos(i)*(a-l)/2,d=u*u/(n*n)+h*h/(r*r);d>1&&(n*=Math.sqrt(d),r*=Math.sqrt(d));var f=n*n*(h*h)+r*r*(u*u),g=f?Math.sqrt((n*n*(r*r)-f)/f):1;o===A&&(g*=-1),isNaN(g)&&(g=0);var p=r?g*n*h/r:0,v=n?g*-r*u/n:0,m=(s+c)/2+Math.cos(i)*p-Math.sin(i)*v,y=(a+l)/2+Math.sin(i)*p+Math.cos(i)*v,w=[(u-p)/n,(h-v)/r],b=[(-1*u-p)/n,(-1*h-v)/r],B=$o([1,0],w),E=$o(w,b);return qo(w,b)<=-1&&(E=Math.PI),qo(w,b)>=1&&(E=0),0===A&&E>0&&(E-=2*Math.PI),1===A&&E<0&&(E+=2*Math.PI),{cx:m,cy:y,rx:Ko(t,[c,l])?0:n,ry:Ko(t,[c,l])?0:r,startAngle:B,endAngle:B+E,xRotation:i,arcFlag:o,sweepFlag:A}}var Jo=function(t){if(""===t||Array.isArray(t)&&0===t.length)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=an(t)}catch(n){e=an(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}!function(t){for(var e=0;e<t.length;e++){var n=t[e-1],r=t[e];if("M"===r[0]&&n){var i=n[0],o=[r[1],r[2]],A=void 0;"L"===i||"M"===i?A=[n[1],n[2]]:"C"!==i&&"A"!==i&&"Q"!==i||(A=[n[n.length-2],n[n.length-1]]),A&&Ko(o,A)&&(t.splice(e,1),e--)}}}(e);var n=function(t){for(var e=!1,n=t.length,r=0;r<n;r++){var i=t[r][0];if("C"===i||"A"===i||"Q"===i){e=!0;break}}return e}(e),r=function(t){for(var e=[],n=[],r=[],i=0;i<t.length;i++){var o=t[i],A=o[0];"M"===A?(r.length&&(n.push(r),r=[]),r.push([o[1],o[2]])):"Z"===A?r.length&&(e.push(r),r=[]):r.push([o[1],o[2]])}return r.length>0&&n.push(r),{polygons:e,polylines:n}}(e),i=r.polygons,o=r.polylines,A=function(t){for(var e=[],n=null,r=null,i=null,o=0,A=t.length,s=0;s<A;s++){var a=t[s];r=t[s+1];var c=a[0],l={command:c,prePoint:n,params:a,startTangent:null,endTangent:null,currentPoint:null,nextPoint:null,arcParams:null,box:null,cubicParams:null};switch(c){case"M":i=[a[1],a[2]],o=s;break;case"A":var u=Zo(n,a);l.arcParams=u}if("Z"===c)n=i,r=t[o+1];else{var h=a.length;n=[a[h-2],a[h-1]]}r&&"Z"===r[0]&&(r=t[o],e[o]&&(e[o].prePoint=n)),l.currentPoint=n,e[o]&&Ko(n,e[o].currentPoint)&&(e[o].prePoint=l.prePoint);var d=r?[r[r.length-2],r[r.length-1]]:null;l.nextPoint=d;var f=l.prePoint;if(["L","H","V"].includes(c))l.startTangent=[f[0]-n[0],f[1]-n[1]],l.endTangent=[n[0]-f[0],n[1]-f[1]];else if("Q"===c){var g=[a[1],a[2]];l.startTangent=[f[0]-g[0],f[1]-g[1]],l.endTangent=[n[0]-g[0],n[1]-g[1]]}else if("T"===c){var p=e[s-1],v=zo(p.currentPoint,f);"Q"===p.command?(l.command="Q",l.startTangent=[f[0]-v[0],f[1]-v[1]],l.endTangent=[n[0]-v[0],n[1]-v[1]]):(l.command="TL",l.startTangent=[f[0]-n[0],f[1]-n[1]],l.endTangent=[n[0]-f[0],n[1]-f[1]])}else if("C"===c){var m=[a[1],a[2]],y=[a[3],a[4]];l.startTangent=[f[0]-m[0],f[1]-m[1]],l.endTangent=[n[0]-y[0],n[1]-y[1]],0===l.startTangent[0]&&0===l.startTangent[1]&&(l.startTangent=[m[0]-y[0],m[1]-y[1]]),0===l.endTangent[0]&&0===l.endTangent[1]&&(l.endTangent=[y[0]-m[0],y[1]-m[1]])}else if("S"===c){var w=e[s-1],b=zo(w.currentPoint,f),B=[a[1],a[2]];"C"===w.command?(l.command="C",l.startTangent=[f[0]-b[0],f[1]-b[1]],l.endTangent=[n[0]-B[0],n[1]-B[1]]):(l.command="SQ",l.startTangent=[f[0]-B[0],f[1]-B[1]],l.endTangent=[n[0]-B[0],n[1]-B[1]])}else if("A"===c){var E=Yo(l,0),x=E.x,C=E.y,M=Yo(l,1,!1),F=M.x,k=M.y;l.startTangent=[x,C],l.endTangent=[F,k]}e.push(l)}return e}(e),s=function(t,e){for(var n=[],r=[],i=[],o=0;o<t.length;o++){var A=t[o],s=A.currentPoint,a=A.params,c=A.prePoint,l=void 0;switch(A.command){case"Q":l=Yn(c[0],c[1],a[1],a[2],a[3],a[4]);break;case"C":l=Kn(c[0],c[1],a[1],a[2],a[3],a[4],a[5],a[6]);break;case"A":var u=A.arcParams;l=Ln(u.cx,u.cy,u.rx,u.ry,u.xRotation,u.startAngle,u.endAngle);break;default:n.push(s[0]),r.push(s[1])}l&&(A.box=l,n.push(l.x,l.x+l.width),r.push(l.y,l.y+l.height))}n=n.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0}),r=r.filter(function(t){return!Number.isNaN(t)&&t!==1/0&&t!==-1/0});var h=Zt(n),d=Zt(r),f=$t(n),g=$t(r);if(0===i.length)return{x:h,y:d,width:f-h,height:g-d};for(var p=0;p<i.length;p++){var v=i[p],m=v.currentPoint;m[0]===h?h-=jo(v,e).xExtra:m[0]===f&&(f+=jo(v,e).xExtra),m[1]===d?d-=jo(v,e).yExtra:m[1]===g&&(g+=jo(v,e).yExtra)}return{x:h,y:d,width:f-h,height:g-d}}(A,0),a=s.x,c=s.y,l=s.width,u=s.height;return{absolutePath:e,hasArc:n,segments:A,polygons:i,polylines:o,totalLength:0,rect:{x:Number.isFinite(a)?a:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(l)?l:0,height:Number.isFinite(u)?u:0}}},tA=Pi(Jo);function eA(t){return Jt(t)?tA(t):Jo(t)}function nA(t,e,n){var r=t.curve,i=e.curve;r&&0!==r.length||(r=fn(t.absolutePath,!1),t.curve=r),i&&0!==i.length||(i=fn(e.absolutePath,!1),e.curve=i);var o=[r,i];r.length!==i.length&&(o=kn(r,i));var A,s,a=Mn(o[0])!==Mn(o[1])?(A=o[0],s=A.slice(1).map(function(t,e,n){return e?n[e-1].slice(-2).concat(t.slice(1)):A[0].slice(1).concat(t.slice(1))}).map(function(t){return t.map(function(e,n){return t[t.length-n-2*(1-n%2)]})}).reverse(),[["M"].concat(s[0].slice(0,2))].concat(s.map(function(t){return["C"].concat(t.slice(2))}))):o[0].map(function(t){return Array.isArray(t)?[].concat(t):t});return[a,Cn(o[1],a),function(t){return t}]}function rA(t,e){return[t.points,e.points,function(t){return t}]}var iA=null,oA=/\s*(\w+)\(([^)]*)\)/g;function AA(t){return function(e){var n=0;return t.map(function(t){return t===iA?e[n++]:t})}}function sA(t){return t}var aA={matrix:["NNNNNN",[iA,iA,0,0,iA,iA,0,0,0,0,1,0,iA,iA,0,1],sA],matrix3d:["NNNNNNNNNNNNNNNN",sA],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",AA([iA,iA,new Ji(1)]),sA],scaleX:["N",AA([iA,new Ji(1),new Ji(1)]),AA([iA,new Ji(1)])],scaleY:["N",AA([new Ji(1),iA,new Ji(1)]),AA([new Ji(1),iA])],scaleZ:["N",AA([new Ji(1),new Ji(1),iA])],scale3d:["NNN",sA],skew:["Aa",null,sA],skewX:["A",null,AA([iA,eo])],skewY:["A",null,AA([eo,iA])],translate:["Tt",AA([iA,iA,to]),sA],translateX:["T",AA([iA,to,to]),AA([iA,to])],translateY:["T",AA([to,iA,to]),AA([to,iA])],translateZ:["L",AA([to,to,iA])],translate3d:["TTL",sA]};function cA(t){for(var e=[],n=t.length,r=0;r<n;r++){var i=t[r],o=i[0],A=i.slice(1);if("translate"===o||"skew"===o?1===A.length&&A.push(0):"scale"===o&&1===A.length&&A.push(A[0]),!aA[o])return[];var s=A.map(function(t){return ao(t)});e.push({t:o,d:s})}return e}function lA(t){if(Array.isArray(t))return cA(t);if("none"===(t=(t||"none").trim()))return[];var e,n=[],r=0;for(oA.lastIndex=0;e=oA.exec(t);){if(e.index!==r)return[];r=e.index+e[0].length;var i=e[1],o=aA[i];if(!o)return[];var A=e[2].split(","),s=o[0];if(s.length<A.length)return[];for(var a=[],c=0;c<s.length;c++){var l=A[c],u=s[c],h=void 0;if(h=l?{A:function(t){return"0"===t.trim()?eo:Qo(t)},N:Do,T:ko,L:Mo}[u.toUpperCase()](l):{a:eo,n:a[0],t:to}[u],void 0===h)return[];a.push(h)}if(n.push({t:i,d:a}),oA.lastIndex===t.length)return n}return[]}function uA(t){if(Array.isArray(t))return cA(t);if("none"===(t=(t||"none").trim()))return[];var e,n=[],r=0;for(oA.lastIndex=0;e=oA.exec(t);){if(e.index!==r)return[];r=e.index+e[0].length;var i=e[1],o=aA[i];if(!o)return[];var A=e[2].split(","),s=o[0];if(s.length<A.length)return[];for(var a=[],c=0;c<s.length;c++){var l=A[c],u=s[c],h=void 0;if(h=l?{A:function(t){return"0"===t.trim()?eo:So(t)},N:Po,T:Fo,L:Co}[u.toUpperCase()](l):{a:eo,n:a[0],t:to}[u],void 0===h)return[];a.push(h)}if(n.push({t:i,d:a}),oA.lastIndex===t.length)return n}return[]}function hA(t){var e,n,r,i;switch(t.t){case"rotateX":return i=Ur(No(t.d[0])),[1,0,0,0,0,Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1];case"rotateY":return i=Ur(No(t.d[0])),[Math.cos(i),0,-Math.sin(i),0,0,1,0,0,Math.sin(i),0,Math.cos(i),0,0,0,0,1];case"rotate":case"rotateZ":return i=Ur(No(t.d[0])),[Math.cos(i),Math.sin(i),0,0,-Math.sin(i),Math.cos(i),0,0,0,0,1,0,0,0,0,1];case"rotate3d":e=t.d[0].value,n=t.d[1].value,r=t.d[2].value,i=Ur(No(t.d[3]));var o=e*e+n*n+r*r;if(0===o)e=1,n=0,r=0;else if(1!==o){var A=Math.sqrt(o);e/=A,n/=A,r/=A}var s=Math.sin(i/2),a=s*Math.cos(i/2),c=s*s;return[1-2*(n*n+r*r)*c,2*(e*n*c+r*a),2*(e*r*c-n*a),0,2*(e*n*c-r*a),1-2*(e*e+r*r)*c,2*(n*r*c+e*a),0,2*(e*r*c+n*a),2*(n*r*c-e*a),1-2*(e*e+n*n)*c,0,0,0,0,1];case"scale":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,1,0,0,0,0,1];case"scaleX":return[t.d[0].value,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"scaleY":return[1,0,0,0,0,t.d[0].value,0,0,0,0,1,0,0,0,0,1];case"scaleZ":return[1,0,0,0,0,1,0,0,0,0,t.d[0].value,0,0,0,0,1];case"scale3d":return[t.d[0].value,0,0,0,0,t.d[1].value,0,0,0,0,t.d[2].value,0,0,0,0,1];case"skew":var l=Ur(No(t.d[0])),u=Ur(No(t.d[1]));return[1,Math.tan(u),0,0,Math.tan(l),1,0,0,0,0,1,0,0,0,0,1];case"skewX":return i=Ur(No(t.d[0])),[1,0,0,0,Math.tan(i),1,0,0,0,0,1,0,0,0,0,1];case"skewY":return i=Ur(No(t.d[0])),[1,Math.tan(i),0,0,0,1,0,0,0,0,1,0,0,0,0,1];case"translate":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Oo(t.d[0],0,null)||0,n=Oo(t.d[1],0,null)||0,0,1];case"translateX":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Oo(t.d[0],0,null)||0,0,0,1];case"translateY":return[1,0,0,0,0,1,0,0,0,0,1,0,0,n=Oo(t.d[0],0,null)||0,0,1];case"translateZ":return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,r=Oo(t.d[0],0,null)||0,1];case"translate3d":return[1,0,0,0,0,1,0,0,0,0,1,0,e=Oo(t.d[0],0,null)||0,n=Oo(t.d[1],0,null)||0,r=Oo(t.d[2],0,null)||0,1];case"perspective":var h=Oo(t.d[0],0,null)||0;return[1,0,0,0,0,1,0,0,0,0,1,h?-1/h:0,0,0,0,1];case"matrix":return[t.d[0].value,t.d[1].value,0,0,t.d[2].value,t.d[3].value,0,0,0,0,1,0,t.d[4].value,t.d[5].value,0,1];case"matrix3d":return t.d.map(function(t){return t.value})}}function dA(t,e){return[t[0]*e[0]+t[4]*e[1]+t[8]*e[2]+t[12]*e[3],t[1]*e[0]+t[5]*e[1]+t[9]*e[2]+t[13]*e[3],t[2]*e[0]+t[6]*e[1]+t[10]*e[2]+t[14]*e[3],t[3]*e[0]+t[7]*e[1]+t[11]*e[2]+t[15]*e[3],t[0]*e[4]+t[4]*e[5]+t[8]*e[6]+t[12]*e[7],t[1]*e[4]+t[5]*e[5]+t[9]*e[6]+t[13]*e[7],t[2]*e[4]+t[6]*e[5]+t[10]*e[6]+t[14]*e[7],t[3]*e[4]+t[7]*e[5]+t[11]*e[6]+t[15]*e[7],t[0]*e[8]+t[4]*e[9]+t[8]*e[10]+t[12]*e[11],t[1]*e[8]+t[5]*e[9]+t[9]*e[10]+t[13]*e[11],t[2]*e[8]+t[6]*e[9]+t[10]*e[10]+t[14]*e[11],t[3]*e[8]+t[7]*e[9]+t[11]*e[10]+t[15]*e[11],t[0]*e[12]+t[4]*e[13]+t[8]*e[14]+t[12]*e[15],t[1]*e[12]+t[5]*e[13]+t[9]*e[14]+t[13]*e[15],t[2]*e[12]+t[6]*e[13]+t[10]*e[14]+t[14]*e[15],t[3]*e[12]+t[7]*e[13]+t[11]*e[14]+t[15]*e[15]]}function fA(t){var e=[0,0,0],n=[1,1,1],r=[0,0,0],i=[0,0,0,1],o=[0,0,0,1];return function(t,e,n,r,i,o){if(!function(t,e){var n=e[15];if(0===n)return!1;for(var r=1/n,i=0;i<16;i++)t[i]=e[i]*r;return!0}(Dr,t))return!1;if(F(Rr,Dr),Rr[3]=0,Rr[7]=0,Rr[11]=0,Rr[15]=1,Math.abs(T(Rr))<1e-8)return!1;var A,s,a=Dr[3],c=Dr[7],l=Dr[11],u=Dr[12],h=Dr[13],d=Dr[14],f=Dr[15];if(0!==a||0!==c||0!==l){if(Hr[0]=a,Hr[1]=c,Hr[2]=l,Hr[3]=f,!N(Rr,Rr))return!1;U(Rr,Rr),kt(i,Hr,Rr)}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=u,e[1]=h,e[2]=d,s=Dr,(A=_r)[0][0]=s[0],A[0][1]=s[1],A[0][2]=s[2],A[1][0]=s[4],A[1][1]=s[5],A[1][2]=s[6],A[2][0]=s[8],A[2][1]=s[9],A[2][2]=s[10],n[0]=lt(_r[0]),vt(_r[0],_r[0]),r[0]=mt(_r[0],_r[1]),Kr(_r[1],_r[1],_r[0],1,-r[0]),n[1]=lt(_r[1]),vt(_r[1],_r[1]),r[0]/=n[1],r[1]=mt(_r[0],_r[2]),Kr(_r[2],_r[2],_r[0],1,-r[1]),r[2]=mt(_r[1],_r[2]),Kr(_r[2],_r[2],_r[1],1,-r[2]),n[2]=lt(_r[2]),vt(_r[2],_r[2]),r[1]/=n[2],r[2]/=n[2],yt(Gr,_r[1],_r[2]),mt(_r[0],Gr)<0)for(var g=0;g<3;g++)n[g]*=-1,_r[g][0]*=-1,_r[g][1]*=-1,_r[g][2]*=-1;o[0]=.5*Math.sqrt(Math.max(1+_r[0][0]-_r[1][1]-_r[2][2],0)),o[1]=.5*Math.sqrt(Math.max(1-_r[0][0]+_r[1][1]-_r[2][2],0)),o[2]=.5*Math.sqrt(Math.max(1-_r[0][0]-_r[1][1]+_r[2][2],0)),o[3]=.5*Math.sqrt(Math.max(1+_r[0][0]+_r[1][1]+_r[2][2],0)),_r[2][1]>_r[1][2]&&(o[0]=-o[0]),_r[0][2]>_r[2][0]&&(o[1]=-o[1]),_r[1][0]>_r[0][1]&&(o[2]=-o[2])}(function(t){return 0===t.length?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:t.map(hA).reduce(dA)}(t),e,n,r,i,o),[[e,n,r,o,i]]}var gA=function(){function t(t,e){for(var n=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],r=0;r<4;r++)for(var i=0;i<4;i++)for(var o=0;o<4;o++)n[r][i]+=e[r][o]*t[o][i];return n}return function(e,n,r,i,o){for(var A=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],s=0;s<4;s++)A[s][3]=o[s];for(var a=0;a<3;a++)for(var c=0;c<3;c++)A[3][a]+=e[c]*A[c][a];var l=i[0],u=i[1],h=i[2],d=i[3],f=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];f[0][0]=1-2*(u*u+h*h),f[0][1]=2*(l*u-h*d),f[0][2]=2*(l*h+u*d),f[1][0]=2*(l*u+h*d),f[1][1]=1-2*(l*l+h*h),f[1][2]=2*(u*h-l*d),f[2][0]=2*(l*h-u*d),f[2][1]=2*(u*h+l*d),f[2][2]=1-2*(l*l+u*u),A=t(A,f);var g=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];r[2]&&(g[2][1]=r[2],A=t(A,g)),r[1]&&(g[2][1]=0,g[2][0]=r[0],A=t(A,g)),r[0]&&(g[2][0]=0,g[1][0]=r[0],A=t(A,g));for(var p=0;p<3;p++)for(var v=0;v<3;v++)A[p][v]*=n[p];return function(t){return 0===t[0][2]&&0===t[0][3]&&0===t[1][2]&&0===t[1][3]&&0===t[2][0]&&0===t[2][1]&&1===t[2][2]&&0===t[2][3]&&0===t[3][2]&&1===t[3][3]}(A)?[A[0][0],A[0][1],A[1][0],A[1][1],A[3][0],A[3][1]]:A[0].concat(A[1],A[2],A[3])}}();function pA(t){return t.toFixed(6).replace(".000000","")}function vA(t,e){var n,r;return t.decompositionPair!==e&&(t.decompositionPair=e,n=fA(t)),e.decompositionPair!==t&&(e.decompositionPair=t,r=fA(e)),null===n[0]||null===r[0]?[[!1],[!0],function(n){return n?e[0].d:t[0].d}]:(n[0].push(0),r[0].push(1),[n,r,function(t){var e=function(t,e,n){var r=function(t,e){for(var n=0,r=0;r<t.length;r++)n+=t[r]*e[r];return n}(t,e);r=ne(r,-1,1);var i=[];if(1===r)i=t;else for(var o=Math.acos(r),A=1*Math.sin(n*o)/Math.sqrt(1-r*r),s=0;s<4;s++)i.push(t[s]*(Math.cos(n*o)-r*A)+e[s]*A);return i}(n[0][3],r[0][3],t[5]);return gA(t[0],t[1],t[2],e,t[4]).map(pA).join(",")}])}function mA(t){return t.replace(/[XY]/,"")}function yA(t){return t.replace(/(X|Y|Z|3d)?$/,"3d")}var wA=function(t,e){return"perspective"===t&&"perspective"===e||("matrix"===t||"matrix3d"===t)&&("matrix"===e||"matrix3d"===e)};function bA(t,e,n){var r=!1;if(!t.length||!e.length){t.length||(r=!0,t=e,e=[]);for(var i=function(){var n=t[o],r=n.t,i=n.d,A="scale"===r.substring(0,5)?1:0;e.push({t:r,d:i.map(function(t){return"number"==typeof t?ao(A):ao(A,t.unit)})})},o=0;o<t.length;o++)i()}var A=[],s=[],a=[];if(t.length!==e.length){var c=vA(t,e);A=[c[0]],s=[c[1]],a=[["matrix",[c[2]]]]}else for(var l=0;l<t.length;l++){var u=t[l].t,h=e[l].t,d=t[l].d,f=e[l].d,g=aA[u],p=aA[h],v=void 0;if(wA(u,h)){var m=vA([t[l]],[e[l]]);A.push(m[0]),s.push(m[1]),a.push(["matrix",[m[2]]])}else{if(u===h)v=u;else if(g[2]&&p[2]&&mA(u)===mA(h))v=mA(u),d=g[2](d),f=p[2](f);else{if(!g[1]||!p[1]||yA(u)!==yA(h)){var y=vA(t,e);A=[y[0]],s=[y[1]],a=[["matrix",[y[2]]]];break}v=yA(u),d=g[1](d),f=p[1](f)}for(var w=[],b=[],B=[],E=0;E<d.length;E++){var x=Uo(d[E],f[E],n,!1,E);w[E]=x[0],b[E]=x[1],B.push(x[2])}A.push(w),s.push(b),a.push([v,B])}}if(r){var C=A;A=s,s=C}return[A,s,function(t){return t.map(function(t,e){var n=t.map(function(t,n){return a[e][1][n](t)}).join(",");return"matrix"===a[e][0]&&16===n.split(",").length&&(a[e][0]="matrix3d"),"matrix3d"===a[e][0]&&6===n.split(",").length&&(a[e][0]="matrix"),"".concat(a[e][0],"(").concat(n,")")}).join(" ")}]}var BA=Pi(function(t){if(Jt(t)){if("text-anchor"===t)return[ao(0,"px"),ao(0,"px")];var e=t.split(" ");return 1===e.length&&("top"===e[0]||"bottom"===e[0]?(e[1]=e[0],e[0]="center"):e[1]="center"),2!==e.length?null:[ko(EA(e[0])),ko(EA(e[1]))]}return[ao(t[0]||0,"px"),ao(t[1]||0,"px")]});function EA(t){return"center"===t?"50%":"left"===t||"top"===t?"0%":"right"===t||"bottom"===t?"100%":t}var xA=[{n:"display",k:["none"]},{n:"opacity",int:!0,inh:!0,d:"1",syntax:ri.OPACITY_VALUE},{n:"fillOpacity",int:!0,inh:!0,d:"1",syntax:ri.OPACITY_VALUE},{n:"strokeOpacity",int:!0,inh:!0,d:"1",syntax:ri.OPACITY_VALUE},{n:"fill",int:!0,k:["none"],d:"none",syntax:ri.PAINT},{n:"fillRule",k:["nonzero","evenodd"],d:"nonzero"},{n:"stroke",int:!0,k:["none"],d:"none",syntax:ri.PAINT,l:!0},{n:"shadowType",k:["inner","outer","both"],d:"outer",l:!0},{n:"shadowColor",int:!0,syntax:ri.COLOR},{n:"shadowOffsetX",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"shadowOffsetY",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"shadowBlur",int:!0,l:!0,d:"0",syntax:ri.SHADOW_BLUR},{n:"lineWidth",int:!0,inh:!0,d:"1",l:!0,a:["strokeWidth"],syntax:ri.LENGTH_PERCENTAGE},{n:"increasedLineWidthForHitTesting",inh:!0,d:"0",l:!0,syntax:ri.LENGTH_PERCENTAGE},{n:"lineJoin",inh:!0,l:!0,a:["strokeLinejoin"],k:["miter","bevel","round"],d:"miter"},{n:"lineCap",inh:!0,l:!0,a:["strokeLinecap"],k:["butt","round","square"],d:"butt"},{n:"lineDash",int:!0,inh:!0,k:["none"],a:["strokeDasharray"],syntax:ri.LENGTH_PERCENTAGE_12},{n:"lineDashOffset",int:!0,inh:!0,d:"0",a:["strokeDashoffset"],syntax:ri.LENGTH_PERCENTAGE},{n:"offsetPath",syntax:ri.DEFINED_PATH},{n:"offsetDistance",int:!0,syntax:ri.OFFSET_DISTANCE},{n:"dx",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"dy",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"zIndex",ind:!0,int:!0,d:"0",k:["auto"],syntax:ri.Z_INDEX},{n:"visibility",k:["visible","hidden"],ind:!0,inh:!0,int:!0,d:"visible"},{n:"pointerEvents",inh:!0,k:["none","auto","stroke","fill","painted","visible","visiblestroke","visiblefill","visiblepainted","all"],d:"auto"},{n:"filter",ind:!0,l:!0,k:["none"],d:"none",syntax:ri.FILTER},{n:"clipPath",syntax:ri.DEFINED_PATH},{n:"textPath",syntax:ri.DEFINED_PATH},{n:"textPathSide",k:["left","right"],d:"left"},{n:"textPathStartOffset",l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"transform",p:100,int:!0,k:["none"],d:"none",syntax:ri.TRANSFORM},{n:"transformOrigin",p:100,d:"0 0",l:!0,syntax:ri.TRANSFORM_ORIGIN},{n:"cx",int:!0,l:!0,d:"0",syntax:ri.COORDINATE},{n:"cy",int:!0,l:!0,d:"0",syntax:ri.COORDINATE},{n:"cz",int:!0,l:!0,d:"0",syntax:ri.COORDINATE},{n:"r",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"rx",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"ry",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"x",int:!0,l:!0,d:"0",syntax:ri.COORDINATE},{n:"y",int:!0,l:!0,d:"0",syntax:ri.COORDINATE},{n:"z",int:!0,l:!0,d:"0",syntax:ri.COORDINATE},{n:"width",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"height",int:!0,l:!0,k:["auto","fit-content","min-content","max-content"],d:"0",syntax:ri.LENGTH_PERCENTAGE},{n:"radius",int:!0,l:!0,d:"0",syntax:ri.LENGTH_PERCENTAGE_14},{n:"x1",int:!0,l:!0,syntax:ri.COORDINATE},{n:"y1",int:!0,l:!0,syntax:ri.COORDINATE},{n:"z1",int:!0,l:!0,syntax:ri.COORDINATE},{n:"x2",int:!0,l:!0,syntax:ri.COORDINATE},{n:"y2",int:!0,l:!0,syntax:ri.COORDINATE},{n:"z2",int:!0,l:!0,syntax:ri.COORDINATE},{n:"d",int:!0,l:!0,d:"",syntax:ri.PATH,p:50},{n:"points",int:!0,l:!0,syntax:ri.LIST_OF_POINTS,p:50},{n:"text",l:!0,d:"",syntax:ri.TEXT,p:50},{n:"textTransform",l:!0,inh:!0,k:["capitalize","uppercase","lowercase","none"],d:"none",syntax:ri.TEXT_TRANSFORM,p:51},{n:"font",l:!0},{n:"fontSize",int:!0,inh:!0,d:"16px",l:!0,syntax:ri.LENGTH_PERCENTAGE},{n:"fontFamily",l:!0,inh:!0,d:"sans-serif"},{n:"fontStyle",l:!0,inh:!0,k:["normal","italic","oblique"],d:"normal"},{n:"fontWeight",l:!0,inh:!0,k:["normal","bold","bolder","lighter"],d:"normal"},{n:"fontVariant",l:!0,inh:!0,k:["normal","small-caps"],d:"normal"},{n:"lineHeight",l:!0,syntax:ri.LENGTH,int:!0,d:"0"},{n:"letterSpacing",l:!0,syntax:ri.LENGTH,int:!0,d:"0"},{n:"miterLimit",l:!0,syntax:ri.NUMBER,d:function(t){return t===cr.PATH||t===cr.POLYGON||t===cr.POLYLINE?"4":"10"}},{n:"wordWrap",l:!0},{n:"wordWrapWidth",l:!0},{n:"maxLines",l:!0},{n:"textOverflow",l:!0,d:"clip"},{n:"leading",l:!0},{n:"textBaseline",l:!0,inh:!0,k:["top","hanging","middle","alphabetic","ideographic","bottom"],d:"alphabetic"},{n:"textAlign",l:!0,inh:!0,k:["start","center","middle","end","left","right"],d:"start"},{n:"markerStart",syntax:ri.MARKER},{n:"markerEnd",syntax:ri.MARKER},{n:"markerMid",syntax:ri.MARKER},{n:"markerStartOffset",syntax:ri.LENGTH,l:!0,int:!0,d:"0"},{n:"markerEndOffset",syntax:ri.LENGTH,l:!0,int:!0,d:"0"}],CA=new Set(xA.filter(function(t){return!!t.l}).map(function(t){return t.n})),MA={},FA=function(){return a(function t(e){var n=this;A(this,t),this.runtime=e,xA.forEach(function(t){n.registerMetadata(t)})},[{key:"registerMetadata",value:function(t){[t.n].concat(u(t.a||[])).forEach(function(e){MA[e]=t})}},{key:"getPropertySyntax",value:function(t){return this.runtime.CSSPropertySyntaxFactory[t]}},{key:"processProperties",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{forceUpdateGeometry:!1};Object.assign(t.attributes,e);var r=t.parsedStyle.clipPath,i=t.parsedStyle.offsetPath;!function(t,e){var n=kA(t);for(var r in e)n.has(r)&&(t.parsedStyle[r]=e[r])}(t,e);var A=!!n.forceUpdateGeometry;if(!A)for(var s in e)if(CA.has(s)){A=!0;break}var a,c,l=kA(t);l.has("fill")&&e.fill&&(t.parsedStyle.fill=Bo(e.fill)),l.has("stroke")&&e.stroke&&(t.parsedStyle.stroke=Bo(e.stroke)),l.has("shadowColor")&&e.shadowColor&&(t.parsedStyle.shadowColor=Bo(e.shadowColor)),l.has("filter")&&e.filter&&(t.parsedStyle.filter=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if("none"===(t=t.toLowerCase().trim()))return[];for(var e,n=/\s*([\w-]+)\(([^)]*)\)/g,r=[],i=0;e=n.exec(t);){if(e.index!==i)return[];if(i=e.index+e[0].length,Io.indexOf(e[1])>-1&&r.push({name:e[1],params:e[2].split(" ").map(function(t){return xo(/deg|rad|grad|turn|px|%/g,t)||Bo(t)})}),n.lastIndex===t.length)return r}return[]}(e.filter)),l.has("radius")&&!Kt(e.radius)&&(t.parsedStyle.radius=To(e.radius,4)),l.has("lineDash")&&!Kt(e.lineDash)&&(t.parsedStyle.lineDash=To(e.lineDash,"even")),l.has("points")&&e.points&&(t.parsedStyle.points=(a=e.points,c=Jt(a)?a.split(" ").map(function(t){var e=m(t.split(","),2),n=e[0],r=e[1];return[Number(n),Number(r)]}):a,{points:c,totalLength:0,segments:[]})),l.has("d")&&""===e.d&&(t.parsedStyle.d=o({},ni)),l.has("d")&&e.d&&(t.parsedStyle.d=eA(e.d)),l.has("textTransform")&&e.textTransform&&this.runtime.CSSPropertySyntaxFactory[ri.TEXT_TRANSFORM].calculator(null,null,{value:e.textTransform},t,null),l.has("clipPath")&&!de(e.clipPath)&&this.runtime.CSSPropertySyntaxFactory[ri.DEFINED_PATH].calculator("clipPath",r,e.clipPath,t,this.runtime),l.has("offsetPath")&&e.offsetPath&&this.runtime.CSSPropertySyntaxFactory[ri.DEFINED_PATH].calculator("offsetPath",i,e.offsetPath,t,this.runtime),l.has("transform")&&e.transform&&(t.parsedStyle.transform=lA(e.transform)),l.has("transformOrigin")&&e.transformOrigin&&(t.parsedStyle.transformOrigin=BA(e.transformOrigin)),l.has("markerStart")&&e.markerStart&&(t.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[ri.MARKER].calculator(null,e.markerStart,e.markerStart,null,null)),l.has("markerEnd")&&e.markerEnd&&(t.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[ri.MARKER].calculator(null,e.markerEnd,e.markerEnd,null,null)),l.has("markerMid")&&e.markerMid&&(t.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[ri.MARKER].calculator("",e.markerMid,e.markerMid,null,null)),l.has("zIndex")&&!Kt(e.zIndex)&&this.runtime.CSSPropertySyntaxFactory[ri.Z_INDEX].postProcessor(t),l.has("offsetDistance")&&!Kt(e.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[ri.OFFSET_DISTANCE].postProcessor(t),l.has("transform")&&e.transform&&this.runtime.CSSPropertySyntaxFactory[ri.TRANSFORM].postProcessor(t),l.has("transformOrigin")&&e.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[ri.TRANSFORM_ORIGIN].postProcessor(t),A&&(t.dirty(!0,!0),n.forceUpdateGeometry||this.runtime.sceneGraphService.dirtyToRoot(t))}},{key:"updateGeometry",value:function(t){var e=t.nodeName,n=this.runtime.geometryUpdaterFactory[e];if(n){var r=t.geometry;r.contentBounds||(r.contentBounds=new yr),r.renderBounds||(r.renderBounds=new yr);var i=t.parsedStyle,o=n.update(i,t),A=o.cx,s=void 0===A?0:A,a=o.cy,c=void 0===a?0:a,l=o.cz,u=void 0===l?0:l,h=o.hwidth,d=void 0===h?0:h,f=o.hheight,g=void 0===f?0:f,p=o.hdepth,v=void 0===p?0:p,m=[Math.abs(d),Math.abs(g),v],y=i.stroke,w=i.lineWidth,b=void 0===w?1:w,B=i.increasedLineWidthForHitTesting,E=void 0===B?0:B,x=i.shadowType,C=void 0===x?"outer":x,M=i.shadowColor,F=i.filter,k=void 0===F?[]:F,S=i.transformOrigin,Q=[s,c,u];r.contentBounds.update(Q,m);var U=e===cr.POLYLINE||e===cr.POLYGON||e===cr.PATH?Math.SQRT2:.5;if(y&&!y.isNone){var N=((b||0)+(E||0))*U;m[0]+=N,m[1]+=N}if(r.renderBounds.update(Q,m),M&&C&&"inner"!==C){var T=r.renderBounds,O=T.min,I=T.max,L=i.shadowBlur||0,P=i.shadowOffsetX||0,D=i.shadowOffsetY||0,R=O[0]-L+P,H=I[0]+L+P,_=O[1]-L+D,G=I[1]+L+D;O[0]=Math.min(O[0],R),I[0]=Math.max(I[0],H),O[1]=Math.min(O[1],_),I[1]=Math.max(I[1],G),r.renderBounds.setMinMax(O,I)}k.forEach(function(t){var e=t.name,n=t.params;if("blur"===e){var i=n[0].value;r.renderBounds.update(r.renderBounds.center,ft(r.renderBounds.halfExtents,r.renderBounds.halfExtents,[i,i,0]))}else if("drop-shadow"===e){var o=n[0].value,A=n[1].value,s=n[2].value,a=r.renderBounds,c=a.min,l=a.max,u=c[0]-s+o,h=l[0]+s+o,d=c[1]-s+A,f=l[1]+s+A;c[0]=Math.min(c[0],u),l[0]=Math.max(l[0],h),c[1]=Math.min(c[1],d),l[1]=Math.max(l[1],f),r.renderBounds.setMinMax(c,l)}}),t.geometry.dirty=!1;var K=g<0,j=(d<0?-1:1)*(S?Oo(S[0],0,t,!0):0),z=(K?-1:1)*(S?Oo(S[1],1,t,!0):0);(j||z)&&t.setOrigin(j,z)}}},{key:"updateSizeAttenuation",value:function(t,e){t.style.isSizeAttenuation?(t.style.rawLineWidth||(t.style.rawLineWidth=t.style.lineWidth),t.style.lineWidth=(t.style.rawLineWidth||1)/e,t.nodeName===cr.CIRCLE&&(t.style.rawR||(t.style.rawR=t.style.r),t.style.r=(t.style.rawR||1)/e)):(t.style.rawLineWidth&&(t.style.lineWidth=t.style.rawLineWidth,delete t.style.rawLineWidth),t.nodeName===cr.CIRCLE&&t.style.rawR&&(t.style.r=t.style.rawR,delete t.style.rawR))}}])}();function kA(t){return t.constructor.PARSED_STYLE_LIST}var SA=function(){return a(function t(){A(this,t),this.mixer=Ro},[{key:"calculator",value:function(t,e,n,r){return No(n)}}])}(),QA=function(){return a(function t(){A(this,t)},[{key:"calculator",value:function(t,e,n,r,i){return n instanceof $i&&(n=null),i.sceneGraphService.updateDisplayObjectDependency(t,e,n,r),"clipPath"===t&&r.forEach(function(t){0===t.childNodes.length&&i.sceneGraphService.dirtyToRoot(t)}),n}}])}(),UA=function(){return a(function t(){A(this,t),this.parser=Bo,this.mixer=Eo},[{key:"calculator",value:function(t,e,n,r){return n instanceof $i?"none"===n.value?oo:Ao:n}}])}(),NA=function(){return a(function t(){A(this,t)},[{key:"calculator",value:function(t,e,n){return n instanceof $i?[]:n}}])}();function TA(t){var e=t.parsedStyle.fontSize;return Kt(e)?null:e}var OA=function(){return a(function t(){A(this,t),this.mixer=Ro},[{key:"calculator",value:function(t,e,n,r,i){if(re(n))return n;if(!Ji.isRelativeUnit(n.unit))return n.value;if(n.unit===Di.kPercentage)return 0;if(n.unit===Di.kEms){if(r.parentNode){var o=TA(r.parentNode);if(o)return o*=n.value}return 0}if(n.unit===Di.kRems){var A;if(null!=r&&null!==(A=r.ownerDocument)&&void 0!==A&&A.documentElement){var s=TA(r.ownerDocument.documentElement);if(s)return s*=n.value}return 0}}}])}(),IA=function(){return a(function t(){A(this,t),this.mixer=_o},[{key:"calculator",value:function(t,e,n){return n.map(function(t){return t.value})}}])}(),LA=function(){return a(function t(){A(this,t),this.mixer=_o},[{key:"calculator",value:function(t,e,n){return n.map(function(t){return t.value})}}])}(),PA=function(){return a(function t(){A(this,t)},[{key:"calculator",value:function(t,e,n,r){var i;n instanceof $i&&(n=null);var o=null===(i=n)||void 0===i?void 0:i.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),DA=function(){return a(function t(){A(this,t),this.mixer=Ro},[{key:"calculator",value:function(t,e,n){return n.value}}])}(),RA=function(){return a(function t(){A(this,t),this.mixer=Ho(0,1)},[{key:"calculator",value:function(t,e,n){return n.value}},{key:"postProcessor",value:function(t){var e=t.parsedStyle,n=e.offsetPath,r=e.offsetDistance;if(n){var i=n.nodeName;if(i===cr.LINE||i===cr.PATH||i===cr.POLYLINE){var o=n.getPoint(r);o&&t.setLocalPosition(o.x,o.y)}}}}])}(),HA=function(){return a(function t(){A(this,t),this.mixer=Ho(0,1)},[{key:"calculator",value:function(t,e,n){return n.value}}])}(),_A=function(){return a(function t(){A(this,t),this.parser=eA,this.mixer=nA},[{key:"calculator",value:function(t,e,n){return n instanceof $i&&"unset"===n.value?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new xr(0,0,0,0)}:n}}])}(),GA=a(function t(){A(this,t),this.mixer=rA}),KA=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).mixer=Ho(0,1/0),t}return v(e,t),a(e)}(OA),jA=function(){return a(function t(){A(this,t)},[{key:"calculator",value:function(t,e,n,r){return n instanceof $i?"unset"===n.value?"":n.value:"".concat(n)}},{key:"postProcessor",value:function(t){t.nodeValue="".concat(t.parsedStyle.text)||""}}])}(),zA=function(){return a(function t(){A(this,t)},[{key:"calculator",value:function(t,e,n,r){var i=r.getAttribute("text");if(i){var o=i;"capitalize"===n.value?o=i.charAt(0).toUpperCase()+i.slice(1):"lowercase"===n.value?o=i.toLowerCase():"uppercase"===n.value&&(o=i.toUpperCase()),r.parsedStyle.text=o}return n.value}}])}(),VA=new WeakMap;var WA="undefined"!=typeof window&&void 0!==window.document;function YA(t){return!!t.getAttribute}function XA(t,e){var n=Number(t.parsedStyle.zIndex||0),r=Number(e.parsedStyle.zIndex||0);if(n===r){var i=t.parentNode;if(i){var o=i.childNodes||[];return o.indexOf(t)-o.indexOf(e)}}return n-r}function qA(t){var e=t;do{var n;if(null===(n=e.parsedStyle)||void 0===n?void 0:n.clipPath)return e;e=e.parentElement}while(null!==e);return null}function $A(t,e){if(WA)return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)}var ZA={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},JA="object"==typeof performance&&performance.now?performance:Date;function ts(t){return t.nodeName===cr.FRAGMENT||t.getRootNode().nodeName===cr.FRAGMENT}function es(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"auto",e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=!1,i=!1,o=!!e&&!e.isNone,A=!!n&&!n.isNone;return"visiblepainted"===t||"painted"===t||"auto"===t?(r=o,i=A):"visiblefill"===t||"fill"===t?r=!0:"visiblestroke"===t||"stroke"===t?i=!0:"visible"!==t&&"all"!==t||(r=!0,i=!0),[r,i]}var ns=1,rs="object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:{},is=Date.now(),os={},As=Date.now(),ss=function(t){if("function"!=typeof t)throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-As,r=n>16?0:16-n,i=ns++;return os[i]=t,Object.keys(os).length>1||setTimeout(function(){As=e;var t=os;os={},Object.keys(t).forEach(function(e){return t[e](rs.performance&&"function"==typeof rs.performance.now?rs.performance.now():Date.now()-is)})},r),i},as=function(t){delete os[t]},cs=function(t){return"string"!=typeof t?ss:""===t?rs.requestAnimationFrame:rs["".concat(t,"RequestAnimationFrame")]},ls=function(t,e){for(var n=0;void 0!==t[n];){if(e(t[n]))return t[n];n+=1}}(["","webkit","moz","ms","o"],function(t){return!!cs(t)}),us=cs(ls),hs=function(t){return"string"!=typeof t?as:""===t?rs.cancelAnimationFrame:rs["".concat(t,"CancelAnimationFrame")]||rs["".concat(t,"CancelRequestAnimationFrame")]}(ls);rs.requestAnimationFrame=us,rs.cancelAnimationFrame=hs;var ds=function(){return a(function t(){A(this,t),this.callbacks=[]},[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(t,e){this.callbacks.push(e)}},{key:"promise",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return Promise.all(this.callbacks.map(function(t){return t.apply(void 0,e)}))}}])}(),fs=function(){return a(function t(){A(this,t),this.callbacks=[]},[{key:"tapPromise",value:function(t,e){this.callbacks.push(e)}},{key:"promise",value:(t=Ar(ir().mark(function t(){var e,n,r,i,o=arguments;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.callbacks.length){t.next=6;break}return t.next=1,(e=this.callbacks)[0].apply(e,o);case 1:n=t.sent,r=1;case 2:if(!(r<this.callbacks.length)){t.next=5;break}return i=this.callbacks[r],t.next=3,i(n);case 3:n=t.sent;case 4:r++,t.next=2;break;case 5:return t.abrupt("return",n);case 6:return t.abrupt("return",null);case 7:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})}]);var t}(),gs=function(){return a(function t(){A(this,t),this.callbacks=[]},[{key:"tap",value:function(t,e){this.callbacks.push(e)}},{key:"call",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];var r=arguments;this.callbacks.forEach(function(t){t.apply(void 0,r)})}}])}(),ps=function(){return a(function t(){A(this,t),this.callbacks=[]},[{key:"tap",value:function(t,e){this.callbacks.push(e)}},{key:"call",value:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(this.callbacks.length){for(var r=arguments,i=this.callbacks[0].apply(void 0,r),o=1;o<this.callbacks.length;o++){i=(0,this.callbacks[o])(i)}return i}return null}}])}(),vs=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],ms=/([\"\'])[^\'\"]+\1/;function ys(t){var e=t.fontSize,n=void 0===e?16:e,r=t.fontFamily,i=void 0===r?"sans-serif":r,o=t.fontStyle,A=void 0===o?"normal":o,s=t.fontVariant,a=void 0===s?"normal":s,c=t.fontWeight;return{fontSize:n,fontFamily:i,fontStyle:A,fontVariant:a,fontWeight:void 0===c?"normal":c}}var ws=Pi(function(t){for(var e=ys(t),n=e.fontSize,r=e.fontFamily,i=e.fontStyle,o=e.fontVariant,A=e.fontWeight,s=re(n)&&"".concat(n,"px")||"16px",a=r.split(","),c=a.length-1;c>=0;c--){var l=a[c].trim();!ms.test(l)&&vs.indexOf(l)<0&&(l='"'.concat(l,'"')),a[c]=l}return"".concat(i," ").concat(o," ").concat(A," ").concat(s," ").concat(a.join(","))},function(t){var e=ys(t),n=e.fontSize,r=e.fontFamily,i=e.fontStyle,o=e.fontVariant,A=e.fontWeight;return"".concat(i,"_").concat(o,"_").concat(A,"_").concat(n,"_").concat(r)}),bs=function(t){return Math.max(t,1e-6)};function Bs(t,e,n){return Q(t),t[4]=Math.tan(e),t[1]=Math.tan(n),t}var Es=C(),xs=C(),Cs={scale:function(t){H(Es,[t[0].value,t[1].value,1].map(function(t){return bs(t)}))},scaleX:function(t){H(Es,[t[0].value,1,1].map(function(t){return bs(t)}))},scaleY:function(t){H(Es,[1,t[0].value,1].map(function(t){return bs(t)}))},scaleZ:function(t){H(Es,[1,1,t[0].value].map(function(t){return bs(t)}))},scale3d:function(t){H(Es,[t[0].value,t[1].value,t[2].value].map(function(t){return bs(t)}))},translate:function(t){R(Es,[t[0].value,t[1].value,0])},translateX:function(t){R(Es,[t[0].value,0,0])},translateY:function(t){R(Es,[0,t[0].value,0])},translateZ:function(t){R(Es,[0,0,t[0].value])},translate3d:function(t){R(Es,[t[0].value,t[1].value,t[2].value])},rotate:function(t){j(Es,Ur(No(t[0])))},rotateX:function(t){G(Es,Ur(No(t[0])))},rotateY:function(t){K(Es,Ur(No(t[0])))},rotateZ:function(t){j(Es,Ur(No(t[0])))},rotate3d:function(t){_(Es,Ur(No(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Bs(Es,Ur(t[0].value),Ur(t[1].value))},skewX:function(t){Bs(Es,Ur(t[0].value),0)},skewY:function(t){Bs(Es,0,Ur(t[0].value))},matrix:function(t){S(Es,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){S.apply(st,[Es].concat(u(t.map(function(t){return t.value}))))}},Ms=ut(1,1,1),Fs=at(),ks={translate:function(t,e){Ua.sceneGraphService.setLocalScale(t,Ms,!1),Ua.sceneGraphService.setLocalEulerAngles(t,Fs,void 0,void 0,!1),Ua.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),Ua.sceneGraphService.dirtyLocalTransform(t,t.transformable)}};function Ss(t,e){if(t.length){if(1===t.length&&ks[t[0].t])return void ks[t[0].t](e,t[0].d);for(var n=Q(xs),r=0;r<t.length;r++){var i=t[r],o=i.t,A=i.d,s=Cs[o];s&&(s(A),ot(n,n,Es))}e.setLocalTransform(n)}else e.resetLocalTransform();return e.getLocalTransform()}var Qs=function(){return a(function t(){A(this,t),this.parser=uA,this.mixer=bA},[{key:"calculator",value:function(t,e,n,r){return n instanceof $i?[]:n}},{key:"postProcessor",value:function(t){Ss(t.parsedStyle.transform,t)}}])}(),Us=function(){return a(function t(){A(this,t)},[{key:"postProcessor",value:function(t){var e=t.parsedStyle.transformOrigin;e[0].unit===Di.kPixels&&e[1].unit===Di.kPixels?t.setOrigin(e[0].value,e[1].value):t.getGeometryBounds()}}])}(),Ns=function(){return a(function t(){A(this,t)},[{key:"calculator",value:function(t,e,n,r){return n.value}},{key:"postProcessor",value:function(t){if(t.parentNode){var e=t.parentNode,n=e.renderable,r=e.sortable;n&&e.dirty(),r&&(r.dirty=!0,r.dirtyReason=$r.Z_INDEX_CHANGED)}}}])}(),Ts=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t,e){var n=t.cx,r=void 0===n?0:n,i=t.cy,o=void 0===i?0:i,A=t.r,s=void 0===A?0:A;return{cx:r,cy:o,hwidth:s,hheight:s}}}])}(),Os=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t,e){var n=t.cx,r=void 0===n?0:n,i=t.cy,o=void 0===i?0:i,A=t.rx,s=void 0===A?0:A,a=t.ry;return{cx:r,cy:o,hwidth:s,hheight:void 0===a?0:a}}}])}(),Is=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t){var e=t.x1,n=t.y1,r=t.x2,i=t.y2,o=Math.min(e,r),A=Math.max(e,r),s=Math.min(n,i),a=(A-o)/2,c=(Math.max(n,i)-s)/2;return{cx:o+a,cy:s+c,hwidth:a,hheight:c}}}])}(),Ls=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t){var e=t.d.rect,n=e.x,r=e.y,i=e.width/2,o=e.height/2;return{cx:n+i,cy:r+o,hwidth:i,hheight:o}}}])}(),Ps=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t){if(t.points&&jt(t.points.points)){var e=t.points.points,n=Math.min.apply(Math,u(e.map(function(t){return t[0]}))),r=Math.max.apply(Math,u(e.map(function(t){return t[0]}))),i=Math.min.apply(Math,u(e.map(function(t){return t[1]}))),o=Math.max.apply(Math,u(e.map(function(t){return t[1]}))),A=(r-n)/2,s=(o-i)/2;return{cx:n+A,cy:i+s,hwidth:A,hheight:s}}return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),Ds=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i,A=t.src,s=t.width,a=void 0===s?0:s,c=t.height,l=a,u=void 0===c?0:c;return A&&!Jt(A)&&(l||(l=A.width,t.width=l),u||(u=A.height,t.height=u)),{cx:r+l/2,cy:o+u/2,hwidth:l/2,hheight:u/2}}}])}(),Rs=function(){return a(function t(e){A(this,t),this.globalRuntime=e},[{key:"isReadyToMeasure",value:function(t,e){return t.text}},{key:"update",value:function(t,e){var n,r=t.text,i=t.textAlign,o=void 0===i?"start":i,A=t.lineWidth,s=void 0===A?1:A,a=t.textBaseline,c=void 0===a?"alphabetic":a,l=t.dx,u=void 0===l?0:l,h=t.dy,d=void 0===h?0:h,f=t.x,g=void 0===f?0:f,p=t.y,v=void 0===p?0:p;if(!this.isReadyToMeasure(t,e))return t.metrics={font:"",width:0,height:0,lines:[],lineWidths:[],lineHeight:0,maxLineWidth:0,fontProperties:{ascent:0,descent:0,fontSize:0},lineMetrics:[]},{hwidth:0,hheight:0,cx:0,cy:0};var m=((null==e||null===(n=e.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n?void 0:n.getConfig())||{}).offscreenCanvas,y=this.globalRuntime.textService.measureText(r,t,m);t.metrics=y;var w=y.width/2,b=y.height/2,B=g+w;"center"===o||"middle"===o?B+=s/2-w:"right"!==o&&"end"!==o||(B+=s-2*w);var E=v-b;return"middle"===c?E+=b:"top"===c||"hanging"===c?E+=2*b:"alphabetic"===c||"bottom"!==c&&"ideographic"!==c||(E+=0),u&&(B+=u),d&&(E+=d),{cx:B,cy:E,hwidth:w,hheight:b}}}])}(),Hs=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t,e){return{cx:0,cy:0,hwidth:0,hheight:0}}}])}(),_s=function(){return a(function t(){A(this,t)},[{key:"update",value:function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i,A=t.width,s=void 0===A?0:A,a=t.height,c=void 0===a?0:a;return{cx:r+s/2,cy:o+c/2,hwidth:s/2,hheight:c/2}}}])}(),Gs=function(){return a(function t(e){A(this,t),this.eventPhase=t.prototype.NONE,this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.defaultPrevented=!1,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new Er,this.page=new Er,this.canvas=new Er,this.viewport=new Er,this.composed=!1,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=e},[{key:"name",get:function(){return this.type}},{key:"layerX",get:function(){return this.layer.x}},{key:"layerY",get:function(){return this.layer.y}},{key:"pageX",get:function(){return this.page.x}},{key:"pageY",get:function(){return this.page.y}},{key:"x",get:function(){return this.canvas.x}},{key:"y",get:function(){return this.canvas.y}},{key:"canvasX",get:function(){return this.canvas.x}},{key:"canvasY",get:function(){return this.canvas.y}},{key:"viewportX",get:function(){return this.viewport.x}},{key:"viewportY",get:function(){return this.viewport.y}},{key:"composedPath",value:function(){return!this.manager||this.path&&this.path[0]===this.target||(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}},{key:"propagationPath",get:function(){return this.composedPath()}},{key:"preventDefault",value:function(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}},{key:"stopImmediatePropagation",value:function(){this.propagationImmediatelyStopped=!0}},{key:"stopPropagation",value:function(){this.propagationStopped=!0}},{key:"initEvent",value:function(){}},{key:"initUIEvent",value:function(){}},{key:"clone",value:function(){throw new Error(Cr)}}])}(),Ks=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).client=new Er,t.movement=new Er,t.offset=new Er,t.global=new Er,t.screen=new Er,t}return v(e,t),a(e,[{key:"clientX",get:function(){return this.client.x}},{key:"clientY",get:function(){return this.client.y}},{key:"movementX",get:function(){return this.movement.x}},{key:"movementY",get:function(){return this.movement.y}},{key:"offsetX",get:function(){return this.offset.x}},{key:"offsetY",get:function(){return this.offset.y}},{key:"globalX",get:function(){return this.global.x}},{key:"globalY",get:function(){return this.global.y}},{key:"screenX",get:function(){return this.screen.x}},{key:"screenY",get:function(){return this.screen.y}},{key:"getModifierState",value:function(t){return"getModifierState"in this.nativeEvent&&this.nativeEvent.getModifierState(t)}},{key:"initMouseEvent",value:function(){throw new Error(Cr)}}])}(Gs),js=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).width=0,t.height=0,t.isPrimary=!1,t}return v(e,t),a(e,[{key:"getCoalescedEvents",value:function(){return"pointermove"===this.type||"mousemove"===this.type||"touchmove"===this.type?[this]:[]}},{key:"getPredictedEvents",value:function(){throw new Error("getPredictedEvents is not supported!")}},{key:"clone",value:function(){return this.manager.clonePointerEvent(this)}}])}(Ks),zs=function(t){function e(){return A(this,e),g(this,e,arguments)}return v(e,t),a(e,[{key:"clone",value:function(){return this.manager.cloneWheelEvent(this)}}])}(Ks),Vs=function(t){function e(t,n){var r;return A(this,e),(r=g(this,e,[null])).type=t,r.detail=null==n?void 0:n.detail,n&&!("detail"in n)&&(r.detail=n),Object.assign(r,n),r}return v(e,t),a(e)}(Gs),Ws=function(){return a(function t(){A(this,t),this.emitter=new b},[{key:"on",value:function(t,e,n){return this.addEventListener(t,e,n),this}},{key:"addEventListener",value:function(t,e,n){var r=!1,i=!1;if(ue(n))r=n;else if(n){var o=n.capture;r=void 0!==o&&o;var A=n.once;i=void 0!==A&&A}r&&(t+="capture"),e=Gt(e)?e:e.handleEvent;var s=Gt(e)?void 0:e;return i?this.emitter.once(t,e,s):this.emitter.on(t,e,s),this}},{key:"off",value:function(t,e,n){return t?this.removeEventListener(t,e,n):this.removeAllEventListeners(),this}},{key:"removeAllEventListeners",value:function(){var t;null===(t=this.emitter)||void 0===t||t.removeAllListeners()}},{key:"removeEventListener",value:function(t,e,n){var r;if(!this.emitter)return this;(ue(n)?n:null==n?void 0:n.capture)&&(t+="capture"),e=Gt(e)?e:null===(r=e)||void 0===r?void 0:r.handleEvent;var i=Gt(e)?void 0:e;return this.emitter.off(t,e,i),this}},{key:"emit",value:function(t,e){this.dispatchEvent(new Vs(t,e))}},{key:"dispatchEventToSelf",value:function(t){t.target||(t.target=this),t.currentTarget=this,this.emitter.emit(t.type,t)}},{key:"dispatchEvent",value:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(arguments.length>2?arguments[2]:void 0)return this.dispatchEventToSelf(t),!0;if(this.document)e=this;else if(this.defaultView)e=this.defaultView;else{var r;e=null===(r=this.ownerDocument)||void 0===r?void 0:r.defaultView}if(e){if(t.manager=e.getEventService(),!t.manager)return!1;t.defaultPrevented=!1,t.path?t.path.length=0:t.page=[],n||(t.target=this),t.manager.dispatchEvent(t,t.type,n)}else this.dispatchEventToSelf(t);return!t.defaultPrevented}}])}(),Ys=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).shadow=!1,t.ownerDocument=null,t.isConnected=!1,t.baseURI="",t.childNodes=[],t.nodeType=0,t.nodeName="",t.nodeValue=null,t.mutations=void 0,t.parentNode=null,t.destroyed=!1,t}return v(e,t),a(e,[{key:"textContent",get:function(){var t="";this.nodeName===cr.TEXT&&(t+=this.style.text);var e,n=sr(this.childNodes);try{for(n.s();!(e=n.n()).done;){var r=e.value;r.nodeName===cr.TEXT?t+=r.nodeValue:t+=r.textContent}}catch(t){n.e(t)}finally{n.f()}return t},set:function(t){var e=this;this.childNodes.slice().forEach(function(t){e.removeChild(t)}),this.nodeName===cr.TEXT&&(this.style.text="".concat(t))}},{key:"getRootNode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(t):t.composed&&this.host?this.host.getRootNode(t):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(t){throw new Error(Cr)}},{key:"lookupNamespaceURI",value:function(t){throw new Error(Cr)}},{key:"lookupPrefix",value:function(t){throw new Error(Cr)}},{key:"normalize",value:function(){throw new Error(Cr)}},{key:"isEqualNode",value:function(t){return this===t}},{key:"isSameNode",value:function(t){return this.isEqualNode(t)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(t){if(t===this)return 0;for(var n=t,r=this,i=[n],o=[r];null!==(A=n.parentNode)&&void 0!==A?A:r.parentNode;){var A;n=n.parentNode?(i.push(n.parentNode),n.parentNode):n,r=r.parentNode?(o.push(r.parentNode),r.parentNode):r}if(n!==r)return e.DOCUMENT_POSITION_DISCONNECTED|e.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|e.DOCUMENT_POSITION_PRECEDING;var s=i.length>o.length?i:o,a=s===i?o:i;if(s[s.length-a.length]===a[0])return s===i?e.DOCUMENT_POSITION_CONTAINED_BY|e.DOCUMENT_POSITION_FOLLOWING:e.DOCUMENT_POSITION_CONTAINS|e.DOCUMENT_POSITION_PRECEDING;for(var c=s.length-a.length,l=a.length-1;l>=0;l--){var u=a[l],h=s[c+l];if(h!==u){var d=u.parentNode.childNodes;return d.indexOf(u)<d.indexOf(h)?a===i?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING:s===i?e.DOCUMENT_POSITION_PRECEDING:e.DOCUMENT_POSITION_FOLLOWING}}return e.DOCUMENT_POSITION_FOLLOWING}},{key:"contain",value:function(t){return this.contains(t)}},{key:"contains",value:function(t){for(var e=t;e&&this!==e;)e=e.parentNode;return!!e}},{key:"getAncestor",value:function(t){for(var e=this;t>0&&e;)e=e.parentNode,t--;return e}},{key:"forEach",value:function(t){for(var e=[this];e.length>0;){var n=e.pop();if(!1===t(n))break;for(var r=n.childNodes.length-1;r>=0;r--)e.push(n.childNodes[r])}}}],[{key:"isNode",value:function(t){return!!t.childNodes}}])}(Ws);Ys.DOCUMENT_POSITION_DISCONNECTED=1,Ys.DOCUMENT_POSITION_PRECEDING=2,Ys.DOCUMENT_POSITION_FOLLOWING=4,Ys.DOCUMENT_POSITION_CONTAINS=8,Ys.DOCUMENT_POSITION_CONTAINED_BY=16,Ys.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var Xs=function(){return a(function t(e,n){var r=this;A(this,t),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=C(),this.tmpVec3=at(),this.onPointerDown=function(t){var e=r.createPointerEvent(t);if(r.dispatchEvent(e,"pointerdown"),"touch"===e.pointerType)r.dispatchEvent(e,"touchstart");else if("mouse"===e.pointerType||"pen"===e.pointerType){var n=2===e.button;r.dispatchEvent(e,n?"rightdown":"mousedown")}r.trackingData(t.pointerId).pressTargetsByButton[t.button]=e.composedPath(),r.freeEvent(e)},this.onPointerUp=function(t){var e=JA.now(),n=r.createPointerEvent(t,void 0,void 0,r.context.config.alwaysTriggerPointerEventOnCanvas?r.rootTarget:void 0);if(r.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)r.dispatchEvent(n,"touchend");else if("mouse"===n.pointerType||"pen"===n.pointerType){var i=2===n.button;r.dispatchEvent(n,i?"rightup":"mouseup")}var o=r.trackingData(t.pointerId),A=r.findMountedTarget(o.pressTargetsByButton[t.button]),s=A;if(A&&!n.composedPath().includes(A)){for(var a=A;a&&!n.composedPath().includes(a);){if(n.currentTarget=a,r.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)r.notifyTarget(n,"touchendoutside");else if("mouse"===n.pointerType||"pen"===n.pointerType){var c=2===n.button;r.notifyTarget(n,c?"rightupoutside":"mouseupoutside")}Ys.isNode(a)&&(a=a.parentNode)}delete o.pressTargetsByButton[t.button],s=a}if(s){var l,u=r.clonePointerEvent(n,"click");u.target=s,u.path=[],o.clicksByButton[t.button]||(o.clicksByButton[t.button]={clickCount:0,target:u.target,timeStamp:e});var h=r.context.renderingContext.root.ownerDocument.defaultView,d=o.clicksByButton[t.button];d.target===u.target&&e-d.timeStamp<h.getConfig().dblClickSpeed?++d.clickCount:d.clickCount=1,d.target=u.target,d.timeStamp=e,u.detail=d.clickCount,null!==(l=n.detail)&&void 0!==l&&l.preventClick||(r.context.config.useNativeClickEvent||"mouse"!==u.pointerType&&"touch"!==u.pointerType||r.dispatchEvent(u,"click"),r.dispatchEvent(u,"pointertap")),r.freeEvent(u)}r.freeEvent(n)},this.onPointerMove=function(t){var e=r.createPointerEvent(t,void 0,void 0,r.context.config.alwaysTriggerPointerEventOnCanvas?r.rootTarget:void 0),n="mouse"===e.pointerType||"pen"===e.pointerType,i=r.trackingData(t.pointerId),o=r.findMountedTarget(i.overTargets);if(i.overTargets&&o!==e.target){var A="mousemove"===t.type?"mouseout":"pointerout",s=r.createPointerEvent(t,A,o||void 0);if(r.dispatchEvent(s,"pointerout"),n&&r.dispatchEvent(s,"mouseout"),!e.composedPath().includes(o)){var a=r.createPointerEvent(t,"pointerleave",o||void 0);for(a.eventPhase=a.AT_TARGET;a.target&&!e.composedPath().includes(a.target);)a.currentTarget=a.target,r.notifyTarget(a),n&&r.notifyTarget(a,"mouseleave"),Ys.isNode(a.target)&&(a.target=a.target.parentNode);r.freeEvent(a)}r.freeEvent(s)}if(o!==e.target){var c="mousemove"===t.type?"mouseover":"pointerover",l=r.clonePointerEvent(e,c);r.dispatchEvent(l,"pointerover"),n&&r.dispatchEvent(l,"mouseover");for(var u=o&&Ys.isNode(o)&&o.parentNode;u&&u!==(Ys.isNode(r.rootTarget)&&r.rootTarget.parentNode)&&u!==e.target;)u=u.parentNode;if(!u||u===(Ys.isNode(r.rootTarget)&&r.rootTarget.parentNode)){var h=r.clonePointerEvent(e,"pointerenter");for(h.eventPhase=h.AT_TARGET;h.target&&h.target!==o&&h.target!==(Ys.isNode(r.rootTarget)&&r.rootTarget.parentNode);)h.currentTarget=h.target,r.notifyTarget(h),n&&r.notifyTarget(h,"mouseenter"),Ys.isNode(h.target)&&(h.target=h.target.parentNode);r.freeEvent(h)}r.freeEvent(l)}r.dispatchEvent(e,"pointermove"),"touch"===e.pointerType&&r.dispatchEvent(e,"touchmove"),n&&(r.dispatchEvent(e,"mousemove"),r.cursor=r.getCursor(e.target)),i.overTargets=e.composedPath(),r.freeEvent(e)},this.onPointerOut=function(t){var e=r.trackingData(t.pointerId);if(e.overTargets){var n="mouse"===t.pointerType||"pen"===t.pointerType,i=r.findMountedTarget(e.overTargets),o=r.createPointerEvent(t,"pointerout",i||void 0);r.dispatchEvent(o),n&&r.dispatchEvent(o,"mouseout");var A=r.createPointerEvent(t,"pointerleave",i||void 0);for(A.eventPhase=A.AT_TARGET;A.target&&A.target!==(Ys.isNode(r.rootTarget)&&r.rootTarget.parentNode);)A.currentTarget=A.target,r.notifyTarget(A),n&&r.notifyTarget(A,"mouseleave"),Ys.isNode(A.target)&&(A.target=A.target.parentNode);e.overTargets=null,r.freeEvent(o),r.freeEvent(A)}r.cursor=null},this.onPointerOver=function(t){var e=r.trackingData(t.pointerId),n=r.createPointerEvent(t),i="mouse"===n.pointerType||"pen"===n.pointerType;r.dispatchEvent(n,"pointerover"),i&&r.dispatchEvent(n,"mouseover"),"mouse"===n.pointerType&&(r.cursor=r.getCursor(n.target));var o=r.clonePointerEvent(n,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==(Ys.isNode(r.rootTarget)&&r.rootTarget.parentNode);)o.currentTarget=o.target,r.notifyTarget(o),i&&r.notifyTarget(o,"mouseenter"),Ys.isNode(o.target)&&(o.target=o.target.parentNode);e.overTargets=n.composedPath(),r.freeEvent(n),r.freeEvent(o)},this.onPointerUpOutside=function(t){var e=r.trackingData(t.pointerId),n=r.findMountedTarget(e.pressTargetsByButton[t.button]),i=r.createPointerEvent(t);if(n){for(var o=n;o;)i.currentTarget=o,r.notifyTarget(i,"pointerupoutside"),"touch"===i.pointerType||"mouse"!==i.pointerType&&"pen"!==i.pointerType||r.notifyTarget(i,2===i.button?"rightupoutside":"mouseupoutside"),Ys.isNode(o)&&(o=o.parentNode);delete e.pressTargetsByButton[t.button]}r.freeEvent(i)},this.onWheel=function(t){var e=r.createWheelEvent(t);r.dispatchEvent(e),r.freeEvent(e)},this.onClick=function(t){if(r.context.config.useNativeClickEvent){var e=r.createPointerEvent(t);r.dispatchEvent(e),r.freeEvent(e)}},this.onPointerCancel=function(t){var e=r.createPointerEvent(t,void 0,void 0,r.context.config.alwaysTriggerPointerEventOnCanvas?r.rootTarget:void 0);r.dispatchEvent(e),r.freeEvent(e)},this.globalRuntime=e,this.context=n},[{key:"init",value:function(){this.rootTarget=this.context.renderingContext.root.parentNode,this.addEventMapping("pointerdown",this.onPointerDown),this.addEventMapping("pointerup",this.onPointerUp),this.addEventMapping("pointermove",this.onPointerMove),this.addEventMapping("pointerout",this.onPointerOut),this.addEventMapping("pointerleave",this.onPointerOut),this.addEventMapping("pointercancel",this.onPointerCancel),this.addEventMapping("pointerover",this.onPointerOver),this.addEventMapping("pointerupoutside",this.onPointerUpOutside),this.addEventMapping("wheel",this.onWheel),this.addEventMapping("click",this.onClick)}},{key:"destroy",value:function(){this.mappingTable={},this.mappingState={},this.eventPool.clear()}},{key:"getScale",value:function(){var t=this.context.contextService.getBoundingClientRect(),e=1,n=1,r=this.context.contextService.getDomElement();if(r&&t){var i=r.offsetWidth,o=r.offsetHeight;i&&o&&(e=t.width/i,n=t.height/o)}return{scaleX:e,scaleY:n,bbox:t}}},{key:"client2Viewport",value:function(t){var e=this.getScale(),n=e.scaleX,r=e.scaleY,i=e.bbox;return new Er((t.x-((null==i?void 0:i.left)||0))/n,(t.y-((null==i?void 0:i.top)||0))/r)}},{key:"viewport2Client",value:function(t){var e=this.getScale(),n=e.scaleX,r=e.scaleY,i=e.bbox;return new Er((t.x+((null==i?void 0:i.left)||0))*n,(t.y+((null==i?void 0:i.top)||0))*r)}},{key:"viewport2Canvas",value:function(t){var e=t.x,n=t.y,r=this.rootTarget.defaultView.getCamera(),i=this.context.config,o=i.width,A=i.height,s=r.getPerspectiveInverse(),a=r.getWorldTransform(),c=O(this.tmpMatrix,a,s),l=dt(this.tmpVec3,e/o*2-1,2*(1-n/A)-1,0);return bt(l,l,c),new Er(l[0],l[1])}},{key:"canvas2Viewport",value:function(t){var e=this.rootTarget.defaultView.getCamera(),n=e.getPerspective(),r=e.getViewTransform(),i=O(this.tmpMatrix,n,r),o=dt(this.tmpVec3,t.x,t.y,0);bt(this.tmpVec3,this.tmpVec3,i);var A=this.context.config,s=A.width,a=A.height;return new Er((o[0]+1)/2*s,(1-(o[1]+1)/2)*a)}},{key:"setPickHandler",value:function(t){this.pickHandler=t}},{key:"addEventMapping",value:function(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(function(t,e){return t.priority-e.priority})}},{key:"mapEvent",value:function(t){if(this.rootTarget){var e=this.mappingTable[t.type];if(e)for(var n=0,r=e.length;n<r;n++)e[n].fn(t);else console.warn("[EventService]: Event mapping not defined for ".concat(t.type))}}},{key:"dispatchEvent",value:function(t,e,n){if(n){t.eventPhase=t.AT_TARGET;var r=this.rootTarget.defaultView||null;t.currentTarget=r,this.notifyListeners(t,e)}else t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e)}},{key:"propagate",value:function(t,e){if(t.target){var n=t.composedPath();t.eventPhase=t.CAPTURING_PHASE;for(var r=n.length-1;r>=1;r--)if(t.currentTarget=n[r],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return;if(t.eventPhase=t.AT_TARGET,t.currentTarget=t.target,this.notifyTarget(t,e),!t.propagationStopped&&!t.propagationImmediatelyStopped){var i=n.indexOf(t.currentTarget);t.eventPhase=t.BUBBLING_PHASE;for(var o=i+1;o<n.length;o++)if(t.currentTarget=n[o],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}}},{key:"propagationPath",value:function(t){var e=[t],n=this.rootTarget.defaultView||null;if(n&&n===t)return e.unshift(n.document),e;for(var r=0;r<2048&&t!==this.rootTarget;r++)Ys.isNode(t)&&t.parentNode&&(e.push(t.parentNode),t=t.parentNode);return n&&e.push(n),e}},{key:"hitTest",value:function(t){var e=t.viewportX,n=t.viewportY,r=this.context.config,i=r.width,o=r.height,A=r.disableHitTesting;return e<0||n<0||e>i||n>o?null:!A&&this.pickHandler(t)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(t,e){var n,r=null==e?void 0:e.target;if(null!==(n=r)&&void 0!==n&&n.shadowRoot&&(r=e.composedPath()[0]),r){if(r===t)return!0;if(t&&t.contains)return t.contains(r)}return!(null==e||!e.composedPath)&&e.composedPath().indexOf(t)>-1}},{key:"getExistedHTML",value:function(t){if(t.nativeEvent.composedPath)for(var e=0,n=t.nativeEvent.composedPath();e<n.length;e++){var r=n[e],i=this.nativeHTMLMap.get(r);if(i)return i}return null}},{key:"pickTarget",value:function(t){return this.hitTest({clientX:t.clientX,clientY:t.clientY,viewportX:t.viewportX,viewportY:t.viewportY,x:t.canvasX,y:t.canvasY})}},{key:"createPointerEvent",value:function(t,e,n,r){var i=this.allocateEvent(js);this.copyPointerData(t,i),this.copyMouseData(t,i),this.copyData(t,i),i.nativeEvent=t.nativeEvent,i.originalEvent=t;var o=this.getExistedHTML(i),A=this.context.contextService.getDomElement();return i.target=null!=n?n:o||this.isNativeEventFromCanvas(A,i.nativeEvent)&&this.pickTarget(i)||r,"string"==typeof e&&(i.type=e),i}},{key:"createWheelEvent",value:function(t){var e=this.allocateEvent(zs);this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.nativeEvent=t.nativeEvent,e.originalEvent=t;var n=this.getExistedHTML(e),r=this.context.contextService.getDomElement();return e.target=n||this.isNativeEventFromCanvas(r,e.nativeEvent)&&this.pickTarget(e),e}},{key:"trackingData",value:function(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}},{key:"cloneWheelEvent",value:function(t){var e=this.allocateEvent(zs);return e.nativeEvent=t.nativeEvent,e.originalEvent=t.originalEvent,this.copyWheelData(t,e),this.copyMouseData(t,e),this.copyData(t,e),e.target=t.target,e.path=t.composedPath().slice(),e.type=t.type,e}},{key:"clonePointerEvent",value:function(t,e){var n=this.allocateEvent(js);return n.nativeEvent=t.nativeEvent,n.originalEvent=t.originalEvent,this.copyPointerData(t,n),this.copyMouseData(t,n),this.copyData(t,n),n.target=t.target,n.path=t.composedPath().slice(),n.type=null!=e?e:n.type,n}},{key:"copyPointerData",value:function(t,e){e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist}},{key:"copyMouseData",value:function(t,e){e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.shiftKey=t.shiftKey,e.client.copyFrom(t.client),e.movement.copyFrom(t.movement),e.canvas.copyFrom(t.canvas),e.screen.copyFrom(t.screen),e.global.copyFrom(t.global),e.offset.copyFrom(t.offset)}},{key:"copyWheelData",value:function(t,e){e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ}},{key:"copyData",value:function(t,e){e.isTrusted=t.isTrusted,e.timeStamp=JA.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.page.copyFrom(t.page),e.viewport.copyFrom(t.viewport)}},{key:"allocateEvent",value:function(t){this.eventPool.has(t)||this.eventPool.set(t,[]);var e=this.eventPool.get(t).pop()||new t(this);return e.eventPhase=e.NONE,e.currentTarget=null,e.path=[],e.target=null,e}},{key:"freeEvent",value:function(t){if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventBoundary!");var e=t.constructor;this.eventPool.has(e)||this.eventPool.set(e,[]),this.eventPool.get(e).push(t)}},{key:"notifyTarget",value:function(t,e){e=null!=e?e:t.type;var n=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?"".concat(e,"capture"):e;this.notifyListeners(t,n),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}},{key:"notifyListeners",value:function(t,e){var n=t.currentTarget.emitter,r=n._events[e];if(r)if("fn"in r)r.once&&n.removeListener(e,r.fn,void 0,!0),r.fn.call(t.currentTarget||r.context,t);else for(var i=0;i<r.length&&!t.propagationImmediatelyStopped;i++)r[i].once&&n.removeListener(e,r[i].fn,void 0,!0),r[i].fn.call(t.currentTarget||r[i].context,t)}},{key:"findMountedTarget",value:function(t){if(!t)return null;for(var e=t[t.length-1],n=t.length-2;n>=0;n--){var r=t[n];if(!(r===this.rootTarget||Ys.isNode(r)&&r.parentNode===e))break;e=t[n]}return e}},{key:"getCursor",value:function(t){for(var e=t;e;){var n=YA(e)&&e.getAttribute("cursor");if(n)return n;e=Ys.isNode(e)&&e.parentNode}}}])}(),qs=function(){return a(function t(){A(this,t)},[{key:"getOrCreateCanvas",value:function(t,e){if(this.canvas)return this.canvas;if(t||Ua.offscreenCanvas)this.canvas=t||Ua.offscreenCanvas,this.context=this.canvas.getContext("2d",o({willReadFrequently:!0},e));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",o({willReadFrequently:!0},e)),this.context&&this.context.measureText||(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(t){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",o({willReadFrequently:!0},e))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(t,e){return this.context||this.getOrCreateCanvas(t,e),this.context}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch(t){}try{return document.createElement("canvas")}catch(t){}return null}}])}(),$s=function(t){return t[t.CAMERA_CHANGED=0]="CAMERA_CHANGED",t[t.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",t[t.NONE=2]="NONE",t}({}),Zs=function(){return a(function t(e,n){A(this,t),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new gs,initAsync:new ds,dirtycheck:new ps,cull:new ps,beginFrame:new gs,beforeRender:new gs,render:new gs,afterRender:new gs,endFrame:new gs,destroy:new gs,pick:new fs,pickSync:new ps,pointerDown:new gs,pointerUp:new gs,pointerMove:new gs,pointerOut:new gs,pointerOver:new gs,pointerWheel:new gs,pointerCancel:new gs,click:new gs},this.globalRuntime=e,this.context=n},[{key:"init",value:function(t){var e=this,n=o(o({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(t){t.apply(n,e.globalRuntime)}),this.hooks.init.call(),0===this.hooks.initAsync.getCallbacksNum()?(this.inited=!0,t()):this.hooks.initAsync.promise().then(function(){e.inited=!0,t()}).catch(function(t){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){return!this.context.config.renderer.getConfig().enableDirtyRectangleRendering||this.context.renderingContext.renderReasons.has($s.CAMERA_CHANGED)}},{key:"render",value:function(t,e,n){var r=this,i=t.getConfig(),o=this.context.renderingContext;if(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.globalRuntime.sceneGraphService.syncHierarchy(o.root),this.globalRuntime.sceneGraphService.notifyMutationObservers(t),o.renderReasons.size&&this.inited){o.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var A=1===o.renderReasons.size&&o.renderReasons.has($s.CAMERA_CHANGED),s=!i.disableRenderHooks||!A;s&&this.renderDisplayObject(o.root,i,o),this.hooks.beginFrame.call(e),s&&o.renderListCurrentFrame.forEach(function(t){r.hooks.beforeRender.call(t),r.hooks.render.call(t),r.hooks.afterRender.call(t)}),this.hooks.endFrame.call(e),o.renderListCurrentFrame=[],o.renderReasons.clear(),n()}}},{key:"renderDisplayObject",value:function(t,e,n){var r=this,i=e.renderer.getConfig(),o=i.enableDirtyCheck,A=i.enableCulling;function s(t){var e=t.renderable,i=t.sortable,s=o?e.dirty||n.dirtyRectangleRenderingDisabled?t:null:t,a=null;s&&(a=A?r.hooks.cull.call(s,r.context.camera):s)&&(r.stats.rendered+=1,n.renderListCurrentFrame.push(a)),t.dirty(!1),i.renderOrder=r.zIndexCounter,r.zIndexCounter+=1,r.stats.total+=1,i.dirty&&(r.sort(t,i),i.dirty=!1,i.dirtyChildren=[],i.dirtyReason=void 0)}for(var a=[t];a.length>0;){var c,l=a.pop();s(l);for(var u=(null===(c=l.sortable)||void 0===c||null===(c=c.sorted)||void 0===c?void 0:c.length)>0?l.sortable.sorted:l.childNodes,h=u.length-1;h>=0;h--)a.push(u[h])}}},{key:"sort",value:function(t,e){var n,r;(null==e||null===(n=e.sorted)||void 0===n?void 0:n.length)>0&&e.dirtyReason!==$r.Z_INDEX_CHANGED?e.dirtyChildren.forEach(function(n){var r=e.sorted.indexOf(n);if(r>-1&&e.sorted.splice(r,1),t.childNodes.indexOf(n)>-1)if(0===e.sorted.length)e.sorted.push(n);else{var i=function(t,e){for(var n=0,r=t.length;n<r;){var i=n+r>>>1;XA(t[i],e)<0?n=i+1:r=i}return n}(e.sorted,n);e.sorted.splice(i,0,n)}}):e.sorted=t.childNodes.slice().sort(XA),(null===(r=e.sorted)||void 0===r?void 0:r.length)>0&&0===t.childNodes.filter(function(t){return t.parsedStyle.zIndex}).length&&(e.sorted=[])}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call()}},{key:"dirty",value:function(){this.context.renderingContext.renderReasons.add($s.DISPLAY_OBJECT_CHANGED)}}])}(),Js=/\[\s*(.*)=(.*)\s*\]/,ta=function(){return a(function t(){A(this,t)},[{key:"selectOne",value:function(t,e){var n=this;if(t.startsWith("."))return e.find(function(e){return((null==e?void 0:e.classList)||[]).indexOf(n.getIdOrClassname(t))>-1});if(t.startsWith("#"))return e.find(function(e){return e.id===n.getIdOrClassname(t)});if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.find(function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)}):null}return e.find(function(n){return e!==n&&n.nodeName===t})}},{key:"selectAll",value:function(t,e){var n=this;if(t.startsWith("."))return e.findAll(function(r){return e!==r&&((null==r?void 0:r.classList)||[]).indexOf(n.getIdOrClassname(t))>-1});if(t.startsWith("#"))return e.findAll(function(r){return e!==r&&r.id===n.getIdOrClassname(t)});if(t.startsWith("[")){var r=this.getAttribute(t),i=r.name,o=r.value;return i?e.findAll(function(t){return e!==t&&("name"===i?t.name===o:n.attributeToString(t,i)===o)}):[]}return e.findAll(function(n){return e!==n&&n.nodeName===t})}},{key:"is",value:function(t,e){if(t.startsWith("."))return e.className===this.getIdOrClassname(t);if(t.startsWith("#"))return e.id===this.getIdOrClassname(t);if(t.startsWith("[")){var n=this.getAttribute(t),r=n.name,i=n.value;return"name"===r?e.name===i:this.attributeToString(e,r)===i}return e.nodeName===t}},{key:"getIdOrClassname",value:function(t){return t.substring(1)}},{key:"getAttribute",value:function(t){var e=t.match(Js),n="",r="";return e&&e.length>2&&(n=e[1].replace(/"/g,""),r=e[2].replace(/"/g,"")),{name:n,value:r}}},{key:"attributeToString",value:function(t,e){if(!t.getAttribute)return"";var n=t.getAttribute(e);return Kt(n)?"":n.toString?n.toString():""}}])}(),ea=function(t){return t.ATTR_MODIFIED="DOMAttrModified",t.INSERTED="DOMNodeInserted",t.MOUNTED="DOMNodeInsertedIntoDocument",t.REMOVED="removed",t.UNMOUNTED="DOMNodeRemovedFromDocument",t.REPARENT="reparent",t.DESTROY="destroy",t.BOUNDS_CHANGED="bounds-changed",t.CULLED="culled",t}({}),na=function(t){function e(t,n,r,i,o,s,a,c){var l;return A(this,e),(l=g(this,e,[null])).relatedNode=n,l.prevValue=r,l.newValue=i,l.attrName=o,l.attrChange=s,l.prevParsedValue=a,l.newParsedValue=c,l.type=t,l}return v(e,t),a(e)}(Gs);na.ADDITION=2,na.MODIFICATION=1,na.REMOVAL=3;var ra,ia,oa,Aa=new na(ea.REPARENT,null,"","","",0,"",""),sa=Rt(),aa=at(),ca=ut(1,1,1),la=C(),ua=Rt(),ha=at(),da=C(),fa=St(),ga=at(),pa=St(),va=at(),ma=at(),ya=at(),wa=C(),ba=St(),Ba=St(),Ea=St(),xa=function(){return a(function t(e){A(this,t),this.displayObjectDependencyMap=new WeakMap,this.runtime=e},[{key:"matches",value:function(t,e){return this.runtime.sceneGraphSelector.is(t,e)}},{key:"querySelector",value:function(t,e){return this.runtime.sceneGraphSelector.selectOne(t,e)}},{key:"querySelectorAll",value:function(t,e){return this.runtime.sceneGraphSelector.selectAll(t,e)}},{key:"attach",value:function(t,e,n){var r,i=!1;t.parentNode&&(i=t.parentNode!==e,this.detach(t));var o=t.nodeName===cr.FRAGMENT,A=ts(e);t.parentNode=e;var s=o?t.childNodes:[t];re(n)?s.forEach(function(t){e.childNodes.splice(n,0,t),t.parentNode=e}):s.forEach(function(t){e.childNodes.push(t),t.parentNode=e});var a=e.sortable;if((null!=a&&null!==(r=a.sorted)&&void 0!==r&&r.length||a.dirty||t.parsedStyle.zIndex)&&(-1===a.dirtyChildren.indexOf(t)&&a.dirtyChildren.push(t),a.dirty=!0,a.dirtyReason=$r.ADDED),!A){if(o)this.dirtyFragment(t);else{var c=t.transformable;c&&this.dirtyWorldTransform(t,c)}if(i){var l,u=!0===(null===(l=e.ownerDocument)||void 0===l||null===(l=l.defaultView)||void 0===l||null===(l=l.getConfig())||void 0===l||null===(l=l.future)||void 0===l?void 0:l.experimentalCancelEventPropagation);t.dispatchEvent(Aa,u,u)}}}},{key:"detach",value:function(t){var e,n;if(t.parentNode){var r=t.transformable,i=t.parentNode.sortable;(null!=i&&null!==(e=i.sorted)&&void 0!==e&&e.length||null!==(n=t.style)&&void 0!==n&&n.zIndex)&&(-1===i.dirtyChildren.indexOf(t)&&i.dirtyChildren.push(t),i.dirty=!0,i.dirtyReason=$r.REMOVED);var o=t.parentNode.childNodes.indexOf(t);o>-1&&t.parentNode.childNodes.splice(o,1),r&&this.dirtyWorldTransform(t,r),t.parentNode=null}}},{key:"getLocalPosition",value:function(t){return t.transformable.localPosition}},{key:"getLocalRotation",value:function(t){return t.transformable.localRotation}},{key:"getLocalScale",value:function(t){return t.transformable.localScale}},{key:"getLocalSkew",value:function(t){return t.transformable.localSkew}},{key:"getLocalTransform",value:function(t){var e=t.transformable;return ei(e),e.localTransform}},{key:"setLocalPosition",value:function(t,e){var n,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.transformable;ma[0]=e[0],ma[1]=e[1],ma[2]=null!==(n=e[2])&&void 0!==n?n:0,Bt(i.localPosition,ma)||(ht(i.localPosition,ma),r&&this.dirtyLocalTransform(t,i))}},{key:"translateLocal",value:function(t,e){"number"==typeof e&&(e=ut(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;Bt(e,aa)||(!function(t,e,n){var r=n[0],i=n[1],o=n[2],A=n[3],s=e[0],a=e[1],c=e[2],l=i*c-o*a,u=o*s-r*c,h=r*a-i*s;l+=l,u+=u,h+=h,t[0]=s+A*l+i*h-o*u,t[1]=a+A*u+o*l-r*h,t[2]=c+A*h+r*u-i*l}(e,e,n.localRotation),ft(n.localPosition,n.localPosition,e),this.dirtyLocalTransform(t,n))}},{key:"setLocalRotation",value:function(t,e,n,r,i){var o=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];"number"==typeof e&&(e=Lt(fa,e,n,r,i));var A=t.transformable;It(A.localRotation,e),o&&this.dirtyLocalTransform(t,A)}},{key:"rotateLocal",value:function(t,e){"number"==typeof e&&(e=ut(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;Tt(Ba,e[0],e[1],e[2]),Pt(n.localRotation,n.localRotation,Ba),this.dirtyLocalTransform(t,n)}},{key:"setLocalScale",value:function(t,e){var n,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=t.transformable;dt(ha,e[0],e[1],null!==(n=e[2])&&void 0!==n?n:i.localScale[2]),Bt(ha,i.localScale)||(ht(i.localScale,ha),r&&this.dirtyLocalTransform(t,i))}},{key:"scaleLocal",value:function(t,e){var n,r=t.transformable;!function(t,e,n){t[0]=e[0]*n[0],t[1]=e[1]*n[1],t[2]=e[2]*n[2]}(r.localScale,r.localScale,dt(ha,e[0],e[1],null!==(n=e[2])&&void 0!==n?n:1)),this.dirtyLocalTransform(t,r)}},{key:"setLocalSkew",value:function(t,e,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];"number"==typeof e&&(e=function(t,e,n){return t[0]=e,t[1]=n,t}(ua,e,n));var i=t.transformable;!function(t,e){t[0]=e[0],t[1]=e[1]}(i.localSkew,e),r&&this.dirtyLocalTransform(t,i)}},{key:"setLocalEulerAngles",value:function(t,e){var n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];"number"==typeof e&&(e=ut(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var r=t.transformable;Tt(r.localRotation,e[0],e[1],e[2]),n&&this.dirtyLocalTransform(t,r)}},{key:"setLocalTransform",value:function(t,e){var n=V(ga,e),r=Y(pa,e),i=W(va,e);this.setLocalScale(t,i,!1),this.setLocalPosition(t,n,!1),this.setLocalRotation(t,r,void 0,void 0,void 0,!1),this.dirtyLocalTransform(t,t.transformable)}},{key:"resetLocalTransform",value:function(t){this.setLocalScale(t,ca,!1),this.setLocalPosition(t,aa,!1),this.setLocalEulerAngles(t,aa,void 0,void 0,!1),this.setLocalSkew(t,sa,void 0,!1),this.dirtyLocalTransform(t,t.transformable)}},{key:"getPosition",value:function(t){var e=t.transformable;return V(e.position,this.getWorldTransform(t,e))}},{key:"getRotation",value:function(t){var e=t.transformable;return Y(e.rotation,this.getWorldTransform(t,e))}},{key:"getScale",value:function(t){var e=t.transformable;return W(e.scaling,this.getWorldTransform(t,e))}},{key:"getOrigin",value:function(t){return t.getGeometryBounds(),t.transformable.origin}},{key:"getWorldTransform",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.transformable;return e.localDirtyFlag||e.dirtyFlag?(t.parentNode&&t.parentNode.transformable&&this.getWorldTransform(t.parentNode),this.internalUpdateTransform(t),e.worldTransform):e.worldTransform}},{key:"setPosition",value:function(t,e){var n,r=t.transformable;if(ya[0]=e[0],ya[1]=e[1],ya[2]=null!==(n=e[2])&&void 0!==n?n:0,!Bt(this.getPosition(t),ya)){if(ht(r.position,ya),null!==t.parentNode&&t.parentNode.transformable){var i=t.parentNode.transformable;F(wa,i.worldTransform),N(wa,wa),bt(r.localPosition,ya,wa)}else ht(r.localPosition,ya);this.dirtyLocalTransform(t,r)}}},{key:"translate",value:function(t,e){"number"==typeof e&&(e=dt(ha,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)),Bt(e,aa)||(ft(ha,this.getPosition(t),e),this.setPosition(t,ha))}},{key:"setRotation",value:function(t,e,n,r,i){var o=t.transformable;if("number"==typeof e&&(e=Ot(e,n,r,i)),null!==t.parentNode&&t.parentNode.transformable){var A=this.getRotation(t.parentNode);It(fa,A),Nt(fa,fa),Ut(o.localRotation,fa,e),Dt(o.localRotation,o.localRotation),this.dirtyLocalTransform(t,o)}else this.setLocalRotation(t,e)}},{key:"rotate",value:function(t,e){"number"==typeof e&&(e=ut(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){var r=fa;Tt(r,e[0],e[1],e[2]);var i=this.getRotation(t),o=this.getRotation(t.parentNode);It(Ea,o),Nt(Ea,Ea),Ut(r,Ea,r),Ut(n.localRotation,r,i),Dt(n.localRotation,n.localRotation),this.dirtyLocalTransform(t,n)}else this.rotateLocal(t,e)}},{key:"setOrigin",value:function(t,e){"number"==typeof e&&(e=[e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0]);var n=t.transformable;if(e[0]!==n.origin[0]||e[1]!==n.origin[1]||e[2]!==n.origin[2]){var r=n.origin;r[0]=e[0],r[1]=e[1],r[2]=e[2]||0,this.dirtyLocalTransform(t,n)}}},{key:"setEulerAngles",value:function(t,e){"number"==typeof e&&(e=ut(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:0));var n=t.transformable;if(null!==t.parentNode&&t.parentNode.transformable){Tt(n.localRotation,e[0],e[1],e[2]);var r=this.getRotation(t.parentNode);It(ba,Nt(fa,r)),Pt(n.localRotation,n.localRotation,ba),this.dirtyLocalTransform(t,n)}else this.setLocalEulerAngles(t,e)}},{key:"getGeometryBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.geometry;return n.dirty&&Ua.styleValueRegistry.updateGeometry(t),(e?n.renderBounds:n.contentBounds||null)||new yr}},{key:"getTransformedGeometryBounds",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0,r=this.getGeometryBounds(t,e);if(!yr.isEmpty(r)){var i=n||new yr;return i.setFromTransformedAABB(r,this.getWorldTransform(t)),i}return null}},{key:"getBounds",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t.renderable;if(!r.boundsDirty&&!n&&r.bounds)return r.bounds;if(!r.renderBoundsDirty&&n&&r.renderBounds)return r.renderBounds;var i=n?r.renderBounds:r.bounds,o=this.getTransformedGeometryBounds(t,n,i);if(t.childNodes.forEach(function(t){var r=e.getBounds(t,n);r&&(o?o.add(r):(o=i||new yr).update(r.center,r.halfExtents))}),o||(o=new yr),n){var A=qA(t);if(A){var s=A.parsedStyle.clipPath.getBounds(n);o?s&&(o=s.intersection(o)):o.update(s.center,s.halfExtents)}}return n?(r.renderBounds=o,r.renderBoundsDirty=!1):(r.bounds=o,r.boundsDirty=!1),o}},{key:"getLocalBounds",value:function(t){if(t.parentNode){var e=la;t.parentNode.transformable&&(e=N(da,this.getWorldTransform(t.parentNode)));var n=this.getBounds(t);if(!yr.isEmpty(n)){var r=new yr;return r.setFromTransformedAABB(n,e),r}}return this.getBounds(t)}},{key:"getBoundingClientRect",value:function(t){var e,n,r=this.getGeometryBounds(t);yr.isEmpty(r)||(n=new yr).setFromTransformedAABB(r,this.getWorldTransform(t));var i=null===(e=t.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e?void 0:e.getContextService().getBoundingClientRect();if(n){var o=m(n.getMin(),2),A=o[0],s=o[1],a=m(n.getMax(),2),c=a[0],l=a[1];return new xr(A+((null==i?void 0:i.left)||0),s+((null==i?void 0:i.top)||0),c-A,l-s)}return new xr((null==i?void 0:i.left)||0,(null==i?void 0:i.top)||0,0,0)}},{key:"internalUpdateTransform",value:function(t){var e,n=null===(e=t.parentNode)||void 0===e?void 0:e.transformable;ei(t.transformable),function(t,e){t.dirtyFlag&&(e?O(t.worldTransform,e.worldTransform,t.localTransform):F(t.worldTransform,t.localTransform),t.dirtyFlag=!1)}(t.transformable,n)}},{key:"internalUpdateElement",value:function(t,e){var n,r,i,o,A,s,a=!0===(null===(n=t.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n||null===(n=n.getConfig())||void 0===n||null===(n=n.future)||void 0===n?void 0:n.experimentalAttributeUpdateOptimization),c=e[e.length-1],l=(null==c?void 0:c.transformDirty)||(null===(r=t.transformable)||void 0===r?void 0:r.localDirtyFlag);t.transformable&&((A=t.transformable).dirtyFlag||(A.dirtyFlag=l));(this.internalUpdateTransform(t),l)&&(null===(s=t.dirty)||void 0===s||s.call(t,!0,!0));var u=(null===(i=t.renderable)||void 0===i?void 0:i.boundsDirty)||(null===(o=t.renderable)||void 0===o?void 0:o.renderBoundsDirty);if((l||u)&&!1===(null==c?void 0:c.shapeUpdated)&&a)for(var h=e.length-1;h>=0;){var d,f,g=e[h];if(g.shapeUpdated)break;null===(d=(f=g.node).dirty)||void 0===d||d.call(f,!0,!0),g.shapeUpdated=!0,h-=1}return l}},{key:"syncHierarchy",value:function(t){for(var e,n,r=[t],i=t.parentNode?[{node:t.parentNode,transformDirty:(null===(e=t.parentNode.transformable)||void 0===e?void 0:e.localDirtyFlag)||(null===(n=t.parentNode.transformable)||void 0===n?void 0:n.dirtyFlag),shapeUpdated:!1}]:[];r.length>0;){for(var o=r.pop(),A=i[i.length-1];i.length>0&&o.parentNode!==A.node;)A=i.pop();var s=this.internalUpdateElement(o,i);if(o.childNodes.length>0){for(var a=o.childNodes.length-1;a>=0;a--)r.push(o.childNodes[a]);i.push({node:o,transformDirty:s,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(t,e){ts(t)||e.localDirtyFlag||(e.localDirtyFlag=!0,e.dirtyFlag||this.dirtyWorldTransform(t,e))}},{key:"dirtyWorldTransform",value:function(t,e){this.dirtyWorldInternal(t,e),this.dirtyToRoot(t,!0)}},{key:"dirtyWorldInternal",value:function(t,e){var n,r=this,i=!0===(null===(n=t.ownerDocument)||void 0===n||null===(n=n.defaultView)||void 0===n||null===(n=n.getConfig())||void 0===n||null===(n=n.future)||void 0===n?void 0:n.experimentalAttributeUpdateOptimization);e.dirtyFlag||(e.dirtyFlag=!0,t.dirty(!0,!0),i||t.childNodes.forEach(function(t){var e=t.transformable;r.dirtyWorldInternal(t,e)}))}},{key:"dirtyToRoot",value:function(t){for(var e,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t,i=!0===(null===(e=t.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e||null===(e=e.getConfig())||void 0===e||null===(e=e.future)||void 0===e?void 0:e.experimentalAttributeUpdateOptimization);r;){var o,A;if(null===(o=(A=r).dirty)||void 0===o||o.call(A,!0,!0),i)break;r=r.parentNode}n&&t.forEach(function(t){var e;null===(e=t.dirty)||void 0===e||e.call(t,!0,!0)}),this.informDependentDisplayObjects(t);var s=t.mutations||[],a=s.find(function(t){return"attributes"===t.type&&t._boundsChangeData});a?a._boundsChangeData={affectChildren:a._boundsChangeData.affectChildren||n}:(a={type:"attributes",target:t,_boundsChangeData:{affectChildren:n}},s.push(a)),t.mutations=s}},{key:"dirtyFragment",value:function(t){var e,n,r=t.transformable;r&&(r.dirtyFlag=!0,r.localDirtyFlag=!0),null===(e=(n=t).dirty)||void 0===e||e.call(n,!0,!0);for(var i=t.childNodes.length,o=0;o<i;o++)this.dirtyFragment(t.childNodes[o])}},{key:"notifyMutationObservers",value:function(t){var e=new Set;if(t.getRoot().forEach(function(t){(t.mutations||[]).forEach(function(n){"attributes"===n.type&&n._boundsChangeData&&(n._boundsChangeData.affectChildren?t.forEach(function(t){var r=o({},n);r.target=t,e.add(r)}):e.add(n))}),t.mutations=void 0}),e.size>0){var n=new Vs(ea.BOUNDS_CHANGED,{detail:Array.from(e)});t.dispatchEvent(n,!0,!0)}}},{key:"updateDisplayObjectDependency",value:function(t,e,n,r){if(e&&e!==n){var i=this.displayObjectDependencyMap.get(e);if(i&&i[t]){var o=i[t].indexOf(r);i[t].splice(o,1)}}if(n){var A=this.displayObjectDependencyMap.get(n);A||(this.displayObjectDependencyMap.set(n,{}),A=this.displayObjectDependencyMap.get(n)),A[t]||(A[t]=[]),A[t].push(r)}}},{key:"informDependentDisplayObjects",value:function(t){var e,n=this,r=this.displayObjectDependencyMap.get(t);if(r){var i=null===(e=t.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e||null===(e=e.getConfig())||void 0===e||null===(e=e.future)||void 0===e?void 0:e.experimentalCancelEventPropagation;Object.keys(r).forEach(function(t){r[t].forEach(function(e){n.dirtyToRoot(e,!0),e.dispatchEvent(new na(ea.ATTR_MODIFIED,e,n,n,t,na.MODIFICATION,n,n),i,i),e.isCustomElement&&e.isConnected&&e.attributeChangedCallback&&e.attributeChangedCallback(t,n,n)})})}}}])}(),Ca=function(){return a(function t(e){if(A(this,t),e<=0)throw new Error("LRU capacity must be a positive number.");this.capacity=e,this.cache=new Map},[{key:"get",value:function(t){if(this.cache.has(t)){var e=this.cache.get(t);return this.cache.delete(t),this.cache.set(t,e),e}}},{key:"put",value:function(t,e){if(this.cache.has(t)&&this.cache.delete(t),this.cache.set(t,e),this.cache.size>this.capacity){var n=this.cache.keys().next().value;this.cache.delete(n)}}},{key:"len",value:function(){return this.cache.size}},{key:"clear",value:function(){this.cache.clear()}}])}(),Ma={MetricsString:"|ÉqÅ",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},Fa=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,ka=new RegExp("".concat(/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/.source,"|").concat(/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/.source,"|").concat(/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/.source,"|").concat(/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/.source)),Sa=new RegExp("".concat(/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/.source,"|").concat(/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/.source,"|").concat(/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/.source,"|").concat(/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/.source)),Qa=function(){return a(function t(e){var n=this;A(this,t),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(t,e){return!n.isBreakingSpace(e)&&!(!t||!Sa.exec(e)&&!ka.exec(t))},this.trimByKinsokuShorui=function(t){var e=u(t),n=e[e.length-2];if(!n)return t;var r=n[n.length-1];return e[e.length-2]=n.slice(0,-1),e[e.length-1]=r+e[e.length-1],e},this.runtime=e,this.charWidthCache=new Ca(100)},[{key:"measureFont",value:function(t,e){if(this.fontMetricsCache[t])return this.fontMetricsCache[t];var n={ascent:0,descent:0,fontSize:0},r=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(e),i=this.runtime.offscreenCanvasCreator.getOrCreateContext(e,{willReadFrequently:!0});i.font=t;var o=Ma.MetricsString+Ma.BaselineSymbol,A=Math.ceil(i.measureText(o).width),s=Math.ceil(i.measureText(Ma.BaselineSymbol).width),a=Ma.HeightMultiplier*s;s=s*Ma.BaselineMultiplier|0,r.width=A,r.height=a,i.fillStyle="#f00",i.fillRect(0,0,A,a),i.font=t,i.textBaseline="alphabetic",i.fillStyle="#000",i.fillText(o,0,s);var c=i.getImageData(0,0,A||1,a||1).data,l=c.length,u=4*A,h=0,d=0,f=!1;for(h=0;h<s;++h){for(var g=0;g<u;g+=4)if(255!==c[d+g]){f=!0;break}if(f)break;d+=u}for(n.ascent=s-h,d=l-u,f=!1,h=a;h>s;--h){for(var p=0;p<u;p+=4)if(255!==c[d+p]){f=!0;break}if(f)break;d-=u}return n.descent=h-s,n.fontSize=n.ascent+n.descent,this.fontMetricsCache[t]=n,n}},{key:"measureText",value:function(t,e,n){var r=e.fontSize,i=void 0===r?16:r,o=e.wordWrap,A=void 0!==o&&o,s=e.lineHeight,a=e.lineWidth,c=void 0===a?1:a,l=e.textBaseline,u=void 0===l?"alphabetic":l,h=e.textAlign,d=void 0===h?"start":h,f=e.letterSpacing,g=void 0===f?0:f,p=e.textPath;e.textPathSide,e.textPathStartOffset;var v=e.leading,m=void 0===v?0:v,y=ws(e),w=this.measureFont(y,n);0===w.fontSize&&(w.fontSize=i,w.ascent=i);var b=this.runtime.offscreenCanvasCreator.getOrCreateContext(n);b.font=y,e.isOverflowing=!1;var B=(A?this.wordWrap(t,e,n):t).split(/(?:\r\n|\r|\n)/),E=new Array(B.length),x=0;if(!p){for(var C=0;C<B.length;C++){var M=b.measureText(B[C]).width+(B[C].length-1)*g;E[C]=M,x=Math.max(x,M)}var F=x+c,k=s||w.fontSize+c,S=Math.max(k,w.fontSize+c)+(B.length-1)*(k+m),Q=0;return"middle"===u?Q=-S/2:"bottom"===u||"alphabetic"===u||"ideographic"===u?Q=-S:"top"!==u&&"hanging"!==u||(Q=0),{font:y,width:F,height:S,lines:B,lineWidths:E,lineHeight:k+=m,maxLineWidth:x,fontProperties:w,lineMetrics:E.map(function(t,e){var n=0;return"center"===d||"middle"===d?n-=t/2:"right"!==d&&"end"!==d||(n-=t),new xr(n-c/2,Q+e*k,t+c,k)})}}p.getTotalLength();for(var U=0;U<B.length;U++)b.measureText(B[U]).width,B[U].length}},{key:"wordWrap",value:function(t,e,n){var r=this,i=Array.from(t);if(0===i.length)return"";var o=this,A=e.wordWrapWidth,s=void 0===A?0:A,a=e.letterSpacing,c=void 0===a?0:a,l=e.maxLines,u=void 0===l?1/0:l,h=e.textOverflow,d=this.runtime.offscreenCanvasCreator.getOrCreateContext(n),f=s+c,g="";"ellipsis"===h?g="...":h&&"clip"!==h&&(g=h);var p=[""],v=0,m=0,y=-1,w=ws(e),b=this.charWidthCache.get(w);b||(b=new Ca(500),this.charWidthCache.put(w,b));var B=function(t){return r.getFromCache(t,c,b,d)},E=B(g);function x(t,e,n,r){for(;B(t)<r&&e<i.length-1&&!o.isNewline(i[e+1]);)t+=i[e+=1];for(;B(t)>r&&e>=n;)e-=1,t=t.slice(0,-1);return{lineTxt:t,txtLastCharIndex:e}}function C(t,e){if(!(E<=0||E>f))if(p[t]){var n=x(p[t],e,y+1,f-E);p[t]=n.lineTxt+g}else p[t]=g}for(var M=0;M<i.length;M++){var F=i[M],k=i[M-1],S=i[M+1],Q=B(F);if(this.isNewline(F)){if(v+1>=u){M<i.length-1&&C(v,M-1),e.isOverflowing=!0;break}y=M-1,m=0,p[v+=1]=""}else{if(Q>f){C(v,M-1),e.isOverflowing=!0;break}if(m>0&&m+Q>f){var U=x(p[v],M-1,y+1,f);if(U.txtLastCharIndex!==M-1){if(p[v]=U.lineTxt,U.txtLastCharIndex===i.length-1)break;M=U.txtLastCharIndex+1,F=i[M],k=i[M-1],S=i[M+1],Q=B(F)}if(v+1>=u){C(v,M-1),e.isOverflowing=!0;break}if(y=M-1,m=0,p[v+=1]="",this.isBreakingSpace(F))continue;this.canBreakInLastChar(F)||(p=this.trimToBreakable(p),m=this.sumTextWidthByCache(p[v]||"",B)),this.shouldBreakByKinsokuShorui(F,S)&&(p=this.trimByKinsokuShorui(p),m+=B(k||""))}m+=Q,p[v]+=F}}return p.join("\n")}},{key:"isBreakingSpace",value:function(t){return"string"==typeof t&&Ma.BreakingSpaces.indexOf(t.charCodeAt(0))>=0}},{key:"isNewline",value:function(t){return"string"==typeof t&&Ma.Newlines.indexOf(t.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(t){var e=u(t),n=e[e.length-2],r=this.findBreakableIndex(n);if(-1===r||!n)return e;var i=n.slice(r,r+1),o=r+1,A=r+(this.isBreakingSpace(i)?0:1);return e[e.length-1]+=n.slice(o,n.length),e[e.length-2]=n.slice(0,A),e}},{key:"canBreakInLastChar",value:function(t){return!t||!Fa.test(t)}},{key:"sumTextWidthByCache",value:function(t,e){return t.split("").reduce(function(t,n){return t+e(n)},0)}},{key:"findBreakableIndex",value:function(t){for(var e=t.length-1;e>=0;e--)if(!Fa.test(t[e]))return e;return-1}},{key:"getFromCache",value:function(t,e,n,r){var i=n.get(t);if("number"!=typeof i){var o=t.length*e;i=r.measureText(t).width+o,n.put(t,i)}return i}},{key:"clearCache",value:function(){this.fontMetricsCache={},this.charWidthCache.clear()}}])}(),Ua={},Na=(ia=new Ds,oa=new Ps,r(r(r(r(r(r(r(r(r(r(ra={},cr.FRAGMENT,null),cr.CIRCLE,new Ts),cr.ELLIPSE,new Os),cr.RECT,ia),cr.IMAGE,ia),cr.GROUP,new Hs),cr.LINE,new Is),cr.TEXT,new Rs(Ua)),cr.POLYLINE,oa),cr.POLYGON,oa),r(r(r(ra,cr.PATH,new Ls),cr.HTML,new _s),cr.MESH,null)),Ta=function(t){var e=new UA,n=new OA;return r(r(r(r(r(r(r(r(r(r(t={},ri.PERCENTAGE,null),ri.NUMBER,new DA),ri.ANGLE,new SA),ri.DEFINED_PATH,new QA),ri.PAINT,e),ri.COLOR,e),ri.FILTER,new NA),ri.LENGTH,n),ri.LENGTH_PERCENTAGE,n),ri.LENGTH_PERCENTAGE_12,new IA),r(r(r(r(r(r(r(r(r(r(t,ri.LENGTH_PERCENTAGE_14,new LA),ri.COORDINATE,new OA),ri.OFFSET_DISTANCE,new RA),ri.OPACITY_VALUE,new HA),ri.PATH,new _A),ri.LIST_OF_POINTS,new GA),ri.SHADOW_BLUR,new KA),ri.TEXT,new jA),ri.TEXT_TRANSFORM,new zA),ri.TRANSFORM,new Qs),r(r(r(t,ri.TRANSFORM_ORIGIN,new Us),ri.Z_INDEX,new Ns),ri.MARKER,new PA)}();Ua.CameraContribution=Xr,Ua.AnimationTimeline=null,Ua.EasingFunction=null,Ua.offscreenCanvasCreator=new qs,Ua.sceneGraphSelector=new ta,Ua.sceneGraphService=new xa(Ua),Ua.textService=new Qa(Ua),Ua.geometryUpdaterFactory=Na,Ua.CSSPropertySyntaxFactory=Ta,Ua.styleValueRegistry=new FA(Ua),Ua.layoutRegistry=null,Ua.globalThis="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Ua.enableStyleSyntax=!0,Ua.enableSizeAttenuation=!1;var Oa=0,Ia=new na(ea.INSERTED,null,"","","",0,"",""),La=new na(ea.REMOVED,null,"","","",0,"",""),Pa=new Vs(ea.DESTROY),Da=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).entity=Oa++,t.transformable={dirtyFlag:!1,localDirtyFlag:!1,localPosition:[0,0,0],localRotation:[0,0,0,1],localScale:[1,1,1],localTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],localSkew:[0,0],position:[0,0,0],rotation:[0,0,0,1],scaling:[1,1,1],worldTransform:[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],origin:[0,0,0]},t.renderable={bounds:void 0,boundsDirty:!0,renderBounds:void 0,renderBoundsDirty:!0,dirtyRenderBounds:void 0,dirty:!1},t.geometry={contentBounds:void 0,renderBounds:void 0,dirty:!0},t.cullable={strategy:qr.Standard,visibilityPlaneMask:-1,visible:!0,enable:!0},t.sortable={dirty:!1,sorted:void 0,renderOrder:0,dirtyChildren:[],dirtyReason:void 0},t.namespaceURI="g",t.scrollLeft=0,t.scrollTop=0,t.clientTop=0,t.clientLeft=0,t.style={},t.computedStyle={},t.parsedStyle={},t.attributes={},t}return v(e,t),a(e,[{key:"dirty",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;this.renderable.dirty=t,void 0!==e&&(this.renderable.boundsDirty=e,this.renderable.renderBoundsDirty=e,this.geometry.dirty=e)}},{key:"className",get:function(){return this.getAttribute("class")||""},set:function(t){this.setAttribute("class",t)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(t){return""!==t})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var t=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[t-1]||null}return null}},{key:"cloneNode",value:function(t){throw new Error(Cr)}},{key:"appendChild",value:function(t,e){var n;if(t.destroyed)throw new Error("Cannot append a destroyed element.");return Ua.sceneGraphService.attach(t,this,e),null!==(n=this.ownerDocument)&&void 0!==n&&n.defaultView&&(ts(this)||t.nodeName!==cr.FRAGMENT?this.ownerDocument.defaultView.mountChildren(t):this.ownerDocument.defaultView.mountFragment(t)),this.isMutationObserved&&(Ia.relatedNode=this,t.dispatchEvent(Ia)),t}},{key:"insertBefore",value:function(t,e){if(e){t.parentElement&&t.parentElement.removeChild(t);var n=this.childNodes.indexOf(e);-1===n?this.appendChild(t):this.appendChild(t,n)}else this.appendChild(t);return t}},{key:"replaceChild",value:function(t,e){var n=this.childNodes.indexOf(e);return this.removeChild(e),this.appendChild(t,n),e}},{key:"removeChild",value:function(t){var e,n,r=!0===(null===(e=this.ownerDocument)||void 0===e||null===(e=e.defaultView)||void 0===e||null===(e=e.getConfig().future)||void 0===e?void 0:e.experimentalCancelEventPropagation);return La.relatedNode=this,t.dispatchEvent(La,r,r),null!==(n=t.ownerDocument)&&void 0!==n&&n.defaultView&&t.ownerDocument.defaultView.unmountChildren(t),Ua.sceneGraphService.detach(t),t}},{key:"removeChildren",value:function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];this.removeChild(e)}}},{key:"destroyChildren",value:function(){for(var t=this.childNodes.length-1;t>=0;t--){var e=this.childNodes[t];e.childNodes.length>0&&e.destroyChildren(),e.destroy()}}},{key:"matches",value:function(t){return Ua.sceneGraphService.matches(t,this)}},{key:"getElementById",value:function(t){return Ua.sceneGraphService.querySelector("#".concat(t),this)}},{key:"getElementsByName",value:function(t){return Ua.sceneGraphService.querySelectorAll('[name="'.concat(t,'"]'),this)}},{key:"getElementsByClassName",value:function(t){return Ua.sceneGraphService.querySelectorAll(".".concat(t),this)}},{key:"getElementsByTagName",value:function(t){return Ua.sceneGraphService.querySelectorAll(t,this)}},{key:"querySelector",value:function(t){return Ua.sceneGraphService.querySelector(t,this)}},{key:"querySelectorAll",value:function(t){return Ua.sceneGraphService.querySelectorAll(t,this)}},{key:"closest",value:function(t){var e=this;do{if(Ua.sceneGraphService.matches(t,e))return e;e=e.parentElement}while(null!==e);return null}},{key:"find",value:function(t){var e=this,n=null;return this.forEach(function(r){return r===e||!t(r)||(n=r,!1)}),n}},{key:"findAll",value:function(t){var e=this,n=[];return this.forEach(function(r){r!==e&&t(r)&&n.push(r)}),n}},{key:"after",value:function(){var t=this;if(this.parentNode){for(var e=this.parentNode.childNodes.indexOf(this),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];r.forEach(function(n,r){var i;return null===(i=t.parentNode)||void 0===i?void 0:i.appendChild(n,e+r+1)})}}},{key:"before",value:function(){if(this.parentNode){for(var t,e=this.parentNode.childNodes.indexOf(this),n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var o=r[0],A=c(r).slice(1);this.parentNode.appendChild(o,e),(t=o).after.apply(t,u(A))}}},{key:"replaceWith",value:function(){this.after.apply(this,arguments),this.remove()}},{key:"append",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.forEach(function(e){return t.appendChild(e)})}},{key:"prepend",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];n.forEach(function(e,n){return t.appendChild(e,n)})}},{key:"replaceChildren",value:function(){for(;this.childNodes.length&&this.firstChild;)this.removeChild(this.firstChild);this.append.apply(this,arguments)}},{key:"remove",value:function(){return this.parentNode?this.parentNode.removeChild(this):this}},{key:"destroy",value:function(){var t,e=!0===(null===(t=this.ownerDocument)||void 0===t||null===(t=t.defaultView)||void 0===t||null===(t=t.getConfig().future)||void 0===t?void 0:t.experimentalCancelEventPropagation);this.destroyChildren(),this.dispatchEvent(Pa,e,e),this.remove(),this.emitter.removeAllListeners(),this.destroyed=!0}},{key:"getGeometryBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Ua.sceneGraphService.getGeometryBounds(this,t)}},{key:"getTransformedGeometryBounds",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return Ua.sceneGraphService.getTransformedGeometryBounds(this,t)}},{key:"getBounds",value:function(){return Ua.sceneGraphService.getBounds(this)}},{key:"getRenderBounds",value:function(){return Ua.sceneGraphService.getBounds(this,!0)}},{key:"getLocalBounds",value:function(){return Ua.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return Ua.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(t){if("symbol"!=typeof t){var e=this.attributes[t];return e}}},{key:"hasAttribute",value:function(t){return this.getAttributeNames().includes(t)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(t){this.setAttribute(t,null),delete this.attributes[t]}},{key:"setAttribute",value:function(t,e){this.attributes[t]=e}},{key:"getAttributeNS",value:function(t,e){throw new Error(Cr)}},{key:"getAttributeNode",value:function(t){throw new Error(Cr)}},{key:"getAttributeNodeNS",value:function(t,e){throw new Error(Cr)}},{key:"hasAttributeNS",value:function(t,e){throw new Error(Cr)}},{key:"removeAttributeNS",value:function(t,e){throw new Error(Cr)}},{key:"removeAttributeNode",value:function(t){throw new Error(Cr)}},{key:"setAttributeNS",value:function(t,e,n){throw new Error(Cr)}},{key:"setAttributeNode",value:function(t){throw new Error(Cr)}},{key:"setAttributeNodeNS",value:function(t){throw new Error(Cr)}},{key:"toggleAttribute",value:function(t,e){throw new Error(Cr)}}])}(Ys);function Ra(t){return!(null==t||!t.nodeName)}var Ha=Ua.globalThis.Proxy?Ua.globalThis.Proxy:function(){},_a=new na(ea.ATTR_MODIFIED,null,null,null,null,na.MODIFICATION,null,null),Ga=at(),Ka=St(),ja=function(t){function e(t){var n;return A(this,e),(n=g(this,e)).isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=t,n.id=t.id||"",n.name=t.name||"",(t.className||t.class)&&(n.className=t.className||t.class),n.nodeName=t.type||cr.GROUP,t.initialParsedStyle&&Object.assign(n.parsedStyle,t.initialParsedStyle),n.initAttributes(t.style),Ua.enableStyleSyntax&&(n.style=new Ha({setProperty:function(t,e){n.setAttribute(t,e)},getPropertyValue:function(t){return n.getAttribute(t)},removeProperty:function(t){n.removeAttribute(t)},item:function(){return""}},{get:function(t,e){return void 0!==t[e]?t[e]:n.getAttribute(e)},set:function(t,e,r){return n.setAttribute(e,r),!0}})),n}return v(e,t),a(e,[{key:"destroy",value:function(){Un(e,"destroy",this)([]),this.getAnimations().forEach(function(t){t.cancel()})}},{key:"cloneNode",value:function(t,e){var n=o({},this.attributes);for(var r in n){var i=n[r];Ra(i)&&"clipPath"!==r&&"offsetPath"!==r&&"textPath"!==r&&(n[r]=i.cloneNode(t)),e&&(n[r]=e(r,i))}var A=new this.constructor(o(o({},this.config),{},{style:n}));return A.setLocalTransform(this.getLocalTransform()),t&&this.children.forEach(function(e){if(!e.style.isMarker){var n=e.cloneNode(t);A.appendChild(n)}}),A}},{key:"initAttributes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};Ua.styleValueRegistry.processProperties(this,t,{forceUpdateGeometry:!0}),this.dirty()}},{key:"setAttribute",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];de(n)||(r||n!==this.attributes[t])&&(this.internalSetAttribute(t,n,{memoize:i}),Un(e,"setAttribute",this)([t,n]))}},{key:"setAttributes",value:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.skipDispatchAttrModifiedEvent,A=void 0!==i&&i;if(A||(e=o({},this.attributes),n=o({},this.parsedStyle)),Ua.styleValueRegistry.processProperties(this,t,r),this.dirty(),!A)for(var s in t)this.dispatchAttrModifiedEvent(s,e[s],t[s],n[s])}},{key:"internalSetAttribute",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this.attributes[t],o=this.parsedStyle[t];Ua.styleValueRegistry.processProperties(this,r({},t,e),n),this.dirty(),this.dispatchAttrModifiedEvent(t,i,e,o)}},{key:"dispatchAttrModifiedEvent",value:function(t,e,n,r){var i,o=this.parsedStyle[t];if(this.isConnected)if(_a.relatedNode=this,_a.prevValue=e,_a.newValue=n,_a.attrName=t,_a.prevParsedValue=r,_a.newParsedValue=o,this.isMutationObserved)this.dispatchEvent(_a);else{var A,s=!0===(null===(A=this.ownerDocument.defaultView.getConfig().future)||void 0===A?void 0:A.experimentalCancelEventPropagation);_a.target=this,this.ownerDocument.defaultView.dispatchEvent(_a,!0,s)}(this.isCustomElement&&this.isConnected||!this.isCustomElement)&&(null===(i=this.attributeChangedCallback)||void 0===i||i.call(this,t,e,n,r,o))}},{key:"getBBox",value:function(){var t=this.getBounds(),e=m(t.getMin(),2),n=e[0],r=e[1],i=m(t.getMax(),2),o=i[0],A=i[1];return new xr(n,r,o-n,A-r)}},{key:"setOrigin",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ua.sceneGraphService.setOrigin(this,Sr(t,e,n,!1)),this}},{key:"getOrigin",value:function(){return Ua.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ua.sceneGraphService.setPosition(this,Sr(t,e,n,!1)),this}},{key:"setLocalPosition",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ua.sceneGraphService.setLocalPosition(this,Sr(t,e,n,!1)),this}},{key:"translate",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ua.sceneGraphService.translate(this,Sr(t,e,n,!1)),this}},{key:"translateLocal",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Ua.sceneGraphService.translateLocal(this,Sr(t,e,n,!1)),this}},{key:"getPosition",value:function(){return Ua.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return Ua.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(t,e,n){return this.scaleLocal(t,e,n)}},{key:"scaleLocal",value:function(t,e,n){return"number"==typeof t&&(t=Sr(t,e=e||t,n=n||t,!1)),Ua.sceneGraphService.scaleLocal(this,t),this}},{key:"setLocalScale",value:function(t,e,n){return"number"==typeof t&&(t=Sr(t,e=e||t,n=n||t,!1)),Ua.sceneGraphService.setLocalScale(this,t),this}},{key:"getLocalScale",value:function(){return Ua.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return Ua.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){return Tr(m(Ir(Ga,Ua.sceneGraphService.getWorldTransform(this)),3)[2])}},{key:"getLocalEulerAngles",value:function(){return Tr(m(Ir(Ga,Ua.sceneGraphService.getLocalRotation(this)),3)[2])}},{key:"setEulerAngles",value:function(t){return Ua.sceneGraphService.setEulerAngles(this,0,0,t),this}},{key:"setLocalEulerAngles",value:function(t){return Ua.sceneGraphService.setLocalEulerAngles(this,0,0,t),this}},{key:"rotateLocal",value:function(t,e,n){return Kt(e)&&Kt(n)?Ua.sceneGraphService.rotateLocal(this,0,0,t):Ua.sceneGraphService.rotateLocal(this,t,e,n),this}},{key:"rotate",value:function(t,e,n){return Kt(e)&&Kt(n)?Ua.sceneGraphService.rotate(this,0,0,t):Ua.sceneGraphService.rotate(this,t,e,n),this}},{key:"setRotation",value:function(t,e,n,r){return Ua.sceneGraphService.setRotation(this,t,e,n,r),this}},{key:"setLocalRotation",value:function(t,e,n,r){return Ua.sceneGraphService.setLocalRotation(this,t,e,n,r),this}},{key:"setLocalSkew",value:function(t,e){return Ua.sceneGraphService.setLocalSkew(this,t,e),this}},{key:"getRotation",value:function(){return Ua.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return Ua.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return Ua.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return Ua.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return Ua.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(t){return Ua.sceneGraphService.setLocalTransform(this,t),this}},{key:"resetLocalTransform",value:function(){Ua.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(t,e){var n,r=null===(n=this.ownerDocument)||void 0===n?void 0:n.timeline;return r?r.play(this,t,e):null}},{key:"isVisible",value:function(){var t;return"hidden"!==(null===(t=this.parsedStyle)||void 0===t?void 0:t.visibility)}},{key:"interactive",get:function(){return this.isInteractive()},set:function(t){this.style.pointerEvents=t?"auto":"none"}},{key:"isInteractive",value:function(){var t;return"none"!==(null===(t=this.parsedStyle)||void 0===t?void 0:t.pointerEvents)}},{key:"isCulled",value:function(){return!(!this.cullable||!this.cullable.enable||this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,u(this.parentNode.children.map(function(t){return Number(t.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,u(this.parentNode.children.map(function(t){return Number(t.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var t=this,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var i=n[0],o=n[1];return i?zt(i)?(Object.keys(i).forEach(function(e){t.setAttribute(e,i[e])}),this):2===n.length?(this.setAttribute(i,o),this):this.attributes[i]:this.attributes}},{key:"getMatrix",value:function(t){var e=t||this.getWorldTransform(),n=m(V(Ga,e),2),r=n[0],i=n[1],o=m(W(Ga,e),2),A=o[0],s=o[1],a=Y(Ka,e),c=m(Ir(Ga,a),3),l=c[0],u=c[2];return Lr(l||u,r,i,A,s)}},{key:"getLocalMatrix",value:function(){return this.getMatrix(this.getLocalTransform())}},{key:"setMatrix",value:function(t){var e=m(Pr(t),5),n=e[0],r=e[1],i=e[2],o=e[3],A=e[4];this.setEulerAngles(A).setPosition(n,r).setLocalScale(i,o)}},{key:"setLocalMatrix",value:function(t){var e=m(Pr(t),5),n=e[0],r=e[1],i=e[2],o=e[3],A=e[4];this.setLocalEulerAngles(A).setLocalPosition(n,r).setLocalScale(i,o)}},{key:"show",value:function(){this.forEach(function(t){t.style.visibility="visible"})}},{key:"hide",value:function(){this.forEach(function(t){t.style.visibility="hidden"})}},{key:"getCount",value:function(){return this.childElementCount}},{key:"getParent",value:function(){return this.parentElement}},{key:"getChildren",value:function(){return this.children}},{key:"getFirst",value:function(){return this.firstElementChild}},{key:"getLast",value:function(){return this.lastElementChild}},{key:"getChildByIndex",value:function(t){return this.children[t]||null}},{key:"add",value:function(t,e){return this.appendChild(t,e)}},{key:"set",value:function(t,e){this.config[t]=e}},{key:"get",value:function(t){return this.config[t]}},{key:"moveTo",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.setPosition(t,e,n),this}},{key:"move",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.setPosition(t,e,n),this}},{key:"setZIndex",value:function(t){return this.style.zIndex=t,this}}])}(Da);ja.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var za=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),g(this,e,[o({type:cr.CIRCLE},t)])}return v(e,t),a(e)}(ja);za.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var Va=["style"],Wa=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=ar(n,Va);return A(this,e),(t=g(this,e,[o({style:r},i)])).isCustomElement=!0,t}return v(e,t),a(e)}(ja);Wa.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var Ya=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),g(this,e,[o({type:cr.ELLIPSE},t)])}return v(e,t),a(e)}(ja);Ya.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"])),(function(t){function e(){return A(this,e),g(this,e,[{type:cr.FRAGMENT}])}return v(e,t),a(e)}(ja)).PARSED_STYLE_LIST=new Set(["class","className"]);var Xa=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),g(this,e,[o({type:cr.GROUP},t)])}return v(e,t),a(e)}(ja);Xa.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var qa=["style"],$a=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=ar(n,qa);return A(this,e),(t=g(this,e,[o({type:cr.HTML,style:r},i)])).cullable.enable=!1,t}return v(e,t),a(e,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var t=N(C(),this.parentNode.getWorldTransform()),e=this.getBounds();if(!yr.isEmpty(e)){var n=new yr;return n.setFromTransformedAABB(e,t),n}}return this.getBounds()}}])}(ja);$a.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Za=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),g(this,e,[o({type:cr.IMAGE},t)])}return v(e,t),a(e)}(ja);Za.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var Ja=["style"],tc=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=ar(n,Ja);A(this,e),(t=g(this,e,[o({type:cr.LINE,style:o({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},r)},i)])).markerStartAngle=0,t.markerEndAngle=0;var s=t.parsedStyle,a=s.markerStart,c=s.markerEnd;return a&&Ra(a)&&(t.markerStartAngle=a.getLocalEulerAngles(),t.appendChild(a)),c&&Ra(c)&&(t.markerEndAngle=c.getLocalEulerAngles(),t.appendChild(c)),t.transformMarker(!0),t.transformMarker(!1),t}return v(e,t),a(e,[{key:"attributeChangedCallback",value:function(t,e,n,r,i){"x1"===t||"y1"===t||"x2"===t||"y2"===t||"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Ra(r)&&(this.markerStartAngle=0,r.remove()),i&&Ra(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t&&(r&&Ra(r)&&(this.markerEndAngle=0,r.remove()),i&&Ra(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1)))}},{key:"transformMarker",value:function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,A=e.x1,s=e.x2,a=e.y1,c=e.y2,l=t?n:r;if(l&&Ra(l)){var u,h,d,f,g,p,v;t?(f=A,g=a,h=s-A,d=c-a,p=i||0,v=this.markerStartAngle):(f=s,g=c,h=A-s,d=a-c,p=o||0,v=this.markerEndAngle),u=Math.atan2(d,h),l.setLocalEulerAngles(180*u/Math.PI+v),l.setLocalPosition(f+Math.cos(u)*p,g+Math.sin(u)*p)}}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.parsedStyle,r=Rn(n.x1,n.y1,n.x2,n.y2,t),i=r.x,o=r.y,A=bt(at(),ut(i,o,0),e?this.getWorldTransform():this.getLocalTransform());return new Er(A[0],A[1])}},{key:"getPointAtLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.getPoint(t/this.getTotalLength(),e)}},{key:"getTotalLength",value:function(){var t=this.parsedStyle;return Dn(t.x1,t.y1,t.x2,t.y2)}}])}(ja);tc.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var ec=["style"],nc=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=ar(n,ec);A(this,e),(t=g(this,e,[o({type:cr.PATH,style:r,initialParsedStyle:{miterLimit:4,d:o({},ni)}},i)])).markerStartAngle=0,t.markerEndAngle=0,t.markerMidList=[];var s=t.parsedStyle,a=s.markerStart,c=s.markerEnd,l=s.markerMid;return a&&Ra(a)&&(t.markerStartAngle=a.getLocalEulerAngles(),t.appendChild(a)),l&&Ra(l)&&t.placeMarkerMid(l),c&&Ra(c)&&(t.markerEndAngle=c.getLocalEulerAngles(),t.appendChild(c)),t.transformMarker(!0),t.transformMarker(!1),t}return v(e,t),a(e,[{key:"attributeChangedCallback",value:function(t,e,n,r,i){"d"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Ra(r)&&(this.markerStartAngle=0,r.remove()),i&&Ra(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Ra(r)&&(this.markerEndAngle=0,r.remove()),i&&Ra(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)}},{key:"transformMarker",value:function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,A=t?n:r;if(A&&Ra(A)){var s,a,c,l,u,h,d;if(t){var f=m(this.getStartTangent(),2),g=f[0],p=f[1];l=p[0],u=p[1],a=g[0]-p[0],c=g[1]-p[1],h=i||0,d=this.markerStartAngle}else{var v=m(this.getEndTangent(),2),y=v[0],w=v[1];l=w[0],u=w[1],a=y[0]-w[0],c=y[1]-w[1],h=o||0,d=this.markerEndAngle}s=Math.atan2(c,a),A.setLocalEulerAngles(180*s/Math.PI+d),A.setLocalPosition(l+Math.cos(s)*h,u+Math.sin(s)*h)}}},{key:"placeMarkerMid",value:function(t){var e=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(t){t.remove()}),t&&Ra(t))for(var n=1;n<e.length-1;n++){var r=m(e[n].currentPoint,2),i=r[0],o=r[1],A=1===n?t:t.cloneNode(!0);this.markerMidList.push(A),this.appendChild(A),A.setLocalPosition(i,o)}}},{key:"getTotalLength",value:function(){return Go(this)}},{key:"getPointAtLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=function(t,e,n){return xn(t,e,Le(Le({},n),{bbox:!1,length:!0})).point}(this.parsedStyle.d.absolutePath,t),r=n.x,i=n.y,o=bt(at(),ut(r,i,0),e?this.getWorldTransform():this.getLocalTransform());return new Er(o[0],o[1])}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.getPointAtLength(t*Go(this),e)}},{key:"getStartTangent",value:function(){var t=this.parsedStyle.d.segments,e=[];if(t.length>1){var n=t[0].currentPoint,r=t[1].currentPoint,i=t[1].startTangent;e=[],i?(e.push([n[0]-i[0],n[1]-i[1]]),e.push([n[0],n[1]])):(e.push([r[0],r[1]]),e.push([n[0],n[1]]))}return e}},{key:"getEndTangent",value:function(){var t=this.parsedStyle.d.segments,e=t.length,n=[];if(e>1){var r=t[e-2].currentPoint,i=t[e-1].currentPoint,o=t[e-1].endTangent;n=[],o?(n.push([i[0]-o[0],i[1]-o[1]]),n.push([i[0],i[1]])):(n.push([r[0],r[1]]),n.push([i[0],i[1]]))}return n}}])}(ja);nc.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var rc=["style"],ic=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.style,i=ar(n,rc);A(this,e),(t=g(this,e,[o({type:cr.POLYGON,style:r,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},i)])).markerStartAngle=0,t.markerEndAngle=0,t.markerMidList=[];var s=t.parsedStyle,a=s.markerStart,c=s.markerEnd,l=s.markerMid;return a&&Ra(a)&&(t.markerStartAngle=a.getLocalEulerAngles(),t.appendChild(a)),l&&Ra(l)&&t.placeMarkerMid(l),c&&Ra(c)&&(t.markerEndAngle=c.getLocalEulerAngles(),t.appendChild(c)),t.transformMarker(!0),t.transformMarker(!1),t}return v(e,t),a(e,[{key:"attributeChangedCallback",value:function(t,e,n,r,i){"points"===t?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):"markerStartOffset"===t||"markerEndOffset"===t?(this.transformMarker(!0),this.transformMarker(!1)):"markerStart"===t?(r&&Ra(r)&&(this.markerStartAngle=0,r.remove()),i&&Ra(i)&&(this.markerStartAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!0))):"markerEnd"===t?(r&&Ra(r)&&(this.markerEndAngle=0,r.remove()),i&&Ra(i)&&(this.markerEndAngle=i.getLocalEulerAngles(),this.appendChild(i),this.transformMarker(!1))):"markerMid"===t&&this.placeMarkerMid(i)}},{key:"transformMarker",value:function(t){var e=this.parsedStyle,n=e.markerStart,r=e.markerEnd,i=e.markerStartOffset,o=e.markerEndOffset,A=(e.points||{}).points,s=t?n:r;if(s&&Ra(s)&&A){var a,c,l,u,h,d,f;if(u=A[0][0],h=A[0][1],t)c=A[1][0]-A[0][0],l=A[1][1]-A[0][1],d=i||0,f=this.markerStartAngle;else{var g=A.length;this.parsedStyle.isClosed?(c=A[g-1][0]-A[0][0],l=A[g-1][1]-A[0][1]):(u=A[g-1][0],h=A[g-1][1],c=A[g-2][0]-A[g-1][0],l=A[g-2][1]-A[g-1][1]),d=o||0,f=this.markerEndAngle}a=Math.atan2(l,c),s.setLocalEulerAngles(180*a/Math.PI+f),s.setLocalPosition(u+Math.cos(a)*d,h+Math.sin(a)*d)}}},{key:"placeMarkerMid",value:function(t){var e=(this.parsedStyle.points||{}).points;if(this.markerMidList.forEach(function(t){t.remove()}),this.markerMidList=[],t&&Ra(t)&&e)for(var n=1;n<(this.parsedStyle.isClosed?e.length:e.length-1);n++){var r=e[n][0],i=e[n][1],o=1===n?t:t.cloneNode(!0);this.markerMidList.push(o),this.appendChild(o),o.setLocalPosition(r,i)}}}])}(ja);ic.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var oc=["style"],Ac=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.style,r=ar(t,oc);return A(this,e),g(this,e,[o({type:cr.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},r)])}return v(e,t),a(e,[{key:"getTotalLength",value:function(){return 0===(t=this).parsedStyle.points.totalLength&&(t.parsedStyle.points.totalLength=zn(t.parsedStyle.points.points)),t.parsedStyle.points.totalLength;var t}},{key:"getPointAtLength",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.getPoint(t/this.getTotalLength(),e)}},{key:"getPoint",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.parsedStyle.points.points;if(0===this.parsedStyle.points.segments.length){var r,i,o=[],A=0,s=this.getTotalLength();n.forEach(function(t,e){n[e+1]&&((r=[0,0])[0]=A/s,i=Dn(t[0],t[1],n[e+1][0],n[e+1][1]),A+=i,r[1]=A/s,o.push(r))}),this.parsedStyle.points.segments=o}var a=0,c=0;this.parsedStyle.points.segments.forEach(function(e,n){t>=e[0]&&t<=e[1]&&(a=(t-e[0])/(e[1]-e[0]),c=n)});var l=Rn(n[c][0],n[c][1],n[c+1][0],n[c+1][1],a),u=l.x,h=l.y,d=bt(at(),ut(u,h,0),e?this.getWorldTransform():this.getLocalTransform());return new Er(d[0],d[1])}},{key:"getStartTangent",value:function(){var t=this.parsedStyle.points.points,e=[];return e.push([t[1][0],t[1][1]]),e.push([t[0][0],t[0][1]]),e}},{key:"getEndTangent",value:function(){var t=this.parsedStyle.points.points,e=t.length-1,n=[];return n.push([t[e-1][0],t[e-1][1]]),n.push([t[e][0],t[e][1]]),n}}])}(ic);Ac.PARSED_STYLE_LIST=new Set([].concat(u(ic.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var sc=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),g(this,e,[o({type:cr.RECT},t)])}return v(e,t),a(e)}(ja);sc.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var ac=["style"],cc=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.style,r=ar(t,ac);return A(this,e),g(this,e,[o({type:cr.TEXT,style:o({fill:"black"},n)},r)])}return v(e,t),a(e,[{key:"getComputedTextLength",value:function(){var t;return this.getGeometryBounds(),(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var t;return this.getGeometryBounds(),(null===(t=this.parsedStyle.metrics)||void 0===t?void 0:t.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(ja);cc.PARSED_STYLE_LIST=new Set([].concat(u(ja.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textDecorationThickness","textPathSide","textPathStartOffset","metrics","dx","dy"]));var lc=function(){return a(function t(){A(this,t),this.registry={},this.define(cr.CIRCLE,za),this.define(cr.ELLIPSE,Ya),this.define(cr.RECT,sc),this.define(cr.IMAGE,Za),this.define(cr.LINE,tc),this.define(cr.GROUP,Xa),this.define(cr.PATH,nc),this.define(cr.POLYGON,ic),this.define(cr.POLYLINE,Ac),this.define(cr.TEXT,cc),this.define(cr.HTML,$a)},[{key:"define",value:function(t,e){this.registry[t]=e}},{key:"get",value:function(t){return this.registry[t]}}])}(),uc=function(t){var e=t.name,n=t.inherits,r=t.interpolable,i=t.initialValue,o=t.syntax;Ua.styleValueRegistry.registerMetadata({n:e,inh:n,int:r,d:i,syntax:o})},hc=function(t){function e(){var t;A(this,e),(t=g(this,e)).defaultView=null,t.ownerDocument=null,t.nodeName="document";try{t.timeline=new Ua.AnimationTimeline(t)}catch(t){}var n={};return xA.forEach(function(t){var e=t.n,r=t.inh,i=t.d;r&&i&&(n[e]=Gt(i)?i(cr.GROUP):i)}),t.documentElement=new Xa({id:"g-root",style:n}),t.documentElement.ownerDocument=t,t.documentElement.parentNode=t,t.childNodes=[t.documentElement],t}return v(e,t),a(e,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(t,e){if("svg"===t)return this.documentElement;var n=this.defaultView.customElements.get(t);n||(console.warn("Unsupported tagName: ",t),n="tspan"===t?cc:Xa);var r=new n(e);return r.ownerDocument=this,r}},{key:"createElementNS",value:function(t,e,n){return this.createElement(e,n)}},{key:"cloneNode",value:function(t){throw new Error(Cr)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(t){}}},{key:"elementsFromBBox",value:function(t,e,n,r){var i=[],o=function(A){if(A.isInteractive()&&!A.isCulled()){var s=A.parsedStyle.pointerEvents;if(!["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(void 0===s?"auto":s)||A.isVisible()){var a=A.getTransformedGeometryBounds(!0);a&&!yr.isEmpty(a)&&a.max[0]>=t&&a.min[0]<=n&&a.max[1]>=e&&a.min[1]<=r&&i.push(A)}A.childNodes&&A.childNodes.forEach(function(t){t instanceof ja&&o(t)})}};return o(this.documentElement),i.sort(function(t,e){return e.sortable.renderOrder-t.sortable.renderOrder}),i}},{key:"elementFromPointSync",value:function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),A=o.width,s=o.height;if(r<0||i<0||r>A||i>s)return null;var a=this.defaultView.viewport2Client({x:r,y:i}),c=a.x,l=a.y,u=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:c,clientY:l},picked:[]}).picked;return u&&u[0]||this.documentElement}},{key:"elementFromPoint",value:(r=Ar(ir().mark(function t(e,n){var r,i,o,A,s,a,c,l,u,h,d;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.defaultView.canvas2Viewport({x:e,y:n}),i=r.x,o=r.y,A=this.defaultView.getConfig(),s=A.width,a=A.height,!(i<0||o<0||i>s||o>a)){t.next=1;break}return t.abrupt("return",null);case 1:return c=this.defaultView.viewport2Client({x:i,y:o}),l=c.x,u=c.y,t.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:e,y:n,viewportX:i,viewportY:o,clientX:l,clientY:u},picked:[]});case 2:return h=t.sent,d=h.picked,t.abrupt("return",d&&d[0]||this.documentElement);case 3:case"end":return t.stop()}},t,this)})),function(t,e){return r.apply(this,arguments)})},{key:"elementsFromPointSync",value:function(t,e){var n=this.defaultView.canvas2Viewport({x:t,y:e}),r=n.x,i=n.y,o=this.defaultView.getConfig(),A=o.width,s=o.height;if(r<0||i<0||r>A||i>s)return[];var a=this.defaultView.viewport2Client({x:r,y:i}),c=a.x,l=a.y,u=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:t,y:e,viewportX:r,viewportY:i,clientX:c,clientY:l},picked:[]}).picked;return u[u.length-1]!==this.documentElement&&u.push(this.documentElement),u}},{key:"elementsFromPoint",value:(n=Ar(ir().mark(function t(e,n){var r,i,o,A,s,a,c,l,u,h,d;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r=this.defaultView.canvas2Viewport({x:e,y:n}),i=r.x,o=r.y,A=this.defaultView.getConfig(),s=A.width,a=A.height,!(i<0||o<0||i>s||o>a)){t.next=1;break}return t.abrupt("return",[]);case 1:return c=this.defaultView.viewport2Client({x:i,y:o}),l=c.x,u=c.y,t.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:e,y:n,viewportX:i,viewportY:o,clientX:l,clientY:u},picked:[]});case 2:return h=t.sent,(d=h.picked)[d.length-1]!==this.documentElement&&d.push(this.documentElement),t.abrupt("return",d);case 3:case"end":return t.stop()}},t,this)})),function(t,e){return n.apply(this,arguments)})},{key:"appendChild",value:function(t,e){throw new Error(Mr)}},{key:"insertBefore",value:function(t,e){throw new Error(Mr)}},{key:"removeChild",value:function(t,e){throw new Error(Mr)}},{key:"replaceChild",value:function(t,e,n){throw new Error(Mr)}},{key:"append",value:function(){throw new Error(Mr)}},{key:"prepend",value:function(){throw new Error(Mr)}},{key:"getElementById",value:function(t){return this.documentElement.getElementById(t)}},{key:"getElementsByName",value:function(t){return this.documentElement.getElementsByName(t)}},{key:"getElementsByTagName",value:function(t){return this.documentElement.getElementsByTagName(t)}},{key:"getElementsByClassName",value:function(t){return this.documentElement.getElementsByClassName(t)}},{key:"querySelector",value:function(t){return this.documentElement.querySelector(t)}},{key:"querySelectorAll",value:function(t){return this.documentElement.querySelectorAll(t)}},{key:"find",value:function(t){return this.documentElement.find(t)}},{key:"findAll",value:function(t){return this.documentElement.findAll(t)}}]);var n,r}(Ys),dc=function(){function t(e){A(this,t),this.strategies=e}return a(t,[{key:"apply",value:function(e){var n=e.config,r=e.camera,i=e.renderingService,o=e.renderingContext,A=this.strategies;i.hooks.cull.tap(t.tag,function(t){if(t){var e,i=t.cullable;if(0===A.length?i.visible=o.unculledEntities.indexOf(t.entity)>-1:i.visible=A.every(function(e){return e.isVisible(r,t)}),!t.isCulled()&&t.isVisible())return t;var s=!0===(null===(e=n.future)||void 0===e?void 0:e.experimentalCancelEventPropagation);return t.dispatchEvent(new Vs(ea.CULLED),s,s),null}return t}),i.hooks.afterRender.tap(t.tag,function(t){t.cullable.visibilityPlaneMask=-1})}}])}();dc.tag="Culling";var fc=function(){function t(){var e=this;A(this,t),this.autoPreventDefault=!1,this.rootPointerEvent=new js(null),this.rootWheelEvent=new zs(null),this.onPointerMove=function(t){var n,r=null===(n=e.context.renderingContext.root)||void 0===n||null===(n=n.ownerDocument)||void 0===n?void 0:n.defaultView;if(!r.supportsTouchEvents||"touch"!==t.pointerType){var i,o=sr(e.normalizeToPointerEvent(t,r));try{for(o.s();!(i=o.n()).done;){var A=i.value,s=e.bootstrapEvent(e.rootPointerEvent,A,r,t);e.context.eventService.mapEvent(s)}}catch(t){o.e(t)}finally{o.f()}e.setCursor(e.context.eventService.cursor)}},this.onClick=function(t){var n,r,i=null===(n=e.context.renderingContext.root)||void 0===n||null===(n=n.ownerDocument)||void 0===n?void 0:n.defaultView,o=sr(e.normalizeToPointerEvent(t,i));try{for(o.s();!(r=o.n()).done;){var A=r.value,s=e.bootstrapEvent(e.rootPointerEvent,A,i,t);e.context.eventService.mapEvent(s)}}catch(t){o.e(t)}finally{o.f()}e.setCursor(e.context.eventService.cursor)}}return a(t,[{key:"apply",value:function(e){var n=this;this.context=e;var r=e.renderingService,i=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(t){return n.context.renderingService.hooks.pickSync.call({position:t,picked:[],topmost:!0}).picked[0]||null}),r.hooks.pointerWheel.tap(t.tag,function(t){var e=n.normalizeWheelEvent(t);n.context.eventService.mapEvent(e)}),r.hooks.pointerDown.tap(t.tag,function(t){if(!i.supportsTouchEvents||"touch"!==t.pointerType){var e=n.normalizeToPointerEvent(t,i);if(n.autoPreventDefault&&e[0].isNormalized)(t.cancelable||!("cancelable"in t))&&t.preventDefault();var r,o=sr(e);try{for(o.s();!(r=o.n()).done;){var A=r.value,s=n.bootstrapEvent(n.rootPointerEvent,A,i,t);n.context.eventService.mapEvent(s)}}catch(t){o.e(t)}finally{o.f()}n.setCursor(n.context.eventService.cursor)}}),r.hooks.pointerUp.tap(t.tag,function(t){if(!i.supportsTouchEvents||"touch"!==t.pointerType){var e,r=n.context.contextService.getDomElement(),o=n.context.eventService.isNativeEventFromCanvas(r,t)?"":"outside",A=sr(n.normalizeToPointerEvent(t,i));try{for(A.s();!(e=A.n()).done;){var s=e.value,a=n.bootstrapEvent(n.rootPointerEvent,s,i,t);a.type+=o,n.context.eventService.mapEvent(a)}}catch(t){A.e(t)}finally{A.f()}n.setCursor(n.context.eventService.cursor)}}),r.hooks.pointerMove.tap(t.tag,this.onPointerMove),r.hooks.pointerOver.tap(t.tag,this.onPointerMove),r.hooks.pointerOut.tap(t.tag,this.onPointerMove),r.hooks.click.tap(t.tag,this.onClick),r.hooks.pointerCancel.tap(t.tag,function(t){var e,r=sr(n.normalizeToPointerEvent(t,i));try{for(r.s();!(e=r.n()).done;){var o=e.value,A=n.bootstrapEvent(n.rootPointerEvent,o,i,t);n.context.eventService.mapEvent(A)}}catch(t){r.e(t)}finally{r.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),o=i.x,A=i.y;t.viewport.x=o,t.viewport.y=A;var s=this.context.eventService.viewport2Canvas(t.viewport),a=s.x,c=s.y;return t.canvas.x=a,t.canvas.y=c,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t.type.startsWith("mouse")&&(t.type=t.type.replace("mouse","pointer")),t.type.startsWith("touch")&&(t.type=ZA[t.type]||t.type),t}},{key:"normalizeWheelEvent",value:function(t){var e=this.rootWheelEvent;this.transferMouseData(e,t),e.deltaMode=t.deltaMode,e.deltaX=t.deltaX,e.deltaY=t.deltaY,e.deltaZ=t.deltaZ;var n=this.context.eventService.client2Viewport({x:t.clientX,y:t.clientY}),r=n.x,i=n.y;e.viewport.x=r,e.viewport.y=i;var o=this.context.eventService.viewport2Canvas(e.viewport),A=o.x,s=o.y;return e.canvas.x=A,e.canvas.y=s,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.nativeEvent=t,e.type=t.type,e}},{key:"transferMouseData",value:function(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=JA.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}},{key:"setCursor",value:function(t){this.context.contextService.applyCursorStyle(t||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(t,e){var n=[];if(e.isTouchEvent(t))for(var r=0;r<t.changedTouches.length;r++){var i=t.changedTouches[r];de(i.button)&&(i.button=0),de(i.buttons)&&(i.buttons=1),de(i.isPrimary)&&(i.isPrimary=1===t.touches.length&&"touchstart"===t.type),de(i.width)&&(i.width=i.radiusX||1),de(i.height)&&(i.height=i.radiusY||1),de(i.tiltX)&&(i.tiltX=0),de(i.tiltY)&&(i.tiltY=0),de(i.pointerType)&&(i.pointerType="touch"),de(i.pointerId)&&(i.pointerId=i.identifier||0),de(i.pressure)&&(i.pressure=i.force||.5),de(i.twist)&&(i.twist=0),de(i.tangentialPressure)&&(i.tangentialPressure=0),i.isNormalized=!0,i.type=t.type,n.push(i)}else if(e.isMouseEvent(t)){var o=t;de(o.isPrimary)&&(o.isPrimary=!0),de(o.width)&&(o.width=1),de(o.height)&&(o.height=1),de(o.tiltX)&&(o.tiltX=0),de(o.tiltY)&&(o.tiltY=0),de(o.pointerType)&&(o.pointerType="mouse"),de(o.pointerId)&&(o.pointerId=1),de(o.pressure)&&(o.pressure=.5),de(o.twist)&&(o.twist=0),de(o.tangentialPressure)&&(o.tangentialPressure=0),o.isNormalized=!0,n.push(o)}else n.push(t);return n}}])}();fc.tag="Event";var gc=[cr.CIRCLE,cr.ELLIPSE,cr.IMAGE,cr.RECT,cr.LINE,cr.POLYLINE,cr.POLYGON,cr.TEXT,cr.PATH,cr.HTML],pc=function(){return a(function t(){A(this,t)},[{key:"isVisible",value:function(t,e){var n,r=e.cullable;if(!r.enable)return!0;var i=e.getRenderBounds();if(yr.isEmpty(i))return!1;var o=t.getFrustum(),A=null===(n=e.parentNode)||void 0===n||null===(n=n.cullable)||void 0===n?void 0:n.visibilityPlaneMask;return r.visibilityPlaneMask=this.computeVisibilityWithPlaneMask(e,i,A||br.INDETERMINATE,o.planes),r.visible=r.visibilityPlaneMask!==br.OUTSIDE,r.visible}},{key:"computeVisibilityWithPlaneMask",value:function(t,e,n,r){if(n===br.OUTSIDE||n===br.INSIDE)return n;for(var i=br.INSIDE,o=gc.indexOf(t.nodeName)>-1,A=0,s=r.length;A<s;++A){var a=1<<A;if(0!==(n&a)&&(!o||4!==A&&5!==A)){var c=r[A],l=c.normal,u=c.distance;if(mt(l,e.getPositiveFarPoint(r[A]))+u<0)return br.OUTSIDE;mt(l,e.getNegativeFarPoint(r[A]))+u<0&&(i|=a)}}return i}}])}(),vc=function(){function t(){A(this,t),this.mutationRecords=[],this.isFirstTimeRendering=!0,this.isFirstTimeRenderingFinished=!1}return a(t,[{key:"apply",value:function(e){var n,r=this,i=e.renderingService,o=e.renderingContext.root.ownerDocument.defaultView,A=function(t){i.dirty()},s=function(t){var e,n=t.detail;(e=r.mutationRecords).push.apply(e,u(n)),i.dirty()},a=function(t){var e=t.target;Ua.enableSizeAttenuation&&Ua.styleValueRegistry.updateSizeAttenuation(e,o.getCamera().getZoom())},c=function(t){var e=t.target;Ua.sceneGraphService.dirtyToRoot(e),i.dirty()};i.hooks.init.tap(t.tag,function(){o.addEventListener(ea.MOUNTED,a),o.addEventListener(ea.UNMOUNTED,c),o.addEventListener(ea.ATTR_MODIFIED,A),o.addEventListener(ea.BOUNDS_CHANGED,s)}),i.hooks.destroy.tap(t.tag,function(){o.removeEventListener(ea.MOUNTED,a),o.removeEventListener(ea.UNMOUNTED,c),o.removeEventListener(ea.ATTR_MODIFIED,A),o.removeEventListener(ea.BOUNDS_CHANGED,s),r.mutationRecords=[]});var l=null!==(n=Ua.globalThis.requestIdleCallback)&&void 0!==n?n:us.bind(Ua.globalThis);i.hooks.endFrame.tap(t.tag,function(){r.isFirstTimeRendering&&(r.isFirstTimeRendering=!1,l(function(){r.isFirstTimeRenderingFinished=!0})),r.mutationRecords=[]})}}])}();vc.tag="Prepare";var mc=function(t){return t.READY="ready",t.BEFORE_RENDER="beforerender",t.RERENDER="rerender",t.AFTER_RENDER="afterrender",t.BEFORE_DESTROY="beforedestroy",t.AFTER_DESTROY="afterdestroy",t.RESIZE="resize",t.DIRTY_RECTANGLE="dirtyrectangle",t.RENDERER_CHANGED="rendererchanged",t}({}),yc=new Vs(ea.MOUNTED),wc=new Vs(ea.UNMOUNTED),bc=new Vs(mc.BEFORE_RENDER),Bc=new Vs(mc.RERENDER),Ec=new Vs(mc.AFTER_RENDER),xc=function(t){function e(t){var n;A(this,e),(n=g(this,e)).Element=ja,n.inited=!1,n.context={};var r=t.container,i=t.canvas,s=t.renderer,a=t.width,c=t.height,l=t.background,u=t.cursor,h=t.supportsMutipleCanvasesInOneContainer,d=t.cleanUpOnDestroy,f=void 0===d||d,p=t.offscreenCanvas,v=t.devicePixelRatio,m=t.requestAnimationFrame,y=t.cancelAnimationFrame,w=t.createImage,b=t.supportsTouchEvents,B=t.supportsPointerEvents,E=t.isTouchEvent,x=t.isMouseEvent,C=t.dblClickSpeed,M=a,F=c,k=v||WA&&window.devicePixelRatio||1;return k=k>=1?Math.ceil(k):1,i&&(M=a||function(t){var e=$A(t,"width");return"auto"===e?t.offsetWidth:parseFloat(e)}(i)||i.width/k,F=c||function(t){var e=$A(t,"height");return"auto"===e?t.offsetHeight:parseFloat(e)}(i)||i.height/k),n.customElements=new lc,n.devicePixelRatio=k,n.requestAnimationFrame=null!=m?m:us.bind(Ua.globalThis),n.cancelAnimationFrame=null!=y?y:hs.bind(Ua.globalThis),n.createImage=null!=w?w:function(){return new window.Image},n.supportsTouchEvents=null!=b?b:"ontouchstart"in Ua.globalThis,n.supportsPointerEvents=null!=B?B:!!Ua.globalThis.PointerEvent,n.isTouchEvent=null!=E?E:function(t){return n.supportsTouchEvents&&t instanceof Ua.globalThis.TouchEvent},n.isMouseEvent=null!=x?x:function(t){return!Ua.globalThis.MouseEvent||t instanceof Ua.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(t instanceof Ua.globalThis.PointerEvent))},p&&(Ua.offscreenCanvas=p),n.document=new hc,n.document.defaultView=n,h||function(t,e,n){if(t){var r="string"==typeof t?document.getElementById(t):t;VA.has(r)&&VA.get(r).destroy(n),VA.set(r,e)}}(r,n,f),n.initRenderingContext(o(o({},t),{},{width:M,height:F,background:null!=l?l:"transparent",cursor:null!=u?u:"default",cleanUpOnDestroy:f,devicePixelRatio:k,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,createImage:n.createImage,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:null!=C?C:200})),n.initDefaultCamera(M,F,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return v(e,t),a(e,[{key:"initRenderingContext",value:function(t){this.context.config=t,this.context.renderingContext={root:this.document.documentElement,unculledEntities:[],renderListCurrentFrame:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(t,e,n){var r=this,i=new Ua.CameraContribution;i.clipSpaceNearZ=n,i.setType(jr.EXPLORING,zr.DEFAULT).setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0).setOrthographic(t/-2,t/2,e/2,e/-2,.1,1e3),i.canvas=this,i.eventEmitter.on(Wr,function(){r.context.renderingContext.renderReasons.add($s.CAMERA_CHANGED),Ua.enableSizeAttenuation&&r.getConfig().renderer.getConfig().enableSizeAttenuation&&r.updateSizeAttenuation()}),this.context.camera=i}},{key:"updateSizeAttenuation",value:function(){var t=this.getCamera().getZoom();this.document.documentElement.forEach(function(e){Ua.styleValueRegistry.updateSizeAttenuation(e,t)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var t=this;return this.readyPromise||(this.readyPromise=new Promise(function(e){t.resolveReadyPromise=function(){e(t)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1?arguments[1]:void 0;Pi.clearCache();var r=!0===(null===(t=this.getConfig().future)||void 0===t?void 0:t.experimentalCancelEventPropagation);n||this.dispatchEvent(new Vs(mc.BEFORE_DESTROY),r,r),this.frameId&&this.cancelAnimationFrame(this.frameId);var i=this.getRoot();e&&(this.unmountChildren(i),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),n||this.dispatchEvent(new Vs(mc.AFTER_DESTROY),r,r);var o=function(t){t.currentTarget=null,t.manager=null,t.target=null,t.relatedNode=null};o(yc),o(wc),o(bc),o(Bc),o(Ec),o(_a),o(Ia),o(La),o(Pa),Ua.textService.clearCache()}},{key:"changeSize",value:function(t,e){this.resize(t,e)}},{key:"resize",value:function(t,e){var n,r=this.context.config;r.width=t,r.height=e,this.getContextService().resize(t,e);var i=this.context.camera,o=i.getProjectionMode();i.setPosition(t/2,e/2,500).setFocalPoint(t/2,e/2,0),o===Vr.ORTHOGRAPHIC?i.setOrthographic(t/-2,t/2,e/2,e/-2,i.getNear(),i.getFar()):i.setAspect(t/e);var A=!0===(null===(n=r.future)||void 0===n?void 0:n.experimentalCancelEventPropagation);this.dispatchEvent(new Vs(mc.RESIZE,{width:t,height:e}),A,A)}},{key:"appendChild",value:function(t,e){return this.document.documentElement.appendChild(t,e)}},{key:"insertBefore",value:function(t,e){return this.document.documentElement.insertBefore(t,e)}},{key:"removeChild",value:function(t){return this.document.documentElement.removeChild(t)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(t){var e,n=this;t&&(bc.detail=t,Ec.detail=t);var r=!0===(null===(e=this.getConfig().future)||void 0===e?void 0:e.experimentalCancelEventPropagation);this.dispatchEvent(bc,r,r),this.getRenderingService().render(this,t,function(){n.dispatchEvent(Bc,r,r)}),this.dispatchEvent(Ec,r,r)}},{key:"run",value:function(){var t=this,e=function(n,r){t.render(r),t.frameId=t.requestAnimationFrame(e)};e()}},{key:"initRenderer",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new fc,new vc,new dc([new pc])),this.loadRendererContainerModule(t),this.context.contextService=new this.context.ContextService(o(o({},Ua),this.context)),this.context.renderingService=new Zs(Ua,this.context),this.context.eventService=new Xs(Ua,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(t,n,!0)):this.context.contextService.initAsync().then(function(){e.initRenderingService(t,n)}).catch(function(t){console.error(t)})}},{key:"initRenderingService",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.context.renderingService.init(function(){var i;e.inited=!0;var o=!0===(null===(i=e.getConfig().future)||void 0===i?void 0:i.experimentalCancelEventPropagation);n?r?e.requestAnimationFrame(function(){e.dispatchEvent(new Vs(mc.READY),o,o)}):e.dispatchEvent(new Vs(mc.READY),o,o):e.dispatchEvent(new Vs(mc.RENDERER_CHANGED),o,o),e.readyPromise&&e.resolveReadyPromise(),n||e.getRoot().forEach(function(t){var e,n;null===(e=(n=t).dirty)||void 0===e||e.call(n,!0,!0)}),e.mountChildren(e.getRoot()),t.getConfig().enableAutoRendering&&e.run()})}},{key:"loadRendererContainerModule",value:function(t){var e=this;t.getPlugins().forEach(function(t){t.context=e.context,t.init(Ua)})}},{key:"setRenderer",value:function(t){var e=this.getConfig();if(e.renderer!==t){var n=e.renderer;e.renderer=t,this.destroy(!1,!0),u((null==n?void 0:n.getPlugins())||[]).reverse().forEach(function(t){t.destroy(Ua)}),this.initRenderer(t)}}},{key:"setCursor",value:function(t){this.getConfig().cursor=t,this.getContextService().applyCursorStyle(t)}},{key:"unmountChildren",value:function(t){var e=this;if(t.childNodes.forEach(function(t){e.unmountChildren(t)}),this.inited){if(t.isMutationObserved)t.dispatchEvent(wc);else{var n,r=!0===(null===(n=this.getConfig().future)||void 0===n?void 0:n.experimentalCancelEventPropagation);wc.target=t,this.dispatchEvent(wc,!0,r)}t!==this.document.documentElement&&(t.ownerDocument=null),t.isConnected=!1}t.isCustomElement&&t.disconnectedCallback&&t.disconnectedCallback()}},{key:"mountChildren",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ts(t);if(this.inited){if(!t.isConnected&&(t.ownerDocument=this.document,t.isConnected=!0,!n))if(t.isMutationObserved)t.dispatchEvent(yc);else{var r,i=!0===(null===(r=this.getConfig().future)||void 0===r?void 0:r.experimentalCancelEventPropagation);yc.target=t,this.dispatchEvent(yc,!0,i)}}else console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",t.nodeName);t.childNodes.forEach(function(t){e.mountChildren(t,n)}),t.isCustomElement&&t.connectedCallback&&t.connectedCallback()}},{key:"mountFragment",value:function(t){this.mountChildren(t,!1)}},{key:"client2Viewport",value:function(t){return this.getEventService().client2Viewport(t)}},{key:"viewport2Client",value:function(t){return this.getEventService().viewport2Client(t)}},{key:"viewport2Canvas",value:function(t){return this.getEventService().viewport2Canvas(t)}},{key:"canvas2Viewport",value:function(t){return this.getEventService().canvas2Viewport(t)}},{key:"getPointByClient",value:function(t,e){return this.client2Viewport({x:t,y:e})}},{key:"getClientByPoint",value:function(t,e){return this.viewport2Client({x:t,y:e})}}])}(Ws),Cc=function(){return a(function t(){A(this,t),this.cacheStore=new Map},[{key:"onRefAdded",value:function(t){}},{key:"has",value:function(t){return this.cacheStore.has(t)}},{key:"put",value:function(t,e,n){return!this.cacheStore.has(t)&&(this.cacheStore.set(t,{value:e,counter:new Set([n.entity])}),this.onRefAdded(n),!0)}},{key:"get",value:function(t,e){var n=this.cacheStore.get(t);return n?(n.counter.has(e.entity)||(n.counter.add(e.entity),this.onRefAdded(e)),n.value):null}},{key:"update",value:function(t,e,n){var r=this.cacheStore.get(t);return!!r&&(r.value=o(o({},r.value),e),r.counter.has(n.entity)||(r.counter.add(n.entity),this.onRefAdded(n)),!0)}},{key:"release",value:function(t,e){var n=this.cacheStore.get(t);return!!n&&(n.counter.delete(e.entity),n.counter.size<=0&&this.cacheStore.delete(t),!0)}},{key:"releaseRef",value:function(t){var e=this;Array.from(this.cacheStore.keys()).forEach(function(n){e.release(n,t)})}},{key:"getSize",value:function(){return this.cacheStore.size}},{key:"clear",value:function(){this.cacheStore.clear()}}])}(),Mc=[],Fc=[],kc=function(){function t(){A(this,t)}return a(t,null,[{key:"stop",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.api;t.rafId&&(e.cancelAnimationFrame(t.rafId),t.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.api;Mc.length<=0&&Fc.length<=0||(Fc.forEach(function(t){return t()}),Fc=Mc.splice(0,t.TASK_NUM_PER_FRAME),t.rafId=e.requestAnimationFrame(function(){t.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,r,i){for(var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,A=arguments.length>5&&void 0!==arguments[5]?arguments[5]:t.api,s=e.naturalWidth||e.width,a=e.naturalHeight||e.height,c=n-o,l=r-o,u=Math.ceil(s/c),h=Math.ceil(a/l),d={tileSize:[n,r],gridSize:[h,u],tiles:Array(h).fill(null).map(function(){return Array(u).fill(null)})},f=function(t){for(var o=function(o){Mc.push(function(){var u=o*c,h=t*l,f=[Math.min(n,s-u),Math.min(r,a-h)],g=f[0],p=f[1],v=A.createCanvas();v.width=n,v.height=r,v.getContext("2d").drawImage(e,u,h,g,p,0,0,g,p),d.tiles[t][o]={x:u,y:h,tileX:o,tileY:t,data:v},i()})},h=0;h<u;h++)o(h)},g=0;g<h;g++)f(g);return t.stop(),t.executeTask(),d}}])}();kc.TASK_NUM_PER_FRAME=10;var Sc=new Cc;Sc.onRefAdded=function(t){var e=this;t.addEventListener(ea.DESTROY,function(){e.releaseRef(t)},{once:!0})};var Qc=function(){return a(function t(e,n){A(this,t),this.gradientCache={},this.patternCache={},this.context=e,this.runtime=n},[{key:"getImageSync",value:function(t,e,n){var r=Jt(t)?t:t.src;if(Sc.has(r)){var i=Sc.get(r,e);if(i.img.complete)return null==n||n(i),i}return this.getOrCreateImage(t,e).then(function(t){null==n||n(t)}).catch(function(t){console.error(t)}),null}},{key:"getOrCreateImage",value:function(t,e){var n=this,r=Jt(t)?t:t.src;if(!Jt(t)&&!Sc.has(r)){var i={img:t,size:[t.naturalWidth||t.width,t.naturalHeight||t.height],tileSize:Uc(t)};Sc.put(r,i,e)}if(Sc.has(r)){var o=Sc.get(r,e);return o.img.complete?Promise.resolve(o):new Promise(function(t,e){o.img.addEventListener("load",function(){o.size=[o.img.naturalWidth||o.img.width,o.img.naturalHeight||o.img.height],o.tileSize=Uc(o.img),t(o)}),o.img.addEventListener("error",function(t){e(t)})})}return new Promise(function(t,i){var o=n.context.config.createImage();if(o){var A={img:o,size:[0,0],tileSize:Uc(o)};Sc.put(r,A,e),o.onload=function(){A.size=[o.naturalWidth||o.width,o.naturalHeight||o.height],A.tileSize=Uc(A.img),t(A)},o.onerror=function(t){i(t)},o.crossOrigin="Anonymous",o.src=r}})}},{key:"createDownSampledImage",value:(e=Ar(ir().mark(function t(e,n){var r,i,A,s,a,c,l,u,h,d,f,g,p,v;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.getOrCreateImage(e,n);case 1:if(void 0===(r=t.sent).downSamplingRate){t.next=2;break}return t.abrupt("return",r);case 2:if(i=this.context.config.enableLargeImageOptimization,s=(A="boolean"==typeof i?{}:i).maxDownSampledImageSize,a=void 0===s?2048:s,c=A.downSamplingRateThreshold,l=void 0===c?.5:c,u=this.runtime.globalThis.createImageBitmap,h=m(r.size,2),d=h[0],f=h[1],g=r.img,p=Math.min((a+a)/(d+f),Math.max(.01,Math.min(l,.5))),v=o(o({},r),{},{downSamplingRate:p}),Sc.update(r.img.src,v,n),!u){t.next=7;break}return t.prev=3,t.next=4,u(r.img,{resizeWidth:d*p,resizeHeight:f*p});case 4:g=t.sent,t.next=6;break;case 5:t.prev=5,t.catch(3),p=1;case 6:t.next=8;break;case 7:p=1;case 8:return v=o(o({},this.getImageSync(e,n)),{},{downSampled:g,downSamplingRate:p}),Sc.update(r.img.src,v,n),t.abrupt("return",v);case 9:case"end":return t.stop()}},t,this,[[3,5]])})),function(t,n){return e.apply(this,arguments)})},{key:"createImageTiles",value:(t=Ar(ir().mark(function t(e,n,r,i){var A,s,a,c,l;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=1,this.getOrCreateImage(e,i);case 1:return A=t.sent,s=i.ownerDocument.defaultView,a=s.requestAnimationFrame,c=s.cancelAnimationFrame,kc.api={requestAnimationFrame:a,cancelAnimationFrame:c,createCanvas:function(){return qs.createCanvas()}},l=o(o({},A),kc.sliceImage(A.img,A.tileSize[0],A.tileSize[0],r)),Sc.update(A.img.src,l,i),t.abrupt("return",l);case 2:case"end":return t.stop()}},t,this)})),function(e,n,r,i){return t.apply(this,arguments)})},{key:"releaseImage",value:function(t,e){Sc.release(Jt(t)?t:t.src,e)}},{key:"releaseImageRef",value:function(t){Sc.releaseRef(t)}},{key:"getOrCreatePatternSync",value:function(t,e,n,r,i,o,A){var s=this.generatePatternKey(e);if(s&&this.patternCache[s])return this.patternCache[s];var a,c=e.image,l=e.repetition,u=e.transform,h=!1;if(Jt(c)){var d=this.getImageSync(c,t,A);a=null==d?void 0:d.img}else r?(a=r,h=!0):a=c;var f,g=a&&n.createPattern(a,l);g&&(f=u?Ss(lA(u),new ja({})):Q(C()),h&&L(f,f,[1/i,1/i,1]),g.setTransform({a:f[0],b:f[1],c:f[4],d:f[5],e:f[12]+o[0],f:f[13]+o[1]}));return s&&g&&(this.patternCache[s]=g),g}},{key:"getOrCreateGradient",value:function(t,e){var n=this.generateGradientKey(t),r=t.type,i=t.steps,o=t.min,A=t.width,s=t.height,a=t.angle,c=t.cx,l=t.cy,u=t.size;if(this.gradientCache[n])return this.gradientCache[n];var h=null;if(r===Xi.LinearGradient){var d=function(t,e,n,r){var i=Ur(r.value),o=0+e/2,A=0+n/2,s=Math.abs(e*Math.cos(i))+Math.abs(n*Math.sin(i));return{x1:t[0]+o-Math.cos(i)*s/2,y1:t[1]+A-Math.sin(i)*s/2,x2:t[0]+o+Math.cos(i)*s/2,y2:t[1]+A+Math.sin(i)*s/2}}(o,A,s,a),f=d.x1,g=d.y1,p=d.x2,v=d.y2;h=e.createLinearGradient(f,g,p,v)}else if(r===Xi.RadialGradient){var m=function(t,e,n,r,i,o){var A=r.value,s=i.value;r.unit===Di.kPercentage&&(A=r.value/100*e),i.unit===Di.kPercentage&&(s=i.value/100*n);var a=Math.max(gn([0,0],[A,s]),gn([0,n],[A,s]),gn([e,n],[A,s]),gn([e,0],[A,s]));return o&&(o instanceof Ji?a=o.value:o instanceof $i&&("closest-side"===o.value?a=Math.min(A,e-A,s,n-s):"farthest-side"===o.value?a=Math.max(A,e-A,s,n-s):"closest-corner"===o.value&&(a=Math.min(gn([0,0],[A,s]),gn([0,n],[A,s]),gn([e,n],[A,s]),gn([e,0],[A,s]))))),{x:A+t[0],y:s+t[1],r:a}}(o,A,s,c,l,u),y=m.x,w=m.y,b=m.r;h=e.createRadialGradient(y,w,0,y,w,b)}return h&&(i.forEach(function(t){var e,n=t.offset,r=t.color;n.unit===Di.kPercentage&&(null===(e=h)||void 0===e||e.addColorStop(n.value/100,r.toString()))}),this.gradientCache[n]=h),this.gradientCache[n]}},{key:"generateGradientKey",value:function(t){var e=t.type,n=t.min,r=t.width,i=t.height,o=t.steps,A=t.angle,s=t.cx,a=t.cy,c=t.size;return"gradient-".concat(e,"-").concat((null==A?void 0:A.toString())||0,"-").concat((null==s?void 0:s.toString())||0,"-").concat((null==a?void 0:a.toString())||0,"-").concat((null==c?void 0:c.toString())||0,"-").concat(n[0],"-").concat(n[1],"-").concat(r,"-").concat(i,"-").concat(o.map(function(t){var e=t.offset,n=t.color;return"".concat(e).concat(n)}).join("-"))}},{key:"generatePatternKey",value:function(t){var e=t.image,n=t.repetition;return Jt(e)?"pattern-".concat(e,"-").concat(n):"rect"===e.nodeName?"pattern-".concat(e.entity,"-").concat(n):void 0}}]);var t,e}();function Uc(t){if(!t.complete)return[0,0];var e=t.naturalWidth||t.width,n=t.naturalHeight||t.height,r=256;return[256,512].forEach(function(t){Math.ceil(n/t)*Math.ceil(e/t)<1e3&&(r=t)}),[r,r]}Qc.isSupportTile=!!qs.createCanvas();var Nc=function(){function t(){A(this,t)}return a(t,[{key:"apply",value:function(e){var n=e.renderingService,r=e.renderingContext,i=e.imagePool,o=r.root.ownerDocument.defaultView,A=function(t,e,n){var r=t.parsedStyle,i=r.width,o=r.height;i&&!o?t.setAttribute("height",n/e*i):!i&&o&&t.setAttribute("width",e/n*o)},s=function(t){var e=t.target,r=e.nodeName,o=e.attributes;if(r===cr.IMAGE){var s=o.src,a=o.keepAspectRatio;i.getImageSync(s,e,function(t){var r=t.img,i=r.width,o=r.height;a&&A(e,i,o),e.dirty(),n.dirty()})}},a=function(t){var e=t.target,r=t.attrName,o=t.prevValue,s=t.newValue;e.nodeName===cr.IMAGE&&"src"===r&&(o!==s&&i.releaseImage(o,e),Jt(s)&&i.getOrCreateImage(s,e).then(function(t){var r=t.img,i=r.width,o=r.height;e.attributes.keepAspectRatio&&A(e,i,o),e.dirty(),n.dirty()}).catch(function(){}))};n.hooks.init.tap(t.tag,function(){o.addEventListener(ea.MOUNTED,s),o.addEventListener(ea.ATTR_MODIFIED,a)}),n.hooks.destroy.tap(t.tag,function(){o.removeEventListener(ea.MOUNTED,s),o.removeEventListener(ea.ATTR_MODIFIED,a)})}}])}();Nc.tag="LoadImage";var Tc=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).name="image-loader",t}return v(e,t),a(e,[{key:"init",value:function(t){this.context.imagePool=new Qc(this.context,t),this.addRenderingPlugin(new Nc)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(ur),Oc=Object.freeze({__proto__:null,ImagePool:Qc,Plugin:Tc}),Ic=function(){function t(){A(this,t),this.displayObjectHTMLElementMap=new WeakMap}return a(t,[{key:"joinTransformMatrix",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,0,0];return"matrix(".concat([t[0],t[1],t[4],t[5],t[12]+e[0],t[13]+e[1]].join(","),")")}},{key:"apply",value:function(e,n){var r=this,i=e.camera,o=e.renderingContext,A=e.renderingService;this.context=e;var s=o.root.ownerDocument.defaultView,a=s.context.eventService.nativeHTMLMap,c=function(t,e){e.style.transform=r.joinTransformMatrix(t.getWorldTransform(),t.getOrigin())},l=function(t){var e=t.target;if(e.nodeName===cr.HTML){r.$camera||(r.$camera=r.createCamera(i));var n=r.getOrCreateEl(e);r.$camera.appendChild(n),Object.keys(e.attributes).forEach(function(t){r.updateAttribute(t,e)}),c(e,n),a.set(n,e)}},u=function(t){var e=t.target;if(e.nodeName===cr.HTML&&r.$camera){var n=r.getOrCreateEl(e);n&&(n.remove(),a.delete(n))}},h=function(t){var e=t.target;if(e.nodeName===cr.HTML){var n=t.attrName;r.updateAttribute(n,e)}},d=function(t){for(var e=t.detail,n=0;n<e.length;n++){var i=e[n].target;(i.nodeName===cr.FRAGMENT?i.childNodes:[i]).forEach(function(t){if(t.nodeName===cr.HTML){var e=r.getOrCreateEl(t);c(t,e)}})}},f=function(){if(r.$camera){var t=r.context.config,e=t.width,n=t.height;r.$camera.parentElement.style.width="".concat(e||0,"px"),r.$camera.parentElement.style.height="".concat(n||0,"px")}};A.hooks.init.tap(t.tag,function(){s.addEventListener(mc.RESIZE,f),s.addEventListener(ea.MOUNTED,l),s.addEventListener(ea.UNMOUNTED,u),s.addEventListener(ea.ATTR_MODIFIED,h),s.addEventListener(ea.BOUNDS_CHANGED,d)}),A.hooks.endFrame.tap(t.tag,function(){r.$camera&&o.renderReasons.has($s.CAMERA_CHANGED)&&(r.$camera.style.transform=r.joinTransformMatrix(i.getOrthoMatrix()))}),A.hooks.destroy.tap(t.tag,function(){r.$camera&&r.$camera.remove(),s.removeEventListener(mc.RESIZE,f),s.removeEventListener(ea.MOUNTED,l),s.removeEventListener(ea.UNMOUNTED,u),s.removeEventListener(ea.ATTR_MODIFIED,h),s.removeEventListener(ea.BOUNDS_CHANGED,d)})}},{key:"createCamera",value:function(t){var e=this.context.config,n=e.document,r=e.width,i=e.height,o=this.context.contextService.getDomElement(),A=o.parentNode;if(A){var s="g-canvas-camera",a=A.querySelector("#".concat(s));if(!a){var c=(n||document).createElement("div");c.style.overflow="hidden",c.style.pointerEvents="none",c.style.position="absolute",c.style.left="0px",c.style.top="0px",c.style.width="".concat(r||0,"px"),c.style.height="".concat(i||0,"px");var l=(n||document).createElement("div");a=l,l.id=s,l.style.position="absolute",l.style.left="".concat(o.offsetLeft||0,"px"),l.style.top="".concat(o.offsetTop||0,"px"),l.style.transformOrigin="left top",l.style.transform=this.joinTransformMatrix(t.getOrthoMatrix()),l.style.pointerEvents="none",l.style.width="100%",l.style.height="100%",c.appendChild(l),A.appendChild(c)}return a}return null}},{key:"getOrCreateEl",value:function(t){var e=this.context.config.document,n=this.displayObjectHTMLElementMap.get(t);return n||(n=(e||document).createElement("div"),t.parsedStyle.$el=n,this.displayObjectHTMLElementMap.set(t,n),t.id&&(n.id=t.id),t.name&&n.setAttribute("name",t.name),t.className&&(n.className=t.className),n.style.position="absolute",n.style["will-change"]="transform",n.style.transform=this.joinTransformMatrix(t.getWorldTransform(),t.getOrigin())),n}},{key:"updateAttribute",value:function(t,e){var n=this.getOrCreateEl(e);switch(t){case"innerHTML":var r=e.parsedStyle.innerHTML;Jt(r)?n.innerHTML=r:(n.innerHTML="",n.appendChild(r));break;case"x":n.style.left="".concat(e.parsedStyle.x,"px");break;case"y":n.style.top="".concat(e.parsedStyle.y,"px");break;case"transformOrigin":var i=e.parsedStyle.transformOrigin;n.style["transform-origin"]="".concat(i[0].buildCSSText(null,null,"")," ").concat(i[1].buildCSSText(null,null,""));break;case"width":var o=e.parsedStyle.width;n.style.width=re(o)?"".concat(o,"px"):o.toString();break;case"height":var A=e.parsedStyle.height;n.style.height=re(A)?"".concat(A,"px"):A.toString();break;case"zIndex":var s=e.parsedStyle.zIndex;n.style["z-index"]="".concat(s);break;case"visibility":var a=e.parsedStyle.visibility;n.style.visibility=a;break;case"pointerEvents":var c=e.parsedStyle.pointerEvents,l=void 0===c?"auto":c;n.style.pointerEvents=l;break;case"opacity":var u=e.parsedStyle.opacity;n.style.opacity="".concat(u);break;case"fill":var h=e.parsedStyle.fill,d="";bo(h)?d=h.isNone?"transparent":e.getAttribute("fill"):Array.isArray(h)?d=e.getAttribute("fill"):wo(h),n.style.background=d;break;case"stroke":var f=e.parsedStyle.stroke,g="";bo(f)?g=f.isNone?"transparent":e.getAttribute("stroke"):Array.isArray(f)?g=e.getAttribute("stroke"):wo(f),n.style["border-color"]=g,n.style["border-style"]="solid";break;case"lineWidth":var p=e.parsedStyle.lineWidth;n.style["border-width"]="".concat(p||0,"px");break;case"lineDash":n.style["border-style"]="dashed";break;case"filter":var v=e.style.filter;n.style.filter=v;break;default:Kt(e.style[t])||""===e.style[t]||(n.style[t]=e.style[t])}}}])}();Ic.tag="HTMLRendering";var Lc=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).name="html-renderer",t}return v(e,t),a(e,[{key:"init",value:function(){this.addRenderingPlugin(new Ic)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(ur),Pc=Object.freeze({__proto__:null,Plugin:Lc}),Dc=function(){function t(){A(this,t)}return a(t,[{key:"apply",value:function(e,n){var r=this,i=e.renderingService,o=e.renderingContext,A=e.config;this.context=e;var s=o.root.ownerDocument.defaultView,a=function(t){i.hooks.pointerMove.call(t)},c=function(t){i.hooks.pointerUp.call(t)},l=function(t){i.hooks.pointerDown.call(t)},u=function(t){i.hooks.pointerOver.call(t)},h=function(t){i.hooks.pointerOut.call(t)},d=function(t){i.hooks.pointerCancel.call(t)},f=function(t){i.hooks.pointerWheel.call(t)},g=function(t){i.hooks.click.call(t)};i.hooks.init.tap(t.tag,function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="none",t.style.msTouchAction="none"):s.supportsPointerEvents&&(t.style.touchAction="none"),s.supportsPointerEvents?function(t){n.globalThis.document.addEventListener("pointermove",a,!0),t.addEventListener("pointerdown",l,!0),t.addEventListener("pointerleave",h,!0),t.addEventListener("pointerover",u,!0),n.globalThis.addEventListener("pointerup",c,!0),n.globalThis.addEventListener("pointercancel",d,!0)}(t):function(t){n.globalThis.document.addEventListener("mousemove",a,!0),t.addEventListener("mousedown",l,!0),t.addEventListener("mouseout",h,!0),t.addEventListener("mouseover",u,!0),n.globalThis.addEventListener("mouseup",c,!0)}(t),s.supportsTouchEvents&&function(t){t.addEventListener("touchstart",l,!0),t.addEventListener("touchend",c,!0),t.addEventListener("touchmove",a,!0),t.addEventListener("touchcancel",d,!0)}(t),A.useNativeClickEvent&&t.addEventListener("click",g,!0),t.addEventListener("wheel",f,{passive:!0,capture:!0})}),i.hooks.destroy.tap(t.tag,function(){var t=r.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(t.style.msContentZooming="",t.style.msTouchAction=""):s.supportsPointerEvents&&(t.style.touchAction=""),s.supportsPointerEvents?function(t){n.globalThis.document.removeEventListener("pointermove",a,!0),t.removeEventListener("pointerdown",l,!0),t.removeEventListener("pointerleave",h,!0),t.removeEventListener("pointerover",u,!0),n.globalThis.removeEventListener("pointerup",c,!0),n.globalThis.removeEventListener("pointercancel",d,!0)}(t):function(t){n.globalThis.document.removeEventListener("mousemove",a,!0),t.removeEventListener("mousedown",l,!0),t.removeEventListener("mouseout",h,!0),t.removeEventListener("mouseover",u,!0),n.globalThis.removeEventListener("mouseup",c,!0)}(t),s.supportsTouchEvents&&function(t){t.removeEventListener("touchstart",l,!0),t.removeEventListener("touchend",c,!0),t.removeEventListener("touchmove",a,!0),t.removeEventListener("touchcancel",d,!0)}(t),A.useNativeClickEvent&&t.removeEventListener("click",g,!0),t.removeEventListener("wheel",f,!0)})}}])}();Dc.tag="DOMInteraction";var Rc=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).name="dom-interaction",t}return v(e,t),a(e,[{key:"init",value:function(){this.addRenderingPlugin(new Dc)}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}}])}(ur),Hc=Object.freeze({__proto__:null,Plugin:Rc});(function(){function t(){A(this,t)}return a(t,[{key:"apply",value:function(e){var n=e.renderingService,r=e.contextService,i=e.config,o=r.getDomElement(),A=function(t){n.hooks.pointerDown.call(t)},s=function(t){n.hooks.pointerUp.call(t)},a=function(t){n.hooks.pointerMove.call(t)},c=function(t){n.hooks.pointerOver.call(t)},l=function(t){n.hooks.pointerOut.call(t)},u=function(t){n.hooks.click.call(t)},h=function(t){n.hooks.pointerCancel.call(t)};n.hooks.init.tap(t.tag,function(){o.addEventListener("touchstart",A,!0),o.addEventListener("touchend",s,!0),o.addEventListener("touchmove",a,!0),o.addEventListener("touchcancel",h,!0),o.addEventListener("mouseout",l,!0),o.addEventListener("mouseover",c,!0),i.useNativeClickEvent&&o.addEventListener("click",u,!0)}),n.hooks.destroy.tap(t.tag,function(){o.removeEventListener("touchstart",A,!0),o.removeEventListener("touchend",s,!0),o.removeEventListener("touchmove",a,!0),o.removeEventListener("touchcancel",h,!0),o.removeEventListener("mouseout",l,!0),o.removeEventListener("mouseover",c,!0),i.useNativeClickEvent&&o.removeEventListener("click",u,!0)})}}])}()).tag="MobileInteraction";
20
+ /*!
21
+ * html2canvas 1.4.1 <https://html2canvas.hertzen.com>
22
+ * Copyright (c) 2022 Niklas von Hertzen <https://hertzen.com>
23
+ * Released under MIT License
24
+ */
25
+ /*! *****************************************************************************
26
+ Copyright (c) Microsoft Corporation.
27
+
28
+ Permission to use, copy, modify, and/or distribute this software for any
29
+ purpose with or without fee is hereby granted.
30
+
31
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
32
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
33
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
34
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
35
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
36
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
37
+ PERFORMANCE OF THIS SOFTWARE.
38
+ ***************************************************************************** */
39
+ var _c=function(t,e){return _c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},_c(t,e)};function Gc(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}_c(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function Kc(t,e,n,r){return new(n||(n=Promise))(function(e,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function A(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(o,A)}s((r=r.apply(t,[])).next())})}function jc(t,e){var n,r,i,o,A={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;A;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return A.label++,{value:o[1],done:!1};case 5:A.label++,r=o[1],o=[0];continue;case 7:o=A.ops.pop(),A.trys.pop();continue;default:if(!(i=A.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){A=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){A.label=o[1];break}if(6===o[0]&&A.label<i[1]){A.label=i[1],i=o;break}if(i&&A.label<i[2]){A.label=i[2],A.ops.push(o);break}i[2]&&A.ops.pop(),A.trys.pop();continue}o=e.call(t,A)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}for(var zc=function(){function t(t,e,n,r){this.left=t,this.top=e,this.width=n,this.height=r}return t.prototype.add=function(e,n,r,i){return new t(this.left+e,this.top+n,this.width+r,this.height+i)},t.fromClientRect=function(e,n){return new t(n.left+e.windowBounds.left,n.top+e.windowBounds.top,n.width,n.height)},t.fromDOMRectList=function(e,n){var r=Array.from(n).find(function(t){return 0!==t.width});return r?new t(r.left+e.windowBounds.left,r.top+e.windowBounds.top,r.width,r.height):t.EMPTY},t.EMPTY=new t(0,0,0,0),t}(),Vc=function(t,e){return zc.fromClientRect(t,e.getBoundingClientRect())},Wc=function(t){for(var e=[],n=0,r=t.length;n<r;){var i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var o=t.charCodeAt(n++);56320==(64512&o)?e.push(((1023&i)<<10)+(1023&o)+65536):(e.push(i),n--)}else e.push(i)}return e},Yc=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var n=t.length;if(!n)return"";for(var r=[],i=-1,o="";++i<n;){var A=t[i];A<=65535?r.push(A):(A-=65536,r.push(55296+(A>>10),A%1024+56320)),(i+1===n||r.length>16384)&&(o+=String.fromCharCode.apply(String,r),r.length=0)}return o},Xc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),$c=0;$c<64;$c++)qc[Xc.charCodeAt($c)]=$c;for(var Zc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jc="undefined"==typeof Uint8Array?[]:new Uint8Array(256),tl=0;tl<64;tl++)Jc[Zc.charCodeAt(tl)]=tl;for(var el=function(t,e,n){return t.slice?t.slice(e,n):new Uint16Array(Array.prototype.slice.call(t,e,n))},nl=function(){function t(t,e,n,r,i,o){this.initialValue=t,this.errorValue=e,this.highStart=n,this.highValueIndex=r,this.index=i,this.data=o}return t.prototype.get=function(t){var e;if(t>=0){if(t<55296||t>56319&&t<=65535)return e=((e=this.index[t>>5])<<2)+(31&t),this.data[e];if(t<=65535)return e=((e=this.index[2048+(t-55296>>5)])<<2)+(31&t),this.data[e];if(t<this.highStart)return e=2080+(t>>11),e=this.index[e],e+=t>>5&63,e=((e=this.index[e])<<2)+(31&t),this.data[e];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),rl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",il="undefined"==typeof Uint8Array?[]:new Uint8Array(256),ol=0;ol<64;ol++)il[rl.charCodeAt(ol)]=ol;var Al=10,sl=13,al=15,cl=17,ll=18,ul=19,hl=20,dl=21,fl=22,gl=24,pl=25,vl=26,ml=27,yl=28,wl=30,bl=32,Bl=33,El=34,xl=35,Cl=37,Ml=38,Fl=39,kl=40,Sl=42,Ql=[9001,65288],Ul="×",Nl="÷",Tl=function(t){var e,n,r,i=function(t){var e,n,r,i,o,A=.75*t.length,s=t.length,a=0;"="===t[t.length-1]&&(A--,"="===t[t.length-2]&&A--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(A):new Array(A),l=Array.isArray(c)?c:new Uint8Array(c);for(e=0;e<s;e+=4)n=Jc[t.charCodeAt(e)],r=Jc[t.charCodeAt(e+1)],i=Jc[t.charCodeAt(e+2)],o=Jc[t.charCodeAt(e+3)],l[a++]=n<<2|r>>4,l[a++]=(15&r)<<4|i>>2,l[a++]=(3&i)<<6|63&o;return c}(t),o=Array.isArray(i)?function(t){for(var e=t.length,n=[],r=0;r<e;r+=4)n.push(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]);return n}(i):new Uint32Array(i),A=Array.isArray(i)?function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n.push(t[r+1]<<8|t[r]);return n}(i):new Uint16Array(i),s=el(A,12,o[4]/2),a=2===o[5]?el(A,(24+o[4])/2):(e=o,n=Math.ceil((24+o[4])/4),e.slice?e.slice(n,r):new Uint32Array(Array.prototype.slice.call(e,n,r)));return new nl(o[0],o[1],o[2],o[3],s,a)}("KwAAAAAAAAAACA4AUD0AADAgAAACAAAAAAAIABAAGABAAEgAUABYAGAAaABgAGgAYgBqAF8AZwBgAGgAcQB5AHUAfQCFAI0AlQCdAKIAqgCyALoAYABoAGAAaABgAGgAwgDKAGAAaADGAM4A0wDbAOEA6QDxAPkAAQEJAQ8BFwF1AH0AHAEkASwBNAE6AUIBQQFJAVEBWQFhAWgBcAF4ATAAgAGGAY4BlQGXAZ8BpwGvAbUBvQHFAc0B0wHbAeMB6wHxAfkBAQIJAvEBEQIZAiECKQIxAjgCQAJGAk4CVgJeAmQCbAJ0AnwCgQKJApECmQKgAqgCsAK4ArwCxAIwAMwC0wLbAjAA4wLrAvMC+AIAAwcDDwMwABcDHQMlAy0DNQN1AD0DQQNJA0kDSQNRA1EDVwNZA1kDdQB1AGEDdQBpA20DdQN1AHsDdQCBA4kDkQN1AHUAmQOhA3UAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AKYDrgN1AHUAtgO+A8YDzgPWAxcD3gPjA+sD8wN1AHUA+wMDBAkEdQANBBUEHQQlBCoEFwMyBDgEYABABBcDSARQBFgEYARoBDAAcAQzAXgEgASIBJAEdQCXBHUAnwSnBK4EtgS6BMIEyAR1AHUAdQB1AHUAdQCVANAEYABgAGAAYABgAGAAYABgANgEYADcBOQEYADsBPQE/AQEBQwFFAUcBSQFLAU0BWQEPAVEBUsFUwVbBWAAYgVgAGoFcgV6BYIFigWRBWAAmQWfBaYFYABgAGAAYABgAKoFYACxBbAFuQW6BcEFwQXHBcEFwQXPBdMF2wXjBeoF8gX6BQIGCgYSBhoGIgYqBjIGOgZgAD4GRgZMBmAAUwZaBmAAYABgAGAAYABgAGAAYABgAGAAYABgAGIGYABpBnAGYABgAGAAYABgAGAAYABgAGAAYAB4Bn8GhQZgAGAAYAB1AHcDFQSLBmAAYABgAJMGdQA9A3UAmwajBqsGqwaVALMGuwbDBjAAywbSBtIG1QbSBtIG0gbSBtIG0gbdBuMG6wbzBvsGAwcLBxMHAwcbByMHJwcsBywHMQcsB9IGOAdAB0gHTgfSBkgHVgfSBtIG0gbSBtIG0gbSBtIG0gbSBiwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdgAGAALAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAdbB2MHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB2kH0gZwB64EdQB1AHUAdQB1AHUAdQB1AHUHfQdgAIUHjQd1AHUAlQedB2AAYAClB6sHYACzB7YHvgfGB3UAzgfWBzMB3gfmB1EB7gf1B/0HlQENAQUIDQh1ABUIHQglCBcDLQg1CD0IRQhNCEEDUwh1AHUAdQBbCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIaQhjCGQIZQhmCGcIaAhpCGMIZAhlCGYIZwhoCGkIYwhkCGUIZghnCGgIcAh3CHoIMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIgggwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAALAcsBywHLAcsBywHLAcsBywHLAcsB4oILAcsB44I0gaWCJ4Ipgh1AHUAqgiyCHUAdQB1AHUAdQB1AHUAdQB1AHUAtwh8AXUAvwh1AMUIyQjRCNkI4AjoCHUAdQB1AO4I9gj+CAYJDgkTCS0HGwkjCYIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiCCIIIggiAAIAAAAFAAYABgAGIAXwBgAHEAdQBFAJUAogCyAKAAYABgAEIA4ABGANMA4QDxAMEBDwE1AFwBLAE6AQEBUQF4QkhCmEKoQrhCgAHIQsAB0MLAAcABwAHAAeDC6ABoAHDCwMMAAcABwAHAAdDDGMMAAcAB6MM4wwjDWMNow3jDaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAGgAaABoAEjDqABWw6bDqABpg6gAaABoAHcDvwOPA+gAaABfA/8DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DvwO/A78DpcPAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcAB9cPKwkyCToJMAB1AHUAdQBCCUoJTQl1AFUJXAljCWcJawkwADAAMAAwAHMJdQB2CX4JdQCECYoJjgmWCXUAngkwAGAAYABxAHUApgn3A64JtAl1ALkJdQDACTAAMAAwADAAdQB1AHUAdQB1AHUAdQB1AHUAowYNBMUIMAAwADAAMADICcsJ0wnZCRUE4QkwAOkJ8An4CTAAMAB1AAAKvwh1AAgKDwoXCh8KdQAwACcKLgp1ADYKqAmICT4KRgowADAAdQB1AE4KMAB1AFYKdQBeCnUAZQowADAAMAAwADAAMAAwADAAMAAVBHUAbQowADAAdQC5CXUKMAAwAHwBxAijBogEMgF9CoQKiASMCpQKmgqIBKIKqgquCogEDQG2Cr4KxgrLCjAAMADTCtsKCgHjCusK8Qr5CgELMAAwADAAMAB1AIsECQsRC3UANAEZCzAAMAAwADAAMAB1ACELKQswAHUANAExCzkLdQBBC0kLMABRC1kLMAAwADAAMAAwADAAdQBhCzAAMAAwAGAAYABpC3ELdwt/CzAAMACHC4sLkwubC58Lpwt1AK4Ltgt1APsDMAAwADAAMAAwADAAMAAwAL4LwwvLC9IL1wvdCzAAMADlC+kL8Qv5C/8LSQswADAAMAAwADAAMAAwADAAMAAHDDAAMAAwADAAMAAODBYMHgx1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1ACYMMAAwADAAdQB1AHUALgx1AHUAdQB1AHUAdQA2DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AD4MdQBGDHUAdQB1AHUAdQB1AEkMdQB1AHUAdQB1AFAMMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQBYDHUAdQB1AF8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUA+wMVBGcMMAAwAHwBbwx1AHcMfwyHDI8MMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAYABgAJcMMAAwADAAdQB1AJ8MlQClDDAAMACtDCwHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsB7UMLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHdQB1AHUAdQB1AHUAdQB1AHUAdQB1AHUAdQB1AA0EMAC9DDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAsBywHLAcsBywHLAcsBywHLQcwAMEMyAwsBywHLAcsBywHLAcsBywHLAcsBywHzAwwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwAHUAdQB1ANQM2QzhDDAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMABgAGAAYABgAGAAYABgAOkMYADxDGAA+AwADQYNYABhCWAAYAAODTAAMAAwADAAFg1gAGAAHg37AzAAMAAwADAAYABgACYNYAAsDTQNPA1gAEMNPg1LDWAAYABgAGAAYABgAGAAYABgAGAAUg1aDYsGVglhDV0NcQBnDW0NdQ15DWAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAlQCBDZUAiA2PDZcNMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAnw2nDTAAMAAwADAAMAAwAHUArw23DTAAMAAwADAAMAAwADAAMAAwADAAMAB1AL8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAB1AHUAdQB1AHUAdQDHDTAAYABgAM8NMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA1w11ANwNMAAwAD0B5A0wADAAMAAwADAAMADsDfQN/A0EDgwOFA4wABsOMAAwADAAMAAwADAAMAAwANIG0gbSBtIG0gbSBtIG0gYjDigOwQUuDsEFMw7SBjoO0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGQg5KDlIOVg7SBtIGXg5lDm0OdQ7SBtIGfQ6EDooOjQ6UDtIGmg6hDtIG0gaoDqwO0ga0DrwO0gZgAGAAYADEDmAAYAAkBtIGzA5gANIOYADaDokO0gbSBt8O5w7SBu8O0gb1DvwO0gZgAGAAxA7SBtIG0gbSBtIGYABgAGAAYAAED2AAsAUMD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHJA8sBywHLAcsBywHLAccDywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywPLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAc0D9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAccD9IG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIGFA8sBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHLAcsBywHPA/SBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gbSBtIG0gYUD0QPlQCVAJUAMAAwADAAMACVAJUAlQCVAJUAlQCVAEwPMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAA//8EAAQABAAEAAQABAAEAAQABAANAAMAAQABAAIABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQACgATABcAHgAbABoAHgAXABYAEgAeABsAGAAPABgAHABLAEsASwBLAEsASwBLAEsASwBLABgAGAAeAB4AHgATAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABYAGwASAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWAA0AEQAeAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAFAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJABYAGgAbABsAGwAeAB0AHQAeAE8AFwAeAA0AHgAeABoAGwBPAE8ADgBQAB0AHQAdAE8ATwAXAE8ATwBPABYAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AHgAeAFAATwBAAE8ATwBPAEAATwBQAFAATwBQAB4AHgAeAB4AHgAeAB0AHQAdAB0AHgAdAB4ADgBQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgBQAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAJAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAkACQAJAAkACQAJAAkABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAFAAHgAeAB4AKwArAFAAUABQAFAAGABQACsAKwArACsAHgAeAFAAHgBQAFAAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUAAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAYAA0AKwArAB4AHgAbACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAB4ABAAEAB4ABAAEABMABAArACsAKwArACsAKwArACsAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAKwArACsAKwBWAFYAVgBWAB4AHgArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AGgAaABoAGAAYAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQAEwAEACsAEwATAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABLAEsASwBLAEsASwBLAEsASwBLABoAGQAZAB4AUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQABMAUAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABABQAFAABAAEAB4ABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUAAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAFAABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQAUABQAB4AHgAYABMAUAArACsABAAbABsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAFAABAAEAAQABAAEAFAABAAEAAQAUAAEAAQABAAEAAQAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArACsAHgArAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAUAAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEAA0ADQBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUAArACsAKwBQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABABQACsAKwArACsAKwArACsAKwAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUAAaABoAUABQAFAAUABQAEwAHgAbAFAAHgAEACsAKwAEAAQABAArAFAAUABQAFAAUABQACsAKwArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQACsAUABQACsAKwAEACsABAAEAAQABAAEACsAKwArACsABAAEACsAKwAEAAQABAArACsAKwAEACsAKwArACsAKwArACsAUABQAFAAUAArAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLAAQABABQAFAAUAAEAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsAKwAEAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAArACsAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AGwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAKwArACsAKwArAAQABAAEACsAKwArACsAUABQACsAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAAQAUAArAFAAUABQAFAAUABQACsAKwArAFAAUABQACsAUABQAFAAUAArACsAKwBQAFAAKwBQACsAUABQACsAKwArAFAAUAArACsAKwBQAFAAUAArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArAAQABAAEAAQABAArACsAKwAEAAQABAArAAQABAAEAAQAKwArAFAAKwArACsAKwArACsABAArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAHgAeAB4AHgAeAB4AGwAeACsAKwArACsAKwAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAUABQAFAAKwArACsAKwArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwAOAFAAUABQAFAAUABQAFAAHgBQAAQABAAEAA4AUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAKwArAAQAUAAEAAQABAAEAAQABAAEACsABAAEAAQAKwAEAAQABAAEACsAKwArACsAKwArACsABAAEACsAKwArACsAKwArACsAUAArAFAAUAAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAFAABAAEAAQABAAEAAQABAArAAQABAAEACsABAAEAAQABABQAB4AKwArACsAKwBQAFAAUAAEAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQABoAUABQAFAAUABQAFAAKwAEAAQABAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQACsAUAArACsAUABQAFAAUABQAFAAUAArACsAKwAEACsAKwArACsABAAEAAQABAAEAAQAKwAEACsABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArAAQABAAeACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAXAAqACoAKgAqACoAKgAqACsAKwArACsAGwBcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAeAEsASwBLAEsASwBLAEsASwBLAEsADQANACsAKwArACsAKwBcAFwAKwBcACsAXABcAFwAXABcACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAXAArAFwAXABcAFwAXABcAFwAXABcAFwAKgBcAFwAKgAqACoAKgAqACoAKgAqACoAXAArACsAXABcAFwAXABcACsAXAArACoAKgAqACoAKgAqACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwBcAFwAXABcAFAADgAOAA4ADgAeAA4ADgAJAA4ADgANAAkAEwATABMAEwATAAkAHgATAB4AHgAeAAQABAAeAB4AHgAeAB4AHgBLAEsASwBLAEsASwBLAEsASwBLAFAAUABQAFAAUABQAFAAUABQAFAADQAEAB4ABAAeAAQAFgARABYAEQAEAAQAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQADQAEAAQABAAEAAQADQAEAAQAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAA0ADQAeAB4AHgAeAB4AHgAEAB4AHgAeAB4AHgAeACsAHgAeAA4ADgANAA4AHgAeAB4AHgAeAAkACQArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgBcAEsASwBLAEsASwBLAEsASwBLAEsADQANAB4AHgAeAB4AXABcAFwAXABcAFwAKgAqACoAKgBcAFwAXABcACoAKgAqAFwAKgAqACoAXABcACoAKgAqACoAKgAqACoAXABcAFwAKgAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKgAqAFwAKgBLAEsASwBLAEsASwBLAEsASwBLACoAKgAqACoAKgAqAFAAUABQAFAAUABQACsAUAArACsAKwArACsAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAKwBQACsAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsABAAEAAQAHgANAB4AHgAeAB4AHgAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUAArACsADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAWABEAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQANAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAANAA0AKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUAArAAQABAArACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqAA0ADQAVAFwADQAeAA0AGwBcACoAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwAeAB4AEwATAA0ADQAOAB4AEwATAB4ABAAEAAQACQArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAHgArACsAKwATABMASwBLAEsASwBLAEsASwBLAEsASwBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAXABcAFwAXABcACsAKwArACsAKwArACsAKwArACsAKwBcAFwAXABcAFwAXABcAFwAXABcAFwAXAArACsAKwArAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAXAArACsAKwAqACoAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAArACsAHgAeAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcACoAKgAqACoAKgAqACoAKgAqACoAKwAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKwArAAQASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACoAKgAqACoAKgAqACoAXAAqACoAKgAqACoAKgArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABABQAFAAUABQAFAAUABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwANAA0AHgANAA0ADQANAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAEAAQABAAEAAQAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwAeAB4AHgAeAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArAA0ADQANAA0ADQBLAEsASwBLAEsASwBLAEsASwBLACsAKwArAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAA0ADQBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUAAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArAAQABAAEAB4ABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAAQAUABQAFAAUABQAFAABABQAFAABAAEAAQAUAArACsAKwArACsABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQACsAUAArAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAFAAUABQACsAHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQACsAKwAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQACsAHgAeAB4AHgAeAB4AHgAOAB4AKwANAA0ADQANAA0ADQANAAkADQANAA0ACAAEAAsABAAEAA0ACQANAA0ADAAdAB0AHgAXABcAFgAXABcAFwAWABcAHQAdAB4AHgAUABQAFAANAAEAAQAEAAQABAAEAAQACQAaABoAGgAaABoAGgAaABoAHgAXABcAHQAVABUAHgAeAB4AHgAeAB4AGAAWABEAFQAVABUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ADQAeAA0ADQANAA0AHgANAA0ADQAHAB4AHgAeAB4AKwAEAAQABAAEAAQABAAEAAQABAAEAFAAUAArACsATwBQAFAAUABQAFAAHgAeAB4AFgARAE8AUABPAE8ATwBPAFAAUABQAFAAUAAeAB4AHgAWABEAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArABsAGwAbABsAGwAbABsAGgAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGgAbABsAGwAbABoAGwAbABoAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbABsAGwAbAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAHgAeAFAAGgAeAB0AHgBQAB4AGgAeAB4AHgAeAB4AHgAeAB4AHgBPAB4AUAAbAB4AHgBQAFAAUABQAFAAHgAeAB4AHQAdAB4AUAAeAFAAHgBQAB4AUABPAFAAUAAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAHgBQAFAAUABQAE8ATwBQAFAAUABQAFAATwBQAFAATwBQAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAUABQAFAATwBPAE8ATwBPAE8ATwBPAE8ATwBQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABPAB4AHgArACsAKwArAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHQAdAB4AHgAeAB0AHQAeAB4AHQAeAB4AHgAdAB4AHQAbABsAHgAdAB4AHgAeAB4AHQAeAB4AHQAdAB0AHQAeAB4AHQAeAB0AHgAdAB0AHQAdAB0AHQAeAB0AHgAeAB4AHgAeAB0AHQAdAB0AHgAeAB4AHgAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB4AHgAeAB0AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAeAB0AHQAdAB0AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAdAB4AHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAWABEAHgAeAB4AHgAeAB4AHQAeAB4AHgAeAB4AHgAeACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAWABEAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAFAAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAeAB4AHQAdAB0AHQAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB0AHQAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB0AHQAeAB4AHQAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AHQAdAB0AHgAeAB0AHgAeAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlAB4AHQAdAB4AHgAdAB4AHgAeAB4AHQAdAB4AHgAeAB4AJQAlAB0AHQAlAB4AJQAlACUAIAAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAeAB4AHgAeAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHgAdAB0AHQAeAB0AJQAdAB0AHgAdAB0AHgAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHQAdAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAdAB0AHQAdACUAHgAlACUAJQAdACUAJQAdAB0AHQAlACUAHQAdACUAHQAdACUAJQAlAB4AHQAeAB4AHgAeAB0AHQAlAB0AHQAdAB0AHQAdACUAJQAlACUAJQAdACUAJQAgACUAHQAdACUAJQAlACUAJQAlACUAJQAeAB4AHgAlACUAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB0AHgAeAB4AFwAXABcAFwAXABcAHgATABMAJQAeAB4AHgAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARABYAEQAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAWABEAFgARABYAEQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAWABEAFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AFgARAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAdAB0AHQAdAB0AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAFAAUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAEAAQABAAeAB4AKwArACsAKwArABMADQANAA0AUAATAA0AUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUAANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAA0ADQANAA0ADQANAA0ADQAeAA0AFgANAB4AHgAXABcAHgAeABcAFwAWABEAFgARABYAEQAWABEADQANAA0ADQATAFAADQANAB4ADQANAB4AHgAeAB4AHgAMAAwADQANAA0AHgANAA0AFgANAA0ADQANAA0ADQANAA0AHgANAB4ADQANAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArACsAKwArACsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArAA0AEQARACUAJQBHAFcAVwAWABEAFgARABYAEQAWABEAFgARACUAJQAWABEAFgARABYAEQAWABEAFQAWABEAEQAlAFcAVwBXAFcAVwBXAFcAVwBXAAQABAAEAAQABAAEACUAVwBXAFcAVwA2ACUAJQBXAFcAVwBHAEcAJQAlACUAKwBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBRAFcAUQBXAFEAVwBXAFcAVwBXAFcAUQBXAFcAVwBXAFcAVwBRAFEAKwArAAQABAAVABUARwBHAFcAFQBRAFcAUQBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFEAVwBRAFcAUQBXAFcAVwBXAFcAVwBRAFcAVwBXAFcAVwBXAFEAUQBXAFcAVwBXABUAUQBHAEcAVwArACsAKwArACsAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwAlACUAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACsAKwArACsAKwArACsAKwArACsAKwArAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAUQBRAFEAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBPAE8ATwBPAE8ATwBPAE8AJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADQATAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABLAEsASwBLAEsASwBLAEsASwBLAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAABAAEAAQABAAeAAQABAAEAAQABAAEAAQABAAEAAQAHgBQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUABQAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAeAA0ADQANAA0ADQArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AUAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAB4AHgAeAB4AHgAeAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AUABQAFAAUABQAFAAUABQAFAAUABQAAQAUABQAFAABABQAFAAUABQAAQAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAeAB4AHgAeAAQAKwArACsAUABQAFAAUABQAFAAHgAeABoAHgArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAADgAOABMAEwArACsAKwArACsAKwArACsABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwANAA0ASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUAAeAB4AHgBQAA4AUABQAAQAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArAB4AWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYAFgAWABYACsAKwArAAQAHgAeAB4AHgAeAB4ADQANAA0AHgAeAB4AHgArAFAASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArAB4AHgBcAFwAXABcAFwAKgBcAFwAXABcAFwAXABcAFwAXABcAEsASwBLAEsASwBLAEsASwBLAEsAXABcAFwAXABcACsAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAFAAUABQAAQAUABQAFAAUABQAFAAUABQAAQABAArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAHgANAA0ADQBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKgAqACoAXAAqACoAKgBcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXAAqAFwAKgAqACoAXABcACoAKgBcAFwAXABcAFwAKgAqAFwAKgBcACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFwAXABcACoAKgBQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAA0ADQBQAFAAUAAEAAQAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQADQAEAAQAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAVABVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBUAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVAFUAVQBVACsAKwArACsAKwArACsAKwArACsAKwArAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAWQBZAFkAKwArACsAKwBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAWgBaAFoAKwArACsAKwAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYABgAGAAYAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAKwArACsAKwArAFYABABWAFYAVgBWAFYAVgBWAFYAVgBWAB4AVgBWAFYAVgBWAFYAVgBWAFYAVgBWAFYAVgArAFYAVgBWAFYAVgArAFYAKwBWAFYAKwBWAFYAKwBWAFYAVgBWAFYAVgBWAFYAVgBWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAEQAWAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAaAB4AKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAGAARABEAGAAYABMAEwAWABEAFAArACsAKwArACsAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACUAJQAlACUAJQAWABEAFgARABYAEQAWABEAFgARABYAEQAlACUAFgARACUAJQAlACUAJQAlACUAEQAlABEAKwAVABUAEwATACUAFgARABYAEQAWABEAJQAlACUAJQAlACUAJQAlACsAJQAbABoAJQArACsAKwArAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAcAKwATACUAJQAbABoAJQAlABYAEQAlACUAEQAlABEAJQBXAFcAVwBXAFcAVwBXAFcAVwBXABUAFQAlACUAJQATACUAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXABYAJQARACUAJQAlAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAWACUAEQAlABYAEQARABYAEQARABUAVwBRAFEAUQBRAFEAUQBRAFEAUQBRAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAEcARwArACsAVwBXAFcAVwBXAFcAKwArAFcAVwBXAFcAVwBXACsAKwBXAFcAVwBXAFcAVwArACsAVwBXAFcAKwArACsAGgAbACUAJQAlABsAGwArAB4AHgAeAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwAEAAQABAAQAB0AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsADQANAA0AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAA0AUABQAFAAUAArACsAKwArAFAAUABQAFAAUABQAFAAUAANAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwArAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwBQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwANAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAB4AUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAUABQAFAAUABQAAQABAAEACsABAAEACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAKwBQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAA0ADQANAA0ADQANAA0ADQAeACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAArACsAKwArAFAAUABQAFAAUAANAA0ADQANAA0ADQAUACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsADQANAA0ADQANAA0ADQBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAB4AHgAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArAAQABAANACsAKwBQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAB4AHgAeAB4AHgArACsAKwArACsAKwAEAAQABAAEAAQABAAEAA0ADQAeAB4AHgAeAB4AKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwAeACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEACsASwBLAEsASwBLAEsASwBLAEsASwANAA0ADQANAFAABAAEAFAAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAeAA4AUAArACsAKwArACsAKwArACsAKwAEAFAAUABQAFAADQANAB4ADQAEAAQABAAEAB4ABAAEAEsASwBLAEsASwBLAEsASwBLAEsAUAAOAFAADQANAA0AKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAANAA0AHgANAA0AHgAEACsAUABQAFAAUABQAFAAUAArAFAAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAA0AKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsABAAEAAQABAArAFAAUABQAFAAUABQAFAAUAArACsAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQACsABAAEAFAABAAEAAQABAAEAAQABAArACsABAAEACsAKwAEAAQABAArACsAUAArACsAKwArACsAKwAEACsAKwArACsAKwBQAFAAUABQAFAABAAEACsAKwAEAAQABAAEAAQABAAEACsAKwArAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsABAAEAAQABAAEAAQABABQAFAAUABQAA0ADQANAA0AHgBLAEsASwBLAEsASwBLAEsASwBLAA0ADQArAB4ABABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAFAAUAAeAFAAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABAAEAAQADgANAA0AEwATAB4AHgAeAA0ADQANAA0ADQANAA0ADQANAA0ADQANAA0ADQANAFAAUABQAFAABAAEACsAKwAEAA0ADQAeAFAAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAFAAKwArACsAKwArACsAKwBLAEsASwBLAEsASwBLAEsASwBLACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAXABcAFwAKwArACoAKgAqACoAKgAqACoAKgAqACoAKgAqACoAKgAqACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBcAFwADQANAA0AKgBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAKwArAFAAKwArAFAAUABQAFAAUABQAFAAUAArAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQAKwAEAAQAKwArAAQABAAEAAQAUAAEAFAABAAEAA0ADQANACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAArACsABAAEAAQABAAEAAQABABQAA4AUAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAABAAEAAQABAAEAAQABAAEAAQABABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAFAABAAEAAQABAAOAB4ADQANAA0ADQAOAB4ABAArACsAKwArACsAKwArACsAUAAEAAQABAAEAAQABAAEAAQABAAEAAQAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAA0ADQANAFAADgAOAA4ADQANACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAEAAQABAAEACsABAAEAAQABAAEAAQABAAEAFAADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAOABMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQACsAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAArACsAKwAEACsABAAEACsABAAEAAQABAAEAAQABABQAAQAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAUABQAFAAUABQAFAAKwBQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAUAArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAABAAEAAQABAAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAaABoAGgAaAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArAA0AUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsADQANAA0ADQANACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABIAEgAQwBDAEMAUABQAFAAUABDAFAAUABQAEgAQwBIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAASABDAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwAJAAkACQAJAAkACQAJABYAEQArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABIAEMAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwANAA0AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArAAQABAAEAAQABAANACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEAA0ADQANAB4AHgAeAB4AHgAeAFAAUABQAFAADQAeACsAKwArACsAKwArACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAANAA0AHgAeACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwAEAFAABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwAEAAQABAAEAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAARwBHABUARwAJACsAKwArACsAKwArACsAKwArACsAKwAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUQBRAFEAKwArACsAKwArACsAKwArACsAKwArACsAKwBRAFEAUQBRACsAKwArACsAKwArACsAKwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUAArACsAHgAEAAQADQAEAAQABAAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAAQABAAEAAQABAAeAB4AHgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAB4AHgAEAAQABAAEAAQABAAEAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4ABAAEAAQAHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwArACsAKwArACsAKwArACsAKwArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAKwArAFAAKwArAFAAUAArACsAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACsAUAArAFAAUABQAFAAUABQAFAAKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwBQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAHgAeAFAAUABQAFAAUAArAFAAKwArACsAUABQAFAAUABQAFAAUAArAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAB4AHgAeAB4AHgAeAB4AHgAeACsAKwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAEsASwBLAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAeAB4AHgAeAB4AHgAeAB4ABAAeAB4AHgAeAB4AHgAeAB4AHgAeAAQAHgAeAA0ADQANAA0AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQAKwAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArAAQABAAEAAQABAAEAAQAKwAEAAQAKwAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwAEAAQABAAEAAQABAAEAFAAUABQAFAAUABQAFAAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwBQAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArABsAUABQAFAAUABQACsAKwBQAFAAUABQAFAAUABQAFAAUAAEAAQABAAEAAQABAAEACsAKwArACsAKwArACsAKwArAB4AHgAeAB4ABAAEAAQABAAEAAQABABQACsAKwArACsASwBLAEsASwBLAEsASwBLAEsASwArACsAKwArABYAFgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAGgBQAFAAUAAaAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAeAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQACsAKwBQAFAAUABQACsAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUAArACsAKwArACsAKwBQACsAKwArACsAUAArAFAAKwBQACsAUABQAFAAKwBQAFAAKwBQACsAKwBQACsAUAArAFAAKwBQACsAUAArAFAAUAArAFAAKwArAFAAUABQAFAAKwBQAFAAUABQAFAAUABQACsAUABQAFAAUAArAFAAUABQAFAAKwBQACsAUABQAFAAUABQAFAAUABQAFAAUAArAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAArACsAKwArACsAUABQAFAAKwBQAFAAUABQAFAAKwBQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwAeAB4AKwArACsAKwArACsAKwArACsAKwArACsAKwArAE8ATwBPAE8ATwBPAE8ATwBPAE8ATwBPAE8AJQAlACUAHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHgAeAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB4AHgAeACUAJQAlAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAdAB0AHQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAKQApACkAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAlACUAJQAlACUAHgAlACUAJQAlACUAIAAgACAAJQAlACAAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACEAIQAhACEAIQAlACUAIAAgACUAJQAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlACUAIAAlACUAJQAlACAAIAAgACUAIAAgACAAJQAlACUAJQAlACUAJQAgACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAlAB4AJQAeACUAJQAlACUAJQAgACUAJQAlACUAHgAlAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAgACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACAAIAAgACAAIAAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeABcAFwAXABUAFQAVAB4AHgAeAB4AJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAgACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlACUAJQAeAB4AHgAeAB4AHgAeAB4AHgAeACUAJQAlACUAJQAlAB4AHgAeAB4AHgAeAB4AHgAlACUAJQAlACUAJQAlACUAHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAgACUAJQAgACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAJQAlACUAJQAlACUAIAAlACUAJQAlACUAJQAlACUAJQAgACAAIAAgACAAIAAgACAAIAAgACUAJQAgACAAIAAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACAAIAAlACAAIAAlACAAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAgACAAIAAlACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAJQAlAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AKwAeAB4AHgAeAB4AHgAeAB4AHgAeAB4AHgArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAEsASwBLAEsASwBLAEsASwBLAEsAKwArACsAKwArACsAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwArAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwAlACUAJQAlACUAJQAlACUAJQAlACUAVwBXACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQBXAFcAVwBXAFcAVwBXAFcAVwBXAFcAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAJQAlACUAKwAEACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArACsAKwArAA=="),Ol=[wl,36],Il=[1,2,3,5],Ll=[Al,8],Pl=[ml,vl],Dl=Il.concat(Ll),Rl=[Ml,Fl,kl,El,xl],Hl=[al,sl],_l=function(t,e,n,r){var i=r[n];if(Array.isArray(t)?-1!==t.indexOf(i):t===i)for(var o=n;o<=r.length;){if((a=r[++o])===e)return!0;if(a!==Al)break}if(i===Al)for(o=n;o>0;){var A=r[--o];if(Array.isArray(t)?-1!==t.indexOf(A):t===A)for(var s=n;s<=r.length;){var a;if((a=r[++s])===e)return!0;if(a!==Al)break}if(A!==Al)break}return!1},Gl=function(t,e){for(var n=t;n>=0;){var r=e[n];if(r!==Al)return r;n--}return 0},Kl=function(t,e,n,r,i){if(0===n[r])return Ul;var o=r-1;if(Array.isArray(i)&&!0===i[o])return Ul;var A=o-1,s=o+1,a=e[o],c=A>=0?e[A]:0,l=e[s];if(2===a&&3===l)return Ul;if(-1!==Il.indexOf(a))return"!";if(-1!==Il.indexOf(l))return Ul;if(-1!==Ll.indexOf(l))return Ul;if(8===Gl(o,e))return Nl;if(11===Tl.get(t[o]))return Ul;if((a===bl||a===Bl)&&11===Tl.get(t[s]))return Ul;if(7===a||7===l)return Ul;if(9===a)return Ul;if(-1===[Al,sl,al].indexOf(a)&&9===l)return Ul;if(-1!==[cl,ll,ul,gl,yl].indexOf(l))return Ul;if(Gl(o,e)===fl)return Ul;if(_l(23,fl,o,e))return Ul;if(_l([cl,ll],dl,o,e))return Ul;if(_l(12,12,o,e))return Ul;if(a===Al)return Nl;if(23===a||23===l)return Ul;if(16===l||16===a)return Nl;if(-1!==[sl,al,dl].indexOf(l)||14===a)return Ul;if(36===c&&-1!==Hl.indexOf(a))return Ul;if(a===yl&&36===l)return Ul;if(l===hl)return Ul;if(-1!==Ol.indexOf(l)&&a===pl||-1!==Ol.indexOf(a)&&l===pl)return Ul;if(a===ml&&-1!==[Cl,bl,Bl].indexOf(l)||-1!==[Cl,bl,Bl].indexOf(a)&&l===vl)return Ul;if(-1!==Ol.indexOf(a)&&-1!==Pl.indexOf(l)||-1!==Pl.indexOf(a)&&-1!==Ol.indexOf(l))return Ul;if(-1!==[ml,vl].indexOf(a)&&(l===pl||-1!==[fl,al].indexOf(l)&&e[s+1]===pl)||-1!==[fl,al].indexOf(a)&&l===pl||a===pl&&-1!==[pl,yl,gl].indexOf(l))return Ul;if(-1!==[pl,yl,gl,cl,ll].indexOf(l))for(var u=o;u>=0;){if((h=e[u])===pl)return Ul;if(-1===[yl,gl].indexOf(h))break;u--}if(-1!==[ml,vl].indexOf(l))for(u=-1!==[cl,ll].indexOf(a)?A:o;u>=0;){var h;if((h=e[u])===pl)return Ul;if(-1===[yl,gl].indexOf(h))break;u--}if(Ml===a&&-1!==[Ml,Fl,El,xl].indexOf(l)||-1!==[Fl,El].indexOf(a)&&-1!==[Fl,kl].indexOf(l)||-1!==[kl,xl].indexOf(a)&&l===kl)return Ul;if(-1!==Rl.indexOf(a)&&-1!==[hl,vl].indexOf(l)||-1!==Rl.indexOf(l)&&a===ml)return Ul;if(-1!==Ol.indexOf(a)&&-1!==Ol.indexOf(l))return Ul;if(a===gl&&-1!==Ol.indexOf(l))return Ul;if(-1!==Ol.concat(pl).indexOf(a)&&l===fl&&-1===Ql.indexOf(t[s])||-1!==Ol.concat(pl).indexOf(l)&&a===ll)return Ul;if(41===a&&41===l){for(var d=n[o],f=1;d>0&&41===e[--d];)f++;if(f%2!=0)return Ul}return a===bl&&l===Bl?Ul:Nl},jl=function(t,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var n=function(t,e){void 0===e&&(e="strict");var n=[],r=[],i=[];return t.forEach(function(t,o){var A=Tl.get(t);if(A>50?(i.push(!0),A-=50):i.push(!1),-1!==["normal","auto","loose"].indexOf(e)&&-1!==[8208,8211,12316,12448].indexOf(t))return r.push(o),n.push(16);if(4===A||11===A){if(0===o)return r.push(o),n.push(wl);var s=n[o-1];return-1===Dl.indexOf(s)?(r.push(r[o-1]),n.push(s)):(r.push(o),n.push(wl))}return r.push(o),31===A?n.push("strict"===e?dl:Cl):A===Sl||29===A?n.push(wl):43===A?t>=131072&&t<=196605||t>=196608&&t<=262141?n.push(Cl):n.push(wl):void n.push(A)}),[r,n,i]}(t,e.lineBreak),r=n[0],i=n[1],o=n[2];"break-all"!==e.wordBreak&&"break-word"!==e.wordBreak||(i=i.map(function(t){return-1!==[pl,wl,Sl].indexOf(t)?Cl:t}));var A="keep-all"===e.wordBreak?o.map(function(e,n){return e&&t[n]>=19968&&t[n]<=40959}):void 0;return[r,i,A]},zl=function(){function t(t,e,n,r){this.codePoints=t,this.required="!"===e,this.start=n,this.end=r}return t.prototype.slice=function(){return Yc.apply(void 0,this.codePoints.slice(this.start,this.end))},t}(),Vl=45,Wl=43,Yl=-1,Xl=function(t){return t>=48&&t<=57},ql=function(t){return Xl(t)||t>=65&&t<=70||t>=97&&t<=102},$l=function(t){return 10===t||9===t||32===t},Zl=function(t){return function(t){return function(t){return t>=97&&t<=122}(t)||function(t){return t>=65&&t<=90}(t)}(t)||function(t){return t>=128}(t)||95===t},Jl=function(t){return Zl(t)||Xl(t)||t===Vl},tu=function(t){return t>=0&&t<=8||11===t||t>=14&&t<=31||127===t},eu=function(t,e){return 92===t&&10!==e},nu=function(t,e,n){return t===Vl?Zl(e)||eu(e,n):!!Zl(t)||!(92!==t||!eu(t,e))},ru=function(t,e,n){return t===Wl||t===Vl?!!Xl(e)||46===e&&Xl(n):Xl(46===t?e:t)},iu=function(t){var e=0,n=1;t[e]!==Wl&&t[e]!==Vl||(t[e]===Vl&&(n=-1),e++);for(var r=[];Xl(t[e]);)r.push(t[e++]);var i=r.length?parseInt(Yc.apply(void 0,r),10):0;46===t[e]&&e++;for(var o=[];Xl(t[e]);)o.push(t[e++]);var A=o.length,s=A?parseInt(Yc.apply(void 0,o),10):0;69!==t[e]&&101!==t[e]||e++;var a=1;t[e]!==Wl&&t[e]!==Vl||(t[e]===Vl&&(a=-1),e++);for(var c=[];Xl(t[e]);)c.push(t[e++]);var l=c.length?parseInt(Yc.apply(void 0,c),10):0;return n*(i+s*Math.pow(10,-A))*Math.pow(10,a*l)},ou={type:2},Au={type:3},su={type:4},au={type:13},cu={type:8},lu={type:21},uu={type:9},hu={type:10},du={type:11},fu={type:12},gu={type:14},pu={type:23},vu={type:1},mu={type:25},yu={type:24},wu={type:26},bu={type:27},Bu={type:28},Eu={type:29},xu={type:31},Cu={type:32},Mu=function(){function t(){this._value=[]}return t.prototype.write=function(t){this._value=this._value.concat(Wc(t))},t.prototype.read=function(){for(var t=[],e=this.consumeToken();e!==Cu;)t.push(e),e=this.consumeToken();return t},t.prototype.consumeToken=function(){var t=this.consumeCodePoint();switch(t){case 34:return this.consumeStringToken(34);case 35:var e=this.peekCodePoint(0),n=this.peekCodePoint(1),r=this.peekCodePoint(2);if(Jl(e)||eu(n,r)){var i=nu(e,n,r)?2:1;return{type:5,value:this.consumeName(),flags:i}}break;case 36:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),au;break;case 39:return this.consumeStringToken(39);case 40:return ou;case 41:return Au;case 42:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),gu;break;case Wl:if(ru(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case 44:return su;case Vl:var o=t,A=this.peekCodePoint(0),s=this.peekCodePoint(1);if(ru(o,A,s))return this.reconsumeCodePoint(t),this.consumeNumericToken();if(nu(o,A,s))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();if(A===Vl&&62===s)return this.consumeCodePoint(),this.consumeCodePoint(),yu;break;case 46:if(ru(t,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(t),this.consumeNumericToken();break;case 47:if(42===this.peekCodePoint(0))for(this.consumeCodePoint();;){var a=this.consumeCodePoint();if(42===a&&47===(a=this.consumeCodePoint()))return this.consumeToken();if(a===Yl)return this.consumeToken()}break;case 58:return wu;case 59:return bu;case 60:if(33===this.peekCodePoint(0)&&this.peekCodePoint(1)===Vl&&this.peekCodePoint(2)===Vl)return this.consumeCodePoint(),this.consumeCodePoint(),mu;break;case 64:var c=this.peekCodePoint(0),l=this.peekCodePoint(1),u=this.peekCodePoint(2);if(nu(c,l,u))return{type:7,value:this.consumeName()};break;case 91:return Bu;case 92:if(eu(t,this.peekCodePoint(0)))return this.reconsumeCodePoint(t),this.consumeIdentLikeToken();break;case 93:return Eu;case 61:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),cu;break;case 123:return du;case 125:return fu;case 117:case 85:var h=this.peekCodePoint(0),d=this.peekCodePoint(1);return h!==Wl||!ql(d)&&63!==d||(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(t),this.consumeIdentLikeToken();case 124:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),uu;if(124===this.peekCodePoint(0))return this.consumeCodePoint(),lu;break;case 126:if(61===this.peekCodePoint(0))return this.consumeCodePoint(),hu;break;case Yl:return Cu}return $l(t)?(this.consumeWhiteSpace(),xu):Xl(t)?(this.reconsumeCodePoint(t),this.consumeNumericToken()):Zl(t)?(this.reconsumeCodePoint(t),this.consumeIdentLikeToken()):{type:6,value:Yc(t)}},t.prototype.consumeCodePoint=function(){var t=this._value.shift();return void 0===t?-1:t},t.prototype.reconsumeCodePoint=function(t){this._value.unshift(t)},t.prototype.peekCodePoint=function(t){return t>=this._value.length?-1:this._value[t]},t.prototype.consumeUnicodeRangeToken=function(){for(var t=[],e=this.consumeCodePoint();ql(e)&&t.length<6;)t.push(e),e=this.consumeCodePoint();for(var n=!1;63===e&&t.length<6;)t.push(e),e=this.consumeCodePoint(),n=!0;if(n)return{type:30,start:parseInt(Yc.apply(void 0,t.map(function(t){return 63===t?48:t})),16),end:parseInt(Yc.apply(void 0,t.map(function(t){return 63===t?70:t})),16)};var r=parseInt(Yc.apply(void 0,t),16);if(this.peekCodePoint(0)===Vl&&ql(this.peekCodePoint(1))){this.consumeCodePoint(),e=this.consumeCodePoint();for(var i=[];ql(e)&&i.length<6;)i.push(e),e=this.consumeCodePoint();return{type:30,start:r,end:parseInt(Yc.apply(void 0,i),16)}}return{type:30,start:r,end:r}},t.prototype.consumeIdentLikeToken=function(){var t=this.consumeName();return"url"===t.toLowerCase()&&40===this.peekCodePoint(0)?(this.consumeCodePoint(),this.consumeUrlToken()):40===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:19,value:t}):{type:20,value:t}},t.prototype.consumeUrlToken=function(){var t=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Yl)return{type:22,value:""};var e=this.peekCodePoint(0);if(39===e||34===e){var n=this.consumeStringToken(this.consumeCodePoint());return 0===n.type&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Yl||41===this.peekCodePoint(0))?(this.consumeCodePoint(),{type:22,value:n.value}):(this.consumeBadUrlRemnants(),pu)}for(;;){var r=this.consumeCodePoint();if(r===Yl||41===r)return{type:22,value:Yc.apply(void 0,t)};if($l(r))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Yl||41===this.peekCodePoint(0)?(this.consumeCodePoint(),{type:22,value:Yc.apply(void 0,t)}):(this.consumeBadUrlRemnants(),pu);if(34===r||39===r||40===r||tu(r))return this.consumeBadUrlRemnants(),pu;if(92===r){if(!eu(r,this.peekCodePoint(0)))return this.consumeBadUrlRemnants(),pu;t.push(this.consumeEscapedCodePoint())}else t.push(r)}},t.prototype.consumeWhiteSpace=function(){for(;$l(this.peekCodePoint(0));)this.consumeCodePoint()},t.prototype.consumeBadUrlRemnants=function(){for(;;){var t=this.consumeCodePoint();if(41===t||t===Yl)return;eu(t,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},t.prototype.consumeStringSlice=function(t){for(var e="";t>0;){var n=Math.min(5e4,t);e+=Yc.apply(void 0,this._value.splice(0,n)),t-=n}return this._value.shift(),e},t.prototype.consumeStringToken=function(t){for(var e="",n=0;;){var r=this._value[n];if(r===Yl||void 0===r||r===t)return{type:0,value:e+=this.consumeStringSlice(n)};if(10===r)return this._value.splice(0,n),vu;if(92===r){var i=this._value[n+1];i!==Yl&&void 0!==i&&(10===i?(e+=this.consumeStringSlice(n),n=-1,this._value.shift()):eu(r,i)&&(e+=this.consumeStringSlice(n),e+=Yc(this.consumeEscapedCodePoint()),n=-1))}n++}},t.prototype.consumeNumber=function(){var t=[],e=4,n=this.peekCodePoint(0);for(n!==Wl&&n!==Vl||t.push(this.consumeCodePoint());Xl(this.peekCodePoint(0));)t.push(this.consumeCodePoint());n=this.peekCodePoint(0);var r=this.peekCodePoint(1);if(46===n&&Xl(r))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),e=8;Xl(this.peekCodePoint(0));)t.push(this.consumeCodePoint());n=this.peekCodePoint(0),r=this.peekCodePoint(1);var i=this.peekCodePoint(2);if((69===n||101===n)&&((r===Wl||r===Vl)&&Xl(i)||Xl(r)))for(t.push(this.consumeCodePoint(),this.consumeCodePoint()),e=8;Xl(this.peekCodePoint(0));)t.push(this.consumeCodePoint());return[iu(t),e]},t.prototype.consumeNumericToken=function(){var t=this.consumeNumber(),e=t[0],n=t[1],r=this.peekCodePoint(0),i=this.peekCodePoint(1),o=this.peekCodePoint(2);return nu(r,i,o)?{type:15,number:e,flags:n,unit:this.consumeName()}:37===r?(this.consumeCodePoint(),{type:16,number:e,flags:n}):{type:17,number:e,flags:n}},t.prototype.consumeEscapedCodePoint=function(){var t=this.consumeCodePoint();if(ql(t)){for(var e=Yc(t);ql(this.peekCodePoint(0))&&e.length<6;)e+=Yc(this.consumeCodePoint());$l(this.peekCodePoint(0))&&this.consumeCodePoint();var n=parseInt(e,16);return 0===n||function(t){return t>=55296&&t<=57343}(n)||n>1114111?65533:n}return t===Yl?65533:t},t.prototype.consumeName=function(){for(var t="";;){var e=this.consumeCodePoint();if(Jl(e))t+=Yc(e);else{if(!eu(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),t;t+=Yc(this.consumeEscapedCodePoint())}}},t}(),Fu=function(){function t(t){this._tokens=t}return t.create=function(e){var n=new Mu;return n.write(e),new t(n.read())},t.parseValue=function(e){return t.create(e).parseComponentValue()},t.parseValues=function(e){return t.create(e).parseComponentValues()},t.prototype.parseComponentValue=function(){for(var t=this.consumeToken();31===t.type;)t=this.consumeToken();if(32===t.type)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(t);var e=this.consumeComponentValue();do{t=this.consumeToken()}while(31===t.type);if(32===t.type)return e;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},t.prototype.parseComponentValues=function(){for(var t=[];;){var e=this.consumeComponentValue();if(32===e.type)return t;t.push(e),t.push()}},t.prototype.consumeComponentValue=function(){var t=this.consumeToken();switch(t.type){case 11:case 28:case 2:return this.consumeSimpleBlock(t.type);case 19:return this.consumeFunction(t)}return t},t.prototype.consumeSimpleBlock=function(t){for(var e={type:t,values:[]},n=this.consumeToken();;){if(32===n.type||Ou(n,t))return e;this.reconsumeToken(n),e.values.push(this.consumeComponentValue()),n=this.consumeToken()}},t.prototype.consumeFunction=function(t){for(var e={name:t.value,values:[],type:18};;){var n=this.consumeToken();if(32===n.type||3===n.type)return e;this.reconsumeToken(n),e.values.push(this.consumeComponentValue())}},t.prototype.consumeToken=function(){var t=this._tokens.shift();return void 0===t?Cu:t},t.prototype.reconsumeToken=function(t){this._tokens.unshift(t)},t}(),ku=function(t){return 15===t.type},Su=function(t){return 17===t.type},Qu=function(t){return 20===t.type},Uu=function(t,e){return Qu(t)&&t.value===e},Nu=function(t){return 31!==t.type&&4!==t.type},Tu=function(t){var e=[],n=[];return t.forEach(function(t){if(4===t.type){if(0===n.length)throw new Error("Error parsing function args, zero tokens for arg");return e.push(n),void(n=[])}31!==t.type&&n.push(t)}),n.length&&e.push(n),e},Ou=function(t,e){return 11===e&&12===t.type||(28===e&&29===t.type||2===e&&3===t.type)},Iu=function(t){return 17===t.type||15===t.type},Lu=function(t){return 16===t.type||Iu(t)},Pu=function(t){return t.length>1?[t[0],t[1]]:[t[0]]},Du={type:17,number:0,flags:4},Ru={type:16,number:50,flags:4},Hu={type:16,number:100,flags:4},_u=function(t,e,n){var r=t[0],i=t[1];return[Gu(r,e),Gu(void 0!==i?i:r,n)]},Gu=function(t,e){if(16===t.type)return t.number/100*e;if(ku(t))switch(t.unit){case"rem":case"em":return 16*t.number;default:return t.number}return t.number},Ku="grad",ju="turn",zu=function(t,e){if(15===e.type)switch(e.unit){case"deg":return Math.PI*e.number/180;case Ku:return Math.PI/200*e.number;case"rad":return e.number;case ju:return 2*Math.PI*e.number}throw new Error("Unsupported angle type")},Vu=function(t){return 15===t.type&&("deg"===t.unit||t.unit===Ku||"rad"===t.unit||t.unit===ju)},Wu=function(t){switch(t.filter(Qu).map(function(t){return t.value}).join(" ")){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Du,Du];case"to top":case"bottom":return Yu(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Du,Hu];case"to right":case"left":return Yu(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Hu,Hu];case"to bottom":case"top":return Yu(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Hu,Du];case"to left":case"right":return Yu(270)}return 0},Yu=function(t){return Math.PI*t/180},Xu=function(t,e){if(18===e.type){var n=rh[e.name];if(void 0===n)throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return n(t,e.values)}if(5===e.type){if(3===e.value.length){var r=e.value.substring(0,1),i=e.value.substring(1,2),o=e.value.substring(2,3);return Zu(parseInt(r+r,16),parseInt(i+i,16),parseInt(o+o,16),1)}if(4===e.value.length){r=e.value.substring(0,1),i=e.value.substring(1,2),o=e.value.substring(2,3);var A=e.value.substring(3,4);return Zu(parseInt(r+r,16),parseInt(i+i,16),parseInt(o+o,16),parseInt(A+A,16)/255)}if(6===e.value.length){r=e.value.substring(0,2),i=e.value.substring(2,4),o=e.value.substring(4,6);return Zu(parseInt(r,16),parseInt(i,16),parseInt(o,16),1)}if(8===e.value.length){r=e.value.substring(0,2),i=e.value.substring(2,4),o=e.value.substring(4,6),A=e.value.substring(6,8);return Zu(parseInt(r,16),parseInt(i,16),parseInt(o,16),parseInt(A,16)/255)}}if(20===e.type){var s=oh[e.value.toUpperCase()];if(void 0!==s)return s}return oh.TRANSPARENT},qu=function(t){return!(255&t)},$u=function(t){var e=255&t,n=255&t>>8,r=255&t>>16,i=255&t>>24;return e<255?"rgba("+i+","+r+","+n+","+e/255+")":"rgb("+i+","+r+","+n+")"},Zu=function(t,e,n,r){return(t<<24|e<<16|n<<8|Math.round(255*r))>>>0},Ju=function(t,e){if(17===t.type)return t.number;if(16===t.type){var n=3===e?1:255;return 3===e?t.number/100*n:Math.round(t.number/100*n)}return 0},th=function(t,e){var n=e.filter(Nu);if(3===n.length){var r=n.map(Ju),i=r[0],o=r[1],A=r[2];return Zu(i,o,A,1)}if(4===n.length){var s=n.map(Ju),a=(i=s[0],o=s[1],A=s[2],s[3]);return Zu(i,o,A,a)}return 0};function eh(t,e,n){return n<0&&(n+=1),n>=1&&(n-=1),n<1/6?(e-t)*n*6+t:n<.5?e:n<2/3?6*(e-t)*(2/3-n)+t:t}var nh=function(t,e){var n=e.filter(Nu),r=n[0],i=n[1],o=n[2],A=n[3],s=(17===r.type?Yu(r.number):zu(t,r))/(2*Math.PI),a=Lu(i)?i.number/100:0,c=Lu(o)?o.number/100:0,l=void 0!==A&&Lu(A)?Gu(A,1):1;if(0===a)return Zu(255*c,255*c,255*c,1);var u=c<=.5?c*(a+1):c+a-c*a,h=2*c-u,d=eh(h,u,s+1/3),f=eh(h,u,s),g=eh(h,u,s-1/3);return Zu(255*d,255*f,255*g,l)},rh={hsl:nh,hsla:nh,rgb:th,rgba:th},ih=function(t,e){return Xu(t,Fu.create(e).parseComponentValue())},oh={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Ah={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(t){if(Qu(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},sh={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ah=function(t,e){var n=Xu(t,e[0]),r=e[1];return r&&Lu(r)?{color:n,stop:r}:{color:n,stop:null}},ch=function(t,e){var n=t[0],r=t[t.length-1];null===n.stop&&(n.stop=Du),null===r.stop&&(r.stop=Hu);for(var i=[],o=0,A=0;A<t.length;A++){var s=t[A].stop;if(null!==s){var a=Gu(s,e);a>o?i.push(a):i.push(o),o=a}else i.push(null)}var c=null;for(A=0;A<i.length;A++){var l=i[A];if(null===l)null===c&&(c=A);else if(null!==c){for(var u=A-c,h=(l-i[c-1])/(u+1),d=1;d<=u;d++)i[c+d-1]=h*d;c=null}}return t.map(function(t,n){return{color:t.color,stop:Math.max(Math.min(1,i[n]/e),0)}})},lh=function(t,e,n){var r="number"==typeof t?t:function(t,e,n){var r=e/2,i=n/2,o=Gu(t[0],e)-r,A=i-Gu(t[1],n);return(Math.atan2(A,o)+2*Math.PI)%(2*Math.PI)}(t,e,n),i=Math.abs(e*Math.sin(r))+Math.abs(n*Math.cos(r)),o=e/2,A=n/2,s=i/2,a=Math.sin(r-Math.PI/2)*s,c=Math.cos(r-Math.PI/2)*s;return[i,o-c,o+c,A-a,A+a]},uh=function(t,e){return Math.sqrt(t*t+e*e)},hh=function(t,e,n,r,i){return[[0,0],[0,e],[t,0],[t,e]].reduce(function(t,e){var o=e[0],A=e[1],s=uh(n-o,r-A);return(i?s<t.optimumDistance:s>t.optimumDistance)?{optimumCorner:e,optimumDistance:s}:t},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},dh=function(t,e){var n=Yu(180),r=[];return Tu(e).forEach(function(e,i){if(0===i){var o=e[0];if(20===o.type&&-1!==["top","left","right","bottom"].indexOf(o.value))return void(n=Wu(e));if(Vu(o))return void(n=(zu(t,o)+Yu(270))%Yu(360))}var A=ah(t,e);r.push(A)}),{angle:n,stops:r,type:1}},fh="closest-side",gh="farthest-side",ph="closest-corner",vh="farthest-corner",mh="circle",yh="ellipse",wh="cover",bh="contain",Bh=function(t,e){var n=0,r=3,i=[],o=[];return Tu(e).forEach(function(e,A){var s=!0;if(0===A?s=e.reduce(function(t,e){if(Qu(e))switch(e.value){case"center":return o.push(Ru),!1;case"top":case"left":return o.push(Du),!1;case"right":case"bottom":return o.push(Hu),!1}else if(Lu(e)||Iu(e))return o.push(e),!1;return t},s):1===A&&(s=e.reduce(function(t,e){if(Qu(e))switch(e.value){case mh:return n=0,!1;case yh:return n=1,!1;case bh:case fh:return r=0,!1;case gh:return r=1,!1;case ph:return r=2,!1;case wh:case vh:return r=3,!1}else if(Iu(e)||Lu(e))return Array.isArray(r)||(r=[]),r.push(e),!1;return t},s)),s){var a=ah(t,e);i.push(a)}}),{size:r,shape:n,stops:i,position:o,type:2}},Eh=function(t,e){if(22===e.type){var n={url:e.value,type:0};return t.cache.addImage(e.value),n}if(18===e.type){var r=Ch[e.name];if(void 0===r)throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(t,e.values)}throw new Error("Unsupported image type "+e.type)};var xh,Ch={"linear-gradient":function(t,e){var n=Yu(180),r=[];return Tu(e).forEach(function(e,i){if(0===i){var o=e[0];if(20===o.type&&"to"===o.value)return void(n=Wu(e));if(Vu(o))return void(n=zu(t,o))}var A=ah(t,e);r.push(A)}),{angle:n,stops:r,type:1}},"-moz-linear-gradient":dh,"-ms-linear-gradient":dh,"-o-linear-gradient":dh,"-webkit-linear-gradient":dh,"radial-gradient":function(t,e){var n=0,r=3,i=[],o=[];return Tu(e).forEach(function(e,A){var s=!0;if(0===A){var a=!1;s=e.reduce(function(t,e){if(a)if(Qu(e))switch(e.value){case"center":return o.push(Ru),t;case"top":case"left":return o.push(Du),t;case"right":case"bottom":return o.push(Hu),t}else(Lu(e)||Iu(e))&&o.push(e);else if(Qu(e))switch(e.value){case mh:return n=0,!1;case yh:return n=1,!1;case"at":return a=!0,!1;case fh:return r=0,!1;case wh:case gh:return r=1,!1;case bh:case ph:return r=2,!1;case vh:return r=3,!1}else if(Iu(e)||Lu(e))return Array.isArray(r)||(r=[]),r.push(e),!1;return t},s)}if(s){var c=ah(t,e);i.push(c)}}),{size:r,shape:n,stops:i,position:o,type:2}},"-moz-radial-gradient":Bh,"-ms-radial-gradient":Bh,"-o-radial-gradient":Bh,"-webkit-radial-gradient":Bh,"-webkit-gradient":function(t,e){var n=Yu(180),r=[],i=1;return Tu(e).forEach(function(e,n){var o=e[0];if(0===n){if(Qu(o)&&"linear"===o.value)return void(i=1);if(Qu(o)&&"radial"===o.value)return void(i=2)}if(18===o.type)if("from"===o.name){var A=Xu(t,o.values[0]);r.push({stop:Du,color:A})}else if("to"===o.name){A=Xu(t,o.values[0]);r.push({stop:Hu,color:A})}else if("color-stop"===o.name){var s=o.values.filter(Nu);if(2===s.length){A=Xu(t,s[1]);var a=s[0];Su(a)&&r.push({stop:{type:16,number:100*a.number,flags:a.flags},color:A})}}}),1===i?{angle:(n+Yu(180))%Yu(360),stops:r,type:i}:{size:3,shape:0,stops:r,position:[],type:i}}},Mh={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(t,e){if(0===e.length)return[];var n=e[0];return 20===n.type&&"none"===n.value?[]:e.filter(function(t){return Nu(t)&&function(t){return!(20===t.type&&"none"===t.value||18===t.type&&!Ch[t.name])}(t)}).map(function(e){return Eh(t,e)})}},Fh={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(t,e){return e.map(function(t){if(Qu(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},kh={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(t,e){return Tu(e).map(function(t){return t.filter(Lu)}).map(Pu)}},Sh={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(t,e){return Tu(e).map(function(t){return t.filter(Qu).map(function(t){return t.value}).join(" ")}).map(Qh)}},Qh=function(t){switch(t){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;default:return 0}};!function(t){t.AUTO="auto",t.CONTAIN="contain",t.COVER="cover"}(xh||(xh={}));var Uh,Nh={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(t,e){return Tu(e).map(function(t){return t.filter(Th)})}},Th=function(t){return Qu(t)||Lu(t)},Oh=function(t){return{name:"border-"+t+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Ih=Oh("top"),Lh=Oh("right"),Ph=Oh("bottom"),Dh=Oh("left"),Rh=function(t){return{name:"border-radius-"+t,initialValue:"0 0",prefix:!1,type:1,parse:function(t,e){return Pu(e.filter(Lu))}}},Hh=Rh("top-left"),_h=Rh("top-right"),Gh=Rh("bottom-right"),Kh=Rh("bottom-left"),jh=function(t){return{name:"border-"+t+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(t,e){switch(e){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},zh=jh("top"),Vh=jh("right"),Wh=jh("bottom"),Yh=jh("left"),Xh=function(t){return{name:"border-"+t+"-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return ku(e)?e.number:0}}},qh=Xh("top"),$h=Xh("right"),Zh=Xh("bottom"),Jh=Xh("left"),td={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},ed={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(t,e){return"rtl"===e?1:0}},nd={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(t,e){return e.filter(Qu).reduce(function(t,e){return t|rd(e.value)},0)}},rd=function(t){switch(t){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},id={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},od={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(t,e){return 20===e.type&&"normal"===e.value?0:17===e.type||15===e.type?e.number:0}};!function(t){t.NORMAL="normal",t.STRICT="strict"}(Uh||(Uh={}));var Ad,sd={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){return"strict"===e?Uh.STRICT:Uh.NORMAL}},ad={name:"line-height",initialValue:"normal",prefix:!1,type:4},cd=function(t,e){return Qu(t)&&"normal"===t.value?1.2*e:17===t.type?e*t.number:Lu(t)?Gu(t,e):e},ld={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(t,e){return 20===e.type&&"none"===e.value?null:Eh(t,e)}},ud={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(t,e){return"inside"===e?0:1}},hd={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;default:return-1}}},dd=function(t){return{name:"margin-"+t,initialValue:"0",prefix:!1,type:4}},fd=dd("top"),gd=dd("right"),pd=dd("bottom"),vd=dd("left"),md={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(t,e){return e.filter(Qu).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;default:return 0}})}},yd={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){return"break-word"===e?"break-word":"normal"}},wd=function(t){return{name:"padding-"+t,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},bd=wd("top"),Bd=wd("right"),Ed=wd("bottom"),xd=wd("left"),Cd={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(t,e){switch(e){case"right":return 2;case"center":case"justify":return 1;default:return 0}}},Md={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(t,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},Fd={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return 1===e.length&&Uu(e[0],"none")?[]:Tu(e).map(function(e){for(var n={color:oh.TRANSPARENT,offsetX:Du,offsetY:Du,blur:Du},r=0,i=0;i<e.length;i++){var o=e[i];Iu(o)?(0===r?n.offsetX=o:1===r?n.offsetY=o:n.blur=o,r++):n.color=Xu(t,o)}return n})}},kd={name:"text-transform",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"uppercase":return 2;case"lowercase":return 1;case"capitalize":return 3}return 0}},Sd={name:"transform",initialValue:"none",prefix:!0,type:0,parse:function(t,e){if(20===e.type&&"none"===e.value)return null;if(18===e.type){var n=Qd[e.name];if(void 0===n)throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return n(e.values)}return null}},Qd={matrix:function(t){var e=t.filter(function(t){return 17===t.type}).map(function(t){return t.number});return 6===e.length?e:null},matrix3d:function(t){var e=t.filter(function(t){return 17===t.type}).map(function(t){return t.number}),n=e[0],r=e[1];e[2],e[3];var i=e[4],o=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var A=e[12],s=e[13];return e[14],e[15],16===e.length?[n,r,i,o,A,s]:null}},Ud={type:16,number:50,flags:4},Nd=[Ud,Ud],Td={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(t,e){var n=e.filter(Lu);return 2!==n.length?Nd:[n[0],n[1]]}},Od={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(t,e){switch(e){case"hidden":return 1;case"collapse":return 2;default:return 0}}};!function(t){t.NORMAL="normal",t.BREAK_ALL="break-all",t.KEEP_ALL="keep-all"}(Ad||(Ad={}));for(var Id={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"break-all":return Ad.BREAK_ALL;case"keep-all":return Ad.KEEP_ALL;default:return Ad.NORMAL}}},Ld={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(t,e){if(20===e.type)return{auto:!0,order:0};if(Su(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},Pd=function(t,e){if(15===e.type)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")},Dd={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(t,e){return Su(e)?e.number:1}},Rd={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Hd={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(t,e){return e.filter(Qu).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return 0!==t})}},_d={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(t,e){var n=[],r=[];return e.forEach(function(t){switch(t.type){case 20:case 0:n.push(t.value);break;case 17:n.push(t.number.toString());break;case 4:r.push(n.join(" ")),n.length=0}}),n.length&&r.push(n.join(" ")),r.map(function(t){return-1===t.indexOf(" ")?t:"'"+t+"'"})}},Gd={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Kd={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(t,e){return Su(e)?e.number:Qu(e)&&"bold"===e.value?700:400}},jd={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return e.filter(Qu).map(function(t){return t.value})}},zd={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(t,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";default:return"normal"}}},Vd=function(t,e){return 0!==(t&e)},Wd={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(t,e){return e.filter(ku).map(function(e){return Pd(t,e)})}},Yd={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(t,e){return 1===e.length&&Uu(e[0],"none")?[]:Tu(e).map(function(e){for(var n={color:255,offsetX:Du,offsetY:Du,blur:Du,spread:Du,inset:!1},r=0,i=0;i<e.length;i++){var o=e[i];Uu(o,"inset")?n.inset=!0:Iu(o)?(0===r?n.offsetX=o:1===r?n.offsetY=o:2===r?n.blur=o:n.spread=o,r++):n.color=Xu(t,o)}return n})}},Xd={name:"paint-order",initialValue:"normal",prefix:!1,type:1,parse:function(t,e){var n=[];return e.filter(Qu).forEach(function(t){switch(t.value){case"stroke":n.push(1);break;case"fill":n.push(0);break;case"markers":n.push(2)}}),[0,1,2].forEach(function(t){-1===n.indexOf(t)&&n.push(t)}),n}},qd={name:"-webkit-text-stroke-color",initialValue:"currentcolor",prefix:!1,type:3,format:"color"},$d={name:"-webkit-text-stroke-width",initialValue:"0",type:0,prefix:!1,parse:function(t,e){return ku(e)?e.number:0}},Zd=function(){function t(t,e){var n,r;this.animationDuration=Jd(t,Wd,e.animationDuration),this.backgroundClip=Jd(t,Ah,e.backgroundClip),this.backgroundColor=Jd(t,sh,e.backgroundColor),this.backgroundImage=Jd(t,Mh,e.backgroundImage),this.backgroundOrigin=Jd(t,Fh,e.backgroundOrigin),this.backgroundPosition=Jd(t,kh,e.backgroundPosition),this.backgroundRepeat=Jd(t,Sh,e.backgroundRepeat),this.backgroundSize=Jd(t,Nh,e.backgroundSize),this.borderTopColor=Jd(t,Ih,e.borderTopColor),this.borderRightColor=Jd(t,Lh,e.borderRightColor),this.borderBottomColor=Jd(t,Ph,e.borderBottomColor),this.borderLeftColor=Jd(t,Dh,e.borderLeftColor),this.borderTopLeftRadius=Jd(t,Hh,e.borderTopLeftRadius),this.borderTopRightRadius=Jd(t,_h,e.borderTopRightRadius),this.borderBottomRightRadius=Jd(t,Gh,e.borderBottomRightRadius),this.borderBottomLeftRadius=Jd(t,Kh,e.borderBottomLeftRadius),this.borderTopStyle=Jd(t,zh,e.borderTopStyle),this.borderRightStyle=Jd(t,Vh,e.borderRightStyle),this.borderBottomStyle=Jd(t,Wh,e.borderBottomStyle),this.borderLeftStyle=Jd(t,Yh,e.borderLeftStyle),this.borderTopWidth=Jd(t,qh,e.borderTopWidth),this.borderRightWidth=Jd(t,$h,e.borderRightWidth),this.borderBottomWidth=Jd(t,Zh,e.borderBottomWidth),this.borderLeftWidth=Jd(t,Jh,e.borderLeftWidth),this.boxShadow=Jd(t,Yd,e.boxShadow),this.color=Jd(t,td,e.color),this.direction=Jd(t,ed,e.direction),this.display=Jd(t,nd,e.display),this.float=Jd(t,id,e.cssFloat),this.fontFamily=Jd(t,_d,e.fontFamily),this.fontSize=Jd(t,Gd,e.fontSize),this.fontStyle=Jd(t,zd,e.fontStyle),this.fontVariant=Jd(t,jd,e.fontVariant),this.fontWeight=Jd(t,Kd,e.fontWeight),this.letterSpacing=Jd(t,od,e.letterSpacing),this.lineBreak=Jd(t,sd,e.lineBreak),this.lineHeight=Jd(t,ad,e.lineHeight),this.listStyleImage=Jd(t,ld,e.listStyleImage),this.listStylePosition=Jd(t,ud,e.listStylePosition),this.listStyleType=Jd(t,hd,e.listStyleType),this.marginTop=Jd(t,fd,e.marginTop),this.marginRight=Jd(t,gd,e.marginRight),this.marginBottom=Jd(t,pd,e.marginBottom),this.marginLeft=Jd(t,vd,e.marginLeft),this.opacity=Jd(t,Dd,e.opacity);var i=Jd(t,md,e.overflow);this.overflowX=i[0],this.overflowY=i[i.length>1?1:0],this.overflowWrap=Jd(t,yd,e.overflowWrap),this.paddingTop=Jd(t,bd,e.paddingTop),this.paddingRight=Jd(t,Bd,e.paddingRight),this.paddingBottom=Jd(t,Ed,e.paddingBottom),this.paddingLeft=Jd(t,xd,e.paddingLeft),this.paintOrder=Jd(t,Xd,e.paintOrder),this.position=Jd(t,Md,e.position),this.textAlign=Jd(t,Cd,e.textAlign),this.textDecorationColor=Jd(t,Rd,null!==(n=e.textDecorationColor)&&void 0!==n?n:e.color),this.textDecorationLine=Jd(t,Hd,null!==(r=e.textDecorationLine)&&void 0!==r?r:e.textDecoration),this.textShadow=Jd(t,Fd,e.textShadow),this.textTransform=Jd(t,kd,e.textTransform),this.transform=Jd(t,Sd,e.transform),this.transformOrigin=Jd(t,Td,e.transformOrigin),this.visibility=Jd(t,Od,e.visibility),this.webkitTextStrokeColor=Jd(t,qd,e.webkitTextStrokeColor),this.webkitTextStrokeWidth=Jd(t,$d,e.webkitTextStrokeWidth),this.wordBreak=Jd(t,Id,e.wordBreak),this.zIndex=Jd(t,Ld,e.zIndex)}return t.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&0===this.visibility},t.prototype.isTransparent=function(){return qu(this.backgroundColor)},t.prototype.isTransformed=function(){return null!==this.transform},t.prototype.isPositioned=function(){return 0!==this.position},t.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},t.prototype.isFloating=function(){return 0!==this.float},t.prototype.isInlineLevel=function(){return Vd(this.display,4)||Vd(this.display,33554432)||Vd(this.display,268435456)||Vd(this.display,536870912)||Vd(this.display,67108864)||Vd(this.display,134217728)},t}(),Jd=function(t,e,n){var r=new Mu,i=null!=n?n.toString():e.initialValue;r.write(i);var o=new Fu(r.read());switch(e.type){case 2:var A=o.parseComponentValue();return e.parse(t,Qu(A)?A.value:e.initialValue);case 0:return e.parse(t,o.parseComponentValue());case 1:return e.parse(t,o.parseComponentValues());case 4:return o.parseComponentValue();case 3:switch(e.format){case"angle":return zu(t,o.parseComponentValue());case"color":return Xu(t,o.parseComponentValue());case"image":return Eh(t,o.parseComponentValue());case"length":var s=o.parseComponentValue();return Iu(s)?s:Du;case"length-percentage":var a=o.parseComponentValue();return Lu(a)?a:Du;case"time":return Pd(t,o.parseComponentValue())}}},tf=function(t,e){var n=function(t){switch(t.getAttribute("data-html2canvas-debug")){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}}(t);return 1===n||e===n},ef=function(t,e){this.context=t,this.textNodes=[],this.elements=[],this.flags=0,tf(e,3),this.styles=new Zd(t,window.getComputedStyle(e,null)),Ag(e)&&(this.styles.animationDuration.some(function(t){return t>0})&&(e.style.animationDuration="0s"),null!==this.styles.transform&&(e.style.transform="none")),this.bounds=Vc(this.context,e),tf(e,4)&&(this.flags|=16)},nf="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),of=0;of<64;of++)rf[nf.charCodeAt(of)]=of;for(var Af=function(t,e,n){return t.slice?t.slice(e,n):new Uint16Array(Array.prototype.slice.call(t,e,n))},sf=function(){function t(t,e,n,r,i,o){this.initialValue=t,this.errorValue=e,this.highStart=n,this.highValueIndex=r,this.index=i,this.data=o}return t.prototype.get=function(t){var e;if(t>=0){if(t<55296||t>56319&&t<=65535)return e=((e=this.index[t>>5])<<2)+(31&t),this.data[e];if(t<=65535)return e=((e=this.index[2048+(t-55296>>5)])<<2)+(31&t),this.data[e];if(t<this.highStart)return e=2080+(t>>11),e=this.index[e],e+=t>>5&63,e=((e=this.index[e])<<2)+(31&t),this.data[e];if(t<=1114111)return this.data[this.highValueIndex]}return this.errorValue},t}(),af="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cf="undefined"==typeof Uint8Array?[]:new Uint8Array(256),lf=0;lf<64;lf++)cf[af.charCodeAt(lf)]=lf;var uf,hf=8,df=9,ff=11,gf=12,pf=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(String.fromCodePoint)return String.fromCodePoint.apply(String,t);var n=t.length;if(!n)return"";for(var r=[],i=-1,o="";++i<n;){var A=t[i];A<=65535?r.push(A):(A-=65536,r.push(55296+(A>>10),A%1024+56320)),(i+1===n||r.length>16384)&&(o+=String.fromCharCode.apply(String,r),r.length=0)}return o},vf=function(t){var e,n,r,i=function(t){var e,n,r,i,o,A=.75*t.length,s=t.length,a=0;"="===t[t.length-1]&&(A--,"="===t[t.length-2]&&A--);var c="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array&&void 0!==Uint8Array.prototype.slice?new ArrayBuffer(A):new Array(A),l=Array.isArray(c)?c:new Uint8Array(c);for(e=0;e<s;e+=4)n=rf[t.charCodeAt(e)],r=rf[t.charCodeAt(e+1)],i=rf[t.charCodeAt(e+2)],o=rf[t.charCodeAt(e+3)],l[a++]=n<<2|r>>4,l[a++]=(15&r)<<4|i>>2,l[a++]=(3&i)<<6|63&o;return c}(t),o=Array.isArray(i)?function(t){for(var e=t.length,n=[],r=0;r<e;r+=4)n.push(t[r+3]<<24|t[r+2]<<16|t[r+1]<<8|t[r]);return n}(i):new Uint32Array(i),A=Array.isArray(i)?function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n.push(t[r+1]<<8|t[r]);return n}(i):new Uint16Array(i),s=Af(A,12,o[4]/2),a=2===o[5]?Af(A,(24+o[4])/2):(e=o,n=Math.ceil((24+o[4])/4),e.slice?e.slice(n,r):new Uint32Array(Array.prototype.slice.call(e,n,r)));return new sf(o[0],o[1],o[2],o[3],s,a)}("AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA="),mf="×",yf=function(t){return vf.get(t)},wf=function(t,e,n){var r=n-2,i=e[r],o=e[n-1],A=e[n];if(2===o&&3===A)return mf;if(2===o||3===o||4===o)return"÷";if(2===A||3===A||4===A)return"÷";if(o===hf&&-1!==[hf,df,ff,gf].indexOf(A))return mf;if(!(o!==ff&&o!==df||A!==df&&10!==A))return mf;if((o===gf||10===o)&&10===A)return mf;if(13===A||5===A)return mf;if(7===A)return mf;if(1===o)return mf;if(13===o&&14===A){for(;5===i;)i=e[--r];if(14===i)return mf}if(15===o&&15===A){for(var s=0;15===i;)s++,i=e[--r];if(s%2==0)return mf}return"÷"},bf=function(t){var e=function(t){for(var e=[],n=0,r=t.length;n<r;){var i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){var o=t.charCodeAt(n++);56320==(64512&o)?e.push(((1023&i)<<10)+(1023&o)+65536):(e.push(i),n--)}else e.push(i)}return e}(t),n=e.length,r=0,i=0,o=e.map(yf);return{next:function(){if(r>=n)return{done:!0,value:null};for(var t=mf;r<n&&(t=wf(0,o,++r))===mf;);if(t!==mf||r===n){var A=pf.apply(null,e.slice(i,r));return i=r,{value:A,done:!1}}return{done:!0,value:null}}}},Bf=function(t){return 0===t[0]&&255===t[1]&&0===t[2]&&255===t[3]},Ef=function(t,e,n,r,i){var o="http://www.w3.org/2000/svg",A=document.createElementNS(o,"svg"),s=document.createElementNS(o,"foreignObject");return A.setAttributeNS(null,"width",t.toString()),A.setAttributeNS(null,"height",e.toString()),s.setAttributeNS(null,"width","100%"),s.setAttributeNS(null,"height","100%"),s.setAttributeNS(null,"x",n.toString()),s.setAttributeNS(null,"y",r.toString()),s.setAttributeNS(null,"externalResourcesRequired","true"),A.appendChild(s),s.appendChild(i),A},xf=function(t){return new Promise(function(e,n){var r=new Image;r.onload=function(){return e(r)},r.onerror=n,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(t))})},Cf={get SUPPORT_RANGE_BOUNDS(){var t=function(t){if(t.createRange){var e=t.createRange();if(e.getBoundingClientRect){var n=t.createElement("boundtest");n.style.height="123px",n.style.display="block",t.body.appendChild(n),e.selectNode(n);var r=e.getBoundingClientRect(),i=Math.round(r.height);if(t.body.removeChild(n),123===i)return!0}}return!1}(document);return Object.defineProperty(Cf,"SUPPORT_RANGE_BOUNDS",{value:t}),t},get SUPPORT_WORD_BREAKING(){var t=Cf.SUPPORT_RANGE_BOUNDS&&function(t){var e=t.createElement("boundtest");e.style.width="50px",e.style.display="block",e.style.fontSize="12px",e.style.letterSpacing="0px",e.style.wordSpacing="0px",t.body.appendChild(e);var n=t.createRange();e.innerHTML="function"==typeof"".repeat?"&#128104;".repeat(10):"";var r=e.firstChild,i=Wc(r.data).map(function(t){return Yc(t)}),o=0,A={},s=i.every(function(t,e){n.setStart(r,o),n.setEnd(r,o+t.length);var i=n.getBoundingClientRect();o+=t.length;var s=i.x>A.x||i.y>A.y;return A=i,0===e||s});return t.body.removeChild(e),s}(document);return Object.defineProperty(Cf,"SUPPORT_WORD_BREAKING",{value:t}),t},get SUPPORT_SVG_DRAWING(){var t=function(t){var e=new Image,n=t.createElement("canvas"),r=n.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";try{r.drawImage(e,0,0),n.toDataURL()}catch(t){return!1}return!0}(document);return Object.defineProperty(Cf,"SUPPORT_SVG_DRAWING",{value:t}),t},get SUPPORT_FOREIGNOBJECT_DRAWING(){var t="function"==typeof Array.from&&"function"==typeof window.fetch?function(t){var e=t.createElement("canvas"),n=100;e.width=n,e.height=n;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,n,n);var i=new Image,o=e.toDataURL();i.src=o;var A=Ef(n,n,0,0,i);return r.fillStyle="red",r.fillRect(0,0,n,n),xf(A).then(function(e){r.drawImage(e,0,0);var i=r.getImageData(0,0,n,n).data;r.fillStyle="red",r.fillRect(0,0,n,n);var A=t.createElement("div");return A.style.backgroundImage="url("+o+")",A.style.height=n+"px",Bf(i)?xf(Ef(n,n,0,0,A)):Promise.reject(!1)}).then(function(t){return r.drawImage(t,0,0),Bf(r.getImageData(0,0,n,n).data)}).catch(function(){return!1})}(document):Promise.resolve(!1);return Object.defineProperty(Cf,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:t}),t},get SUPPORT_CORS_IMAGES(){var t=void 0!==(new Image).crossOrigin;return Object.defineProperty(Cf,"SUPPORT_CORS_IMAGES",{value:t}),t},get SUPPORT_RESPONSE_TYPE(){var t="string"==typeof(new XMLHttpRequest).responseType;return Object.defineProperty(Cf,"SUPPORT_RESPONSE_TYPE",{value:t}),t},get SUPPORT_CORS_XHR(){var t="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Cf,"SUPPORT_CORS_XHR",{value:t}),t},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var t=!("undefined"==typeof Intl||!Intl.Segmenter);return Object.defineProperty(Cf,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:t}),t}},Mf=function(t,e){this.text=t,this.bounds=e},Ff=function(t,e){var n=e.ownerDocument;if(n){var r=n.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var o=Vc(t,r);return r.firstChild&&i.replaceChild(r.firstChild,r),o}}return zc.EMPTY},kf=function(t,e,n){var r=t.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(t,e),i.setEnd(t,e+n),i},Sf=function(t){if(Cf.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(t)).map(function(t){return t.segment})}return function(t){for(var e,n=bf(t),r=[];!(e=n.next()).done;)e.value&&r.push(e.value.slice());return r}(t)},Qf=function(t,e){return 0!==e.letterSpacing?Sf(t):function(t,e){if(Cf.SUPPORT_NATIVE_TEXT_SEGMENTATION){var n=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(n.segment(t)).map(function(t){return t.segment})}return Nf(t,e)}(t,e)},Uf=[32,160,4961,65792,65793,4153,4241],Nf=function(t,e){for(var n,r=function(t,e){var n=Wc(t),r=jl(n,e),i=r[0],o=r[1],A=r[2],s=n.length,a=0,c=0;return{next:function(){if(c>=s)return{done:!0,value:null};for(var t=Ul;c<s&&(t=Kl(n,o,i,++c,A))===Ul;);if(t!==Ul||c===s){var e=new zl(n,t,a,c);return a=c,{value:e,done:!1}}return{done:!0,value:null}}}}(t,{lineBreak:e.lineBreak,wordBreak:"break-word"===e.overflowWrap?"break-word":e.wordBreak}),i=[],o=function(){if(n.value){var t=n.value.slice(),e=Wc(t),r="";e.forEach(function(t){-1===Uf.indexOf(t)?r+=Yc(t):(r.length&&i.push(r),i.push(Yc(t)),r="")}),r.length&&i.push(r)}};!(n=r.next()).done;)o();return i},Tf=function(t,e,n){this.text=Of(e.data,n.textTransform),this.textBounds=function(t,e,n,r){var i=Qf(e,n),o=[],A=0;return i.forEach(function(e){if(n.textDecorationLine.length||e.trim().length>0)if(Cf.SUPPORT_RANGE_BOUNDS){var i=kf(r,A,e.length).getClientRects();if(i.length>1){var s=Sf(e),a=0;s.forEach(function(e){o.push(new Mf(e,zc.fromDOMRectList(t,kf(r,a+A,e.length).getClientRects()))),a+=e.length})}else o.push(new Mf(e,zc.fromDOMRectList(t,i)))}else{var c=r.splitText(e.length);o.push(new Mf(e,Ff(t,r))),r=c}else Cf.SUPPORT_RANGE_BOUNDS||(r=r.splitText(e.length));A+=e.length}),o}(t,this.text,n,e)},Of=function(t,e){switch(e){case 1:return t.toLowerCase();case 3:return t.replace(If,Lf);case 2:return t.toUpperCase();default:return t}},If=/(^|\s|:|-|\(|\))([a-z])/g,Lf=function(t,e,n){return t.length>0?e+n.toUpperCase():t},Pf=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.src=n.currentSrc||n.src,r.intrinsicWidth=n.naturalWidth,r.intrinsicHeight=n.naturalHeight,r.context.cache.addImage(r.src),r}return Gc(e,t),e}(ef),Df=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.canvas=n,r.intrinsicWidth=n.width,r.intrinsicHeight=n.height,r}return Gc(e,t),e}(ef),Rf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=new XMLSerializer,o=Vc(e,n);return n.setAttribute("width",o.width+"px"),n.setAttribute("height",o.height+"px"),r.svg="data:image/svg+xml,"+encodeURIComponent(i.serializeToString(n)),r.intrinsicWidth=n.width.baseVal.value,r.intrinsicHeight=n.height.baseVal.value,r.context.cache.addImage(r.svg),r}return Gc(e,t),e}(ef),Hf=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.value=n.value,r}return Gc(e,t),e}(ef),_f=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.start=n.start,r.reversed="boolean"==typeof n.reversed&&!0===n.reversed,r}return Gc(e,t),e}(ef),Gf=[{type:15,flags:0,unit:"px",number:3}],Kf=[{type:16,flags:0,number:50}],jf="checkbox",zf="radio",Vf="password",Wf=707406591,Yf=function(t){function e(e,n){var r,i,o,A=t.call(this,e,n)||this;switch(A.type=n.type.toLowerCase(),A.checked=n.checked,A.value=0===(i=(r=n).type===Vf?new Array(r.value.length+1).join("•"):r.value).length?r.placeholder||"":i,A.type!==jf&&A.type!==zf||(A.styles.backgroundColor=3739148031,A.styles.borderTopColor=A.styles.borderRightColor=A.styles.borderBottomColor=A.styles.borderLeftColor=2779096575,A.styles.borderTopWidth=A.styles.borderRightWidth=A.styles.borderBottomWidth=A.styles.borderLeftWidth=1,A.styles.borderTopStyle=A.styles.borderRightStyle=A.styles.borderBottomStyle=A.styles.borderLeftStyle=1,A.styles.backgroundClip=[0],A.styles.backgroundOrigin=[0],A.bounds=(o=A.bounds).width>o.height?new zc(o.left+(o.width-o.height)/2,o.top,o.height,o.height):o.width<o.height?new zc(o.left,o.top+(o.height-o.width)/2,o.width,o.width):o),A.type){case jf:A.styles.borderTopRightRadius=A.styles.borderTopLeftRadius=A.styles.borderBottomRightRadius=A.styles.borderBottomLeftRadius=Gf;break;case zf:A.styles.borderTopRightRadius=A.styles.borderTopLeftRadius=A.styles.borderBottomRightRadius=A.styles.borderBottomLeftRadius=Kf}return A}return Gc(e,t),e}(ef),Xf=function(t){function e(e,n){var r=t.call(this,e,n)||this,i=n.options[n.selectedIndex||0];return r.value=i&&i.text||"",r}return Gc(e,t),e}(ef),qf=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.value=n.value,r}return Gc(e,t),e}(ef),$f=function(t){function e(e,n){var r=t.call(this,e,n)||this;r.src=n.src,r.width=parseInt(n.width,10)||0,r.height=parseInt(n.height,10)||0,r.backgroundColor=r.styles.backgroundColor;try{if(n.contentWindow&&n.contentWindow.document&&n.contentWindow.document.documentElement){r.tree=eg(e,n.contentWindow.document.documentElement);var i=n.contentWindow.document.documentElement?ih(e,getComputedStyle(n.contentWindow.document.documentElement).backgroundColor):oh.TRANSPARENT,o=n.contentWindow.document.body?ih(e,getComputedStyle(n.contentWindow.document.body).backgroundColor):oh.TRANSPARENT;r.backgroundColor=qu(i)?qu(o)?r.styles.backgroundColor:o:i}}catch(t){}return r}return Gc(e,t),e}(ef),Zf=["OL","UL","MENU"],Jf=function(t,e,n,r){for(var i=e.firstChild,o=void 0;i;i=o)if(o=i.nextSibling,ig(i)&&i.data.trim().length>0)n.textNodes.push(new Tf(t,i,n.styles));else if(og(i))if(mg(i)&&i.assignedNodes)i.assignedNodes().forEach(function(e){return Jf(t,e,n,r)});else{var A=tg(t,i);A.styles.isVisible()&&(ng(i,A,r)?A.flags|=4:rg(A.styles)&&(A.flags|=2),-1!==Zf.indexOf(i.tagName)&&(A.flags|=8),n.elements.push(A),i.slot,i.shadowRoot?Jf(t,i.shadowRoot,A,r):pg(i)||ug(i)||vg(i)||Jf(t,i,A,r))}},tg=function(t,e){return fg(e)?new Pf(t,e):dg(e)?new Df(t,e):ug(e)?new Rf(t,e):ag(e)?new Hf(t,e):cg(e)?new _f(t,e):lg(e)?new Yf(t,e):vg(e)?new Xf(t,e):pg(e)?new qf(t,e):gg(e)?new $f(t,e):new ef(t,e)},eg=function(t,e){var n=tg(t,e);return n.flags|=4,Jf(t,e,n,n),n},ng=function(t,e,n){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||hg(t)&&n.styles.isTransparent()},rg=function(t){return t.isPositioned()||t.isFloating()},ig=function(t){return t.nodeType===Node.TEXT_NODE},og=function(t){return t.nodeType===Node.ELEMENT_NODE},Ag=function(t){return og(t)&&void 0!==t.style&&!sg(t)},sg=function(t){return"object"==typeof t.className},ag=function(t){return"LI"===t.tagName},cg=function(t){return"OL"===t.tagName},lg=function(t){return"INPUT"===t.tagName},ug=function(t){return"svg"===t.tagName},hg=function(t){return"BODY"===t.tagName},dg=function(t){return"CANVAS"===t.tagName},fg=function(t){return"IMG"===t.tagName},gg=function(t){return"IFRAME"===t.tagName},pg=function(t){return"TEXTAREA"===t.tagName},vg=function(t){return"SELECT"===t.tagName},mg=function(t){return"SLOT"===t.tagName},yg={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},wg={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},bg={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Bg={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Eg=function(t,e,n,r,i,o){return t<e||t>n?Ng(t,i,o.length>0):r.integers.reduce(function(e,n,i){for(;t>=n;)t-=n,e+=r.values[i];return e},"")+o},xg=function(t,e,n,r){var i="";do{n||t--,i=r(t)+i,t/=e}while(t*e>=e);return i},Cg=function(t,e,n,r,i){var o=n-e+1;return(t<0?"-":"")+(xg(Math.abs(t),o,r,function(t){return Yc(Math.floor(t%o)+e)})+i)},Mg=function(t,e,n){void 0===n&&(n=". ");var r=e.length;return xg(Math.abs(t),r,!1,function(t){return e[Math.floor(t%r)]})+n},Fg=function(t,e,n,r,i,o){if(t<-9999||t>9999)return Ng(t,4,i.length>0);var A=Math.abs(t),s=i;if(0===A)return e[0]+s;for(var a=0;A>0&&a<=4;a++){var c=A%10;0===c&&Vd(o,1)&&""!==s?s=e[c]+s:c>1||1===c&&0===a||1===c&&1===a&&Vd(o,2)||1===c&&1===a&&Vd(o,4)&&t>100||1===c&&a>1&&Vd(o,8)?s=e[c]+(a>0?n[a-1]:"")+s:1===c&&a>0&&(s=n[a-1]+s),A=Math.floor(A/10)}return(t<0?r:"")+s},kg="十百千萬",Sg="拾佰仟萬",Qg="マイナス",Ug="마이너스",Ng=function(t,e,n){var r=n?". ":"",i=n?"、":"",o=n?", ":"",A=n?" ":"";switch(e){case 0:return"•"+A;case 1:return"◦"+A;case 2:return"◾"+A;case 5:var s=Cg(t,48,57,!0,r);return s.length<4?"0"+s:s;case 4:return Mg(t,"〇一二三四五六七八九",i);case 6:return Eg(t,1,3999,yg,3,r).toLowerCase();case 7:return Eg(t,1,3999,yg,3,r);case 8:return Cg(t,945,969,!1,r);case 9:return Cg(t,97,122,!1,r);case 10:return Cg(t,65,90,!1,r);case 11:return Cg(t,1632,1641,!0,r);case 12:case 49:return Eg(t,1,9999,wg,3,r);case 35:return Eg(t,1,9999,wg,3,r).toLowerCase();case 13:return Cg(t,2534,2543,!0,r);case 14:case 30:return Cg(t,6112,6121,!0,r);case 15:return Mg(t,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return Mg(t,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Fg(t,"零一二三四五六七八九",kg,"負",i,14);case 47:return Fg(t,"零壹貳參肆伍陸柒捌玖",Sg,"負",i,15);case 42:return Fg(t,"零一二三四五六七八九",kg,"负",i,14);case 41:return Fg(t,"零壹贰叁肆伍陆柒捌玖",Sg,"负",i,15);case 26:return Fg(t,"〇一二三四五六七八九","十百千万",Qg,i,0);case 25:return Fg(t,"零壱弐参四伍六七八九","拾百千万",Qg,i,7);case 31:return Fg(t,"영일이삼사오육칠팔구","십백천만",Ug,o,7);case 33:return Fg(t,"零一二三四五六七八九","十百千萬",Ug,o,0);case 32:return Fg(t,"零壹貳參四五六七八九","拾百千",Ug,o,7);case 18:return Cg(t,2406,2415,!0,r);case 20:return Eg(t,1,19999,Bg,3,r);case 21:return Cg(t,2790,2799,!0,r);case 22:return Cg(t,2662,2671,!0,r);case 22:return Eg(t,1,10999,bg,3,r);case 23:return Mg(t,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return Mg(t,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Cg(t,3302,3311,!0,r);case 28:return Mg(t,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return Mg(t,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return Cg(t,3792,3801,!0,r);case 37:return Cg(t,6160,6169,!0,r);case 38:return Cg(t,4160,4169,!0,r);case 39:return Cg(t,2918,2927,!0,r);case 40:return Cg(t,1776,1785,!0,r);case 43:return Cg(t,3046,3055,!0,r);case 44:return Cg(t,3174,3183,!0,r);case 45:return Cg(t,3664,3673,!0,r);case 46:return Cg(t,3872,3881,!0,r);default:return Cg(t,48,57,!0,r)}};!function(t){t[t.BEFORE=0]="BEFORE",t[t.AFTER=1]="AFTER"}(uf||(uf={}));var Tg,Og=function(){function t(){}return t.getOrigin=function(e){var n=t._link;return n?(n.href=e,n.href=n.href,n.protocol+n.hostname+n.port):"about:blank"},t.isSameOrigin=function(e){return t.getOrigin(e)===t._origin},t.setContext=function(e){t._link=e.document.createElement("a"),t._origin=t.getOrigin(e.location.href)},t._origin="about:blank",t}(),Ig=function(){function t(t,e){this.type=0,this.x=t,this.y=e}return t.prototype.add=function(e,n){return new t(this.x+e,this.y+n)},t}(),Lg=function(t,e,n){return new Ig(t.x+(e.x-t.x)*n,t.y+(e.y-t.y)*n)},Pg=function(){function t(t,e,n,r){this.type=1,this.start=t,this.startControl=e,this.endControl=n,this.end=r}return t.prototype.subdivide=function(e,n){var r=Lg(this.start,this.startControl,e),i=Lg(this.startControl,this.endControl,e),o=Lg(this.endControl,this.end,e),A=Lg(r,i,e),s=Lg(i,o,e),a=Lg(A,s,e);return n?new t(this.start,r,A,a):new t(a,s,o,this.end)},t.prototype.add=function(e,n){return new t(this.start.add(e,n),this.startControl.add(e,n),this.endControl.add(e,n),this.end.add(e,n))},t.prototype.reverse=function(){return new t(this.end,this.endControl,this.startControl,this.start)},t}(),Dg=function(t){return 1===t.type},Rg=function(t){var e=t.styles,n=t.bounds,r=_u(e.borderTopLeftRadius,n.width,n.height),i=r[0],o=r[1],A=_u(e.borderTopRightRadius,n.width,n.height),s=A[0],a=A[1],c=_u(e.borderBottomRightRadius,n.width,n.height),l=c[0],u=c[1],h=_u(e.borderBottomLeftRadius,n.width,n.height),d=h[0],f=h[1],g=[];g.push((i+s)/n.width),g.push((d+l)/n.width),g.push((o+f)/n.height),g.push((a+u)/n.height);var p=Math.max.apply(Math,g);p>1&&(i/=p,o/=p,s/=p,a/=p,l/=p,u/=p,d/=p,f/=p);var v=n.width-s,m=n.height-u,y=n.width-l,w=n.height-f,b=e.borderTopWidth,B=e.borderRightWidth,E=e.borderBottomWidth,x=e.borderLeftWidth,C=Gu(e.paddingTop,t.bounds.width),M=Gu(e.paddingRight,t.bounds.width),F=Gu(e.paddingBottom,t.bounds.width),k=Gu(e.paddingLeft,t.bounds.width);this.topLeftBorderDoubleOuterBox=i>0||o>0?Hg(n.left+x/3,n.top+b/3,i-x/3,o-b/3,Tg.TOP_LEFT):new Ig(n.left+x/3,n.top+b/3),this.topRightBorderDoubleOuterBox=i>0||o>0?Hg(n.left+v,n.top+b/3,s-B/3,a-b/3,Tg.TOP_RIGHT):new Ig(n.left+n.width-B/3,n.top+b/3),this.bottomRightBorderDoubleOuterBox=l>0||u>0?Hg(n.left+y,n.top+m,l-B/3,u-E/3,Tg.BOTTOM_RIGHT):new Ig(n.left+n.width-B/3,n.top+n.height-E/3),this.bottomLeftBorderDoubleOuterBox=d>0||f>0?Hg(n.left+x/3,n.top+w,d-x/3,f-E/3,Tg.BOTTOM_LEFT):new Ig(n.left+x/3,n.top+n.height-E/3),this.topLeftBorderDoubleInnerBox=i>0||o>0?Hg(n.left+2*x/3,n.top+2*b/3,i-2*x/3,o-2*b/3,Tg.TOP_LEFT):new Ig(n.left+2*x/3,n.top+2*b/3),this.topRightBorderDoubleInnerBox=i>0||o>0?Hg(n.left+v,n.top+2*b/3,s-2*B/3,a-2*b/3,Tg.TOP_RIGHT):new Ig(n.left+n.width-2*B/3,n.top+2*b/3),this.bottomRightBorderDoubleInnerBox=l>0||u>0?Hg(n.left+y,n.top+m,l-2*B/3,u-2*E/3,Tg.BOTTOM_RIGHT):new Ig(n.left+n.width-2*B/3,n.top+n.height-2*E/3),this.bottomLeftBorderDoubleInnerBox=d>0||f>0?Hg(n.left+2*x/3,n.top+w,d-2*x/3,f-2*E/3,Tg.BOTTOM_LEFT):new Ig(n.left+2*x/3,n.top+n.height-2*E/3),this.topLeftBorderStroke=i>0||o>0?Hg(n.left+x/2,n.top+b/2,i-x/2,o-b/2,Tg.TOP_LEFT):new Ig(n.left+x/2,n.top+b/2),this.topRightBorderStroke=i>0||o>0?Hg(n.left+v,n.top+b/2,s-B/2,a-b/2,Tg.TOP_RIGHT):new Ig(n.left+n.width-B/2,n.top+b/2),this.bottomRightBorderStroke=l>0||u>0?Hg(n.left+y,n.top+m,l-B/2,u-E/2,Tg.BOTTOM_RIGHT):new Ig(n.left+n.width-B/2,n.top+n.height-E/2),this.bottomLeftBorderStroke=d>0||f>0?Hg(n.left+x/2,n.top+w,d-x/2,f-E/2,Tg.BOTTOM_LEFT):new Ig(n.left+x/2,n.top+n.height-E/2),this.topLeftBorderBox=i>0||o>0?Hg(n.left,n.top,i,o,Tg.TOP_LEFT):new Ig(n.left,n.top),this.topRightBorderBox=s>0||a>0?Hg(n.left+v,n.top,s,a,Tg.TOP_RIGHT):new Ig(n.left+n.width,n.top),this.bottomRightBorderBox=l>0||u>0?Hg(n.left+y,n.top+m,l,u,Tg.BOTTOM_RIGHT):new Ig(n.left+n.width,n.top+n.height),this.bottomLeftBorderBox=d>0||f>0?Hg(n.left,n.top+w,d,f,Tg.BOTTOM_LEFT):new Ig(n.left,n.top+n.height),this.topLeftPaddingBox=i>0||o>0?Hg(n.left+x,n.top+b,Math.max(0,i-x),Math.max(0,o-b),Tg.TOP_LEFT):new Ig(n.left+x,n.top+b),this.topRightPaddingBox=s>0||a>0?Hg(n.left+Math.min(v,n.width-B),n.top+b,v>n.width+B?0:Math.max(0,s-B),Math.max(0,a-b),Tg.TOP_RIGHT):new Ig(n.left+n.width-B,n.top+b),this.bottomRightPaddingBox=l>0||u>0?Hg(n.left+Math.min(y,n.width-x),n.top+Math.min(m,n.height-E),Math.max(0,l-B),Math.max(0,u-E),Tg.BOTTOM_RIGHT):new Ig(n.left+n.width-B,n.top+n.height-E),this.bottomLeftPaddingBox=d>0||f>0?Hg(n.left+x,n.top+Math.min(w,n.height-E),Math.max(0,d-x),Math.max(0,f-E),Tg.BOTTOM_LEFT):new Ig(n.left+x,n.top+n.height-E),this.topLeftContentBox=i>0||o>0?Hg(n.left+x+k,n.top+b+C,Math.max(0,i-(x+k)),Math.max(0,o-(b+C)),Tg.TOP_LEFT):new Ig(n.left+x+k,n.top+b+C),this.topRightContentBox=s>0||a>0?Hg(n.left+Math.min(v,n.width+x+k),n.top+b+C,v>n.width+x+k?0:s-x+k,a-(b+C),Tg.TOP_RIGHT):new Ig(n.left+n.width-(B+M),n.top+b+C),this.bottomRightContentBox=l>0||u>0?Hg(n.left+Math.min(y,n.width-(x+k)),n.top+Math.min(m,n.height+b+C),Math.max(0,l-(B+M)),u-(E+F),Tg.BOTTOM_RIGHT):new Ig(n.left+n.width-(B+M),n.top+n.height-(E+F)),this.bottomLeftContentBox=d>0||f>0?Hg(n.left+x+k,n.top+w,Math.max(0,d-(x+k)),f-(E+F),Tg.BOTTOM_LEFT):new Ig(n.left+x+k,n.top+n.height-(E+F))};!function(t){t[t.TOP_LEFT=0]="TOP_LEFT",t[t.TOP_RIGHT=1]="TOP_RIGHT",t[t.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",t[t.BOTTOM_LEFT=3]="BOTTOM_LEFT"}(Tg||(Tg={}));var Hg=function(t,e,n,r,i){var o=(Math.sqrt(2)-1)/3*4,A=n*o,s=r*o,a=t+n,c=e+r;switch(i){case Tg.TOP_LEFT:return new Pg(new Ig(t,c),new Ig(t,c-s),new Ig(a-A,e),new Ig(a,e));case Tg.TOP_RIGHT:return new Pg(new Ig(t,e),new Ig(t+A,e),new Ig(a,c-s),new Ig(a,c));case Tg.BOTTOM_RIGHT:return new Pg(new Ig(a,e),new Ig(a,e+s),new Ig(t+A,c),new Ig(t,c));case Tg.BOTTOM_LEFT:default:return new Pg(new Ig(a,c),new Ig(a-A,c),new Ig(t,e+s),new Ig(t,e))}},_g=function(t){return[t.topLeftBorderBox,t.topRightBorderBox,t.bottomRightBorderBox,t.bottomLeftBorderBox]},Gg=function(t){return[t.topLeftPaddingBox,t.topRightPaddingBox,t.bottomRightPaddingBox,t.bottomLeftPaddingBox]},Kg=function(t,e,n){this.offsetX=t,this.offsetY=e,this.matrix=n,this.type=0,this.target=6},jg=function(t,e){this.path=t,this.target=e,this.type=1},zg=function(t){this.opacity=t,this.type=2,this.target=6},Vg=function(t){return 1===t.type},Wg=function(t,e){return t.length===e.length&&t.some(function(t,n){return t===e[n]})},Yg=function(t){this.element=t,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]},Xg=function(){function t(t,e){if(this.container=t,this.parent=e,this.effects=[],this.curves=new Rg(this.container),this.container.styles.opacity<1&&this.effects.push(new zg(this.container.styles.opacity)),null!==this.container.styles.transform){var n=this.container.bounds.left+this.container.styles.transformOrigin[0].number,r=this.container.bounds.top+this.container.styles.transformOrigin[1].number,i=this.container.styles.transform;this.effects.push(new Kg(n,r,i))}if(0!==this.container.styles.overflowX){var o=_g(this.curves),A=Gg(this.curves);Wg(o,A)?this.effects.push(new jg(o,6)):(this.effects.push(new jg(o,2)),this.effects.push(new jg(A,4)))}}return t.prototype.getEffects=function(t){for(var e=-1===[2,3].indexOf(this.container.styles.position),n=this.parent,r=this.effects.slice(0);n;){var i=n.effects.filter(function(t){return!Vg(t)});if(e||0!==n.container.styles.position||!n.parent){if(r.unshift.apply(r,i),e=-1===[2,3].indexOf(n.container.styles.position),0!==n.container.styles.overflowX){var o=_g(n.curves),A=Gg(n.curves);Wg(o,A)||r.unshift(new jg(A,6))}}else r.unshift.apply(r,i);n=n.parent}return r.filter(function(e){return Vd(e.target,t)})},t}(),qg=function(t,e,n,r){t.container.elements.forEach(function(i){var o=Vd(i.flags,4),A=Vd(i.flags,2),s=new Xg(i,t);Vd(i.styles.display,2048)&&r.push(s);var a=Vd(i.flags,8)?[]:r;if(o||A){var c=o||i.styles.isPositioned()?n:e,l=new Yg(s);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var h=0;c.negativeZIndex.some(function(t,e){return u>t.element.container.styles.zIndex.order?(h=e,!1):h>0}),c.negativeZIndex.splice(h,0,l)}else if(u>0){var d=0;c.positiveZIndex.some(function(t,e){return u>=t.element.container.styles.zIndex.order?(d=e+1,!1):d>0}),c.positiveZIndex.splice(d,0,l)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(l)}else i.styles.isFloating()?c.nonPositionedFloats.push(l):c.nonPositionedInlineLevel.push(l);qg(s,l,o?l:n,a)}else i.styles.isInlineLevel()?e.inlineLevel.push(s):e.nonInlineLevel.push(s),qg(s,e,n,a);Vd(i.flags,8)&&$g(i,a)})},$g=function(t,e){for(var n=t instanceof _f?t.start:1,r=t instanceof _f&&t.reversed,i=0;i<e.length;i++){var o=e[i];o.container instanceof Hf&&"number"==typeof o.container.value&&0!==o.container.value&&(n=o.container.value),o.listValue=Ng(n,o.container.styles.listStyleType,!0),n+=r?-1:1}},Zg=function(t,e){switch(e){case 0:return tp(t.topLeftBorderBox,t.topLeftPaddingBox,t.topRightBorderBox,t.topRightPaddingBox);case 1:return tp(t.topRightBorderBox,t.topRightPaddingBox,t.bottomRightBorderBox,t.bottomRightPaddingBox);case 2:return tp(t.bottomRightBorderBox,t.bottomRightPaddingBox,t.bottomLeftBorderBox,t.bottomLeftPaddingBox);default:return tp(t.bottomLeftBorderBox,t.bottomLeftPaddingBox,t.topLeftBorderBox,t.topLeftPaddingBox)}},Jg=function(t,e){var n=[];return Dg(t)?n.push(t.subdivide(.5,!1)):n.push(t),Dg(e)?n.push(e.subdivide(.5,!0)):n.push(e),n},tp=function(t,e,n,r){var i=[];return Dg(t)?i.push(t.subdivide(.5,!1)):i.push(t),Dg(n)?i.push(n.subdivide(.5,!0)):i.push(n),Dg(r)?i.push(r.subdivide(.5,!0).reverse()):i.push(r),Dg(e)?i.push(e.subdivide(.5,!1).reverse()):i.push(e),i},ep=function(t){var e=t.bounds,n=t.styles;return e.add(n.borderLeftWidth,n.borderTopWidth,-(n.borderRightWidth+n.borderLeftWidth),-(n.borderTopWidth+n.borderBottomWidth))},np=function(t){var e=t.styles,n=t.bounds,r=Gu(e.paddingLeft,n.width),i=Gu(e.paddingRight,n.width),o=Gu(e.paddingTop,n.width),A=Gu(e.paddingBottom,n.width);return n.add(r+e.borderLeftWidth,o+e.borderTopWidth,-(e.borderRightWidth+e.borderLeftWidth+r+i),-(e.borderTopWidth+e.borderBottomWidth+o+A))},rp=function(t,e,n){var r=function(t,e){return 0===t?e.bounds:2===t?np(e):ep(e)}(sp(t.styles.backgroundOrigin,e),t),i=function(t,e){return 0===t?e.bounds:2===t?np(e):ep(e)}(sp(t.styles.backgroundClip,e),t),o=Ap(sp(t.styles.backgroundSize,e),n,r),A=o[0],s=o[1],a=_u(sp(t.styles.backgroundPosition,e),r.width-A,r.height-s);return[ap(sp(t.styles.backgroundRepeat,e),a,o,r,i),Math.round(r.left+a[0]),Math.round(r.top+a[1]),A,s]},ip=function(t){return Qu(t)&&t.value===xh.AUTO},op=function(t){return"number"==typeof t},Ap=function(t,e,n){var r=e[0],i=e[1],o=e[2],A=t[0],s=t[1];if(!A)return[0,0];if(Lu(A)&&s&&Lu(s))return[Gu(A,n.width),Gu(s,n.height)];var a=op(o);if(Qu(A)&&(A.value===xh.CONTAIN||A.value===xh.COVER))return op(o)?n.width/n.height<o!=(A.value===xh.COVER)?[n.width,n.width/o]:[n.height*o,n.height]:[n.width,n.height];var c=op(r),l=op(i),u=c||l;if(ip(A)&&(!s||ip(s)))return c&&l?[r,i]:a||u?u&&a?[c?r:i*o,l?i:r/o]:[c?r:n.width,l?i:n.height]:[n.width,n.height];if(a){var h=0,d=0;return Lu(A)?h=Gu(A,n.width):Lu(s)&&(d=Gu(s,n.height)),ip(A)?h=d*o:s&&!ip(s)||(d=h/o),[h,d]}var f=null,g=null;if(Lu(A)?f=Gu(A,n.width):s&&Lu(s)&&(g=Gu(s,n.height)),null===f||s&&!ip(s)||(g=c&&l?f/r*i:n.height),null!==g&&ip(A)&&(f=c&&l?g/i*r:n.width),null!==f&&null!==g)return[f,g];throw new Error("Unable to calculate background-size for element")},sp=function(t,e){var n=t[e];return void 0===n?t[0]:n},ap=function(t,e,n,r,i){var o=e[0],A=e[1],s=n[0],a=n[1];switch(t){case 2:return[new Ig(Math.round(r.left),Math.round(r.top+A)),new Ig(Math.round(r.left+r.width),Math.round(r.top+A)),new Ig(Math.round(r.left+r.width),Math.round(a+r.top+A)),new Ig(Math.round(r.left),Math.round(a+r.top+A))];case 3:return[new Ig(Math.round(r.left+o),Math.round(r.top)),new Ig(Math.round(r.left+o+s),Math.round(r.top)),new Ig(Math.round(r.left+o+s),Math.round(r.height+r.top)),new Ig(Math.round(r.left+o),Math.round(r.height+r.top))];case 1:return[new Ig(Math.round(r.left+o),Math.round(r.top+A)),new Ig(Math.round(r.left+o+s),Math.round(r.top+A)),new Ig(Math.round(r.left+o+s),Math.round(r.top+A+a)),new Ig(Math.round(r.left+o),Math.round(r.top+A+a))];default:return[new Ig(Math.round(i.left),Math.round(i.top)),new Ig(Math.round(i.left+i.width),Math.round(i.top)),new Ig(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Ig(Math.round(i.left),Math.round(i.height+i.top))]}},cp="Hidden Text",lp=function(){function t(t){this._data={},this._document=t}return t.prototype.parseMetrics=function(t,e){var n=this._document.createElement("div"),r=this._document.createElement("img"),i=this._document.createElement("span"),o=this._document.body;n.style.visibility="hidden",n.style.fontFamily=t,n.style.fontSize=e,n.style.margin="0",n.style.padding="0",n.style.whiteSpace="nowrap",o.appendChild(n),r.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",r.width=1,r.height=1,r.style.margin="0",r.style.padding="0",r.style.verticalAlign="baseline",i.style.fontFamily=t,i.style.fontSize=e,i.style.margin="0",i.style.padding="0",i.appendChild(this._document.createTextNode(cp)),n.appendChild(i),n.appendChild(r);var A=r.offsetTop-i.offsetTop+2;n.removeChild(i),n.appendChild(this._document.createTextNode(cp)),n.style.lineHeight="normal",r.style.verticalAlign="super";var s=r.offsetTop-n.offsetTop+2;return o.removeChild(n),{baseline:A,middle:s}},t.prototype.getMetrics=function(t,e){var n=t+" "+e;return void 0===this._data[n]&&(this._data[n]=this.parseMetrics(t,e)),this._data[n]},t}(),up=function(t,e){this.context=t,this.options=e};!function(t){function e(e,n){var r=t.call(this,e,n)||this;return r._activeEffects=[],r.canvas=n.canvas?n.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),n.canvas||(r.canvas.width=Math.floor(n.width*n.scale),r.canvas.height=Math.floor(n.height*n.scale),r.canvas.style.width=n.width+"px",r.canvas.style.height=n.height+"px"),r.fontMetrics=new lp(document),r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-n.x,-n.y),r.ctx.textBaseline="bottom",r._activeEffects=[],r.context.logger.debug("Canvas renderer initialized ("+n.width+"x"+n.height+") with scale "+n.scale),r}Gc(e,t),e.prototype.applyEffects=function(t){for(var e=this;this._activeEffects.length;)this.popEffect();t.forEach(function(t){return e.applyEffect(t)})},e.prototype.applyEffect=function(t){this.ctx.save(),function(t){return 2===t.type}(t)&&(this.ctx.globalAlpha=t.opacity),function(t){return 0===t.type}(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Vg(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Kc(this,0,void 0,function(){return jc(this,function(e){switch(e.label){case 0:return t.element.container.styles.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Kc(this,0,void 0,function(){return jc(this,function(e){switch(e.label){case 0:return Vd(t.container.flags,16),t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return e.sent(),[4,this.renderNodeContent(t)];case 2:e.sent(),e.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,e,n){var r=this;0===e?this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+n):Sf(t.text).reduce(function(e,i){return r.ctx.fillText(i,e,t.bounds.top+n),e+r.ctx.measureText(i).width},t.bounds.left)},e.prototype.createFontStyle=function(t){var e=t.fontVariant.filter(function(t){return"normal"===t||"small-caps"===t}).join(""),n=pp(t.fontFamily).join(", "),r=ku(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,e,t.fontWeight,r,n].join(" "),n,r]},e.prototype.renderTextNode=function(t,e){return Kc(this,0,void 0,function(){var n,r,i,o,A,s,a,c,l=this;return jc(this,function(u){return n=this.createFontStyle(e),r=n[0],i=n[1],o=n[2],this.ctx.font=r,this.ctx.direction=1===e.direction?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",A=this.fontMetrics.getMetrics(i,o),s=A.baseline,a=A.middle,c=e.paintOrder,t.textBounds.forEach(function(t){c.forEach(function(n){switch(n){case 0:l.ctx.fillStyle=$u(e.color),l.renderTextWithLetterSpacing(t,e.letterSpacing,s);var r=e.textShadow;r.length&&t.text.trim().length&&(r.slice(0).reverse().forEach(function(n){l.ctx.shadowColor=$u(n.color),l.ctx.shadowOffsetX=n.offsetX.number*l.options.scale,l.ctx.shadowOffsetY=n.offsetY.number*l.options.scale,l.ctx.shadowBlur=n.blur.number,l.renderTextWithLetterSpacing(t,e.letterSpacing,s)}),l.ctx.shadowColor="",l.ctx.shadowOffsetX=0,l.ctx.shadowOffsetY=0,l.ctx.shadowBlur=0),e.textDecorationLine.length&&(l.ctx.fillStyle=$u(e.textDecorationColor||e.color),e.textDecorationLine.forEach(function(e){switch(e){case 1:l.ctx.fillRect(t.bounds.left,Math.round(t.bounds.top+s),t.bounds.width,1);break;case 2:l.ctx.fillRect(t.bounds.left,Math.round(t.bounds.top),t.bounds.width,1);break;case 3:l.ctx.fillRect(t.bounds.left,Math.ceil(t.bounds.top+a),t.bounds.width,1)}}));break;case 1:e.webkitTextStrokeWidth&&t.text.trim().length&&(l.ctx.strokeStyle=$u(e.webkitTextStrokeColor),l.ctx.lineWidth=e.webkitTextStrokeWidth,l.ctx.lineJoin=window.chrome?"miter":"round",l.ctx.strokeText(t.text,t.bounds.left,t.bounds.top+s)),l.ctx.strokeStyle="",l.ctx.lineWidth=0,l.ctx.lineJoin="miter"}})}),[2]})})},e.prototype.renderReplacedElement=function(t,e,n){if(n&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var r=np(t),i=Gg(e);this.path(i),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(n,0,0,t.intrinsicWidth,t.intrinsicHeight,r.left,r.top,r.width,r.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Kc(this,0,void 0,function(){var n,r,i,o,A,s,a,c,l,u,h,d,f,g,p,v,m,y;return jc(this,function(w){switch(w.label){case 0:this.applyEffects(t.getEffects(4)),n=t.container,r=t.curves,i=n.styles,o=0,A=n.textNodes,w.label=1;case 1:return o<A.length?(s=A[o],[4,this.renderTextNode(s,i)]):[3,4];case 2:w.sent(),w.label=3;case 3:return o++,[3,1];case 4:if(!(n instanceof Pf))return[3,8];w.label=5;case 5:return w.trys.push([5,7,,8]),[4,this.context.cache.match(n.src)];case 6:return p=w.sent(),this.renderReplacedElement(n,r,p),[3,8];case 7:return w.sent(),this.context.logger.error("Error loading image "+n.src),[3,8];case 8:if(n instanceof Df&&this.renderReplacedElement(n,r,n.canvas),!(n instanceof Rf))return[3,12];w.label=9;case 9:return w.trys.push([9,11,,12]),[4,this.context.cache.match(n.svg)];case 10:return p=w.sent(),this.renderReplacedElement(n,r,p),[3,12];case 11:return w.sent(),this.context.logger.error("Error loading svg "+n.svg.substring(0,255)),[3,12];case 12:return n instanceof $f&&n.tree?[4,new e(this.context,{scale:this.options.scale,backgroundColor:n.backgroundColor,x:0,y:0,width:n.width,height:n.height}).render(n.tree)]:[3,14];case 13:a=w.sent(),n.width&&n.height&&this.ctx.drawImage(a,0,0,n.width,n.height,n.bounds.left,n.bounds.top,n.bounds.width,n.bounds.height),w.label=14;case 14:if(n instanceof Yf&&(c=Math.min(n.bounds.width,n.bounds.height),n.type===jf?n.checked&&(this.ctx.save(),this.path([new Ig(n.bounds.left+.39363*c,n.bounds.top+.79*c),new Ig(n.bounds.left+.16*c,n.bounds.top+.5549*c),new Ig(n.bounds.left+.27347*c,n.bounds.top+.44071*c),new Ig(n.bounds.left+.39694*c,n.bounds.top+.5649*c),new Ig(n.bounds.left+.72983*c,n.bounds.top+.23*c),new Ig(n.bounds.left+.84*c,n.bounds.top+.34085*c),new Ig(n.bounds.left+.39363*c,n.bounds.top+.79*c)]),this.ctx.fillStyle=$u(Wf),this.ctx.fill(),this.ctx.restore()):n.type===zf&&n.checked&&(this.ctx.save(),this.ctx.beginPath(),this.ctx.arc(n.bounds.left+c/2,n.bounds.top+c/2,c/4,0,2*Math.PI,!0),this.ctx.fillStyle=$u(Wf),this.ctx.fill(),this.ctx.restore())),hp(n)&&n.value.length){switch(l=this.createFontStyle(i),m=l[0],u=l[1],h=this.fontMetrics.getMetrics(m,u).baseline,this.ctx.font=m,this.ctx.fillStyle=$u(i.color),this.ctx.textBaseline="alphabetic",this.ctx.textAlign=fp(n.styles.textAlign),y=np(n),d=0,n.styles.textAlign){case 1:d+=y.width/2;break;case 2:d+=y.width}f=y.add(d,0,0,-y.height/2+1),this.ctx.save(),this.path([new Ig(y.left,y.top),new Ig(y.left+y.width,y.top),new Ig(y.left+y.width,y.top+y.height),new Ig(y.left,y.top+y.height)]),this.ctx.clip(),this.renderTextWithLetterSpacing(new Mf(n.value,f),i.letterSpacing,h),this.ctx.restore(),this.ctx.textBaseline="alphabetic",this.ctx.textAlign="left"}if(!Vd(n.styles.display,2048))return[3,20];if(null===n.styles.listStyleImage)return[3,19];if(0!==(g=n.styles.listStyleImage).type)return[3,18];p=void 0,v=g.url,w.label=15;case 15:return w.trys.push([15,17,,18]),[4,this.context.cache.match(v)];case 16:return p=w.sent(),this.ctx.drawImage(p,n.bounds.left-(p.width+10),n.bounds.top),[3,18];case 17:return w.sent(),this.context.logger.error("Error loading list-style-image "+v),[3,18];case 18:return[3,20];case 19:t.listValue&&-1!==n.styles.listStyleType&&(m=this.createFontStyle(i)[0],this.ctx.font=m,this.ctx.fillStyle=$u(i.color),this.ctx.textBaseline="middle",this.ctx.textAlign="right",y=new zc(n.bounds.left,n.bounds.top+Gu(n.styles.paddingTop,n.bounds.width),n.bounds.width,cd(i.lineHeight,i.fontSize.number)/2+1),this.renderTextWithLetterSpacing(new Mf(t.listValue,y),i.letterSpacing,cd(i.lineHeight,i.fontSize.number)/2+2),this.ctx.textBaseline="bottom",this.ctx.textAlign="left"),w.label=20;case 20:return[2]}})})},e.prototype.renderStackContent=function(t){return Kc(this,0,void 0,function(){var e,n,r,i,o,A,s,a,c,l,u,h,d,f,g;return jc(this,function(p){switch(p.label){case 0:return Vd(t.element.container.flags,16),[4,this.renderNodeBackgroundAndBorders(t.element)];case 1:p.sent(),e=0,n=t.negativeZIndex,p.label=2;case 2:return e<n.length?(g=n[e],[4,this.renderStack(g)]):[3,5];case 3:p.sent(),p.label=4;case 4:return e++,[3,2];case 5:return[4,this.renderNodeContent(t.element)];case 6:p.sent(),r=0,i=t.nonInlineLevel,p.label=7;case 7:return r<i.length?(g=i[r],[4,this.renderNode(g)]):[3,10];case 8:p.sent(),p.label=9;case 9:return r++,[3,7];case 10:o=0,A=t.nonPositionedFloats,p.label=11;case 11:return o<A.length?(g=A[o],[4,this.renderStack(g)]):[3,14];case 12:p.sent(),p.label=13;case 13:return o++,[3,11];case 14:s=0,a=t.nonPositionedInlineLevel,p.label=15;case 15:return s<a.length?(g=a[s],[4,this.renderStack(g)]):[3,18];case 16:p.sent(),p.label=17;case 17:return s++,[3,15];case 18:c=0,l=t.inlineLevel,p.label=19;case 19:return c<l.length?(g=l[c],[4,this.renderNode(g)]):[3,22];case 20:p.sent(),p.label=21;case 21:return c++,[3,19];case 22:u=0,h=t.zeroOrAutoZIndexOrTransformedOrOpacity,p.label=23;case 23:return u<h.length?(g=h[u],[4,this.renderStack(g)]):[3,26];case 24:p.sent(),p.label=25;case 25:return u++,[3,23];case 26:d=0,f=t.positiveZIndex,p.label=27;case 27:return d<f.length?(g=f[d],[4,this.renderStack(g)]):[3,30];case 28:p.sent(),p.label=29;case 29:return d++,[3,27];case 30:return[2]}})})},e.prototype.mask=function(t){this.ctx.beginPath(),this.ctx.moveTo(0,0),this.ctx.lineTo(this.canvas.width,0),this.ctx.lineTo(this.canvas.width,this.canvas.height),this.ctx.lineTo(0,this.canvas.height),this.ctx.lineTo(0,0),this.formatPath(t.slice(0).reverse()),this.ctx.closePath()},e.prototype.path=function(t){this.ctx.beginPath(),this.formatPath(t),this.ctx.closePath()},e.prototype.formatPath=function(t){var e=this;t.forEach(function(t,n){var r=Dg(t)?t.start:t;0===n?e.ctx.moveTo(r.x,r.y):e.ctx.lineTo(r.x,r.y),Dg(t)&&e.ctx.bezierCurveTo(t.startControl.x,t.startControl.y,t.endControl.x,t.endControl.y,t.end.x,t.end.y)})},e.prototype.renderRepeat=function(t,e,n,r){this.path(t),this.ctx.fillStyle=e,this.ctx.translate(n,r),this.ctx.fill(),this.ctx.translate(-n,-r)},e.prototype.resizeImage=function(t,e,n){var r;if(t.width===e&&t.height===n)return t;var i=(null!==(r=this.canvas.ownerDocument)&&void 0!==r?r:document).createElement("canvas");return i.width=Math.max(1,e),i.height=Math.max(1,n),i.getContext("2d").drawImage(t,0,0,t.width,t.height,0,0,e,n),i},e.prototype.renderBackgroundImage=function(t){return Kc(this,0,void 0,function(){var e,n,r,i,o,A;return jc(this,function(s){switch(s.label){case 0:e=t.styles.backgroundImage.length-1,n=function(n){var i,o,A,s,a,c,l,u,h,d,f,g,p,v,m,y,w,b,B,E,x,C,M,F,k,S,Q,U,N,T,O;return jc(this,function(I){switch(I.label){case 0:if(0!==n.type)return[3,5];i=void 0,o=n.url,I.label=1;case 1:return I.trys.push([1,3,,4]),[4,r.context.cache.match(o)];case 2:return i=I.sent(),[3,4];case 3:return I.sent(),r.context.logger.error("Error loading background-image "+o),[3,4];case 4:return i&&(A=rp(t,e,[i.width,i.height,i.width/i.height]),y=A[0],C=A[1],M=A[2],B=A[3],E=A[4],v=r.ctx.createPattern(r.resizeImage(i,B,E),"repeat"),r.renderRepeat(y,v,C,M)),[3,6];case 5:1===n.type?(s=rp(t,e,[null,null,null]),y=s[0],C=s[1],M=s[2],B=s[3],E=s[4],a=lh(n.angle,B,E),c=a[0],l=a[1],u=a[2],h=a[3],d=a[4],(f=document.createElement("canvas")).width=B,f.height=E,g=f.getContext("2d"),p=g.createLinearGradient(l,h,u,d),ch(n.stops,c).forEach(function(t){return p.addColorStop(t.stop,$u(t.color))}),g.fillStyle=p,g.fillRect(0,0,B,E),B>0&&E>0&&(v=r.ctx.createPattern(f,"repeat"),r.renderRepeat(y,v,C,M))):function(t){return 2===t.type}(n)&&(m=rp(t,e,[null,null,null]),y=m[0],w=m[1],b=m[2],B=m[3],E=m[4],x=0===n.position.length?[Ru]:n.position,C=Gu(x[0],B),M=Gu(x[x.length-1],E),F=function(t,e,n,r,i){var o=0,A=0;switch(t.size){case 0:0===t.shape?o=A=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(n),Math.abs(n-i)):1===t.shape&&(o=Math.min(Math.abs(e),Math.abs(e-r)),A=Math.min(Math.abs(n),Math.abs(n-i)));break;case 2:if(0===t.shape)o=A=Math.min(uh(e,n),uh(e,n-i),uh(e-r,n),uh(e-r,n-i));else if(1===t.shape){var s=Math.min(Math.abs(n),Math.abs(n-i))/Math.min(Math.abs(e),Math.abs(e-r)),a=hh(r,i,e,n,!0),c=a[0],l=a[1];A=s*(o=uh(c-e,(l-n)/s))}break;case 1:0===t.shape?o=A=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(n),Math.abs(n-i)):1===t.shape&&(o=Math.max(Math.abs(e),Math.abs(e-r)),A=Math.max(Math.abs(n),Math.abs(n-i)));break;case 3:if(0===t.shape)o=A=Math.max(uh(e,n),uh(e,n-i),uh(e-r,n),uh(e-r,n-i));else if(1===t.shape){s=Math.max(Math.abs(n),Math.abs(n-i))/Math.max(Math.abs(e),Math.abs(e-r));var u=hh(r,i,e,n,!1);c=u[0],l=u[1],A=s*(o=uh(c-e,(l-n)/s))}}return Array.isArray(t.size)&&(o=Gu(t.size[0],r),A=2===t.size.length?Gu(t.size[1],i):o),[o,A]}(n,C,M,B,E),k=F[0],S=F[1],k>0&&S>0&&(Q=r.ctx.createRadialGradient(w+C,b+M,0,w+C,b+M,k),ch(n.stops,2*k).forEach(function(t){return Q.addColorStop(t.stop,$u(t.color))}),r.path(y),r.ctx.fillStyle=Q,k!==S?(U=t.bounds.left+.5*t.bounds.width,N=t.bounds.top+.5*t.bounds.height,O=1/(T=S/k),r.ctx.save(),r.ctx.translate(U,N),r.ctx.transform(1,0,0,T,0,0),r.ctx.translate(-U,-N),r.ctx.fillRect(w,O*(b-N)+N,B,E*O),r.ctx.restore()):r.ctx.fill())),I.label=6;case 6:return e--,[2]}})},r=this,i=0,o=t.styles.backgroundImage.slice(0).reverse(),s.label=1;case 1:return i<o.length?(A=o[i],[5,n(A)]):[3,4];case 2:s.sent(),s.label=3;case 3:return i++,[3,1];case 4:return[2]}})})},e.prototype.renderSolidBorder=function(t,e,n){return Kc(this,0,void 0,function(){return jc(this,function(r){return this.path(Zg(n,e)),this.ctx.fillStyle=$u(t),this.ctx.fill(),[2]})})},e.prototype.renderDoubleBorder=function(t,e,n,r){return Kc(this,0,void 0,function(){var i,o;return jc(this,function(A){switch(A.label){case 0:return e<3?[4,this.renderSolidBorder(t,n,r)]:[3,2];case 1:return A.sent(),[2];case 2:return i=function(t,e){switch(e){case 0:return tp(t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox,t.topRightBorderBox,t.topRightBorderDoubleOuterBox);case 1:return tp(t.topRightBorderBox,t.topRightBorderDoubleOuterBox,t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox);case 2:return tp(t.bottomRightBorderBox,t.bottomRightBorderDoubleOuterBox,t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox);default:return tp(t.bottomLeftBorderBox,t.bottomLeftBorderDoubleOuterBox,t.topLeftBorderBox,t.topLeftBorderDoubleOuterBox)}}(r,n),this.path(i),this.ctx.fillStyle=$u(t),this.ctx.fill(),o=function(t,e){switch(e){case 0:return tp(t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox,t.topRightBorderDoubleInnerBox,t.topRightPaddingBox);case 1:return tp(t.topRightBorderDoubleInnerBox,t.topRightPaddingBox,t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox);case 2:return tp(t.bottomRightBorderDoubleInnerBox,t.bottomRightPaddingBox,t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox);default:return tp(t.bottomLeftBorderDoubleInnerBox,t.bottomLeftPaddingBox,t.topLeftBorderDoubleInnerBox,t.topLeftPaddingBox)}}(r,n),this.path(o),this.ctx.fill(),[2]}})})},e.prototype.renderNodeBackgroundAndBorders=function(t){return Kc(this,0,void 0,function(){var e,n,r,i,o,A,s,a,c=this;return jc(this,function(l){switch(l.label){case 0:return this.applyEffects(t.getEffects(2)),e=t.container.styles,n=!qu(e.backgroundColor)||e.backgroundImage.length,r=[{style:e.borderTopStyle,color:e.borderTopColor,width:e.borderTopWidth},{style:e.borderRightStyle,color:e.borderRightColor,width:e.borderRightWidth},{style:e.borderBottomStyle,color:e.borderBottomColor,width:e.borderBottomWidth},{style:e.borderLeftStyle,color:e.borderLeftColor,width:e.borderLeftWidth}],i=dp(sp(e.backgroundClip,0),t.curves),n||e.boxShadow.length?(this.ctx.save(),this.path(i),this.ctx.clip(),qu(e.backgroundColor)||(this.ctx.fillStyle=$u(e.backgroundColor),this.ctx.fill()),[4,this.renderBackgroundImage(t.container)]):[3,2];case 1:l.sent(),this.ctx.restore(),e.boxShadow.slice(0).reverse().forEach(function(e){c.ctx.save();var n,r,i,o,A,s=_g(t.curves),a=e.inset?0:1e4,l=(n=s,r=-a+(e.inset?1:-1)*e.spread.number,i=(e.inset?1:-1)*e.spread.number,o=e.spread.number*(e.inset?-2:2),A=e.spread.number*(e.inset?-2:2),n.map(function(t,e){switch(e){case 0:return t.add(r,i);case 1:return t.add(r+o,i);case 2:return t.add(r+o,i+A);case 3:return t.add(r,i+A)}return t}));e.inset?(c.path(s),c.ctx.clip(),c.mask(l)):(c.mask(s),c.ctx.clip(),c.path(l)),c.ctx.shadowOffsetX=e.offsetX.number+a,c.ctx.shadowOffsetY=e.offsetY.number,c.ctx.shadowColor=$u(e.color),c.ctx.shadowBlur=e.blur.number,c.ctx.fillStyle=e.inset?$u(e.color):"rgba(0,0,0,1)",c.ctx.fill(),c.ctx.restore()}),l.label=2;case 2:o=0,A=0,s=r,l.label=3;case 3:return A<s.length?0!==(a=s[A]).style&&!qu(a.color)&&a.width>0?2!==a.style?[3,5]:[4,this.renderDashedDottedBorder(a.color,a.width,o,t.curves,2)]:[3,11]:[3,13];case 4:return l.sent(),[3,11];case 5:return 3!==a.style?[3,7]:[4,this.renderDashedDottedBorder(a.color,a.width,o,t.curves,3)];case 6:return l.sent(),[3,11];case 7:return 4!==a.style?[3,9]:[4,this.renderDoubleBorder(a.color,a.width,o,t.curves)];case 8:return l.sent(),[3,11];case 9:return[4,this.renderSolidBorder(a.color,o,t.curves)];case 10:l.sent(),l.label=11;case 11:o++,l.label=12;case 12:return A++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,e,n,r,i){return Kc(this,0,void 0,function(){var o,A,s,a,c,l,u,h,d,f,g,p,v,m,y,w;return jc(this,function(b){return this.ctx.save(),o=function(t,e){switch(e){case 0:return Jg(t.topLeftBorderStroke,t.topRightBorderStroke);case 1:return Jg(t.topRightBorderStroke,t.bottomRightBorderStroke);case 2:return Jg(t.bottomRightBorderStroke,t.bottomLeftBorderStroke);default:return Jg(t.bottomLeftBorderStroke,t.topLeftBorderStroke)}}(r,n),A=Zg(r,n),2===i&&(this.path(A),this.ctx.clip()),Dg(A[0])?(s=A[0].start.x,a=A[0].start.y):(s=A[0].x,a=A[0].y),Dg(A[1])?(c=A[1].end.x,l=A[1].end.y):(c=A[1].x,l=A[1].y),u=0===n||2===n?Math.abs(s-c):Math.abs(a-l),this.ctx.beginPath(),3===i?this.formatPath(o):this.formatPath(A.slice(0,2)),h=e<3?3*e:2*e,d=e<3?2*e:e,3===i&&(h=e,d=e),f=!0,u<=2*h?f=!1:u<=2*h+d?(h*=g=u/(2*h+d),d*=g):(p=Math.floor((u+d)/(h+d)),v=(u-p*h)/(p-1),d=(m=(u-(p+1)*h)/p)<=0||Math.abs(d-v)<Math.abs(d-m)?v:m),f&&(3===i?this.ctx.setLineDash([0,h+d]):this.ctx.setLineDash([h,d])),3===i?(this.ctx.lineCap="round",this.ctx.lineWidth=e):this.ctx.lineWidth=2*e+1.1,this.ctx.strokeStyle=$u(t),this.ctx.stroke(),this.ctx.setLineDash([]),2===i&&(Dg(A[0])&&(y=A[3],w=A[0],this.ctx.beginPath(),this.formatPath([new Ig(y.end.x,y.end.y),new Ig(w.start.x,w.start.y)]),this.ctx.stroke()),Dg(A[1])&&(y=A[1],w=A[2],this.ctx.beginPath(),this.formatPath([new Ig(y.end.x,y.end.y),new Ig(w.start.x,w.start.y)]),this.ctx.stroke())),this.ctx.restore(),[2]})})},e.prototype.render=function(t){return Kc(this,0,void 0,function(){var e;return jc(this,function(n){switch(n.label){case 0:return this.options.backgroundColor&&(this.ctx.fillStyle=$u(this.options.backgroundColor),this.ctx.fillRect(this.options.x,this.options.y,this.options.width,this.options.height)),e=function(t){var e=new Xg(t,null),n=new Yg(e),r=[];return qg(e,n,n,r),$g(e.container,r),n}(t),[4,this.renderStack(e)];case 1:return n.sent(),this.applyEffects([]),[2,this.canvas]}})})}}(up);var hp=function(t){return t instanceof qf||(t instanceof Xf||t instanceof Yf&&t.type!==zf&&t.type!==jf)},dp=function(t,e){switch(t){case 0:return _g(e);case 2:return function(t){return[t.topLeftContentBox,t.topRightContentBox,t.bottomRightContentBox,t.bottomLeftContentBox]}(e);default:return Gg(e)}},fp=function(t){switch(t){case 1:return"center";case 2:return"right";default:return"left"}},gp=["-apple-system","system-ui"],pp=function(t){return/iPhone OS 15_(0|1)/.test(window.navigator.userAgent)?t.filter(function(t){return-1===gp.indexOf(t)}):t};!function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.canvas=n.canvas?n.canvas:document.createElement("canvas"),r.ctx=r.canvas.getContext("2d"),r.options=n,r.canvas.width=Math.floor(n.width*n.scale),r.canvas.height=Math.floor(n.height*n.scale),r.canvas.style.width=n.width+"px",r.canvas.style.height=n.height+"px",r.ctx.scale(r.options.scale,r.options.scale),r.ctx.translate(-n.x,-n.y),r.context.logger.debug("EXPERIMENTAL ForeignObject renderer initialized ("+n.width+"x"+n.height+" at "+n.x+","+n.y+") with scale "+n.scale),r}Gc(e,t),e.prototype.render=function(t){return Kc(this,0,void 0,function(){var e,n;return jc(this,function(r){switch(r.label){case 0:return e=Ef(this.options.width*this.options.scale,this.options.height*this.options.scale,this.options.scale,this.options.scale,t),[4,vp(e)];case 1:return n=r.sent(),this.options.backgroundColor&&(this.ctx.fillStyle=$u(this.options.backgroundColor),this.ctx.fillRect(0,0,this.options.width*this.options.scale,this.options.height*this.options.scale)),this.ctx.drawImage(n,-this.options.x*this.options.scale,-this.options.y*this.options.scale),[2,this.canvas]}})})}}(up);var vp=function(t){return new Promise(function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent((new XMLSerializer).serializeToString(t))})};"undefined"!=typeof window&&Og.setContext(window);
40
+ /*!
41
+ * @antv/g
42
+ * @description A core module for rendering engine implements DOM API.
43
+ * @version 6.3.1
44
+ * @date 12/24/2025, 11:55:39 AM
45
+ * @author AntVis
46
+ * @docs https://g.antv.antgroup.com/
47
+ */var mp=function(t){function e(t,n,r,i){var o;return A(this,e),(o=g(this,e,[t])).currentTime=r,o.timelineTime=i,o.target=n,o.type="finish",o.bubbles=!1,o.currentTarget=n,o.defaultPrevented=!1,o.eventPhase=o.AT_TARGET,o.timeStamp=Date.now(),o.currentTime=r,o.timelineTime=i,o}return v(e,t),a(e)}(Gs),yp=0,wp=function(){return a(function t(e,n){var r;A(this,t),this.currentTimePending=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._playbackRate=1,this._inTimeline=!0,this.effect=e,e.animation=this,this.timeline=n,this.id="".concat(yp++),this._inEffect=!!this.effect.update(0),this._totalDuration=Number(null===(r=this.effect)||void 0===r?void 0:r.getComputedTiming().endTime),this._holdTime=0,this._paused=!1,this.oldPlayState="idle",this.updatePromises()},[{key:"pending",get:function(){return null===this._startTime&&!this._paused&&0!==this.playbackRate||this.currentTimePending}},{key:"playState",get:function(){return this._idle?"idle":this._isFinished?"finished":this._paused?"paused":"running"}},{key:"ready",get:function(){var t=this;return this.readyPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.readyPromise=new Promise(function(e,n){t.resolveReadyPromise=function(){e(t)},t.rejectReadyPromise=function(){n(new Error)}}),this.pending||this.resolveReadyPromise()),this.readyPromise}},{key:"finished",get:function(){var t=this;return this.finishedPromise||(-1===this.timeline.animationsWithPromises.indexOf(this)&&this.timeline.animationsWithPromises.push(this),this.finishedPromise=new Promise(function(e,n){t.resolveFinishedPromise=function(){e(t)},t.rejectFinishedPromise=function(){n(new Error)}}),"finished"===this.playState&&this.resolveFinishedPromise()),this.finishedPromise}},{key:"currentTime",get:function(){return this.updatePromises(),this._idle||this.currentTimePending?null:this._currentTime},set:function(t){if(t=Number(t),!isNaN(t)){var e;if(this.timeline.restart(),!this._paused&&null!==this._startTime)this._startTime=Number(null===(e=this.timeline)||void 0===e?void 0:e.currentTime)-t/this.playbackRate;this.currentTimePending=!1,this._currentTime!==t&&(this._idle&&(this._idle=!1,this._paused=!0),this.tickCurrentTime(t,!0),this.timeline.applyDirtiedAnimation(this))}}},{key:"startTime",get:function(){return this._startTime},set:function(t){if(null!==t){if(this.updatePromises(),t=Number(t),isNaN(t))return;if(this._paused||this._idle)return;this._startTime=t,this.tickCurrentTime((Number(this.timeline.currentTime)-this._startTime)*this.playbackRate),this.timeline.applyDirtiedAnimation(this),this.updatePromises()}}},{key:"playbackRate",get:function(){return this._playbackRate},set:function(t){if(t!==this._playbackRate){this.updatePromises();var e=this.currentTime;this._playbackRate=t,this.startTime=null,"paused"!==this.playState&&"idle"!==this.playState&&(this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this)),null!==e&&(this.currentTime=e),this.updatePromises()}}},{key:"_isFinished",get:function(){return!this._idle&&(this._playbackRate>0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||"running"===this.playState||!this._finishedFlag}},{key:"updatePromises",value:function(){var t;if(null!==(t=this.effect.target)&&void 0!==t&&t.destroyed)return this.readyPromise=void 0,this.finishedPromise=void 0,!1;var e=this.oldPlayState,n=this.pending?"pending":this.playState;return this.readyPromise&&n!==e&&("idle"===n?(this.rejectReadyPromise(),this.readyPromise=void 0):"pending"===e?this.resolveReadyPromise():"pending"===n&&(this.readyPromise=void 0)),this.finishedPromise&&n!==e&&("idle"===n?(this.rejectFinishedPromise(),this.finishedPromise=void 0):"finished"===n?this.resolveFinishedPromise():"finished"===e&&(this.finishedPromise=void 0)),this.oldPlayState=n,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),-1===this.timeline.animations.indexOf(this)&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._isFinished||this._paused||this._idle?this._idle&&(this.rewind(),this._idle=!1):this.currentTimePending=!0,this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var t=this;if(this.updatePromises(),this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=null,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var e=new mp(null,this,this.currentTime,null);setTimeout(function(){t.oncancel(e)})}}},{key:"reverse",value:function(){this.updatePromises();var t=this.currentTime;this.playbackRate*=-1,this.play(),null!==t&&(this.currentTime=t),this.updatePromises()}},{key:"updatePlaybackRate",value:function(t){this.playbackRate=t}},{key:"targetAnimations",value:function(){var t;return(null===(t=this.effect)||void 0===t?void 0:t.target).getAnimations()}},{key:"markTarget",value:function(){var t=this.targetAnimations();-1===t.indexOf(this)&&t.push(this)}},{key:"unmarkTarget",value:function(){var t=this.targetAnimations(),e=t.indexOf(this);-1!==e&&t.splice(e,1)}},{key:"tick",value:function(t,e){this._idle||this._paused||(null===this._startTime?e&&(this.startTime=t-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((t-this._startTime)*this.playbackRate)),e&&(this.currentTimePending=!1,this.fireEvents(t))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else{if(!(this._totalDuration<1/0))throw new Error("Unable to rewind negative playback rate animation with infinite duration");this.currentTime=this._totalDuration}}},{key:"persist",value:function(){throw new Error(Cr)}},{key:"addEventListener",value:function(t,e,n){throw new Error(Cr)}},{key:"removeEventListener",value:function(t,e,n){throw new Error(Cr)}},{key:"dispatchEvent",value:function(t){throw new Error(Cr)}},{key:"commitStyles",value:function(){throw new Error(Cr)}},{key:"ensureAlive",value:function(){var t,e;this.playbackRate<0&&0===this.currentTime?this._inEffect=!(null===(t=this.effect)||void 0===t||!t.update(-1)):this._inEffect=!(null===(e=this.effect)||void 0===e||!e.update(this.currentTime));this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(t,e){t!==this._currentTime&&(this._currentTime=t,this._isFinished&&!e&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(t){var e=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var n=new mp(null,this,this.currentTime,t);setTimeout(function(){e.onfinish&&e.onfinish(n)})}this._finishedFlag=!0}}else{if(this.onframe&&"running"===this.playState){var r=new mp(null,this,this.currentTime,t);this.onframe(r)}this._finishedFlag=!1}}}])}(),bp=.1,Bp="function"==typeof Float32Array,Ep=function(t,e){return 1-3*e+3*t},xp=function(t,e){return 3*e-6*t},Cp=function(t){return 3*t},Mp=function(t,e,n){return((Ep(e,n)*t+xp(e,n))*t+Cp(e))*t},Fp=function(t,e,n){return 3*Ep(e,n)*t*t+2*xp(e,n)*t+Cp(e)},kp=function(t,e,n,r){if(!(t>=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===r)return function(t){return t};for(var i=Bp?new Float32Array(11):new Array(11),o=0;o<11;++o)i[o]=Mp(o*bp,t,n);var A=function(e){for(var r=0,o=1;10!==o&&i[o]<=e;++o)r+=bp;--o;var A=r+(e-i[o])/(i[o+1]-i[o])*bp,s=Fp(A,t,n);return s>=.001?function(t,e,n,r){for(var i=0;i<4;++i){var o=Fp(e,n,r);if(0===o)return e;e-=(Mp(e,n,r)-t)/o}return e}(e,A,t,n):0===s?A:function(t,e,n,r,i){var o,A,s=0;do{(o=Mp(A=e+(n-e)/2,r,i)-t)>0?n=A:e=A}while(Math.abs(o)>1e-7&&++s<10);return A}(e,r,r+bp,t,n)};return function(t){return 0===t||1===t?t:Mp(A(t),e,r)}},Sp=function(t){return Math.pow(t,2)},Qp=function(t){return Math.pow(t,3)},Up=function(t){return Math.pow(t,4)},Np=function(t){return Math.pow(t,5)},Tp=function(t){return Math.pow(t,6)},Op=function(t){return 1-Math.cos(t*Math.PI/2)},Ip=function(t){return 1-Math.sqrt(1-t*t)},Lp=function(t){return t*t*(3*t-2)},Pp=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*e-2)/22-t,2)},Dp=function(t){var e=m(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?1:n,i=e[1],o=void 0===i?.5:i,A=ne(Number(r),1,10),s=ne(Number(o),.1,2);return 0===t||1===t?t:-A*Math.pow(2,10*(t-1))*Math.sin((t-1-s/(2*Math.PI)*Math.asin(1/A))*(2*Math.PI)/s)},Rp=function(t){var e=arguments.length>2?arguments[2]:void 0,n=m(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),r=n[0],i=void 0===r?1:r,o=n[1],A=void 0===o?100:o,s=n[2],a=void 0===s?10:s,c=n[3],l=void 0===c?0:c;i=ne(i,.1,1e3),A=ne(A,.1,1e3),a=ne(a,.1,1e3),l=ne(l,.1,1e3);var u=Math.sqrt(A/i),h=a/(2*Math.sqrt(A*i)),d=h<1?u*Math.sqrt(1-h*h):0,f=h<1?(h*u-l)/d:-l+u,g=e?e*t/1e3:t;return g=h<1?Math.exp(-g*h*u)*(1*Math.cos(d*g)+f*Math.sin(d*g)):(1+f*g)*Math.exp(-g*u),0===t||1===t?t:1-g},Hp=function(t){var e=m(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],2),n=e[0],r=void 0===n?10:n;return("start"===e[1]?Math.ceil:Math.floor)(ne(t,0,1)*r)/r},_p=function(t){var e=m(arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],4),n=e[0],r=e[1],i=e[2],o=e[3];return kp(n,r,i,o)(t)},Gp=kp(.42,0,1,1),Kp=function(t){return function(e){return 1-t(1-e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],arguments.length>2?arguments[2]:void 0)}},jp=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?t(2*e,n,r)/2:1-t(-2*e+2,n,r)/2}},zp=function(t){return function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-2*e,n,r))/2:(t(2*e-1,n,r)+1)/2}},Vp={steps:Hp,"step-start":function(t){return Hp(t,[1,"start"])},"step-end":function(t){return Hp(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":_p,ease:function(t){return _p(t,[.25,.1,.25,1])},in:Gp,out:Kp(Gp),"in-out":jp(Gp),"out-in":zp(Gp),"in-quad":Sp,"out-quad":Kp(Sp),"in-out-quad":jp(Sp),"out-in-quad":zp(Sp),"in-cubic":Qp,"out-cubic":Kp(Qp),"in-out-cubic":jp(Qp),"out-in-cubic":zp(Qp),"in-quart":Up,"out-quart":Kp(Up),"in-out-quart":jp(Up),"out-in-quart":zp(Up),"in-quint":Np,"out-quint":Kp(Np),"in-out-quint":jp(Np),"out-in-quint":zp(Np),"in-expo":Tp,"out-expo":Kp(Tp),"in-out-expo":jp(Tp),"out-in-expo":zp(Tp),"in-sine":Op,"out-sine":Kp(Op),"in-out-sine":jp(Op),"out-in-sine":zp(Op),"in-circ":Ip,"out-circ":Kp(Ip),"in-out-circ":jp(Ip),"out-in-circ":zp(Ip),"in-back":Lp,"out-back":Kp(Lp),"in-out-back":jp(Lp),"out-in-back":zp(Lp),"in-bounce":Pp,"out-bounce":Kp(Pp),"in-out-bounce":jp(Pp),"out-in-bounce":zp(Pp),"in-elastic":Dp,"out-elastic":Kp(Dp),"in-out-elastic":jp(Dp),"out-in-elastic":zp(Dp),spring:Rp,"spring-in":Rp,"spring-out":Kp(Rp),"spring-in-out":jp(Rp),"spring-out-in":zp(Rp)},Wp=function(t){return t};function Yp(t,e){return function(n){if(n>=1)return 1;var r=1/t;return(n+=e*r)-n%r}}var Xp="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",qp=new RegExp("cubic-bezier\\(".concat(Xp,",").concat(Xp,",").concat(Xp,",").concat(Xp,"\\)")),$p=/steps\(\s*(\d+)\s*\)/,Zp=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Jp(t){var e=qp.exec(t);if(e)return kp.apply(void 0,u(e.slice(1).map(Number)));var n=$p.exec(t);if(n)return Yp(Number(n[1]),0);var r=Zp.exec(t);return r?Yp(Number(r[1]),{start:1,middle:.5,end:0}[r[2]]):Vp[function(t){return function(t){return"-"===(t=t.replace(/([A-Z])/g,function(t){return"-".concat(t.toLowerCase())})).charAt(0)?t.substring(1):t}(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()}(t)]||Vp.linear}function tv(t){return Math.abs(function(t){var e;if(0===t.duration||0===t.iterations)return 0;return("auto"===t.duration?0:Number(t.duration))*(null!==(e=t.iterations)&&void 0!==e?e:1)}(t)/(t.playbackRate||1))}function ev(t,e,n){var r=function(t,e,n){if(null===e)return 0;var r=n.endTime;return e<Math.min(n.delay,r)?1:e>=Math.min(n.delay+t+n.endDelay,r)?2:3}(t,e,n),i=function(t,e,n,r,i){switch(r){case 1:return"backwards"===e||"both"===e?0:null;case 3:return n-i;case 2:return"forwards"===e||"both"===e?t:null;case 0:return null}}(t,n.fill,e,r,n.delay);if(null===i)return null;var o="auto"===n.duration?0:n.duration,A=function(t,e,n,r,i){var o=i;return 0===t?1!==e&&(o+=n):o+=r/t,o}(o,r,n.iterations,i,n.iterationStart),s=function(t,e,n,r,i,o){var A=t===1/0?e%1:t%1;return 0!==A||2!==n||0===r||0===i&&0!==o||(A=1),A}(A,n.iterationStart,r,n.iterations,i,o),a=function(t,e,n,r){return 2===t&&e===1/0?1/0:1===n?Math.floor(r)-1:Math.floor(r)}(r,n.iterations,s,A),c=function(t,e,n){var r=t;if("normal"!==t&&"reverse"!==t){var i=e;"alternate-reverse"===t&&(i+=1),r="normal",i!==1/0&&i%2!=0&&(r="reverse")}return"normal"===r?n:1-n}(n.direction,a,s);return n.currentIteration=a,n.progress=c,n.easingFunction(c)}function nv(t,e,n){var r=function(t,e){for(var n={},r=0;r<t.length;r++)for(var i in t[r])if(rv(i)){var o={offset:t[r].offset,computedOffset:t[r].computedOffset,easing:t[r].easing,easingFunction:Jp(t[r].easing)||e.easingFunction,value:t[r][i]};n[i]=n[i]||[],n[i].push(o)}return n}(t,e),i=function(t,e){var n=[];for(var r in t)for(var i=t[r],o=0;o<i.length-1;o++){var A=o,s=o+1,a=i[A].computedOffset,c=i[s].computedOffset,l=a,u=c;0===o&&(l=-1/0,0===c&&(s=A)),o===i.length-2&&(u=1/0,1===a&&(A=s)),n.push({applyFrom:l,applyTo:u,startOffset:i[A].computedOffset,endOffset:i[s].computedOffset,easingFunction:i[A].easingFunction,property:r,interpolation:ov(r,i[A].value,i[s].value,e)})}return n.sort(function(t,e){return t.startOffset-e.startOffset}),n}(r,n);return function(t,e){if(null!==e)i.filter(function(t){return e>=t.applyFrom&&e<t.applyTo}).forEach(function(n){var r=e-n.startOffset,i=n.endOffset-n.startOffset,o=0===i?0:r/i;t.setAttribute(n.property,n.interpolation(o),!1,!1)});else for(var n in r)rv(n)&&t.setAttribute(n,null)}}function rv(t){return"offset"!==t&&"easing"!==t&&"composite"!==t&&"computedOffset"!==t}var iv=function(t,e,n){return function(r){var i=Av(t,e,r);return re(i)?i:n(i)}};function ov(t,e,n,r){var i=MA[t];if(i&&i.syntax&&i.int){var o=Ua.styleValueRegistry.getPropertySyntax(i.syntax);if(o){var A=o.parser,s=A?A(e,r):e,a=A?A(n,r):n,c=o.mixer(s,a,r);if(c){var l=iv.apply(void 0,u(c));return function(t){return 0===t?e:1===t?n:l(t)}}}}return iv(!1,!0,function(t){return t?n:e})}function Av(t,e,n){if("number"==typeof t&&"number"==typeof e)return t*(1-n)+e*n;if("boolean"==typeof t&&"boolean"==typeof e||"string"==typeof t&&"string"==typeof e)return n<.5?t:e;if(Array.isArray(t)&&Array.isArray(e)){for(var r=t.length,i=e.length,o=Math.max(r,i),A=[],s=0;s<o;s++)A.push(Av(t[s<r?s:r-1],e[s<i?s:i-1],n));return A}throw new Error("Mismatched interpolation arguments ".concat(t,":").concat(e))}var sv=function(){return a(function t(){A(this,t),this.delay=0,this.direction="normal",this.duration="auto",this._easing="linear",this.easingFunction=Wp,this.endDelay=0,this.fill="auto",this.iterationStart=0,this.iterations=1,this.currentIteration=null,this.progress=null},[{key:"easing",get:function(){return this._easing},set:function(t){this.easingFunction=Jp(t),this._easing=t}}])}();function av(t,e){if(null===t)return[];Array.isArray(t)||(t=function(t){var e=[];for(var n in t)if(!(n in["easing","offset","composite"])){var r=t[n];Array.isArray(r)||(r=[r]);for(var i=r.length,o=0;o<i;o++){if(!e[o]){var A={};"offset"in t&&(A.offset=Number(t.offset)),"easing"in t&&(A.easing=t.easing),"composite"in t&&(A.composite=t.composite),e[o]=A}void 0!==r[o]&&null!==r[o]&&(e[o][n]=r[o])}}return e.sort(function(t,e){return(t.computedOffset||0)-(e.computedOffset||0)}),e}(t));for(var n=t.map(function(t){var n={};for(var r in null!=e&&e.composite&&(n.composite="auto"),t){var i=t[r];if("offset"===r){if(null!==i){if(i=Number(i),!isFinite(i))throw new Error("Keyframe offsets must be numbers.");if(i<0||i>1)throw new Error("Keyframe offsets must be between 0 and 1.");n.computedOffset=i}}else if("composite"===r&&-1===["replace","add","accumulate","auto"].indexOf(i))throw new Error("".concat(i," compositing is not supported"));n[r]=i}return void 0===n.offset&&(n.offset=null),void 0===n.easing&&(n.easing=(null==e?void 0:e.easing)||"linear"),void 0===n.composite&&(n.composite="auto"),n}),r=!0,i=-1/0,o=0;o<n.length;o++){var A=n[o].offset;if(Kt(A))r=!1;else{if(A<i)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");i=A}}return n=n.filter(function(t){return Number(t.offset)>=0&&Number(t.offset)<=1}),r||function(){var t,e,r=n.length;n[r-1].computedOffset=Number(null!==(t=n[r-1].offset)&&void 0!==t?t:1),r>1&&(n[0].computedOffset=Number(null!==(e=n[0].offset)&&void 0!==e?e:0));for(var i=0,o=Number(n[0].computedOffset),A=1;A<r;A++){var s=n[A].computedOffset;if(!Kt(s)&&!Kt(o)){for(var a=1;a<A-i;a++)n[i+a].computedOffset=o+(Number(s)-o)*a/(A-i);i=A,o=Number(s)}}}(),n}var cv="backwards|forwards|both|none".split("|"),lv="reverse|alternate|alternate-reverse".split("|");function uv(t,e){return function(t){var e=new sv;return"number"!=typeof t||isNaN(t)?void 0!==t&&Object.keys(t).forEach(function(n){if(void 0!==t[n]&&null!==t[n]&&"auto"!==t[n]){if(("number"==typeof e[n]||"duration"===n)&&("number"!=typeof t[n]||isNaN(t[n])))return;if("fill"===n&&-1===cv.indexOf(t[n]))return;if("direction"===n&&-1===lv.indexOf(t[n]))return;e[n]=t[n]}}):e.duration=t,e}(t=function(t){"number"==typeof t&&(t=isNaN(t)?{duration:"auto"}:{duration:t});return t}(null!=t?t:{duration:"auto"}))}var hv=function(){return a(function t(e,n,r){var i=this;A(this,t),this.composite="replace",this.iterationComposite="replace",this.target=e,this.timing=uv(r),this.timing.effect=this,this.timing.activeDuration=tv(this.timing),this.timing.endTime=Math.max(0,this.timing.delay+this.timing.activeDuration+this.timing.endDelay),this.normalizedKeyframes=av(n,this.timing),this.interpolations=nv(this.normalizedKeyframes,this.timing,this.target);var o=Ua.globalThis.Proxy;this.computedTiming=o?new o(this.timing,{get:function(t,e){return"duration"===e?"auto"===t.duration?0:t.duration:"fill"===e?"auto"===t.fill?"none":t.fill:"localTime"===e?i.animation&&i.animation.currentTime||null:"currentIteration"===e?i.animation&&"running"===i.animation.playState?t.currentIteration||0:null:"progress"===e?i.animation&&"running"===i.animation.playState?t.progress||0:null:t[e]},set:function(){return!0}}):this.timing},[{key:"applyInterpolations",value:function(){this.interpolations(this.target,Number(this.timeFraction))}},{key:"update",value:function(t){return null!==t&&(this.timeFraction=ev(this.timing.activeDuration,t,this.timing),null!==this.timeFraction)}},{key:"getKeyframes",value:function(){return this.normalizedKeyframes}},{key:"setKeyframes",value:function(t){this.normalizedKeyframes=av(t)}},{key:"getComputedTiming",value:function(){return this.computedTiming}},{key:"getTiming",value:function(){return this.timing}},{key:"updateTiming",value:function(t){var e=this;Object.keys(t||{}).forEach(function(n){e.timing[n]=t[n]})}}])}();function dv(t,e){return Number(t.id)-Number(e.id)}var fv=function(){return a(function t(e){var n=this;A(this,t),this.animations=[],this.ticking=!1,this.timelineTicking=!1,this.hasRestartedThisFrame=!1,this.animationsWithPromises=[],this.inTick=!1,this.pendingEffects=[],this.currentTime=null,this.rafId=0,this.rafCallbacks=[],this.webAnimationsNextTick=function(t){n.currentTime=t,n.discardAnimations(),0===n.animations.length?n.timelineTicking=!1:n.requestAnimationFrame(n.webAnimationsNextTick)},this.processRafCallbacks=function(t){var e=n.rafCallbacks;n.rafCallbacks=[],t<Number(n.currentTime)&&(t=Number(n.currentTime)),n.animations.sort(dv),n.animations=n.tick(t,!0,n.animations)[0],e.forEach(function(e){e[1](t)}),n.applyPendingEffects()},this.document=e},[{key:"getAnimations",value:function(){return this.discardAnimations(),this.animations.slice()}},{key:"isTicking",value:function(){return this.inTick}},{key:"play",value:function(t,e,n){var r=new hv(t,e,n),i=new wp(r,this);return this.animations.push(i),this.restartWebAnimationsNextTick(),i.updatePromises(),i.play(),i.updatePromises(),i}},{key:"applyDirtiedAnimation",value:function(t){var e=this;if(!this.inTick){t.markTarget();var n=t.targetAnimations();n.sort(dv),this.tick(Number(this.currentTime),!1,n.slice())[1].forEach(function(t){var n=e.animations.indexOf(t);-1!==n&&e.animations.splice(n,1)}),this.applyPendingEffects()}}},{key:"restart",value:function(){return this.ticking||(this.ticking=!0,this.requestAnimationFrame(function(){}),this.hasRestartedThisFrame=!0),this.hasRestartedThisFrame}},{key:"destroy",value:function(){this.document.defaultView.cancelAnimationFrame(this.frameId)}},{key:"applyPendingEffects",value:function(){this.pendingEffects.forEach(function(t){null==t||t.applyInterpolations()}),this.pendingEffects=[]}},{key:"updateAnimationsPromises",value:function(){this.animationsWithPromises=this.animationsWithPromises.filter(function(t){return t.updatePromises()})}},{key:"discardAnimations",value:function(){this.updateAnimationsPromises(),this.animations=this.animations.filter(function(t){return"finished"!==t.playState&&"idle"!==t.playState})}},{key:"restartWebAnimationsNextTick",value:function(){this.timelineTicking||(this.timelineTicking=!0,this.requestAnimationFrame(this.webAnimationsNextTick))}},{key:"rAF",value:function(t){var e=this.rafId++;return 0===this.rafCallbacks.length&&(this.frameId=this.document.defaultView.requestAnimationFrame(this.processRafCallbacks)),this.rafCallbacks.push([e,t]),e}},{key:"requestAnimationFrame",value:function(t){var e=this;return this.rAF(function(n){e.updateAnimationsPromises(),t(n),e.updateAnimationsPromises()})}},{key:"tick",value:function(t,e,n){var r,i,o=this;this.inTick=!0,this.hasRestartedThisFrame=!1,this.currentTime=t,this.ticking=!1;var A=[],s=[],a=[],c=[];return n.forEach(function(n){n.tick(t,e),n._inEffect?(s.push(n.effect),n.markTarget()):(A.push(n.effect),n.unmarkTarget()),n._needsTick&&(o.ticking=!0);var r=n._inEffect||n._needsTick;n._inTimeline=r,r?a.push(n):c.push(n)}),(r=this.pendingEffects).push.apply(r,A),(i=this.pendingEffects).push.apply(i,s),this.ticking&&this.requestAnimationFrame(function(){}),this.inTick=!1,[a,c]}}])}();Ua.EasingFunction=Jp,Ua.AnimationTimeline=fv;var gv=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).landmarks=[],t}return v(e,t),a(e,[{key:"rotate",value:function(t,e,n){if(this.relElevation=Fr(e),this.relAzimuth=Fr(t),this.relRoll=Fr(n),this.elevation+=this.relElevation,this.azimuth+=this.relAzimuth,this.roll+=this.relRoll,this.type===jr.EXPLORING){var r=Qt(St(),[1,0,0],Ur((this.rotateWorld?1:-1)*this.relElevation)),i=Qt(St(),[0,1,0],Ur((this.rotateWorld?1:-1)*this.relAzimuth)),o=Qt(St(),[0,0,1],Ur(this.relRoll)),A=Ut(St(),i,r);A=Ut(St(),A,o);var s=q(C(),A);I(this.matrix,this.matrix,[0,0,-this.distance]),O(this.matrix,this.matrix,s),I(this.matrix,this.matrix,[0,0,this.distance])}else{if(Math.abs(this.elevation)>90)return this;this.computeMatrix()}return this._getAxes(),this.type===jr.ORBITING||this.type===jr.EXPLORING?this._getPosition():this.type===jr.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(t,e){var n=Sr(t,e,0),r=ct(this.position);return ft(r,r,pt(at(),this.right,n[0])),ft(r,r,pt(at(),this.up,n[1])),this._setPosition(r),this.triggerUpdate(),this}},{key:"dolly",value:function(t){var e=this.forward,n=ct(this.position),r=this.dollyingStep,i=this.distance+t*this.dollyingStep;return r=Math.max(Math.min(i,this.maxDistance),this.minDistance)-this.distance,n[0]+=r*e[0],n[1]+=r*e[1],n[2]+=r*e[2],this._setPosition(n),this.type===jr.ORBITING||this.type===jr.EXPLORING?this._getDistance():this.type===jr.TRACKING&&ft(this.focalPoint,n,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){void 0!==this.landmarkAnimationID&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(t){var e,n,r,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},A=o.position,s=void 0===A?this.position:A,a=o.focalPoint,c=void 0===a?this.focalPoint:a,l=o.roll,u=o.zoom,h=new Ua.CameraContribution;h.setType(this.type,void 0),h.setPosition(s[0],null!==(e=s[1])&&void 0!==e?e:this.position[1],null!==(n=s[2])&&void 0!==n?n:this.position[2]),h.setFocalPoint(c[0],null!==(r=c[1])&&void 0!==r?r:this.focalPoint[1],null!==(i=c[2])&&void 0!==i?i:this.focalPoint[2]),h.setRoll(null!=l?l:this.roll),h.setZoom(null!=u?u:this.zoom);var d={name:t,matrix:M(h.getWorldTransform()),right:ct(h.right),up:ct(h.up),forward:ct(h.forward),position:ct(h.getPosition()),focalPoint:ct(h.getFocalPoint()),distanceVector:ct(h.getDistanceVector()),distance:h.getDistance(),dollyingStep:h.getDollyingStep(),azimuth:h.getAzimuth(),elevation:h.getElevation(),roll:h.getRoll(),relAzimuth:h.relAzimuth,relElevation:h.relElevation,relRoll:h.relRoll,zoom:h.getZoom()};return this.landmarks.push(d),d}},{key:"gotoLandmark",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Jt(t)?this.landmarks.find(function(e){return e.name===t}):t;if(r){var i=re(n)?{duration:n}:n,o=i.easing,A=void 0===o?"linear":o,s=i.duration,a=void 0===s?100:s,c=i.easingFunction,l=void 0===c?void 0:c,u=i.onfinish,h=void 0===u?void 0:u,d=i.onframe,f=void 0===d?void 0:d;this.cancelLandmarkAnimation();var g,p=r.position,v=r.focalPoint,m=r.zoom,y=r.roll,w=l||Ua.EasingFunction(A),b=function(){e.setFocalPoint(v),e.setPosition(p),e.setRoll(y),e.setZoom(m),e.computeMatrix(),e.triggerUpdate(),null==h||h()};if(0===a)return b();var B=function(t){void 0===g&&(g=t);var n=t-g;if(n>=a)b();else{var r,i,o=w(n/a),A=at(),s=at();if(wt(A,e.focalPoint,v,o),wt(s,e.position,p,o),i=e.roll*(1-o)+y*o,r=e.zoom*(1-o)+m*o,e.setFocalPoint(A),e.setPosition(s),e.setRoll(i),e.setZoom(r),xt(A,v)+xt(s,p)<=.01&&void 0===m&&void 0===y)return b();e.computeMatrix(),e.triggerUpdate(),n<a&&(null==f||f(o),e.landmarkAnimationID=e.canvas.requestAnimationFrame(B))}};this.canvas.requestAnimationFrame(B)}}}])}(Xr);Ua.CameraContribution=gv;var pv=["body","startHead","endHead","startHeadOffset","endHeadOffset"],vv=["body","startHead","endHead","startHeadOffset","endHeadOffset"],mv=["body","startHead","endHead","startHeadOffset","endHeadOffset"],yv=function(t){function e(t){var n;A(this,e);var r=(n=g(this,e,[o(o({},t),{},{type:e.tag})])).attributes,i=r.body,s=r.startHead,a=r.endHead;r.startHeadOffset,r.endHeadOffset;var c=ar(r,pv);if(!i)throw new Error("Arrow's body is required");return n.body=i,n.appendChild(n.body),n.handleBodyAttributeChanged(n.body),s&&n.appendArrowHead(n.getArrowHeadType(s),!0),a&&n.appendArrowHead(n.getArrowHeadType(a),!1),n.applyArrowStyle(c,[n.body,n.startHead,n.endHead]),n}return v(e,t),a(e,[{key:"handleBodyAttributeChanged",value:function(t){var e=this;t.addEventListener(ea.ATTR_MODIFIED,function(t){var n=t.attrName;"x1"===n||"y1"===n?e.startHead&&e.transformArrowHead(e.startHead,!0):"x2"!==n&&"y2"!==n||e.endHead&&e.transformArrowHead(e.endHead,!1)})}},{key:"getBody",value:function(){return this.body}},{key:"getStartHead",value:function(){return this.startHead}},{key:"getEndHead",value:function(){return this.endHead}},{key:"attributeChangedCallback",value:function(t,e,n){if("opacity"===t||"strokeOpacity"===t||"stroke"===t||"lineWidth"===t||"increasedLineWidthForHitTesting"===t)this.applyArrowStyle(r({},t,n),[this.body,this.startHead,this.endHead]);else if("startHead"===t||"endHead"===t){var i="startHead"===t;if(this.destroyArrowHead(i),n){var o=this.attributes;o.body,o.startHead,o.endHead,o.startHeadOffset,o.endHeadOffset;var A=ar(o,vv);this.appendArrowHead(this.getArrowHeadType(n),i),this.applyArrowStyle(A,[i?this.startHead:this.endHead])}}else if("body"===t){var s=this.attributes;s.body,s.startHead,s.endHead,s.startHeadOffset,s.endHeadOffset;var a=ar(s,mv);this.body.destroy(),this.body=n,this.appendChild(this.body),this.applyArrowStyle(a,[this.body])}else"startHeadOffset"===t?this.moveArrowHeadAlongTangent(n,!0):"endHeadOffset"===t&&this.moveArrowHeadAlongTangent(n,!1)}},{key:"getArrowHeadType",value:function(t){return"boolean"==typeof t?"default":"custom"}},{key:"appendArrowHead",value:function(t,e){var n;n="default"===t?this.createDefaultArrowHead():e?this.attributes.startHead:this.attributes.endHead,this.transformArrowHead(n,e),n.setAttribute("zIndex",1),e?this.startHead=n:this.endHead=n,this.appendChild(n);var r=e?this.attributes.startHeadOffset:this.attributes.endHeadOffset;r&&this.moveArrowHeadAlongTangent(r,e)}},{key:"transformArrowHead",value:function(t,e){var n,r=at(),i=0,o=0,A=0,s=0,a=this.body&&this.body.nodeName;if(a===cr.LINE){var c=this.body.attributes,l=c.x1,u=c.x2,h=c.y1,d=c.y2;i=e?u:l,o=e?l:u,A=e?d:h,s=e?h:d}else if(a===cr.POLYLINE){var f=this.body.attributes.points,g=f.length;i=e?f[1][0]:f[g-2][0],A=e?f[1][1]:f[g-2][1],o=e?f[0][0]:f[g-1][0],s=e?f[0][1]:f[g-1][1]}else if(a===cr.PATH){var p=m(this.getTangent(this.body,e),2),v=p[0],y=p[1];i=v[0],A=v[1],o=y[0],s=y[1]}var w=i-o,b=A-s;n=Math.atan2(b,w),r=ut(o,s,0),e?(this.startHeadPosition=r,this.startHeadRad=n):(this.endHeadPosition=r,this.endHeadRad=n),t.setLocalPosition(r),t.setLocalEulerAngles(180*n/Math.PI+t.getLocalEulerAngles())}},{key:"moveArrowHeadAlongTangent",value:function(t,e){var n=e?this.startHead:this.endHead;n&&n.setLocalPosition(Et(at(),e?this.startHeadPosition:this.endHeadPosition,ut(Math.cos(e?this.startHeadRad:this.endHeadRad)*t,Math.sin(e?this.startHeadRad:this.endHeadRad)*t,0))),this.body}},{key:"destroyArrowHead",value:function(t){t&&this.startHead&&(this.startHead.destroy(),this.startHead=void 0),!t&&this.endHead&&(this.endHead.destroy(),this.endHead=void 0)}},{key:"getTangent",value:function(t,e){return e?t.getStartTangent():t.getEndTangent()}},{key:"createDefaultArrowHead",value:function(){var t=this.attributes,e=t.stroke,n=t.lineWidth,r=Math.sin,i=Math.cos,o=Math.PI,A=10*i(o/6);return new nc({style:{d:"M".concat(A/2,",").concat(10*r(o/6)," L-").concat(A/2,",0 L").concat(A/2,",-").concat(10*r(o/6)),stroke:e,lineWidth:n,transformOrigin:"center"}})}},{key:"applyArrowStyle",value:function(t,e){var n=t.opacity,r=t.stroke,i=t.strokeOpacity,o=t.lineWidth,A=t.increasedLineWidthForHitTesting;e.forEach(function(t){t&&(Kt(n)||(t.style.opacity=n),Kt(r)||(t.style.stroke=r),Kt(i)||(t.style.strokeOpacity=i),Kt(o)||(t.style.lineWidth=o),Kt(A)||(t.style.increasedLineWidthForHitTesting=A))})}}])}(Wa);yv.tag="arrow",yv.PARSED_STYLE_LIST=new Set([].concat(u(Wa.PARSED_STYLE_LIST),["body","startHead","endHead","startHeadOffset","endHeadOffset","stroke","lineWidth","opacity","strokeOpacity"]));var wv=Math.PI,bv=2*wv,Bv=Math.sin,Ev=Math.cos,xv=Math.acos,Cv=Math.atan2,Mv=Math.sqrt,Fv=Math.max,kv=Math.min,Sv=1e-4;[{name:"sr",inherits:!1,interpolable:!0,syntax:ri.LENGTH_PERCENTAGE},{name:"sr0",inherits:!1,interpolable:!0,syntax:ri.LENGTH_PERCENTAGE},{name:"startAngle",inherits:!1,interpolable:!0,syntax:ri.ANGLE},{name:"endAngle",inherits:!1,interpolable:!0,syntax:ri.ANGLE}].forEach(function(t){uc(t)});var Qv=function(t,e,n,r){return{x:t+n*Math.cos(r),y:e+n*Math.sin(r)}};function Uv(t,e,n,r,i,o,A){var s=t-n,a=e-r,c=o/Mv(s*s+a*a),l=c*a,u=-c*s,h=t+l,d=e+u,f=n+l,g=r+u,p=(h+f)/2,v=(d+g)/2,m=f-h,y=g-d,w=m*m+y*y,b=i-o,B=h*g-f*d,E=(y<0?-1:1)*Mv(Fv(0,b*b*w-B*B)),x=(B*y-m*E)/w,C=(-B*m-y*E)/w,M=(B*y+m*E)/w,F=(-B*m+y*E)/w,k=x-p,S=C-v,Q=M-p,U=F-v;return k*k+S*S>Q*Q+U*U&&(x=M,C=F),{cx:x,cy:C,x0:-l,y0:-u,x1:x*(i/b-1),y1:C*(i/b-1)}}function Nv(t,e){return(e=e<0&&t>=0?e+bv:e)-t<=wv?0:1}var Tv=function(t){function e(t){var n;return A(this,e),(n=g(this,e,[t])).updatePath(),n}return v(e,t),a(e,[{key:"setAttribute",value:function(t,n,r){Un(e,"setAttribute",this)([t,n,r]),["startAngle","endAngle","sr","sr0","radius"].indexOf(t)>-1&&this.updatePath()}},{key:"updatePath",value:function(){var t=this.parsedStyle,n=t.x,r=t.y,i=t.startAngle,o=t.endAngle,A=t.sr,s=t.sr0,a=t.radius,c=this.createPath(n,r,i?Ur(i):0,o?Ur(o):2*Math.PI,A||0,s||0,a||[0,0,0,0]);Un(e,"setAttribute",this)(["d",c])}},{key:"createPath",value:function(t,e,n,r,i,o,A){if(!(i<=0)){var s=Qv(t,e,i,n),a=Qv(t,e,i,r),c=Qv(t,e,o,n),l=Qv(t,e,o,r);if(ie(r-n,2*Math.PI)){var u=Qv(t,e,i,n+Math.PI),h=Qv(t,e,o,n+Math.PI),d=[["M",s.x,s.y],["A",i,i,0,1,1,u.x,u.y],["A",i,i,0,1,1,a.x,a.y],["M",c.x,c.y]];return o&&(d.push(["A",o,o,0,1,0,h.x,h.y]),d.push(["A",o,o,0,1,0,l.x,l.y])),d.push(["M",s.x,s.y]),d.push(["Z"]),d}var f=r-n,g=i*Ev(n),p=i*Bv(n),v=o*Ev(r),y=o*Bv(r),w=i*Ev(r),b=i*Bv(r),B=o*Ev(n),E=o*Bv(n),x=m(A,4),C=x[0],M=x[1],F=x[2],k=x[3],S=(i-o)/2,Q=kv(S,C),U=kv(S,M),N=kv(S,F),T=kv(S,k),O=Fv(Q,U),I=Fv(N,T),L=O,P=I;if((O>Sv||I>Sv)&&f<wv){var D=function(t,e,n,r,i,o,A,s){var a=n-t,c=r-e,l=A-i,u=s-o,h=u*a-l*c;if(!(h*h<Sv))return[t+(h=(l*(e-o)-u*(t-i))/h)*a,e+h*c]}(g,p,B,E,w,b,v,y);if(D){var R=g-D[0],H=p-D[1],_=w-D[0],G=b-D[1],K=1/Bv(xv((R*_+H*G)/(Mv(R*R+H*H)*Mv(_*_+G*G)))/2),j=Mv(D[0]*D[0]+D[1]*D[1]);L=kv(O,(i-j)/(K+1)),P=kv(I,(o-j)/(K-1))}}var z=Nv(n,r),V=[];if(L>Sv){var W=kv(C,L),Y=kv(M,L),X=Uv(B,E,g,p,i,W),q=Uv(w,b,v,y,i,Y);if(V.push(["M",t+X.cx+X.x0,e+X.cy+X.y0]),L<O&&W===Y){var $=Cv(X.y0,X.x0),Z=Cv(q.y0,q.x0);V.push(["A",L,L,0,Nv($,Z),1,t+q.cx+q.x0,e+q.cy+q.y0])}else{if(W>0){var J=Cv(X.y0,X.x0),tt=Cv(X.y1,X.x1),et=Qv(t,e,i,tt);V.push(["A",W,W,0,Nv(J,tt),1,et.x,et.y])}var nt=Cv(X.cy+X.y1,X.cx+X.x1),rt=Cv(q.cy+q.y1,q.cx+q.x1),it=Qv(t,e,i,rt);if(V.push(["A",i,i,0,Nv(nt,rt),1,it.x,it.y]),Y>0){var ot=Cv(q.y1,q.x1),At=Cv(q.y0,q.x0);V.push(["A",Y,Y,0,Nv(ot,At),1,t+q.cx+q.x0,e+q.cy+q.y0])}}}else V.push(["M",s.x,s.y]),V.push(["A",i,i,0,z,1,a.x,a.y]);if(o<Sv)V.push(["L",l.x,l.y]);else if(P>Sv){var st=kv(k,P),at=kv(F,P),ct=Uv(v,y,0,0,o-i,at),lt=Uv(0,0,B,E,o-i,st);if(V.push(["L",t+ct.cx+ct.x0,e+ct.cy+ct.y0]),P<I&&st===at){var ut=Cv(ct.y0,ct.x0),ht=Cv(lt.y0,lt.x0),dt=Qv(t,e,o,ht);V.push(["A",L,L,0,Nv(ut,ht),1,dt.x,dt.y])}else{if(at>0){var ft=Cv(ct.y0,ct.x0),gt=Cv(ct.y1,ct.x1),pt=Qv(t,e,o-i,gt);V.push(["A",at,at,0,Nv(ft,gt),1,pt.x,pt.y])}var vt=Cv(ct.cy+ct.y1,ct.cx+ct.x1),mt=Cv(lt.cy+lt.y1,lt.cx+lt.x1),yt=Qv(t,e,o,mt);if(V.push(["A",o,o,0,Nv(mt,vt),0,yt.x,yt.y]),V.push(["L",yt.x,yt.y]),st>0){var wt=Cv(lt.y1,lt.x1),bt=Cv(lt.y0,lt.x0);V.push(["A",st,st,0,Nv(wt,bt),1,t+lt.cx+lt.x0,e+lt.cy+lt.y0])}}}else V.push(["L",l.x,l.y]),V.push(["A",o,o,0,z,0,c.x,c.y]);return V.push(["Z"]),V}}}])}(nc);Tv.PARSED_STYLE_LIST=new Set([].concat(u(nc.PARSED_STYLE_LIST),["x","y","sr","sr0","radius","startAngle","endAngle"]));const Ov={duration:500},Iv={duration:1e3,easing:"cubic-bezier(0.250, 0.460, 0.450, 0.940)",iterations:1,fill:"both"};var Lv,Pv,Dv,Rv,Hv,_v,Gv,Kv,jv;!function(t){t.NodeAdded="NodeAdded",t.NodeUpdated="NodeUpdated",t.NodeRemoved="NodeRemoved",t.EdgeAdded="EdgeAdded",t.EdgeUpdated="EdgeUpdated",t.EdgeRemoved="EdgeRemoved",t.ComboAdded="ComboAdded",t.ComboUpdated="ComboUpdated",t.ComboRemoved="ComboRemoved"}(Lv||(Lv={})),function(t){t.DRAW="draw",t.COLLAPSE="collapse",t.EXPAND="expand",t.TRANSFORM="transform"}(Pv||(Pv={})),t.CanvasEvent=void 0,function(t){t.CLICK="canvas:click",t.DBLCLICK="canvas:dblclick",t.POINTER_OVER="canvas:pointerover",t.POINTER_LEAVE="canvas:pointerleave",t.POINTER_ENTER="canvas:pointerenter",t.POINTER_MOVE="canvas:pointermove",t.POINTER_OUT="canvas:pointerout",t.POINTER_DOWN="canvas:pointerdown",t.POINTER_UP="canvas:pointerup",t.CONTEXT_MENU="canvas:contextmenu",t.DRAG_START="canvas:dragstart",t.DRAG="canvas:drag",t.DRAG_END="canvas:dragend",t.DRAG_ENTER="canvas:dragenter",t.DRAG_OVER="canvas:dragover",t.DRAG_LEAVE="canvas:dragleave",t.DROP="canvas:drop",t.WHEEL="canvas:wheel"}(t.CanvasEvent||(t.CanvasEvent={})),t.ComboEvent=void 0,(Dv=t.ComboEvent||(t.ComboEvent={})).CLICK="combo:click",Dv.DBLCLICK="combo:dblclick",Dv.POINTER_OVER="combo:pointerover",Dv.POINTER_LEAVE="combo:pointerleave",Dv.POINTER_ENTER="combo:pointerenter",Dv.POINTER_MOVE="combo:pointermove",Dv.POINTER_OUT="combo:pointerout",Dv.POINTER_DOWN="combo:pointerdown",Dv.POINTER_UP="combo:pointerup",Dv.CONTEXT_MENU="combo:contextmenu",Dv.DRAG_START="combo:dragstart",Dv.DRAG="combo:drag",Dv.DRAG_END="combo:dragend",Dv.DRAG_ENTER="combo:dragenter",Dv.DRAG_OVER="combo:dragover",Dv.DRAG_LEAVE="combo:dragleave",Dv.DROP="combo:drop",t.CommonEvent=void 0,(Rv=t.CommonEvent||(t.CommonEvent={})).CLICK="click",Rv.DBLCLICK="dblclick",Rv.POINTER_OVER="pointerover",Rv.POINTER_LEAVE="pointerleave",Rv.POINTER_ENTER="pointerenter",Rv.POINTER_MOVE="pointermove",Rv.POINTER_OUT="pointerout",Rv.POINTER_DOWN="pointerdown",Rv.POINTER_UP="pointerup",Rv.CONTEXT_MENU="contextmenu",Rv.DRAG_START="dragstart",Rv.DRAG="drag",Rv.DRAG_END="dragend",Rv.DRAG_ENTER="dragenter",Rv.DRAG_OVER="dragover",Rv.DRAG_LEAVE="dragleave",Rv.DROP="drop",Rv.KEY_DOWN="keydown",Rv.KEY_UP="keyup",Rv.WHEEL="wheel",Rv.PINCH="pinch",t.ContainerEvent=void 0,(Hv=t.ContainerEvent||(t.ContainerEvent={})).KEY_DOWN="keydown",Hv.KEY_UP="keyup",t.EdgeEvent=void 0,(_v=t.EdgeEvent||(t.EdgeEvent={})).CLICK="edge:click",_v.DBLCLICK="edge:dblclick",_v.POINTER_OVER="edge:pointerover",_v.POINTER_LEAVE="edge:pointerleave",_v.POINTER_ENTER="edge:pointerenter",_v.POINTER_MOVE="edge:pointermove",_v.POINTER_OUT="edge:pointerout",_v.POINTER_DOWN="edge:pointerdown",_v.POINTER_UP="edge:pointerup",_v.CONTEXT_MENU="edge:contextmenu",_v.DRAG_ENTER="edge:dragenter",_v.DRAG_OVER="edge:dragover",_v.DRAG_LEAVE="edge:dragleave",_v.DROP="edge:drop",t.GraphEvent=void 0,(Gv=t.GraphEvent||(t.GraphEvent={})).BEFORE_CANVAS_INIT="beforecanvasinit",Gv.AFTER_CANVAS_INIT="aftercanvasinit",Gv.BEFORE_SIZE_CHANGE="beforesizechange",Gv.AFTER_SIZE_CHANGE="aftersizechange",Gv.BEFORE_ELEMENT_CREATE="beforeelementcreate",Gv.AFTER_ELEMENT_CREATE="afterelementcreate",Gv.BEFORE_ELEMENT_UPDATE="beforeelementupdate",Gv.AFTER_ELEMENT_UPDATE="afterelementupdate",Gv.BEFORE_ELEMENT_DESTROY="beforeelementdestroy",Gv.AFTER_ELEMENT_DESTROY="afterelementdestroy",Gv.BEFORE_ELEMENT_TRANSLATE="beforeelementtranslate",Gv.AFTER_ELEMENT_TRANSLATE="afterelementtranslate",Gv.BEFORE_DRAW="beforedraw",Gv.AFTER_DRAW="afterdraw",Gv.BEFORE_RENDER="beforerender",Gv.AFTER_RENDER="afterrender",Gv.BEFORE_ANIMATE="beforeanimate",Gv.AFTER_ANIMATE="afteranimate",Gv.BEFORE_LAYOUT="beforelayout",Gv.AFTER_LAYOUT="afterlayout",Gv.BEFORE_STAGE_LAYOUT="beforestagelayout",Gv.AFTER_STAGE_LAYOUT="afterstagelayout",Gv.BEFORE_TRANSFORM="beforetransform",Gv.AFTER_TRANSFORM="aftertransform",Gv.BATCH_START="batchstart",Gv.BATCH_END="batchend",Gv.BEFORE_DESTROY="beforedestroy",Gv.AFTER_DESTROY="afterdestroy",Gv.BEFORE_RENDERER_CHANGE="beforerendererchange",Gv.AFTER_RENDERER_CHANGE="afterrendererchange",t.HistoryEvent=void 0,(Kv=t.HistoryEvent||(t.HistoryEvent={})).UNDO="undo",Kv.REDO="redo",Kv.CANCEL="cancel",Kv.ADD="add",Kv.CLEAR="clear",Kv.CHANGE="change",t.NodeEvent=void 0,(jv=t.NodeEvent||(t.NodeEvent={})).CLICK="node:click",jv.DBLCLICK="node:dblclick",jv.POINTER_OVER="node:pointerover",jv.POINTER_LEAVE="node:pointerleave",jv.POINTER_ENTER="node:pointerenter",jv.POINTER_MOVE="node:pointermove",jv.POINTER_OUT="node:pointerout",jv.POINTER_DOWN="node:pointerdown",jv.POINTER_UP="node:pointerup",jv.CONTEXT_MENU="node:contextmenu",jv.DRAG_START="node:dragstart",jv.DRAG="node:drag",jv.DRAG_END="node:dragend",jv.DRAG_ENTER="node:dragenter",jv.DRAG_OVER="node:dragover",jv.DRAG_LEAVE="node:dragleave",jv.DROP="node:drop";const zv="combo",Vv="tree";var Wv;t.ExtensionCategory=void 0,(Wv=t.ExtensionCategory||(t.ExtensionCategory={})).NODE="node",Wv.EDGE="edge",Wv.COMBO="combo",Wv.THEME="theme",Wv.PALETTE="palette",Wv.LAYOUT="layout",Wv.BEHAVIOR="behavior",Wv.PLUGIN="plugin",Wv.ANIMATION="animation",Wv.TRANSFORM="transform",Wv.SHAPE="shape";const Yv={animation:{},behavior:{},combo:{},edge:{},layout:{},node:{},palette:{},theme:{},plugin:{},transform:{},shape:{}};function Xv(t,e){var n;const r=null===(n=Yv[t])||void 0===n?void 0:n[e];if(r)return r}const qv="5.1.1";function $v(t){return`[G6 v${qv}] ${t}`}const Zv=t=>{console.warn($v(t))};function Jv(e){const{theme:n}=e;if(!n)return{};const r=Xv(t.ExtensionCategory.THEME,n);return r||(Zv(`The theme of ${n} is not registered.`),{})}function tm(t,e){if(Array.isArray(t)&&0===t.length)return null;const n=Array.isArray(t)?t[0]:t,r=Array.isArray(t)?t.slice(1):e||[];return new Proxy(n,{get:(t,e)=>"function"!=typeof t[e]||["onframe","onfinish"].includes(e)?"finished"===e?Promise.all([n.finished,...r.map(t=>t.finished)]):Reflect.get(t,e):(...n)=>{t[e](...n),r.forEach(t=>{var r;return null===(r=t[e])||void 0===r?void 0:r.call(t,...n)})},set:(t,e,n)=>(["onframe","onfinish"].includes(e)||r.forEach(t=>{t[e]=n}),Reflect.set(t,e,n))})}function em(t){const e=t.reduce((t,e)=>(Object.entries(e).forEach(([e,n])=>{void 0===t[e]?t[e]=[n]:t[e].push(n)}),t),{});Object.entries(e).forEach(([n,r])=>{(r.length!==t.length||r.some(t=>Kt(t))||r.every(t=>!["sourceNode","targetNode","childrenNode"].includes(n)&&xe(t,r[0])))&&delete e[n]});const n=Object.entries(e).reduce((t,[e,n])=>(n.forEach((n,r)=>{t[r]?t[r][e]=n:t[r]={[e]:n}}),t),[]);return 0!==t.length&&0===n.length&&n.push({_:0},{_:0}),n}function nm(t){switch(t){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function rm(t,e){const{animation:n}=t;if(!1===n||!1===e)return!1;const r=Object.assign({},Ov);return zt(n)&&Object.assign(r,n),zt(e)&&Object.assign(r,e),r}function im(e,n,r,i){var o,A;const{animation:s}=e;if(!1===s||!1===i)return[];const a=null===(o=null==e?void 0:e[n])||void 0===o?void 0:o.animation;if(!1===a)return[];const c=null==a?void 0:a[r];if(!1===c)return[];const l=null===(A=Jv(e)[n])||void 0===A?void 0:A.animation,u=(e=[])=>function(e){if("string"==typeof e){return Xv(t.ExtensionCategory.ANIMATION,e)||(Zv(`The animation of ${e} is not registered.`),[])}return e}(e).map(t=>Object.assign(Object.assign(Object.assign(Object.assign({},Iv),zt(s)&&s),t),zt(i)&&i));if(c)return u(c);if(!l)return[];const h=l[r];return!1===h?[]:u(h)}function om(t,e,n,r=[]){if(!r&&0===t&&0===e&&0===n)return null;if(Array.isArray(r)){let i=-1;const o=[];for(let A=0;A<r.length;A++){const s=r[A];if("translate"===s[0]){if(s[1]===t&&s[2]===e)return null;i=A,o.push(["translate",t,e])}else if("translate3d"===s[0]){if(s[1]===t&&s[2]===e&&s[3]===n)return null;i=A,o.push(["translate3d",t,e,null!=n?n:0])}else o.push(s)}return-1===i&&o.splice(0,0,re(n)?["translate3d",t,e,null!=n?n:0]:["translate",t,e]),0===o.length?null:o}const i=r?r.replace(/translate(3d)?\([^)]*\)/g,""):"";return 0===n?`translate(${t}, ${e})${i}`:`translate3d(${t}, ${e}, ${n})${i}`}const Am=(t,e,n)=>{if(!n.length)return null;const[r,i]=e;let o;const A=n.map(e=>{var{fields:n,shape:A,states:s}=e,a=Pe(e,["fields","shape","states"]);const c=(e=>{var n;if(e){const o=t.getShape(e);if(!o)return null;const A=`get${ce(e)}Style`,s=(null===(n=null==t?void 0:t[A])||void 0===n?void 0:n.bind(t))||(t=>t);return{shape:o,fromStyle:(null==s?void 0:s(r))||{},toStyle:(null==s?void 0:s(i))||{}}}return{shape:t,fromStyle:r,toStyle:i}})(A);if(!c)return null;const{shape:l,fromStyle:u,toStyle:h}=c,d=[{},{}];if(n.forEach(t=>{var e,n;Object.assign(d[0],{[t]:null!==(e=u[t])&&void 0!==e?e:nm(t)}),Object.assign(d[1],{[t]:null!==(n=h[t])&&void 0!==n?n:nm(t)})}),d.some(t=>Object.keys(t).some(t=>["x","y","z"].includes(t)))){const{x:t=0,y:e=0,z:n,transform:r=""}=l.attributes||{};d.forEach(i=>{var o,A,s;i.transform=om(null!==(o=i.x)&&void 0!==o?o:t,null!==(A=i.y)&&void 0!==A?A:e,null!==(s=i.z)&&void 0!==s?s:n,r)})}const f=l.animate(em(d),a);return void 0===A&&(o=f),f}).filter(Boolean),s=o||(null==A?void 0:A[0]);return s?tm(s,A.filter(t=>t!=t)):null},sm=[{fields:["x","y"]}],am=sm,cm=[{fields:["sourceNode","targetNode"]}],lm=cm,um=[{fields:["childrenNode","x","y"]}],hm=um;function dm(t){return 3===t.length}function fm(t){return t instanceof Float32Array||!(!Array.isArray(t)||2!==t.length&&3!==t.length)&&t.every(t=>"number"==typeof t)}function gm(t,e,n){return t>=e&&t<=n}function pm(t=0){if(Array.isArray(t)){const[e=0,n=e,r=e,i=n]=t;return[e,n,r,i]}return[t,t,t,t]}function vm(t=0){const e=pm(t);return e[0]+e[2]}function mm(t){return t.max[0]-t.min[0]}function ym(t){return t.max[1]-t.min[1]}function wm(t){return[mm(t),ym(t)]}function bm(t,e){const n=fm(t)?Bm(t):t.getShape("key").getBounds();return e?Em(n,e):n}function Bm(t){const[e,n,r=0]=t,i=new yr;return i.setMinMax([e,n,r],[e,n,r]),i}function Em(t,e){const[n,r,i,o]=pm(e),[A,s,a]=t.min,[c,l,u]=t.max,h=new yr;return h.setMinMax([A-o,s-n,a],[c+r,l+i,u]),h}function xm(t){if(0===t.length)return new yr;if(1===t.length)return t[0];const e=new yr;e.setMinMax(t[0].min,t[0].max);for(let n=1;n<t.length;n++){const r=t[n];e.setMinMax([Math.min(e.min[0],r.min[0]),Math.min(e.min[1],r.min[1]),Math.min(e.min[2],r.min[2])],[Math.max(e.max[0],r.max[0]),Math.max(e.max[1],r.max[1]),Math.max(e.max[2],r.max[2])])}return e}function Cm(t,e){return gm(t[0],e.min[0],e.max[0])&&gm(t[1],e.min[1],e.max[1])}function Mm(t,e,n=!1){const{min:[r,i],max:[o,A]}=e,s=(t[1]===i||t[1]===A)&&(n||gm(t[0],r,o)),a=(t[0]===r||t[0]===o)&&(n||gm(t[1],i,A));return s||a}function Fm(t,e){const{center:n}=e;return t[0]===n[0]&&t[1]===n[1]}function km(t,e){const[n,r]=t,[i,o]=e.min,[A,s]=e.max,a=n-i,c=A-n,l=r-o,u=s-r,h=Math.min(a,c,l,u);return h===a?"left":h===c?"right":h===l?"top":h===u?"bottom":"left"}function Sm(t,e){const n=ge(t);if(Cm(t,e)){switch(km(t,e)){case"left":n[0]=e.min[0];break;case"right":n[0]=e.max[0];break;case"top":n[1]=e.min[1];break;case"bottom":n[1]=e.max[1]}}else{const[r,i]=t,[o,A]=e.min,[s,a]=e.max;n[0]=gm(r,o,s)?r:r<o?o:s,n[1]=gm(i,A,a)?i:i<A?A:a}return n}var Qm=function(t,e){return t===e},Um=function(){function t(t,e){void 0===e&&(e=null),this.value=t,this.next=e}return t.prototype.toString=function(t){return t?t(this.value):"".concat(this.value)},t}(),Nm=function(){function t(t){void 0===t&&(t=Qm),this.head=null,this.tail=null,this.compare=t}return t.prototype.prepend=function(t){var e=new Um(t,this.head);return this.head=e,this.tail||(this.tail=e),this},t.prototype.append=function(t){var e=new Um(t);return this.head?(this.tail.next=e,this.tail=e,this):(this.head=e,this.tail=e,this)},t.prototype.delete=function(t){if(!this.head)return null;for(var e=null;this.head&&this.compare(this.head.value,t);)e=this.head,this.head=this.head.next;var n=this.head;if(null!==n)for(;n.next;)this.compare(n.next.value,t)?(e=n.next,n.next=n.next.next):n=n.next;return this.compare(this.tail.value,t)&&(this.tail=n),e},t.prototype.find=function(t){var e=t.value,n=void 0===e?void 0:e,r=t.callback,i=void 0===r?void 0:r;if(!this.head)return null;for(var o=this.head;o;){if(i&&i(o.value))return o;if(void 0!==n&&this.compare(o.value,n))return o;o=o.next}return null},t.prototype.deleteTail=function(){var t=this.tail;if(this.head===this.tail)return this.head=null,this.tail=null,t;for(var e=this.head;e.next;)e.next.next?e=e.next:e.next=null;return this.tail=e,t},t.prototype.deleteHead=function(){if(!this.head)return null;var t=this.head;return this.head.next?this.head=this.head.next:(this.head=null,this.tail=null),t},t.prototype.fromArray=function(t){var e=this;return t.forEach(function(t){return e.append(t)}),this},t.prototype.toArray=function(){for(var t=[],e=this.head;e;)t.push(e),e=e.next;return t},t.prototype.reverse=function(){for(var t=this.head,e=null,n=null;t;)n=t.next,t.next=e,e=t,t=n;this.tail=this.head,this.head=e},t.prototype.toString=function(t){return void 0===t&&(t=void 0),this.toArray().map(function(e){return e.toString(t)}).toString()},t}(),Tm=function(t,e,n){void 0===e&&(e=[]);var r=e.filter(function(e){return e.source===t||e.target===t});if("target"===n){return r.filter(function(e){return e.source===t}).map(function(t){return t.target})}if("source"===n){return r.filter(function(e){return e.target===t}).map(function(t){return t.source})}return r.map(function(e){return e.source===t?e.target:e.source})},Om={}.toString,Im=function(t,e){return Om.call(t)==="[object "+e+"]"},Lm=function(t){return Im(t,"Function")},Pm=function(t){return Array.isArray?Array.isArray(t):Im(t,"Array")};var Dm,Rm=Object.values?function(t){return Object.values(t)}:function(t){var e=[];return function(t,e){var n,r;if(t)if(Pm(t))for(var i=0,o=t.length;i<o&&!1!==e(t[i],i);i++);else if(r=typeof(n=t),null!==n&&"object"===r||"function"===r)for(var A in t)if(t.hasOwnProperty(A)&&!1===e(t[A],A))break}(t,function(n,r){Lm(t)&&"prototype"===r||e.push(n)}),e};!function(t,e){if(!Lm(t))throw new TypeError("Expected a function");var n=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var o=e?e.apply(this,r):r[0],A=n.cache;if(A.has(o))return A.get(o);var s=t.apply(this,r);return A.set(o,s),s};n.cache=new Map}(function(t,e){void 0===e&&(e={});var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,A=e.fontVariant;return Dm||(Dm=document.createElement("canvas").getContext("2d")),Dm.font=[o,A,i,n+"px",r].join(" "),Dm.measureText(function(t){return Im(t,"String")}(t)?t:"").width},function(t,e){return void 0===e&&(e={}),function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],A=0,s=o.length;A<s;A++,i++)r[i]=o[A];return r}([t],Rm(e)).join("")});function Hm(t,e,n,r){if(t===e)return[t];if(r[e])return r[e];for(var i=[],o=0,A=n[e];o<A.length;o++){var s=Hm(t,A[o],n,r);if(!s)return;for(var a=0,c=s;a<c.length;a++){var l=c[a];Pm(l)?i.push(_e(_e([],l,!0),[e],!1)):i.push([l,e])}}return r[e]=i,r[e]}var _m,Gm=function(t,e,n,r,i){var o=function(t,e,n,r){var i=t.nodes,o=void 0===i?[]:i,A=t.edges,s=void 0===A?[]:A,a={},c={},l={};o.forEach(function(t,n){var r=t.id;c[r]=1/0,r===e&&(c[r]=0)});for(var u=o.length,h=function(t){var e=function(t,e,n){for(var r,i=1/0,o=0;o<e.length;o++){var A=e[o].id;!n[A]&&t[A]<=i&&(i=t[A],r=e[o])}return r}(c,o,a),i=e.id;if(a[i]=!0,c[i]===1/0)return"continue";var A=[];A=n?function(t,e){return e.filter(function(e){return e.source===t})}(i,s):function(t,e){return e.filter(function(e){return e.source===t||e.target===t})}(i,s),A.forEach(function(t){var n=t.target,o=t.source,A=n===i?o:n,s=r&&t[r]?t[r]:1;c[A]>c[e.id]+s?(c[A]=c[e.id]+s,l[A]=[e.id]):c[A]===c[e.id]+s&&l[A].push(e.id)})},d=0;d<u;d++)h();l[e]=[e];var f={};for(var g in c)c[g]!==1/0&&Hm(e,g,l,f);var p={};for(var g in f)p[g]=f[g][0];return{length:c,path:p,allPath:f}}(t,e,r,i),A=o.length,s=o.path,a=o.allPath;return{length:A[n],path:s[n],allPath:a[n]}};!function(t){t.EuclideanDistance="euclideanDistance"}(_m||(_m={}));function Km(t){if(void 0!==t.id)return t.id;if(void 0!==t.source&&void 0!==t.target)return`${t.source}-${t.target}`;throw new Error($v("The datum does not have available id."))}function jm(t){return t.combo}function zm(t,e){const n={nodes:(t.nodes||[]).map(Km),edges:(t.edges||[]).map(Km),combos:(t.combos||[]).map(Km)};return e?Object.values(n).flat():n}!function(){function t(t){void 0===t&&(t=10),this.linkedList=new Nm,this.maxStep=t}Object.defineProperty(t.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return!this.linkedList.head},t.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},t.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},t.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},t.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},t.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},t.prototype.clear=function(){for(;!this.isEmpty();)this.pop()}}();const Vm=(t,e,n)=>{var r;switch(n.type){case"degree":{const i=new Map;return null===(r=t.nodes)||void 0===r||r.forEach(t=>{const r=e(Km(t),n.direction).length;i.set(Km(t),r)}),i}case"betweenness":return Ym(t,n.directed,n.weightPropertyName);case"closeness":return Xm(t,n.directed,n.weightPropertyName);case"eigenvector":return $m(t,n.directed);case"pagerank":return qm(t,n.epsilon,n.linkProb);default:return Wm(t)}},Wm=t=>{var e;const n=new Map;return null===(e=t.nodes)||void 0===e||e.forEach(t=>{n.set(Km(t),0)}),n},Ym=(t,e,n)=>{const r=Wm(t),{nodes:i=[]}=t;return i.forEach(o=>{i.forEach(i=>{if(o!==i){const{allPath:A}=Gm(t,Km(o),Km(i),e,n),s=A.length;A.flat().forEach(t=>{t!==Km(o)&&t!==Km(i)&&r.set(t,r.get(t)+1/s)})}})}),r},Xm=(t,e,n)=>{const r=new Map,{nodes:i=[]}=t;return i.forEach(o=>{const A=i.reduce((r,i)=>{if(o!==i){const{length:A}=Gm(t,Km(o),Km(i),e,n);r+=A}return r},0);r.set(Km(o),1/A)}),r},qm=(t,e,n)=>{var r;const i=new Map,o=function(t,e,n){"number"!=typeof e&&(e=1e-6),"number"!=typeof n&&(n=.85);for(var r,i=1,o=0,A=1e3,s=t.nodes,a=void 0===s?[]:s,c=t.edges,l=void 0===c?[]:c,u=a.length,h={},d={},f=0;f<u;++f)h[p=(b=a[f]).id]=1/u,d[p]=1/u;for(var g=function(t){var e={},n=t.nodes,r=void 0===n?[]:n,i=t.edges,o=void 0===i?[]:i;return r.forEach(function(t){e[t.id]={degree:0,inDegree:0,outDegree:0}}),o.forEach(function(t){e[t.source].degree++,e[t.source].outDegree++,e[t.target].degree++,e[t.target].inDegree++}),e}(t);A>0&&i>e;){for(o=0,f=0;f<u;++f){var p=(b=a[f]).id;if(r=0,0===g[b.id].inDegree)h[p]=0;else{for(var v=Tm(p,l,"source"),m=0;m<v.length;++m){var y=v[m],w=g[y].outDegree;w>0&&(r+=d[y]/w)}h[p]=n*r,o+=h[p]}}for(o=(1-o)/u,i=0,f=0;f<u;++f){var b;r=h[p=(b=a[f]).id]+o,i+=Math.abs(r-d[p]),d[p]=r}A-=1}return d}(t,e,n);return null===(r=t.nodes)||void 0===r||r.forEach(t=>{i.set(Km(t),o[Km(t)])}),i},$m=(t,e)=>{const{nodes:n=[]}=t,r=Zm(t,e),i=Jm(r,n.length),o=new Map;return n.forEach((t,e)=>{o.set(Km(t),i[e])}),o},Zm=(t,e)=>{const{nodes:n=[],edges:r=[]}=t,i=Array(n.length).fill(null).map(()=>Array(n.length).fill(0));return r.forEach(({source:t,target:r})=>{const o=n.findIndex(e=>Km(e)===t),A=n.findIndex(t=>Km(t)===r);e?i[o][A]=1:(i[o][A]=1,i[A][o]=1)}),i},Jm=(t,e,n=100,r=1e-6)=>{let i=Array(e).fill(1),o=1/0;for(let A=0;A<n&&o>r;A++){const n=Array(e).fill(0);for(let r=0;r<e;r++)for(let o=0;o<e;o++)n[r]+=t[r][o]*i[o];const r=Math.sqrt(n.reduce((t,e)=>t+e*e,0));for(let t=0;t<e;t++)n[t]/=r;o=Math.sqrt(n.reduce((t,e,n)=>t+(e-i[n])*e,0)),i=n}return i};function ty(t,e,n,r=xe){const i=new Map(t.map(t=>[n(t),t])),o=new Map(e.map(t=>[n(t),t])),A=new Set(i.keys()),s=new Set(o.keys()),a=[],c=[],l=[],u=[];return s.forEach(t=>{A.has(t)?r(i.get(t),o.get(t))?u.push(o.get(t)):c.push(o.get(t)):a.push(o.get(t))}),A.forEach(t=>{s.has(t)||l.push(i.get(t))}),{enter:a,exit:l,keep:u,update:c}}function ey(t,e,n){t.forEach(t=>{(t=>{n&&!n(t)||(t.style.visibility=e)})(t)})}class ny{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=function(t,e,n){const r={},i=t=>(t in r||(r[t]=0),`${e}-${t}-${r[t]++}`);return n.map(e=>"string"==typeof e?{type:e,key:i(e)}:"function"==typeof e?e.call(t):e.key?e:Object.assign(Object.assign({},e),{key:i(e.type)}))}(this.context.graph,this.category,t),{enter:n,update:r,exit:i,keep:o}=ty(this.extensions,e,t=>t.key);this.createExtensions(n),this.updateExtensions([...r,...o]),this.destroyExtensions(i),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:r}=t,i=Xv(e,r);if(!i)return Zv(`The extension ${r} of ${e} is not registered.`);const o=new i(this.context,t);o.initialized=!0,this.extensionMap[n]=o}createExtensions(t){t.forEach(t=>this.createExtension(t))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(t=>this.updateExtension(t))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.initialized&&!e.destroyed&&e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:t})=>this.destroyExtension(t))}destroy(){this.destroyExtensions(this.extensions),this.context={},this.extensions=[],this.extensionMap={}}}class ry{constructor(t,e){this.events=[],this.initialized=!1,this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class iy extends ry{}class oy extends iy{constructor(t,e){super(t,Object.assign({},oy.defaultOptions,e)),this.isOverlapping=(t,e)=>e.some(e=>t.intersects(e)),this.occupiedBounds=[],this.detectLabelCollision=t=>{const e=this.context.viewport,n={show:[],hide:[]};return this.occupiedBounds=[],t.forEach(t=>{const r=t.getShape("label").getRenderBounds();e.isInViewport(r,!0)&&!this.isOverlapping(r,this.occupiedBounds)?(n.show.push(t),this.occupiedBounds.push(Em(r,this.options.padding))):n.hide.push(t)}),n},this.hideLabelIfExceedViewport=(t,e)=>{const{exit:n}=ty(t,e,t=>t.id);null==n||n.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(t,e)=>{const{model:n}=this.context,r=n.getData(),i=n.getRelatedEdgesData.bind(n);return t.map(t=>(this.nodeCentralities.has(t.id)||(this.nodeCentralities=Vm(r,i,e)),{node:t,centrality:this.nodeCentralities.get(t.id)})).sort((t,e)=>e.centrality-t.centrality).map(t=>t.node)},this.sortLabelElementsInView=t=>{const{sort:e,sortNode:n,sortCombo:r,sortEdge:i}=this.options,{model:o}=this.context;if(Gt(e))return t.sort((t,n)=>e(o.getElementDataById(t.id),o.getElementDataById(n.id)));const{node:A=[],edge:s=[],combo:a=[]}=ee(t,t=>t.type),c=Gt(r)?a.sort((t,e)=>r(...o.getComboData([t.id,e.id]))):a,l=Gt(n)?A.sort((t,e)=>n(...o.getNodeData([t.id,e.id]))):this.sortNodesByCentrality(A,n),u=Gt(i)?s.sort((t,e)=>i(...o.getEdgeData([t.id,e.id]))):s;return[...c,...l,...u]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=t=>{var e;if("zIndex"===(null===(e=t.data)||void 0===e?void 0:e.stage))return;if(!this.validate(t))return void(this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear()));const n=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,n),this.labelElementsInView=n;const r=this.sortLabelElementsInView(this.labelElementsInView),{show:i,hide:o}=this.detectLabelCollision(r);for(let t=i.length-1;t>=0;t--)this.showLabel(i[t]);o.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=t=>{const e=t.getShape("label");e&&ey(e,"hidden"),this.hiddenElements.set(t.id,t)},this.showLabel=t=>{const e=t.getShape("label");e&&ey(e,"visible"),t.toFront(),this.hiddenElements.delete(t.id)},this.onTransform=Qe(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=t=>{this.enableToggle&&this.onToggleVisibility(t)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=t=>{this.onToggleVisibility(t),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const r=t[n];r.isVisible()&&r.getShape("label")&&e.push(r)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.on(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.on(t.GraphEvent.AFTER_DRAW,this.toggle),e.on(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.BEFORE_RENDER,this.onBeforeRender),e.off(t.GraphEvent.AFTER_RENDER,this.onAfterRender),e.off(t.GraphEvent.AFTER_DRAW,this.toggle),e.off(t.GraphEvent.AFTER_LAYOUT,this.toggle),e.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}oy.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};const Ay=[0,0,0];function sy(t,e){if(t.length==e.length)return[t,e];if(dm(t)&&0!==t[2]||dm(e)&&0!==e[2])throw new Error($v("Vectors could not operate due to different dimensions."));return[yy(t),yy(e)]}function ay(t,e){return[t,e]=sy(t,e),t.map((t,n)=>t+e[n])}function cy(t,e){return[t,e]=sy(t,e),t.map((t,n)=>t-e[n])}function ly(t,e){return"number"==typeof e?t.map(t=>t*e):([t,e]=sy(t,e),t.map((t,n)=>t*e[n]))}function uy(t,e){return"number"==typeof e?t.map(t=>t/e):([t,e]=sy(t,e),t.map((t,n)=>{if(0==e[n])throw new Error($v("Vector could not be divided by zero"));return t/e[n]}))}function hy(t,e){return t.map(t=>t*e)}function dy(t,e){return[t,e]=sy(t,e),Math.sqrt(t.reduce((t,n,r)=>t+Math.pow(n-e[r],2),0))}function fy(t,e){return[t,e]=sy(t,e),t.reduce((t,n,r)=>t+Math.abs(n-e[r]),0)}function gy(t){const e=t.reduce((t,e)=>t+Math.pow(e,2),0);return t.map(t=>t/Math.sqrt(e))}function py(t,e,n=!1){[t,e]=sy(t,e);const r=t[0]*e[1]-t[1]*e[0];let i=Math.acos(ly(t,e).reduce((t,e)=>t+e,0)/(dy(t,Ay)*dy(e,Ay)));return n&&r<0&&(i=2*Math.PI-i),i}function vy(t,e=!0){return e?[-t[1],t[0]]:[t[1],-t[0]]}function my(t,e){return t.map(t=>t%e)}function yy(t){return[t[0],t[1]]}function wy(t){return 2===t.length?[t[0],t[1],0]:t}function by(t){const[e,n]=t;return e||n?Math.atan2(n,e):0}function By(t,e){const[n,r]=t;if(e%360==0)return[n,r];const i=e*Math.PI/180,o=Math.cos(i),A=Math.sin(i);return[n*o-r*A,n*A+r*o]}function Ey(t,e){const[n,r]=t,[i,o]=e;return function(t,e){const n=wy(t),r=wy(e);return[n[1]*r[2]-n[2]*r[1],n[2]*r[0]-n[0]*r[2],n[0]*r[1]-n[1]*r[0]]}(cy(n,r),cy(i,o)).every(t=>0===t)}function xy(t,e,n=!1){if(Ey(t,e))return;const[r,i]=t,[o,A]=e,s=((r[0]-o[0])*(o[1]-A[1])-(r[1]-o[1])*(o[0]-A[0]))/((r[0]-i[0])*(o[1]-A[1])-(r[1]-i[1])*(o[0]-A[0])),a=A[0]-o[0]?(r[0]-o[0]+s*(i[0]-r[0]))/(A[0]-o[0]):(r[1]-o[1]+s*(i[1]-r[1]))/(A[1]-o[1]);return n||gm(s,0,1)&&gm(a,0,1)?[r[0]+s*(i[0]-r[0]),r[1]+s*(i[1]-r[1])]:void 0}function Cy(t){if(Array.isArray(t))return gm(t[0],0,1)&&gm(t[1],0,1)?t:[.5,.5];const e=t.split("-");return[e.includes("left")?0:e.includes("right")?1:.5,e.includes("top")?0:e.includes("bottom")?1:.5]}function My(t){const{x:e=0,y:n=0,z:r=0}=t.style||{};return[+e,+n,+r]}function Fy(t){const{x:e,y:n,z:r}=t.style||{};return void 0!==e||void 0!==n||void 0!==r}function ky(t,e="center"){return function(t,e){const[n,r]=e,{min:i,max:o}=t;return[i[0]+n*(o[0]-i[0]),i[1]+r*(o[1]-i[1])]}(t,Cy(e))}function Sy(t){var e;return[t.x,t.y,null!==(e=t.z)&&void 0!==e?e:0]}function Qy(t){var e;return{x:t[0],y:t[1],z:null!==(e=t[2])&&void 0!==e?e:0}}function Uy(t,e=0){return t.map(t=>parseFloat(t.toFixed(e)))}function Ny(t,e,n,r=!1){if(xe(t,e))return t;const i=gy(r?cy(t,e):cy(e,t)),o=[i[0]*n,i[1]*n];return ay(yy(t),o)}function Ty(t,e){return t[1]===e[1]}function Oy(t,e){return Ty(t,e)||function(t,e){return t[0]===e[0]}(t,e)}function Iy(t,e,n){return Ey([t,e],[e,n])}function Ly(t,e){return[2*e[0]-t[0],2*e[1]-t[1]]}function Py(t,e,n,r=!0,i=!1){for(let o=0;o<n.length;o++){let A=n[o],s=n[(o+1)%n.length];r&&(A=ay(e,A),s=ay(e,s));const a=xy([e,i?Ly(t,e):t],[A,s]);if(a)return{point:a,line:[A,s]}}return{point:e,line:void 0}}function Dy(t,e,n=!1){const r=e.center,i=cy(n?Ly(t,r):t,e.center),o=Math.atan2(i[1],i[0]);if(isNaN(o))return r;const A=mm(e)/2,s=ym(e)/2;return[r[0]+A*Math.cos(o),r[1]+s*Math.sin(o)]}function Ry(t,e){let n=1/0,r=[[0,0],[0,0]];return e.forEach(e=>{const i=function(t,e){const n=Hy(t,e);return dy(t,n)}(t,e);i<n&&(n=i,r=e)}),r}function Hy(t,e){const[n,r]=e[0],[i,o]=e[1],[A,s]=t,a=i-n,c=o-r;if(0===a&&0===c)return[n,r];let l=((A-n)*a+(s-r)*c)/(a*a+c*c);l>1?l=1:l<0&&(l=0);return[n+l*a,r+l*c]}function _y(t,e=!0){const n=function(t){const e=t.reduce((t,e)=>ay(t,e),[0,0]);return uy(e,t.length)}(t);return t.sort(([t,r],[i,o])=>{const A=Math.atan2(r-n[1],t-n[0]),s=Math.atan2(o-n[1],i-n[0]);return e?s-A:A-s})}function Gy(t,e){return[t,[t[0],e[1]],e,[e[0],t[1]]]}class Ky{constructor(t,e,n){if(this.phase=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,Ky.instance)return Ky.callbacks[this.phase].push(n),Ky.instance;this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents(),Ky.instance=this,Ky.callbacks[this.phase].push(n)}bindEvents(){const{emitter:e}=this;e.on(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.on(t.CommonEvent.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const r=this.pointerByTouch.findIndex(e=>e.pointerId===t);r>=0&&(this.pointerByTouch[r]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client||{};if(void 0!==e&&void 0!==n&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),"touch"===t.pointerType&&2===this.pointerByTouch.length)){Ky.isPinching=!0;const e=this.pointerByTouch[0].x-this.pointerByTouch[1].x,n=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(e*e+n*n),Ky.callbacks.pinchstart.forEach(e=>e(t,{scale:0}))}}onPointerMove(t){if(2!==this.pointerByTouch.length||null===this.initialDistance)return;const{x:e,y:n}=t.client||{};if(void 0===e||void 0===n)return;this.updatePointerPosition(t.pointerId,e,n);const r=this.pointerByTouch[0].x-this.pointerByTouch[1].x,i=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(r*r+i*i)/this.initialDistance;Ky.callbacks.pinchmove.forEach(e=>e(t,{scale:5*(o-1)}))}onPointerUp(t){var e;Ky.callbacks.pinchend.forEach(e=>e(t,{scale:0})),Ky.isPinching=!1,this.initialDistance=null,this.pointerByTouch=[],null===(e=Ky.instance)||void 0===e||e.tryDestroy()}destroy(){this.emitter.off(t.CommonEvent.POINTER_DOWN,this.onPointerDown),this.emitter.off(t.CommonEvent.POINTER_MOVE,this.onPointerMove),this.emitter.off(t.CommonEvent.POINTER_UP,this.onPointerUp),Ky.instance=null}off(t,e){const n=Ky.callbacks[t].indexOf(e);n>-1&&Ky.callbacks[t].splice(n,1),this.tryDestroy()}tryDestroy(){Object.values(Ky.callbacks).every(t=>0===t.length)&&this.destroy()}}Ky.isPinching=!1,Ky.instance=null,Ky.callbacks={pinchstart:[],pinchmove:[],pinchend:[]};const jy=new Set(["Control","Alt","Meta","Shift"]);function zy(t){return jy.has(t)}const Vy=t=>t.map(t=>Jt(t)?t.toLocaleLowerCase():t);class Wy{constructor(e){this.map=new Map,this.boundHandlePinch=()=>{},this.recordKey=new Set,this.onKeyDown=t=>{(null==t?void 0:t.key)&&(this.recordKey.add(t.key),this.trigger(t))},this.onKeyUp=t=>{(null==t?void 0:t.key)&&this.recordKey.delete(t.key)},this.onKeyDownWindow=t=>{zy(t.key)&&this.recordKey.add(t.key)},this.onKeyUpWindow=t=>{zy(t.key)&&this.recordKey.delete(t.key)},this.onWheel=e=>{this.triggerExtendKey(t.CommonEvent.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(t.CommonEvent.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(t.CommonEvent.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=e,this.bindEvents()}bind(e,n){0!==e.length&&(e.includes(t.CommonEvent.PINCH)&&!this.pinchHandler&&(this.boundHandlePinch=this.handlePinch.bind(this),this.pinchHandler=new Ky(this.emitter,"pinchmove",this.boundHandlePinch)),this.map.set(e,n))}unbind(t,e){this.map.forEach((n,r)=>{xe(r,t)&&(e&&e!==n||this.map.delete(r))})}unbindAll(){this.map.clear()}match(t){const e=Vy(Array.from(this.recordKey)).sort(),n=Vy(t).sort();return xe(e,n)}bindEvents(){var e;const{emitter:n}=this;window.addEventListener(t.CommonEvent.KEY_DOWN,this.onKeyDownWindow),window.addEventListener(t.CommonEvent.KEY_UP,this.onKeyUpWindow),n.on(t.CommonEvent.KEY_DOWN,this.onKeyDown),n.on(t.CommonEvent.KEY_UP,this.onKeyUp),n.on(t.CommonEvent.WHEEL,this.onWheel),n.on(t.CommonEvent.DRAG,this.onDrag),null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,r)=>{r.includes(t)&&xe(Array.from(this.recordKey),r.filter(e=>e!==t))&&n(e)})}destroy(){var e,n;this.unbindAll(),this.emitter.off(t.CommonEvent.KEY_DOWN,this.onKeyDown),this.emitter.off(t.CommonEvent.KEY_UP,this.onKeyUp),window.removeEventListener(t.CommonEvent.KEY_DOWN,this.onKeyDownWindow),window.removeEventListener(t.CommonEvent.KEY_UP,this.onKeyUpWindow),this.emitter.off(t.CommonEvent.WHEEL,this.onWheel),this.emitter.off(t.CommonEvent.DRAG,this.onDrag),null===(e=this.pinchHandler)||void 0===e||e.off("pinchmove",this.boundHandlePinch),null===(n=globalThis.removeEventListener)||void 0===n||n.call(globalThis,"focus",this.onFocus)}}class Yy extends iy{constructor(t,e){super(t,be({},Yy.defaultOptions,e)),this.shortcut=new Wy(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,r=Object.assign({},this.options.style);this.options.style.lineWidth&&(r.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new sc({id:"g6-brush-select",style:r}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:r}=this.options;this.endPoint=Xy(t,this.context.graph),null===(e=this.rectShape)||void 0===e||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&"default"===r&&this.updateElementsStates(Gy(this.startPoint,this.endPoint))}onPointerUp(t){this.startPoint&&(this.endPoint?(this.endPoint=Xy(t,this.context.graph),this.updateElementsStates(Gy(this.startPoint,this.endPoint)),this.clearBrush()):this.clearBrush())}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((t,e)=>Object.assign({},t,e.reduce((t,e)=>{var n;const r=null===(n=e.states||[])||void 0===n?void 0:n.filter(t=>t!==this.options.state);return t[Km(e)]=r,t},{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:r,mode:i,onSelect:o}=this.options,A=this.selector(e,t,n),s={};switch(i){case"union":A.forEach(t=>{s[t]=[...e.getElementState(t),r]});break;case"diff":A.forEach(t=>{const n=e.getElementState(t);s[t]=n.includes(r)?n.filter(t=>t!==r):[...n,r]});break;case"intersect":A.forEach(t=>{const n=e.getElementState(t);s[t]=n.includes(r)?[r]:[]});break;default:A.forEach(t=>{s[t]=[r]})}Gt(o)&&o(s),e.setElementState(s,this.options.animation)}selector(t,e,n){if(!n||0===n.length)return[];const r=[],i=t.getData();if(n.forEach(n=>{i[`${n}s`].forEach(n=>{const i=Km(n);"hidden"!==t.getElementVisibility(i)&&function(t,e,n,r){const i=t[0],o=t[1];let A=!1;void 0===n&&(n=0),void 0===r&&(r=e.length);const s=r-n;for(let t=0,r=s-1;t<s;r=t++){const s=e[t+n][0],a=e[t+n][1],c=e[r+n][0],l=e[r+n][1];a>o!=l>o&&i<(c-s)*(o-a)/(l-a)+s&&(A=!A)}return A}(t.getElementPosition(i),e)&&r.push(i)})}),n.includes("edge")){const t=i.edges;null==t||t.forEach(t=>{const{source:e,target:n}=t;r.includes(e)&&r.includes(n)&&r.push(Km(t))})}return r}clearBrush(){var t;null===(t=this.rectShape)||void 0===t||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(t=>"drag"!==t))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}bindEvents(){const{graph:e}=this.context;e.on(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.on(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.on(t.CommonEvent.POINTER_UP,this.onPointerUp),e.on(t.CanvasEvent.CLICK,this.clearStates)}unbindEvents(){const{graph:e}=this.context;e.off(t.CommonEvent.POINTER_DOWN,this.onPointerDown),e.off(t.CommonEvent.POINTER_MOVE,this.onPointerMove),e.off(t.CommonEvent.POINTER_UP,this.onPointerUp),e.off(t.CanvasEvent.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=be(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Yy.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const Xy=(t,e)=>{if(!("node"!==t.targetType&&"combo"!==t.targetType||t.nativeEvent.target instanceof HTMLCanvasElement)){const[n,r]=e.getCanvasByClient([t.client.x,t.client.y]);return[n,r]}return[t.canvas.x,t.canvas.y]},qy=.8,$y=["node","edge","combo"];function Zy(t,e,n,r,i=0){"TB"===r&&e(t,i);const o=n(t);if(o)for(const t of o)Zy(t,e,n,r,i+1);"BT"===r&&e(t,i)}function Jy(t,e,n,r,i="both"){if("combo"===e||"node"===e)return tw(t,n,r,i);const o=t.getEdgeData(n);if(!o)return[];const A=tw(t,o.source,r-1,i),s=tw(t,o.target,r-1,i);return Array.from(new Set([...A,...s,n]))}function tw(t,e,n,r="both"){const i=new Set,o=new Set,A=new Set;return function(t,e,n){const r=[[t,0]];for(;r.length;){const[t,i]=r.shift();e(t,i);const o=n(t);if(o)for(const t of o)r.push([t,i+1])}}(e,(e,i)=>{i>n||(A.add(e),t.getRelatedEdgesData(e,r).forEach(t=>{const e=Km(t);!o.has(e)&&i<n&&(A.add(e),o.add(e))}))},e=>t.getRelatedEdgesData(e,r).map(t=>t.source===e?t.target:t.source).filter(t=>!i.has(t)&&(i.add(t),!0))),Array.from(A)}function ew(t){return t.states||[]}class nw extends iy{constructor(t,e){super(t,Object.assign({},nw.defaultOptions,e)),this.onClickSelect=t=>De(this,void 0,void 0,function*(){var e,n;this.validate(t)&&(yield this.updateState(t),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))}),this.onClickCanvas=t=>De(this,void 0,void 0,function*(){var e,n;this.validate(t)&&(yield this.clearState(),null===(n=(e=this.options).onClick)||void 0===n||n.call(e,t))}),this.shortcut=new Wy(t.graph),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),$y.forEach(n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)}),e.on(t.CanvasEvent.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:r}=this.context,{degree:i}=this.options;return Jy(r,n,e.id,"function"==typeof i?i(t):i).filter(t=>t!==e.id)}updateState(t){return De(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:r,animation:i}=this.options;if(!e&&!r&&!n)return;const{target:o}=t,{graph:A}=this.context,s=ew(A.getElementData(o.id)).includes(e)?"unselect":"select",a={},c=this.isMultipleSelect,l=[o.id],u=this.getNeighborIds(t);if(c)if(Object.assign(a,this.getDataStates()),"select"===s){const t=(t,e)=>{t.forEach(t=>{const r=new Set(A.getElementState(t));r.add(e),r.delete(n),a[t]=Array.from(r)})};t(l,e),t(u,r),n&&Object.keys(a).forEach(t=>{const i=a[t];i.includes(e)||i.includes(r)||i.includes(n)||a[t].push(n)})}else{const t=a[o.id];a[o.id]=t.filter(t=>t!==e&&t!==r),t.includes(n)||a[o.id].push(n),u.forEach(t=>{a[t]=a[t].filter(t=>t!==r),a[t].includes(e)||a[t].push(n)})}else if("select"===s){Object.assign(a,this.getClearStates(!!n));const t=(t,e)=>{t.forEach(t=>{a[t]||(a[t]=A.getElementState(t)),a[t].push(e)})};t(l,e),t(u,r),n&&Object.keys(a).forEach(t=>{l.includes(t)||u.includes(t)||a[t].push(n)})}else Object.assign(a,this.getClearStates());yield A.setElementState(a,i)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:r}=t.getData(),i={};return[...e,...n,...r].forEach(t=>{i[Km(t)]=ew(t)}),i}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:r,neighborState:i}=this.options,o=new Set([n,r,i]),{nodes:A,edges:s,combos:a}=e.getData(),c={};return[...A,...s,...a].forEach(e=>{const n=ew(e),r=n.filter(t=>!o.has(t));(t||r.length!==n.length)&&(c[Km(e)]=r)}),c}clearState(){return De(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;$y.forEach(n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.onClickSelect)}),e.off(t.CanvasEvent.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}function rw(t){var e;return!!(null===(e=t.style)||void 0===e?void 0:e.collapsed)}function iw(t,e){if(!t.startsWith(e))return!1;const n=t[e.length];return n>="A"&&n<="Z"}function ow(t,e,n=!0){if(!e)return t;if(!iw(t,e))return t;const r=t.slice(e.length);return n?function(t){var e=ae(t);return e.charAt(0).toLowerCase()+e.substring(1)}(r):r}function Aw(t,e){const n=Object.entries(t).reduce((t,[n,r])=>("className"===n||"class"===n||iw(n,e)&&Object.assign(t,{[ow(n,e)]:r}),t),{});if("opacity"in t){const r=function(t,e){return`${e}${ce(t)}`}("opacity",e),i=t.opacity;if(r in t){const e=t[r];Object.assign(n,{opacity:i*e})}else Object.assign(n,{opacity:i})}return n}function sw(t,e){const n=e.length;return Object.keys(t).reduce((r,i)=>{if(i.startsWith(e)){r[i.slice(n)]=t[i]}return r},{})}function aw(t,e){const n="string"==typeof e?[e]:e,r={};return Object.keys(t).forEach(e=>{n.find(t=>e.startsWith(t))||(r[e]=t[e])}),r}function cw(t=0){if("number"==typeof t)return[t,t,t];const[e,n=e,r=e]=t;return[e,n,r]}function lw(t,e){const{datum:n,graph:r}=e;return"function"==typeof t?t.call(r,n):Object.fromEntries(Object.entries(t).map(([t,e])=>"function"==typeof e?[t,e.call(r,n)]:[t,e]))}function uw(t,e){const n=(null==t?void 0:t.style)||{},r=(null==e?void 0:e.style)||{};for(const t in n)t in r||(r[t]=n[t]);return Object.assign({},t,e,{style:r})}function hw(t){if(t)return"string"==typeof t||"function"==typeof t||Array.isArray(t)?{type:"group",field:t=>t.id,color:t,invert:!1}:t}function dw(t){const e="string"==typeof t?Xv("palette",t):t;if("function"!=typeof e)return e}function fw(t,e){let n=2*t;return"string"==typeof e?n=t*Number(e.replace("%",""))/100:"number"==typeof e&&(n=e),isNaN(n)&&(n=2*t),n}function gw(t,e,n=1,r=!1){const i=r?n:1;return fw((t.max[0]-t.min[0])*i,e)}nw.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};class pw extends Wa{constructor(t){mw(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(e,n,r,i,o){var A,s,a,c,l,u,h,d;const f=this.shapeMap[e];if(!1===r)return void(f&&(null===(A=null==o?void 0:o.beforeDestroy)||void 0===A||A.call(o,f),i.removeChild(f),delete this.shapeMap[e],null===(s=null==o?void 0:o.afterDestroy)||void 0===s||s.call(o,f)));const g="string"==typeof n?Xv(t.ExtensionCategory.SHAPE,n):n;if(!g)throw new Error($v(`Shape ${n} not found`));if(!f||f.destroyed||!(f instanceof g)){f&&(null===(a=null==o?void 0:o.beforeDestroy)||void 0===a||a.call(o,f),null==f||f.destroy(),null===(c=null==o?void 0:o.afterDestroy)||void 0===c||c.call(o,f)),null===(l=null==o?void 0:o.beforeCreate)||void 0===l||l.call(o);const t=new g({className:e,style:r});return i.appendChild(t),this.shapeMap[e]=t,null===(u=null==o?void 0:o.afterCreate)||void 0===u||u.call(o,t),t}return null===(h=null==o?void 0:o.beforeUpdate)||void 0===h||h.call(o,f),tE(f,r),null===(d=null==o?void 0:o.afterUpdate)||void 0===d||d.call(o,f),f}update(t={}){const e=Object.assign({},this.attributes,t);mw(e),function(t,e){const{zIndex:n,transform:r,transformOrigin:i,visibility:o,cursor:A,clipPath:s,component:a}=e,c=Pe(e,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(t.attributes,c),r&&t.setAttribute("transform",r);re(n)&&t.setAttribute("zIndex",n);i&&t.setAttribute("transformOrigin",i);o&&t.setAttribute("visibility",o);A&&t.setAttribute("cursor",A);s&&t.setAttribute("clipPath",s);a&&t.setAttribute("component",a)}(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return function(t){const{x:e,y:n,z:r,class:i,className:o,transform:A,transformOrigin:s,zIndex:a,visibility:c}=t;return Pe(t,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(0===t.length)return null;const n=[];if(void 0!==t[0].x||void 0!==t[0].y||void 0!==t[0].z){const{x:e=0,y:n=0,z:r=0}=this.attributes;t.forEach(t=>{const{x:i=e,y:o=n,z:A=r}=t;Object.assign(t,{transform:A?[["translate3d",i,o,A]]:[["translate",i,o]]})})}const r=super.animate(t,e);if(r&&(vw(this,r),n.push(r)),Array.isArray(t)&&t.length>0){const r=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(t=>!r.includes(t))){Object.entries(this.shapeMap).forEach(([r,i])=>{const o=this[`get${ce(r)}Style`];if(Gt(o)){const r=t.map(t=>o.call(this,Object.assign(Object.assign({},this.attributes),t))),A=i.animate(em(r),e);A&&(vw(i,A),n.push(A))}});const r=(r,i)=>{if(!Ee(r)){const o=this[`get${ce(i)}Style`];if(Gt(o)){const i=t.map(t=>o.call(this,Object.assign(Object.assign({},this.attributes),t)));Object.entries(i[0]).map(([t])=>{const o=i.map(e=>e[t]),A=r[t];if(A){const t=A.animate(em(o),e);t&&(vw(A,t),n.push(t))}})}}};this.compositeShapes.forEach(([t,e])=>{const n=sw(this.shapeMap,e);r(n,t)})}}return tm(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;ey(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function vw(t,e){null==e||e.finished.then(()=>{const n=t.activeAnimations.findIndex(t=>t===e);n>-1&&t.activeAnimations.splice(n,1)})}function mw(t){if(!t)return{};if("x"in t||"y"in t||"z"in t){const{x:e=0,y:n=0,z:r,transform:i}=t,o=om(e,n,r,i);o&&(t.transform=o)}return t}class yw extends pw{constructor(t){super(uw({style:yw.defaultStyleProps},t))}isTextStyle(t){return iw(t,"label")}isBackgroundStyle(t){return iw(t,"background")}getTextStyle(t){const e=this.getGraphicStyle(t),{padding:n}=e;return aw(Pe(e,["padding"]),"background")}getBackgroundStyle(t){if(!1===t.background)return!1;const e=this.getGraphicStyle(t),{wordWrap:n,wordWrapWidth:r,padding:i}=e,o=Aw(e,"background"),{min:[A,s],center:[a,c],halfExtents:[l,u]}=this.shapeMap.text.getGeometryBounds(),[h,d,f,g]=pm(i),p=2*l+g+d,{width:v,height:m}=o;v&&m?Object.assign(o,{x:a-Number(v)/2,y:c-Number(m)/2}):Object.assign(o,{x:A-g,y:s-h,width:n?Math.min(p,r+g+d):p,height:2*u+h+f});const{radius:y}=o;if("string"==typeof y&&y.endsWith("%")){const t=Number(y.replace("%",""))/100;o.radius=Math.min(+o.width,+o.height)*t}return o}render(t=this.parsedAttributes,e=this){this.upsert("text",cc,this.getTextStyle(t),e),this.upsert("background",sc,this.getBackgroundStyle(t),e)}getGeometryBounds(){return(this.getShape("background")||this.getShape("text")).getGeometryBounds()}}yw.defaultStyleProps={padding:0,fontSize:12,fontFamily:"system-ui, sans-serif",wordWrap:!0,maxLines:1,wordWrapWidth:128,textOverflow:"...",textBaseline:"middle",backgroundOpacity:.75,backgroundZIndex:-1,backgroundLineWidth:0};class ww extends pw{constructor(t){super(uw({style:ww.defaultStyleProps},t))}getBadgeStyle(t){return this.getGraphicStyle(t)}render(t=this.parsedAttributes,e=this){this.upsert("label",yw,this.getBadgeStyle(t),e)}getGeometryBounds(){const t=this.getShape("label");return(t.getShape("background")||t.getShape("text")).getGeometryBounds()}}ww.defaultStyleProps={padding:[2,4,2,4],fontSize:10,wordWrap:!1,backgroundRadius:"50%",backgroundOpacity:1};const bw={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function Bw(t){const e=[],n="string"==typeof t?function(t){const e=t.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),n=[];let r="",i={};for(;e.length>0;){let t=e.shift();t in bw?r=t:e.unshift(t),i={type:r},bw[r].forEach(n=>{t=e.shift(),i[n]=t}),"M"===r?r="L":"m"===r&&(r="l");const[o,...A]=Object.values(i);n.push([o,...A.map(Number)])}return n}(t):t;return n.forEach(t=>{const n=t[0];if("Z"!==n)if("A"!==n)for(let n=1;n<t.length;n+=2)e.push([t[n],t[n+1],0]);else{const n=t.length;e.push([t[n-2],t[n-1],0])}else e.push(e[0])}),e}const Ew=t=>{if(t.length<2)return[["M",0,0],["L",0,0]];const e=t[0],n=t[1],r=t[t.length-1],i=t[t.length-2];t.unshift(i,r),t.push(e,n);const o=[["M",r[0],r[1]]];for(let e=1;e<t.length-2;e+=1){const[n,r]=t[e-1],[i,A]=t[e],[s,a]=t[e+1],[c,l]=e!==t.length-2?t[e+2]:[s,a],u=i+(s-n)/6,h=A+(a-r)/6,d=s-(c-i)/6,f=a-(l-A)/6;o.push(["C",u,h,d,f,s,a])}return o};class xw extends pw{constructor(t){super(uw({style:xw.defaultStyleProps},t))}getLabelStyle(t){if(!t.label||!t.d||0===t.d.length)return!1;const e=Aw(this.getGraphicStyle(t),"label"),{maxWidth:n,offsetX:r,offsetY:i,autoRotate:o,placement:A,closeToPath:s}=e,a=Pe(e,["maxWidth","offsetX","offsetY","autoRotate","placement","closeToPath"]),c=this.shapeMap.key,l=null==c?void 0:c.getRenderBounds();return Object.assign(function(t,e,n,r,i,o,A){const[s,a]=ky(t,e),c={textAlign:"left"===e?"right":"right"===e?"left":"center",textBaseline:"top"===e?"bottom":"bottom"===e?"top":"middle",transform:[["translate",s+n,a+r]]};if("center"===e||!i)return c;const l=Bw(o);if(!l||l.length<=3)return c;const u=l.map((t,e)=>{const n=t,r=l[(e+1)%l.length];return xe(n,r)?null:[n,r]}).filter(Boolean),h=Ry([s,a],u),d=Hy([s,a],h);if(d&&h&&(c.transform=[["translate",d[0]+n,d[1]+r]],A)){const t=Math.atan((h[0][1]-h[1][1])/(h[0][0]-h[1][0]));c.transform.push(["rotate",t/Math.PI*180]),c.textAlign="center","right"!==e&&"left"!==e||(c.textBaseline=t>0?"right"===e?"bottom":"top":"right"===e?"top":"bottom")}return c}(l,A,r,i,s,t.d,o),{wordWrapWidth:gw(l,n)},a)}getKeyStyle(t){return this.getGraphicStyle(t)}render(t,e){this.upsert("key",nc,this.getKeyStyle(t),e),this.upsert("label",yw,this.getLabelStyle(t),e)}}xw.defaultStyleProps={label:!0,labelPlacement:"bottom",labelCloseToPath:!0,labelAutoRotate:!0,labelOffsetX:0,labelOffsetY:0};let Cw=class extends Za{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Fw=this,this.isMutationObserved=!0,this.addEventListener(ea.MOUNTED,this.onMounted),this.addEventListener(ea.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:r=0}=this.attributes;if(t&&n&&r){const[i,o]=this.getBounds().min,A={x:i,y:o,radius:t,width:n,height:r};if(e)Object.assign(this.parsedStyle.clipPath.style,A);else{const t=new sc({style:A});this.style.clipPath=t}}else e&&(this.style.clipPath=null)}};const Mw=new WeakMap;let Fw=null;const kw=t=>{if(Fw&&function(t){const e=[];let n=t.parentNode;for(;n;)e.push(n),n=n.parentNode;return e}(Fw).includes(t)){const e=Mw.get(t);e?e.includes(Fw)||e.push(Fw):Mw.set(t,[Fw])}},Sw=t=>{const e=Mw.get(t);e&&e.forEach(t=>t.handleRadius())};class Qw extends pw{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,r=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},r):Object.assign({textBaseline:"middle",textAlign:"center"},r)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?Cw:cc,this.getIconStyle(t),e)}}class Uw extends pw{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then(()=>this.onframe())),n}}class Nw extends Uw{constructor(t){super(uw({style:Nw.defaultStyleProps},t)),this.type="node"}getSize(t=this.attributes){const{size:e}=t;return cw(e)}getKeyStyle(t){const e=this.getGraphicStyle(t);return Object.assign(aw(e,["label","halo","icon","badge","port"]))}getLabelStyle(t){if(!1===t.label||!t.labelText)return!1;const e=Aw(this.getGraphicStyle(t),"label"),{placement:n,maxWidth:r,offsetX:i,offsetY:o}=e,A=Pe(e,["placement","maxWidth","offsetX","offsetY"]),s=this.getShape("key").getLocalBounds();return Object.assign(ZB(s,n,i,o),{wordWrapWidth:gw(s,r)},A)}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getKeyStyle(t),{fill:n}=e,r=Pe(e,["fill"]),i=Aw(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign(Object.assign({},r),{stroke:n}),i)}getIconStyle(t){if(!1===t.icon||!t.iconText&&!t.iconSrc)return!1;const e=Aw(this.getGraphicStyle(t),"icon");return Object.assign(function(t,e){const n=cw(t);let r={};return e.text&&!e.fontSize&&(r={fontSize:.5*Math.min(...n)}),!e.src||e.width&&e.height||(r={width:.5*n[0],height:.5*n[1]}),r}(t.size,e),e)}getBadgesStyle(t){var e;const n=sw(this.shapeMap,"badge-"),r={};if(Object.keys(n).forEach(t=>{r[t]=!1}),!1===t.badge||!(null===(e=t.badges)||void 0===e?void 0:e.length))return r;const{badges:i=[],badgePalette:o,opacity:A=1}=t,s=Pe(t,["badges","badgePalette","opacity"]),a=dw(o),c=Aw(this.getGraphicStyle(s),"badge");return i.forEach((t,e)=>{r[e]=Object.assign(Object.assign({backgroundFill:a?a[e%(null==a?void 0:a.length)]:void 0,opacity:A},c),this.getBadgeStyle(t))}),r}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:r,offsetY:i}=t,o=Pe(t,["placement","offsetX","offsetY"]),A=ZB(e.getLocalBounds(),n,r,i,!0);return Object.assign(Object.assign({},A),o)}getPortsStyle(t){var e;const n=this.getPorts(),r={};if(Object.keys(n).forEach(t=>{r[t]=!1}),!1===t.port||!(null===(e=t.ports)||void 0===e?void 0:e.length))return r;const i=Aw(this.getGraphicStyle(t),"port"),{ports:o=[]}=t;return o.forEach((e,n)=>{const o=e.key||n,A=Object.assign(Object.assign({},i),e);if(VB(A))r[o]=!1;else{const[n,i]=this.getPortXY(t,e);r[o]=Object.assign({transform:[["translate",n,i]]},A)}}),r}getPortXY(t,e){const{placement:n="left"}=e,r=this.getShape("key");return jB(function(t,e){if(!t)return e.getLocalBounds();const n=t.canvas.getLayer(),r=e.cloneNode();ey(r,"hidden"),n.appendChild(r);const i=r.getLocalBounds();return r.destroy(),i}(this.context,r),n)}getPorts(){return sw(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){return function(t,e,n=!1){return Py(t,ky(e,"center"),[ky(e,"left-top"),ky(e,"right-top"),ky(e,"right-bottom"),ky(e,"left-bottom")],!1,n).point}(t,this.getShape("key").getBounds(),e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),r=this.getShape("key");this.upsert("halo",r.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",Qw,n,e),kw(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(t=>{const r=n[t];this.upsert(`badge-${t}`,ww,r,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(t=>{const r=n[t],i=`port-${t}`;this.upsert(i,za,r,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",yw,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&Sw(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Nw.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};let Tw=class t extends Nw{constructor(e){super(uw({style:t.defaultStyleProps},e))}drawKeyShape(t,e){return this.upsert("key",za,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,r=2*n*qy;return!!e&&Object.assign({width:r,height:r},e)}getIntersectPoint(t,e=!1){return Dy(t,this.getShape("key").getBounds(),e)}};Tw.defaultStyleProps={size:32};class Ow extends Nw{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",ic,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,r;const{points:i}=this.getShape("key").attributes;return Py(t,[+((null===(n=this.attributes)||void 0===n?void 0:n.x)||0),+((null===(r=this.attributes)||void 0===r?void 0:r.y)||0)],i,!0,e).point}}class Iw extends Ow{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return function(t,e){return[[0,-e/2],[t/2,0],[0,e/2],[-t/2,0]]}(e,n)}}class Lw extends Tw{constructor(t){super(uw({style:Lw.defaultStyleProps},t))}parseOuterR(){const{size:t}=this.parsedAttributes;return Math.min(...cw(t))/2}parseInnerR(){const{innerR:t}=this.parsedAttributes;return Jt(t)?parseInt(t)/100*this.parseOuterR():t}drawDonutShape(t,e){const{donuts:n}=t;if(!(null==n?void 0:n.length))return;const r=n.map(t=>re(t)?{value:t}:t),i=Aw(this.getGraphicStyle(t),"donut"),o=dw(t.donutPalette);if(!o)return;const A=r.reduce((t,e)=>{var n;return t+(null!==(n=e.value)&&void 0!==n?n:0)},0),s=this.parseOuterR(),a=this.parseInnerR();let c=0;r.forEach((t,n)=>{const{value:l=0,color:u=o[n%o.length]}=t,h=Pe(t,["value","color"]),d=360*(0===A?1/r.length:l/A);this.upsert(`round${n}`,nc,Object.assign(Object.assign(Object.assign({},i),{d:Dw(s,a,c,c+d),fill:u}),h),e),c+=d})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}Lw.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const Pw=(t,e,n,r)=>[t+Math.sin(r)*n,e-Math.cos(r)*n],Dw=(t=0,e=0,n,r)=>{const[i,o]=[0,0];return Math.abs(n-r)%360<1e-6?((t,e,n,r)=>r<=0||n<=r?[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"]]:[["M",t-n,e],["A",n,n,0,1,1,t+n,e],["A",n,n,0,1,1,t-n,e],["Z"],["M",t+r,e],["A",r,r,0,1,0,t-r,e],["A",r,r,0,1,0,t+r,e],["Z"]])(i,o,t,e):((t,e,n,r,i,o)=>{const[A,s]=[i/360*2*Math.PI,o/360*2*Math.PI],a=[Pw(t,e,r,A),Pw(t,e,n,A),Pw(t,e,n,s),Pw(t,e,r,s)],c=s-A>Math.PI?1:0;return[["M",a[0][0],a[0][1]],["L",a[1][0],a[1][1]],["A",n,n,0,c,1,a[2][0],a[2][1]],["L",a[3][0],a[3][1]],["A",r,r,0,c,0,a[0][0],a[0][1]],["Z"]]})(i,o,t,e,n,r)};class Rw extends Nw{constructor(t){super(uw({style:Rw.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ya,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:r/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:r}=this.getShape("key").attributes,i=2*Math.min(+n,+r)*qy;return!!e&&Object.assign({width:i,height:i},e)}getIntersectPoint(t,e=!1){return Dy(t,this.getShape("key").getBounds(),e)}}Rw.defaultStyleProps={size:[45,35]};class Hw extends Ow{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return[[0,e=this.getOuterR(t)],[e*Math.sqrt(3)/2,e/2],[e*Math.sqrt(3)/2,-e/2],[0,-e],[-e*Math.sqrt(3)/2,-e/2],[-e*Math.sqrt(3)/2,e/2]];var e}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*qy;return!!e&&Object.assign({width:n,height:n},e)}}function _w(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var Gw=0;function Kw(t){return"__private_"+Gw+++"_"+t}
48
+ /*!
49
+ * @antv/g-canvas
50
+ * @description A renderer implemented by Canvas 2D API
51
+ * @version 2.2.0
52
+ * @date 12/24/2025, 11:55:53 AM
53
+ * @author AntVis
54
+ * @docs https://g.antv.antgroup.com/
55
+ */var jw=Kw("renderState"),zw=function(){function t(e){A(this,t),this.renderQueue=[],Object.defineProperty(this,jw,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=C(),this.dprMatrix=C(),this.tmpMat4=C(),this.vec3a=at(),this.vec3b=at(),this.vec3c=at(),this.vec3d=at(),this.canvasRendererPluginOptions=e}return a(t,[{key:"apply",value:function(e,n){var r=this;this.context=e;var i=this.context,o=i.config,A=i.camera,s=i.renderingService,a=i.renderingContext,c=i.pathGeneratorFactory,l=o.renderer.getConfig().enableRenderingOptimization;o.renderer.getConfig().enableDirtyCheck=!1,o.renderer.getConfig().enableDirtyRectangleRendering=!1,this.pathGeneratorFactory=c;var u=e.contextService,h=a.root.ownerDocument.defaultView;s.hooks.init.tap(t.tag,function(){var t=u.getDPR(),e=o.width,n=o.height,i=u.getContext();r.clearRect(i,0,0,e*t,n*t,o.background)}),s.hooks.destroy.tap(t.tag,function(){r.renderQueue=[],_w(r,jw)[jw]={restoreStack:[],prevObject:null,currentContext:null}});var d=function(t,e){for(var i=[t];i.length>0;){var o,A=i.pop();A.isVisible()&&!A.isCulled()&&(l?r.renderDisplayObjectOptimized(A,e,r.context,_w(r,jw)[jw],n):r.renderDisplayObject(A,e,r.context,_w(r,jw)[jw],n));for(var s=(null===(o=A.sortable)||void 0===o||null===(o=o.sorted)||void 0===o?void 0:o.length)>0?A.sortable.sorted:A.childNodes,a=s.length-1;a>=0;a--)i.push(s[a])}};s.hooks.endFrame.tap(t.tag,function(){if(function(){var t,e=u.getContext(),n=u.getDPR(),i=o.width,A=o.height,a=r.canvasRendererPluginOptions,c=a.dirtyObjectNumThreshold,l=a.dirtyObjectRatioThreshold,d=s.getStats(),f=d.total,g=d.rendered,p=g/f;r.clearFullScreen=r.clearFullScreenLastFrame||!(null!==(t=h.context.renderingPlugins[1])&&void 0!==t&&t.isFirstTimeRenderingFinished)||s.disableDirtyRectangleRendering()||g>c&&p>l,e&&("function"==typeof e.resetTransform?e.resetTransform():e.setTransform(1,0,0,1,0,0),r.clearFullScreen&&r.clearRect(e,0,0,i*n,A*n,o.background))}(),0!==a.root.childNodes.length){l=o.renderer.getConfig().enableRenderingOptimization,_w(r,jw)[jw]={restoreStack:[],prevObject:null,currentContext:_w(r,jw)[jw].currentContext},_w(r,jw)[jw].currentContext.clear(),r.clearFullScreenLastFrame=!1;var t=u.getContext(),e=u.getDPR();if(H(r.dprMatrix,[e,e,1]),O(r.vpMatrix,r.dprMatrix,A.getOrthoMatrix()),r.clearFullScreen)l?(t.save(),d(a.root,t),t.restore()):d(a.root,t);else{var i=r.safeMergeAABB(r.mergeDirtyAABBs(r.renderQueue));if(yr.isEmpty(i))return void(r.renderQueue=[]);var c=r.convertAABB2Rect(i),f=c.x,g=c.y,p=c.width,v=c.height,y=bt(r.vec3a,[f,g,0],r.vpMatrix),w=bt(r.vec3b,[f+p,g,0],r.vpMatrix),b=bt(r.vec3c,[f,g+v,0],r.vpMatrix),B=bt(r.vec3d,[f+p,g+v,0],r.vpMatrix),E=Math.min(y[0],w[0],B[0],b[0]),x=Math.min(y[1],w[1],B[1],b[1]),C=Math.max(y[0],w[0],B[0],b[0]),M=Math.max(y[1],w[1],B[1],b[1]),F=Math.floor(E),k=Math.floor(x),S=Math.ceil(C-E),Q=Math.ceil(M-x);t.save(),r.clearRect(t,F,k,S,Q,o.background),t.beginPath(),t.rect(F,k,S,Q),t.clip(),t.setTransform(r.vpMatrix[0],r.vpMatrix[1],r.vpMatrix[4],r.vpMatrix[5],r.vpMatrix[12],r.vpMatrix[13]),o.renderer.getConfig().enableDirtyRectangleRenderingDebug&&h.dispatchEvent(new Vs(mc.DIRTY_RECTANGLE,{dirtyRect:{x:F,y:k,width:S,height:Q}}));var U=m(i.getMin(),2),N=U[0],T=U[1],I=m(i.getMax(),2),L=I[0],P=I[1];a.root.ownerDocument.elementsFromBBox(N,T,L,P).sort(function(t,e){return t.sortable.renderOrder-e.sortable.renderOrder}).forEach(function(e){e&&e.isVisible()&&!e.isCulled()&&r.renderDisplayObject(e,t,r.context,_w(r,jw)[jw],n)}),t.restore(),r.renderQueue.forEach(function(t){r.saveDirtyAABB(t)}),r.renderQueue=[]}_w(r,jw)[jw].restoreStack.forEach(function(){t.restore()}),_w(r,jw)[jw].restoreStack=[]}else r.clearFullScreenLastFrame=!0}),s.hooks.render.tap(t.tag,function(t){r.clearFullScreen||r.renderQueue.push(t)})}},{key:"clearRect",value:function(t,e,n,r,i,o){t.clearRect(e,n,r,i),o&&(t.fillStyle=o,t.fillRect(e,n,r,i))}},{key:"renderDisplayObjectOptimized",value:function(t,e,n,r,i){var o=t.nodeName,A=!1,s=this.context.styleRendererFactory[o],a=this.pathGeneratorFactory[o],c=t.parsedStyle.clipPath;if(c){(!r.prevObject||!it(c.getWorldTransform(),r.prevObject.getWorldTransform()))&&(this.applyWorldTransform(e,c),r.prevObject=null);var l=this.pathGeneratorFactory[c.nodeName];l&&(e.save(),A=!0,e.beginPath(),l(e,c.parsedStyle),e.closePath(),e.clip())}if(s){(!r.prevObject||!it(t.getWorldTransform(),r.prevObject.getWorldTransform()))&&this.applyWorldTransform(e,t);var u=!r.prevObject;if(!u){var h=r.prevObject.nodeName;u=o===cr.TEXT?h!==cr.TEXT:o===cr.IMAGE?h!==cr.IMAGE:h===cr.TEXT||h===cr.IMAGE}s.applyStyleToContext(e,t,u,r),r.prevObject=t}a&&(e.beginPath(),a(e,t.parsedStyle),o!==cr.LINE&&o!==cr.PATH&&o!==cr.POLYLINE&&e.closePath()),s&&s.drawToContext(e,t,_w(this,jw)[jw],this,i),A&&e.restore(),t.dirty(!1)}},{key:"renderDisplayObject",value:function(t,e,n,r,i){var o=t.nodeName,A=r.restoreStack[r.restoreStack.length-1];!A||t.compareDocumentPosition(A)&Ys.DOCUMENT_POSITION_CONTAINS||(e.restore(),r.restoreStack.pop());var s=this.context.styleRendererFactory[o],a=this.pathGeneratorFactory[o],c=t.parsedStyle.clipPath;if(c){this.applyWorldTransform(e,c);var l=this.pathGeneratorFactory[c.nodeName];l&&(e.save(),r.restoreStack.push(t),e.beginPath(),l(e,c.parsedStyle),e.closePath(),e.clip())}s&&(this.applyWorldTransform(e,t),e.save(),this.applyAttributesToContext(e,t)),a&&(e.beginPath(),a(e,t.parsedStyle),o!==cr.LINE&&o!==cr.PATH&&o!==cr.POLYLINE&&e.closePath()),s&&(s.render(e,t.parsedStyle,t,n,this,i),e.restore()),t.dirty(!1)}},{key:"applyAttributesToContext",value:function(t,e){var n=e.parsedStyle,r=n.stroke,i=n.fill,o=n.opacity,A=n.lineDash,s=n.lineDashOffset;A&&t.setLineDash(A),Kt(s)||(t.lineDashOffset=s),Kt(o)||(t.globalAlpha*=o),Kt(r)||Array.isArray(r)||r.isNone||(t.strokeStyle=e.attributes.stroke),Kt(i)||Array.isArray(i)||i.isNone||(t.fillStyle=e.attributes.fill)}},{key:"convertAABB2Rect",value:function(t){var e=t.getMin(),n=t.getMax(),r=Math.floor(e[0]),i=Math.floor(e[1]);return{x:r,y:i,width:Math.ceil(n[0])-r,height:Math.ceil(n[1])-i}}},{key:"mergeDirtyAABBs",value:function(t){var e=new yr;return t.forEach(function(t){var n=t.getRenderBounds();e.add(n);var r=t.renderable.dirtyRenderBounds;r&&e.add(r)}),e}},{key:"saveDirtyAABB",value:function(t){var e=t.renderable;e.dirtyRenderBounds||(e.dirtyRenderBounds=new yr);var n=t.getRenderBounds();n&&e.dirtyRenderBounds.update(n.center,n.halfExtents)}},{key:"applyWorldTransform",value:function(t,e,n){n?(F(this.tmpMat4,e.getLocalTransform()),O(this.tmpMat4,n,this.tmpMat4),O(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(F(this.tmpMat4,e.getWorldTransform()),O(this.tmpMat4,this.vpMatrix,this.tmpMat4)),t.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var t=new yr,e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return n.forEach(function(e){t.add(e)}),t}}])}();function Vw(t,e,n,r,i,o,A){var s,a;if("rect"===t.image.nodeName){var c=t.image.parsedStyle,l=c.width,u=c.height;a=r.contextService.getDPR();var h=r.config.offscreenCanvas;(s=o.offscreenCanvasCreator.getOrCreateCanvas(h)).width=l*a,s.height=u*a;var d=o.offscreenCanvasCreator.getOrCreateContext(h),f={restoreStack:[],prevObject:null,currentContext:new Map};t.image.forEach(function(t){i.renderDisplayObject(t,d,r,f,o)}),f.restoreStack.forEach(function(){d.restore()})}return A.getOrCreatePatternSync(e,t,n,s,a,e.getGeometryBounds().min,function(){e.dirty(),r.renderingService.dirty()})}function Ww(t,e,n,r){var i;if(t.type===Xi.LinearGradient||t.type===Xi.RadialGradient){var A=e.getGeometryBounds(),s=A&&2*A.halfExtents[0]||1,a=A&&2*A.halfExtents[1]||1,c=A&&A.min||[0,0];i=r.getOrCreateGradient(o(o({type:t.type},t.value),{},{min:c,width:s,height:a}),n)}return i}zw.tag="CanvasRenderer";var Yw=["shadowBlur","shadowOffsetX","shadowOffsetY"],Xw=["lineCap","lineJoin","miterLimit"],qw={globalAlpha:1,shadowBlur:0,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"#000",filter:"none",globalCompositeOperation:"source-over",strokeStyle:"#000",strokeOpacity:1,lineWidth:1,lineDash:[],lineDashOffset:0,lineCap:"butt",lineJoin:"miter",miterLimit:10,fillStyle:"#000",fillOpacity:1},$w={};function Zw(t,e,n,r){var i=r.has(e)?r.get(e):qw[e];return i!==n&&("lineDash"===e?t.setLineDash(n):t[e]=n,r.set(e,n)),i}var Jw=function(){return a(function t(e){A(this,t),this.imagePool=e},[{key:"applyAttributesToContext",value:function(t,e){}},{key:"render",value:function(t,e,n,r,i,o){}},{key:"applyCommonStyleToContext",value:function(t,e,n,r){var i=n?$w:r.prevObject.parsedStyle,o=e.parsedStyle;(n||o.opacity!==i.opacity)&&Zw(t,"globalAlpha",Kt(o.opacity)?qw.globalAlpha:o.opacity,r.currentContext),(n||o.blend!==i.blend)&&Zw(t,"globalCompositeOperation",Kt(o.blend)?qw.globalCompositeOperation:o.blend,r.currentContext)}},{key:"applyStrokeFillStyleToContext",value:function(t,e,n,r){var i=n?$w:r.prevObject.parsedStyle,o=e.parsedStyle,A=o.lineWidth,s=void 0===A?qw.lineWidth:A,a=o.fill&&!o.fill.isNone;if(o.stroke&&!o.stroke.isNone&&s>0){if(n||e.attributes.stroke!==r.prevObject.attributes.stroke)Zw(t,"strokeStyle",Kt(o.stroke)||Array.isArray(o.stroke)||o.stroke.isNone?qw.strokeStyle:e.attributes.stroke,r.currentContext);(n||o.lineWidth!==i.lineWidth)&&Zw(t,"lineWidth",Kt(o.lineWidth)?qw.lineWidth:o.lineWidth,r.currentContext),(n||o.lineDash!==i.lineDash)&&Zw(t,"lineDash",o.lineDash||qw.lineDash,r.currentContext),(n||o.lineDashOffset!==i.lineDashOffset)&&Zw(t,"lineDashOffset",Kt(o.lineDashOffset)?qw.lineDashOffset:o.lineDashOffset,r.currentContext);for(var c=0;c<Xw.length;c++){var l=Xw[c];(n||o[l]!==i[l])&&Zw(t,l,Kt(o[l])?qw[l]:o[l],r.currentContext)}}a&&(n||e.attributes.fill!==r.prevObject.attributes.fill)&&Zw(t,"fillStyle",Kt(o.fill)||Array.isArray(o.fill)||o.fill.isNone?qw.fillStyle:e.attributes.fill,r.currentContext)}},{key:"applyStyleToContext",value:function(t,e,n,r){var i=e.nodeName;this.applyCommonStyleToContext(t,e,n,r),i===cr.IMAGE||this.applyStrokeFillStyleToContext(t,e,n,r)}},{key:"applyShadowAndFilterStyleToContext",value:function(t,e,n,r){var i=e.parsedStyle;if(n){Zw(t,"shadowColor",i.shadowColor.toString(),r.currentContext);for(var o=0;o<Yw.length;o++){var A=Yw[o];Zw(t,A,i[A]||qw[A],r.currentContext)}}i.filter&&i.filter.length&&Zw(t,"filter",e.attributes.filter,r.currentContext)}},{key:"clearShadowAndFilterStyleForContext",value:function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(e){Zw(t,"shadowColor",qw.shadowColor,r.currentContext);for(var o=0;o<Yw.length;o++){var A=Yw[o];Zw(t,A,qw[A],r.currentContext)}}if(n)if(e&&i){var s=t.filter;!Kt(s)&&s.indexOf("drop-shadow")>-1&&Zw(t,"filter",s.replace(/drop-shadow\([^)]*\)/,"").trim()||qw.filter,r.currentContext)}else Zw(t,"filter",qw.filter,r.currentContext)}},{key:"fillToContext",value:function(t,e,n,r,i){var o=this,A=e.parsedStyle,s=A.fill,a=A.fillRule,c=null;if(Array.isArray(s)&&s.length>0)s.forEach(function(r){var i=Zw(t,"fillStyle",Ww(r,e,t,o.imagePool),n.currentContext);c=null!=c?c:i,a?t.fill(a):t.fill()});else{if(wo(s)){var l=Vw(s,e,t,e.ownerDocument.defaultView.context,r,i,this.imagePool);l&&(t.fillStyle=l,c=!0)}a?t.fill(a):t.fill()}null!==c&&Zw(t,"fillStyle",c,n.currentContext)}},{key:"strokeToContext",value:function(t,e,n,r,i){var o=this,A=e.parsedStyle.stroke,s=null;if(Array.isArray(A)&&A.length>0)A.forEach(function(r){var i=Zw(t,"strokeStyle",Ww(r,e,t,o.imagePool),n.currentContext);s=null!=s?s:i,t.stroke()});else{if(wo(A)){var a=Vw(A,e,t,e.ownerDocument.defaultView.context,r,i,this.imagePool);if(a){var c=Zw(t,"strokeStyle",a,n.currentContext);s=null!=s?s:c}}t.stroke()}null!==s&&Zw(t,"strokeStyle",s,n.currentContext)}},{key:"drawToContext",value:function(t,e,n,r,i){var o,A=e.nodeName,s=e.parsedStyle,a=s.opacity,c=void 0===a?qw.globalAlpha:a,l=s.fillOpacity,u=void 0===l?qw.fillOpacity:l,h=s.strokeOpacity,d=void 0===h?qw.strokeOpacity:h,f=s.lineWidth,g=void 0===f?qw.lineWidth:f,p=s.fill&&!s.fill.isNone,v=s.stroke&&!s.stroke.isNone&&g>0;if(p||v){var m=!Kt(s.shadowColor)&&s.shadowBlur>0,y="inner"===s.shadowType,w=0===(null===(o=s.fill)||void 0===o?void 0:o.alpha),b=!(!s.filter||!s.filter.length),B=m&&v&&(A===cr.PATH||A===cr.LINE||A===cr.POLYLINE||w||y),E=null;if(p)B||this.applyShadowAndFilterStyleToContext(t,e,m,n),E=Zw(t,"globalAlpha",c*u,n.currentContext),this.fillToContext(t,e,n,r,i),B||this.clearShadowAndFilterStyleForContext(t,m,b,n);if(v){var x=!1,C=Zw(t,"globalAlpha",c*d,n.currentContext);if(E=p?E:C,B&&(this.applyShadowAndFilterStyleToContext(t,e,m,n),x=!0,y)){var M=t.globalCompositeOperation;t.globalCompositeOperation="source-atop",this.strokeToContext(t,e,n,r,i),t.globalCompositeOperation=M,this.clearShadowAndFilterStyleForContext(t,m,b,n,!0)}this.strokeToContext(t,e,n,r,i),x&&this.clearShadowAndFilterStyleForContext(t,m,b,n)}null!==E&&Zw(t,"globalAlpha",E,n.currentContext)}}}])}(),tb=function(t){function e(){return A(this,e),g(this,e,arguments)}return v(e,t),a(e,[{key:"render",value:function(t,e,n,r,i,o){var A=e.fill,s=e.fillRule,a=e.opacity,c=void 0===a?1:a,l=e.fillOpacity,u=void 0===l?1:l,h=e.stroke,d=e.strokeOpacity,f=void 0===d?1:d,g=e.lineWidth,p=void 0===g?1:g,v=e.lineCap,m=e.lineJoin,y=e.shadowType,w=e.shadowColor,b=e.shadowBlur,B=e.filter,E=e.miterLimit,x=A&&!A.isNone,C=h&&!h.isNone&&p>0,M=0===(null==A?void 0:A.alpha),F=!(!B||!B.length),k=!Kt(w)&&b>0,S=n.nodeName,Q="inner"===y,U=C&&k&&(S===cr.PATH||S===cr.LINE||S===cr.POLYLINE||M||Q);x&&(t.globalAlpha=c*u,U||eb(n,t,k),nb(t,n,A,s,r,i,o,this.imagePool),U||this.clearShadowAndFilter(t,F,k)),C&&(t.globalAlpha=c*f,t.lineWidth=p,Kt(E)||(t.miterLimit=E),Kt(v)||(t.lineCap=v),Kt(m)||(t.lineJoin=m),U&&(Q&&(t.globalCompositeOperation="source-atop"),eb(n,t,!0),Q&&(rb(t,n,h,r,i,o,this.imagePool),t.globalCompositeOperation=qw.globalCompositeOperation,this.clearShadowAndFilter(t,F,!0))),rb(t,n,h,r,i,o,this.imagePool))}},{key:"clearShadowAndFilter",value:function(t,e,n){if(n&&(t.shadowColor="transparent",t.shadowBlur=0),e){var r=t.filter;!Kt(r)&&r.indexOf("drop-shadow")>-1&&(t.filter=r.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(Jw);function eb(t,e,n){var r=t.parsedStyle,i=r.filter,o=r.shadowColor,A=r.shadowBlur,s=r.shadowOffsetX,a=r.shadowOffsetY;i&&i.length&&(e.filter=t.style.filter),n&&(e.shadowColor=o.toString(),e.shadowBlur=A||0,e.shadowOffsetX=s||0,e.shadowOffsetY=a||0)}function nb(t,e,n,r,i,o,A,s){var a=arguments.length>8&&void 0!==arguments[8]&&arguments[8];Array.isArray(n)?n.forEach(function(n){t.fillStyle=Ww(n,e,t,s),a||(r?t.fill(r):t.fill())}):(wo(n)&&(t.fillStyle=Vw(n,e,t,i,o,A,s)),a||(r?t.fill(r):t.fill()))}function rb(t,e,n,r,i,o,A){var s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];Array.isArray(n)?n.forEach(function(n){t.strokeStyle=Ww(n,e,t,A),s||t.stroke()}):(wo(n)&&(t.strokeStyle=Vw(n,e,t,r,i,o,A)),s||t.stroke())}var ib=function(t){function e(){return A(this,e),g(this,e,arguments)}return v(e,t),a(e,[{key:"renderDownSampled",value:function(t,e,n,r){var i=r.src,o=r.imageCache;o.downSampled?t.drawImage(o.downSampled,Math.floor(r.drawRect[0]),Math.floor(r.drawRect[1]),Math.ceil(r.drawRect[2]),Math.ceil(r.drawRect[3])):this.imagePool.createDownSampledImage(i,n).then(function(){n.ownerDocument&&(n.dirty(),n.ownerDocument.defaultView.context.renderingService.dirty())}).catch(function(t){console.error(t)})}},{key:"renderTile",value:function(t,e,n,r){var i=r.src,o=r.imageCache,A=r.imageRect,s=r.drawRect,a=o.size,c=t.getTransform(),l=c.a,u=c.b,h=c.c,d=c.d,f=c.e,g=c.f;if(t.resetTransform(),null!=o&&o.gridSize){for(var p=[a[0]/A[2],a[1]/A[3]],v=[o.tileSize[0]/p[0],o.tileSize[1]/p[1]],m=[Math.floor((s[0]-A[0])/v[0]),Math.ceil((s[0]+s[2]-A[0])/v[0])],y=m[0],w=m[1],b=[Math.floor((s[1]-A[1])/v[1]),Math.ceil((s[1]+s[3]-A[1])/v[1])],B=b[1],E=b[0];E<=B;E++)for(var x=y;x<=w;x++){var C=o.tiles[E][x];if(C){var M=[Math.floor(A[0]+C.tileX*v[0]),Math.floor(A[1]+C.tileY*v[1]),Math.ceil(v[0]),Math.ceil(v[1])];t.drawImage(C.data,M[0],M[1],M[2],M[3])}}t.setTransform(l,u,h,d,f,g)}else this.imagePool.createImageTiles(i,[],function(){n.ownerDocument&&(n.dirty(),n.ownerDocument.defaultView.context.renderingService.dirty())},n).catch(function(t){console.error(t)})}},{key:"render",value:function(t,n,r){var i=n.x,o=void 0===i?0:i,A=n.y,s=void 0===A?0:A,a=n.width,c=n.height,l=n.src,u=n.shadowColor,h=n.shadowBlur,d=this.imagePool.getImageSync(l,r),f=null==d?void 0:d.img,g=a,p=c;if(f){var v,y,w,b,B,E,x,C,M,F,S,Q,U,N,T;g||(g=f.width),p||(p=f.height),eb(r,t,!Kt(u)&&h>0);try{var O=r.ownerDocument.defaultView.getContextService().getDomElement(),I=O.width,L=O.height,P=t.getTransform(),D=P.a,R=P.b,H=function(t,e){var n=bt(at(),[t[0],t[1],0],e),r=bt(at(),[t[0]+t[2],t[1],0],e),i=bt(at(),[t[0],t[1]+t[3],0],e),o=bt(at(),[t[0]+t[2],t[1]+t[3],0],e);return[Math.min(n[0],r[0],i[0],o[0]),Math.min(n[1],r[1],i[1],o[1]),Math.max(n[0],r[0],i[0],o[0])-Math.min(n[0],r[0],i[0],o[0]),Math.max(n[1],r[1],i[1],o[1])-Math.min(n[1],r[1],i[1],o[1])]}([o,s,g,p],k(D,P.c,0,0,R,P.d,0,0,0,0,1,0,P.e,P.f,0,1)),_=(v=H,y=m([0,0,I,L],4),w=y[0],b=y[1],B=y[2],E=y[3],x=m(v,4),C=x[0],M=x[1],F=x[2],S=x[3],Q=Math.max(w,C),U=Math.max(b,M),N=Math.min(w+B,C+F),T=Math.min(b+E,M+S),N<=Q||T<=U?null:[Q,U,N-Q,T-U]);if(!_)return;if(!r.ownerDocument.defaultView.getConfig().enableLargeImageOptimization)return void e.renderFull(t,n,r,{image:f,drawRect:[o,s,g,p]});if(H[2]/d.size[0]<(d.downSamplingRate||.5))return void this.renderDownSampled(t,n,r,{src:l,imageCache:d,drawRect:[o,s,g,p]});if(!ImagePool.isSupportTile)return void e.renderFull(t,n,r,{image:f,drawRect:[o,s,g,p]});this.renderTile(t,n,r,{src:l,imageCache:d,imageRect:H,drawRect:_})}catch(t){}}}},{key:"drawToContext",value:function(t,e,n,r,i){this.render(t,e.parsedStyle,e)}}],[{key:"renderFull",value:function(t,e,n,r){t.drawImage(r.image,Math.floor(r.drawRect[0]),Math.floor(r.drawRect[1]),Math.ceil(r.drawRect[2]),Math.ceil(r.drawRect[3]))}}])}(tb),ob=function(t){function e(){return A(this,e),g(this,e,arguments)}return v(e,t),a(e,[{key:"render",value:function(t,e,n,r,i,o){n.getBounds();var A=e.lineWidth,s=void 0===A?1:A,a=e.textAlign,c=void 0===a?"start":a,l=e.textBaseline,u=void 0===l?"alphabetic":l,h=e.lineJoin,d=void 0===h?"miter":h,f=e.miterLimit,g=void 0===f?10:f,p=e.letterSpacing,v=void 0===p?0:p,m=e.stroke,y=e.fill,w=e.fillRule,b=e.fillOpacity,B=void 0===b?1:b,E=e.strokeOpacity,x=void 0===E?1:E,C=e.opacity,M=void 0===C?1:C,F=e.metrics,k=e.x,S=void 0===k?0:k,Q=e.y,U=void 0===Q?0:Q,N=e.dx,T=e.dy,O=e.shadowColor,I=e.shadowBlur,L=e.textDecorationLine,P=F.font,D=F.lines,R=F.height,H=F.lineHeight,_=F.lineMetrics;t.font=P,t.lineWidth=s,t.textAlign="middle"===c?"center":c;var G=u;"alphabetic"===G&&(G="bottom"),t.lineJoin=d,Kt(g)||(t.miterLimit=g);var K=U;"middle"===u?K+=-R/2-H/2:"bottom"===u||"alphabetic"===u||"ideographic"===u?K+=-R:"top"!==u&&"hanging"!==u||(K+=-H);var j=S+(N||0);K+=T||0,1===D.length&&("bottom"===G?(G="middle",K-=.5*R):"top"===G&&(G="middle",K+=.5*R)),t.textBaseline=G,eb(n,t,!Kt(O)&&I>0);for(var z=0;z<D.length;z++){var V=s/2+j;K+=H,Kt(m)||m.isNone||!s||this.drawLetterSpacing(t,n,D[z],_[z],c,V,K,v,y,w,B,m,x,M,!0,r,i,o),Kt(y)||this.drawLetterSpacing(t,n,D[z],_[z],c,V,K,v,y,w,B,m,x,M,!1,r,i,o)}L&&"none"!==L&&this.drawTextDecorations(t,e,n,D,H,j,U+(T||0),r,i,o)}},{key:"drawLetterSpacing",value:function(t,e,n,r,i,o,A,s,a,c,l,u,h,d,f,g,p,v){if(0!==s){var m=t.textAlign;t.textAlign="left";var y=o;"center"===i||"middle"===i?y=o-r.width/2:"right"!==i&&"end"!==i||(y=o-r.width);for(var w=Array.from(n),b=t.measureText(n).width,B=0,E=0;E<w.length;++E){var x=w[E];f?this.strokeText(t,e,x,y,A,u,h,g,p,v):this.fillText(t,e,x,y,A,a,c,l,d,g,p,v),y+=b-(B=t.measureText(n.substring(E+1)).width)+s,b=B}t.textAlign=m}else f?this.strokeText(t,e,n,o,A,u,h,g,p,v):this.fillText(t,e,n,o,A,a,c,l,d,g,p,v)}},{key:"fillText",value:function(t,e,n,r,i,o,A,s,a,c,l,u){var h;nb(t,e,o,A,c,l,u,this.imagePool,!0);var d=!Kt(s)&&1!==s;d&&(h=t.globalAlpha,t.globalAlpha=s*a),t.fillText(n,r,i),d&&(t.globalAlpha=h)}},{key:"strokeText",value:function(t,e,n,r,i,o,A,s,a,c){var l;rb(t,e,o,s,a,c,this.imagePool,!0);var u=!Kt(A)&&1!==A;u&&(l=t.globalAlpha,t.globalAlpha=A),t.strokeText(n,r,i),u&&(t.globalAlpha=l)}},{key:"drawTextDecorations",value:function(t,e,n,r,i,o,A,s,a,c){var l=e.textDecorationLine,u=e.textDecorationColor,h=e.textDecorationStyle,d=e.textDecorationThickness,f=void 0===d?1:d,g=e.textAlign,p=void 0===g?"start":g,v=e.lineWidth,m=void 0===v?1:v,y=e.metrics;if(l&&"none"!==l){var w=y.lineMetrics,b=l.split(" ");switch(t.lineWidth=f,u&&(t.strokeStyle="rgba(".concat(u.r,", ").concat(u.g,", ").concat(u.b,", ").concat(u.alpha,")")),h){case"dashed":t.setLineDash([5,5]);break;case"dotted":t.setLineDash([2,2]);break;default:t.setLineDash([])}var B=A,E=e.textBaseline,x=void 0===E?"alphabetic":E;"middle"===x?B+=-y.height/2-i/2:"bottom"===x||"alphabetic"===x||"ideographic"===x?B+=-y.height:"top"!==x&&"hanging"!==x||(B+=-i);for(var C=0;C<r.length;C++){B+=i;var M=w[C];if(M){var F=m/2,k=o,S=o+M.width;"center"===p||"middle"===p?(k=o-M.width/2,S=o+M.width/2):"right"!==p&&"end"!==p||(k=o-M.width,S=o),k+=F,S+=F;var Q,U=sr(b);try{for(U.s();!(Q=U.n()).done;){var N=Q.value,T=B;switch(N){case"underline":T+=2;break;case"overline":T-=i-2;break;case"line-through":T-=i/2;break;default:continue}"wavy"===h?this.drawWavyLine(t,k,S,T):(t.beginPath(),t.moveTo(k,T),t.lineTo(S,T),t.stroke())}}catch(t){U.e(t)}finally{U.f()}}}t.setLineDash([])}}},{key:"drawWavyLine",value:function(t,e,n,r){var i=10,o=Math.floor((n-e)/i);t.beginPath(),t.moveTo(e,r);for(var A=0;A<o;A++){var s=e+A*i+2.5,a=r+2,c=e+A*i+5,l=r;t.quadraticCurveTo(s,a,c,l);var u=e+A*i+7.5,h=r-2,d=e+(A+1)*i,f=r;t.quadraticCurveTo(u,h,d,f)}t.stroke()}},{key:"drawToContext",value:function(t,e,n,r,i){this.render(t,e.parsedStyle,e,e.ownerDocument.defaultView.context,r,i)}}])}(tb),Ab=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),(t=g(this,e)).name="canvas-renderer",t.options=n,t}return v(e,t),a(e,[{key:"init",value:function(){var t,e=o({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),n=this.context.imagePool,i=new tb(n),A=(r(r(r(r(r(r(r(r(r(r(t={},cr.CIRCLE,i),cr.ELLIPSE,i),cr.RECT,i),cr.IMAGE,new ib(n)),cr.TEXT,new ob(n)),cr.LINE,i),cr.POLYLINE,i),cr.POLYGON,i),cr.PATH,i),cr.GROUP,void 0),r(r(r(t,cr.HTML,void 0),cr.MESH,void 0),cr.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=A,this.context.styleRendererFactory=A,this.addRenderingPlugin(new zw(e))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(ur),sb=at(),ab=at(),cb=at(),lb=C(),ub=function(){function t(){var e=this;A(this,t),this.isHit=function(t,n,r,i){var o=e.context.pointInPathPickerFactory[t.nodeName];if(o){var A=N(lb,r),s=bt(ab,dt(cb,n[0],n[1],0),A);if(o(t,new Er(s[0],s[1]),i,e.isPointInPath,e.context,e.runtime))return!0}return!1},this.isPointInPath=function(t,n){var r=e.runtime.offscreenCanvasCreator.getOrCreateContext(e.context.config.offscreenCanvas),i=e.context.pathGeneratorFactory[t.nodeName];return i&&(r.beginPath(),i(r,t.parsedStyle),r.closePath()),r.isPointInPath(n.x,n.y)}}return a(t,[{key:"apply",value:function(e,n){var r,i=this,o=e.renderingService,A=e.renderingContext;this.context=e,this.runtime=n;var s=null===(r=A.root)||void 0===r?void 0:r.ownerDocument;o.hooks.pick.tapPromise(t.tag,function(){var t=Ar(ir().mark(function t(e){return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",i.pick(s,e));case 1:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()),o.hooks.pickSync.tap(t.tag,function(t){return i.pick(s,t)})}},{key:"pick",value:function(t,e){var n,r=e.topmost,i=e.position,o=i.x,A=i.y,s=dt(sb,o,A,0),a=[],c=sr(t.elementsFromBBox(s[0],s[1],s[0],s[1]));try{for(c.s();!(n=c.n()).done;){var l=n.value,u=l.getWorldTransform();if(this.isHit(l,s,u,!1)){var h=qA(l);if(h){var d=h.parsedStyle.clipPath;if(this.isHit(d,s,d.getWorldTransform(),!0)){if(r)return e.picked=[l],e;a.push(l)}}else{if(r)return e.picked=[l],e;a.push(l)}}}}catch(t){c.e(t)}finally{c.f()}return e.picked=a,e}}])}();function hb(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,A=r.cy,s=void 0===A?0:A,a=r.r,c=r.fill,l=r.stroke,u=r.lineWidth,h=void 0===u?1:u,d=r.increasedLineWidthForHitTesting,f=void 0===d?0:d,g=r.pointerEvents,p=void 0===g?"auto":g,v=(h+f)/2,y=Nn(o,s,e.x,e.y),w=m(es(p,c,l),2),b=w[0],B=w[1];return b&&B||n?y<=a+v:b?y<=a:!!B&&(y>=a-v&&y<=a+v)}function db(t,e,n,r){return t/(n*n)+e/(r*r)}function fb(t,e,n){var r=t.parsedStyle,i=r.cx,o=void 0===i?0:i,A=r.cy,s=void 0===A?0:A,a=r.rx,c=r.ry,l=r.fill,u=r.stroke,h=r.lineWidth,d=void 0===h?1:h,f=r.increasedLineWidthForHitTesting,g=void 0===f?0:f,p=r.pointerEvents,v=void 0===p?"auto":p,y=e.x,w=e.y,b=m(es(v,l,u),2),B=b[0],E=b[1],x=(d+g)/2,C=(y-o)*(y-o),M=(w-s)*(w-s);return B&&E||n?db(C,M,a+x,c+x)<=1:B?db(C,M,a,c)<=1:!!E&&(db(C,M,a-x,c-x)>=1&&db(C,M,a+x,c+x)<=1)}function gb(t,e,n,r,i,o){return i>=t&&i<=t+n&&o>=e&&o<=e+r}function pb(t,e,n,r,i,o,A,s){var a=(Math.atan2(s-e,A-t)+2*Math.PI)%(2*Math.PI),c={x:t+n*Math.cos(a),y:e+n*Math.sin(a)};return Nn(c.x,c.y,A,s)<=o/2}function vb(t,e,n,r,i,o,A){var s=Math.min(t,n),a=Math.max(t,n),c=Math.min(e,r),l=Math.max(e,r),u=i/2;return o>=s-u&&o<=a+u&&A>=c-u&&A<=l+u&&Hn(t,e,n,r,o,A)<=i/2}function mb(t,e,n,r,i){var o=t.length;if(o<2)return!1;for(var A=0;A<o-1;A++){if(vb(t[A][0],t[A][1],t[A+1][0],t[A+1][1],e,n,r))return!0}if(i){var s=t[0],a=t[o-1];if(vb(s[0],s[1],a[0],a[1],e,n,r))return!0}return!1}ub.tag="CanvasPicker";function yb(t){return Math.abs(t)<1e-6?0:t<0?-1:1}function wb(t,e,n){return(n[0]-t[0])*(e[1]-t[1])===(e[0]-t[0])*(n[1]-t[1])&&Math.min(t[0],e[0])<=n[0]&&n[0]<=Math.max(t[0],e[0])&&Math.min(t[1],e[1])<=n[1]&&n[1]<=Math.max(t[1],e[1])}function bb(t,e,n){var r=!1,i=t.length;if(i<=2)return!1;for(var o=0;o<i;o++){var A=t[o],s=t[(o+1)%i];if(wb(A,s,[e,n]))return!0;yb(A[1]-n)>0!=yb(s[1]-n)>0&&yb(e-(n-A[1])*(A[0]-s[0])/(A[1]-s[1])-A[0])<0&&(r=!r)}return r}function Bb(t,e,n){for(var r=!1,i=0;i<t.length;i++){if(r=bb(t[i],e,n))break}return r}function Eb(t,e,n){var r=t.parsedStyle,i=r.x1,o=r.y1,A=r.x2,s=r.y2,a=r.lineWidth,c=void 0===a?1:a,l=r.increasedLineWidthForHitTesting,u=void 0===l?0:l,h=r.pointerEvents;return!(!m(es(void 0===h?"auto":h,r.fill,r.stroke),2)[1]&&!n||!c)&&vb(i,o,A,s,c+u,e.x,e.y)}function xb(t,e,n,r,i,o){var A=t.parsedStyle,s=A.lineWidth,a=void 0===s?1:s,c=A.increasedLineWidthForHitTesting,l=void 0===c?0:c,u=A.stroke,h=A.fill,d=A.d,f=A.pointerEvents,g=void 0===f?"auto":f,p=d.segments,v=d.hasArc,y=d.polylines,w=d.polygons,b=m(es(g,(null==w?void 0:w.length)&&h,u),2),B=b[0],E=b[1],x=Go(t),C=!1;return B||n?C=v?r(t,e):Bb(w,e.x,e.y)||Bb(y,e.x,e.y):((E||n)&&(C=function(t,e,n,r,i){for(var o=!1,A=e/2,s=0;s<t.length;s++){var a=t[s],c=a.currentPoint,l=a.params,u=a.prePoint,h=a.box;if(!h||gb(h.x-A,h.y-A,h.width+e,h.height+e,n,r))switch(a.command){case"L":case"Z":if(o=vb(u[0],u[1],c[0],c[1],e,n,r))return!0;break;case"Q":if(o=Xn(u[0],u[1],l[1],l[2],l[3],l[4],n,r)<=e/2)return!0;break;case"C":if(o=jn(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6],n,r,i)<=e/2)return!0;break;case"A":a.cubicParams||(a.cubicParams=ln(u[0],u[1],l[1],l[2],l[3],l[4],l[5],l[6],l[7],void 0));for(var d=a.cubicParams,f=u,g=0;g<d.length;g+=6){var p=jn(f[0],f[1],d[g],d[g+1],d[g+2],d[g+3],d[g+4],d[g+5],n,r,i);if(f=[d[g+4],d[g+5]],o=p<=e/2)return!0}}}return o}(p,a+l,e.x,e.y,x)),C)}function Cb(t,e,n){var r=t.parsedStyle,i=r.stroke,o=r.fill,A=r.lineWidth,s=void 0===A?1:A,a=r.increasedLineWidthForHitTesting,c=void 0===a?0:a,l=r.points,u=r.pointerEvents,h=m(es(void 0===u?"auto":u,o,i),2),d=h[0],f=!1;return(h[1]||n)&&(f=mb(l.points,s+c,e.x,e.y,!0)),f||!d&&!n||(f=bb(l.points,e.x,e.y)),f}function Mb(t,e,n){var r=t.parsedStyle,i=r.lineWidth,o=void 0===i?1:i,A=r.increasedLineWidthForHitTesting,s=void 0===A?0:A,a=r.points,c=r.pointerEvents;return!(!m(es(void 0===c?"auto":c,r.fill,r.stroke),2)[1]&&!n||!o)&&mb(a.points,o+s,e.x,e.y,!1)}function Fb(t,e,n,r,i){var o=t.parsedStyle,A=o.radius,s=o.fill,a=o.stroke,c=o.lineWidth,l=void 0===c?1:c,u=o.increasedLineWidthForHitTesting,h=void 0===u?0:u,d=o.x,f=void 0===d?0:d,g=o.y,p=void 0===g?0:g,v=o.width,y=o.height,w=o.pointerEvents,b=m(es(void 0===w?"auto":w,s,a),2),B=b[0],E=b[1],x=A&&A.some(function(t){return 0!==t}),C=l+h;if(x){var M=!1;return(E||n)&&(M=function(t,e,n,r,i,o,A,s){var a=m(i,4),c=a[0],l=a[1],u=a[2],h=a[3];return vb(t+c,e,t+n-l,e,o,A,s)||vb(t+n,e+l,t+n,e+r-u,o,A,s)||vb(t+n-u,e+r,t+h,e+r,o,A,s)||vb(t,e+r-h,t,e+c,o,A,s)||pb(t+n-l,e+l,l,Math.PI,Math.PI,o,A,s)||pb(t+n-u,e+r-u,u,0,Math.PI,o,A,s)||pb(t+h,e+r-h,h,Math.PI,Math.PI,o,A,s)||pb(t+c,e+c,c,Math.PI,Math.PI,o,A,s)}(f,p,v,y,A.map(function(t){return ne(t,0,Math.min(Math.abs(v)/2,Math.abs(y)/2))}),C,e.x,e.y)),M||!B&&!n||(M=r(t,e)),M}var F=C/2;return B&&E||n?gb(f-F,p-F,v+F,y+F,e.x,e.y):B?gb(f,p,v,y,e.x,e.y):!!E&&function(t,e,n,r,i,o,A){var s=i/2;return gb(t-s,e-s,n,i,o,A)||gb(t+n-s,e-s,i,r,o,A)||gb(t+s,e+r-s,n,i,o,A)||gb(t-s,e+s,i,r,o,A)}(f,p,v,y,C,e.x,e.y)}function kb(t,e,n,r,i,A){var s=t.parsedStyle,a=s.pointerEvents,c=void 0===a?"auto":a,l=s.x,u=void 0===l?0:l,h=s.y,d=void 0===h?0:h,f=s.width,g=s.height;if("non-transparent-pixel"===c){var p=i.config.offscreenCanvas,v=A.offscreenCanvasCreator.getOrCreateCanvas(p),m=A.offscreenCanvasCreator.getOrCreateContext(p,{willReadFrequently:!0});return v.width=f,v.height=g,i.defaultStyleRendererFactory[cr.IMAGE].render(m,o(o({},t.parsedStyle),{},{x:0,y:0}),t,void 0,void 0,void 0),m.getImageData(e.x-u,e.y-d,1,1).data.every(function(t){return 0!==t})}return!0}function Sb(t,e,n,r){var i=t.getGeometryBounds();return e.x>=i.min[0]&&e.y>=i.min[1]&&e.x<=i.max[0]&&e.y<=i.max[1]}var Qb=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).name="canvas-picker",t}return v(e,t),a(e,[{key:"init",value:function(){var t,e=(r(r(r(r(r(r(r(r(r(r(t={},cr.CIRCLE,hb),cr.ELLIPSE,fb),cr.RECT,Fb),cr.LINE,Eb),cr.POLYLINE,Mb),cr.POLYGON,Cb),cr.PATH,xb),cr.TEXT,Sb),cr.GROUP,null),cr.IMAGE,kb),r(r(t,cr.HTML,null),cr.MESH,null));this.context.pointInPathPickerFactory=e,this.addRenderingPlugin(new ub)}},{key:"destroy",value:function(){delete this.context.pointInPathPickerFactory,this.removeAllRenderingPlugins()}}])}(ur);function Ub(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,A=e.r;t.arc(r,o,A,0,2*Math.PI,!1)}function Nb(t,e){var n=e.cx,r=void 0===n?0:n,i=e.cy,o=void 0===i?0:i,A=e.rx,s=e.ry;if(t.ellipse)t.ellipse(r,o,A,s,0,0,2*Math.PI,!1);else{var a=A>s?A:s,c=A>s?1:A/s,l=A>s?s/A:1;t.save(),t.scale(c,l),t.arc(r,o,a,0,2*Math.PI)}}function Tb(t,e){var n,r,i=e.x1,o=e.y1,A=e.x2,s=e.y2,a=e.markerStart,c=e.markerEnd,l=e.markerStartOffset,u=e.markerEndOffset,h=0,d=0,f=0,g=0,p=0;a&&Ra(a)&&l&&(n=A-i,r=s-o,p=Math.atan2(r,n),h=Math.cos(p)*(l||0),d=Math.sin(p)*(l||0)),c&&Ra(c)&&u&&(n=i-A,r=o-s,p=Math.atan2(r,n),f=Math.cos(p)*(u||0),g=Math.sin(p)*(u||0)),t.moveTo(i+h,o+d),t.lineTo(A+f,s+g)}function Ob(t,e){var n,r,i=e.markerStart,o=e.markerEnd,A=e.markerStartOffset,s=e.markerEndOffset,a=e.d,c=a.absolutePath,l=a.segments,u=0,h=0,d=0,f=0,g=0;if(i&&Ra(i)&&A){var p=m(i.parentNode.getStartTangent(),2),v=p[0],y=p[1];n=v[0]-y[0],r=v[1]-y[1],g=Math.atan2(r,n),u=Math.cos(g)*(A||0),h=Math.sin(g)*(A||0)}if(o&&Ra(o)&&s){var w=m(o.parentNode.getEndTangent(),2),b=w[0],B=w[1];n=b[0]-B[0],r=b[1]-B[1],g=Math.atan2(r,n),d=Math.cos(g)*(s||0),f=Math.sin(g)*(s||0)}for(var E=0;E<c.length;E++){var x=c[E],C=x[0],M=c[E+1],F=0===E&&(0!==u||0!==h),k=(E===c.length-1||M&&("M"===M[0]||"Z"===M[0]))&&0!==d&&0!==f,S=m(F?[u,h]:[0,0],2),Q=S[0],U=S[1],N=m(k?[d,f]:[0,0],2),T=N[0],O=N[1];switch(C){case"M":t.moveTo(x[1]+Q,x[2]+U);break;case"L":t.lineTo(x[1]+T,x[2]+O);break;case"Q":t.quadraticCurveTo(x[1],x[2],x[3]+T,x[4]+O);break;case"C":t.bezierCurveTo(x[1],x[2],x[3],x[4],x[5]+T,x[6]+O);break;case"A":var I=l[E].arcParams,L=I.cx,P=I.cy,D=I.rx,R=I.ry,H=I.startAngle,_=I.endAngle,G=I.xRotation,K=I.sweepFlag;if(t.ellipse)t.ellipse(L,P,D,R,G,H,_,!!(1-K));else{var j=D>R?D:R,z=D>R?1:D/R,V=D>R?R/D:1;t.translate(L,P),t.rotate(G),t.scale(z,V),t.arc(0,0,j,H,_,!!(1-K)),t.scale(1/z,1/V),t.rotate(-G),t.translate(-L,-P)}k&&t.lineTo(x[6]+d,x[7]+f);break;case"Z":t.closePath()}}}function Ib(t,e){var n,r,i=e.markerStart,o=e.markerEnd,A=e.markerStartOffset,s=e.markerEndOffset,a=e.points.points,c=a.length,l=a[0][0],u=a[0][1],h=a[c-1][0],d=a[c-1][1],f=0,g=0,p=0,v=0,m=0;i&&Ra(i)&&A&&(n=a[1][0]-a[0][0],r=a[1][1]-a[0][1],m=Math.atan2(r,n),f=Math.cos(m)*(A||0),g=Math.sin(m)*(A||0)),o&&Ra(o)&&s&&(n=a[c-1][0]-a[0][0],r=a[c-1][1]-a[0][1],m=Math.atan2(r,n),p=Math.cos(m)*(s||0),v=Math.sin(m)*(s||0)),t.moveTo(l+(f||p),u+(g||v));for(var y=1;y<c-1;y++){var w=a[y];t.lineTo(w[0],w[1])}t.lineTo(h,d)}function Lb(t,e){var n,r,i=e.markerStart,o=e.markerEnd,A=e.markerStartOffset,s=e.markerEndOffset,a=e.points.points,c=a.length,l=a[0][0],u=a[0][1],h=a[c-1][0],d=a[c-1][1],f=0,g=0,p=0,v=0,m=0;i&&Ra(i)&&A&&(n=a[1][0]-a[0][0],r=a[1][1]-a[0][1],m=Math.atan2(r,n),f=Math.cos(m)*(A||0),g=Math.sin(m)*(A||0)),o&&Ra(o)&&s&&(n=a[c-2][0]-a[c-1][0],r=a[c-2][1]-a[c-1][1],m=Math.atan2(r,n),p=Math.cos(m)*(s||0),v=Math.sin(m)*(s||0)),t.moveTo(l+f,u+g);for(var y=1;y<c-1;y++){var w=a[y];t.lineTo(w[0],w[1])}t.lineTo(h+p,d+v)}function Pb(t,e){var n=e.x,r=void 0===n?0:n,i=e.y,o=void 0===i?0:i,A=e.radius,s=e.width,a=e.height,c=s,l=a,u=A&&A.some(function(t){return 0!==t});if(u){var h=s>0?1:-1,d=a>0?1:-1,f=h+d===0,g=A.map(function(t){return ne(t,0,Math.min(Math.abs(c)/2,Math.abs(l)/2))}),p=m(g,4),v=p[0],y=p[1],w=p[2],b=p[3];t.moveTo(h*v+r,o),t.lineTo(c-h*y+r,o),0!==y&&t.arc(c-h*y+r,d*y+o,y,-d*Math.PI/2,h>0?0:Math.PI,f),t.lineTo(c+r,l-d*w+o),0!==w&&t.arc(c-h*w+r,l-d*w+o,w,h>0?0:Math.PI,d>0?Math.PI/2:1.5*Math.PI,f),t.lineTo(h*b+r,l+o),0!==b&&t.arc(h*b+r,l-d*b+o,b,d>0?Math.PI/2:-Math.PI/2,h>0?Math.PI:0,f),t.lineTo(r,d*v+o),0!==v&&t.arc(h*v+r,d*v+o,v,h>0?Math.PI:0,d>0?1.5*Math.PI:Math.PI/2,f)}else t.rect(r,o,c,l)}var Db=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).name="canvas-path-generator",t}return v(e,t),a(e,[{key:"init",value:function(){var t,e=(r(r(r(r(r(r(r(r(r(r(t={},cr.CIRCLE,Ub),cr.ELLIPSE,Nb),cr.RECT,Pb),cr.LINE,Tb),cr.POLYLINE,Lb),cr.POLYGON,Ib),cr.PATH,Ob),cr.TEXT,void 0),cr.GROUP,void 0),cr.IMAGE,void 0),r(r(r(t,cr.HTML,void 0),cr.MESH,void 0),cr.FRAGMENT,void 0));this.context.pathGeneratorFactory=e}},{key:"destroy",value:function(){delete this.context.pathGeneratorFactory}}])}(ur),Rb=function(){return a(function t(e){A(this,t),this.renderingContext=e.renderingContext,this.canvasConfig=e.config},[{key:"init",value:function(){var t=this.canvasConfig,e=t.container,n=t.canvas;if(n)this.$canvas=n,e&&n.parentElement!==e&&e.appendChild(n),this.$container=n.parentElement,this.canvasConfig.container=this.$container;else if(e&&(this.$container=Jt(e)?document.getElementById(e):e,this.$container)){var r=document.createElement("canvas");this.$container.appendChild(r),this.$container.style.position||(this.$container.style.position="relative"),this.$canvas=r}this.context=this.$canvas.getContext("2d"),this.resize(this.canvasConfig.width,this.canvasConfig.height)}},{key:"getContext",value:function(){return this.context}},{key:"getDomElement",value:function(){return this.$canvas}},{key:"getDPR",value:function(){return this.dpr}},{key:"getBoundingClientRect",value:function(){if(this.$canvas.getBoundingClientRect)return this.$canvas.getBoundingClientRect()}},{key:"destroy",value:function(){this.$container&&this.$canvas&&this.$canvas.parentNode&&this.$container.removeChild(this.$canvas)}},{key:"resize",value:function(t,e){var n=this.canvasConfig.devicePixelRatio;this.dpr=n,this.$canvas&&(this.$canvas.width=this.dpr*t,this.$canvas.height=this.dpr*e,function(t,e,n){WA&&t.style&&(t.style.width=e+"px",t.style.height=n+"px")}(this.$canvas,t,e)),this.renderingContext.renderReasons.add($s.CAMERA_CHANGED)}},{key:"applyCursorStyle",value:function(t){this.$container&&this.$container.style&&(this.$container.style.cursor=t)}},{key:"toDataURL",value:(t=Ar(ir().mark(function t(){var e,n,r,i=arguments;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=(e=i.length>0&&void 0!==i[0]?i[0]:{}).type,r=e.encoderOptions,t.abrupt("return",this.context.canvas.toDataURL(n,r));case 1:case"end":return t.stop()}},t,this)})),function(){return t.apply(this,arguments)})}]);var t}(),Hb=function(t){function e(){var t;A(this,e);for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=g(this,e,[].concat(r))).name="canvas-context-register",t}return v(e,t),a(e,[{key:"init",value:function(){this.context.ContextService=Rb}},{key:"destroy",value:function(){delete this.context.ContextService}}])}(ur),_b=function(t){function e(t){var n;return A(this,e),(n=g(this,e,[t])).registerPlugin(new Hb),n.registerPlugin(new Oc.Plugin),n.registerPlugin(new Db),n.registerPlugin(new Ab),n.registerPlugin(new Hc.Plugin),n.registerPlugin(new Qb),n.registerPlugin(new Pc.Plugin),n}return v(e,t),a(e)}(hr);class Gb extends Nw{constructor(t){super(Object.assign(Object.assign({},t),{style:Object.assign({},Gb.defaultStyleProps,t.style)})),this.rootPointerEvent=new js(null),this.forwardEvents=t=>{const e=this.context.canvas,n=e.context.renderingContext.root.ownerDocument.defaultView;this.normalizeToPointerEvent(t,n).forEach(r=>{const i=this.bootstrapEvent(this.rootPointerEvent,r,n,t);Me(e.context.eventService,"mappingTable.pointerupoutside",[]),e.context.eventService.mapEvent(i)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[t.CommonEvent.CLICK,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_UP,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=ke(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:r=0}=e,i=Pe(e,["dx","dy"]),[o,A]=this.getSize(t);return Object.assign(Object.assign({x:n,y:r},i),{width:o,height:A})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:r,y:i,width:o=0,height:A=0}=n,s=this.upsert("key-container",sc,{x:r,y:i,width:o,height:A,opacity:0},e);return this.upsert("key",$a,n,s)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof _b))return;const t=this.getDomElement();this.events.forEach(e=>{t.addEventListener(e,this.forwardEvents)})}attributeChangedCallback(t,e,n){"zIndex"===t&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let e=0;e<t.changedTouches.length;e++){const r=t.changedTouches[e];de(r.button)&&(r.button=0),de(r.buttons)&&(r.buttons=1),de(r.isPrimary)&&(r.isPrimary=1===t.touches.length&&"touchstart"===t.type),de(r.width)&&(r.width=r.radiusX||1),de(r.height)&&(r.height=r.radiusY||1),de(r.tiltX)&&(r.tiltX=0),de(r.tiltY)&&(r.tiltY=0),de(r.pointerType)&&(r.pointerType="touch"),de(r.pointerId)&&(r.pointerId=r.identifier||0),de(r.pressure)&&(r.pressure=r.force||.5),de(r.twist)&&(r.twist=0),de(r.tangentialPressure)&&(r.tangentialPressure=0),r.isNormalized=!0,r.type=t.type,n.push(r)}else if(e.isMouseEvent(t)){const e=t;de(e.isPrimary)&&(e.isPrimary=!0),de(e.width)&&(e.width=1),de(e.height)&&(e.height=1),de(e.tiltX)&&(e.tiltX=0),de(e.tiltY)&&(e.tiltY=0),de(e.pointerType)&&(e.pointerType="mouse"),de(e.pointerId)&&(e.pointerId=1),de(e.pressure)&&(e.pressure=.5),de(e.twist)&&(e.twist=0),de(e.tangentialPressure)&&(e.tangentialPressure=0),e.isNormalized=!0,n.push(e)}else n.push(t);return n}transferMouseData(t,e){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.altKey=e.altKey,t.metaKey=e.metaKey,t.shiftKey=e.shiftKey,t.ctrlKey=e.ctrlKey,t.button=e.button,t.buttons=e.buttons,t.client.x=e.clientX,t.client.y=e.clientY,t.movement.x=e.movementX,t.movement.y=e.movementY,t.page.x=e.pageX,t.page.y=e.pageY,t.screen.x=e.screenX,t.screen.y=e.screenY,t.relatedTarget=null}bootstrapEvent(t,e,n,r){t.view=n,t.originalEvent=null,t.nativeEvent=r,t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist,this.transferMouseData(t,e);const{x:i,y:o}=this.getViewportXY(e);t.viewport.x=i,t.viewport.y=o;const[A,s]=this.context.canvas.getCanvasByViewport([i,o]);return t.canvas.x=A,t.canvas.y=s,t.global.copyFrom(t.canvas),t.offset.copyFrom(t.canvas),t.isTrusted=r.isTrusted,"pointerleave"===t.type&&(t.type="pointerout"),t}getViewportXY(t){let e,n;const{offsetX:r,offsetY:i,clientX:o,clientY:A}=t;if(Kt(r)||Kt(i)){const t=this.eventService.client2Viewport({x:o,y:A});e=t.x,n=t.y}else e=r,n=i;return{x:e,y:n}}onframe(){super.onframe();const{opacity:t}=this.attributes;this.getDomElement().style.opacity=`${t}`}}Gb.defaultStyleProps={size:[160,80],halo:!1,icon:!1,label:!1,pointerEvents:"auto"};let Kb=class t extends Nw{constructor(e){super(uw({style:t.defaultStyleProps},e))}getKeyStyle(t){const[e,n]=this.getSize(t),r=super.getKeyStyle(t),{fillOpacity:i,opacity:o=i}=r,A=Pe(r,["fillOpacity","opacity"]);return Object.assign(Object.assign({opacity:o},A),{width:e,height:n,x:-e/2,y:-n/2})}getBounds(){return this.getShape("key").getBounds()}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getShape("key").attributes,{fill:n,stroke:r}=e;Pe(e,["fill","stroke"]);const i=Aw(this.getGraphicStyle(t),"halo"),o=Number(i.lineWidth),[A,s]=ay(yy(this.getSize(t)),[o,o]),{lineWidth:a}=i,c={fill:"transparent",lineWidth:a/2,width:A-a/2,height:s-a/2,x:-(A-a/2)/2,y:-(s-a/2)/2};return Object.assign(Object.assign({},i),c)}getIconStyle(t){const e=super.getIconStyle(t),[n,r]=this.getSize(t);return!!e&&Object.assign({width:n*qy,height:r*qy},e)}drawKeyShape(t,e){const n=this.upsert("key",Cw,this.getKeyStyle(t),e);return kw(this),n}drawHaloShape(t,e){this.upsert("halo",sc,this.getHaloStyle(t),e)}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&Sw(this)}};Kb.defaultStyleProps={size:32};class jb extends Nw{constructor(t){super(t)}getKeyStyle(t){const[e,n]=this.getSize(t);return Object.assign(Object.assign({},super.getKeyStyle(t)),{width:e,height:n,x:-e/2,y:-n/2})}getIconStyle(t){const e=super.getIconStyle(t),{width:n,height:r}=this.getShape("key").attributes;return!!e&&Object.assign({width:n*qy,height:r*qy},e)}drawKeyShape(t,e){return this.upsert("key",sc,this.getKeyStyle(t),e)}}class zb extends Ow{constructor(t){super(t)}getInnerR(t){return t.innerR||3*this.getOuterR(t)/8}getOuterR(t){return Math.min(...this.getSize(t))/2}getPoints(t){return e=this.getOuterR(t),n=this.getInnerR(t),[[0,-e],[n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)],[e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[0,n],[-e*Math.cos(3*Math.PI/10),e*Math.sin(3*Math.PI/10)],[-n*Math.cos(Math.PI/10),n*Math.sin(Math.PI/10)],[-e*Math.cos(Math.PI/10),-e*Math.sin(Math.PI/10)],[-n*Math.cos(3*Math.PI/10),-n*Math.sin(3*Math.PI/10)]];var e,n}getIconStyle(t){const e=super.getIconStyle(t),n=2*this.getInnerR(t)*qy;return!!e&&Object.assign({width:n,height:n},e)}getPortXY(t,e){const{placement:n="top"}=e,r=this.getShape("key").getLocalBounds(),i=function(t,e){const n={};return n.top=[0,-t],n.left=[-t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n["left-bottom"]=[-t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.bottom=[0,e],n["right-bottom"]=[t*Math.cos(3*Math.PI/10),t*Math.sin(3*Math.PI/10)],n.right=n.default=[t*Math.cos(Math.PI/10),-t*Math.sin(Math.PI/10)],n}(this.getOuterR(t),this.getInnerR(t));return jB(r,n,i,!1)}}class Vb extends Ow{constructor(t){super(uw({style:Vb.defaultStyleProps},t))}getPoints(t){const{direction:e}=t,[n,r]=this.getSize(t);return function(t,e,n){const r=e/2,i=t/2,o={up:[[-i,r],[i,r],[0,-r]],left:[[-i,0],[i,r],[i,-r]],right:[[-i,r],[-i,-r],[i,0]],down:[[-i,-r],[i,-r],[0,r]]};return o[n]||o.up}(n,r,e)}getPortXY(t,e){const{direction:n}=t,{placement:r="top"}=e,i=this.getShape("key").getLocalBounds(),[o,A]=this.getSize(t),s=function(t,e,n){const r=e/2,i=t/2,o={};"down"===n?(o.bottom=o.default=[0,r],o.right=[i,-r],o.left=[-i,-r]):"left"===n?(o.top=[i,-r],o.bottom=[i,r],o.left=o.default=[-i,0]):"right"===n?(o.top=[-i,-r],o.bottom=[-i,r],o.right=o.default=[i,0]):(o.left=[-i,r],o.top=o.default=[0,-r],o.right=[i,r]);return o}(o,A,n);return jB(i,r,s,!1)}getIconStyle(t){const{icon:e,iconText:n,iconSrc:r,direction:i}=t;if(!1===e||Ee(n||r))return!1;const o=Aw(this.getGraphicStyle(t),"icon"),A=this.getShape("key").getLocalBounds(),[s,a]=function(t,e){const{center:n}=t,[r,i]=wm(t);return["up"===e||"down"===e?n[0]:"right"===e?n[0]-r/6:n[0]+r/6,"left"===e||"right"===e?n[1]:"down"===e?n[1]-i/6:n[1]+i/6]}(A,i),c=2*function(t,e){let[n,r]=wm(t);return[n,r]="up"===e||"down"===e?[n,r]:[r,n],(Math.pow(r,2)-Math.pow(Math.sqrt(Math.pow(n/2,2)+Math.pow(r,2))-n/2,2))/(2*r)}(A,i)*qy;return Object.assign({x:s,y:a,width:c,height:c},o)}}Vb.defaultStyleProps={size:40,direction:"up"};class Wb extends Nw{constructor(t){super(uw({style:Wb.defaultStyleProps},t)),this.type="combo",this.updateComboPosition(this.parsedAttributes)}getKeySize(t){const{collapsed:e,childrenNode:n=[]}=t;return 0===n.length?this.getEmptyKeySize(t):e?this.getCollapsedKeySize(t):this.getExpandedKeySize(t)}getEmptyKeySize(t){const{padding:e,collapsedSize:n}=t,[r,i,o,A]=pm(e);return ay(cw(n),[A+i,r+o,0])}getCollapsedKeySize(t){return cw(t.collapsedSize)}getExpandedKeySize(t){const e=this.getContentBBox(t);return[mm(e),ym(e),0]}getContentBBox(t){const{childrenNode:e=[],padding:n}=t,r=e.map(t=>this.context.element.getElement(t)).filter(Boolean);if(0===r.length){const e=new yr,{x:n=0,y:r=0,size:i}=t,[o,A]=cw(i);return e.setMinMax([n-o/2,r-A/2,0],[n+o/2,r+A/2,0]),e}const i=xm(r.map(t=>t.getBounds()));return n?Em(i,n):i}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",Qw,n,e),kw(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Aw(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,r=Pe(e,["type"]),i=this.getShape("key"),[o,A]=ky(i.getLocalBounds(),"center"),s=Object.assign(Object.assign({},r),{x:o,y:A});if(n){const e=this.getCollapsedMarkerText(n,t);Object.assign(s,{text:e})}return s}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:r}=this.context;return"descendant-count"===t?r.getDescendantsData(this.id).length.toString():"child-count"===t?n.length.toString():"node-count"===t?r.getDescendantsData(this.id).filter(t=>"node"===r.getElementType(Km(t))).length.toString():Gt(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:r,childrenData:i=[]}=t;if(0===i.length)return[+e,+n,0];if(r){const{model:t}=this.context,r=t.getDescendantsData(this.id).filter(e=>!t.isCombo(Km(e)));if(r.length>0&&r.some(Fy)){return uy(r.reduce((t,e)=>ay(t,My(e)),[0,0,0]),r.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:r}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:r}}),Sw(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(t=>{var{x:e,y:n,z:r,transform:i}=t;return Pe(t,["x","y","z","transform"])}),e);return n?new Proxy(n,{set:(t,e,n)=>("currentTime"===e&&Promise.resolve().then(()=>this.onframe()),Reflect.set(t,e,n))}):n}}Wb.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class Yb extends Wb{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",za,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[r]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&Aw(n,"collapsed")),{r:r/2})}getCollapsedKeySize(t){const[e,n]=cw(t.collapsedSize),r=Math.max(e,n)/2;return[2*r,2*r,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,r]=wm(e),i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2))/2;return[2*i,2*i,0]}getIntersectPoint(t,e=!1){return Dy(t,this.getShape("key").getBounds(),e)}}class Xb extends Wb{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",sc,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,r]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&Aw(e,"collapsed")),{width:n,height:r,x:-n/2,y:-r/2})}}const qb={padding:10};function $b(t,e,n,r,i,o){const{padding:A}=Object.assign(qb,o),s=bm(n,A),a=bm(r,A),c=[t,...i,e];let l=null;const u=[];for(let t=0,e=c.length;t<e-1;t++){const n=t+1,r=c[t],i=c[n],o=Oy(r,i);let h=null;if(0===t)if(n===e-1)if(s.intersects(a))h=AB(r,i,s,a);else if(Fm(r,s)||Fm(i,a))o||(h=oB(r,i,s,a));else{const t=Sm(r,s),e=Sm(i,a);h=nB(t,e,tB(t,e)),h.points.unshift(t),h.points.push(e)}else Cm(i,s)?h=AB(r,i,s,bm(i,A),l):o||(h=rB(r,i,s));else n===e-1?Cm(r,a)?h=AB(r,i,bm(r,A),a,l):o||(h=iB(r,i,a,l)):o||(h=nB(r,i,l));h?(u.push(...h.points),l=h.direction):l=tB(r,i),n<e-1&&u.push(i)}return u.map(yy)}const Zb={N:"S",S:"N",W:"E",E:"W"},Jb={N:-Math.PI/2,S:Math.PI/2,E:0,W:Math.PI};function tB(t,e){const[n,r]=t,[i,o]=e;return n===i?r>o?"N":"S":r===o?n>i?"W":"E":null}function eB(t,e){return"N"===e||"S"===e?ym(t):mm(t)}function nB(t,e,n){const r=[t[0],e[1]],i=[e[0],t[1]],o=tB(t,r),A=tB(t,i),s=n?Zb[n]:null,a=o===n||o!==s&&A!==n?r:i;return{points:[a],direction:tB(a,e)}}function rB(t,e,n){if(Fm(t,n)){const r=sB(t,e,n);return{points:[r],direction:tB(r,e)}}{const r=Sm(t,n),i=["left","right"].includes(km(t,n))?[e[0],r[1]]:[r[0],e[1]];return{points:[i],direction:tB(i,e)}}}function iB(t,e,n,r){const i=Fm(e,n)?e:Sm(e,n),o=[[i[0],t[1]],[t[0],i[1]]],A=o.filter(t=>function(t,e){return!Cm(t,e)}(t,n)&&!Mm(t,n,!0)),s=A.filter(e=>tB(e,t)!==r);if(s.length>0){const n=s.find(e=>tB(t,e)===r)||s[0];return{points:[n],direction:tB(n,e)}}{const i=Ny(e,_t(o,A)[0],eB(n,r)/2);return{points:[sB(i,t,n),i],direction:tB(i,e)}}}function oB(t,e,n,r){let i=rB(t,e,n);const o=wy(i.points[0]);if(Cm(o,r)){i=rB(e,t,r);const A=wy(i.points[0]);if(Cm(A,n)){const s=Ny(t,o,eB(n,tB(t,o))/2),a=Ny(e,A,eB(r,tB(e,A))/2),c=[(s[0]+a[0])/2,(s[1]+a[1])/2],l=rB(t,c,n),u=iB(c,e,r,l.direction);i.points=[l.points[0],u.points[0]],i.direction=u.direction}}return i}function AB(t,e,n,r,i){const o=.01,A=xm([n,r]),s=dy(e,A.center)>dy(t,A.center),[a,c]=s?[e,t]:[t,e],l=ym(A)+mm(A);let u;if(i){const t=[a[0]+l*Math.cos(Jb[i]),a[1]+l*Math.sin(Jb[i])];u=Ny(Sm(t,A),t,o)}else u=Ny(Sm(a,A),a,-.01);let h=sB(u,c,A),d=[Uy(u,2),Uy(h,2)];if(xe(Uy(u),Uy(h))){const t=py(cy(u,a),[1,0,0])+Math.PI/2;h=[c[0]+l*Math.cos(t),c[1]+l*Math.sin(t),0],h=Uy(Ny(Sm(h,A),c,-.01),2);d=[u,sB(u,h,A),h]}return{points:s?d.reverse():d,direction:tB(s?u:h,e)}}function sB(t,e,n){let r=[t[0],e[1]];return Cm(r,n)&&(r=[e[0],t[1]]),r}const aB={top:0,bottom:0,left:Math.PI/2,right:Math.PI/2,"top-right":Math.PI/4,"right-top":Math.PI/4,"bottom-left":Math.PI/4,"left-bottom":Math.PI/4,"right-bottom":-Math.PI/4,"bottom-right":-Math.PI/4,"left-top":-Math.PI/4,"top-left":-Math.PI/4};function cB(t,e,n,r,i,o,A){var s;let a="number"==typeof e?e:.5;if("start"===e&&(a=0),"end"===e&&(a=.99),o&&A){a=.5,r=0,i=0;let e=null!==(s=aB[A])&&void 0!==s?s:0;Math.cos(e)<-1e-6&&(e+=Math.PI);const o=n&&0!==e,[c,l]=lB(t,a,r,i,o?e:void 0),u=[["translate",c,l]];return o&&u.push(["rotate",e/Math.PI*180]),{textAlign:"center",transform:u}}const c=Sy(t.getPoint(a)),l=Sy(t.getPoint(a+.01));let u="start"===e?"left":"end"===e?"right":"center";if(Ty(c,l)||!n){const[e,n]=lB(t,a,r,i);return{transform:[["translate",e,n]],textAlign:u}}let h=Math.atan2(l[1]-c[1],l[0]-c[0]);l[0]<c[0]&&(u="center"===u?u:"left"===u?"right":"left",r*=-1,h+=Math.PI);const[d,f]=lB(t,a,r,i,h);return{textAlign:u,transform:[["translate",d,f],["rotate",h/Math.PI*180]]}}function lB(t,e,n,r,i){const[o,A]=Sy(t.getPoint(e));let s=n,a=r;return i&&(s=n*Math.cos(i)-r*Math.sin(i),a=n*Math.sin(i)+r*Math.cos(i)),[o+s,A+a]}function uB(t,e,n,r){if(xe(t,e))return t;const i=cy(e,t),o=[t[0]+n*i[0],t[1]+n*i[1]],A=gy(vy(i,!1));return o[0]+=r*A[0],o[1]+=r*A[1],o}function hB(t,e,n){return[["M",t[0],t[1]],["C",n[0][0],n[0][1],n[1][0],n[1][1],e[0],e[1]]]}function dB(t,e=0,n=!1){const r=t.length-1,i=t[0],o=t[r],A=t.slice(1,r),s=[["M",i[0],i[1]]];return A.forEach((t,n)=>{const r=A[n-1]||i,a=A[n+1]||o;if(!Iy(r,t,a)&&e){const[n,i]=function(t,e,n,r){const i=fy(t,e),o=fy(n,e),A=Math.min(r,Math.min(i,o)/2),s=[e[0]-A/i*(e[0]-t[0]),e[1]-A/i*(e[1]-t[1])],a=[e[0]-A/o*(e[0]-n[0]),e[1]-A/o*(e[1]-n[1])];return[s,a]}(r,t,a,e);s.push(["L",n[0],n[1]],["Q",t[0],t[1],i[0],i[1]],["L",i[0],i[1]])}else s.push(["L",t[0],t[1]])}),s.push(["L",o[0],o[1]]),n&&s.push(["Z"]),s}function fB(t,e,n,r,i){const o=bm(t),A=t.getCenter();let s=r&&WB(r),a=i&&WB(i);if(!s||!a){const r=(t=>{const e=Math.PI/2,n=ym(t)/2,r=mm(t)/2,i=Math.atan2(n,r)/2,o=Math.atan2(r,n)/2;return{top:[-e-o,-e+o],"top-right":[-e+o,-i],"right-top":[-e+o,-i],right:[-i,i],"bottom-right":[i,e-o],"right-bottom":[i,e-o],bottom:[e-o,e+o],"bottom-left":[e+o,Math.PI-i],"left-bottom":[e+o,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-e-o],"left-top":[Math.PI+i,-e-o]}})(o),i=r[e][0],c=r[e][1],[l,u]=wm(o),h=Math.max(l,u),d=ay(A,[h*Math.cos(i),h*Math.sin(i),0]),f=ay(A,[h*Math.cos(c),h*Math.sin(c),0]);s=$B(t,d),a=$B(t,f),n||([s,a]=[a,s])}return[s,a]}function gB(t,e,n,r){const i=t.getCenter();if(xe(e,n)){const t=cy(e,i),o=[r*Math.sign(t[0])||r/2,r*Math.sign(t[1])||-r/2,0];return[ay(e,o),ay(n,ly(o,[1,-1,1]))]}return[Ny(i,e,dy(i,e)+r),Ny(i,n,dy(i,n)+r)]}function pB(t,e,n,r,i,o,A){const s=zB(t),a=s[o||A],c=s[A||o];let[l,u]=fB(t,n,r,a,c);const h=function(t,e,n,r){const i=[],o=bm(t);if(xe(e,n)){switch(km(e,o)){case"left":i.push([e[0]-r,e[1]]),i.push([e[0]-r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"right":i.push([e[0]+r,e[1]]),i.push([e[0]+r,e[1]+r]),i.push([e[0],e[1]+r]);break;case"top":i.push([e[0],e[1]-r]),i.push([e[0]+r,e[1]-r]),i.push([e[0]+r,e[1]]);break;case"bottom":i.push([e[0],e[1]+r]),i.push([e[0]+r,e[1]+r]),i.push([e[0]+r,e[1]])}}else{const t=km(e,o),A=km(n,o);if(t===A){let o,A;switch(t){case"left":o=Math.min(e[0],n[0])-r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"right":o=Math.max(e[0],n[0])+r,i.push([o,e[1]]),i.push([o,n[1]]);break;case"top":A=Math.min(e[1],n[1])-r,i.push([e[0],A]),i.push([n[0],A]);break;case"bottom":A=Math.max(e[1],n[1])+r,i.push([e[0],A]),i.push([n[0],A])}}else{const s=(t,e)=>({left:[e[0]-r,e[1]],right:[e[0]+r,e[1]],top:[e[0],e[1]-r],bottom:[e[0],e[1]+r]}[t]),a=s(t,e),c=s(A,n),l=sB(a,c,o);i.push(a,l,c)}}return i}(t,l,u,i);return a&&(l=qB(a,h[0])),c&&(u=qB(c,h.at(-1))),dB([l,...h,u],e)}function vB(t,e){const n=new Set,r=new Set,i=new Set;return t.forEach(o=>{e(o).forEach(e=>{n.add(e),t.includes(e.source)&&t.includes(e.target)?r.add(e):i.add(e)})}),{edges:Array.from(n),internal:Array.from(r),external:Array.from(i)}}function mB(t,e){const n=[];let r=t;for(;r;){n.push(r);const t=e(Km(r));if(!t)break;r=t}if(n.some(t=>{var e;return null===(e=t.style)||void 0===e?void 0:e.collapsed})){const t=n.reverse().findIndex(rw);return n[t]||n.at(-1)}return t}const yB=(t,e)=>[["M",-t/2,0],["L",t/2,-e/2],["L",t/2,e/2],["Z"]];var wB=Object.freeze({__proto__:null,circle:(t,e)=>{const n=Math.max(t,e)/2;return[["M",-t/2,0],["A",n,n,0,1,0,2*n-t/2,0],["A",n,n,0,1,0,-t/2,0],["Z"]]},diamond:(t,e)=>[["M",-t/2,0],["L",0,-e/2],["L",t/2,0],["L",0,e/2],["Z"]],rect:(t,e)=>[["M",-t/2,-e/2],["L",t/2,-e/2],["L",t/2,e/2],["L",-t/2,e/2],["Z"]],simple:(t,e)=>[["M",t/2,-e/2],["L",-t/2,0],["L",t/2,0],["L",-t/2,0],["L",t/2,e/2]],triangle:yB,triangleRect:(t,e)=>{const n=t/2,r=t/7,i=t-r;return[["M",-n,0],["L",0,-e/2],["L",0,e/2],["Z"],["M",i-n,-e/2],["L",i+r-n,-e/2],["L",i+r-n,e/2],["L",i-n,e/2],["Z"]]},vee:(t,e)=>[["M",-t/2,0],["L",t/2,-e/2],["L",4*t/5-t/2,0],["L",t/2,e/2],["Z"]]});class bB extends Uw{constructor(t){super(uw({style:bB.defaultStyleProps},t)),this.type="edge"}get sourceNode(){const{sourceNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}get targetNode(){const{targetNode:t}=this.parsedAttributes;return this.context.element.getElement(t)}getKeyStyle(t){const e=this.getGraphicStyle(t),{loop:n}=e,r=Pe(e,["loop"]),{sourceNode:i,targetNode:o}=this,A={d:n&&GB(i,o)?this.getLoopPath(t):this.getKeyPath(t)};return nc.PARSED_STYLE_LIST.forEach(t=>{t in r&&(A[t]=r[t])}),A}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,r=this.sourceNode,i=bm(r),o=Math.max(mm(i),ym(i)),{type:A,placement:s,clockwise:a,dist:c=o}=Aw(this.getGraphicStyle(t),"loop");return"arc"===A?function(t,e,n,r,i,o){const A=t.getPorts()[i||o],s=t.getPorts()[o||i];let[a,c]=fB(t,e,n,A,s);if(xe(a,c)){const e=gB(t,a,c,r);return A&&(a=qB(A,e[0])),s&&(c=qB(s,e.at(-1))),hB(a,c,e)}const l=t.getCenter(),u=[(a[0]+c[0])/2,(a[1]+c[1])/2,0],h=dy(l,u)>1e-6?gy(cy(u,l)):[0,-1,0],d=dy(a,c),f=Math.max(Math.abs(r),.01),g=(d*d+4*f*f)/(8*f),p=[u[0]+h[0]*f,u[1]+h[1]*f,0],v=[u[0]+h[0]*(f-g),u[1]+h[1]*(f-g),0],m=2*Math.PI,y=Math.atan2(a[1]-v[1],a[0]-v[0]),w=((Math.atan2(c[1]-v[1],c[0]-v[0])-y)%m+m)%m,b=((Math.atan2(p[1]-v[1],p[0]-v[0])-y)%m+m)%m<=w+1e-6,B=b?1:0,E=(b?w:m-w)>Math.PI?1:0;if(A){const t=[a[0]-v[0],a[1]-v[1],0];a=qB(A,ay(a,1===B?[-t[1],t[0],0]:[t[1],-t[0],0]))}if(s){const t=[c[0]-v[0],c[1]-v[1],0];c=qB(s,ay(c,1===B?[t[1],-t[0],0]:[-t[1],t[0],0]))}return[["M",a[0],a[1]],["A",g,g,0,E,B,c[0],c[1]]]}(r,s,a,c,e,n):function(t,e,n,r,i,o){const A=t.getPorts()[i||o],s=t.getPorts()[o||i];let[a,c]=fB(t,e,n,A,s);const l=gB(t,a,c,r);return A&&(a=qB(A,l[0])),s&&(c=qB(s,l.at(-1))),hB(a,c,l)}(r,s,a,c,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:r,targetPort:i}=t,{sourceNode:o,targetNode:A}=this,[s,a]=function(t,e,n,r){const i=YB(t,e,n,r),o=YB(e,t,r,n);return[i,o]}(o,A,r,i);if(!e){return[s?WB(s):o.getCenter(),a?WB(a):A.getCenter()]}const c="function"==typeof n?n():n;return[XB(s||o,c[0]||a||A),XB(a||A,c[c.length-1]||s||o)]}getHaloStyle(t){if(!1===t.halo)return!1;const e=this.getKeyStyle(t),n=Aw(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(!1===t.label||!t.labelText)return!1;const e=Aw(this.getGraphicStyle(t),"label"),{placement:n,offsetX:r,offsetY:i,autoRotate:o,maxWidth:A}=e,s=Pe(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),a=t.loop&&GB(this.sourceNode,this.targetNode),{placement:c}=Aw(this.getGraphicStyle(t),"loop"),l=cB(this.shapeMap.key,n,o,r,i,a,c),u=this.shapeMap.key.getLocalBounds(),h=function(t,e,n=1){return fw(dy(t[0],t[1])*n,e)}([u.min,u.max],A);return Object.assign({wordWrapWidth:h},l,s)}getBadgeStyle(t){if(!1===t.badge||!t.badgeText)return!1;const e=Aw(t,"badge"),{offsetX:n,offsetY:r,placement:i}=e,o=Pe(e,["offsetX","offsetY","placement"]);return Object.assign(o,function(t,e,n,r,i){var o,A;const s=2*(null===(o=t.badge)||void 0===o?void 0:o.getGeometryBounds().halfExtents[0])||0,a=2*(null===(A=t.label)||void 0===A?void 0:A.getGeometryBounds().halfExtents[0])||0;return cB(t.key,n,!0,(a?(a/2+s/2)*("suffix"===e?1:-1):0)+r,i)}(this.shapeMap,i,t.labelPlacement,n,r))}drawArrow(t,e){var n;const r="start"===e,i=t["start"===e?"startArrow":"endArrow"],o=this.shapeMap.key;if(i){const e=this.getArrowStyle(t,r),[n,i,A]=r?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],s=o.parsedStyle[n];if(s)s.attr(e);else{const t=new(e.src?Za:nc)({style:e});o.style[n]=t}o.style[i]=t[A]||e.width/2+ +e.lineWidth}else{const t=r?"markerStart":"markerEnd";null===(n=o.style[t])||void 0===n||n.destroy(),o.style[t]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,r=e?"startArrow":"endArrow",i=Aw(this.getGraphicStyle(t),r),{size:o,type:A}=i,s=Pe(i,["size","type"]),[a,c]=cw(function(t,e){return e||(t<4?10:4===t?12:2.5*t)}(n.lineWidth,o)),l=(Gt(A)?A:wB[A]||yB)(a,c);return Object.assign(ke(n,["stroke","strokeOpacity","fillOpacity"]),{width:a,height:c},Object.assign({},l&&{d:l,fill:"simple"===A?"":n.stroke}),s)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",yw,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",nc,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",ww,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",nc,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n?new Proxy(n,{set:(t,e,n)=>("currentTime"===e&&Promise.resolve().then(()=>this.onframe()),Reflect.set(t,e,n))}):n}}bB.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class BB extends bB{constructor(t){super(uw({style:BB.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:r,curvePosition:i,curveOffset:o}=t,A=this.getControlPoints(e,n,function(t){return re(t)?[t,1-t]:t}(i),function(t){return re(t)?[t,-t]:t}(o),r);return hB(e,n,A)}getControlPoints(t,e,n,r,i){return 2===(null==i?void 0:i.length)?i:[uB(t,e,n[0],r[0]),uB(t,e,n[1],r[1])]}}BB.defaultStyleProps={curvePosition:.5,curveOffset:20};class EB extends BB{constructor(t){super(uw({style:EB.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[0]-t[0];return[[t[0]+i*n[0]+r[0],t[1]],[e[0]-i*n[1]+r[1],e[1]]]}}EB.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class xB extends BB{constructor(t){super(uw({style:xB.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=My(this.ref);return[this.sourceNode.getIntersectPoint(e,!0),this.targetNode.getIntersectPoint(e)]}toRadialCoordinate(t){const e=My(this.ref);return[dy(t,e),by(cy(t,e))]}getControlPoints(t,e,n,r){const[i,o]=this.toRadialCoordinate(t),[A]=this.toRadialCoordinate(e),s=A-i;return[[t[0]+(s*n[0]+r[0])*Math.cos(o),t[1]+(s*n[0]+r[0])*Math.sin(o)],[e[0]-(s*n[1]-r[0])*Math.cos(o),e[1]-(s*n[1]-r[0])*Math.sin(o)]]}}xB.defaultStyleProps={curvePosition:.5,curveOffset:20};class CB extends BB{constructor(t){super(uw({style:CB.defaultStyleProps},t))}getControlPoints(t,e,n,r){const i=e[1]-t[1];return[[t[0],t[1]+i*n[0]+r[0]],[e[0],e[1]-i*n[1]+r[1]]]}}CB.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};let MB=class t extends bB{constructor(e){super(uw({style:t.defaultStyleProps},e))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}};MB.defaultStyleProps={};const FB={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:fy},kB=t=>`${Math.round(t[0])}|||${Math.round(t[1])}`;function SB(t,e){const n=t=>Math.round(t/e);return re(t)?n(t):t.map(n)}function QB(t,e){const n=e[0]-t[0],r=e[1]-t[1];return n||r?Math.atan2(r,n):0}function UB(t,e,n,r){const i=QB(t,e),o=n[kB(t)];return function(t,e){const n=Math.abs(t-e);return n>Math.PI?2*Math.PI-n:n}(QB(o||r,t),i)}function NB(t,e,n){return Math.min(...e.map(e=>n(t,e)))}const TB=(t,e,n,r)=>{if(!e)return[t];const{directionMap:i,offset:o}=r,A=Em(e.getRenderBounds(),o),s=Object.keys(i).reduce((e,r)=>{if(n.includes(r)){const n=i[r],[o,s]=wm(A),a=[t[0]+n.stepX*o,t[1]+n.stepY*s],c=function(t){const{min:[e,n],max:[r,i]}=t,o=[e,i],A=[r,i],s=[r,n],a=[e,n];return[[o,A],[A,s],[s,a],[a,o]]}(A);for(let n=0;n<c.length;n++){const r=xy([t,a],c[n]);r&&Mm(r,A)&&e.push(r)}}return e},[]);return Cm(t,A)||s.push(t),s.map(t=>SB(t,r.gridSize))},OB=(t,e,n,r,i,o,A)=>{const s=[];let a=[o[0]===r[0]?r[0]:t[0]*A,o[1]===r[1]?r[1]:t[1]*A];s.unshift(a);let c=t,l=e[kB(c)];for(;l;){const t=l,r=c;UB(t,r,e,n)&&(a=[t[0]===r[0]?a[0]:t[0]*A,t[1]===r[1]?a[1]:t[1]*A],s.unshift(a)),l=e[kB(t)],c=t}const u=i.map(t=>[t[0]*A,t[1]*A]),h=function(t,e,n){let r=t[0],i=n(t[0],e);for(let o=0;o<t.length;o++){const A=t[o],s=n(A,e);s<i&&(r=A,i=s)}return r}(u,a,fy);return s.unshift(h),s};function IB(t,e,n,r){const i=yy(t.getCenter()),o=yy(e.getCenter()),A=Object.assign(FB,r),{gridSize:s}=A,a=((t,e)=>{const{offset:n,gridSize:r}=e,i={};return t.forEach(t=>{if(!t||t.destroyed||!t.isVisible())return;const e=Em(t.getRenderBounds(),n);for(let t=SB(e.min[0],r);t<=SB(e.max[0],r);t+=1)for(let n=SB(e.min[1],r);n<=SB(e.max[1],r);n+=1)i[`${t}|||${n}`]=!0}),i})(A.enableObstacleAvoidance?n:[t,e],A),c=SB(i,s),l=SB(o,s),u=TB(i,t,A.startDirections,A),h=TB(o,e,A.endDirections,A);u.forEach(t=>delete a[kB(t)]),h.forEach(t=>delete a[kB(t)]);const d={},f={},g={},p={},v={},m=new LB;for(let t=0;t<u.length;t++){const e=u[t],n=kB(e);d[n]=e,p[n]=0,v[n]=NB(e,h,A.distFunc),m.add({id:n,value:v[n]})}const y=h.map(t=>kB(t));let w,b=A.maximumLoops,B=1/0;for(const[t,e]of Object.entries(d))v[t]<=B&&(B=v[t],w=e);for(;Object.keys(d).length>0&&b>0;){const t=m.minId(!1);if(!t)break;w=d[t];const e=kB(w);if(y.includes(e))return OB(w,g,c,o,u,l,s);delete d[e],m.remove(e),f[e]=!0;for(const t of Object.values(A.directionMap)){const n=ay(w,[t.stepX,t.stepY]),r=kB(n);if(f[r])continue;const i=UB(w,n,g,c);if(i>A.maxAllowedDirectionChange)continue;if(a[r])continue;d[r]||(d[r]=n);const o=A.penalties[i],l=A.distFunc(w,n)+(isNaN(o)?s:o),u=p[e]+l,y=p[r];y&&u>=y||(g[r]=w,p[r]=u,v[r]=u+NB(n,h,A.distFunc),m.add({id:r,value:v[r]}))}b-=1}return[]}class LB{constructor(){this.arr=[],this.map={},this.arr=[],this.map={}}_innerAdd(t,e){let n=0,r=e-1;for(;r-n>1;){const e=Math.floor((n+r)/2);if(this.arr[e].value>t.value)r=e;else{if(!(this.arr[e].value<t.value))return this.arr.splice(e,0,t),void(this.map[t.id]=!0);n=e}}this.arr.splice(r,0,t),this.map[t.id]=!0}add(t){delete this.map[t.id];const e=this.arr.length;if(!e||this.arr[e-1].value<t.value)return this.arr.push(t),void(this.map[t.id]=!0);this._innerAdd(t,e)}remove(t){this.map[t]&&delete this.map[t]}_clearAndGetMinId(){let t;for(let e=this.arr.length-1;e>=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t}_findFirstId(){for(;this.arr.length;){const t=this.arr.shift();if(this.map[t.id])return t.id}}minId(t){return t?this._clearAndGetMinId():this._findFirstId()}}class PB extends bB{constructor(t){super(uw({style:PB.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:r}=this,[i,o]=this.getEndpoints(t,!1);let A=[];if(e)if("shortest-path"===e.type){A=IB(n,r,this.context.element.getNodes(),e),A.length||(A=$b(i,o,n,r,t.controlPoints,{padding:e.offset}))}else"orth"===e.type&&(A=$b(i,o,n,r,t.controlPoints,e));else A=t.controlPoints;return A}getPoints(t){const e=this.getControlPoints(t),[n,r]=this.getEndpoints(t,!0,e);return[n,...e,r]}getKeyPath(t){return dB(this.getPoints(t),t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:r}=t,i=this.sourceNode,o=bm(i),A=Math.max(mm(o),ym(o))/4,{placement:s,clockwise:a,dist:c=A}=Aw(this.getGraphicStyle(t),"loop");return pB(i,r,s,a,c,e,n)}}PB.defaultStyleProps={radius:0,controlPoints:[],router:!1};class DB extends bB{constructor(t){super(uw({style:DB.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[r,i]=this.getEndpoints(t);return function(t,e,n){return[["M",t[0],t[1]],["Q",n[0],n[1],e[0],e[1]]]}(r,i,t.controlPoint||uB(r,i,e,n))}}function RB(t){return t instanceof Nw&&"node"===t.type}function HB(t){return t instanceof bB}function _B(t){return t instanceof Wb}function GB(t,e){return!(!t||!e)&&t===e}DB.defaultStyleProps={curvePosition:.5,curveOffset:30};const KB={top:[.5,0],right:[1,.5],bottom:[.5,1],left:[0,.5],"left-top":[0,0],"top-left":[0,0],"left-bottom":[0,1],"bottom-left":[0,1],"right-top":[1,0],"top-right":[1,0],"right-bottom":[1,1],"bottom-right":[1,1],default:[.5,.5]};function jB(t,e,n=KB,r=!0){const i=[.5,.5],o=Jt(e)?Ce(n,e.toLocaleLowerCase(),i):e;if(!r&&Jt(e))return o;const[A,s]=o||i;return[t.min[0]+mm(t)*A,t.min[1]+ym(t)*s]}function zB(t){if(!t)return{};const e=t.getPorts();return(t.attributes.ports||[]).forEach((n,r)=>{var i;const{key:o,placement:A}=n;VB(n)&&(e[i=o||r]||(e[i]=ky(t.getShape("key").getBounds(),A)))}),e}function VB(t){const{r:e}=t;return!e||0===Number(e)}function WB(t){return fm(t)?t:t.getPosition()}function YB(t,e,n,r){const i=zB(t);if(n)return i[n];const o=Object.values(i);if(0===o.length)return;const A=o.map(t=>WB(t)),s=function(t,e){const n=zB(t);if(e)return[WB(n[e])];const r=Object.values(n);return r.length>0?r.map(t=>WB(t)):[t.getCenter()]}(e,r),[a]=function(t,e){let n=1/0,r=[t[0],e[0]];return t.forEach(t=>{e.forEach(e=>{const i=dy(t,e);i<n&&(n=i,r=[t,e])})}),r}(A,s);return o.find(t=>WB(t)===a)}function XB(t,e){return _B(t)||RB(t)?$B(t,e):qB(t,e)}function qB(t,e){if(!t||!e)return[0,0,0];if(fm(t))return t;if(t.attributes.linkToCenter)return t.getPosition();return Dy(fm(e)?e:RB(e)?e.getCenter():e.getPosition(),t.getBounds())}function $B(t,e){if(!t||!e)return[0,0,0];const n=fm(e)?e:RB(e)?e.getCenter():e.getPosition();return t.getIntersectPoint(n)||t.getCenter()}function ZB(t,e="bottom",n=0,r=0,i=!1){const o=e.split("-"),[A,s]=ky(t,e),[a,c]=i?["bottom","top"]:["top","bottom"];return{transform:[["translate",A+n,s+r]],textBaseline:o.includes("top")?c:o.includes("bottom")?a:"middle",textAlign:o.includes("left")?"right":o.includes("right")?"left":"center"}}function JB(t){return"hidden"!==Ce(t,["style","visibility"])}function tE(t,e){"update"in t?t.update(e):t.attr(e)}function eE(t){return Ce(t,"__to_be_destroyed__",!1)}class nE extends iy{constructor(t,e){super(t,Object.assign({},nE.defaultOptions,e)),this.onCollapseExpand=t=>De(this,void 0,void 0,function*(){if(!this.validate(t))return;const{target:e}=t;if(!(RB(n=e)||HB(n)||_B(n)))return;var n;const r=e.id,{model:i,graph:o}=this.context,A=i.getElementDataById(r);if(!A)return!1;const{onCollapse:s,onExpand:a,animation:c,align:l}=this.options;rw(A)?(yield o.expandElement(r,{animation:c,align:l}),null==a||a(r)):(yield o.collapseElement(r,{animation:c,align:l}),null==s||s(r))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}function rE(t,e){const{data:n,style:r}=t,i=Pe(t,["data","style"]),{data:o,style:A}=e,s=Pe(e,["data","style"]),a=Object.assign(Object.assign({},i),s);return(n||o)&&Object.assign(a,{data:Object.assign(Object.assign({},n),o)}),(r||A)&&Object.assign(a,{style:Object.assign(Object.assign({},r),A)}),a}function iE(t){const{data:e,style:n}=t,r=Pe(t,["data","style"]);return e&&(r.data=Object.assign({},e)),n&&(r.style=Object.assign({},n)),r}function oE(t={},e={}){const{states:n=[],data:r={},style:i={},children:o=[]}=t,A=Pe(t,["states","data","style","children"]),{states:s=[],data:a={},style:c={},children:l=[]}=e,u=(t,e)=>t.length===e.length&&t.every((t,n)=>t===e[n]),h=(t,e)=>{const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(n=>t[n]===e[n])};return!!h(A,Pe(e,["states","data","style","children"]))&&(!!u(o,l)&&(!!u(n,s)&&(!!h(r,a)&&!!h(i,c))))}nE.defaultOptions={enable:!0,animation:!0,trigger:t.CommonEvent.DBLCLICK,align:!0};const AE="__internal_override__";function sE(t){return!1!==t[AE]}const aE="g6-create-edge-assist-node-id";class cE extends iy{constructor(t,e){super(t,Object.assign({},cE.defaultOptions,e)),this.drop=t=>De(this,void 0,void 0,function*(){const{targetType:e}=t;["combo","node"].includes(e)&&this.source?yield this.handleCreateEdge(t):yield this.cancelEdge()}),this.handleCreateEdge=t=>De(this,void 0,void 0,function*(){var e,n,r;if(!this.validate(t))return;const{graph:i,canvas:o,batch:A,element:s}=this.context,{style:a}=this.options;if(this.source)return this.createEdge(t),void(yield this.cancelEdge());A.startBatch(),o.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([t.target.id])[0];const c=i.getElementData(this.source);i.addNodeData([{id:aE,type:"circle",[AE]:!1,style:{size:1,visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:null===(e=c.style)||void 0===e?void 0:e.x,y:null===(n=c.style)||void 0===n?void 0:n.y}}]),i.addEdgeData([{id:"g6-create-edge-assist-edge-id",source:this.source,target:aE,style:Object.assign({pointerEvents:"none"},a)}]),yield null===(r=s.draw({animation:!1}))||void 0===r?void 0:r.finished}),this.updateAssistEdge=t=>De(this,void 0,void 0,function*(){var e;if(!this.source)return;const{model:n,element:r,graph:i}=this.context,[o,A]=i.getCanvasByClient([t.client.x,t.client.y]);n.translateNodeTo(aE,[o,A]),yield null===(e=r.draw({animation:!1,silence:!0}))||void 0===e?void 0:e.finished}),this.createEdge=t=>{var e,n;const{graph:r}=this.context,{style:i,onFinish:o,onCreate:A}=this.options;if(void 0===(null===(e=t.target)||void 0===e?void 0:e.id)||void 0===this.source)return;const s=null===(n=this.getSelectedNodeIDs([t.target.id]))||void 0===n?void 0:n[0];var a;const c=A({id:`${this.source}-${s}-${Ue[a=a||"g"]?Ue[a]+=1:Ue[a]=1,a+Ue[a]}`,source:this.source,target:s,style:i});c&&(r.addEdgeData([c]),o(c))},this.cancelEdge=()=>De(this,void 0,void 0,function*(){var t;if(!this.source)return;const{graph:e,element:n,batch:r}=this.context;e.removeNodeData([aE]),this.source=void 0,yield null===(t=n.draw({animation:!1}))||void 0===t?void 0:t.finished,r.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:e}=this.context,{trigger:n}=this.options;this.unbindEvents(),"click"===n?(e.on(t.NodeEvent.CLICK,this.handleCreateEdge),e.on(t.ComboEvent.CLICK,this.handleCreateEdge),e.on(t.CanvasEvent.CLICK,this.cancelEdge),e.on(t.EdgeEvent.CLICK,this.cancelEdge)):(e.on(t.NodeEvent.DRAG_START,this.handleCreateEdge),e.on(t.ComboEvent.DRAG_START,this.handleCreateEdge),e.on(t.CommonEvent.POINTER_UP,this.drop)),e.on(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(t=>t.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;e.off(t.NodeEvent.CLICK,this.handleCreateEdge),e.off(t.ComboEvent.CLICK,this.handleCreateEdge),e.off(t.CanvasEvent.CLICK,this.cancelEdge),e.off(t.EdgeEvent.CLICK,this.cancelEdge),e.off(t.NodeEvent.DRAG_START,this.handleCreateEdge),e.off(t.ComboEvent.DRAG_START,this.handleCreateEdge),e.off(t.CommonEvent.POINTER_UP,this.drop),e.off(t.CommonEvent.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}cE.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:t=>t,onFinish:()=>{}};class lE extends iy{constructor(t,e){super(t,Object.assign({},lE.defaultOptions,e)),this.isDragging=!1,this.onDragStart=t=>{this.validate(t)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=t=>{var e,n,r,i;if(!this.isDragging||Ky.isPinching)return;const o=null!==(n=null===(e=t.movement)||void 0===e?void 0:e.x)&&void 0!==n?n:t.dx,A=null!==(i=null===(r=t.movement)||void 0===r?void 0:r.y)&&void 0!==i?i:t.dy;0!==(o|A)&&this.translate([o,A],!1)},this.onDragEnd=()=>{var t,e;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),null===(e=(t=this.options).onFinish)||void 0===e||e.call(t)},this.invokeOnFinish=pe(()=>{var t,e;null===(e=(t=this.options).onFinish)||void 0===e||e.call(t)},300),this.shortcut=new Wy(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:e}=this.options;if(zt(e)){const{up:t=[],down:n=[],left:r=[],right:i=[]}=e;this.shortcut.bind(t,t=>this.onTranslate([0,1],t)),this.shortcut.bind(n,t=>this.onTranslate([0,-1],t)),this.shortcut.bind(r,t=>this.onTranslate([1,0],t)),this.shortcut.bind(i,t=>this.onTranslate([-1,0],t))}else{const{graph:e}=this.context;e.on(t.CommonEvent.DRAG_START,this.onDragStart),e.on(t.CommonEvent.DRAG,this.onDrag),e.on(t.CommonEvent.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return De(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,r=-1*n;yield this.translate(ly(t,r),this.options.animation),this.invokeOnFinish()})}translate(t,e){return De(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),t=this.clampByRotation(t),yield this.context.graph.translateBy(t,e)})}clampByRotation([t,e]){return By([t,e],this.context.graph.getRotation())}clampByDirection([t,e]){const{direction:n}=this.options;return"x"===n?e=0:"y"===n&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:r}=this.context,[i,o]=r.getSize(),[A,s,a,c]=pm(this.options.range),l=[o*A,i*s,o*a,i*c],u=Em(Bm(n.getCanvasCenter()),l),h=cy(n.getViewportCenter(),[t,e,0]);if(!Cm(h,u)){const{min:[n,r],max:[i,o]}=u;(h[0]<n&&t>0||h[0]>i&&t<0)&&(t=0),(h[1]<r&&e>0||h[1]>o&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return"function"==typeof e?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:e}=this.context;e.off(t.CommonEvent.DRAG_START,this.onDragStart),e.off(t.CommonEvent.DRAG,this.onDrag),e.off(t.CommonEvent.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}lE.defaultOptions={enable:t=>!("targetType"in t)||"canvas"===t.targetType,sensitivity:10,direction:"both",range:1/0};class uE extends iy{constructor(e,n){super(e,Object.assign({},uE.defaultOptions,n)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=t=>De(this,void 0,void 0,function*(){var e;if("link"!==this.options.dropEffect)return;const{model:n,element:r}=this.context,i=t.target.id;this.target.forEach(t=>{const e=n.getParentData(t,zv);e&&Km(e)===i&&n.refreshComboData(i),n.setParent(t,i,zv)}),yield null===(e=null==r?void 0:r.draw({animation:!0}))||void 0===e?void 0:e.finished}),this.setCursor=e=>{if(this.isDragging)return;const{type:n}=e,{canvas:r}=this.context,{cursor:i}=this.options;n===t.CommonEvent.POINTER_ENTER?r.setCursor((null==i?void 0:i.grab)||"grab"):r.setCursor((null==i?void 0:i.default)||"default")},this.shortcut=new Wy(e.graph),this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:e,canvas:n}=this.context,r=n.getLayer().getContextService().$canvas;r&&(r.addEventListener("blur",this.onDragEnd),r.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(n=>{e.on(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.on(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.on(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd),e.on(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.setCursor),e.on(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(e.on(t.ComboEvent.DROP,this.onDrop),e.on(t.CanvasEvent.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(t=>t.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return uy([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:r,graph:i}=this.context;r.setCursor((null===(e=this.options.cursor)||void 0===e?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const o=t.target.id;i.getElementState(o).includes(this.options.state)?this.target=this.getSelectedNodeIDs([o]):this.target=[o],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(!this.enable)return;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:t=0,y:e=0}=this.shadow.attributes,[n,r]=cy([+t,+e],this.shadowOrigin);this.moveElement(this.target,[n,r])}this.showEdges(),null===(e=(t=this.options).onFinish)||void 0===e||e.call(t,this.target);const{batch:r,canvas:i}=this.context;r.endBatch(),i.setCursor((null===(n=this.options.cursor)||void 0===n?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}isKeydown(){const{trigger:t}=this.options;return!(null==t?void 0:t.length)||this.shortcut.match(t)}validate(t){if(this.destroyed||eE(t.target)||this.context.graph.isCollapsingExpanding||!this.isKeydown())return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}clampByRotation([t,e]){return By([t,e],this.context.graph.getRotation())}moveElement(t,e){return De(this,void 0,void 0,function*(){const{graph:n,model:r}=this.context,{dropEffect:i}=this.options;"move"===i&&t.forEach(t=>r.refreshComboData(t)),n.translateElementBy(Object.fromEntries(t.map(t=>[t,this.clampByRotation(e)])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[r,i]=t;this.shadow.attr({x:+e+r,y:+n+i})}createShadow(t){const e=Aw(this.options,"shadow"),n=xm(t.map(t=>this.context.element.getElement(t).getBounds())),[r,i]=n.min;this.shadowOrigin=[r,i];const[o,A]=wm(n),s={width:o,height:A,x:r,y:i};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),s),{visibility:"visible"})):(this.shadow=new sc({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),s),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||0===this.hiddenEdges.length||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if("none"===t||e)return;const{graph:n}=this.context;this.hiddenEdges="all"===t?n.getEdgeData().map(Km):Array.from(new Set(this.target.map(e=>n.getRelatedEdgesData(e,t).map(Km)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:e,canvas:n}=this.context,r=n.getLayer().getContextService().$canvas;r&&(r.removeEventListener("blur",this.onDragEnd),r.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(n=>{e.off(`${n}:${t.CommonEvent.DRAG_START}`,this.onDragStart),e.off(`${n}:${t.CommonEvent.DRAG}`,this.onDrag),e.off(`${n}:${t.CommonEvent.DRAG_END}`,this.onDragEnd),e.off(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.setCursor),e.off(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.setCursor)}),e.off(`combo:${t.CommonEvent.DROP}`,this.onDrop),e.off(`canvas:${t.CommonEvent.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),null===(t=this.shadow)||void 0===t||t.destroy(),super.destroy()}}uE.defaultOptions={animation:!0,enable:t=>["node","combo"].includes(t.targetType),trigger:[],dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var hE=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this._events[t]||[],o=this._events["*"]||[],A=function(r){for(var i=r.length,o=0;o<i;o++)if(r[o]){var A=r[o],s=A.callback;A.once&&(r.splice(o,1),0===r.length&&delete e._events[t],i--,o--),s.apply(e,n)}};A(i),A(o)},t.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();function dE(t,e,n,r){for(;t.length;){const i=t.shift();if(n(i))return!0;e.add(i.id),r(i.id).forEach(n=>{e.has(n.id)||(e.add(n.id),t.push(n))})}return!1}function fE(t,e,n,r){if(n(t))return!0;e.add(t.id);for(const i of r(t.id))if(!e.has(i.id)&&fE(i,e,n,r))return!0;return!1}const gE=()=>!0;class pE{graph;nodeFilter;edgeFilter;cacheEnabled;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;allNodesMap=new Map;allEdgesMap=new Map;constructor(t){this.graph=t.graph;const e=t.nodeFilter||gE,n=t.edgeFilter||gE;this.nodeFilter=e,this.edgeFilter=t=>{const{source:r,target:i}=this.graph.getEdgeDetail(t.id);return!(!e(r)||!e(i))&&n(t,r,i)},"auto"===t.cache?(this.cacheEnabled=!0,this.startAutoCache()):"manual"===t.cache?this.cacheEnabled=!0:this.cacheEnabled=!1}clearCache=()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()};refreshCache=()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))};updateCache=t=>{const e=new Set;t.forEach(t=>{const n=this.bothEdgesMap.get(t);if(n&&n.forEach(t=>e.add(t.id)),this.hasNode(t)){const n=this.graph.getRelatedEdges(t,"in").filter(this.edgeFilter),r=this.graph.getRelatedEdges(t,"out").filter(this.edgeFilter),i=Array.from(new Set([...n,...r]));i.forEach(t=>e.add(t.id)),this.inEdgesMap.set(t,n),this.outEdgesMap.set(t,r),this.bothEdgesMap.set(t,i),this.allNodesMap.set(t,this.graph.getNode(t))}else this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.bothEdgesMap.delete(t),this.allNodesMap.delete(t)}),e.forEach(t=>{this.hasEdge(t)?this.allEdgesMap.set(t,this.graph.getEdge(t)):this.allEdgesMap.delete(t)})};startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}handleGraphChanged=t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":case"NodeRemoved":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":"source"!==n.propertyName&&"target"!==n.propertyName||(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const r=t.graph.getEdge(n.id);e.add(r.source),e.add(r.target)}}}),this.updateCache(e)};checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some(e=>e.id===t)}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),this.cacheEnabled)return"in"===e?this.inEdgesMap.get(t):"out"===e?this.outEdgesMap.get(t):this.bothEdgesMap.get(t);return this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map(t=>this.getNode(t.target));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map(t=>this.getNode(t.source));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return n&&this.nodeFilter(n)?n:null}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];dE([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];fE(this.getNode(t),new Set,e,r)}}let vE=class t extends hE{nodeMap=new Map;edgeMap=new Map;inEdgesMap=new Map;outEdgesMap=new Map;bothEdgesMap=new Map;treeIndices=new Map;changes=[];batchCount=0;onChanged=()=>{};constructor(t){super(),t&&(t.nodes&&this.addNodes(t.nodes),t.edges&&this.addEdges(t.edges),t.tree&&this.addTree(t.tree),t.onChanged&&(this.onChanged=t.onChanged))}batch=t=>{this.batchCount+=1,t(),this.batchCount-=1,this.batchCount||this.commit()};commit(){const t=this.changes;this.changes=[];const e={graph:this,changes:t};this.emit("changed",e),this.onChanged(e)}reduceChanges(t){let e=[];return t.forEach(t=>{switch(t.type){case"NodeRemoved":{let n=!1;e=e.filter(e=>{if("NodeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"NodeDataUpdated"===e.type?e.id!==t.value.id:"TreeStructureChanged"!==e.type||e.nodeId!==t.value.id}),n||e.push(t);break}case"EdgeRemoved":{let n=!1;e=e.filter(e=>{if("EdgeAdded"===e.type){const r=e.value.id===t.value.id;return r&&(n=!0),!r}return"EdgeDataUpdated"!==e.type&&"EdgeUpdated"!==e.type||e.id!==t.value.id}),n||e.push(t);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const n=e.findIndex(e=>e.type===t.type&&e.id===t.id&&(void 0===t.propertyName||e.propertyName===t.propertyName)),r=e[n];r?void 0!==t.propertyName?r.newValue=t.newValue:(e.splice(n,1),e.push(t)):e.push(t);break}case"TreeStructureDetached":e=e.filter(e=>"TreeStructureAttached"===e.type?e.treeKey!==t.treeKey:"TreeStructureChanged"!==e.type||e.treeKey!==t.treeKey),e.push(t);break;case"TreeStructureChanged":{const n=e.find(e=>"TreeStructureChanged"===e.type&&e.treeKey===t.treeKey&&e.nodeId===t.nodeId);n?n.newParentId=t.newParentId:e.push(t);break}default:e.push(t)}}),e}checkNodeExistence(t){this.getNode(t)}hasNode(t){return this.nodeMap.has(t)}areNeighbors(t,e){return this.getNeighbors(e).some(e=>e.id===t)}getNode(t){const e=this.nodeMap.get(t);if(!e)throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){if(this.checkNodeExistence(t),"in"===e){const e=this.inEdgesMap.get(t);return Array.from(e)}if("out"===e){const e=this.outEdgesMap.get(t);return Array.from(e)}{const e=this.bothEdgesMap.get(t);return Array.from(e)}}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const e=this.getRelatedEdges(t,"out").map(t=>this.getNode(t.target));return Array.from(new Set(e))}getPredecessors(t){const e=this.getRelatedEdges(t,"in").map(t=>this.getNode(t.source));return Array.from(new Set(e))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}doAddNode(t){if(this.hasNode(t.id))throw new Error("Node already exists: "+t.id);this.nodeMap.set(t.id,t),this.inEdgesMap.set(t.id,new Set),this.outEdgesMap.set(t.id,new Set),this.bothEdgesMap.set(t.id,new Set),this.treeIndices.forEach(e=>{e.childrenMap.set(t.id,new Set)}),this.changes.push({type:"NodeAdded",value:t})}addNodes(t){this.batch(()=>{for(const e of t)this.doAddNode(e)})}addNode(t){this.addNodes([t])}doRemoveNode(t){const e=this.getNode(t),n=this.bothEdgesMap.get(t);n?.forEach(t=>this.doRemoveEdge(t.id)),this.nodeMap.delete(t),this.treeIndices.forEach(n=>{n.childrenMap.get(t)?.forEach(t=>{n.parentMap.delete(t.id)});const r=n.parentMap.get(t);r&&n.childrenMap.get(r.id)?.delete(e),n.parentMap.delete(t),n.childrenMap.delete(t)}),this.bothEdgesMap.delete(t),this.inEdgesMap.delete(t),this.outEdgesMap.delete(t),this.changes.push({type:"NodeRemoved",value:e})}removeNodes(t){this.batch(()=>{t.forEach(t=>this.doRemoveNode(t))})}removeNode(t){this.removeNodes([t])}updateNodeDataProperty(t,e,n){const r=this.getNode(t);this.batch(()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"NodeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})})}mergeNodeData(t,e){this.batch(()=>{Object.entries(e).forEach(([e,n])=>{this.updateNodeDataProperty(t,e,n)})})}updateNodeData(...t){const e=t[0],n=this.getNode(e);if("string"==typeof t[1])return void this.updateNodeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch(()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"NodeDataUpdated",id:e,oldValue:t,newValue:i})})}checkEdgeExistence(t){if(!this.hasEdge(t))throw new Error("Edge not found for id: "+t)}hasEdge(t){return this.edgeMap.has(t)}getEdge(t){return this.checkEdgeExistence(t),this.edgeMap.get(t)}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}doAddEdge(t){if(this.hasEdge(t.id))throw new Error("Edge already exists: "+t.id);this.checkNodeExistence(t.source),this.checkNodeExistence(t.target),this.edgeMap.set(t.id,t);const e=this.inEdgesMap.get(t.target),n=this.outEdgesMap.get(t.source),r=this.bothEdgesMap.get(t.source),i=this.bothEdgesMap.get(t.target);e.add(t),n.add(t),r.add(t),i.add(t),this.changes.push({type:"EdgeAdded",value:t})}addEdges(t){this.batch(()=>{for(const e of t)this.doAddEdge(e)})}addEdge(t){this.addEdges([t])}doRemoveEdge(t){const e=this.getEdge(t),n=this.outEdgesMap.get(e.source),r=this.inEdgesMap.get(e.target),i=this.bothEdgesMap.get(e.source),o=this.bothEdgesMap.get(e.target);n.delete(e),r.delete(e),i.delete(e),o.delete(e),this.edgeMap.delete(t),this.changes.push({type:"EdgeRemoved",value:e})}removeEdges(t){this.batch(()=>{t.forEach(t=>this.doRemoveEdge(t))})}removeEdge(t){this.removeEdges([t])}updateEdgeSource(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.source,i=e;this.outEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.outEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.source=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"source",oldValue:r,newValue:i})})}updateEdgeTarget(t,e){const n=this.getEdge(t);this.checkNodeExistence(e);const r=n.target,i=e;this.inEdgesMap.get(r).delete(n),this.bothEdgesMap.get(r).delete(n),this.inEdgesMap.get(i).add(n),this.bothEdgesMap.get(i).add(n),n.target=e,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:t,propertyName:"target",oldValue:r,newValue:i})})}updateEdgeDataProperty(t,e,n){const r=this.getEdge(t);this.batch(()=>{const i=r.data[e],o=n;r.data[e]=o,this.changes.push({type:"EdgeDataUpdated",id:t,propertyName:e,oldValue:i,newValue:o})})}updateEdgeData(...t){const e=t[0],n=this.getEdge(e);if("string"==typeof t[1])return void this.updateEdgeDataProperty(e,t[1],t[2]);let r;if("function"==typeof t[1]){const e=t[1];r=e(n.data)}else"object"==typeof t[1]&&(r=t[1]);this.batch(()=>{const t=n.data,i=r;n.data=r,this.changes.push({type:"EdgeDataUpdated",id:e,oldValue:t,newValue:i})})}mergeEdgeData(t,e){this.batch(()=>{Object.entries(e).forEach(([e,n])=>{this.updateEdgeDataProperty(t,e,n)})})}checkTreeExistence(t){if(!this.hasTreeStructure(t))throw new Error("Tree structure not found for treeKey: "+t)}hasTreeStructure(t){return this.treeIndices.has(t)}attachTreeStructure(t){this.treeIndices.has(t)||(this.treeIndices.set(t,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:t})}))}detachTreeStructure(t){this.checkTreeExistence(t),this.treeIndices.delete(t),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:t})})}addTree(t,e){this.batch(()=>{this.attachTreeStructure(e);const n=[],r=Array.isArray(t)?t:[t];for(;r.length;){const t=r.shift();n.push(t),t.children&&r.push(...t.children)}this.addNodes(n),n.forEach(t=>{t.children?.forEach(n=>{this.setParent(n.id,t.id,e)})})})}getRoots(t){return this.checkTreeExistence(t),this.getAllNodes().filter(e=>!this.getParent(e.id,t))}getChildren(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);const n=this.treeIndices.get(e).childrenMap.get(t);return Array.from(n||[])}getParent(t,e){this.checkNodeExistence(t),this.checkTreeExistence(e);return this.treeIndices.get(e).parentMap.get(t)||null}getAncestors(t,e){const n=[];let r,i=this.getNode(t);for(;r=this.getParent(i.id,e);)n.push(r),i=r;return n}setParent(t,e,n){this.checkTreeExistence(n);const r=this.treeIndices.get(n);if(!r)return;const i=this.getNode(t),o=r.parentMap.get(t);if(o?.id===e)return;if(null==e)return o&&r.childrenMap.get(o.id)?.delete(i),void r.parentMap.delete(t);const A=this.getNode(e);r.parentMap.set(t,A),o&&r.childrenMap.get(o.id)?.delete(i);let s=r.childrenMap.get(A.id);s||(s=new Set,r.childrenMap.set(A.id,s)),s.add(i),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:n,nodeId:t,oldParentId:o?.id,newParentId:A.id})})}dfsTree(t,e,n){return fE(this.getNode(t),new Set,e,t=>this.getChildren(t,n))}bfsTree(t,e,n){return dE([this.getNode(t)],new Set,e,t=>this.getChildren(t,n))}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return dE([this.getNode(t)],new Set,e,r)}dfs(t,e,n="out"){const r={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];return fE(this.getNode(t),new Set,e,r)}clone(){const e=this.getAllNodes().map(t=>({...t,data:{...t.data}})),n=this.getAllEdges().map(t=>({...t,data:{...t.data}})),r=new t({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:t,childrenMap:e},n)=>{const i=new Map;t.forEach((t,e)=>{i.set(e,r.getNode(t.id))});const o=new Map;e.forEach((t,e)=>{o.set(e,new Set(Array.from(t).map(t=>r.getNode(t.id))))}),r.treeIndices.set(n,{parentMap:i,childrenMap:o})}),r}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(t){return new pE({graph:this,...t})}},mE=class{constructor(t,e){this.context=t,this.options=e||{}}};function yE(t,e){return class extends mE{constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>(t.tick(e),this.getLayoutResult(t))}}execute(t,e){return De(this,void 0,void 0,function*(){return yield this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(be({},this.options,e))),this.getLayoutResult(this.instance)})}graphData2LayoutModel(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e,...r],edges:n}}transformOptions(t){if(t.node=t=>{var n;const{style:r}=t||{},i="combo"in(t||{})&&null!==(n=t.combo)&&void 0!==n?n:null,o=Km(t);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({id:o},re(null==r?void 0:r.x)?{x:r.x}:{}),re(null==r?void 0:r.y)?{y:r.y}:{}),re(null==r?void 0:r.z)?{z:r.z}:{}),{parentId:i}),(t=>e.model.isCombo(t))(o)?{isCombo:!0}:{})},t.edge=t=>({id:Km(t),source:t.source,target:t.target}),!("onTick"in t))return t;const n=t.onTick;return t.onTick=t=>n(this.getLayoutResult(t)),t}getLayoutResult(t){const{model:e}=this.context,n={nodes:[],edges:[],combos:[]};return t.forEachNode(t=>{var r;const i=String(t.id),o=e.isCombo(i)?n.combos:n.nodes,A=Object.assign({x:t.x,y:t.y,z:null!==(r=t.z)&&void 0!==r?r:0},t.size?{size:t.size}:{});null==o||o.push({id:i,style:A})}),t.forEachEdge(t=>{const e={controlPoints:t.points||[]};n.edges.push({id:String(t.id),source:String(t.source),target:String(t.target),style:e})}),n}}}function wE(t){const{nodes:e,edges:n=[]}=t,r={nodes:[],edges:[],combos:[]};return e.forEach(t=>{const e=t.data._isCombo?r.combos:r.nodes,{x:n,y:i,z:o=0}=t.data;null==e||e.push({id:t.id,style:{x:n,y:i,z:o}})}),n.forEach(t=>{const{id:e,source:n,target:i,data:{points:o=[],controlPoints:A=o.slice(1,o.length-1)}}=t;r.edges.push({id:e,source:n,target:i,style:Object.assign({},(null==A?void 0:A.length)?{controlPoints:A.map(Sy)}:{})})}),r}function bE(t,e,...n){if(e in t)return t[e](...n);if("instance"in t){const r=t.instance;if(e in r)return r[e](...n)}return null}function BE(t,e){if(e in t)return t[e];if("instance"in t){const n=t.instance;if(e in n)return n[e]}return null}class EE extends uE{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(null==t?void 0:t.id))}validate(t){return!!this.context.layout&&(this.forceLayoutInstance?super.validate(t):(Zv("DragElementForce only works with d3-force or d3-force-3d layout"),!1))}moveElement(t,e){return De(this,void 0,void 0,function*(){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach((r,i)=>{const{x:o=0,y:A=0}=r.style||{};n&&bE(n,"setFixedPosition",t[i],[...ay([+o,+A],this.clampByRotation(e))])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&BE(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(t=>{const{x:n=0,y:r=0}=t.style||{};e&&bE(e,"setFixedPosition",Km(t),[+n,+r])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&BE(t,"simulation").alphaTarget(0),this.options.fixed||this.context.graph.getNodeData(this.target).forEach(e=>{t&&bE(t,"setFixedPosition",Km(e),[null,null,null])})}}class xE extends iy{constructor(t,e){super(t,Object.assign({},xE.defaultOptions,e)),this.isZoomEvent=t=>Boolean(t.data&&"scale"in t.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=t=>De(this,void 0,void 0,function*(){if(!this.validate(t))return;const{graph:e}=this.context,{state:n,nodeFilter:r,edgeFilter:i,comboFilter:o}=this.options,A=(n?e.getElementDataByState("node",n):e.getNodeData()).filter(r),s=(n?e.getElementDataByState("edge",n):e.getEdgeData()).filter(i),a=(n?e.getElementDataByState("combo",n):e.getComboData()).filter(o),c=this.isZoomEvent(t)?this.zoom=Math.max(.01,Math.min(t.data.scale,10)):this.zoom,l=[...A,...a];l.length>0&&l.forEach(t=>this.fixNodeLike(t,c)),this.updateRelatedEdges(),s.length>0&&s.forEach(t=>this.fixEdge(t,c))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(t,e,n)=>{var r;const i=this.cachedStyles.get(t)||[],o=(null===(r=i.find(t=>t.shape===e))||void 0===r?void 0:r.style)||{};return n in o||(o[n]=e.attributes[n],this.cachedStyles.set(t,[...i.filter(t=>t.shape!==e),{shape:e,style:o}])),o[n]},this.scaleEntireElement=(t,e,n)=>{e.setLocalScale(1/n);const r=this.cachedStyles.get(t)||[];r.push({shape:e}),this.cachedStyles.set(t,r)},this.scaleSpecificShapes=(t,e,n)=>{const r=function(t){const e=[],n=t=>{(null==t?void 0:t.children.length)&&t.children.forEach(t=>{e.push(t),n(t)})};return n(t),e}(t);(Array.isArray(n)?n:[n]).forEach(n=>{const{shape:i,fields:o}=n,A="function"==typeof i?i(r):t.getShape(i);A&&(o?o.forEach(n=>{const r=this.getOriginalFieldValue(t.id,A,n);re(r)&&(A.style[n]=r/e)}):this.scaleEntireElement(t.id,A,e))})},this.skipIfExceedViewport=t=>{const{viewport:e}=this.context;return!(null==e?void 0:e.isInViewport(t.getRenderBounds(),!1,30))},this.fixNodeLike=(t,e)=>{const n=Km(t),{element:r,model:i}=this.context,o=r.getElement(n);if(!o||this.skipIfExceedViewport(o))return;i.getRelatedEdgesData(n).forEach(t=>this.relatedEdgeToUpdate.add(Km(t)));const A=this.options[o.type];A?this.scaleSpecificShapes(o,e,A):this.scaleEntireElement(n,o,e)},this.fixEdge=(t,e)=>{const n=Km(t),r=this.context.element.getElement(n);if(!r||this.skipIfExceedViewport(r))return;const i=this.options.edge;if(!i)return r.style.transformOrigin="center",void this.scaleEntireElement(n,r,e);this.scaleSpecificShapes(r,e,i)},this.updateRelatedEdges=()=>{const{element:t}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(e=>{const n=t.getElement(e);null==n||n.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=t=>De(this,void 0,void 0,function*(){var e;(null===(e=t.data)||void 0===e?void 0:e.firstRender)||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(t=>{t.forEach(({shape:t,style:e})=>{if(Ee(e))t.setLocalScale(1);else{if(this.options.state)return;Object.entries(e).forEach(([e,n])=>t.style[e]=n)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(e=>e&&"node"===t.getElementType(e));if(n.length>0){const r=new Set;n.forEach(e=>{t.getRelatedEdgesData(e).forEach(t=>r.add(Km(t)))}),r.forEach(t=>{const n=null==e?void 0:e.getElement(t);null==n||n.update({})})}}}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.resetTransform),e.on(t.GraphEvent.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.resetTransform),e.off(t.GraphEvent.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}xE.defaultOptions={enable:t=>t.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};class CE extends iy{constructor(t,e){super(t,Object.assign({},CE.defaultOptions,e)),this.focus=t=>De(this,void 0,void 0,function*(){if(!this.validate(t))return;const{graph:e}=this.context;yield e.focusElement(t.target.id,this.options.animation)}),this.shortcut=new Wy(t.graph),this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),$y.forEach(n=>{e.on(`${n}:${t.CommonEvent.CLICK}`,this.focus)})}validate(t){if(this.destroyed||!this.isKeydown())return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}isKeydown(){const{trigger:t}=this.options;return!(null==t?void 0:t.length)||this.shortcut.match(t)}unbindEvents(){const{graph:e}=this.context;$y.forEach(n=>{e.off(`${n}:${t.CommonEvent.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),this.shortcut.destroy(),super.destroy()}}CE.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0,trigger:[]};class ME extends iy{constructor(e,n){super(e,Object.assign({},ME.defaultOptions,n)),this.isFrozen=!1,this.toggleFrozen=t=>{this.isFrozen="dragstart"===t.type},this.hoverElement=e=>{if(!this.validate(e))return;const n=e.type===t.CommonEvent.POINTER_ENTER;this.updateElementsState(e,n);const{onHover:r,onHoverEnd:i}=this.options;n?null==r||r(e):null==i||i(e)},this.updateElementsState=(t,e)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:n}=this.context,{state:r,animation:i,inactiveState:o}=this.options,A=this.getActiveIds(t),s={};if(r&&Object.assign(s,this.getElementsState(A,r,e)),o){const t=zm(n.getData(),!0).filter(t=>!A.includes(t));Object.assign(s,this.getElementsState(t,o,e))}n.setElementState(s,i)},this.getElementsState=(t,e,n)=>{const{graph:r}=this.context,i={};return t.forEach(t=>{const o=r.getElementState(t);i[t]=n?o.includes(e)?o:[...o,e]:o.filter(t=>t!==e)}),i},this.bindEvents()}bindEvents(){const{graph:e}=this.context;this.unbindEvents(),$y.forEach(n=>{e.on(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.hoverElement),e.on(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.hoverElement)});const n=this.context.canvas.document;n.addEventListener(`${t.CommonEvent.DRAG_START}`,this.toggleFrozen),n.addEventListener(`${t.CommonEvent.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:r}=this.options,i=t.target.id;return n?Jy(e,t.targetType,i,"function"==typeof n?n(t):n,r):[i]}validate(t){if(this.destroyed||this.isFrozen||eE(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}unbindEvents(){const{graph:e}=this.context;$y.forEach(n=>{e.off(`${n}:${t.CommonEvent.POINTER_ENTER}`,this.hoverElement),e.off(`${n}:${t.CommonEvent.POINTER_LEAVE}`,this.hoverElement)});const n=this.context.canvas.document;n.removeEventListener(`${t.CommonEvent.DRAG_START}`,this.toggleFrozen),n.removeEventListener(`${t.CommonEvent.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}ME.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class FE extends Yy{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e,graph:n}=this.context;this.pathShape=new nc({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[Xy(t,n)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:r}=this.options;this.points.push(Xy(t,this.context.graph)),null===(e=this.pathShape)||void 0===e||e.setAttribute("d",function(t,e=!0){const n=[];return t.forEach((t,e)=>{n.push([0===e?"M":"L",...t])}),e&&n.push(["Z"]),n}(this.points)),n&&"default"===r&&this.points.length>2&&super.updateElementsStates(this.points)}onPointerUp(){this.points&&(this.points.length<2||super.updateElementsStates(this.points),this.clearLasso())}clearLasso(){var t;null===(t=this.pathShape)||void 0===t||t.remove(),this.pathShape=void 0,this.points=void 0}}class kE extends iy{constructor(t,e){super(t,Object.assign({},kE.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(t,e,n)=>{t.filter(Boolean).forEach(t=>{"hidden"!==e||t.isVisible()?"visible"===e&&this.hiddenShapes.includes(t)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(t),1):ey(t,e,n):this.hiddenShapes.push(t)})},this.filterShapes=(t,e)=>{if(Gt(e))return n=>!e(t,n);const n=null==e?void 0:e[t];return t=>!t.className||!(null==n?void 0:n.includes(t.className))},this.hideShapes=t=>{if(!this.validate(t)||!this.isVisible)return;const{element:e}=this.context,{shapes:n={}}=this.options;this.setElementsVisibility(e.getNodes(),"hidden",this.filterShapes("node",n)),this.setElementsVisibility(e.getEdges(),"hidden",this.filterShapes("edge",n)),this.setElementsVisibility(e.getCombos(),"hidden",this.filterShapes("combo",n)),this.isVisible=!1},this.showShapes=pe(t=>{if(!this.validate(t)||this.isVisible)return;const{element:e}=this.context;this.setElementsVisibility(e.getNodes(),"visible"),this.setElementsVisibility(e.getEdges(),"visible"),this.setElementsVisibility(e.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.BEFORE_TRANSFORM,this.hideShapes),e.on(t.GraphEvent.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.BEFORE_TRANSFORM,this.hideShapes),e.off(t.GraphEvent.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}kE.defaultOptions={enable:!0,debounce:200,shapes:t=>"node"===t};class SE extends iy{constructor(t,e){super(t,Object.assign({},SE.defaultOptions,e)),this.onWheel=t=>De(this,void 0,void 0,function*(){this.options.preventDefault&&t.preventDefault();const e=t.deltaX,n=t.deltaY;yield this.scroll([-e,-n],t)}),this.shortcut=new Wy(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var e,n;const{trigger:r}=this.options;if(this.shortcut.unbindAll(),zt(r)){null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.onWheel);const{up:n=[],down:i=[],left:o=[],right:A=[]}=r;this.shortcut.bind(n,t=>this.scroll([0,-10],t)),this.shortcut.bind(i,t=>this.scroll([0,10],t)),this.shortcut.bind(o,t=>this.scroll([-10,0],t)),this.shortcut.bind(A,t=>this.scroll([10,0],t))}else null===(n=this.graphDom)||void 0===n||n.addEventListener(t.CommonEvent.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=ly(t,e),t=this.clampByDirection(t),t=this.clampByRange(t)}clampByDirection([t,e]){const{direction:n}=this.options;return"x"===n?e=0:"y"===n&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:r}=this.context,[i,o]=r.getSize(),[A,s,a,c]=pm(this.options.range),l=[o*A,i*s,o*a,i*c],u=Em(Bm(n.getCanvasCenter()),l),h=cy(n.getViewportCenter(),[t,e,0]);if(!Cm(h,u)){const{min:[n,r],max:[i,o]}=u;(h[0]<n&&t>0||h[0]>i&&t<0)&&(t=0),(h[1]<r&&e>0||h[1]>o&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return De(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,r=this.context.graph,i=this.formatDisplacement(t);yield r.translateBy(i,!1),null==n||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}destroy(){var e;this.shortcut.destroy(),null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.onWheel),super.destroy()}}SE.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};class QE extends iy{constructor(t,e){super(t,Object.assign({},QE.defaultOptions,e)),this.zoom=(t,e,n)=>De(this,void 0,void 0,function*(){if(!this.validate(e))return;const{graph:r}=this.context;let i=this.options.origin;!i&&"viewport"in e&&(i=Sy(e.viewport));const{sensitivity:o,onFinish:A}=this.options,s=1+ne(t,-50,50)*o/100,a=r.getZoom();yield r.zoomTo(a*s,n,i),null==A||A()}),this.onReset=()=>De(this,void 0,void 0,function*(){yield this.context.graph.zoomTo(1,this.options.animation)}),this.preventDefault=t=>{this.options.preventDefault&&t.preventDefault()},this.shortcut=new Wy(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:e}=this.options;if(this.shortcut.unbindAll(),Array.isArray(e))if(e.includes(t.CommonEvent.PINCH))this.shortcut.bind([t.CommonEvent.PINCH],t=>{this.zoom(t.scale,t,!1)});else{const n=this.context.canvas.getContainer();null==n||n.addEventListener(t.CommonEvent.WHEEL,this.preventDefault),this.shortcut.bind([...e,t.CommonEvent.WHEEL],t=>{const{deltaX:e,deltaY:n}=t;this.zoom(-(null!=n?n:e),t,!1)})}if("object"==typeof e){const{zoomIn:t=[],zoomOut:n=[],reset:r=[]}=e;this.shortcut.bind(t,t=>this.zoom(10,t,this.options.animation)),this.shortcut.bind(n,t=>this.zoom(-10,t,this.options.animation)),this.shortcut.bind(r,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Gt(e)?e(t):!!e}destroy(){var e;this.shortcut.destroy(),null===(e=this.context.canvas.getContainer())||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.preventDefault),super.destroy()}}function UE(t,e,n,r="height"){const i=t[r],o=e[r];return"center"===n?(i+o)/2:t.height}QE.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};const NE=Object.assign,TE={getId:t=>t.id||t.name,getPreH:t=>t.preH||0,getPreV:t=>t.preV||0,getHGap:t=>t.hgap||18,getVGap:t=>t.vgap||18,getChildren:t=>t.children,getHeight:t=>t.height||36,getWidth(t){const e=t.label||" ";return t.width||18*e.split("").length}};let OE=class t{constructor(e,n){if(this.x=0,this.y=0,this.depth=0,this.children=[],this.hgap=0,this.vgap=0,e instanceof t||"x"in e&&"y"in e&&"children"in e){const t=e;return this.data=t.data,this.id=t.id,this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.depth=t.depth,this.children=t.children,this.parent=t.parent,this.hgap=t.hgap,this.vgap=t.vgap,this.preH=t.preH,void(this.preV=t.preV)}this.data=e;const r=n.getHGap(e),i=n.getVGap(e);this.preH=n.getPreH(e),this.preV=n.getPreV(e),this.width=n.getWidth(e),this.height=n.getHeight(e),this.width+=this.preH,this.height+=this.preV,this.id=n.getId(e),this.addGap(r,i)}isRoot(){return 0===this.depth}isLeaf(){return 0===this.children.length}addGap(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e}eachNode(t){let e,n=[this];for(;e=n.shift();)t(e),n=e.children.concat(n)}DFTraverse(t){this.eachNode(t)}BFTraverse(t){let e,n=[this];for(;e=n.shift();)t(e),n=n.concat(e.children)}getBoundingBox(){const t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(e=>{t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t}translate(t=0,e=0){this.eachNode(n=>{n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})}right2left(){const t=this.getBoundingBox();this.eachNode(e=>{e.x=e.x-2*(e.x-t.left)-e.width}),this.translate(t.width,0)}bottom2top(){const t=this.getBoundingBox();this.eachNode(e=>{e.y=e.y-2*(e.y-t.top)-e.height}),this.translate(0,t.height)}};function IE(t,e={},n){e=NE({},TE,e);const r=new OE(t,e),i=[r];let o;if(!n&&!t.collapsed)for(;o=i.shift();)if(!o.data.collapsed){const t=e.getChildren(o.data),n=t?t.length:0;if(o.children=new Array(n),t&&n)for(let r=0;r<n;r++){const n=new OE(t[r],e);o.children[r]=n,i.push(n),n.parent=o,n.depth=o.depth+1}}return r}let LE=class{constructor(t,e={}){this.options=e,this.rootNode=IE(t,e)}execute(){throw new Error("please override this method")}},PE=class t{constructor(t=0,e=0,n=0,r=[]){this.x=0,this.prelim=0,this.mod=0,this.shift=0,this.change=0,this.tl=null,this.tr=null,this.el=null,this.er=null,this.msel=0,this.mser=0,this.w=t||0,this.h=e||0,this.y=n||0,this.c=r||[],this.cs=r.length}static fromNode(e,n){if(!e)return null;const r=[];return e.children.forEach(e=>{const i=t.fromNode(e,n);i&&r.push(i)}),n?new t(e.height,e.width,e.x,r):new t(e.width,e.height,e.y,r)}};function DE(t,e,n){n?t.y+=e:t.x+=e,t.children.forEach(t=>{DE(t,e,n)})}function RE(t,e){let n=e?t.y:t.x;return t.children.forEach(t=>{n=Math.min(RE(t,e),n)}),n}function HE(t,e){DE(t,-RE(t,e),e)}function _E(t,e,n){n?e.y=t.x:e.x=t.x,t.c.forEach((t,r)=>{_E(t,e.children[r],n)})}function GE(t,e,n=0){e?(t.x=n,n+=t.width):(t.y=n,n+=t.height),t.children.forEach(t=>{GE(t,e,n)})}function KE(t,e={}){const n=e.isHorizontal;function r(t){0===t.cs?(t.el=t,t.er=t,t.msel=t.mser=0):(t.el=t.c[0].el,t.msel=t.c[0].msel,t.er=t.c[t.cs-1].er,t.mser=t.c[t.cs-1].mser)}function i(t,e,n){let r=t.c[e-1],i=r.mod,c=t.c[e],l=c.mod;for(;null!==r&&null!==c;){n&&a(r)>n.low&&(n=n.nxt);const u=i+r.prelim+r.w-(l+c.prelim);u>0&&(l+=u,n&&o(t,e,n.index,u));const h=a(r),d=a(c);h<=d&&(r=s(r),null!==r&&(i+=r.mod)),h>=d&&(c=A(c),null!==c&&(l+=c.mod))}!r&&c?function(t,e,n,r){const i=t.c[0].el;i.tl=n;const o=r-n.mod-t.c[0].msel;i.mod+=o,i.prelim-=o,t.c[0].el=t.c[e].el,t.c[0].msel=t.c[e].msel}(t,e,c,l):r&&!c&&function(t,e,n,r){const i=t.c[e].er;i.tr=n;const o=r-n.mod-t.c[e].mser;i.mod+=o,i.prelim-=o,t.c[e].er=t.c[e-1].er,t.c[e].mser=t.c[e-1].mser}(t,e,r,i)}function o(t,e,n,r){t.c[e].mod+=r,t.c[e].msel+=r,t.c[e].mser+=r,function(t,e,n,r){if(n!==e-1){const i=e-n;t.c[n+1].shift+=r/i,t.c[e].shift-=r/i,t.c[e].change-=r-r/i}}(t,e,n,r)}function A(t){return 0===t.cs?t.tl:t.c[0]}function s(t){return 0===t.cs?t.tr:t.c[t.cs-1]}function a(t){return t.y+t.h}function c(t,e,n){for(;null!==n&&t>=n.low;)n=n.nxt;return{low:t,index:e,nxt:n}}GE(t,n);const l=PE.fromNode(t,n);return l&&(function t(e){if(0===e.cs)return void r(e);t(e.c[0]);let n=c(a(e.c[0].el),0,null);for(let r=1;r<e.cs;++r){t(e.c[r]);const o=a(e.c[r].er);i(e,r,n),n=c(o,r,n)}!function(t){t.prelim=(t.c[0].prelim+t.c[0].mod+t.c[t.cs-1].mod+t.c[t.cs-1].prelim+t.c[t.cs-1].w)/2-t.w/2}(e),r(e)}(l),function t(e,n){n+=e.mod,e.x=e.prelim+n,function(t){let e=0,n=0;for(let r=0;r<t.cs;r++)e+=t.c[r].shift,n+=e+t.c[r].change,t.c[r].mod+=n}(e);for(let r=0;r<e.cs;r++)t(e.c[r],n)}(l,0),_E(l,t,n),HE(t,n)),t}function jE(t,e){const n=IE(t.data,e,!0),r=IE(t.data,e,!0),i=t.children.length,o=Math.round(i/2),A=e.getSide||function(t,e){return e<o?"right":"left"};for(let e=0;e<i;e++){const i=t.children[e];"right"===A(i,e)?r.children.push(i):n.children.push(i)}return n.eachNode(t=>{t.isRoot()||(t.side="left")}),r.eachNode(t=>{t.isRoot()||(t.side="right")}),{left:n,right:r}}const zE=["LR","RL","TB","BT","H","V"],VE=["LR","RL","H"],WE=zE[0];function YE(t,e,n){const r=e.direction||WE;if(e.isHorizontal=(t=>VE.indexOf(t)>-1)(r),-1===zE.indexOf(r))throw new TypeError(`Invalid direction: ${r}`);if(r===zE[0])n(t,e);else if(r===zE[1])n(t,e),t.right2left();else if(r===zE[2])n(t,e);else if(r===zE[3])n(t,e),t.bottom2top();else if(r===zE[4]||r===zE[5]){const{left:r,right:i}=jE(t,e);n(r,e),n(i,e),e.isHorizontal?r.right2left():r.bottom2top(),i.translate(r.x-i.x,r.y-i.y),t.x=r.x,t.y=i.y;const o=t.getBoundingBox();e.isHorizontal?o.top<0&&t.translate(0,-o.top):o.left<0&&t.translate(-o.left,0)}let i=e.fixedRoot;return void 0===i&&(i=!0),i&&t.translate(-(t.x+t.width/2+t.hgap),-(t.y+t.height/2+t.vgap)),function(t,e){if(e.radial){const[n,r]=e.isHorizontal?["x","y"]:["y","x"],i={x:1/0,y:1/0},o={x:-1/0,y:-1/0};let A=0;t.DFTraverse(t=>{A++;const{x:e,y:n}=t;i.x=Math.min(i.x,e),i.y=Math.min(i.y,n),o.x=Math.max(o.x,e),o.y=Math.max(o.y,n)});const s=o[r]-i[r];if(0===s)return;const a=2*Math.PI/A;t.DFTraverse(e=>{const o=e[r],A=i[r],c=e[n],l=t[n],u=(o-A)/s*(2*Math.PI-a)+a,h=c-l;e.x=Math.cos(u)*h,e.y=Math.sin(u)*h})}}(t,e),t}let XE=class extends LE{execute(){return YE(this.rootNode,this.options,KE)}};const qE={};function $E(t,e){const n=NE({},qE,e);return new XE(t,n).execute()}let ZE=class{constructor(t=0,e=[]){this.x=0,this.y=0,this.leftChild=null,this.rightChild=null,this.isLeaf=!1,this.height=t,this.children=e}};const JE={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function tx(t,e,n){n?(e.x=t.x,e.y=t.y):(e.x=t.y,e.y=t.x),t.children.forEach((t,r)=>{tx(t,e.children[r],n)})}function ex(t,e={}){const n=NE({},JE,e);let r=0,i=null;const o=function t(e){e.width=0,e.depth&&e.depth>r&&(r=e.depth);const n=e.children,i=n.length,o=new ZE(0,[]);return n.forEach((e,n)=>{const r=t(e);o.children.push(r),0===n&&(o.leftChild=r),n===i-1&&(o.rightChild=r)}),o.originNode=e,o.isLeaf=e.isLeaf(),o}(t);return function t(e){if(e.isLeaf||0===e.children.length)e.drawingDepth=r;else{const n=e.children.map(e=>t(e)),r=Math.min(...n);e.drawingDepth=r-1}return e.drawingDepth}(o),function t(e){e.x=e.drawingDepth*n.rankSep,e.isLeaf?(e.y=0,i&&(e.y=i.y+i.height+n.nodeSep,e.originNode.parent!==i.originNode.parent&&(e.y+=n.subTreeSep)),i=e):(e.children.forEach(e=>{t(e)}),e.y=(e.leftChild.y+e.rightChild.y)/2)}(o),tx(o,t,n.isHorizontal),t}class nx extends LE{execute(){return this.rootNode.width=0,YE(this.rootNode,this.options,ex)}}const rx={};function ix(t,e){const n=NE({},rx,e);return new nx(t,n).execute()}function ox(t,e,n,r){let i=null;t.eachNode(t=>{!function(t,e,n,r,i){const o=("function"==typeof n?n(t):n)*t.depth;if(!r)try{if(t.parent&&t.id===t.parent.children[0].id)return t.x+=o,void(t.y=e?e.y:0)}catch{}if(t.x+=o,e){if(t.y=e.y+UE(e,t,i),e.parent&&t.parent&&t.parent.id!==e.parent.id){const n=e.parent,r=n.y+UE(n,t,i);t.y=r>t.y?r:t.y}}else t.y=0}(t,i,e,n,r),i=t})}const Ax=["LR","RL","H"],sx=Ax[0];let ax=class extends LE{execute(){const t=this.options,e=this.rootNode;t.isHorizontal=!0;const{indent:n=20,dropCap:r=!0,direction:i=sx,align:o}=t;if(i&&-1===Ax.indexOf(i))throw new TypeError(`Invalid direction: ${i}`);if(i===Ax[0])ox(e,n,r,o);else if(i===Ax[1])ox(e,n,r,o),e.right2left();else if(i===Ax[2]){const{left:i,right:A}=jE(e,t);ox(i,n,r,o),i.right2left(),ox(A,n,r,o);const s=i.getBoundingBox();A.translate(s.width,0),e.x=A.x-e.width/2}return e}};const cx={};function lx(t,e){const n=NE({},cx,e);return new ax(t,n).execute()}function ux(t,e){let n=0;return t.children.length?t.children.forEach(t=>{n+=ux(t,e)}):n=t.height,t._subTreeSep=e.getSubTreeSep(t.data),t.totalHeight=Math.max(t.height,n)+2*t._subTreeSep,t.totalHeight}function hx(t){const e=t.children,n=e.length;if(n){e.forEach(t=>{hx(t)});const r=e[0],i=e[n-1],o=i.y-r.y+i.height;let A=0;if(e.forEach(t=>{A+=t.totalHeight}),o>t.height)t.y=r.y+o/2-t.height/2;else if(1!==e.length||t.height>A){const n=t.y+(t.height-o)/2-r.y;e.forEach(t=>{t.translate(0,n)})}else t.y=(r.y+r.height/2+i.y+i.height/2)/2-t.height/2}}const dx={getSubTreeSep:()=>0};function fx(t,e={}){return e=NE({},dx,e),t.parent={x:0,width:0,height:0,y:0},t.BFTraverse(t=>{t.x=t.parent.x+t.parent.width}),t.parent=void 0,ux(t,e),t.startY=0,t.y=t.totalHeight/2-t.height/2,t.eachNode(t=>{const e=t.children,n=e.length;if(n){const r=e[0];if(r.startY=t.startY+t._subTreeSep,1===n)r.y=t.y+t.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(let t=1;t<n;t++){const n=e[t];n.startY=e[t-1].startY+e[t-1].totalHeight,n.y=n.startY+n.totalHeight/2-n.height/2}}}}),hx(t),t}class gx extends LE{execute(){return YE(this.rootNode,this.options,fx)}}const px={};function vx(t,e){const n=NE({},px,e);return new gx(t,n).execute()}function mx(t,e,n,r){return new(n||(n=Promise))(function(e,i){function o(t){try{s(r.next(t))}catch(t){i(t)}}function A(t){try{s(r.throw(t))}catch(t){i(t)}}function s(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n(function(t){t(r)})).then(o,A)}s((r=r.apply(t,[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const yx={abs:Math.abs,ceil:Math.ceil,floor:Math.floor,max:Math.max,min:Math.min,round:Math.round,sqrt:Math.sqrt,pow:Math.pow};class wx extends Error{constructor(t,e,n){super(t),this.position=e,this.token=n,this.name="ExpressionError"}}var bx;!function(t){t[t.STRING=0]="STRING",t[t.NUMBER=1]="NUMBER",t[t.BOOLEAN=2]="BOOLEAN",t[t.NULL=3]="NULL",t[t.IDENTIFIER=4]="IDENTIFIER",t[t.OPERATOR=5]="OPERATOR",t[t.FUNCTION=6]="FUNCTION",t[t.DOT=7]="DOT",t[t.BRACKET_LEFT=8]="BRACKET_LEFT",t[t.BRACKET_RIGHT=9]="BRACKET_RIGHT",t[t.PAREN_LEFT=10]="PAREN_LEFT",t[t.PAREN_RIGHT=11]="PAREN_RIGHT",t[t.COMMA=12]="COMMA",t[t.QUESTION=13]="QUESTION",t[t.COLON=14]="COLON",t[t.DOLLAR=15]="DOLLAR"}(bx||(bx={}));const Bx=new Set([32,9,10,13]),Ex=new Set([43,45,42,47,37,33,38,124,61,60,62]),xx=new Map([["true",bx.BOOLEAN],["false",bx.BOOLEAN],["null",bx.NULL]]),Cx=new Map([["===",!0],["!==",!0],["<=",!0],[">=",!0],["&&",!0],["||",!0],["+",!0],["-",!0],["*",!0],["/",!0],["%",!0],["!",!0],["<",!0],[">",!0]]),Mx=new Map([[46,bx.DOT],[91,bx.BRACKET_LEFT],[93,bx.BRACKET_RIGHT],[40,bx.PAREN_LEFT],[41,bx.PAREN_RIGHT],[44,bx.COMMA],[63,bx.QUESTION],[58,bx.COLON],[36,bx.DOLLAR]]),Fx=new Map;for(const[t,e]of Mx.entries())Fx.set(t,{type:e,value:String.fromCharCode(t)});function kx(t){return t>=48&&t<=57}function Sx(t){return t>=97&&t<=122||t>=65&&t<=90||95===t}function Qx(t){return Sx(t)||kx(t)}function Ux(t){return Ex.has(t)}var Nx;!function(t){t[t.Program=0]="Program",t[t.Literal=1]="Literal",t[t.Identifier=2]="Identifier",t[t.MemberExpression=3]="MemberExpression",t[t.CallExpression=4]="CallExpression",t[t.BinaryExpression=5]="BinaryExpression",t[t.UnaryExpression=6]="UnaryExpression",t[t.ConditionalExpression=7]="ConditionalExpression"}(Nx||(Nx={}));const Tx=new Map([["||",2],["&&",3],["===",4],["!==",4],[">",5],[">=",5],["<",5],["<=",5],["+",6],["-",6],["*",7],["/",7],["%",7],["!",8]]),Ox={type:Nx.Literal,value:null},Ix={type:Nx.Literal,value:!0},Lx={type:Nx.Literal,value:!1},Px=t=>{let e=0;const n=t.length,r=()=>e>=n?null:t[e],i=()=>t[e++],o=t=>{const e=r();return null!==e&&e.type===t},A=t=>t.type===bx.OPERATOR?Tx.get(t.value)||-1:t.type===bx.DOT||t.type===bx.BRACKET_LEFT?9:t.type===bx.QUESTION?1:-1,s=t=>{let n,A;if(i().type===bx.DOT){if(!o(bx.IDENTIFIER)){const t=r();throw new wx("Expected property name",e,t?t.value:"<end of input>")}const t=i();n={type:Nx.Identifier,name:t.value},A=!1}else{if(n=c(0),!o(bx.BRACKET_RIGHT)){const t=r();throw new wx("Expected closing bracket",e,t?t.value:"<end of input>")}i(),A=!0}return{type:Nx.MemberExpression,object:t,property:n,computed:A}},a=()=>{const t=r();if(!t)throw new wx("Unexpected end of input",e,"<end of input>");if(t.type===bx.OPERATOR&&("!"===t.value||"-"===t.value)){i();const e=a();return{type:Nx.UnaryExpression,operator:t.value,argument:e,prefix:!0}}switch(t.type){case bx.NUMBER:return i(),{type:Nx.Literal,value:Number(t.value)};case bx.STRING:return i(),{type:Nx.Literal,value:t.value};case bx.BOOLEAN:return i(),"true"===t.value?Ix:Lx;case bx.NULL:return i(),Ox;case bx.IDENTIFIER:return i(),{type:Nx.Identifier,name:t.value};case bx.FUNCTION:return(()=>{const t=i(),n=[];if(!o(bx.PAREN_LEFT)){const t=r();throw new wx("Expected opening parenthesis after function name",e,t?t.value:"<end of input>")}for(i();;){if(o(bx.PAREN_RIGHT)){i();break}if(!r()){const t=r();throw new wx("Expected closing parenthesis",e,t?t.value:"<end of input>")}if(n.length>0){if(!o(bx.COMMA)){const t=r();throw new wx("Expected comma between function arguments",e,t?t.value:"<end of input>")}i()}const t=c(0);n.push(t)}return{type:Nx.CallExpression,callee:{type:Nx.Identifier,name:t.value},arguments:n}})();case bx.PAREN_LEFT:{i();const t=c(0);if(!o(bx.PAREN_RIGHT)){const t=r();throw new wx("Expected closing parenthesis",e,t?t.value:"<end of input>")}return i(),t}default:throw new wx(`Unexpected token: ${t.type}`,e,t.value)}},c=(l=0)=>{let u=a();for(;e<n;){const n=t[e],a=A(n);if(a<=l)break;if(n.type!==bx.QUESTION)if(n.type!==bx.OPERATOR){if(n.type!==bx.DOT&&n.type!==bx.BRACKET_LEFT)break;u=s(u)}else{i();const t=c(a);u={type:Nx.BinaryExpression,operator:n.value,left:u,right:t}}else{i();const t=c(0);if(!o(bx.COLON)){const t=r();throw new wx("Expected : in conditional expression",e,t?t.value:"<end of input>")}i();const n=c(0);u={type:Nx.ConditionalExpression,test:u,consequent:t,alternate:n}}}return u},l=c();return{type:Nx.Program,body:l}},Dx=(t,e,n)=>{let r=e;n&&(r={...e,context:{...e.context,...n}});const i=t=>{switch(t.type){case Nx.Literal:return(t=>t.value)(t);case Nx.Identifier:return(t=>{if(!(t.name in r.context))throw new wx(`Undefined variable: ${t.name}`);return r.context[t.name]})(t);case Nx.MemberExpression:return(t=>{const e=i(t.object);if(null==e)throw new wx("Cannot access property of null or undefined");return e[t.computed?i(t.property):t.property.name]})(t);case Nx.CallExpression:return(t=>{const e=r.functions[t.callee.name];if(!e)throw new wx(`Undefined function: ${t.callee.name}`);return e(...t.arguments.map(t=>i(t)))})(t);case Nx.BinaryExpression:return(t=>{if("&&"===t.operator){const e=i(t.left);return e?i(t.right):e}if("||"===t.operator)return i(t.left)||i(t.right);const e=i(t.left),n=i(t.right);switch(t.operator){case"+":return e+n;case"-":return e-n;case"*":return e*n;case"/":return e/n;case"%":return e%n;case"===":return e===n;case"!==":return e!==n;case">":return e>n;case">=":return e>=n;case"<":return e<n;case"<=":return e<=n;default:throw new wx(`Unknown operator: ${t.operator}`)}})(t);case Nx.UnaryExpression:return(t=>{const e=i(t.argument);if(t.prefix)switch(t.operator){case"!":return!e;case"-":if("number"!=typeof e)throw new wx(`Cannot apply unary - to non-number: ${e}`);return-e;default:throw new wx(`Unknown operator: ${t.operator}`)}throw new wx(`Postfix operators are not supported: ${t.operator}`)})(t);case Nx.ConditionalExpression:return(t=>{const e=i(t.test);return i(e?t.consequent:t.alternate)})(t);default:throw new wx(`Evaluation error: Unsupported node type: ${t.type}`)}};return i(t.body)};function Rx(t){const e=(t=>{const e=t,n=e.length,r=new Array(Math.ceil(n/3));let i=0,o=0;function A(t){const r=o+1;o++;let i="",A=!1;for(;o<n;){const n=e.charCodeAt(o);if(n===t)return A||(i=e.substring(r,o)),o++,{type:bx.STRING,value:i};92===n?(A||(i=e.substring(r,o),A=!0),o++,i+=e[o]):A&&(i+=e[o]),o++}throw new wx(`Unterminated string starting with ${String.fromCharCode(t)}`,o,e.substring(Math.max(0,o-10),o))}function s(){const t=o;for(45===e.charCodeAt(o)&&o++;o<n&&kx(e.charCodeAt(o));)o++;if(o<n&&46===e.charCodeAt(o))for(o++;o<n&&kx(e.charCodeAt(o));)o++;const r=e.slice(t,o);return{type:bx.NUMBER,value:r}}function a(){o++;const t=o;if(o<n&&Sx(e.charCodeAt(o)))for(o++;o<n&&Qx(e.charCodeAt(o));)o++;const r=e.slice(t,o);return{type:bx.FUNCTION,value:r}}function c(){const t=o++;for(;o<n&&Qx(e.charCodeAt(o));)o++;const r=e.slice(t,o),i=xx.get(r);return i?{type:i,value:r}:{type:bx.IDENTIFIER,value:r}}function l(){if(o+2<n){const t=e.substring(o,o+3);if(Cx.has(t))return o+=3,{type:bx.OPERATOR,value:t}}if(o+1<n){const t=e.substring(o,o+2);if(Cx.has(t))return o+=2,{type:bx.OPERATOR,value:t}}const t=e[o];if(Cx.has(t))return o++,{type:bx.OPERATOR,value:t};throw new wx(`Unknown operator at position ${o}: ${e.substring(o,o+1)}`,o,e.substring(Math.max(0,o-10),o))}for(;o<n;){const t=e.charCodeAt(o);if(u=t,Bx.has(u)){o++;continue}const h=Fx.get(t);if(h)r[i++]=h,o++;else if(34!==t&&39!==t)if(kx(t)||45===t&&o+1<n&&kx(e.charCodeAt(o+1)))r[i++]=s();else if(64!==t)if(Sx(t))r[i++]=c();else{if(!Ux(t))throw new wx(`Unexpected character: ${e[o]}`,o,e.substring(Math.max(0,o-10),o));r[i++]=l()}else r[i++]=a();else r[i++]=A(t)}var u;return i===r.length?r:r.slice(0,i)})(t),n=Px(e),r=((t={},e={})=>({context:t,functions:e}))({},yx);return(t={})=>Dx(n,r,t)}function Hx(t,e){if("string"!=typeof t)return;const n=t.trim();if(n)try{return Rx(n),function(t,e={}){return Rx(t)(e)}(n,e)}catch(t){return}}function _x(t){return"number"==typeof t}function Gx(t){if(!t)return[0,0,0];if(_x(t))return[t,t,t];if(Array.isArray(t)&&0===t.length)return[0,0,0];const[e,n=e,r=e]=t;return[e,n,r]}function Kx(t){return null==t}function jx(t){return"string"==typeof t}function zx(t){return"function"==typeof t}function Vx(t,e){if("function"==typeof t)return t;if("string"==typeof t){const n=t;return(...t)=>{const r={};for(let n=0;n<e.length;n++)r[e[n]]=t[n];return Hx(n,r)}}return()=>t}function Wx(t,e,n="node"){if(Kx(t))return()=>e;if(jx(t)){const r=Vx(t,[n]);return t=>{const n=r(t);return _x(n)?n:e}}return zx(t)?t:_x(t)?()=>t:()=>e}function Yx(t,e=10,n="node"){if(Kx(t))return()=>e;if(jx(t)){const r=Vx(t,[n]);return t=>{const n=r(t);return function(t){return!!_x(t)||!!Array.isArray(t)&&t.every(t=>_x(t))}(n)?n:e}}return zx(t)?t:_x(t)||Array.isArray(t)?()=>t:()=>e}const Xx=(t,e,n=10,r=0)=>{const i=Yx(e,r),o=Yx(t,n);return t=>{const[e,n,r]=Gx(o(t)),[A,s,a]=Gx(i(t));return[e+A,n+s,r+a]}};function qx(t){var e;return[t.x,t.y,null!==(e=t.z)&&void 0!==e?e:0]}class $x{constructor(t,e={}){this.edgeIdCounter=new Map,this.nodeMap=function(t,e){if(!t)throw new Error("Data.nodes is required");const n=new Map;for(const r of t){const t={_original:r};for(const e of Zx){const n=r[e];Kx(n)||(t[e]=n)}if(e){const n=e(r);for(const e in n){const r=n[e];Kx(r)||(t[e]=r)}}if(Kx(t.id))throw new Error("Node is missing id field");n.set(t.id,t)}return n}(t.nodes,e.node),this.edgeMap=function(t,e,n){const r=new Map;for(const i of t){const t={_original:i};for(const e of Jx){const n=i[e];Kx(n)||(t[e]=n)}if(e){const n=e(i);for(const e in n){const r=n[e];Kx(r)||(t[e]=r)}}if(Kx(t.source)||Kx(t.target))throw new Error("Edge is missing source or target field");Kx(t.id)&&(t.id=null==n?void 0:n(i)),r.set(t.id,t)}return r}(t.edges||[],e.edge,this.getEdgeId.bind(this))}data(){return{nodes:this.nodeMap,edges:this.edgeMap}}replace(t){this.nodeMap=t.nodes,this.edgeMap=t.edges,this.clearCache()}nodes(){return Array.from(this.nodeMap.values())}node(t){return this.nodeMap.get(t)}nodeAt(t){this.indexNodeCache||this.buildNodeIndexCache();const e=this.indexNodeCache.get(t);return e?this.nodeMap.get(e):void 0}nodeIndexOf(t){var e;return this.nodeIndexCache||this.buildNodeIndexCache(),null!==(e=this.nodeIndexCache.get(t))&&void 0!==e?e:-1}firstNode(){return this.nodeMap.values().next().value}forEachNode(t){let e=0;this.nodeMap.forEach(n=>t(n,e++))}originalNode(t){const e=this.nodeMap.get(t);return null==e?void 0:e._original}nodeCount(){return this.nodeMap.size}edges(){return Array.from(this.edgeMap.values())}edge(t){return this.edgeMap.get(t)}firstEdge(){return this.edgeMap.values().next().value}forEachEdge(t){let e=0;this.edgeMap.forEach(n=>t(n,e++))}originalEdge(t){const e=this.edgeMap.get(t);return null==e?void 0:e._original}edgeCount(){return this.edgeMap.size}getEdgeId(t){if(t.id)return t.id;const e=`${t.source}-${t.target}`,n=this.edgeIdCounter.get(e)||0,r=0===n?e:`${e}-${n}`;return this.edgeIdCounter.set(e,n+1),r}degree(t,e="both"){this.degreeCache||this.buildDegreeCache();const n=this.degreeCache.get(t);return n?n[e]:0}neighbors(t,e="both"){if(this.outAdjacencyCache&&this.inAdjacencyCache||this.buildAdjacencyCache(),"out"===e)return Array.from(this.outAdjacencyCache.get(t)||[]);if("in"===e)return Array.from(this.inAdjacencyCache.get(t)||[]);if(this.bothAdjacencyCache)return Array.from(this.bothAdjacencyCache.get(t)||[]);const n=this.inAdjacencyCache.get(t),r=this.outAdjacencyCache.get(t);if(!n&&!r)return[];if(!n)return Array.from(r);if(!r)return Array.from(n);const i=new Set;return n.forEach(t=>i.add(t)),r.forEach(t=>i.add(t)),Array.from(i)}successors(t){return this.neighbors(t,"out")}predecessors(t){return this.neighbors(t,"in")}setNodeOrder(t){const e=new Map;for(const n of t)e.set(n.id,n);this.nodeMap=e,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}clearCache(){this.degreeCache=void 0,this.inAdjacencyCache=void 0,this.outAdjacencyCache=void 0,this.bothAdjacencyCache=void 0,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}buildDegreeCache(){this.degreeCache=new Map;for(const t of this.edges()){const{source:e,target:n}=t;if(t.source===t.target)continue;this.degreeCache.has(e)||this.degreeCache.set(e,{in:0,out:0,both:0});const r=this.degreeCache.get(t.source);r&&(r.out++,r.both++),this.degreeCache.has(n)||this.degreeCache.set(n,{in:0,out:0,both:0});const i=this.degreeCache.get(t.target);i&&(i.in++,i.both++)}}buildAdjacencyCache(){this.inAdjacencyCache=new Map,this.outAdjacencyCache=new Map;for(const t of this.edges())this.nodeMap.has(t.source)&&this.nodeMap.has(t.target)&&(this.outAdjacencyCache.has(t.source)||this.outAdjacencyCache.set(t.source,new Set),this.outAdjacencyCache.get(t.source).add(t.target),this.inAdjacencyCache.has(t.target)||this.inAdjacencyCache.set(t.target,new Set),this.inAdjacencyCache.get(t.target).add(t.source))}buildNodeIndexCache(){this.nodeIndexCache=new Map,this.indexNodeCache=new Map;let t=0;this.nodeMap.forEach((e,n)=>{this.nodeIndexCache.set(n,t),this.indexNodeCache.set(t,n),t++})}destroy(){this.clearCache(),this.nodeMap.clear(),this.edgeMap.clear(),this.edgeIdCounter.clear()}}const Zx=["id","x","y","z","vx","vy","vz","fx","fy","fz","parentId"],Jx=["id","source","target","points"];function tC(t,e,n,r=2){t.forEachNode(t=>{Kx(t.x)&&(t.x=Math.random()*e),Kx(t.y)&&(t.y=Math.random()*n),3===r&&Kx(t.z)&&(t.z=Math.random()*Math.min(e,n))})}class eC{constructor(t,e={}){this.graph=new $x(t,e)}export(){return this.graph.data()}replace(t){this.graph.replace(t)}forEachNode(t){this.graph.forEachNode(t)}forEachEdge(t){this.graph.forEachEdge((e,n)=>{e.sourceNode=this.graph.node(e.source),e.targetNode=this.graph.node(e.target),t(e,n)})}destroy(){this.graph.destroy()}}
56
+ /**
57
+ * @license
58
+ * Copyright 2019 Google LLC
59
+ * SPDX-License-Identifier: Apache-2.0
60
+ */const nC=Symbol("Comlink.proxy"),rC=Symbol("Comlink.endpoint"),iC=Symbol("Comlink.releaseProxy"),oC=Symbol("Comlink.finalizer"),AC=Symbol("Comlink.thrown"),sC=t=>"object"==typeof t&&null!==t||"function"==typeof t,aC=new Map([["proxy",{canHandle:t=>sC(t)&&t[nC],serialize(t){const{port1:e,port2:n}=new MessageChannel;return cC(t,e),[n,[n]]},deserialize:t=>(t.start(),uC(t))}],["throw",{canHandle:t=>sC(t)&&AC in t,serialize({value:t}){let e;return e=t instanceof Error?{isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:{isError:!1,value:t},[e,[]]},deserialize(t){if(t.isError)throw Object.assign(new Error(t.value.message),t.value);throw t.value}}]]);function cC(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(i){if(!i||!i.data)return;if(!function(t,e){for(const n of t){if(e===n||"*"===n)return!0;if(n instanceof RegExp&&n.test(e))return!0}return!1}(n,i.origin))return void console.warn(`Invalid origin '${i.origin}' for comlink proxy`);const{id:o,type:A,path:s}=Object.assign({path:[]},i.data),a=(i.data.argumentList||[]).map(wC);let c;try{const e=s.slice(0,-1).reduce((t,e)=>t[e],t),n=s.reduce((t,e)=>t[e],t);switch(A){case"GET":c=n;break;case"SET":e[s.slice(-1)[0]]=wC(i.data.value),c=!0;break;case"APPLY":c=n.apply(e,a);break;case"CONSTRUCT":c=function(t){return Object.assign(t,{[nC]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:e,port2:n}=new MessageChannel;cC(t,n),c=function(t,e){return mC.set(t,e),t}(e,[e])}break;case"RELEASE":c=void 0;break;default:return}}catch(t){c={value:t,[AC]:0}}Promise.resolve(c).catch(t=>({value:t,[AC]:0})).then(n=>{const[i,s]=yC(n);e.postMessage(Object.assign(Object.assign({},i),{id:o}),s),"RELEASE"===A&&(e.removeEventListener("message",r),lC(e),oC in t&&"function"==typeof t[oC]&&t[oC]())}).catch(t=>{const[n,r]=yC({value:new TypeError("Unserializable return value"),[AC]:0});e.postMessage(Object.assign(Object.assign({},n),{id:o}),r)})}),e.start&&e.start()}function lC(t){(function(t){return"MessagePort"===t.constructor.name})(t)&&t.close()}function uC(t,e){const n=new Map;return t.addEventListener("message",function(t){const{data:e}=t;if(!e||!e.id)return;const r=n.get(e.id);if(r)try{r(e)}finally{n.delete(e.id)}}),pC(t,n,[],e)}function hC(t){if(t)throw new Error("Proxy has been released and is not useable")}function dC(t){return bC(t,new Map,{type:"RELEASE"}).then(()=>{lC(t)})}const fC=new WeakMap,gC="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(fC.get(t)||0)-1;fC.set(t,e),0===e&&dC(t)});function pC(t,e,n=[],r=function(){}){let i=!1;const o=new Proxy(r,{get(r,A){if(hC(i),A===iC)return()=>{!function(t){gC&&gC.unregister(t)}(o),dC(t),e.clear(),i=!0};if("then"===A){if(0===n.length)return{then:()=>o};const r=bC(t,e,{type:"GET",path:n.map(t=>t.toString())}).then(wC);return r.then.bind(r)}return pC(t,e,[...n,A])},set(r,o,A){hC(i);const[s,a]=yC(A);return bC(t,e,{type:"SET",path:[...n,o].map(t=>t.toString()),value:s},a).then(wC)},apply(r,o,A){hC(i);const s=n[n.length-1];if(s===rC)return bC(t,e,{type:"ENDPOINT"}).then(wC);if("bind"===s)return pC(t,e,n.slice(0,-1));const[a,c]=vC(A);return bC(t,e,{type:"APPLY",path:n.map(t=>t.toString()),argumentList:a},c).then(wC)},construct(r,o){hC(i);const[A,s]=vC(o);return bC(t,e,{type:"CONSTRUCT",path:n.map(t=>t.toString()),argumentList:A},s).then(wC)}});return function(t,e){const n=(fC.get(e)||0)+1;fC.set(e,n),gC&&gC.register(t,e,t)}(o,t),o}function vC(t){const e=t.map(yC);return[e.map(t=>t[0]),(n=e.map(t=>t[1]),Array.prototype.concat.apply([],n))];var n}const mC=new WeakMap;function yC(t){for(const[e,n]of aC)if(n.canHandle(t)){const[r,i]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},i]}return[{type:"RAW",value:t},mC.get(t)||[]]}function wC(t){switch(t.type){case"HANDLER":return aC.get(t.name).deserialize(t.value);case"RAW":return t.value}}function bC(t,e,n,r){return new Promise(i=>{const o=new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-");e.set(o,i),t.start&&t.start(),t.postMessage(Object.assign({id:o},n),r)})}class BC{constructor(){this.worker=null,this.workerApi=null}execute(t,e,n){return mx(this,0,void 0,function*(){if(this.worker||(yield this.initWorker()),!this.workerApi)throw new Error("Worker API not initialized");return yield this.workerApi.execute(t,e,n)})}destroy(){this.workerApi&&this.workerApi.destroy(),this.worker&&(this.worker.terminate(),this.worker=null,this.workerApi=null)}initWorker(){return mx(this,0,void 0,function*(){const t=this.resolveWorkerPath(),e=t.includes("/lib/")||t.endsWith(".mjs")?"module":"classic";this.worker=new Worker(t,{type:e}),this.workerApi=uC(this.worker)})}resolveWorkerPath(){const t=(()=>{if("undefined"==typeof document)return null;const t=document.currentScript;if(null==t?void 0:t.src)return t.src;const e=document.getElementsByTagName("script");for(let t=e.length-1;t>=0;t--){const n=e[t].src;if(n&&(n.includes("index.js")||n.includes("index.min.js")))return n}return null})();if(t){if(t.includes("index.js")||t.includes("index.min.js")){const e=t.replace(/index(\.min)?\.(m?js)(\?.*)?$/,"worker.js");if(e!==t)return e}const e=t.replace(/\/runtime\/[^/]+\.(m?js)(\?.*)?$/,"/worker.js");if(e!==t)return e;const n=t.replace(/\/[^/]+\.(m?js)(\?.*)?$/,"/worker.js");if(n!==t)return n}return"./worker.js"}}class EC{constructor(t){this.supervisor=null,this.initialOptions=this.mergeOptions(this.getDefaultOptions(),t)}get options(){return this.runtimeOptions||this.initialOptions}mergeOptions(t,e){return Object.assign({},t,e||{})}execute(t,e){return mx(this,0,void 0,function*(){this.runtimeOptions=this.mergeOptions(this.initialOptions,e);const{node:n,edge:r,enableWorker:i}=this.runtimeOptions;this.context=new eC(t,{node:n,edge:r}),this.model=this.context.graph;i&&"undefined"!=typeof Worker?yield this.layoutInWorker(t,this.runtimeOptions):yield this.layout(this.runtimeOptions)})}layoutInWorker(t,e){var n;return mx(this,0,void 0,function*(){try{this.supervisor||(this.supervisor=new BC);const r=yield this.supervisor.execute(this.id,t,e);null===(n=this.context)||void 0===n||n.replace(r)}catch(t){console.error("Layout in worker failed, fallback to main thread layout.",t),yield this.layout(e)}})}forEachNode(t){this.context.forEachNode(t)}forEachEdge(t){this.context.forEachEdge(t)}destroy(){var t;null===(t=this.context)||void 0===t||t.destroy(),this.model=null,this.context=null,this.supervisor&&(this.supervisor.destroy(),this.supervisor=null)}}class xC extends EC{}function CC(t){return!!t.tick&&!!t.stop}class MC{constructor(t={}){this.options=t,this.nodes=new Map,this.edges=new Map,this.inEdges=new Map,this.outEdges=new Map,this.parentMap=new Map,this.childrenMap=new Map,t.tree&&Array.isArray(t.tree)&&t.tree.length>0&&("string"==typeof t.tree[0]?t.tree.forEach(t=>{this.parentMap.set(t,new Map),this.childrenMap.set(t,new Map)}):(this.attachTreeStructure("default"),this.addTree(t.tree))),t.nodes&&t.nodes.forEach(t=>this.addNode(t)),t.edges&&t.edges.forEach(t=>this.addEdge(t))}addNode(t){this.nodes.has(t.id)||(this.nodes.set(t.id,t),this.inEdges.set(t.id,new Set),this.outEdges.set(t.id,new Set))}addNodes(t){t.forEach(t=>this.addNode(t))}getNode(t){return this.nodes.get(t)}hasNode(t){return this.nodes.has(t)}removeNode(t){if(!this.nodes.has(t))return;const e=Array.from(this.inEdges.get(t)||[]),n=Array.from(this.outEdges.get(t)||[]);e.forEach(t=>this.removeEdge(t)),n.forEach(t=>this.removeEdge(t)),this.nodes.delete(t),this.inEdges.delete(t),this.outEdges.delete(t),this.parentMap.forEach(e=>{e.delete(t)}),this.childrenMap.forEach(e=>{e.delete(t)})}getAllNodes(){return Array.from(this.nodes.values())}addEdge(t){if(!this.nodes.has(t.source)||!this.nodes.has(t.target))throw new Error(`Cannot add edge ${t.id}: source ${t.source} or target ${t.target} does not exist`);this.edges.set(t.id,t),this.outEdges.get(t.source).add(t.id),this.inEdges.get(t.target).add(t.id)}addEdges(t){t.forEach(t=>this.addEdge(t))}getEdge(t){return this.edges.get(t)}hasEdge(t){return this.edges.has(t)}removeEdge(t){var e,n;const r=this.edges.get(t);r&&(this.edges.delete(t),null===(e=this.outEdges.get(r.source))||void 0===e||e.delete(t),null===(n=this.inEdges.get(r.target))||void 0===n||n.delete(t))}getAllEdges(){return Array.from(this.edges.values())}updateEdgeData(t,e){const n=this.edges.get(t);n&&Object.assign(n.data,e)}updateNodeData(t,e){const n=this.nodes.get(t);n&&Object.assign(n.data,e)}getRelatedEdges(t,e="both"){const n=[];if("in"===e||"both"===e){const e=this.inEdges.get(t);e&&e.forEach(t=>{const e=this.edges.get(t);e&&n.push(e)})}if("out"===e||"both"===e){const e=this.outEdges.get(t);e&&e.forEach(t=>{const e=this.edges.get(t);e&&n.push(e)})}return n}getSuccessors(t){const e=this.outEdges.get(t);if(!e||0===e.size)return[];const n=[];return e.forEach(t=>{const e=this.edges.get(t);if(e){const t=this.nodes.get(e.target);t&&n.push(t)}}),n.length>0?n:[]}getPredecessors(t){const e=this.inEdges.get(t);if(!e||0===e.size)return[];const n=[];return e.forEach(t=>{const e=this.edges.get(t);if(e){const t=this.nodes.get(e.source);t&&n.push(t)}}),n.length>0?n:[]}getNeighbors(t){const e=[...this.getSuccessors(t)||[],...this.getPredecessors(t)||[]],n=Array.from(new Map(e.map(t=>[t.id,t])).values());return n.length>0?n:[]}attachTreeStructure(t){this.parentMap.has(t)||(this.parentMap.set(t,new Map),this.childrenMap.set(t,new Map))}addTree(t,e){var n,r;const i=e||(null!==(r=null===(n=this.options.tree)||void 0===n?void 0:n[0])&&void 0!==r?r:"default");this.hasTreeStructure(i)||this.attachTreeStructure(i);const o=Array.isArray(t)?t:[t],A=(t,e)=>{this.addNode({id:t.id,data:t.data}),void 0!==e&&this.setParent(t.id,e,i),t.children&&t.children.length>0&&t.children.forEach(e=>{A(e,t.id)})};o.forEach(t=>A(t))}hasTreeStructure(t){return this.parentMap.has(t)}setParent(t,e,n){var r,i,o;const A=n||(null!==(i=null===(r=this.options.tree)||void 0===r?void 0:r[0])&&void 0!==i?i:"default");this.parentMap.has(A)||this.attachTreeStructure(A);const s=this.parentMap.get(A),a=this.childrenMap.get(A),c=s.get(t);void 0!==c&&(null===(o=a.get(c))||void 0===o||o.delete(t)),s.set(t,e),a.has(e)||a.set(e,new Set),a.get(e).add(t)}getParent(t,e){var n,r;const i=e||(null!==(r=null===(n=this.options.tree)||void 0===n?void 0:n[0])&&void 0!==r?r:"default");this.parentMap.has(i)||this.attachTreeStructure(i);const o=this.parentMap.get(i);if(!o)return;const A=o.get(t);return void 0===A?null:this.nodes.get(A)}getChildren(t,e){var n,r;const i=e||(null!==(r=null===(n=this.options.tree)||void 0===n?void 0:n[0])&&void 0!==r?r:"default"),o=this.childrenMap.get(i);if(!o)return[];const A=o.get(t);return A?Array.from(A).map(t=>this.nodes.get(t)).filter(t=>void 0!==t):[]}getRoots(t){var e,n;const r=t||(null!==(n=null===(e=this.options.tree)||void 0===e?void 0:e[0])&&void 0!==n?n:"default"),i=this.parentMap.get(r),o=[];return this.nodes.forEach(t=>{i&&void 0!==i.get(t.id)||o.push(t)}),o}dfsTree(t,e){const n=[t],r=new Set;for(;n.length>0;){const t=n.pop();if(r.has(t))continue;const i=this.getNode(t);if(i){r.add(t);if(!0===e(i))continue;const o=this.getChildren(t);for(let t=o.length-1;t>=0;t--)r.has(o[t].id)||n.push(o[t].id)}}}}const FC=(t,e)=>{if("next"!==t&&"prev"!==t)return e},kC=t=>{t.prev.next=t.next,t.next.prev=t.prev,delete t.next,delete t.prev};let SC=class{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return kC(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&kC(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,FC)),n=null==n?void 0:n.prev;return`[${t.join(", ")}]`}};class QC extends SC{}const UC=()=>1,NC=(t,e,n)=>{let r=[];const i=e[e.length-1],o=e[0];let A;for(;t.getAllNodes().length;){for(;A=o.dequeue();)TC(t,e,n,A);for(;A=i.dequeue();)TC(t,e,n,A);if(t.getAllNodes().length)for(let i=e.length-2;i>0;--i)if(A=e[i].dequeue(),A){r=r.concat(TC(t,e,n,A,!0));break}}return r},TC=(t,e,n,r,i)=>{var o,A;const s=[];return t.hasNode(r.v)&&(null===(o=t.getRelatedEdges(r.v,"in"))||void 0===o||o.forEach(r=>{const o=r.data.weight,A=t.getNode(r.source);i&&s.push({v:r.source,w:r.target,in:0,out:0}),void 0===A.data.out&&(A.data.out=0),A.data.out-=o,IC(e,n,Object.assign({v:A.id},A.data))}),null===(A=t.getRelatedEdges(r.v,"out"))||void 0===A||A.forEach(r=>{const i=r.data.weight,o=r.target,A=t.getNode(o);void 0===A.data.in&&(A.data.in=0),A.data.in-=i,IC(e,n,Object.assign({v:A.id},A.data))}),t.removeNode(r.v)),i?s:void 0},OC=(t,e)=>{const n=new MC;let r=0,i=0;t.getAllNodes().forEach(t=>{n.addNode({id:t.id,data:{v:t.id,in:0,out:0}})}),t.getAllEdges().forEach(t=>{const o=n.getRelatedEdges(t.source,"out").find(e=>e.target===t.target),A=(null==e?void 0:e(t))||1;o?n.updateEdgeData(null==o?void 0:o.id,Object.assign(Object.assign({},o.data),{weight:o.data.weight+A})):n.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:A}}),i=Math.max(i,n.getNode(t.source).data.out+=A),r=Math.max(r,n.getNode(t.target).data.in+=A)});const o=[],A=i+r+3;for(let t=0;t<A;t++)o.push(new QC);const s=r+1;return n.getAllNodes().forEach(t=>{IC(o,s,Object.assign({v:t.id},n.getNode(t.id).data))}),{buckets:o,zeroIdx:s,graph:n}},IC=(t,e,n)=>{n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)},LC=(t,e)=>{const n=((t,e)=>{var n;if(t.getAllNodes().length<=1)return[];const r=OC(t,e||UC);return null===(n=NC(r.graph,r.buckets,r.zeroIdx).map(e=>t.getRelatedEdges(e.v,"out").filter(({target:t})=>t===e.w)))||void 0===n?void 0:n.flat()})(t,t=>t.data.weight||1);null==n||n.forEach(e=>{const n=e.data;t.removeEdge(e.id),n.forwardName=e.data.name,n.reversed=!0,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign({},n)})})},PC=(t,e,n,r)=>{let i;do{i=`${r}${Math.random()}`}while(t.hasNode(i));return n.dummy=e,t.addNode({id:i,data:n}),i},DC=t=>{const e=new MC;return t.getAllNodes().forEach(n=>{t.getChildren(n.id).length||e.addNode(Object.assign({},n))}),t.getAllEdges().forEach(t=>{e.addEdge(t)}),e},RC=(t,e)=>{const n=Number(t.x),r=Number(t.y),i=Number(e.x)-n,o=Number(e.y)-r;let A,s,a=Number(t.width)/2,c=Number(t.height)/2;return i||o?(Math.abs(o)*a>Math.abs(i)*c?(o<0&&(c=-c),A=c*i/o,s=c):(i<0&&(a=-a),A=a,s=a*o/i),{x:n+A,y:r+s}):{x:0,y:0}},HC=t=>{const e=[],n=GC(t)+1;for(let t=0;t<n;t++)e.push([]);t.getAllNodes().forEach(t=>{const n=t.data.rank;void 0!==n&&e[n]&&e[n].push(t.id)});for(let r=0;r<n;r++)e[r]=e[r].sort((e,n)=>{return r=t.getNode(e).data.order,i=t.getNode(n).data.order,Number(r)-Number(i);var r,i});return e},_C=(t,e,n,r)=>{const i={width:0,height:0};return _x(n)&&_x(r)&&(i.rank=n,i.order=r),PC(t,"border",i,e)},GC=t=>{let e;return t.getAllNodes().forEach(t=>{const n=t.data.rank;void 0!==n&&(void 0===e||n>e)&&(e=n)}),e||(e=0),e},KC=(t,e)=>t.reduce((t,n)=>e(t)>e(n)?n:t),jC=(t,e,n,r,i,o)=>{if(!r.includes(e.id)){r.push(e.id),n||o.push(e.id);const A=i(e.id);A&&A.forEach(e=>jC(t,e,n,r,i,o)),n&&o.push(e.id)}},zC=(t,e,n,r)=>{const i=Array.isArray(e)?e:[e],o=e=>t.getNeighbors(e),A=[],s=[];return i.forEach(e=>{if(!t.hasNode(e.id))throw new Error(`Graph does not have node: ${e}`);jC(t,e,"post"===n,s,o,A)}),A},VC=(t,e,n,r,i,o)=>{const A={rank:o,borderType:e,width:0,height:0},s=o-i.data.minRank,a=i.data[e][s-1],c=PC(t,"border",A,n);i.data[e][s]=c,t.setParent(c,r),a&&t.addEdge({id:`e${Math.random()}`,source:a,target:c,data:{weight:1}})},WC=t=>{t.getAllNodes().forEach(t=>{YC(t)}),t.getAllEdges().forEach(t=>{YC(t)})},YC=t=>{const e=t.data.width;t.data.width=t.data.height,t.data.height=e},XC=t=>{t.getAllNodes().forEach(t=>{qC(t.data)}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>qC(t)),t.data.hasOwnProperty("y")&&qC(t.data)})},qC=t=>{(null==t?void 0:t.y)&&(t.y=-t.y)},$C=t=>{t.getAllNodes().forEach(t=>{ZC(t.data)}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>ZC(t)),t.data.hasOwnProperty("x")&&ZC(t.data)})},ZC=t=>{const e=t.x;t.x=t.y,t.y=e},JC=(t,e,n,r,i,o,A)=>{const s=t.getChildren(A);if(!(null==s?void 0:s.length))return void(A!==e&&t.addEdge({id:`e${Math.random()}`,source:e,target:A,data:{weight:0,minlen:n}}));const a=_C(t,"_bt"),c=_C(t,"_bb"),l=t.getNode(A);t.setParent(a,A),l.data.borderTop=a,t.setParent(c,A),l.data.borderBottom=c,null==s||s.forEach(s=>{JC(t,e,n,r,i,o,s.id);const l=s.data.borderTop?s.data.borderTop:s.id,u=s.data.borderBottom?s.data.borderBottom:s.id,h=s.data.borderTop?r:2*r,d=l!==u?1:i-o[A]+1;t.addEdge({id:`e${Math.random()}`,source:a,target:l,data:{minlen:d,weight:h,nestingEdge:!0}}),t.addEdge({id:`e${Math.random()}`,source:u,target:c,data:{minlen:d,weight:h,nestingEdge:!0}})}),t.getParent(A)||t.addEdge({id:`e${Math.random()}`,source:e,target:a,data:{weight:0,minlen:i+o[A]}})},tM=t=>{const e={},n=(r,i)=>{const o=t.getChildren(r);null==o||o.forEach(t=>n(t.id,i+1)),e[r]=i};return t.getRoots().forEach(t=>n(t.id,1)),e},eM=t=>{let e=0;return t.getAllEdges().forEach(t=>{e+=t.data.weight}),e},nM="edge-label",rM=(t,e,n)=>{let r=e.source,i=t.getNode(r).data.rank;const o=e.target,A=t.getNode(o).data.rank,s=e.data.labelRank;if(A===i+1)return;let a,c,l;for(t.removeEdge(e.id),l=0,++i;i<A;++l,++i)e.data.points=[],c={originalEdge:e,width:0,height:0,rank:i},a=PC(t,"edge",c,"_d"),i===s&&(c.width=e.data.width,c.height=e.data.height,c.dummy=nM,c.labelpos=e.data.labelpos),t.addEdge({id:`e${Math.random()}`,source:r,target:a,data:{weight:e.data.weight}}),0===l&&n.push(a),r=a;t.addEdge({id:`e${Math.random()}`,source:r,target:o,data:{weight:e.data.weight}})},iM=t=>{let e;for(;t.hasNode(e=`_root${Math.random()}`););return e},oM=(t,e,n)=>{const r=((t,e)=>null==t?void 0:t.reduce((t,n,r)=>(t[n]=e[r],t),{}))(n,n.map((t,e)=>e)),i=e.map(e=>{const n=t.getRelatedEdges(e,"out").map(t=>({pos:r[t.target]||0,weight:t.data.weight}));return null==n?void 0:n.sort((t,e)=>t.pos-e.pos)}),o=i.flat().filter(t=>void 0!==t);let A=1;for(;A<n.length;)A<<=1;const s=2*A-1;A-=1;const a=Array(s).fill(0,0,s);let c=0;return null==o||o.forEach(t=>{if(t){let e=t.pos+A;a[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=a[e+1]),e=e-1>>1,a[e]+=t.weight;c+=t.weight*n}}),c},AM=(t,e)=>{let n=0;for(let r=1;r<(null==e?void 0:e.length);r+=1)n+=oM(t,e[r-1],e[r]);return n},sM=t=>{const e={},n=t.getAllNodes(),r=n.map(t=>{var e;return null!==(e=t.data.rank)&&void 0!==e?e:-1/0}),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o.push([]);const A=n.sort((e,n)=>t.getNode(e.id).data.rank-t.getNode(n.id).data.rank),s=A.filter(e=>void 0!==t.getNode(e.id).data.fixorder),a=s.sort((e,n)=>t.getNode(e.id).data.fixorder-t.getNode(n.id).data.fixorder);return null==a||a.forEach(n=>{isNaN(t.getNode(n.id).data.rank)||o[t.getNode(n.id).data.rank].push(n.id),e[n.id]=!0}),null==A||A.forEach(n=>t.dfsTree(n.id,t=>{if(e.hasOwnProperty(t.id))return!0;e[t.id]=!0,isNaN(t.data.rank)||o[t.data.rank].push(t.id)})),o},aM=t=>{var e,n;const r=[];for(;null==t?void 0:t.length;){const i=t.pop();r.push(i),null===(e=i.in.reverse())||void 0===e||e.forEach(t=>{return(e=i,t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&cM(e,t)})(t);var e}),null===(n=i.out)||void 0===n||n.forEach(e=>{return(n=i,e=>{e.in.push(n),0===--e.indegree&&t.push(e)})(e);var n})}const i=r.filter(t=>!t.merged),o=["vs","i","barycenter","weight"];return i.map(t=>{const e={};return null==o||o.forEach(n=>{void 0!==t[n]&&(e[n]=t[n])}),e})},cM=(t,e)=>{var n;let r=0,i=0;t.weight&&(r+=t.barycenter*t.weight,i+=t.weight),e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),t.vs=null===(n=e.vs)||void 0===n?void 0:n.concat(t.vs),t.barycenter=r/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0},lM=(t,e,n)=>{let r,i=n;for(;e.length&&(r=e[e.length-1]).i<=i;)e.pop(),null==t||t.push(r.vs),i++;return i},uM=(t,e)=>(n,r)=>{if(void 0!==n.fixorder&&void 0!==r.fixorder)return n.fixorder-r.fixorder;if(n.barycenter<r.barycenter)return-1;if(n.barycenter>r.barycenter)return 1;if(e&&void 0!==n.order&&void 0!==r.order){if(n.order<r.order)return-1;if(n.order>r.order)return 1}return t?r.i-n.i:n.i-r.i},hM=(t,e,n,r,i,o)=>{var A,s,a,c;let l=t.getChildren(e).map(t=>t.id);const u=t.getNode(e),h=u?u.data.borderLeft:void 0,d=u?u.data.borderRight:void 0,f={};h&&(l=null==l?void 0:l.filter(t=>t!==h&&t!==d));const g=((t,e)=>e.map(e=>{const n=t.getRelatedEdges(e,"in");if(!(null==n?void 0:n.length))return{v:e};const r={sum:0,weight:0};return null==n||n.forEach(e=>{const n=t.getNode(e.source);r.sum+=e.data.weight*n.data.order,r.weight+=e.data.weight}),{v:e,barycenter:r.sum/r.weight,weight:r.weight}}))(t,l||[]);null==g||g.forEach(e=>{var i;if(null===(i=t.getChildren(e.v))||void 0===i?void 0:i.length){const i=hM(t,e.v,n,r,o);f[e.v]=i,i.hasOwnProperty("barycenter")&&fM(e,i)}});const p=((t,e)=>{var n,r,i;const o={};null==t||t.forEach((t,e)=>{o[t.v]={i:e,indegree:0,in:[],out:[],vs:[t.v]};const n=o[t.v];void 0!==t.barycenter&&(n.barycenter=t.barycenter,n.weight=t.weight)}),null===(n=e.getAllEdges())||void 0===n||n.forEach(t=>{const e=o[t.source],n=o[t.target];void 0!==e&&void 0!==n&&(n.indegree++,e.out.push(o[t.target]))});const A=null===(i=(r=Object.values(o)).filter)||void 0===i?void 0:i.call(r,t=>!t.indegree);return aM(A)})(g,n);dM(p,f),null===(A=p.filter(t=>t.vs.length>0))||void 0===A||A.forEach(e=>{const n=t.getNode(e.vs[0]);n&&(e.fixorder=n.data.fixorder,e.order=n.data.order)});const v=((t,e,n,r)=>{const i=((t,e)=>{const n={lhs:[],rhs:[]};return null==t||t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n})(t,t=>{const e=t.hasOwnProperty("fixorder")&&!isNaN(t.fixorder);return r?!e&&t.hasOwnProperty("barycenter"):e||t.hasOwnProperty("barycenter")}),o=i.lhs,A=i.rhs.sort((t,e)=>-t.i- -e.i),s=[];let a=0,c=0,l=0;null==o||o.sort(uM(!!e,!!n)),l=lM(s,A,l),null==o||o.forEach(t=>{var e;l+=null===(e=t.vs)||void 0===e?void 0:e.length,s.push(t.vs),a+=t.barycenter*t.weight,c+=t.weight,l=lM(s,A,l)});const u={vs:s.flat()};return c&&(u.barycenter=a/c,u.weight=c),u})(p,r,i,o);if(h&&(v.vs=[h,v.vs,d].flat(),null===(s=t.getPredecessors(h))||void 0===s?void 0:s.length)){const e=t.getNode((null===(a=t.getPredecessors(h))||void 0===a?void 0:a[0].id)||""),n=t.getNode((null===(c=t.getPredecessors(d))||void 0===c?void 0:c[0].id)||"");v.hasOwnProperty("barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+e.data.order+n.data.order)/(v.weight+2),v.weight+=2}return v},dM=(t,e)=>{null==t||t.forEach(t=>{var n;const r=null===(n=t.vs)||void 0===n?void 0:n.map(t=>e[t]?e[t].vs:t);t.vs=r.flat()})},fM=(t,e)=>{void 0!==t.barycenter?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)};function gM(t){return Array.isArray(t)}var pM=function(t){if("object"!=typeof t||null===t)return t;var e;if(gM(t)){e=[];for(var n=0,r=t.length;n<r;n++)"object"==typeof t[n]&&null!=t[n]?e[n]=pM(t[n]):e[n]=t[n]}else for(var i in e={},t)"object"==typeof t[i]&&null!=t[i]?e[i]=pM(t[i]):e[i]=t[i];return e};const vM=(t,e,n)=>e.map(e=>((t,e,n)=>{const r=iM(t),i=new MC;return i.addNode({id:r,data:{}}),t.getAllNodes().forEach(o=>{var A,s;const a=t.getParent(o.id);(o.data.rank===e||o.data.minRank<=e&&e<=o.data.maxRank)&&(i.hasNode(o.id)||i.addNode(Object.assign({},o)),(null==a?void 0:a.id)&&!i.hasNode(null==a?void 0:a.id)&&i.addNode(Object.assign({},a)),i.setParent(o.id,(null==a?void 0:a.id)||r),t.getRelatedEdges(o.id,n).forEach(e=>{const n=e.source===o.id?e.target:e.source;i.hasNode(n)||i.addNode(Object.assign({},t.getNode(n)));const r=i.getRelatedEdges(n,"out").find(({target:t})=>t===o.id),A=void 0!==r?r.data.weight:0;r?i.updateEdgeData(r.id,Object.assign(Object.assign({},r.data),{weight:e.data.weight+A})):i.addEdge({id:e.id,source:n,target:o.id,data:{weight:e.data.weight+A}})}),o.data.hasOwnProperty("minRank")&&i.updateNodeData(o.id,Object.assign(Object.assign({},o.data),{borderLeft:[null===(A=o.data.borderLeft)||void 0===A?void 0:A[e-o.data.minRank]],borderRight:[null===(s=o.data.borderRight)||void 0===s?void 0:s[e-o.data.minRank]]})))}),i})(t,e,n)),mM=(t,e,n,r)=>{const i=new MC;null==t||t.forEach(t=>{var o;const A=t.getRoots()[0].id,s=hM(t,A,i,e,n,r);for(let e=0;e<(null===(o=s.vs)||void 0===o?void 0:o.length);e++){const n=t.getNode(s.vs[e]);n&&(n.data.order=e)}((t,e,n)=>{const r={};let i;null==n||n.forEach(n=>{let o,A,s=t.getParent(n);for(;s;){if(o=t.getParent(s.id),o?(A=r[o.id],r[o.id]=s.id):(A=i,i=s.id),A&&A!==s.id)return e.hasNode(A)||e.addNode({id:A,data:{}}),e.hasNode(s.id)||e.addNode({id:s.id,data:{}}),void(e.hasEdge(`e${A}-${s.id}`)||e.addEdge({id:`e${A}-${s.id}`,source:A,target:s.id,data:{}}));s=o}})})(t,i,s.vs)})},yM=(t,e)=>{null==e||e.forEach(e=>{null==e||e.forEach((e,n)=>{t.getNode(e).data.order=n})})},wM=(t,e)=>{const n=(t=>{const e={};let n=0;const r=i=>{const o=n;t.getChildren(i).forEach(t=>r(t.id)),e[i]={low:o,lim:n++}};return t.getRoots().forEach(t=>r(t.id)),e})(t);e.forEach(e=>{var r,i;let o=e,A=t.getNode(o);const s=A.data.originalEdge;if(!s)return;const a=((t,e,n,r)=>{var i,o;const A=[],s=[],a=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);let l,u;l=n;do{l=null===(i=t.getParent(l))||void 0===i?void 0:i.id,A.push(l)}while(l&&(e[l].low>a||c>e[l].lim));for(u=l,l=r;l&&l!==u;)s.push(l),l=null===(o=t.getParent(l))||void 0===o?void 0:o.id;return{lca:u,path:A.concat(s.reverse())}})(t,n,s.source,s.target),c=a.path,l=a.lca;let u=0,h=c[u],d=!0;for(;o!==s.target;){if(A=t.getNode(o),d){for(;h!==l&&(null===(r=t.getNode(h))||void 0===r?void 0:r.data.maxRank)<A.data.rank;)u++,h=c[u];h===l&&(d=!1)}if(!d){for(;u<c.length-1&&(null===(i=t.getNode(c[u+1]))||void 0===i?void 0:i.data.minRank)<=A.data.rank;)u++;h=c[u]}t.hasNode(h)&&t.setParent(o,h),o=t.getSuccessors(o)[0].id}})},bM=(t,e)=>{const n={};function r(e,r){const i=function(t){return JSON.stringify(t.slice(1))}(e);r.get(i)||(!function(e,r,i,o,A){var s,a;let c;for(let l=r;l<i;l++)c=e[l],(null===(s=t.getNode(c))||void 0===s?void 0:s.data.dummy)&&(null===(a=t.getPredecessors(c))||void 0===a||a.forEach(e=>{const r=t.getNode(e.id);r.data.dummy&&(r.data.order<o||r.data.order>A)&&EM(n,e.id,c)}))}(...e),r.set(i,!0))}const i=(e,n)=>{let i,o=-1,A=0;const s=new Map;return null==n||n.forEach((a,c)=>{var l;if("border"===(null===(l=t.getNode(a))||void 0===l?void 0:l.data.dummy)){const e=t.getPredecessors(a)||[];e.length&&(i=t.getNode(e[0].id).data.order,r([n,A,c,o,i],s),A=c,o=i)}r([n,A,n.length,i,e.length],s)}),n};return(null==e?void 0:e.length)&&e.reduce(i),n},BM=(t,e)=>{var n,r;if(null===(n=t.getNode(e))||void 0===n?void 0:n.data.dummy)return null===(r=t.getPredecessors(e))||void 0===r?void 0:r.find(e=>t.getNode(e.id).data.dummy)},EM=(t,e,n)=>{let r=e,i=n;if(r>i){const t=r;r=i,i=t}let o=t[r];o||(t[r]=o={}),o[i]=!0},xM=(t,e,n)=>{let r=e,i=n;if(r>n){r=n,i=e}return!!t[r]},CM=(t,e,n,r,i,o)=>{const A=new MC,s=MM(r,i,o);return null==e||e.forEach(e=>{let r;null==e||e.forEach(e=>{const i=n[e];if(A.hasNode(i)||A.addNode({id:i,data:{}}),r){const o=n[r],a=A.getRelatedEdges(o,"out").find(t=>t.target===i);a?A.updateEdgeData(a.id,Object.assign(Object.assign({},a.data),{weight:Math.max(s(t,e,r),a.data.weight||0)})):A.addEdge({id:`e${Math.random()}`,source:o,target:i,data:{weight:Math.max(s(t,e,r),0)}})}r=e})}),A};const MM=(t,e,n)=>(r,i,o)=>{const A=r.getNode(i),s=r.getNode(o);let a=0,c=0;if(a+=A.data.width/2,A.data.hasOwnProperty("labelpos"))switch((A.data.labelpos||"").toLowerCase()){case"l":c=-A.data.width/2;break;case"r":c=A.data.width/2}if(c&&(a+=n?c:-c),c=0,a+=(A.data.dummy?e:t)/2,a+=(s.data.dummy?e:t)/2,a+=s.data.width/2,s.data.labelpos)switch((s.data.labelpos||"").toLowerCase()){case"l":c=s.data.width/2;break;case"r":c=-s.data.width/2}return c&&(a+=n?c:-c),c=0,a},FM=(t,e)=>t.getNode(e).data.width||0,kM=(t,e)=>{const{align:n,nodesep:r=0,edgesep:i=0}=e||{},o=HC(t),A=Object.assign(((t,e)=>{const n={},r=(e,r)=>{let i=0,o=0;const A=e.length,s=null==r?void 0:r[(null==r?void 0:r.length)-1];return null==r||r.forEach((e,a)=>{var c;const l=BM(t,e),u=l?t.getNode(l.id).data.order:A;(l||e===s)&&(null===(c=r.slice(o,a+1))||void 0===c||c.forEach(e=>{var r;null===(r=t.getPredecessors(e))||void 0===r||r.forEach(r=>{var o;const A=t.getNode(r.id),s=A.data.order;!(s<i||u<s)||A.data.dummy&&(null===(o=t.getNode(e))||void 0===o?void 0:o.data.dummy)||EM(n,r.id,e)})}),o=a+1,i=u)}),r};return(null==e?void 0:e.length)&&e.reduce(r),n})(t,o),bM(t,o)),s={};let a=[];["u","d"].forEach(e=>{a="u"===e?o:Object.values(o).reverse(),["l","r"].forEach(n=>{"r"===n&&(a=a.map(t=>Object.values(t).reverse()));const o=("u"===e?t.getPredecessors:t.getSuccessors).bind(t),c=((t,e,n,r)=>{const i={},o={},A={};return null==e||e.forEach(t=>{null==t||t.forEach((t,e)=>{i[t]=t,o[t]=t,A[t]=e})}),null==e||e.forEach(t=>{let e=-1;null==t||t.forEach(t=>{let s=r(t).map(t=>t.id);if(s.length){s=s.sort((t,e)=>A[t]-A[e]);const r=(s.length-1)/2;for(let a=Math.floor(r),c=Math.ceil(r);a<=c;++a){const r=s[a];o[t]===t&&e<A[r]&&!xM(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=A[r])}}})}),{root:i,align:o}})(0,a,A,o),l=((t,e,n,r,i,o,A)=>{var s;const a={},c=CM(t,e,n,i,o,A),l=A?"borderLeft":"borderRight",u=(t,e)=>{let n=c.getAllNodes(),r=n.pop();const i={};for(;r;)i[r.id]?t(r.id):(i[r.id]=!0,n.push(r),n=n.concat(e(r.id))),r=n.pop()};return u(t=>{a[t]=(c.getRelatedEdges(t,"in")||[]).reduce((t,e)=>Math.max(t,(a[e.source]||0)+e.data.weight),0)},c.getPredecessors.bind(c)),u(e=>{const n=(c.getRelatedEdges(e,"out")||[]).reduce((t,e)=>Math.min(t,(a[e.target]||0)-e.data.weight),Number.POSITIVE_INFINITY),r=t.getNode(e);n!==Number.POSITIVE_INFINITY&&r.data.borderType!==l&&(a[e]=Math.max(a[e],n))},c.getSuccessors.bind(c)),null===(s=Object.values(r))||void 0===s||s.forEach(t=>{a[t]=a[n[t]]}),a})(t,a,c.root,c.align,r,i,"r"===n);"r"===n&&Object.keys(l).forEach(t=>l[t]=-l[t]),s[e+n]=l})});const c=((t,e)=>KC(Object.values(e),e=>{var n;let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return null===(n=Object.keys(e))||void 0===n||n.forEach(n=>{const o=e[n],A=FM(t,n)/2;r=Math.max(o+A,r),i=Math.min(o-A,i)}),r-i}))(t,s);return c&&function(t,e){const n=Object.values(e),r=Math.min(...n),i=Math.max(...n);["u","d"].forEach(n=>{["l","r"].forEach(o=>{const A=n+o,s=t[A];let a;if(s===e)return;const c=Object.values(s);a="l"===o?r-Math.min(...c):i-Math.max(...c),a&&(t[A]={},Object.keys(s).forEach(e=>{t[A][e]=s[e]+a}))})})}(s,c),((t,e)=>{const n={};return Object.keys(t.ul).forEach(r=>{if(e)n[r]=t[e.toLowerCase()][r];else{const e=Object.values(t).map(t=>t[r]);n[r]=(e[0]+e[1])/2}}),n})(s,n)},SM=(t,e)=>{var n;const r=DC(t);((t,e)=>{const{ranksep:n=0}=e||{},r=HC(t);let i=0;null==r||r.forEach(e=>{const r=e.map(e=>t.getNode(e).data.height),o=Math.max(...r,0);null==e||e.forEach(e=>{t.getNode(e).data.y=i+o/2}),i+=o+n})})(r,e);const i=kM(r,e);null===(n=Object.keys(i))||void 0===n||n.forEach(t=>{r.getNode(t).data.x=i[t]})},QM=t=>{const e={},n=r=>{var i;const o=t.getNode(r);if(!o)return 0;if(e[r])return o.data.rank;let A;return e[r]=!0,null===(i=t.getRelatedEdges(r,"out"))||void 0===i||i.forEach(t=>{const e=n(t.target)-t.data.minlen;e&&(void 0===A||e<A)&&(A=e)}),A||(A=0),o.data.rank=A,A};t.getAllNodes().filter(e=>0===t.getRelatedEdges(e.id,"in").length).forEach(t=>n(t.id))},UM=(t,e)=>t.getNode(e.target).data.rank-t.getNode(e.source).data.rank-e.data.minlen,NM=(t,e)=>{const n=r=>{e.getRelatedEdges(r,"both").forEach(i=>{const o=i.source,A=r===o?i.target:o;t.hasNode(A)||UM(e,i)||(t.addNode({id:A,data:{}}),t.addEdge({id:i.id,source:r,target:A,data:{}}),n(A))})};return t.getAllNodes().forEach(t=>n(t.id)),t.getAllNodes().length},TM=(t,e)=>{const n=r=>{var i;null===(i=e.getRelatedEdges(r,"both"))||void 0===i||i.forEach(i=>{const o=i.source,A=r===o?i.target:o;t.hasNode(A)||void 0===e.getNode(A).data.layer&&UM(e,i)||(t.addNode({id:A,data:{}}),t.addEdge({id:i.id,source:r,target:A,data:{}}),n(A))})};return t.getAllNodes().forEach(t=>n(t.id)),t.getAllNodes().length},OM=(t,e)=>KC(e.getAllEdges(),n=>t.hasNode(n.source)!==t.hasNode(n.target)?UM(e,n):1/0),IM=(t,e,n)=>{t.getAllNodes().forEach(t=>{const r=e.getNode(t.id);r.data.rank||(r.data.rank=0),r.data.rank+=n})},LM=t=>{const e=(t=>{const e=new MC;return t.getAllNodes().forEach(t=>{e.addNode(Object.assign({},t))}),t.getAllEdges().forEach(t=>{const n=e.getRelatedEdges(t.source,"out").find(e=>e.target===t.target);n?e.updateEdgeData(null==n?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+t.data.weight||0,minlen:Math.max(n.data.minlen,t.data.minlen||1)})):e.addEdge({id:t.id,source:t.source,target:t.target,data:{weight:t.data.weight||0,minlen:t.data.minlen||1}})}),e})(t);QM(e);const n=(t=>{const e=new MC({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);NM(e,t)<r;)i=OM(e,t),o=e.hasNode(i.source)?UM(t,i):-UM(t,i),IM(e,t,o);return e})(e);let r,i;for(HM(n),PM(n,e);r=GM(n);)i=KM(n,e,r),jM(n,e,r,i)},PM=(t,e)=>{let n=zC(t,t.getAllNodes(),"post");n=n.slice(0,(null==n?void 0:n.length)-1),n.forEach(n=>{DM(t,e,n)})},DM=(t,e,n)=>{const r=t.getNode(n).data.parent,i=t.getRelatedEdges(n,"both").find(t=>t.target===r||t.source===r);i.data.cutvalue=RM(t,e,n)},RM=(t,e,n)=>{const r=t.getNode(n).data.parent;let i=!0,o=e.getRelatedEdges(n,"out").find(t=>t.target===r),A=0;return o||(i=!1,o=e.getRelatedEdges(r,"out").find(t=>t.target===n)),A=o.data.weight,e.getRelatedEdges(n,"both").forEach(e=>{const o=e.source===n,s=o?e.target:e.source;if(s!==r){const r=o===i,a=e.data.weight;if(A+=r?a:-a,VM(t,n,s)){const e=t.getRelatedEdges(n,"both").find(t=>t.source===s||t.target===s).data.cutvalue;A+=r?-e:e}}}),A},HM=(t,e=t.getAllNodes()[0].id)=>{_M(t,{},1,e)},_M=(t,e,n,r,i)=>{var o;const A=n;let s=n;const a=t.getNode(r);return e[r]=!0,null===(o=t.getNeighbors(r))||void 0===o||o.forEach(n=>{e[n.id]||(s=_M(t,e,s,n.id,r))}),a.data.low=A,a.data.lim=s++,i?a.data.parent=i:delete a.data.parent,s},GM=t=>t.getAllEdges().find(t=>t.data.cutvalue<0),KM=(t,e,n)=>{let r=n.source,i=n.target;e.getRelatedEdges(r,"out").find(t=>t.target===i)||(r=n.target,i=n.source);const o=t.getNode(r),A=t.getNode(i);let s=o,a=!1;o.data.lim>A.data.lim&&(s=A,a=!0);const c=e.getAllEdges().filter(e=>a===WM(t.getNode(e.source),s)&&a!==WM(t.getNode(e.target),s));return KC(c,t=>UM(e,t))},jM=(t,e,n,r)=>{const i=t.getRelatedEdges(n.source,"both").find(t=>t.source===n.target||t.target===n.target);i&&t.removeEdge(i.id),t.addEdge({id:`e${Math.random()}`,source:r.source,target:r.target,data:{}}),HM(t),PM(t,e),zM(t,e)},zM=(t,e)=>{const n=t.getAllNodes().find(t=>!t.data.parent);let r=zC(t,n,"pre");r=r.slice(1),r.forEach(n=>{const r=t.getNode(n).data.parent;let i=e.getRelatedEdges(n,"out").find(t=>t.target===r),o=!1;!i&&e.hasNode(r)&&(i=e.getRelatedEdges(r,"out").find(t=>t.target===n),o=!0),e.getNode(n).data.rank=(e.hasNode(r)&&e.getNode(r).data.rank||0)+(o?null==i?void 0:i.data.minlen:-(null==i?void 0:i.data.minlen))})},VM=(t,e,n)=>t.getRelatedEdges(e,"both").find(t=>t.source===n||t.target===n),WM=(t,e)=>e.data.low<=t.data.lim&&t.data.lim<=e.data.lim,YM=QM,XM=t=>{(t=>{const e={};let n;const r=i=>{var o;const A=t.getNode(i);if(!A)return 0;if(e[i])return A.data.rank;let s;return e[i]=!0,null===(o=t.getRelatedEdges(i,"out"))||void 0===o||o.forEach(t=>{const e=r(t.target)-t.data.minlen;e&&(void 0===s||e<s)&&(s=e)}),s||(s=0),(void 0===n||s<n)&&(n=s),A.data.rank=s,s};t.getAllNodes().filter(e=>0===t.getRelatedEdges(e.id,"in").length).forEach(t=>{t&&r(t.id)}),void 0===n&&(n=0);const i={},o=(e,n)=>{var r;const A=t.getNode(e),s=isNaN(A.data.layer)?n:A.data.layer;(void 0===A.data.rank||A.data.rank<s)&&(A.data.rank=s),i[e]||(i[e]=!0,null===(r=t.getRelatedEdges(e,"out"))||void 0===r||r.forEach(t=>{o(t.target,s+t.data.minlen)}))};t.getAllNodes().forEach(t=>{const e=t.data;e&&(isNaN(e.layer)?e.rank-=n:o(t.id,e.layer))})})(t),(t=>{const e=new MC({tree:[]}),n=t.getAllNodes()[0],r=t.getAllNodes().length;let i,o;for(e.addNode(n);TM(e,t)<r;)i=OM(e,t),o=e.hasNode(i.source)?UM(t,i):-UM(t,i),IM(e,t,o)})(t)},qM=t=>{LM(t)},$M=(t,e)=>{const{ranker:n,rankdir:r="tb",nodeOrder:i,keepNodeOrder:o,align:A,nodesep:s=50,edgesep:a=20,ranksep:c=50}=e;gF(t),LC(t);const{nestingRoot:l,nodeRankFactor:u}=(t=>{const e=PC(t,"root",{},"_root"),n=tM(t);let r=Math.max(...Object.values(n));Math.abs(r)===1/0&&(r=1);const i=r-1,o=2*i+1;t.getAllEdges().forEach(t=>{t.data.minlen*=o});const A=eM(t)+1;return t.getRoots().forEach(r=>{JC(t,e,o,A,i,n,r.id)}),{nestingRoot:e,nodeRankFactor:o}})(t);((t,e)=>{switch(e){case"network-simplex":qM(t);break;case"tight-tree":default:XM(t);break;case"longest-path":YM(t)}})(DC(t),n),sF(t),((t,e=0)=>{const n=t.getAllNodes(),r=n.filter(t=>void 0!==t.data.rank).map(t=>t.data.rank),i=Math.min(...r),o=[];n.forEach(t=>{const e=(t.data.rank||0)-i;o[e]||(o[e]=[]),o[e].push(t.id)});let A=0;for(let n=0;n<o.length;n++){const r=o[n];void 0===r?n%e!==0&&(A-=1):A&&(null==r||r.forEach(e=>{const n=t.getNode(e);n&&(n.data.rank=n.data.rank||0,n.data.rank+=A)}))}})(t,u),((t,e)=>{e&&t.removeNode(e),t.getAllEdges().forEach(e=>{e.data.nestingEdge&&t.removeEdge(e.id)})})(t,l),(t=>{const e=t.getAllNodes().filter(t=>void 0!==t.data.rank).map(t=>t.data.rank),n=Math.min(...e);t.getAllNodes().forEach(t=>{t.data.hasOwnProperty("rank")&&n!==1/0&&(t.data.rank-=n)})})(t),aF(t),cF(t);const h=[];((t,e)=>{t.getAllEdges().forEach(n=>rM(t,n,e))})(t,h),wM(t,h),(t=>{const e=n=>{const r=t.getChildren(n),i=t.getNode(n);if((null==r?void 0:r.length)&&r.forEach(t=>e(t.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let e=i.data.minRank,r=i.data.maxRank+1;e<r;e+=1)VC(t,"borderLeft","_bl",n,i,e),VC(t,"borderRight","_br",n,i,e)}};t.getRoots().forEach(t=>e(t.id))})(t),o&&((t,e)=>{const n=t.getAllNodes().filter(e=>{var n;return!(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length)}),r=n.map(t=>t.data.rank),i=Math.max(...r),o=[];for(let t=0;t<i+1;t++)o[t]=[];null==e||e.forEach(e=>{const n=t.getNode(e);n&&!n.data.dummy&&(isNaN(n.data.rank)||(n.data.fixorder=o[n.data.rank].length,o[n.data.rank].push(e)))})})(t,i),((t,e)=>{const n=GC(t),r=[],i=[];for(let t=1;t<n+1;t++)r.push(t);for(let t=n-1;t>-1;t--)i.push(t);const o=vM(t,r,"in"),A=vM(t,i,"out");let s=sM(t);yM(t,s);let a,c=Number.POSITIVE_INFINITY;for(let n=0,r=0;r<4;++n,++r){mM(n%2?o:A,n%4>=2,!1,e),s=HC(t);const i=AM(t,s);i<c&&(r=0,a=pM(s),c=i)}s=sM(t),yM(t,s);for(let n=0,r=0;r<4;++n,++r){mM(n%2?o:A,n%4>=2,!0,e),s=HC(t);const i=AM(t,s);i<c&&(r=0,a=pM(s),c=i)}yM(t,a)})(t,o),pF(t),((t,e)=>{const n=e.toLowerCase();"lr"!==n&&"rl"!==n||WC(t)})(t,r),SM(t,{align:A,nodesep:s,edgesep:a,ranksep:c}),vF(t),fF(t),((t,e)=>{e.forEach(e=>{let n=t.getNode(e);const{data:r}=n,i=r.originalEdge;let o;i&&t.addEdge(i);let A=e;for(;n.data.dummy;)o=t.getSuccessors(A)[0],t.removeNode(A),i.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===nM&&(i.data.x=n.data.x,i.data.y=n.data.y,i.data.width=n.data.width,i.data.height=n.data.height),A=o.id,n=t.getNode(A)})})(t,h),hF(t),((t,e)=>{const n=e.toLowerCase();"bt"!==n&&"rl"!==n||XC(t),"lr"!==n&&"rl"!==n||($C(t),WC(t))})(t,r);const{width:d,height:f}=lF(t);return uF(t),dF(t),(t=>{t.getAllEdges().forEach(e=>{const n=e.data;if(n.reversed){t.removeEdge(e.id);const r=n.forwardName;delete n.reversed,delete n.forwardName,t.addEdge({id:e.id,source:e.target,target:e.source,data:Object.assign(Object.assign({},n),{forwardName:r})})}})})(t),{width:d,height:f}},ZM=(t,e)=>{t.getAllNodes().forEach(n=>{const r=t.getNode(n.id);if(e.hasNode(n.id)){const t=e.getNode(n.id);r.data.fixorder=t.data._order,delete t.data._order}else delete r.data.fixorder})},JM=(t,e)=>{t.getAllNodes().forEach(n=>{var r;const i=t.getNode(n.id);if(i){const t=e.getNode(n.id);i.data.x=t.data.x,i.data.y=t.data.y,i.data._order=t.data.order,i.data._rank=t.data.rank,(null===(r=e.getChildren(n.id))||void 0===r?void 0:r.length)&&(i.data.width=t.data.width,i.data.height=t.data.height)}}),t.getAllEdges().forEach(n=>{const r=t.getEdge(n.id),i=e.getEdge(n.id);r.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(r.data.x=i.data.x,r.data.y=i.data.y)})},tF=["width","height","layer","fixorder"],eF={width:0,height:0},nF=["minlen","weight","width","height","labeloffset"],rF={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},iF=["labelpos"],oF=t=>{const e=new MC({tree:[]});return t.getAllNodes().forEach(n=>{const r=yF(t.getNode(n.id).data),i=Object.assign(Object.assign({},eF),r),o=mF(i,tF);e.hasNode(n.id)||e.addNode({id:n.id,data:Object.assign({},o)});const A=t.hasTreeStructure("combo")?t.getParent(n.id,"combo"):t.getParent(n.id);Kx(A)||(e.hasNode(A.id)||e.addNode(Object.assign({},A)),e.setParent(n.id,A.id))}),t.getAllEdges().forEach(n=>{const r=yF(t.getEdge(n.id).data),i={};null==iF||iF.forEach(t=>{void 0!==r[t]&&(i[t]=r[t])}),e.addEdge({id:n.id,source:n.source,target:n.target,data:Object.assign({},rF,mF(r,nF),i)})}),e},AF=(t,e)=>{const{ranksep:n=0,rankdir:r}=e;return t.getAllNodes().forEach(t=>{isNaN(t.data.layer)||t.data.layer||(t.data.layer=0)}),t.getAllEdges().forEach(t=>{var e;t.data.minlen*=2,"c"!==(null===(e=t.data.labelpos)||void 0===e?void 0:e.toLowerCase())&&("TB"===r||"BT"===r?t.data.width+=t.data.labeloffset:t.data.height+=t.data.labeloffset)}),n/2},sF=t=>{t.getAllEdges().forEach(e=>{if(e.data.width&&e.data.height){const n=t.getNode(e.source),r={e:e,rank:(t.getNode(e.target).data.rank-n.data.rank)/2+n.data.rank};PC(t,"edge-proxy",r,"_ep")}})},aF=t=>{let e=0;return t.getAllNodes().forEach(n=>{var r,i;n.data.borderTop&&(n.data.minRank=null===(r=t.getNode(n.data.borderTop))||void 0===r?void 0:r.data.rank,n.data.maxRank=null===(i=t.getNode(n.data.borderBottom))||void 0===i?void 0:i.data.rank,e=Math.max(e,n.data.maxRank||-1/0))}),e},cF=t=>{t.getAllNodes().forEach(e=>{"edge-proxy"===e.data.dummy&&(t.getEdge(e.data.e.id).data.labelRank=e.data.rank,t.removeNode(e.id))})},lF=(t,e)=>{let n,r,i=0,o=0;const{marginx:A=0,marginy:s=0}={},a=t=>{if(!t.data)return;const e=t.data.x,A=t.data.y,s=t.data.width,a=t.data.height;isNaN(e)||isNaN(s)||(void 0===n&&(n=e-s/2),n=Math.min(n,e-s/2),i=Math.max(i,e+s/2)),isNaN(A)||isNaN(a)||(void 0===r&&(r=A-a/2),r=Math.min(r,A-a/2),o=Math.max(o,A+a/2))};return t.getAllNodes().forEach(t=>{a(t)}),t.getAllEdges().forEach(t=>{(null==t?void 0:t.data.hasOwnProperty("x"))&&a(t)}),n-=A,r-=s,t.getAllNodes().forEach(t=>{t.data.x-=n,t.data.y-=r}),t.getAllEdges().forEach(t=>{var e;null===(e=t.data.points)||void 0===e||e.forEach(t=>{t.x-=n,t.y-=r}),t.data.hasOwnProperty("x")&&(t.data.x-=n),t.data.hasOwnProperty("y")&&(t.data.y-=r)}),{width:i-n+A,height:o-r+s}},uF=t=>{t.getAllEdges().forEach(e=>{const n=t.getNode(e.source),r=t.getNode(e.target);let i,o;e.data.points?(i=e.data.points[0],o=e.data.points[e.data.points.length-1]):(e.data.points=[],i={x:r.data.x,y:r.data.y},o={x:n.data.x,y:n.data.y}),e.data.points.unshift(RC(n.data,i)),e.data.points.push(RC(r.data,o))})},hF=t=>{t.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch("l"!==t.data.labelpos&&"r"!==t.data.labelpos||(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset}})},dF=t=>{t.getAllEdges().forEach(t=>{var e;t.data.reversed&&(null===(e=t.data.points)||void 0===e||e.reverse())})},fF=t=>{t.getAllNodes().forEach(e=>{var n,r,i;if(null===(n=t.getChildren(e.id))||void 0===n?void 0:n.length){const n=t.getNode(e.id),o=t.getNode(n.data.borderTop),A=t.getNode(n.data.borderBottom),s=t.getNode(n.data.borderLeft[(null===(r=n.data.borderLeft)||void 0===r?void 0:r.length)-1]),a=t.getNode(n.data.borderRight[(null===(i=n.data.borderRight)||void 0===i?void 0:i.length)-1]);n.data.width=Math.abs((null==a?void 0:a.data.x)-(null==s?void 0:s.data.x))||10,n.data.height=Math.abs((null==A?void 0:A.data.y)-(null==o?void 0:o.data.y))||10,n.data.x=((null==s?void 0:s.data.x)||0)+n.data.width/2,n.data.y=((null==o?void 0:o.data.y)||0)+n.data.height/2}}),t.getAllNodes().forEach(e=>{"border"===e.data.dummy&&t.removeNode(e.id)})},gF=t=>{t.getAllEdges().forEach(e=>{if(e.source===e.target){const n=t.getNode(e.source);n.data.selfEdges||(n.data.selfEdges=[]),n.data.selfEdges.push(e),t.removeEdge(e.id)}})},pF=t=>{const e=HC(t);null==e||e.forEach(e=>{let n=0;null==e||e.forEach((e,r)=>{var i;const o=t.getNode(e);o.data.order=r+n,null===(i=o.data.selfEdges)||void 0===i||i.forEach(e=>{PC(t,"selfedge",{width:e.data.width,height:e.data.height,rank:o.data.rank,order:r+ ++n,e:e},"_se")}),delete o.data.selfEdges})})},vF=t=>{t.getAllNodes().forEach(e=>{const n=t.getNode(e.id);if("selfedge"===n.data.dummy){const r=t.getNode(n.data.e.source),i=r.data.x+r.data.width/2,o=r.data.y,A=n.data.x-i,s=r.data.height/2;t.hasEdge(n.data.e.id)?t.updateEdgeData(n.data.e.id,n.data.e.data):t.addEdge({id:n.data.e.id,source:n.data.e.source,target:n.data.e.target,data:n.data.e.data}),t.removeNode(e.id),n.data.e.data.points=[{x:i+2*A/3,y:o-s},{x:i+5*A/6,y:o-s},{y:o,x:i+A},{x:i+5*A/6,y:o+s},{x:i+2*A/3,y:o+s}],n.data.e.data.x=n.data.x,n.data.e.data.y=n.data.y}})},mF=(t,e)=>{const n={};return null==e||e.forEach(e=>{void 0!==t[e]&&(n[e]=+t[e])}),n},yF=(t={})=>{const e={};return Object.keys(t).forEach(n=>{e[n.toLowerCase()]=t[n]}),e},wF={nodeSize:10,nodeSpacing:0,rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class bF extends EC{constructor(){super(...arguments),this.id="antv-dagre"}getDefaultOptions(){return wF}layout(t){return mx(this,0,void 0,function*(){const{nodeSize:e,nodeSpacing:n,align:r,rankdir:i="TB",ranksep:o,nodesep:A,edgeLabelSpace:s,ranker:a="tight-tree",nodeOrder:c,begin:l,controlPoints:u,radial:h,sortByCombo:d,preset:f,ranksepFunc:g,nodesepFunc:p}=t,v=Wx(g,null!=o?o:50,"node"),m=Wx(p,null!=A?A:50,"node");let y=m,w=v;"LR"!==i&&"RL"!==i||(y=v,w=m);const b=new MC({tree:[]}),B=this.model.nodes(),E=this.model.edges(),x=Xx(e,n,wF.nodeSize,wF.nodeSpacing);B.forEach(t=>{var e;const n=t._original,r=x(n),i=w(n),o=y(n),A=r[0]+2*o,s=r[1]+2*i,a=null===(e=t.data)||void 0===e?void 0:e.layer;_x(a)?b.addNode({id:t.id,data:{width:A,height:s,layer:a,originalWidth:r[0],originalHeight:r[1]}}):b.addNode({id:t.id,data:{width:A,height:s,originalWidth:r[0],originalHeight:r[1]}})}),E.forEach(t=>{b.addEdge({id:t.id,source:t.source,target:t.target,data:{}})}),d&&(b.attachTreeStructure("combo"),B.forEach(t=>{const e=null==t?void 0:t.parentId;void 0!==e&&b.hasNode(e)&&b.setParent(t.id,e,"combo")}));let C=null;(null==f?void 0:f.length)&&(C=new MC,f.forEach(t=>{C.addNode({id:t.id,data:t.data})})),((t,e)=>{const{edgeLabelSpace:n,keepNodeOrder:r,prevGraph:i,rankdir:o,ranksep:A}=e;!r&&i&&ZM(t,i);const s=oF(t);let a;n&&(e.ranksep=AF(s,{rankdir:o,ranksep:A}));try{a=$M(s,e)}catch(t){if("Not possible to find intersection inside of the rectangle"===t.message)return void console.error("The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure:\n",t);throw t}JM(t,s)})(b,{prevGraph:C,edgeLabelSpace:s,keepNodeOrder:!!c,nodeOrder:c||[],acyclicer:"greedy",ranker:a,rankdir:i,nodesep:A,align:r});const M=[0,0];if(l){let t=1/0,e=1/0;b.getAllNodes().forEach(n=>{t>n.data.x&&(t=n.data.x),e>n.data.y&&(e=n.data.y)}),b.getAllEdges().forEach(n=>{var r;null===(r=n.data.points)||void 0===r||r.forEach(n=>{t>n.x&&(t=n.x),e>n.y&&(e=n.y)})}),M[0]=l[0]-t,M[1]=l[1]-e}const F="LR"===i||"RL"===i;if(h);else{const t=new Set,e="BT"===i||"RL"===i?(t,e)=>e-t:(t,e)=>t-e;b.getAllNodes().forEach(e=>{e.data.x=e.data.x+M[0],e.data.y=e.data.y+M[1],t.add(F?e.data.x:e.data.y)});const n=Array.from(t).sort(e),r=F?(t,e)=>t.x!==e.x:(t,e)=>t.y!==e.y,o=F?(t,e,n)=>{const r=Math.max(e.y,n.y),i=Math.min(e.y,n.y);return t.filter(t=>t.y<=r&&t.y>=i)}:(t,e,n)=>{const r=Math.max(e.x,n.x),i=Math.min(e.x,n.x);return t.filter(t=>t.x<=r&&t.x>=i)};b.getAllEdges().forEach((t,e)=>{var i;s&&u&&"loop"!==t.data.type&&(t.data.controlPoints=BF(null===(i=t.data.points)||void 0===i?void 0:i.map(({x:t,y:e})=>({x:t+M[0],y:e+M[1]})),b.getNode(t.source),b.getNode(t.target),n,F,r,o))})}this.model.forEachNode(t=>{const e=b.getNode(t.id);if(e){const{x:n,y:r,width:i,height:o,originalWidth:A,originalHeight:s}=e.data,a=d?b.getChildren(t.id,"combo"):b.getChildren(t.id);if(a.length>0){let e=1/0,n=-1/0,r=1/0,i=-1/0;a.forEach(t=>{const o=t.id,A=b.getNode(o);if(null==A?void 0:A.data){const t=A.data.x,o=A.data.y,s=A.data.originalWidth||A.data.width||0,a=A.data.originalHeight||A.data.height||0;e=Math.min(e,t-s/2),n=Math.max(n,t+s/2),r=Math.min(r,o-a/2),i=Math.max(i,o+a/2)}});const o=20,A=(n-e||0)+2*o,s=(i-r||0)+2*o;t.x=(e+n)/2,t.y=(r+i)/2,t.size=[A,s]}else t.x=n,t.y=r,t.size=[A,s]}}),this.model.forEachEdge(t=>{const e=b.getEdge(t.id);e&&e.data.controlPoints&&(t.points=e.data.controlPoints.map(qx))})})}}const BF=(t,e,n,r,i,o,A)=>{let s=(null==t?void 0:t.slice(1,t.length-1))||[];if(e&&n){let{x:t,y:a}=e.data,{x:c,y:l}=n.data;if(i&&(t=e.data.y,a=e.data.x,c=n.data.y,l=n.data.x),l!==a&&t!==c){const u=r.indexOf(a),h=r[u+1];if(h){const t=s[0],e=i?{x:(a+h)/2,y:(null==t?void 0:t.y)||c}:{x:(null==t?void 0:t.x)||c,y:(a+h)/2};t&&!o(t,e)||s.unshift(e)}const d=r.indexOf(l),f=Math.abs(d-u);if(1===f)s=A(s,e.data,n.data),s.length||s.push(i?{x:(a+l)/2,y:t}:{x:t,y:(a+l)/2});else if(f>1){const e=r[d-1];if(e){const n=s[s.length-1],r=i?{x:(l+e)/2,y:(null==n?void 0:n.y)||c}:{x:(null==n?void 0:n.x)||t,y:(l+e)/2};n&&!o(n,r)||s.push(r)}}}}return s};function EF(t,e,n=2){if(1===t.nodeCount()){const r=t.firstNode();r.x=e[0],r.y=e[1],3===n&&(r.z=e[2]||0)}}function xF(t,e){const n=t.nodes();return n.sort(e),t.setNodeOrder(n),t}function CF(t,e="desc"){return xF(t,(n,r)=>{const i=t.degree(n.id),o=t.degree(r.id);return"asc"===e?i-o:o-i})}function MF(t,e){return xF(t,(n,r)=>{const i=t.originalNode(n.id),o=t.originalNode(r.id);return e(i,o)})}function FF(t,e=!1){const n=t.nodeCount();if(0===n)return t;const r=t.nodes(),i=[r[0]],o={};o[r[0].id]=!0;let A=0,s=0;return t.forEachNode(a=>{if(0!==s){const c=t.degree(a.id,"both"),l=s<n-1?t.degree(r[s+1].id,"both"):0,u=i[A].id,h=t.neighbors(u,"both").includes(a.id);if(s!==n-1&&c===l&&!h||o[a.id]){const A=e?t.successors(u):t.neighbors(u);let s=!1;for(let e=0;e<A.length;e++){const n=A[e],r=t.node(n);if(r&&t.degree(n)===t.degree(a.id)&&!o[n]){i.push(r),o[n]=!0,s=!0;break}}let c=0;for(;!s&&(o[r[c].id]||(i.push(r[c]),o[r[c].id]=!0,s=!0),c++,c!==n););}else i.push(a),o[a.id]=!0,A++}s++}),t.setNodeOrder(i),t}const kF=t=>{const{width:e,height:n,center:r}=t,i=null!=e?e:"undefined"!=typeof window?window.innerWidth:0,o=null!=n?n:"undefined"!=typeof window?window.innerHeight:0;return{width:i,height:o,center:null!=r?r:[i/2,o/2]}},SF={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1,nodeSize:10,nodeSpacing:0};class QF extends EC{constructor(){super(...arguments),this.id="circular"}getDefaultOptions(){return SF}layout(){return mx(this,0,void 0,function*(){const{width:t,height:e,center:n}=kF(this.options),r=this.model.nodeCount();if(!r||1===r)return void EF(this.model,n);const{ordering:i,nodeSpacing:o,nodeSize:A,endAngle:s=2*Math.PI,startAngle:a=0,divisions:c,angleRatio:l,clockwise:u}=this.options;"topology"===i?FF(this.model,!1):"topology-directed"===i?FF(this.model,!0):"degree"===i&&CF(this.model,"asc");let{radius:h,startRadius:d,endRadius:f}=this.options;const g=this.model.nodes(),p=Xx(A,o,SF.nodeSize,SF.nodeSpacing);if(o){let t=0;for(const e of g)t+=Math.max(...p(e._original));h=t/(2*Math.PI)}else h||d||f?!d&&f?d=f:d&&!f&&(f=d):h=Math.min(e,t)/2;const v=(s-a)/r*l,m=Math.ceil(r/c),y=2*Math.PI/c;for(let t=0;t<r;){const e=g[t];let i=h;i||null===d||null===f||(i=d+t*(f-d)/(r-1)),i||(i=10+100*t/(r-1));const o=t%m*v+y*Math.floor(t/m);let A=a+o;u||(A=s-o),e.x=n[0]+Math.cos(A)*i,e.y=n[1]+Math.sin(A)*i,t++}})}}const UF={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:1.5*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class NF extends EC{constructor(){super(...arguments),this.id="concentric"}getDefaultOptions(){return UF}layout(){return mx(this,0,void 0,function*(){const{width:t,height:e,center:n}=kF(this.options),r=this.model.nodeCount();if(!r||1===r)return void EF(this.model,n);const{sortBy:i,maxLevelDiff:o,sweep:A,clockwise:s,equidistant:a,preventOverlap:c,startAngle:l=UF.startAngle,nodeSize:u,nodeSpacing:h}=this.options,d=i&&"degree"!==i?Vx(i,["node"]):"degree";if("degree"===d)CF(this.model);else{const t=(t,e)=>{const n=d(t),r=d(e);return n===r?0:n>r?-1:1};MF(this.model,t)}const f=this.model.nodes(),g=new Map;for(const t of f){const e="degree"===d?this.model.degree(t.id):d(t._original);g.set(t.id,e)}const p=this.model.firstNode(),v=o||g.get(p.id)/4,m=Xx(u,h,UF.nodeSize,UF.nodeSpacing),y=new Map;for(const t of f)y.set(t.id,Math.max(...m(t._original)));const w=[{nodes:[]}];let b=w[0];for(let t=0;t<r;t++){const e=f[t];if(b.nodes.length>0){const t=b.nodes[0],n=Math.abs(g.get(t.id)-g.get(e.id));v&&n>=v&&(b={nodes:[]},w.push(b))}b.nodes.push(e)}for(const t of w){const e=t.nodes.map(t=>y.get(t.id));t.nodeSizes=e,t.maxNodeSize=Math.max(...e)}if(w.forEach(t=>{const e=void 0===A?2*Math.PI-2*Math.PI/t.nodes.length:A;t.dTheta=e/Math.max(1,t.nodes.length-1)}),c){let t=0;for(let e=0;e<w.length;e++){const n=w[e];if(n.nodes.length>1){const e=n.nodeSizes||[];let r=0;for(let t=0;t<e.length-1;t++)r=Math.max(r,(e[t]+e[t+1])/2);const i=Math.cos(n.dTheta)-Math.cos(0),o=Math.sin(n.dTheta)-Math.sin(0),A=Math.sqrt(i*i+o*o),s=A>0?r/A:0;t=Math.max(s,t)}if(n.r=t,e<w.length-1){const r=w[e+1],i=((n.maxNodeSize||0)+(r.maxNodeSize||0))/2;t+=Math.max(0,i)}}}else{let n=0;w[0].r=0;for(let t=0;t<w.length-1;t++){const e=w[t],r=w[t+1],i=((e.maxNodeSize||0)+(r.maxNodeSize||0))/2;n+=Math.max(0,i),r.r=n}const r=Math.min(t,e)/2;let i=1;for(const t of w){const e=t.r||0;if(e<=0)continue;const n=r-(t.maxNodeSize||0);if(n<=0){i=0;break}i=Math.min(i,n/e)}if(i=Math.max(0,Math.min(1,i)),1!==i)for(const t of w)t.r=(t.r||0)*i}if(a){let t=0,e=0;for(let n=0;n<w.length;n++){const r=(w[n].r||0)-e;t=Math.max(t,r)}e=0,w.forEach((n,r)=>{0===r&&(e=n.r||0),n.r=e,e+=t})}w.forEach(t=>{const e=t.dTheta||0,r=t.r||0;t.nodes.forEach((t,i)=>{const o=l+(s?1:-1)*e*i;t.x=n[0]+r*Math.cos(o),t.y=n[1]+r*Math.sin(o)})})})}}function TF(t,...e){return e.forEach(e=>{e&&Object.keys(e).forEach(n=>{const r=e[n];void 0!==r&&(t[n]=r)})}),t}const OF=4294967296;var IF,LF,PF=0,DF=0,RF=0,HF=0,_F=0,GF=0,KF="object"==typeof performance&&performance.now?performance:Date,jF="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function zF(){return _F||(jF(VF),_F=KF.now()+GF)}function VF(){_F=0}function WF(){this._call=this._time=this._next=null}function YF(t,e,n){var r=new WF;return r.restart(t,e,n),r}function XF(){_F=(HF=KF.now())+GF,PF=DF=0;try{!function(){zF(),++PF;for(var t,e=IF;e;)(t=_F-e._time)>=0&&e._call.call(void 0,t),e=e._next;--PF}()}finally{PF=0,function(){var t,e,n=IF,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:IF=e);LF=t,$F(r)}(),_F=0}}function qF(){var t=KF.now(),e=t-HF;e>1e3&&(GF-=e,HF=t)}function $F(t){PF||(DF&&(DF=clearTimeout(DF)),t-_F>24?(t<1/0&&(DF=setTimeout(XF,t-KF.now()-GF)),RF&&(RF=clearInterval(RF))):(RF||(HF=KF.now(),RF=setInterval(qF,1e3)),PF=1,jF(XF)))}WF.prototype=YF.prototype={constructor:WF,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?zF():+n)+(null==e?0:+e),this._next||LF===this||(LF?LF._next=this:IF=this,LF=this),this._call=t,this._time=n,$F()},stop:function(){this._call&&(this._call=null,this._time=1/0,$F())}};var ZF={value:()=>{}};function JF(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new tk(r)}function tk(t){this._=t}function ek(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function nk(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=ZF,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function rk(t){return t.x}function ik(t){return t.y}tk.prototype=JF.prototype={constructor:tk,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),A=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++A<s;)if(n=(t=o[A]).type)i[n]=nk(i[n],t.name,e);else if(null==e)for(n in i)i[n]=nk(i[n],t.name,null);return this}for(;++A<s;)if((n=(t=o[A]).type)&&(n=ek(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new tk(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var ok=Math.PI*(3-Math.sqrt(5));function Ak(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,A=.6,s=new Map,a=YF(u),c=JF("tick","end"),l=function(){let t=1;return()=>(t=(1664525*t+1013904223)%OF)/OF}();function u(){h(),c.call("tick",e),n<r&&(a.stop(),c.call("end",e))}function h(r){var a,c,l=t.length;void 0===r&&(r=1);for(var u=0;u<r;++u)for(n+=(o-n)*i,s.forEach(function(t){t(n)}),a=0;a<l;++a)null==(c=t[a]).fx?c.x+=c.vx*=A:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=A:(c.y=c.fy,c.vy=0);return e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*ok;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function f(e){return e.initialize&&e.initialize(t,l),e}return null==t&&(t=[]),d(),e={tick:h,restart:function(){return a.restart(u),e},stop:function(){return a.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),s.forEach(f),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(A=1-t,e):1-A},randomSource:function(t){return arguments.length?(l=t,s.forEach(f),e):l},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,f(n)),e):s.get(t)},find:function(e,n,r){var i,o,A,s,a,c=0,l=t.length;for(null==r?r=1/0:r*=r,c=0;c<l;++c)(A=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(a=s,r=A);return a},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function sk(t){return function(){return t}}function ak(t){var e,n,r,i=sk(.1);function o(t){for(var i,o=0,A=e.length;o<A;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function A(){if(e){var o,A=e.length;for(n=new Array(A),r=new Array(A),o=0;o<A;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=sk(null==t?0:+t)),o.initialize=function(t){e=t,A()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:sk(+t),A(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:sk(+e),A(),o):t},o}function ck(t){var e,n,r,i=sk(.1);function o(t){for(var i,o=0,A=e.length;o<A;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function A(){if(e){var o,A=e.length;for(n=new Array(A),r=new Array(A),o=0;o<A;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=sk(null==t?0:+t)),o.initialize=function(t){e=t,A()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:sk(+t),A(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:sk(+e),A(),o):t},o}function lk(t){return 1e-6*(t()-.5)}function uk(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,A,s,a,c,l,u,h,d=t._root,f={data:r},g=t._x0,p=t._y0,v=t._x1,m=t._y1;if(!d)return t._root=f,t;for(;d.length;)if((c=e>=(o=(g+v)/2))?g=o:v=o,(l=n>=(A=(p+m)/2))?p=A:m=A,i=d,!(d=d[u=l<<1|c]))return i[u]=f,t;if(s=+t._x.call(null,d.data),a=+t._y.call(null,d.data),e===s&&n===a)return f.next=d,i?i[u]=f:t._root=f,t;do{i=i?i[u]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+v)/2))?g=o:v=o,(l=n>=(A=(p+m)/2))?p=A:m=A}while((u=l<<1|c)==(h=(a>=A)<<1|s>=o));return i[h]=d,i[u]=f,t}function hk(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function dk(t){return t[0]}function fk(t){return t[1]}function gk(t,e,n){var r=new pk(null==e?dk:e,null==n?fk:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function pk(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function vk(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var mk=gk.prototype=pk.prototype;function yk(t){return t.x+t.vx}function wk(t){return t.y+t.vy}function bk(t){var e,n,r,i=1,o=1;function A(){for(var t,A,a,c,l,u,h,d=e.length,f=0;f<o;++f)for(A=gk(e,yk,wk).visitAfter(s),t=0;t<d;++t)a=e[t],u=n[a.index],h=u*u,c=a.x+a.vx,l=a.y+a.vy,A.visit(g);function g(t,e,n,o,A){var s=t.data,d=t.r,f=u+d;if(!s)return e>c+f||o<c-f||n>l+f||A<l-f;if(s.index>a.index){var g=c-s.x-s.vx,p=l-s.y-s.vy,v=g*g+p*p;v<f*f&&(0===g&&(v+=(g=lk(r))*g),0===p&&(v+=(p=lk(r))*p),v=(f-(v=Math.sqrt(v)))/v*i,a.vx+=(g*=v)*(f=(d*=d)/(h+d)),a.vy+=(p*=v)*f,s.vx-=g*(f=1-f),s.vy-=p*f)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function a(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=sk(null==t?1:+t)),A.initialize=function(t,n){e=t,r=n,a()},A.iterations=function(t){return arguments.length?(o=+t,A):o},A.strength=function(t){return arguments.length?(i=+t,A):i},A.radius=function(e){return arguments.length?(t="function"==typeof e?e:sk(+e),a(),A):t},A}function Bk(){var t,e,n,r,i,o=sk(-30),A=1,s=1/0,a=.81;function c(n){var i,o=t.length,A=gk(t,rk,ik).visitAfter(u);for(r=n,i=0;i<o;++i)e=t[i],A.visit(h)}function l(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function u(t){var e,n,r,o,A,s=0,a=0;if(t.length){for(r=o=A=0;A<4;++A)(e=t[A])&&(n=Math.abs(e.value))&&(s+=e.value,a+=n,r+=n*e.x,o+=n*e.y);t.x=r/a,t.y=o/a}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function h(t,o,c,l){if(!t.value)return!0;var u=t.x-e.x,h=t.y-e.y,d=l-o,f=u*u+h*h;if(d*d/a<f)return f<s&&(0===u&&(f+=(u=lk(n))*u),0===h&&(f+=(h=lk(n))*h),f<A&&(f=Math.sqrt(A*f)),e.vx+=u*t.value*r/f,e.vy+=h*t.value*r/f),!0;if(!(t.length||f>=s)){(t.data!==e||t.next)&&(0===u&&(f+=(u=lk(n))*u),0===h&&(f+=(h=lk(n))*h),f<A&&(f=Math.sqrt(A*f)));do{t.data!==e&&(d=i[t.data.index]*r/f,e.vx+=u*d,e.vy+=h*d)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,l()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:sk(+t),l(),c):o},c.distanceMin=function(t){return arguments.length?(A=t*t,c):Math.sqrt(A)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c}function Ek(t){return t.index}function xk(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Ck(t){var e,n,r,i,o,A,s=Ek,a=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=sk(30),l=1;function u(r){for(var i=0,s=t.length;i<l;++i)for(var a,c,u,h,d,f,g,p=0;p<s;++p)c=(a=t[p]).source,h=(u=a.target).x+u.vx-c.x-c.vx||lk(A),d=u.y+u.vy-c.y-c.vy||lk(A),h*=f=((f=Math.sqrt(h*h+d*d))-n[p])/f*r*e[p],d*=f,u.vx-=h*(g=o[p]),u.vy-=d*g,c.vx+=h*(g=1-g),c.vy+=d*g}function h(){if(r){var A,a,c=r.length,l=t.length,u=new Map(r.map((t,e)=>[s(t,e,r),t]));for(A=0,i=new Array(c);A<l;++A)(a=t[A]).index=A,"object"!=typeof a.source&&(a.source=xk(u,a.source)),"object"!=typeof a.target&&(a.target=xk(u,a.target)),i[a.source.index]=(i[a.source.index]||0)+1,i[a.target.index]=(i[a.target.index]||0)+1;for(A=0,o=new Array(l);A<l;++A)a=t[A],o[A]=i[a.source.index]/(i[a.source.index]+i[a.target.index]);e=new Array(l),d(),n=new Array(l),f()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+a(t[n],n,t)}function f(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),u.initialize=function(t,e){r=t,A=e,h()},u.links=function(e){return arguments.length?(t=e,h(),u):t},u.id=function(t){return arguments.length?(s=t,u):s},u.iterations=function(t){return arguments.length?(l=+t,u):l},u.strength=function(t){return arguments.length?(a="function"==typeof t?t:sk(+t),d(),u):a},u.distance=function(t){return arguments.length?(c="function"==typeof t?t:sk(+t),f(),u):c},u}mk.copy=function(){var t,e,n=new pk(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=vk(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=vk(e));return n},mk.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return uk(this.cover(e,n),e,n,t)},mk.addAll=function(t){var e,n,r,i,o=t.length,A=new Array(o),s=new Array(o),a=1/0,c=1/0,l=-1/0,u=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(A[n]=r,s[n]=i,r<a&&(a=r),r>l&&(l=r),i<c&&(c=i),i>u&&(u=i));if(a>l||c>u)return this;for(this.cover(a,c).cover(l,u),n=0;n<o;++n)uk(this,A[n],s[n],t[n]);return this},mk.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var A,s,a=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(A=new Array(4))[s]=c,c=A,a*=2,s){case 0:i=n+a,o=r+a;break;case 1:n=i-a,o=r+a;break;case 2:i=n+a,r=o-a;break;case 3:n=i-a,r=o-a}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},mk.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},mk.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},mk.find=function(t,e,n){var r,i,o,A,s,a,c,l=this._x0,u=this._y0,h=this._x1,d=this._y1,f=[],g=this._root;for(g&&f.push(new hk(g,l,u,h,d)),null==n?n=1/0:(l=t-n,u=e-n,h=t+n,d=e+n,n*=n);a=f.pop();)if(!(!(g=a.node)||(i=a.x0)>h||(o=a.y0)>d||(A=a.x1)<l||(s=a.y1)<u))if(g.length){var p=(i+A)/2,v=(o+s)/2;f.push(new hk(g[3],p,v,A,s),new hk(g[2],i,v,p,s),new hk(g[1],p,o,A,v),new hk(g[0],i,o,p,v)),(c=(e>=v)<<1|t>=p)&&(a=f[f.length-1],f[f.length-1]=f[f.length-1-c],f[f.length-1-c]=a)}else{var m=t-+this._x.call(null,g.data),y=e-+this._y.call(null,g.data),w=m*m+y*y;if(w<n){var b=Math.sqrt(n=w);l=t-b,u=e-b,h=t+b,d=e+b,r=g.data}}return r},mk.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(A=+this._y.call(null,t)))return this;var e,n,r,i,o,A,s,a,c,l,u,h,d=this._root,f=this._x0,g=this._y0,p=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(s=(f+p)/2))?f=s:p=s,(l=A>=(a=(g+v)/2))?g=a:v=a,e=d,!(d=d[u=l<<1|c]))return this;if(!d.length)break;(e[u+1&3]||e[u+2&3]||e[u+3&3])&&(n=e,h=u)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[u]=i:delete e[u],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},mk.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},mk.root=function(){return this._root},mk.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},mk.visit=function(t){var e,n,r,i,o,A,s=[],a=this._root;for(a&&s.push(new hk(a,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(a=e.node,r=e.x0,i=e.y0,o=e.x1,A=e.y1)&&a.length){var c=(r+o)/2,l=(i+A)/2;(n=a[3])&&s.push(new hk(n,c,l,o,A)),(n=a[2])&&s.push(new hk(n,r,l,c,A)),(n=a[1])&&s.push(new hk(n,c,i,o,l)),(n=a[0])&&s.push(new hk(n,r,i,c,l))}return this},mk.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new hk(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,A=e.x0,s=e.y0,a=e.x1,c=e.y1,l=(A+a)/2,u=(s+c)/2;(o=i[0])&&n.push(new hk(o,A,s,l,u)),(o=i[1])&&n.push(new hk(o,l,s,a,u)),(o=i[2])&&n.push(new hk(o,A,u,l,c)),(o=i[3])&&n.push(new hk(o,l,u,a,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},mk.x=function(t){return arguments.length?(this._x=t,this):this._x},mk.y=function(t){return arguments.length?(this._y=t,this):this._y};const Mk=(t,e)=>t[e];function Fk(){function t(t){return()=>t}let e,n=t=>t.cluster,r=t(1),i=t(-1),o=t(100),A=t(.1),s=[0,0],a=[],c={},l=[],u=100,h=100,d={none:{x:0,y:0}},f=[],g="force",p=!0,v=.1;function m(t){if(!p)return m;e.tick(),w();for(let e,r=0,i=a.length,o=t*v;r<i;++r)e=a[r],e.vx||(e.vx=0),e.vy||(e.vy=0),e.vx+=(d[n(e._original)].x-e.x)*o,e.vy+=(d[n(e._original)].y-e.y)*o}function y(){a&&function(){if(!a||!a.length)return;const t=a[0];if(void 0===n(t._original))throw Error("Couldnt find the grouping attribute for the nodes. Make sure to set it up with forceInABox.groupBy('clusterAttr') before calling .links()");const s=function(){const t=[],e=[],i={};let o=[],A={},s=[];return A=function(t){const e={};return t.forEach(t=>{const r=n(t._original);e[r]||(e[r]={count:0,sumforceNodeSize:0})}),t.forEach(t=>{const i=n(t._original),o=r(t._original),A=e[i];A.count=A.count+1,A.sumforceNodeSize=A.sumforceNodeSize+Math.PI*(o*o)*1.3,e[i]=A}),e}(a),s=function(t){const e={},r=[];t.forEach(t=>{const r=function(t){const e=Mk(t,"source"),r=Mk(t,"target"),i=n(c[e]._original),o=n(c[r]._original);return i<=o?`${i}~${o}`:`${o}~${i}`}(t);let i=0;void 0!==e[r]&&(i=e[r]),i+=1,e[r]=i});return Object.entries(e).forEach(([t,e])=>{const n=t.split("~")[0],i=t.split("~")[1];void 0!==n&&void 0!==i&&r.push({source:n,target:i,count:e})}),r}(l),o=Object.keys(A),o.forEach((e,n)=>{const r=A[e];t.push({id:e,size:r.count,r:Math.sqrt(r.sumforceNodeSize/Math.PI)}),i[e]=n}),s.forEach(t=>{const n=Mk(t,"source"),r=Mk(t,"target"),o=i[n],A=i[r];void 0!==o&&void 0!==A&&e.push({source:o,target:A,count:t.count})}),{nodes:t,links:e}}();e=Ak(s.nodes).force("x",ak(u).strength(.1)).force("y",ck(h).strength(.1)).force("collide",bk(t=>t.r).iterations(4)).force("charge",Bk().strength(i)).force("links",Ck(s.nodes.length?s.links:[]).distance(o).strength(A)),f=e.nodes(),w()}()}function w(){return d={none:{x:0,y:0}},f.forEach(t=>{d[t.id]={x:t.x-s[0],y:t.y-s[1]}}),d}return m.initialize=t=>{a=t,y()},m.template=function(t){return arguments.length?(g=t,y(),m):g},m.groupBy=function(t){return arguments.length?"string"==typeof t?(n=e=>e[t],m):(n=t,m):n},m.enableGrouping=function(t){return arguments.length?(p=t,m):p},m.strength=function(t){return arguments.length?(v=t,m):v},m.centerX=function(t){return arguments.length?(u=t,m):u},m.centerY=function(t){return arguments.length?(h=t,m):h},m.nodes=function(t){return arguments.length?(function(t){c={},t.forEach(t=>{c[t.id]=t})}(t||[]),a=t||[],m):a},m.links=function(t){return arguments.length?(l=t||[],y(),m):l},m.forceNodeSize=function(e){return arguments.length?(r="function"==typeof e?e:t(+e),y(),m):r},m.nodeSize=m.forceNodeSize,m.forceCharge=function(e){return arguments.length?(i="function"==typeof e?e:t(+e),y(),m):i},m.forceLinkDistance=function(e){return arguments.length?(o="function"==typeof e?e:t(+e),y(),m):o},m.forceLinkStrength=function(e){return arguments.length?(A="function"==typeof e?e:t(+e),y(),m):A},m.offset=function(t){return arguments.length?(s=t,m):s},m.getFocis=w,m}var kk={}.toString,Sk=function(t,e){return kk.call(t)==="[object "+e+"]"},Qk=function(t){if(!function(t){return"object"==typeof t&&null!==t}(t)||!Sk(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;for(var e=t;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};function Uk(t,e){if(Object.hasOwn)return Object.hasOwn(t,e);if(null==t)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(t),e)}function Nk(t,e,n,r){for(var i in n=n||0,r=r||5,e)if(Uk(e,i)){var o=e[i];null!==o&&Qk(o)?(Qk(t[i])||(t[i]={}),n<r?Nk(t[i],o,n+1,r):t[i]=e[i]):gM(o)?(t[i]=[],t[i]=t[i].concat(o)):void 0!==o&&(t[i]=o)}}const Tk={edgeId:"edge.id",manyBody:{strength:-30},preventOverlap:!1,nodeSize:10,nodeSpacing:0,x:!1,y:!1,clustering:!1,clusterNodeStrength:-1,clusterEdgeStrength:.1,clusterEdgeDistance:100,clusterFociStrength:.8,clusterNodeSize:10};class Ok extends xC{getDefaultOptions(){return Tk}mergeOptions(t,e){return function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)Nk(t,e[r]);return t}({},t,e)}constructor(t){super(t),this.id="d3-force",this.d3Nodes=[],this.d3Edges=[],this.config={simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource"]},this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}stop(){return this.simulation&&this.simulation.stop(),this}tick(t=1){var e,n;if(this.simulation){for(let e=0;e<t;e++)this.simulation.tick();this.syncPositionsFromD3(),null===(n=(e=this.options).onTick)||void 0===n||n.call(e,this)}return this}restart(t){return this.simulation&&(void 0!==t&&this.simulation.alpha(t),this.simulation.restart()),this}reheat(){return this.restart(1)}getAlpha(){var t,e;return null!==(e=null===(t=this.simulation)||void 0===t?void 0:t.alpha())&&void 0!==e?e:0}setAlpha(t){return this.simulation&&this.simulation.alpha(t),this}getForce(t){var e;return null===(e=this.simulation)||void 0===e?void 0:e.force(t)}force(t,e){return this.simulation&&this.simulation.force(t,e),this}nodes(){var t,e;return null!==(e=null===(t=this.simulation)||void 0===t?void 0:t.nodes())&&void 0!==e?e:[]}find(t,e,n){if(this.simulation)return this.simulation.find(t,e,n)}setFixedPosition(t,e){const n=this.d3Nodes.find(e=>e.id===t),r=this.model.node(t);if(!r||!n)return;const i=["fx","fy","fz"];null!==e?e.forEach((t,e)=>{e<i.length&&("number"==typeof t||null===t)&&(r[i[e]]=t,n[i[e]]=t)}):i.forEach(t=>{delete r[t],delete n[t]})}parseOptions(t){const e=t;return void 0===e.iterations&&(e.link&&void 0===e.link.iterations&&(e.iterations=e.link.iterations),e.collide&&void 0===e.collide.iterations&&(e.iterations=e.collide.iterations)),e}layout(){var t;return mx(this,0,void 0,function*(){const e=this.parseOptions(this.options||{});this.createD3Copies();const n=this.setSimulation(e);return n.nodes(this.d3Nodes),null===(t=n.force("link"))||void 0===t||t.links(this.d3Edges),new Promise(t=>{n.on("end",()=>{this.syncPositionsFromD3(),t()})})})}createD3Copies(){this.d3Nodes=[],this.d3Edges=[],this.model.forEachNode(t=>{this.d3Nodes.push(Object.assign({},t))}),this.model.forEachEdge(t=>{this.d3Edges.push(Object.assign({},t))})}syncPositionsFromD3(){this.d3Nodes.forEach(t=>{const e=this.model.node(t.id);e&&(e.x=t.x,e.y=t.y,void 0!==t.z&&(e.z=t.z),void 0!==t.fx&&(e.fx=t.fx),void 0!==t.fy&&(e.fy=t.fy),void 0!==t.fz&&(e.fz=t.fz),void 0!==t.vx&&(e.vx=t.vx),void 0!==t.vy&&(e.vy=t.vy),void 0!==t.vz&&(e.vz=t.vz))})}initSimulation(){return Ak()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var e;this.syncPositionsFromD3(),null===(e=t.onTick)||void 0===e||e.call(t,this)})),Ik(e,this.config.simulationAttrs.map(e=>[e,t[e]])),this.setupForces(e,t),e}setupForces(t,e){this.setupLinkForce(t,e),this.setupManyBodyForce(t,e),this.setupCenterForce(t,e),this.setupCollisionForce(t,e),this.setupXForce(t,e),this.setupYForce(t,e),this.setupRadialForce(t,e),this.setupClusterForce(t,e)}getCenterOptions(t){if(!1===t.center)return;const e=kF({width:t.width,height:t.height});return TF({},t.center||{},{x:e.width/2,y:e.height/2,strength:t.centerStrength})}setupCenterForce(t,e){const n=this.getCenterOptions(e);if(n){let e=t.force("center");e||(e=function(t,e){var n,r=1;function i(){var i,o,A=n.length,s=0,a=0;for(i=0;i<A;++i)s+=(o=n[i]).x,a+=o.y;for(s=(s/A-t)*r,a=(a/A-e)*r,i=0;i<A;++i)(o=n[i]).x-=s,o.y-=a}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}(n.x,n.y),t.force("center",e));const r=[];void 0!==n.x&&r.push(["x",n.x]),void 0!==n.y&&r.push(["y",n.y]),void 0!==n.strength&&r.push(["strength",n.strength]),Ik(e,r)}else t.force("center",null)}getManyBodyOptions(t){if(!1!==t.manyBody)return TF({},t.manyBody||{},{strength:t.nodeStrength?Vx(t.nodeStrength,["node"]):void 0,distanceMin:t.distanceMin,distanceMax:t.distanceMax,theta:t.theta})}setupManyBodyForce(t,e){const n=this.getManyBodyOptions(e);if(n){let e=t.force("charge");e||(e=Bk(),t.force("charge",e));const r=[];void 0!==n.strength&&r.push(["strength",n.strength]),void 0!==n.distanceMin&&r.push(["distanceMin",n.distanceMin]),void 0!==n.distanceMax&&r.push(["distanceMax",n.distanceMax]),void 0!==n.theta&&r.push(["theta",n.theta]),Ik(e,r)}else t.force("charge",null)}getLinkOptions(t){if(!1!==t.link)return TF({},t.link||{},{id:t.edgeId?Vx(t.edgeId,["edge"]):void 0,distance:t.linkDistance?Vx(t.linkDistance,["edge"]):void 0,strength:t.edgeStrength?Vx(t.edgeStrength,["edge"]):void 0,iterations:t.edgeIterations})}setupLinkForce(t,e){const n=this.model.edges(),r=this.getLinkOptions(e);if(n.length>0&&r){let e=t.force("link");e||(e=Ck(),t.force("link",e));const n=[];void 0!==r.id&&n.push(["id",r.id]),void 0!==r.distance&&n.push(["distance",r.distance]),void 0!==r.strength&&n.push(["strength",r.strength]),void 0!==r.iterations&&n.push(["iterations",r.iterations]),Ik(e,n)}else t.force("link",null)}getCollisionOptions(t){if(!1===t.preventOverlap&&(!1===t.collide||void 0===t.collide))return;const e=Xx(t.nodeSize,t.nodeSpacing,Tk.nodeSize,Tk.nodeSpacing);return TF({},t.collide||{},{radius:t.collide&&t.collide.radius||(t=>Math.max(...e(t._original))/2),strength:t.collideStrength,iterations:t.collideIterations})}setupCollisionForce(t,e){const n=this.getCollisionOptions(e);if(n){let e=t.force("collide");e||(e=bk(),t.force("collide",e));const r=[];void 0!==n.radius&&r.push(["radius",n.radius]),void 0!==n.strength&&r.push(["strength",n.strength]),void 0!==n.iterations&&r.push(["iterations",n.iterations]),Ik(e,r)}else t.force("collide",null)}getXForceOptions(t){var e;if(!1===t.x)return;const n=this.getCenterOptions(t);return TF({},t.x||{},{x:null!==(e=t.forceXPosition)&&void 0!==e?e:n&&n.x,strength:t.forceXStrength})}setupXForce(t,e){const n=this.getXForceOptions(e);if(n){let e=t.force("x");e||(e=ak(),t.force("x",e));const r=[];void 0!==n.x&&r.push(["x",n.x]),void 0!==n.strength&&r.push(["strength",n.strength]),Ik(e,r)}else t.force("x",null)}getYForceOptions(t){var e;if(!1===t.y)return;const n=this.getCenterOptions(t);return TF({},t.y||{},{y:null!==(e=t.forceYPosition)&&void 0!==e?e:n&&n.y,strength:t.forceYStrength})}setupYForce(t,e){const n=this.getYForceOptions(e);if(n){let e=t.force("y");e||(e=ck(),t.force("y",e));const r=[];void 0!==n.y&&r.push(["y",n.y]),void 0!==n.strength&&r.push(["strength",n.strength]),Ik(e,r)}else t.force("y",null)}getRadialOptions(t){var e,n,r;if(void 0!==t.radial||void 0!==t.radialStrength||void 0!==t.radialRadius||void 0!==t.radialX||void 0!==t.radialY){const i=this.getCenterOptions(t);return TF({},t.radial||{},{strength:t.radialStrength,radius:null!==(e=t.radialRadius)&&void 0!==e?e:100,x:null!==(n=t.radialX)&&void 0!==n?n:i&&i.x,y:null!==(r=t.radialY)&&void 0!==r?r:i&&i.y})}}setupRadialForce(t,e){const n=this.getRadialOptions(e);if(n){let e=t.force("radial");e||(e=function(t,e,n){var r,i,o,A=sk(.1);function s(t){for(var A=0,s=r.length;A<s;++A){var a=r[A],c=a.x-e||1e-6,l=a.y-n||1e-6,u=Math.sqrt(c*c+l*l),h=(o[A]-u)*i[A]*t/u;a.vx+=c*h,a.vy+=l*h}}function a(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),i[e]=isNaN(o[e])?0:+A(r[e],e,r)}}return"function"!=typeof t&&(t=sk(+t)),null==e&&(e=0),null==n&&(n=0),s.initialize=function(t){r=t,a()},s.strength=function(t){return arguments.length?(A="function"==typeof t?t:sk(+t),a(),s):A},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:sk(+e),a(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(n=+t,s):n},s}(n.radius||100,n.x,n.y),t.force("radial",e));const r=[];void 0!==n.radius&&r.push(["radius",n.radius]),void 0!==n.strength&&r.push(["strength",n.strength]),void 0!==n.x&&r.push(["x",n.x]),void 0!==n.y&&r.push(["y",n.y]),Ik(e,r)}else t.force("radial",null)}setupClusterForce(t,e){const{clustering:n}=e;if(n){const{clusterFociStrength:n,clusterEdgeDistance:r,clusterEdgeStrength:i,clusterNodeStrength:o,clusterNodeSize:A,clusterBy:s}=e,a=this.getCenterOptions(e);let c=t.force("group");c||(c=Fk(),t.force("group",c)),Ik(c,[["centerX",a&&a.x],["centerY",a&&a.y],["template","force"],["strength",n],["groupBy",s?Vx(s,["node"]):void 0],["nodes",this.model.nodes()],["links",this.model.edges()],["forceLinkDistance",r],["forceLinkStrength",i],["forceCharge",o],["forceNodeSize",A]])}else t.force("group",null)}}const Ik=(t,e)=>e.reduce((e,[n,r])=>e[n]&&void 0!==r?e[n].call(t,r):e,t);function Lk(t){return function(){return t}}function Pk(t){var e,n,r,i=Lk(.1);function o(t){for(var i,o=0,A=e.length;o<A;++o)(i=e[o]).vz+=(r[o]-i.z)*n[o]*t}function A(){if(e){var o,A=e.length;for(n=new Array(A),r=new Array(A),o=0;o<A;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Lk(null==t?0:+t)),o.initialize=function(t){e=t,A()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Lk(+t),A(),o):i},o.z=function(e){return arguments.length?(t="function"==typeof e?e:Lk(+e),A(),o):t},o}function Dk(t){var e,n,r,i=Lk(.1);function o(t){for(var i,o=0,A=e.length;o<A;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function A(){if(e){var o,A=e.length;for(n=new Array(A),r=new Array(A),o=0;o<A;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Lk(null==t?0:+t)),o.initialize=function(t){e=t,A()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Lk(+t),A(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:Lk(+e),A(),o):t},o}function Rk(t){var e,n,r,i=Lk(.1);function o(t){for(var i,o=0,A=e.length;o<A;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function A(){if(e){var o,A=e.length;for(n=new Array(A),r=new Array(A),o=0;o<A;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=Lk(null==t?0:+t)),o.initialize=function(t){e=t,A()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:Lk(+t),A(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:Lk(+e),A(),o):t},o}function Hk(t,e,n,r){var i,o,A,s,a=Lk(.1);function c(t){for(var a=0,c=i.length;a<c;++a){var l=i[a],u=l.x-e||1e-6,h=(l.y||0)-n||1e-6,d=(l.z||0)-r||1e-6,f=Math.sqrt(u*u+h*h+d*d),g=(s[a]-f)*A[a]*t/f;l.vx+=u*g,o>1&&(l.vy+=h*g),o>2&&(l.vz+=d*g)}}function l(){if(i){var e,n=i.length;for(A=new Array(n),s=new Array(n),e=0;e<n;++e)s[e]=+t(i[e],e,i),A[e]=isNaN(s[e])?0:+a(i[e],e,i)}}return"function"!=typeof t&&(t=Lk(+t)),null==e&&(e=0),null==n&&(n=0),null==r&&(r=0),c.initialize=function(t,...e){i=t,o=e.find(t=>[1,2,3].includes(t))||2,l()},c.strength=function(t){return arguments.length?(a="function"==typeof t?t:Lk(+t),l(),c):a},c.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lk(+e),l(),c):t},c.x=function(t){return arguments.length?(e=+t,c):e},c.y=function(t){return arguments.length?(n=+t,c):n},c.z=function(t){return arguments.length?(r=+t,c):r},c}function _k(t){return 1e-6*(t()-.5)}function Gk(t,e,n){if(isNaN(e))return t;var r,i,o,A,s,a,c=t._root,l={data:n},u=t._x0,h=t._x1;if(!c)return t._root=l,t;for(;c.length;)if((A=e>=(i=(u+h)/2))?u=i:h=i,r=c,!(c=c[s=+A]))return r[s]=l,t;if(e===(o=+t._x.call(null,c.data)))return l.next=c,r?r[s]=l:t._root=l,t;do{r=r?r[s]=new Array(2):t._root=new Array(2),(A=e>=(i=(u+h)/2))?u=i:h=i}while((s=+A)===(a=+(o>=i)));return r[a]=c,r[s]=l,t}function Kk(t,e,n){this.node=t,this.x0=e,this.x1=n}function jk(t){return t[0]}function zk(t,e){var n=new Vk(null==e?jk:e,NaN,NaN);return null==t?n:n.addAll(t)}function Vk(t,e,n){this._x=t,this._x0=e,this._x1=n,this._root=void 0}function Wk(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Yk=zk.prototype=Vk.prototype;function Xk(t,e,n,r,i){if(isNaN(e)||isNaN(n)||isNaN(r))return t;var o,A,s,a,c,l,u,h,d,f,g,p,v=t._root,m={data:i},y=t._x0,w=t._y0,b=t._z0,B=t._x1,E=t._y1,x=t._z1;if(!v)return t._root=m,t;for(;v.length;)if((h=e>=(A=(y+B)/2))?y=A:B=A,(d=n>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(b+x)/2))?b=a:x=a,o=v,!(v=v[g=f<<2|d<<1|h]))return o[g]=m,t;if(c=+t._x.call(null,v.data),l=+t._y.call(null,v.data),u=+t._z.call(null,v.data),e===c&&n===l&&r===u)return m.next=v,o?o[g]=m:t._root=m,t;do{o=o?o[g]=new Array(8):t._root=new Array(8),(h=e>=(A=(y+B)/2))?y=A:B=A,(d=n>=(s=(w+E)/2))?w=s:E=s,(f=r>=(a=(b+x)/2))?b=a:x=a}while((g=f<<2|d<<1|h)==(p=(u>=a)<<2|(l>=s)<<1|c>=A));return o[p]=v,o[g]=m,t}function qk(t,e,n,r,i,o,A){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=A}Yk.copy=function(){var t,e,n=new Vk(this._x,this._x0,this._x1),r=this._root;if(!r)return n;if(!r.length)return n._root=Wk(r),n;for(t=[{source:r,target:n._root=new Array(2)}];r=t.pop();)for(var i=0;i<2;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(2)}):r.target[i]=Wk(e));return n},Yk.add=function(t){const e=+this._x.call(null,t);return Gk(this.cover(e),e,t)},Yk.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e);let r=1/0,i=-1/0;for(let o,A=0;A<e;++A)isNaN(o=+this._x.call(null,t[A]))||(n[A]=o,o<r&&(r=o),o>i&&(i=o));if(r>i)return this;this.cover(r).cover(i);for(let r=0;r<e;++r)Gk(this,n[r],t[r]);return this},Yk.cover=function(t){if(isNaN(t=+t))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(t))+1;else{for(var r,i,o=n-e||1,A=this._root;e>t||t>=n;)switch(i=+(t<e),(r=new Array(2))[i]=A,A=r,o*=2,i){case 0:n=e+o;break;case 1:e=n-o}this._root&&this._root.length&&(this._root=A)}return this._x0=e,this._x1=n,this},Yk.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},Yk.extent=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},Yk.find=function(t,e){var n,r,i,o,A,s=this._x0,a=this._x1,c=[],l=this._root;for(l&&c.push(new Kk(l,s,a)),null==e?e=1/0:(s=t-e,a=t+e);o=c.pop();)if(!(!(l=o.node)||(r=o.x0)>a||(i=o.x1)<s))if(l.length){var u=(r+i)/2;c.push(new Kk(l[1],u,i),new Kk(l[0],r,u)),(A=+(t>=u))&&(o=c[c.length-1],c[c.length-1]=c[c.length-1-A],c[c.length-1-A]=o)}else{var h=Math.abs(t-+this._x.call(null,l.data));h<e&&(e=h,s=t-h,a=t+h,n=l.data)}return n},Yk.remove=function(t){if(isNaN(o=+this._x.call(null,t)))return this;var e,n,r,i,o,A,s,a,c,l=this._root,u=this._x0,h=this._x1;if(!l)return this;if(l.length)for(;;){if((s=o>=(A=(u+h)/2))?u=A:h=A,e=l,!(l=l[a=+s]))return this;if(!l.length)break;e[a+1&1]&&(n=e,c=a)}for(;l.data!==t;)if(r=l,!(l=l.next))return this;return(i=l.next)&&delete l.next,r?(i?r.next=i:delete r.next,this):e?(i?e[a]=i:delete e[a],(l=e[0]||e[1])&&l===(e[1]||e[0])&&!l.length&&(n?n[c]=l:this._root=l),this):(this._root=i,this)},Yk.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},Yk.root=function(){return this._root},Yk.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},Yk.visit=function(t){var e,n,r,i,o=[],A=this._root;for(A&&o.push(new Kk(A,this._x0,this._x1));e=o.pop();)if(!t(A=e.node,r=e.x0,i=e.x1)&&A.length){var s=(r+i)/2;(n=A[1])&&o.push(new Kk(n,s,i)),(n=A[0])&&o.push(new Kk(n,r,s))}return this},Yk.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new Kk(this._root,this._x0,this._x1));e=n.pop();){var i=e.node;if(i.length){var o,A=e.x0,s=e.x1,a=(A+s)/2;(o=i[0])&&n.push(new Kk(o,A,a)),(o=i[1])&&n.push(new Kk(o,a,s))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.x1);return this},Yk.x=function(t){return arguments.length?(this._x=t,this):this._x};const $k=(t,e,n,r,i,o)=>Math.sqrt((t-r)**2+(e-i)**2+(n-o)**2);function Zk(t){return t[0]}function Jk(t){return t[1]}function tS(t){return t[2]}function eS(t,e,n,r){var i=new nS(null==e?Zk:e,null==n?Jk:n,null==r?tS:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function nS(t,e,n,r,i,o,A,s,a){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=A,this._y1=s,this._z1=a,this._root=void 0}function rS(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var iS=eS.prototype=nS.prototype;function oS(t){return t.x+t.vx}function AS(t){return t.y+t.vy}function sS(t){return t.z+t.vz}function aS(t){var e,n,r,i,o=1,A=1;function s(){for(var t,s,c,l,u,h,d,f,g=e.length,p=0;p<A;++p)for(s=(1===n?zk(e,oS):2===n?gk(e,oS,AS):3===n?eS(e,oS,AS,sS):null).visitAfter(a),t=0;t<g;++t)c=e[t],d=r[c.index],f=d*d,l=c.x+c.vx,n>1&&(u=c.y+c.vy),n>2&&(h=c.z+c.vz),s.visit(v);function v(t,e,r,A,s,a,g){var p=[e,r,A,s,a,g],v=p[0],m=p[1],y=p[2],w=p[n],b=p[n+1],B=p[n+2],E=t.data,x=t.r,C=d+x;if(!E)return v>l+C||w<l-C||n>1&&(m>u+C||b<u-C)||n>2&&(y>h+C||B<h-C);if(E.index>c.index){var M=l-E.x-E.vx,F=n>1?u-E.y-E.vy:0,k=n>2?h-E.z-E.vz:0,S=M*M+F*F+k*k;S<C*C&&(0===M&&(S+=(M=_k(i))*M),n>1&&0===F&&(S+=(F=_k(i))*F),n>2&&0===k&&(S+=(k=_k(i))*k),S=(C-(S=Math.sqrt(S)))/S*o,c.vx+=(M*=S)*(C=(x*=x)/(f+x)),n>1&&(c.vy+=(F*=S)*C),n>2&&(c.vz+=(k*=S)*C),E.vx-=M*(C=1-C),n>1&&(E.vy-=F*C),n>2&&(E.vz-=k*C))}}}function a(t){if(t.data)return t.r=r[t.data.index];for(var e=t.r=0;e<Math.pow(2,n);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function c(){if(e){var n,i,o=e.length;for(r=new Array(o),n=0;n<o;++n)i=e[n],r[i.index]=+t(i,n,e)}}return"function"!=typeof t&&(t=Lk(null==t?1:+t)),s.initialize=function(t,...r){e=t,i=r.find(t=>"function"==typeof t)||Math.random,n=r.find(t=>[1,2,3].includes(t))||2,c()},s.iterations=function(t){return arguments.length?(A=+t,s):A},s.strength=function(t){return arguments.length?(o=+t,s):o},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:Lk(+e),c(),s):t},s}function cS(t,e,n){var r,i=1;function o(){var o,A,s=r.length,a=0,c=0,l=0;for(o=0;o<s;++o)a+=(A=r[o]).x||0,c+=A.y||0,l+=A.z||0;for(a=(a/s-t)*i,c=(c/s-e)*i,l=(l/s-n)*i,o=0;o<s;++o)A=r[o],a&&(A.x-=a),c&&(A.y-=c),l&&(A.z-=l)}return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),o.initialize=function(t){r=t},o.x=function(e){return arguments.length?(t=+e,o):t},o.y=function(t){return arguments.length?(e=+t,o):e},o.z=function(t){return arguments.length?(n=+t,o):n},o.strength=function(t){return arguments.length?(i=+t,o):i},o}iS.copy=function(){var t,e,n=new nS(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(!r)return n;if(!r.length)return n._root=rS(r),n;for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=rS(e));return n},iS.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t),r=+this._z.call(null,t);return Xk(this.cover(e,n,r),e,n,r,t)},iS.addAll=function(t){Array.isArray(t)||(t=Array.from(t));const e=t.length,n=new Float64Array(e),r=new Float64Array(e),i=new Float64Array(e);let o=1/0,A=1/0,s=1/0,a=-1/0,c=-1/0,l=-1/0;for(let u,h,d,f,g=0;g<e;++g)isNaN(h=+this._x.call(null,u=t[g]))||isNaN(d=+this._y.call(null,u))||isNaN(f=+this._z.call(null,u))||(n[g]=h,r[g]=d,i[g]=f,h<o&&(o=h),h>a&&(a=h),d<A&&(A=d),d>c&&(c=d),f<s&&(s=f),f>l&&(l=f));if(o>a||A>c||s>l)return this;this.cover(o,A,s).cover(a,c,l);for(let o=0;o<e;++o)Xk(this,n[o],r[o],i[o],t[o]);return this},iS.cover=function(t,e,n){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,A=this._x1,s=this._y1,a=this._z1;if(isNaN(r))A=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,a=(o=Math.floor(n))+1;else{for(var c,l,u=A-r||1,h=this._root;r>t||t>=A||i>e||e>=s||o>n||n>=a;)switch(l=(n<o)<<2|(e<i)<<1|t<r,(c=new Array(8))[l]=h,h=c,u*=2,l){case 0:A=r+u,s=i+u,a=o+u;break;case 1:r=A-u,s=i+u,a=o+u;break;case 2:A=r+u,i=s-u,a=o+u;break;case 3:r=A-u,i=s-u,a=o+u;break;case 4:A=r+u,s=i+u,o=a-u;break;case 5:r=A-u,s=i+u,o=a-u;break;case 6:A=r+u,i=s-u,o=a-u;break;case 7:r=A-u,i=s-u,o=a-u}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=i,this._z0=o,this._x1=A,this._y1=s,this._z1=a,this},iS.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},iS.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},iS.find=function(t,e,n,r){var i,o,A,s,a,c,l,u,h,d=this._x0,f=this._y0,g=this._z0,p=this._x1,v=this._y1,m=this._z1,y=[],w=this._root;for(w&&y.push(new qk(w,d,f,g,p,v,m)),null==r?r=1/0:(d=t-r,f=e-r,g=n-r,p=t+r,v=e+r,m=n+r,r*=r);u=y.pop();)if(!(!(w=u.node)||(o=u.x0)>p||(A=u.y0)>v||(s=u.z0)>m||(a=u.x1)<d||(c=u.y1)<f||(l=u.z1)<g))if(w.length){var b=(o+a)/2,B=(A+c)/2,E=(s+l)/2;y.push(new qk(w[7],b,B,E,a,c,l),new qk(w[6],o,B,E,b,c,l),new qk(w[5],b,A,E,a,B,l),new qk(w[4],o,A,E,b,B,l),new qk(w[3],b,B,s,a,c,E),new qk(w[2],o,B,s,b,c,E),new qk(w[1],b,A,s,a,B,E),new qk(w[0],o,A,s,b,B,E)),(h=(n>=E)<<2|(e>=B)<<1|t>=b)&&(u=y[y.length-1],y[y.length-1]=y[y.length-1-h],y[y.length-1-h]=u)}else{var x=t-+this._x.call(null,w.data),C=e-+this._y.call(null,w.data),M=n-+this._z.call(null,w.data),F=x*x+C*C+M*M;if(F<r){var k=Math.sqrt(r=F);d=t-k,f=e-k,g=n-k,p=t+k,v=e+k,m=n+k,i=w.data}}return i},iS.findAllWithinRadius=function(t,e,n,r){const i=[],o=t-r,A=e-r,s=n-r,a=t+r,c=e+r,l=n+r;return this.visit((u,h,d,f,g,p,v)=>{if(!u.length)do{const o=u.data;$k(t,e,n,this._x(o),this._y(o),this._z(o))<=r&&i.push(o)}while(u=u.next);return h>a||d>c||f>l||g<o||p<A||v<s}),i},iS.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(A=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,n,r,i,o,A,s,a,c,l,u,h,d,f,g,p=this._root,v=this._x0,m=this._y0,y=this._z0,w=this._x1,b=this._y1,B=this._z1;if(!p)return this;if(p.length)for(;;){if((u=o>=(a=(v+w)/2))?v=a:w=a,(h=A>=(c=(m+b)/2))?m=c:b=c,(d=s>=(l=(y+B)/2))?y=l:B=l,e=p,!(p=p[f=d<<2|h<<1|u]))return this;if(!p.length)break;(e[f+1&7]||e[f+2&7]||e[f+3&7]||e[f+4&7]||e[f+5&7]||e[f+6&7]||e[f+7&7])&&(n=e,g=f)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(p=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&p===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[g]=p:this._root=p),this):(this._root=i,this)},iS.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},iS.root=function(){return this._root},iS.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},iS.visit=function(t){var e,n,r,i,o,A,s,a,c=[],l=this._root;for(l&&c.push(new qk(l,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.z0,A=e.x1,s=e.y1,a=e.z1)&&l.length){var u=(r+A)/2,h=(i+s)/2,d=(o+a)/2;(n=l[7])&&c.push(new qk(n,u,h,d,A,s,a)),(n=l[6])&&c.push(new qk(n,r,h,d,u,s,a)),(n=l[5])&&c.push(new qk(n,u,i,d,A,h,a)),(n=l[4])&&c.push(new qk(n,r,i,d,u,h,a)),(n=l[3])&&c.push(new qk(n,u,h,o,A,s,d)),(n=l[2])&&c.push(new qk(n,r,h,o,u,s,d)),(n=l[1])&&c.push(new qk(n,u,i,o,A,h,d)),(n=l[0])&&c.push(new qk(n,r,i,o,u,h,d))}return this},iS.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new qk(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i=e.node;if(i.length){var o,A=e.x0,s=e.y0,a=e.z0,c=e.x1,l=e.y1,u=e.z1,h=(A+c)/2,d=(s+l)/2,f=(a+u)/2;(o=i[0])&&n.push(new qk(o,A,s,a,h,d,f)),(o=i[1])&&n.push(new qk(o,h,s,a,c,d,f)),(o=i[2])&&n.push(new qk(o,A,d,a,h,l,f)),(o=i[3])&&n.push(new qk(o,h,d,a,c,l,f)),(o=i[4])&&n.push(new qk(o,A,s,f,h,d,u)),(o=i[5])&&n.push(new qk(o,h,s,f,c,d,u)),(o=i[6])&&n.push(new qk(o,A,d,f,h,l,u)),(o=i[7])&&n.push(new qk(o,h,d,f,c,l,u))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},iS.x=function(t){return arguments.length?(this._x=t,this):this._x},iS.y=function(t){return arguments.length?(this._y=t,this):this._y},iS.z=function(t){return arguments.length?(this._z=t,this):this._z};const lS=4294967296;function uS(t){return t.x}function hS(t){return t.y}function dS(t){return t.z}var fS=Math.PI*(3-Math.sqrt(5)),gS=20*Math.PI/(9+Math.sqrt(221));function pS(t,e){e=e||2;var n,r=Math.min(3,Math.max(1,Math.round(e))),i=1,o=.001,A=1-Math.pow(o,1/300),s=0,a=.6,c=new Map,l=YF(d),u=JF("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%lS)/lS}();function d(){f(),u.call("tick",n),i<o&&(l.stop(),u.call("end",n))}function f(e){var o,l,u=t.length;void 0===e&&(e=1);for(var h=0;h<e;++h)for(i+=(s-i)*A,c.forEach(function(t){t(i)}),o=0;o<u;++o)null==(l=t[o]).fx?l.x+=l.vx*=a:(l.x=l.fx,l.vx=0),r>1&&(null==l.fy?l.y+=l.vy*=a:(l.y=l.fy,l.vy=0)),r>2&&(null==l.fz?l.z+=l.vz*=a:(l.z=l.fz,l.vz=0));return n}function g(){for(var e,n=0,i=t.length;n<i;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),null!=e.fz&&(e.z=e.fz),isNaN(e.x)||r>1&&isNaN(e.y)||r>2&&isNaN(e.z)){var o=10*(r>2?Math.cbrt(.5+n):r>1?Math.sqrt(.5+n):n),A=n*fS,s=n*gS;1===r?e.x=o:2===r?(e.x=o*Math.cos(A),e.y=o*Math.sin(A)):(e.x=o*Math.sin(A)*Math.cos(s),e.y=o*Math.cos(A),e.z=o*Math.sin(A)*Math.sin(s))}(isNaN(e.vx)||r>1&&isNaN(e.vy)||r>2&&isNaN(e.vz))&&(e.vx=0,r>1&&(e.vy=0),r>2&&(e.vz=0))}}function p(e){return e.initialize&&e.initialize(t,h,r),e}return null==t&&(t=[]),g(),n={tick:f,restart:function(){return l.restart(d),n},stop:function(){return l.stop(),n},numDimensions:function(t){return arguments.length?(r=Math.min(3,Math.max(1,Math.round(t))),c.forEach(p),n):r},nodes:function(e){return arguments.length?(t=e,g(),c.forEach(p),n):t},alpha:function(t){return arguments.length?(i=+t,n):i},alphaMin:function(t){return arguments.length?(o=+t,n):o},alphaDecay:function(t){return arguments.length?(A=+t,n):+A},alphaTarget:function(t){return arguments.length?(s=+t,n):s},velocityDecay:function(t){return arguments.length?(a=1-t,n):1-a},randomSource:function(t){return arguments.length?(h=t,c.forEach(p),n):h},force:function(t,e){return arguments.length>1?(null==e?c.delete(t):c.set(t,p(e)),n):c.get(t)},find:function(){var e,n,i,o,A,s,a=Array.prototype.slice.call(arguments),c=a.shift()||0,l=(r>1?a.shift():null)||0,u=(r>2?a.shift():null)||0,h=a.shift()||1/0,d=0,f=t.length;for(h*=h,d=0;d<f;++d)(o=(e=c-(A=t[d]).x)*e+(n=l-(A.y||0))*n+(i=u-(A.z||0))*i)<h&&(s=A,h=o);return s},on:function(t,e){return arguments.length>1?(u.on(t,e),n):u.on(t)}}}function vS(){var t,e,n,r,i,o,A=Lk(-30),s=1,a=1/0,c=.81;function l(r){var o,A=t.length,s=(1===e?zk(t,uS):2===e?gk(t,uS,hS):3===e?eS(t,uS,hS,dS):null).visitAfter(h);for(i=r,o=0;o<A;++o)n=t[o],s.visit(d)}function u(){if(t){var e,n,r=t.length;for(o=new Array(r),e=0;e<r;++e)n=t[e],o[n.index]=+A(n,e,t)}}function h(t){var n,r,i,A,s,a,c=0,l=0,u=t.length;if(u){for(i=A=s=a=0;a<u;++a)(n=t[a])&&(r=Math.abs(n.value))&&(c+=n.value,l+=r,i+=r*(n.x||0),A+=r*(n.y||0),s+=r*(n.z||0));c*=Math.sqrt(4/u),t.x=i/l,e>1&&(t.y=A/l),e>2&&(t.z=s/l)}else{(n=t).x=n.data.x,e>1&&(n.y=n.data.y),e>2&&(n.z=n.data.z);do{c+=o[n.data.index]}while(n=n.next)}t.value=c}function d(t,A,l,u,h){if(!t.value)return!0;var d=[l,u,h][e-1],f=t.x-n.x,g=e>1?t.y-n.y:0,p=e>2?t.z-n.z:0,v=d-A,m=f*f+g*g+p*p;if(v*v/c<m)return m<a&&(0===f&&(m+=(f=_k(r))*f),e>1&&0===g&&(m+=(g=_k(r))*g),e>2&&0===p&&(m+=(p=_k(r))*p),m<s&&(m=Math.sqrt(s*m)),n.vx+=f*t.value*i/m,e>1&&(n.vy+=g*t.value*i/m),e>2&&(n.vz+=p*t.value*i/m)),!0;if(!(t.length||m>=a)){(t.data!==n||t.next)&&(0===f&&(m+=(f=_k(r))*f),e>1&&0===g&&(m+=(g=_k(r))*g),e>2&&0===p&&(m+=(p=_k(r))*p),m<s&&(m=Math.sqrt(s*m)));do{t.data!==n&&(v=o[t.data.index]*i/m,n.vx+=f*v,e>1&&(n.vy+=g*v),e>2&&(n.vz+=p*v))}while(t=t.next)}}return l.initialize=function(n,...i){t=n,r=i.find(t=>"function"==typeof t)||Math.random,e=i.find(t=>[1,2,3].includes(t))||2,u()},l.strength=function(t){return arguments.length?(A="function"==typeof t?t:Lk(+t),u(),l):A},l.distanceMin=function(t){return arguments.length?(s=t*t,l):Math.sqrt(s)},l.distanceMax=function(t){return arguments.length?(a=t*t,l):Math.sqrt(a)},l.theta=function(t){return arguments.length?(c=t*t,l):Math.sqrt(c)},l}function mS(t){return t.index}function yS(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function wS(t){var e,n,r,i,o,A,s,a=mS,c=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},l=Lk(30),u=1;function h(r){for(var o=0,a=t.length;o<u;++o)for(var c,l,h,d,f,g=0,p=0,v=0,m=0;g<a;++g)l=(c=t[g]).source,p=(h=c.target).x+h.vx-l.x-l.vx||_k(s),i>1&&(v=h.y+h.vy-l.y-l.vy||_k(s)),i>2&&(m=h.z+h.vz-l.z-l.vz||_k(s)),p*=d=((d=Math.sqrt(p*p+v*v+m*m))-n[g])/d*r*e[g],v*=d,m*=d,h.vx-=p*(f=A[g]),i>1&&(h.vy-=v*f),i>2&&(h.vz-=m*f),l.vx+=p*(f=1-f),i>1&&(l.vy+=v*f),i>2&&(l.vz+=m*f)}function d(){if(r){var i,s,c=r.length,l=t.length,u=new Map(r.map((t,e)=>[a(t,e,r),t]));for(i=0,o=new Array(c);i<l;++i)(s=t[i]).index=i,"object"!=typeof s.source&&(s.source=yS(u,s.source)),"object"!=typeof s.target&&(s.target=yS(u,s.target)),o[s.source.index]=(o[s.source.index]||0)+1,o[s.target.index]=(o[s.target.index]||0)+1;for(i=0,A=new Array(l);i<l;++i)s=t[i],A[i]=o[s.source.index]/(o[s.source.index]+o[s.target.index]);e=new Array(l),f(),n=new Array(l),g()}}function f(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+c(t[n],n,t)}function g(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+l(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,...e){r=t,s=e.find(t=>"function"==typeof t)||Math.random,i=e.find(t=>[1,2,3].includes(t))||2,d()},h.links=function(e){return arguments.length?(t=e,d(),h):t},h.id=function(t){return arguments.length?(a=t,h):a},h.iterations=function(t){return arguments.length?(u=+t,h):u},h.strength=function(t){return arguments.length?(c="function"==typeof t?t:Lk(+t),f(),h):c},h.distance=function(t){return arguments.length?(l="function"==typeof t?t:Lk(+t),g(),h):l},h}var bS,BS,ES,xS,CS,MS,FS,kS,SS,QS,US,NS,TS,OS,IS,LS,PS,DS,RS,HS,_S,GS,KS,jS,zS,VS,WS,YS,XS,qS,$S,ZS,JS,tQ,eQ,nQ,rQ,iQ,oQ,AQ,sQ,aQ,cQ,lQ,uQ,hQ,dQ,fQ,gQ,pQ,vQ,mQ,yQ,wQ,bQ,BQ,EQ,xQ,CQ,MQ,FQ,kQ,SQ,QQ,UQ,NQ,TQ,OQ,IQ,LQ,PQ,DQ,RQ,HQ,_Q,GQ,KQ,jQ,zQ,VQ,WQ,YQ,XQ,qQ,$Q,ZQ,JQ,tU,eU,nU,rU,iU,oU,AU,sU,aU,cU,lU,uU,hU,dU,fU,gU,pU,vU,mU,yU,wU,bU="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function BU(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function EU(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if("function"==typeof e){var n=function t(){var n=!1;try{n=this instanceof t}catch{}return n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}),n}function xU(){if(xS)return ES;return xS=1,ES=function(t,e){return t===e||t!=t&&e!=e}}function CU(){if(MS)return CS;MS=1;var t=xU();return CS=function(e,n){for(var r=e.length;r--;)if(t(e[r][0],n))return r;return-1},CS}function MU(){if(LS)return IS;LS=1;var t=BS?bS:(BS=1,bS=function(){this.__data__=[],this.size=0}),e=function(){if(kS)return FS;kS=1;var t=CU(),e=Array.prototype.splice;return FS=function(n){var r=this.__data__,i=t(r,n);return!(i<0||(i==r.length-1?r.pop():e.call(r,i,1),--this.size,0))},FS}(),n=function(){if(QS)return SS;QS=1;var t=CU();return SS=function(e){var n=this.__data__,r=t(n,e);return r<0?void 0:n[r][1]},SS}(),r=function(){if(NS)return US;NS=1;var t=CU();return US=function(e){return t(this.__data__,e)>-1}}(),i=function(){if(OS)return TS;OS=1;var t=CU();return TS=function(e,n){var r=this.__data__,i=t(r,e);return i<0?(++this.size,r.push([e,n])):r[i][1]=n,this},TS}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,IS=o}function FU(){if(VS)return zS;VS=1;var t="object"==typeof bU&&bU&&bU.Object===Object&&bU;return zS=t}function kU(){if(YS)return WS;YS=1;var t=FU(),e="object"==typeof self&&self&&self.Object===Object&&self,n=t||e||Function("return this")();return WS=n}function SU(){if(qS)return XS;qS=1;var t=kU().Symbol;return XS=t}function QU(){if(nQ)return eQ;nQ=1;var t=SU(),e=function(){if(ZS)return $S;ZS=1;var t=SU(),e=Object.prototype,n=e.hasOwnProperty,r=e.toString,i=t?t.toStringTag:void 0;return $S=function(t){var e=n.call(t,i),o=t[i];try{t[i]=void 0;var A=!0}catch(t){}var s=r.call(t);return A&&(e?t[i]=o:delete t[i]),s}}(),n=function(){if(tQ)return JS;tQ=1;var t=Object.prototype.toString;return JS=function(e){return t.call(e)}}(),r=t?t.toStringTag:void 0;return eQ=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":r&&r in Object(t)?e(t):n(t)}}function UU(){if(iQ)return rQ;return iQ=1,rQ=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}}function NU(){if(AQ)return oQ;AQ=1;var t=QU(),e=UU();return oQ=function(n){if(!e(n))return!1;var r=t(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function TU(){if(lQ)return cQ;lQ=1;var t,e=function(){if(aQ)return sQ;aQ=1;var t=kU()["__core-js_shared__"];return sQ=t}(),n=(t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||""))?"Symbol(src)_1."+t:"";return cQ=function(t){return!!n&&n in t}}function OU(){if(hQ)return uQ;hQ=1;var t=Function.prototype.toString;return uQ=function(e){if(null!=e){try{return t.call(e)}catch(t){}try{return e+""}catch(t){}}return""}}function IU(){if(mQ)return vQ;mQ=1;var t=function(){if(fQ)return dQ;fQ=1;var t=NU(),e=TU(),n=UU(),r=OU(),i=/^\[object .+?Constructor\]$/,o=Function.prototype,A=Object.prototype,s=o.toString,a=A.hasOwnProperty,c=RegExp("^"+s.call(a).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return dQ=function(o){return!(!n(o)||e(o))&&(t(o)?c:i).test(r(o))}}(),e=pQ?gQ:(pQ=1,gQ=function(t,e){return null==t?void 0:t[e]});return vQ=function(n,r){var i=e(n,r);return t(i)?i:void 0}}function LU(){if(wQ)return yQ;wQ=1;var t=IU()(kU(),"Map");return yQ=t}function PU(){if(BQ)return bQ;BQ=1;var t=IU()(Object,"create");return bQ=t}function DU(){if(OQ)return TQ;OQ=1;var t=function(){if(xQ)return EQ;xQ=1;var t=PU();return EQ=function(){this.__data__=t?t(null):{},this.size=0}}(),e=MQ?CQ:(MQ=1,CQ=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}),n=function(){if(kQ)return FQ;kQ=1;var t=PU(),e=Object.prototype.hasOwnProperty;return FQ=function(n){var r=this.__data__;if(t){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return e.call(r,n)?r[n]:void 0},FQ}(),r=function(){if(QQ)return SQ;QQ=1;var t=PU(),e=Object.prototype.hasOwnProperty;return SQ=function(n){var r=this.__data__;return t?void 0!==r[n]:e.call(r,n)},SQ}(),i=function(){if(NQ)return UQ;NQ=1;var t=PU();return UQ=function(e,n){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=t&&void 0===n?"__lodash_hash_undefined__":n,this},UQ}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,TQ=o}function RU(){if(HQ)return RQ;HQ=1;var t=DQ?PQ:(DQ=1,PQ=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t});return RQ=function(e,n){var r=e.__data__;return t(n)?r["string"==typeof n?"string":"hash"]:r.map},RQ}function HU(){if(qQ)return XQ;qQ=1;var t=function(){if(LQ)return IQ;LQ=1;var t=DU(),e=MU(),n=LU();return IQ=function(){this.size=0,this.__data__={hash:new t,map:new(n||e),string:new t}}}(),e=function(){if(GQ)return _Q;GQ=1;var t=RU();return _Q=function(e){var n=t(this,e).delete(e);return this.size-=n?1:0,n}}(),n=function(){if(jQ)return KQ;jQ=1;var t=RU();return KQ=function(e){return t(this,e).get(e)}}(),r=function(){if(VQ)return zQ;VQ=1;var t=RU();return zQ=function(e){return t(this,e).has(e)}}(),i=function(){if(YQ)return WQ;YQ=1;var t=RU();return WQ=function(e,n){var r=t(this,e),i=r.size;return r.set(e,n),this.size+=r.size==i?0:1,this},WQ}();function o(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}return o.prototype.clear=t,o.prototype.delete=e,o.prototype.get=n,o.prototype.has=r,o.prototype.set=i,XQ=o}function _U(){if(tU)return JQ;tU=1;var t=MU(),e=function(){if(DS)return PS;DS=1;var t=MU();return PS=function(){this.__data__=new t,this.size=0}}(),n=(HS||(HS=1,RS=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}),RS),r=GS?_S:(GS=1,_S=function(t){return this.__data__.get(t)}),i=jS?KS:(jS=1,KS=function(t){return this.__data__.has(t)}),o=function(){if(ZQ)return $Q;ZQ=1;var t=MU(),e=LU(),n=HU();return $Q=function(r,i){var o=this.__data__;if(o instanceof t){var A=o.__data__;if(!e||A.length<199)return A.push([r,i]),this.size=++o.size,this;o=this.__data__=new n(A)}return o.set(r,i),this.size=o.size,this},$Q}();function A(e){var n=this.__data__=new t(e);this.size=n.size}return A.prototype.clear=e,A.prototype.delete=n,A.prototype.get=r,A.prototype.has=i,A.prototype.set=o,JQ=A}function GU(){if(nU)return eU;return nU=1,eU=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t},eU}function KU(){if(iU)return rU;iU=1;var t=IU(),e=function(){try{var e=t(Object,"defineProperty");return e({},"",{}),e}catch(t){}}();return rU=e}function jU(){if(AU)return oU;AU=1;var t=KU();return oU=function(e,n,r){"__proto__"==n&&t?t(e,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[n]=r}}function zU(){if(aU)return sU;aU=1;var t=jU(),e=xU(),n=Object.prototype.hasOwnProperty;return sU=function(r,i,o){var A=r[i];n.call(r,i)&&e(A,o)&&(void 0!==o||i in r)||t(r,i,o)}}function VU(){if(lU)return cU;lU=1;var t=zU(),e=jU();return cU=function(n,r,i,o){var A=!i;i||(i={});for(var s=-1,a=r.length;++s<a;){var c=r[s],l=o?o(i[c],n[c],c,i,n):void 0;void 0===l&&(l=n[c]),A?e(i,c,l):t(i,c,l)}return i},cU}function WU(){if(fU)return dU;return fU=1,dU=function(t){return null!=t&&"object"==typeof t}}function YU(){if(mU)return vU;mU=1;var t=function(){if(pU)return gU;pU=1;var t=QU(),e=WU();return gU=function(n){return e(n)&&"[object Arguments]"==t(n)}}(),e=WU(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,o=t(function(){return arguments}())?t:function(t){return e(t)&&r.call(t,"callee")&&!i.call(t,"callee")};return vU=o}function XU(){if(wU)return yU;wU=1;var t=Array.isArray;return yU=t}var qU,$U,ZU,JU,tN,eN,nN,rN,iN,oN,AN,sN={exports:{}};function aN(){return ZU||(ZU=1,function(t,e){var n=kU(),r=$U?qU:($U=1,qU=function(){return!1}),i=e&&!e.nodeType&&e,o=i&&t&&!t.nodeType&&t,A=o&&o.exports===i?n.Buffer:void 0,s=(A?A.isBuffer:void 0)||r;t.exports=s}(sN,sN.exports)),sN.exports}function cN(){if(tN)return JU;tN=1;var t=/^(?:0|[1-9]\d*)$/;return JU=function(e,n){var r=typeof e;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&t.test(e))&&e>-1&&e%1==0&&e<n},JU}function lN(){if(nN)return eN;nN=1;return eN=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}}function uN(){if(AN)return oN;return AN=1,oN=function(t){return function(e){return t(e)}}}var hN,dN,fN,gN,pN,vN,mN,yN,wN,bN,BN,EN,xN,CN,MN,FN,kN,SN,QN,UN,NN,TN,ON,IN,LN,PN,DN,RN={exports:{}};function HN(){return hN||(hN=1,function(t,e){var n=FU(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r&&n.process,A=function(){try{var t=i&&i.require&&i.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=A}(RN,RN.exports)),RN.exports}function _N(){if(fN)return dN;fN=1;var t=function(){if(iN)return rN;iN=1;var t=QU(),e=lN(),n=WU(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,rN=function(i){return n(i)&&e(i.length)&&!!r[t(i)]}}(),e=uN(),n=HN(),r=n&&n.isTypedArray,i=r?e(r):t;return dN=i}function GN(){if(pN)return gN;pN=1;var t=(hU||(hU=1,uU=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}),uU),e=YU(),n=XU(),r=aN(),i=cN(),o=_N(),A=Object.prototype.hasOwnProperty;return gN=function(s,a){var c=n(s),l=!c&&e(s),u=!c&&!l&&r(s),h=!c&&!l&&!u&&o(s),d=c||l||u||h,f=d?t(s.length,String):[],g=f.length;for(var p in s)!a&&!A.call(s,p)||d&&("length"==p||u&&("offset"==p||"parent"==p)||h&&("buffer"==p||"byteLength"==p||"byteOffset"==p)||i(p,g))||f.push(p);return f},gN}function KN(){if(mN)return vN;mN=1;var t=Object.prototype;return vN=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||t)}}function jN(){if(wN)return yN;return wN=1,yN=function(t,e){return function(n){return t(e(n))}},yN}function zN(){if(xN)return EN;xN=1;var t=KN(),e=function(){if(BN)return bN;BN=1;var t=jN()(Object.keys,Object);return bN=t}(),n=Object.prototype.hasOwnProperty;return EN=function(r){if(!t(r))return e(r);var i=[];for(var o in Object(r))n.call(r,o)&&"constructor"!=o&&i.push(o);return i}}function VN(){if(MN)return CN;MN=1;var t=NU(),e=lN();return CN=function(n){return null!=n&&e(n.length)&&!t(n)}}function WN(){if(kN)return FN;kN=1;var t=GN(),e=zN(),n=VN();return FN=function(r){return n(r)?t(r):e(r)}}function YN(){if(ON)return TN;ON=1;var t=UU(),e=KN(),n=NN?UN:(NN=1,UN=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}),r=Object.prototype.hasOwnProperty;return TN=function(i){if(!t(i))return n(i);var o=e(i),A=[];for(var s in i)("constructor"!=s||!o&&r.call(i,s))&&A.push(s);return A}}function XN(){if(LN)return IN;LN=1;var t=GN(),e=YN(),n=VN();return IN=function(r){return n(r)?t(r,!0):e(r)}}var qN,$N,ZN,JN,tT,eT,nT,rT,iT,oT,AT,sT,aT,cT,lT,uT,hT,dT,fT,gT,pT,vT,mT,yT,wT,bT,BT,ET,xT,CT,MT,FT,kT,ST,QT,UT,NT,TT,OT,IT,LT,PT,DT,RT,HT,_T,GT,KT,jT,zT,VT,WT,YT,XT,qT,$T,ZT,JT,tO,eO,nO,rO,iO,oO,AO,sO,aO,cO,lO,uO,hO,dO,fO,gO,pO,vO,mO,yO,wO,bO,BO,EO,xO,CO,MO,FO,kO,SO,QO,UO,NO,TO,OO,IO,LO,PO,DO,RO,HO,_O,GO,KO,jO,zO,VO,WO,YO,XO,qO,$O,ZO,JO,tI,eI,nI,rI,iI,oI,AI,sI,aI,cI,lI,uI,hI,dI,fI,gI,pI,vI,mI,yI,wI,bI,BI,EI,xI,CI,MI,FI,kI,SI,QI,UI,NI,TI,OI,II,LI,PI,DI,RI,HI,_I,GI,KI,jI,zI,VI,WI,YI,XI,qI,$I,ZI,JI,tL,eL,nL,rL,iL,oL,AL,sL,aL,cL,lL,uL,hL,dL,fL,gL,pL,vL,mL,yL,wL,bL,BL,EL,xL,CL,ML,FL,kL,SL,QL,UL,NL,TL,OL,IL,LL,PL,DL,RL,HL,_L,GL,KL,jL,zL,VL,WL,YL,XL,qL,$L,ZL,JL,tP,eP,nP,rP,iP,oP,AP,sP,aP,cP,lP,uP,hP,dP,fP,gP,pP,vP,mP,yP,wP,bP,BP,EP,xP,CP,MP,FP,kP,SP,QP,UP,NP,TP,OP,IP,LP,PP,DP,RP,HP,_P,GP,KP,jP,zP,VP,WP,YP,XP,qP,$P,ZP,JP,tD,eD,nD,rD,iD,oD,AD,sD,aD,cD,lD,uD,hD,dD,fD,gD,pD,vD,mD,yD,wD,bD,BD,ED,xD,CD,MD,FD,kD,SD,QD,UD,ND,TD,OD,ID,LD,PD,DD,RD,HD,_D,GD,KD,jD,zD,VD,WD,YD,XD,qD,$D,ZD,JD,tR,eR,nR,rR,iR,oR,AR,sR,aR,cR,lR,uR,hR,dR,fR,gR,pR,vR,mR,yR,wR,bR,BR,ER,xR,CR,MR,FR,kR,SR,QR,UR,NR,TR,OR,IR,LR,PR,DR,RR,HR,_R,GR,KR,jR,zR,VR,WR,YR,XR,qR,$R,ZR,JR,tH,eH,nH,rH,iH,oH,AH,sH,aH,cH,lH,uH,hH,dH,fH,gH,pH,vH,mH,yH,wH,bH,BH,EH,xH,CH,MH,FH,kH,SH,QH,UH,NH,TH,OH,IH,LH,PH,DH,RH,HH,_H,GH,KH,jH,zH,VH,WH,YH,XH={exports:{}};function qH(){return qN||(qN=1,function(t,e){var n=kU(),r=e&&!e.nodeType&&e,i=r&&t&&!t.nodeType&&t,o=i&&i.exports===r?n.Buffer:void 0,A=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=A?A(n):new t.constructor(n);return t.copy(r),r}}(XH,XH.exports)),XH.exports}function $H(){if(ZN)return $N;return ZN=1,$N=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e},$N}function ZH(){if(tT)return JN;return tT=1,JN=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,o=[];++n<r;){var A=t[n];e(A,n,t)&&(o[i++]=A)}return o},JN}function JH(){if(nT)return eT;return nT=1,eT=function(){return[]}}function t_(){if(iT)return rT;iT=1;var t=ZH(),e=JH(),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return rT=r?function(e){return null==e?[]:(e=Object(e),t(r(e),function(t){return n.call(e,t)}))}:e}function e_(){if(aT)return sT;return aT=1,sT=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t},sT}function n_(){if(lT)return cT;lT=1;var t=jN()(Object.getPrototypeOf,Object);return cT=t}function r_(){if(hT)return uT;hT=1;var t=e_(),e=n_(),n=t_(),r=JH(),i=Object.getOwnPropertySymbols;return uT=i?function(r){for(var i=[];r;)t(i,n(r)),r=e(r);return i}:r}function i_(){if(pT)return gT;pT=1;var t=e_(),e=XU();return gT=function(n,r,i){var o=r(n);return e(n)?o:t(o,i(n))}}function o_(){if(mT)return vT;mT=1;var t=i_(),e=t_(),n=WN();return vT=function(r){return t(r,n,e)}}function A_(){if(MT)return CT;MT=1;var t=IU()(kU(),"Set");return CT=t}function s_(){if(QT)return ST;QT=1;var t=function(){if(BT)return bT;BT=1;var t=IU()(kU(),"DataView");return bT=t}(),e=LU(),n=function(){if(xT)return ET;xT=1;var t=IU()(kU(),"Promise");return ET=t}(),r=A_(),i=function(){if(kT)return FT;kT=1;var t=IU()(kU(),"WeakMap");return FT=t}(),o=QU(),A=OU(),s="[object Map]",a="[object Promise]",c="[object Set]",l="[object WeakMap]",u="[object DataView]",h=A(t),d=A(e),f=A(n),g=A(r),p=A(i),v=o;return(t&&v(new t(new ArrayBuffer(1)))!=u||e&&v(new e)!=s||n&&v(n.resolve())!=a||r&&v(new r)!=c||i&&v(new i)!=l)&&(v=function(t){var e=o(t),n="[object Object]"==e?t.constructor:void 0,r=n?A(n):"";if(r)switch(r){case h:return u;case d:return s;case f:return a;case g:return c;case p:return l}return e}),ST=v}function a_(){if(OT)return TT;OT=1;var t=kU().Uint8Array;return TT=t}function c_(){if(LT)return IT;LT=1;var t=a_();return IT=function(e){var n=new e.constructor(e.byteLength);return new t(n).set(new t(e)),n}}function l_(){if(jT)return KT;jT=1;var t=c_();return KT=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}}function u_(){if(VT)return zT;VT=1;var t=c_(),e=function(){if(DT)return PT;DT=1;var t=c_();return PT=function(e,n){var r=n?t(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}}(),n=function(){if(HT)return RT;HT=1;var t=/\w*$/;return RT=function(e){var n=new e.constructor(e.source,t.exec(e));return n.lastIndex=e.lastIndex,n}}(),r=function(){if(GT)return _T;GT=1;var t=SU(),e=t?t.prototype:void 0,n=e?e.valueOf:void 0;return _T=function(t){return n?Object(n.call(t)):{}}}(),i=l_();return zT=function(o,A,s){var a=o.constructor;switch(A){case"[object ArrayBuffer]":return t(o);case"[object Boolean]":case"[object Date]":return new a(+o);case"[object DataView]":return e(o,s);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return i(o,s);case"[object Map]":case"[object Set]":return new a;case"[object Number]":case"[object String]":return new a(o);case"[object RegExp]":return n(o);case"[object Symbol]":return r(o)}}}function h_(){if(YT)return WT;YT=1;var t=UU(),e=Object.create,n=function(){function n(){}return function(r){if(!t(r))return{};if(e)return e(r);n.prototype=r;var i=new n;return n.prototype=void 0,i}}();return WT=n}function d_(){if(qT)return XT;qT=1;var t=h_(),e=n_(),n=KN();return XT=function(r){return"function"!=typeof r.constructor||n(r)?{}:t(e(r))}}function f_(){if(tO)return JT;tO=1;var t=function(){if(ZT)return $T;ZT=1;var t=s_(),e=WU();return $T=function(n){return e(n)&&"[object Map]"==t(n)}}(),e=uN(),n=HN(),r=n&&n.isMap,i=r?e(r):t;return JT=i}function g_(){if(iO)return rO;iO=1;var t=function(){if(nO)return eO;nO=1;var t=s_(),e=WU();return eO=function(n){return e(n)&&"[object Set]"==t(n)}}(),e=uN(),n=HN(),r=n&&n.isSet,i=r?e(r):t;return rO=i}function p_(){if(AO)return oO;AO=1;var t=_U(),e=GU(),n=zU(),r=function(){if(QN)return SN;QN=1;var t=VU(),e=WN();return SN=function(n,r){return n&&t(r,e(r),n)}}(),i=function(){if(DN)return PN;DN=1;var t=VU(),e=XN();return PN=function(n,r){return n&&t(r,e(r),n)}}(),o=qH(),A=$H(),s=function(){if(AT)return oT;AT=1;var t=VU(),e=t_();return oT=function(n,r){return t(n,e(n),r)}}(),a=function(){if(fT)return dT;fT=1;var t=VU(),e=r_();return dT=function(n,r){return t(n,e(n),r)}}(),c=o_(),l=function(){if(wT)return yT;wT=1;var t=i_(),e=r_(),n=XN();return yT=function(r){return t(r,n,e)}}(),u=s_(),h=function(){if(NT)return UT;NT=1;var t=Object.prototype.hasOwnProperty;return UT=function(e){var n=e.length,r=new e.constructor(n);return n&&"string"==typeof e[0]&&t.call(e,"index")&&(r.index=e.index,r.input=e.input),r},UT}(),d=u_(),f=d_(),g=XU(),p=aN(),v=f_(),m=UU(),y=g_(),w=WN(),b=XN(),B="[object Arguments]",E="[object Function]",x="[object Object]",C={};return C[B]=C["[object Array]"]=C["[object ArrayBuffer]"]=C["[object DataView]"]=C["[object Boolean]"]=C["[object Date]"]=C["[object Float32Array]"]=C["[object Float64Array]"]=C["[object Int8Array]"]=C["[object Int16Array]"]=C["[object Int32Array]"]=C["[object Map]"]=C["[object Number]"]=C[x]=C["[object RegExp]"]=C["[object Set]"]=C["[object String]"]=C["[object Symbol]"]=C["[object Uint8Array]"]=C["[object Uint8ClampedArray]"]=C["[object Uint16Array]"]=C["[object Uint32Array]"]=!0,C["[object Error]"]=C[E]=C["[object WeakMap]"]=!1,oO=function M(F,k,S,Q,U,N){var T,O=1&k,I=2&k,L=4&k;if(S&&(T=U?S(F,Q,U,N):S(F)),void 0!==T)return T;if(!m(F))return F;var P=g(F);if(P){if(T=h(F),!O)return A(F,T)}else{var D=u(F),R=D==E||"[object GeneratorFunction]"==D;if(p(F))return o(F,O);if(D==x||D==B||R&&!U){if(T=I||R?{}:f(F),!O)return I?a(F,i(T,F)):s(F,r(T,F))}else{if(!C[D])return U?F:{};T=d(F,D,O)}}N||(N=new t);var H=N.get(F);if(H)return H;N.set(F,T),y(F)?F.forEach(function(t){T.add(M(t,k,S,t,F,N))}):v(F)&&F.forEach(function(t,e){T.set(e,M(t,k,S,e,F,N))});var _=P?void 0:(L?I?l:c:I?b:w)(F);return e(_||F,function(t,e){_&&(t=F[e=t]),n(T,e,M(t,k,S,e,F,N))}),T},oO}function v_(){if(aO)return sO;aO=1;var t=p_();return sO=function(e){return t(e,4)}}function m_(){if(lO)return cO;return lO=1,cO=function(t){return function(){return t}}}function y_(){if(fO)return dO;fO=1;var t=(hO||(hO=1,uO=function(t){return function(e,n,r){for(var i=-1,o=Object(e),A=r(e),s=A.length;s--;){var a=A[t?s:++i];if(!1===n(o[a],a,o))break}return e}}),uO),e=t();return dO=e}function w_(){if(pO)return gO;pO=1;var t=y_(),e=WN();return gO=function(n,r){return n&&t(n,r,e)}}function b_(){if(wO)return yO;wO=1;var t=w_(),e=function(){if(mO)return vO;mO=1;var t=VN();return vO=function(e,n){return function(r,i){if(null==r)return r;if(!t(r))return e(r,i);for(var o=r.length,A=n?o:-1,s=Object(r);(n?A--:++A<o)&&!1!==i(s[A],A,s););return r}},vO}(),n=e(t);return yO=n}function B_(){if(BO)return bO;return BO=1,bO=function(t){return t}}function E_(){if(xO)return EO;xO=1;var t=B_();return EO=function(e){return"function"==typeof e?e:t}}function x_(){if(MO)return CO;MO=1;var t=GU(),e=b_(),n=E_(),r=XU();return CO=function(i,o){return(r(i)?t:e)(i,n(o))}}function C_(){return kO?FO:(kO=1,FO=x_())}function M_(){if(LO)return IO;LO=1;var t=HU(),e=NO?UO:(NO=1,UO=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}),n=OO?TO:(OO=1,TO=function(t){return this.__data__.has(t)});function r(e){var n=-1,r=null==e?0:e.length;for(this.__data__=new t;++n<r;)this.add(e[n])}return r.prototype.add=r.prototype.push=e,r.prototype.has=n,IO=r}function F_(){if(HO)return RO;return HO=1,RO=function(t,e){return t.has(e)}}function k_(){if(GO)return _O;GO=1;var t=M_(),e=(DO||(DO=1,PO=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}),PO),n=F_();return _O=function(r,i,o,A,s,a){var c=1&o,l=r.length,u=i.length;if(l!=u&&!(c&&u>l))return!1;var h=a.get(r),d=a.get(i);if(h&&d)return h==i&&d==r;var f=-1,g=!0,p=2&o?new t:void 0;for(a.set(r,i),a.set(i,r);++f<l;){var v=r[f],m=i[f];if(A)var y=c?A(m,v,f,i,r,a):A(v,m,f,r,i,a);if(void 0!==y){if(y)continue;g=!1;break}if(p){if(!e(i,function(t,e){if(!n(p,e)&&(v===t||s(v,t,o,A,a)))return p.push(e)})){g=!1;break}}else if(v!==m&&!s(v,m,o,A,a)){g=!1;break}}return a.delete(r),a.delete(i),g},_O}function S_(){if(VO)return zO;return VO=1,zO=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n},zO}function Q_(){if(YO)return WO;YO=1;var t=SU(),e=a_(),n=xU(),r=k_(),i=(jO||(jO=1,KO=function(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}),KO),o=S_(),A=t?t.prototype:void 0,s=A?A.valueOf:void 0;return WO=function(t,A,a,c,l,u,h){switch(a){case"[object DataView]":if(t.byteLength!=A.byteLength||t.byteOffset!=A.byteOffset)return!1;t=t.buffer,A=A.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=A.byteLength||!u(new e(t),new e(A)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+t,+A);case"[object Error]":return t.name==A.name&&t.message==A.message;case"[object RegExp]":case"[object String]":return t==A+"";case"[object Map]":var d=i;case"[object Set]":var f=1&c;if(d||(d=o),t.size!=A.size&&!f)return!1;var g=h.get(t);if(g)return g==A;c|=2,h.set(t,A);var p=r(d(t),d(A),c,l,u,h);return h.delete(t),p;case"[object Symbol]":if(s)return s.call(t)==s.call(A)}return!1}}function U_(){if(ZO)return $O;ZO=1;var t=_U(),e=k_(),n=Q_(),r=function(){if(qO)return XO;qO=1;var t=o_(),e=Object.prototype.hasOwnProperty;return XO=function(n,r,i,o,A,s){var a=1&i,c=t(n),l=c.length;if(l!=t(r).length&&!a)return!1;for(var u=l;u--;){var h=c[u];if(!(a?h in r:e.call(r,h)))return!1}var d=s.get(n),f=s.get(r);if(d&&f)return d==r&&f==n;var g=!0;s.set(n,r),s.set(r,n);for(var p=a;++u<l;){var v=n[h=c[u]],m=r[h];if(o)var y=a?o(m,v,h,r,n,s):o(v,m,h,n,r,s);if(!(void 0===y?v===m||A(v,m,i,o,s):y)){g=!1;break}p||(p="constructor"==h)}if(g&&!p){var w=n.constructor,b=r.constructor;w==b||!("constructor"in n)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof b&&b instanceof b||(g=!1)}return s.delete(n),s.delete(r),g},XO}(),i=s_(),o=XU(),A=aN(),s=_N(),a="[object Arguments]",c="[object Array]",l="[object Object]",u=Object.prototype.hasOwnProperty;return $O=function(h,d,f,g,p,v){var m=o(h),y=o(d),w=m?c:i(h),b=y?c:i(d),B=(w=w==a?l:w)==l,E=(b=b==a?l:b)==l,x=w==b;if(x&&A(h)){if(!A(d))return!1;m=!0,B=!1}if(x&&!B)return v||(v=new t),m||s(h)?e(h,d,f,g,p,v):n(h,d,w,f,g,p,v);if(!(1&f)){var C=B&&u.call(h,"__wrapped__"),M=E&&u.call(d,"__wrapped__");if(C||M){var F=C?h.value():h,k=M?d.value():d;return v||(v=new t),p(F,k,f,g,v)}}return!!x&&(v||(v=new t),r(h,d,f,g,p,v))}}function N_(){if(tI)return JO;tI=1;var t=U_(),e=WU();return JO=function n(r,i,o,A,s){return r===i||(null==r||null==i||!e(r)&&!e(i)?r!=r&&i!=i:t(r,i,o,A,n,s))},JO}function T_(){if(iI)return rI;iI=1;var t=UU();return rI=function(e){return e==e&&!t(e)}}function O_(){if(aI)return sI;return aI=1,sI=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}}function I_(){if(lI)return cI;lI=1;var t=function(){if(nI)return eI;nI=1;var t=_U(),e=N_();return eI=function(n,r,i,o){var A=i.length,s=A,a=!o;if(null==n)return!s;for(n=Object(n);A--;){var c=i[A];if(a&&c[2]?c[1]!==n[c[0]]:!(c[0]in n))return!1}for(;++A<s;){var l=(c=i[A])[0],u=n[l],h=c[1];if(a&&c[2]){if(void 0===u&&!(l in n))return!1}else{var d=new t;if(o)var f=o(u,h,l,n,r,d);if(!(void 0===f?e(h,u,3,o,d):f))return!1}}return!0},eI}(),e=function(){if(AI)return oI;AI=1;var t=T_(),e=WN();return oI=function(n){for(var r=e(n),i=r.length;i--;){var o=r[i],A=n[o];r[i]=[o,A,t(A)]}return r},oI}(),n=O_();return cI=function(r){var i=e(r);return 1==i.length&&i[0][2]?n(i[0][0],i[0][1]):function(e){return e===r||t(e,r,i)}}}function L_(){if(hI)return uI;hI=1;var t=QU(),e=WU();return uI=function(n){return"symbol"==typeof n||e(n)&&"[object Symbol]"==t(n)}}function P_(){if(fI)return dI;fI=1;var t=XU(),e=L_(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return dI=function(i,o){if(t(i))return!1;var A=typeof i;return!("number"!=A&&"symbol"!=A&&"boolean"!=A&&null!=i&&!e(i))||(r.test(i)||!n.test(i)||null!=o&&i in Object(o))}}function D_(){if(mI)return vI;mI=1;var t=function(){if(pI)return gI;pI=1;var t=HU();function e(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var t=arguments,e=r?r.apply(this,t):t[0],o=i.cache;if(o.has(e))return o.get(e);var A=n.apply(this,t);return i.cache=o.set(e,A)||o,A};return i.cache=new(e.Cache||t),i}return e.Cache=t,gI=e}();return vI=function(e){var n=t(e,function(t){return 500===r.size&&r.clear(),t}),r=n.cache;return n}}function R_(){if(BI)return bI;return BI=1,bI=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i},bI}function H_(){if(MI)return CI;MI=1;var t=function(){if(xI)return EI;xI=1;var t=SU(),e=R_(),n=XU(),r=L_(),i=t?t.prototype:void 0,o=i?i.toString:void 0;return EI=function t(i){if("string"==typeof i)return i;if(n(i))return e(i,t)+"";if(r(i))return o?o.call(i):"";var A=i+"";return"0"==A&&1/i==-1/0?"-0":A},EI}();return CI=function(e){return null==e?"":t(e)}}function __(){if(kI)return FI;kI=1;var t=XU(),e=P_(),n=function(){if(wI)return yI;wI=1;var t=D_(),e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=t(function(t){var r=[];return 46===t.charCodeAt(0)&&r.push(""),t.replace(e,function(t,e,i,o){r.push(i?o.replace(n,"$1"):e||t)}),r});return yI=r}(),r=H_();return FI=function(i,o){return t(i)?i:e(i,o)?[i]:n(r(i))}}function G_(){if(QI)return SI;QI=1;var t=L_();return SI=function(e){if("string"==typeof e||t(e))return e;var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}}function K_(){if(NI)return UI;NI=1;var t=__(),e=G_();return UI=function(n,r){for(var i=0,o=(r=t(r,n)).length;null!=n&&i<o;)n=n[e(r[i++])];return i&&i==o?n:void 0},UI}function j_(){if(DI)return PI;DI=1;var t=__(),e=YU(),n=XU(),r=cN(),i=lN(),o=G_();return PI=function(A,s,a){for(var c=-1,l=(s=t(s,A)).length,u=!1;++c<l;){var h=o(s[c]);if(!(u=null!=A&&a(A,h)))break;A=A[h]}return u||++c!=l?u:!!(l=null==A?0:A.length)&&i(l)&&r(h,l)&&(n(A)||e(A))},PI}function z_(){if(HI)return RI;HI=1;var t=LI?II:(LI=1,II=function(t,e){return null!=t&&e in Object(t)}),e=j_();return RI=function(n,r){return null!=n&&e(n,r,t)}}function V_(){if(GI)return _I;GI=1;var t=N_(),e=function(){if(OI)return TI;OI=1;var t=K_();return TI=function(e,n,r){var i=null==e?void 0:t(e,n);return void 0===i?r:i}}(),n=z_(),r=P_(),i=T_(),o=O_(),A=G_();return _I=function(s,a){return r(s)&&i(a)?o(A(s),a):function(r){var i=e(r,s);return void 0===i&&i===a?n(r,s):t(a,i,3)}}}function W_(){if(jI)return KI;return jI=1,KI=function(t){return function(e){return null==e?void 0:e[t]}}}function Y_(){if(YI)return WI;YI=1;var t=W_(),e=function(){if(VI)return zI;VI=1;var t=K_();return zI=function(e){return function(n){return t(n,e)}}}(),n=P_(),r=G_();return WI=function(i){return n(i)?t(r(i)):e(i)}}function X_(){if(qI)return XI;qI=1;var t=I_(),e=V_(),n=B_(),r=XU(),i=Y_();return XI=function(o){return"function"==typeof o?o:null==o?n:"object"==typeof o?r(o)?e(o[0],o[1]):t(o):i(o)}}function q_(){if(ZI)return $I;ZI=1;var t=ZH(),e=function(){if(QO)return SO;QO=1;var t=b_();return SO=function(e,n){var r=[];return t(e,function(t,e,i){n(t,e,i)&&r.push(t)}),r},SO}(),n=X_(),r=XU();return $I=function(i,o){return(r(i)?t:e)(i,n(o,3))}}function $_(){if(nL)return eL;nL=1;var t=function(){if(tL)return JI;tL=1;var t=Object.prototype.hasOwnProperty;return JI=function(e,n){return null!=e&&t.call(e,n)}}(),e=j_();return eL=function(n,r){return null!=n&&e(n,r,t)}}function Z_(){if(iL)return rL;iL=1;var t=zN(),e=s_(),n=YU(),r=XU(),i=VN(),o=aN(),A=KN(),s=_N(),a=Object.prototype.hasOwnProperty;return rL=function(c){if(null==c)return!0;if(i(c)&&(r(c)||"string"==typeof c||"function"==typeof c.splice||o(c)||s(c)||n(c)))return!c.length;var l=e(c);if("[object Map]"==l||"[object Set]"==l)return!c.size;if(A(c))return!t(c).length;for(var u in c)if(a.call(c,u))return!1;return!0}}function J_(){if(AL)return oL;return AL=1,oL=function(t){return void 0===t}}function tG(){if(aL)return sL;aL=1;var t=b_(),e=VN();return sL=function(n,r){var i=-1,o=e(n)?Array(n.length):[];return t(n,function(t,e,n){o[++i]=r(t,e,n)}),o},sL}function eG(){if(lL)return cL;lL=1;var t=R_(),e=X_(),n=tG(),r=XU();return cL=function(i,o){return(r(i)?t:n)(i,e(o,3))}}function nG(){if(pL)return gL;pL=1;var t=(hL||(hL=1,uL=function(t,e,n,r){var i=-1,o=null==t?0:t.length;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}),uL),e=b_(),n=X_(),r=(fL||(fL=1,dL=function(t,e,n,r,i){return i(t,function(t,i,o){n=r?(r=!1,t):e(n,t,i,o)}),n}),dL),i=XU();return gL=function(o,A,s){var a=i(o)?t:r,c=arguments.length<3;return a(o,n(A,4),s,c,e)},gL}function rG(){if(ML)return CL;ML=1;var t=function(){if(wL)return yL;wL=1;var t=W_()("length");return yL=t}(),e=function(){if(BL)return bL;BL=1;var t=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return bL=function(e){return t.test(e)}}(),n=function(){if(xL)return EL;xL=1;var t="\\ud800-\\udfff",e="["+t+"]",n="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",i="[^"+t+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",A="[\\ud800-\\udbff][\\udc00-\\udfff]",s="(?:"+n+"|"+r+")?",a="[\\ufe0e\\ufe0f]?",c=a+s+"(?:\\u200d(?:"+[i,o,A].join("|")+")"+a+s+")*",l="(?:"+[i+n+"?",n,o,A,e].join("|")+")",u=RegExp(r+"(?="+r+")|"+l+c,"g");return EL=function(t){for(var e=u.lastIndex=0;u.test(t);)++e;return e}}();return CL=function(r){return e(r)?n(r):t(r)}}function iG(){if(kL)return FL;kL=1;var t=zN(),e=s_(),n=VN(),r=function(){if(mL)return vL;mL=1;var t=QU(),e=XU(),n=WU();return vL=function(r){return"string"==typeof r||!e(r)&&n(r)&&"[object String]"==t(r)}}(),i=rG();return FL=function(o){if(null==o)return 0;if(n(o))return r(o)?i(o):o.length;var A=e(o);return"[object Map]"==A||"[object Set]"==A?o.size:t(o).length}}function oG(){if(QL)return SL;QL=1;var t=GU(),e=h_(),n=w_(),r=X_(),i=n_(),o=XU(),A=aN(),s=NU(),a=UU(),c=_N();return SL=function(l,u,h){var d=o(l),f=d||A(l)||c(l);if(u=r(u,4),null==h){var g=l&&l.constructor;h=f?d?new g:[]:a(l)&&s(g)?e(i(l)):{}}return(f?t:n)(l,function(t,e,n){return u(h,t,e,n)}),h},SL}function AG(){if(OL)return TL;OL=1;var t=e_(),e=function(){if(NL)return UL;NL=1;var t=SU(),e=YU(),n=XU(),r=t?t.isConcatSpreadable:void 0;return UL=function(t){return n(t)||e(t)||!!(r&&t&&t[r])}}();return TL=function n(r,i,o,A,s){var a=-1,c=r.length;for(o||(o=e),s||(s=[]);++a<c;){var l=r[a];i>0&&o(l)?i>1?n(l,i-1,o,A,s):t(s,l):A||(s[s.length]=l)}return s},TL}function sG(){if(DL)return PL;DL=1;var t=LL?IL:(LL=1,IL=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}),e=Math.max;return PL=function(n,r,i){return r=e(void 0===r?n.length-1:r,0),function(){for(var o=arguments,A=-1,s=e(o.length-r,0),a=Array(s);++A<s;)a[A]=o[r+A];A=-1;for(var c=Array(r+1);++A<r;)c[A]=o[A];return c[r]=i(a),t(n,this,c)}},PL}function aG(){if(jL)return KL;jL=1;var t=function(){if(HL)return RL;HL=1;var t=m_(),e=KU(),n=B_();return RL=e?function(n,r){return e(n,"toString",{configurable:!0,enumerable:!1,value:t(r),writable:!0})}:n}(),e=function(){if(GL)return _L;GL=1;var t=Date.now;return _L=function(e){var n=0,r=0;return function(){var i=t(),o=16-(i-r);if(r=i,o>0){if(++n>=800)return arguments[0]}else n=0;return e.apply(void 0,arguments)}},_L}(),n=e(t);return KL=n}function cG(){if(VL)return zL;VL=1;var t=B_(),e=sG(),n=aG();return zL=function(r,i){return n(e(r,i,t),r+"")}}function lG(){if(YL)return WL;return YL=1,WL=function(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1},WL}function uG(){if(tP)return JL;tP=1;var t=lG(),e=qL?XL:(qL=1,XL=function(t){return t!=t}),n=(ZL||(ZL=1,$L=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}),$L);return JL=function(r,i,o){return i==i?n(r,i,o):t(r,e,o)}}function hG(){if(aP)return sP;aP=1;var t=A_(),e=AP?oP:(AP=1,oP=function(){}),n=S_(),r=t&&1/n(new t([,-0]))[1]==1/0?function(e){return new t(e)}:e;return sP=r}function dG(){if(lP)return cP;lP=1;var t=M_(),e=function(){if(nP)return eP;nP=1;var t=uG();return eP=function(e,n){return!(null==e||!e.length)&&t(e,n,0)>-1}}(),n=(iP||(iP=1,rP=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}),rP),r=F_(),i=hG(),o=S_();return cP=function(A,s,a){var c=-1,l=e,u=A.length,h=!0,d=[],f=d;if(a)h=!1,l=n;else if(u>=200){var g=s?null:i(A);if(g)return o(g);h=!1,l=r,f=new t}else f=s?[]:d;t:for(;++c<u;){var p=A[c],v=s?s(p):p;if(p=a||0!==p?p:0,h&&v==v){for(var m=f.length;m--;)if(f[m]===v)continue t;s&&f.push(v),d.push(p)}else l(f,v,a)||(f!==d&&f.push(v),d.push(p))}return d},cP}function fG(){if(hP)return uP;hP=1;var t=VN(),e=WU();return uP=function(n){return e(n)&&t(n)}}function gG(){if(fP)return dP;fP=1;var t=AG(),e=cG(),n=dG(),r=fG(),i=e(function(e){return n(t(e,1,r,!0))});return dP=i}function pG(){if(mP)return vP;mP=1;var t=function(){if(pP)return gP;pP=1;var t=R_();return gP=function(e,n){return t(n,function(t){return e[t]})}}(),e=WN();return vP=function(n){return null==n?[]:t(n,e(n))}}function vG(){if(wP)return yP;var t;wP=1;try{t={clone:v_(),constant:m_(),each:C_(),filter:q_(),has:$_(),isArray:XU(),isEmpty:Z_(),isFunction:NU(),isUndefined:J_(),keys:WN(),map:eG(),reduce:nG(),size:iG(),transform:oG(),union:gG(),values:pG()}}catch(t){}return t||(t=window._),yP=t}function mG(){if(BP)return bP;BP=1;var t=vG();bP=n;var e="\0";function n(n){this._isDirected=!t.has(n,"directed")||n.directed,this._isMultigraph=!!t.has(n,"multigraph")&&n.multigraph,this._isCompound=!!t.has(n,"compound")&&n.compound,this._label=void 0,this._defaultNodeLabelFn=t.constant(void 0),this._defaultEdgeLabelFn=t.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[e]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function r(t,e){t[e]?t[e]++:t[e]=1}function i(t,e){--t[e]||delete t[e]}function o(e,n,r,i){var o=""+n,A=""+r;if(!e&&o>A){var s=o;o=A,A=s}return o+""+A+""+(t.isUndefined(i)?"\0":i)}function A(t,e){return o(t,e.v,e.w,e.name)}return n.prototype._nodeCount=0,n.prototype._edgeCount=0,n.prototype.isDirected=function(){return this._isDirected},n.prototype.isMultigraph=function(){return this._isMultigraph},n.prototype.isCompound=function(){return this._isCompound},n.prototype.setGraph=function(t){return this._label=t,this},n.prototype.graph=function(){return this._label},n.prototype.setDefaultNodeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultNodeLabelFn=e,this},n.prototype.nodeCount=function(){return this._nodeCount},n.prototype.nodes=function(){return t.keys(this._nodes)},n.prototype.sources=function(){var e=this;return t.filter(this.nodes(),function(n){return t.isEmpty(e._in[n])})},n.prototype.sinks=function(){var e=this;return t.filter(this.nodes(),function(n){return t.isEmpty(e._out[n])})},n.prototype.setNodes=function(e,n){var r=arguments,i=this;return t.each(e,function(t){r.length>1?i.setNode(t,n):i.setNode(t)}),this},n.prototype.setNode=function(n,r){return t.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=e,this._children[n]={},this._children[e][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},n.prototype.node=function(t){return this._nodes[t]},n.prototype.hasNode=function(e){return t.has(this._nodes,e)},n.prototype.removeNode=function(e){var n=this;if(t.has(this._nodes,e)){var r=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],t.each(this.children(e),function(t){n.setParent(t)}),delete this._children[e]),t.each(t.keys(this._in[e]),r),delete this._in[e],delete this._preds[e],t.each(t.keys(this._out[e]),r),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this},n.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(r))r=e;else{for(var i=r+="";!t.isUndefined(i);i=this.parent(i))if(i===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},n.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},n.prototype.parent=function(t){if(this._isCompound){var n=this._parent[t];if(n!==e)return n}},n.prototype.children=function(n){if(t.isUndefined(n)&&(n=e),this._isCompound){var r=this._children[n];if(r)return t.keys(r)}else{if(n===e)return this.nodes();if(this.hasNode(n))return[]}},n.prototype.predecessors=function(e){var n=this._preds[e];if(n)return t.keys(n)},n.prototype.successors=function(e){var n=this._sucs[e];if(n)return t.keys(n)},n.prototype.neighbors=function(e){var n=this.predecessors(e);if(n)return t.union(n,this.successors(e))},n.prototype.isLeaf=function(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length},n.prototype.filterNodes=function(e){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;t.each(this._nodes,function(t,r){e(r)&&n.setNode(r,t)}),t.each(this._edgeObjs,function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,r.edge(t))});var i={};function o(t){var e=r.parent(t);return void 0===e||n.hasNode(e)?(i[t]=e,e):e in i?i[e]:o(e)}return this._isCompound&&t.each(n.nodes(),function(t){n.setParent(t,o(t))}),n},n.prototype.setDefaultEdgeLabel=function(e){return t.isFunction(e)||(e=t.constant(e)),this._defaultEdgeLabelFn=e,this},n.prototype.edgeCount=function(){return this._edgeCount},n.prototype.edges=function(){return t.values(this._edgeObjs)},n.prototype.setPath=function(e,n){var r=this,i=arguments;return t.reduce(e,function(t,e){return i.length>1?r.setEdge(t,e,n):r.setEdge(t,e),e}),this},n.prototype.setEdge=function(){var e,n,i,A,s=!1,a=arguments[0];"object"==typeof a&&null!==a&&"v"in a?(e=a.v,n=a.w,i=a.name,2===arguments.length&&(A=arguments[1],s=!0)):(e=a,n=arguments[1],i=arguments[3],arguments.length>2&&(A=arguments[2],s=!0)),e=""+e,n=""+n,t.isUndefined(i)||(i=""+i);var c=o(this._isDirected,e,n,i);if(t.has(this._edgeLabels,c))return s&&(this._edgeLabels[c]=A),this;if(!t.isUndefined(i)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[c]=s?A:this._defaultEdgeLabelFn(e,n,i);var l=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var A=i;i=o,o=A}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,e,n,i);return e=l.v,n=l.w,Object.freeze(l),this._edgeObjs[c]=l,r(this._preds[n],e),r(this._sucs[e],n),this._in[n][c]=l,this._out[e][c]=l,this._edgeCount++,this},n.prototype.edge=function(t,e,n){var r=1===arguments.length?A(this._isDirected,arguments[0]):o(this._isDirected,t,e,n);return this._edgeLabels[r]},n.prototype.hasEdge=function(e,n,r){var i=1===arguments.length?A(this._isDirected,arguments[0]):o(this._isDirected,e,n,r);return t.has(this._edgeLabels,i)},n.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?A(this._isDirected,arguments[0]):o(this._isDirected,t,e,n),s=this._edgeObjs[r];return s&&(t=s.v,e=s.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[e],t),i(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},n.prototype.inEdges=function(e,n){var r=this._in[e];if(r){var i=t.values(r);return n?t.filter(i,function(t){return t.v===n}):i}},n.prototype.outEdges=function(e,n){var r=this._out[e];if(r){var i=t.values(r);return n?t.filter(i,function(t){return t.w===n}):i}},n.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))},bP}function yG(){return MP?CP:(MP=1,CP={Graph:mG(),version:xP?EP:(xP=1,EP="2.1.8")})}function wG(){if(kP)return FP;kP=1;var t=vG(),e=mG();function n(e){return t.map(e.nodes(),function(n){var r=e.node(n),i=e.parent(n),o={v:n};return t.isUndefined(r)||(o.value=r),t.isUndefined(i)||(o.parent=i),o})}function r(e){return t.map(e.edges(),function(n){var r=e.edge(n),i={v:n.v,w:n.w};return t.isUndefined(n.name)||(i.name=n.name),t.isUndefined(r)||(i.value=r),i})}return FP={write:function(e){var i={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n(e),edges:r(e)};t.isUndefined(e.graph())||(i.value=t.clone(e.graph()));return i},read:function(n){var r=new e(n.options).setGraph(n.value);return t.each(n.nodes,function(t){r.setNode(t.v,t.value),t.parent&&r.setParent(t.v,t.parent)}),t.each(n.edges,function(t){r.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),r}},FP}function bG(){if(QP)return SP;QP=1;var t=vG();return SP=function(e){var n,r={},i=[];function o(i){t.has(r,i)||(r[i]=!0,n.push(i),t.each(e.successors(i),o),t.each(e.predecessors(i),o))}return t.each(e.nodes(),function(t){n=[],o(t),n.length&&i.push(n)}),i},SP}function BG(){if(NP)return UP;NP=1;var t=vG();function e(){this._arr=[],this._keyIndices={}}return UP=e,e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(t){return t.key})},e.prototype.has=function(e){return t.has(this._keyIndices,e)},e.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},e.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(e,n){var r=this._keyIndices;if(e=String(e),!t.has(r,e)){var i=this._arr,o=i.length;return r[e]=o,i.push({key:e,priority:n}),this._decrease(o),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},e.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},e.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))},e.prototype._decrease=function(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e},e.prototype._swap=function(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e},UP}function EG(){if(OP)return TP;OP=1;var t=vG(),e=BG();TP=function(t,r,i,o){return function(t,n,r,i){var o,A,s={},a=new e,c=function(t){var e=t.v!==o?t.v:t.w,n=s[e],i=r(t),c=A.distance+i;if(i<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+i);c<n.distance&&(n.distance=c,n.predecessor=o,a.decrease(e,c))};t.nodes().forEach(function(t){var e=t===n?0:Number.POSITIVE_INFINITY;s[t]={distance:e},a.add(t,e)});for(;a.size()>0&&(o=a.removeMin(),(A=s[o]).distance!==Number.POSITIVE_INFINITY);)i(o).forEach(c);return s}(t,String(r),i||n,o||function(e){return t.outEdges(e)})};var n=t.constant(1);return TP}function xG(){if(LP)return IP;LP=1;var t=EG(),e=vG();return IP=function(n,r,i){return e.transform(n.nodes(),function(e,o){e[o]=t(n,o,r,i)},{})},IP}function CG(){if(DP)return PP;DP=1;var t=vG();return PP=function(e){var n=0,r=[],i={},o=[];function A(s){var a=i[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),e.successors(s).forEach(function(e){t.has(i,e)?i[e].onStack&&(a.lowlink=Math.min(a.lowlink,i[e].index)):(A(e),a.lowlink=Math.min(a.lowlink,i[e].lowlink))}),a.lowlink===a.index){var c,l=[];do{c=r.pop(),i[c].onStack=!1,l.push(c)}while(s!==c);o.push(l)}}return e.nodes().forEach(function(e){t.has(i,e)||A(e)}),o},PP}function MG(){if(HP)return RP;HP=1;var t=vG(),e=CG();return RP=function(n){return t.filter(e(n),function(t){return t.length>1||1===t.length&&n.hasEdge(t[0],t[0])})},RP}function FG(){if(GP)return _P;GP=1;var t=vG();_P=function(t,n,r){return function(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],A=o[n],s=r.distance+i.distance;s<A.distance&&(A.distance=s,A.predecessor=i.predecessor)})})}),r}(t,n||e,r||function(e){return t.outEdges(e)})};var e=t.constant(1);return _P}function kG(){if(jP)return KP;jP=1;var t=vG();function e(e){var r={},i={},o=[];if(t.each(e.sinks(),function A(s){if(t.has(i,s))throw new n;t.has(r,s)||(i[s]=!0,r[s]=!0,t.each(e.predecessors(s),A),delete i[s],o.push(s))}),t.size(r)!==e.nodeCount())throw new n;return o}function n(){}return KP=e,e.CycleException=n,n.prototype=new Error,KP}function SG(){if(VP)return zP;VP=1;var t=kG();return zP=function(e){try{t(e)}catch(e){if(e instanceof t.CycleException)return!1;throw e}return!0},zP}function QG(){if(YP)return WP;YP=1;var t=vG();function e(n,r,i,o,A,s){t.has(o,r)||(o[r]=!0,i||s.push(r),t.each(A(r),function(t){e(n,t,i,o,A,s)}),i&&s.push(r))}return WP=function(n,r,i){t.isArray(r)||(r=[r]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),A=[],s={};return t.each(r,function(t){if(!n.hasNode(t))throw new Error("Graph does not have node: "+t);e(n,t,"post"===i,s,o,A)}),A},WP}function UG(){if(qP)return XP;qP=1;var t=QG();return XP=function(e,n){return t(e,n,"post")},XP}function NG(){if(ZP)return $P;ZP=1;var t=QG();return $P=function(e,n){return t(e,n,"pre")},$P}function TG(){if(tD)return JP;tD=1;var t=vG(),e=mG(),n=BG();return JP=function(r,i){var o,A=new e,s={},a=new n;function c(t){var e=t.v===o?t.w:t.v,n=a.priority(e);if(void 0!==n){var r=i(t);r<n&&(s[e]=o,a.decrease(e,r))}}if(0===r.nodeCount())return A;t.each(r.nodes(),function(t){a.add(t,Number.POSITIVE_INFINITY),A.setNode(t)}),a.decrease(r.nodes()[0],0);var l=!1;for(;a.size()>0;){if(o=a.removeMin(),t.has(s,o))A.setEdge(o,s[o]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(o).forEach(c)}return A},JP}function OG(){if(iD)return rD;iD=1;var t=yG();return rD={Graph:t.Graph,json:wG(),alg:nD?eD:(nD=1,eD={components:bG(),dijkstra:EG(),dijkstraAll:xG(),findCycles:MG(),floydWarshall:FG(),isAcyclic:SG(),postorder:UG(),preorder:NG(),prim:TG(),tarjan:CG(),topsort:kG()}),version:t.version}}function IG(){if(AD)return oD;var t;AD=1;try{t=OG()}catch(t){}return t||(t=window.graphlib),oD=t}function LG(){if(aD)return sD;aD=1;var t=p_();return sD=function(e){return t(e,5)}}function PG(){if(lD)return cD;lD=1;var t=xU(),e=VN(),n=cN(),r=UU();return cD=function(i,o,A){if(!r(A))return!1;var s=typeof o;return!!("number"==s?e(A)&&n(o,A.length):"string"==s&&o in A)&&t(A[o],i)},cD}function DG(){if(hD)return uD;hD=1;var t=cG(),e=xU(),n=PG(),r=XN(),i=Object.prototype,o=i.hasOwnProperty,A=t(function(t,A){t=Object(t);var s=-1,a=A.length,c=a>2?A[2]:void 0;for(c&&n(A[0],A[1],c)&&(a=1);++s<a;)for(var l=A[s],u=r(l),h=-1,d=u.length;++h<d;){var f=u[h],g=t[f];(void 0===g||e(g,i[f])&&!o.call(t,f))&&(t[f]=l[f])}return t});return uD=A}function RG(){if(mD)return vD;mD=1;var t=function(){if(pD)return gD;pD=1;var t=/\s/;return gD=function(e){for(var n=e.length;n--&&t.test(e.charAt(n)););return n},gD}(),e=/^\s+/;return vD=function(n){return n?n.slice(0,t(n)+1).replace(e,""):n}}function HG(){if(BD)return bD;BD=1;var t=function(){if(wD)return yD;wD=1;var t=RG(),e=UU(),n=L_(),r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,A=parseInt;return yD=function(s){if("number"==typeof s)return s;if(n(s))return NaN;if(e(s)){var a="function"==typeof s.valueOf?s.valueOf():s;s=e(a)?a+"":a}if("string"!=typeof s)return 0===s?s:+s;s=t(s);var c=i.test(s);return c||o.test(s)?A(s.slice(2),c?2:8):r.test(s)?NaN:+s}}(),e=1/0;return bD=function(n){return n?(n=t(n))===e||n===-1/0?17976931348623157e292*(n<0?-1:1):n==n?n:0:0===n?n:0}}function _G(){if(MD)return CD;MD=1;var t=lG(),e=X_(),n=function(){if(xD)return ED;xD=1;var t=HG();return ED=function(e){var n=t(e),r=n%1;return n==n?r?n-r:n:0}}(),r=Math.max;return CD=function(i,o,A){var s=null==i?0:i.length;if(!s)return-1;var a=null==A?0:n(A);return a<0&&(a=r(s+a,0)),t(i,e(o,3),a)},CD}function GG(){if(kD)return FD;kD=1;var t=function(){if(fD)return dD;fD=1;var t=X_(),e=VN(),n=WN();return dD=function(r){return function(i,o,A){var s=Object(i);if(!e(i)){var a=t(o,3);i=n(i),o=function(t){return a(s[t],t,s)}}var c=r(i,o,A);return c>-1?s[a?i[c]:c]:void 0}},dD}(),e=t(_G());return FD=e}function KG(){if(QD)return SD;QD=1;var t=AG();return SD=function(e){return(null==e?0:e.length)?t(e,1):[]}}function jG(){if(ND)return UD;ND=1;var t=y_(),e=E_(),n=XN();return UD=function(r,i){return null==r?r:t(r,e(i),n)}}function zG(){if(OD)return TD;return OD=1,TD=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0},TD}function VG(){if(LD)return ID;LD=1;var t=jU(),e=w_(),n=X_();return ID=function(r,i){var o={};return i=n(i,3),e(r,function(e,n,r){t(o,n,i(e,n,r))}),o}}function WG(){if(DD)return PD;DD=1;var t=L_();return PD=function(e,n,r){for(var i=-1,o=e.length;++i<o;){var A=e[i],s=n(A);if(null!=s&&(void 0===a?s==s&&!t(s):r(s,a)))var a=s,c=A}return c},PD}function YG(){if(GD)return _D;GD=1;var t=WG(),e=HD?RD:(HD=1,RD=function(t,e){return t>e}),n=B_();return _D=function(r){return r&&r.length?t(r,n,e):void 0}}function XG(){if(jD)return KD;jD=1;var t=jU(),e=xU();return KD=function(n,r,i){(void 0!==i&&!e(n[r],i)||void 0===i&&!(r in n))&&t(n,r,i)}}function qG(){if(YD)return WD;return YD=1,WD=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}}function $G(){if(ZD)return $D;ZD=1;var t=XG(),e=qH(),n=l_(),r=$H(),i=d_(),o=YU(),A=XU(),s=fG(),a=aN(),c=NU(),l=UU(),u=function(){if(VD)return zD;VD=1;var t=QU(),e=n_(),n=WU(),r=Function.prototype,i=Object.prototype,o=r.toString,A=i.hasOwnProperty,s=o.call(Object);return zD=function(r){if(!n(r)||"[object Object]"!=t(r))return!1;var i=e(r);if(null===i)return!0;var a=A.call(i,"constructor")&&i.constructor;return"function"==typeof a&&a instanceof a&&o.call(a)==s}}(),h=_N(),d=qG(),f=function(){if(qD)return XD;qD=1;var t=VU(),e=XN();return XD=function(n){return t(n,e(n))}}();return $D=function(g,p,v,m,y,w,b){var B=d(g,v),E=d(p,v),x=b.get(E);if(x)t(g,v,x);else{var C=w?w(B,E,v+"",g,p,b):void 0,M=void 0===C;if(M){var F=A(E),k=!F&&a(E),S=!F&&!k&&h(E);C=E,F||k||S?A(B)?C=B:s(B)?C=r(B):k?(M=!1,C=e(E,!0)):S?(M=!1,C=n(E,!0)):C=[]:u(E)||o(E)?(C=B,o(B)?C=f(B):l(B)&&!c(B)||(C=i(E))):M=!1}M&&(b.set(E,C),y(C,E,m,w,b),b.delete(E)),t(g,v,C)}}}function ZG(){if(iR)return rR;iR=1;var t=function(){if(tR)return JD;tR=1;var t=_U(),e=XG(),n=y_(),r=$G(),i=UU(),o=XN(),A=qG();return JD=function s(a,c,l,u,h){a!==c&&n(c,function(n,o){if(h||(h=new t),i(n))r(a,c,o,l,s,u,h);else{var d=u?u(A(a,o),n,o+"",a,c,h):void 0;void 0===d&&(d=n),e(a,o,d)}},o)},JD}(),e=function(){if(nR)return eR;nR=1;var t=cG(),e=PG();return eR=function(n){return t(function(t,r){var i=-1,o=r.length,A=o>1?r[o-1]:void 0,s=o>2?r[2]:void 0;for(A=n.length>3&&"function"==typeof A?(o--,A):void 0,s&&e(r[0],r[1],s)&&(A=o<3?void 0:A,o=1),t=Object(t);++i<o;){var a=r[i];a&&n(t,a,i,A)}return t})},eR}(),n=e(function(e,n,r){t(e,n,r)});return rR=n}function JG(){if(AR)return oR;return AR=1,oR=function(t,e){return t<e}}function tK(){if(aR)return sR;aR=1;var t=WG(),e=JG(),n=B_();return sR=function(r){return r&&r.length?t(r,n,e):void 0}}function eK(){if(lR)return cR;lR=1;var t=WG(),e=X_(),n=JG();return cR=function(r,i){return r&&r.length?t(r,e(i,2),n):void 0}}function nK(){if(hR)return uR;hR=1;var t=kU();return uR=function(){return t.Date.now()}}function rK(){if(pR)return gR;pR=1;var t=K_(),e=function(){if(fR)return dR;fR=1;var t=zU(),e=__(),n=cN(),r=UU(),i=G_();return dR=function(o,A,s,a){if(!r(o))return o;for(var c=-1,l=(A=e(A,o)).length,u=l-1,h=o;null!=h&&++c<l;){var d=i(A[c]),f=s;if("__proto__"===d||"constructor"===d||"prototype"===d)return o;if(c!=u){var g=h[d];void 0===(f=a?a(g,d,h):void 0)&&(f=r(g)?g:n(A[c+1])?[]:{})}t(h,d,f),h=h[d]}return o},dR}(),n=__();return gR=function(r,i,o){for(var A=-1,s=i.length,a={};++A<s;){var c=i[A],l=t(r,c);o(l,c)&&e(a,n(c,r),l)}return a},gR}function iK(){if(BR)return bR;BR=1;var t=function(){if(mR)return vR;mR=1;var t=rK(),e=z_();return vR=function(n,r){return t(n,r,function(t,r){return e(n,r)})}}(),e=function(){if(wR)return yR;wR=1;var t=KG(),e=sG(),n=aG();return yR=function(r){return n(e(r,void 0,t),r+"")}}(),n=e(function(e,n){return null==e?{}:t(e,n)});return bR=n}function oK(){if(MR)return CR;MR=1;var t=function(){if(xR)return ER;xR=1;var t=Math.ceil,e=Math.max;return ER=function(n,r,i,o){for(var A=-1,s=e(t((r-n)/(i||1)),0),a=Array(s);s--;)a[o?s:++A]=n,n+=i;return a},ER}(),e=PG(),n=HG();return CR=function(r){return function(i,o,A){return A&&"number"!=typeof A&&e(i,o,A)&&(o=A=void 0),i=n(i),void 0===o?(o=i,i=0):o=n(o),A=void 0===A?i<o?1:-1:n(A),t(i,o,A,r)}},CR}function AK(){if(kR)return FR;kR=1;var t=oK()();return FR=t}function sK(){if(OR)return TR;OR=1;var t=function(){if(NR)return UR;NR=1;var t=L_();return UR=function(e,n){if(e!==n){var r=void 0!==e,i=null===e,o=e==e,A=t(e),s=void 0!==n,a=null===n,c=n==n,l=t(n);if(!a&&!l&&!A&&e>n||A&&s&&c&&!a&&!l||i&&s&&c||!r&&c||!o)return 1;if(!i&&!A&&!l&&e<n||l&&r&&o&&!i&&!A||a&&r&&o||!s&&o||!c)return-1}return 0}}();return TR=function(e,n,r){for(var i=-1,o=e.criteria,A=n.criteria,s=o.length,a=r.length;++i<s;){var c=t(o[i],A[i]);if(c)return i>=a?c:c*("desc"==r[i]?-1:1)}return e.index-n.index},TR}function aK(){if(LR)return IR;LR=1;var t=R_(),e=K_(),n=X_(),r=tG(),i=(QR||(QR=1,SR=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}),SR),o=uN(),A=sK(),s=B_(),a=XU();return IR=function(c,l,u){l=l.length?t(l,function(t){return a(t)?function(n){return e(n,1===t.length?t[0]:t)}:t}):[s];var h=-1;l=t(l,o(n));var d=r(c,function(e,n,r){return{criteria:t(l,function(t){return t(e)}),index:++h,value:e}});return i(d,function(t,e){return A(t,e,u)})},IR}function cK(){if(DR)return PR;DR=1;var t=AG(),e=aK(),n=cG(),r=PG(),i=n(function(n,i){if(null==n)return[];var o=i.length;return o>1&&r(n,i[0],i[1])?i=[]:o>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),e(n,t(i,1),[])});return PR=i}function lK(){if(HR)return RR;HR=1;var t=H_(),e=0;return RR=function(n){var r=++e;return t(n)+r},RR}function uK(){if(jR)return KR;jR=1;var t=zU(),e=(GR||(GR=1,_R=function(t,e,n){for(var r=-1,i=t.length,o=e.length,A={};++r<i;){var s=r<o?e[r]:void 0;n(A,t[r],s)}return A}),_R);return KR=function(n,r){return e(n||[],r||[],t)},KR}function hK(){if(VR)return zR;var t;VR=1;try{t={cloneDeep:LG(),constant:m_(),defaults:DG(),each:C_(),filter:q_(),find:GG(),flatten:KG(),forEach:x_(),forIn:jG(),has:$_(),isUndefined:J_(),last:zG(),map:eG(),mapValues:VG(),max:YG(),merge:ZG(),min:tK(),minBy:eK(),now:nK(),pick:iK(),range:AK(),reduce:nG(),sortBy:cK(),uniqueId:lK(),values:pG(),zipObject:uK()}}catch(t){}return t||(t=window._),zR=t}function dK(){if(qR)return XR;qR=1;var t=hK(),e=IG().Graph,n=function(){if(YR)return WR;function t(){var t={};t._next=t._prev=t,this._sentinel=t}function e(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function n(t,e){if("_next"!==t&&"_prev"!==t)return e}return YR=1,WR=t,t.prototype.dequeue=function(){var t=this._sentinel,n=t._prev;if(n!==t)return e(n),n},t.prototype.enqueue=function(t){var n=this._sentinel;t._prev&&t._next&&e(t),t._next=n._next,n._next._prev=t,n._next=t,t._prev=n},t.prototype.toString=function(){for(var t=[],e=this._sentinel,r=e._prev;r!==e;)t.push(JSON.stringify(r,n)),r=r._prev;return"["+t.join(", ")+"]"},WR}();XR=function(A,s){if(A.nodeCount()<=1)return[];var a=function(r,i){var A=new e,s=0,a=0;t.forEach(r.nodes(),function(t){A.setNode(t,{v:t,in:0,out:0})}),t.forEach(r.edges(),function(t){var e=A.edge(t.v,t.w)||0,n=i(t),r=e+n;A.setEdge(t.v,t.w,r),a=Math.max(a,A.node(t.v).out+=n),s=Math.max(s,A.node(t.w).in+=n)});var c=t.range(a+s+3).map(function(){return new n}),l=s+1;return t.forEach(A.nodes(),function(t){o(c,l,A.node(t))}),{graph:A,buckets:c,zeroIdx:l}}(A,s||r),c=function(t,e,n){var r,o=[],A=e[e.length-1],s=e[0];for(;t.nodeCount();){for(;r=s.dequeue();)i(t,e,n,r);for(;r=A.dequeue();)i(t,e,n,r);if(t.nodeCount())for(var a=e.length-2;a>0;--a)if(r=e[a].dequeue()){o=o.concat(i(t,e,n,r,!0));break}}return o}(a.graph,a.buckets,a.zeroIdx);return t.flatten(t.map(c,function(t){return A.outEdges(t.v,t.w)}),!0)};var r=t.constant(1);function i(e,n,r,i,A){var s=A?[]:void 0;return t.forEach(e.inEdges(i.v),function(t){var i=e.edge(t),a=e.node(t.v);A&&s.push({v:t.v,w:t.w}),a.out-=i,o(n,r,a)}),t.forEach(e.outEdges(i.v),function(t){var i=e.edge(t),A=t.w,s=e.node(A);s.in-=i,o(n,r,s)}),e.removeNode(i.v),s}function o(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}return XR}function fK(){if(ZR)return $R;ZR=1;var t=hK(),e=dK();return $R={run:function(n){var r="greedy"===n.graph().acyclicer?e(n,function(t){return function(e){return t.edge(e).weight}}(n)):function(e){var n=[],r={},i={};function o(A){t.has(i,A)||(i[A]=!0,r[A]=!0,t.forEach(e.outEdges(A),function(e){t.has(r,e.w)?n.push(e):o(e.w)}),delete r[A])}return t.forEach(e.nodes(),o),n}(n);t.forEach(r,function(e){var r=n.edge(e);n.removeEdge(e),r.forwardName=e.name,r.reversed=!0,n.setEdge(e.w,e.v,r,t.uniqueId("rev"))})},undo:function(e){t.forEach(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}},$R}function gK(){if(tH)return JR;tH=1;var t=hK(),e=IG().Graph;function n(e,n,r,i){var o;do{o=t.uniqueId(i)}while(e.hasNode(o));return r.dummy=n,e.setNode(o,r),o}function r(e){return t.max(t.map(e.nodes(),function(n){var r=e.node(n).rank;if(!t.isUndefined(r))return r}))}return JR={addDummyNode:n,simplify:function(n){var r=(new e).setGraph(n.graph());return t.forEach(n.nodes(),function(t){r.setNode(t,n.node(t))}),t.forEach(n.edges(),function(t){var e=r.edge(t.v,t.w)||{weight:0,minlen:1},i=n.edge(t);r.setEdge(t.v,t.w,{weight:e.weight+i.weight,minlen:Math.max(e.minlen,i.minlen)})}),r},asNonCompoundGraph:function(n){var r=new e({multigraph:n.isMultigraph()}).setGraph(n.graph());return t.forEach(n.nodes(),function(t){n.children(t).length||r.setNode(t,n.node(t))}),t.forEach(n.edges(),function(t){r.setEdge(t,n.edge(t))}),r},successorWeights:function(e){var n=t.map(e.nodes(),function(n){var r={};return t.forEach(e.outEdges(n),function(t){r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return t.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=t.map(e.nodes(),function(n){var r={};return t.forEach(e.inEdges(n),function(t){r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return t.zipObject(e.nodes(),n)},intersectRect:function(t,e){var n,r,i=t.x,o=t.y,A=e.x-i,s=e.y-o,a=t.width/2,c=t.height/2;if(!A&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*a>Math.abs(A)*c?(s<0&&(c=-c),n=c*A/s,r=c):(A<0&&(a=-a),n=a,r=a*s/A);return{x:i+n,y:o+r}},buildLayerMatrix:function(e){var n=t.map(t.range(r(e)+1),function(){return[]});return t.forEach(e.nodes(),function(r){var i=e.node(r),o=i.rank;t.isUndefined(o)||(n[o][i.order]=r)}),n},normalizeRanks:function(e){var n=t.min(t.map(e.nodes(),function(t){return e.node(t).rank}));t.forEach(e.nodes(),function(r){var i=e.node(r);t.has(i,"rank")&&(i.rank-=n)})},removeEmptyRanks:function(e){var n=t.min(t.map(e.nodes(),function(t){return e.node(t).rank})),r=[];t.forEach(e.nodes(),function(t){var i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});var i=0,o=e.graph().nodeRankFactor;t.forEach(r,function(n,r){t.isUndefined(n)&&r%o!==0?--i:i&&t.forEach(n,function(t){e.node(t).rank+=i})})},addBorderNode:function(t,e,r,i){var o={width:0,height:0};arguments.length>=4&&(o.rank=r,o.order=i);return n(t,"border",o,e)},maxRank:r,partition:function(e,n){var r={lhs:[],rhs:[]};return t.forEach(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r},time:function(e,n){var r=t.now();try{return n()}finally{console.log(e+" time: "+(t.now()-r)+"ms")}},notime:function(t,e){return e()}},JR}function pK(){if(nH)return eH;nH=1;var t=hK(),e=gK();return eH={run:function(n){n.graph().dummyChains=[],t.forEach(n.edges(),function(t){!function(t,n){var r,i,o,A=n.v,s=t.node(A).rank,a=n.w,c=t.node(a).rank,l=n.name,u=t.edge(n),h=u.labelRank;if(c===s+1)return;for(t.removeEdge(n),o=0,++s;s<c;++o,++s)u.points=[],i={width:0,height:0,edgeLabel:u,edgeObj:n,rank:s},r=e.addDummyNode(t,"edge",i,"_d"),s===h&&(i.width=u.width,i.height=u.height,i.dummy="edge-label",i.labelpos=u.labelpos),t.setEdge(A,r,{weight:u.weight},l),0===o&&t.graph().dummyChains.push(r),A=r;t.setEdge(A,a,{weight:u.weight},l)}(n,t)})},undo:function(e){t.forEach(e.graph().dummyChains,function(t){var n,r=e.node(t),i=r.edgeLabel;for(e.setEdge(r.edgeObj,i);r.dummy;)n=e.successors(t)[0],e.removeNode(t),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),t=n,r=e.node(t)})}},eH}function vK(){if(iH)return rH;iH=1;var t=hK();return rH={longestPath:function(e){var n={};t.forEach(e.sources(),function r(i){var o=e.node(i);if(t.has(n,i))return o.rank;n[i]=!0;var A=t.min(t.map(e.outEdges(i),function(t){return r(t.w)-e.edge(t).minlen}));return A!==Number.POSITIVE_INFINITY&&null!=A||(A=0),o.rank=A})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}},rH}function mK(){if(AH)return oH;AH=1;var t=hK(),e=IG().Graph,n=vK().slack;function r(e,r){return t.forEach(e.nodes(),function i(o){t.forEach(r.nodeEdges(o),function(t){var A=t.v,s=o===A?t.w:A;e.hasNode(s)||n(r,t)||(e.setNode(s,{}),e.setEdge(o,s,{}),i(s))})}),e.nodeCount()}function i(e,r){return t.minBy(r.edges(),function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return n(r,t)})}function o(e,n,r){t.forEach(e.nodes(),function(t){n.node(t).rank+=r})}return oH=function(t){var A,s,a=new e({directed:!1}),c=t.nodes()[0],l=t.nodeCount();a.setNode(c,{});for(;r(a,t)<l;)A=i(a,t),s=a.hasNode(A.v)?n(t,A):-n(t,A),o(a,t,s);return a},oH}function yK(){if(aH)return sH;aH=1;var t=hK(),e=mK(),n=vK().slack,r=vK().longestPath,i=IG().alg.preorder,o=IG().alg.postorder,A=gK().simplify;function s(t){t=A(t),r(t);var n,i=e(t);for(l(i),a(i,t);n=h(i);)f(i,t,n,d(i,t,n))}function a(e,n){var r=o(e,e.nodes());r=r.slice(0,r.length-1),t.forEach(r,function(t){!function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=c(t,e,n)}(e,n,t)})}function c(e,n,r){var i=e.node(r).parent,o=!0,A=n.edge(r,i),s=0;return A||(o=!1,A=n.edge(i,r)),s=A.weight,t.forEach(n.nodeEdges(r),function(t){var A=t.v===r,a=A?t.w:t.v;if(a!==i){var c=A===o,l=n.edge(t).weight;if(s+=c?l:-l,function(t,e,n){return t.hasEdge(e,n)}(e,r,a)){var u=e.edge(r,a).cutvalue;s+=c?-u:u}}}),s}function l(t,e){arguments.length<2&&(e=t.nodes()[0]),u(t,{},1,e)}function u(e,n,r,i,o){var A=r,s=e.node(i);return n[i]=!0,t.forEach(e.neighbors(i),function(o){t.has(n,o)||(r=u(e,n,r,o,i))}),s.low=A,s.lim=r++,o?s.parent=o:delete s.parent,r}function h(e){return t.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function d(e,r,i){var o=i.v,A=i.w;r.hasEdge(o,A)||(o=i.w,A=i.v);var s=e.node(o),a=e.node(A),c=s,l=!1;s.lim>a.lim&&(c=a,l=!0);var u=t.filter(r.edges(),function(t){return l===g(e,e.node(t.v),c)&&l!==g(e,e.node(t.w),c)});return t.minBy(u,function(t){return n(r,t)})}function f(e,n,r,o){var A=r.v,s=r.w;e.removeEdge(A,s),e.setEdge(o.v,o.w,{}),l(e),a(e,n),function(e,n){var r=t.find(e.nodes(),function(t){return!n.node(t).parent}),o=i(e,r);o=o.slice(1),t.forEach(o,function(t){var r=e.node(t).parent,i=n.edge(t,r),o=!1;i||(i=n.edge(r,t),o=!0),n.node(t).rank=n.node(r).rank+(o?i.minlen:-i.minlen)})}(e,n)}function g(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}return sH=s,s.initLowLimValues=l,s.initCutValues=a,s.calcCutValue=c,s.leaveEdge=h,s.enterEdge=d,s.exchangeEdges=f,sH}function wK(){if(lH)return cH;lH=1;var t=vK().longestPath,e=mK(),n=yK();cH=function(n){switch(n.graph().ranker){case"network-simplex":default:i(n);break;case"tight-tree":!function(n){t(n),e(n)}(n);break;case"longest-path":r(n)}};var r=t;function i(t){n(t)}return cH}function bK(){if(hH)return uH;hH=1;var t=hK();return uH=function(e){var n=function(e){var n={},r=0;function i(o){var A=r;t.forEach(e.children(o),i),n[o]={low:A,lim:r++}}return t.forEach(e.children(),i),n}(e);t.forEach(e.graph().dummyChains,function(t){for(var r=e.node(t),i=r.edgeObj,o=function(t,e,n,r){var i,o,A=[],s=[],a=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),A.push(i)}while(i&&(e[i].low>a||c>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:A.concat(s.reverse()),lca:o}}(e,n,i.v,i.w),A=o.path,s=o.lca,a=0,c=A[a],l=!0;t!==i.w;){if(r=e.node(t),l){for(;(c=A[a])!==s&&e.node(c).maxRank<r.rank;)a++;c===s&&(l=!1)}if(!l){for(;a<A.length-1&&e.node(c=A[a+1]).minRank<=r.rank;)a++;c=A[a]}e.setParent(t,c),t=e.successors(t)[0]}})},uH}function BK(){if(fH)return dH;fH=1;var t=hK(),e=gK();function n(r,i,o,A,s,a,c){var l=r.children(c);if(l.length){var u=e.addBorderNode(r,"_bt"),h=e.addBorderNode(r,"_bb"),d=r.node(c);r.setParent(u,c),d.borderTop=u,r.setParent(h,c),d.borderBottom=h,t.forEach(l,function(t){n(r,i,o,A,s,a,t);var e=r.node(t),l=e.borderTop?e.borderTop:t,d=e.borderBottom?e.borderBottom:t,f=e.borderTop?A:2*A,g=l!==d?1:s-a[c]+1;r.setEdge(u,l,{weight:f,minlen:g,nestingEdge:!0}),r.setEdge(d,h,{weight:f,minlen:g,nestingEdge:!0})}),r.parent(c)||r.setEdge(i,u,{weight:0,minlen:s+a[c]})}else c!==i&&r.setEdge(i,c,{weight:0,minlen:o})}return dH={run:function(r){var i=e.addDummyNode(r,"root",{},"_root"),o=function(e){var n={};function r(i,o){var A=e.children(i);A&&A.length&&t.forEach(A,function(t){r(t,o+1)}),n[i]=o}return t.forEach(e.children(),function(t){r(t,1)}),n}(r),A=t.max(t.values(o))-1,s=2*A+1;r.graph().nestingRoot=i,t.forEach(r.edges(),function(t){r.edge(t).minlen*=s});var a=function(e){return t.reduce(e.edges(),function(t,n){return t+e.edge(n).weight},0)}(r)+1;t.forEach(r.children(),function(t){n(r,i,s,a,A,o,t)}),r.graph().nodeRankFactor=s},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,t.forEach(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}},dH}function EK(){if(mH)return vH;mH=1;var t=hK();function e(e){t.forEach(e.nodes(),function(t){n(e.node(t))}),t.forEach(e.edges(),function(t){n(e.edge(t))})}function n(t){var e=t.width;t.width=t.height,t.height=e}function r(t){t.y=-t.y}function i(t){var e=t.x;t.x=t.y,t.y=e}return vH={adjust:function(t){var n=t.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||e(t)},undo:function(n){var o=n.graph().rankdir.toLowerCase();"bt"!==o&&"rl"!==o||function(e){t.forEach(e.nodes(),function(t){r(e.node(t))}),t.forEach(e.edges(),function(n){var i=e.edge(n);t.forEach(i.points,r),t.has(i,"y")&&r(i)})}(n);"lr"!==o&&"rl"!==o||(!function(e){t.forEach(e.nodes(),function(t){i(e.node(t))}),t.forEach(e.edges(),function(n){var r=e.edge(n);t.forEach(r.points,i),t.has(r,"x")&&i(r)})}(n),e(n))}},vH}function xK(){if(MH)return CH;MH=1;var t=hK();return CH=function(e,n){var r={};return t.forEach(e,function(e,n){var i=r[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};t.isUndefined(e.barycenter)||(i.barycenter=e.barycenter,i.weight=e.weight)}),t.forEach(n.edges(),function(e){var n=r[e.v],i=r[e.w];t.isUndefined(n)||t.isUndefined(i)||(i.indegree++,n.out.push(r[e.w]))}),function(e){var n=[];function r(e){return function(n){n.merged||(t.isUndefined(n.barycenter)||t.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(e,n)}}function i(t){return function(n){n.in.push(t),0===--n.indegree&&e.push(n)}}for(;e.length;){var o=e.pop();n.push(o),t.forEach(o.in.reverse(),r(o)),t.forEach(o.out,i(o))}return t.map(t.filter(n,function(t){return!t.merged}),function(e){return t.pick(e,["vs","i","barycenter","weight"])})}(t.filter(r,function(t){return!t.indegree}))},CH}function CK(){if(QH)return SH;QH=1;var t=hK(),e=function(){if(xH)return EH;xH=1;var t=hK();return EH=function(e,n){return t.map(n,function(n){var r=e.inEdges(n);if(r.length){var i=t.reduce(r,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}return{v:n}})},EH}(),n=xK(),r=function(){if(kH)return FH;kH=1;var t=hK(),e=gK();function n(e,n,r){for(var i;n.length&&(i=t.last(n)).i<=r;)n.pop(),e.push(i.vs),r++;return r}return FH=function(r,i){var o,A=e.partition(r,function(e){return t.has(e,"barycenter")}),s=A.lhs,a=t.sortBy(A.rhs,function(t){return-t.i}),c=[],l=0,u=0,h=0;s.sort((o=!!i,function(t,e){return t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:o?e.i-t.i:t.i-e.i})),h=n(c,a,h),t.forEach(s,function(t){h+=t.vs.length,c.push(t.vs),l+=t.barycenter*t.weight,u+=t.weight,h=n(c,a,h)});var d={vs:t.flatten(c,!0)};return u&&(d.barycenter=l/u,d.weight=u),d}}();return SH=function i(o,A,s,a){var c=o.children(A),l=o.node(A),u=l?l.borderLeft:void 0,h=l?l.borderRight:void 0,d={};u&&(c=t.filter(c,function(t){return t!==u&&t!==h}));var f=e(o,c);t.forEach(f,function(e){if(o.children(e.v).length){var n=i(o,e.v,s,a);d[e.v]=n,t.has(n,"barycenter")&&(r=e,A=n,t.isUndefined(r.barycenter)?(r.barycenter=A.barycenter,r.weight=A.weight):(r.barycenter=(r.barycenter*r.weight+A.barycenter*A.weight)/(r.weight+A.weight),r.weight+=A.weight))}var r,A});var g=n(f,s);!function(e,n){t.forEach(e,function(e){e.vs=t.flatten(e.vs.map(function(t){return n[t]?n[t].vs:t}),!0)})}(g,d);var p=r(g,a);if(u&&(p.vs=t.flatten([u,p.vs,h],!0),o.predecessors(u).length)){var v=o.node(o.predecessors(u)[0]),m=o.node(o.predecessors(h)[0]);t.has(p,"barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+v.order+m.order)/(p.weight+2),p.weight+=2}return p},SH}function MK(){if(NH)return UH;NH=1;var t=hK(),e=IG().Graph;return UH=function(n,r,i){var o=function(e){var n;for(;e.hasNode(n=t.uniqueId("_root")););return n}(n),A=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(t){return n.node(t)});return t.forEach(n.nodes(),function(e){var s=n.node(e),a=n.parent(e);(s.rank===r||s.minRank<=r&&r<=s.maxRank)&&(A.setNode(e),A.setParent(e,a||o),t.forEach(n[i](e),function(r){var i=r.v===e?r.w:r.v,o=A.edge(i,e),s=t.isUndefined(o)?0:o.weight;A.setEdge(i,e,{weight:n.edge(r).weight+s})}),t.has(s,"minRank")&&A.setNode(e,{borderLeft:s.borderLeft[r],borderRight:s.borderRight[r]}))}),A},UH}function FK(){if(LH)return IH;LH=1;var t=hK(),e=function(){if(wH)return yH;wH=1;var t=hK();return yH=function(e){var n={},r=t.filter(e.nodes(),function(t){return!e.children(t).length}),i=t.max(t.map(r,function(t){return e.node(t).rank})),o=t.map(t.range(i+1),function(){return[]});function A(r){if(!t.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),t.forEach(e.successors(r),A)}}var s=t.sortBy(r,function(t){return e.node(t).rank});return t.forEach(s,A),o},yH}(),n=function(){if(BH)return bH;BH=1;var t=hK();function e(e,n,r){for(var i=t.zipObject(r,t.map(r,function(t,e){return e})),o=t.flatten(t.map(n,function(n){return t.sortBy(t.map(e.outEdges(n),function(t){return{pos:i[t.w],weight:e.edge(t).weight}}),"pos")}),!0),A=1;A<r.length;)A<<=1;var s=2*A-1;A-=1;var a=t.map(new Array(s),function(){return 0}),c=0;return t.forEach(o.forEach(function(t){var e=t.pos+A;a[e]+=t.weight;for(var n=0;e>0;)e%2&&(n+=a[e+1]),a[e=e-1>>1]+=t.weight;c+=t.weight*n})),c}return bH=function(t,n){for(var r=0,i=1;i<n.length;++i)r+=e(t,n[i-1],n[i]);return r},bH}(),r=CK(),i=MK(),o=function(){if(OH)return TH;OH=1;var t=hK();return TH=function(e,n,r){var i,o={};t.forEach(r,function(t){for(var r,A,s=e.parent(t);s;){if((r=e.parent(s))?(A=o[r],o[r]=s):(A=i,i=s),A&&A!==s)return void n.setEdge(A,s);s=r}})},TH}(),A=IG().Graph,s=gK();function a(e,n,r){return t.map(n,function(t){return i(e,t,r)})}function c(e,n){var i=new A;t.forEach(e,function(e){var A=e.graph().root,s=r(e,A,i,n);t.forEach(s.vs,function(t,n){e.node(t).order=n}),o(e,i,s.vs)})}function l(e,n){t.forEach(n,function(n){t.forEach(n,function(t,n){e.node(t).order=n})})}return IH=function(r){var i=s.maxRank(r),o=a(r,t.range(1,i+1),"inEdges"),A=a(r,t.range(i-1,-1,-1),"outEdges"),u=e(r);l(r,u);for(var h,d=Number.POSITIVE_INFINITY,f=0,g=0;g<4;++f,++g){c(f%2?o:A,f%4>=2),u=s.buildLayerMatrix(r);var p=n(r,u);p<d&&(g=0,h=t.cloneDeep(u),d=p)}l(r,h)},IH}function kK(){if(DH)return PH;DH=1;var t=hK(),e=IG().Graph,n=gK();function r(e,n){var r={};return t.reduce(n,function(n,i){var A=0,s=0,a=n.length,c=t.last(i);return t.forEach(i,function(n,l){var u=function(e,n){if(e.node(n).dummy)return t.find(e.predecessors(n),function(t){return e.node(t).dummy})}(e,n),h=u?e.node(u).order:a;(u||n===c)&&(t.forEach(i.slice(s,l+1),function(n){t.forEach(e.predecessors(n),function(t){var i=e.node(t),s=i.order;!(s<A||h<s)||i.dummy&&e.node(n).dummy||o(r,t,n)})}),s=l+1,A=h)}),i}),r}function i(e,n){var r={};function i(n,i,A,s,a){var c;t.forEach(t.range(i,A),function(i){c=n[i],e.node(c).dummy&&t.forEach(e.predecessors(c),function(t){var n=e.node(t);n.dummy&&(n.order<s||n.order>a)&&o(r,t,c)})})}return t.reduce(n,function(n,r){var o,A=-1,s=0;return t.forEach(r,function(t,a){if("border"===e.node(t).dummy){var c=e.predecessors(t);c.length&&(o=e.node(c[0]).order,i(r,s,a,A,o),s=a,A=o)}i(r,s,r.length,o,n.length)}),r}),r}function o(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function A(e,n,r){if(n>r){var i=n;n=r,r=i}return t.has(e[n],r)}function s(e,n,r,i){var o={},s={},a={};return t.forEach(n,function(e){t.forEach(e,function(t,e){o[t]=t,s[t]=t,a[t]=e})}),t.forEach(n,function(e){var n=-1;t.forEach(e,function(e){var c=i(e);if(c.length){c=t.sortBy(c,function(t){return a[t]});for(var l=(c.length-1)/2,u=Math.floor(l),h=Math.ceil(l);u<=h;++u){var d=c[u];s[e]===e&&n<a[d]&&!A(r,e,d)&&(s[d]=e,s[e]=o[e]=o[d],n=a[d])}}})}),{root:o,align:s}}function a(n,r,i,o,A){var s={},a=function(n,r,i,o){var A=new e,s=n.graph(),a=function(e,n,r){return function(i,o,A){var s,a=i.node(o),c=i.node(A),l=0;if(l+=a.width/2,t.has(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":s=-a.width/2;break;case"r":s=a.width/2}if(s&&(l+=r?s:-s),s=0,l+=(a.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,t.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":s=c.width/2;break;case"r":s=-c.width/2}return s&&(l+=r?s:-s),s=0,l}}(s.nodesep,s.edgesep,o);return t.forEach(r,function(e){var r;t.forEach(e,function(t){var e=i[t];if(A.setNode(e),r){var o=i[r],s=A.edge(o,e);A.setEdge(o,e,Math.max(a(n,t,r),s||0))}r=t})}),A}(n,r,i,A),c=A?"borderLeft":"borderRight";function l(t,e){for(var n=a.nodes(),r=n.pop(),i={};r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}return l(function(t){s[t]=a.inEdges(t).reduce(function(t,e){return Math.max(t,s[e.v]+a.edge(e))},0)},a.predecessors.bind(a)),l(function(t){var e=a.outEdges(t).reduce(function(t,e){return Math.min(t,s[e.w]-a.edge(e))},Number.POSITIVE_INFINITY),r=n.node(t);e!==Number.POSITIVE_INFINITY&&r.borderType!==c&&(s[t]=Math.max(s[t],e))},a.successors.bind(a)),t.forEach(o,function(t){s[t]=s[i[t]]}),s}function c(e,n){return t.minBy(t.values(n),function(n){var r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return t.forIn(n,function(t,n){var o=function(t,e){return t.node(e).width}(e,n)/2;r=Math.max(t+o,r),i=Math.min(t-o,i)}),r-i})}function l(e,n){var r=t.values(n),i=t.min(r),o=t.max(r);t.forEach(["u","d"],function(r){t.forEach(["l","r"],function(A){var s,a=r+A,c=e[a];if(c!==n){var l=t.values(c);(s="l"===A?i-t.min(l):o-t.max(l))&&(e[a]=t.mapValues(c,function(t){return t+s}))}})})}function u(e,n){return t.mapValues(e.ul,function(r,i){if(n)return e[n.toLowerCase()][i];var o=t.sortBy(t.map(e,i));return(o[1]+o[2])/2})}return PH={positionX:function(e){var o,A=n.buildLayerMatrix(e),h=t.merge(r(e,A),i(e,A)),d={};t.forEach(["u","d"],function(n){o="u"===n?A:t.values(A).reverse(),t.forEach(["l","r"],function(r){"r"===r&&(o=t.map(o,function(e){return t.values(e).reverse()}));var i=("u"===n?e.predecessors:e.successors).bind(e),A=s(e,o,h,i),c=a(e,o,A.root,A.align,"r"===r);"r"===r&&(c=t.mapValues(c,function(t){return-t})),d[n+r]=c})});var f=c(e,d);return l(d,f),u(d,e.graph().align)},findType1Conflicts:r,findType2Conflicts:i,addConflict:o,hasConflict:A,verticalAlignment:s,horizontalCompaction:a,alignCoordinates:l,findSmallestWidthAlignment:c,balance:u},PH}function SK(){if(HH)return RH;HH=1;var t=hK(),e=gK(),n=kK().positionX;return RH=function(r){r=e.asNonCompoundGraph(r),function(n){var r=e.buildLayerMatrix(n),i=n.graph().ranksep,o=0;t.forEach(r,function(e){var r=t.max(t.map(e,function(t){return n.node(t).height}));t.forEach(e,function(t){n.node(t).y=o+r/2}),o+=r+i})}(r),t.forEach(n(r),function(t,e){r.node(e).x=t})},RH}function QK(){if(GH)return _H;GH=1;var t=hK(),e=fK(),n=pK(),r=wK(),i=gK().normalizeRanks,o=bK(),A=gK().removeEmptyRanks,s=BK(),a=function(){if(pH)return gH;pH=1;var t=hK(),e=gK();function n(t,n,r,i,o,A){var s={width:0,height:0,rank:A,borderType:n},a=o[n][A-1],c=e.addDummyNode(t,"border",s,r);o[n][A]=c,t.setParent(c,i),a&&t.setEdge(a,c,{weight:1})}return gH=function(e){t.forEach(e.children(),function r(i){var o=e.children(i),A=e.node(i);if(o.length&&t.forEach(o,r),t.has(A,"minRank")){A.borderLeft=[],A.borderRight=[];for(var s=A.minRank,a=A.maxRank+1;s<a;++s)n(e,"borderLeft","_bl",i,A,s),n(e,"borderRight","_br",i,A,s)}})},gH}(),c=EK(),l=FK(),u=SK(),h=gK(),d=IG().Graph;_H=function(x,C){var M=C&&C.debugTiming?h.time:h.notime;M("layout",function(){var C=M(" buildLayoutGraph",function(){return function(e){var n=new d({multigraph:!0,compound:!0}),r=E(e.graph());return n.setGraph(t.merge({},g,B(r,f),t.pick(r,p))),t.forEach(e.nodes(),function(r){var i=E(e.node(r));n.setNode(r,t.defaults(B(i,v),m)),n.setParent(r,e.parent(r))}),t.forEach(e.edges(),function(r){var i=E(e.edge(r));n.setEdge(r,t.merge({},w,B(i,y),t.pick(i,b)))}),n}(x)});M(" runLayout",function(){!function(d,f){f(" makeSpaceForEdgeLabels",function(){!function(e){var n=e.graph();n.ranksep/=2,t.forEach(e.edges(),function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(d)}),f(" removeSelfEdges",function(){!function(e){t.forEach(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(d)}),f(" acyclic",function(){e.run(d)}),f(" nestingGraph.run",function(){s.run(d)}),f(" rank",function(){r(h.asNonCompoundGraph(d))}),f(" injectEdgeLabelProxies",function(){!function(e){t.forEach(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v),i={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};h.addDummyNode(e,"edge-proxy",i,"_ep")}})}(d)}),f(" removeEmptyRanks",function(){A(d)}),f(" nestingGraph.cleanup",function(){s.cleanup(d)}),f(" normalizeRanks",function(){i(d)}),f(" assignRankMinMax",function(){!function(e){var n=0;t.forEach(e.nodes(),function(r){var i=e.node(r);i.borderTop&&(i.minRank=e.node(i.borderTop).rank,i.maxRank=e.node(i.borderBottom).rank,n=t.max(n,i.maxRank))}),e.graph().maxRank=n}(d)}),f(" removeEdgeLabelProxies",function(){!function(e){t.forEach(e.nodes(),function(t){var n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}(d)}),f(" normalize.run",function(){n.run(d)}),f(" parentDummyChains",function(){o(d)}),f(" addBorderSegments",function(){a(d)}),f(" order",function(){l(d)}),f(" insertSelfEdges",function(){!function(e){var n=h.buildLayerMatrix(e);t.forEach(n,function(n){var r=0;t.forEach(n,function(n,i){var o=e.node(n);o.order=i+r,t.forEach(o.selfEdges,function(t){h.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:o.rank,order:i+ ++r,e:t.e,label:t.label},"_se")}),delete o.selfEdges})})}(d)}),f(" adjustCoordinateSystem",function(){c.adjust(d)}),f(" position",function(){u(d)}),f(" positionSelfEdges",function(){!function(e){t.forEach(e.nodes(),function(t){var n=e.node(t);if("selfedge"===n.dummy){var r=e.node(n.e.v),i=r.x+r.width/2,o=r.y,A=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*A/3,y:o-s},{x:i+5*A/6,y:o-s},{x:i+A,y:o},{x:i+5*A/6,y:o+s},{x:i+2*A/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}(d)}),f(" removeBorderNodes",function(){!function(e){t.forEach(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),i=e.node(r.borderTop),o=e.node(r.borderBottom),A=e.node(t.last(r.borderLeft)),s=e.node(t.last(r.borderRight));r.width=Math.abs(s.x-A.x),r.height=Math.abs(o.y-i.y),r.x=A.x+r.width/2,r.y=i.y+r.height/2}}),t.forEach(e.nodes(),function(t){"border"===e.node(t).dummy&&e.removeNode(t)})}(d)}),f(" normalize.undo",function(){n.undo(d)}),f(" fixupEdgeLabelCoords",function(){!function(e){t.forEach(e.edges(),function(n){var r=e.edge(n);if(t.has(r,"x"))switch("l"!==r.labelpos&&"r"!==r.labelpos||(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}(d)}),f(" undoCoordinateSystem",function(){c.undo(d)}),f(" translateGraph",function(){!function(e){var n=Number.POSITIVE_INFINITY,r=0,i=Number.POSITIVE_INFINITY,o=0,A=e.graph(),s=A.marginx||0,a=A.marginy||0;function c(t){var e=t.x,A=t.y,s=t.width,a=t.height;n=Math.min(n,e-s/2),r=Math.max(r,e+s/2),i=Math.min(i,A-a/2),o=Math.max(o,A+a/2)}t.forEach(e.nodes(),function(t){c(e.node(t))}),t.forEach(e.edges(),function(n){var r=e.edge(n);t.has(r,"x")&&c(r)}),n-=s,i-=a,t.forEach(e.nodes(),function(t){var r=e.node(t);r.x-=n,r.y-=i}),t.forEach(e.edges(),function(r){var o=e.edge(r);t.forEach(o.points,function(t){t.x-=n,t.y-=i}),t.has(o,"x")&&(o.x-=n),t.has(o,"y")&&(o.y-=i)}),A.width=r-n+s,A.height=o-i+a}(d)}),f(" assignNodeIntersects",function(){!function(e){t.forEach(e.edges(),function(t){var n,r,i=e.edge(t),o=e.node(t.v),A=e.node(t.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=A,r=o),i.points.unshift(h.intersectRect(o,n)),i.points.push(h.intersectRect(A,r))})}(d)}),f(" reversePoints",function(){!function(e){t.forEach(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}(d)}),f(" acyclic.undo",function(){e.undo(d)})}(C,M)}),M(" updateInputGraph",function(){!function(e,n){t.forEach(e.nodes(),function(t){var r=e.node(t),i=n.node(t);r&&(r.x=i.x,r.y=i.y,n.children(t).length&&(r.width=i.width,r.height=i.height))}),t.forEach(e.edges(),function(r){var i=e.edge(r),o=n.edge(r);i.points=o.points,t.has(o,"x")&&(i.x=o.x,i.y=o.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(x,C)})})};var f=["nodesep","edgesep","ranksep","marginx","marginy"],g={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},p=["acyclicer","ranker","rankdir","align"],v=["width","height"],m={width:0,height:0},y=["minlen","weight","width","height","labeloffset"],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},b=["labelpos"];function B(e,n){return t.mapValues(t.pick(e,n),Number)}function E(e){var n={};return t.forEach(e,function(t,e){n[e.toLowerCase()]=t}),n}return _H}function UK(){if(jH)return KH;jH=1;var t=hK(),e=gK(),n=IG().Graph;return KH={debugOrdering:function(r){var i=e.buildLayerMatrix(r),o=new n({compound:!0,multigraph:!0}).setGraph({});return t.forEach(r.nodes(),function(t){o.setNode(t,{label:t}),o.setParent(t,"layer"+r.node(t).rank)}),t.forEach(r.edges(),function(t){o.setEdge(t.v,t.w,{},t.name)}),t.forEach(i,function(e,n){var r="layer"+n;o.setNode(r,{rank:"same"}),t.reduce(e,function(t,e){return o.setEdge(t,e,{style:"invis"}),e})}),o}},KH}var NK=YH?WH:(YH=1,WH={graphlib:IG(),layout:QK(),debug:UK(),util:{time:gK().time,notime:gK().notime},version:VH?zH:(VH=1,zH="0.8.5")}),TK=BU(NK);var OK=Object.prototype.hasOwnProperty,IK=function(t,e){if(null===t||!Qk(t))return{};var n={};return function(t,e){var n,r;if(t)if(gM(t))for(var i=0,o=t.length;i<o&&!1!==e(t[i],i);i++);else if(r=typeof(n=t),null!==n&&"object"===r||"function"===r)for(var A in t)if(t.hasOwnProperty(A)&&!1===e(t[A],A))break}(e,function(e){OK.call(t,e)&&(n[e]=t[e])}),n};class LK extends EC{constructor(){super(...arguments),this.id="dagre",this.isCompoundGraph=null,this.config={graphAttributes:["rankdir","align","nodesep","edgesep","ranksep","marginx","marginy","acyclicer","ranker"],nodeAttributes:["width","height"],edgeAttributes:["minlen","weight","width","height","labelpos","labeloffset"]}}getDefaultOptions(){return{directed:!0,multigraph:!0,rankdir:"TB",align:void 0,nodesep:50,edgesep:10,ranksep:50,marginx:0,marginy:0,acyclicer:void 0,ranker:"network-simplex",nodeSize:[0,0],edgeMinLen:1,edgeWeight:1,edgeLabelSize:[0,0],edgeLabelPos:"r",edgeLabelOffset:10}}layout(){return mx(this,0,void 0,function*(){const t=new NK.graphlib.Graph({directed:!!this.options.directed,multigraph:!!this.options.multigraph,compound:this.isCompound()});t.setGraph(IK(this.options,this.config.graphAttributes)),t.setDefaultEdgeLabel(()=>({}));const e=Yx(this.options.nodeSize,0);this.model.forEachNode(n=>{const r=n._original,[i,o]=Gx(e(r)),A={width:i,height:o};if(t.setNode(String(n.id),A),this.isCompound()){if(Kx(n.parentId))return;t.setParent(String(n.id),String(n.parentId))}});const{edgeLabelSize:n,edgeLabelOffset:r,edgeLabelPos:i,edgeMinLen:o,edgeWeight:A}=this.options,s=Yx(n,0,"edge"),a=Wx(r,10,"edge"),c="string"==typeof i?()=>i:Vx(i,["edge"]),l=Wx(o,1,"edge"),u=Wx(A,1,"edge");this.model.forEachEdge(e=>{const n=e._original,[r,i]=Gx(s(n)),o={width:r,height:i,labelpos:c(n),labeloffset:a(n),minlen:l(n),weight:u(n)};t.setEdge(String(e.source),String(e.target),o,String(e.id))}),TK.layout(t),this.model.forEachNode(e=>{const n=t.node(String(e.id));n&&(e.x=n.x,e.y=n.y,e.size=[n.width,n.height])}),this.model.forEachEdge(e=>{const n=t.edge(String(e.source),String(e.target),String(e.id));if(!n)return;const{width:r,height:i,weight:o,minlen:A,labelpos:s,labeloffset:a,points:c}=n;e.labelSize=[r,i],e.weight=o,e.minLen=A,e.labelPos=s,e.labelOffset=a,e.points=c.map(qx)})})}isCompound(){return null!==this.isCompoundGraph?this.isCompoundGraph:(t=this.options.compound,Sk(t,"Boolean")?this.isCompoundGraph=this.options.compound:(this.isCompoundGraph=this.model.nodes().some(t=>!Kx(t.parentId)),this.isCompoundGraph));var t}}const PK=1e-6;function DK(t){var e;let n=0;if(t.length)for(let e=0;e<t.length;e++){const r=t[e];r&&r.r>n&&(n=r.r)}else if(t.data){n=t.data.r||0;let r=t.next;for(;r;)n=Math.max(n,(null===(e=r.data)||void 0===e?void 0:e.r)||0),r=r.next}t.r=n}function RK(t=1,e=.005,n=2){function r(r,i){!function(t,e,n,r,i=2){const o=e/n,A=t.nodes(),s=A.map((t,e)=>{const{nodeStrength:n,x:r,y:i,z:A,size:s,mass:a}=t;return{x:r,y:i,z:A,size:s,index:e,id:t.id,vx:0,vy:0,vz:0,weight:o*n,mass:a||1}}),a=(2===i?gk(s,t=>t.x,t=>t.y):eS(s,t=>t.x,t=>t.y,t=>t.z)).visitAfter(HK),c=new Map;s.forEach(t=>{c.set(t.id,t),function(t,e,n){e.visit((e,r,i,o,A,s,a)=>_K(e,r,i,o,A,s,a,t,n))}(t,a,i)}),s.map(t=>{const e=t.id;r[e]={x:t.vx/t.mass,y:t.vy/t.mass,z:t.vz/t.mass}})}(r,t,e*e,i,n)}return r.factor=function(e){return arguments.length?(t=e,r):t},r.coulombDisScale=function(t){return arguments.length?(e=t,r):e},r.dimensions=function(t){return arguments.length?(n=t,r):n},r}function HK(t){let e=0,n=0,r=0,i=0,o=0;const A=t.length;if(A){for(let s=0;s<A;s++){const A=t[s];A&&A.weight&&(e+=A.weight,n+=A.x*A.weight,r+=A.y*A.weight,i+=A.z*A.weight,o+=A.size*A.weight)}t.x=n/e,t.y=r/e,t.z=i/e,t.size=o/e,t.weight=e}else{const e=t;t.x=e.data.x,t.y=e.data.y,t.z=e.data.z,t.size=e.data.size,t.weight=e.data.weight}}const _K=(t,e,n,r,i,o,A,s,a)=>{var c;if((null===(c=t.data)||void 0===c?void 0:c.id)===s.id)return;const l=2===a?r:3===a?o:n,u=s.x-t.x||.1,h=s.y-t.y||.1,d=s.z-t.z||.1,f=[u,h,d],g=l-e;let p=0;for(let t=0;t<a;t++)p+=f[t]*f[t];const v=Math.sqrt(p)*p;if(g*g*.81<p){const e=t.weight/v;return s.vx+=u*e,s.vy+=h*e,s.vz+=d*e,!0}if(t.length)return!1;if(t.data!==s){const e=t.data.weight/v;s.vx+=u*e,s.vy+=h*e,s.vz+=d*e}};var GK=function(){function t(){this._events={}}return t.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},t.prototype.once=function(t,e){return this.on(t,e,!0)},t.prototype.emit=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=this._events[t]||[],o=this._events["*"]||[],A=function(r){for(var i=r.length,o=0;o<i;o++)if(r[o]){var A=r[o],s=A.callback;A.once&&(r.splice(o,1),0===r.length&&delete e._events[t],i--,o--),s.apply(e,n)}};A(i),A(o)},t.prototype.off=function(t,e){if(t)if(e){for(var n=this._events[t]||[],r=n.length,i=0;i<r;i++)n[i].callback===e&&(n.splice(i,1),r--,i--);0===n.length&&delete this._events[t]}else delete this._events[t];else this._events={};return this},t.prototype.getEvents=function(){return this._events},t}();class KK extends GK{constructor(){super(...arguments),this.iteration=0,this.judgingDistance=1/0,this.running=!1,this.tickCallback=null,this.endCallback=null,this.timer=0}initialize(t){this.options=t,this.iteration=0,this.judgingDistance=1/0}on(t,e){return"tick"===t&&(this.tickCallback=e),"end"===t&&(this.endCallback=e),this}tick(t=1){var e;for(let n=0;n<t;n++){const t=this.runOneStep();this.judgingDistance=t,this.iteration++,null===(e=this.tickCallback)||void 0===e||e.call(this)}return this}restart(){if(this.running)return this;const{maxIteration:t=500,minMovement:e=0,animate:n=!0}=this.options;if(!n||"undefined"==typeof window){for(;this.iteration<t&&(this.judgingDistance>e||this.iteration<1);)this.tick(1);return Promise.resolve().then(()=>{var t;null===(t=this.endCallback)||void 0===t||t.call(this)}),this}return this.running=!0,this.timer=window.setInterval(()=>{var n;this.tick(1),(this.iteration>=t||this.judgingDistance<e)&&(this.stop(),null===(n=this.endCallback)||void 0===n||n.call(this))},0),this}stop(){return this.running=!1,this.timer&&(clearInterval(this.timer),this.timer=0),this}}class jK extends KK{constructor(){super(...arguments),this.forces=new Map,this.velMap={}}data(t){return this.model=t,t.forEachNode(t=>{this.velMap[t.id]={x:0,y:0,z:0}}),this}force(t,e){return 1===arguments.length?this.forces.get(t)||null:(null===e?this.forces.delete(t):e&&this.forces.set(t,e),e||null)}runOneStep(){const t={},e=this.model.nodes();if(!e.length)return 0;e.forEach(e=>{t[e.id]={x:0,y:0,z:0}}),this.forces.forEach(e=>{e(this.model,t)}),this.updateVelocity(t);const n=this.updatePosition();return this.monitor(t,e),n}setFixedPosition(t,e){const n=this.model.node(t);if(!n)return;const r=["fx","fy","fz"];if(null===e)return void r.forEach(t=>delete n[t]);e.forEach((t,e)=>{e<r.length&&("number"==typeof t||null===t)&&(n[r[e]]=t)});const i=this.velMap[t];i&&(i.x=0,i.y=0,i.z=0)}updateVelocity(t){const{damping:e=.9,maxSpeed:n=100,interval:r=.02,dimensions:i=2}=this.options;this.model.nodes().forEach(o=>{const A=o.id;let s=(this.velMap[A].x+t[A].x*r)*e,a=(this.velMap[A].y+t[A].y*r)*e,c=3===i?(this.velMap[A].z+t[A].z*r)*e:0;const l=Math.sqrt(s*s+a*a+c*c);if(l>n){const t=n/l;s*=t,a*=t,c*=t}this.velMap[A]={x:s,y:a,z:c}})}updatePosition(){const{distanceThresholdMode:t="mean",interval:e=.02,dimensions:n=2}=this.options,r=this.model.nodes();let i=0,o="max"===t?-1/0:"min"===t?1/0:0;return r.forEach(r=>{const A=r.id;if(_x(r.fx)&&_x(r.fy))return r.x=r.fx,r.y=r.fy,void(3===n&&_x(r.fz)&&(r.z=r.fz));const s=this.velMap[A].x*e,a=this.velMap[A].y*e,c=3===n?this.velMap[A].z*e:0;r.x+=s,r.y+=a,3===n&&(r.z=(r.z||0)+c);const l=Math.sqrt(s*s+a*a+c*c);"max"===t?o=Math.max(o,l):"min"===t?o=Math.min(o,l):i+=l}),"mean"===t?i/r.length:o}monitor(t,e){const{monitor:n,dimensions:r=2}=this.options;if(!n)return;let i=0;e.forEach(e=>{const n=t[e.id],o=n.x*n.x+n.y*n.y+(3===r?n.z*n.z:0);i+=(e.mass||1)*o*.5}),n({energy:i,nodes:e,edges:this.model.edges(),iterations:this.iteration})}}var zK={}.toString,VK=Object.prototype,WK=Object.prototype.hasOwnProperty;function YK(t){if(Kx(t))return!0;if(function(t){return null!==t&&"function"!=typeof t&&isFinite(t.length)}(t))return!t.length;var e=function(t){return zK.call(t).replace(/^\[object /,"").replace(/]$/,"")}(t);if("Map"===e||"Set"===e)return!t.size;if(function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||VK)}(t))return!Object.keys(t).length;for(var n in t)if(WK.call(t,n))return!1;return!0}const XK={nodeSize:30,dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,collideStrength:1,preventOverlap:!0,distanceThresholdMode:"mean"};class qK extends xC{constructor(){super(...arguments),this.id="force",this.simulation=null}getDefaultOptions(){return XK}layout(){var t;return mx(this,0,void 0,function*(){const e=this.parseOptions(this.options),{width:n,height:r,dimensions:i}=e;if(this.initializePhysicsData(this.model,e),tC(this.model,n,r,i),!(null===(t=this.model.nodes())||void 0===t?void 0:t.length))return;const o=this.setSimulation(e);return o.data(this.model),o.initialize(e),o.restart(),new Promise(t=>{o.on("end",()=>t())})})}initializePhysicsData(t,e){const{nodeSize:n,getMass:r,nodeStrength:i,edgeStrength:o,linkDistance:A}=e;t.forEachNode(t=>{const e=t._original;t.size=n(e),t.mass=r(e),t.nodeStrength=i(e)}),t.forEachEdge(e=>{const n=e._original;e.edgeStrength=o(n),e.linkDistance=A(n,t.originalNode(e.source),t.originalNode(e.target))})}setSimulation(t){const e=this.simulation||new jK;return this.simulation||(this.simulation=e.on("tick",()=>{var e;null===(e=t.onTick)||void 0===e||e.call(t,this)})),this.setupRepulsiveForce(e,t),this.setupAttractiveForce(e,t),this.setupCollideForce(e,t),this.setupGravityForce(e,t),this.setupCentripetalForce(e,t),e}setupRepulsiveForce(t,e){const{factor:n,coulombDisScale:r,dimensions:i}=e;let o=t.force("repulsive");o||(o=RK(n,r,i),t.force("repulsive",o)),o.factor&&o.factor(n),o.coulombDisScale&&o.coulombDisScale(r),o.dimensions&&o.dimensions(i)}setupAttractiveForce(t,e){const{dimensions:n,preventOverlap:r}=e;if((this.model.edges()||[]).length>0){let e=t.force("attractive");e||(e=function(t=2){let e=!1;function n(e,n){e.forEachEdge(r=>{var i,o;const{source:A,target:s}=r,a=e.node(A),c=e.node(s);if(!a||!c)return;let l=c.x-a.x,u=c.y-a.y,h=3===t?(null!==(i=c.z)&&void 0!==i?i:0)-(null!==(o=a.z)&&void 0!==o?o:0):0;l||u||(l=.01,u=.01,3!==t||h||(h=.01));const d=Math.sqrt(l*l+u*u+h*h);if(d<Number(a.size)+Number(c.size))return;const f=l/d,g=u/d,p=h/d,{linkDistance:v=200,edgeStrength:m=200}=r,y=(v-d)*m,w=1/(a.mass||1),b=1/(c.mass||1),B=f*y,E=g*y,x=p*y;n[A].x-=B*w,n[A].y-=E*w,n[A].z-=x*w,n[s].x+=B*b,n[s].y+=E*b,n[s].z+=x*b})}return n.dimensions=function(e){return arguments.length?(t=e,n):t},n.preventOverlap=function(t){return arguments.length?(e=t,n):e},n}(n),t.force("attractive",e)),e.dimensions&&e.dimensions(n),e.preventOverlap&&e.preventOverlap(r)}else t.force("attractive",null)}setupGravityForce(t,e){const{center:n,gravity:r,getCenter:i}=e;if(r){let e=t.force("gravity");e||(e=function(t=[0,0,0],e=10){let n;function r(r,i){r.nodes()&&r.forEachNode(o=>{const{id:A,mass:s,x:a,y:c,z:l=0}=o;let u=0,h=0,d=0,f=e;const g=r.degree(A),p=null==n?void 0:n(o,g);if(p){const[t,e,n]=p;u=a-t,h=c-e,f=n}else u=a-t[0],h=c-t[1],d=l-(t[2]||0);f&&(i[A].x-=f*u/s,i[A].y-=f*h/s,i[A].z-=f*d/s)})}return r.center=function(e){return arguments.length?(t=e,r):t},r.gravity=function(t){return arguments.length?(e=t,r):e},r.getCenter=function(t){return arguments.length?(n=t,r):n},r}(n,r),t.force("gravity",e)),e.center&&e.center(n),e.gravity&&e.gravity(r),e.getCenter&&e.getCenter(i)}else t.force("gravity",null)}setupCollideForce(t,e){const{preventOverlap:n,collideStrength:r=1,dimensions:i}=e;if(n&&r){let e=t.force("collide");e||(e=function(t=2){let e=1;function n(n,r){const i=n.nodes();if(i.length<2||e<=0)return;if(2===t){const t=i.map((t,e)=>({id:t.id,index:e,x:t.x,y:t.y,r:Number(t.size)/2,mass:t.mass||1,fx:t.fx,fy:t.fy})),e=gk(t,t=>t.x,t=>t.y).visitAfter(DK);for(const n of t)e.visit((t,e,i,A,s)=>{const a=t.r||0,c=n.r+a;if(e>n.x+c||A<n.x-c||i>n.y+c||s<n.y-c)return!0;if(!t.data)return!1;let l=t;do{const t=l.data;t&&t.index>n.index&&o(n,t,r),l=l.next}while(l);return!1});return}const s=i.map((t,e)=>{var n;return{id:t.id,index:e,x:t.x,y:t.y,z:null!==(n=t.z)&&void 0!==n?n:0,r:Number(t.size)/2,mass:t.mass||1,fx:t.fx,fy:t.fy,fz:t.fz}});for(let t=0;t<s.length;t++)for(let e=t+1;e<s.length;e++)A(s[t],s[e],r)}function r(t){return _x(t.fx)&&_x(t.fy)?0:1/(t.mass||1)}function i(t){return _x(t.fx)&&_x(t.fy)&&_x(t.fz)?0:1/(t.mass||1)}function o(t,n,i){let o=t.x-n.x,A=t.y-n.y,s=Math.hypot(o,A);const a=t.r+n.r;if(s>=a)return;s<PK&&(o=t.index<n.index?PK:-1e-6,A=0,s=Math.abs(o));const c=o/s,l=A/s,u=(a-s)*e*500,h=r(t),d=r(n);h&&(i[t.id].x+=c*u*h,i[t.id].y+=l*u*h),d&&(i[n.id].x-=c*u*d,i[n.id].y-=l*u*d)}function A(t,n,r){let o=t.x-n.x,A=t.y-n.y,s=t.z-n.z,a=Math.sqrt(o*o+A*A+s*s);const c=t.r+n.r;if(a>=c)return;a<PK&&(o=t.index<n.index?PK:-1e-6,A=0,s=0,a=Math.abs(o));const l=o/a,u=A/a,h=s/a,d=(c-a)*e*500,f=i(t),g=i(n);f&&(r[t.id].x+=l*d*f,r[t.id].y+=u*d*f,r[t.id].z+=h*d*f),g&&(r[n.id].x-=l*d*g,r[n.id].y-=u*d*g,r[n.id].z-=h*d*g)}return n.dimensions=function(e){return arguments.length?(t=e,n):t},n.strength=function(t){return arguments.length?(e=t,n):e},n}(i),t.force("collide",e)),e.strength&&e.strength(r),e.dimensions&&e.dimensions(i)}else t.force("collide",null)}setupCentripetalForce(t,e){const{centripetalOptions:n,width:r,height:i}=e;if(n){let e=t.force("centripetal");e||(e=function(){let t,e=800,n=600;function r(r,i){if(!t)return;const{leaf:o,single:A,others:s,center:a}=t,c=r.nodes(),l=r.edges(),u=c.map(t=>Object.assign(Object.assign({},t),{data:t.data||{}})),h=l.map(t=>Object.assign(Object.assign({},t),{data:t.data||{}}));r.forEachNode(t=>{const{id:c,mass:l,x:d,y:f,z:g=0,data:p}=t,v=r.degree(c,"in"),m=r.degree(c,"out"),y=r.degree(c,"both"),w=Object.assign(Object.assign({},t),{data:p||{}}),{x:b,y:B,z:E,centerStrength:x}=(null==a?void 0:a(w,u,h,e,n))||{x:0,y:0,z:0,centerStrength:0};if(!_x(b)||!_x(B))return;const C=(d-b)/l,M=(f-B)/l,F=(g-(E||0))/l;if(x&&(i[c].x-=x*C,i[c].y-=x*M,i[c].z-=x*F),0===y){const t=A(w);if(!t)return;return i[c].x-=t*C,i[c].y-=t*M,void(i[c].z-=t*F)}if(0===v||0===m){const t=o(w,u,h);if(!t)return;return i[c].x-=t*C,i[c].y-=t*M,void(i[c].z-=t*F)}const k=s(w);k&&(i[c].x-=k*C,i[c].y-=k*M,i[c].z-=k*F)})}return r.options=function(e){return arguments.length?(t=e,r):t},r.width=function(t){return arguments.length?(e=t,r):e},r.height=function(t){return arguments.length?(n=t,r):n},r}(),t.force("centripetal",e)),e.options&&e.options(n),e.width&&e.width(r),e.height&&e.height(i)}else t.force("centripetal",null)}parseOptions(t){const e=Object.assign(Object.assign({},t),kF(t));if(e.nodeClusterBy&&(e.nodeClusterBy=Vx(e.nodeClusterBy,["node"])),t.getMass?e.getMass=Wx(t.getMass,1):e.getMass=t=>{if(!t)return 1;const e=this.model.degree(t.id,"both");return!e||e<5?1:5*e*1},t.getCenter){const n=["node","degree"];e.getCenter=Vx(t.getCenter,n)}const n=Xx(t.nodeSize,t.nodeSpacing);return e.nodeSize=t=>{if(!t)return 0;const[e,r,i]=n(t);return Math.max(e,r,i)},e.linkDistance=t.linkDistance?Vx(t.linkDistance,["edge","source","target"]):(t,e,n)=>1+t.nodeSize(e)+t.nodeSize(n),e.nodeStrength=Wx(t.nodeStrength,1),e.edgeStrength=Wx(t.edgeStrength,1,"edge"),e.clusterNodeStrength=Wx(t.clusterNodeStrength,1),this.formatCentripetal(e),e}formatCentripetal(t){var e,n;const{dimensions:r,centripetalOptions:i,center:o,leafCluster:A,clustering:s,nodeClusterBy:a}=t,c=Vx(null==i?void 0:i.leaf,["node","nodes","edges"]),l=Wx(null==i?void 0:i.single,2),u=Wx(null==i?void 0:i.others,1),h=Vx(null!==(e=null==i?void 0:i.center)&&void 0!==e?e:t=>({x:o[0],y:o[1],z:3===r?o[2]:void 0}),["node","nodes","edges","width","height"]),d=Object.assign(Object.assign({},i),{leaf:c,single:l,others:u,center:h});let f,g;if(i&&(t.centripetalOptions=d),A&&a&&(f=this.getSameTypeLeafMap(a),g=Array.from(new Set(null===(n=this.model.nodes())||void 0===n?void 0:n.map(t=>a(t._original))))||[],t.centripetalOptions=Object.assign({},d,{single:()=>100,leaf:e=>{const{siblingLeaves:n,sameTypeLeaves:r}=f[e.id]||{};return(null==r?void 0:r.length)===(null==n?void 0:n.length)||1===(null==g?void 0:g.length)?1:t.clusterNodeStrength(e)},others:()=>1,center:t=>{const e=this.model.degree(t.id,"both");if(!e)return{x:100,y:100,z:0};let n;if(1===e){const{sameTypeLeaves:e=[]}=f[t.id]||{};1===e.length?n=void 0:e.length>1&&(n=this.getAvgNodePosition(e))}else n=void 0;return{x:null==n?void 0:n.x,y:null==n?void 0:n.y,z:null==n?void 0:n.z}}})),s&&a){f||(f=this.getSameTypeLeafMap(a));let e=[];YK(e)&&this.model.forEachNode(t=>{const n=a(t._original);n&&!e.includes(n)&&e.push(n)});const n={};e.forEach(t=>{const e=this.model.nodes().filter(e=>a(e._original)===t);n[t]=this.getAvgNodePosition(e)}),t.centripetalOptions=Object.assign(d,{single:e=>t.clusterNodeStrength(e),leaf:e=>t.clusterNodeStrength(e),others:e=>t.clusterNodeStrength(e),center:t=>{const e=n[a(t._original)];return{x:null==e?void 0:e.x,y:null==e?void 0:e.y,z:null==e?void 0:e.z}}})}}getSameTypeLeafMap(t){const e={};return this.model.forEachNode(n=>{1===this.model.degree(n.id,"both")&&(e[n.id]=this.getCoreNodeAndSiblingLeaves(n,t))}),e}getCoreNodeAndSiblingLeaves(t,e){const n=this.model.degree(t.id,"in"),r=this.model.degree(t.id,"out");let i=t,o=[];if(0===n){const e=this.model.successors(t.id);i=this.model.node(e[0]),o=this.model.neighbors(i.id).map(t=>this.model.node(t))}else if(0===r){const e=this.model.predecessors(t.id);i=this.model.node(e[0]),o=this.model.neighbors(i.id).map(t=>this.model.node(t))}o=o.filter(t=>0===this.model.degree(t.id,"in")||0===this.model.degree(t.id,"out"));const A=e(t._original)||"",s=o.filter(t=>e(t._original)===A&&(0===this.model.degree(t.id,"in")||0===this.model.degree(t.id,"out")));return{coreNode:i,siblingLeaves:o,sameTypeLeaves:s}}getAvgNodePosition(t){const e={x:0,y:0};t.forEach(t=>{e.x+=t.x||0,e.y+=t.y||0});const n=t.length||1;return{x:e.x/n,y:e.y/n}}tick(t=1){return this.simulation&&this.simulation.tick(t),this}stop(){return this.simulation&&this.simulation.stop(),this}restart(){return this.simulation&&this.simulation.restart(),this}setFixedPosition(t,e){return this.simulation&&this.simulation.setFixedPosition(t,e),this}}class $K{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let r=Math.hypot(e,n);r=r<1e-4?1e-4:r;const i=this.g*(this.degree+1)*(t.degree+1)/r;this.fx+=i*e/r,this.fy+=i*n/r}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,r=(this.ry*this.mass+t.ry*t.mass)/e,i=this.degree+t.degree;return new $K({rx:n,ry:r,mass:e,degree:i})}}class ZK{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new ZK({xmid:t,ymid:e,length:n})}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2;return new ZK({xmid:t,ymid:e,length:n})}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new ZK({xmid:t,ymid:e,length:n})}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2;return new ZK({xmid:t,ymid:e,length:n})}}class JK{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,null!=t&&(this.quad=t)}insert(t){null!=this.body?this._isExternal()?(this.quad&&(this.NW=new JK(this.quad.NW()),this.NE=new JK(this.quad.NE()),this.SW=new JK(this.quad.SW()),this.SE=new JK(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t)):this.body=t}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return null==this.NW&&null==this.NE&&null==this.SW&&null==this.SE}updateForce(t){if(null!=this.body&&t!==this.body)if(this._isExternal())t.addForce(this.body);else{(this.quad?this.quad.getLength():0)/this.body.distanceTo(t)<this.theta?t.addForce(this.body):(this.NW&&this.NW.updateForce(t),this.NE&&this.NE.updateForce(t),this.SW&&this.SW.updateForce(t),this.SE&&this.SE.updateForce(t))}}}let tj=class extends KK{constructor(){super(...arguments),this.sg=0,this.forces={},this.preForces={},this.bodies={},this.sizes={},this.maxIteration=0}data(t,e){return this.model=t,this.sizes=e,this}initialize(t){super.initialize(t),this.maxIteration=t.maxIteration,this.sg=0,this.initForces()}initForces(){const{model:t,options:e}=this,{kr:n,barnesHut:r}=e,i=t.nodes();this.forces={},this.preForces={},this.bodies={};for(let e=0;e<i.length;e+=1){const o=i[e];if(this.forces[o.id]=[0,0],this.preForces[o.id]=[0,0],r){const r={id:e,rx:o.x,ry:o.y,mass:1,g:n,degree:t.degree(o.id)};this.bodies[o.id]=new $K(r)}}}setFixedPosition(t,e){const n=this.model.node(t);if(!n)return;const r=["fx","fy","fz"];null!==e?e.forEach((t,e)=>{e<r.length&&("number"==typeof t||null===t)&&(n[r[e]]=t)}):r.forEach(t=>{delete n[t]})}isNodeFixed(t){return _x(t.fx)&&_x(t.fy)}syncFixedPositions(){this.model.forEachNode(t=>{this.isNodeFixed(t)&&(t.x=t.fx,t.y=t.fy)})}runOneStep(){const{model:t,options:e}=this,{preventOverlap:n,barnesHut:r}=e,i=this.maxIteration-this.iteration,o=t.nodes();for(let t=0;t<o.length;t+=1){const{id:e}=o[t];this.preForces[e]=[...this.forces[e]||[0,0]],this.forces[e]=[0,0]}return this.syncFixedPositions(),this.calculateAttractive(i),r&&!n?this.calculateOptRepulsiveGravity():this.calculateRepulsiveGravity(i,100),this.updatePositions()}calculateAttractive(t){const{model:e,options:n}=this,{preventOverlap:r,dissuadeHubs:i,mode:o,prune:A}=n,s=e.edges();for(let t=0;t<s.length;t+=1){const{source:n,target:a}=s[t],c=e.node(n),l=e.node(a),u=e.degree(n),h=e.degree(a);if(A&&(u<=1||h<=1))continue;const d=l.x-c.x,f=l.y-c.y;let g=Math.hypot(d,f);g=g<1e-4?1e-4:g;const p=d/g,v=f/g;let m=g;r&&(m=Math.max(0,g-this.sizes[n]-this.sizes[a]));let y=m,w=m;"linlog"===o&&(y=Math.log(1+m),w=y),i&&(y=m/u,w=m/h),this.forces[n][0]+=y*p,this.forces[n][1]+=y*v,this.forces[a][0]-=w*p,this.forces[a][1]-=w*v}}calculateOptRepulsiveGravity(){const{model:t,options:e}=this,{kg:n,center:r,prune:i,kr:o}=e,A=t.nodes(),s=A.length;let a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY,u=Number.NEGATIVE_INFINITY;for(let e=0;e<s;e+=1){const n=A[e],{id:r,x:o,y:s}=n;if(i&&t.degree(r)<=1)continue;const h=this.bodies[r];h&&(h.setPos(o,s),o<a&&(a=o),o>c&&(c=o),s<l&&(l=s),s>u&&(u=s))}let h=Math.max(c-a,u-l);(!isFinite(h)||h<=0)&&(h=1);const d=new ZK({xmid:(c+a)/2,ymid:(u+l)/2,length:h,massCenter:r,mass:s}),f=new JK(d);for(let e=0;e<s;e+=1){const{id:n}=A[e];if(i&&t.degree(n)<=1)continue;const r=this.bodies[n];r&&r.in(d)&&f.insert(r)}for(let e=0;e<s;e+=1){const o=A[e],{id:s,x:a,y:c}=o,l=t.degree(s);if(i&&l<=1)continue;const u=this.bodies[s];if(!u)continue;u.resetForce(),f.updateForce(u),this.forces[s][0]-=u.fx,this.forces[s][1]-=u.fy;const h=a-r[0],d=c-r[1];let g=Math.hypot(h,d);g=g<1e-4?1e-4:g;const p=h/g,v=d/g,m=n*(l+1);this.forces[s][0]-=m*p,this.forces[s][1]-=m*v}}calculateRepulsiveGravity(t,e){const{model:n,options:r}=this,{preventOverlap:i,kr:o,kg:A,center:s,prune:a}=r,c=n.nodes(),l=c.length;for(let t=0;t<l;t+=1){const r=c[t],u=n.degree(r.id);for(let A=t+1;A<l;A+=1){const t=c[A],s=n.degree(t.id);if(a&&(u<=1||s<=1))continue;const l=t.x-r.x,h=t.y-r.y;let d=Math.hypot(l,h);d=d<1e-4?1e-4:d;const f=l/d,g=h/d;let p,v=d;if(i){const n=d-this.sizes[r.id]-this.sizes[t.id];n<0?p=e*(u+1)*(s+1):0===n?p=0:(v=n,p=o*(u+1)*(s+1)/v)}else p=o*(u+1)*(s+1)/v;this.forces[r.id][0]-=p*f,this.forces[r.id][1]-=p*g,this.forces[t.id][0]+=p*f,this.forces[t.id][1]+=p*g}const h=r.x-s[0],d=r.y-s[1];let f=Math.hypot(h,d);f=f<1e-4?1e-4:f;const g=h/f,p=d/f,v=A*(u+1);this.forces[r.id][0]-=v*g,this.forces[r.id][1]-=v*p}}updatePositions(){const{model:t,options:e}=this,{ks:n,tao:r,prune:i,ksmax:o,distanceThresholdMode:A="max"}=e,s=t.nodes(),a=s.length,c={},l={};let u=0,h=0;for(let e=0;e<a;e+=1){const{id:n}=s[e],r=t.degree(n);if(i&&r<=1)continue;const o=this.preForces[n]||[0,0],A=this.forces[n]||[0,0],a=A[0]-o[0],d=A[1]-o[1],f=Math.hypot(a,d),g=A[0]+o[0],p=A[1]+o[1],v=Math.hypot(g,p);c[n]=f,l[n]=v/2,u+=(r+1)*c[n],h+=(r+1)*l[n]}let d=this.sg;const f=this.sg;u<=0?d=f>0?f:1:(d=r*h/u,0!==f&&(d=d>1.5*f?1.5*f:d)),this.sg=d;let g=0,p=1/0,v=0,m=0;for(let e=0;e<a;e+=1){const r=s[e],A=r.id,a=t.degree(A);if(i&&a<=1)continue;if(this.isNodeFixed(r))continue;const l=c[A]||0;let u=n*d/(1+d*Math.sqrt(l)),h=Math.hypot(this.forces[A][0],this.forces[A][1]);h=h<1e-4?1e-4:h;const f=o/h;u>f&&(u=f);const y=u*this.forces[A][0],w=u*this.forces[A][1];r.x+=y,r.y+=w;const b=Math.hypot(y,w);b>0&&(m++,v+=b,b>g&&(g=b),b<p&&(p=b))}switch(A){case"min":return p;case"mean":return m>0?v/m:0;default:return g}}destroy(){this.stop(),this.forces={},this.preForces={},this.bodies={},this.sizes={},this.off()}};const ej={nodeSize:10,nodeSpacing:0,width:300,height:300,kr:5,kg:1,mode:"normal",preventOverlap:!1,dissuadeHubs:!1,maxIteration:0,ks:.1,ksmax:10,tao:.1};class nj extends xC{constructor(){super(...arguments),this.id="force-atlas2",this.simulation=null}getDefaultOptions(){return ej}layout(t){return mx(this,0,void 0,function*(){const e=this.parseOptions(t),{width:n,height:r,prune:i,center:o}=e,A=this.model.nodeCount();if(!A||1===A)return EF(this.model,o);tC(this.model,n,r);const s=this.getSizes(e.nodeSize,e.nodeSpacing),a=this.setSimulation();a.data(this.model,s),a.initialize(e),a.restart();const c=()=>new Promise(t=>{a.on("end",t)});if(!i)return c();if(yield c(),i){const t=this.model.edges();for(let e=0;e<t.length;e+=1){const{source:n,target:r}=t[e],i=this.model.degree(n),o=this.model.degree(r),A=this.model.node(n),s=this.model.node(r);i<=1?(A.x=s.x,A.y=s.y):o<=1&&(s.x=A.x,s.y=A.y)}a.initialize(Object.assign(Object.assign({},e),{prune:!1,barnesHut:!1})),a.tick(100)}})}getSizes(t,e){const n={},r=Xx(t,e,ej.nodeSize,ej.nodeSpacing);return this.model.forEachNode(t=>{n[t.id]=Math.max(...r(t._original))}),n}setSimulation(){const t=this.simulation||new tj;return this.simulation||(this.simulation=t.on("tick",()=>{var t,e;return null===(e=(t=this.options).onTick)||void 0===e?void 0:e.call(t,this)})),this.simulation}parseOptions(t={}){const{barnesHut:e,prune:n,maxIteration:r,kr:i,kg:o}=t,A={},s=this.model.nodeCount();return void 0===e&&s>250&&(A.barnesHut=!0),void 0===n&&s>100&&(A.prune=!0),0!==r||n?0===r&&n&&(A.maxIteration=100,s<=200&&s>100?A.maxIteration=500:s>200&&(A.maxIteration=950)):(A.maxIteration=250,s<=200&&s>100?A.maxIteration=1e3:s>200&&(A.maxIteration=1200)),i||(A.kr=50,s>100&&s<=500?A.kr=20:s>500&&(A.kr=1)),o||(A.kg=20,s>100&&s<=500?A.kg=10:s>500&&(A.kg=1)),Object.assign(Object.assign(Object.assign({},t),A),kF(t))}stop(){var t;null===(t=this.simulation)||void 0===t||t.stop()}tick(t=1){var e;null===(e=this.simulation)||void 0===e||e.tick(t)}restart(){var t;null===(t=this.simulation)||void 0===t||t.restart()}setFixedPosition(t,e){var n;null===(n=this.simulation)||void 0===n||n.setFixedPosition(t,e)}destroy(){var t;super.destroy(),this.stop(),null===(t=this.simulation)||void 0===t||t.destroy(),this.simulation=null}}class rj extends KK{constructor(){super(...arguments),this.displacements=null,this.clusterMap=null}data(t){return this.model=t,this}initialize(t){super.initialize(t),this.recomputeConstants(),this.displacements=null,this.clusterMap=null,this.initDisplacements()}recomputeConstants(){const{model:t,options:e}=this,{width:n,height:r}=kF(e),i=n*r;this.k2=i/(t.nodeCount()+1),this.k=Math.sqrt(this.k2),this.maxDisplace=Math.sqrt(i)/10}runOneStep(){return this.syncFixedPositions(),this.initDisplacements(),this.calculateRepulsive(),this.calculateAttractive(),this.applyClusterGravity(),this.applyGlobalGravity(),this.updatePositions()}setFixedPosition(t,e){const n=this.model.node(t);if(!n)return;const r=["fx","fy","fz"];null!==e?e.forEach((t,e)=>{e<r.length&&("number"==typeof t||null===t)&&(n[r[e]]=t)}):r.forEach(t=>{delete n[t]})}isNodeFixed(t){return!Kx(t.fx)&&!Kx(t.fy)}syncFixedPositions(){const{model:t,options:e}=this,n=3===e.dimensions;t.forEachNode(t=>{this.isNodeFixed(t)&&(t.x=t.fx,t.y=t.fy,n&&void 0!==t.fz&&(t.z=t.fz))})}initDisplacements(){this.displacements||(this.displacements=new Map,this.model.forEachNode(t=>{this.displacements.set(t.id,{x:0,y:0,z:0})})),this.displacements.forEach(t=>{t.x=0,t.y=0,t.z=0})}calculateRepulsive(){const{model:t,options:e}=this,n=3===e.dimensions,r=t.nodes();for(let t=0;t<r.length;t++){const e=r[t],i=this.displacements.get(e.id),o=this.isNodeFixed(e);for(let A=t+1;A<r.length;A++){const t=r[A],s=this.displacements.get(t.id),a=this.isNodeFixed(t);let c=e.x-t.x,l=e.y-t.y,u=n?e.z-t.z:0,h=c*c+l*l+u*u;0===h&&(h=1,c=.01,l=.01,u=.01);const d=this.k2/h,f=c*d,g=l*d,p=u*d;o||a?o&&!a?(s.x-=2*f,s.y-=2*g,n&&(s.z-=2*p)):!o&&a&&(i.x+=2*f,i.y+=2*g,n&&(i.z+=2*p)):(i.x+=f,i.y+=g,s.x-=f,s.y-=g,n&&(i.z+=p,s.z-=p))}}}calculateAttractive(){const{model:t,options:e}=this,n=3===e.dimensions;t.forEachEdge(e=>{const{source:r,target:i}=e;if(!r||!i||r===i)return;const o=t.node(r),A=t.node(i),s=this.displacements.get(r),a=this.displacements.get(i),c=this.isNodeFixed(o),l=this.isNodeFixed(A),u=A.x-o.x,h=A.y-o.y,d=n?A.z-o.z:0,f=Math.sqrt(u*u+h*h+d*d);if(0===f)return;const g=f/this.k,p=u*g,v=h*g,m=d*g;c||l?c&&!l?(a.x-=2*p,a.y-=2*v,n&&(a.z-=2*m)):!c&&l&&(s.x+=2*p,s.y+=2*v,n&&(s.z+=2*m)):(s.x+=p,s.y+=v,a.x-=p,a.y-=v,n&&(s.z+=m,a.z-=m))})}applyClusterGravity(){const{model:t,options:e}=this,{nodeClusterBy:n,clusterGravity:r,dimensions:i,clustering:o}=e;if(!o)return;if(this.clusterMap||(this.clusterMap=new Map,t.forEachNode(e=>{const r=n(t.originalNode(e.id));this.clusterMap.has(r)||this.clusterMap.set(r,{name:r,cx:0,cy:0,cz:0,count:0})})),0===this.clusterMap.size)return;const A=3===i;this.clusterMap.forEach(t=>{t.cx=0,t.cy=0,t.cz=0,t.count=0}),t.forEachNode(e=>{const r=n(t.originalNode(e.id)),i=this.clusterMap.get(r);i&&(i.cx+=e.x,i.cy+=e.y,A&&(i.cz+=e.z),i.count++)}),this.clusterMap.forEach(t=>{t.count>0&&(t.cx/=t.count,t.cy/=t.count,t.cz/=t.count)}),t.forEachNode(e=>{const{id:i}=e;if(this.isNodeFixed(e))return;const o=n(t.originalNode(i)),s=this.clusterMap.get(o);if(!s)return;const a=this.displacements.get(i),c=e.x-s.cx,l=e.y-s.cy,u=A?e.z-s.cz:0,h=Math.sqrt(c*c+l*l+u*u);if(0===h)return;const d=this.k*r;a.x-=d*c/h,a.y-=d*l/h,A&&(a.z-=d*u/h)})}applyGlobalGravity(){const{model:t,options:e}=this,{gravity:n,center:r,dimensions:i}=e,o=3===i,A=.01*this.k*n;t.forEachNode(t=>{const{id:e}=t;if(this.isNodeFixed(t))return;const n=this.displacements.get(e);n.x-=A*(t.x-r[0]),n.y-=A*(t.y-r[1]),o&&(n.z-=A*(t.z-(r[2]||0)))})}updatePositions(){const{model:t,options:e}=this,{speed:n,dimensions:r,distanceThresholdMode:i="max"}=e,o=3===r;let A=0,s=1/0,a=0,c=0;if(t.forEachNode(t=>{const{id:e}=t;if(this.isNodeFixed(t))return;const r=this.displacements.get(e),i=Math.sqrt(r.x*r.x+r.y*r.y+(o?r.z*r.z:0));if(0===i)return;const l=Math.min(this.maxDisplace*(n/800),i),u=l/i;t.x+=r.x*u,t.y+=r.y*u,o&&(t.z=t.z+r.z*u),A=Math.max(A,l),s=Math.min(s,l),a+=l,c++}),0===c)return 0;switch(i){case"min":return s===1/0?0:s;case"mean":return a/c;default:return A}}destroy(){var t,e;this.stop(),null===(t=this.displacements)||void 0===t||t.clear(),null===(e=this.clusterMap)||void 0===e||e.clear()}}const ij={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"node.cluster",dimensions:2};class oj extends xC{constructor(){super(...arguments),this.id="fruchterman",this.simulation=null}getDefaultOptions(){return ij}parseOptions(t={}){const{clustering:e,nodeClusterBy:n}=this.options,r=e&&!!n;return Object.assign(t,kF(t),{clustering:r,nodeClusterBy:Vx(n,["node"])}),t}layout(){return mx(this,0,void 0,function*(){const t=this.parseOptions(this.options),{dimensions:e,center:n,width:r,height:i}=t,o=this.model.nodeCount();if(!o||1===o)return void EF(this.model,n,e);tC(this.model,r,i,e);const A=this.setSimulation();return A.data(this.model),A.initialize(t),A.restart(),new Promise(t=>{A.on("end",()=>t())})})}setSimulation(){const t=this.simulation||new rj;return this.simulation||(this.simulation=t.on("tick",()=>{var t,e;return null===(e=(t=this.options).onTick)||void 0===e?void 0:e.call(t,this)})),this.simulation}restart(){var t;null===(t=this.simulation)||void 0===t||t.restart()}stop(){var t;null===(t=this.simulation)||void 0===t||t.stop()}tick(t=1){var e;null===(e=this.simulation)||void 0===e||e.tick(t)}setFixedPosition(t,e){var n;null===(n=this.simulation)||void 0===n||n.setFixedPosition(t,e)}destroy(){var t;super.destroy(),this.stop(),null===(t=this.simulation)||void 0===t||t.destroy(),this.simulation=null}}const Aj={begin:[0,0],preventOverlap:!0,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,nodeSpacing:10,width:300,height:300};class sj extends EC{constructor(){super(...arguments),this.id="grid"}getDefaultOptions(){return Aj}parseOptions(t={},e){const{rows:n,cols:r,position:i,sortBy:o}=t,{width:A,height:s,center:a}=kF(t);let c=t.rows,l=t.cols;const u=e.nodeCount();if(null!=n&&null!=r)c=n,l=r;else if(null!=n&&null==r)c=n,l=Math.ceil(u/c);else if(null==n&&null!=r)l=r,c=Math.ceil(u/l);else{const t=Math.sqrt(u*s/A);c=Math.round(t),l=Math.round(A/s*t)}c=Math.max(c,1),l=Math.max(l,1);const h={rows:c,cols:l};if(h.cols*h.rows>u){const t=aj(h),e=cj(h);(t-1)*e>=u?aj(h,t-1):(e-1)*t>=u&&cj(h,e-1)}else for(;h.cols*h.rows<u;){const t=aj(h),e=cj(h);(e+1)*t>=u?cj(h,e+1):aj(h,t+1)}const d=o?"degree"===o||"id"===o?o:Vx(o,["nodeA","nodeB"]):Aj.sortBy;return Object.assign(Object.assign({},t),{sortBy:d,rcs:h,center:a,width:A,height:s,position:Vx(i,["node"])})}layout(){return mx(this,0,void 0,function*(){const{begin:t,rcs:e,sortBy:n,width:r,height:i,condense:o,preventOverlap:A,nodeSpacing:s,nodeSize:a,position:c}=this.parseOptions(this.options,this.model),l=this.model.nodeCount();if(!l||1===l)return void EF(this.model,t);"degree"===n?CF(this.model):"id"===n?xF(this.model,(t,e)=>{const n=t.id,r=e.id;return"number"==typeof n&&"number"==typeof r?n-r:String(n).localeCompare(String(r))}):MF(this.model,n);let u=o?0:r/e.cols,h=o?0:i/e.rows;if(A){const t=Xx(a,s,Aj.nodeSize,Aj.nodeSpacing);this.model.forEachNode(e=>{const[n,r]=t(e._original);u=Math.max(u,n),h=Math.max(h,r)})}const d={},f={row:0,col:0},g={};this.model.forEachNode(n=>{const r=n._original;let i;if(c&&(i=c(r)),i&&(void 0!==i.row||void 0!==i.col)){const t={row:i.row,col:i.col};if(void 0===t.col)for(t.col=0;lj(d,t);)t.col++;else if(void 0===t.row)for(t.row=0;lj(d,t);)t.row++;g[n.id]=t,uj(d,t)}dj(n,t,u,h,g,e,f,d)})})}}const aj=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.min(r,i);else{Math.min(r,i)===t.rows?t.rows=e:t.cols=e}return n},cj=(t,e)=>{let n;const r=t.rows||5,i=t.cols||5;if(null==e)n=Math.max(r,i);else{Math.max(r,i)===t.rows?t.rows=e:t.cols=e}return n},lj=(t,e)=>t[`c-${e.row}-${e.col}`]||!1,uj=(t,e)=>t[`c-${e.row}-${e.col}`]=!0,hj=(t,e)=>{const n=t.cols||5;e.col++,e.col>=n&&(e.col=0,e.row++)},dj=(t,e,n,r,i,o,A,s)=>{let a,c;const l=i[t.id];if(l)a=l.col*n+n/2+e[0],c=l.row*r+r/2+e[1];else{for(;lj(s,A);)hj(o,A);a=A.col*n+n/2+e[0],c=A.row*r+r/2+e[1],uj(s,A),hj(o,A)}t.x=a,t.y=c};var fj={};const gj=Object.prototype.toString;function pj(t){const e=gj.call(t);return e.endsWith("Array]")&&!e.includes("Big")}var vj=EU(Object.freeze({__proto__:null,isAnyArray:pj}));var mj,yj=Object.freeze({__proto__:null,default:function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!pj(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");if(void 0!==n.output){if(!pj(n.output))throw new TypeError("output option must be an array if specified");e=n.output}else e=new Array(t.length);var r=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!pj(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var A=t[r],s=r+1;s<o;s++)t[s]<A&&(A=t[s]);return A}(t),i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!pj(t))throw new TypeError("input must be an array");if(0===t.length)throw new TypeError("input must not be empty");var n=e.fromIndex,r=void 0===n?0:n,i=e.toIndex,o=void 0===i?t.length:i;if(r<0||r>=t.length||!Number.isInteger(r))throw new Error("fromIndex must be a positive integer smaller than length");if(o<=r||o>t.length||!Number.isInteger(o))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var A=t[r],s=r+1;s<o;s++)t[s]>A&&(A=t[s]);return A}(t);if(r===i)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var o=n.min,A=void 0===o?n.autoMinMax?r:0:o,s=n.max,a=void 0===s?n.autoMinMax?i:1:s;if(A>=a)throw new RangeError("min option must be smaller than max option");for(var c=(a-A)/(i-r),l=0;l<t.length;l++)e[l]=(t[l]-r)*c+A;return e}}),wj=EU(yj);function bj(){if(mj)return fj;mj=1,Object.defineProperty(fj,"__esModule",{value:!0});var t=vj,e=wj;const n=" ".repeat(2),r=" ".repeat(4);function i(t,e={}){const{maxRows:i=15,maxColumns:A=10,maxNumSize:s=8,padMinus:a="auto"}=e;return`${t.constructor.name} {\n${n}[\n${r}${function(t,e,n,i,A){const{rows:s,columns:a}=t,c=Math.min(s,e),l=Math.min(a,n),u=[];if("auto"===A){A=!1;t:for(let e=0;e<c;e++)for(let n=0;n<l;n++)if(t.get(e,n)<0){A=!0;break t}}for(let e=0;e<c;e++){let n=[];for(let r=0;r<l;r++)n.push(o(t.get(e,r),i,A));u.push(`${n.join(" ")}`)}l!==a&&(u[u.length-1]+=` ... ${a-n} more columns`);c!==s&&u.push(`... ${s-e} more rows`);return u.join(`\n${r}`)}(t,i,A,s,a)}\n${n}]\n${n}rows: ${t.rows}\n${n}columns: ${t.columns}\n}`}function o(t,e,n){return(t>=0&&n?` ${A(t,e-1)}`:A(t,e)).padEnd(e)}function A(t,e){let n=t.toString();if(n.length<=e)return n;let r=t.toFixed(e);if(r.length>e&&(r=t.toFixed(Math.max(0,e-(r.length-e)))),r.length<=e&&!r.startsWith("0.000")&&!r.startsWith("-0.000"))return r;let i=t.toExponential(e);return i.length>e&&(i=t.toExponential(Math.max(0,e-(i.length-e)))),i.slice(0)}function s(t,e,n){let r=n?t.rows:t.rows-1;if(e<0||e>r)throw new RangeError("Row index out of range")}function a(t,e,n){let r=n?t.columns:t.columns-1;if(e<0||e>r)throw new RangeError("Column index out of range")}function c(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.columns)throw new RangeError("vector size must be the same as the number of columns");return e}function l(t,e){if(e.to1DArray&&(e=e.to1DArray()),e.length!==t.rows)throw new RangeError("vector size must be the same as the number of rows");return e}function u(e,n){if(!t.isAnyArray(n))throw new TypeError("row indices must be an array");for(let t=0;t<n.length;t++)if(n[t]<0||n[t]>=e.rows)throw new RangeError("row indices are out of range")}function h(e,n){if(!t.isAnyArray(n))throw new TypeError("column indices must be an array");for(let t=0;t<n.length;t++)if(n[t]<0||n[t]>=e.columns)throw new RangeError("column indices are out of range")}function d(t,e,n,r,i){if(5!==arguments.length)throw new RangeError("expected 4 arguments");if(g("startRow",e),g("endRow",n),g("startColumn",r),g("endColumn",i),e>n||r>i||e<0||e>=t.rows||n<0||n>=t.rows||r<0||r>=t.columns||i<0||i>=t.columns)throw new RangeError("Submatrix indices are out of range")}function f(t,e=0){let n=[];for(let r=0;r<t;r++)n.push(e);return n}function g(t,e){if("number"!=typeof e)throw new TypeError(`${t} must be a number`)}function p(t){if(t.isEmpty())throw new Error("Empty matrix has no elements to index")}class v{static from1DArray(t,e,n){if(t*e!==n.length)throw new RangeError("data length does not match given dimensions");let r=new w(t,e);for(let i=0;i<t;i++)for(let t=0;t<e;t++)r.set(i,t,n[i*e+t]);return r}static rowVector(t){let e=new w(1,t.length);for(let n=0;n<t.length;n++)e.set(0,n,t[n]);return e}static columnVector(t){let e=new w(t.length,1);for(let n=0;n<t.length;n++)e.set(n,0,t[n]);return e}static zeros(t,e){return new w(t,e)}static ones(t,e){return new w(t,e).fill(1)}static rand(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{random:r=Math.random}=n;let i=new w(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++)i.set(n,t,r());return i}static randInt(t,e,n={}){if("object"!=typeof n)throw new TypeError("options must be an object");const{min:r=0,max:i=1e3,random:o=Math.random}=n;if(!Number.isInteger(r))throw new TypeError("min must be an integer");if(!Number.isInteger(i))throw new TypeError("max must be an integer");if(r>=i)throw new RangeError("min must be smaller than max");let A=i-r,s=new w(t,e);for(let n=0;n<t;n++)for(let t=0;t<e;t++){let e=r+Math.round(o()*A);s.set(n,t,e)}return s}static eye(t,e,n){void 0===e&&(e=t),void 0===n&&(n=1);let r=Math.min(t,e),i=this.zeros(t,e);for(let t=0;t<r;t++)i.set(t,t,n);return i}static diag(t,e,n){let r=t.length;void 0===e&&(e=r),void 0===n&&(n=e);let i=Math.min(r,e,n),o=this.zeros(e,n);for(let e=0;e<i;e++)o.set(e,e,t[e]);return o}static min(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new w(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.min(t.get(o,n),e.get(o,n)));return i}static max(t,e){t=this.checkMatrix(t),e=this.checkMatrix(e);let n=t.rows,r=t.columns,i=new this(n,r);for(let o=0;o<n;o++)for(let n=0;n<r;n++)i.set(o,n,Math.max(t.get(o,n),e.get(o,n)));return i}static checkMatrix(t){return v.isMatrix(t)?t:new w(t)}static isMatrix(t){return null!=t&&"Matrix"===t.klass}get size(){return this.rows*this.columns}apply(t){if("function"!=typeof t)throw new TypeError("callback must be a function");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.call(this,e,n);return this}to1DArray(){let t=[];for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.push(this.get(e,n));return t}to2DArray(){let t=[];for(let e=0;e<this.rows;e++){t.push([]);for(let n=0;n<this.columns;n++)t[e].push(this.get(e,n))}return t}toJSON(){return this.to2DArray()}isRowVector(){return 1===this.rows}isColumnVector(){return 1===this.columns}isVector(){return 1===this.rows||1===this.columns}isSquare(){return this.rows===this.columns}isEmpty(){return 0===this.rows||0===this.columns}isSymmetric(){if(this.isSquare()){for(let t=0;t<this.rows;t++)for(let e=0;e<=t;e++)if(this.get(t,e)!==this.get(e,t))return!1;return!0}return!1}isDistance(){if(!this.isSymmetric())return!1;for(let t=0;t<this.rows;t++)if(0!==this.get(t,t))return!1;return!0}isEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);t++}return r}isReducedEchelonForm(){let t=0,e=0,n=-1,r=!0,i=!1;for(;t<this.rows&&r;){for(e=0,i=!1;e<this.columns&&!1===i;)0===this.get(t,e)?e++:1===this.get(t,e)&&e>n?(i=!0,n=e):(r=!1,i=!0);for(let n=e+1;n<this.rows;n++)0!==this.get(t,n)&&(r=!1);t++}return r}echelonForm(){let t=this.clone(),e=0,n=0;for(;e<t.rows&&n<t.columns;){let r=e;for(let i=e;i<t.rows;i++)t.get(i,n)>t.get(r,n)&&(r=i);if(0===t.get(r,n))n++;else{t.swapRows(e,r);let i=t.get(e,n);for(let r=n;r<t.columns;r++)t.set(e,r,t.get(e,r)/i);for(let r=e+1;r<t.rows;r++){let i=t.get(r,n)/t.get(e,n);t.set(r,n,0);for(let o=n+1;o<t.columns;o++)t.set(r,o,t.get(r,o)-t.get(e,o)*i)}e++,n++}}return t}reducedEchelonForm(){let t=this.echelonForm(),e=t.columns,n=t.rows,r=n-1;for(;r>=0;)if(0===t.maxRow(r))r--;else{let i=0,o=!1;for(;i<n&&!1===o;)1===t.get(r,i)?o=!0:i++;for(let n=0;n<r;n++){let o=t.get(n,i);for(let A=i;A<e;A++){let e=t.get(n,A)-o*t.get(r,A);t.set(n,A,e)}}r--}return t}set(){throw new Error("set method is unimplemented")}get(){throw new Error("get method is unimplemented")}repeat(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{rows:e=1,columns:n=1}=t;if(!Number.isInteger(e)||e<=0)throw new TypeError("rows must be a positive integer");if(!Number.isInteger(n)||n<=0)throw new TypeError("columns must be a positive integer");let r=new w(this.rows*e,this.columns*n);for(let t=0;t<e;t++)for(let e=0;e<n;e++)r.setSubMatrix(this,this.rows*t,this.columns*e);return r}fill(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,t);return this}neg(){return this.mulS(-1)}getRow(t){s(this,t);let e=[];for(let n=0;n<this.columns;n++)e.push(this.get(t,n));return e}getRowVector(t){return w.rowVector(this.getRow(t))}setRow(t,e){s(this,t),e=c(this,e);for(let n=0;n<this.columns;n++)this.set(t,n,e[n]);return this}swapRows(t,e){s(this,t),s(this,e);for(let n=0;n<this.columns;n++){let r=this.get(t,n);this.set(t,n,this.get(e,n)),this.set(e,n,r)}return this}getColumn(t){a(this,t);let e=[];for(let n=0;n<this.rows;n++)e.push(this.get(n,t));return e}getColumnVector(t){return w.columnVector(this.getColumn(t))}setColumn(t,e){a(this,t),e=l(this,e);for(let n=0;n<this.rows;n++)this.set(n,t,e[n]);return this}swapColumns(t,e){a(this,t),a(this,e);for(let n=0;n<this.rows;n++){let r=this.get(n,t);this.set(n,t,this.get(n,e)),this.set(n,e,r)}return this}addRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[n]);return this}subRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[n]);return this}mulRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[n]);return this}divRowVector(t){t=c(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[n]);return this}addColumnVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t[e]);return this}subColumnVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t[e]);return this}mulColumnVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t[e]);return this}divColumnVector(t){t=l(this,t);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t[e]);return this}mulRow(t,e){s(this,t);for(let n=0;n<this.columns;n++)this.set(t,n,this.get(t,n)*e);return this}mulColumn(t,e){a(this,t);for(let n=0;n<this.rows;n++)this.set(n,t,this.get(n,t)*e);return this}max(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)>t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}maxIndex(){p(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)>t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}min(t){if(this.isEmpty())return NaN;switch(t){case"row":{const t=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[e]&&(t[e]=this.get(e,n));return t}case"column":{const t=new Array(this.columns).fill(Number.POSITIVE_INFINITY);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t[n]&&(t[n]=this.get(e,n));return t}case void 0:{let t=this.get(0,0);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.get(e,n)<t&&(t=this.get(e,n));return t}default:throw new Error(`invalid option: ${t}`)}}minIndex(){p(this);let t=this.get(0,0),e=[0,0];for(let n=0;n<this.rows;n++)for(let r=0;r<this.columns;r++)this.get(n,r)<t&&(t=this.get(n,r),e[0]=n,e[1]=r);return e}maxRow(t){if(s(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)>e&&(e=this.get(t,n));return e}maxRowIndex(t){s(this,t),p(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)>e&&(e=this.get(t,r),n[1]=r);return n}minRow(t){if(s(this,t),this.isEmpty())return NaN;let e=this.get(t,0);for(let n=1;n<this.columns;n++)this.get(t,n)<e&&(e=this.get(t,n));return e}minRowIndex(t){s(this,t),p(this);let e=this.get(t,0),n=[t,0];for(let r=1;r<this.columns;r++)this.get(t,r)<e&&(e=this.get(t,r),n[1]=r);return n}maxColumn(t){if(a(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)>e&&(e=this.get(n,t));return e}maxColumnIndex(t){a(this,t),p(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)>e&&(e=this.get(r,t),n[0]=r);return n}minColumn(t){if(a(this,t),this.isEmpty())return NaN;let e=this.get(0,t);for(let n=1;n<this.rows;n++)this.get(n,t)<e&&(e=this.get(n,t));return e}minColumnIndex(t){a(this,t),p(this);let e=this.get(0,t),n=[0,t];for(let r=1;r<this.rows;r++)this.get(r,t)<e&&(e=this.get(r,t),n[0]=r);return n}diag(){let t=Math.min(this.rows,this.columns),e=[];for(let n=0;n<t;n++)e.push(this.get(n,n));return e}norm(t="frobenius"){switch(t){case"max":return this.max();case"frobenius":return Math.sqrt(this.dot(this));default:throw new RangeError(`unknown norm type: ${t}`)}}cumulativeSum(){let t=0;for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t+=this.get(e,n),this.set(e,n,t);return this}dot(t){v.isMatrix(t)&&(t=t.to1DArray());let e=this.to1DArray();if(e.length!==t.length)throw new RangeError("vectors do not have the same size");let n=0;for(let r=0;r<e.length;r++)n+=e[r]*t[r];return n}mmul(t){t=w.checkMatrix(t);let e=this.rows,n=this.columns,r=t.columns,i=new w(e,r),o=new Float64Array(n);for(let A=0;A<r;A++){for(let e=0;e<n;e++)o[e]=t.get(e,A);for(let t=0;t<e;t++){let e=0;for(let r=0;r<n;r++)e+=this.get(t,r)*o[r];i.set(t,A,e)}}return i}mpow(t){if(!this.isSquare())throw new RangeError("Matrix must be square");if(!Number.isInteger(t)||t<0)throw new RangeError("Exponent must be a non-negative integer");let e=w.eye(this.rows),n=this;for(let r=t;r>=1;r/=2)1&r&&(e=e.mmul(n)),n=n.mmul(n);return e}strassen2x2(t){t=w.checkMatrix(t);let e=new w(2,2);const n=this.get(0,0),r=t.get(0,0),i=this.get(0,1),o=t.get(0,1),A=this.get(1,0),s=t.get(1,0),a=this.get(1,1),c=t.get(1,1),l=(n+a)*(r+c),u=(A+a)*r,h=n*(o-c),d=a*(s-r),f=(n+i)*c,g=l+d-f+(i-a)*(s+c),p=h+f,v=u+d,m=l-u+h+(A-n)*(r+o);return e.set(0,0,g),e.set(0,1,p),e.set(1,0,v),e.set(1,1,m),e}strassen3x3(t){t=w.checkMatrix(t);let e=new w(3,3);const n=this.get(0,0),r=this.get(0,1),i=this.get(0,2),o=this.get(1,0),A=this.get(1,1),s=this.get(1,2),a=this.get(2,0),c=this.get(2,1),l=this.get(2,2),u=t.get(0,0),h=t.get(0,1),d=t.get(0,2),f=t.get(1,0),g=t.get(1,1),p=t.get(1,2),v=t.get(2,0),m=t.get(2,1),y=t.get(2,2),b=(n-o)*(-h+g),B=(-n+o+A)*(u-h+g),E=(o+A)*(-u+h),x=n*u,C=(-n+a+c)*(u-d+p),M=(-n+a)*(d-p),F=(a+c)*(-u+d),k=(-i+c+l)*(g+v-m),S=(i-l)*(g-m),Q=i*v,U=(c+l)*(-v+m),N=(-i+A+s)*(p+v-y),T=(i-s)*(p-y),O=(A+s)*(-v+y),I=x+Q+r*f,L=(n+r+i-o-A-c-l)*g+B+E+x+k+Q+U,P=x+C+F+(n+r+i-A-s-a-c)*p+Q+N+O,D=b+A*(-u+h+f-g-p-v+y)+B+x+Q+N+T,R=b+B+E+x+s*m,H=Q+N+T+O+o*d,_=x+C+M+c*(-u+d+f-g-p-v+m)+k+S+Q,G=k+S+Q+U+a*h,K=x+C+M+F+l*y;return e.set(0,0,I),e.set(0,1,L),e.set(0,2,P),e.set(1,0,D),e.set(1,1,R),e.set(1,2,H),e.set(2,0,_),e.set(2,1,G),e.set(2,2,K),e}mmulStrassen(t){t=w.checkMatrix(t);let e=this.clone(),n=e.rows,r=e.columns,i=t.rows,o=t.columns;function A(t,e,n){let r=t.rows,i=t.columns;if(r===e&&i===n)return t;{let r=v.zeros(e,n);return r=r.setSubMatrix(t,0,0),r}}r!==i&&console.warn(`Multiplying ${n} x ${r} and ${i} x ${o} matrix: dimensions do not match.`);let s=Math.max(n,i),a=Math.max(r,o);return e=A(e,s,a),function t(e,n,r,i){if(r<=512||i<=512)return e.mmul(n);r%2==1&&i%2==1?(e=A(e,r+1,i+1),n=A(n,r+1,i+1)):r%2==1?(e=A(e,r+1,i),n=A(n,r+1,i)):i%2==1&&(e=A(e,r,i+1),n=A(n,r,i+1));let o=parseInt(e.rows/2,10),s=parseInt(e.columns/2,10),a=e.subMatrix(0,o-1,0,s-1),c=n.subMatrix(0,o-1,0,s-1),l=e.subMatrix(0,o-1,s,e.columns-1),u=n.subMatrix(0,o-1,s,n.columns-1),h=e.subMatrix(o,e.rows-1,0,s-1),d=n.subMatrix(o,n.rows-1,0,s-1),f=e.subMatrix(o,e.rows-1,s,e.columns-1),g=n.subMatrix(o,n.rows-1,s,n.columns-1),p=t(v.add(a,f),v.add(c,g),o,s),m=t(v.add(h,f),c,o,s),y=t(a,v.sub(u,g),o,s),w=t(f,v.sub(d,c),o,s),b=t(v.add(a,l),g,o,s),B=t(v.sub(h,a),v.add(c,u),o,s),E=t(v.sub(l,f),v.add(d,g),o,s),x=v.add(p,w);x.sub(b),x.add(E);let C=v.add(y,b),M=v.add(m,w),F=v.sub(p,m);F.add(y),F.add(B);let k=v.zeros(2*x.rows,2*x.columns);return k=k.setSubMatrix(x,0,0),k=k.setSubMatrix(C,x.rows,0),k=k.setSubMatrix(M,0,x.columns),k=k.setSubMatrix(F,x.rows,x.columns),k.subMatrix(0,r-1,0,i-1)}(e,t=A(t,s,a),s,a)}scaleRows(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:n=0,max:r=1}=t;if(!Number.isFinite(n))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(n>=r)throw new RangeError("min must be smaller than max");let i=new w(this.rows,this.columns);for(let t=0;t<this.rows;t++){const o=this.getRow(t);o.length>0&&e(o,{min:n,max:r,output:o}),i.setRow(t,o)}return i}scaleColumns(t={}){if("object"!=typeof t)throw new TypeError("options must be an object");const{min:n=0,max:r=1}=t;if(!Number.isFinite(n))throw new TypeError("min must be a number");if(!Number.isFinite(r))throw new TypeError("max must be a number");if(n>=r)throw new RangeError("min must be smaller than max");let i=new w(this.rows,this.columns);for(let t=0;t<this.columns;t++){const o=this.getColumn(t);o.length&&e(o,{min:n,max:r,output:o}),i.setColumn(t,o)}return i}flipRows(){const t=Math.ceil(this.columns/2);for(let e=0;e<this.rows;e++)for(let n=0;n<t;n++){let t=this.get(e,n),r=this.get(e,this.columns-1-n);this.set(e,n,r),this.set(e,this.columns-1-n,t)}return this}flipColumns(){const t=Math.ceil(this.rows/2);for(let e=0;e<this.columns;e++)for(let n=0;n<t;n++){let t=this.get(n,e),r=this.get(this.rows-1-n,e);this.set(n,e,r),this.set(this.rows-1-n,e,t)}return this}kroneckerProduct(t){t=w.checkMatrix(t);let e=this.rows,n=this.columns,r=t.rows,i=t.columns,o=new w(e*r,n*i);for(let A=0;A<e;A++)for(let e=0;e<n;e++)for(let n=0;n<r;n++)for(let s=0;s<i;s++)o.set(r*A+n,i*e+s,this.get(A,e)*t.get(n,s));return o}kroneckerSum(t){if(t=w.checkMatrix(t),!this.isSquare()||!t.isSquare())throw new Error("Kronecker Sum needs two Square Matrices");let e=this.rows,n=t.rows,r=this.kroneckerProduct(w.eye(n,n)),i=w.eye(e,e).kroneckerProduct(t);return r.add(i)}transpose(){let t=new w(this.columns,this.rows);for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)t.set(n,e,this.get(e,n));return t}sortRows(t=m){for(let e=0;e<this.rows;e++)this.setRow(e,this.getRow(e).sort(t));return this}sortColumns(t=m){for(let e=0;e<this.columns;e++)this.setColumn(e,this.getColumn(e).sort(t));return this}subMatrix(t,e,n,r){d(this,t,e,n,r);let i=new w(e-t+1,r-n+1);for(let o=t;o<=e;o++)for(let e=n;e<=r;e++)i.set(o-t,e-n,this.get(o,e));return i}subMatrixRow(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.columns-1),e>n||e<0||e>=this.columns||n<0||n>=this.columns)throw new RangeError("Argument out of range");let r=new w(t.length,n-e+1);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.rows)throw new RangeError(`Row index out of range: ${t[i]}`);r.set(i,o-e,this.get(t[i],o))}return r}subMatrixColumn(t,e,n){if(void 0===e&&(e=0),void 0===n&&(n=this.rows-1),e>n||e<0||e>=this.rows||n<0||n>=this.rows)throw new RangeError("Argument out of range");let r=new w(n-e+1,t.length);for(let i=0;i<t.length;i++)for(let o=e;o<=n;o++){if(t[i]<0||t[i]>=this.columns)throw new RangeError(`Column index out of range: ${t[i]}`);r.set(o-e,i,this.get(o,t[i]))}return r}setSubMatrix(t,e,n){if((t=w.checkMatrix(t)).isEmpty())return this;d(this,e,e+t.rows-1,n,n+t.columns-1);for(let r=0;r<t.rows;r++)for(let i=0;i<t.columns;i++)this.set(e+r,n+i,t.get(r,i));return this}selection(t,e){u(this,t),h(this,e);let n=new w(t.length,e.length);for(let r=0;r<t.length;r++){let i=t[r];for(let t=0;t<e.length;t++){let o=e[t];n.set(r,t,this.get(i,o))}}return n}trace(){let t=Math.min(this.rows,this.columns),e=0;for(let n=0;n<t;n++)e+=this.get(n,n);return e}clone(){return this.constructor.copy(this,new w(this.rows,this.columns))}static copy(t,e){for(const[n,r,i]of t.entries())e.set(n,r,i);return e}sum(t){switch(t){case"row":return function(t){let e=f(t.rows);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]+=t.get(n,r);return e}(this);case"column":return function(t){let e=f(t.columns);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]+=t.get(n,r);return e}(this);case void 0:return function(t){let e=0;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e+=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}product(t){switch(t){case"row":return function(t){let e=f(t.rows,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[n]*=t.get(n,r);return e}(this);case"column":return function(t){let e=f(t.columns,1);for(let n=0;n<t.rows;++n)for(let r=0;r<t.columns;++r)e[r]*=t.get(n,r);return e}(this);case void 0:return function(t){let e=1;for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)e*=t.get(n,r);return e}(this);default:throw new Error(`invalid option: ${t}`)}}mean(t){const e=this.sum(t);switch(t){case"row":for(let t=0;t<this.rows;t++)e[t]/=this.columns;return e;case"column":for(let t=0;t<this.columns;t++)e[t]/=this.rows;return e;case void 0:return e/this.size;default:throw new Error(`invalid option: ${t}`)}}variance(e,n={}){if("object"==typeof e&&(n=e,e=void 0),"object"!=typeof n)throw new TypeError("options must be an object");const{unbiased:r=!0,mean:i=this.mean(e)}=n;if("boolean"!=typeof r)throw new TypeError("unbiased must be a boolean");switch(e){case"row":if(!t.isAnyArray(i))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let A=0;A<r;A++){let r=0,s=0,a=0;for(let e=0;e<i;e++)a=t.get(A,e)-n[A],r+=a,s+=a*a;e?o.push((s-r*r/i)/(i-1)):o.push((s-r*r/i)/i)}return o}(this,r,i);case"column":if(!t.isAnyArray(i))throw new TypeError("mean must be an array");return function(t,e,n){const r=t.rows,i=t.columns,o=[];for(let A=0;A<i;A++){let i=0,s=0,a=0;for(let e=0;e<r;e++)a=t.get(e,A)-n[A],i+=a,s+=a*a;e?o.push((s-i*i/r)/(r-1)):o.push((s-i*i/r)/r)}return o}(this,r,i);case void 0:if("number"!=typeof i)throw new TypeError("mean must be a number");return function(t,e,n){const r=t.rows,i=t.columns,o=r*i;let A=0,s=0,a=0;for(let e=0;e<r;e++)for(let r=0;r<i;r++)a=t.get(e,r)-n,A+=a,s+=a*a;return e?(s-A*A/o)/(o-1):(s-A*A/o)/o}(this,r,i);default:throw new Error(`invalid option: ${e}`)}}standardDeviation(t,e){"object"==typeof t&&(e=t,t=void 0);const n=this.variance(t,e);if(void 0===t)return Math.sqrt(n);for(let t=0;t<n.length;t++)n[t]=Math.sqrt(n[t]);return n}center(e,n={}){if("object"==typeof e&&(n=e,e=void 0),"object"!=typeof n)throw new TypeError("options must be an object");const{center:r=this.mean(e)}=n;switch(e){case"row":if(!t.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[n])}(this,r),this;case"column":if(!t.isAnyArray(r))throw new TypeError("center must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e[r])}(this,r),this;case void 0:if("number"!=typeof r)throw new TypeError("center must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)-e)}(this,r),this;default:throw new Error(`invalid option: ${e}`)}}scale(e,n={}){if("object"==typeof e&&(n=e,e=void 0),"object"!=typeof n)throw new TypeError("options must be an object");let r=n.scale;switch(e){case"row":if(void 0===r)r=function(t){const e=[];for(let n=0;n<t.rows;n++){let r=0;for(let e=0;e<t.columns;e++)r+=t.get(n,e)**2/(t.columns-1);e.push(Math.sqrt(r))}return e}(this);else if(!t.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[n])}(this,r),this;case"column":if(void 0===r)r=function(t){const e=[];for(let n=0;n<t.columns;n++){let r=0;for(let e=0;e<t.rows;e++)r+=t.get(e,n)**2/(t.rows-1);e.push(Math.sqrt(r))}return e}(this);else if(!t.isAnyArray(r))throw new TypeError("scale must be an array");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e[r])}(this,r),this;case void 0:if(void 0===r)r=function(t){const e=t.size-1;let n=0;for(let r=0;r<t.columns;r++)for(let i=0;i<t.rows;i++)n+=t.get(i,r)**2/e;return Math.sqrt(n)}(this);else if("number"!=typeof r)throw new TypeError("scale must be a number");return function(t,e){for(let n=0;n<t.rows;n++)for(let r=0;r<t.columns;r++)t.set(n,r,t.get(n,r)/e)}(this,r),this;default:throw new Error(`invalid option: ${e}`)}}toString(t){return i(this,t)}[Symbol.iterator](){return this.entries()}*entries(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield[t,e,this.get(t,e)]}*values(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)yield this.get(t,e)}}function m(t,e){return t-e}function y(t){return t.every(t=>"number"==typeof t)}v.prototype.klass="Matrix","undefined"!=typeof Symbol&&(v.prototype[Symbol.for("nodejs.util.inspect.custom")]=function(){return i(this)}),v.random=v.rand,v.randomInt=v.randInt,v.diagonal=v.diag,v.prototype.diagonal=v.prototype.diag,v.identity=v.eye,v.prototype.negate=v.prototype.neg,v.prototype.tensorProduct=v.prototype.kroneckerProduct;class w extends v{data;#t(t,e){if(this.data=[],!(Number.isInteger(e)&&e>=0))throw new TypeError("nColumns must be a positive integer");for(let n=0;n<t;n++)this.data.push(new Float64Array(e));this.rows=t,this.columns=e}constructor(e,n){if(super(),w.isMatrix(e))this.#t(e.rows,e.columns),w.copy(e,this);else if(Number.isInteger(e)&&e>=0)this.#t(e,n);else{if(!t.isAnyArray(e))throw new TypeError("First argument must be a positive number or an array");{const t=e;if("number"!=typeof(n=(e=t.length)?t[0].length:0))throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let r=0;r<e;r++){if(t[r].length!==n)throw new RangeError("Inconsistent array dimensions");if(!y(t[r]))throw new TypeError("Input data contains non-numeric values");this.data.push(Float64Array.from(t[r]))}this.rows=e,this.columns=n}}}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}removeRow(t){return s(this,t),this.data.splice(t,1),this.rows-=1,this}addRow(t,e){return void 0===e&&(e=t,t=this.rows),s(this,t,!0),e=Float64Array.from(c(this,e)),this.data.splice(t,0,e),this.rows+=1,this}removeColumn(t){a(this,t);for(let e=0;e<this.rows;e++){const n=new Float64Array(this.columns-1);for(let r=0;r<t;r++)n[r]=this.data[e][r];for(let r=t+1;r<this.columns;r++)n[r-1]=this.data[e][r];this.data[e]=n}return this.columns-=1,this}addColumn(t,e){void 0===e&&(e=t,t=this.columns),a(this,t,!0),e=l(this,e);for(let n=0;n<this.rows;n++){const r=new Float64Array(this.columns+1);let i=0;for(;i<t;i++)r[i]=this.data[n][i];for(r[i++]=e[n];i<this.columns+1;i++)r[i]=this.data[n][i-1];this.data[n]=r}return this.columns+=1,this}}!function(t,e){t.prototype.add=function(t){return"number"==typeof t?this.addS(t):this.addM(t)},t.prototype.addS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t);return this},t.prototype.addM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)+t.get(e,n));return this},t.add=function(t,n){return new e(t).add(n)},t.prototype.sub=function(t){return"number"==typeof t?this.subS(t):this.subM(t)},t.prototype.subS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t);return this},t.prototype.subM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)-t.get(e,n));return this},t.sub=function(t,n){return new e(t).sub(n)},t.prototype.subtract=t.prototype.sub,t.prototype.subtractS=t.prototype.subS,t.prototype.subtractM=t.prototype.subM,t.subtract=t.sub,t.prototype.mul=function(t){return"number"==typeof t?this.mulS(t):this.mulM(t)},t.prototype.mulS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t);return this},t.prototype.mulM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)*t.get(e,n));return this},t.mul=function(t,n){return new e(t).mul(n)},t.prototype.multiply=t.prototype.mul,t.prototype.multiplyS=t.prototype.mulS,t.prototype.multiplyM=t.prototype.mulM,t.multiply=t.mul,t.prototype.div=function(t){return"number"==typeof t?this.divS(t):this.divM(t)},t.prototype.divS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t);return this},t.prototype.divM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)/t.get(e,n));return this},t.div=function(t,n){return new e(t).div(n)},t.prototype.divide=t.prototype.div,t.prototype.divideS=t.prototype.divS,t.prototype.divideM=t.prototype.divM,t.divide=t.div,t.prototype.mod=function(t){return"number"==typeof t?this.modS(t):this.modM(t)},t.prototype.modS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t);return this},t.prototype.modM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)%t.get(e,n));return this},t.mod=function(t,n){return new e(t).mod(n)},t.prototype.modulus=t.prototype.mod,t.prototype.modulusS=t.prototype.modS,t.prototype.modulusM=t.prototype.modM,t.modulus=t.mod,t.prototype.and=function(t){return"number"==typeof t?this.andS(t):this.andM(t)},t.prototype.andS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t);return this},t.prototype.andM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)&t.get(e,n));return this},t.and=function(t,n){return new e(t).and(n)},t.prototype.or=function(t){return"number"==typeof t?this.orS(t):this.orM(t)},t.prototype.orS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t);return this},t.prototype.orM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)|t.get(e,n));return this},t.or=function(t,n){return new e(t).or(n)},t.prototype.xor=function(t){return"number"==typeof t?this.xorS(t):this.xorM(t)},t.prototype.xorS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t);return this},t.prototype.xorM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)^t.get(e,n));return this},t.xor=function(t,n){return new e(t).xor(n)},t.prototype.leftShift=function(t){return"number"==typeof t?this.leftShiftS(t):this.leftShiftM(t)},t.prototype.leftShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t);return this},t.prototype.leftShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)<<t.get(e,n));return this},t.leftShift=function(t,n){return new e(t).leftShift(n)},t.prototype.signPropagatingRightShift=function(t){return"number"==typeof t?this.signPropagatingRightShiftS(t):this.signPropagatingRightShiftM(t)},t.prototype.signPropagatingRightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t);return this},t.prototype.signPropagatingRightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>t.get(e,n));return this},t.signPropagatingRightShift=function(t,n){return new e(t).signPropagatingRightShift(n)},t.prototype.rightShift=function(t){return"number"==typeof t?this.rightShiftS(t):this.rightShiftM(t)},t.prototype.rightShiftS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t);return this},t.prototype.rightShiftM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)>>>t.get(e,n));return this},t.rightShift=function(t,n){return new e(t).rightShift(n)},t.prototype.zeroFillRightShift=t.prototype.rightShift,t.prototype.zeroFillRightShiftS=t.prototype.rightShiftS,t.prototype.zeroFillRightShiftM=t.prototype.rightShiftM,t.zeroFillRightShift=t.rightShift,t.prototype.not=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,~this.get(t,e));return this},t.not=function(t){return new e(t).not()},t.prototype.abs=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.abs(this.get(t,e)));return this},t.abs=function(t){return new e(t).abs()},t.prototype.acos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acos(this.get(t,e)));return this},t.acos=function(t){return new e(t).acos()},t.prototype.acosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.acosh(this.get(t,e)));return this},t.acosh=function(t){return new e(t).acosh()},t.prototype.asin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asin(this.get(t,e)));return this},t.asin=function(t){return new e(t).asin()},t.prototype.asinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.asinh(this.get(t,e)));return this},t.asinh=function(t){return new e(t).asinh()},t.prototype.atan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atan(this.get(t,e)));return this},t.atan=function(t){return new e(t).atan()},t.prototype.atanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.atanh(this.get(t,e)));return this},t.atanh=function(t){return new e(t).atanh()},t.prototype.cbrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cbrt(this.get(t,e)));return this},t.cbrt=function(t){return new e(t).cbrt()},t.prototype.ceil=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.ceil(this.get(t,e)));return this},t.ceil=function(t){return new e(t).ceil()},t.prototype.clz32=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.clz32(this.get(t,e)));return this},t.clz32=function(t){return new e(t).clz32()},t.prototype.cos=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cos(this.get(t,e)));return this},t.cos=function(t){return new e(t).cos()},t.prototype.cosh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.cosh(this.get(t,e)));return this},t.cosh=function(t){return new e(t).cosh()},t.prototype.exp=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.exp(this.get(t,e)));return this},t.exp=function(t){return new e(t).exp()},t.prototype.expm1=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.expm1(this.get(t,e)));return this},t.expm1=function(t){return new e(t).expm1()},t.prototype.floor=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.floor(this.get(t,e)));return this},t.floor=function(t){return new e(t).floor()},t.prototype.fround=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.fround(this.get(t,e)));return this},t.fround=function(t){return new e(t).fround()},t.prototype.log=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log(this.get(t,e)));return this},t.log=function(t){return new e(t).log()},t.prototype.log1p=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log1p(this.get(t,e)));return this},t.log1p=function(t){return new e(t).log1p()},t.prototype.log10=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log10(this.get(t,e)));return this},t.log10=function(t){return new e(t).log10()},t.prototype.log2=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.log2(this.get(t,e)));return this},t.log2=function(t){return new e(t).log2()},t.prototype.round=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.round(this.get(t,e)));return this},t.round=function(t){return new e(t).round()},t.prototype.sign=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sign(this.get(t,e)));return this},t.sign=function(t){return new e(t).sign()},t.prototype.sin=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sin(this.get(t,e)));return this},t.sin=function(t){return new e(t).sin()},t.prototype.sinh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sinh(this.get(t,e)));return this},t.sinh=function(t){return new e(t).sinh()},t.prototype.sqrt=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.sqrt(this.get(t,e)));return this},t.sqrt=function(t){return new e(t).sqrt()},t.prototype.tan=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tan(this.get(t,e)));return this},t.tan=function(t){return new e(t).tan()},t.prototype.tanh=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.tanh(this.get(t,e)));return this},t.tanh=function(t){return new e(t).tanh()},t.prototype.trunc=function(){for(let t=0;t<this.rows;t++)for(let e=0;e<this.columns;e++)this.set(t,e,Math.trunc(this.get(t,e)));return this},t.trunc=function(t){return new e(t).trunc()},t.pow=function(t,n){return new e(t).pow(n)},t.prototype.pow=function(t){return"number"==typeof t?this.powS(t):this.powM(t)},t.prototype.powS=function(t){for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)**t);return this},t.prototype.powM=function(t){if(t=e.checkMatrix(t),this.rows!==t.rows||this.columns!==t.columns)throw new RangeError("Matrices dimensions must be equal");for(let e=0;e<this.rows;e++)for(let n=0;n<this.columns;n++)this.set(e,n,this.get(e,n)**t.get(e,n));return this}}(v,w);class b extends v{#e;get size(){return this.#e.size}get rows(){return this.#e.rows}get columns(){return this.#e.columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(t){return w.isMatrix(t)&&"SymmetricMatrix"===t.klassType}static zeros(t){return new this(t)}static ones(t){return new this(t).fill(1)}constructor(t){if(super(),w.isMatrix(t)){if(!t.isSymmetric())throw new TypeError("not symmetric data");this.#e=w.copy(t,new w(t.rows,t.rows))}else if(Number.isInteger(t)&&t>=0)this.#e=new w(t,t);else if(this.#e=new w(t),!this.isSymmetric())throw new TypeError("not symmetric data")}clone(){const t=new b(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())t.set(e,n,r);return t}toMatrix(){return new w(this)}get(t,e){return this.#e.get(t,e)}set(t,e,n){return this.#e.set(t,e,n),this.#e.set(e,t,n),this}removeCross(t){return this.#e.removeRow(t),this.#e.removeColumn(t),this}addCross(t,e){void 0===e&&(e=t,t=this.diagonalSize);const n=e.slice();return n.splice(t,1),this.#e.addRow(t,n),this.#e.addColumn(t,e),this}applyMask(t){if(t.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const e=[];for(const[n,r]of t.entries())r||e.push(n);e.reverse();for(const t of e)this.removeCross(t);return this}toCompact(){const{diagonalSize:t}=this,e=new Array(t*(t+1)/2);for(let n=0,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=++r);return e}static fromCompact(t){const e=t.length,n=(Math.sqrt(8*e+1)-1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(t)}`);const r=new b(n);for(let i=0,o=0,A=0;A<e;A++)r.set(i,o,t[A]),++i>=n&&(i=++o);return r}*upperRightEntries(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield[t,e,n],++e>=this.diagonalSize&&(e=++t)}}*upperRightValues(){for(let t=0,e=0;t<this.diagonalSize;void 0){const n=this.get(t,e);yield n,++e>=this.diagonalSize&&(e=++t)}}}b.prototype.klassType="SymmetricMatrix";class B extends b{static isDistanceMatrix(t){return b.isSymmetricMatrix(t)&&"DistanceMatrix"===t.klassSubType}constructor(t){if(super(t),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(t,e,n){return t===e&&(n=0),super.set(t,e,n)}addCross(t,e){return void 0===e&&(e=t,t=this.diagonalSize),(e=e.slice())[t]=0,super.addCross(t,e)}toSymmetricMatrix(){return new b(this)}clone(){const t=new B(this.diagonalSize);for(const[e,n,r]of this.upperRightEntries())e!==n&&t.set(e,n,r);return t}toCompact(){const{diagonalSize:t}=this,e=new Array((t-1)*t/2);for(let n=1,r=0,i=0;i<e.length;i++)e[i]=this.get(r,n),++n>=t&&(n=1+ ++r);return e}static fromCompact(t){const e=t.length;if(0===e)return new this(0);const n=(Math.sqrt(8*e+1)+1)/2;if(!Number.isInteger(n))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(t)}`);const r=new this(n);for(let i=1,o=0,A=0;A<e;A++)r.set(i,o,t[A]),++i>=n&&(i=1+ ++o);return r}}B.prototype.klassSubType="DistanceMatrix";class E extends v{constructor(t,e,n){super(),this.matrix=t,this.rows=e,this.columns=n}}class x extends E{constructor(t,e,n){u(t,e),h(t,n),super(t,e.length,n.length),this.rowIndices=e,this.columnIndices=n}set(t,e,n){return this.matrix.set(this.rowIndices[t],this.columnIndices[e],n),this}get(t,e){return this.matrix.get(this.rowIndices[t],this.columnIndices[e])}}class C extends v{constructor(t,e={}){const{rows:n=1}=e;if(t.length%n!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=n,this.columns=t.length/n,this.data=t}set(t,e,n){let r=this._calculateIndex(t,e);return this.data[r]=n,this}get(t,e){let n=this._calculateIndex(t,e);return this.data[n]}_calculateIndex(t,e){return t*this.columns+e}}class M extends v{constructor(t){super(),this.data=t,this.rows=t.length,this.columns=t[0].length}set(t,e,n){return this.data[t][e]=n,this}get(t,e){return this.data[t][e]}}class F{constructor(t){let e,n,r,i,o,A,s,a,c,l=(t=M.checkMatrix(t)).clone(),u=l.rows,h=l.columns,d=new Float64Array(u),f=1;for(e=0;e<u;e++)d[e]=e;for(a=new Float64Array(u),n=0;n<h;n++){for(e=0;e<u;e++)a[e]=l.get(e,n);for(e=0;e<u;e++){for(c=Math.min(e,n),o=0,r=0;r<c;r++)o+=l.get(e,r)*a[r];a[e]-=o,l.set(e,n,a[e])}for(i=n,e=n+1;e<u;e++)Math.abs(a[e])>Math.abs(a[i])&&(i=e);if(i!==n){for(r=0;r<h;r++)A=l.get(i,r),l.set(i,r,l.get(n,r)),l.set(n,r,A);s=d[i],d[i]=d[n],d[n]=s,f=-f}if(n<u&&0!==l.get(n,n))for(e=n+1;e<u;e++)l.set(e,n,l.get(e,n)/l.get(n,n))}this.LU=l,this.pivotVector=d,this.pivotSign=f}isSingular(){let t=this.LU,e=t.columns;for(let n=0;n<e;n++)if(0===t.get(n,n))return!0;return!1}solve(t){t=w.checkMatrix(t);let e=this.LU;if(e.rows!==t.rows)throw new Error("Invalid matrix dimensions");if(this.isSingular())throw new Error("LU matrix is singular");let n,r,i,o=t.columns,A=t.subMatrixRow(this.pivotVector,0,o-1),s=e.columns;for(i=0;i<s;i++)for(n=i+1;n<s;n++)for(r=0;r<o;r++)A.set(n,r,A.get(n,r)-A.get(i,r)*e.get(n,i));for(i=s-1;i>=0;i--){for(r=0;r<o;r++)A.set(i,r,A.get(i,r)/e.get(i,i));for(n=0;n<i;n++)for(r=0;r<o;r++)A.set(n,r,A.get(n,r)-A.get(i,r)*e.get(n,i))}return A}get determinant(){let t=this.LU;if(!t.isSquare())throw new Error("Matrix must be square");let e=this.pivotSign,n=t.columns;for(let r=0;r<n;r++)e*=t.get(r,r);return e}get lowerTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new w(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i>e?r.set(i,e,t.get(i,e)):i===e?r.set(i,e,1):r.set(i,e,0);return r}get upperTriangularMatrix(){let t=this.LU,e=t.rows,n=t.columns,r=new w(e,n);for(let i=0;i<e;i++)for(let e=0;e<n;e++)i<=e?r.set(i,e,t.get(i,e)):r.set(i,e,0);return r}get pivotPermutationVector(){return Array.from(this.pivotVector)}}function k(t,e){let n=0;return Math.abs(t)>Math.abs(e)?(n=e/t,Math.abs(t)*Math.sqrt(1+n*n)):0!==e?(n=t/e,Math.abs(e)*Math.sqrt(1+n*n)):0}class S{constructor(t){let e,n,r,i,o=(t=M.checkMatrix(t)).clone(),A=t.rows,s=t.columns,a=new Float64Array(s);for(r=0;r<s;r++){let t=0;for(e=r;e<A;e++)t=k(t,o.get(e,r));if(0!==t){for(o.get(r,r)<0&&(t=-t),e=r;e<A;e++)o.set(e,r,o.get(e,r)/t);for(o.set(r,r,o.get(r,r)+1),n=r+1;n<s;n++){for(i=0,e=r;e<A;e++)i+=o.get(e,r)*o.get(e,n);for(i=-i/o.get(r,r),e=r;e<A;e++)o.set(e,n,o.get(e,n)+i*o.get(e,r))}}a[r]=-t}this.QR=o,this.Rdiag=a}solve(t){t=w.checkMatrix(t);let e=this.QR,n=e.rows;if(t.rows!==n)throw new Error("Matrix row dimensions must agree");if(!this.isFullRank())throw new Error("Matrix is rank deficient");let r,i,o,A,s=t.columns,a=t.clone(),c=e.columns;for(o=0;o<c;o++)for(i=0;i<s;i++){for(A=0,r=o;r<n;r++)A+=e.get(r,o)*a.get(r,i);for(A=-A/e.get(o,o),r=o;r<n;r++)a.set(r,i,a.get(r,i)+A*e.get(r,o))}for(o=c-1;o>=0;o--){for(i=0;i<s;i++)a.set(o,i,a.get(o,i)/this.Rdiag[o]);for(r=0;r<o;r++)for(i=0;i<s;i++)a.set(r,i,a.get(r,i)-a.get(o,i)*e.get(r,o))}return a.subMatrix(0,c-1,0,s-1)}isFullRank(){let t=this.QR.columns;for(let e=0;e<t;e++)if(0===this.Rdiag[e])return!1;return!0}get upperTriangularMatrix(){let t,e,n=this.QR,r=n.columns,i=new w(r,r);for(t=0;t<r;t++)for(e=0;e<r;e++)t<e?i.set(t,e,n.get(t,e)):t===e?i.set(t,e,this.Rdiag[t]):i.set(t,e,0);return i}get orthogonalMatrix(){let t,e,n,r,i=this.QR,o=i.rows,A=i.columns,s=new w(o,A);for(n=A-1;n>=0;n--){for(t=0;t<o;t++)s.set(t,n,0);for(s.set(n,n,1),e=n;e<A;e++)if(0!==i.get(n,n)){for(r=0,t=n;t<o;t++)r+=i.get(t,n)*s.get(t,e);for(r=-r/i.get(n,n),t=n;t<o;t++)s.set(t,e,s.get(t,e)+r*i.get(t,n))}}return s}}class Q{constructor(t,e={}){if((t=M.checkMatrix(t)).isEmpty())throw new Error("Matrix must be non-empty");let n=t.rows,r=t.columns;const{computeLeftSingularVectors:i=!0,computeRightSingularVectors:o=!0,autoTranspose:A=!1}=e;let s,a=Boolean(i),c=Boolean(o),l=!1;if(n<r)if(A){s=t.transpose(),n=s.rows,r=s.columns,l=!0;let e=a;a=c,c=e}else s=t.clone(),console.warn("Computing SVD on a matrix with more columns than rows. Consider enabling autoTranspose");else s=t.clone();let u=Math.min(n,r),h=Math.min(n+1,r),d=new Float64Array(h),f=new w(n,u),g=new w(r,r),p=new Float64Array(r),v=new Float64Array(n),m=new Float64Array(h);for(let t=0;t<h;t++)m[t]=t;let y=Math.min(n-1,r),b=Math.max(0,Math.min(r-2,n)),B=Math.max(y,b);for(let t=0;t<B;t++){if(t<y){d[t]=0;for(let e=t;e<n;e++)d[t]=k(d[t],s.get(e,t));if(0!==d[t]){s.get(t,t)<0&&(d[t]=-d[t]);for(let e=t;e<n;e++)s.set(e,t,s.get(e,t)/d[t]);s.set(t,t,s.get(t,t)+1)}d[t]=-d[t]}for(let e=t+1;e<r;e++){if(t<y&&0!==d[t]){let r=0;for(let i=t;i<n;i++)r+=s.get(i,t)*s.get(i,e);r=-r/s.get(t,t);for(let i=t;i<n;i++)s.set(i,e,s.get(i,e)+r*s.get(i,t))}p[e]=s.get(t,e)}if(a&&t<y)for(let e=t;e<n;e++)f.set(e,t,s.get(e,t));if(t<b){p[t]=0;for(let e=t+1;e<r;e++)p[t]=k(p[t],p[e]);if(0!==p[t]){p[t+1]<0&&(p[t]=0-p[t]);for(let e=t+1;e<r;e++)p[e]/=p[t];p[t+1]+=1}if(p[t]=-p[t],t+1<n&&0!==p[t]){for(let e=t+1;e<n;e++)v[e]=0;for(let e=t+1;e<n;e++)for(let n=t+1;n<r;n++)v[e]+=p[n]*s.get(e,n);for(let e=t+1;e<r;e++){let r=-p[e]/p[t+1];for(let i=t+1;i<n;i++)s.set(i,e,s.get(i,e)+r*v[i])}}if(c)for(let e=t+1;e<r;e++)g.set(e,t,p[e])}}let E=Math.min(r,n+1);if(y<r&&(d[y]=s.get(y,y)),n<E&&(d[E-1]=0),b+1<E&&(p[b]=s.get(b,E-1)),p[E-1]=0,a){for(let t=y;t<u;t++){for(let e=0;e<n;e++)f.set(e,t,0);f.set(t,t,1)}for(let t=y-1;t>=0;t--)if(0!==d[t]){for(let e=t+1;e<u;e++){let r=0;for(let i=t;i<n;i++)r+=f.get(i,t)*f.get(i,e);r=-r/f.get(t,t);for(let i=t;i<n;i++)f.set(i,e,f.get(i,e)+r*f.get(i,t))}for(let e=t;e<n;e++)f.set(e,t,-f.get(e,t));f.set(t,t,1+f.get(t,t));for(let e=0;e<t-1;e++)f.set(e,t,0)}else{for(let e=0;e<n;e++)f.set(e,t,0);f.set(t,t,1)}}if(c)for(let t=r-1;t>=0;t--){if(t<b&&0!==p[t])for(let e=t+1;e<r;e++){let n=0;for(let i=t+1;i<r;i++)n+=g.get(i,t)*g.get(i,e);n=-n/g.get(t+1,t);for(let i=t+1;i<r;i++)g.set(i,e,g.get(i,e)+n*g.get(i,t))}for(let e=0;e<r;e++)g.set(e,t,0);g.set(t,t,1)}let x=E-1,C=Number.EPSILON;for(;E>0;){let t,e;for(t=E-2;t>=-1&&-1!==t;t--){const e=Number.MIN_VALUE+C*Math.abs(d[t]+Math.abs(d[t+1]));if(Math.abs(p[t])<=e||Number.isNaN(p[t])){p[t]=0;break}}if(t===E-2)e=4;else{let n;for(n=E-1;n>=t&&n!==t;n--){let e=(n!==E?Math.abs(p[n]):0)+(n!==t+1?Math.abs(p[n-1]):0);if(Math.abs(d[n])<=C*e){d[n]=0;break}}n===t?e=3:n===E-1?e=1:(e=2,t=n)}switch(t++,e){case 1:{let e=p[E-2];p[E-2]=0;for(let n=E-2;n>=t;n--){let i=k(d[n],e),o=d[n]/i,A=e/i;if(d[n]=i,n!==t&&(e=-A*p[n-1],p[n-1]=o*p[n-1]),c)for(let t=0;t<r;t++)i=o*g.get(t,n)+A*g.get(t,E-1),g.set(t,E-1,-A*g.get(t,n)+o*g.get(t,E-1)),g.set(t,n,i)}break}case 2:{let e=p[t-1];p[t-1]=0;for(let r=t;r<E;r++){let i=k(d[r],e),o=d[r]/i,A=e/i;if(d[r]=i,e=-A*p[r],p[r]=o*p[r],a)for(let e=0;e<n;e++)i=o*f.get(e,r)+A*f.get(e,t-1),f.set(e,t-1,-A*f.get(e,r)+o*f.get(e,t-1)),f.set(e,r,i)}break}case 3:{const e=Math.max(Math.abs(d[E-1]),Math.abs(d[E-2]),Math.abs(p[E-2]),Math.abs(d[t]),Math.abs(p[t])),i=d[E-1]/e,o=d[E-2]/e,A=p[E-2]/e,s=d[t]/e,l=p[t]/e,u=((o+i)*(o-i)+A*A)/2,h=i*A*(i*A);let v=0;0===u&&0===h||(v=u<0?0-Math.sqrt(u*u+h):Math.sqrt(u*u+h),v=h/(u+v));let m=(s+i)*(s-i)+v,y=s*l;for(let e=t;e<E-1;e++){let i=k(m,y);0===i&&(i=Number.MIN_VALUE);let o=m/i,A=y/i;if(e!==t&&(p[e-1]=i),m=o*d[e]+A*p[e],p[e]=o*p[e]-A*d[e],y=A*d[e+1],d[e+1]=o*d[e+1],c)for(let t=0;t<r;t++)i=o*g.get(t,e)+A*g.get(t,e+1),g.set(t,e+1,-A*g.get(t,e)+o*g.get(t,e+1)),g.set(t,e,i);if(i=k(m,y),0===i&&(i=Number.MIN_VALUE),o=m/i,A=y/i,d[e]=i,m=o*p[e]+A*d[e+1],d[e+1]=-A*p[e]+o*d[e+1],y=A*p[e+1],p[e+1]=o*p[e+1],a&&e<n-1)for(let t=0;t<n;t++)i=o*f.get(t,e)+A*f.get(t,e+1),f.set(t,e+1,-A*f.get(t,e)+o*f.get(t,e+1)),f.set(t,e,i)}p[E-2]=m;break}case 4:if(d[t]<=0&&(d[t]=d[t]<0?-d[t]:0,c))for(let e=0;e<=x;e++)g.set(e,t,-g.get(e,t));for(;t<x&&!(d[t]>=d[t+1]);){let e=d[t];if(d[t]=d[t+1],d[t+1]=e,c&&t<r-1)for(let n=0;n<r;n++)e=g.get(n,t+1),g.set(n,t+1,g.get(n,t)),g.set(n,t,e);if(a&&t<n-1)for(let r=0;r<n;r++)e=f.get(r,t+1),f.set(r,t+1,f.get(r,t)),f.set(r,t,e);t++}E--}}if(l){let t=g;g=f,f=t}this.m=n,this.n=r,this.s=d,this.U=f,this.V=g}solve(t){let e=t,n=this.threshold,r=this.s.length,i=w.zeros(r,r);for(let t=0;t<r;t++)Math.abs(this.s[t])<=n?i.set(t,t,0):i.set(t,t,1/this.s[t]);let o=this.U,A=this.rightSingularVectors,s=A.mmul(i),a=A.rows,c=o.rows,l=w.zeros(a,c);for(let t=0;t<a;t++)for(let e=0;e<c;e++){let n=0;for(let i=0;i<r;i++)n+=s.get(t,i)*o.get(e,i);l.set(t,e,n)}return l.mmul(e)}solveForDiagonal(t){return this.solve(w.diag(t))}inverse(){let t=this.V,e=this.threshold,n=t.rows,r=t.columns,i=new w(n,this.s.length);for(let o=0;o<n;o++)for(let n=0;n<r;n++)Math.abs(this.s[n])>e&&i.set(o,n,t.get(o,n)/this.s[n]);let o=this.U,A=o.rows,s=o.columns,a=new w(n,A);for(let t=0;t<n;t++)for(let e=0;e<A;e++){let n=0;for(let r=0;r<s;r++)n+=i.get(t,r)*o.get(e,r);a.set(t,e,n)}return a}get condition(){return this.s[0]/this.s[Math.min(this.m,this.n)-1]}get norm2(){return this.s[0]}get rank(){let t=Math.max(this.m,this.n)*this.s[0]*Number.EPSILON,e=0,n=this.s;for(let r=0,i=n.length;r<i;r++)n[r]>t&&e++;return e}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return w.diag(this.s)}}function U(t,e,n=!1){return t=M.checkMatrix(t),e=M.checkMatrix(e),n?new Q(t).solve(e):t.isSquare()?new F(t).solve(e):new S(t).solve(e)}function N(t,e){let n=[];for(let r=0;r<t;r++)r!==e&&n.push(r);return n}function T(t,e,n,r=1e-9,i=1e-9){if(t>i)return new Array(e.rows+1).fill(0);{let t=e.addRow(n,[0]);for(let e=0;e<t.rows;e++)Math.abs(t.get(e,0))<r&&t.set(e,0,0);return t.to1DArray()}}class O{constructor(t,e={}){const{assumeSymmetric:n=!1}=e;if(!(t=M.checkMatrix(t)).isSquare())throw new Error("Matrix is not a square matrix");if(t.isEmpty())throw new Error("Matrix must be non-empty");let r,i,o=t.columns,A=new w(o,o),s=new Float64Array(o),a=new Float64Array(o),c=t,l=!1;if(l=!!n||t.isSymmetric(),l){for(r=0;r<o;r++)for(i=0;i<o;i++)A.set(r,i,c.get(r,i));!function(t,e,n,r){let i,o,A,s,a,c,l,u;for(a=0;a<t;a++)n[a]=r.get(t-1,a);for(s=t-1;s>0;s--){for(u=0,A=0,c=0;c<s;c++)u+=Math.abs(n[c]);if(0===u)for(e[s]=n[s-1],a=0;a<s;a++)n[a]=r.get(s-1,a),r.set(s,a,0),r.set(a,s,0);else{for(c=0;c<s;c++)n[c]/=u,A+=n[c]*n[c];for(i=n[s-1],o=Math.sqrt(A),i>0&&(o=-o),e[s]=u*o,A-=i*o,n[s-1]=i-o,a=0;a<s;a++)e[a]=0;for(a=0;a<s;a++){for(i=n[a],r.set(a,s,i),o=e[a]+r.get(a,a)*i,c=a+1;c<=s-1;c++)o+=r.get(c,a)*n[c],e[c]+=r.get(c,a)*i;e[a]=o}for(i=0,a=0;a<s;a++)e[a]/=A,i+=e[a]*n[a];for(l=i/(A+A),a=0;a<s;a++)e[a]-=l*n[a];for(a=0;a<s;a++){for(i=n[a],o=e[a],c=a;c<=s-1;c++)r.set(c,a,r.get(c,a)-(i*e[c]+o*n[c]));n[a]=r.get(s-1,a),r.set(s,a,0)}}n[s]=A}for(s=0;s<t-1;s++){if(r.set(t-1,s,r.get(s,s)),r.set(s,s,1),A=n[s+1],0!==A){for(c=0;c<=s;c++)n[c]=r.get(c,s+1)/A;for(a=0;a<=s;a++){for(o=0,c=0;c<=s;c++)o+=r.get(c,s+1)*r.get(c,a);for(c=0;c<=s;c++)r.set(c,a,r.get(c,a)-o*n[c])}}for(c=0;c<=s;c++)r.set(c,s+1,0)}for(a=0;a<t;a++)n[a]=r.get(t-1,a),r.set(t-1,a,0);r.set(t-1,t-1,1),e[0]=0}(o,a,s,A),function(t,e,n,r){let i,o,A,s,a,c,l,u,h,d,f,g,p,v,m,y;for(A=1;A<t;A++)e[A-1]=e[A];e[t-1]=0;let w=0,b=0,B=Number.EPSILON;for(c=0;c<t;c++){for(b=Math.max(b,Math.abs(n[c])+Math.abs(e[c])),l=c;l<t&&!(Math.abs(e[l])<=B*b);)l++;if(l>c)do{for(i=n[c],u=(n[c+1]-i)/(2*e[c]),h=k(u,1),u<0&&(h=-h),n[c]=e[c]/(u+h),n[c+1]=e[c]*(u+h),d=n[c+1],o=i-n[c],A=c+2;A<t;A++)n[A]-=o;for(w+=o,u=n[l],f=1,g=f,p=f,v=e[c+1],m=0,y=0,A=l-1;A>=c;A--)for(p=g,g=f,y=m,i=f*e[A],o=f*u,h=k(u,e[A]),e[A+1]=m*h,m=e[A]/h,f=u/h,u=f*n[A]-m*i,n[A+1]=o+m*(f*i+m*n[A]),a=0;a<t;a++)o=r.get(a,A+1),r.set(a,A+1,m*r.get(a,A)+f*o),r.set(a,A,f*r.get(a,A)-m*o);u=-m*y*p*v*e[c]/d,e[c]=m*u,n[c]=f*u}while(Math.abs(e[c])>B*b);n[c]=n[c]+w,e[c]=0}for(A=0;A<t-1;A++){for(a=A,u=n[A],s=A+1;s<t;s++)n[s]<u&&(a=s,u=n[s]);if(a!==A)for(n[a]=n[A],n[A]=u,s=0;s<t;s++)u=r.get(s,A),r.set(s,A,r.get(s,a)),r.set(s,a,u)}}(o,a,s,A)}else{let t=new w(o,o),e=new Float64Array(o);for(i=0;i<o;i++)for(r=0;r<o;r++)t.set(r,i,c.get(r,i));!function(t,e,n,r){let i,o,A,s,a,c,l,u=0,h=t-1;for(c=u+1;c<=h-1;c++){for(l=0,s=c;s<=h;s++)l+=Math.abs(e.get(s,c-1));if(0!==l){for(A=0,s=h;s>=c;s--)n[s]=e.get(s,c-1)/l,A+=n[s]*n[s];for(o=Math.sqrt(A),n[c]>0&&(o=-o),A-=n[c]*o,n[c]=n[c]-o,a=c;a<t;a++){for(i=0,s=h;s>=c;s--)i+=n[s]*e.get(s,a);for(i/=A,s=c;s<=h;s++)e.set(s,a,e.get(s,a)-i*n[s])}for(s=0;s<=h;s++){for(i=0,a=h;a>=c;a--)i+=n[a]*e.get(s,a);for(i/=A,a=c;a<=h;a++)e.set(s,a,e.get(s,a)-i*n[a])}n[c]=l*n[c],e.set(c,c-1,l*o)}}for(s=0;s<t;s++)for(a=0;a<t;a++)r.set(s,a,s===a?1:0);for(c=h-1;c>=u+1;c--)if(0!==e.get(c,c-1)){for(s=c+1;s<=h;s++)n[s]=e.get(s,c-1);for(a=c;a<=h;a++){for(o=0,s=c;s<=h;s++)o+=n[s]*r.get(s,a);for(o=o/n[c]/e.get(c,c-1),s=c;s<=h;s++)r.set(s,a,r.get(s,a)+o*n[s])}}}(o,t,e,A),function(t,e,n,r,i){let o,A,s,a,c,l,u,h,d,f,g,p,v,m,y,w=t-1,b=0,B=t-1,E=Number.EPSILON,x=0,C=0,M=0,F=0,k=0,S=0,Q=0,U=0;for(o=0;o<t;o++)for((o<b||o>B)&&(n[o]=i.get(o,o),e[o]=0),A=Math.max(o-1,0);A<t;A++)C+=Math.abs(i.get(o,A));for(;w>=b;){for(a=w;a>b&&(S=Math.abs(i.get(a-1,a-1))+Math.abs(i.get(a,a)),0===S&&(S=C),!(Math.abs(i.get(a,a-1))<E*S));)a--;if(a===w)i.set(w,w,i.get(w,w)+x),n[w]=i.get(w,w),e[w]=0,w--,U=0;else if(a===w-1){if(u=i.get(w,w-1)*i.get(w-1,w),M=(i.get(w-1,w-1)-i.get(w,w))/2,F=M*M+u,Q=Math.sqrt(Math.abs(F)),i.set(w,w,i.get(w,w)+x),i.set(w-1,w-1,i.get(w-1,w-1)+x),h=i.get(w,w),F>=0){for(Q=M>=0?M+Q:M-Q,n[w-1]=h+Q,n[w]=n[w-1],0!==Q&&(n[w]=h-u/Q),e[w-1]=0,e[w]=0,h=i.get(w,w-1),S=Math.abs(h)+Math.abs(Q),M=h/S,F=Q/S,k=Math.sqrt(M*M+F*F),M/=k,F/=k,A=w-1;A<t;A++)Q=i.get(w-1,A),i.set(w-1,A,F*Q+M*i.get(w,A)),i.set(w,A,F*i.get(w,A)-M*Q);for(o=0;o<=w;o++)Q=i.get(o,w-1),i.set(o,w-1,F*Q+M*i.get(o,w)),i.set(o,w,F*i.get(o,w)-M*Q);for(o=b;o<=B;o++)Q=r.get(o,w-1),r.set(o,w-1,F*Q+M*r.get(o,w)),r.set(o,w,F*r.get(o,w)-M*Q)}else n[w-1]=h+M,n[w]=h+M,e[w-1]=Q,e[w]=-Q;w-=2,U=0}else{if(h=i.get(w,w),d=0,u=0,a<w&&(d=i.get(w-1,w-1),u=i.get(w,w-1)*i.get(w-1,w)),10===U){for(x+=h,o=b;o<=w;o++)i.set(o,o,i.get(o,o)-h);S=Math.abs(i.get(w,w-1))+Math.abs(i.get(w-1,w-2)),h=d=.75*S,u=-.4375*S*S}if(30===U&&(S=(d-h)/2,S=S*S+u,S>0)){for(S=Math.sqrt(S),d<h&&(S=-S),S=h-u/((d-h)/2+S),o=b;o<=w;o++)i.set(o,o,i.get(o,o)-S);x+=S,h=d=u=.964}for(U+=1,c=w-2;c>=a&&(Q=i.get(c,c),k=h-Q,S=d-Q,M=(k*S-u)/i.get(c+1,c)+i.get(c,c+1),F=i.get(c+1,c+1)-Q-k-S,k=i.get(c+2,c+1),S=Math.abs(M)+Math.abs(F)+Math.abs(k),M/=S,F/=S,k/=S,c!==a)&&!(Math.abs(i.get(c,c-1))*(Math.abs(F)+Math.abs(k))<E*(Math.abs(M)*(Math.abs(i.get(c-1,c-1))+Math.abs(Q)+Math.abs(i.get(c+1,c+1)))));)c--;for(o=c+2;o<=w;o++)i.set(o,o-2,0),o>c+2&&i.set(o,o-3,0);for(s=c;s<=w-1&&(m=s!==w-1,s!==c&&(M=i.get(s,s-1),F=i.get(s+1,s-1),k=m?i.get(s+2,s-1):0,h=Math.abs(M)+Math.abs(F)+Math.abs(k),0!==h&&(M/=h,F/=h,k/=h)),0!==h);s++)if(S=Math.sqrt(M*M+F*F+k*k),M<0&&(S=-S),0!==S){for(s!==c?i.set(s,s-1,-S*h):a!==c&&i.set(s,s-1,-i.get(s,s-1)),M+=S,h=M/S,d=F/S,Q=k/S,F/=M,k/=M,A=s;A<t;A++)M=i.get(s,A)+F*i.get(s+1,A),m&&(M+=k*i.get(s+2,A),i.set(s+2,A,i.get(s+2,A)-M*Q)),i.set(s,A,i.get(s,A)-M*h),i.set(s+1,A,i.get(s+1,A)-M*d);for(o=0;o<=Math.min(w,s+3);o++)M=h*i.get(o,s)+d*i.get(o,s+1),m&&(M+=Q*i.get(o,s+2),i.set(o,s+2,i.get(o,s+2)-M*k)),i.set(o,s,i.get(o,s)-M),i.set(o,s+1,i.get(o,s+1)-M*F);for(o=b;o<=B;o++)M=h*r.get(o,s)+d*r.get(o,s+1),m&&(M+=Q*r.get(o,s+2),r.set(o,s+2,r.get(o,s+2)-M*k)),r.set(o,s,r.get(o,s)-M),r.set(o,s+1,r.get(o,s+1)-M*F)}}}if(0===C)return;for(w=t-1;w>=0;w--)if(M=n[w],F=e[w],0===F)for(a=w,i.set(w,w,1),o=w-1;o>=0;o--){for(u=i.get(o,o)-M,k=0,A=a;A<=w;A++)k+=i.get(o,A)*i.get(A,w);if(e[o]<0)Q=u,S=k;else if(a=o,0===e[o]?i.set(o,w,0!==u?-k/u:-k/(E*C)):(h=i.get(o,o+1),d=i.get(o+1,o),F=(n[o]-M)*(n[o]-M)+e[o]*e[o],l=(h*S-Q*k)/F,i.set(o,w,l),i.set(o+1,w,Math.abs(h)>Math.abs(Q)?(-k-u*l)/h:(-S-d*l)/Q)),l=Math.abs(i.get(o,w)),E*l*l>1)for(A=o;A<=w;A++)i.set(A,w,i.get(A,w)/l)}else if(F<0)for(a=w-1,Math.abs(i.get(w,w-1))>Math.abs(i.get(w-1,w))?(i.set(w-1,w-1,F/i.get(w,w-1)),i.set(w-1,w,-(i.get(w,w)-M)/i.get(w,w-1))):(y=I(0,-i.get(w-1,w),i.get(w-1,w-1)-M,F),i.set(w-1,w-1,y[0]),i.set(w-1,w,y[1])),i.set(w,w-1,0),i.set(w,w,1),o=w-2;o>=0;o--){for(f=0,g=0,A=a;A<=w;A++)f+=i.get(o,A)*i.get(A,w-1),g+=i.get(o,A)*i.get(A,w);if(u=i.get(o,o)-M,e[o]<0)Q=u,k=f,S=g;else if(a=o,0===e[o]?(y=I(-f,-g,u,F),i.set(o,w-1,y[0]),i.set(o,w,y[1])):(h=i.get(o,o+1),d=i.get(o+1,o),p=(n[o]-M)*(n[o]-M)+e[o]*e[o]-F*F,v=2*(n[o]-M)*F,0===p&&0===v&&(p=E*C*(Math.abs(u)+Math.abs(F)+Math.abs(h)+Math.abs(d)+Math.abs(Q))),y=I(h*k-Q*f+F*g,h*S-Q*g-F*f,p,v),i.set(o,w-1,y[0]),i.set(o,w,y[1]),Math.abs(h)>Math.abs(Q)+Math.abs(F)?(i.set(o+1,w-1,(-f-u*i.get(o,w-1)+F*i.get(o,w))/h),i.set(o+1,w,(-g-u*i.get(o,w)-F*i.get(o,w-1))/h)):(y=I(-k-d*i.get(o,w-1),-S-d*i.get(o,w),Q,F),i.set(o+1,w-1,y[0]),i.set(o+1,w,y[1]))),l=Math.max(Math.abs(i.get(o,w-1)),Math.abs(i.get(o,w))),E*l*l>1)for(A=o;A<=w;A++)i.set(A,w-1,i.get(A,w-1)/l),i.set(A,w,i.get(A,w)/l)}for(o=0;o<t;o++)if(o<b||o>B)for(A=o;A<t;A++)r.set(o,A,i.get(o,A));for(A=t-1;A>=b;A--)for(o=b;o<=B;o++){for(Q=0,s=b;s<=Math.min(A,B);s++)Q+=r.get(o,s)*i.get(s,A);r.set(o,A,Q)}}(o,a,s,A,t)}this.n=o,this.e=a,this.d=s,this.V=A}get realEigenvalues(){return Array.from(this.d)}get imaginaryEigenvalues(){return Array.from(this.e)}get eigenvectorMatrix(){return this.V}get diagonalMatrix(){let t,e,n=this.n,r=this.e,i=this.d,o=new w(n,n);for(t=0;t<n;t++){for(e=0;e<n;e++)o.set(t,e,0);o.set(t,t,i[t]),r[t]>0?o.set(t,t+1,r[t]):r[t]<0&&o.set(t,t-1,r[t])}return o}}function I(t,e,n,r){let i,o;return Math.abs(n)>Math.abs(r)?(i=r/n,o=n+i*r,[(t+i*e)/o,(e-i*t)/o]):(i=n/r,o=r+i*n,[(i*t+e)/o,(i*e-t)/o])}class L{constructor(t){if(!(t=M.checkMatrix(t)).isSymmetric())throw new Error("Matrix is not symmetric");let e,n,r,i=t,o=i.rows,A=new w(o,o),s=!0;for(n=0;n<o;n++){let t=0;for(r=0;r<n;r++){let o=0;for(e=0;e<r;e++)o+=A.get(r,e)*A.get(n,e);o=(i.get(n,r)-o)/A.get(r,r),A.set(n,r,o),t+=o*o}for(t=i.get(n,n)-t,s&&=t>0,A.set(n,n,Math.sqrt(Math.max(t,0))),r=n+1;r<o;r++)A.set(n,r,0)}this.L=A,this.positiveDefinite=s}isPositiveDefinite(){return this.positiveDefinite}solve(t){t=M.checkMatrix(t);let e=this.L,n=e.rows;if(t.rows!==n)throw new Error("Matrix dimensions do not match");if(!1===this.isPositiveDefinite())throw new Error("Matrix is not positive definite");let r,i,o,A=t.columns,s=t.clone();for(o=0;o<n;o++)for(i=0;i<A;i++){for(r=0;r<o;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(o,r));s.set(o,i,s.get(o,i)/e.get(o,o))}for(o=n-1;o>=0;o--)for(i=0;i<A;i++){for(r=o+1;r<n;r++)s.set(o,i,s.get(o,i)-s.get(r,i)*e.get(r,o));s.set(o,i,s.get(o,i)/e.get(o,o))}return s}get lowerTriangularMatrix(){return this.L}}class P{constructor(e,n={}){e=M.checkMatrix(e);let{Y:r}=n;const{scaleScores:i=!1,maxIterations:o=1e3,terminationCriteria:A=1e-10}=n;let s;if(r){if(r=t.isAnyArray(r)&&"number"==typeof r[0]?w.columnVector(r):M.checkMatrix(r),r.rows!==e.rows)throw new Error("Y should have the same number of rows as X");s=r.getColumnVector(0)}else s=e.getColumnVector(0);let a,c,l,u,h=1;for(let t=0;t<o&&h>A;t++)l=e.transpose().mmul(s).div(s.transpose().mmul(s).get(0,0)),l=l.div(l.norm()),a=e.mmul(l).div(l.transpose().mmul(l).get(0,0)),t>0&&(h=a.clone().sub(u).pow(2).sum()),u=a.clone(),r?(c=r.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),c=c.div(c.norm()),s=r.mmul(c).div(c.transpose().mmul(c).get(0,0))):s=a;if(r){let t=e.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0));t=t.div(t.norm());let n=e.clone().sub(a.clone().mmul(t.transpose())),i=s.transpose().mmul(a).div(a.transpose().mmul(a).get(0,0)),o=r.clone().sub(a.clone().mulS(i.get(0,0)).mmul(c.transpose()));this.t=a,this.p=t.transpose(),this.w=l.transpose(),this.q=c,this.u=s,this.s=a.transpose().mmul(a),this.xResidual=n,this.yResidual=o,this.betas=i}else this.w=l.transpose(),this.s=a.transpose().mmul(a).sqrt(),this.t=i?a.clone().div(this.s.get(0,0)):a,this.xResidual=e.sub(a.mmul(l.transpose()))}}return fj.AbstractMatrix=v,fj.CHO=L,fj.CholeskyDecomposition=L,fj.DistanceMatrix=B,fj.EVD=O,fj.EigenvalueDecomposition=O,fj.LU=F,fj.LuDecomposition=F,fj.Matrix=w,fj.MatrixColumnSelectionView=class extends E{constructor(t,e){h(t,e),super(t,t.rows,e.length),this.columnIndices=e}set(t,e,n){return this.matrix.set(t,this.columnIndices[e],n),this}get(t,e){return this.matrix.get(t,this.columnIndices[e])}},fj.MatrixColumnView=class extends E{constructor(t,e){a(t,e),super(t,t.rows,1),this.column=e}set(t,e,n){return this.matrix.set(t,this.column,n),this}get(t){return this.matrix.get(t,this.column)}},fj.MatrixFlipColumnView=class extends E{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(t,this.columns-e-1,n),this}get(t,e){return this.matrix.get(t,this.columns-e-1)}},fj.MatrixFlipRowView=class extends E{constructor(t){super(t,t.rows,t.columns)}set(t,e,n){return this.matrix.set(this.rows-t-1,e,n),this}get(t,e){return this.matrix.get(this.rows-t-1,e)}},fj.MatrixRowSelectionView=class extends E{constructor(t,e){u(t,e),super(t,e.length,t.columns),this.rowIndices=e}set(t,e,n){return this.matrix.set(this.rowIndices[t],e,n),this}get(t,e){return this.matrix.get(this.rowIndices[t],e)}},fj.MatrixRowView=class extends E{constructor(t,e){s(t,e),super(t,1,t.columns),this.row=e}set(t,e,n){return this.matrix.set(this.row,e,n),this}get(t,e){return this.matrix.get(this.row,e)}},fj.MatrixSelectionView=x,fj.MatrixSubView=class extends E{constructor(t,e,n,r,i){d(t,e,n,r,i),super(t,n-e+1,i-r+1),this.startRow=e,this.startColumn=r}set(t,e,n){return this.matrix.set(this.startRow+t,this.startColumn+e,n),this}get(t,e){return this.matrix.get(this.startRow+t,this.startColumn+e)}},fj.MatrixTransposeView=class extends E{constructor(t){super(t,t.columns,t.rows)}set(t,e,n){return this.matrix.set(e,t,n),this}get(t,e){return this.matrix.get(e,t)}},fj.NIPALS=P,fj.Nipals=P,fj.QR=S,fj.QrDecomposition=S,fj.SVD=Q,fj.SingularValueDecomposition=Q,fj.SymmetricMatrix=b,fj.WrapperMatrix1D=C,fj.WrapperMatrix2D=M,fj.correlation=function(e,n=e,r={}){e=new w(e);let i=!1;if("object"!=typeof n||w.isMatrix(n)||t.isAnyArray(n)?n=new w(n):(r=n,n=e,i=!0),e.rows!==n.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:o=!0,scale:A=!0}=r;o&&(e.center("column"),i||n.center("column")),A&&(e.scale("column"),i||n.scale("column"));const s=e.standardDeviation("column",{unbiased:!0}),a=i?s:n.standardDeviation("column",{unbiased:!0}),c=e.transpose().mmul(n);for(let t=0;t<c.rows;t++)for(let n=0;n<c.columns;n++)c.set(t,n,c.get(t,n)*(1/(s[t]*a[n]))*(1/(e.rows-1)));return c},fj.covariance=function(e,n=e,r={}){e=new w(e);let i=!1;if("object"!=typeof n||w.isMatrix(n)||t.isAnyArray(n)?n=new w(n):(r=n,n=e,i=!0),e.rows!==n.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:o=!0}=r;o&&(e=e.center("column"),i||(n=n.center("column")));const A=e.transpose().mmul(n);for(let t=0;t<A.rows;t++)for(let n=0;n<A.columns;n++)A.set(t,n,A.get(t,n)*(1/(e.rows-1)));return A},fj.default=w,fj.determinant=function t(e){if((e=w.checkMatrix(e)).isSquare()){if(0===e.columns)return 1;let n,r,i,o;if(2===e.columns)return n=e.get(0,0),r=e.get(0,1),i=e.get(1,0),o=e.get(1,1),n*o-r*i;if(3===e.columns){let o,A,s;return o=new x(e,[1,2],[1,2]),A=new x(e,[1,2],[0,2]),s=new x(e,[1,2],[0,1]),n=e.get(0,0),r=e.get(0,1),i=e.get(0,2),n*t(o)-r*t(A)+i*t(s)}return new F(e).determinant}throw Error("determinant can only be calculated for a square matrix")},fj.inverse=function(t,e=!1){return t=M.checkMatrix(t),e?new Q(t).inverse():U(t,w.eye(t.rows))},fj.linearDependencies=function(t,e={}){const{thresholdValue:n=1e-9,thresholdError:r=1e-9}=e;let i=(t=w.checkMatrix(t)).rows,o=new w(i,i);for(let e=0;e<i;e++){let A=w.columnVector(t.getRow(e)),s=t.subMatrixRow(N(i,e)).transpose(),a=new Q(s).solve(A),c=w.sub(A,s.mmul(a)).abs().max();o.setRow(e,T(c,a,e,n,r))}return o},fj.pseudoInverse=function(t,e=Number.EPSILON){if((t=w.checkMatrix(t)).isEmpty())return t.transpose();let n=new Q(t,{autoTranspose:!0}),r=n.leftSingularVectors,i=n.rightSingularVectors,o=n.diagonal;for(let t=0;t<o.length;t++)Math.abs(o[t])>e?o[t]=1/o[t]:o[t]=0;return i.mmul(w.diag(o).mmul(r.transpose()))},fj.solve=U,fj.wrap=function(e,n){if(t.isAnyArray(e))return e[0]&&t.isAnyArray(e[0])?new M(e):new C(e,n);throw new Error("the argument is not an array")},fj}var Bj=bj(),Ej=BU(Bj);const xj=Bj.Matrix,Cj=Bj.SingularValueDecomposition;Ej.Matrix?Ej.Matrix:Bj.Matrix;const Mj=(t,e)=>{const n=t.nodeCount(),r=Array.from({length:n},()=>[]),i={};let o=0;return t.forEachNode(t=>{i[t.id]=o++}),t.forEachEdge(t=>{const e=i[t.source],n=i[t.target];null!=e&&null!=n&&(r[e].push(n),r[n].push(e))}),r};function Fj(t){const e=t.length;new Array(e).fill(0);const n=Array.from({length:e},()=>new Array(e).fill(1/0));for(let r=0;r<e;r++)n[r]=kj(t,r);return n}function kj(t,e){const n=t.length,r=new Array(n).fill(1/0);r[e]=0;const i=new Sj;for(i.push([0,e]);!i.empty();){const[e,n]=i.pop();if(e!==r[n])continue;const o=t[n];for(let t=0;t<o.length;t++){const n=o[t],A=e+1;A<r[n]&&(r[n]=A,i.push([A,n]))}}return r}class Sj{constructor(){this.data=[]}push(t){this.data.push(t),this.bubbleUp(this.data.length-1)}pop(){const t=this.data[0],e=this.data.pop();return this.data.length>0&&(this.data[0]=e,this.bubbleDown(0)),t}empty(){return 0===this.data.length}bubbleUp(t){const e=this.data;for(;t>0;){const n=t-1>>1;if(e[n][0]<=e[t][0])break;[e[n],e[t]]=[e[t],e[n]],t=n}}bubbleDown(t){const e=this.data,n=e.length;for(;;){const r=2*t+1,i=2*t+2;let o=t;if(r<n&&e[r][0]<e[o][0]&&(o=r),i<n&&e[i][0]<e[o][0]&&(o=i),o===t)break;[e[t],e[o]]=[e[o],e[t]],t=o}}}const Qj={center:[0,0],linkDistance:50};class Uj extends EC{constructor(){super(...arguments),this.id="mds"}getDefaultOptions(){return Qj}layout(){return mx(this,0,void 0,function*(){const{linkDistance:t=Qj.linkDistance}=this.options,{center:e}=kF(this.options),n=this.model.nodeCount();if(0===n||1===n)return void EF(this.model,e);const r=Fj(Mj(this.model));Nj(r);const i=((t,e)=>{const n=t.length,r=new Array(n);for(let i=0;i<n;i++){const n=t[i],o=n.length,A=new Array(o);for(let t=0;t<o;t++)A[t]=n[t]*e;r[i]=A}return r})(r,t),o=Tj(i);let A=0;this.model.forEachNode(t=>{const n=o[A++];t.x=n[0]+e[0],t.y=n[1]+e[1]})})}}const Nj=t=>{let e=Number.NEGATIVE_INFINITY;const n=[],r=t.length;for(let i=0;i<r;i++){const r=t[i],o=r.length;for(let t=0;t<o;t++){const o=r[t];o===1/0?n.push([i,t]):e<o&&(e=o)}}for(let r=0;r<n.length;r++){const[i,o]=n[r];t[i][o]=e}},Tj=(t,e=2,n=Qj.linkDistance)=>{try{const n=t.length,r=new xj(n,n);for(let e=0;e<n;e++)for(let i=0;i<n;i++){const n=t[e][i];r.set(e,i,-.5*n*n)}const i=r.mean("row"),o=r.mean("column"),A=r.mean();r.add(A).subRowVector(i).subColumnVector(o);const s=new Cj(r),a=xj.sqrt(s.diagonalMatrix).diagonal(),c=s.leftSingularVectors,l=a,u=[];for(let t=0;t<c.rows;t++){const n=[];for(let r=0;r<e;r++)n.push(c.get(t,r)*l[r]);u.push(n)}return u}catch(e){const r=[];for(let e=0;e<t.length;e++){const t=Math.random()*n,e=Math.random()*n;r.push([t,e])}return r}},Oj={maxIteration:10,width:10,speed:100,gravity:10,k:5},Ij=(t,e,n,r,i)=>{let o=0;t.forEachNode(A=>{let s=0;t.forEachNode(t=>{if(s<=o)return void s++;if(A.id===t.id)return;if(r.get(A.id)!==r.get(t.id))return;let a=A.x-t.x,c=A.y-t.y,l=Math.sqrt(a*a+c*c);if(0===l){l=1;const t=o>s?1:-1;a=.01*t,c=.01*t}const u=Math.max(...i(A._original));if(l<Math.max(...i(t._original))/2+u/2){const r=n*n/l,i=e.get(A.id),o=e.get(t.id),s=a/l*r,u=c/l*r;e.set(A.id,{x:i.x+s,y:i.y+u}),e.set(t.id,{x:o.x-s,y:o.y-u})}s++}),o++})},Lj=(t,e,n,r,i,o,A)=>{r&&t.forEachNode(t=>{const n=t.x-i.x,r=t.y-i.y,o=Math.sqrt(n*n+r*r);let A=r/o,s=-n/o;const a=e.get(t.id),c=Math.sqrt(a.x*a.x+a.y*a.y);let l=Math.acos((A*a.x+s*a.y)/c);l>Math.PI/2&&(l-=Math.PI/2,A*=-1,s*=-1);const u=Math.cos(l)*c;e.set(t.id,{x:A*u,y:s*u})});let s=0,a=0;return t.forEachNode(t=>{if(t.id===i.id)return;const c=e.get(t.id),l=Math.sqrt(c.x*c.x+c.y*c.y);if(l>0){const e=Math.min(o*(n/800),l);if(t.x+=c.x/l*e,t.y+=c.y/l*e,r){let e=t.x-i.x,n=t.y-i.y;const r=Math.sqrt(e*e+n*n);e=e/r*A.get(t.id),n=n/r*A.get(t.id),t.x=i.x+e,t.y=i.y+n}s+=e,a++}}),a>0?s/a:0},Pj={focusNode:null,linkDistance:50,maxIteration:1e3,maxPreventOverlapIteration:200,preventOverlap:!1,sortStrength:10,strictRadial:!0,unitRadius:null,nodeSize:10,nodeSpacing:0};class Dj extends EC{constructor(){super(...arguments),this.id="radial"}getDefaultOptions(){return Pj}layout(){return mx(this,0,void 0,function*(){const{width:t,height:e,center:n}=kF(this.options),r=this.model.nodeCount();if(!r||1===r)return EF(this.model,n);const{focusNode:i,linkDistance:o=Pj.linkDistance,maxIteration:A=Pj.maxIteration,maxPreventOverlapIteration:s=Pj.maxPreventOverlapIteration,nodeSize:a,nodeSpacing:c,preventOverlap:l,sortBy:u,sortStrength:h=Pj.sortStrength,strictRadial:d,unitRadius:f}=this.options,g=i&&this.model.node(i)||this.model.firstNode(),p=this.model.nodeIndexOf(g.id),v=Fj(Mj(this.model)),m=Gj(v,p);_j(v,p,m+1);const y=v[p],w=(t-n[0]>n[0]?n[0]:t-n[0])||t/2,b=(e-n[1]>n[1]?n[1]:e-n[1])||e/2,B=Math.min(w,b),E=Math.max(...y),x=[],C=new Map,M=null!=f?f:B/E;y.forEach((t,e)=>{const n=t*M;x.push(n),C.set(this.model.nodeAt(e).id,n)});const F=Rj(this.model,v,o,x,M,u,h),k=Tj(F,2,o),S=k[p];let Q=0;if(this.model.forEachNode(t=>{const e=k[Q];t.x=e[0]-S[0],t.y=e[1]-S[1],Q++}),this.run(A,F,x,p),this.model.forEachNode(t=>{t.x+=n[0],t.y+=n[1]}),l){const e={nodeSizeFunc:Xx(a,c,Pj.nodeSize,Pj.nodeSpacing),radiiMap:C,width:t,strictRadial:Boolean(d),focusNode:g,maxIteration:s,k:r/4.5};((t,e)=>{const n=Object.assign(Object.assign({},Oj),e),{maxIteration:r,width:i,k:o,speed:A=Oj.speed,strictRadial:s,focusNode:a,radiiMap:c,nodeSizeFunc:l}=n,u=.002*o,h=new Map,d=i/10;for(let e=0;e<r&&(t.forEachNode(t=>{h.set(t.id,{x:0,y:0})}),Ij(t,h,o,c,l),!(Lj(t,h,A,s,a,d,c)<u));e++);})(this.model,e)}})}run(t,e,n,r){const i=Hj(e),o=this.model.nodeCount(),A=this.model.nodes(),s=new Float64Array(o),a=new Float64Array(o);for(let t=0;t<o;t++)s[t]=A[t].x,a[t]=A[t].y;for(let c=0;c<=t;c++){const l=c/t,u=1-l;for(let t=0;t<o;t++){if(t===r)continue;const c=s[t],h=a[t],d=Math.sqrt(c*c+h*h),f=0===d?0:1/d;let g=0,p=0,v=0;for(let n=0;n<o;n++){if(t===n)continue;const r=s[n],o=a[n],A=Math.sqrt((c-r)*(c-r)+(h-o)*(h-o)),l=0===A?0:1/A,u=e[n][t];v+=i[t][n],g+=i[t][n]*(r+u*(c-r)*l),p+=i[t][n]*(o+u*(h-o)*l)}const m=0===n[t]?0:1/n[t];v*=u,v+=l*m*m,g*=u,g+=l*m*c*f,p*=u,p+=l*m*h*f,s[t]=g/v,a[t]=p/v,A[t].x=s[t],A[t].y=a[t]}}}}const Rj=(t,e,n,r,i,o,A)=>{const s=e.length,a=new Array(s),c=new Array(s);for(let t=0;t<s;t++)c[t]=r[t]/i;const l=(n+i)/2,u=new Map,h=o&&"data"!==o?Vx(o,["node"]):null,d="data"===o;for(let i=0;i<s;i++){const o=e[i],f=new Array(s);a[i]=f;const g=c[i]||1;for(let e=0;e<s;e++){if(i===e){f[e]=0;continue}const s=o[e];if(r[i]===r[e])if(d)f[e]=s*Math.abs(i-e)*A/g;else if(h){const n=t.nodeAt(i),r=t.nodeAt(e);let o=u.get(n.id);if(void 0===o){const t=h(n._original)||0;o="string"==typeof t?t.charCodeAt(0):Number(t||0),u.set(n.id,o)}let a=u.get(r.id);if(void 0===a){const t=h(r._original)||0;a="string"==typeof t?t.charCodeAt(0):Number(t||0),u.set(r.id,a)}f[e]=s*Math.abs(o-a)*A/g}else f[e]=s*n/g;else f[e]=s*l}}return a},Hj=t=>{const e=t.length,n=t[0].length,r=[];for(let i=0;i<e;i++){const e=[];for(let r=0;r<n;r++)0!==t[i][r]?e.push(1/(t[i][r]*t[i][r])):e.push(0);r.push(e)}return r},_j=(t,e,n)=>{const r=t.length;for(let i=0;i<r;i++)if(t[e][i]===1/0){t[e][i]=n,t[i][e]=n;for(let o=0;o<r;o++)t[i][o]!==1/0&&t[e][o]===1/0&&(t[e][o]=n+t[i][o],t[o][e]=n+t[i][o])}for(let n=0;n<r;n++)if(n!==e)for(let i=0;i<r;i++)if(t[n][i]===1/0){let r=Math.abs(t[e][n]-t[e][i]);r=0===r?1:r,t[n][i]=r}},Gj=(t,e)=>{const n=t[e];let r=0;for(let t=0;t<n.length;t++)n[t]!==1/0&&(r=Math.max(r,n[t]));return r};class Kj extends EC{constructor(){super(...arguments),this.id="random"}getDefaultOptions(){return{center:[0,0],width:300,height:300}}layout(){return mx(this,0,void 0,function*(){const{width:t,height:e,center:n}=kF(this.options);this.model.forEachNode(r=>{r.x=jj(t)+n[0],r.y=jj(e)+n[1]})})}}const jj=t=>.9*(Math.random()-.5)*t,zj={"antv-dagre":bF,"d3-force-3d":class extends Ok{constructor(){super(...arguments),this.id="d3-force-3d",this.config={simulationAttrs:["alpha","alphaMin","alphaDecay","alphaTarget","velocityDecay","randomSource","numDimensions"]},this.forceMap={link:wS,manyBody:vS,center:cS,collide:aS,radial:Hk,x:Rk,y:Dk,z:Pk}}getDefaultOptions(){return{numDimensions:3,link:{id:t=>t.id},manyBody:{},center:{x:0,y:0,z:0}}}initSimulation(){return pS()}setupForces(t,e){Object.entries(this.forceMap).forEach(([n,r])=>{const i=n;if(e[n]){let n=t.force(i);n||(n=r(),t.force(i,n)),Ik(n,Object.entries(e[i]))}else t.force(i,null)})}},"d3-force":Ok,"force-atlas2":nj,circular:QF,concentric:NF,dagre:LK,force:qK,fruchterman:oj,grid:sj,mds:Uj,radial:Dj,random:Kj},Vj={layout:t=>t?{type:"concentric",preventOverlap:!0}:{type:"force",preventOverlap:!0},nodeSize:20,nodeSpacing:0,comboPadding:10,comboSpacing:0},Wj="root";class Yj extends EC{constructor(){super(...arguments),this.id="combo-combined",this.relativePositions=new Map,this.getParentId=t=>t.parentId||Wj}getDefaultOptions(){return Vj}layout(){return mx(this,0,void 0,function*(){const{center:t}=kF(this.options);this.resetLayoutState();const e=this.buildHierarchyTree();yield this.layoutHierarchy(e),this.convertToGlobalPositions(e,t),this.applyPositionsToModel(e)})}isCombo(t){return Boolean(t.isCombo)}resetLayoutState(){this.relativePositions.clear()}layoutHierarchy(t){return mx(this,0,void 0,function*(){for(const e of t.children||[])this.isCombo(e)&&(yield this.layoutHierarchy(e));const e=t.children||[];if(0===e.length)return t.size=[0,0,0],void(t.parentId=t.id===Wj?null:t.parentId);const n=this.getLayoutConfig(t),{type:r}=n,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}(n,["type"]),o=new(this.getLayoutClass(r))(i),A=this.createTemporaryGraphData(e);yield function(t,e,n={}){var r;return mx(this,0,void 0,function*(){return CC(t)?(t.execute(e,n),t.stop(),t.tick(null!==(r=n.iterations)&&void 0!==r?r:300)):yield t.execute(e,n)})}(o,A,{});const s=o.model.nodes();this.recordRelativePositions(s,t);const{center:a,width:c,height:l}=this.calculateComboBounds(t);t.size=[c,l,0],(t.children||[]).forEach(t=>{const e=this.relativePositions.get(t.id);if(!e)return;const n=Object.assign(Object.assign({},e),{x:e.x-a[0],y:e.y-a[1]});this.relativePositions.set(t.id,n)})})}recordRelativePositions(t,e){const n=this.calculateComboCenter(t);t.forEach(t=>{this.relativePositions.set(t.id,{x:t.x-n[0],y:t.y-n[1],relativeTo:String(e.id)})})}buildHierarchyTree(){const t={id:Wj,isCombo:!0,children:[],parentId:null},e=new Map;return e.set(Wj,t),this.model.forEachNode(t=>{if(this.isCombo(t)){const n=Object.assign(Object.assign({},t),{children:[],parentId:this.getParentId(t)});e.set(String(t.id),n)}}),this.model.forEachNode(t=>{const n=e.get(this.getParentId(t));if(this.isCombo(t)){const r=e.get(String(t.id));n&&r&&(n.children.push(r),r.parentId=n.id)}else n&&n.children.push(Object.assign(Object.assign({},t),{children:[],parentId:this.getParentId(t)}))}),t}convertToGlobalPositions(t,e){var n,r;const i=t.id===Wj?null:this.relativePositions.get(t.id),o=e[0]+(null!==(n=null==i?void 0:i.x)&&void 0!==n?n:0),A=e[1]+(null!==(r=null==i?void 0:i.y)&&void 0!==r?r:0);t.x=o,t.y=A,(t.children||[]).forEach(t=>{var e,n;const r=this.relativePositions.get(t.id);t.x=o+(null!==(e=null==r?void 0:r.x)&&void 0!==e?e:0),t.y=A+(null!==(n=null==r?void 0:r.y)&&void 0!==n?n:0),t.size=this.getNodeLikeSize(t,!1),this.isCombo(t)&&this.convertToGlobalPositions(t,[o,A])})}getLayoutConfig(t){const e="object"==typeof this.options.layout?this.options.layout:Vx(this.options.layout,["comboId"]);if("function"==typeof e){const n=t.id===Wj?null:t.id;return this.normalizeLayoutConfig(e(n))}return this.normalizeLayoutConfig(e)}normalizeLayoutConfig(t){const e=Object.assign(Object.assign({type:"concentric"},kF(this.options)),{nodeSize:"node.size",nodeSpacing:0});return t?"string"==typeof t?Object.assign(Object.assign({},e),{type:t}):Object.assign(Object.assign({},e),t):e}getLayoutClass(t){return zj[t]||zj.concentric}createTemporaryGraphData(t){const e=t.map(t=>Object.assign(Object.assign({},t),{size:this.getNodeLikeSize(t)})),n=new Set(t.map(t=>String(t.id))),r=[],i=t=>{let e=String(t);const r=new Set;for(;e&&!r.has(e);){if(n.has(e))return e;r.add(e);const t=this.model.node(e),i=null==t?void 0:t.parentId;e=null==i?null:String(i)}return null};return this.model.forEachEdge(t=>{const e=i(String(t.source)),n=i(String(t.target));e&&n&&e!==n&&r.push({source:e,target:n})}),{nodes:e,edges:r}}calculateComboCenter(t){if(0===t.length)return[0,0];const e=new Map;t.forEach(t=>{const n=this.getNodeLikeSize(t);e.set(t.id,n)});let n=1/0,r=1/0,i=-1/0,o=-1/0;return t.forEach(t=>{const[A=0,s=0]=e.get(t.id);n=Math.min(n,t.x-A/2),r=Math.min(r,t.y-s/2),i=Math.max(i,t.x+A/2),o=Math.max(o,t.y+s/2)}),Number.isFinite(n)&&Number.isFinite(r)?[(n+i)/2,(r+o)/2]:[0,0]}calculateComboBounds(t){const e=t.children||[];if(0===e.length)return{center:[0,0],width:0,height:0};let n=1/0,r=1/0,i=-1/0,o=-1/0;if(e.forEach(t=>{var e,A;const s=this.relativePositions.get(t.id),a=null!==(e=null==s?void 0:s.x)&&void 0!==e?e:0,c=null!==(A=null==s?void 0:s.y)&&void 0!==A?A:0,[l,u]=this.getNodeLikeSize(t);n=Math.min(n,a-l/2),r=Math.min(r,c-u/2),i=Math.max(i,a+l/2),o=Math.max(o,c+u/2)}),!Number.isFinite(n)||!Number.isFinite(r))return{center:[0,0],width:0,height:0};const A=Wx(this.options.comboPadding,20,"combo")(t._original);return{center:[(n+i)/2,(r+o)/2],width:i-n+2*A,height:o-r+2*A}}getNodeLikeSize(t,e=!0){return this.isCombo(t)?this.getComboSize(t,e):this.getNodeSize(t,e)}getNodeSize(t,e=!0){const{nodeSize:n,nodeSpacing:r}=this.options;return Xx(n,e?r:0)(t._original)}getComboSize(t,e=!0){const n=Wx(this.options.comboSpacing,0,"combo"),r=e?n(t._original):0,[i,o]=t.size;return[i+r/2,o+r/2,0]}applyPositionsToModel(t){const e=t=>{const e=this.model.node(t.id);e&&(e.x=t.x,e.y=t.y,t.size&&(e.size=t.size))},n=t=>{t.id!==Wj&&e(t),(t.children||[]).forEach(t=>{this.isCombo(t)?n(t):e(t)})};n(t)}}class Xj extends mE{constructor(){super(...arguments),this.id="fishbone"}getRoot(){const t=this.context.model.getRootsData();if(!(Ee(t)||t.length>2))return t[0]}formatSize(t){const e="function"==typeof t?t:()=>t;return t=>cw(e(t))}doLayout(t,e){const{hGap:n,getRibSep:r,vGap:i,nodeSize:o,height:A}=e,{model:s}=this.context,a=this.formatSize(o);let c=a(t)[0]+r(t);const l=(t,e=0)=>{var r;return e+=n*((t.children||[]).length+1),null===(r=t.children)||void 0===r||r.forEach(t=>{var n;null===(n=s.getNodeLikeDatum(t).children)||void 0===n||n.forEach(t=>{const n=s.getNodeLikeDatum(t);e=l(n,e)})}),e},u=t=>{if(1===t.depth)return c;const e=s.getParentData(t.id,"tree");if(Zj(t)){const r=s.getParentData(e.id,"tree"),o=f(t)-f(r);return u(e)+o*n/i}{const n=(e.children||[]).indexOf(t.id),r=s.getNodeData((e.children||[]).slice(n));return h(e)-r.reduce((t,e)=>t+l(e),0)-a(e)[0]/2}},h=me(t=>{if($j(t))return a(t)[0]/2;const e=s.getParentData(t.id,"tree");if(Zj(t))return u(t)+l(t)+a(t)[0]/2;{const r=f(t)-f(e),o=n/i;return u(t)+r*o}},t=>t.id),d=t=>f(s.getParentData(t,"tree")),f=me(t=>{if($j(t))return A/2;if(Zj(t)){const e=s.getParentData(t.id,"tree"),n=e.children.indexOf(t.id);if(0===n)return d(e.id)+i;const r=s.getNodeLikeDatum(e.children[n-1]);if(Ee(r.children))return f(r)+i;const o=s.getDescendantsData(r.id);return Math.max(...o.map(t=>Zj(t)?d(t.id):f(t)))+i}{if(Ee(t.children))return d(t.id)+i;const e=s.getNodeLikeDatum(t.children.slice(-1)[0]);if(Ee(e.children))return f(e)+i;const n=s.getDescendantsData(t.id).slice(-1)[0];return(Zj(n)?d(n.id):f(n))+i}},t=>t.id);let g=0;const p={nodes:[],edges:[]},v=t=>{var e;null===(e=t.children)||void 0===e||e.forEach(t=>v(s.getNodeLikeDatum(t)));const n=f(t),i=h(t);if(p.nodes.push({id:t.id,x:i,y:n}),$j(t))return;const o=s.getRelatedEdgesData(t.id,"in")[0],A=[u(t),Zj(t)?n:d(t.id)];p.edges.push({id:Km(o),controlPoints:[A],relatedNodeId:t.id}),g=Math.max(g,i+r(t)),1===t.depth&&(c=g)};return v(t),p}placeAlterative(t,e){const n=(e.children||[]).filter((t,e)=>e%2!=0);if(0===n.length)return t;const{model:r}=this.context,i=t.nodes.find(t=>t.id===e.id).y,o=t=>{const e=r.getAncestorsData(t,"tree");if(Ee(e))return!1;const i=1===e.length?t:e[e.length-2].id;return n.includes(i)};t.nodes.forEach(t=>{o(t.id)&&(t.y=2*i-t.y)}),t.edges.forEach(t=>{o(t.relatedNodeId)&&(t.controlPoints=t.controlPoints.map(t=>[t[0],2*i-t[1]]))})}rightToLeft(t,e){return t.nodes.forEach(t=>t.x=e.width-t.x),t.edges.forEach(t=>{t.controlPoints=t.controlPoints.map(t=>[e.width-t[0],t[1]])}),t}execute(t,e){return De(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},Xj.defaultOptions),this.options),e),{direction:r,nodeSize:i}=n,o=this.getRoot();if(!o)return t;const A=this.formatSize(i);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(t=>A(t)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(t=>A(t)[0])));let s=this.doLayout(o,n);this.placeAlterative(s,o),"RL"===r&&(s=this.rightToLeft(s,n));const{model:a}=this.context,c=[],l=[];return s.nodes.forEach(t=>{const{id:e,x:n,y:r}=t,i=a.getNodeLikeDatum(e);c.push(qj(i,{x:n,y:r}))}),s.edges.forEach(t=>{const{id:e,controlPoints:n}=t,r=a.getEdgeDatum(e);l.push(qj(r,{controlPoints:n}))}),{nodes:c,edges:l}})}}Xj.defaultOptions={direction:"RL",getRibSep:()=>60};const qj=(t,e)=>Object.assign(Object.assign({},t),{style:Object.assign(Object.assign({},t.style||{}),e)}),$j=t=>0===t.depth,Zj=t=>(t.depth||(t.depth=0))%2==0;class Jj extends mE{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n="function"==typeof e?e:()=>e;return t.reduce((t,e)=>{const[r,i]=cw(n(e))||[0,0];return[Math.max(t[0],r),Math.max(t[1],i)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,r={},i={},o={};e.forEach(t=>{r[t.id]=0,i[t.id]=0,o[t.id]=[]}),n.forEach(t=>{r[t.target]++,i[t.source]++,o[t.source].push(t.target)});const A=new Set,s=t=>{A.has(t)||(A.add(t),o[t].forEach(s))};if(s(e[0].id),A.size!==e.length)return!1;const a=e.filter(t=>0===r[t.id]),c=e.filter(t=>0===i[t.id]);if(1!==a.length||1!==c.length)return!1;return e.filter(t=>1===r[t.id]&&1===i[t.id]).length===e.length-2}execute(t,e){return De(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:r,padding:i,sortBy:o,cols:A,colGap:s,rowGap:a,clockwise:c,width:l,height:u}=Object.assign({},Jj.defaultOptions,this.options,e),[h,d,f,g]=pm(i),p=this.formatSize(t.nodes||[],r),v=Math.ceil((t.nodes||[]).length/A);let m=s||(l-g-d-A*p[0])/(A-1),y=a||(u-h-f-v*p[1])/(v-1);(y===1/0||y<0)&&(y=0),(m===1/0||m<0)&&(m=0);const w=o?null===(n=t.nodes)||void 0===n?void 0:n.sort(o):function(t){const{nodes:e=[],edges:n=[]}=t,r={},i={};e.forEach(t=>{r[t.id]=0,i[t.id]=[]}),n.forEach(t=>{r[t.target]++,i[t.source].push(t.target)});const o=[],A=[];e.forEach(t=>{0===r[t.id]&&o.push(t.id)});for(;o.length>0;){const t=o.shift(),n=e.find(e=>e.id===t);A.push(n),i[t].forEach(t=>{r[t]--,0===r[t]&&o.push(t)})}return A}(t),b=(w||[]).map((t,e)=>{const n=Math.floor(e/A),r=e%A,i=g+(c?n%2==0?r:A-1-r:n%2==0?A-1-r:r)*(p[0]+m)+p[0]/2,o=h+n*(p[1]+y)+p[1]/2;return{id:t.id,style:{x:i,y:o}}});return{nodes:b}})}}Jj.defaultOptions={padding:0,cols:5,clockwise:!0};class tz extends ry{}function ez(t,e=!0,n){const r=document.createElement("div");return r.setAttribute("class",`g6-${t}`),Object.assign(r.style,{position:"absolute",display:"block"}),e&&Object.assign(r.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),n&&Object.assign(r.style,n),r}function nz(t,e="div",n={},r="",i=document.body){const o=document.getElementById(t);o&&o.remove();const A=document.createElement(e);return A.innerHTML=r,A.id=t,Object.assign(A.style,n),i.appendChild(A),A}class rz extends tz{constructor(t,e){super(t,Object.assign({},rz.defaultOptions,e)),this.$element=ez("background");this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return De(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Se(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}function iz(t,e,n,r,i,o){const A=n-t,s=r-e;let a=i-t,c=o-e,l=a*A+c*s,u=0;l<=0?u=0:(a=A-a,c=s-c,l=a*A+c*s,u=l<=0?0:l*l/(A*A+s*s));const h=a*a+c*c-u;return h<0?0:h}function oz(t,e,n,r){return(t-n)*(t-n)+(e-r)*(e-r)}function Az(t,e,n,r,i){return oz(t,e,n,r)<i*i}function sz(t){const e=Math.min(t.x1,t.x2),n=Math.max(t.x1,t.x2),r=Math.min(t.y1,t.y2),i=Math.max(t.y1,t.y2);return{x:e,y:r,x2:n,y2:i,width:n-e,height:i-r}}rz.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};class az{constructor(t,e,n,r){this.x1=t,this.y1=e,this.x2=n,this.y2=r}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new az(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2)return!1;if(e<this.y1&&e<=this.y2||e>this.y1&&e>=this.y2)return!1;if(t>this.x1&&t>=this.x2)return!1;if(t<this.x1&&t<=this.x2)return!0;return t<=this.x1+(e-this.y1)*(this.x2-this.x1)/(this.y2-this.y1)}distSquare(t,e){return iz(this.x1,this.y1,this.x2,this.y2,t,e)}ptClose(t,e,n){if(this.x1<this.x2){if(t<this.x1-n||t>this.x2+n)return!1}else if(t<this.x2-n||t>this.x1+n)return!1;if(this.y1<this.y2){if(e<this.y1-n||e>this.y2+n)return!1}else if(e<this.y2-n||e>this.y1+n)return!1;return!0}}var cz,lz;!function(t){t[t.POINT=1]="POINT",t[t.PARALLEL=2]="PARALLEL",t[t.COINCIDENT=3]="COINCIDENT",t[t.NONE=4]="NONE"}(cz||(cz={}));class uz{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function hz(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const e=n/i,o=r/i;return 0<=e&&e<=1&&0<=o&&o<=1?new uz(cz.POINT,t.x1+e*(t.x2-t.x1),t.y1+e*(t.y2-t.y1)):new uz(cz.NONE)}return new uz(0===n||0===r?cz.COINCIDENT:cz.PARALLEL)}function dz(t,e){const n=(e.x2-e.x1)*(t.y1-e.y1)-(e.y2-e.y1)*(t.x1-e.x1),r=(t.x2-t.x1)*(t.y1-e.y1)-(t.y2-t.y1)*(t.x1-e.x1),i=(e.y2-e.y1)*(t.x2-t.x1)-(e.x2-e.x1)*(t.y2-t.y1);if(i){const t=n/i,e=r/i;if(0<=t&&t<=1&&0<=e&&e<=1)return t}return Number.POSITIVE_INFINITY}function fz(t,e,n){const r=new Set;return t.width<=0?(r.add(lz.LEFT),r.add(lz.RIGHT)):e<t.x?r.add(lz.LEFT):e>t.x+t.width&&r.add(lz.RIGHT),t.height<=0?(r.add(lz.TOP),r.add(lz.BOTTOM)):n<t.y?r.add(lz.TOP):n>t.y+t.height&&r.add(lz.BOTTOM),r}function gz(t,e){let n=e.x1,r=e.y1;const i=e.x2,o=e.y2,A=Array.from(fz(t,i,o));if(0===A.length)return!0;let s=fz(t,n,r);for(;0!==s.size;){for(const t of A)if(s.has(t))return!1;if(s.has(lz.RIGHT)||s.has(lz.LEFT)){let e=t.x;s.has(lz.RIGHT)&&(e+=t.width),r+=(e-n)*(o-r)/(i-n),n=e}else{let e=t.y;s.has(lz.BOTTOM)&&(e+=t.height),n+=(e-r)*(i-n)/(o-r),r=e}s=fz(t,n,r)}return!0}function pz(t,e){let n=Number.POSITIVE_INFINITY,r=0;function i(t,i,o,A){let s=dz(e,new az(t,i,o,A));s=Math.abs(s-.5),s>=0&&s<=1&&(r++,s<n&&(n=s))}return i(t.x,t.y,t.x2,t.y),i(t.x,t.y,t.x,t.y2),r>1?n:(i(t.x,t.y2,t.x2,t.y2),r>1?n:(i(t.x2,t.y,t.x2,t.y2),0===r?-1:n))}function vz(t,e){let n=0;const r=hz(t,new az(e.x,e.y,e.x2,e.y));n+=r.state===cz.POINT?1:0;const i=hz(t,new az(e.x,e.y,e.x,e.y2));n+=i.state===cz.POINT?1:0;const o=hz(t,new az(e.x,e.y2,e.x2,e.y2));n+=o.state===cz.POINT?1:0;const A=hz(t,new az(e.x2,e.y,e.x2,e.y2));return n+=A.state===cz.POINT?1:0,{top:r,left:i,bottom:o,right:A,count:n}}!function(t){t[t.LEFT=0]="LEFT",t[t.TOP=1]="TOP",t[t.RIGHT=2]="RIGHT",t[t.BOTTOM=3]="BOTTOM"}(lz||(lz={}));class mz{constructor(t,e,n,r){this.x=t,this.y=e,this.width=n,this.height=r}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new mz(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new mz(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x+t.width),i=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=r-e,this.height=i-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),r=Math.max(this.x2,t.x),i=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=r-e,this.height=i-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return!(this.area<=0||t.width<=0||t.height<=0)&&(t.x+t.width>this.x&&t.y+t.height>this.y&&t.x<this.x2&&t.y<this.y2)}distSquare(t,e){if(this.containsPt(t,e))return 0;const n=fz(this,t,e);return n.has(lz.TOP)?n.has(lz.LEFT)?oz(t,e,this.x,this.y):n.has(lz.RIGHT)?oz(t,e,this.x2,this.y):(this.y-e)*(this.y-e):n.has(lz.BOTTOM)?n.has(lz.LEFT)?oz(t,e,this.x,this.y2):n.has(lz.RIGHT)?oz(t,e,this.x2,this.y2):(e-this.y2)*(e-this.y2):n.has(lz.LEFT)?(this.x-t)*(this.x-t):n.has(lz.RIGHT)?(t-this.x2)*(t-this.x2):0}}class yz{constructor(t,e,n){this.cx=t,this.cy=e,this.radius=n}get x(){return this.cx-this.radius}get x2(){return this.cx+this.radius}get width(){return 2*this.radius}get y(){return this.cy-this.radius}get y2(){return this.cy+this.radius}get height(){return 2*this.radius}static from(t){return new yz(t.cx,t.cy,t.radius)}containsPt(t,e){return oz(this.cx,this.cy,t,e)<this.radius*this.radius}distSquare(t,e){const n=oz(this.cx,this.cy,t,e);if(n<this.radius*this.radius)return 0;const r=Math.sqrt(n)-this.radius;return r*r}draw(t){t.ellipse(this.cx,this.cy,this.radius,this.radius,0,0,2*Math.PI)}}class wz{constructor(t,e=0,n=0,r=0,i=0,o=10,A=10,s=new Float32Array(Math.max(0,o*A)).fill(0)){this.pixelGroup=t,this.i=e,this.j=n,this.pixelX=r,this.pixelY=i,this.width=o,this.height=A,this.area=s}createSub(t,e){return new wz(this.pixelGroup,t.x,t.y,e.x,e.y,t.width,t.height)}static fromPixelRegion(t,e){return new wz(e,0,0,t.x,t.y,Math.ceil(t.width/e),Math.ceil(t.height/e))}copy(t,e){return new wz(this.pixelGroup,this.scaleX(e.x),this.scaleY(e.y),e.x,e.y,t.width,t.height,t.area)}boundX(t){return t<this.i?this.i:t>=this.width?this.width-1:t}boundY(t){return t<this.j?this.j:t>=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),r=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),i=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup));return new mz(e,n,r-e,i-n)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),r=this.boundX(t.x-n),i=this.boundY(t.y-n),o=this.boundX(t.x2+n),A=this.boundY(t.y2+n);return new mz(r,i,o-r,A-i)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||0===e)return;const n=this.width,r=t.width,i=Math.max(0,t.i),o=Math.max(0,t.j),A=Math.min(t.i+t.width,n),s=Math.min(t.j+t.height,this.height);if(!(s<=0||A<=0||i>=n||s>=this.height))for(let a=o;a<s;a++){const o=(a-t.j)*r,s=a*n;for(let n=i;n<A;n++){const r=t.area[n-t.i+o];0!==r&&(this.area[n+s]+=e*r)}}}fill(t){this.area.fill(t)}fillArea(t,e){const n=t.x+t.y*this.width;for(let r=0;r<t.height;r++){const i=n+r*this.width;this.area.fill(e,i,i+t.width)}}fillHorizontalLine(t,e,n,r){const i=t+e*this.width;this.area.fill(r,i,i+n)}fillVerticalLine(t,e,n,r){const i=t+e*this.width;for(let t=0;t<n;t++)this.area[i+t*this.width]=r}clear(){this.area.fill(0)}toString(){let t="";for(let e=0;e<this.height;e++){const n=e*this.width;for(let e=0;e<this.width;e++){t+=this.area[n+e].toFixed(1).padStart(6),t+=" "}t+="\n"}return t}draw(t,e=!0){if(this.width<=0||this.height<=0)return;t.save(),e&&t.translate(this.pixelX,this.pixelY);const n=this.area.reduce((t,e)=>Math.min(t,e),Number.POSITIVE_INFINITY),r=this.area.reduce((t,e)=>Math.max(t,e),Number.NEGATIVE_INFINITY),i=t=>(t-n)/(r-n);t.scale(this.pixelGroup,this.pixelGroup);for(let e=0;e<this.width;e++)for(let n=0;n<this.height;n++){const r=this.area[e+n*this.width];t.fillStyle=`rgba(0, 0, 0, ${i(r)})`,t.fillRect(e,n,1,1)}t.restore()}drawThreshold(t,e,n=!0){if(!(this.width<=0||this.height<=0)){t.save(),n&&t.translate(this.pixelX,this.pixelY),t.scale(this.pixelGroup,this.pixelGroup);for(let n=0;n<this.width;n++)for(let r=0;r<this.height;r++){const i=this.area[n+r*this.width];t.fillStyle=i>e?"black":"white",t.fillRect(n,r,1,1)}t.restore()}}}function bz(t,e){const n=t=>({x:t.x-e,y:t.y-e,width:t.width+2*e,height:t.height+2*e});return Array.isArray(t)?t.map(n):n(t)}function Bz(t,e,n){return Ez(Object.assign(sz(t),{distSquare:(e,n)=>iz(t.x1,t.y1,t.x2,t.y2,e,n)}),e,n)}function Ez(t,e,n){const r=bz(t,n),i=e.scale(r),o=e.createSub(i,r);return function(t,e,n,r){const i=n*n;for(let o=0;o<t.height;o++)for(let A=0;A<t.width;A++){const s=r(e.invertScaleX(t.i+A),e.invertScaleY(t.j+o));if(0!==s){if(s<i){const e=n-Math.sqrt(s);t.set(A,o,e*e)}}else t.set(A,o,i)}}(o,e,n,(e,n)=>t.distSquare(e,n)),o}function xz(t,e){return{x:t,y:e}}function Cz(t,e,n,r){if(0===t.length)return[];const i=function(t){if(t.length<2)return t;let e=0,n=0;return t.forEach(t=>{e+=t.cx,n+=t.cy}),e/=t.length,n/=t.length,t.map(t=>{const r=e-t.cx,i=n-t.cy;return[t,r*r+i*i]}).sort((t,e)=>t[1]-e[1]).map(t=>t[0])}(t);return i.map((t,o)=>{const A=i.slice(0,o);return function(t,e,n,r,i){const o=xz(e.cx,e.cy),A=function(t,e,n){let r=Number.POSITIVE_INFINITY;return e.reduce((e,i)=>{const o=oz(t.x,t.y,i.cx,i.cy);if(o>r)return e;const A=new az(t.x,t.y,i.cx,i.cy),s=function(t,e){return t.reduce((t,n)=>gz(n,e)&&function(t,e){function n(t,n,r,i){let o=dz(e,new az(t,n,r,i));return o=Math.abs(o-.5),o>=0&&o<=1?1:0}let r=n(t.x,t.y,t.x2,t.y);return r+=n(t.x,t.y,t.x,t.y2),r>1||(r+=n(t.x,t.y2,t.x2,t.y2),r>1||(r+=n(t.x2,t.y,t.x2,t.y2),r>0))}(n,e)?t+1:t,0)}(n,A);return o*(s+1)*(s+1)<r&&(e=i,r=o*(s+1)*(s+1)),e},null)}(o,n,t);if(null==A)return[];const s=function(t,e,n,r){const i=[],o=[];o.push(t);let A=!0;for(let t=0;t<n&&A;t++)for(A=!1;!A&&o.length>0;){const t=o.pop(),n=kz(e,t),s=n?vz(t,n):null;if(!n||!s||2!==s.count){A||i.push(t);continue}let a=r,c=Sz(n,a,s,!0),l=Fz(c,o)||Fz(c,i),u=Mz(c,e);for(;!l&&u&&a>=1;)a/=1.5,c=Sz(n,a,s,!0),l=Fz(c,o)||Fz(c,i),u=Mz(c,e);if(!c||l||u||(o.push(new az(t.x1,t.y1,c.x,c.y)),o.push(new az(c.x,c.y,t.x2,t.y2)),A=!0),A)continue;a=r,c=Sz(n,a,s,!1);let h=Fz(c,o)||Fz(c,i);for(u=Mz(c,e);!h&&u&&a>=1;)a/=1.5,c=Sz(n,a,s,!1),h=Fz(c,o)||Fz(c,i),u=Mz(c,e);c&&!h&&(o.push(new az(t.x1,t.y1,c.x,c.y)),o.push(new az(c.x,c.y,t.x2,t.y2)),A=!0),A||i.push(t)}for(;o.length>0;)i.push(o.pop());return i}(new az(o.x,o.y,A.cx,A.cy),t,r,i);return function(t,e){const n=[];for(;t.length>0;){const r=t.pop();if(0===t.length){n.push(r);break}const i=t.pop(),o=new az(r.x1,r.y1,i.x2,i.y2);kz(e,o)?(n.push(r),t.push(i)):t.push(o)}return n}(s,t)}(e,t,A,n,r)}).flat()}function Mz(t,e){return e.some(e=>e.containsPt(t.x,t.y))}function Fz(t,e){return e.some(e=>!!Az(e.x1,e.y1,t.x,t.y,.001)||!!Az(e.x2,e.y2,t.x,t.y,.001))}function kz(t,e){let n=Number.POSITIVE_INFINITY,r=null;for(const i of t){if(!gz(i,e))continue;const t=pz(i,e);t>=0&&t<n&&(r=i,n=t)}return r}function Sz(t,e,n,r){const i=n.top,o=n.left,A=n.bottom,s=n.right;if(r){if(o.state===cz.POINT){if(i.state===cz.POINT)return xz(t.x-e,t.y-e);if(A.state===cz.POINT)return xz(t.x-e,t.y2+e);const n=t.width*t.height;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?xz(t.x-e,t.y-e):xz(t.x2+e,t.y-e):o.y<s.y?xz(t.x-e,t.y2+e):xz(t.x2+e,t.y2+e)}if(s.state===cz.POINT){if(i.state===cz.POINT)return xz(t.x2+e,t.y-e);if(A.state===cz.POINT)return xz(t.x2+e,t.y2+e)}const n=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*n?i.x>A.x?xz(t.x-e,t.y-e):xz(t.x-e,t.y2+e):i.x<A.x?xz(t.x2+e,t.y-e):xz(t.x2+e,t.y2+e)}if(o.state===cz.POINT){if(i.state===cz.POINT)return xz(t.x2+e,t.y2+e);if(A.state===cz.POINT)return xz(t.x2+e,t.y-e);const n=t.height*t.width;return t.width*(.5*(o.y-t.y+(s.y-t.y)))<.5*n?o.y>s.y?xz(t.x2+e,t.y2+e):xz(t.x-e,t.y2+e):o.y<s.y?xz(t.x2+e,t.y-e):xz(t.x-e,t.y-e)}if(s.state===cz.POINT){if(i.state===cz.POINT)return xz(t.x-e,t.y2+e);if(A.state===cz.POINT)return xz(t.x-e,t.y-e)}const a=t.height*t.width;return t.height*(.5*(i.x-t.x+(s.x-t.x)))<.5*a?i.x>A.x?xz(t.x2+e,t.y2+e):xz(t.x2+e,t.y-e):i.x<A.x?xz(t.x-e,t.y2+e):xz(t.x-e,t.y-e)}function Qz(t,e,n,r){if(!(t.closed?n<t.length:n<t.length-1))return!1;const i=t.get(e),o=t.get(n+1);for(let A=e+1;A<=n;A++){const e=t.get(A);if(iz(i.x,i.y,o.x,o.y,e.x,e.y)>r)return!1}return!0}function Uz(t,e){switch(t){case-2:return(((3-e)*e-3)*e+1)/6;case-1:return((3*e-6)*e*e+4)/6;case 0:return(((-3*e+3)*e+3)*e+1)/6;case 1:return e*e*e/6;default:throw new Error("unknown error")}}class Nz{constructor(t=[],e=!0){this.points=t,this.closed=e}get(t){const e=t,n=this.points.length;return t<0?this.closed?this.get(t+n):this.points[0]:t>=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(0===e.length)return"";const n="function"==typeof t?t:function(t){if(!Number.isFinite(t))return t=>t;if(0===t)return Math.round;const e=Math.pow(10,t);return t=>Math.round(t*e)/e}(t);let r="M";for(const t of e)r+=`${n(t.x)},${n(t.y)} L`;return r=r.slice(0,-1),this.closed&&(r+=" Z"),r}draw(t){const e=this.points;if(0!==e.length){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return function(t=8){return e=>{let n=t,r=e.length;if(n>1)for(r=Math.floor(e.length/n);r<3&&n>1;)n-=1,r=Math.floor(e.length/n);const i=[];for(let t=0,o=0;o<r;o++,t+=n)i.push(e.get(t));return new Nz(i)}}(t)(this)}simplify(t){return function(t=0){return e=>{if(t<0||e.length<3)return e;const n=[];let r=0;const i=t*t;for(;r<e.length;){let t=r+1;for(;Qz(e,r,t,i);)t++;n.push(e.get(r)),r=t}return new Nz(n)}}(t)(this)}bSplines(t){return function(t=6){function e(t,e,n){let r=0,i=0;for(let o=-2;o<=1;o++){const A=t.get(e+o),s=Uz(o,n);r+=s*A.x,i+=s*A.y}return{x:r,y:i}}return n=>{if(n.length<3)return n;const r=[],i=n.closed,o=n.length+3-1+(i?0:2);r.push(e(n,2-(i?0:2),0));for(let A=2-(i?0:2);A<o;A++)for(let i=1;i<=t;i++)r.push(e(n,A,i/t));return new Nz(r)}}(t)(this)}apply(t){return t(this)}containsElements(t){const e=function(t){if(0===t.length)return null;const e=t[0],n=new mz(e.x,e.y,0,0);for(const e of t)n.addPoint(e);return n}(this.points);return!!e&&t.every(t=>e.containsPt(t.cx,t.cy)&&this.withinArea(t.cx,t.cy))}withinArea(t,e){if(0===this.length)return!1;let n=0;const r=this.points[0],i=new az(r.x,r.y,r.x,r.y);for(let r=1;r<this.points.length;r++){const o=this.points[r];i.x1=i.x2,i.y1=i.y2,i.x2=o.x,i.y2=o.y,i.cuts(t,e)&&n++}return i.x1=i.x2,i.y1=i.y2,i.x2=r.x,i.y2=r.y,i.cuts(t,e)&&n++,n%2==1}}class Tz{constructor(t=0){this.count=0,this.arr=[],this.set=new Set,this.arr.length=t}add(t){this.set.add(`${t.x}x${t.y}`),this.arr[this.count++]=t}contains(t){return this.set.has(`${t.x}x${t.y}`)}isFirst(t){if(0===this.count)return!1;const e=this.arr[0];return null!=e&&e.x===t.x&&e.y===t.y}path(){return new Nz(this.arr.slice(0,this.count))}clear(){this.set.clear(),this.count=0}get(t){return this.arr[t]}get length(){return this.count}}function Oz(t,e){const n=2*(Math.floor(t.width)+Math.floor(t.height)),r=new Tz(n);function i(n,r,i,o){const A=t.get(n,r);return Number.isNaN(A)?Number.NaN:A>e?i+o:i}function o(t,e){let n=0;return n=i(t,e,n,1),n=i(t+1,e,n,2),n=i(t,e+1,n,4),n=i(t+1,e+1,n,8),Number.isNaN(n)?-1:n}let A=1;function s(e,n){let i=e,s=n,a=t.invertScaleX(i),c=t.invertScaleY(s);for(let e=0;e<t.width*t.height;e++){const e={x:a,y:c};if(r.contains(e)){if(r.isFirst(e))return!0}else r.add(e);const n=o(i,s);switch(n){case-1:return!0;case 0:case 3:case 2:case 7:A=2;break;case 12:case 14:case 4:A=3;break;case 6:A=0===A?3:2;break;case 1:case 13:case 5:A=0;break;case 9:A=2===A?0:1;break;case 10:case 8:case 11:A=1;break;default:return console.warn("Marching squares invalid state: "+n),!0}switch(A){case 0:s--,c-=t.pixelGroup;break;case 1:s++,c+=t.pixelGroup;break;case 3:i--,a-=t.pixelGroup;break;case 2:i++,a+=t.pixelGroup;break;default:return console.warn("Marching squares invalid state: "+n),!0}}return!0}for(let n=0;n<t.width;n++)for(let i=0;i<t.height;i++){if(t.get(n,i)<=e)continue;const A=o(n,i);if(!(A<0||15===A)&&s(n,i))return r.path()}return null}const Iz={maxRoutingIterations:100,maxMarchingIterations:20,pixelGroup:4,edgeR0:10,edgeR1:20,nodeR0:15,nodeR1:50,morphBuffer:10,threshold:1,memberInfluenceFactor:1,edgeInfluenceFactor:1,nonMemberInfluenceFactor:-.8,virtualEdges:!0};function Lz(t){return null!=t&&"number"==typeof t.radius}function Pz(t,e){if(Lz(t)!==Lz(e))return!1;if(Lz(t)){const n=e;return t.cx===n.cx&&t.cy===n.cy&&t.radius===n.radius}const n=e;return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}var Dz;!function(t){t[t.MEMBERS=0]="MEMBERS",t[t.NON_MEMBERS=1]="NON_MEMBERS",t[t.EDGES=2]="EDGES"}(Dz||(Dz={}));let Rz=class{constructor(t={}){this.dirty=new Set,this.members=[],this.nonMembers=[],this.virtualEdges=[],this.edges=[],this.activeRegion=new mz(0,0,0,0),this.potentialArea=new wz(1,0,0,0,0,0,0),this.o=Object.assign({},Iz,t)}pushMember(...t){if(0!==t.length){this.dirty.add(Dz.MEMBERS);for(const e of t)this.members.push({raw:e,obj:Lz(e)?yz.from(e):mz.from(e),area:null})}}removeMember(t){const e=this.members.findIndex(e=>Pz(e.raw,t));return!(e<0)&&(this.members.splice(e,1),this.dirty.add(Dz.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(e=>Pz(e.raw,t));return!(e<0)&&(this.nonMembers.splice(e,1),this.dirty.add(Dz.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(e=>e.obj.equals(t));return!(e<0)&&(this.edges.splice(e,1),this.dirty.add(Dz.NON_MEMBERS),!0)}pushNonMember(...t){if(0!==t.length){this.dirty.add(Dz.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:Lz(e)?yz.from(e):mz.from(e),area:null})}}pushEdge(...t){if(0!==t.length){this.dirty.add(Dz.EDGES);for(const e of t)this.edges.push({raw:e,obj:az.from(e),area:null})}}update(){const t=this.dirty.has(Dz.MEMBERS),e=this.dirty.has(Dz.NON_MEMBERS);let n=this.dirty.has(Dz.EDGES);this.dirty.clear();const r=this.members.map(t=>t.obj);if(this.o.virtualEdges&&(t||e)){const t=this.nonMembers.map(t=>t.obj),e=Cz(r,t,this.o.maxRoutingIterations,this.o.morphBuffer),i=new Map(this.virtualEdges.map(t=>[t.obj.toString(),t.area]));this.virtualEdges=e.map(t=>{var e;return{raw:t,obj:t,area:null!==(e=i.get(t.toString()))&&void 0!==e?e:null}}),n=!0}let i=!1;if(t||n){const t=this.virtualEdges.concat(this.edges).map(t=>t.obj),e=function(t,e){if(0===t.length)return new mz(0,0,0,0);const n=mz.from(t[0]);for(const e of t)n.add(e);for(const t of e)n.add(sz(t));return n}(r,t),n=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,o=mz.from(bz(e,n));o.equals(this.activeRegion)||(i=!0,this.activeRegion=o)}if(i){const t=Math.ceil(this.activeRegion.width/this.o.pixelGroup),e=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=wz.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(t=>t.area=null),this.nonMembers.forEach(t=>t.area=null),this.edges.forEach(t=>t.area=null),this.virtualEdges.forEach(t=>t.area=null)):t===this.potentialArea.width&&e===this.potentialArea.height||(this.potentialArea=wz.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const o=new Map,A=t=>{if(t.area){const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof mz?"R":"C"}`;o.set(e,t.area)}},s=t=>{if(t.area)return;const e=`${t.obj.width}x${t.obj.height}x${t.obj instanceof mz?"R":"C"}`;if(o.has(e)){const n=o.get(e);return void(t.area=this.potentialArea.copy(n,{x:t.obj.x-this.o.nodeR1,y:t.obj.y-this.o.nodeR1}))}const n=t.obj instanceof mz?function(t,e,n){const r=e.scale(t),i=e.addPadding(r,n),o=e.createSub(i,{x:t.x-n,y:t.y-n}),A=r.x-i.x,s=r.y-i.y,a=i.x2-r.x2,c=i.y2-r.y2,l=i.width-A-a,u=i.height-s-c,h=n*n;o.fillArea({x:A,y:s,width:l+1,height:u+1},h);const d=[0],f=Math.max(s,A,a,c);{const i=e.invertScaleX(r.x+r.width/2);for(let o=1;o<f;o++){const A=e.invertScaleY(r.y-o),s=t.distSquare(i,A);if(!(s<h))break;{const t=n-Math.sqrt(s);d.push(t*t)}}}const g=[],p=Math.max(A,a),v=Math.max(s,a);for(let i=1;i<p;i++){const o=e.invertScaleX(r.x-i),A=[];for(let i=1;i<v;i++){const s=e.invertScaleY(r.y-i),a=t.distSquare(o,s);if(a<h){const t=n-Math.sqrt(a);A.push(t*t)}else A.push(0)}g.push(A)}for(let t=1;t<Math.min(s,d.length);t++){const e=d[t];o.fillHorizontalLine(A,s-t,l+1,e)}for(let t=1;t<Math.min(c,d.length);t++){const e=d[t];o.fillHorizontalLine(A,s+u+t,l+1,e)}for(let t=1;t<Math.min(A,d.length);t++){const e=d[t];o.fillVerticalLine(A-t,s,u+1,e)}for(let t=1;t<Math.min(c,d.length);t++){const e=d[t];o.fillVerticalLine(A+l+t,s,u+1,e)}for(let t=1;t<A;t++){const e=g[t-1],n=A-t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<c;t++)o.set(n,s+u+t,e[t-1])}for(let t=1;t<a;t++){const e=g[t-1],n=A+l+t;for(let t=1;t<s;t++)o.set(n,s-t,e[t-1]);for(let t=1;t<c;t++)o.set(n,s+u+t,e[t-1])}return o}(t.obj,this.potentialArea,this.o.nodeR1):Ez(t.obj,this.potentialArea,this.o.nodeR1);t.area=n,o.set(e,n)};this.members.forEach(A),this.nonMembers.forEach(A),this.members.forEach(s),this.nonMembers.forEach(t=>{this.activeRegion.intersects(t.obj)?s(t):t.area=null}),this.edges.forEach(t=>{t.area||(t.area=Bz(t.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(t=>{t.area||(t.area=Bz(t.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(0===this.members.length)return new Nz([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map(t=>t.area),r=this.virtualEdges.concat(this.edges).map(t=>t.area),i=this.nonMembers.filter(t=>null!=t.area).map(t=>t.area),o=this.members.map(t=>t.obj);return function(t,e,n,r,i,o={}){const A=Object.assign({},Iz,o);let s=A.threshold,a=A.memberInfluenceFactor,c=A.edgeInfluenceFactor,l=A.nonMemberInfluenceFactor;const u=(A.nodeR0-A.nodeR1)*(A.nodeR0-A.nodeR1),h=(A.edgeR0-A.edgeR1)*(A.edgeR0-A.edgeR1);for(let o=0;o<A.maxMarchingIterations;o++){if(t.clear(),0!==a){const n=a/u;for(const r of e)t.incArea(r,n)}if(0!==c){const e=c/h;for(const r of n)t.incArea(r,e)}if(0!==l){const e=l/u;for(const n of r)t.incArea(n,e)}const d=Oz(t,s);if(d&&i(d))return d;if(s*=.95,o<=.5*A.maxMarchingIterations)a*=1.2,c*=1.2;else{if(!(0!==l&&r.length>0))break;l*=.8}}return new Nz([])}(e,n,r,i,t=>t.containsElements(o),t)}};class Hz extends tz{constructor(t,e){super(t,be({},Hz.defaultOptions,e)),this.path=null,this.members=new Map,this.avoidMembers=new Map,this.bubbleSetOptions={},this.drawBubbleSets=()=>{const{style:t,bubbleSetOptions:e}=this.parseOptions();xe(this.bubbleSetOptions,e)||this.init(),this.bubbleSetOptions=Object.assign({},e);const n=Object.assign(Object.assign({},t),{d:this.getPath()});this.shape?this.shape.update(n):(this.shape=new xw({style:n}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=t=>{if(!this.shape)return;const e=Km(t.data);[...this.options.members,...this.options.avoidMembers].includes(e)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(e)}))},this.getPath=t=>{const{graph:e}=this.context,n=this.options.members,r=[...this.members.keys()],i=this.options.avoidMembers,o=[...this.avoidMembers.keys()];if(0===n.length&&0===i.length)return this.members.clear(),this.avoidMembers.clear(),this.path=[],this.path;if(!t&&this.path&&xe(n,r)&&xe(i,o))return this.path;const{enter:A=[],exit:s=[]}=ty(r,n,t=>t),{enter:a=[],exit:c=[]}=ty(o,i,t=>t);if(t){const e=n.includes(t),r=i.includes(t);e&&(s.push(t),A.push(t)),r&&(c.push(t),a.push(t))}const l=(t,n,r)=>{t.forEach(t=>{const i=r?this.members:this.avoidMembers,o=r?"pushMember":"pushNonMember",A=r?"removeMember":"removeNonMember";if(n){let n;"edge"===e.getElementType(t)?([n]=Gz(e,t),this.bubbleSets.pushEdge(n)):([n]=_z(e,t),this.bubbleSets[o](n)),i.set(t,n)}else{const n=i.get(t);n&&("edge"===e.getElementType(t)?this.bubbleSets.removeEdge(n):this.bubbleSets[A](n),i.delete(t))}})};l(s,!1,!0),l(A,!0,!0),l(c,!1,!1),l(a,!0,!1);const u=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=Ew(u.points.map(Sy)),this.path},this.bindEvents(),this.bubbleSets=new Rz(this.options)}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new Rz(this.options),this.members.clear(),this.avoidMembers.clear(),this.path=null}parseOptions(){const t=this.options,{type:e,key:n,members:r,avoidMembers:i}=t,o=Pe(t,["type","key","members","avoidMembers"]),A=Object.keys(o).reduce((t,e)=>(e in Iz?t.bubbleSetOptions[e]=o[e]:t.style[e]=o[e],t),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:r,avoidMembers:i},A)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(t=>this.options.avoidMembers.includes(t))&&(this.options.avoidMembers=this.options.avoidMembers.filter(t=>!e.includes(t))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(t=>!e.includes(t)),this.drawBubbleSets()}updateMember(t){this.options.members=Gt(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(t=>this.options.members.includes(t))&&(this.options.members=this.options.members.filter(t=>!e.includes(t))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(t=>e.includes(t))&&(this.options.avoidMembers=this.options.avoidMembers.filter(t=>!e.includes(t)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape&&(this.shape.destroy(),this.shape=void 0),super.destroy()}}Hz.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},Iz);const _z=(t,e)=>(Array.isArray(e)?e:[e]).map(e=>{const n=t.getElementRenderBounds(e);return new mz(n.min[0],n.min[1],mm(n),ym(n))}),Gz=(t,e)=>(Array.isArray(e)?e:[e]).map(e=>{const n=t.getEdgeData(e),r=t.getElementPosition(n.source),i=t.getElementPosition(n.target);return az.from({x1:r[0],y1:r[1],x2:i[0],y2:i[1]})});class Kz extends tz{constructor(t,e){super(t,Object.assign({},Kz.defaultOptions,e)),this.targetElement=null,this.wheelHandler=t=>{t.stopPropagation()},this.onTriggerEvent=t=>{var e;null===(e=t.preventDefault)||void 0===e||e.call(t),this.show(t)},this.onMenuItemClick=t=>{const{onClick:e,trigger:n}=this.options;if(t.target instanceof HTMLElement&&t.target.className.includes("g6-contextmenu-li")){const n=t.target.getAttribute("value");null==e||e(n,t.target,this.targetElement),this.hide()}"click"!==n&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=ez("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.$element.addEventListener("wheel",this.wheelHandler);this.context.canvas.getContainer().appendChild(this.$element),nz("g6-contextmenu-css","style",{},"\n .g6-contextmenu {\n font-size: 12px;\n background-color: rgba(255, 255, 255, 0.96);\n border-radius: 4px;\n overflow-x: hidden;\n overflow-y: auto;\n max-height: calc(100% - 8px);\n box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px;\n transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s;\n }\n\n .g6-contextmenu::-webkit-scrollbar {\n width: 6px;\n }\n\n .g6-contextmenu::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.2);\n border-radius: 3px;\n }\n\n .g6-contextmenu::-webkit-scrollbar-thumb:hover {\n background-color: rgba(0, 0, 0, 0.3);\n }\n\n .g6-contextmenu-ul {\n max-width: 256px;\n min-width: 96px;\n list-style: none;\n padding: 0;\n margin: 0;\n }\n\n .g6-contextmenu-li {\n padding: 8px 12px;\n cursor: pointer;\n user-select: none;\n }\n\n .g6-contextmenu-li:hover {\n background-color: #f5f5f5;\n cursor: pointer;\n }\n",document.head)}show(t){return De(this,void 0,void 0,function*(){const{enable:e,offset:n}=this.options;if("function"==typeof e&&!e(t)||!e)return void this.hide();const r=yield this.getDOMContent(t);r instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(r)):this.$element.innerHTML=r;const i=this.context.graph.getCanvas().getContainer().getBoundingClientRect();let o=t.client.x-i.left+n[0],A=t.client.y-i.top+n[1];this.$element.style.display="block";const s=this.$element.offsetWidth,a=this.$element.offsetHeight,c=i.width,l=i.height;o=Math.max(4,Math.min(o,c-s-4)),A=Math.max(4,Math.min(A,l-a-4)),this.$element.style.left=`${o}px`,this.$element.style.top=`${A}px`,this.targetElement=t.target})}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return De(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?`\n <ul class="g6-contextmenu-ul">\n ${(yield n(t)).map(t=>`<li class="g6-contextmenu-li" value="${t.value}">${t.name}</li>`).join("")}\n </ul>\n `:yield e(t)})}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick),this.$element.removeEventListener("wheel",this.wheelHandler)}}Kz.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'<div class="g6-contextmenu-loading">Loading...</div>',getContent:()=>"It is a empty context menu.",enable:()=>!0};class jz extends tz{constructor(t,e){super(t,Object.assign({},jz.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:t,element:e}=this.context,n=t.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:r,iterRate:i,divRate:o}=this.options;let{lambda:A,divisions:s,iterations:a}=this.options;for(let t=0;t<r;t++){for(let t=0;t<a;t++){const t={};n.forEach(e=>{var n;if(e.source===e.target)return;const r=Km(e);t[r]=this.getEdgeForces(e,s,A);for(let e=0;e<s+1;e++)(n=this.edgePoints)[r]||(n[r]=[]),this.edgePoints[r][e]=ay(this.edgePoints[r][e],t[r][e])})}A/=2,s*=o,a*=i,this.divideEdges(s)}n.forEach(t=>{const n=Km(t),r=e.getElement(n);null==r||r.update({d:dB(this.edgePoints[n])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(t=>[Km(t),yy(My(t))]))}divideEdges(t){this.context.model.getEdgeData().forEach(e=>{var n;const r=Km(e);(n=this.edgePoints)[r]||(n[r]=[]);const i=this.nodeMap[e.source],o=this.nodeMap[e.target];if(1===t)this.edgePoints[r].push(i),this.edgePoints[r].push(uy(ay(i,o),2)),this.edgePoints[r].push(o);else{const e=(0===this.edgePoints[r].length?dy(i,o):$z(this.edgePoints[r]))/(t+1);let n=e;const A=[i];for(let t=1;t<this.edgePoints[r].length;t++){const i=this.edgePoints[r][t-1],o=this.edgePoints[r][t];let s=dy(o,i);for(;s>n;){const t=n/s,r=ay(i,ly(cy(o,i),t));A.push(r),s-=n,n=e}n-=s}A.push(o),this.edgePoints[r]=A}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[r,i]=cy(n,e);return{source:e,target:n,vx:r,vy:i,length:dy(e,n)}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),r=this.getVectorPosition(e);return zz(n,r)*Vz(n,r)*Wz(n,r)*qz(n,r)}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((r,i)=>{n.forEach((n,o)=>{var A,s;if(o<=i)return;this.measureEdgeCompatibility(r,n)>=e&&(t[A=Km(r)]||(t[A]=[]),t[Km(r)].push(n),t[s=Km(n)]||(t[s]=[]),t[Km(n)].push(r))})}),t}getSpringForce(t,e){const{pre:n,cur:r,next:i}=t;return ly(cy(ay(n,i),ly(r,2)),e)}getElectrostaticForce(t,e){Ee(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[Km(e)];let r=[0,0];return null==n||n.forEach(n=>{const i=this.edgePoints[Km(n)][t],o=this.edgePoints[Km(e)][t],A=cy(i,o),s=dy(i,o);r=ay(r,ly(A,1/s))}),r}getEdgeForces(t,e,n){const r=this.nodeMap[t.source],i=this.nodeMap[t.target],o=this.options.K/(dy(r,i)*(e+1)),A=[[0,0]],s=Km(t);for(let r=1;r<e;r++){const e=this.getSpringForce({pre:this.edgePoints[s][r-1],cur:this.edgePoints[s][r],next:this.edgePoints[s][r+1]||[0,0]},o),i=this.getElectrostaticForce(r,t);A.push(ly(ay(e,i),n))}return A.push([0,0]),A}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_RENDER,this.onBundle)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_RENDER,this.onBundle)}destroy(){this.unbindEvents(),super.destroy()}}jz.defaultOptions={K:.1,lambda:.1,divisions:1,divRate:2,cycles:6,iterations:90,iterRate:2/3,bundleThreshold:.6};const zz=(t,e)=>Math.abs(function(t,e){return[t,e]=sy(t,e),t.reduce((t,n,r)=>t+n*e[r],0)}([t.vx,t.vy],[e.vx,e.vy])/(t.length*e.length)),Vz=(t,e)=>{const n=(t.length+e.length)/2;return 2/(n/Math.min(t.length,e.length)+Math.max(t.length,e.length)/n)},Wz=(t,e)=>{const n=(t.length+e.length)/2;return n/(n+dy(uy(ay(t.source,t.target),2),uy(ay(e.source,e.target),2)))},Yz=(t,e)=>{if(e.source[0]===e.target[0])return[e.source[0],t[1]];if(e.source[1]===e.target[1])return[t[0],e.source[1]];const n=(e.source[1]-e.target[1])/(e.source[0]-e.target[0]),r=(n*n*e.source[0]+n*(t[1]-e.source[1])+t[0])/(n*n+1);return[r,n*(r-e.source[0])+e.source[1]]},Xz=(t,e)=>{const n=Yz(e.source,t),r=Yz(e.target,t),i=uy(ay(n,r),2),o=uy(ay(t.source,t.target),2);return 0===dy(n,r)?0:Math.max(0,1-2*dy(o,i)/dy(n,r))},qz=(t,e)=>Math.min(Xz(t,e),Xz(e,t)),$z=t=>{let e=0;for(let n=1;n<t.length;n++)e+=dy(t[n],t[n-1]);return e},Zz={fill:"#fff",fillOpacity:1,lineWidth:1,stroke:"#000",strokeOpacity:.8,zIndex:-1/0};class Jz extends tz{constructor(t,e){super(t,Object.assign({},Jz.defaultOptions,e)),this.shapes=new Map,this.r=this.options.r,this.onEdgeFilter=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=Sy(t.canvas);this.renderLens(e),this.renderFocusElements()},this.renderLens=t=>{const e=Object.assign({},Zz,this.options.style);this.isLensOn||(this.lens=new Tw({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,Qy(t),{size:2*this.r}),this.lens.update(e)},this.getFilterData=()=>{const{filter:t}=this.options,{model:e}=this.context,n=e.getData();if(!t)return n;const{nodes:r,edges:i,combos:o}=n;return{nodes:r.filter(e=>t(Km(e),"node")),edges:i.filter(e=>t(Km(e),"edge")),combos:o.filter(e=>t(Km(e),"combo"))}},this.getFocusElements=t=>{const{nodes:e,edges:n}=this.getFilterData(),r=e.filter(e=>dy(My(e),t)<this.r),i=r.map(t=>Km(t));return{nodes:r,edges:n.filter(t=>{const{source:e,target:n}=t,r=i.includes(e),o=i.includes(n);switch(this.options.nodeType){case"both":return r&&o;case"either":return r!==o;case"source":return r&&!o;case"target":return!r&&o;default:return!1}})}},this.renderFocusElements=()=>{const{element:t,graph:e}=this.context;if(!this.isLensOn)return;const n=this.lens.getCenter(),{nodes:r,edges:i}=this.getFocusElements(n),o=new Set,A=n=>{const r=Km(n);o.add(r);const i=t.getElement(r);if(!i)return;const A=this.shapes.get(r)||i.cloneNode();A.setPosition(i.getPosition()),A.id=i.id,this.shapes.has(r)?Object.entries(i.attributes).forEach(([t,e])=>{A.style[t]!==e&&(A.style[t]=e)}):(this.canvas.appendChild(A),this.shapes.set(r,A));const s=e.getElementType(r),a=this.getElementStyle(s,n);A.update(a)};r.forEach(A),i.forEach(A),this.shapes.forEach((t,e)=>{o.has(e)||(t.destroy(),this.shapes.delete(e))})},this.scaleRByWheel=t=>{var e;this.options.preventDefault&&t.preventDefault();const{clientX:n,clientY:r,deltaX:i,deltaY:o}=t,{graph:A,canvas:s}=this.context,a=A.getCanvasByClient([n,r]),c=null===(e=this.lens)||void 0===e?void 0:e.getCenter();if(!this.isLensOn||dy(a,c)>this.r)return;const{maxR:l,minR:u}=this.options,h=i+o>0?1/.95:.95,d=Math.min(...s.getSize())/2;this.r=Math.max(u||0,Math.min(l||d,this.r*h)),this.renderLens(c),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=t=>{var e;const n=Sy(t.canvas),r=null===(e=this.lens)||void 0===e?void 0:e.getCenter();!this.isLensOn||dy(n,r)>this.r||(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=Sy(t.canvas);this.renderLens(e),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n="node"===t?this.options.nodeStyle:this.options.edgeStyle;return"function"==typeof n?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.addEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.addEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.addEventListener(t.CommonEvent.DRAG,this.onDrag),o.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i}=this.options,o=n.getCanvas().getLayer();["click","drag"].includes(r)&&o.removeEventListener(t.CommonEvent.CLICK,this.onEdgeFilter),"pointermove"===r?o.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onEdgeFilter):"drag"===r&&(o.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),o.removeEventListener(t.CommonEvent.DRAG,this.onDrag),o.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd)),"wheel"===i&&(null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,this.scaleRByWheel))}update(t){var e;this.unbindEvents(),super.update(t),this.r=null!==(e=t.r)&&void 0!==e?e:this.r,this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}Jz.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const tV={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12};class eV extends tz{constructor(t,e){super(t,Object.assign({},eV.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=t=>{if("drag"===this.options.trigger&&this.isLensOn)return;const e=Sy(t.canvas);this.onMagnify(e)},this.onMagnify=t=>{t.some(isNaN)||(this.renderLens(t),this.renderFocusElements())},this.renderLens=t=>{const e=Object.assign({},tV,this.options.style);this.isLensOn||(this.lens=new Tw({style:e}),this.canvas.appendChild(this.lens)),Object.assign(e,Qy(t),{size:2*this.r,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(e)},this.getDPercent=()=>{const{minD:t,maxD:e}=this.options;return`${Math.round((this.d-t)/(e-t)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:t}=this.context,e=this.lens.getCenter(),n=(this.d+1)*this.r,r=new Map,i=new Map;t.getNodeData().forEach(o=>{const A=My(o),s=dy(A,e);if(s>this.r)return;const a=n*s/(this.d*s+this.r),[c,l]=A,[u,h]=e,d=[u+a*((c-u)/s),h+a*((l-h)/s)],f=Km(o),g=this.getNodeStyle(o),p=ke(t.getElementRenderStyle(f),Object.keys(g));r.set(f,Object.assign(Object.assign({},Qy(d)),g)),i.set(f,Object.assign(Object.assign({},Qy(A)),p))}),this.updateStyle(r,i)},this.getNodeStyle=t=>{const{nodeStyle:e}=this.options;return"function"==typeof e?e(t):e},this.updateStyle=(t,e)=>{const{graph:n,element:r}=this.context,{enter:i,exit:o,keep:A}=ty(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(t.keys()),t=>t),s=new Set,a=(t,e)=>{const i=r.getElement(t);null==i||i.update(e),n.getRelatedEdgesData(t).forEach(t=>{s.add(Km(t))})};[...i,...A].forEach(e=>{a(e,t.get(e))}),o.forEach(t=>{a(t,this.prevOriginStyleMap.get(t)),this.prevOriginStyleMap.delete(t)}),s.forEach(t=>{const e=r.getElement(t);null==e||e.update({})}),this.prevMagnifiedStyleMap=t,e.forEach((t,e)=>{this.prevOriginStyleMap.has(e)||this.prevOriginStyleMap.set(e,t)})},this.isWheelValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;const{clientX:e,clientY:n}=t;return!(dy(this.context.graph.getCanvasByClient([e,n]),this.lens.getCenter())>this.r)},this.scaleR=t=>{const{maxR:e,minR:n}=this.options,r=t?1/.95:.95,i=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(n||0,Math.min(e||i,this.r*r))},this.scaleD=t=>{const{maxD:e,minD:n}=this.options,r=t?this.d+.1:this.d-.1;this.d=Math.max(n,Math.min(e,r))},this.scaleRByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleR(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByWheel=t=>{if(!this.isWheelValid(t))return;const{deltaX:e,deltaY:n}=t;this.scaleD(e+n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.isDragValid=t=>{if(this.options.preventDefault&&t.preventDefault(),!this.isLensOn)return!1;return!(dy(Sy(t.canvas),this.lens.getCenter())>this.r)},this.isLensDragging=!1,this.onDragStart=t=>{this.isDragValid(t)&&(this.isLensDragging=!0)},this.onDrag=t=>{if(!this.isLensDragging)return;const e=Sy(t.canvas);this.onMagnify(e)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleR(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.scaleDByDrag=t=>{if(!this.isLensDragging)return;const{dx:e,dy:n}=t;this.scaleD(e-n>0);const r=this.lens.getCenter();this.onMagnify(r)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,A=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&A.addEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&A.addEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){A.addEventListener(t.CommonEvent.DRAG_START,this.onDragStart),A.addEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;A.addEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.addEventListener(t.CommonEvent.WHEEL,n,{passive:!1})}}unbindEvents(){var e;const{graph:n}=this.context,{trigger:r,scaleRBy:i,scaleDBy:o}=this.options,A=n.getCanvas().getLayer();if(["click","drag"].includes(r)&&A.removeEventListener(t.CommonEvent.CLICK,this.onCreateFisheye),"pointermove"===r&&A.removeEventListener(t.CommonEvent.POINTER_MOVE,this.onCreateFisheye),"drag"===r||"drag"===i||"drag"===o){A.removeEventListener(t.CommonEvent.DRAG_START,this.onDragStart),A.removeEventListener(t.CommonEvent.DRAG_END,this.onDragEnd);const e="drag"===r?this.onDrag:"drag"===i?this.scaleRByDrag:this.scaleDByDrag;A.removeEventListener(t.CommonEvent.DRAG,e)}if("wheel"===i||"wheel"===o){const n="wheel"===i?this.scaleRByWheel:this.scaleDByWheel;null===(e=this.graphDom)||void 0===e||e.removeEventListener(t.CommonEvent.WHEEL,n)}}update(t){var e,n;this.unbindEvents(),super.update(t),this.r=null!==(e=t.r)&&void 0!==e?e:this.r,this.d=null!==(n=t.d)&&void 0!==n?n:this.d,this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&(null===(t=this.lens)||void 0===t||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}eV.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class nV extends tz{constructor(t,e){super(t,Object.assign({},nV.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var t,e,n,r;const i=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(i),i?null===(e=(t=this.options).onEnter)||void 0===e||e.call(t):null===(r=(n=this.options).onExit)||void 0===r||r.call(n)},this.shortcut=new Wy(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML="\n :not(:root):fullscreen::backdrop {\n background: transparent;\n }\n "}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit);["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(t=>{document.addEventListener(t,this.onFullscreenChange,!1)})}unbindEvents(){this.shortcut.unbindAll();["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(t=>{document.removeEventListener(t,this.onFullscreenChange,!1)})}setGraphSize(t=!0){var e,n;let r,i;t?(r=(null===(e=globalThis.screen)||void 0===e?void 0:e.width)||0,i=(null===(n=globalThis.screen)||void 0===n?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[r,i]=this.graphSize,this.context.graph.setSize(r,i),this.context.graph.render()}request(){!document.fullscreenElement&&(document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled"))&&this.$el.requestFullscreen().catch(t=>{Zv(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}nV.defaultOptions={trigger:{},autoFit:!0};class rV extends tz{constructor(t,e){super(t,Object.assign({},rV.defaultOptions,e)),this.$element=ez("grid-line",!0),this.offset=[0,0],this.currentScale=1,this.followZoom=t=>{const{data:{scale:e,origin:n}}=t;if(!e||void 0===n&&void 0===this.context.viewport)return;const r=this.currentScale;this.currentScale=e;const i=e/r,o=ly(n||this.context.graph.getCanvasCenter(),1-i),A=this.baseSize*e,s=ay(my(ly(this.offset,i),A),o);this.$element.style.backgroundSize=`${A}px ${A}px`,this.$element.style.backgroundPosition=`${s[0]}px ${s[1]}px`,this.offset=my(s,A)},this.followTranslate=t=>{if(!this.options.follow)return;const{data:{translate:e}}=t;e&&this.updateOffset(e)},this.onTransform=t=>{const e=this.parseFollow(this.options.follow);e.zoom&&this.followZoom(t),e.translate&&this.followTranslate(t)};this.context.canvas.getContainer().prepend(this.$element),this.baseSize=this.options.size,this.updateStyle(),this.bindEvents()}update(t){super.update(t),void 0!==t.size&&(this.baseSize=t.size),this.updateStyle()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{stroke:t,lineWidth:e,border:n,borderLineWidth:r,borderStroke:i,borderStyle:o}=this.options,A=this.baseSize*this.currentScale;Object.assign(this.$element.style,{border:n?`${r}px ${o} ${i}`:"none",backgroundImage:`linear-gradient(${t} ${e}px, transparent ${e}px), linear-gradient(90deg, ${t} ${e}px, transparent ${e}px)`,backgroundSize:`${A}px ${A}px`,backgroundRepeat:"repeat"})}updateOffset(t){const e=this.baseSize*this.currentScale;this.offset=my(ay(this.offset,t),e),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}parseFollow(t){var e,n;return ue(t)?{translate:t,zoom:t}:{translate:null!==(e=null==t?void 0:t.translate)&&void 0!==e&&e,zoom:null!==(n=null==t?void 0:t.zoom)&&void 0!==n&&n}}destroy(){this.context.graph.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}function iV(t){const e={Added:new Map,Updated:new Map,Removed:new Map};return t.forEach(t=>{const{type:n,value:r}=t,i=Km(r);if("NodeAdded"===n||"EdgeAdded"===n||"ComboAdded"===n)e.Added.set(i,t);else if("NodeUpdated"===n||"EdgeUpdated"===n||"ComboUpdated"===n)if(e.Added.has(i))e.Added.set(i,{type:n.replace("Updated","Added"),value:r});else if(e.Updated.has(i)){const{original:t}=e.Updated.get(i);e.Updated.set(i,{type:n,value:r,original:t})}else e.Removed.has(i)||e.Updated.set(i,t);else"NodeRemoved"!==n&&"EdgeRemoved"!==n&&"ComboRemoved"!==n||(e.Added.has(i)?e.Added.delete(i):e.Updated.has(i)?(e.Updated.delete(i),e.Removed.set(i,t)):e.Removed.set(i,t))}),[...Array.from(e.Added.values()),...Array.from(e.Updated.values()),...Array.from(e.Removed.values())]}function oV(t){const{NodeAdded:e=[],NodeUpdated:n=[],NodeRemoved:r=[],EdgeAdded:i=[],EdgeUpdated:o=[],EdgeRemoved:A=[],ComboAdded:s=[],ComboUpdated:a=[],ComboRemoved:c=[]}=ee(t,t=>t.type);return{add:{nodes:e,edges:i,combos:s},update:{nodes:n,edges:o,combos:a},remove:{nodes:r,edges:A,combos:c}}}function AV(t,e){for(const n in t)zt(t[n])&&!Array.isArray(t[n])&&null!==t[n]?(e[n]||(e[n]={}),AV(t[n],e[n])):void 0===e[n]&&(e[n]=nm(n))}function sV(t,e=!1,n){const r={animation:e,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:o,remove:A}=oV(iV(t));return["nodes","edges","combos"].forEach(t=>{o[t]&&o[t].forEach(e=>{var i,o;const A=Object.assign({},e.value);let s=Object.assign({},e.original);if(n){const t=n.graph.getElementType(Km(e.original)),r="edge"===t?"stroke":"fill",i=n.element.getElementComputedStyle(t,e.original);s=Object.assign(Object.assign({},e.original),{style:Object.assign({[r]:i[r]},e.original.style)})}AV(A,s),(i=r.current.update)[t]||(i[t]=[]),r.current.update[t].push(A),(o=r.original.update)[t]||(o[t]=[]),r.original.update[t].push(s)}),i[t]&&i[t].forEach(e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.add)[t]||(n[t]=[]),r.current.add[t].push(o),(i=r.original.remove)[t]||(i[t]=[]),r.original.remove[t].push(o)}),A[t]&&A[t].forEach(e=>{var n,i;const o=Object.assign({},e.value);(n=r.current.remove)[t]||(n[t]=[]),r.current.remove[t].push(o),(i=r.original.add)[t]||(i[t]=[]),r.original.add[t].push(o)})}),r}rV.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};class aV extends tz{constructor(e,n){super(e,Object.assign({},aV.defaultOptions,n)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(t,e=!0)=>{var n,r,i;this.freezed=!0,null===(r=(n=this.options).executeCommand)||void 0===r||r.call(n,t);const o=e?t.original:t.current;this.context.graph.addData(o.add),this.context.graph.updateData(o.update),this.context.graph.removeData(zm(o.remove,!1)),null===(i=this.context.element)||void 0===i||i.draw({silence:!0,animation:t.animation}),this.freezed=!1},this.addCommand=e=>{var n;if(!this.freezed){if(e.type===t.GraphEvent.AFTER_DRAW){const{dataChanges:t=[],animation:r=!0}=e.data;if(null===(n=this.context.batch)||void 0===n?void 0:n.isBatching){if(!this.batchChanges)return;return this.batchChanges.push(t),void(this.batchAnimation&&(this.batchAnimation=r))}this.batchChanges=[t],this.batchAnimation=r}this.undoStackPush(sV(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(t.HistoryEvent.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=t=>{const{initiate:e}=t.data;if(this.batchAnimation=!1,e)this.batchChanges=[];else{this.undoStack.pop()||(this.batchChanges=null)}},this.emitter=new hE;const{graph:r}=this.context;r.on(t.GraphEvent.AFTER_DRAW,this.addCommand),r.on(t.GraphEvent.BATCH_START,this.initBatchCommand),r.on(t.GraphEvent.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var e,n,r,i;const o=this.undoStack.pop();if(o){this.executeCommand(o);if(!1===(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,o,!1)))return;this.redoStack.push(o),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,o,!1),this.notify(t.HistoryEvent.UNDO,o)}return this}redo(){const e=this.redoStack.pop();return e&&(this.executeCommand(e,!1),this.undoStackPush(e),this.notify(t.HistoryEvent.REDO,e)),this}undoAndCancel(){const e=this.undoStack.pop();return e&&(this.executeCommand(e,!1),this.redoStack=[],this.notify(t.HistoryEvent.CANCEL,e)),this}undoStackPush(t){var e,n,r,i;const{stackSize:o}=this.options;0!==o&&this.undoStack.length>=o&&this.undoStack.shift();!1!==(null===(n=(e=this.options).beforeAddCommand)||void 0===n?void 0:n.call(e,t,!0))&&(this.undoStack.push(t),null===(i=(r=this.options).afterAddCommand)||void 0===i||i.call(r,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(t.HistoryEvent.CLEAR,null)}notify(e,n){this.emitter.emit(e,{cmd:n}),this.emitter.emit(t.HistoryEvent.CHANGE,{cmd:n})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.addCommand),e.off(t.GraphEvent.BATCH_START,this.initBatchCommand),e.off(t.GraphEvent.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}aV.defaultOptions={stackSize:0};const cV={toXy(t,e){if(!e)return[...t];const n=e[0].slice(1),r=e[1].slice(1);return t.map(t=>[t[n],t[r]])},fromXy(t,e){if(!e)return[...t];const n=e[0].slice(1),r=e[1].slice(1);return t.map(([t,e])=>({[n]:t,[r]:e}))}};let lV=class{constructor(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(const e of t){const t=this.coordToCellNum(e[0]),n=this.coordToCellNum(e[1]);this._cells[t]||(this._cells[t]=[]),this._cells[t][n]||(this._cells[t][n]=[]),this._cells[t][n].push(e)}}cellPoints(t,e){var n;return(null===(n=this._cells[t])||void 0===n?void 0:n[e])||[]}rangePoints(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this.coordToCellNum(t[2]),i=this.coordToCellNum(t[3]),o=[];for(let t=e;t<=r;t++)for(let e=n;e<=i;e++){const n=this.cellPoints(t,e);for(const t of n)o.push(t)}return o}removePoint(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),r=this._cells[e][n],i=r.findIndex(([e,n])=>e===t[0]&&n===t[1]);return i>-1&&r.splice(i,1),r}trunc(t){return Math.trunc(t)}coordToCellNum(t){return this.trunc(t*this._reverseCellSize)}extendBbox(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}};const uV=+(Math.pow(2,27)+1);function hV(t,e,n){const r=t*e,i=uV*t,o=i-(i-t),A=t-o,s=uV*e,a=s-(s-e),c=e-a,l=A*c-(r-o*a-A*a-o*c);return n?(n[0]=l,n[1]=r,n):[l,r]}function dV(t,e,n){const r=t+e,i=r-t,o=e-i,A=t-(r-i);return n?(n[0]=A+o,n[1]=r,n):[A+o,r]}function fV(t,e){const n=t.length;if(1===n){const n=hV(t[0],e);return n[0]?n:[n[1]]}const r=new Array(2*n),i=[.1,.1],o=[.1,.1];let A=0;hV(t[0],e,i),i[0]&&(r[A++]=i[0]);for(let s=1;s<n;++s){hV(t[s],e,o);dV(i[1],o[0],i),i[0]&&(r[A++]=i[0]);const n=o[1],a=i[1],c=n+a,l=a-(c-n);i[1]=c,l&&(r[A++]=l)}return i[1]&&(r[A++]=i[1]),0===A&&(r[A++]=0),r.length=A,r}function gV(t,e){const n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){const n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],-e[0]);const i=new Array(n+r);let o=0,A=0,s=0;const a=Math.abs;let c,l,u=t[A],h=a(u),d=-e[s],f=a(d);h<f?(l=u,A+=1,A<n&&(u=t[A],h=a(u))):(l=d,s+=1,s<r&&(d=-e[s],f=a(d))),A<n&&h<f||s>=r?(c=u,A+=1,A<n&&(u=t[A],h=a(u))):(c=d,s+=1,s<r&&(d=-e[s],f=a(d)));let g,p,v,m,y,w=c+l,b=w-c,B=l-b,E=B,x=w;for(;A<n&&s<r;)h<f?(c=u,A+=1,A<n&&(u=t[A],h=a(u))):(c=d,s+=1,s<r&&(d=-e[s],f=a(d))),l=E,w=c+l,b=w-c,B=l-b,B&&(i[o++]=B),g=x+w,p=g-x,v=g-p,m=w-p,y=x-v,E=y+m,x=g;for(;A<n;)c=u,l=E,w=c+l,b=w-c,B=l-b,B&&(i[o++]=B),g=x+w,p=g-x,v=g-p,m=w-p,y=x-v,E=y+m,x=g,A+=1,A<n&&(u=t[A]);for(;s<r;)c=d,l=E,w=c+l,b=w-c,B=l-b,B&&(i[o++]=B),g=x+w,p=g-x,v=g-p,m=w-p,y=x-v,E=y+m,x=g,s+=1,s<r&&(d=-e[s]);return E&&(i[o++]=E),x&&(i[o++]=x),o||(i[o++]=0),i.length=o,i}function pV(t,e){const n=0|t.length,r=0|e.length;if(1===n&&1===r)return function(t,e){const n=t+e,r=n-t,i=t-(n-r)+(e-r);return i?[i,n]:[n]}(t[0],e[0]);const i=new Array(n+r);let o=0,A=0,s=0;const a=Math.abs;let c,l,u=t[A],h=a(u),d=e[s],f=a(d);h<f?(l=u,A+=1,A<n&&(u=t[A],h=a(u))):(l=d,s+=1,s<r&&(d=e[s],f=a(d))),A<n&&h<f||s>=r?(c=u,A+=1,A<n&&(u=t[A],h=a(u))):(c=d,s+=1,s<r&&(d=e[s],f=a(d)));let g,p,v,m,y,w=c+l,b=w-c,B=l-b,E=B,x=w;for(;A<n&&s<r;)h<f?(c=u,A+=1,A<n&&(u=t[A],h=a(u))):(c=d,s+=1,s<r&&(d=e[s],f=a(d))),l=E,w=c+l,b=w-c,B=l-b,B&&(i[o++]=B),g=x+w,p=g-x,v=g-p,m=w-p,y=x-v,E=y+m,x=g;for(;A<n;)c=u,l=E,w=c+l,b=w-c,B=l-b,B&&(i[o++]=B),g=x+w,p=g-x,v=g-p,m=w-p,y=x-v,E=y+m,x=g,A+=1,A<n&&(u=t[A]);for(;s<r;)c=d,l=E,w=c+l,b=w-c,B=l-b,B&&(i[o++]=B),g=x+w,p=g-x,v=g-p,m=w-p,y=x-v,E=y+m,x=g,s+=1,s<r&&(d=e[s]);return E&&(i[o++]=E),x&&(i[o++]=x),o||(i[o++]=0),i.length=o,i}function vV(t,e,n,r){return function(n,i,o){const A=t(t(e(i[1],o[0]),e(-o[1],i[0])),t(e(n[1],i[0]),e(-i[1],n[0]))),s=t(e(n[1],o[0]),e(-o[1],n[0])),a=r(A,s);return a[a.length-1]}}function mV(t,e,n,r){return function(i,o,A,s){const a=t(t(n(t(e(A[1],s[0]),e(-s[1],A[0])),o[2]),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),-A[2]),n(t(e(o[1],A[0]),e(-A[1],o[0])),s[2]))),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),s[2])))),c=t(t(n(t(e(A[1],s[0]),e(-s[1],A[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-A[2]),n(t(e(i[1],A[0]),e(-A[1],i[0])),s[2]))),t(n(t(e(o[1],A[0]),e(-A[1],o[0])),i[2]),t(n(t(e(i[1],A[0]),e(-A[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),A[2])))),l=r(a,c);return l[l.length-1]}}function yV(t,e,n,r){return function(i,o,A,s,a){const c=t(t(t(n(t(n(t(e(s[1],a[0]),e(-a[1],s[0])),A[2]),t(n(t(e(A[1],a[0]),e(-a[1],A[0])),-s[2]),n(t(e(A[1],s[0]),e(-s[1],A[0])),a[2]))),o[3]),t(n(t(n(t(e(s[1],a[0]),e(-a[1],s[0])),o[2]),t(n(t(e(o[1],a[0]),e(-a[1],o[0])),-s[2]),n(t(e(o[1],s[0]),e(-s[1],o[0])),a[2]))),-A[3]),n(t(n(t(e(A[1],a[0]),e(-a[1],A[0])),o[2]),t(n(t(e(o[1],a[0]),e(-a[1],o[0])),-A[2]),n(t(e(o[1],A[0]),e(-A[1],o[0])),a[2]))),s[3]))),t(n(t(n(t(e(A[1],s[0]),e(-s[1],A[0])),o[2]),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),-A[2]),n(t(e(o[1],A[0]),e(-A[1],o[0])),s[2]))),-a[3]),t(n(t(n(t(e(s[1],a[0]),e(-a[1],s[0])),o[2]),t(n(t(e(o[1],a[0]),e(-a[1],o[0])),-s[2]),n(t(e(o[1],s[0]),e(-s[1],o[0])),a[2]))),i[3]),n(t(n(t(e(s[1],a[0]),e(-a[1],s[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-s[2]),n(t(e(i[1],s[0]),e(-s[1],i[0])),a[2]))),-o[3])))),t(t(n(t(n(t(e(o[1],a[0]),e(-a[1],o[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),a[2]))),s[3]),t(n(t(n(t(e(o[1],s[0]),e(-s[1],o[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),s[2]))),-a[3]),n(t(n(t(e(A[1],s[0]),e(-s[1],A[0])),o[2]),t(n(t(e(o[1],s[0]),e(-s[1],o[0])),-A[2]),n(t(e(o[1],A[0]),e(-A[1],o[0])),s[2]))),i[3]))),t(n(t(n(t(e(A[1],s[0]),e(-s[1],A[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-A[2]),n(t(e(i[1],A[0]),e(-A[1],i[0])),s[2]))),-o[3]),t(n(t(n(t(e(o[1],s[0]),e(-s[1],o[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),s[2]))),A[3]),n(t(n(t(e(o[1],A[0]),e(-A[1],o[0])),i[2]),t(n(t(e(i[1],A[0]),e(-A[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),A[2]))),-s[3]))))),l=t(t(t(n(t(n(t(e(s[1],a[0]),e(-a[1],s[0])),A[2]),t(n(t(e(A[1],a[0]),e(-a[1],A[0])),-s[2]),n(t(e(A[1],s[0]),e(-s[1],A[0])),a[2]))),i[3]),n(t(n(t(e(s[1],a[0]),e(-a[1],s[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-s[2]),n(t(e(i[1],s[0]),e(-s[1],i[0])),a[2]))),-A[3])),t(n(t(n(t(e(A[1],a[0]),e(-a[1],A[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-A[2]),n(t(e(i[1],A[0]),e(-A[1],i[0])),a[2]))),s[3]),n(t(n(t(e(A[1],s[0]),e(-s[1],A[0])),i[2]),t(n(t(e(i[1],s[0]),e(-s[1],i[0])),-A[2]),n(t(e(i[1],A[0]),e(-A[1],i[0])),s[2]))),-a[3]))),t(t(n(t(n(t(e(A[1],a[0]),e(-a[1],A[0])),o[2]),t(n(t(e(o[1],a[0]),e(-a[1],o[0])),-A[2]),n(t(e(o[1],A[0]),e(-A[1],o[0])),a[2]))),i[3]),n(t(n(t(e(A[1],a[0]),e(-a[1],A[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-A[2]),n(t(e(i[1],A[0]),e(-A[1],i[0])),a[2]))),-o[3])),t(n(t(n(t(e(o[1],a[0]),e(-a[1],o[0])),i[2]),t(n(t(e(i[1],a[0]),e(-a[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),a[2]))),A[3]),n(t(n(t(e(o[1],A[0]),e(-A[1],o[0])),i[2]),t(n(t(e(i[1],A[0]),e(-A[1],i[0])),-o[2]),n(t(e(i[1],o[0]),e(-o[1],i[0])),A[2]))),-a[3])))),u=r(c,l);return u[u.length-1]}}function wV(t){return(3===t?vV:4===t?mV:yV)(pV,hV,fV,gV)}const bV=wV(3),BV=wV(4),EV=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,n){const r=(t[1]-n[1])*(e[0]-n[0]),i=(t[0]-n[0])*(e[1]-n[1]),o=r-i;let A;if(r>0){if(i<=0)return o;A=r+i}else{if(!(r<0))return o;if(i>=0)return o;A=-(r+i)}const s=33306690738754716e-32*A;return o>=s||o<=-s?o:bV(t,e,n)},function(t,e,n,r){const i=t[0]-r[0],o=e[0]-r[0],A=n[0]-r[0],s=t[1]-r[1],a=e[1]-r[1],c=n[1]-r[1],l=t[2]-r[2],u=e[2]-r[2],h=n[2]-r[2],d=o*c,f=A*a,g=A*s,p=i*c,v=i*a,m=o*s,y=l*(d-f)+u*(g-p)+h*(v-m),w=7771561172376103e-31*((Math.abs(d)+Math.abs(f))*Math.abs(l)+(Math.abs(g)+Math.abs(p))*Math.abs(u)+(Math.abs(v)+Math.abs(m))*Math.abs(h));return y>w||-y>w?y:BV(t,e,n,r)}];function xV(t){let e=EV[t.length];return e||(e=EV[t.length]=wV(t.length)),e.apply(void 0,...t)}var CV=function(){for(;EV.length<=5;)EV.push(wV(EV.length));const t=function(t,e,n,r,i,o,A){return function(...e){switch(e.length){case 0:case 1:return 0;case 2:return r(e[0],e[1]);case 3:return i(e[0],e[1],e[2]);case 4:return o(e[0],e[1],e[2],e[3]);case 5:return A(e[0],e[1],e[2],e[3],e[4])}return t(e)}}(void 0,xV,...EV);for(let e=0;e<=5;++e)t[e]=EV[e];return t}();const MV=CV[3];function FV(t,e,n,r){const i=CV(t,n,r),o=CV(e,n,r);if(i>0&&o>0||i<0&&o<0)return!1;const A=CV(n,t,e),s=CV(r,t,e);return!(A>0&&s>0||A<0&&s<0)&&(0!==i||0!==o||0!==A||0!==s||function(t,e,n,r){for(let i=0;i<2;++i){const o=t[i],A=e[i],[s,a]=[Math.min(o,A),Math.max(o,A)],c=n[i],l=r[i],[u,h]=[Math.min(c,l),Math.max(c,l)];if(h<s||a<u)return!1}return!0}(t,e,n,r))}function kV(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function SV(t,e,n){const r=[e[0]-t[0],e[1]-t[1]],i=[n[0]-t[0],n[1]-t[1]],o=kV(t,e),A=kV(t,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(o*A)}function QV(t,e){for(let n=0;n<e.length-1;n++){const r=[e[n],e[n+1]];if(!(t[0][0]===r[0][0]&&t[0][1]===r[0][1]||t[0][0]===r[1][0]&&t[0][1]===r[1][1])&&FV(t[0],t[1],r[0],r[1]))return!0}return!1}function UV(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function NV(t,e,n){let r,i,o=null,A=IV,s=IV;for(let a=0;a<e.length;a++)r=SV(t[0],t[1],e[a]),i=SV(t[1],t[0],e[a]),r>A&&i>s&&!QV([t[0],e[a]],n)&&!QV([t[1],e[a]],n)&&(A=r,s=i,o=e[a]);return o}function TV(t,e,n,r,i){let o=!1;for(let A=0;A<t.length-1;A++){const s=[t[A],t[A+1]],a=s[0][0]+","+s[0][1]+","+s[1][0]+","+s[1][1];if(kV(s[0],s[1])<e||i.has(a))continue;let c,l,u,h=0,d=UV(s);do{d=r.extendBbox(d,h),c=d[2]-d[0],l=d[3]-d[1],u=NV(s,r.rangePoints(d),t),h++}while(null===u&&(n[0]>c||n[1]>l));c>=n[0]&&l>=n[1]&&i.add(a),null!==u&&(t.splice(A+1,0,u),r.removePoint(u),o=!0)}return o?TV(t,e,n,r,i):t}function OV(t,e,n){const r=e||20,i=function(t){const e=[t[0]];let n=t[0];for(let r=1;r<t.length;r++){const i=t[r];n[0]===i[0]&&n[1]===i[1]||e.push(i),n=i}return e}(function(t){return t.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]})}(cV.toXy(t,n)));if(i.length<4){const t=i.concat([i[0]]);return n?cV.fromXy(t,n):t}const o=function(t){let e=1/0,n=1/0,r=-1/0,i=-1/0;for(let o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<n&&(n=t[o][1]),t[o][0]>r&&(r=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[r-e,i-n]}(i),A=[o[0]*LV,o[1]*LV],s=function(t){const e=t.length;if(e<3){const n=new Array(e);for(let t=0;t<e;++t)n[t]=t;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:n}const n=new Array(e);for(let t=0;t<e;++t)n[t]=t;n.sort((e,n)=>t[e][0]-t[n][0]||t[e][1]-t[n][1]);const r=[n[0],n[1]],i=[n[0],n[1]];for(let o=2;o<e;++o){const e=n[o],A=t[e];let s=r.length;for(;s>1&&MV(t[r[s-2]],t[r[s-1]],A)<=0;)s-=1,r.pop();for(r.push(e),s=i.length;s>1&&MV(t[i[s-2]],t[i[s-1]],A)>=0;)s-=1,i.pop();i.push(e)}const o=new Array(i.length+r.length-2);let A=0;for(let t=0,e=r.length;t<e;++t)o[A++]=r[t];for(let t=i.length-2;t>0;--t)o[A++]=i[t];return o}(i).reverse().map(t=>i[t]);s.push(s[0]);const a=i.filter(function(t){return s.indexOf(t)<0}),c=Math.ceil(1/(i.length/(o[0]*o[1]))),l=TV(s,Math.pow(r,2),A,function(t,e){return new lV(t,e)}(a,c),new Set);return n?cV.fromXy(l,n):l}const IV=Math.cos(90/(180/Math.PI)),LV=.6;const PV=(t,e,n)=>{if("sharp"===n)return[["M",t[0]-e,t[1]-e],["L",t[0]+e,t[1]-e],["L",t[0]+e,t[1]+e],["L",t[0]-e,t[1]+e],["Z"]];const r=[e,e,0,0,0];return[["M",t[0],t[1]-e],["A",...r,t[0],t[1]+e],["A",...r,t[0],t[1]-e]]},DV=(t,e,n)=>{const r=[e,e,0,0,0],i="sharp"===n?ay(t[0],hy(gy(cy(t[0],t[1])),e)):t[0],o="sharp"===n?ay(t[1],hy(gy(cy(t[1],t[0])),e)):t[1],A=hy(gy(vy(cy(i,o),!1)),e),s=hy(A,-1),a=ay(i,A),c=ay(o,A),l=ay(o,s),u=ay(i,s);return"sharp"===n?[["M",a[0],a[1]],["L",c[0],c[1]],["L",l[0],l[1]],["L",u[0],u[1]],["Z"]]:[["M",a[0],a[1]],["L",c[0],c[1]],["A",...r,l[0],l[1]],["L",u[0],u[1]],["A",...r,a[0],a[1]]]},RV=(t,e)=>{const n=_y(t).map((n,r)=>{const i=(r-2+t.length)%t.length,o=(r-1+t.length)%t.length,A=(r+1)%t.length,s=t[i],a=t[o],c=t[A],l=cy(s,a),u=cy(a,n),h=cy(n,c),d=(t,e)=>py(t,e,!0)<Math.PI,f=d(l,u),g=d(u,h),p=t=>hy(gy(vy(t,!1)),e),v=p(u);return[{p:yy(ay(a,f?p(l):v)),concave:f&&a},{p:yy(ay(n,g?p(h):v)),concave:g&&n}]}),r=[e,e,0,0,0],i=n.findIndex((t,e)=>!(n[(e-1+n.length)%n.length][0].concave||n[(e-1+n.length)%n.length][1].concave||t[0].concave||t[0].concave||t[1].concave)),o=n.slice(i).concat(n.slice(0,i));let A=[];return o.flatMap((t,e)=>{const i=[],s=o[n.length-1];return 0===e&&i.push(["M",...s[1].p]),t[0].concave?A.push(t[0].p,t[1].p):i.push(["A",...r,...t[0].p]),t[1].concave?A.unshift(t[1].p):i.push(["L",...t[1].p]),3===A.length&&(i.pop(),i.push(["C",...A.flat()]),A=[]),i})},HV=(t,e)=>{const n=_y(t).map((e,n)=>({p:e,v:gy(cy(t[(n+1)%t.length],e))}));return n.forEach((r,i)=>{const o=i>0?i-1:t.length-1,A=n[o].v,s=gy(ay(A,hy(r.v,py(A,r.v,!0)<Math.PI?1:-1)));r.p=ay(r.p,hy(s,e))}),Ew(n.map(t=>t.p))},_V=(t,e)=>{const n=t.map((n,r)=>{const i=t[0===r?t.length-1:r-1],o=wy(hy(gy(vy(cy(i,n),!1)),e));return[ay(i,o),ay(n,o)]}),r=n.flat(),i=r.map((t,e)=>{if(e%2==0)return null;return xy([r[(e-1)%r.length],r[e%r.length]],[r[(e+1)%r.length],r[(e+2)%r.length]],!0)}).filter(Boolean);return i.map((t,e)=>[0===e?"M":"L",t[0],t[1]]).concat([["Z"]])};class GV extends tz{constructor(t,e){super(t,Object.assign({},GV.defaultOptions,e)),this.hullMemberIds=[],this.drawHull=()=>{if(this.shape){const t=!xe(this.optionsCache,this.options);this.shape.update(this.getHullStyle(t))}else this.shape=new xw({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);this.optionsCache=Object.assign({},this.options)},this.updateHullPath=t=>{this.shape&&this.options.members.includes(Km(t.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(t=!1)=>{const{graph:e}=this.context,n=this.getMember();if(0===n.length)return"";const r=n.map(t=>e.getNodeData(t)),i=OV(r.map(My),this.options.concavity).slice(1).reverse(),o=i.flatMap(t=>r.filter(e=>xe(My(e),t)).map(Km));return xe(o,this.hullMemberIds)&&!t||(this.hullMemberIds=o,this.path=function(t,e,n){if(1===t.length)return PV(t[0],e,n);if(2===t.length)return DV(t,e,n);if(3===t.length){const[r,i,o]=_y(t);if(Iy(r,i,o))return DV([r,o],e,n)}switch(n){case"smooth":return HV(t,e);case"sharp":return _V(t,e);default:return RV(t,e)}}(i,this.getPadding(),this.options.corner)),this.path},this.bindEvents()}bindEvents(){this.context.graph.on(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.on(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}unbindEvents(){this.context.graph.off(t.GraphEvent.AFTER_RENDER,this.drawHull),this.context.graph.off(t.GraphEvent.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:r,corner:i}=e,o=Pe(e,["members","padding","corner"]);return Object.assign(Object.assign({},o),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context,e=this.hullMemberIds.reduce((e,n)=>{const{halfExtents:r}=t.getElementRenderBounds(n),i=Math.max(r[0],r[1]);return Math.max(e,i)},0);return e+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(t=>!e.includes(t)),e.some(t=>this.hullMemberIds.includes(t))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Gt(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.unbindEvents(),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}function KV(t,e){e(t),t.children&&t.children.forEach(function(t){t&&KV(t,e)})}function jV(t){VV(t,!0)}function zV(t){VV(t,!1)}function VV(t,e){var n=e?"visible":"hidden";KV(t,function(t){t.attr("visibility",n)})}GV.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};var WV=function(t){function e(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=t.apply(this,_e([],He(e),!1))||this;return r.isMutationObserved=!0,r.addEventListener(ea.INSERTED,function(){zV(r)}),r}return Ie(e,t),e}(Xa);function YV(t){var e=t.appendChild(new WV({class:"offscreen"}));return zV(e),e}var XV=function(t){function e(e){void 0===e&&(e={});var n=e.style,r=Pe(e,["style"]);return t.call(this,Le({style:Le({text:"",fill:"black",fontFamily:"sans-serif",fontSize:16,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",lineWidth:1,textAlign:"start",textBaseline:"middle"},n)},r))||this}return Ie(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=YV(this)),this._offscreen},enumerable:!1,configurable:!0}),e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e}(cc);function qV(t){return t*Math.PI/180}function $V(t){return Number((180*t/Math.PI).toPrecision(5))}var ZV=function(){function t(t,e,n,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=0),void 0===r&&(r=0),this.x=0,this.y=0,this.width=0,this.height=0,this.x=t,this.y=e,this.width=n,this.height=r}return Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!1,configurable:!0}),t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t.prototype.toJSON=function(){return{x:this.x,y:this.y,width:this.width,height:this.height,top:this.top,right:this.right,bottom:this.bottom,left:this.left}},t.prototype.isPointIn=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},t}();function JV(t,e){return Gt(t)?t.apply(void 0,_e([],He(e),!1)):t}var tW,eW=function(t,e){var n=function(t){return"".concat(e,"-").concat(t)},r=Object.fromEntries(Object.entries(t).map(function(t){var e=He(t,2),r=e[0],i=e[1],o=n(i);return[r,{name:o,class:".".concat(o),id:"#".concat(o),toString:function(){return o}}]}));return Object.assign(r,{prefix:n}),r},nW=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=5),Object.entries(e).forEach(function(i){var o=He(i,2),A=o[0],s=o[1],a=t;Object.prototype.hasOwnProperty.call(e,A)&&(s?qt(s)?(qt(t[A])||(a[A]={}),n<r?nW(t[A],s,n+1,r):a[A]=e[A]):jt(s)?(a[A]=[],a[A]=a[A].concat(s)):a[A]=s:a[A]=s)})},rW=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];for(var r=0;r<e.length;r+=1)nW(t,e[r]);return t},iW=function(t){return void 0!==t&&null!=t&&!Number.isNaN(t)},oW=me(function(t,e){var n=e.fontSize,r=e.fontFamily,i=e.fontWeight,o=e.fontStyle,A=e.fontVariant;return tW||(tW=Ua.offscreenCanvasCreator.getOrCreateContext(void 0)),tW.font=[o,A,i,"".concat(n,"px"),r].join(" "),tW.measureText(t).width},function(t,e){return[t,Object.values(e||AW(t)).join()].join("")},4096),AW=function(t){var e=t.style.fontFamily||"sans-serif",n=t.style.fontWeight||"normal",r=t.style.fontStyle||"normal",i=t.style.fontVariant,o=t.style.fontSize;return{fontSize:o="object"==typeof o?o.value:o,fontFamily:e,fontWeight:n,fontStyle:r,fontVariant:i}};function sW(t){return"text"===t.nodeName?t:"g"===t.nodeName&&1===t.children.length&&"text"===t.children[0].nodeName?t.children[0]:null}function aW(t,e){var n=sW(t);n&&n.attr(e)}function cW(t,e,n){void 0===n&&(n="..."),aW(t,{wordWrap:!0,wordWrapWidth:e,maxLines:1,textOverflow:n})}function lW(t){var e=t.nativeEvent,n=t.touches,r=t.clientX,i=t.clientY;if(e)return[e.clientX,e.clientY];if(n){var o=n[0];return[o.clientX,o.clientY]}return"number"==typeof r&&"number"==typeof i?[r,i]:[0,0]}function uW(t){return"function"==typeof t?t():Jt(t)||re(t)?new XV({style:{text:String(t)}}):t}function hW(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=function(t){t.node().removeChildren()}),t?n(e):(r&&i(e),null)}function dW(t,e,n,r,i){return void 0===r&&(r=!0),void 0===i&&(i=!1),!!(r&&t===e||i&&t===n)||t>e&&t<n}function fW(t,e){return"number"==typeof t&&"number"==typeof e?function(t,e){return function(n){return t*(1-n)+e*n}}(t,e):Array.isArray(t)&&Array.isArray(e)?function(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0;return function(i){var o=new Array(r),A=new Array(n),s=0;for(s=0;s<r;++s)o[s]=fW(t[s],e[s]);for(;s<n;++s)A[s]=e[s];for(s=0;s<r;++s)A[s]=o[s](i);return A}}(t,e):"object"==typeof t&&"object"==typeof e?function(t,e){void 0===t&&(t={}),void 0===e&&(e={});var n={},r={};return Object.entries(e).forEach(function(e){var i=He(e,2),o=i[0],A=i[1];o in t?n[o]=fW(t[o],A):r[o]=A}),function(t){return Object.entries(n).forEach(function(e){var n=He(e,2),i=n[0],o=n[1];return r[i]=o(t)}),r}}(t,e):function(e){return t}}function gW(t,e){return[t[0]*e,t[1]*e]}function pW(t,e){return[t[0]+e[0],t[1]+e[1]]}function vW(t,e){return[t[0]-e[0],t[1]-e[1]]}function mW(t,e){return[Math.min(t[0],e[0]),Math.min(t[1],e[1])]}function yW(t,e){return[Math.max(t[0],e[0]),Math.max(t[1],e[1])]}function wW(t,e){return Math.sqrt(Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2))}function bW(t){if(0===t[0]&&0===t[1])return[0,0];var e=Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2));return[t[0]/e,t[1]/e]}function BW(t,e){return+t.toPrecision(e)}function EW(t,e){var n={},r=Array.isArray(e)?e:[e];for(var i in t)r.includes(i)||(n[i]=t[i]);return n}function xW(t,e,n){void 0===n&&(n=[[0,0],[1,1]]);for(var r=[],i=0,o=t.length;i<o;i+=2)r.push([t[i],t[i+1]]);var A,s,a,c=function(t,e,n,r){var i,o,A,s,a,c,l=[],u=!!r,h=[1/0,1/0],d=[-1/0,-1/0];if(u){h=(i=He(r,2))[0],d=i[1];for(var f=0,g=t.length;f<g;f+=1)h=mW(h,v=t[f]),d=yW(d,v)}f=0;for(var p=t.length;f<p;f+=1){var v=t[f];if(0===f)c=v;else if(f===p-1)a=v,l.push(c),l.push(a);else{o=t[f-1];var m=[0,0];m=gW(m=vW(A=t[f+1],o),e);var y=wW(v,o),w=wW(v,A),b=y+w;0!==b&&(y/=b,w/=b);var B=gW(m,-y),E=gW(m,w);a=pW(v,B),s=mW(s=pW(v,E),yW(A,v)),s=yW(s,mW(A,v)),a=mW(a=pW(v,B=gW(B=vW(s,v),-y/w)),yW(o,v)),s=pW(v,E=gW(E=vW(v,a=yW(a,mW(o,v))),w/y)),u&&(a=mW(a=yW(a,h),d),s=mW(s=yW(s,h),d)),l.push(c),l.push(a),c=s}}return l}(r,.4,0,n),l=r.length,u=[];for(i=0;i<l-1;i+=1)A=c[2*i],s=c[2*i+1],a=r[i+1],u.push(["C",A[0],A[1],s[0],s[1],a[0],a[1]]);return u}var CW=["$el","cx","cy","d","dx","dy","fill","fillOpacity","filter","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","height","img","increasedLineWidthForHitTesting","innerHTML","isBillboard","billboardRotation","isSizeAttenuation","isClosed","isOverflowing","leading","letterSpacing","lineDash","lineHeight","lineWidth","markerEnd","markerEndOffset","markerMid","markerStart","markerStartOffset","maxLines","metrics","miterLimit","offsetX","offsetY","opacity","path","points","r","radius","rx","ry","shadowColor","src","stroke","strokeOpacity","text","textAlign","textBaseline","textDecorationColor","textDecorationLine","textDecorationStyle","textOverflow","textPath","textPathSide","textPathStartOffset","transform","transformOrigin","visibility","width","wordWrap","wordWrapWidth","x","x1","x2","y","y1","y2","z1","z2","zIndex"];function MW(t){return CW.includes(t)}function FW(t){var e={};for(var n in t)MW(n)&&(e[n]=t[n]);return e}function kW(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,A=e/Math.max(i,o);return t.style.transform="scale(".concat(A,")"),A}var SW=function(){function t(t,n,r,i,o,A,s){void 0===t&&(t=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=[null,null,null,null,null]),void 0===A&&(A=[]),void 0===s&&(s=[]),e.add(this),this._elements=Array.from(t),this._data=n,this._parent=r,this._document=i,this._enter=o[0],this._update=o[1],this._exit=o[2],this._merge=o[3],this._split=o[4],this._transitions=A,this._facetElements=s}var e,n,r;return t.prototype.selectAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(e,null,this._elements[0],this._document)},t.prototype.selectFacetAll=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t):t;return new n(this._elements,null,this._parent,this._document,void 0,void 0,e)},t.prototype.select=function(t){var e="string"==typeof t?this._parent.querySelectorAll(t)[0]||null:t;return new n([e],null,e,this._document)},t.prototype.append=function(t){var e=this,r="function"==typeof t?t:function(){return e.createElement(t)},i=[];if(null!==this._data){for(var o=0;o<this._data.length;o++){var A=this._data[o],s=He(Array.isArray(A)?A:[A,null],2),a=s[0],c=s[1];(u=r(a,o)).__data__=a,null!==c&&(u.__fromElements__=c),this._parent.appendChild(u),i.push(u)}return new n(i,null,this._parent,this._document)}for(o=0;o<this._elements.length;o++){var l=this._elements[o],u=r(a=l.__data__,o);l.appendChild(u),i.push(u)}return new n(i,null,i[0],this._document)},t.prototype.maybeAppend=function(t,n){var i=Ge(this,e,"m",r).call(this,"#"===t[0]?t:"#".concat(t),n);return i.attr("id",t),i},t.prototype.maybeAppendByClassName=function(t,n){var i=t.toString(),o=Ge(this,e,"m",r).call(this,"."===i[0]?i:".".concat(i),n);return o.attr("className",i),o},t.prototype.maybeAppendByName=function(t,n){var i=Ge(this,e,"m",r).call(this,'[name="'.concat(t,'"]'),n);return i.attr("name",t),i},t.prototype.data=function(t,e,r){var i,o;void 0===e&&(e=function(t){return t}),void 0===r&&(r=function(){return null});for(var A,s,a,c=[],l=[],u=new Set(this._elements),h=[],d=new Set,f=new Map(this._elements.map(function(t,n){return[e(t.__data__,n),t]})),g=new Map(this._facetElements.map(function(t,n){return[e(t.__data__,n),t]})),p=(A=this._elements,s=function(t){return r(t.__data__)},a=new Map,A.forEach(function(t){var e=s(t);a.has(e)||a.set(e,[]),a.get(e).push(t)}),a),v=0;v<t.length;v++){var m=t[v],y=e(m,v),w=r(m,v);if(f.has(y))(x=f.get(y)).__data__=m,x.__facet__=!1,l.push(x),u.delete(x),f.delete(y);else if(g.has(y)){(x=g.get(y)).__data__=m,x.__facet__=!0,l.push(x),g.delete(y)}else if(p.has(y)){var b=p.get(y);h.push([m,b]);try{for(var B=(i=void 0,Re(b)),E=B.next();!E.done;E=B.next()){var x=E.value;u.delete(x)}}catch(t){i={error:t}}finally{try{E&&!E.done&&(o=B.return)&&o.call(B)}finally{if(i)throw i.error}}p.delete(y)}else if(f.has(w)){(x=f.get(w)).__toData__?x.__toData__.push(m):x.__toData__=[m],d.add(x),u.delete(x)}else c.push(m)}var C=[new n([],c,this._parent,this._document),new n(l,null,this._parent,this._document),new n(u,null,this._parent,this._document),new n([],h,this._parent,this._document),new n(d,null,this._parent,this._document)];return new n(this._elements,null,this._parent,this._document,C)},t.prototype.merge=function(t){var e=_e(_e([],He(this._elements),!1),He(t._elements),!1),r=_e(_e([],He(this._transitions),!1),He(t._transitions),!1);return new n(e,null,this._parent,this._document,void 0,r)},t.prototype.createElement=function(t){if(this._document)return this._document.createElement(t,{});var e=n.registry[t];return e?new e:function(t){throw new Error(t)}("Unknown node type: ".concat(t))},t.prototype.join=function(t,e,n,r,i){void 0===t&&(t=function(t){return t}),void 0===e&&(e=function(t){return t}),void 0===n&&(n=function(t){return t.remove()}),void 0===r&&(r=function(t){return t}),void 0===i&&(i=function(t){return t.remove()});var o=t(this._enter),A=e(this._update),s=n(this._exit),a=r(this._merge),c=i(this._split);return A.merge(o).merge(s).merge(a).merge(c)},t.prototype.remove=function(){for(var t=function(t){var n=e._elements[t],r=e._transitions[t];r?r.then(function(){return n.remove()}):n.remove()},e=this,r=0;r<this._elements.length;r++)t(r);return new n([],null,this._parent,this._document,void 0,this._transitions)},t.prototype.each=function(t){for(var e=0;e<this._elements.length;e++){var n=this._elements[e],r=n.__data__;t.call(n,r,e)}return this},t.prototype.attr=function(t,e){var n="function"!=typeof e?function(){return e}:e;return this.each(function(r,i){void 0!==e&&(this[t]=n.call(this,r,i))})},t.prototype.style=function(t,e,n){void 0===n&&(n=!0);var r="function"==typeof e&&n?e:function(){return e};return this.each(function(n,i){void 0!==e&&(this.style[t]=r.call(this,n,i))})},t.prototype.styles=function(t,e){return void 0===t&&(t={}),void 0===e&&(e=!0),this.each(function(n,r){var i=this;Object.entries(t).forEach(function(t){var o=He(t,2),A=o[0],s=o[1],a="function"==typeof s&&e?s:function(){return s};void 0!==s&&i.attr(A,a.call(i,n,r))})})},t.prototype.update=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each(function(e,r){t&&this.update&&this.update(n.call(this,e,r))})},t.prototype.maybeUpdate=function(t,e){void 0===e&&(e=!0);var n="function"==typeof t&&e?t:function(){return t};return this.each(function(e,r){t&&this.update&&this.update(n.call(this,e,r))})},t.prototype.transition=function(t){this._transitions;var e=new Array(this._elements.length);return this.each(function(n,r){e[r]=t.call(this,n,r)}),this._transitions=function(t){if(!jt(t))return[];for(var e=[],n=0;n<t.length;n++)e=e.concat(t[n]);return e}(e),this},t.prototype.on=function(t,e){return this.each(function(){this.addEventListener(t,e)}),this},t.prototype.call=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.call.apply(t,_e([this._parent,this],He(e),!1)),this},t.prototype.node=function(){return this._elements[0]},t.prototype.nodes=function(){return this._elements},t.prototype.transitions=function(){return this._transitions.filter(function(t){return!!t})},t.prototype.parent=function(){return this._parent},n=t,e=new WeakSet,r=function(t,e){var r=this._elements[0],i=r.querySelector(t);if(i)return new n([i],null,this._parent,this._document);var o="string"==typeof e?this.createElement(e):e();return r.appendChild(o),new n([o],null,this._parent,this._document)},t.registry={g:Xa,rect:sc,circle:za,path:nc,text:XV,ellipse:Ya,image:Za,line:tc,polygon:ic,polyline:Ac,html:$a},t}();function QW(t){return new SW([t],null,t,t.ownerDocument)}function UW(t){if(re(t))return[t,t,t,t];if(jt(t)){var e=t.length;if(1===e)return[t[0],t[0],t[0],t[0]];if(2===e)return[t[0],t[1],t[0],t[1]];if(3===e)return[t[0],t[1],t[2],t[1]];if(4===e)return t}return[0,0,0,0]}function NW(t){var e=t.getLocalBounds(),n=He([e.min,e.max],2),r=He(n[0],2),i=r[0],o=r[1],A=He(n[1],2),s=A[0],a=A[1];return{x:i,y:o,width:s-i,height:a-o,left:i,bottom:a,top:o,right:s}}function TW(t,e){var n=He(t,2),r=n[0],i=n[1],o=He(e,2),A=o[0],s=o[1];return r!==A&&i===s}function OW(t){return t.toString().charAt(0).toUpperCase()+t.toString().slice(1)}function IW(t,e,n){var r;void 0===n&&(n=!0);var i=e||(null===(r=t.match(/^([a-z][a-z0-9]+)/))||void 0===r?void 0:r[0])||"",o=t.replace(new RegExp("^(".concat(i,")")),"");return n?function(t){return t.toString().charAt(0).toLowerCase()+t.toString().slice(1)}(o):o}var LW=function(t,e){if(!(null==t?void 0:t.startsWith(e)))return!1;var n=t[e.length];return n>="A"&&n<="Z"};function PW(t,e,n){void 0===n&&(n=!1);var r={};return Object.entries(t).forEach(function(t){var i=He(t,2),o=i[0],A=i[1];if("className"===o||"class"===o);else if(LW(o,"show")&&LW(IW(o,"show"),e)!==n)o===function(t,e){return"".concat(e).concat(OW(t))}(e,"show")?r[o]=A:r[o.replace(new RegExp(OW(e)),"")]=A;else if(!LW(o,"show")&&LW(o,e)!==n){var s=IW(o,e);"filter"===s&&"function"==typeof A||(r[s]=A)}}),r}function DW(t,e){return Object.entries(t).reduce(function(t,n){var r=He(n,2),i=r[0],o=r[1];return i.startsWith("show")?t["show".concat(e).concat(i.slice(4))]=o:t["".concat(e).concat(OW(i))]=o,t},{})}function RW(t,e){void 0===e&&(e=["x","y","class","className"]);var n=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],r={},i={};return Object.entries(t).forEach(function(t){var o=He(t,2),A=o[0],s=o[1];e.includes(A)||(-1!==n.indexOf(A)?i[A]=s:r[A]=s)}),[r,i]}function HW(t,e){var n={YYYY:t.getFullYear(),MM:t.getMonth()+1,DD:t.getDate(),HH:t.getHours(),mm:t.getMinutes(),ss:t.getSeconds()},r=e;return Object.keys(n).forEach(function(t){var e=n[t];r=r.replace(t,"YYYY"===t?"".concat(e):"".concat(e).padStart(2,"0"))}),r}function _W(t,e){if(e)try{var n=e.replace(/translate\(([+-]*[\d]+[%]*),[ ]*([+-]*[\d]+[%]*)\)/g,function(e,n,r){return"translate(".concat(function(t,e,n){var r=t.getBBox(),i=r.width,o=r.height,A=He([e,n].map(function(t,e){var n;return t.includes("%")?parseFloat((null===(n=t.match(/[+-]?([0-9]*[.])?[0-9]+/))||void 0===n?void 0:n[0])||"0")/100*(0===e?i:o):t}),2);return[A[0],A[1]]}(t,n,r),")")});t.attr("transform",n)}catch(t){}}var GW=function(t,e){null!=e?t.replaceChildren?Array.isArray(e)?t.replaceChildren.apply(t,_e([],He(e),!1)):t.replaceChildren(e):(t.innerHTML="",Array.isArray(e)?e.forEach(function(e){return t.appendChild(e)}):t.appendChild(e)):t.innerHTML=""};function KW(t){return/\S+-\S+/g.test(t)?t.split("-").map(function(t){return t[0]}):t.length>2?[t[0]]:t.split("")}function jW(){VV(this,"hidden"!==this.attributes.visibility)}var zW=function(t){function e(e,n){void 0===n&&(n={});var r=t.call(this,rW({},{style:n},e))||this;return r.initialized=!1,r._defaultOptions=n,r}return Ie(e,t),Object.defineProperty(e.prototype,"offscreenGroup",{get:function(){return this._offscreen||(this._offscreen=YV(this)),this._offscreen},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"defaultOptions",{get:function(){return this._defaultOptions},enumerable:!1,configurable:!0}),e.prototype.connectedCallback=function(){this.render(this.attributes,this),this.bindEvents(this.attributes,this),this.initialized=!0},e.prototype.disconnectedCallback=function(){var t;null===(t=this._offscreen)||void 0===t||t.destroy()},e.prototype.attributeChangedCallback=function(t){"visibility"===t&&jW.call(this)},e.prototype.update=function(t,e){var n;return this.attr(rW({},this.attributes,t||{})),null===(n=this.render)||void 0===n?void 0:n.call(this,this.attributes,this,e)},e.prototype.clear=function(){this.removeChildren()},e.prototype.bindEvents=function(t,e){},e.prototype.getSubShapeStyle=function(t){return t.x,t.y,t.transform,t.transformOrigin,t.class,t.className,t.zIndex,Pe(t,["x","y","transform","transformOrigin","class","className","zIndex"])},e}(Wa),VW=function(t,e,n){return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"]]},WW=VW,YW=function(t,e,n){return[["M",t,e+n],["L",t,e-n]]},XW=function(t,e,n){return[["M",t-n,e],["L",t+n,e]]},qW=XW;var $W=function(t,e,n){return[["M",t-n,e-n],["L",t+n,e],["L",t-n,e+n],["Z"]]};function ZW(t){var e=function(t){var e="default";if(zt(t)&&t instanceof Image)e="image";else if(Gt(t))e="symbol";else if(Jt(t)){var n=new RegExp("data:(image|text)");e=t.match(n)?"base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(t)?"url":"symbol"}return e}(t);return["base64","url","image"].includes(e)?"image":t&&"symbol"===e?"path":null}var JW=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),e.prototype.render=function(t,n){var r=t.x,i=void 0===r?0:r,o=t.y,A=void 0===o?0:o,s=this.getSubShapeStyle(t),a=s.symbol,c=s.size,l=void 0===c?16:c,u=Pe(s,["symbol","size"]),h=ZW(a);hW(!!h,QW(n),function(t){t.maybeAppendByClassName("marker",h).attr("className","marker ".concat(h,"-marker")).call(function(t){if("image"===h){var n=2*l;t.styles({img:a,width:n,height:n,x:i-l,y:A-l})}else{n=l/2;var r=Gt(a)?a:e.getSymbol(a);t.styles(Le({d:null==r?void 0:r(i,A,n)},u))}})})},e.MARKER_SYMBOL_MAP=new Map,e.registerSymbol=function(t,n){e.MARKER_SYMBOL_MAP.set(t,n)},e.getSymbol=function(t){return e.MARKER_SYMBOL_MAP.get(t)},e.getSymbols=function(){return Array.from(e.MARKER_SYMBOL_MAP.keys())},e}(zW);function tY(t,...e){return e.reduce((t,e)=>n=>t(e(n)),t)}function eY(t,e){return e-t?n=>(n-t)/(e-t):t=>.5}JW.registerSymbol("cross",function(t,e,n){return[["M",t-n,e-n],["L",t+n,e+n],["M",t+n,e-n],["L",t-n,e+n]]}),JW.registerSymbol("hyphen",function(t,e,n){return[["M",t-n,e],["L",t+n,e]]}),JW.registerSymbol("line",YW),JW.registerSymbol("plus",function(t,e,n){return[["M",t-n,e],["L",t+n,e],["M",t,e-n],["L",t,e+n]]}),JW.registerSymbol("tick",function(t,e,n){return[["M",t-n/2,e-n],["L",t+n/2,e-n],["M",t,e-n],["L",t,e+n],["M",t-n/2,e+n],["L",t+n/2,e+n]]}),JW.registerSymbol("circle",VW),JW.registerSymbol("point",WW),JW.registerSymbol("bowtie",function(t,e,n){var r=n-1.5;return[["M",t-n,e-r],["L",t+n,e+r],["L",t+n,e-r],["L",t-n,e+r],["Z"]]}),JW.registerSymbol("hexagon",function(t,e,n){var r=n/2*Math.sqrt(3);return[["M",t,e-n],["L",t+r,e-n/2],["L",t+r,e+n/2],["L",t,e+n],["L",t-r,e+n/2],["L",t-r,e-n/2],["Z"]]}),JW.registerSymbol("square",function(t,e,n){return[["M",t-n,e-n],["L",t+n,e-n],["L",t+n,e+n],["L",t-n,e+n],["Z"]]}),JW.registerSymbol("diamond",function(t,e,n){return[["M",t-n,e],["L",t,e-n],["L",t+n,e],["L",t,e+n],["Z"]]}),JW.registerSymbol("triangle",function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e+r],["L",t,e-r],["L",t+n,e+r],["Z"]]}),JW.registerSymbol("triangle-down",function(t,e,n){var r=n*Math.sin(1/3*Math.PI);return[["M",t-n,e-r],["L",t+n,e-r],["L",t,e+r],["Z"]]}),JW.registerSymbol("line",YW),JW.registerSymbol("dot",XW),JW.registerSymbol("dash",qW),JW.registerSymbol("smooth",function(t,e,n){return[["M",t-n,e],["A",n/2,n/2,0,1,1,t,e],["A",n/2,n/2,0,1,0,t+n,e]]}),JW.registerSymbol("hv",function(t,e,n){return[["M",t-n-1,e-2.5],["L",t,e-2.5],["L",t,e+2.5],["L",t+n+1,e+2.5]]}),JW.registerSymbol("vh",function(t,e,n){return[["M",t-n-1,e+2.5],["L",t,e+2.5],["L",t,e-2.5],["L",t+n+1,e-2.5]]}),JW.registerSymbol("hvh",function(t,e,n){return[["M",t-(n+1),e+2.5],["L",t-n/2,e+2.5],["L",t-n/2,e-2.5],["L",t+n/2,e-2.5],["L",t+n/2,e+2.5],["L",t+n+1,e+2.5]]}),JW.registerSymbol("vhv",function(t,e){return[["M",t-5,e+2.5],["L",t-5,e],["L",t,e],["L",t,e-3],["L",t,e+3],["L",t+6.5,e+3]]}),JW.registerSymbol("focus",function(t,e,n){var r=.2*n,i=.7*n;return[["M",t-n,e],["A",n,n,0,1,0,t+n,e],["A",n,n,0,1,0,t-n,e],["Z"],["M",t-i,e],["L",t-r,e],["M",t+r,e],["L",t+i,e],["M",t,e-i],["L",t,e-r],["M",t,e+r],["L",t,e+i]]});const nY=Math.sqrt(50),rY=Math.sqrt(10),iY=Math.sqrt(2);function oY(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log(r)/Math.LN10),o=r/10**i;return i>=0?(o>=nY?10:o>=rY?5:o>=iY?2:1)*10**i:-(10**-i)/(o>=nY?10:o>=rY?5:o>=iY?2:1)}const AY=(t,e,n=5)=>{const r=[t,e];let i,o=0,A=r.length-1,s=r[o],a=r[A];return a<s&&([s,a]=[a,s],[o,A]=[A,o]),i=oY(s,a,n),i>0?(s=Math.floor(s/i)*i,a=Math.ceil(a/i)*i,i=oY(s,a,n)):i<0&&(s=Math.ceil(s*i)/i,a=Math.floor(a*i)/i,i=oY(s,a,n)),i>0?(r[o]=Math.floor(s/i)*i,r[A]=Math.ceil(a/i)*i):i<0&&(r[o]=Math.ceil(s*i)/i,r[A]=Math.floor(a*i)/i),r};function sY(t){return!(de(t)||(e=t,null===e)||Number.isNaN(t));var e}var aY={exports:{}},cY={exports:{}},lY=function(t){return!(!t||"string"==typeof t)&&(t instanceof Array||Array.isArray(t)||t.length>=0&&(t.splice instanceof Function||Object.getOwnPropertyDescriptor(t,t.length-1)&&"String"!==t.constructor.name))},uY=Array.prototype.concat,hY=Array.prototype.slice,dY=cY.exports=function(t){for(var e=[],n=0,r=t.length;n<r;n++){var i=t[n];lY(i)?e=uY.call(e,hY.call(i)):e.push(i)}return e};dY.wrap=function(t){return function(){return t(dY(arguments))}};var fY=cY.exports,gY={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},pY=fY,vY=Object.hasOwnProperty,mY=Object.create(null);for(var yY in gY)vY.call(gY,yY)&&(mY[gY[yY]]=yY);var wY=aY.exports={to:{},get:{}};function bY(t,e,n){return Math.min(Math.max(e,t),n)}function BY(t){var e=Math.round(t).toString(16).toUpperCase();return e.length<2?"0"+e:e}wY.get=function(t){var e,n;switch(t.substring(0,3).toLowerCase()){case"hsl":e=wY.get.hsl(t),n="hsl";break;case"hwb":e=wY.get.hwb(t),n="hwb";break;default:e=wY.get.rgb(t),n="rgb"}return e?{model:n,value:e}:null},wY.get.rgb=function(t){if(!t)return null;var e,n,r,i=[0,0,0,1];if(e=t.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i)){for(r=e[2],e=e[1],n=0;n<3;n++){var o=2*n;i[n]=parseInt(e.slice(o,o+2),16)}r&&(i[3]=parseInt(r,16)/255)}else if(e=t.match(/^#([a-f0-9]{3,4})$/i)){for(r=(e=e[1])[3],n=0;n<3;n++)i[n]=parseInt(e[n]+e[n],16);r&&(i[3]=parseInt(r+r,16)/255)}else if(e=t.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)){for(n=0;n<3;n++)i[n]=parseInt(e[n+1],0);e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}else{if(!(e=t.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/)))return(e=t.match(/^(\w+)$/))?"transparent"===e[1]?[0,0,0,0]:vY.call(gY,e[1])?((i=gY[e[1]])[3]=1,i):null:null;for(n=0;n<3;n++)i[n]=Math.round(2.55*parseFloat(e[n+1]));e[4]&&(e[5]?i[3]=.01*parseFloat(e[4]):i[3]=parseFloat(e[4]))}for(n=0;n<3;n++)i[n]=bY(i[n],0,255);return i[3]=bY(i[3],0,1),i},wY.get.hsl=function(t){if(!t)return null;var e=t.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,bY(parseFloat(e[2]),0,100),bY(parseFloat(e[3]),0,100),bY(isNaN(n)?1:n,0,1)]}return null},wY.get.hwb=function(t){if(!t)return null;var e=t.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(e){var n=parseFloat(e[4]);return[(parseFloat(e[1])%360+360)%360,bY(parseFloat(e[2]),0,100),bY(parseFloat(e[3]),0,100),bY(isNaN(n)?1:n,0,1)]}return null},wY.to.hex=function(){var t=pY(arguments);return"#"+BY(t[0])+BY(t[1])+BY(t[2])+(t[3]<1?BY(Math.round(255*t[3])):"")},wY.to.rgb=function(){var t=pY(arguments);return t.length<4||1===t[3]?"rgb("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+")":"rgba("+Math.round(t[0])+", "+Math.round(t[1])+", "+Math.round(t[2])+", "+t[3]+")"},wY.to.rgb.percent=function(){var t=pY(arguments),e=Math.round(t[0]/255*100),n=Math.round(t[1]/255*100),r=Math.round(t[2]/255*100);return t.length<4||1===t[3]?"rgb("+e+"%, "+n+"%, "+r+"%)":"rgba("+e+"%, "+n+"%, "+r+"%, "+t[3]+")"},wY.to.hsl=function(){var t=pY(arguments);return t.length<4||1===t[3]?"hsl("+t[0]+", "+t[1]+"%, "+t[2]+"%)":"hsla("+t[0]+", "+t[1]+"%, "+t[2]+"%, "+t[3]+")"},wY.to.hwb=function(){var t=pY(arguments),e="";return t.length>=4&&1!==t[3]&&(e=", "+t[3]),"hwb("+t[0]+", "+t[1]+"%, "+t[2]+"%"+e+")"},wY.to.keyword=function(t){return mY[t.slice(0,3)]};var EY=y(aY.exports);function xY(t,e,n){let r=n;return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}function CY(t){const e=EY.get(t);if(!e)return null;const{model:n,value:r}=e;return"rgb"===n?r:"hsl"===n?function(t){const e=t[0]/360,n=t[1]/100,r=t[2]/100,i=t[3];if(0===n)return[255*r,255*r,255*r,i];const o=r<.5?r*(1+n):r+n-r*n,A=2*r-o;return[255*xY(A,o,e+1/3),255*xY(A,o,e),255*xY(A,o,e-1/3),i]}(r):null}const MY=(t,e)=>n=>t*(1-n)+e*n,FY=(t,e)=>"number"==typeof t&&"number"==typeof e?MY(t,e):"string"==typeof t&&"string"==typeof e?((t,e)=>{const n=CY(t),r=CY(e);return null===n||null===r?n?()=>t:()=>e:t=>{const e=new Array(4);for(let i=0;i<4;i+=1){const o=n[i],A=r[i];e[i]=o*(1-t)+A*t}const[i,o,A,s]=e;return`rgba(${Math.round(i)}, ${Math.round(o)}, ${Math.round(A)}, ${s})`}})(t,e):()=>t,kY=(t,e)=>{const n=MY(t,e);return t=>Math.round(n(t))};function SY({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):n}function QY(t){return"object"==typeof t?t.valueOf():t}class UY extends Map{constructor(t){if(super(),this.map=new Map,this.initKey=QY,null!==t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(SY({map:this.map,initKey:this.initKey},t))}has(t){return super.has(SY({map:this.map,initKey:this.initKey},t))}set(t,e){return super.set(function({map:t,initKey:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}({map:this.map,initKey:this.initKey},t),e)}delete(t){return super.delete(function({map:t,initKey:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}({map:this.map,initKey:this.initKey},t))}}class NY{constructor(t){this.options=be({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=be({},this.options,t),this.rescale(t)}rescale(t){}}const TY=Symbol("defaultUnknown");function OY(t,e,n){for(let r=0;r<e.length;r+=1)t.has(e[r])||t.set(n(e[r]),r)}function IY(t){const{value:e,from:n,to:r,mapper:i,notFoundReturn:o}=t;let A=i.get(e);if(void 0===A){if(o!==TY)return o;A=n.push(e)-1,i.set(e,A)}return r[A%r.length]}function LY(t){return t instanceof Date?t=>`${t}`:"object"==typeof t?t=>JSON.stringify(t):t=>t}class PY extends NY{getDefaultOptions(){return{domain:[],range:[],unknown:TY}}constructor(t){super(t)}map(t){return 0===this.domainIndexMap.size&&OY(this.domainIndexMap,this.getDomain(),this.domainKey),IY({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return 0===this.rangeIndexMap.size&&OY(this.rangeIndexMap,this.getRange(),this.rangeKey),IY({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=LY(e),this.rangeKey=LY(n),!this.rangeIndexMap)return this.rangeIndexMap=new Map,void(this.domainIndexMap=new Map);t&&!t.range||this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new PY(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function DY(t){return Math.round(1e12*t)/1e12}function RY(t){const{domain:e,range:n,paddingOuter:r,paddingInner:i,flex:o,round:A,align:s}=t,a=e.length,c=function(t,e){const n=e-t.length;return n>0?[...t,...new Array(n).fill(1)]:n<0?t.slice(0,e):t}(o,a),[l,u]=n,h=u-l,d=h/(2/a*r+1-1/a*i),f=d*i/a,g=d-a*f,p=function(t){const e=Math.min(...t);return t.map(t=>t/e)}(c),v=g/p.reduce((t,e)=>t+e),m=new UY(e.map((t,e)=>{const n=p[e]*v;return[t,A?Math.floor(n):n]})),y=new UY(e.map((t,e)=>{const n=p[e]*v+f;return[t,A?Math.floor(n):n]})),w=Array.from(y.values()).reduce((t,e)=>t+e),b=l+(h-(w-w/a*i))*s;let B=A?Math.round(b):b;const E=new Array(a);for(let t=0;t<a;t+=1){E[t]=DY(B);const n=e[t];B+=y.get(n)}return{valueBandWidth:m,valueStep:y,adjustedRange:E}}class HY extends PY{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:TY,flex:[]}}constructor(t){super(t)}clone(){return new HY(this.options)}getStep(t){return void 0===this.valueStep?1:"number"==typeof this.valueStep?this.valueStep:void 0===t?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return void 0===this.valueBandWidth?1:"number"==typeof this.valueBandWidth?this.valueBandWidth:void 0===t?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:r,flex:i}=this.options,{adjustedRange:o,valueBandWidth:A,valueStep:s}=function(t){var e;const{domain:n}=t,r=n.length;if(0===r)return{valueBandWidth:void 0,valueStep:void 0,adjustedRange:[]};if(null===(e=t.flex)||void 0===e?void 0:e.length)return RY(t);const{range:i,paddingOuter:o,paddingInner:A,round:s,align:a}=t;let c,l,u=i[0];const h=i[1]-u,d=2*o,f=r-A;c=h/Math.max(1,d+f),s&&(c=Math.floor(c)),u+=(h-c*(r-A))*a,l=c*(1-A),s&&(u=Math.round(u),l=Math.round(l));const g=new Array(r).fill(0).map((t,e)=>u+e*c);return{valueStep:c,valueBandWidth:l,adjustedRange:g}}({align:t,range:n,round:r,flex:i,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=s,this.valueBandWidth=A,this.adjustedRange=o}}const _Y=(t,e,n)=>{let r,i,o=t,A=e;if(o===A&&n>0)return[o];let s=oY(o,A,n);if(0===s||!Number.isFinite(s))return[];if(s>0){o=Math.ceil(o/s),A=Math.floor(A/s),i=new Array(r=Math.ceil(A-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)*s}else{s=-s,o=Math.ceil(o*s),A=Math.floor(A*s),i=new Array(r=Math.ceil(A-o+1));for(let t=0;t<r;t+=1)i[t]=(o+t)/s}return i},GY=(t,e,n)=>{const[r,i]=t,[o,A]=e;let s,a;return r<i?(s=eY(r,i),a=n(o,A)):(s=eY(i,r),a=n(A,o)),tY(a,s)},KY=(t,e,n)=>{const r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),A=t[0]>t[r],s=A?[...t].reverse():t,a=A?[...e].reverse():e;for(let t=0;t<r;t+=1)i[t]=eY(s[t],s[t+1]),o[t]=n(a[t],a[t+1]);return e=>{const n=function(t,e,n,r){let i=n,o=r||t.length;const A=t=>t;for(;i<o;){const n=Math.floor((i+o)/2);A(t[n])>e?o=n:i=n+1}return i}(t,e,1,r)-1,A=i[n];return tY(o[n],A)(e)}},jY=(t,e,n,r)=>(Math.min(t.length,e.length)>2?KY:GY)(t,e,r?kY:n);class zY extends NY{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:MY,tickCount:5}}map(t){return sY(t)?this.output(t):this.options.unknown}invert(t){return sY(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...r]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...r)}getTicks(){const{tickMethod:t}=this.options,[e,n,r,...i]=this.getTickMethodOptions();return t(e,n,r,...i)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options;return[t[0],t[t.length-1],e]}chooseNice(){return AY}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,r=this.options.domain.map(t),i=Math.min(r.length,n.length);return e?function(t,e){const n=e<t?e:t,r=t>e?t:e;return t=>Math.min(Math.max(n,t),r)}(r[0],r[i-1]):Te}composeOutput(t,e){const{domain:n,range:r,round:i,interpolate:o}=this.options,A=jY(n.map(t),r,o,i);this.output=tY(A,e,t)}composeInput(t,e,n){const{domain:r,range:i}=this.options,o=jY(i,r.map(t),MY);this.input=tY(e,n,o)}}class VY extends zY{getDefaultOptions(){return{domain:[0,1],range:[0,1],unknown:void 0,nice:!1,clamp:!1,round:!1,interpolate:FY,tickMethod:_Y,tickCount:5}}chooseTransforms(){return[Te,Te]}clone(){return new VY(this.options)}}var WY=function(t){function e(e){var n=this,r=e.style,i=Pe(e,["style"]);return(n=t.call(this,be({},{type:"column"},Le({style:r},i)))||this).columnsGroup=new Xa({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return Ie(e,t),e.prototype.render=function(){var t=this.attributes,e=t.columns,n=t.x,r=t.y;this.columnsGroup.style.transform="translate(".concat(n,", ").concat(r,")"),QW(this.columnsGroup).selectAll(".column").data(e.flat()).join(function(t){return t.append("rect").attr("className","column").each(function(t){this.attr(t)})},function(t){return t.each(function(t){this.attr(t)})},function(t){return t.remove()})},e.prototype.update=function(t){this.attr(rW({},this.attributes,t)),this.render()},e.prototype.clear=function(){this.removeChildren()},e}(ja),YY=function(t){function e(e){var n=this,r=e.style,i=Pe(e,["style"]);return(n=t.call(this,be({},{type:"lines"},Le({style:r},i)))||this).linesGroup=n.appendChild(new Xa),n.areasGroup=n.appendChild(new Xa),n.render(),n}return Ie(e,t),e.prototype.render=function(){var t=this.attributes,e=t.lines,n=t.areas,r=t.x,i=t.y;this.style.transform="translate(".concat(r,", ").concat(i,")"),e&&this.renderLines(e),n&&this.renderAreas(n)},e.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},e.prototype.update=function(t){this.attr(rW({},this.attributes,t)),this.render()},e.prototype.renderLines=function(t){QW(this.linesGroup).selectAll(".line").data(t).join(function(t){return t.append("path").attr("className","line").each(function(t){this.attr(t)})},function(t){return t.each(function(t){this.attr(t)})},function(t){return t.remove()})},e.prototype.renderAreas=function(t){QW(this.linesGroup).selectAll(".area").data(t).join(function(t){return t.append("path").attr("className","area").each(function(t){this.attr(t)})},function(t){return t.each(function(t){this.style(t)})},function(t){return t.remove()})},e}(ja);function XY(t,e){void 0===e&&(e=!1);var n=e?t.length-1:0,r=t.map(function(t,e){return _e([e===n?"M":"L"],He(t),!1)});return e?r.reverse():r}function qY(t,e){if(void 0===e&&(e=!1),t.length<=2)return XY(t);for(var n=[],r=t.length,i=0;i<r;i+=1){var o=e?t[r-i-1]:t[i];xe(o,n.slice(-2))||n.push.apply(n,_e([],He(o),!1))}var A=xW(n);return e?A.unshift(_e(["M"],He(t[r-1]),!1)):A.unshift(_e(["M"],He(t[0]),!1)),A}function $Y(t,e,n){var r=ge(t);return r.push(["L",e,n],["L",0,n],["Z"]),r}function ZY(t){return 0===t.length?[0,0]:[Zt(Ae(t,function(t){return Zt(t)||0})),$t(oe(t,function(t){return $t(t)||0}))]}function JY(t){for(var e=ge(t),n=e[0].length,r=He([Array(n).fill(0),Array(n).fill(0)],2),i=r[0],o=r[1],A=0;A<e.length;A+=1)for(var s=e[A],a=0;a<n;a+=1)s[a]>=0?(s[a]+=i[a],i[a]=s[a]):(s[a]+=o[a],o[a]=s[a]);return e}var tX=function(t){function e(e){return t.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Ie(e,t),Object.defineProperty(e.prototype,"rawData",{get:function(){var t=this.attributes.data;if(!t||0===(null==t?void 0:t.length))return[[]];var e=ge(t);return re(e[0])?[e]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.isStack?JY(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"baseline",{get:function(){var t=this.scales.y,e=He(t.getOptions().domain||[0,0],2),n=e[0],r=e[1];return r<0?t.map(r):t.map(n<0?0:n)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"containerShape",{get:function(){var t=this.attributes;return{width:t.width,height:t.height}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"linesStyle",{get:function(){var t=this,e=this.attributes,n=e.type,r=e.isStack,i=e.smooth;if("line"!==n)throw new Error("linesStyle can only be used in line type");var o=PW(this.attributes,"area"),A=PW(this.attributes,"line"),s=this.containerShape.width,a=this.data;if(0===a[0].length)return{lines:[],areas:[]};var c=this.scales,l=function(t,e){var n,r=e.x,i=e.y,o=He(i.getOptions().range||[0,0],2),A=o[0],s=o[1];return s>A&&(n=He([A,s],2),s=n[0],A=n[1]),t.map(function(t){return t.map(function(t,e){return[r.map(e),ne(i.map(t),s,A)]})})}(a,{x:c.x,y:c.y}),u=[];if(o){var h=this.baseline;u=r?i?function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=t[i],A=qY(o),s=void 0;if(0===i)s=$Y(A,e,n);else{var a=qY(t[i-1],!0),c=o[0];a[0][0]="L",s=_e(_e(_e([],He(A),!1),He(a),!1),[_e(["M"],He(c),!1),["Z"]],!1)}r.push(s)}return r}(l,s,h):function(t,e,n){for(var r=[],i=t.length-1;i>=0;i-=1){var o=XY(t[i]),A=void 0;if(0===i)A=$Y(o,e,n);else{var s=XY(t[i-1],!0);s[0][0]="L",A=_e(_e(_e([],He(o),!1),He(s),!1),[["Z"]],!1)}r.push(A)}return r}(l,s,h):function(t,e,n,r){return t.map(function(t){return $Y(e?qY(t):XY(t),n,r)})}(l,i,s,h)}return{lines:l.map(function(e,n){return Le({stroke:t.getColor(n),d:i?qY(e):XY(e)},A)}),areas:u.map(function(e,n){return Le({d:e,fill:t.getColor(n)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"columnsStyle",{get:function(){var t=this,e=PW(this.attributes,"column"),n=this.attributes,r=n.isStack,i=n.type,o=n.scale;if("column"!==i)throw new Error("columnsStyle can only be used in column type");var A=this.containerShape.height,s=this.rawData;if(!s)return{columns:[]};r&&(s=JY(s));var a=this.createScales(s),c=a.x,l=a.y,u=He(ZY(s),2),h=u[0],d=u[1],f=new VY({domain:[0,d-(h>0?0:h)],range:[0,A*o]}),g=c.getBandWidth(),p=this.rawData;return{columns:s.map(function(n,i){return n.map(function(n,o){var A=g/s.length;return Le(Le({fill:t.getColor(i)},e),r?{x:c.map(o),y:l.map(n),width:g,height:f.map(p[i][o])}:{x:c.map(o)+A*i,y:n>=0?l.map(n):l.map(0),width:A,height:f.map(Math.abs(n))})})})}},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){var n,r,i;(n=e,r=".container",i="rect",n.querySelector(r)?QW(n).select(r):QW(n).append(i)).attr("className","container").node();var o=t.type,A=t.x,s=t.y,a="spark".concat(o),c=Le({x:A,y:s},"line"===o?this.linesStyle:this.columnsStyle);QW(e).selectAll(".spark").data([o]).join(function(t){return t.append(function(t){return"line"===t?new YY({className:a,style:c}):new WY({className:a,style:c})}).attr("className","spark ".concat(a))},function(t){return t.update(c)},function(t){return t.remove()})},e.prototype.getColor=function(t){var e=this.attributes.color;return jt(e)?e[t%e.length]:Gt(e)?e.call(null,t):e},e.prototype.createScales=function(t){var e,n,r=this.attributes,i=r.type,o=r.scale,A=r.range,s=void 0===A?[]:A,a=r.spacing,c=this.containerShape,l=c.width,u=c.height,h=He(ZY(t),2),d=h[0],f=h[1],g=new VY({domain:[null!==(e=s[0])&&void 0!==e?e:d,null!==(n=s[1])&&void 0!==n?n:f],range:[u,u*(1-o)]});return"line"===i?{type:i,x:new VY({domain:[0,t[0].length-1],range:[0,l]}),y:g}:{type:i,x:new HY({domain:t[0].map(function(t,e){return e}),range:[0,l],paddingInner:a,paddingOuter:a/2,align:.5}),y:g}},e.tag="sparkline",e}(zW);function eX(t){if(!t)return{enter:!1,update:!1,exit:!1};var e=["enter","update","exit"],n=Object.fromEntries(Object.entries(t).filter(function(t){var n=He(t,1)[0];return!e.includes(n)}));return Object.fromEntries(e.map(function(e){return function(t){return"boolean"!=typeof t&&"enter"in t&&"update"in t&&"exit"in t}(t)?!1===t[e]?[e,!1]:[e,Le(Le({},t[e]),n)]:[e,n]}))}function nX(t,e){t?t.finished.then(e):e()}function rX(t,e){"update"in t?t.update(e):t.attr(e)}function iX(t,e,n){return 0===e.length?null:n?t.animate(e,n):(rX(t,{style:e.slice(-1)[0]}),null)}function oX(t,e,n){var r={},i={};return Object.entries(e).forEach(function(e){var n=He(e,2),o=n[0],A=n[1];if(!Kt(A)){var s=t.style[o]||t.parsedStyle[o]||0;s!==A&&(r[o]=s,i[o]=A)}}),n?iX(t,[r,i],Le({fill:"both"},n)):(rX(t,i),null)}function AX(t,e){return t.style.opacity||(t.style.opacity=1),oX(t,{opacity:0},e)}var sX={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},aX={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},cX={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},lX=eW({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),uX=eW({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),hX=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),e.prototype.render=function(t,e){var n=t.x,r=t.y,i=t.size,o=void 0===i?10:i,A=t.radius,s=void 0===A?o/4:A,a=t.orientation,c=t.classNamePrefix,l=Pe(t,["x","y","size","radius","orientation","classNamePrefix"]),u=o,h=2.4*u,d=c?"".concat(uX.iconRect.name," ").concat(c,"handle-icon-rect"):uX.iconRect.name,f=function(t){return c?"".concat(uX.iconLine,"-").concat(t," ").concat(c,"handle-icon-line"):"".concat(uX.iconLine,"-").concat(t)},g=QW(e).maybeAppendByClassName(uX.iconRect,"rect").attr("className",d).styles(Le(Le({},l),{width:u,height:h,radius:s,x:n-u/2,y:r-h/2,transformOrigin:"center"})),p=n+1/3*u-u/2,v=n+2/3*u-u/2,m=r+1/4*h-h/2,y=r+3/4*h-h/2;g.maybeAppendByClassName("".concat(uX.iconLine,"-1"),"line").attr("className",f(1)).styles(Le({x1:p,x2:p,y1:m,y2:y},l)),g.maybeAppendByClassName("".concat(uX.iconLine,"-2"),"line").attr("className",f(2)).styles(Le({x1:v,x2:v,y1:m,y2:y},l)),"vertical"===a&&(g.node().style.transform="rotate(90)")},e}(zW),dX=function(t){function e(e){return t.call(this,e,cX)||this}return Ie(e,t),e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.x,i=n.y,o=n.showLabel,A=PW(this.attributes,"label"),s=A.x,a=void 0===s?0:s,c=A.y,l=void 0===c?0:c,u=A.transform,h=A.transformOrigin,d=He(RW(Pe(A,["x","y","transform","transformOrigin"]),[]),2),f=d[0],g=d[1],p=QW(t).maybeAppendByClassName(uX.labelGroup,"g").styles(g),v=Le(Le({},aX),f),m=v.text,y=Pe(v,["text"]);hW(!!o,p,function(t){e.label=t.maybeAppendByClassName(uX.label,"text").styles(Le(Le({},y),{x:r+a,y:i+l,transform:u,transformOrigin:h,text:"".concat(m)})),e.label.on("mousedown",function(t){t.stopPropagation()}),e.label.on("touchstart",function(t){t.stopPropagation()})})},e.prototype.renderIcon=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.orientation,o=e.type,A=e.classNamePrefix,s=Le(Le({x:n,y:r,orientation:i,classNamePrefix:A},sX),PW(this.attributes,"icon")),a=this.attributes.iconShape,c=void 0===a?function(){return new hX({style:s})}:a;QW(t).maybeAppendByClassName(uX.iconGroup,"g").selectAll(uX.icon.class).data([c]).join(function(t){return t.append("string"==typeof c?c:function(){return c(o)}).attr("className",uX.icon.name)},function(t){return t.update(s)},function(t){return t.remove()})},e.prototype.render=function(t,e){this.renderIcon(e),this.renderLabel(e)},e}(zW),fX=function(t){function e(e){var n=t.call(this,e,Le(Le(Le({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(t){return t.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},DW(cX,"handle")),DW(sX,"handleIcon")),DW(aX,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(t){return function(e){e.stopPropagation(),n.target=t,n.prevPos=n.getOrientVal(lW(e));var r=n.availableSpace,i=r.x,o=r.y,A=n.getBBox(),s=A.x,a=A.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([i,o])-n.getOrientVal([+s,+a])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(t){var e=n.attributes,r=e.slidable,i=e.brushable,o=e.type;t.stopPropagation();var A=n.getOrientVal(lW(t)),s=A-n.prevPos;if(s){var a=n.getRatio(s);switch(n.target){case"start":r&&n.setValuesOffset(a);break;case"end":r&&n.setValuesOffset(0,a);break;case"selection":r&&n.setValuesOffset(a,a);break;case"track":if(!i)return;n.selectionWidth+=a,"range"===o?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0)}n.prevPos=A}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(t){var e=n.attributes,r=e.onChange,i=e.type,o="range"===i?t:t[1],A="range"===i?n.getValues():n.getValues()[1],s=new Vs("valuechange",{detail:{oldValue:o,value:A}});n.dispatchEvent(s),null==r||r(A)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Ie(e,t),Object.defineProperty(e.prototype,"values",{get:function(){return this.attributes.values},set:function(t){this.attributes.values=this.clampValues(t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sparklineStyle",{get:function(){if("horizontal"!==this.attributes.orientation)return null;var t=PW(this.attributes,"sparkline");return Le(Le({zIndex:0},this.availableSpace),t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shape",{get:function(){var t=this.attributes,e=t.trackLength,n=t.trackSize,r=He(this.getOrientVal([[e,n],[n,e]]),2);return{width:r[0],height:r[1]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes;t.x,t.y;var e=He(UW(t.padding),4),n=e[0],r=e[1],i=e[2],o=e[3],A=this.shape;return{x:o,y:n,width:A.width-(o+r),height:A.height-(n+i)}},enumerable:!1,configurable:!0}),e.prototype.getValues=function(){return this.values},e.prototype.setValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1),this.attributes.values=t;var n=!1!==e&&this.attributes.animate;this.updateSelectionArea(n),this.updateHandlesPosition(n)},e.prototype.updateSelectionArea=function(t){var e=this.calcSelectionArea();this.foregroundGroup.selectAll(lX.selection.class).each(function(n,r){oX(this,e[r],t)})},e.prototype.updateHandlesPosition=function(t){this.attributes.showHandle&&(this.startHandle&&oX(this.startHandle,this.getHandleStyle("start"),t),this.endHandle&&oX(this.endHandle,this.getHandleStyle("end"),t))},e.prototype.innerSetValues=function(t,e){void 0===t&&(t=[0,0]),void 0===e&&(e=!1);var n=this.values,r=this.clampValues(t);this.attributes.values=r,this.setValues(r),e&&this.onValueChange(n)},e.prototype.renderTrack=function(t){var e=this.attributes,n=e.x,r=e.y,i=PW(this.attributes,"track");this.trackShape=QW(t).maybeAppendByClassName(lX.track,"rect").styles(Le(Le({x:n,y:r},this.shape),i))},e.prototype.renderBrushArea=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.brushable;this.brushArea=QW(t).maybeAppendByClassName(lX.brushArea,"rect").styles(Le({x:n,y:r,fill:"transparent",cursor:i?"crosshair":"default"},this.shape))},e.prototype.renderSparkline=function(t){var e=this,n=this.attributes,r=n.x,i=n.y;hW("horizontal"===n.orientation,QW(t).maybeAppendByClassName(lX.sparklineGroup,"g"),function(t){var n=Le(Le({},e.sparklineStyle),{x:r,y:i});t.maybeAppendByClassName(lX.sparkline,function(){return new tX({style:n})}).update(n)})},e.prototype.renderHandles=function(){var t,e=this,n=this.attributes,r=n.showHandle,i=n.type,o=r?"range"===i?["start","end"]:["end"]:[],A=this;null===(t=this.foregroundGroup)||void 0===t||t.selectAll(lX.handle.class).data(o.map(function(t){return{type:t}}),function(t){return t.type}).join(function(t){return t.append(function(t){var n=t.type;return new dX({style:e.getHandleStyle(n)})}).each(function(t){var e=t.type;this.attr("class","".concat(lX.handle.name," ").concat(e,"-handle"));var n="".concat(e,"Handle");A[n]=this,this.addEventListener("pointerdown",A.onDragStart(e))})},function(t){return t.each(function(t){var e=t.type;this.update(A.getHandleStyle(e))})},function(t){return t.each(function(t){var e=t.type,n="".concat(e,"Handle");A[n]=void 0}).remove()})},e.prototype.renderSelection=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.type,o=e.selectionType;this.foregroundGroup=QW(t).maybeAppendByClassName(lX.foreground,"g");var A=PW(this.attributes,"selection"),s=function(t){return t.style("visibility",function(t){return t.show?"visible":"hidden"}).style("cursor",function(t){return"select"===o?"grab":"invert"===o?"crosshair":"default"}).styles(Le(Le({},A),{transform:"translate(".concat(n,", ").concat(r,")")}))},a=this;this.foregroundGroup.selectAll(lX.selection.class).data("value"===i?[]:this.calcSelectionArea().map(function(t,e){return{style:Le({},t),index:e,show:"select"===o?1===e:1!==e}}),function(t){return t.index}).join(function(t){return t.append("rect").attr("className",lX.selection.name).call(s).each(function(t,e){var n=this;1===e?(a.selectionShape=QW(this),this.on("pointerdown",function(t){n.attr("cursor","grabbing"),a.onDragStart("selection")(t)}),a.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),a.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),a.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){n.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){n.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){n.attr("cursor","pointer")})):this.on("pointerdown",a.onDragStart("track"))})},function(t){return t.call(s)},function(t){return t.remove()}),this.updateSelectionArea(!1),this.renderHandles()},e.prototype.render=function(t,e){this.renderTrack(e),this.renderSparkline(e),this.renderBrushArea(e),this.renderSelection(e)},e.prototype.clampValues=function(t,e){var n;void 0===e&&(e=4);var r=He(this.range,2),i=r[0],o=r[1],A=He(this.getValues().map(function(t){return BW(t,e)}),2),s=A[0],a=A[1],c=He(((Array.isArray(t)?t:[s,null!=t?t:a])||[s,a]).map(function(t){return BW(t,e)}),2),l=c[0],u=c[1];if("value"===this.attributes.type)return[0,ne(u,i,o)];l>u&&(l=(n=He([u,l],2))[0],u=n[1]);var h=u-l;return h>o-i?[i,o]:l<i?s===i&&a===u?[i,u]:[i,h+i]:u>o?a===o&&s===l?[l,o]:[o-h,o]:[l,u]},e.prototype.calcSelectionArea=function(t){var e=He(this.clampValues(t),2),n=e[0],r=e[1],i=this.availableSpace,o=i.x,A=i.y,s=i.width,a=i.height;return this.getOrientVal([[{y:A,height:a,x:o,width:n*s},{y:A,height:a,x:n*s+o,width:(r-n)*s},{y:A,height:a,x:r*s,width:(1-r)*s}],[{x:o,width:s,y:A,height:n*a},{x:o,width:s,y:n*a+A,height:(r-n)*a},{x:o,width:s,y:r*a,height:(1-r)*a}]])},e.prototype.calcHandlePosition=function(t){var e=this.attributes.handleIconOffset,n=this.availableSpace,r=n.x,i=n.y,o=n.width,A=n.height,s=He(this.clampValues(),2),a=s[0],c=s[1],l="start"===t?-e:e,u=("start"===t?a:c)*this.getOrientVal([o,A])+l;return{x:r+this.getOrientVal([u,o/2]),y:i+this.getOrientVal([A/2,u])}},e.prototype.inferTextStyle=function(t){return"horizontal"===this.attributes.orientation?{}:"start"===t?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:"end"===t?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},e.prototype.calcHandleText=function(t){var e,n=this.attributes,r=n.type,i=n.orientation,o=n.formatter,A=n.autoFitLabel,s=PW(this.attributes,"handle"),a=PW(s,"label"),c=s.spacing,l=this.getHandleSize(),u=this.clampValues(),h=o("start"===t?u[0]:u[1]),d=new XV({style:Le(Le(Le({},a),this.inferTextStyle(t)),{text:h})}),f=d.getBBox(),g=f.width,p=f.height;if(d.destroy(),!A){if("value"===r)return{text:h,x:0,y:-p-c};var v=c+l+("horizontal"===i?g/2:0);return(e={text:h})["horizontal"===i?"x":"y"]="start"===t?-v:v,e}var m=0,y=0,w=this.availableSpace,b=w.width,B=w.height,E=this.calcSelectionArea()[1],x=E.x,C=E.y,M=E.width,F=E.height,k=c+l;if("horizontal"===i){var S=k+g/2;if("start"===t)m=x-k-g>0?-S:S;else m=b-x-M-k>g?S:-S}else{var Q=p+k;y="start"===t?C-l>p?-Q:k:B-(C+F)-l>p?Q:-k}return{x:m,y:y,text:h}},e.prototype.getHandleLabelStyle=function(t){var e=PW(this.attributes,"handleLabel");return Le(Le(Le({},e),this.calcHandleText(t)),this.inferTextStyle(t))},e.prototype.getHandleIconStyle=function(){var t=this.attributes.handleIconShape,e=PW(this.attributes,"handleIcon"),n=this.getOrientVal(["ew-resize","ns-resize"]),r=this.getHandleSize();return Le({cursor:n,shape:t,size:r},e)},e.prototype.getHandleStyle=function(t){var e=this.attributes,n=e.x,r=e.y,i=e.showLabel,o=e.showLabelOnInteraction,A=e.orientation,s=this.calcHandlePosition(t),a=s.x,c=s.y,l=this.calcHandleText(t),u=i;return!i&&o&&(u=!!this.target),Le(Le(Le({},DW(this.getHandleIconStyle(),"icon")),DW(Le(Le({},this.getHandleLabelStyle(t)),l),"label")),{transform:"translate(".concat(a+n,", ").concat(c+r,")"),orientation:A,showLabel:u,type:t,zIndex:3})},e.prototype.getHandleSize=function(){var t=this.attributes,e=t.handleIconSize,n=t.width,r=t.height;return e||Math.floor((this.getOrientVal([+r,+n])+4)/2.4)},e.prototype.getOrientVal=function(t){var e=He(t,2),n=e[0],r=e[1];return"horizontal"===this.attributes.orientation?n:r},e.prototype.setValuesOffset=function(t,e){void 0===e&&(e=0);var n=this.attributes.type,r=He(this.getValues(),2),i=[r[0]+("range"===n?t:0),r[1]+e].sort();this.innerSetValues(i,!0)},e.prototype.getRatio=function(t){var e=this.availableSpace,n=e.width,r=e.height;return t/this.getOrientVal([n,r])},e.prototype.dispatchCustomEvent=function(t,e,n){var r=this;t.on(e,function(t){t.stopPropagation(),r.dispatchEvent(new Vs(n,{detail:t}))})},e.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var t=this.brushArea;this.dispatchCustomEvent(t,"click","trackClick"),this.dispatchCustomEvent(t,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(t,"pointerleave","trackMouseleave"),t.on("pointerdown",this.onDragStart("track"))},e.prototype.onScroll=function(t){if(this.attributes.scrollable){var e=t.deltaX,n=t.deltaY||e,r=this.getRatio(n);this.setValuesOffset(r,r)}},e.tag="slider",e}(zW),gX="grid-group",pX="main-group",vX="line-group",mX="tick-group",yX="label-group",wX="title-group",bX="grid",BX="line",EX="line-first",xX="line-second",CX="tick",MX="tick-item",FX="label",kX="label-item",SX="title",QX={data:[],animate:{enter:!1,update:{duration:100,easing:"ease-in-out-sine",fill:"both"},exit:{duration:100,fill:"both"}},showArrow:!0,showGrid:!0,showLabel:!0,showLine:!0,showTick:!0,showTitle:!0,showTrunc:!1,dataThreshold:100,lineLineWidth:1,lineStroke:"black",crossPadding:10,titleFill:"black",titleFontSize:12,titlePosition:"lb",titleSpacing:0,titleTextAlign:"center",titleTextBaseline:"middle",lineArrow:function(){return new nc({style:{d:[["M",10,10],["L",-10,0],["L",10,-10],["L",0,0],["L",10,10],["Z"]],fill:"black",transformOrigin:"center"}})},labelAlign:"parallel",labelDirection:"positive",labelFontSize:12,labelSpacing:0,gridConnect:"line",gridControlAngles:[],gridDirection:"positive",gridLength:0,gridType:"segment",lineArrowOffset:15,lineArrowSize:10,tickDirection:"positive",tickLength:5,tickLineWidth:1,tickStroke:"black",labelOverlap:[]};be({},QX,{style:{type:"arc"}}),be({},QX,{style:{}});var UX=eW({mainGroup:pX,gridGroup:gX,grid:bX,lineGroup:vX,line:BX,tickGroup:mX,tick:CX,tickItem:MX,labelGroup:yX,label:FX,labelItem:kX,titleGroup:wX,title:SX,lineFirst:EX,lineSecond:xX},"axis"),NX=eW({lineGroup:"line-group",line:"line",regionGroup:"region-group",region:"region"},"grid");function TX(t){return t.reduce(function(t,e,n){return t.push(_e([0===n?"M":"L"],He(e),!1)),t},[])}function OX(t,e,n){return"surround"===e.type?function(t,e,n){var r=e.connect,i=void 0===r?"line":r,o=e.center;if("line"===i)return TX(t);if(!o)return[];var A=wW(t[0],o),s=n?0:1;return t.reduce(function(t,e,n){return 0===n?t.push(_e(["M"],He(e),!1)):t.push(_e(["A",A,A,0,0,s],He(e),!1)),t},[])}(t,e,n):TX(t)}function IX(t,e,n){var r=n.type,i=n.connect,o=n.center,A=n.closed?[["Z"]]:[],s=He([OX(t,n),OX(e.slice().reverse(),n,!0)],2),a=s[0],c=s[1],l=He([t[0],e.slice(-1)[0]],2),u=l[0],h=l[1],d=function(t,e){return[a,t,c,e,A].flat()};if("line"===i||"surround"===r)return d([_e(["L"],He(h),!1)],[_e(["L"],He(u),!1)]);if(!o)throw new Error("Arc grid need to specified center");var f=He([wW(h,o),wW(u,o)],2),g=f[0],p=f[1];return d([_e(["A",g,g,0,0,1],He(h),!1),_e(["L"],He(h),!1)],[_e(["A",p,p,0,0,0],He(u),!1),_e(["L"],He(u),!1)])}var LX=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),e.prototype.render=function(t,e){t.type,t.center,t.areaFill,t.closed;var n=Pe(t,["type","center","areaFill","closed"]),r=function(t){var e=t.data,n=void 0===e?[]:e;return t.closed?n.map(function(t){var e=t.points,n=He(e,1)[0];return Le(Le({},t),{points:_e(_e([],He(e),!1),[n],!1)})}):n}(t),i=QW(e).maybeAppendByClassName(NX.lineGroup,"g"),o=QW(e).maybeAppendByClassName(NX.regionGroup,"g"),A=function(t,e,n,r){var i=n.animate,o=n.isBillboard,A=e.map(function(t,e){return{id:t.id||"grid-line-".concat(e),d:OX(t.points,n)}});return t.selectAll(NX.line.class).data(A,function(t){return t.id}).join(function(t){return t.append("path").each(function(t,e){var n=JV(FW(Le({d:t.d},r)),[t,e,A]);this.attr(Le({class:NX.line.name,stroke:"#D9D9D9",lineWidth:1,lineDash:[4,4],isBillboard:o},n))})},function(t){return t.transition(function(t,e){return oX(this,JV(FW(Le({d:t.d},r)),[t,e,A]),i.update)})},function(t){return t.transition(function(){var t=this,e=AX(this,i.exit);return nX(e,function(){return t.remove()}),e})}).transitions()}(i,r,t,n),s=function(t,e,n){var r=n.animate,i=n.connect,o=n.areaFill;if(e.length<2||!o||!i)return[];for(var A=Array.isArray(o)?o:[o,"transparent"],s=function(t){return A[t%A.length]},a=[],c=0;c<e.length-1;c++){var l=He([e[c].points,e[c+1].points],2),u=IX(l[0],l[1],n);a.push({d:u,fill:s(c)})}return t.selectAll(NX.region.class).data(a,function(t,e){return e}).join(function(t){return t.append("path").each(function(t,e){var n=JV(t,[t,e,a]);this.attr(n)}).attr("className",NX.region.name)},function(t){return t.transition(function(t,e){return oX(this,JV(t,[t,e,a]),r.update)})},function(t){return t.transition(function(){var t=this,e=AX(this,r.exit);return nX(e,function(){return t.remove()}),e})}).transitions()}(o,r,t);return _e(_e([],He(A),!1),He(s),!1)},e}(zW);function PX(t,e){return Object.fromEntries(Object.entries(t).map(function(t){var n=He(t,2);return[n[0],JV(n[1],e)]}))}function DX(t,e){return e&&Gt(e)?t.filter(e):t}function RX(t,e){var n=e.startAngle;return(e.endAngle-n)*t+n}function HX(t,e){if("linear"===e.type){var n=He(e.startPos,2),r=n[0],i=n[1],o=He(e.endPos,2),A=He([o[0]-r,o[1]-i],2);return bW([A[0],A[1]])}var s=qV(RX(t,e));return[-Math.sin(s),Math.cos(s)]}function _X(t,e,n){return function(t,e){return e?[t[1],-t[0]]:[-t[1],t[0]]}(HX(t,n),"positive"!==e)}function GX(t,e){return _X(t,e.labelDirection,e)}function KX(t,e,n){return n?"".concat(t," ").concat(n,"axis-").concat(e):t}function jX(t,e,n,r){return r&&t.attr("className",KX(e.name,n,r)),t}function zX(t,e){return"linear"===e.type?function(t,e){var n=He(e.startPos,2),r=n[0],i=n[1],o=He(e.endPos,2),A=He([o[0]-r,o[1]-i],2);return[r+A[0]*t,i+A[1]*t]}(t,e):function(t,e){var n=e.radius,r=He(e.center,2),i=r[0],o=r[1],A=qV(RX(t,e));return[i+n*Math.cos(A),o+n*Math.sin(A)]}(t,e)}function VX(t){return 0===HX(0,t)[1]}function WX(t){return 0===HX(0,t)[0]}function YX(t,e){return e-t===360}function XX(t,e,n,r,i){var o=e-t,A=He([i,i],2),s=A[0],a=A[1],c=He([qV(t),qV(e)],2),l=c[0],u=c[1],h=function(t){return[n+i*Math.cos(t),r+i*Math.sin(t)]},d=He(h(l),2),f=d[0],g=d[1],p=He(h(u),2),v=p[0],m=p[1];if(YX(t,e)){var y=He(h((u+l)/2),2);return[["M",f,g],["A",s,a,0,1,0,y[0],y[1]],["A",s,a,0,1,0,v,m]]}var w=o>180?1:0,b=t>e?0:1;return"M".concat(f,",").concat(g,",A").concat(s,",").concat(a,",0,").concat(w,",").concat(b,",").concat(v,",").concat(m)}function qX(t,e,n,r){var i=e.startAngle,o=e.endAngle,A=e.center,s=e.radius,a=e.classNamePrefix;return t.selectAll(UX.line.class).data([{d:XX.apply(void 0,_e(_e([i,o],He(A),!1),[s],!1))}],function(t,e){return e}).join(function(t){var n=t.append("path").attr("className",UX.line.name).styles(e).styles({d:function(t){return t.d}});return jX(n,UX.line,BX,a),n},function(t){return t.transition(function(){var t=this,e=function(t,e,n,r){if(!r)return t.attr("__keyframe_data__",n),null;var i=r.duration,o=void 0===i?0:i,A=fW(e,n),s=Math.ceil(+o/16),a=new Array(s).fill(0).map(function(t,e,n){return{__keyframe_data__:A(e/(n.length-1))}});return t.animate(a,Le({fill:"both"},r))}(this,function(t){var e=t.attributes,n=e.startAngle,r=e.endAngle,i=e.center,o=e.radius;return _e(_e([n,r],He(i),!1),[o],!1)}(this),_e(_e([i,o],He(A),!1),[s],!1),r.update);if(e){var n=function(){var e=Ce(t.attributes,"__keyframe_data__");t.style.d=XX.apply(void 0,_e([],He(e),!1))};e.onframe=n,e.onfinish=n}return e}).styles(e)},function(t){return t.remove()}).styles(n).transitions()}function $X(t){var e=He(t,2),n=He(e[0],2),r=n[0],i=n[1],o=He(e[1],2);return{x1:r,y1:i,x2:o[0],y2:o[1]}}function ZX(t,e,n,r){var i=e.showTrunc,o=e.startPos,A=e.endPos,s=e.truncRange,a=e.lineExtension,c=e.classNamePrefix,l=He([o,A],2),u=He(l[0],2),h=u[0],d=u[1],f=He(l[1],2),g=f[0],p=f[1],v=He(a?function(t,e,n){void 0===n&&(n=[0,0]);var r=He([t,e,n],3),i=He(r[0],2),o=i[0],A=i[1],s=He(r[1],2),a=s[0],c=s[1],l=He(r[2],2),u=l[0],h=l[1],d=He([a-o,c-A],2),f=d[0],g=d[1],p=Math.sqrt(Math.pow(f,2)+Math.pow(g,2)),v=He([-u/p,h/p],2),m=v[0],y=v[1];return[m*f,m*g,y*f,y*g]}(o,A,a):new Array(4).fill(0),4),m=v[0],y=v[1],w=v[2],b=v[3],B=function(e){return t.selectAll(UX.line.class).data(e,function(t,e){return e}).join(function(t){var e=t.append("line").styles(n).transition(function(t){return oX(this,$X(t.line),!1)});return e.attr("className",function(t){if(!c)return"".concat(UX.line.name," ").concat(t.className);var e=KX(UX.line.name,BX,c);if(t.className===UX.lineFirst.name){var n=KX(UX.lineFirst.name,EX,c);return"".concat(e," ").concat(n)}if(t.className===UX.lineSecond.name){n=KX(UX.lineSecond.name,xX,c);return"".concat(e," ").concat(n)}return e}),e},function(t){return t.styles(n).transition(function(t){return oX(this,$X(t.line),r.update)})},function(t){return t.remove()}).transitions()};if(!i||!s)return B([{line:[[h+m,d+y],[g+w,p+b]],className:UX.line.name}]);var E=He(s,2),x=E[0],C=E[1],M=g-h,F=p-d,k=He([h+M*x,d+F*x],2),S=k[0],Q=k[1],U=He([h+M*C,d+F*C],2),N=U[0],T=U[1],O=B([{line:[[h+m,d+y],[S,Q]],className:UX.lineFirst.name},{line:[[N,T],[g+w,p+b]],className:UX.lineSecond.name}]);return function(t,e){e.truncRange,e.truncShape,e.lineExtension}(0,e),O}function JX(t,e,n){var r,i=e.type,o=PW(e,"line");return r="linear"===i?ZX(t,e,EW(o,"arrow"),n):qX(t,e,EW(o,"arrow"),n),function(t,e,n,r){var i,o=n.showArrow,A=n.showTrunc,s=n.lineArrow,a=n.lineArrowOffset,c=n.lineArrowSize;if(i="arc"===e?t.select(UX.line.class):A?t.select(UX.lineSecond.class):t.select(UX.line.class),!o||!s||"arc"===n.type&&YX(n.startAngle,n.endAngle)){var l=i.node();l&&(l.style.markerEnd=void 0)}else{var u=uW(s);u.attr(r),kW(u,c),i.style("markerEnd",u).style("markerEndOffset",-a)}}(t,i,e,o),r}function tq(t){var e=t.type,n=t.gridCenter;return"linear"===e?n:n||t.center}function eq(t,e){var n=e.gridLength;return t.map(function(t,r){var i=t.value,o=He(zX(i,e),2),A=o[0],s=o[1],a=He(gW(function(t,e){return _X(t,e.gridDirection,e)}(i,e),n),2);return{id:r,points:[[A,s],[A+a[0],s+a[1]]]}})}function nq(t,e,n,r){var i=n.classNamePrefix,o=PW(n,"grid"),A=o.type,s=o.areaFill,a=tq(n),c=DX(e,n.gridFilter),l="segment"===A?eq(c,n):function(t,e){var n=e.gridControlAngles,r=tq(e);if(!r)throw new Error("grid center is not provide");if(t.length<2)throw new Error("Invalid grid data");if(!n||0===n.length)throw new Error("Invalid gridControlAngles");var i=He(r,2),o=i[0],A=i[1];return t.map(function(t,r){var i=He(zX(t.value,e),2),s=i[0],a=i[1],c=He([s-o,a-A],2),l=c[0],u=c[1],h=[];return n.forEach(function(t){var e=qV(t),n=He([Math.cos(e),Math.sin(e)],2),r=n[0],i=n[1],s=l*r-u*i+o,a=l*i+u*r+A;h.push([s,a])}),{points:h,id:r}})}(c,n),u=Le(Le({},o),{center:a,areaFill:Gt(s)?c.map(function(t,e){return JV(s,[t,e,c])}):s,animate:r,data:l});return t.selectAll(UX.grid.class).data([1]).join(function(t){var e=t.append(function(){return new LX({style:u})}).attr("className",UX.grid.name);return jX(e,UX.grid,bX,i),e},function(t){return t.transition(function(){return this.update(u)})},function(t){return t.remove()}).transitions()}var rq=function(){function t(t,e,n,r){this.set(t,e,n,r)}return Object.defineProperty(t.prototype,"left",{get:function(){return this.x1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y2},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.defined("x2")&&this.defined("x1")?this.x2-this.x1:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.defined("y2")&&this.defined("y1")?this.y2-this.y1:void 0},enumerable:!1,configurable:!0}),t.prototype.rotatedPoints=function(t,e,n){var r=this,i=r.x1,o=r.y1,A=r.x2,s=r.y2,a=Math.cos(t),c=Math.sin(t),l=e-e*a+n*c,u=n-e*c-n*a;return[[a*i-c*s+l,c*i+a*s+u],[a*A-c*s+l,c*A+a*s+u],[a*i-c*o+l,c*i+a*o+u],[a*A-c*o+l,c*A+a*o+u]]},t.prototype.set=function(t,e,n,r){return n<t?(this.x2=t,this.x1=n):(this.x1=t,this.x2=n),r<e?(this.y2=e,this.y1=r):(this.y1=e,this.y2=r),this},t.prototype.defined=function(t){return this[t]!==Number.MAX_VALUE&&this[t]!==-Number.MAX_VALUE},t}();function iq(t,e){var n=t.getEulerAngles()||0;t.setEulerAngles(0);var r=t.getBounds(),i=He(r.min,2),o=i[0],A=i[1],s=He(r.max,2),a=s[0],c=s[1],l=t.getBBox(),u=l.width,h=l.height,d=0,f=0,g=o,p=A,v=sW(t);if(v){h-=1.5;var m=v.style.textAlign,y=v.style.textBaseline;"center"===m?g=(o+a)/2:"right"!==m&&"end"!==m||(g=a),"middle"===y?p=(A+c)/2:"bottom"===y&&(p=c)}var w=He(UW(e),4),b=w[0],B=void 0===b?0:b,E=w[1],x=void 0===E?0:E,C=w[2],M=void 0===C?B:C,F=w[3],k=new rq((d+=o)-(void 0===F?x:F),(f+=A)-B,d+u+x,f+h+M);return t.setEulerAngles(n),k.rotatedPoints(qV(n),g,p)}function oq(t,e){return e[0]<=Math.max(t[0][0],t[1][0])&&e[0]<=Math.min(t[0][0],t[1][0])&&e[1]<=Math.max(t[0][1],t[1][1])&&e[1]<=Math.min(t[0][1],t[1][1])}function Aq(t,e,n){var r=(e[1]-t[1])*(n[0]-e[0])-(e[0]-t[0])*(n[1]-e[1]);return 0===r?0:r<0?2:1}function sq(t,e){var n=Aq(t[0],t[1],e[0]),r=Aq(t[0],t[1],e[1]),i=Aq(e[0],e[1],t[0]),o=Aq(e[0],e[1],t[1]);return n!==r&&i!==o||(!(0!==n||!oq(t,e[0]))||(!(0!==r||!oq(t,e[1]))||(!(0!==i||!oq(e,t[0]))||!(0!==o||!oq(e,t[1])))))}function aq(t,e){return e.every(function(e){return function(t,e){var n=t.length;if(n<3)return!1;var r=[e,[9999,e[1]]],i=0,o=0;do{var A=[t[o],t[(o+1)%n]];if(sq(A,r)){if(0===Aq(A[0],e,A[1]))return oq(A,e);i++}o=(o+1)%n}while(0!==o);return!!(1&i)}(t,e)})}function cq(t,e){return[[t[0],t[1],t[2],t[3]],[t[2],t[3],t[4],t[5]],[t[4],t[5],t[6],t[7]],[t[6],t[7],t[0],t[1]]].some(function(t){return function(t,e){var n=He(t,4),r=n[0],i=n[1],o=n[2],A=n[3],s=He(e,4),a=s[0],c=s[1],l=o-r,u=A-i,h=s[2]-a,d=s[3]-c,f=l*d-h*u;if(0===f)return!1;var g=f>0,p=r-a,v=i-c,m=l*v-u*p;if(m<0===g)return!1;var y=h*v-d*p;return y<0!==g&&m>f!==g&&y>f!==g}(e,t)})}function lq(t,e,n){var r,i,o=e.crossPadding,A=new Set,s=null,a=function(t,e){var n=t.type,r=t.labelDirection,i=t.crossSize;if(!i)return!1;if("arc"===n){var o=t.center,A=t.radius,s=He(o,2),a=s[0],c=s[1],l="negative"===r?0:i,u=-A-l,h=A+l,d=He(UW(e),4),f=d[0],g=d[1],p=d[2],v=d[3];return new rq(a+u-v,c+u-f,a+h+g,c+h+p)}var m=He(t.startPos,2),y=m[0],w=m[1],b=He(t.endPos,2),B=b[0],E=b[1],x=He(WX(t)?[-e,0,e,0]:[0,e,0,-e],4),C=x[0],M=x[1],F=x[2],k=x[3],S=gW(GX(0,t),i),Q=new rq(y,w,B,E);return Q.x1+=k,Q.y1+=C,Q.x2+=M+S[0],Q.y2+=F+S[1],Q}(e,o),c=function(t){return!a||function(t,e,n){var r=t.x1,i=t.x2,o=t.y1,A=t.y2;return aq([[r,o],[i,o],[i,A],[r,A]],iq(e,n))}(a,t)},l=function(t,e){return!t||!t.firstChild||!function(t,e,n){var r,i,o=iq(t,n).flat(1),A=iq(e,n).flat(1),s=[[o[0],o[1],o[2],o[3]],[o[0],o[1],o[4],o[5]],[o[4],o[5],o[6],o[7]],[o[2],o[3],o[6],o[7]]];try{for(var a=Re(s),c=a.next();!c.done;c=a.next())if(cq(A,c.value))return!0}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return!1}(t.firstChild,e.firstChild,UW(n))};try{for(var u=Re(t),h=u.next();!h.done;h=u.next()){var d=h.value;c(d)?!s||l(s,d)?s=d:(A.add(s),A.add(d)):A.add(d)}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return Array.from(A)}function uq(t,e){return void 0===e&&(e={}),Kt(t)?0:"number"==typeof t?t:Math.floor(oW(t,e))}var hq=function(t,e){var n=e.seq,r=void 0===n?2:n;return t.filter(function(t,e){return!(e%r)||(zV(t),!1)})},dq=function(t){return t.filter(iW)};var fq=new Map([["hide",function(t,e,n,r){var i=t.length,o=e.keepHeader,A=e.keepTail;if(!(i<=1||2===i&&o&&A)){var s,a,c=hq,l=function(t){return t.forEach(r.show),t},u=2,h=t.slice(),d=t.slice(),f=Math.min.apply(Math,_e([1],He(t.map(function(t){return t.getBBox().width})),!1));if("linear"===n.type&&(VX(n)||WX(n))){var g=NW(t[0]).left,p=NW(t[i-1]).right,v=Math.abs(p-g)||1;u=Math.max(Math.floor(i*f/v),u)}for(o&&(s=h.splice(0,1)[0]),A&&(a=h.splice(-1,1)[0],h.reverse()),l(h);u<t.length&&lq(dq(a?_e(_e([a],He(d),!1),[s],!1):_e([s],He(d),!1)),n,null==e?void 0:e.margin).length;){if(a&&!s&&u%2==0)h.splice(0,1).forEach(r.hide);else if(a&&s){h.splice(0,1).forEach(r.hide)}d=c(l(h),{seq:u}),u++}}}],["rotate",function(t,e,n,r){var i,o,A=e.optionalAngles,s=void 0===A?[0,45,90]:A,a=e.margin,c=e.recoverWhenFailed,l=void 0===c||c,u=t.map(function(t){return t.getLocalEulerAngles()}),h=function(){return lq(t,n,a).length<1},d=function(e){return t.forEach(function(t,n){var i=Array.isArray(e)?e[n]:e;r.rotate(t,+i)})};try{for(var f=Re(s),g=f.next();!g.done;g=f.next()){if(d(g.value),h())return}}catch(t){i={error:t}}finally{try{g&&!g.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}l&&d(u)}],["ellipsis",function(t,e,n,r){if(!(t.length<=0)){var i=e.suffix,o=void 0===i?"...":i,A=e.minLength,s=e.maxLength,a=void 0===s?1/0:s,c=e.step,l=void 0===c?" ":c,u=e.margin,h=void 0===u?[0,0,0,0]:u,d=AW(r.getTextShape(t[0])),f=uq(l,d),g=A?uq(A,d):f,p=uq(a,d);(Kt(p)||p===1/0)&&(p=Math.max.apply(null,t.map(function(t){return t.getBBox().width})));var v=t.slice(),m=He(h,4);m[0],m[1],m[2],m[3];for(var y=function(e){if(v.forEach(function(t){r.ellipsis(r.getTextShape(t),e,o)}),(v=lq(t,n,h)).length<1)return{value:void 0}},w=p;w>g+f;w-=f){var b=y(w);if("object"==typeof b)return b.value}}}],["wrap",function(t,e,n,r,i){var o,A=e.maxLines,s=void 0===A?3:A,a=e.recoverWhenFailed,c=void 0===a||a,l=e.margin,u=void 0===l?[0,0,0,0]:l,h=JV(null!==(o=e.wordWrapWidth)&&void 0!==o?o:50,[i]),d=t.map(function(t){return t.attr("maxLines")||1}),f=Math.min.apply(Math,_e([],He(d),!1)),g=function(){return lq(t,n,u).length<1},p=function(t){var e=t.type,n=t.labelDirection;return"linear"===e&&VX(t)?"negative"===n?"bottom":"top":"middle"}(n),v=function(e){return t.forEach(function(t,n){var i=Array.isArray(e)?e[n]:e;r.wrap(t,h,i,p)})};if(!(f>s)){if("linear"===n.type&&VX(n)){if(v(s),g())return}else for(var m=f;m<=s;m++)if(v(m),g())return;c&&v(d)}}]]);function gq(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return t.reduce(function(t,e){return t*function(t){return"positive"===t?-1:1}(e)},1)}function pq(t){for(var e=t;e<0;)e+=360;return Math.round(e%360)}function vq(t,e){var n=He(t,2),r=n[0],i=n[1],o=He(e,2),A=o[0],s=o[1],a=He([r*A+i*s,r*s-i*A],2),c=a[0],l=a[1];return Math.atan2(l,c)}function mq(t,e,n){var r,i=n.labelAlign;if(null===(r=e.style.transform)||void 0===r?void 0:r.includes("rotate"))return e.getLocalEulerAngles();var o=GX(t.value,n),A=HX(t.value,n);return"horizontal"===i?0:function(t){var e=(t+360)%180;return dW(e,-90,90)||(e+=180),e}($V("perpendicular"===i?vq([1,0],o):vq([A[0]<0?-1:1,0],A)))}function yq(t,e,n){var r=n.type,i=n.labelAlign,o=GX(t,n),A=pq(e),s=pq($V(vq([1,0],o))),a="center",c="middle";return"linear"===r?[90,270].includes(s)&&0===A?(a="center",c=1===o[1]?"top":"bottom"):s%180||![90,270].includes(A)?0===s?(dW(A,0,90,!1,!0)||dW(A,0,90)||dW(A,270,360))&&(a="start"):90===s?dW(A,0,90,!1,!0)?a="start":(dW(A,90,180)||dW(A,270,360))&&(a="end"):270===s?dW(A,0,90,!1,!0)?a="end":(dW(A,90,180)||dW(A,270,360))&&(a="start"):180===s&&(90===A?a="start":(dW(A,0,90)||dW(A,270,360))&&(a="end")):a="center":"parallel"===i?c=dW(s,0,180,!0)?"top":"bottom":"horizontal"===i?dW(s,90,270,!1)?a="end":(dW(s,270,360,!1)||dW(s,0,90))&&(a="start"):"perpendicular"===i&&(a=dW(s,90,270)?"end":"start"),{textAlign:a,textBaseline:c}}function wq(t,e,n){var r=n.showTick,i=n.tickLength,o=n.tickDirection,A=n.labelDirection,s=n.labelSpacing,a=e.indexOf(t),c=JV(s,[t,a,e]),l=He([GX(t.value,n),gq(A,o)],2),u=He(pW(gW(l[0],c+(1===l[1]?JV(r?i:0,[t,a,e]):0)),zX(t.value,n)),2);return{x:u[0],y:u[1]}}function bq(t,e,n,r){var i=r.labelRender,o=(Ce(r,"endPos.0",400)-Ce(r,"startPos.0",0))/n.length,A=Gt(i)?JV(i,[t,e,n,GX(t.value,r)]):t.label||"",s=function(t){var e=(new DOMParser).parseFromString(t,"text/html").body.firstElementChild;if(console.log(null==e?void 0:e.getClientRects(),11),!e)return 0;var n=e.getAttribute("style")||"",r=Object.fromEntries(n.split(";").map(function(t){return t.trim()}).filter(function(t){return t.includes(":")}).map(function(t){var e=He(t.split(":").map(function(t){return t.trim()}),2),n=e[0],r=e[1];return[n.toLowerCase(),r]})),i=function(t){if(!t)return 0;var e=t.match(/([\d.]+)px/);return e?parseFloat(e[1]):0};if(r.height)return i(r.height);var o,A=i(r["font-size"])||16,s=r["line-height"];o=s&&"normal"!==s?s.endsWith("px")?i(s):/^[\d.]+$/.test(s)?parseFloat(s)*A:A:1.2*A;var a=i(r["padding-top"]),c=i(r["padding-bottom"]);r.padding&&(1===(l=r.padding.split(/\s+/).map(i)).length||2===l.length?(a=l[0],c=l[0]):(3===l.length||4===l.length)&&(a=l[0],c=l[2]));var l,u=i(r["border-top-width"]),h=i(r["border-bottom-width"]);if(r.border){var d=r.border.match(/([\d.]+)px/);d&&(u=parseFloat(d[1]),h=parseFloat(d[1]))}return r["border-width"]&&(1===(l=r["border-width"].split(/\s+/).map(i)).length||2===l.length?(u=l[0],h=l[0]):(3===l.length||4===l.length)&&(u=l[0],h=l[2])),o+a+c+u+h}(A)||30;return function(){return e={width:o,height:s},"function"==typeof(t=A)?t():Jt(t)||re(t)?new $a({style:Le(Le({pointerEvents:"auto"},e),{innerHTML:t})}):t;var t,e}}var Bq={html:["fill"],text:[]};function Eq(t,e){["text","html"].includes(t.nodeName)&&t.attr(EW(e,Bq[t.nodeName]))}function xq(t,e){!function(t,e,n,r){var i=e.labelOverlap,o=void 0===i?[]:i;o.length&&o.forEach(function(i){var o=i.type,A=fq.get(o);(function(t,e,n){return!(e.labelOverlap.length<1)&&("hide"===n?!function(t){for(var e=t;e;){if("offscreen"===e.className)return!0;e=e.parent}return!1}(t[0]):"rotate"===n?!t.some(function(t){var e;return!!(null===(e=t.attr("transform"))||void 0===e?void 0:e.includes("rotate"))}):"ellipsis"!==n&&"wrap"!==n||t.filter(function(t){return t.querySelector("text")}).length>=1)})(t,e,o)&&(null==A||A(t,i,e,r,n))})}(this.node().childNodes,t,e,{hide:zV,show:jV,rotate:function(e,n){!function(t,e,n){e.setLocalEulerAngles(t);var r=yq(e.__data__.value,t,n),i=e.querySelector(UX.labelItem.class);i&&Eq(i,r)}(+n,e,t)},ellipsis:function(t,e,n){t&&cW(t,e||1/0,n)},wrap:function(t,e,n){var r,i;t&&(void 0===(r=n)&&(r=2),void 0===i&&(i="top"),aW(t,{wordWrap:!0,wordWrapWidth:e,maxLines:r,textBaseline:i}))},getTextShape:function(t){return t.querySelector(UX.labelItem.class)}})}function Cq(t,e,n,r,i){var o=n.indexOf(e),A=i.labelRender,s=i.classNamePrefix,a=QW(t).append(A?bq(e,o,n,i):function(t,e,n,r){var i=r.labelFormatter;return Gt(i)?function(){return uW(JV(i,[t,e,n,GX(t.value,r)]))}:function(){return uW(t.label||"")}}(e,o,n,i)).attr("className",UX.labelItem.name).node();jX(QW(a),UX.labelItem,kX,s);var c=He(RW(PX(r,[e,o,n])),2),l=c[0],u=c[1],h=u.transform,d=Pe(u,["transform"]);_W(a,h);var f=mq(e,a,i);if(a.getLocalEulerAngles()||a.setLocalEulerAngles(f),Eq(a,Le(Le({},yq(e.value,f,i)),l)),"html"===a.nodeName){var g=a.getBBox(),p=a.style.x||0;a.attr("x",p-g.width/2)}return t.attr(d),a}function Mq(t,e,n,r,i){var o,A,s,a=n.classNamePrefix,c=DX(e,n.labelFilter),l=PW(n,"label"),u=t.selectAll(UX.label.class).data(c,function(t,e){return e}).join(function(t){var r=t.append("g").attr("className",UX.label.name).transition(function(t){Cq(this,t,e,l,n);var r=wq(t,e,n),i=r.x,o=r.y;return this.style.transform="translate(".concat(i,", ").concat(o,")"),null});return jX(r,UX.label,FX,a),r},function(t){return t.transition(function(t){var i=function(t,e,n,r){if(void 0===r&&(r="destroy"),function(t,e){return"text"===t.nodeName&&"text"===e.nodeName&&t.attributes.text===e.attributes.text}(t,e))return t.remove(),[null];var i=function(){"destroy"===r?t.destroy():"hide"===r&&zV(t),e.isVisible()&&jV(e)};if(!n)return i(),[null];var o=n.duration,A=void 0===o?0:o,s=n.delay,a=void 0===s?0:s,c=Math.ceil(+A/2),l=+A/4,u=He(t.getGeometryBounds().center,2),h=u[0],d=u[1],f=He(e.getGeometryBounds().center,2),g=He([(h+f[0])/2-h,(d+f[1])/2-d],2),p=g[0],v=g[1],m=t.style.opacity,y=void 0===m?1:m,w=e.style.opacity,b=void 0===w?1:w,B=t.style.transform||"",E=e.style.transform||"",x=t.animate([{opacity:y,transform:"translate(0, 0) ".concat(B)},{opacity:0,transform:"translate(".concat(p,", ").concat(v,") ").concat(B)}],Le(Le({fill:"both"},n),{duration:a+c+l})),C=e.animate([{opacity:0,transform:"translate(".concat(-p,", ").concat(-v,") ").concat(E),offset:.01},{opacity:b,transform:"translate(0, 0) ".concat(E)}],Le(Le({fill:"both"},n),{duration:c+l,delay:a+c-l}));return nX(C,i),[x,C]}(this.querySelector(UX.labelItem.class),Cq(this,t,e,l,n),r.update),o=wq(t,e,n),A=o.x,s=o.y,a=oX(this,{transform:"translate(".concat(A,", ").concat(s,")")},r.update);return _e(_e([],He(i),!1),[a],!1)})},function(t){return o=t,t.transition(function(){var t=this,e=AX(this.childNodes[0],r.exit);return nX(e,function(){return QW(t).remove()}),e}),o}).transitions();return s=function(){xq.call(t,n,i)},0===(A=u).length?s():Promise.all(A.map(function(t){return null==t?void 0:t.finished})).then(s),u}function Fq(t,e){return _X(t,e.tickDirection,e)}function kq(t,e,n,r,i){var o=He(function(t,e){var n=He(t,2);return[[0,0],[n[0]*e,n[1]*e]]}(r,JV(i.tickLength,[t,e,n])),2),A=He(o[0],2),s=A[0],a=A[1],c=He(o[1],2);return{x1:s,x2:c[0],y1:a,y2:c[1]}}function Sq(t,e,n,r,i,o){var A=function(t,e,n,r,i){var o=i.tickFormatter,A=i.classNamePrefix,s=Fq(e.value,i),a="line";Gt(o)&&(a=function(){return JV(o,[e,n,r,s])});var c=t.append(a).attr("className",UX.tickItem.name);return jX(c,UX.tickItem,MX,A),c}(QW(this),t,e,n,r);!function(t,e,n,r,i,o,A){var s=Fq(t.value,o),a=kq(t,e,n,s,o),c=a.x1,l=a.x2,u=a.y1,h=a.y2,d=He(RW(PX(A,[t,e,n,s])),2),f=d[0],g=d[1];"line"===r.node().nodeName&&r.styles(Le({x1:c,x2:l,y1:u,y2:h},f)),i.attr(g),r.styles(f)}(t,e,n,A,this,r,i);var s=He(zX(t.value,r),2),a=s[0],c=s[1];return oX(this,{transform:"translate(".concat(a,", ").concat(c,")")},o)}function Qq(t,e,n,r,i){var o=He(RW(PW(r,"title")),2),A=o[0],s=o[1],a=s.transform,c=s.transformOrigin,l=Pe(s,["transform","transformOrigin"]);e.styles(l);var u=a||function(t,e,n){var r=2*t.getGeometryBounds().halfExtents[1];if("vertical"===e){if("left"===n)return"rotate(-90) translate(0, ".concat(r/2,")");if("right"===n)return"rotate(-90) translate(0, -".concat(r/2,")")}return""}(t.node(),A.direction,A.position);t.styles(Le(Le({},A),{transformOrigin:c})),_W(t.node(),u);var h=function(t,e,n){var r=n.titlePosition,i=void 0===r?"lb":r,o=n.titleSpacing,A=KW(i),s=t.node().getLocalBounds(),a=He(s.min,2),c=a[0],l=a[1],u=He(s.halfExtents,2),h=u[0],d=u[1],f=He(e.node().getLocalBounds().halfExtents,2),g=f[0],p=f[1],v=He([c+h,l+d],2),m=v[0],y=v[1],w=He(UW(o),4),b=w[0],B=w[1],E=w[2],x=w[3];if(["start","end"].includes(i)&&"linear"===n.type){var C=n.startPos,M=n.endPos,F=He("start"===i?[C,M]:[M,C],2),k=F[0],S=F[1],Q=He(gW(bW([-S[0]+k[0],-S[1]+k[1]]),b),2),U=Q[0],N=Q[1];return{x:k[0]+U,y:k[1]+N}}return A.includes("t")&&(y-=d+p+b),A.includes("r")&&(m+=h+g+B),A.includes("l")&&(m-=h+g+x),A.includes("b")&&(y+=d+p+E),{x:m,y:y}}(QW(n._offscreen||n.querySelector(UX.mainGroup.class)),e,r),d=h.x,f=h.y;return oX(e.node(),{transform:"translate(".concat(d,", ").concat(f,")")},i)}function Uq(t,e,n,r){var i=t.showLine,o=t.showTick,A=t.showLabel,s=t.classNamePrefix,a=e.maybeAppendByClassName(UX.lineGroup,"g");jX(a,UX.lineGroup,vX,s);var c=hW(i,a,function(e){return JX(e,t,r)})||[],l=e.maybeAppendByClassName(UX.tickGroup,"g");jX(l,UX.tickGroup,mX,s);var u=hW(o,l,function(e){return function(t,e,n,r){var i=n.classNamePrefix,o=DX(e,n.tickFilter),A=PW(n,"tick");return t.selectAll(UX.tick.class).data(o,function(t){return t.id||t.label}).join(function(t){var e=t.append("g").attr("className",UX.tick.name).transition(function(t,e){return Sq.call(this,t,e,o,n,A,!1)});return jX(e,UX.tick,CX,i),e},function(t){return t.transition(function(t,e){return this.removeChildren(),Sq.call(this,t,e,o,n,A,r.update)})},function(t){return t.transition(function(){var t=this,e=AX(this.childNodes[0],r.exit);return nX(e,function(){return t.remove()}),e})}).transitions()}(e,n,t,r)})||[],h=e.maybeAppendByClassName(UX.labelGroup,"g");jX(h,UX.labelGroup,yX,s);var d=hW(A,h,function(i){return Mq(i,n,t,r,e.node())})||[];return _e(_e(_e([],He(c),!1),He(u),!1),He(d),!1).filter(function(t){return!!t})}var Nq=function(t){function e(e){return t.call(this,e,QX)||this}return Ie(e,t),e.prototype.render=function(t,e,n){var r=this,i=t.titleText,o=t.data,A=t.animate,s=t.showTitle,a=t.showGrid,c=t.dataThreshold,l=t.truncRange,u=t.classNamePrefix,h=e.className||"axis";u?e.attr("className","".concat(h," ").concat(u,"axis")):e.className||e.attr("className","axis");var d=function(t,e){if(t.length<=e)return t;for(var n=Math.floor(t.length/e),r=[],i=0;i<t.length;i+=n)r.push(t[i]);return r}(o,c).filter(function(t){var e=t.value;return!(l&&e>l[0]&&e<l[1])}),f=eX(void 0===n?A:n),g=QW(e).maybeAppendByClassName(UX.gridGroup,"g");jX(g,UX.gridGroup,gX,u);var p=hW(a,g,function(e){return nq(e,d,t,f)})||[],v=QW(e).maybeAppendByClassName(UX.mainGroup,"g");jX(v,UX.mainGroup,pX,u),i&&(!this.initialized&&f.enter||this.initialized&&f.update)&&Uq(t,QW(this.offscreenGroup),d,eX(!1));var m=Uq(t,QW(v.node()),d,f),y=QW(e).maybeAppendByClassName(UX.titleGroup,"g");jX(y,UX.titleGroup,wX,u);var w=hW(s,y,function(e){return function(t,e,n,r){var i=n.titleText,o=n.classNamePrefix;return t.selectAll(UX.title.class).data([{title:i}].filter(function(t){return!!t.title}),function(t,e){return t.title}).join(function(A){var s=A.append(function(){return uW(i)}).attr("className",UX.title.name).transition(function(){return Qq(QW(this),t,e,n,r.enter)});return jX(s,UX.title,SX,o),s},function(i){return i.transition(function(){return Qq(QW(this),t,e,n,r.update)})},function(t){return t.remove()}).transitions()}(e,r,t,f)})||[];return _e(_e(_e([],He(p),!1),He(m),!1),He(w),!1).flat().filter(function(t){return!!t})},e}(zW);function Tq(t,e,n){return n?"".concat(t," ").concat(n,"legend-").concat(e):t}function Oq(t,e,n){return void 0===t&&(t="horizontal"),"horizontal"===t?e:n}JW.registerSymbol("hiddenHandle",function(t,e,n){var r=1.4*n;return[["M",t-n,e-r],["L",t+n,e-r],["L",t+n,e+r],["L",t-n,e+r],["Z"]]}),JW.registerSymbol("verticalHandle",function(t,e,n){var r=1.4*n,i=n/2,o=n/6,A=t+.4*r;return[["M",t,e],["L",A,e+i],["L",t+r,e+i],["L",t+r,e-i],["L",A,e-i],["Z"],["M",A,e+o],["L",t+r-2,e+o],["M",A,e-o],["L",t+r-2,e-o]]}),JW.registerSymbol("horizontalHandle",function(t,e,n){var r=1.4*n,i=n/2,o=n/6,A=e+.4*r;return[["M",t,e],["L",t-i,A],["L",t-i,e+r],["L",t+i,e+r],["L",t+i,A],["Z"],["M",t-o,A],["L",t-o,e+r-2],["M",t+o,A],["L",t+o,e+r-2]]});var Iq="title",Lq="item",Pq="marker",Dq="label",Rq="value",Hq="focus-icon",_q="background",Gq="handle-marker",Kq="handle-label",jq="prev-btn",zq="next-btn",Vq="page-info",Wq=eW({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),Yq={showLabel:!0,formatter:function(t){return t.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0};!function(t){function e(e){return t.call(this,e,Yq)||this}Ie(e,t),e.prototype.render=function(t,e){var n=QW(e).maybeAppendByClassName(Wq.markerGroup,"g");this.renderMarker(n);var r=QW(e).maybeAppendByClassName(Wq.labelGroup,"g");this.renderLabel(r)},e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.orientation,i=n.classNamePrefix,o=n.markerSymbol,A=void 0===o?Oq(r,"horizontalHandle","verticalHandle"):o;hW(!!A,t,function(t){var n=PW(e.attributes,"marker"),r=Le({symbol:A},n),o=Tq(Wq.marker.name,Gq,i);if(e.marker=t.maybeAppendByClassName(Wq.marker,function(){return new JW({style:r,className:o})}).update(r),i){var s=e.marker.node().querySelector(".marker");if(s){var a=Tq((s.getAttribute("class")||"").split(" ")[0],Gq,i);s.setAttribute("class",a)}}})},e.prototype.renderLabel=function(t){var e=this,n=this.attributes,r=n.showLabel,i=n.orientation,o=n.spacing,A=void 0===o?0:o,s=n.formatter,a=n.classNamePrefix;hW(r,t,function(t){var n,r=PW(e.attributes,"label"),o=r.text,c=Pe(r,["text"]),l=(null===(n=t.select(Wq.marker.class))||void 0===n?void 0:n.node().getBBox())||{},u=l.width,h=void 0===u?0:u,d=l.height,f=He(Oq(i,[0,(void 0===d?0:d)+A,"center","top"],[h+A,0,"start","middle"]),4),g=f[0],p=f[1],v=f[2],m=f[3],y=Tq(Wq.label.name,Kq,a);t.maybeAppendByClassName(Wq.label,"text").attr("className",y).styles(Le(Le({},c),{x:g,y:p,text:s(o).toString(),textAlign:v,textBaseline:m}))})}}(zW);var Xq={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},qq=rW({},Xq,{});rW({},Xq,DW(Yq,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"});var $q=eW({title:"title",html:"html",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),Zq=eW({text:"text"},"title");function Jq(t,e){var n=Object.entries(e).reduce(function(e,n){var r=He(n,2),i=r[0],o=r[1];return t.node().attr(i)||(e[i]=o),e},{});t.styles(n)}var t$,e$=function(t){function e(e){return t.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return Ie(e,t),e.prototype.getAvailableSpace=function(){var t=this.attributes,e=t.width,n=t.height,r=t.position,i=t.spacing,o=t.inset,A=this.querySelector(Zq.text.class);if(!A)return new ZV(0,0,+e,+n);var s=A.getBBox(),a=s.width,c=s.height,l=He(UW(i),4),u=l[0],h=l[1],d=l[2],f=l[3],g=He([0,0,+e,+n],4),p=g[0],v=g[1],m=g[2],y=g[3],w=KW(r);if(w.includes("i"))return new ZV(p,v,m,y);w.forEach(function(t,r){var i,o,A,s;"t"===t&&(i=He(0===r?[c+d,+n-c-d]:[0,+n],2),v=i[0],y=i[1]),"r"===t&&(o=He([+e-a-f],1),m=o[0]),"b"===t&&(A=He([+n-c-u],1),y=A[0]),"l"===t&&(s=He(0===r?[a+h,+e-a-h]:[0,+e],2),p=s[0],m=s[1])});var b=He(UW(o),4),B=b[0],E=b[1],x=b[2],C=b[3],M=He([C+E,B+x],2),F=M[0],k=M[1];return new ZV(p+C,v+B,m-F,y-k)},e.prototype.getBBox=function(){return this.title?this.title.getBBox():new ZV(0,0,0,0)},e.prototype.render=function(t,e){var n=this;t.width,t.height,t.position,t.spacing;var r=t.classNamePrefix,i=Pe(t,["width","height","position","spacing","classNamePrefix"]),o=He(RW(i),1)[0],A=function(t){var e,n,r,i,o=t,A=o.width,s=o.height,a=o.position,c=He([+A/2,+s/2],2),l=He([+c[0],+c[1],"center","middle"],4),u=l[0],h=l[1],d=l[2],f=l[3],g=KW(a);return g.includes("l")&&(u=(e=He([0,"start"],2))[0],d=e[1]),g.includes("r")&&(u=(n=He([+A,"end"],2))[0],d=n[1]),g.includes("t")&&(h=(r=He([0,"top"],2))[0],f=r[1]),g.includes("b")&&(h=(i=He([+s,"bottom"],2))[0],f=i[1]),{x:u,y:h,textAlign:d,textBaseline:f}}(t),s=A.x,a=A.y,c=A.textAlign,l=A.textBaseline;hW(!!i.text,QW(e),function(t){var e=Tq(Zq.text.name,Iq,r);n.title=t.maybeAppendByClassName(Zq.text,"text").attr("className",e).styles(o).call(Jq,{x:s,y:a,textAlign:c,textBaseline:l}).node()})},e}(zW),n$=eW({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),r$=function(t){function e(e){var n=t.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:$W(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(t,e){return"".concat(t,"/").concat(e)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new Xa({class:n$.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Xa({class:n$.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Ie(e,t),Object.defineProperty(e.prototype,"defaultPage",{get:function(){var t=this.attributes.defaultPage;return ne(t,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageShape",{get:function(){var t=He(function(t){var e;return(null===(e=t[0])||void 0===e?void 0:e.map(function(e,n){return t.map(function(t){return t[n]})}))||[]}(this.pageViews.map(function(t){var e=t.getBBox();return[e.width,e.height]})).map(function(t){return Math.max.apply(Math,_e([],He(t),!1))}),2),e=t[0],n=t[1],r=this.attributes,i=r.pageWidth,o=void 0===i?e:i,A=r.pageHeight;return{pageWidth:o,pageHeight:void 0===A?n:A}},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(e.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e=t.prototype.getBBox.call(this),n=e.x,r=e.y,i=this.controllerShape,o=this.pageShape,A=o.pageWidth,s=o.pageHeight;return new ZV(n,r,A+i.width,s)},e.prototype.goTo=function(t){var e=this,n=this.attributes.animate,r=this,i=r.currPage,o=r.playState,A=r.playWindow,s=r.pageViews;if("idle"!==o||t<0||s.length<=0||t>=s.length)return null;s[i].setLocalPosition(0,0),this.prepareFollowingPage(t);var a=He(this.getFollowingPageDiff(t),2),c=a[0],l=a[1];this.playState="running";var u=iX(A,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-c,", ").concat(-l,")")}],n);return nX(u,function(){e.innerCurrPage=t,e.playState="idle",e.setVisiblePages([t]),e.updatePageInfo()}),u},e.prototype.prev=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n<=0)return null;var r=t?(n-1+e)%e:ne(n-1,0,e);return this.goTo(r)},e.prototype.next=function(){var t=this.attributes.loop,e=this.pageViews.length,n=this.currPage;if(!t&&n>=e-1)return null;var r=t?(n+1)%e:ne(n+1,0,e);return this.goTo(r)},e.prototype.renderClipPath=function(t){var e=this.pageShape,n=e.pageWidth,r=e.pageHeight;n&&r?(this.clipPath=t.maybeAppendByClassName(n$.clipPath,"rect").styles({width:n,height:r}),this.contentGroup.attr("clipPath",this.clipPath.node())):this.contentGroup.style.clipPath=void 0},e.prototype.setVisiblePages=function(t){this.playWindow.children.forEach(function(e,n){t.includes(n)?jV(e):zV(e)})},e.prototype.adjustControllerLayout=function(){var t=this,e=t.prevBtnGroup,n=t.nextBtnGroup,r=t.pageInfoGroup,i=this.attributes,o=i.orientation,A=i.controllerPadding,s=r.getBBox(),a=s.width;s.height;var c=He("horizontal"===o?[-180,0]:[-90,90],2),l=c[0],u=c[1];e.setLocalEulerAngles(l),n.setLocalEulerAngles(u);var h=e.getBBox(),d=h.width,f=h.height,g=n.getBBox(),p=g.width,v=g.height,m=Math.max(d,a,p),y="horizontal"===o?{offset:[[0,0],[d/2+A,0],[d+a+2*A,0]],textAlign:"start"}:{offset:[[m/2,-f-A],[m/2,0],[m/2,v+A]],textAlign:"center"},w=He(y.offset,3),b=He(w[0],2),B=b[0],E=b[1],x=He(w[1],2),C=x[0],M=x[1],F=He(w[2],2),k=F[0],S=F[1],Q=y.textAlign,U=r.querySelector("text");U&&(U.style.textAlign=Q),e.setLocalPosition(B,E),r.setLocalPosition(C,M),n.setLocalPosition(k,S)},e.prototype.updatePageInfo=function(){var t,e=this,n=e.currPage,r=e.pageViews,i=e.attributes.formatter;r.length<2||(null===(t=this.pageInfoGroup.querySelector(n$.pageInfo.class))||void 0===t||t.attr("text",i(n+1,r.length)),this.adjustControllerLayout())},e.prototype.getFollowingPageDiff=function(t){var e=this.currPage;if(e===t)return[0,0];var n=this.attributes.orientation,r=this.pageShape,i=r.pageWidth,o=r.pageHeight,A=t<e?-1:1;return"horizontal"===n?[A*i,0]:[0,A*o]},e.prototype.prepareFollowingPage=function(t){var e=this.currPage,n=this.pageViews;if(this.setVisiblePages([t,e]),t!==e){var r=He(this.getFollowingPageDiff(t),2),i=r[0],o=r[1];n[t].setLocalPosition(i,o)}},e.prototype.renderController=function(t){var e=this,n=this.attributes,r=n.controllerSpacing,i=n.classNamePrefix,o=void 0===i?"":i,A=this.pageShape,s=A.pageWidth,a=A.pageHeight,c=this.pageViews.length>=2,l=t.maybeAppendByClassName(n$.controller,"g");if(VV(l.node(),c),c){var u=PW(this.attributes,"button"),h=PW(this.attributes,"pageNum"),d=He(RW(u),2),f=d[0],g=d[1],p=f.size,v=Pe(f,["size"]),m=!l.select(n$.prevBtnGroup.class).node(),y=l.maybeAppendByClassName(n$.prevBtnGroup,"g").styles(g);this.prevBtnGroup=y.node();var w=y.maybeAppendByClassName(n$.prevBtn,"path");if(o){var b=Tq(n$.prevBtn.name,jq,o);w.node().setAttribute("class",b)}var B=l.maybeAppendByClassName(n$.nextBtnGroup,"g").styles(g);this.nextBtnGroup=B.node();var E=B.maybeAppendByClassName(n$.nextBtn,"path");if(o){var x=Tq(n$.nextBtn.name,zq,o);E.node().setAttribute("class",x)}[w,E].forEach(function(t){t.styles(Le(Le({},v),{transformOrigin:"center"})),kW(t.node(),p)});var C=l.maybeAppendByClassName(n$.pageInfoGroup,"g");this.pageInfoGroup=C.node();var M=C.maybeAppendByClassName(n$.pageInfo,"text");if(M.styles(h),o){var F=Tq(n$.pageInfo.name,Vq,o);M.node().setAttribute("class",F)}this.updatePageInfo(),l.node().setLocalPosition(s+r,a/2),m&&(this.prevBtnGroup.addEventListener("click",function(){e.prev()}),this.nextBtnGroup.addEventListener("click",function(){e.next()}))}},e.prototype.render=function(t,e){var n=t.x,r=void 0===n?0:n,i=t.y,o=void 0===i?0:i;this.attr("transform","translate(".concat(r,", ").concat(o,")"));var A=QW(e);this.renderClipPath(A),this.renderController(A),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},e.prototype.bindEvents=function(){var t=this,e=pe(function(){return t.render(t.attributes,t)},50);this.playWindow.addEventListener(ea.INSERTED,e),this.playWindow.addEventListener(ea.REMOVED,e)},e}(zW),i$="component-poptip",o$="component-poptip-arrow",A$="component-poptip-text",s$=((t$={})[".".concat(i$)]={visibility:"visible",position:"absolute","background-color":"rgba(0, 0, 0)","box-shadow":"0px 0px 10px #aeaeae","border-radius":"3px",color:"#fff",opacity:.8,"font-size":"12px",padding:"4px 6px",display:"flex","justify-content":"center","align-items":"center","z-index":8,transition:"visibility 50ms"},t$[".".concat(A$)]={"text-align":"center"},t$[".".concat(i$,"[data-position='top']")]={transform:"translate(-50%, -100%)"},t$[".".concat(i$,"[data-position='left']")]={transform:"translate(-100%, -50%)"},t$[".".concat(i$,"[data-position='right']")]={transform:"translate(0, -50%)"},t$[".".concat(i$,"[data-position='bottom']")]={transform:"translate(-50%, 0)"},t$[".".concat(i$,"[data-position='top-left']")]={transform:"translate(0,-100%)"},t$[".".concat(i$,"[data-position='top-right']")]={transform:"translate(-100%,-100%)"},t$[".".concat(i$,"[data-position='left-top']")]={transform:"translate(-100%, 0)"},t$[".".concat(i$,"[data-position='left-bottom']")]={transform:"translate(-100%, -100%)"},t$[".".concat(i$,"[data-position='right-top']")]={transform:"translate(0, 0)"},t$[".".concat(i$,"[data-position='right-bottom']")]={transform:"translate(0, -100%)"},t$[".".concat(i$,"[data-position='bottom-left']")]={transform:"translate(0, 0)"},t$[".".concat(i$,"[data-position='bottom-right']")]={transform:"translate(-100%, 0)"},t$[".".concat(o$)]={width:"4px",height:"4px",transform:"rotate(45deg)","background-color":"rgba(0, 0, 0)",position:"absolute","z-index":-1},t$[".".concat(i$,"[data-position='top']")]={transform:"translate(-50%, calc(-100% - 5px))"},t$["[data-position='top'] .".concat(o$)]={bottom:"-2px"},t$[".".concat(i$,"[data-position='left']")]={transform:"translate(calc(-100% - 5px), -50%)"},t$["[data-position='left'] .".concat(o$)]={right:"-2px"},t$[".".concat(i$,"[data-position='right']")]={transform:"translate(5px, -50%)"},t$["[data-position='right'] .".concat(o$)]={left:"-2px"},t$[".".concat(i$,"[data-position='bottom']")]={transform:"translate(-50%, 5px)"},t$["[data-position='bottom'] .".concat(o$)]={top:"-2px"},t$[".".concat(i$,"[data-position='top-left']")]={transform:"translate(0, calc(-100% - 5px))"},t$["[data-position='top-left'] .".concat(o$)]={left:"10px",bottom:"-2px"},t$[".".concat(i$,"[data-position='top-right']")]={transform:"translate(-100%, calc(-100% - 5px))"},t$["[data-position='top-right'] .".concat(o$)]={right:"10px",bottom:"-2px"},t$[".".concat(i$,"[data-position='left-top']")]={transform:"translate(calc(-100% - 5px), 0)"},t$["[data-position='left-top'] .".concat(o$)]={right:"-2px",top:"8px"},t$[".".concat(i$,"[data-position='left-bottom']")]={transform:"translate(calc(-100% - 5px), -100%)"},t$["[data-position='left-bottom'] .".concat(o$)]={right:"-2px",bottom:"8px"},t$[".".concat(i$,"[data-position='right-top']")]={transform:"translate(5px, 0)"},t$["[data-position='right-top'] .".concat(o$)]={left:"-2px",top:"8px"},t$[".".concat(i$,"[data-position='right-bottom']")]={transform:"translate(5px, -100%)"},t$["[data-position='right-bottom'] .".concat(o$)]={left:"-2px",bottom:"8px"},t$[".".concat(i$,"[data-position='bottom-left']")]={transform:"translate(0, 5px)"},t$["[data-position='bottom-left'] .".concat(o$)]={top:"-2px",left:"8px"},t$[".".concat(i$,"[data-position='bottom-right']")]={transform:"translate(-100%, 5px)"},t$["[data-position='bottom-right'] .".concat(o$)]={top:"-2px",right:"8px"},t$);function a$(t){var e=t&&document.getElementById(t);return e||((e=document.createElement("div")).setAttribute("id",t),document.body.appendChild(e)),e}var c$=function(t){function e(n){var r=t.call(this,be({style:{id:"component-poptip"}},e.defaultOptions,n))||this;return r.visibility="visible",r.map=new Map,r.domStyles="",r.initShape(),r.render(r.attributes,r),r}return Ie(e,t),Object.defineProperty(e.prototype,"visible",{get:function(){return"visible"===this.visibility},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.visibility=this.style.visibility,this.updatePoptipElement()},e.prototype.update=function(t){this.attr(be({},this.style,t)),this.render(this.attributes,this)},e.prototype.bind=function(t,e){var n=this;if(t){var r=this.style.text,i=function(i){var o=t,A=n.style,s=r;if(e){var a="function"==typeof e?e.call(null,i):e,c=a.html,l=a.target,u=Pe(a,["html","target"]);A=function(t,e,n){return e&&fe(t,e),n&&fe(t,n),t}({},n.style,u),(l||!1===l)&&(o=l),"string"==typeof c&&(s=c)}var h=A.position,d=A.arrowPointAtCenter,f=A.follow,g=A.offset;if(o){var p=i,v=He(function(t,e,n,r,i,o){if(void 0===i&&(i=!1),void 0===o&&(o=!1),o)return[t,e];var A=n.getBoundingClientRect(),s=A.x,a=A.y,c=A.width,l=A.height;switch(r){case"top":return i?[s+c/2,a]:[t,a];case"left":return i?[s,a+l/2]:[s,e];case"bottom":return i?[s+c/2,a+l]:[t,a+l];case"right":return i?[s+c,a+l/2]:[s+c,e];case"top-right":case"right-top":return[s+c,a];case"left-bottom":case"bottom-left":return[s,a+l];case"right-bottom":case"bottom-right":return[s+c,a+l];default:return[s,a]}}(p.clientX,p.clientY,o,h,d,f),2),m=v[0],y=v[1];n.showTip(m,y,{text:s,position:h,offset:g})}else n.hideTip()},o=function(){n.hideTip()};t.addEventListener("mousemove",i),t.addEventListener("mouseleave",o),this.map.set(t,[i,o])}},e.prototype.unbind=function(t){if(this.map.has(t)){var e=He(this.map.get(t)||[],2),n=e[0],r=e[1];n&&t.removeEventListener("mousemove",n),r&&t.removeEventListener("mouseleave",r),this.map.delete(t)}},e.prototype.clear=function(){this.container.innerHTML=""},e.prototype.destroy=function(){var e,n=this;_e([],He(this.map.keys()),!1).forEach(function(t){return n.unbind(t)}),null===(e=this.container)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.showTip=function(t,e,n){var r=Ce(n,"text");if((!r||"string"==typeof r)&&(this.applyStyles(),t&&e&&n)){var i=n.offset,o=n.position;if(o&&this.container.setAttribute("data-position",o),this.setOffsetPosition(t,e,i),"string"==typeof r){var A=this.container.querySelector(".".concat(A$));A&&(A.innerHTML=r)}this.visibility="visible",this.container.style.visibility="visible"}},e.prototype.hideTip=function(){this.visibility="hidden",this.container.style.visibility="hidden"},e.prototype.getContainer=function(){return this.container},e.prototype.getClassName=function(){var t=this.style.containerClassName;return"".concat(i$).concat(t?" ".concat(t):"")},e.prototype.initShape=function(){var t=this,e=this.style.id;this.container=function(t){var e,n,r=(e=a$,function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return n||(n=e.apply(void 0,t)),n})(t);return r}(e),this.container.className=this.getClassName(),this.container.addEventListener("mousemove",function(){return t.showTip()}),this.container.addEventListener("mouseleave",function(){return t.hideTip()})},e.prototype.updatePoptipElement=function(){var t=this.container;this.clear();var e=this.style,n=e.id,r=e.template,i=e.text;this.container.setAttribute("id",n),this.container.className=this.getClassName();var o,A='<span class="'.concat(o$,'"></span>');t.innerHTML=A,Jt(r)?t.innerHTML+=r:r&&((o=r)instanceof Element||o instanceof Document)&&t.appendChild(r),i&&(t.getElementsByClassName(A$)[0].textContent=i),this.applyStyles(),this.container.style.visibility=this.visibility},e.prototype.applyStyles=function(){var t=rW({},s$,this.style.domStyles),e=Object.entries(t).reduce(function(t,e){var n=He(e,2),r=n[0],i=n[1],o=Object.entries(i).reduce(function(t,e){var n=He(e,2),r=n[0],i=n[1];return"".concat(t).concat(r,": ").concat(i,";")},"");return"".concat(t).concat(r,"{").concat(o,"}")},"");if(this.domStyles!==e){this.domStyles=e;var n=this.container.querySelector("style");n&&this.container.removeChild(n),(n=document.createElement("style")).innerHTML=e,this.container.appendChild(n)}},e.prototype.setOffsetPosition=function(t,e,n){void 0===n&&(n=this.style.offset);var r=He(n,2),i=r[0],o=void 0===i?0:i,A=r[1],s=void 0===A?0:A;this.container.style.left="".concat(t+o,"px"),this.container.style.top="".concat(e+s,"px")},e.tag="poptip",e.defaultOptions={style:{x:0,y:0,width:0,height:0,target:null,visibility:"hidden",text:"",position:"top",follow:!1,offset:[0,0],domStyles:s$,template:'<div class="'.concat(A$,'"></div>')}},e}(zW),l$=eW({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",focusGroup:"focus-group",focus:"focus",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item"),u$={offset:[0,20],domStyles:{".component-poptip":{opacity:"1",padding:"8px 12px",background:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},".component-poptip-arrow":{display:"none"},".component-poptip-text":{color:"#000",lineHeight:"20px"}}};var h$=function(t){function e(e,n){var r=t.call(this,e,{span:[1,1],marker:function(){return new za({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this;return r.keyFields={},r.keyFields=n||{},r}return Ie(e,t),Object.defineProperty(e.prototype,"showValue",{get:function(){var t=this.attributes.valueText;return!!t&&("string"==typeof t||"number"==typeof t?""!==t:"function"==typeof t||""!==t.attr("text"))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"actualSpace",{get:function(){var t=this.labelGroup,e=this.valueGroup,n=this.attributes,r=n.markerSize,i=n.focus,o=n.focusMarkerSize,A=t.node().getBBox(),s=A.width,a=A.height,c=e.node().getBBox(),l=c.width,u=c.height;return{markerWidth:r,labelWidth:s,valueWidth:l,focusWidth:i?null!=o?o:12:0,height:Math.max(r,a,u)}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"span",{get:function(){var t=this.attributes.span;if(!t)return[1,1];var e=He(UW(t),2),n=e[0],r=e[1],i=this.showValue?r:0,o=n+i;return[n/o,i/o]},enumerable:!1,configurable:!0}),e.prototype.setAttribute=function(e,n){t.prototype.setAttribute.call(this,e,n)},Object.defineProperty(e.prototype,"shape",{get:function(){var t,e=this.attributes,n=e.markerSize,r=e.width,i=this.actualSpace,o=i.markerWidth,A=i.focusWidth,s=i.height,a=this.actualSpace,c=a.labelWidth,l=a.valueWidth,u=He(this.spacing,3),h=u[0],d=u[1],f=u[2];if(r){var g=r-n-h-d-A-f,p=He(this.span,2);c=(t=He([p[0]*g,p[1]*g],2))[0],l=t[1]}return{width:o+c+l+h+d+A+f,height:s,markerWidth:o,labelWidth:c,valueWidth:l,focusWidth:A}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){var t=this.attributes,e=t.spacing,n=t.focus;if(!e)return[0,0,0];var r=He(UW(e),3),i=r[0],o=r[1],A=r[2];return[i,this.showValue?o:0,n?A:0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"layout",{get:function(){var t=this.shape,e=t.markerWidth,n=t.labelWidth,r=t.valueWidth,i=t.focusWidth,o=t.width,A=t.height,s=He(this.spacing,3),a=s[0],c=s[1];return{height:A,width:o,markerWidth:e,labelWidth:n,valueWidth:r,focusWidth:i,position:[e/2,e+a,e+n+a+c,e+n+r+a+c+s[2]+i/2]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleSize",{get:function(){var t=function(t){var e=t.querySelector(l$.marker.class);return e?e.style:{}}(this.markerGroup.node()),e=this.attributes,n=e.markerSize,r=e.markerStrokeWidth,i=void 0===r?t.strokeWidth:r,o=e.markerLineWidth,A=void 0===o?t.lineWidth:o,s=e.markerStroke,a=void 0===s?t.stroke:s,c=+(i||A||(a?1:0))*Math.sqrt(2),l=this.markerGroup.node().getBBox(),u=l.width,h=l.height;return(1-c/Math.max(u,h))*n},enumerable:!1,configurable:!0}),e.prototype.renderMarker=function(t){var e=this,n=this.attributes,r=n.marker,i=n.classNamePrefix,o=PW(this.attributes,"marker");this.markerGroup=t.maybeAppendByClassName(l$.markerGroup,"g").style("zIndex",0),hW(!!r,this.markerGroup,function(){var t,n=e.markerGroup.node(),A=null===(t=n.childNodes)||void 0===t?void 0:t[0],s=Tq(l$.marker.name,Pq,i),a="string"==typeof r?new JW({style:{symbol:r},className:s}):r();if(A)if(a.nodeName===A.nodeName)A instanceof JW?A.update(Le(Le({},o),{symbol:r})):(!function(t,e){var n,r,i=e.attributes;try{for(var o=Re(Object.entries(i)),A=o.next();!A.done;A=o.next()){var s=He(A.value,2),a=s[0],c=s[1];"id"!==a&&"className"!==a&&t.attr(a,c)}}catch(t){n={error:t}}finally{try{A&&!A.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}(A,a),QW(A).styles(o));else{if(A.remove(),!(a instanceof JW)){var c=Tq(l$.marker.name,Pq,i);a.className=c}QW(a).styles(o),n.appendChild(a)}else{if(!(a instanceof JW)){var l=Tq(l$.marker.name,Pq,i);a.className=l,QW(a).styles(o)}n.appendChild(a)}e.markerGroup.node().scale(1/e.markerGroup.node().getScale()[0]);var u=kW(e.markerGroup.node(),e.scaleSize);e.markerGroup.node().style._transform="scale(".concat(u,")")})},e.prototype.renderLabel=function(t){var e=PW(this.attributes,"label"),n=e.text,r=Pe(e,["text"]),i=this.attributes.classNamePrefix;this.labelGroup=t.maybeAppendByClassName(l$.labelGroup,"g").style("zIndex",0);var o=Tq(l$.label.name,Dq,i),A=this.labelGroup.maybeAppendByClassName(l$.label,function(){return uW(n)});A.node().setAttribute("class",o),A.styles(r)},e.prototype.renderValue=function(t){var e=this,n=PW(this.attributes,"value"),r=n.text,i=Pe(n,["text"]),o=this.attributes.classNamePrefix;this.valueGroup=t.maybeAppendByClassName(l$.valueGroup,"g").style("zIndex",0),hW(this.showValue,this.valueGroup,function(){var t=Tq(l$.value.name,Rq,o),n=e.valueGroup.maybeAppendByClassName(l$.value,function(){return uW(r)});n.node().setAttribute("class",t),n.styles(i)})},e.prototype.createPoptip=function(){var t=this.attributes.poptip||{};t.render;var e=Pe(t,["render"]),n=new c$({style:rW(u$,e)});return this.poptipGroup=n,n},e.prototype.bindPoptip=function(t){var e=this,n=this.attributes.poptip;n&&(this.poptipGroup||this.createPoptip()).bind(t,function(){var t=e.attributes,r=t.labelText,i=t.valueText,o=t.markerFill,A="string"==typeof r?r:null==r?void 0:r.attr("text"),s="string"==typeof i?i:null==i?void 0:i.attr("text");if("function"==typeof n.render)return{html:n.render(Le(Le({},e.keyFields),{label:A,value:s,color:o}))};var a="";return"string"!=typeof A&&"number"!=typeof A||(a+='<div class="component-poptip-label">'.concat(A,"</div>")),"string"!=typeof s&&"number"!=typeof s||(a+='<div class="component-poptip-value">'.concat(s,"</div>")),{html:a}})},e.prototype.renderFocus=function(t){var e=this,n=this.attributes,r=n.focus,i=n.focusMarkerSize,o=n.classNamePrefix,A={x:0,y:0,size:i,opacity:.6,symbol:"focus",stroke:"#aaaaaa",lineWidth:1};de(r)||(this.focusGroup=t.maybeAppendByClassName(l$.focusGroup,"g").style("zIndex",0),hW(r,this.focusGroup,function(){var n=Tq(l$.focus.name,Hq,o),r=new JW({style:Le(Le({},A),{symbol:"focus"}),className:n}),i=new za({style:{r:A.size/2,fill:"transparent"}}),s=e.focusGroup.node();s.appendChild(i),s.appendChild(r),r.update({opacity:0}),t.node().addEventListener("pointerenter",function(){r.update({opacity:1})}),t.node().addEventListener("pointerleave",function(){r.update({opacity:0})})}))},e.prototype.renderPoptip=function(t){var e=this;this.attributes.poptip&&[t.maybeAppendByClassName(l$.value,"g").node(),t.maybeAppendByClassName(l$.label,"g").node()].forEach(function(t){t&&e.bindPoptip(t)})},e.prototype.renderBackground=function(t){var e=this.shape,n=e.width,r=e.height,i=PW(this.attributes,"background");this.background=t.maybeAppendByClassName(l$.backgroundGroup,"g").style("zIndex",-1);var o=this.background.maybeAppendByClassName(l$.background,"rect");o.styles(Le({width:n,height:r},i));var A=this.attributes.classNamePrefix,s=void 0===A?"":A;if(s){var a=Tq(l$.background.name,_q,s);o.node().setAttribute("class",a)}},e.prototype.adjustLayout=function(){var t=this.layout,e=t.labelWidth,n=t.valueWidth,r=t.height,i=He(t.position,4),o=i[0],A=i[1],s=i[2],a=i[3],c=r/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(c,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(A,", ").concat(c,")")}),this.focusGroup&&this.focusGroup.styles({transform:"translate(".concat(a,", ").concat(c,")")}),cW(this.labelGroup.select(l$.label.class).node(),Math.ceil(e)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(s,", ").concat(c,")")}),cW(this.valueGroup.select(l$.value.class).node(),Math.ceil(n)))},e.prototype.render=function(t,e){var n=QW(e),r=t.x,i=void 0===r?0:r,o=t.y,A=void 0===o?0:o;n.styles({transform:"translate(".concat(i,", ").concat(A,")")}),this.renderMarker(n),this.renderLabel(n),this.renderValue(n),this.renderBackground(n),this.renderPoptip(n),this.renderFocus(n),this.adjustLayout()},e}(zW),d$=eW({page:"item-page",navigator:"navigator",item:"item"},"items"),f$=function(t,e,n){return void 0===n&&(n=!0),t?e(t):n},g$=function(t){function e(e){var n=t.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:Ne,mouseenter:Ne,mouseleave:Ne})||this;return n.navigatorShape=[0,0],n}return Ie(e,t),Object.defineProperty(e.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"grid",{get:function(){var t=this.attributes,e=t.gridRow,n=t.gridCol,r=t.data;if(!e&&!n)throw new Error("gridRow and gridCol can not be set null at the same time");return e&&n?[e,n]:e?[e,r.length]:[r.length,n]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderData",{get:function(){var t=this.attributes,e=t.data,n=t.layout,r=t.poptip,i=t.focus,o=t.focusMarkerSize,A=t.classNamePrefix,s=PW(this.attributes,"item"),a=e.map(function(t,a){var c=t.id,l=void 0===c?a:c,u=t.label,h=t.value;return{id:"".concat(l),index:a,style:Le({layout:n,labelText:u,valueText:h,poptip:r,focus:i,focusMarkerSize:o,classNamePrefix:A},Object.fromEntries(Object.entries(s).map(function(n){var r=He(n,2);return[r[0],JV(r[1],[t,a,e])]})))}});return a},enumerable:!1,configurable:!0}),e.prototype.getGridLayout=function(){var t=this,e=this.attributes,n=e.orientation,r=e.width,i=e.rowPadding,o=e.colPadding,A=He(this.navigatorShape,1)[0],s=He(this.grid,2),a=s[0],c=s[1],l=c*a,u=0;return this.pageViews.children.map(function(e,s){var h,d,f=Math.floor(s/l),g=s%l,p=t.ifHorizontal(c,a),v=[Math.floor(g/p),g%p];"vertical"===n&&v.reverse();var m=He(v,2),y=m[0],w=m[1],b=(r-A-(c-1)*o)/c,B=e.getBBox().height,E=He([0,0],2),x=E[0],C=E[1];return"horizontal"===n?(x=(h=He([u,y*(B+i)],2))[0],C=h[1],u=w===c-1?0:u+b+o):(x=(d=He([w*(b+o),u],2))[0],C=d[1],u=y===a-1?0:u+B+i),{page:f,index:s,row:y,col:w,pageIndex:g,width:b,height:B,x:x,y:C}})},e.prototype.getFlexLayout=function(){var t=this.attributes,e=t.width,n=t.height,r=t.rowPadding,i=t.colPadding,o=He(this.navigatorShape,1)[0],A=He(this.grid,2),s=A[0],a=A[1],c=He([e-o,n],2),l=c[0],u=c[1],h=He([0,0,0,0,0,0,0,0],8),d=h[0],f=h[1],g=h[2],p=h[3],v=h[4],m=h[5],y=h[6],w=h[7];return this.pageViews.children.map(function(t,e){var n,o,A,c,h=t.getBBox(),b=h.width,B=h.height,E=0===y?0:i,x=y+E+b;return x<=l&&f$(v,function(t){return t<a})?(n=He([y+E,w,x],3),d=n[0],f=n[1],y=n[2],{width:b,height:B,x:d,y:f,page:g,index:e,pageIndex:p++,row:m,col:v++}):(o=He([m+1,0,0,w+B+r],4),m=o[0],v=o[1],y=o[2],(w=o[3])+B<=u&&f$(m,function(t){return t<s})?(A=He([y,w,b],3),d=A[0],f=A[1],y=A[2],{width:b,height:B,x:d,y:f,page:g,index:e,pageIndex:p++,row:m,col:v++}):(c=He([0,0,b,0,g+1,0,0,0],8),d=c[0],f=c[1],y=c[2],w=c[3],g=c[4],p=c[5],m=c[6],v=c[7],{width:b,height:B,x:d,y:f,page:g,index:e,pageIndex:p++,row:m,col:v++}))})},Object.defineProperty(e.prototype,"itemsLayout",{get:function(){this.navigatorShape=[0,0];var t="grid"===this.attributes.layout?this.getGridLayout:this.getFlexLayout,e=t.call(this);return e.slice(-1)[0].page>0?(this.navigatorShape=[55,0],t.call(this)):e},enumerable:!1,configurable:!0}),e.prototype.ifHorizontal=function(t,e){return Oq(this.attributes.orientation,t,e)},e.prototype.flattenPage=function(t){t.querySelectorAll(d$.item.class).forEach(function(e){t.appendChild(e)}),t.querySelectorAll(d$.page.class).forEach(function(e){t.removeChild(e).destroy()})},e.prototype.renderItems=function(t){var e=this.attributes,n=e.click,r=e.mouseenter,i=e.mouseleave,o=e.classNamePrefix;this.flattenPage(t);var A=this.dispatchCustomEvent.bind(this),s=Tq(d$.item.name,Lq,o);QW(t).selectAll(d$.item.class).data(this.renderData,function(t){return t.id}).join(function(t){return t.append(function(t){var e=t.style,n=Pe(t,["style"]);return new h$({style:e},n)}).attr("className",s).on("click",function(){null==n||n(this),A("itemClick",{item:this})}).on("pointerenter",function(){null==r||r(this),A("itemMouseenter",{item:this})}).on("pointerleave",function(){null==i||i(this),A("itemMouseleave",{item:this})})},function(t){return t.each(function(t){var e=t.style;this.update(e)})},function(t){return t.remove()})},e.prototype.relayoutNavigator=function(){var t,e=this.attributes,n=e.layout,r=e.width,i=(null===(t=this.pageViews.children[0])||void 0===t?void 0:t.getBBox().height)||0,o=He(this.navigatorShape,2),A=o[0],s=o[1];this.navigator.update("grid"===n?{pageWidth:r-A,pageHeight:i-s}:{})},e.prototype.adjustLayout=function(){var t,e,n=this,r=Object.entries((t=this.itemsLayout,e="page",t.reduce(function(t,n){return(t[n[e]]=t[n[e]]||[]).push(n),t},{}))).map(function(t){var e=He(t,2);return{page:e[0],layouts:e[1]}}),i=_e([],He(this.navigator.getContainer().children),!1);r.forEach(function(t){var e=t.layouts,r=n.pageViews.appendChild(new Xa({className:d$.page.name}));e.forEach(function(t){var e=t.x,n=t.y,o=t.index,A=t.width,s=t.height,a=i[o];r.appendChild(a),Me(a,"__layout__",t),a.update({x:e,y:n,width:A,height:s})})}),this.relayoutNavigator()},e.prototype.renderNavigator=function(t){var e=this.attributes,n=e.orientation,r=e.classNamePrefix,i=PW(this.attributes,"nav"),o=rW({orientation:n,classNamePrefix:r},i),A=this;return t.selectAll(d$.navigator.class).data(["nav"]).join(function(t){return t.append(function(){return new r$({style:o})}).attr("className",d$.navigator.name).each(function(){A.navigator=this})},function(t){return t.each(function(){this.update(o)})},function(t){return t.remove()}),this.navigator},e.prototype.getBBox=function(){return this.navigator.getBBox()},e.prototype.render=function(t,e){var n=this.attributes.data;if(n&&0!==n.length){var r=this.renderNavigator(QW(e));this.renderItems(r.getContainer()),this.adjustLayout()}},e.prototype.dispatchCustomEvent=function(t,e){var n=new Vs(t,{detail:e});this.dispatchEvent(n)},e}(zW),p$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),e.prototype.update=function(t){this.attr(t)},e}($a),v$=function(t){function e(e){return t.call(this,e,qq)||this}return Ie(e,t),e.prototype.renderTitle=function(t,e,n){var r=this.attributes,i=r.showTitle,o=r.titleText,A=r.classNamePrefix,s=He(RW(PW(this.attributes,"title")),2),a=s[0],c=s[1];this.titleGroup=t.maybeAppendByClassName($q.titleGroup,"g").styles(c);var l=Le(Le({width:e,height:n},a),{text:i?o:"",classNamePrefix:A});this.title=this.titleGroup.maybeAppendByClassName($q.title,function(){return new e$({style:l})}).update(l)},e.prototype.renderCustom=function(t){var e=this.attributes.data,n={innerHTML:this.attributes.render(e),pointerEvents:"auto"};t.maybeAppendByClassName($q.html,function(){return new p$({className:$q.html.name,style:n})}).update(n)},e.prototype.renderItems=function(t,e){var n=e.x,r=e.y,i=e.width,o=e.height,A=He(RW(PW(this.attributes,"title",!0)),2),s=A[0],a=A[1],c=Le(Le({},s),{width:i,height:o,x:0,y:0});this.itemsGroup=t.maybeAppendByClassName($q.itemsGroup,"g").styles(Le(Le({},a),{transform:"translate(".concat(n,", ").concat(r,")")}));var l=this;this.itemsGroup.selectAll($q.items.class).data(["items"]).join(function(t){return t.append(function(){return new g$({style:c})}).attr("className",$q.items.name).each(function(){l.items=QW(this)})},function(t){return t.update(c)},function(t){return t.remove()})},e.prototype.adjustLayout=function(){if(this.attributes.showTitle){var t=this.title.node().getAvailableSpace(),e=t.x,n=t.y;this.itemsGroup.node().style.transform="translate(".concat(e,", ").concat(n,")")}},Object.defineProperty(e.prototype,"availableSpace",{get:function(){var t=this.attributes,e=t.showTitle,n=t.width,r=t.height;return e?this.title.node().getAvailableSpace():new ZV(0,0,n,r)},enumerable:!1,configurable:!0}),e.prototype.getBBox=function(){var e,n,r=null===(e=this.title)||void 0===e?void 0:e.node(),i=null===(n=this.items)||void 0===n?void 0:n.node();return r&&i?function(t,e){var n=t.attributes,r=n.position,i=n.spacing,o=n.inset,A=n.text,s=t.getBBox(),a=e.getBBox(),c=KW(r),l=He(UW(A?i:0),4),u=l[0],h=l[1],d=l[2],f=l[3],g=He(UW(o),4),p=g[0],v=g[1],m=g[2],y=g[3],w=He([f+h,u+d],2),b=w[0],B=w[1],E=He([y+v,p+m],2),x=E[0],C=E[1];if("l"===c[0])return new ZV(s.x,s.y,a.width+s.width+b+x,Math.max(a.height+C,s.height));if("t"===c[0])return new ZV(s.x,s.y,Math.max(a.width+x,s.width),a.height+s.height+B+C);var M=He([e.attributes.width||a.width,e.attributes.height||a.height],2),F=M[0],k=M[1];return new ZV(a.x,a.y,F+s.width+b+x,k+s.height+B+C)}(r,i):t.prototype.getBBox.call(this)},e.prototype.render=function(t,e){var n=this.attributes,r=n.width,i=n.height,o=n.x,A=void 0===o?0:o,s=n.y,a=void 0===s?0:s,c=n.classNamePrefix,l=n.render,u=QW(e),h=e.className||"legend-category";c?e.attr("className","".concat(h," ").concat(c,"legend")):e.className||e.attr("className","legend-category"),e.style.transform="translate(".concat(A,", ").concat(a,")"),l?this.renderCustom(u):(this.renderTitle(u,r,i),this.renderItems(u,this.availableSpace),this.adjustLayout())},e}(zW),m$={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(t){return t.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},y$=eW({background:"background",labelGroup:"label-group",label:"label"},"indicator"),w$=function(t){function e(e){var n=t.call(this,e,m$)||this;return n.point=[0,0],n.group=n.appendChild(new Xa({})),n.isMutationObserved=!0,n}return Ie(e,t),e.prototype.renderBackground=function(){if(this.label){var t=this.attributes,e=t.position,n=He(UW(t.padding),4),r=n[0],i=n[1],o=n[2],A=n[3],s=this.label.node().getLocalBounds(),a=s.min,c=s.max,l=new ZV(a[0]-A,a[1]-r,c[0]+i-a[0]+A,c[1]+o-a[1]+r),u=this.getPath(e,l),h=PW(this.attributes,"background");this.background=QW(this.group).maybeAppendByClassName(y$.background,"path").styles(Le(Le({},h),{d:u})),this.group.appendChild(this.label.node())}},e.prototype.renderLabel=function(){var t=this.attributes,e=t.formatter,n=t.labelText,r=He(RW(PW(this.attributes,"label")),2),i=r[0],o=r[1];i.text;var A=Pe(i,["text"]);(this.label=QW(this.group).maybeAppendByClassName(y$.labelGroup,"g").styles(o),n)&&this.label.maybeAppendByClassName(y$.label,function(){return uW(e(n))}).style("text",e(n).toString()).selectAll("text").styles(A)},e.prototype.adjustLayout=function(){var t=He(this.point,2),e=t[0],n=t[1],r=this.attributes,i=r.x,o=r.y;this.group.attr("transform","translate(".concat(i-e,", ").concat(o-n,")"))},e.prototype.getPath=function(t,e){var n=this.attributes.radius,r=e.x,i=e.y,o=e.width,A=e.height,s=[["M",r+n,i],["L",r+o-n,i],["A",n,n,0,0,1,r+o,i+n],["L",r+o,i+A-n],["A",n,n,0,0,1,r+o-n,i+A],["L",r+n,i+A],["A",n,n,0,0,1,r,i+A-n],["L",r,i+n],["A",n,n,0,0,1,r+n,i],["Z"]],a={top:4,right:6,bottom:0,left:2}[t],c=this.createCorner([s[a].slice(-2),s[a+1].slice(-2)]);return s.splice.apply(s,_e([a+1,1],He(c),!1)),s[0][0]="M",s},e.prototype.createCorner=function(t,e){void 0===e&&(e=10);var n=TW.apply(void 0,_e([],He(t),!1)),r=He(t,2),i=He(r[0],2),o=i[0],A=i[1],s=He(r[1],2),a=s[0],c=s[1],l=He(n?[a-o,[o,a]]:[c-A,[A,c]],2),u=l[0],h=He(l[1],2),d=h[0],f=h[1],g=u/2,p=e*(u/Math.abs(u)),v=p/2,m=p*Math.sqrt(3)/2*.8,y=He([d,d+g-v,d+g,d+g+v,f],5),w=y[0],b=y[1],B=y[2],E=y[3],x=y[4];return n?(this.point=[B,A-m],[["L",w,A],["L",b,A],["L",B,A-m],["L",E,A],["L",x,A]]):(this.point=[o+m,B],[["L",o,w],["L",o,b],["L",o+m,B],["L",o,E],["L",o,x]])},e.prototype.applyVisibility=function(){"hidden"===this.attributes.visibility?zV(this):jV(this)},e.prototype.bindEvents=function(){this.label.on(ea.BOUNDS_CHANGED,this.renderBackground)},e.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},e}(zW);function b$(t){return void 0===t&&(t=""),{CONTAINER:"".concat(t,"tooltip"),TITLE:"".concat(t,"tooltip-title"),LIST:"".concat(t,"tooltip-list"),LIST_ITEM:"".concat(t,"tooltip-list-item"),NAME:"".concat(t,"tooltip-list-item-name"),MARKER:"".concat(t,"tooltip-list-item-marker"),NAME_LABEL:"".concat(t,"tooltip-list-item-name-label"),VALUE:"".concat(t,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(t,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(t,"tooltip-crosshair-y")}}var B$={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function E$(t){var e;void 0===t&&(t="");var n=b$(t);return(e={})[".".concat(n.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},e[".".concat(n.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},e[".".concat(n.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},e[".".concat(n.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},e[".".concat(n.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},e[".".concat(n.NAME)]={display:"flex","align-items":"center","max-width":"216px"},e[".".concat(n.NAME_LABEL)]=Le({flex:1},B$),e[".".concat(n.VALUE)]=Le({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},B$),e[".".concat(n.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e[".".concat(n.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},e}var x$=function(t){function e(e){var n,r,i=this,o=null===(r=null===(n=e.style)||void 0===n?void 0:n.template)||void 0===r?void 0:r.prefixCls,A=b$(o);return(i=t.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'<div class="'.concat(A.CONTAINER,'"></div>'),title:'<div class="'.concat(A.TITLE,'"></div>'),item:'<li class="'.concat(A.LIST_ITEM,'" data-index={index}>\n <span class="').concat(A.NAME,'">\n <span class="').concat(A.MARKER,'" style="background:{color}"></span>\n <span class="').concat(A.NAME_LABEL,'" title="{name}">{name}</span>\n </span>\n <span class="').concat(A.VALUE,'" title="{value}">{value}</span>\n </li>')},style:E$(o)})||this).timestamp=-1,i.prevCustomContentKey=i.attributes.contentKey,i.initShape(),i.render(i.attributes,i),i}return Ie(e,t),Object.defineProperty(e.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),e.prototype.getContainer=function(){return this.element},Object.defineProperty(e.prototype,"elementSize",{get:function(){return{width:this.element.offsetWidth,height:this.element.offsetHeight}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"HTMLTooltipItemsElements",{get:function(){var t=this.attributes,e=t.data,n=t.template;return e.map(function(t,e){var r=t.name,i=void 0===r?"":r,o=t.color,A=void 0===o?"black":o,s=t.index,a=Pe(t,["name","color","index"]),c=Le({name:i,color:A,index:null!=s?s:e},a);return Sn(function(t,e){return t&&e?t.replace(/\\?\{([^{}]+)\}/g,function(t,n){return"\\"===t.charAt(0)?t.slice(1):void 0===e[n]?"":e[n]}):t}(n.item,c))})},enumerable:!1,configurable:!0}),e.prototype.render=function(t,e){this.renderHTMLTooltipElement(),this.updatePosition()},e.prototype.destroy=function(){var e;null===(e=this.element)||void 0===e||e.remove(),t.prototype.destroy.call(this)},e.prototype.show=function(t,e){var n=this;if(void 0!==t&&void 0!==e){var r=function(){n.attributes.x=null!=t?t:n.attributes.x,n.attributes.y=null!=e?e:n.attributes.y,n.updatePosition()};"hidden"===this.element.style.visibility?this.closeTransition(r):r()}this.element.style.visibility="visible"},e.prototype.hide=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.attributes.enterable&&this.isCursorEntered(t,e)||(this.element.style.visibility="hidden")},e.prototype.initShape=function(){var t=this.attributes.template;this.element=Sn(t.container),this.id&&this.element.setAttribute("id",this.id)},e.prototype.renderCustomContent=function(){if(void 0===this.prevCustomContentKey||this.prevCustomContentKey!==this.attributes.contentKey){this.prevCustomContentKey=this.attributes.contentKey;var t=this.attributes.content;t&&("string"==typeof t?this.element.innerHTML=t:GW(this.element,t))}},e.prototype.renderHTMLTooltipElement=function(){var t,e,n=this.attributes,r=n.template,i=n.title,o=n.enterable,A=n.style,s=n.content,a=b$(r.prefixCls),c=this.element;if(this.element.style.pointerEvents=o?"auto":"none",s)this.renderCustomContent();else{i?(c.innerHTML=r.title,c.getElementsByClassName(a.TITLE)[0].innerHTML=i):null===(e=null===(t=c.getElementsByClassName(a.TITLE))||void 0===t?void 0:t[0])||void 0===e||e.remove();var l=this.HTMLTooltipItemsElements,u=document.createElement("ul");u.className=a.LIST,GW(u,l);var h=this.element.querySelector(".".concat(a.LIST));h?h.replaceWith(u):c.appendChild(u)}!function(t,e){Object.entries(e).forEach(function(e){var n=He(e,2),r=n[0],i=n[1];_e([t],He(t.querySelectorAll(r)),!1).filter(function(t){return t.matches(r)}).forEach(function(t){t&&(t.style.cssText+=Object.entries(i).reduce(function(t,e){return"".concat(t).concat(e.join(":"),";")},""))})})}(c,A)},e.prototype.getRelativeOffsetFromCursor=function(t){var e=this.attributes,n=e.position,r=e.offset,i=(t||n).split("-"),o={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},A=this.elementSize,s=A.width,a=A.height,c=[-s/2,-a/2];return i.forEach(function(t){var e=He(c,2),n=e[0],i=e[1],A=He(o[t],2),l=A[0],u=A[1];c=[n+(s/2+r[0])*l,i+(a/2+r[1])*u]}),c},e.prototype.setOffsetPosition=function(t){var e=He(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,A=void 0===o?0:o,s=i.y,a=void 0===s?0:s,c=i.container,l=c.x,u=c.y;this.element.style.left="".concat(+A+l+n,"px"),this.element.style.top="".concat(+a+u+r,"px")},e.prototype.updatePosition=function(){var t=this.attributes.showDelay,e=void 0===t?60:t,n=Date.now();this.timestamp>0&&n-this.timestamp<e||(this.timestamp=n,this.setOffsetPosition(this.autoPosition(this.getRelativeOffsetFromCursor())))},e.prototype.autoPosition=function(t){var e=He(t,2),n=e[0],r=e[1],i=this.attributes,o=i.x,A=i.y,s=i.bounding,a=i.position;if(!s)return[n,r];var c=this.element,l=c.offsetWidth,u=c.offsetHeight,h=He([+o+n,+A+r],2),d=h[0],f=h[1],g={left:"right",right:"left",top:"bottom",bottom:"top"},p=s.x,v=s.y,m={left:d<p,right:d+l>p+s.width,top:f<v,bottom:f+u>v+s.height},y=[];a.split("-").forEach(function(t){m[t]?y.push(g[t]):y.push(t)});var w=y.join("-");return this.getRelativeOffsetFromCursor(w)},e.prototype.isCursorEntered=function(t,e){if(this.element){var n=this.element.getBoundingClientRect(),r=n.x,i=n.y,o=n.width,A=n.height;return new ZV(r,i,o,A).isPointIn(t,e)}return!1},e.prototype.closeTransition=function(t){var e=this,n=this.element.style.transition;this.element.style.transition="none",t(),setTimeout(function(){e.element.style.transition=n},10)},e.tag="tooltip",e}(zW),C$=function(t){function e(n){var r=t.call(this,rW({},e.defaultOptions,n))||this;return r.hoverColor="#f5f5f5",r.selectedColor="#e6f7ff",r.background=r.appendChild(new sc({})),r.label=r.background.appendChild(new Xa({})),r}return Ie(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return UW(this.style.padding)},enumerable:!1,configurable:!0}),e.prototype.renderLabel=function(){var t=this.style,e=t.label,n=t.value,r=PW(this.attributes,"label");QW(this.label).maybeAppend(".label",function(){return uW(e)}).attr("className","label").styles(r),this.label.attr("__data__",n)},e.prototype.renderBackground=function(){var t=this.label.getBBox(),e=He(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3],A=t.width,s=t.height,a=A+o+r,c=s+n+i,l=PW(this.attributes,"background"),u=this.style,h=u.width,d=void 0===h?0:h,f=u.height,g=void 0===f?0:f,p=u.selected;this.background.attr(Le(Le({},l),{width:Math.max(a,d),height:Math.max(c,g),fill:p?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((c-s)/2,")")})},e.prototype.render=function(){this.renderLabel(),this.renderBackground()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("pointerenter",function(){t.style.selected||t.background.attr("fill",t.hoverColor)}),this.addEventListener("pointerleave",function(){t.style.selected||t.background.attr("fill",t.style.backgroundFill)});var e=this;this.addEventListener("click",function(){var n=t.style,r=n.label,i=n.value,o=n.onClick;null==o||o(i,{label:r,value:i},e)})},e.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},e}(zW),M$=function(t){function e(n){var r,i,o=t.call(this,rW({},e.defaultOptions,n))||this;o.currentValue=null===(r=e.defaultOptions.style)||void 0===r?void 0:r.defaultValue,o.isPointerInSelect=!1,o.select=o.appendChild(new sc({className:"select",style:{cursor:"pointer",width:0,height:0}})),o.dropdown=o.appendChild(new sc({className:"dropdown"}));var A=o.style.defaultValue;return A&&(null===(i=o.style.options)||void 0===i?void 0:i.some(function(t){return t.value===A}))&&(o.currentValue=A),o}return Ie(e,t),e.prototype.setValue=function(t){this.currentValue=t,this.render()},e.prototype.getValue=function(){return this.currentValue},Object.defineProperty(e.prototype,"dropdownPadding",{get:function(){return UW(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),e.prototype.renderSelect=function(){var t,e=this,n=this.style,r=n.x,i=n.y,o=n.width,A=n.height,s=n.bordered,a=n.showDropdownIcon,c=PW(this.attributes,"select"),l=PW(this.attributes,"placeholder");this.select.attr(Le(Le({x:r,y:i,width:o,height:A},c),{fill:"#fff",strokeWidth:s?1:0}));var u=this.dropdownPadding;a&&QW(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(r+o-10-u[1]-u[3],", ").concat(i+A/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var h=null===(t=this.style.options)||void 0===t?void 0:t.find(function(t){return t.value===e.currentValue}),d=Le({x:r+u[3]},l);QW(this.select).selectAll(".placeholder").data(h?[]:[1]).join(function(t){return t.append("text").attr("className","placeholder").styles(d).style("y",function(){var t=this.getBBox();return i+(A-t.height)/2})},function(t){return t.styles(d)},function(t){return t.remove()});var f=PW(this.attributes,"optionLabel"),g=Le({x:r+u[3]},f);QW(this.select).selectAll(".value").data(h?[h]:[]).join(function(t){return t.append(function(t){return uW(t.label)}).attr("className","value").styles(g).style("y",function(){var t=this.getBBox();return i+(A-t.height)/2})},function(t){return t.styles(g)},function(t){return t.remove()})},e.prototype.renderDropdown=function(){var t,e,n=this,r=this.style,i=r.x,o=r.y,A=r.width,s=r.height,a=r.options,c=r.onSelect,l=r.open,u=PW(this.attributes,"dropdown"),h=PW(this.attributes,"option"),d=this.dropdownPadding;QW(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(a,function(t){return t.value}).join(function(t){return t.append(function(t){return new C$({className:"dropdown-item",style:Le(Le(Le({},t),h),{width:A-d[1]-d[3],selected:t.value===n.currentValue,onClick:function(t,e,r){n.setValue(t),null==c||c(t,e,r),n.dispatchEvent(new Vs("change",{detail:{value:t,option:e,item:r}})),zV(n.dropdown)}})})}).each(function(t,e){var n,r=(null===(n=this.parentNode)||void 0===n?void 0:n.children).reduce(function(t,n,r){return r<e&&(t+=n.getBBox().height),t},0);this.attr("transform","translate(".concat(d[3],", ").concat(d[0]+r,")"))})},function(t){return t.update(function(t){return{selected:t.value===n.currentValue}})},function(t){return t.remove()});var f=null===(e=null===(t=this.dropdown.getElementsByClassName("dropdown-container"))||void 0===t?void 0:t[0])||void 0===e?void 0:e.getBBox(),g=u.spacing;this.dropdown.attr(Le({transform:"translate(".concat(i,", ").concat(o+s+g,")"),width:f.width+d[1]+d[3],height:f.height+d[0]+d[2]},u)),!l&&zV(this.dropdown)},e.prototype.render=function(){this.renderSelect(),this.renderDropdown()},e.prototype.bindEvents=function(){var t=this;this.addEventListener("click",function(t){t.stopPropagation()}),this.select.addEventListener("click",function(){"visible"===t.dropdown.style.visibility?zV(t.dropdown):jV(t.dropdown)}),this.addEventListener("pointerenter",function(){t.isPointerInSelect=!0}),this.addEventListener("pointerleave",function(){t.isPointerInSelect=!1}),null===document||void 0===document||document.addEventListener("click",function(){t.isPointerInSelect||zV(t.dropdown)})},e.defaultOptions={style:{x:0,y:0,width:140,height:32,options:[],bordered:!0,defaultValue:"",selectRadius:8,selectStroke:"#d9d9d9",showDropdownIcon:!0,placeholderText:"请选择",placeholderFontSize:12,placeholderTextBaseline:"top",placeholderFill:"#c2c2c2",dropdownFill:"#fff",dropdownStroke:"#d9d9d9",dropdownRadius:8,dropdownShadowBlur:4,dropdownShadowColor:"rgba(0, 0, 0, 0.08)",dropdownPadding:8,dropdownSpacing:10,optionPadding:[8,12],optionFontSize:12,optionTextBaseline:"top",optionBackgroundFill:"#fff",optionBackgroundRadius:4,optionLabelFontSize:12,optionLabelTextBaseline:"top"}},e}(zW),F$=function(t){function e(n){var r=t.call(this,rW({},{style:{backgroundOpacity:e.backgroundOpacities.default}},e.defaultOptions,n))||this;return r.showBackground=!0,r.background=r.appendChild(new sc({})),r.icon=r.appendChild(new Xa({})),r}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"BaseIcon"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return Math.log10(this.attributes.size)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"padding",{get:function(){return UW(this.attributes.size/5)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"iconSize",{get:function(){var t=this.attributes.size,e=He(this.padding,4),n=e[0],r=e[1],i=e[2],o=e[3];return Math.max(t-Math.max(o+r,n+i),2*this.lineWidth+1)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.size,i=r/2,o=PW(this.attributes,"background");this.background.attr(Le({x:e-i,y:n-i,width:r,height:r},o))},e.prototype.showIndicator=function(){if(this.label){var t=this.attributes.size,e=this.background.getBBox(),n=e.x,r=e.y;this.indicator.update({x:n+t/2,y:r-5,labelText:this.label,visibility:"visible"})}},e.prototype.hideIndicator=function(){this.indicator.update({visibility:"hidden"})},e.prototype.connectedCallback=function(){var e;t.prototype.connectedCallback.call(this);var n=this.attributes.size,r=this.background.getBBox(),i=r.x,o=r.y,A=null===(e=this.ownerDocument)||void 0===e?void 0:e.defaultView;A&&(this.indicator=A.appendChild(new w$({style:{x:i+n/2,y:o-n/2,visibility:"hidden",position:"top",radius:3,zIndex:100}})))},e.prototype.disconnectedCallback=function(){this.indicator.destroy()},e.prototype.render=function(){this.renderIcon(),this.showBackground&&this.renderBackground()},e.prototype.bindEvents=function(){var t=this,n=this.attributes.onClick;if(this.addEventListener("click",function(){null==n||n(t)}),this.showBackground){var r=function(){return t.background.attr({opacity:e.backgroundOpacities.default})};this.addEventListener("pointerenter",function(){t.background.attr({opacity:e.backgroundOpacities.hover}),t.showIndicator()}),this.addEventListener("pointerleave",function(){r(),t.hideIndicator()}),this.addEventListener("pointerdown",function(){t.background.attr({opacity:e.backgroundOpacities.active})}),this.addEventListener("pointerup",function(){r()})}},e.tag="IconBase",e.defaultOptions={style:{x:0,y:0,size:10,color:"#565758",backgroundRadius:4,backgroundFill:"#e2e2e2"}},e.backgroundOpacities={default:0,hover:.8,active:1},e}(zW),k$=function(t,e){return void 0===e&&(e="#565758"),new nc({style:{fill:e,d:"M ".concat(t,",").concat(t," L -").concat(t,",0 L ").concat(t,",-").concat(t," Z"),transformOrigin:"center"}})},S$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),e.prototype.arcPath=function(t,e,n){var r=He([n,n],2),i=r[0],o=r[1],A=function(r){return[t+n*Math.cos(r),e+n*Math.sin(r)]},s=He(A(-5/4*Math.PI),2),a=s[0],c=s[1],l=He(A(1/4*Math.PI),2),u=l[0],h=l[1];return"M".concat(a,",").concat(c,",A").concat(i,",").concat(o,",0,1,1,").concat(u,",").concat(h)},Object.defineProperty(e.prototype,"label",{get:function(){return"重置"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,A=o+.5;QW(this.icon).maybeAppend(".reset","path").styles({stroke:r,lineWidth:o,d:this.arcPath(e,n,i/2-o),markerStart:k$(A,r)})},e}(F$),Q$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快退"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,A=i/2/Math.pow(3,.5),s=[[e,n],[e,n-A],[e-o,n],[e,n+A],[e,n],[e+o,n-A],[e+o,n+A],[e,n]];QW(this.icon).maybeAppend(".backward","polygon").styles({points:s,fill:r})},e}(F$),U$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"快进"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/2,A=i/2/Math.pow(3,.5),s=[[e,n],[e,n-A],[e+o,n],[e,n+A],[e,n],[e-o,n-A],[e-o,n+A],[e,n]];QW(this.icon).maybeAppend(".forward","polygon").styles({points:s,fill:r})},e}(F$),N$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"播放"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3*Math.pow(3,.5)*.8,A=[[e+o,n],[e-o/2,n-i/2*.8],[e-o/2,n+i/2*.8],[e+o,n]];QW(this.icon).maybeAppend(".play","polygon").styles({points:A,fill:r})},e}(F$),T$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"暂停"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=i/3,A=[[e-o,n-i/2],[e-o,n+i/2],[e-o/2,n+i/2],[e-o/2,n-i/2],[e-o,n-i/2],[e+o/2,n-i/2],[e+o/2,n+i/2],[e+o,n+i/2],[e+o,n-i/2]];QW(this.icon).maybeAppend(".pause","polygon").styles({points:A,fill:r})},e}(F$),O$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"范围时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,A=o;QW(this.icon).maybeAppend(".left-line","line").styles({x1:e-i/2,y1:n-i/2,x2:e-i/2,y2:n+i/2,stroke:r,lineWidth:o}),QW(this.icon).maybeAppend(".right-line","line").styles({x1:e+i/2,y1:n-i/2,x2:e+i/2,y2:n+i/2,stroke:r,lineWidth:o}),QW(this.icon).maybeAppend(".left-arrow","line").styles({x1:e,y1:n,x2:e-i/2+2*A,y2:n,stroke:r,lineWidth:o,markerEnd:k$(2*o,r)}),QW(this.icon).maybeAppend(".right-arrow","line").styles({x1:e,y1:n,x2:e+i/2-2*A,y2:n,stroke:r,lineWidth:o,markerEnd:k$(2*o,r)})},e}(F$),I$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"单一时间"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;QW(this.icon).maybeAppend(".line","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o});var A=o;QW(this.icon).maybeAppend(".left-arrow","line").styles({x1:e-i/2-2*A,y1:n,x2:e-2*A,y2:n,stroke:r,lineWidth:o,markerEnd:k$(2*o,r)}),QW(this.icon).maybeAppend(".right-arrow","line").styles({x1:e+i/2+2*A,y1:n,x2:e+2*A,y2:n,stroke:r,lineWidth:o,markerEnd:k$(2*o,r)})},e}(F$),L$=function(t){return[[-t/2,-t/2],[-t/2,t/2],[t/2,t/2]]},P$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"折线图"},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth,A=(i-2*o-o)/4,s=(i-2*o-o)/2,a=He([e-i/2+o,n+i/2-2*o],2),c=a[0],l=a[1];QW(this.icon).maybeAppend(".coordinate","polyline").styles({points:L$(i).map(function(t){var r=He(t,2),i=r[0],o=r[1];return[i+e,o+n]}),stroke:r,lineWidth:o}),QW(this.icon).maybeAppend(".line","polyline").styles({points:[[c,l],[c+A,l-s],[c+2*A,l],[c+4*A,l-2*s]],stroke:r,lineWidth:o})},e}(F$),D$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Ie(e,t),Object.defineProperty(e.prototype,"label",{get:function(){return"条形图"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return[1,4,2,4,3]},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.data,e=this.attributes,n=e.x,r=e.y,i=e.color,o=this.iconSize,A=this.lineWidth,s=A,a=(o-s)/t.length,c=(o-2*s)/4,l=He([n-o/2+2*s,r+o/2-s],2),u=l[0],h=l[1];QW(this.icon).maybeAppend(".coordinate","polyline").styles({points:L$(o).map(function(t){var e=He(t,2),i=e[0],o=e[1];return[i+n,o+r]}),stroke:i,lineWidth:A}),QW(this.icon).maybeAppend(".bars","g").selectAll(".column").data(this.data.map(function(t,e){return{value:t,index:e}})).join(function(t){return t.append("line").attr("className","column").style("x1",function(t){var e=t.index;return u+a*e}).style("y1",h).style("x2",function(t){var e=t.index;return u+a*e}).style("y2",function(t){var e=t.value;return h-c*e}).styles({y1:h,stroke:i,lineWidth:A})})},e}(F$),R$=function(t){function e(e){var n=t.call(this,rW({},{style:{color:"#d8d9d9"}},e))||this;return n.showBackground=!1,n}return Ie(e,t),e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.color,i=this.iconSize,o=this.lineWidth;QW(this.icon).maybeAppend(".split","line").styles({x1:e,y1:n-i/2,x2:e,y2:n+i/2,stroke:r,lineWidth:o})},e}(F$),H$=function(t){function e(){var e=t.apply(this,_e([],He(arguments),!1))||this;return e.showBackground=!1,e}return Ie(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return UW(0)},enumerable:!1,configurable:!0}),e.prototype.renderIcon=function(){var t=this.iconSize,e=this.attributes,n=e.x,r=e.y,i=e.speed,o=void 0===i?1:i,A=Se(this.attributes,["x","y","transform","transformOrigin","width","height","size","color","speed"]),s=ne(t,20,1/0),a=Le(Le({},A),{x:n-s/2,y:r-10,width:s,height:20,defaultValue:o,bordered:!1,showDropdownIcon:!1,selectRadius:2,dropdownPadding:this.padding,dropdownRadius:2,dropdownSpacing:t/5,placeholderFontSize:t/2,optionPadding:0,optionLabelFontSize:t/2,optionBackgroundRadius:1,options:[{label:"1x",value:1},{label:"1.5x",value:1.5},{label:"2x",value:2}]});QW(this.icon).maybeAppend(".speed",function(){return new M$({style:a})}).attr("className","speed").each(function(){this.update(a)})},e.tag="SpeedSelect",e}(F$),_$=function(t){function e(e){var n=t.call(this,e)||this;return n.icon=n.appendChild(new Xa({})),n.currentType=n.attributes.type,n}return Ie(e,t),e.prototype.getType=function(){return this.currentType},e.prototype.render=function(){var t=this,e=this.attributes;e.onChange;var n=Pe(e,["onChange"]);QW(this.icon).selectAll(".icon").data([this.currentType]).join(function(e){return e.append(function(e){var n,r=null===(n=t.toggles.find(function(t){return He(t,1)[0]===e}))||void 0===n?void 0:n[1];if(!r)throw new Error("Invalid type: ".concat(e));return new r({})}).attr("className","icon").styles(n,!1).update({})},function(t){return t.styles({restStyles:n}).update({})},function(t){return t.remove()})},e.prototype.bindEvents=function(){var t=this,e=this.attributes.onChange;this.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation();var r=(t.toggles.findIndex(function(e){return He(e,1)[0]===t.currentType})+1)%t.toggles.length,i=t.toggles[r][0];null==e||e(t.currentType),t.currentType=i,t.render()})},e.tag="ToggleIcon",e}(zW),G$=function(t){function e(e){var n=t.call(this,rW({},{style:{type:"play"}},e))||this;return n.toggles=[["play",N$],["pause",T$]],n}return Ie(e,t),e}(_$),K$=function(t){function e(e){var n=t.call(this,rW({},{style:{type:"range"}},e))||this;return n.toggles=[["range",O$],["value",I$]],n}return Ie(e,t),e}(_$),j$=function(t){function e(e){var n=t.call(this,rW({},{style:{type:"column"}},e))||this;return n.toggles=[["line",P$],["column",D$]],n}return Ie(e,t),e}(_$),z$={reset:S$,speed:H$,backward:Q$,playPause:G$,forward:U$,selectionType:K$,chartType:j$,split:R$},V$=function(t){function e(n){var r=t.call(this,rW({},e.defaultOptions,n))||this;return r.background=r.appendChild(new sc({})),r.functions=r.appendChild(new Xa({})),r}return Ie(e,t),Object.defineProperty(e.prototype,"padding",{get:function(){return UW(this.attributes.padding)},enumerable:!1,configurable:!0}),e.prototype.renderBackground=function(){var t=this.style,e=t.x,n=t.y,r=t.width,i=t.height,o=PW(this.attributes,"background");this.background.attr(Le({x:e,y:n,width:r,height:i},o))},e.prototype.renderFunctions=function(){var t,e=this,n=this.attributes,r=n.functions,i=n.iconSize,o=n.iconSpacing,A=n.x,s=n.y,a=n.width,c=n.height,l=n.align,u=He(this.padding,4),h=u[1],d=u[3],f=r.reduce(function(t,e){return t.length&&e.length?t.concat.apply(t,_e(["split"],He(e),!1)):t.concat.apply(t,_e([],He(e),!1))},[]),g=f.length*(i+o)-o,p={left:d+i/2,center:(a-g)/2+i/2,right:a-g-d-h+i/2}[l]||0;null===(t=this.speedSelect)||void 0===t||t.destroy(),this.functions.removeChildren(),f.forEach(function(t,n){var r,a=z$[t],l={x:A+n*(i+o)+p,y:s+c/2,size:i};if(a===H$?(l.speed=e.attributes.speed,l.onSelect=function(n){return e.handleFunctionChange(t,{value:n})}):[G$,K$,j$].includes(a)?(l.onChange=function(n){return e.handleFunctionChange(t,{value:n})},a===G$&&(l.type="play"===e.attributes.state?"pause":"play"),a===K$&&(l.type="range"===e.attributes.selectionType?"value":"range"),a===j$&&(l.type="line"===e.attributes.chartType?"column":"line")):l.onClick=function(){return e.handleFunctionChange(t,{value:t})},a===H$){var u=null===(r=e.ownerDocument)||void 0===r?void 0:r.defaultView;u&&(e.speedSelect=new a({style:Le(Le({},l),{zIndex:100})}),u.appendChild(e.speedSelect))}else e.functions.appendChild(new a({style:l}))})},e.prototype.disconnectedCallback=function(){var e;t.prototype.disconnectedCallback.call(this),null===(e=this.speedSelect)||void 0===e||e.destroy()},e.prototype.render=function(){this.renderBackground(),this.renderFunctions()},e.prototype.handleFunctionChange=function(t,e){var n=this.attributes.onChange;null==n||n(t,e)},e.defaultOptions={style:{x:0,y:0,width:300,height:40,padding:0,align:"center",iconSize:25,iconSpacing:0,speed:1,state:"pause",chartType:"line",selectionType:"range",backgroundFill:"#fbfdff",backgroundStroke:"#ebedf0",functions:[["reset","speed"],["backward","playPause","forward"],["selectionType","chartType"]]}},e}(zW),W$=function(t){function e(n){var r=t.call(this,rW({},e.defaultOptions,n))||this;return r.bindEvents(),r}return Ie(e,t),e.prototype.bindEvents=function(){var t=this;this.addEventListener("mouseenter",function(){t.attr("lineWidth",Math.ceil(+(t.style.r||0)/2))}),this.addEventListener("mouseleave",function(){t.attr("lineWidth",0)})},e.defaultOptions={style:{r:5,fill:"#3f7cf7",lineWidth:0,stroke:"#3f7cf7",strokeOpacity:.5,cursor:"pointer"}},e}(za),Y$=function(t){function e(n){return t.call(this,rW({},e.defaultOptions,n))||this}return Ie(e,t),e.prototype.renderBackground=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=PW(this.attributes,"background");QW(this).maybeAppend("background","rect").attr("className","background").styles(Le({x:e-r/2,y:n-i/2,width:r,height:i},o))},e.prototype.renderIcon=function(){var t=this.attributes,e=t.x,n=t.y,r=t.iconSize,i=PW(this.attributes,"icon"),o=r/2;QW(this).maybeAppend("icon-left-line","line").attr("className","icon-left-line").styles(Le({x1:e-1,y1:n-o,x2:e-1,y2:n+o},i)),QW(this).maybeAppend("icon-right-line","line").attr("className","icon-right-line").styles(Le({x1:e+1,y1:n-o,x2:e+1,y2:n+o},i))},e.prototype.renderBorder=function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,A=PW(this.attributes,"border"),s="start"===o?+r/2:-r/2;QW(this).maybeAppend("border","line").attr("className","border").styles(Le({x1:s+e,y1:n-i/2,x2:s+e,y2:n+i/2},A))},e.prototype.render=function(){this.renderBackground(),this.renderIcon(),this.renderBorder()},e.defaultOptions={style:{x:0,y:0,width:10,height:50,iconSize:10,type:"start",backgroundFill:"#fff",backgroundFillOpacity:.5,iconStroke:"#9a9a9a",iconLineWidth:1,borderStroke:"#e8e8e8",borderLineWidth:1}},e}(zW);function X$(t,e){return"number"==typeof t?q$(t):function(t,e){var n=new Date(t);switch(e){case"half-hour":case"hour":case"four-hour":return[0,6,12,18].includes(n.getHours())&&0===n.getMinutes()?HW(n,"HH:mm\nYYYY-MM-DD"):HW(n,"HH:mm");case"half-day":return n.getHours()<12?"AM\n".concat(HW(n,"YYYY-MM-DD")):"PM";case"day":return[1,10,20].includes(n.getDate())?HW(n,"DD\nYYYY-MM"):HW(n,"DD");case"week":return n.getDate()<=7?HW(n,"DD\nYYYY-MM"):HW(n,"DD");case"month":return[0,6].includes(n.getMonth())?HW(n,"MM月\nYYYY"):HW(n,"MM月");case"season":return[0].includes(n.getMonth())?HW(n,"MM月\nYYYY"):HW(n,"MM月");case"year":return HW(n,"YYYY");default:return HW(n,"YYYY-MM-DD HH:mm")}}(t,e)}function q$(t){var e=String(Math.floor(t/3600)).padStart(2,"0"),n=String(Math.floor(t%3600/60)).padStart(2,"0"),r=String(Math.floor(t%60)).padStart(2,"0");return t<3600?"".concat(n,":").concat(r):"".concat(e,":").concat(n,":").concat(r)}var $$=function(t){function e(n){var r=t.call(this,rW({},e.defaultOptions,n))||this;r.axis=r.appendChild(new Nq({style:{type:"linear",startPos:[0,0],endPos:[0,0],data:[],showArrow:!1,animate:!1}})),r.timeline=r.appendChild(new fX({style:{onChange:function(t){r.handleSliderChange(t)}}})),r.controller=r.appendChild(new V$({})),r.states={},r.handleSliderChange=function(t){var e,n=(e=r.states.values,Array.isArray(e)?_e([],He(e),!1):e);r.setBySliderValues(t),r.dispatchOnChange(n)};var i=r.attributes,o=i.selectionType,A=i.chartType,s=i.speed,a=i.state,c=i.playMode,l=i.values;return r.states={chartType:A,playMode:c,selectionType:o,speed:s,state:a},r.setByTimebarValues(l),r}return Ie(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.attributes.data.sort(function(t,e){return t.time<e.time?-1:t.time>e.time?1:0})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){var t=this.attributes,e=t.x,n=t.y,r=t.width,i=t.height,o=t.type,A=t.controllerHeight,s=ne(+i-A,0,+i),a=new ZV(e,n+ +i-A,+r,A),c=0,l="time"===o?10:s;return{axisBBox:"chart"===o?new ZV(e,n+s-(c=35),+r,c):new ZV,controllerBBox:a,timelineBBox:new ZV(e,n+("time"===o?s:s-l),+r,l-c)}},enumerable:!1,configurable:!0}),e.prototype.setBySliderValues=function(t){var e,n,r=this.data,i=He(Array.isArray(t)?t:[0,t],2),o=i[0],A=i[1],s=r.length,a=r[Math.floor(o*s)],c=r[Math.ceil(A*s)-(Array.isArray(t)?0:1)];this.states.values=[null!==(e=null==a?void 0:a.time)&&void 0!==e?e:r[0].time,null!==(n=null==c?void 0:c.time)&&void 0!==n?n:1/0]},e.prototype.setByTimebarValues=function(t){var e,n,r,i=this.data,o=He(Array.isArray(t)?t:[void 0,t],2),A=o[0],s=o[1],a=i.find(function(t){return t.time===A}),c=i.find(function(t){return t.time===s});this.states.values=[null!==(e=null==a?void 0:a.time)&&void 0!==e?e:null===(n=i[0])||void 0===n?void 0:n.time,null!==(r=null==c?void 0:c.time)&&void 0!==r?r:1/0]},e.prototype.setByIndex=function(t){var e,n,r,i,o=this.data,A=He(t,2),s=A[0],a=A[1];this.states.values=[null!==(n=null===(e=o[s])||void 0===e?void 0:e.time)&&void 0!==n?n:o[0].time,null!==(i=null===(r=this.data[a])||void 0===r?void 0:r.time)&&void 0!==i?i:1/0]},Object.defineProperty(e.prototype,"sliderValues",{get:function(){var t,e=this.states,n=e.values,r=e.selectionType,i=He(Array.isArray(n)?n:[void 0,n],2),o=i[0],A=i[1],s=this.data,a=s.length,c="value"===r;return[(t=s.findIndex(function(t){return t.time===o}),c?0:t>-1?t/a:0),function(){if(A===1/0)return 1;var t=s.findIndex(function(t){return t.time===A});return t>-1?t/a:c?.5:1}()]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"values",{get:function(){var t=this.states,e=t.values,n=t.selectionType,r=He(Array.isArray(e)?e:[this.data[0].time,e],2),i=r[0],o=r[1];return"value"===n?o:[i,o]},enumerable:!1,configurable:!0}),e.prototype.getDatumByRatio=function(t){var e=this.data,n=e.length;return e[Math.floor(t*(n-1))]},Object.defineProperty(e.prototype,"chartHandleIconShape",{get:function(){var t=this.states.selectionType,e=this.space.timelineBBox.height;return"range"===t?function(t){return new Y$({style:{type:t,height:e,iconSize:e/6}})}:function(){return new tc({style:{x1:0,y1:-e/2,x2:0,y2:e/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),e.prototype.getChartStyle=function(t){var e=this,n=t.x,r=t.y,i=t.width,o=t.height,A=this.states,s=A.selectionType,a=A.chartType,c=this.data,l=this.attributes,u=l.type,h=l.labelFormatter,d=PW(this.attributes,"chart");d.type;var f=Pe(d,["type"]),g="range"===s;if("time"===u)return Le({handleIconShape:function(){return new W$({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:g?-15:0,autoFitLabel:g,handleSpacing:g?-15:0,trackFill:"#edeeef",trackLength:i,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:s,values:this.sliderValues,formatter:function(t){if(h)return h(t);var n=e.getDatumByRatio(t).time;return"number"==typeof n?q$(n):HW(n,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},f);var p="range"===s?5:0,v=c.map(function(t){return t.value});return Le({handleIconOffset:p,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:v,sparklineType:a,sparklineScale:.8,trackLength:i,trackSize:o,type:s,values:this.sliderValues,transform:"translate(".concat(n,", ").concat(r,")"),zIndex:1},f)},e.prototype.renderChart=function(t){void 0===t&&(t=this.space.timelineBBox),this.timeline.update(this.getChartStyle(t))},e.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},e.prototype.getAxisStyle=function(t){var e=this.data,n=this.attributes,r=n.interval,i=n.labelFormatter,o=PW(this.attributes,"axis"),A=t.x,s=t.y,a=t.width,c=_e(_e([],He(e),!1),[{time:0}],!1).map(function(t,e,n){var r=t.time;return{label:"".concat(r),value:e/(n.length-1),time:r}}),l=Le({startPos:[A,s],endPos:[A+a,s],data:c,labelFilter:function(t,e){return e<c.length-1},labelFormatter:function(t){var e=t.time;return i?i(e):X$(e,r)}},o);return l},e.prototype.renderAxis=function(t){void 0===t&&(t=this.space.axisBBox),"chart"===this.attributes.type&&this.axis.update(this.getAxisStyle(t))},e.prototype.renderController=function(t){void 0===t&&(t=this.space.controllerBBox);var e=this.attributes.type,n=this.states,r=n.state,i=n.speed,o=n.selectionType,A=n.chartType,s=PW(this.attributes,"controller"),a=this,c=Le(Le(Le({},t),{iconSize:20,speed:i,state:r,selectionType:o,chartType:A,onChange:function(t,e){var n=e.value;switch(t){case"reset":a.internalReset();break;case"speed":a.handleSpeedChange(n);break;case"backward":a.internalBackward();break;case"playPause":"play"===n?a.internalPlay():a.internalPause();break;case"forward":a.internalForward();break;case"selectionType":a.handleSelectionTypeChange(n);break;case"chartType":a.handleChartTypeChange(n)}}}),s);"time"===e&&(c.functions=[["reset","speed"],["backward","playPause","forward"],["selectionType"]]),this.controller.update(c)},e.prototype.dispatchOnChange=function(t){var e=this.data,n=this.attributes.onChange,r=this.states,i=r.values,o=r.selectionType,A=He(i,2),s=A[0],a=A[1],c=a===1/0?e.at(-1).time:a;t&&function(t,e){if(Array.isArray(t)){if(!Array.isArray(e))return!1;if(t[0]===e[0]){if(t[1]===e[1])return!0;if(t[1]===1/0||e[1]===1/0)return!0}return!1}return!Array.isArray(e)&&t===e}(t,"range"===o?[s,c]:c)||null==n||n("range"===o?[s,c]:c)},e.prototype.internalReset=function(t){var e,n,r=this.states.selectionType;this.internalPause(),this.setBySliderValues("range"===r?[0,1]:[0,0]),this.renderController(),this.updateSelection(),t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onReset)||void 0===n||n.call(e),this.dispatchOnChange())},e.prototype.reset=function(){this.internalReset()},e.prototype.moveSelection=function(t,e){var n=this.data,r=n.length,i=this.states,o=i.values,A=i.selectionType,s=i.playMode,a=He(o,2),c=a[0],l=a[1],u=n.findIndex(function(t){return t.time===c}),h=n.findIndex(function(t){return t.time===l});-1===h&&(h=r);var d,f="backward"===t?-1:1;"range"===A?"acc"===s?(d=[u,h+f],-1===f&&u===h&&(d=[u,r])):d=[u+f,h+f]:d=[u,h+f];var g=function(t){var e=He(t.sort(function(t,e){return t-e}),2),n=e[0],i=e[1],o=function(t){return ne(t,0,r)};return i>r?"value"===A?[0,0]:"acc"===s?[o(n),o(n)]:[0,o(i-n)]:n<0?"acc"===s?[0,o(i)]:[o(n+r-i),r]:[o(n),o(i)]}(d);return this.setByIndex(g),this.updateSelection(),g},e.prototype.internalBackward=function(t){var e,n,r=this.moveSelection("backward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onBackward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.backward=function(){this.internalBackward()},e.prototype.internalPlay=function(t){var e,n,r=this,i=this.data,o=this.attributes.loop,A=this.states.speed,s=void 0===A?1:A;this.playInterval=window.setInterval(function(){r.internalForward()[1]!==i.length||o||(r.internalPause(),r.renderController())},1e3/s),this.states.state="play",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPlay)||void 0===n||n.call(e))},e.prototype.play=function(){this.internalPlay()},e.prototype.internalPause=function(t){var e,n;clearInterval(this.playInterval),this.states.state="pause",!t&&(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onPause)||void 0===n||n.call(e))},e.prototype.pause=function(){this.internalPause()},e.prototype.internalForward=function(t){var e,n,r=this.moveSelection("forward",t);return t||(null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onForward)||void 0===n||n.call(e),this.dispatchOnChange()),r},e.prototype.forward=function(){this.internalForward()},e.prototype.handleSpeedChange=function(t){var e,n;this.states.speed=t,"play"===this.states.state&&(this.internalPause(!0),this.internalPlay(!0)),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSpeedChange)||void 0===n||n.call(e,t)},e.prototype.handleSelectionTypeChange=function(t){var e,n;this.states.selectionType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onSelectionTypeChange)||void 0===n||n.call(e,t)},e.prototype.handleChartTypeChange=function(t){var e,n;this.states.chartType=t,this.renderChart(),null===(n=null===(e=this.attributes)||void 0===e?void 0:e.onChartTypeChange)||void 0===n||n.call(e,t)},e.prototype.render=function(){var t=this.space,e=t.axisBBox,n=t.controllerBBox,r=t.timelineBBox;this.renderController(n),this.renderAxis(e),this.renderChart(r),"play"===this.states.state&&this.internalPlay()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.internalPause(!0)},e.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},e}(zW);function Z$(t){const{width:e,height:n,renderer:r}=t,i=function(t){var e;const{container:n,className:r,graphCanvas:i}=t;if(n)return"string"==typeof n?document.getElementById(n):n;const o=ez(r,!1),{width:A,height:s,containerStyle:a}=t,[c,l]=function(t){const{width:e,height:n,placement:r,graphCanvas:i}=t,[o,A]=i.getSize(),[s,a]=Cy(r);return[s*(o-e),a*(A-n)]}(t);return Object.assign(o.style,Object.assign({position:"absolute",left:c+"px",top:l+"px",width:A+"px",height:s+"px"},a)),null===(e=i.getContainer())||void 0===e||e.appendChild(o),o}(t);return[i,new xc({width:e,height:n,container:i,renderer:r||new _b})]}class J$ extends tz{constructor(e,n){super(e,Object.assign({},J$.defaultOptions,n)),this.typePrefix="__data__",this.draw=!1,this.fieldMap={node:new Map,edge:new Map,combo:new Map},this.selectedItems=[],this.bindEvents=()=>{const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.createElement)},this.changeState=(t,e)=>{const{graph:n}=this.context,{typePrefix:r}=this,i=Ce(t,[r,"id"]),o=Ce(t,[r,"style","labelText"]),[A]=i.split("__"),s=this.fieldMap[A].get(o)||[];n.setElementState(Object.fromEntries(null==s?void 0:s.map(t=>[t,e])))},this.click=t=>{if("hover"===this.options.trigger)return;const e=Ce(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?(this.selectedItems=this.selectedItems.filter(t=>t!==e),this.changeState(t,[])):(this.selectedItems.push(e),this.changeState(t,"selected"))},this.mouseleave=t=>{"click"!==this.options.trigger&&(this.selectedItems=[],this.changeState(t,[]))},this.mouseenter=t=>{if("click"===this.options.trigger)return;const e=Ce(t,[this.typePrefix,"id"]);this.selectedItems.includes(e)?this.selectedItems=this.selectedItems.filter(t=>t!==e):(this.selectedItems.push(e),this.changeState(t,"active"))},this.setFieldMap=(t,e,n)=>{if(!t)return;const r=this.fieldMap[n];if(r)if(r.has(t)){const n=r.get(t);n&&(n.push(e),r.set(t,n))}else r.set(t,[e])},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(t,e)=>{if(!t)return[];const{model:n,element:r}=this.context,{nodes:i,edges:o,combos:A}=n.getData(),s={},a=e=>Gt(t)?t(e):t,c={node:"circle",edge:"line",combo:"rect"},l={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},u=(t,e)=>{t.forEach(t=>{const{id:n}=t,i=Ce(t,["data",a(t)]),o=(null==r?void 0:r.getElementType(e,t))||"circle",A=((t,e)=>null==r?void 0:r.getElementComputedStyle(t,e))(e,t),u=("edge"===e?null==A?void 0:A.stroke:null==A?void 0:A.fill)||"#1783ff";n&&i&&i.replace(/\s+/g,"")&&(this.setFieldMap(i,n,e),s[i]||(s[i]={id:`${e}__${n}`,label:i,marker:l[o]||c[e],elementType:e,lineWidth:1,stroke:u,fill:u}))})};switch(e){case"node":u(i,"node");break;case"edge":u(o,"edge");break;case"combo":u(A,"combo");break;default:return[]}return Object.values(s)},this.createElement=()=>{if(this.draw)return void this.updateElement();const t=this.options,{width:e,height:n,nodeField:r,edgeField:i,comboField:o,trigger:A,position:s,container:a,containerStyle:c,className:l}=t,u=Pe(t,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),h=this.getMarkerData(r,"node"),d=this.getMarkerData(i,"edge"),f=this.getMarkerData(o,"combo"),g=[...h,...f,...d],p=Object.assign({width:e,height:n,data:g,itemMarkerLineWidth:({lineWidth:t})=>t,itemMarker:({marker:t})=>t,itemMarkerStroke:({stroke:t})=>t,itemMarkerFill:({fill:t})=>t,gridCol:h.length},u,this.getEvents()),v=new v$({className:"legend",style:p});this.category=v;this.upsertCanvas().appendChild(v),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.container)||void 0===e||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:r=e,height:i=n,position:o,container:A,containerStyle:s,className:a}=this.options,[c,l]=Z$({width:r,height:i,graphCanvas:t,container:A,containerStyle:s,placement:o,className:"legend"});return this.container=c,a&&c.classList.add(a),this.canvas=l,this.canvas}destroy(){this.clear(),this.context.graph.off(t.GraphEvent.AFTER_DRAW,this.createElement),super.destroy()}}J$.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class tZ extends tz{constructor(t,e){super(t,Object.assign({},tZ.defaultOptions,e)),this.onDraw=t=>{var e;(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.render)||this.onRender()},this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=t=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(t.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=t=>{if(!this.mask||!this.isMaskDragging)return;const{size:[e,n]}=this.options,{movementX:r,movementY:i}=t,{left:o,top:A,width:s,height:a}=this.mask.style,[,,c,l]=this.maskBBox;let u=parseInt(o)+r,h=parseInt(A)+i,d=parseInt(s),f=parseInt(a);u<0&&(u=0),h<0&&(h=0),u+d>e&&(u=nZ(e-d,0)),h+f>n&&(h=nZ(n-f,0)),d<c&&(r>0?(u=nZ(u-r,0),d=eZ(d+r,e)):r<0&&(d=eZ(d-r,e))),f<l&&(i>0?(h=nZ(h-i,0),f=eZ(f+i,n)):i<0&&(f=eZ(f-i,n))),Object.assign(this.mask.style,{left:u+"px",top:h+"px",width:d+"px",height:f+"px"});const g=parseInt(o)-u,p=parseInt(A)-h;if(0===g&&0===p)return;const v=this.context.canvas.getCamera().getZoom()/this.canvas.getCamera().getZoom();this.context.graph.translateBy([g*v,p*v],!1)},this.onMaskDragEnd=t=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(t.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=Qe(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=pe(()=>{this.renderMinimap(),this.renderMask()},this.options.delay)}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_DRAW,this.onDraw),e.on(t.GraphEvent.AFTER_RENDER,this.onRender),e.on(t.GraphEvent.AFTER_ANIMATE,this.onRender),e.on(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_DRAW,this.onDraw),e.off(t.GraphEvent.AFTER_RENDER,this.onRender),e.off(t.GraphEvent.AFTER_ANIMATE,this.onRender),e.off(t.GraphEvent.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e,element:n}=this.context,r=e.getData(),i={nodes:r.nodes.filter(t=>null==n?void 0:n.getElement(Km(t))),edges:r.edges.filter(t=>{const e=null==n?void 0:n.getElement(Km(t));return e&&JB(e)}),combos:r.combos.filter(t=>null==n?void 0:n.getElement(Km(t)))};if(!t)return i;const{nodes:o,edges:A,combos:s}=i;return{nodes:o.filter(e=>t(Km(e),"node")),edges:A.filter(e=>t(Km(e),"edge")),combos:s.filter(e=>t(Km(e),"combo"))}}setShapes(t,e){const{nodes:n,edges:r,combos:i}=e,{shape:o}=this.options,{element:A}=this.context,s=(e,n)=>{const r=Km(e),i=null==A?void 0:A.getElement(r);if(!i)return;const s=i.getShape("key");let a;if("string"==typeof o){const t=o;a=i.getShape(t).cloneNode()}else{const t=o(r,n,i);a=t===i?t.cloneNode(!0):t}a.setPosition(s.getPosition()),i.style.zIndex&&(a.style.zIndex=i.style.zIndex),a.id=i.id,t.appendChild(a)};t.removeChildren(),r.forEach(t=>s(t,"edge")),i.forEach(t=>s(t,"combo")),n.forEach(t=>s(t,"node"))}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:r,height:i}=this.canvas.getConfig();e===r&&n===i||this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:r,position:i,container:o,containerStyle:A}=this.options,[s,a]=Z$({renderer:t,width:e,height:n,placement:i,className:"minimap",container:o,containerStyle:A,graphCanvas:this.context.canvas});r&&s.classList.add(r),this.container=s,this.canvas=a}return this.setCamera(),this.canvas}createLandmark(t,e,n){const r=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(r))return this.landmarkMap.get(r);const i=this.canvas.getCamera().createLandmark(r,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(r,i),i}setCamera(){var t;const{canvas:e}=this.context,n=null===(t=this.canvas)||void 0===t?void 0:t.getCamera();if(!n)return;const{size:[r,i],padding:o}=this.options,[A,s,a,c]=pm(o),{min:l,max:u,center:h}=e.getBounds("elements"),d=(r-c-s)/(u[0]-l[0]),f=(i-A-a)/(u[1]-l[1]),g=Math.min(d,f),p=this.createLandmark(h,h,g);n.gotoLandmark(p,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),r=t.getCanvasByViewport(e),i=this.canvas.canvas2Viewport(Qy(n)),o=this.canvas.canvas2Viewport(Qy(r)),A=o.x-i.x,s=o.y-i.y;return[i.x,i.y,A,s]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,r,i,o]=this.maskBBox;return n<0&&(i=eZ(i+n,t),n=0),r<0&&(o=eZ(o+r,e),r=0),n+i>t&&(i=nZ(t-n,0)),r+o>e&&(o=nZ(e-r,0)),[eZ(n,t),eZ(r,e),nZ(i,0),nZ(o,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart),this.mask.draggable=!0,this.mask.addEventListener("dragstart",t=>t.preventDefault&&t.preventDefault())),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,r]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:r+"px"})}destroy(){var t,e,n;this.unbindEvents(),null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.mask)||void 0===e||e.remove(),null===(n=this.container)||void 0===n||n.remove(),super.destroy()}}tZ.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const eZ=(t,e)=>Math.min(t,e),nZ=(t,e)=>Math.max(t,e),rZ={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class iZ extends tz{constructor(t,e){super(t,Object.assign({},iZ.defaultOptions,e)),this.initSnapline=()=>{const t=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=t.appendChild(new tc({style:Object.assign(Object.assign({},rZ),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=t.appendChild(new tc({style:Object.assign(Object.assign({},rZ),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(t,e,n)=>De(this,void 0,void 0,function*(){const{verticalX:r,horizontalY:i}=n,{tolerance:o}=this.options,{min:[A,s],max:[a,c],center:[l,u]}=e;let h=0,d=0;null!==r&&(oZ(a,r)<o&&(h=r-a),oZ(A,r)<o&&(h=r-A),oZ(l,r)<o&&(h=r-l),0!==h&&(this.isVerticalSticking=!0)),null!==i&&(oZ(c,i)<o&&(d=i-c),oZ(s,i)<o&&(d=i-s),oZ(u,i)<o&&(d=i-u),0!==d&&(this.isHorizontalSticking=!0)),0===h&&0===d||(yield this.context.graph.translateElementBy({[t]:[h,d]},!1))}),this.enableSnap=t=>{const{target:e}=t,n=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[r,i]=this.getDelta(t);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(r)<=n&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,-i]},!1),!1;if(this.isHorizontalSticking&&Math.abs(i)<=n)return this.context.graph.translateElementBy({[e.id]:[0,-i]},!1),!1;if(this.isVerticalSticking&&Math.abs(r)<=n)return this.context.graph.translateElementBy({[e.id]:[-r,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(t,e)=>{const{tolerance:n,shape:r}=this.options,{min:[i,o],max:[A,s],center:[a,c]}=e;let l=null,u=null,h=null,d=null,f=null,g=null;return this.getNodes().some(e=>{if(xe(t.id,e.id))return!1;const p=AZ(e,r).getRenderBounds(),{min:[v,m],max:[y,w],center:[b,B]}=p;return null===l&&(oZ(b,a)<n?l=b:oZ(v,i)<n||oZ(v,A)<n?l=v:(oZ(y,A)<n||oZ(y,i)<n)&&(l=y),null!==l&&(u=Math.min(m,o),h=Math.max(w,s))),null===d&&(oZ(B,c)<n?d=B:oZ(m,o)<n||oZ(m,s)<n?d=m:(oZ(w,s)<n||oZ(w,o)<n)&&(d=w),null!==d&&(f=Math.min(v,i),g=Math.max(y,A))),null!==l&&null!==d}),{verticalX:l,verticalMinY:u,verticalMaxY:h,horizontalY:d,horizontalMinX:f,horizontalMaxX:g}},this.onDragStart=()=>{this.initSnapline()},this.onDrag=t=>De(this,void 0,void 0,function*(){const{target:e}=t;if(this.options.autoSnap){if(!this.enableSnap(t))return}const n=AZ(e,this.options.shape).getRenderBounds(),r=this.calcSnaplineMetadata(e,n);this.hideSnapline(),null===r.verticalX&&null===r.horizontalY||this.updateSnapline(r),this.options.autoSnap&&(yield this.autoSnapToLine(e.id,n,r))}),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,n=((null===(t=this.context.element)||void 0===t?void 0:t.getNodes())||[]).filter(t=>{var e;return JB(t)&&(null===(e=this.context.viewport)||void 0===e?void 0:e.isInViewport(t.getRenderBounds()))});return e?n.filter(t=>e(t)):n}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||rZ.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:r,horizontalY:i,horizontalMinX:o,horizontalMaxX:A}=t,[s,a]=this.context.canvas.getSize(),{offset:c}=this.options;null!==i?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:o-c,y1:i,x2:c===1/0?s:A+c,y2:i,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",null!==e?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?a:r+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return uy([t.dx,t.dy],e)}bindEvents(){return De(this,void 0,void 0,function*(){const{graph:e}=this.context;e.on(t.NodeEvent.DRAG_START,this.onDragStart),e.on(t.NodeEvent.DRAG,this.onDrag),e.on(t.NodeEvent.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:e}=this.context;e.off(t.NodeEvent.DRAG_START,this.onDragStart),e.off(t.NodeEvent.DRAG,this.onDrag),e.off(t.NodeEvent.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;null===(t=this.horizontalLine)||void 0===t||t.destroy(),null===(e=this.verticalLine)||void 0===e||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}iZ.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const oZ=(t,e)=>Math.abs(t-e),AZ=(t,e)=>"function"==typeof e?e(t):t.getShape(e),sZ=["timestamp","time","date","datetime"];class aZ extends tz{get padding(){return pm(this.options.padding)}constructor(t,e){super(t,Object.assign({},aZ.defaultOptions,e)),this.backup(),this.upsertTimebar()}play(){var t;null===(t=this.timebar)||void 0===t||t.play()}pause(){var t;null===(t=this.timebar)||void 0===t||t.pause()}forward(){var t;null===(t=this.timebar)||void 0===t||t.forward()}backward(){var t;null===(t=this.timebar)||void 0===t||t.backward()}reset(){var t;null===(t=this.timebar)||void 0===t||t.reset()}update(t){super.update(t),this.backup(),this.upsertTimebar()}backup(){this.originalData=cZ(this.context.graph.getData())}upsertTimebar(){const{canvas:t}=this.context,e=this.options,{onChange:n,timebarType:r,data:i,x:o,y:A,width:s,height:a,mode:c}=e,l=Pe(e,["onChange","timebarType","data","x","y","width","height","mode"]),u=t.getSize(),[h]=this.padding;this.upsertCanvas().ready.then(()=>{var t;const e=Object.assign(Object.assign({x:u[0]/2-s/2,y:h,onChange:t=>{const e=(jt(t)?t:[t,t]).map(t=>function(t){return t instanceof Date}(t)?t.getTime():t);"modify"===this.options.mode?this.filterElements(e):this.hiddenElements(e),null==n||n(e)}},l),{data:i.map(t=>re(t)?{time:t,value:0}:t),width:s,height:a,type:r});this.timebar?this.timebar.update(e):(this.timebar=new $$({style:e}),null===(t=this.canvas)||void 0===t||t.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,r=this.context.canvas,[i]=r.getSize(),[o,,A]=this.padding,[s,a]=Z$({width:i,height:e+o+A,graphCanvas:r,className:"timebar",placement:n});return this.container=s,t&&s.classList.add(t),this.canvas=a,this.canvas}filterElements(t){return De(this,void 0,void 0,function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:r}=this.options,{graph:i,element:o}=this.context,A=cZ(this.originalData);n.forEach(e=>{const n=`${e}s`;A[n]=(this.originalData[n]||[]).filter(e=>{const n=r(e);return!!lZ(n,t)})});const s=[...A.nodes,...A.combos].map(t=>Km(t));A.edges=A.edges.filter(t=>{const e=t.source,n=t.target;return s.includes(e)&&s.includes(n)}),i.setData(A),yield null===(e=o.draw({animation:!1,silence:!0}))||void 0===e?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:r}=this.options,i=[],o=[];n.forEach(e=>{var n;const A=`${e}s`;((null===(n=this.originalData)||void 0===n?void 0:n[A])||[]).forEach(e=>{const n=Km(e),A=r(e);lZ(A,t)?o.push(n):i.push(n)})}),e.hideElement(i,!1),e.showElement(o,!1)}destroy(){var t,e,n;const{graph:r}=this.context;this.originalData&&r.setData(Object.assign({},this.originalData)),null===(t=this.timebar)||void 0===t||t.destroy(),null===(e=this.canvas)||void 0===e||e.destroy(),null===(n=this.container)||void 0===n||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}aZ.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:t=>uZ(t,sZ,void 0),loop:!1};const cZ=t=>{const{nodes:e=[],edges:n=[],combos:r=[]}=t;return{nodes:[...e],edges:[...n],combos:[...r]}},lZ=(t,e)=>{if(re(e))return t===e;const[n,r]=e;return t>=n&&t<=r},uZ=(t,e,n)=>{var r;for(let n=0;n<e.length;n++){const i=e[n],o=null===(r=t.data)||void 0===r?void 0:r[i];if(o)return o}return n},hZ={fill:"#1D2129",wordWrap:!0,maxLines:1,textOverflow:"ellipsis",textBaseline:"top",textAlign:"start",x:0},dZ=Object.assign(Object.assign({},hZ),{fillOpacity:.9,fontSize:16,fontWeight:"bold"}),fZ=Object.assign(Object.assign({},hZ),{fillOpacity:.65,fontSize:12,fontWeight:"normal"}),gZ={align:"left",spacing:8,size:44,padding:[16,24,0,24]},pZ="title",vZ="subtitle";class mZ extends tz{get padding(){return pm(this.options.padding)}constructor(t,e){super(t,Object.assign({},gZ,e)),this.onRender=()=>{const t=this.updateCanvas();this.renderTitle(t)},this.bindEvents()}bindEvents(){const{graph:e}=this.context;e.on(t.GraphEvent.AFTER_RENDER,this.onRender),e.on(t.GraphEvent.AFTER_ANIMATE,this.onRender)}unbindEvents(){const{graph:e}=this.context;e.off(t.GraphEvent.AFTER_RENDER,this.onRender),e.off(t.GraphEvent.AFTER_ANIMATE,this.onRender)}destroy(){var t,e;this.unbindEvents(),null===(t=this.canvas)||void 0===t||t.destroy(),null===(e=this.container)||void 0===e||e.remove(),super.destroy()}updateCanvas(){const{size:t,className:e,align:n}=this.options,[r]=this.context.canvas.getSize(),[i=0,,o=0]=this.padding,A=t+i+o;if(this.canvas){const{width:t,height:e}=this.canvas.getConfig();r===t&&A===e||this.canvas.resize(r,A)}else{const t={left:"left-top",center:"top",right:"right-top"},[i,o]=Z$({width:r,height:A,placement:t[n]||t.left,className:"title-canvas",graphCanvas:this.context.canvas});e&&i.classList.add(e),this.container=i,this.canvas=o}return this.canvas}renderTitle(t){const e=new yZ({options:this.options,ctx:this.context});t.removeChildren(),e.getTitle().forEach(e=>{e&&t.appendChild(e)})}}class yZ{get padding(){return pm(this.options.padding)}constructor(t){const{options:e,ctx:n}=t;this.options=e,this.context=n}getTitle(){const t=this.options,e=pZ,n=t[e],r=vZ,i=t[r],{spacing:o=44,padding:A,align:s}=t,a=Pe(t,[e+"",r+"","spacing","padding","align"]),c=n,l=i,u=Aw(a,pZ),h=Aw(a,vZ),[d]=this.context.graph.getSize(),[f=0,g=0,,p=0]=this.padding,v=d,m=v-p-g;let y=null,w=p,b="left";switch(s){case"left":default:w=p,b="left";break;case"center":w=v/2,b="center";break;case"right":w=v-g,b="right"}const B=new yw({className:pZ,style:Object.assign(Object.assign(Object.assign(Object.assign({},dZ),{wordWrapWidth:m-5,x:w,y:f,textAlign:b}),u),{text:c})}),E=B.getBBox();return l&&(y=new yw({className:"subTitle",style:Object.assign(Object.assign(Object.assign(Object.assign({},fZ),{wordWrapWidth:m-5,x:w,y:E.height+o+f,textAlign:b}),h),{text:l})})),[B,y]}}class wZ extends tz{constructor(t,e){super(t,Object.assign({},wZ.defaultOptions,e)),this.$element=ez("toolbar",!1),this.onToolbarItemClick=t=>{const{onClick:e}=this.options;if(t.target instanceof Element&&t.target.className.includes("g6-toolbar-item")){const n=t.target.getAttribute("value");null==e||e(n,t.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),nz("g6-toolbar-css","style",{},"\n .g6-toolbar {\n position: absolute;\n z-index: 100;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n border-radius: 4px;\n box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1);\n opacity: 0.65;\n }\n .g6-toolbar .g6-toolbar-item {\n display: inline-block;\n width: 16px;\n height: 16px;\n padding: 4px;\n cursor: pointer;\n box-sizing: content-box;\n }\n\n .g6-toolbar .g6-toolbar-item:hover {\n background-color: #f0f0f0;\n }\n\n .g6-toolbar .g6-toolbar-item svg {\n display: inline-block;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n",document.head),nz("g6-toolbar-svgicon","div",{display:"none"},'\n <svg>\n <symbol id="zoom-in" viewBox="64 64 896 896">\n <path d="M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="zoom-out" viewBox="64 64 896 896">\n <path d="M637 443H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h312c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zm284 424L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"></path>\n </symbol>\n <symbol id="edit" viewBox="64 64 896 896">\n <path d="M257.7 752c2 0 4-.2 6-.5L431.9 722c2-.4 3.9-1.3 5.3-2.8l423.9-423.9a9.96 9.96 0 000-14.1L694.9 114.9c-1.9-1.9-4.4-2.9-7.1-2.9s-5.2 1-7.1 2.9L256.8 538.8c-1.5 1.5-2.4 3.3-2.8 5.3l-29.5 168.2a33.5 33.5 0 009.4 29.8c6.6 6.4 14.9 9.9 23.8 9.9zm67.4-174.4L687.8 215l73.3 73.3-362.7 362.6-88.9 15.7 15.6-89zM880 836H144c-17.7 0-32 14.3-32 32v36c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-36c0-17.7-14.3-32-32-32z"></path>\n </symbol>\n <symbol id="delete" viewBox="64 64 896 896">\n <path d="M360 184h-8c4.4 0 8-3.6 8-8v8h304v-8c0 4.4 3.6 8 8 8h-8v72h72v-80c0-35.3-28.7-64-64-64H352c-35.3 0-64 28.7-64 64v80h72v-72zm504 72H160c-17.7 0-32 14.3-32 32v32c0 4.4 3.6 8 8 8h60.4l24.7 523c1.6 34.1 29.8 61 63.9 61h454c34.2 0 62.3-26.8 63.9-61l24.7-523H888c4.4 0 8-3.6 8-8v-32c0-17.7-14.3-32-32-32zM731.3 840H292.7l-24.2-512h487l-24.2 512z"></path>\n </symbol>\n <symbol id="redo" viewBox="64 64 896 896">\n <path d="M758.2 839.1C851.8 765.9 912 651.9 912 523.9 912 303 733.5 124.3 512.6 124 291.4 123.7 112 302.8 112 523.9c0 125.2 57.5 236.9 147.6 310.2 3.5 2.8 8.6 2.2 11.4-1.3l39.4-50.5c2.7-3.4 2.1-8.3-1.2-11.1-8.1-6.6-15.9-13.7-23.4-21.2a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-9.3 9.3-19.1 18-29.3 26L668.2 724a8 8 0 00-14.1 3l-39.6 162.2c-1.2 5 2.6 9.9 7.7 9.9l167 .8c6.7 0 10.5-7.7 6.3-12.9l-37.3-47.9z"></path>\n </symbol>\n <symbol id="undo" viewBox="64 64 896 896">\n <path d="M511.4 124C290.5 124.3 112 303 112 523.9c0 128 60.2 242 153.8 315.2l-37.5 48c-4.1 5.3-.3 13 6.3 12.9l167-.8c5.2 0 9-4.9 7.7-9.9L369.8 727a8 8 0 00-14.1-3L315 776.1c-10.2-8-20-16.7-29.3-26a318.64 318.64 0 01-68.6-101.7C200.4 609 192 567.1 192 523.9s8.4-85.1 25.1-124.5c16.1-38.1 39.2-72.3 68.6-101.7 29.4-29.4 63.6-52.5 101.7-68.6C426.9 212.4 468.8 204 512 204s85.1 8.4 124.5 25.1c38.1 16.1 72.3 39.2 101.7 68.6 29.4 29.4 52.5 63.6 68.6 101.7 16.7 39.4 25.1 81.3 25.1 124.5s-8.4 85.1-25.1 124.5a318.64 318.64 0 01-68.6 101.7c-7.5 7.5-15.3 14.5-23.4 21.2a7.93 7.93 0 00-1.2 11.1l39.4 50.5c2.8 3.5 7.9 4.1 11.4 1.3C854.5 760.8 912 649.1 912 523.9c0-221.1-179.4-400.2-400.6-399.9z"></path>\n </symbol>\n <symbol id="export" viewBox="64 64 896 896">\n <path d="M880 912H144c-17.7 0-32-14.3-32-32V144c0-17.7 14.3-32 32-32h360c4.4 0 8 3.6 8 8v56c0 4.4-3.6 8-8 8H184v656h656V520c0-4.4 3.6-8 8-8h56c4.4 0 8 3.6 8 8v360c0 17.7-14.3 32-32 32zM770.87 199.13l-52.2-52.2a8.01 8.01 0 014.7-13.6l179.4-21c5.1-.6 9.5 3.7 8.9 8.9l-21 179.4c-.8 6.6-8.9 9.4-13.6 4.7l-52.4-52.4-256.2 256.2a8.03 8.03 0 01-11.3 0l-42.4-42.4a8.03 8.03 0 010-11.3l256.1-256.3z"></path>\n </symbol>\n <symbol id="auto-fit" viewBox="64 64 896 896">\n <path d="M952 474H829.8C812.5 327.6 696.4 211.5 550 194.2V72c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v122.2C327.6 211.5 211.5 327.6 194.2 474H72c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h122.2C211.5 696.4 327.6 812.5 474 829.8V952c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V829.8C696.4 812.5 812.5 696.4 829.8 550H952c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8zM512 756c-134.8 0-244-109.2-244-244s109.2-244 244-244 244 109.2 244 244-109.2 244-244 244z"></path>\n <path d="M512 392c-32.1 0-62.1 12.4-84.8 35.2-22.7 22.7-35.2 52.7-35.2 84.8s12.5 62.1 35.2 84.8C449.9 619.4 480 632 512 632s62.1-12.5 84.8-35.2C619.4 574.1 632 544 632 512s-12.5-62.1-35.2-84.8A118.57 118.57 0 00512 392z"></path>\n </symbol>\n <symbol id="reset" viewBox="64 64 896 896">\n <path d="M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"></path>\n </symbol>\n <symbol id="exit-fullscreen" viewBox="0 0 1024 1024">\n <path d="M418.13333333 361.43786666c0 0.2048-0.13653333 0.4096-0.13653334 0.68266667C417.99679999 362.32533333 418.13333333 362.53013333 418.13333333 362.73493333 418.13333333 371.54133333 414.44693333 379.392 408.78079999 385.39946666 408.43946666 385.7408 408.30293333 386.21866666 408.02986666 386.49173333c-1.09226667 1.09226667-2.59413333 1.77493333-3.82293333 2.73066667C398.40426666 393.65973333 391.64586666 396.8 383.93173333 396.8 383.72693333 396.8 383.59039999 396.73173333 383.38559999 396.73173333S382.97599999 396.8 382.77119999 396.8L112.29866666 396.8C92.50133333 396.8 76.79999999 381.50826666 76.79999999 362.66666666 76.66346666 343.89333333 92.63786666 328.53333333 112.16213333 328.53333333l189.44 0L87.44959999 114.51733333C73.59146666 100.59093333 73.25013333 78.5408 86.63039999 65.29706666c13.17546667-13.44853333 35.36213333-12.97066667 49.152 0.88746667l214.08426667 214.08426667L349.86666666 90.89706666C349.79839999 71.23626666 365.22666666 55.46666666 383.99999999 55.46666666 402.77333333 55.33013333 418.13333333 71.30453333 418.13333333 90.8288L418.13333333 361.43786666zM928.90453333 328.53333333l-189.44 0 214.15253333-214.08426667c13.85813333-13.9264 14.19946667-35.90826667 0.88746667-49.22026666-13.17546667-13.44853333-35.36213333-12.97066667-49.152 0.88746666l-214.08426667 214.08426667L691.26826666 90.89706666C691.26826666 71.23626666 675.83999999 55.46666666 657.06666666 55.46666666 638.29333333 55.33013333 622.93333333 71.30453333 622.93333333 90.8288l0 270.60906666c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 362.32533333 622.93333333 362.53013333 622.93333333 362.73493333 622.93333333 371.54133333 626.61973333 379.392 632.28586666 385.39946666c0.34133333 0.34133333 0.47786667 0.8192 0.8192 1.09226667 1.09226667 1.09226667 2.59413333 1.77493333 3.8912 2.73066667C642.66239999 393.65973333 649.42079999 396.8 657.13493333 396.8c0.2048 0 0.34133333-0.06826667 0.54613333-0.06826667S658.09066666 396.8 658.29546666 396.8l270.5408 0C948.56533333 396.8 964.26666666 381.50826666 964.26666666 362.66666666 964.40319999 343.89333333 948.42879999 328.53333333 928.90453333 328.53333333zM418.13333333 635.73333333c0-8.8064-3.6864-16.5888-9.35253334-22.66453333C408.43946666 612.72746666 408.30293333 612.2496 408.02986666 611.90826666 406.86933333 610.88426666 405.43573333 610.2016 404.20693333 609.24586666 398.47253333 604.80853333 391.64586666 601.6 383.93173333 601.6 383.72693333 601.6 383.59039999 601.73653333 383.38559999 601.73653333S382.97599999 601.6 382.77119999 601.6L112.29866666 601.6C92.50133333 601.6 76.79999999 616.96 76.79999999 635.73333333 76.66346666 654.50666666 92.63786666 669.86666666 112.16213333 669.86666666l189.44 0-214.15253334 214.15253334c-13.85813333 13.85813333-14.19946667 35.84-0.88746666 49.22026666 13.17546667 13.44853333 35.36213333 12.9024 49.152-0.95573333l214.08426666-214.08426667 0 189.37173334c0 19.59253333 15.42826667 35.49866667 34.2016 35.36213333C402.77333333 943.2064 418.13333333 927.232 418.13333333 907.5712L418.13333333 637.09866666c0-0.27306667-0.13653333-0.47786667-0.13653334-0.68266666C417.99679999 636.14293333 418.13333333 635.93813333 418.13333333 635.73333333zM739.46453333 669.86666666l189.44 0c19.456 0 35.49866667-15.36 35.36213333-34.13333333C964.26666666 616.96 948.56533333 601.6 928.76799999 601.6L658.29546666 601.6C658.09066666 601.6 657.88586666 601.73653333 657.68106666 601.73653333S657.33973333 601.6 657.13493333 601.6C649.42079999 601.6 642.59413333 604.80853333 636.85973333 609.24586666 635.63093333 610.2016 634.19733333 610.88426666 633.03679999 611.90826666 632.76373333 612.2496 632.62719999 612.72746666 632.28586666 613.0688 626.61973333 619.14453333 622.93333333 626.92693333 622.93333333 635.73333333c0 0.2048 0.13653333 0.4096 0.13653333 0.68266667C623.06986666 636.6208 622.93333333 636.8256 622.93333333 637.09866666l0 270.5408C622.93333333 927.232 638.29333333 943.2064 657.06666666 942.93333333c18.77333333 0.13653333 34.2016-15.70133333 34.2016-35.36213333l0-189.37173334 214.08426667 214.08426667c13.78986667 13.85813333 35.90826667 14.40426667 49.152 0.95573333 13.312-13.312 12.97066667-35.36213333-0.88746667-49.22026666L739.46453333 669.86666666z" ></path></symbol>\n <symbol id="request-fullscreen" viewBox="0 0 1024 1024">\n <path d="M69.818182 87.598545v273.128728a34.909091 34.909091 0 0 0 69.818182 0V163.653818l221.928727 222.021818a33.512727 33.512727 0 0 0 47.383273-47.383272L186.926545 116.363636h197.073455a34.909091 34.909091 0 0 0 0-69.818181H110.871273C85.364364 46.545455 69.818182 59.671273 69.818182 87.598545zM938.542545 46.545455H665.413818a34.909091 34.909091 0 0 0 0 69.818181h197.073455L640.465455 338.292364a33.512727 33.512727 0 0 0 47.383272 47.383272l221.928728-222.021818v197.073455a34.909091 34.909091 0 0 0 69.818181 0V87.598545c0-27.927273-15.453091-41.053091-40.96-41.05309z m-827.671272 907.636363h273.128727a34.909091 34.909091 0 0 0 0-69.818182H186.926545l222.021819-221.928727a33.512727 33.512727 0 0 0-47.383273-47.383273L139.636364 837.073455V640a34.909091 34.909091 0 0 0-69.818182 0v273.128727c0 27.927273 15.546182 41.053091 41.053091 41.053091z m868.724363-41.053091V640a34.909091 34.909091 0 0 0-69.818181 0v197.073455L687.941818 615.051636a33.512727 33.512727 0 0 0-47.383273 47.383273L862.487273 884.363636H665.413818a34.909091 34.909091 0 0 0 0 69.818182h273.128727c25.6 0 41.053091-13.125818 41.053091-41.053091z" ></path></symbol>\n </svg>\n'),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return De(this,void 0,void 0,function*(){e.update.call(this,t);const{className:n,position:r,style:i}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,i,function(t){const e={top:"unset",right:"unset",bottom:"unset",left:"unset"};return t.split("-").forEach(t=>{e[t]="8px"}),e.flexDirection=t.startsWith("top")||t.startsWith("bottom")?"row":"column",e}(r)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return De(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(t=>{var e;return`\n <div class="g6-toolbar-item" value="${t.value}" title="${null!==(e=t.title)&&void 0!==e?e:""}">\n <svg aria-hidden="true" focusable="false">\n <use xlink:href="#${t.id}"></use>\n </svg>\n </div>`}).join("")})}}wZ.defaultOptions={position:"top-left"};class bZ extends tz{constructor(t,e){super(t,Object.assign({},bZ.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(t,e)=>{const{enable:n}=this.options;return"function"==typeof n?n(t,e):n},this.onClick=t=>{const{target:{id:e}}=t;this.currentTarget===e?this.hide(t):this.show(t)},this.onPointerMove=t=>{const{target:e}=t;this.currentTarget&&e.id!==this.currentTarget&&this.show(t)},this.onPointerLeave=t=>{this.hide(t)},this.onCanvasMove=t=>{this.hide(t)},this.onPointerOver=t=>{this.show(t)},this.showById=t=>De(this,void 0,void 0,function*(){const e={target:{id:t}};yield this.show(e)}),this.getElementData=(t,e)=>{const{model:n}=this.context;switch(e){case"node":return n.getNodeData([t]);case"edge":return n.getEdgeData([t]);case"combo":return n.getComboData([t]);default:return[]}},this.show=t=>De(this,void 0,void 0,function*(){var e,n;const{client:r,target:{id:i}}=t;if(eE(t.target))return;const o=this.context.graph.getElementType(i),{getContent:A,title:s}=this.options,a=this.getElementData(i,o);if(!this.tooltipElement)return;if(!this.isEnable(t,a))return void this.hide(t);let c,l,u={};if(A){if(u.content=yield A(t,a),!u.content)return}else{const t=this.context.graph.getElementRenderStyle(i),e="node"===o?t.fill:t.stroke;u={title:s||o,data:a.map(t=>({name:"ID",value:t.id||`${t.source} -> ${t.target}`,color:e}))}}if(this.currentTarget=i,r)c=r.x,l=r.y;else{const t=Ce(a,"0.style",{x:0,y:0});c=t.x,l=t.y}null===(n=(e=this.options).onOpenChange)||void 0===n||n.call(e,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:c,y:l,style:{".tooltip":{visibility:"visible"}}}),u))}),this.hide=t=>{var e,n,r,i,o;if(!t)return null===(n=(e=this.options).onOpenChange)||void 0===n||n.call(e,!1),null===(r=this.tooltipElement)||void 0===r||r.hide(),void(this.currentTarget=null);if(!this.tooltipElement)return;if(!this.currentTarget)return;const{client:{x:A,y:s}}=t;null===(o=(i=this.options).onOpenChange)||void 0===o||o.call(i,!1),this.tooltipElement.hide(A,s),this.currentTarget=null},this.initTooltip=()=>{var t;const e=new x$({className:"tooltip",style:this.tooltipStyleProps});return null===(t=this.container)||void 0===t||t.appendChild(e.HTMLTooltipElement),e},this.render(),this.bindEvents()}getEvents(){return"click"===this.options.trigger?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerover":this.onPointerOver,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerover":this.onPointerOver,"edge:pointermove":this.onPointerMove,"combo:pointerover":this.onPointerOver,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&(null===(e=this.container)||void 0===e||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:r,left:i}=n.getBoundingClientRect(),{style:o,position:A,enterable:s,container:a={x:-i,y:-r},title:c,offset:l}=this.options,[u,h]=e,[d,f]=t.getSize();return{x:u,y:h,container:a,title:c,bounding:{x:0,y:0,width:d,height:f},position:A,enterable:s,offset:l,style:o}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&(null===(t=this.container)||void 0===t||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}let BZ;function EZ(t,e){BZ||(BZ=document.createElement("canvas")),BZ.width=t,BZ.height=e;return BZ.getContext("2d").clearRect(0,0,t,e),BZ}bZ.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};class xZ extends tz{constructor(t,e){super(t,Object.assign({},xZ.defaultOptions,e)),this.$element=ez("watermark");this.context.canvas.getContainer().appendChild(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return De(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:r,height:i,text:o,imageURL:A}=n,s=Pe(n,["width","height","text","imageURL"]);Object.keys(s).forEach(e=>{e.startsWith("background")&&(this.$element.style[e]=t[e])});const a=A?yield function(t,e,n,r){return De(this,void 0,void 0,function*(){const i=EZ(t,e),o=i.getContext("2d"),{rotate:A,opacity:s}=r;A&&o.rotate(A),s&&(o.globalAlpha=s);const a=new Image;return a.crossOrigin="anonymous",a.src=n,new Promise(n=>{a.onload=function(){const r=t>a.width?(t-a.width)/2:0,A=e>a.height?(e-a.height)/2:0;o.drawImage(a,0,0,a.width,a.height,r,A,t-2*r,e-2*A),n(i.toDataURL())}})})}(r,i,A,s):yield function(t,e,n,r){return De(this,void 0,void 0,function*(){const i=EZ(t,e),o=i.getContext("2d"),{rotate:A,opacity:s,textFill:a,textFontSize:c,textFontFamily:l,textFontVariant:u,textFontWeight:h,textAlign:d,textBaseline:f}=r;return o.textAlign=d,o.textBaseline=f,o.translate(t/2,e/2),o.font=`${c}px ${l} ${u} ${h}`,A&&o.rotate(A),s&&(o.globalAlpha=s),a&&(o.fillStyle=a,o.fillText(`${n}`,0,0)),i.toDataURL()})}(r,i,o,s);this.$element.style.backgroundImage=`url(${a})`})}destroy(){super.destroy(),this.$element.remove()}}xZ.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const CZ=["#7E92B5","#F4664A","#FFBE3A"],MZ={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},FZ={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function kZ(t){const{bgColor:e,textColor:n,nodeColor:r,nodeColorDisabled:i,nodeStroke:o,nodeHaloStrokeOpacityActive:A=.15,nodeHaloStrokeOpacitySelected:s=.25,nodeOpacityDisabled:a=.06,nodeIconOpacityInactive:c=.85,nodeOpacityInactive:l=.25,nodeBadgePalette:u=CZ,nodePaletteOptions:h=MZ,edgeColor:d,edgeColorDisabled:f,edgePaletteOptions:g=FZ,comboColor:p,comboColorDisabled:v,comboStroke:m,comboStrokeDisabled:y,edgeColorInactive:w}=t;return{background:e,node:{palette:h,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:u,fill:r,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:n,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:r,portLineWidth:1,portStroke:o,portStrokeOpacity:.65,size:32,stroke:o,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:s,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:o},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:A},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:o,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:l,donutOpacity:l,fillOpacity:l,iconOpacity:c,labelFill:n,labelFillOpacity:l,strokeOpacity:l},disabled:{badgeBackgroundOpacity:.25,donutOpacity:a,fill:i,fillOpacity:a,iconFill:i,iconOpacity:.25,labelFill:n,labelFillOpacity:.25,strokeOpacity:a}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:d,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,badgeBackgroundOpacity:1,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:d,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:w,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:f,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:e,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:p,halo:!1,haloLineWidth:12,haloStroke:m,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:e,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:n,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:m},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:v,fillOpacity:.25,labelOpacity:.25,stroke:y,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const SZ=kZ({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),QZ=kZ({bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"});class UZ extends ry{beforeDraw(t,e){return t}afterLayout(t,e){}}function NZ(t,e,n,r,i){const o=Km(r),A=`${n}s`,s=i?r:t.add[A].get(o)||t.update[A].get(o)||t.remove[A].get(o)||r;Object.entries(t).forEach(([t,n])=>{e===t?n[A].set(o,s):n[A].delete(o)})}function TZ(t,e){return Object.keys(t).every(n=>t[n]===e[n])}const OZ=(t,e,n,r)=>{const i=`${n}s`,o=Km(r);t.add[i].has(o)||t.update[i].has(o)||t[e][i].set(Km(r),r)};const IZ=new WeakMap;const LZ=(t,e,n=2)=>{if("object"!=typeof t||"object"!=typeof e)return t===e;const r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(const i of r){const r=t[i],o=e[i];if(n>1&&"object"==typeof r&&"object"==typeof o){if(!LZ(r,o,n-1))return!1}else if(r!==o)return!1}return!0};function PZ(t,e,n){Yv[t][e]&&Zv(`The extension ${e} of ${t} has been registered before, and will be overridden.`),Object.assign(Yv[t],{[e]:n})}
61
+ /*!
62
+ * @antv/g-plugin-dragndrop
63
+ * @description A G plugin for Drag n Drop implemented with PointerEvents
64
+ * @version 2.1.1
65
+ * @date 12/24/2025, 11:56:44 AM
66
+ * @author AntVis
67
+ * @docs https://g.antv.antgroup.com/
68
+ */var DZ=function(){function t(e){A(this,t),this.dragndropPluginOptions=e}return a(t,[{key:"apply",value:function(e){var n=this,r=e.renderingService,i=e.renderingContext.root.ownerDocument,o=i.defaultView,A=function(t){var e=t.target,r=e===i,A=r&&n.dragndropPluginOptions.isDocumentDraggable?i:e.closest&&e.closest("[draggable=true]");if(A){var s=!1,a=t.timeStamp,c=[t.clientX,t.clientY],l=null,u=[t.clientX,t.clientY],h=function(){var t=Ar(ir().mark(function t(o){var h,d,f,g,p,v;return ir().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(s){t.next=2;break}if(h=o.timeStamp-a,d=gn([o.clientX,o.clientY],c),!(h<=n.dragndropPluginOptions.dragstartTimeThreshold||d<=n.dragndropPluginOptions.dragstartDistanceThreshold)){t.next=1;break}return t.abrupt("return");case 1:o.type="dragstart",A.dispatchEvent(o),s=!0;case 2:if(o.type="drag",o.dx=o.clientX-u[0],o.dy=o.clientY-u[1],A.dispatchEvent(o),u=[o.clientX,o.clientY],r){t.next=4;break}return f="pointer"===n.dragndropPluginOptions.overlap?[o.canvasX,o.canvasY]:e.getBounds().center,t.next=3,i.elementsFromPoint(f[0],f[1]);case 3:g=t.sent,p=g[g.indexOf(e)+1],v=(null==p?void 0:p.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?i:null),l!==v&&(l&&(o.type="dragleave",o.target=l,l.dispatchEvent(o)),v&&(o.type="dragenter",o.target=v,v.dispatchEvent(o)),(l=v)&&(o.type="dragover",o.target=l,l.dispatchEvent(o)));case 4:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}();o.addEventListener("pointermove",h);var d=function(t){if(s){t.detail={preventClick:!0};var e=t.clone();l&&(e.type="drop",e.target=l,l.dispatchEvent(e)),e.type="dragend",A.dispatchEvent(e),s=!1}o.removeEventListener("pointermove",h)};e.addEventListener("pointerup",d,{once:!0}),e.addEventListener("pointerupoutside",d,{once:!0})}};r.hooks.init.tap(t.tag,function(){o.addEventListener("pointerdown",A)}),r.hooks.destroy.tap(t.tag,function(){o.removeEventListener("pointerdown",A)})}}])}();DZ.tag="Dragndrop";var RZ=function(t){function e(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return A(this,e),(t=g(this,e)).name="dragndrop",t.options=n,t}return v(e,t),a(e,[{key:"init",value:function(){this.addRenderingPlugin(new DZ(o({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(t){Object.assign(this.plugins[0].dragndropPluginOptions,t)}}])}(ur);const HZ=["main"],_Z=["background","main","label","transient"];class GZ{getConfig(){return this.config}getLayer(t="main"){return this.extends.layers[t]||this.getLayers().main}getLayers(){return this.extends.layers}getRenderer(t){return this.extends.renderers[t]}getCamera(t="main"){return this.getLayer(t).getCamera()}getRoot(t="main"){return this.getLayer(t).getRoot()}getContextService(t="main"){return this.getLayer(t).getContextService()}setCursor(t){this.config.cursor=t,this.getLayer().setCursor(t)}get document(){return this.getLayer().document}get context(){return this.getLayer().context}constructor(t){this.config={enableMultiLayer:!0},Object.assign(this.config,t);const e=this.config,{renderer:n,background:r,cursor:i,enableMultiLayer:o}=e,A=Pe(e,["renderer","background","cursor","enableMultiLayer"]),s=o?_Z:HZ,a=KZ(n,s),c=Object.fromEntries(s.map(t=>[t,new xc(Object.assign(Object.assign({},A),{supportsMutipleCanvasesInOneContainer:o,renderer:a[t],background:o?"background"===t?r:void 0:r}))]));jZ(c),this.extends={config:this.config,renderer:n,renderers:a,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const r=n.getCamera(),i=r.getPosition(),o=r.getFocalPoint();n.resize(t,e),r.setPosition(i),r.setFocalPoint(o)})}getBounds(t){return xm(Object.values(this.getLayers()).map(e=>t?e.getRoot().childNodes.find(e=>e.classList.includes(t)):e.getRoot()).filter(t=>(null==t?void 0:t.childNodes.length)>0).map(t=>t.getBounds()))}getContainer(){const t=this.extends.config.container;return"string"==typeof t?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const r=(null===(n=t.style)||void 0===n?void 0:n.$layer)||"main";return this.getLayer(r).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=KZ(t,this.config.enableMultiLayer?_Z:HZ);this.extends.renderers=e,Object.entries(e).forEach(([t,e])=>this.getLayer(t).setRenderer(e)),jZ(this.getLayers())}getCanvasByViewport(t){return Sy(this.getLayer().viewport2Canvas(Qy(t)))}getViewportByCanvas(t){return Sy(this.getLayer().canvas2Viewport(Qy(t)))}getViewportByClient(t){return Sy(this.getLayer().client2Viewport(Qy(t)))}getClientByViewport(t){return Sy(this.getLayer().viewport2Client(Qy(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Qy(t));return Sy(e.viewport2Canvas(n))}toDataURL(){return De(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,r=Pe(t,["mode"]);let[i,o,A,s]=[0,0,0,0];if("viewport"===n)[A,s]=this.getSize();else if("overall"===n){const t=this.getBounds(),e=wm(t);[i,o]=t.min,[A,s]=e}const a=Sn('<div id="virtual-image"></div>'),c=new xc({width:A,height:s,renderer:new _b,devicePixelRatio:e,container:a,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const l=this.getLayer("label").getRoot().cloneNode(!0),u=c.viewport2Canvas({x:0,y:0}),h=this.getCanvasByViewport([0,0]);l.translate([h[0]-u.x,h[1]-u.y]),l.scale(1/this.getCamera().getZoom()),c.appendChild(l),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const d=this.getCamera(),f=c.getCamera();if("viewport"===n)f.setZoom(d.getZoom()),f.setPosition(d.getPosition()),f.setFocalPoint(d.getFocalPoint());else if("overall"===n){const[t,e,n]=f.getPosition(),[r,A,s]=f.getFocalPoint();f.setPosition([t+i,e+o,n]),f.setFocalPoint([r+i,A+o,s])}const g=c.getContextService();return new Promise(t=>{c.addEventListener(mc.RERENDER,()=>De(this,void 0,void 0,function*(){yield new Promise(t=>setTimeout(t,300));const e=yield g.toDataURL(r);t(e)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function KZ(t,e){return Object.fromEntries(e.map(e=>{const n=(null==t?void 0:t(e))||new _b;return n instanceof _b&&n.setConfig({enableDirtyRectangleRendering:!1}),"main"===e?n.registerPlugin(new RZ({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function jZ(t){Object.entries(t).forEach(([t,e])=>{const n=e.getContextService().getDomElement();(null==n?void 0:n.style)&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,"main"!==t&&(n.style.pointerEvents="none")),(null==n?void 0:n.parentElement)&&(n.parentElement.style.display="grid",n.parentElement.style.isolation="isolate")})}const zZ=t=>t?parseInt(t):0;function VZ(t){if(!t)return[0,0];let e=640,n=480;const[r,i]=function(t){const e=getComputedStyle(t),n=t.clientWidth||zZ(e.width),r=t.clientHeight||zZ(e.height);return[n-(zZ(e.paddingLeft)+zZ(e.paddingRight)),r-(zZ(e.paddingTop)+zZ(e.paddingBottom))]}(t);e=r||e,n=i||n;return[Math.max(re(e)?e:1,1),Math.max(re(n)?n:1,1)]}class WZ{constructor(t){this.type=t}}class YZ extends WZ{constructor(t,e){super(t),this.data=e}}class XZ extends WZ{constructor(t,e,n,r){super(t),this.animationType=e,this.animation=n,this.data=r}}class qZ extends WZ{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class $Z extends WZ{constructor(t,e){super(t),this.data=e}}function ZZ(t,e){t.emit(e.type,e)}function JZ(t){var e;return(null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0}const tJ="cachedStyle",eJ=t=>`__${t}__`;function nJ(t,e){return Ce(t,[tJ,eJ(e)])}class rJ{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var r,i,o;null===(r=null==e?void 0:e.before)||void 0===r||r.call(e);const A=this.getTasks().map(([e,r])=>{var i,o,A;const{element:s,elementType:a,stage:c}=e,l=im(this.context.options,a,c,t);null===(i=null==r?void 0:r.before)||void 0===i||i.call(r);const u=l.length?Am(s,this.inferStyle(e,n),l):null;return u?(null===(o=null==r?void 0:r.beforeAnimate)||void 0===o||o.call(r,u),u.finished.then(()=>{var t,e;null===(t=null==r?void 0:r.afterAnimate)||void 0===t||t.call(r,u),null===(e=null==r?void 0:r.after)||void 0===e||e.call(r),this.animations.delete(u)})):null===(A=null==r?void 0:r.after)||void 0===A||A.call(r),u}).filter(Boolean);A.forEach(t=>this.animations.add(t));const s=tm(A);return s?(null===(i=null==e?void 0:e.beforeAnimate)||void 0===i||i.call(e,s),s.finished.then(()=>{var t,n;null===(t=null==e?void 0:e.afterAnimate)||void 0===t||t.call(e,s),null===(n=null==e?void 0:e.after)||void 0===n||n.call(e),this.release()})):null===(o=null==e?void 0:e.after)||void 0===o||o.call(e),s}inferStyle(t,e){var n,r;const{element:i,elementType:o,stage:A,originalStyle:s,updatedStyle:a={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},s),a));const{modifiedStyle:c}=t,l={},u={};if("enter"===A)Object.assign(l,{opacity:0});else if("exit"===A)Object.assign(u,{opacity:0});else if("show"===A)Object.assign(l,{opacity:0}),Object.assign(u,{opacity:null!==(n=nJ(i,"opacity"))&&void 0!==n?n:nm("opacity")});else if("hide"===A)Object.assign(l,{opacity:null!==(r=nJ(i,"opacity"))&&void 0!==r?r:nm("opacity")}),Object.assign(u,{opacity:0});else if("collapse"===A){const{collapse:t}=e||{},{target:n,descendants:r,position:A}=t;if("node"===o){if(r.includes(i.id)){const[t,e,n]=A;Object.assign(u,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e]=A;Object.assign(u,{x:t,y:e,childrenNode:s.childrenNode})}}else"edge"===o&&Object.assign(u,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if("expand"===A){const{expand:t}=e||{},{target:n,descendants:r,position:A}=t;if("node"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=A;Object.assign(l,{x:t,y:e,z:n})}}else if("combo"===o){if(i.id===n||r.includes(i.id)){const[t,e,n]=A;Object.assign(l,{x:t,y:e,z:n,childrenNode:c.childrenNode})}}else"edge"===o&&Object.assign(l,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(l).length>0?Object.assign({},s,l):s,Object.keys(u).length>0?Object.assign({},c,u):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,r=null===(e=null===(t=n.document)||void 0===t?void 0:t.timeline)||void 0===e?void 0:e.animationsWithPromises;r&&(n.document.timeline.animationsWithPromises=r.filter(t=>"finished"!==t.playState))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class iJ{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(e=!0){this.batchCount++,1===this.batchCount&&this.emit(new YZ(t.GraphEvent.BATCH_START,{initiate:e}))}endBatch(){this.batchCount--,0===this.batchCount&&this.emit(new YZ(t.GraphEvent.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class oJ extends ny{constructor(e){super(e),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,r=function(t){if(!t)return null;if(t instanceof hc)return{type:"canvas",element:t};let e=t;for(;e;){if(RB(e))return{type:"node",element:e};if(HB(e))return{type:"edge",element:e};if(_B(e))return{type:"combo",element:e};e=e.parentElement}return null}(n);if(!r)return;const{graph:i,canvas:o}=this.context,{type:A,element:s}=r;if("destroyed"in s&&(eE(s)||s.destroyed))return;const{type:a,detail:c,button:l}=e,u=Object.assign(Object.assign({},e),{target:s,targetType:A,originalTarget:n});a===t.CommonEvent.POINTER_MOVE&&(this.currentTarget!==s&&(this.currentTarget&&i.emit(`${this.currentTargetType}:${t.CommonEvent.POINTER_LEAVE}`,Object.assign(Object.assign({},u),{type:t.CommonEvent.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),s&&(Object.assign(u,{type:t.CommonEvent.POINTER_ENTER}),i.emit(`${A}:${t.CommonEvent.POINTER_ENTER}`,u))),this.currentTarget=s,this.currentTargetType=A),a===t.CommonEvent.CLICK&&2===l||(i.emit(`${A}:${a}`,u),i.emit(a,u)),a===t.CommonEvent.CLICK&&2===c&&(Object.assign(u,{type:t.CommonEvent.DBLCLICK}),i.emit(`${A}:${t.CommonEvent.DBLCLICK}`,u),i.emit(t.CommonEvent.DBLCLICK,u)),a===t.CommonEvent.POINTER_DOWN&&2===l&&(Object.assign(u,{type:t.CommonEvent.CONTEXT_MENU,preventDefault:()=>{var e;null===(e=o.getContainer())||void 0===e||e.addEventListener(t.CommonEvent.CONTEXT_MENU,t=>t.preventDefault(),{once:!0})}}),i.emit(`${A}:${t.CommonEvent.CONTEXT_MENU}`,u),i.emit(t.CommonEvent.CONTEXT_MENU,u))},this.forwardContainerEvents=t=>{this.context.graph.emit(t.type,t)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach(t=>{e.addEventListener(t,this.forwardContainerEvents)});const n=this.context.canvas.document;n&&[t.CommonEvent.CLICK,t.CommonEvent.DBLCLICK,t.CommonEvent.POINTER_OVER,t.CommonEvent.POINTER_LEAVE,t.CommonEvent.POINTER_ENTER,t.CommonEvent.POINTER_MOVE,t.CommonEvent.POINTER_OUT,t.CommonEvent.POINTER_DOWN,t.CommonEvent.POINTER_UP,t.CommonEvent.CONTEXT_MENU,t.CommonEvent.DRAG_START,t.CommonEvent.DRAG,t.CommonEvent.DRAG_END,t.CommonEvent.DRAG_ENTER,t.CommonEvent.DRAG_OVER,t.CommonEvent.DRAG_LEAVE,t.CommonEvent.DROP,t.CommonEvent.WHEEL].forEach(t=>{n.addEventListener(t,this.forwardCanvasEvents)})}destroy(){const e=this.context.canvas.getContainer();e&&[t.ContainerEvent.KEY_DOWN,t.ContainerEvent.KEY_UP].forEach(t=>{e.removeEventListener(t,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function AJ(t){const{id:e=Km(t),style:n,data:r}=t,i=Pe(t,["id","style","data"]),o=Object.assign(Object.assign({},t),{style:Object.assign({},n),data:Object.assign({},r)});return function(t){return"source"in t&&"target"in t}(t)?Object.assign({id:e,data:o},i):{id:e,data:o}}function sJ(t){return t.data}class aJ{constructor(){this.latestRemovedComboIds=new Set,this.comboIds=new Set,this.changes=[],this.batchCount=0,this.isTraceless=!1,this.enableUpdateNodeLikeHierarchy=!0,this.model=new vE}pushChange(t){if(this.isTraceless)return;const{type:e}=t;if(e===Lv.NodeUpdated||e===Lv.EdgeUpdated||e===Lv.ComboUpdated){const{value:n,original:r}=t;this.changes.push({value:iE(n),original:iE(r),type:e})}else this.changes.push({value:iE(t.value),type:e})}getChanges(){return this.changes}clearChanges(){this.changes=[]}batch(t){this.batchCount++,this.model.batch(t),this.batchCount--}isBatching(){return this.batchCount>0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const r=sJ(n);return this.isCombo(Km(r))||(void 0===t||t.includes(Km(r)))&&e.push(r),e},[])}getEdgeDatum(t){return sJ(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const r=sJ(n);return(void 0===t||t.includes(Km(r)))&&e.push(r),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const r=sJ(n);return this.isCombo(Km(r))?((void 0===t||t.includes(Km(r)))&&e.push(r),e):e},[])}getRootsData(t=Vv){return this.model.getRoots(t).map(sJ)}getAncestorsData(t,e){const{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getAncestors(t,e).map(sJ):[]}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Zy(e,t=>{t!==e&&n.push(t)},t=>this.getChildrenData(Km(t)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e)return void Zv("The hierarchy structure key is not specified");if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const r=n.getParent(t,e);return r?sJ(r):void 0}getChildrenData(t){const e="node"===this.getElementType(t)?Vv:zv,{model:n}=this;return n.hasNode(t)&&n.hasTreeStructure(e)?n.getChildren(t,e).map(sJ):[]}getElementsDataByType(t){return"node"===t?this.getNodeData():"edge"===t?this.getEdgeData():"combo"===t?this.getComboData():[]}getElementDataById(t){return"edge"===this.getElementType(t)?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){return sJ(this.model.getNode(t))}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const r=sJ(n);return t?t.includes(Km(r))&&e.push(r):e.push(r),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(t=>{var n;return null===(n=t.states)||void 0===n?void 0:n.includes(e)})}getElementState(t){var e;return(null===(e=this.getElementDataById(t))||void 0===e?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(sJ)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(sJ)}setData(t){const{nodes:e=[],edges:n=[],combos:r=[]}=t,{nodes:i,edges:o,combos:A}=this.getData(),s=ty(i,e,t=>Km(t),oE),a=ty(o,n,t=>Km(t),oE),c=ty(A,r,t=>Km(t),oE);this.batch(()=>{const t={nodes:s.enter,edges:a.enter,combos:c.enter};this.addData(t),this.computeZIndex(t,"add",!0);const e={nodes:s.update,edges:a.update,combos:c.update};this.updateData(e),this.computeZIndex(e,"update",!0);const n={nodes:s.exit.map(Km),edges:a.exit.map(Km),combos:c.exit.map(Km)};this.removeData(n)})}addData(t){const{nodes:e,edges:n,combos:r}=t;this.batch(()=>{this.addComboData(r),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(t=>(this.pushChange({value:t,type:Lv.NodeAdded}),AJ(t)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(t=>(this.pushChange({value:t,type:Lv.EdgeAdded}),AJ(t)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(zv)||e.attachTreeStructure(zv),e.addNodes(t.map(t=>(this.comboIds.add(Km(t)),this.pushChange({value:t,type:Lv.ComboAdded}),AJ(t)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),r=e.map(Km);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...r]}]),this.addEdgeData(r.map(e=>({source:t,target:e})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:n=[],edges:r=[],combos:i=[]}=t;i.forEach(t=>{var n,r,i;const o=Km(t);if("add"===e&&re(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t))return;const A=this.getParentData(o,zv),s=A?(null!==(i=null===(r=A.style)||void 0===r?void 0:r.zIndex)&&void 0!==i?i:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:o,style:{zIndex:s}}])})}),n.forEach(t=>{var n,r,i;const o=Km(t);if("add"===e&&re(null===(n=t.style)||void 0===n?void 0:n.zIndex))return;if("update"===e&&!("combo"in t)&&!("children"in t))return;let A=0;const s=this.getParentData(o,zv);if(s)A=((null===(r=s.style)||void 0===r?void 0:r.zIndex)||0)+1;else{const t=this.getParentData(o,Vv);t&&(A=(null===(i=null==t?void 0:t.style)||void 0===i?void 0:i.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:o,style:{zIndex:A}}])})}),r.forEach(t=>{var e,n,r,i,o;if(re(null===(e=t.style)||void 0===e?void 0:e.zIndex))return;let{id:A,source:s,target:a}=t;if(A){const t=this.getEdgeDatum(A);s=t.source,a=t.target}else A=Km(t);if(!s||!a)return;const c=(null===(r=null===(n=this.getNodeLikeDatum(s))||void 0===n?void 0:n.style)||void 0===r?void 0:r.zIndex)||0,l=(null===(o=null===(i=this.getNodeLikeDatum(a))||void 0===i?void 0:i.style)||void 0===o?void 0:o.zIndex)||0;this.updateEdgeData([{id:Km(t),style:{zIndex:Math.max(c,l)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),r=this.getElementDataById(t),i=this.getData();if(Object.assign(i,{[`${n}s`]:i[`${n}s`].filter(e=>Km(e)!==t)}),"combo"===n&&!rw(r)){const e=new Set(this.getAncestorsData(t,zv).map(Km));i.nodes=i.nodes.filter(t=>!e.has(Km(t))),i.combos=i.combos.filter(t=>!e.has(Km(t))),i.edges=i.edges.filter(({source:t,target:n})=>!e.has(t)&&!e.has(n))}return Math.max((null===(e=r.style)||void 0===e?void 0:e.zIndex)||0,0,...Object.values(i).flat().map(t=>{var e;return((null===(e=null==t?void 0:t.style)||void 0===e?void 0:e.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(t=>{const n=Km(t),r=jm(t);void 0!==r&&(e.hasTreeStructure(zv)||e.attachTreeStructure(zv),null===r&&this.refreshComboData(n),this.setParent(n,jm(t),zv));const i=t.children||[];if(i.length){e.hasTreeStructure(Vv)||e.attachTreeStructure(Vv);const t=i.filter(t=>e.hasNode(t));t.forEach(t=>this.setParent(t,n,Vv)),t.length!==i.length&&this.updateNodeData([{id:n,children:t}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:r}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(r),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(t=>{const r=Km(t),i=sJ(e.getNode(r));if(oE(i,t))return;const o=rE(i,t);this.pushChange({value:o,original:i,type:Lv.NodeUpdated}),e.mergeNodeData(r,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(t=>{this.pushChange({value:t,original:t,type:Lv.NodeUpdated})}),e.forEach(t=>{this.pushChange({value:t,original:t,type:Lv.EdgeUpdated})}),n.forEach(t=>{this.pushChange({value:t,original:t,type:Lv.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=Km(t);if(!e.hasNode(n))return;const r=rE(sJ(e.getNode(n)),t);e.mergeNodeData(n,r)}syncEdgeDatum(t){const{model:e}=this,n=Km(t);if(!e.hasEdge(n))return;const r=rE(sJ(e.getEdge(n)),t);e.mergeEdgeData(n,r)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(t=>{const n=Km(t),r=sJ(e.getEdge(n));if(oE(r,t))return;t.source&&r.source!==t.source&&e.updateEdgeSource(n,t.source),t.target&&r.target!==t.target&&e.updateEdgeTarget(n,t.target);const i=rE(r,t);this.pushChange({value:i,original:r,type:Lv.EdgeUpdated}),e.mergeEdgeData(n,i)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(t=>{const r=Km(t),i=sJ(e.getNode(r));if(oE(i,t))return;const o=rE(i,t);this.pushChange({value:o,original:i,type:Lv.ComboUpdated}),e.mergeNodeData(r,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,r=!0){if(t===e)return;const i=jm(this.getNodeLikeDatum(t));if(i!==e&&n===zv){const n={id:t,combo:e};this.isCombo(t),this.syncNodeLikeDatum(n)}this.model.setParent(t,e,n),r&&n===zv&&function(t,e){void 0===e&&(e=new Map);var n=[];if(Array.isArray(t))for(var r=0,i=t.length;r<i;r++){var o=t[r];e.has(o)||(n.push(o),e.set(o,!0))}return n}([i,e]).forEach(t=>{void 0!==t&&this.refreshComboData(t)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,zv);e&&this.pushChange({value:e,original:e,type:Lv.ComboUpdated}),n.forEach(t=>{this.pushChange({value:t,original:t,type:Lv.ComboUpdated})})}getElementPosition(t){return My(this.getElementDataById(t))}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=ay(this.getElementPosition(t),[...e,0].slice(0,3));this.translateNodeTo(t,n)}translateNodeTo(t,e){const[n=0,r=0,i=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:r,z:i}}])})}translateComboBy(t,e){const[n=0,r=0,i=0]=e;if([n,r,i].some(isNaN)||[n,r,i].every(t=>0===t))return;const o=this.getComboData([t])[0];if(!o)return;const A=new Set;Zy(o,t=>{const e=Km(t);if(A.has(e))return;A.add(e);const[o,s,a]=My(t),c=rE(t,{style:{x:o+n,y:s+r,z:a+i}});this.pushChange({value:c,original:t,type:this.isCombo(e)?Lv.ComboUpdated:Lv.NodeUpdated}),this.model.mergeNodeData(e,c)},t=>this.getChildrenData(Km(t)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[r=0,i=0,o=0]=e,A=null===(n=this.getComboData([t]))||void 0===n?void 0:n[0];if(!A)return;const[s,a,c]=My(A),l=r-s,u=i-a,h=o-c;Zy(A,t=>{const e=Km(t),[n,r,i]=My(t),o=rE(t,{style:{x:n+l,y:r+u,z:i+h}});this.pushChange({value:o,original:t,type:this.isCombo(e)?Lv.ComboUpdated:Lv.NodeUpdated}),this.model.mergeNodeData(e,o)},t=>this.getChildrenData(Km(t)),"BT")}removeData(t){const{nodes:e,edges:n,combos:r}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(r),this.latestRemovedComboIds=new Set(r)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(t=>{this.removeEdgeData(this.getRelatedEdgesData(t).map(Km)),this.pushChange({value:this.getNodeData([t])[0],type:Lv.NodeRemoved}),this.removeNodeLikeHierarchy(t)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(t=>this.pushChange({value:this.getEdgeData([t])[0],type:Lv.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(t=>{this.pushChange({value:this.getComboData([t])[0],type:Lv.ComboRemoved}),this.removeNodeLikeHierarchy(t),this.comboIds.delete(t)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(zv)){const e=jm(this.getNodeLikeDatum(t));this.setParent(t,void 0,zv,!1),this.model.getChildren(t,zv).forEach(t=>{const n=sJ(t),r=Km(n);this.setParent(Km(n),e,zv,!1);const i=rE(n,{id:Km(n),combo:e});this.pushChange({value:i,original:n,type:this.isCombo(r)?Lv.ComboUpdated:Lv.NodeUpdated}),this.model.mergeNodeData(Km(n),i)}),Kt(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error($v(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(t=>t.id)),t.removeNodes(e.map(t=>t.id)),this.context={}}}class cJ{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new Xa({className:"elements"}))}}emit(t,e){e.silence||ZZ(this.context.graph,t)}forEachElementData(t){$y.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:r,graph:i}=this.context,o=sE(e)&&(null===(n=r[t])||void 0===n?void 0:n.type)||e.type;return o?"string"==typeof o?o:o.call(i,e):"edge"===t?"line":"circle"}getTheme(t){return Jv(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map(t=>n[t]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var r,i;const o=Object.assign({},hw(null===(r=this.getTheme(e))||void 0===r?void 0:r.palette),hw(null===(i=t[e])||void 0===i?void 0:i.palette));(null==o?void 0:o.field)&&Object.assign(this.paletteStyle,function(t,e){if(!e)return{};const{type:n,color:r,field:i,invert:o}=e,A=t=>{const e="string"==typeof r?Xv("palette",r):r;if("function"==typeof e){const n={};return t.forEach(([t,r])=>{n[t]=e(o?1-r:r)}),n}if(Array.isArray(e)){const n=o?[...e].reverse():e,r={};return t.forEach(([t,i])=>{r[t]=n[i%e.length]}),r}return{}},s=(t,e)=>{var n;return"string"==typeof t?null===(n=e.data)||void 0===n?void 0:n[t]:null==t?void 0:t(e)};if("group"===n){const e=ee(t,t=>{if(!i)return"default";const e=s(i,t);return e?String(e):"default"}),n=A(Object.keys(e).map((t,e)=>[t,e])),r={};return Object.entries(e).forEach(([t,e])=>{e.forEach(e=>{r[Km(e)]=n[t]})}),r}if("value"===n){const[e,n]=t.reduce(([t,e],n)=>{const r=s(i,n);if("number"!=typeof r)throw new Error($v(`Palette field ${i} is not a number`));return[Math.min(t,r),Math.max(e,r)]},[1/0,-1/0]),r=n-e;return A(t.map(t=>[t.id,(s(i,t)-e)/r]))}}(n,o))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?"edge"===t?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:r}=this.context,i=(null===(n=r[t])||void 0===n?void 0:n.style)||{};"transform"in i&&Array.isArray(i.transform)&&(i.transform=[...i.transform]),this.defaultStyle[Km(e.datum)]=lw(i,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];(void 0===t||t.includes(Km(i)))&&this.computeElementDefaultStyle(n,{datum:i,graph:e})}})}getDefaultStyle(t){return this.defaultStyle[t]||{}}getElementState(t){try{const{model:e}=this.context;return e.getElementState(t)}catch(t){return[]}}getElementStateStyle(t,e,n){var r,i;const{options:o}=this.context;return lw((null===(i=null===(r=o[t])||void 0===r?void 0:r.state)||void 0===i?void 0:i[e])||{},n)}computeElementStatesStyle(t,e,n){this.stateStyle[Km(n.datum)]=Object.assign({},...e.map(e=>this.getElementStateStyle(t,e,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,r)=>{const i=r.length;for(let o=0;o<i;o++){const i=r[o];if(void 0===t||t.includes(Km(i))){const t=this.getElementState(Km(i));this.computeElementStatesStyle(n,t,{datum:i,graph:e})}}})}getStateStyle(t){return this.stateStyle[t]||{}}computeStyle(t,e){t&&["translate","zIndex"].includes(t)||(this.computePaletteStyle(),this.computeElementsDefaultStyle(e),this.computeElementsStatesStyle(e))}getElement(t){return this.elementMap[t]}getNodes(){return this.context.model.getNodeData().map(({id:t})=>this.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[Km(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=Km(e),r=this.getThemeStyle(t),i=this.getPaletteStyle(t,n),o=e.style||{},A=this.getDefaultStyle(n),s=this.getThemeStateStyle(t,this.getElementState(n)),a=this.getStateStyle(n),c=sE(e)?Object.assign({},r,i,o,A,s,a):Object.assign({},o);if("combo"===t){const t=this.context.model.getChildrenData(n),e=!!c.collapsed?[]:t.map(Km).filter(t=>this.getElement(t));Object.assign(c,{childrenNode:e,childrenData:t})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:r=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(r),{type:n,stage:r,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:r,remove:i}}}=e;return this.destroyElements(i,t),this.createElements(n,t),this.updateElements(r,t),this.setAnimationTask(t,e)}preLayoutDraw(){return De(this,arguments,void 0,function*(t={animation:!0}){var e,n;const r=this.getDrawData(t);if(!r)return;const{data:{drawData:i}}=r;yield null===(n=null===(e=this.context.layout)||void 0===e?void 0:e.preLayout)||void 0===n?void 0:n.call(e,i);const{add:o,update:A,remove:s}=i;return this.destroyElements(s,t),this.createElements(o,t),this.updateElements(A,t),this.setAnimationTask(t,r)})}setAnimationTask(e,n){const{animation:r,silence:i}=e,{data:{dataChanges:o,drawData:A},stage:s,type:a}=n;return this.context.animation.animate(r,i?{}:{before:()=>this.emit(new YZ(t.GraphEvent.BEFORE_DRAW,{dataChanges:o,animation:r,stage:s,render:"render"===a}),e),beforeAnimate:n=>this.emit(new XZ(t.GraphEvent.BEFORE_ANIMATE,Pv.DRAW,n,A),e),afterAnimate:n=>this.emit(new XZ(t.GraphEvent.AFTER_ANIMATE,Pv.DRAW,n,A),e),after:()=>this.emit(new YZ(t.GraphEvent.AFTER_DRAW,{dataChanges:o,animation:r,stage:s,render:"render"===a,firstRender:!1===this.context.graph.rendered}),e)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),r=iV(n);if(0===r.length)return null;const{NodeAdded:i=[],NodeUpdated:o=[],NodeRemoved:A=[],EdgeAdded:s=[],EdgeUpdated:a=[],EdgeRemoved:c=[],ComboAdded:l=[],ComboUpdated:u=[],ComboRemoved:h=[]}=ee(r,t=>t.type),d=(t,e)=>{const n=[];return t.forEach(t=>{const r=Km(t.value);this.getElement(r)?n.push(t):e.push(t)}),n},f=d(o,i),g=d(a,s),p=d(u,l),v=t=>new Map(t.map(t=>{const e=t.value;return[Km(e),e]})),m={add:{nodes:v(i),edges:v(s),combos:v(l)},update:{nodes:v(f),edges:v(g),combos:v(p)},remove:{nodes:v(A),edges:v(c),combos:v(h)}},y=this.transformData(m,t);return e.clearChanges(),{dataChanges:n,drawData:y}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((t,n)=>n.beforeDraw(t,e),t)}createElement(e,n,r){var i;const o=Km(n);if(this.getElement(o))return;const A=this.getElementType(e,n),s=this.getElementComputedStyle(e,n),a=Xv(e,A);if(!a)return Zv(`The element ${A} of ${e} is not registered.`);this.emit(new qZ(t.GraphEvent.BEFORE_ELEMENT_CREATE,e,n),r);const c=this.container.appendChild(new a({id:o,context:this.context,style:s}));this.shapeTypeMap[o]=A,this.elementMap[o]=c;const{stage:l="enter"}=r;null===(i=this.context.animation)||void 0===i||i.add({element:c,elementType:e,stage:l,originalStyle:Object.assign({},c.attributes),updatedStyle:s},{after:()=>{var i;this.emit(new qZ(t.GraphEvent.AFTER_ELEMENT_CREATE,e,n),r),null===(i=c.onCreate)||void 0===i||i.call(c)}})}createElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach(([t,n])=>{n.forEach(n=>this.createElement(t,n,e))})}getUpdateStageStyle(t,e,n){const{stage:r="update"}=n;if("translate"===r){if("node"===t||"combo"===t){const{style:{x:t=0,y:n=0,z:r=0}={}}=e;return{x:t,y:n,z:r}}return{}}return this.getElementComputedStyle(t,e)}updateElement(e,n,r){var i;const o=Km(n),{stage:A="update"}=r,s=this.getElement(o);if(!s)return()=>null;this.emit(new qZ(t.GraphEvent.BEFORE_ELEMENT_UPDATE,e,n),r);const a=this.getElementType(e,n),c=this.getUpdateStageStyle(e,n,r);this.shapeTypeMap[o]!==a&&(s.destroy(),delete this.shapeTypeMap[o],delete this.elementMap[o],this.createElement(e,n,{animation:!1,silence:!0}));const l="visibility"!==A?A:"hidden"===c.visibility?"hide":"show";"hide"===l&&delete c.visibility,null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:l,originalStyle:Object.assign({},s.attributes),updatedStyle:c},{before:()=>{const t=this.elementMap[o];"collapse"!==A&&tE(t,c),"visibility"===A&&(function(t,e){return eJ(e)in(Ce(t,tJ)||{})}(t,"opacity")||function(t,e){const n=Array.isArray(e)?e:[e];Ce(t,tJ)||Me(t,tJ,{}),n.forEach(e=>{Me(Ce(t,tJ),eJ(e),t.attributes[e])})}(t,"opacity"),this.visibilityCache.set(t,"show"===l?"visible":"hidden"),"show"===l&&ey(t,"visible"))},after:()=>{var i;const s=this.elementMap[o];"collapse"===A&&tE(s,c),"hide"===l&&ey(s,this.visibilityCache.get(s)),this.emit(new qZ(t.GraphEvent.AFTER_ELEMENT_UPDATE,e,n),r),null===(i=s.onUpdate)||void 0===i||i.call(s)}})}updateElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["node",n],["combo",i],["edge",r]].forEach(([t,n])=>{n.forEach(n=>this.updateElement(t,n,e))})}markDestroyElement(t){Object.values(t.remove).forEach(t=>{t.forEach(t=>{const e=Km(t),n=this.getElement(e);n&&function(t){Me(t,"__to_be_destroyed__",!0)}(n)})})}destroyElement(e,n,r){var i;const{stage:o="exit"}=r,A=Km(n),s=this.elementMap[A];if(!s)return()=>null;this.emit(new qZ(t.GraphEvent.BEFORE_ELEMENT_DESTROY,e,n),r),null===(i=this.context.animation)||void 0===i||i.add({element:s,elementType:e,stage:o,originalStyle:Object.assign({},s.attributes),updatedStyle:{}},{after:()=>{var i;this.clearElement(A),s.destroy(),null===(i=s.onDestroy)||void 0===i||i.call(s),this.emit(new qZ(t.GraphEvent.AFTER_ELEMENT_DESTROY,e,n),r)}})}destroyElements(t,e){const{nodes:n,edges:r,combos:i}=t;[["combo",i],["edge",r],["node",n]].forEach(([t,n])=>{n.forEach(n=>this.destroyElement(t,n,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,r;const i=null===(n=t.nodes)||void 0===n?void 0:n.find(t=>Km(t)===e);if(i){const n=cy(My(this.context.model.getNodeLikeDatum(e)),My(i));null===(r=t.nodes)||void 0===r||r.forEach(t=>{var e,r,i;(null===(e=t.style)||void 0===e?void 0:e.x)&&(t.style.x+=n[0]),(null===(r=t.style)||void 0===r?void 0:r.y)&&(t.style.y+=n[1]),(null===(i=t.style)||void 0===i?void 0:i.z)&&(t.style.z+=n[2]||0)})}}syncLayoutResult(t,e){return De(this,void 0,void 0,function*(){const{layout:n,model:r}=this.context;if(!n)return;const i=this.context.options.layout,o=yield n.simulate(i?(A=i,Array.isArray(A)?A.map(t=>Object.assign(Object.assign({},t),{preLayout:!0})):Object.assign(Object.assign({},A),{preLayout:!0})):void 0);var A;e&&this.alignLayoutResultToElement(o,t),r.updateData(o)})}collapseNode(e,n){return De(this,void 0,void 0,function*(){var r;const{animation:i,align:o}=n;yield this.syncLayoutResult(e,o);const A=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(this.context.animation.clear(),this.computeStyle("collapse"),!A)return;const{drawData:s}=A,{add:a,remove:c,update:l}=s;this.markDestroyElement(s);const u={animation:i,stage:"collapse",data:s};this.destroyElements(c,u),this.createElements(a,u),this.updateElements(l,u),yield null===(r=this.context.animation.animate(i,{beforeAnimate:e=>this.emit(new XZ(t.GraphEvent.BEFORE_ANIMATE,Pv.COLLAPSE,e,s),u),afterAnimate:e=>this.emit(new XZ(t.GraphEvent.AFTER_ANIMATE,Pv.COLLAPSE,e,s),u)},{collapse:{target:e,descendants:Array.from(c.nodes).map(([,t])=>Km(t)),position:My(l.nodes.get(e))}}))||void 0===r?void 0:r.finished})}expandNode(e,n){return De(this,void 0,void 0,function*(){var r;const{model:i}=this.context,{animation:o,align:A}=n,s=My(i.getNodeData([e])[0]);yield this.syncLayoutResult(e,A);const a=this.computeChangesAndDrawData({stage:"expand",animation:o});if(this.createElements(a.drawData.add,{animation:!1,stage:"expand",target:e}),this.context.animation.clear(),this.computeStyle("expand"),!a)return;const{drawData:c}=a,{update:l,add:u}=c,h={animation:o,stage:"expand",data:c};u.edges.forEach(t=>l.edges.set(Km(t),t)),u.nodes.forEach(t=>l.nodes.set(Km(t),t)),this.updateElements(l,h),yield null===(r=this.context.animation.animate(o,{beforeAnimate:e=>this.emit(new XZ(t.GraphEvent.BEFORE_ANIMATE,Pv.EXPAND,e,c),h),afterAnimate:e=>this.emit(new XZ(t.GraphEvent.AFTER_ANIMATE,Pv.EXPAND,e,c),h)},{expand:{target:e,descendants:Array.from(u.nodes).map(([,t])=>Km(t)),position:s}}))||void 0===r?void 0:r.finished})}collapseCombo(e,n){return De(this,void 0,void 0,function*(){var r;const{model:i,element:o}=this.context;if(i.getAncestorsData(e,zv).some(t=>rw(t)))return;const A=o.getElement(e),s=A.getComboPosition(Object.assign(Object.assign({},A.attributes),{collapsed:!0})),a=this.computeChangesAndDrawData({stage:"collapse",animation:n});if(!a)return;const{dataChanges:c,drawData:l}=a;this.markDestroyElement(l);const{update:u,remove:h}=l,d={animation:n,stage:"collapse",data:l};this.destroyElements(h,d),this.updateElements(u,d);const f=t=>Array.from(t).map(([,t])=>Km(t));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new YZ(t.GraphEvent.BEFORE_DRAW,{dataChanges:c,animation:n}),d),beforeAnimate:e=>this.emit(new XZ(t.GraphEvent.BEFORE_ANIMATE,Pv.COLLAPSE,e,l),d),afterAnimate:e=>this.emit(new XZ(t.GraphEvent.AFTER_ANIMATE,Pv.COLLAPSE,e,l),d),after:()=>this.emit(new YZ(t.GraphEvent.AFTER_DRAW,{dataChanges:c,animation:n}),d)},{collapse:{target:e,descendants:[...f(h.nodes),...f(h.combos)],position:s}}))||void 0===r?void 0:r.finished})}expandCombo(e,n){return De(this,void 0,void 0,function*(){var r;const{model:i}=this.context,o=My(i.getComboData([e])[0]);this.computeStyle("expand");const A=this.computeChangesAndDrawData({stage:"expand",animation:n});if(!A)return;const{dataChanges:s,drawData:a}=A,{add:c,update:l}=a,u={animation:n,stage:"expand",data:a,target:e};this.createElements(c,u),this.updateElements(l,u);const h=t=>Array.from(t).map(([,t])=>Km(t));yield null===(r=this.context.animation.animate(n,{before:()=>this.emit(new YZ(t.GraphEvent.BEFORE_DRAW,{dataChanges:s,animation:n}),u),beforeAnimate:e=>this.emit(new XZ(t.GraphEvent.BEFORE_ANIMATE,Pv.EXPAND,e,a),u),afterAnimate:e=>this.emit(new XZ(t.GraphEvent.AFTER_ANIMATE,Pv.EXPAND,e,a),u),after:()=>this.emit(new YZ(t.GraphEvent.AFTER_DRAW,{dataChanges:s,animation:n}),u)},{expand:{target:e,descendants:[...h(c.nodes),...h(c.combos)],position:o}}))||void 0===r?void 0:r.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}class lJ{get presetOptions(){return{animation:!!rm(this.context.options,!0)}}get options(){const{options:t}=this.context;return t.layout}constructor(t){this.instances=[],this.context=t}getLayoutInstance(){return this.instances}preLayout(e){return De(this,void 0,void 0,function*(){var n,r,i,o;const{graph:A,model:s}=this.context,{add:a}=e;ZZ(A,new YZ(t.GraphEvent.BEFORE_LAYOUT,{type:"pre"}));const c=yield null===(n=this.context.layout)||void 0===n?void 0:n.simulate();null===(r=null==c?void 0:c.nodes)||void 0===r||r.forEach(t=>{const e=Km(t),n=a.nodes.get(e);s.syncNodeLikeDatum(t),n&&Object.assign(n.style,t.style)}),null===(i=null==c?void 0:c.edges)||void 0===i||i.forEach(t=>{const e=Km(t),n=a.edges.get(e);s.syncEdgeDatum(t),n&&Object.assign(n.style,t.style)}),null===(o=null==c?void 0:c.combos)||void 0===o||o.forEach(t=>{const e=Km(t),n=a.combos.get(e);s.syncNodeLikeDatum(t),n&&Object.assign(n.style,t.style)}),ZZ(A,new YZ(t.GraphEvent.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",e)})}postLayout(){return De(this,arguments,void 0,function*(e=this.options){if(!e)return;const n=Array.isArray(e)?e:[e],{graph:r}=this.context;ZZ(r,new YZ(t.GraphEvent.BEFORE_LAYOUT,{type:"post"}));for(let e=0;e<n.length;e++){const i=n[e],o=this.getLayoutData(i),A=Object.assign(Object.assign({},this.presetOptions),i);ZZ(r,new YZ(t.GraphEvent.BEFORE_STAGE_LAYOUT,{options:A,index:e}));const s=yield this.stepLayout(o,A,e);ZZ(r,new YZ(t.GraphEvent.AFTER_STAGE_LAYOUT,{options:A,index:e})),i.animation||this.updateElementPosition(s,!1)}ZZ(r,new YZ(t.GraphEvent.AFTER_LAYOUT,{type:"post"})),this.transformDataAfterLayout("post")})}transformDataAfterLayout(t,e){const n=this.context.transform.getTransformInstance();Object.values(n).forEach(n=>n.afterLayout(t,e))}simulate(){return De(this,arguments,void 0,function*(t=this.options){if(!t)return{};const e=Array.isArray(t)?t:[t];let n={};for(let t=0;t<e.length;t++){const r=e[t],i=this.getLayoutData(r);n=yield this.stepLayout(i,Object.assign(Object.assign(Object.assign({},this.presetOptions),r),{animation:!1}),t)}return n})}stepLayout(t,e,n){return De(this,void 0,void 0,function*(){return function(t){const{type:e}=t;return["compact-box","mindmap","dendrogram","indented"].includes(e)}(e)?yield this.treeLayout(t,e,n):yield this.graphLayout(t,e,n)})}graphLayout(t,e,n){return De(this,void 0,void 0,function*(){const{animation:r,iterations:i=300}=e,o=this.initGraphLayout(e);if(!o)return{};if(this.instances[n]=o,this.instance=o,CC(o))return r?yield o.execute(t,{animate:!0,maxIteration:i,onTick:t=>this.updateElementPosition(t,!1)}):(o.execute(t),o.stop(),o.tick(i));const A=yield o.execute(t);if(r){const t=this.updateElementPosition(A,r);yield null==t?void 0:t.finished}return A})}treeLayout(t,e,n){return De(this,void 0,void 0,function*(){const{type:n,animation:r}=e,i=Xv("layout",n);if(!i)return{};const{nodes:o=[],edges:A=[]}=t,s=new vE({nodes:o.map(t=>({id:Km(t),data:t.data||{}})),edges:A.map(t=>({id:Km(t),source:t.source,target:t.target,data:t.data||{}}))});!function(t){if(t.hasTreeStructure(Vv))return;t.attachTreeStructure(Vv);const e=t.getAllEdges();for(const n of e){const{source:e,target:r}=n;t.setParent(r,e,Vv)}}(s);const a={nodes:[],edges:[]},c={nodes:[],edges:[]};s.getRoots(Vv).forEach(t=>{Zy(t,t=>{t.children=s.getSuccessors(t.id)},t=>s.getSuccessors(t.id),"TB");const n=i(t,e),{x:r,y:o,z:A=0}=n;Zy(n,t=>{const{id:e,x:n,y:i,z:s=0}=t;a.nodes.push({id:e,style:{x:r,y:o,z:A}}),c.nodes.push({id:e,style:{x:n,y:i,z:s}})},t=>t.children,"TB")});const l=this.inferTreeLayoutOffset(c);if(uJ(c,l),r){uJ(a,l),this.updateElementPosition(a,!1);const t=this.updateElementPosition(c,r);yield null==t?void 0:t.finished}return c})}inferTreeLayoutOffset(t){var e;let[n,r]=[1/0,-1/0],[i,o]=[1/0,-1/0];null===(e=t.nodes)||void 0===e||e.forEach(t=>{const{x:e=0,y:A=0}=t.style||{};n=Math.min(n,e),r=Math.max(r,e),i=Math.min(i,A),o=Math.max(o,A)});const{canvas:A}=this.context,s=A.getSize(),[a,c]=A.getCanvasByViewport([0,0]),[l,u]=A.getCanvasByViewport(s);if(n>=a&&r<=l&&i>=c&&o<=u)return[0,0];return[(a+l)/2-(n+r)/2,(c+u)/2-(i+o)/2]}stopLayout(){this.instance&&CC(this.instance)&&(this.instance.stop(),this.instance=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,comboFilter:n=()=>!0,preLayout:r=!1,isLayoutInvisibleNodes:i=!1}=t,{nodes:o,edges:A,combos:s}=this.context.model.getData(),{element:a,model:c}=this.context,l=t=>a.getElement(t),u=r?t=>{var n;if(!i){if("hidden"===(null===(n=t.style)||void 0===n?void 0:n.visibility))return!1;if(c.getAncestorsData(t.id,Vv).some(rw))return!1;if(c.getAncestorsData(t.id,zv).some(rw))return!1}return e(t)}:t=>{const n=Km(t),r=l(n);return!!r&&(!eE(r)&&e(t))},h=o.filter(u),d=s.filter(n),f=new Map(h.map(t=>[Km(t),t]));d.forEach(t=>f.set(Km(t),t));return{nodes:h,edges:A.filter(({source:t,target:e})=>f.has(t)&&f.has(e)),combos:d}}initGraphLayout(t){var e;const{element:n,viewport:r}=this.context,{type:i,animation:o,iterations:A}=t,s=Pe(t,["type","animation","iterations"]),[a,c]=r.getCanvasSize(),l=[a/2,c/2],u=null!==(e=null==t?void 0:t.nodeSize)&&void 0!==e?e:t=>{const e=null==n?void 0:n.getElement(t.id);return e?e.attributes.size:null==n?void 0:n.getElementComputedStyle("node",t).size},h=Xv("layout",i);if(!h)return Zv(`The layout of ${i} is not registered.`);const d=Object.getPrototypeOf(h.prototype)===mE.prototype?h:function(t){return!("forEachNode"in t.prototype)&&!("forEachEdge"in t.prototype)}(h)?function(t,e){return class extends mE{constructor(e,n){if(super(e,n),this.instance=new t({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const t=this.instance;this.stop=t.stop.bind(t),this.tick=e=>{var n;return wE(null===(n=t.tick)||void 0===n?void 0:n.call(t,e))}}}execute(t,e){return De(this,void 0,void 0,function*(){return wE(yield this.instance.execute(this.graphData2LayoutModel(t),this.transformOptions(be({},this.options,e))))})}transformOptions(t){if(!("onTick"in t))return t;const e=t.onTick;return t.onTick=t=>e(wE(t)),t}graphData2LayoutModel(t){const{nodes:n=[],edges:r=[],combos:i=[]}=t,o=n.map(t=>{const e=Km(t),{data:n,style:r,combo:i}=t,o=Pe(t,["data","style","combo"]),A={id:e,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),{data:n}),i?{parentId:i}:{}),{style:r}),o)};return(null==r?void 0:r.x)&&Object.assign(A.data,{x:r.x}),(null==r?void 0:r.y)&&Object.assign(A.data,{y:r.y}),(null==r?void 0:r.z)&&Object.assign(A.data,{z:r.z}),A}),A=new Map(o.map(t=>[t.id,t])),s=r.filter(t=>{const{source:e,target:n}=t;return A.has(e)&&A.has(n)}).map(t=>{const{source:e,target:n,data:r,style:i}=t;return{id:Km(t),source:e,target:n,data:Object.assign({},r),style:Object.assign({},i)}}),a=i.map(t=>({id:Km(t),data:Object.assign({_isCombo:!0},t.data),style:Object.assign({},t.style)})),c=new vE({nodes:[...o,...a],edges:s});return e.model.model.hasTreeStructure(zv)&&(c.attachTreeStructure(zv),o.forEach(t=>{const n=e.model.model.getParent(t.id,zv);n&&c.hasNode(n.id)&&c.setParent(t.id,n.id,zv)})),c}}}(h,this.context):yE(h,this.context),f=new d(this.context),g={nodeSize:u,width:a,height:c,center:l};switch(f.id){case"d3-force":case"d3-force-3d":Object.assign(g,{center:{x:a/2,y:c/2,z:0}})}return be(f.options,g,s),f}updateElementPosition(t,e){const{model:n,element:r}=this.context;return r?(n.updateData(t),r.draw({animation:e,silence:!0})):null}destroy(){this.stopLayout(),this.context={},this.instance=void 0,this.instances=[],this.animationResult=void 0}}const uJ=(t,e)=>{var n;const[r,i]=e;null===(n=t.nodes)||void 0===n||n.forEach(t=>{if(t.style){const{x:e=0,y:n=0}=t.style;t.style.x=e+r,t.style.y=n+i}else t.style={x:r,y:i}})};function hJ(t){return t.layout?(Array.isArray(t.layout)||"preLayout"in t.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(t.layout.type)&&(t.layout.preLayout=!0),t):t}class dJ extends ny{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;Zv(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(e=>e.type===t);return n?this.extensionMap[n.key]:void 0}}const fJ=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class gJ extends ny{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...fJ.slice(0,fJ.length-1),...t,fJ[fJ.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}class pJ{get padding(){return pm(this.context.options.padding)}get paddingOffset(){const[t,e,n,r]=this.padding,[i,o,A]=[(r-e)/2,(t-n)/2,0];return[i,o,A]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:r,rotation:i,x:o=e,y:A=n}=t.options;this.transform({mode:"absolute",scale:r,translate:[o,A],rotate:i},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const r=Object.entries(t.getLayers()).filter(([t])=>!["main"].includes(t)),i=r.map(([,t])=>t.getCamera()),o=e[n];if("function"==typeof o)return(...t)=>{const r=o.apply(e,t);return i.forEach(e=>{e[n].apply(e,t)}),r}}})}createLandmark(t){return this.camera.createLandmark("landmark-"+this.landmarkCounter++,t)}getAnimation(t){const e=rm(this.context.options,t);return!!e&&ke(Object.assign({},e),["easing","duration"])}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:r=[]}=t,i=this.getZoom(),o=e.getPosition(),A=e.getFocalPoint(),[s,a]=this.getCanvasCenter(),[c=0,l=0,u=0]=r,h=uy([-c,-l,-u],i);return"relative"===n?{position:ay(o,h),focalPoint:ay(A,h)}:{position:ay([s,a,o[2]],h),focalPoint:ay([s,a,A[2]],h)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:"relative"===e?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:r,scale:i=1}=t;return ne("relative"===r?n*i:i,...e)}transform(e,n){return De(this,void 0,void 0,function*(){const{graph:r}=this.context,{translate:i,rotate:o,scale:A,origin:s}=e;this.cancelAnimation();const a=this.getAnimation(n);if(ZZ(r,new $Z(t.GraphEvent.BEFORE_TRANSFORM,e)),!o&&A&&!i&&s&&!a)return this.camera.setZoomByViewportPoint(this.getZoomOptions(e),s),void ZZ(r,new $Z(t.GraphEvent.AFTER_TRANSFORM,e));const c={};if(i&&Object.assign(c,this.getTranslateOptions(e)),re(o)&&Object.assign(c,this.getRotateOptions(e)),re(A)&&Object.assign(c,{zoom:this.getZoomOptions(e)}),a)return ZZ(r,new XZ(t.GraphEvent.BEFORE_ANIMATE,Pv.TRANSFORM,null,e)),new Promise(n=>{this.transformResolver=n,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},a),{onfinish:()=>{ZZ(r,new XZ(t.GraphEvent.AFTER_ANIMATE,Pv.TRANSFORM,null,e)),ZZ(r,new $Z(t.GraphEvent.AFTER_TRANSFORM,e)),this.transformResolver=void 0,n()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),ZZ(r,new $Z(t.GraphEvent.AFTER_TRANSFORM,e))})}fitView(t,e){return De(this,void 0,void 0,function*(){const[n,r,i,o]=this.padding,{when:A="always",direction:s="both"}=t||{},[a,c]=this.context.canvas.getSize(),l=a-o-r,u=c-n-i,h=this.context.canvas.getBounds(),d=this.getBBoxInViewport(h),[f,g]=wm(d);if("overflow"===A&&!("x"===s&&f>=l||"y"===s&&g>=u||"both"===s&&f>=l&&g>=u))return yield this.fitCenter({animation:e});const p=l/f,v=u/g,m="x"===s?p:"y"===s?v:Math.min(p,v),y=this.getAnimation(e);Number.isFinite(m)&&(yield this.transform({mode:"relative",scale:m,translate:ay(cy(this.getCanvasCenter(),this.getBBoxInViewport(h).center),uy(this.paddingOffset,m))},y))})}fitCenter(t){return De(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return De(this,arguments,void 0,function*(t,e={}){const{element:n}=this.context;if(!n)return;const r=xm(t.map(t=>{return r=n.getElement(t),e.shapes?r.getShape(e.shapes).getRenderBounds():r.getRenderBounds();var r}));yield this.focus(r,e)})}focus(t,e){return De(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),r=cy(e.position||this.getCanvasCenter(),n);yield this.transform({mode:"relative",translate:ay(r,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:r}=this.context,[i,o]=r.getViewportByCanvas(e),[A,s]=r.getViewportByCanvas(n),a=new yr;return a.setMinMax([i,o,0],[A,s,0]),a}isInViewport(t,e=!1,n=0){const{graph:r}=this.context,i=this.getCanvasSize(),[o,A]=r.getCanvasByViewport([0,0]),[s,a]=r.getCanvasByViewport(i);let c=new yr;return c.setMinMax([o,A,0],[s,a,0]),n&&(c=Em(c,n)),fm(t)?Cm(t,c):e?function(t,e){const[n,r]=t.min,[i,o]=t.max,[A,s]=e.min,[a,c]=e.max;return n>=A&&i<=a&&r>=s&&o<=c}(t,c):c.intersects(t)}cancelAnimation(){var t,e;(null===(t=this.camera.landmarks)||void 0===t?void 0:t.length)&&this.camera.cancelLandmarkAnimation(),null===(e=this.transformResolver)||void 0===e||e.call(this)}}class vJ extends hE{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new aJ},this.isCollapsingExpanding=!1,this.onResize=pe(()=>{this.resize()},300),this._setOptions(Object.assign({},vJ.defaultOptions,t),!0),this.context.graph=this,this.options.autoResize&&(null===(e=globalThis.addEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),Object.assign(this.options,function(t){return[hJ].reduce((t,e)=>e(t),t)}(t)),e){const{data:e}=t;return void(e&&this.addData(e))}const{behaviors:n,combo:r,data:i,edge:o,layout:A,node:s,plugins:a,theme:c,transforms:l}=t;n&&this.setBehaviors(n),i&&this.setData(i),s&&this.setNode(s),o&&this.setEdge(o),r&&this.setCombo(r),A&&this.setLayout(A),c&&this.setTheme(c),a&&this.setPlugins(a),l&&this.setTransforms(l)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Gt(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Gt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Gt(t)?t(this.getBehaviors()):t,null===(e=this.context.behavior)||void 0===e||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Gt(t)?t(this.getPlugins()):t,null===(e=this.context.plugin)||void 0===e||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Gt(t)?t(this.getTransforms()):t,null===(e=this.context.transform)||void 0===e||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(e=>"object"==typeof e&&e.key===t.key?Object.assign(Object.assign({},e),t):e)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}hasNode(t){return this.context.model.hasNode(t)}hasEdge(t){return this.context.model.hasEdge(t)}hasCombo(t){return this.context.model.hasCombo(t)}getElementData(t){return Array.isArray(t)?t.map(t=>this.context.model.getElementDataById(t)):this.context.model.getElementDataById(t)}getNodeData(t){return void 0===t?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeLikeDatum(t)}getEdgeData(t){return void 0===t?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeDatum(t)}getComboData(t){return void 0===t?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getNodeLikeDatum(t)}setData(t){this.context.model.setData(Gt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Gt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Gt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Gt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Gt(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Gt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Gt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Gt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Gt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Gt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Gt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Gt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Gt(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return De(this,void 0,void 0,function*(){var e;if(this.context.canvas)return yield this.context.canvas.ready;const{container:n="container",width:r,height:i,renderer:o,cursor:A,background:s,canvas:a,devicePixelRatio:c=(null!==(e=globalThis.devicePixelRatio)&&void 0!==e?e:1)}=this.options;if(n instanceof GZ)this.context.canvas=n,A&&n.setCursor(A),o&&n.setRenderer(o),yield n.ready;else{const e=Jt(n)?document.getElementById(n):n,l=VZ(e);this.emit(t.GraphEvent.BEFORE_CANVAS_INIT,{container:e,width:r,height:i});const u=Object.assign(Object.assign({},a),{container:e,width:r||l[0],height:i||l[1],background:s,renderer:o,cursor:A,devicePixelRatio:c}),h=new GZ(u);this.context.canvas=h,yield h.ready,this.emit(t.GraphEvent.AFTER_CANVAS_INIT,{canvas:h})}})}updateCanvas(e){var n,r;const{renderer:i,cursor:o,height:A,width:s}=e,a=this.context.canvas;a&&(i&&(this.emit(t.GraphEvent.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),a.setRenderer(i),this.emit(t.GraphEvent.AFTER_RENDERER_CHANGE,{renderer:i})),o&&a.setCursor(o),(re(s)||re(A))&&this.setSize(null!==(n=null!=s?s:this.options.width)&&void 0!==n?n:0,null!==(r=null!=A?A:this.options.height)&&void 0!==r?r:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new iJ(this.context)),this.context.plugin||(this.context.plugin=new dJ(this.context)),this.context.viewport||(this.context.viewport=new pJ(this.context)),this.context.transform||(this.context.transform=new gJ(this.context)),this.context.element||(this.context.element=new cJ(this.context)),this.context.animation||(this.context.animation=new rJ(this.context)),this.context.layout||(this.context.layout=new lJ(this.context)),this.context.behavior||(this.context.behavior=new oJ(this.context))}prepare(){return De(this,void 0,void 0,function*(){yield Promise.resolve(),this.destroyed?console.error($v("The graph instance has been destroyed")):(yield this.initCanvas(),this.initRuntime())})}render(){return De(this,void 0,void 0,function*(){if(yield this.prepare(),ZZ(this,new YZ(t.GraphEvent.BEFORE_RENDER)),this.options.layout)if(this.rendered||(e=this.options.layout,Array.isArray(e)||!(null==e?void 0:e.preLayout))){const t=this.context.element.draw({type:"render"});yield Promise.all([null==t?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([null==t?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([null==t?void 0:t.finished,this.autoFit()])}var e;this.rendered=!0,ZZ(this,new YZ(t.GraphEvent.AFTER_RENDER))})}draw(){return De(this,void 0,void 0,function*(){var t;yield this.prepare(),yield null===(t=this.context.element.draw())||void 0===t?void 0:t.finished})}layout(t){return De(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return De(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),null==e||e.clear()})}destroy(){var e;ZZ(this,new YZ(t.GraphEvent.BEFORE_DESTROY));const{layout:n,animation:r,element:i,model:o,canvas:A,behavior:s,plugin:a}=this.context;null==a||a.destroy(),null==s||s.destroy(),null==n||n.destroy(),null==r||r.destroy(),null==i||i.destroy(),o.destroy(),null==A||A.destroy(),this.options={},this.context={},this.off(),null===(e=globalThis.removeEventListener)||void 0===e||e.call(globalThis,"resize",this.onResize),this.destroyed=!0,ZZ(this,new YZ(t.GraphEvent.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(e,n){var r;const i=VZ(null===(r=this.context.canvas)||void 0===r?void 0:r.getContainer()),o=[e||i[0],n||i[1]];if(!this.context.canvas)return;const A=this.context.canvas.getSize();xe(o,A)||(ZZ(this,new YZ(t.GraphEvent.BEFORE_SIZE_CHANGE,{size:o})),this.context.canvas.resize(...o),ZZ(this,new YZ(t.GraphEvent.AFTER_SIZE_CHANGE,{size:o})))}fitView(t,e){return De(this,void 0,void 0,function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.fitView(t,e)})}fitCenter(t){return De(this,void 0,void 0,function*(){var e;yield null===(e=this.context.viewport)||void 0===e?void 0:e.fitCenter({animation:t})})}autoFit(){return De(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(Jt(t))"view"===t?yield this.fitView():"center"===t&&(yield this.fitCenter());else{const{type:e,animation:n}=t;"view"===e?yield this.fitView(t.options,n):"center"===e&&(yield this.fitCenter(n))}})}focusElement(t,e){return De(this,void 0,void 0,function*(){var n;yield null===(n=this.context.viewport)||void 0===n?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return De(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return De(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return De(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return De(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return De(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return De(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return cy([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return De(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,A]=zt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach(([t,e])=>this.context.model.translateNodeLikeBy(t,e)),yield null===(i=this.context.element.draw({animation:A,stage:"translate"}))||void 0===i?void 0:i.finished})}translateElementTo(t,e){return De(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,A]=zt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n];Object.entries(o).forEach(([t,e])=>this.context.model.translateNodeLikeTo(t,e)),yield null===(i=this.context.element.draw({animation:A,stage:"translate"}))||void 0===i?void 0:i.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Se(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return De(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,A]=zt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach(([t,e])=>{const n=this.getElementType(t);s[`${n}s`].push({id:t,style:{visibility:e}})});const{model:a,element:c}=this.context;a.preventUpdateNodeLikeHierarchy(()=>{a.updateData(s)}),yield null===(i=c.draw({animation:A,stage:"visibility"}))||void 0===i?void 0:i.finished})}showElement(t,e){return De(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(t=>[t,"visible"])),e)})}hideElement(t,e){return De(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(t=>[t,"hidden"])),e)})}getElementVisibility(t){var e,n;const r=this.context.element.getElement(t);return null!==(n=null===(e=null==r?void 0:r.style)||void 0===e?void 0:e.visibility)&&void 0!==n?n:"visible"}setElementZIndex(t,e){return De(this,void 0,void 0,function*(){var n;const r={nodes:[],edges:[],combos:[]},i=zt(t)?t:{[t]:e};Object.entries(i).forEach(([t,e])=>{const n=this.getElementType(t);r[`${n}s`].push({id:t,style:{zIndex:e}})});const{model:o,element:A}=this.context;o.preventUpdateNodeLikeHierarchy(()=>o.updateData(r)),yield null===(n=A.draw({animation:!1,stage:"zIndex"}))||void 0===n?void 0:n.finished})}frontElement(t){return De(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,r={};e.map(t=>{const e=n.getFrontZIndex(t);if("combo"===n.getElementType(t)){const i=n.getAncestorsData(t,zv).at(-1)||this.getComboData(t),o=[i,...n.getDescendantsData(Km(i))],A=e-JZ(i);o.forEach(t=>{r[Km(t)]=this.getElementZIndex(Km(t))+A});const{internal:s}=vB(o.map(Km),t=>n.getRelatedEdgesData(t));s.forEach(t=>{const e=Km(t);r[e]=this.getElementZIndex(e)+A})}else r[t]=e}),yield this.setElementZIndex(r)})}getElementZIndex(t){return JZ(this.context.model.getElementDataById(t))}setElementState(t,e){return De(this,arguments,void 0,function*(t,e,n=!0){var r,i;const[o,A]=zt(t)?[t,null===(r=e)||void 0===r||r]:[{[t]:e},n],s={nodes:[],edges:[],combos:[]};Object.entries(o).forEach(([t,e])=>{const n=this.getElementType(t);var r;s[`${n}s`].push({id:t,states:(r=e,r?Array.isArray(r)?r:[r]:[])})}),this.updateData(s),yield null===(i=this.context.element.draw({animation:A,stage:"state"}))||void 0===i?void 0:i.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return De(this,arguments,void 0,function*(t,e=!0){const{model:n,element:r}=this.context;if(rw(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!1});const i=n.getElementType(t);yield this.frontElement(t),this.isCollapsingExpanding=!0,n.updateData("node"===i?{nodes:[{id:t,style:{collapsed:!0}}]}:{combos:[{id:t,style:{collapsed:!0}}]}),"node"===i?yield r.collapseNode(t,e):"combo"===i&&(yield r.collapseCombo(t,!!e.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return De(this,arguments,void 0,function*(t,e=!0){const{model:n,element:r}=this.context;if(!rw(n.getNodeLikeData([t])[0]))return;if(this.isCollapsingExpanding)return;"boolean"==typeof e&&(e={animation:e,align:!1});const i=n.getElementType(t);this.isCollapsingExpanding=!0,n.updateData("node"===i?{nodes:[{id:t,style:{collapsed:!1}}]}:{combos:[{id:t,style:{collapsed:!1}}]}),"node"===i?yield r.expandNode(t,e):"combo"===i&&(yield r.expandCombo(t,!!e.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);"node"===n?this.updateNodeData([{id:t,style:{collapsed:e}}]):"combo"===n&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return De(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}vJ.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};const mJ=(t,e)=>{const{source:n,target:r}=e,i=t.getElementDataById(n),o=t.getElementDataById(r),A=mB(i,e=>t.getParentData(e,zv)),s=mB(o,e=>t.getParentData(e,zv)),a={sourceNode:Km(A),targetNode:Km(s)};return e.style?Object.assign(e.style,a):e.style=a,e};class yJ extends UZ{constructor(t,e){super(t,be({},yJ.defaultOptions,e)),this.assignSizeByCentrality=(t,e,n,r,i,o)=>{const A=[e,n],s=[r[0],i[0]],a=[r[1],i[1]],c=[r[2],i[2]],l=(t,e)=>{if("function"==typeof o)return o(t,A,e);switch(o){case"linear":return((t,e,n)=>{const[r,i]=e,[o,A]=n;return i===r?o:o+(t-r)/(i-r)*(A-o)})(t,A,e);case"log":return((t,e,n)=>{const[r,i]=e,[o,A]=n;return o+Math.log(t-r+1)/Math.log(i-r+1)*(A-o)})(t,A,e);case"pow":return((t,e,n,r=2)=>{const[i,o]=e,[A,s]=n;return A+Math.pow((t-i)/(o-i),r)*(s-A)})(t,A,e,2);case"sqrt":return((t,e,n)=>{const[r,i]=e,[o,A]=n;return o+Math.sqrt((t-r)/(i-r))*(A-o)})(t,A,e);default:return e[0]}};return[l(t,s),l(t,a),l(t,c)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),r=cw(this.options.maxSize),i=cw(this.options.minSize),o=this.getCentralities(this.options.centrality),A=o.size>0?Math.max(...o.values()):0,s=o.size>0?Math.min(...o.values()):0;return n.forEach(e=>{var n;const a=this.assignSizeByCentrality(o.get(Km(e))||0,s,A,i,r,this.options.scale),c=null===(n=this.context.element)||void 0===n?void 0:n.getElement(Km(e)),l={size:a};this.assignLabelStyle(l,a,e,c),c&&TZ(l,c.attributes)||NZ(t,c?"update":"add","node",be(e,{style:l}),!0)}),t}assignLabelStyle(t,e,n,r){var i;const o=r?r.config.style:null===(i=this.context.element)||void 0===i?void 0:i.getElementComputedStyle("node",n);if(Object.assign(t,ke(o,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const n=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:n,labelLineHeight:n+vm(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const r=Math.min(...t)/2,[i,o]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(o,Math.max(r,i))}getCentralities(t){const{model:e}=this.context,n=e.getData();if("function"==typeof t)return t(n);const r=e.getRelatedEdgesData.bind(e);return Vm(n,r,t)}}yJ.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class wJ extends UZ{constructor(t,e){super(t,Object.assign({},wJ.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=My(this.ref),{graph:n,model:r}=this.context;null===(t=r.getData().nodes)||void 0===t||t.forEach(t=>{var i;if(Km(t)===Km(this.ref))return;const o=by(cy(My(t),e)),A=Math.abs(o)>Math.PI/2,s=!t.children||0===t.children.length,a=Km(t),c=null===(i=this.context.element)||void 0===i?void 0:i.getElement(a);if(!c||!c.isVisible())return;const l=(s?1:-1)*(cw(n.getElementRenderStyle(a).size)[0]/2+this.options.offset),u=[["translate",l*Math.cos(o),l*Math.sin(o)],["rotate",A?Tr(o)+180:Tr(o)]];r.updateNodeData([{id:Km(t),style:{labelTextAlign:A===s?"right":"left",labelTextBaseline:"middle",labelTransform:u}}])}),n.draw()}}wJ.defaultOptions={offset:5};const bJ=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class BJ extends UZ{constructor(t,e){super(t,Object.assign({},BJ.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=t=>{const{add:{edges:e},update:{nodes:n,edges:r,combos:i},remove:{edges:o}}=t,{model:A}=this.context,s=new Map,a=(t,e)=>{A.getRelatedEdgesData(e).forEach(t=>!s.has(Km(t))&&s.set(Km(t),t))};n.forEach(a),i.forEach(a);const c=e=>{const n=new Set(t.remove.edges.keys()),r=A.getEdgeData().filter(t=>!n.has(Km(t))).map(t=>mJ(A,t));xJ(e,r).forEach(t=>{const e=Km(t);s.has(e)||s.set(e,t)})};if(o.size&&o.forEach(c),e.size&&e.forEach(c),r.size){const t=oV(iV(A.getChanges())).update.edges;r.forEach(e=>{var n;c(e);const r=null===(n=t.find(t=>Km(t.value)===Km(e)))||void 0===n?void 0:n.original;r&&!CJ(e,r)&&c(r)})}Ee(this.options.edges)||s.forEach((t,e)=>!this.options.edges.includes(e)&&s.delete(e));const l=A.getEdgeData().map(Km);return new Map([...s].sort((t,e)=>l.indexOf(t[0])-l.indexOf(e[0])))},this.applyBundlingStyle=(t,e,n)=>{var r,i;const{edgeMap:o,reverses:A}=EJ(e),s=null!==(r=this.options.loopMode)&&void 0!==r?r:"spread",a=null!==(i=this.options.loopDistance)&&void 0!==i?i:n,c=new Map;o.forEach(e=>{e.forEach((e,r,i)=>{var o,l;const u=i.length,h=e.style||{};if(e.source===e.target)if("nested"===s){const t=h.loopPlacement||"top",n=`${e.source}-${t}`;if(h.loopPlacement=t,void 0===h.loopDist){const t=null!==(o=c.get(n))&&void 0!==o?o:0;h.loopDist=35+t*a,c.set(n,t+1)}}else{const t=bJ.length;h.loopPlacement=bJ[r%t],h.loopDist=Math.floor(r/t)*n+50}else if(1===u)h.curveOffset=0;else{const t=(r%2==0?1:-1)*(A[`${e.source}|${e.target}|${r}`]?-1:1);h.curveOffset=u%2==1?t*Math.ceil(r/2)*n*2:t*(Math.floor(r/2)*n*2+n)}const d=Object.assign(e,{type:"quadratic",style:h}),f=null===(l=this.context.element)||void 0===l?void 0:l.getElement(Km(e));f&&TZ(d.style,f.attributes)||NZ(t,f?"update":"add","edge",d,!0)})})},this.resetEdgeStyle=t=>{const e=t.style||{},n=this.cacheMergeStyle.get(Km(t))||{};return Object.keys(n).forEach(r=>{xe(e[r],n[r])&&(t[r]?e[r]=t[r]:delete e[r])}),Object.assign(t,{style:e})},this.applyMergingStyle=(t,e)=>{const{edgeMap:n,reverses:r}=EJ(e);n.forEach(e=>{var n;if(1===e.length){const r=e[0],i=null===(n=this.context.element)||void 0===n?void 0:n.getElement(Km(r)),o=this.resetEdgeStyle(r);return void(i&&TZ(o,i.attributes)||NZ(t,i?"update":"add","edge",o))}const i=e.map(({source:t,target:e,style:n={}},i)=>{const{startArrow:o,endArrow:A}=n,s={},[a,c]=r[`${t}|${e}|${i}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return ue(o)&&(s[a]=o),ue(A)&&(s[c]=A),s}).reduce((t,e)=>Object.assign(Object.assign({},t),e),{});e.forEach((e,n,r)=>{var o;if(0!==n)return void NZ(t,"remove","edge",e);const A=Object.assign({},Gt(this.options.style)?this.options.style(r):this.options.style,{childrenData:r});this.cacheMergeStyle.set(Km(e),A);const s=Object.assign(Object.assign({},e),{type:"line",style:Object.assign(Object.assign(Object.assign({},e.style),i),A)}),a=null===(o=this.context.element)||void 0===o?void 0:o.getElement(Km(e));a&&TZ(s.style,a.attributes)||NZ(t,a?"update":"add","edge",s,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return 0===e.size||("bundle"===this.options.mode?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}BJ.defaultOptions={mode:"bundle",distance:15,loopMode:"spread",loopDistance:15};const EJ=t=>{const e=new Map,n=new Set,r={},i=new Map;for(const[o,A]of t){if(n.has(o))continue;const{source:s,target:a}=A,c=`${s}-${a}`;e.has(c)||(e.set(c,[]),i.set(c,new Set));const l=e.get(c),u=i.get(c);l&&u&&!u.has(o)&&(l.push(A),u.add(o),n.add(o));for(const[l,u]of t)if(!n.has(l)&&l!==o&&CJ(A,u)){const t=e.get(c),o=i.get(c);t&&o&&!o.has(l)&&(t.push(u),o.add(l),s===u.target&&a===u.source&&(r[`${u.source}|${u.target}|${t.length-1}`]=!0),n.add(l))}}return{edgeMap:e,reverses:r}},xJ=(t,e,n)=>e.filter(e=>CJ(e,t)),CJ=(t,e)=>{const{sourceNode:n,targetNode:r}=t.style||{},{sourceNode:i,targetNode:o}=e.style||{};return n===i&&r===o||n===o&&r===i};const MJ={animation:{"combo-collapse":um,"combo-expand":hm,"node-collapse":sm,"node-expand":am,"path-in":cm,"path-out":lm,fade:[{fields:["opacity"]}],translate:[{fields:["x","y"]}]},behavior:{"brush-select":Yy,"click-select":nw,"collapse-expand":nE,"create-edge":cE,"drag-canvas":lE,"drag-element-force":EE,"drag-element":uE,"fix-element-size":xE,"focus-element":CE,"hover-activate":ME,"lasso-select":FE,"auto-adapt-label":oy,"optimize-viewport-transform":kE,"scroll-canvas":SE,"zoom-canvas":QE},combo:{circle:Yb,rect:Xb},edge:{cubic:BB,line:MB,polyline:PB,quadratic:DB,"cubic-horizontal":EB,"cubic-radial":xB,"cubic-vertical":CB},layout:{"antv-dagre":bF,"combo-combined":Yj,"compact-box":$E,"d3-force":Ok,"force-atlas2":nj,circular:QF,concentric:NF,dagre:LK,dendrogram:ix,fishbone:Xj,force:qK,fruchterman:oj,grid:sj,indented:lx,mds:Uj,mindmap:vx,radial:Dj,random:Kj,snake:Jj},node:{circle:Tw,diamond:Iw,ellipse:Rw,hexagon:Hw,html:Gb,image:Kb,rect:jb,star:zb,donut:Lw,triangle:Vb},palette:{spectral:["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],tableau:["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],oranges:["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],greens:["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],blues:["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"]},theme:{dark:SZ,light:QZ},plugin:{"bubble-sets":Hz,"edge-bundling":jz,"edge-filter-lens":Jz,"grid-line":rV,background:rz,contextmenu:Kz,fisheye:eV,fullscreen:nV,history:aV,hull:GV,legend:J$,minimap:tZ,snapline:iZ,timebar:aZ,title:mZ,toolbar:wZ,tooltip:bZ,watermark:xZ},transform:{"arrange-draw-order":class extends UZ{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,r=t=>{const n=[];return t.forEach((t,r)=>{const i=e.getAncestorsData(r,"combo").map(t=>Km(t)).reverse();n.push([r,t,i.length])}),new Map(n.sort(([,,t],[,,e])=>e-t).map(([t,e])=>[t,e]))};return t.add.combos=r(n),t.update.combos=r(t.update.combos),t}},"collapse-expand-combo":class extends UZ{beforeDraw(t,e){if("visibility"===e.stage)return t;if(!this.context.model.model.hasTreeStructure(zv))return t;const{model:n}=this.context,{add:r,update:i}=t,o=[...t.update.combos.entries(),...t.add.combos.entries()];for(;o.length;){const[e,A]=o.pop();if(rw(A)){const A=n.getDescendantsData(e),s=A.map(Km),{internal:a,external:c}=vB(s,t=>n.getRelatedEdgesData(t));A.forEach(e=>{const r=Km(e),i=o.findIndex(([t])=>t===r);-1!==i&&o.splice(i,1);const A=n.getElementType(r);NZ(t,"remove",A,e)}),a.forEach(e=>NZ(t,"remove","edge",e)),c.forEach(t=>{var e;const n=Km(t);(null===(e=this.context.element)||void 0===e?void 0:e.getElement(n))?i.edges.set(n,t):r.edges.set(n,t)})}else{const r=n.getChildrenData(e),i=r.map(Km),{edges:A}=vB(i,t=>n.getRelatedEdgesData(t));[...r,...A].forEach(e=>{var r;const i=Km(e),A=n.getElementType(i),s=null===(r=this.context.element)||void 0===r?void 0:r.getElement(i);NZ(t,s?"update":"add",A,e),"combo"===A&&o.push([i,e])})}}return t}},"collapse-expand-node":class extends UZ{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(OZ(e,"add","node",t),rw(t))return;const n=Km(t);OZ(e,"add","node",t);this.context.model.getRelatedEdgesData(n).forEach(t=>{NZ(e,"add","edge",t)});this.context.model.getChildrenData(n).forEach(t=>{this.handleExpand(t,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(Vv))return t;const{add:{nodes:r,edges:i},update:{nodes:o}}=t,A=new Map,s=new Map;r.forEach((t,e)=>{rw(t)&&A.set(e,t)}),i.forEach(t=>{if("node"!==e.getElementType(t.source))return;const n=e.getNodeData(t.source);rw(n)&&A.set(t.source,n)}),o.forEach((t,e)=>{const n=this.getElement(e);if(!n)return;const r=n.attributes.collapsed;rw(t)?r||A.set(e,t):r&&s.set(e,t)});const a=new Set;return A.forEach((e,r)=>{n.getDescendantsData(r).forEach(e=>{const r=Km(e);if(a.has(r))return;NZ(t,"remove","node",e);n.getRelatedEdgesData(r).forEach(e=>{NZ(t,"remove","edge",e)}),a.add(r)})}),s.forEach((e,r)=>{n.getAncestorsData(r,Vv).some(rw)?NZ(t,"remove","node",e):this.handleExpand(e,t)}),t}},"get-edge-actual-ends":class extends UZ{beforeDraw(t){const{add:e,update:n}=t,{model:r}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,t])=>{mJ(r,t)}),t}},"map-node-size":yJ,"place-radial-labels":wJ,"process-parallel-edges":BJ,"update-related-edges":class extends UZ{beforeDraw(t,e){const{stage:n}=e;if("visibility"===n)return t;const{model:r}=this.context,{update:{nodes:i,edges:o,combos:A}}=t,s=(t,e)=>{r.getRelatedEdgesData(e).forEach(t=>!o.has(Km(t))&&o.set(Km(t),t))};return i.forEach(s),A.forEach(s),t}}},shape:{circle:za,ellipse:Ya,group:Xa,html:$a,image:Cw,line:tc,path:nc,polygon:ic,polyline:Ac,rect:sc,text:cc,label:yw,badge:ww}};Object.entries(MJ).forEach(([t,e])=>{Object.entries(e).forEach(([e,n])=>{PZ(t,e,n)})});t.AntVDagreLayout=bF,t.AutoAdaptLabel=oy,t.Background=rz,t.Badge=ww,t.BaseBehavior=iy,t.BaseCombo=Wb,t.BaseEdge=bB,t.BaseLayout=mE,t.BaseNode=Nw,t.BasePlugin=tz,t.BaseShape=pw,t.BaseTransform=UZ,t.BrushSelect=Yy,t.BubbleSets=Hz,t.CameraSetting=class extends tz{constructor(t,e){super(t,e),this.setOptions=t=>{const e=(t,e)=>{switch(t){case"projectionMode":return"perspective"===e?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[e];case"aspect":return"number"==typeof e?e:this.getCanvasAspect();default:return e}};Object.entries({cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"}).forEach(([n,r])=>{const i=t[n];if(void 0!==i){const t=e(n,i);this.context.canvas.getCamera()[r](t)}})},this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(t.GraphEvent.BEFORE_DRAW,()=>this.setOptions(this.options))}getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}},t.Canvas=GZ,t.Circle=Tw,t.CircleCombo=Yb,t.CircularLayout=QF,t.ClickSelect=nw,t.CollapseExpand=nE,t.ComboCombinedLayout=Yj,t.CompactBoxLayout=$E,t.ConcentricLayout=NF,t.Contextmenu=Kz,t.CreateEdge=cE,t.Cubic=BB,t.CubicHorizontal=EB,t.CubicRadial=xB,t.CubicVertical=CB,t.D3ForceLayout=Ok,t.DagreLayout=LK,t.DendrogramLayout=ix,t.Diamond=Iw,t.Donut=Lw,t.DragCanvas=lE,t.DragElement=uE,t.DragElementForce=EE,t.EdgeBundling=jz,t.EdgeFilterLens=Jz,t.Ellipse=Rw,t.FishboneLayout=Xj,t.Fisheye=eV,t.FixElementSize=xE,t.FocusElement=CE,t.ForceAtlas2Layout=nj,t.ForceLayout=qK,t.FruchtermanLayout=oj,t.Fullscreen=nV,t.Graph=vJ,t.GridLayout=sj,t.GridLine=rV,t.HTML=Gb,t.Hexagon=Hw,t.History=aV,t.HoverActivate=ME,t.Hull=GV,t.Icon=Qw,t.Image=Kb,t.IndentedLayout=lx,t.Label=yw,t.LassoSelect=FE,t.Legend=J$,t.Line=MB,t.MDSLayout=Uj,t.MapNodeSize=yJ,t.MindmapLayout=vx,t.Minimap=tZ,t.OptimizeViewportTransform=kE,t.PlaceRadialLabels=wJ,t.Polyline=PB,t.ProcessParallelEdges=BJ,t.Quadratic=DB,t.RadialLayout=Dj,t.RandomLayout=Kj,t.Rect=jb,t.RectCombo=Xb,t.ScrollCanvas=SE,t.Shortcut=Wy,t.SnakeLayout=Jj,t.Snapline=iZ,t.Star=zb,t.Timebar=aZ,t.Title=mZ,t.Toolbar=wZ,t.Tooltip=bZ,t.Triangle=Vb,t.Watermark=xZ,t.ZoomCanvas=QE,t.effect=function(t,e,n){IZ.has(t)||IZ.set(t,{});const r=IZ.get(t);if(!r[e])return r[e]=n,!0;const i=r[e];return!LZ(i,n)&&(r[e]=n,!0)},t.getExtension=Xv,t.getExtensions=function(t){return Yv[t]},t.iconfont={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"},t.idOf=Km,t.invokeLayoutMethod=bE,t.isCollapsed=rw,t.omitStyleProps=aw,t.parseSize=cw,t.positionOf=My,t.register=PZ,t.setVisibility=ey,t.subStyleProps=Aw,t.treeToGraphData=function(t,e){const{getNodeData:n=(t,e)=>{if(t.depth=e,!t.children)return t;const{children:n}=t,r=Pe(t,["children"]);return Object.assign(Object.assign({},r),{children:n.map(t=>t.id)})},getEdgeData:r=(t,e)=>({source:t.id,target:e.id}),getChildren:i=t=>t.children||[]}=e||{},o=[],A=[];return Zy(t,(t,e)=>{o.push(n(t,e));const s=i(t);for(const e of s)A.push(r(t,e))},t=>i(t),"TB"),{nodes:o,edges:A}},t.version=qv});