@daoyi/nmtl-ui 2.0.1-beta.10 → 2.0.1-beta.101

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 (104) hide show
  1. package/lib/components/Autocomplete-9e392b0c.js +470 -0
  2. package/lib/components/Autocomplete.js +20 -1
  3. package/lib/components/Avatar.js +53 -1
  4. package/lib/components/BackTop.js +124 -1
  5. package/lib/components/BarChart.js +762 -1
  6. package/lib/components/Breadcrumbs.js +122 -1
  7. package/lib/components/Button-305b69a0.js +92 -0
  8. package/lib/components/Button.js +6 -1
  9. package/lib/components/Carousel.js +4654 -1
  10. package/lib/components/Checkbox.js +37 -1
  11. package/lib/components/CollapseContent.js +180 -1
  12. package/lib/components/ContactModal-90b95c63.js +12188 -0
  13. package/lib/components/ContactModal.js +24 -3
  14. package/lib/components/Drawer-2cbcec04.js +163 -0
  15. package/lib/components/Drawer.js +17 -1
  16. package/lib/components/Dropdown.js +134 -1
  17. package/lib/components/Empty-bf77164f.js +45 -0
  18. package/lib/components/Empty.js +5 -1
  19. package/lib/components/ExportButton.js +128 -1
  20. package/lib/components/ExtraTools-55f66039.js +3619 -0
  21. package/lib/components/ExtraTools.js +10 -22
  22. package/lib/components/Filter.js +814 -12
  23. package/lib/components/Footer.js +317 -1
  24. package/lib/components/ForwardLink-83a7eea9.js +125 -0
  25. package/lib/components/ForwardLink.js +10 -0
  26. package/lib/components/Header.js +220 -1
  27. package/lib/components/Image.js +61 -1
  28. package/lib/components/Input.js +82 -1
  29. package/lib/components/InputMethod.js +33949 -12
  30. package/lib/components/KeywordSearch-d378ca7f.js +151 -0
  31. package/lib/components/KeywordSearch.js +22 -1
  32. package/lib/components/KeywordTicker.js +224 -1
  33. package/lib/components/Keywords.js +343 -1
  34. package/lib/components/Loading.js +28 -1
  35. package/lib/components/MUITheme.js +2639 -1
  36. package/lib/components/Modal-777fe87d.js +116 -0
  37. package/lib/components/Modal.js +10 -1
  38. package/lib/components/MoreButton-493f7c82.js +148 -0
  39. package/lib/components/MoreButton.js +8 -1
  40. package/lib/components/Pagination.js +3632 -0
  41. package/lib/components/Radio.js +78 -1
  42. package/lib/components/SNA.js +1691 -22
  43. package/lib/components/Select-e0790135.js +145 -0
  44. package/lib/components/Select.js +13 -1
  45. package/lib/components/Spin-8dc60bfe.js +75 -0
  46. package/lib/components/Spin.js +6 -1
  47. package/lib/components/Table.js +51 -1
  48. package/lib/components/Tooltip-6ebfa9c1.js +70 -0
  49. package/lib/components/Tooltip.js +7 -1
  50. package/lib/components/_commonjsHelpers-70de2c37.js +28 -0
  51. package/lib/components/_rollupPluginBabelHelpers-a52356f6.js +142 -0
  52. package/lib/components/createSvgIcon-e3803ee1.js +576 -0
  53. package/lib/components/dataExport-d55d6fa3.js +92 -0
  54. package/lib/components/debounce-127da66c.js +355 -0
  55. package/lib/components/defaultTheme-ed7746fe.js +1661 -0
  56. package/lib/components/globalConfig.js +251 -0
  57. package/lib/components/hoist-non-react-statics.cjs-3f408ad2.js +105 -0
  58. package/lib/components/index-b47819f3.js +481 -0
  59. package/lib/components/index-b76a85f4.js +61 -0
  60. package/lib/components/isObjectLike-e111475d.js +190 -0
  61. package/lib/components/style-inject.es-1f59c1d0.js +28 -1
  62. package/lib/components/toConsumableArray-dbe8af76.js +19 -0
  63. package/lib/components/transform-3a04288b.js +5475 -0
  64. package/lib/components/useTheme-d16d02d9.js +11 -0
  65. package/lib/components/withTheme-2d778133.js +6 -0
  66. package/lib/configs/config.selector.js +151 -0
  67. package/lib/configs/index.d.ts +1 -0
  68. package/lib/configs/index.js +1 -0
  69. package/lib/index.d.ts +2 -0
  70. package/lib/index.js +2 -0
  71. package/lib/utils/_rollupPluginBabelHelpers-8dd26e1a.js +121 -0
  72. package/lib/utils/arrayMerge.js +4953 -1
  73. package/lib/utils/chunkArray.js +15 -1
  74. package/lib/utils/convert2HtmlEntities.js +42 -1
  75. package/lib/utils/domToImage.js +802 -1
  76. package/lib/utils/downloadGephi.js +106 -1
  77. package/lib/utils/exportXlsx.js +219 -1
  78. package/lib/utils/historyAppendSearch.js +502 -1
  79. package/lib/utils/isDevelopMode.js +5 -1
  80. package/lib/utils/parseYMD.js +36 -1
  81. package/lib/utils/removeDuplicateItem.js +11 -1
  82. package/lib/utils/sendEmail.js +39 -1
  83. package/lib/utils/snaDefine-6a2bcd94.js +5 -0
  84. package/lib/utils/snaDefine.js +1 -1
  85. package/lib/utils/snaPreProcess.js +84 -1
  86. package/package.json +125 -127
  87. package/lib/components/Empty-54b79907.js +0 -1
  88. package/lib/components/KeywordSearch-5a393f12.js +0 -1
  89. package/lib/components/Select-f2441b83.js +0 -1
  90. package/lib/components/_rollupPluginBabelHelpers-1b8c042f.js +0 -1
  91. package/lib/components/_rollupPluginBabelHelpers-ec4e2a53.js +0 -1
  92. package/lib/components/createSvgIcon-62b64929.js +0 -1
  93. package/lib/components/createSvgIcon-e24792d4.js +0 -1
  94. package/lib/components/createTheme-7fffa109.js +0 -1
  95. package/lib/components/dataExport-9fccd4f0.js +0 -1
  96. package/lib/components/debounce-c993109b.js +0 -1
  97. package/lib/components/hoist-non-react-statics.cjs-d6a9befd.js +0 -1
  98. package/lib/components/index-11391ca3.js +0 -7
  99. package/lib/components/index-b2745105.js +0 -7
  100. package/lib/components/isObjectLike-2f1983fe.js +0 -1
  101. package/lib/components/style-inject.es-c875d022.js +0 -1
  102. package/lib/components/transform-ee09e63e.js +0 -1
  103. package/lib/utils/_commonjsHelpers-e2cda605.js +0 -1
  104. package/lib/utils/_rollupPluginBabelHelpers-928a52ce.js +0 -1
