@flourish/sdk 4.2.0 → 4.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/RELEASE_NOTES.md +3 -0
- package/lib/sdk.js +25 -5
- package/package.json +1 -1
- package/site/script.js +1 -1
- package/common/embed/credit.d.ts +0 -5
- package/common/embed/credit.js +0 -47
- package/common/embed/customer_analytics.d.ts +0 -5
- package/common/embed/customer_analytics.js +0 -114
- package/common/embed/embedding.d.ts +0 -25
- package/common/embed/embedding.js +0 -461
- package/common/embed/localizations.d.ts +0 -243
- package/common/embed/localizations.js +0 -90
- package/common/embed/parse_query_params.d.ts +0 -2
- package/common/embed/parse_query_params.js +0 -18
- package/common/package.json +0 -8
- package/common/tsconfig.sdk.tsbuildinfo +0 -1
- package/common/utils/columns.d.ts +0 -11
- package/common/utils/columns.js +0 -175
- package/common/utils/data.d.ts +0 -30
- package/common/utils/data.js +0 -279
- package/common/utils/json.d.ts +0 -3
- package/common/utils/json.js +0 -60
- package/common/utils/polyfills.d.ts +0 -0
- package/common/utils/polyfills.js +0 -30
- package/common/utils/state.d.ts +0 -7
- package/common/utils/state.js +0 -144
package/site/script.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
var Flourish=function(t){"use strict";function e(t){return parseInt(t).toString()===""+t&&t>=0}function n(t,e,n){return t.map((function(t){var r={};return Object.keys(e).forEach((function(n){r[n]=t[e[n]]})),Object.keys(n).forEach((function(e){var i=n[e];Array.isArray(i)||(i=[i]),r[e]=i.map((function(e){return t[e]}))})),r}))}function r(t,e,r){var i=n(t,e=e||{},r=r||{});return i.column_names={},Object.keys(e).forEach((function(t){i.column_names[t]=e[t]})),Object.keys(r).forEach((function(t){var e=r[t];i.column_names[t]=Array.isArray(e)?e:[e]})),i}function i(t,r,i){!function(t,n){var r;if(!Object.keys(t).every((function(n){return e(t[n])})))throw r="All column_bindings values should be non-negative integers",new TypeError(r);if(!Object.keys(n).every((function(t){var r=n[t];return Array.isArray(r)?r.every(e):e(r)})))throw r="All columns_bindings values should be non-negative integers or arrays thereof",new TypeError(r)}(r=r||{},i=i||{});var o=t[0],a=n(t.slice(1),r,i);return a.column_names={},Object.keys(r).forEach((function(t){a.column_names[t]=o[r[t]]})),Object.keys(i).forEach((function(t){var e=i[t];a.column_names[t]=(Array.isArray(e)?e:[e]).map((function(t){return o[t]}))})),a}function o(t,e,n){return(Array.isArray(t[0])?i:r)(t,e,n)}var a="http://www.w3.org/1999/xhtml",s={svg:"http://www.w3.org/2000/svg",xhtml:a,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function l(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),s.hasOwnProperty(e)?{space:s[e],local:t}:t}function u(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===a&&e.documentElement.namespaceURI===a?e.createElement(t):e.createElementNS(n,t)}}function c(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function d(t){var e=l(t);return(e.local?c:u)(e)}function p(){}function f(t){return null==t?p:function(){return this.querySelector(t)}}function h(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function m(){return[]}function g(t){return null==t?m:function(){return this.querySelectorAll(t)}}function v(t){return function(){return this.matches(t)}}function y(t){return function(e){return e.matches(t)}}var b=Array.prototype.find;function _(){return this.firstElementChild}var w=Array.prototype.filter;function x(){return this.children}function C(t){return new Array(t.length)}function A(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function k(t){return function(){return t}}function E(t,e,n,r,i,o){for(var a,s=0,l=e.length,u=o.length;s<u;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new A(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function T(t,e,n,r,i,o,a){var s,l,u,c=new Map,d=e.length,p=o.length,f=new Array(d);for(s=0;s<d;++s)(l=e[s])&&(f[s]=u=a.call(l,l.__data__,s,e)+"",c.has(u)?i[s]=l:c.set(u,l));for(s=0;s<p;++s)u=a.call(t,o[s],s,o)+"",(l=c.get(u))?(r[s]=l,l.__data__=o[s],c.delete(u)):n[s]=new A(t,o[s]);for(s=0;s<d;++s)(l=e[s])&&c.get(f[s])===l&&(i[s]=l)}function L(t){return t.__data__}function D(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function F(t){return function(){this.removeAttribute(t)}}function S(t){return function(){this.removeAttributeNS(t.space,t.local)}}function M(t,e){return function(){this.setAttribute(t,e)}}function N(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function U(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function O(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 B(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function H(t){return function(){this.style.removeProperty(t)}}function R(t,e,n){return function(){this.style.setProperty(t,e,n)}}function j(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function I(t,e){return t.style.getPropertyValue(e)||B(t).getComputedStyle(t,null).getPropertyValue(e)}function z(t){return function(){delete this[t]}}function P(t,e){return function(){this[t]=e}}function $(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function q(t){return t.trim().split(/^|\s+/)}function V(t){return t.classList||new Y(t)}function Y(t){this._node=t,this._names=q(t.getAttribute("class")||"")}function W(t,e){for(var n=V(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function G(t,e){for(var n=V(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Z(t){return function(){W(this,t)}}function X(t){return function(){G(this,t)}}function J(t,e){return function(){(e.apply(this,arguments)?W:G)(this,t)}}function K(){this.textContent=""}function Q(t){return function(){this.textContent=t}}function tt(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function et(){this.innerHTML=""}function nt(t){return function(){this.innerHTML=t}}function rt(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function it(){this.nextSibling&&this.parentNode.appendChild(this)}function ot(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function at(){return null}function st(){var t=this.parentNode;t&&t.removeChild(this)}function lt(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ut(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ct(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 dt(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function pt(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function ft(t,e,n){var r=B(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function ht(t,e){return function(){return ft(this,t,e)}}function mt(t,e){return function(){return ft(this,t,e.apply(this,arguments))}}A.prototype={constructor:A,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)}},Y.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 gt,vt,yt,bt,_t,wt=[null];function xt(t,e){this._groups=t,this._parents=e}function Ct(){return new xt([[document.documentElement]],wt)}function At(t){return"string"==typeof t?new xt([[document.querySelector(t)]],[document.documentElement]):new xt([[t]],wt)}function kt(t){return At(d(t).call(document.documentElement))}function Et(t){return"string"==typeof t?new xt([document.querySelectorAll(t)],[document.documentElement]):new xt([null==t?[]:h(t)],wt)}function Tt(){if(!yt)return null;var t=yt.nodes()[1].value;if("custom"===bt&&""!=t){var e=parseInt(t,10);return isNaN(e)?null:e}return null}function Lt(){_t&&_t.preview_pane&&_t.preview_pane.setFixedHeight&&_t.preview_pane.setFixedHeight(Tt())}function Dt(t,e=!1){bt=t,Lt(),"custom"===t?(At("#editor-custom-inputs").style("opacity",1),At(".preview-holder").style("width",yt.nodes()[0].value+"px").select("iframe").style("width",yt.nodes()[0].value+"px")):(At("#editor-custom-inputs").style("opacity",0),At(".preview-holder").attr("style",null).select("iframe").style("width",null)),e||At(".preview-holder").style("max-width","none"),Et("#preview-menu .preview-mode").classed("selected",(function(){return this.id=="editor-"+t})),At("#editor-rotate").classed("active",(function(){return"auto"!==t})),At(".row.editor").classed("mobile",(function(){return"mobile"==t})),At(".row.editor").classed("tablet",(function(){return"tablet"==t})),At(".preview-holder").on("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd transitionend",St),gt=t}function Ft(t){return _t=t,yt=Et("#editor-custom-inputs input"),St(),Et("#preview-menu .preview-mode").on("click",(function(){Dt(this.getAttribute("data-target"))})),yt.on("change",(function(){Dt(this.getAttribute("data-target"))})),Dt("auto",!0),function(){var t,e,n=document.querySelector("#resize-handle"),r=document.querySelector(".preview-holder");function i(i){"editor-custom"!==i.target.parentElement.id&&(t=r.getBoundingClientRect().width,n.parentElement.parentElement.querySelector("#resize-overlay").classList.add("dragging"),n.parentElement.classList.add("dragging"),e=i.clientX,At(".preview-holder").style("transition","none"),Dt("custom"),document.addEventListener("mousemove",o),document.addEventListener("mouseup",a),i.preventDefault())}function o(n){var i=n.clientX-e,o=t+2*i;r.style.width=o+"px",r.querySelector("iframe").style.width=o-4+"px",St(),_t.preview_pane.resize()}function a(){t=r.getBoundingClientRect().width,At(".preview-holder").style("transition",null),n.parentElement.parentElement.querySelector("#resize-overlay").classList.remove("dragging"),n.parentElement.classList.remove("dragging"),St(),_t.preview_pane.resize(),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",a)}n.addEventListener("mousedown",i)}
|
|
2
|
-
/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.2.2/LICENSE */(),window.innerWidth<=768&&(vt="auto"),window.addEventListener("resize",(function(){gt&&St(),window.innerWidth<=768?vt||(vt=gt,Dt("auto")):vt&&(Dt(vt),vt=null),_t.preview_pane.resize()})),{getHeightSetting:Tt}}function St(){var t=At(".preview-holder").node().getBoundingClientRect();yt.nodes()[0].value=Math.round(t.width),""!==yt.nodes()[1].value&&"custom"===bt&&(yt.nodes()[1].value=Math.round(t.height))}xt.prototype=Ct.prototype={constructor:xt,select:function(t){"function"!=typeof t&&(t=f(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,u=r[i]=new Array(l),c=0;c<l;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),u[c]=a);return new xt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:h(e)}}(t):g(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,u=0;u<l;++u)(a=s[u])&&(r.push(t.call(a,a.__data__,u,s)),i.push(a));return new xt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return b.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=v(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new xt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,L);var n=e?T:E,r=this._parents,i=this._groups;"function"!=typeof t&&(t=k(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),u=0;u<o;++u){var c=r[u],d=i[u],p=d.length,f=h(t.call(c,c&&c.__data__,u,r)),m=f.length,g=s[u]=new Array(m),v=a[u]=new Array(m),y=l[u]=new Array(p);n(c,d,g,v,y,f,e);for(var b,_,w=0,x=0;w<m;++w)if(b=g[w]){for(w>=x&&(x=w+1);!(_=v[x])&&++x<m;);b._next=_||null}}return(a=new xt(a,r))._enter=s,a._exit=l,a},enter:function(){return new xt(this._enter||this._groups.map(C),this._parents)},exit:function(){return new xt(this._exit||this._groups.map(C),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(i=e(i)),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof xt))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,u=e[s],c=n[s],d=u.length,p=a[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<r;++s)a[s]=e[s];return new xt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=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=D);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,u=i[o]=new Array(l),c=0;c<l;++c)(a=s[c])&&(u[c]=a);u.sort(e)}return new xt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=l(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?S:F:"function"==typeof e?n.local?O:U:n.local?N:M)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?H:"function"==typeof e?j:R)(t,e,null==n?"":n)):I(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?z:"function"==typeof e?$:P)(t,e)):this.node()[t]},classed:function(t,e){var n=q(t+"");if(arguments.length<2){for(var r=V(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?J:e?Z:X)(n,e))},text:function(t){return arguments.length?this.each(null==t?K:("function"==typeof t?tt:Q)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?et:("function"==typeof t?rt:nt)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(ot)},append:function(t){var e="function"==typeof t?t:d(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:d(t),r=null==e?at:"function"==typeof e?e:f(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(st)},clone:function(t){return this.select(t?ut:lt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=ct(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?pt:dt,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(r=0,l=s[u];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?mt:ht)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Mt=Object.hasOwnProperty,Nt=Object.setPrototypeOf,Ut=Object.isFrozen,Ot=Object.getPrototypeOf,Bt=Object.getOwnPropertyDescriptor,Ht=Object.freeze,Rt=Object.seal,jt=Object.create,It="undefined"!=typeof Reflect&&Reflect,zt=It.apply,Pt=It.construct;zt||(zt=function(t,e,n){return t.apply(e,n)}),Ht||(Ht=function(t){return t}),Rt||(Rt=function(t){return t}),Pt||(Pt=function(t,e){return new(Function.prototype.bind.apply(t,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))))});var $t,qt=te(Array.prototype.forEach),Vt=te(Array.prototype.pop),Yt=te(Array.prototype.push),Wt=te(String.prototype.toLowerCase),Gt=te(String.prototype.match),Zt=te(String.prototype.replace),Xt=te(String.prototype.indexOf),Jt=te(String.prototype.trim),Kt=te(RegExp.prototype.test),Qt=($t=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return Pt($t,e)});function te(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return zt(t,e,r)}}function ee(t,e){Nt&&Nt(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var i=Wt(r);i!==r&&(Ut(e)||(e[n]=i),r=i)}t[r]=!0}return t}function ne(t){var e=jt(null),n=void 0;for(n in t)zt(Mt,t,[n])&&(e[n]=t[n]);return e}function re(t,e){for(;null!==t;){var n=Bt(t,e);if(n){if(n.get)return te(n.get);if("function"==typeof n.value)return te(n.value)}t=Ot(t)}return function(t){return console.warn("fallback value for",t),null}}var ie=Ht(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),oe=Ht(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ae=Ht(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),se=Ht(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),le=Ht(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),ue=Ht(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ce=Ht(["#text"]),de=Ht(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),pe=Ht(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),fe=Ht(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),he=Ht(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),me=Rt(/\{\{[\s\S]*|[\s\S]*\}\}/gm),ge=Rt(/<%[\s\S]*|[\s\S]*%>/gm),ve=Rt(/^data-[\-\w.\u00B7-\uFFFF]/),ye=Rt(/^aria-[\-\w]+$/),be=Rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_e=Rt(/^(?:\w+script|data):/i),we=Rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xe="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};function Ce(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var Ae=function(){return"undefined"==typeof window?null:window},ke=function(t,e){if("object"!==(void 0===t?"undefined":xe(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};var Ee,Te,Le=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ae(),n=function(e){return t(e)};if(n.version="2.2.8",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,i=e.document,o=e.DocumentFragment,a=e.HTMLTemplateElement,s=e.Node,l=e.Element,u=e.NodeFilter,c=e.NamedNodeMap,d=void 0===c?e.NamedNodeMap||e.MozNamedAttrMap:c,p=e.Text,f=e.Comment,h=e.DOMParser,m=e.trustedTypes,g=l.prototype,v=re(g,"cloneNode"),y=re(g,"nextSibling"),b=re(g,"childNodes"),_=re(g,"parentNode");if("function"==typeof a){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var x=ke(m,r),C=x&&tt?x.createHTML(""):"",A=i,k=A.implementation,E=A.createNodeIterator,T=A.createDocumentFragment,L=r.importNode,D={};try{D=ne(i).documentMode?i.documentMode:{}}catch(t){}var F={};n.isSupported="function"==typeof _&&k&&void 0!==k.createHTMLDocument&&9!==D;var S=me,M=ge,N=ve,U=ye,O=_e,B=we,H=be,R=null,j=ee({},[].concat(Ce(ie),Ce(oe),Ce(ae),Ce(le),Ce(ce))),I=null,z=ee({},[].concat(Ce(de),Ce(pe),Ce(fe),Ce(he))),P=null,$=null,q=!0,V=!0,Y=!1,W=!1,G=!1,Z=!1,X=!1,J=!1,K=!1,Q=!0,tt=!1,et=!0,nt=!0,rt=!1,it={},ot=ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),at=null,st=ee({},["audio","video","img","source","image","track"]),lt=null,ut=ee({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ct="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",pt="http://www.w3.org/1999/xhtml",ft=pt,ht=null,mt=i.createElement("form"),gt=function(t){ht&&ht===t||(t&&"object"===(void 0===t?"undefined":xe(t))||(t={}),t=ne(t),R="ALLOWED_TAGS"in t?ee({},t.ALLOWED_TAGS):j,I="ALLOWED_ATTR"in t?ee({},t.ALLOWED_ATTR):z,lt="ADD_URI_SAFE_ATTR"in t?ee(ne(ut),t.ADD_URI_SAFE_ATTR):ut,at="ADD_DATA_URI_TAGS"in t?ee(ne(st),t.ADD_DATA_URI_TAGS):st,P="FORBID_TAGS"in t?ee({},t.FORBID_TAGS):{},$="FORBID_ATTR"in t?ee({},t.FORBID_ATTR):{},it="USE_PROFILES"in t&&t.USE_PROFILES,q=!1!==t.ALLOW_ARIA_ATTR,V=!1!==t.ALLOW_DATA_ATTR,Y=t.ALLOW_UNKNOWN_PROTOCOLS||!1,W=t.SAFE_FOR_TEMPLATES||!1,G=t.WHOLE_DOCUMENT||!1,J=t.RETURN_DOM||!1,K=t.RETURN_DOM_FRAGMENT||!1,Q=!1!==t.RETURN_DOM_IMPORT,tt=t.RETURN_TRUSTED_TYPE||!1,X=t.FORCE_BODY||!1,et=!1!==t.SANITIZE_DOM,nt=!1!==t.KEEP_CONTENT,rt=t.IN_PLACE||!1,H=t.ALLOWED_URI_REGEXP||H,ft=t.NAMESPACE||ft,W&&(V=!1),K&&(J=!0),it&&(R=ee({},[].concat(Ce(ce))),I=[],!0===it.html&&(ee(R,ie),ee(I,de)),!0===it.svg&&(ee(R,oe),ee(I,pe),ee(I,he)),!0===it.svgFilters&&(ee(R,ae),ee(I,pe),ee(I,he)),!0===it.mathMl&&(ee(R,le),ee(I,fe),ee(I,he))),t.ADD_TAGS&&(R===j&&(R=ne(R)),ee(R,t.ADD_TAGS)),t.ADD_ATTR&&(I===z&&(I=ne(I)),ee(I,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&ee(lt,t.ADD_URI_SAFE_ATTR),nt&&(R["#text"]=!0),G&&ee(R,["html","head","body"]),R.table&&(ee(R,["tbody"]),delete P.tbody),Ht&&Ht(t),ht=t)},vt=ee({},["mi","mo","mn","ms","mtext"]),yt=ee({},["foreignobject","desc","title","annotation-xml"]),bt=ee({},oe);ee(bt,ae),ee(bt,se);var _t=ee({},le);ee(_t,ue);var wt=function(t){var e=_(t);e&&e.tagName||(e={namespaceURI:pt,tagName:"template"});var n=Wt(t.tagName),r=Wt(e.tagName);if(t.namespaceURI===dt)return e.namespaceURI===pt?"svg"===n:e.namespaceURI===ct?"svg"===n&&("annotation-xml"===r||vt[r]):Boolean(bt[n]);if(t.namespaceURI===ct)return e.namespaceURI===pt?"math"===n:e.namespaceURI===dt?"math"===n&&yt[r]:Boolean(_t[n]);if(t.namespaceURI===pt){if(e.namespaceURI===dt&&!yt[r])return!1;if(e.namespaceURI===ct&&!vt[r])return!1;var i=ee({},["title","style","font","a","script"]);return!_t[n]&&(i[n]||!bt[n])}return!1},xt=function(t){Yt(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=C}catch(e){t.remove()}}},Ct=function(t,e){try{Yt(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Yt(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!I[t])if(J||K)try{xt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},At=function(t){var e=void 0,n=void 0;if(X)t="<remove></remove>"+t;else{var r=Gt(t,/^[\r\n\t ]+/);n=r&&r[0]}var o=x?x.createHTML(t):t;if(ft===pt)try{e=(new h).parseFromString(o,"text/html")}catch(t){}e&&e.documentElement||((e=k.createDocument(ft,"template",null)).documentElement.innerHTML=o);var a=e.body||e.documentElement;return t&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),G?e.documentElement:a},kt=function(t){return E.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,(function(){return u.FILTER_ACCEPT}),!1)},Et=function(t){return!(t instanceof p||t instanceof f)&&!("string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof d&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},Tt=function(t){return"object"===(void 0===s?"undefined":xe(s))?t instanceof s:t&&"object"===(void 0===t?"undefined":xe(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Lt=function(t,e,r){F[t]&&qt(F[t],(function(t){t.call(n,e,r,ht)}))},Dt=function(t){var e=void 0;if(Lt("beforeSanitizeElements",t,null),Et(t))return xt(t),!0;if(Gt(t.nodeName,/[\u0080-\uFFFF]/))return xt(t),!0;var r=Wt(t.nodeName);if(Lt("uponSanitizeElement",t,{tagName:r,allowedTags:R}),!Tt(t.firstElementChild)&&(!Tt(t.content)||!Tt(t.content.firstElementChild))&&Kt(/<[/\w]/g,t.innerHTML)&&Kt(/<[/\w]/g,t.textContent))return xt(t),!0;if(!R[r]||P[r]){if(nt&&!ot[r]){var i=_(t)||t.parentNode,o=b(t)||t.childNodes;if(o&&i)for(var a=o.length-1;a>=0;--a)i.insertBefore(v(o[a],!0),y(t))}return xt(t),!0}return t instanceof l&&!wt(t)?(xt(t),!0):"noscript"!==r&&"noembed"!==r||!Kt(/<\/no(script|embed)/i,t.innerHTML)?(W&&3===t.nodeType&&(e=t.textContent,e=Zt(e,S," "),e=Zt(e,M," "),t.textContent!==e&&(Yt(n.removed,{element:t.cloneNode()}),t.textContent=e)),Lt("afterSanitizeElements",t,null),!1):(xt(t),!0)},Ft=function(t,e,n){if(et&&("id"===e||"name"===e)&&(n in i||n in mt))return!1;if(V&&Kt(N,e));else if(q&&Kt(U,e));else{if(!I[e]||$[e])return!1;if(lt[e]);else if(Kt(H,Zt(n,B,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Xt(n,"data:")||!at[t]){if(Y&&!Kt(O,Zt(n,B,"")));else if(n)return!1}else;}return!0},St=function(t){var e=void 0,r=void 0,i=void 0,o=void 0;Lt("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I};for(o=a.length;o--;){var l=e=a[o],u=l.name,c=l.namespaceURI;if(r=Jt(e.value),i=Wt(u),s.attrName=i,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Lt("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(Ct(u,t),s.keepAttr))if(Kt(/\/>/i,r))Ct(u,t);else{W&&(r=Zt(r,S," "),r=Zt(r,M," "));var d=t.nodeName.toLowerCase();if(Ft(d,i,r))try{c?t.setAttributeNS(c,u,r):t.setAttribute(u,r),Vt(n.removed)}catch(t){}}}Lt("afterSanitizeAttributes",t,null)}},Mt=function t(e){var n=void 0,r=kt(e);for(Lt("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Lt("uponSanitizeShadowNode",n,null),Dt(n)||(n.content instanceof o&&t(n.content),St(n));Lt("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,i){var a=void 0,l=void 0,u=void 0,c=void 0,d=void 0;if(t||(t="\x3c!--\x3e"),"string"!=typeof t&&!Tt(t)){if("function"!=typeof t.toString)throw Qt("toString is not a function");if("string"!=typeof(t=t.toString()))throw Qt("dirty is not a string, aborting")}if(!n.isSupported){if("object"===xe(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(Tt(t))return e.toStaticHTML(t.outerHTML)}return t}if(Z||gt(i),n.removed=[],"string"==typeof t&&(rt=!1),rt);else if(t instanceof s)1===(l=(a=At("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!J&&!W&&!G&&-1===t.indexOf("<"))return x&&tt?x.createHTML(t):t;if(!(a=At(t)))return J?null:C}a&&X&&xt(a.firstChild);for(var p=kt(rt?t:a);u=p.nextNode();)3===u.nodeType&&u===c||Dt(u)||(u.content instanceof o&&Mt(u.content),St(u),c=u);if(c=null,rt)return t;if(J){if(K)for(d=T.call(a.ownerDocument);a.firstChild;)d.appendChild(a.firstChild);else d=a;return Q&&(d=L.call(r,d,!0)),d}var f=G?a.outerHTML:a.innerHTML;return W&&(f=Zt(f,S," "),f=Zt(f,M," ")),x&&tt?x.createHTML(f):f},n.setConfig=function(t){gt(t),Z=!0},n.clearConfig=function(){ht=null,Z=!1},n.isValidAttribute=function(t,e,n){ht||gt({});var r=Wt(t),i=Wt(e);return Ft(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(F[t]=F[t]||[],Yt(F[t],e))},n.removeHook=function(t){F[t]&&Vt(F[t])},n.removeHooks=function(t){F[t]&&(F[t]=[])},n.removeAllHooks=function(){F={}},n}(),De=25,Fe=10,Se=10,Me={};function Ne(t,e,n,r,i,o,a){var s=n-t/2-Se,l=n+t/2+Se,u=t/2+Math.min(0,s-i.left)+Math.max(0,l-i.right);return{pos:[u,a],shape:u-Fe<5?[-u,-15*o,Math.max(Fe,5-u),-10*o]:u+Fe>t-5?[Math.min(-10,t-u-5),-10*o,Math.min(Fe,t-u),-15*o]:[-10,-10*o,Fe,-10*o]}}function Ue(t,e,n,r,i,o,a){var s=r-e/2-Se,l=r+e/2+Se,u=e/2+Math.min(0,s-i.top)+Math.max(0,l-i.bottom);return{pos:[a,u],shape:u-Fe<5?[-15*o,-u,-10*o,Math.max(Fe,5-u)]:u+Fe>e-5?[-10*o,Math.min(-10,e-u-5),-15*o,Math.min(Fe,e-u)]:[-10*o,-10,-10*o,Fe]}}function Oe(t,e,n,r,i,o){var a=Me[t](e,n,r,i,o),s=r-De-a.pos[0],l=i-De-a.pos[1];return{left:s,top:l,right:s+e+50,bottom:l+n+50}}function Be(t,e,n){var r,i=document.createElementNS("http://www.w3.org/2000/svg",t);if(e)for(r in e)i.setAttribute(r,e[r]);var o=i.style;if(n)for(r in n)o[r]=n[r];return i}function He(){return Ee||((Ee=document.createElement("div")).id="flourish-popup-constrainer",(Te=Ee.style).overflow="hidden",Te.pointerEvents="none",Te.position="absolute",Te.left="0",Te.top="0",Te.margin="0",Te.padding="0",document.body.appendChild(Ee),this._resizeConstrainer(),Ee)}Me.bottom=function(t,e){return{shape:[-10,-10,Fe,-10],pos:[t/2,e+Se]}},Me.top=function(t,e){return{shape:[-10,Se,Fe,Se],pos:[t/2,-10]}},Me.left=function(t,e){return{shape:[Se,Fe,Se,-10],pos:[-10,e/2]}},Me.right=function(t,e){return{shape:[-10,Fe,-10,-10],pos:[t+Se,e/2]}},Me.topLeft=function(t,e){return{shape:[15,Se,Se,15],pos:[-10,-10]}},Me.bottomLeft=function(t,e){return{shape:[15,-10,Se,-15],pos:[-10,e+Se]}},Me.topRight=function(t,e){return{shape:[-15,Se,-10,15],pos:[t+Se,-10]}},Me.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+Se,e+Se]}},Me.bottomFlexible=function(t,e,n,r,i){return Ne(t,0,n,0,i,1,e+Se)},Me.topFlexible=function(t,e,n,r,i){return Ne(t,0,n,0,i,-1,-10)},Me.rightFlexible=function(t,e,n,r,i){return Ue(0,e,0,r,i,1,t+Se)},Me.leftFlexible=function(t,e,n,r,i){return Ue(0,e,0,r,i,-1,-10)};var Re,je=1,Ie={container:document.body,maxWidth:"70%",point:null,html:null,directions:["bottom","top","left","right","topLeft","bottomLeft","topRight","bottomRight","bottomFlexible","topFlexible","leftFlexible","rightFlexible"],fallbackFit:"horizontal"};function ze(){for(var t in this.unique_id=je++,this.is_visible=!0,Ie)this["_"+t]=Ie[t];this.handlers={click:[]}}function Pe(t){ze.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var $e in Ie)Pe($e);function qe(){return new ze}function Ve(){Re=qe().container(document.body),function(t){t.each((function(){var t=At(this);if(t.attr("data-popup-allow-interaction")&&!t.select(".popup-content-wrapper").size()){var e=t.append("span").attr("class","popup-content-wrapper").style("display","none").append("span").attr("class","popup-content-outer");e.append("span").attr("class","popup-content-inner"),e.append("span").attr("class","popup-content-arrow")}At(this).on("mouseenter focus",(function(t){Ye.call(this,t,!0)})).on("mouseover focus",Ye).on("mouseout blur",We)}))}(Et(".popup"))}function Ye(t,e){if(this.getAttribute("data-popup-head")||this.getAttribute("data-popup-body")){var n=this.getAttribute("data-popup-allow-interaction"),r=this.getAttribute("data-popup-position"),i=this.getBoundingClientRect(),o=i.left+i.width/2,a=i.top+i.height,s=this.getAttribute("data-popup-head")||null,l=this.getAttribute("data-popup-body")||null,u="";if(s&&(u+=kt("span").classed("popup-content-header",!0).html(Le.sanitize(s)).node().outerHTML),l&&(u+=kt("span").classed("popup-content-body",!0).html(Le.sanitize(l)).node().outerHTML),n){r&&["top","bottom"].includes(r)||(r="top");At(this).select(".popup-content-outer").style("display","inline-block"),At(this).select(".popup-content-inner").style("display","inline-block"),At(this).select(".popup-content-wrapper").style("display","block").style("bottom","top"==r?i.height-4+"px":null).style("top","bottom"==r?i.height-4+"px":null),e&&At(this).select(".popup-content-inner").html(u);var c=this.getAttribute("data-popup-constrainer")||"body",d=At(c).size()?At(c).node().getBoundingClientRect():document.body,p=At(this).select(".popup-content-inner").node().getBoundingClientRect().width,f=o,h=-p/2,m=f+p/2-(d.right-15),g=d.left+15-(f-p/2);m>0?h-=m:g>0&&(h+=g),At(this).select(".popup-content-wrapper").style("left",i.width/2+h+"px");At(this).select(".popup-content-arrow").style("left",-5+Math.abs(h)+"px")}else{var v=["top","topFlexible"];r&&("left"===r?(v=["right","rightFlexible"],o=i.left,a=i.top+i.height/2):"right"===r?(v=["left","leftFlexible"],o=i.right,a=i.top+i.height/2):"top"===r?(v=["bottom","bottomFlexible"],o=i.left+i.width/2,a=i.top):"bottom"===r&&(v=["top","topFlexible"],o=i.left+i.width/2,a=i.top+i.height)),Re.point(o,a).html(u).directions(v).draw()}}}function We(){this.getAttribute("data-popup-allow-interaction")&&At(this).select(".popup-content-wrapper").style("display","none"),Re.hide()}ze.prototype.point=function(t,e){if(void 0===t)return this._point;if(Array.isArray(t))this._point=[t[0],t[1]];else if(void 0!==e)this._point=[t,e];else if(t instanceof HTMLElement||t instanceof SVGElement){var n=t.getBoundingClientRect();this._point=[Math.floor(n.left+n.width/2),Math.floor(n.top+n.height/2)]}else console.error("Popup: could not understand argument");return this},ze.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},ze.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&","<":"<",">":">"}[t]}))}(t),this},ze.prototype.on=function(t,e){if(!(t in this.handlers))throw new Error("Popup.on: No such event: "+t);return this.handlers[t].push(e),this},ze.prototype.fire=function(t,e){if(!(t in this.handlers))throw new Error("Popup.fire: No such event: "+t);for(var n=this.handlers[t],r=0;r<n.length;r++)n[r].call(this,e);return this},ze.prototype._getElement=function(){var t=this,e="flourish-popup-"+t.unique_id,n=document.getElementById(e);if(!n){(n=document.createElement("div")).className="flourish-popup",n.id=e;var r=n.style;r.display="none",r.margin=r.padding=0,r.position="absolute",r.width="80px",r.height="40px",r.boxSizing="border-box",n.addEventListener("click",(function(e){t.fire("click",e)}),!1);var i=Be("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),o=Be("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});o.appendChild(Be("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),o.appendChild(Be("feOffset",{dx:0,dy:2,result:"offsetblur"}));var a=Be("feComponentTransfer");a.appendChild(Be("feFuncA",{type:"linear",slope:.2})),o.appendChild(a);var s=Be("feMerge");o.appendChild(s),s.appendChild(Be("feMergeNode")),s.appendChild(Be("feMergeNode",{in:"SourceGraphic"})),i.appendChild(o);var l=Be("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});l.appendChild(Be("rect",{x:De,y:De,rx:5})),l.appendChild(Be("path")),i.appendChild(l),n.appendChild(i);var u=document.createElement("div");u.className="flourish-popup-content",(r=u.style).position="absolute",r.top=r.left="25px",r.padding="10px",n.appendChild(u),t._getConstrainer().appendChild(n)}return t._resizeConstrainer(),n},ze.prototype._getConstrainer=He,ze.prototype._resizeConstrainer=function(){Ee||He.call(this);var t=Te.display;Te.display="none",Te.width=document.documentElement.scrollWidth+"px",Te.height=document.documentElement.scrollHeight+"px",Te.display=t},ze.prototype.draw=function(){var t=this;if(t.is_visible=!0,t._point){var e=document.documentElement.getBoundingClientRect(),n=t._point[0],r=t._point[1],i=t._container.getBoundingClientRect();n<i.left?n=i.left:n>i.right&&(n=i.right),r<i.top?r=i.top:r>i.bottom&&(r=i.bottom);var o=n-e.left,a=r-e.top,s=t._getElement(),l=s.style,u=s.querySelector(".flourish-popup-svg"),c=u.querySelector("g"),d=c.querySelector("rect"),p=c.querySelector("path"),f=s.querySelector(".flourish-popup-content");l.display="block",f.style.maxWidth=function(e){return t._maxWidth.match(/^\d+(?:\.\d+)?%$/)?e.width*parseFloat(t._maxWidth)/100:t._maxWidth.match(/^\d+(?:\.\d+)?(?:px)?$/)?parseFloat(t._maxWidth):(null!=t._maxWidth&&console.error("Popup: Unknown value for maxWidth: "+t._maxWidth),e.width)}(i)+"px",t._inner_html!=t._html&&(f.innerHTML=t._inner_html=t._html);var h,m,g=f.getBoundingClientRect();do{h=Math.ceil(g.width),m=Math.ceil(g.height),l.width=h+50+"px",l.height=m+50+"px",g=f.getBoundingClientRect()}while(h!=Math.ceil(g.width)||m!=Math.ceil(g.height));d.setAttribute("width",h),d.setAttribute("height",m),u.setAttribute("width",h+50),u.setAttribute("height",m+50);for(var v,y,b=null,_=null,w=null,x=1/0,C=1/0,A=0;A<t._directions.length;A++){var k=t._directions[A],E=Oe(k,h,m,n,r,i),T=Math.max(0,Math.floor(i.left)-E.left-15)+Math.max(0,E.right-Math.ceil(i.right)-15),L=Math.max(0,Math.floor(i.top)-E.top-15)+Math.max(0,E.bottom-Math.ceil(i.bottom)-15);if(0==T&&0==L){b=k;break}(T<x||T==x&&L<v)&&(x=T,v=L,_=k),(L<C||L==C&&T<y)&&(C=L,y=T,w=k)}return b?k=b:"horizontal"==t._fallbackFit?k=_:"vertical"==t._fallbackFit?k=w:(console.warn("Popup: failed to point box of size ("+h+", "+m+") at ("+n+", "+r+") within ("+i.left+", "+i.top+", "+i.right+", "+i.bottom+")"),k=t._directions[0]),function(t,e,n,r,i,o,a,s,l,u){var c=Me[t](r,i,s,l,u);e.left=o-De-c.pos[0]+"px",e.top=a-De-c.pos[1]+"px",n.setAttribute("d","M0,0L"+c.shape.join(",")+"Z"),n.setAttribute("transform","translate("+(c.pos[0]+De)+","+(c.pos[1]+De)+")")}(k,l,p,h,m,o,a,n,r,i),t}console.error("Popup: cannot draw popup till point() has been specified")},ze.prototype.hide=function(){return this.is_visible?(this.is_visible=!1,this._getElement().style.display="none",this):this},qe.version="2.1.5";const Ge=Math.pow(2,31)-1,Ze=Math.pow(2,15);function Xe(t,e){if(t=t.toUpperCase(),!/^[A-Z]+$/.test(t)){if(!t){if(e)return-1;throw new Error("Non-optional data binding must specify column")}throw function(t){try{tn(t)}catch(t){return!1}return!0}(t)?new Error("You can only select one column"):new Error("Invalid column specification: "+t)}for(var n=0,r=0;r<t.length;r++)n=26*n+(t.charCodeAt(r)-64);return n-1>Ge&&console.warn("Column index out of range"),Math.min(n-1,Ge)}function Je(t){t+=1;for(var e="";t>0;){var n=Math.floor(t/26),r=t%26;0==r&&(n-=1,r+=26),e=String.fromCharCode(64+r)+e,t=n}return e}function Ke(t){var e=t.match(/\s*(?:[-–—:]|\.\.)\s*/);if(!e)throw new Error("Failed to parse column range: "+t);var n=t.substr(0,e.index),r=t.substr(e.index+e[0].length),i=Xe(n),o=Xe(r),a=[],s=o>=i?1:-1,l=Math.abs(o-i)+1;l>Ze&&(console.warn("Truncating excessively long range"),l=Ze);for(var u=0;u<l;u++)a.push(i+u*s);return a}function Qe(t,e){return Je(t)+"-"+Je(e)}function tn(t){var e=[],n=(t=t.replace(/^\s+|\s+$/g,"")).split(/\s*,\s*/);1==n.length&&""===n[0]&&(n=[]);for(var r=0;r<n.length;r++){var i=n[r];/^[A-Za-z]+$/.test(i)?e.push(Xe(i)):Array.prototype.push.apply(e,Ke(i))}return e}function en(t){for(var e=function(t){if(!t.length)return[];for(var e=[],n=t[0],r=t[0],i=null,o=0;o<t.length-1;o++){var a=t[o+1]-t[o];null!==i||1!==Math.abs(a)?a!==i?(e.push([n,r]),n=r=t[o+1],i=null):r=t[o+1]:(r=t[o+1],i=a)}return e.push([n,r]),e}(t),n=[],r=0;r<e.length;r++){var i=e[r];i[0]==i[1]?n.push(Je(i[0])):n.push(Qe(i[0],i[1]))}return n.join(",")}function nn(t,e,n,r){var i=n?e[t.data_table_id]+"::":"";if("column"in t)return i+Je(t.column);if("columns"in t)return i+en(t.columns);if(r)return"";throw new Error("Data binding must have .column or .columns")}var rn=new Date,on=new Date;function an(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,o){var a,s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return s},i.filter=function(n){return an((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return rn.setTime(+e),on.setTime(+r),t(rn),t(on),Math.floor(n(rn,on))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var sn=864e5,ln=6048e5,un=an((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/sn}),(function(t){return t.getDate()-1})),cn=un;function dn(t){return an((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ln}))}un.range;var pn=dn(0),fn=dn(1),hn=dn(2),mn=dn(3),gn=dn(4),vn=dn(5),yn=dn(6);pn.range,fn.range,hn.range,mn.range,gn.range,vn.range,yn.range;var bn=an((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var _n=bn;bn.range;var wn=an((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/sn}),(function(t){return t.getUTCDate()-1})),xn=wn;function Cn(t){return an((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/ln}))}wn.range;var An=Cn(0),kn=Cn(1),En=Cn(2),Tn=Cn(3),Ln=Cn(4),Dn=Cn(5),Fn=Cn(6);An.range,kn.range,En.range,Tn.range,Ln.range,Dn.range,Fn.range;var Sn=an((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Sn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Mn=Sn;function Nn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Un(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function On(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Sn.range;var Bn,Hn,Rn,jn={"-":"",_:" ",0:"0"},In=/^\s*\d+/,zn=/^%/,Pn=/[\\^$*+?|[\]().{}]/g;function $n(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function qn(t){return t.replace(Pn,"\\$&")}function Vn(t){return new RegExp("^(?:"+t.map(qn).join("|")+")","i")}function Yn(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Wn(t,e,n){var r=In.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Gn(t,e,n){var r=In.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Zn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Xn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Jn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Kn(t,e,n){var r=In.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Qn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function tr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function er(t,e,n){var r=In.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function nr(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function rr(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ir(t,e,n){var r=In.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function or(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ar(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function sr(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function lr(t,e,n){var r=In.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function ur(t,e,n){var r=In.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function cr(t,e,n){var r=zn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function dr(t,e,n){var r=In.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function pr(t,e,n){var r=In.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function fr(t,e){return $n(t.getDate(),e,2)}function hr(t,e){return $n(t.getHours(),e,2)}function mr(t,e){return $n(t.getHours()%12||12,e,2)}function gr(t,e){return $n(1+cn.count(_n(t),t),e,3)}function vr(t,e){return $n(t.getMilliseconds(),e,3)}function yr(t,e){return vr(t,e)+"000"}function br(t,e){return $n(t.getMonth()+1,e,2)}function _r(t,e){return $n(t.getMinutes(),e,2)}function wr(t,e){return $n(t.getSeconds(),e,2)}function xr(t){var e=t.getDay();return 0===e?7:e}function Cr(t,e){return $n(pn.count(_n(t)-1,t),e,2)}function Ar(t){var e=t.getDay();return e>=4||0===e?gn(t):gn.ceil(t)}function kr(t,e){return t=Ar(t),$n(gn.count(_n(t),t)+(4===_n(t).getDay()),e,2)}function Er(t){return t.getDay()}function Tr(t,e){return $n(fn.count(_n(t)-1,t),e,2)}function Lr(t,e){return $n(t.getFullYear()%100,e,2)}function Dr(t,e){return $n((t=Ar(t)).getFullYear()%100,e,2)}function Fr(t,e){return $n(t.getFullYear()%1e4,e,4)}function Sr(t,e){var n=t.getDay();return $n((t=n>=4||0===n?gn(t):gn.ceil(t)).getFullYear()%1e4,e,4)}function Mr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+$n(e/60|0,"0",2)+$n(e%60,"0",2)}function Nr(t,e){return $n(t.getUTCDate(),e,2)}function Ur(t,e){return $n(t.getUTCHours(),e,2)}function Or(t,e){return $n(t.getUTCHours()%12||12,e,2)}function Br(t,e){return $n(1+xn.count(Mn(t),t),e,3)}function Hr(t,e){return $n(t.getUTCMilliseconds(),e,3)}function Rr(t,e){return Hr(t,e)+"000"}function jr(t,e){return $n(t.getUTCMonth()+1,e,2)}function Ir(t,e){return $n(t.getUTCMinutes(),e,2)}function zr(t,e){return $n(t.getUTCSeconds(),e,2)}function Pr(t){var e=t.getUTCDay();return 0===e?7:e}function $r(t,e){return $n(An.count(Mn(t)-1,t),e,2)}function qr(t){var e=t.getUTCDay();return e>=4||0===e?Ln(t):Ln.ceil(t)}function Vr(t,e){return t=qr(t),$n(Ln.count(Mn(t),t)+(4===Mn(t).getUTCDay()),e,2)}function Yr(t){return t.getUTCDay()}function Wr(t,e){return $n(kn.count(Mn(t)-1,t),e,2)}function Gr(t,e){return $n(t.getUTCFullYear()%100,e,2)}function Zr(t,e){return $n((t=qr(t)).getUTCFullYear()%100,e,2)}function Xr(t,e){return $n(t.getUTCFullYear()%1e4,e,4)}function Jr(t,e){var n=t.getUTCDay();return $n((t=n>=4||0===n?Ln(t):Ln.ceil(t)).getUTCFullYear()%1e4,e,4)}function Kr(){return"+0000"}function Qr(){return"%"}function ti(t){return+t}function ei(t){return Math.floor(+t/1e3)}function ni(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function ri(t){return function(e){return"string"!=typeof e&&ni(e),(e=e.trim())?t(e):null}}Bn=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,u=Vn(i),c=Yn(i),d=Vn(o),p=Yn(o),f=Vn(a),h=Yn(a),m=Vn(s),g=Yn(s),v=Vn(l),y=Yn(l),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:fr,e:fr,f:yr,g:Dr,G:Sr,H:hr,I:mr,j:gr,L:vr,m:br,M:_r,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ti,s:ei,S:wr,u:xr,U:Cr,V:kr,w:Er,W:Tr,x:null,X:null,y:Lr,Y:Fr,Z:Mr,"%":Qr},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Nr,e:Nr,f:Rr,g:Zr,G:Jr,H:Ur,I:Or,j:Br,L:Hr,m:jr,M:Ir,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ti,s:ei,S:zr,u:Pr,U:$r,V:Vr,w:Yr,W:Wr,x:null,X:null,y:Gr,Y:Xr,Z:Kr,"%":Qr},w={a:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:rr,e:rr,f:ur,g:Qn,G:Kn,H:or,I:or,j:ir,L:lr,m:nr,M:ar,p:function(t,e,n){var r=u.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:er,Q:dr,s:pr,S:sr,u:Gn,U:Zn,V:Xn,w:Wn,W:Jn,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Qn,Y:Kn,Z:tr,"%":cr};function x(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s<u;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=jn[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function C(t,e){return function(n){var r,i,o=On(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Un(On(o.y,0,1))).getUTCDay(),r=i>4||0===i?kn.ceil(r):kn(r),r=xn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Nn(On(o.y,0,1))).getDay(),r=i>4||0===i?fn.ceil(r):fn(r),r=cn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Un(On(o.y,0,1)).getUTCDay():Nn(On(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Un(o)):Nn(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in jn?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=C(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=C(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Bn.format,Bn.parse,Hn=Bn.utcFormat,Rn=Bn.utcParse;var ii=new Date(1972,3,27,19,45,5),oi={"%b %d":[{regex:/^june\s(30|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,5,t.split(/\s/)[1])}},{regex:/^july\s(3[01]|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,6,t.split(/\s/)[1])}},{regex:/^sept\s(30|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,8,t.split(/\s/)[1])}}],"%d %b":[{regex:/^(0?[1-9]|[1-9][0-9])\sjune$/i,toDate:function(t){return new Date(null,5,t.split(/\s/)[0])}},{regex:/^(0?[1-9]|[1-9][0-9])\sjuly$/i,toDate:function(t){return new Date(null,6,t.split(/\s/)[0])}},{regex:/^(0?[1-9]|[1-9][0-9])\ssept$/i,toDate:function(t){return new Date(null,8,t.split(/\s/)[0])}}]};function ai(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function si(t,e){var n,r=Rn(t),i=Hn(t);return n=ri("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:ri((function(e){return r(e)||(oi[t]?ai(oi[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(ii)})}var li=Object.freeze([si("%Y-%m-%dT%H:%M:%S.%LZ"),si("%Y-%m-%d %H:%M:%S"),si("%Y-%m-%dT%H:%M:%S"),si("%Y-%m-%dT%H:%M:%SZ"),si("%d/%m/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),si("%d/%m/%Y %H:%M",(function(t,e){if(!e)return!1;var n=t.split(/[/ :]/).map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),si("%d/%m/%y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&!isNaN(n[2])})),si("%m/%d/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3})),si("%m/%d/%Y %H:%M",(function(t,e){if(!e)return!1;var n=t.split(/[/ :]/).map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),si("%m/%d/%y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),si("%Y/%m/%d",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12&&n[2]>0&&n[2]<=31})),si("%d-%m-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),si("%d-%m-%y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&!isNaN(n[2])})),si("%d.%m.%Y",(function(t,e){if(!e)return!1;var n=t.split(".").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),si("%m.%d.%y",(function(t,e){if(!e)return!1;var n=t.split(".").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),si("%m-%d-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3})),si("%m-%d-%y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),si("%Y-%m-%d",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12&&n[2]>0&&n[2]<=31})),si("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),si("%d %b %Y",(function(t,e){if(!e)return!1;var n=t.split(" ").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d %B %Y",(function(t,e){if(!e)return!1;var n=t.split(" ").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d %b %y"),si("%-d %b ’%y"),si("%d %B %y"),si("%d-%b-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d-%B-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d-%b-%y"),si("%d-%B-%y"),si("%m/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>=1e3})),si("%m/%y"),si("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),si("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),si("%b-%y"),si("%b %y"),si("%B %y"),si("%b '%y"),si("%B %-d %Y"),si("%d %b",(function(t,e){return!!e||!!ai(oi["%d %b"])(t)})),si("%d %B"),si("%b %d",(function(t,e){return!!e||!!ai(oi["%b %d"])(t)})),si("%B %d"),si("%d-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12})),si("%m-%d"),si("%d/%m"),si("%m/%d"),si("%b %d %Y"),si("%b %d %Y, %-I.%M%p"),si("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),si("%B"),si("%b"),si("%X"),si("%I:%M %p"),si("%-I.%M%p"),si("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),si("%H:%M:%S"),si("%M:%S"),si("%-I%p"),si("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),si("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function ui(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var ci,di=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){if(!(e=di.exec(t)))throw new Error("invalid format: "+t);var e;return new fi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function fi(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function hi(t,e){var n=ui(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}pi.prototype=fi.prototype,fi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var mi={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return hi(100*t,e)},r:hi,s:function(t,e){var n=ui(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(ci=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ui(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function gi(t){return t}var vi=Array.prototype.map,yi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function bi(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?gi:(e=vi.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?gi:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(vi.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=pi(t)).fill,n=t.align,d=t.sign,p=t.symbol,f=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):mi[y]||(void 0===g&&(g=12),v=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===p?i:"#"===p&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===p?o:/[%p]/.test(y)?l:"",w=mi[y],x=/[defgprs%]/.test(y);function C(t){var i,o,l,p=b,C=_;if("c"===y)C=w(t)+C,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==d&&(A=!1),p=(A?"("===d?d:u:"-"===d||"("===d?"":d)+p,C=("s"===y?yi[8+ci/3]:"")+C+(A&&"("===d?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){C=(46===l?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}m&&!f&&(t=r(t,1/0));var k=p.length+t.length+C.length,E=k<h?new Array(h-k+1).join(e):"";switch(m&&f&&(t=r(E+t,E.length?h-C.length:1/0),E=""),n){case"<":t=p+t+C+E;break;case"=":t=p+E+t+C;break;case"^":t=E.slice(0,k=E.length>>1)+p+t+C+E.slice(k);break;default:t=E+p+t+C}return s(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=pi(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=ui(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=yi[8+i/3];return function(t){return r(o*t)+a}}}}var _i={test:ri((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/,/g,""))})),description:"Comma thousand separator, point decimal mark",thousand_separator:",",decimal_mark:".",id:"number$comma_point",example:"12,235.56"},wi={test:ri((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/\s/g,""))})),description:"Space thousand separator, point decimal mark",thousand_separator:" ",decimal_mark:".",id:"number$space_point",example:"12 235.56"},xi={test:ri((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},Ci={test:ri((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/\./g,"").replace(/,/,"."))})),description:"Point thousand separator, comma decimal mark",thousand_separator:".",decimal_mark:",",id:"number$point_comma",example:"12.235,56"},Ai={test:ri((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/\s/g,"").replace(/,/,"."))})),description:"Space thousand separator, comma decimal mark",thousand_separator:" ",decimal_mark:",",id:"number$space_comma",example:"12 235,56"},ki={test:ri((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},Ei=Object.freeze([_i,wi,Ci,Ai,xi,ki]);Ei.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=bi({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var Ti,Li=Object.freeze({test:function(t){return"string"==typeof t||ni(t)},parse:function(t){return"string"==typeof t?t:ni(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),Di=Object.freeze({datetime:li,number:Ei}),Fi=Object.freeze(["datetime","number","string"]),Si=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),Mi=Object.freeze(Object.keys(Si));function Ni(t,e){return t.index-e.index}function Ui(t,e){return e.n_success-t.n_success||Ni(t,e)}function Oi(t){return(""+t).trim()}function Bi(t){return void 0===t?function(t){return Oi(t)}:"function"==typeof t?function(e,n){return Oi(t(e,n))}:function(e){return Oi(e[""+t])}}function Hi(t){t?Array.isArray(t)||(t=[t]):t=Fi;var e=t.reduce((function(t,e){var n=Di[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=Mi.reduce((function(t,e){return t[e]=Si[e],t}),{}),i=function(t,i){i=Bi(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[Li]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),l=r.n_failing_values,u=r.sort?Ui:Ni,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],u=!1,c=0;c<a;c++){var d=o[c];if(!e.test(d)&&(++r>s?u=!0:-1===i.indexOf(d)&&(i.push(d),i.length>l&&(u=!0)),u))break}return u||t.push({interp:e,n_success:a-r,index:n}),t}),[]).sort(u).map((function(t){return t.interp}));return n&&c.push(Li),c};return Mi.forEach((function(t){var e;i[(e=t,e.replace(/_(\w)/g,(function(t,e){return e.toUpperCase()})))]=function(e){return void 0===e?r[t]:(r[t]=e,i)}})),i}function Ri(t,e,n,r){var i=[],o=[],a=0,s=[],l={};function u(t,e){if(!l[t])return{};var n=l[t];return n[e]?n[e]:{}}for(var c in s.column_names={},s.metadata={},n){var d={},p=n[c];if(p){for(let t=0;t<p.length;t++){const e=p[t].type_id,n=p[t].output_format_id,r=n&&"auto"!==n?n:e;d[p[t].index]={type_id:e,output_format_id:r}}l[c]=d}}for(var f in t)if(null!==t[f]&&(void 0!==t[f].columns||void 0!==t[f].column)){var h=t[f];if(h.template_data_binding=r[f],h.key=f,h.data_table_id in e){var m=e[h.data_table_id];if(0!=m.length){if("columns"in h&&null!=h.columns){var g=m[0].length;h.columns=h.columns.filter((function(t){return t<g})),s.column_names[f]=h.columns.map((function(t){return m[0][t]})),s.metadata[f]=h.columns.map((function(t){const{type_id:e,output_format_id:n}=u(h.data_table_id,t);return e?{type:e.split("$")[0],type_id:e,output_format_id:n}:null}))}else{if(!("column"in h)||null==h.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(h));{s.column_names[f]=m[0][h.column];const{type_id:t,output_format_id:e}=u(h.data_table_id,h.column);t&&(s.metadata[f]={type:t.split("$")[0],type_id:t,output_format_id:e})}}-1==o.indexOf(h.data_table_id)&&(o.push(h.data_table_id),a=Math.max(a,m.length-1)),i.push(h)}else console.warn("Empty data table")}else{var v=[];for(var y in e)v.push(y);console.error("Data table id "+h.data_table_id+" not in "+JSON.stringify(v))}}function b(t,e,n){if(!t.template_data_binding.data_type)return n;var r=function(t,e){const{type_id:n}=u(t,e);if(n)return Hi.getInterpretation(n)}(t.data_table_id,e);r&&"number"==r.type&&(n=$i(n));var i=r?r.parse(n):n;return Number.isNaN(i)&&(i=null),i}for(var _=0;_<a;_++){for(var w={},x=0;x<i.length;x++){var C=e[(h=i[x]).data_table_id];_+1>=C.length||("columns"in h&&null!=h.columns?w[h.key]=h.columns.filter((function(t){return t<C[_+1].length})).map((function(t){return b(h,t,C[_+1][t])})):"column"in h&&null!=h.column&&(h.column>=C[_+1].length?w[h.key]=b(h,h.column,""):w[h.key]=b(h,h.column,C[_+1][h.column])))}s.push(w)}return s}function ji(t){return function(t){for(var e=t.length,n=e>0?t[0].length:0,r=[],i=0;i<n;i++){for(var o=[],a=0;a<e;a++)o.push(t[a][i]);r.push(o)}return r}(t).map((function(t,e){const n=function(t){const e=t.length;return e>100?t.slice(10,e-10):e>50?t.slice(5,e-5):e>30?t.slice(4,e-4):e>20?t.slice(3,e-3):e>10?t.slice(2,e-2):e>1?t.slice(1,e):t.slice(0,1)}(t);let r;r=n.length>2e3?function(t,e){if(t.length<=2*e)return t;const n=function(t){let e=t;return function(){e|=0,e=e+1831565813|0;var t=Math.imul(e^e>>>15,1|e);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}(t.length);for(;t.length>e;){const e=Math.floor(n()*t.length);t.splice(e,1)}return t}(n,1e3):n;const i=(o=r,a=o.filter((function(t){return t&&!zi.includes(t.trim())})).map($i),Pi(a))[0].id;var o,a;return{type_id:i,index:e,output_format_id:i}}))}function Ii(t){for(var e=t.length;e-- >1&&(!t[e]||!t[e].length||Array.isArray(t[e])&&-1==t[e].findIndex((function(t){return null!==t&&""!==t})));)t.splice(e,1);return t}Hi.DATETIME_IDS=Object.freeze(li.map((function(t){return t.id}))),Hi.NUMBER_IDS=Object.freeze(Ei.map((function(t){return t.id}))),Hi.STRING_IDS=Object.freeze([Li.id]),Hi.getInterpretation=(Ti=li.concat(Ei,Li).reduce((function(t,e){return t[e.id]=e,t}),{}),function(t){return Ti[t]}),Hi._createAccessorFunction=Bi,Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<n;){var o=e[i];if(t.call(r,o,i,e))return i;i++}return-1},configurable:!0,writable:!0});var zi=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],Pi=Hi().nMax(1/0).nFailingValues(8).failureFraction(.1);function $i(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}let qi,Vi={};const Yi=t=>{const e=At(".dialog");if(t.which in Vi){var n=Vi[t.which];n.callback&&n.callback(qi.node().value),e.remove(),t.preventDefault()}};function Wi(t,e,{buttons:n=[{text:"Okay",keyCode:13}],is_html:r=!1,upgrade:i=null,is_loading:o=!1,width:a="420px",on_close:s=null}={}){var l=At("body").append("div").attr("class","dialog").attr("tabindex",0).on("mousedown",(function(t){for(var e=t.target,n=!1;e&&"dialog"!=e.className;)"dialog"==(e=e.parentNode).className&&(n=!0);n||(s&&s(),l.remove())})),u=l.append("div").attr("class","dialog-inner").style("width",a).on("click",(function(t){t.stopPropagation()})),c=u.append("div").attr("class","text"+(o?" loading":""));if("string"==typeof t?c.append("h1").text(t):t instanceof HTMLElement&&c.append("h1").append((()=>t)),"string"==typeof e)qi=r?c.append("div").classed("loading-spinner",o).html(e):c.append("p").text(e);else if(e instanceof HTMLElement)qi=c.append((()=>e));else if("object"==typeof e){if(qi=c.append(e.type),e.value&&(qi.node().value=e.value),e.attributes)for(var d in e.attributes)qi.attr(d,e.attributes[d]);qi.node().focus()}var p=u;null!=i&&"object"==typeof i&&function(t,e,n,r){r&&t.classed("business",!0);var i=t.append("div").attr("class","text");i.append("p").text(e),i.append("ul").selectAll("li").data(n).enter().append("li").html((function(t){return t})).append("i").attr("class","fa fa-check")}(p=p.append("div").attr("class","upgrade"),i.message,i.list,i.is_business);var f=p.append("div").attr("class","btns"+(o?" loading":""));return Vi={},n.forEach((function(t){var e=f.append(t.tag_name||"div").attr("class","btn").attr("data-testid","dialog-button").style("margin-right",o?"0":"0.75em").text(t.text).on("click",(function(){t.callback&&t.callback(qi.node().value,l),l.remove()}));t.class&&e.classed(t.class,!0),t.keyCode&&(Vi[t.keyCode]=t),t.href&&e.attr("href",t.href),t.target&&e.attr("target",t.target),t.fa_icon&&e.append("i").lower().attr("class","fa "+t.fa_icon)})),l.node().addEventListener("keydown",Yi),l.node().focus(),l}const Gi={allow_other_option:!1,match_anywhere:!1,custom_renderer:null,autocomplete:!0};function Zi({input:t,id:e,options:n=[],mode:r="single",options_config:i={}}){if(t&&e){this.input=t,this.id=e,this.mode=["single","multi"].includes(r)?r:"single",this.options=(Array.isArray(n)?n:[n]).map(Ji),this.selected_options=[],this.options_config={...Gi,...i},this.options_config.allow_other_option&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": it's not possible to allow other options in multi mode."),this.options_config.allow_other_option=!1),this.options_config.autocomplete&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": autocomplete will be disabled in multi mode."),this.options_config.autocomplete=!1),this.autocomplete=this.initAutocomplete(),this.changeCallback=function(){};var o=this;this.input.type="text",this.input.classList.add("multi"==r?"multi-select":"single-select"),this.input.addEventListener("change",(function(t){o.changeCallback.call(o.input,o.getValue(),t)})),this.setOptions(n),this.options_config.autocomplete||(this.input.setAttribute("readonly",!0),this.input.style.cursor="pointer")}else console.error("Can't initialize a dropdown without input or id")}function Xi(t){var e=t.options.filter((e=>t.selected_options.includes(e[1])));return t.selected_options.length&&!e.length&&t.options_config.allow_other_option&&(e=[[t.selected_options[0],t.selected_options[0]]]),e}function Ji(t){return Array.isArray(t)?t.map(String):[String(t),String(t)]}Zi.prototype.setSelectedOptions=function(t){this.selected_options=Array.isArray(t)?t:[t],this.updateInput()},Zi.prototype.setOptions=function(t){this.options=t.map(Ji),this.autocomplete.renderOptions()},Zi.prototype.select=function(t){"multi"==this.mode?this.selected_options.push(t):this.selected_options=[t],this.updateInput()},Zi.prototype.deselect=function(t){if("single"!=this.mode){var e=this.selected_options.indexOf(t);e>-1&&this.selected_options.splice(e,1),this.updateInput()}},Zi.prototype.getValue=function(t){var e=Xi(this).map((t=>t[1]));return"multi"===this.mode?t?e.join(", "):e:e[0]},Zi.prototype.getOptions=function(){return this.options},Zi.prototype.getDisplayValue=function(){return Xi(this).map((t=>t[0])).join(", ")},Zi.prototype.updateInput=function(){this.input.value=this.getDisplayValue(),this.input.setAttribute("data-value",this.getValue(!0))},Zi.prototype.isSelected=function(t){return this.selected_options.includes(t)},Zi.prototype.onChange=function(t){this.changeCallback=t};Zi.prototype.initAutocomplete=function(){var t=this,e=this.options_config,n=this.input;if(n.setAttribute("data-autocomplete",this.id),n.setAttribute("autocomplete","off"),!document.getElementById(this.id)){const t=kt("i").classed("fa fa-chevron-down clickable",!0),e=kt("div").classed("dropdown autocomplete",!0).attr("id",this.id);n.insertAdjacentHTML("afterend",t.node().outerHTML+e.node().outerHTML)}var r=[],i=At(document.getElementById(this.id));i.classed("click-to-open",!0);var o=i.append("div").attr("class","dropdown-list");function a(t){if(1===t.length)return"dropdown-category";var e="dropdown-item";return r.length&&r.includes(t[1])&&(e+=" current"),e}function s(n){var r=n||t.options;o.selectAll("div").remove(),o.selectAll("div").data(r).enter().append("div").attr("class",a).attr("data-value",(function(t){return"string"==typeof t?t||null:t[1]})).each((function(t){const n=At(this);if(!e.custom_renderer){const e=Array.isArray(t)?t[0]:t;return void n.text(e)}let r=e.custom_renderer(t,this);if(r){if(Array.isArray(r)||(r=[r]),r.find((t=>"string"!=typeof t&&!(t instanceof HTMLElement))))throw new Error("Autocomplete elements must be strings or HTMLElements");n.node().append(...r)}})),r.length||o.append("div").attr("class","dropdown-item disabled").text("No matches found")}function l(){i.classed("open",!1)}function u(e,r){if(r.hasAttribute("data-value")){var i=r.getAttribute("data-value");At(r).classed("current")&&"multi"===t.mode?t.deselect(i):t.select(i),l(),At(n).dispatch("change")}else e.preventDefault()}return i.on("mousedown",(function(t){u(t,t.target)})),At(n).on("keydown.autocomplete",(function(t){var e,r;9==t.keyCode||13==t.keyCode?(e=o.select(".selected")).empty()||(u(t,e.node()),n.blur()):40==t.keyCode?((e=o.select(".selected")).empty()||(r=e.node().nextSibling),r||(r=o.select(".dropdown-item[data-value]").node()),o.selectAll(".selected").classed("selected",!1),At(r).classed("selected",!0)):38==t.keyCode&&((e=o.select(".selected")).empty()||(r=e.node().previousSibling),r||(r=o.select(".dropdown-item:last-child").node()),o.selectAll(".selected").classed("selected",!1),At(r).classed("selected",!0))})).on("input.autocomplete",(function(){var r,i,o=n.value,a=o.toLowerCase(),l=!1,u=t.options;if(At(n).attr("data-value",o),i=e.match_anywhere?(t,e)=>t.includes(e):(t,e)=>0===t.indexOf(e),o){r=[];for(var c=0;c<u.length;c++){var d=("string"==typeof u[c]?u[c]:u[c][0]).toLowerCase();d==a&&(l=!0),i(d,a)&&r.push(u[c])}e.allow_other_option&&!l&&r.unshift(["Add new value: "+o,o])}else r=u;s(r)})).on("focus.autocomplete",(function(){var e=t.getValue();r=Array.isArray(e)?e:[e],s(t.options),i.classed("open",!0)})).on("blur.autocomplete",l),{renderOptions:s}};var Ki={number:{text:"Number",symbol:"/images/data_type_number.svg"},datetime:{text:"Date/time",symbol:"/images/data_type_date.svg"},string:{text:"Text",symbol:"/images/data_type_string.svg"}};Hi.STRING_IDS[0];var Qi,to,eo,no=[{full:"#F4B1C5",light:"#FFDDE7"},{full:"#967EC6",light:"#D0C5E5"},{full:"#C67EBD",light:"#E5C5E1"},{full:"#7E91C6",light:"#C5CDE5"},{full:"#7EB0C6",light:"#C5DBE5"},{full:"#7EC69B",light:"#C5E5D2"},{full:"#B3C67E",light:"#DDE5C5"},{full:"#C69B7E",light:"#E5D2C5"}],ro={},io={},oo=0;function ao(t,e){oo=0;var n=!1;t.template_id&&t.dataTables((function(r,i){if(r)return console.error("Failed to get data tables: "+r);io={};var o=t.dataBindingsForCurrentTemplate(),a=t.getDataTableNames(),s=At(".sheet-tab.selected").size()>0?At(".sheet-tab.selected").datum().id:null;to.html("");var l=null;"string"!=typeof e[0]&&(e=["Data"].concat(e));for(var u,c=[],d=0;d<e.length;d++){const t=e[d],n=e[d-1],r=!(!n||"string"==typeof n||n.dataset===t.dataset),i=(t.columns||t.column||"").split("::")[0],s="string"==typeof t;if((s||r)&&(void 0!==u&&c.push(u),u={title:s?t:i,description:null,bindings:[],template_sheet:null,visualisation_sheet:null}),s){if(d<e.length-1){var p=e[d+1];"string"==typeof p&&(u.description=p,d+=1)}}else{if(null===u.template_sheet&&i)for(var f in a)if(a[f]===i){u.template_sheet=+f;break}if(null===u.visualisation_sheet){var h=o[t.dataset]&&o[t.dataset][t.key];h&&(u.visualisation_sheet=h.data_table_id)}u.bindings.push(t),d===e.length-1&&c.push(u)}}for(d=0;d<c.length;d++){var m=c[d],g=m.bindings,v=m.visualisation_sheet||m.template_sheet||i[0].id,y=(l=to.append("div").attr("class","data-block").attr("data-sheet",a[v]).style("display",v===s?null:"none")).append("h2").attr("class","no-select");y.append("i").attr("class","fa fa-table"),y.append("span").text(" "+m.title),m.description&&l.append("p").text(m.description);var b=l.append("div").attr("class","data-bindings-header");b.append("p").attr("class","data-bindings-title").text("Select columns to visualise");for(var _=0;_<g.length;_++){var w=g[_];w.data_type&&(n=!0);var x=o[w.dataset]&&o[w.dataset][w.key],C=x?x.data_table_id:v;io[w.dataset]||(io[w.dataset]={}),io[w.dataset][w.key]=C,C!==v&&C===s&&l.style("display",null),so(l.append("div"),w,x,a,C!==s)}n&&b.append("p").attr("class","data-bindings-reset clickable").html("<i class='fa fa-magic'></i> Auto set columns").on("click",(function(){Wi("Automatically choose your columns","<i class='fa fa-magic'></i> Flourish will interpret your data to determine which columns to visualize",{is_html:!0,buttons:[{text:"Continue",keyCode:13,class:"primary",callback:function(){Qi.spreadsheet.inferDataBindings()}},{text:"Cancel",keyCode:27,class:"secondary"}]})}))}Qi.spreadsheet&&(Qi.spreadsheet.updateHighlights(),Qi.spreadsheet.updateTabs())}))}function so(t,e,n,r,i){no[oo]||(oo=0),t.attr("class","settings-option option-type-"+e.type).style("display",i?"none":null);var o=null==n?"":nn(n,r,!1,e.optional);ro[e.dataset]||(ro[e.dataset]={}),ro[e.dataset][e.key]=oo;var a="column"===e.type&&!e.optional,s=a&&!n;t.classed("empty-required-binding",s);var l=t.append("div").attr("class","data-binding-title").on("click",(function(){At(this).select("input").node().focus()}));l.append("h3").text(e.name).append("i").attr("class","fa fa-question setting-tooltip").style("display",e.description||e.data_type?null:"none"),"column"!=e.type||e.optional||l.select("h3").append("span").attr("class","required").text("Required"),l.append("input").attr("id","data-binding-"+e.dataset+"-"+e.key).attr("name",e.dataset+"-"+e.key).attr("disabled",!Qi.visualisation.can_edit||null).attr("autocomplete","off").attr("title",'Type in column IDs here, for example "A" or "A,B,D" or "A-D"').each((function(){this.value=o})).attr("data-value",o).attr("type","text").call(function(t){return function(e){e.on("change",(function(){Re.hide(),function(t,e){var n=t.parentElement.parentElement.parentElement.getAttribute("data-sheet"),r=t.value.indexOf("::")>-1,i={type:e.type};"column"==i.type?i.column=r?t.value:n+"::"+t.value:i.columns=r?t.value:n+"::"+t.value;var o,a=t.getBoundingClientRect(),s=[a.left-5,a.top+.5*a.height];if(t.value||"column"!=i.type){try{o=function(t,e){var n={};if(!(t.type in t)){if(t.optional)return n;throw new Error("Data binding must specify '"+t.type+"': "+JSON.stringify(t))}var r=t[t.type].indexOf("::");if(-1==r)throw new Error("Invalid data binding: "+t[t.type]);var i=t[t.type].substr(0,r);n.data_table_id=e[i];var o=t[t.type].substr(r+2);if("column"==t.type)n.column=Xe(o,t.optional);else{if("columns"!=t.type)throw new Error("Unknown data binding type: "+t.type);n.columns=tn(o)}return n}(i,Qi.visualisation.getDataTableIds());var l=nn(o,Qi.visualisation.getDataTableNames(),!1,e.optional);t.value.toUpperCase()!==l&&(t.value=l)}catch(e){return console.error("Failed to parse data binding",e),Re.point(s).text(e.message).draw(),t.value=t.getAttribute("data-value"),void(eo=!0)}if(At(t.parentElement.parentElement).classed("empty-required-binding",!1),!o.data_table_id)return t.value=t.getAttribute("data-value"),Re.point(s).text("No such data table").draw(),void(eo=!0);if(e.data_type){const n=Qi.spreadsheet.getTypeAnnotatedColumns();if("column"===i.type){const r=n[o.column];if(!r)return Re.point(s).html(`<span class="popup-content-header">Column '${t.value}' does not exist</span><p>Choose a column from the data table</p>`).draw(),t.value=t.getAttribute("data-value"),void(eo=!0);if(uo(e,r))return t.value=t.getAttribute("data-value"),Re.point(s).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${co([r.type])} columns</span>\n\t\t\t\t\t\t<p style="font-size:1em; margin-top:0.75em;">Choose a different column or check/change the column’s type in the header row with the following types:</p>\n\t\t\t\t\t\t<div style="font-size: 1em; margin-top: 0.75em;">${co(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(eo=!0)}else{const r=n.filter((t=>o.columns.includes(t.index))).filter((t=>uo(e,t)));if(r.length){t.value=t.getAttribute("data-value");var u=r.map((t=>t.type)).reduce(((t,e)=>t.includes(e)?t:[...t,e]),[]),c=u.reduce(((t,e,n,r)=>1===r.length?co([e]):(n<r.length-1?t+=`${n>0?",":""} ${co([e])}`:t+=`or ${co([e])}`,t)),"");return Re.point(s).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${c} columns</span>\n\t\t\t\t\t\t<p style="font-size:1em; margin-top:0.75em;">Choose a different column or check/change the column’s type in the header row with the following types:</p>\n\t\t\t\t\t\t<div style="font-size: 1em; margin-top: 0.75em;">${co(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(eo=!0)}}}}else if(o=null,!e.optional)return t.value=t.getAttribute("data-value"),Re.point(s).text("This column selection is required").draw(),void(eo=!0);Qi.spreadsheet.updateTabs();var d={};d[e.dataset]={},d[e.dataset][e.key]=o,lo(d,(function(){t.setAttribute("data-value",t.value);var e=po();e?(At(".publish-btn").classed("disabled",!0),At(".republish-btn").classed("disabled",!0),Et(".download-btn").classed("disabled",!0),At("body").classed("impossible",!0)):(At(".publish-btn").classed("disabled",!1),At(".republish-btn").classed("disabled",!1),Et(".download-btn").classed("disabled",!1),At("body").classed("impossible",!1),Qi.visualisation.getState((function(t){Qi.visualisation.prepareData((function(e,n){e?console.error("Failed to prepare data for template"):Qi.preview_pane.getDrawCalled()?Qi.preview_pane.sync({data:n,state:t,update:!0}):(Qi.preview_pane.sync({data:n,state:t,draw:!0}),Qi.preview_pane.setDrawCalled(!0))}))}))),Qi.spreadsheet&&Qi.spreadsheet.updateHighlights(),Qi.template_settings&&(e?Qi.template_settings.setReadOnly():Qi.template_settings.unsetReadOnly(),Qi.template_settings.populate()),Qi.theme_chooser.enableOrDisable()}))}(this,t)})).on("keydown",(function(){Qi.confirm.blank()})).on("focus",(function(){eo||Re.hide(),eo=!1,Et(".data-bindings .settings-option").classed("open",!1),At(this.parentElement.parentElement).classed("open",!0)}))}}(e)).style("background",no[oo].light).style("border-color",no[oo].full),s&&Qi.template_settings.setReadOnly(),a&&t.append("div").attr("class","data-binding-required").append("p").text("This column selection is required. The visualisation will not update while this field is empty.");var u,c=t.append("div").attr("class","data-binding-description");if(e.description&&c.append("p").html(Le.sanitize(e.description)),e.data_type){var d=c.append("div").attr("class","data-binding-data-types");d.append("p").text("Accepted column types");for(var p=Array.isArray(e.data_type)?e.data_type:[e.data_type],f=0;f<p.length;f++)u="string"==typeof p[f]?p[f]:p[f].type,d.append("span").attr("class","type-symbol data-binding-type-symbol").attr("title",Ki[u].text+" column.").style("background-image","url("+Ki[u].symbol+")")}oo++}function lo(t,e){Qi.confirm.saving(),Qi.visualisation.updateDataBindings(t,(function(t){if(t)return Qi.confirm.error(t),console.error("Failed to save data binding:",t),void Qi.analytics("event","exception",{description:t.message||t,fatal:!0});Qi.analytics("event","visualisation",{change_data_binding:Qi.visualisation.id}),Qi.confirm.saved(),fo(),e&&e()}))}function uo(t,e){return!(Array.isArray(t.data_type)?t.data_type:[t.data_type]).some((t=>"string"==typeof t?t===e.type:t.type===e.type))}function co(t){return t.map((t=>`\n\t\t<span class="column-type">\n\t\t<span class="type-symbol" title="${Ki[t].text} column" style="background-image: url(${Ki[t].symbol});"></span>\n\t\t<h2>${Ki[t].text}</h2>\n\t\t</span>\n\t\t`)).join("")}function po(){var t=Qi.visualisation.dataBindingsForCurrentTemplate(),e=Qi.template_data_bindings,n={};return e.forEach((function(t){"string"!=typeof t&&(n[t.dataset]||(n[t.dataset]={}),n[t.dataset][t.key]=t)})),e.some((function(e){if("string"!=typeof e&&"column"===e.type&&!n[e.dataset][e.key].optional)return!t[e.dataset]||null==t[e.dataset][e.key]}))}function fo(t=!0){if(po())At("body").classed("impossible",!0),At(".empty-label").html("<i class='fa fa-exclamation-triangle'></i> Oops! It looks like one of the required column selections is empty."),At(".empty-details").html("Head over to the <span class='data-tab-icon'><i class='fa fa-table'></i> Data</span> tab to choose a suitable column.");else if(At("body").classed("impossible")){const e=Qi.visualisation?Qi.visualisation:Qi.story;e.status&&e.status.requested_by?Qi.confirm_published.awaitingReview(e.status,e.can_review,Qi.user):Qi.visualisation.embed_url&&t?Qi.confirm_published.edited():(Qi.confirm_published.unpublished(),At("body").classed("impossible",!1),At(".empty-label").text(""),At(".empty-details").text(""))}}var ho,mo,go,vo,yo,bo,_o,wo,xo,Co=!1;function Ao(t){if(Co&&window.top!==window.self){var e=window;"srcdoc"===e.location.pathname&&(e=e.parent);var n,r=(n={},window._Flourish_template_id&&(n.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(n.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(n.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(n.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(n.story_id=window.Flourish.app.story.id,n.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(n.slide_index=window.Flourish.app.current_slide.index+1),n),i={sender:"Flourish",method:"customerAnalytics"};for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o]);for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);e.parent.postMessage(JSON.stringify(i),"*")}}function ko(t){if("function"!=typeof t)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(t)}function Eo(){Co=!0;[{event_name:"click",action_name:"click",use_capture:!0},{event_name:"keydown",action_name:"key_down",use_capture:!0},{event_name:"mouseenter",action_name:"mouse_enter",use_capture:!1},{event_name:"mouseleave",action_name:"mouse_leave",use_capture:!1}].forEach((function(t){document.body.addEventListener(t.event_name,(function(){Ao({action:t.action_name})}),t.use_capture)}))}function To(){if(null==ho){var t=function(){var t=window.location;"about:srcdoc"==t.href&&(t=window.parent.location);var e={};return function(t,n,r){for(;r=n.exec(t);)e[decodeURIComponent(r[1])]=decodeURIComponent(r[2])}(t.search.substring(1).replace(/\+/g,"%20"),/([^&=]+)=?([^&]*)/g),e}();ho="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return ho}function Lo(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function Do(t){if(t&&window.top!==window.self){var e=window;"srcdoc"==e.location.pathname&&(e=e.parent);var n={sender:"Flourish",method:"scrolly"};if(t)for(var r in t)n[r]=t[r];e.parent.postMessage(JSON.stringify(n),"*")}}function Fo(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),mo)return t=parseInt(t,10),void n.parent.postMessage({sentinel:"amp",type:"embed-size",height:t},"*");var r={sender:"Flourish",context:"iframe.resize",method:"resize",height:t,src:n.location.toString()};if(e)for(var i in e)r[i]=e[i];n.parent.postMessage(JSON.stringify(r),"*")}}function So(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function Mo(t){return"string"==typeof t||t instanceof String}function No(t){return"warn"!==t.method?(console.warn("BUG: validateWarnMessage called for method"+t.method),!1):!(null!=t.message&&!Mo(t.message))&&!(null!=t.explanation&&!Mo(t.explanation))}function Uo(t){return"resize"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Mo(t.src)&&(!!Mo(t.context)&&!!("number"==typeof(e=t.height)?!isNaN(e)&&e>=0:Mo(e)&&/\d/.test(e)&&/^[0-9]*(\.[0-9]*)?(cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%)?$/i.test(e)));var e}function Oo(t){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function Bo(t){return"scrolly"!==t.method?(console.warn("BUG: validateScrolly called for method"+t.method),!1):!!Array.isArray(t.slides)}function Ho(t){return"customerAnalytics"===t.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+t.method),!1)}function Ro(t){return"request-upload"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Mo(t.name)&&!(null!=t.accept&&!Mo(t.accept))}function jo(t,e,n){var r=function(t){for(var e={warn:No,resize:Uo,setSetting:Oo,customerAnalytics:Ho,"request-upload":Ro,scrolly:Bo},n={},r=0;r<t.length;r++){var i=t[r];if(!e[i])throw new Error("No validator found for method "+i);n[i]=e[i]}return n}(e);window.addEventListener("message",(function(e){var i=function(){if(e.origin==document.location.origin)return!0;if(n){const t=e.origin.toLowerCase();if(n=n.toLowerCase(),t.endsWith("//"+n))return!0;if(t.endsWith("."+n))return!0}return!!e.origin.match(/\/\/localhost:\d+$|\/\/(?:public|app)\.flourish.devlocal$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$|\/\/flourish-user-templates\.com$/)}();if(null!=e.source&&i){var o;try{o="object"==typeof e.data?e.data:JSON.parse(e.data)}catch(t){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(e.data))}if("Flourish"===o.sender)if(o.method)if(Object.prototype.hasOwnProperty.call(r,o.method))if(r[o.method](o)){for(var a=document.querySelectorAll("iframe"),s=0;s<a.length;s++)if(a[s].contentWindow==e.source||a[s].contentWindow==e.source.parent)return void t(o,a[s]);console.warn("could not find frame",o)}else console.warn("Validation failed for the message",o);else console.warn("No validator implemented for message",o);else console.warn("The 'method' property was missing from message",o)}})),So()&&(window.addEventListener("resize",Io),Io())}function Io(){for(var t=document.querySelectorAll(".flourish-embed"),e=0;e<t.length;e++){var n=t[e];if(!n.getAttribute("data-width")){var r=n.querySelector("iframe");if(r){var i=window.getComputedStyle(n),o=n.offsetWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight);r.style.width=o+"px"}}}}function zo(t,e){var n=t.parentNode;if(n.classList.contains("fl-scrolly-wrapper"))console.warn("createScrolly is being called more than once per story. This should not happen.");else{n.classList.add("fl-scrolly-wrapper"),n.style.position="relative",n.style.paddingBottom="1px",n.style.transform="translate3d(0, 0, 0)",t.style.position="sticky";var r=n.getAttribute("data-height")||null;r||(r="80vh",t.style.height=r),t.style.top="calc(50vh - "+r+"/2)";var i=n.querySelector(".flourish-credit");i&&(i.style.position="sticky",i.style.top="calc(50vh + "+r+"/2)"),e.forEach((function(t,e){var r="string"==typeof t&&""!=t.trim(),i=document.createElement("div");i.setAttribute("data-slide",e),i.classList.add("fl-scrolly-caption"),i.style.position="relative",i.style.transform="translate3d(0,0,0)",i.style.textAlign="center",i.style.maxWidth="500px",i.style.height="auto",i.style.marginTop="0",i.style.marginBottom=r?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var o=document.createElement("div");o.innerHTML=t,o.style.visibility=r?"":"hidden",o.style.display="inline-block",o.style.paddingTop="1.25em",o.style.paddingRight="1.25em",o.style.paddingBottom="1.25em",o.style.paddingLeft="1.25em",o.style.background="rgba(255,255,255,0.9)",o.style.boxShadow="0px 0px 10px rgba(0,0,0,0.2)",o.style.borderRadius="10px",o.style.textAlign="center",o.style.maxWidth="100%",o.style.margin="0 20px",o.style.overflowX="hidden",i.appendChild(o),n.appendChild(i)})),function(t){for(var e=new IntersectionObserver((function(e){e.forEach((function(e){if(e.isIntersecting){var n=t.querySelector("iframe");n&&(n.src=n.src.replace(/#slide-.*/,"")+"#slide-"+e.target.getAttribute("data-slide"))}}))}),{rootMargin:"0px 0px -0% 0px"}),n=t.querySelectorAll(".fl-scrolly-caption"),r=0;r<n.length;r++)e.observe(n[r]);t.querySelectorAll(".fl-scrolly-caption img").forEach((function(t){t.style.maxWidth="100%"}))}(n)}}function Po(t,e,n,r,i){var o=document.createElement("iframe");if(o.setAttribute("scrolling","no"),o.setAttribute("frameborder","0"),o.setAttribute("title","Interactive or visual content"),o.setAttribute("sandbox","allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"),e.appendChild(o),o.offsetParent||"fixed"===getComputedStyle(o).position)$o(t,e,o,n,r,i);else{var a={embed_url:t,container:e,iframe:o,width:n,height:r,play_on_load:i};if(window._flourish_poll_items?window._flourish_poll_items.push(a):window._flourish_poll_items=[a],window._flourish_poll_items.length>1)return o;var s=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(t){return!t.iframe.offsetParent||($o(t.embed_url,t.container,t.iframe,t.width,t.height,t.play_on_load),!1)})),window._flourish_poll_items.length||clearInterval(s)}),500)}return o}function $o(t,e,n,r,i,o){var a;return r&&"number"==typeof r?(a=r,r+="px"):r&&r.match(/^[ \t\r\n\f]*([+-]?\d+|\d*\.\d+(?:[eE][+-]?\d+)?)(?:\\?[Pp]|\\0{0,4}[57]0(?:\r\n|[ \t\r\n\f])?)(?:\\?[Xx]|\\0{0,4}[57]8(?:\r\n|[ \t\r\n\f])?)[ \t\r\n\f]*$/)&&(a=parseFloat(r)),i&&"number"==typeof i&&(i+="px"),r?n.style.width=r:So()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=Lo(a||n.offsetWidth)+"px"),i&&("%"===i.charAt(i.length-1)&&(i=parseFloat(i)/100*e.parentNode.offsetHeight+"px"),n.style.height=i),n.setAttribute("src",t+(o?"#play-on-load":"")),n}function qo(t,e,n){for(var r in e||(e=[]),n||(n={}),t)e.push(r),"object"==typeof t[r]&&qo(t[r],e,n),n[e.join(".")]=t[r],e.pop();return n}function Vo(t){var e={};for(var n in t){for(var r=e,i=n.indexOf("."),o=0;i>=0;i=n.indexOf(".",o=i+1)){var a=n.substring(o,i);a in r||(r[a]={}),r=r[a]}r[n.substring(o)]=t[n]}return e}function Yo(t){if(null==t)return t;var e,n={};for(var r in t)Array.isArray(t[r])?n[r]=t[r].slice():(e=t[r],Array.isArray(e)||"object"!=typeof e||null==e?n[r]=t[r]:n[r]=Yo(t[r]));return n}var Wo,Go=null;function Zo(){return"MessageChannel"in window}var Xo=null;function Jo(){Xo&&go.removeEventListener("load",Xo),Xo=null}function Ko(t){Jo(),go.addEventListener("load",t),Xo=t}function Qo(t,e,n){return ba(!1),xo=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,Go=null,xo&&xo.template_id?(Ko(function(t,e,n){var r=t.visualisation?t.visualisation.template_id:t.current_slide.visualisation.template_id,i=t.current_slide?t.current_slide.id:null;return function(){Lt(),!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||(Jo(),sa((function(o,a){o?console.error("Failed to get default state"):!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||la((function(o,s){if(o)console.error("Failed to call hasData");else if(xo&&xo.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var l=!1;t.visualisation&&(l=t.data_bindings.requiredBindingsAreUnset()),s?xo.refreshDataBindings((function(o){o?console.error("Failed to refresh data bindings"):!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||xo.prepareData((function(o,s){o?console.error("Failed to prepare data for template"):!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||va({data:s,state:e,draw:!l},(function(t,e){Go=a,n(t,e)}))}))})):va({state:e,draw:!l},(function(t,e){Go=a,n(t,e)}))}}))})))}}(t,e,n)),go.src="/template/"+xo.template_id+"/embed/?auto=1&environment="+vo+"&is_read_only="+(t.is_read_only?"1":"0"),go):(Jo(),go.src="about:blank",go)}function ta(t){sa((function(e,n){e?console.error("Failed to get default state"):(Go=n,t())}))}function ea(t,e){var n=t.template_id;t.refreshDataBindings((function(r){r?console.error("Failed to fetch data bindings"):t.prepareData((function(t,r){if(xo&&xo.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function na(t,e){ea(t,(function(t,n){if(t)return e(t);va({data:n,update:!0},e)}))}function ra(t,e){ea(t,(function(t,n){if(t)return e(t);va({data:n,update:!1},e)}))}function ia(t,e,n){ea(t,(function(t,r){if(t)return n(t);va({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function oa(t,e,n,r=go){if(Zo()){var i=new MessageChannel;i.port1.onmessage=function(t){var e=t.data;if("string"==typeof e){if(!n)return;return n(void 0,JSON.parse(e))}if("object"==typeof e){if("result"in e){if(!n)return;return n(void 0,e.result)}if("error"in e){if(!n)return;return n(e.error)}console.error("Unrecognised response to message",e)}else console.error("Unrecognised response to message",e)},r.contentWindow.postMessage({sender:"Flourish",method:t,argument:e},"*",[i.port2])}}function aa(t,e){oa("setState",Vo(t),e)}function sa(t,e){"function"!=typeof t?oa("getState",t,e):oa("getState",void 0,t)}function la(t){oa("hasData",void 0,t)}function ua(t,e){oa("setData",t,e)}function ca(t){oa("getData",void 0,t)}function da(t){oa("draw",void 0,t),ba(!0)}function pa(t){_o&&_o.clear(),ya()&&oa("update",void 0,t)}function fa(t,e,n){oa("snapshot",t,e,n)}function ha(){return Yo(Go)}function ma(t,e){oa("setFixedHeight",t,e)}function ga(t){if(go.parentNode.offsetWidth){if(void 0!==t)Wo=null!=t;else if(Wo)return;var e=t||bo&&bo.responsive_menu&&bo.responsive_menu.getHeightSetting()||yo.getHeightForBreakpoint(go.offsetWidth),n=typeof e;("number"===n||"string"===n&&!isNaN(e))&&(e+="px"),go.style.height=e}}function va(t,e,n=go){ya()?delete t.draw:t.draw&&ba(!0),t.state&&(t.state=Vo(t.state)),_o&&_o.clear(),oa("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&ba(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(ua(t.data,e),delete t.data,!1):t.state?(aa(t.state,e),delete t.state,!1):t.draw?(da(e),delete t.draw,!1):!t.update||(pa(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}),n)}function ya(){return wo}function ba(t){wo=t}function _a(t,e,n,r,i){return go=document.querySelector(t),vo=e,bo=n,_o=r,i||(i={}),mo="#amp=1"==window.location.hash,yo={createEmbedIframe:Po,isFixedHeight:To,getHeightForBreakpoint:Lo,startEventListeners:jo,notifyParentWindow:Fo,initScrolly:Do,createScrolly:zo,isSafari:So,initCustomerAnalytics:Eo,addAnalyticsListener:ko,sendCustomerAnalyticsMessage:Ao},go.style.height=yo.getHeightForBreakpoint(go.offsetWidth)+"px",yo.startEventListeners((function(t){"resize"==t.method?ga(t.height):"warn"==t.method?(_o&&_o.warn(t),console.warn("Warning from template:",t.message,t.explanation)):t.method in i&&i[t.method](t)}),["resize","warn","customerAnalytics","setSetting","request-upload"]),Zo()||function(t){if(t){var e=document.createElement("div");e.className="unsupported-notice",e.innerHTML="<h3>Please update your browser</h3><p>This page only works with newer versions of your browser.</p>",t.appendChild(e)}}(go.parentNode),{loadVisualisation:Qo,updateData:na,updateDataAndState:ia,updateDataNotPreview:ra,setState:aa,getState:sa,getDefaultState:ha,hasData:la,setData:ua,getData:ca,draw:da,update:pa,snapshot:fa,setFixedHeight:ma,resize:ga,sync:va,getDrawCalled:ya,setDrawCalled:ba,setFrameLoadListener:Ko,updateDefaultState:ta}}var wa=function(t=document.body){t.classList.add("loading")},xa=function(t=document.body){t.classList.remove("loading")};const Ca=new Set([1,274,282,283,296,34675,40961,42240]);function Aa(t){let e=0;function n(n){if(e>=t.byteLength)return null;void 0===n&&(n=1);const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength+2);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=(new TextEncoder).encode("Exif\0\0");function*s(t){if(t<32)return;if(!function(t,e){if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t.getInt8(n)!==e.getInt8(n))return!1;return!0}(n(6),new DataView(a.buffer)))return void n(t-8);const e=[],r=n(t-8),i=r.getUint16(0);let o;if(18761===i)o=!0;else{if(19789!==i)return;o=!1}function s(t){return r.getUint16(t,o)}function l(t){return r.getUint32(t,o)}if(42!==s(2))return;let u=l(4);for(;0!=u;){const t=s(u);u+=2;for(let n=0;n<t;n++){const t=s(u),n=s(u+2),i=l(u+4),a=l(u+8);if(u+=12,!Ca.has(t))continue;if(n<1||n>12)continue;let c;switch(n){case 1:case 2:case 6:case 7:c=1;break;case 3:case 8:c=2;break;case 4:case 9:case 11:c=4;break;case 5:case 10:case 12:c=8}const d=c*i;let p;if(d<=4)p=new DataView(new ArrayBuffer(4),0,4),p.setUint32(0,a,o);else{p=new DataView(new ArrayBuffer(d));for(let t=0;t<d;t++)p.setInt8(t,r.getInt8(a+t))}e.push({code:t,type:n,num_values:i,data:p})}u=l(u)}let c=10;for(const{data:t}of e)c+=12,t.byteLength>4&&(c+=t.byteLength);c+=4;const d=new Uint8Array(c),p=new DataView(d.buffer);d.set((new TextEncoder).encode("MM\0*\0\0\0\b"),0),p.setUint16(8,e.length);let f=10,h=10+12*e.length+4;for(const{code:t,type:n,num_values:r,data:i}of e){if(p.setUint16(f,t),p.setUint16(f+2,n),p.setUint32(f+4,r),i.byteLength<=4)for(let t=0;t<i.byteLength;t++)p.setInt8(f+8+t,i.getInt8(t));else{p.setUint32(f+8,h);for(let t=0;t<i.byteLength;t++)p.setInt8(h+t,i.getInt8(t));h+=i.byteLength}f+=12}const m=new Uint8Array(10),g=new DataView(m.buffer);g.setUint8(0,255),g.setUint8(1,225),g.setUint16(2,p.byteLength+8),m.set(a,4),yield m,yield p}const l=n(2);if(65496!==l.getUint16(0))throw new Error("Not a valid JPEG");for(o(l);;){const t=n(2),e=t.getUint16(0);if(65498===e){o(t);break}const r=n(2),i=r.getUint16(0);if(65505!==e)o(t),o(r),o(n(i-2));else for(const t of s(i))o(t)}const u=new Uint8Array([255,217]);let c,d=!1,p=!1;for(;null!=(c=n());){if(d&&217===c.getUint8(0)){p=!0,o(new DataView(new Uint8Array([217]).buffer));break}const t=new Uint8Array(c.buffer).indexOf(u);if(!(t<0)){o(c.slice(0,t+2)),p=!0;break}o(c),d=c.byteLength>0&&255===c.getUint8(c.byteLength-1)}return p||o(u),r}function ka(t){let e=0;function n(n){if(e+n>t.byteLength)return null;const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=n(8);if(80!==a.getUint8(1)||78!==a.getUint8(2)||71!==a.getUint8(3))throw new Error("Not a valid PNG");let s,l;for(o(a);null!=(s=n(4))&&null!=(l=n(4));){const t=s.getUint32(0),e=l.getUint8(0),r=l.getUint8(1);101===e||105===e&&84===r?(n(t),n(4)):(o(s),o(l),o(n(t)),o(n(4)))}return r}var Ea="/api/file/upload";function Ta(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){La(t)}))}function La(t,e){var n=t.ownerDocument.createElement("button");n.type="button",n.className="upload",n.setAttribute("title","Upload a file from your computer"),n.innerHTML="⬆︎",t.insertAdjacentElement("afterend",n),e||(n.onclick=Da)}function Da(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),Fa({accept:e,success:function(e){var n;t.disabled=!1,t.classList.toggle("uploading",!1),t.value=e,"createEvent"in document?(n=document.createEvent("Event")).initEvent("change",!0,!0):n=new Event("change",{bubbles:!0}),t.dispatchEvent(n)},failure:function(){t.disabled=!1,t.classList.toggle("uploading",!1)}})}function Fa(t){var e=document.getElementById("file-uploader");e||((e=document.createElement("input")).type="file",e.setAttribute("id","file-uploader"),e.style.display="none",document.body.appendChild(e)),t.accept?e.setAttribute("accept",t.accept):e.removeAttribute("accept"),e.onchange=async function(){wa(),await async function(t,e,n){const r=await async function(t){try{if("image/png"===t.type)return new File([ka(await t.arrayBuffer())],t.name,{type:t.type});if("image/jpeg"===t.type)return new File([Aa(await t.arrayBuffer())],t.name,{type:t.type})}catch(t){console.error(t)}return t}(t[0]);!function(t,e){var n={filename:t.name,content_type:t.type,size:t.size};Sa(Ea,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(r,(function(t,i){if(t)return xa(),Wi("Upload error","There was a problem uploading your file: "+t.message),void console.error(t);var o=function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}({file:r},i.fields);Sa(i.upload_url,o,(function(t,r){xa(),t?(Wi("Upload error","There was a problem uploading your file ("+r.status+")."),console.error(t),n&&n()):e(i.file_url)}))}))}(e.files,t.success,t.failure),e.parentNode.removeChild(e)},e.click()}function Sa(t,e,n){var r=new XMLHttpRequest,i=new FormData;if("object"==typeof e){for(var o in e)e.hasOwnProperty(o)&&"file"!==o&&i.append(o,e[o]);e.hasOwnProperty("file")&&i.append("file",e.file)}window.Flourish.csrf_token&&i.append("csrf_token",window.Flourish.csrf_token),r.onload=function(){if(r.status>=200&&r.status<300)n(null,r);else try{var e=JSON.parse(r.responseText).error;n(e,r)}catch(e){n(new Error("POST "+t+" received status code: "+r.status),r)}},r.open("POST",t,!0),r.send(i)}var Ma="https://fonts.googleapis.com/css?family=",Na=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],Ua="Same as parent",Oa=[],Ba=[],Ha={};function Ra(t){return Ma+t.replace(/ /g,"+")+":400,700"}function ja(t){var e=Ba.concat(Oa,Na.map((function(t){return{name:t,url:Ra(t)}})));return t&&e.unshift({name:Ua}),e}function Ia(t){return ja(!0).find((function(e){return e.name==t}))}var za=!1;function Pa(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function $a(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(Ma)&&(n=e.value=Pa(n)),!Ia(n))){if(/^https?:\/\//.test(n)){za||(qa(n),e.value="");var r=n;return n=e.value=Pa(r),Ba.push({name:n,url:r}),void Va()}var i=Ra(n);try{var o=new XMLHttpRequest;if(o.open("HEAD",i,!1),o.send(),404==o.status)throw"Font not found";Ba.push({name:n,url:i}),Va()}catch(t){qa(n),e.value=""}}}function qa(t){Wi("Unrecognised font “"+t+"”","Fonts must be chosen from Google Fonts. Visit <a href='https://fonts.google.com'>fonts.google.com</a> to find more",{is_html:!0})}function Va(){var t,e,n=Object.keys(Ha);for(t=0;t<n.length;++t)(e=Ha[n[t]]).dropdown.setOptions(ja(e.can_inherit).map((function(t){return t.name})))}var Ya={initialize:function(t,e,n){var r=!!e.optional;za=n,t.classList.add("font-menu");var i=new Zi({input:t,id:e.property+"-dropdown",options:ja(r).map((t=>t.name)),mode:"single",options_config:{allow_other_option:!0}});t._dropdown=i,Ha[e.property]={dropdown:i,can_inherit:r},t.addEventListener("change",$a)},update:function(t,e){var n=e?e.name:Ua;t._dropdown.setSelectedOptions(n),Ia(n)||(n!=Ua&&Ba.push({name:n,url:e.url}),Va())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:Pa(t.value),url:t.value};var e=t.value;if(e==Ua)return null;var n=Ia(e);return n||{name:e,url:Ra(e)}},replaceThemeFonts:function(t){Oa=(t||[]).map((function(t){return{name:t.name,url:t.url}})),Va()}},Wa="$";function Ga(){}function Za(t,e){var n=new Ga;if(t instanceof Ga)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function Xa(){}Ga.prototype=Za.prototype={constructor:Ga,has:function(t){return Wa+t in this},get:function(t){return this[Wa+t]},set:function(t,e){return this[Wa+t]=e,this},remove:function(t){var e=Wa+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Wa&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Wa&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Wa&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Wa&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Wa&&++t;return t},empty:function(){for(var t in this)if(t[0]===Wa)return!1;return!0},each:function(t){for(var e in this)e[0]===Wa&&t(this[e],e.slice(1),this)}};var Ja=Za.prototype;Xa.prototype={constructor:Xa,has:Ja.has,add:function(t){return this[Wa+(t+="")]=t,this},remove:Ja.remove,clear:Ja.clear,values:Ja.keys,size:Ja.size,empty:Ja.empty,each:Ja.each};var Ka={value:function(){}};function Qa(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new ts(r)}function ts(t){this._=t}function es(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function ns(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function rs(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ka,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function is(t,e,n,r,i){for(var o in t.getVersionNumber=function(){return t.version_number},t.setVersionNumber=function(e){t.version_number=e},t.id=e,t.version_number=n||0,r)t[o]=r[o];if(i)for(var o in i)t[o]=i[o]}ts.prototype=Qa.prototype={constructor:ts,on:function(t,e){var n,r=this._,i=es(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=rs(r[n],t.name,e);else if(null==e)for(n in r)r[n]=rs(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=ns(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ts(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var os={};function as(t){t.running||(t.running=!0,ss(t,(function(){t.running=!1})))}function ss(t,e){t.request=function(t,e){var n="method"in t?t.method:"POST",r="request_type"in t?t.request_type:"application/json",i="response_type"in t?t.response_type:"application/json",o=t.url,a=t.payload,s=t.callback;!a&&ls(n)&&(a=function(){return{}});if(a){if("function"!=typeof a)throw new Error("Internal error: processRequestThen: payload must be a function, not "+typeof a,a);"object"==typeof(a=a())&&ls(n)&&(window.Flourish&&window.Flourish.csrf_token||console.trace("window.Flourish.csrf_token missing"),a.csrf_token=window.Flourish.csrf_token),"string"!=typeof a&&(a=JSON.stringify(a))}var l=function(t,e){var n,r,i,o,a=Qa("beforesend","progress","load","error"),s=Za(),l=new XMLHttpRequest,u=null,c=null,d=0;function p(t){var e,r=l.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,l)}catch(t){return void a.call("error",n,t)}else e=l;a.call("load",n,e)}else a.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(t)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=p:l.onreadystatechange=function(t){l.readyState>3&&p(t)},l.onprogress=function(t){a.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(o=t,n):o},timeout:function(t){return arguments.length?(d=+t,n):d},user:function(t){return arguments.length<1?u:(u=null==t?null:t+"",n)},password:function(t){return arguments.length<1?c:(c=null==t?null:t+"",n)},response:function(t){return i=t,n},get:function(t,e){return n.send("GET",t,e)},post:function(t,e){return n.send("POST",t,e)},send:function(e,i,p){return l.open(e,t,!0,u,c),null==r||s.has("accept")||s.set("accept",r+",*/*"),l.setRequestHeader&&s.each((function(t,e){l.setRequestHeader(e,t)})),null!=r&&l.overrideMimeType&&l.overrideMimeType(r),null!=o&&(l.responseType=o),d>0&&(l.timeout=d),null==p&&"function"==typeof i&&(p=i,i=null),null!=p&&1===p.length&&(p=function(t){return function(e,n){t(null==e?n:null)}}(p)),null!=p&&n.on("error",p).on("load",(function(t){p(null,t)})),a.call("beforesend",n,l),l.send(null==i?null:i),n},abort:function(){return l.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}return n}(o);r&&"GET"!==n&&l.header("Content-Type",r);i&&l.mimeType(i);return l.on("error",(function(t){var n;try{n=JSON.parse(t.target.responseText),s(n.error)}catch(e){s("Internal error: "+t.target.responseText)}e()})),l.on("load",(function(t){var n=t.responseText;"application/json"===i&&(n=JSON.parse(n));try{s(void 0,n)}catch(t){console.error(t.stack)}e()})),l.send(n,a),l}(t.items.shift(),(function(){t.request=null,0==t.items.length?e():ss(t,e)}))}function ls(t){return["POST","PUT","DELETE"].includes(t)}function us(t,e){void 0===e&&(e="default"),e in os||(os[e]={items:[],running:!1,name:e}),os[e].items.push(t),as(os[e])}function cs(t,e){for(var n in e)t[n]=e[n];return t}function ds(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&cs(t,e),us({url:t.api_prefix+"/"+t.id,payload:function(){return{version_number:t.getVersionNumber(),fields:e}},callback:function(i,o){if(i)return r(i);n||cs(t,e),t.setVersionNumber(o.version_number),r(void 0)}})}function ps(t,e){t.delete_requested=!0,us({url:t.api_prefix+"/"+t.id,method:"DELETE",payload:function(){return{version_number:t.getVersionNumber()}},callback:function(n,r){if(n)return e(n);t.setVersionNumber(r.version_number),t.is_deleted=!0,e(void 0,r)}})}var fs={addApiKey:function(t){us({url:"/api/user/api_keys",method:"PUT",callback:t})},addFolder:function(t,e){us({url:"/api/user/folder/"+encodeURIComponent(t),method:"PUT",callback:e})},addTag:function(t,e){us({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},deleteApiKey:function(t,e){us({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchFolders:function(t){us({url:"/api/user/folder",method:"GET",callback:t})},fetchProjects:function(t,e,n,r,i,o,a,s){let l="/api/user/projects";const u=[];n&&u.push("sort="+encodeURIComponent(n)),r&&u.push("filter="+encodeURIComponent(r)),i&&u.push("offset="+encodeURIComponent(i)),o&&u.push("limit="+encodeURIComponent(o)),a&&u.push("search="+encodeURIComponent(a)),s&&u.push("is_recent=true"),e&&(l+="/folder/"+encodeURIComponent(e)),u.length&&(l+="?"+u.join("&")),us({url:l,method:"GET",callback:t})},generateSdkToken:function(t){us({url:"/api/user/generate_sdk_token",method:"GET",callback:t})},getApiKeys:function(t){us({url:"/api/user/api_keys",method:"GET",callback:t})},getReviewCount:function(t){us({url:"/api/reviews/count",method:"GET",callback:t})},isUsernameAvailable:function(t,e){us({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},logHistory:function(t){us({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})},removeFolder:function(t,e){us({url:"/api/user/folder/"+encodeURIComponent(t),method:"DELETE",callback:e})},removeTag:function(t,e){us({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},renameFolder:function(t,e,n){us({url:"/api/user/folder/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},renameTag:function(t,e,n){us({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},revokeSdkToken:function(t,e){us({url:"/api/user/sdk_token/"+encodeURIComponent(t),method:"DELETE",callback:e})},setSamlProviderId:function(t,e,n){us({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})},update:function(t,e){us({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})}};var hs={};function ms(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function gs(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function vs(){}var ys=.7,bs=1/ys,_s="\\s*([+-]?\\d+)\\s*",ws="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Cs=/^#([0-9a-f]{3,8})$/,As=new RegExp(`^rgb\\(${_s},${_s},${_s}\\)$`),ks=new RegExp(`^rgb\\(${xs},${xs},${xs}\\)$`),Es=new RegExp(`^rgba\\(${_s},${_s},${_s},${ws}\\)$`),Ts=new RegExp(`^rgba\\(${xs},${xs},${xs},${ws}\\)$`),Ls=new RegExp(`^hsl\\(${ws},${xs},${xs}\\)$`),Ds=new RegExp(`^hsla\\(${ws},${xs},${xs},${ws}\\)$`),Fs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ss(){return this.rgb().formatHex()}function Ms(){return this.rgb().formatRgb()}function Ns(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Cs.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Us(e):3===n?new Rs(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Os(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Os(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=As.exec(t))?new Rs(e[1],e[2],e[3],1):(e=ks.exec(t))?new Rs(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Es.exec(t))?Os(e[1],e[2],e[3],e[4]):(e=Ts.exec(t))?Os(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ls.exec(t))?qs(e[1],e[2]/100,e[3]/100,1):(e=Ds.exec(t))?qs(e[1],e[2]/100,e[3]/100,e[4]):Fs.hasOwnProperty(t)?Us(Fs[t]):"transparent"===t?new Rs(NaN,NaN,NaN,0):null}function Us(t){return new Rs(t>>16&255,t>>8&255,255&t,1)}function Os(t,e,n,r){return r<=0&&(t=e=n=NaN),new Rs(t,e,n,r)}function Bs(t){return t instanceof vs||(t=Ns(t)),t?new Rs((t=t.rgb()).r,t.g,t.b,t.opacity):new Rs}function Hs(t,e,n,r){return 1===arguments.length?Bs(t):new Rs(t,e,n,null==r?1:r)}function Rs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function js(){return`#${$s(this.r)}${$s(this.g)}${$s(this.b)}`}function Is(){const t=zs(this.opacity);return`${1===t?"rgb(":"rgba("}${Ps(this.r)}, ${Ps(this.g)}, ${Ps(this.b)}${1===t?")":`, ${t})`}`}function zs(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ps(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function $s(t){return((t=Ps(t))<16?"0":"")+t.toString(16)}function qs(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ys(t,e,n,r)}function Vs(t){if(t instanceof Ys)return new Ys(t.h,t.s,t.l,t.opacity);if(t instanceof vs||(t=Ns(t)),!t)return new Ys;if(t instanceof Ys)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,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Ys(a,s,l,t.opacity)}function Ys(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ws(t){return(t=(t||0)%360)<0?t+360:t}function Gs(t){return Math.max(0,Math.min(1,t||0))}function Zs(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Xs(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}ms(vs,Ns,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ss,formatHex:Ss,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Vs(this).formatHsl()},formatRgb:Ms,toString:Ms}),ms(Rs,Hs,gs(vs,{brighter(t){return t=null==t?bs:Math.pow(bs,t),new Rs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ys:Math.pow(ys,t),new Rs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Rs(Ps(this.r),Ps(this.g),Ps(this.b),zs(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:js,formatHex:js,formatHex8:function(){return`#${$s(this.r)}${$s(this.g)}${$s(this.b)}${$s(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Is,toString:Is})),ms(Ys,(function(t,e,n,r){return 1===arguments.length?Vs(t):new Ys(t,e,n,null==r?1:r)}),gs(vs,{brighter(t){return t=null==t?bs:Math.pow(bs,t),new Ys(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ys:Math.pow(ys,t),new Ys(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 Rs(Zs(t>=240?t-240:t+120,i,r),Zs(t,i,r),Zs(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ys(Ws(this.h),Gs(this.s),Gs(this.l),zs(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=zs(this.opacity);return`${1===t?"hsl(":"hsla("}${Ws(this.h)}, ${100*Gs(this.s)}%, ${100*Gs(this.l)}%${1===t?")":`, ${t})`}`}}));var Js=Xs("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Ks=Xs("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Qs=Xs("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),tl=Xs("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),el=t=>()=>t;function nl(t){return 1==(t=+t)?rl: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):el(isNaN(e)?n:e)}}function rl(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):el(isNaN(t)?e:t)}var il=function t(e){var n=nl(e);function r(t,e){var r=n((t=Hs(t)).r,(e=Hs(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=rl(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 ol(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var al=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sl=new RegExp(al.source,"g");function ll(t,e){var n,r,i,o=al.lastIndex=sl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=al.exec(t))&&(r=sl.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,l.push({i:a,x:ol(n,r)})),o=sl.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}var ul,cl=180/Math.PI,dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pl(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*cl,skewX:Math.atan(l)*cl,scaleX:a,scaleY:s}}function fl(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:ol(t,i)},{i:l-2,x:ol(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:ol(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:ol(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),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:ol(t,n)},{i:s-2,x:ol(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var hl,ml,gl=fl((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?dl:pl(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),vl=fl((function(t){return null==t?dl:(ul||(ul=document.createElementNS("http://www.w3.org/2000/svg","g")),ul.setAttribute("transform",t),(t=ul.transform.baseVal.consolidate())?pl((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):dl)}),", ",")",")"),yl=0,bl=0,_l=0,wl=0,xl=0,Cl=0,Al="object"==typeof performance&&performance.now?performance:Date,kl="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function El(){return xl||(kl(Tl),xl=Al.now()+Cl)}function Tl(){xl=0}function Ll(){this._call=this._time=this._next=null}function Dl(t,e,n){var r=new Ll;return r.restart(t,e,n),r}function Fl(){xl=(wl=Al.now())+Cl,yl=bl=0;try{!function(){El(),++yl;for(var t,e=hl;e;)(t=xl-e._time)>=0&&e._call.call(null,t),e=e._next;--yl}()}finally{yl=0,function(){var t,e,n=hl,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:hl=e);ml=t,Ml(r)}(),xl=0}}function Sl(){var t=Al.now(),e=t-wl;e>1e3&&(Cl-=e,wl=t)}function Ml(t){yl||(bl&&(bl=clearTimeout(bl)),t-xl>24?(t<1/0&&(bl=setTimeout(Fl,t-Al.now()-Cl)),_l&&(_l=clearInterval(_l))):(_l||(wl=Al.now(),_l=setInterval(Sl,1e3)),yl=1,kl(Fl)))}function Nl(t,e,n){var r=new Ll;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Ll.prototype=Dl.prototype={constructor:Ll,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?El():+n)+(null==e?0:+e),this._next||ml===this||(ml?ml._next=this:hl=this,ml=this),this._call=t,this._time=n,Ml()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ml())}};var Ul=Qa("start","end","cancel","interrupt"),Ol=[];function Bl(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=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,c,d,p;if(1!==n.state)return l();for(u in i)if((p=i[u]).name===n.name){if(3===p.state)return Nl(a);4===p.state?(p.state=6,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete i[u]):+u<e&&(p.state=6,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete i[u])}if(Nl((function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(d=n.tween.length),u=0,c=-1;u<d;++u)(p=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=p);r.length=c+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Dl(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:Ul,tween:Ol,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Hl(t,e){var n=jl(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Rl(t,e){var n=jl(t,e);if(n.state>3)throw new Error("too late; already running");return n}function jl(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Il(t,e){var n,r;return function(){var i=Rl(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function zl(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=Rl(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===e){i[l]=s;break}l===u&&i.push(s)}o.tween=i}}function Pl(t,e,n){var r=t._id;return t.each((function(){var t=Rl(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return jl(t,r).value[e]}}function $l(t,e){var n;return("number"==typeof e?ol:e instanceof Ns?il:(n=Ns(e))?(e=n,il):ll)(t,e)}function ql(t){return function(){this.removeAttribute(t)}}function Vl(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yl(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Wl(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function Gl(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Zl(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Xl(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Jl(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Kl(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Jl(t,i)),n}return i._value=e,i}function Ql(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Xl(t,i)),n}return i._value=e,i}function tu(t,e){return function(){Hl(this,t).delay=+e.apply(this,arguments)}}function eu(t,e){return e=+e,function(){Hl(this,t).delay=e}}function nu(t,e){return function(){Rl(this,t).duration=+e.apply(this,arguments)}}function ru(t,e){return e=+e,function(){Rl(this,t).duration=e}}function iu(t,e){if("function"!=typeof e)throw new Error;return function(){Rl(this,t).ease=e}}function ou(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Hl:Rl;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var au=Ct.prototype.constructor;function su(t){return function(){this.style.removeProperty(t)}}function lu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function uu(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&lu(t,o,n)),r}return o._value=e,o}function cu(t){return function(e){this.textContent=t.call(this,e)}}function du(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&cu(r)),e}return r._value=t,r}var pu=0;function fu(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function hu(){return++pu}var mu=Ct.prototype;fu.prototype={constructor:fu,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=f(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,u=r[a],c=u.length,d=o[a]=new Array(c),p=0;p<c;++p)(s=u[p])&&(l=t.call(s,s.__data__,p,u))&&("__data__"in s&&(l.__data__=s.__data__),d[p]=l,Bl(d[p],e,n,p,d,jl(s,n)));return new fu(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=g(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,u=r[s],c=u.length,d=0;d<c;++d)if(l=u[d]){for(var p,f=t.call(l,l.__data__,d,u),h=jl(l,n),m=0,v=f.length;m<v;++m)(p=f[m])&&Bl(p,e,n,m,f,h);o.push(f),a.push(l)}return new fu(o,a,e,n)},selectChild:mu.selectChild,selectChildren:mu.selectChildren,filter:function(t){"function"!=typeof t&&(t=v(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new fu(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,u=e[s],c=n[s],d=u.length,p=a[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<r;++s)a[s]=e[s];return new fu(a,this._parents,this._name,this._id)},selection:function(){return new au(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=hu(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,u=0;u<l;++u)if(a=s[u]){var c=jl(a,e);Bl(a,t,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new fu(r,this._parents,t,n)},call:mu.call,nodes:mu.nodes,node:mu.node,size:mu.size,empty:mu.empty,each:mu.each,on:function(t,e){var n=this._id;return arguments.length<2?jl(this.node(),n).on.on(t):this.each(ou(n,t,e))},attr:function(t,e){var n=l(t),r="transform"===n?vl:$l;return this.attrTween(t,"function"==typeof e?(n.local?Zl:Gl)(n,r,Pl(this,"attr."+t,e)):null==e?(n.local?Vl:ql)(n):(n.local?Wl:Yl)(n,r,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 r=l(t);return this.tween(n,(r.local?Kl:Ql)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?gl:$l;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=I(this,t),a=(this.style.removeProperty(t),I(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,su(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=I(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=I(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Pl(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=Rl(this,t),u=l.on,c=null==l.value[a]?o||(o=su(e)):void 0;u===n&&i===c||(r=(n=u).copy()).on(s,i=c),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=I(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,uu(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}}(Pl(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,du(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=jl(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Il:zl)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?tu:eu)(e,t)):jl(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?nu:ru)(e,t)):jl(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(iu(e,t)):jl(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Rl(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var s={value:a},l={value:function(){0==--i&&o()}};n.each((function(){var n=Rl(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:mu[Symbol.iterator]};var gu,vu,yu={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function bu(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function _u(t){var e;if(gu=At(".detailed-settings"),(vu=gu.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){gu.transition().duration(100).style("opacity",0).on("end",(function(){At(this).html("").style("display","none"),At(".template-settings").style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),At(".template-settings-search").style("display",null).style("opacity",0).transition().duration(200).style("opacity",1)})),gu.node()})),"string"==typeof t)e=vu.append("div").html(t);else if("object"==typeof t&&(e=vu.append(t.type),t.value&&(vu.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),At(".template-settings-search").style("display","none"),At(".template-settings").style("display","none"),gu.style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),gu.node()}Ct.prototype.interrupt=function(t){return this.each((function(){!function(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>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Ct.prototype.transition=function(t){var e,n;t instanceof fu?(e=t._id,t=t._name):(e=hu(),(n=yu).time=El(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,u=0;u<l;++u)(a=s[u])&&Bl(a,t,e,u,s,n||bu(a,e));return new fu(r,this._parents,t,e)};var wu,xu,Cu,Au,ku={},Eu={},Tu={Flourish:{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#007d8e","#1aa7ee","#29dae4","#88e99a","#019c00","#c11f1f","#730000"]},"Flourish Alternate":{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#88e99a","#29dae4","#1aa7ee","#019c00","#007d8e","#c11f1f","#730000"]},"Flourish High Fire":{colors:["#730000","#c11f1f","#9654e5","#ff6283","#ff8800","#ffc502"]},"Flourish Low Fire":{colors:["#4328e7","#007d8e","#019c00","#1aa7ee","#29dae4","#88e99a"]},"Flourish Uranium":{colors:["#c11f1f","#ff8800","#ffc502"]},"Flourish Erbium":{colors:["#730000","#9654e5","#ff6283"]},"Flourish Barium":{colors:["#4328e7","#1aa7ee","#29dae4"]},"Flourish Chromium":{colors:["#007d8e","#019c00","#88e99a"]},"Flourish Pale":{colors:["#e667b1","#a193f3","#eb8484","#4bedf3","#d6a4e9","#48ffa7","#ffb1c1","#8cd3f7","#f6c992","#94ecf1","#ffe281","#c4f4cd"]},"Flourish Deep":{colors:["#430b2b","#1d0e7a","#611010","#04393b","#5a1c72","#004826","#b10025","#09557b","#0f7277","#816300","#1d9c34"]},"Flourish Mono":{colors:["#000000","#6a6a6a","#959595","#dddddd"]},"Flourish Legacy":{scheme:"flourish_default_1",colors:["#1D6996","#EDAD08","#73AF48","#94346E","#38A6A5","#E17C05","#5F4690","#0F8554","#6F4070","#CC503E","#994E95","#666666"]},"Flourish Legacy Alternate":{scheme:"flourish_default_2",colors:["#11A579","#CC503E","#3969AC","#F2B701","#7F3C8D","#80BA5A","#E68310","#CF1C90","#008695","#F97B72","#4B4B8F","#A5AA99"]},Rainbow:{colors:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"]},Pastel:{colors:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"]},Antique:{colors:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"]},Accent:{scheme:"schemeAccent",colors:Js},Dark:{scheme:"schemeDark2",colors:Ks},Paired:{scheme:"schemePaired",colors:Qs},Pale:{scheme:"schemePastel1",colors:tl},"Farrow & Ball":{colors:["#EDD8C4","#C4A999","#F9C1C0","#B76A4C","#8F483C","#783027","#8A1D2E","#602A1F","#893838","#BD795A","#DC6130","#AD3B34","#ECE8BD","#F7E28A","#EBEB82","#FAD862","#F1CA61","#F5C03B","#F9E7D4","#F4E4AC","#EFD491","#DAC589","#D2B15E","#CD9344","#EFEFCC","#E8E7CA","#CAD5AD","#B9B495","#73806F","#636F65","#BDAB65","#889A73","#829C7A","#6C7855","#81B693","#BBBEA0","#99A286","#AAC0B3","#427E7F","#769194","#ECF3EC","#EBEBD4","#D0D9C9","#9EAF9F","#7A8E8D","#516365","#DBE5DC","#C4C9C5","#CBD7D7","#AABEBF","#66839A","#A0D2CD","#56AAC5","#535E7D","#2E3548","#48606E","#2C3437"]}},Lu={};function Du(){var t,e={};for(t in Lu)e[t]=Lu[t];for(t in Tu)e[t]=Tu[t];return e}var Fu="Edit color palette";function Su(t){t&&t.length?(Lu={},t.forEach((function(t){var e=Object.keys(t)[0];Lu[e]={colors:t[e]}}))):Lu={},function(){for(var t in ku){ku[t].setOptions(Nu())}}()}function Mu(){if(void 0!==wu)return wu;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),wu="color"==t.type&&"!"!==t.value}function Nu(){var t=[],e=Du();for(var n in t.push([Fu,""]),e)t.push([n,e[n].colors.join("|")]);return t}function Uu(t,e){var n=t[0],r=t[1];if(!r){const t=kt("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(Fu),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=kt("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=kt("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function Ou(t,e){var n,r,i=Du(),o=t.parentNode.querySelector(".color-swatches");if(Array.isArray(e))r=e;else if("string"==typeof e){if(i[e])n=e;else for(var a in i)if(i[a].scheme==e){n=a;break}n&&(r=i[n].colors)}if(!r||!r.length)return t.parentNode.classList.remove("custom"),t.removeAttribute("data-value"),t.value="",void(o.innerHTML="");o.innerHTML="",o.append(...Uu([null,r])),t.setAttribute("data-value",r.join("|"))}function Bu(t){Au=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",At(Au).classed("dragging",!0),Et(".palette p:not(.dragging) input").style("pointer-events","none")}function Hu(t){t.preventDefault();var e=At(".palette").selectAll("[draggable='true']").style("border-color",null),n=At(t.target);if("true"===n.attr("draggable")){var r="bottom";if(n.node()===e.nodes()[0]){var i=t.target.getBoundingClientRect(),o=i.top+i.height/2;t.clientY<o&&(r="top")}At(t.target).style("border-"+r,"1px solid black")}}function Ru(t){if(Au){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===At(".palette").selectAll("[draggable='true']").style("border-color",null).nodes()[0]){var r=e.getBoundingClientRect(),i=r.top+r.height/2;t.clientY<i&&(n=e)}e.parentNode.insertBefore(Au,n),Au=!1,zu()}}}function ju(){At(Au).classed("dragging",!1),Et(".palette *").style("border-bottom",null).style("border-top",null),Et(".palette p input").style("pointer-events",null)}function Iu(t){for(var e=t.target;e&&"BUTTON"!==e.tagName;)e=e.parentNode;e&&(e.classList.contains("fa-plus-square")?function(t){var e=t.target.parentNode,n=Pu("#000000");e.insertAdjacentHTML("beforebegin",n),zu()}(t):e.classList.contains("fa-times")&&function(t){t.parentNode.childNodes.length>2?t.parentNode.removeChild(t):("INPUT"==t.firstChild.tagName?t.firstChild.value="#000000":t.firstChild.style.backgroundColor="#000000",t.firstChild.nextSibling.value="#000000");zu()}(e.parentNode))}function zu(){for(var t=Cu.getAttribute("data-autocomplete"),e=ku[t],n=[],r=xu.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var o=e.getOptions();Eu[t]?o[0][1]=n.join("|"):o.unshift(["Custom",n.join("|")]),Eu[t]=n,e.setOptions(o),Ou(Cu,n),At(Cu).dispatch("change")}function Pu(t){const e=kt("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),Mu()?e.append("input").attr("type","color").attr("value",t):e.append("span").classed("swatch-color",!0).style("background-color",t),e.append("input").attr("type","text").attr("value",t),e.append("button").attr("type","button").classed("fa fa-times",!0),e.node().outerHTML}function $u(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void zu();var i=Ns(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:Mu()?e.value=e.previousSibling.value:e.value=e.previousSibling.style.backgroundColor,void(Re.point(e).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.type?e.nextSibling.value=n:Mu()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,zu()}var qu,Vu,Yu={initialize:function(t,e){e.choices&&Su(e.choices),t.type="text",t.classList.add("colors");var n=document.createElement("span");n.setAttribute("class","color-swatches"),t.parentNode.insertBefore(n,t);var r=t.getAttribute("name")+"-dropdown";ku[r]=new Zi({input:t,id:r,mode:"single",options:Nu(),options_config:{custom_renderer:Uu}}),t.addEventListener("change",(function(e){t.value==Fu?(e.stopImmediatePropagation(),t.value="",function(t){Cu=t;var e=(xu=_u({type:"div",attributes:{class:"palette"}})).querySelector(".palette"),n=function(t,e){e||(e=t.parentNode.querySelector(".color-swatches"));for(var n=[],r=0;r<e.childNodes.length;r++)if(!e.childNodes[r].classList.contains("fa")){var i=e.childNodes[r].style.backgroundColor,o=Ns(i);o?n.push(o.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=Pu(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",$u),e.addEventListener("dragstart",Bu),e.addEventListener("dragover",Hu),e.addEventListener("drop",Ru),e.addEventListener("dragend",ju),e.addEventListener("click",Iu)}(t)):Ou(t,(t.getAttribute("data-value")||"").split("|"))}))},update:Ou,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:Su},Wu={};const Gu={style:!0,url:!0,flourish_embed:!0};var Zu={h1:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.91 7.453V9H14.162V7.453H12.615V0.744995H11.211C10.9163 0.918329 10.613 1.06566 10.301 1.187C9.989 1.30833 9.60767 1.41233 9.157 1.499V2.682H10.704V7.453H8.91Z",width:14,height:9},h2:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.24078 7.908V9H14.0518V7.388H12.3878C12.1884 7.388 11.9588 7.401 11.6988 7.427C11.4474 7.44434 11.2178 7.466 11.0098 7.492C11.3478 7.14534 11.6728 6.79434 11.9848 6.439C12.3054 6.07501 12.5871 5.71534 12.8298 5.36C13.0811 4.996 13.2804 4.63634 13.4278 4.281C13.5751 3.917 13.6488 3.56167 13.6488 3.215C13.6488 2.81634 13.5838 2.45667 13.4538 2.136C13.3238 1.81534 13.1374 1.54234 12.8948 1.317C12.6521 1.083 12.3618 0.905338 12.0238 0.784004C11.6944 0.654004 11.3261 0.589005 10.9188 0.589005C10.3294 0.589005 9.82245 0.701671 9.39778 0.927004C8.97311 1.14367 8.55711 1.46867 8.14978 1.902L9.18978 2.929C9.39778 2.70367 9.61878 2.50867 9.85278 2.344C10.0868 2.17067 10.3554 2.084 10.6588 2.084C11.0228 2.084 11.3088 2.19234 11.5168 2.409C11.7248 2.617 11.8288 2.92467 11.8288 3.332C11.8288 3.62667 11.7378 3.93867 11.5558 4.268C11.3824 4.58867 11.1354 4.93967 10.8148 5.321C10.5028 5.69367 10.1258 6.09667 9.68378 6.53C9.25045 6.95467 8.76945 7.414 8.24078 7.908Z",width:15,height:9},bold:{path:"M0.00100708 9V0.524002H2.90001C3.34201 0.524002 3.74934 0.558669 4.12201 0.628002C4.50334 0.688669 4.83267 0.801335 5.11001 0.966002C5.39601 1.13067 5.61701 1.34734 5.77301 1.616C5.93767 1.88467 6.02001 2.22267 6.02001 2.63C6.02001 2.82067 5.99401 3.01134 5.94201 3.202C5.89001 3.39267 5.81634 3.57034 5.72101 3.735C5.62567 3.89967 5.50867 4.047 5.37001 4.177C5.24001 4.307 5.08834 4.40234 4.91501 4.463V4.515C5.13167 4.567 5.33101 4.64934 5.51301 4.762C5.69501 4.866 5.85534 5.00034 5.99401 5.165C6.13267 5.32967 6.24101 5.52467 6.31901 5.75C6.39701 5.96667 6.43601 6.218 6.43601 6.504C6.43601 6.93734 6.34934 7.31 6.17601 7.622C6.01134 7.934 5.77734 8.194 5.47401 8.402C5.17934 8.60134 4.83267 8.753 4.43401 8.857C4.03534 8.95234 3.60634 9 3.14701 9H0.00100708ZM1.91201 3.917H2.80901C3.27701 3.917 3.61501 3.826 3.82301 3.644C4.03967 3.462 4.14801 3.21934 4.14801 2.916C4.14801 2.58667 4.03967 2.35267 3.82301 2.214C3.60634 2.07534 3.27267 2.006 2.82201 2.006H1.91201V3.917ZM1.91201 7.518H2.99101C4.03967 7.518 4.56401 7.13667 4.56401 6.374C4.56401 6.00134 4.43401 5.737 4.17401 5.581C3.91401 5.41634 3.51967 5.334 2.99101 5.334H1.91201V7.518Z",width:7,height:9},italic:{path:"M7 1.44444H5.06656L3.6687 8.05556H5.5V9H0.5V8.05556H2.6547L4.05256 1.44444H2V0.5H7V1.44444Z",width:7,height:9},line_break:{description:"Add line break",path:"M14 0V6H3.83L6.41 3.41L5 2L0 7L5 12L6.41 10.59L3.83 8H16V0H14Z",width:16,height:12},url:{description:"Add URL",path:"M8.03571429,6.69642857 C8.03571429,6.5476183 7.98363147,6.42113147 7.87946429,6.31696429 L6.71875,5.15625 C6.61458281,5.05208281 6.48809598,5 6.33928571,5 C6.18303493,5 6.0491077,5.05952321 5.9375,5.17857143 L6.16350446,5.40178571 L6.16350446,5.40178571 L6.21434766,5.4637896 C6.22447497,5.4770171 6.23542901,5.49169139 6.24720982,5.5078125 C6.28255226,5.55617584 6.30673357,5.6036084 6.31975446,5.65011161 C6.33277536,5.69661482 6.33928571,5.74776758 6.33928571,5.80357143 C6.33928571,5.9523817 6.2872029,6.07886853 6.18303571,6.18303571 C6.07886853,6.2872029 5.9523817,6.33928571 5.80357143,6.33928571 C5.74776758,6.33928571 5.69661482,6.33277536 5.65011161,6.31975446 C5.6036084,6.30673357 5.55617584,6.28255226 5.5078125,6.24720982 L5.42844742,6.18644594 L5.42844742,6.18644594 L5.37357392,6.13653276 L5.37357392,6.13653276 L5.17857143,5.9375 L5.17857143,5.9375 C5.05580296,6.05282796 4.99441964,6.18861529 4.99441964,6.34486607 C4.99441964,6.49367634 5.04650246,6.62016317 5.15066964,6.72433036 L6.30022321,7.87946429 C6.40067015,7.97991122 6.52715698,8.03013393 6.6796875,8.03013393 C6.82849777,8.03013393 6.9549846,7.98177132 7.05915179,7.88504464 L7.87946429,7.0703125 C7.98363147,6.96614531 8.03571429,6.84151858 8.03571429,6.69642857 Z M4.11272321,2.76227679 C4.11272321,2.61346652 4.0606404,2.48697969 3.95647321,2.3828125 L2.80691964,1.22767857 C2.70275246,1.12351138 2.57626562,1.07142857 2.42745536,1.07142857 C2.28236535,1.07142857 2.15587852,1.12165128 2.04799107,1.22209821 L1.22767857,2.03683036 C1.12351138,2.14099754 1.07142857,2.26562427 1.07142857,2.41071429 C1.07142857,2.55952455 1.12351138,2.68601138 1.22767857,2.79017857 L2.38839286,3.95089286 C2.48883979,4.05133979 2.61532662,4.1015625 2.76785714,4.1015625 C2.92410792,4.1015625 3.05803516,4.04389939 3.16964286,3.92857143 L2.94363839,3.70535714 L2.94363839,3.70535714 L2.85993304,3.59933036 L2.85993304,3.59933036 C2.8245906,3.55096702 2.80040929,3.50353446 2.78738839,3.45703125 C2.77436749,3.41052804 2.76785714,3.35937528 2.76785714,3.30357143 C2.76785714,3.15476116 2.81993996,3.02827433 2.92410714,2.92410714 C3.02827433,2.81993996 3.15476116,2.76785714 3.30357143,2.76785714 C3.35937528,2.76785714 3.41052804,2.77436749 3.45703125,2.78738839 C3.50353446,2.80040929 3.55096702,2.8245906 3.59933036,2.85993304 L3.70535714,2.94363839 L3.70535714,2.94363839 L3.92857143,3.16964286 L3.92857143,3.16964286 C4.0513399,3.0543149 4.11272321,2.91852757 4.11272321,2.76227679 Z M8.63839286,5.55803571 C8.95089442,5.87053728 9.10714286,6.24999777 9.10714286,6.69642857 C9.10714286,7.14285938 8.94903432,7.52045977 8.6328125,7.82924107 L7.8125,8.64397321 C7.50371869,8.95275452 7.1261183,9.10714286 6.6796875,9.10714286 C6.22953644,9.10714286 5.85007595,8.94903432 5.54129464,8.6328125 L4.39174107,7.47767857 C4.08295977,7.16889727 3.92857143,6.79129688 3.92857143,6.34486607 C3.92857143,5.8872745 4.09226027,5.4985135 4.41964286,5.17857143 L3.92857143,4.6875 C3.60862935,5.01488259 3.22172846,5.17857143 2.76785714,5.17857143 C2.32142634,5.17857143 1.94196585,5.02232299 1.62946429,4.70982143 L0.46875,3.54910714 C0.156248437,3.23660558 -8.52651283e-14,2.85714509 -8.52651283e-14,2.41071429 C-8.52651283e-14,1.96428348 0.158108538,1.58668309 0.474330357,1.27790179 L1.29464286,0.463169643 C1.60342416,0.154388337 1.98102455,1.42108547e-14 2.42745536,1.42108547e-14 C2.87760642,1.42108547e-14 3.25706691,0.158108538 3.56584821,0.474330357 L4.71540179,1.62946429 C5.02418309,1.93824559 5.17857143,2.31584598 5.17857143,2.76227679 C5.17857143,3.21986836 5.01488259,3.60862935 4.6875,3.92857143 L5.17857143,4.41964286 C5.4985135,4.09226027 5.8854144,3.92857143 6.33928571,3.92857143 C6.78571652,3.92857143 7.16517701,4.08481987 7.47767857,4.39732143 L8.63839286,5.55803571 Z",width:9.5,height:9.5},flourish_embed:{description:"Add Flourish embed",path:"M7.57358 5.28931L10.1281 6.04854L10.0432 6.517L7.37515 6.22624L9.44904 7.9224L9.20119 8.29833L6.86556 7.0207L8.11097 9.37696L7.7504 9.62552L6.06604 7.5604L6.34206 10.2078L5.89578 10.2926L5.11055 7.73772L4.36044 10.2926L3.89331 10.2078L4.16934 7.5604L2.50622 9.62552L2.12402 9.37696L3.38372 7.0207L1.04113 8.29833L0.793673 7.9224L2.88146 6.22624L0.213045 6.517L0.128113 6.04854L2.6479 5.28931L0.128113 4.53667L0.213045 4.06859L2.88146 4.35974L0.793673 2.66319L1.04113 2.28687L3.38372 3.56451L2.12402 1.20824L2.50622 0.960069L4.16934 3.02519L3.89331 0.377778L4.36044 0.292603L5.11055 2.84787L5.89578 0.292603L6.34206 0.377778L6.06604 3.02519L7.7504 0.960069L8.11097 1.20824L6.86556 3.56451L9.20119 2.28687L9.44904 2.66319L7.37515 4.35974L10.0432 4.06859L10.1281 4.53667L7.57358 5.28931Z",width:10,height:10}};function Xu(t,e){Wu=e||Gu;var n=At(Vu=_u({type:"div",attributes:{class:"text-editor-container settings-option"}})).select(".text-editor-container").html("");for(var r in n.append("div").attr("class","text-settings"),n.append("textarea").text(t.value).attr("class","text-input").on("blur",(function(){t.value=this.value,At(t).dispatch("change")})),Wu)Wu[r]&&Ju(r);(Wu.bindings||Wu.bindings_custom)&&(n.append("div").attr("class","text-bindings"),Ku()),Ve()}function Ju(t){if("bindings"!=t&&"bindings_custom"!=t){var e=At(Vu).select(".text-settings").append("div").attr("class","editor-section");if("style"==t){["h1","h2","bold","italic","line_break"].forEach((function(t){var n=Zu[t].description?Zu[t].description:"Add "+t+" text";e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",Qu).append("svg").attr("height",Zu[t].height).attr("width",Zu[t].width).attr("viewBox","0 0 "+Zu[t].width+" "+Zu[t].height).append("path").attr("fill","#333333").attr("d",Zu[t].path)}))}else{var n=Zu[t].description?Zu[t].description:"Add "+t;e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",Qu).append("svg").attr("height",Zu[t].height).attr("width",Zu[t].width).attr("viewBox","0 0 "+Zu[t].width+" "+Zu[t].height).append("path").attr("fill","#333333").attr("d",Zu[t].path)}}}function Ku(){if(Wu.bindings||Wu.bindings_custom){var t;if(Array.isArray(Wu.bindings))t={},Wu.bindings.forEach((function(e){var n=e.split("."),r=n[0],i=n.length>1?n[1]:null;i&&(t[r]||(t[r]=[]),t[r].push(i))}));else if(!0===Wu.bindings)t=null;else if(!Array.isArray(Wu.bindings_custom))return;var e=qu.visualisation.data_bindings[qu.visualisation.template_id],n={},r=[];qu.visualisation.data_tables.forEach((function(t){n[t.id]=t.cached_data[0]}));var i=null!==t;for(var o in e)if(!i||t[o]){var a=e[o];for(var s in a)if(!i||t[o].includes(s)){var l=a[s];if(null!=l.column){var u=n[l.data_table_id][l.column];u&&!r.includes(u)&&r.push(u)}else l.columns&&l.columns.forEach((function(t){var e=n[l.data_table_id][t];e&&!r.includes(e)&&r.push(e)}))}}Wu.bindings_custom&&Array.isArray(Wu.bindings_custom)&&Wu.bindings_custom.forEach((function(t){t[0]&&t[1]&&r.push({name:t[0],binding:t[1],type:"dynamic"})})),At(".text-bindings").html("").style("display",r.length?null:"none").append("p").text("Click to add values from your data"),At(".text-bindings").selectAll("button.binding").data(r).enter().append("button").attr("data-action","binding").attr("data-binding",(function(t){return"object"==typeof t?t.binding:t})).attr("data-type",(function(t){return"object"==typeof t?t.type:null})).on("click",Qu).text((function(t){return"object"==typeof t?t.name:t}))}}function Qu(){var t,e=At(".text-editor-container .text-input"),n=e.node().value,r=e.node().selectionStart,i=e.node().selectionEnd,o=i-r,a=n.substr(r,o),s=At(this).attr("data-action"),l="flourish_embed"==s?prompt("Specify the ID of published Flourish project (eg. story/123 or visualisation/124)","visualisation/"):"";if("bold"==s)t=tc(a,"<b>","</b>");else if("italic"==s)t=tc(a,"<i>","</i>");else if("h1"==s)t=tc(a,"<h1>","</h1>");else if("h2"==s)t=tc(a,"<h2>","</h2>");else if("line_break"==s)t=tc(a,"<br>","");else if("url"==s)t=tc(a,'<a href ="">',"</a>",10);else if("flourish_embed"==s)t=tc(l,'<iframe src="https://flo.uri.sh/','/embed" frameborder="0" scrolling="no" style="width:100%;height:400px;"></iframe>');else if("binding"==s){var u=At(this).attr("data-binding");t=tc(u,"{{","}}",u.length+4)}e.node().setRangeText(t.text,r,i),e.node().focus(),e.node().selectionStart=r+t.cursor,e.node().selectionEnd=r+t.cursor}function tc(t,e,n,r){return e=e||"",n=n||"",t=t||"",{cursor:r||e.length+t.length,text:e+t+n}}var ec,nc,rc,ic={initialize:function(t,e,n){qu=t,At(e.parentElement).append("div").attr("class","text-editor-btn").attr("tabindex","0").on("click",(function(){Xu(e,n.editor)})).on("keydown",(function(t){13==t.keyCode&&Xu(e,n.editor)})).append("i").attr("class","fa fa-paint-brush")},updateDataBindings:Ku},oc=void 0,ac=/fa-(\S*)/g,sc=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/,lc=/^gradient:/g;function uc(t){var e=!At(t.parentNode).classed("open");Et(".template-settings .settings-block").classed("open",!1).attr("aria-expanded",!1),e&&At(t.parentNode).classed("open",!0).attr("aria-expanded",!0)}function cc(t){if(t){oc={};for(var e=0,n=null,r=null,i=ec&&ec.user?ec.user.template_settings_overrides:{},o=0;o<t.length;o++){var a=t[o];if("string"!=typeof a){if("object"!=typeof a||n||r||(e++,r=rc.append("div").attr("class","toplevel-settings-block")),"hidden"!==a.type){var s=n||r;if(a.new_section&&(s.append("div").classed("settings-divider",!0),"string"==typeof a.new_section&&s.append("h3").classed("settings-subhead",!0).text(a.new_section)),void 0!==a.show_if){if(a.show_condition)throw new Error("BUG: show_if present as well as show_condition");a.show_condition=[{type:"show",condition:a.show_if}],delete a.show_if}else if(void 0!==a.hide_if){if(a.show_condition)throw new Error("BUG: hide_if present as well as show_condition");a.show_condition=[{type:"hide",condition:a.hide_if}],delete a.hide_if}oc[a.property]=a.type,dc(s.append("div"),a,i)}}else r=null,(n=rc.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(a).on("click",(function(){uc(this)})).on("keyup",(function(t){13===t.keyCode&&uc(this)})),n.classed("open",e<1),n.attr("aria-expanded",e<1),"State documentation"===a&&n.style("display","none"),e++}Et(".upgrade-setting").on("click",(function(){!function(t,e,n,r){var i=[],o=[];i.push(["Upgrade to a premium account to get:"]),o.push(["<strong>Branding control:</strong> Add custom logos, colors, and styles to keep your projects consistent with your brand identity","<strong>Logo removal:</strong> Embed your projects without the Flourish logo appended","<strong>Team management:</strong> Seamlessly manage your team with our collaboration and approval features"]);var a=Math.floor(Math.random()*i.length),s=Math.floor(Math.random()*o.length),l="title"+a+"-list"+s,u=[{text:"Upgrade now",class:"convert",tag_name:"a",href:"https://flourish.studio/pricing",target:"_blank",keyCode:13,callback:function(){t.analytics("event","upgrade-click",{upgrade_id:l}),fs.logHistory({category:"upgrade",action:"clicked",detail:r})}},{text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("event","upgrade-close",{upgrade_id:l}),fs.logHistory({category:"upgrade",action:"closed",detail:r})}}];t.analytics("event","upgrade-open",{upgrade_id:l}),fs.logHistory({category:"upgrade",action:"viewed",detail:r}),Wi(e,n,{buttons:u,is_html:!0,upgrade:{message:i[a],list:o[s],is_business:!0}})}(ec,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings")})),Ve()}}function dc(t,e,n){e.upgrade=e.property in n;var r="html"==e.type,i=e.choices&&("buttons"==e.style||"boolean"==e.type);t.attr("class","settings-option option-type-"+e.type+(i?" settings-buttons":"")+(r?" text-editor":"")+(e.upgrade?" upgrade-setting":""));var o=t.append("label").attr("for","setting-"+e.property).classed("hidden",null==e.name).append("h3").text(e.name).classed("no-select",!0);(e.upgrade||e.description)&&o.append("i").style("font-family","FontAwesome").classed("fa setting-tooltip popup",!0).classed("fa-star tooltip-upgrade",e.upgrade).classed("fa-question tooltip-help",!e.upgrade).style("background-color",e.upgrade?"#93366e":null).attr("tabindex","0").attr("data-popup-head",e.upgrade?"This is a premium feature":null).attr("data-popup-body",e.description?e.description.replace(/\[\[/g,"").replace(/\]\]/g,""):null).attr("data-popup-allow-interaction",!0).attr("data-popup-constrainer",".settings-block"),e.width&&t.classed("width-"+e.width.replace(/ /g,"-"),!0);var a="input";if(["text","code","html"].includes(e.type)&&(a="textarea"),"code"==e.type){var s=!1;t.append("i").attr("class","popup fa fa-reply clickable wrap-control").attr("data-popup-body","Wrap/unwrap text").attr("data-popup-position","top").on("click",(function(){s=!s,At(this.parentNode).select("textarea").attr("wrap",s?null:"off"),At(this).classed("selected",s)}))}var l=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!ec.visualisation.can_edit||null),u=l.node();if("colors"==e.type)Yu.initialize(u,e);else if("font"==e.type)Ya.initialize(u,e,ec.user&&null!=ec.user.company_id);else if("number"==e.type)u.setAttribute("type","number"),null!=e.min&&u.setAttribute("min",e.min),null!=e.max&&u.setAttribute("max",e.max),e.step&&u.setAttribute("step",e.step);else if("url"==e.type)u.setAttribute("type","url"),nc.addButton(u,e.upgrade);else if(i){l.remove(),l=t.append("div").attr("id","setting-"+e.property).attr("name",e.property).classed("buttons-container",!0).classed("large","large"==e.size),u=l.node();var c=e.choices.length,d=[3,4,5],p=function(){if(c<=2)return{column_count:c,rows:1};var t=d.map((function(t){return{column_count:t,orphans:c%t/t,rows:c/t}})).filter((function(t){return t.rows>=1})).sort((function(t,e){return t.rows>e.rows?1:t.rows<e.rows?-1:0})),e=t.filter((function(t){return 0===t.orphans}));return 1===e.length||e.length>1?e[0]:0===e.length?t.sort((function(t,e){return t.orphans>e.orphans?-1:t.orphans<e.orphans?1:0}))[0]:void 0}();e.choices.forEach((function(t,n){l.append("input").attr("type","radio").attr("name",e.property).attr("value",t[1]).attr("id",e.property+"_"+n).attr("class","setting").attr("disabled",!ec.visualisation.can_edit||null).call(pc(e)),mc(t,l.append("label").attr("for",e.property+"_"+n).style("width",100/p.column_count+"%").style("border-radius",(function(){var t=p.column_count,e=Math.ceil(p.rows),r=t*e-c;return e<=1?0===n?"3px 0 0 3px":n===t-1?"0 3px 3px 0":null:e>1?0===n?"3px 0 0 0":n===t-1?"0 3px 0 0":n===c-(t-r)?"0 0 0 3px":n===c-1&&0===r?"0 0 3px 0":null:null})).node())}))}else"boolean"==e.type?(u.setAttribute("type","checkbox"),t.classed("slider-container",!0),t.append("label").attr("class","slider").attr("for","setting-"+e.property)):u.setAttribute("type","text");if("code"==e.type&&(u.setAttribute("wrap","off"),l.on("keydown.tab",(function(t){var e=t;if(9===e.keyCode&&!(e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)){e.preventDefault();var n=this.selectionStart;this.value=this.value.substring(0,n)+"\t"+this.value.substring(this.selectionEnd),this.selectionEnd=n+1}}))),r&&(t.append("div").attr("class","text-editor-setting").node().appendChild(u),ic.initialize(ec,u,e)),e.choices&&"string"==e.type&&"buttons"!=e.style&&(u._dropdown=new Zi({input:u,id:e.property+"-dropdown",options:e.choices,options_config:{allow_other_option:e.choices_other,custom_renderer:mc},mode:"single"})),"color"==e.type){At(u).classed("color",!0).style("display","none");var f=At(u.parentNode).append("div").attr("class","color-picker"),h=f.append("div").attr("class","color-wrapper");e.optional&&f.append("div").attr("class","cancel-setting popup").attr("tabindex","0").html("<svg><use xlink:href='#cancel-setting'></use></svg>").attr("data-popup-body","If cleared, the color will be set automatically based on the theme or context").on("click keydown",(function(t){t.keyCode&&13!==t.keyCode||(u.value="",l.dispatch("change"),At(this.parentNode).classed("is-null",!0))})),h.append("input").attr("type","color").on("change",(function(){u.value=this.value,l.dispatch("change"),At(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){At(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){At(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&u.setAttribute("placeholder",e.placeholder),e.size&&u.classList.add("size-"+e.size),l.call(pc(e))}function pc(t){return function(e){var n=!1;e.on("change",(function(){var e=this;Re.hide(),n=!0,ec.preview_pane.getState(t.property,(function(r,i){return r?(console.error("Failed to get state property "+t.property,r),void(n=!1)):function(t,e){if("number"!==e.type)return!0;if(""===t.value)return!!e.optional||(Re.point(t).text("A value is required").draw(),!1);var n=parseFloat(t.value);return e.hasOwnProperty("min")&&n<e.min?(Re.point(t).text("Value cannot be less than "+e.min).draw(),t.value=e.min):e.hasOwnProperty("max")&&n>e.max&&(Re.point(t).text("Value cannot be greater than "+e.max).draw(),t.value=e.max),!0}(e,t)?void function(t,e,n){r=e.property,i=100,o=gc,a=[t,e,n],clearTimeout(hs[r]),hs[r]=setTimeout((function(){o.apply(window,a),delete hs[r]}),i);var r,i,o,a}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&At(e).dispatch("blur"));var o="radio"==e.type?e.nextSibling:e;Re.point(o).text("Not changed: "+(r.message||r)).draw();var a={};a[t.property]=i,ec.preview_pane.setState(a,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);ec.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);hc(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){ec.confirm.blank(),13==t.keyCode&&Re.hide()})).on("blur",(function(){if(!n){var e=this;Re.hide(),ec.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):hc(e,r)}))}}))}}function fc(t,e,n){if(t.classList.contains("colors"))return Yu.getValue(t);if(t.classList.contains("font-menu")){var r=Ya.getValue(t);return e&&!r?n?null:"":r}if(t.classList.contains("buttons-container")){for(var i,o=t.querySelectorAll("input[type='radio']"),a=0;a<o.length;a++)if(o[a].checked){i=o[a];break}if(!i)return n?null:"";t=i}switch(t.getAttribute("type")){case"checkbox":return t.checked;case"number":return e&&!t.value.length?n?null:"":+t.value;case"radio":if(t.parentNode.parentNode.classList.contains("option-type-boolean"))return"true"==t.value;default:return e&&t.classList.contains("color")&&!t.value.length?n?null:"":t.hasAttribute("data-value")?t.getAttribute("data-value"):t.value}}function hc(t,e){if(t.classList.contains("colors"))Yu.update(t,e);else if(t.classList.contains("font-menu"))Ya.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,At(t.parentNode).select(".color-picker").classed("is-null",null===e),At(t.parentNode).select(".color-wrapper input").node().value=e;else if(t.getAttribute("data-autocomplete")){for(var n=function(t){for(var e=0;e<ec.settings.length;e++){var n=ec.settings[e];if(n.property===t)return n}}(t.name),r=0;r<n.choices.length;r++){var i,o,a=n.choices[r];if("string"==typeof a?i=o=a:(i=a[1],o=a[0]),e==i)return t.value=o,t.setAttribute("data-value",i),void(t._dropdown&&t._dropdown.setSelectedOptions(a))}t.value=e,t.setAttribute("data-value",e)}else if(t.className.indexOf("buttons-container")>-1){var s=t.querySelectorAll("input[type='radio']");for(r=0;r<s.length;r++)s[r].value===""+e&&(s[r].checked=!0)}else t.value=e}function mc(t,e){var n=At(e);if("string"!=typeof t){var r=t[2];if(r)if(r.match(ac))n.append("i").attr("class","fa "+r);else if(r.match(sc))n.append("img").attr("src",r);else if(r.match(lc)){var i=r.replace("gradient:","");n.append("div").attr("class","gradient-swatch").style("width","15px").style("height","15px").style("margin-right","5px").style("border-radius","15px").style("background","linear-gradient(to right, "+i+")")}var o=t[0];o.match(ac)?n.append("i").attr("class","fa "+o):o.match(sc)?n.append("img").attr("src",o):n.node().append(o)}else n.text(t)}function gc(t,e,n){var r={},i=fc(t,e.optional);if(r[e.property]=i,!("choices"in e)||"colors"===e.type||function(t,e){return!!t.choices_other||-1!==t.choices.map((function(t){return t instanceof Array?t[1]:t})).indexOf(e)}(e,i)){ec.confirm.saving();var o=!1,a={};a[e.property]=fc(t,e.optional,!0),ec.preview_pane.setState(a,(function(t){if(t)return s(t);ec.preview_pane.update((function(t){if(t)return s(t);ec.visualisation.updateSettings(r,(function(t){if(t)return s(t);ec.analytics("event","visualisation",{change_setting:ec.visualisation.id}),bc(),ec.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function s(r){o||(ec.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void ec.confirm.error(e);hc(t,i),bc(),ec.confirm.blank(),n&&n(r)})),o=!0)}}function vc(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");return ec.visualisation.__sdk__?function(t,e){if(t.length>=4)return;for(var n=null,r=ec.template_data_bindings,i=0;i<r.length;i++){var o=r[i];if("string"!=typeof o&&(o.dataset===t[1]&&o.key===t[2])){n=o;break}}if(!n)throw new Error("Bug: data binding not found - these should already have been checked");return"column"===n.type?!!n.column===e:!!n.columns.split("::")[1]===e}(n,e):function(t,e){if(t.length<4){return!!document.getElementById("data-binding-"+t[1]+"-"+t[2]).value===e}if("type"!==t[3])throw new Error("Fourth part of name must be “type”");var n=ec.visualisation.template_id,r=ec.visualisation.data_bindings[n][t[1]][t[2]];if(null==r)return!1;for(var i,o=ec.visualisation.data_tables,a=r.data_table_id,s=r.columns||[r.column],l=0;l<o.length;l++)if(o[l].id===a){i=o[l].column_types;break}var u=!1;for(l=0;l<s.length;l++){var c=i[s[l]].type_id.split("$")[0];if(u=-1!==(Array.isArray(e)?e:[e]).indexOf(c))break}return u}(n,e)}(t,e):function(t,e){var n=document.getElementById("setting-"+t);if(!n)return console.error("Could not find input for setting",t),!1;var r=fc(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function yc(t){if("boolean"==typeof t)return t;if("string"==typeof t)return vc(t,!0);if("object"==typeof t){for(var e in t)if(!vc(e,t[e]))return!1;return!0}}function bc(){ec.settings.filter((function(t){return"object"==typeof t&&"show_condition"in t})).forEach((function(t){var e=t.show_condition.every((function(t){var e="show"===t.type;let n=t.condition;Array.isArray(n)||(n=[n]);for(let t=0;t<n.length;t++){if(yc(n[t]))return e}return!e})),n=document.getElementById("setting-"+t.property);if(n){for(var r=n;!r.classList.contains("settings-option");)r=r.parentNode;if(At(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(At(i).classed("settings-divider")||At(i).classed("settings-subhead"));)At(i).classed("hidden",!e),i=i.previousSibling}else console.error("Could not find input",t.property)}));for(var t=document.querySelectorAll(".template-settings .settings-block, .template-settings .toplevel-settings-block"),e=0;e<t.length;e++){var n=t[e];n.classList.contains("hidden")?null!==n.querySelector(".settings-option:not(.hidden)")&&n.classList.remove("hidden"):null==n.querySelector(".settings-option:not(.hidden)")&&n.classList.add("hidden")}}function _c(t,e,n){return ec=t,nc={setup:Ta,addButton:La,startUpload:Fa},(rc=At(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),Yu.replaceThemeColors(e),Ya.replaceThemeFonts(n),cc(ec.settings),function(){function t(e,n){return!e||e.classList.contains("template-settings")?null:e.classList.contains(n)?e:t(e.parentNode,n)}function e(t){return t.replace(/ /g,"").replace(/-/g,"").toLowerCase().trim()}At(".side-panel .template-settings-search").on("input",(function(n){var r=e(n.target.value),i=!r,o=At(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden) h3, .settings-subhead:not(.hidden)");At(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden), .settings-subhead:not(.hidden), .settings-divider:not(.hidden)").classed("search-filtered-out",!i),i||o.filter((function(){var t=e(this.innerText);return!!t&&t.indexOf(r)>-1})).each((function(){var e=t(this,"settings-block"),n=At(this);if("H2"==this.tagName)e&&At(e).selectAll("h2, .settings-option, .settings-subhead, .settings-divider").classed("search-filtered-out",!1);else if("H3"==this.tagName)if(e&&At(e).select("h2").classed("search-filtered-out",!1),n.classed("settings-subhead")){n.classed("search-filtered-out",!1),this.previousSibling.classList.remove("search-filtered-out");for(var r=this.nextSibling;r&&r.classList.contains("settings-option");)r.classList.remove("search-filtered-out"),r=r.nextSibling}else{var i=t(this,"settings-option");if(i){i.classList.remove("search-filtered-out");for(var o=null,a=i.previousSibling;a&&null==o;)a.classList.contains("settings-subhead")?o=a:a=a.classList.contains("settings-divider")?null:a.previousSibling;o&&(o.classList.remove("search-filtered-out"),o.previousSibling.classList.remove("search-filtered-out"))}}}))}))}(),At(".side-panel-scrollbox").on("scroll",(function(){Re.hide()})),{update:function(t){rc.html(""),At(".current-template").style("opacity","1"),cc(ec.settings=t)},populate:function(){ec.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=qo(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&hc(i,n[r])}ic.updateDataBindings(),bc()}}))},getSettingsForCurrentTemplate:function(){return oc},setReadOnly:function(){Et(".setting").each((function(){At(this).attr("disabled",!0)}))},unsetReadOnly:function(){Et(".setting").each((function(){At(this).attr("disabled",null)}))}}}var wc,xc,Cc=!1,Ac=[];function kc(){At(".flourish-warn-list").classed("visible",!1),Cc=!1}function Ec(){return At(".flourish-warn-btn").on("click",(function(){Cc?kc():(At(".flourish-warn-list").classed("visible",!0),Cc=!0)})),{clear:Lc,warn:Dc}}function Tc(){At(".flourish-warn-container").classed("visible",Ac.length),Ac.length>100&&(Ac.length=100);var t=At(".flourish-warn-list ul").selectAll("li").data(Ac),e=t.enter().append("li");e.append("i").attr("class","fa fa-warning"),e.append("p").attr("class","message"),e.append("p").attr("class","explanation");var n=t.merge(e);n.select(".message").text((function(t){return t.message||""})),n.select(".explanation").text((function(t){return t.explanation||""})),t.exit().remove()}function Lc(){Ac=[],Tc(),kc()}function Dc(t){Ac.unshift(t),Tc()}function Fc(t){var e=wc.visualisation,n=e.getTemplate(),r=!1,i=!1,o=!1;function a(){var e=wc.template_settings.getSettingsForCurrentTemplate(),n=wc.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);xc.loadVisualisation(wc,r,(function(){wc.template_settings.populate(),wc.data_bindings.updateRequiredBindingsOverlay(!1),xa(),t&&t()})),St()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(wc.template_settings.update(e),r=!0,i&&o&&a())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(wc.data_bindings.update(e),i=!0,r&&o&&a())})),e.refreshDataBindings((function(t){t?console.error("Failed to get template data bindings: "+t):(o=!0,i&&r&&a())}))}function Sc(t){xc.updateData(wc.visualisation,t)}function Mc(t){xc.updateDataNotPreview(wc.visualisation,t)}function Nc(t){wc=t;var e=Ec();return{loadTemplate:Fc,updateData:Sc,updateDataNotPreview:Mc,sync:(xc=_a("iframe#preview","editor",wc,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(hc(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:xc.setState,getState:xc.getState,hasData:xc.hasData,setData:xc.setData,getData:xc.getData,draw:xc.draw,update:xc.update,getDefaultState:xc.getDefaultState,snapshot:xc.snapshot,setFixedHeight:xc.setFixedHeight,resize:xc.resize,getDrawCalled:xc.getDrawCalled,setDrawCalled:xc.setDrawCalled}}var Uc={},Oc={};function Bc(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Hc(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Rc(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function jc(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Rc(-t,6):t>9999?"+"+Rc(t,6):Rc(t,4)}(t.getUTCFullYear())+"-"+Rc(t.getUTCMonth()+1,2)+"-"+Rc(t.getUTCDate(),2)+(i?"T"+Rc(e,2)+":"+Rc(n,2)+":"+Rc(r,2)+"."+Rc(i,3)+"Z":r?"T"+Rc(e,2)+":"+Rc(n,2)+":"+Rc(r,2)+"Z":n||e?"T"+Rc(e,2)+":"+Rc(n,2)+"Z":"")}var Ic=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,u=!1;function c(){if(l)return Oc;if(u)return u=!1,Uc;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?u=!0:13===r&&(u=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))u=!0;else if(13===r)u=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Oc;){for(var d=[];r!==Uc&&r!==Oc;)d.push(r),r=c();e&&null==(d=e(d,s++))||i.push(d)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?jc(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Bc(t);return function(r,i){return e(n(r),i,t)}}(t,e):Bc(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Hc(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Hc(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),zc=Ic.parseRows,Pc=Ic.formatRows;function $c(t,e,n){is(this,"object"==typeof e?(n=e).id:e,void 0,n,{getVersionNumber:function(){return t.version_number},setVersionNumber:function(e){t.version_number=e}}),this.visualisation=t,this.api_prefix="/api/data_table"}function qc(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?qc(t):t}))}function Vc(t){this.id=t}function Yc(t,e,n,r=null){if(is(this,t,e,n),this.api_prefix="/api/visualisation",this.slide_id=r,this.data_tables){var i=this;this.data_tables=this.data_tables.map((function(t){return new $c(i,t)}))}}function Wc(t,e,n){us({url:t.api_prefix+"/"+t.id+"/data_bindings",method:"POST",payload:function(){return{version_number:t.version_number,data_bindings:e}},callback:function(r,i){if(r)return n(r);t.version_number=i.version_number,t.data_bindings||(t.data_bindings={}),t.template_id in t.data_bindings||(t.data_bindings[t.template_id]={});var o=t.data_bindings[t.template_id];for(var a in e)for(var s in e[a]){var l=e[a][s];o[a]||(o[a]={}),null===l?delete o[a][s]:o[a][s]=l}n(void 0)}})}function Gc(t,e,n){us({url:t.api_prefix+"/"+t.id+"/settings",payload:function(){return{version_number:t.version_number,settings:e}},callback:function(r,i){if(r)return n(r);t.version_number=i.version_number,t.settings||(t.settings={}),t.template_id in t.settings||(t.settings[t.template_id]={});var o=t.settings[t.template_id];for(var a in e){var s=e[a];o[a]=s}n(void 0)}})}function Zc(t,e,n,r){us({url:t.api_prefix+"/"+t.id+"/publish",payload:function(){return{password:n,anyone_can_duplicate:r}},callback:function(n,r){if(n)return e(n);t.version_number=r.version_number,t.embed_url=r.embed_url,t.showcase_url=r.showcase_url,t.is_password_protected=r.is_password_protected,t.anyone_can_duplicate=r.anyone_can_duplicate,e(void 0,r)}})}function Xc(t,e){for(var n in e)"object"!=typeof t[n]||null==t[n]||Array.isArray(t[n])||"object"!=typeof e[n]||null==e[n]||Array.isArray(e[n])?t[n]=e[n]:Xc(t[n],e[n])}function Jc(t,e,n,r){function i(){}this.visualisation=t,this.settings=e,this.template_data_bindings=n,this.public_url_prefix=r,this.is_read_only=!1,this.template_settings=_c(this),this.data_bindings=(Qi=this,to=At(".data-bindings"),{update:function(t){t&&(Qi.template_data_bindings=t),ao(Qi.visualisation,Qi.template_data_bindings)},modify:function(t,e=!1){lo(t,(function(){ao(Qi.visualisation,Qi.template_data_bindings),e&&Qi.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:po,updateRequiredBindingsOverlay:fo}),this.preview_pane=Nc(this),this.responsive_menu=Ft(this),this.confirm={on:i,blank:i,saved:i,saving:i,error:i},this.analytics=i,this.tour={fireEvent:i},window.addEventListener("hashchange",(()=>{this.loadFromUrlHash()}))}$c.prototype.getColumnTypes=function(t){us({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,qc(n.column_types||[]))}},"load-data")},$c.prototype.csv=function(t,e=null){this.cached_data?t(void 0,qc(this.cached_data)):this.csvPromise(e).then((e=>t(null,e)),(e=>t(e)))},$c.prototype.csvPromise=async function(t=null){if(this.cached_data)return qc(this.cached_data);const e=this;let n=this.api_prefix+"/"+this.id+"/csv";return t&&(n="/api/slide/"+t+"/data_table/"+this.id+"/csv"),new Promise(((t,r)=>{us({url:n,response_type:"text/csv; charset=utf-8",method:"GET",callback(n,i){if(n)return r(n);e.cached_data=zc(i),t(qc(e.cached_data))}},"load-data")}))},$c.prototype.saveData=function(t,e){var n=this,r=Ii(qc(t));us({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:Pc(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,e(void 0)}})},$c.prototype.updateFromUrl=function(t,e){var n=this;us({url:this.api_prefix+"/"+this.id+"/csv-url",payload:function(){return{live_csv_url:t,version_number:n.getVersionNumber()}},callback:function(r,i){if(r)return e(r);n.setVersionNumber(i.version_number),n.live_csv_url=t,t?n.updateFromLiveCsvUrl((function(t,r){if(t)return n.last_remote_data_error_message=t,e(t);var i=function(t){Ii(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];null==n&&(n=""),"string"!=typeof n&&(n=""+n),e[t]=n.trim()}return t}(zc(r.csv));n.cached_data=i,n.setVersionNumber(r.version_number),n.t_updated=r.t_updated,n.last_remote_data_error_message=null,e(void 0,i,r.new_column_types)})):(n.t_updated=i.t_updated,n.last_remote_data_error_message=null,e(void 0,null,null))}})},$c.prototype.updateFromLiveCsvUrl=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/update-from-live-csv-url",payload:function(){return{version_number:e.getVersionNumber()}},callback:function(n,r){if(n)return t(n);e.setVersionNumber(r.version_number),t(void 0,r)}})},$c.prototype.save=function(t,e){return ds(this,t,e)},$c.prototype.delete=function(t){return ps(this,t)},Vc.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;us({url:"/api/template/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r.settings,t(void 0,e.settings)}})}},Vc.prototype.getDataBindings=function(t){us({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},Yc.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),ds(this,t,e)},Yc.prototype.setTemplateId=function(t,e){ds(this,{template_id:t},e)},Yc.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new Vc(this.template_id)),this._template):null},Yc.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},Yc.prototype.getState=function(t){this.template_id||t({});var e=this.settingsForCurrentTemplate();this.getTemplate().getSettings((function(n,r){if(n)throw n;for(var i={},o=0;o<r.length;o++){var a=r[o];a.property in e&&(i[a.property]=e[a.property])}t(Vo(i))}))},Yc.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},Yc.prototype.refreshDataBindings=function(t){var e=this;let n=this.api_prefix+"/"+this.id;this.slide_id&&(n="/api/slide/"+this.slide_id+"/visualisation"),us({url:n+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},Yc.prototype.resetToTheme=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/reset_to_theme",method:"POST",payload:function(){return{version_number:e.version_number}},callback:function(n,r){if(n)return t(n);e.version_number=r.version_number,t(void 0)}})},Yc.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return Wc(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):Wc(n,t,e)}))},Yc.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return Gc(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):Gc(n,t,e)}))},Yc.prototype.refreshSettings=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},Yc.prototype.getThemeFontsAndColors=function(t){us({url:this.api_prefix+"/"+this.id+"/theme-fonts-and-colors",method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,n.fonts,n.colors)}})},Yc.prototype.getDataTables=function(t){let e=this.api_prefix+"/"+this.id;this.slide_id&&(e="/api/slide/"+this.slide_id+"/visualisation"),us({url:e+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},Yc.prototype.dataTables=function(t){var e=this;e.data_tables?t(void 0,e.data_tables):(e.after_loading_data_tables||(e.after_loading_data_tables=[]),e.after_loading_data_tables.push(t),e.after_loading_data_tables.length>1||e.getDataTables((function(t,n){if(t){for(var r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](t);e.after_loading_data_tables=[]}else{e.data_tables=n.map((function(t){return new $c(e,t)}));for(r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](void 0,e.data_tables);e.after_loading_data_tables=[]}})))},Yc.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},Yc.prototype.prepareData=function(t){var e=this;if(!e.data_bindings)throw new Error("No data bindings loaded");var n=e.template_id;e.dataTables((function(r,i){if(r)return t(r);if(e.template_id==n){for(var o={},a={},s=0,l=0;l<i.length;l++)!function(r){a[r.id]=r.column_types,r.csv((function(l,u){if(l)throw l;e.template_id==n&&(o[r.id]=u,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var i={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in i||(i[t.dataset]={}),i[t.dataset][t.key]=t)}));var s={},l=e.dataBindingsForCurrentTemplate();for(var u in l)s[u]=Ri(l[u],o,a,i[u]);for(u in i)s[u]||(s[u]=[],s[u].column_names={},s[u].metadata={});t(void 0,s)})))}),e.slide_id)}(i[l]);0==i.length&&t(void 0,{})}}))},Yc.prototype.delete=function(t){ps(this,t)},Yc.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.id]=r.name}return e}(this.data_tables)),this.data_table_names},Yc.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.name]=r.id}return e}(this.data_tables)),this.data_table_ids},Yc.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},Yc.prototype.duplicate=function(t){us({url:this.api_prefix+"/"+this.id+"/duplicate",callback:t})},Yc.prototype.deleteCanvaEmbed=function(t){us({url:this.api_prefix+"/"+this.id+"/delete_canva_embed",callback:t})},Yc.prototype.publish=function(t,e,n){var r=this;if(this.is_listed)return Zc(r,t,e,n);this.save({is_listed:!0},(function(i){return i?t(i):Zc(r,t,e,n)}))},Yc.prototype.unpublish=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/unpublish",callback:function(n,r){if(n)return t(n);e.version_number=r.version_number,e.embed_url=r.embed_url,e.showcase_url=r.showcase_url,t(void 0,r)}})},Yc.prototype.published=function(){return!!this.showcase_url},Yc.prototype.sendForReview=function(t,e,n){var r=this;us({url:"/api/reviews",payload:function(){return{project_id:r.id,project_type:"visualisation",reviewers:t,message:e}},callback:function(t,e){r.status=e,n(t,e)}})},Yc.prototype.approve=function(t,e){var n=this;us({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},Yc.prototype.decline=function(t,e,n){var r=this;us({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},Yc.prototype.cancelReview=function(t,e){var n=this;us({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},Yc.list=function(t){us({url:"/api/visualisations",method:"GET",callback:t})},Yc.getById=function(t,e){us({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new Yc(t,r.version_number,r))}})},Yc.getPublishedJson=function(t,e,n){us({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},Yc.createFromTemplate=function(t,e){us({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},Yc.createFromVisualisation=function(t,e){us({url:"/api/visualisation/"+t+"/duplicate",callback:e})},Yc.setAsStaffPick=function(t,e){us({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},Yc.unsetAsStaffPick=function(t,e){us({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},Yc.setFolder=function(t,e,n){us({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e),method:"PUT",callback:n})},Yc.removeFolder=function(t,e,n){us({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e),method:"DELETE",callback:n})},Yc.removeTag=function(t,e,n){us({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},Yc.prototype.updateCompanyAccess=function(t,e,n={}){us({url:"/api/visualisation/"+this.id+"/company_access",method:"POST",callback:e,payload:function(){return{company_access:t,options:n}}})},Yc.prototype.getTags=function(t){us({url:"/api/visualisation/"+this.id+"/tags",method:"GET",callback:t})},Yc.prototype.setTags=function(t,e){us({url:"/api/visualisation/"+this.id+"/tags",method:"PUT",callback:e,payload:function(){return{tags:t}}})},Jc.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;const t=window.location.hash.slice(1),e=(n=Yc.getPublishedJson,function(...t){return new Promise(((e,i)=>{n.call(r,...t,(function(t,n){if(t)return i(t);e(n)}))}))});var n,r;try{const n=await e(t,this.public_url_prefix);this.updateFromJson(n)}catch(t){console.error(t)}},Jc.prototype.updateFromJson=function({state:t,bindings:e,data:n}){const r={};for(const[t,i]of Object.entries(e)){const e={},a={};for(const[t,n]of Object.entries(i))Array.isArray(n)?a[t]=n:e[t]=n;const s=o(n[t],e,a);r[t]=s}const i={};Xc(i,this.preview_pane.getDefaultState()),Xc(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var Kc={},Qc={};function td(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ed(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function nd(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function rd(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+nd(-t,6):t>9999?"+"+nd(t,6):nd(t,4)}(t.getUTCFullYear())+"-"+nd(t.getUTCMonth()+1,2)+"-"+nd(t.getUTCDate(),2)+(i?"T"+nd(e,2)+":"+nd(n,2)+":"+nd(r,2)+"."+nd(i,3)+"Z":r?"T"+nd(e,2)+":"+nd(n,2)+":"+nd(r,2)+"Z":n||e?"T"+nd(e,2)+":"+nd(n,2)+"Z":"")}var id=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,u=!1;function c(){if(l)return Qc;if(u)return u=!1,Kc;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?u=!0:13===r&&(u=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))u=!0;else if(13===r)u=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Qc;){for(var d=[];r!==Kc&&r!==Qc;)d.push(r),r=c();e&&null==(d=e(d,s++))||i.push(d)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?rd(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=td(t);return function(r,i){return e(n(r),i,t)}}(t,e):td(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=ed(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=ed(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),od=id.parseRows,ad="$";function sd(){}function ld(t,e){var n=new sd;if(t instanceof sd)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function ud(){}sd.prototype=ld.prototype={constructor:sd,has:function(t){return ad+t in this},get:function(t){return this[ad+t]},set:function(t,e){return this[ad+t]=e,this},remove:function(t){var e=ad+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===ad&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===ad&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===ad&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===ad&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===ad&&++t;return t},empty:function(){for(var t in this)if(t[0]===ad)return!1;return!0},each:function(t){for(var e in this)e[0]===ad&&t(this[e],e.slice(1),this)}};var cd=ld.prototype;ud.prototype={constructor:ud,has:cd.has,add:function(t){return this[ad+(t+="")]=t,this},remove:cd.remove,clear:cd.clear,values:cd.keys,size:cd.size,empty:cd.empty,each:cd.each};var dd,pd,fd={value:function(){}};function hd(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new md(r)}function md(t){this._=t}function gd(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function vd(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function yd(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=fd,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function bd(t,e,n){var r;r="object"==typeof e?e.id:e,this.id=r,this.visualisation=t,this.api_prefix="/api/data_table"}function _d(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?_d(t):t}))}function wd(t){this.id=t}function xd(t,e,n){var r=this;r.id=1,r.template_id=1,r.api_prefix="/api/visualisation",r.can_edit=!0,r.__sdk__=!0,n.data_tables&&(this.data_tables=n.data_tables.map((function(t){return new bd(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}md.prototype=hd.prototype={constructor:md,on:function(t,e){var n,r=this._,i=gd(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=yd(r[n],t.name,e);else if(null==e)for(n in r)r[n]=yd(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=vd(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new md(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}},bd.prototype.csv=function(t){if(this.cached_data)t(void 0,_d(this.cached_data));else{var e=this;!function(t,e){var n,r,i,o,a=hd("beforesend","progress","load","error"),s=ld(),l=new XMLHttpRequest,u=null,c=null,d=0;function p(t){var e,r=l.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,l)}catch(t){return void a.call("error",n,t)}else e=l;a.call("load",n,e)}else a.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(t)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=p:l.onreadystatechange=function(t){l.readyState>3&&p(t)},l.onprogress=function(t){a.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(o=t,n):o},timeout:function(t){return arguments.length?(d=+t,n):d},user:function(t){return arguments.length<1?u:(u=null==t?null:t+"",n)},password:function(t){return arguments.length<1?c:(c=null==t?null:t+"",n)},response:function(t){return i=t,n},get:function(t,e){return n.send("GET",t,e)},post:function(t,e){return n.send("POST",t,e)},send:function(e,i,p){return l.open(e,t,!0,u,c),null==r||s.has("accept")||s.set("accept",r+",*/*"),l.setRequestHeader&&s.each((function(t,e){l.setRequestHeader(e,t)})),null!=r&&l.overrideMimeType&&l.overrideMimeType(r),null!=o&&(l.responseType=o),d>0&&(l.timeout=d),null==p&&"function"==typeof i&&(p=i,i=null),null!=p&&1===p.length&&(p=function(t){return function(e,n){t(null==e?n:null)}}(p)),null!=p&&n.on("error",p).on("load",(function(t){p(null,t)})),a.call("beforesend",n,l),l.send(null==i?null:i),n},abort:function(){return l.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}}(this.api_prefix+"/"+this.id+"/csv",(function(n,r){e.cached_data=od(r.response),t(void 0,_d(e.cached_data))}))}},bd.prototype.saveData=function(t,e){e()},bd.prototype.save=function(t,e){e()},bd.prototype.delete=function(t){t()},wd.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},wd.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},wd.prototype.refreshDataBindings=function(t){t(void 0)},xd.prototype.save=function(t,e){this.version_number++,e(void 0)},xd.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new wd(this.template_id)),this._template):null},xd.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},xd.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},xd.prototype.refreshDataBindings=function(t){t()},xd.prototype.updateDataBindings=function(t,e){var n=this;n.version_number++,n.data_bindings||(n.data_bindings={}),n.template_id in n.data_bindings||(n.data_bindings[n.template_id]={});var r=n.data_bindings[n.template_id];for(var i in t)for(var o in t[i]){var a=t[i][o];r[i][o]=a}e(void 0)},xd.prototype.updateSettings=function(t,e){var n=this;n.version_number++,n.settings||(n.settings={}),n.template_id in n.settings||(n.settings[n.template_id]={});var r=n.settings[n.template_id];for(var i in t){var o=t[i];r[i]=o}e(void 0)},xd.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},xd.prototype.dataTables=function(t){var e=this;e.data_tables?t(void 0,e.data_tables):(e.after_loading_data_tables||(e.after_loading_data_tables=[]),e.after_loading_data_tables.push(t),e.after_loading_data_tables.length>1||e.getDataTables((function(t,n){if(t){for(var r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](t);e.after_loading_data_tables=[]}else{e.data_tables=n.map((function(t){return new bd(e,t)}));for(r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](void 0,e.data_tables);e.after_loading_data_tables=[]}})))},xd.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},xd.prototype.prepareData=function(t){var e=this;if(!e.data_bindings)throw new Error("No data bindings loaded");var n=e.template_id;e.dataTables((function(r,i){if(r)return t(r);if(e.template_id==n){for(var o={},a={},s=0,l=0;l<i.length;l++)!function(r){r.csv((function(l,u){if(l)throw l;e.template_id==n&&(a[r.id]=ji(u),o[r.id]=u,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var i={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in i||(i[t.dataset]={}),i[t.dataset][t.key]=t)}));var s={},l=e.dataBindingsForCurrentTemplate();for(var u in l)s[u]=Ri(l[u],o,a,i[u]);for(u in i)s[u]||(s[u]=[],s[u].column_names={},s[u].metadata={});t(void 0,s)})))}))}(i[l]);0==i.length&&t(void 0,{})}}))},xd.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.id]=r.name}return e}(this.data_tables)),this.data_table_names},xd.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.name]=r.id}return e}(this.data_tables)),this.data_table_ids},xd.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var Cd=!1;function Ad(){dd&&dd.classList.remove("shown")}function kd(){this.close(),Cd||(dd&&setTimeout((function(){dd.classList.add("shown")}),1e3),setTimeout(Ed,250))}function Ed(){Td().addEventListener("open",(function(){window.location.reload()}))}function Td(){var t=new window.WebSocket(pd);return t.addEventListener("open",Ad),t.addEventListener("close",kd),t}return t.Visualisation=xd,t.initSDK=function(t,e,n,r){return Ve(),window.Flourish=window.Flourish||{},window.Flourish.app=new Jc(t,e,n,r),window.Flourish.app},t.talkToServer=function(){dd=document.getElementById("error-server-down"),pd=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){Cd=!0})),Td()},Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
2
|
+
/*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.2.2/LICENSE */(),window.innerWidth<=768&&(vt="auto"),window.addEventListener("resize",(function(){gt&&St(),window.innerWidth<=768?vt||(vt=gt,Dt("auto")):vt&&(Dt(vt),vt=null),_t.preview_pane.resize()})),{getHeightSetting:Tt}}function St(){var t=At(".preview-holder").node().getBoundingClientRect();yt.nodes()[0].value=Math.round(t.width),""!==yt.nodes()[1].value&&"custom"===bt&&(yt.nodes()[1].value=Math.round(t.height))}xt.prototype=Ct.prototype={constructor:xt,select:function(t){"function"!=typeof t&&(t=f(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,u=r[i]=new Array(l),c=0;c<l;++c)(o=s[c])&&(a=t.call(o,o.__data__,c,s))&&("__data__"in o&&(a.__data__=o.__data__),u[c]=a);return new xt(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:h(e)}}(t):g(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,u=0;u<l;++u)(a=s[u])&&(r.push(t.call(a,a.__data__,u,s)),i.push(a));return new xt(r,i)},selectChild:function(t){return this.select(null==t?_:function(t){return function(){return b.call(this.children,t)}}("function"==typeof t?t:y(t)))},selectChildren:function(t){return this.selectAll(null==t?x:function(t){return function(){return w.call(this.children,t)}}("function"==typeof t?t:y(t)))},filter:function(t){"function"!=typeof t&&(t=v(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new xt(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,L);var n=e?T:E,r=this._parents,i=this._groups;"function"!=typeof t&&(t=k(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),u=0;u<o;++u){var c=r[u],d=i[u],p=d.length,f=h(t.call(c,c&&c.__data__,u,r)),m=f.length,g=s[u]=new Array(m),v=a[u]=new Array(m),y=l[u]=new Array(p);n(c,d,g,v,y,f,e);for(var b,_,w=0,x=0;w<m;++w)if(b=g[w]){for(w>=x&&(x=w+1);!(_=v[x])&&++x<m;);b._next=_||null}}return(a=new xt(a,r))._enter=s,a._exit=l,a},enter:function(){return new xt(this._enter||this._groups.map(C),this._parents)},exit:function(){return new xt(this._exit||this._groups.map(C),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(i=e(i)),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){if(!(t instanceof xt))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,u=e[s],c=n[s],d=u.length,p=a[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<r;++s)a[s]=e[s];return new xt(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=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=D);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,u=i[o]=new Array(l),c=0;c<l;++c)(a=s[c])&&(u[c]=a);u.sort(e)}return new xt(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=l(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?S:F:"function"==typeof e?n.local?O:U:n.local?N:M)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?H:"function"==typeof e?j:R)(t,e,null==n?"":n)):I(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?z:"function"==typeof e?$:P)(t,e)):this.node()[t]},classed:function(t,e){var n=q(t+"");if(arguments.length<2){for(var r=V(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?J:e?Z:X)(n,e))},text:function(t){return arguments.length?this.each(null==t?K:("function"==typeof t?tt:Q)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?et:("function"==typeof t?rt:nt)(t)):this.node().innerHTML},raise:function(){return this.each(it)},lower:function(){return this.each(ot)},append:function(t){var e="function"==typeof t?t:d(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:d(t),r=null==e?at:"function"==typeof e?e:f(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(st)},clone:function(t){return this.select(t?ut:lt)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=ct(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?pt:dt,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(r=0,l=s[u];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?mt:ht)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Mt=Object.hasOwnProperty,Nt=Object.setPrototypeOf,Ut=Object.isFrozen,Ot=Object.getPrototypeOf,Bt=Object.getOwnPropertyDescriptor,Ht=Object.freeze,Rt=Object.seal,jt=Object.create,It="undefined"!=typeof Reflect&&Reflect,zt=It.apply,Pt=It.construct;zt||(zt=function(t,e,n){return t.apply(e,n)}),Ht||(Ht=function(t){return t}),Rt||(Rt=function(t){return t}),Pt||(Pt=function(t,e){return new(Function.prototype.bind.apply(t,[null].concat(function(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}(e))))});var $t,qt=te(Array.prototype.forEach),Vt=te(Array.prototype.pop),Yt=te(Array.prototype.push),Wt=te(String.prototype.toLowerCase),Gt=te(String.prototype.match),Zt=te(String.prototype.replace),Xt=te(String.prototype.indexOf),Jt=te(String.prototype.trim),Kt=te(RegExp.prototype.test),Qt=($t=TypeError,function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return Pt($t,e)});function te(t){return function(e){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return zt(t,e,r)}}function ee(t,e){Nt&&Nt(t,null);for(var n=e.length;n--;){var r=e[n];if("string"==typeof r){var i=Wt(r);i!==r&&(Ut(e)||(e[n]=i),r=i)}t[r]=!0}return t}function ne(t){var e=jt(null),n=void 0;for(n in t)zt(Mt,t,[n])&&(e[n]=t[n]);return e}function re(t,e){for(;null!==t;){var n=Bt(t,e);if(n){if(n.get)return te(n.get);if("function"==typeof n.value)return te(n.value)}t=Ot(t)}return function(t){return console.warn("fallback value for",t),null}}var ie=Ht(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),oe=Ht(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ae=Ht(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),se=Ht(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),le=Ht(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),ue=Ht(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ce=Ht(["#text"]),de=Ht(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns","slot"]),pe=Ht(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),fe=Ht(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),he=Ht(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),me=Rt(/\{\{[\s\S]*|[\s\S]*\}\}/gm),ge=Rt(/<%[\s\S]*|[\s\S]*%>/gm),ve=Rt(/^data-[\-\w.\u00B7-\uFFFF]/),ye=Rt(/^aria-[\-\w]+$/),be=Rt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),_e=Rt(/^(?:\w+script|data):/i),we=Rt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xe="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};function Ce(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var Ae=function(){return"undefined"==typeof window?null:window},ke=function(t,e){if("object"!==(void 0===t?"undefined":xe(t))||"function"!=typeof t.createPolicy)return null;var n=null,r="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(r)&&(n=e.currentScript.getAttribute(r));var i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};var Ee,Te,Le=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ae(),n=function(e){return t(e)};if(n.version="2.2.8",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var r=e.document,i=e.document,o=e.DocumentFragment,a=e.HTMLTemplateElement,s=e.Node,l=e.Element,u=e.NodeFilter,c=e.NamedNodeMap,d=void 0===c?e.NamedNodeMap||e.MozNamedAttrMap:c,p=e.Text,f=e.Comment,h=e.DOMParser,m=e.trustedTypes,g=l.prototype,v=re(g,"cloneNode"),y=re(g,"nextSibling"),b=re(g,"childNodes"),_=re(g,"parentNode");if("function"==typeof a){var w=i.createElement("template");w.content&&w.content.ownerDocument&&(i=w.content.ownerDocument)}var x=ke(m,r),C=x&&tt?x.createHTML(""):"",A=i,k=A.implementation,E=A.createNodeIterator,T=A.createDocumentFragment,L=r.importNode,D={};try{D=ne(i).documentMode?i.documentMode:{}}catch(t){}var F={};n.isSupported="function"==typeof _&&k&&void 0!==k.createHTMLDocument&&9!==D;var S=me,M=ge,N=ve,U=ye,O=_e,B=we,H=be,R=null,j=ee({},[].concat(Ce(ie),Ce(oe),Ce(ae),Ce(le),Ce(ce))),I=null,z=ee({},[].concat(Ce(de),Ce(pe),Ce(fe),Ce(he))),P=null,$=null,q=!0,V=!0,Y=!1,W=!1,G=!1,Z=!1,X=!1,J=!1,K=!1,Q=!0,tt=!1,et=!0,nt=!0,rt=!1,it={},ot=ee({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),at=null,st=ee({},["audio","video","img","source","image","track"]),lt=null,ut=ee({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),ct="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",pt="http://www.w3.org/1999/xhtml",ft=pt,ht=null,mt=i.createElement("form"),gt=function(t){ht&&ht===t||(t&&"object"===(void 0===t?"undefined":xe(t))||(t={}),t=ne(t),R="ALLOWED_TAGS"in t?ee({},t.ALLOWED_TAGS):j,I="ALLOWED_ATTR"in t?ee({},t.ALLOWED_ATTR):z,lt="ADD_URI_SAFE_ATTR"in t?ee(ne(ut),t.ADD_URI_SAFE_ATTR):ut,at="ADD_DATA_URI_TAGS"in t?ee(ne(st),t.ADD_DATA_URI_TAGS):st,P="FORBID_TAGS"in t?ee({},t.FORBID_TAGS):{},$="FORBID_ATTR"in t?ee({},t.FORBID_ATTR):{},it="USE_PROFILES"in t&&t.USE_PROFILES,q=!1!==t.ALLOW_ARIA_ATTR,V=!1!==t.ALLOW_DATA_ATTR,Y=t.ALLOW_UNKNOWN_PROTOCOLS||!1,W=t.SAFE_FOR_TEMPLATES||!1,G=t.WHOLE_DOCUMENT||!1,J=t.RETURN_DOM||!1,K=t.RETURN_DOM_FRAGMENT||!1,Q=!1!==t.RETURN_DOM_IMPORT,tt=t.RETURN_TRUSTED_TYPE||!1,X=t.FORCE_BODY||!1,et=!1!==t.SANITIZE_DOM,nt=!1!==t.KEEP_CONTENT,rt=t.IN_PLACE||!1,H=t.ALLOWED_URI_REGEXP||H,ft=t.NAMESPACE||ft,W&&(V=!1),K&&(J=!0),it&&(R=ee({},[].concat(Ce(ce))),I=[],!0===it.html&&(ee(R,ie),ee(I,de)),!0===it.svg&&(ee(R,oe),ee(I,pe),ee(I,he)),!0===it.svgFilters&&(ee(R,ae),ee(I,pe),ee(I,he)),!0===it.mathMl&&(ee(R,le),ee(I,fe),ee(I,he))),t.ADD_TAGS&&(R===j&&(R=ne(R)),ee(R,t.ADD_TAGS)),t.ADD_ATTR&&(I===z&&(I=ne(I)),ee(I,t.ADD_ATTR)),t.ADD_URI_SAFE_ATTR&&ee(lt,t.ADD_URI_SAFE_ATTR),nt&&(R["#text"]=!0),G&&ee(R,["html","head","body"]),R.table&&(ee(R,["tbody"]),delete P.tbody),Ht&&Ht(t),ht=t)},vt=ee({},["mi","mo","mn","ms","mtext"]),yt=ee({},["foreignobject","desc","title","annotation-xml"]),bt=ee({},oe);ee(bt,ae),ee(bt,se);var _t=ee({},le);ee(_t,ue);var wt=function(t){var e=_(t);e&&e.tagName||(e={namespaceURI:pt,tagName:"template"});var n=Wt(t.tagName),r=Wt(e.tagName);if(t.namespaceURI===dt)return e.namespaceURI===pt?"svg"===n:e.namespaceURI===ct?"svg"===n&&("annotation-xml"===r||vt[r]):Boolean(bt[n]);if(t.namespaceURI===ct)return e.namespaceURI===pt?"math"===n:e.namespaceURI===dt?"math"===n&&yt[r]:Boolean(_t[n]);if(t.namespaceURI===pt){if(e.namespaceURI===dt&&!yt[r])return!1;if(e.namespaceURI===ct&&!vt[r])return!1;var i=ee({},["title","style","font","a","script"]);return!_t[n]&&(i[n]||!bt[n])}return!1},xt=function(t){Yt(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=C}catch(e){t.remove()}}},Ct=function(t,e){try{Yt(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){Yt(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!I[t])if(J||K)try{xt(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},At=function(t){var e=void 0,n=void 0;if(X)t="<remove></remove>"+t;else{var r=Gt(t,/^[\r\n\t ]+/);n=r&&r[0]}var o=x?x.createHTML(t):t;if(ft===pt)try{e=(new h).parseFromString(o,"text/html")}catch(t){}e&&e.documentElement||((e=k.createDocument(ft,"template",null)).documentElement.innerHTML=o);var a=e.body||e.documentElement;return t&&n&&a.insertBefore(i.createTextNode(n),a.childNodes[0]||null),G?e.documentElement:a},kt=function(t){return E.call(t.ownerDocument||t,t,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT,(function(){return u.FILTER_ACCEPT}),!1)},Et=function(t){return!(t instanceof p||t instanceof f)&&!("string"==typeof t.nodeName&&"string"==typeof t.textContent&&"function"==typeof t.removeChild&&t.attributes instanceof d&&"function"==typeof t.removeAttribute&&"function"==typeof t.setAttribute&&"string"==typeof t.namespaceURI&&"function"==typeof t.insertBefore)},Tt=function(t){return"object"===(void 0===s?"undefined":xe(s))?t instanceof s:t&&"object"===(void 0===t?"undefined":xe(t))&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Lt=function(t,e,r){F[t]&&qt(F[t],(function(t){t.call(n,e,r,ht)}))},Dt=function(t){var e=void 0;if(Lt("beforeSanitizeElements",t,null),Et(t))return xt(t),!0;if(Gt(t.nodeName,/[\u0080-\uFFFF]/))return xt(t),!0;var r=Wt(t.nodeName);if(Lt("uponSanitizeElement",t,{tagName:r,allowedTags:R}),!Tt(t.firstElementChild)&&(!Tt(t.content)||!Tt(t.content.firstElementChild))&&Kt(/<[/\w]/g,t.innerHTML)&&Kt(/<[/\w]/g,t.textContent))return xt(t),!0;if(!R[r]||P[r]){if(nt&&!ot[r]){var i=_(t)||t.parentNode,o=b(t)||t.childNodes;if(o&&i)for(var a=o.length-1;a>=0;--a)i.insertBefore(v(o[a],!0),y(t))}return xt(t),!0}return t instanceof l&&!wt(t)?(xt(t),!0):"noscript"!==r&&"noembed"!==r||!Kt(/<\/no(script|embed)/i,t.innerHTML)?(W&&3===t.nodeType&&(e=t.textContent,e=Zt(e,S," "),e=Zt(e,M," "),t.textContent!==e&&(Yt(n.removed,{element:t.cloneNode()}),t.textContent=e)),Lt("afterSanitizeElements",t,null),!1):(xt(t),!0)},Ft=function(t,e,n){if(et&&("id"===e||"name"===e)&&(n in i||n in mt))return!1;if(V&&Kt(N,e));else if(q&&Kt(U,e));else{if(!I[e]||$[e])return!1;if(lt[e]);else if(Kt(H,Zt(n,B,"")));else if("src"!==e&&"xlink:href"!==e&&"href"!==e||"script"===t||0!==Xt(n,"data:")||!at[t]){if(Y&&!Kt(O,Zt(n,B,"")));else if(n)return!1}else;}return!0},St=function(t){var e=void 0,r=void 0,i=void 0,o=void 0;Lt("beforeSanitizeAttributes",t,null);var a=t.attributes;if(a){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:I};for(o=a.length;o--;){var l=e=a[o],u=l.name,c=l.namespaceURI;if(r=Jt(e.value),i=Wt(u),s.attrName=i,s.attrValue=r,s.keepAttr=!0,s.forceKeepAttr=void 0,Lt("uponSanitizeAttribute",t,s),r=s.attrValue,!s.forceKeepAttr&&(Ct(u,t),s.keepAttr))if(Kt(/\/>/i,r))Ct(u,t);else{W&&(r=Zt(r,S," "),r=Zt(r,M," "));var d=t.nodeName.toLowerCase();if(Ft(d,i,r))try{c?t.setAttributeNS(c,u,r):t.setAttribute(u,r),Vt(n.removed)}catch(t){}}}Lt("afterSanitizeAttributes",t,null)}},Mt=function t(e){var n=void 0,r=kt(e);for(Lt("beforeSanitizeShadowDOM",e,null);n=r.nextNode();)Lt("uponSanitizeShadowNode",n,null),Dt(n)||(n.content instanceof o&&t(n.content),St(n));Lt("afterSanitizeShadowDOM",e,null)};return n.sanitize=function(t,i){var a=void 0,l=void 0,u=void 0,c=void 0,d=void 0;if(t||(t="\x3c!--\x3e"),"string"!=typeof t&&!Tt(t)){if("function"!=typeof t.toString)throw Qt("toString is not a function");if("string"!=typeof(t=t.toString()))throw Qt("dirty is not a string, aborting")}if(!n.isSupported){if("object"===xe(e.toStaticHTML)||"function"==typeof e.toStaticHTML){if("string"==typeof t)return e.toStaticHTML(t);if(Tt(t))return e.toStaticHTML(t.outerHTML)}return t}if(Z||gt(i),n.removed=[],"string"==typeof t&&(rt=!1),rt);else if(t instanceof s)1===(l=(a=At("\x3c!----\x3e")).ownerDocument.importNode(t,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?a=l:a.appendChild(l);else{if(!J&&!W&&!G&&-1===t.indexOf("<"))return x&&tt?x.createHTML(t):t;if(!(a=At(t)))return J?null:C}a&&X&&xt(a.firstChild);for(var p=kt(rt?t:a);u=p.nextNode();)3===u.nodeType&&u===c||Dt(u)||(u.content instanceof o&&Mt(u.content),St(u),c=u);if(c=null,rt)return t;if(J){if(K)for(d=T.call(a.ownerDocument);a.firstChild;)d.appendChild(a.firstChild);else d=a;return Q&&(d=L.call(r,d,!0)),d}var f=G?a.outerHTML:a.innerHTML;return W&&(f=Zt(f,S," "),f=Zt(f,M," ")),x&&tt?x.createHTML(f):f},n.setConfig=function(t){gt(t),Z=!0},n.clearConfig=function(){ht=null,Z=!1},n.isValidAttribute=function(t,e,n){ht||gt({});var r=Wt(t),i=Wt(e);return Ft(r,i,n)},n.addHook=function(t,e){"function"==typeof e&&(F[t]=F[t]||[],Yt(F[t],e))},n.removeHook=function(t){F[t]&&Vt(F[t])},n.removeHooks=function(t){F[t]&&(F[t]=[])},n.removeAllHooks=function(){F={}},n}(),De=25,Fe=10,Se=10,Me={};function Ne(t,e,n,r,i,o,a){var s=n-t/2-Se,l=n+t/2+Se,u=t/2+Math.min(0,s-i.left)+Math.max(0,l-i.right);return{pos:[u,a],shape:u-Fe<5?[-u,-15*o,Math.max(Fe,5-u),-10*o]:u+Fe>t-5?[Math.min(-10,t-u-5),-10*o,Math.min(Fe,t-u),-15*o]:[-10,-10*o,Fe,-10*o]}}function Ue(t,e,n,r,i,o,a){var s=r-e/2-Se,l=r+e/2+Se,u=e/2+Math.min(0,s-i.top)+Math.max(0,l-i.bottom);return{pos:[a,u],shape:u-Fe<5?[-15*o,-u,-10*o,Math.max(Fe,5-u)]:u+Fe>e-5?[-10*o,Math.min(-10,e-u-5),-15*o,Math.min(Fe,e-u)]:[-10*o,-10,-10*o,Fe]}}function Oe(t,e,n,r,i,o){var a=Me[t](e,n,r,i,o),s=r-De-a.pos[0],l=i-De-a.pos[1];return{left:s,top:l,right:s+e+50,bottom:l+n+50}}function Be(t,e,n){var r,i=document.createElementNS("http://www.w3.org/2000/svg",t);if(e)for(r in e)i.setAttribute(r,e[r]);var o=i.style;if(n)for(r in n)o[r]=n[r];return i}function He(){return Ee||((Ee=document.createElement("div")).id="flourish-popup-constrainer",(Te=Ee.style).overflow="hidden",Te.pointerEvents="none",Te.position="absolute",Te.left="0",Te.top="0",Te.margin="0",Te.padding="0",document.body.appendChild(Ee),this._resizeConstrainer(),Ee)}Me.bottom=function(t,e){return{shape:[-10,-10,Fe,-10],pos:[t/2,e+Se]}},Me.top=function(t,e){return{shape:[-10,Se,Fe,Se],pos:[t/2,-10]}},Me.left=function(t,e){return{shape:[Se,Fe,Se,-10],pos:[-10,e/2]}},Me.right=function(t,e){return{shape:[-10,Fe,-10,-10],pos:[t+Se,e/2]}},Me.topLeft=function(t,e){return{shape:[15,Se,Se,15],pos:[-10,-10]}},Me.bottomLeft=function(t,e){return{shape:[15,-10,Se,-15],pos:[-10,e+Se]}},Me.topRight=function(t,e){return{shape:[-15,Se,-10,15],pos:[t+Se,-10]}},Me.bottomRight=function(t,e){return{shape:[-15,-10,-10,-15],pos:[t+Se,e+Se]}},Me.bottomFlexible=function(t,e,n,r,i){return Ne(t,0,n,0,i,1,e+Se)},Me.topFlexible=function(t,e,n,r,i){return Ne(t,0,n,0,i,-1,-10)},Me.rightFlexible=function(t,e,n,r,i){return Ue(0,e,0,r,i,1,t+Se)},Me.leftFlexible=function(t,e,n,r,i){return Ue(0,e,0,r,i,-1,-10)};var Re,je=1,Ie={container:document.body,maxWidth:"70%",point:null,html:null,directions:["bottom","top","left","right","topLeft","bottomLeft","topRight","bottomRight","bottomFlexible","topFlexible","leftFlexible","rightFlexible"],fallbackFit:"horizontal"};function ze(){for(var t in this.unique_id=je++,this.is_visible=!0,Ie)this["_"+t]=Ie[t];this.handlers={click:[]}}function Pe(t){ze.prototype[t]=function(e){return void 0===e?this["_"+t]:(this["_"+t]=e,this)}}for(var $e in Ie)Pe($e);function qe(){return new ze}function Ve(){Re=qe().container(document.body),function(t){t.each((function(){var t=At(this);if(t.attr("data-popup-allow-interaction")&&!t.select(".popup-content-wrapper").size()){var e=t.append("span").attr("class","popup-content-wrapper").style("display","none").append("span").attr("class","popup-content-outer");e.append("span").attr("class","popup-content-inner"),e.append("span").attr("class","popup-content-arrow")}At(this).on("mouseenter focus",(function(t){Ye.call(this,t,!0)})).on("mouseover",Ye).on("mouseout focusout",We)}))}(Et(".popup"))}function Ye(t,e){if(this.getAttribute("data-popup-head")||this.getAttribute("data-popup-body")){var n=this.getAttribute("data-popup-allow-interaction"),r=this.getAttribute("data-popup-position"),i=this.getBoundingClientRect(),o=i.left+i.width/2,a=i.top+i.height,s=this.getAttribute("data-popup-head")||null,l=this.getAttribute("data-popup-body")||null,u="";if(s&&(u+=kt("span").classed("popup-content-header",!0).html(Le.sanitize(s)).node().outerHTML),l&&(u+=kt("span").classed("popup-content-body",!0).html(Le.sanitize(l)).node().outerHTML),n){r&&["top","bottom"].includes(r)||(r="top");At(this).select(".popup-content-outer").style("display","inline-block"),At(this).select(".popup-content-inner").style("display","inline-block"),At(this).select(".popup-content-wrapper").style("display","block").style("bottom","top"==r?i.height-4+"px":null).style("top","bottom"==r?i.height-4+"px":null),e&&At(this).select(".popup-content-inner").html(u);var c=this.getAttribute("data-popup-constrainer")||"body",d=At(c).size()?At(c).node().getBoundingClientRect():document.body,p=At(this).select(".popup-content-inner").node().getBoundingClientRect().width,f=o,h=-p/2,m=f+p/2-(d.right-15),g=d.left+15-(f-p/2);m>0?h-=m:g>0&&(h+=g),At(this).select(".popup-content-wrapper").style("left",i.width/2+h+"px");At(this).select(".popup-content-arrow").style("left",-5+Math.abs(h)+"px")}else{var v=["top","topFlexible"];r&&("left"===r?(v=["right","rightFlexible"],o=i.left,a=i.top+i.height/2):"right"===r?(v=["left","leftFlexible"],o=i.right,a=i.top+i.height/2):"top"===r?(v=["bottom","bottomFlexible"],o=i.left+i.width/2,a=i.top):"bottom"===r&&(v=["top","topFlexible"],o=i.left+i.width/2,a=i.top+i.height)),Re.point(o,a).html(u).directions(v).draw()}}}function We(t){document.activeElement===this||this.contains(t.relatedTarget)||(this.getAttribute("data-popup-allow-interaction")&&At(this).select(".popup-content-wrapper").style("display","none"),Re.hide())}ze.prototype.point=function(t,e){if(void 0===t)return this._point;if(Array.isArray(t))this._point=[t[0],t[1]];else if(void 0!==e)this._point=[t,e];else if(t instanceof HTMLElement||t instanceof SVGElement){var n=t.getBoundingClientRect();this._point=[Math.floor(n.left+n.width/2),Math.floor(n.top+n.height/2)]}else console.error("Popup: could not understand argument");return this},ze.prototype.directions=function(t){return void 0===t?this._directions:("string"==typeof t&&(t=[t]),this._directions=t.slice(),this)},ze.prototype.text=function(t){return this._html=function(t){return t.replace(/[&<>]/g,(function(t){return{"&":"&","<":"<",">":">"}[t]}))}(t),this},ze.prototype.on=function(t,e){if(!(t in this.handlers))throw new Error("Popup.on: No such event: "+t);return this.handlers[t].push(e),this},ze.prototype.fire=function(t,e){if(!(t in this.handlers))throw new Error("Popup.fire: No such event: "+t);for(var n=this.handlers[t],r=0;r<n.length;r++)n[r].call(this,e);return this},ze.prototype._getElement=function(){var t=this,e="flourish-popup-"+t.unique_id,n=document.getElementById(e);if(!n){(n=document.createElement("div")).className="flourish-popup",n.id=e;var r=n.style;r.display="none",r.margin=r.padding=0,r.position="absolute",r.width="80px",r.height="40px",r.boxSizing="border-box",n.addEventListener("click",(function(e){t.fire("click",e)}),!1);var i=Be("svg",{class:"flourish-popup-svg"},{position:"absolute",top:0,left:0,bottom:0,right:0}),o=Be("filter",{id:"dropshadow-"+t.unique_id,height:"130%"});o.appendChild(Be("feGaussianBlur",{in:"SourceAlpha",stdDeviation:5})),o.appendChild(Be("feOffset",{dx:0,dy:2,result:"offsetblur"}));var a=Be("feComponentTransfer");a.appendChild(Be("feFuncA",{type:"linear",slope:.2})),o.appendChild(a);var s=Be("feMerge");o.appendChild(s),s.appendChild(Be("feMergeNode")),s.appendChild(Be("feMergeNode",{in:"SourceGraphic"})),i.appendChild(o);var l=Be("g",{filter:"url(#dropshadow-"+t.unique_id+")",fill:"white",stroke:"none"});l.appendChild(Be("rect",{x:De,y:De,rx:5})),l.appendChild(Be("path")),i.appendChild(l),n.appendChild(i);var u=document.createElement("div");u.className="flourish-popup-content",(r=u.style).position="absolute",r.top=r.left="25px",r.padding="10px",n.appendChild(u),t._getConstrainer().appendChild(n)}return t._resizeConstrainer(),n},ze.prototype._getConstrainer=He,ze.prototype._resizeConstrainer=function(){Ee||He.call(this);var t=Te.display;Te.display="none",Te.width=document.documentElement.scrollWidth+"px",Te.height=document.documentElement.scrollHeight+"px",Te.display=t},ze.prototype.draw=function(){var t=this;if(t.is_visible=!0,t._point){var e=document.documentElement.getBoundingClientRect(),n=t._point[0],r=t._point[1],i=t._container.getBoundingClientRect();n<i.left?n=i.left:n>i.right&&(n=i.right),r<i.top?r=i.top:r>i.bottom&&(r=i.bottom);var o=n-e.left,a=r-e.top,s=t._getElement(),l=s.style,u=s.querySelector(".flourish-popup-svg"),c=u.querySelector("g"),d=c.querySelector("rect"),p=c.querySelector("path"),f=s.querySelector(".flourish-popup-content");l.display="block",f.style.maxWidth=function(e){return t._maxWidth.match(/^\d+(?:\.\d+)?%$/)?e.width*parseFloat(t._maxWidth)/100:t._maxWidth.match(/^\d+(?:\.\d+)?(?:px)?$/)?parseFloat(t._maxWidth):(null!=t._maxWidth&&console.error("Popup: Unknown value for maxWidth: "+t._maxWidth),e.width)}(i)+"px",t._inner_html!=t._html&&(f.innerHTML=t._inner_html=t._html);var h,m,g=f.getBoundingClientRect();do{h=Math.ceil(g.width),m=Math.ceil(g.height),l.width=h+50+"px",l.height=m+50+"px",g=f.getBoundingClientRect()}while(h!=Math.ceil(g.width)||m!=Math.ceil(g.height));d.setAttribute("width",h),d.setAttribute("height",m),u.setAttribute("width",h+50),u.setAttribute("height",m+50);for(var v,y,b=null,_=null,w=null,x=1/0,C=1/0,A=0;A<t._directions.length;A++){var k=t._directions[A],E=Oe(k,h,m,n,r,i),T=Math.max(0,Math.floor(i.left)-E.left-15)+Math.max(0,E.right-Math.ceil(i.right)-15),L=Math.max(0,Math.floor(i.top)-E.top-15)+Math.max(0,E.bottom-Math.ceil(i.bottom)-15);if(0==T&&0==L){b=k;break}(T<x||T==x&&L<v)&&(x=T,v=L,_=k),(L<C||L==C&&T<y)&&(C=L,y=T,w=k)}return b?k=b:"horizontal"==t._fallbackFit?k=_:"vertical"==t._fallbackFit?k=w:(console.warn("Popup: failed to point box of size ("+h+", "+m+") at ("+n+", "+r+") within ("+i.left+", "+i.top+", "+i.right+", "+i.bottom+")"),k=t._directions[0]),function(t,e,n,r,i,o,a,s,l,u){var c=Me[t](r,i,s,l,u);e.left=o-De-c.pos[0]+"px",e.top=a-De-c.pos[1]+"px",n.setAttribute("d","M0,0L"+c.shape.join(",")+"Z"),n.setAttribute("transform","translate("+(c.pos[0]+De)+","+(c.pos[1]+De)+")")}(k,l,p,h,m,o,a,n,r,i),t}console.error("Popup: cannot draw popup till point() has been specified")},ze.prototype.hide=function(){return this.is_visible?(this.is_visible=!1,this._getElement().style.display="none",this):this},qe.version="2.1.5";const Ge=Math.pow(2,31)-1,Ze=Math.pow(2,15);function Xe(t,e){if(t=t.toUpperCase(),!/^[A-Z]+$/.test(t)){if(!t){if(e)return-1;throw new Error("Non-optional data binding must specify column")}throw function(t){try{tn(t)}catch(t){return!1}return!0}(t)?new Error("You can only select one column"):new Error("Invalid column specification: "+t)}for(var n=0,r=0;r<t.length;r++)n=26*n+(t.charCodeAt(r)-64);return n-1>Ge&&console.warn("Column index out of range"),Math.min(n-1,Ge)}function Je(t){t+=1;for(var e="";t>0;){var n=Math.floor(t/26),r=t%26;0==r&&(n-=1,r+=26),e=String.fromCharCode(64+r)+e,t=n}return e}function Ke(t){var e=t.match(/\s*(?:[-–—:]|\.\.)\s*/);if(!e)throw new Error("Failed to parse column range: "+t);var n=t.substr(0,e.index),r=t.substr(e.index+e[0].length),i=Xe(n),o=Xe(r),a=[],s=o>=i?1:-1,l=Math.abs(o-i)+1;l>Ze&&(console.warn("Truncating excessively long range"),l=Ze);for(var u=0;u<l;u++)a.push(i+u*s);return a}function Qe(t,e){return Je(t)+"-"+Je(e)}function tn(t){var e=[],n=(t=t.replace(/^\s+|\s+$/g,"")).split(/\s*,\s*/);1==n.length&&""===n[0]&&(n=[]);for(var r=0;r<n.length;r++){var i=n[r];/^[A-Za-z]+$/.test(i)?e.push(Xe(i)):Array.prototype.push.apply(e,Ke(i))}return e}function en(t){for(var e=function(t){if(!t.length)return[];for(var e=[],n=t[0],r=t[0],i=null,o=0;o<t.length-1;o++){var a=t[o+1]-t[o];null!==i||1!==Math.abs(a)?a!==i?(e.push([n,r]),n=r=t[o+1],i=null):r=t[o+1]:(r=t[o+1],i=a)}return e.push([n,r]),e}(t),n=[],r=0;r<e.length;r++){var i=e[r];i[0]==i[1]?n.push(Je(i[0])):n.push(Qe(i[0],i[1]))}return n.join(",")}function nn(t,e,n,r){var i=n?e[t.data_table_id]+"::":"";if("column"in t)return i+Je(t.column);if("columns"in t)return i+en(t.columns);if(r)return"";throw new Error("Data binding must have .column or .columns")}var rn=new Date,on=new Date;function an(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=function(e){return t(e=new Date(+e)),e},i.ceil=function(n){return t(n=new Date(n-1)),e(n,1),t(n),n},i.round=function(t){var e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=function(t,n){return e(t=new Date(+t),null==n?1:Math.floor(n)),t},i.range=function(n,r,o){var a,s=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return s;do{s.push(a=new Date(+n)),e(n,o),t(n)}while(a<n&&n<r);return s},i.filter=function(n){return an((function(e){if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)}),(function(t,r){if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}))},n&&(i.count=function(e,r){return rn.setTime(+e),on.setTime(+r),t(rn),t(on),Math.floor(n(rn,on))},i.every=function(t){return t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?function(e){return r(e)%t==0}:function(e){return i.count(0,e)%t==0}):i:null}),i}var sn=864e5,ln=6048e5,un=an((function(t){t.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/sn}),(function(t){return t.getDate()-1})),cn=un;function dn(t){return an((function(e){e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)}),(function(t,e){t.setDate(t.getDate()+7*e)}),(function(t,e){return(e-t-6e4*(e.getTimezoneOffset()-t.getTimezoneOffset()))/ln}))}un.range;var pn=dn(0),fn=dn(1),hn=dn(2),mn=dn(3),gn=dn(4),vn=dn(5),yn=dn(6);pn.range,fn.range,hn.range,mn.range,gn.range,vn.range,yn.range;var bn=an((function(t){t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,e){t.setFullYear(t.getFullYear()+e)}),(function(t,e){return e.getFullYear()-t.getFullYear()}),(function(t){return t.getFullYear()}));bn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,n){e.setFullYear(e.getFullYear()+n*t)})):null};var _n=bn;bn.range;var wn=an((function(t){t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+e)}),(function(t,e){return(e-t)/sn}),(function(t){return t.getUTCDate()-1})),xn=wn;function Cn(t){return an((function(e){e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCDate(t.getUTCDate()+7*e)}),(function(t,e){return(e-t)/ln}))}wn.range;var An=Cn(0),kn=Cn(1),En=Cn(2),Tn=Cn(3),Ln=Cn(4),Dn=Cn(5),Fn=Cn(6);An.range,kn.range,En.range,Tn.range,Ln.range,Dn.range,Fn.range;var Sn=an((function(t){t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,e){t.setUTCFullYear(t.getUTCFullYear()+e)}),(function(t,e){return e.getUTCFullYear()-t.getUTCFullYear()}),(function(t){return t.getUTCFullYear()}));Sn.every=function(t){return isFinite(t=Math.floor(t))&&t>0?an((function(e){e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,n){e.setUTCFullYear(e.getUTCFullYear()+n*t)})):null};var Mn=Sn;function Nn(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Un(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function On(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}Sn.range;var Bn,Hn,Rn,jn={"-":"",_:" ",0:"0"},In=/^\s*\d+/,zn=/^%/,Pn=/[\\^$*+?|[\]().{}]/g;function $n(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function qn(t){return t.replace(Pn,"\\$&")}function Vn(t){return new RegExp("^(?:"+t.map(qn).join("|")+")","i")}function Yn(t){for(var e={},n=-1,r=t.length;++n<r;)e[t[n].toLowerCase()]=n;return e}function Wn(t,e,n){var r=In.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Gn(t,e,n){var r=In.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function Zn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Xn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Jn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function Kn(t,e,n){var r=In.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function Qn(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function tr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function er(t,e,n){var r=In.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function nr(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function rr(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function ir(t,e,n){var r=In.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function or(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function ar(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function sr(t,e,n){var r=In.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function lr(t,e,n){var r=In.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function ur(t,e,n){var r=In.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function cr(t,e,n){var r=zn.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function dr(t,e,n){var r=In.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function pr(t,e,n){var r=In.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function fr(t,e){return $n(t.getDate(),e,2)}function hr(t,e){return $n(t.getHours(),e,2)}function mr(t,e){return $n(t.getHours()%12||12,e,2)}function gr(t,e){return $n(1+cn.count(_n(t),t),e,3)}function vr(t,e){return $n(t.getMilliseconds(),e,3)}function yr(t,e){return vr(t,e)+"000"}function br(t,e){return $n(t.getMonth()+1,e,2)}function _r(t,e){return $n(t.getMinutes(),e,2)}function wr(t,e){return $n(t.getSeconds(),e,2)}function xr(t){var e=t.getDay();return 0===e?7:e}function Cr(t,e){return $n(pn.count(_n(t)-1,t),e,2)}function Ar(t){var e=t.getDay();return e>=4||0===e?gn(t):gn.ceil(t)}function kr(t,e){return t=Ar(t),$n(gn.count(_n(t),t)+(4===_n(t).getDay()),e,2)}function Er(t){return t.getDay()}function Tr(t,e){return $n(fn.count(_n(t)-1,t),e,2)}function Lr(t,e){return $n(t.getFullYear()%100,e,2)}function Dr(t,e){return $n((t=Ar(t)).getFullYear()%100,e,2)}function Fr(t,e){return $n(t.getFullYear()%1e4,e,4)}function Sr(t,e){var n=t.getDay();return $n((t=n>=4||0===n?gn(t):gn.ceil(t)).getFullYear()%1e4,e,4)}function Mr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+$n(e/60|0,"0",2)+$n(e%60,"0",2)}function Nr(t,e){return $n(t.getUTCDate(),e,2)}function Ur(t,e){return $n(t.getUTCHours(),e,2)}function Or(t,e){return $n(t.getUTCHours()%12||12,e,2)}function Br(t,e){return $n(1+xn.count(Mn(t),t),e,3)}function Hr(t,e){return $n(t.getUTCMilliseconds(),e,3)}function Rr(t,e){return Hr(t,e)+"000"}function jr(t,e){return $n(t.getUTCMonth()+1,e,2)}function Ir(t,e){return $n(t.getUTCMinutes(),e,2)}function zr(t,e){return $n(t.getUTCSeconds(),e,2)}function Pr(t){var e=t.getUTCDay();return 0===e?7:e}function $r(t,e){return $n(An.count(Mn(t)-1,t),e,2)}function qr(t){var e=t.getUTCDay();return e>=4||0===e?Ln(t):Ln.ceil(t)}function Vr(t,e){return t=qr(t),$n(Ln.count(Mn(t),t)+(4===Mn(t).getUTCDay()),e,2)}function Yr(t){return t.getUTCDay()}function Wr(t,e){return $n(kn.count(Mn(t)-1,t),e,2)}function Gr(t,e){return $n(t.getUTCFullYear()%100,e,2)}function Zr(t,e){return $n((t=qr(t)).getUTCFullYear()%100,e,2)}function Xr(t,e){return $n(t.getUTCFullYear()%1e4,e,4)}function Jr(t,e){var n=t.getUTCDay();return $n((t=n>=4||0===n?Ln(t):Ln.ceil(t)).getUTCFullYear()%1e4,e,4)}function Kr(){return"+0000"}function Qr(){return"%"}function ti(t){return+t}function ei(t){return Math.floor(+t/1e3)}function ni(t){throw new TypeError("Expected a value of type string but got a value of type "+typeof t)}function ri(t){return function(e){return"string"!=typeof e&&ni(e),(e=e.trim())?t(e):null}}Bn=function(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,u=Vn(i),c=Yn(i),d=Vn(o),p=Yn(o),f=Vn(a),h=Yn(a),m=Vn(s),g=Yn(s),v=Vn(l),y=Yn(l),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:fr,e:fr,f:yr,g:Dr,G:Sr,H:hr,I:mr,j:gr,L:vr,m:br,M:_r,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:ti,s:ei,S:wr,u:xr,U:Cr,V:kr,w:Er,W:Tr,x:null,X:null,y:Lr,Y:Fr,Z:Mr,"%":Qr},_={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:Nr,e:Nr,f:Rr,g:Zr,G:Jr,H:Ur,I:Or,j:Br,L:Hr,m:jr,M:Ir,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:ti,s:ei,S:zr,u:Pr,U:$r,V:Vr,w:Yr,W:Wr,x:null,X:null,y:Gr,Y:Xr,Z:Kr,"%":Qr},w={a:function(t,e,n){var r=f.exec(e.slice(n));return r?(t.w=h[r[0].toLowerCase()],n+r[0].length):-1},A:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p[r[0].toLowerCase()],n+r[0].length):-1},b:function(t,e,n){var r=v.exec(e.slice(n));return r?(t.m=y[r[0].toLowerCase()],n+r[0].length):-1},B:function(t,e,n){var r=m.exec(e.slice(n));return r?(t.m=g[r[0].toLowerCase()],n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:rr,e:rr,f:ur,g:Qn,G:Kn,H:or,I:or,j:ir,L:lr,m:nr,M:ar,p:function(t,e,n){var r=u.exec(e.slice(n));return r?(t.p=c[r[0].toLowerCase()],n+r[0].length):-1},q:er,Q:dr,s:pr,S:sr,u:Gn,U:Zn,V:Xn,w:Wn,W:Jn,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:Qn,Y:Kn,Z:tr,"%":cr};function x(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,u=t.length;for(n instanceof Date||(n=new Date(+n));++s<u;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=jn[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function C(t,e){return function(n){var r,i,o=On(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Un(On(o.y,0,1))).getUTCDay(),r=i>4||0===i?kn.ceil(r):kn(r),r=xn.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Nn(On(o.y,0,1))).getDay(),r=i>4||0===i?fn.ceil(r):fn(r),r=cn.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Un(On(o.y,0,1)).getUTCDay():Nn(On(o.y,0,1)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Un(o)):Nn(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=w[i in jn?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=x(n,b),b.X=x(r,b),b.c=x(e,b),_.x=x(n,_),_.X=x(r,_),_.c=x(e,_),{format:function(t){var e=x(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=C(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=x(t+="",_);return e.toString=function(){return t},e},utcParse:function(t){var e=C(t+="",!0);return e.toString=function(){return t},e}}}({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}),Bn.format,Bn.parse,Hn=Bn.utcFormat,Rn=Bn.utcParse;var ii=new Date(1972,3,27,19,45,5),oi={"%b %d":[{regex:/^june\s(30|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,5,t.split(/\s/)[1])}},{regex:/^july\s(3[01]|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,6,t.split(/\s/)[1])}},{regex:/^sept\s(30|[12][0-9]|0?[1-9])$/i,toDate:function(t){return new Date(null,8,t.split(/\s/)[1])}}],"%d %b":[{regex:/^(0?[1-9]|[1-9][0-9])\sjune$/i,toDate:function(t){return new Date(null,5,t.split(/\s/)[0])}},{regex:/^(0?[1-9]|[1-9][0-9])\sjuly$/i,toDate:function(t){return new Date(null,6,t.split(/\s/)[0])}},{regex:/^(0?[1-9]|[1-9][0-9])\ssept$/i,toDate:function(t){return new Date(null,8,t.split(/\s/)[0])}}]};function ai(t){return function(e){var n=null;return t.forEach((function(t){e.match(t.regex)&&(n=t.toDate(e))})),n}}function si(t,e){var n,r=Rn(t),i=Hn(t);return n=ri("function"==typeof e?function(t){return e(t,null!==r(t))}:function(t){return null!==r(t)}),Object.freeze({test:n,parse:ri((function(e){return r(e)||(oi[t]?ai(oi[t])(e):null)})),format:function(t){return i(t)},type:"datetime",description:t,id:"datetime$"+t,example:i(ii)})}var li=Object.freeze([si("%Y-%m-%dT%H:%M:%S.%LZ"),si("%Y-%m-%d %H:%M:%S"),si("%Y-%m-%dT%H:%M:%S"),si("%Y-%m-%dT%H:%M:%SZ"),si("%d/%m/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),si("%d/%m/%Y %H:%M",(function(t,e){if(!e)return!1;var n=t.split(/[/ :]/).map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),si("%d/%m/%y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&!isNaN(n[2])})),si("%m/%d/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3})),si("%m/%d/%Y %H:%M",(function(t,e){if(!e)return!1;var n=t.split(/[/ :]/).map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3&&n[3]>=0&&n[3]<24&&n[4]>=0&&n[4]<60})),si("%m/%d/%y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),si("%Y/%m/%d",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12&&n[2]>0&&n[2]<=31})),si("%d-%m-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),si("%d-%m-%y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&!isNaN(n[2])})),si("%d.%m.%Y",(function(t,e){if(!e)return!1;var n=t.split(".").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12&&n[2]>=1e3})),si("%m.%d.%y",(function(t,e){if(!e)return!1;var n=t.split(".").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),si("%m-%d-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&n[2]>=1e3})),si("%m-%d-%y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>0&&n[1]<=31&&!isNaN(n[2])})),si("%Y-%m-%d",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12&&n[2]>0&&n[2]<=31})),si("%Y-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>=1e3&&n[1]>0&&n[1]<=12})),si("%d %b %Y",(function(t,e){if(!e)return!1;var n=t.split(" ").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d %B %Y",(function(t,e){if(!e)return!1;var n=t.split(" ").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d %b %y"),si("%-d %b ’%y"),si("%d %B %y"),si("%d-%b-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d-%B-%Y",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[2]>=1e3})),si("%d-%b-%y"),si("%d-%B-%y"),si("%m/%Y",(function(t,e){if(!e)return!1;var n=t.split("/").map(parseFloat);return n[0]>0&&n[0]<=12&&n[1]>=1e3})),si("%m/%y"),si("%b %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),si("%B %Y",(function(t,e){return!!e&&t.split(" ").map(parseFloat)[1]>=1e3})),si("%b-%y"),si("%b %y"),si("%B %y"),si("%b '%y"),si("%B %-d %Y"),si("%d %b",(function(t,e){return!!e||!!ai(oi["%d %b"])(t)})),si("%d %B"),si("%b %d",(function(t,e){return!!e||!!ai(oi["%b %d"])(t)})),si("%B %d"),si("%d-%m",(function(t,e){if(!e)return!1;var n=t.split("-").map(parseFloat);return n[0]>0&&n[0]<=31&&n[1]>0&&n[1]<=12})),si("%m-%d"),si("%d/%m"),si("%m/%d"),si("%b %d %Y"),si("%b %d %Y, %-I.%M%p"),si("%Y",(function(t,e){if(!e)return!1;var n=parseFloat(t);return n>1499&&n<2200})),si("%B"),si("%b"),si("%X"),si("%I:%M %p"),si("%-I.%M%p"),si("%H:%M",(function(t,e){if(!e)return!1;var n=t.split(":").map(parseFloat);return n[0]>=0&&n[0]<24})),si("%H:%M:%S"),si("%M:%S"),si("%-I%p"),si("Q%q %Y",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length})),si("%Y Q%q",(function(t,e){return!!e&&6===t.replace(/\s/g,"").length}))]);function ui(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}var ci,di=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){if(!(e=di.exec(t)))throw new Error("invalid format: "+t);var e;return new fi({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function fi(t){this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}function hi(t,e){var n=ui(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}pi.prototype=fi.prototype,fi.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type};var mi={"%":function(t,e){return(100*t).toFixed(e)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},g:function(t,e){return t.toPrecision(e)},o:function(t){return Math.round(t).toString(8)},p:function(t,e){return hi(100*t,e)},r:hi,s:function(t,e){var n=ui(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(ci=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ui(t,Math.max(0,e+o-1))[0]},X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}};function gi(t){return t}var vi=Array.prototype.map,yi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function bi(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?gi:(e=vi.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?gi:function(t){return function(e){return e.replace(/[0-9]/g,(function(e){return t[+e]}))}}(vi.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",u=void 0===t.minus?"-":t.minus+"",c=void 0===t.nan?"NaN":t.nan+"";function d(t){var e=(t=pi(t)).fill,n=t.align,d=t.sign,p=t.symbol,f=t.zero,h=t.width,m=t.comma,g=t.precision,v=t.trim,y=t.type;"n"===y?(m=!0,y="g"):mi[y]||(void 0===g&&(g=12),v=!0,y="g"),(f||"0"===e&&"="===n)&&(f=!0,e="0",n="=");var b="$"===p?i:"#"===p&&/[boxX]/.test(y)?"0"+y.toLowerCase():"",_="$"===p?o:/[%p]/.test(y)?l:"",w=mi[y],x=/[defgprs%]/.test(y);function C(t){var i,o,l,p=b,C=_;if("c"===y)C=w(t)+C,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?c:w(Math.abs(t),g),v&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0==+t&&"+"!==d&&(A=!1),p=(A?"("===d?d:u:"-"===d||"("===d?"":d)+p,C=("s"===y?yi[8+ci/3]:"")+C+(A&&"("===d?")":""),x)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){C=(46===l?a+t.slice(i+1):t.slice(i))+C,t=t.slice(0,i);break}}m&&!f&&(t=r(t,1/0));var k=p.length+t.length+C.length,E=k<h?new Array(h-k+1).join(e):"";switch(m&&f&&(t=r(E+t,E.length?h-C.length:1/0),E=""),n){case"<":t=p+t+C+E;break;case"=":t=p+E+t+C;break;case"^":t=E.slice(0,k=E.length>>1)+p+t+C+E.slice(k);break;default:t=E+p+t+C}return s(t)}return g=void 0===g?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),C.toString=function(){return t+""},C}return{format:d,formatPrefix:function(t,e){var n,r=d(((t=pi(t)).type="f",t)),i=3*Math.max(-8,Math.min(8,Math.floor((n=e,((n=ui(Math.abs(n)))?n[1]:NaN)/3)))),o=Math.pow(10,-i),a=yi[8+i/3];return function(t){return r(o*t)+a}}}}var _i={test:ri((function(t){return/^(\+|-)?\d{1,3}(,\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/,/g,""))})),description:"Comma thousand separator, point decimal mark",thousand_separator:",",decimal_mark:".",id:"number$comma_point",example:"12,235.56"},wi={test:ri((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/\s/g,""))})),description:"Space thousand separator, point decimal mark",thousand_separator:" ",decimal_mark:".",id:"number$space_point",example:"12 235.56"},xi={test:ri((function(t){return/^(\+|-)?\d+(\.\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t)})),description:"No thousand separator, point decimal mark",thousand_separator:"",decimal_mark:".",id:"number$none_point",example:"12235.56"},Ci={test:ri((function(t){return/^(\+|-)?\d{1,3}(\.\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/\./g,"").replace(/,/,"."))})),description:"Point thousand separator, comma decimal mark",thousand_separator:".",decimal_mark:",",id:"number$point_comma",example:"12.235,56"},Ai={test:ri((function(t){return/^(\+|-)?\d{1,3}(\s\d{3})*(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/\s/g,"").replace(/,/,"."))})),description:"Space thousand separator, comma decimal mark",thousand_separator:" ",decimal_mark:",",id:"number$space_comma",example:"12 235,56"},ki={test:ri((function(t){return/^(\+|-)?\d+(,\d+)?((e|E)(\+|-)?\d+)?$/.test(t.trim())})),parse:ri((function(t){return parseFloat(t.replace(/,/,"."))})),description:"No thousand separator, comma decimal mark",thousand_separator:"",decimal_mark:",",id:"number$none_comma",example:"12235,56"},Ei=Object.freeze([_i,wi,Ci,Ai,xi,ki]);Ei.forEach((function(t){t.type="number",t.format=function(t){var e,n,r=bi({decimal:t.decimal_mark,thousands:t.thousand_separator,grouping:[3],currency:["",""]});return function(t,i){return null===t?"":(i||(i=",.2f"),i!==n&&(n=i,e=r.format(n)),e(t))}}(t),Object.freeze(t)}));var Ti,Li=Object.freeze({test:function(t){return"string"==typeof t||ni(t)},parse:function(t){return"string"==typeof t?t:ni(t)},format:function(t){if("string"==typeof t)return t},type:"string",description:"Arbitrary string",id:"string$arbitrary_string"}),Di=Object.freeze({datetime:li,number:Ei}),Fi=Object.freeze(["datetime","number","string"]),Si=Object.freeze({n_max:250,n_failing_values:0,failure_fraction:.05,sort:!0}),Mi=Object.freeze(Object.keys(Si));function Ni(t,e){return t.index-e.index}function Ui(t,e){return e.n_success-t.n_success||Ni(t,e)}function Oi(t){return(""+t).trim()}function Bi(t){return void 0===t?function(t){return Oi(t)}:"function"==typeof t?function(e,n){return Oi(t(e,n))}:function(e){return Oi(e[""+t])}}function Hi(t){t?Array.isArray(t)||(t=[t]):t=Fi;var e=t.reduce((function(t,e){var n=Di[e];return n&&Array.prototype.push.apply(t,n),t}),[]),n=-1!==t.indexOf("string"),r=Mi.reduce((function(t,e){return t[e]=Si[e],t}),{}),i=function(t,i){i=Bi(i);var o=t.map(i).filter((function(t){return t}));if(!o.length)return n?[Li]:[];var a=Math.min(r.n_max,o.length),s=Math.floor(a*r.failure_fraction),l=r.n_failing_values,u=r.sort?Ui:Ni,c=e.slice().reduce((function(t,e,n){for(var r=c=0,i=[],u=!1,c=0;c<a;c++){var d=o[c];if(!e.test(d)&&(++r>s?u=!0:-1===i.indexOf(d)&&(i.push(d),i.length>l&&(u=!0)),u))break}return u||t.push({interp:e,n_success:a-r,index:n}),t}),[]).sort(u).map((function(t){return t.interp}));return n&&c.push(Li),c};return Mi.forEach((function(t){var e;i[(e=t,e.replace(/_(\w)/g,(function(t,e){return e.toUpperCase()})))]=function(e){return void 0===e?r[t]:(r[t]=e,i)}})),i}function Ri(t,e,n,r){var i=[],o=[],a=0,s=[],l={};function u(t,e){if(!l[t])return{};var n=l[t];return n[e]?n[e]:{}}for(var c in s.column_names={},s.metadata={},n){var d={},p=n[c];if(p){for(let t=0;t<p.length;t++){const e=p[t].type_id,n=p[t].output_format_id,r=n&&"auto"!==n?n:e;d[p[t].index]={type_id:e,output_format_id:r}}l[c]=d}}for(var f in t)if(null!==t[f]&&(void 0!==t[f].columns||void 0!==t[f].column)){var h=t[f];if(h.template_data_binding=r[f],h.key=f,h.data_table_id in e){var m=e[h.data_table_id];if(0!=m.length){if("columns"in h&&null!=h.columns){var g=m[0].length;h.columns=h.columns.filter((function(t){return t<g})),s.column_names[f]=h.columns.map((function(t){return m[0][t]})),s.metadata[f]=h.columns.map((function(t){const{type_id:e,output_format_id:n}=u(h.data_table_id,t);return e?{type:e.split("$")[0],type_id:e,output_format_id:n}:null}))}else{if(!("column"in h)||null==h.column)throw new Error("Data binding includes no column(s) specification: "+JSON.stringify(h));{s.column_names[f]=m[0][h.column];const{type_id:t,output_format_id:e}=u(h.data_table_id,h.column);t&&(s.metadata[f]={type:t.split("$")[0],type_id:t,output_format_id:e})}}-1==o.indexOf(h.data_table_id)&&(o.push(h.data_table_id),a=Math.max(a,m.length-1)),i.push(h)}else console.warn("Empty data table")}else{var v=[];for(var y in e)v.push(y);console.error("Data table id "+h.data_table_id+" not in "+JSON.stringify(v))}}function b(t,e,n){if(!t.template_data_binding.data_type)return n;var r=function(t,e){const{type_id:n}=u(t,e);if(n)return Hi.getInterpretation(n)}(t.data_table_id,e);r&&"number"==r.type&&(n=$i(n));var i=r?r.parse(n):n;return Number.isNaN(i)&&(i=null),i}for(var _=0;_<a;_++){for(var w={},x=0;x<i.length;x++){var C=e[(h=i[x]).data_table_id];_+1>=C.length||("columns"in h&&null!=h.columns?w[h.key]=h.columns.filter((function(t){return t<C[_+1].length})).map((function(t){return b(h,t,C[_+1][t])})):"column"in h&&null!=h.column&&(h.column>=C[_+1].length?w[h.key]=b(h,h.column,""):w[h.key]=b(h,h.column,C[_+1][h.column])))}s.push(w)}return s}function ji(t){return function(t){for(var e=t.length,n=e>0?t[0].length:0,r=[],i=0;i<n;i++){for(var o=[],a=0;a<e;a++)o.push(t[a][i]);r.push(o)}return r}(t).map((function(t,e){const n=function(t){const e=t.length;return e>100?t.slice(10,e-10):e>50?t.slice(5,e-5):e>30?t.slice(4,e-4):e>20?t.slice(3,e-3):e>10?t.slice(2,e-2):e>1?t.slice(1,e):t.slice(0,1)}(t);let r;r=n.length>2e3?function(t,e){if(t.length<=2*e)return t;const n=function(t){let e=t;return function(){e|=0,e=e+1831565813|0;var t=Math.imul(e^e>>>15,1|e);return(((t=t+Math.imul(t^t>>>7,61|t)^t)^t>>>14)>>>0)/4294967296}}(t.length);for(;t.length>e;){const e=Math.floor(n()*t.length);t.splice(e,1)}return t}(n,1e3):n;const i=(o=r,a=o.filter((function(t){return t&&!zi.includes(t.trim())})).map($i),Pi(a))[0].id;var o,a;return{type_id:i,index:e,output_format_id:i}}))}function Ii(t){for(var e=t.length;e-- >1&&(!t[e]||!t[e].length||Array.isArray(t[e])&&-1==t[e].findIndex((function(t){return null!==t&&""!==t})));)t.splice(e,1);return t}Hi.DATETIME_IDS=Object.freeze(li.map((function(t){return t.id}))),Hi.NUMBER_IDS=Object.freeze(Ei.map((function(t){return t.id}))),Hi.STRING_IDS=Object.freeze([Li.id]),Hi.getInterpretation=(Ti=li.concat(Ei,Li).reduce((function(t,e){return t[e.id]=e,t}),{}),function(t){return Ti[t]}),Hi._createAccessorFunction=Bi,Array.prototype.findIndex||Object.defineProperty(Array.prototype,"findIndex",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],i=0;i<n;){var o=e[i];if(t.call(r,o,i,e))return i;i++}return-1},configurable:!0,writable:!0});var zi=["#DIV/0","#N/A","#NAME?","#NULL!","#NUM!","#REF!","#VALUE!","#ERROR!"],Pi=Hi().nMax(1/0).nFailingValues(8).failureFraction(.1);function $i(t){return(t=t||"").replace(/[€£$¥%º]/g,"")}let qi,Vi={};const Yi=t=>{const e=At(".dialog");if(t.which in Vi){var n=Vi[t.which];n.callback&&n.callback(qi.node().value),e.remove(),t.preventDefault()}};function Wi(t,e,{buttons:n=[{text:"Okay",keyCode:13}],is_html:r=!1,upgrade:i=null,is_loading:o=!1,width:a="420px",on_close:s=null}={}){var l=At("body").append("div").attr("class","dialog").attr("tabindex",0).on("mousedown",(function(t){for(var e=t.target,n=!1;e&&"dialog"!=e.className;)"dialog"==(e=e.parentNode).className&&(n=!0);n||(s&&s(),l.remove())})),u=l.append("div").attr("class","dialog-inner").style("width",a).on("click",(function(t){t.stopPropagation()})),c=u.append("div").attr("class","text"+(o?" loading":""));if("string"==typeof t?c.append("h1").text(t):t instanceof HTMLElement&&c.append("h1").append((()=>t)),"string"==typeof e)qi=r?c.append("div").classed("loading-spinner",o).html(e):c.append("p").text(e);else if(e instanceof HTMLElement)qi=c.append((()=>e));else if("object"==typeof e){if(qi=c.append(e.type),e.value&&(qi.node().value=e.value),e.attributes)for(var d in e.attributes)qi.attr(d,e.attributes[d]);qi.node().focus()}var p=u;null!=i&&"object"==typeof i&&function(t,e,n,r){r&&t.classed("business",!0);var i=t.append("div").attr("class","text");i.append("p").text(e),i.append("ul").selectAll("li").data(n).enter().append("li").html((function(t){return t})).append("i").attr("class","fa fa-check")}(p=p.append("div").attr("class","upgrade"),i.message,i.list,i.is_business);var f=p.append("div").attr("class","btns"+(o?" loading":""));return Vi={},n.forEach((function(t){var e=f.append(t.tag_name||"div").attr("class","btn").attr("data-testid","dialog-button").style("margin-right",o?"0":"0.75em").text(t.text).on("click",(function(){t.callback&&t.callback(qi.node().value,l),l.remove()}));t.class&&e.classed(t.class,!0),t.keyCode&&(Vi[t.keyCode]=t),t.href&&e.attr("href",t.href),t.target&&e.attr("target",t.target),t.fa_icon&&e.append("i").lower().attr("class","fa "+t.fa_icon)})),l.node().addEventListener("keydown",Yi),l.node().focus(),l}const Gi={allow_other_option:!1,match_anywhere:!1,custom_renderer:null,autocomplete:!0};function Zi({input:t,id:e,options:n=[],mode:r="single",options_config:i={}}){if(t&&e){this.input=t,this.id=e,this.mode=["single","multi"].includes(r)?r:"single",this.options=(Array.isArray(n)?n:[n]).map(Ji),this.selected_options=[],this.options_config={...Gi,...i},this.options_config.allow_other_option&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": it's not possible to allow other options in multi mode."),this.options_config.allow_other_option=!1),this.options_config.autocomplete&&"multi"===this.mode&&(console.warn("Warning for dropdown "+e+": autocomplete will be disabled in multi mode."),this.options_config.autocomplete=!1),this.autocomplete=this.initAutocomplete(),this.changeCallback=function(){};var o=this;this.input.type="text",this.input.classList.add("multi"==r?"multi-select":"single-select"),this.input.addEventListener("change",(function(t){o.changeCallback.call(o.input,o.getValue(),t)})),this.setOptions(n),this.options_config.autocomplete||(this.input.setAttribute("readonly",!0),this.input.style.cursor="pointer")}else console.error("Can't initialize a dropdown without input or id")}function Xi(t){var e=t.options.filter((e=>t.selected_options.includes(e[1])));return t.selected_options.length&&!e.length&&t.options_config.allow_other_option&&(e=[[t.selected_options[0],t.selected_options[0]]]),e}function Ji(t){return Array.isArray(t)?t.map(String):[String(t),String(t)]}Zi.prototype.setSelectedOptions=function(t){this.selected_options=Array.isArray(t)?t:[t],this.updateInput()},Zi.prototype.setOptions=function(t){this.options=t.map(Ji),this.autocomplete.renderOptions()},Zi.prototype.select=function(t){"multi"==this.mode?this.selected_options.push(t):this.selected_options=[t],this.updateInput()},Zi.prototype.deselect=function(t){if("single"!=this.mode){var e=this.selected_options.indexOf(t);e>-1&&this.selected_options.splice(e,1),this.updateInput()}},Zi.prototype.getValue=function(t){var e=Xi(this).map((t=>t[1]));return"multi"===this.mode?t?e.join(", "):e:e[0]},Zi.prototype.getOptions=function(){return this.options},Zi.prototype.getDisplayValue=function(){return Xi(this).map((t=>t[0])).join(", ")},Zi.prototype.updateInput=function(){this.input.value=this.getDisplayValue(),this.input.setAttribute("data-value",this.getValue(!0))},Zi.prototype.isSelected=function(t){return this.selected_options.includes(t)},Zi.prototype.onChange=function(t){this.changeCallback=t};Zi.prototype.initAutocomplete=function(){var t=this,e=this.options_config,n=this.input;if(n.setAttribute("data-autocomplete",this.id),n.setAttribute("autocomplete","off"),!document.getElementById(this.id)){const t=kt("i").classed("fa fa-chevron-down clickable",!0),e=kt("div").classed("dropdown autocomplete",!0).attr("id",this.id);n.insertAdjacentHTML("afterend",t.node().outerHTML+e.node().outerHTML)}var r=[],i=At(document.getElementById(this.id));i.classed("click-to-open",!0);var o=i.append("div").attr("class","dropdown-list");function a(t){if(1===t.length)return"dropdown-category";var e="dropdown-item";return r.length&&r.includes(t[1])&&(e+=" current"),e}function s(n){var r=n||t.options;o.selectAll("div").remove(),o.selectAll("div").data(r).enter().append("div").attr("class",a).attr("data-value",(function(t){return"string"==typeof t?t||null:t[1]})).each((function(t){const n=At(this);if(!e.custom_renderer){const e=Array.isArray(t)?t[0]:t;return void n.text(e)}let r=e.custom_renderer(t,this);if(r){if(Array.isArray(r)||(r=[r]),r.find((t=>"string"!=typeof t&&!(t instanceof HTMLElement))))throw new Error("Autocomplete elements must be strings or HTMLElements");n.node().append(...r)}})),r.length||o.append("div").attr("class","dropdown-item disabled").text("No matches found")}function l(){i.classed("open",!1)}function u(e,r){if(r.hasAttribute("data-value")){var i=r.getAttribute("data-value");At(r).classed("current")&&"multi"===t.mode?t.deselect(i):t.select(i),l(),At(n).dispatch("change")}else e.preventDefault()}return i.on("mousedown",(function(t){u(t,t.target)})),At(n).on("keydown.autocomplete",(function(t){var e,r;9==t.keyCode||13==t.keyCode?(e=o.select(".selected")).empty()||(u(t,e.node()),n.blur()):40==t.keyCode?((e=o.select(".selected")).empty()||(r=e.node().nextSibling),r||(r=o.select(".dropdown-item[data-value]").node()),o.selectAll(".selected").classed("selected",!1),At(r).classed("selected",!0)):38==t.keyCode&&((e=o.select(".selected")).empty()||(r=e.node().previousSibling),r||(r=o.select(".dropdown-item:last-child").node()),o.selectAll(".selected").classed("selected",!1),At(r).classed("selected",!0))})).on("input.autocomplete",(function(){var r,i,o=n.value,a=o.toLowerCase(),l=!1,u=t.options;if(At(n).attr("data-value",o),i=e.match_anywhere?(t,e)=>t.includes(e):(t,e)=>0===t.indexOf(e),o){r=[];for(var c=0;c<u.length;c++){var d=("string"==typeof u[c]?u[c]:u[c][0]).toLowerCase();d==a&&(l=!0),i(d,a)&&r.push(u[c])}e.allow_other_option&&!l&&r.unshift(["Add new value: "+o,o])}else r=u;s(r)})).on("focus.autocomplete",(function(){var e=t.getValue();r=Array.isArray(e)?e:[e],s(t.options),i.classed("open",!0)})).on("blur.autocomplete",l),{renderOptions:s}};var Ki={number:{text:"Number",symbol:"/images/data_type_number.svg"},datetime:{text:"Date/time",symbol:"/images/data_type_date.svg"},string:{text:"Text",symbol:"/images/data_type_string.svg"}};Hi.STRING_IDS[0];var Qi,to,eo,no=[{full:"#F4B1C5",light:"#FFDDE7"},{full:"#967EC6",light:"#D0C5E5"},{full:"#C67EBD",light:"#E5C5E1"},{full:"#7E91C6",light:"#C5CDE5"},{full:"#7EB0C6",light:"#C5DBE5"},{full:"#7EC69B",light:"#C5E5D2"},{full:"#B3C67E",light:"#DDE5C5"},{full:"#C69B7E",light:"#E5D2C5"}],ro={},io={},oo=0;function ao(t,e){oo=0;var n=!1;t.template_id&&t.dataTables((function(r,i){if(r)return console.error("Failed to get data tables: "+r);io={};var o=t.dataBindingsForCurrentTemplate(),a=t.getDataTableNames(),s=At(".sheet-tab.selected").size()>0?At(".sheet-tab.selected").datum().id:null;to.html("");var l=null;"string"!=typeof e[0]&&(e=["Data"].concat(e));for(var u,c=[],d=0;d<e.length;d++){const t=e[d],n=e[d-1],r=!(!n||"string"==typeof n||n.dataset===t.dataset),i=(t.columns||t.column||"").split("::")[0],s="string"==typeof t;if((s||r)&&(void 0!==u&&c.push(u),u={title:s?t:i,description:null,bindings:[],template_sheet:null,visualisation_sheet:null}),s){if(d<e.length-1){var p=e[d+1];"string"==typeof p&&(u.description=p,d+=1)}}else{if(null===u.template_sheet&&i)for(var f in a)if(a[f]===i){u.template_sheet=+f;break}if(null===u.visualisation_sheet){var h=o[t.dataset]&&o[t.dataset][t.key];h&&(u.visualisation_sheet=h.data_table_id)}u.bindings.push(t),d===e.length-1&&c.push(u)}}for(d=0;d<c.length;d++){var m=c[d],g=m.bindings,v=m.visualisation_sheet||m.template_sheet||i[0].id,y=(l=to.append("div").attr("class","data-block").attr("data-sheet",a[v]).style("display",v===s?null:"none")).append("h2").attr("class","no-select");y.append("i").attr("class","fa fa-table"),y.append("span").text(" "+m.title),m.description&&l.append("p").text(m.description);var b=l.append("div").attr("class","data-bindings-header");b.append("p").attr("class","data-bindings-title").text("Select columns to visualise");for(var _=0;_<g.length;_++){var w=g[_];w.data_type&&(n=!0);var x=o[w.dataset]&&o[w.dataset][w.key],C=x?x.data_table_id:v;io[w.dataset]||(io[w.dataset]={}),io[w.dataset][w.key]=C,C!==v&&C===s&&l.style("display",null),so(l.append("div"),w,x,a,C!==s)}n&&b.append("p").attr("class","data-bindings-reset clickable").html("<i class='fa fa-magic'></i> Auto set columns").on("click",(function(){Wi("Automatically choose your columns","<i class='fa fa-magic'></i> Flourish will interpret your data to determine which columns to visualize",{is_html:!0,buttons:[{text:"Continue",keyCode:13,class:"primary",callback:function(){Qi.spreadsheet.inferDataBindings()}},{text:"Cancel",keyCode:27,class:"secondary"}]})}))}Qi.spreadsheet&&(Qi.spreadsheet.updateHighlights(),Qi.spreadsheet.updateTabs())}))}function so(t,e,n,r,i){no[oo]||(oo=0),t.attr("class","settings-option option-type-"+e.type).style("display",i?"none":null);var o=null==n?"":nn(n,r,!1,e.optional);ro[e.dataset]||(ro[e.dataset]={}),ro[e.dataset][e.key]=oo;var a="column"===e.type&&!e.optional,s=a&&!n;t.classed("empty-required-binding",s);var l=t.append("div").attr("class","data-binding-title").on("click",(function(){At(this).select("input").node().focus()}));l.append("h3").text(e.name).append("i").attr("class","fa fa-question setting-tooltip").style("display",e.description||e.data_type?null:"none"),"column"!=e.type||e.optional||l.select("h3").append("span").attr("class","required").text("Required"),l.append("input").attr("id","data-binding-"+e.dataset+"-"+e.key).attr("name",e.dataset+"-"+e.key).attr("disabled",!Qi.visualisation.can_edit||null).attr("autocomplete","off").attr("title",'Type in column IDs here, for example "A" or "A,B,D" or "A-D"').each((function(){this.value=o})).attr("data-value",o).attr("type","text").call(function(t){return function(e){e.on("change",(function(){Re.hide(),function(t,e){var n=t.parentElement.parentElement.parentElement.getAttribute("data-sheet"),r=t.value.indexOf("::")>-1,i={type:e.type};"column"==i.type?i.column=r?t.value:n+"::"+t.value:i.columns=r?t.value:n+"::"+t.value;var o,a=t.getBoundingClientRect(),s=[a.left-5,a.top+.5*a.height];if(t.value||"column"!=i.type){try{o=function(t,e){var n={};if(!(t.type in t)){if(t.optional)return n;throw new Error("Data binding must specify '"+t.type+"': "+JSON.stringify(t))}var r=t[t.type].indexOf("::");if(-1==r)throw new Error("Invalid data binding: "+t[t.type]);var i=t[t.type].substr(0,r);n.data_table_id=e[i];var o=t[t.type].substr(r+2);if("column"==t.type)n.column=Xe(o,t.optional);else{if("columns"!=t.type)throw new Error("Unknown data binding type: "+t.type);n.columns=tn(o)}return n}(i,Qi.visualisation.getDataTableIds());var l=nn(o,Qi.visualisation.getDataTableNames(),!1,e.optional);t.value.toUpperCase()!==l&&(t.value=l)}catch(e){return console.error("Failed to parse data binding",e),Re.point(s).text(e.message).draw(),t.value=t.getAttribute("data-value"),void(eo=!0)}if(At(t.parentElement.parentElement).classed("empty-required-binding",!1),!o.data_table_id)return t.value=t.getAttribute("data-value"),Re.point(s).text("No such data table").draw(),void(eo=!0);if(e.data_type){const n=Qi.spreadsheet.getTypeAnnotatedColumns();if("column"===i.type){const r=n[o.column];if(!r)return Re.point(s).html(`<span class="popup-content-header">Column '${t.value}' does not exist</span><p>Choose a column from the data table</p>`).draw(),t.value=t.getAttribute("data-value"),void(eo=!0);if(uo(e,r))return t.value=t.getAttribute("data-value"),Re.point(s).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${co([r.type])} columns</span>\n\t\t\t\t\t\t<p style="font-size:1em; margin-top:0.75em;">Choose a different column or check/change the column’s type in the header row with the following types:</p>\n\t\t\t\t\t\t<div style="font-size: 1em; margin-top: 0.75em;">${co(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(eo=!0)}else{const r=n.filter((t=>o.columns.includes(t.index))).filter((t=>uo(e,t)));if(r.length){t.value=t.getAttribute("data-value");var u=r.map((t=>t.type)).reduce(((t,e)=>t.includes(e)?t:[...t,e]),[]),c=u.reduce(((t,e,n,r)=>1===r.length?co([e]):(n<r.length-1?t+=`${n>0?",":""} ${co([e])}`:t+=`or ${co([e])}`,t)),"");return Re.point(s).html(`\n\t\t\t\t\t\t<span class="popup-content-header">This column selection does not accept ${c} columns</span>\n\t\t\t\t\t\t<p style="font-size:1em; margin-top:0.75em;">Choose a different column or check/change the column’s type in the header row with the following types:</p>\n\t\t\t\t\t\t<div style="font-size: 1em; margin-top: 0.75em;">${co(e.data_type)}</div>\n\t\t\t\t\t`).draw(),void(eo=!0)}}}}else if(o=null,!e.optional)return t.value=t.getAttribute("data-value"),Re.point(s).text("This column selection is required").draw(),void(eo=!0);Qi.spreadsheet.updateTabs();var d={};d[e.dataset]={},d[e.dataset][e.key]=o,lo(d,(function(){t.setAttribute("data-value",t.value);var e=po();e?(At(".publish-btn").classed("disabled",!0),At(".republish-btn").classed("disabled",!0),Et(".download-btn").classed("disabled",!0),At("body").classed("impossible",!0)):(At(".publish-btn").classed("disabled",!1),At(".republish-btn").classed("disabled",!1),Et(".download-btn").classed("disabled",!1),At("body").classed("impossible",!1),Qi.visualisation.getState((function(t){Qi.visualisation.prepareData((function(e,n){e?console.error("Failed to prepare data for template"):Qi.preview_pane.getDrawCalled()?Qi.preview_pane.sync({data:n,state:t,update:!0}):(Qi.preview_pane.sync({data:n,state:t,draw:!0}),Qi.preview_pane.setDrawCalled(!0))}))}))),Qi.spreadsheet&&Qi.spreadsheet.updateHighlights(),Qi.template_settings&&(e?Qi.template_settings.setReadOnly():Qi.template_settings.unsetReadOnly(),Qi.template_settings.populate()),Qi.theme_chooser.enableOrDisable()}))}(this,t)})).on("keydown",(function(){Qi.confirm.blank()})).on("focus",(function(){eo||Re.hide(),eo=!1,Et(".data-bindings .settings-option").classed("open",!1),At(this.parentElement.parentElement).classed("open",!0)}))}}(e)).style("background",no[oo].light).style("border-color",no[oo].full),s&&Qi.template_settings.setReadOnly(),a&&t.append("div").attr("class","data-binding-required").append("p").text("This column selection is required. The visualisation will not update while this field is empty.");var u,c=t.append("div").attr("class","data-binding-description");if(e.description&&c.append("p").html(Le.sanitize(e.description)),e.data_type){var d=c.append("div").attr("class","data-binding-data-types");d.append("p").text("Accepted column types");for(var p=Array.isArray(e.data_type)?e.data_type:[e.data_type],f=0;f<p.length;f++)u="string"==typeof p[f]?p[f]:p[f].type,d.append("span").attr("class","type-symbol data-binding-type-symbol").attr("title",Ki[u].text+" column.").style("background-image","url("+Ki[u].symbol+")")}oo++}function lo(t,e){Qi.confirm.saving(),Qi.visualisation.updateDataBindings(t,(function(t){if(t)return Qi.confirm.error(t),console.error("Failed to save data binding:",t),void Qi.analytics("event","exception",{description:t.message||t,fatal:!0});Qi.analytics("event","visualisation",{change_data_binding:Qi.visualisation.id}),Qi.confirm.saved(),fo(),e&&e()}))}function uo(t,e){return!(Array.isArray(t.data_type)?t.data_type:[t.data_type]).some((t=>"string"==typeof t?t===e.type:t.type===e.type))}function co(t){return t.map((t=>`\n\t\t<span class="column-type">\n\t\t<span class="type-symbol" title="${Ki[t].text} column" style="background-image: url(${Ki[t].symbol});"></span>\n\t\t<h2>${Ki[t].text}</h2>\n\t\t</span>\n\t\t`)).join("")}function po(){var t=Qi.visualisation.dataBindingsForCurrentTemplate(),e=Qi.template_data_bindings,n={};return e.forEach((function(t){"string"!=typeof t&&(n[t.dataset]||(n[t.dataset]={}),n[t.dataset][t.key]=t)})),e.some((function(e){if("string"!=typeof e&&"column"===e.type&&!n[e.dataset][e.key].optional)return!t[e.dataset]||null==t[e.dataset][e.key]}))}function fo(t=!0){if(po())At("body").classed("impossible",!0),At(".empty-label").html("<i class='fa fa-exclamation-triangle'></i> Oops! It looks like one of the required column selections is empty."),At(".empty-details").html("Head over to the <span class='data-tab-icon'><i class='fa fa-table'></i> Data</span> tab to choose a suitable column.");else if(At("body").classed("impossible")){const e=Qi.visualisation?Qi.visualisation:Qi.story;e.status&&e.status.requested_by?Qi.confirm_published.awaitingReview(e.status,e.can_review,Qi.user):Qi.visualisation.embed_url&&t?Qi.confirm_published.edited():(Qi.confirm_published.unpublished(),At("body").classed("impossible",!1),At(".empty-label").text(""),At(".empty-details").text(""))}}var ho,mo,go,vo,yo,bo,_o,wo,xo,Co=!1;function Ao(t){if(Co&&window.top!==window.self){var e=window;"srcdoc"===e.location.pathname&&(e=e.parent);var n,r=(n={},window._Flourish_template_id&&(n.template_id=window._Flourish_template_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_template_id&&(n.template_id=window.Flourish.app.loaded_template_id),window._Flourish_visualisation_id&&(n.visualisation_id=window._Flourish_visualisation_id),window.Flourish&&window.Flourish.app&&window.Flourish.app.loaded_visualisation&&(n.visualisation_id=window.Flourish.app.loaded_visualisation.id),window.Flourish&&window.Flourish.app&&window.Flourish.app.story&&(n.story_id=window.Flourish.app.story.id,n.slide_count=window.Flourish.app.story.slides.length),window.Flourish&&window.Flourish.app&&window.Flourish.app.current_slide&&(n.slide_index=window.Flourish.app.current_slide.index+1),n),i={sender:"Flourish",method:"customerAnalytics"};for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o]);for(var o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);e.parent.postMessage(JSON.stringify(i),"*")}}function ko(t){if("function"!=typeof t)throw new Error("Analytics callback is not a function");window.Flourish._analytics_listeners.push(t)}function Eo(){Co=!0;[{event_name:"click",action_name:"click",use_capture:!0},{event_name:"keydown",action_name:"key_down",use_capture:!0},{event_name:"mouseenter",action_name:"mouse_enter",use_capture:!1},{event_name:"mouseleave",action_name:"mouse_leave",use_capture:!1}].forEach((function(t){document.body.addEventListener(t.event_name,(function(){Ao({action:t.action_name})}),t.use_capture)}))}function To(){if(null==ho){var t=function(){var t=window.location;"about:srcdoc"==t.href&&(t=window.parent.location);var e={};return function(t,n,r){for(;r=n.exec(t);)e[decodeURIComponent(r[1])]=decodeURIComponent(r[2])}(t.search.substring(1).replace(/\+/g,"%20"),/([^&=]+)=?([^&]*)/g),e}();ho="referrer"in t?/^https:\/\/medium.com\//.test(t.referrer):!("auto"in t)}return ho}function Lo(t){var e=t||window.innerWidth;return e>999?650:e>599?575:400}function Do(t){if(t&&window.top!==window.self){var e=window;"srcdoc"==e.location.pathname&&(e=e.parent);var n={sender:"Flourish",method:"scrolly"};if(t)for(var r in t)n[r]=t[r];e.parent.postMessage(JSON.stringify(n),"*")}}function Fo(t,e){if(window.top!==window.self){var n=window;if("srcdoc"==n.location.pathname&&(n=n.parent),mo)return t=parseInt(t,10),void n.parent.postMessage({sentinel:"amp",type:"embed-size",height:t},"*");var r={sender:"Flourish",context:"iframe.resize",method:"resize",height:t,src:n.location.toString()};if(e)for(var i in e)r[i]=e[i];n.parent.postMessage(JSON.stringify(r),"*")}}function So(){return(-1!==navigator.userAgent.indexOf("Safari")||-1!==navigator.userAgent.indexOf("iPhone"))&&-1==navigator.userAgent.indexOf("Chrome")}function Mo(t){return"string"==typeof t||t instanceof String}function No(t){return"warn"!==t.method?(console.warn("BUG: validateWarnMessage called for method"+t.method),!1):!(null!=t.message&&!Mo(t.message))&&!(null!=t.explanation&&!Mo(t.explanation))}function Uo(t){return"resize"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Mo(t.src)&&(!!Mo(t.context)&&!!("number"==typeof(e=t.height)?!isNaN(e)&&e>=0:Mo(e)&&/\d/.test(e)&&/^[0-9]*(\.[0-9]*)?(cm|mm|Q|in|pc|pt|px|em|ex|ch|rem|lh|vw|vh|vmin|vmax|%)?$/i.test(e)));var e}function Oo(t){throw new Error("Validation for setSetting is not implemented yet; see issue #4328")}function Bo(t){return"scrolly"!==t.method?(console.warn("BUG: validateScrolly called for method"+t.method),!1):!!Array.isArray(t.slides)}function Ho(t){return"customerAnalytics"===t.method||(console.warn("BUG: validateCustomerAnalyticsMessage called for method"+t.method),!1)}function Ro(t){return"request-upload"!==t.method?(console.warn("BUG: validateResizeMessage called for method"+t.method),!1):!!Mo(t.name)&&!(null!=t.accept&&!Mo(t.accept))}function jo(t,e,n){var r=function(t){for(var e={warn:No,resize:Uo,setSetting:Oo,customerAnalytics:Ho,"request-upload":Ro,scrolly:Bo},n={},r=0;r<t.length;r++){var i=t[r];if(!e[i])throw new Error("No validator found for method "+i);n[i]=e[i]}return n}(e);window.addEventListener("message",(function(e){var i=function(){if(e.origin==document.location.origin)return!0;if(n){const t=e.origin.toLowerCase();if(n=n.toLowerCase(),t.endsWith("//"+n))return!0;if(t.endsWith("."+n))return!0}return!!e.origin.match(/\/\/localhost:\d+$|\/\/(?:public|app)\.flourish.devlocal$|\/\/flourish-api\.com$|\.flourish\.(?:local(:\d+)?|net|rocks|studio)$|\.uri\.sh$|\/\/flourish-user-templates\.com$/)}();if(null!=e.source&&i){var o;try{o="object"==typeof e.data?e.data:JSON.parse(e.data)}catch(t){return void console.warn("Unexpected non-JSON message: "+JSON.stringify(e.data))}if("Flourish"===o.sender)if(o.method)if(Object.prototype.hasOwnProperty.call(r,o.method))if(r[o.method](o)){for(var a=document.querySelectorAll("iframe"),s=0;s<a.length;s++)if(a[s].contentWindow==e.source||a[s].contentWindow==e.source.parent)return void t(o,a[s]);console.warn("could not find frame",o)}else console.warn("Validation failed for the message",o);else console.warn("No validator implemented for message",o);else console.warn("The 'method' property was missing from message",o)}})),So()&&(window.addEventListener("resize",Io),Io())}function Io(){for(var t=document.querySelectorAll(".flourish-embed"),e=0;e<t.length;e++){var n=t[e];if(!n.getAttribute("data-width")){var r=n.querySelector("iframe");if(r){var i=window.getComputedStyle(n),o=n.offsetWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight);r.style.width=o+"px"}}}}function zo(t,e){var n=t.parentNode;if(n.classList.contains("fl-scrolly-wrapper"))console.warn("createScrolly is being called more than once per story. This should not happen.");else{n.classList.add("fl-scrolly-wrapper"),n.style.position="relative",n.style.paddingBottom="1px",n.style.transform="translate3d(0, 0, 0)",t.style.position="sticky";var r=n.getAttribute("data-height")||null;r||(r="80vh",t.style.height=r),t.style.top="calc(50vh - "+r+"/2)";var i=n.querySelector(".flourish-credit");i&&(i.style.position="sticky",i.style.top="calc(50vh + "+r+"/2)"),e.forEach((function(t,e){var r="string"==typeof t&&""!=t.trim(),i=document.createElement("div");i.setAttribute("data-slide",e),i.classList.add("fl-scrolly-caption"),i.style.position="relative",i.style.transform="translate3d(0,0,0)",i.style.textAlign="center",i.style.maxWidth="500px",i.style.height="auto",i.style.marginTop="0",i.style.marginBottom=r?"100vh":"50vh",i.style.marginLeft="auto",i.style.marginRight="auto";var o=document.createElement("div");o.innerHTML=t,o.style.visibility=r?"":"hidden",o.style.display="inline-block",o.style.paddingTop="1.25em",o.style.paddingRight="1.25em",o.style.paddingBottom="1.25em",o.style.paddingLeft="1.25em",o.style.background="rgba(255,255,255,0.9)",o.style.boxShadow="0px 0px 10px rgba(0,0,0,0.2)",o.style.borderRadius="10px",o.style.textAlign="center",o.style.maxWidth="100%",o.style.margin="0 20px",o.style.overflowX="hidden",i.appendChild(o),n.appendChild(i)})),function(t){for(var e=new IntersectionObserver((function(e){e.forEach((function(e){if(e.isIntersecting){var n=t.querySelector("iframe");n&&(n.src=n.src.replace(/#slide-.*/,"")+"#slide-"+e.target.getAttribute("data-slide"))}}))}),{rootMargin:"0px 0px -0% 0px"}),n=t.querySelectorAll(".fl-scrolly-caption"),r=0;r<n.length;r++)e.observe(n[r]);t.querySelectorAll(".fl-scrolly-caption img").forEach((function(t){t.style.maxWidth="100%"}))}(n)}}function Po(t,e,n,r,i){var o=document.createElement("iframe");if(o.setAttribute("scrolling","no"),o.setAttribute("frameborder","0"),o.setAttribute("title","Interactive or visual content"),o.setAttribute("sandbox","allow-same-origin allow-forms allow-scripts allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"),e.appendChild(o),o.offsetParent||"fixed"===getComputedStyle(o).position)$o(t,e,o,n,r,i);else{var a={embed_url:t,container:e,iframe:o,width:n,height:r,play_on_load:i};if(window._flourish_poll_items?window._flourish_poll_items.push(a):window._flourish_poll_items=[a],window._flourish_poll_items.length>1)return o;var s=setInterval((function(){window._flourish_poll_items=window._flourish_poll_items.filter((function(t){return!t.iframe.offsetParent||($o(t.embed_url,t.container,t.iframe,t.width,t.height,t.play_on_load),!1)})),window._flourish_poll_items.length||clearInterval(s)}),500)}return o}function $o(t,e,n,r,i,o){var a;return r&&"number"==typeof r?(a=r,r+="px"):r&&r.match(/^[ \t\r\n\f]*([+-]?\d+|\d*\.\d+(?:[eE][+-]?\d+)?)(?:\\?[Pp]|\\0{0,4}[57]0(?:\r\n|[ \t\r\n\f])?)(?:\\?[Xx]|\\0{0,4}[57]8(?:\r\n|[ \t\r\n\f])?)[ \t\r\n\f]*$/)&&(a=parseFloat(r)),i&&"number"==typeof i&&(i+="px"),r?n.style.width=r:So()?n.style.width=e.offsetWidth+"px":n.style.width="100%",!!i||(t.match(/\?/)?t+="&auto=1":t+="?auto=1",i=Lo(a||n.offsetWidth)+"px"),i&&("%"===i.charAt(i.length-1)&&(i=parseFloat(i)/100*e.parentNode.offsetHeight+"px"),n.style.height=i),n.setAttribute("src",t+(o?"#play-on-load":"")),n}function qo(t,e,n){for(var r in e||(e=[]),n||(n={}),t)e.push(r),"object"==typeof t[r]&&qo(t[r],e,n),n[e.join(".")]=t[r],e.pop();return n}function Vo(t){var e={};for(var n in t){for(var r=e,i=n.indexOf("."),o=0;i>=0;i=n.indexOf(".",o=i+1)){var a=n.substring(o,i);a in r||(r[a]={}),r=r[a]}r[n.substring(o)]=t[n]}return e}function Yo(t){if(null==t)return t;var e,n={};for(var r in t)Array.isArray(t[r])?n[r]=t[r].slice():(e=t[r],Array.isArray(e)||"object"!=typeof e||null==e?n[r]=t[r]:n[r]=Yo(t[r]));return n}var Wo,Go=null;function Zo(){return"MessageChannel"in window}var Xo=null;function Jo(){Xo&&go.removeEventListener("load",Xo),Xo=null}function Ko(t){Jo(),go.addEventListener("load",t),Xo=t}function Qo(t,e,n){return ba(!1),xo=t?t.visualisation?t.visualisation:t.current_slide.visualisation:null,Go=null,xo&&xo.template_id?(Ko(function(t,e,n){var r=t.visualisation?t.visualisation.template_id:t.current_slide.visualisation.template_id,i=t.current_slide?t.current_slide.id:null;return function(){Lt(),!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||(Jo(),sa((function(o,a){o?console.error("Failed to get default state"):!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||la((function(o,s){if(o)console.error("Failed to call hasData");else if(xo&&xo.template_id==r&&(!t.current_slide||t.current_slide.id===i)){var l=!1;t.visualisation&&(l=t.data_bindings.requiredBindingsAreUnset()),s?xo.refreshDataBindings((function(o){o?console.error("Failed to refresh data bindings"):!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||xo.prepareData((function(o,s){o?console.error("Failed to prepare data for template"):!xo||xo.template_id!=r||t.current_slide&&t.current_slide.id!==i||va({data:s,state:e,draw:!l},(function(t,e){Go=a,n(t,e)}))}))})):va({state:e,draw:!l},(function(t,e){Go=a,n(t,e)}))}}))})))}}(t,e,n)),go.src="/template/"+xo.template_id+"/embed/?auto=1&environment="+vo+"&is_read_only="+(t.is_read_only?"1":"0"),go):(Jo(),go.src="about:blank",go)}function ta(t){sa((function(e,n){e?console.error("Failed to get default state"):(Go=n,t())}))}function ea(t,e){var n=t.template_id;t.refreshDataBindings((function(r){r?console.error("Failed to fetch data bindings"):t.prepareData((function(t,r){if(xo&&xo.template_id==n)return t?(console.error("Failed to prepare data for template"),void e(t)):void e(void 0,r)}))}))}function na(t,e){ea(t,(function(t,n){if(t)return e(t);va({data:n,update:!0},e)}))}function ra(t,e){ea(t,(function(t,n){if(t)return e(t);va({data:n,update:!1},e)}))}function ia(t,e,n){ea(t,(function(t,r){if(t)return n(t);va({data:r,state:e,overwrite_state:!0,update:!0},n)}))}function oa(t,e,n,r=go){if(Zo()){var i=new MessageChannel;i.port1.onmessage=function(t){var e=t.data;if("string"==typeof e){if(!n)return;return n(void 0,JSON.parse(e))}if("object"==typeof e){if("result"in e){if(!n)return;return n(void 0,e.result)}if("error"in e){if(!n)return;return n(e.error)}console.error("Unrecognised response to message",e)}else console.error("Unrecognised response to message",e)},r.contentWindow.postMessage({sender:"Flourish",method:t,argument:e},"*",[i.port2])}}function aa(t,e){oa("setState",Vo(t),e)}function sa(t,e){"function"!=typeof t?oa("getState",t,e):oa("getState",void 0,t)}function la(t){oa("hasData",void 0,t)}function ua(t,e){oa("setData",t,e)}function ca(t){oa("getData",void 0,t)}function da(t){oa("draw",void 0,t),ba(!0)}function pa(t){_o&&_o.clear(),ya()&&oa("update",void 0,t)}function fa(t,e,n){oa("snapshot",t,e,n)}function ha(){return Yo(Go)}function ma(t,e){oa("setFixedHeight",t,e)}function ga(t){if(go.parentNode.offsetWidth){if(void 0!==t)Wo=null!=t;else if(Wo)return;var e=t||bo&&bo.responsive_menu&&bo.responsive_menu.getHeightSetting()||yo.getHeightForBreakpoint(go.offsetWidth),n=typeof e;("number"===n||"string"===n&&!isNaN(e))&&(e+="px"),go.style.height=e}}function va(t,e,n=go){ya()?delete t.draw:t.draw&&ba(!0),t.state&&(t.state=Vo(t.state)),_o&&_o.clear(),oa("sync",t,(function(n,r){null!=n||"success"!==r?(t.draw&&ba(!1),function n(r){r?e&&e(r):function(t,e){return t.data?(ua(t.data,e),delete t.data,!1):t.state?(aa(t.state,e),delete t.state,!1):t.draw?(da(e),delete t.draw,!1):!t.update||(pa(e),delete t.update,!1)}(t,n)&&e&&e(void 0)}(n)):e&&e(void 0)}),n)}function ya(){return wo}function ba(t){wo=t}function _a(t,e,n,r,i){return go=document.querySelector(t),vo=e,bo=n,_o=r,i||(i={}),mo="#amp=1"==window.location.hash,yo={createEmbedIframe:Po,isFixedHeight:To,getHeightForBreakpoint:Lo,startEventListeners:jo,notifyParentWindow:Fo,initScrolly:Do,createScrolly:zo,isSafari:So,initCustomerAnalytics:Eo,addAnalyticsListener:ko,sendCustomerAnalyticsMessage:Ao},go.style.height=yo.getHeightForBreakpoint(go.offsetWidth)+"px",yo.startEventListeners((function(t){"resize"==t.method?ga(t.height):"warn"==t.method?(_o&&_o.warn(t),console.warn("Warning from template:",t.message,t.explanation)):t.method in i&&i[t.method](t)}),["resize","warn","customerAnalytics","setSetting","request-upload"]),Zo()||function(t){if(t){var e=document.createElement("div");e.className="unsupported-notice",e.innerHTML="<h3>Please update your browser</h3><p>This page only works with newer versions of your browser.</p>",t.appendChild(e)}}(go.parentNode),{loadVisualisation:Qo,updateData:na,updateDataAndState:ia,updateDataNotPreview:ra,setState:aa,getState:sa,getDefaultState:ha,hasData:la,setData:ua,getData:ca,draw:da,update:pa,snapshot:fa,setFixedHeight:ma,resize:ga,sync:va,getDrawCalled:ya,setDrawCalled:ba,setFrameLoadListener:Ko,updateDefaultState:ta}}var wa=function(t=document.body){t.classList.add("loading")},xa=function(t=document.body){t.classList.remove("loading")};const Ca=new Set([1,274,282,283,296,34675,40961,42240]);function Aa(t){let e=0;function n(n){if(e>=t.byteLength)return null;void 0===n&&(n=1);const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength+2);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=(new TextEncoder).encode("Exif\0\0");function*s(t){if(t<32)return;if(!function(t,e){if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.byteLength;n++)if(t.getInt8(n)!==e.getInt8(n))return!1;return!0}(n(6),new DataView(a.buffer)))return void n(t-8);const e=[],r=n(t-8),i=r.getUint16(0);let o;if(18761===i)o=!0;else{if(19789!==i)return;o=!1}function s(t){return r.getUint16(t,o)}function l(t){return r.getUint32(t,o)}if(42!==s(2))return;let u=l(4);for(;0!=u;){const t=s(u);u+=2;for(let n=0;n<t;n++){const t=s(u),n=s(u+2),i=l(u+4),a=l(u+8);if(u+=12,!Ca.has(t))continue;if(n<1||n>12)continue;let c;switch(n){case 1:case 2:case 6:case 7:c=1;break;case 3:case 8:c=2;break;case 4:case 9:case 11:c=4;break;case 5:case 10:case 12:c=8}const d=c*i;let p;if(d<=4)p=new DataView(new ArrayBuffer(4),0,4),p.setUint32(0,a,o);else{p=new DataView(new ArrayBuffer(d));for(let t=0;t<d;t++)p.setInt8(t,r.getInt8(a+t))}e.push({code:t,type:n,num_values:i,data:p})}u=l(u)}let c=10;for(const{data:t}of e)c+=12,t.byteLength>4&&(c+=t.byteLength);c+=4;const d=new Uint8Array(c),p=new DataView(d.buffer);d.set((new TextEncoder).encode("MM\0*\0\0\0\b"),0),p.setUint16(8,e.length);let f=10,h=10+12*e.length+4;for(const{code:t,type:n,num_values:r,data:i}of e){if(p.setUint16(f,t),p.setUint16(f+2,n),p.setUint32(f+4,r),i.byteLength<=4)for(let t=0;t<i.byteLength;t++)p.setInt8(f+8+t,i.getInt8(t));else{p.setUint32(f+8,h);for(let t=0;t<i.byteLength;t++)p.setInt8(h+t,i.getInt8(t));h+=i.byteLength}f+=12}const m=new Uint8Array(10),g=new DataView(m.buffer);g.setUint8(0,255),g.setUint8(1,225),g.setUint16(2,p.byteLength+8),m.set(a,4),yield m,yield p}const l=n(2);if(65496!==l.getUint16(0))throw new Error("Not a valid JPEG");for(o(l);;){const t=n(2),e=t.getUint16(0);if(65498===e){o(t);break}const r=n(2),i=r.getUint16(0);if(65505!==e)o(t),o(r),o(n(i-2));else for(const t of s(i))o(t)}const u=new Uint8Array([255,217]);let c,d=!1,p=!1;for(;null!=(c=n());){if(d&&217===c.getUint8(0)){p=!0,o(new DataView(new Uint8Array([217]).buffer));break}const t=new Uint8Array(c.buffer).indexOf(u);if(!(t<0)){o(c.slice(0,t+2)),p=!0;break}o(c),d=c.byteLength>0&&255===c.getUint8(c.byteLength-1)}return p||o(u),r}function ka(t){let e=0;function n(n){if(e+n>t.byteLength)return null;const r=new DataView(t,e,n);return e+=n,r}const r=new Uint8Array(t.byteLength);let i=0;function o(t){r.set(new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)),i),i+=t.byteLength}const a=n(8);if(80!==a.getUint8(1)||78!==a.getUint8(2)||71!==a.getUint8(3))throw new Error("Not a valid PNG");let s,l;for(o(a);null!=(s=n(4))&&null!=(l=n(4));){const t=s.getUint32(0),e=l.getUint8(0),r=l.getUint8(1);101===e||105===e&&84===r?(n(t),n(4)):(o(s),o(l),o(n(t)),o(n(4)))}return r}var Ea="/api/file/upload";function Ta(t){(t||document).querySelectorAll("input[type=url]").forEach((function(t){La(t)}))}function La(t,e){var n=t.ownerDocument.createElement("button");n.type="button",n.className="upload",n.setAttribute("title","Upload a file from your computer"),n.innerHTML="⬆︎",t.insertAdjacentElement("afterend",n),e||(n.onclick=Da)}function Da(){var t=this.previousSibling,e=t.getAttribute("accept");t.disabled=!0,t.classList.toggle("uploading",!0),Fa({accept:e,success:function(e){var n;t.disabled=!1,t.classList.toggle("uploading",!1),t.value=e,"createEvent"in document?(n=document.createEvent("Event")).initEvent("change",!0,!0):n=new Event("change",{bubbles:!0}),t.dispatchEvent(n)},failure:function(){t.disabled=!1,t.classList.toggle("uploading",!1)}})}function Fa(t){var e=document.getElementById("file-uploader");e||((e=document.createElement("input")).type="file",e.setAttribute("id","file-uploader"),e.style.display="none",document.body.appendChild(e)),t.accept?e.setAttribute("accept",t.accept):e.removeAttribute("accept"),e.onchange=async function(){wa(),await async function(t,e,n){const r=await async function(t){try{if("image/png"===t.type)return new File([ka(await t.arrayBuffer())],t.name,{type:t.type});if("image/jpeg"===t.type)return new File([Aa(await t.arrayBuffer())],t.name,{type:t.type})}catch(t){console.error(t)}return t}(t[0]);!function(t,e){var n={filename:t.name,content_type:t.type,size:t.size};Sa(Ea,n,(function(t,n){return t?e(t):e(null,JSON.parse(n.responseText))}))}(r,(function(t,i){if(t)return xa(),Wi("Upload error","There was a problem uploading your file: "+t.message),void console.error(t);var o=function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}({file:r},i.fields);Sa(i.upload_url,o,(function(t,r){xa(),t?(Wi("Upload error","There was a problem uploading your file ("+r.status+")."),console.error(t),n&&n()):e(i.file_url)}))}))}(e.files,t.success,t.failure),e.parentNode.removeChild(e)},e.click()}function Sa(t,e,n){var r=new XMLHttpRequest,i=new FormData;if("object"==typeof e){for(var o in e)e.hasOwnProperty(o)&&"file"!==o&&i.append(o,e[o]);e.hasOwnProperty("file")&&i.append("file",e.file)}window.Flourish.csrf_token&&i.append("csrf_token",window.Flourish.csrf_token),r.onload=function(){if(r.status>=200&&r.status<300)n(null,r);else try{var e=JSON.parse(r.responseText).error;n(e,r)}catch(e){n(new Error("POST "+t+" received status code: "+r.status),r)}},r.open("POST",t,!0),r.send(i)}var Ma="https://fonts.googleapis.com/css?family=",Na=["Source Sans Pro","Roboto Condensed","Merriweather","Lora","Playfair Display","Coda","Lobster","Cabin Sketch"],Ua="Same as parent",Oa=[],Ba=[],Ha={};function Ra(t){return Ma+t.replace(/ /g,"+")+":400,700"}function ja(t){var e=Ba.concat(Oa,Na.map((function(t){return{name:t,url:Ra(t)}})));return t&&e.unshift({name:Ua}),e}function Ia(t){return ja(!0).find((function(e){return e.name==t}))}var za=!1;function Pa(t){return t.substr(t.lastIndexOf("=")+1).replace(/\+/g," ")}function $a(t){var e=t.target,n=e.value;if(n&&(0==n.indexOf(Ma)&&(n=e.value=Pa(n)),!Ia(n))){if(/^https?:\/\//.test(n)){za||(qa(n),e.value="");var r=n;return n=e.value=Pa(r),Ba.push({name:n,url:r}),void Va()}var i=Ra(n);try{var o=new XMLHttpRequest;if(o.open("HEAD",i,!1),o.send(),404==o.status)throw"Font not found";Ba.push({name:n,url:i}),Va()}catch(t){qa(n),e.value=""}}}function qa(t){Wi("Unrecognised font “"+t+"”","Fonts must be chosen from Google Fonts. Visit <a href='https://fonts.google.com'>fonts.google.com</a> to find more",{is_html:!0})}function Va(){var t,e,n=Object.keys(Ha);for(t=0;t<n.length;++t)(e=Ha[n[t]]).dropdown.setOptions(ja(e.can_inherit).map((function(t){return t.name})))}var Ya={initialize:function(t,e,n){var r=!!e.optional;za=n,t.classList.add("font-menu");var i=new Zi({input:t,id:e.property+"-dropdown",options:ja(r).map((t=>t.name)),mode:"single",options_config:{allow_other_option:!0}});t._dropdown=i,Ha[e.property]={dropdown:i,can_inherit:r},t.addEventListener("change",$a)},update:function(t,e){var n=e?e.name:Ua;t._dropdown.setSelectedOptions(n),Ia(n)||(n!=Ua&&Ba.push({name:n,url:e.url}),Va())},getValue:function(t){if(/^https?:\/\//.test(t.value))return{name:Pa(t.value),url:t.value};var e=t.value;if(e==Ua)return null;var n=Ia(e);return n||{name:e,url:Ra(e)}},replaceThemeFonts:function(t){Oa=(t||[]).map((function(t){return{name:t.name,url:t.url}})),Va()}},Wa="$";function Ga(){}function Za(t,e){var n=new Ga;if(t instanceof Ga)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function Xa(){}Ga.prototype=Za.prototype={constructor:Ga,has:function(t){return Wa+t in this},get:function(t){return this[Wa+t]},set:function(t,e){return this[Wa+t]=e,this},remove:function(t){var e=Wa+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===Wa&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===Wa&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===Wa&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===Wa&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===Wa&&++t;return t},empty:function(){for(var t in this)if(t[0]===Wa)return!1;return!0},each:function(t){for(var e in this)e[0]===Wa&&t(this[e],e.slice(1),this)}};var Ja=Za.prototype;Xa.prototype={constructor:Xa,has:Ja.has,add:function(t){return this[Wa+(t+="")]=t,this},remove:Ja.remove,clear:Ja.clear,values:Ja.keys,size:Ja.size,empty:Ja.empty,each:Ja.each};var Ka={value:function(){}};function Qa(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new ts(r)}function ts(t){this._=t}function es(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function ns(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function rs(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ka,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function is(t,e,n,r,i){for(var o in t.getVersionNumber=function(){return t.version_number},t.setVersionNumber=function(e){t.version_number=e},t.id=e,t.version_number=n||0,r)t[o]=r[o];if(i)for(var o in i)t[o]=i[o]}ts.prototype=Qa.prototype={constructor:ts,on:function(t,e){var n,r=this._,i=es(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=rs(r[n],t.name,e);else if(null==e)for(n in r)r[n]=rs(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=ns(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new ts(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var os={};function as(t){t.running||(t.running=!0,ss(t,(function(){t.running=!1})))}function ss(t,e){t.request=function(t,e){var n="method"in t?t.method:"POST",r="request_type"in t?t.request_type:"application/json",i="response_type"in t?t.response_type:"application/json",o=t.url,a=t.payload,s=t.callback;!a&&ls(n)&&(a=function(){return{}});if(a){if("function"!=typeof a)throw new Error("Internal error: processRequestThen: payload must be a function, not "+typeof a,a);"object"==typeof(a=a())&&ls(n)&&(window.Flourish&&window.Flourish.csrf_token||console.trace("window.Flourish.csrf_token missing"),a.csrf_token=window.Flourish.csrf_token),"string"!=typeof a&&(a=JSON.stringify(a))}var l=function(t,e){var n,r,i,o,a=Qa("beforesend","progress","load","error"),s=Za(),l=new XMLHttpRequest,u=null,c=null,d=0;function p(t){var e,r=l.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,l)}catch(t){return void a.call("error",n,t)}else e=l;a.call("load",n,e)}else a.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(t)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=p:l.onreadystatechange=function(t){l.readyState>3&&p(t)},l.onprogress=function(t){a.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(o=t,n):o},timeout:function(t){return arguments.length?(d=+t,n):d},user:function(t){return arguments.length<1?u:(u=null==t?null:t+"",n)},password:function(t){return arguments.length<1?c:(c=null==t?null:t+"",n)},response:function(t){return i=t,n},get:function(t,e){return n.send("GET",t,e)},post:function(t,e){return n.send("POST",t,e)},send:function(e,i,p){return l.open(e,t,!0,u,c),null==r||s.has("accept")||s.set("accept",r+",*/*"),l.setRequestHeader&&s.each((function(t,e){l.setRequestHeader(e,t)})),null!=r&&l.overrideMimeType&&l.overrideMimeType(r),null!=o&&(l.responseType=o),d>0&&(l.timeout=d),null==p&&"function"==typeof i&&(p=i,i=null),null!=p&&1===p.length&&(p=function(t){return function(e,n){t(null==e?n:null)}}(p)),null!=p&&n.on("error",p).on("load",(function(t){p(null,t)})),a.call("beforesend",n,l),l.send(null==i?null:i),n},abort:function(){return l.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}return n}(o);r&&"GET"!==n&&l.header("Content-Type",r);i&&l.mimeType(i);return l.on("error",(function(t){var n;try{n=JSON.parse(t.target.responseText),s(n.error)}catch(e){s("Internal error: "+t.target.responseText)}e()})),l.on("load",(function(t){var n=t.responseText;"application/json"===i&&(n=JSON.parse(n));try{s(void 0,n)}catch(t){console.error(t.stack)}e()})),l.send(n,a),l}(t.items.shift(),(function(){t.request=null,0==t.items.length?e():ss(t,e)}))}function ls(t){return["POST","PUT","DELETE"].includes(t)}function us(t,e){void 0===e&&(e="default"),e in os||(os[e]={items:[],running:!1,name:e}),os[e].items.push(t),as(os[e])}function cs(t,e){for(var n in e)t[n]=e[n];return t}function ds(t,e,n,r){"function"==typeof n&&(r=n,n=!1),n&&cs(t,e),us({url:t.api_prefix+"/"+t.id,payload:function(){return{version_number:t.getVersionNumber(),fields:e}},callback:function(i,o){if(i)return r(i);n||cs(t,e),t.setVersionNumber(o.version_number),r(void 0)}})}function ps(t,e){t.delete_requested=!0,us({url:t.api_prefix+"/"+t.id,method:"DELETE",payload:function(){return{version_number:t.getVersionNumber()}},callback:function(n,r){if(n)return e(n);t.setVersionNumber(r.version_number),t.is_deleted=!0,e(void 0,r)}})}var fs={addApiKey:function(t){us({url:"/api/user/api_keys",method:"PUT",callback:t})},addFolder:function(t,e){us({url:"/api/user/folder/"+encodeURIComponent(t),method:"PUT",callback:e})},addTag:function(t,e){us({url:"/api/user/tag/"+encodeURIComponent(t),method:"PUT",callback:e})},deleteApiKey:function(t,e){us({url:"/api/user/api_keys/"+t,method:"DELETE",callback:e})},fetchFolders:function(t){us({url:"/api/user/folder",method:"GET",callback:t})},fetchProjects:function(t,e,n,r,i,o,a,s){let l="/api/user/projects";const u=[];n&&u.push("sort="+encodeURIComponent(n)),r&&u.push("filter="+encodeURIComponent(r)),i&&u.push("offset="+encodeURIComponent(i)),o&&u.push("limit="+encodeURIComponent(o)),a&&u.push("search="+encodeURIComponent(a)),s&&u.push("is_recent=true"),e&&(l+="/folder/"+encodeURIComponent(e)),u.length&&(l+="?"+u.join("&")),us({url:l,method:"GET",callback:t})},generateSdkToken:function(t){us({url:"/api/user/generate_sdk_token",method:"GET",callback:t})},getApiKeys:function(t){us({url:"/api/user/api_keys",method:"GET",callback:t})},getReviewCount:function(t){us({url:"/api/reviews/count",method:"GET",callback:t})},isUsernameAvailable:function(t,e){us({url:"/api/user/username?u="+encodeURIComponent(t),method:"GET",callback:e})},logHistory:function(t){us({url:"/api/history",method:"POST",payload:function(){return t},callback:function(){}})},removeFolder:function(t,e){us({url:"/api/user/folder/"+encodeURIComponent(t),method:"DELETE",callback:e})},removeTag:function(t,e){us({url:"/api/user/tag/"+encodeURIComponent(t),method:"DELETE",callback:e})},renameFolder:function(t,e,n){us({url:"/api/user/folder/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},renameTag:function(t,e,n){us({url:"/api/user/tag/"+encodeURIComponent(t)+"/"+encodeURIComponent(e),method:"PUT",callback:n})},revokeSdkToken:function(t,e){us({url:"/api/user/sdk_token/"+encodeURIComponent(t),method:"DELETE",callback:e})},setSamlProviderId:function(t,e,n){us({url:"/api/user/"+encodeURIComponent(t)+"/change_saml_provider_id",method:"POST",payload:function(){return{saml_provider_id:e}},callback:n})},update:function(t,e){us({url:"/api/user",method:"POST",payload:function(){return{fields:t}},callback:e})}};var hs={};function ms(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function gs(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function vs(){}var ys=.7,bs=1/ys,_s="\\s*([+-]?\\d+)\\s*",ws="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Cs=/^#([0-9a-f]{3,8})$/,As=new RegExp(`^rgb\\(${_s},${_s},${_s}\\)$`),ks=new RegExp(`^rgb\\(${xs},${xs},${xs}\\)$`),Es=new RegExp(`^rgba\\(${_s},${_s},${_s},${ws}\\)$`),Ts=new RegExp(`^rgba\\(${xs},${xs},${xs},${ws}\\)$`),Ls=new RegExp(`^hsl\\(${ws},${xs},${xs}\\)$`),Ds=new RegExp(`^hsla\\(${ws},${xs},${xs},${ws}\\)$`),Fs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Ss(){return this.rgb().formatHex()}function Ms(){return this.rgb().formatRgb()}function Ns(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=Cs.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Us(e):3===n?new Rs(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Os(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Os(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=As.exec(t))?new Rs(e[1],e[2],e[3],1):(e=ks.exec(t))?new Rs(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Es.exec(t))?Os(e[1],e[2],e[3],e[4]):(e=Ts.exec(t))?Os(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Ls.exec(t))?qs(e[1],e[2]/100,e[3]/100,1):(e=Ds.exec(t))?qs(e[1],e[2]/100,e[3]/100,e[4]):Fs.hasOwnProperty(t)?Us(Fs[t]):"transparent"===t?new Rs(NaN,NaN,NaN,0):null}function Us(t){return new Rs(t>>16&255,t>>8&255,255&t,1)}function Os(t,e,n,r){return r<=0&&(t=e=n=NaN),new Rs(t,e,n,r)}function Bs(t){return t instanceof vs||(t=Ns(t)),t?new Rs((t=t.rgb()).r,t.g,t.b,t.opacity):new Rs}function Hs(t,e,n,r){return 1===arguments.length?Bs(t):new Rs(t,e,n,null==r?1:r)}function Rs(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function js(){return`#${$s(this.r)}${$s(this.g)}${$s(this.b)}`}function Is(){const t=zs(this.opacity);return`${1===t?"rgb(":"rgba("}${Ps(this.r)}, ${Ps(this.g)}, ${Ps(this.b)}${1===t?")":`, ${t})`}`}function zs(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Ps(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function $s(t){return((t=Ps(t))<16?"0":"")+t.toString(16)}function qs(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ys(t,e,n,r)}function Vs(t){if(t instanceof Ys)return new Ys(t.h,t.s,t.l,t.opacity);if(t instanceof vs||(t=Ns(t)),!t)return new Ys;if(t instanceof Ys)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,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Ys(a,s,l,t.opacity)}function Ys(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ws(t){return(t=(t||0)%360)<0?t+360:t}function Gs(t){return Math.max(0,Math.min(1,t||0))}function Zs(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function Xs(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}ms(vs,Ns,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ss,formatHex:Ss,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Vs(this).formatHsl()},formatRgb:Ms,toString:Ms}),ms(Rs,Hs,gs(vs,{brighter(t){return t=null==t?bs:Math.pow(bs,t),new Rs(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ys:Math.pow(ys,t),new Rs(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Rs(Ps(this.r),Ps(this.g),Ps(this.b),zs(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:js,formatHex:js,formatHex8:function(){return`#${$s(this.r)}${$s(this.g)}${$s(this.b)}${$s(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Is,toString:Is})),ms(Ys,(function(t,e,n,r){return 1===arguments.length?Vs(t):new Ys(t,e,n,null==r?1:r)}),gs(vs,{brighter(t){return t=null==t?bs:Math.pow(bs,t),new Ys(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ys:Math.pow(ys,t),new Ys(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 Rs(Zs(t>=240?t-240:t+120,i,r),Zs(t,i,r),Zs(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ys(Ws(this.h),Gs(this.s),Gs(this.l),zs(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=zs(this.opacity);return`${1===t?"hsl(":"hsla("}${Ws(this.h)}, ${100*Gs(this.s)}%, ${100*Gs(this.l)}%${1===t?")":`, ${t})`}`}}));var Js=Xs("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Ks=Xs("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Qs=Xs("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),tl=Xs("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),el=t=>()=>t;function nl(t){return 1==(t=+t)?rl: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):el(isNaN(e)?n:e)}}function rl(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):el(isNaN(t)?e:t)}var il=function t(e){var n=nl(e);function r(t,e){var r=n((t=Hs(t)).r,(e=Hs(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=rl(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 ol(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var al=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sl=new RegExp(al.source,"g");function ll(t,e){var n,r,i,o=al.lastIndex=sl.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=al.exec(t))&&(r=sl.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,l.push({i:a,x:ol(n,r)})),o=sl.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}var ul,cl=180/Math.PI,dl={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function pl(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*cl,skewX:Math.atan(l)*cl,scaleX:a,scaleY:s}}function fl(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:ol(t,i)},{i:l-2,x:ol(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:ol(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:ol(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),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:ol(t,n)},{i:s-2,x:ol(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var hl,ml,gl=fl((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?dl:pl(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),vl=fl((function(t){return null==t?dl:(ul||(ul=document.createElementNS("http://www.w3.org/2000/svg","g")),ul.setAttribute("transform",t),(t=ul.transform.baseVal.consolidate())?pl((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):dl)}),", ",")",")"),yl=0,bl=0,_l=0,wl=0,xl=0,Cl=0,Al="object"==typeof performance&&performance.now?performance:Date,kl="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function El(){return xl||(kl(Tl),xl=Al.now()+Cl)}function Tl(){xl=0}function Ll(){this._call=this._time=this._next=null}function Dl(t,e,n){var r=new Ll;return r.restart(t,e,n),r}function Fl(){xl=(wl=Al.now())+Cl,yl=bl=0;try{!function(){El(),++yl;for(var t,e=hl;e;)(t=xl-e._time)>=0&&e._call.call(null,t),e=e._next;--yl}()}finally{yl=0,function(){var t,e,n=hl,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:hl=e);ml=t,Ml(r)}(),xl=0}}function Sl(){var t=Al.now(),e=t-wl;e>1e3&&(Cl-=e,wl=t)}function Ml(t){yl||(bl&&(bl=clearTimeout(bl)),t-xl>24?(t<1/0&&(bl=setTimeout(Fl,t-Al.now()-Cl)),_l&&(_l=clearInterval(_l))):(_l||(wl=Al.now(),_l=setInterval(Sl,1e3)),yl=1,kl(Fl)))}function Nl(t,e,n){var r=new Ll;return e=null==e?0:+e,r.restart((n=>{r.stop(),t(n+e)}),e,n),r}Ll.prototype=Dl.prototype={constructor:Ll,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?El():+n)+(null==e?0:+e),this._next||ml===this||(ml?ml._next=this:hl=this,ml=this),this._call=t,this._time=n,Ml()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ml())}};var Ul=Qa("start","end","cancel","interrupt"),Ol=[];function Bl(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=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var u,c,d,p;if(1!==n.state)return l();for(u in i)if((p=i[u]).name===n.name){if(3===p.state)return Nl(a);4===p.state?(p.state=6,p.timer.stop(),p.on.call("interrupt",t,t.__data__,p.index,p.group),delete i[u]):+u<e&&(p.state=6,p.timer.stop(),p.on.call("cancel",t,t.__data__,p.index,p.group),delete i[u])}if(Nl((function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))})),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(d=n.tween.length),u=0,c=-1;u<d;++u)(p=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=p);r.length=c+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Dl(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:Ul,tween:Ol,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Hl(t,e){var n=jl(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Rl(t,e){var n=jl(t,e);if(n.state>3)throw new Error("too late; already running");return n}function jl(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Il(t,e){var n,r;return function(){var i=Rl(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function zl(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=Rl(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===e){i[l]=s;break}l===u&&i.push(s)}o.tween=i}}function Pl(t,e,n){var r=t._id;return t.each((function(){var t=Rl(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return jl(t,r).value[e]}}function $l(t,e){var n;return("number"==typeof e?ol:e instanceof Ns?il:(n=Ns(e))?(e=n,il):ll)(t,e)}function ql(t){return function(){this.removeAttribute(t)}}function Vl(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yl(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Wl(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function Gl(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Zl(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function Xl(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Jl(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Kl(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Jl(t,i)),n}return i._value=e,i}function Ql(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Xl(t,i)),n}return i._value=e,i}function tu(t,e){return function(){Hl(this,t).delay=+e.apply(this,arguments)}}function eu(t,e){return e=+e,function(){Hl(this,t).delay=e}}function nu(t,e){return function(){Rl(this,t).duration=+e.apply(this,arguments)}}function ru(t,e){return e=+e,function(){Rl(this,t).duration=e}}function iu(t,e){if("function"!=typeof e)throw new Error;return function(){Rl(this,t).ease=e}}function ou(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Hl:Rl;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}var au=Ct.prototype.constructor;function su(t){return function(){this.style.removeProperty(t)}}function lu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function uu(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&lu(t,o,n)),r}return o._value=e,o}function cu(t){return function(e){this.textContent=t.call(this,e)}}function du(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&cu(r)),e}return r._value=t,r}var pu=0;function fu(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function hu(){return++pu}var mu=Ct.prototype;fu.prototype={constructor:fu,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=f(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,u=r[a],c=u.length,d=o[a]=new Array(c),p=0;p<c;++p)(s=u[p])&&(l=t.call(s,s.__data__,p,u))&&("__data__"in s&&(l.__data__=s.__data__),d[p]=l,Bl(d[p],e,n,p,d,jl(s,n)));return new fu(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=g(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,u=r[s],c=u.length,d=0;d<c;++d)if(l=u[d]){for(var p,f=t.call(l,l.__data__,d,u),h=jl(l,n),m=0,v=f.length;m<v;++m)(p=f[m])&&Bl(p,e,n,m,f,h);o.push(f),a.push(l)}return new fu(o,a,e,n)},selectChild:mu.selectChild,selectChildren:mu.selectChildren,filter:function(t){"function"!=typeof t&&(t=v(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],u=0;u<s;++u)(o=a[u])&&t.call(o,o.__data__,u,a)&&l.push(o);return new fu(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,u=e[s],c=n[s],d=u.length,p=a[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(p[f]=l);for(;s<r;++s)a[s]=e[s];return new fu(a,this._parents,this._name,this._id)},selection:function(){return new au(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=hu(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,u=0;u<l;++u)if(a=s[u]){var c=jl(a,e);Bl(a,t,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new fu(r,this._parents,t,n)},call:mu.call,nodes:mu.nodes,node:mu.node,size:mu.size,empty:mu.empty,each:mu.each,on:function(t,e){var n=this._id;return arguments.length<2?jl(this.node(),n).on.on(t):this.each(ou(n,t,e))},attr:function(t,e){var n=l(t),r="transform"===n?vl:$l;return this.attrTween(t,"function"==typeof e?(n.local?Zl:Gl)(n,r,Pl(this,"attr."+t,e)):null==e?(n.local?Vl:ql)(n):(n.local?Wl:Yl)(n,r,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 r=l(t);return this.tween(n,(r.local?Kl:Ql)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?gl:$l;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=I(this,t),a=(this.style.removeProperty(t),I(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,su(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=I(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=I(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Pl(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=Rl(this,t),u=l.on,c=null==l.value[a]?o||(o=su(e)):void 0;u===n&&i===c||(r=(n=u).copy()).on(s,i=c),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=I(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,uu(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}}(Pl(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,du(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=jl(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Il:zl)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?tu:eu)(e,t)):jl(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?nu:ru)(e,t)):jl(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(iu(e,t)):jl(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Rl(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise((function(o,a){var s={value:a},l={value:function(){0==--i&&o()}};n.each((function(){var n=Rl(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e})),0===i&&o()}))},[Symbol.iterator]:mu[Symbol.iterator]};var gu,vu,yu={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function bu(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function _u(t){var e;if(gu=At(".detailed-settings"),(vu=gu.append("div").attr("class","settings-block")).append("h2").text("Back to settings").on("click",(function(){gu.transition().duration(100).style("opacity",0).on("end",(function(){At(this).html("").style("display","none"),At(".template-settings").style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),At(".template-settings-search").style("display",null).style("opacity",0).transition().duration(200).style("opacity",1)})),gu.node()})),"string"==typeof t)e=vu.append("div").html(t);else if("object"==typeof t&&(e=vu.append(t.type),t.value&&(vu.node().value=t.value),t.attributes))for(var n in t.attributes)e.attr(n,t.attributes[n]);return e.node().focus(),At(".template-settings-search").style("display","none"),At(".template-settings").style("display","none"),gu.style("display","block").style("opacity",0).transition().duration(200).style("opacity",1),gu.node()}Ct.prototype.interrupt=function(t){return this.each((function(){!function(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>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}(this,t)}))},Ct.prototype.transition=function(t){var e,n;t instanceof fu?(e=t._id,t=t._name):(e=hu(),(n=yu).time=El(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,u=0;u<l;++u)(a=s[u])&&Bl(a,t,e,u,s,n||bu(a,e));return new fu(r,this._parents,t,e)};var wu,xu,Cu,Au,ku={},Eu={},Tu={Flourish:{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#007d8e","#1aa7ee","#29dae4","#88e99a","#019c00","#c11f1f","#730000"]},"Flourish Alternate":{colors:["#4328e7","#9654e5","#ff6283","#ff8800","#ffc502","#88e99a","#29dae4","#1aa7ee","#019c00","#007d8e","#c11f1f","#730000"]},"Flourish High Fire":{colors:["#730000","#c11f1f","#9654e5","#ff6283","#ff8800","#ffc502"]},"Flourish Low Fire":{colors:["#4328e7","#007d8e","#019c00","#1aa7ee","#29dae4","#88e99a"]},"Flourish Uranium":{colors:["#c11f1f","#ff8800","#ffc502"]},"Flourish Erbium":{colors:["#730000","#9654e5","#ff6283"]},"Flourish Barium":{colors:["#4328e7","#1aa7ee","#29dae4"]},"Flourish Chromium":{colors:["#007d8e","#019c00","#88e99a"]},"Flourish Pale":{colors:["#e667b1","#a193f3","#eb8484","#4bedf3","#d6a4e9","#48ffa7","#ffb1c1","#8cd3f7","#f6c992","#94ecf1","#ffe281","#c4f4cd"]},"Flourish Deep":{colors:["#430b2b","#1d0e7a","#611010","#04393b","#5a1c72","#004826","#b10025","#09557b","#0f7277","#816300","#1d9c34"]},"Flourish Mono":{colors:["#000000","#6a6a6a","#959595","#dddddd"]},"Flourish Legacy":{scheme:"flourish_default_1",colors:["#1D6996","#EDAD08","#73AF48","#94346E","#38A6A5","#E17C05","#5F4690","#0F8554","#6F4070","#CC503E","#994E95","#666666"]},"Flourish Legacy Alternate":{scheme:"flourish_default_2",colors:["#11A579","#CC503E","#3969AC","#F2B701","#7F3C8D","#80BA5A","#E68310","#CF1C90","#008695","#F97B72","#4B4B8F","#A5AA99"]},Rainbow:{colors:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"]},Pastel:{colors:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"]},Antique:{colors:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"]},Accent:{scheme:"schemeAccent",colors:Js},Dark:{scheme:"schemeDark2",colors:Ks},Paired:{scheme:"schemePaired",colors:Qs},Pale:{scheme:"schemePastel1",colors:tl},"Farrow & Ball":{colors:["#EDD8C4","#C4A999","#F9C1C0","#B76A4C","#8F483C","#783027","#8A1D2E","#602A1F","#893838","#BD795A","#DC6130","#AD3B34","#ECE8BD","#F7E28A","#EBEB82","#FAD862","#F1CA61","#F5C03B","#F9E7D4","#F4E4AC","#EFD491","#DAC589","#D2B15E","#CD9344","#EFEFCC","#E8E7CA","#CAD5AD","#B9B495","#73806F","#636F65","#BDAB65","#889A73","#829C7A","#6C7855","#81B693","#BBBEA0","#99A286","#AAC0B3","#427E7F","#769194","#ECF3EC","#EBEBD4","#D0D9C9","#9EAF9F","#7A8E8D","#516365","#DBE5DC","#C4C9C5","#CBD7D7","#AABEBF","#66839A","#A0D2CD","#56AAC5","#535E7D","#2E3548","#48606E","#2C3437"]}},Lu={};function Du(){var t,e={};for(t in Lu)e[t]=Lu[t];for(t in Tu)e[t]=Tu[t];return e}var Fu="Edit color palette";function Su(t){t&&t.length?(Lu={},t.forEach((function(t){var e=Object.keys(t)[0];Lu[e]={colors:t[e]}}))):Lu={},function(){for(var t in ku){ku[t].setOptions(Nu())}}()}function Mu(){if(void 0!==wu)return wu;var t=document.createElement("input");return t.setAttribute("type","color"),t.setAttribute("value","!"),wu="color"==t.type&&"!"!==t.value}function Nu(){var t=[],e=Du();for(var n in t.push([Fu,""]),e)t.push([n,e[n].colors.join("|")]);return t}function Uu(t,e){var n=t[0],r=t[1];if(!r){const t=kt("em");return t.append("i").classed("fa fa-pencil",!0),t.node().append(Fu),t.node()}Array.isArray(r)||(r=r.split("|"));const i=[];if(e&&n){const t=kt("label").text(n);i.push(t.node())}return r.forEach((function(t,e){const n=kt("span").attr("data-index",e).style("background-color",t);i.push(n.node())})),i}function Ou(t,e){var n,r,i=Du(),o=t.parentNode.querySelector(".color-swatches");if(Array.isArray(e))r=e;else if("string"==typeof e){if(i[e])n=e;else for(var a in i)if(i[a].scheme==e){n=a;break}n&&(r=i[n].colors)}if(!r||!r.length)return t.parentNode.classList.remove("custom"),t.removeAttribute("data-value"),t.value="",void(o.innerHTML="");o.innerHTML="",o.append(...Uu([null,r])),t.setAttribute("data-value",r.join("|"))}function Bu(t){Au=t.target,t.dataTransfer.setData("text/plain","x"),event.dataTransfer.effectAllowed="move",At(Au).classed("dragging",!0),Et(".palette p:not(.dragging) input").style("pointer-events","none")}function Hu(t){t.preventDefault();var e=At(".palette").selectAll("[draggable='true']").style("border-color",null),n=At(t.target);if("true"===n.attr("draggable")){var r="bottom";if(n.node()===e.nodes()[0]){var i=t.target.getBoundingClientRect(),o=i.top+i.height/2;t.clientY<o&&(r="top")}At(t.target).style("border-"+r,"1px solid black")}}function Ru(t){if(Au){for(var e=t.target;e&&("P"!==e.tagName||!e.nextSibling);)e=e.parentNode;if(e){var n=e.nextSibling;if(e===At(".palette").selectAll("[draggable='true']").style("border-color",null).nodes()[0]){var r=e.getBoundingClientRect(),i=r.top+r.height/2;t.clientY<i&&(n=e)}e.parentNode.insertBefore(Au,n),Au=!1,zu()}}}function ju(){At(Au).classed("dragging",!1),Et(".palette *").style("border-bottom",null).style("border-top",null),Et(".palette p input").style("pointer-events",null)}function Iu(t){for(var e=t.target;e&&"BUTTON"!==e.tagName;)e=e.parentNode;e&&(e.classList.contains("fa-plus-square")?function(t){var e=t.target.parentNode,n=Pu("#000000");e.insertAdjacentHTML("beforebegin",n),zu()}(t):e.classList.contains("fa-times")&&function(t){t.parentNode.childNodes.length>2?t.parentNode.removeChild(t):("INPUT"==t.firstChild.tagName?t.firstChild.value="#000000":t.firstChild.style.backgroundColor="#000000",t.firstChild.nextSibling.value="#000000");zu()}(e.parentNode))}function zu(){for(var t=Cu.getAttribute("data-autocomplete"),e=ku[t],n=[],r=xu.querySelectorAll(".palette input[type=text]"),i=0;i<r.length;i++)n.push(r[i].value);var o=e.getOptions();Eu[t]?o[0][1]=n.join("|"):o.unshift(["Custom",n.join("|")]),Eu[t]=n,e.setOptions(o),Ou(Cu,n),At(Cu).dispatch("change")}function Pu(t){const e=kt("p").attr("draggable",!0);return e.append("span").classed("swatch-handle",!0).text(".. .. .."),Mu()?e.append("input").attr("type","color").attr("value",t):e.append("span").classed("swatch-color",!0).style("background-color",t),e.append("input").attr("type","text").attr("value",t),e.append("button").attr("type","button").classed("fa fa-times",!0),e.node().outerHTML}function $u(t){var e=t.target,n=e.value,r=e.parentNode;if(!n)return r.parentNode.removeChild(r),void zu();var i=Ns(n);if(!i)return console.warn("bad color",n),"color"==e.type?e.value=e.nextSibling.value:Mu()?e.value=e.previousSibling.value:e.value=e.previousSibling.style.backgroundColor,void(Re.point(e).text(n+" is not a valid color").draw()._getElement().style.zIndex=115);"color"==e.type?e.nextSibling.value=n:Mu()?e.previousSibling.value=i.hex():e.previousSibling.style.backgroundColor=n,zu()}var qu,Vu,Yu={initialize:function(t,e){e.choices&&Su(e.choices),t.type="text",t.classList.add("colors");var n=document.createElement("span");n.setAttribute("class","color-swatches"),t.parentNode.insertBefore(n,t);var r=t.getAttribute("name")+"-dropdown";ku[r]=new Zi({input:t,id:r,mode:"single",options:Nu(),options_config:{custom_renderer:Uu}}),t.addEventListener("change",(function(e){t.value==Fu?(e.stopImmediatePropagation(),t.value="",function(t){Cu=t;var e=(xu=_u({type:"div",attributes:{class:"palette"}})).querySelector(".palette"),n=function(t,e){e||(e=t.parentNode.querySelector(".color-swatches"));for(var n=[],r=0;r<e.childNodes.length;r++)if(!e.childNodes[r].classList.contains("fa")){var i=e.childNodes[r].style.backgroundColor,o=Ns(i);o?n.push(o.hex()):(console.warn("Bad color",i),n.push("#000000"))}return n}(t),r="";n.forEach((function(t){r+=Pu(t)})),r+="<p><button class='fa fa-plus-square clickable'></button></p>",e.innerHTML=r,e.addEventListener("change",$u),e.addEventListener("dragstart",Bu),e.addEventListener("dragover",Hu),e.addEventListener("drop",Ru),e.addEventListener("dragend",ju),e.addEventListener("click",Iu)}(t)):Ou(t,(t.getAttribute("data-value")||"").split("|"))}))},update:Ou,getValue:function(t){var e=t.getAttribute("data-value");return e?e.split("|"):null},replaceThemeColors:Su},Wu={};const Gu={style:!0,url:!0,flourish_embed:!0};var Zu={h1:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.91 7.453V9H14.162V7.453H12.615V0.744995H11.211C10.9163 0.918329 10.613 1.06566 10.301 1.187C9.989 1.30833 9.60767 1.41233 9.157 1.499V2.682H10.704V7.453H8.91Z",width:14,height:9},h2:{path:"M0.00100708 0.524002V9H1.91201V5.464H4.83701V9H6.76101V0.524002H4.83701V3.787H1.91201V0.524002H0.00100708ZM8.24078 7.908V9H14.0518V7.388H12.3878C12.1884 7.388 11.9588 7.401 11.6988 7.427C11.4474 7.44434 11.2178 7.466 11.0098 7.492C11.3478 7.14534 11.6728 6.79434 11.9848 6.439C12.3054 6.07501 12.5871 5.71534 12.8298 5.36C13.0811 4.996 13.2804 4.63634 13.4278 4.281C13.5751 3.917 13.6488 3.56167 13.6488 3.215C13.6488 2.81634 13.5838 2.45667 13.4538 2.136C13.3238 1.81534 13.1374 1.54234 12.8948 1.317C12.6521 1.083 12.3618 0.905338 12.0238 0.784004C11.6944 0.654004 11.3261 0.589005 10.9188 0.589005C10.3294 0.589005 9.82245 0.701671 9.39778 0.927004C8.97311 1.14367 8.55711 1.46867 8.14978 1.902L9.18978 2.929C9.39778 2.70367 9.61878 2.50867 9.85278 2.344C10.0868 2.17067 10.3554 2.084 10.6588 2.084C11.0228 2.084 11.3088 2.19234 11.5168 2.409C11.7248 2.617 11.8288 2.92467 11.8288 3.332C11.8288 3.62667 11.7378 3.93867 11.5558 4.268C11.3824 4.58867 11.1354 4.93967 10.8148 5.321C10.5028 5.69367 10.1258 6.09667 9.68378 6.53C9.25045 6.95467 8.76945 7.414 8.24078 7.908Z",width:15,height:9},bold:{path:"M0.00100708 9V0.524002H2.90001C3.34201 0.524002 3.74934 0.558669 4.12201 0.628002C4.50334 0.688669 4.83267 0.801335 5.11001 0.966002C5.39601 1.13067 5.61701 1.34734 5.77301 1.616C5.93767 1.88467 6.02001 2.22267 6.02001 2.63C6.02001 2.82067 5.99401 3.01134 5.94201 3.202C5.89001 3.39267 5.81634 3.57034 5.72101 3.735C5.62567 3.89967 5.50867 4.047 5.37001 4.177C5.24001 4.307 5.08834 4.40234 4.91501 4.463V4.515C5.13167 4.567 5.33101 4.64934 5.51301 4.762C5.69501 4.866 5.85534 5.00034 5.99401 5.165C6.13267 5.32967 6.24101 5.52467 6.31901 5.75C6.39701 5.96667 6.43601 6.218 6.43601 6.504C6.43601 6.93734 6.34934 7.31 6.17601 7.622C6.01134 7.934 5.77734 8.194 5.47401 8.402C5.17934 8.60134 4.83267 8.753 4.43401 8.857C4.03534 8.95234 3.60634 9 3.14701 9H0.00100708ZM1.91201 3.917H2.80901C3.27701 3.917 3.61501 3.826 3.82301 3.644C4.03967 3.462 4.14801 3.21934 4.14801 2.916C4.14801 2.58667 4.03967 2.35267 3.82301 2.214C3.60634 2.07534 3.27267 2.006 2.82201 2.006H1.91201V3.917ZM1.91201 7.518H2.99101C4.03967 7.518 4.56401 7.13667 4.56401 6.374C4.56401 6.00134 4.43401 5.737 4.17401 5.581C3.91401 5.41634 3.51967 5.334 2.99101 5.334H1.91201V7.518Z",width:7,height:9},italic:{path:"M7 1.44444H5.06656L3.6687 8.05556H5.5V9H0.5V8.05556H2.6547L4.05256 1.44444H2V0.5H7V1.44444Z",width:7,height:9},line_break:{description:"Add line break",path:"M14 0V6H3.83L6.41 3.41L5 2L0 7L5 12L6.41 10.59L3.83 8H16V0H14Z",width:16,height:12},url:{description:"Add URL",path:"M8.03571429,6.69642857 C8.03571429,6.5476183 7.98363147,6.42113147 7.87946429,6.31696429 L6.71875,5.15625 C6.61458281,5.05208281 6.48809598,5 6.33928571,5 C6.18303493,5 6.0491077,5.05952321 5.9375,5.17857143 L6.16350446,5.40178571 L6.16350446,5.40178571 L6.21434766,5.4637896 C6.22447497,5.4770171 6.23542901,5.49169139 6.24720982,5.5078125 C6.28255226,5.55617584 6.30673357,5.6036084 6.31975446,5.65011161 C6.33277536,5.69661482 6.33928571,5.74776758 6.33928571,5.80357143 C6.33928571,5.9523817 6.2872029,6.07886853 6.18303571,6.18303571 C6.07886853,6.2872029 5.9523817,6.33928571 5.80357143,6.33928571 C5.74776758,6.33928571 5.69661482,6.33277536 5.65011161,6.31975446 C5.6036084,6.30673357 5.55617584,6.28255226 5.5078125,6.24720982 L5.42844742,6.18644594 L5.42844742,6.18644594 L5.37357392,6.13653276 L5.37357392,6.13653276 L5.17857143,5.9375 L5.17857143,5.9375 C5.05580296,6.05282796 4.99441964,6.18861529 4.99441964,6.34486607 C4.99441964,6.49367634 5.04650246,6.62016317 5.15066964,6.72433036 L6.30022321,7.87946429 C6.40067015,7.97991122 6.52715698,8.03013393 6.6796875,8.03013393 C6.82849777,8.03013393 6.9549846,7.98177132 7.05915179,7.88504464 L7.87946429,7.0703125 C7.98363147,6.96614531 8.03571429,6.84151858 8.03571429,6.69642857 Z M4.11272321,2.76227679 C4.11272321,2.61346652 4.0606404,2.48697969 3.95647321,2.3828125 L2.80691964,1.22767857 C2.70275246,1.12351138 2.57626562,1.07142857 2.42745536,1.07142857 C2.28236535,1.07142857 2.15587852,1.12165128 2.04799107,1.22209821 L1.22767857,2.03683036 C1.12351138,2.14099754 1.07142857,2.26562427 1.07142857,2.41071429 C1.07142857,2.55952455 1.12351138,2.68601138 1.22767857,2.79017857 L2.38839286,3.95089286 C2.48883979,4.05133979 2.61532662,4.1015625 2.76785714,4.1015625 C2.92410792,4.1015625 3.05803516,4.04389939 3.16964286,3.92857143 L2.94363839,3.70535714 L2.94363839,3.70535714 L2.85993304,3.59933036 L2.85993304,3.59933036 C2.8245906,3.55096702 2.80040929,3.50353446 2.78738839,3.45703125 C2.77436749,3.41052804 2.76785714,3.35937528 2.76785714,3.30357143 C2.76785714,3.15476116 2.81993996,3.02827433 2.92410714,2.92410714 C3.02827433,2.81993996 3.15476116,2.76785714 3.30357143,2.76785714 C3.35937528,2.76785714 3.41052804,2.77436749 3.45703125,2.78738839 C3.50353446,2.80040929 3.55096702,2.8245906 3.59933036,2.85993304 L3.70535714,2.94363839 L3.70535714,2.94363839 L3.92857143,3.16964286 L3.92857143,3.16964286 C4.0513399,3.0543149 4.11272321,2.91852757 4.11272321,2.76227679 Z M8.63839286,5.55803571 C8.95089442,5.87053728 9.10714286,6.24999777 9.10714286,6.69642857 C9.10714286,7.14285938 8.94903432,7.52045977 8.6328125,7.82924107 L7.8125,8.64397321 C7.50371869,8.95275452 7.1261183,9.10714286 6.6796875,9.10714286 C6.22953644,9.10714286 5.85007595,8.94903432 5.54129464,8.6328125 L4.39174107,7.47767857 C4.08295977,7.16889727 3.92857143,6.79129688 3.92857143,6.34486607 C3.92857143,5.8872745 4.09226027,5.4985135 4.41964286,5.17857143 L3.92857143,4.6875 C3.60862935,5.01488259 3.22172846,5.17857143 2.76785714,5.17857143 C2.32142634,5.17857143 1.94196585,5.02232299 1.62946429,4.70982143 L0.46875,3.54910714 C0.156248437,3.23660558 -8.52651283e-14,2.85714509 -8.52651283e-14,2.41071429 C-8.52651283e-14,1.96428348 0.158108538,1.58668309 0.474330357,1.27790179 L1.29464286,0.463169643 C1.60342416,0.154388337 1.98102455,1.42108547e-14 2.42745536,1.42108547e-14 C2.87760642,1.42108547e-14 3.25706691,0.158108538 3.56584821,0.474330357 L4.71540179,1.62946429 C5.02418309,1.93824559 5.17857143,2.31584598 5.17857143,2.76227679 C5.17857143,3.21986836 5.01488259,3.60862935 4.6875,3.92857143 L5.17857143,4.41964286 C5.4985135,4.09226027 5.8854144,3.92857143 6.33928571,3.92857143 C6.78571652,3.92857143 7.16517701,4.08481987 7.47767857,4.39732143 L8.63839286,5.55803571 Z",width:9.5,height:9.5},flourish_embed:{description:"Add Flourish embed",path:"M7.57358 5.28931L10.1281 6.04854L10.0432 6.517L7.37515 6.22624L9.44904 7.9224L9.20119 8.29833L6.86556 7.0207L8.11097 9.37696L7.7504 9.62552L6.06604 7.5604L6.34206 10.2078L5.89578 10.2926L5.11055 7.73772L4.36044 10.2926L3.89331 10.2078L4.16934 7.5604L2.50622 9.62552L2.12402 9.37696L3.38372 7.0207L1.04113 8.29833L0.793673 7.9224L2.88146 6.22624L0.213045 6.517L0.128113 6.04854L2.6479 5.28931L0.128113 4.53667L0.213045 4.06859L2.88146 4.35974L0.793673 2.66319L1.04113 2.28687L3.38372 3.56451L2.12402 1.20824L2.50622 0.960069L4.16934 3.02519L3.89331 0.377778L4.36044 0.292603L5.11055 2.84787L5.89578 0.292603L6.34206 0.377778L6.06604 3.02519L7.7504 0.960069L8.11097 1.20824L6.86556 3.56451L9.20119 2.28687L9.44904 2.66319L7.37515 4.35974L10.0432 4.06859L10.1281 4.53667L7.57358 5.28931Z",width:10,height:10}};function Xu(t,e){Wu=e||Gu;var n=At(Vu=_u({type:"div",attributes:{class:"text-editor-container settings-option"}})).select(".text-editor-container").html("");for(var r in n.append("div").attr("class","text-settings"),n.append("textarea").text(t.value).attr("class","text-input").on("blur",(function(){t.value=this.value,At(t).dispatch("change")})),Wu)Wu[r]&&Ju(r);(Wu.bindings||Wu.bindings_custom)&&(n.append("div").attr("class","text-bindings"),Ku()),Ve()}function Ju(t){if("bindings"!=t&&"bindings_custom"!=t){var e=At(Vu).select(".text-settings").append("div").attr("class","editor-section");if("style"==t){["h1","h2","bold","italic","line_break"].forEach((function(t){var n=Zu[t].description?Zu[t].description:"Add "+t+" text";e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",Qu).append("svg").attr("height",Zu[t].height).attr("width",Zu[t].width).attr("viewBox","0 0 "+Zu[t].width+" "+Zu[t].height).append("path").attr("fill","#333333").attr("d",Zu[t].path)}))}else{var n=Zu[t].description?Zu[t].description:"Add "+t;e.append("div").attr("class","editor-button popup").attr("data-action",t).attr("data-popup-body",n).attr("data-popup-position","top").on("click",Qu).append("svg").attr("height",Zu[t].height).attr("width",Zu[t].width).attr("viewBox","0 0 "+Zu[t].width+" "+Zu[t].height).append("path").attr("fill","#333333").attr("d",Zu[t].path)}}}function Ku(){if(Wu.bindings||Wu.bindings_custom){var t;if(Array.isArray(Wu.bindings))t={},Wu.bindings.forEach((function(e){var n=e.split("."),r=n[0],i=n.length>1?n[1]:null;i&&(t[r]||(t[r]=[]),t[r].push(i))}));else if(!0===Wu.bindings)t=null;else if(!Array.isArray(Wu.bindings_custom))return;var e=qu.visualisation.data_bindings[qu.visualisation.template_id],n={},r=[];qu.visualisation.data_tables.forEach((function(t){n[t.id]=t.cached_data[0]}));var i=null!==t;for(var o in e)if(!i||t[o]){var a=e[o];for(var s in a)if(!i||t[o].includes(s)){var l=a[s];if(null!=l.column){var u=n[l.data_table_id][l.column];u&&!r.includes(u)&&r.push(u)}else l.columns&&l.columns.forEach((function(t){var e=n[l.data_table_id][t];e&&!r.includes(e)&&r.push(e)}))}}Wu.bindings_custom&&Array.isArray(Wu.bindings_custom)&&Wu.bindings_custom.forEach((function(t){t[0]&&t[1]&&r.push({name:t[0],binding:t[1],type:"dynamic"})})),At(".text-bindings").html("").style("display",r.length?null:"none").append("p").text("Click to add values from your data"),At(".text-bindings").selectAll("button.binding").data(r).enter().append("button").attr("data-action","binding").attr("data-binding",(function(t){return"object"==typeof t?t.binding:t})).attr("data-type",(function(t){return"object"==typeof t?t.type:null})).on("click",Qu).text((function(t){return"object"==typeof t?t.name:t}))}}function Qu(){var t,e=At(".text-editor-container .text-input"),n=e.node().value,r=e.node().selectionStart,i=e.node().selectionEnd,o=i-r,a=n.substr(r,o),s=At(this).attr("data-action"),l="flourish_embed"==s?prompt("Specify the ID of published Flourish project (eg. story/123 or visualisation/124)","visualisation/"):"";if("bold"==s)t=tc(a,"<b>","</b>");else if("italic"==s)t=tc(a,"<i>","</i>");else if("h1"==s)t=tc(a,"<h1>","</h1>");else if("h2"==s)t=tc(a,"<h2>","</h2>");else if("line_break"==s)t=tc(a,"<br>","");else if("url"==s)t=tc(a,'<a href ="">',"</a>",10);else if("flourish_embed"==s)t=tc(l,'<iframe src="https://flo.uri.sh/','/embed" frameborder="0" scrolling="no" style="width:100%;height:400px;"></iframe>');else if("binding"==s){var u=At(this).attr("data-binding");t=tc(u,"{{","}}",u.length+4)}e.node().setRangeText(t.text,r,i),e.node().focus(),e.node().selectionStart=r+t.cursor,e.node().selectionEnd=r+t.cursor}function tc(t,e,n,r){return e=e||"",n=n||"",t=t||"",{cursor:r||e.length+t.length,text:e+t+n}}var ec,nc,rc,ic={initialize:function(t,e,n){qu=t,At(e.parentElement).append("div").attr("class","text-editor-btn").attr("tabindex","0").on("click",(function(){Xu(e,n.editor)})).on("keydown",(function(t){13==t.keyCode&&Xu(e,n.editor)})).append("i").attr("class","fa fa-paint-brush")},updateDataBindings:Ku},oc=void 0,ac=/fa-(\S*)/g,sc=/^data:image\/(svg|svg\+xml|png|jpg);base64,[A-Z-a-z0-9+/=]*$/,lc=/^gradient:/g;function uc(t){var e=!At(t.parentNode).classed("open");Et(".template-settings .settings-block").classed("open",!1).attr("aria-expanded",!1),e&&At(t.parentNode).classed("open",!0).attr("aria-expanded",!0)}function cc(t){if(t){oc={};for(var e=0,n=null,r=null,i=ec&&ec.user?ec.user.template_settings_overrides:{},o=0;o<t.length;o++){var a=t[o];if("string"!=typeof a){if("object"!=typeof a||n||r||(e++,r=rc.append("div").attr("class","toplevel-settings-block")),"hidden"!==a.type){var s=n||r;if(a.new_section&&(s.append("div").classed("settings-divider",!0),"string"==typeof a.new_section&&s.append("h3").classed("settings-subhead",!0).text(a.new_section)),void 0!==a.show_if){if(a.show_condition)throw new Error("BUG: show_if present as well as show_condition");a.show_condition=[{type:"show",condition:a.show_if}],delete a.show_if}else if(void 0!==a.hide_if){if(a.show_condition)throw new Error("BUG: hide_if present as well as show_condition");a.show_condition=[{type:"hide",condition:a.hide_if}],delete a.hide_if}oc[a.property]=a.type,dc(s.append("div"),a,i)}}else r=null,(n=rc.append("div").attr("class","settings-block")).append("h2").attr("class","no-select").attr("tabindex","0").text(a).on("click",(function(){uc(this)})).on("keyup",(function(t){13===t.keyCode&&uc(this)})),n.classed("open",e<1),n.attr("aria-expanded",e<1),"State documentation"===a&&n.style("display","none"),e++}Et(".upgrade-setting").on("click",(function(){!function(t,e,n,r){var i=[],o=[];i.push(["Upgrade to a premium account to get:"]),o.push(["<strong>Branding control:</strong> Add custom logos, colors, and styles to keep your projects consistent with your brand identity","<strong>Logo removal:</strong> Embed your projects without the Flourish logo appended","<strong>Team management:</strong> Seamlessly manage your team with our collaboration and approval features"]);var a=Math.floor(Math.random()*i.length),s=Math.floor(Math.random()*o.length),l="title"+a+"-list"+s,u=[{text:"Upgrade now",class:"convert",tag_name:"a",href:"https://flourish.studio/pricing",target:"_blank",keyCode:13,callback:function(){t.analytics("event","upgrade-click",{upgrade_id:l}),fs.logHistory({category:"upgrade",action:"clicked",detail:r})}},{text:"Maybe later",keyCode:27,class:"secondary",callback:function(){t.analytics("event","upgrade-close",{upgrade_id:l}),fs.logHistory({category:"upgrade",action:"closed",detail:r})}}];t.analytics("event","upgrade-open",{upgrade_id:l}),fs.logHistory({category:"upgrade",action:"viewed",detail:r}),Wi(e,n,{buttons:u,is_html:!0,upgrade:{message:i[a],list:o[s],is_business:!0}})}(ec,"This is a premium feature","Upgrade your plan to change this setting.","upgrade-settings")})),Ve()}}function dc(t,e,n){e.upgrade=e.property in n;var r="html"==e.type,i=e.choices&&("buttons"==e.style||"boolean"==e.type);t.attr("class","settings-option option-type-"+e.type+(i?" settings-buttons":"")+(r?" text-editor":"")+(e.upgrade?" upgrade-setting":""));var o=t.append("label").attr("for","setting-"+e.property).classed("hidden",null==e.name).append("h3").text(e.name).classed("no-select",!0);(e.upgrade||e.description)&&o.append("i").style("font-family","FontAwesome").classed("fa setting-tooltip popup",!0).classed("fa-star tooltip-upgrade",e.upgrade).classed("fa-question tooltip-help",!e.upgrade).style("background-color",e.upgrade?"#93366e":null).attr("tabindex","0").attr("data-popup-head",e.upgrade?"This is a premium feature":null).attr("data-popup-body",e.description?e.description.replace(/\[\[/g,"").replace(/\]\]/g,""):null).attr("data-popup-allow-interaction",!0).attr("data-popup-constrainer",".settings-block"),e.width&&t.classed("width-"+e.width.replace(/ /g,"-"),!0);var a="input";if(["text","code","html"].includes(e.type)&&(a="textarea"),"code"==e.type){var s=!1;t.append("i").attr("class","popup fa fa-reply clickable wrap-control").attr("data-popup-body","Wrap/unwrap text").attr("data-popup-position","top").on("click",(function(){s=!s,At(this.parentNode).select("textarea").attr("wrap",s?null:"off"),At(this).classed("selected",s)}))}var l=t.append(a).attr("id","setting-"+e.property).attr("class","setting").attr("name",e.property).attr("disabled",!ec.visualisation.can_edit||null),u=l.node();if("colors"==e.type)Yu.initialize(u,e);else if("font"==e.type)Ya.initialize(u,e,ec.user&&null!=ec.user.company_id);else if("number"==e.type)u.setAttribute("type","number"),null!=e.min&&u.setAttribute("min",e.min),null!=e.max&&u.setAttribute("max",e.max),e.step&&u.setAttribute("step",e.step);else if("url"==e.type)u.setAttribute("type","url"),nc.addButton(u,e.upgrade);else if(i){l.remove(),l=t.append("div").attr("id","setting-"+e.property).attr("name",e.property).classed("buttons-container",!0).classed("large","large"==e.size),u=l.node();var c=e.choices.length,d=[3,4,5],p=function(){if(c<=2)return{column_count:c,rows:1};var t=d.map((function(t){return{column_count:t,orphans:c%t/t,rows:c/t}})).filter((function(t){return t.rows>=1})).sort((function(t,e){return t.rows>e.rows?1:t.rows<e.rows?-1:0})),e=t.filter((function(t){return 0===t.orphans}));return 1===e.length||e.length>1?e[0]:0===e.length?t.sort((function(t,e){return t.orphans>e.orphans?-1:t.orphans<e.orphans?1:0}))[0]:void 0}();e.choices.forEach((function(t,n){l.append("input").attr("type","radio").attr("name",e.property).attr("value",t[1]).attr("id",e.property+"_"+n).attr("class","setting").attr("disabled",!ec.visualisation.can_edit||null).call(pc(e)),mc(t,l.append("label").attr("for",e.property+"_"+n).style("width",100/p.column_count+"%").style("border-radius",(function(){var t=p.column_count,e=Math.ceil(p.rows),r=t*e-c;return e<=1?0===n?"3px 0 0 3px":n===t-1?"0 3px 3px 0":null:e>1?0===n?"3px 0 0 0":n===t-1?"0 3px 0 0":n===c-(t-r)?"0 0 0 3px":n===c-1&&0===r?"0 0 3px 0":null:null})).node())}))}else"boolean"==e.type?(u.setAttribute("type","checkbox"),t.classed("slider-container",!0),t.append("label").attr("class","slider").attr("for","setting-"+e.property)):u.setAttribute("type","text");if("code"==e.type&&(u.setAttribute("wrap","off"),l.on("keydown.tab",(function(t){var e=t;if(9===e.keyCode&&!(e.altKey||e.metaKey||e.ctrlKey||e.shiftKey)){e.preventDefault();var n=this.selectionStart;this.value=this.value.substring(0,n)+"\t"+this.value.substring(this.selectionEnd),this.selectionEnd=n+1}}))),r&&(t.append("div").attr("class","text-editor-setting").node().appendChild(u),ic.initialize(ec,u,e)),e.choices&&"string"==e.type&&"buttons"!=e.style&&(u._dropdown=new Zi({input:u,id:e.property+"-dropdown",options:e.choices,options_config:{allow_other_option:e.choices_other,custom_renderer:mc},mode:"single"})),"color"==e.type){At(u).classed("color",!0).style("display","none");var f=At(u.parentNode).append("div").attr("class","color-picker"),h=f.append("div").attr("class","color-wrapper");e.optional&&f.append("div").attr("class","cancel-setting popup").attr("tabindex","0").html("<svg><use xlink:href='#cancel-setting'></use></svg>").attr("data-popup-body","If cleared, the color will be set automatically based on the theme or context").on("click keydown",(function(t){t.keyCode&&13!==t.keyCode||(u.value="",l.dispatch("change"),At(this.parentNode).classed("is-null",!0))})),h.append("input").attr("type","color").on("change",(function(){u.value=this.value,l.dispatch("change"),At(this.parentNode.parentNode).classed("is-null",!1)})).on("focus",(function(){At(this.parentNode.parentNode).classed("active",!0)})).on("blur",(function(){At(this.parentNode.parentNode).classed("active",!1)}))}e.placeholder&&u.setAttribute("placeholder",e.placeholder),e.size&&u.classList.add("size-"+e.size),l.call(pc(e))}function pc(t){return function(e){var n=!1;e.on("change",(function(){var e=this;Re.hide(),n=!0,ec.preview_pane.getState(t.property,(function(r,i){return r?(console.error("Failed to get state property "+t.property,r),void(n=!1)):function(t,e){if("number"!==e.type)return!0;if(""===t.value)return!!e.optional||(Re.point(t).text("A value is required").draw(),!1);var n=parseFloat(t.value);return e.hasOwnProperty("min")&&n<e.min?(Re.point(t).text("Value cannot be less than "+e.min).draw(),t.value=e.min):e.hasOwnProperty("max")&&n>e.max&&(Re.point(t).text("Value cannot be greater than "+e.max).draw(),t.value=e.max),!0}(e,t)?void function(t,e,n){r=e.property,i=100,o=gc,a=[t,e,n],clearTimeout(hs[r]),hs[r]=setTimeout((function(){o.apply(window,a),delete hs[r]}),i);var r,i,o,a}(e,t,(function(r){if(!r)return n=!1,void("SELECT"==e.tagName&&At(e).dispatch("blur"));var o="radio"==e.type?e.nextSibling:e;Re.point(o).text("Not changed: "+(r.message||r)).draw();var a={};a[t.property]=i,ec.preview_pane.setState(a,(function(r){if(r)return console.error("Failed to revert setting "+t.property+" to value: "+i),void(n=!1);ec.preview_pane.update((function(r){if(r)return console.error("Failed to update after reverting setting "+t.property+" to value: "+i),void(n=!1);hc(e,i),n=!1}))}))})):(e.value=i,void(n=!1))}))})).on("keydown",(function(t){ec.confirm.blank(),13==t.keyCode&&Re.hide()})).on("blur",(function(){if(!n){var e=this;Re.hide(),ec.preview_pane.getState(t.property,(function(n,r){n?console.error("Failed to get state property "+t.property,n):hc(e,r)}))}}))}}function fc(t,e,n){if(t.classList.contains("colors"))return Yu.getValue(t);if(t.classList.contains("font-menu")){var r=Ya.getValue(t);return e&&!r?n?null:"":r}if(t.classList.contains("buttons-container")){for(var i,o=t.querySelectorAll("input[type='radio']"),a=0;a<o.length;a++)if(o[a].checked){i=o[a];break}if(!i)return n?null:"";t=i}switch(t.getAttribute("type")){case"checkbox":return t.checked;case"number":return e&&!t.value.length?n?null:"":+t.value;case"radio":if(t.parentNode.parentNode.classList.contains("option-type-boolean"))return"true"==t.value;default:return e&&t.classList.contains("color")&&!t.value.length?n?null:"":t.hasAttribute("data-value")?t.getAttribute("data-value"):t.value}}function hc(t,e){if(t.classList.contains("colors"))Yu.update(t,e);else if(t.classList.contains("font-menu"))Ya.update(t,e);else if("checkbox"==t.getAttribute("type"))t.checked=e;else if(t.classList.contains("color"))t.value=e,At(t.parentNode).select(".color-picker").classed("is-null",null===e),At(t.parentNode).select(".color-wrapper input").node().value=e;else if(t.getAttribute("data-autocomplete")){for(var n=function(t){for(var e=0;e<ec.settings.length;e++){var n=ec.settings[e];if(n.property===t)return n}}(t.name),r=0;r<n.choices.length;r++){var i,o,a=n.choices[r];if("string"==typeof a?i=o=a:(i=a[1],o=a[0]),e==i)return t.value=o,t.setAttribute("data-value",i),void(t._dropdown&&t._dropdown.setSelectedOptions(a))}t.value=e,t.setAttribute("data-value",e)}else if(t.className.indexOf("buttons-container")>-1){var s=t.querySelectorAll("input[type='radio']");for(r=0;r<s.length;r++)s[r].value===""+e&&(s[r].checked=!0)}else t.value=e}function mc(t,e){var n=At(e);if("string"!=typeof t){var r=t[2];if(r)if(r.match(ac))n.append("i").attr("class","fa "+r);else if(r.match(sc))n.append("img").attr("src",r);else if(r.match(lc)){var i=r.replace("gradient:","");n.append("div").attr("class","gradient-swatch").style("width","15px").style("height","15px").style("margin-right","5px").style("border-radius","15px").style("background","linear-gradient(to right, "+i+")")}var o=t[0];o.match(ac)?n.append("i").attr("class","fa "+o):o.match(sc)?n.append("img").attr("src",o):n.node().append(o)}else n.text(t)}function gc(t,e,n){var r={},i=fc(t,e.optional);if(r[e.property]=i,!("choices"in e)||"colors"===e.type||function(t,e){return!!t.choices_other||-1!==t.choices.map((function(t){return t instanceof Array?t[1]:t})).indexOf(e)}(e,i)){ec.confirm.saving();var o=!1,a={};a[e.property]=fc(t,e.optional,!0),ec.preview_pane.setState(a,(function(t){if(t)return s(t);ec.preview_pane.update((function(t){if(t)return s(t);ec.visualisation.updateSettings(r,(function(t){if(t)return s(t);ec.analytics("event","visualisation",{change_setting:ec.visualisation.id}),bc(),ec.confirm.saved(),n&&n()}))}))}))}else n&&n("You can only choose values from the list");function s(r){o||(ec.preview_pane.getState(e.property,(function(e,i){if(e)return console.error("Failed to get state",e),void ec.confirm.error(e);hc(t,i),bc(),ec.confirm.blank(),n&&n(r)})),o=!0)}}function vc(t,e){return/^data\./.test(t)?function(t,e){var n=t.split(".");return ec.visualisation.__sdk__?function(t,e){if(t.length>=4)return;for(var n=null,r=ec.template_data_bindings,i=0;i<r.length;i++){var o=r[i];if("string"!=typeof o&&(o.dataset===t[1]&&o.key===t[2])){n=o;break}}if(!n)throw new Error("Bug: data binding not found - these should already have been checked");return"column"===n.type?!!n.column===e:!!n.columns.split("::")[1]===e}(n,e):function(t,e){if(t.length<4){return!!document.getElementById("data-binding-"+t[1]+"-"+t[2]).value===e}if("type"!==t[3])throw new Error("Fourth part of name must be “type”");var n=ec.visualisation.template_id,r=ec.visualisation.data_bindings[n][t[1]][t[2]];if(null==r)return!1;for(var i,o=ec.visualisation.data_tables,a=r.data_table_id,s=r.columns||[r.column],l=0;l<o.length;l++)if(o[l].id===a){i=o[l].column_types;break}var u=!1;for(l=0;l<s.length;l++){var c=i[s[l]].type_id.split("$")[0];if(u=-1!==(Array.isArray(e)?e:[e]).indexOf(c))break}return u}(n,e)}(t,e):function(t,e){var n=document.getElementById("setting-"+t);if(!n)return console.error("Could not find input for setting",t),!1;var r=fc(n);if(e instanceof Array)return-1!==e.indexOf(r);return r===e}(t,e)}function yc(t){if("boolean"==typeof t)return t;if("string"==typeof t)return vc(t,!0);if("object"==typeof t){for(var e in t)if(!vc(e,t[e]))return!1;return!0}}function bc(){ec.settings.filter((function(t){return"object"==typeof t&&"show_condition"in t})).forEach((function(t){var e=t.show_condition.every((function(t){var e="show"===t.type;let n=t.condition;Array.isArray(n)||(n=[n]);for(let t=0;t<n.length;t++){if(yc(n[t]))return e}return!e})),n=document.getElementById("setting-"+t.property);if(n){for(var r=n;!r.classList.contains("settings-option");)r=r.parentNode;if(At(r).classed("hidden",!e),t.new_section)for(var i=r.previousSibling;i&&(At(i).classed("settings-divider")||At(i).classed("settings-subhead"));)At(i).classed("hidden",!e),i=i.previousSibling}else console.error("Could not find input",t.property)}));for(var t=document.querySelectorAll(".template-settings .settings-block, .template-settings .toplevel-settings-block"),e=0;e<t.length;e++){var n=t[e];n.classList.contains("hidden")?null!==n.querySelector(".settings-option:not(.hidden)")&&n.classList.remove("hidden"):null==n.querySelector(".settings-option:not(.hidden)")&&n.classList.add("hidden")}}function _c(t,e,n){return ec=t,nc={setup:Ta,addButton:La,startUpload:Fa},(rc=At(".side-panel .template-settings")).on("submit",(function(t){t.preventDefault()})),Yu.replaceThemeColors(e),Ya.replaceThemeFonts(n),cc(ec.settings),function(){function t(e,n){return!e||e.classList.contains("template-settings")?null:e.classList.contains(n)?e:t(e.parentNode,n)}function e(t){return t.replace(/ /g,"").replace(/-/g,"").toLowerCase().trim()}At(".side-panel .template-settings-search").on("input",(function(n){var r=e(n.target.value),i=!r,o=At(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden) h3, .settings-subhead:not(.hidden)");At(".side-panel .template-settings").selectAll(".settings-block:not(.hidden) > h2, .settings-option:not(.hidden), .settings-subhead:not(.hidden), .settings-divider:not(.hidden)").classed("search-filtered-out",!i),i||o.filter((function(){var t=e(this.innerText);return!!t&&t.indexOf(r)>-1})).each((function(){var e=t(this,"settings-block"),n=At(this);if("H2"==this.tagName)e&&At(e).selectAll("h2, .settings-option, .settings-subhead, .settings-divider").classed("search-filtered-out",!1);else if("H3"==this.tagName)if(e&&At(e).select("h2").classed("search-filtered-out",!1),n.classed("settings-subhead")){n.classed("search-filtered-out",!1),this.previousSibling.classList.remove("search-filtered-out");for(var r=this.nextSibling;r&&r.classList.contains("settings-option");)r.classList.remove("search-filtered-out"),r=r.nextSibling}else{var i=t(this,"settings-option");if(i){i.classList.remove("search-filtered-out");for(var o=null,a=i.previousSibling;a&&null==o;)a.classList.contains("settings-subhead")?o=a:a=a.classList.contains("settings-divider")?null:a.previousSibling;o&&(o.classList.remove("search-filtered-out"),o.previousSibling.classList.remove("search-filtered-out"))}}}))}))}(),At(".side-panel-scrollbox").on("scroll",(function(){Re.hide()})),{update:function(t){rc.html(""),At(".current-template").style("opacity","1"),cc(ec.settings=t)},populate:function(){ec.preview_pane.getState((function(t,e){if(t)console.error("Failed to get state",t);else{var n=qo(e);for(var r in n){var i=document.getElementById("setting-"+r);i&&hc(i,n[r])}ic.updateDataBindings(),bc()}}))},getSettingsForCurrentTemplate:function(){return oc},setReadOnly:function(){Et(".setting").each((function(){At(this).attr("disabled",!0)}))},unsetReadOnly:function(){Et(".setting").each((function(){At(this).attr("disabled",null)}))}}}var wc,xc,Cc=!1,Ac=[];function kc(){At(".flourish-warn-list").classed("visible",!1),Cc=!1}function Ec(){return At(".flourish-warn-btn").on("click",(function(){Cc?kc():(At(".flourish-warn-list").classed("visible",!0),Cc=!0)})),{clear:Lc,warn:Dc}}function Tc(){At(".flourish-warn-container").classed("visible",Ac.length),Ac.length>100&&(Ac.length=100);var t=At(".flourish-warn-list ul").selectAll("li").data(Ac),e=t.enter().append("li");e.append("i").attr("class","fa fa-warning"),e.append("p").attr("class","message"),e.append("p").attr("class","explanation");var n=t.merge(e);n.select(".message").text((function(t){return t.message||""})),n.select(".explanation").text((function(t){return t.explanation||""})),t.exit().remove()}function Lc(){Ac=[],Tc(),kc()}function Dc(t){Ac.unshift(t),Tc()}function Fc(t){var e=wc.visualisation,n=e.getTemplate(),r=!1,i=!1,o=!1;function a(){var e=wc.template_settings.getSettingsForCurrentTemplate(),n=wc.visualisation.settingsForCurrentTemplate(),r={};for(var i in n)i in e&&(r[i]=n[i]);xc.loadVisualisation(wc,r,(function(){wc.template_settings.populate(),wc.data_bindings.updateRequiredBindingsOverlay(!1),xa(),t&&t()})),St()}n.getSettings((function(t,e){t?console.error("Failed to get template settings: "+t):(wc.template_settings.update(e),r=!0,i&&o&&a())})),n.getDataBindings((function(t,e){t?console.error("Failed to get template data bindings: "+t):(wc.data_bindings.update(e),i=!0,r&&o&&a())})),e.refreshDataBindings((function(t){t?console.error("Failed to get template data bindings: "+t):(o=!0,i&&r&&a())}))}function Sc(t){xc.updateData(wc.visualisation,t)}function Mc(t){xc.updateDataNotPreview(wc.visualisation,t)}function Nc(t){wc=t;var e=Ec();return{loadTemplate:Fc,updateData:Sc,updateDataNotPreview:Mc,sync:(xc=_a("iframe#preview","editor",wc,e,{setSetting({name:t,value:e}){const n=function(t){return document.getElementById("setting-"+t)}(t);n?(hc(n,e),n.dispatchEvent(new Event("change"))):console.log(`Could not find setting ${t}`)}})).sync,setState:xc.setState,getState:xc.getState,hasData:xc.hasData,setData:xc.setData,getData:xc.getData,draw:xc.draw,update:xc.update,getDefaultState:xc.getDefaultState,snapshot:xc.snapshot,setFixedHeight:xc.setFixedHeight,resize:xc.resize,getDrawCalled:xc.getDrawCalled,setDrawCalled:xc.setDrawCalled}}var Uc={},Oc={};function Bc(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function Hc(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function Rc(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function jc(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+Rc(-t,6):t>9999?"+"+Rc(t,6):Rc(t,4)}(t.getUTCFullYear())+"-"+Rc(t.getUTCMonth()+1,2)+"-"+Rc(t.getUTCDate(),2)+(i?"T"+Rc(e,2)+":"+Rc(n,2)+":"+Rc(r,2)+"."+Rc(i,3)+"Z":r?"T"+Rc(e,2)+":"+Rc(n,2)+":"+Rc(r,2)+"Z":n||e?"T"+Rc(e,2)+":"+Rc(n,2)+"Z":"")}var Ic=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,u=!1;function c(){if(l)return Oc;if(u)return u=!1,Uc;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?u=!0:13===r&&(u=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))u=!0;else if(13===r)u=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Oc;){for(var d=[];r!==Uc&&r!==Oc;)d.push(r),r=c();e&&null==(d=e(d,s++))||i.push(d)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?jc(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Bc(t);return function(r,i){return e(n(r),i,t)}}(t,e):Bc(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Hc(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Hc(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),zc=Ic.parseRows,Pc=Ic.formatRows;function $c(t,e,n){is(this,"object"==typeof e?(n=e).id:e,void 0,n,{getVersionNumber:function(){return t.version_number},setVersionNumber:function(e){t.version_number=e}}),this.visualisation=t,this.api_prefix="/api/data_table"}function qc(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?qc(t):t}))}function Vc(t){this.id=t}function Yc(t,e,n,r=null){if(is(this,t,e,n),this.api_prefix="/api/visualisation",this.slide_id=r,this.data_tables){var i=this;this.data_tables=this.data_tables.map((function(t){return new $c(i,t)}))}}function Wc(t,e,n){us({url:t.api_prefix+"/"+t.id+"/data_bindings",method:"POST",payload:function(){return{version_number:t.version_number,data_bindings:e}},callback:function(r,i){if(r)return n(r);t.version_number=i.version_number,t.data_bindings||(t.data_bindings={}),t.template_id in t.data_bindings||(t.data_bindings[t.template_id]={});var o=t.data_bindings[t.template_id];for(var a in e)for(var s in e[a]){var l=e[a][s];o[a]||(o[a]={}),null===l?delete o[a][s]:o[a][s]=l}n(void 0)}})}function Gc(t,e,n){us({url:t.api_prefix+"/"+t.id+"/settings",payload:function(){return{version_number:t.version_number,settings:e}},callback:function(r,i){if(r)return n(r);t.version_number=i.version_number,t.settings||(t.settings={}),t.template_id in t.settings||(t.settings[t.template_id]={});var o=t.settings[t.template_id];for(var a in e){var s=e[a];o[a]=s}n(void 0)}})}function Zc(t,e,n,r){us({url:t.api_prefix+"/"+t.id+"/publish",payload:function(){return{password:n,anyone_can_duplicate:r}},callback:function(n,r){if(n)return e(n);t.version_number=r.version_number,t.embed_url=r.embed_url,t.showcase_url=r.showcase_url,t.is_password_protected=r.is_password_protected,t.anyone_can_duplicate=r.anyone_can_duplicate,e(void 0,r)}})}function Xc(t,e){for(var n in e)"object"!=typeof t[n]||null==t[n]||Array.isArray(t[n])||"object"!=typeof e[n]||null==e[n]||Array.isArray(e[n])?t[n]=e[n]:Xc(t[n],e[n])}function Jc(t,e,n,r){function i(){}this.visualisation=t,this.settings=e,this.template_data_bindings=n,this.public_url_prefix=r,this.is_read_only=!1,this.template_settings=_c(this),this.data_bindings=(Qi=this,to=At(".data-bindings"),{update:function(t){t&&(Qi.template_data_bindings=t),ao(Qi.visualisation,Qi.template_data_bindings)},modify:function(t,e=!1){lo(t,(function(){ao(Qi.visualisation,Qi.template_data_bindings),e&&Qi.preview_pane.updateData((t=>{if(t)return console.error("Failed to update preview pane: "+t)}))}))},requiredBindingsAreUnset:po,updateRequiredBindingsOverlay:fo}),this.preview_pane=Nc(this),this.responsive_menu=Ft(this),this.confirm={on:i,blank:i,saved:i,saving:i,error:i},this.analytics=i,this.tour={fireEvent:i},window.addEventListener("hashchange",(()=>{this.loadFromUrlHash()}))}$c.prototype.getColumnTypes=function(t){us({url:this.api_prefix+"/"+this.id,method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,qc(n.column_types||[]))}},"load-data")},$c.prototype.csv=function(t,e=null){this.cached_data?t(void 0,qc(this.cached_data)):this.csvPromise(e).then((e=>t(null,e)),(e=>t(e)))},$c.prototype.csvPromise=async function(t=null){if(this.cached_data)return qc(this.cached_data);const e=this;let n=this.api_prefix+"/"+this.id+"/csv";return t&&(n="/api/slide/"+t+"/data_table/"+this.id+"/csv"),new Promise(((t,r)=>{us({url:n,response_type:"text/csv; charset=utf-8",method:"GET",callback(n,i){if(n)return r(n);e.cached_data=zc(i),t(qc(e.cached_data))}},"load-data")}))},$c.prototype.saveData=function(t,e){var n=this,r=Ii(qc(t));us({url:this.api_prefix+"/"+this.id+"/csv",payload:function(){return{version_number:n.getVersionNumber(),data:Pc(r)}},callback:function(t,i){if(t)return e(t);n.setVersionNumber(i.version_number),n.cached_data=r,e(void 0)}})},$c.prototype.updateFromUrl=function(t,e){var n=this;us({url:this.api_prefix+"/"+this.id+"/csv-url",payload:function(){return{live_csv_url:t,version_number:n.getVersionNumber()}},callback:function(r,i){if(r)return e(r);n.setVersionNumber(i.version_number),n.live_csv_url=t,t?n.updateFromLiveCsvUrl((function(t,r){if(t)return n.last_remote_data_error_message=t,e(t);var i=function(t){Ii(t);for(let e of t)for(let t=0;t<e.length;t++){let n=e[t];null==n&&(n=""),"string"!=typeof n&&(n=""+n),e[t]=n.trim()}return t}(zc(r.csv));n.cached_data=i,n.setVersionNumber(r.version_number),n.t_updated=r.t_updated,n.last_remote_data_error_message=null,e(void 0,i,r.new_column_types)})):(n.t_updated=i.t_updated,n.last_remote_data_error_message=null,e(void 0,null,null))}})},$c.prototype.updateFromLiveCsvUrl=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/update-from-live-csv-url",payload:function(){return{version_number:e.getVersionNumber()}},callback:function(n,r){if(n)return t(n);e.setVersionNumber(r.version_number),t(void 0,r)}})},$c.prototype.save=function(t,e){return ds(this,t,e)},$c.prototype.delete=function(t){return ps(this,t)},Vc.prototype.getSettings=function(t){if(this.settings)t(void 0,this.settings);else{var e=this;us({url:"/api/template/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r.settings,t(void 0,e.settings)}})}},Vc.prototype.getDataBindings=function(t){us({url:"/api/template/"+this.id+"/data_bindings",method:"GET",callback:t})},Yc.prototype.save=function(t,e){this.is_listed||(t.is_listed=!0),ds(this,t,e)},Yc.prototype.setTemplateId=function(t,e){ds(this,{template_id:t},e)},Yc.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new Vc(this.template_id)),this._template):null},Yc.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},Yc.prototype.getState=function(t){this.template_id||t({});var e=this.settingsForCurrentTemplate();this.getTemplate().getSettings((function(n,r){if(n)throw n;for(var i={},o=0;o<r.length;o++){var a=r[o];a.property in e&&(i[a.property]=e[a.property])}t(Vo(i))}))},Yc.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},Yc.prototype.refreshDataBindings=function(t){var e=this;let n=this.api_prefix+"/"+this.id;this.slide_id&&(n="/api/slide/"+this.slide_id+"/visualisation"),us({url:n+"/data_bindings",method:"GET",callback:function(n,r){if(n)return t(n);e.data_bindings=r,t()}})},Yc.prototype.resetToTheme=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/reset_to_theme",method:"POST",payload:function(){return{version_number:e.version_number}},callback:function(n,r){if(n)return t(n);e.version_number=r.version_number,t(void 0)}})},Yc.prototype.updateDataBindings=function(t,e){var n=this;if(this.is_listed)return Wc(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):Wc(n,t,e)}))},Yc.prototype.updateSettings=function(t,e){var n=this;if(this.is_listed)return Gc(n,t,e);this.save({is_listed:!0},(function(r){return r?e(r):Gc(n,t,e)}))},Yc.prototype.refreshSettings=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/settings",method:"GET",callback:function(n,r){if(n)return t(n);e.settings=r,t()}})},Yc.prototype.getThemeFontsAndColors=function(t){us({url:this.api_prefix+"/"+this.id+"/theme-fonts-and-colors",method:"GET",callback:function(e,n){if(e)return t(e);t(void 0,n.fonts,n.colors)}})},Yc.prototype.getDataTables=function(t){let e=this.api_prefix+"/"+this.id;this.slide_id&&(e="/api/slide/"+this.slide_id+"/visualisation"),us({url:e+"/data",method:"GET",callback:function(e,n){return e?t(e):t(void 0,n.data)}})},Yc.prototype.dataTables=function(t){var e=this;e.data_tables?t(void 0,e.data_tables):(e.after_loading_data_tables||(e.after_loading_data_tables=[]),e.after_loading_data_tables.push(t),e.after_loading_data_tables.length>1||e.getDataTables((function(t,n){if(t){for(var r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](t);e.after_loading_data_tables=[]}else{e.data_tables=n.map((function(t){return new $c(e,t)}));for(r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](void 0,e.data_tables);e.after_loading_data_tables=[]}})))},Yc.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},Yc.prototype.prepareData=function(t){var e=this;if(!e.data_bindings)throw new Error("No data bindings loaded");var n=e.template_id;e.dataTables((function(r,i){if(r)return t(r);if(e.template_id==n){for(var o={},a={},s=0,l=0;l<i.length;l++)!function(r){a[r.id]=r.column_types,r.csv((function(l,u){if(l)throw l;e.template_id==n&&(o[r.id]=u,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var i={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in i||(i[t.dataset]={}),i[t.dataset][t.key]=t)}));var s={},l=e.dataBindingsForCurrentTemplate();for(var u in l)s[u]=Ri(l[u],o,a,i[u]);for(u in i)s[u]||(s[u]=[],s[u].column_names={},s[u].metadata={});t(void 0,s)})))}),e.slide_id)}(i[l]);0==i.length&&t(void 0,{})}}))},Yc.prototype.delete=function(t){ps(this,t)},Yc.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.id]=r.name}return e}(this.data_tables)),this.data_table_names},Yc.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.name]=r.id}return e}(this.data_tables)),this.data_table_ids},Yc.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0},Yc.prototype.duplicate=function(t){us({url:this.api_prefix+"/"+this.id+"/duplicate",callback:t})},Yc.prototype.deleteCanvaEmbed=function(t){us({url:this.api_prefix+"/"+this.id+"/delete_canva_embed",callback:t})},Yc.prototype.publish=function(t,e,n){var r=this;if(this.is_listed)return Zc(r,t,e,n);this.save({is_listed:!0},(function(i){return i?t(i):Zc(r,t,e,n)}))},Yc.prototype.unpublish=function(t){var e=this;us({url:this.api_prefix+"/"+this.id+"/unpublish",callback:function(n,r){if(n)return t(n);e.version_number=r.version_number,e.embed_url=r.embed_url,e.showcase_url=r.showcase_url,t(void 0,r)}})},Yc.prototype.published=function(){return!!this.showcase_url},Yc.prototype.sendForReview=function(t,e,n){var r=this;us({url:"/api/reviews",payload:function(){return{project_id:r.id,project_type:"visualisation",reviewers:t,message:e}},callback:function(t,e){r.status=e,n(t,e)}})},Yc.prototype.approve=function(t,e){var n=this;us({url:"/api/review/"+t+"/approve",callback:function(t,r){return n.status=r,e(t,r)}})},Yc.prototype.decline=function(t,e,n){var r=this;us({url:"/api/review/"+t+"/decline",payload:function(){return{message:e}},callback:function(t,e){r.status=e,n(t,e)}})},Yc.prototype.cancelReview=function(t,e){var n=this;us({url:"/api/review/"+t+"/cancel",callback:function(t,r){n.status=r,e(t,r)}})},Yc.list=function(t){us({url:"/api/visualisations",method:"GET",callback:t})},Yc.getById=function(t,e){us({url:"/api/visualisation/"+t,method:"GET",callback:function(n,r){if(n)return e(n);e(void 0,new Yc(t,r.version_number,r))}})},Yc.getPublishedJson=function(t,e,n){us({url:`${e}visualisation/${t}/visualisation.json`,method:"GET",callback(t,e){if(t)return n(t);n(void 0,e)}})},Yc.createFromTemplate=function(t,e){us({url:"/api/template/"+t+"/visualisations",method:"PUT",callback:e})},Yc.createFromVisualisation=function(t,e){us({url:"/api/visualisation/"+t+"/duplicate",callback:e})},Yc.setAsStaffPick=function(t,e){us({url:"/api/visualisation/"+t+"/set_staff_pick",method:"POST",callback:e})},Yc.unsetAsStaffPick=function(t,e){us({url:"/api/visualisation/"+t+"/unset_staff_pick",method:"POST",callback:e})},Yc.setFolder=function(t,e,n){us({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e),method:"PUT",callback:n})},Yc.removeFolder=function(t,e,n){us({url:"/api/visualisation/"+t+"/folder/"+encodeURIComponent(e),method:"DELETE",callback:n})},Yc.removeTag=function(t,e,n){us({url:"/api/visualisation/"+t+"/tag/"+encodeURIComponent(e),method:"DELETE",callback:n})},Yc.prototype.updateCompanyAccess=function(t,e,n={}){us({url:"/api/visualisation/"+this.id+"/company_access",method:"POST",callback:e,payload:function(){return{company_access:t,options:n}}})},Yc.prototype.getTags=function(t){us({url:"/api/visualisation/"+this.id+"/tags",method:"GET",callback:t})},Yc.prototype.setTags=function(t,e){us({url:"/api/visualisation/"+this.id+"/tags",method:"PUT",callback:e,payload:function(){return{tags:t}}})},Jc.prototype.loadFromUrlHash=async function(){if(!window.location.hash)return;const t=window.location.hash.slice(1),e=(n=Yc.getPublishedJson,function(...t){return new Promise(((e,i)=>{n.call(r,...t,(function(t,n){if(t)return i(t);e(n)}))}))});var n,r;try{const n=await e(t,this.public_url_prefix);this.updateFromJson(n)}catch(t){console.error(t)}},Jc.prototype.updateFromJson=function({state:t,bindings:e,data:n}){const r={};for(const[t,i]of Object.entries(e)){const e={},a={};for(const[t,n]of Object.entries(i))Array.isArray(n)?a[t]=n:e[t]=n;const s=o(n[t],e,a);r[t]=s}const i={};Xc(i,this.preview_pane.getDefaultState()),Xc(i,t),this.preview_pane.sync({state:i,data:r,overwrite_state:!0,update:!0},(()=>this.template_settings.populate()))};var Kc={},Qc={};function td(t){return new Function("d","return {"+t.map((function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'})).join(",")+"}")}function ed(t){var e=Object.create(null),n=[];return t.forEach((function(t){for(var r in t)r in e||n.push(e[r]=r)})),n}function nd(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function rd(t){var e=t.getUTCHours(),n=t.getUTCMinutes(),r=t.getUTCSeconds(),i=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":function(t){return t<0?"-"+nd(-t,6):t>9999?"+"+nd(t,6):nd(t,4)}(t.getUTCFullYear())+"-"+nd(t.getUTCMonth()+1,2)+"-"+nd(t.getUTCDate(),2)+(i?"T"+nd(e,2)+":"+nd(n,2)+":"+nd(r,2)+"."+nd(i,3)+"Z":r?"T"+nd(e,2)+":"+nd(n,2)+":"+nd(r,2)+"Z":n||e?"T"+nd(e,2)+":"+nd(n,2)+"Z":"")}var id=function(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,u=!1;function c(){if(l)return Qc;if(u)return u=!1,Kc;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?u=!0:13===r&&(u=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))u=!0;else if(13===r)u=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=c())!==Qc;){for(var d=[];r!==Kc&&r!==Qc;)d.push(r),r=c();e&&null==(d=e(d,s++))||i.push(d)}return i}function i(e,n){return e.map((function(e){return n.map((function(t){return a(e[t])})).join(t)}))}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?rd(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,(function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=td(t);return function(r,i){return e(n(r),i,t)}}(t,e):td(t)}));return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=ed(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=ed(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}(","),od=id.parseRows,ad="$";function sd(){}function ld(t,e){var n=new sd;if(t instanceof sd)t.each((function(t,e){n.set(e,t)}));else if(Array.isArray(t)){var r,i=-1,o=t.length;if(null==e)for(;++i<o;)n.set(i,t[i]);else for(;++i<o;)n.set(e(r=t[i],i,t),r)}else if(t)for(var a in t)n.set(a,t[a]);return n}function ud(){}sd.prototype=ld.prototype={constructor:sd,has:function(t){return ad+t in this},get:function(t){return this[ad+t]},set:function(t,e){return this[ad+t]=e,this},remove:function(t){var e=ad+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===ad&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===ad&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===ad&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===ad&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===ad&&++t;return t},empty:function(){for(var t in this)if(t[0]===ad)return!1;return!0},each:function(t){for(var e in this)e[0]===ad&&t(this[e],e.slice(1),this)}};var cd=ld.prototype;ud.prototype={constructor:ud,has:cd.has,add:function(t){return this[ad+(t+="")]=t,this},remove:cd.remove,clear:cd.clear,values:cd.keys,size:cd.size,empty:cd.empty,each:cd.each};var dd,pd,fd={value:function(){}};function hd(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new md(r)}function md(t){this._=t}function gd(t,e){return t.trim().split(/^|\s+/).map((function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}}))}function vd(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function yd(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=fd,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}function bd(t,e,n){var r;r="object"==typeof e?e.id:e,this.id=r,this.visualisation=t,this.api_prefix="/api/data_table"}function _d(t){return t.map((function(t){return null!=t&&"object"==typeof t&&"map"in t?_d(t):t}))}function wd(t){this.id=t}function xd(t,e,n){var r=this;r.id=1,r.template_id=1,r.api_prefix="/api/visualisation",r.can_edit=!0,r.__sdk__=!0,n.data_tables&&(this.data_tables=n.data_tables.map((function(t){return new bd(r,t)}))),n.data_bindings&&(this.data_bindings=n.data_bindings)}md.prototype=hd.prototype={constructor:md,on:function(t,e){var n,r=this._,i=gd(t+"",r),o=-1,a=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=i[o]).type)r[n]=yd(r[n],t.name,e);else if(null==e)for(n in r)r[n]=yd(r[n],t.name,null);return this}for(;++o<a;)if((n=(t=i[o]).type)&&(n=vd(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new md(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}},bd.prototype.csv=function(t){if(this.cached_data)t(void 0,_d(this.cached_data));else{var e=this;!function(t,e){var n,r,i,o,a=hd("beforesend","progress","load","error"),s=ld(),l=new XMLHttpRequest,u=null,c=null,d=0;function p(t){var e,r=l.status;if(!r&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||r>=200&&r<300||304===r){if(i)try{e=i.call(n,l)}catch(t){return void a.call("error",n,t)}else e=l;a.call("load",n,e)}else a.call("error",n,t)}if("undefined"!=typeof XDomainRequest&&!("withCredentials"in l)&&/^(http(s)?:)?\/\//.test(t)&&(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=l.ontimeout=p:l.onreadystatechange=function(t){l.readyState>3&&p(t)},l.onprogress=function(t){a.call("progress",n,t)},n={header:function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s.get(t):(null==e?s.remove(t):s.set(t,e+""),n)},mimeType:function(t){return arguments.length?(r=null==t?null:t+"",n):r},responseType:function(t){return arguments.length?(o=t,n):o},timeout:function(t){return arguments.length?(d=+t,n):d},user:function(t){return arguments.length<1?u:(u=null==t?null:t+"",n)},password:function(t){return arguments.length<1?c:(c=null==t?null:t+"",n)},response:function(t){return i=t,n},get:function(t,e){return n.send("GET",t,e)},post:function(t,e){return n.send("POST",t,e)},send:function(e,i,p){return l.open(e,t,!0,u,c),null==r||s.has("accept")||s.set("accept",r+",*/*"),l.setRequestHeader&&s.each((function(t,e){l.setRequestHeader(e,t)})),null!=r&&l.overrideMimeType&&l.overrideMimeType(r),null!=o&&(l.responseType=o),d>0&&(l.timeout=d),null==p&&"function"==typeof i&&(p=i,i=null),null!=p&&1===p.length&&(p=function(t){return function(e,n){t(null==e?n:null)}}(p)),null!=p&&n.on("error",p).on("load",(function(t){p(null,t)})),a.call("beforesend",n,l),l.send(null==i?null:i),n},abort:function(){return l.abort(),n},on:function(){var t=a.on.apply(a,arguments);return t===a?n:t}},null!=e){if("function"!=typeof e)throw new Error("invalid callback: "+e);return n.get(e)}}(this.api_prefix+"/"+this.id+"/csv",(function(n,r){e.cached_data=od(r.response),t(void 0,_d(e.cached_data))}))}},bd.prototype.saveData=function(t,e){e()},bd.prototype.save=function(t,e){e()},bd.prototype.delete=function(t){t()},wd.prototype.getSettings=function(t){t(void 0,window.Flourish.app.settings)},wd.prototype.getDataBindings=function(t){t(void 0,window.Flourish.app.template_data_bindings)},wd.prototype.refreshDataBindings=function(t){t(void 0)},xd.prototype.save=function(t,e){this.version_number++,e(void 0)},xd.prototype.getTemplate=function(){return this.template_id?(this._template&&this.template_id==this._template.id||(this._template=new wd(this.template_id)),this._template):null},xd.prototype.settingsForCurrentTemplate=function(){return this.settings&&this.template_id in this.settings?this.settings[this.template_id]:{}},xd.prototype.dataBindingsForCurrentTemplate=function(){return this.data_bindings&&this.template_id in this.data_bindings?this.data_bindings[this.template_id]:{}},xd.prototype.refreshDataBindings=function(t){t()},xd.prototype.updateDataBindings=function(t,e){var n=this;n.version_number++,n.data_bindings||(n.data_bindings={}),n.template_id in n.data_bindings||(n.data_bindings[n.template_id]={});var r=n.data_bindings[n.template_id];for(var i in t)for(var o in t[i]){var a=t[i][o];r[i][o]=a}e(void 0)},xd.prototype.updateSettings=function(t,e){var n=this;n.version_number++,n.settings||(n.settings={}),n.template_id in n.settings||(n.settings[n.template_id]={});var r=n.settings[n.template_id];for(var i in t){var o=t[i];r[i]=o}e(void 0)},xd.prototype.getDataTables=function(t){t(void 0,window.Flourish.app.data_tables)},xd.prototype.dataTables=function(t){var e=this;e.data_tables?t(void 0,e.data_tables):(e.after_loading_data_tables||(e.after_loading_data_tables=[]),e.after_loading_data_tables.push(t),e.after_loading_data_tables.length>1||e.getDataTables((function(t,n){if(t){for(var r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](t);e.after_loading_data_tables=[]}else{e.data_tables=n.map((function(t){return new bd(e,t)}));for(r=0;r<e.after_loading_data_tables.length;r++)e.after_loading_data_tables[r](void 0,e.data_tables);e.after_loading_data_tables=[]}})))},xd.prototype.refreshDataTables=function(){this.data_tables=void 0,this.dataTablesHaveChanged()},xd.prototype.prepareData=function(t){var e=this;if(!e.data_bindings)throw new Error("No data bindings loaded");var n=e.template_id;e.dataTables((function(r,i){if(r)return t(r);if(e.template_id==n){for(var o={},a={},s=0,l=0;l<i.length;l++)!function(r){r.csv((function(l,u){if(l)throw l;e.template_id==n&&(a[r.id]=ji(u),o[r.id]=u,++s==i.length&&e.getTemplate().getDataBindings((function(n,r){if(n)throw n;var i={};r.forEach((function(t){"string"!=typeof t&&(t.dataset in i||(i[t.dataset]={}),i[t.dataset][t.key]=t)}));var s={},l=e.dataBindingsForCurrentTemplate();for(var u in l)s[u]=Ri(l[u],o,a,i[u]);for(u in i)s[u]||(s[u]=[],s[u].column_names={},s[u].metadata={});t(void 0,s)})))}))}(i[l]);0==i.length&&t(void 0,{})}}))},xd.prototype.getDataTableNames=function(){return void 0===this.data_table_names&&(this.data_table_names=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.id]=r.name}return e}(this.data_tables)),this.data_table_names},xd.prototype.getDataTableIds=function(){return void 0===this.data_table_ids&&(this.data_table_ids=function(t){for(var e={},n=0;n<t.length;n++){var r=t[n];e[r.name]=r.id}return e}(this.data_tables)),this.data_table_ids},xd.prototype.dataTablesHaveChanged=function(){this.data_table_names=this.data_table_ids=void 0};var Cd=!1;function Ad(){dd&&dd.classList.remove("shown")}function kd(){this.close(),Cd||(dd&&setTimeout((function(){dd.classList.add("shown")}),1e3),setTimeout(Ed,250))}function Ed(){Td().addEventListener("open",(function(){window.location.reload()}))}function Td(){var t=new window.WebSocket(pd);return t.addEventListener("open",Ad),t.addEventListener("close",kd),t}return t.Visualisation=xd,t.initSDK=function(t,e,n,r){return Ve(),window.Flourish=window.Flourish||{},window.Flourish.app=new Jc(t,e,n,r),window.Flourish.app},t.talkToServer=function(){dd=document.getElementById("error-server-down"),pd=window.location.origin.replace(/^http(s?):\/\//,"ws$1://"),window.addEventListener("beforeunload",(function(){Cd=!0})),Td()},Object.defineProperty(t,"__esModule",{value:!0}),t}({});
|
|
3
3
|
//# sourceMappingURL=script.js.map
|