From 3f232ca9931dec3e2453a65f9085eb52a87f3b7b Mon Sep 17 00:00:00 2001 From: Rico Sonntag Date: Mon, 28 Aug 2023 20:36:12 +0200 Subject: [PATCH] Release 1.6.0 --- package.json | 2 +- resources/js/pedigree-chart.min.js | 2 +- src/Module.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index e80ede8..b180b4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webtrees-pedigree-chart", - "version": "1.5.1-dev", + "version": "1.6.0", "license": "GPL-3.0", "repository": { "type": "git", diff --git a/resources/js/pedigree-chart.min.js b/resources/js/pedigree-chart.min.js index cc7f334..0e82c86 100644 --- a/resources/js/pedigree-chart.min.js +++ b/resources/js/pedigree-chart.min.js @@ -1 +1 @@ -var t,e;t=this,e=function(t){var e="http://www.w3.org/1999/xhtml",n={svg:"http://www.w3.org/2000/svg",xhtml:e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function i(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===e&&n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(r,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function a(t){var e=r(t);return(e.local?o:i)(e)}function s(){}function h(t){return null==t?s:function(){return this.querySelector(t)}}function u(){return[]}function l(t){return null==t?u:function(){return this.querySelectorAll(t)}}function c(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}function f(t){return function(){return this.matches(t)}}function d(t){return function(e){return e.matches(t)}}var p=Array.prototype.find;function g(){return this.firstElementChild}var m=Array.prototype.filter;function _(){return Array.from(this.children)}function y(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}function x(t,e,n,r,i,o){for(var a,s=0,h=e.length,u=o.length;se?1:t>=e?0:NaN}function A(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function E(t,e){return function(){this.setAttribute(t,e)}}function M(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function S(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function T(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 P(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function C(t){return function(){this.style.removeProperty(t)}}function L(t,e,n){return function(){this.style.setProperty(t,e,n)}}function R(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function $(t,e){return t.style.getPropertyValue(e)||P(t).getComputedStyle(t,null).getPropertyValue(e)}function B(t){return function(){delete this[t]}}function I(t,e){return function(){this[t]=e}}function H(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function D(t){return t.trim().split(/^|\s+/)}function X(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=D(t.getAttribute("class")||"")}function Y(t,e){for(var n=X(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lt=[null];function ct(t,e){this._groups=t,this._parents=e}function ft(){return new ct([[document.documentElement]],lt)}function dt(t){return"string"==typeof t?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],lt)}function pt(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}ct.prototype=ft.prototype={constructor:ct,select:function(t){"function"!=typeof t&&(t=h(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=N+1);!(v=_[A])&&++A=0;)(r=i[o])&&(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=N);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?C:"function"==typeof e?R:L)(t,e,null==n?"":n)):$(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?B:"function"==typeof e?H:I)(t,e)):this.node()[t]},classed:function(t,e){var n=D(t+"");if(arguments.length<2){for(var r=X(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?at:ot,r=0;r{}};function mt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--bt}()}finally{bt=0,function(){for(var t,e,n=xt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:xt=e);wt=t,It(r)}(),Et=0}}function Bt(){var t=St.now(),e=t-zt;e>At&&(Mt-=e,zt=t)}function It(t){bt||(kt&&(kt=clearTimeout(kt)),t-Et>24?(t<1/0&&(kt=setTimeout($t,t-St.now()-Mt)),Nt&&(Nt=clearInterval(Nt))):(Nt||(zt=St.now(),Nt=setInterval(Bt,At)),bt=1,Tt($t)))}function Ht(t,e,n){var r=new Lt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Lt.prototype=Rt.prototype={constructor:Lt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Pt():+n)+(null==e?0:+e),this._next||wt===this||(wt?wt._next=this:xt=this,wt=this),this._call=t,this._time=n,It()},stop:function(){this._call&&(this._call=null,this._time=1/0,It())}};var Dt=mt("start","end","cancel","interrupt"),Xt=[],Wt=0,Yt=1,Vt=2,qt=3,Ot=4,Ut=5,jt=6;function Ft(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=Yt,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,l,c,f;if(n.state!==Yt)return h();for(u in i)if((f=i[u]).name===n.name){if(f.state===qt)return Ht(a);f.state===Ot?(f.state=jt,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[u]):+uWt)throw new Error("too late; already scheduled");return n}function Kt(t,e){var n=Qt(t,e);if(n.state>qt)throw new Error("too late; already running");return n}function Qt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Jt(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>Vt&&n.state>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ve(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ve(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=he.exec(t))?new we(e[1],e[2],e[3],1):(e=ue.exec(t))?new we(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=le.exec(t))?ve(e[1],e[2],e[3],e[4]):(e=ce.exec(t))?ve(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=fe.exec(t))?Ee(e[1],e[2]/100,e[3]/100,1):(e=de.exec(t))?Ee(e[1],e[2]/100,e[3]/100,e[4]):pe.hasOwnProperty(t)?ye(pe[t]):"transparent"===t?new we(NaN,NaN,NaN,0):null}function ye(t){return new we(t>>16&255,t>>8&255,255&t,1)}function ve(t,e,n,r){return r<=0&&(t=e=n=NaN),new we(t,e,n,r)}function xe(t,e,n,r){return 1===arguments.length?((i=t)instanceof ee||(i=_e(i)),i?new we((i=i.rgb()).r,i.g,i.b,i.opacity):new we):new we(t,e,n,null==r?1:r);var i}function we(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function be(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function ke(){const t=Ne(this.opacity);return`${1===t?"rgb(":"rgba("}${Ae(this.r)}, ${Ae(this.g)}, ${Ae(this.b)}${1===t?")":`, ${t})`}`}function Ne(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ae(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ze(t){return((t=Ae(t))<16?"0":"")+t.toString(16)}function Ee(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Se(t,e,n,r)}function Me(t){if(t instanceof Se)return new Se(t.h,t.s,t.l,t.opacity);if(t instanceof ee||(t=_e(t)),!t)return new Se;if(t instanceof Se)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,h=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&h<1?0:a,new Se(a,s,h,t.opacity)}function Se(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Te(t){return(t=(t||0)%360)<0?t+360:t}function Pe(t){return Math.max(0,Math.min(1,t||0))}function Ce(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Zt(ee,_e,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ge,formatHex:ge,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Me(this).formatHsl()},formatRgb:me,toString:me}),Zt(we,xe,te(ee,{brighter(t){return t=null==t?re:Math.pow(re,t),new we(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ne:Math.pow(ne,t),new we(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new we(Ae(this.r),Ae(this.g),Ae(this.b),Ne(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:be,formatHex:be,formatHex8:function(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ke,toString:ke})),Zt(Se,(function(t,e,n,r){return 1===arguments.length?Me(t):new Se(t,e,n,null==r?1:r)}),te(ee,{brighter(t){return t=null==t?re:Math.pow(re,t),new Se(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ne:Math.pow(ne,t),new Se(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new we(Ce(t>=240?t-240:t+120,i,r),Ce(t,i,r),Ce(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Se(Te(this.h),Pe(this.s),Pe(this.l),Ne(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ne(this.opacity);return`${1===t?"hsl(":"hsla("}${Te(this.h)}, ${100*Pe(this.s)}%, ${100*Pe(this.l)}%${1===t?")":`, ${t})`}`}}));var Le=t=>()=>t;function Re(t){return 1==(t=+t)?$e:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Le(isNaN(e)?n:e)}}function $e(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Le(isNaN(t)?e:t)}var Be=function t(e){var n=Re(e);function r(t,e){var r=n((t=xe(t)).r,(e=xe(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=$e(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Ie(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var He=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,De=new RegExp(He.source,"g");function Xe(t,e){var n,r,i,o=He.lastIndex=De.lastIndex=0,a=-1,s=[],h=[];for(t+="",e+="";(n=He.exec(t))&&(r=De.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,h.push({i:a,x:Ie(n,r)})),o=De.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ie(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,h),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ie(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,h),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ie(t,n)},{i:s-2,x:Ie(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,h),o=a=null,function(t){for(var e,n=-1,r=h.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Gt:Kt;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=r(t),i="transform"===n?je:tn;return this.attrTween(t,"function"==typeof e?(n.local?sn:an)(n,i,Ze(this,"attr."+t,e)):null==e?(n.local?nn:en)(n):(n.local?on:rn)(n,i,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var i=r(t);return this.tween(n,(i.local?hn:un)(i,e))},style:function(t,e,n){var r="transform"==(t+="")?Ue:tn;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=$(this,t),a=(this.style.removeProperty(t),$(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,gn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=$(this,t),s=n(this),h=s+"";return null==s&&(this.style.removeProperty(t),h=s=$(this,t)),a===h?null:a===r&&h===i?o:(i=h,o=e(r=a,s))}}(t,r,Ze(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var h=Kt(this,t),u=h.on,l=null==h.value[a]?o||(o=gn(e)):void 0;u===n&&i===l||(r=(n=u).copy()).on(s,i=l),h.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=$(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ze(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Qt(this.node(),n).tween,o=0,a=i.length;o()=>t;function An(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function zn(t,e,n){this.k=t,this.x=e,this.y=n}zn.prototype={constructor:zn,scale:function(t){return 1===t?this:new zn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new zn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var En=new zn(1,0,0);function Mn(t){for(;!t.__zoom;)if(!(t=t.parentNode))return En;return t.__zoom}function Sn(t){t.stopImmediatePropagation()}function Tn(t){t.preventDefault(),t.stopImmediatePropagation()}function Pn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Cn(){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 Ln(){return this.__zoom||En}function Rn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function $n(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bn(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function In(){var t,e,n,r=Pn,i=Cn,o=Bn,a=Rn,s=$n,h=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ke,f=mt("start","zoom","end"),d=500,p=150,g=0,m=10;function _(t){t.property("__zoom",Ln).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",E).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(t,e){return(e=Math.max(h[0],Math.min(h[1],e)))===t.k?t:new zn(e,t.x,t.y)}function v(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new zn(t.k,r,i)}function x(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,r){t.on("start.zoom",(function(){b(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=b(t,o).event(r),s=i.apply(t,o),h=null==n?x(s):"function"==typeof n?n.apply(t,o):n,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=c(l.invert(h).concat(u/l.k),f.invert(h).concat(u/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=u/e[2];t=new zn(n,h[0]-e[0]*n,h[1]-e[1]*n)}a.zoom(null,t)}}))}function b(t,e,n){return!n&&t.__zooming||new k(t,e)}function k(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function N(t,...e){if(r.apply(this,arguments)){var n=b(this,e).event(t),i=this.__zoom,s=Math.max(h[0],Math.min(h[1],i.k*Math.pow(2,a.apply(this,arguments)))),l=pt(t);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=i.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[l,i.invert(l)],Jt(this),n.start()}Tn(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",o(v(y(i,s),n.mouse[0],n.mouse[1]),n.extent,u))}}function A(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=b(this,e,!0).event(t),s=dt(t.view).on("mousemove.zoom",(function(t){if(Tn(t),!a.moved){var e=t.clientX-l,n=t.clientY-c;a.moved=e*e+n*n>g}a.event(t).zoom("mouse",o(v(a.that.__zoom,a.mouse[0]=pt(t,i),a.mouse[1]),a.extent,u))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=dt(t).on("dragstart.drag",null);e&&(r.on("click.drag",kn,bn),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,a.moved),Tn(t),a.event(t).end()}),!0),h=pt(t,i),l=t.clientX,c=t.clientY;!function(t){var e=t.document.documentElement,n=dt(t).on("dragstart.drag",kn,bn);"onselectstart"in e?n.on("selectstart.drag",kn,bn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),Sn(t),a.mouse=[h,this.__zoom.invert(h)],Jt(this),a.start()}}function z(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=pt(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),h=n.k*(t.shiftKey?.5:2),c=o(v(y(n,h),a,s),i.apply(this,e),u);Tn(t),l>0?dt(this).transition().duration(l).call(w,c,a,t):dt(this).call(_.transform,c,a,t)}}function E(n,...i){if(r.apply(this,arguments)){var o,a,s,h,u=n.touches,l=u.length,c=b(this,i,n.changedTouches.length===l).event(n);for(Sn(n),a=0;a=0;)e+=n[r].value;else e=1;t.value=e}function Dn(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Wn)):void 0===e&&(e=Xn);for(var n,r,i,o,a,s=new qn(t),h=[s];n=h.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)h.push(r=i[o]=new qn(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Vn)}function Xn(t){return t.children}function Wn(t){return Array.isArray(t)?t[1]:null}function Yn(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Vn(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function qn(t){this.data=t,this.depth=this.height=0,this.parent=null}function On(t,e){return t.parent===e.parent?1:2}function Un(t){var e=t.children;return e?e[0]:t.t}function jn(t){var e=t.children;return e?e[e.length-1]:t.t}function Fn(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Gn(t,e,n){return t.a.parent===e.parent?t.a:n}function Kn(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function Qn(){var t=On,e=1,n=1,r=null;function i(i){var h=function(t){for(var e,n,r,i,o,a=new Kn(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new Kn(r[i],i)),n.parent=e;return(a.parent=new Kn(null,0)).children=[a],a}(i);if(h.eachAfter(o),h.parent.m=-h.z,h.eachBefore(a),r)i.eachBefore(s);else{var u=i,l=i,c=i;i.eachBefore((function(t){t.xl.x&&(l=t),t.depth>c.depth&&(c=t)}));var f=u===l?1:t(u,l)/2,d=f-u.x,p=e/(l.x+f+d),g=n/(c.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,h=o.parent.children[0],u=o.m,l=a.m,c=s.m,f=h.m;s=jn(s),o=Un(o),s&&o;)h=Un(h),(a=jn(a)).a=e,(i=s.z+c-o.z-u+t(s._,o._))>0&&(Fn(Gn(s,e,r),e,i),u+=i,l+=i),c+=s.m,u+=o.m,f+=h.m,l+=a.m;s&&!jn(a)&&(a.t=s,a.m+=c-l),o&&!Un(h)&&(h.t=o,h.m+=u-f,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Jn(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}Mn.prototype=zn.prototype,qn.prototype=Dn.prototype={constructor:qn,count:function(){return this.eachAfter(Hn)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],h=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return Dn(this).eachBefore(Yn)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n1+(t?Math.max(...t.map(e)):0),n=e(t);let r=Dn(t,(t=>this._configuration.showEmptyBoxes?(!t.parents&&t.generation.5));this._root=r,this._nodes=i(r)}get nodes(){return this._nodes}get root(){return this._root}createEmptyNode(t,e){return{id:0,xref:"",url:"",updateUrl:"",generation:t,name:"",firstNames:[],lastNames:[],preferredName:"",alternativeNames:[],isAltRtl:!1,sex:e,timespan:""}}}class cr{constructor(t,e){this._orientation=t,this._cornerRadius=e,this._imagePadding=5,this._imageRadius=Math.min(40,t.boxHeight/2-this._imagePadding),this._x=this.calculateX(),this._y=this.calculateY(),this._width=this.calculateImageWidth(),this._height=this.calculateImageHeight(),this._rx=this.calculateCornerRadius(),this._ry=this.calculateCornerRadius()}calculateX(){return-this._orientation.boxWidth/2+this._imagePadding}calculateY(){return this._orientation instanceof ar||this._orientation instanceof sr?-this._imageRadius:-this._orientation.boxHeight/2+this._imagePadding}calculateImageWidth(){return this._orientation instanceof ar||this._orientation instanceof sr?2*this._imageRadius:this._orientation.boxWidth-2*this._imagePadding}calculateImageHeight(){return 2*this._imageRadius}calculateCornerRadius(){return this._cornerRadius-this._imagePadding}get imagePadding(){return this._imagePadding}get imageRadius(){return this._imageRadius}set imageRadius(t){this._imageRadius=t}get x(){return this._x}get y(){return this._y}get rx(){return this._rx}get ry(){return this._ry}get width(){return this._width}get height(){return this._height}}class fr{constructor(t,e=null){this._orientation=t,this._image=e,this._textPadding=15,this._x=this.calculateX(),this._y=this.calculateY(),this._width=this.calculateWidth()}calculateX(){const t=-this._orientation.boxWidth/2+this._textPadding;return this._image?t+this._image.width:t}calculateY(){return this._orientation instanceof ar||this._orientation instanceof sr?-this._textPadding:this._image?this._image.y+this._image.height+2*this._textPadding:-this._orientation.boxHeight/2+2*this._textPadding}calculateWidth(){const t=this._orientation.boxWidth-2*this._textPadding;return this._image&&(this._orientation instanceof ar||this._orientation instanceof sr)?t-this._image.width:t}get x(){return this._x}get y(){return this._y}get width(){return this._width}}class dr{constructor(t){this._cornerRadius=20,this._showImage=!0,this._orientation=t,this._x=-t.boxWidth/2,this._y=-t.boxHeight/2,this._rx=this._cornerRadius,this._ry=this._cornerRadius,this._width=t.boxWidth,this._height=t.boxHeight,this._image=new cr(t,this._cornerRadius)}get showImage(){return this._showImage}set showImage(t){this._showImage=t}get x(){return this._x}get y(){return this._y}get rx(){return this._rx}get ry(){return this._ry}get width(){return this._width}get height(){return this._height}get image(){return this._image}get text(){return new fr(this._orientation,this._showImage?this._image:null)}}class pr{constructor(t,e,n){this._svg=t,this._configuration=e,this._hierarchy=n,this._hierarchy.root.x0=0,this._hierarchy.root.y0=0,this._orientation=this._configuration.orientation,this._box=new dr(this._orientation),this.draw(this._hierarchy.root)}draw(t){let e=this._hierarchy.nodes.descendants(),n=this._hierarchy.nodes.links();e.forEach((t=>{this._orientation.norm(t)})),this.drawLinks(n,t),this.drawNodes(e,t),e.forEach((t=>{t.x0=t.x,t.y0=t.y}))}drawNodes(t,e){let n=0,r=this;this._svg.defs.get().append("clipPath").attr("id","clip-image").append("rect").attr("rx",this._box.image.rx).attr("ry",this._box.image.ry).attr("x",this._box.image.x).attr("y",this._box.image.y).attr("width",this._box.image.width).attr("height",this._box.image.height);let i=this._svg.visual.selectAll("g.person").data(t,(t=>t.id||(t.id=++n))).enter().append("g").attr("class","person").attr("transform",(t=>"translate("+t.x+","+t.y+")"));i.append("rect").attr("class",(t=>"F"===t.data.sex?"female":t.data.sex===tr?"male":"unknown")).attr("rx",this._box.rx).attr("ry",this._box.ry).attr("x",this._box.x).attr("y",this._box.y).attr("width",this._box.width).attr("height",this._box.height).attr("fill-opacity",.5),i.filter((t=>""!==t.data.xref)).each((function(t){let e=dt(this);e.append("title").text((t=>t.data.name));const n=r.getImageToLoad(t);if(r._box.showImage=!!n,r._box.showImage){let t=e.append("g").attr("class","image");t.append("rect").attr("rx",r._box.image.rx).attr("ry",r._box.image.ry).attr("x",r._box.image.x).attr("y",r._box.image.y).attr("width",r._box.image.width).attr("height",r._box.image.height).attr("fill","rgb(255, 255, 255)");let i=t.append("image").attr("x",r._box.image.x).attr("y",r._box.image.y).attr("width",r._box.image.width).attr("height",r._box.image.height).attr("clip-path","url(#clip-image)");(function(t,e=null){return fetch(t,e).then((t=>t.blob())).then((t=>new Promise(((e,n)=>{const r=new FileReader;r.onloadend=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}))))})(n).then((t=>i.attr("xlink:href",t))).catch((t=>{console.error(t)})),t.append("rect").attr("rx",r._box.image.rx).attr("ry",r._box.image.ry).attr("x",r._box.image.x).attr("y",r._box.image.y).attr("width",r._box.image.width).attr("height",r._box.image.height).attr("fill","none").attr("stroke","rgb(200, 200, 200)").attr("stroke-width",1.5)}r.addNames(e,t),r.addDates(e,t),r._box.showImage=!0}))}togglePerson(t,e){e.parents?(e._parents=e.parents,e.parents=null):(e.parents=e._parents,e._parents=null),this.draw(e)}collapse(t){t.parents&&(t._parents=t.parents,t._parents.forEach((t=>this.collapse(t))),t.parents=null)}addFirstNames(t,e){let n=0;for(let r of e.data.firstNames){let i=t.append("tspan").text(r);r===e.data.preferredName&&i.attr("class","preferred"),0!==n&&i.attr("dx","0.25em"),++n}}addLastNames(t,e,n=0){let r=0;for(let i of e.data.lastNames){let e=t.append("tspan").attr("class","lastName").text(i);0!==r&&e.attr("dx","0.25em"),0!==n&&e.attr("dx",n+"em"),++r}}truncateNames(t){let e=this._box.text.width;t.selectAll("tspan:not(.preferred):not(.lastName)").nodes().reverse().forEach((n=>dt(n).each(this.truncateText(t,e)))),t.selectAll("tspan.preferred").each(this.truncateText(t,e)),t.selectAll("tspan.lastName").each(this.truncateText(t,e))}truncateText(t,e){let n=this;return function(){let r=n.getTextLength(t),i=dt(this),o=i.text().split(/\s+/);for(let a=o.length-1;a>=0;--a)r>e&&(o[a]=o[a].slice(0,1)+".",i.text(o.join(" ")),r=n.getTextLength(t))}}truncateDate(t,e){let n=this;return function(){let r=n.getTextLength(t),i=dt(this),o=i.text();for(;r>e&&o.length>1;)o=o.slice(0,-1).trim(),i.text(o),r=n.getTextLength(t);"."===o[o.length-1]&&i.text(o.slice(0,-1).trim())}}getTextLength(t){let e=0;return t.selectAll("tspan").each((function(){e+=this.getComputedTextLength()})),e}addNames(t,e){let n=t.append("g").attr("class","name");if(this._orientation.splittNames){let t=n.append("text").attr("text-anchor","middle").attr("alignment-baseline","central").attr("dy",this._box.text.y),r=n.append("text").attr("text-anchor","middle").attr("alignment-baseline","central").attr("dy",this._box.text.y+20);this.addFirstNames(t,e),this.addLastNames(r,e),e.data.firstNames.length||e.data.lastNames.length||t.append("tspan").text(e.data.name),this.truncateNames(t),this.truncateNames(r)}else{let t=n.append("text").attr("text-anchor",this._configuration.rtl?"end":"start").attr("dx",this._box.text.x).attr("dy",this._box.text.y);this.addFirstNames(t,e),this.addLastNames(t,e,.25),e.data.firstNames.length||e.data.lastNames.length||t.append("tspan").text(e.data.name),this.truncateNames(t)}}addDates(t,e){let n=t.append("g").attr("class","table");if(this._orientation.splittNames){let t=n.append("text").attr("class","date").attr("text-anchor","middle").attr("alignment-baseline","central").attr("dy",this._box.text.y+50);t.append("title").text(e.data.timespan);let r=t.append("tspan").text(e.data.timespan);return void(this.getTextLength(t)>this._box.text.width&&(t.selectAll("tspan").each(this.truncateDate(t,this._box.text.width)),r.text(r.text()+"…")))}let r=20;if(e.data.birth){n.append("text").attr("class","date").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r).append("tspan").text("★").attr("x",this._box.text.x+5);let t=n.append("text").attr("class","date").attr("text-anchor",this._configuration.rtl?"end":"start").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r);t.append("title").text(e.data.birth);let i=t.append("tspan").text(e.data.birth).attr("x",this._box.text.x+15);this.getTextLength(t)>this._box.text.width-25&&(t.selectAll("tspan").each(this.truncateDate(t,this._box.text.width-25)),i.text(i.text()+"…"))}if(e.data.death){e.data.birth&&(r+=20),n.append("text").attr("class","date").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r).append("tspan").text("†").attr("x",this._box.text.x+5);let t=n.append("text").attr("class","date").attr("text-anchor",this._configuration.rtl?"end":"start").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r);t.append("title").text(e.data.death);let i=t.append("tspan").text(e.data.death).attr("x",this._box.text.x+15);this.getTextLength(t)>this._box.text.width-25&&(t.selectAll("tspan").each(this.truncateDate(t,this._box.text.width-25)),i.text(i.text().trim()+"…"))}}getImageToLoad(t){return t.data.thumbnail?t.data.thumbnail:""}drawLinks(t,e){this._svg.visual.selectAll("path.link").data(t,(t=>t.target.id)).enter().append("path").classed("link",!0).attr("d",(t=>this._orientation.elbow(t)))}}class gr{constructor(t){this._element=t.append("div").attr("class","overlay").style("opacity",1e-6)}show(t,e=0,n=null){this._element.select("p").remove(),this._element.append("p").attr("class","tooltip").text(t),this._element.transition().duration(e).style("opacity",1).on("end",(()=>{"function"==typeof n&&n()}))}hide(t=0,e=0){this._element.transition().delay(t).duration(e).style("opacity",1e-6)}get(){return this._element}}class mr{constructor(t){this._element=t.append("defs")}get(){return this._element}}class _r{constructor(t){this._zoom=null,this._parent=t,this.init()}init(){this._zoom=In(),this._zoom.scaleExtent([.1,20]).on("zoom",(t=>{this._parent.attr("transform",t.transform)})),this._zoom.wheelDelta((t=>-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002))),this._zoom.filter((t=>{if("wheel"===t.type){if(!t.ctrlKey)return!1;var e=Mn(this);if(e.k){if(e.k<=.1&&t.deltaY>0)return t.preventDefault(),!1;if(e.k>=20&&t.deltaY<0)return t.preventDefault(),!1}return!0}return t.button||"touchstart"!==t.type?!(t.ctrlKey&&"wheel"!==t.type||t.button):2===t.touches.length}))}get(){return this._zoom}}class yr{triggerDownload(t,e){let n=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),r=document.createElement("a");r.setAttribute("download",e),r.setAttribute("href",t),r.setAttribute("target","_blank"),r.dispatchEvent(n)}}class vr extends yr{copyStylesInline(t,e){let n=["svg","g","text","textPath"];for(let r=0;r{let i=(new XMLSerializer).serializeToString(t),o=window.URL||window.webkitURL||window,a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),s=o.createObjectURL(a),h=new Image;h.onload=()=>{let t=this.createCanvas(e,n),i=t.getContext("2d");i.fillStyle="rgb(255,255,255)",i.fillRect(0,0,t.width,t.height),i.drawImage(h,0,0),o.revokeObjectURL(s);let a=t.toDataURL("image/png").replace("image/png","image/octet-stream");r(a)},h.src=s}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e){const n=[4960,3508];this.cloneSvg(t.get().node()).then((e=>{this.copyStylesInline(t.get().node(),e);const r=this.calculateViewBox(t.get().node()),i=Math.max(n[0],r[2]),o=Math.max(n[1],r[3]);return e.setAttribute("width",""+i),e.setAttribute("height",""+o),e.setAttribute("viewBox",""+r),this.convertToDataUrl(e,i,o)})).then((t=>this.triggerDownload(t,e))).catch((()=>{console.log("Failed to save chart as PNG image")}))}}class xr extends yr{copyStylesInline(t,e){return new Promise((n=>{(function(t,e){return fetch(t,e).then(Jn)})(t).then((t=>{t=t.replace(/#webtrees-pedigree-chart-container /g,"");let r=document.createElementNS("http://www.w3.org/2000/svg","style");r.appendChild(document.createTextNode(t)),e.prepend(r),n(e)}))}))}convertToObjectUrl(t){return new Promise((e=>{let n=(new XMLSerializer).serializeToString(t),r=window.URL||window.webkitURL||window,i=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=r.createObjectURL(i),a=new Image;a.onload=()=>{e(o)},a.src=o}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e,n){this.cloneSvg(t.get().node()).then((t=>this.copyStylesInline(e,t))).then((t=>this.convertToObjectUrl(t))).then((t=>this.triggerDownload(t,n))).catch((()=>{console.log("Failed to save chart as SVG image")}))}}class wr{constructor(){this._exportClass=null}setExportClass(t){switch(t){case"png":this._exportClass=vr;break;case"svg":this._exportClass=xr}}createExport(t){switch(this.setExportClass(t),t){case"png":case"svg":return new this._exportClass}}}class br{constructor(t,e){this._element=t.append("svg"),this._defs=new mr(this._element),this._visual=null,this._zoom=null,this._configuration=e,this.init()}init(){this._element.attr("width","100%").attr("height","100%").attr("text-rendering","optimizeLegibility").attr("text-anchor","middle").attr("xmlns:xlink","https://www.w3.org/1999/xlink")}initEvents(t){this._element.on("contextmenu",(t=>t.preventDefault())).on("wheel",(e=>{e.ctrlKey||t.show(this._configuration.labels.zoom,300,(()=>{t.hide(700,800)}))})).on("touchend",(e=>{e.touches.length<2&&t.hide(0,800)})).on("touchmove",(e=>{e.touches.length>=2?t.hide():t.show(this._configuration.labels.move)})).on("click",(t=>this.doStopPropagation(t)),!0),this._configuration.rtl&&this._element.classed("rtl",!0),this._visual=this._element.append("g"),this._zoom=new _r(this._visual),this._element.call(this._zoom.get())}doStopPropagation(t){t.defaultPrevented&&t.stopPropagation()}export(t){return(new wr).createExport(t)}get defs(){return this._defs}get zoom(){return this._zoom}get visual(){return this._visual}get(){return this._element}}class kr{constructor(t,e){this._configuration=e,this._parent=t,this._hierarchy=new lr(this._configuration),this._data={}}get svg(){return this._svg}updateViewBox(){let t=this._svg.visual.node().getBBox(),e=this._parent.node().getBoundingClientRect(),n=Math.max(e.width,t.width),r=Math.max(e.height,t.height,300),i=(n-t.width)/2,o=(r-t.height)/2,a=Math.ceil(t.x-i-10),s=Math.ceil(t.y-o-10);n=Math.ceil(n+20),r=Math.ceil(r+20),this._svg.get().attr("viewBox",[a,s,n,r])}get data(){return this._data}set data(t){this._data=t,this._hierarchy.init(this._data)}draw(){this._parent.html(""),this._svg=new br(this._parent,this._configuration),this._overlay=new gr(this._parent),this._svg.initEvents(this._overlay),new pr(this._svg,this._configuration,this._hierarchy),this.bindClickEventListener(),this.updateViewBox()}bindClickEventListener(){let t=this;this._svg.visual.selectAll("g.person").filter((t=>""!==t.data.xref)).each((function(e){dt(this).on("click",(function(){t.personClick(e.data)}))}))}personClick(t){1===t.generation?this.redirectToIndividual(t.url):this.update(t.updateUrl)}redirectToIndividual(t){window.location=t}update(t){window.location=t}}t.PedigreeChart=class{constructor(t,e){this._selector=t,this._parent=dt(this._selector),this._configuration=new ur(e.labels,e.generations,e.showEmptyBoxes,e.treeLayout,e.rtl),this._chart=new kr(this._parent,this._configuration),this.init()}init(){dt("#centerButton").on("click",(()=>this.center())),dt("#exportPNG").on("click",(()=>this.exportPNG())),dt("#exportSVG").on("click",(()=>this.exportSVG()))}center(){this._chart.svg.get().transition().duration(750).call(this._chart.svg.zoom.get().transform,En)}get configuration(){return this._configuration}set cssFile(t){this._cssFile=t}update(t){this._chart.update(t)}draw(t){this._chart.data=t,this._chart.draw()}exportPNG(){this._chart.svg.export("png").svgToImage(this._chart.svg,"pedigree-chart.png")}exportSVG(){this._chart.svg.export("svg").svgToImage(this._chart.svg,this._cssFile,"pedigree-chart.svg")}},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WebtreesPedigreeChart={}); +var t,e;t=this,e=function(t){var e="http://www.w3.org/1999/xhtml",n={svg:"http://www.w3.org/2000/svg",xhtml:e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function r(t){var e=t+="",r=e.indexOf(":");return r>=0&&"xmlns"!==(e=t.slice(0,r))&&(t=t.slice(r+1)),n.hasOwnProperty(e)?{space:n[e],local:t}:t}function i(t){return function(){var n=this.ownerDocument,r=this.namespaceURI;return r===e&&n.documentElement.namespaceURI===e?n.createElement(t):n.createElementNS(r,t)}}function o(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function a(t){var e=r(t);return(e.local?o:i)(e)}function s(){}function h(t){return null==t?s:function(){return this.querySelector(t)}}function u(){return[]}function l(t){return null==t?u:function(){return this.querySelectorAll(t)}}function c(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}function f(t){return function(){return this.matches(t)}}function d(t){return function(e){return e.matches(t)}}var p=Array.prototype.find;function g(){return this.firstElementChild}var m=Array.prototype.filter;function _(){return Array.from(this.children)}function y(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}function x(t,e,n,r,i,o){for(var a,s=0,h=e.length,u=o.length;se?1:t>=e?0:NaN}function A(t){return function(){this.removeAttribute(t)}}function z(t){return function(){this.removeAttributeNS(t.space,t.local)}}function E(t,e){return function(){this.setAttribute(t,e)}}function M(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function S(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function T(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 P(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function C(t){return function(){this.style.removeProperty(t)}}function L(t,e,n){return function(){this.style.setProperty(t,e,n)}}function R(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function $(t,e){return t.style.getPropertyValue(e)||P(t).getComputedStyle(t,null).getPropertyValue(e)}function B(t){return function(){delete this[t]}}function I(t,e){return function(){this[t]=e}}function H(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function D(t){return t.trim().split(/^|\s+/)}function X(t){return t.classList||new W(t)}function W(t){this._node=t,this._names=D(t.getAttribute("class")||"")}function Y(t,e){for(var n=X(t),r=-1,i=e.length;++r=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var lt=[null];function ct(t,e){this._groups=t,this._parents=e}function ft(){return new ct([[document.documentElement]],lt)}function dt(t){return"string"==typeof t?new ct([[document.querySelector(t)]],[document.documentElement]):new ct([[t]],lt)}function pt(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}ct.prototype=ft.prototype={constructor:ct,select:function(t){"function"!=typeof t&&(t=h(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=A&&(A=N+1);!(v=_[A])&&++A=0;)(r=i[o])&&(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=N);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==e?C:"function"==typeof e?R:L)(t,e,null==n?"":n)):$(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?B:"function"==typeof e?H:I)(t,e)):this.node()[t]},classed:function(t,e){var n=D(t+"");if(arguments.length<2){for(var r=X(this.node()),i=-1,o=n.length;++i=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?at:ot,r=0;r{}};function mt(){for(var t,e=0,n=arguments.length,r={};e=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a0)for(var n,r,i=new Array(n),o=0;o=0&&e._call.call(void 0,t),e=e._next;--bt}()}finally{bt=0,function(){for(var t,e,n=xt,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:xt=e);wt=t,It(r)}(),Et=0}}function Bt(){var t=St.now(),e=t-zt;e>At&&(Mt-=e,zt=t)}function It(t){bt||(kt&&(kt=clearTimeout(kt)),t-Et>24?(t<1/0&&(kt=setTimeout($t,t-St.now()-Mt)),Nt&&(Nt=clearInterval(Nt))):(Nt||(zt=St.now(),Nt=setInterval(Bt,At)),bt=1,Tt($t)))}function Ht(t,e,n){var r=new Lt;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Lt.prototype=Rt.prototype={constructor:Lt,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Pt():+n)+(null==e?0:+e),this._next||wt===this||(wt?wt._next=this:xt=this,wt=this),this._call=t,this._time=n,It()},stop:function(){this._call&&(this._call=null,this._time=1/0,It())}};var Dt=mt("start","end","cancel","interrupt"),Xt=[],Wt=0,Yt=1,Vt=2,qt=3,Ot=4,Ut=5,jt=6;function Ft(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=Yt,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,l,c,f;if(n.state!==Yt)return h();for(u in i)if((f=i[u]).name===n.name){if(f.state===qt)return Ht(a);f.state===Ot?(f.state=jt,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[u]):+uWt)throw new Error("too late; already scheduled");return n}function Kt(t,e){var n=Qt(t,e);if(n.state>qt)throw new Error("too late; already running");return n}function Qt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Jt(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>Vt&&n.state>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ve(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ve(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=he.exec(t))?new we(e[1],e[2],e[3],1):(e=ue.exec(t))?new we(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=le.exec(t))?ve(e[1],e[2],e[3],e[4]):(e=ce.exec(t))?ve(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=fe.exec(t))?Ee(e[1],e[2]/100,e[3]/100,1):(e=de.exec(t))?Ee(e[1],e[2]/100,e[3]/100,e[4]):pe.hasOwnProperty(t)?ye(pe[t]):"transparent"===t?new we(NaN,NaN,NaN,0):null}function ye(t){return new we(t>>16&255,t>>8&255,255&t,1)}function ve(t,e,n,r){return r<=0&&(t=e=n=NaN),new we(t,e,n,r)}function xe(t,e,n,r){return 1===arguments.length?((i=t)instanceof ee||(i=_e(i)),i?new we((i=i.rgb()).r,i.g,i.b,i.opacity):new we):new we(t,e,n,null==r?1:r);var i}function we(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function be(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}`}function ke(){const t=Ne(this.opacity);return`${1===t?"rgb(":"rgba("}${Ae(this.r)}, ${Ae(this.g)}, ${Ae(this.b)}${1===t?")":`, ${t})`}`}function Ne(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ae(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ze(t){return((t=Ae(t))<16?"0":"")+t.toString(16)}function Ee(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Se(t,e,n,r)}function Me(t){if(t instanceof Se)return new Se(t.h,t.s,t.l,t.opacity);if(t instanceof ee||(t=_e(t)),!t)return new Se;if(t instanceof Se)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,h=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n0&&h<1?0:a,new Se(a,s,h,t.opacity)}function Se(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Te(t){return(t=(t||0)%360)<0?t+360:t}function Pe(t){return Math.max(0,Math.min(1,t||0))}function Ce(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}Zt(ee,_e,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:ge,formatHex:ge,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Me(this).formatHsl()},formatRgb:me,toString:me}),Zt(we,xe,te(ee,{brighter(t){return t=null==t?re:Math.pow(re,t),new we(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ne:Math.pow(ne,t),new we(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new we(Ae(this.r),Ae(this.g),Ae(this.b),Ne(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:be,formatHex:be,formatHex8:function(){return`#${ze(this.r)}${ze(this.g)}${ze(this.b)}${ze(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ke,toString:ke})),Zt(Se,(function(t,e,n,r){return 1===arguments.length?Me(t):new Se(t,e,n,null==r?1:r)}),te(ee,{brighter(t){return t=null==t?re:Math.pow(re,t),new Se(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ne:Math.pow(ne,t),new Se(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new we(Ce(t>=240?t-240:t+120,i,r),Ce(t,i,r),Ce(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Se(Te(this.h),Pe(this.s),Pe(this.l),Ne(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Ne(this.opacity);return`${1===t?"hsl(":"hsla("}${Te(this.h)}, ${100*Pe(this.s)}%, ${100*Pe(this.l)}%${1===t?")":`, ${t})`}`}}));var Le=t=>()=>t;function Re(t){return 1==(t=+t)?$e:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Le(isNaN(e)?n:e)}}function $e(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Le(isNaN(t)?e:t)}var Be=function t(e){var n=Re(e);function r(t,e){var r=n((t=xe(t)).r,(e=xe(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=$e(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Ie(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var He=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,De=new RegExp(He.source,"g");function Xe(t,e){var n,r,i,o=He.lastIndex=De.lastIndex=0,a=-1,s=[],h=[];for(t+="",e+="";(n=He.exec(t))&&(r=De.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,h.push({i:a,x:Ie(n,r)})),o=De.lastIndex;return o180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Ie(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,h),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Ie(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,h),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Ie(t,n)},{i:s-2,x:Ie(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,h),o=a=null,function(t){for(var e,n=-1,r=h.length;++n=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Gt:Kt;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=r(t),i="transform"===n?je:tn;return this.attrTween(t,"function"==typeof e?(n.local?sn:an)(n,i,Ze(this,"attr."+t,e)):null==e?(n.local?nn:en)(n):(n.local?on:rn)(n,i,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var i=r(t);return this.tween(n,(i.local?hn:un)(i,e))},style:function(t,e,n){var r="transform"==(t+="")?Ue:tn;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=$(this,t),a=(this.style.removeProperty(t),$(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,gn(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=$(this,t),s=n(this),h=s+"";return null==s&&(this.style.removeProperty(t),h=s=$(this,t)),a===h?null:a===r&&h===i?o:(i=h,o=e(r=a,s))}}(t,r,Ze(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var h=Kt(this,t),u=h.on,l=null==h.value[a]?o||(o=gn(e)):void 0;u===n&&i===l||(r=(n=u).copy()).on(s,i=l),h.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=$(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Ze(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Qt(this.node(),n).tween,o=0,a=i.length;o()=>t;function An(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function zn(t,e,n){this.k=t,this.x=e,this.y=n}zn.prototype={constructor:zn,scale:function(t){return 1===t?this:new zn(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new zn(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var En=new zn(1,0,0);function Mn(t){for(;!t.__zoom;)if(!(t=t.parentNode))return En;return t.__zoom}function Sn(t){t.stopImmediatePropagation()}function Tn(t){t.preventDefault(),t.stopImmediatePropagation()}function Pn(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Cn(){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 Ln(){return this.__zoom||En}function Rn(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function $n(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bn(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function In(){var t,e,n,r=Pn,i=Cn,o=Bn,a=Rn,s=$n,h=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Ke,f=mt("start","zoom","end"),d=500,p=150,g=0,m=10;function _(t){t.property("__zoom",Ln).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",E).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(t,e){return(e=Math.max(h[0],Math.min(h[1],e)))===t.k?t:new zn(e,t.x,t.y)}function v(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new zn(t.k,r,i)}function x(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function w(t,e,n,r){t.on("start.zoom",(function(){b(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(r).end()})).tween("zoom",(function(){var t=this,o=arguments,a=b(t,o).event(r),s=i.apply(t,o),h=null==n?x(s):"function"==typeof n?n.apply(t,o):n,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=c(l.invert(h).concat(u/l.k),f.invert(h).concat(u/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=u/e[2];t=new zn(n,h[0]-e[0]*n,h[1]-e[1]*n)}a.zoom(null,t)}}))}function b(t,e,n){return!n&&t.__zooming||new k(t,e)}function k(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function N(t,...e){if(r.apply(this,arguments)){var n=b(this,e).event(t),i=this.__zoom,s=Math.max(h[0],Math.min(h[1],i.k*Math.pow(2,a.apply(this,arguments)))),l=pt(t);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=i.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[l,i.invert(l)],Jt(this),n.start()}Tn(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",o(v(y(i,s),n.mouse[0],n.mouse[1]),n.extent,u))}}function A(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=b(this,e,!0).event(t),s=dt(t.view).on("mousemove.zoom",(function(t){if(Tn(t),!a.moved){var e=t.clientX-l,n=t.clientY-c;a.moved=e*e+n*n>g}a.event(t).zoom("mouse",o(v(a.that.__zoom,a.mouse[0]=pt(t,i),a.mouse[1]),a.extent,u))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),function(t,e){var n=t.document.documentElement,r=dt(t).on("dragstart.drag",null);e&&(r.on("click.drag",kn,bn),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(t.view,a.moved),Tn(t),a.event(t).end()}),!0),h=pt(t,i),l=t.clientX,c=t.clientY;!function(t){var e=t.document.documentElement,n=dt(t).on("dragstart.drag",kn,bn);"onselectstart"in e?n.on("selectstart.drag",kn,bn):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}(t.view),Sn(t),a.mouse=[h,this.__zoom.invert(h)],Jt(this),a.start()}}function z(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=pt(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),h=n.k*(t.shiftKey?.5:2),c=o(v(y(n,h),a,s),i.apply(this,e),u);Tn(t),l>0?dt(this).transition().duration(l).call(w,c,a,t):dt(this).call(_.transform,c,a,t)}}function E(n,...i){if(r.apply(this,arguments)){var o,a,s,h,u=n.touches,l=u.length,c=b(this,i,n.changedTouches.length===l).event(n);for(Sn(n),a=0;a=0;)e+=n[r].value;else e=1;t.value=e}function Dn(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Wn)):void 0===e&&(e=Xn);for(var n,r,i,o,a,s=new qn(t),h=[s];n=h.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)h.push(r=i[o]=new qn(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Vn)}function Xn(t){return t.children}function Wn(t){return Array.isArray(t)?t[1]:null}function Yn(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Vn(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function qn(t){this.data=t,this.depth=this.height=0,this.parent=null}function On(t,e){return t.parent===e.parent?1:2}function Un(t){var e=t.children;return e?e[0]:t.t}function jn(t){var e=t.children;return e?e[e.length-1]:t.t}function Fn(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Gn(t,e,n){return t.a.parent===e.parent?t.a:n}function Kn(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function Qn(){var t=On,e=1,n=1,r=null;function i(i){var h=function(t){for(var e,n,r,i,o,a=new Kn(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new Kn(r[i],i)),n.parent=e;return(a.parent=new Kn(null,0)).children=[a],a}(i);if(h.eachAfter(o),h.parent.m=-h.z,h.eachBefore(a),r)i.eachBefore(s);else{var u=i,l=i,c=i;i.eachBefore((function(t){t.xl.x&&(l=t),t.depth>c.depth&&(c=t)}));var f=u===l?1:t(u,l)/2,d=f-u.x,p=e/(l.x+f+d),g=n/(c.depth||1);i.eachBefore((function(t){t.x=(t.x+d)*p,t.y=t.depth*g}))}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,h=o.parent.children[0],u=o.m,l=a.m,c=s.m,f=h.m;s=jn(s),o=Un(o),s&&o;)h=Un(h),(a=jn(a)).a=e,(i=s.z+c-o.z-u+t(s._,o._))>0&&(Fn(Gn(s,e,r),e,i),u+=i,l+=i),c+=s.m,u+=o.m,f+=h.m,l+=a.m;s&&!jn(a)&&(a.t=s,a.m+=c-l),o&&!Un(h)&&(h.t=o,h.m+=u-f,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Jn(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}Mn.prototype=zn.prototype,qn.prototype=Dn.prototype={constructor:qn,count:function(){return this.eachAfter(Hn)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],h=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter((function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n}))},sort:function(t){return this.eachBefore((function(e){e.children&&e.children.sort(t)}))},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore((function(e){e.children||t.push(e)})),t},links:function(){var t=this,e=[];return t.each((function(n){n!==t&&e.push({source:n.parent,target:n})})),e},copy:function(){return Dn(this).eachBefore(Yn)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n1+(t?Math.max(...t.map(e)):0),n=e(t);let r=Dn(t,(t=>this._configuration.showEmptyBoxes?(!t.parents&&t.generation.5));this._root=r,this._nodes=i(r)}get nodes(){return this._nodes}get root(){return this._root}createEmptyNode(t,e){return{id:0,xref:"",url:"",updateUrl:"",generation:t,name:"",firstNames:[],lastNames:[],preferredName:"",alternativeNames:[],isAltRtl:!1,sex:e,timespan:""}}}class cr{constructor(t,e){this._orientation=t,this._cornerRadius=e,this._imagePadding=5,this._imageRadius=Math.min(40,t.boxHeight/2-this._imagePadding),this._x=this.calculateX(),this._y=this.calculateY(),this._width=this.calculateImageWidth(),this._height=this.calculateImageHeight(),this._rx=this.calculateCornerRadius(),this._ry=this.calculateCornerRadius()}calculateX(){return-this._orientation.boxWidth/2+this._imagePadding}calculateY(){return this._orientation instanceof ar||this._orientation instanceof sr?-this._imageRadius:-this._orientation.boxHeight/2+this._imagePadding}calculateImageWidth(){return this._orientation instanceof ar||this._orientation instanceof sr?2*this._imageRadius:this._orientation.boxWidth-2*this._imagePadding}calculateImageHeight(){return 2*this._imageRadius}calculateCornerRadius(){return this._cornerRadius-this._imagePadding}get imagePadding(){return this._imagePadding}get imageRadius(){return this._imageRadius}set imageRadius(t){this._imageRadius=t}get x(){return this._x}get y(){return this._y}get rx(){return this._rx}get ry(){return this._ry}get width(){return this._width}get height(){return this._height}}class fr{constructor(t,e=null){this._orientation=t,this._image=e,this._textPadding=15,this._x=this.calculateX(),this._y=this.calculateY(),this._width=this.calculateWidth()}calculateX(){const t=-this._orientation.boxWidth/2+this._textPadding;return this._image?t+this._image.width:t}calculateY(){return this._orientation instanceof ar||this._orientation instanceof sr?-this._textPadding:this._image?this._image.y+this._image.height+2*this._textPadding:-this._orientation.boxHeight/2+2*this._textPadding}calculateWidth(){const t=this._orientation.boxWidth-2*this._textPadding;return this._image&&(this._orientation instanceof ar||this._orientation instanceof sr)?t-this._image.width:t}get x(){return this._x}get y(){return this._y}get width(){return this._width}}class dr{constructor(t){this._cornerRadius=20,this._showImage=!0,this._orientation=t,this._x=-t.boxWidth/2,this._y=-t.boxHeight/2,this._rx=this._cornerRadius,this._ry=this._cornerRadius,this._width=t.boxWidth,this._height=t.boxHeight,this._image=new cr(t,this._cornerRadius)}get showImage(){return this._showImage}set showImage(t){this._showImage=t}get x(){return this._x}get y(){return this._y}get rx(){return this._rx}get ry(){return this._ry}get width(){return this._width}get height(){return this._height}get image(){return this._image}get text(){return new fr(this._orientation,this._showImage?this._image:null)}}class pr{constructor(t,e,n){this._svg=t,this._configuration=e,this._hierarchy=n,this._hierarchy.root.x0=0,this._hierarchy.root.y0=0,this._orientation=this._configuration.orientation,this._box=new dr(this._orientation),this.draw(this._hierarchy.root)}draw(t){let e=this._hierarchy.nodes.descendants(),n=this._hierarchy.nodes.links();e.forEach((t=>{this._orientation.norm(t)})),this.drawLinks(n,t),this.drawNodes(e,t),e.forEach((t=>{t.x0=t.x,t.y0=t.y}))}drawNodes(t,e){let n=0,r=this;this._svg.defs.get().append("clipPath").attr("id","clip-image").append("rect").attr("rx",this._box.image.rx).attr("ry",this._box.image.ry).attr("x",this._box.image.x).attr("y",this._box.image.y).attr("width",this._box.image.width).attr("height",this._box.image.height);let i=this._svg.visual.selectAll("g.person").data(t,(t=>t.id||(t.id=++n))).enter().append("g").attr("class","person").attr("transform",(t=>"translate("+t.x+","+t.y+")"));i.append("rect").attr("class",(t=>"F"===t.data.sex?"female":t.data.sex===tr?"male":"unknown")).attr("rx",this._box.rx).attr("ry",this._box.ry).attr("x",this._box.x).attr("y",this._box.y).attr("width",this._box.width).attr("height",this._box.height).attr("fill-opacity",.5),i.filter((t=>""!==t.data.xref)).each((function(t){let e=dt(this);e.append("title").text((t=>t.data.name));const n=r.getImageToLoad(t);if(r._box.showImage=!!n,r._box.showImage){let t=e.append("g").attr("class","image");t.append("rect").attr("rx",r._box.image.rx).attr("ry",r._box.image.ry).attr("x",r._box.image.x).attr("y",r._box.image.y).attr("width",r._box.image.width).attr("height",r._box.image.height).attr("fill","rgb(255, 255, 255)");let i=t.append("image").attr("x",r._box.image.x).attr("y",r._box.image.y).attr("width",r._box.image.width).attr("height",r._box.image.height).attr("clip-path","url(#clip-image)");(function(t,e=null){return fetch(t,e).then((t=>t.blob())).then((t=>new Promise(((e,n)=>{const r=new FileReader;r.onloadend=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}))))})(n).then((t=>i.attr("xlink:href",t))).catch((t=>{console.error(t)})),t.append("rect").attr("rx",r._box.image.rx).attr("ry",r._box.image.ry).attr("x",r._box.image.x).attr("y",r._box.image.y).attr("width",r._box.image.width).attr("height",r._box.image.height).attr("fill","none").attr("stroke","rgb(200, 200, 200)").attr("stroke-width",1.5)}r.addNames(e,t),r.addDates(e,t),r._box.showImage=!0}))}togglePerson(t,e){e.parents?(e._parents=e.parents,e.parents=null):(e.parents=e._parents,e._parents=null),this.draw(e)}collapse(t){t.parents&&(t._parents=t.parents,t._parents.forEach((t=>this.collapse(t))),t.parents=null)}addFirstNames(t,e){let n=0;for(let r of e.data.firstNames){let i=t.append("tspan").text(r);r===e.data.preferredName&&i.attr("class","preferred"),0!==n&&i.attr("dx","0.25em"),++n}}addLastNames(t,e,n=0){let r=0;for(let i of e.data.lastNames){let e=t.append("tspan").attr("class","lastName").text(i);0!==r&&e.attr("dx","0.25em"),0!==n&&e.attr("dx",n+"em"),++r}}truncateNames(t){let e=this._box.text.width;t.selectAll("tspan:not(.preferred):not(.lastName)").nodes().reverse().forEach((n=>dt(n).each(this.truncateText(t,e)))),t.selectAll("tspan.preferred").each(this.truncateText(t,e)),t.selectAll("tspan.lastName").each(this.truncateText(t,e))}truncateText(t,e){let n=this;return function(){let r=n.getTextLength(t),i=dt(this),o=i.text().split(/\s+/);for(let a=o.length-1;a>=0;--a)r>e&&(o[a]=o[a].slice(0,1)+".",i.text(o.join(" ")),r=n.getTextLength(t))}}truncateDate(t,e){let n=this;return function(){let r=n.getTextLength(t),i=dt(this),o=i.text();for(;r>e&&o.length>1;)o=o.slice(0,-1).trim(),i.text(o),r=n.getTextLength(t);"."===o[o.length-1]&&i.text(o.slice(0,-1).trim())}}getTextLength(t){let e=0;return t.selectAll("tspan").each((function(){e+=this.getComputedTextLength()})),e}addNames(t,e){let n=t.append("g").attr("class","name");if(this._orientation.splittNames){let t=n.append("text").attr("class","wt-chart-box-name").attr("text-anchor","middle").attr("alignment-baseline","central").attr("dy",this._box.text.y),r=n.append("text").attr("class","wt-chart-box-name").attr("text-anchor","middle").attr("alignment-baseline","central").attr("dy",this._box.text.y+20);this.addFirstNames(t,e),this.addLastNames(r,e),e.data.firstNames.length||e.data.lastNames.length||t.append("tspan").text(e.data.name),this.truncateNames(t),this.truncateNames(r)}else{let t=n.append("text").attr("class","wt-chart-box-name").attr("text-anchor",this._configuration.rtl?"end":"start").attr("dx",this._box.text.x).attr("dy",this._box.text.y);this.addFirstNames(t,e),this.addLastNames(t,e,.25),e.data.firstNames.length||e.data.lastNames.length||t.append("tspan").text(e.data.name),this.truncateNames(t)}}addDates(t,e){let n=t.append("g").attr("class","table");if(this._orientation.splittNames){let t=n.append("text").attr("class","date").attr("text-anchor","middle").attr("alignment-baseline","central").attr("dy",this._box.text.y+50);t.append("title").text(e.data.timespan);let r=t.append("tspan").text(e.data.timespan);return void(this.getTextLength(t)>this._box.text.width&&(t.selectAll("tspan").each(this.truncateDate(t,this._box.text.width)),r.text(r.text()+"…")))}let r=20;if(e.data.birth){n.append("text").attr("fill","currentColor").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r).append("tspan").text("★").attr("x",this._box.text.x+5);let t=n.append("text").attr("class","date").attr("text-anchor",this._configuration.rtl?"end":"start").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r);t.append("title").text(e.data.birth);let i=t.append("tspan").text(e.data.birth).attr("x",this._box.text.x+15);this.getTextLength(t)>this._box.text.width-25&&(t.selectAll("tspan").each(this.truncateDate(t,this._box.text.width-25)),i.text(i.text()+"…"))}if(e.data.death){e.data.birth&&(r+=20),n.append("text").attr("fill","currentColor").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r).append("tspan").text("†").attr("x",this._box.text.x+5);let t=n.append("text").attr("class","date").attr("text-anchor",this._configuration.rtl?"end":"start").attr("dominant-baseline","middle").attr("x",this._box.text.x).attr("dy",this._box.text.y+r);t.append("title").text(e.data.death);let i=t.append("tspan").text(e.data.death).attr("x",this._box.text.x+15);this.getTextLength(t)>this._box.text.width-25&&(t.selectAll("tspan").each(this.truncateDate(t,this._box.text.width-25)),i.text(i.text().trim()+"…"))}}getImageToLoad(t){return t.data.thumbnail?t.data.thumbnail:""}drawLinks(t,e){this._svg.visual.selectAll("path.link").data(t,(t=>t.target.id)).enter().append("path").classed("link",!0).attr("d",(t=>this._orientation.elbow(t)))}}class gr{constructor(t){this._element=t.append("div").attr("class","overlay").style("opacity",1e-6)}show(t,e=0,n=null){this._element.select("p").remove(),this._element.append("p").attr("class","tooltip").text(t),this._element.transition().duration(e).style("opacity",1).on("end",(()=>{"function"==typeof n&&n()}))}hide(t=0,e=0){this._element.transition().delay(t).duration(e).style("opacity",1e-6)}get(){return this._element}}class mr{constructor(t){this._element=t.append("defs")}get(){return this._element}}class _r{constructor(t){this._zoom=null,this._parent=t,this.init()}init(){this._zoom=In(),this._zoom.scaleExtent([.1,20]).on("zoom",(t=>{this._parent.attr("transform",t.transform)})),this._zoom.wheelDelta((t=>-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002))),this._zoom.filter((t=>{if("wheel"===t.type){if(!t.ctrlKey)return!1;var e=Mn(this);if(e.k){if(e.k<=.1&&t.deltaY>0)return t.preventDefault(),!1;if(e.k>=20&&t.deltaY<0)return t.preventDefault(),!1}return!0}return t.button||"touchstart"!==t.type?!(t.ctrlKey&&"wheel"!==t.type||t.button):2===t.touches.length}))}get(){return this._zoom}}class yr{triggerDownload(t,e){let n=new MouseEvent("click",{view:window,bubbles:!1,cancelable:!0}),r=document.createElement("a");r.setAttribute("download",e),r.setAttribute("href",t),r.setAttribute("target","_blank"),r.dispatchEvent(n)}}class vr extends yr{copyStylesInline(t,e){let n=["svg","g","text","textPath"];for(let r=0;r{let i=(new XMLSerializer).serializeToString(t),o=window.URL||window.webkitURL||window,a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),s=o.createObjectURL(a),h=new Image;h.onload=()=>{let t=this.createCanvas(e,n),i=t.getContext("2d");i.fillStyle="rgb(255,255,255)",i.fillRect(0,0,t.width,t.height),i.drawImage(h,0,0),o.revokeObjectURL(s);let a=t.toDataURL("image/png").replace("image/png","image/octet-stream");r(a)},h.src=s}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e){const n=[4960,3508];this.cloneSvg(t.get().node()).then((e=>{this.copyStylesInline(t.get().node(),e);const r=this.calculateViewBox(t.get().node()),i=Math.max(n[0],r[2]),o=Math.max(n[1],r[3]);return e.setAttribute("width",""+i),e.setAttribute("height",""+o),e.setAttribute("viewBox",""+r),this.convertToDataUrl(e,i,o)})).then((t=>this.triggerDownload(t,e))).catch((()=>{console.log("Failed to save chart as PNG image")}))}}class xr extends yr{copyStylesInline(t,e){return new Promise((n=>{Promise.all(t.map((t=>function(t,e){return fetch(t,e).then(Jn)}(t)))).then((t=>{t.forEach((t=>{t=t.replace(/#webtrees-pedigree-chart-container /g,"");let n=document.createElementNS("http://www.w3.org/2000/svg","style");n.appendChild(document.createTextNode(t)),e.prepend(n)})),n(e)}))}))}convertToObjectUrl(t){return new Promise((e=>{let n=(new XMLSerializer).serializeToString(t),r=window.URL||window.webkitURL||window,i=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=r.createObjectURL(i),a=new Image;a.onload=()=>{e(o)},a.src=o}))}cloneSvg(t){return new Promise((e=>{e(t.cloneNode(!0))}))}svgToImage(t,e,n){this.cloneSvg(t.get().node()).then((t=>this.copyStylesInline(e,t))).then((t=>this.convertToObjectUrl(t))).then((t=>this.triggerDownload(t,n))).catch((()=>{console.log("Failed to save chart as SVG image")}))}}class wr{constructor(){this._exportClass=null}setExportClass(t){switch(t){case"png":this._exportClass=vr;break;case"svg":this._exportClass=xr}}createExport(t){switch(this.setExportClass(t),t){case"png":case"svg":return new this._exportClass}}}class br{constructor(t,e){this._element=t.append("svg"),this._defs=new mr(this._element),this._visual=null,this._zoom=null,this._configuration=e,this.init()}init(){this._element.attr("class","wt-global").attr("width","100%").attr("height","100%").attr("text-rendering","optimizeLegibility").attr("text-anchor","middle").attr("xmlns:xlink","https://www.w3.org/1999/xlink")}initEvents(t){this._element.on("contextmenu",(t=>t.preventDefault())).on("wheel",(e=>{e.ctrlKey||t.show(this._configuration.labels.zoom,300,(()=>{t.hide(700,800)}))})).on("touchend",(e=>{e.touches.length<2&&t.hide(0,800)})).on("touchmove",(e=>{e.touches.length>=2?t.hide():t.show(this._configuration.labels.move)})).on("click",(t=>this.doStopPropagation(t)),!0),this._configuration.rtl&&this._element.classed("rtl",!0),this._visual=this._element.append("g"),this._zoom=new _r(this._visual),this._element.call(this._zoom.get())}doStopPropagation(t){t.defaultPrevented&&t.stopPropagation()}export(t){return(new wr).createExport(t)}get defs(){return this._defs}get zoom(){return this._zoom}get visual(){return this._visual}get(){return this._element}}class kr{constructor(t,e){this._configuration=e,this._parent=t,this._hierarchy=new lr(this._configuration),this._data={}}get svg(){return this._svg}updateViewBox(){let t=this._svg.visual.node().getBBox(),e=this._parent.node().getBoundingClientRect(),n=Math.max(e.width,t.width),r=Math.max(e.height,t.height,300),i=(n-t.width)/2,o=(r-t.height)/2,a=Math.ceil(t.x-i-10),s=Math.ceil(t.y-o-10);n=Math.ceil(n+20),r=Math.ceil(r+20),this._svg.get().attr("viewBox",[a,s,n,r])}get data(){return this._data}set data(t){this._data=t,this._hierarchy.init(this._data)}draw(){this._parent.html(""),this._svg=new br(this._parent,this._configuration),this._overlay=new gr(this._parent),this._svg.initEvents(this._overlay),new pr(this._svg,this._configuration,this._hierarchy),this.bindClickEventListener(),this.updateViewBox()}bindClickEventListener(){let t=this;this._svg.visual.selectAll("g.person").filter((t=>""!==t.data.xref)).each((function(e){dt(this).on("click",(function(){t.personClick(e.data)}))}))}personClick(t){1===t.generation?this.redirectToIndividual(t.url):this.update(t.updateUrl)}redirectToIndividual(t){window.location=t}update(t){window.location=t}}t.PedigreeChart=class{constructor(t,e){this._selector=t,this._parent=dt(this._selector),this._configuration=new ur(e.labels,e.generations,e.showEmptyBoxes,e.treeLayout,e.rtl),this._chart=new kr(this._parent,this._configuration),this.init()}init(){dt("#centerButton").on("click",(()=>this.center())),dt("#exportPNG").on("click",(()=>this.exportPNG())),dt("#exportSVG").on("click",(()=>this.exportSVG()))}center(){this._chart.svg.get().transition().duration(750).call(this._chart.svg.zoom.get().transform,En)}get configuration(){return this._configuration}set cssFiles(t){this._cssFiles=t}update(t){this._chart.update(t)}draw(t){this._chart.data=t,this._chart.draw()}exportPNG(){this._chart.svg.export("png").svgToImage(this._chart.svg,"pedigree-chart.png")}exportSVG(){this._chart.svg.export("svg").svgToImage(this._chart.svg,this._cssFiles,"pedigree-chart.svg")}},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WebtreesPedigreeChart={}); diff --git a/src/Module.php b/src/Module.php index b61e736..91aea35 100644 --- a/src/Module.php +++ b/src/Module.php @@ -59,7 +59,7 @@ class Module extends PedigreeChartModule implements ModuleCustomInterface /** * @var string */ - public const CUSTOM_VERSION = '1.5.1-dev'; + public const CUSTOM_VERSION = '1.6.0'; /** * @var string