@@ -1,22 +1,1691 @@
1
- import*as t from"react";import e,{useMemo as n,useState as r,useRef as o,useEffect as i,useCallback as a,Component as l,forwardRef as u}from"react";import c from"prop-types";import{c as s,b as f,u as h}from"./index-b2745105.js";import{d,m as p,t as m,e as y,T as g,i as v,c as w,a as b,s as x,o as _}from"./transform-ee09e63e.js";import{_ as E}from"./_rollupPluginBabelHelpers-ec4e2a53.js";import{Menu as k,MenuItem as S,Tooltip as C,IconButton as T}from"@material-ui/core";import A from"./Tooltip.js";import{s as N,f as P,a as z}from"./dataExport-9fccd4f0.js";import{s as O}from"./style-inject.es-1f59c1d0.js";import{i as j,a as M,r as F}from"./createSvgIcon-e24792d4.js";import"@material-ui/styles";import"react-dom";var D="http://www.w3.org/1999/xhtml",I={svg:"http://www.w3.org/2000/svg",xhtml:D,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function B(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),I.hasOwnProperty(e)?{space:I[e],local:t}:t}function L(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===D&&e.documentElement.namespaceURI===D?e.createElement(t):e.createElementNS(n,t)}}function R(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function q(t){var e=B(t);return(e.local?R:L)(e)}function U(){}function G(t){return null==t?U:function(){return this.querySelector(t)}}function $(){return[]}function H(t){return new Array(t.length)}function V(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}V.prototype={constructor:V,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function W(t,e,n,r,o,i){for(var a,l=0,u=e.length,c=i.length;l<c;++l)(a=e[l])?(a.__data__=i[l],r[l]=a):n[l]=new V(t,i[l]);for(;l<u;++l)(a=e[l])&&(o[l]=a)}function X(t,e,n,r,o,i,a){var l,u,c,s={},f=e.length,h=i.length,d=new Array(f);for(l=0;l<f;++l)(u=e[l])&&(d[l]=c="$"+a.call(u,u.__data__,l,e),c in s?o[l]=u:s[c]=u);for(l=0;l<h;++l)(u=s[c="$"+a.call(t,i[l],l,i)])?(r[l]=u,u.__data__=i[l],s[c]=null):n[l]=new V(t,i[l]);for(l=0;l<f;++l)(u=e[l])&&s[d[l]]===u&&(o[l]=u)}function Y(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function K(t){return function(){this.removeAttribute(t)}}function J(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Q(t,e){return function(){this.setAttribute(t,e)}}function Z(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function tt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function et(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function nt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function rt(t){return function(){this.style.removeProperty(t)}}function ot(t,e,n){return function(){this.style.setProperty(t,e,n)}}function it(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function at(t,e){return t.style.getPropertyValue(e)||nt(t).getComputedStyle(t,null).getPropertyValue(e)}function lt(t){return function(){delete this[t]}}function ut(t,e){return function(){this[t]=e}}function ct(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function st(t){return t.trim().split(/^|\s+/)}function ft(t){return t.classList||new ht(t)}function ht(t){this._node=t,this._names=st(t.getAttribute("class")||"")}function dt(t,e){for(var n=ft(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function pt(t,e){for(var n=ft(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function mt(t){return function(){dt(this,t)}}function yt(t){return function(){pt(this,t)}}function gt(t,e){return function(){(e.apply(this,arguments)?dt:pt)(this,t)}}function vt(){this.textContent=""}function wt(t){return function(){this.textContent=t}}function bt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function xt(){this.innerHTML=""}function _t(t){return function(){this.innerHTML=t}}function Et(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function kt(){this.nextSibling&&this.parentNode.appendChild(this)}function St(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ct(){return null}function Tt(){var t=this.parentNode;t&&t.removeChild(this)}function At(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Nt(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}ht.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Pt={},zt=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(Pt={mouseenter:"mouseover",mouseleave:"mouseout"}));function Ot(t,e,n){return t=jt(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function jt(t,e,n){return function(r){var o=zt;zt=r;try{t.call(this,this.__data__,e,n)}finally{zt=o}}}function Mt(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function Ft(t){return function(){var e=this.__on;if(e){for(var n,r=0,o=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++o]=n:this.removeEventListener(n.type,n.listener,n.capture);++o?e.length=o:delete this.__on}}}function Dt(t,e,n){var r=Pt.hasOwnProperty(t.type)?Ot:jt;return function(o,i,a){var l,u=this.__on,c=r(e,i,a);if(u)for(var s=0,f=u.length;s<f;++s)if((l=u[s]).type===t.type&&l.name===t.name)return this.removeEventListener(l.type,l.listener,l.capture),this.addEventListener(l.type,l.listener=c,l.capture=n),void(l.value=e);this.addEventListener(t.type,c,n),l={type:t.type,name:t.name,value:e,listener:c,capture:n},u?u.push(l):this.__on=[l]}}function It(t,e,n,r){var o=zt;t.sourceEvent=zt,zt=t;try{return e.apply(n,r)}finally{zt=o}}function Bt(t,e,n){var r=nt(t),o=r.CustomEvent;"function"==typeof o?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function Lt(t,e){return function(){return Bt(this,t,e)}}function Rt(t,e){return function(){return Bt(this,t,e.apply(this,arguments))}}var qt=[null];function Ut(t,e){this._groups=t,this._parents=e}function Gt(t){return"string"==typeof t?new Ut([[document.querySelector(t)]],[document.documentElement]):new Ut([[t]],qt)}function $t(){for(var t,e=zt;t=e.sourceEvent;)e=t;return e}function Ht(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}function Vt(t){var e=$t();return e.changedTouches&&(e=e.changedTouches[0]),Ht(t,e)}function Wt(t,e,n){arguments.length<3&&(n=e,e=$t().changedTouches);for(var r,o=0,i=e?e.length:0;o<i;++o)if((r=e[o]).identifier===n)return Ht(t,r);return null}function Xt(){zt.stopImmediatePropagation()}function Yt(){zt.preventDefault(),zt.stopImmediatePropagation()}function Kt(t){var e=t.document.documentElement,n=Gt(t).on("dragstart.drag",Yt,!0);"onselectstart"in e?n.on("selectstart.drag",Yt,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Jt(t,e){var n=t.document.documentElement,r=Gt(t).on("dragstart.drag",null);e&&(r.on("click.drag",Yt,!0),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Qt(t){return function(){return t}}function Zt(t,e,n,r,o,i,a,l,u,c){this.target=t,this.type=e,this.subject=n,this.identifier=r,this.active=o,this.x=i,this.y=a,this.dx=l,this.dy=u,this._=c}function te(){return!zt.ctrlKey&&!zt.button}function ee(){return this.parentNode}function ne(t){return null==t?{x:zt.x,y:zt.y}:t}function re(){return navigator.maxTouchPoints||"ontouchstart"in this}Ut.prototype={constructor:Ut,select:function(t){"function"!=typeof t&&(t=G(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a,l=e[o],u=l.length,c=r[o]=new Array(u),s=0;s<u;++s)(i=l[s])&&(a=t.call(i,i.__data__,s,l))&&("__data__"in i&&(a.__data__=i.__data__),c[s]=a);return new Ut(r,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=function(t){return null==t?$:function(){return this.querySelectorAll(t)}}(t));for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var a,l=e[i],u=l.length,c=0;c<u;++c)(a=l[c])&&(r.push(t.call(a,a.__data__,c,l)),o.push(a));return new Ut(r,o)},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i,a=e[o],l=a.length,u=r[o]=[],c=0;c<l;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&u.push(i);return new Ut(r,this._parents)},data:function(t,e){if(!t)return d=new Array(this.size()),c=-1,this.each((function(t){d[++c]=t})),d;var n=e?X:W,r=this._parents,o=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var i=o.length,a=new Array(i),l=new Array(i),u=new Array(i),c=0;c<i;++c){var s=r[c],f=o[c],h=f.length,d=t.call(s,s&&s.__data__,c,r),p=d.length,m=l[c]=new Array(p),y=a[c]=new Array(p);n(s,f,m,y,u[c]=new Array(h),d,e);for(var g,v,w=0,b=0;w<p;++w)if(g=m[w]){for(w>=b&&(b=w+1);!(v=y[b])&&++b<p;);g._next=v||null}}return(a=new Ut(a,r))._enter=l,a._exit=u,a},enter:function(){return new Ut(this._enter||this._groups.map(H),this._parents)},exit:function(){return new Ut(this._exit||this._groups.map(H),this._parents)},join:function(t,e,n){var r=this.enter(),o=this,i=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(o=e(o)),null==n?i.remove():n(i),r&&o?r.merge(o).order():o},merge:function(t){for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),a=new Array(r),l=0;l<i;++l)for(var u,c=e[l],s=n[l],f=c.length,h=a[l]=new Array(f),d=0;d<f;++d)(u=c[d]||s[d])&&(h[d]=u);for(;l<r;++l)a[l]=e[l];return new Ut(a,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,o=t[e],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Y);for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a,l=n[i],u=l.length,c=o[i]=new Array(u),s=0;s<u;++s)(a=l[s])&&(c[s]=a);c.sort(e)}return new Ut(o,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each((function(){t[++e]=this})),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){var t=0;return this.each((function(){++t})),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o,i=e[n],a=0,l=i.length;a<l;++a)(o=i[a])&&t.call(o,o.__data__,a,i);return this},attr:function(t,e){var n=B(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?J:K:"function"==typeof e?n.local?et:tt:n.local?Z:Q)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?rt:"function"==typeof e?it:ot)(t,e,null==n?"":n)):at(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?lt:"function"==typeof e?ct:ut)(t,e)):this.node()[t]},classed:function(t,e){var n=st(t+"");if(arguments.length<2){for(var r=ft(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each(("function"==typeof e?gt:e?mt:yt)(n,e))},text:function(t){return arguments.length?this.each(null==t?vt:("function"==typeof t?bt:wt)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?xt:("function"==typeof t?Et:_t)(t)):this.node().innerHTML},raise:function(){return this.each(kt)},lower:function(){return this.each(St)},append:function(t){var e="function"==typeof t?t:q(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:q(t),r=null==e?Ct:"function"==typeof e?e:G(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Tt)},clone:function(t){return this.select(t?Nt:At)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,o,i=Mt(t+""),a=i.length;if(!(arguments.length<2)){for(l=e?Dt:Ft,null==n&&(n=!1),r=0;r<a;++r)this.each(l(i[r],e,n));return this}var l=this.node().__on;if(l)for(var u,c=0,s=l.length;c<s;++c)for(r=0,u=l[c];r<a;++r)if((o=i[r]).type===u.type&&o.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?Rt:Lt)(t,e))}},Zt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var oe=Math.SQRT2;function ie(t){return((t=Math.exp(t))+1/t)/2}function ae(t,e){var n,r,o=t[0],i=t[1],a=t[2],l=e[0],u=e[1],c=e[2],s=l-o,f=u-i,h=s*s+f*f;if(h<1e-12)r=Math.log(c/a)/oe,n=function(t){return[o+t*s,i+t*f,a*Math.exp(oe*t*r)]};else{var d=Math.sqrt(h),p=(c*c-a*a+4*h)/(2*a*2*d),m=(c*c-a*a-4*h)/(2*c*2*d),y=Math.log(Math.sqrt(p*p+1)-p),g=Math.log(Math.sqrt(m*m+1)-m);r=(g-y)/oe,n=function(t){var e=t*r,n=ie(y),l=a/(2*d)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(oe*e+y)-function(t){return((t=Math.exp(t))-1/t)/2}(y));return[o+l*s,i+l*f,a*n/ie(oe*e+y)]}}return n.duration=1e3*r,n}function le(t){return function(){return t}}function ue(){return 1e-6*(Math.random()-.5)}function ce(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var o,i,a,l,u,c,s,f,h,d=t._root,p={data:r},m=t._x0,y=t._y0,g=t._x1,v=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(i=(m+g)/2))?m=i:g=i,(s=n>=(a=(y+v)/2))?y=a:v=a,o=d,!(d=d[f=s<<1|c]))return o[f]=p,t;if(l=+t._x.call(null,d.data),u=+t._y.call(null,d.data),e===l&&n===u)return p.next=d,o?o[f]=p:t._root=p,t;do{o=o?o[f]=new Array(4):t._root=new Array(4),(c=e>=(i=(m+g)/2))?m=i:g=i,(s=n>=(a=(y+v)/2))?y=a:v=a}while((f=s<<1|c)==(h=(u>=a)<<1|l>=i));return o[h]=d,o[f]=p,t}function se(t,e,n,r,o){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=o}function fe(t){return t[0]}function he(t){return t[1]}function de(t,e,n){var r=new pe(null==e?fe:e,null==n?he:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function pe(t,e,n,r,o,i){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=o,this._y1=i,this._root=void 0}function me(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var ye=de.prototype=pe.prototype;function ge(t){return t.x+t.vx}function ve(t){return t.y+t.vy}function we(t){return t.index}function be(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}function xe(t){return t.x}function _e(t){return t.y}ye.copy=function(){var t,e,n=new pe(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=me(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var o=0;o<4;++o)(e=r.source[o])&&(e.length?t.push({source:e,target:r.target[o]=new Array(4)}):r.target[o]=me(e));return n},ye.add=function(t){var e=+this._x.call(null,t),n=+this._y.call(null,t);return ce(this.cover(e,n),e,n,t)},ye.addAll=function(t){var e,n,r,o,i=t.length,a=new Array(i),l=new Array(i),u=1/0,c=1/0,s=-1/0,f=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(o=+this._y.call(null,e))||(a[n]=r,l[n]=o,r<u&&(u=r),r>s&&(s=r),o<c&&(c=o),o>f&&(f=o));if(u>s||c>f)return this;for(this.cover(u,c).cover(s,f),n=0;n<i;++n)ce(this,a[n],l[n],t[n]);return this},ye.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,o=this._x1,i=this._y1;if(isNaN(n))o=(n=Math.floor(t))+1,i=(r=Math.floor(e))+1;else{for(var a,l,u=o-n,c=this._root;n>t||t>=o||r>e||e>=i;)switch(l=(e<r)<<1|t<n,(a=new Array(4))[l]=c,c=a,u*=2,l){case 0:o=n+u,i=r+u;break;case 1:n=o-u,i=r+u;break;case 2:o=n+u,r=i-u;break;case 3:n=o-u,r=i-u}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=o,this._y1=i,this},ye.data=function(){var t=[];return this.visit((function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)})),t},ye.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]]},ye.find=function(t,e,n){var r,o,i,a,l,u,c,s=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],m=this._root;for(m&&p.push(new se(m,s,f,h,d)),null==n?n=1/0:(s=t-n,f=e-n,h=t+n,d=e+n,n*=n);u=p.pop();)if(!(!(m=u.node)||(o=u.x0)>h||(i=u.y0)>d||(a=u.x1)<s||(l=u.y1)<f))if(m.length){var y=(o+a)/2,g=(i+l)/2;p.push(new se(m[3],y,g,a,l),new se(m[2],o,g,y,l),new se(m[1],y,i,a,g),new se(m[0],o,i,y,g)),(c=(e>=g)<<1|t>=y)&&(u=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=u)}else{var v=t-+this._x.call(null,m.data),w=e-+this._y.call(null,m.data),b=v*v+w*w;if(b<n){var x=Math.sqrt(n=b);s=t-x,f=e-x,h=t+x,d=e+x,r=m.data}}return r},ye.remove=function(t){if(isNaN(i=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,o,i,a,l,u,c,s,f,h,d=this._root,p=this._x0,m=this._y0,y=this._x1,g=this._y1;if(!d)return this;if(d.length)for(;;){if((c=i>=(l=(p+y)/2))?p=l:y=l,(s=a>=(u=(m+g)/2))?m=u:g=u,e=d,!(d=d[f=s<<1|c]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(o=d.next)&&delete d.next,r?(o?r.next=o:delete r.next,this):e?(o?e[f]=o:delete e[f],(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=o,this)},ye.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},ye.root=function(){return this._root},ye.size=function(){var t=0;return this.visit((function(e){if(!e.length)do{++t}while(e=e.next)})),t},ye.visit=function(t){var e,n,r,o,i,a,l=[],u=this._root;for(u&&l.push(new se(u,this._x0,this._y0,this._x1,this._y1));e=l.pop();)if(!t(u=e.node,r=e.x0,o=e.y0,i=e.x1,a=e.y1)&&u.length){var c=(r+i)/2,s=(o+a)/2;(n=u[3])&&l.push(new se(n,c,s,i,a)),(n=u[2])&&l.push(new se(n,r,s,c,a)),(n=u[1])&&l.push(new se(n,c,o,i,s)),(n=u[0])&&l.push(new se(n,r,o,c,s))}return this},ye.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new se(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var o=e.node;if(o.length){var i,a=e.x0,l=e.y0,u=e.x1,c=e.y1,s=(a+u)/2,f=(l+c)/2;(i=o[0])&&n.push(new se(i,a,l,s,f)),(i=o[1])&&n.push(new se(i,s,l,u,f)),(i=o[2])&&n.push(new se(i,a,f,s,c)),(i=o[3])&&n.push(new se(i,s,f,u,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},ye.x=function(t){return arguments.length?(this._x=t,this):this._x},ye.y=function(t){return arguments.length?(this._y=t,this):this._y};var Ee=Math.PI*(3-Math.sqrt(5));var ke=function(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");function Se(){for(var t,e=y;t=e.sourceEvent;)e=t;return e}function Ce(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(t.getScreenCTM().inverse())).x,r.y]}var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}function Te(t){var e=Se();return e.changedTouches&&(e=e.changedTouches[0]),Ce(t,e)}function Ae(t,e,n){arguments.length<3&&(n=e,e=Se().changedTouches);for(var r,o=0,i=e?e.length:0;o<i;++o)if((r=e[o]).identifier===n)return Ce(t,r);return null}function Ne(t){return function(){return t}}function Pe(t,e,n){this.target=t,this.type=e,this.transform=n}function ze(){y.stopImmediatePropagation()}function Oe(){y.preventDefault(),y.stopImmediatePropagation()}function je(){return!y.ctrlKey&&!y.button}function Me(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Fe(){return this.__zoom||v}function De(){return-y.deltaY*(1===y.deltaMode?.05:y.deltaMode?1:.002)}function Ie(){return navigator.maxTouchPoints||"ontouchstart"in this}function Be(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}var Le={fullscreenEnabled:0,fullscreenElement:1,requestFullscreen:2,exitFullscreen:3,fullscreenchange:4,fullscreenerror:5,fullscreen:6},Re=["webkitFullscreenEnabled","webkitFullscreenElement","webkitRequestFullscreen","webkitExitFullscreen","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],qe=["mozFullScreenEnabled","mozFullScreenElement","mozRequestFullScreen","mozCancelFullScreen","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],Ue=["msFullscreenEnabled","msFullscreenElement","msRequestFullscreen","msExitFullscreen","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"],Ge="undefined"!=typeof window&&void 0!==window.document?window.document:{},$e="fullscreenEnabled"in Ge&&Object.keys(Le)||Re[0]in Ge&&Re||qe[0]in Ge&&qe||Ue[0]in Ge&&Ue||[],He={requestFullscreen:function(t){return t[$e[Le.requestFullscreen]]()},requestFullscreenFunction:function(t){return t[$e[Le.requestFullscreen]]},get exitFullscreen(){return Ge[$e[Le.exitFullscreen]].bind(Ge)},get fullscreenPseudoClass(){return":"+$e[Le.fullscreen]},addEventListener:function(t,e,n){return Ge.addEventListener($e[Le[t]],e,n)},removeEventListener:function(t,e,n){return Ge.removeEventListener($e[Le[t]],e,n)},get fullscreenEnabled(){return Boolean(Ge[$e[Le.fullscreenEnabled]])},set fullscreenEnabled(t){},get fullscreenElement(){return Ge[$e[Le.fullscreenElement]]},set fullscreenElement(t){},get onfullscreenchange(){return Ge[("on"+$e[Le.fullscreenchange]).toLowerCase()]},set onfullscreenchange(t){return Ge[("on"+$e[Le.fullscreenchange]).toLowerCase()]=t},get onfullscreenerror(){return Ge[("on"+$e[Le.fullscreenerror]).toLowerCase()]},set onfullscreenerror(t){return Ge[("on"+$e[Le.fullscreenerror]).toLowerCase()]=t}},Ve=He;var We=function(){return We=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},We.apply(this,arguments)},Xe=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 o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n};var Ye,Ke=(Ye=function(t,e){return Ye=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])},Ye(t,e)},function(t,e){function n(){this.constructor=t}Ye(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),Je=function(){return Je=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},Je.apply(this,arguments)},Qe=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function l(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,l)}u((r=r.apply(t,e||[])).next())}))},Ze=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}},tn=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 o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n},en=function(t){return!!t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then},nn=function(t,e){return{left:window.outerWidth/2+(window.screenX||window.screenLeft||0)-t/2,top:window.outerHeight/2+(window.screenY||window.screenTop||0)-e/2}},rn=function(t,e){return{top:(window.screen.height-e)/2,left:(window.screen.width-t)/2}};function on(t,e,n){var r=e.height,o=e.width,i=tn(e,["height","width"]),a=Je({height:r,width:o,location:"no",toolbar:"no",status:"no",directories:"no",menubar:"no",scrollbars:"yes",resizable:"no",centerscreen:"yes",chrome:"yes"},i),l=window.open(t,"",Object.keys(a).map((function(t){return t+"="+a[t]})).join(", "));if(n)var u=window.setInterval((function(){try{(null===l||l.closed)&&(window.clearInterval(u),n(l))}catch(t){console.error(t)}}),1e3);return l}var an=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.openShareDialog=function(t){var n=e.props,r=n.onShareWindowClose,o=n.windowHeight,i=void 0===o?400:o,a=n.windowPosition,l=void 0===a?"windowCenter":a,u=n.windowWidth,c=void 0===u?550:u;on(t,Je({height:i,width:c},"windowCenter"===l?nn(c,i):rn(c,i)),r)},e.handleClick=function(t){return Qe(e,void 0,void 0,(function(){var e,n,r,o,i,a,l,u,c,s;return Ze(this,(function(f){switch(f.label){case 0:return e=this.props,n=e.beforeOnClick,r=e.disabled,o=e.networkLink,i=e.onClick,a=e.url,l=e.openShareDialogOnClick,u=e.opts,c=o(a,u),r?[2]:(t.preventDefault(),n?(s=n(),en(s)?[4,s]:[3,2]):[3,2]);case 1:f.sent(),f.label=2;case 2:return l&&this.openShareDialog(c),i&&i(t,c),[2]}}))}))},e}return Ke(n,t),n.prototype.render=function(){var t=this.props;t.beforeOnClick;var n=t.children,r=t.className,o=t.disabled,i=t.disabledStyle,a=t.forwardedRef;t.networkLink;var l=t.networkName;t.onShareWindowClose,t.openShareDialogOnClick,t.opts;var u=t.resetButtonStyle,c=t.style;t.url,t.windowHeight,t.windowPosition,t.windowWidth;var f=tn(t,["beforeOnClick","children","className","disabled","disabledStyle","forwardedRef","networkLink","networkName","onShareWindowClose","openShareDialogOnClick","opts","resetButtonStyle","style","url","windowHeight","windowPosition","windowWidth"]),h=s("react-share__ShareButton",{"react-share__ShareButton--disabled":!!o,disabled:!!o},r),d=Je(Je(u?{backgroundColor:"transparent",border:"none",padding:0,font:"inherit",color:"inherit",cursor:"pointer"}:{},c),o&&i);return e.createElement("button",Je({},f,{"aria-label":f["aria-label"]||l,className:h,onClick:this.handleClick,ref:a,style:d}),n)},n.defaultProps={disabledStyle:{opacity:.6},openShareDialogOnClick:!0,resetButtonStyle:!0},n}(l),ln=an,un=function(){return un=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},un.apply(this,arguments)};var cn,sn,fn=(cn={color:"#3b5998",networkName:"facebook",path:"M34.1,47V33.3h4.6l0.7-5.3h-5.3v-3.4c0-1.5,0.4-2.6,2.6-2.6l2.8,0v-4.8c-0.5-0.1-2.2-0.2-4.1-0.2 c-4.1,0-6.9,2.5-6.9,7V28H24v5.3h4.6V47H34.1z"},(sn=function(t){var n=t.bgStyle,r=t.borderRadius,o=t.iconFillColor,i=t.round,a=t.size,l=Xe(t,["bgStyle","borderRadius","iconFillColor","round","size"]);return e.createElement("svg",We({viewBox:"0 0 64 64",width:a,height:a},l),i?e.createElement("circle",{cx:"32",cy:"32",r:"31",fill:cn.color,style:n}):e.createElement("rect",{width:"64",height:"64",rx:r,ry:r,fill:cn.color,style:n}),e.createElement("path",{d:cn.path,fill:o}))}).defaultProps={bgStyle:{},borderRadius:0,iconFillColor:"white",size:64},sn),hn=function(){var t=function(e,n){return t=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])},t(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),dn=function(t){function e(e){var n=t.call(this,e)||this;return n.name="AssertionError",n}return hn(e,t),e}(Error);var pn=function(t,n,r,o){function i(i,a){var l=r(i),u=un({},i);return Object.keys(l).forEach((function(t){delete u[t]})),e.createElement(ln,un({},o,u,{forwardedRef:a,networkName:t,networkLink:n,opts:r(i)}))}return i.displayName="ShareButton-"+t,u(i)}("facebook",(function(t,e){var n,r,o=e.quote,i=e.hashtag;return function(t,e){if(!t)throw new dn(e)}(t,"facebook.url"),"https://www.facebook.com/sharer/sharer.php"+(n={u:t,quote:o,hashtag:i},r=Object.entries(n).filter((function(t){return null!=t[1]})).map((function(t){var e=t[0],n=t[1];return encodeURIComponent(e)+"="+encodeURIComponent(String(n))})),r.length>0?"?"+r.join("&"):"")}),(function(t){return{quote:t.quote,hashtag:t.hashtag}}),{windowWidth:550,windowHeight:400}),mn=pn,yn=f((function(t){
2
- /*!
3
- * screenfull
4
- * v5.2.0 - 2021-11-03
5
- * (c) Sindre Sorhus; MIT License
6
- */
7
- !function(){var e="undefined"!=typeof window&&void 0!==window.document?window.document:{},n=t.exports,r=function(){for(var t,n=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],r=0,o=n.length,i={};r<o;r++)if((t=n[r])&&t[1]in e){for(r=0;r<t.length;r++)i[n[0][r]]=t[r];return i}return!1}(),o={change:r.fullscreenchange,error:r.fullscreenerror},i={request:function(t,n){return new Promise(function(o,i){var a=function(){this.off("change",a),o()}.bind(this);this.on("change",a);var l=(t=t||e.documentElement)[r.requestFullscreen](n);l instanceof Promise&&l.then(a).catch(i)}.bind(this))},exit:function(){return new Promise(function(t,n){if(this.isFullscreen){var o=function(){this.off("change",o),t()}.bind(this);this.on("change",o);var i=e[r.exitFullscreen]();i instanceof Promise&&i.then(o).catch(n)}else t()}.bind(this))},toggle:function(t,e){return this.isFullscreen?this.exit():this.request(t,e)},onchange:function(t){this.on("change",t)},onerror:function(t){this.on("error",t)},on:function(t,n){var r=o[t];r&&e.addEventListener(r,n,!1)},off:function(t,n){var r=o[t];r&&e.removeEventListener(r,n,!1)},raw:r};r?(Object.defineProperties(i,{isFullscreen:{get:function(){return Boolean(e[r.fullscreenElement])}},element:{enumerable:!0,get:function(){return e[r.fullscreenElement]}},isEnabled:{enumerable:!0,get:function(){return Boolean(e[r.fullscreenEnabled])}}}),n?t.exports=i:window.screenfull=i):n?t.exports={isEnabled:!1}:window.screenfull={isEnabled:!1}}()}));yn.isEnabled;var gn=f((function(t,e){window,t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=8)}([function(t,e,n){t.exports=n(2)},function(t,e,n){var r=n(4);"string"==typeof r&&(r=[[t.i,r,""]]);var o={hmr:!0,transform:void 0,insertInto:void 0};n(6)(r,o),r.locals&&(t.exports=r.locals)},function(t,e,n){
8
- /** @license React v16.5.2
9
- * react.production.min.js
10
- *
11
- * Copyright (c) Facebook, Inc. and its affiliates.
12
- *
13
- * This source code is licensed under the MIT license found in the
14
- * LICENSE file in the root directory of this source tree.
15
- */
16
- var r=n(3),o="function"==typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,a=o?Symbol.for("react.portal"):60106,l=o?Symbol.for("react.fragment"):60107,u=o?Symbol.for("react.strict_mode"):60108,c=o?Symbol.for("react.profiler"):60114,s=o?Symbol.for("react.provider"):60109,f=o?Symbol.for("react.context"):60110,h=o?Symbol.for("react.async_mode"):60111,d=o?Symbol.for("react.forward_ref"):60112,p="function"==typeof Symbol&&Symbol.iterator;function m(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(t,e,n,r,o,i,a,l){if(!t){if(t=void 0,void 0===e)t=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,a,l],c=0;(t=Error(e.replace(/%s/g,(function(){return u[c++]})))).name="Invariant Violation"}throw t.framesToPop=1,t}}(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g={};function v(t,e,n){this.props=t,this.context=e,this.refs=g,this.updater=n||y}function w(){}function b(t,e,n){this.props=t,this.context=e,this.refs=g,this.updater=n||y}v.prototype.isReactComponent={},v.prototype.setState=function(t,e){"object"!=typeof t&&"function"!=typeof t&&null!=t&&m("85"),this.updater.enqueueSetState(this,t,e,"setState")},v.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},w.prototype=v.prototype;var x=b.prototype=new w;x.constructor=b,r(x,v.prototype),x.isPureReactComponent=!0;var _={current:null,currentDispatcher:null},E=Object.prototype.hasOwnProperty,k={key:!0,ref:!0,__self:!0,__source:!0};function S(t,e,n){var r=void 0,o={},a=null,l=null;if(null!=e)for(r in void 0!==e.ref&&(l=e.ref),void 0!==e.key&&(a=""+e.key),e)E.call(e,r)&&!k.hasOwnProperty(r)&&(o[r]=e[r]);var u=arguments.length-2;if(1===u)o.children=n;else if(1<u){for(var c=Array(u),s=0;s<u;s++)c[s]=arguments[s+2];o.children=c}if(t&&t.defaultProps)for(r in u=t.defaultProps)void 0===o[r]&&(o[r]=u[r]);return{$$typeof:i,type:t,key:a,ref:l,props:o,_owner:_.current}}function C(t){return"object"==typeof t&&null!==t&&t.$$typeof===i}var T=/\/+/g,A=[];function N(t,e,n,r){if(A.length){var o=A.pop();return o.result=t,o.keyPrefix=e,o.func=n,o.context=r,o.count=0,o}return{result:t,keyPrefix:e,func:n,context:r,count:0}}function P(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>A.length&&A.push(t)}function z(t,e,n){return null==t?0:function t(e,n,r,o){var l=typeof e;"undefined"!==l&&"boolean"!==l||(e=null);var u=!1;if(null===e)u=!0;else switch(l){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case i:case a:u=!0}}if(u)return r(o,e,""===n?"."+O(e,0):n),1;if(u=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c<e.length;c++){var s=n+O(l=e[c],c);u+=t(l,s,r,o)}else if("function"==typeof(s=null===e||"object"!=typeof e?null:"function"==typeof(s=p&&e[p]||e["@@iterator"])?s:null))for(e=s.call(e),c=0;!(l=e.next()).done;)u+=t(l=l.value,s=n+O(l,c++),r,o);else"object"===l&&m("31","[object Object]"==(r=""+e)?"object with keys {"+Object.keys(e).join(", ")+"}":r,"");return u}(t,"",e,n)}function O(t,e){return"object"==typeof t&&null!==t&&null!=t.key?function(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,(function(t){return e[t]}))}(t.key):e.toString(36)}function j(t,e){t.func.call(t.context,e,t.count++)}function M(t,e,n){var r=t.result,o=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?F(t,r,n,(function(t){return t})):null!=t&&(C(t)&&(t=function(t,e){return{$$typeof:i,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}(t,o+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(T,"$&/")+"/")+n)),r.push(t))}function F(t,e,n,r,o){var i="";null!=n&&(i=(""+n).replace(T,"$&/")+"/"),z(t,M,e=N(e,i,r,o)),P(e)}var D={Children:{map:function(t,e,n){if(null==t)return t;var r=[];return F(t,r,null,e,n),r},forEach:function(t,e,n){if(null==t)return t;z(t,j,e=N(null,null,e,n)),P(e)},count:function(t){return z(t,(function(){return null}),null)},toArray:function(t){var e=[];return F(t,e,null,(function(t){return t})),e},only:function(t){return C(t)||m("143"),t}},createRef:function(){return{current:null}},Component:v,PureComponent:b,createContext:function(t,e){return void 0===e&&(e=null),(t={$$typeof:f,_calculateChangedBits:e,_currentValue:t,_currentValue2:t,Provider:null,Consumer:null,unstable_read:null}).Provider={$$typeof:s,_context:t},t.Consumer=t,t.unstable_read=function(t,e){var n=_.currentDispatcher;return null===n&&m("277"),n.readContext(t,e)}.bind(null,t),t},forwardRef:function(t){return{$$typeof:d,render:t}},Fragment:l,StrictMode:u,unstable_AsyncMode:h,unstable_Profiler:c,createElement:S,cloneElement:function(t,e,n){null==t&&m("267",t);var o=void 0,a=r({},t.props),l=t.key,u=t.ref,c=t._owner;if(null!=e){void 0!==e.ref&&(u=e.ref,c=_.current),void 0!==e.key&&(l=""+e.key);var s=void 0;for(o in t.type&&t.type.defaultProps&&(s=t.type.defaultProps),e)E.call(e,o)&&!k.hasOwnProperty(o)&&(a[o]=void 0===e[o]&&void 0!==s?s[o]:e[o])}if(1==(o=arguments.length-2))a.children=n;else if(1<o){s=Array(o);for(var f=0;f<o;f++)s[f]=arguments[f+2];a.children=s}return{$$typeof:i,type:t.type,key:l,ref:u,props:a,_owner:c}},createFactory:function(t){var e=S.bind(null,t);return e.type=t,e},isValidElement:C,version:"16.5.2",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:_,assign:r}},I={default:D},B=I&&D||I;t.exports=B.default||B},function(t,e,n){
17
- /*
18
- object-assign
19
- (c) Sindre Sorhus
20
- @license MIT
21
- */
22
- var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(t){r[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,a,l=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var c in n=Object(arguments[u]))o.call(n,c)&&(l[c]=n[c]);if(r){a=r(n);for(var s=0;s<a.length;s++)i.call(n,a[s])&&(l[a[s]]=n[a[s]])}}return l}},function(t,e,n){(t.exports=n(5)(!1)).push([t.i,".font-size-changer {\n display: inline-block; }\n .font-size-changer .font-size-changer-buttons > div {\n float: left;\n border: 1px solid;\n text-align: center;\n line-height: 40px;\n -webkit-box-sizing: border-box;\n /* Safari/Chrome, other WebKit */\n -moz-box-sizing: border-box;\n /* Firefox, other Gecko */\n box-sizing: border-box;\n -webkit-touch-callout: none;\n /* iOS Safari */\n -webkit-user-select: none;\n /* Safari */\n -khtml-user-select: none;\n /* Konqueror HTML */\n -moz-user-select: none;\n /* Firefox */\n -ms-user-select: none;\n /* Internet Explorer/Edge */\n user-select: none;\n /* Non-prefixed version, currently\r\n supported by Chrome and Opera */ }\n",""])},function(t,e){t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",r=t[3];if(!r)return n;if(e&&"function"==typeof btoa){var o=function(t){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t))))+" */"}(r),i=r.sources.map((function(t){return"/*# sourceURL="+r.sourceRoot+t+" */"}));return[n].concat(i).concat([o]).join("\n")}return[n].join("\n")}(e,t);return e[2]?"@media "+e[2]+"{"+n+"}":n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];"number"==typeof i&&(r[i]=!0)}for(o=0;o<t.length;o++){var a=t[o];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),e.push(a))}},e}},function(t,e,n){var r={},o=function(t){var e;return function(){return void 0===e&&(e=t.apply(this,arguments)),e}}((function(){return window&&document&&document.all&&!window.atob})),i=function(t){var e={};return function(t,n){if("function"==typeof t)return t();if(void 0===e[t]){var r=function(t,e){return e?e.querySelector(t):document.querySelector(t)}.call(this,t,n);if(window.HTMLIFrameElement&&r instanceof window.HTMLIFrameElement)try{r=r.contentDocument.head}catch(t){r=null}e[t]=r}return e[t]}}(),a=null,l=0,u=[],c=n(7);function s(t,e){for(var n=0;n<t.length;n++){var o=t[n],i=r[o.id];if(i){i.refs++;for(var a=0;a<i.parts.length;a++)i.parts[a](o.parts[a]);for(;a<o.parts.length;a++)i.parts.push(y(o.parts[a],e))}else{var l=[];for(a=0;a<o.parts.length;a++)l.push(y(o.parts[a],e));r[o.id]={id:o.id,refs:1,parts:l}}}}function f(t,e){for(var n=[],r={},o=0;o<t.length;o++){var i=t[o],a=e.base?i[0]+e.base:i[0],l={css:i[1],media:i[2],sourceMap:i[3]};r[a]?r[a].parts.push(l):n.push(r[a]={id:a,parts:[l]})}return n}function h(t,e){var n=i(t.insertInto);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");var r=u[u.length-1];if("top"===t.insertAt)r?r.nextSibling?n.insertBefore(e,r.nextSibling):n.appendChild(e):n.insertBefore(e,n.firstChild),u.push(e);else if("bottom"===t.insertAt)n.appendChild(e);else{if("object"!=typeof t.insertAt||!t.insertAt.before)throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");var o=i(t.insertAt.before,n);n.insertBefore(e,o)}}function d(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t);var e=u.indexOf(t);e>=0&&u.splice(e,1)}function p(t){var e=document.createElement("style");if(void 0===t.attrs.type&&(t.attrs.type="text/css"),void 0===t.attrs.nonce){var r=n.nc;r&&(t.attrs.nonce=r)}return m(e,t.attrs),h(t,e),e}function m(t,e){Object.keys(e).forEach((function(n){t.setAttribute(n,e[n])}))}function y(t,e){var n,r,o,i;if(e.transform&&t.css){if(!(i=e.transform(t.css)))return function(){};t.css=i}if(e.singleton){var u=l++;n=a||(a=p(e)),r=v.bind(null,n,u,!1),o=v.bind(null,n,u,!0)}else t.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(t){var e=document.createElement("link");return void 0===t.attrs.type&&(t.attrs.type="text/css"),t.attrs.rel="stylesheet",m(e,t.attrs),h(t,e),e}(e),r=function(t,e,n){var r=n.css,o=n.sourceMap,i=void 0===e.convertToAbsoluteUrls&&o;(e.convertToAbsoluteUrls||i)&&(r=c(r)),o&&(r+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(o))))+" */");var a=new Blob([r],{type:"text/css"}),l=t.href;t.href=URL.createObjectURL(a),l&&URL.revokeObjectURL(l)}.bind(null,n,e),o=function(){d(n),n.href&&URL.revokeObjectURL(n.href)}):(n=p(e),r=function(t,e){var n=e.css,r=e.media;if(r&&t.setAttribute("media",r),t.styleSheet)t.styleSheet.cssText=n;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(n))}}.bind(null,n),o=function(){d(n)});return r(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;r(t=e)}else o()}}t.exports=function(t,e){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(e=e||{}).attrs="object"==typeof e.attrs?e.attrs:{},e.singleton||"boolean"==typeof e.singleton||(e.singleton=o()),e.insertInto||(e.insertInto="head"),e.insertAt||(e.insertAt="bottom");var n=f(t,e);return s(n,e),function(t){for(var o=[],i=0;i<n.length;i++){var a=n[i];(l=r[a.id]).refs--,o.push(l)}for(t&&s(f(t,e),e),i=0;i<o.length;i++){var l;if(0===(l=o[i]).refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete r[l.id]}}}};var g=function(){var t=[];return function(e,n){return t[e]=n,t.filter(Boolean).join("\n")}}();function v(t,e,n,r){var o=n?"":r.css;if(t.styleSheet)t.styleSheet.cssText=g(e,o);else{var i=document.createTextNode(o),a=t.childNodes;a[e]&&t.removeChild(a[e]),a.length?t.insertBefore(i,a[e]):t.appendChild(i)}}},function(t,e){t.exports=function(t){var e="undefined"!=typeof window&&window.location;if(!e)throw new Error("fixUrls requires window.location");if(!t||"string"!=typeof t)return t;var n=e.protocol+"//"+e.host,r=n+e.pathname.replace(/\/[^\/]*$/,"/");return t.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(t,e){var o,i=e.trim().replace(/^"(.*)"$/,(function(t,e){return e})).replace(/^'(.*)'$/,(function(t,e){return e}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(i)?t:(o=0===i.indexOf("//")?i:0===i.indexOf("/")?n+i:r+i.replace(/^\.\//,""),"url("+JSON.stringify(o)+")")}))}},function(t,e,n){n.r(e);var r=n(0),o=n.n(r),i="up",a="down";function l(t){return(l="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})(t)}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function c(t){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}var h=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e){return!e||"object"!==l(e)&&"function"!=typeof e?f(t):e}(this,c(e).call(this))).onClick=t.onClick.bind(f(f(t))),t}return function(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}}),e&&s(t,e)}(e,r.Component),function(t,e,n){e&&u(t.prototype,e),n&&u(t,n)}(e,[{key:"onClick",value:function(){(0,this.props.onClick)()}},{key:"getDefaultButtonContent",value:function(){var t=this.props.direction===i?"36px":"20px";return o.a.createElement("span",{style:{fontSize:t}},"A")}},{key:"render",value:function(){var t=this.props.direction,e=this.props,n=e.style,r=void 0===n?{}:n,i=e.customButton,a=void 0===i?this.getDefaultButtonContent():i;return o.a.createElement("div",{className:"font-size-".concat(t),style:r,onClick:this.onClick},a)}}]),e}();function d(t){return(d="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})(t)}function p(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function m(t){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function g(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}n(1);var v=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=function(t,e){return!e||"object"!==d(e)&&"function"!=typeof e?g(t):e}(this,m(e).call(this))).handleChange.bind(g(g(t))),t.setChangeDirection.bind(g(g(t))),t.state={options:{stepSize:2,range:3},changeCount:0,changeDirection:null},t}return function(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}}),e&&y(t,e)}(e,r.Component),function(t,e,n){e&&p(t.prototype,e),n&&p(t,n)}(e,[{key:"handleChange",value:function(t,e,n){this.props.onChange&&(0,this.props.onChange)(t,e,n)}},{key:"componentDidMount",value:function(){var t=this.props.options;this.setState({options:Object.assign({},this.state.options,t)})}},{key:"getFontSizeDetails",value:function(t){var e=parseFloat(t);return{value:e,unit:t.toString().replace(e.toString(),"")}}},{key:"applyFontSize",value:function(t){var e=this.state.options.stepSize,n=this.state.changeDirection===i?e:-1*e,r=window.getComputedStyle(t,null).getPropertyValue("font-size"),o=this.getFontSizeDetails(r).value,a=o+n;t.style.fontSize=a+"px",a!==o&&this.handleChange(t,a,o)}},{key:"iterateChildren",value:function(t){if(this.applyFontSize(t),t.children&&0!==t.children.length){var e=!0,n=!1,r=void 0;try{for(var o,i=t.children[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value;this.iterateChildren(a)}}catch(t){n=!0,r=t}finally{try{e||null==i.return||i.return()}finally{if(n)throw r}}}}},{key:"updateChangeCount",value:function(){var t=this.state,e=t.changeCount,n=t.changeDirection===i?1:-1;this.setState({changeCount:e+n})}},{key:"iterateElementsAndApplyFontSizeChange",value:function(){var t=this.props.targets,e=!0,n=!1,r=void 0;try{for(var o,i=t[Symbol.iterator]();!(e=(o=i.next()).done);e=!0){var a=o.value,l=document.querySelectorAll(a),u=!0,c=!1,s=void 0;try{for(var f,h=l[Symbol.iterator]();!(u=(f=h.next()).done);u=!0){var d=f.value;this.iterateChildren(d)}}catch(t){c=!0,s=t}finally{try{u||null==h.return||h.return()}finally{if(c)throw s}}}}catch(t){n=!0,r=t}finally{try{e||null==i.return||i.return()}finally{if(n)throw r}}this.updateChangeCount()}},{key:"validateChangePerRange",value:function(){var t=this.state,e=t.changeCount,n=t.changeDirection,r=this.state.options.range,o=!0;return n===i&&e>=r&&(o=!1),n===a&&e<=-1*r&&(o=!1),o}},{key:"initFontSizeChange",value:function(){this.validateChangePerRange()&&this.iterateElementsAndApplyFontSizeChange()}},{key:"setChangeDirection",value:function(t,e){var n=t?i:a;this.setState({changeDirection:n},e)}},{key:"onFontSizeUp",value:function(){this.setChangeDirection(!0,this.initFontSizeChange)}},{key:"onFontSizeDown",value:function(){this.setChangeDirection(!1,this.initFontSizeChange)}},{key:"getFontSizeChangerStyle",value:function(t){var e=t.style,n=void 0===e?{}:e,r=t.verticalAlignment,o=void 0!==r&&r,i=t.buttonsMargin,a=void 0===i?4:i,l=this.getFontSizeDetails(n.width||"40px"),u=this.getFontSizeDetails(n.height||"40px");return{width:(!1===o?2*l.value+a:l.value)+l.unit,height:(!1===o?u.value:2*u.value+a)+u.unit}}},{key:"getFontSizeChangerButtonStyle",value:function(t,e){var n=e.style,r=void 0===n?{}:n,o=e.verticalAlignment,l=void 0!==o&&o,u=e.reverseOrder,c=void 0!==u&&u,s=e.buttonsMargin,f=void 0===s?4:s,h=this.getFontSizeDetails(r.width||"40px"),d=this.getFontSizeDetails(r.height||"40px"),p={width:h.value+h.unit,height:d.value+d.unit},m=f+(!1===l?h.unit:d.unit);return(t===i&&!1===c||t===a&&!0===c)&&(!1===l?p.marginRight=m:p.marginBottom=m),Object.assign({},r,p)}},{key:"render",value:function(){var t=this.props.customButtons,e=void 0===t?{}:t,n=e.up,r=e.down,l=this.getFontSizeChangerStyle(e),u=this.getFontSizeChangerButtonStyle(i,e),c=this.getFontSizeChangerButtonStyle(a,e);return o.a.createElement("div",{className:"font-size-changer",style:l},o.a.createElement("div",{className:"font-size-changer-buttons",style:l},o.a.createElement(h,{direction:i,customButton:n,onClick:this.onFontSizeUp.bind(this),style:u}),o.a.createElement(h,{direction:a,customButton:r,onClick:this.onFontSizeDown.bind(this),style:c})))}}]),e}();e.default=v}])})),vn=h(gn),wn=f((function(t){!function(e){var n=function(){return{escape:function(t){return t.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1")},parseExtension:t,mimeType:function(e){var n=t(e).toLowerCase();return(r="application/font-woff",o="image/jpeg",{woff:r,woff2:r,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:o,jpeg:o,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml"})[n]||"";var r,o},dataAsUrl:function(t,e){return"data:"+e+";base64,"+t},isDataUrl:function(t){return-1!==t.search(/^(data:)/)},canvasToBlob:function(t){return t.toBlob?new Promise((function(e){t.toBlob(e)})):function(t){return new Promise((function(e){for(var n=window.atob(t.toDataURL().split(",")[1]),r=n.length,o=new Uint8Array(r),i=0;i<r;i++)o[i]=n.charCodeAt(i);e(new Blob([o],{type:"image/png"}))}))}(t)},resolveUrl:function(t,e){var n=document.implementation.createHTMLDocument(),r=n.createElement("base");n.head.appendChild(r);var o=n.createElement("a");return n.body.appendChild(o),r.href=e,o.href=t,o.href},getAndEncode:function(t){var e=3e4;l.impl.options.cacheBust&&(t+=(/\?/.test(t)?"&":"?")+(new Date).getTime());return new Promise((function(n){var r,o=new XMLHttpRequest;if(o.onreadystatechange=a,o.ontimeout=u,o.responseType="blob",o.timeout=e,o.open("GET",t,!0),o.send(),l.impl.options.imagePlaceholder){var i=l.impl.options.imagePlaceholder.split(/,/);i&&i[1]&&(r=i[1])}function a(){if(4===o.readyState)if(200===o.status){var e=new FileReader;e.onloadend=function(){var t=e.result.split(/,/)[1];n(t)},e.readAsDataURL(o.response)}else r?n(r):c("cannot fetch resource: "+t+", status: "+o.status)}function u(){r?n(r):c("timeout of "+e+"ms occured while fetching resource: "+t)}function c(t){console.error(t),n("")}}))},uid:function(){var t=0;return function(){return"u"+e()+t++;function e(){return("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)}}}(),delay:function(t){return function(e){return new Promise((function(n){setTimeout((function(){n(e)}),t)}))}},asArray:function(t){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e},escapeXhtml:function(t){return t.replace(/#/g,"%23").replace(/\n/g,"%0A")},makeImage:function(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){e(r)},r.onerror=n,r.src=t}))},width:function(t){var n=e(t,"border-left-width"),r=e(t,"border-right-width");return t.scrollWidth+n+r},height:function(t){var n=e(t,"border-top-width"),r=e(t,"border-bottom-width");return t.scrollHeight+n+r}};function t(t){var e=/\.([^\.\/]*?)$/g.exec(t);return e?e[1]:""}function e(t,e){var n=window.getComputedStyle(t).getPropertyValue(e);return parseFloat(n.replace("px",""))}}(),r=function(){var t=/url\(['"]?([^'"]+?)['"]?\)/g;return{inlineAll:function(t,n,i){return a()?Promise.resolve(t):Promise.resolve(t).then(r).then((function(e){var r=Promise.resolve(t);return e.forEach((function(t){r=r.then((function(e){return o(e,t,n,i)}))})),r}));function a(){return!e(t)}},shouldProcess:e,impl:{readUrls:r,inline:o}};function e(e){return-1!==e.search(t)}function r(e){for(var r,o=[];null!==(r=t.exec(e));)o.push(r[1]);return o.filter((function(t){return!n.isDataUrl(t)}))}function o(t,e,r,o){return Promise.resolve(e).then((function(t){return r?n.resolveUrl(t,r):t})).then(o||n.getAndEncode).then((function(t){return n.dataAsUrl(t,n.mimeType(e))})).then((function(r){return t.replace(function(t){return new RegExp("(url\\(['\"]?)("+n.escape(t)+")(['\"]?\\))","g")}(e),"$1"+r+"$3")}))}}(),o=function(){return{resolveAll:function(){return t().then((function(t){return Promise.all(t.map((function(t){return t.resolve()})))})).then((function(t){return t.join("\n")}))},impl:{readAll:t}};function t(){return Promise.resolve(n.asArray(document.styleSheets)).then((function(t){var e=[];return t.forEach((function(t){try{n.asArray(t.cssRules||[]).forEach(e.push.bind(e))}catch(e){console.log("Error while reading CSS rules from "+t.href,e.toString())}})),e})).then((function(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return r.shouldProcess(t.style.getPropertyValue("src"))}))})).then((function(e){return e.map(t)}));function t(t){return{resolve:function(){var e=(t.parentStyleSheet||{}).href;return r.inlineAll(t.cssText,e)},src:function(){return t.style.getPropertyValue("src")}}}}}(),i=function(){return{inlineAll:function e(o){return o instanceof Element?i(o).then((function(){return o instanceof HTMLImageElement?t(o).inline():Promise.all(n.asArray(o.childNodes).map((function(t){return e(t)})))})):Promise.resolve(o);function i(t){var e=t.style.getPropertyValue("background");return e?r.inlineAll(e).then((function(e){t.style.setProperty("background",e,t.style.getPropertyPriority("background"))})).then((function(){return t})):Promise.resolve(t)}},impl:{newImage:t}};function t(t){return{inline:function(e){return n.isDataUrl(t.src)?Promise.resolve():Promise.resolve(t.src).then(e||n.getAndEncode).then((function(e){return n.dataAsUrl(e,n.mimeType(t.src))})).then((function(e){return new Promise((function(n,r){t.onload=n,t.onerror=r,t.src=e}))}))}}}}(),a={imagePlaceholder:void 0,cacheBust:!1},l={toSvg:u,toPng:function(t,e){return c(t,e||{}).then((function(t){return t.toDataURL()}))},toJpeg:function(t,e){return c(t,e=e||{}).then((function(t){return t.toDataURL("image/jpeg",e.quality||1)}))},toBlob:function(t,e){return c(t,e||{}).then(n.canvasToBlob)},toPixelData:function(t,e){return c(t,e||{}).then((function(e){return e.getContext("2d").getImageData(0,0,n.width(t),n.height(t)).data}))},impl:{fontFaces:o,images:i,util:n,inliner:r,options:{}}};function u(t,e){return function(t){void 0===t.imagePlaceholder?l.impl.options.imagePlaceholder=a.imagePlaceholder:l.impl.options.imagePlaceholder=t.imagePlaceholder;void 0===t.cacheBust?l.impl.options.cacheBust=a.cacheBust:l.impl.options.cacheBust=t.cacheBust}(e=e||{}),Promise.resolve(t).then((function(t){return s(t,e.filter,!0)})).then(f).then(h).then((function(t){e.bgcolor&&(t.style.backgroundColor=e.bgcolor);e.width&&(t.style.width=e.width+"px");e.height&&(t.style.height=e.height+"px");e.style&&Object.keys(e.style).forEach((function(n){t.style[n]=e.style[n]}));return t})).then((function(r){return function(t,e,r){return Promise.resolve(t).then((function(t){return t.setAttribute("xmlns","http://www.w3.org/1999/xhtml"),(new XMLSerializer).serializeToString(t)})).then(n.escapeXhtml).then((function(t){return'<foreignObject x="0" y="0" width="100%" height="100%">'+t+"</foreignObject>"})).then((function(t){return'<svg xmlns="http://www.w3.org/2000/svg" width="'+e+'" height="'+r+'">'+t+"</svg>"})).then((function(t){return"data:image/svg+xml;charset=utf-8,"+t}))}(r,e.width||n.width(t),e.height||n.height(t))}))}function c(t,e){return u(t,e).then(n.makeImage).then(n.delay(100)).then((function(r){var o=function(t){var r=document.createElement("canvas");if(r.width=e.width||n.width(t),r.height=e.height||n.height(t),e.bgcolor){var o=r.getContext("2d");o.fillStyle=e.bgcolor,o.fillRect(0,0,r.width,r.height)}return r}(t);return o.getContext("2d").drawImage(r,0,0),o}))}function s(t,e,r){return r||!e||e(t)?Promise.resolve(t).then((function(t){return t instanceof HTMLCanvasElement?n.makeImage(t.toDataURL()):t.cloneNode(!1)})).then((function(r){return function(t,e,r){var o=t.childNodes;return 0===o.length?Promise.resolve(e):i(e,n.asArray(o),r).then((function(){return e}));function i(t,e,n){var r=Promise.resolve();return e.forEach((function(e){r=r.then((function(){return s(e,n)})).then((function(e){e&&t.appendChild(e)}))})),r}}(t,r,e)})).then((function(e){return function(t,e){return e instanceof Element?Promise.resolve().then(r).then(o).then(i).then(a).then((function(){return e})):e;function r(){function r(t,e){function r(t,e){n.asArray(t).forEach((function(n){e.setProperty(n,t.getPropertyValue(n),t.getPropertyPriority(n))}))}t.cssText?e.cssText=t.cssText:r(t,e)}r(window.getComputedStyle(t),e.style)}function o(){function r(r){var o=window.getComputedStyle(t,r),i=o.getPropertyValue("content");if(""!==i&&"none"!==i){var a=n.uid();e.className=e.className+" "+a;var l=document.createElement("style");l.appendChild(u(a,r,o)),e.appendChild(l)}function u(t,e,r){var o="."+t+":"+e,i=r.cssText?a(r):l(r);return document.createTextNode(o+"{"+i+"}");function a(t){var e=t.getPropertyValue("content");return t.cssText+" content: "+e+";"}function l(t){return n.asArray(t).map(e).join("; ")+";";function e(e){return e+": "+t.getPropertyValue(e)+(t.getPropertyPriority(e)?" !important":"")}}}}[":before",":after"].forEach((function(t){r(t)}))}function i(){t instanceof HTMLTextAreaElement&&(e.innerHTML=t.value),t instanceof HTMLInputElement&&e.setAttribute("value",t.value)}function a(){e instanceof SVGElement&&(e.setAttribute("xmlns","http://www.w3.org/2000/svg"),e instanceof SVGRectElement&&["width","height"].forEach((function(t){var n=e.getAttribute(t);n&&e.style.setProperty(t,n)})))}}(t,e)})):Promise.resolve()}function f(t){return o.resolveAll().then((function(e){var n=document.createElement("style");return t.appendChild(n),n.appendChild(document.createTextNode(e)),t}))}function h(t){return i.inlineAll(t).then((function(){return t}))}t.exports=l}()}));const bn=require("jszip"),xn=require("react-file-download"),_n=t=>{const{nodes:e,links:n}=t,r=(n||[]).map((t=>{let{source:n,target:r}=t;return{source:e[n].name,target:e[r].name,sourceType:e[n].type,targetType:e[r].type}})),{nodeMap:o,nodesTsv:i}=(t=>{let e=1e7;const n={};let r=!1;t.forEach((t=>{let{source:o,target:i,sourceType:a,targetType:l}=t;""!==i&&""!==o&&(Object.keys(n).indexOf(o)<0?(""!==a?(r=!0,n[o]={ID:e,WEIGHT:1,NODE_TYPE:a}):n[o]={ID:e,WEIGHT:1},e+=1):n[o].WEIGHT+=1,Object.keys(n).indexOf(i)<0?(""!==l?(r=!0,n[i]={ID:e,WEIGHT:1,NODE_TYPE:l}):n[i]={ID:e,WEIGHT:1},e+=1):n[i].WEIGHT+=1)}));let o=r?"ID\tLABEL\tWEIGHT\tNODE_TYPE\r\n":"ID\tLABEL\tWEIGHT\r\n";return Object.keys(n).forEach((t=>{const e=n[t].ID,i=n[t].WEIGHT,a=r?n[t].NODE_TYPE:"";o+=r?`${e}\t${t}\t${i}\t${a}\r\n`:`${e}\t${t}\t${i}\r\n`})),{nodeMap:n,nodesTsv:o}})(r),a=((t,e)=>{let n="SOURCE\tTARGET\tWEIGHT\tTYPE\r\n";return t.forEach((t=>{let{source:r,target:o}=t;if(""===o||""===r)return;const i=e[r].ID,a=e[o].ID;n+=`${i}\t${a}\t1\tUndirected\r\n`})),n})(r,o),l=new bn;l.file("Node_Table.tsv",i),l.file("Edge_Table.tsv",a),l.generateAsync({type:"blob"}).then((t=>{xn(t,"Gephi_generated_by_NMTL.zip")}))},En=t=>{let e,{data:n,dataType:r,extType:o="xlsx"}=t;if("sna"===r)e=N(n);else e=n;P(`\ufeff${z(e)}`,`output.${o}`)};En.chronologyConvert=t=>{const e=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const[e,n]=t.split('<span class="tooltip">');return{before:e,after:n}};return(t||[]).map((t=>{let{start_date:{day:n,month:r,year:o},display_date:i,text:{headline:a,text:l}}=t;return{"日期":`${o||""}/${r||""}/${n||""}`,"名稱":(i||"").replace("<span>","").replace("</span>",""),"描述":(a||"").replaceAll(/(<([^>]+)>)/gi,""),"類型":e(l).before,"註(資料集名稱)":e(l).after.replaceAll("\n","").replaceAll("\t","").replace("註","").replace("資料來源:","").replaceAll(/(<([^>]+)>)/gi,"")}}))},En.mapConvert=t=>(t||[]).map((t=>{let{title:e,author:n,publisher:r,locations:o,posX:i,posY:a}=t;return{"名稱(書名/文章名)":e||"","作者":n||"","出版者":r||"","地點(作品描述區域)":o||"","經度":i||"","緯度":a||""}})),En.mapLgConvert=t=>(t||[]).map((t=>{let{title:e,locationOfFormation:n,workLocations:r,createPosX:o,createPosY:i,activePosX:a,activePosY:l}=t;return{"組織名稱":e||"","創立地點":n,"創立地點經度":o||"","創立地點緯度":i||"","活動地點":r||"","活動地點經度":a||"","活動地點緯度":l||""}})),En.worksBarChart=t=>(t||[]).map((t=>{let{date:e,year:n,title:r,keywords:o,authors:i,genreName:a}=t;return{"出版年/發表年":e||n||"","名稱(書名/文章名)":r||"","作者":(i||[]).map((t=>{let{author:e}=t;return e})).join(","),"關鍵字":(o||"").replaceAll("\n",""),"文學分類":a||""}})),En.worksSlider=t=>(t||[]).map((t=>{let{title:e,author:n,date:r}=t;return{"名稱(書名/文章名)":e||"","作者":n||"","出版日期/發表日期":r||""}}));const kn=t=>{let{fill:n="#825c0d"}=t;return e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32"},e.createElement("defs",null,e.createElement("clipPath",{id:"a"},e.createElement("path",{"data-name":"Rectangle 125",style:{fill:"#fff"},d:"M0 0h32v32H0z"}))),e.createElement("g",{style:{clipPath:"url(#a)"}},e.createElement("path",{d:"M-960 600h-20v-10h4v2h-2v6h16v-6h-2v-2h4zm-5.06-12.608-1.348-1.454-2.592 2.427V580h-2v8.365l-2.544-2.427-1.362 1.454 4.948 4.671z",transform:"translate(986 -574)",style:{fill:n},"data-name":"Mask Group 42"})))},Sn=e=>{let{fill:n="#825c0d"}=e;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32"},t.createElement("defs",null,t.createElement("clipPath",{id:"clip-path"},t.createElement("path",{id:"Rectangle_128","data-name":"Rectangle 128",style:{fill:"#fff"},d:"M0 0h32v32H0z"})),t.createElement("style",null,`\n .cls-3{fill:${n}}\n `)),t.createElement("g",{id:"Mask_Group_47","data-name":"Mask Group 47",style:{clipPath:"url(#clip-path)"}},t.createElement("g",{id:"Group_3633","data-name":"Group 3633",transform:"translate(6 6)"},t.createElement("path",{id:"Path_181","data-name":"Path 181",className:"cls-3",d:"M514 371v-2h-2v2h-2v2h2v2h2v-2h2v-2z",transform:"translate(-495 -369)"}),t.createElement("g",{id:"Group_3632","data-name":"Group 3632",transform:"translate(0 2)"},t.createElement("path",{id:"Path_182","data-name":"Path 182",className:"cls-3",d:"M502.276 371h3.447L512 389h-3.164l-1.595-5.129h-6.586L499.036 389H496zm-.926 10.649h5.17l-.746-2.419c-.643-1.953-1.209-3.956-1.776-5.983h-.128a126.193 126.193 0 0 1-1.748 5.983z",transform:"translate(-496 -371)"})))))},Cn=e=>{let{fill:n="#825c0d"}=e;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32"},t.createElement("defs",null,t.createElement("clipPath",{id:"clip-path"},t.createElement("path",{id:"Rectangle_129","data-name":"Rectangle 129",style:{fill:"#fff"},d:"M0 0h32v32H0z"})),t.createElement("style",null,`\n .cls-3{fill:${n}}\n `)),t.createElement("g",{id:"Mask_Group_48","data-name":"Mask Group 48",style:{clipPath:"url(#clip-path)"}},t.createElement("g",{id:"Group_3635","data-name":"Group 3635",transform:"translate(6 8)"},t.createElement("path",{id:"Path_181","data-name":"Path 181",className:"cls-3",d:"M510 371v2h6v-2z",transform:"translate(-495 -371)"}),t.createElement("g",{id:"Group_3632","data-name":"Group 3632"},t.createElement("path",{id:"Path_182","data-name":"Path 182",className:"cls-3",d:"M502.276 371h3.447L512 389h-3.164l-1.595-5.129h-6.586L499.036 389H496zm-.926 10.649h5.17l-.746-2.419c-.643-1.953-1.209-3.956-1.776-5.983h-.128a126.193 126.193 0 0 1-1.748 5.983z",transform:"translate(-496 -371)"})))))},Tn=e=>{let{fill:n="#825c0d"}=e;return t.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:32,height:32,viewBox:"0 0 32 32"},t.createElement("defs",null,t.createElement("clipPath",{id:"clip-path"},t.createElement("path",{id:"Rectangle_124","data-name":"Rectangle 124",style:{fill:"#fff"},d:"M0 0h32v32H0z"})),t.createElement("style",null,`\n .cls-3{fill:${n}}\n `)),t.createElement("g",{id:"Mask_Group_46","data-name":"Mask Group 46",style:{clipPath:"url(#clip-path)"}},t.createElement("g",{id:"Group_3629","data-name":"Group 3629",transform:"translate(6 6.001)"},t.createElement("path",{id:"Path_176","data-name":"Path 176",className:"cls-3",d:"M-721 1949.376h2.5v-3.755h3.755v-2.5H-721z",transform:"translate(721.003 -1943.118)"}),t.createElement("path",{id:"Path_177","data-name":"Path 177",className:"cls-3",d:"M-721 1960.376h6.258v-2.5h-3.758v-3.755h-2.5z",transform:"translate(721.003 -1940.376)"}),t.createElement("path",{id:"Path_178","data-name":"Path 178",className:"cls-3",d:"M-703.744 1943.118H-710v2.5h3.755v3.755h2.5z",transform:"translate(723.744 -1943.118)"}),t.createElement("path",{id:"Path_179","data-name":"Path 179",className:"cls-3",d:"M-703.744 1960.376v-6.259h-2.5v3.755H-710v2.5z",transform:"translate(723.744 -1940.376)"}))))};O(".extraTools {\n width: 100%;\n display: inline-flex;\n justify-content: flex-end;\n align-items: center;\n gap: 1rem;\n padding: 0px 20px;\n padding-top: 12px; }\n .extraTools__share button {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools__download {\n cursor: pointer; }\n .extraTools__download-icon {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools__fullscreenBtn {\n cursor: pointer;\n padding-top: 0; }\n .extraTools__fullscreenBtn-icon {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools__fontsize {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools .font-size-changer,\n .extraTools .font-size-changer-buttons,\n .extraTools .font-size-up,\n .extraTools .font-size-down,\n .extraTools .tooltip {\n display: flex;\n justify-content: center;\n align-items: center; }\n .extraTools .font-size-up {\n width: 32px !important;\n cursor: pointer;\n margin-right: 16px !important; }\n .extraTools .font-size-down {\n cursor: pointer;\n width: 32px !important; }\n .extraTools .fullscreenExit {\n text-align: right;\n cursor: pointer;\n border: 0; }\n .extraTools #download-menu .MuiMenuItem-root {\n color: #4e3a16;\n width: auto;\n overflow: hidden;\n font-size: 1rem;\n box-sizing: border-box;\n min-height: 48px;\n font-weight: 400;\n line-height: 1;\n padding-top: 1rem;\n white-space: initial;\n border-bottom: 0;\n letter-spacing: 0.00938em;\n padding-bottom: 1rem; }\n");const An=t=>{let{className:n}=t;return e.createElement("div",{className:s("extraTools__share",n)},e.createElement(mn,{url:document.location.href},e.createElement(fn,{size:32,round:!0})))};An.defaultProps={className:void 0},An.propTypes={className:c.string};const Nn=t=>{let{className:n,intl:o,exclude:i,iconColor:a,data:l,dataType:u,domToImageId:c,DownloadExcel:f}=t;const[h,d]=r(null),p=[{key:"downloadImage",onClick:()=>(t=>{let{id:e,fileName:n="image",quality:r=.95}=t;const o=document.getElementById(e),i=document.getElementById("yaxis"),a=document.getElementById("barChart__block");i&&i.setAttribute("transform","translate(0, 0 )"),wn.toPng(o,{quality:r}).then((t=>{const e=document.createElement("a");e.download=`${n}.png`,e.href=t,e.click(),i&&a&&(i.setAttribute("transform","translate(0, 0 )"),i.setAttribute("transform",`translate(${a.scrollLeft}, 0)`))})).catch((t=>{console.error("oops, something went wrong!",t)}))})({id:c}),label:o?"knowledge.writersAndWorksSNA.download.img":"下載圖片"},{key:"downloadGephi",onClick:()=>_n(l),label:o?"knowledge.writersAndWorksSNA.download.gephi":"下載Gephi"},{key:"downloadTsv",onClick:()=>En({data:l,dataType:u,extType:"tsv"}),label:o?"knowledge.writersAndWorksSNA.download.tsv":"下載Tsv"},{key:"downloadXls",label:o?"knowledge.writersAndWorksSNA.download.xls":"下載Excel"}];return e.createElement("div",{className:s("extraTools__download",n)},e.createElement(A,{title:o?o.formatMessage({id:"knowledge.writersAndWorksSNA.download"}):"下載",placement:"bottom"},e.createElement("div",{className:"extraTools__download-icon",onClick:t=>d(t.currentTarget)},e.createElement(kn,{fill:a}))),e.createElement(k,{id:"download-menu",anchorEl:h,keepMounted:!0,open:Boolean(h),onClose:()=>d(null)},p.map((t=>{let{key:n,onClick:r,label:a}=t;return u=n,!((i||[]).filter((t=>t===u)).length>0)&&((t,n)=>"downloadXls"===t&&f?e.createElement(f,{key:t,element:n,data:l}):n)(n,e.createElement(S,{key:n,onClick:r},o?o.formatMessage({id:a}):a));var u}))))};Nn.defaultProps={className:void 0,intl:void 0,exclude:void 0,data:null,dataType:void 0,iconColor:"#825c0d",domToImageId:"network-graph",DownloadExcel:void 0},Nn.propTypes={className:c.string,intl:c.objectOf(c.any),exclude:c.arrayOf(c.string),data:c.oneOfType([c.array,c.object]),dataType:c.string,iconColor:c.string,domToImageId:c.string,DownloadExcel:c.oneOfType([c.node,c.func])};const Pn=t=>{let{className:n,intl:r,iconColor:o,fullscreenDomId:i}=t;return e.createElement("div",{className:s("extraTools__fullscreenBtn",n)},e.createElement(A,{title:r?r.formatMessage({id:"knowledge.writersAndWorksSNA.fullscreen"}):"全螢幕模式",placement:"bottom"},e.createElement("div",{className:"extraTools__fullscreenBtn-icon",onClick:()=>{yn.isEnabled&&i&&yn.request(document.getElementById(i))}},e.createElement(Tn,{fill:o}))))};Pn.defaultProps={className:void 0,intl:void 0,iconColor:"#825c0d",fullscreenDomId:void 0},Pn.propTypes={className:c.string,intl:c.objectOf(c.any),iconColor:c.string,fullscreenDomId:c.string};const zn=t=>{let{className:n,intl:r,iconColor:o,FontSizeTargets:i,FontSizeOptions:a}=t;return e.createElement("div",{className:s("extraTools__fontsize",n)},e.createElement(vn,{targets:i,options:a,customButtons:{up:e.createElement(A,{title:r?r.formatMessage({id:"knowledge.writersAndWorksSNA.big"}):"字級放大",placement:"bottom"},e.createElement(Sn,{fill:o})),down:e.createElement(A,{title:r?r.formatMessage({id:"knowledge.writersAndWorksSNA.small"}):"字級縮小",placement:"bottom"},e.createElement(Cn,{fill:o})),style:{border:"none"},buttonsMargin:10}}))};zn.defaultProps={className:void 0,intl:void 0,iconColor:"#825c0d",FontSizeTargets:["#network-graph svg g text"],FontSizeOptions:{stepSize:2,range:1}},zn.propTypes={className:c.string,intl:c.objectOf(c.any),iconColor:c.string,FontSizeTargets:c.arrayOf(c.string),FontSizeOptions:c.objectOf(c.any)};const On=t=>{let{className:n,intl:r,exclude:o,data:i,dataType:a,iconColor:l,domToImageId:u,FontSizeTargets:c,FontSizeOptions:f,DownloadExcel:h,fullscreenDomId:d}=t;const p={intl:r,exclude:o,data:i,dataType:a,iconColor:l,domToImageId:u,FontSizeTargets:c,FontSizeOptions:f,DownloadExcel:h,fullscreenDomId:d},m=[{keys:["share"],Component:An},{keys:["downloadImage","downloadGephi","downloadTsv","downloadXls"],Component:Nn},{keys:["fullscreen"],Component:Pn},{keys:["fontSizeChanger"],Component:zn}];return e.createElement("div",{className:s("extraTools",n)},m.map((t=>{let{keys:n,Component:r}=t;return!(t=>(o||[]).filter((e=>t.some((t=>t===e)))).length===t.length)(n)&&e.createElement(r,E({key:n[0]},p))})))};On.ShareButton=An,On.DownloadMenu=Nn,On.FullscreenBtn=Pn,On.FontSizeChanger=zn,On.defaultProps={className:void 0,intl:void 0,exclude:["downloadGephi"],data:null,dataType:void 0,iconColor:"#825c0d",domToImageId:"network-graph",FontSizeTargets:["#network-graph svg g text"],FontSizeOptions:{stepSize:2,range:1},DownloadExcel:void 0,fullscreenDomId:void 0},On.propTypes={className:c.string,intl:c.objectOf(c.any),exclude:c.arrayOf(c.string),data:c.oneOfType([c.array,c.object]),dataType:c.string,iconColor:c.string,domToImageId:c.string,FontSizeTargets:c.arrayOf(c.string),FontSizeOptions:c.objectOf(c.any),DownloadExcel:c.oneOfType([c.node,c.func]),fullscreenDomId:c.string};var jn=f((function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=j(e),o=(0,M(F).default)(r.createElement("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z"}),"Replay");n.default=o})),Mn=h(jn);const Fn=()=>e.createElement("div",{id:"resetBtn"},e.createElement(C,{title:"回到原來位置與大小"},e.createElement(T,null,e.createElement(Mn,null))));Fn.propTypes={};O(".SNA {\n overflow: hidden;\n object-fit: contain;\n position: relative;\n font-size: 0.75rem;\n width: 100%; }\n .SNA--smallSize .node {\n padding-top: 8px;\n font-size: 0.75rem;\n width: 3rem;\n height: 3rem;\n overflow: hidden;\n white-space: pre-wrap;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical; }\n .SNA .node {\n background-color: #4a4e69;\n border-radius: 50%;\n color: #fff;\n font-size: 20px;\n font-weight: 500;\n height: 54px;\n width: 54px;\n padding-top: 15px;\n position: absolute;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: grab; }\n .SNA .links line {\n stroke: #c7bfb4;\n stroke-width: 2; }\n .SNA .mainNode {\n fill: #4e3a16; }\n .SNA .person {\n fill: #867b3a; }\n .SNA .publication {\n fill: #825c0d; }\n .SNA .article {\n fill: #afafaf; }\n .SNA .keyword {\n fill: #fcfae8; }\n .SNA .org {\n fill: #000000; }\n .SNA #resetBtn {\n float: right; }\n .SNA #network-graph svg {\n width: 100%;\n height: 100%; }\n\n@media only screen and (max-width: 484px) {\n .SNA {\n margin-left: 0px; }\n .SNA .node {\n background-color: #4a4e69;\n border-radius: 50%;\n color: #fff;\n font-size: 1px;\n font-weight: 500;\n height: 44px;\n width: 44px;\n padding-top: 12px;\n position: absolute;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: grab; } }\n\n@media only screen and (max-width: 484px) {\n .SNA {\n margin-left: 0px; } }\n");var Dn=function(t){var l,u=o(null),c=t.className,f=t.intl,h=t.exclude,E=t.distance,k=t.SNAData,S=t.handleClickNodeGoto,C=t.DownloadExcel,T=t.width,A=t.height,N=t.fontColor,P=t.backgroundColor,z=t.iconColor;if(!k||0===k.nodes.length)return e.createElement("div",{className:"noData"},f?f.formatMessage({id:"common.noData"}):"暫無資料");var O=function(){var t=r(!1),e=t[0],l=t[1],u=o(null);i((function(){var t=function(){l(Ve.fullscreenElement===u.current)};return Ve.addEventListener("fullscreenchange",t),function(){return Ve.removeEventListener("fullscreenchange",t)}}),[]);var c=a((function(){return Ve.fullscreenElement?Ve.exitFullscreen().then((function(){return Ve.requestFullscreen(u.current)})):u.current?Ve.requestFullscreen(u.current):void 0}),[]),s=a((function(){return Ve.fullscreenElement===u.current?Ve.exitFullscreen():Promise.resolve()}),[]);return n((function(){return{active:e,enter:c,exit:s,node:u}}),[e,c,s])}(),j=n((function(){return O.active?screen.width:screen.width>1050?T:screen.width-80}),[O.active,screen.width]),M=n((function(){return O.active?screen.height:screen.width>1050?A:screen.height-300}),[O.active,screen.width]),F=function(t){return function(){var t,e,n,r,o=te,i=ee,a=ne,l=re,u={},c=d("start","drag","end"),s=0,f=0;function h(t){t.on("mousedown.drag",p).filter(l).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(){if(!r&&o.apply(this,arguments)){var a=b("mouse",i.apply(this,arguments),Vt,this,arguments);a&&(Gt(zt.view).on("mousemove.drag",m,!0).on("mouseup.drag",y,!0),Kt(zt.view),Xt(),n=!1,t=zt.clientX,e=zt.clientY,a("start"))}}function m(){if(Yt(),!n){var r=zt.clientX-t,o=zt.clientY-e;n=r*r+o*o>f}u.mouse("drag")}function y(){Gt(zt.view).on("mousemove.drag mouseup.drag",null),Jt(zt.view,n),Yt(),u.mouse("end")}function g(){if(o.apply(this,arguments)){var t,e,n=zt.changedTouches,r=i.apply(this,arguments),a=n.length;for(t=0;t<a;++t)(e=b(n[t].identifier,r,Wt,this,arguments))&&(Xt(),e("start"))}}function v(){var t,e,n=zt.changedTouches,r=n.length;for(t=0;t<r;++t)(e=u[n[t].identifier])&&(Yt(),e("drag"))}function w(){var t,e,n=zt.changedTouches,o=n.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),t=0;t<o;++t)(e=u[n[t].identifier])&&(Xt(),e("end"))}function b(t,e,n,r,o){var i,l,f,d=n(e,t),p=c.copy();if(It(new Zt(h,"beforestart",i,t,s,d[0],d[1],0,0,p),(function(){return null!=(zt.subject=i=a.apply(r,o))&&(l=i.x-d[0]||0,f=i.y-d[1]||0,!0)})))return function a(c){var m,y=d;switch(c){case"start":u[t]=a,m=s++;break;case"end":delete u[t],--s;case"drag":d=n(e,t),m=s}It(new Zt(h,c,i,t,m,d[0]+l,d[1]+f,d[0]-y[0],d[1]-y[1],p),p.apply,p,[c,r,o])}}return h.filter=function(t){return arguments.length?(o="function"==typeof t?t:Qt(!!t),h):o},h.container=function(t){return arguments.length?(i="function"==typeof t?t:Qt(t),h):i},h.subject=function(t){return arguments.length?(a="function"==typeof t?t:Qt(t),h):a},h.touchable=function(t){return arguments.length?(l="function"==typeof t?t:Qt(!!t),h):l},h.on=function(){var t=c.on.apply(c,arguments);return t===c?h:t},h.clickDistance=function(t){return arguments.length?(f=(t=+t)*t,h):Math.sqrt(f)},h}().on("start",(function(e){y.active||t.alphaTarget(.3).restart(),e.fx=e.x,e.fy=e.y})).on("drag",(function(t){t.fx=y.x>j-10||y.x<20?t.x:y.x,t.fy=y.y>M-10||y.y<20?t.y:y.y}))},D=function(t,e,n){var r=function(t,e,n){var r=.5*(e.x+t.x),o=.5*(e.y+t.y),i=e.x-t.x,a=e.y-t.y,l=Math.pow(Math.pow(i,2)+Math.pow(a,2),.5);return{qx:r-a*n/l,qy:o+i*n/l}}(t,e,n),o=r.qx,i=r.qy;return isNaN(o)?"M".concat(t.x,", ").concat(t.y," Q0 0 ").concat(e.x," ").concat(e.y):"M".concat(t.x,", ").concat(t.y," Q").concat(o," ").concat(i," ").concat(e.x," ").concat(e.y)},I=function(t){var e=8.5,n="-0 -".concat(e," ").concat(17," ").concat(17),r="M 0,-".concat(6.800000000000001," L ").concat(13.600000000000001," ,0 L 0,").concat(6.800000000000001),o=_(ke),i=t.links.map((function(t){return Object.create(t)})),a=t.nodes.map((function(t){return Object.create(t)})),c=function(t){var e,n=1,r=.001,o=1-Math.pow(r,1/300),i=0,a=.6,l=p(),u=m(s),c=d("tick","end");function s(){f(),c.call("tick",e),n<r&&(u.stop(),c.call("end",e))}function f(r){var u,c,s=t.length;void 0===r&&(r=1);for(var f=0;f<r;++f)for(n+=(i-n)*o,l.each((function(t){t(n)})),u=0;u<s;++u)null==(c=t[u]).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 h(){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 o=10*Math.sqrt(n),i=n*Ee;e.x=o*Math.cos(i),e.y=o*Math.sin(i)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function y(e){return e.initialize&&e.initialize(t),e}return null==t&&(t=[]),h(),e={tick:f,restart:function(){return u.restart(s),e},stop:function(){return u.stop(),e},nodes:function(n){return arguments.length?(t=n,h(),l.each(y),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?(o=+t,e):+o},alphaTarget:function(t){return arguments.length?(i=+t,e):i},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},force:function(t,n){return arguments.length>1?(null==n?l.remove(t):l.set(t,y(n)),e):l.get(t)},find:function(e,n,r){var o,i,a,l,u,c=0,s=t.length;for(null==r?r=1/0:r*=r,c=0;c<s;++c)(a=(o=e-(l=t[c]).x)*o+(i=n-l.y)*i)<r&&(u=l,r=a);return u},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}(a).force("link",function(t){var e,n,r,o,i,a=we,l=function(t){return 1/Math.min(o[t.source.index],o[t.target.index])},u=le(30),c=1;function s(r){for(var o=0,a=t.length;o<c;++o)for(var l,u,s,f,h,d,p,m=0;m<a;++m)u=(l=t[m]).source,f=(s=l.target).x+s.vx-u.x-u.vx||ue(),h=s.y+s.vy-u.y-u.vy||ue(),f*=d=((d=Math.sqrt(f*f+h*h))-n[m])/d*r*e[m],h*=d,s.vx-=f*(p=i[m]),s.vy-=h*p,u.vx+=f*(p=1-p),u.vy+=h*p}function f(){if(r){var l,u,c=r.length,s=t.length,f=p(r,a);for(l=0,o=new Array(c);l<s;++l)(u=t[l]).index=l,"object"!=typeof u.source&&(u.source=be(f,u.source)),"object"!=typeof u.target&&(u.target=be(f,u.target)),o[u.source.index]=(o[u.source.index]||0)+1,o[u.target.index]=(o[u.target.index]||0)+1;for(l=0,i=new Array(s);l<s;++l)u=t[l],i[l]=o[u.source.index]/(o[u.source.index]+o[u.target.index]);e=new Array(s),h(),n=new Array(s),d()}}function h(){if(r)for(var n=0,o=t.length;n<o;++n)e[n]=+l(t[n],n,t)}function d(){if(r)for(var e=0,o=t.length;e<o;++e)n[e]=+u(t[e],e,t)}return null==t&&(t=[]),s.initialize=function(t){r=t,f()},s.links=function(e){return arguments.length?(t=e,f(),s):t},s.id=function(t){return arguments.length?(a=t,s):a},s.iterations=function(t){return arguments.length?(c=+t,s):c},s.strength=function(t){return arguments.length?(l="function"==typeof t?t:le(+t),h(),s):l},s.distance=function(t){return arguments.length?(u="function"==typeof t?t:le(+t),d(),s):u},s}(i).id((function(t){return t.index})).distance(50)).force("charge",function(){var t,e,n,r,o=le(-30),i=1,a=1/0,l=.81;function u(r){var o,i=t.length,a=de(t,xe,_e).visitAfter(s);for(n=r,o=0;o<i;++o)e=t[o],a.visit(f)}function c(){if(t){var e,n,i=t.length;for(r=new Array(i),e=0;e<i;++e)n=t[e],r[n.index]=+o(n,e,t)}}function s(t){var e,n,o,i,a,l=0,u=0;if(t.length){for(o=i=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(l+=e.value,u+=n,o+=n*e.x,i+=n*e.y);t.x=o/u,t.y=i/u}else{(e=t).x=e.data.x,e.y=e.data.y;do{l+=r[e.data.index]}while(e=e.next)}t.value=l}function f(t,o,u,c){if(!t.value)return!0;var s=t.x-e.x,f=t.y-e.y,h=c-o,d=s*s+f*f;if(h*h/l<d)return d<a&&(0===s&&(d+=(s=ue())*s),0===f&&(d+=(f=ue())*f),d<i&&(d=Math.sqrt(i*d)),e.vx+=s*t.value*n/d,e.vy+=f*t.value*n/d),!0;if(!(t.length||d>=a)){(t.data!==e||t.next)&&(0===s&&(d+=(s=ue())*s),0===f&&(d+=(f=ue())*f),d<i&&(d=Math.sqrt(i*d)));do{t.data!==e&&(h=r[t.data.index]*n/d,e.vx+=s*h,e.vy+=f*h)}while(t=t.next)}}return u.initialize=function(e){t=e,c()},u.strength=function(t){return arguments.length?(o="function"==typeof t?t:le(+t),c(),u):o},u.distanceMin=function(t){return arguments.length?(i=t*t,u):Math.sqrt(i)},u.distanceMax=function(t){return arguments.length?(a=t*t,u):Math.sqrt(a)},u.theta=function(t){return arguments.length?(l=t*t,u):Math.sqrt(l)},u}().strength(-200).distanceMax(1e3)).force("center",function(t,e){var n;function r(){var r,o,i=n.length,a=0,l=0;for(r=0;r<i;++r)a+=(o=n[r]).x,l+=o.y;for(a=a/i-t,l=l/i-e,r=0;r<i;++r)(o=n[r]).x-=a,o.y-=l}return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r}(j/2,M/2)).force("collide",function(t){var e,n,r=1,o=1;function i(){for(var t,i,l,u,c,s,f,h=e.length,d=0;d<o;++d)for(i=de(e,ge,ve).visitAfter(a),t=0;t<h;++t)l=e[t],s=n[l.index],f=s*s,u=l.x+l.vx,c=l.y+l.vy,i.visit(p);function p(t,e,n,o,i){var a=t.data,h=t.r,d=s+h;if(!a)return e>u+d||o<u-d||n>c+d||i<c-d;if(a.index>l.index){var p=u-a.x-a.vx,m=c-a.y-a.vy,y=p*p+m*m;y<d*d&&(0===p&&(y+=(p=ue())*p),0===m&&(y+=(m=ue())*m),y=(d-(y=Math.sqrt(y)))/y*r,l.vx+=(p*=y)*(d=(h*=h)/(f+h)),l.vy+=(m*=y)*d,a.vx-=p*(d=1-d),a.vy-=m*d)}}}function a(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 l(){if(e){var r,o,i=e.length;for(n=new Array(i),r=0;r<i;++r)o=e[r],n[o.index]=+t(o,r,e)}}return"function"!=typeof t&&(t=le(null==t?1:+t)),i.initialize=function(t){e=t,l()},i.iterations=function(t){return arguments.length?(o=+t,i):o},i.strength=function(t){return arguments.length?(r=+t,i):r},i.radius=function(e){return arguments.length?(t="function"==typeof e?e:le(+e),l(),i):t},i}().radius((function(){return 13.5})).strength(1).iterations(10)).force("x",function(t){var e,n,r,o=le(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vx+=(r[i]-o.x)*n[i]*t}function a(){if(e){var i,a=e.length;for(n=new Array(a),r=new Array(a),i=0;i<a;++i)n[i]=isNaN(r[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=le(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:le(+t),a(),i):o},i.x=function(e){return arguments.length?(t="function"==typeof e?e:le(+e),a(),i):t},i}(j/2)).force("y",function(t){var e,n,r,o=le(.1);function i(t){for(var o,i=0,a=e.length;i<a;++i)(o=e[i]).vy+=(r[i]-o.y)*n[i]*t}function a(){if(e){var i,a=e.length;for(n=new Array(a),r=new Array(a),i=0;i<a;++i)n[i]=isNaN(r[i]=+t(e[i],i,e))?0:+o(e[i],i,e)}}return"function"!=typeof t&&(t=le(null==t?0:+t)),i.initialize=function(t){e=t,a()},i.strength=function(t){return arguments.length?(o="function"==typeof t?t:le(+t),a(),i):o},i.y=function(e){return arguments.length?(t="function"==typeof e?e:le(+e),a(),i):t},i}(M/2)).force("radial",function(t,e,n){var r,o,i,a=le(.1);function l(t){for(var a=0,l=r.length;a<l;++a){var u=r[a],c=u.x-e||1e-6,s=u.y-n||1e-6,f=Math.sqrt(c*c+s*s),h=(i[a]-f)*o[a]*t/f;u.vx+=c*h,u.vy+=s*h}}function u(){if(r){var e,n=r.length;for(o=new Array(n),i=new Array(n),e=0;e<n;++e)i[e]=+t(r[e],e,r),o[e]=isNaN(i[e])?0:+a(r[e],e,r)}}return"function"!=typeof t&&(t=le(+t)),null==e&&(e=0),null==n&&(n=0),l.initialize=function(t){r=t,u()},l.strength=function(t){return arguments.length?(a="function"==typeof t?t:le(+t),u(),l):a},l.radius=function(e){return arguments.length?(t="function"==typeof e?e:le(+e),u(),l):t},l.x=function(t){return arguments.length?(e=+t,l):e},l.y=function(t){return arguments.length?(n=+t,l):n},l}(100,j/1.5,M/1.5));u.current=x("#sna-graph").append("svg").attr("viewBox",[0,0,j,M]).style("background-color",P),u.current.append("defs").append("marker").attr("id","arrowhead").attr("viewBox",n).attr("refX",23.8).attr("refY",0).attr("orient","auto").attr("markerWidth",15.3).attr("markerHeight",15.3).attr("xoverflow","visible").append("svg:path").attr("d",r).attr("fill","#999").style("stroke","none"),l=u.current.append("g");var s=function(){var t,e,n=je,r=Me,o=Be,i=De,a=Ie,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],c=250,s=ae,f=d("start","zoom","end"),h=500,p=0;function m(t){t.property("__zoom",Fe).on("wheel.zoom",A).on("mousedown.zoom",N).on("dblclick.zoom",P).filter(a).on("touchstart.zoom",z).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",j).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new g(e,t.x,t.y)}function E(t,e,n){var r=e[0]-n[0]*t.k,o=e[1]-n[1]*t.k;return r===t.x&&o===t.y?t:new g(t.k,r,o)}function k(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function S(t,e,n){t.on("start.zoom",(function(){C(this,arguments).start()})).on("interrupt.zoom end.zoom",(function(){C(this,arguments).end()})).tween("zoom",(function(){var t=this,o=arguments,i=C(t,o),a=r.apply(t,o),l=null==n?k(a):"function"==typeof n?n.apply(t,o):n,u=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),c=t.__zoom,f="function"==typeof e?e.apply(t,o):e,h=s(c.invert(l).concat(u/c.k),f.invert(l).concat(u/f.k));return function(t){if(1===t)t=f;else{var e=h(t),n=u/e[2];t=new g(n,l[0]-e[0]*n,l[1]-e[1]*n)}i.zoom(null,t)}}))}function C(t,e,n){return!n&&t.__zooming||new T(t,e)}function T(t,e){this.that=t,this.args=e,this.active=0,this.extent=r.apply(t,e),this.taps=0}function A(){if(n.apply(this,arguments)){var t=C(this,arguments),e=this.__zoom,r=Math.max(l[0],Math.min(l[1],e.k*Math.pow(2,i.apply(this,arguments)))),a=Te(this);if(t.wheel)t.mouse[0][0]===a[0]&&t.mouse[0][1]===a[1]||(t.mouse[1]=e.invert(t.mouse[0]=a)),clearTimeout(t.wheel);else{if(e.k===r)return;t.mouse=[a,e.invert(a)],b(this),t.start()}Oe(),t.wheel=setTimeout(c,150),t.zoom("mouse",o(E(_(e,r),t.mouse[0],t.mouse[1]),t.extent,u))}function c(){t.wheel=null,t.end()}}function N(){if(!e&&n.apply(this,arguments)){var t=C(this,arguments,!0),r=x(y.view).on("mousemove.zoom",c,!0).on("mouseup.zoom",s,!0),i=Te(this),a=y.clientX,l=y.clientY;Kt(y.view),ze(),t.mouse=[i,this.__zoom.invert(i)],b(this),t.start()}function c(){if(Oe(),!t.moved){var e=y.clientX-a,n=y.clientY-l;t.moved=e*e+n*n>p}t.zoom("mouse",o(E(t.that.__zoom,t.mouse[0]=Te(t.that),t.mouse[1]),t.extent,u))}function s(){r.on("mousemove.zoom mouseup.zoom",null),Jt(y.view,t.moved),Oe(),t.end()}}function P(){if(n.apply(this,arguments)){var t=this.__zoom,e=Te(this),i=t.invert(e),a=t.k*(y.shiftKey?.5:2),l=o(E(_(t,a),e,i),r.apply(this,arguments),u);Oe(),c>0?x(this).transition().duration(c).call(S,l,e):x(this).call(m.transform,l)}}function z(){if(n.apply(this,arguments)){var e,r,o,i,a=y.touches,l=a.length,u=C(this,arguments,y.changedTouches.length===l);for(ze(),r=0;r<l;++r)i=[i=Ae(this,a,(o=a[r]).identifier),this.__zoom.invert(i),o.identifier],u.touch0?u.touch1||u.touch0[2]===i[2]||(u.touch1=i,u.taps=0):(u.touch0=i,e=!0,u.taps=1+!!t);t&&(t=clearTimeout(t)),e&&(u.taps<2&&(t=setTimeout((function(){t=null}),h)),b(this),u.start())}}function O(){if(this.__zooming){var e,n,r,i,a=C(this,arguments),l=y.changedTouches,c=l.length;for(Oe(),t&&(t=clearTimeout(t)),a.taps=0,e=0;e<c;++e)r=Ae(this,l,(n=l[e]).identifier),a.touch0&&a.touch0[2]===n.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===n.identifier&&(a.touch1[0]=r);if(n=a.that.__zoom,a.touch1){var s=a.touch0[0],f=a.touch0[1],h=a.touch1[0],d=a.touch1[1],p=(p=h[0]-s[0])*p+(p=h[1]-s[1])*p,m=(m=d[0]-f[0])*m+(m=d[1]-f[1])*m;n=_(n,Math.sqrt(p/m)),r=[(s[0]+h[0])/2,(s[1]+h[1])/2],i=[(f[0]+d[0])/2,(f[1]+d[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],i=a.touch0[1]}a.zoom("touch",o(E(n,r,i),a.extent,u))}}function j(){if(this.__zooming){var t,n,r=C(this,arguments),o=y.changedTouches,i=o.length;for(ze(),e&&clearTimeout(e),e=setTimeout((function(){e=null}),h),t=0;t<i;++t)n=o[t],r.touch0&&r.touch0[2]===n.identifier?delete r.touch0:r.touch1&&r.touch1[2]===n.identifier&&delete r.touch1;if(r.touch1&&!r.touch0&&(r.touch0=r.touch1,delete r.touch1),r.touch0)r.touch0[1]=this.__zoom.invert(r.touch0[0]);else if(r.end(),2===r.taps){var a=x(this).on("dblclick.zoom");a&&a.apply(this,arguments)}}}return m.transform=function(t,e,n){var r=t.selection?t.selection():t;r.property("__zoom",Fe),t!==r?S(t,e,n):r.interrupt().each((function(){C(this,arguments).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},m.scaleBy=function(t,e,n){m.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n)},m.scaleTo=function(t,e,n){m.transform(t,(function(){var t=r.apply(this,arguments),i=this.__zoom,a=null==n?k(t):"function"==typeof n?n.apply(this,arguments):n,l=i.invert(a),c="function"==typeof e?e.apply(this,arguments):e;return o(E(_(i,c),a,l),t,u)}),n)},m.translateBy=function(t,e,n){m.transform(t,(function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),u)}))},m.translateTo=function(t,e,n,i){m.transform(t,(function(){var t=r.apply(this,arguments),a=this.__zoom,l=null==i?k(t):"function"==typeof i?i.apply(this,arguments):i;return o(v.translate(l[0],l[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,u)}),i)},T.prototype={start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){w(new Pe(m,t,this.that.__zoom),f.apply,f,[t,this.that,this.args])}},m.wheelDelta=function(t){return arguments.length?(i="function"==typeof t?t:Ne(+t),m):i},m.filter=function(t){return arguments.length?(n="function"==typeof t?t:Ne(!!t),m):n},m.touchable=function(t){return arguments.length?(a="function"==typeof t?t:Ne(!!t),m):a},m.extent=function(t){return arguments.length?(r="function"==typeof t?t:Ne([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),m):r},m.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],m):[l[0],l[1]]},m.translateExtent=function(t){return arguments.length?(u[0][0]=+t[0][0],u[1][0]=+t[1][0],u[0][1]=+t[0][1],u[1][1]=+t[1][1],m):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},m.constrain=function(t){return arguments.length?(o=t,m):o},m.duration=function(t){return arguments.length?(c=+t,m):c},m.interpolate=function(t){return arguments.length?(s=t,m):s},m.on=function(){var t=f.on.apply(f,arguments);return t===f?m:t},m.clickDistance=function(t){return arguments.length?(p=(t=+t)*t,m):Math.sqrt(p)},m}().scaleExtent([.5,20]).extent([[0,0],[j,M]]).on("zoom",(function(){l.attr("transform",y.transform)}));s(u.current),x("#resetBtn").on("click",(function(){u.current.transition().duration(750).call(s.transform,v)}));var h=l.append("g").attr("stroke","#999").attr("stroke-opacity",.6).selectAll("line").data(i).join("path").attr("fill","none").attr("stroke-dasharray",(function(t){return"protege"===t.ontology?"2,5,3":""})).attr("key",(function(t){return t.type})),E=l.append("g").attr("stroke","#fff").attr("stroke-width",1.5).selectAll("circle").data(a).join("circle").attr("r",(function(t){return"mainNode"===t.type?13.5:e})).attr("fill",(function(t){return o(t.type)})).attr("key",(function(t){return t.type})).attr("class",(function(t){return"node node-".concat(t.id," ").concat(t.type&&"organization"===t.type?"org":"person"===t.type?"person":"publication"===t.type?"publication":"mainNode"===t.type?"mainNode":"article"===t.type?"article":"keyword"===t.type?"keyword":"event"===t.type?"event":"")})).on("click",(function(t){return t.hasClick?S({name:t.name,id:t.id,type:t.type}):null})).call(F(c));E.append("title").text((function(t){return"".concat(t.name,"-").concat(function(t){switch(t){case"mainNode":return f?f.formatMessage({id:"SNA.search.center"}):"主要搜尋中心";case"organization":return f?f.formatMessage({id:"SNA.organization"}):"組織";case"person":return f?f.formatMessage({id:"SNA.author"}):"作家";case"publication":return f?f.formatMessage({id:"SNA.publication"}):"作家";case"article":return f?f.formatMessage({id:"SNA.article"}):"單篇作品";case"keyword":return f?f.formatMessage({id:"SNA.keyword"}):"關鍵字";case"event":return f?f.formatMessage({id:"SNA.event"}):"事件";default:return""}}(t.type))}));var k=l.append("g").selectAll("text").data(a).join("text").attr("fill",N).attr("text-anchor","middle").attr("key",(function(t){return t.type})).style("color","#fff").style("font-size","14px").text((function(t){return t.name})),C=l.selectAll(".edgepath").data(i).enter().append("path").attr("class","edgepath").attr("fill-opacity",0).attr("stroke-opacity",0).attr("id",(function(t,e){return"edgepath".concat(e)})).style("pointer-events","none");l.selectAll(".edgelabel").data(i).enter().append("text").style("pointer-events","none").attr("class","edgelabel").attr("font-size","10px").attr("fill","#aaa").attr("visibility","visible").attr("key",(function(t){return t.type})).attr("id",(function(t,e){return"edgelabel".concat(e)})).append("textPath").attr("xlink:href",(function(t,e){return"#edgepath".concat(e)})).style("text-anchor","middle").style("pointer-events","none").attr("startOffset","50%").text((function(t){return t.property})),c.on("tick",(function(){a.forEach((function(t){t.x>=j-20&&(t.x=j-20),t.y>=M-20&&(t.y=M-20),t.x<=20&&(t.x=20),t.y<=20&&(t.y=20)})),h.attr("d",(function(t){return D(t.source,t.target,30)})),E.attr("cx",(function(t){return t.x})).attr("cy",(function(t){return t.y})),k.attr("x",(function(t){return t.x})).attr("y",(function(t){return t.y-e})),C.attr("d",(function(t){return D(t.source,t.target,30)}))}))};return i((function(){if(k&&k.nodes&&k.nodes.length>0){var t=document.getElementById("network-graph");t&&t.childNodes[0]&&t.removeChild(t.childNodes[0]),I(k)}}),[k,O.active]),e.createElement("div",{className:s("SNA",{"SNA--smallSize":E<200},c),style:{contentWidth:j,contentHeight:M,backgroundColor:P}},e.createElement(On,{intl:f,data:k,iconColor:z,domToImageId:"sna-graph",FontSizeTargets:["#sna-graph svg g text"],exclude:h,DownloadExcel:C,fullscreenDomId:"sna-graph"}),e.createElement(Fn,null),e.createElement("div",{id:"sna-graph"}))};Dn.defaultProps={className:void 0,intl:void 0,width:1050,height:600,distance:400,SNAData:null,fontColor:"#000000",backgroundColor:"#FFFFFF",iconColor:"#825c0d",exclude:["downloadXls","downloadTsv"],handleClickNodeGoto:null,DownloadExcel:void 0},Dn.propTypes={className:c.string,intl:c.objectOf(c.any),width:c.number,height:c.number,distance:c.number,SNAData:c.objectOf(c.any),fontColor:c.string,backgroundColor:c.string,iconColor:c.string,exclude:c.arrayOf(c.string),handleClickNodeGoto:c.func,DownloadExcel:c.oneOfType([c.node,c.func])};export{Dn as default};
1
+ import React__default, { useMemo, useEffect } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { c as classNames } from './index-b76a85f4.js';
4
+ import { e as event, d as d3Select, a as dispatch, c as customEvent, D as DragEvent, q as quadtree, m as map, t as timer, T as Transform, i as identity, b as interrupt, o as ordinal, f as category10 } from './transform-3a04288b.js';
5
+ import { E as ExtraTools } from './ExtraTools-55f66039.js';
6
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
7
+ import './_rollupPluginBabelHelpers-a52356f6.js';
8
+ import './_commonjsHelpers-70de2c37.js';
9
+ import '@material-ui/core';
10
+ import './Tooltip-6ebfa9c1.js';
11
+ import './dataExport-d55d6fa3.js';
12
+
13
+ function sourceEvent() {
14
+ var current = event, source;
15
+ while (source = current.sourceEvent) current = source;
16
+ return current;
17
+ }
18
+
19
+ function point(node, event) {
20
+ var svg = node.ownerSVGElement || node;
21
+
22
+ if (svg.createSVGPoint) {
23
+ var point = svg.createSVGPoint();
24
+ point.x = event.clientX, point.y = event.clientY;
25
+ point = point.matrixTransform(node.getScreenCTM().inverse());
26
+ return [point.x, point.y];
27
+ }
28
+
29
+ var rect = node.getBoundingClientRect();
30
+ return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
31
+ }
32
+
33
+ function mouse(node) {
34
+ var event = sourceEvent();
35
+ if (event.changedTouches) event = event.changedTouches[0];
36
+ return point(node, event);
37
+ }
38
+
39
+ function touch(node, touches, identifier) {
40
+ if (arguments.length < 3) identifier = touches, touches = sourceEvent().changedTouches;
41
+
42
+ for (var i = 0, n = touches ? touches.length : 0, touch; i < n; ++i) {
43
+ if ((touch = touches[i]).identifier === identifier) {
44
+ return point(node, touch);
45
+ }
46
+ }
47
+
48
+ return null;
49
+ }
50
+
51
+ function nopropagation$1() {
52
+ event.stopImmediatePropagation();
53
+ }
54
+
55
+ function noevent$1() {
56
+ event.preventDefault();
57
+ event.stopImmediatePropagation();
58
+ }
59
+
60
+ function dragDisable(view) {
61
+ var root = view.document.documentElement,
62
+ selection = d3Select(view).on("dragstart.drag", noevent$1, true);
63
+ if ("onselectstart" in root) {
64
+ selection.on("selectstart.drag", noevent$1, true);
65
+ } else {
66
+ root.__noselect = root.style.MozUserSelect;
67
+ root.style.MozUserSelect = "none";
68
+ }
69
+ }
70
+
71
+ function yesdrag(view, noclick) {
72
+ var root = view.document.documentElement,
73
+ selection = d3Select(view).on("dragstart.drag", null);
74
+ if (noclick) {
75
+ selection.on("click.drag", noevent$1, true);
76
+ setTimeout(function() { selection.on("click.drag", null); }, 0);
77
+ }
78
+ if ("onselectstart" in root) {
79
+ selection.on("selectstart.drag", null);
80
+ } else {
81
+ root.style.MozUserSelect = root.__noselect;
82
+ delete root.__noselect;
83
+ }
84
+ }
85
+
86
+ function constant$2(x) {
87
+ return function() {
88
+ return x;
89
+ };
90
+ }
91
+
92
+ // Ignore right-click, since that should open the context menu.
93
+ function defaultFilter$1() {
94
+ return !event.ctrlKey && !event.button;
95
+ }
96
+
97
+ function defaultContainer() {
98
+ return this.parentNode;
99
+ }
100
+
101
+ function defaultSubject(d) {
102
+ return d == null ? {x: event.x, y: event.y} : d;
103
+ }
104
+
105
+ function defaultTouchable$1() {
106
+ return navigator.maxTouchPoints || ("ontouchstart" in this);
107
+ }
108
+
109
+ function drag() {
110
+ var filter = defaultFilter$1,
111
+ container = defaultContainer,
112
+ subject = defaultSubject,
113
+ touchable = defaultTouchable$1,
114
+ gestures = {},
115
+ listeners = dispatch("start", "drag", "end"),
116
+ active = 0,
117
+ mousedownx,
118
+ mousedowny,
119
+ mousemoving,
120
+ touchending,
121
+ clickDistance2 = 0;
122
+
123
+ function drag(selection) {
124
+ selection
125
+ .on("mousedown.drag", mousedowned)
126
+ .filter(touchable)
127
+ .on("touchstart.drag", touchstarted)
128
+ .on("touchmove.drag", touchmoved)
129
+ .on("touchend.drag touchcancel.drag", touchended)
130
+ .style("touch-action", "none")
131
+ .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
132
+ }
133
+
134
+ function mousedowned() {
135
+ if (touchending || !filter.apply(this, arguments)) return;
136
+ var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
137
+ if (!gesture) return;
138
+ d3Select(event.view).on("mousemove.drag", mousemoved, true).on("mouseup.drag", mouseupped, true);
139
+ dragDisable(event.view);
140
+ nopropagation$1();
141
+ mousemoving = false;
142
+ mousedownx = event.clientX;
143
+ mousedowny = event.clientY;
144
+ gesture("start");
145
+ }
146
+
147
+ function mousemoved() {
148
+ noevent$1();
149
+ if (!mousemoving) {
150
+ var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny;
151
+ mousemoving = dx * dx + dy * dy > clickDistance2;
152
+ }
153
+ gestures.mouse("drag");
154
+ }
155
+
156
+ function mouseupped() {
157
+ d3Select(event.view).on("mousemove.drag mouseup.drag", null);
158
+ yesdrag(event.view, mousemoving);
159
+ noevent$1();
160
+ gestures.mouse("end");
161
+ }
162
+
163
+ function touchstarted() {
164
+ if (!filter.apply(this, arguments)) return;
165
+ var touches = event.changedTouches,
166
+ c = container.apply(this, arguments),
167
+ n = touches.length, i, gesture;
168
+
169
+ for (i = 0; i < n; ++i) {
170
+ if (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) {
171
+ nopropagation$1();
172
+ gesture("start");
173
+ }
174
+ }
175
+ }
176
+
177
+ function touchmoved() {
178
+ var touches = event.changedTouches,
179
+ n = touches.length, i, gesture;
180
+
181
+ for (i = 0; i < n; ++i) {
182
+ if (gesture = gestures[touches[i].identifier]) {
183
+ noevent$1();
184
+ gesture("drag");
185
+ }
186
+ }
187
+ }
188
+
189
+ function touchended() {
190
+ var touches = event.changedTouches,
191
+ n = touches.length, i, gesture;
192
+
193
+ if (touchending) clearTimeout(touchending);
194
+ touchending = setTimeout(function() { touchending = null; }, 500); // Ghost clicks are delayed!
195
+ for (i = 0; i < n; ++i) {
196
+ if (gesture = gestures[touches[i].identifier]) {
197
+ nopropagation$1();
198
+ gesture("end");
199
+ }
200
+ }
201
+ }
202
+
203
+ function beforestart(id, container, point, that, args) {
204
+ var p = point(container, id), s, dx, dy,
205
+ sublisteners = listeners.copy();
206
+
207
+ if (!customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
208
+ if ((event.subject = s = subject.apply(that, args)) == null) return false;
209
+ dx = s.x - p[0] || 0;
210
+ dy = s.y - p[1] || 0;
211
+ return true;
212
+ })) return;
213
+
214
+ return function gesture(type) {
215
+ var p0 = p, n;
216
+ switch (type) {
217
+ case "start": gestures[id] = gesture, n = active++; break;
218
+ case "end": delete gestures[id], --active; // nobreak
219
+ case "drag": p = point(container, id), n = active; break;
220
+ }
221
+ customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [type, that, args]);
222
+ };
223
+ }
224
+
225
+ drag.filter = function(_) {
226
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant$2(!!_), drag) : filter;
227
+ };
228
+
229
+ drag.container = function(_) {
230
+ return arguments.length ? (container = typeof _ === "function" ? _ : constant$2(_), drag) : container;
231
+ };
232
+
233
+ drag.subject = function(_) {
234
+ return arguments.length ? (subject = typeof _ === "function" ? _ : constant$2(_), drag) : subject;
235
+ };
236
+
237
+ drag.touchable = function(_) {
238
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant$2(!!_), drag) : touchable;
239
+ };
240
+
241
+ drag.on = function() {
242
+ var value = listeners.on.apply(listeners, arguments);
243
+ return value === listeners ? drag : value;
244
+ };
245
+
246
+ drag.clickDistance = function(_) {
247
+ return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
248
+ };
249
+
250
+ return drag;
251
+ }
252
+
253
+ var rho = Math.SQRT2,
254
+ rho2 = 2,
255
+ rho4 = 4,
256
+ epsilon2 = 1e-12;
257
+
258
+ function cosh(x) {
259
+ return ((x = Math.exp(x)) + 1 / x) / 2;
260
+ }
261
+
262
+ function sinh(x) {
263
+ return ((x = Math.exp(x)) - 1 / x) / 2;
264
+ }
265
+
266
+ function tanh(x) {
267
+ return ((x = Math.exp(2 * x)) - 1) / (x + 1);
268
+ }
269
+
270
+ // p0 = [ux0, uy0, w0]
271
+ // p1 = [ux1, uy1, w1]
272
+ function interpolateZoom(p0, p1) {
273
+ var ux0 = p0[0], uy0 = p0[1], w0 = p0[2],
274
+ ux1 = p1[0], uy1 = p1[1], w1 = p1[2],
275
+ dx = ux1 - ux0,
276
+ dy = uy1 - uy0,
277
+ d2 = dx * dx + dy * dy,
278
+ i,
279
+ S;
280
+
281
+ // Special case for u0 ≅ u1.
282
+ if (d2 < epsilon2) {
283
+ S = Math.log(w1 / w0) / rho;
284
+ i = function(t) {
285
+ return [
286
+ ux0 + t * dx,
287
+ uy0 + t * dy,
288
+ w0 * Math.exp(rho * t * S)
289
+ ];
290
+ };
291
+ }
292
+
293
+ // General case.
294
+ else {
295
+ var d1 = Math.sqrt(d2),
296
+ b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1),
297
+ b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1),
298
+ r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0),
299
+ r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
300
+ S = (r1 - r0) / rho;
301
+ i = function(t) {
302
+ var s = t * S,
303
+ coshr0 = cosh(r0),
304
+ u = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s + r0) - sinh(r0));
305
+ return [
306
+ ux0 + u * dx,
307
+ uy0 + u * dy,
308
+ w0 * coshr0 / cosh(rho * s + r0)
309
+ ];
310
+ };
311
+ }
312
+
313
+ i.duration = S * 1000;
314
+
315
+ return i;
316
+ }
317
+
318
+ function center(x, y) {
319
+ var nodes;
320
+
321
+ if (x == null) x = 0;
322
+ if (y == null) y = 0;
323
+
324
+ function force() {
325
+ var i,
326
+ n = nodes.length,
327
+ node,
328
+ sx = 0,
329
+ sy = 0;
330
+
331
+ for (i = 0; i < n; ++i) {
332
+ node = nodes[i], sx += node.x, sy += node.y;
333
+ }
334
+
335
+ for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) {
336
+ node = nodes[i], node.x -= sx, node.y -= sy;
337
+ }
338
+ }
339
+
340
+ force.initialize = function(_) {
341
+ nodes = _;
342
+ };
343
+
344
+ force.x = function(_) {
345
+ return arguments.length ? (x = +_, force) : x;
346
+ };
347
+
348
+ force.y = function(_) {
349
+ return arguments.length ? (y = +_, force) : y;
350
+ };
351
+
352
+ return force;
353
+ }
354
+
355
+ function constant$1(x) {
356
+ return function() {
357
+ return x;
358
+ };
359
+ }
360
+
361
+ function jiggle() {
362
+ return (Math.random() - 0.5) * 1e-6;
363
+ }
364
+
365
+ function x$2(d) {
366
+ return d.x + d.vx;
367
+ }
368
+
369
+ function y$2(d) {
370
+ return d.y + d.vy;
371
+ }
372
+
373
+ function collide(radius) {
374
+ var nodes,
375
+ radii,
376
+ strength = 1,
377
+ iterations = 1;
378
+
379
+ if (typeof radius !== "function") radius = constant$1(radius == null ? 1 : +radius);
380
+
381
+ function force() {
382
+ var i, n = nodes.length,
383
+ tree,
384
+ node,
385
+ xi,
386
+ yi,
387
+ ri,
388
+ ri2;
389
+
390
+ for (var k = 0; k < iterations; ++k) {
391
+ tree = quadtree(nodes, x$2, y$2).visitAfter(prepare);
392
+ for (i = 0; i < n; ++i) {
393
+ node = nodes[i];
394
+ ri = radii[node.index], ri2 = ri * ri;
395
+ xi = node.x + node.vx;
396
+ yi = node.y + node.vy;
397
+ tree.visit(apply);
398
+ }
399
+ }
400
+
401
+ function apply(quad, x0, y0, x1, y1) {
402
+ var data = quad.data, rj = quad.r, r = ri + rj;
403
+ if (data) {
404
+ if (data.index > node.index) {
405
+ var x = xi - data.x - data.vx,
406
+ y = yi - data.y - data.vy,
407
+ l = x * x + y * y;
408
+ if (l < r * r) {
409
+ if (x === 0) x = jiggle(), l += x * x;
410
+ if (y === 0) y = jiggle(), l += y * y;
411
+ l = (r - (l = Math.sqrt(l))) / l * strength;
412
+ node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj));
413
+ node.vy += (y *= l) * r;
414
+ data.vx -= x * (r = 1 - r);
415
+ data.vy -= y * r;
416
+ }
417
+ }
418
+ return;
419
+ }
420
+ return x0 > xi + r || x1 < xi - r || y0 > yi + r || y1 < yi - r;
421
+ }
422
+ }
423
+
424
+ function prepare(quad) {
425
+ if (quad.data) return quad.r = radii[quad.data.index];
426
+ for (var i = quad.r = 0; i < 4; ++i) {
427
+ if (quad[i] && quad[i].r > quad.r) {
428
+ quad.r = quad[i].r;
429
+ }
430
+ }
431
+ }
432
+
433
+ function initialize() {
434
+ if (!nodes) return;
435
+ var i, n = nodes.length, node;
436
+ radii = new Array(n);
437
+ for (i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
438
+ }
439
+
440
+ force.initialize = function(_) {
441
+ nodes = _;
442
+ initialize();
443
+ };
444
+
445
+ force.iterations = function(_) {
446
+ return arguments.length ? (iterations = +_, force) : iterations;
447
+ };
448
+
449
+ force.strength = function(_) {
450
+ return arguments.length ? (strength = +_, force) : strength;
451
+ };
452
+
453
+ force.radius = function(_) {
454
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
455
+ };
456
+
457
+ return force;
458
+ }
459
+
460
+ function index(d) {
461
+ return d.index;
462
+ }
463
+
464
+ function find(nodeById, nodeId) {
465
+ var node = nodeById.get(nodeId);
466
+ if (!node) throw new Error("missing: " + nodeId);
467
+ return node;
468
+ }
469
+
470
+ function link(links) {
471
+ var id = index,
472
+ strength = defaultStrength,
473
+ strengths,
474
+ distance = constant$1(30),
475
+ distances,
476
+ nodes,
477
+ count,
478
+ bias,
479
+ iterations = 1;
480
+
481
+ if (links == null) links = [];
482
+
483
+ function defaultStrength(link) {
484
+ return 1 / Math.min(count[link.source.index], count[link.target.index]);
485
+ }
486
+
487
+ function force(alpha) {
488
+ for (var k = 0, n = links.length; k < iterations; ++k) {
489
+ for (var i = 0, link, source, target, x, y, l, b; i < n; ++i) {
490
+ link = links[i], source = link.source, target = link.target;
491
+ x = target.x + target.vx - source.x - source.vx || jiggle();
492
+ y = target.y + target.vy - source.y - source.vy || jiggle();
493
+ l = Math.sqrt(x * x + y * y);
494
+ l = (l - distances[i]) / l * alpha * strengths[i];
495
+ x *= l, y *= l;
496
+ target.vx -= x * (b = bias[i]);
497
+ target.vy -= y * b;
498
+ source.vx += x * (b = 1 - b);
499
+ source.vy += y * b;
500
+ }
501
+ }
502
+ }
503
+
504
+ function initialize() {
505
+ if (!nodes) return;
506
+
507
+ var i,
508
+ n = nodes.length,
509
+ m = links.length,
510
+ nodeById = map(nodes, id),
511
+ link;
512
+
513
+ for (i = 0, count = new Array(n); i < m; ++i) {
514
+ link = links[i], link.index = i;
515
+ if (typeof link.source !== "object") link.source = find(nodeById, link.source);
516
+ if (typeof link.target !== "object") link.target = find(nodeById, link.target);
517
+ count[link.source.index] = (count[link.source.index] || 0) + 1;
518
+ count[link.target.index] = (count[link.target.index] || 0) + 1;
519
+ }
520
+
521
+ for (i = 0, bias = new Array(m); i < m; ++i) {
522
+ link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
523
+ }
524
+
525
+ strengths = new Array(m), initializeStrength();
526
+ distances = new Array(m), initializeDistance();
527
+ }
528
+
529
+ function initializeStrength() {
530
+ if (!nodes) return;
531
+
532
+ for (var i = 0, n = links.length; i < n; ++i) {
533
+ strengths[i] = +strength(links[i], i, links);
534
+ }
535
+ }
536
+
537
+ function initializeDistance() {
538
+ if (!nodes) return;
539
+
540
+ for (var i = 0, n = links.length; i < n; ++i) {
541
+ distances[i] = +distance(links[i], i, links);
542
+ }
543
+ }
544
+
545
+ force.initialize = function(_) {
546
+ nodes = _;
547
+ initialize();
548
+ };
549
+
550
+ force.links = function(_) {
551
+ return arguments.length ? (links = _, initialize(), force) : links;
552
+ };
553
+
554
+ force.id = function(_) {
555
+ return arguments.length ? (id = _, force) : id;
556
+ };
557
+
558
+ force.iterations = function(_) {
559
+ return arguments.length ? (iterations = +_, force) : iterations;
560
+ };
561
+
562
+ force.strength = function(_) {
563
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initializeStrength(), force) : strength;
564
+ };
565
+
566
+ force.distance = function(_) {
567
+ return arguments.length ? (distance = typeof _ === "function" ? _ : constant$1(+_), initializeDistance(), force) : distance;
568
+ };
569
+
570
+ return force;
571
+ }
572
+
573
+ function x$1(d) {
574
+ return d.x;
575
+ }
576
+
577
+ function y$1(d) {
578
+ return d.y;
579
+ }
580
+
581
+ var initialRadius = 10,
582
+ initialAngle = Math.PI * (3 - Math.sqrt(5));
583
+
584
+ function simulation(nodes) {
585
+ var simulation,
586
+ alpha = 1,
587
+ alphaMin = 0.001,
588
+ alphaDecay = 1 - Math.pow(alphaMin, 1 / 300),
589
+ alphaTarget = 0,
590
+ velocityDecay = 0.6,
591
+ forces = map(),
592
+ stepper = timer(step),
593
+ event = dispatch("tick", "end");
594
+
595
+ if (nodes == null) nodes = [];
596
+
597
+ function step() {
598
+ tick();
599
+ event.call("tick", simulation);
600
+ if (alpha < alphaMin) {
601
+ stepper.stop();
602
+ event.call("end", simulation);
603
+ }
604
+ }
605
+
606
+ function tick(iterations) {
607
+ var i, n = nodes.length, node;
608
+
609
+ if (iterations === undefined) iterations = 1;
610
+
611
+ for (var k = 0; k < iterations; ++k) {
612
+ alpha += (alphaTarget - alpha) * alphaDecay;
613
+
614
+ forces.each(function (force) {
615
+ force(alpha);
616
+ });
617
+
618
+ for (i = 0; i < n; ++i) {
619
+ node = nodes[i];
620
+ if (node.fx == null) node.x += node.vx *= velocityDecay;
621
+ else node.x = node.fx, node.vx = 0;
622
+ if (node.fy == null) node.y += node.vy *= velocityDecay;
623
+ else node.y = node.fy, node.vy = 0;
624
+ }
625
+ }
626
+
627
+ return simulation;
628
+ }
629
+
630
+ function initializeNodes() {
631
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
632
+ node = nodes[i], node.index = i;
633
+ if (node.fx != null) node.x = node.fx;
634
+ if (node.fy != null) node.y = node.fy;
635
+ if (isNaN(node.x) || isNaN(node.y)) {
636
+ var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;
637
+ node.x = radius * Math.cos(angle);
638
+ node.y = radius * Math.sin(angle);
639
+ }
640
+ if (isNaN(node.vx) || isNaN(node.vy)) {
641
+ node.vx = node.vy = 0;
642
+ }
643
+ }
644
+ }
645
+
646
+ function initializeForce(force) {
647
+ if (force.initialize) force.initialize(nodes);
648
+ return force;
649
+ }
650
+
651
+ initializeNodes();
652
+
653
+ return simulation = {
654
+ tick: tick,
655
+
656
+ restart: function() {
657
+ return stepper.restart(step), simulation;
658
+ },
659
+
660
+ stop: function() {
661
+ return stepper.stop(), simulation;
662
+ },
663
+
664
+ nodes: function(_) {
665
+ return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), simulation) : nodes;
666
+ },
667
+
668
+ alpha: function(_) {
669
+ return arguments.length ? (alpha = +_, simulation) : alpha;
670
+ },
671
+
672
+ alphaMin: function(_) {
673
+ return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
674
+ },
675
+
676
+ alphaDecay: function(_) {
677
+ return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
678
+ },
679
+
680
+ alphaTarget: function(_) {
681
+ return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
682
+ },
683
+
684
+ velocityDecay: function(_) {
685
+ return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
686
+ },
687
+
688
+ force: function(name, _) {
689
+ return arguments.length > 1 ? ((_ == null ? forces.remove(name) : forces.set(name, initializeForce(_))), simulation) : forces.get(name);
690
+ },
691
+
692
+ find: function(x, y, radius) {
693
+ var i = 0,
694
+ n = nodes.length,
695
+ dx,
696
+ dy,
697
+ d2,
698
+ node,
699
+ closest;
700
+
701
+ if (radius == null) radius = Infinity;
702
+ else radius *= radius;
703
+
704
+ for (i = 0; i < n; ++i) {
705
+ node = nodes[i];
706
+ dx = x - node.x;
707
+ dy = y - node.y;
708
+ d2 = dx * dx + dy * dy;
709
+ if (d2 < radius) closest = node, radius = d2;
710
+ }
711
+
712
+ return closest;
713
+ },
714
+
715
+ on: function(name, _) {
716
+ return arguments.length > 1 ? (event.on(name, _), simulation) : event.on(name);
717
+ }
718
+ };
719
+ }
720
+
721
+ function manyBody() {
722
+ var nodes,
723
+ node,
724
+ alpha,
725
+ strength = constant$1(-30),
726
+ strengths,
727
+ distanceMin2 = 1,
728
+ distanceMax2 = Infinity,
729
+ theta2 = 0.81;
730
+
731
+ function force(_) {
732
+ var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);
733
+ for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
734
+ }
735
+
736
+ function initialize() {
737
+ if (!nodes) return;
738
+ var i, n = nodes.length, node;
739
+ strengths = new Array(n);
740
+ for (i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
741
+ }
742
+
743
+ function accumulate(quad) {
744
+ var strength = 0, q, c, weight = 0, x, y, i;
745
+
746
+ // For internal nodes, accumulate forces from child quadrants.
747
+ if (quad.length) {
748
+ for (x = y = i = 0; i < 4; ++i) {
749
+ if ((q = quad[i]) && (c = Math.abs(q.value))) {
750
+ strength += q.value, weight += c, x += c * q.x, y += c * q.y;
751
+ }
752
+ }
753
+ quad.x = x / weight;
754
+ quad.y = y / weight;
755
+ }
756
+
757
+ // For leaf nodes, accumulate forces from coincident quadrants.
758
+ else {
759
+ q = quad;
760
+ q.x = q.data.x;
761
+ q.y = q.data.y;
762
+ do strength += strengths[q.data.index];
763
+ while (q = q.next);
764
+ }
765
+
766
+ quad.value = strength;
767
+ }
768
+
769
+ function apply(quad, x1, _, x2) {
770
+ if (!quad.value) return true;
771
+
772
+ var x = quad.x - node.x,
773
+ y = quad.y - node.y,
774
+ w = x2 - x1,
775
+ l = x * x + y * y;
776
+
777
+ // Apply the Barnes-Hut approximation if possible.
778
+ // Limit forces for very close nodes; randomize direction if coincident.
779
+ if (w * w / theta2 < l) {
780
+ if (l < distanceMax2) {
781
+ if (x === 0) x = jiggle(), l += x * x;
782
+ if (y === 0) y = jiggle(), l += y * y;
783
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
784
+ node.vx += x * quad.value * alpha / l;
785
+ node.vy += y * quad.value * alpha / l;
786
+ }
787
+ return true;
788
+ }
789
+
790
+ // Otherwise, process points directly.
791
+ else if (quad.length || l >= distanceMax2) return;
792
+
793
+ // Limit forces for very close nodes; randomize direction if coincident.
794
+ if (quad.data !== node || quad.next) {
795
+ if (x === 0) x = jiggle(), l += x * x;
796
+ if (y === 0) y = jiggle(), l += y * y;
797
+ if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l);
798
+ }
799
+
800
+ do if (quad.data !== node) {
801
+ w = strengths[quad.data.index] * alpha / l;
802
+ node.vx += x * w;
803
+ node.vy += y * w;
804
+ } while (quad = quad.next);
805
+ }
806
+
807
+ force.initialize = function(_) {
808
+ nodes = _;
809
+ initialize();
810
+ };
811
+
812
+ force.strength = function(_) {
813
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
814
+ };
815
+
816
+ force.distanceMin = function(_) {
817
+ return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
818
+ };
819
+
820
+ force.distanceMax = function(_) {
821
+ return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
822
+ };
823
+
824
+ force.theta = function(_) {
825
+ return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
826
+ };
827
+
828
+ return force;
829
+ }
830
+
831
+ function radial(radius, x, y) {
832
+ var nodes,
833
+ strength = constant$1(0.1),
834
+ strengths,
835
+ radiuses;
836
+
837
+ if (typeof radius !== "function") radius = constant$1(+radius);
838
+ if (x == null) x = 0;
839
+ if (y == null) y = 0;
840
+
841
+ function force(alpha) {
842
+ for (var i = 0, n = nodes.length; i < n; ++i) {
843
+ var node = nodes[i],
844
+ dx = node.x - x || 1e-6,
845
+ dy = node.y - y || 1e-6,
846
+ r = Math.sqrt(dx * dx + dy * dy),
847
+ k = (radiuses[i] - r) * strengths[i] * alpha / r;
848
+ node.vx += dx * k;
849
+ node.vy += dy * k;
850
+ }
851
+ }
852
+
853
+ function initialize() {
854
+ if (!nodes) return;
855
+ var i, n = nodes.length;
856
+ strengths = new Array(n);
857
+ radiuses = new Array(n);
858
+ for (i = 0; i < n; ++i) {
859
+ radiuses[i] = +radius(nodes[i], i, nodes);
860
+ strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
861
+ }
862
+ }
863
+
864
+ force.initialize = function(_) {
865
+ nodes = _, initialize();
866
+ };
867
+
868
+ force.strength = function(_) {
869
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
870
+ };
871
+
872
+ force.radius = function(_) {
873
+ return arguments.length ? (radius = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : radius;
874
+ };
875
+
876
+ force.x = function(_) {
877
+ return arguments.length ? (x = +_, force) : x;
878
+ };
879
+
880
+ force.y = function(_) {
881
+ return arguments.length ? (y = +_, force) : y;
882
+ };
883
+
884
+ return force;
885
+ }
886
+
887
+ function x(x) {
888
+ var strength = constant$1(0.1),
889
+ nodes,
890
+ strengths,
891
+ xz;
892
+
893
+ if (typeof x !== "function") x = constant$1(x == null ? 0 : +x);
894
+
895
+ function force(alpha) {
896
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
897
+ node = nodes[i], node.vx += (xz[i] - node.x) * strengths[i] * alpha;
898
+ }
899
+ }
900
+
901
+ function initialize() {
902
+ if (!nodes) return;
903
+ var i, n = nodes.length;
904
+ strengths = new Array(n);
905
+ xz = new Array(n);
906
+ for (i = 0; i < n; ++i) {
907
+ strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
908
+ }
909
+ }
910
+
911
+ force.initialize = function(_) {
912
+ nodes = _;
913
+ initialize();
914
+ };
915
+
916
+ force.strength = function(_) {
917
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
918
+ };
919
+
920
+ force.x = function(_) {
921
+ return arguments.length ? (x = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : x;
922
+ };
923
+
924
+ return force;
925
+ }
926
+
927
+ function y(y) {
928
+ var strength = constant$1(0.1),
929
+ nodes,
930
+ strengths,
931
+ yz;
932
+
933
+ if (typeof y !== "function") y = constant$1(y == null ? 0 : +y);
934
+
935
+ function force(alpha) {
936
+ for (var i = 0, n = nodes.length, node; i < n; ++i) {
937
+ node = nodes[i], node.vy += (yz[i] - node.y) * strengths[i] * alpha;
938
+ }
939
+ }
940
+
941
+ function initialize() {
942
+ if (!nodes) return;
943
+ var i, n = nodes.length;
944
+ strengths = new Array(n);
945
+ yz = new Array(n);
946
+ for (i = 0; i < n; ++i) {
947
+ strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
948
+ }
949
+ }
950
+
951
+ force.initialize = function(_) {
952
+ nodes = _;
953
+ initialize();
954
+ };
955
+
956
+ force.strength = function(_) {
957
+ return arguments.length ? (strength = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : strength;
958
+ };
959
+
960
+ force.y = function(_) {
961
+ return arguments.length ? (y = typeof _ === "function" ? _ : constant$1(+_), initialize(), force) : y;
962
+ };
963
+
964
+ return force;
965
+ }
966
+
967
+ function constant(x) {
968
+ return function() {
969
+ return x;
970
+ };
971
+ }
972
+
973
+ function ZoomEvent(target, type, transform) {
974
+ this.target = target;
975
+ this.type = type;
976
+ this.transform = transform;
977
+ }
978
+
979
+ function nopropagation() {
980
+ event.stopImmediatePropagation();
981
+ }
982
+
983
+ function noevent() {
984
+ event.preventDefault();
985
+ event.stopImmediatePropagation();
986
+ }
987
+
988
+ // Ignore right-click, since that should open the context menu.
989
+ function defaultFilter() {
990
+ return !event.ctrlKey && !event.button;
991
+ }
992
+
993
+ function defaultExtent() {
994
+ var e = this;
995
+ if (e instanceof SVGElement) {
996
+ e = e.ownerSVGElement || e;
997
+ if (e.hasAttribute("viewBox")) {
998
+ e = e.viewBox.baseVal;
999
+ return [[e.x, e.y], [e.x + e.width, e.y + e.height]];
1000
+ }
1001
+ return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]];
1002
+ }
1003
+ return [[0, 0], [e.clientWidth, e.clientHeight]];
1004
+ }
1005
+
1006
+ function defaultTransform() {
1007
+ return this.__zoom || identity;
1008
+ }
1009
+
1010
+ function defaultWheelDelta() {
1011
+ return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002);
1012
+ }
1013
+
1014
+ function defaultTouchable() {
1015
+ return navigator.maxTouchPoints || ("ontouchstart" in this);
1016
+ }
1017
+
1018
+ function defaultConstrain(transform, extent, translateExtent) {
1019
+ var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
1020
+ dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
1021
+ dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
1022
+ dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
1023
+ return transform.translate(
1024
+ dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
1025
+ dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
1026
+ );
1027
+ }
1028
+
1029
+ function zoom() {
1030
+ var filter = defaultFilter,
1031
+ extent = defaultExtent,
1032
+ constrain = defaultConstrain,
1033
+ wheelDelta = defaultWheelDelta,
1034
+ touchable = defaultTouchable,
1035
+ scaleExtent = [0, Infinity],
1036
+ translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]],
1037
+ duration = 250,
1038
+ interpolate = interpolateZoom,
1039
+ listeners = dispatch("start", "zoom", "end"),
1040
+ touchstarting,
1041
+ touchending,
1042
+ touchDelay = 500,
1043
+ wheelDelay = 150,
1044
+ clickDistance2 = 0;
1045
+
1046
+ function zoom(selection) {
1047
+ selection
1048
+ .property("__zoom", defaultTransform)
1049
+ .on("wheel.zoom", wheeled)
1050
+ .on("mousedown.zoom", mousedowned)
1051
+ .on("dblclick.zoom", dblclicked)
1052
+ .filter(touchable)
1053
+ .on("touchstart.zoom", touchstarted)
1054
+ .on("touchmove.zoom", touchmoved)
1055
+ .on("touchend.zoom touchcancel.zoom", touchended)
1056
+ .style("touch-action", "none")
1057
+ .style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
1058
+ }
1059
+
1060
+ zoom.transform = function(collection, transform, point) {
1061
+ var selection = collection.selection ? collection.selection() : collection;
1062
+ selection.property("__zoom", defaultTransform);
1063
+ if (collection !== selection) {
1064
+ schedule(collection, transform, point);
1065
+ } else {
1066
+ selection.interrupt().each(function() {
1067
+ gesture(this, arguments)
1068
+ .start()
1069
+ .zoom(null, typeof transform === "function" ? transform.apply(this, arguments) : transform)
1070
+ .end();
1071
+ });
1072
+ }
1073
+ };
1074
+
1075
+ zoom.scaleBy = function(selection, k, p) {
1076
+ zoom.scaleTo(selection, function() {
1077
+ var k0 = this.__zoom.k,
1078
+ k1 = typeof k === "function" ? k.apply(this, arguments) : k;
1079
+ return k0 * k1;
1080
+ }, p);
1081
+ };
1082
+
1083
+ zoom.scaleTo = function(selection, k, p) {
1084
+ zoom.transform(selection, function() {
1085
+ var e = extent.apply(this, arguments),
1086
+ t0 = this.__zoom,
1087
+ p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p,
1088
+ p1 = t0.invert(p0),
1089
+ k1 = typeof k === "function" ? k.apply(this, arguments) : k;
1090
+ return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
1091
+ }, p);
1092
+ };
1093
+
1094
+ zoom.translateBy = function(selection, x, y) {
1095
+ zoom.transform(selection, function() {
1096
+ return constrain(this.__zoom.translate(
1097
+ typeof x === "function" ? x.apply(this, arguments) : x,
1098
+ typeof y === "function" ? y.apply(this, arguments) : y
1099
+ ), extent.apply(this, arguments), translateExtent);
1100
+ });
1101
+ };
1102
+
1103
+ zoom.translateTo = function(selection, x, y, p) {
1104
+ zoom.transform(selection, function() {
1105
+ var e = extent.apply(this, arguments),
1106
+ t = this.__zoom,
1107
+ p0 = p == null ? centroid(e) : typeof p === "function" ? p.apply(this, arguments) : p;
1108
+ return constrain(identity.translate(p0[0], p0[1]).scale(t.k).translate(
1109
+ typeof x === "function" ? -x.apply(this, arguments) : -x,
1110
+ typeof y === "function" ? -y.apply(this, arguments) : -y
1111
+ ), e, translateExtent);
1112
+ }, p);
1113
+ };
1114
+
1115
+ function scale(transform, k) {
1116
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k));
1117
+ return k === transform.k ? transform : new Transform(k, transform.x, transform.y);
1118
+ }
1119
+
1120
+ function translate(transform, p0, p1) {
1121
+ var x = p0[0] - p1[0] * transform.k, y = p0[1] - p1[1] * transform.k;
1122
+ return x === transform.x && y === transform.y ? transform : new Transform(transform.k, x, y);
1123
+ }
1124
+
1125
+ function centroid(extent) {
1126
+ return [(+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2];
1127
+ }
1128
+
1129
+ function schedule(transition, transform, point) {
1130
+ transition
1131
+ .on("start.zoom", function() { gesture(this, arguments).start(); })
1132
+ .on("interrupt.zoom end.zoom", function() { gesture(this, arguments).end(); })
1133
+ .tween("zoom", function() {
1134
+ var that = this,
1135
+ args = arguments,
1136
+ g = gesture(that, args),
1137
+ e = extent.apply(that, args),
1138
+ p = point == null ? centroid(e) : typeof point === "function" ? point.apply(that, args) : point,
1139
+ w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]),
1140
+ a = that.__zoom,
1141
+ b = typeof transform === "function" ? transform.apply(that, args) : transform,
1142
+ i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
1143
+ return function(t) {
1144
+ if (t === 1) t = b; // Avoid rounding error on end.
1145
+ else { var l = i(t), k = w / l[2]; t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k); }
1146
+ g.zoom(null, t);
1147
+ };
1148
+ });
1149
+ }
1150
+
1151
+ function gesture(that, args, clean) {
1152
+ return (!clean && that.__zooming) || new Gesture(that, args);
1153
+ }
1154
+
1155
+ function Gesture(that, args) {
1156
+ this.that = that;
1157
+ this.args = args;
1158
+ this.active = 0;
1159
+ this.extent = extent.apply(that, args);
1160
+ this.taps = 0;
1161
+ }
1162
+
1163
+ Gesture.prototype = {
1164
+ start: function() {
1165
+ if (++this.active === 1) {
1166
+ this.that.__zooming = this;
1167
+ this.emit("start");
1168
+ }
1169
+ return this;
1170
+ },
1171
+ zoom: function(key, transform) {
1172
+ if (this.mouse && key !== "mouse") this.mouse[1] = transform.invert(this.mouse[0]);
1173
+ if (this.touch0 && key !== "touch") this.touch0[1] = transform.invert(this.touch0[0]);
1174
+ if (this.touch1 && key !== "touch") this.touch1[1] = transform.invert(this.touch1[0]);
1175
+ this.that.__zoom = transform;
1176
+ this.emit("zoom");
1177
+ return this;
1178
+ },
1179
+ end: function() {
1180
+ if (--this.active === 0) {
1181
+ delete this.that.__zooming;
1182
+ this.emit("end");
1183
+ }
1184
+ return this;
1185
+ },
1186
+ emit: function(type) {
1187
+ customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [type, this.that, this.args]);
1188
+ }
1189
+ };
1190
+
1191
+ function wheeled() {
1192
+ if (!filter.apply(this, arguments)) return;
1193
+ var g = gesture(this, arguments),
1194
+ t = this.__zoom,
1195
+ k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))),
1196
+ p = mouse(this);
1197
+
1198
+ // If the mouse is in the same location as before, reuse it.
1199
+ // If there were recent wheel events, reset the wheel idle timeout.
1200
+ if (g.wheel) {
1201
+ if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) {
1202
+ g.mouse[1] = t.invert(g.mouse[0] = p);
1203
+ }
1204
+ clearTimeout(g.wheel);
1205
+ }
1206
+
1207
+ // If this wheel event won’t trigger a transform change, ignore it.
1208
+ else if (t.k === k) return;
1209
+
1210
+ // Otherwise, capture the mouse point and location at the start.
1211
+ else {
1212
+ g.mouse = [p, t.invert(p)];
1213
+ interrupt(this);
1214
+ g.start();
1215
+ }
1216
+
1217
+ noevent();
1218
+ g.wheel = setTimeout(wheelidled, wheelDelay);
1219
+ g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
1220
+
1221
+ function wheelidled() {
1222
+ g.wheel = null;
1223
+ g.end();
1224
+ }
1225
+ }
1226
+
1227
+ function mousedowned() {
1228
+ if (touchending || !filter.apply(this, arguments)) return;
1229
+ var g = gesture(this, arguments, true),
1230
+ v = d3Select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true),
1231
+ p = mouse(this),
1232
+ x0 = event.clientX,
1233
+ y0 = event.clientY;
1234
+
1235
+ dragDisable(event.view);
1236
+ nopropagation();
1237
+ g.mouse = [p, this.__zoom.invert(p)];
1238
+ interrupt(this);
1239
+ g.start();
1240
+
1241
+ function mousemoved() {
1242
+ noevent();
1243
+ if (!g.moved) {
1244
+ var dx = event.clientX - x0, dy = event.clientY - y0;
1245
+ g.moved = dx * dx + dy * dy > clickDistance2;
1246
+ }
1247
+ g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent, translateExtent));
1248
+ }
1249
+
1250
+ function mouseupped() {
1251
+ v.on("mousemove.zoom mouseup.zoom", null);
1252
+ yesdrag(event.view, g.moved);
1253
+ noevent();
1254
+ g.end();
1255
+ }
1256
+ }
1257
+
1258
+ function dblclicked() {
1259
+ if (!filter.apply(this, arguments)) return;
1260
+ var t0 = this.__zoom,
1261
+ p0 = mouse(this),
1262
+ p1 = t0.invert(p0),
1263
+ k1 = t0.k * (event.shiftKey ? 0.5 : 2),
1264
+ t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
1265
+
1266
+ noevent();
1267
+ if (duration > 0) d3Select(this).transition().duration(duration).call(schedule, t1, p0);
1268
+ else d3Select(this).call(zoom.transform, t1);
1269
+ }
1270
+
1271
+ function touchstarted() {
1272
+ if (!filter.apply(this, arguments)) return;
1273
+ var touches = event.touches,
1274
+ n = touches.length,
1275
+ g = gesture(this, arguments, event.changedTouches.length === n),
1276
+ started, i, t, p;
1277
+
1278
+ nopropagation();
1279
+ for (i = 0; i < n; ++i) {
1280
+ t = touches[i], p = touch(this, touches, t.identifier);
1281
+ p = [p, this.__zoom.invert(p), t.identifier];
1282
+ if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting;
1283
+ else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0;
1284
+ }
1285
+
1286
+ if (touchstarting) touchstarting = clearTimeout(touchstarting);
1287
+
1288
+ if (started) {
1289
+ if (g.taps < 2) touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay);
1290
+ interrupt(this);
1291
+ g.start();
1292
+ }
1293
+ }
1294
+
1295
+ function touchmoved() {
1296
+ if (!this.__zooming) return;
1297
+ var g = gesture(this, arguments),
1298
+ touches = event.changedTouches,
1299
+ n = touches.length, i, t, p, l;
1300
+
1301
+ noevent();
1302
+ if (touchstarting) touchstarting = clearTimeout(touchstarting);
1303
+ g.taps = 0;
1304
+ for (i = 0; i < n; ++i) {
1305
+ t = touches[i], p = touch(this, touches, t.identifier);
1306
+ if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p;
1307
+ else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p;
1308
+ }
1309
+ t = g.that.__zoom;
1310
+ if (g.touch1) {
1311
+ var p0 = g.touch0[0], l0 = g.touch0[1],
1312
+ p1 = g.touch1[0], l1 = g.touch1[1],
1313
+ dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp,
1314
+ dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
1315
+ t = scale(t, Math.sqrt(dp / dl));
1316
+ p = [(p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2];
1317
+ l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2];
1318
+ }
1319
+ else if (g.touch0) p = g.touch0[0], l = g.touch0[1];
1320
+ else return;
1321
+ g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
1322
+ }
1323
+
1324
+ function touchended() {
1325
+ if (!this.__zooming) return;
1326
+ var g = gesture(this, arguments),
1327
+ touches = event.changedTouches,
1328
+ n = touches.length, i, t;
1329
+
1330
+ nopropagation();
1331
+ if (touchending) clearTimeout(touchending);
1332
+ touchending = setTimeout(function() { touchending = null; }, touchDelay);
1333
+ for (i = 0; i < n; ++i) {
1334
+ t = touches[i];
1335
+ if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0;
1336
+ else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1;
1337
+ }
1338
+ if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1;
1339
+ if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]);
1340
+ else {
1341
+ g.end();
1342
+ // If this was a dbltap, reroute to the (optional) dblclick.zoom handler.
1343
+ if (g.taps === 2) {
1344
+ var p = d3Select(this).on("dblclick.zoom");
1345
+ if (p) p.apply(this, arguments);
1346
+ }
1347
+ }
1348
+ }
1349
+
1350
+ zoom.wheelDelta = function(_) {
1351
+ return arguments.length ? (wheelDelta = typeof _ === "function" ? _ : constant(+_), zoom) : wheelDelta;
1352
+ };
1353
+
1354
+ zoom.filter = function(_) {
1355
+ return arguments.length ? (filter = typeof _ === "function" ? _ : constant(!!_), zoom) : filter;
1356
+ };
1357
+
1358
+ zoom.touchable = function(_) {
1359
+ return arguments.length ? (touchable = typeof _ === "function" ? _ : constant(!!_), zoom) : touchable;
1360
+ };
1361
+
1362
+ zoom.extent = function(_) {
1363
+ return arguments.length ? (extent = typeof _ === "function" ? _ : constant([[+_[0][0], +_[0][1]], [+_[1][0], +_[1][1]]]), zoom) : extent;
1364
+ };
1365
+
1366
+ zoom.scaleExtent = function(_) {
1367
+ return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [scaleExtent[0], scaleExtent[1]];
1368
+ };
1369
+
1370
+ zoom.translateExtent = function(_) {
1371
+ return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]];
1372
+ };
1373
+
1374
+ zoom.constrain = function(_) {
1375
+ return arguments.length ? (constrain = _, zoom) : constrain;
1376
+ };
1377
+
1378
+ zoom.duration = function(_) {
1379
+ return arguments.length ? (duration = +_, zoom) : duration;
1380
+ };
1381
+
1382
+ zoom.interpolate = function(_) {
1383
+ return arguments.length ? (interpolate = _, zoom) : interpolate;
1384
+ };
1385
+
1386
+ zoom.on = function() {
1387
+ var value = listeners.on.apply(listeners, arguments);
1388
+ return value === listeners ? zoom : value;
1389
+ };
1390
+
1391
+ zoom.clickDistance = function(_) {
1392
+ return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
1393
+ };
1394
+
1395
+ return zoom;
1396
+ }
1397
+
1398
+ var css_248z = ".SNA {\n overflow: hidden;\n object-fit: contain;\n position: relative;\n font-size: 0.75rem;\n width: 100%;\n}\n.SNA--smallSize .node {\n padding-top: 8px;\n font-size: 0.75rem;\n width: 3rem;\n height: 3rem;\n overflow: hidden;\n white-space: pre-wrap;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n}\n.SNA .node {\n background-color: #4a4e69;\n border-radius: 50%;\n color: #fff;\n font-size: 20px;\n font-weight: 500;\n height: 54px;\n width: 54px;\n padding-top: 15px;\n position: absolute;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: grab;\n}\n.SNA .links line {\n stroke: #c7bfb4;\n stroke-width: 2;\n}\n.SNA .mainNode {\n fill: #4e3a16;\n}\n.SNA .person {\n fill: #867b3a;\n}\n.SNA .publication {\n fill: #825c0d;\n}\n.SNA .article {\n fill: #afafaf;\n}\n.SNA .keyword {\n fill: #fcfae8;\n}\n.SNA .org {\n fill: #000000;\n}\n.SNA #network-graph svg {\n width: 100%;\n height: 100%;\n}\n\n@media only screen and (max-width: 484px) {\n .SNA {\n margin-left: 0px;\n }\n .SNA .node {\n background-color: #4a4e69;\n border-radius: 50%;\n color: #fff;\n font-size: 1px;\n font-weight: 500;\n height: 44px;\n width: 44px;\n padding-top: 12px;\n position: absolute;\n text-align: center;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n cursor: grab;\n }\n}\n@media only screen and (max-width: 484px) {\n .SNA {\n margin-left: 0px;\n }\n}";
1399
+ styleInject(css_248z);
1400
+
1401
+ /* eslint-disable indent */
1402
+ var SNA = function SNA(props) {
1403
+ // common
1404
+ var className = props.className,
1405
+ intl = props.intl,
1406
+ exclude = props.exclude,
1407
+ distance = props.distance,
1408
+ SNAData = props.SNAData,
1409
+ handleClickNodeGoto = props.handleClickNodeGoto,
1410
+ DownloadExcel = props.DownloadExcel;
1411
+ // styles
1412
+ var width = props.width,
1413
+ height = props.height,
1414
+ fontColor = props.fontColor,
1415
+ backgroundColor = props.backgroundColor,
1416
+ iconColor = props.iconColor;
1417
+ var g;
1418
+ if (!SNAData || SNAData.nodes.length === 0) {
1419
+ return /*#__PURE__*/React__default.createElement("div", {
1420
+ className: "noData"
1421
+ }, intl ? intl.formatMessage({
1422
+ id: 'common.noData'
1423
+ }) : '暫無資料');
1424
+ }
1425
+ var contentWidth = useMemo(function () {
1426
+ return screen.width > 1050 ? width : screen.width - 80;
1427
+ }, [screen.width]);
1428
+ var contentHeight = useMemo(function () {
1429
+ return screen.width > 1050 ? height : screen.height - 300;
1430
+ }, [screen.width]);
1431
+ var translateType = function translateType(type) {
1432
+ switch (type) {
1433
+ case 'mainNode':
1434
+ // 主要搜尋中心
1435
+ return intl ? intl.formatMessage({
1436
+ id: 'SNA.search.center'
1437
+ }) : '主要搜尋中心';
1438
+ case 'organization':
1439
+ // 組織
1440
+ return intl ? intl.formatMessage({
1441
+ id: 'SNA.organization'
1442
+ }) : '組織';
1443
+ case 'person':
1444
+ // 作家
1445
+ return intl ? intl.formatMessage({
1446
+ id: 'SNA.author'
1447
+ }) : '作家';
1448
+ case 'publication':
1449
+ // 著作
1450
+ return intl ? intl.formatMessage({
1451
+ id: 'SNA.publication'
1452
+ }) : '作家';
1453
+ case 'article':
1454
+ // 單篇作品
1455
+ return intl ? intl.formatMessage({
1456
+ id: 'SNA.article'
1457
+ }) : '單篇作品';
1458
+ case 'keyword':
1459
+ // 關鍵字
1460
+ return intl ? intl.formatMessage({
1461
+ id: 'SNA.keyword'
1462
+ }) : '關鍵字';
1463
+ case 'event':
1464
+ // 事件
1465
+ return intl ? intl.formatMessage({
1466
+ id: 'SNA.event'
1467
+ }) : '事件';
1468
+ default:
1469
+ return '';
1470
+ }
1471
+ };
1472
+ var drag$1 = function drag$1(simulation) {
1473
+ function dragstarted(d) {
1474
+ if (!event.active) simulation.alphaTarget(0.3).restart();
1475
+ d.fx = d.x;
1476
+ d.fy = d.y;
1477
+ }
1478
+ function dragged(d) {
1479
+ d.fx = event.x > contentWidth - 10 || event.x < 20 ? d.x : event.x;
1480
+ d.fy = event.y > contentHeight - 10 || event.y < 20 ? d.y : event.y;
1481
+ }
1482
+ return drag().on('start', dragstarted).on('drag', dragged);
1483
+ };
1484
+ var calculateCurve = function calculateCurve(source, target, curveLen) {
1485
+ var mx = (target.x + source.x) * 0.5;
1486
+ var my = (target.y + source.y) * 0.5;
1487
+ var tsx = target.x - source.x;
1488
+ var tsy = target.y - source.y;
1489
+ var L = Math.pow(Math.pow(tsx, 2) + Math.pow(tsy, 2), 0.5);
1490
+ var qx = mx - tsy * curveLen / L;
1491
+ var qy = my + tsx * curveLen / L;
1492
+ return {
1493
+ qx: qx,
1494
+ qy: qy
1495
+ };
1496
+ };
1497
+ var getLineCurve = function getLineCurve(source, target, curveLen) {
1498
+ var _calculateCurve = calculateCurve(source, target, curveLen),
1499
+ qx = _calculateCurve.qx,
1500
+ qy = _calculateCurve.qy;
1501
+ if (isNaN(qx)) {
1502
+ return "M".concat(source.x, ", ").concat(source.y, " Q0 0 ").concat(target.x, " ").concat(target.y);
1503
+ }
1504
+ return "M".concat(source.x, ", ").concat(source.y, " Q").concat(qx, " ").concat(qy, " ").concat(target.x, " ").concat(target.y);
1505
+ };
1506
+ var init = function init(networkData) {
1507
+ var edgeLabelSize = '10px';
1508
+ var lineRaduis = 30;
1509
+ var nodeStroke = 1.5;
1510
+ var nodeRadius = 10 - nodeStroke;
1511
+ var mainNodeRadius = 15 - nodeStroke;
1512
+ var arrowPercent = 0.8;
1513
+ var arrowViewBox = "-0 -".concat(nodeRadius, " ").concat(nodeRadius * 2, " ").concat(nodeRadius * 2);
1514
+ var arrowPath = "M 0,-".concat(nodeRadius * arrowPercent, " L ").concat(nodeRadius * arrowPercent * 2, " ,0 L 0,").concat(nodeRadius * arrowPercent);
1515
+ var color = ordinal(category10);
1516
+ var links = networkData.links.map(function (d) {
1517
+ return Object.create(d);
1518
+ });
1519
+ var nodes = networkData.nodes.map(function (d) {
1520
+ return Object.create(d);
1521
+ });
1522
+ var simulation$1 = simulation(nodes).force('link', link(links).id(function (d) {
1523
+ return d.index;
1524
+ }).distance(50)).force('charge', manyBody().strength(-200).distanceMax(1000)).force('center', center(contentWidth / 2, contentHeight / 2)).force('collide', collide().radius(function () {
1525
+ return nodeRadius + 5;
1526
+ }).strength(1).iterations(10)).force('x', x(contentWidth / 2)).force('y', y(contentHeight / 2)).force('radial', radial(100, contentWidth / 1.5, contentHeight / 1.5));
1527
+ var svg = d3Select('#sna-graph').append('svg').attr('viewBox', [0, 0, contentWidth, contentHeight]).style('background-color', backgroundColor);
1528
+ svg.append('defs').append('marker').attr('id', 'arrowhead').attr('viewBox', arrowViewBox).attr('refX', nodeRadius * 2 + nodeRadius * arrowPercent).attr('refY', 0).attr('orient', 'auto').attr('markerWidth', nodeRadius * (1 + arrowPercent)).attr('markerHeight', nodeRadius * (1 + arrowPercent)).attr('xoverflow', 'visible').append('svg:path').attr('d', arrowPath).attr('fill', '#999').style('stroke', 'none');
1529
+ // 增加一層g用來包住所有的物件,並對此g加入縮放功能
1530
+ g = svg.append('g');
1531
+ var zoomActions = function zoomActions() {
1532
+ g.attr('transform', event.transform);
1533
+ };
1534
+ var zoomHandler = zoom().scaleExtent([0.5, 20]).extent([[0, 0], [contentWidth, contentHeight]]).on('zoom', zoomActions);
1535
+ zoomHandler(svg);
1536
+ var link$1 = g.append('g').attr('stroke', '#999').attr('stroke-opacity', 0.6).selectAll('line').data(links).join('path').attr('fill', 'none').attr('stroke-dasharray', function (d) {
1537
+ return d.ontology === 'protege' ? '2,5,3' : '';
1538
+ }).attr('key', function (d) {
1539
+ return d.type;
1540
+ });
1541
+ var node = g.append('g').attr('stroke', '#fff').attr('stroke-width', nodeStroke).selectAll('circle').data(nodes).join('circle').attr('r', function (d) {
1542
+ return d.type === 'mainNode' ? mainNodeRadius : nodeRadius;
1543
+ }).attr('fill', function (d) {
1544
+ return color(d.type);
1545
+ }).attr('key', function (d) {
1546
+ return d.type;
1547
+ }).attr('class', function (d) {
1548
+ return "node node-".concat(d.id, " ").concat(d.type && d.type === 'organization' ? 'org' : d.type === 'person' ? 'person' : d.type === 'publication' ? 'publication' : d.type === 'mainNode' ? 'mainNode' : d.type === 'article' ? 'article' : d.type === 'keyword' ? 'keyword' : d.type === 'event' ? 'event' : '');
1549
+ }).on('click', function (d) {
1550
+ return d.hasClick ? handleClickNodeGoto({
1551
+ name: d.name,
1552
+ id: d.id,
1553
+ type: d.type
1554
+ }) : null;
1555
+ }).call(drag$1(simulation$1));
1556
+ node.append('title').text(function (d) {
1557
+ return "".concat(d.name, "-").concat(translateType(d.type));
1558
+ });
1559
+ var nodeLabel = g.append('g').selectAll('text').data(nodes).join('text').attr('fill', fontColor).attr('text-anchor', 'middle').attr('key', function (d) {
1560
+ return d.type;
1561
+ }).style('color', '#fff').style('font-size', '14px').text(function (d) {
1562
+ return d.name;
1563
+ });
1564
+ var edgepaths = g.selectAll('.edgepath').data(links).enter().append('path').attr('class', 'edgepath').attr('fill-opacity', 0).attr('stroke-opacity', 0).attr('id', function (d, i) {
1565
+ return "edgepath".concat(i);
1566
+ }).style('pointer-events', 'none');
1567
+ var edgelabels = g.selectAll('.edgelabel').data(links).enter().append('text').style('pointer-events', 'none').attr('class', 'edgelabel').attr('font-size', edgeLabelSize).attr('fill', '#aaa').attr('visibility', 'visible').attr('key', function (d) {
1568
+ return d.type;
1569
+ }).attr('id', function (d, i) {
1570
+ return "edgelabel".concat(i);
1571
+ });
1572
+ edgelabels.append('textPath').attr('xlink:href', function (d, i) {
1573
+ return "#edgepath".concat(i);
1574
+ }).style('text-anchor', 'middle').style('pointer-events', 'none').attr('startOffset', '50%').text(function (d) {
1575
+ return d.property;
1576
+ });
1577
+ simulation$1.on('tick', function () {
1578
+ nodes.forEach(function (d) {
1579
+ // x軸 超過寬度380,回彈到380座標軸區域位置。 ——作用爲:超出範圍的回彈到視圖寬度範圍內
1580
+ if (d.x >= contentWidth - 20) {
1581
+ d.x = contentWidth - 20;
1582
+ }
1583
+ // y軸 超過高度280,回彈到280座標軸區域位置。 ——作用爲:超出範圍的回彈到視圖高度範圍內
1584
+ if (d.y >= contentHeight - 20) {
1585
+ d.y = contentHeight - 20;
1586
+ }
1587
+ if (d.x <= 20) {
1588
+ d.x = 20;
1589
+ }
1590
+ if (d.y <= 20) {
1591
+ d.y = 20;
1592
+ }
1593
+ });
1594
+ link$1.attr('d', function (d) {
1595
+ return getLineCurve(d.source, d.target, lineRaduis);
1596
+ });
1597
+ node.attr('cx', function (d) {
1598
+ return d.x;
1599
+ }).attr('cy', function (d) {
1600
+ return d.y;
1601
+ });
1602
+ nodeLabel.attr('x', function (d) {
1603
+ return d.x;
1604
+ }).attr('y', function (d) {
1605
+ return d.y - nodeRadius;
1606
+ });
1607
+ edgepaths.attr('d', function (d) {
1608
+ return getLineCurve(d.source, d.target, lineRaduis);
1609
+ });
1610
+ });
1611
+ };
1612
+ var renderSNA = function renderSNA() {
1613
+ if (SNAData && SNAData.nodes && SNAData.nodes.length > 0) {
1614
+ var div = document.getElementById('sna-graph');
1615
+ if (div && div.childNodes[0]) {
1616
+ div.removeChild(div.childNodes[0]);
1617
+ }
1618
+ init(SNAData);
1619
+ }
1620
+ };
1621
+
1622
+ // 資料異動或全螢幕切換,重新渲染網絡圖
1623
+ useEffect(function () {
1624
+ renderSNA();
1625
+ }, [SNAData]);
1626
+ return /*#__PURE__*/React__default.createElement("div", {
1627
+ className: classNames('SNA', {
1628
+ 'SNA--smallSize': distance < 200
1629
+ }, className),
1630
+ style: {
1631
+ contentWidth: contentWidth,
1632
+ contentHeight: contentHeight,
1633
+ backgroundColor: backgroundColor
1634
+ }
1635
+ }, /*#__PURE__*/React__default.createElement(ExtraTools, {
1636
+ data: SNAData,
1637
+ iconColor: iconColor,
1638
+ domToImageId: "sna-graph",
1639
+ FontSizeTargets: ['#sna-graph svg g text'],
1640
+ exclude: exclude,
1641
+ DownloadExcel: DownloadExcel,
1642
+ fullscreenDomId: "sna-graph",
1643
+ renderSNA: renderSNA
1644
+ }), /*#__PURE__*/React__default.createElement("div", {
1645
+ id: "sna-graph"
1646
+ }));
1647
+ };
1648
+ SNA.defaultProps = {
1649
+ className: undefined,
1650
+ intl: undefined,
1651
+ width: 1050,
1652
+ height: 600,
1653
+ distance: 400,
1654
+ SNAData: null,
1655
+ fontColor: '#000000',
1656
+ backgroundColor: '#FFFFFF',
1657
+ iconColor: '#825c0d',
1658
+ exclude: ['downloadXls', 'downloadTsv'],
1659
+ handleClickNodeGoto: null,
1660
+ DownloadExcel: undefined
1661
+ };
1662
+
1663
+ /* Write props detail information and 'npm run updateStory' will help you generate stories's argTypes */
1664
+ SNA.propTypes = {
1665
+ /** Css Name */
1666
+ className: PropTypes.string,
1667
+ /** 語言 */
1668
+ intl: PropTypes.objectOf(PropTypes.any),
1669
+ /** 寬度 */
1670
+ width: PropTypes.number,
1671
+ /** 高度 */
1672
+ height: PropTypes.number,
1673
+ /** 點跟點之間的距離 */
1674
+ distance: PropTypes.number,
1675
+ /** 資料 */
1676
+ SNAData: PropTypes.objectOf(PropTypes.any),
1677
+ /** 網絡圖文字顏色 */
1678
+ fontColor: PropTypes.string,
1679
+ /** 網絡圖背景顏色 */
1680
+ backgroundColor: PropTypes.string,
1681
+ /** icon顏色 */
1682
+ iconColor: PropTypes.string,
1683
+ /** 不顯示的按鈕 ['share', 'downloadImage', 'downloadTsv', 'downloadXls', 'fullscreen', 'fontSizeChanger'] */
1684
+ exclude: PropTypes.arrayOf(PropTypes.string),
1685
+ /** 按下點後要轉址的功能 */
1686
+ handleClickNodeGoto: PropTypes.func,
1687
+ /** Download元件, 由外部傳入的原因是需要環境設定 */
1688
+ DownloadExcel: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
1689
+ };
1690
+
1691
+ export { SNA as default };